-
Notifications
You must be signed in to change notification settings - Fork 447
Implement widget borders in vue #7322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b9f52ae
6d027ab
b990033
dc4ec7e
da1f734
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,7 @@ import type { NodeId } from '@/renderer/core/layout/types' | |||||||||||||||||
| import type { InputSpec } from '@/schemas/nodeDef/nodeDefSchemaV2' | ||||||||||||||||||
| import { isDOMWidget } from '@/scripts/domWidget' | ||||||||||||||||||
| import { useNodeDefStore } from '@/stores/nodeDefStore' | ||||||||||||||||||
| import type { WidgetValue } from '@/types/simplifiedWidget' | ||||||||||||||||||
| import type { BorderColor, WidgetValue } from '@/types/simplifiedWidget' | ||||||||||||||||||
|
|
||||||||||||||||||
| import type { | ||||||||||||||||||
| LGraph, | ||||||||||||||||||
|
|
@@ -47,6 +47,7 @@ export interface SafeWidgetData { | |||||||||||||||||
| spec?: InputSpec | ||||||||||||||||||
| slotMetadata?: WidgetSlotMetadata | ||||||||||||||||||
| isDOMWidget?: boolean | ||||||||||||||||||
| borderColor?: BorderColor | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| export interface VueNodeData { | ||||||||||||||||||
|
|
@@ -104,17 +105,22 @@ export function safeWidgetMapper( | |||||||||||||||||
| } | ||||||||||||||||||
| const spec = nodeDefStore.getInputSpecForWidget(node, widget.name) | ||||||||||||||||||
| const slotInfo = slotMetadata.get(widget.name) | ||||||||||||||||||
| const borderColor = | ||||||||||||||||||
| (widget.promoted && 'promoted') || | ||||||||||||||||||
| (widget.advanced && 'advanced') || | ||||||||||||||||||
| undefined | ||||||||||||||||||
|
||||||||||||||||||
| const borderColor = | |
| (widget.promoted && 'promoted') || | |
| (widget.advanced && 'advanced') || | |
| undefined | |
| const borderColor = | |
| widget.promoted ? 'promoted' : | |
| widget.advanced ? 'advanced' : | |
| undefined |
AustinMroz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,14 @@ | |
| :model-value="widget.value" | ||
| :node-id="nodeData?.id != null ? String(nodeData.id) : ''" | ||
| :node-type="nodeType" | ||
| class="flex-1 col-span-2" | ||
| :class=" | ||
| cn( | ||
| 'flex-1 col-span-2', | ||
| widget.borderColor && 'border rounded-lg', | ||
| widget.borderColor === 'promoted' && 'border-fuchsia-600/80', | ||
| widget.borderColor === 'advanced' && 'border-azure-400/80' | ||
|
||
| ) | ||
| " | ||
| @update:model-value="widget.updateHandler" | ||
| /> | ||
| </div> | ||
|
|
@@ -86,7 +93,11 @@ import { | |
| shouldExpand, | ||
| shouldRenderAsVue | ||
| } from '@/renderer/extensions/vueNodes/widgets/registry/widgetRegistry' | ||
| import type { SimplifiedWidget, WidgetValue } from '@/types/simplifiedWidget' | ||
| import type { | ||
| BorderColor, | ||
| SimplifiedWidget, | ||
| WidgetValue | ||
| } from '@/types/simplifiedWidget' | ||
| import { cn } from '@/utils/tailwindUtil' | ||
|
|
||
| import InputSlot from './InputSlot.vue' | ||
|
|
@@ -125,6 +136,7 @@ interface ProcessedWidget { | |
| name: string | ||
| type: string | ||
| vueComponent: Component | ||
| borderColor?: BorderColor | ||
| simplified: SimplifiedWidget | ||
| value: WidgetValue | ||
| updateHandler: (value: WidgetValue) => void | ||
|
|
@@ -184,6 +196,7 @@ const processedWidgets = computed((): ProcessedWidget[] => { | |
| vueComponent, | ||
| simplified, | ||
| value: widget.value, | ||
| borderColor: widget.borderColor, | ||
| updateHandler, | ||
| tooltipConfig, | ||
| slotMetadata | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Could this happen lower down?
Maybe in NodeWidgets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm specifically trying to limit the runaway growth of our SimplifiedWidgets object.
I'd prefer to move in the other direction and convert things into an actual color here, but tailwind doesn't allow that.