@salilvnair/dui 1.0.6 → 1.0.8

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.
Files changed (153) hide show
  1. package/dist/assets/DuiShowcase-C18KoqHP.css +1 -0
  2. package/dist/assets/{DuiShowcase-DdIO2HHe.js → DuiShowcase-DwihGCxO.js} +1377 -1359
  3. package/dist/assets/{index-BcOB3b2I.js → index-D9rPjVPP.js} +2 -2
  4. package/dist/chunks/{daakia-icons-BpwUOdSO.js → daakia-icons-DYLRx0Yi.js} +1096 -1053
  5. package/dist/chunks/daakia-icons-DYLRx0Yi.js.map +1 -0
  6. package/dist/chunks/doc-path-D2_JUEIe.js +695 -0
  7. package/dist/chunks/doc-path-D2_JUEIe.js.map +1 -0
  8. package/dist/icons/daakia-icons.d.ts +24 -0
  9. package/dist/index.html +1 -1
  10. package/dist/index.js +20952 -17301
  11. package/dist/index.js.map +1 -1
  12. package/dist/lib/components/button/AIButtonView.d.ts +10 -1
  13. package/dist/lib/components/button/ActionButtonView.d.ts +42 -0
  14. package/dist/lib/components/button/BookmarkButtonView.d.ts +10 -1
  15. package/dist/lib/components/button/DropDownButtonView.d.ts +8 -1
  16. package/dist/lib/components/button/FabView.d.ts +10 -1
  17. package/dist/lib/components/button/FollowButtonView.d.ts +10 -1
  18. package/dist/lib/components/button/HoldToConfirmView.d.ts +10 -1
  19. package/dist/lib/components/button/LikeButtonView.d.ts +10 -1
  20. package/dist/lib/components/button/MorphingIconButtonView.d.ts +10 -1
  21. package/dist/lib/components/button/SegmentedView.d.ts +10 -1
  22. package/dist/lib/components/button/ThemeToggleView.d.ts +10 -1
  23. package/dist/lib/components/button/VoteWidgetView.d.ts +10 -1
  24. package/dist/lib/components/chips/ChipView.d.ts +32 -1
  25. package/dist/lib/components/chips/CommandChipView.d.ts +10 -1
  26. package/dist/lib/components/display/BadgeChipView.d.ts +25 -0
  27. package/dist/lib/components/display/DonutView.d.ts +35 -0
  28. package/dist/lib/components/display/EmptyStateView.d.ts +33 -1
  29. package/dist/lib/components/display/FileBrowserView.d.ts +143 -0
  30. package/dist/lib/components/display/FileBrowserView.test.d.ts +1 -0
  31. package/dist/lib/components/display/FindingCardView.d.ts +36 -0
  32. package/dist/lib/components/display/FlameGraphView.d.ts +32 -0
  33. package/dist/lib/components/display/GroupHeaderView.d.ts +28 -0
  34. package/dist/lib/components/display/IssueCardSkeletonView.d.ts +28 -0
  35. package/dist/lib/components/display/IssueCardView.d.ts +40 -0
  36. package/dist/lib/components/display/LaneChartView.d.ts +46 -0
  37. package/dist/lib/components/display/LineDiffView.d.ts +25 -0
  38. package/dist/lib/components/display/PriorityMarkView.d.ts +20 -0
  39. package/dist/lib/components/display/SetupOptionView.d.ts +56 -0
  40. package/dist/lib/components/display/SunburstView.d.ts +32 -0
  41. package/dist/lib/components/display/SwimlaneChartView.d.ts +48 -0
  42. package/dist/lib/components/display/TableSkeletonView.d.ts +34 -0
  43. package/dist/lib/components/display/hierarchy-layout.d.ts +114 -0
  44. package/dist/lib/components/display/hierarchy-layout.test.d.ts +1 -0
  45. package/dist/lib/components/display/lane-scale.d.ts +67 -0
  46. package/dist/lib/components/display/lane-scale.test.d.ts +1 -0
  47. package/dist/lib/components/display/line-diff.d.ts +42 -0
  48. package/dist/lib/components/input/AvatarUploadView.d.ts +10 -1
  49. package/dist/lib/components/input/CalendarView.d.ts +10 -1
  50. package/dist/lib/components/input/CascaderView.d.ts +10 -1
  51. package/dist/lib/components/input/ChatInputView.d.ts +10 -1
  52. package/dist/lib/components/input/CheckboxView.d.ts +10 -1
  53. package/dist/lib/components/input/ChecklistView.d.ts +10 -1
  54. package/dist/lib/components/input/ColorPickerView.d.ts +10 -1
  55. package/dist/lib/components/input/ComboBoxView.d.ts +10 -1
  56. package/dist/lib/components/input/DateInputView.d.ts +10 -1
  57. package/dist/lib/components/input/DateRangePickerView.d.ts +10 -1
  58. package/dist/lib/components/input/DateTimeInputView.d.ts +10 -1
  59. package/dist/lib/components/input/DialKnobInputView.d.ts +10 -1
  60. package/dist/lib/components/input/DurationInputView.d.ts +10 -1
  61. package/dist/lib/components/input/EditorView.d.ts +8 -0
  62. package/dist/lib/components/input/EditorView.shell.d.ts +9 -1
  63. package/dist/lib/components/input/EmojiPickerView.d.ts +10 -1
  64. package/dist/lib/components/input/FeedbackWidgetView.d.ts +10 -1
  65. package/dist/lib/components/input/FileDropzoneView.d.ts +10 -1
  66. package/dist/lib/components/input/FilterInputView.d.ts +25 -0
  67. package/dist/lib/components/input/FloatingLabelInputView.d.ts +10 -1
  68. package/dist/lib/components/input/FormDataTableView.d.ts +10 -1
  69. package/dist/lib/components/input/GhostTypingPlaceholderView.d.ts +10 -1
  70. package/dist/lib/components/input/HiddenKeyValueItemView.d.ts +10 -1
  71. package/dist/lib/components/input/HighlightedInputView.d.ts +12 -1
  72. package/dist/lib/components/input/IconPickerView.d.ts +10 -1
  73. package/dist/lib/components/input/InlineEditTextView.d.ts +10 -1
  74. package/dist/lib/components/input/InviteInputView.d.ts +10 -1
  75. package/dist/lib/components/input/KeyValueTableRowView.d.ts +10 -1
  76. package/dist/lib/components/input/KeyValueTableView.d.ts +10 -1
  77. package/dist/lib/components/input/MarkdownEditorView.d.ts +30 -0
  78. package/dist/lib/components/input/MaskedInputView.d.ts +10 -1
  79. package/dist/lib/components/input/MentionInputView.d.ts +10 -1
  80. package/dist/lib/components/input/MergedInputView.d.ts +10 -1
  81. package/dist/lib/components/input/NpsSurveyView.d.ts +10 -1
  82. package/dist/lib/components/input/OtpInputView.d.ts +10 -1
  83. package/dist/lib/components/input/PhoneInputView.d.ts +10 -1
  84. package/dist/lib/components/input/PickerView.d.ts +10 -1
  85. package/dist/lib/components/input/PriorityPickerView.d.ts +10 -1
  86. package/dist/lib/components/input/RadioCardView.d.ts +10 -1
  87. package/dist/lib/components/input/RadioGroupView.d.ts +10 -1
  88. package/dist/lib/components/input/RangeSliderView.d.ts +10 -1
  89. package/dist/lib/components/input/RatingView.d.ts +10 -1
  90. package/dist/lib/components/input/RichTextToolbarView.d.ts +10 -1
  91. package/dist/lib/components/input/RoleSelectView.d.ts +10 -1
  92. package/dist/lib/components/input/SearchFieldView.d.ts +33 -0
  93. package/dist/lib/components/input/SegmentedControlView.d.ts +20 -1
  94. package/dist/lib/components/input/SelectInputView.d.ts +32 -1
  95. package/dist/lib/components/input/SelectTextInputView.d.ts +12 -1
  96. package/dist/lib/components/input/ShortcutRecorderView.d.ts +10 -1
  97. package/dist/lib/components/input/SliderView.d.ts +10 -1
  98. package/dist/lib/components/input/SpectrumSliderView.d.ts +10 -1
  99. package/dist/lib/components/input/StepperInputView.d.ts +10 -1
  100. package/dist/lib/components/input/SwatchPickerView.d.ts +38 -0
  101. package/dist/lib/components/input/SwitchGroupView.d.ts +10 -1
  102. package/dist/lib/components/input/TabView.d.ts +10 -1
  103. package/dist/lib/components/input/TagInputView.d.ts +10 -1
  104. package/dist/lib/components/input/TextInputView.d.ts +9 -0
  105. package/dist/lib/components/input/ThemeCardSelectorView.d.ts +10 -1
  106. package/dist/lib/components/input/TimeWheelView.d.ts +10 -1
  107. package/dist/lib/components/input/TimeZoneSelectView.d.ts +40 -0
  108. package/dist/lib/components/input/TimeZoneSelectView.test.d.ts +1 -0
  109. package/dist/lib/components/input/TogglePillView.d.ts +51 -0
  110. package/dist/lib/components/input/ToggleSwitchView.d.ts +10 -1
  111. package/dist/lib/components/input/TransferListView.d.ts +10 -1
  112. package/dist/lib/components/input/TreeSelectView.d.ts +10 -1
  113. package/dist/lib/components/input/WizardStepperView.d.ts +10 -1
  114. package/dist/lib/components/input/doc-path.d.ts +52 -0
  115. package/dist/lib/components/input/doc-path.test.d.ts +1 -0
  116. package/dist/lib/components/input/markdown-serialise.d.ts +23 -0
  117. package/dist/lib/components/input/select-position.test.d.ts +1 -0
  118. package/dist/lib/components/layout/PathBreadcrumbView.d.ts +67 -0
  119. package/dist/lib/components/layout/PathBreadcrumbView.test.d.ts +1 -0
  120. package/dist/lib/components/layout/SplitPanelView.d.ts +26 -1
  121. package/dist/lib/components/modal/ActionSheetView.d.ts +10 -1
  122. package/dist/lib/components/modal/AlertDialogView.d.ts +10 -1
  123. package/dist/lib/components/modal/BottomSheetView.d.ts +10 -1
  124. package/dist/lib/components/modal/CommandPaletteView.d.ts +10 -1
  125. package/dist/lib/components/modal/ContextMenuView.d.ts +19 -1
  126. package/dist/lib/components/modal/DrawerView.d.ts +10 -1
  127. package/dist/lib/components/modal/InfoPopupView.d.ts +13 -1
  128. package/dist/lib/components/modal/ModalView.d.ts +19 -3
  129. package/dist/lib/components/modal/NotificationCenterView.d.ts +10 -1
  130. package/dist/lib/components/modal/PopoverView.d.ts +10 -1
  131. package/dist/lib/components/modal/SheetView.d.ts +31 -0
  132. package/dist/lib/components/modal/SpotlightTourView.d.ts +10 -1
  133. package/dist/lib/components/modal/StackedToastDeckView.d.ts +10 -1
  134. package/dist/lib/components/modal/sheet-drag.d.ts +60 -0
  135. package/dist/lib/components/modal/sheet-drag.test.d.ts +1 -0
  136. package/dist/lib/components/tabs/PilledTabView.d.ts +10 -1
  137. package/dist/lib/components/tabs/TabBarView.d.ts +10 -1
  138. package/dist/lib/components/tabs/UnderlineTabsView.d.ts +41 -0
  139. package/dist/lib/components/testid.test.d.ts +1 -0
  140. package/dist/lib/core/IconSize.d.ts +37 -0
  141. package/dist/lib/core/TerminalPalette.d.ts +81 -0
  142. package/dist/lib/core/TerminalPaletteFile.d.ts +61 -0
  143. package/dist/lib/core/TerminalPaletteFile.test.d.ts +1 -0
  144. package/dist/lib/index.d.ts +65 -0
  145. package/dist/monaco-setup.js +589 -493
  146. package/dist/monaco-setup.js.map +1 -1
  147. package/dist/style.css +1 -1
  148. package/dist/theme/editor.js +1 -1
  149. package/package.json +5 -3
  150. package/dist/assets/DuiShowcase-CRLG9S4N.css +0 -1
  151. package/dist/chunks/EditorView.shell-DWGMOgiy.js +0 -510
  152. package/dist/chunks/EditorView.shell-DWGMOgiy.js.map +0 -1
  153. package/dist/chunks/daakia-icons-BpwUOdSO.js.map +0 -1
@@ -0,0 +1,695 @@
1
+ import { jsx as p, Fragment as C, jsxs as y } from "react/jsx-runtime";
2
+ import { useMemo as M, useContext as F, createContext as N, useRef as D, useEffect as w, useState as S, useSyncExternalStore as j } from "react";
3
+ import { createPortal as A } from "react-dom";
4
+ import { ax as G } from "./daakia-icons-DYLRx0Yi.js";
5
+ const dn = {
6
+ /** Standard form controls: text input, select, duration, search, highlighted input */
7
+ input: { xxs: 16, xs: 20, sm: 24, md: 28, lg: 36, xl: 40, xxl: 48, xxxl: 56 },
8
+ /** Push buttons (primary, secondary, ghost, danger) */
9
+ button: { xxs: 16, xs: 20, sm: 24, md: 28, lg: 36, xl: 40, xxl: 48, xxxl: 56 },
10
+ /** Pill tabs, segment controls */
11
+ tab: { xxs: 16, xs: 20, sm: 24, md: 28, lg: 36, xl: 40, xxl: 48, xxxl: 56 },
12
+ /** Sidebar nav items, settings nav links */
13
+ nav: { xxs: 20, xs: 24, sm: 28, md: 32, lg: 36, xl: 44, xxl: 52, xxxl: 60 },
14
+ /** Context-menu items, dropdown options, sub-menu rows */
15
+ menu: { xxs: 14, xs: 18, sm: 22, md: 26, lg: 30, xl: 36, xxl: 42, xxxl: 48 },
16
+ /** Table / KV-table rows */
17
+ table: { xxs: 18, xs: 22, sm: 26, md: 30, lg: 36, xl: 40, xxl: 46, xxxl: 54 },
18
+ /** Card container min-height (loosely applied) */
19
+ card: { xxs: 28, xs: 36, sm: 48, md: 64, lg: 80, xl: 96, xxl: 112, xxxl: 128 }
20
+ }, pn = {
21
+ xxs: 10,
22
+ xs: 12,
23
+ sm: 16,
24
+ md: 20,
25
+ lg: 24,
26
+ xl: 28,
27
+ xxl: 32,
28
+ xxxl: 38
29
+ }, fn = {
30
+ xxs: 18,
31
+ xs: 22,
32
+ sm: 26,
33
+ md: 30,
34
+ lg: 34,
35
+ xl: 38,
36
+ xxl: 44,
37
+ xxxl: 50
38
+ }, hn = {
39
+ xxs: 40,
40
+ xs: 52,
41
+ sm: 64,
42
+ md: 80,
43
+ lg: 100,
44
+ xl: 120,
45
+ xxl: 144,
46
+ xxxl: 168
47
+ }, mn = {
48
+ xxs: 2,
49
+ xs: 3,
50
+ sm: 4,
51
+ md: 5,
52
+ lg: 6,
53
+ xl: 8,
54
+ xxl: 10,
55
+ xxxl: 12
56
+ }, gn = {
57
+ xxs: 16,
58
+ xs: 20,
59
+ sm: 24,
60
+ md: 32,
61
+ lg: 40,
62
+ xl: 48,
63
+ xxl: 56,
64
+ xxxl: 72
65
+ }, vn = {
66
+ xxs: 6,
67
+ xs: 7,
68
+ sm: 8,
69
+ md: 10,
70
+ lg: 12,
71
+ xl: 14,
72
+ xxl: 16,
73
+ xxxl: 20
74
+ }, bn = {
75
+ xxs: { trackW: 18, trackH: 10, thumb: 8 },
76
+ xs: { trackW: 24, trackH: 14, thumb: 10 },
77
+ sm: { trackW: 28, trackH: 16, thumb: 12 },
78
+ md: { trackW: 36, trackH: 20, thumb: 16 },
79
+ lg: { trackW: 44, trackH: 24, thumb: 20 },
80
+ xl: { trackW: 52, trackH: 28, thumb: 24 },
81
+ xxl: { trackW: 60, trackH: 32, thumb: 28 },
82
+ xxxl: { trackW: 68, trackH: 36, thumb: 32 }
83
+ }, yn = {
84
+ xxs: { box: 10, icon: 6 },
85
+ xs: { box: 12, icon: 8 },
86
+ sm: { box: 14, icon: 9 },
87
+ md: { box: 16, icon: 11 },
88
+ lg: { box: 18, icon: 13 },
89
+ xl: { box: 20, icon: 15 },
90
+ xxl: { box: 22, icon: 17 },
91
+ xxxl: { box: 26, icon: 20 }
92
+ }, kn = {
93
+ xxs: 8,
94
+ xs: 10,
95
+ sm: 11,
96
+ md: 12,
97
+ lg: 14,
98
+ xl: 16,
99
+ xxl: 18,
100
+ xxxl: 20
101
+ }, In = {
102
+ xxs: "8px",
103
+ xs: "9px",
104
+ sm: "10px",
105
+ md: "11px",
106
+ lg: "12px",
107
+ xl: "13px",
108
+ xxl: "14px",
109
+ xxxl: "16px"
110
+ }, wn = {
111
+ xxs: "2px",
112
+ xs: "3px",
113
+ sm: "4px",
114
+ md: "5px",
115
+ lg: "7px",
116
+ xl: "9px",
117
+ xxl: "11px",
118
+ xxxl: "14px"
119
+ }, Z = {
120
+ xxs: 10,
121
+ xs: 11,
122
+ sm: 11,
123
+ md: 12,
124
+ lg: 13,
125
+ xl: 14,
126
+ xxl: 15,
127
+ xxxl: 16
128
+ }, _n = {
129
+ xxs: "4px",
130
+ xs: "6px",
131
+ sm: "8px",
132
+ md: "10px",
133
+ lg: "12px",
134
+ xl: "16px",
135
+ xxl: "20px",
136
+ xxxl: "24px"
137
+ }, Dn = {
138
+ xxs: "2px",
139
+ xs: "3px",
140
+ sm: "4px",
141
+ md: "5px",
142
+ lg: "6px",
143
+ xl: "8px",
144
+ xxl: "10px",
145
+ xxxl: "12px"
146
+ }, X = {
147
+ none: "0px",
148
+ sm: "3px",
149
+ md: "4px",
150
+ lg: "6px",
151
+ full: "999px"
152
+ }, Sn = {
153
+ xxs: "2px",
154
+ xs: "3px",
155
+ // DUI_RADIUS_MAP.sm
156
+ sm: "4px",
157
+ // DUI_RADIUS_MAP.md
158
+ md: "4px",
159
+ // DUI_RADIUS_MAP.md
160
+ lg: "6px",
161
+ // DUI_RADIUS_MAP.lg
162
+ xl: "6px",
163
+ // DUI_RADIUS_MAP.lg
164
+ xxl: "8px",
165
+ xxxl: "10px"
166
+ }, q = {
167
+ sm: "80px",
168
+ md: "120px",
169
+ default: "auto",
170
+ lg: "200px",
171
+ fullWidth: "100%",
172
+ maxContent: "max-content",
173
+ fw: "100%",
174
+ mx: "max-content"
175
+ }, J = { size: "md" }, R = N(J);
176
+ function En({
177
+ size: n = "md",
178
+ width: o,
179
+ borderRadius: t,
180
+ color: e,
181
+ defaultColor: s,
182
+ activeColor: r,
183
+ fontStyle: i,
184
+ children: c
185
+ }) {
186
+ const x = M(
187
+ () => ({ size: n, width: o, borderRadius: t, color: e, defaultColor: s, activeColor: r, fontStyle: i }),
188
+ [n, o, t, e, s, r, i]
189
+ );
190
+ return /* @__PURE__ */ p(R.Provider, { value: x, children: c });
191
+ }
192
+ function U() {
193
+ return F(R);
194
+ }
195
+ function K(n, o) {
196
+ return n === void 0 ? o : typeof n == "number" ? `${n}px` : X[n];
197
+ }
198
+ function Y(n) {
199
+ return n ? q[n] : "auto";
200
+ }
201
+ function Wn(n) {
202
+ const o = U();
203
+ return M(
204
+ () => ({
205
+ borderRadius: K(o.borderRadius, n),
206
+ width: Y(o.width),
207
+ color: o.color,
208
+ defaultColor: o.defaultColor,
209
+ activeColor: o.activeColor,
210
+ fontStyle: o.fontStyle
211
+ }),
212
+ [o, n]
213
+ );
214
+ }
215
+ function Cn(n, o = {}) {
216
+ const t = U(), e = n ?? t.size;
217
+ return {
218
+ fontSize: Z[e]
219
+ };
220
+ }
221
+ const V = { auto: "max-content", sm: "140px", md: "180px", lg: "220px" };
222
+ function Q(n) {
223
+ return !n || n === "auto" ? "max-content" : typeof n == "number" ? `${n}px` : V[n] || "max-content";
224
+ }
225
+ const nn = 288;
226
+ function tn(n) {
227
+ return typeof n == "number" ? Math.round(n * 1.07) : nn;
228
+ }
229
+ function H({
230
+ items: n,
231
+ onClose: o,
232
+ rounded: t,
233
+ subMax: e
234
+ }) {
235
+ const [s, r] = S(null);
236
+ return /* @__PURE__ */ p(C, { children: n.map((i) => /* @__PURE__ */ p(
237
+ en,
238
+ {
239
+ item: i,
240
+ onClose: o,
241
+ rounded: t,
242
+ subMax: e,
243
+ activeSubId: s,
244
+ onSubOpen: r
245
+ },
246
+ i.id
247
+ )) });
248
+ }
249
+ function en({
250
+ item: n,
251
+ onClose: o,
252
+ rounded: t,
253
+ subMax: e,
254
+ activeSubId: s,
255
+ onSubOpen: r
256
+ }) {
257
+ const i = D(null), c = D(null);
258
+ if (n.separator)
259
+ return /* @__PURE__ */ p("div", { style: { height: "1px", background: "var(--color-surface-border)", margin: "4px 0" } });
260
+ const x = !!(n.children && n.children.length > 0), u = n.danger, m = x && s === n.id, g = () => {
261
+ r(x ? n.id : null);
262
+ }, a = (l) => {
263
+ var h;
264
+ if (l.stopPropagation(), !n.disabled) {
265
+ if (x) {
266
+ r(n.id);
267
+ return;
268
+ }
269
+ (h = n.onClick) == null || h.call(n), o();
270
+ }
271
+ };
272
+ return w(() => {
273
+ if (!m || !i.current || !c.current) return;
274
+ const l = c.current;
275
+ l.style.visibility = "hidden";
276
+ const h = requestAnimationFrame(() => {
277
+ if (!i.current || !c.current) return;
278
+ const f = i.current.getBoundingClientRect();
279
+ l.style.top = `${f.top - 4}px`, l.style.left = `${f.right + 4}px`;
280
+ const d = l.getBoundingClientRect();
281
+ d.right > window.innerWidth - 8 && (l.style.left = `${f.left - d.width - 4}px`), d.bottom > window.innerHeight - 8 && (l.style.top = `${window.innerHeight - d.height - 8}px`), l.style.visibility = "visible";
282
+ });
283
+ return () => cancelAnimationFrame(h);
284
+ }, [m]), /* @__PURE__ */ y(
285
+ "div",
286
+ {
287
+ ref: i,
288
+ onMouseEnter: g,
289
+ style: { position: "relative" },
290
+ children: [
291
+ /* @__PURE__ */ y(
292
+ "div",
293
+ {
294
+ onClick: a,
295
+ className: `dui_ctx-menu__item${u ? " dui_ctx-menu__item--danger" : ""}${n.disabled ? " dui_ctx-menu__item--disabled" : ""}`,
296
+ style: {
297
+ display: "flex",
298
+ // A described item is two lines, so the icon and chevron align to the
299
+ // label rather than floating against the middle of the block.
300
+ alignItems: n.description ? "flex-start" : "center",
301
+ gap: "8px",
302
+ padding: "8px 10px",
303
+ borderRadius: t ? "5px" : "0px",
304
+ fontSize: "12px",
305
+ fontWeight: 500,
306
+ cursor: n.disabled ? "default" : "pointer",
307
+ // A disabled item that explains itself has to stay readable: the
308
+ // reason is the reason it is disabled, and dimming it to 45% makes
309
+ // the one thing worth reading the hardest thing to read.
310
+ opacity: n.disabled ? n.description ? 0.75 : 0.45 : 1,
311
+ color: u ? "var(--color-error)" : "var(--color-text-secondary)",
312
+ userSelect: "none"
313
+ },
314
+ children: [
315
+ n.icon && /* @__PURE__ */ p("span", { style: { width: "14px", display: "flex", alignItems: "center", flexShrink: 0, marginTop: n.description ? "1px" : 0, color: n.iconColor ?? (u ? "var(--color-error)" : "var(--color-text-muted)") }, children: n.icon }),
316
+ n.description ? /* @__PURE__ */ y("span", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "2px" }, children: [
317
+ /* @__PURE__ */ y("span", { style: { display: "flex", alignItems: "baseline", gap: "8px" }, children: [
318
+ /* @__PURE__ */ p("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: n.label }),
319
+ n.shortcut && !x && /* @__PURE__ */ p("span", { style: { fontSize: "10px", color: "var(--color-text-muted)", flexShrink: 0 }, children: n.shortcut })
320
+ ] }),
321
+ /* @__PURE__ */ p("span", { style: { fontSize: "10.5px", fontWeight: 400, lineHeight: 1.45, color: "var(--color-text-muted)", whiteSpace: "normal" }, children: n.description })
322
+ ] }) : /* @__PURE__ */ y(C, { children: [
323
+ /* @__PURE__ */ p("span", { style: { flex: 1, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: n.label }),
324
+ n.shortcut && !x && /* @__PURE__ */ p("span", { style: { fontSize: "10px", color: "var(--color-text-muted)", marginLeft: "12px", flexShrink: 0 }, children: n.shortcut })
325
+ ] }),
326
+ x && /* @__PURE__ */ p(G, { size: 10, style: { color: "var(--color-text-muted)", flexShrink: 0, marginLeft: "8px", marginTop: n.description ? "3px" : 0 } })
327
+ ]
328
+ }
329
+ ),
330
+ x && m && A(
331
+ /* @__PURE__ */ p(
332
+ "div",
333
+ {
334
+ ref: c,
335
+ "data-dui-ctx-menu": "true",
336
+ style: {
337
+ position: "fixed",
338
+ visibility: "hidden",
339
+ zIndex: 99999,
340
+ background: "var(--color-elevated, var(--color-surface-bg))",
341
+ border: "1px solid var(--color-surface-border)",
342
+ borderRadius: t ? "7px" : "0px",
343
+ padding: "4px",
344
+ minWidth: "200px",
345
+ width: "max-content",
346
+ /*
347
+ Capped, because `max-content` has no opinion about how wide is
348
+ too wide. A submenu of plain labels never reaches this; one whose
349
+ items carry descriptions would otherwise grow to the longest
350
+ sentence in it and lay every entry out on a single long line.
351
+ With a ceiling, the text wraps instead.
352
+ */
353
+ maxWidth: `${e}px`,
354
+ boxShadow: "0 12px 40px rgba(0,0,0,.35)"
355
+ },
356
+ children: /* @__PURE__ */ p(
357
+ H,
358
+ {
359
+ items: n.children,
360
+ onClose: o,
361
+ rounded: t,
362
+ subMax: e
363
+ }
364
+ )
365
+ }
366
+ ),
367
+ document.body
368
+ )
369
+ ]
370
+ }
371
+ );
372
+ }
373
+ function rn({
374
+ testId: n,
375
+ items: o,
376
+ anchorEl: t,
377
+ open: e,
378
+ onClose: s,
379
+ width: r = "auto",
380
+ rounded: i = !0,
381
+ matchAnchorWidth: c = !1,
382
+ position: x,
383
+ align: u = "auto"
384
+ }) {
385
+ const m = D(null);
386
+ if (w(() => {
387
+ if (!e) return;
388
+ const a = (l) => {
389
+ var f, d;
390
+ const h = l.target;
391
+ (f = m.current) != null && f.contains(h) || t != null && t.contains(h) || (d = h.closest) != null && d.call(h, "[data-dui-ctx-menu]") || s();
392
+ };
393
+ return document.addEventListener("mousedown", a), () => document.removeEventListener("mousedown", a);
394
+ }, [e, t, s]), w(() => {
395
+ if (!e) return;
396
+ const a = (l) => {
397
+ if (l.key === "Escape") {
398
+ s();
399
+ return;
400
+ }
401
+ const h = l.key.toUpperCase(), f = o.find((d) => d.disabled || d.separator || !d.shortcut || !d.onClick ? !1 : d.shortcut === "⌫" ? l.key === "Backspace" || l.key === "Delete" : d.shortcut.toUpperCase() === h);
402
+ f && (l.preventDefault(), f.onClick(), s());
403
+ };
404
+ return document.addEventListener("keydown", a), () => document.removeEventListener("keydown", a);
405
+ }, [e, s, o]), w(() => {
406
+ if (!e || !m.current) return;
407
+ const a = m.current, l = () => {
408
+ const f = a.scrollWidth, d = a.scrollHeight;
409
+ let v, k, _ = 0;
410
+ if (x)
411
+ v = x.x, k = x.y, _ = x.y;
412
+ else if (t) {
413
+ const b = t.getBoundingClientRect();
414
+ u === "right" ? v = b.right - f : u === "left" ? v = b.left : v = b.left + f <= window.innerWidth - 8 ? b.left : b.right - f, k = b.bottom + 4, _ = b.top, c && (a.style.width = b.width + "px");
415
+ } else
416
+ return;
417
+ v + f > window.innerWidth - 8 && (v = Math.max(8, window.innerWidth - f - 8)), v < 8 && (v = 8), k + d > window.innerHeight - 8 && (k = Math.max(8, _ - d - 4)), a.style.left = v + "px", a.style.top = k + "px";
418
+ };
419
+ l();
420
+ const h = requestAnimationFrame(l);
421
+ return window.addEventListener("scroll", l, { passive: !0, capture: !0 }), window.addEventListener("resize", l, { passive: !0 }), () => {
422
+ cancelAnimationFrame(h), window.removeEventListener("scroll", l, { capture: !0 }), window.removeEventListener("resize", l);
423
+ };
424
+ }, [e, t, x, c, u]), !e) return null;
425
+ const g = Q(r);
426
+ return A(
427
+ /* @__PURE__ */ p(
428
+ "div",
429
+ {
430
+ "data-testid": n,
431
+ ref: m,
432
+ "data-dui-ctx-menu": "true",
433
+ style: {
434
+ position: "fixed",
435
+ zIndex: 99998,
436
+ width: g,
437
+ minWidth: "140px",
438
+ background: "var(--color-elevated, var(--color-surface-bg))",
439
+ border: "1px solid var(--color-surface-border)",
440
+ borderRadius: i ? "8px" : "0px",
441
+ padding: "4px",
442
+ boxShadow: "0 12px 40px rgba(0,0,0,.35), 0 0 0 1px var(--color-panel-border, rgba(255,255,255,.04))",
443
+ animation: "dui_menu-in 120ms ease-out"
444
+ },
445
+ children: /* @__PURE__ */ p(
446
+ H,
447
+ {
448
+ items: o,
449
+ onClose: s,
450
+ rounded: i,
451
+ subMax: tn(r)
452
+ }
453
+ )
454
+ }
455
+ ),
456
+ document.body
457
+ );
458
+ }
459
+ let T = "idle", L = null, $ = null;
460
+ const E = /* @__PURE__ */ new Set();
461
+ function on() {
462
+ for (const n of E) n();
463
+ }
464
+ function W() {
465
+ return T;
466
+ }
467
+ function Mn(n) {
468
+ L = n;
469
+ }
470
+ function An(n) {
471
+ $ = n;
472
+ }
473
+ function Rn() {
474
+ return L;
475
+ }
476
+ function Un() {
477
+ return $;
478
+ }
479
+ function Hn() {
480
+ T = "ready", on();
481
+ }
482
+ function Tn() {
483
+ return j(
484
+ (n) => (E.add(n), () => E.delete(n)),
485
+ W,
486
+ W
487
+ );
488
+ }
489
+ function Ln({
490
+ bordered: n,
491
+ containerHeight: o,
492
+ children: t,
493
+ contextMenuMode: e = "native",
494
+ contextMenuItems: s,
495
+ itemsAt: r,
496
+ accentColor: i
497
+ }) {
498
+ const [c, x] = S(null), [u, m] = S([]), g = e === "dui";
499
+ return /* @__PURE__ */ y(
500
+ "div",
501
+ {
502
+ className: `dui-editor-shell relative${n ? " rounded border border-[var(--color-surface-border)]" : ""}`,
503
+ style: { height: o, width: "100%", position: "relative", ...i ? { "--editor-accent": i } : {} },
504
+ onContextMenuCapture: g ? (a) => {
505
+ a.preventDefault(), m((r == null ? void 0 : r(a.clientX, a.clientY)) ?? []), x({ x: a.clientX, y: a.clientY });
506
+ } : void 0,
507
+ children: [
508
+ t,
509
+ g && (u.length > 0 || s) && /* @__PURE__ */ p(
510
+ rn,
511
+ {
512
+ open: !!c,
513
+ anchorEl: null,
514
+ position: c ?? void 0,
515
+ items: [...u, ...s ?? []],
516
+ onClose: () => x(null),
517
+ width: 240
518
+ }
519
+ )
520
+ ]
521
+ }
522
+ );
523
+ }
524
+ function sn(n, o) {
525
+ let t = "", e = o + 1;
526
+ for (; e < n.length; ) {
527
+ const s = n[e];
528
+ if (s === "\\") {
529
+ const r = n[e + 1];
530
+ t += r === "n" ? `
531
+ ` : r === "t" ? " " : r === "r" ? "\r" : r === "u" ? String.fromCharCode(parseInt(n.slice(e + 2, e + 6), 16) || 0) : r ?? "", e += r === "u" ? 6 : 2;
532
+ continue;
533
+ }
534
+ if (s === '"') return { value: t, end: e };
535
+ t += s, e++;
536
+ }
537
+ return { value: t, end: n.length };
538
+ }
539
+ const xn = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
540
+ function P(n) {
541
+ let o = "$";
542
+ for (const t of n)
543
+ t.kind === "array" ? o += `[${t.index}]` : t.key !== void 0 && (o += xn.test(t.key) ? `.${t.key}` : `[${JSON.stringify(t.key)}]`);
544
+ return o;
545
+ }
546
+ function $n(n, o) {
547
+ const t = O(n, o);
548
+ return t && P(t);
549
+ }
550
+ function Pn(n, o) {
551
+ const t = O(n, o);
552
+ if (!t) return [];
553
+ const e = [];
554
+ for (let s = 0; s <= t.length; s++) {
555
+ const r = P(t.slice(0, s));
556
+ r !== e[e.length - 1] && e.push(r);
557
+ }
558
+ return e;
559
+ }
560
+ function O(n, o) {
561
+ if (!n) return;
562
+ const t = Math.max(0, Math.min(o, n.length)), e = [];
563
+ let s = 0;
564
+ for (; s < n.length && !(s >= t); ) {
565
+ const r = n[s];
566
+ if (r === '"') {
567
+ const { value: i, end: c } = sn(n, s), x = e[e.length - 1];
568
+ let u = c + 1;
569
+ for (; u < n.length && /\s/.test(n[u]); ) u++;
570
+ if (n[u] === ":" && (x == null ? void 0 : x.kind) === "object" && (x.key = i), t <= c) return e;
571
+ s = c + 1;
572
+ continue;
573
+ }
574
+ if (r === "{") {
575
+ e.push({ kind: "object", index: 0 }), s++;
576
+ continue;
577
+ }
578
+ if (r === "[") {
579
+ e.push({ kind: "array", index: 0 }), s++;
580
+ continue;
581
+ }
582
+ if (r === "}" || r === "]") {
583
+ e.pop(), s++;
584
+ continue;
585
+ }
586
+ if (r === ",") {
587
+ const i = e[e.length - 1];
588
+ (i == null ? void 0 : i.kind) === "array" ? i.index++ : i && (i.key = void 0), s++;
589
+ continue;
590
+ }
591
+ s++;
592
+ }
593
+ return e;
594
+ }
595
+ function z(n) {
596
+ return n.map((o) => o.index > 1 ? `/${o.name}[${o.index}]` : `/${o.name}`).join("");
597
+ }
598
+ function I(n, o, t) {
599
+ const e = n.indexOf(t, o);
600
+ return e === -1 ? n.length : e + t.length;
601
+ }
602
+ function On(n, o) {
603
+ const t = B(n, o);
604
+ return t != null && t.length ? z(t) : void 0;
605
+ }
606
+ function zn(n, o) {
607
+ const t = B(n, o) ?? [];
608
+ return t.map((e, s) => z(t.slice(0, s + 1)));
609
+ }
610
+ function B(n, o) {
611
+ var i;
612
+ if (!n) return;
613
+ const t = Math.max(0, Math.min(o, n.length)), e = [], s = /* @__PURE__ */ new Map();
614
+ let r = 0;
615
+ for (; r < n.length && r < t; ) {
616
+ if (n[r] !== "<") {
617
+ r++;
618
+ continue;
619
+ }
620
+ if (n.startsWith("<!--", r)) {
621
+ r = I(n, r, "-->");
622
+ continue;
623
+ }
624
+ if (n.startsWith("<![CDATA[", r)) {
625
+ r = I(n, r, "]]>");
626
+ continue;
627
+ }
628
+ if (n.startsWith("<?", r)) {
629
+ r = I(n, r, "?>");
630
+ continue;
631
+ }
632
+ if (n.startsWith("<!", r)) {
633
+ r = I(n, r, ">");
634
+ continue;
635
+ }
636
+ const c = n.indexOf(">", r);
637
+ if (c === -1) break;
638
+ const x = n.slice(r + 1, c);
639
+ if (x.startsWith("/")) {
640
+ if (t <= c) return e;
641
+ e.pop(), r = c + 1;
642
+ continue;
643
+ }
644
+ const u = (i = x.match(/^[^\s/>]+/)) == null ? void 0 : i[0];
645
+ if (!u) {
646
+ r = c + 1;
647
+ continue;
648
+ }
649
+ const m = e[e.length - 1], g = m ? m.counts : s, a = (g.get(u) ?? 0) + 1;
650
+ g.set(u, a);
651
+ const l = x.endsWith("/");
652
+ if (e.push({ name: u, counts: /* @__PURE__ */ new Map(), index: a }), t <= c) return e;
653
+ l && e.pop(), r = c + 1;
654
+ }
655
+ return e;
656
+ }
657
+ export {
658
+ Pn as A,
659
+ Wn as B,
660
+ rn as C,
661
+ Sn as D,
662
+ Ln as E,
663
+ On as F,
664
+ zn as G,
665
+ Hn as H,
666
+ Mn as I,
667
+ An as J,
668
+ Dn as a,
669
+ _n as b,
670
+ kn as c,
671
+ In as d,
672
+ dn as e,
673
+ K as f,
674
+ pn as g,
675
+ X as h,
676
+ bn as i,
677
+ wn as j,
678
+ hn as k,
679
+ fn as l,
680
+ mn as m,
681
+ vn as n,
682
+ gn as o,
683
+ yn as p,
684
+ Cn as q,
685
+ Y as r,
686
+ Tn as s,
687
+ Rn as t,
688
+ U as u,
689
+ Un as v,
690
+ Z as w,
691
+ q as x,
692
+ En as y,
693
+ $n as z
694
+ };
695
+ //# sourceMappingURL=doc-path-D2_JUEIe.js.map