@lushly-dev/violet-elements 0.2.0-preview.2 → 0.2.0-preview.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -6
- package/custom-elements.json +23 -2
- package/dist/alert/violet-alert.js +19 -1
- package/dist/alert/violet-alert.js.map +1 -1
- package/dist/badge/violet-badge.js +3 -1
- package/dist/badge/violet-badge.js.map +1 -1
- package/dist/card/violet-card.js +6 -0
- package/dist/card/violet-card.js.map +1 -1
- package/dist/color-picker/violet-color-picker.js +3 -2
- package/dist/color-picker/violet-color-picker.js.map +1 -1
- package/dist/conversation/violet-approval-card.js +18 -4
- package/dist/conversation/violet-approval-card.js.map +1 -1
- package/dist/conversation/violet-chat-composer.js +2 -2
- package/dist/conversation/violet-chat-composer.js.map +1 -1
- package/dist/conversation/violet-chat-suggestions.js +5 -5
- package/dist/conversation/violet-chat-suggestions.js.map +1 -1
- package/dist/conversation/violet-conversation-thread.js +1 -1
- package/dist/conversation/violet-conversation-thread.js.map +1 -1
- package/dist/conversation/violet-message-media.js +4 -4
- package/dist/conversation/violet-message-media.js.map +1 -1
- package/dist/conversation/violet-message-status.js +6 -6
- package/dist/conversation/violet-message-status.js.map +1 -1
- package/dist/conversation/violet-message.js +5 -5
- package/dist/conversation/violet-message.js.map +1 -1
- package/dist/conversation/violet-reasoning-block.js +4 -4
- package/dist/conversation/violet-reasoning-block.js.map +1 -1
- package/dist/conversation/violet-source-citation.js +7 -7
- package/dist/conversation/violet-source-citation.js.map +1 -1
- package/dist/conversation/violet-tool-call-card.js +28 -14
- package/dist/conversation/violet-tool-call-card.js.map +1 -1
- package/dist/conversation/violet-tool-result-card.js +20 -6
- package/dist/conversation/violet-tool-result-card.js.map +1 -1
- package/dist/data-grid/violet-data-grid.styles.js +4 -1
- package/dist/data-grid/violet-data-grid.styles.js.map +1 -1
- package/dist/dialog/violet-dialog.js +6 -0
- package/dist/dialog/violet-dialog.js.map +1 -1
- package/dist/icon/icon-registry.js +19 -0
- package/dist/icon/icon-registry.js.map +1 -1
- package/dist/progress/violet-progress.js +15 -1
- package/dist/progress/violet-progress.js.map +1 -1
- package/dist/skeleton/violet-skeleton.js +3 -1
- package/dist/skeleton/violet-skeleton.js.map +1 -1
- package/dist/snackbar/violet-snackbar.js +14 -0
- package/dist/snackbar/violet-snackbar.js.map +1 -1
- package/dist/tab/violet-tab.js +3 -3
- package/dist/tab/violet-tab.js.map +1 -1
- package/dist/tab-panel/violet-tab-panel.js +14 -2
- package/dist/tab-panel/violet-tab-panel.js.map +1 -1
- package/dist/tabs/violet-tabs.d.ts +5 -0
- package/dist/tabs/violet-tabs.js +13 -5
- package/dist/tabs/violet-tabs.js.map +1 -1
- package/dist/teaching-tip/violet-teaching-tip.js +1 -1
- package/dist/teaching-tip/violet-teaching-tip.js.map +1 -1
- package/dist/text-area/violet-text-area.js +5 -0
- package/dist/text-area/violet-text-area.js.map +1 -1
- package/dist/text-field/violet-text-field.js +5 -0
- package/dist/text-field/violet-text-field.js.map +1 -1
- package/dist/theme/generated/violet-theme.generated.d.ts +15 -15
- package/dist/theme/generated/violet-theme.generated.js +15 -15
- package/dist/theme/generated/violet-theme.generated.js.map +1 -1
- package/dist/toast/violet-toast.js +14 -0
- package/dist/toast/violet-toast.js.map +1 -1
- package/package.json +6 -6
- package/tokens/raw-palette.proposal.jsonc +84 -81
- package/tokens/violet-theme.export.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"violet-color-picker.js","sourceRoot":"","sources":["../../src/color-picker/violet-color-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAElG,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAC9F,O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n\nimport \"../color-swatch/violet-color-swatch\";\nimport \"../icon/violet-icon\";\nimport { registerSystemChevronRightIcon } from \"../icon/generated/icons/system-chevron-right\";\nimport { installFormDisabled } from \"../foundations/violet-form-disabled\";\nimport {\n clamp,\n hexToHsl,\n hslToHex,\n lightnessGradient,\n normalizeHexColor,\n saturationGradient,\n} from \"./violet-color-utils\";\nimport { violetFieldTokenDefaults } from \"../theme/violet-token-defaults\";\n\nexport type VioletColorPickerSize = \"compact\" | \"natural\" | \"comfortable\";\n\nconst DEFAULT_COLOR = \"#c84f3b\";\nconst DEFAULT_PRESETS = [\"#244635\", \"#c84f3b\", \"#df7f44\", \"#d2b062\", \"#7c9d83\", \"#5f7ea6\", \"#7d5fa6\", \"#b95a7b\"];\n\nlet violetColorPickerCount = 0;\nregisterSystemChevronRightIcon();\n\nconst styles = css`\n ${violetFieldTokenDefaults}\n\n :host {\n position: relative;\n display: grid;\n }\n\n :host([size=\"compact\"]) {\n --violet-target-size: var(--_target-size-compact);\n --violet-control-label-size: var(--_type-label-size-compact);\n --violet-control-body-size: var(--_type-body-size-compact);\n --violet-control-caption-size: var(--_type-caption-size-compact);\n }\n\n :host([size=\"natural\"]) {\n --violet-target-size: var(--_target-size-natural);\n --violet-control-label-size: var(--_type-label-size);\n --violet-control-body-size: var(--_type-body-size);\n --violet-control-caption-size: var(--_type-caption-size);\n }\n\n :host([size=\"comfortable\"]) {\n --violet-target-size: var(--_target-size-comfortable);\n --violet-control-label-size: var(--_type-label-size);\n --violet-control-body-size: var(--_type-body-size);\n --violet-control-caption-size: var(--_type-caption-size);\n }\n\n .field {\n display: grid;\n gap: 0;\n }\n\n .label {\n color: var(--_text-secondary);\n font-size: var(--_control-label-size);\n font-weight: var(--_type-label-weight);\n line-height: var(--_type-label-line);\n margin-block-end: var(--_space-field-gap);\n }\n\n .control-shell {\n position: relative;\n display: grid;\n }\n\n .control-shell.open {\n z-index: var(--_layer-raised);\n }\n\n .trigger {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: auto minmax(0, 1fr) auto;\n align-items: center;\n gap: var(--_space-inline-md);\n inline-size: 100%;\n min-block-size: var(--_target-size);\n padding-inline: max(var(--_space-inline-md), calc(var(--_target-size) * 0.375));\n padding-block: calc(var(--_space-stack-xs) + 2px);\n border: 1px solid var(--_border-subtle);\n border-radius: var(--_radius-md);\n background: var(--_field-background);\n color: var(--_field-text);\n box-shadow: var(--_field-shadow);\n cursor: pointer;\n text-align: start;\n transition:\n border-color var(--_duration-fast) var(--_easing-standard),\n box-shadow var(--_duration-base) var(--_easing-standard);\n }\n\n .trigger:hover {\n box-shadow: var(--_field-shadow-hover);\n }\n\n .trigger:focus-visible,\n .control-shell.open .trigger {\n outline: none;\n border-color: var(--_field-border-focus);\n box-shadow: var(--_field-shadow-focus);\n }\n\n :host([disabled]) .trigger,\n :host(:disabled) .trigger {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n :host([invalid]) .trigger,\n :host([data-invalid]) .trigger {\n border-color: var(--_danger-border);\n }\n\n .swatch {\n flex: 0 0 auto;\n }\n\n .trigger-copy {\n display: grid;\n gap: 1px;\n min-inline-size: 0;\n }\n\n .trigger-value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--_control-body-size);\n line-height: var(--_type-body-line);\n color: var(--color-text-primary, #181b1a);\n }\n\n .trigger-value.placeholder {\n color: var(--_text-muted);\n }\n\n .trigger-meta {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-muted);\n }\n\n .trigger-icon {\n display: inline-grid;\n place-items: center;\n color: var(--_text-muted);\n transition: transform var(--_duration-base) var(--_easing-standard);\n }\n\n .control-shell.open .trigger-icon {\n transform: rotate(90deg);\n }\n\n .trigger-icon violet-icon {\n --violet-icon-size: 1rem;\n }\n\n .panel {\n box-sizing: border-box;\n position: fixed;\n inset: unset;\n inline-size: min(26rem, calc(100vw - 8px));\n max-inline-size: calc(100vw - 16px);\n padding: var(--_space-stack-sm);\n border: 1px solid var(--_border-subtle);\n border-radius: calc(var(--_radius-md) * 2);\n background: var(--_surface-card);\n box-shadow: var(--_shadow-floating);\n color: inherit;\n z-index: var(--_layer-popover);\n gap: var(--_space-stack-sm);\n opacity: 0;\n transform: translateY(calc(var(--_space-stack-xs) * -1));\n transition:\n opacity var(--_duration-fast) var(--_easing-standard),\n transform var(--_duration-fast) var(--_easing-standard),\n display var(--_duration-fast) var(--_easing-standard) allow-discrete,\n overlay var(--_duration-fast) var(--_easing-standard) allow-discrete;\n }\n\n /*\n * Only lay the panel out while it is open. A base \\`display\\` would override the UA's\n * \\`[popover]:not(:popover-open) { display: none }\\`, leaving the closed panel laid out\n * (just transparent) and intercepting clicks meant for the trigger. The\n * \\`display ... allow-discrete\\` transition above keeps the fade-out.\n */\n .panel:popover-open,\n .panel.open {\n display: grid;\n opacity: 1;\n transform: translateY(0);\n\n @starting-style {\n opacity: 0;\n transform: translateY(calc(var(--_space-stack-xs) * -1));\n }\n }\n\n .panel::backdrop {\n background: transparent;\n }\n\n .panel-header {\n display: flex;\n align-items: center;\n gap: var(--_space-inline-md);\n }\n\n .preview-copy {\n display: grid;\n gap: 0;\n min-inline-size: 0;\n }\n\n .panel-title {\n font-size: var(--_control-body-size);\n line-height: var(--_type-body-line);\n font-weight: 600;\n color: var(--color-text-primary, #181b1a);\n }\n\n .hex-field {\n display: grid;\n gap: var(--_space-stack-2xs);\n }\n\n .field-label {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-secondary);\n }\n\n .hex-input {\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: calc(var(--_target-size) - 4px);\n padding-inline: max(var(--_space-inline-md), 0.75rem);\n border: 1px solid var(--_field-border);\n border-radius: var(--_radius-md);\n background: var(--_surface-page);\n color: inherit;\n font: inherit;\n font-size: var(--_control-body-size);\n line-height: var(--_type-body-line);\n box-shadow: var(--_shadow-control);\n }\n\n .hex-input:focus {\n outline: none;\n }\n\n .hex-input:focus-visible {\n border-color: color-mix(in srgb, var(--_focus-ring) 48%, var(--_border-subtle));\n box-shadow: 0 0 0 2px var(--_focus-ring);\n }\n\n .hex-hint {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-muted);\n }\n\n .channels {\n display: grid;\n gap: var(--_space-stack-sm);\n }\n\n .channel {\n display: grid;\n gap: var(--_space-stack-2xs);\n }\n\n .channel-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--_space-inline-md);\n }\n\n .channel-value {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-muted);\n }\n\n .channel-input {\n appearance: none;\n -webkit-appearance: none;\n inline-size: 100%;\n block-size: 1.125rem;\n margin: 0;\n border: 0;\n background: transparent;\n }\n\n .channel-input:focus {\n outline: none;\n }\n\n .channel-input::-webkit-slider-runnable-track {\n block-size: 0.625rem;\n border-radius: var(--_radius-round, 9999px);\n background: var(--_channel-track, var(--_surface-subtle));\n }\n\n .channel-input::-moz-range-track {\n block-size: 0.625rem;\n border-radius: var(--_radius-round, 9999px);\n background: var(--_channel-track, var(--_surface-subtle));\n }\n\n .channel-input::-webkit-slider-thumb {\n appearance: none;\n -webkit-appearance: none;\n inline-size: 1rem;\n block-size: 1rem;\n margin-block-start: -0.1875rem;\n border: 1px solid var(--_border-subtle);\n border-radius: var(--_radius-round, 9999px);\n background: var(--_surface-page);\n box-shadow: var(--_shadow-control);\n }\n\n .channel-input::-moz-range-thumb {\n inline-size: 1rem;\n block-size: 1rem;\n border: 1px solid var(--_border-subtle);\n border-radius: var(--_radius-round, 9999px);\n background: var(--_surface-page);\n box-shadow: var(--_shadow-control);\n }\n\n .channel-input:focus-visible::-webkit-slider-thumb {\n box-shadow:\n var(--_shadow-control),\n 0 0 0 2px var(--_focus-ring);\n }\n\n .channel-input:focus-visible::-moz-range-thumb {\n box-shadow:\n var(--_shadow-control),\n 0 0 0 2px var(--_focus-ring);\n }\n\n .presets {\n display: grid;\n gap: var(--_space-stack-2xs);\n }\n\n .preset-grid {\n display: flex;\n flex-wrap: wrap;\n gap: var(--_space-inline-md);\n }\n\n .preset-button {\n display: inline-grid;\n place-items: center;\n padding: 0;\n border: 1px solid transparent;\n background: transparent;\n cursor: pointer;\n border-radius: var(--_radius-round, 9999px);\n }\n\n .preset-button[aria-pressed=\"true\"] {\n border-color: color-mix(in srgb, var(--_focus-ring) 48%, var(--_border-subtle));\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--_focus-ring) 25%, transparent);\n }\n\n .preset-button:focus-visible {\n outline: none;\n border-color: color-mix(in srgb, var(--_focus-ring) 48%, var(--_border-subtle));\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--_focus-ring) 25%, transparent);\n }\n\n .supporting,\n .error {\n margin: 0;\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n }\n\n .supporting {\n color: var(--_text-muted);\n margin-block-start: var(--_space-field-gap);\n }\n\n .error {\n color: var(--color-state-danger-foreground, #c42a1a);\n margin-block-start: var(--_space-field-gap);\n }\n\n .control-shell.open ~ .supporting,\n .control-shell.open ~ .error {\n visibility: hidden;\n }\n`;\n\nconst template = html<VioletColorPicker>`\n <div class=\"field\" part=\"field\">\n ${when(\n x => Boolean(x.label),\n html<VioletColorPicker>`<label class=\"label\" part=\"label\" id=\"${x => x.labelId}\">${x => x.label}</label>`,\n )}\n <div class=\"${x => x.controlShellClass}\" part=\"control-shell\">\n <button\n id=\"${x => x.triggerId}\"\n class=\"trigger\"\n part=\"trigger\"\n type=\"button\"\n ?disabled=\"${x => x.effectiveDisabled}\"\n aria-controls=\"${x => x.panelId}\"\n aria-describedby=\"${x => x.describedBy || null}\"\n aria-expanded=\"${x => x.expandedText}\"\n aria-haspopup=\"dialog\"\n aria-invalid=\"${x => x.ariaInvalidText}\"\n aria-labelledby=\"${x => x.labelledBy}\"\n @click=\"${x => x.toggleOpen()}\"\n >\n <violet-color-swatch\n class=\"swatch\"\n part=\"swatch\"\n decorative\n size=\"${x => x.swatchSize}\"\n value=\"${x => x.currentSelectedColor}\"\n ></violet-color-swatch>\n <span class=\"trigger-copy\">\n <span class=\"${x => x.triggerValueClass}\" id=\"${x => x.valueId}\">${x => x.triggerValueText}</span>\n <span class=\"trigger-meta\" id=\"${x => x.metaId}\">${x => x.triggerMetaText}</span>\n </span>\n <span class=\"trigger-icon\" aria-hidden=\"true\">\n <violet-icon icon=\"system/chevron-right\" decorative></violet-icon>\n </span>\n </button>\n <div\n id=\"${x => x.panelId}\"\n class=\"${x => x.panelClass}\"\n part=\"panel\"\n popover=\"auto\"\n role=\"dialog\"\n aria-label=\"${x => x.panelLabel}\"\n @toggle=\"${(x, c) => x.handleToggle(c.event as ToggleEvent)}\"\n >\n <div class=\"panel-header\" part=\"panel-header\">\n <violet-color-swatch value=\"${x => x.currentSelectedColor}\" size=\"comfortable\" decorative></violet-color-swatch>\n <div class=\"preview-copy\">\n <div class=\"panel-title\">${x => x.panelTitleText}</div>\n </div>\n </div>\n <div class=\"hex-field\">\n <label class=\"field-label\" for=\"${x => x.hexInputId}\">Hex value</label>\n <input\n id=\"${x => x.hexInputId}\"\n class=\"hex-input\"\n part=\"hex-input\"\n type=\"text\"\n name=\"${x => x.name}\"\n inputmode=\"text\"\n spellcheck=\"false\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n :value=\"${x => x.value}\"\n ?disabled=\"${x => x.effectiveDisabled}\"\n ?required=\"${x => x.required}\"\n aria-invalid=\"${x => x.invalid ? \"true\" : \"false\"}\"\n aria-describedby=\"${x => x.hexHintId}\"\n @input=\"${(x, c) => x.handleInput(c.event)}\"\n @change=\"${(x, c) => x.handleCommit(c.event)}\"\n @blur=\"${(x, c) => x.handleCommit(c.event)}\"\n />\n <div class=\"hex-hint\" id=\"${x => x.hexHintId}\">Use a 3- or 6-digit hex color.</div>\n </div>\n <div class=\"channels\" part=\"channels\">\n <div class=\"channel\">\n <div class=\"channel-header\">\n <label class=\"field-label\" for=\"${x => x.hueInputId}\">Hue</label>\n <span class=\"channel-value\">${x => Math.round(x.hue)}deg</span>\n </div>\n <input\n id=\"${x => x.hueInputId}\"\n class=\"channel-input\"\n style=\"--_channel-track: linear-gradient(90deg, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);\"\n type=\"range\"\n min=\"0\"\n max=\"360\"\n step=\"1\"\n :value=\"${x => x.hue}\"\n @input=\"${(x, c) => x.handleHueInput(c.event)}\"\n @change=\"${(x, c) => x.handleHueCommit(c.event)}\"\n />\n </div>\n <div class=\"channel\">\n <div class=\"channel-header\">\n <label class=\"field-label\" for=\"${x => x.saturationInputId}\">Saturation</label>\n <span class=\"channel-value\">${x => Math.round(x.saturation)}%</span>\n </div>\n <input\n id=\"${x => x.saturationInputId}\"\n class=\"channel-input\"\n style=\"${x => x.saturationTrackStyle}\"\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n :value=\"${x => x.saturation}\"\n @input=\"${(x, c) => x.handleSaturationInput(c.event)}\"\n @change=\"${(x, c) => x.handleSaturationCommit(c.event)}\"\n />\n </div>\n <div class=\"channel\">\n <div class=\"channel-header\">\n <label class=\"field-label\" for=\"${x => x.lightnessInputId}\">Lightness</label>\n <span class=\"channel-value\">${x => Math.round(x.lightness)}%</span>\n </div>\n <input\n id=\"${x => x.lightnessInputId}\"\n class=\"channel-input\"\n style=\"${x => x.lightnessTrackStyle}\"\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n :value=\"${x => x.lightness}\"\n @input=\"${(x, c) => x.handleLightnessInput(c.event)}\"\n @change=\"${(x, c) => x.handleLightnessCommit(c.event)}\"\n />\n </div>\n </div>\n <div class=\"presets\" part=\"presets\">\n <div class=\"field-label\">Suggested swatches</div>\n <div class=\"preset-grid\">\n ${repeat(\n x => x.presets,\n html<string, VioletColorPicker>`\n <button\n class=\"preset-button\"\n type=\"button\"\n aria-label=\"${(preset, c) => c.parent.presetAriaLabel(preset)}\"\n aria-pressed=\"${(preset, c) => String(c.parent.currentDisplayColor === preset)}\"\n @click=\"${(preset, c) => c.parent.applyPreset(preset)}\"\n >\n <violet-color-swatch decorative shape=\"circle\" value=\"${preset => preset}\"></violet-color-swatch>\n </button>\n `,\n )}\n </div>\n </div>\n <slot name=\"presets\"></slot>\n </div>\n </div>\n ${when(\n x => Boolean(x.supportingText) && !x.isInvalid,\n html<VioletColorPicker>`<p class=\"supporting\" part=\"supporting-text\" id=\"${x => x.supportingId}\">${x => x.supportingText}</p>`,\n )}\n ${when(\n x => Boolean(x.isInvalid && x.errorText),\n html<VioletColorPicker>`<p class=\"error\" part=\"error-text\" id=\"${x => x.errorId}\">${x => x.errorText}</p>`,\n )}\n </div>\n`;\n\n/**\n * Violet color picker built from a swatch trigger, textual value, and standard channel controls.\n *\n * @summary Token-driven color picker with a popover editor, hex value entry, and HSL channel sliders.\n * @fires input - Emitted when the selected color changes.\n * @fires change - Emitted when a committed color differs, ignoring case, from the last committed or author-set value.\n * @slot presets - Optional additional preset content rendered under the built-in swatches.\n */\nexport class VioletColorPicker extends FASTElement {\n public static readonly formAssociated = true;\n\n readonly #internals: ElementInternals;\n // The color `change` compares against: the last author-set or committed value, normalized.\n #committedColor = \"\";\n /** The value when the picker was connected, which a form reset restores. */\n #defaultValue = \"\";\n #applyingColor = false;\n readonly #handleViewportChange = () => {\n if (this.open) {\n this.positionPanel();\n }\n };\n\n public readonly labelId: string;\n public readonly triggerId: string;\n public readonly valueId: string;\n public readonly metaId: string;\n public readonly panelId: string;\n public readonly supportingId: string;\n public readonly errorId: string;\n public readonly hexInputId: string;\n public readonly hexHintId: string;\n public readonly hueInputId: string;\n public readonly saturationInputId: string;\n public readonly lightnessInputId: string;\n\n public open = false;\n public hue = 0;\n public saturation = 0;\n public lightness = 0;\n public hexDraft = \"\";\n public validationInvalid = false;\n\n declare public label: string;\n declare public value: string;\n declare public name: string;\n declare public supportingText: string;\n declare public errorText: string;\n declare public disabled: boolean;\n declare public required: boolean;\n declare public invalid: boolean;\n declare public size: VioletColorPickerSize;\n\n /**\n * True while an ancestor `<fieldset disabled>` disables the control.\n */\n declare public fieldsetDisabled: boolean;\n\n /**\n * Author `disabled` or fieldset-disabled.\n */\n declare public readonly effectiveDisabled: boolean;\n\n public constructor() {\n super();\n const id = violetColorPickerCount;\n violetColorPickerCount += 1;\n\n this.#internals = this.attachInternals();\n this.labelId = `violet-color-picker-label-${id}`;\n this.triggerId = `violet-color-picker-trigger-${id}`;\n this.valueId = `violet-color-picker-value-${id}`;\n this.metaId = `violet-color-picker-meta-${id}`;\n this.panelId = `violet-color-picker-panel-${id}`;\n this.supportingId = `violet-color-picker-supporting-${id}`;\n this.errorId = `violet-color-picker-error-${id}`;\n this.hexInputId = `violet-color-picker-hex-${id}`;\n this.hexHintId = `violet-color-picker-hex-hint-${id}`;\n this.hueInputId = `violet-color-picker-hue-${id}`;\n this.saturationInputId = `violet-color-picker-saturation-${id}`;\n this.lightnessInputId = `violet-color-picker-lightness-${id}`;\n\n this.label = \"\";\n this.value = \"\";\n this.name = \"\";\n this.supportingText = \"\";\n this.errorText = \"\";\n this.disabled = false;\n this.required = false;\n this.invalid = false;\n this.size = \"natural\";\n\n this.syncFromColor(this.value);\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n this.#defaultValue = this.value;\n this.#committedColor = this.currentSelectedColor;\n this.syncFromColor(this.value);\n this.#syncFormState();\n this.syncOpenState();\n window.addEventListener(\"resize\", this.#handleViewportChange);\n window.addEventListener(\"scroll\", this.#handleViewportChange, true);\n }\n\n public disconnectedCallback(): void {\n window.removeEventListener(\"resize\", this.#handleViewportChange);\n window.removeEventListener(\"scroll\", this.#handleViewportChange, true);\n super.disconnectedCallback();\n }\n\n public valueChanged(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n\n if (!this.#applyingColor) {\n this.#committedColor = this.currentSelectedColor;\n }\n\n this.syncFromColor(this.value);\n this.#syncFormState();\n }\n\n public disabledChanged(): void {\n if (this.effectiveDisabled && this.open) {\n this.close();\n }\n\n if (this.$fastController.isConnected) {\n this.#syncFormState();\n }\n }\n\n public requiredChanged(): void {\n if (this.$fastController.isConnected) {\n this.#syncFormState();\n }\n }\n\n public invalidChanged(): void {\n if (this.$fastController.isConnected) {\n this.#syncFormState();\n }\n }\n\n public get form(): HTMLFormElement | null {\n return this.#internals.form;\n }\n\n public get validity(): ValidityState {\n return this.#internals.validity;\n }\n\n public get validationMessage(): string {\n return this.#internals.validationMessage;\n }\n\n public get willValidate(): boolean {\n return this.#internals.willValidate;\n }\n\n public get presets(): string[] {\n return DEFAULT_PRESETS;\n }\n\n public get currentDisplayColor(): string {\n return normalizeHexColor(this.value) ?? hslToHex({ h: this.hue, s: this.saturation, l: this.lightness });\n }\n\n public get currentSelectedColor(): string {\n return normalizeHexColor(this.value) ?? \"\";\n }\n\n public get describedBy(): string {\n const ids: string[] = [];\n\n if (this.isInvalid && this.errorText) {\n ids.push(this.errorId);\n } else if (this.supportingText) {\n ids.push(this.supportingId);\n }\n\n return ids.join(\" \");\n }\n\n public get labelledBy(): string {\n const ids: string[] = [];\n\n if (this.label) {\n ids.push(this.labelId);\n }\n\n // Every visible text of the trigger, in order, so the name contains it (WCAG 2.5.3).\n ids.push(this.valueId, this.metaId);\n return ids.join(\" \");\n }\n\n public get panelLabel(): string {\n return this.label ? `${this.label} color picker` : \"Color picker\";\n }\n\n public get panelTitleText(): string {\n return this.value ? \"Selected color\" : \"No color selected\";\n }\n\n public get controlShellClass(): string {\n return `control-shell${this.open ? \" open\" : \"\"}`;\n }\n\n public get panelClass(): string {\n return `panel${this.open ? \" open\" : \"\"}`;\n }\n\n public get expandedText(): string {\n return String(this.open);\n }\n\n public get ariaInvalidText(): string {\n return this.isInvalid ? \"true\" : \"false\";\n }\n\n public get isInvalid(): boolean {\n return this.invalid || this.validationInvalid;\n }\n\n public get swatchSize(): \"compact\" | \"natural\" | \"comfortable\" {\n return this.size;\n }\n\n public get triggerValueClass(): string {\n return this.value ? \"trigger-value\" : \"trigger-value placeholder\";\n }\n\n public get triggerValueText(): string {\n return this.value || \"Choose color\";\n }\n\n public get triggerMetaText(): string {\n return this.value ? \"Adjust color\" : \"Select a color\";\n }\n\n public get saturationTrackStyle(): string {\n return `--_channel-track: ${saturationGradient(this.hue, this.lightness)};`;\n }\n\n public get lightnessTrackStyle(): string {\n return `--_channel-track: ${lightnessGradient(this.hue, this.saturation)};`;\n }\n\n public toggleOpen(): void {\n if (this.effectiveDisabled) {\n return;\n }\n\n const panel = this.panelElement;\n\n if (!panel) {\n return;\n }\n\n if (panel.matches(\":popover-open\")) {\n panel.hidePopover();\n } else {\n panel.showPopover();\n }\n }\n\n public close(): void {\n if (this.panelElement?.matches(\":popover-open\")) {\n this.panelElement.hidePopover();\n }\n }\n\n public handleToggle(event: ToggleEvent): void {\n this.open = event.newState === \"open\";\n this.syncOpenState();\n\n if (this.open) {\n this.positionPanel();\n requestAnimationFrame(() => {\n this.positionPanel();\n this.hexInputElement?.focus();\n this.hexInputElement?.select();\n });\n } else {\n this.hexDraft = this.currentSelectedColor;\n this.syncHexInputValue();\n }\n }\n\n public handleHexInput(event: Event): void {\n // The native `input` is composed and would reach the host as a second event; this element emits its own.\n event.stopPropagation();\n const input = event.currentTarget as HTMLInputElement;\n this.hexDraft = input.value;\n\n const normalized = normalizeHexColor(input.value);\n\n // Preview only full six-digit colors while typing. Applying \"#167\", valid shorthand on the way to\n // \"#1670ca\", would rewrite the field to \"#116677\" under the caret. Commit expands shorthand.\n if (!normalized || input.value.trim().replace(/^#/, \"\").length !== 6) {\n return;\n }\n\n this.applyColor(normalized, true, false);\n }\n\n public handleInput(event: Event): void {\n this.handleHexInput(event);\n }\n\n public handleHexCommit(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n const normalized = normalizeHexColor(input.value);\n\n if (!normalized) {\n this.hexDraft = this.currentSelectedColor;\n this.syncHexInputValue();\n return;\n }\n\n this.applyColor(normalized, true, true);\n }\n\n public handleCommit(event: Event): void {\n this.handleHexCommit(event);\n }\n\n public handleChannelInput(channel: \"h\" | \"s\" | \"l\", event: Event): void {\n // The native `input` is composed and would reach the host as a second event; this element emits its own.\n event.stopPropagation();\n const input = event.currentTarget as HTMLInputElement;\n const nextValue = Number(input.value);\n this.updateChannel(channel, nextValue);\n this.commitFromChannels(true, false);\n }\n\n public handleChannelCommit(channel: \"h\" | \"s\" | \"l\", event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n const nextValue = Number(input.value);\n this.updateChannel(channel, nextValue);\n this.commitFromChannels(true, true);\n }\n\n public handleHueInput(event: Event): void {\n this.handleChannelInput(\"h\", event);\n }\n\n public handleHueCommit(event: Event): void {\n this.handleChannelCommit(\"h\", event);\n }\n\n public handleSaturationInput(event: Event): void {\n this.handleChannelInput(\"s\", event);\n }\n\n public handleSaturationCommit(event: Event): void {\n this.handleChannelCommit(\"s\", event);\n }\n\n public handleLightnessInput(event: Event): void {\n this.handleChannelInput(\"l\", event);\n }\n\n public handleLightnessCommit(event: Event): void {\n this.handleChannelCommit(\"l\", event);\n }\n\n public applyPreset(color: string): void {\n this.applyColor(color, true, true);\n }\n\n public presetAriaLabel(color: string): string {\n return `Use ${color}`;\n }\n\n public formStateRestoreCallback(state: File | string | FormData | null): void {\n if (typeof state === \"string\") {\n this.value = state;\n }\n }\n\n public formResetCallback(): void {\n this.value = this.#defaultValue;\n this.syncFromColor(this.value);\n this.#syncFormState();\n }\n\n public checkValidity(): boolean {\n return this.#internals.checkValidity();\n }\n\n public reportValidity(): boolean {\n return this.#internals.reportValidity();\n }\n\n private get panelElement(): HTMLElement | null {\n return this.shadowRoot?.querySelector(\".panel\") ?? null;\n }\n\n private get controlShellElement(): HTMLElement | null {\n return this.shadowRoot?.querySelector(\".control-shell\") ?? null;\n }\n\n private get hexInputElement(): HTMLInputElement | null {\n return this.shadowRoot?.querySelector(\".hex-input\") ?? null;\n }\n\n private syncFromColor(value: string): void {\n const normalized = normalizeHexColor(value);\n const hsl = hexToHsl(normalized || DEFAULT_COLOR);\n\n if (!hsl) {\n return;\n }\n\n this.hue = hsl.h;\n this.saturation = hsl.s;\n this.lightness = hsl.l;\n this.hexDraft = normalized ?? \"\";\n this.syncHexInputValue();\n }\n\n private updateChannel(channel: \"h\" | \"s\" | \"l\", value: number): void {\n switch (channel) {\n case \"h\":\n this.hue = clamp(value, 0, 360);\n break;\n case \"s\":\n this.saturation = clamp(value, 0, 100);\n break;\n case \"l\":\n this.lightness = clamp(value, 0, 100);\n break;\n }\n }\n\n private commitFromChannels(emitInput: boolean, emitChange: boolean): void {\n const next = hslToHex({\n h: this.hue,\n s: this.saturation,\n l: this.lightness,\n });\n\n this.applyColor(next, emitInput, emitChange);\n }\n\n private applyColor(color: string, emitInput: boolean, emitChange: boolean): void {\n const normalized = normalizeHexColor(color);\n\n if (!normalized) {\n return;\n }\n\n // Comparing normalized colors keeps an author's `#1670CA` from reading as an edit to `#1670ca`.\n const valueChanged = normalized !== this.currentSelectedColor;\n if (valueChanged) {\n this.#applyingColor = true;\n this.value = normalized;\n this.#applyingColor = false;\n }\n this.hexDraft = normalized;\n this.syncFromColor(normalized);\n this.#syncFormState();\n\n if (emitInput && valueChanged) {\n this.$emit(\"input\", { value: normalized });\n }\n\n if (emitChange && normalized !== this.#committedColor) {\n this.#committedColor = normalized;\n this.$emit(\"change\", { value: normalized });\n }\n }\n\n #syncFormState(): void {\n this.#internals.setFormValue(this.value || null);\n\n if (this.effectiveDisabled) {\n this.validationInvalid = false;\n this.removeAttribute(\"data-invalid\");\n this.#internals.setValidity({});\n return;\n }\n\n if (this.invalid) {\n this.validationInvalid = true;\n this.setAttribute(\"data-invalid\", \"\");\n this.#internals.setValidity({ customError: true }, this.errorText || \"The selected color is invalid.\");\n return;\n }\n\n if (this.required && !this.value) {\n this.validationInvalid = true;\n this.setAttribute(\"data-invalid\", \"\");\n this.#internals.setValidity({ valueMissing: true }, this.errorText || \"Select a color.\");\n return;\n }\n\n this.validationInvalid = false;\n this.removeAttribute(\"data-invalid\");\n this.#internals.setValidity({});\n }\n\n private syncHexInputValue(): void {\n const input = this.hexInputElement;\n\n if (!input || input.value === this.hexDraft) {\n return;\n }\n\n input.value = this.hexDraft;\n }\n\n private syncOpenState(): void {\n this.controlShellElement?.classList.toggle(\"open\", this.open);\n this.panelElement?.classList.toggle(\"open\", this.open);\n\n if (this.panelElement) {\n this.panelElement.style.opacity = this.open ? \"1\" : \"0\";\n this.panelElement.style.transform = this.open ? \"translateY(0)\" : \"translateY(calc(var(--_space-stack-xs) * -1))\";\n }\n }\n\n private positionPanel(): void {\n const panel = this.panelElement;\n const trigger = this.shadowRoot?.querySelector(\".trigger\") as HTMLButtonElement | null;\n\n if (!panel || !trigger) {\n return;\n }\n\n const rect = trigger.getBoundingClientRect();\n const viewportPadding = 8;\n const gap = 6;\n\n let left = rect.left;\n let top = rect.bottom + gap;\n const width = Math.min(Math.max(rect.width, 320), window.innerWidth - viewportPadding * 2);\n\n panel.style.width = `${width}px`;\n panel.style.left = `${Math.max(viewportPadding, left)}px`;\n panel.style.top = `${Math.max(viewportPadding, top)}px`;\n\n requestAnimationFrame(() => {\n const panelRect = panel.getBoundingClientRect();\n\n if (panelRect.right > window.innerWidth - viewportPadding) {\n left = Math.max(viewportPadding, window.innerWidth - panelRect.width - viewportPadding);\n }\n\n if (panelRect.bottom > window.innerHeight - viewportPadding) {\n top = Math.max(viewportPadding, rect.top - panelRect.height - gap);\n }\n\n panel.style.left = `${left}px`;\n panel.style.top = `${top}px`;\n });\n }\n}\n\nattr(VioletColorPicker.prototype, \"label\");\nattr(VioletColorPicker.prototype, \"value\");\nattr(VioletColorPicker.prototype, \"name\");\nattr({ attribute: \"supporting-text\" })(VioletColorPicker.prototype, \"supportingText\");\nattr({ attribute: \"error-text\" })(VioletColorPicker.prototype, \"errorText\");\nattr({ mode: \"boolean\" })(VioletColorPicker.prototype, \"disabled\");\ninstallFormDisabled(VioletColorPicker.prototype);\nattr({ mode: \"boolean\" })(VioletColorPicker.prototype, \"required\");\nattr({ mode: \"boolean\" })(VioletColorPicker.prototype, \"invalid\");\nattr(VioletColorPicker.prototype, \"size\");\nobservable(VioletColorPicker.prototype, \"open\");\nobservable(VioletColorPicker.prototype, \"hue\");\nobservable(VioletColorPicker.prototype, \"saturation\");\nobservable(VioletColorPicker.prototype, \"lightness\");\nobservable(VioletColorPicker.prototype, \"hexDraft\");\nobservable(VioletColorPicker.prototype, \"validationInvalid\");\n\nif (!customElements.get(\"violet-color-picker\")) {\n await VioletColorPicker.define({\n name: \"violet-color-picker\",\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true,\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"violet-color-picker.js","sourceRoot":"","sources":["../../src/color-picker/violet-color-picker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAElG,OAAO,qCAAqC,CAAC;AAC7C,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EACH,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAI1E,mFAAmF;AACnF,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAEjH,IAAI,sBAAsB,GAAG,CAAC,CAAC;AAC/B,8BAA8B,EAAE,CAAC;AAEjC,MAAM,MAAM,GAAG,GAAG,CAAA;MACZ,wBAAwB;;;;;;;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AAiB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAC1C,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAChD,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAC/C,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACtD,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AACrD,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACpD,UAAU,CAAC,iBAAiB,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC;AAE7D,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,qBAAqB,CAAC,EAAE,CAAC;IAC7C,MAAM,iBAAiB,CAAC,MAAM,CAAC;QAC3B,IAAI,EAAE,qBAAqB;QAC3B,QAAQ;QACR,MAAM;QACN,aAAa,EAAE;YACX,cAAc,EAAE,IAAI;SACvB;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { FASTElement, attr, css, html, observable, repeat, when } from \"@lushly-dev/fast-element\";\n\nimport \"../color-swatch/violet-color-swatch\";\nimport \"../icon/violet-icon\";\nimport { registerSystemChevronRightIcon } from \"../icon/generated/icons/system-chevron-right\";\nimport { installFormDisabled } from \"../foundations/violet-form-disabled\";\nimport {\n clamp,\n hexToHsl,\n hslToHex,\n lightnessGradient,\n normalizeHexColor,\n saturationGradient,\n} from \"./violet-color-utils\";\nimport { violetFieldTokenDefaults } from \"../theme/violet-token-defaults\";\n\nexport type VioletColorPickerSize = \"compact\" | \"natural\" | \"comfortable\";\n\n// AFD Refined palette defaults (D159): fixed component defaults, not theme tokens.\nconst DEFAULT_COLOR = \"#146ba0\";\nconst DEFAULT_PRESETS = [\"#181b1a\", \"#2c5e4b\", \"#a3ebcd\", \"#146ba0\", \"#c42a1a\", \"#f96e5b\", \"#92400e\", \"#6b7d6e\"];\n\nlet violetColorPickerCount = 0;\nregisterSystemChevronRightIcon();\n\nconst styles = css`\n ${violetFieldTokenDefaults}\n\n :host {\n position: relative;\n display: grid;\n }\n\n :host([size=\"compact\"]) {\n --violet-target-size: var(--_target-size-compact);\n --violet-control-label-size: var(--_type-label-size-compact);\n --violet-control-body-size: var(--_type-body-size-compact);\n --violet-control-caption-size: var(--_type-caption-size-compact);\n }\n\n :host([size=\"natural\"]) {\n --violet-target-size: var(--_target-size-natural);\n --violet-control-label-size: var(--_type-label-size);\n --violet-control-body-size: var(--_type-body-size);\n --violet-control-caption-size: var(--_type-caption-size);\n }\n\n :host([size=\"comfortable\"]) {\n --violet-target-size: var(--_target-size-comfortable);\n --violet-control-label-size: var(--_type-label-size);\n --violet-control-body-size: var(--_type-body-size);\n --violet-control-caption-size: var(--_type-caption-size);\n }\n\n .field {\n display: grid;\n gap: 0;\n }\n\n .label {\n color: var(--_text-secondary);\n font-size: var(--_control-label-size);\n font-weight: var(--_type-label-weight);\n line-height: var(--_type-label-line);\n margin-block-end: var(--_space-field-gap);\n }\n\n .control-shell {\n position: relative;\n display: grid;\n }\n\n .control-shell.open {\n z-index: var(--_layer-raised);\n }\n\n .trigger {\n box-sizing: border-box;\n display: grid;\n grid-template-columns: auto minmax(0, 1fr) auto;\n align-items: center;\n gap: var(--_space-inline-md);\n inline-size: 100%;\n min-block-size: var(--_target-size);\n padding-inline: max(var(--_space-inline-md), calc(var(--_target-size) * 0.375));\n padding-block: calc(var(--_space-stack-xs) + 2px);\n border: 1px solid var(--_border-subtle);\n border-radius: var(--_radius-md);\n background: var(--_field-background);\n color: var(--_field-text);\n box-shadow: var(--_field-shadow);\n cursor: pointer;\n text-align: start;\n transition:\n border-color var(--_duration-fast) var(--_easing-standard),\n box-shadow var(--_duration-base) var(--_easing-standard);\n }\n\n .trigger:hover {\n box-shadow: var(--_field-shadow-hover);\n }\n\n .trigger:focus-visible,\n .control-shell.open .trigger {\n outline: none;\n border-color: var(--_field-border-focus);\n box-shadow: var(--_field-shadow-focus);\n }\n\n :host([disabled]) .trigger,\n :host(:disabled) .trigger {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n :host([invalid]) .trigger,\n :host([data-invalid]) .trigger {\n border-color: var(--_danger-border);\n }\n\n .swatch {\n flex: 0 0 auto;\n }\n\n .trigger-copy {\n display: grid;\n gap: 1px;\n min-inline-size: 0;\n }\n\n .trigger-value {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--_control-body-size);\n line-height: var(--_type-body-line);\n color: var(--color-text-primary, #181b1a);\n }\n\n .trigger-value.placeholder {\n color: var(--_text-muted);\n }\n\n .trigger-meta {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-muted);\n }\n\n .trigger-icon {\n display: inline-grid;\n place-items: center;\n color: var(--_text-muted);\n transition: transform var(--_duration-base) var(--_easing-standard);\n }\n\n .control-shell.open .trigger-icon {\n transform: rotate(90deg);\n }\n\n .trigger-icon violet-icon {\n --violet-icon-size: 1rem;\n }\n\n .panel {\n box-sizing: border-box;\n position: fixed;\n inset: unset;\n inline-size: min(26rem, calc(100vw - 8px));\n max-inline-size: calc(100vw - 16px);\n padding: var(--_space-stack-sm);\n border: 1px solid var(--_border-subtle);\n border-radius: calc(var(--_radius-md) * 2);\n background: var(--_surface-card);\n box-shadow: var(--_shadow-floating);\n color: inherit;\n z-index: var(--_layer-popover);\n gap: var(--_space-stack-sm);\n opacity: 0;\n transform: translateY(calc(var(--_space-stack-xs) * -1));\n transition:\n opacity var(--_duration-fast) var(--_easing-standard),\n transform var(--_duration-fast) var(--_easing-standard),\n display var(--_duration-fast) var(--_easing-standard) allow-discrete,\n overlay var(--_duration-fast) var(--_easing-standard) allow-discrete;\n }\n\n /*\n * Only lay the panel out while it is open. A base \\`display\\` would override the UA's\n * \\`[popover]:not(:popover-open) { display: none }\\`, leaving the closed panel laid out\n * (just transparent) and intercepting clicks meant for the trigger. The\n * \\`display ... allow-discrete\\` transition above keeps the fade-out.\n */\n .panel:popover-open,\n .panel.open {\n display: grid;\n opacity: 1;\n transform: translateY(0);\n\n @starting-style {\n opacity: 0;\n transform: translateY(calc(var(--_space-stack-xs) * -1));\n }\n }\n\n .panel::backdrop {\n background: transparent;\n }\n\n .panel-header {\n display: flex;\n align-items: center;\n gap: var(--_space-inline-md);\n }\n\n .preview-copy {\n display: grid;\n gap: 0;\n min-inline-size: 0;\n }\n\n .panel-title {\n font-size: var(--_control-body-size);\n line-height: var(--_type-body-line);\n font-weight: 600;\n color: var(--color-text-primary, #181b1a);\n }\n\n .hex-field {\n display: grid;\n gap: var(--_space-stack-2xs);\n }\n\n .field-label {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-secondary);\n }\n\n .hex-input {\n box-sizing: border-box;\n inline-size: 100%;\n min-block-size: calc(var(--_target-size) - 4px);\n padding-inline: max(var(--_space-inline-md), 0.75rem);\n border: 1px solid var(--_field-border);\n border-radius: var(--_radius-md);\n background: var(--_surface-page);\n color: inherit;\n font: inherit;\n font-size: var(--_control-body-size);\n line-height: var(--_type-body-line);\n box-shadow: var(--_shadow-control);\n }\n\n .hex-input:focus {\n outline: none;\n }\n\n .hex-input:focus-visible {\n border-color: color-mix(in srgb, var(--_focus-ring) 48%, var(--_border-subtle));\n box-shadow: 0 0 0 2px var(--_focus-ring);\n }\n\n .hex-hint {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-muted);\n }\n\n .channels {\n display: grid;\n gap: var(--_space-stack-sm);\n }\n\n .channel {\n display: grid;\n gap: var(--_space-stack-2xs);\n }\n\n .channel-header {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: var(--_space-inline-md);\n }\n\n .channel-value {\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n color: var(--_text-muted);\n }\n\n .channel-input {\n appearance: none;\n -webkit-appearance: none;\n inline-size: 100%;\n block-size: 1.125rem;\n margin: 0;\n border: 0;\n background: transparent;\n }\n\n .channel-input:focus {\n outline: none;\n }\n\n .channel-input::-webkit-slider-runnable-track {\n block-size: 0.625rem;\n border-radius: var(--_radius-round, 9999px);\n background: var(--_channel-track, var(--_surface-subtle));\n }\n\n .channel-input::-moz-range-track {\n block-size: 0.625rem;\n border-radius: var(--_radius-round, 9999px);\n background: var(--_channel-track, var(--_surface-subtle));\n }\n\n .channel-input::-webkit-slider-thumb {\n appearance: none;\n -webkit-appearance: none;\n inline-size: 1rem;\n block-size: 1rem;\n margin-block-start: -0.1875rem;\n border: 1px solid var(--_border-subtle);\n border-radius: var(--_radius-round, 9999px);\n background: var(--_surface-page);\n box-shadow: var(--_shadow-control);\n }\n\n .channel-input::-moz-range-thumb {\n inline-size: 1rem;\n block-size: 1rem;\n border: 1px solid var(--_border-subtle);\n border-radius: var(--_radius-round, 9999px);\n background: var(--_surface-page);\n box-shadow: var(--_shadow-control);\n }\n\n .channel-input:focus-visible::-webkit-slider-thumb {\n box-shadow:\n var(--_shadow-control),\n 0 0 0 2px var(--_focus-ring);\n }\n\n .channel-input:focus-visible::-moz-range-thumb {\n box-shadow:\n var(--_shadow-control),\n 0 0 0 2px var(--_focus-ring);\n }\n\n .presets {\n display: grid;\n gap: var(--_space-stack-2xs);\n }\n\n .preset-grid {\n display: flex;\n flex-wrap: wrap;\n gap: var(--_space-inline-md);\n }\n\n .preset-button {\n display: inline-grid;\n place-items: center;\n padding: 0;\n border: 1px solid transparent;\n background: transparent;\n cursor: pointer;\n border-radius: var(--_radius-round, 9999px);\n }\n\n .preset-button[aria-pressed=\"true\"] {\n border-color: color-mix(in srgb, var(--_focus-ring) 48%, var(--_border-subtle));\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--_focus-ring) 25%, transparent);\n }\n\n .preset-button:focus-visible {\n outline: none;\n border-color: color-mix(in srgb, var(--_focus-ring) 48%, var(--_border-subtle));\n box-shadow: 0 0 0 2px color-mix(in srgb, var(--_focus-ring) 25%, transparent);\n }\n\n .supporting,\n .error {\n margin: 0;\n font-size: var(--_control-caption-size);\n line-height: var(--_type-caption-line);\n }\n\n .supporting {\n color: var(--_text-muted);\n margin-block-start: var(--_space-field-gap);\n }\n\n .error {\n color: var(--color-state-danger-foreground, #c42a1a);\n margin-block-start: var(--_space-field-gap);\n }\n\n .control-shell.open ~ .supporting,\n .control-shell.open ~ .error {\n visibility: hidden;\n }\n`;\n\nconst template = html<VioletColorPicker>`\n <div class=\"field\" part=\"field\">\n ${when(\n x => Boolean(x.label),\n html<VioletColorPicker>`<label class=\"label\" part=\"label\" id=\"${x => x.labelId}\">${x => x.label}</label>`,\n )}\n <div class=\"${x => x.controlShellClass}\" part=\"control-shell\">\n <button\n id=\"${x => x.triggerId}\"\n class=\"trigger\"\n part=\"trigger\"\n type=\"button\"\n ?disabled=\"${x => x.effectiveDisabled}\"\n aria-controls=\"${x => x.panelId}\"\n aria-describedby=\"${x => x.describedBy || null}\"\n aria-expanded=\"${x => x.expandedText}\"\n aria-haspopup=\"dialog\"\n aria-invalid=\"${x => x.ariaInvalidText}\"\n aria-labelledby=\"${x => x.labelledBy}\"\n @click=\"${x => x.toggleOpen()}\"\n >\n <violet-color-swatch\n class=\"swatch\"\n part=\"swatch\"\n decorative\n size=\"${x => x.swatchSize}\"\n value=\"${x => x.currentSelectedColor}\"\n ></violet-color-swatch>\n <span class=\"trigger-copy\">\n <span class=\"${x => x.triggerValueClass}\" id=\"${x => x.valueId}\">${x => x.triggerValueText}</span>\n <span class=\"trigger-meta\" id=\"${x => x.metaId}\">${x => x.triggerMetaText}</span>\n </span>\n <span class=\"trigger-icon\" aria-hidden=\"true\">\n <violet-icon icon=\"system/chevron-right\" decorative></violet-icon>\n </span>\n </button>\n <div\n id=\"${x => x.panelId}\"\n class=\"${x => x.panelClass}\"\n part=\"panel\"\n popover=\"auto\"\n role=\"dialog\"\n aria-label=\"${x => x.panelLabel}\"\n @toggle=\"${(x, c) => x.handleToggle(c.event as ToggleEvent)}\"\n >\n <div class=\"panel-header\" part=\"panel-header\">\n <violet-color-swatch value=\"${x => x.currentSelectedColor}\" size=\"comfortable\" decorative></violet-color-swatch>\n <div class=\"preview-copy\">\n <div class=\"panel-title\">${x => x.panelTitleText}</div>\n </div>\n </div>\n <div class=\"hex-field\">\n <label class=\"field-label\" for=\"${x => x.hexInputId}\">Hex value</label>\n <input\n id=\"${x => x.hexInputId}\"\n class=\"hex-input\"\n part=\"hex-input\"\n type=\"text\"\n name=\"${x => x.name}\"\n inputmode=\"text\"\n spellcheck=\"false\"\n autocapitalize=\"off\"\n autocomplete=\"off\"\n :value=\"${x => x.value}\"\n ?disabled=\"${x => x.effectiveDisabled}\"\n ?required=\"${x => x.required}\"\n aria-invalid=\"${x => x.invalid ? \"true\" : \"false\"}\"\n aria-describedby=\"${x => x.hexHintId}\"\n @input=\"${(x, c) => x.handleInput(c.event)}\"\n @change=\"${(x, c) => x.handleCommit(c.event)}\"\n @blur=\"${(x, c) => x.handleCommit(c.event)}\"\n />\n <div class=\"hex-hint\" id=\"${x => x.hexHintId}\">Use a 3- or 6-digit hex color.</div>\n </div>\n <div class=\"channels\" part=\"channels\">\n <div class=\"channel\">\n <div class=\"channel-header\">\n <label class=\"field-label\" for=\"${x => x.hueInputId}\">Hue</label>\n <span class=\"channel-value\">${x => Math.round(x.hue)}deg</span>\n </div>\n <input\n id=\"${x => x.hueInputId}\"\n class=\"channel-input\"\n style=\"--_channel-track: linear-gradient(90deg, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);\"\n type=\"range\"\n min=\"0\"\n max=\"360\"\n step=\"1\"\n :value=\"${x => x.hue}\"\n @input=\"${(x, c) => x.handleHueInput(c.event)}\"\n @change=\"${(x, c) => x.handleHueCommit(c.event)}\"\n />\n </div>\n <div class=\"channel\">\n <div class=\"channel-header\">\n <label class=\"field-label\" for=\"${x => x.saturationInputId}\">Saturation</label>\n <span class=\"channel-value\">${x => Math.round(x.saturation)}%</span>\n </div>\n <input\n id=\"${x => x.saturationInputId}\"\n class=\"channel-input\"\n style=\"${x => x.saturationTrackStyle}\"\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n :value=\"${x => x.saturation}\"\n @input=\"${(x, c) => x.handleSaturationInput(c.event)}\"\n @change=\"${(x, c) => x.handleSaturationCommit(c.event)}\"\n />\n </div>\n <div class=\"channel\">\n <div class=\"channel-header\">\n <label class=\"field-label\" for=\"${x => x.lightnessInputId}\">Lightness</label>\n <span class=\"channel-value\">${x => Math.round(x.lightness)}%</span>\n </div>\n <input\n id=\"${x => x.lightnessInputId}\"\n class=\"channel-input\"\n style=\"${x => x.lightnessTrackStyle}\"\n type=\"range\"\n min=\"0\"\n max=\"100\"\n step=\"1\"\n :value=\"${x => x.lightness}\"\n @input=\"${(x, c) => x.handleLightnessInput(c.event)}\"\n @change=\"${(x, c) => x.handleLightnessCommit(c.event)}\"\n />\n </div>\n </div>\n <div class=\"presets\" part=\"presets\">\n <div class=\"field-label\">Suggested swatches</div>\n <div class=\"preset-grid\">\n ${repeat(\n x => x.presets,\n html<string, VioletColorPicker>`\n <button\n class=\"preset-button\"\n type=\"button\"\n aria-label=\"${(preset, c) => c.parent.presetAriaLabel(preset)}\"\n aria-pressed=\"${(preset, c) => String(c.parent.currentDisplayColor === preset)}\"\n @click=\"${(preset, c) => c.parent.applyPreset(preset)}\"\n >\n <violet-color-swatch decorative shape=\"circle\" value=\"${preset => preset}\"></violet-color-swatch>\n </button>\n `,\n )}\n </div>\n </div>\n <slot name=\"presets\"></slot>\n </div>\n </div>\n ${when(\n x => Boolean(x.supportingText) && !x.isInvalid,\n html<VioletColorPicker>`<p class=\"supporting\" part=\"supporting-text\" id=\"${x => x.supportingId}\">${x => x.supportingText}</p>`,\n )}\n ${when(\n x => Boolean(x.isInvalid && x.errorText),\n html<VioletColorPicker>`<p class=\"error\" part=\"error-text\" id=\"${x => x.errorId}\">${x => x.errorText}</p>`,\n )}\n </div>\n`;\n\n/**\n * Violet color picker built from a swatch trigger, textual value, and standard channel controls.\n *\n * @summary Token-driven color picker with a popover editor, hex value entry, and HSL channel sliders.\n * @fires input - Emitted when the selected color changes.\n * @fires change - Emitted when a committed color differs, ignoring case, from the last committed or author-set value.\n * @slot presets - Optional additional preset content rendered under the built-in swatches.\n */\nexport class VioletColorPicker extends FASTElement {\n public static readonly formAssociated = true;\n\n readonly #internals: ElementInternals;\n // The color `change` compares against: the last author-set or committed value, normalized.\n #committedColor = \"\";\n /** The value when the picker was connected, which a form reset restores. */\n #defaultValue = \"\";\n #applyingColor = false;\n readonly #handleViewportChange = () => {\n if (this.open) {\n this.positionPanel();\n }\n };\n\n public readonly labelId: string;\n public readonly triggerId: string;\n public readonly valueId: string;\n public readonly metaId: string;\n public readonly panelId: string;\n public readonly supportingId: string;\n public readonly errorId: string;\n public readonly hexInputId: string;\n public readonly hexHintId: string;\n public readonly hueInputId: string;\n public readonly saturationInputId: string;\n public readonly lightnessInputId: string;\n\n public open = false;\n public hue = 0;\n public saturation = 0;\n public lightness = 0;\n public hexDraft = \"\";\n public validationInvalid = false;\n\n declare public label: string;\n declare public value: string;\n declare public name: string;\n declare public supportingText: string;\n declare public errorText: string;\n declare public disabled: boolean;\n declare public required: boolean;\n declare public invalid: boolean;\n declare public size: VioletColorPickerSize;\n\n /**\n * True while an ancestor `<fieldset disabled>` disables the control.\n */\n declare public fieldsetDisabled: boolean;\n\n /**\n * Author `disabled` or fieldset-disabled.\n */\n declare public readonly effectiveDisabled: boolean;\n\n public constructor() {\n super();\n const id = violetColorPickerCount;\n violetColorPickerCount += 1;\n\n this.#internals = this.attachInternals();\n this.labelId = `violet-color-picker-label-${id}`;\n this.triggerId = `violet-color-picker-trigger-${id}`;\n this.valueId = `violet-color-picker-value-${id}`;\n this.metaId = `violet-color-picker-meta-${id}`;\n this.panelId = `violet-color-picker-panel-${id}`;\n this.supportingId = `violet-color-picker-supporting-${id}`;\n this.errorId = `violet-color-picker-error-${id}`;\n this.hexInputId = `violet-color-picker-hex-${id}`;\n this.hexHintId = `violet-color-picker-hex-hint-${id}`;\n this.hueInputId = `violet-color-picker-hue-${id}`;\n this.saturationInputId = `violet-color-picker-saturation-${id}`;\n this.lightnessInputId = `violet-color-picker-lightness-${id}`;\n\n this.label = \"\";\n this.value = \"\";\n this.name = \"\";\n this.supportingText = \"\";\n this.errorText = \"\";\n this.disabled = false;\n this.required = false;\n this.invalid = false;\n this.size = \"natural\";\n\n this.syncFromColor(this.value);\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n this.#defaultValue = this.value;\n this.#committedColor = this.currentSelectedColor;\n this.syncFromColor(this.value);\n this.#syncFormState();\n this.syncOpenState();\n window.addEventListener(\"resize\", this.#handleViewportChange);\n window.addEventListener(\"scroll\", this.#handleViewportChange, true);\n }\n\n public disconnectedCallback(): void {\n window.removeEventListener(\"resize\", this.#handleViewportChange);\n window.removeEventListener(\"scroll\", this.#handleViewportChange, true);\n super.disconnectedCallback();\n }\n\n public valueChanged(): void {\n if (!this.$fastController.isConnected) {\n return;\n }\n\n if (!this.#applyingColor) {\n this.#committedColor = this.currentSelectedColor;\n }\n\n this.syncFromColor(this.value);\n this.#syncFormState();\n }\n\n public disabledChanged(): void {\n if (this.effectiveDisabled && this.open) {\n this.close();\n }\n\n if (this.$fastController.isConnected) {\n this.#syncFormState();\n }\n }\n\n public requiredChanged(): void {\n if (this.$fastController.isConnected) {\n this.#syncFormState();\n }\n }\n\n public invalidChanged(): void {\n if (this.$fastController.isConnected) {\n this.#syncFormState();\n }\n }\n\n public get form(): HTMLFormElement | null {\n return this.#internals.form;\n }\n\n public get validity(): ValidityState {\n return this.#internals.validity;\n }\n\n public get validationMessage(): string {\n return this.#internals.validationMessage;\n }\n\n public get willValidate(): boolean {\n return this.#internals.willValidate;\n }\n\n public get presets(): string[] {\n return DEFAULT_PRESETS;\n }\n\n public get currentDisplayColor(): string {\n return normalizeHexColor(this.value) ?? hslToHex({ h: this.hue, s: this.saturation, l: this.lightness });\n }\n\n public get currentSelectedColor(): string {\n return normalizeHexColor(this.value) ?? \"\";\n }\n\n public get describedBy(): string {\n const ids: string[] = [];\n\n if (this.isInvalid && this.errorText) {\n ids.push(this.errorId);\n } else if (this.supportingText) {\n ids.push(this.supportingId);\n }\n\n return ids.join(\" \");\n }\n\n public get labelledBy(): string {\n const ids: string[] = [];\n\n if (this.label) {\n ids.push(this.labelId);\n }\n\n // Every visible text of the trigger, in order, so the name contains it (WCAG 2.5.3).\n ids.push(this.valueId, this.metaId);\n return ids.join(\" \");\n }\n\n public get panelLabel(): string {\n return this.label ? `${this.label} color picker` : \"Color picker\";\n }\n\n public get panelTitleText(): string {\n return this.value ? \"Selected color\" : \"No color selected\";\n }\n\n public get controlShellClass(): string {\n return `control-shell${this.open ? \" open\" : \"\"}`;\n }\n\n public get panelClass(): string {\n return `panel${this.open ? \" open\" : \"\"}`;\n }\n\n public get expandedText(): string {\n return String(this.open);\n }\n\n public get ariaInvalidText(): string {\n return this.isInvalid ? \"true\" : \"false\";\n }\n\n public get isInvalid(): boolean {\n return this.invalid || this.validationInvalid;\n }\n\n public get swatchSize(): \"compact\" | \"natural\" | \"comfortable\" {\n return this.size;\n }\n\n public get triggerValueClass(): string {\n return this.value ? \"trigger-value\" : \"trigger-value placeholder\";\n }\n\n public get triggerValueText(): string {\n return this.value || \"Choose color\";\n }\n\n public get triggerMetaText(): string {\n return this.value ? \"Adjust color\" : \"Select a color\";\n }\n\n public get saturationTrackStyle(): string {\n return `--_channel-track: ${saturationGradient(this.hue, this.lightness)};`;\n }\n\n public get lightnessTrackStyle(): string {\n return `--_channel-track: ${lightnessGradient(this.hue, this.saturation)};`;\n }\n\n public toggleOpen(): void {\n if (this.effectiveDisabled) {\n return;\n }\n\n const panel = this.panelElement;\n\n if (!panel) {\n return;\n }\n\n if (panel.matches(\":popover-open\")) {\n panel.hidePopover();\n } else {\n panel.showPopover();\n }\n }\n\n public close(): void {\n if (this.panelElement?.matches(\":popover-open\")) {\n this.panelElement.hidePopover();\n }\n }\n\n public handleToggle(event: ToggleEvent): void {\n this.open = event.newState === \"open\";\n this.syncOpenState();\n\n if (this.open) {\n this.positionPanel();\n requestAnimationFrame(() => {\n this.positionPanel();\n this.hexInputElement?.focus();\n this.hexInputElement?.select();\n });\n } else {\n this.hexDraft = this.currentSelectedColor;\n this.syncHexInputValue();\n }\n }\n\n public handleHexInput(event: Event): void {\n // The native `input` is composed and would reach the host as a second event; this element emits its own.\n event.stopPropagation();\n const input = event.currentTarget as HTMLInputElement;\n this.hexDraft = input.value;\n\n const normalized = normalizeHexColor(input.value);\n\n // Preview only full six-digit colors while typing. Applying \"#167\", valid shorthand on the way to\n // \"#1670ca\", would rewrite the field to \"#116677\" under the caret. Commit expands shorthand.\n if (!normalized || input.value.trim().replace(/^#/, \"\").length !== 6) {\n return;\n }\n\n this.applyColor(normalized, true, false);\n }\n\n public handleInput(event: Event): void {\n this.handleHexInput(event);\n }\n\n public handleHexCommit(event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n const normalized = normalizeHexColor(input.value);\n\n if (!normalized) {\n this.hexDraft = this.currentSelectedColor;\n this.syncHexInputValue();\n return;\n }\n\n this.applyColor(normalized, true, true);\n }\n\n public handleCommit(event: Event): void {\n this.handleHexCommit(event);\n }\n\n public handleChannelInput(channel: \"h\" | \"s\" | \"l\", event: Event): void {\n // The native `input` is composed and would reach the host as a second event; this element emits its own.\n event.stopPropagation();\n const input = event.currentTarget as HTMLInputElement;\n const nextValue = Number(input.value);\n this.updateChannel(channel, nextValue);\n this.commitFromChannels(true, false);\n }\n\n public handleChannelCommit(channel: \"h\" | \"s\" | \"l\", event: Event): void {\n const input = event.currentTarget as HTMLInputElement;\n const nextValue = Number(input.value);\n this.updateChannel(channel, nextValue);\n this.commitFromChannels(true, true);\n }\n\n public handleHueInput(event: Event): void {\n this.handleChannelInput(\"h\", event);\n }\n\n public handleHueCommit(event: Event): void {\n this.handleChannelCommit(\"h\", event);\n }\n\n public handleSaturationInput(event: Event): void {\n this.handleChannelInput(\"s\", event);\n }\n\n public handleSaturationCommit(event: Event): void {\n this.handleChannelCommit(\"s\", event);\n }\n\n public handleLightnessInput(event: Event): void {\n this.handleChannelInput(\"l\", event);\n }\n\n public handleLightnessCommit(event: Event): void {\n this.handleChannelCommit(\"l\", event);\n }\n\n public applyPreset(color: string): void {\n this.applyColor(color, true, true);\n }\n\n public presetAriaLabel(color: string): string {\n return `Use ${color}`;\n }\n\n public formStateRestoreCallback(state: File | string | FormData | null): void {\n if (typeof state === \"string\") {\n this.value = state;\n }\n }\n\n public formResetCallback(): void {\n this.value = this.#defaultValue;\n this.syncFromColor(this.value);\n this.#syncFormState();\n }\n\n public checkValidity(): boolean {\n return this.#internals.checkValidity();\n }\n\n public reportValidity(): boolean {\n return this.#internals.reportValidity();\n }\n\n private get panelElement(): HTMLElement | null {\n return this.shadowRoot?.querySelector(\".panel\") ?? null;\n }\n\n private get controlShellElement(): HTMLElement | null {\n return this.shadowRoot?.querySelector(\".control-shell\") ?? null;\n }\n\n private get hexInputElement(): HTMLInputElement | null {\n return this.shadowRoot?.querySelector(\".hex-input\") ?? null;\n }\n\n private syncFromColor(value: string): void {\n const normalized = normalizeHexColor(value);\n const hsl = hexToHsl(normalized || DEFAULT_COLOR);\n\n if (!hsl) {\n return;\n }\n\n this.hue = hsl.h;\n this.saturation = hsl.s;\n this.lightness = hsl.l;\n this.hexDraft = normalized ?? \"\";\n this.syncHexInputValue();\n }\n\n private updateChannel(channel: \"h\" | \"s\" | \"l\", value: number): void {\n switch (channel) {\n case \"h\":\n this.hue = clamp(value, 0, 360);\n break;\n case \"s\":\n this.saturation = clamp(value, 0, 100);\n break;\n case \"l\":\n this.lightness = clamp(value, 0, 100);\n break;\n }\n }\n\n private commitFromChannels(emitInput: boolean, emitChange: boolean): void {\n const next = hslToHex({\n h: this.hue,\n s: this.saturation,\n l: this.lightness,\n });\n\n this.applyColor(next, emitInput, emitChange);\n }\n\n private applyColor(color: string, emitInput: boolean, emitChange: boolean): void {\n const normalized = normalizeHexColor(color);\n\n if (!normalized) {\n return;\n }\n\n // Comparing normalized colors keeps an author's `#1670CA` from reading as an edit to `#1670ca`.\n const valueChanged = normalized !== this.currentSelectedColor;\n if (valueChanged) {\n this.#applyingColor = true;\n this.value = normalized;\n this.#applyingColor = false;\n }\n this.hexDraft = normalized;\n this.syncFromColor(normalized);\n this.#syncFormState();\n\n if (emitInput && valueChanged) {\n this.$emit(\"input\", { value: normalized });\n }\n\n if (emitChange && normalized !== this.#committedColor) {\n this.#committedColor = normalized;\n this.$emit(\"change\", { value: normalized });\n }\n }\n\n #syncFormState(): void {\n this.#internals.setFormValue(this.value || null);\n\n if (this.effectiveDisabled) {\n this.validationInvalid = false;\n this.removeAttribute(\"data-invalid\");\n this.#internals.setValidity({});\n return;\n }\n\n if (this.invalid) {\n this.validationInvalid = true;\n this.setAttribute(\"data-invalid\", \"\");\n this.#internals.setValidity({ customError: true }, this.errorText || \"The selected color is invalid.\");\n return;\n }\n\n if (this.required && !this.value) {\n this.validationInvalid = true;\n this.setAttribute(\"data-invalid\", \"\");\n this.#internals.setValidity({ valueMissing: true }, this.errorText || \"Select a color.\");\n return;\n }\n\n this.validationInvalid = false;\n this.removeAttribute(\"data-invalid\");\n this.#internals.setValidity({});\n }\n\n private syncHexInputValue(): void {\n const input = this.hexInputElement;\n\n if (!input || input.value === this.hexDraft) {\n return;\n }\n\n input.value = this.hexDraft;\n }\n\n private syncOpenState(): void {\n this.controlShellElement?.classList.toggle(\"open\", this.open);\n this.panelElement?.classList.toggle(\"open\", this.open);\n\n if (this.panelElement) {\n this.panelElement.style.opacity = this.open ? \"1\" : \"0\";\n this.panelElement.style.transform = this.open ? \"translateY(0)\" : \"translateY(calc(var(--_space-stack-xs) * -1))\";\n }\n }\n\n private positionPanel(): void {\n const panel = this.panelElement;\n const trigger = this.shadowRoot?.querySelector(\".trigger\") as HTMLButtonElement | null;\n\n if (!panel || !trigger) {\n return;\n }\n\n const rect = trigger.getBoundingClientRect();\n const viewportPadding = 8;\n const gap = 6;\n\n let left = rect.left;\n let top = rect.bottom + gap;\n const width = Math.min(Math.max(rect.width, 320), window.innerWidth - viewportPadding * 2);\n\n panel.style.width = `${width}px`;\n panel.style.left = `${Math.max(viewportPadding, left)}px`;\n panel.style.top = `${Math.max(viewportPadding, top)}px`;\n\n requestAnimationFrame(() => {\n const panelRect = panel.getBoundingClientRect();\n\n if (panelRect.right > window.innerWidth - viewportPadding) {\n left = Math.max(viewportPadding, window.innerWidth - panelRect.width - viewportPadding);\n }\n\n if (panelRect.bottom > window.innerHeight - viewportPadding) {\n top = Math.max(viewportPadding, rect.top - panelRect.height - gap);\n }\n\n panel.style.left = `${left}px`;\n panel.style.top = `${top}px`;\n });\n }\n}\n\nattr(VioletColorPicker.prototype, \"label\");\nattr(VioletColorPicker.prototype, \"value\");\nattr(VioletColorPicker.prototype, \"name\");\nattr({ attribute: \"supporting-text\" })(VioletColorPicker.prototype, \"supportingText\");\nattr({ attribute: \"error-text\" })(VioletColorPicker.prototype, \"errorText\");\nattr({ mode: \"boolean\" })(VioletColorPicker.prototype, \"disabled\");\ninstallFormDisabled(VioletColorPicker.prototype);\nattr({ mode: \"boolean\" })(VioletColorPicker.prototype, \"required\");\nattr({ mode: \"boolean\" })(VioletColorPicker.prototype, \"invalid\");\nattr(VioletColorPicker.prototype, \"size\");\nobservable(VioletColorPicker.prototype, \"open\");\nobservable(VioletColorPicker.prototype, \"hue\");\nobservable(VioletColorPicker.prototype, \"saturation\");\nobservable(VioletColorPicker.prototype, \"lightness\");\nobservable(VioletColorPicker.prototype, \"hexDraft\");\nobservable(VioletColorPicker.prototype, \"validationInvalid\");\n\nif (!customElements.get(\"violet-color-picker\")) {\n await VioletColorPicker.define({\n name: \"violet-color-picker\",\n template,\n styles,\n shadowOptions: {\n delegatesFocus: true,\n },\n });\n}\n"]}
|
|
@@ -17,9 +17,9 @@ const styles = css `
|
|
|
17
17
|
|
|
18
18
|
:host {
|
|
19
19
|
display: block;
|
|
20
|
-
--_approval-font-size: var(--violet-approval-font-size, var(--_body-size
|
|
21
|
-
--_approval-line-height: var(--violet-approval-line-height, var(--_body-line
|
|
22
|
-
--_approval-caption-size: var(--violet-approval-caption-size, var(--_caption-size
|
|
20
|
+
--_approval-font-size: var(--violet-approval-font-size, var(--_body-size));
|
|
21
|
+
--_approval-line-height: var(--violet-approval-line-height, var(--_body-line));
|
|
22
|
+
--_approval-caption-size: var(--violet-approval-caption-size, var(--_caption-size));
|
|
23
23
|
--_warning-bg-subtle: var(--color-state-warning-background, #f3e8d2);
|
|
24
24
|
--_warning-text: var(--color-state-warning-text, #92400e);
|
|
25
25
|
--_success-bg-subtle: var(--color-state-success-background, #dfeae3);
|
|
@@ -125,7 +125,7 @@ const styles = css `
|
|
|
125
125
|
gap: var(--_space-stack-2xs);
|
|
126
126
|
font-size: var(--_approval-font-size);
|
|
127
127
|
line-height: var(--_approval-line-height);
|
|
128
|
-
color: var(--_text-primary
|
|
128
|
+
color: var(--_text-primary);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
.detail {
|
|
@@ -158,6 +158,20 @@ const styles = css `
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
@media (forced-colors: active) {
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
.frame > * {
|
|
166
|
+
forced-color-adjust: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
slot {
|
|
171
|
+
forced-color-adjust: auto;
|
|
172
|
+
color: CanvasText;
|
|
173
|
+
}
|
|
174
|
+
|
|
161
175
|
.frame::part(root) {
|
|
162
176
|
forced-color-adjust: none;
|
|
163
177
|
border-color: ButtonText;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"violet-approval-card.js","sourceRoot":"","sources":["../../src/conversation/violet-approval-card.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAA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C,CAAC;AACP,CAAC","sourcesContent":["import { FASTElement, attr, css, html, observable } from \"@lushly-dev/fast-element\";\n\nimport { violetSurfaceTokenDefaults } from \"../theme/violet-token-defaults\";\nimport { registerSystemCheckmarkIcon } from \"../icon/generated/icons/system-checkmark\";\nimport { registerSystemDismissIcon } from \"../icon/generated/icons/system-dismiss\";\nimport { registerSystemWarningIcon } from \"../icon/generated/icons/system-warning\";\nimport \"../icon/violet-icon\";\nimport \"../button/violet-button\";\nimport \"../card/violet-card\";\n\nconst styles = css`\n ${violetSurfaceTokenDefaults}\n\n :host {\n display: block;\n --_approval-font-size: var(--violet-approval-font-size, var(--_body-size, 14px));\n --_approval-line-height: var(--violet-approval-line-height, var(--_body-line, 20px));\n --_approval-caption-size: var(--violet-approval-caption-size, var(--_caption-size, 12px));\n --_warning-bg-subtle: var(--color-state-warning-background, #f3e8d2);\n --_warning-text: var(--color-state-warning-text, #92400e);\n --_success-bg-subtle: var(--color-state-success-background, #dfeae3);\n --_success-text: var(--color-state-success-text, #2c5e4b);\n --_danger-bg-subtle: var(--color-state-danger-background, #f7e4df);\n --_danger-text: var(--color-state-danger-text, #c42a1a);\n }\n\n /* The one raised card in a thread: a toned band, the request, and the actions on a band. */\n .frame {\n display: block;\n --violet-card-border-color: transparent;\n --violet-card-background: var(--_surface-card);\n --violet-card-shadow: var(--_shadow-card);\n }\n\n .frame::part(root) {\n overflow: hidden;\n }\n\n /* The toned band is the card's header, edge to edge and straight on to the request. */\n .frame::part(header) {\n padding: 0;\n }\n\n .frame::part(body) {\n border-block-start-color: transparent;\n }\n\n /* Once it is answered there are no actions to hold. */\n :host(:not([state=\"pending\"])) .frame::part(footer) {\n display: none;\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--_space-sm);\n padding: var(--_space-sm) var(--_space-md);\n background: var(--_warning-bg-subtle);\n font-size: var(--type-label-sm-size, 13px);\n line-height: var(--_approval-line-height);\n font-weight: 500;\n color: var(--_warning-text);\n }\n\n :host([state=\"approved\"]) .header {\n background: var(--_success-bg-subtle);\n color: var(--_success-text);\n }\n\n :host([state=\"denied\"]) .header {\n background: var(--_danger-bg-subtle);\n color: var(--_danger-text);\n }\n\n .header-leading {\n display: flex;\n align-items: center;\n gap: var(--_space-sm);\n min-inline-size: 0;\n }\n\n .header-icon {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n --violet-icon-size: 1rem;\n }\n\n .header-title {\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .status-chip {\n flex-shrink: 0;\n margin-inline-start: auto;\n padding: var(--_space-stack-2xs) var(--_space-sm);\n /* The edge is clear; it shows only in forced colours. */\n border: 1px solid transparent;\n border-radius: calc(var(--_radius-md) - 2px);\n background: color-mix(in srgb, currentColor 12%, transparent);\n font-size: var(--_approval-caption-size);\n font-weight: 500;\n line-height: var(--_caption-line);\n color: inherit;\n }\n\n /* On the danger band any tint takes the label under 4.5:1 in the default theme (the band is\n already the danger background), so the denied chip is drawn by a faint edge instead. */\n :host([state=\"denied\"]) .status-chip {\n background: transparent;\n border-color: color-mix(in srgb, currentColor 40%, transparent);\n }\n\n .summary {\n display: grid;\n gap: var(--_space-stack-2xs);\n font-size: var(--_approval-font-size);\n line-height: var(--_approval-line-height);\n color: var(--_text-primary, #181b1a);\n }\n\n .detail {\n display: grid;\n gap: var(--_space-stack-2xs);\n margin-block-start: var(--_space-stack-xs);\n font-size: var(--_approval-caption-size);\n line-height: var(--_caption-line);\n color: var(--_text-muted);\n }\n\n slot[name=\"summary\"]::slotted(*),\n slot[name=\"detail\"]::slotted(*) {\n margin: 0;\n }\n\n .detail[hidden] {\n display: none;\n }\n\n .actions {\n display: flex;\n align-items: center;\n gap: var(--_space-sm);\n padding: 0;\n }\n\n .actions[hidden] {\n display: none;\n }\n\n @media (forced-colors: active) {\n .frame::part(root) {\n forced-color-adjust: none;\n border-color: ButtonText;\n background: Canvas;\n }\n\n .status-chip {\n border-color: currentColor;\n }\n\n .frame::part(body) {\n border-block-start-color: ButtonText;\n }\n\n /* Inside the opted-out root the theme's text colours stay, so the text takes the system's. */\n .header,\n :host([state]) .header,\n .summary,\n .detail {\n background: Canvas;\n color: CanvasText;\n }\n /* Nested controls and icons take the system's colours again. */\n violet-button,\n violet-icon,\n ::slotted(violet-button),\n ::slotted(violet-icon) {\n forced-color-adjust: auto;\n }\n }\n`;\n\nconst template = html<VioletApprovalCard>`\n <violet-card class=\"frame\" part=\"root\" appearance=\"outline\" padding=\"medium\" aria-label=\"Action requires approval\">\n <div class=\"header\" part=\"header\" slot=\"header\">\n <span class=\"header-leading\">\n <span class=\"header-icon\">\n ${x => {\n if (x.state === \"approved\") {\n return html`<violet-icon icon=\"system/checkmark\" decorative></violet-icon>`;\n }\n if (x.state === \"denied\") {\n return html`<violet-icon icon=\"system/dismiss\" decorative></violet-icon>`;\n }\n return html`<violet-icon icon=\"system/warning\" decorative></violet-icon>`;\n }}\n </span>\n <span class=\"header-title\">\n ${x => {\n if (x.state === \"approved\") { return \"Approved\"; }\n if (x.state === \"denied\") { return \"Denied\"; }\n return \"Approval required\";\n }}\n </span>\n </span>\n <span class=\"status-chip\" part=\"status-chip\">\n ${x => {\n if (x.state === \"approved\") { return \"Confirmed\"; }\n if (x.state === \"denied\") { return \"Blocked\"; }\n return \"Pending\";\n }}\n </span>\n </div>\n <div class=\"summary\" part=\"summary\" ?hidden=\"${x => !x.hasSummary}\">\n <slot name=\"summary\" @slotchange=\"${x => x.handleSummarySlotChange()}\"></slot>\n </div>\n <div class=\"detail\" part=\"detail\" ?hidden=\"${x => !x.hasDetail}\">\n <slot name=\"detail\" @slotchange=\"${x => x.handleDetailSlotChange()}\"></slot>\n </div>\n <div class=\"actions\" part=\"actions\" slot=\"footer\" ?hidden=\"${x => x.state !== \"pending\"}\">\n <slot name=\"actions\">\n <violet-button\n appearance=\"primary\"\n part=\"approve-button\"\n @click=\"${x => x.handleApprove()}\"\n >Approve</violet-button>\n <violet-button\n appearance=\"secondary\"\n part=\"deny-button\"\n @click=\"${x => x.handleDeny()}\"\n >Deny</violet-button>\n </slot>\n </div>\n </violet-card>\n`;\n\n/**\n * Violet approval card.\n *\n * @summary Human-in-the-loop approval surface for sensitive tool actions.\n * Maps to TanStack AI approval-requested / AI SDK approval flow.\n * @slot summary - What action needs approval.\n * @slot detail - Expanded explanation or consequences.\n * @slot actions - Custom action buttons (approve/deny provided by default).\n * @csspart root - The outer container.\n * @csspart header - The status header bar.\n * @csspart summary - The action summary.\n * @csspart detail - The detail section.\n * @csspart actions - The action button row.\n * @csspart approve-button - The default approve button.\n * @csspart deny-button - The default deny button.\n * @fires approve - When the user approves the action.\n * @fires deny - When the user denies the action.\n */\nexport class VioletApprovalCard extends FASTElement {\n declare public state: string;\n\n @observable\n declare public hasSummary: boolean;\n\n @observable\n declare public hasDetail: boolean;\n\n public constructor() {\n super();\n this.state = \"pending\";\n this.hasSummary = false;\n this.hasDetail = false;\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n registerSystemCheckmarkIcon();\n registerSystemDismissIcon();\n registerSystemWarningIcon();\n this.handleSummarySlotChange();\n this.handleDetailSlotChange();\n }\n\n public handleApprove(): void {\n this.$emit(\"approve\");\n }\n\n public handleDeny(): void {\n this.$emit(\"deny\");\n }\n\n public handleSummarySlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"summary\"]') as HTMLSlotElement | null;\n this.hasSummary = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n\n public handleDetailSlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"detail\"]') as HTMLSlotElement | null;\n this.hasDetail = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n}\n\nexport type VioletApprovalState = \"pending\" | \"approved\" | \"denied\";\n\nattr(VioletApprovalCard.prototype, \"state\");\n\nif (!customElements.get(\"violet-approval-card\")) {\n await FASTElement.define(VioletApprovalCard, {\n name: \"violet-approval-card\",\n template,\n styles,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"violet-approval-card.js","sourceRoot":"","sources":["../../src/conversation/violet-approval-card.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACnF,OAAO,qBAAqB,CAAC;AAC7B,OAAO,yBAAyB,CAAC;AACjC,OAAO,qBAAqB,CAAC;AAE7B,MAAM,MAAM,GAAG,GAAG,CAAA;MACZ,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6L/B,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,CAAoB;;;;;sBAKnB,CAAC,CAAC,EAAE;IACF,IAAI,CAAC,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;QACzB,OAAO,IAAI,CAAA,gEAAgE,CAAC;IAChF,CAAC;IACD,IAAI,CAAC,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,IAAI,CAAA,8DAA8D,CAAC;IAC9E,CAAC;IACD,OAAO,IAAI,CAAA,8DAA8D,C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CAAC;IACP,CAAC;CACJ;AAhDkB;IADd,UAAU;sDACwB;AAGpB;IADd,UAAU;qDACuB;AAiDtC,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAE5C,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;IAC9C,MAAM,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE;QACzC,IAAI,EAAE,sBAAsB;QAC5B,QAAQ;QACR,MAAM;KACT,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { FASTElement, attr, css, html, observable } from \"@lushly-dev/fast-element\";\n\nimport { violetSurfaceTokenDefaults } from \"../theme/violet-token-defaults\";\nimport { registerSystemCheckmarkIcon } from \"../icon/generated/icons/system-checkmark\";\nimport { registerSystemDismissIcon } from \"../icon/generated/icons/system-dismiss\";\nimport { registerSystemWarningIcon } from \"../icon/generated/icons/system-warning\";\nimport \"../icon/violet-icon\";\nimport \"../button/violet-button\";\nimport \"../card/violet-card\";\n\nconst styles = css`\n ${violetSurfaceTokenDefaults}\n\n :host {\n display: block;\n --_approval-font-size: var(--violet-approval-font-size, var(--_body-size));\n --_approval-line-height: var(--violet-approval-line-height, var(--_body-line));\n --_approval-caption-size: var(--violet-approval-caption-size, var(--_caption-size));\n --_warning-bg-subtle: var(--color-state-warning-background, #f3e8d2);\n --_warning-text: var(--color-state-warning-text, #92400e);\n --_success-bg-subtle: var(--color-state-success-background, #dfeae3);\n --_success-text: var(--color-state-success-text, #2c5e4b);\n --_danger-bg-subtle: var(--color-state-danger-background, #f7e4df);\n --_danger-text: var(--color-state-danger-text, #c42a1a);\n }\n\n /* The one raised card in a thread: a toned band, the request, and the actions on a band. */\n .frame {\n display: block;\n --violet-card-border-color: transparent;\n --violet-card-background: var(--_surface-card);\n --violet-card-shadow: var(--_shadow-card);\n }\n\n .frame::part(root) {\n overflow: hidden;\n }\n\n /* The toned band is the card's header, edge to edge and straight on to the request. */\n .frame::part(header) {\n padding: 0;\n }\n\n .frame::part(body) {\n border-block-start-color: transparent;\n }\n\n /* Once it is answered there are no actions to hold. */\n :host(:not([state=\"pending\"])) .frame::part(footer) {\n display: none;\n }\n\n .header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--_space-sm);\n padding: var(--_space-sm) var(--_space-md);\n background: var(--_warning-bg-subtle);\n font-size: var(--type-label-sm-size, 13px);\n line-height: var(--_approval-line-height);\n font-weight: 500;\n color: var(--_warning-text);\n }\n\n :host([state=\"approved\"]) .header {\n background: var(--_success-bg-subtle);\n color: var(--_success-text);\n }\n\n :host([state=\"denied\"]) .header {\n background: var(--_danger-bg-subtle);\n color: var(--_danger-text);\n }\n\n .header-leading {\n display: flex;\n align-items: center;\n gap: var(--_space-sm);\n min-inline-size: 0;\n }\n\n .header-icon {\n flex-shrink: 0;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n --violet-icon-size: 1rem;\n }\n\n .header-title {\n min-inline-size: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .status-chip {\n flex-shrink: 0;\n margin-inline-start: auto;\n padding: var(--_space-stack-2xs) var(--_space-sm);\n /* The edge is clear; it shows only in forced colours. */\n border: 1px solid transparent;\n border-radius: calc(var(--_radius-md) - 2px);\n background: color-mix(in srgb, currentColor 12%, transparent);\n font-size: var(--_approval-caption-size);\n font-weight: 500;\n line-height: var(--_caption-line);\n color: inherit;\n }\n\n /* On the danger band any tint takes the label under 4.5:1 in the default theme (the band is\n already the danger background), so the denied chip is drawn by a faint edge instead. */\n :host([state=\"denied\"]) .status-chip {\n background: transparent;\n border-color: color-mix(in srgb, currentColor 40%, transparent);\n }\n\n .summary {\n display: grid;\n gap: var(--_space-stack-2xs);\n font-size: var(--_approval-font-size);\n line-height: var(--_approval-line-height);\n color: var(--_text-primary);\n }\n\n .detail {\n display: grid;\n gap: var(--_space-stack-2xs);\n margin-block-start: var(--_space-stack-xs);\n font-size: var(--_approval-caption-size);\n line-height: var(--_caption-line);\n color: var(--_text-muted);\n }\n\n slot[name=\"summary\"]::slotted(*),\n slot[name=\"detail\"]::slotted(*) {\n margin: 0;\n }\n\n .detail[hidden] {\n display: none;\n }\n\n .actions {\n display: flex;\n align-items: center;\n gap: var(--_space-sm);\n padding: 0;\n }\n\n .actions[hidden] {\n display: none;\n }\n\n @media (forced-colors: active) {\n /*\n * The card's slots let what is slotted into a card take the system colours; what this\n * component puts in its card it paints itself, so it opts out again.\n */\n .frame > * {\n forced-color-adjust: none;\n }\n\n /* What is slotted into this component takes the system colours. */\n slot {\n forced-color-adjust: auto;\n color: CanvasText;\n }\n\n .frame::part(root) {\n forced-color-adjust: none;\n border-color: ButtonText;\n background: Canvas;\n }\n\n .status-chip {\n border-color: currentColor;\n }\n\n .frame::part(body) {\n border-block-start-color: ButtonText;\n }\n\n /* Inside the opted-out root the theme's text colours stay, so the text takes the system's. */\n .header,\n :host([state]) .header,\n .summary,\n .detail {\n background: Canvas;\n color: CanvasText;\n }\n /* Nested controls and icons take the system's colours again. */\n violet-button,\n violet-icon,\n ::slotted(violet-button),\n ::slotted(violet-icon) {\n forced-color-adjust: auto;\n }\n }\n`;\n\nconst template = html<VioletApprovalCard>`\n <violet-card class=\"frame\" part=\"root\" appearance=\"outline\" padding=\"medium\" aria-label=\"Action requires approval\">\n <div class=\"header\" part=\"header\" slot=\"header\">\n <span class=\"header-leading\">\n <span class=\"header-icon\">\n ${x => {\n if (x.state === \"approved\") {\n return html`<violet-icon icon=\"system/checkmark\" decorative></violet-icon>`;\n }\n if (x.state === \"denied\") {\n return html`<violet-icon icon=\"system/dismiss\" decorative></violet-icon>`;\n }\n return html`<violet-icon icon=\"system/warning\" decorative></violet-icon>`;\n }}\n </span>\n <span class=\"header-title\">\n ${x => {\n if (x.state === \"approved\") { return \"Approved\"; }\n if (x.state === \"denied\") { return \"Denied\"; }\n return \"Approval required\";\n }}\n </span>\n </span>\n <span class=\"status-chip\" part=\"status-chip\">\n ${x => {\n if (x.state === \"approved\") { return \"Confirmed\"; }\n if (x.state === \"denied\") { return \"Blocked\"; }\n return \"Pending\";\n }}\n </span>\n </div>\n <div class=\"summary\" part=\"summary\" ?hidden=\"${x => !x.hasSummary}\">\n <slot name=\"summary\" @slotchange=\"${x => x.handleSummarySlotChange()}\"></slot>\n </div>\n <div class=\"detail\" part=\"detail\" ?hidden=\"${x => !x.hasDetail}\">\n <slot name=\"detail\" @slotchange=\"${x => x.handleDetailSlotChange()}\"></slot>\n </div>\n <div class=\"actions\" part=\"actions\" slot=\"footer\" ?hidden=\"${x => x.state !== \"pending\"}\">\n <slot name=\"actions\">\n <violet-button\n appearance=\"primary\"\n part=\"approve-button\"\n @click=\"${x => x.handleApprove()}\"\n >Approve</violet-button>\n <violet-button\n appearance=\"secondary\"\n part=\"deny-button\"\n @click=\"${x => x.handleDeny()}\"\n >Deny</violet-button>\n </slot>\n </div>\n </violet-card>\n`;\n\n/**\n * Violet approval card.\n *\n * @summary Human-in-the-loop approval surface for sensitive tool actions.\n * Maps to TanStack AI approval-requested / AI SDK approval flow.\n * @slot summary - What action needs approval.\n * @slot detail - Expanded explanation or consequences.\n * @slot actions - Custom action buttons (approve/deny provided by default).\n * @csspart root - The outer container.\n * @csspart header - The status header bar.\n * @csspart summary - The action summary.\n * @csspart detail - The detail section.\n * @csspart actions - The action button row.\n * @csspart approve-button - The default approve button.\n * @csspart deny-button - The default deny button.\n * @fires approve - When the user approves the action.\n * @fires deny - When the user denies the action.\n */\nexport class VioletApprovalCard extends FASTElement {\n declare public state: string;\n\n @observable\n declare public hasSummary: boolean;\n\n @observable\n declare public hasDetail: boolean;\n\n public constructor() {\n super();\n this.state = \"pending\";\n this.hasSummary = false;\n this.hasDetail = false;\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n registerSystemCheckmarkIcon();\n registerSystemDismissIcon();\n registerSystemWarningIcon();\n this.handleSummarySlotChange();\n this.handleDetailSlotChange();\n }\n\n public handleApprove(): void {\n this.$emit(\"approve\");\n }\n\n public handleDeny(): void {\n this.$emit(\"deny\");\n }\n\n public handleSummarySlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"summary\"]') as HTMLSlotElement | null;\n this.hasSummary = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n\n public handleDetailSlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"detail\"]') as HTMLSlotElement | null;\n this.hasDetail = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n}\n\nexport type VioletApprovalState = \"pending\" | \"approved\" | \"denied\";\n\nattr(VioletApprovalCard.prototype, \"state\");\n\nif (!customElements.get(\"violet-approval-card\")) {\n await FASTElement.define(VioletApprovalCard, {\n name: \"violet-approval-card\",\n template,\n styles,\n });\n}\n"]}
|
|
@@ -16,8 +16,8 @@ const styles = css `
|
|
|
16
16
|
|
|
17
17
|
:host {
|
|
18
18
|
display: block;
|
|
19
|
-
--_composer-font-size: var(--violet-composer-font-size, var(--_body-size
|
|
20
|
-
--_composer-line-height: var(--violet-composer-line-height, var(--_body-line
|
|
19
|
+
--_composer-font-size: var(--violet-composer-font-size, var(--_body-size));
|
|
20
|
+
--_composer-line-height: var(--violet-composer-line-height, var(--_body-line));
|
|
21
21
|
--_composer-min-rows: var(--violet-composer-min-rows, 3);
|
|
22
22
|
--_composer-max-rows: var(--violet-composer-max-rows, 8);
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"violet-chat-composer.js","sourceRoot":"","sources":["../../src/conversation/violet-chat-composer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAA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C,CAAC;AAClD,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC5C,kFAAkF;AAClF,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAClE,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAEpE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;IAC9C,MAAM,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE;QACzC,IAAI,EAAE,sBAAsB;QAC5B,QAAQ;QACR,MAAM;QACN,aAAa,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;KAC1C,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { FASTElement, attr, css, html, observable } from \"@lushly-dev/fast-element\";\n\nimport { violetSurfaceTokenDefaults } from \"../theme/violet-token-defaults\";\nimport { registerSystemArrowUpIcon } from \"../icon/generated/icons/system-arrow-up\";\nimport { registerSystemStopIcon } from \"../icon/generated/icons/system-stop\";\nimport \"../icon/violet-icon\";\nimport \"../icon-button/violet-icon-button\";\nimport \"../text-area/violet-text-area\";\nimport type { VioletTextArea } from \"../text-area/violet-text-area\";\n\nconst styles = css`\n ${violetSurfaceTokenDefaults}\n\n :host {\n display: block;\n --_composer-font-size: var(--violet-composer-font-size, var(--_body-size, 14px));\n --_composer-line-height: var(--violet-composer-line-height, var(--_body-line, 20px));\n --_composer-min-rows: var(--violet-composer-min-rows, 3);\n --_composer-max-rows: var(--violet-composer-max-rows, 8);\n }\n\n .root {\n display: flex;\n flex-direction: column;\n /* Raised, so it reads as the place to write without a drawn box. The edge shows only in forced colours. */\n border: var(--_card-border-width, 1px) solid transparent;\n border-radius: var(--_radius-lg);\n background: var(--_surface-card);\n box-shadow: var(--_shadow-card);\n overflow: hidden;\n transition: box-shadow 0.15s ease;\n }\n\n .root:focus-within {\n box-shadow:\n var(--_shadow-card),\n 0 0 0 2px var(--_focus-ring);\n }\n\n .input-row {\n display: flex;\n align-items: flex-end;\n gap: var(--_space-sm);\n padding: var(--_space-sm) var(--_space-md);\n }\n\n .input-field {\n flex: 1;\n min-inline-size: 0;\n --_surface-page: transparent;\n --_surface-subtle: transparent;\n --_border-subtle: transparent;\n --_shadow-control: none;\n --_focus-ring: transparent;\n }\n\n .input-field::part(control-frame) {\n min-block-size: auto;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n }\n\n .input-field::part(label) {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n\n .input-field::part(control) {\n min-block-size: calc(var(--_composer-line-height) * var(--_composer-min-rows));\n max-block-size: calc(var(--_composer-line-height) * var(--_composer-max-rows));\n padding-block: var(--_space-xs, 4px);\n resize: none;\n overflow-y: auto;\n field-sizing: content;\n }\n\n .actions {\n display: flex;\n align-items: center;\n gap: var(--_space-sm);\n padding: 0 var(--_space-md) var(--_space-sm);\n }\n\n .actions[hidden] {\n display: none;\n }\n\n .footer {\n padding: var(--_space-xs, 4px) var(--_space-md);\n border-block-start: var(--_card-border-width, 1px) solid transparent;\n font-size: var(--_caption-size);\n color: var(--_text-muted);\n }\n\n .footer[hidden] {\n display: none;\n }\n\n @media (forced-colors: active) {\n .root {\n forced-color-adjust: none;\n border-color: ButtonText;\n background: Canvas;\n box-shadow: none;\n }\n\n .root:focus-within {\n box-shadow: 0 0 0 2px Highlight;\n }\n }\n`;\n\nconst template = html<VioletChatComposer>`\n <div class=\"root\" part=\"root\">\n <div class=\"input-row\">\n <violet-text-area\n class=\"input-field\"\n part=\"input\"\n label=\"${x => x.label}\"\n placeholder=\"${x => x.placeholder}\"\n value=\"${x => x.value}\"\n ?disabled=\"${x => x.disabled || x.status === \"submitted\" || x.status === \"streaming\"}\"\n rows=\"3\"\n @keydown=\"${(x, c) => x.handleKeydown(c.event as KeyboardEvent)}\"\n @input=\"${(x, c) => x.handleInput(c.event)}\"\n ></violet-text-area>\n ${x => x.status === \"streaming\"\n ? html<VioletChatComposer>`\n <violet-icon-button\n appearance=\"primary\"\n label=\"Stop generating\"\n part=\"stop-button\"\n @click=\"${x => x.handleStop()}\"\n >\n <violet-icon icon=\"system/stop\" decorative></violet-icon>\n </violet-icon-button>\n `\n : html<VioletChatComposer>`\n <violet-icon-button\n appearance=\"primary\"\n label=\"Send message\"\n part=\"submit-button\"\n ?disabled=\"${x => !x.canSubmit}\"\n @click=\"${x => x.handleSubmit()}\"\n >\n <violet-icon icon=\"system/arrow-up\" decorative></violet-icon>\n </violet-icon-button>\n `\n }\n </div>\n <div class=\"actions\" part=\"actions\" ?hidden=\"${x => !x.hasActions}\">\n <slot name=\"actions\" @slotchange=\"${x => x.handleActionsSlotChange()}\"></slot>\n </div>\n <div class=\"footer\" part=\"footer\" ?hidden=\"${x => !x.hasFooter}\">\n <slot name=\"footer\" @slotchange=\"${x => x.handleFooterSlotChange()}\"></slot>\n </div>\n </div>\n`;\n\n/**\n * Violet chat composer.\n *\n * @summary Prompt input shell with auto-growing textarea, submit/stop\n * toggle, and optional action and footer slots.\n * @attr label - Programmatic label forwarded to the composer input.\n * @slot actions - Action buttons (attach file, etc.).\n * @slot footer - Below-input content (token count, model picker, etc.).\n * @csspart root - The outer container.\n * @csspart input - The textarea.\n * @csspart submit-button - The send button.\n * @csspart stop-button - The stop button (shown during streaming).\n * @csspart actions - The action button row.\n * @csspart footer - The footer area.\n * @fires submit - When the user submits a message. Detail: { text }.\n * @fires stop - When the user clicks stop during streaming.\n */\nexport class VioletChatComposer extends FASTElement {\n declare public status: string;\n declare public placeholder: string;\n declare public label: string;\n declare public disabled: boolean;\n declare public value: string;\n\n @observable\n declare public hasInput: boolean;\n\n @observable\n declare public hasActions: boolean;\n\n @observable\n declare public hasFooter: boolean;\n\n public constructor() {\n super();\n this.status = \"ready\";\n this.placeholder = \"Send a message\\u2026\";\n this.label = \"Message\";\n this.disabled = false;\n this.value = \"\";\n this.hasInput = false;\n this.hasActions = false;\n this.hasFooter = false;\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n registerSystemArrowUpIcon();\n registerSystemStopIcon();\n this.syncInputState();\n queueMicrotask(() => this.syncTextareaHeight());\n }\n\n get textAreaField(): VioletTextArea | null {\n return this.shadowRoot?.querySelector(\"violet-text-area\") as VioletTextArea | null;\n }\n\n get textareaEl(): HTMLTextAreaElement | null {\n return this.textAreaField?.shadowRoot?.querySelector(\"textarea\") as HTMLTextAreaElement | null;\n }\n\n get canSubmit(): boolean {\n return !this.disabled && this.status !== \"submitted\" && this.status !== \"streaming\" && Boolean(this.value.trim());\n }\n\n public handleKeydown(event: KeyboardEvent): boolean {\n // Enter that confirms an IME composition must not submit the message.\n if (event.isComposing || event.keyCode === 229) {\n return true;\n }\n\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n // Enter never stops a running response; Stop is the explicit button.\n if (this.status !== \"streaming\") {\n this.handleSubmit();\n }\n return false;\n }\n return true;\n }\n\n public handleInput(_event: Event): void {\n const field = this.textAreaField;\n this.value = field?.value ?? \"\";\n this.hasInput = Boolean(this.value.trim());\n this.syncTextareaHeight();\n }\n\n public handleSubmit(): void {\n const field = this.textAreaField;\n const text = field?.value.trim();\n if (!text || this.disabled || this.status === \"submitted\" || this.status === \"streaming\") {\n return;\n }\n\n this.$emit(\"submit\", { text });\n\n if (field) {\n field.value = \"\";\n }\n this.value = \"\";\n this.hasInput = false;\n this.syncTextareaHeight();\n }\n\n public handleStop(): void {\n this.$emit(\"stop\");\n }\n\n public handleActionsSlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"actions\"]') as HTMLSlotElement | null;\n this.hasActions = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n\n public handleFooterSlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"footer\"]') as HTMLSlotElement | null;\n this.hasFooter = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n\n public valueChanged(): void {\n if (this.$fastController.isConnected) {\n this.syncInputState();\n queueMicrotask(() => this.syncTextareaHeight());\n }\n }\n\n public syncInputState(): void {\n this.hasInput = Boolean(this.value.trim());\n }\n\n public syncTextareaHeight(): void {\n const textarea = this.textareaEl;\n if (!textarea) {\n return;\n }\n\n const lineHeight = Number.parseFloat(getComputedStyle(textarea).lineHeight) || 20;\n const maxRows = Number.parseFloat(getComputedStyle(this).getPropertyValue(\"--_composer-max-rows\")) || 8;\n const maxHeight = lineHeight * maxRows;\n\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;\n textarea.style.overflowY = textarea.scrollHeight > maxHeight ? \"auto\" : \"hidden\";\n }\n}\n\nexport type VioletChatComposerStatus = \"ready\" | \"submitted\" | \"streaming\" | \"error\";\n\nattr(VioletChatComposer.prototype, \"status\");\nattr(VioletChatComposer.prototype, \"placeholder\");\nattr(VioletChatComposer.prototype, \"label\");\n// fromView: typed text must not be reflected back into the DOM `value` attribute.\nattr({ mode: \"fromView\" })(VioletChatComposer.prototype, \"value\");\nattr({ mode: \"boolean\" })(VioletChatComposer.prototype, \"disabled\");\n\nif (!customElements.get(\"violet-chat-composer\")) {\n await FASTElement.define(VioletChatComposer, {\n name: \"violet-chat-composer\",\n template,\n styles,\n shadowOptions: { delegatesFocus: true },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"violet-chat-composer.js","sourceRoot":"","sources":["../../src/conversation/violet-chat-composer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,E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EAAE,QAAQ,CAAC,CAAC;AAC7C,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAClD,IAAI,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC5C,kFAAkF;AAClF,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAClE,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAEpE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,sBAAsB,CAAC,EAAE,CAAC;IAC9C,MAAM,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE;QACzC,IAAI,EAAE,sBAAsB;QAC5B,QAAQ;QACR,MAAM;QACN,aAAa,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;KAC1C,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { FASTElement, attr, css, html, observable } from \"@lushly-dev/fast-element\";\n\nimport { violetSurfaceTokenDefaults } from \"../theme/violet-token-defaults\";\nimport { registerSystemArrowUpIcon } from \"../icon/generated/icons/system-arrow-up\";\nimport { registerSystemStopIcon } from \"../icon/generated/icons/system-stop\";\nimport \"../icon/violet-icon\";\nimport \"../icon-button/violet-icon-button\";\nimport \"../text-area/violet-text-area\";\nimport type { VioletTextArea } from \"../text-area/violet-text-area\";\n\nconst styles = css`\n ${violetSurfaceTokenDefaults}\n\n :host {\n display: block;\n --_composer-font-size: var(--violet-composer-font-size, var(--_body-size));\n --_composer-line-height: var(--violet-composer-line-height, var(--_body-line));\n --_composer-min-rows: var(--violet-composer-min-rows, 3);\n --_composer-max-rows: var(--violet-composer-max-rows, 8);\n }\n\n .root {\n display: flex;\n flex-direction: column;\n /* Raised, so it reads as the place to write without a drawn box. The edge shows only in forced colours. */\n border: var(--_card-border-width, 1px) solid transparent;\n border-radius: var(--_radius-lg);\n background: var(--_surface-card);\n box-shadow: var(--_shadow-card);\n overflow: hidden;\n transition: box-shadow 0.15s ease;\n }\n\n .root:focus-within {\n box-shadow:\n var(--_shadow-card),\n 0 0 0 2px var(--_focus-ring);\n }\n\n .input-row {\n display: flex;\n align-items: flex-end;\n gap: var(--_space-sm);\n padding: var(--_space-sm) var(--_space-md);\n }\n\n .input-field {\n flex: 1;\n min-inline-size: 0;\n --_surface-page: transparent;\n --_surface-subtle: transparent;\n --_border-subtle: transparent;\n --_shadow-control: none;\n --_focus-ring: transparent;\n }\n\n .input-field::part(control-frame) {\n min-block-size: auto;\n padding: 0;\n border: 0;\n background: transparent;\n box-shadow: none;\n }\n\n .input-field::part(label) {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n }\n\n .input-field::part(control) {\n min-block-size: calc(var(--_composer-line-height) * var(--_composer-min-rows));\n max-block-size: calc(var(--_composer-line-height) * var(--_composer-max-rows));\n padding-block: var(--_space-xs, 4px);\n resize: none;\n overflow-y: auto;\n field-sizing: content;\n }\n\n .actions {\n display: flex;\n align-items: center;\n gap: var(--_space-sm);\n padding: 0 var(--_space-md) var(--_space-sm);\n }\n\n .actions[hidden] {\n display: none;\n }\n\n .footer {\n padding: var(--_space-xs, 4px) var(--_space-md);\n border-block-start: var(--_card-border-width, 1px) solid transparent;\n font-size: var(--_caption-size);\n color: var(--_text-muted);\n }\n\n .footer[hidden] {\n display: none;\n }\n\n @media (forced-colors: active) {\n .root {\n forced-color-adjust: none;\n border-color: ButtonText;\n background: Canvas;\n box-shadow: none;\n }\n\n .root:focus-within {\n box-shadow: 0 0 0 2px Highlight;\n }\n }\n`;\n\nconst template = html<VioletChatComposer>`\n <div class=\"root\" part=\"root\">\n <div class=\"input-row\">\n <violet-text-area\n class=\"input-field\"\n part=\"input\"\n label=\"${x => x.label}\"\n placeholder=\"${x => x.placeholder}\"\n value=\"${x => x.value}\"\n ?disabled=\"${x => x.disabled || x.status === \"submitted\" || x.status === \"streaming\"}\"\n rows=\"3\"\n @keydown=\"${(x, c) => x.handleKeydown(c.event as KeyboardEvent)}\"\n @input=\"${(x, c) => x.handleInput(c.event)}\"\n ></violet-text-area>\n ${x => x.status === \"streaming\"\n ? html<VioletChatComposer>`\n <violet-icon-button\n appearance=\"primary\"\n label=\"Stop generating\"\n part=\"stop-button\"\n @click=\"${x => x.handleStop()}\"\n >\n <violet-icon icon=\"system/stop\" decorative></violet-icon>\n </violet-icon-button>\n `\n : html<VioletChatComposer>`\n <violet-icon-button\n appearance=\"primary\"\n label=\"Send message\"\n part=\"submit-button\"\n ?disabled=\"${x => !x.canSubmit}\"\n @click=\"${x => x.handleSubmit()}\"\n >\n <violet-icon icon=\"system/arrow-up\" decorative></violet-icon>\n </violet-icon-button>\n `\n }\n </div>\n <div class=\"actions\" part=\"actions\" ?hidden=\"${x => !x.hasActions}\">\n <slot name=\"actions\" @slotchange=\"${x => x.handleActionsSlotChange()}\"></slot>\n </div>\n <div class=\"footer\" part=\"footer\" ?hidden=\"${x => !x.hasFooter}\">\n <slot name=\"footer\" @slotchange=\"${x => x.handleFooterSlotChange()}\"></slot>\n </div>\n </div>\n`;\n\n/**\n * Violet chat composer.\n *\n * @summary Prompt input shell with auto-growing textarea, submit/stop\n * toggle, and optional action and footer slots.\n * @attr label - Programmatic label forwarded to the composer input.\n * @slot actions - Action buttons (attach file, etc.).\n * @slot footer - Below-input content (token count, model picker, etc.).\n * @csspart root - The outer container.\n * @csspart input - The textarea.\n * @csspart submit-button - The send button.\n * @csspart stop-button - The stop button (shown during streaming).\n * @csspart actions - The action button row.\n * @csspart footer - The footer area.\n * @fires submit - When the user submits a message. Detail: { text }.\n * @fires stop - When the user clicks stop during streaming.\n */\nexport class VioletChatComposer extends FASTElement {\n declare public status: string;\n declare public placeholder: string;\n declare public label: string;\n declare public disabled: boolean;\n declare public value: string;\n\n @observable\n declare public hasInput: boolean;\n\n @observable\n declare public hasActions: boolean;\n\n @observable\n declare public hasFooter: boolean;\n\n public constructor() {\n super();\n this.status = \"ready\";\n this.placeholder = \"Send a message\\u2026\";\n this.label = \"Message\";\n this.disabled = false;\n this.value = \"\";\n this.hasInput = false;\n this.hasActions = false;\n this.hasFooter = false;\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n registerSystemArrowUpIcon();\n registerSystemStopIcon();\n this.syncInputState();\n queueMicrotask(() => this.syncTextareaHeight());\n }\n\n get textAreaField(): VioletTextArea | null {\n return this.shadowRoot?.querySelector(\"violet-text-area\") as VioletTextArea | null;\n }\n\n get textareaEl(): HTMLTextAreaElement | null {\n return this.textAreaField?.shadowRoot?.querySelector(\"textarea\") as HTMLTextAreaElement | null;\n }\n\n get canSubmit(): boolean {\n return !this.disabled && this.status !== \"submitted\" && this.status !== \"streaming\" && Boolean(this.value.trim());\n }\n\n public handleKeydown(event: KeyboardEvent): boolean {\n // Enter that confirms an IME composition must not submit the message.\n if (event.isComposing || event.keyCode === 229) {\n return true;\n }\n\n if (event.key === \"Enter\" && !event.shiftKey) {\n event.preventDefault();\n // Enter never stops a running response; Stop is the explicit button.\n if (this.status !== \"streaming\") {\n this.handleSubmit();\n }\n return false;\n }\n return true;\n }\n\n public handleInput(_event: Event): void {\n const field = this.textAreaField;\n this.value = field?.value ?? \"\";\n this.hasInput = Boolean(this.value.trim());\n this.syncTextareaHeight();\n }\n\n public handleSubmit(): void {\n const field = this.textAreaField;\n const text = field?.value.trim();\n if (!text || this.disabled || this.status === \"submitted\" || this.status === \"streaming\") {\n return;\n }\n\n this.$emit(\"submit\", { text });\n\n if (field) {\n field.value = \"\";\n }\n this.value = \"\";\n this.hasInput = false;\n this.syncTextareaHeight();\n }\n\n public handleStop(): void {\n this.$emit(\"stop\");\n }\n\n public handleActionsSlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"actions\"]') as HTMLSlotElement | null;\n this.hasActions = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n\n public handleFooterSlotChange(): void {\n const slot = this.shadowRoot?.querySelector('slot[name=\"footer\"]') as HTMLSlotElement | null;\n this.hasFooter = (slot?.assignedNodes({ flatten: true }) ?? []).some(node => {\n if (node.nodeType === Node.TEXT_NODE) {\n return Boolean(node.textContent?.trim());\n }\n return true;\n });\n }\n\n public valueChanged(): void {\n if (this.$fastController.isConnected) {\n this.syncInputState();\n queueMicrotask(() => this.syncTextareaHeight());\n }\n }\n\n public syncInputState(): void {\n this.hasInput = Boolean(this.value.trim());\n }\n\n public syncTextareaHeight(): void {\n const textarea = this.textareaEl;\n if (!textarea) {\n return;\n }\n\n const lineHeight = Number.parseFloat(getComputedStyle(textarea).lineHeight) || 20;\n const maxRows = Number.parseFloat(getComputedStyle(this).getPropertyValue(\"--_composer-max-rows\")) || 8;\n const maxHeight = lineHeight * maxRows;\n\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;\n textarea.style.overflowY = textarea.scrollHeight > maxHeight ? \"auto\" : \"hidden\";\n }\n}\n\nexport type VioletChatComposerStatus = \"ready\" | \"submitted\" | \"streaming\" | \"error\";\n\nattr(VioletChatComposer.prototype, \"status\");\nattr(VioletChatComposer.prototype, \"placeholder\");\nattr(VioletChatComposer.prototype, \"label\");\n// fromView: typed text must not be reflected back into the DOM `value` attribute.\nattr({ mode: \"fromView\" })(VioletChatComposer.prototype, \"value\");\nattr({ mode: \"boolean\" })(VioletChatComposer.prototype, \"disabled\");\n\nif (!customElements.get(\"violet-chat-composer\")) {\n await FASTElement.define(VioletChatComposer, {\n name: \"violet-chat-composer\",\n template,\n styles,\n shadowOptions: { delegatesFocus: true },\n });\n}\n"]}
|
|
@@ -5,8 +5,8 @@ const styles = css `
|
|
|
5
5
|
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
|
-
--_suggestion-font-size: var(--violet-suggestion-font-size, var(--_body-size
|
|
9
|
-
--_suggestion-line-height: var(--violet-suggestion-line-height, var(--_body-line
|
|
8
|
+
--_suggestion-font-size: var(--violet-suggestion-font-size, var(--_body-size));
|
|
9
|
+
--_suggestion-line-height: var(--violet-suggestion-line-height, var(--_body-line));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.root {
|
|
@@ -29,18 +29,18 @@ const styles = css `
|
|
|
29
29
|
min-block-size: var(--size-target-natural, 32px);
|
|
30
30
|
padding: 0 var(--_space-md);
|
|
31
31
|
border: var(--_card-border-width, 1px) solid var(--color-action-secondary-border, transparent);
|
|
32
|
-
border-radius: var(--_radius-round
|
|
32
|
+
border-radius: var(--_radius-round);
|
|
33
33
|
background: var(--color-action-secondary-background, var(--_surface-subtle));
|
|
34
34
|
font-size: var(--_suggestion-font-size);
|
|
35
35
|
line-height: var(--_suggestion-line-height);
|
|
36
|
-
color: var(--_text-primary
|
|
36
|
+
color: var(--_text-primary);
|
|
37
37
|
cursor: pointer;
|
|
38
38
|
transition: background 0.15s ease, border-color 0.15s ease;
|
|
39
39
|
white-space: nowrap;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
::slotted(*:hover) {
|
|
43
|
-
background: var(--_surface-hover
|
|
43
|
+
background: var(--_surface-hover);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
::slotted(*:focus-visible) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"violet-chat-suggestions.js","sourceRoot":"","sources":["../../src/conversation/violet-chat-suggestions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AAE5E,MAAM,MAAM,GAAG,GAAG,CAAA;MACZ,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC9B,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACzC,CAAC;YACD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE,CAAC;gBAClC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;YACxC,CAAC;QACL,CAAC;IACL,CAAC;IAEO,aAAa,CAAC,OAAoB,EAAE,SAAiB;QACzD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAkB,CAAC;QACzD,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAE3B,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC;QACpC,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACL,CAAC;CACJ;AAED,IAAI,CAAC,qBAAqB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AAErD,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAAC;IACjD,MAAM,WAAW,CAAC,MAAM,CAAC,qBAAqB,EAAE;QAC5C,IAAI,EAAE,yBAAyB;QAC/B,QAAQ;QACR,MAAM;KACT,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { FASTElement, attr, css, html } from \"@lushly-dev/fast-element\";\n\nimport { violetSurfaceTokenDefaults } from \"../theme/violet-token-defaults\";\n\nconst styles = css`\n ${violetSurfaceTokenDefaults}\n\n :host {\n display: block;\n --_suggestion-font-size: var(--violet-suggestion-font-size, var(--_body-size
|
|
1
|
+
{"version":3,"file":"violet-chat-suggestions.js","sourceRoot":"","sources":["../../src/conversation/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Content":["import { FASTElement, attr, css, html } from \"@lushly-dev/fast-element\";\n\nimport { violetSurfaceTokenDefaults } from \"../theme/violet-token-defaults\";\n\nconst styles = css`\n ${violetSurfaceTokenDefaults}\n\n :host {\n display: block;\n --_suggestion-font-size: var(--violet-suggestion-font-size, var(--_body-size));\n --_suggestion-line-height: var(--violet-suggestion-line-height, var(--_body-line));\n }\n\n .root {\n display: flex;\n flex-wrap: wrap;\n gap: var(--_space-sm);\n }\n\n :host([orientation=\"vertical\"]) .root {\n flex-direction: column;\n flex-wrap: nowrap;\n }\n\n /* Filled like a secondary button, and the same height; round, because it is a suggestion. */\n ::slotted(*) {\n all: unset;\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n min-block-size: var(--size-target-natural, 32px);\n padding: 0 var(--_space-md);\n border: var(--_card-border-width, 1px) solid var(--color-action-secondary-border, transparent);\n border-radius: var(--_radius-round);\n background: var(--color-action-secondary-background, var(--_surface-subtle));\n font-size: var(--_suggestion-font-size);\n line-height: var(--_suggestion-line-height);\n color: var(--_text-primary);\n cursor: pointer;\n transition: background 0.15s ease, border-color 0.15s ease;\n white-space: nowrap;\n }\n\n ::slotted(*:hover) {\n background: var(--_surface-hover);\n }\n\n ::slotted(*:focus-visible) {\n outline: none;\n box-shadow: 0 0 0 2px var(--_focus-ring);\n }\n\n @media (forced-colors: active) {\n ::slotted(*) {\n forced-color-adjust: none;\n border-color: ButtonText;\n background: Canvas;\n color: ButtonText;\n }\n\n ::slotted(*:hover) {\n background: Highlight;\n color: HighlightText;\n }\n }\n`;\n\nconst template = html<VioletChatSuggestions>`\n <div class=\"root\" part=\"root\" role=\"group\" aria-label=\"Suggested prompts\">\n <slot @slotchange=\"${x => x.ensureChipRoles()}\" @click=\"${(x, c) => x.handleClick(c.event)}\" @keydown=\"${(x, c) => x.handleKeydown(c.event as KeyboardEvent)}\"></slot>\n </div>\n`;\n\n/**\n * Violet chat suggestions.\n *\n * @summary Prompt starter chip row. Children are rendered as clickable\n * suggestion chips that fire a select event.\n * @slot - Suggestion chip elements (buttons or custom elements).\n * @csspart root - The chip container.\n * @fires select - When a suggestion is clicked. Detail: { text }.\n */\nexport class VioletChatSuggestions extends FASTElement {\n declare public orientation: string;\n\n public constructor() {\n super();\n this.orientation = \"horizontal\";\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n this.ensureChipRoles();\n }\n\n /** The direct child chip that contains the event target, if any. */\n private chipOf(target: EventTarget | null): HTMLElement | null {\n let node = target as Node | null;\n while (node && node.parentNode !== this) {\n node = node.parentNode;\n }\n return node instanceof HTMLElement ? node : null;\n }\n\n public handleClick(event: Event): void {\n const chip = this.chipOf(event.target);\n if (chip) {\n const text = chip.textContent?.trim() ?? \"\";\n if (text) {\n this.$emit(\"select\", { text });\n }\n }\n }\n\n public handleKeydown(event: KeyboardEvent): boolean {\n const target = (this.chipOf(event.target) ?? event.target) as HTMLElement;\n if (event.key === \"Enter\" || event.key === \" \") {\n if (this.chipOf(event.target)) {\n event.preventDefault();\n const text = target.textContent?.trim() ?? \"\";\n if (text) {\n this.$emit(\"select\", { text });\n }\n return false;\n }\n }\n\n // Arrow key navigation between chips\n if (event.key === \"ArrowRight\" || event.key === \"ArrowDown\") {\n event.preventDefault();\n this.focusNextChip(target, 1);\n return false;\n }\n if (event.key === \"ArrowLeft\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n this.focusNextChip(target, -1);\n return false;\n }\n\n // Unhandled keys (Tab, ...) keep their default action.\n return true;\n }\n\n public ensureChipRoles(): void {\n for (const child of Array.from(this.children)) {\n if (!child.getAttribute(\"role\")) {\n child.setAttribute(\"role\", \"button\");\n }\n if (!child.hasAttribute(\"tabindex\")) {\n child.setAttribute(\"tabindex\", \"0\");\n }\n }\n }\n\n private focusNextChip(current: HTMLElement, direction: number): void {\n const chips = Array.from(this.children) as HTMLElement[];\n const idx = chips.indexOf(current);\n if (idx === -1) { return; }\n\n const next = chips[idx + direction];\n if (next) {\n next.focus();\n }\n }\n}\n\nattr(VioletChatSuggestions.prototype, \"orientation\");\n\nif (!customElements.get(\"violet-chat-suggestions\")) {\n await FASTElement.define(VioletChatSuggestions, {\n name: \"violet-chat-suggestions\",\n template,\n styles,\n });\n}\n"]}
|