@cloudvoyant/helical-ui 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,25 +1,17 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
1
+ import {
2
+ __export,
3
+ __reExport,
4
+ commandMenuStyles,
5
+ commandPaletteStyles,
6
+ createCommandTree,
7
+ matchesCommandHotkey
8
+ } from "./chunk-AFE6BORT.js";
18
9
 
19
10
  // src/index.ts
20
11
  var index_exports = {};
21
12
  __export(index_exports, {
22
13
  DEFAULT_JUMP_ALPHABET: () => DEFAULT_JUMP_ALPHABET,
14
+ DEFAULT_THEME: () => DEFAULT_THEME2,
23
15
  EditorHeading: () => EditorHeading,
24
16
  ExitHeading: () => ExitHeading,
25
17
  HeadingWithId: () => HeadingWithId,
@@ -32,14 +24,15 @@ __export(index_exports, {
32
24
  SIDEBAR_WIDTH_ICON: () => SIDEBAR_WIDTH_ICON,
33
25
  SIDEBAR_WIDTH_MOBILE: () => SIDEBAR_WIDTH_MOBILE,
34
26
  THEMES: () => THEMES,
27
+ THEME_CLASS_PREFIX: () => THEME_CLASS_PREFIX2,
35
28
  THEME_NAMES: () => THEME_NAMES,
36
29
  TitleHeading: () => TitleHeading,
37
- announceCommandMessage: () => announceCommandMessage,
38
30
  badgeVariants: () => badgeVariants,
39
31
  buildChartDefinition: () => buildChartDefinition,
40
32
  buildExtensions: () => buildExtensions,
41
33
  buildWhichKeyTree: () => buildWhichKeyTree,
42
34
  buttonVariants: () => buttonVariants,
35
+ captureDialogFocusTarget: () => captureDialogFocusTarget,
43
36
  cardBodyBase: () => cardBodyBase,
44
37
  cardCoverVariants: () => cardCoverVariants,
45
38
  cardDescriptionBase: () => cardDescriptionBase,
@@ -70,15 +63,6 @@ __export(index_exports, {
70
63
  codeBlockSpinnerBase: () => codeBlockSpinnerBase,
71
64
  codeBlockTitleBase: () => codeBlockTitleBase,
72
65
  colBase: () => colBase,
73
- colonCommandDialogContentBase: () => colonCommandDialogContentBase,
74
- colonCommandErrorBase: () => colonCommandErrorBase,
75
- colonCommandInputVariants: () => colonCommandInputVariants,
76
- colonCommandItemVariants: () => colonCommandItemVariants,
77
- colonCommandListVariants: () => colonCommandListVariants,
78
- colonCommandPositionerBase: () => colonCommandPositionerBase,
79
- colonCommandPrefixBase: () => colonCommandPrefixBase,
80
- colonCommandPromptBarVariants: () => colonCommandPromptBarVariants,
81
- colonCommandVariants: () => colonCommandVariants,
82
66
  comboboxClearTriggerBase: () => comboboxClearTriggerBase,
83
67
  comboboxContentBase: () => comboboxContentBase,
84
68
  comboboxControlBase: () => comboboxControlBase,
@@ -90,24 +74,8 @@ __export(index_exports, {
90
74
  comboboxListBase: () => comboboxListBase,
91
75
  comboboxPositionerBase: () => comboboxPositionerBase,
92
76
  comboboxTriggerBase: () => comboboxTriggerBase,
93
- commandMenuDialogContentBase: () => commandMenuDialogContentBase,
94
- commandMenuErrorBase: () => commandMenuErrorBase,
95
- commandMenuInputVariants: () => commandMenuInputVariants,
96
- commandMenuItemVariants: () => commandMenuItemVariants,
97
- commandMenuListVariants: () => commandMenuListVariants,
98
- commandMenuPositionerBase: () => commandMenuPositionerBase,
99
- commandMenuPrefixBase: () => commandMenuPrefixBase,
100
- commandMenuPromptBarVariants: () => commandMenuPromptBarVariants,
101
- commandMenuVariants: () => commandMenuVariants,
102
- commandPaletteBreadcrumbBase: () => commandPaletteBreadcrumbBase,
103
- commandPaletteDialogContentBase: () => commandPaletteDialogContentBase,
104
- commandPaletteFooterBase: () => commandPaletteFooterBase,
105
- commandPaletteHeaderBase: () => commandPaletteHeaderBase,
106
- commandPaletteInputBase: () => commandPaletteInputBase,
107
- commandPaletteItemBase: () => commandPaletteItemBase,
108
- commandPaletteListBase: () => commandPaletteListBase,
109
- commandPalettePositionerBase: () => commandPalettePositionerBase,
110
- commandPaletteVariants: () => commandPaletteVariants,
77
+ commandMenuStyles: () => commandMenuStyles,
78
+ commandPaletteStyles: () => commandPaletteStyles,
111
79
  containerBase: () => containerBase,
112
80
  createCodeBlockCustom: () => createCodeBlockCustom,
113
81
  createCommandTree: () => createCommandTree,
@@ -121,6 +89,7 @@ __export(index_exports, {
121
89
  createUrlMention: () => createUrlMention,
122
90
  createVimPreset: () => createVimPreset,
123
91
  createWhichKeyController: () => createWhichKeyController,
92
+ cycleThemeModeValue: () => cycleThemeModeValue,
124
93
  defaultChartColor: () => defaultChartColor,
125
94
  defaultListboxFilter: () => defaultListboxFilter,
126
95
  dialogBackdropBase: () => dialogBackdropBase,
@@ -133,6 +102,7 @@ __export(index_exports, {
133
102
  dialogHeaderBase: () => dialogHeaderBase,
134
103
  dialogHeaderStickyBase: () => dialogHeaderStickyBase,
135
104
  dialogPositionerBase: () => dialogPositionerBase,
105
+ dialogStyles: () => dialogStyles,
136
106
  dialogTitleBase: () => dialogTitleBase,
137
107
  eventToChordKeys: () => eventToChordKeys,
138
108
  extractYouTubeId: () => extractYouTubeId,
@@ -155,8 +125,6 @@ __export(index_exports, {
155
125
  findDirectionalPane: () => findDirectionalPane,
156
126
  findEditorScrollContainer: () => findEditorScrollContainer,
157
127
  flattenKeymapEntries: () => flattenKeymapEntries,
158
- formatColonCompletionInput: () => formatColonCompletionInput,
159
- formatCommandMenuCompletionInput: () => formatCommandMenuCompletionInput,
160
128
  formatKeyChord: () => formatKeyChord,
161
129
  formatKeySequence: () => formatKeySequence,
162
130
  formatTime: () => formatTime,
@@ -167,6 +135,7 @@ __export(index_exports, {
167
135
  getModalEditor: () => getModalEditor,
168
136
  getNodeChildren: () => getNodeChildren,
169
137
  getPresetKeymap: () => getPresetKeymap,
138
+ hasThemeCss: () => hasThemeCss,
170
139
  hstackBase: () => hstackBase,
171
140
  inferPlatform: () => inferPlatform,
172
141
  injectCodeBlockStyles: () => injectCodeBlockStyles,
@@ -185,6 +154,7 @@ __export(index_exports, {
185
154
  latexErrorBase: () => latexErrorBase,
186
155
  latexInlineBase: () => latexInlineBase,
187
156
  latexRootBase: () => latexRootBase,
157
+ lightSwitchButtonVariants: () => lightSwitchButtonVariants,
188
158
  listboxContentBase: () => listboxContentBase,
189
159
  listboxEmptyBase: () => listboxEmptyBase,
190
160
  listboxInputBase: () => listboxInputBase,
@@ -203,6 +173,7 @@ __export(index_exports, {
203
173
  manimPlaceholderLabelBase: () => manimPlaceholderLabelBase,
204
174
  manimRootBase: () => manimRootBase,
205
175
  matchesCommandHotkey: () => matchesCommandHotkey,
176
+ mergeThemePresets: () => mergeThemePresets,
206
177
  mermaidLoadingBase: () => mermaidLoadingBase,
207
178
  mermaidRootBase: () => mermaidRootBase,
208
179
  mermaidSourceBase: () => mermaidSourceBase,
@@ -299,22 +270,20 @@ __export(index_exports, {
299
270
  radioGroupItemControlBase: () => radioGroupItemControlBase,
300
271
  radioGroupItemTextBase: () => radioGroupItemTextBase,
301
272
  radioGroupRootBase: () => radioGroupRootBase,
273
+ readDocumentDarkMode: () => readDocumentDarkMode,
274
+ readDocumentTheme: () => readDocumentTheme,
275
+ readSystemDarkMode: () => readSystemDarkMode,
276
+ registerCustomThemes: () => registerCustomThemes,
302
277
  registerImageInsertCallback: () => registerImageInsertCallback,
303
278
  registerModalEditor: () => registerModalEditor,
304
279
  registerYouTubeInsertCallback: () => registerYouTubeInsertCallback,
305
280
  renderChartSvgString: () => renderChartSvgString,
306
281
  renderCodeToHtml: () => renderCodeToHtml,
307
282
  renderMermaidSource: () => renderMermaidSource,
308
- resolveColonCommandGridNavigation: () => resolveColonCommandGridNavigation,
309
- resolveColonCommandGridStyle: () => resolveColonCommandGridStyle,
310
- resolveColonCommandState: () => resolveColonCommandState,
311
- resolveCommandLevel: () => resolveCommandLevel,
312
- resolveCommandMenuGridNavigation: () => resolveCommandMenuGridNavigation,
313
- resolveCommandMenuGridStyle: () => resolveCommandMenuGridStyle,
314
- resolveCommandMenuState: () => resolveCommandMenuState,
315
283
  resolveKbdSteps: () => resolveKbdSteps,
316
284
  resolveMermaidThemeVariables: () => resolveMermaidThemeVariables,
317
285
  resolveNode: () => resolveNode,
286
+ restoreDialogFocusTarget: () => restoreDialogFocusTarget,
318
287
  revealChevronBase: () => revealChevronBase,
319
288
  revealContentBase: () => revealContentBase,
320
289
  revealRootBase: () => revealRootBase,
@@ -337,22 +306,24 @@ __export(index_exports, {
337
306
  selectTriggerBase: () => selectTriggerBase,
338
307
  selectValueBase: () => selectValueBase,
339
308
  serializeModalSliceText: () => serializeModalSliceText,
340
- shouldHandleCommandHotkey: () => shouldHandleCommandHotkey,
341
309
  sidebarMenuButtonVariants: () => sidebarMenuButtonVariants,
342
310
  sidebarStyles: () => sidebarStyles,
343
311
  slashCommands: () => slashCommands,
344
- splitHighlightSegments: () => splitHighlightSegments,
345
312
  splitterPanelBase: () => splitterPanelBase,
346
313
  splitterResizeTriggerBase: () => splitterResizeTriggerBase,
347
314
  splitterResizeTriggerIndicatorBase: () => splitterResizeTriggerIndicatorBase,
348
315
  splitterResizeTriggerSeparatorBase: () => splitterResizeTriggerSeparatorBase,
349
316
  splitterRootBase: () => splitterRootBase,
350
317
  stackBase: () => stackBase,
318
+ subscribeDocumentTheme: () => subscribeDocumentTheme,
351
319
  subscribeDocumentWhichKeyController: () => subscribeDocumentWhichKeyController,
320
+ subscribeSystemDarkMode: () => subscribeSystemDarkMode,
352
321
  switchControlBase: () => switchControlBase,
353
322
  switchLabelBase: () => switchLabelBase,
354
323
  switchThumbBase: () => switchThumbBase,
355
324
  switchVariants: () => switchVariants,
325
+ syncDocumentDarkMode: () => syncDocumentDarkMode,
326
+ syncDocumentTheme: () => syncDocumentTheme,
356
327
  tabsContentBase: () => tabsContentBase,
357
328
  tabsIndicatorBase: () => tabsIndicatorBase,
358
329
  tabsIndicatorVariants: () => tabsIndicatorVariants,
@@ -369,6 +340,7 @@ __export(index_exports, {
369
340
  tagsInputItemTextBase: () => tagsInputItemTextBase,
370
341
  tagsInputRootBase: () => tagsInputRootBase,
371
342
  textareaBase: () => textareaBase,
343
+ themeSelectorStyles: () => themeSelectorStyles,
372
344
  toLaTeX: () => toLaTeX,
373
345
  toastActionTriggerBase: () => toastActionTriggerBase,
374
346
  toastCloseTriggerBase: () => toastCloseTriggerBase,
@@ -538,6 +510,63 @@ var dialogHeaderStickyBase = "sticky top-0 z-10 bg-background";
538
510
  var dialogFooterStickyBase = "sticky bottom-0 z-10 bg-background";
539
511
  var dialogFullscreenContentBase = "h-dvh w-full max-w-none rounded-none border-0 p-0 sm:rounded-none";
540
512
  var dialogCloseTriggerBase = "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-[3px] focus:ring-ring/30 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
513
+ var dialogStyles = {
514
+ backdrop: dialogBackdropBase,
515
+ positioner: dialogPositionerBase,
516
+ content: dialogContentBase,
517
+ title: dialogTitleBase,
518
+ description: dialogDescriptionBase,
519
+ header: dialogHeaderBase,
520
+ footer: dialogFooterBase,
521
+ headerSticky: dialogHeaderStickyBase,
522
+ footerSticky: dialogFooterStickyBase,
523
+ fullscreenContent: dialogFullscreenContentBase,
524
+ closeTrigger: dialogCloseTriggerBase
525
+ };
526
+ function captureDialogFocusTarget(excludeRoot) {
527
+ if (typeof document === "undefined" || !(document.activeElement instanceof HTMLElement)) {
528
+ return null;
529
+ }
530
+ const active = document.activeElement;
531
+ if (active === document.body || active === document.documentElement) {
532
+ return null;
533
+ }
534
+ if (excludeRoot?.contains(active)) {
535
+ return null;
536
+ }
537
+ return active;
538
+ }
539
+ function restoreDialogFocusTarget(previousFocusEl, closingContentEl) {
540
+ if (typeof window === "undefined" || typeof document === "undefined") return;
541
+ const hasFocusMovedElsewhere = () => {
542
+ const active = document.activeElement;
543
+ if (active && active !== document.body && active !== document.documentElement && active !== previousFocusEl && (!closingContentEl || !closingContentEl.contains(active)) && !active.closest('[data-state="closed"]')) {
544
+ return true;
545
+ }
546
+ const openModal = document.querySelector(
547
+ '[role="dialog"][data-state="open"], [data-modal="true"]:not([data-state="closed"])'
548
+ );
549
+ if (openModal && openModal !== closingContentEl) {
550
+ return true;
551
+ }
552
+ return false;
553
+ };
554
+ if (hasFocusMovedElsewhere()) return;
555
+ const applyRestore = () => {
556
+ if (hasFocusMovedElsewhere()) return;
557
+ if (previousFocusEl && document.contains(previousFocusEl)) {
558
+ previousFocusEl.focus();
559
+ }
560
+ };
561
+ if (typeof window.requestAnimationFrame === "function") {
562
+ window.requestAnimationFrame(() => {
563
+ if (hasFocusMovedElsewhere()) return;
564
+ window.requestAnimationFrame(applyRestore);
565
+ });
566
+ } else {
567
+ applyRestore();
568
+ }
569
+ }
541
570
 
542
571
  // src/window.ts
543
572
  var windowPositionerBase = "z-50 [--z-index:50]!";
@@ -975,8 +1004,77 @@ var navbarMobileHeaderBase = "flex items-center justify-between gap-2 px-4 py-3"
975
1004
  var navbarMobileMenuBase = "flex flex-1 flex-col gap-1 overflow-y-auto px-4 py-2";
976
1005
  var navbarMobileActionsBase = "flex items-center gap-2 border-t border-border px-4 py-4";
977
1006
 
1007
+ // src/light-switch.ts
1008
+ import { cva as cva11 } from "class-variance-authority";
1009
+ var THEME_CLASS_PREFIX = "theme-";
1010
+ var DEFAULT_THEME = "helical-ui";
1011
+ var lightSwitchButtonVariants = cva11("ml-auto h-[26px] w-[26px] p-1");
1012
+ function cycleThemeModeValue(mode) {
1013
+ return mode === "system" ? "light" : mode === "light" ? "dark" : "system";
1014
+ }
1015
+ function readSystemDarkMode() {
1016
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
1017
+ try {
1018
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
1019
+ } catch {
1020
+ return false;
1021
+ }
1022
+ }
1023
+ function subscribeSystemDarkMode(onChange) {
1024
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
1025
+ return () => {
1026
+ };
1027
+ }
1028
+ try {
1029
+ const media = window.matchMedia("(prefers-color-scheme: dark)");
1030
+ const listener = (event) => onChange(event.matches);
1031
+ media.addEventListener("change", listener);
1032
+ return () => media.removeEventListener("change", listener);
1033
+ } catch {
1034
+ return () => {
1035
+ };
1036
+ }
1037
+ }
1038
+ function readDocumentDarkMode() {
1039
+ if (typeof document === "undefined") return readSystemDarkMode();
1040
+ return document.documentElement.classList.contains("dark");
1041
+ }
1042
+ function syncDocumentDarkMode(dark) {
1043
+ if (typeof document === "undefined") return;
1044
+ const root = document.documentElement;
1045
+ const hasThemeClass = Array.from(root.classList).some((cls) => cls.startsWith(THEME_CLASS_PREFIX));
1046
+ if (!hasThemeClass) {
1047
+ root.classList.add(`${THEME_CLASS_PREFIX}${DEFAULT_THEME}`);
1048
+ }
1049
+ root.classList.toggle("dark", dark);
1050
+ }
1051
+
978
1052
  // src/themes.ts
979
- var THEMES = [
1053
+ import { cva as cva12 } from "class-variance-authority";
1054
+ var THEME_CLASS_PREFIX2 = "theme-";
1055
+ var DEFAULT_THEME2 = "helical-ui";
1056
+ var themeSelectorContainerBase = "max-h-64 overflow-y-auto rounded-md border border-border p-2";
1057
+ var themeSelectorGridBase = "grid grid-cols-2 gap-2";
1058
+ var themeSelectorSwatchVariants = cva12(
1059
+ "relative flex flex-col gap-1.5 overflow-hidden rounded-md border bg-background p-1.5 text-left text-foreground transition-colors",
1060
+ {
1061
+ variants: {
1062
+ active: {
1063
+ true: "border-foreground",
1064
+ false: "border-border hover:border-muted-foreground"
1065
+ }
1066
+ },
1067
+ defaultVariants: {
1068
+ active: false
1069
+ }
1070
+ }
1071
+ );
1072
+ var themeSelectorStyles = {
1073
+ container: themeSelectorContainerBase,
1074
+ grid: themeSelectorGridBase,
1075
+ swatch: themeSelectorSwatchVariants
1076
+ };
1077
+ var BUILTIN_THEMES = [
980
1078
  { name: "amber-minimal", label: "Amber Minimal" },
981
1079
  { name: "amethyst-haze", label: "Amethyst Haze" },
982
1080
  { name: "anthropic", label: "Anthropic" },
@@ -1031,7 +1129,161 @@ var THEMES = [
1031
1129
  { name: "vitepress", label: "Vitepress" },
1032
1130
  { name: "helical-ui", label: "Helical UI" }
1033
1131
  ];
1132
+ var BUILTIN_THEME_NAMES = new Set(BUILTIN_THEMES.map((t) => t.name));
1133
+ var customThemesWithCss = /* @__PURE__ */ new Set();
1134
+ var themeSubscribers = /* @__PURE__ */ new Set();
1135
+ var THEMES = [...BUILTIN_THEMES];
1034
1136
  var THEME_NAMES = THEMES.map((t) => t.name);
1137
+ function notifyThemeSubscribers() {
1138
+ const snapshot = {
1139
+ theme: readDocumentTheme(),
1140
+ dark: readDocumentDarkMode(),
1141
+ themes: [...THEMES]
1142
+ };
1143
+ for (const listener of themeSubscribers) {
1144
+ listener(snapshot);
1145
+ }
1146
+ }
1147
+ function escapeRegExp(value) {
1148
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1149
+ }
1150
+ function ruleListHasThemeSelector(rules, pattern) {
1151
+ for (let i = 0; i < rules.length; i += 1) {
1152
+ const rule = rules[i];
1153
+ if (!rule) continue;
1154
+ if ("selectorText" in rule && typeof rule.selectorText === "string") {
1155
+ if (pattern.test(rule.selectorText)) {
1156
+ return true;
1157
+ }
1158
+ }
1159
+ if ("cssRules" in rule && rule.cssRules) {
1160
+ if (ruleListHasThemeSelector(rule.cssRules, pattern)) {
1161
+ return true;
1162
+ }
1163
+ }
1164
+ }
1165
+ return false;
1166
+ }
1167
+ function injectCustomThemeCss(theme) {
1168
+ if (theme.css?.trim()) {
1169
+ customThemesWithCss.add(theme.name);
1170
+ }
1171
+ if (typeof document === "undefined" || !theme.css?.trim()) return;
1172
+ const selector = `style[data-helical-custom-theme="${theme.name}"]`;
1173
+ let styleEl = document.head.querySelector(selector);
1174
+ if (!styleEl) {
1175
+ styleEl = document.createElement("style");
1176
+ styleEl.setAttribute("data-helical-custom-theme", theme.name);
1177
+ document.head.appendChild(styleEl);
1178
+ }
1179
+ if (styleEl.textContent !== theme.css) {
1180
+ styleEl.textContent = theme.css;
1181
+ }
1182
+ }
1183
+ function registerCustomThemes(customThemes) {
1184
+ const merged = [];
1185
+ const seen = /* @__PURE__ */ new Set();
1186
+ for (const custom of customThemes) {
1187
+ if (!seen.has(custom.name)) {
1188
+ injectCustomThemeCss(custom);
1189
+ merged.push(custom);
1190
+ seen.add(custom.name);
1191
+ }
1192
+ }
1193
+ for (const preset of THEMES) {
1194
+ if (!seen.has(preset.name)) {
1195
+ merged.push(preset);
1196
+ seen.add(preset.name);
1197
+ }
1198
+ }
1199
+ for (const preset of BUILTIN_THEMES) {
1200
+ if (!seen.has(preset.name)) {
1201
+ merged.push(preset);
1202
+ seen.add(preset.name);
1203
+ }
1204
+ }
1205
+ const changed = merged.length !== THEMES.length || merged.some((item, idx) => THEMES[idx]?.name !== item.name);
1206
+ THEMES.splice(0, THEMES.length, ...merged);
1207
+ THEME_NAMES.splice(0, THEME_NAMES.length, ...merged.map((t) => t.name));
1208
+ if (changed) {
1209
+ notifyThemeSubscribers();
1210
+ }
1211
+ return merged;
1212
+ }
1213
+ var mergeThemePresets = registerCustomThemes;
1214
+ function hasThemeCss(theme) {
1215
+ if (!theme) return false;
1216
+ if (typeof document === "undefined" || !document.styleSheets || document.styleSheets.length === 0) {
1217
+ return BUILTIN_THEME_NAMES.has(theme) || customThemesWithCss.has(theme);
1218
+ }
1219
+ const pattern = new RegExp(`\\.${THEME_CLASS_PREFIX2}${escapeRegExp(theme)}(?![a-zA-Z0-9_-])`);
1220
+ for (let i = 0; i < document.styleSheets.length; i += 1) {
1221
+ const sheet = document.styleSheets[i];
1222
+ if (!sheet) continue;
1223
+ try {
1224
+ if (sheet.cssRules && ruleListHasThemeSelector(sheet.cssRules, pattern)) {
1225
+ return true;
1226
+ }
1227
+ } catch {
1228
+ }
1229
+ }
1230
+ return false;
1231
+ }
1232
+ function readDocumentTheme() {
1233
+ if (typeof document === "undefined") return DEFAULT_THEME2;
1234
+ const classes = Array.from(document.documentElement.classList);
1235
+ for (const cls of classes) {
1236
+ if (cls.startsWith(THEME_CLASS_PREFIX2)) {
1237
+ const candidate = cls.slice(THEME_CLASS_PREFIX2.length);
1238
+ if (candidate) return candidate;
1239
+ }
1240
+ }
1241
+ return DEFAULT_THEME2;
1242
+ }
1243
+ function syncDocumentTheme(theme, dark) {
1244
+ const resolvedTheme = hasThemeCss(theme) ? theme : DEFAULT_THEME2;
1245
+ if (typeof document === "undefined") return resolvedTheme;
1246
+ const root = document.documentElement;
1247
+ const targetClass = `${THEME_CLASS_PREFIX2}${resolvedTheme}`;
1248
+ const toRemove = [];
1249
+ root.classList.forEach((cls) => {
1250
+ if (cls.startsWith(THEME_CLASS_PREFIX2) && cls !== targetClass) {
1251
+ toRemove.push(cls);
1252
+ }
1253
+ });
1254
+ for (const cls of toRemove) {
1255
+ root.classList.remove(cls);
1256
+ }
1257
+ if (!root.classList.contains(targetClass)) {
1258
+ root.classList.add(targetClass);
1259
+ }
1260
+ if (typeof dark === "boolean") {
1261
+ root.classList.toggle("dark", dark);
1262
+ }
1263
+ notifyThemeSubscribers();
1264
+ return resolvedTheme;
1265
+ }
1266
+ function subscribeDocumentTheme(onChange) {
1267
+ themeSubscribers.add(onChange);
1268
+ if (typeof document === "undefined" || typeof MutationObserver === "undefined") {
1269
+ return () => {
1270
+ themeSubscribers.delete(onChange);
1271
+ };
1272
+ }
1273
+ const root = document.documentElement;
1274
+ const observer = new MutationObserver(() => {
1275
+ onChange({
1276
+ theme: readDocumentTheme(),
1277
+ dark: readDocumentDarkMode(),
1278
+ themes: [...THEMES]
1279
+ });
1280
+ });
1281
+ observer.observe(root, { attributes: true, attributeFilter: ["class"] });
1282
+ return () => {
1283
+ themeSubscribers.delete(onChange);
1284
+ observer.disconnect();
1285
+ };
1286
+ }
1035
1287
 
1036
1288
  // src/field.ts
1037
1289
  var fieldRootBase = "flex w-full flex-col gap-2 data-invalid:text-destructive";
@@ -1045,8 +1297,8 @@ var fieldsetHelperBase = "text-sm text-muted-foreground";
1045
1297
  var fieldsetErrorBase = "text-sm text-destructive";
1046
1298
 
1047
1299
  // src/input.ts
1048
- import { cva as cva11 } from "class-variance-authority";
1049
- var inputVariants = cva11(
1300
+ import { cva as cva13 } from "class-variance-authority";
1301
+ var inputVariants = cva13(
1050
1302
  "flex w-full min-w-0 rounded-md border border-input bg-transparent px-3 text-sm shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/24 data-invalid:border-destructive data-invalid:ring-[3px] data-invalid:ring-destructive/24",
1051
1303
  {
1052
1304
  variants: {
@@ -1072,8 +1324,8 @@ var numberInputInputBase = "h-9 w-full min-w-0 flex-1 border-0 bg-transparent px
1072
1324
  var numberInputTriggerBase = "flex size-9 shrink-0 items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
1073
1325
 
1074
1326
  // src/checkbox.ts
1075
- import { cva as cva12 } from "class-variance-authority";
1076
- var checkboxVariants = cva12(
1327
+ import { cva as cva14 } from "class-variance-authority";
1328
+ var checkboxVariants = cva14(
1077
1329
  "relative inline-flex size-4 shrink-0 items-center justify-center rounded-sm border border-input bg-transparent shadow-xs transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:ring-offset-1 focus-visible:ring-offset-background data-invalid:border-destructive data-invalid:ring-[3px] data-invalid:ring-destructive/24 disabled:pointer-events-none disabled:opacity-50",
1078
1330
  {
1079
1331
  variants: {
@@ -1093,8 +1345,8 @@ var checkboxLabelBase = "select-none text-sm font-medium leading-none";
1093
1345
  var checkboxGroupBase = "flex flex-col gap-2";
1094
1346
 
1095
1347
  // src/switch.ts
1096
- import { cva as cva13 } from "class-variance-authority";
1097
- var switchVariants = cva13(
1348
+ import { cva as cva15 } from "class-variance-authority";
1349
+ var switchVariants = cva15(
1098
1350
  "inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-transparent bg-input p-0.5 shadow-xs transition-colors outline-none data-[state=checked]:bg-primary data-invalid:border-destructive data-invalid:ring-[3px] data-invalid:ring-destructive/24 focus-visible:ring-[3px] focus-visible:ring-ring/30 disabled:pointer-events-none disabled:opacity-50",
1099
1351
  {
1100
1352
  variants: {
@@ -1114,7 +1366,7 @@ var switchThumbBase = "pointer-events-none block aspect-square h-full w-auto rou
1114
1366
  var switchLabelBase = "select-none text-sm font-medium leading-none";
1115
1367
 
1116
1368
  // src/select.ts
1117
- import { cva as cva14 } from "class-variance-authority";
1369
+ import { cva as cva16 } from "class-variance-authority";
1118
1370
  var selectTriggerBase = "flex w-fit cursor-default items-center gap-2 whitespace-nowrap data-[placeholder-shown]:text-muted-foreground data-[state=open]:border-ring data-[state=open]:ring-[3px] data-[state=open]:ring-ring/30 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground";
1119
1371
  var selectValueBase = "flex min-w-0 items-center gap-2 truncate";
1120
1372
  var selectIndicatorBase = "flex items-center justify-center text-muted-foreground";
@@ -1125,7 +1377,7 @@ var selectItemGroupLabelBase = "px-2 py-1.5 text-xs font-semibold text-muted-for
1125
1377
  var selectItemBase = "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 pe-8 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground";
1126
1378
  var selectItemTextBase = "flex w-full flex-1 items-center gap-2";
1127
1379
  var selectItemIndicatorBase = "absolute inset-y-0 end-2 flex items-center justify-center text-foreground";
1128
- var nativeSelectVariants = cva14(
1380
+ var nativeSelectVariants = cva16(
1129
1381
  "appearance-none w-full min-w-0 rounded-md border border-input bg-transparent pe-8 ps-2.5 text-sm shadow-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/30 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-[3px] aria-invalid:ring-destructive/24",
1130
1382
  {
1131
1383
  variants: {
@@ -1144,7 +1396,7 @@ var nativeSelectWrapperBase = "relative w-fit [&_svg]:pointer-events-none [&_svg
1144
1396
  var nativeSelectIconBase = "pointer-events-none absolute inset-y-0 end-2.5 flex items-center justify-center text-muted-foreground";
1145
1397
 
1146
1398
  // src/combobox.ts
1147
- import { cva as cva15 } from "class-variance-authority";
1399
+ import { cva as cva17 } from "class-variance-authority";
1148
1400
  var comboboxControlBase = "relative flex w-full flex-wrap items-center gap-1";
1149
1401
  var comboboxInputBase = "pe-8";
1150
1402
  var comboboxTriggerBase = "absolute inset-y-0 end-1 flex w-8 items-center justify-center text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0";
@@ -1152,7 +1404,7 @@ var comboboxClearTriggerBase = "absolute inset-y-0 end-9 flex items-center justi
1152
1404
  var comboboxPositionerBase = "z-50 [--z-index:50]!";
1153
1405
  var comboboxContentBase = "relative z-50 max-h-96 min-w-48 overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md outline-none";
1154
1406
  var comboboxItemGroupLabelBase = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
1155
- var comboboxItemVariants = cva15(
1407
+ var comboboxItemVariants = cva17(
1156
1408
  "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-muted-foreground",
1157
1409
  {
1158
1410
  variants: {
@@ -1250,8 +1502,8 @@ var radioGroupItemControlBase = "relative inline-flex size-4 shrink-0 items-cent
1250
1502
  var radioGroupItemTextBase = "select-none text-sm font-medium leading-none";
1251
1503
 
1252
1504
  // src/notice.ts
1253
- import { cva as cva16 } from "class-variance-authority";
1254
- var noticeVariants = cva16(
1505
+ import { cva as cva18 } from "class-variance-authority";
1506
+ var noticeVariants = cva18(
1255
1507
  "not-prose relative my-4 grid w-full items-center gap-y-0.5 rounded-lg border px-3 py-2.5 text-sm grid-cols-[0_1fr] has-[>svg]:grid-cols-[calc(var(--spacing)*3)_1fr] has-[>svg]:gap-x-2.5 [&>svg]:size-4",
1256
1508
  {
1257
1509
  variants: {
@@ -1550,8 +1802,8 @@ var quizSubmitButtonBase = "rounded-md bg-primary px-3 py-1.5 text-sm font-mediu
1550
1802
  var quizResetButtonBase = "inline-flex items-center gap-1.5 rounded-md border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2";
1551
1803
 
1552
1804
  // src/prose.ts
1553
- import { cva as cva17 } from "class-variance-authority";
1554
- var proseVariants = cva17(
1805
+ import { cva as cva19 } from "class-variance-authority";
1806
+ var proseVariants = cva19(
1555
1807
  [
1556
1808
  "text-foreground",
1557
1809
  "max-w-none",
@@ -1594,8 +1846,8 @@ var proseVariants = cva17(
1594
1846
  );
1595
1847
 
1596
1848
  // src/toggle-group.ts
1597
- import { cva as cva18 } from "class-variance-authority";
1598
- var toggleGroupRootVariants = cva18("inline-flex items-center", {
1849
+ import { cva as cva20 } from "class-variance-authority";
1850
+ var toggleGroupRootVariants = cva20("inline-flex items-center", {
1599
1851
  variants: {
1600
1852
  orientation: { horizontal: "flex-row", vertical: "flex-col" },
1601
1853
  // `gap` belongs to the variants, not the base. With a `gap-1` base plus a `gap-0` variant
@@ -1641,7 +1893,7 @@ var listboxItemGroupBase = "flex flex-col py-1 first:pt-0 last:pb-0";
1641
1893
  var listboxItemGroupLabelBase = "px-2 py-1 text-[11px] font-semibold tracking-wider text-muted-foreground uppercase select-none";
1642
1894
 
1643
1895
  // src/kbd.ts
1644
- import { cva as cva19 } from "class-variance-authority";
1896
+ import { cva as cva21 } from "class-variance-authority";
1645
1897
  import {
1646
1898
  ALL_KEYS,
1647
1899
  detectPlatform,
@@ -1651,7 +1903,7 @@ import {
1651
1903
  normalizeKeyName,
1652
1904
  validateHotkey
1653
1905
  } from "@tanstack/hotkeys";
1654
- var kbdVariants = cva19(
1906
+ var kbdVariants = cva21(
1655
1907
  "inline-flex shrink-0 items-center justify-center gap-0.5 rounded border font-mono font-medium leading-none tracking-tight select-none",
1656
1908
  {
1657
1909
  variants: {
@@ -1847,13 +2099,13 @@ function isChordCommandString(value) {
1847
2099
  }
1848
2100
 
1849
2101
  // src/toast.ts
1850
- import { cva as cva20 } from "class-variance-authority";
2102
+ import { cva as cva22 } from "class-variance-authority";
1851
2103
  var toasterBase = [
1852
2104
  "w-[calc(100%-var(--viewport-offset-left))] sm:w-(--width) [--width:22.25rem]",
1853
2105
  "data-[align=center]:left-[calc(var(--viewport-offset-right)/2)]!",
1854
2106
  "sm:data-[align=center]:w-full"
1855
2107
  ].join(" ");
1856
- var toastVariants = cva20(
2108
+ var toastVariants = cva22(
1857
2109
  [
1858
2110
  "z-(--z-index) translate-x-(--x) translate-y-(--y) opacity-(--opacity)",
1859
2111
  "data-[overlap]:scale-[calc(1-var(--index,0)*0.04)]",
@@ -1882,636 +2134,6 @@ var toastDescriptionBase = "text-xs leading-relaxed text-muted-foreground";
1882
2134
  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";
1883
2135
  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";
1884
2136
 
1885
- // src/command/core.ts
1886
- import { matchesKeyboardEvent } from "@tanstack/hotkeys";
1887
- import { TreeCollection } from "@zag-js/collection";
1888
- import { createFilter } from "@zag-js/i18n-utils";
1889
- import { createLiveRegion } from "@zag-js/live-region";
1890
- import { Fzf, byLengthAsc } from "fzf";
1891
- var ROOT_NODE_VALUE = "__root__";
1892
- var DEFAULT_GROUP_LABEL = "Commands";
1893
- var i18nFilter = createFilter({ sensitivity: "base" });
1894
- var sharedLiveRegion = null;
1895
- function getNodeCommandToken(node) {
1896
- return (node.command ?? node.value).trim();
1897
- }
1898
- function isEditableTarget(target) {
1899
- if (!target || typeof target !== "object") return false;
1900
- const el = target;
1901
- if (el.isContentEditable) return true;
1902
- const tag = el.tagName?.toLowerCase();
1903
- if (tag === "input" || tag === "textarea" || tag === "select") return true;
1904
- if (typeof el.closest === "function" && el.closest('[contenteditable="true"], .ProseMirror')) {
1905
- return true;
1906
- }
1907
- return false;
1908
- }
1909
- function toFlatItem(node, ancestorPath, ancestorLabels, ancestorCommands, tree, fallbackGroup) {
1910
- const cmd = getNodeCommandToken(node);
1911
- const valuePath = [...ancestorPath, node.value];
1912
- const commandTokens = [...ancestorCommands, cmd];
1913
- const isBranch = tree.isBranchNode(node);
1914
- const group = node.group ?? fallbackGroup ?? (ancestorLabels.length > 0 ? ancestorLabels[ancestorLabels.length - 1] : DEFAULT_GROUP_LABEL);
1915
- return {
1916
- value: valuePath.join("/"),
1917
- label: node.label,
1918
- description: node.description,
1919
- group,
1920
- command: cmd,
1921
- fullCommand: `:${commandTokens.join(" ")}`,
1922
- aliases: node.aliases ?? [],
1923
- shortcut: node.shortcut,
1924
- badge: node.badge,
1925
- active: Boolean(node.active),
1926
- disabled: Boolean(node.disabled),
1927
- isBranch,
1928
- valuePath,
1929
- breadcrumbLabels: ancestorLabels,
1930
- node
1931
- };
1932
- }
1933
- function groupCommandItems(items) {
1934
- const map = /* @__PURE__ */ new Map();
1935
- for (const item of items) {
1936
- const groupLabel = item.group || DEFAULT_GROUP_LABEL;
1937
- const list = map.get(groupLabel);
1938
- if (list) {
1939
- list.push(item);
1940
- } else {
1941
- map.set(groupLabel, [item]);
1942
- }
1943
- }
1944
- return Array.from(map.entries()).map(([label, groupItems]) => ({
1945
- label,
1946
- items: groupItems
1947
- }));
1948
- }
1949
- function collectDeepFlatItems(parentNode, ancestorPath, ancestorLabels, ancestorCommands, tree, out) {
1950
- const children = tree.getNodeChildren(parentNode);
1951
- for (const child of children) {
1952
- const flat = toFlatItem(child, ancestorPath, ancestorLabels, ancestorCommands, tree);
1953
- out.push(flat);
1954
- if (tree.isBranchNode(child)) {
1955
- collectDeepFlatItems(
1956
- child,
1957
- [...ancestorPath, child.value],
1958
- [...ancestorLabels, child.label],
1959
- [...ancestorCommands, getNodeCommandToken(child)],
1960
- tree,
1961
- out
1962
- );
1963
- }
1964
- }
1965
- }
1966
- function matchesCommandToken(node, token) {
1967
- const lower = token.toLowerCase();
1968
- const cmd = getNodeCommandToken(node).toLowerCase();
1969
- if (cmd === lower || node.value.toLowerCase() === lower) {
1970
- return true;
1971
- }
1972
- return (node.aliases ?? []).some((alias) => alias.toLowerCase() === lower);
1973
- }
1974
- function createCommandTree(items) {
1975
- if (items instanceof TreeCollection) {
1976
- return items;
1977
- }
1978
- const rootNode = {
1979
- value: ROOT_NODE_VALUE,
1980
- label: "Root",
1981
- children: items ?? []
1982
- };
1983
- return new TreeCollection({
1984
- rootNode,
1985
- nodeToValue: (node) => node.value,
1986
- nodeToString: (node) => node.label,
1987
- isNodeDisabled: (node) => Boolean(node.disabled),
1988
- nodeToChildren: (node) => node.children ?? []
1989
- });
1990
- }
1991
- function resolveCommandLevel(tree, activePath = [], query = "", options) {
1992
- const rootChildren = tree.getNodeChildren(tree.rootNode);
1993
- const hasCommands = rootChildren.length > 0;
1994
- if (!hasCommands) {
1995
- return {
1996
- hasCommands: false,
1997
- breadcrumbs: [],
1998
- items: [],
1999
- groups: []
2000
- };
2001
- }
2002
- const breadcrumbs = [];
2003
- const resolvedValuePath = [];
2004
- const resolvedLabels = [];
2005
- const resolvedCommands = [];
2006
- let currentNode = tree.rootNode;
2007
- for (const segment of activePath) {
2008
- const children = tree.getNodeChildren(currentNode);
2009
- const match = children.find((child) => child.value === segment);
2010
- if (!match || !tree.isBranchNode(match)) {
2011
- break;
2012
- }
2013
- const cmd = getNodeCommandToken(match);
2014
- breadcrumbs.push({
2015
- value: match.value,
2016
- label: match.label,
2017
- command: cmd
2018
- });
2019
- resolvedValuePath.push(match.value);
2020
- resolvedLabels.push(match.label);
2021
- resolvedCommands.push(cmd);
2022
- currentNode = match;
2023
- }
2024
- const trimmedQuery = query.trim();
2025
- const directChildren = tree.getNodeChildren(currentNode);
2026
- const directItems = directChildren.map(
2027
- (child) => toFlatItem(child, resolvedValuePath, resolvedLabels, resolvedCommands, tree)
2028
- );
2029
- if (!trimmedQuery) {
2030
- return {
2031
- hasCommands: true,
2032
- breadcrumbs,
2033
- items: directItems,
2034
- groups: groupCommandItems(directItems)
2035
- };
2036
- }
2037
- const normalizedQuery = trimmedQuery.startsWith(":") ? trimmedQuery.slice(1).trim() : trimmedQuery;
2038
- if (!normalizedQuery) {
2039
- return {
2040
- hasCommands: true,
2041
- breadcrumbs,
2042
- items: directItems,
2043
- groups: groupCommandItems(directItems)
2044
- };
2045
- }
2046
- const allowDeepSearch = options?.deepSearch !== false && breadcrumbs.length === 0;
2047
- const candidatePool = [];
2048
- if (allowDeepSearch) {
2049
- collectDeepFlatItems(currentNode, resolvedValuePath, resolvedLabels, resolvedCommands, tree, candidatePool);
2050
- } else {
2051
- candidatePool.push(...directItems);
2052
- }
2053
- const labelFzf = new Fzf(candidatePool, {
2054
- selector: (item) => item.label,
2055
- tiebreakers: [byLengthAsc],
2056
- casing: "case-insensitive"
2057
- });
2058
- const labelResults = labelFzf.find(normalizedQuery);
2059
- const labelMatchMap = /* @__PURE__ */ new Map();
2060
- for (const res of labelResults) {
2061
- labelMatchMap.set(res.item.value, {
2062
- score: res.score,
2063
- positions: Array.from(res.positions).sort((a, b) => a - b)
2064
- });
2065
- }
2066
- const compositeFzf = new Fzf(candidatePool, {
2067
- selector: (item) => [
2068
- item.label,
2069
- item.command,
2070
- item.fullCommand,
2071
- ...item.aliases,
2072
- ...item.breadcrumbLabels,
2073
- item.description ?? "",
2074
- ...item.node.keywords ?? []
2075
- ].join(" "),
2076
- tiebreakers: [byLengthAsc],
2077
- casing: "case-insensitive"
2078
- });
2079
- const compositeResults = compositeFzf.find(normalizedQuery);
2080
- const matchedByValue = /* @__PURE__ */ new Map();
2081
- for (const res of compositeResults) {
2082
- const labelHit = labelMatchMap.get(res.item.value);
2083
- const depthPenalty = (res.item.valuePath.length - 1) * 2;
2084
- const effectiveScore = (labelHit ? labelHit.score + 20 : res.score) - depthPenalty;
2085
- matchedByValue.set(res.item.value, {
2086
- ...res.item,
2087
- matchPositions: labelHit?.positions ?? [],
2088
- score: effectiveScore
2089
- });
2090
- }
2091
- for (const candidate of candidatePool) {
2092
- if (matchedByValue.has(candidate.value)) continue;
2093
- if (i18nFilter.contains(candidate.label, normalizedQuery) || i18nFilter.contains(candidate.command, normalizedQuery)) {
2094
- matchedByValue.set(candidate.value, {
2095
- ...candidate,
2096
- matchPositions: [],
2097
- score: 1
2098
- });
2099
- }
2100
- }
2101
- const rankedItems = Array.from(matchedByValue.values()).sort((a, b) => {
2102
- const scoreDiff = (b.score ?? 0) - (a.score ?? 0);
2103
- if (scoreDiff !== 0) return scoreDiff;
2104
- if (a.valuePath.length !== b.valuePath.length) {
2105
- return a.valuePath.length - b.valuePath.length;
2106
- }
2107
- return a.label.length - b.label.length;
2108
- });
2109
- return {
2110
- hasCommands: true,
2111
- breadcrumbs,
2112
- items: rankedItems,
2113
- groups: groupCommandItems(rankedItems)
2114
- };
2115
- }
2116
- function resolveCommandMenuState(tree, rawInput = "") {
2117
- const rootChildren = tree.getNodeChildren(tree.rootNode);
2118
- const hasCommands = rootChildren.length > 0;
2119
- const withoutColon = rawInput.startsWith(":") ? rawInput.slice(1) : rawInput;
2120
- const normalizedInput = `:${withoutColon}`;
2121
- if (!hasCommands) {
2122
- return {
2123
- hasCommands: false,
2124
- normalizedInput,
2125
- completedTokens: [],
2126
- partialToken: withoutColon.trim(),
2127
- breadcrumbs: [],
2128
- suggestions: [],
2129
- exactNode: null,
2130
- error: null
2131
- };
2132
- }
2133
- const hasTrailingSpace = /\s+$/.test(withoutColon);
2134
- const trimmed = withoutColon.trim();
2135
- const rawTokens = trimmed.length > 0 ? trimmed.split(/\s+/) : [];
2136
- const tokensToWalk = hasTrailingSpace ? rawTokens : rawTokens.slice(0, -1);
2137
- const partialToken = hasTrailingSpace ? "" : rawTokens[rawTokens.length - 1] ?? "";
2138
- const completedTokens = [];
2139
- const breadcrumbs = [];
2140
- const ancestorPath = [];
2141
- const ancestorLabels = [];
2142
- let currentNode = tree.rootNode;
2143
- for (let i = 0; i < tokensToWalk.length; i++) {
2144
- const token = tokensToWalk[i];
2145
- const children = tree.getNodeChildren(currentNode);
2146
- const matchedChild = children.find((child) => matchesCommandToken(child, token));
2147
- if (!matchedChild) {
2148
- return {
2149
- hasCommands: true,
2150
- normalizedInput,
2151
- completedTokens,
2152
- partialToken: rawTokens.slice(i).join(" "),
2153
- breadcrumbs,
2154
- suggestions: [],
2155
- exactNode: null,
2156
- error: `Unknown command: ${token}`
2157
- };
2158
- }
2159
- const canonicalCmd = getNodeCommandToken(matchedChild);
2160
- if (!tree.isBranchNode(matchedChild)) {
2161
- const extraTokens = rawTokens.slice(i + 1);
2162
- const hasExtra = extraTokens.length > 0 || partialToken.length > 0;
2163
- if (hasExtra) {
2164
- return {
2165
- hasCommands: true,
2166
- normalizedInput,
2167
- completedTokens: [...completedTokens, canonicalCmd],
2168
- partialToken,
2169
- breadcrumbs,
2170
- suggestions: [],
2171
- exactNode: null,
2172
- error: `Command ':${[...completedTokens, canonicalCmd].join(" ")}' does not take arguments`
2173
- };
2174
- }
2175
- const exactFlat = toFlatItem(matchedChild, ancestorPath, ancestorLabels, completedTokens, tree);
2176
- return {
2177
- hasCommands: true,
2178
- normalizedInput,
2179
- completedTokens: [...completedTokens, canonicalCmd],
2180
- partialToken: "",
2181
- breadcrumbs,
2182
- suggestions: [exactFlat],
2183
- exactNode: exactFlat,
2184
- error: null
2185
- };
2186
- }
2187
- completedTokens.push(canonicalCmd);
2188
- breadcrumbs.push({
2189
- value: matchedChild.value,
2190
- label: matchedChild.label,
2191
- command: canonicalCmd
2192
- });
2193
- ancestorPath.push(matchedChild.value);
2194
- ancestorLabels.push(matchedChild.label);
2195
- currentNode = matchedChild;
2196
- }
2197
- const branchChildren = tree.getNodeChildren(currentNode);
2198
- const branchItems = branchChildren.map(
2199
- (child) => toFlatItem(child, ancestorPath, ancestorLabels, completedTokens, tree)
2200
- );
2201
- if (!partialToken) {
2202
- return {
2203
- hasCommands: true,
2204
- normalizedInput,
2205
- completedTokens,
2206
- partialToken: "",
2207
- breadcrumbs,
2208
- suggestions: branchItems,
2209
- exactNode: null,
2210
- error: null
2211
- };
2212
- }
2213
- const exactChild = branchItems.find((item) => matchesCommandToken(item.node, partialToken)) ?? null;
2214
- const cmdFzf = new Fzf(branchItems, {
2215
- selector: (item) => item.command,
2216
- tiebreakers: [byLengthAsc],
2217
- casing: "case-insensitive"
2218
- });
2219
- const cmdHits = /* @__PURE__ */ new Map();
2220
- for (const res of cmdFzf.find(partialToken)) {
2221
- cmdHits.set(res.item.value, {
2222
- score: res.score,
2223
- positions: Array.from(res.positions).sort((a, b) => a - b)
2224
- });
2225
- }
2226
- const labelFzf = new Fzf(branchItems, {
2227
- selector: (item) => item.label,
2228
- tiebreakers: [byLengthAsc],
2229
- casing: "case-insensitive"
2230
- });
2231
- const labelHits = /* @__PURE__ */ new Map();
2232
- for (const res of labelFzf.find(partialToken)) {
2233
- labelHits.set(res.item.value, {
2234
- score: res.score,
2235
- positions: Array.from(res.positions).sort((a, b) => a - b)
2236
- });
2237
- }
2238
- const combinedFzf = new Fzf(branchItems, {
2239
- selector: (item) => [item.command, ...item.aliases, item.label, item.description ?? "", ...item.node.keywords ?? []].join(" "),
2240
- tiebreakers: [byLengthAsc],
2241
- casing: "case-insensitive"
2242
- });
2243
- const suggestionMap = /* @__PURE__ */ new Map();
2244
- for (const res of combinedFzf.find(partialToken)) {
2245
- const cmdHit = cmdHits.get(res.item.value);
2246
- const labelHit = labelHits.get(res.item.value);
2247
- const isExact = exactChild?.value === res.item.value;
2248
- const isPrefix = res.item.command.toLowerCase().startsWith(partialToken.toLowerCase());
2249
- const score = (cmdHit ? cmdHit.score + 50 : res.score) + (isExact ? 500 : 0) + (isPrefix ? 100 : 0);
2250
- suggestionMap.set(res.item.value, {
2251
- ...res.item,
2252
- commandMatchPositions: cmdHit?.positions ?? [],
2253
- matchPositions: labelHit?.positions ?? [],
2254
- score
2255
- });
2256
- }
2257
- const suggestions = Array.from(suggestionMap.values()).sort((a, b) => {
2258
- const scoreDiff = (b.score ?? 0) - (a.score ?? 0);
2259
- if (scoreDiff !== 0) return scoreDiff;
2260
- return a.command.length - b.command.length;
2261
- });
2262
- const error = suggestions.length === 0 ? `Unknown command: ${[...completedTokens, partialToken].join(" ")}` : null;
2263
- return {
2264
- hasCommands: true,
2265
- normalizedInput,
2266
- completedTokens,
2267
- partialToken,
2268
- breadcrumbs,
2269
- suggestions,
2270
- exactNode: exactChild ? suggestionMap.get(exactChild.value) ?? exactChild : null,
2271
- error
2272
- };
2273
- }
2274
- var resolveColonCommandState = resolveCommandMenuState;
2275
- function formatCommandMenuCompletionInput(completedTokens, item, appendBranchSpace = true) {
2276
- const nextTokens = [...completedTokens, item.command].join(" ");
2277
- return item.isBranch && appendBranchSpace ? `:${nextTokens} ` : `:${nextTokens}`;
2278
- }
2279
- var formatColonCompletionInput = formatCommandMenuCompletionInput;
2280
- function splitHighlightSegments(text, matchPositions) {
2281
- if (!text) return [];
2282
- if (!matchPositions || matchPositions.length === 0) {
2283
- return [{ text, highlight: false }];
2284
- }
2285
- const posSet = new Set(matchPositions);
2286
- const segments = [];
2287
- let currentText = "";
2288
- let currentHighlight = posSet.has(0);
2289
- for (let i = 0; i < text.length; i++) {
2290
- const isHighlighted = posSet.has(i);
2291
- if (i > 0 && isHighlighted !== currentHighlight) {
2292
- segments.push({ text: currentText, highlight: currentHighlight });
2293
- currentText = text[i];
2294
- currentHighlight = isHighlighted;
2295
- } else {
2296
- currentText += text[i];
2297
- }
2298
- }
2299
- if (currentText.length > 0) {
2300
- segments.push({ text: currentText, highlight: currentHighlight });
2301
- }
2302
- return segments;
2303
- }
2304
- function announceCommandMessage(message) {
2305
- if (typeof document === "undefined" || !message) return;
2306
- try {
2307
- if (!sharedLiveRegion) {
2308
- sharedLiveRegion = createLiveRegion({ level: "polite", document });
2309
- }
2310
- sharedLiveRegion.announce(message, 150);
2311
- } catch {
2312
- }
2313
- }
2314
- function matchesCommandHotkey(event, hotkey) {
2315
- if (!hotkey) return false;
2316
- const trimmed = hotkey.trim();
2317
- if (trimmed === ":") {
2318
- if (isEditableTarget(event.target)) return false;
2319
- return !event.metaKey && !event.ctrlKey && !event.altKey && event.key === ":";
2320
- }
2321
- try {
2322
- if (matchesKeyboardEvent(event, hotkey)) {
2323
- return true;
2324
- }
2325
- } catch {
2326
- }
2327
- const normalized = trimmed.toLowerCase();
2328
- if (normalized === "mod+k" || normalized === "cmd+k" || normalized === "ctrl+k") {
2329
- return (event.metaKey || event.ctrlKey) && !event.altKey && event.key.toLowerCase() === "k";
2330
- }
2331
- return false;
2332
- }
2333
- function isHotkeyAnchorVisible(el) {
2334
- if (el.closest("[hidden]")) return false;
2335
- const fwWrapper = el.closest("[data-fw]");
2336
- const activeFw = el.ownerDocument?.documentElement?.getAttribute("data-framework");
2337
- if (fwWrapper && activeFw && fwWrapper.getAttribute("data-fw") !== activeFw) {
2338
- return false;
2339
- }
2340
- return true;
2341
- }
2342
- function shouldHandleCommandHotkey(anchorEl, selector) {
2343
- if (!anchorEl || typeof document === "undefined") return true;
2344
- if (!isHotkeyAnchorVisible(anchorEl)) return false;
2345
- const myPreview = anchorEl.closest("[data-example-preview]");
2346
- const activePreview = document.activeElement?.closest?.("[data-example-preview]") ?? null;
2347
- if (activePreview) {
2348
- return myPreview === activePreview;
2349
- }
2350
- if (myPreview) {
2351
- const previewAnchors = Array.from(
2352
- document.querySelectorAll(`[data-example-preview] ${selector}`)
2353
- ).filter(isHotkeyAnchorVisible);
2354
- return previewAnchors[0] === anchorEl;
2355
- }
2356
- return true;
2357
- }
2358
- function resolveCommandMenuGridStyle(columns = "auto", itemCount) {
2359
- if (columns === 1 || itemCount <= 0) {
2360
- return void 0;
2361
- }
2362
- const maxCols = columns === "auto" ? itemCount <= 6 ? 2 : itemCount <= 12 ? 3 : 4 : columns;
2363
- const colCount = Math.max(1, Math.min(maxCols, itemCount));
2364
- const rowCount = Math.max(1, Math.ceil(itemCount / colCount));
2365
- return {
2366
- display: "grid",
2367
- gridAutoFlow: "column",
2368
- gridTemplateRows: `repeat(${rowCount}, minmax(0, auto))`,
2369
- gridTemplateColumns: `repeat(${colCount}, minmax(0, 1fr))`
2370
- };
2371
- }
2372
- var resolveColonCommandGridStyle = resolveCommandMenuGridStyle;
2373
- function resolveCommandMenuGridNavigation(columns = "auto", itemCount, currentIdx, key) {
2374
- if (itemCount <= 0) return -1;
2375
- const safeIdx = currentIdx >= 0 && currentIdx < itemCount ? currentIdx : 0;
2376
- if (key === "ArrowDown") {
2377
- return (safeIdx + 1) % itemCount;
2378
- }
2379
- if (key === "ArrowUp") {
2380
- return (safeIdx - 1 + itemCount) % itemCount;
2381
- }
2382
- if (columns === 1) {
2383
- return safeIdx;
2384
- }
2385
- const maxCols = columns === "auto" ? itemCount <= 6 ? 2 : itemCount <= 12 ? 3 : 4 : columns;
2386
- const colCount = Math.max(1, Math.min(maxCols, itemCount));
2387
- const rowCount = Math.max(1, Math.ceil(itemCount / colCount));
2388
- const totalCols = Math.max(1, Math.ceil(itemCount / rowCount));
2389
- const row = safeIdx % rowCount;
2390
- const col = Math.floor(safeIdx / rowCount);
2391
- const nextCol = key === "ArrowRight" ? (col + 1) % totalCols : (col - 1 + totalCols) % totalCols;
2392
- return Math.min(nextCol * rowCount + row, itemCount - 1);
2393
- }
2394
- var resolveColonCommandGridNavigation = resolveCommandMenuGridNavigation;
2395
-
2396
- // src/command/styles.ts
2397
- import { cva as cva21 } from "class-variance-authority";
2398
- var commandPaletteVariants = cva21(
2399
- "flex w-full flex-col overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl outline-none",
2400
- {
2401
- variants: {
2402
- size: {
2403
- sm: "max-w-md",
2404
- md: "max-w-xl",
2405
- lg: "max-w-2xl"
2406
- }
2407
- },
2408
- defaultVariants: {
2409
- size: "md"
2410
- }
2411
- }
2412
- );
2413
- var commandPalettePositionerBase = "items-center justify-center p-4";
2414
- var commandPaletteDialogContentBase = "my-auto gap-0 overflow-hidden p-0 sm:max-w-xl";
2415
- var commandPaletteHeaderBase = "flex items-center gap-2 border-b border-border px-3 py-2.5";
2416
- 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";
2417
- 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";
2418
- var commandPaletteListBase = "max-h-80 overflow-y-auto p-1.5 outline-none";
2419
- 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";
2420
- 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";
2421
- var commandMenuVariants = cva21(
2422
- "flex w-full flex-col overflow-hidden border border-border bg-popover font-mono text-popover-foreground shadow-2xl outline-none",
2423
- {
2424
- variants: {
2425
- size: {
2426
- sm: "text-xs",
2427
- md: "text-sm",
2428
- lg: "text-base"
2429
- }
2430
- },
2431
- defaultVariants: {
2432
- size: "md"
2433
- }
2434
- }
2435
- );
2436
- var commandMenuPositionerBase = "items-end justify-stretch p-0!";
2437
- 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";
2438
- var commandMenuListVariants = cva21("overflow-y-auto border-b border-border bg-popover/95 outline-none", {
2439
- variants: {
2440
- columns: {
2441
- auto: "grid! grid-flow-col!",
2442
- 1: "flex flex-col",
2443
- 2: "grid! grid-flow-col!",
2444
- 3: "grid! grid-flow-col!",
2445
- 4: "grid! grid-flow-col!"
2446
- },
2447
- size: {
2448
- sm: "max-h-44 gap-x-2 gap-y-0.5 px-2 py-1",
2449
- md: "max-h-60 gap-x-3 gap-y-1 p-2",
2450
- lg: "max-h-72 gap-x-4 gap-y-1.5 p-3"
2451
- }
2452
- },
2453
- defaultVariants: {
2454
- columns: "auto",
2455
- size: "md"
2456
- }
2457
- });
2458
- var commandMenuItemVariants = cva21(
2459
- "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",
2460
- {
2461
- variants: {
2462
- size: {
2463
- sm: "px-1.5 py-0.5 text-[11px] leading-tight",
2464
- md: "px-2.5 py-1.5 text-xs",
2465
- lg: "px-3 py-2 text-sm"
2466
- }
2467
- },
2468
- defaultVariants: {
2469
- size: "md"
2470
- }
2471
- }
2472
- );
2473
- var commandMenuPromptBarVariants = cva21(
2474
- "flex w-full items-center border-t border-border/60 bg-muted/50 font-mono",
2475
- {
2476
- variants: {
2477
- size: {
2478
- sm: "gap-1 px-2 py-1 text-xs",
2479
- md: "gap-1.5 px-3 py-2 text-sm",
2480
- lg: "gap-2 px-4 py-2.5 text-base"
2481
- }
2482
- },
2483
- defaultVariants: {
2484
- size: "md"
2485
- }
2486
- }
2487
- );
2488
- var commandMenuPrefixBase = "select-none font-mono font-bold text-primary";
2489
- var commandMenuInputVariants = cva21(
2490
- "flex-1 border-0 bg-transparent font-mono text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-0",
2491
- {
2492
- variants: {
2493
- size: {
2494
- sm: "px-0.5 py-0 text-xs",
2495
- md: "px-1 py-0.5 text-sm",
2496
- lg: "px-1.5 py-1 text-base"
2497
- }
2498
- },
2499
- defaultVariants: {
2500
- size: "md"
2501
- }
2502
- }
2503
- );
2504
- 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";
2505
- var colonCommandVariants = commandMenuVariants;
2506
- var colonCommandPositionerBase = commandMenuPositionerBase;
2507
- var colonCommandDialogContentBase = commandMenuDialogContentBase;
2508
- var colonCommandListVariants = commandMenuListVariants;
2509
- var colonCommandItemVariants = commandMenuItemVariants;
2510
- var colonCommandPromptBarVariants = commandMenuPromptBarVariants;
2511
- var colonCommandPrefixBase = commandMenuPrefixBase;
2512
- var colonCommandInputVariants = commandMenuInputVariants;
2513
- var colonCommandErrorBase = commandMenuErrorBase;
2514
-
2515
2137
  // src/which-key/index.ts
2516
2138
  var which_key_exports = {};
2517
2139
  __export(which_key_exports, {
@@ -4015,7 +3637,7 @@ import { isModifierKey as isModifierKey2, normalizeKeyName as normalizeKeyName2,
4015
3637
  import { trackDismissableBranch } from "@zag-js/dismissable";
4016
3638
  import { getFirstFocusable, getFocusables, isEditableElement, isInView } from "@zag-js/dom-query";
4017
3639
  import { setInteractionModality, trackInteractionModality } from "@zag-js/focus-visible";
4018
- import { createLiveRegion as createLiveRegion2 } from "@zag-js/live-region";
3640
+ import { createLiveRegion } from "@zag-js/live-region";
4019
3641
  var PRIORITY_WEIGHT = {
4020
3642
  overlay: 60,
4021
3643
  widget: 50,
@@ -6318,7 +5940,7 @@ function createWhichKeyController(options = {}) {
6318
5940
  } catch {
6319
5941
  }
6320
5942
  try {
6321
- liveRegion = createLiveRegion2({
5943
+ liveRegion = createLiveRegion({
6322
5944
  level: "polite",
6323
5945
  document: doc
6324
5946
  });
@@ -6574,8 +6196,8 @@ function createWhichKeyController(options = {}) {
6574
6196
  }
6575
6197
 
6576
6198
  // src/which-key/styles.ts
6577
- import { cva as cva22 } from "class-variance-authority";
6578
- var whichKeyVariants = cva22(
6199
+ import { cva as cva23 } from "class-variance-authority";
6200
+ var whichKeyVariants = cva23(
6579
6201
  "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",
6580
6202
  {
6581
6203
  variants: {
@@ -6593,7 +6215,7 @@ var whichKeyVariants = cva22(
6593
6215
  var whichKeyHeaderBase = "flex items-center justify-between gap-2 px-3 pt-2.5 pb-1 text-xs font-medium";
6594
6216
  var whichKeyTitleBase = "flex items-center gap-1.5 font-semibold text-foreground";
6595
6217
  var whichKeyBreadcrumbBase = "flex items-center gap-1 text-[11px] text-muted-foreground";
6596
- var whichKeyBodyVariants = cva22("p-1.5", {
6218
+ var whichKeyBodyVariants = cva23("p-1.5", {
6597
6219
  variants: {
6598
6220
  variant: {
6599
6221
  helix: "flex flex-col gap-0.5",
@@ -6608,7 +6230,7 @@ var whichKeyBodyVariants = cva22("p-1.5", {
6608
6230
  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";
6609
6231
  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";
6610
6232
  var whichKeyFooterBase = "pointer-events-none h-2 shrink-0";
6611
- var whichKeyModeBadgeVariants = cva22(
6233
+ var whichKeyModeBadgeVariants = cva23(
6612
6234
  "inline-flex items-center gap-1 rounded font-mono font-semibold tracking-wider uppercase select-none",
6613
6235
  {
6614
6236
  variants: {
@@ -6637,7 +6259,7 @@ var whichKeyExplorerInputBase = "mx-4 mb-2 w-[calc(100%-2rem)] rounded-md border
6637
6259
  var whichKeyExplorerListContentBase = "max-h-none flex-1 overflow-visible px-2.5 pt-1 pb-3 outline-none";
6638
6260
  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";
6639
6261
  var whichKeyExplorerHighlightMarkBase = "rounded-xs bg-primary/20 px-0.5 font-semibold text-foreground";
6640
- var paneVariants = cva22(
6262
+ var paneVariants = cva23(
6641
6263
  "relative transition-shadow duration-150 data-[pane-active=true]:ring-1 data-[pane-active=true]:ring-primary/40",
6642
6264
  {
6643
6265
  variants: {
@@ -6652,7 +6274,7 @@ var paneVariants = cva22(
6652
6274
  }
6653
6275
  );
6654
6276
  var jumpOverlayRootBase = "pointer-events-none fixed inset-0 z-[60] overflow-hidden";
6655
- var jumpBadgeVariants = cva22(
6277
+ var jumpBadgeVariants = cva23(
6656
6278
  "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",
6657
6279
  {
6658
6280
  variants: {
@@ -8918,6 +8540,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
8918
8540
  }
8919
8541
  export {
8920
8542
  DEFAULT_JUMP_ALPHABET,
8543
+ DEFAULT_THEME2 as DEFAULT_THEME,
8921
8544
  EditorHeading,
8922
8545
  ExitHeading,
8923
8546
  HeadingWithId,
@@ -8930,14 +8553,15 @@ export {
8930
8553
  SIDEBAR_WIDTH_ICON,
8931
8554
  SIDEBAR_WIDTH_MOBILE,
8932
8555
  THEMES,
8556
+ THEME_CLASS_PREFIX2 as THEME_CLASS_PREFIX,
8933
8557
  THEME_NAMES,
8934
8558
  TitleHeading,
8935
- announceCommandMessage,
8936
8559
  badgeVariants,
8937
8560
  buildChartDefinition,
8938
8561
  buildExtensions,
8939
8562
  buildWhichKeyTree,
8940
8563
  buttonVariants,
8564
+ captureDialogFocusTarget,
8941
8565
  cardBodyBase,
8942
8566
  cardCoverVariants,
8943
8567
  cardDescriptionBase,
@@ -8968,15 +8592,6 @@ export {
8968
8592
  codeBlockSpinnerBase,
8969
8593
  codeBlockTitleBase,
8970
8594
  colBase,
8971
- colonCommandDialogContentBase,
8972
- colonCommandErrorBase,
8973
- colonCommandInputVariants,
8974
- colonCommandItemVariants,
8975
- colonCommandListVariants,
8976
- colonCommandPositionerBase,
8977
- colonCommandPrefixBase,
8978
- colonCommandPromptBarVariants,
8979
- colonCommandVariants,
8980
8595
  comboboxClearTriggerBase,
8981
8596
  comboboxContentBase,
8982
8597
  comboboxControlBase,
@@ -8988,24 +8603,8 @@ export {
8988
8603
  comboboxListBase,
8989
8604
  comboboxPositionerBase,
8990
8605
  comboboxTriggerBase,
8991
- commandMenuDialogContentBase,
8992
- commandMenuErrorBase,
8993
- commandMenuInputVariants,
8994
- commandMenuItemVariants,
8995
- commandMenuListVariants,
8996
- commandMenuPositionerBase,
8997
- commandMenuPrefixBase,
8998
- commandMenuPromptBarVariants,
8999
- commandMenuVariants,
9000
- commandPaletteBreadcrumbBase,
9001
- commandPaletteDialogContentBase,
9002
- commandPaletteFooterBase,
9003
- commandPaletteHeaderBase,
9004
- commandPaletteInputBase,
9005
- commandPaletteItemBase,
9006
- commandPaletteListBase,
9007
- commandPalettePositionerBase,
9008
- commandPaletteVariants,
8606
+ commandMenuStyles,
8607
+ commandPaletteStyles,
9009
8608
  containerBase,
9010
8609
  createCodeBlockCustom,
9011
8610
  createCommandTree,
@@ -9019,6 +8618,7 @@ export {
9019
8618
  createUrlMention,
9020
8619
  createVimPreset,
9021
8620
  createWhichKeyController,
8621
+ cycleThemeModeValue,
9022
8622
  defaultChartColor,
9023
8623
  defaultListboxFilter,
9024
8624
  dialogBackdropBase,
@@ -9031,6 +8631,7 @@ export {
9031
8631
  dialogHeaderBase,
9032
8632
  dialogHeaderStickyBase,
9033
8633
  dialogPositionerBase,
8634
+ dialogStyles,
9034
8635
  dialogTitleBase,
9035
8636
  eventToChordKeys,
9036
8637
  extractYouTubeId,
@@ -9053,8 +8654,6 @@ export {
9053
8654
  findDirectionalPane,
9054
8655
  findEditorScrollContainer,
9055
8656
  flattenKeymapEntries,
9056
- formatColonCompletionInput,
9057
- formatCommandMenuCompletionInput,
9058
8657
  formatKeyChord,
9059
8658
  formatKeySequence,
9060
8659
  formatTime,
@@ -9065,6 +8664,7 @@ export {
9065
8664
  getModalEditor,
9066
8665
  getNodeChildren,
9067
8666
  getPresetKeymap,
8667
+ hasThemeCss,
9068
8668
  hstackBase,
9069
8669
  inferPlatform,
9070
8670
  injectCodeBlockStyles,
@@ -9083,6 +8683,7 @@ export {
9083
8683
  latexErrorBase,
9084
8684
  latexInlineBase,
9085
8685
  latexRootBase,
8686
+ lightSwitchButtonVariants,
9086
8687
  listboxContentBase,
9087
8688
  listboxEmptyBase,
9088
8689
  listboxInputBase,
@@ -9101,6 +8702,7 @@ export {
9101
8702
  manimPlaceholderLabelBase,
9102
8703
  manimRootBase,
9103
8704
  matchesCommandHotkey,
8705
+ mergeThemePresets,
9104
8706
  mermaidLoadingBase,
9105
8707
  mermaidRootBase,
9106
8708
  mermaidSourceBase,
@@ -9197,22 +8799,20 @@ export {
9197
8799
  radioGroupItemControlBase,
9198
8800
  radioGroupItemTextBase,
9199
8801
  radioGroupRootBase,
8802
+ readDocumentDarkMode,
8803
+ readDocumentTheme,
8804
+ readSystemDarkMode,
8805
+ registerCustomThemes,
9200
8806
  registerImageInsertCallback,
9201
8807
  registerModalEditor,
9202
8808
  registerYouTubeInsertCallback,
9203
8809
  renderChartSvgString,
9204
8810
  renderCodeToHtml,
9205
8811
  renderMermaidSource,
9206
- resolveColonCommandGridNavigation,
9207
- resolveColonCommandGridStyle,
9208
- resolveColonCommandState,
9209
- resolveCommandLevel,
9210
- resolveCommandMenuGridNavigation,
9211
- resolveCommandMenuGridStyle,
9212
- resolveCommandMenuState,
9213
8812
  resolveKbdSteps,
9214
8813
  resolveMermaidThemeVariables,
9215
8814
  resolveNode,
8815
+ restoreDialogFocusTarget,
9216
8816
  revealChevronBase,
9217
8817
  revealContentBase,
9218
8818
  revealRootBase,
@@ -9235,22 +8835,24 @@ export {
9235
8835
  selectTriggerBase,
9236
8836
  selectValueBase,
9237
8837
  serializeModalSliceText,
9238
- shouldHandleCommandHotkey,
9239
8838
  sidebarMenuButtonVariants,
9240
8839
  sidebarStyles,
9241
8840
  slashCommands,
9242
- splitHighlightSegments,
9243
8841
  splitterPanelBase,
9244
8842
  splitterResizeTriggerBase,
9245
8843
  splitterResizeTriggerIndicatorBase,
9246
8844
  splitterResizeTriggerSeparatorBase,
9247
8845
  splitterRootBase,
9248
8846
  stackBase,
8847
+ subscribeDocumentTheme,
9249
8848
  subscribeDocumentWhichKeyController,
8849
+ subscribeSystemDarkMode,
9250
8850
  switchControlBase,
9251
8851
  switchLabelBase,
9252
8852
  switchThumbBase,
9253
8853
  switchVariants,
8854
+ syncDocumentDarkMode,
8855
+ syncDocumentTheme,
9254
8856
  tabsContentBase,
9255
8857
  tabsIndicatorBase,
9256
8858
  tabsIndicatorVariants,
@@ -9267,6 +8869,7 @@ export {
9267
8869
  tagsInputItemTextBase,
9268
8870
  tagsInputRootBase,
9269
8871
  textareaBase,
8872
+ themeSelectorStyles,
9270
8873
  toLaTeX,
9271
8874
  toastActionTriggerBase,
9272
8875
  toastCloseTriggerBase,