@ds-mo/ui 2.4.1 → 2.5.0
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/dist/.build-stamp +1 -1
- package/dist/components/ds-app-shell.js +1 -1
- package/dist/components/ds-app-shell.js.map +1 -1
- package/dist/components/ds-bar-nav.js +1 -1
- package/dist/components/ds-bar-nav.js.map +1 -1
- package/dist/components/ds-menu.js +1 -1
- package/dist/components/ds-select.js +1 -1
- package/dist/components/ds-select.js.map +1 -1
- package/dist/components/ds-shell-gradient-picker.d.ts +11 -0
- package/dist/components/ds-shell-gradient-picker.js +2 -0
- package/dist/components/ds-shell-gradient-picker.js.map +1 -0
- package/dist/components/ds-shell-gradient-swatch.d.ts +11 -0
- package/dist/components/ds-shell-gradient-swatch.js +2 -0
- package/dist/components/ds-shell-gradient-swatch.js.map +1 -0
- package/dist/components/ds-slider.js +1 -1
- package/dist/components/ds-toggle.js +1 -1
- package/dist/components/p-BU5fKLdO.js +2 -0
- package/dist/components/p-BU5fKLdO.js.map +1 -0
- package/dist/components/p-BgiK3sHs.js +2 -0
- package/dist/components/p-BgiK3sHs.js.map +1 -0
- package/dist/components/p-CLmK4lRE.js +2 -0
- package/dist/components/p-CLmK4lRE.js.map +1 -0
- package/dist/components/p-DKG6W4pb.js +2 -0
- package/dist/components/p-DKG6W4pb.js.map +1 -0
- package/dist/types/components/AppShell/AppShell.d.ts +6 -0
- package/dist/types/components/Menu/Menu.d.ts +4 -0
- package/dist/types/components/Menu/menu-types.d.ts +10 -1
- package/dist/types/components/ShellGradientPicker/ShellGradientPicker.d.ts +10 -0
- package/dist/types/components/ShellGradientSwatch/ShellGradientSwatch.d.ts +14 -0
- package/dist/types/components/ShellGradientSwatch/shell-gradient-swatch-types.d.ts +4 -0
- package/dist/types/components.d.ts +127 -0
- package/dist/types/nav/index.d.ts +2 -0
- package/dist/types/nav/shell-gradient-presets.d.ts +11 -0
- package/dist/types/nav/shell-gradient.d.ts +7 -4
- package/package.json +2 -2
- package/src/angular/index.ts +2 -0
- package/src/angular/proxies.ts +69 -3
- package/src/react/components.ts +2 -0
- package/src/react/ds-menu.ts +5 -3
- package/src/react/ds-shell-gradient-picker.ts +27 -0
- package/src/react/ds-shell-gradient-swatch.ts +27 -0
- package/src/wc/components/AppShell/AppShell.tsx +13 -1
- package/src/wc/components/BarNav/bar-nav-tabs-menu-utils.ts +2 -2
- package/src/wc/components/Menu/Menu.tsx +27 -4
- package/src/wc/components/Menu/menu-types.ts +19 -1
- package/src/wc/components/ShellGradientPicker/ShellGradientPicker.tsx +49 -0
- package/src/wc/components/ShellGradientSwatch/ShellGradientSwatch.tsx +53 -0
- package/src/wc/components/ShellGradientSwatch/shell-gradient-swatch-types.ts +16 -0
- package/src/wc/components.d.ts +127 -0
- package/src/wc/nav/index.ts +9 -0
- package/src/wc/nav/shell-gradient-presets.ts +35 -0
- package/src/wc/nav/shell-gradient.ts +26 -8
- package/dist/components/p-YzIqPOqL.js +0 -2
- package/dist/components/p-YzIqPOqL.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["computeMenuPosition","input","anchorRect","a","popupWidth","pw","popupHeight","ph","side","align","sideOffsetPx","alignOffsetPx","viewportPadPx","vpPad","viewportWidth","viewportHeight","x","y","top","left","right","width","bottom","height","Math","min","max","isMenuGradientPickerSection","section","variant","menuCss","POSITION_RETRY_BUDGET","Menu","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","open","items","sections","sideOffset","TOKEN_DEFAULTS","space050","alignOffset","initialFocusVisible","shouldRender","closing","pos","focusedIndex","positionReady","focusRingVisible","clickOutsideHandler","scrollResizeHandler","closeTimer","itemEls","positionRetryRaf","listenersReady","componentDidLoad","onOpenChange","disconnectedCallback","cancelPositionRetry","teardownListeners","isOpen","setupListeners","schedulePositionUpdate","focusInitialItem","setTimeout","closeAnimationMs","onAnchorChange","onPositionPropsChange","resolveCssLengthPx","popupFallbackWidthPx","menuWidthXs","popupFallbackHeightPx","menuFallbackHeight","resolveCssTimeMs","motionShort3","animationDurationShort3","resolvedAnchor","anchor","anchorId","document","getElementById","activeSections","length","flatItems","flatMap","cancelAnimationFrame","onReady","remaining","attempt","calculatePosition","requestAnimationFrame","anchorEl","popup","el","querySelector","getBoundingClientRect","offsetWidth","offsetHeight","window","innerWidth","innerHeight","flat","selectedIdx","findIndex","it","isSelected","isInactive","firstEnabledIdx","btns","querySelectorAll","focus","e","t","target","contains","close","addEventListener","removeEventListener","clearTimeout","dsClose","emit","handleKeyDown","enabled","map","i","filter","cur","indexOf","safe","key","preventDefault","stopPropagation","focusItem","idx","handleItemClick","item","dsSelect","handleGradientSelect","preset","dsGradientSelect","render","h","Host","style","display","flatIdx","popupStyle","position","transform","round","zIndex","visibility","menuWidth","minWidth","class","role","si","header","undefined","value","onDsChange","detail","isFocused","type","isDestructive","disabled","tabIndex","onMouseDown","onClick","onFocus","label","subtext","showToggle","toggleValue"],"sources":["src/wc/components/Menu/menu-position.ts","src/wc/components/Menu/menu-types.ts","src/wc/components/Menu/Menu.css?tag=ds-menu&encapsulation=scoped","src/wc/components/Menu/Menu.tsx"],"sourcesContent":["export type MenuSide = 'top' | 'right' | 'bottom' | 'left';\nexport type MenuAlign = 'start' | 'center' | 'end';\n\nexport interface MenuPositionInput {\n anchorRect: Pick<DOMRectReadOnly, 'top' | 'left' | 'right' | 'bottom' | 'width' | 'height'>;\n popupWidth: number;\n popupHeight: number;\n side: MenuSide;\n align: MenuAlign;\n sideOffsetPx: number;\n alignOffsetPx: number;\n viewportPadPx: number;\n viewportWidth: number;\n viewportHeight: number;\n}\n\n/** Pure layout math for ds-menu — anchor rect + placement props → viewport-fixed x/y. */\nexport function computeMenuPosition(input: MenuPositionInput): { x: number; y: number } {\n const {\n anchorRect: a,\n popupWidth: pw,\n popupHeight: ph,\n side,\n align,\n sideOffsetPx,\n alignOffsetPx,\n viewportPadPx: vpPad,\n viewportWidth,\n viewportHeight,\n } = input;\n\n let x = 0;\n let y = 0;\n\n switch (side) {\n case 'top':\n y = a.top - ph - sideOffsetPx;\n x =\n align === 'start'\n ? a.left + alignOffsetPx\n : align === 'end'\n ? a.right - pw + alignOffsetPx\n : a.left + a.width / 2 - pw / 2 + alignOffsetPx;\n break;\n case 'bottom':\n y = a.bottom + sideOffsetPx;\n x =\n align === 'start'\n ? a.left + alignOffsetPx\n : align === 'end'\n ? a.right - pw + alignOffsetPx\n : a.left + a.width / 2 - pw / 2 + alignOffsetPx;\n break;\n case 'left':\n x = a.left - pw - sideOffsetPx;\n y =\n align === 'start'\n ? a.top + alignOffsetPx\n : align === 'end'\n ? a.bottom - ph + alignOffsetPx\n : a.top + a.height / 2 - ph / 2 + alignOffsetPx;\n break;\n case 'right':\n x = a.right + sideOffsetPx;\n y =\n align === 'start'\n ? a.top + alignOffsetPx\n : align === 'end'\n ? a.bottom - ph + alignOffsetPx\n : a.top + a.height / 2 - ph / 2 + alignOffsetPx;\n break;\n }\n\n return {\n x: Math.min(Math.max(x, vpPad), viewportWidth - pw - vpPad),\n y: Math.min(Math.max(y, vpPad), viewportHeight - ph - vpPad),\n };\n}\n","import type { ShellGradientPreset } from '../../nav/shell-gradient-presets';\n\nexport type { MenuAlign, MenuSide } from './menu-position';\n\nexport interface MenuItemData {\n label: string;\n value?: string;\n subtext?: string;\n isSelected?: boolean;\n isInactive?: boolean;\n isDestructive?: boolean;\n showToggle?: boolean;\n toggleValue?: boolean;\n}\n\nexport interface MenuItemsSection {\n header?: string;\n items: MenuItemData[];\n}\n\nexport interface MenuGradientPickerSection {\n header?: string;\n variant: 'gradient-picker';\n value: ShellGradientPreset;\n}\n\nexport type MenuSection = MenuItemsSection | MenuGradientPickerSection;\n\nexport function isMenuGradientPickerSection(\n section: MenuSection,\n): section is MenuGradientPickerSection {\n return 'variant' in section && section.variant === 'gradient-picker';\n}\n\nexport type { ShellGradientPreset };\n","@import '../../utils/focus-ring.css';\n\n/* ── Popup shell ─────────────────────────────────────────────────────────── */\n\n.menu-popup {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n min-width: var(--dimension-menu-width-xs);\n max-width: var(--dimension-panel-width-lg);\n overflow: hidden;\n background-color: var(--color-background-primary);\n border-radius: var(--dimension-radius-075);\n /* Split elevation: shadow on shell, inset highlight on ::after (combined token clips with overflow:hidden). */\n box-shadow: var(--effect-shadow-elevated-floating);\n animation: menuFadeIn var(--effect-motion-short-2) forwards;\n backface-visibility: hidden;\n will-change: transform;\n}\n\n.menu-popup::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n pointer-events: none;\n box-shadow: var(--effect-highlight-elevated-floating);\n}\n\n.menu-popup--closing {\n animation: menuFadeOut var(--effect-motion-short-3) forwards;\n}\n\n@keyframes menuFadeIn {\n from { opacity: 0; transform: inherit scale(0.97); }\n to { opacity: 1; }\n}\n\n@keyframes menuFadeOut {\n from { opacity: 1; }\n to { opacity: 0; }\n}\n\n/* ── Sections ────────────────────────────────────────────────────────────── */\n\n.menu-section {\n display: flex;\n flex-direction: column;\n gap: var(--dimension-space-050);\n padding: var(--dimension-space-050);\n}\n\n.menu-section--divided {\n border-bottom: var(--dimension-stroke-width-015) solid var(--color-border-tertiary);\n}\n\n.section-header {\n display: flex;\n align-items: center;\n height: var(--dimension-size-400);\n padding: var(--dimension-space-050) var(--dimension-space-075);\n -webkit-user-select: none;\n user-select: none;\n}\n\n.section-label {\n color: var(--color-foreground-secondary);\n}\n\n.menu-section--gradient-picker {\n padding-bottom: var(--dimension-space-050);\n}\n\n/* ── Items ───────────────────────────────────────────────────────────────── */\n\n.menu-item {\n display: flex;\n align-items: center;\n gap: var(--dimension-space-050);\n position: relative;\n width: 100%;\n min-height: var(--dimension-size-400);\n padding: var(--dimension-space-075);\n box-sizing: border-box;\n border: none;\n border-radius: var(--dimension-radius-025);\n background: transparent;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n text-align: left;\n color: inherit;\n --_hover-bg: var(--color-interaction-hover);\n --_pressed-bg: var(--color-interaction-pressed);\n --_selected-bg: var(--color-interaction-active);\n}\n\n.menu-item:has(.menu-item__subtext) {\n align-items: flex-start;\n}\n\n/* Interaction layer — same ::after pattern as tabs / BarNav trigger */\n.menu-item::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n background: transparent;\n pointer-events: none;\n transition: none;\n}\n\n.menu-item--selected::after {\n background: var(--_selected-bg);\n transition: none;\n}\n\n.menu-item:hover:not(:disabled):not(.menu-item--selected)::after {\n background: var(--_hover-bg);\n transition: none;\n}\n\n.menu-item:active:not(:disabled)::after {\n background: var(--_pressed-bg);\n transition: none;\n}\n\n.menu-item--inactive {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.menu-item--destructive .menu-item__label {\n color: var(--color-foreground-bold-negative) !important;\n}\n\n.menu-item__content {\n position: relative;\n z-index: 1;\n display: flex;\n flex: 1;\n flex-direction: column;\n gap: var(--dimension-space-025);\n min-width: 0;\n}\n\n.menu-item__label {\n color: var(--color-foreground-secondary);\n}\n\n.menu-item:has(.menu-item__subtext) .menu-item__label,\n.menu-item--selected .menu-item__label {\n color: var(--color-foreground-primary);\n}\n\n.menu-item__subtext {\n color: var(--color-foreground-secondary);\n line-height: 1.4;\n}\n\n/* ── Toggle suffix ───────────────────────────────────────────────────────── */\n\n.menu-item__toggle {\n position: relative;\n z-index: 1;\n flex-shrink: 0;\n width: calc(var(--dimension-size-400) + var(--dimension-size-050));\n height: var(--dimension-size-250);\n border-radius: var(--dimension-radius-125);\n background-color: var(--color-background-translucent);\n transition: background-color var(--effect-motion-short-2);\n}\n\n.menu-item__toggle--on {\n background-color: var(--color-background-medium-brand);\n}\n\n.menu-item__toggle-thumb {\n position: absolute;\n top: var(--dimension-space-025);\n left: var(--dimension-space-025);\n width: var(--dimension-size-200);\n height: var(--dimension-size-200);\n border-radius: 50%;\n background-color: var(--color-foreground-on-bold-background-primary);\n transition: transform var(--effect-motion-short-2);\n}\n\n.menu-item__toggle--on .menu-item__toggle-thumb {\n transform: translateX(var(--dimension-offset-200, 16px));\n}\n","import { Component, Prop, State, Event, EventEmitter, Element, Watch, Listen, h, Host } from '@stencil/core';\nimport { resolveCssLengthPx, resolveCssTimeMs, TOKEN_DEFAULTS } from '../../utils';\nimport { computeMenuPosition, type MenuAlign, type MenuSide } from './menu-position';\nimport type { MenuItemData, MenuSection } from './menu-types';\nimport { isMenuGradientPickerSection } from './menu-types';\nimport type { ShellGradientPreset } from '../../nav/shell-gradient-presets';\n\n/** rAF retries while the popup mounts or the anchor resolves. */\nconst POSITION_RETRY_BUDGET = 8;\n\n@Component({\n tag: 'ds-menu',\n styleUrl: 'Menu.css',\n scoped: true,\n})\nexport class Menu {\n @Element() el!: HTMLElement;\n\n @Prop({ mutable: true }) open: boolean = false;\n @Prop() items: MenuItemData[] = [];\n @Prop() sections: MenuSection[] = [];\n @Prop() side: MenuSide = 'bottom';\n @Prop() align: MenuAlign = 'start';\n /** Gap between anchor and menu — number (px) or TokoMo length (`var(--dimension-space-050)`, etc.). */\n @Prop() sideOffset: number | string = TOKEN_DEFAULTS.space050;\n /** Cross-axis offset — number (px) or TokoMo length. */\n @Prop() alignOffset: number | string = 0;\n @Prop() menuWidth: string | undefined;\n @Prop() minWidth: string | undefined;\n /** External trigger element to position against. Set via JS: menuEl.anchor = buttonEl */\n @Prop() anchor: HTMLElement | undefined;\n /** ID of the external trigger element for positioning */\n @Prop() anchorId: string | undefined;\n /** Show a visible ring on the initially focused menu item. Use only when the opener was keyboard-driven. */\n @Prop() initialFocusVisible: boolean = false;\n\n @State() private shouldRender: boolean = false;\n @State() private closing: boolean = false;\n @State() private pos: { x: number; y: number } = { x: 0, y: 0 };\n @State() private focusedIndex: number = 0;\n @State() private positionReady: boolean = false;\n @State() private focusRingVisible: boolean = false;\n\n @Event() dsClose!: EventEmitter<void>;\n @Event() dsSelect!: EventEmitter<MenuItemData>;\n /** Emitted when a `gradient-picker` section swatch is chosen. */\n @Event() dsGradientSelect!: EventEmitter<ShellGradientPreset>;\n\n private clickOutsideHandler: ((e: MouseEvent) => void) | null = null;\n private scrollResizeHandler: (() => void) | null = null;\n private closeTimer: ReturnType<typeof setTimeout> | null = null;\n private itemEls: HTMLElement[] = [];\n private positionRetryRaf: number | null = null;\n private listenersReady = false;\n\n componentDidLoad() {\n if (this.open) this.onOpenChange(true);\n }\n\n disconnectedCallback() {\n this.cancelPositionRetry();\n this.teardownListeners();\n }\n\n @Watch('open')\n onOpenChange(isOpen: boolean) {\n if (isOpen) {\n this.teardownListeners();\n this.shouldRender = true;\n this.closing = false;\n this.positionReady = false;\n this.listenersReady = false;\n this.focusRingVisible = this.initialFocusVisible;\n this.listenersReady = true;\n this.setupListeners();\n this.schedulePositionUpdate(() => {\n this.focusInitialItem();\n });\n } else if (this.shouldRender) {\n this.cancelPositionRetry();\n this.closing = true;\n this.teardownListeners();\n this.listenersReady = false;\n this.closeTimer = setTimeout(() => {\n this.shouldRender = false;\n this.closing = false;\n this.closeTimer = null;\n }, this.closeAnimationMs);\n }\n }\n\n @Watch('anchor')\n @Watch('anchorId')\n onAnchorChange() {\n if (this.open) this.schedulePositionUpdate();\n }\n\n @Watch('side')\n @Watch('align')\n @Watch('sideOffset')\n @Watch('alignOffset')\n onPositionPropsChange() {\n if (this.open) this.schedulePositionUpdate();\n }\n\n private get viewportPadPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.space050, TOKEN_DEFAULTS.space050);\n }\n\n private get sideOffsetPx(): number {\n return resolveCssLengthPx(this.sideOffset, TOKEN_DEFAULTS.space050);\n }\n\n private get alignOffsetPx(): number {\n return resolveCssLengthPx(this.alignOffset, 0);\n }\n\n private get popupFallbackWidthPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuWidthXs, TOKEN_DEFAULTS.menuWidthXs);\n }\n\n private get popupFallbackHeightPx(): number {\n return resolveCssLengthPx(TOKEN_DEFAULTS.menuFallbackHeight, TOKEN_DEFAULTS.menuFallbackHeight);\n }\n\n private get closeAnimationMs(): number {\n return resolveCssTimeMs(TOKEN_DEFAULTS.motionShort3, TOKEN_DEFAULTS.animationDurationShort3);\n }\n\n private get resolvedAnchor(): HTMLElement | null {\n if (this.anchor) return this.anchor;\n if (this.anchorId) return document.getElementById(this.anchorId);\n return null;\n }\n\n private get activeSections(): MenuSection[] {\n if (this.sections.length > 0) return this.sections;\n if (this.items.length > 0) return [{ items: this.items }];\n return [];\n }\n\n private get flatItems(): MenuItemData[] {\n return this.activeSections.flatMap(section =>\n isMenuGradientPickerSection(section) ? [] : section.items,\n );\n }\n\n private cancelPositionRetry() {\n if (this.positionRetryRaf !== null) {\n cancelAnimationFrame(this.positionRetryRaf);\n this.positionRetryRaf = null;\n }\n }\n\n /** Retry until anchor + popup exist — do not reveal at 0,0 on a failed first pass. */\n private schedulePositionUpdate(onReady?: () => void) {\n if (!this.open) return;\n\n this.cancelPositionRetry();\n this.positionReady = false;\n\n let remaining = POSITION_RETRY_BUDGET;\n\n const attempt = () => {\n this.positionRetryRaf = null;\n if (!this.open) return;\n\n if (this.calculatePosition()) {\n this.positionReady = true;\n onReady?.();\n return;\n }\n\n if (remaining > 0) {\n remaining -= 1;\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n };\n\n this.positionRetryRaf = requestAnimationFrame(attempt);\n }\n\n /** @returns `true` when anchor and popup were found and `pos` was updated. */\n private calculatePosition(): boolean {\n const anchorEl = this.resolvedAnchor;\n if (!anchorEl) return false;\n const popup = this.el.querySelector('.menu-popup') as HTMLElement | null;\n if (!popup) return false;\n\n this.pos = computeMenuPosition({\n anchorRect: anchorEl.getBoundingClientRect(),\n popupWidth: popup.offsetWidth || this.popupFallbackWidthPx,\n popupHeight: popup.offsetHeight || this.popupFallbackHeightPx,\n side: this.side,\n align: this.align,\n sideOffsetPx: this.sideOffsetPx,\n alignOffsetPx: this.alignOffsetPx,\n viewportPadPx: this.viewportPadPx,\n viewportWidth: window.innerWidth,\n viewportHeight: window.innerHeight,\n });\n return true;\n }\n\n /** Focus the selected item when present, otherwise the first enabled item. */\n private focusInitialItem() {\n const flat = this.flatItems;\n const selectedIdx = flat.findIndex(it => it.isSelected && !it.isInactive);\n const firstEnabledIdx = flat.findIndex(it => !it.isInactive);\n this.focusedIndex = selectedIdx >= 0\n ? selectedIdx\n : (firstEnabledIdx >= 0 ? firstEnabledIdx : 0);\n\n requestAnimationFrame(() => {\n const btns = this.el.querySelectorAll<HTMLElement>('.menu-item');\n btns[this.focusedIndex]?.focus();\n });\n }\n\n private setupListeners() {\n this.clickOutsideHandler = (e: MouseEvent) => {\n const t = e.target as Node;\n const popup = this.el.querySelector('.menu-popup');\n const anchorEl = this.resolvedAnchor;\n if (popup?.contains(t) || anchorEl?.contains(t)) return;\n this.close();\n };\n\n this.scrollResizeHandler = () => {\n if (this.shouldRender && !this.closing) this.calculatePosition();\n };\n\n document.addEventListener('mousedown', this.clickOutsideHandler, true);\n window.addEventListener('scroll', this.scrollResizeHandler, true);\n window.addEventListener('resize', this.scrollResizeHandler);\n }\n\n private teardownListeners() {\n if (this.clickOutsideHandler) {\n document.removeEventListener('mousedown', this.clickOutsideHandler, true);\n this.clickOutsideHandler = null;\n }\n if (this.scrollResizeHandler) {\n window.removeEventListener('scroll', this.scrollResizeHandler, true);\n window.removeEventListener('resize', this.scrollResizeHandler);\n this.scrollResizeHandler = null;\n }\n if (this.closeTimer) {\n clearTimeout(this.closeTimer);\n this.closeTimer = null;\n }\n }\n\n private close() {\n this.resolvedAnchor?.focus();\n this.dsClose.emit();\n this.open = false;\n this.onOpenChange(false);\n }\n\n @Listen('keydown')\n handleKeyDown(e: KeyboardEvent) {\n if (!this.shouldRender || this.closing) return;\n const flat = this.flatItems;\n const enabled = flat.map((it, i) => ({ it, i })).filter(({ it }) => !it.isInactive).map(({ i }) => i);\n if (!enabled.length) return;\n\n const cur = enabled.indexOf(this.focusedIndex);\n const safe = cur < 0 ? 0 : cur;\n\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault(); e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[(safe + 1) % enabled.length];\n this.focusItem(this.focusedIndex);\n break;\n case 'ArrowUp':\n e.preventDefault(); e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[(safe - 1 + enabled.length) % enabled.length];\n this.focusItem(this.focusedIndex);\n break;\n case 'Home':\n e.preventDefault(); e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[0];\n this.focusItem(this.focusedIndex);\n break;\n case 'End':\n e.preventDefault(); e.stopPropagation();\n this.focusRingVisible = true;\n this.focusedIndex = enabled[enabled.length - 1];\n this.focusItem(this.focusedIndex);\n break;\n case 'Escape':\n e.preventDefault();\n this.close();\n break;\n case 'Tab':\n e.preventDefault();\n this.close();\n break;\n }\n }\n\n private focusItem(idx: number) {\n const btns = this.el.querySelectorAll<HTMLElement>('.menu-item');\n btns[idx]?.focus();\n }\n\n private handleItemClick(item: MenuItemData) {\n if (item.isInactive) return;\n this.dsSelect.emit(item);\n this.close();\n }\n\n private handleGradientSelect(preset: ShellGradientPreset) {\n this.dsGradientSelect.emit(preset);\n }\n\n render() {\n if (!this.shouldRender) return <Host style={{ display: 'contents' }} />;\n\n const sections = this.activeSections;\n let flatIdx = 0;\n\n const popupStyle: Record<string, string> = {\n position: 'fixed',\n left: '0',\n top: '0',\n transform: `translate(${Math.round(this.pos.x)}px, ${Math.round(this.pos.y)}px)`,\n zIndex: '9998',\n visibility: this.positionReady ? 'visible' : 'hidden',\n };\n\n if (this.menuWidth) popupStyle['width'] = this.menuWidth;\n if (this.minWidth) popupStyle['min-width'] = this.minWidth;\n\n return (\n <Host style={{ display: 'contents' }}>\n <div\n class={{ 'menu-popup': true, 'menu-popup--closing': this.closing }}\n style={popupStyle}\n role=\"menu\"\n aria-label=\"Menu\"\n aria-orientation=\"vertical\"\n >\n {sections.map((section, si) => (\n <div\n key={si}\n class={{\n 'menu-section': true,\n 'menu-section--divided': si < sections.length - 1,\n 'menu-section--gradient-picker': isMenuGradientPickerSection(section),\n }}\n role={section.header ? 'group' : undefined}\n aria-label={section.header}\n >\n {section.header && (\n <div class=\"section-header\" aria-hidden=\"true\">\n <span class=\"text-body-small-emphasis section-label\">{section.header}</span>\n </div>\n )}\n {isMenuGradientPickerSection(section) ? (\n <ds-shell-gradient-picker\n value={section.value}\n onDsChange={(e: CustomEvent<ShellGradientPreset>) => {\n e.stopPropagation();\n this.handleGradientSelect(e.detail);\n }}\n />\n ) : (\n section.items.map(item => {\n const idx = flatIdx++;\n const isFocused = this.focusedIndex === idx;\n return (\n <button\n key={idx}\n type=\"button\"\n class={{\n 'menu-item': true,\n 'ds-focus-ring-inset': true,\n 'ds-focus-ring--visible': isFocused && this.focusRingVisible,\n 'menu-item--selected': !!item.isSelected,\n 'menu-item--inactive': !!item.isInactive,\n 'menu-item--destructive': !!item.isDestructive,\n 'menu-item--focused': isFocused,\n }}\n role=\"menuitem\"\n aria-current={item.isSelected ? 'true' : undefined}\n disabled={item.isInactive}\n tabIndex={isFocused ? 0 : -1}\n onMouseDown={() => { this.focusRingVisible = false; }}\n onClick={() => this.handleItemClick(item)}\n onFocus={() => { this.focusedIndex = idx; }}\n >\n <div class=\"menu-item__content\">\n <span class={item.isSelected ? 'text-body-medium-emphasis menu-item__label' : 'text-body-medium menu-item__label'}>\n {item.label}\n </span>\n {item.subtext && (\n <span class=\"text-body-small menu-item__subtext\">{item.subtext}</span>\n )}\n </div>\n {item.showToggle && (\n <div class={{ 'menu-item__toggle': true, 'menu-item__toggle--on': !!item.toggleValue }} aria-hidden=\"true\">\n <div class=\"menu-item__toggle-thumb\" />\n </div>\n )}\n </button>\n );\n }))}\n </div>\n ))}\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"sPAiBM,SAAUA,EAAoBC,GAClC,MACEC,WAAYC,EACZC,WAAYC,EACZC,YAAaC,EAAEC,KACfA,EAAIC,MACJA,EAAKC,aACLA,EAAYC,cACZA,EACAC,cAAeC,EAAKC,cACpBA,EAAaC,eACbA,GACEd,EAEJ,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1,2 @@
|
|
|
1
|
+
import{p as s,H as e,c as i,h as t,a as r,t as o}from"./index.js";import{D as n,a,b as d}from"./p-BU5fKLdO.js";const c=()=>`.sc-ds-shell-gradient-swatch-h{--ds-focus-ring-width:var(--dimension-stroke-width-025, 2px);--ds-focus-ring-offset:var(--dimension-space-025, 2px);--ds-focus-ring-color:var(--color-interaction-focus)}.ds-focus-ring.sc-ds-shell-gradient-swatch:focus-visible{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}.ds-focus-ring.ds-focus-ring--visible.sc-ds-shell-gradient-swatch{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:var(--ds-focus-ring-offset)}.ds-focus-ring-inset.sc-ds-shell-gradient-swatch:focus-visible{outline:none}.ds-focus-ring-inset.sc-ds-shell-gradient-swatch:focus-visible::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-shell-gradient-swatch{outline:none}.ds-focus-ring-inset.ds-focus-ring--visible.sc-ds-shell-gradient-swatch::after{outline:var(--ds-focus-ring-width) solid var(--ds-focus-ring-color);outline-offset:calc(-1 * var(--ds-focus-ring-width))}.sc-ds-shell-gradient-swatch-h{display:inline-flex}.shell-gradient-swatch.sc-ds-shell-gradient-swatch{position:relative;box-sizing:border-box;width:var(--dimension-size-400);height:var(--dimension-size-400);padding:0;border:none;border-radius:var(--dimension-radius-half);background-color:var(--color-background-secondary);background-repeat:no-repeat;background-size:cover;background-position:0 0;cursor:pointer;flex-shrink:0}.shell-gradient-swatch.sc-ds-shell-gradient-swatch:disabled{opacity:0.5;cursor:not-allowed}.shell-gradient-swatch--selected.sc-ds-shell-gradient-swatch::after{content:'';position:absolute;inset:0;border-radius:inherit;box-shadow:inset 0 0 0 var(--dimension-stroke-width-025) var(--color-border-bold-brand);pointer-events:none}.shell-gradient-swatch.sc-ds-shell-gradient-swatch:not(.shell-gradient-swatch--selected):hover:not(:disabled)::after{content:'';position:absolute;inset:0;border-radius:inherit;background:var(--color-interaction-hover);pointer-events:none}`;const l=s(class s extends e{constructor(s){super();if(s!==false){this.__registerHost()}this.dsSelect=i(this,"dsSelect");this.preset=n;this.selected=false;this.inactive=false;this.handleClick=()=>{if(this.inactive)return;this.dsSelect.emit(this.preset)}}render(){const s=this.ariaLabel??a[this.preset];return t(r,{key:"6486c517e186071b6f756f3561e073367107274b"},t("button",{key:"8eb09042ad6d120c8717a206fa8dc8aaf289360f",type:"button",class:{"shell-gradient-swatch":true,"ds-focus-ring-inset":true,"shell-gradient-swatch--selected":this.selected},style:{backgroundImage:d(this.preset)},"aria-label":s,"aria-pressed":this.selected?"true":"false",disabled:this.inactive,onClick:this.handleClick}))}static get style(){return c()}},[2,"ds-shell-gradient-swatch",{preset:[513],selected:[516],inactive:[4],ariaLabel:[1,"aria-label"]}]);function h(){if(typeof customElements==="undefined"){return}const s=["ds-shell-gradient-swatch"];s.forEach((s=>{switch(s){case"ds-shell-gradient-swatch":if(!customElements.get(o(s))){customElements.define(o(s),l)}break}}))}h();export{l as S,h as d};
|
|
2
|
+
//# sourceMappingURL=p-DKG6W4pb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["shellGradientSwatchCss","ShellGradientSwatch","__stencil_proxyCustomElement","HTMLElement","constructor","registerHost","this","preset","DEFAULT_SHELL_GRADIENT_PRESET","selected","inactive","handleClick","dsSelect","emit","render","label","ariaLabel","SHELL_GRADIENT_PRESET_LABELS","h","Host","key","type","class","style","backgroundImage","buildShellRadialGradientForPreset","disabled","onClick"],"sources":["src/wc/components/ShellGradientSwatch/ShellGradientSwatch.css?tag=ds-shell-gradient-swatch&encapsulation=scoped","src/wc/components/ShellGradientSwatch/ShellGradientSwatch.tsx"],"sourcesContent":["@import '../../utils/focus-ring.css';\n\n:host {\n display: inline-flex;\n}\n\n.shell-gradient-swatch {\n position: relative;\n box-sizing: border-box;\n width: var(--dimension-size-400);\n height: var(--dimension-size-400);\n padding: 0;\n border: none;\n border-radius: var(--dimension-radius-half);\n background-color: var(--color-background-secondary);\n background-repeat: no-repeat;\n background-size: cover;\n background-position: 0 0;\n cursor: pointer;\n flex-shrink: 0;\n}\n\n.shell-gradient-swatch:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n\n.shell-gradient-swatch--selected::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n box-shadow: inset 0 0 0 var(--dimension-stroke-width-025) var(--color-border-bold-brand);\n pointer-events: none;\n}\n\n.shell-gradient-swatch:not(.shell-gradient-swatch--selected):hover:not(:disabled)::after {\n content: '';\n position: absolute;\n inset: 0;\n border-radius: inherit;\n background: var(--color-interaction-hover);\n pointer-events: none;\n}\n","import { Component, Prop, Event, EventEmitter, h, Host } from '@stencil/core';\nimport {\n SHELL_GRADIENT_PRESET_LABELS,\n buildShellRadialGradientForPreset,\n DEFAULT_SHELL_GRADIENT_PRESET,\n type ShellGradientPreset,\n} from './shell-gradient-swatch-types';\n\n@Component({\n tag: 'ds-shell-gradient-swatch',\n styleUrl: 'ShellGradientSwatch.css',\n scoped: true,\n})\nexport class ShellGradientSwatch {\n /** Wash preset this orb previews. */\n @Prop({ reflect: true }) preset: ShellGradientPreset = DEFAULT_SHELL_GRADIENT_PRESET;\n\n /** Selected state — shows an inset brand ring. */\n @Prop({ reflect: true }) selected = false;\n\n @Prop() inactive = false;\n\n @Prop({ attribute: 'aria-label' }) ariaLabel: string | undefined;\n\n @Event() dsSelect!: EventEmitter<ShellGradientPreset>;\n\n private handleClick = () => {\n if (this.inactive) return;\n this.dsSelect.emit(this.preset);\n };\n\n render() {\n const label = this.ariaLabel ?? SHELL_GRADIENT_PRESET_LABELS[this.preset];\n\n return (\n <Host>\n <button\n type=\"button\"\n class={{\n 'shell-gradient-swatch': true,\n 'ds-focus-ring-inset': true,\n 'shell-gradient-swatch--selected': this.selected,\n }}\n style={{ backgroundImage: buildShellRadialGradientForPreset(this.preset) }}\n aria-label={label}\n aria-pressed={this.selected ? 'true' : 'false'}\n disabled={this.inactive}\n onClick={this.handleClick}\n />\n </Host>\n );\n }\n}\n"],"mappings":"+GAAA,MAAMA,EAAyB,IAAM,0iE,MCaxBC,EAAmBC,EAAA,MAAAD,UAAAE,EALhC,WAAAC,CAAAC,G,6EAO2BC,KAAAC,OAA8BC,EAG9BF,KAAAG,SAAW,MAE5BH,KAAAI,SAAW,MAMXJ,KAAAK,YAAc,KACpB,GAAIL,KAAKI,SAAU,OACnBJ,KAAKM,SAASC,KAAKP,KAAKC,OAAO,CAwBlC,CArBC,MAAAO,GACE,MAAMC,EAAQT,KAAKU,WAAaC,EAA6BX,KAAKC,QAElE,OACEW,EAACC,EAAI,CAAAC,IAAA,4CACHF,EAAA,UAAAE,IAAA,2CACEC,KAAK,SACLC,MAAO,CACL,wBAAyB,KACzB,sBAAuB,KACvB,kCAAmChB,KAAKG,UAE1Cc,MAAO,CAAEC,gBAAiBC,EAAkCnB,KAAKC,SAAS,aAC9DQ,EAAK,eACHT,KAAKG,SAAW,OAAS,QACvCiB,SAAUpB,KAAKI,SACfiB,QAASrB,KAAKK,c","ignoreList":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NavChromeStyle } from '../../nav/nav-chrome';
|
|
2
|
+
import { type ShellGradientPreset } from '../../nav/shell-gradient-presets';
|
|
2
3
|
export declare class AppShell {
|
|
3
4
|
/** Chrome style propagated to slotted `ds-panel-nav` and `ds-bar-nav`. */
|
|
4
5
|
navStyle: NavChromeStyle;
|
|
@@ -11,6 +12,11 @@ export declare class AppShell {
|
|
|
11
12
|
* When set, overrides the built-in radial wash.
|
|
12
13
|
*/
|
|
13
14
|
gradientSrc: string;
|
|
15
|
+
/**
|
|
16
|
+
* Built-in shell wash preset when `gradient` is true.
|
|
17
|
+
* `cool` (blue), `neutral` (grey), `warm` (yellow). `gradientSrc` overrides when set.
|
|
18
|
+
*/
|
|
19
|
+
gradientPreset: ShellGradientPreset;
|
|
14
20
|
/** When `true` (default), registers global shell keyboard shortcuts. `[` toggles panel nav; `]` closes tools; K/A/S/M/N toggle tool drawers. Modifiers are ignored so browser chords like ⌘N stay native. */
|
|
15
21
|
shortcutsEnabled: boolean;
|
|
16
22
|
el: HTMLElement;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
2
|
import { type MenuAlign, type MenuSide } from './menu-position';
|
|
3
3
|
import type { MenuItemData, MenuSection } from './menu-types';
|
|
4
|
+
import type { ShellGradientPreset } from '../../nav/shell-gradient-presets';
|
|
4
5
|
export declare class Menu {
|
|
5
6
|
el: HTMLElement;
|
|
6
7
|
open: boolean;
|
|
@@ -28,6 +29,8 @@ export declare class Menu {
|
|
|
28
29
|
private focusRingVisible;
|
|
29
30
|
dsClose: EventEmitter<void>;
|
|
30
31
|
dsSelect: EventEmitter<MenuItemData>;
|
|
32
|
+
/** Emitted when a `gradient-picker` section swatch is chosen. */
|
|
33
|
+
dsGradientSelect: EventEmitter<ShellGradientPreset>;
|
|
31
34
|
private clickOutsideHandler;
|
|
32
35
|
private scrollResizeHandler;
|
|
33
36
|
private closeTimer;
|
|
@@ -61,6 +64,7 @@ export declare class Menu {
|
|
|
61
64
|
handleKeyDown(e: KeyboardEvent): void;
|
|
62
65
|
private focusItem;
|
|
63
66
|
private handleItemClick;
|
|
67
|
+
private handleGradientSelect;
|
|
64
68
|
render(): any;
|
|
65
69
|
}
|
|
66
70
|
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ShellGradientPreset } from '../../nav/shell-gradient-presets';
|
|
1
2
|
export type { MenuAlign, MenuSide } from './menu-position';
|
|
2
3
|
export interface MenuItemData {
|
|
3
4
|
label: string;
|
|
@@ -9,8 +10,16 @@ export interface MenuItemData {
|
|
|
9
10
|
showToggle?: boolean;
|
|
10
11
|
toggleValue?: boolean;
|
|
11
12
|
}
|
|
12
|
-
export interface
|
|
13
|
+
export interface MenuItemsSection {
|
|
13
14
|
header?: string;
|
|
14
15
|
items: MenuItemData[];
|
|
15
16
|
}
|
|
17
|
+
export interface MenuGradientPickerSection {
|
|
18
|
+
header?: string;
|
|
19
|
+
variant: 'gradient-picker';
|
|
20
|
+
value: ShellGradientPreset;
|
|
21
|
+
}
|
|
22
|
+
export type MenuSection = MenuItemsSection | MenuGradientPickerSection;
|
|
23
|
+
export declare function isMenuGradientPickerSection(section: MenuSection): section is MenuGradientPickerSection;
|
|
24
|
+
export type { ShellGradientPreset };
|
|
16
25
|
//# sourceMappingURL=menu-types.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { type ShellGradientPreset } from '../ShellGradientSwatch/shell-gradient-swatch-types';
|
|
3
|
+
export declare class ShellGradientPicker {
|
|
4
|
+
/** Active shell wash preset. */
|
|
5
|
+
value: ShellGradientPreset;
|
|
6
|
+
dsChange: EventEmitter<ShellGradientPreset>;
|
|
7
|
+
private handleSwatchSelect;
|
|
8
|
+
render(): any;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ShellGradientPicker.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EventEmitter } from '../../stencil-public-runtime';
|
|
2
|
+
import { type ShellGradientPreset } from './shell-gradient-swatch-types';
|
|
3
|
+
export declare class ShellGradientSwatch {
|
|
4
|
+
/** Wash preset this orb previews. */
|
|
5
|
+
preset: ShellGradientPreset;
|
|
6
|
+
/** Selected state — shows an inset brand ring. */
|
|
7
|
+
selected: boolean;
|
|
8
|
+
inactive: boolean;
|
|
9
|
+
ariaLabel: string | undefined;
|
|
10
|
+
dsSelect: EventEmitter<ShellGradientPreset>;
|
|
11
|
+
private handleClick;
|
|
12
|
+
render(): any;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ShellGradientSwatch.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ShellGradientPreset } from '../../nav/shell-gradient-presets';
|
|
2
|
+
export type { ShellGradientPreset };
|
|
3
|
+
export { DEFAULT_SHELL_GRADIENT_PRESET, SHELL_GRADIENT_PRESETS, SHELL_GRADIENT_PRESET_LABELS, buildShellRadialGradientForPreset, isShellGradientPreset, shellGradientPresetStopToken, } from '../../nav/shell-gradient-presets';
|
|
4
|
+
//# sourceMappingURL=shell-gradient-swatch-types.d.ts.map
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
import { AccordionItemData } from "./components/Accordion/Accordion";
|
|
9
9
|
import { NavChromeStyle } from "./nav/nav-chrome";
|
|
10
|
+
import { ShellGradientPreset } from "./nav/shell-gradient-presets";
|
|
10
11
|
import { BadgeSurface, BadgeVariant } from "./components/Badge/Badge";
|
|
11
12
|
import { BannerContrast, BannerIntent } from "./components/Banner/Banner";
|
|
12
13
|
import { BarNavTab } from "./components/BarNav/bar-nav-types";
|
|
@@ -31,6 +32,7 @@ import { PanelToolsItem, PanelToolsToolId } from "./components/PanelTools/panel-
|
|
|
31
32
|
import { RadioOption } from "./components/RadioGroup/RadioGroup";
|
|
32
33
|
import { ScrollbarVariant } from "./components/Scrollbar/Scrollbar";
|
|
33
34
|
import { SelectOption } from "./components/Select/Select";
|
|
35
|
+
import { ShellGradientPreset as ShellGradientPreset1 } from "./components/ShellGradientSwatch/shell-gradient-swatch-types";
|
|
34
36
|
import { SkeletonVariant } from "./components/Skeleton/Skeleton";
|
|
35
37
|
import { SurfaceBackground, SurfaceContrast, SurfaceElement, SurfaceElevation, SurfaceIntent, SurfaceRadius } from "./components/Surface/Surface";
|
|
36
38
|
import { TabItem } from "./components/TabGroup/tab-item-utils";
|
|
@@ -45,6 +47,7 @@ import { ToggleGroupBackground, ToggleGroupElevation, ToggleGroupItem, ToggleGro
|
|
|
45
47
|
import { TooltipAlign, TooltipSide } from "./components/Tooltip/Tooltip";
|
|
46
48
|
export { AccordionItemData } from "./components/Accordion/Accordion";
|
|
47
49
|
export { NavChromeStyle } from "./nav/nav-chrome";
|
|
50
|
+
export { ShellGradientPreset } from "./nav/shell-gradient-presets";
|
|
48
51
|
export { BadgeSurface, BadgeVariant } from "./components/Badge/Badge";
|
|
49
52
|
export { BannerContrast, BannerIntent } from "./components/Banner/Banner";
|
|
50
53
|
export { BarNavTab } from "./components/BarNav/bar-nav-types";
|
|
@@ -69,6 +72,7 @@ export { PanelToolsItem, PanelToolsToolId } from "./components/PanelTools/panel-
|
|
|
69
72
|
export { RadioOption } from "./components/RadioGroup/RadioGroup";
|
|
70
73
|
export { ScrollbarVariant } from "./components/Scrollbar/Scrollbar";
|
|
71
74
|
export { SelectOption } from "./components/Select/Select";
|
|
75
|
+
export { ShellGradientPreset as ShellGradientPreset1 } from "./components/ShellGradientSwatch/shell-gradient-swatch-types";
|
|
72
76
|
export { SkeletonVariant } from "./components/Skeleton/Skeleton";
|
|
73
77
|
export { SurfaceBackground, SurfaceContrast, SurfaceElement, SurfaceElevation, SurfaceIntent, SurfaceRadius } from "./components/Surface/Surface";
|
|
74
78
|
export { TabItem } from "./components/TabGroup/tab-item-utils";
|
|
@@ -103,6 +107,11 @@ export namespace Components {
|
|
|
103
107
|
* @default false
|
|
104
108
|
*/
|
|
105
109
|
"gradient": boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Built-in shell wash preset when `gradient` is true. `cool` (blue), `neutral` (grey), `warm` (yellow). `gradientSrc` overrides when set.
|
|
112
|
+
* @default DEFAULT_SHELL_GRADIENT_PRESET
|
|
113
|
+
*/
|
|
114
|
+
"gradientPreset": ShellGradientPreset;
|
|
106
115
|
/**
|
|
107
116
|
* Optional custom gradient for `background-image` (e.g. SVG URL). When set, overrides the built-in radial wash.
|
|
108
117
|
* @default ''
|
|
@@ -802,6 +811,30 @@ export namespace Components {
|
|
|
802
811
|
*/
|
|
803
812
|
"value": string;
|
|
804
813
|
}
|
|
814
|
+
interface DsShellGradientPicker {
|
|
815
|
+
/**
|
|
816
|
+
* Active shell wash preset.
|
|
817
|
+
* @default DEFAULT_SHELL_GRADIENT_PRESET
|
|
818
|
+
*/
|
|
819
|
+
"value": ShellGradientPreset1;
|
|
820
|
+
}
|
|
821
|
+
interface DsShellGradientSwatch {
|
|
822
|
+
"ariaLabel": string | undefined;
|
|
823
|
+
/**
|
|
824
|
+
* @default false
|
|
825
|
+
*/
|
|
826
|
+
"inactive": boolean;
|
|
827
|
+
/**
|
|
828
|
+
* Wash preset this orb previews.
|
|
829
|
+
* @default DEFAULT_SHELL_GRADIENT_PRESET
|
|
830
|
+
*/
|
|
831
|
+
"preset": ShellGradientPreset1;
|
|
832
|
+
/**
|
|
833
|
+
* Selected state — shows an inset brand ring.
|
|
834
|
+
* @default false
|
|
835
|
+
*/
|
|
836
|
+
"selected": boolean;
|
|
837
|
+
}
|
|
805
838
|
interface DsSkeleton {
|
|
806
839
|
/**
|
|
807
840
|
* Height as a CSS value string or number (px).
|
|
@@ -1212,6 +1245,14 @@ export interface DsSelectCustomEvent<T> extends CustomEvent<T> {
|
|
|
1212
1245
|
detail: T;
|
|
1213
1246
|
target: HTMLDsSelectElement;
|
|
1214
1247
|
}
|
|
1248
|
+
export interface DsShellGradientPickerCustomEvent<T> extends CustomEvent<T> {
|
|
1249
|
+
detail: T;
|
|
1250
|
+
target: HTMLDsShellGradientPickerElement;
|
|
1251
|
+
}
|
|
1252
|
+
export interface DsShellGradientSwatchCustomEvent<T> extends CustomEvent<T> {
|
|
1253
|
+
detail: T;
|
|
1254
|
+
target: HTMLDsShellGradientSwatchElement;
|
|
1255
|
+
}
|
|
1215
1256
|
export interface DsSliderCustomEvent<T> extends CustomEvent<T> {
|
|
1216
1257
|
detail: T;
|
|
1217
1258
|
target: HTMLDsSliderElement;
|
|
@@ -1480,6 +1521,7 @@ declare global {
|
|
|
1480
1521
|
interface HTMLDsMenuElementEventMap {
|
|
1481
1522
|
"dsClose": void;
|
|
1482
1523
|
"dsSelect": MenuItemData;
|
|
1524
|
+
"dsGradientSelect": ShellGradientPreset;
|
|
1483
1525
|
}
|
|
1484
1526
|
interface HTMLDsMenuElement extends Components.DsMenu, HTMLStencilElement {
|
|
1485
1527
|
addEventListener<K extends keyof HTMLDsMenuElementEventMap>(type: K, listener: (this: HTMLDsMenuElement, ev: DsMenuCustomEvent<HTMLDsMenuElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -1613,6 +1655,40 @@ declare global {
|
|
|
1613
1655
|
prototype: HTMLDsSelectElement;
|
|
1614
1656
|
new (): HTMLDsSelectElement;
|
|
1615
1657
|
};
|
|
1658
|
+
interface HTMLDsShellGradientPickerElementEventMap {
|
|
1659
|
+
"dsChange": ShellGradientPreset1;
|
|
1660
|
+
}
|
|
1661
|
+
interface HTMLDsShellGradientPickerElement extends Components.DsShellGradientPicker, HTMLStencilElement {
|
|
1662
|
+
addEventListener<K extends keyof HTMLDsShellGradientPickerElementEventMap>(type: K, listener: (this: HTMLDsShellGradientPickerElement, ev: DsShellGradientPickerCustomEvent<HTMLDsShellGradientPickerElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1663
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1664
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1665
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1666
|
+
removeEventListener<K extends keyof HTMLDsShellGradientPickerElementEventMap>(type: K, listener: (this: HTMLDsShellGradientPickerElement, ev: DsShellGradientPickerCustomEvent<HTMLDsShellGradientPickerElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
1667
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1668
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1669
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1670
|
+
}
|
|
1671
|
+
var HTMLDsShellGradientPickerElement: {
|
|
1672
|
+
prototype: HTMLDsShellGradientPickerElement;
|
|
1673
|
+
new (): HTMLDsShellGradientPickerElement;
|
|
1674
|
+
};
|
|
1675
|
+
interface HTMLDsShellGradientSwatchElementEventMap {
|
|
1676
|
+
"dsSelect": ShellGradientPreset1;
|
|
1677
|
+
}
|
|
1678
|
+
interface HTMLDsShellGradientSwatchElement extends Components.DsShellGradientSwatch, HTMLStencilElement {
|
|
1679
|
+
addEventListener<K extends keyof HTMLDsShellGradientSwatchElementEventMap>(type: K, listener: (this: HTMLDsShellGradientSwatchElement, ev: DsShellGradientSwatchCustomEvent<HTMLDsShellGradientSwatchElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1680
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1681
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
1682
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1683
|
+
removeEventListener<K extends keyof HTMLDsShellGradientSwatchElementEventMap>(type: K, listener: (this: HTMLDsShellGradientSwatchElement, ev: DsShellGradientSwatchCustomEvent<HTMLDsShellGradientSwatchElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
1684
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1685
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
1686
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1687
|
+
}
|
|
1688
|
+
var HTMLDsShellGradientSwatchElement: {
|
|
1689
|
+
prototype: HTMLDsShellGradientSwatchElement;
|
|
1690
|
+
new (): HTMLDsShellGradientSwatchElement;
|
|
1691
|
+
};
|
|
1616
1692
|
interface HTMLDsSkeletonElement extends Components.DsSkeleton, HTMLStencilElement {
|
|
1617
1693
|
}
|
|
1618
1694
|
var HTMLDsSkeletonElement: {
|
|
@@ -1800,6 +1876,8 @@ declare global {
|
|
|
1800
1876
|
"ds-radio-group": HTMLDsRadioGroupElement;
|
|
1801
1877
|
"ds-scrollbar": HTMLDsScrollbarElement;
|
|
1802
1878
|
"ds-select": HTMLDsSelectElement;
|
|
1879
|
+
"ds-shell-gradient-picker": HTMLDsShellGradientPickerElement;
|
|
1880
|
+
"ds-shell-gradient-swatch": HTMLDsShellGradientSwatchElement;
|
|
1803
1881
|
"ds-skeleton": HTMLDsSkeletonElement;
|
|
1804
1882
|
"ds-slider": HTMLDsSliderElement;
|
|
1805
1883
|
"ds-surface": HTMLDsSurfaceElement;
|
|
@@ -1840,6 +1918,11 @@ declare namespace LocalJSX {
|
|
|
1840
1918
|
* @default false
|
|
1841
1919
|
*/
|
|
1842
1920
|
"gradient"?: boolean;
|
|
1921
|
+
/**
|
|
1922
|
+
* Built-in shell wash preset when `gradient` is true. `cool` (blue), `neutral` (grey), `warm` (yellow). `gradientSrc` overrides when set.
|
|
1923
|
+
* @default DEFAULT_SHELL_GRADIENT_PRESET
|
|
1924
|
+
*/
|
|
1925
|
+
"gradientPreset"?: ShellGradientPreset;
|
|
1843
1926
|
/**
|
|
1844
1927
|
* Optional custom gradient for `background-image` (e.g. SVG URL). When set, overrides the built-in radial wash.
|
|
1845
1928
|
* @default ''
|
|
@@ -2374,6 +2457,10 @@ declare namespace LocalJSX {
|
|
|
2374
2457
|
"menuWidth"?: string | undefined;
|
|
2375
2458
|
"minWidth"?: string | undefined;
|
|
2376
2459
|
"onDsClose"?: (event: DsMenuCustomEvent<void>) => void;
|
|
2460
|
+
/**
|
|
2461
|
+
* Emitted when a `gradient-picker` section swatch is chosen.
|
|
2462
|
+
*/
|
|
2463
|
+
"onDsGradientSelect"?: (event: DsMenuCustomEvent<ShellGradientPreset>) => void;
|
|
2377
2464
|
"onDsSelect"?: (event: DsMenuCustomEvent<MenuItemData>) => void;
|
|
2378
2465
|
/**
|
|
2379
2466
|
* @default false
|
|
@@ -2597,6 +2684,32 @@ declare namespace LocalJSX {
|
|
|
2597
2684
|
*/
|
|
2598
2685
|
"value"?: string;
|
|
2599
2686
|
}
|
|
2687
|
+
interface DsShellGradientPicker {
|
|
2688
|
+
"onDsChange"?: (event: DsShellGradientPickerCustomEvent<ShellGradientPreset1>) => void;
|
|
2689
|
+
/**
|
|
2690
|
+
* Active shell wash preset.
|
|
2691
|
+
* @default DEFAULT_SHELL_GRADIENT_PRESET
|
|
2692
|
+
*/
|
|
2693
|
+
"value"?: ShellGradientPreset1;
|
|
2694
|
+
}
|
|
2695
|
+
interface DsShellGradientSwatch {
|
|
2696
|
+
"ariaLabel"?: string | undefined;
|
|
2697
|
+
/**
|
|
2698
|
+
* @default false
|
|
2699
|
+
*/
|
|
2700
|
+
"inactive"?: boolean;
|
|
2701
|
+
"onDsSelect"?: (event: DsShellGradientSwatchCustomEvent<ShellGradientPreset1>) => void;
|
|
2702
|
+
/**
|
|
2703
|
+
* Wash preset this orb previews.
|
|
2704
|
+
* @default DEFAULT_SHELL_GRADIENT_PRESET
|
|
2705
|
+
*/
|
|
2706
|
+
"preset"?: ShellGradientPreset1;
|
|
2707
|
+
/**
|
|
2708
|
+
* Selected state — shows an inset brand ring.
|
|
2709
|
+
* @default false
|
|
2710
|
+
*/
|
|
2711
|
+
"selected"?: boolean;
|
|
2712
|
+
}
|
|
2600
2713
|
interface DsSkeleton {
|
|
2601
2714
|
/**
|
|
2602
2715
|
* Height as a CSS value string or number (px).
|
|
@@ -2964,6 +3077,7 @@ declare namespace LocalJSX {
|
|
|
2964
3077
|
"gradient": boolean;
|
|
2965
3078
|
"grid": boolean;
|
|
2966
3079
|
"gradientSrc": string;
|
|
3080
|
+
"gradientPreset": ShellGradientPreset;
|
|
2967
3081
|
"shortcutsEnabled": boolean;
|
|
2968
3082
|
}
|
|
2969
3083
|
interface DsBadgeAttributes {
|
|
@@ -3171,6 +3285,15 @@ declare namespace LocalJSX {
|
|
|
3171
3285
|
"ariaLabel": string | undefined;
|
|
3172
3286
|
"ariaLabelledby": string | undefined;
|
|
3173
3287
|
}
|
|
3288
|
+
interface DsShellGradientPickerAttributes {
|
|
3289
|
+
"value": ShellGradientPreset;
|
|
3290
|
+
}
|
|
3291
|
+
interface DsShellGradientSwatchAttributes {
|
|
3292
|
+
"preset": ShellGradientPreset;
|
|
3293
|
+
"selected": boolean;
|
|
3294
|
+
"inactive": boolean;
|
|
3295
|
+
"ariaLabel": string | undefined;
|
|
3296
|
+
}
|
|
3174
3297
|
interface DsSkeletonAttributes {
|
|
3175
3298
|
"variant": SkeletonVariant;
|
|
3176
3299
|
"width": string;
|
|
@@ -3309,6 +3432,8 @@ declare namespace LocalJSX {
|
|
|
3309
3432
|
"ds-radio-group": Omit<DsRadioGroup, keyof DsRadioGroupAttributes> & { [K in keyof DsRadioGroup & keyof DsRadioGroupAttributes]?: DsRadioGroup[K] } & { [K in keyof DsRadioGroup & keyof DsRadioGroupAttributes as `attr:${K}`]?: DsRadioGroupAttributes[K] } & { [K in keyof DsRadioGroup & keyof DsRadioGroupAttributes as `prop:${K}`]?: DsRadioGroup[K] };
|
|
3310
3433
|
"ds-scrollbar": Omit<DsScrollbar, keyof DsScrollbarAttributes> & { [K in keyof DsScrollbar & keyof DsScrollbarAttributes]?: DsScrollbar[K] } & { [K in keyof DsScrollbar & keyof DsScrollbarAttributes as `attr:${K}`]?: DsScrollbarAttributes[K] } & { [K in keyof DsScrollbar & keyof DsScrollbarAttributes as `prop:${K}`]?: DsScrollbar[K] };
|
|
3311
3434
|
"ds-select": Omit<DsSelect, keyof DsSelectAttributes> & { [K in keyof DsSelect & keyof DsSelectAttributes]?: DsSelect[K] } & { [K in keyof DsSelect & keyof DsSelectAttributes as `attr:${K}`]?: DsSelectAttributes[K] } & { [K in keyof DsSelect & keyof DsSelectAttributes as `prop:${K}`]?: DsSelect[K] };
|
|
3435
|
+
"ds-shell-gradient-picker": Omit<DsShellGradientPicker, keyof DsShellGradientPickerAttributes> & { [K in keyof DsShellGradientPicker & keyof DsShellGradientPickerAttributes]?: DsShellGradientPicker[K] } & { [K in keyof DsShellGradientPicker & keyof DsShellGradientPickerAttributes as `attr:${K}`]?: DsShellGradientPickerAttributes[K] } & { [K in keyof DsShellGradientPicker & keyof DsShellGradientPickerAttributes as `prop:${K}`]?: DsShellGradientPicker[K] };
|
|
3436
|
+
"ds-shell-gradient-swatch": Omit<DsShellGradientSwatch, keyof DsShellGradientSwatchAttributes> & { [K in keyof DsShellGradientSwatch & keyof DsShellGradientSwatchAttributes]?: DsShellGradientSwatch[K] } & { [K in keyof DsShellGradientSwatch & keyof DsShellGradientSwatchAttributes as `attr:${K}`]?: DsShellGradientSwatchAttributes[K] } & { [K in keyof DsShellGradientSwatch & keyof DsShellGradientSwatchAttributes as `prop:${K}`]?: DsShellGradientSwatch[K] };
|
|
3312
3437
|
"ds-skeleton": Omit<DsSkeleton, keyof DsSkeletonAttributes> & { [K in keyof DsSkeleton & keyof DsSkeletonAttributes]?: DsSkeleton[K] } & { [K in keyof DsSkeleton & keyof DsSkeletonAttributes as `attr:${K}`]?: DsSkeletonAttributes[K] } & { [K in keyof DsSkeleton & keyof DsSkeletonAttributes as `prop:${K}`]?: DsSkeleton[K] };
|
|
3313
3438
|
"ds-slider": Omit<DsSlider, keyof DsSliderAttributes> & { [K in keyof DsSlider & keyof DsSliderAttributes]?: DsSlider[K] } & { [K in keyof DsSlider & keyof DsSliderAttributes as `attr:${K}`]?: DsSliderAttributes[K] } & { [K in keyof DsSlider & keyof DsSliderAttributes as `prop:${K}`]?: DsSlider[K] } & OneOf<"label", DsSlider["label"], DsSliderAttributes["label"]>;
|
|
3314
3439
|
"ds-surface": Omit<DsSurface, keyof DsSurfaceAttributes> & { [K in keyof DsSurface & keyof DsSurfaceAttributes]?: DsSurface[K] } & { [K in keyof DsSurface & keyof DsSurfaceAttributes as `attr:${K}`]?: DsSurfaceAttributes[K] } & { [K in keyof DsSurface & keyof DsSurfaceAttributes as `prop:${K}`]?: DsSurface[K] };
|
|
@@ -3356,6 +3481,8 @@ declare module "@stencil/core" {
|
|
|
3356
3481
|
"ds-radio-group": LocalJSX.IntrinsicElements["ds-radio-group"] & JSXBase.HTMLAttributes<HTMLDsRadioGroupElement>;
|
|
3357
3482
|
"ds-scrollbar": LocalJSX.IntrinsicElements["ds-scrollbar"] & JSXBase.HTMLAttributes<HTMLDsScrollbarElement>;
|
|
3358
3483
|
"ds-select": LocalJSX.IntrinsicElements["ds-select"] & JSXBase.HTMLAttributes<HTMLDsSelectElement>;
|
|
3484
|
+
"ds-shell-gradient-picker": LocalJSX.IntrinsicElements["ds-shell-gradient-picker"] & JSXBase.HTMLAttributes<HTMLDsShellGradientPickerElement>;
|
|
3485
|
+
"ds-shell-gradient-swatch": LocalJSX.IntrinsicElements["ds-shell-gradient-swatch"] & JSXBase.HTMLAttributes<HTMLDsShellGradientSwatchElement>;
|
|
3359
3486
|
"ds-skeleton": LocalJSX.IntrinsicElements["ds-skeleton"] & JSXBase.HTMLAttributes<HTMLDsSkeletonElement>;
|
|
3360
3487
|
"ds-slider": LocalJSX.IntrinsicElements["ds-slider"] & JSXBase.HTMLAttributes<HTMLDsSliderElement>;
|
|
3361
3488
|
"ds-surface": LocalJSX.IntrinsicElements["ds-surface"] & JSXBase.HTMLAttributes<HTMLDsSurfaceElement>;
|
|
@@ -4,6 +4,8 @@ export { SHELL_BAR_NAV_VT_NAME, SHELL_NAV_REVEAL_DURATION_VAR, SHELL_NAV_REVEAL_
|
|
|
4
4
|
export type { ShellNavRevealOrigin } from './shell-view-transition';
|
|
5
5
|
export { SHELL_GRADIENT_IMAGE_VAR, SHELL_GRADIENT_SIZE_VAR, SHELL_GRADIENT_POSITION_PANEL_VAR, SHELL_GRADIENT_POSITION_BAR_VAR, SHELL_GRADIENT_OPACITY_VAR, SHELL_CHROME_SURFACE_POSITION_VAR, SHELL_GRADIENT_OPACITY, buildShellRadialGradient, shellGradientImage, shellGradientSize, shellGradientPositionPanel, shellGradientPositionBar, shellChromeSurfacePosition, shellChromeLayerActive, readShellViewportDimensions, } from './shell-gradient';
|
|
6
6
|
export type { ShellGradientLayout, ShellViewportDimensions } from './shell-gradient';
|
|
7
|
+
export type { ShellGradientPreset } from './shell-gradient-presets';
|
|
8
|
+
export { DEFAULT_SHELL_GRADIENT_PRESET, SHELL_GRADIENT_PRESETS, SHELL_GRADIENT_PRESET_LABELS, buildShellRadialGradientForPreset, isShellGradientPreset, shellGradientPresetStopToken, } from './shell-gradient-presets';
|
|
7
9
|
export type { ChromeTransitionDetail, ChromeTransitionSource } from './chrome-transition';
|
|
8
10
|
export { CHROME_TRANSITION_END, CHROME_TRANSITION_START, ChromeTransitionDepth, createRafCoalescer, readChromeTransitionSource, readChromeTransitionPhase, } from './chrome-transition';
|
|
9
11
|
export { barGradientPositionFromPanelWidth, isPanelNavCollapsed, panelWidthPxFromTokens, readCssVarWidthPx, readPanelNavWidthTokens, } from './shell-chrome-metrics';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Built-in shell chrome wash presets — cool (blue), neutral (grey), warm (yellow). */
|
|
2
|
+
export type ShellGradientPreset = 'cool' | 'neutral' | 'warm';
|
|
3
|
+
export declare const SHELL_GRADIENT_PRESETS: ShellGradientPreset[];
|
|
4
|
+
/** Default wash when `gradient-preset` is omitted. */
|
|
5
|
+
export declare const DEFAULT_SHELL_GRADIENT_PRESET: ShellGradientPreset;
|
|
6
|
+
export declare const SHELL_GRADIENT_PRESET_LABELS: Record<ShellGradientPreset, string>;
|
|
7
|
+
export declare function shellGradientPresetStopToken(preset: ShellGradientPreset): string;
|
|
8
|
+
export declare function isShellGradientPreset(value: string): value is ShellGradientPreset;
|
|
9
|
+
/** Radial wash for a preset — transparent at top-left into the intent stop. */
|
|
10
|
+
export declare function buildShellRadialGradientForPreset(preset: ShellGradientPreset): string;
|
|
11
|
+
//# sourceMappingURL=shell-gradient-presets.d.ts.map
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/** CSS var names consumed by `ds-panel-nav` / `ds-bar-nav` inside `ds-app-shell`. */
|
|
2
|
+
import type { ShellGradientPreset } from './shell-gradient-presets';
|
|
3
|
+
export type { ShellGradientPreset } from './shell-gradient-presets';
|
|
4
|
+
export { DEFAULT_SHELL_GRADIENT_PRESET, SHELL_GRADIENT_PRESETS, SHELL_GRADIENT_PRESET_LABELS, buildShellRadialGradientForPreset, isShellGradientPreset, shellGradientPresetStopToken, } from './shell-gradient-presets';
|
|
2
5
|
export declare const SHELL_GRADIENT_IMAGE_VAR = "--ds-shell-gradient-image";
|
|
3
6
|
export declare const SHELL_GRADIENT_SIZE_VAR = "--ds-shell-gradient-size";
|
|
4
7
|
export declare const SHELL_GRADIENT_POSITION_PANEL_VAR = "--ds-shell-gradient-position-panel";
|
|
@@ -12,11 +15,11 @@ export declare const SHELL_GRADIENT_OPACITY = "0.1";
|
|
|
12
15
|
export declare function shellChromeLayerActive(gradient: boolean, grid: boolean): boolean;
|
|
13
16
|
/**
|
|
14
17
|
* Shell radial wash — same for panel and bar nav.
|
|
15
|
-
* Tokens follow `data-theme` (light/dark
|
|
18
|
+
* Tokens follow `data-theme` (light/dark intent stops).
|
|
16
19
|
*/
|
|
17
|
-
export declare function buildShellRadialGradient(): string;
|
|
18
|
-
/** Built-in radial image (
|
|
19
|
-
export declare function shellGradientImage(): string;
|
|
20
|
+
export declare function buildShellRadialGradient(preset?: ShellGradientPreset): string;
|
|
21
|
+
/** Built-in radial image (`gradientSrc` on shell overrides). */
|
|
22
|
+
export declare function shellGradientImage(preset?: ShellGradientPreset): string;
|
|
20
23
|
export interface ShellViewportDimensions {
|
|
21
24
|
width: number;
|
|
22
25
|
height: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ds-mo/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "CompoMo — composable web components styled with TokoMo design tokens",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"pretest": "node scripts/generate-icon-catalog.mjs",
|
|
70
70
|
"build": "stencil build && node scripts/patch-index-types.mjs && node scripts/verify-icons-externalized.mjs && node scripts/write-build-stamp.mjs",
|
|
71
71
|
"verify:pack": "node scripts/verify-npm-pack.mjs && node scripts/verify-nav-import.mjs",
|
|
72
|
-
"test": "node --import tsx/esm --test tests/panel-nav-utils.test.ts tests/panel-tools.test.ts tests/shell-shortcuts.test.ts tests/shell-view-transition.test.ts tests/shell-gradient.test.ts tests/shell-chrome-metrics.test.ts tests/shell-chrome-layer.test.ts tests/chrome-transition.test.ts tests/bar-nav-overflow-hysteresis.test.ts tests/badge-gradient-ring.test.ts tests/scroll-edge-fade.test.ts tests/resolve-css-length-px.test.ts tests/resolve-css-time-ms.test.ts tests/overlay-positioning.test.ts tests/menu-position.test.ts tests/bar-nav-utils.test.ts tests/bar-nav-tabs-menu-utils.test.ts tests/bar-nav-dom-utils.test.ts tests/icon-catalog.test.ts",
|
|
72
|
+
"test": "node --import tsx/esm --test tests/panel-nav-utils.test.ts tests/panel-tools.test.ts tests/shell-shortcuts.test.ts tests/shell-gradient-presets.test.ts tests/shell-view-transition.test.ts tests/shell-gradient.test.ts tests/shell-chrome-metrics.test.ts tests/shell-chrome-layer.test.ts tests/chrome-transition.test.ts tests/bar-nav-overflow-hysteresis.test.ts tests/badge-gradient-ring.test.ts tests/scroll-edge-fade.test.ts tests/resolve-css-length-px.test.ts tests/resolve-css-time-ms.test.ts tests/overlay-positioning.test.ts tests/menu-position.test.ts tests/bar-nav-utils.test.ts tests/bar-nav-tabs-menu-utils.test.ts tests/bar-nav-dom-utils.test.ts tests/icon-catalog.test.ts",
|
|
73
73
|
"test:e2e": "npm run build && playwright test",
|
|
74
74
|
"test:e2e:install": "playwright install chromium",
|
|
75
75
|
"build:docs": "stencil build --docs",
|