@cloudvoyant/helical-ui 0.21.1 → 0.22.0-rc.202611080958.2b01f13
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/index.cjs +1488 -155
- package/dist/index.d.cts +328 -15
- package/dist/index.d.ts +328 -15
- package/dist/index.js +1870 -155
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -45,6 +46,7 @@ __export(index_exports, {
|
|
|
45
46
|
THEMES: () => THEMES,
|
|
46
47
|
THEME_NAMES: () => THEME_NAMES,
|
|
47
48
|
TitleHeading: () => TitleHeading,
|
|
49
|
+
announceCommandMessage: () => announceCommandMessage,
|
|
48
50
|
badgeVariants: () => badgeVariants,
|
|
49
51
|
buildChartDefinition: () => buildChartDefinition,
|
|
50
52
|
buildExtensions: () => buildExtensions,
|
|
@@ -80,6 +82,15 @@ __export(index_exports, {
|
|
|
80
82
|
codeBlockSpinnerBase: () => codeBlockSpinnerBase,
|
|
81
83
|
codeBlockTitleBase: () => codeBlockTitleBase,
|
|
82
84
|
colBase: () => colBase,
|
|
85
|
+
colonCommandDialogContentBase: () => colonCommandDialogContentBase,
|
|
86
|
+
colonCommandErrorBase: () => colonCommandErrorBase,
|
|
87
|
+
colonCommandInputVariants: () => colonCommandInputVariants,
|
|
88
|
+
colonCommandItemVariants: () => colonCommandItemVariants,
|
|
89
|
+
colonCommandListVariants: () => colonCommandListVariants,
|
|
90
|
+
colonCommandPositionerBase: () => colonCommandPositionerBase,
|
|
91
|
+
colonCommandPrefixBase: () => colonCommandPrefixBase,
|
|
92
|
+
colonCommandPromptBarVariants: () => colonCommandPromptBarVariants,
|
|
93
|
+
colonCommandVariants: () => colonCommandVariants,
|
|
83
94
|
comboboxClearTriggerBase: () => comboboxClearTriggerBase,
|
|
84
95
|
comboboxContentBase: () => comboboxContentBase,
|
|
85
96
|
comboboxControlBase: () => comboboxControlBase,
|
|
@@ -91,8 +102,27 @@ __export(index_exports, {
|
|
|
91
102
|
comboboxListBase: () => comboboxListBase,
|
|
92
103
|
comboboxPositionerBase: () => comboboxPositionerBase,
|
|
93
104
|
comboboxTriggerBase: () => comboboxTriggerBase,
|
|
105
|
+
commandMenuDialogContentBase: () => commandMenuDialogContentBase,
|
|
106
|
+
commandMenuErrorBase: () => commandMenuErrorBase,
|
|
107
|
+
commandMenuInputVariants: () => commandMenuInputVariants,
|
|
108
|
+
commandMenuItemVariants: () => commandMenuItemVariants,
|
|
109
|
+
commandMenuListVariants: () => commandMenuListVariants,
|
|
110
|
+
commandMenuPositionerBase: () => commandMenuPositionerBase,
|
|
111
|
+
commandMenuPrefixBase: () => commandMenuPrefixBase,
|
|
112
|
+
commandMenuPromptBarVariants: () => commandMenuPromptBarVariants,
|
|
113
|
+
commandMenuVariants: () => commandMenuVariants,
|
|
114
|
+
commandPaletteBreadcrumbBase: () => commandPaletteBreadcrumbBase,
|
|
115
|
+
commandPaletteDialogContentBase: () => commandPaletteDialogContentBase,
|
|
116
|
+
commandPaletteFooterBase: () => commandPaletteFooterBase,
|
|
117
|
+
commandPaletteHeaderBase: () => commandPaletteHeaderBase,
|
|
118
|
+
commandPaletteInputBase: () => commandPaletteInputBase,
|
|
119
|
+
commandPaletteItemBase: () => commandPaletteItemBase,
|
|
120
|
+
commandPaletteListBase: () => commandPaletteListBase,
|
|
121
|
+
commandPalettePositionerBase: () => commandPalettePositionerBase,
|
|
122
|
+
commandPaletteVariants: () => commandPaletteVariants,
|
|
94
123
|
containerBase: () => containerBase,
|
|
95
124
|
createCodeBlockCustom: () => createCodeBlockCustom,
|
|
125
|
+
createCommandTree: () => createCommandTree,
|
|
96
126
|
createHelixPreset: () => createHelixPreset,
|
|
97
127
|
createImageNode: () => createImageNode,
|
|
98
128
|
createInternalMention: () => createInternalMention,
|
|
@@ -137,9 +167,12 @@ __export(index_exports, {
|
|
|
137
167
|
findDirectionalPane: () => findDirectionalPane,
|
|
138
168
|
findEditorScrollContainer: () => findEditorScrollContainer,
|
|
139
169
|
flattenKeymapEntries: () => flattenKeymapEntries,
|
|
170
|
+
formatColonCompletionInput: () => formatColonCompletionInput,
|
|
171
|
+
formatCommandMenuCompletionInput: () => formatCommandMenuCompletionInput,
|
|
140
172
|
formatKeyChord: () => formatKeyChord,
|
|
141
173
|
formatKeySequence: () => formatKeySequence,
|
|
142
174
|
formatTime: () => formatTime,
|
|
175
|
+
formatWhichKeyLabel: () => formatWhichKeyLabel,
|
|
143
176
|
generateJumpLabels: () => generateJumpLabels,
|
|
144
177
|
getDocumentWhichKeyController: () => getDocumentWhichKeyController,
|
|
145
178
|
getEditorModalTarget: () => getEditorModalTarget,
|
|
@@ -147,9 +180,11 @@ __export(index_exports, {
|
|
|
147
180
|
getNodeChildren: () => getNodeChildren,
|
|
148
181
|
getPresetKeymap: () => getPresetKeymap,
|
|
149
182
|
hstackBase: () => hstackBase,
|
|
183
|
+
inferPlatform: () => inferPlatform,
|
|
150
184
|
injectCodeBlockStyles: () => injectCodeBlockStyles,
|
|
151
185
|
inputVariants: () => inputVariants,
|
|
152
186
|
insertPastedUrlAsLink: () => insertPastedUrlAsLink,
|
|
187
|
+
isChordCommandString: () => isChordCommandString,
|
|
153
188
|
isEditorInInsertMode: () => isEditorInInsertMode,
|
|
154
189
|
isGroupNode: () => isGroupNode,
|
|
155
190
|
itemVariants: () => itemVariants,
|
|
@@ -179,6 +214,7 @@ __export(index_exports, {
|
|
|
179
214
|
manimPlaceholderBase: () => manimPlaceholderBase,
|
|
180
215
|
manimPlaceholderLabelBase: () => manimPlaceholderLabelBase,
|
|
181
216
|
manimRootBase: () => manimRootBase,
|
|
217
|
+
matchesCommandHotkey: () => matchesCommandHotkey,
|
|
182
218
|
mermaidLoadingBase: () => mermaidLoadingBase,
|
|
183
219
|
mermaidRootBase: () => mermaidRootBase,
|
|
184
220
|
mermaidSourceBase: () => mermaidSourceBase,
|
|
@@ -214,6 +250,7 @@ __export(index_exports, {
|
|
|
214
250
|
navbarShrunkBase: () => navbarShrunkBase,
|
|
215
251
|
navbarTriggerVariants: () => navbarTriggerVariants,
|
|
216
252
|
navbarVariants: () => navbarVariants,
|
|
253
|
+
nodeExplicitlyIncludesMode: () => nodeExplicitlyIncludesMode,
|
|
217
254
|
nodeMatchesMode: () => nodeMatchesMode,
|
|
218
255
|
normalizeNodeModes: () => normalizeNodeModes,
|
|
219
256
|
noticeDescriptionBase: () => noticeDescriptionBase,
|
|
@@ -280,6 +317,14 @@ __export(index_exports, {
|
|
|
280
317
|
renderChartSvgString: () => renderChartSvgString,
|
|
281
318
|
renderCodeToHtml: () => renderCodeToHtml,
|
|
282
319
|
renderMermaidSource: () => renderMermaidSource,
|
|
320
|
+
resolveColonCommandGridNavigation: () => resolveColonCommandGridNavigation,
|
|
321
|
+
resolveColonCommandGridStyle: () => resolveColonCommandGridStyle,
|
|
322
|
+
resolveColonCommandState: () => resolveColonCommandState,
|
|
323
|
+
resolveCommandLevel: () => resolveCommandLevel,
|
|
324
|
+
resolveCommandMenuGridNavigation: () => resolveCommandMenuGridNavigation,
|
|
325
|
+
resolveCommandMenuGridStyle: () => resolveCommandMenuGridStyle,
|
|
326
|
+
resolveCommandMenuState: () => resolveCommandMenuState,
|
|
327
|
+
resolveKbdSteps: () => resolveKbdSteps,
|
|
283
328
|
resolveMermaidThemeVariables: () => resolveMermaidThemeVariables,
|
|
284
329
|
resolveNode: () => resolveNode,
|
|
285
330
|
revealChevronBase: () => revealChevronBase,
|
|
@@ -303,9 +348,11 @@ __export(index_exports, {
|
|
|
303
348
|
selectPositionerBase: () => selectPositionerBase,
|
|
304
349
|
selectTriggerBase: () => selectTriggerBase,
|
|
305
350
|
selectValueBase: () => selectValueBase,
|
|
351
|
+
shouldHandleCommandHotkey: () => shouldHandleCommandHotkey,
|
|
306
352
|
sidebarMenuButtonVariants: () => sidebarMenuButtonVariants,
|
|
307
353
|
sidebarStyles: () => sidebarStyles,
|
|
308
354
|
slashCommands: () => slashCommands,
|
|
355
|
+
splitHighlightSegments: () => splitHighlightSegments,
|
|
309
356
|
splitterPanelBase: () => splitterPanelBase,
|
|
310
357
|
splitterResizeTriggerBase: () => splitterResizeTriggerBase,
|
|
311
358
|
splitterResizeTriggerIndicatorBase: () => splitterResizeTriggerIndicatorBase,
|
|
@@ -334,6 +381,13 @@ __export(index_exports, {
|
|
|
334
381
|
tagsInputRootBase: () => tagsInputRootBase,
|
|
335
382
|
textareaBase: () => textareaBase,
|
|
336
383
|
toLaTeX: () => toLaTeX,
|
|
384
|
+
toastActionTriggerBase: () => toastActionTriggerBase,
|
|
385
|
+
toastCloseTriggerBase: () => toastCloseTriggerBase,
|
|
386
|
+
toastDescriptionBase: () => toastDescriptionBase,
|
|
387
|
+
toastIconBase: () => toastIconBase,
|
|
388
|
+
toastTitleBase: () => toastTitleBase,
|
|
389
|
+
toastVariants: () => toastVariants,
|
|
390
|
+
toasterBase: () => toasterBase,
|
|
337
391
|
toggleButtonVariants: () => toggleButtonVariants,
|
|
338
392
|
toggleGroupRootVariants: () => toggleGroupRootVariants,
|
|
339
393
|
tooltipArrowBase: () => tooltipArrowBase,
|
|
@@ -341,6 +395,8 @@ __export(index_exports, {
|
|
|
341
395
|
tooltipPositionerBase: () => tooltipPositionerBase,
|
|
342
396
|
unregisterImageInsertCallback: () => unregisterImageInsertCallback,
|
|
343
397
|
unregisterYouTubeInsertCallback: () => unregisterYouTubeInsertCallback,
|
|
398
|
+
validateKbdChord: () => validateKbdChord,
|
|
399
|
+
validateKbdHotkey: () => validateKbdHotkey,
|
|
344
400
|
vstackBase: () => vstackBase,
|
|
345
401
|
whichKeyBodyVariants: () => whichKeyBodyVariants,
|
|
346
402
|
whichKeyBreadcrumbBase: () => whichKeyBreadcrumbBase,
|
|
@@ -1604,30 +1660,115 @@ var kbdVariants = (0, import_class_variance_authority19.cva)(
|
|
|
1604
1660
|
sm: "min-h-4 min-w-4 px-1 py-0.5 text-[10px]",
|
|
1605
1661
|
md: "min-h-5 min-w-5 px-1.5 py-0.5 text-xs",
|
|
1606
1662
|
lg: "min-h-6 min-w-6 px-2 py-1 text-sm"
|
|
1663
|
+
},
|
|
1664
|
+
invalid: {
|
|
1665
|
+
true: "border-destructive/70 bg-destructive/10 text-destructive line-through decoration-destructive/70",
|
|
1666
|
+
false: ""
|
|
1607
1667
|
}
|
|
1608
1668
|
},
|
|
1609
1669
|
defaultVariants: {
|
|
1610
1670
|
variant: "outline",
|
|
1611
|
-
size: "md"
|
|
1671
|
+
size: "md",
|
|
1672
|
+
invalid: false
|
|
1612
1673
|
}
|
|
1613
1674
|
}
|
|
1614
1675
|
);
|
|
1615
1676
|
var kbdGroupBase = "inline-flex items-center gap-1";
|
|
1616
1677
|
var KEY_LABEL_OVERRIDES = {
|
|
1617
1678
|
Space: "Space",
|
|
1679
|
+
Spacebar: "Space",
|
|
1618
1680
|
" ": "Space",
|
|
1619
1681
|
Escape: "Esc",
|
|
1682
|
+
Esc: "Esc",
|
|
1620
1683
|
Backspace: "\u232B",
|
|
1684
|
+
Delete: "\u2326",
|
|
1685
|
+
Del: "\u2326",
|
|
1621
1686
|
Enter: "\u21B5",
|
|
1687
|
+
Return: "\u21B5",
|
|
1688
|
+
Tab: "Tab",
|
|
1622
1689
|
ArrowUp: "\u2191",
|
|
1623
1690
|
ArrowDown: "\u2193",
|
|
1624
1691
|
ArrowLeft: "\u2190",
|
|
1625
1692
|
ArrowRight: "\u2192"
|
|
1626
1693
|
};
|
|
1694
|
+
var ALL_KEYS_SET = import_hotkeys.ALL_KEYS;
|
|
1695
|
+
function isKnownSingleKey(keyPart) {
|
|
1696
|
+
if (!keyPart) return false;
|
|
1697
|
+
if (Object.hasOwn(KEY_LABEL_OVERRIDES, keyPart)) return true;
|
|
1698
|
+
if (ALL_KEYS_SET.has(keyPart)) return true;
|
|
1699
|
+
if (keyPart.length === 1 && ALL_KEYS_SET.has((0, import_hotkeys.normalizeKeyName)(keyPart))) return true;
|
|
1700
|
+
if (/^\[[A-Za-z][A-Za-z0-9]*\]$/.test(keyPart)) {
|
|
1701
|
+
return (0, import_hotkeys.validateHotkey)(keyPart).valid;
|
|
1702
|
+
}
|
|
1703
|
+
return false;
|
|
1704
|
+
}
|
|
1705
|
+
function inferPlatform() {
|
|
1706
|
+
const hint = typeof navigator !== "undefined" ? `${navigator.platform ?? ""} ${navigator.userAgent ?? ""}`.trim() : void 0;
|
|
1707
|
+
return (0, import_hotkeys.detectPlatform)(hint || void 0);
|
|
1708
|
+
}
|
|
1709
|
+
function validateKbdChord(chord) {
|
|
1710
|
+
const trimmed = chord.trim();
|
|
1711
|
+
if (!trimmed) {
|
|
1712
|
+
return { valid: false, warnings: [], errors: ["Hotkey cannot be empty"] };
|
|
1713
|
+
}
|
|
1714
|
+
if (trimmed.length > 1 && (trimmed.startsWith("+") || /[^+]\+$/.test(trimmed) || trimmed.includes("++") && !trimmed.endsWith("++"))) {
|
|
1715
|
+
return {
|
|
1716
|
+
valid: false,
|
|
1717
|
+
warnings: [],
|
|
1718
|
+
errors: [`Invalid hotkey format in '${trimmed}': empty modifier or key part`]
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
const baseResult = (0, import_hotkeys.validateHotkey)(trimmed);
|
|
1722
|
+
if (!baseResult.valid) {
|
|
1723
|
+
return baseResult;
|
|
1724
|
+
}
|
|
1725
|
+
if (trimmed.includes("+") && trimmed.length > 1) {
|
|
1726
|
+
if (!(0, import_hotkeys.hasNonModifierKey)(trimmed)) {
|
|
1727
|
+
return {
|
|
1728
|
+
valid: false,
|
|
1729
|
+
warnings: baseResult.warnings,
|
|
1730
|
+
errors: [...baseResult.errors, `Modifier-only chord '${trimmed}' is missing an action key`]
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
const rawParts = trimmed.endsWith("++") ? [...trimmed.slice(0, -2).split("+"), "+"] : trimmed.split("+");
|
|
1734
|
+
const keyPart = rawParts[rawParts.length - 1]?.trim() ?? "";
|
|
1735
|
+
if (!isKnownSingleKey(keyPart)) {
|
|
1736
|
+
return {
|
|
1737
|
+
valid: false,
|
|
1738
|
+
warnings: baseResult.warnings,
|
|
1739
|
+
errors: [...baseResult.errors, `Unknown key: '${keyPart}'`]
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
return baseResult;
|
|
1743
|
+
}
|
|
1744
|
+
if (trimmed.length === 1 || isKnownSingleKey(trimmed) || (0, import_hotkeys.isModifierKey)(trimmed)) {
|
|
1745
|
+
return baseResult;
|
|
1746
|
+
}
|
|
1747
|
+
return {
|
|
1748
|
+
valid: false,
|
|
1749
|
+
warnings: baseResult.warnings,
|
|
1750
|
+
errors: [...baseResult.errors, `Unknown key: '${trimmed}'`]
|
|
1751
|
+
};
|
|
1752
|
+
}
|
|
1753
|
+
function validateKbdHotkey(hotkey) {
|
|
1754
|
+
const rawSteps = Array.isArray(hotkey) ? hotkey : typeof hotkey === "string" ? hotkey.trim().split(/\s+/).filter(Boolean) : [];
|
|
1755
|
+
if (rawSteps.length === 0) {
|
|
1756
|
+
return { valid: false, warnings: [], errors: ["Hotkey cannot be empty"] };
|
|
1757
|
+
}
|
|
1758
|
+
if (rawSteps.length === 1) {
|
|
1759
|
+
return validateKbdChord(rawSteps[0]);
|
|
1760
|
+
}
|
|
1761
|
+
const results = rawSteps.map((step) => validateKbdChord(step));
|
|
1762
|
+
return {
|
|
1763
|
+
valid: results.every((r) => r.valid),
|
|
1764
|
+
warnings: results.flatMap((r, idx) => r.warnings.map((w) => `Step ${idx + 1}: ${w}`)),
|
|
1765
|
+
errors: results.flatMap((r, idx) => r.errors.map((e) => `Step ${idx + 1}: ${e}`))
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1627
1768
|
function formatKeyChord(chord, options) {
|
|
1628
1769
|
const trimmed = chord.trim();
|
|
1629
1770
|
if (!trimmed) return "";
|
|
1630
|
-
if (KEY_LABEL_OVERRIDES
|
|
1771
|
+
if (Object.hasOwn(KEY_LABEL_OVERRIDES, trimmed)) {
|
|
1631
1772
|
return KEY_LABEL_OVERRIDES[trimmed];
|
|
1632
1773
|
}
|
|
1633
1774
|
if (trimmed.length === 1) {
|
|
@@ -1636,9 +1777,13 @@ function formatKeyChord(chord, options) {
|
|
|
1636
1777
|
if (/^Shift\+([a-zA-Z])$/.test(trimmed)) {
|
|
1637
1778
|
return trimmed.slice(-1).toUpperCase();
|
|
1638
1779
|
}
|
|
1780
|
+
const validation = validateKbdChord(trimmed);
|
|
1781
|
+
if (!validation.valid) {
|
|
1782
|
+
return trimmed;
|
|
1783
|
+
}
|
|
1639
1784
|
try {
|
|
1640
1785
|
const formatted = (0, import_hotkeys.formatForDisplay)(trimmed, {
|
|
1641
|
-
platform:
|
|
1786
|
+
platform: inferPlatform(),
|
|
1642
1787
|
useSymbols: options?.useSymbols ?? true
|
|
1643
1788
|
});
|
|
1644
1789
|
return formatted || trimmed;
|
|
@@ -1647,9 +1792,772 @@ function formatKeyChord(chord, options) {
|
|
|
1647
1792
|
}
|
|
1648
1793
|
}
|
|
1649
1794
|
function formatKeySequence(hotkey, options) {
|
|
1650
|
-
const steps =
|
|
1795
|
+
const steps = typeof hotkey === "string" ? hotkey.trim().split(/\s+/).filter(Boolean) : hotkey;
|
|
1651
1796
|
return steps.map((step) => formatKeyChord(step, options));
|
|
1652
1797
|
}
|
|
1798
|
+
function resolveKbdSteps(hotkey, options) {
|
|
1799
|
+
const rawSteps = Array.isArray(hotkey) ? [...hotkey] : typeof hotkey === "string" ? hotkey.trim().split(/\s+/).filter(Boolean) : [];
|
|
1800
|
+
if (rawSteps.length === 0) {
|
|
1801
|
+
const msg = "Hotkey cannot be empty";
|
|
1802
|
+
if (options?.warn !== false) {
|
|
1803
|
+
console.warn(`[helical-ui/Kbd] Invalid hotkey "${String(hotkey)}": ${msg}`);
|
|
1804
|
+
}
|
|
1805
|
+
return {
|
|
1806
|
+
steps: [{ raw: "", label: "?", valid: false, errors: [msg], warnings: [] }],
|
|
1807
|
+
valid: false,
|
|
1808
|
+
message: msg
|
|
1809
|
+
};
|
|
1810
|
+
}
|
|
1811
|
+
const steps = rawSteps.map((raw) => {
|
|
1812
|
+
const validation = validateKbdChord(raw);
|
|
1813
|
+
const label = validation.valid ? formatKeyChord(raw, options) : raw.trim() || "?";
|
|
1814
|
+
return {
|
|
1815
|
+
raw,
|
|
1816
|
+
label,
|
|
1817
|
+
valid: validation.valid,
|
|
1818
|
+
errors: validation.errors,
|
|
1819
|
+
warnings: validation.warnings
|
|
1820
|
+
};
|
|
1821
|
+
});
|
|
1822
|
+
const valid = steps.every((s) => s.valid);
|
|
1823
|
+
const allMessages = steps.flatMap((s, idx) => {
|
|
1824
|
+
const prefix = steps.length > 1 ? `Step ${idx + 1} (${s.raw}): ` : "";
|
|
1825
|
+
return [...s.errors, ...s.warnings].map((m) => `${prefix}${m}`);
|
|
1826
|
+
});
|
|
1827
|
+
const message = allMessages.length > 0 ? allMessages.join("; ") : void 0;
|
|
1828
|
+
if (!valid && options?.warn !== false) {
|
|
1829
|
+
const rawDisplay = Array.isArray(hotkey) ? hotkey.join(" ") : hotkey;
|
|
1830
|
+
console.warn(`[helical-ui/Kbd] Invalid hotkey "${rawDisplay}": ${message}`);
|
|
1831
|
+
}
|
|
1832
|
+
return { steps, valid, message };
|
|
1833
|
+
}
|
|
1834
|
+
function isChordCommandString(value) {
|
|
1835
|
+
const trimmed = value.trim();
|
|
1836
|
+
if (!trimmed || trimmed.length <= 1) return false;
|
|
1837
|
+
if (trimmed.includes("+")) return true;
|
|
1838
|
+
if (/\s+/.test(trimmed)) {
|
|
1839
|
+
const tokens = trimmed.split(/\s+/).filter(Boolean);
|
|
1840
|
+
return tokens.length > 1 && tokens.every((t) => validateKbdChord(t).valid);
|
|
1841
|
+
}
|
|
1842
|
+
return false;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
// src/toast.ts
|
|
1846
|
+
var import_class_variance_authority20 = require("class-variance-authority");
|
|
1847
|
+
var toasterBase = [
|
|
1848
|
+
"w-[calc(100%-var(--viewport-offset-left))] sm:w-(--width) [--width:22.25rem]",
|
|
1849
|
+
"data-[align=center]:left-[calc(var(--viewport-offset-right)/2)]!",
|
|
1850
|
+
"sm:data-[align=center]:w-full"
|
|
1851
|
+
].join(" ");
|
|
1852
|
+
var toastVariants = (0, import_class_variance_authority20.cva)(
|
|
1853
|
+
[
|
|
1854
|
+
"z-(--z-index) translate-x-(--x) translate-y-(--y) opacity-(--opacity)",
|
|
1855
|
+
"data-[overlap]:scale-[calc(1-var(--index,0)*0.04)]",
|
|
1856
|
+
"relative w-[calc(100%-var(--viewport-offset-left))] sm:w-(--width)",
|
|
1857
|
+
"flex items-start justify-between gap-2.5 rounded-lg border border-border bg-popover px-3.5 py-3 text-sm text-popover-foreground shadow-lg select-none outline-none",
|
|
1858
|
+
"transition-[translate,scale,opacity,height] duration-250 ease-[cubic-bezier(0.21,1.02,0.73,1)] will-change-[translate,opacity,scale]",
|
|
1859
|
+
"data-[state=closed]:duration-200 data-[state=closed]:ease-[cubic-bezier(0.06,0.71,0.55,1)]",
|
|
1860
|
+
"motion-reduce:transition-none!",
|
|
1861
|
+
"data-[type=info]:border-info/30",
|
|
1862
|
+
"data-[type=success]:border-success/30",
|
|
1863
|
+
"data-[type=warning]:border-warn/30",
|
|
1864
|
+
"data-[type=error]:border-danger/30"
|
|
1865
|
+
].join(" ")
|
|
1866
|
+
);
|
|
1867
|
+
var toastIconBase = [
|
|
1868
|
+
"mt-0.5 shrink-0",
|
|
1869
|
+
"in-data-[type=warning]:text-warn",
|
|
1870
|
+
"in-data-[type=success]:text-success",
|
|
1871
|
+
"in-data-[type=error]:text-danger",
|
|
1872
|
+
"in-data-[type=info]:text-info",
|
|
1873
|
+
"in-data-[type=loading]:text-primary",
|
|
1874
|
+
"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0"
|
|
1875
|
+
].join(" ");
|
|
1876
|
+
var toastTitleBase = "text-sm font-medium leading-tight text-popover-foreground";
|
|
1877
|
+
var toastDescriptionBase = "text-xs leading-relaxed text-muted-foreground";
|
|
1878
|
+
var toastActionTriggerBase = "inline-flex h-7 shrink-0 cursor-pointer items-center justify-center rounded-md border border-border bg-secondary px-2.5 text-xs font-medium text-secondary-foreground transition-colors hover:bg-secondary/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50";
|
|
1879
|
+
var toastCloseTriggerBase = "inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground opacity-70 transition-opacity hover:bg-accent hover:text-accent-foreground hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50 [&_svg]:pointer-events-none [&_svg]:size-3.5";
|
|
1880
|
+
|
|
1881
|
+
// src/command/core.ts
|
|
1882
|
+
var import_hotkeys2 = require("@tanstack/hotkeys");
|
|
1883
|
+
var import_collection = require("@zag-js/collection");
|
|
1884
|
+
var import_i18n_utils = require("@zag-js/i18n-utils");
|
|
1885
|
+
var import_live_region = require("@zag-js/live-region");
|
|
1886
|
+
var import_fzf = require("fzf");
|
|
1887
|
+
var ROOT_NODE_VALUE = "__root__";
|
|
1888
|
+
var DEFAULT_GROUP_LABEL = "Commands";
|
|
1889
|
+
var i18nFilter = (0, import_i18n_utils.createFilter)({ sensitivity: "base" });
|
|
1890
|
+
var sharedLiveRegion = null;
|
|
1891
|
+
function getNodeCommandToken(node) {
|
|
1892
|
+
return (node.command ?? node.value).trim();
|
|
1893
|
+
}
|
|
1894
|
+
function isEditableTarget(target) {
|
|
1895
|
+
if (!target || typeof target !== "object") return false;
|
|
1896
|
+
const el = target;
|
|
1897
|
+
if (el.isContentEditable) return true;
|
|
1898
|
+
const tag = el.tagName?.toLowerCase();
|
|
1899
|
+
if (tag === "input" || tag === "textarea" || tag === "select") return true;
|
|
1900
|
+
if (typeof el.closest === "function" && el.closest('[contenteditable="true"], .ProseMirror')) {
|
|
1901
|
+
return true;
|
|
1902
|
+
}
|
|
1903
|
+
return false;
|
|
1904
|
+
}
|
|
1905
|
+
function toFlatItem(node, ancestorPath, ancestorLabels, ancestorCommands, tree, fallbackGroup) {
|
|
1906
|
+
const cmd = getNodeCommandToken(node);
|
|
1907
|
+
const valuePath = [...ancestorPath, node.value];
|
|
1908
|
+
const commandTokens = [...ancestorCommands, cmd];
|
|
1909
|
+
const isBranch = tree.isBranchNode(node);
|
|
1910
|
+
const group = node.group ?? fallbackGroup ?? (ancestorLabels.length > 0 ? ancestorLabels[ancestorLabels.length - 1] : DEFAULT_GROUP_LABEL);
|
|
1911
|
+
return {
|
|
1912
|
+
value: valuePath.join("/"),
|
|
1913
|
+
label: node.label,
|
|
1914
|
+
description: node.description,
|
|
1915
|
+
group,
|
|
1916
|
+
command: cmd,
|
|
1917
|
+
fullCommand: `:${commandTokens.join(" ")}`,
|
|
1918
|
+
aliases: node.aliases ?? [],
|
|
1919
|
+
shortcut: node.shortcut,
|
|
1920
|
+
badge: node.badge,
|
|
1921
|
+
active: Boolean(node.active),
|
|
1922
|
+
disabled: Boolean(node.disabled),
|
|
1923
|
+
isBranch,
|
|
1924
|
+
valuePath,
|
|
1925
|
+
breadcrumbLabels: ancestorLabels,
|
|
1926
|
+
node
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
function groupCommandItems(items) {
|
|
1930
|
+
const map = /* @__PURE__ */ new Map();
|
|
1931
|
+
for (const item of items) {
|
|
1932
|
+
const groupLabel = item.group || DEFAULT_GROUP_LABEL;
|
|
1933
|
+
const list = map.get(groupLabel);
|
|
1934
|
+
if (list) {
|
|
1935
|
+
list.push(item);
|
|
1936
|
+
} else {
|
|
1937
|
+
map.set(groupLabel, [item]);
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
return Array.from(map.entries()).map(([label, groupItems]) => ({
|
|
1941
|
+
label,
|
|
1942
|
+
items: groupItems
|
|
1943
|
+
}));
|
|
1944
|
+
}
|
|
1945
|
+
function collectDeepFlatItems(parentNode, ancestorPath, ancestorLabels, ancestorCommands, tree, out) {
|
|
1946
|
+
const children = tree.getNodeChildren(parentNode);
|
|
1947
|
+
for (const child of children) {
|
|
1948
|
+
const flat = toFlatItem(child, ancestorPath, ancestorLabels, ancestorCommands, tree);
|
|
1949
|
+
out.push(flat);
|
|
1950
|
+
if (tree.isBranchNode(child)) {
|
|
1951
|
+
collectDeepFlatItems(
|
|
1952
|
+
child,
|
|
1953
|
+
[...ancestorPath, child.value],
|
|
1954
|
+
[...ancestorLabels, child.label],
|
|
1955
|
+
[...ancestorCommands, getNodeCommandToken(child)],
|
|
1956
|
+
tree,
|
|
1957
|
+
out
|
|
1958
|
+
);
|
|
1959
|
+
}
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1962
|
+
function matchesCommandToken(node, token) {
|
|
1963
|
+
const lower = token.toLowerCase();
|
|
1964
|
+
const cmd = getNodeCommandToken(node).toLowerCase();
|
|
1965
|
+
if (cmd === lower || node.value.toLowerCase() === lower) {
|
|
1966
|
+
return true;
|
|
1967
|
+
}
|
|
1968
|
+
return (node.aliases ?? []).some((alias) => alias.toLowerCase() === lower);
|
|
1969
|
+
}
|
|
1970
|
+
function createCommandTree(items) {
|
|
1971
|
+
if (items instanceof import_collection.TreeCollection) {
|
|
1972
|
+
return items;
|
|
1973
|
+
}
|
|
1974
|
+
const rootNode = {
|
|
1975
|
+
value: ROOT_NODE_VALUE,
|
|
1976
|
+
label: "Root",
|
|
1977
|
+
children: items ?? []
|
|
1978
|
+
};
|
|
1979
|
+
return new import_collection.TreeCollection({
|
|
1980
|
+
rootNode,
|
|
1981
|
+
nodeToValue: (node) => node.value,
|
|
1982
|
+
nodeToString: (node) => node.label,
|
|
1983
|
+
isNodeDisabled: (node) => Boolean(node.disabled),
|
|
1984
|
+
nodeToChildren: (node) => node.children ?? []
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
function resolveCommandLevel(tree, activePath = [], query = "", options) {
|
|
1988
|
+
const rootChildren = tree.getNodeChildren(tree.rootNode);
|
|
1989
|
+
const hasCommands = rootChildren.length > 0;
|
|
1990
|
+
if (!hasCommands) {
|
|
1991
|
+
return {
|
|
1992
|
+
hasCommands: false,
|
|
1993
|
+
breadcrumbs: [],
|
|
1994
|
+
items: [],
|
|
1995
|
+
groups: []
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
const breadcrumbs = [];
|
|
1999
|
+
const resolvedValuePath = [];
|
|
2000
|
+
const resolvedLabels = [];
|
|
2001
|
+
const resolvedCommands = [];
|
|
2002
|
+
let currentNode = tree.rootNode;
|
|
2003
|
+
for (const segment of activePath) {
|
|
2004
|
+
const children = tree.getNodeChildren(currentNode);
|
|
2005
|
+
const match = children.find((child) => child.value === segment);
|
|
2006
|
+
if (!match || !tree.isBranchNode(match)) {
|
|
2007
|
+
break;
|
|
2008
|
+
}
|
|
2009
|
+
const cmd = getNodeCommandToken(match);
|
|
2010
|
+
breadcrumbs.push({
|
|
2011
|
+
value: match.value,
|
|
2012
|
+
label: match.label,
|
|
2013
|
+
command: cmd
|
|
2014
|
+
});
|
|
2015
|
+
resolvedValuePath.push(match.value);
|
|
2016
|
+
resolvedLabels.push(match.label);
|
|
2017
|
+
resolvedCommands.push(cmd);
|
|
2018
|
+
currentNode = match;
|
|
2019
|
+
}
|
|
2020
|
+
const trimmedQuery = query.trim();
|
|
2021
|
+
const directChildren = tree.getNodeChildren(currentNode);
|
|
2022
|
+
const directItems = directChildren.map(
|
|
2023
|
+
(child) => toFlatItem(child, resolvedValuePath, resolvedLabels, resolvedCommands, tree)
|
|
2024
|
+
);
|
|
2025
|
+
if (!trimmedQuery) {
|
|
2026
|
+
return {
|
|
2027
|
+
hasCommands: true,
|
|
2028
|
+
breadcrumbs,
|
|
2029
|
+
items: directItems,
|
|
2030
|
+
groups: groupCommandItems(directItems)
|
|
2031
|
+
};
|
|
2032
|
+
}
|
|
2033
|
+
const normalizedQuery = trimmedQuery.startsWith(":") ? trimmedQuery.slice(1).trim() : trimmedQuery;
|
|
2034
|
+
if (!normalizedQuery) {
|
|
2035
|
+
return {
|
|
2036
|
+
hasCommands: true,
|
|
2037
|
+
breadcrumbs,
|
|
2038
|
+
items: directItems,
|
|
2039
|
+
groups: groupCommandItems(directItems)
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
const allowDeepSearch = options?.deepSearch !== false && breadcrumbs.length === 0;
|
|
2043
|
+
const candidatePool = [];
|
|
2044
|
+
if (allowDeepSearch) {
|
|
2045
|
+
collectDeepFlatItems(currentNode, resolvedValuePath, resolvedLabels, resolvedCommands, tree, candidatePool);
|
|
2046
|
+
} else {
|
|
2047
|
+
candidatePool.push(...directItems);
|
|
2048
|
+
}
|
|
2049
|
+
const labelFzf = new import_fzf.Fzf(candidatePool, {
|
|
2050
|
+
selector: (item) => item.label,
|
|
2051
|
+
tiebreakers: [import_fzf.byLengthAsc],
|
|
2052
|
+
casing: "case-insensitive"
|
|
2053
|
+
});
|
|
2054
|
+
const labelResults = labelFzf.find(normalizedQuery);
|
|
2055
|
+
const labelMatchMap = /* @__PURE__ */ new Map();
|
|
2056
|
+
for (const res of labelResults) {
|
|
2057
|
+
labelMatchMap.set(res.item.value, {
|
|
2058
|
+
score: res.score,
|
|
2059
|
+
positions: Array.from(res.positions).sort((a, b) => a - b)
|
|
2060
|
+
});
|
|
2061
|
+
}
|
|
2062
|
+
const compositeFzf = new import_fzf.Fzf(candidatePool, {
|
|
2063
|
+
selector: (item) => [
|
|
2064
|
+
item.label,
|
|
2065
|
+
item.command,
|
|
2066
|
+
item.fullCommand,
|
|
2067
|
+
...item.aliases,
|
|
2068
|
+
...item.breadcrumbLabels,
|
|
2069
|
+
item.description ?? "",
|
|
2070
|
+
...item.node.keywords ?? []
|
|
2071
|
+
].join(" "),
|
|
2072
|
+
tiebreakers: [import_fzf.byLengthAsc],
|
|
2073
|
+
casing: "case-insensitive"
|
|
2074
|
+
});
|
|
2075
|
+
const compositeResults = compositeFzf.find(normalizedQuery);
|
|
2076
|
+
const matchedByValue = /* @__PURE__ */ new Map();
|
|
2077
|
+
for (const res of compositeResults) {
|
|
2078
|
+
const labelHit = labelMatchMap.get(res.item.value);
|
|
2079
|
+
const depthPenalty = (res.item.valuePath.length - 1) * 2;
|
|
2080
|
+
const effectiveScore = (labelHit ? labelHit.score + 20 : res.score) - depthPenalty;
|
|
2081
|
+
matchedByValue.set(res.item.value, {
|
|
2082
|
+
...res.item,
|
|
2083
|
+
matchPositions: labelHit?.positions ?? [],
|
|
2084
|
+
score: effectiveScore
|
|
2085
|
+
});
|
|
2086
|
+
}
|
|
2087
|
+
for (const candidate of candidatePool) {
|
|
2088
|
+
if (matchedByValue.has(candidate.value)) continue;
|
|
2089
|
+
if (i18nFilter.contains(candidate.label, normalizedQuery) || i18nFilter.contains(candidate.command, normalizedQuery)) {
|
|
2090
|
+
matchedByValue.set(candidate.value, {
|
|
2091
|
+
...candidate,
|
|
2092
|
+
matchPositions: [],
|
|
2093
|
+
score: 1
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
const rankedItems = Array.from(matchedByValue.values()).sort((a, b) => {
|
|
2098
|
+
const scoreDiff = (b.score ?? 0) - (a.score ?? 0);
|
|
2099
|
+
if (scoreDiff !== 0) return scoreDiff;
|
|
2100
|
+
if (a.valuePath.length !== b.valuePath.length) {
|
|
2101
|
+
return a.valuePath.length - b.valuePath.length;
|
|
2102
|
+
}
|
|
2103
|
+
return a.label.length - b.label.length;
|
|
2104
|
+
});
|
|
2105
|
+
return {
|
|
2106
|
+
hasCommands: true,
|
|
2107
|
+
breadcrumbs,
|
|
2108
|
+
items: rankedItems,
|
|
2109
|
+
groups: groupCommandItems(rankedItems)
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
function resolveCommandMenuState(tree, rawInput = "") {
|
|
2113
|
+
const rootChildren = tree.getNodeChildren(tree.rootNode);
|
|
2114
|
+
const hasCommands = rootChildren.length > 0;
|
|
2115
|
+
const withoutColon = rawInput.startsWith(":") ? rawInput.slice(1) : rawInput;
|
|
2116
|
+
const normalizedInput = `:${withoutColon}`;
|
|
2117
|
+
if (!hasCommands) {
|
|
2118
|
+
return {
|
|
2119
|
+
hasCommands: false,
|
|
2120
|
+
normalizedInput,
|
|
2121
|
+
completedTokens: [],
|
|
2122
|
+
partialToken: withoutColon.trim(),
|
|
2123
|
+
breadcrumbs: [],
|
|
2124
|
+
suggestions: [],
|
|
2125
|
+
exactNode: null,
|
|
2126
|
+
error: null
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
const hasTrailingSpace = /\s+$/.test(withoutColon);
|
|
2130
|
+
const trimmed = withoutColon.trim();
|
|
2131
|
+
const rawTokens = trimmed.length > 0 ? trimmed.split(/\s+/) : [];
|
|
2132
|
+
const tokensToWalk = hasTrailingSpace ? rawTokens : rawTokens.slice(0, -1);
|
|
2133
|
+
const partialToken = hasTrailingSpace ? "" : rawTokens[rawTokens.length - 1] ?? "";
|
|
2134
|
+
const completedTokens = [];
|
|
2135
|
+
const breadcrumbs = [];
|
|
2136
|
+
const ancestorPath = [];
|
|
2137
|
+
const ancestorLabels = [];
|
|
2138
|
+
let currentNode = tree.rootNode;
|
|
2139
|
+
for (let i = 0; i < tokensToWalk.length; i++) {
|
|
2140
|
+
const token = tokensToWalk[i];
|
|
2141
|
+
const children = tree.getNodeChildren(currentNode);
|
|
2142
|
+
const matchedChild = children.find((child) => matchesCommandToken(child, token));
|
|
2143
|
+
if (!matchedChild) {
|
|
2144
|
+
return {
|
|
2145
|
+
hasCommands: true,
|
|
2146
|
+
normalizedInput,
|
|
2147
|
+
completedTokens,
|
|
2148
|
+
partialToken: rawTokens.slice(i).join(" "),
|
|
2149
|
+
breadcrumbs,
|
|
2150
|
+
suggestions: [],
|
|
2151
|
+
exactNode: null,
|
|
2152
|
+
error: `Unknown command: ${token}`
|
|
2153
|
+
};
|
|
2154
|
+
}
|
|
2155
|
+
const canonicalCmd = getNodeCommandToken(matchedChild);
|
|
2156
|
+
if (!tree.isBranchNode(matchedChild)) {
|
|
2157
|
+
const extraTokens = rawTokens.slice(i + 1);
|
|
2158
|
+
const hasExtra = extraTokens.length > 0 || partialToken.length > 0;
|
|
2159
|
+
if (hasExtra) {
|
|
2160
|
+
return {
|
|
2161
|
+
hasCommands: true,
|
|
2162
|
+
normalizedInput,
|
|
2163
|
+
completedTokens: [...completedTokens, canonicalCmd],
|
|
2164
|
+
partialToken,
|
|
2165
|
+
breadcrumbs,
|
|
2166
|
+
suggestions: [],
|
|
2167
|
+
exactNode: null,
|
|
2168
|
+
error: `Command ':${[...completedTokens, canonicalCmd].join(" ")}' does not take arguments`
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
2171
|
+
const exactFlat = toFlatItem(matchedChild, ancestorPath, ancestorLabels, completedTokens, tree);
|
|
2172
|
+
return {
|
|
2173
|
+
hasCommands: true,
|
|
2174
|
+
normalizedInput,
|
|
2175
|
+
completedTokens: [...completedTokens, canonicalCmd],
|
|
2176
|
+
partialToken: "",
|
|
2177
|
+
breadcrumbs,
|
|
2178
|
+
suggestions: [exactFlat],
|
|
2179
|
+
exactNode: exactFlat,
|
|
2180
|
+
error: null
|
|
2181
|
+
};
|
|
2182
|
+
}
|
|
2183
|
+
completedTokens.push(canonicalCmd);
|
|
2184
|
+
breadcrumbs.push({
|
|
2185
|
+
value: matchedChild.value,
|
|
2186
|
+
label: matchedChild.label,
|
|
2187
|
+
command: canonicalCmd
|
|
2188
|
+
});
|
|
2189
|
+
ancestorPath.push(matchedChild.value);
|
|
2190
|
+
ancestorLabels.push(matchedChild.label);
|
|
2191
|
+
currentNode = matchedChild;
|
|
2192
|
+
}
|
|
2193
|
+
const branchChildren = tree.getNodeChildren(currentNode);
|
|
2194
|
+
const branchItems = branchChildren.map(
|
|
2195
|
+
(child) => toFlatItem(child, ancestorPath, ancestorLabels, completedTokens, tree)
|
|
2196
|
+
);
|
|
2197
|
+
if (!partialToken) {
|
|
2198
|
+
return {
|
|
2199
|
+
hasCommands: true,
|
|
2200
|
+
normalizedInput,
|
|
2201
|
+
completedTokens,
|
|
2202
|
+
partialToken: "",
|
|
2203
|
+
breadcrumbs,
|
|
2204
|
+
suggestions: branchItems,
|
|
2205
|
+
exactNode: null,
|
|
2206
|
+
error: null
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
const exactChild = branchItems.find((item) => matchesCommandToken(item.node, partialToken)) ?? null;
|
|
2210
|
+
const cmdFzf = new import_fzf.Fzf(branchItems, {
|
|
2211
|
+
selector: (item) => item.command,
|
|
2212
|
+
tiebreakers: [import_fzf.byLengthAsc],
|
|
2213
|
+
casing: "case-insensitive"
|
|
2214
|
+
});
|
|
2215
|
+
const cmdHits = /* @__PURE__ */ new Map();
|
|
2216
|
+
for (const res of cmdFzf.find(partialToken)) {
|
|
2217
|
+
cmdHits.set(res.item.value, {
|
|
2218
|
+
score: res.score,
|
|
2219
|
+
positions: Array.from(res.positions).sort((a, b) => a - b)
|
|
2220
|
+
});
|
|
2221
|
+
}
|
|
2222
|
+
const labelFzf = new import_fzf.Fzf(branchItems, {
|
|
2223
|
+
selector: (item) => item.label,
|
|
2224
|
+
tiebreakers: [import_fzf.byLengthAsc],
|
|
2225
|
+
casing: "case-insensitive"
|
|
2226
|
+
});
|
|
2227
|
+
const labelHits = /* @__PURE__ */ new Map();
|
|
2228
|
+
for (const res of labelFzf.find(partialToken)) {
|
|
2229
|
+
labelHits.set(res.item.value, {
|
|
2230
|
+
score: res.score,
|
|
2231
|
+
positions: Array.from(res.positions).sort((a, b) => a - b)
|
|
2232
|
+
});
|
|
2233
|
+
}
|
|
2234
|
+
const combinedFzf = new import_fzf.Fzf(branchItems, {
|
|
2235
|
+
selector: (item) => [item.command, ...item.aliases, item.label, item.description ?? "", ...item.node.keywords ?? []].join(" "),
|
|
2236
|
+
tiebreakers: [import_fzf.byLengthAsc],
|
|
2237
|
+
casing: "case-insensitive"
|
|
2238
|
+
});
|
|
2239
|
+
const suggestionMap = /* @__PURE__ */ new Map();
|
|
2240
|
+
for (const res of combinedFzf.find(partialToken)) {
|
|
2241
|
+
const cmdHit = cmdHits.get(res.item.value);
|
|
2242
|
+
const labelHit = labelHits.get(res.item.value);
|
|
2243
|
+
const isExact = exactChild?.value === res.item.value;
|
|
2244
|
+
const isPrefix = res.item.command.toLowerCase().startsWith(partialToken.toLowerCase());
|
|
2245
|
+
const score = (cmdHit ? cmdHit.score + 50 : res.score) + (isExact ? 500 : 0) + (isPrefix ? 100 : 0);
|
|
2246
|
+
suggestionMap.set(res.item.value, {
|
|
2247
|
+
...res.item,
|
|
2248
|
+
commandMatchPositions: cmdHit?.positions ?? [],
|
|
2249
|
+
matchPositions: labelHit?.positions ?? [],
|
|
2250
|
+
score
|
|
2251
|
+
});
|
|
2252
|
+
}
|
|
2253
|
+
const suggestions = Array.from(suggestionMap.values()).sort((a, b) => {
|
|
2254
|
+
const scoreDiff = (b.score ?? 0) - (a.score ?? 0);
|
|
2255
|
+
if (scoreDiff !== 0) return scoreDiff;
|
|
2256
|
+
return a.command.length - b.command.length;
|
|
2257
|
+
});
|
|
2258
|
+
const error = suggestions.length === 0 ? `Unknown command: ${[...completedTokens, partialToken].join(" ")}` : null;
|
|
2259
|
+
return {
|
|
2260
|
+
hasCommands: true,
|
|
2261
|
+
normalizedInput,
|
|
2262
|
+
completedTokens,
|
|
2263
|
+
partialToken,
|
|
2264
|
+
breadcrumbs,
|
|
2265
|
+
suggestions,
|
|
2266
|
+
exactNode: exactChild ? suggestionMap.get(exactChild.value) ?? exactChild : null,
|
|
2267
|
+
error
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
var resolveColonCommandState = resolveCommandMenuState;
|
|
2271
|
+
function formatCommandMenuCompletionInput(completedTokens, item, appendBranchSpace = true) {
|
|
2272
|
+
const nextTokens = [...completedTokens, item.command].join(" ");
|
|
2273
|
+
return item.isBranch && appendBranchSpace ? `:${nextTokens} ` : `:${nextTokens}`;
|
|
2274
|
+
}
|
|
2275
|
+
var formatColonCompletionInput = formatCommandMenuCompletionInput;
|
|
2276
|
+
function splitHighlightSegments(text, matchPositions) {
|
|
2277
|
+
if (!text) return [];
|
|
2278
|
+
if (!matchPositions || matchPositions.length === 0) {
|
|
2279
|
+
return [{ text, highlight: false }];
|
|
2280
|
+
}
|
|
2281
|
+
const posSet = new Set(matchPositions);
|
|
2282
|
+
const segments = [];
|
|
2283
|
+
let currentText = "";
|
|
2284
|
+
let currentHighlight = posSet.has(0);
|
|
2285
|
+
for (let i = 0; i < text.length; i++) {
|
|
2286
|
+
const isHighlighted = posSet.has(i);
|
|
2287
|
+
if (i > 0 && isHighlighted !== currentHighlight) {
|
|
2288
|
+
segments.push({ text: currentText, highlight: currentHighlight });
|
|
2289
|
+
currentText = text[i];
|
|
2290
|
+
currentHighlight = isHighlighted;
|
|
2291
|
+
} else {
|
|
2292
|
+
currentText += text[i];
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
if (currentText.length > 0) {
|
|
2296
|
+
segments.push({ text: currentText, highlight: currentHighlight });
|
|
2297
|
+
}
|
|
2298
|
+
return segments;
|
|
2299
|
+
}
|
|
2300
|
+
function announceCommandMessage(message) {
|
|
2301
|
+
if (typeof document === "undefined" || !message) return;
|
|
2302
|
+
try {
|
|
2303
|
+
if (!sharedLiveRegion) {
|
|
2304
|
+
sharedLiveRegion = (0, import_live_region.createLiveRegion)({ level: "polite", document });
|
|
2305
|
+
}
|
|
2306
|
+
sharedLiveRegion.announce(message, 150);
|
|
2307
|
+
} catch {
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2310
|
+
function matchesCommandHotkey(event, hotkey) {
|
|
2311
|
+
if (!hotkey) return false;
|
|
2312
|
+
const trimmed = hotkey.trim();
|
|
2313
|
+
if (trimmed === ":") {
|
|
2314
|
+
if (isEditableTarget(event.target)) return false;
|
|
2315
|
+
return !event.metaKey && !event.ctrlKey && !event.altKey && event.key === ":";
|
|
2316
|
+
}
|
|
2317
|
+
try {
|
|
2318
|
+
if ((0, import_hotkeys2.matchesKeyboardEvent)(event, hotkey)) {
|
|
2319
|
+
return true;
|
|
2320
|
+
}
|
|
2321
|
+
} catch {
|
|
2322
|
+
}
|
|
2323
|
+
const normalized = trimmed.toLowerCase();
|
|
2324
|
+
if (normalized === "mod+k" || normalized === "cmd+k" || normalized === "ctrl+k") {
|
|
2325
|
+
return (event.metaKey || event.ctrlKey) && !event.altKey && event.key.toLowerCase() === "k";
|
|
2326
|
+
}
|
|
2327
|
+
return false;
|
|
2328
|
+
}
|
|
2329
|
+
function isHotkeyAnchorVisible(el) {
|
|
2330
|
+
if (el.closest("[hidden]")) return false;
|
|
2331
|
+
const fwWrapper = el.closest("[data-fw]");
|
|
2332
|
+
const activeFw = el.ownerDocument?.documentElement?.getAttribute("data-framework");
|
|
2333
|
+
if (fwWrapper && activeFw && fwWrapper.getAttribute("data-fw") !== activeFw) {
|
|
2334
|
+
return false;
|
|
2335
|
+
}
|
|
2336
|
+
return true;
|
|
2337
|
+
}
|
|
2338
|
+
function shouldHandleCommandHotkey(anchorEl, selector) {
|
|
2339
|
+
if (!anchorEl || typeof document === "undefined") return true;
|
|
2340
|
+
if (!isHotkeyAnchorVisible(anchorEl)) return false;
|
|
2341
|
+
const myPreview = anchorEl.closest("[data-example-preview]");
|
|
2342
|
+
const activePreview = document.activeElement?.closest?.("[data-example-preview]") ?? null;
|
|
2343
|
+
if (activePreview) {
|
|
2344
|
+
return myPreview === activePreview;
|
|
2345
|
+
}
|
|
2346
|
+
if (myPreview) {
|
|
2347
|
+
const previewAnchors = Array.from(
|
|
2348
|
+
document.querySelectorAll(`[data-example-preview] ${selector}`)
|
|
2349
|
+
).filter(isHotkeyAnchorVisible);
|
|
2350
|
+
return previewAnchors[0] === anchorEl;
|
|
2351
|
+
}
|
|
2352
|
+
return true;
|
|
2353
|
+
}
|
|
2354
|
+
function resolveCommandMenuGridStyle(columns = "auto", itemCount) {
|
|
2355
|
+
if (columns === 1 || itemCount <= 0) {
|
|
2356
|
+
return void 0;
|
|
2357
|
+
}
|
|
2358
|
+
const maxCols = columns === "auto" ? itemCount <= 6 ? 2 : itemCount <= 12 ? 3 : 4 : columns;
|
|
2359
|
+
const colCount = Math.max(1, Math.min(maxCols, itemCount));
|
|
2360
|
+
const rowCount = Math.max(1, Math.ceil(itemCount / colCount));
|
|
2361
|
+
return {
|
|
2362
|
+
display: "grid",
|
|
2363
|
+
gridAutoFlow: "column",
|
|
2364
|
+
gridTemplateRows: `repeat(${rowCount}, minmax(0, auto))`,
|
|
2365
|
+
gridTemplateColumns: `repeat(${colCount}, minmax(0, 1fr))`
|
|
2366
|
+
};
|
|
2367
|
+
}
|
|
2368
|
+
var resolveColonCommandGridStyle = resolveCommandMenuGridStyle;
|
|
2369
|
+
function resolveCommandMenuGridNavigation(columns = "auto", itemCount, currentIdx, key) {
|
|
2370
|
+
if (itemCount <= 0) return -1;
|
|
2371
|
+
const safeIdx = currentIdx >= 0 && currentIdx < itemCount ? currentIdx : 0;
|
|
2372
|
+
if (key === "ArrowDown") {
|
|
2373
|
+
return (safeIdx + 1) % itemCount;
|
|
2374
|
+
}
|
|
2375
|
+
if (key === "ArrowUp") {
|
|
2376
|
+
return (safeIdx - 1 + itemCount) % itemCount;
|
|
2377
|
+
}
|
|
2378
|
+
if (columns === 1) {
|
|
2379
|
+
return safeIdx;
|
|
2380
|
+
}
|
|
2381
|
+
const maxCols = columns === "auto" ? itemCount <= 6 ? 2 : itemCount <= 12 ? 3 : 4 : columns;
|
|
2382
|
+
const colCount = Math.max(1, Math.min(maxCols, itemCount));
|
|
2383
|
+
const rowCount = Math.max(1, Math.ceil(itemCount / colCount));
|
|
2384
|
+
const totalCols = Math.max(1, Math.ceil(itemCount / rowCount));
|
|
2385
|
+
const row = safeIdx % rowCount;
|
|
2386
|
+
const col = Math.floor(safeIdx / rowCount);
|
|
2387
|
+
const nextCol = key === "ArrowRight" ? (col + 1) % totalCols : (col - 1 + totalCols) % totalCols;
|
|
2388
|
+
return Math.min(nextCol * rowCount + row, itemCount - 1);
|
|
2389
|
+
}
|
|
2390
|
+
var resolveColonCommandGridNavigation = resolveCommandMenuGridNavigation;
|
|
2391
|
+
|
|
2392
|
+
// src/command/styles.ts
|
|
2393
|
+
var import_class_variance_authority21 = require("class-variance-authority");
|
|
2394
|
+
var commandPaletteVariants = (0, import_class_variance_authority21.cva)(
|
|
2395
|
+
"flex w-full flex-col overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl outline-none",
|
|
2396
|
+
{
|
|
2397
|
+
variants: {
|
|
2398
|
+
size: {
|
|
2399
|
+
sm: "max-w-md",
|
|
2400
|
+
md: "max-w-xl",
|
|
2401
|
+
lg: "max-w-2xl"
|
|
2402
|
+
}
|
|
2403
|
+
},
|
|
2404
|
+
defaultVariants: {
|
|
2405
|
+
size: "md"
|
|
2406
|
+
}
|
|
2407
|
+
}
|
|
2408
|
+
);
|
|
2409
|
+
var commandPalettePositionerBase = "items-center justify-center p-4";
|
|
2410
|
+
var commandPaletteDialogContentBase = "my-auto gap-0 overflow-hidden p-0 sm:max-w-xl";
|
|
2411
|
+
var commandPaletteHeaderBase = "flex items-center gap-2 border-b border-border px-3 py-2.5";
|
|
2412
|
+
var commandPaletteBreadcrumbBase = "inline-flex shrink-0 items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground";
|
|
2413
|
+
var commandPaletteInputBase = "flex-1 border-0 bg-transparent px-1 py-0.5 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-0";
|
|
2414
|
+
var commandPaletteListBase = "max-h-80 overflow-y-auto p-1.5 outline-none";
|
|
2415
|
+
var commandPaletteItemBase = "group relative flex w-full cursor-pointer select-none items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-sm outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
|
|
2416
|
+
var commandPaletteFooterBase = "flex flex-wrap items-center justify-between gap-2 border-t border-border bg-muted/30 px-3 py-2 text-[11px] text-muted-foreground";
|
|
2417
|
+
var commandMenuVariants = (0, import_class_variance_authority21.cva)(
|
|
2418
|
+
"flex w-full flex-col overflow-hidden border border-border bg-popover font-mono text-popover-foreground shadow-2xl outline-none",
|
|
2419
|
+
{
|
|
2420
|
+
variants: {
|
|
2421
|
+
size: {
|
|
2422
|
+
sm: "text-xs",
|
|
2423
|
+
md: "text-sm",
|
|
2424
|
+
lg: "text-base"
|
|
2425
|
+
}
|
|
2426
|
+
},
|
|
2427
|
+
defaultVariants: {
|
|
2428
|
+
size: "md"
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
);
|
|
2432
|
+
var commandMenuPositionerBase = "items-end justify-stretch p-0!";
|
|
2433
|
+
var commandMenuDialogContentBase = "fixed inset-x-0 bottom-0 top-auto my-0 w-full max-w-none translate-x-0 translate-y-0 gap-0 overflow-hidden rounded-none border-x-0 border-b-0 border-t border-border p-0 shadow-2xl sm:max-w-none sm:rounded-none";
|
|
2434
|
+
var commandMenuListVariants = (0, import_class_variance_authority21.cva)("overflow-y-auto border-b border-border bg-popover/95 outline-none", {
|
|
2435
|
+
variants: {
|
|
2436
|
+
columns: {
|
|
2437
|
+
auto: "grid! grid-flow-col!",
|
|
2438
|
+
1: "flex flex-col",
|
|
2439
|
+
2: "grid! grid-flow-col!",
|
|
2440
|
+
3: "grid! grid-flow-col!",
|
|
2441
|
+
4: "grid! grid-flow-col!"
|
|
2442
|
+
},
|
|
2443
|
+
size: {
|
|
2444
|
+
sm: "max-h-44 gap-x-2 gap-y-0.5 px-2 py-1",
|
|
2445
|
+
md: "max-h-60 gap-x-3 gap-y-1 p-2",
|
|
2446
|
+
lg: "max-h-72 gap-x-4 gap-y-1.5 p-3"
|
|
2447
|
+
}
|
|
2448
|
+
},
|
|
2449
|
+
defaultVariants: {
|
|
2450
|
+
columns: "auto",
|
|
2451
|
+
size: "md"
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2454
|
+
var commandMenuItemVariants = (0, import_class_variance_authority21.cva)(
|
|
2455
|
+
"group relative flex min-w-0 w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md font-mono outline-none transition-colors data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2456
|
+
{
|
|
2457
|
+
variants: {
|
|
2458
|
+
size: {
|
|
2459
|
+
sm: "px-1.5 py-0.5 text-[11px] leading-tight",
|
|
2460
|
+
md: "px-2.5 py-1.5 text-xs",
|
|
2461
|
+
lg: "px-3 py-2 text-sm"
|
|
2462
|
+
}
|
|
2463
|
+
},
|
|
2464
|
+
defaultVariants: {
|
|
2465
|
+
size: "md"
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
);
|
|
2469
|
+
var commandMenuPromptBarVariants = (0, import_class_variance_authority21.cva)(
|
|
2470
|
+
"flex w-full items-center border-t border-border/60 bg-muted/50 font-mono",
|
|
2471
|
+
{
|
|
2472
|
+
variants: {
|
|
2473
|
+
size: {
|
|
2474
|
+
sm: "gap-1 px-2 py-1 text-xs",
|
|
2475
|
+
md: "gap-1.5 px-3 py-2 text-sm",
|
|
2476
|
+
lg: "gap-2 px-4 py-2.5 text-base"
|
|
2477
|
+
}
|
|
2478
|
+
},
|
|
2479
|
+
defaultVariants: {
|
|
2480
|
+
size: "md"
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
);
|
|
2484
|
+
var commandMenuPrefixBase = "select-none font-mono font-bold text-primary";
|
|
2485
|
+
var commandMenuInputVariants = (0, import_class_variance_authority21.cva)(
|
|
2486
|
+
"flex-1 border-0 bg-transparent font-mono text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-0",
|
|
2487
|
+
{
|
|
2488
|
+
variants: {
|
|
2489
|
+
size: {
|
|
2490
|
+
sm: "px-0.5 py-0 text-xs",
|
|
2491
|
+
md: "px-1 py-0.5 text-sm",
|
|
2492
|
+
lg: "px-1.5 py-1 text-base"
|
|
2493
|
+
}
|
|
2494
|
+
},
|
|
2495
|
+
defaultVariants: {
|
|
2496
|
+
size: "md"
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
);
|
|
2500
|
+
var commandMenuErrorBase = "flex items-center justify-between gap-2 border-t border-destructive/30 bg-destructive/10 px-3 py-1.5 font-mono text-xs text-destructive";
|
|
2501
|
+
var colonCommandVariants = commandMenuVariants;
|
|
2502
|
+
var colonCommandPositionerBase = commandMenuPositionerBase;
|
|
2503
|
+
var colonCommandDialogContentBase = commandMenuDialogContentBase;
|
|
2504
|
+
var colonCommandListVariants = commandMenuListVariants;
|
|
2505
|
+
var colonCommandItemVariants = commandMenuItemVariants;
|
|
2506
|
+
var colonCommandPromptBarVariants = commandMenuPromptBarVariants;
|
|
2507
|
+
var colonCommandPrefixBase = commandMenuPrefixBase;
|
|
2508
|
+
var colonCommandInputVariants = commandMenuInputVariants;
|
|
2509
|
+
var colonCommandErrorBase = commandMenuErrorBase;
|
|
2510
|
+
|
|
2511
|
+
// src/which-key/index.ts
|
|
2512
|
+
var which_key_exports = {};
|
|
2513
|
+
__export(which_key_exports, {
|
|
2514
|
+
DEFAULT_JUMP_ALPHABET: () => DEFAULT_JUMP_ALPHABET,
|
|
2515
|
+
Jumplist: () => Jumplist,
|
|
2516
|
+
buildWhichKeyTree: () => buildWhichKeyTree,
|
|
2517
|
+
createHelixPreset: () => createHelixPreset,
|
|
2518
|
+
createJumplist: () => createJumplist,
|
|
2519
|
+
createKakounePreset: () => createKakounePreset,
|
|
2520
|
+
createVimPreset: () => createVimPreset,
|
|
2521
|
+
createWhichKeyController: () => createWhichKeyController,
|
|
2522
|
+
eventToChordKeys: () => eventToChordKeys,
|
|
2523
|
+
findDirectionalPane: () => findDirectionalPane,
|
|
2524
|
+
flattenKeymapEntries: () => flattenKeymapEntries,
|
|
2525
|
+
formatWhichKeyLabel: () => formatWhichKeyLabel,
|
|
2526
|
+
generateJumpLabels: () => generateJumpLabels,
|
|
2527
|
+
getDocumentWhichKeyController: () => getDocumentWhichKeyController,
|
|
2528
|
+
getModalEditor: () => getModalEditor,
|
|
2529
|
+
getNodeChildren: () => getNodeChildren,
|
|
2530
|
+
getPresetKeymap: () => getPresetKeymap,
|
|
2531
|
+
isGroupNode: () => isGroupNode,
|
|
2532
|
+
jumpBadgeMatchedPrefixBase: () => jumpBadgeMatchedPrefixBase,
|
|
2533
|
+
jumpBadgeVariants: () => jumpBadgeVariants,
|
|
2534
|
+
jumpOverlayRootBase: () => jumpOverlayRootBase,
|
|
2535
|
+
nodeExplicitlyIncludesMode: () => nodeExplicitlyIncludesMode,
|
|
2536
|
+
nodeMatchesMode: () => nodeMatchesMode,
|
|
2537
|
+
normalizeNodeModes: () => normalizeNodeModes,
|
|
2538
|
+
notifyAllModalEditors: () => notifyAllModalEditors,
|
|
2539
|
+
paneVariants: () => paneVariants,
|
|
2540
|
+
registerModalEditor: () => registerModalEditor,
|
|
2541
|
+
resolveNode: () => resolveNode,
|
|
2542
|
+
subscribeDocumentWhichKeyController: () => subscribeDocumentWhichKeyController,
|
|
2543
|
+
whichKeyBodyVariants: () => whichKeyBodyVariants,
|
|
2544
|
+
whichKeyBreadcrumbBase: () => whichKeyBreadcrumbBase,
|
|
2545
|
+
whichKeyExplorerContentBase: () => whichKeyExplorerContentBase,
|
|
2546
|
+
whichKeyExplorerHeaderBase: () => whichKeyExplorerHeaderBase,
|
|
2547
|
+
whichKeyExplorerHighlightMarkBase: () => whichKeyExplorerHighlightMarkBase,
|
|
2548
|
+
whichKeyExplorerInputBase: () => whichKeyExplorerInputBase,
|
|
2549
|
+
whichKeyExplorerItemBase: () => whichKeyExplorerItemBase,
|
|
2550
|
+
whichKeyExplorerListContentBase: () => whichKeyExplorerListContentBase,
|
|
2551
|
+
whichKeyExplorerListboxBase: () => whichKeyExplorerListboxBase,
|
|
2552
|
+
whichKeyFooterBase: () => whichKeyFooterBase,
|
|
2553
|
+
whichKeyHeaderBase: () => whichKeyHeaderBase,
|
|
2554
|
+
whichKeyItemBase: () => whichKeyItemBase,
|
|
2555
|
+
whichKeyItemLabelBase: () => whichKeyItemLabelBase,
|
|
2556
|
+
whichKeyModeBadgeVariants: () => whichKeyModeBadgeVariants,
|
|
2557
|
+
whichKeyTitleBase: () => whichKeyTitleBase,
|
|
2558
|
+
whichKeyVariants: () => whichKeyVariants
|
|
2559
|
+
});
|
|
2560
|
+
__reExport(which_key_exports, require("@tanstack/hotkeys"));
|
|
1653
2561
|
|
|
1654
2562
|
// src/which-key/core.ts
|
|
1655
2563
|
var DEFAULT_JUMP_ALPHABET = "asdfghjklqwertyuiopzxcvbnm";
|
|
@@ -1660,6 +2568,13 @@ function nodeMatchesMode(node, mode) {
|
|
|
1660
2568
|
}
|
|
1661
2569
|
return node.mode === mode;
|
|
1662
2570
|
}
|
|
2571
|
+
function nodeExplicitlyIncludesMode(node, mode) {
|
|
2572
|
+
if (!node.mode) return false;
|
|
2573
|
+
if (Array.isArray(node.mode)) {
|
|
2574
|
+
return node.mode.includes(mode);
|
|
2575
|
+
}
|
|
2576
|
+
return node.mode === mode;
|
|
2577
|
+
}
|
|
1663
2578
|
function normalizeNodeModes(node) {
|
|
1664
2579
|
if (!node.mode) return ["normal"];
|
|
1665
2580
|
return Array.isArray(node.mode) ? node.mode : [node.mode];
|
|
@@ -1671,7 +2586,7 @@ function getNodeChildren(node, rootTrie, visitedProxies = /* @__PURE__ */ new Se
|
|
|
1671
2586
|
if (!visitedProxies.has(proxyKey)) {
|
|
1672
2587
|
const nextVisited = new Set(visitedProxies);
|
|
1673
2588
|
nextVisited.add(proxyKey);
|
|
1674
|
-
const target = resolveNodeInternal(rootTrie, node.proxy, void 0, nextVisited);
|
|
2589
|
+
const target = resolveNodeInternal(rootTrie, node.proxy, void 0, nextVisited, rootTrie);
|
|
1675
2590
|
if (target) {
|
|
1676
2591
|
proxyChildren = getNodeChildren(target, rootTrie, nextVisited);
|
|
1677
2592
|
}
|
|
@@ -1684,7 +2599,7 @@ function getNodeChildren(node, rootTrie, visitedProxies = /* @__PURE__ */ new Se
|
|
|
1684
2599
|
...node.children ?? {}
|
|
1685
2600
|
};
|
|
1686
2601
|
}
|
|
1687
|
-
function resolveNodeInternal(rootTrie, path, mode, visitedProxies) {
|
|
2602
|
+
function resolveNodeInternal(rootTrie, path, mode, visitedProxies, proxyRootTrie = rootTrie) {
|
|
1688
2603
|
if (path.length === 0) return null;
|
|
1689
2604
|
let currentMap = rootTrie;
|
|
1690
2605
|
let currentNode = null;
|
|
@@ -1696,18 +2611,26 @@ function resolveNodeInternal(rootTrie, path, mode, visitedProxies) {
|
|
|
1696
2611
|
if (mode && !nodeMatchesMode(candidate, mode)) return null;
|
|
1697
2612
|
currentNode = candidate;
|
|
1698
2613
|
if (i < path.length - 1) {
|
|
1699
|
-
currentMap = getNodeChildren(candidate,
|
|
2614
|
+
currentMap = getNodeChildren(candidate, proxyRootTrie, visitedProxies);
|
|
1700
2615
|
}
|
|
1701
2616
|
}
|
|
1702
2617
|
return currentNode;
|
|
1703
2618
|
}
|
|
1704
|
-
function resolveNode(rootTrie, path, mode) {
|
|
1705
|
-
return resolveNodeInternal(rootTrie, path, mode, /* @__PURE__ */ new Set());
|
|
2619
|
+
function resolveNode(rootTrie, path, mode, proxyRootTrie = rootTrie) {
|
|
2620
|
+
return resolveNodeInternal(rootTrie, path, mode, /* @__PURE__ */ new Set(), proxyRootTrie);
|
|
1706
2621
|
}
|
|
1707
2622
|
function isGroupNode(node, rootTrie) {
|
|
1708
2623
|
const children = getNodeChildren(node, rootTrie);
|
|
1709
2624
|
return Object.keys(children).length > 0;
|
|
1710
2625
|
}
|
|
2626
|
+
function formatWhichKeyLabel(label) {
|
|
2627
|
+
const trimmed = label.trim();
|
|
2628
|
+
if (!trimmed.startsWith("+")) return trimmed;
|
|
2629
|
+
const withoutPlus = trimmed.slice(1).trim();
|
|
2630
|
+
if (!withoutPlus) return trimmed;
|
|
2631
|
+
if (withoutPlus.toLowerCase() === "goto") return "Go to";
|
|
2632
|
+
return withoutPlus.charAt(0).toUpperCase() + withoutPlus.slice(1);
|
|
2633
|
+
}
|
|
1711
2634
|
function buildWhichKeyTree(rootTrie, activePath, mode) {
|
|
1712
2635
|
if (activePath.length === 0) {
|
|
1713
2636
|
const items2 = Object.values(rootTrie).filter((item) => !item.hidden && nodeMatchesMode(item, mode));
|
|
@@ -1963,7 +2886,7 @@ function createTextObjectChildren() {
|
|
|
1963
2886
|
return {
|
|
1964
2887
|
i: {
|
|
1965
2888
|
key: "i",
|
|
1966
|
-
label: "
|
|
2889
|
+
label: "Inner",
|
|
1967
2890
|
group: "Inner Text Object",
|
|
1968
2891
|
category: "Match / Text Objects",
|
|
1969
2892
|
mode: ["normal", "select"],
|
|
@@ -2007,7 +2930,7 @@ function createTextObjectChildren() {
|
|
|
2007
2930
|
},
|
|
2008
2931
|
a: {
|
|
2009
2932
|
key: "a",
|
|
2010
|
-
label: "
|
|
2933
|
+
label: "Around",
|
|
2011
2934
|
group: "Around Text Object",
|
|
2012
2935
|
category: "Match / Text Objects",
|
|
2013
2936
|
mode: ["normal", "select"],
|
|
@@ -2054,7 +2977,7 @@ function createTextObjectChildren() {
|
|
|
2054
2977
|
function createWindowMenu() {
|
|
2055
2978
|
return {
|
|
2056
2979
|
key: "Control+w",
|
|
2057
|
-
label: "
|
|
2980
|
+
label: "Window",
|
|
2058
2981
|
group: "Window / Pane",
|
|
2059
2982
|
category: "Window / Pane",
|
|
2060
2983
|
mode: ["normal", "select"],
|
|
@@ -2131,7 +3054,7 @@ function createWindowMenu() {
|
|
|
2131
3054
|
},
|
|
2132
3055
|
s: {
|
|
2133
3056
|
key: "s",
|
|
2134
|
-
label: "
|
|
3057
|
+
label: "Sticky Window",
|
|
2135
3058
|
group: "Sticky Window Mode",
|
|
2136
3059
|
description: "Keep Window menu open until Escape",
|
|
2137
3060
|
category: "Window / Pane",
|
|
@@ -2156,7 +3079,7 @@ function createSpaceMenu(leaderKey = "Space", viewKey = "z") {
|
|
|
2156
3079
|
}
|
|
2157
3080
|
return {
|
|
2158
3081
|
key: leaderKey,
|
|
2159
|
-
label: "
|
|
3082
|
+
label: "Leader",
|
|
2160
3083
|
group: "Leader",
|
|
2161
3084
|
category: "Leader",
|
|
2162
3085
|
mode: ["normal", "select"],
|
|
@@ -2170,7 +3093,7 @@ function createSpaceMenu(leaderKey = "Space", viewKey = "z") {
|
|
|
2170
3093
|
},
|
|
2171
3094
|
w: {
|
|
2172
3095
|
key: "w",
|
|
2173
|
-
label: "
|
|
3096
|
+
label: "Window",
|
|
2174
3097
|
group: "Window / Pane",
|
|
2175
3098
|
description: "Spatial and indexed pane navigation",
|
|
2176
3099
|
category: "Window / Pane",
|
|
@@ -2185,15 +3108,15 @@ function createSpaceMenu(leaderKey = "Space", viewKey = "z") {
|
|
|
2185
3108
|
},
|
|
2186
3109
|
g: {
|
|
2187
3110
|
key: "g",
|
|
2188
|
-
label: "
|
|
2189
|
-
group: "
|
|
3111
|
+
label: "Go to",
|
|
3112
|
+
group: "Go to",
|
|
2190
3113
|
description: "Go to locations and boundaries",
|
|
2191
3114
|
category: "Goto",
|
|
2192
3115
|
proxy: ["g"]
|
|
2193
3116
|
},
|
|
2194
3117
|
v: {
|
|
2195
3118
|
key: "v",
|
|
2196
|
-
label: "
|
|
3119
|
+
label: "View",
|
|
2197
3120
|
group: "View / Scroll",
|
|
2198
3121
|
description: "Scroll and align viewport",
|
|
2199
3122
|
category: "View",
|
|
@@ -2201,7 +3124,7 @@ function createSpaceMenu(leaderKey = "Space", viewKey = "z") {
|
|
|
2201
3124
|
},
|
|
2202
3125
|
k: {
|
|
2203
3126
|
key: "k",
|
|
2204
|
-
label: "
|
|
3127
|
+
label: "Preset",
|
|
2205
3128
|
group: "Keybinding Preset",
|
|
2206
3129
|
description: "Switch modal grammar (Helix / Vim / Kakoune)",
|
|
2207
3130
|
category: "Space",
|
|
@@ -2236,7 +3159,7 @@ function createSpaceMenu(leaderKey = "Space", viewKey = "z") {
|
|
|
2236
3159
|
function createViewMenu(key, centerKey) {
|
|
2237
3160
|
return {
|
|
2238
3161
|
key,
|
|
2239
|
-
label: "
|
|
3162
|
+
label: "View",
|
|
2240
3163
|
group: "View",
|
|
2241
3164
|
category: "View",
|
|
2242
3165
|
mode: ["normal", "select"],
|
|
@@ -2290,7 +3213,7 @@ function createUnimpairedMenus() {
|
|
|
2290
3213
|
return {
|
|
2291
3214
|
"[": {
|
|
2292
3215
|
key: "[",
|
|
2293
|
-
label: "
|
|
3216
|
+
label: "Previous",
|
|
2294
3217
|
group: "Previous (Unimpaired)",
|
|
2295
3218
|
category: "Unimpaired",
|
|
2296
3219
|
mode: ["normal", "select"],
|
|
@@ -2334,7 +3257,7 @@ function createUnimpairedMenus() {
|
|
|
2334
3257
|
},
|
|
2335
3258
|
"]": {
|
|
2336
3259
|
key: "]",
|
|
2337
|
-
label: "
|
|
3260
|
+
label: "Next",
|
|
2338
3261
|
group: "Next (Unimpaired)",
|
|
2339
3262
|
category: "Unimpaired",
|
|
2340
3263
|
mode: ["normal", "select"],
|
|
@@ -2587,8 +3510,8 @@ function createHelixPreset(leaderKey = "Space") {
|
|
|
2587
3510
|
"Control+w": createWindowMenu(),
|
|
2588
3511
|
g: {
|
|
2589
3512
|
key: "g",
|
|
2590
|
-
label: "
|
|
2591
|
-
group: "
|
|
3513
|
+
label: "Go to",
|
|
3514
|
+
group: "Go to",
|
|
2592
3515
|
category: "Goto",
|
|
2593
3516
|
mode: ["normal", "select"],
|
|
2594
3517
|
children: {
|
|
@@ -2674,7 +3597,7 @@ function createHelixPreset(leaderKey = "Space") {
|
|
|
2674
3597
|
z: createViewMenu("z", "z"),
|
|
2675
3598
|
Z: {
|
|
2676
3599
|
key: "Z",
|
|
2677
|
-
label: "
|
|
3600
|
+
label: "Sticky View",
|
|
2678
3601
|
group: "View (Sticky)",
|
|
2679
3602
|
description: "Lock View menu open until Escape",
|
|
2680
3603
|
category: "View",
|
|
@@ -2685,7 +3608,7 @@ function createHelixPreset(leaderKey = "Space") {
|
|
|
2685
3608
|
},
|
|
2686
3609
|
m: {
|
|
2687
3610
|
key: "m",
|
|
2688
|
-
label: "
|
|
3611
|
+
label: "Match",
|
|
2689
3612
|
group: "Match / Text Objects",
|
|
2690
3613
|
category: "Match / Text Objects",
|
|
2691
3614
|
mode: ["normal", "select"],
|
|
@@ -2768,8 +3691,8 @@ function createVimPreset(leaderKey = "Space") {
|
|
|
2768
3691
|
"Control+w": createWindowMenu(),
|
|
2769
3692
|
g: {
|
|
2770
3693
|
key: "g",
|
|
2771
|
-
label: "
|
|
2772
|
-
group: "
|
|
3694
|
+
label: "Go to",
|
|
3695
|
+
group: "Go to",
|
|
2773
3696
|
category: "Goto",
|
|
2774
3697
|
mode: ["normal", "select"],
|
|
2775
3698
|
children: {
|
|
@@ -2880,7 +3803,7 @@ function createVimPreset(leaderKey = "Space") {
|
|
|
2880
3803
|
z: createViewMenu("z", "z"),
|
|
2881
3804
|
m: {
|
|
2882
3805
|
key: "m",
|
|
2883
|
-
label: "
|
|
3806
|
+
label: "Text Objects",
|
|
2884
3807
|
group: "Text Objects",
|
|
2885
3808
|
category: "Match / Text Objects",
|
|
2886
3809
|
mode: ["normal", "select"],
|
|
@@ -2906,8 +3829,8 @@ function createKakounePreset(leaderKey = "Space") {
|
|
|
2906
3829
|
"Control+w": createWindowMenu(),
|
|
2907
3830
|
g: {
|
|
2908
3831
|
key: "g",
|
|
2909
|
-
label: "
|
|
2910
|
-
group: "
|
|
3832
|
+
label: "Go to",
|
|
3833
|
+
group: "Go to",
|
|
2911
3834
|
category: "Goto",
|
|
2912
3835
|
mode: ["normal", "select"],
|
|
2913
3836
|
children: {
|
|
@@ -3014,7 +3937,7 @@ function createKakounePreset(leaderKey = "Space") {
|
|
|
3014
3937
|
v: createViewMenu("v", "v"),
|
|
3015
3938
|
V: {
|
|
3016
3939
|
key: "V",
|
|
3017
|
-
label: "
|
|
3940
|
+
label: "Lock View",
|
|
3018
3941
|
group: "View (Lock)",
|
|
3019
3942
|
description: "Lock Kakoune View mode open until Escape (V)",
|
|
3020
3943
|
category: "View",
|
|
@@ -3025,7 +3948,7 @@ function createKakounePreset(leaderKey = "Space") {
|
|
|
3025
3948
|
},
|
|
3026
3949
|
m: {
|
|
3027
3950
|
key: "m",
|
|
3028
|
-
label: "
|
|
3951
|
+
label: "Object",
|
|
3029
3952
|
group: "Object / Match",
|
|
3030
3953
|
category: "Match / Text Objects",
|
|
3031
3954
|
mode: ["normal", "select"],
|
|
@@ -3095,11 +4018,98 @@ function getPresetKeymap(preset, leaderKey = "Space") {
|
|
|
3095
4018
|
}
|
|
3096
4019
|
|
|
3097
4020
|
// src/which-key/controller.ts
|
|
3098
|
-
var
|
|
4021
|
+
var import_hotkeys3 = require("@tanstack/hotkeys");
|
|
3099
4022
|
var import_dismissable = require("@zag-js/dismissable");
|
|
3100
4023
|
var import_dom_query = require("@zag-js/dom-query");
|
|
3101
4024
|
var import_focus_visible = require("@zag-js/focus-visible");
|
|
3102
|
-
var
|
|
4025
|
+
var import_live_region2 = require("@zag-js/live-region");
|
|
4026
|
+
var PRIORITY_WEIGHT = {
|
|
4027
|
+
overlay: 60,
|
|
4028
|
+
widget: 50,
|
|
4029
|
+
extension: 40,
|
|
4030
|
+
editor: 30,
|
|
4031
|
+
pane: 20,
|
|
4032
|
+
global: 10
|
|
4033
|
+
};
|
|
4034
|
+
function resolveLayerEnabled(layer) {
|
|
4035
|
+
try {
|
|
4036
|
+
return typeof layer.enabled === "function" ? Boolean(layer.enabled()) : Boolean(layer.enabled);
|
|
4037
|
+
} catch {
|
|
4038
|
+
return false;
|
|
4039
|
+
}
|
|
4040
|
+
}
|
|
4041
|
+
function resolveLayerNodes(layer) {
|
|
4042
|
+
try {
|
|
4043
|
+
return (typeof layer.nodes === "function" ? layer.nodes() : layer.nodes) ?? {};
|
|
4044
|
+
} catch {
|
|
4045
|
+
return {};
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
4048
|
+
function resolveLayerElement(layer) {
|
|
4049
|
+
if (!layer.hasElementOption) return null;
|
|
4050
|
+
try {
|
|
4051
|
+
return (typeof layer.element === "function" ? layer.element() : layer.element) ?? null;
|
|
4052
|
+
} catch {
|
|
4053
|
+
return null;
|
|
4054
|
+
}
|
|
4055
|
+
}
|
|
4056
|
+
function elementContains(container, target) {
|
|
4057
|
+
if (!target) return false;
|
|
4058
|
+
if (container === target) return true;
|
|
4059
|
+
if (typeof container.contains === "function") {
|
|
4060
|
+
try {
|
|
4061
|
+
if (container.contains(target)) return true;
|
|
4062
|
+
} catch {
|
|
4063
|
+
}
|
|
4064
|
+
}
|
|
4065
|
+
let curr = target.parentElement;
|
|
4066
|
+
while (curr) {
|
|
4067
|
+
if (curr === container) return true;
|
|
4068
|
+
curr = curr.parentElement;
|
|
4069
|
+
}
|
|
4070
|
+
return false;
|
|
4071
|
+
}
|
|
4072
|
+
function getElementDepth(el) {
|
|
4073
|
+
let depth = 0;
|
|
4074
|
+
let curr = el.parentElement;
|
|
4075
|
+
while (curr) {
|
|
4076
|
+
depth += 1;
|
|
4077
|
+
curr = curr.parentElement;
|
|
4078
|
+
}
|
|
4079
|
+
return depth;
|
|
4080
|
+
}
|
|
4081
|
+
function compareResolvedLayers(a, b) {
|
|
4082
|
+
if (Boolean(a.isPreset) !== Boolean(b.isPreset)) {
|
|
4083
|
+
return a.isPreset ? 1 : -1;
|
|
4084
|
+
}
|
|
4085
|
+
const aIsOverlay = a.priority === "overlay";
|
|
4086
|
+
const bIsOverlay = b.priority === "overlay";
|
|
4087
|
+
if (aIsOverlay !== bIsOverlay) {
|
|
4088
|
+
return aIsOverlay ? -1 : 1;
|
|
4089
|
+
}
|
|
4090
|
+
if (a.matchedElement && b.matchedElement) {
|
|
4091
|
+
if (a.matchedElement !== b.matchedElement) {
|
|
4092
|
+
if (elementContains(a.matchedElement, b.matchedElement)) {
|
|
4093
|
+
return 1;
|
|
4094
|
+
}
|
|
4095
|
+
if (elementContains(b.matchedElement, a.matchedElement)) {
|
|
4096
|
+
return -1;
|
|
4097
|
+
}
|
|
4098
|
+
if (b.elementDepth !== a.elementDepth) {
|
|
4099
|
+
return b.elementDepth - a.elementDepth;
|
|
4100
|
+
}
|
|
4101
|
+
}
|
|
4102
|
+
} else if (a.matchedElement && !b.matchedElement) {
|
|
4103
|
+
return -1;
|
|
4104
|
+
} else if (!a.matchedElement && b.matchedElement) {
|
|
4105
|
+
return 1;
|
|
4106
|
+
}
|
|
4107
|
+
const weightDiff = PRIORITY_WEIGHT[b.priority] - PRIORITY_WEIGHT[a.priority];
|
|
4108
|
+
if (weightDiff !== 0) {
|
|
4109
|
+
return weightDiff;
|
|
4110
|
+
}
|
|
4111
|
+
return b.registrationOrder - a.registrationOrder;
|
|
4112
|
+
}
|
|
3103
4113
|
function mergeKeymapTrees(base, overlay) {
|
|
3104
4114
|
const result = { ...base };
|
|
3105
4115
|
for (const [key, node] of Object.entries(overlay)) {
|
|
@@ -3164,8 +4174,8 @@ function isTextEntryElement(el) {
|
|
|
3164
4174
|
function eventToChordKeys(event) {
|
|
3165
4175
|
const rawKey = event.key;
|
|
3166
4176
|
if (!rawKey) return [];
|
|
3167
|
-
const normalizedName = (0,
|
|
3168
|
-
if ((0,
|
|
4177
|
+
const normalizedName = (0, import_hotkeys3.normalizeKeyName)(rawKey);
|
|
4178
|
+
if ((0, import_hotkeys3.isModifierKey)(normalizedName) || rawKey === "Shift" || rawKey === "Control" || rawKey === "Alt" || rawKey === "Meta") {
|
|
3169
4179
|
return [];
|
|
3170
4180
|
}
|
|
3171
4181
|
const hasCtrl = event.ctrlKey;
|
|
@@ -3185,8 +4195,23 @@ function eventToChordKeys(event) {
|
|
|
3185
4195
|
if (baseKey.length === 1 && baseKey.toLowerCase() !== baseKey) {
|
|
3186
4196
|
candidates2.push([...mods, baseKey.toLowerCase()].join("+"));
|
|
3187
4197
|
}
|
|
4198
|
+
if (hasCtrl !== hasMeta) {
|
|
4199
|
+
const modAliasMods = ["Mod"];
|
|
4200
|
+
if (hasAlt) modAliasMods.push("Alt");
|
|
4201
|
+
if (hasShift) modAliasMods.push("Shift");
|
|
4202
|
+
const modPrimary = [...modAliasMods, primaryKey].join("+");
|
|
4203
|
+
if (!candidates2.includes(modPrimary)) {
|
|
4204
|
+
candidates2.push(modPrimary);
|
|
4205
|
+
}
|
|
4206
|
+
if (baseKey.length === 1 && baseKey.toLowerCase() !== baseKey) {
|
|
4207
|
+
const modLower = [...modAliasMods, baseKey.toLowerCase()].join("+");
|
|
4208
|
+
if (!candidates2.includes(modLower)) {
|
|
4209
|
+
candidates2.push(modLower);
|
|
4210
|
+
}
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
3188
4213
|
try {
|
|
3189
|
-
const parsed = (0,
|
|
4214
|
+
const parsed = (0, import_hotkeys3.parseKeyboardEvent)(event);
|
|
3190
4215
|
if (parsed?.key) {
|
|
3191
4216
|
const parsedMods = [];
|
|
3192
4217
|
if (parsed.ctrl) parsedMods.push("Control");
|
|
@@ -3202,7 +4227,14 @@ function eventToChordKeys(event) {
|
|
|
3202
4227
|
}
|
|
3203
4228
|
return candidates2;
|
|
3204
4229
|
}
|
|
3205
|
-
const candidates = [
|
|
4230
|
+
const candidates = [];
|
|
4231
|
+
if (hasShift && baseKey.length > 1) {
|
|
4232
|
+
candidates.push(`Shift+${baseKey}`);
|
|
4233
|
+
if (normalizedName !== baseKey) {
|
|
4234
|
+
candidates.push(`Shift+${normalizedName}`);
|
|
4235
|
+
}
|
|
4236
|
+
}
|
|
4237
|
+
candidates.push(baseKey);
|
|
3206
4238
|
if (hasShift && baseKey.length === 1) {
|
|
3207
4239
|
candidates.push(`Shift+${baseKey.toUpperCase()}`);
|
|
3208
4240
|
candidates.push(`Shift+${baseKey}`);
|
|
@@ -3226,15 +4258,18 @@ function getTopMostModalDialog(doc) {
|
|
|
3226
4258
|
}
|
|
3227
4259
|
return dialogs[dialogs.length - 1] ?? null;
|
|
3228
4260
|
}
|
|
3229
|
-
function getPaneFocusableItems(container, ownScope) {
|
|
4261
|
+
function getPaneFocusableItems(container, ownScope, ignoreEnteredExample = false) {
|
|
3230
4262
|
const doc = container.ownerDocument;
|
|
3231
4263
|
const activeEl = doc?.activeElement instanceof HTMLElement ? doc.activeElement : null;
|
|
3232
|
-
const enteredExample = !ownScope && activeEl && !activeEl.hasAttribute("data-example") ? activeEl.closest("[data-example]") : null;
|
|
4264
|
+
const enteredExample = !ignoreEnteredExample && !ownScope && activeEl && !activeEl.hasAttribute("data-example") ? activeEl.closest("[data-example]") : null;
|
|
3233
4265
|
const searchRoot = enteredExample && container.contains(enteredExample) ? enteredExample.querySelector("[data-example-preview]") ?? enteredExample : container;
|
|
3234
4266
|
const raw = (0, import_dom_query.getFocusables)(searchRoot, { includeContainer: false });
|
|
3235
4267
|
return raw.filter((el) => {
|
|
3236
4268
|
if (!(el instanceof HTMLElement)) return false;
|
|
3237
|
-
if (el.
|
|
4269
|
+
if (el.tabIndex < 0 && el.getAttribute("role") !== "tab") return false;
|
|
4270
|
+
if (el.closest(
|
|
4271
|
+
'[data-which-key-root], [data-which-key-explorer], [data-which-key-jump-overlay], [data-scope="toast"]'
|
|
4272
|
+
)) {
|
|
3238
4273
|
return false;
|
|
3239
4274
|
}
|
|
3240
4275
|
const fwEl = el.closest("[data-fw]");
|
|
@@ -3269,7 +4304,10 @@ function getJumpableItems(container, ownScope) {
|
|
|
3269
4304
|
for (const el of [...rawFocusables, ...rawTabs]) {
|
|
3270
4305
|
if (!(el instanceof HTMLElement) || seen.has(el)) continue;
|
|
3271
4306
|
seen.add(el);
|
|
3272
|
-
if (el.
|
|
4307
|
+
if (el.tabIndex < 0 && el.getAttribute("role") !== "tab") continue;
|
|
4308
|
+
if (el.closest(
|
|
4309
|
+
'[data-which-key-root], [data-which-key-explorer], [data-which-key-jump-overlay], [data-scope="toast"]'
|
|
4310
|
+
)) {
|
|
3273
4311
|
continue;
|
|
3274
4312
|
}
|
|
3275
4313
|
const fwEl = el.closest("[data-fw]");
|
|
@@ -3303,7 +4341,33 @@ function notifyRootControllerListeners(doc) {
|
|
|
3303
4341
|
function getDocumentWhichKeyController(doc) {
|
|
3304
4342
|
const resolved = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
3305
4343
|
if (!resolved) return null;
|
|
3306
|
-
|
|
4344
|
+
const root = rootControllerByDoc.get(resolved);
|
|
4345
|
+
if (root) return root;
|
|
4346
|
+
const entries = attachedEntriesByDoc.get(resolved);
|
|
4347
|
+
if (!entries || entries.size === 0) return null;
|
|
4348
|
+
const activeEl = resolved.activeElement && isElementLike(resolved.activeElement) ? resolved.activeElement : null;
|
|
4349
|
+
const focusedScope = activeEl ? activeEl.closest?.("[data-which-key-scope]") ?? null : null;
|
|
4350
|
+
if (focusedScope) {
|
|
4351
|
+
for (const entry of entries) {
|
|
4352
|
+
if (entry.getScopeElement() === focusedScope) {
|
|
4353
|
+
return entry.controller;
|
|
4354
|
+
}
|
|
4355
|
+
}
|
|
4356
|
+
}
|
|
4357
|
+
const remembered = lastInteractedScopeByDoc.get(resolved) ?? null;
|
|
4358
|
+
if (remembered) {
|
|
4359
|
+
for (const entry of entries) {
|
|
4360
|
+
if (entry.getScopeElement() === remembered) {
|
|
4361
|
+
return entry.controller;
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
for (const entry of entries) {
|
|
4366
|
+
if (isScopeElementActive(entry.getScopeElement(), resolved)) {
|
|
4367
|
+
return entry.controller;
|
|
4368
|
+
}
|
|
4369
|
+
}
|
|
4370
|
+
return Array.from(entries)[0]?.controller ?? null;
|
|
3307
4371
|
}
|
|
3308
4372
|
function subscribeDocumentWhichKeyController(doc, listener) {
|
|
3309
4373
|
const resolved = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
@@ -3420,9 +4484,31 @@ function createWhichKeyController(options = {}) {
|
|
|
3420
4484
|
} catch {
|
|
3421
4485
|
}
|
|
3422
4486
|
}
|
|
4487
|
+
function readStoredLeaderOnly() {
|
|
4488
|
+
if (!storageKey || typeof window === "undefined") return null;
|
|
4489
|
+
try {
|
|
4490
|
+
const raw = window.localStorage.getItem(`${storageKey}:leader-only`);
|
|
4491
|
+
if (raw === "true") return true;
|
|
4492
|
+
if (raw === "false") return false;
|
|
4493
|
+
} catch {
|
|
4494
|
+
}
|
|
4495
|
+
return null;
|
|
4496
|
+
}
|
|
4497
|
+
function writeStoredLeaderOnly(next) {
|
|
4498
|
+
const doc = resolveDoc();
|
|
4499
|
+
if (doc?.documentElement && !options.getScopeElement?.()) {
|
|
4500
|
+
doc.documentElement.dataset.whichKeyLeaderOnly = String(next);
|
|
4501
|
+
}
|
|
4502
|
+
if (!storageKey || typeof window === "undefined") return;
|
|
4503
|
+
try {
|
|
4504
|
+
window.localStorage.setItem(`${storageKey}:leader-only`, String(next));
|
|
4505
|
+
} catch {
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
3423
4508
|
let preset = options.preset ?? readStoredPreset() ?? "helix";
|
|
3424
4509
|
let mode = options.defaultMode ?? "normal";
|
|
3425
4510
|
const leaderKey = options.leaderKey ?? "Space";
|
|
4511
|
+
let leaderOnly = options.leaderOnly ?? readStoredLeaderOnly() ?? false;
|
|
3426
4512
|
let jumpAction = options.jumpAction ?? readStoredJumpAction() ?? "activate";
|
|
3427
4513
|
const jumpAlphabet = options.jumpAlphabet ?? DEFAULT_JUMP_ALPHABET;
|
|
3428
4514
|
const listeners = /* @__PURE__ */ new Set();
|
|
@@ -3430,11 +4516,15 @@ function createWhichKeyController(options = {}) {
|
|
|
3430
4516
|
const commandHandlers = /* @__PURE__ */ new Map();
|
|
3431
4517
|
const panes = /* @__PURE__ */ new Map();
|
|
3432
4518
|
const jumplist = createJumplist(50);
|
|
4519
|
+
let layerRegistrationCounter = 0;
|
|
3433
4520
|
if (options.keymap) {
|
|
3434
4521
|
keymapLayers.set("__initial__", {
|
|
3435
4522
|
id: "__initial__",
|
|
3436
4523
|
nodes: options.keymap,
|
|
3437
|
-
enabled: true
|
|
4524
|
+
enabled: true,
|
|
4525
|
+
priority: "global",
|
|
4526
|
+
hasElementOption: false,
|
|
4527
|
+
registrationOrder: ++layerRegistrationCounter
|
|
3438
4528
|
});
|
|
3439
4529
|
}
|
|
3440
4530
|
if (options.commands) {
|
|
@@ -3470,12 +4560,64 @@ function createWhichKeyController(options = {}) {
|
|
|
3470
4560
|
} catch {
|
|
3471
4561
|
}
|
|
3472
4562
|
}
|
|
3473
|
-
function
|
|
3474
|
-
|
|
4563
|
+
function getOrderedActiveLayers(event, includePreset = true, ignoreElementContainment = false) {
|
|
4564
|
+
const doc = resolveDoc();
|
|
4565
|
+
const rawEventTarget = event?.target ?? null;
|
|
4566
|
+
const eventTargetEl = isElementLike(rawEventTarget) ? rawEventTarget : null;
|
|
4567
|
+
const activeEl = doc?.activeElement && isElementLike(doc.activeElement) ? doc.activeElement : null;
|
|
4568
|
+
const resolved = [];
|
|
3475
4569
|
for (const layer of keymapLayers.values()) {
|
|
3476
|
-
if (!layer
|
|
4570
|
+
if (!resolveLayerEnabled(layer)) continue;
|
|
3477
4571
|
if (layer.scope && layer.scope !== activePaneId) continue;
|
|
3478
|
-
|
|
4572
|
+
let matchedElement = null;
|
|
4573
|
+
let elementDepth = -1;
|
|
4574
|
+
if (layer.hasElementOption) {
|
|
4575
|
+
const el = resolveLayerElement(layer);
|
|
4576
|
+
if (!el) continue;
|
|
4577
|
+
if (!ignoreElementContainment) {
|
|
4578
|
+
const containsEventTarget = elementContains(el, eventTargetEl);
|
|
4579
|
+
const containsActiveEl = elementContains(el, activeEl);
|
|
4580
|
+
if (!containsEventTarget && !containsActiveEl) continue;
|
|
4581
|
+
}
|
|
4582
|
+
matchedElement = el;
|
|
4583
|
+
elementDepth = getElementDepth(el);
|
|
4584
|
+
}
|
|
4585
|
+
if (layer.matchesTarget && event) {
|
|
4586
|
+
const checkTarget = rawEventTarget ?? activeEl;
|
|
4587
|
+
try {
|
|
4588
|
+
if (!layer.matchesTarget(checkTarget, event)) continue;
|
|
4589
|
+
} catch {
|
|
4590
|
+
continue;
|
|
4591
|
+
}
|
|
4592
|
+
}
|
|
4593
|
+
resolved.push({
|
|
4594
|
+
id: layer.id,
|
|
4595
|
+
nodes: resolveLayerNodes(layer),
|
|
4596
|
+
priority: layer.priority,
|
|
4597
|
+
matchedElement,
|
|
4598
|
+
elementDepth,
|
|
4599
|
+
registrationOrder: layer.registrationOrder
|
|
4600
|
+
});
|
|
4601
|
+
}
|
|
4602
|
+
resolved.sort(compareResolvedLayers);
|
|
4603
|
+
if (includePreset) {
|
|
4604
|
+
resolved.push({
|
|
4605
|
+
id: "__preset__",
|
|
4606
|
+
nodes: getPresetKeymap(preset, leaderKey),
|
|
4607
|
+
priority: "global",
|
|
4608
|
+
matchedElement: null,
|
|
4609
|
+
elementDepth: -1,
|
|
4610
|
+
registrationOrder: -1,
|
|
4611
|
+
isPreset: true
|
|
4612
|
+
});
|
|
4613
|
+
}
|
|
4614
|
+
return resolved;
|
|
4615
|
+
}
|
|
4616
|
+
function buildMergedTrie() {
|
|
4617
|
+
const layers = getOrderedActiveLayers(void 0, true, true);
|
|
4618
|
+
let trie = {};
|
|
4619
|
+
for (let i = layers.length - 1; i >= 0; i -= 1) {
|
|
4620
|
+
trie = mergeKeymapTrees(trie, layers[i].nodes);
|
|
3479
4621
|
}
|
|
3480
4622
|
return trie;
|
|
3481
4623
|
}
|
|
@@ -3512,7 +4654,7 @@ function createWhichKeyController(options = {}) {
|
|
|
3512
4654
|
order,
|
|
3513
4655
|
lastFocusedElement: existing?.lastFocusedElement ?? null
|
|
3514
4656
|
});
|
|
3515
|
-
if (!activePaneId &&
|
|
4657
|
+
if (!disabled && (!activePaneId || id === "docs-main" && activePaneId === "docs-sidebar")) {
|
|
3516
4658
|
activePaneId = id;
|
|
3517
4659
|
}
|
|
3518
4660
|
}
|
|
@@ -3542,11 +4684,12 @@ function createWhichKeyController(options = {}) {
|
|
|
3542
4684
|
preset,
|
|
3543
4685
|
mode,
|
|
3544
4686
|
leaderKey,
|
|
4687
|
+
leaderOnly,
|
|
3545
4688
|
activePath: [...activePath],
|
|
3546
4689
|
breadcrumb: tree.breadcrumb,
|
|
3547
4690
|
title: tree.title,
|
|
3548
4691
|
items: tree.items,
|
|
3549
|
-
isOpen: activePath.length > 0 && tree.items.length > 0,
|
|
4692
|
+
isOpen: activePath.length > 0 && tree.items.length > 0 && (!leaderOnly || activePath[0] === leaderKey),
|
|
3550
4693
|
sticky: sticky || tree.sticky,
|
|
3551
4694
|
countBuffer,
|
|
3552
4695
|
explorerOpen,
|
|
@@ -3635,6 +4778,13 @@ function createWhichKeyController(options = {}) {
|
|
|
3635
4778
|
announce(`Switched to ${nextPreset} preset`);
|
|
3636
4779
|
emit();
|
|
3637
4780
|
}
|
|
4781
|
+
function setLeaderOnly(nextLeaderOnly) {
|
|
4782
|
+
if (leaderOnly === nextLeaderOnly) return;
|
|
4783
|
+
leaderOnly = nextLeaderOnly;
|
|
4784
|
+
writeStoredLeaderOnly(nextLeaderOnly);
|
|
4785
|
+
options.onLeaderOnlyChange?.(nextLeaderOnly);
|
|
4786
|
+
emit();
|
|
4787
|
+
}
|
|
3638
4788
|
function setJumpAction(action) {
|
|
3639
4789
|
if (jumpAction === action) return;
|
|
3640
4790
|
jumpAction = action;
|
|
@@ -3782,17 +4932,23 @@ function createWhichKeyController(options = {}) {
|
|
|
3782
4932
|
function jumpToBoundary(boundary) {
|
|
3783
4933
|
const container = getActiveContainer();
|
|
3784
4934
|
if (!container) return false;
|
|
3785
|
-
const
|
|
3786
|
-
|
|
4935
|
+
const ownScope = options.getScopeElement?.() ?? null;
|
|
4936
|
+
const ignoreEnteredExample = boundary === "start" || boundary === "end";
|
|
4937
|
+
const items = getPaneFocusableItems(container, ownScope, ignoreEnteredExample);
|
|
3787
4938
|
const doc = resolveDoc();
|
|
3788
4939
|
const win = doc?.defaultView ?? null;
|
|
4940
|
+
if (items.length === 0 && boundary !== "start" && boundary !== "end") {
|
|
4941
|
+
return false;
|
|
4942
|
+
}
|
|
3789
4943
|
recordCurrentLocation();
|
|
3790
4944
|
if (boundary === "start" || boundary === "first-in-group") {
|
|
3791
4945
|
const target2 = items[0];
|
|
3792
|
-
|
|
4946
|
+
if (target2) {
|
|
4947
|
+
focusElementInActivePane(target2);
|
|
4948
|
+
}
|
|
3793
4949
|
if (boundary === "start") {
|
|
3794
4950
|
container.scrollTop = 0;
|
|
3795
|
-
if (win && !isScrollableContainer(container, doc)) {
|
|
4951
|
+
if (win && !ownScope && !isScrollableContainer(container, doc)) {
|
|
3796
4952
|
try {
|
|
3797
4953
|
win.scrollTo({ top: 0, behavior: "instant" });
|
|
3798
4954
|
} catch {
|
|
@@ -3805,10 +4961,12 @@ function createWhichKeyController(options = {}) {
|
|
|
3805
4961
|
return true;
|
|
3806
4962
|
}
|
|
3807
4963
|
const target = items[items.length - 1];
|
|
3808
|
-
|
|
4964
|
+
if (target) {
|
|
4965
|
+
focusElementInActivePane(target);
|
|
4966
|
+
}
|
|
3809
4967
|
if (boundary === "end") {
|
|
3810
4968
|
container.scrollTop = container.scrollHeight;
|
|
3811
|
-
if (win && !isScrollableContainer(container, doc)) {
|
|
4969
|
+
if (win && !ownScope && !isScrollableContainer(container, doc)) {
|
|
3812
4970
|
const scrollMax = Math.max(
|
|
3813
4971
|
doc?.documentElement?.scrollHeight ?? 0,
|
|
3814
4972
|
doc?.body?.scrollHeight ?? 0,
|
|
@@ -4566,29 +5724,124 @@ function createWhichKeyController(options = {}) {
|
|
|
4566
5724
|
options.onCommand?.(commandId, ctx);
|
|
4567
5725
|
return handled;
|
|
4568
5726
|
}
|
|
4569
|
-
function
|
|
5727
|
+
function createCommandContext(event) {
|
|
4570
5728
|
const count = countBuffer ? Math.max(1, Number.parseInt(countBuffer, 10)) : 1;
|
|
4571
|
-
|
|
5729
|
+
return {
|
|
4572
5730
|
count,
|
|
4573
5731
|
mode,
|
|
4574
5732
|
preset,
|
|
4575
5733
|
activePaneId,
|
|
4576
5734
|
event
|
|
4577
5735
|
};
|
|
5736
|
+
}
|
|
5737
|
+
function tryInvokeLeafNode(node, ctx) {
|
|
5738
|
+
if (node.when && !node.when(ctx)) {
|
|
5739
|
+
return false;
|
|
5740
|
+
}
|
|
4578
5741
|
let handled = false;
|
|
4579
5742
|
if (node.action) {
|
|
4580
5743
|
const res = node.action(ctx);
|
|
4581
5744
|
handled = res !== false;
|
|
4582
5745
|
}
|
|
4583
|
-
if (!handled && node.commandId) {
|
|
5746
|
+
if (!handled && !node.action && node.commandId) {
|
|
4584
5747
|
handled = executeCommand(node.commandId, ctx);
|
|
4585
5748
|
}
|
|
5749
|
+
if (!handled) {
|
|
5750
|
+
return false;
|
|
5751
|
+
}
|
|
4586
5752
|
countBuffer = "";
|
|
4587
5753
|
if (!sticky) {
|
|
4588
5754
|
activePath = [];
|
|
4589
5755
|
}
|
|
4590
5756
|
emit();
|
|
4591
|
-
return
|
|
5757
|
+
return true;
|
|
5758
|
+
}
|
|
5759
|
+
function evaluateLayersInPrefix(chordCandidates, event) {
|
|
5760
|
+
const layers = getOrderedActiveLayers(event, true);
|
|
5761
|
+
const mergedTrie = buildMergedTrie();
|
|
5762
|
+
let matchedAnyNode = false;
|
|
5763
|
+
for (const layer of layers) {
|
|
5764
|
+
const parentNode = resolveNode(layer.nodes, activePath, mode, mergedTrie);
|
|
5765
|
+
if (!parentNode) continue;
|
|
5766
|
+
const children = getNodeChildren(parentNode, mergedTrie);
|
|
5767
|
+
for (const candidate of chordCandidates) {
|
|
5768
|
+
const child = children[candidate];
|
|
5769
|
+
if (!child || !nodeMatchesMode(child, mode)) continue;
|
|
5770
|
+
matchedAnyNode = true;
|
|
5771
|
+
const ctx = createCommandContext(event);
|
|
5772
|
+
if (child.when && !child.when(ctx)) continue;
|
|
5773
|
+
if (!child.action && !child.commandId && isGroupNode(child, mergedTrie)) {
|
|
5774
|
+
activePath = [...activePath, candidate];
|
|
5775
|
+
if (child.sticky || child.loop) {
|
|
5776
|
+
sticky = true;
|
|
5777
|
+
}
|
|
5778
|
+
announce(`${child.group ?? child.label} menu`);
|
|
5779
|
+
emit();
|
|
5780
|
+
if (event) {
|
|
5781
|
+
event.preventDefault();
|
|
5782
|
+
event.stopPropagation();
|
|
5783
|
+
}
|
|
5784
|
+
return { handled: true, matchedAnyNode: true };
|
|
5785
|
+
}
|
|
5786
|
+
if (tryInvokeLeafNode(child, ctx)) {
|
|
5787
|
+
if (event) {
|
|
5788
|
+
event.preventDefault();
|
|
5789
|
+
event.stopPropagation();
|
|
5790
|
+
}
|
|
5791
|
+
return { handled: true, matchedAnyNode: true };
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
return { handled: false, matchedAnyNode };
|
|
5796
|
+
}
|
|
5797
|
+
function evaluateLayersAtRoot(chordCandidates, event, evalOptions = {}) {
|
|
5798
|
+
const insertModeOnly = Boolean(evalOptions.insertModeOnly);
|
|
5799
|
+
const includePreset = evalOptions.includePreset ?? !insertModeOnly;
|
|
5800
|
+
const layers = getOrderedActiveLayers(event, includePreset);
|
|
5801
|
+
let mergedTrieCache = null;
|
|
5802
|
+
const getMerged = () => mergedTrieCache ??= buildMergedTrie();
|
|
5803
|
+
for (const layer of layers) {
|
|
5804
|
+
for (const candidate of chordCandidates) {
|
|
5805
|
+
const node = layer.nodes[candidate];
|
|
5806
|
+
if (!node) continue;
|
|
5807
|
+
if (insertModeOnly) {
|
|
5808
|
+
if (!nodeExplicitlyIncludesMode(node, "insert")) continue;
|
|
5809
|
+
} else if (!nodeMatchesMode(node, mode)) {
|
|
5810
|
+
continue;
|
|
5811
|
+
}
|
|
5812
|
+
const ctx = createCommandContext(event);
|
|
5813
|
+
if (node.when && !node.when(ctx)) continue;
|
|
5814
|
+
if (!node.action && !node.commandId && isGroupNode(node, getMerged())) {
|
|
5815
|
+
activePath = [candidate];
|
|
5816
|
+
sticky = Boolean(node.sticky || node.loop);
|
|
5817
|
+
announce(`${node.group ?? node.label} menu`);
|
|
5818
|
+
emit();
|
|
5819
|
+
if (event) {
|
|
5820
|
+
event.preventDefault();
|
|
5821
|
+
event.stopPropagation();
|
|
5822
|
+
}
|
|
5823
|
+
return true;
|
|
5824
|
+
}
|
|
5825
|
+
if (tryInvokeLeafNode(node, ctx)) {
|
|
5826
|
+
if (event) {
|
|
5827
|
+
event.preventDefault();
|
|
5828
|
+
event.stopPropagation();
|
|
5829
|
+
}
|
|
5830
|
+
return true;
|
|
5831
|
+
}
|
|
5832
|
+
}
|
|
5833
|
+
}
|
|
5834
|
+
return false;
|
|
5835
|
+
}
|
|
5836
|
+
function hasRegisteredNodeForCandidate(candidate, event) {
|
|
5837
|
+
const layers = getOrderedActiveLayers(event, false);
|
|
5838
|
+
for (const layer of layers) {
|
|
5839
|
+
const node = layer.nodes[candidate];
|
|
5840
|
+
if (node && nodeMatchesMode(node, mode)) {
|
|
5841
|
+
return true;
|
|
5842
|
+
}
|
|
5843
|
+
}
|
|
5844
|
+
return false;
|
|
4592
5845
|
}
|
|
4593
5846
|
function executeExplorerEntry(entryOrId) {
|
|
4594
5847
|
const state = computeState();
|
|
@@ -4668,51 +5921,29 @@ function createWhichKeyController(options = {}) {
|
|
|
4668
5921
|
return false;
|
|
4669
5922
|
}
|
|
4670
5923
|
function triggerKey(key, event) {
|
|
4671
|
-
|
|
5924
|
+
if (mode === "insert") {
|
|
5925
|
+
return evaluateLayersAtRoot([key], event, { insertModeOnly: true, includePreset: false });
|
|
5926
|
+
}
|
|
4672
5927
|
if (activePath.length > 0) {
|
|
4673
|
-
const
|
|
4674
|
-
if (!
|
|
5928
|
+
const { handled } = evaluateLayersInPrefix([key], event);
|
|
5929
|
+
if (!handled && !sticky) {
|
|
4675
5930
|
closePrefix();
|
|
4676
|
-
return false;
|
|
4677
5931
|
}
|
|
4678
|
-
|
|
4679
|
-
const child = children[key];
|
|
4680
|
-
if (!child || !nodeMatchesMode(child, mode)) {
|
|
4681
|
-
if (!sticky) {
|
|
4682
|
-
closePrefix();
|
|
4683
|
-
}
|
|
4684
|
-
return false;
|
|
4685
|
-
}
|
|
4686
|
-
if (isGroupNode(child, rootTrie)) {
|
|
4687
|
-
activePath = [...activePath, key];
|
|
4688
|
-
if (child.sticky || child.loop) {
|
|
4689
|
-
sticky = true;
|
|
4690
|
-
}
|
|
4691
|
-
announce(`${child.group ?? child.label} menu`);
|
|
4692
|
-
emit();
|
|
4693
|
-
return true;
|
|
4694
|
-
}
|
|
4695
|
-
return invokeNode(child, event);
|
|
5932
|
+
return handled;
|
|
4696
5933
|
}
|
|
4697
|
-
|
|
5934
|
+
const rootTrie = buildMergedTrie();
|
|
5935
|
+
if (/^[0-9]$/.test(key) && !hasRegisteredNodeForCandidate(key, event) && (countBuffer.length > 0 || key !== "0" || !rootTrie["0"])) {
|
|
4698
5936
|
if (countBuffer.length > 0 || key !== "0") {
|
|
4699
5937
|
countBuffer += key;
|
|
4700
5938
|
emit();
|
|
5939
|
+
if (event) {
|
|
5940
|
+
event.preventDefault();
|
|
5941
|
+
event.stopPropagation();
|
|
5942
|
+
}
|
|
4701
5943
|
return true;
|
|
4702
5944
|
}
|
|
4703
5945
|
}
|
|
4704
|
-
|
|
4705
|
-
if (!rootNode || !nodeMatchesMode(rootNode, mode)) {
|
|
4706
|
-
return false;
|
|
4707
|
-
}
|
|
4708
|
-
if (isGroupNode(rootNode, rootTrie)) {
|
|
4709
|
-
activePath = [key];
|
|
4710
|
-
sticky = Boolean(rootNode.sticky || rootNode.loop);
|
|
4711
|
-
announce(`${rootNode.group ?? rootNode.label} menu`);
|
|
4712
|
-
emit();
|
|
4713
|
-
return true;
|
|
4714
|
-
}
|
|
4715
|
-
return invokeNode(rootNode, event);
|
|
5946
|
+
return evaluateLayersAtRoot([key], event, { insertModeOnly: false, includePreset: true });
|
|
4716
5947
|
}
|
|
4717
5948
|
function handleKeyDown(event) {
|
|
4718
5949
|
if (!isControllerEnabled()) return false;
|
|
@@ -4730,9 +5961,21 @@ function createWhichKeyController(options = {}) {
|
|
|
4730
5961
|
}
|
|
4731
5962
|
const doc = resolveDoc();
|
|
4732
5963
|
const targetEl = (isElementLike(event.target) ? event.target : null) ?? doc?.activeElement ?? null;
|
|
5964
|
+
if (targetEl && isHTMLElementLike(targetEl) && typeof targetEl.closest === "function" && (targetEl.closest(
|
|
5965
|
+
'[data-command-palette][data-modal="true"], [data-command-menu][data-modal="true"], [data-colon-command][data-modal="true"]'
|
|
5966
|
+
) || isTextEntryElement(targetEl) && targetEl.closest("[data-command-palette], [data-command-menu], [data-colon-command]"))) {
|
|
5967
|
+
return false;
|
|
5968
|
+
}
|
|
4733
5969
|
const editorTarget = getModalEditor(targetEl);
|
|
4734
5970
|
const inEditable = isTextEntryElement(targetEl);
|
|
4735
5971
|
if (mode === "insert") {
|
|
5972
|
+
const insertChordCandidates = eventToChordKeys(event);
|
|
5973
|
+
if (insertChordCandidates.length > 0 && evaluateLayersAtRoot(insertChordCandidates, event, {
|
|
5974
|
+
insertModeOnly: true,
|
|
5975
|
+
includePreset: false
|
|
5976
|
+
})) {
|
|
5977
|
+
return true;
|
|
5978
|
+
}
|
|
4736
5979
|
if (event.key === "Escape") {
|
|
4737
5980
|
if (editorTarget?.hasActiveSuggestion?.()) {
|
|
4738
5981
|
return false;
|
|
@@ -4765,19 +6008,52 @@ function createWhichKeyController(options = {}) {
|
|
|
4765
6008
|
}
|
|
4766
6009
|
const chordCandidates2 = eventToChordKeys(event);
|
|
4767
6010
|
if (chordCandidates2.length === 0) return false;
|
|
4768
|
-
const
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
const matchedChord = chordCandidates2.find((c) => Boolean(children[c]));
|
|
4772
|
-
event.preventDefault();
|
|
4773
|
-
event.stopPropagation();
|
|
4774
|
-
if (matchedChord) {
|
|
4775
|
-
return triggerKey(matchedChord, event);
|
|
6011
|
+
const { handled, matchedAnyNode } = evaluateLayersInPrefix(chordCandidates2, event);
|
|
6012
|
+
if (handled) {
|
|
6013
|
+
return true;
|
|
4776
6014
|
}
|
|
4777
6015
|
if (!sticky) {
|
|
4778
6016
|
closePrefix();
|
|
4779
6017
|
}
|
|
4780
|
-
|
|
6018
|
+
if (!matchedAnyNode) {
|
|
6019
|
+
event.preventDefault();
|
|
6020
|
+
event.stopPropagation();
|
|
6021
|
+
return true;
|
|
6022
|
+
}
|
|
6023
|
+
return false;
|
|
6024
|
+
}
|
|
6025
|
+
const chordCandidates = eventToChordKeys(event);
|
|
6026
|
+
if (event.key === " " && !event.ctrlKey && !event.metaKey && !event.altKey && targetEl) {
|
|
6027
|
+
const role = targetEl.getAttribute("role");
|
|
6028
|
+
const isToggleControl = targetEl instanceof HTMLInputElement && (targetEl.type === "checkbox" || targetEl.type === "radio") || role === "checkbox" || role === "switch" || role === "radio";
|
|
6029
|
+
if (isToggleControl) {
|
|
6030
|
+
return false;
|
|
6031
|
+
}
|
|
6032
|
+
const isButtonControl = targetEl.tagName === "BUTTON" || role === "button";
|
|
6033
|
+
if (isButtonControl) {
|
|
6034
|
+
const previewAncestor = targetEl.closest("[data-example-preview]");
|
|
6035
|
+
const ownScope = options.getScopeElement?.() ?? null;
|
|
6036
|
+
if (previewAncestor && (!ownScope || !previewAncestor.contains(ownScope))) {
|
|
6037
|
+
return false;
|
|
6038
|
+
}
|
|
6039
|
+
}
|
|
6040
|
+
}
|
|
6041
|
+
if (chordCandidates.length > 0) {
|
|
6042
|
+
const rootTrie = buildMergedTrie();
|
|
6043
|
+
for (const candidate of chordCandidates) {
|
|
6044
|
+
if (/^[0-9]$/.test(candidate) && !hasRegisteredNodeForCandidate(candidate, event) && (countBuffer.length > 0 || candidate !== "0" || !rootTrie["0"])) {
|
|
6045
|
+
if (countBuffer.length > 0 || candidate !== "0") {
|
|
6046
|
+
countBuffer += keyFromCandidate(candidate);
|
|
6047
|
+
emit();
|
|
6048
|
+
event.preventDefault();
|
|
6049
|
+
event.stopPropagation();
|
|
6050
|
+
return true;
|
|
6051
|
+
}
|
|
6052
|
+
}
|
|
6053
|
+
}
|
|
6054
|
+
if (evaluateLayersAtRoot(chordCandidates, event, { insertModeOnly: false, includePreset: true })) {
|
|
6055
|
+
return true;
|
|
6056
|
+
}
|
|
4781
6057
|
}
|
|
4782
6058
|
if (event.key === "Escape") {
|
|
4783
6059
|
if (editorTarget && (mode === "select" || !editorTarget.hasActiveSuggestion?.())) {
|
|
@@ -4837,21 +6113,6 @@ function createWhichKeyController(options = {}) {
|
|
|
4837
6113
|
setMode("insert");
|
|
4838
6114
|
return true;
|
|
4839
6115
|
}
|
|
4840
|
-
if (event.key === " " && !event.ctrlKey && !event.metaKey && !event.altKey && targetEl) {
|
|
4841
|
-
const role = targetEl.getAttribute("role");
|
|
4842
|
-
const isToggleControl = targetEl instanceof HTMLInputElement && (targetEl.type === "checkbox" || targetEl.type === "radio") || role === "checkbox" || role === "switch" || role === "radio";
|
|
4843
|
-
if (isToggleControl) {
|
|
4844
|
-
return false;
|
|
4845
|
-
}
|
|
4846
|
-
const isButtonControl = targetEl.tagName === "BUTTON" || role === "button";
|
|
4847
|
-
if (isButtonControl) {
|
|
4848
|
-
const previewAncestor = targetEl.closest("[data-example-preview]");
|
|
4849
|
-
const ownScope = options.getScopeElement?.() ?? null;
|
|
4850
|
-
if (previewAncestor && (!ownScope || !previewAncestor.contains(ownScope))) {
|
|
4851
|
-
return false;
|
|
4852
|
-
}
|
|
4853
|
-
}
|
|
4854
|
-
}
|
|
4855
6116
|
if (editorTarget && !editorTarget.hasActiveSuggestion?.() && !event.ctrlKey && !event.metaKey && !event.altKey && (event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "ArrowUp" || event.key === "ArrowDown")) {
|
|
4856
6117
|
const arrowMotion = event.key === "ArrowLeft" ? "left" : event.key === "ArrowRight" ? "right" : event.key === "ArrowUp" ? "up" : "down";
|
|
4857
6118
|
if (event.shiftKey && mode === "normal") {
|
|
@@ -4866,23 +6127,6 @@ function createWhichKeyController(options = {}) {
|
|
|
4866
6127
|
emit();
|
|
4867
6128
|
return true;
|
|
4868
6129
|
}
|
|
4869
|
-
const chordCandidates = eventToChordKeys(event);
|
|
4870
|
-
if (chordCandidates.length === 0) return false;
|
|
4871
|
-
const rootTrie = buildMergedTrie();
|
|
4872
|
-
for (const candidate of chordCandidates) {
|
|
4873
|
-
if (/^[0-9]$/.test(candidate) && (countBuffer.length > 0 || candidate !== "0" || !rootTrie["0"])) {
|
|
4874
|
-
if (countBuffer.length > 0 || candidate !== "0") {
|
|
4875
|
-
event.preventDefault();
|
|
4876
|
-
event.stopPropagation();
|
|
4877
|
-
return triggerKey(candidate, event);
|
|
4878
|
-
}
|
|
4879
|
-
}
|
|
4880
|
-
if (rootTrie[candidate] && nodeMatchesMode(rootTrie[candidate], mode)) {
|
|
4881
|
-
event.preventDefault();
|
|
4882
|
-
event.stopPropagation();
|
|
4883
|
-
return triggerKey(candidate, event);
|
|
4884
|
-
}
|
|
4885
|
-
}
|
|
4886
6130
|
if (inEditable && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
4887
6131
|
event.preventDefault();
|
|
4888
6132
|
event.stopPropagation();
|
|
@@ -4890,10 +6134,13 @@ function createWhichKeyController(options = {}) {
|
|
|
4890
6134
|
}
|
|
4891
6135
|
return false;
|
|
4892
6136
|
}
|
|
6137
|
+
function keyFromCandidate(candidate) {
|
|
6138
|
+
return candidate;
|
|
6139
|
+
}
|
|
4893
6140
|
function attach(target) {
|
|
4894
6141
|
detachCleanups.forEach((fn) => fn());
|
|
4895
6142
|
detachCleanups = [];
|
|
4896
|
-
const doc = target instanceof Document ? target : target
|
|
6143
|
+
const doc = typeof Document !== "undefined" && target instanceof Document ? target : target && "ownerDocument" in target && target.ownerDocument ? target.ownerDocument : target ?? resolveDoc();
|
|
4897
6144
|
if (!doc) return () => {
|
|
4898
6145
|
};
|
|
4899
6146
|
const eventTarget = target ?? doc;
|
|
@@ -4907,7 +6154,7 @@ function createWhichKeyController(options = {}) {
|
|
|
4907
6154
|
} catch {
|
|
4908
6155
|
}
|
|
4909
6156
|
try {
|
|
4910
|
-
liveRegion = (0,
|
|
6157
|
+
liveRegion = (0, import_live_region2.createLiveRegion)({
|
|
4911
6158
|
level: "polite",
|
|
4912
6159
|
document: doc
|
|
4913
6160
|
});
|
|
@@ -4919,6 +6166,7 @@ function createWhichKeyController(options = {}) {
|
|
|
4919
6166
|
liveRegion = null;
|
|
4920
6167
|
}
|
|
4921
6168
|
const entry = {
|
|
6169
|
+
controller: controllerApi,
|
|
4922
6170
|
getScopeElement: () => options.getScopeElement?.() ?? null,
|
|
4923
6171
|
isBusy: () => activePath.length > 0 || sticky || explorerOpen || mode === "jump" || countBuffer.length > 0
|
|
4924
6172
|
};
|
|
@@ -4928,8 +6176,10 @@ function createWhichKeyController(options = {}) {
|
|
|
4928
6176
|
attachedEntriesByDoc.set(doc, docEntries);
|
|
4929
6177
|
}
|
|
4930
6178
|
docEntries.add(entry);
|
|
6179
|
+
notifyRootControllerListeners(doc);
|
|
4931
6180
|
detachCleanups.push(() => {
|
|
4932
6181
|
docEntries?.delete(entry);
|
|
6182
|
+
notifyRootControllerListeners(doc);
|
|
4933
6183
|
});
|
|
4934
6184
|
if (!options.getScopeElement?.()) {
|
|
4935
6185
|
const storedPreset = readStoredPreset();
|
|
@@ -4940,9 +6190,14 @@ function createWhichKeyController(options = {}) {
|
|
|
4940
6190
|
if (storedJump && !options.jumpAction) {
|
|
4941
6191
|
jumpAction = storedJump;
|
|
4942
6192
|
}
|
|
6193
|
+
const storedLeaderOnly = readStoredLeaderOnly();
|
|
6194
|
+
if (storedLeaderOnly !== null && options.leaderOnly === void 0) {
|
|
6195
|
+
leaderOnly = storedLeaderOnly;
|
|
6196
|
+
}
|
|
4943
6197
|
if (doc.documentElement) {
|
|
4944
6198
|
doc.documentElement.dataset.keymapPreset = preset;
|
|
4945
6199
|
doc.documentElement.dataset.jumpAction = jumpAction;
|
|
6200
|
+
doc.documentElement.dataset.whichKeyLeaderOnly = String(leaderOnly);
|
|
4946
6201
|
}
|
|
4947
6202
|
rootControllerByDoc.set(doc, controllerApi);
|
|
4948
6203
|
notifyRootControllerListeners(doc);
|
|
@@ -4977,7 +6232,9 @@ function createWhichKeyController(options = {}) {
|
|
|
4977
6232
|
break;
|
|
4978
6233
|
}
|
|
4979
6234
|
}
|
|
4980
|
-
if (isTextEntryElement(targetNode) && (
|
|
6235
|
+
if (isTextEntryElement(targetNode) && !targetNode.closest(
|
|
6236
|
+
"[data-which-key-explorer], [data-command-palette], [data-command-menu], [data-colon-command]"
|
|
6237
|
+
) && (mode === "normal" || mode === "select")) {
|
|
4981
6238
|
setMode("insert");
|
|
4982
6239
|
}
|
|
4983
6240
|
};
|
|
@@ -4989,8 +6246,13 @@ function createWhichKeyController(options = {}) {
|
|
|
4989
6246
|
'[data-which-key-root], [data-which-key-explorer], [data-which-key-jump-overlay], [data-scope="dialog"]'
|
|
4990
6247
|
)) {
|
|
4991
6248
|
const focusedScope = targetNode.closest("[data-which-key-scope]") ?? null;
|
|
4992
|
-
if (
|
|
6249
|
+
if (focusedScope && isScopeElementActive(focusedScope, doc)) {
|
|
4993
6250
|
lastInteractedScopeByDoc.set(doc, focusedScope);
|
|
6251
|
+
} else if (!focusedScope) {
|
|
6252
|
+
const currentRemembered = lastInteractedScopeByDoc.get(doc) ?? null;
|
|
6253
|
+
if (!currentRemembered || !targetNode.contains(currentRemembered)) {
|
|
6254
|
+
lastInteractedScopeByDoc.set(doc, null);
|
|
6255
|
+
}
|
|
4994
6256
|
}
|
|
4995
6257
|
}
|
|
4996
6258
|
if (!shouldEntryHandleEvent(entry, doc)) return;
|
|
@@ -5008,7 +6270,9 @@ function createWhichKeyController(options = {}) {
|
|
|
5008
6270
|
if (programmaticFocusDepth > 0) {
|
|
5009
6271
|
return;
|
|
5010
6272
|
}
|
|
5011
|
-
if (isTextEntryElement(targetNode) && !getModalEditor(targetNode)
|
|
6273
|
+
if (isTextEntryElement(targetNode) && !getModalEditor(targetNode) && !targetNode.closest(
|
|
6274
|
+
"[data-which-key-explorer], [data-command-palette], [data-command-menu], [data-colon-command]"
|
|
6275
|
+
)) {
|
|
5012
6276
|
if (mode === "normal" || mode === "select") {
|
|
5013
6277
|
setMode("insert");
|
|
5014
6278
|
}
|
|
@@ -5041,16 +6305,26 @@ function createWhichKeyController(options = {}) {
|
|
|
5041
6305
|
keymapLayers.clear();
|
|
5042
6306
|
}
|
|
5043
6307
|
function registerKeymap(id, nodes, layerOptions) {
|
|
5044
|
-
|
|
6308
|
+
const hasElementOption = layerOptions !== void 0 && Object.prototype.hasOwnProperty.call(layerOptions, "element") && layerOptions.element !== void 0;
|
|
6309
|
+
const defaultPriority = layerOptions?.scope ? "pane" : "global";
|
|
6310
|
+
const entry = {
|
|
5045
6311
|
id,
|
|
5046
6312
|
nodes,
|
|
5047
6313
|
scope: layerOptions?.scope,
|
|
5048
|
-
enabled: layerOptions?.enabled ?? true
|
|
5049
|
-
|
|
6314
|
+
enabled: layerOptions?.enabled ?? true,
|
|
6315
|
+
priority: layerOptions?.priority ?? defaultPriority,
|
|
6316
|
+
hasElementOption,
|
|
6317
|
+
element: layerOptions?.element,
|
|
6318
|
+
matchesTarget: layerOptions?.matchesTarget,
|
|
6319
|
+
registrationOrder: ++layerRegistrationCounter
|
|
6320
|
+
};
|
|
6321
|
+
keymapLayers.set(id, entry);
|
|
5050
6322
|
emit();
|
|
5051
6323
|
return () => {
|
|
5052
|
-
keymapLayers.
|
|
5053
|
-
|
|
6324
|
+
if (keymapLayers.get(id) === entry) {
|
|
6325
|
+
keymapLayers.delete(id);
|
|
6326
|
+
emit();
|
|
6327
|
+
}
|
|
5054
6328
|
};
|
|
5055
6329
|
}
|
|
5056
6330
|
function registerCommand(commandId, handler) {
|
|
@@ -5106,6 +6380,7 @@ function createWhichKeyController(options = {}) {
|
|
|
5106
6380
|
handleKeyDown,
|
|
5107
6381
|
setPreset,
|
|
5108
6382
|
setMode,
|
|
6383
|
+
setLeaderOnly,
|
|
5109
6384
|
setJumpAction,
|
|
5110
6385
|
openPrefix,
|
|
5111
6386
|
closePrefix,
|
|
@@ -5135,8 +6410,8 @@ function createWhichKeyController(options = {}) {
|
|
|
5135
6410
|
}
|
|
5136
6411
|
|
|
5137
6412
|
// src/which-key/styles.ts
|
|
5138
|
-
var
|
|
5139
|
-
var whichKeyVariants = (0,
|
|
6413
|
+
var import_class_variance_authority22 = require("class-variance-authority");
|
|
6414
|
+
var whichKeyVariants = (0, import_class_variance_authority22.cva)(
|
|
5140
6415
|
"fixed z-50 flex flex-col overflow-hidden border bg-popover/95 text-popover-foreground shadow-xl backdrop-blur-md transition-all duration-150 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
5141
6416
|
{
|
|
5142
6417
|
variants: {
|
|
@@ -5154,7 +6429,7 @@ var whichKeyVariants = (0, import_class_variance_authority20.cva)(
|
|
|
5154
6429
|
var whichKeyHeaderBase = "flex items-center justify-between gap-2 px-3 pt-2.5 pb-1 text-xs font-medium";
|
|
5155
6430
|
var whichKeyTitleBase = "flex items-center gap-1.5 font-semibold text-foreground";
|
|
5156
6431
|
var whichKeyBreadcrumbBase = "flex items-center gap-1 text-[11px] text-muted-foreground";
|
|
5157
|
-
var whichKeyBodyVariants = (0,
|
|
6432
|
+
var whichKeyBodyVariants = (0, import_class_variance_authority22.cva)("p-1.5", {
|
|
5158
6433
|
variants: {
|
|
5159
6434
|
variant: {
|
|
5160
6435
|
helix: "flex flex-col gap-0.5",
|
|
@@ -5167,9 +6442,9 @@ var whichKeyBodyVariants = (0, import_class_variance_authority20.cva)("p-1.5", {
|
|
|
5167
6442
|
}
|
|
5168
6443
|
});
|
|
5169
6444
|
var whichKeyItemBase = "group flex w-full cursor-pointer items-center justify-between gap-3 rounded-md px-2 py-1 text-left text-xs transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground focus-visible:outline-none";
|
|
5170
|
-
var whichKeyItemLabelBase = "truncate text-foreground group-hover:text-accent-foreground data-[group=true]:font-medium data-[group=true]:text-primary";
|
|
5171
|
-
var whichKeyFooterBase = "
|
|
5172
|
-
var whichKeyModeBadgeVariants = (0,
|
|
6445
|
+
var whichKeyItemLabelBase = "inline-flex min-w-0 items-center gap-1 truncate text-foreground group-hover:text-accent-foreground data-[group=true]:font-medium data-[group=true]:text-primary";
|
|
6446
|
+
var whichKeyFooterBase = "pointer-events-none h-2 shrink-0";
|
|
6447
|
+
var whichKeyModeBadgeVariants = (0, import_class_variance_authority22.cva)(
|
|
5173
6448
|
"inline-flex items-center gap-1 rounded font-mono font-semibold tracking-wider uppercase select-none",
|
|
5174
6449
|
{
|
|
5175
6450
|
variants: {
|
|
@@ -5198,7 +6473,7 @@ var whichKeyExplorerInputBase = "mx-4 mb-2 w-[calc(100%-2rem)] rounded-md border
|
|
|
5198
6473
|
var whichKeyExplorerListContentBase = "max-h-none flex-1 overflow-visible px-2.5 pt-1 pb-3 outline-none";
|
|
5199
6474
|
var whichKeyExplorerItemBase = "flex w-full cursor-pointer items-center justify-between gap-3 rounded-md px-2.5 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground";
|
|
5200
6475
|
var whichKeyExplorerHighlightMarkBase = "rounded-xs bg-primary/20 px-0.5 font-semibold text-foreground";
|
|
5201
|
-
var paneVariants = (0,
|
|
6476
|
+
var paneVariants = (0, import_class_variance_authority22.cva)(
|
|
5202
6477
|
"relative transition-shadow duration-150 data-[pane-active=true]:ring-1 data-[pane-active=true]:ring-primary/40",
|
|
5203
6478
|
{
|
|
5204
6479
|
variants: {
|
|
@@ -5213,7 +6488,7 @@ var paneVariants = (0, import_class_variance_authority20.cva)(
|
|
|
5213
6488
|
}
|
|
5214
6489
|
);
|
|
5215
6490
|
var jumpOverlayRootBase = "pointer-events-none fixed inset-0 z-[60] overflow-hidden";
|
|
5216
|
-
var jumpBadgeVariants = (0,
|
|
6491
|
+
var jumpBadgeVariants = (0, import_class_variance_authority22.cva)(
|
|
5217
6492
|
"pointer-events-auto fixed z-[61] inline-flex items-center justify-center rounded border px-1 py-0.5 font-mono text-[11px] leading-none font-bold shadow-md transition-transform select-none",
|
|
5218
6493
|
{
|
|
5219
6494
|
variants: {
|
|
@@ -5229,6 +6504,9 @@ var jumpBadgeVariants = (0, import_class_variance_authority20.cva)(
|
|
|
5229
6504
|
);
|
|
5230
6505
|
var jumpBadgeMatchedPrefixBase = "opacity-50 line-through";
|
|
5231
6506
|
|
|
6507
|
+
// src/index.ts
|
|
6508
|
+
__reExport(index_exports, which_key_exports, module.exports);
|
|
6509
|
+
|
|
5232
6510
|
// src/editor/build-extensions.ts
|
|
5233
6511
|
var import_starter_kit = __toESM(require("@tiptap/starter-kit"), 1);
|
|
5234
6512
|
var import_extension_placeholder = __toESM(require("@tiptap/extension-placeholder"), 1);
|
|
@@ -7172,6 +8450,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7172
8450
|
THEMES,
|
|
7173
8451
|
THEME_NAMES,
|
|
7174
8452
|
TitleHeading,
|
|
8453
|
+
announceCommandMessage,
|
|
7175
8454
|
badgeVariants,
|
|
7176
8455
|
buildChartDefinition,
|
|
7177
8456
|
buildExtensions,
|
|
@@ -7207,6 +8486,15 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7207
8486
|
codeBlockSpinnerBase,
|
|
7208
8487
|
codeBlockTitleBase,
|
|
7209
8488
|
colBase,
|
|
8489
|
+
colonCommandDialogContentBase,
|
|
8490
|
+
colonCommandErrorBase,
|
|
8491
|
+
colonCommandInputVariants,
|
|
8492
|
+
colonCommandItemVariants,
|
|
8493
|
+
colonCommandListVariants,
|
|
8494
|
+
colonCommandPositionerBase,
|
|
8495
|
+
colonCommandPrefixBase,
|
|
8496
|
+
colonCommandPromptBarVariants,
|
|
8497
|
+
colonCommandVariants,
|
|
7210
8498
|
comboboxClearTriggerBase,
|
|
7211
8499
|
comboboxContentBase,
|
|
7212
8500
|
comboboxControlBase,
|
|
@@ -7218,8 +8506,27 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7218
8506
|
comboboxListBase,
|
|
7219
8507
|
comboboxPositionerBase,
|
|
7220
8508
|
comboboxTriggerBase,
|
|
8509
|
+
commandMenuDialogContentBase,
|
|
8510
|
+
commandMenuErrorBase,
|
|
8511
|
+
commandMenuInputVariants,
|
|
8512
|
+
commandMenuItemVariants,
|
|
8513
|
+
commandMenuListVariants,
|
|
8514
|
+
commandMenuPositionerBase,
|
|
8515
|
+
commandMenuPrefixBase,
|
|
8516
|
+
commandMenuPromptBarVariants,
|
|
8517
|
+
commandMenuVariants,
|
|
8518
|
+
commandPaletteBreadcrumbBase,
|
|
8519
|
+
commandPaletteDialogContentBase,
|
|
8520
|
+
commandPaletteFooterBase,
|
|
8521
|
+
commandPaletteHeaderBase,
|
|
8522
|
+
commandPaletteInputBase,
|
|
8523
|
+
commandPaletteItemBase,
|
|
8524
|
+
commandPaletteListBase,
|
|
8525
|
+
commandPalettePositionerBase,
|
|
8526
|
+
commandPaletteVariants,
|
|
7221
8527
|
containerBase,
|
|
7222
8528
|
createCodeBlockCustom,
|
|
8529
|
+
createCommandTree,
|
|
7223
8530
|
createHelixPreset,
|
|
7224
8531
|
createImageNode,
|
|
7225
8532
|
createInternalMention,
|
|
@@ -7264,9 +8571,12 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7264
8571
|
findDirectionalPane,
|
|
7265
8572
|
findEditorScrollContainer,
|
|
7266
8573
|
flattenKeymapEntries,
|
|
8574
|
+
formatColonCompletionInput,
|
|
8575
|
+
formatCommandMenuCompletionInput,
|
|
7267
8576
|
formatKeyChord,
|
|
7268
8577
|
formatKeySequence,
|
|
7269
8578
|
formatTime,
|
|
8579
|
+
formatWhichKeyLabel,
|
|
7270
8580
|
generateJumpLabels,
|
|
7271
8581
|
getDocumentWhichKeyController,
|
|
7272
8582
|
getEditorModalTarget,
|
|
@@ -7274,9 +8584,11 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7274
8584
|
getNodeChildren,
|
|
7275
8585
|
getPresetKeymap,
|
|
7276
8586
|
hstackBase,
|
|
8587
|
+
inferPlatform,
|
|
7277
8588
|
injectCodeBlockStyles,
|
|
7278
8589
|
inputVariants,
|
|
7279
8590
|
insertPastedUrlAsLink,
|
|
8591
|
+
isChordCommandString,
|
|
7280
8592
|
isEditorInInsertMode,
|
|
7281
8593
|
isGroupNode,
|
|
7282
8594
|
itemVariants,
|
|
@@ -7306,6 +8618,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7306
8618
|
manimPlaceholderBase,
|
|
7307
8619
|
manimPlaceholderLabelBase,
|
|
7308
8620
|
manimRootBase,
|
|
8621
|
+
matchesCommandHotkey,
|
|
7309
8622
|
mermaidLoadingBase,
|
|
7310
8623
|
mermaidRootBase,
|
|
7311
8624
|
mermaidSourceBase,
|
|
@@ -7341,6 +8654,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7341
8654
|
navbarShrunkBase,
|
|
7342
8655
|
navbarTriggerVariants,
|
|
7343
8656
|
navbarVariants,
|
|
8657
|
+
nodeExplicitlyIncludesMode,
|
|
7344
8658
|
nodeMatchesMode,
|
|
7345
8659
|
normalizeNodeModes,
|
|
7346
8660
|
noticeDescriptionBase,
|
|
@@ -7407,6 +8721,14 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7407
8721
|
renderChartSvgString,
|
|
7408
8722
|
renderCodeToHtml,
|
|
7409
8723
|
renderMermaidSource,
|
|
8724
|
+
resolveColonCommandGridNavigation,
|
|
8725
|
+
resolveColonCommandGridStyle,
|
|
8726
|
+
resolveColonCommandState,
|
|
8727
|
+
resolveCommandLevel,
|
|
8728
|
+
resolveCommandMenuGridNavigation,
|
|
8729
|
+
resolveCommandMenuGridStyle,
|
|
8730
|
+
resolveCommandMenuState,
|
|
8731
|
+
resolveKbdSteps,
|
|
7410
8732
|
resolveMermaidThemeVariables,
|
|
7411
8733
|
resolveNode,
|
|
7412
8734
|
revealChevronBase,
|
|
@@ -7430,9 +8752,11 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7430
8752
|
selectPositionerBase,
|
|
7431
8753
|
selectTriggerBase,
|
|
7432
8754
|
selectValueBase,
|
|
8755
|
+
shouldHandleCommandHotkey,
|
|
7433
8756
|
sidebarMenuButtonVariants,
|
|
7434
8757
|
sidebarStyles,
|
|
7435
8758
|
slashCommands,
|
|
8759
|
+
splitHighlightSegments,
|
|
7436
8760
|
splitterPanelBase,
|
|
7437
8761
|
splitterResizeTriggerBase,
|
|
7438
8762
|
splitterResizeTriggerIndicatorBase,
|
|
@@ -7461,6 +8785,13 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7461
8785
|
tagsInputRootBase,
|
|
7462
8786
|
textareaBase,
|
|
7463
8787
|
toLaTeX,
|
|
8788
|
+
toastActionTriggerBase,
|
|
8789
|
+
toastCloseTriggerBase,
|
|
8790
|
+
toastDescriptionBase,
|
|
8791
|
+
toastIconBase,
|
|
8792
|
+
toastTitleBase,
|
|
8793
|
+
toastVariants,
|
|
8794
|
+
toasterBase,
|
|
7464
8795
|
toggleButtonVariants,
|
|
7465
8796
|
toggleGroupRootVariants,
|
|
7466
8797
|
tooltipArrowBase,
|
|
@@ -7468,6 +8799,8 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
|
|
|
7468
8799
|
tooltipPositionerBase,
|
|
7469
8800
|
unregisterImageInsertCallback,
|
|
7470
8801
|
unregisterYouTubeInsertCallback,
|
|
8802
|
+
validateKbdChord,
|
|
8803
|
+
validateKbdHotkey,
|
|
7471
8804
|
vstackBase,
|
|
7472
8805
|
whichKeyBodyVariants,
|
|
7473
8806
|
whichKeyBreadcrumbBase,
|