@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.cjs CHANGED
@@ -32,6 +32,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
32
32
  var index_exports = {};
33
33
  __export(index_exports, {
34
34
  DEFAULT_JUMP_ALPHABET: () => DEFAULT_JUMP_ALPHABET,
35
+ DEFAULT_THEME: () => DEFAULT_THEME2,
35
36
  EditorHeading: () => EditorHeading,
36
37
  ExitHeading: () => ExitHeading,
37
38
  HeadingWithId: () => HeadingWithId,
@@ -44,14 +45,15 @@ __export(index_exports, {
44
45
  SIDEBAR_WIDTH_ICON: () => SIDEBAR_WIDTH_ICON,
45
46
  SIDEBAR_WIDTH_MOBILE: () => SIDEBAR_WIDTH_MOBILE,
46
47
  THEMES: () => THEMES,
48
+ THEME_CLASS_PREFIX: () => THEME_CLASS_PREFIX2,
47
49
  THEME_NAMES: () => THEME_NAMES,
48
50
  TitleHeading: () => TitleHeading,
49
- announceCommandMessage: () => announceCommandMessage,
50
51
  badgeVariants: () => badgeVariants,
51
52
  buildChartDefinition: () => buildChartDefinition,
52
53
  buildExtensions: () => buildExtensions,
53
54
  buildWhichKeyTree: () => buildWhichKeyTree,
54
55
  buttonVariants: () => buttonVariants,
56
+ captureDialogFocusTarget: () => captureDialogFocusTarget,
55
57
  cardBodyBase: () => cardBodyBase,
56
58
  cardCoverVariants: () => cardCoverVariants,
57
59
  cardDescriptionBase: () => cardDescriptionBase,
@@ -82,15 +84,6 @@ __export(index_exports, {
82
84
  codeBlockSpinnerBase: () => codeBlockSpinnerBase,
83
85
  codeBlockTitleBase: () => codeBlockTitleBase,
84
86
  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,
94
87
  comboboxClearTriggerBase: () => comboboxClearTriggerBase,
95
88
  comboboxContentBase: () => comboboxContentBase,
96
89
  comboboxControlBase: () => comboboxControlBase,
@@ -102,24 +95,8 @@ __export(index_exports, {
102
95
  comboboxListBase: () => comboboxListBase,
103
96
  comboboxPositionerBase: () => comboboxPositionerBase,
104
97
  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,
98
+ commandMenuStyles: () => commandMenuStyles,
99
+ commandPaletteStyles: () => commandPaletteStyles,
123
100
  containerBase: () => containerBase,
124
101
  createCodeBlockCustom: () => createCodeBlockCustom,
125
102
  createCommandTree: () => createCommandTree,
@@ -133,6 +110,7 @@ __export(index_exports, {
133
110
  createUrlMention: () => createUrlMention,
134
111
  createVimPreset: () => createVimPreset,
135
112
  createWhichKeyController: () => createWhichKeyController,
113
+ cycleThemeModeValue: () => cycleThemeModeValue,
136
114
  defaultChartColor: () => defaultChartColor,
137
115
  defaultListboxFilter: () => defaultListboxFilter,
138
116
  dialogBackdropBase: () => dialogBackdropBase,
@@ -145,6 +123,7 @@ __export(index_exports, {
145
123
  dialogHeaderBase: () => dialogHeaderBase,
146
124
  dialogHeaderStickyBase: () => dialogHeaderStickyBase,
147
125
  dialogPositionerBase: () => dialogPositionerBase,
126
+ dialogStyles: () => dialogStyles,
148
127
  dialogTitleBase: () => dialogTitleBase,
149
128
  eventToChordKeys: () => eventToChordKeys,
150
129
  extractYouTubeId: () => extractYouTubeId,
@@ -167,8 +146,6 @@ __export(index_exports, {
167
146
  findDirectionalPane: () => findDirectionalPane,
168
147
  findEditorScrollContainer: () => findEditorScrollContainer,
169
148
  flattenKeymapEntries: () => flattenKeymapEntries,
170
- formatColonCompletionInput: () => formatColonCompletionInput,
171
- formatCommandMenuCompletionInput: () => formatCommandMenuCompletionInput,
172
149
  formatKeyChord: () => formatKeyChord,
173
150
  formatKeySequence: () => formatKeySequence,
174
151
  formatTime: () => formatTime,
@@ -179,6 +156,7 @@ __export(index_exports, {
179
156
  getModalEditor: () => getModalEditor,
180
157
  getNodeChildren: () => getNodeChildren,
181
158
  getPresetKeymap: () => getPresetKeymap,
159
+ hasThemeCss: () => hasThemeCss,
182
160
  hstackBase: () => hstackBase,
183
161
  inferPlatform: () => inferPlatform,
184
162
  injectCodeBlockStyles: () => injectCodeBlockStyles,
@@ -197,6 +175,7 @@ __export(index_exports, {
197
175
  latexErrorBase: () => latexErrorBase,
198
176
  latexInlineBase: () => latexInlineBase,
199
177
  latexRootBase: () => latexRootBase,
178
+ lightSwitchButtonVariants: () => lightSwitchButtonVariants,
200
179
  listboxContentBase: () => listboxContentBase,
201
180
  listboxEmptyBase: () => listboxEmptyBase,
202
181
  listboxInputBase: () => listboxInputBase,
@@ -215,6 +194,7 @@ __export(index_exports, {
215
194
  manimPlaceholderLabelBase: () => manimPlaceholderLabelBase,
216
195
  manimRootBase: () => manimRootBase,
217
196
  matchesCommandHotkey: () => matchesCommandHotkey,
197
+ mergeThemePresets: () => mergeThemePresets,
218
198
  mermaidLoadingBase: () => mermaidLoadingBase,
219
199
  mermaidRootBase: () => mermaidRootBase,
220
200
  mermaidSourceBase: () => mermaidSourceBase,
@@ -311,22 +291,20 @@ __export(index_exports, {
311
291
  radioGroupItemControlBase: () => radioGroupItemControlBase,
312
292
  radioGroupItemTextBase: () => radioGroupItemTextBase,
313
293
  radioGroupRootBase: () => radioGroupRootBase,
294
+ readDocumentDarkMode: () => readDocumentDarkMode,
295
+ readDocumentTheme: () => readDocumentTheme,
296
+ readSystemDarkMode: () => readSystemDarkMode,
297
+ registerCustomThemes: () => registerCustomThemes,
314
298
  registerImageInsertCallback: () => registerImageInsertCallback,
315
299
  registerModalEditor: () => registerModalEditor,
316
300
  registerYouTubeInsertCallback: () => registerYouTubeInsertCallback,
317
301
  renderChartSvgString: () => renderChartSvgString,
318
302
  renderCodeToHtml: () => renderCodeToHtml,
319
303
  renderMermaidSource: () => renderMermaidSource,
320
- resolveColonCommandGridNavigation: () => resolveColonCommandGridNavigation,
321
- resolveColonCommandGridStyle: () => resolveColonCommandGridStyle,
322
- resolveColonCommandState: () => resolveColonCommandState,
323
- resolveCommandLevel: () => resolveCommandLevel,
324
- resolveCommandMenuGridNavigation: () => resolveCommandMenuGridNavigation,
325
- resolveCommandMenuGridStyle: () => resolveCommandMenuGridStyle,
326
- resolveCommandMenuState: () => resolveCommandMenuState,
327
304
  resolveKbdSteps: () => resolveKbdSteps,
328
305
  resolveMermaidThemeVariables: () => resolveMermaidThemeVariables,
329
306
  resolveNode: () => resolveNode,
307
+ restoreDialogFocusTarget: () => restoreDialogFocusTarget,
330
308
  revealChevronBase: () => revealChevronBase,
331
309
  revealContentBase: () => revealContentBase,
332
310
  revealRootBase: () => revealRootBase,
@@ -349,22 +327,24 @@ __export(index_exports, {
349
327
  selectTriggerBase: () => selectTriggerBase,
350
328
  selectValueBase: () => selectValueBase,
351
329
  serializeModalSliceText: () => serializeModalSliceText,
352
- shouldHandleCommandHotkey: () => shouldHandleCommandHotkey,
353
330
  sidebarMenuButtonVariants: () => sidebarMenuButtonVariants,
354
331
  sidebarStyles: () => sidebarStyles,
355
332
  slashCommands: () => slashCommands,
356
- splitHighlightSegments: () => splitHighlightSegments,
357
333
  splitterPanelBase: () => splitterPanelBase,
358
334
  splitterResizeTriggerBase: () => splitterResizeTriggerBase,
359
335
  splitterResizeTriggerIndicatorBase: () => splitterResizeTriggerIndicatorBase,
360
336
  splitterResizeTriggerSeparatorBase: () => splitterResizeTriggerSeparatorBase,
361
337
  splitterRootBase: () => splitterRootBase,
362
338
  stackBase: () => stackBase,
339
+ subscribeDocumentTheme: () => subscribeDocumentTheme,
363
340
  subscribeDocumentWhichKeyController: () => subscribeDocumentWhichKeyController,
341
+ subscribeSystemDarkMode: () => subscribeSystemDarkMode,
364
342
  switchControlBase: () => switchControlBase,
365
343
  switchLabelBase: () => switchLabelBase,
366
344
  switchThumbBase: () => switchThumbBase,
367
345
  switchVariants: () => switchVariants,
346
+ syncDocumentDarkMode: () => syncDocumentDarkMode,
347
+ syncDocumentTheme: () => syncDocumentTheme,
368
348
  tabsContentBase: () => tabsContentBase,
369
349
  tabsIndicatorBase: () => tabsIndicatorBase,
370
350
  tabsIndicatorVariants: () => tabsIndicatorVariants,
@@ -381,6 +361,7 @@ __export(index_exports, {
381
361
  tagsInputItemTextBase: () => tagsInputItemTextBase,
382
362
  tagsInputRootBase: () => tagsInputRootBase,
383
363
  textareaBase: () => textareaBase,
364
+ themeSelectorStyles: () => themeSelectorStyles,
384
365
  toLaTeX: () => toLaTeX,
385
366
  toastActionTriggerBase: () => toastActionTriggerBase,
386
367
  toastCloseTriggerBase: () => toastCloseTriggerBase,
@@ -551,6 +532,63 @@ var dialogHeaderStickyBase = "sticky top-0 z-10 bg-background";
551
532
  var dialogFooterStickyBase = "sticky bottom-0 z-10 bg-background";
552
533
  var dialogFullscreenContentBase = "h-dvh w-full max-w-none rounded-none border-0 p-0 sm:rounded-none";
553
534
  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";
535
+ var dialogStyles = {
536
+ backdrop: dialogBackdropBase,
537
+ positioner: dialogPositionerBase,
538
+ content: dialogContentBase,
539
+ title: dialogTitleBase,
540
+ description: dialogDescriptionBase,
541
+ header: dialogHeaderBase,
542
+ footer: dialogFooterBase,
543
+ headerSticky: dialogHeaderStickyBase,
544
+ footerSticky: dialogFooterStickyBase,
545
+ fullscreenContent: dialogFullscreenContentBase,
546
+ closeTrigger: dialogCloseTriggerBase
547
+ };
548
+ function captureDialogFocusTarget(excludeRoot) {
549
+ if (typeof document === "undefined" || !(document.activeElement instanceof HTMLElement)) {
550
+ return null;
551
+ }
552
+ const active = document.activeElement;
553
+ if (active === document.body || active === document.documentElement) {
554
+ return null;
555
+ }
556
+ if (excludeRoot?.contains(active)) {
557
+ return null;
558
+ }
559
+ return active;
560
+ }
561
+ function restoreDialogFocusTarget(previousFocusEl, closingContentEl) {
562
+ if (typeof window === "undefined" || typeof document === "undefined") return;
563
+ const hasFocusMovedElsewhere = () => {
564
+ const active = document.activeElement;
565
+ if (active && active !== document.body && active !== document.documentElement && active !== previousFocusEl && (!closingContentEl || !closingContentEl.contains(active)) && !active.closest('[data-state="closed"]')) {
566
+ return true;
567
+ }
568
+ const openModal = document.querySelector(
569
+ '[role="dialog"][data-state="open"], [data-modal="true"]:not([data-state="closed"])'
570
+ );
571
+ if (openModal && openModal !== closingContentEl) {
572
+ return true;
573
+ }
574
+ return false;
575
+ };
576
+ if (hasFocusMovedElsewhere()) return;
577
+ const applyRestore = () => {
578
+ if (hasFocusMovedElsewhere()) return;
579
+ if (previousFocusEl && document.contains(previousFocusEl)) {
580
+ previousFocusEl.focus();
581
+ }
582
+ };
583
+ if (typeof window.requestAnimationFrame === "function") {
584
+ window.requestAnimationFrame(() => {
585
+ if (hasFocusMovedElsewhere()) return;
586
+ window.requestAnimationFrame(applyRestore);
587
+ });
588
+ } else {
589
+ applyRestore();
590
+ }
591
+ }
554
592
 
555
593
  // src/window.ts
556
594
  var windowPositionerBase = "z-50 [--z-index:50]!";
@@ -988,8 +1026,77 @@ var navbarMobileHeaderBase = "flex items-center justify-between gap-2 px-4 py-3"
988
1026
  var navbarMobileMenuBase = "flex flex-1 flex-col gap-1 overflow-y-auto px-4 py-2";
989
1027
  var navbarMobileActionsBase = "flex items-center gap-2 border-t border-border px-4 py-4";
990
1028
 
1029
+ // src/light-switch.ts
1030
+ var import_class_variance_authority11 = require("class-variance-authority");
1031
+ var THEME_CLASS_PREFIX = "theme-";
1032
+ var DEFAULT_THEME = "helical-ui";
1033
+ var lightSwitchButtonVariants = (0, import_class_variance_authority11.cva)("ml-auto h-[26px] w-[26px] p-1");
1034
+ function cycleThemeModeValue(mode) {
1035
+ return mode === "system" ? "light" : mode === "light" ? "dark" : "system";
1036
+ }
1037
+ function readSystemDarkMode() {
1038
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return false;
1039
+ try {
1040
+ return window.matchMedia("(prefers-color-scheme: dark)").matches;
1041
+ } catch {
1042
+ return false;
1043
+ }
1044
+ }
1045
+ function subscribeSystemDarkMode(onChange) {
1046
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
1047
+ return () => {
1048
+ };
1049
+ }
1050
+ try {
1051
+ const media = window.matchMedia("(prefers-color-scheme: dark)");
1052
+ const listener = (event) => onChange(event.matches);
1053
+ media.addEventListener("change", listener);
1054
+ return () => media.removeEventListener("change", listener);
1055
+ } catch {
1056
+ return () => {
1057
+ };
1058
+ }
1059
+ }
1060
+ function readDocumentDarkMode() {
1061
+ if (typeof document === "undefined") return readSystemDarkMode();
1062
+ return document.documentElement.classList.contains("dark");
1063
+ }
1064
+ function syncDocumentDarkMode(dark) {
1065
+ if (typeof document === "undefined") return;
1066
+ const root = document.documentElement;
1067
+ const hasThemeClass = Array.from(root.classList).some((cls) => cls.startsWith(THEME_CLASS_PREFIX));
1068
+ if (!hasThemeClass) {
1069
+ root.classList.add(`${THEME_CLASS_PREFIX}${DEFAULT_THEME}`);
1070
+ }
1071
+ root.classList.toggle("dark", dark);
1072
+ }
1073
+
991
1074
  // src/themes.ts
992
- var THEMES = [
1075
+ var import_class_variance_authority12 = require("class-variance-authority");
1076
+ var THEME_CLASS_PREFIX2 = "theme-";
1077
+ var DEFAULT_THEME2 = "helical-ui";
1078
+ var themeSelectorContainerBase = "max-h-64 overflow-y-auto rounded-md border border-border p-2";
1079
+ var themeSelectorGridBase = "grid grid-cols-2 gap-2";
1080
+ var themeSelectorSwatchVariants = (0, import_class_variance_authority12.cva)(
1081
+ "relative flex flex-col gap-1.5 overflow-hidden rounded-md border bg-background p-1.5 text-left text-foreground transition-colors",
1082
+ {
1083
+ variants: {
1084
+ active: {
1085
+ true: "border-foreground",
1086
+ false: "border-border hover:border-muted-foreground"
1087
+ }
1088
+ },
1089
+ defaultVariants: {
1090
+ active: false
1091
+ }
1092
+ }
1093
+ );
1094
+ var themeSelectorStyles = {
1095
+ container: themeSelectorContainerBase,
1096
+ grid: themeSelectorGridBase,
1097
+ swatch: themeSelectorSwatchVariants
1098
+ };
1099
+ var BUILTIN_THEMES = [
993
1100
  { name: "amber-minimal", label: "Amber Minimal" },
994
1101
  { name: "amethyst-haze", label: "Amethyst Haze" },
995
1102
  { name: "anthropic", label: "Anthropic" },
@@ -1044,7 +1151,161 @@ var THEMES = [
1044
1151
  { name: "vitepress", label: "Vitepress" },
1045
1152
  { name: "helical-ui", label: "Helical UI" }
1046
1153
  ];
1154
+ var BUILTIN_THEME_NAMES = new Set(BUILTIN_THEMES.map((t) => t.name));
1155
+ var customThemesWithCss = /* @__PURE__ */ new Set();
1156
+ var themeSubscribers = /* @__PURE__ */ new Set();
1157
+ var THEMES = [...BUILTIN_THEMES];
1047
1158
  var THEME_NAMES = THEMES.map((t) => t.name);
1159
+ function notifyThemeSubscribers() {
1160
+ const snapshot = {
1161
+ theme: readDocumentTheme(),
1162
+ dark: readDocumentDarkMode(),
1163
+ themes: [...THEMES]
1164
+ };
1165
+ for (const listener of themeSubscribers) {
1166
+ listener(snapshot);
1167
+ }
1168
+ }
1169
+ function escapeRegExp(value) {
1170
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1171
+ }
1172
+ function ruleListHasThemeSelector(rules, pattern) {
1173
+ for (let i = 0; i < rules.length; i += 1) {
1174
+ const rule = rules[i];
1175
+ if (!rule) continue;
1176
+ if ("selectorText" in rule && typeof rule.selectorText === "string") {
1177
+ if (pattern.test(rule.selectorText)) {
1178
+ return true;
1179
+ }
1180
+ }
1181
+ if ("cssRules" in rule && rule.cssRules) {
1182
+ if (ruleListHasThemeSelector(rule.cssRules, pattern)) {
1183
+ return true;
1184
+ }
1185
+ }
1186
+ }
1187
+ return false;
1188
+ }
1189
+ function injectCustomThemeCss(theme) {
1190
+ if (theme.css?.trim()) {
1191
+ customThemesWithCss.add(theme.name);
1192
+ }
1193
+ if (typeof document === "undefined" || !theme.css?.trim()) return;
1194
+ const selector = `style[data-helical-custom-theme="${theme.name}"]`;
1195
+ let styleEl = document.head.querySelector(selector);
1196
+ if (!styleEl) {
1197
+ styleEl = document.createElement("style");
1198
+ styleEl.setAttribute("data-helical-custom-theme", theme.name);
1199
+ document.head.appendChild(styleEl);
1200
+ }
1201
+ if (styleEl.textContent !== theme.css) {
1202
+ styleEl.textContent = theme.css;
1203
+ }
1204
+ }
1205
+ function registerCustomThemes(customThemes) {
1206
+ const merged = [];
1207
+ const seen = /* @__PURE__ */ new Set();
1208
+ for (const custom of customThemes) {
1209
+ if (!seen.has(custom.name)) {
1210
+ injectCustomThemeCss(custom);
1211
+ merged.push(custom);
1212
+ seen.add(custom.name);
1213
+ }
1214
+ }
1215
+ for (const preset of THEMES) {
1216
+ if (!seen.has(preset.name)) {
1217
+ merged.push(preset);
1218
+ seen.add(preset.name);
1219
+ }
1220
+ }
1221
+ for (const preset of BUILTIN_THEMES) {
1222
+ if (!seen.has(preset.name)) {
1223
+ merged.push(preset);
1224
+ seen.add(preset.name);
1225
+ }
1226
+ }
1227
+ const changed = merged.length !== THEMES.length || merged.some((item, idx) => THEMES[idx]?.name !== item.name);
1228
+ THEMES.splice(0, THEMES.length, ...merged);
1229
+ THEME_NAMES.splice(0, THEME_NAMES.length, ...merged.map((t) => t.name));
1230
+ if (changed) {
1231
+ notifyThemeSubscribers();
1232
+ }
1233
+ return merged;
1234
+ }
1235
+ var mergeThemePresets = registerCustomThemes;
1236
+ function hasThemeCss(theme) {
1237
+ if (!theme) return false;
1238
+ if (typeof document === "undefined" || !document.styleSheets || document.styleSheets.length === 0) {
1239
+ return BUILTIN_THEME_NAMES.has(theme) || customThemesWithCss.has(theme);
1240
+ }
1241
+ const pattern = new RegExp(`\\.${THEME_CLASS_PREFIX2}${escapeRegExp(theme)}(?![a-zA-Z0-9_-])`);
1242
+ for (let i = 0; i < document.styleSheets.length; i += 1) {
1243
+ const sheet = document.styleSheets[i];
1244
+ if (!sheet) continue;
1245
+ try {
1246
+ if (sheet.cssRules && ruleListHasThemeSelector(sheet.cssRules, pattern)) {
1247
+ return true;
1248
+ }
1249
+ } catch {
1250
+ }
1251
+ }
1252
+ return false;
1253
+ }
1254
+ function readDocumentTheme() {
1255
+ if (typeof document === "undefined") return DEFAULT_THEME2;
1256
+ const classes = Array.from(document.documentElement.classList);
1257
+ for (const cls of classes) {
1258
+ if (cls.startsWith(THEME_CLASS_PREFIX2)) {
1259
+ const candidate = cls.slice(THEME_CLASS_PREFIX2.length);
1260
+ if (candidate) return candidate;
1261
+ }
1262
+ }
1263
+ return DEFAULT_THEME2;
1264
+ }
1265
+ function syncDocumentTheme(theme, dark) {
1266
+ const resolvedTheme = hasThemeCss(theme) ? theme : DEFAULT_THEME2;
1267
+ if (typeof document === "undefined") return resolvedTheme;
1268
+ const root = document.documentElement;
1269
+ const targetClass = `${THEME_CLASS_PREFIX2}${resolvedTheme}`;
1270
+ const toRemove = [];
1271
+ root.classList.forEach((cls) => {
1272
+ if (cls.startsWith(THEME_CLASS_PREFIX2) && cls !== targetClass) {
1273
+ toRemove.push(cls);
1274
+ }
1275
+ });
1276
+ for (const cls of toRemove) {
1277
+ root.classList.remove(cls);
1278
+ }
1279
+ if (!root.classList.contains(targetClass)) {
1280
+ root.classList.add(targetClass);
1281
+ }
1282
+ if (typeof dark === "boolean") {
1283
+ root.classList.toggle("dark", dark);
1284
+ }
1285
+ notifyThemeSubscribers();
1286
+ return resolvedTheme;
1287
+ }
1288
+ function subscribeDocumentTheme(onChange) {
1289
+ themeSubscribers.add(onChange);
1290
+ if (typeof document === "undefined" || typeof MutationObserver === "undefined") {
1291
+ return () => {
1292
+ themeSubscribers.delete(onChange);
1293
+ };
1294
+ }
1295
+ const root = document.documentElement;
1296
+ const observer = new MutationObserver(() => {
1297
+ onChange({
1298
+ theme: readDocumentTheme(),
1299
+ dark: readDocumentDarkMode(),
1300
+ themes: [...THEMES]
1301
+ });
1302
+ });
1303
+ observer.observe(root, { attributes: true, attributeFilter: ["class"] });
1304
+ return () => {
1305
+ themeSubscribers.delete(onChange);
1306
+ observer.disconnect();
1307
+ };
1308
+ }
1048
1309
 
1049
1310
  // src/field.ts
1050
1311
  var fieldRootBase = "flex w-full flex-col gap-2 data-invalid:text-destructive";
@@ -1058,8 +1319,8 @@ var fieldsetHelperBase = "text-sm text-muted-foreground";
1058
1319
  var fieldsetErrorBase = "text-sm text-destructive";
1059
1320
 
1060
1321
  // src/input.ts
1061
- var import_class_variance_authority11 = require("class-variance-authority");
1062
- var inputVariants = (0, import_class_variance_authority11.cva)(
1322
+ var import_class_variance_authority13 = require("class-variance-authority");
1323
+ var inputVariants = (0, import_class_variance_authority13.cva)(
1063
1324
  "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",
1064
1325
  {
1065
1326
  variants: {
@@ -1085,8 +1346,8 @@ var numberInputInputBase = "h-9 w-full min-w-0 flex-1 border-0 bg-transparent px
1085
1346
  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";
1086
1347
 
1087
1348
  // src/checkbox.ts
1088
- var import_class_variance_authority12 = require("class-variance-authority");
1089
- var checkboxVariants = (0, import_class_variance_authority12.cva)(
1349
+ var import_class_variance_authority14 = require("class-variance-authority");
1350
+ var checkboxVariants = (0, import_class_variance_authority14.cva)(
1090
1351
  "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",
1091
1352
  {
1092
1353
  variants: {
@@ -1106,8 +1367,8 @@ var checkboxLabelBase = "select-none text-sm font-medium leading-none";
1106
1367
  var checkboxGroupBase = "flex flex-col gap-2";
1107
1368
 
1108
1369
  // src/switch.ts
1109
- var import_class_variance_authority13 = require("class-variance-authority");
1110
- var switchVariants = (0, import_class_variance_authority13.cva)(
1370
+ var import_class_variance_authority15 = require("class-variance-authority");
1371
+ var switchVariants = (0, import_class_variance_authority15.cva)(
1111
1372
  "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",
1112
1373
  {
1113
1374
  variants: {
@@ -1127,7 +1388,7 @@ var switchThumbBase = "pointer-events-none block aspect-square h-full w-auto rou
1127
1388
  var switchLabelBase = "select-none text-sm font-medium leading-none";
1128
1389
 
1129
1390
  // src/select.ts
1130
- var import_class_variance_authority14 = require("class-variance-authority");
1391
+ var import_class_variance_authority16 = require("class-variance-authority");
1131
1392
  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";
1132
1393
  var selectValueBase = "flex min-w-0 items-center gap-2 truncate";
1133
1394
  var selectIndicatorBase = "flex items-center justify-center text-muted-foreground";
@@ -1138,7 +1399,7 @@ var selectItemGroupLabelBase = "px-2 py-1.5 text-xs font-semibold text-muted-for
1138
1399
  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";
1139
1400
  var selectItemTextBase = "flex w-full flex-1 items-center gap-2";
1140
1401
  var selectItemIndicatorBase = "absolute inset-y-0 end-2 flex items-center justify-center text-foreground";
1141
- var nativeSelectVariants = (0, import_class_variance_authority14.cva)(
1402
+ var nativeSelectVariants = (0, import_class_variance_authority16.cva)(
1142
1403
  "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",
1143
1404
  {
1144
1405
  variants: {
@@ -1157,7 +1418,7 @@ var nativeSelectWrapperBase = "relative w-fit [&_svg]:pointer-events-none [&_svg
1157
1418
  var nativeSelectIconBase = "pointer-events-none absolute inset-y-0 end-2.5 flex items-center justify-center text-muted-foreground";
1158
1419
 
1159
1420
  // src/combobox.ts
1160
- var import_class_variance_authority15 = require("class-variance-authority");
1421
+ var import_class_variance_authority17 = require("class-variance-authority");
1161
1422
  var comboboxControlBase = "relative flex w-full flex-wrap items-center gap-1";
1162
1423
  var comboboxInputBase = "pe-8";
1163
1424
  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";
@@ -1165,7 +1426,7 @@ var comboboxClearTriggerBase = "absolute inset-y-0 end-9 flex items-center justi
1165
1426
  var comboboxPositionerBase = "z-50 [--z-index:50]!";
1166
1427
  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";
1167
1428
  var comboboxItemGroupLabelBase = "px-2 py-1.5 text-xs font-semibold text-muted-foreground";
1168
- var comboboxItemVariants = (0, import_class_variance_authority15.cva)(
1429
+ var comboboxItemVariants = (0, import_class_variance_authority17.cva)(
1169
1430
  "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",
1170
1431
  {
1171
1432
  variants: {
@@ -1263,8 +1524,8 @@ var radioGroupItemControlBase = "relative inline-flex size-4 shrink-0 items-cent
1263
1524
  var radioGroupItemTextBase = "select-none text-sm font-medium leading-none";
1264
1525
 
1265
1526
  // src/notice.ts
1266
- var import_class_variance_authority16 = require("class-variance-authority");
1267
- var noticeVariants = (0, import_class_variance_authority16.cva)(
1527
+ var import_class_variance_authority18 = require("class-variance-authority");
1528
+ var noticeVariants = (0, import_class_variance_authority18.cva)(
1268
1529
  "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",
1269
1530
  {
1270
1531
  variants: {
@@ -1555,8 +1816,8 @@ var quizSubmitButtonBase = "rounded-md bg-primary px-3 py-1.5 text-sm font-mediu
1555
1816
  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";
1556
1817
 
1557
1818
  // src/prose.ts
1558
- var import_class_variance_authority17 = require("class-variance-authority");
1559
- var proseVariants = (0, import_class_variance_authority17.cva)(
1819
+ var import_class_variance_authority19 = require("class-variance-authority");
1820
+ var proseVariants = (0, import_class_variance_authority19.cva)(
1560
1821
  [
1561
1822
  "text-foreground",
1562
1823
  "max-w-none",
@@ -1599,8 +1860,8 @@ var proseVariants = (0, import_class_variance_authority17.cva)(
1599
1860
  );
1600
1861
 
1601
1862
  // src/toggle-group.ts
1602
- var import_class_variance_authority18 = require("class-variance-authority");
1603
- var toggleGroupRootVariants = (0, import_class_variance_authority18.cva)("inline-flex items-center", {
1863
+ var import_class_variance_authority20 = require("class-variance-authority");
1864
+ var toggleGroupRootVariants = (0, import_class_variance_authority20.cva)("inline-flex items-center", {
1604
1865
  variants: {
1605
1866
  orientation: { horizontal: "flex-row", vertical: "flex-col" },
1606
1867
  // `gap` belongs to the variants, not the base. With a `gap-1` base plus a `gap-0` variant
@@ -1646,9 +1907,9 @@ var listboxItemGroupBase = "flex flex-col py-1 first:pt-0 last:pb-0";
1646
1907
  var listboxItemGroupLabelBase = "px-2 py-1 text-[11px] font-semibold tracking-wider text-muted-foreground uppercase select-none";
1647
1908
 
1648
1909
  // src/kbd.ts
1649
- var import_class_variance_authority19 = require("class-variance-authority");
1910
+ var import_class_variance_authority21 = require("class-variance-authority");
1650
1911
  var import_hotkeys = require("@tanstack/hotkeys");
1651
- var kbdVariants = (0, import_class_variance_authority19.cva)(
1912
+ var kbdVariants = (0, import_class_variance_authority21.cva)(
1652
1913
  "inline-flex shrink-0 items-center justify-center gap-0.5 rounded border font-mono font-medium leading-none tracking-tight select-none",
1653
1914
  {
1654
1915
  variants: {
@@ -1844,13 +2105,13 @@ function isChordCommandString(value) {
1844
2105
  }
1845
2106
 
1846
2107
  // src/toast.ts
1847
- var import_class_variance_authority20 = require("class-variance-authority");
2108
+ var import_class_variance_authority22 = require("class-variance-authority");
1848
2109
  var toasterBase = [
1849
2110
  "w-[calc(100%-var(--viewport-offset-left))] sm:w-(--width) [--width:22.25rem]",
1850
2111
  "data-[align=center]:left-[calc(var(--viewport-offset-right)/2)]!",
1851
2112
  "sm:data-[align=center]:w-full"
1852
2113
  ].join(" ");
1853
- var toastVariants = (0, import_class_variance_authority20.cva)(
2114
+ var toastVariants = (0, import_class_variance_authority22.cva)(
1854
2115
  [
1855
2116
  "z-(--z-index) translate-x-(--x) translate-y-(--y) opacity-(--opacity)",
1856
2117
  "data-[overlap]:scale-[calc(1-var(--index,0)*0.04)]",
@@ -1886,12 +2147,7 @@ var import_i18n_utils = require("@zag-js/i18n-utils");
1886
2147
  var import_live_region = require("@zag-js/live-region");
1887
2148
  var import_fzf = require("fzf");
1888
2149
  var ROOT_NODE_VALUE = "__root__";
1889
- var DEFAULT_GROUP_LABEL = "Commands";
1890
2150
  var i18nFilter = (0, import_i18n_utils.createFilter)({ sensitivity: "base" });
1891
- var sharedLiveRegion = null;
1892
- function getNodeCommandToken(node) {
1893
- return (node.command ?? node.value).trim();
1894
- }
1895
2151
  function isEditableTarget(target) {
1896
2152
  if (!target || typeof target !== "object") return false;
1897
2153
  const el = target;
@@ -1903,71 +2159,6 @@ function isEditableTarget(target) {
1903
2159
  }
1904
2160
  return false;
1905
2161
  }
1906
- function toFlatItem(node, ancestorPath, ancestorLabels, ancestorCommands, tree, fallbackGroup) {
1907
- const cmd = getNodeCommandToken(node);
1908
- const valuePath = [...ancestorPath, node.value];
1909
- const commandTokens = [...ancestorCommands, cmd];
1910
- const isBranch = tree.isBranchNode(node);
1911
- const group = node.group ?? fallbackGroup ?? (ancestorLabels.length > 0 ? ancestorLabels[ancestorLabels.length - 1] : DEFAULT_GROUP_LABEL);
1912
- return {
1913
- value: valuePath.join("/"),
1914
- label: node.label,
1915
- description: node.description,
1916
- group,
1917
- command: cmd,
1918
- fullCommand: `:${commandTokens.join(" ")}`,
1919
- aliases: node.aliases ?? [],
1920
- shortcut: node.shortcut,
1921
- badge: node.badge,
1922
- active: Boolean(node.active),
1923
- disabled: Boolean(node.disabled),
1924
- isBranch,
1925
- valuePath,
1926
- breadcrumbLabels: ancestorLabels,
1927
- node
1928
- };
1929
- }
1930
- function groupCommandItems(items) {
1931
- const map = /* @__PURE__ */ new Map();
1932
- for (const item of items) {
1933
- const groupLabel = item.group || DEFAULT_GROUP_LABEL;
1934
- const list = map.get(groupLabel);
1935
- if (list) {
1936
- list.push(item);
1937
- } else {
1938
- map.set(groupLabel, [item]);
1939
- }
1940
- }
1941
- return Array.from(map.entries()).map(([label, groupItems]) => ({
1942
- label,
1943
- items: groupItems
1944
- }));
1945
- }
1946
- function collectDeepFlatItems(parentNode, ancestorPath, ancestorLabels, ancestorCommands, tree, out) {
1947
- const children = tree.getNodeChildren(parentNode);
1948
- for (const child of children) {
1949
- const flat = toFlatItem(child, ancestorPath, ancestorLabels, ancestorCommands, tree);
1950
- out.push(flat);
1951
- if (tree.isBranchNode(child)) {
1952
- collectDeepFlatItems(
1953
- child,
1954
- [...ancestorPath, child.value],
1955
- [...ancestorLabels, child.label],
1956
- [...ancestorCommands, getNodeCommandToken(child)],
1957
- tree,
1958
- out
1959
- );
1960
- }
1961
- }
1962
- }
1963
- function matchesCommandToken(node, token) {
1964
- const lower = token.toLowerCase();
1965
- const cmd = getNodeCommandToken(node).toLowerCase();
1966
- if (cmd === lower || node.value.toLowerCase() === lower) {
1967
- return true;
1968
- }
1969
- return (node.aliases ?? []).some((alias) => alias.toLowerCase() === lower);
1970
- }
1971
2162
  function createCommandTree(items) {
1972
2163
  if (items instanceof import_collection.TreeCollection) {
1973
2164
  return items;
@@ -1985,329 +2176,6 @@ function createCommandTree(items) {
1985
2176
  nodeToChildren: (node) => node.children ?? []
1986
2177
  });
1987
2178
  }
1988
- function resolveCommandLevel(tree, activePath = [], query = "", options) {
1989
- const rootChildren = tree.getNodeChildren(tree.rootNode);
1990
- const hasCommands = rootChildren.length > 0;
1991
- if (!hasCommands) {
1992
- return {
1993
- hasCommands: false,
1994
- breadcrumbs: [],
1995
- items: [],
1996
- groups: []
1997
- };
1998
- }
1999
- const breadcrumbs = [];
2000
- const resolvedValuePath = [];
2001
- const resolvedLabels = [];
2002
- const resolvedCommands = [];
2003
- let currentNode = tree.rootNode;
2004
- for (const segment of activePath) {
2005
- const children = tree.getNodeChildren(currentNode);
2006
- const match = children.find((child) => child.value === segment);
2007
- if (!match || !tree.isBranchNode(match)) {
2008
- break;
2009
- }
2010
- const cmd = getNodeCommandToken(match);
2011
- breadcrumbs.push({
2012
- value: match.value,
2013
- label: match.label,
2014
- command: cmd
2015
- });
2016
- resolvedValuePath.push(match.value);
2017
- resolvedLabels.push(match.label);
2018
- resolvedCommands.push(cmd);
2019
- currentNode = match;
2020
- }
2021
- const trimmedQuery = query.trim();
2022
- const directChildren = tree.getNodeChildren(currentNode);
2023
- const directItems = directChildren.map(
2024
- (child) => toFlatItem(child, resolvedValuePath, resolvedLabels, resolvedCommands, tree)
2025
- );
2026
- if (!trimmedQuery) {
2027
- return {
2028
- hasCommands: true,
2029
- breadcrumbs,
2030
- items: directItems,
2031
- groups: groupCommandItems(directItems)
2032
- };
2033
- }
2034
- const normalizedQuery = trimmedQuery.startsWith(":") ? trimmedQuery.slice(1).trim() : trimmedQuery;
2035
- if (!normalizedQuery) {
2036
- return {
2037
- hasCommands: true,
2038
- breadcrumbs,
2039
- items: directItems,
2040
- groups: groupCommandItems(directItems)
2041
- };
2042
- }
2043
- const allowDeepSearch = options?.deepSearch !== false && breadcrumbs.length === 0;
2044
- const candidatePool = [];
2045
- if (allowDeepSearch) {
2046
- collectDeepFlatItems(currentNode, resolvedValuePath, resolvedLabels, resolvedCommands, tree, candidatePool);
2047
- } else {
2048
- candidatePool.push(...directItems);
2049
- }
2050
- const labelFzf = new import_fzf.Fzf(candidatePool, {
2051
- selector: (item) => item.label,
2052
- tiebreakers: [import_fzf.byLengthAsc],
2053
- casing: "case-insensitive"
2054
- });
2055
- const labelResults = labelFzf.find(normalizedQuery);
2056
- const labelMatchMap = /* @__PURE__ */ new Map();
2057
- for (const res of labelResults) {
2058
- labelMatchMap.set(res.item.value, {
2059
- score: res.score,
2060
- positions: Array.from(res.positions).sort((a, b) => a - b)
2061
- });
2062
- }
2063
- const compositeFzf = new import_fzf.Fzf(candidatePool, {
2064
- selector: (item) => [
2065
- item.label,
2066
- item.command,
2067
- item.fullCommand,
2068
- ...item.aliases,
2069
- ...item.breadcrumbLabels,
2070
- item.description ?? "",
2071
- ...item.node.keywords ?? []
2072
- ].join(" "),
2073
- tiebreakers: [import_fzf.byLengthAsc],
2074
- casing: "case-insensitive"
2075
- });
2076
- const compositeResults = compositeFzf.find(normalizedQuery);
2077
- const matchedByValue = /* @__PURE__ */ new Map();
2078
- for (const res of compositeResults) {
2079
- const labelHit = labelMatchMap.get(res.item.value);
2080
- const depthPenalty = (res.item.valuePath.length - 1) * 2;
2081
- const effectiveScore = (labelHit ? labelHit.score + 20 : res.score) - depthPenalty;
2082
- matchedByValue.set(res.item.value, {
2083
- ...res.item,
2084
- matchPositions: labelHit?.positions ?? [],
2085
- score: effectiveScore
2086
- });
2087
- }
2088
- for (const candidate of candidatePool) {
2089
- if (matchedByValue.has(candidate.value)) continue;
2090
- if (i18nFilter.contains(candidate.label, normalizedQuery) || i18nFilter.contains(candidate.command, normalizedQuery)) {
2091
- matchedByValue.set(candidate.value, {
2092
- ...candidate,
2093
- matchPositions: [],
2094
- score: 1
2095
- });
2096
- }
2097
- }
2098
- const rankedItems = Array.from(matchedByValue.values()).sort((a, b) => {
2099
- const scoreDiff = (b.score ?? 0) - (a.score ?? 0);
2100
- if (scoreDiff !== 0) return scoreDiff;
2101
- if (a.valuePath.length !== b.valuePath.length) {
2102
- return a.valuePath.length - b.valuePath.length;
2103
- }
2104
- return a.label.length - b.label.length;
2105
- });
2106
- return {
2107
- hasCommands: true,
2108
- breadcrumbs,
2109
- items: rankedItems,
2110
- groups: groupCommandItems(rankedItems)
2111
- };
2112
- }
2113
- function resolveCommandMenuState(tree, rawInput = "") {
2114
- const rootChildren = tree.getNodeChildren(tree.rootNode);
2115
- const hasCommands = rootChildren.length > 0;
2116
- const withoutColon = rawInput.startsWith(":") ? rawInput.slice(1) : rawInput;
2117
- const normalizedInput = `:${withoutColon}`;
2118
- if (!hasCommands) {
2119
- return {
2120
- hasCommands: false,
2121
- normalizedInput,
2122
- completedTokens: [],
2123
- partialToken: withoutColon.trim(),
2124
- breadcrumbs: [],
2125
- suggestions: [],
2126
- exactNode: null,
2127
- error: null
2128
- };
2129
- }
2130
- const hasTrailingSpace = /\s+$/.test(withoutColon);
2131
- const trimmed = withoutColon.trim();
2132
- const rawTokens = trimmed.length > 0 ? trimmed.split(/\s+/) : [];
2133
- const tokensToWalk = hasTrailingSpace ? rawTokens : rawTokens.slice(0, -1);
2134
- const partialToken = hasTrailingSpace ? "" : rawTokens[rawTokens.length - 1] ?? "";
2135
- const completedTokens = [];
2136
- const breadcrumbs = [];
2137
- const ancestorPath = [];
2138
- const ancestorLabels = [];
2139
- let currentNode = tree.rootNode;
2140
- for (let i = 0; i < tokensToWalk.length; i++) {
2141
- const token = tokensToWalk[i];
2142
- const children = tree.getNodeChildren(currentNode);
2143
- const matchedChild = children.find((child) => matchesCommandToken(child, token));
2144
- if (!matchedChild) {
2145
- return {
2146
- hasCommands: true,
2147
- normalizedInput,
2148
- completedTokens,
2149
- partialToken: rawTokens.slice(i).join(" "),
2150
- breadcrumbs,
2151
- suggestions: [],
2152
- exactNode: null,
2153
- error: `Unknown command: ${token}`
2154
- };
2155
- }
2156
- const canonicalCmd = getNodeCommandToken(matchedChild);
2157
- if (!tree.isBranchNode(matchedChild)) {
2158
- const extraTokens = rawTokens.slice(i + 1);
2159
- const hasExtra = extraTokens.length > 0 || partialToken.length > 0;
2160
- if (hasExtra) {
2161
- return {
2162
- hasCommands: true,
2163
- normalizedInput,
2164
- completedTokens: [...completedTokens, canonicalCmd],
2165
- partialToken,
2166
- breadcrumbs,
2167
- suggestions: [],
2168
- exactNode: null,
2169
- error: `Command ':${[...completedTokens, canonicalCmd].join(" ")}' does not take arguments`
2170
- };
2171
- }
2172
- const exactFlat = toFlatItem(matchedChild, ancestorPath, ancestorLabels, completedTokens, tree);
2173
- return {
2174
- hasCommands: true,
2175
- normalizedInput,
2176
- completedTokens: [...completedTokens, canonicalCmd],
2177
- partialToken: "",
2178
- breadcrumbs,
2179
- suggestions: [exactFlat],
2180
- exactNode: exactFlat,
2181
- error: null
2182
- };
2183
- }
2184
- completedTokens.push(canonicalCmd);
2185
- breadcrumbs.push({
2186
- value: matchedChild.value,
2187
- label: matchedChild.label,
2188
- command: canonicalCmd
2189
- });
2190
- ancestorPath.push(matchedChild.value);
2191
- ancestorLabels.push(matchedChild.label);
2192
- currentNode = matchedChild;
2193
- }
2194
- const branchChildren = tree.getNodeChildren(currentNode);
2195
- const branchItems = branchChildren.map(
2196
- (child) => toFlatItem(child, ancestorPath, ancestorLabels, completedTokens, tree)
2197
- );
2198
- if (!partialToken) {
2199
- return {
2200
- hasCommands: true,
2201
- normalizedInput,
2202
- completedTokens,
2203
- partialToken: "",
2204
- breadcrumbs,
2205
- suggestions: branchItems,
2206
- exactNode: null,
2207
- error: null
2208
- };
2209
- }
2210
- const exactChild = branchItems.find((item) => matchesCommandToken(item.node, partialToken)) ?? null;
2211
- const cmdFzf = new import_fzf.Fzf(branchItems, {
2212
- selector: (item) => item.command,
2213
- tiebreakers: [import_fzf.byLengthAsc],
2214
- casing: "case-insensitive"
2215
- });
2216
- const cmdHits = /* @__PURE__ */ new Map();
2217
- for (const res of cmdFzf.find(partialToken)) {
2218
- cmdHits.set(res.item.value, {
2219
- score: res.score,
2220
- positions: Array.from(res.positions).sort((a, b) => a - b)
2221
- });
2222
- }
2223
- const labelFzf = new import_fzf.Fzf(branchItems, {
2224
- selector: (item) => item.label,
2225
- tiebreakers: [import_fzf.byLengthAsc],
2226
- casing: "case-insensitive"
2227
- });
2228
- const labelHits = /* @__PURE__ */ new Map();
2229
- for (const res of labelFzf.find(partialToken)) {
2230
- labelHits.set(res.item.value, {
2231
- score: res.score,
2232
- positions: Array.from(res.positions).sort((a, b) => a - b)
2233
- });
2234
- }
2235
- const combinedFzf = new import_fzf.Fzf(branchItems, {
2236
- selector: (item) => [item.command, ...item.aliases, item.label, item.description ?? "", ...item.node.keywords ?? []].join(" "),
2237
- tiebreakers: [import_fzf.byLengthAsc],
2238
- casing: "case-insensitive"
2239
- });
2240
- const suggestionMap = /* @__PURE__ */ new Map();
2241
- for (const res of combinedFzf.find(partialToken)) {
2242
- const cmdHit = cmdHits.get(res.item.value);
2243
- const labelHit = labelHits.get(res.item.value);
2244
- const isExact = exactChild?.value === res.item.value;
2245
- const isPrefix = res.item.command.toLowerCase().startsWith(partialToken.toLowerCase());
2246
- const score = (cmdHit ? cmdHit.score + 50 : res.score) + (isExact ? 500 : 0) + (isPrefix ? 100 : 0);
2247
- suggestionMap.set(res.item.value, {
2248
- ...res.item,
2249
- commandMatchPositions: cmdHit?.positions ?? [],
2250
- matchPositions: labelHit?.positions ?? [],
2251
- score
2252
- });
2253
- }
2254
- const suggestions = Array.from(suggestionMap.values()).sort((a, b) => {
2255
- const scoreDiff = (b.score ?? 0) - (a.score ?? 0);
2256
- if (scoreDiff !== 0) return scoreDiff;
2257
- return a.command.length - b.command.length;
2258
- });
2259
- const error = suggestions.length === 0 ? `Unknown command: ${[...completedTokens, partialToken].join(" ")}` : null;
2260
- return {
2261
- hasCommands: true,
2262
- normalizedInput,
2263
- completedTokens,
2264
- partialToken,
2265
- breadcrumbs,
2266
- suggestions,
2267
- exactNode: exactChild ? suggestionMap.get(exactChild.value) ?? exactChild : null,
2268
- error
2269
- };
2270
- }
2271
- var resolveColonCommandState = resolveCommandMenuState;
2272
- function formatCommandMenuCompletionInput(completedTokens, item, appendBranchSpace = true) {
2273
- const nextTokens = [...completedTokens, item.command].join(" ");
2274
- return item.isBranch && appendBranchSpace ? `:${nextTokens} ` : `:${nextTokens}`;
2275
- }
2276
- var formatColonCompletionInput = formatCommandMenuCompletionInput;
2277
- function splitHighlightSegments(text, matchPositions) {
2278
- if (!text) return [];
2279
- if (!matchPositions || matchPositions.length === 0) {
2280
- return [{ text, highlight: false }];
2281
- }
2282
- const posSet = new Set(matchPositions);
2283
- const segments = [];
2284
- let currentText = "";
2285
- let currentHighlight = posSet.has(0);
2286
- for (let i = 0; i < text.length; i++) {
2287
- const isHighlighted = posSet.has(i);
2288
- if (i > 0 && isHighlighted !== currentHighlight) {
2289
- segments.push({ text: currentText, highlight: currentHighlight });
2290
- currentText = text[i];
2291
- currentHighlight = isHighlighted;
2292
- } else {
2293
- currentText += text[i];
2294
- }
2295
- }
2296
- if (currentText.length > 0) {
2297
- segments.push({ text: currentText, highlight: currentHighlight });
2298
- }
2299
- return segments;
2300
- }
2301
- function announceCommandMessage(message) {
2302
- if (typeof document === "undefined" || !message) return;
2303
- try {
2304
- if (!sharedLiveRegion) {
2305
- sharedLiveRegion = (0, import_live_region.createLiveRegion)({ level: "polite", document });
2306
- }
2307
- sharedLiveRegion.announce(message, 150);
2308
- } catch {
2309
- }
2310
- }
2311
2179
  function matchesCommandHotkey(event, hotkey) {
2312
2180
  if (!hotkey) return false;
2313
2181
  const trimmed = hotkey.trim();
@@ -2327,72 +2195,10 @@ function matchesCommandHotkey(event, hotkey) {
2327
2195
  }
2328
2196
  return false;
2329
2197
  }
2330
- function isHotkeyAnchorVisible(el) {
2331
- if (el.closest("[hidden]")) return false;
2332
- const fwWrapper = el.closest("[data-fw]");
2333
- const activeFw = el.ownerDocument?.documentElement?.getAttribute("data-framework");
2334
- if (fwWrapper && activeFw && fwWrapper.getAttribute("data-fw") !== activeFw) {
2335
- return false;
2336
- }
2337
- return true;
2338
- }
2339
- function shouldHandleCommandHotkey(anchorEl, selector) {
2340
- if (!anchorEl || typeof document === "undefined") return true;
2341
- if (!isHotkeyAnchorVisible(anchorEl)) return false;
2342
- const myPreview = anchorEl.closest("[data-example-preview]");
2343
- const activePreview = document.activeElement?.closest?.("[data-example-preview]") ?? null;
2344
- if (activePreview) {
2345
- return myPreview === activePreview;
2346
- }
2347
- if (myPreview) {
2348
- const previewAnchors = Array.from(
2349
- document.querySelectorAll(`[data-example-preview] ${selector}`)
2350
- ).filter(isHotkeyAnchorVisible);
2351
- return previewAnchors[0] === anchorEl;
2352
- }
2353
- return true;
2354
- }
2355
- function resolveCommandMenuGridStyle(columns = "auto", itemCount) {
2356
- if (columns === 1 || itemCount <= 0) {
2357
- return void 0;
2358
- }
2359
- const maxCols = columns === "auto" ? itemCount <= 6 ? 2 : itemCount <= 12 ? 3 : 4 : columns;
2360
- const colCount = Math.max(1, Math.min(maxCols, itemCount));
2361
- const rowCount = Math.max(1, Math.ceil(itemCount / colCount));
2362
- return {
2363
- display: "grid",
2364
- gridAutoFlow: "column",
2365
- gridTemplateRows: `repeat(${rowCount}, minmax(0, auto))`,
2366
- gridTemplateColumns: `repeat(${colCount}, minmax(0, 1fr))`
2367
- };
2368
- }
2369
- var resolveColonCommandGridStyle = resolveCommandMenuGridStyle;
2370
- function resolveCommandMenuGridNavigation(columns = "auto", itemCount, currentIdx, key) {
2371
- if (itemCount <= 0) return -1;
2372
- const safeIdx = currentIdx >= 0 && currentIdx < itemCount ? currentIdx : 0;
2373
- if (key === "ArrowDown") {
2374
- return (safeIdx + 1) % itemCount;
2375
- }
2376
- if (key === "ArrowUp") {
2377
- return (safeIdx - 1 + itemCount) % itemCount;
2378
- }
2379
- if (columns === 1) {
2380
- return safeIdx;
2381
- }
2382
- const maxCols = columns === "auto" ? itemCount <= 6 ? 2 : itemCount <= 12 ? 3 : 4 : columns;
2383
- const colCount = Math.max(1, Math.min(maxCols, itemCount));
2384
- const rowCount = Math.max(1, Math.ceil(itemCount / colCount));
2385
- const totalCols = Math.max(1, Math.ceil(itemCount / rowCount));
2386
- const row = safeIdx % rowCount;
2387
- const col = Math.floor(safeIdx / rowCount);
2388
- const nextCol = key === "ArrowRight" ? (col + 1) % totalCols : (col - 1 + totalCols) % totalCols;
2389
- return Math.min(nextCol * rowCount + row, itemCount - 1);
2390
- }
2391
- var resolveColonCommandGridNavigation = resolveCommandMenuGridNavigation;
2392
2198
 
2393
2199
  // src/command/styles.ts
2394
- var import_class_variance_authority21 = require("class-variance-authority");
2395
- var commandPaletteVariants = (0, import_class_variance_authority21.cva)(
2200
+ var import_class_variance_authority23 = require("class-variance-authority");
2201
+ var commandPaletteVariants = (0, import_class_variance_authority23.cva)(
2396
2202
  "flex w-full flex-col overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl outline-none",
2397
2203
  {
2398
2204
  variants: {
@@ -2415,7 +2221,18 @@ var commandPaletteInputBase = "flex-1 border-0 bg-transparent px-1 py-0.5 text-s
2415
2221
  var commandPaletteListBase = "max-h-80 overflow-y-auto p-1.5 outline-none";
2416
2222
  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";
2417
2223
  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";
2418
- var commandMenuVariants = (0, import_class_variance_authority21.cva)(
2224
+ var commandPaletteStyles = {
2225
+ root: commandPaletteVariants,
2226
+ positioner: commandPalettePositionerBase,
2227
+ dialogContent: commandPaletteDialogContentBase,
2228
+ header: commandPaletteHeaderBase,
2229
+ breadcrumb: commandPaletteBreadcrumbBase,
2230
+ input: commandPaletteInputBase,
2231
+ list: commandPaletteListBase,
2232
+ item: commandPaletteItemBase,
2233
+ footer: commandPaletteFooterBase
2234
+ };
2235
+ var commandMenuVariants = (0, import_class_variance_authority23.cva)(
2419
2236
  "flex w-full flex-col overflow-hidden border border-border bg-popover font-mono text-popover-foreground shadow-2xl outline-none",
2420
2237
  {
2421
2238
  variants: {
@@ -2432,7 +2249,7 @@ var commandMenuVariants = (0, import_class_variance_authority21.cva)(
2432
2249
  );
2433
2250
  var commandMenuPositionerBase = "items-end justify-stretch p-0!";
2434
2251
  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";
2435
- var commandMenuListVariants = (0, import_class_variance_authority21.cva)("overflow-y-auto border-b border-border bg-popover/95 outline-none", {
2252
+ var commandMenuListVariants = (0, import_class_variance_authority23.cva)("overflow-y-auto border-b border-border bg-popover/95 outline-none", {
2436
2253
  variants: {
2437
2254
  columns: {
2438
2255
  auto: "grid! grid-flow-col!",
@@ -2452,7 +2269,7 @@ var commandMenuListVariants = (0, import_class_variance_authority21.cva)("overfl
2452
2269
  size: "md"
2453
2270
  }
2454
2271
  });
2455
- var commandMenuItemVariants = (0, import_class_variance_authority21.cva)(
2272
+ var commandMenuItemVariants = (0, import_class_variance_authority23.cva)(
2456
2273
  "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",
2457
2274
  {
2458
2275
  variants: {
@@ -2467,7 +2284,7 @@ var commandMenuItemVariants = (0, import_class_variance_authority21.cva)(
2467
2284
  }
2468
2285
  }
2469
2286
  );
2470
- var commandMenuPromptBarVariants = (0, import_class_variance_authority21.cva)(
2287
+ var commandMenuPromptBarVariants = (0, import_class_variance_authority23.cva)(
2471
2288
  "flex w-full items-center border-t border-border/60 bg-muted/50 font-mono",
2472
2289
  {
2473
2290
  variants: {
@@ -2483,7 +2300,7 @@ var commandMenuPromptBarVariants = (0, import_class_variance_authority21.cva)(
2483
2300
  }
2484
2301
  );
2485
2302
  var commandMenuPrefixBase = "select-none font-mono font-bold text-primary";
2486
- var commandMenuInputVariants = (0, import_class_variance_authority21.cva)(
2303
+ var commandMenuInputVariants = (0, import_class_variance_authority23.cva)(
2487
2304
  "flex-1 border-0 bg-transparent font-mono text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-0",
2488
2305
  {
2489
2306
  variants: {
@@ -2499,15 +2316,17 @@ var commandMenuInputVariants = (0, import_class_variance_authority21.cva)(
2499
2316
  }
2500
2317
  );
2501
2318
  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";
2502
- var colonCommandVariants = commandMenuVariants;
2503
- var colonCommandPositionerBase = commandMenuPositionerBase;
2504
- var colonCommandDialogContentBase = commandMenuDialogContentBase;
2505
- var colonCommandListVariants = commandMenuListVariants;
2506
- var colonCommandItemVariants = commandMenuItemVariants;
2507
- var colonCommandPromptBarVariants = commandMenuPromptBarVariants;
2508
- var colonCommandPrefixBase = commandMenuPrefixBase;
2509
- var colonCommandInputVariants = commandMenuInputVariants;
2510
- var colonCommandErrorBase = commandMenuErrorBase;
2319
+ var commandMenuStyles = {
2320
+ root: commandMenuVariants,
2321
+ positioner: commandMenuPositionerBase,
2322
+ dialogContent: commandMenuDialogContentBase,
2323
+ list: commandMenuListVariants,
2324
+ item: commandMenuItemVariants,
2325
+ promptBar: commandMenuPromptBarVariants,
2326
+ prefix: commandMenuPrefixBase,
2327
+ input: commandMenuInputVariants,
2328
+ error: commandMenuErrorBase
2329
+ };
2511
2330
 
2512
2331
  // src/which-key/index.ts
2513
2332
  var which_key_exports = {};
@@ -6570,8 +6389,8 @@ function createWhichKeyController(options = {}) {
6570
6389
  }
6571
6390
 
6572
6391
  // src/which-key/styles.ts
6573
- var import_class_variance_authority22 = require("class-variance-authority");
6574
- var whichKeyVariants = (0, import_class_variance_authority22.cva)(
6392
+ var import_class_variance_authority24 = require("class-variance-authority");
6393
+ var whichKeyVariants = (0, import_class_variance_authority24.cva)(
6575
6394
  "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",
6576
6395
  {
6577
6396
  variants: {
@@ -6589,7 +6408,7 @@ var whichKeyVariants = (0, import_class_variance_authority22.cva)(
6589
6408
  var whichKeyHeaderBase = "flex items-center justify-between gap-2 px-3 pt-2.5 pb-1 text-xs font-medium";
6590
6409
  var whichKeyTitleBase = "flex items-center gap-1.5 font-semibold text-foreground";
6591
6410
  var whichKeyBreadcrumbBase = "flex items-center gap-1 text-[11px] text-muted-foreground";
6592
- var whichKeyBodyVariants = (0, import_class_variance_authority22.cva)("p-1.5", {
6411
+ var whichKeyBodyVariants = (0, import_class_variance_authority24.cva)("p-1.5", {
6593
6412
  variants: {
6594
6413
  variant: {
6595
6414
  helix: "flex flex-col gap-0.5",
@@ -6604,7 +6423,7 @@ var whichKeyBodyVariants = (0, import_class_variance_authority22.cva)("p-1.5", {
6604
6423
  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";
6605
6424
  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";
6606
6425
  var whichKeyFooterBase = "pointer-events-none h-2 shrink-0";
6607
- var whichKeyModeBadgeVariants = (0, import_class_variance_authority22.cva)(
6426
+ var whichKeyModeBadgeVariants = (0, import_class_variance_authority24.cva)(
6608
6427
  "inline-flex items-center gap-1 rounded font-mono font-semibold tracking-wider uppercase select-none",
6609
6428
  {
6610
6429
  variants: {
@@ -6633,7 +6452,7 @@ var whichKeyExplorerInputBase = "mx-4 mb-2 w-[calc(100%-2rem)] rounded-md border
6633
6452
  var whichKeyExplorerListContentBase = "max-h-none flex-1 overflow-visible px-2.5 pt-1 pb-3 outline-none";
6634
6453
  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";
6635
6454
  var whichKeyExplorerHighlightMarkBase = "rounded-xs bg-primary/20 px-0.5 font-semibold text-foreground";
6636
- var paneVariants = (0, import_class_variance_authority22.cva)(
6455
+ var paneVariants = (0, import_class_variance_authority24.cva)(
6637
6456
  "relative transition-shadow duration-150 data-[pane-active=true]:ring-1 data-[pane-active=true]:ring-primary/40",
6638
6457
  {
6639
6458
  variants: {
@@ -6648,7 +6467,7 @@ var paneVariants = (0, import_class_variance_authority22.cva)(
6648
6467
  }
6649
6468
  );
6650
6469
  var jumpOverlayRootBase = "pointer-events-none fixed inset-0 z-[60] overflow-hidden";
6651
- var jumpBadgeVariants = (0, import_class_variance_authority22.cva)(
6470
+ var jumpBadgeVariants = (0, import_class_variance_authority24.cva)(
6652
6471
  "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",
6653
6472
  {
6654
6473
  variants: {
@@ -8915,6 +8734,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
8915
8734
  // Annotate the CommonJS export names for ESM import in node:
8916
8735
  0 && (module.exports = {
8917
8736
  DEFAULT_JUMP_ALPHABET,
8737
+ DEFAULT_THEME,
8918
8738
  EditorHeading,
8919
8739
  ExitHeading,
8920
8740
  HeadingWithId,
@@ -8927,14 +8747,15 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
8927
8747
  SIDEBAR_WIDTH_ICON,
8928
8748
  SIDEBAR_WIDTH_MOBILE,
8929
8749
  THEMES,
8750
+ THEME_CLASS_PREFIX,
8930
8751
  THEME_NAMES,
8931
8752
  TitleHeading,
8932
- announceCommandMessage,
8933
8753
  badgeVariants,
8934
8754
  buildChartDefinition,
8935
8755
  buildExtensions,
8936
8756
  buildWhichKeyTree,
8937
8757
  buttonVariants,
8758
+ captureDialogFocusTarget,
8938
8759
  cardBodyBase,
8939
8760
  cardCoverVariants,
8940
8761
  cardDescriptionBase,
@@ -8965,15 +8786,6 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
8965
8786
  codeBlockSpinnerBase,
8966
8787
  codeBlockTitleBase,
8967
8788
  colBase,
8968
- colonCommandDialogContentBase,
8969
- colonCommandErrorBase,
8970
- colonCommandInputVariants,
8971
- colonCommandItemVariants,
8972
- colonCommandListVariants,
8973
- colonCommandPositionerBase,
8974
- colonCommandPrefixBase,
8975
- colonCommandPromptBarVariants,
8976
- colonCommandVariants,
8977
8789
  comboboxClearTriggerBase,
8978
8790
  comboboxContentBase,
8979
8791
  comboboxControlBase,
@@ -8985,24 +8797,8 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
8985
8797
  comboboxListBase,
8986
8798
  comboboxPositionerBase,
8987
8799
  comboboxTriggerBase,
8988
- commandMenuDialogContentBase,
8989
- commandMenuErrorBase,
8990
- commandMenuInputVariants,
8991
- commandMenuItemVariants,
8992
- commandMenuListVariants,
8993
- commandMenuPositionerBase,
8994
- commandMenuPrefixBase,
8995
- commandMenuPromptBarVariants,
8996
- commandMenuVariants,
8997
- commandPaletteBreadcrumbBase,
8998
- commandPaletteDialogContentBase,
8999
- commandPaletteFooterBase,
9000
- commandPaletteHeaderBase,
9001
- commandPaletteInputBase,
9002
- commandPaletteItemBase,
9003
- commandPaletteListBase,
9004
- commandPalettePositionerBase,
9005
- commandPaletteVariants,
8800
+ commandMenuStyles,
8801
+ commandPaletteStyles,
9006
8802
  containerBase,
9007
8803
  createCodeBlockCustom,
9008
8804
  createCommandTree,
@@ -9016,6 +8812,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9016
8812
  createUrlMention,
9017
8813
  createVimPreset,
9018
8814
  createWhichKeyController,
8815
+ cycleThemeModeValue,
9019
8816
  defaultChartColor,
9020
8817
  defaultListboxFilter,
9021
8818
  dialogBackdropBase,
@@ -9028,6 +8825,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9028
8825
  dialogHeaderBase,
9029
8826
  dialogHeaderStickyBase,
9030
8827
  dialogPositionerBase,
8828
+ dialogStyles,
9031
8829
  dialogTitleBase,
9032
8830
  eventToChordKeys,
9033
8831
  extractYouTubeId,
@@ -9050,8 +8848,6 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9050
8848
  findDirectionalPane,
9051
8849
  findEditorScrollContainer,
9052
8850
  flattenKeymapEntries,
9053
- formatColonCompletionInput,
9054
- formatCommandMenuCompletionInput,
9055
8851
  formatKeyChord,
9056
8852
  formatKeySequence,
9057
8853
  formatTime,
@@ -9062,6 +8858,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9062
8858
  getModalEditor,
9063
8859
  getNodeChildren,
9064
8860
  getPresetKeymap,
8861
+ hasThemeCss,
9065
8862
  hstackBase,
9066
8863
  inferPlatform,
9067
8864
  injectCodeBlockStyles,
@@ -9080,6 +8877,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9080
8877
  latexErrorBase,
9081
8878
  latexInlineBase,
9082
8879
  latexRootBase,
8880
+ lightSwitchButtonVariants,
9083
8881
  listboxContentBase,
9084
8882
  listboxEmptyBase,
9085
8883
  listboxInputBase,
@@ -9098,6 +8896,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9098
8896
  manimPlaceholderLabelBase,
9099
8897
  manimRootBase,
9100
8898
  matchesCommandHotkey,
8899
+ mergeThemePresets,
9101
8900
  mermaidLoadingBase,
9102
8901
  mermaidRootBase,
9103
8902
  mermaidSourceBase,
@@ -9194,22 +8993,20 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9194
8993
  radioGroupItemControlBase,
9195
8994
  radioGroupItemTextBase,
9196
8995
  radioGroupRootBase,
8996
+ readDocumentDarkMode,
8997
+ readDocumentTheme,
8998
+ readSystemDarkMode,
8999
+ registerCustomThemes,
9197
9000
  registerImageInsertCallback,
9198
9001
  registerModalEditor,
9199
9002
  registerYouTubeInsertCallback,
9200
9003
  renderChartSvgString,
9201
9004
  renderCodeToHtml,
9202
9005
  renderMermaidSource,
9203
- resolveColonCommandGridNavigation,
9204
- resolveColonCommandGridStyle,
9205
- resolveColonCommandState,
9206
- resolveCommandLevel,
9207
- resolveCommandMenuGridNavigation,
9208
- resolveCommandMenuGridStyle,
9209
- resolveCommandMenuState,
9210
9006
  resolveKbdSteps,
9211
9007
  resolveMermaidThemeVariables,
9212
9008
  resolveNode,
9009
+ restoreDialogFocusTarget,
9213
9010
  revealChevronBase,
9214
9011
  revealContentBase,
9215
9012
  revealRootBase,
@@ -9232,22 +9029,24 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9232
9029
  selectTriggerBase,
9233
9030
  selectValueBase,
9234
9031
  serializeModalSliceText,
9235
- shouldHandleCommandHotkey,
9236
9032
  sidebarMenuButtonVariants,
9237
9033
  sidebarStyles,
9238
9034
  slashCommands,
9239
- splitHighlightSegments,
9240
9035
  splitterPanelBase,
9241
9036
  splitterResizeTriggerBase,
9242
9037
  splitterResizeTriggerIndicatorBase,
9243
9038
  splitterResizeTriggerSeparatorBase,
9244
9039
  splitterRootBase,
9245
9040
  stackBase,
9041
+ subscribeDocumentTheme,
9246
9042
  subscribeDocumentWhichKeyController,
9043
+ subscribeSystemDarkMode,
9247
9044
  switchControlBase,
9248
9045
  switchLabelBase,
9249
9046
  switchThumbBase,
9250
9047
  switchVariants,
9048
+ syncDocumentDarkMode,
9049
+ syncDocumentTheme,
9251
9050
  tabsContentBase,
9252
9051
  tabsIndicatorBase,
9253
9052
  tabsIndicatorVariants,
@@ -9264,6 +9063,7 @@ function lockEditorOverlayScroll(editorElement, overlayElement) {
9264
9063
  tagsInputItemTextBase,
9265
9064
  tagsInputRootBase,
9266
9065
  textareaBase,
9066
+ themeSelectorStyles,
9267
9067
  toLaTeX,
9268
9068
  toastActionTriggerBase,
9269
9069
  toastCloseTriggerBase,