@salilvnair/dui 1.0.7 → 1.0.9

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