@epilot/zenith-react 0.2.0-next.0 → 0.2.0-next.3
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/components/accordion/accordion.js +57 -48
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +120 -92
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/avatar/avatar-group.js +38 -35
- package/dist/components/avatar/avatar-group.js.map +1 -1
- package/dist/components/avatar/avatar.js +78 -71
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/badge/badge.js +60 -55
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +99 -54
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
- package/dist/components/button/button.js +87 -77
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button-group/button-group.js +36 -32
- package/dist/components/button-group/button-group.js.map +1 -1
- package/dist/components/callout/callout.js +105 -98
- package/dist/components/callout/callout.js.map +1 -1
- package/dist/components/card/card.js +62 -52
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +22 -19
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/code-block/code-block.js +135 -123
- package/dist/components/code-block/code-block.js.map +1 -1
- package/dist/components/code-editor/code-editor.js +276 -260
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/collapsible-sidebar/collapsible-sidebar.js +62 -56
- package/dist/components/collapsible-sidebar/collapsible-sidebar.js.map +1 -1
- package/dist/components/command/command.js +116 -105
- package/dist/components/command/command.js.map +1 -1
- package/dist/components/data-table/data-table-body.js +38 -34
- package/dist/components/data-table/data-table-body.js.map +1 -1
- package/dist/components/data-table/data-table-column-header.js +30 -26
- package/dist/components/data-table/data-table-column-header.js.map +1 -1
- package/dist/components/data-table/data-table-column-order.js +79 -73
- package/dist/components/data-table/data-table-column-order.js.map +1 -1
- package/dist/components/data-table/data-table-column-visibility.js +25 -22
- package/dist/components/data-table/data-table-column-visibility.js.map +1 -1
- package/dist/components/data-table/data-table-content.js +47 -44
- package/dist/components/data-table/data-table-content.js.map +1 -1
- package/dist/components/data-table/data-table-error.js +36 -32
- package/dist/components/data-table/data-table-error.js.map +1 -1
- package/dist/components/data-table/data-table-footer.js +10 -8
- package/dist/components/data-table/data-table-footer.js.map +1 -1
- package/dist/components/data-table/data-table-header-draggable.js +40 -36
- package/dist/components/data-table/data-table-header-draggable.js.map +1 -1
- package/dist/components/data-table/data-table-header.js +113 -99
- package/dist/components/data-table/data-table-header.js.map +1 -1
- package/dist/components/data-table/data-table-loading.js +21 -18
- package/dist/components/data-table/data-table-loading.js.map +1 -1
- package/dist/components/data-table/data-table-resize-handle.js +13 -11
- package/dist/components/data-table/data-table-resize-handle.js.map +1 -1
- package/dist/components/data-table/data-table-row.js +71 -59
- package/dist/components/data-table/data-table-row.js.map +1 -1
- package/dist/components/data-table/data-table-toolbar.js +9 -7
- package/dist/components/data-table/data-table-toolbar.js.map +1 -1
- package/dist/components/data-table/data-table.js +48 -46
- package/dist/components/data-table/data-table.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +173 -164
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-range-picker/range-calendar.js +36 -34
- package/dist/components/date-range-picker/range-calendar.js.map +1 -1
- package/dist/components/date-time-picker/calendar.js +290 -272
- package/dist/components/date-time-picker/calendar.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-input.js +22 -20
- package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker-panel.js +126 -120
- package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
- package/dist/components/date-time-picker/date-time-picker.js +42 -40
- package/dist/components/date-time-picker/date-time-picker.js.map +1 -1
- package/dist/components/date-time-picker/time-picker.js +95 -87
- package/dist/components/date-time-picker/time-picker.js.map +1 -1
- package/dist/components/dialog/dialog.js +115 -95
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.js +144 -109
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +141 -112
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/field/field-combobox.js +196 -176
- package/dist/components/field/field-combobox.js.map +1 -1
- package/dist/components/field/field.js +137 -126
- package/dist/components/field/field.js.map +1 -1
- package/dist/components/list/list.js +237 -219
- package/dist/components/list/list.js.map +1 -1
- package/dist/components/option-card/option-card.js +129 -116
- package/dist/components/option-card/option-card.js.map +1 -1
- package/dist/components/pill/pill.js +55 -51
- package/dist/components/pill/pill.js.map +1 -1
- package/dist/components/popover/popover.js +53 -36
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/radio/radio.js +38 -34
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/scroll-area/scroll-area.js +38 -35
- package/dist/components/scroll-area/scroll-area.js.map +1 -1
- package/dist/components/scroll-overflow/scroll-overflow.js +166 -151
- package/dist/components/scroll-overflow/scroll-overflow.js.map +1 -1
- package/dist/components/segmented-control/segmented-control.js +93 -85
- package/dist/components/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/select/select.js +149 -128
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/separator/separator.js +19 -16
- package/dist/components/separator/separator.js.map +1 -1
- package/dist/components/skeleton/skeleton.js +34 -30
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/spinner/spinner.js +22 -17
- package/dist/components/spinner/spinner.js.map +1 -1
- package/dist/components/surface/surface.js +25 -22
- package/dist/components/surface/surface.js.map +1 -1
- package/dist/components/switch/switch.js +66 -57
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table-pagination.js +139 -129
- package/dist/components/table/table-pagination.js.map +1 -1
- package/dist/components/table/table.js +104 -90
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.js +206 -128
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/toast/toast.js +112 -100
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/toggle/toggle.js +32 -30
- package/dist/components/toggle/toggle.js.map +1 -1
- package/dist/components/tooltip/tooltip.js +59 -46
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/lib/clear-button.js +18 -17
- package/dist/lib/clear-button.js.map +1 -1
- package/dist/styles/host-reset.js +47 -0
- package/dist/styles/host-reset.js.map +1 -0
- package/dist/styles/overlay-layer.js +5 -0
- package/dist/styles/overlay-layer.js.map +1 -0
- package/dist/tokens.json +1 -1
- package/package.json +8 -6
- package/scripts/migration-diagnostics.mjs +42 -7
- package/scripts/migration-sweep.mjs +9 -1
|
@@ -1,62 +1,64 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
1
|
+
import { jsxs as Y, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
3
|
import { mergeClasses as m, SLOT_ATTR as c, shorthands as l } from "@epilot/zenith-runtime/v1";
|
|
4
|
-
import { makeZenithStyles as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
4
|
+
import { makeZenithStyles as lt } from "../../styles/make-styles.js";
|
|
5
|
+
import { boxModel as p, nativeControl as at } from "../../styles/host-reset.js";
|
|
6
|
+
import { leadingXs as ae, spacingElement2 as x, surfaceField as ie, spacingElement05 as We, info11 as st, warning11 as ct, error11 as dt, infoUi as ut, warningUi as ft, errorUi as Te, grayA12 as j, spacingElement3 as ne, grayA8 as le, grayA2 as Re, fontMono as Ie, accentA5 as ht, fontWeightNormal as gt, trackingNormal as mt, textXs as pt, grayA3 as $e, focusRing as vt, surfaceRadiusField as bt, borderField as yt, borderWidthField as kt } from "../../tokens/index.js";
|
|
7
|
+
import { Button as xt } from "../button/button.js";
|
|
8
|
+
import { applyIndent as St } from "./indent.js";
|
|
9
|
+
import { highlightCode as wt, splitTokenLines as Ct } from "../../lib/code-highlight.js";
|
|
10
|
+
import { useCodeTokenRenderer as zt } from "../../lib/code-tokens.js";
|
|
11
|
+
import { severityByLine as Wt, visibleDiagnostics as Rt, lineIndexAt as $t, caretAfterRewrite as Dt, gutterDigits as Tt } from "../../lib/code-lines.js";
|
|
12
|
+
const It = 2e3, se = "--zenith-code-gutter", De = {
|
|
12
13
|
...l.margin(0),
|
|
13
14
|
...l.borderWidth(0),
|
|
14
15
|
...l.borderStyle("none"),
|
|
15
|
-
...l.padding(
|
|
16
|
-
fontFamily:
|
|
17
|
-
fontSize:
|
|
18
|
-
lineHeight:
|
|
19
|
-
letterSpacing:
|
|
20
|
-
fontWeight:
|
|
16
|
+
...l.padding(x),
|
|
17
|
+
fontFamily: Ie,
|
|
18
|
+
fontSize: pt,
|
|
19
|
+
lineHeight: ae,
|
|
20
|
+
letterSpacing: mt,
|
|
21
|
+
fontWeight: gt,
|
|
21
22
|
textIndent: 0,
|
|
22
23
|
boxSizing: "border-box",
|
|
23
24
|
// A classic, space-consuming scrollbar narrows the textarea's content box but not the layer's,
|
|
24
25
|
// which moves where wrapped lines break. Reserving the gutter on both keeps one content width.
|
|
25
26
|
// Platforms with overlay scrollbars never had the problem.
|
|
26
27
|
scrollbarGutter: "stable"
|
|
27
|
-
},
|
|
28
|
-
error: { rule:
|
|
29
|
-
warning: { rule:
|
|
30
|
-
info: { rule:
|
|
31
|
-
},
|
|
28
|
+
}, k = {
|
|
29
|
+
error: { rule: Te, number: dt },
|
|
30
|
+
warning: { rule: ft, number: ct },
|
|
31
|
+
info: { rule: ut, number: st }
|
|
32
|
+
}, Mt = lt({
|
|
32
33
|
root: {
|
|
34
|
+
...p,
|
|
33
35
|
display: "flex",
|
|
34
36
|
flexDirection: "column",
|
|
35
37
|
minWidth: 0,
|
|
36
38
|
position: "relative",
|
|
37
|
-
backgroundColor:
|
|
38
|
-
...l.borderWidth(
|
|
39
|
+
backgroundColor: ie,
|
|
40
|
+
...l.borderWidth(kt),
|
|
39
41
|
...l.borderStyle("solid"),
|
|
40
|
-
...l.borderColor(
|
|
41
|
-
borderRadius:
|
|
42
|
+
...l.borderColor(yt),
|
|
43
|
+
borderRadius: bt,
|
|
42
44
|
// Declared before the state rules below so those win by source order, per AGENTS.md rule 2.
|
|
43
45
|
"&:focus-within": {
|
|
44
46
|
outlineWidth: "2px",
|
|
45
47
|
outlineStyle: "solid",
|
|
46
48
|
outlineOffset: "-1px",
|
|
47
|
-
outlineColor:
|
|
49
|
+
outlineColor: vt
|
|
48
50
|
},
|
|
49
51
|
"&[data-invalid]": {
|
|
50
|
-
...l.borderColor(
|
|
52
|
+
...l.borderColor(Te)
|
|
51
53
|
},
|
|
52
54
|
"&[data-disabled]": {
|
|
53
|
-
backgroundColor:
|
|
55
|
+
backgroundColor: $e
|
|
54
56
|
}
|
|
55
57
|
},
|
|
56
58
|
// Repaint the opaque gutter when the surrounding field is disabled.
|
|
57
59
|
rootDisabledGutter: {
|
|
58
60
|
[`&[data-disabled] [${c}='code-editor-line-number']`]: {
|
|
59
|
-
backgroundColor:
|
|
61
|
+
backgroundColor: $e
|
|
60
62
|
}
|
|
61
63
|
},
|
|
62
64
|
// focus-within would keep the overlay visible throughout the editing session.
|
|
@@ -65,7 +67,7 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
65
67
|
},
|
|
66
68
|
// The textarea defines the box; this decorative layer stretches without measurement.
|
|
67
69
|
highlight: {
|
|
68
|
-
|
|
70
|
+
...De,
|
|
69
71
|
position: "absolute",
|
|
70
72
|
top: 0,
|
|
71
73
|
right: 0,
|
|
@@ -76,7 +78,7 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
76
78
|
// Paint only: it must never take a click, a caret or a selection away from the control.
|
|
77
79
|
pointerEvents: "none",
|
|
78
80
|
userSelect: "none",
|
|
79
|
-
color:
|
|
81
|
+
color: j,
|
|
80
82
|
"&[data-composing]": {
|
|
81
83
|
// Provisional IME text lives in the textarea, so the layer would be showing stale colours
|
|
82
84
|
// over it. Declared after the base so it wins by source order.
|
|
@@ -85,30 +87,32 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
85
87
|
},
|
|
86
88
|
/** With a gutter, the left padding moves into the number cell so the cell can pin flush. */
|
|
87
89
|
highlightGutter: {
|
|
90
|
+
...p,
|
|
88
91
|
paddingLeft: 0
|
|
89
92
|
},
|
|
90
93
|
textarea: {
|
|
91
|
-
|
|
94
|
+
...at,
|
|
95
|
+
...De,
|
|
92
96
|
position: "relative",
|
|
93
97
|
width: "100%",
|
|
94
98
|
minWidth: 0,
|
|
95
99
|
backgroundColor: "transparent",
|
|
96
100
|
// The glyphs come from the layer beneath; only the caret is painted here.
|
|
97
101
|
color: "transparent",
|
|
98
|
-
caretColor:
|
|
102
|
+
caretColor: j,
|
|
99
103
|
overflowX: "auto",
|
|
100
104
|
overflowY: "auto",
|
|
101
105
|
// The root paints the ring for the whole surface; a second one on the control would double it.
|
|
102
106
|
outlineStyle: "none",
|
|
103
107
|
"::placeholder": {
|
|
104
|
-
color:
|
|
108
|
+
color: le,
|
|
105
109
|
// Placeholders are the textarea's own paint, so they need a real colour despite the above.
|
|
106
|
-
WebkitTextFillColor:
|
|
110
|
+
WebkitTextFillColor: le
|
|
107
111
|
},
|
|
108
112
|
"::selection": {
|
|
109
113
|
// An alpha tint, so highlighted glyphs stay legible through the selection band instead of
|
|
110
114
|
// being covered by it — transparent text under an opaque selection is invisible text.
|
|
111
|
-
backgroundColor:
|
|
115
|
+
backgroundColor: ht
|
|
112
116
|
},
|
|
113
117
|
":disabled": {
|
|
114
118
|
cursor: "not-allowed"
|
|
@@ -116,12 +120,13 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
116
120
|
"&[data-composing]": {
|
|
117
121
|
// Reveal what the IME is composing. Without this the author types blind through a CJK
|
|
118
122
|
// composition, which is the one way this technique can fail outright.
|
|
119
|
-
color:
|
|
123
|
+
color: j
|
|
120
124
|
}
|
|
121
125
|
},
|
|
122
126
|
// Keep textarea glyphs aligned with the highlighted rows.
|
|
123
127
|
textareaGutter: {
|
|
124
|
-
|
|
128
|
+
...p,
|
|
129
|
+
paddingLeft: `calc(${x} + var(${se}) + ${ne})`
|
|
125
130
|
},
|
|
126
131
|
// Unsupported browsers fall back to the native rows height.
|
|
127
132
|
autoSize: {
|
|
@@ -147,44 +152,53 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
147
152
|
whiteSpace: "pre-wrap",
|
|
148
153
|
overflowWrap: "break-word"
|
|
149
154
|
},
|
|
155
|
+
// The UA gives `<code>` its own monospace family and size, so the pre's metrics would not reach
|
|
156
|
+
// the rows without this.
|
|
157
|
+
code: {
|
|
158
|
+
fontFamily: Ie,
|
|
159
|
+
fontSize: "1em"
|
|
160
|
+
},
|
|
150
161
|
// Width constraints below require a block formatting context.
|
|
151
162
|
codeRows: {
|
|
152
163
|
display: "block"
|
|
153
164
|
},
|
|
154
165
|
// Give the sticky gutter and active-line band the full width of unwrapped code.
|
|
155
166
|
codeNoWrap: {
|
|
167
|
+
...p,
|
|
156
168
|
width: "max-content",
|
|
157
169
|
minWidth: "100%"
|
|
158
170
|
},
|
|
159
171
|
line: {
|
|
172
|
+
...p,
|
|
160
173
|
display: "flex",
|
|
161
174
|
width: "100%"
|
|
162
175
|
},
|
|
163
176
|
/** The band under the caret's line. See `caretLine` in the component for when it is on. */
|
|
164
177
|
lineActive: {
|
|
165
|
-
backgroundImage: `linear-gradient(${
|
|
178
|
+
backgroundImage: `linear-gradient(${Re}, ${Re})`
|
|
166
179
|
},
|
|
167
180
|
lineNumber: {
|
|
168
181
|
userSelect: "none",
|
|
169
182
|
textAlign: "right",
|
|
170
183
|
flexGrow: 0,
|
|
171
184
|
flexShrink: 0,
|
|
172
|
-
color:
|
|
185
|
+
color: le,
|
|
173
186
|
boxSizing: "border-box",
|
|
174
|
-
width: `calc(var(${
|
|
175
|
-
paddingLeft:
|
|
176
|
-
paddingRight:
|
|
187
|
+
width: `calc(var(${se}) + ${x} + ${ne})`,
|
|
188
|
+
paddingLeft: x,
|
|
189
|
+
paddingRight: ne,
|
|
177
190
|
// Pinned, so a long line scrolled sideways does not take the numbers with it. Opaque, because
|
|
178
191
|
// scrolled code passes underneath.
|
|
179
192
|
position: "sticky",
|
|
180
193
|
left: 0,
|
|
181
|
-
backgroundColor:
|
|
194
|
+
backgroundColor: ie
|
|
182
195
|
},
|
|
183
196
|
/** The caret's line number, lifted out of the gutter's grey. */
|
|
184
197
|
lineNumberActive: {
|
|
185
|
-
color:
|
|
198
|
+
color: j
|
|
186
199
|
},
|
|
187
200
|
lineContent: {
|
|
201
|
+
...p,
|
|
188
202
|
minWidth: 0,
|
|
189
203
|
flexGrow: 1,
|
|
190
204
|
flexShrink: 1,
|
|
@@ -197,33 +211,33 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
197
211
|
diagnosticError: {
|
|
198
212
|
textDecorationLine: "underline",
|
|
199
213
|
textDecorationStyle: "wavy",
|
|
200
|
-
textDecorationColor:
|
|
214
|
+
textDecorationColor: k.error.rule,
|
|
201
215
|
textDecorationSkipInk: "none",
|
|
202
216
|
textUnderlineOffset: "0.2em"
|
|
203
217
|
},
|
|
204
218
|
diagnosticWarning: {
|
|
205
219
|
textDecorationLine: "underline",
|
|
206
220
|
textDecorationStyle: "wavy",
|
|
207
|
-
textDecorationColor:
|
|
221
|
+
textDecorationColor: k.warning.rule,
|
|
208
222
|
textDecorationSkipInk: "none",
|
|
209
223
|
textUnderlineOffset: "0.2em"
|
|
210
224
|
},
|
|
211
225
|
diagnosticInfo: {
|
|
212
226
|
textDecorationLine: "underline",
|
|
213
227
|
textDecorationStyle: "wavy",
|
|
214
|
-
textDecorationColor:
|
|
228
|
+
textDecorationColor: k.info.rule,
|
|
215
229
|
textDecorationSkipInk: "none",
|
|
216
230
|
textUnderlineOffset: "0.2em"
|
|
217
231
|
},
|
|
218
|
-
numberError: { color:
|
|
219
|
-
numberWarning: { color:
|
|
220
|
-
numberInfo: { color:
|
|
232
|
+
numberError: { color: k.error.number },
|
|
233
|
+
numberWarning: { color: k.warning.number },
|
|
234
|
+
numberInfo: { color: k.info.number },
|
|
221
235
|
format: {
|
|
222
236
|
position: "absolute",
|
|
223
|
-
top:
|
|
224
|
-
right:
|
|
237
|
+
top: We,
|
|
238
|
+
right: We,
|
|
225
239
|
zIndex: 1,
|
|
226
|
-
backgroundColor:
|
|
240
|
+
backgroundColor: ie,
|
|
227
241
|
opacity: 0,
|
|
228
242
|
transitionProperty: "opacity",
|
|
229
243
|
transitionDuration: "120ms",
|
|
@@ -238,6 +252,7 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
238
252
|
"&[data-format-state='pending']": { opacity: 1 }
|
|
239
253
|
},
|
|
240
254
|
srOnly: {
|
|
255
|
+
...p,
|
|
241
256
|
position: "absolute",
|
|
242
257
|
width: "1px",
|
|
243
258
|
height: "1px",
|
|
@@ -248,7 +263,7 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
248
263
|
clip: "rect(0, 0, 0, 0)",
|
|
249
264
|
whiteSpace: "nowrap"
|
|
250
265
|
}
|
|
251
|
-
}),
|
|
266
|
+
}), Nt = (ce) => /* @__PURE__ */ Y(
|
|
252
267
|
"svg",
|
|
253
268
|
{
|
|
254
269
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -260,7 +275,7 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
260
275
|
strokeLinejoin: "round",
|
|
261
276
|
"aria-hidden": "true",
|
|
262
277
|
focusable: "false",
|
|
263
|
-
...
|
|
278
|
+
...ce,
|
|
264
279
|
children: [
|
|
265
280
|
/* @__PURE__ */ n("path", { d: "M4 5h16" }),
|
|
266
281
|
/* @__PURE__ */ n("path", { d: "M9 10h11" }),
|
|
@@ -268,262 +283,263 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
268
283
|
/* @__PURE__ */ n("path", { d: "M4 20h16" })
|
|
269
284
|
]
|
|
270
285
|
}
|
|
271
|
-
),
|
|
272
|
-
value:
|
|
273
|
-
defaultValue:
|
|
274
|
-
onValueChange:
|
|
275
|
-
onChange:
|
|
276
|
-
onKeyDown:
|
|
277
|
-
onBlur:
|
|
278
|
-
onFocus:
|
|
279
|
-
onSelect:
|
|
280
|
-
onScroll:
|
|
286
|
+
), jt = r.forwardRef(function({
|
|
287
|
+
value: de,
|
|
288
|
+
defaultValue: Me,
|
|
289
|
+
onValueChange: W,
|
|
290
|
+
onChange: R,
|
|
291
|
+
onKeyDown: $,
|
|
292
|
+
onBlur: D,
|
|
293
|
+
onFocus: T,
|
|
294
|
+
onSelect: I,
|
|
295
|
+
onScroll: M,
|
|
281
296
|
onCompositionStart: N,
|
|
282
|
-
onCompositionEnd:
|
|
283
|
-
language:
|
|
284
|
-
wrap:
|
|
285
|
-
resize:
|
|
286
|
-
indentWithTab:
|
|
287
|
-
indentSize:
|
|
288
|
-
invalid:
|
|
297
|
+
onCompositionEnd: A,
|
|
298
|
+
language: P,
|
|
299
|
+
wrap: E = !1,
|
|
300
|
+
resize: Ne,
|
|
301
|
+
indentWithTab: ue = !1,
|
|
302
|
+
indentSize: L = 2,
|
|
303
|
+
invalid: fe = !1,
|
|
289
304
|
readOnly: u = !1,
|
|
290
305
|
disabled: f = !1,
|
|
291
|
-
showLineNumbers:
|
|
292
|
-
diagnostics:
|
|
306
|
+
showLineNumbers: v = !1,
|
|
307
|
+
diagnostics: G,
|
|
293
308
|
onFormat: d,
|
|
294
309
|
onFormatError: h,
|
|
295
|
-
formatLabel:
|
|
296
|
-
formattedLabel:
|
|
297
|
-
formatErrorLabel:
|
|
298
|
-
autoSize:
|
|
299
|
-
maxRows:
|
|
300
|
-
rows:
|
|
301
|
-
className:
|
|
302
|
-
style:
|
|
303
|
-
spellCheck:
|
|
304
|
-
autoComplete:
|
|
305
|
-
autoCorrect:
|
|
306
|
-
autoCapitalize:
|
|
307
|
-
dir:
|
|
308
|
-
...
|
|
309
|
-
},
|
|
310
|
-
const
|
|
310
|
+
formatLabel: Ae = "Format code",
|
|
311
|
+
formattedLabel: he = "Formatted",
|
|
312
|
+
formatErrorLabel: F = "Formatting failed",
|
|
313
|
+
autoSize: Z = !1,
|
|
314
|
+
maxRows: ge,
|
|
315
|
+
rows: me,
|
|
316
|
+
className: Ee,
|
|
317
|
+
style: pe,
|
|
318
|
+
spellCheck: Le = !1,
|
|
319
|
+
autoComplete: Ge = "off",
|
|
320
|
+
autoCorrect: Ke = "off",
|
|
321
|
+
autoCapitalize: Ue = "off",
|
|
322
|
+
dir: Be = "ltr",
|
|
323
|
+
...q
|
|
324
|
+
}, S) {
|
|
325
|
+
const t = Mt(), ve = `${r.useId()}-diagnostics`, J = de !== void 0, [He, Oe] = r.useState(Me ?? ""), a = J ? de : He, be = zt(), ye = r.useRef(null), [ke, xe] = r.useState(!1), K = r.useRef(null), Xe = r.useCallback(
|
|
311
326
|
(e) => {
|
|
312
|
-
|
|
327
|
+
K.current = e, typeof S == "function" ? S(e) : S && (S.current = e);
|
|
313
328
|
},
|
|
314
|
-
[
|
|
315
|
-
),
|
|
329
|
+
[S]
|
|
330
|
+
), w = r.useRef(!1), b = r.useCallback(
|
|
316
331
|
(e) => {
|
|
317
|
-
|
|
332
|
+
J || Oe(e), W == null || W(e);
|
|
318
333
|
},
|
|
319
|
-
[
|
|
320
|
-
),
|
|
321
|
-
`).length, [a]),
|
|
322
|
-
() =>
|
|
323
|
-
[
|
|
324
|
-
),
|
|
325
|
-
() =>
|
|
326
|
-
[
|
|
327
|
-
), g =
|
|
334
|
+
[J, W]
|
|
335
|
+
), C = r.useMemo(() => a.split(`
|
|
336
|
+
`).length, [a]), Se = r.useMemo(
|
|
337
|
+
() => Wt(G, C),
|
|
338
|
+
[G, C]
|
|
339
|
+
), Q = r.useMemo(
|
|
340
|
+
() => Rt(G, C),
|
|
341
|
+
[G, C]
|
|
342
|
+
), g = v || Se.size > 0, [_e, V] = r.useState(null), U = r.useCallback(() => {
|
|
328
343
|
if (!g) return;
|
|
329
|
-
const e =
|
|
344
|
+
const e = K.current;
|
|
330
345
|
if (e !== null) {
|
|
331
346
|
if (e.selectionStart !== e.selectionEnd) {
|
|
332
|
-
|
|
347
|
+
V(null);
|
|
333
348
|
return;
|
|
334
349
|
}
|
|
335
|
-
|
|
350
|
+
V($t(e.value, e.selectionStart ?? 0));
|
|
336
351
|
}
|
|
337
|
-
}, [g]),
|
|
352
|
+
}, [g]), je = r.useCallback(
|
|
338
353
|
(e) => {
|
|
339
|
-
|
|
354
|
+
b(e.target.value), R == null || R(e);
|
|
340
355
|
},
|
|
341
|
-
[
|
|
342
|
-
),
|
|
356
|
+
[b, R]
|
|
357
|
+
), Ye = r.useCallback(
|
|
343
358
|
(e) => {
|
|
344
|
-
|
|
359
|
+
U(), I == null || I(e);
|
|
345
360
|
},
|
|
346
|
-
[
|
|
347
|
-
),
|
|
361
|
+
[I, U]
|
|
362
|
+
), Pe = r.useCallback(
|
|
348
363
|
(e) => {
|
|
349
|
-
|
|
364
|
+
U(), T == null || T(e);
|
|
350
365
|
},
|
|
351
|
-
[
|
|
352
|
-
),
|
|
353
|
-
|
|
366
|
+
[T, U]
|
|
367
|
+
), B = r.useRef(!1), [H, ee] = r.useState(!1), [Fe, we] = r.useState(""), y = r.useRef(null);
|
|
368
|
+
r.useEffect(
|
|
354
369
|
() => () => {
|
|
355
|
-
|
|
370
|
+
y.current !== null && clearTimeout(y.current);
|
|
356
371
|
},
|
|
357
372
|
[]
|
|
358
373
|
);
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
},
|
|
363
|
-
}, []),
|
|
374
|
+
const O = r.useCallback((e) => {
|
|
375
|
+
we(e), y.current !== null && clearTimeout(y.current), y.current = setTimeout(() => {
|
|
376
|
+
y.current = null, we("");
|
|
377
|
+
}, It);
|
|
378
|
+
}, []), te = r.useCallback(async () => {
|
|
364
379
|
if (d === void 0 || u || f) return;
|
|
365
|
-
const e =
|
|
366
|
-
if (e === null ||
|
|
380
|
+
const e = K.current;
|
|
381
|
+
if (e === null || B.current) return;
|
|
367
382
|
const o = e.value;
|
|
368
|
-
|
|
383
|
+
B.current = !0, ee(!0);
|
|
369
384
|
let i;
|
|
370
385
|
try {
|
|
371
386
|
i = await d(o);
|
|
372
|
-
} catch (
|
|
373
|
-
|
|
387
|
+
} catch (_) {
|
|
388
|
+
B.current = !1, ee(!1), O(F), h == null || h(_ ?? new Error("Formatting failed"));
|
|
374
389
|
return;
|
|
375
390
|
}
|
|
376
|
-
|
|
377
|
-
const s =
|
|
391
|
+
B.current = !1, ee(!1);
|
|
392
|
+
const s = K.current;
|
|
378
393
|
if (s !== null) {
|
|
379
394
|
if (s.value !== o) {
|
|
380
|
-
|
|
395
|
+
O(F), h == null || h(
|
|
381
396
|
new Error("Formatting discarded: the value changed while formatting")
|
|
382
397
|
);
|
|
383
398
|
return;
|
|
384
399
|
}
|
|
385
400
|
if (i !== o) {
|
|
386
|
-
const
|
|
387
|
-
s.value = i, s.setSelectionRange(
|
|
401
|
+
const _ = Dt(o, i, s.selectionStart ?? 0);
|
|
402
|
+
s.value = i, s.setSelectionRange(_, _), b(i);
|
|
388
403
|
}
|
|
389
|
-
|
|
404
|
+
O(he);
|
|
390
405
|
}
|
|
391
406
|
}, [
|
|
392
|
-
|
|
393
|
-
|
|
407
|
+
O,
|
|
408
|
+
b,
|
|
394
409
|
f,
|
|
395
|
-
|
|
396
|
-
|
|
410
|
+
F,
|
|
411
|
+
he,
|
|
397
412
|
d,
|
|
398
413
|
h,
|
|
399
414
|
u
|
|
400
|
-
]),
|
|
415
|
+
]), Ze = r.useCallback(
|
|
401
416
|
(e) => {
|
|
402
|
-
if (
|
|
417
|
+
if ($ == null || $(e), e.defaultPrevented || u || f) return;
|
|
403
418
|
if (d !== void 0 && e.altKey && e.shiftKey && !e.ctrlKey && !e.metaKey && (e.code === "KeyF" || e.key.toLowerCase() === "f")) {
|
|
404
|
-
e.preventDefault(),
|
|
419
|
+
e.preventDefault(), w.current = !1, te();
|
|
405
420
|
return;
|
|
406
421
|
}
|
|
407
|
-
if (!
|
|
422
|
+
if (!ue) return;
|
|
408
423
|
if (e.key === "Escape") {
|
|
409
|
-
|
|
424
|
+
w.current = !0;
|
|
410
425
|
return;
|
|
411
426
|
}
|
|
412
427
|
if (e.key !== "Tab") {
|
|
413
|
-
|
|
428
|
+
w.current = !1;
|
|
414
429
|
return;
|
|
415
430
|
}
|
|
416
|
-
if (
|
|
431
|
+
if (w.current || e.ctrlKey || e.metaKey || e.altKey)
|
|
417
432
|
return;
|
|
418
|
-
const o = e.currentTarget, i =
|
|
433
|
+
const o = e.currentTarget, i = St(
|
|
419
434
|
{
|
|
420
435
|
value: o.value,
|
|
421
436
|
selectionStart: o.selectionStart ?? 0,
|
|
422
437
|
selectionEnd: o.selectionEnd ?? 0
|
|
423
438
|
},
|
|
424
|
-
{ outdent: e.shiftKey, indentSize:
|
|
439
|
+
{ outdent: e.shiftKey, indentSize: L }
|
|
425
440
|
);
|
|
426
|
-
i.value === o.value && i.selectionStart === o.selectionStart && i.selectionEnd === o.selectionEnd || (e.preventDefault(), o.value = i.value, o.setSelectionRange(i.selectionStart, i.selectionEnd),
|
|
441
|
+
i.value === o.value && i.selectionStart === o.selectionStart && i.selectionEnd === o.selectionEnd || (e.preventDefault(), o.value = i.value, o.setSelectionRange(i.selectionStart, i.selectionEnd), b(i.value));
|
|
427
442
|
},
|
|
428
443
|
[
|
|
429
|
-
|
|
444
|
+
b,
|
|
430
445
|
f,
|
|
431
|
-
|
|
432
|
-
|
|
446
|
+
L,
|
|
447
|
+
ue,
|
|
433
448
|
d,
|
|
434
|
-
|
|
449
|
+
$,
|
|
435
450
|
u,
|
|
436
|
-
|
|
451
|
+
te
|
|
437
452
|
]
|
|
438
|
-
),
|
|
453
|
+
), qe = r.useCallback(
|
|
439
454
|
(e) => {
|
|
440
|
-
|
|
455
|
+
w.current = !1, V(null), D == null || D(e);
|
|
441
456
|
},
|
|
442
|
-
[
|
|
443
|
-
),
|
|
457
|
+
[D]
|
|
458
|
+
), Je = r.useCallback(
|
|
444
459
|
(e) => {
|
|
445
|
-
const o =
|
|
446
|
-
o !== null && (o.scrollTop = e.currentTarget.scrollTop, o.scrollLeft = e.currentTarget.scrollLeft),
|
|
460
|
+
const o = ye.current;
|
|
461
|
+
o !== null && (o.scrollTop = e.currentTarget.scrollTop, o.scrollLeft = e.currentTarget.scrollLeft), M == null || M(e);
|
|
447
462
|
},
|
|
448
|
-
[
|
|
449
|
-
),
|
|
463
|
+
[M]
|
|
464
|
+
), Qe = r.useCallback(
|
|
450
465
|
(e) => {
|
|
451
|
-
|
|
466
|
+
xe(!0), N == null || N(e);
|
|
452
467
|
},
|
|
453
468
|
[N]
|
|
454
|
-
),
|
|
469
|
+
), Ve = r.useCallback(
|
|
455
470
|
(e) => {
|
|
456
|
-
|
|
471
|
+
xe(!1), A == null || A(e);
|
|
457
472
|
},
|
|
458
|
-
[
|
|
459
|
-
),
|
|
460
|
-
`) ? `${a} ` : a,
|
|
461
|
-
() =>
|
|
462
|
-
[
|
|
463
|
-
),
|
|
473
|
+
[A]
|
|
474
|
+
), re = g ? a : a.endsWith(`
|
|
475
|
+
`) ? `${a} ` : a, z = r.useMemo(
|
|
476
|
+
() => wt(re, P),
|
|
477
|
+
[re, P]
|
|
478
|
+
), X = r.useMemo(
|
|
464
479
|
() => g ? a.split(`
|
|
465
480
|
`) : null,
|
|
466
481
|
[a, g]
|
|
467
|
-
),
|
|
468
|
-
() => g &&
|
|
469
|
-
[
|
|
470
|
-
),
|
|
471
|
-
minHeight: `calc(${
|
|
472
|
-
maxHeight:
|
|
473
|
-
} : void 0,
|
|
474
|
-
[
|
|
475
|
-
...
|
|
476
|
-
} :
|
|
477
|
-
error:
|
|
478
|
-
warning:
|
|
479
|
-
info:
|
|
480
|
-
},
|
|
481
|
-
error:
|
|
482
|
-
warning:
|
|
483
|
-
info:
|
|
482
|
+
), Ce = r.useMemo(
|
|
483
|
+
() => g && z !== null ? Ct(z) : null,
|
|
484
|
+
[z, g]
|
|
485
|
+
), ze = E ? t.wrap : t.noWrap, oe = Ne ?? (Z ? "none" : "vertical"), et = oe === "vertical" ? t.resizeVertical : oe === "horizontal" ? t.resizeHorizontal : oe === "both" ? t.resizeBoth : t.resizeNone, tt = Z ? {
|
|
486
|
+
minHeight: `calc(${me ?? 3} * ${ae} + ${x} * 2)`,
|
|
487
|
+
maxHeight: ge === void 0 ? void 0 : `calc(${ge} * ${ae} + ${x} * 2)`
|
|
488
|
+
} : void 0, rt = v ? {
|
|
489
|
+
[se]: `${Tt(C)}ch`,
|
|
490
|
+
...pe
|
|
491
|
+
} : pe, ot = Q.length === 0 ? q["aria-describedby"] : [q["aria-describedby"], ve].filter(Boolean).join(" "), it = {
|
|
492
|
+
error: t.diagnosticError,
|
|
493
|
+
warning: t.diagnosticWarning,
|
|
494
|
+
info: t.diagnosticInfo
|
|
495
|
+
}, nt = {
|
|
496
|
+
error: t.numberError,
|
|
497
|
+
warning: t.numberWarning,
|
|
498
|
+
info: t.numberInfo
|
|
484
499
|
};
|
|
485
|
-
return /* @__PURE__ */
|
|
500
|
+
return /* @__PURE__ */ Y(
|
|
486
501
|
"div",
|
|
487
502
|
{
|
|
488
503
|
"data-slot": "code-editor",
|
|
489
504
|
[c]: "code-editor",
|
|
490
|
-
"data-language":
|
|
491
|
-
"data-invalid":
|
|
505
|
+
"data-language": P,
|
|
506
|
+
"data-invalid": fe || void 0,
|
|
492
507
|
"data-disabled": f || void 0,
|
|
493
508
|
"data-readonly": u || void 0,
|
|
494
|
-
"data-formatting":
|
|
509
|
+
"data-formatting": H || void 0,
|
|
495
510
|
className: m(
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
d === void 0 ? void 0 :
|
|
499
|
-
|
|
511
|
+
t.root,
|
|
512
|
+
v ? t.rootDisabledGutter : void 0,
|
|
513
|
+
d === void 0 ? void 0 : t.rootFormatReveal,
|
|
514
|
+
Ee
|
|
500
515
|
),
|
|
501
|
-
style:
|
|
516
|
+
style: rt,
|
|
502
517
|
children: [
|
|
503
518
|
/* @__PURE__ */ n(
|
|
504
519
|
"pre",
|
|
505
520
|
{
|
|
506
|
-
ref:
|
|
521
|
+
ref: ye,
|
|
507
522
|
"aria-hidden": "true",
|
|
508
523
|
"data-slot": "code-editor-highlight",
|
|
509
524
|
[c]: "code-editor-highlight",
|
|
510
|
-
"data-composing":
|
|
525
|
+
"data-composing": ke || void 0,
|
|
511
526
|
className: m(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
527
|
+
t.highlight,
|
|
528
|
+
v ? t.highlightGutter : void 0,
|
|
529
|
+
ze
|
|
515
530
|
),
|
|
516
|
-
style: { tabSize:
|
|
531
|
+
style: { tabSize: L },
|
|
517
532
|
children: /* @__PURE__ */ n(
|
|
518
533
|
"code",
|
|
519
534
|
{
|
|
520
535
|
className: m(
|
|
521
|
-
|
|
522
|
-
|
|
536
|
+
t.code,
|
|
537
|
+
X === null ? void 0 : t.codeRows,
|
|
538
|
+
X !== null && !E ? t.codeNoWrap : void 0
|
|
523
539
|
),
|
|
524
|
-
children:
|
|
525
|
-
const i =
|
|
526
|
-
return /* @__PURE__ */
|
|
540
|
+
children: X === null ? z === null ? re : be(z) : X.map((e, o) => {
|
|
541
|
+
const i = Se.get(o + 1), s = _e === o;
|
|
542
|
+
return /* @__PURE__ */ Y(
|
|
527
543
|
"span",
|
|
528
544
|
{
|
|
529
545
|
"data-slot": "code-editor-line",
|
|
@@ -532,38 +548,38 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
532
548
|
"data-active": s || void 0,
|
|
533
549
|
"data-severity": i,
|
|
534
550
|
className: m(
|
|
535
|
-
|
|
536
|
-
s ?
|
|
551
|
+
t.line,
|
|
552
|
+
s ? t.lineActive : void 0
|
|
537
553
|
),
|
|
538
554
|
children: [
|
|
539
|
-
|
|
555
|
+
v ? /* @__PURE__ */ n(
|
|
540
556
|
"span",
|
|
541
557
|
{
|
|
542
558
|
"data-slot": "code-editor-line-number",
|
|
543
559
|
[c]: "code-editor-line-number",
|
|
544
560
|
className: m(
|
|
545
|
-
|
|
546
|
-
s ?
|
|
547
|
-
i === void 0 ? void 0 :
|
|
561
|
+
t.lineNumber,
|
|
562
|
+
s ? t.lineNumberActive : void 0,
|
|
563
|
+
i === void 0 ? void 0 : nt[i]
|
|
548
564
|
),
|
|
549
565
|
children: o + 1
|
|
550
566
|
}
|
|
551
567
|
) : null,
|
|
552
|
-
/* @__PURE__ */
|
|
568
|
+
/* @__PURE__ */ Y(
|
|
553
569
|
"span",
|
|
554
570
|
{
|
|
555
571
|
"data-slot": "code-editor-line-content",
|
|
556
572
|
[c]: "code-editor-line-content",
|
|
557
573
|
className: m(
|
|
558
|
-
|
|
559
|
-
|
|
574
|
+
t.lineContent,
|
|
575
|
+
E ? t.lineContentWrap : void 0
|
|
560
576
|
),
|
|
561
577
|
children: [
|
|
562
578
|
/* @__PURE__ */ n(
|
|
563
579
|
"span",
|
|
564
580
|
{
|
|
565
|
-
className: i === void 0 ? void 0 :
|
|
566
|
-
children:
|
|
581
|
+
className: i === void 0 ? void 0 : it[i],
|
|
582
|
+
children: Ce === null ? e : be(Ce[o] ?? [])
|
|
567
583
|
}
|
|
568
584
|
),
|
|
569
585
|
`
|
|
@@ -583,67 +599,67 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
583
599
|
/* @__PURE__ */ n(
|
|
584
600
|
"textarea",
|
|
585
601
|
{
|
|
586
|
-
...
|
|
587
|
-
ref:
|
|
602
|
+
...q,
|
|
603
|
+
ref: Xe,
|
|
588
604
|
"data-slot": "code-editor-input",
|
|
589
605
|
[c]: "code-editor-input",
|
|
590
606
|
value: a,
|
|
591
|
-
rows:
|
|
592
|
-
onChange:
|
|
593
|
-
onKeyDown:
|
|
594
|
-
onFocus:
|
|
595
|
-
onBlur:
|
|
596
|
-
onSelect:
|
|
597
|
-
onScroll:
|
|
598
|
-
onCompositionStart:
|
|
599
|
-
onCompositionEnd:
|
|
600
|
-
"data-composing":
|
|
607
|
+
rows: me,
|
|
608
|
+
onChange: je,
|
|
609
|
+
onKeyDown: Ze,
|
|
610
|
+
onFocus: Pe,
|
|
611
|
+
onBlur: qe,
|
|
612
|
+
onSelect: Ye,
|
|
613
|
+
onScroll: Je,
|
|
614
|
+
onCompositionStart: Qe,
|
|
615
|
+
onCompositionEnd: Ve,
|
|
616
|
+
"data-composing": ke || void 0,
|
|
601
617
|
readOnly: u,
|
|
602
618
|
disabled: f,
|
|
603
|
-
"aria-invalid":
|
|
604
|
-
"aria-describedby":
|
|
605
|
-
"aria-busy":
|
|
606
|
-
spellCheck:
|
|
607
|
-
autoComplete:
|
|
608
|
-
autoCorrect:
|
|
609
|
-
autoCapitalize:
|
|
610
|
-
dir:
|
|
611
|
-
wrap:
|
|
612
|
-
style: { tabSize:
|
|
619
|
+
"aria-invalid": fe || void 0,
|
|
620
|
+
"aria-describedby": ot,
|
|
621
|
+
"aria-busy": H || void 0,
|
|
622
|
+
spellCheck: Le,
|
|
623
|
+
autoComplete: Ge,
|
|
624
|
+
autoCorrect: Ke,
|
|
625
|
+
autoCapitalize: Ue,
|
|
626
|
+
dir: Be,
|
|
627
|
+
wrap: E ? "soft" : "off",
|
|
628
|
+
style: { tabSize: L, ...tt },
|
|
613
629
|
className: m(
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
630
|
+
t.textarea,
|
|
631
|
+
v ? t.textareaGutter : void 0,
|
|
632
|
+
Z ? t.autoSize : void 0,
|
|
633
|
+
ze,
|
|
634
|
+
et
|
|
619
635
|
)
|
|
620
636
|
}
|
|
621
637
|
),
|
|
622
638
|
d === void 0 ? null : /* @__PURE__ */ n(
|
|
623
|
-
|
|
639
|
+
xt,
|
|
624
640
|
{
|
|
625
641
|
type: "button",
|
|
626
642
|
variant: "ghost",
|
|
627
643
|
size: "icon-sm",
|
|
628
|
-
"data-format-state":
|
|
629
|
-
"aria-label":
|
|
630
|
-
disabled: f || u ||
|
|
631
|
-
className:
|
|
644
|
+
"data-format-state": H ? "pending" : "idle",
|
|
645
|
+
"aria-label": Ae,
|
|
646
|
+
disabled: f || u || H,
|
|
647
|
+
className: t.format,
|
|
632
648
|
onMouseDown: (e) => e.preventDefault(),
|
|
633
649
|
onClick: () => {
|
|
634
|
-
|
|
650
|
+
te();
|
|
635
651
|
},
|
|
636
|
-
children: /* @__PURE__ */ n(
|
|
652
|
+
children: /* @__PURE__ */ n(Nt, {})
|
|
637
653
|
}
|
|
638
654
|
),
|
|
639
|
-
|
|
655
|
+
Q.length === 0 ? null : /* @__PURE__ */ n(
|
|
640
656
|
"ul",
|
|
641
657
|
{
|
|
642
|
-
id:
|
|
658
|
+
id: ve,
|
|
643
659
|
"data-slot": "code-editor-diagnostics",
|
|
644
660
|
[c]: "code-editor-diagnostics",
|
|
645
|
-
className:
|
|
646
|
-
children:
|
|
661
|
+
className: t.srOnly,
|
|
662
|
+
children: Q.map((e, o) => /* @__PURE__ */ n("li", { children: `${e.severity ?? "error"}, line ${e.line}${e.column === void 0 ? "" : `, column ${e.column}`}: ${e.message}` }, o))
|
|
647
663
|
}
|
|
648
664
|
),
|
|
649
665
|
d === void 0 ? null : /* @__PURE__ */ n(
|
|
@@ -653,8 +669,8 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
653
669
|
"aria-live": "polite",
|
|
654
670
|
"data-slot": "code-editor-format-status",
|
|
655
671
|
[c]: "code-editor-format-status",
|
|
656
|
-
className:
|
|
657
|
-
children:
|
|
672
|
+
className: t.srOnly,
|
|
673
|
+
children: Fe
|
|
658
674
|
}
|
|
659
675
|
)
|
|
660
676
|
]
|
|
@@ -662,6 +678,6 @@ const Dt = 2e3, ae = "--zenith-code-gutter", $e = {
|
|
|
662
678
|
);
|
|
663
679
|
});
|
|
664
680
|
export {
|
|
665
|
-
|
|
681
|
+
jt as CodeEditor
|
|
666
682
|
};
|
|
667
683
|
//# sourceMappingURL=code-editor.js.map
|