@adecore/ui 0.31.11 → 0.32.0

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 (163) hide show
  1. package/dist/AccentSwatches.js +290 -13
  2. package/dist/Banner.js +90 -9
  3. package/dist/Button.js +114 -22
  4. package/dist/ButtonGroup.js +62 -8
  5. package/dist/Checkbox.js +73 -4
  6. package/dist/ChoiceCards.js +205 -11
  7. package/dist/CloseButton.js +87 -7
  8. package/dist/ColorSwatch.js +132 -15
  9. package/dist/ColorWheelPicker.js +305 -71
  10. package/dist/ColumnResizeHandle.js +43 -8
  11. package/dist/DisabledReason.js +27 -8
  12. package/dist/DockShell.js +144 -37
  13. package/dist/EmptyState.js +95 -6
  14. package/dist/ErrorBoundary.js +254 -31
  15. package/dist/Field.js +349 -31
  16. package/dist/FileIcon.js +67 -6
  17. package/dist/Icon.js +38 -6
  18. package/dist/IconButton.js +176 -20
  19. package/dist/IconPicker.js +344 -73
  20. package/dist/Input.js +233 -14
  21. package/dist/Kbd.js +150 -10
  22. package/dist/LazyBoundary.js +14 -5
  23. package/dist/ListRow.js +75 -15
  24. package/dist/Meter.js +108 -5
  25. package/dist/MiddleTruncate.js +126 -45
  26. package/dist/PanelEmpty.js +64 -5
  27. package/dist/PanelHeader.js +95 -13
  28. package/dist/Pill.js +114 -19
  29. package/dist/ProjectSwitcher.js +225 -12
  30. package/dist/PromptDialog.js +352 -37
  31. package/dist/SectionLabel.js +62 -8
  32. package/dist/SegmentBar.js +197 -36
  33. package/dist/Segmented.js +130 -23
  34. package/dist/Select.js +310 -19
  35. package/dist/SelectSearch.js +344 -29
  36. package/dist/Separator.js +35 -4
  37. package/dist/ShortcutHints.js +146 -76
  38. package/dist/Skeleton.js +31 -4
  39. package/dist/Slider.js +172 -10
  40. package/dist/SlidingColumn.js +194 -34
  41. package/dist/Spinner.js +100 -3
  42. package/dist/Stepper.js +232 -11
  43. package/dist/Surface.js +62 -8
  44. package/dist/Switch.js +60 -6
  45. package/dist/TextMenu.js +212 -17
  46. package/dist/Tile.js +149 -5
  47. package/dist/Toasts.js +391 -33
  48. package/dist/Tooltip.js +153 -16
  49. package/dist/UIProvider.js +62 -15
  50. package/dist/Waveform.js +362 -93
  51. package/dist/Wipe.js +259 -34
  52. package/dist/ZoomControls.js +356 -14
  53. package/dist/class-name.js +1 -1
  54. package/dist/clipboard.js +15 -17
  55. package/dist/context-menu/index.parts.js +1 -1
  56. package/dist/dialog/index.parts.js +1 -1
  57. package/dist/dialog/parts.js +378 -29
  58. package/dist/dialog-layer.js +51 -18
  59. package/dist/error-boundary.js +19 -19
  60. package/dist/error-message.js +1 -1
  61. package/dist/field-context.js +7 -5
  62. package/dist/file-icon.js +23 -21
  63. package/dist/file-tree/helpers.js +133 -119
  64. package/dist/file-tree/index.parts.js +3 -3
  65. package/dist/file-tree/parts.js +418 -127
  66. package/dist/file-tree/style.js +1 -1
  67. package/dist/file-tree/use-file-tree-shift.js +43 -30
  68. package/dist/file-tree/use-file-tree.js +60 -18
  69. package/dist/file-tree/use-slots.js +220 -192
  70. package/dist/floating.js +2 -2
  71. package/dist/format/datetime.js +88 -38
  72. package/dist/format/duration.js +59 -53
  73. package/dist/format/index.js +1 -1
  74. package/dist/format/locale.js +76 -56
  75. package/dist/format/number.js +77 -61
  76. package/dist/format/regions.js +4 -2
  77. package/dist/format/time-zone.js +1 -1
  78. package/dist/icon-button-size.js +12 -2
  79. package/dist/icon-picker.js +70 -61
  80. package/dist/index.js +57 -57
  81. package/dist/key-value-list/index.parts.js +1 -1
  82. package/dist/key-value-list/parts.js +256 -22
  83. package/dist/lazy-landings.js +10 -10
  84. package/dist/lazy.js +84 -71
  85. package/dist/locales/en.js +80 -80
  86. package/dist/locales/nl.js +80 -80
  87. package/dist/locales.js +10 -7
  88. package/dist/menu/index.parts.js +1 -1
  89. package/dist/menu/parts.js +882 -44
  90. package/dist/merge-refs.js +8 -9
  91. package/dist/middle-truncate.js +24 -25
  92. package/dist/modality.js +27 -19
  93. package/dist/placement.js +11 -20
  94. package/dist/platform.js +6 -6
  95. package/dist/popover/index.parts.js +1 -1
  96. package/dist/popover/parts.js +173 -11
  97. package/dist/popup-layer.js +38 -17
  98. package/dist/prefetch.js +78 -79
  99. package/dist/preview-card/index.parts.js +1 -1
  100. package/dist/project-switcher-row.js +153 -12
  101. package/dist/select-row.js +69 -5
  102. package/dist/select-shared.js +6 -6
  103. package/dist/selection.js +16 -16
  104. package/dist/seti-icons.js +413 -413
  105. package/dist/settings/ConfirmDialog.js +55 -8
  106. package/dist/settings/DetailHeader.js +72 -4
  107. package/dist/settings/MasterDetail.js +119 -7
  108. package/dist/settings/SettingsDialog.js +820 -80
  109. package/dist/settings/SettingsRow.js +205 -18
  110. package/dist/settings/SettingsSection.js +96 -6
  111. package/dist/settings/index.js +7 -7
  112. package/dist/settings/target.js +7 -2
  113. package/dist/shortcut-hints.js +73 -55
  114. package/dist/shortcut.js +140 -104
  115. package/dist/step-places.js +1 -1
  116. package/dist/tabs/index.parts.js +1 -1
  117. package/dist/tabs/overflow.js +18 -18
  118. package/dist/tabs/parts.js +780 -166
  119. package/dist/testing/dedupe.js +82 -75
  120. package/dist/testing/fake-source.js +12 -12
  121. package/dist/testing/index.js +1 -1
  122. package/dist/toast-store.js +65 -46
  123. package/dist/tree/index.parts.js +1 -1
  124. package/dist/tree/parts.js +721 -94
  125. package/dist/tree/shift.js +28 -22
  126. package/dist/tree/style.js +2 -2
  127. package/dist/tree/use-tree-shift.js +178 -117
  128. package/dist/useAsyncAction.js +23 -19
  129. package/dist/useColumnResize.js +36 -34
  130. package/dist/useContentSize.js +62 -18
  131. package/dist/useMeasuredWidth.js +14 -3
  132. package/dist/useNow.js +73 -30
  133. package/dist/wipe-split.js +14 -14
  134. package/dist/workspace/DropPreview.js +60 -7
  135. package/dist/workspace/SplitView.js +1025 -441
  136. package/dist/workspace/TabStrip.js +810 -191
  137. package/dist/workspace/Workspace.js +276 -26
  138. package/dist/workspace/context.js +8 -3
  139. package/dist/workspace/geometry.js +173 -150
  140. package/dist/workspace/model.js +313 -250
  141. package/dist/workspace/preview.js +61 -61
  142. package/dist/zoom.js +2 -2
  143. package/package.json +1 -1
  144. package/src/ErrorBoundary.tsx +1 -1
  145. package/src/Field.tsx +4 -3
  146. package/src/IconPicker.tsx +3 -3
  147. package/src/LazyBoundary.tsx +2 -0
  148. package/src/MiddleTruncate.tsx +2 -2
  149. package/src/SegmentBar.tsx +2 -2
  150. package/src/Toasts.tsx +3 -1
  151. package/src/Tooltip.tsx +7 -10
  152. package/src/Waveform.tsx +3 -3
  153. package/src/file-tree/parts.tsx +6 -9
  154. package/src/file-tree/use-file-tree-shift.tsx +6 -9
  155. package/src/lazy.tsx +4 -0
  156. package/src/locales/en.ts +4 -4
  157. package/src/locales/nl.ts +5 -5
  158. package/src/settings/SettingsDialog.tsx +1 -1
  159. package/src/tree/parts.tsx +5 -8
  160. package/src/useContentSize.ts +3 -3
  161. package/src/workspace/SplitView.tsx +2 -2
  162. package/src/workspace/TabStrip.tsx +2 -3
  163. package/src/workspace/Workspace.tsx +2 -5
package/dist/Stepper.js CHANGED
@@ -1,18 +1,239 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { Minus, Plus } from 'lucide-react';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { ButtonGroup } from './ButtonGroup.js';
5
+ import { ButtonGroup } from "./ButtonGroup.js";
6
6
  import { formatFixed } from './format/number.js';
7
- import { IconButton } from './IconButton.js';
7
+ import { IconButton } from "./IconButton.js";
8
8
  import { placesOf } from './step-places.js';
9
9
  /* A number between minus and plus, in one sunken group so the three read as a single control. */
10
- export function Stepper({ value, onValueChange, min, max, step, decimals = placesOf(step), unit, label, className, ref }) {
11
- const { t } = useTranslation('ui');
12
- const reading = (amount) => (_jsxs(_Fragment, { children: [formatFixed(amount, decimals), unit && _jsx("span", { className: "text-text-muted", children: unit })] }));
13
- const nudge = (direction) => {
14
- const next = Math.round((value + direction * step) * 100) / 100;
15
- onValueChange(Math.min(max, Math.max(min, next)));
10
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export function Stepper(t0) {
12
+ const $ = _c(58);
13
+ const {
14
+ value,
15
+ onValueChange,
16
+ min,
17
+ max,
18
+ step,
19
+ decimals: t1,
20
+ unit,
21
+ label,
22
+ className,
23
+ ref
24
+ } = t0;
25
+ let t2;
26
+ if ($[0] !== step || $[1] !== t1) {
27
+ t2 = t1 === undefined ? placesOf(step) : t1;
28
+ $[0] = step;
29
+ $[1] = t1;
30
+ $[2] = t2;
31
+ } else {
32
+ t2 = $[2];
33
+ }
34
+ const decimals = t2;
35
+ const {
36
+ t
37
+ } = useTranslation("ui");
38
+ let t3;
39
+ if ($[3] !== decimals || $[4] !== unit) {
40
+ t3 = amount => /*#__PURE__*/_jsxs(_Fragment, {
41
+ children: [formatFixed(amount, decimals), unit && /*#__PURE__*/_jsx("span", {
42
+ className: "text-text-muted",
43
+ children: unit
44
+ })]
45
+ });
46
+ $[3] = decimals;
47
+ $[4] = unit;
48
+ $[5] = t3;
49
+ } else {
50
+ t3 = $[5];
51
+ }
52
+ const reading = t3;
53
+ let t4;
54
+ if ($[6] !== max || $[7] !== min || $[8] !== onValueChange || $[9] !== step || $[10] !== value) {
55
+ t4 = direction => {
56
+ const next = Math.round((value + direction * step) * 100) / 100;
57
+ onValueChange(Math.min(max, Math.max(min, next)));
16
58
  };
17
- return (_jsxs(ButtonGroup, { ref: ref, className: clsx('shrink-0 rounded-lg bg-surface-sunken p-0.5', className), role: "group", "aria-label": label, children: [_jsx(IconButton, { icon: Minus, size: "sm", label: t('controls.stepper.smallerFor', { label }), tooltip: t('controls.stepper.smaller'), disabled: value <= min, onClick: () => nudge(-1) }), _jsxs("span", { className: "grid min-w-10 px-1 text-center text-xs text-text tabular-nums", children: [_jsx("span", { className: "invisible col-start-1 row-start-1", children: reading(min) }), _jsx("span", { className: "invisible col-start-1 row-start-1", children: reading(max) }), _jsx("span", { className: "col-start-1 row-start-1", "aria-live": "polite", children: reading(value) })] }), _jsx(IconButton, { icon: Plus, size: "sm", label: t('controls.stepper.largerFor', { label }), tooltip: t('controls.stepper.larger'), disabled: value >= max, onClick: () => nudge(1) })] }));
18
- }
59
+ $[6] = max;
60
+ $[7] = min;
61
+ $[8] = onValueChange;
62
+ $[9] = step;
63
+ $[10] = value;
64
+ $[11] = t4;
65
+ } else {
66
+ t4 = $[11];
67
+ }
68
+ const nudge = t4;
69
+ let t5;
70
+ if ($[12] !== className) {
71
+ t5 = clsx("shrink-0 rounded-lg bg-surface-sunken p-0.5", className);
72
+ $[12] = className;
73
+ $[13] = t5;
74
+ } else {
75
+ t5 = $[13];
76
+ }
77
+ let t6;
78
+ if ($[14] !== label || $[15] !== t) {
79
+ t6 = t("controls.stepper.smallerFor", {
80
+ label
81
+ });
82
+ $[14] = label;
83
+ $[15] = t;
84
+ $[16] = t6;
85
+ } else {
86
+ t6 = $[16];
87
+ }
88
+ let t7;
89
+ if ($[17] !== t) {
90
+ t7 = t("controls.stepper.smaller");
91
+ $[17] = t;
92
+ $[18] = t7;
93
+ } else {
94
+ t7 = $[18];
95
+ }
96
+ const t8 = value <= min;
97
+ let t9;
98
+ if ($[19] !== nudge) {
99
+ t9 = () => nudge(-1);
100
+ $[19] = nudge;
101
+ $[20] = t9;
102
+ } else {
103
+ t9 = $[20];
104
+ }
105
+ let t10;
106
+ if ($[21] !== t6 || $[22] !== t7 || $[23] !== t8 || $[24] !== t9) {
107
+ t10 = /*#__PURE__*/_jsx(IconButton, {
108
+ icon: Minus,
109
+ size: "sm",
110
+ label: t6,
111
+ tooltip: t7,
112
+ disabled: t8,
113
+ onClick: t9
114
+ });
115
+ $[21] = t6;
116
+ $[22] = t7;
117
+ $[23] = t8;
118
+ $[24] = t9;
119
+ $[25] = t10;
120
+ } else {
121
+ t10 = $[25];
122
+ }
123
+ let t11;
124
+ if ($[26] !== min || $[27] !== reading) {
125
+ t11 = /*#__PURE__*/_jsx("span", {
126
+ className: "invisible col-start-1 row-start-1",
127
+ children: reading(min)
128
+ });
129
+ $[26] = min;
130
+ $[27] = reading;
131
+ $[28] = t11;
132
+ } else {
133
+ t11 = $[28];
134
+ }
135
+ let t12;
136
+ if ($[29] !== max || $[30] !== reading) {
137
+ t12 = /*#__PURE__*/_jsx("span", {
138
+ className: "invisible col-start-1 row-start-1",
139
+ children: reading(max)
140
+ });
141
+ $[29] = max;
142
+ $[30] = reading;
143
+ $[31] = t12;
144
+ } else {
145
+ t12 = $[31];
146
+ }
147
+ let t13;
148
+ if ($[32] !== reading || $[33] !== value) {
149
+ t13 = /*#__PURE__*/_jsx("span", {
150
+ className: "col-start-1 row-start-1",
151
+ "aria-live": "polite",
152
+ children: reading(value)
153
+ });
154
+ $[32] = reading;
155
+ $[33] = value;
156
+ $[34] = t13;
157
+ } else {
158
+ t13 = $[34];
159
+ }
160
+ let t14;
161
+ if ($[35] !== t11 || $[36] !== t12 || $[37] !== t13) {
162
+ t14 = /*#__PURE__*/_jsxs("span", {
163
+ className: "grid min-w-10 px-1 text-center text-xs text-text tabular-nums",
164
+ children: [t11, t12, t13]
165
+ });
166
+ $[35] = t11;
167
+ $[36] = t12;
168
+ $[37] = t13;
169
+ $[38] = t14;
170
+ } else {
171
+ t14 = $[38];
172
+ }
173
+ let t15;
174
+ if ($[39] !== label || $[40] !== t) {
175
+ t15 = t("controls.stepper.largerFor", {
176
+ label
177
+ });
178
+ $[39] = label;
179
+ $[40] = t;
180
+ $[41] = t15;
181
+ } else {
182
+ t15 = $[41];
183
+ }
184
+ let t16;
185
+ if ($[42] !== t) {
186
+ t16 = t("controls.stepper.larger");
187
+ $[42] = t;
188
+ $[43] = t16;
189
+ } else {
190
+ t16 = $[43];
191
+ }
192
+ const t17 = value >= max;
193
+ let t18;
194
+ if ($[44] !== nudge) {
195
+ t18 = () => nudge(1);
196
+ $[44] = nudge;
197
+ $[45] = t18;
198
+ } else {
199
+ t18 = $[45];
200
+ }
201
+ let t19;
202
+ if ($[46] !== t15 || $[47] !== t16 || $[48] !== t17 || $[49] !== t18) {
203
+ t19 = /*#__PURE__*/_jsx(IconButton, {
204
+ icon: Plus,
205
+ size: "sm",
206
+ label: t15,
207
+ tooltip: t16,
208
+ disabled: t17,
209
+ onClick: t18
210
+ });
211
+ $[46] = t15;
212
+ $[47] = t16;
213
+ $[48] = t17;
214
+ $[49] = t18;
215
+ $[50] = t19;
216
+ } else {
217
+ t19 = $[50];
218
+ }
219
+ let t20;
220
+ if ($[51] !== label || $[52] !== ref || $[53] !== t10 || $[54] !== t14 || $[55] !== t19 || $[56] !== t5) {
221
+ t20 = /*#__PURE__*/_jsxs(ButtonGroup, {
222
+ ref: ref,
223
+ className: t5,
224
+ role: "group",
225
+ "aria-label": label,
226
+ children: [t10, t14, t19]
227
+ });
228
+ $[51] = label;
229
+ $[52] = ref;
230
+ $[53] = t10;
231
+ $[54] = t14;
232
+ $[55] = t19;
233
+ $[56] = t5;
234
+ $[57] = t20;
235
+ } else {
236
+ t20 = $[57];
237
+ }
238
+ return t20;
239
+ }
package/dist/Surface.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import clsx from 'clsx';
2
3
  import { useRender } from '@base-ui/react/use-render';
3
4
  const FLOAT = 'border border-border bg-[color-mix(in_srgb,var(--surface-raised)_88%,transparent)] shadow-float backdrop-blur-[14px]';
@@ -6,11 +7,64 @@ const FLOAT = 'border border-border bg-[color-mix(in_srgb,var(--surface-raised)_
6
7
  * chip over a scrolling thread. It brings the ground, the border and the shadow; the caller brings
7
8
  * the shape (radius, padding, height) and the position.
8
9
  */
9
- export function Surface({ render, className, ref, ...props }) {
10
- return useRender({
11
- render,
12
- ref,
13
- defaultTagName: 'div',
14
- props: { ...props, className: clsx(FLOAT, className) }
15
- });
16
- }
10
+ export function Surface(t0) {
11
+ const $ = _c(14);
12
+ let className;
13
+ let props;
14
+ let ref;
15
+ let render;
16
+ if ($[0] !== t0) {
17
+ ({
18
+ render,
19
+ className,
20
+ ref,
21
+ ...props
22
+ } = t0);
23
+ $[0] = t0;
24
+ $[1] = className;
25
+ $[2] = props;
26
+ $[3] = ref;
27
+ $[4] = render;
28
+ } else {
29
+ className = $[1];
30
+ props = $[2];
31
+ ref = $[3];
32
+ render = $[4];
33
+ }
34
+ let t1;
35
+ if ($[5] !== className) {
36
+ t1 = clsx(FLOAT, className);
37
+ $[5] = className;
38
+ $[6] = t1;
39
+ } else {
40
+ t1 = $[6];
41
+ }
42
+ let t2;
43
+ if ($[7] !== props || $[8] !== t1) {
44
+ t2 = {
45
+ ...props,
46
+ className: t1
47
+ };
48
+ $[7] = props;
49
+ $[8] = t1;
50
+ $[9] = t2;
51
+ } else {
52
+ t2 = $[9];
53
+ }
54
+ let t3;
55
+ if ($[10] !== ref || $[11] !== render || $[12] !== t2) {
56
+ t3 = {
57
+ render,
58
+ ref,
59
+ defaultTagName: "div",
60
+ props: t2
61
+ };
62
+ $[10] = ref;
63
+ $[11] = render;
64
+ $[12] = t2;
65
+ $[13] = t3;
66
+ } else {
67
+ t3 = $[13];
68
+ }
69
+ return useRender(t3);
70
+ }
package/dist/Switch.js CHANGED
@@ -1,9 +1,63 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import clsx from 'clsx';
3
3
  import { Switch as BaseSwitch } from '@base-ui/react/switch';
4
4
  /* On or off, as a switch rather than a checkbox: a setting that takes effect the moment it flips. */
5
- export function Switch({ checked, onCheckedChange, label, disabled, className, ref }) {
6
- return (_jsx(BaseSwitch.Root, { ref: ref, checked: checked, onCheckedChange: (next) => onCheckedChange(next), "aria-label": label, disabled: disabled,
7
- // Base UI renders the root as a `span`, which ignores its size outside a flex row unless it lays out as a box.
8
- className: clsx('relative inline-flex h-5 w-9 shrink-0 rounded-full bg-border-strong p-0.5 transition-colors data-checked:bg-accent data-disabled:opacity-50', className), children: _jsx(BaseSwitch.Thumb, { className: "block h-4 w-4 rounded-full bg-surface-raised shadow-raised transition-transform data-checked:translate-x-4" }) }));
9
- }
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export function Switch(t0) {
7
+ const $ = _c(12);
8
+ const {
9
+ checked,
10
+ onCheckedChange,
11
+ label,
12
+ disabled,
13
+ className,
14
+ ref
15
+ } = t0;
16
+ let t1;
17
+ if ($[0] !== onCheckedChange) {
18
+ t1 = next => onCheckedChange(next);
19
+ $[0] = onCheckedChange;
20
+ $[1] = t1;
21
+ } else {
22
+ t1 = $[1];
23
+ }
24
+ let t2;
25
+ if ($[2] !== className) {
26
+ t2 = clsx("relative inline-flex h-5 w-9 shrink-0 rounded-full bg-border-strong p-0.5 transition-colors data-checked:bg-accent data-disabled:opacity-50", className);
27
+ $[2] = className;
28
+ $[3] = t2;
29
+ } else {
30
+ t2 = $[3];
31
+ }
32
+ let t3;
33
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
34
+ t3 = /*#__PURE__*/_jsx(BaseSwitch.Thumb, {
35
+ className: "block h-4 w-4 rounded-full bg-surface-raised shadow-raised transition-transform data-checked:translate-x-4"
36
+ });
37
+ $[4] = t3;
38
+ } else {
39
+ t3 = $[4];
40
+ }
41
+ let t4;
42
+ if ($[5] !== checked || $[6] !== disabled || $[7] !== label || $[8] !== ref || $[9] !== t1 || $[10] !== t2) {
43
+ t4 = /*#__PURE__*/_jsx(BaseSwitch.Root, {
44
+ ref: ref,
45
+ checked: checked,
46
+ onCheckedChange: t1,
47
+ "aria-label": label,
48
+ disabled: disabled,
49
+ className: t2,
50
+ children: t3
51
+ });
52
+ $[5] = checked;
53
+ $[6] = disabled;
54
+ $[7] = label;
55
+ $[8] = ref;
56
+ $[9] = t1;
57
+ $[10] = t2;
58
+ $[11] = t4;
59
+ } else {
60
+ t4 = $[11];
61
+ }
62
+ return t4;
63
+ }
package/dist/TextMenu.js CHANGED
@@ -1,12 +1,12 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useRef, useState } from 'react';
3
3
  import { Copy, Scan } from 'lucide-react';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { copyText } from './clipboard.js';
6
- import { Icon } from './Icon.js';
7
- import { Kbd } from './Kbd.js';
6
+ import { Icon } from "./Icon.js";
7
+ import { Kbd } from "./Kbd.js";
8
8
  import { mergeRefs } from './merge-refs.js';
9
- import { ContextMenuRoot, ContextMenuTrigger, MenuItem, MenuPopup, MenuSeparator } from './menu/parts.js';
9
+ import { ContextMenuRoot, ContextMenuTrigger, MenuItem, MenuPopup, MenuSeparator } from "./menu/parts.js";
10
10
  import { isApplePlatform } from './platform.js';
11
11
  import { selectAllWithin, selectionWithin } from './selection.js';
12
12
  import { EDIT_SHORTCUTS, matchesShortcut } from './shortcut.js';
@@ -15,17 +15,212 @@ import { EDIT_SHORTCUTS, matchesShortcut } from './shortcut.js';
15
15
  * for the whole of it, on Cmd+A as well. Anywhere text can be selected a right-click has to offer
16
16
  * to copy it, and an app that draws every menu itself offers nothing at all without one of these.
17
17
  */
18
- export function TextMenu({ children, items, ref, ...rest }) {
19
- const { t } = useTranslation('ui');
20
- const host = useRef(null);
21
- // Read when the menu opens: a selection made after that is not the one the click was about.
22
- const [selection, setSelection] = useState('');
23
- const onKeyDown = (event) => {
24
- if (!matchesShortcut(EDIT_SHORTCUTS.selectAll, event, isApplePlatform())) {
25
- return;
26
- }
27
- event.preventDefault();
28
- selectAllWithin(host.current);
18
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
+ export function TextMenu(t0) {
20
+ const $ = _c(40);
21
+ let children;
22
+ let items;
23
+ let ref;
24
+ let rest;
25
+ if ($[0] !== t0) {
26
+ ({
27
+ children,
28
+ items,
29
+ ref,
30
+ ...rest
31
+ } = t0);
32
+ $[0] = t0;
33
+ $[1] = children;
34
+ $[2] = items;
35
+ $[3] = ref;
36
+ $[4] = rest;
37
+ } else {
38
+ children = $[1];
39
+ items = $[2];
40
+ ref = $[3];
41
+ rest = $[4];
42
+ }
43
+ const {
44
+ t
45
+ } = useTranslation("ui");
46
+ const host = useRef(null);
47
+ const [selection, setSelection] = useState("");
48
+ let t1;
49
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
50
+ t1 = event => {
51
+ if (!matchesShortcut(EDIT_SHORTCUTS.selectAll, event, isApplePlatform())) {
52
+ return;
53
+ }
54
+ event.preventDefault();
55
+ selectAllWithin(host.current);
29
56
  };
30
- return (_jsxs(ContextMenuRoot, { onOpenChange: (open) => setSelection(open ? selectionWithin(host.current) : ''), children: [_jsx(ContextMenuTrigger, { ...rest, ref: mergeRefs(host, ref), onKeyDown: onKeyDown, children: children }), _jsxs(MenuPopup, { children: [_jsxs(MenuItem, { disabled: selection === '', onClick: () => copyText(selection), children: [_jsx(Icon, { icon: Copy, size: 14 }), " ", t('action.copy'), " ", _jsx(Kbd, { shortcut: EDIT_SHORTCUTS.copy })] }), _jsx(MenuSeparator, {}), _jsxs(MenuItem, { onClick: () => selectAllWithin(host.current), children: [_jsx(Icon, { icon: Scan, size: 14 }), " ", t('action.selectAll'), " ", _jsx(Kbd, { shortcut: EDIT_SHORTCUTS.selectAll })] }), items !== undefined && (_jsxs(_Fragment, { children: [_jsx(MenuSeparator, {}), items] }))] })] }));
31
- }
57
+ $[5] = t1;
58
+ } else {
59
+ t1 = $[5];
60
+ }
61
+ const onKeyDown = t1;
62
+ let t2;
63
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
64
+ t2 = open => setSelection(open ? selectionWithin(host.current) : "");
65
+ $[6] = t2;
66
+ } else {
67
+ t2 = $[6];
68
+ }
69
+ let t3;
70
+ if ($[7] !== ref) {
71
+ t3 = mergeRefs(host, ref);
72
+ $[7] = ref;
73
+ $[8] = t3;
74
+ } else {
75
+ t3 = $[8];
76
+ }
77
+ let t4;
78
+ if ($[9] !== children || $[10] !== rest || $[11] !== t3) {
79
+ t4 = /*#__PURE__*/_jsx(ContextMenuTrigger, {
80
+ ...rest,
81
+ ref: t3,
82
+ onKeyDown: onKeyDown,
83
+ children: children
84
+ });
85
+ $[9] = children;
86
+ $[10] = rest;
87
+ $[11] = t3;
88
+ $[12] = t4;
89
+ } else {
90
+ t4 = $[12];
91
+ }
92
+ const t5 = selection === "";
93
+ let t6;
94
+ if ($[13] !== selection) {
95
+ t6 = () => copyText(selection);
96
+ $[13] = selection;
97
+ $[14] = t6;
98
+ } else {
99
+ t6 = $[14];
100
+ }
101
+ let t7;
102
+ if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
103
+ t7 = /*#__PURE__*/_jsx(Icon, {
104
+ icon: Copy,
105
+ size: 14
106
+ });
107
+ $[15] = t7;
108
+ } else {
109
+ t7 = $[15];
110
+ }
111
+ let t8;
112
+ if ($[16] !== t) {
113
+ t8 = t("action.copy");
114
+ $[16] = t;
115
+ $[17] = t8;
116
+ } else {
117
+ t8 = $[17];
118
+ }
119
+ let t9;
120
+ if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
121
+ t9 = /*#__PURE__*/_jsx(Kbd, {
122
+ shortcut: EDIT_SHORTCUTS.copy
123
+ });
124
+ $[18] = t9;
125
+ } else {
126
+ t9 = $[18];
127
+ }
128
+ let t10;
129
+ if ($[19] !== t5 || $[20] !== t6 || $[21] !== t8) {
130
+ t10 = /*#__PURE__*/_jsxs(MenuItem, {
131
+ disabled: t5,
132
+ onClick: t6,
133
+ children: [t7, " ", t8, " ", t9]
134
+ });
135
+ $[19] = t5;
136
+ $[20] = t6;
137
+ $[21] = t8;
138
+ $[22] = t10;
139
+ } else {
140
+ t10 = $[22];
141
+ }
142
+ let t11;
143
+ if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
144
+ t11 = /*#__PURE__*/_jsx(MenuSeparator, {});
145
+ $[23] = t11;
146
+ } else {
147
+ t11 = $[23];
148
+ }
149
+ let t12;
150
+ let t13;
151
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
152
+ t12 = () => selectAllWithin(host.current);
153
+ t13 = /*#__PURE__*/_jsx(Icon, {
154
+ icon: Scan,
155
+ size: 14
156
+ });
157
+ $[24] = t12;
158
+ $[25] = t13;
159
+ } else {
160
+ t12 = $[24];
161
+ t13 = $[25];
162
+ }
163
+ let t14;
164
+ if ($[26] !== t) {
165
+ t14 = t("action.selectAll");
166
+ $[26] = t;
167
+ $[27] = t14;
168
+ } else {
169
+ t14 = $[27];
170
+ }
171
+ let t15;
172
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
173
+ t15 = /*#__PURE__*/_jsx(Kbd, {
174
+ shortcut: EDIT_SHORTCUTS.selectAll
175
+ });
176
+ $[28] = t15;
177
+ } else {
178
+ t15 = $[28];
179
+ }
180
+ let t16;
181
+ if ($[29] !== t14) {
182
+ t16 = /*#__PURE__*/_jsxs(MenuItem, {
183
+ onClick: t12,
184
+ children: [t13, " ", t14, " ", t15]
185
+ });
186
+ $[29] = t14;
187
+ $[30] = t16;
188
+ } else {
189
+ t16 = $[30];
190
+ }
191
+ let t17;
192
+ if ($[31] !== items) {
193
+ t17 = items !== undefined && /*#__PURE__*/_jsxs(_Fragment, {
194
+ children: [/*#__PURE__*/_jsx(MenuSeparator, {}), items]
195
+ });
196
+ $[31] = items;
197
+ $[32] = t17;
198
+ } else {
199
+ t17 = $[32];
200
+ }
201
+ let t18;
202
+ if ($[33] !== t10 || $[34] !== t16 || $[35] !== t17) {
203
+ t18 = /*#__PURE__*/_jsxs(MenuPopup, {
204
+ children: [t10, t11, t16, t17]
205
+ });
206
+ $[33] = t10;
207
+ $[34] = t16;
208
+ $[35] = t17;
209
+ $[36] = t18;
210
+ } else {
211
+ t18 = $[36];
212
+ }
213
+ let t19;
214
+ if ($[37] !== t18 || $[38] !== t4) {
215
+ t19 = /*#__PURE__*/_jsxs(ContextMenuRoot, {
216
+ onOpenChange: t2,
217
+ children: [t4, t18]
218
+ });
219
+ $[37] = t18;
220
+ $[38] = t4;
221
+ $[39] = t19;
222
+ } else {
223
+ t19 = $[39];
224
+ }
225
+ return t19;
226
+ }