@weasel-js/ui 1.0.0 → 1.0.1
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/chunks/ActionsBar-CAjrj_Pt.js +48 -0
- package/dist/chunks/{ActionsBar-CzU6Of3B.js.map → ActionsBar-CAjrj_Pt.js.map} +1 -1
- package/dist/chunks/{Callout-CxxrEcSb.js → Callout-DlirfLJl.js} +1 -1
- package/dist/chunks/{Callout-CxxrEcSb.js.map → Callout-DlirfLJl.js.map} +1 -1
- package/dist/chunks/{Checkbox-Cf6YHVWV.js → Checkbox-B3Z_u7k0.js} +1 -1
- package/dist/chunks/{Checkbox-Cf6YHVWV.js.map → Checkbox-B3Z_u7k0.js.map} +1 -1
- package/dist/chunks/{ColorField-sGLnThpB.js → ColorField-B4Hd2qqS.js} +1 -1
- package/dist/chunks/{ColorField-sGLnThpB.js.map → ColorField-B4Hd2qqS.js.map} +1 -1
- package/dist/chunks/{ComboBox-EnV1IytN.js → ComboBox-tbmgND-F.js} +2 -2
- package/dist/chunks/{ComboBox-EnV1IytN.js.map → ComboBox-tbmgND-F.js.map} +1 -1
- package/dist/chunks/{CurveEditor-DAb2EMyR.js → CurveEditor-CSKqAXMp.js} +1 -1
- package/dist/chunks/{CurveEditor-DAb2EMyR.js.map → CurveEditor-CSKqAXMp.js.map} +1 -1
- package/dist/chunks/{Dialog-CQymDCAl.js → Dialog-BFuakycR.js} +1 -1
- package/dist/chunks/{Dialog-CQymDCAl.js.map → Dialog-BFuakycR.js.map} +1 -1
- package/dist/chunks/{Field-BHSu2F3E.js → Field-DPxmJzZz.js} +1 -1
- package/dist/chunks/{Field-BHSu2F3E.js.map → Field-DPxmJzZz.js.map} +1 -1
- package/dist/chunks/{GradientEditor-Co9aGyRe.js → GradientEditor-3pYXGAPg.js} +3 -3
- package/dist/chunks/{GradientEditor-Co9aGyRe.js.map → GradientEditor-3pYXGAPg.js.map} +1 -1
- package/dist/chunks/{Input-qk44ESKC.js → Input-Dg_CYXg4.js} +2 -2
- package/dist/chunks/{Input-qk44ESKC.js.map → Input-Dg_CYXg4.js.map} +1 -1
- package/dist/chunks/{NumberField-CYhQeWoM.js → NumberField-BhxUgi43.js} +2 -2
- package/dist/chunks/{NumberField-CYhQeWoM.js.map → NumberField-BhxUgi43.js.map} +1 -1
- package/dist/chunks/OptionsBar-hQN-wfd-.js +52 -0
- package/dist/chunks/OptionsBar-hQN-wfd-.js.map +1 -0
- package/dist/chunks/{PointPlotter-EkbCBK9j.js → PointPlotter-DCSjvpN0.js} +2 -2
- package/dist/chunks/{PointPlotter-EkbCBK9j.js.map → PointPlotter-DCSjvpN0.js.map} +1 -1
- package/dist/chunks/{Powerline-Bg9M5oBK.js → Powerline-DkOTPnUV.js} +1 -1
- package/dist/chunks/{Powerline-Bg9M5oBK.js.map → Powerline-DkOTPnUV.js.map} +1 -1
- package/dist/chunks/{Prefs-DZjXp2Ln.js → Prefs-C4HfuTvm.js} +10 -10
- package/dist/chunks/{Prefs-DZjXp2Ln.js.map → Prefs-C4HfuTvm.js.map} +1 -1
- package/dist/chunks/{RadioGroup-rL2i3afr.js → RadioGroup-Bg3Rqxe2.js} +2 -2
- package/dist/chunks/{RadioGroup-rL2i3afr.js.map → RadioGroup-Bg3Rqxe2.js.map} +1 -1
- package/dist/chunks/{RangeSlider-DPldYd4O.js → RangeSlider-BvM_DGSr.js} +1 -1
- package/dist/chunks/{RangeSlider-DPldYd4O.js.map → RangeSlider-BvM_DGSr.js.map} +1 -1
- package/dist/chunks/{ResizeHandle-DR8X229y.js → ResizeHandle-BUkW2kZC.js} +1 -1
- package/dist/chunks/{ResizeHandle-DR8X229y.js.map → ResizeHandle-BUkW2kZC.js.map} +1 -1
- package/dist/chunks/{Select-vSeAbspK.js → Select-DC0AjrEe.js} +2 -2
- package/dist/chunks/{Select-vSeAbspK.js.map → Select-DC0AjrEe.js.map} +1 -1
- package/dist/chunks/{SelectionPanel-1mmALQba.js → SelectionPanel-DoTdisRY.js} +6 -6
- package/dist/chunks/{SelectionPanel-1mmALQba.js.map → SelectionPanel-DoTdisRY.js.map} +1 -1
- package/dist/chunks/{Sidebar-CigrFvpL.js → Sidebar-B8qig3BQ.js} +1 -1
- package/dist/chunks/{Sidebar-CigrFvpL.js.map → Sidebar-B8qig3BQ.js.map} +1 -1
- package/dist/chunks/{SidebarPanel-C0w16BrF.js → SidebarPanel-LOt2c-wb.js} +1 -1
- package/dist/chunks/{SidebarPanel-C0w16BrF.js.map → SidebarPanel-LOt2c-wb.js.map} +1 -1
- package/dist/chunks/{StatusBar-lt_Ok6WK.js → StatusBar-Cg2LzdAm.js} +1 -1
- package/dist/chunks/{StatusBar-lt_Ok6WK.js.map → StatusBar-Cg2LzdAm.js.map} +1 -1
- package/dist/chunks/{Switch-BYj762hm.js → Switch-I4putUAY.js} +1 -1
- package/dist/chunks/{Switch-BYj762hm.js.map → Switch-I4putUAY.js.map} +1 -1
- package/dist/chunks/{Tabs-DOW5jtnq.js → Tabs-irZuG_PN.js} +1 -1
- package/dist/chunks/{Tabs-DOW5jtnq.js.map → Tabs-irZuG_PN.js.map} +1 -1
- package/dist/chunks/{Toast-DLM2AsTz.js → Toast-BGYP8Pw0.js} +1 -1
- package/dist/chunks/{Toast-DLM2AsTz.js.map → Toast-BGYP8Pw0.js.map} +1 -1
- package/dist/chunks/ToggleBar-BP1zFcvg.js +74 -0
- package/dist/chunks/ToggleBar-BP1zFcvg.js.map +1 -0
- package/dist/chunks/{ToolButton-5L1sAlJC.js → ToolButton-DUeg8fPN.js} +1 -1
- package/dist/chunks/{ToolButton-5L1sAlJC.js.map → ToolButton-DUeg8fPN.js.map} +1 -1
- package/dist/chunks/{ToolGroup-BAthcF5H.js → ToolGroup-D0CvyQhQ.js} +1 -1
- package/dist/chunks/{ToolGroup-BAthcF5H.js.map → ToolGroup-D0CvyQhQ.js.map} +1 -1
- package/dist/chunks/{ToolOptionsBar-D4xmXa_a.js → ToolOptionsBar-N_MQcSo4.js} +1 -1
- package/dist/chunks/{ToolOptionsBar-D4xmXa_a.js.map → ToolOptionsBar-N_MQcSo4.js.map} +1 -1
- package/dist/chunks/{ToolPalette-BDkvV3pJ.js → ToolPalette-BipoMdZz.js} +3 -3
- package/dist/chunks/{ToolPalette-BDkvV3pJ.js.map → ToolPalette-BipoMdZz.js.map} +1 -1
- package/dist/chunks/useRovingTabIndex-DBZtq4IH.js +65 -0
- package/dist/chunks/useRovingTabIndex-DBZtq4IH.js.map +1 -0
- package/dist/components/ActionsBar/ActionsBar.d.ts.map +1 -1
- package/dist/components/ActionsBar/index.js +1 -1
- package/dist/components/Callout/index.js +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/ColorField/index.js +1 -1
- package/dist/components/ComboBox/index.js +1 -1
- package/dist/components/CurveEditor/index.js +1 -1
- package/dist/components/Dialog/index.js +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/GradientEditor/index.js +1 -1
- package/dist/components/Input/index.js +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OptionsBar/OptionsBar.d.ts.map +1 -1
- package/dist/components/OptionsBar/index.js +1 -1
- package/dist/components/PointPlotter/index.js +1 -1
- package/dist/components/Powerline/index.js +1 -1
- package/dist/components/Prefs/index.js +1 -1
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/RangeSlider/index.js +1 -1
- package/dist/components/ResizeHandle/index.js +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SelectionPanel/index.js +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/SidebarPanel/index.js +1 -1
- package/dist/components/StatusBar/index.js +1 -1
- package/dist/components/Switch/index.js +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/ToggleBar/ToggleBar.d.ts.map +1 -1
- package/dist/components/ToggleBar/index.js +1 -1
- package/dist/components/ToolButton/index.js +1 -1
- package/dist/components/ToolGroup/index.js +1 -1
- package/dist/components/ToolOptionsBar/index.js +1 -1
- package/dist/components/ToolPalette/index.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -37
- package/dist/index.js.map +1 -1
- package/dist/useRovingTabIndex.d.ts +52 -0
- package/dist/useRovingTabIndex.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/chunks/ActionsBar-CzU6Of3B.js +0 -94
- package/dist/chunks/OptionsBar-CHOP_CiW.js +0 -98
- package/dist/chunks/OptionsBar-CHOP_CiW.js.map +0 -1
- package/dist/chunks/ToggleBar-Defj6Asn.js +0 -129
- package/dist/chunks/ToggleBar-Defj6Asn.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolPalette-BDkvV3pJ.js","names":[],"sources":["../../src/components/ToolPalette/ToolPalette.module.css","../../src/components/ToolPalette/formatShortcut.ts","../../src/components/ToolPalette/ToolPalette.tsx"],"sourcesContent":[".palette {\n display: flex;\n flex-direction: column;\n gap: 4px;\n background: var(--wzl-surface);\n border: 1px solid var(--wzl-border);\n border-radius: 4px;\n padding: 4px;\n user-select: none;\n}\n.palette.horizontal {\n flex-direction: row;\n}\n\n/* Applied to ineligible tool buttons in the active mode. */\n.ineligibleBtn {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.separator {\n background: var(--wzl-border);\n}\n.palette:not(.horizontal) .separator {\n height: 1px;\n margin: 2px 0;\n}\n.palette.horizontal .separator {\n width: 1px;\n margin: 0 2px;\n}\n","import { keyGlyph } from '../Keycaps/keyGlyph';\n\nexport interface ShortcutInput {\n key: string | readonly string[];\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Format a shortcut as an array of display chips, one per key — modifier\n * icons (⌘, ↑, ⌥) followed by the key glyph. UIs that want a boxed\n * per-key look render each chip in its own element. `shift: 'optional'` is\n * treated as falsy. */\nexport function formatShortcutParts(b: ShortcutInput | undefined): readonly string[] | undefined {\n if (!b) return undefined;\n const rawKey = Array.isArray(b.key) ? b.key[0] : (b.key as string);\n const parts: string[] = [];\n if (b.mod) parts.push('⌘');\n if (b.shift === true) parts.push('⇧');\n if (b.alt) parts.push('⌥');\n parts.push(keyGlyph(rawKey));\n return parts;\n}\n\n/** Format a shortcut as a single display string. Order: mod, shift, alt,\n * key. Returns `undefined` for `undefined` input so callers can `??` a\n * fallback. When `key` is an array, the first element is used. `shift: 'optional'`\n * is treated as falsy. */\nexport function formatShortcut(b: ShortcutInput | undefined): string | undefined {\n const parts = formatShortcutParts(b);\n return parts ? parts.join('') : undefined;\n}\n","import { Fragment, useRef, type ReactNode } from 'react';\nimport { UnknownIcon } from '@weasel-js/core';\nimport type { AnyTool, ToolsApi } from '@weasel-js/core';\nimport { eligibleContribution, type ModeRegistry } from '@weasel-js/modes';\nimport { ToolButton } from '../ToolButton';\nimport { ToolGroup } from '../ToolGroup';\nimport s from './ToolPalette.module.css';\nimport { formatShortcut, type ShortcutInput } from './formatShortcut';\n\nconst DEFAULT_GROUP_ORDER = ['select', 'shape', 'draw', 'type', 'view'] as const;\nconst MISC = 'misc';\n\nfunction partitionByGroup(list: AnyTool[]): Map<string, AnyTool[]> {\n const groups = new Map<string, AnyTool[]>();\n for (const tool of list) {\n const g = tool.presentation?.group ?? MISC;\n const bucket = groups.get(g) ?? [];\n bucket.push(tool);\n groups.set(g, bucket);\n }\n return groups;\n}\n\nfunction orderedGroupKeys(\n groups: Map<string, AnyTool[]>,\n groupOrder: readonly string[],\n): string[] {\n const seen = new Set(groups.keys());\n const ordered: string[] = [];\n for (const known of groupOrder) {\n if (seen.has(known)) {\n ordered.push(known);\n seen.delete(known);\n }\n }\n // Unknown groups in insertion order (Map preserves it), misc last.\n for (const key of groups.keys()) {\n if (seen.has(key) && key !== MISC) {\n ordered.push(key);\n seen.delete(key);\n }\n }\n if (seen.has(MISC)) ordered.push(MISC);\n return ordered;\n}\n\nfunction resolveIcon(tool: AnyTool): ReactNode {\n const rawIcon = tool.presentation?.icon;\n if (rawIcon == null) return <UnknownIcon />;\n if (typeof rawIcon === 'function') return rawIcon(undefined);\n return rawIcon;\n}\n\nexport interface ToolPaletteProps {\n tools: ToolsApi;\n orientation?: 'vertical' | 'horizontal';\n className?: string;\n /** Derive the keyboard shortcut for a tool button from the action registry.\n * Called with the tool's id; return `undefined` to suppress a chip. When\n * omitted, falls back to `tool.keybinding` (legacy path). */\n lookupShortcut?: (toolId: string) => ShortcutInput | undefined;\n /**\n * Optional mode registry. When provided, tools whose `capabilities` do not\n * match the current mode are rendered greyed-out, aria-disabled, and their\n * onClick is suppressed. When omitted, all tools are treated as eligible\n * (preserves existing behaviour in consumers that haven't wired a registry).\n */\n modeRegistry?: ModeRegistry;\n /**\n * Presentation-group display order. Groups not listed keep their registry\n * insertion order after the listed ones; `misc` always renders last.\n * Defaults to `['select', 'shape', 'draw', 'type', 'view']`.\n */\n groupOrder?: readonly string[];\n}\n\nexport function ToolPalette(props: ToolPaletteProps) {\n const {\n tools, orientation = 'vertical', className, lookupShortcut, modeRegistry,\n groupOrder = DEFAULT_GROUP_ORDER,\n } = props;\n const list = Object.values(tools.registry);\n const groups = partitionByGroup(list);\n const groupKeys = orderedGroupKeys(groups, groupOrder);\n const cls = [s.palette, orientation === 'horizontal' && s.horizontal, className]\n .filter(Boolean).join(' ');\n\n const orderedIds = groupKeys.flatMap((k) => groups.get(k)!.map((t) => t.id));\n const tabbableId = tools.active && orderedIds.includes(tools.active)\n ? tools.active\n : orderedIds[0];\n const rootRef = useRef<HTMLDivElement | null>(null);\n\n function onKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n const target = e.target as HTMLElement;\n if (target.tagName !== 'BUTTON') return;\n const root = rootRef.current;\n if (!root) return;\n const buttons = Array.from(root.querySelectorAll<HTMLButtonElement>('button'));\n const i = buttons.indexOf(target as HTMLButtonElement);\n if (i < 0) return;\n\n let next = -1;\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n next = (i + 1) % buttons.length;\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n next = (i - 1 + buttons.length) % buttons.length;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = buttons.length - 1;\n break;\n }\n if (next >= 0) {\n e.preventDefault();\n buttons[next].focus();\n }\n }\n\n return (\n <div\n ref={rootRef}\n className={cls}\n role=\"toolbar\"\n aria-label=\"Tools\"\n onKeyDown={onKeyDown}\n >\n {groupKeys.map((key, i) => (\n <Fragment key={key}>\n {i > 0 && (\n <div\n className={s.separator}\n role=\"separator\"\n aria-orientation={orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n />\n )}\n <ToolGroup orientation={orientation} groupKey={key}>\n {groups.get(key)!.map((tool) => {\n const label = tool.presentation?.label ?? tool.id;\n const shortcut = tool.presentation?.shortcut\n ?? formatShortcut(lookupShortcut ? lookupShortcut(tool.id) : tool.keybinding);\n const enabled = modeRegistry ? eligibleContribution(modeRegistry, tool) : true;\n const modeName = modeRegistry ? modeRegistry.current().id : undefined;\n const resolvedTitle = !enabled && modeName\n ? `${label}${shortcut ? ` (${shortcut})` : ''} — disabled in ${modeName} mode`\n : undefined;\n return (\n <ToolButton\n key={tool.id}\n icon={resolveIcon(tool)}\n label={label}\n shortcut={shortcut}\n active={tools.active === tool.id}\n tabbable={tool.id === tabbableId}\n ariaDisabled={!enabled}\n className={!enabled ? s.ineligibleBtn : undefined}\n title={resolvedTitle}\n onClick={enabled ? () => tools.setActive(tool.id) : () => {}}\n />\n );\n })}\n </ToolGroup>\n </Fragment>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;ACaA,SAAgB,EAAoB,GAA6D;AAC/F,KAAI,CAAC,EAAG;CACR,IAAM,IAAS,MAAM,QAAQ,EAAE,IAAI,GAAG,EAAE,IAAI,KAAM,EAAE,KAC9C,IAAkB,EAAE;AAK1B,QAJI,EAAE,OAAK,EAAM,KAAK,IAAI,EACtB,EAAE,UAAU,MAAM,EAAM,KAAK,IAAI,EACjC,EAAE,OAAK,EAAM,KAAK,I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G,GAAG,EAAK,WAAW,EACzE,IAAU,IAAe,EAAqB,GAAc,EAAK,GAAG,IACpE,IAAW,IAAe,EAAa,SAAS,CAAC,KAAK,KAAA,GACtD,IAAgB,CAAC,KAAW,IAC9B,GAAG,IAAQ,IAAW,KAAK,EAAS,KAAK,GAAG,iBAAiB,EAAS,SACtE,KAAA;AACJ,WACE,kBAAC,GAAD;KAEE,MAAM,EAAY,EAAK;KAChB;KACG;KACV,QAAQ,EAAM,WAAW,EAAK;KAC9B,UAAU,EAAK,OAAO;KACtB,cAAc,CAAC;KACf,WAAY,IAA4B,KAAA,IAAlB,EAAE;KACxB,OAAO;KACP,SAAS,UAAgB,EAAM,UAAU,EAAK,GAAG,SAAS;KAC1D,EAVK,EAAK,GAUV;KAEJ;GACQ,CAAA,CACH,EAAA,EAlCI,EAkCJ,CACX;EACE,CAAA"}
|
|
1
|
+
{"version":3,"file":"ToolPalette-BipoMdZz.js","names":[],"sources":["../../src/components/ToolPalette/ToolPalette.module.css","../../src/components/ToolPalette/formatShortcut.ts","../../src/components/ToolPalette/ToolPalette.tsx"],"sourcesContent":[".palette {\n display: flex;\n flex-direction: column;\n gap: 4px;\n background: var(--wzl-surface);\n border: 1px solid var(--wzl-border);\n border-radius: 4px;\n padding: 4px;\n user-select: none;\n}\n.palette.horizontal {\n flex-direction: row;\n}\n\n/* Applied to ineligible tool buttons in the active mode. */\n.ineligibleBtn {\n opacity: 0.35;\n cursor: not-allowed;\n}\n\n.separator {\n background: var(--wzl-border);\n}\n.palette:not(.horizontal) .separator {\n height: 1px;\n margin: 2px 0;\n}\n.palette.horizontal .separator {\n width: 1px;\n margin: 0 2px;\n}\n","import { keyGlyph } from '../Keycaps/keyGlyph';\n\nexport interface ShortcutInput {\n key: string | readonly string[];\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Format a shortcut as an array of display chips, one per key — modifier\n * icons (⌘, ↑, ⌥) followed by the key glyph. UIs that want a boxed\n * per-key look render each chip in its own element. `shift: 'optional'` is\n * treated as falsy. */\nexport function formatShortcutParts(b: ShortcutInput | undefined): readonly string[] | undefined {\n if (!b) return undefined;\n const rawKey = Array.isArray(b.key) ? b.key[0] : (b.key as string);\n const parts: string[] = [];\n if (b.mod) parts.push('⌘');\n if (b.shift === true) parts.push('⇧');\n if (b.alt) parts.push('⌥');\n parts.push(keyGlyph(rawKey));\n return parts;\n}\n\n/** Format a shortcut as a single display string. Order: mod, shift, alt,\n * key. Returns `undefined` for `undefined` input so callers can `??` a\n * fallback. When `key` is an array, the first element is used. `shift: 'optional'`\n * is treated as falsy. */\nexport function formatShortcut(b: ShortcutInput | undefined): string | undefined {\n const parts = formatShortcutParts(b);\n return parts ? parts.join('') : undefined;\n}\n","import { Fragment, useRef, type ReactNode } from 'react';\nimport { UnknownIcon } from '@weasel-js/core';\nimport type { AnyTool, ToolsApi } from '@weasel-js/core';\nimport { eligibleContribution, type ModeRegistry } from '@weasel-js/modes';\nimport { ToolButton } from '../ToolButton';\nimport { ToolGroup } from '../ToolGroup';\nimport s from './ToolPalette.module.css';\nimport { formatShortcut, type ShortcutInput } from './formatShortcut';\n\nconst DEFAULT_GROUP_ORDER = ['select', 'shape', 'draw', 'type', 'view'] as const;\nconst MISC = 'misc';\n\nfunction partitionByGroup(list: AnyTool[]): Map<string, AnyTool[]> {\n const groups = new Map<string, AnyTool[]>();\n for (const tool of list) {\n const g = tool.presentation?.group ?? MISC;\n const bucket = groups.get(g) ?? [];\n bucket.push(tool);\n groups.set(g, bucket);\n }\n return groups;\n}\n\nfunction orderedGroupKeys(\n groups: Map<string, AnyTool[]>,\n groupOrder: readonly string[],\n): string[] {\n const seen = new Set(groups.keys());\n const ordered: string[] = [];\n for (const known of groupOrder) {\n if (seen.has(known)) {\n ordered.push(known);\n seen.delete(known);\n }\n }\n // Unknown groups in insertion order (Map preserves it), misc last.\n for (const key of groups.keys()) {\n if (seen.has(key) && key !== MISC) {\n ordered.push(key);\n seen.delete(key);\n }\n }\n if (seen.has(MISC)) ordered.push(MISC);\n return ordered;\n}\n\nfunction resolveIcon(tool: AnyTool): ReactNode {\n const rawIcon = tool.presentation?.icon;\n if (rawIcon == null) return <UnknownIcon />;\n if (typeof rawIcon === 'function') return rawIcon(undefined);\n return rawIcon;\n}\n\nexport interface ToolPaletteProps {\n tools: ToolsApi;\n orientation?: 'vertical' | 'horizontal';\n className?: string;\n /** Derive the keyboard shortcut for a tool button from the action registry.\n * Called with the tool's id; return `undefined` to suppress a chip. When\n * omitted, falls back to `tool.keybinding` (legacy path). */\n lookupShortcut?: (toolId: string) => ShortcutInput | undefined;\n /**\n * Optional mode registry. When provided, tools whose `capabilities` do not\n * match the current mode are rendered greyed-out, aria-disabled, and their\n * onClick is suppressed. When omitted, all tools are treated as eligible\n * (preserves existing behaviour in consumers that haven't wired a registry).\n */\n modeRegistry?: ModeRegistry;\n /**\n * Presentation-group display order. Groups not listed keep their registry\n * insertion order after the listed ones; `misc` always renders last.\n * Defaults to `['select', 'shape', 'draw', 'type', 'view']`.\n */\n groupOrder?: readonly string[];\n}\n\nexport function ToolPalette(props: ToolPaletteProps) {\n const {\n tools, orientation = 'vertical', className, lookupShortcut, modeRegistry,\n groupOrder = DEFAULT_GROUP_ORDER,\n } = props;\n const list = Object.values(tools.registry);\n const groups = partitionByGroup(list);\n const groupKeys = orderedGroupKeys(groups, groupOrder);\n const cls = [s.palette, orientation === 'horizontal' && s.horizontal, className]\n .filter(Boolean).join(' ');\n\n const orderedIds = groupKeys.flatMap((k) => groups.get(k)!.map((t) => t.id));\n const tabbableId = tools.active && orderedIds.includes(tools.active)\n ? tools.active\n : orderedIds[0];\n const rootRef = useRef<HTMLDivElement | null>(null);\n\n function onKeyDown(e: React.KeyboardEvent<HTMLDivElement>) {\n const target = e.target as HTMLElement;\n if (target.tagName !== 'BUTTON') return;\n const root = rootRef.current;\n if (!root) return;\n const buttons = Array.from(root.querySelectorAll<HTMLButtonElement>('button'));\n const i = buttons.indexOf(target as HTMLButtonElement);\n if (i < 0) return;\n\n let next = -1;\n switch (e.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n next = (i + 1) % buttons.length;\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n next = (i - 1 + buttons.length) % buttons.length;\n break;\n case 'Home':\n next = 0;\n break;\n case 'End':\n next = buttons.length - 1;\n break;\n }\n if (next >= 0) {\n e.preventDefault();\n buttons[next].focus();\n }\n }\n\n return (\n <div\n ref={rootRef}\n className={cls}\n role=\"toolbar\"\n aria-label=\"Tools\"\n onKeyDown={onKeyDown}\n >\n {groupKeys.map((key, i) => (\n <Fragment key={key}>\n {i > 0 && (\n <div\n className={s.separator}\n role=\"separator\"\n aria-orientation={orientation === 'horizontal' ? 'vertical' : 'horizontal'}\n />\n )}\n <ToolGroup orientation={orientation} groupKey={key}>\n {groups.get(key)!.map((tool) => {\n const label = tool.presentation?.label ?? tool.id;\n const shortcut = tool.presentation?.shortcut\n ?? formatShortcut(lookupShortcut ? lookupShortcut(tool.id) : tool.keybinding);\n const enabled = modeRegistry ? eligibleContribution(modeRegistry, tool) : true;\n const modeName = modeRegistry ? modeRegistry.current().id : undefined;\n const resolvedTitle = !enabled && modeName\n ? `${label}${shortcut ? ` (${shortcut})` : ''} — disabled in ${modeName} mode`\n : undefined;\n return (\n <ToolButton\n key={tool.id}\n icon={resolveIcon(tool)}\n label={label}\n shortcut={shortcut}\n active={tools.active === tool.id}\n tabbable={tool.id === tabbableId}\n ariaDisabled={!enabled}\n className={!enabled ? s.ineligibleBtn : undefined}\n title={resolvedTitle}\n onClick={enabled ? () => tools.setActive(tool.id) : () => {}}\n />\n );\n })}\n </ToolGroup>\n </Fragment>\n ))}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;ACaA,SAAgB,EAAoB,GAA6D;AAC/F,KAAI,CAAC,EAAG;CACR,IAAM,IAAS,MAAM,QAAQ,EAAE,IAAI,GAAG,EAAE,IAAI,KAAM,EAAE,KAC9C,IAAkB,EAAE;AAK1B,QAJI,EAA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B,IAAM,IAAQ,EAAK,cAAc,SAAS,EAAK,IACzC,IAAW,EAAK,cAAc,YAC/B,EAAe,IAAiB,EAAe,EAAK,GAAG,GAAG,EAAK,WAAW,EACzE,IAAU,IAAe,EAAqB,GAAc,EAAK,GAAG,IACpE,IAAW,IAAe,EAAa,SAAS,CAAC,KAAK,KAAA,GACtD,IAAgB,CAAC,KAAW,IAC9B,GAAG,IAAQ,IAAW,KAAK,EAAS,KAAK,GAAG,iBAAiB,EAAS,SACtE,KAAA;AACJ,WACE,kBAAC,GAAD;KAEE,MAAM,EAAY,EAAK;KAChB;KACG;KACV,QAAQ,EAAM,WAAW,EAAK;KAC9B,UAAU,EAAK,OAAO;KACtB,cAAc,CAAC;KACf,WAAY,IAA4B,KAAA,IAAlB,EAAE;KACxB,OAAO;KACP,SAAS,UAAgB,EAAM,UAAU,EAAK,GAAG,SAAS;KAC1D,EAVK,EAAK,GAUV;KAEJ;GACQ,CAAA,CACH,EAAA,EAlCI,EAkCJ,CACX;EACE,CAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useRef as e } from "react";
|
|
2
|
+
//#region src/useRovingTabIndex.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
for (let t = 0; t < e.length; t++) if (!e[t].disabled) return t;
|
|
5
|
+
return -1;
|
|
6
|
+
}
|
|
7
|
+
function n(e) {
|
|
8
|
+
for (let t = e.length - 1; t >= 0; t--) if (!e[t].disabled) return t;
|
|
9
|
+
return -1;
|
|
10
|
+
}
|
|
11
|
+
function r(e, t) {
|
|
12
|
+
let n = e.length;
|
|
13
|
+
for (let r = 1; r <= n; r++) {
|
|
14
|
+
let i = (t + r + n) % n;
|
|
15
|
+
if (!e[i].disabled) return i;
|
|
16
|
+
}
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
function i(e, t) {
|
|
20
|
+
let n = e.length;
|
|
21
|
+
for (let r = 1; r <= n; r++) {
|
|
22
|
+
let i = (t - r + n) % n;
|
|
23
|
+
if (!e[i].disabled) return i;
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
27
|
+
function a(a) {
|
|
28
|
+
let { items: o, itemClassName: s, onNavigate: c, onActivate: l } = a, u = e(null), d = a.tabStopIndex ?? t(o), f = (e) => {
|
|
29
|
+
let t = u.current;
|
|
30
|
+
t && t.querySelectorAll(`.${s}`)[e]?.focus();
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
rootRef: u,
|
|
34
|
+
tabIndexFor: (e) => e === d ? 0 : -1,
|
|
35
|
+
onKeyDown: (e) => (a) => {
|
|
36
|
+
let s = -1;
|
|
37
|
+
switch (a.key) {
|
|
38
|
+
case "ArrowLeft":
|
|
39
|
+
case "ArrowUp":
|
|
40
|
+
s = i(o, e);
|
|
41
|
+
break;
|
|
42
|
+
case "ArrowRight":
|
|
43
|
+
case "ArrowDown":
|
|
44
|
+
s = r(o, e);
|
|
45
|
+
break;
|
|
46
|
+
case "Home":
|
|
47
|
+
s = t(o);
|
|
48
|
+
break;
|
|
49
|
+
case "End":
|
|
50
|
+
s = n(o);
|
|
51
|
+
break;
|
|
52
|
+
case " ":
|
|
53
|
+
case "Enter":
|
|
54
|
+
l && (a.preventDefault(), l(e));
|
|
55
|
+
return;
|
|
56
|
+
default: return;
|
|
57
|
+
}
|
|
58
|
+
s < 0 || s === e || (a.preventDefault(), c?.(s), f(s));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { a as t };
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=useRovingTabIndex-DBZtq4IH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRovingTabIndex-DBZtq4IH.js","names":[],"sources":["../../src/useRovingTabIndex.ts"],"sourcesContent":["import { useRef, type KeyboardEvent as ReactKeyboardEvent, type RefObject } from 'react';\n\n/** The only thing the hook needs to know about a bar's items: which are\n * skipped by arrow navigation. */\nexport type RovingItem = { disabled?: boolean };\n\nexport type UseRovingTabIndexOptions = {\n /** In the same order as the elements carrying `itemClassName`. */\n items: readonly RovingItem[];\n /** Class on the focusable element of each item, inside the container the\n * returned `rootRef` is attached to. Their DOM order must match `items`. */\n itemClassName: string;\n /** Index that carries `tabIndex=0`. Defaults to the first enabled item; a\n * radiogroup-style bar passes its selected index so Tab lands on the\n * current value. */\n tabStopIndex?: number;\n /** Called with the new index as arrow/Home/End focus moves, before focus\n * moves. This is where a selection-follows-focus bar commits the value. */\n onNavigate?: (index: number) => void;\n /** Space/Enter on the item at `index`. When omitted the keypress is left\n * alone, which on a native `<button>` produces an ordinary click. */\n onActivate?: (index: number) => void;\n};\n\nexport type RovingTabIndex<T extends HTMLElement = HTMLDivElement> = {\n /** Attach to the container element that holds the items. */\n rootRef: RefObject<T | null>;\n /** `tabIndex` value for the item at `index`. */\n tabIndexFor: (index: number) => 0 | -1;\n /** `onKeyDown` for the item at `index`. */\n onKeyDown: (index: number) => (e: ReactKeyboardEvent<HTMLElement>) => void;\n};\n\nfunction firstEnabledIndex(items: readonly RovingItem[]): number {\n for (let i = 0; i < items.length; i++) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction lastEnabledIndex(items: readonly RovingItem[]): number {\n for (let i = items.length - 1; i >= 0; i--) if (!items[i].disabled) return i;\n return -1;\n}\n\nfunction nextEnabledIndex(items: readonly RovingItem[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from + k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\nfunction prevEnabledIndex(items: readonly RovingItem[], from: number): number {\n const n = items.length;\n for (let k = 1; k <= n; k++) {\n const i = (from - k + n) % n;\n if (!items[i].disabled) return i;\n }\n return from;\n}\n\n/**\n * Roving tabindex for a bar of items: one item is in the tab order, and the\n * arrow keys move focus among the rest, skipping disabled ones and wrapping\n * at both ends. Home and End go to the first and last enabled item. Both axes\n * navigate, so the same bar works laid out either way.\n *\n * Backs `ActionsBar`, `OptionsBar`, and `ToggleBar`.\n *\n * **When a bar should not use this.** Only when the bar owns its items. A\n * container of arbitrary compound controls — a number field, a select, a\n * color field — must leave the arrow keys alone, because those controls edit\n * their own value with them; taking the arrows over would break the control\n * to navigate between controls. `ToolOptionsBar` is that case and keeps plain\n * DOM tab order. A bar whose items are all simple buttons is the case this\n * hook is for.\n *\n * With every item disabled there is no tab stop and the bar drops out of the\n * tab order entirely.\n */\nexport function useRovingTabIndex<T extends HTMLElement = HTMLDivElement>(\n options: UseRovingTabIndexOptions,\n): RovingTabIndex<T> {\n const { items, itemClassName, onNavigate, onActivate } = options;\n const rootRef = useRef<T | null>(null);\n\n const tabStopIndex = options.tabStopIndex ?? firstEnabledIndex(items);\n\n const focusItem = (index: number): void => {\n const root = rootRef.current;\n if (!root) return;\n const elements = root.querySelectorAll<HTMLElement>(`.${itemClassName}`);\n elements[index]?.focus();\n };\n\n const onKeyDown = (index: number) => (e: ReactKeyboardEvent<HTMLElement>): void => {\n let nextIndex = -1;\n switch (e.key) {\n case 'ArrowLeft':\n case 'ArrowUp':\n nextIndex = prevEnabledIndex(items, index);\n break;\n case 'ArrowRight':\n case 'ArrowDown':\n nextIndex = nextEnabledIndex(items, index);\n break;\n case 'Home':\n nextIndex = firstEnabledIndex(items);\n break;\n case 'End':\n nextIndex = lastEnabledIndex(items);\n break;\n case ' ':\n case 'Enter':\n if (onActivate) {\n e.preventDefault();\n onActivate(index);\n }\n return;\n default:\n return;\n }\n if (nextIndex < 0 || nextIndex === index) return;\n e.preventDefault();\n onNavigate?.(nextIndex);\n focusItem(nextIndex);\n };\n\n return {\n rootRef,\n tabIndexFor: (index: number) => (index === tabStopIndex ? 0 : -1),\n onKeyDown,\n };\n}\n"],"mappings":";;AAiCA,SAAS,EAAkB,GAAsC;AAC/D,MAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,IAAK,KAAI,CAAC,EAAM,GAAG,SAAU,QAAO;AACtE,QAAO;;AAGT,SAAS,EAAiB,G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AAa,EAAU,EACvB,EAAU,EAAU;;EAOrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionsBar.d.ts","sourceRoot":"","sources":["../../../src/components/ActionsBar/ActionsBar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionsBar.d.ts","sourceRoot":"","sources":["../../../src/components/ActionsBar/ActionsBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9E,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;IAC/D,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;IAChE,KAAK,EAAE,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CA8CtG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ActionsBar-
|
|
1
|
+
import { t as e } from "../../chunks/ActionsBar-CAjrj_Pt.js";
|
|
2
2
|
export { e as ActionsBar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/Callout-
|
|
1
|
+
import { n as e, t } from "../../chunks/Callout-DlirfLJl.js";
|
|
2
2
|
export { t as Callout, e as CalloutTrigger };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Checkbox-
|
|
1
|
+
import { t as e } from "../../chunks/Checkbox-B3Z_u7k0.js";
|
|
2
2
|
export { e as Checkbox };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ColorField-
|
|
1
|
+
import { t as e } from "../../chunks/ColorField-B4Hd2qqS.js";
|
|
2
2
|
export { e as ColorField };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/ComboBox-
|
|
1
|
+
import { n as e, t } from "../../chunks/ComboBox-tbmgND-F.js";
|
|
2
2
|
export { t as ComboBox, e as ComboBoxItem };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, t as a } from "../../chunks/CurveEditor-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "../../chunks/CurveEditor-CSKqAXMp.js";
|
|
2
2
|
export { n as CurveEditor, i as LayeredCurveEditor, t as createFunctionLayer, a as createSetCurveOp, e as functionLayerState, r as sampleByInterpolation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Dialog-
|
|
1
|
+
import { t as e } from "../../chunks/Dialog-BFuakycR.js";
|
|
2
2
|
export { e as Dialog };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/Field-
|
|
1
|
+
import { n as e, t } from "../../chunks/Field-DPxmJzZz.js";
|
|
2
2
|
export { t as Field, e as fieldClasses };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/GradientEditor-
|
|
1
|
+
import { n as e, t } from "../../chunks/GradientEditor-3pYXGAPg.js";
|
|
2
2
|
export { e as GradientEditor, t as GradientHandles };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Input-
|
|
1
|
+
import { t as e } from "../../chunks/Input-Dg_CYXg4.js";
|
|
2
2
|
export { e as Input };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/NumberField-
|
|
1
|
+
import { t as e } from "../../chunks/NumberField-BhxUgi43.js";
|
|
2
2
|
export { e as NumberField };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsBar.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsBar/OptionsBar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"OptionsBar.d.ts","sourceRoot":"","sources":["../../../src/components/OptionsBar/OptionsBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9E,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;IAC/D,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,CAAC;AACzC,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;IAChE,KAAK,EAAE,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;4EACwE;IACxE,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB;0EACsE;IACtE,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B,CAAC;AAEF,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,YAAY,CAkDtG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/OptionsBar-
|
|
1
|
+
import { t as e } from "../../chunks/OptionsBar-hQN-wfd-.js";
|
|
2
2
|
export { e as OptionsBar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/PointPlotter-
|
|
1
|
+
import { t as e } from "../../chunks/PointPlotter-DCSjvpN0.js";
|
|
2
2
|
export { e as PointPlotter };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "../../chunks/Prefs-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "../../chunks/Prefs-C4HfuTvm.js";
|
|
2
2
|
export { i as PrefsDialog, n as PrefsForm, r as isPrefLeaf, t as prefValueAtPath, e as visiblePrefSubtree };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/RadioGroup-
|
|
1
|
+
import { n as e, t } from "../../chunks/RadioGroup-Bg3Rqxe2.js";
|
|
2
2
|
export { t as Radio, e as RadioGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/RangeSlider-
|
|
1
|
+
import { t as e } from "../../chunks/RangeSlider-BvM_DGSr.js";
|
|
2
2
|
export { e as RangeSlider };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ResizeHandle-
|
|
1
|
+
import { t as e } from "../../chunks/ResizeHandle-BUkW2kZC.js";
|
|
2
2
|
export { e as ResizeHandle };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../chunks/Select-
|
|
1
|
+
import { n as e, t } from "../../chunks/Select-DC0AjrEe.js";
|
|
2
2
|
export { t as Select, e as SelectItem };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../../chunks/SelectionPanel-
|
|
1
|
+
import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../../chunks/SelectionPanel-DoTdisRY.js";
|
|
2
2
|
export { r as MIXED, s as SelectionPanel, a as aggregateValue, n as classifyKind, e as effectiveSections, i as kindBreakdown, o as nodeValueAt, t as setAtPath };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Sidebar-
|
|
1
|
+
import { t as e } from "../../chunks/Sidebar-B8qig3BQ.js";
|
|
2
2
|
export { e as Sidebar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/SidebarPanel-
|
|
1
|
+
import { t as e } from "../../chunks/SidebarPanel-LOt2c-wb.js";
|
|
2
2
|
export { e as SidebarPanel };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../../chunks/StatusBar-
|
|
1
|
+
import { n as e, r as t, t as n } from "../../chunks/StatusBar-Cg2LzdAm.js";
|
|
2
2
|
export { n as StatusBar, e as StatusBarItem, t as StatusBarSpacer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Switch-
|
|
1
|
+
import { t as e } from "../../chunks/Switch-I4putUAY.js";
|
|
2
2
|
export { e as Switch };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "../../chunks/Tabs-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../../chunks/Tabs-irZuG_PN.js";
|
|
2
2
|
export { r as Tab, t as TabList, n as TabPanel, e as Tabs };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "../../chunks/Toast-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "../../chunks/Toast-BGYP8Pw0.js";
|
|
2
2
|
export { n as ToastQueue, i as ToastRegion, r as createToastQueue, t as defaultToastQueue, e as toast };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleBar.d.ts","sourceRoot":"","sources":["../../../src/components/ToggleBar/ToggleBar.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ToggleBar.d.ts","sourceRoot":"","sources":["../../../src/components/ToggleBar/ToggleBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAI9E,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI;IAC9D,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AACxC,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,SAAS,CAAC;AAErD,KAAK,WAAW,GAAG;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;4EACwE;IACxE,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;0EACsE;IACtE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IACzD,CAAC,WAAW,GAAG;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,KAAK,EAAE,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC,GACF,CAAC,WAAW,GAAG;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,SAAS,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IACpB;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;IAC3B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC;CAC/B,CAAC,CAAC;AAEP,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,YAAY,CAqGpG"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ToggleBar-
|
|
1
|
+
import { t as e } from "../../chunks/ToggleBar-BP1zFcvg.js";
|
|
2
2
|
export { e as ToggleBar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ToolButton-
|
|
1
|
+
import { t as e } from "../../chunks/ToolButton-DUeg8fPN.js";
|
|
2
2
|
export { e as ToolButton };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ToolGroup-
|
|
1
|
+
import { t as e } from "../../chunks/ToolGroup-D0CvyQhQ.js";
|
|
2
2
|
export { e as ToolGroup };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/ToolOptionsBar-
|
|
1
|
+
import { t as e } from "../../chunks/ToolOptionsBar-N_MQcSo4.js";
|
|
2
2
|
export { e as ToolOptionsBar };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, r as t, t as n } from "../../chunks/ToolPalette-
|
|
1
|
+
import { n as e, r as t, t as n } from "../../chunks/ToolPalette-BipoMdZz.js";
|
|
2
2
|
export { n as ToolPalette, e as formatShortcut, t as formatShortcutParts };
|
package/dist/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ export type { GradientTrackOpts } from './paintGradientTrack';
|
|
|
43
43
|
export { oklchToHex, chromaAt } from './color/oklch';
|
|
44
44
|
export type { ChromaCurve, ChromaCurvePoint } from './color/oklch';
|
|
45
45
|
export { useReorderDragList } from './useReorderDragList';
|
|
46
|
+
export { useRovingTabIndex } from './useRovingTabIndex';
|
|
47
|
+
export type { RovingItem, RovingTabIndex, UseRovingTabIndexOptions } from './useRovingTabIndex';
|
|
46
48
|
export { formatNumber, MINUS_SIGN } from './format/number';
|
|
47
49
|
export type { LayerListItem, UseReorderDragListOptions, ReorderDragState, ReorderDragHandlers, } from './useReorderDragList';
|
|
48
50
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,c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;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC3D,YAAY,EACV,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,53 +8,54 @@ import { n as u, t as d } from "./chunks/DataGrid-BQklXGRl.js";
|
|
|
8
8
|
import { a as f, i as p, n as m, o as h, r as g, t as _ } from "./chunks/Keycaps-CFX7UAj8.js";
|
|
9
9
|
import { t as v } from "./chunks/keyGlyph-BDH5fqkO.js";
|
|
10
10
|
import { n as y, r as b, t as x } from "./chunks/Slider-Di2kNqVy.js";
|
|
11
|
-
import { t as S } from "./chunks/ToggleBar-
|
|
12
|
-
import { t as C } from "./chunks/
|
|
13
|
-
import { t as w } from "./chunks/
|
|
14
|
-
import { t as T } from "./chunks/
|
|
15
|
-
import { t as E } from "./chunks/
|
|
16
|
-
import { t as D } from "./chunks/
|
|
17
|
-
import { t as O } from "./chunks/
|
|
18
|
-
import {
|
|
19
|
-
import { t as j } from "./chunks/
|
|
20
|
-
import { t as M } from "./chunks/
|
|
21
|
-
import {
|
|
22
|
-
import { t as F } from "./chunks/
|
|
23
|
-
import {
|
|
24
|
-
import { t as R } from "./chunks/
|
|
25
|
-
import {
|
|
26
|
-
import { t as W } from "./chunks/
|
|
27
|
-
import {
|
|
28
|
-
import { t as te } from "./chunks/
|
|
29
|
-
import { t as ne } from "./chunks/
|
|
30
|
-
import { t as re } from "./chunks/
|
|
31
|
-
import {
|
|
32
|
-
import { t as se } from "./chunks/
|
|
33
|
-
import { t as ce } from "./chunks/
|
|
34
|
-
import {
|
|
11
|
+
import { t as S } from "./chunks/ToggleBar-BP1zFcvg.js";
|
|
12
|
+
import { t as C } from "./chunks/useRovingTabIndex-DBZtq4IH.js";
|
|
13
|
+
import { t as w } from "./chunks/OptionsBar-hQN-wfd-.js";
|
|
14
|
+
import { t as T } from "./chunks/ActionsBar-CAjrj_Pt.js";
|
|
15
|
+
import { t as E } from "./chunks/ToolOptionsBar-N_MQcSo4.js";
|
|
16
|
+
import { t as D } from "./chunks/Powerline-DkOTPnUV.js";
|
|
17
|
+
import { t as O } from "./chunks/Checkbox-B3Z_u7k0.js";
|
|
18
|
+
import { t as k } from "./chunks/ColorField-B4Hd2qqS.js";
|
|
19
|
+
import { n as A, t as j } from "./chunks/Field-DPxmJzZz.js";
|
|
20
|
+
import { t as M } from "./chunks/Input-Dg_CYXg4.js";
|
|
21
|
+
import { t as N } from "./chunks/NumberField-BhxUgi43.js";
|
|
22
|
+
import { n as P, t as F } from "./chunks/RadioGroup-Bg3Rqxe2.js";
|
|
23
|
+
import { t as I } from "./chunks/RangeSlider-BvM_DGSr.js";
|
|
24
|
+
import { n as L, t as R } from "./chunks/Select-DC0AjrEe.js";
|
|
25
|
+
import { t as z } from "./chunks/Switch-I4putUAY.js";
|
|
26
|
+
import { a as B, i as V, n as H, r as U, t as W } from "./chunks/Prefs-C4HfuTvm.js";
|
|
27
|
+
import { t as G } from "./chunks/Dialog-BFuakycR.js";
|
|
28
|
+
import { a as K, c as q, i as J, n as Y, o as X, r as Z, s as Q, t as te } from "./chunks/SelectionPanel-DoTdisRY.js";
|
|
29
|
+
import { t as ne } from "./chunks/ResizeHandle-BUkW2kZC.js";
|
|
30
|
+
import { t as re } from "./chunks/Sidebar-B8qig3BQ.js";
|
|
31
|
+
import { t as ie } from "./chunks/SidebarPanel-LOt2c-wb.js";
|
|
32
|
+
import { n as ae, r as oe, t as se } from "./chunks/StatusBar-Cg2LzdAm.js";
|
|
33
|
+
import { t as ce } from "./chunks/ToolButton-DUeg8fPN.js";
|
|
34
|
+
import { t as le } from "./chunks/ToolGroup-D0CvyQhQ.js";
|
|
35
|
+
import { n as ue, r as de, t as fe } from "./chunks/ToolPalette-BipoMdZz.js";
|
|
35
36
|
import "./components/Field/index.js";
|
|
36
|
-
import { i as
|
|
37
|
-
import { n as
|
|
38
|
-
import { n as
|
|
39
|
-
import { a as
|
|
40
|
-
import { a as
|
|
41
|
-
import { t as
|
|
42
|
-
import { n as
|
|
43
|
-
import { oklabToSrgbU8 as
|
|
37
|
+
import { i as pe, n as me, r as he, t as ge } from "./chunks/Tabs-irZuG_PN.js";
|
|
38
|
+
import { n as _e, t as ve } from "./chunks/ComboBox-tbmgND-F.js";
|
|
39
|
+
import { n as ye, t as be } from "./chunks/Callout-DlirfLJl.js";
|
|
40
|
+
import { a as xe, i as Se, n as Ce, r as we, t as Te } from "./chunks/Toast-BGYP8Pw0.js";
|
|
41
|
+
import { a as Ee, i as De, n as $, o as Oe, r as ke, t as Ae } from "./chunks/CurveEditor-CSKqAXMp.js";
|
|
42
|
+
import { t as je } from "./chunks/PointPlotter-DCSjvpN0.js";
|
|
43
|
+
import { n as Me, r as Ne, t as Pe } from "./chunks/GradientEditor-3pYXGAPg.js";
|
|
44
|
+
import { oklabToSrgbU8 as Fe, oklchToOklab as Ie, rgbaToHex as Le } from "@weasel-js/core";
|
|
44
45
|
//#region src/color/oklch.ts
|
|
45
|
-
function
|
|
46
|
-
let [r, i, a] =
|
|
47
|
-
return
|
|
46
|
+
function Re(e, t, n) {
|
|
47
|
+
let [r, i, a] = Ie(e, t, n * Math.PI / 180), [o, s, c] = Fe(r, i, a);
|
|
48
|
+
return Le([
|
|
48
49
|
o / 255,
|
|
49
50
|
s / 255,
|
|
50
51
|
c / 255
|
|
51
52
|
]);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function ze(e, t) {
|
|
54
55
|
let [n, r] = t.lRange;
|
|
55
56
|
return e <= n ? t.cBot : e >= r ? t.cTop : e <= t.midL ? t.cBot + (t.cPeak - t.cBot) * ((e - n) / (t.midL - n)) : t.cPeak + (t.cTop - t.cPeak) * ((e - t.midL) / (r - t.midL));
|
|
56
57
|
}
|
|
57
58
|
//#endregion
|
|
58
|
-
export { s as ActionBar,
|
|
59
|
+
export { s as ActionBar, T as ActionsBar, ee as Badge, l as Button, be as Callout, ye as CalloutTrigger, O as Checkbox, k as ColorField, ve as ComboBox, _e as ComboBoxItem, $ as CurveEditor, d as DataGrid, G as Dialog, c as EDGE_PROFILES, j as Field, Me as GradientEditor, Pe as GradientHandles, M as Input, f as KeyCap, p as KeySequence, ke as LayeredCurveEditor, y as MINUS_SIGN, Y as MIXED, N as NumberField, w as OptionsBar, i as Plot2D, je as PointPlotter, D as Powerline, W as PrefsDialog, H as PrefsForm, F as Radio, P as RadioGroup, I as RangeSlider, ne as ResizeHandle, R as Select, L as SelectItem, te as SelectionPanel, re as Sidebar, ie as SidebarPanel, x as Slider, se as StatusBar, ae as StatusBarItem, oe as StatusBarSpacer, z as Switch, ge as Tab, me as TabList, he as TabPanel, pe as Tabs, Ce as ToastQueue, Te as ToastRegion, S as ToggleBar, ce as ToolButton, le as ToolGroup, E as ToolOptionsBar, fe as ToolPalette, o as Tooltip, a as TooltipTrigger, Z as aggregateValue, ze as chromaAt, J as classifyKind, De as createFunctionLayer, Ae as createSetCurveOp, we as createToastQueue, Se as defaultToastQueue, _ as detectPlatform, t as dlog, K as effectiveSections, A as fieldClasses, b as formatNumber, ue as formatShortcut, de as formatShortcutParts, Ee as functionLayerState, h as inferKeycapKind, e as isDebugEnabled, U as isPrefLeaf, v as keyGlyph, m as keySpecFromKey, g as keySpecsFromMods, X as kindBreakdown, n as modelToPlot, Q as nodeValueAt, Re as oklchToHex, Ne as paintGradientTrack, r as plotToModel, V as prefValueAtPath, Oe as sampleByInterpolation, q as setAtPath, xe as toast, u as useReorderDragList, C as useRovingTabIndex, B as visiblePrefSubtree };
|
|
59
60
|
|
|
60
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/color/oklch.ts"],"sourcesContent":["// OKLCH math from Björn Ottosson: https://bottosson.github.io/posts/oklab/\nimport { oklchToOklab, oklabToSrgbU8, rgbaToHex } from '@weasel-js/core';\n\nexport type ChromaCurve = {\n lRange: [number, number];\n midL: number;\n cBot: number;\n cPeak: number;\n cTop: number;\n};\n\nexport type ChromaCurvePoint = { L: number; C: number };\n\nexport function oklchToHex(L: number, C: number, Hdeg: number): string {\n // Delegate to the kit's OKLab pipeline (kit angle unit is radians) →\n // gamut-clipped u8 sRGB → `#rrggbb`.\n const [l, a, b] = oklchToOklab(L, C, (Hdeg * Math.PI) / 180);\n const [r, g, bl] = oklabToSrgbU8(l, a, b);\n return rgbaToHex([r / 255, g / 255, bl / 255]);\n}\n\nexport function chromaAt(L: number, curve: ChromaCurve): number {\n const [lo, hi] = curve.lRange;\n if (L <= lo) return curve.cBot;\n if (L >= hi) return curve.cTop;\n if (L <= curve.midL) return curve.cBot + (curve.cPeak - curve.cBot) * ((L - lo) / (curve.midL - lo));\n return curve.cPeak + (curve.cTop - curve.cPeak) * ((L - curve.midL) / (hi - curve.midL));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/color/oklch.ts"],"sourcesContent":["// OKLCH math from Björn Ottosson: https://bottosson.github.io/posts/oklab/\nimport { oklchToOklab, oklabToSrgbU8, rgbaToHex } from '@weasel-js/core';\n\nexport type ChromaCurve = {\n lRange: [number, number];\n midL: number;\n cBot: number;\n cPeak: number;\n cTop: number;\n};\n\nexport type ChromaCurvePoint = { L: number; C: number };\n\nexport function oklchToHex(L: number, C: number, Hdeg: number): string {\n // Delegate to the kit's OKLab pipeline (kit angle unit is radians) →\n // gamut-clipped u8 sRGB → `#rrggbb`.\n const [l, a, b] = oklchToOklab(L, C, (Hdeg * Math.PI) / 180);\n const [r, g, bl] = oklabToSrgbU8(l, a, b);\n return rgbaToHex([r / 255, g / 255, bl / 255]);\n}\n\nexport function chromaAt(L: number, curve: ChromaCurve): number {\n const [lo, hi] = curve.lRange;\n if (L <= lo) return curve.cBot;\n if (L >= hi) return curve.cTop;\n if (L <= curve.midL) return curve.cBot + (curve.cPeak - curve.cBot) * ((L - lo) / (curve.midL - lo));\n return curve.cPeak + (curve.cTop - curve.cPeak) * ((L - curve.midL) / (hi - curve.midL));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAgB,GAAW,GAAW,GAAW,GAAsB;CAGrE,IAAM,CAAC,GAAG,GAAG,KAAK,GAAa,GAAG,GAAI,IAAO,KAAK,KAAM,IAAI,EACtD,CAAC,GAAG,GAAG,KAAM,GAAc,GAAG,GAAG,EAAE;AACzC,QAAO,GAAU;EAAC,IAAI;EAAK,IAAI;EAAK,IAAK;EAAI,CAAC;;AAGhD,SAAgB,GAAS,GAAW,GAA4B;CAC9D,IAAM,CAAC,GAAI,KAAM,EAAM;AAIvB,QAHI,KAAK,IAAW,EAAM,OACtB,KAAK,IAAW,EAAM,OACtB,KAAK,EAAM,OAAa,EAAM,QAAQ,EAAM,QAAQ,EAAM,UAAU,IAAI,MAAO,EAAM,OAAO,MACzF,EAAM,SAAS,EAAM,OAAO,EAAM,WAAW,IAAI,EAAM,SAAS,IAAK,EAAM"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type KeyboardEvent as ReactKeyboardEvent, type RefObject } from 'react';
|
|
2
|
+
/** The only thing the hook needs to know about a bar's items: which are
|
|
3
|
+
* skipped by arrow navigation. */
|
|
4
|
+
export type RovingItem = {
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type UseRovingTabIndexOptions = {
|
|
8
|
+
/** In the same order as the elements carrying `itemClassName`. */
|
|
9
|
+
items: readonly RovingItem[];
|
|
10
|
+
/** Class on the focusable element of each item, inside the container the
|
|
11
|
+
* returned `rootRef` is attached to. Their DOM order must match `items`. */
|
|
12
|
+
itemClassName: string;
|
|
13
|
+
/** Index that carries `tabIndex=0`. Defaults to the first enabled item; a
|
|
14
|
+
* radiogroup-style bar passes its selected index so Tab lands on the
|
|
15
|
+
* current value. */
|
|
16
|
+
tabStopIndex?: number;
|
|
17
|
+
/** Called with the new index as arrow/Home/End focus moves, before focus
|
|
18
|
+
* moves. This is where a selection-follows-focus bar commits the value. */
|
|
19
|
+
onNavigate?: (index: number) => void;
|
|
20
|
+
/** Space/Enter on the item at `index`. When omitted the keypress is left
|
|
21
|
+
* alone, which on a native `<button>` produces an ordinary click. */
|
|
22
|
+
onActivate?: (index: number) => void;
|
|
23
|
+
};
|
|
24
|
+
export type RovingTabIndex<T extends HTMLElement = HTMLDivElement> = {
|
|
25
|
+
/** Attach to the container element that holds the items. */
|
|
26
|
+
rootRef: RefObject<T | null>;
|
|
27
|
+
/** `tabIndex` value for the item at `index`. */
|
|
28
|
+
tabIndexFor: (index: number) => 0 | -1;
|
|
29
|
+
/** `onKeyDown` for the item at `index`. */
|
|
30
|
+
onKeyDown: (index: number) => (e: ReactKeyboardEvent<HTMLElement>) => void;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Roving tabindex for a bar of items: one item is in the tab order, and the
|
|
34
|
+
* arrow keys move focus among the rest, skipping disabled ones and wrapping
|
|
35
|
+
* at both ends. Home and End go to the first and last enabled item. Both axes
|
|
36
|
+
* navigate, so the same bar works laid out either way.
|
|
37
|
+
*
|
|
38
|
+
* Backs `ActionsBar`, `OptionsBar`, and `ToggleBar`.
|
|
39
|
+
*
|
|
40
|
+
* **When a bar should not use this.** Only when the bar owns its items. A
|
|
41
|
+
* container of arbitrary compound controls — a number field, a select, a
|
|
42
|
+
* color field — must leave the arrow keys alone, because those controls edit
|
|
43
|
+
* their own value with them; taking the arrows over would break the control
|
|
44
|
+
* to navigate between controls. `ToolOptionsBar` is that case and keeps plain
|
|
45
|
+
* DOM tab order. A bar whose items are all simple buttons is the case this
|
|
46
|
+
* hook is for.
|
|
47
|
+
*
|
|
48
|
+
* With every item disabled there is no tab stop and the bar drops out of the
|
|
49
|
+
* tab order entirely.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useRovingTabIndex<T extends HTMLElement = HTMLDivElement>(options: UseRovingTabIndexOptions): RovingTabIndex<T>;
|
|
52
|
+
//# sourceMappingURL=useRovingTabIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRovingTabIndex.d.ts","sourceRoot":"","sources":["../src/useRovingTabIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,aAAa,IAAI,kBAAkB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzF;mCACmC;AACnC,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG;IACrC,kEAAkE;IAClE,KAAK,EAAE,SAAS,UAAU,EAAE,CAAC;IAC7B;iFAC6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB;;yBAEqB;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;gFAC4E;IAC5E,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC;0EACsE;IACtE,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc,IAAI;IACnE,4DAA4D;IAC5D,OAAO,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7B,gDAAgD;IAChD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACvC,2CAA2C;IAC3C,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAC5E,CAAC;AA8BF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc,EACtE,OAAO,EAAE,wBAAwB,GAChC,cAAc,CAAC,CAAC,CAAC,CAmDnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "UI chrome primitives for weasel apps (properties panel, etc.)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"./package.json": "./package.json"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@weasel-js/modes": "1.0.
|
|
26
|
+
"@weasel-js/modes": "1.0.1",
|
|
27
27
|
"react-aria-components": "^1.5.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|