@ac-design/design-system 2.3.0 → 2.4.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 (60) hide show
  1. package/dist/lib/compat.css +211 -0
  2. package/dist/lib/components/AcAppSwitcher.vue.d.ts +1 -1
  3. package/dist/lib/components/AcAppSwitcher.vue_vue_type_script_setup_true_lang.js +23 -23
  4. package/dist/lib/components/AcAreaChart.vue.d.ts +1 -1
  5. package/dist/lib/components/AcBarChart.vue.d.ts +1 -1
  6. package/dist/lib/components/AcButton.vue.d.ts +7 -1
  7. package/dist/lib/components/AcButton.vue_vue_type_script_setup_true_lang.js +90 -69
  8. package/dist/lib/components/AcCellValue.vue.d.ts +3 -3
  9. package/dist/lib/components/AcCellValue.vue_vue_type_script_setup_true_lang.js +20 -20
  10. package/dist/lib/components/AcCheckBox.vue.d.ts +4 -1
  11. package/dist/lib/components/AcCheckBox.vue_vue_type_script_setup_true_lang.js +50 -50
  12. package/dist/lib/components/AcCircularProgress.vue.d.ts +1 -1
  13. package/dist/lib/components/AcCodeEditor.vue.d.ts +12 -0
  14. package/dist/lib/components/AcCodeEditor.vue_vue_type_script_setup_true_lang.js +240 -207
  15. package/dist/lib/components/AcColorInput.vue.d.ts +3 -3
  16. package/dist/lib/components/AcColorInput.vue_vue_type_script_setup_true_lang.js +72 -66
  17. package/dist/lib/components/AcCostSummary.vue.d.ts +1 -1
  18. package/dist/lib/components/AcDatePicker.vue.d.ts +14 -7
  19. package/dist/lib/components/AcDatePicker.vue_vue_type_script_setup_true_lang.js +417 -372
  20. package/dist/lib/components/AcDeleteModal.vue.d.ts +1 -1
  21. package/dist/lib/components/AcDonutChart.vue.d.ts +2 -2
  22. package/dist/lib/components/AcDropdown.vue.d.ts +1 -1
  23. package/dist/lib/components/AcDropdown.vue_vue_type_script_setup_true_lang.js +8 -8
  24. package/dist/lib/components/AcFormFooter.vue_vue_type_script_setup_true_lang.js +8 -8
  25. package/dist/lib/components/AcGraphChart.vue.d.ts +2 -2
  26. package/dist/lib/components/AcInput.vue.d.ts +75 -54
  27. package/dist/lib/components/AcInput.vue_vue_type_script_setup_true_lang.js +253 -89
  28. package/dist/lib/components/AcKeyValueInput.vue.d.ts +34 -54
  29. package/dist/lib/components/AcKeyValueInput.vue_vue_type_script_setup_true_lang.js +134 -106
  30. package/dist/lib/components/AcLineChart.vue.d.ts +1 -1
  31. package/dist/lib/components/AcMapChart.vue.d.ts +2 -2
  32. package/dist/lib/components/AcModal.vue.d.ts +1 -1
  33. package/dist/lib/components/AcNotificationMenu.vue.d.ts +1 -1
  34. package/dist/lib/components/AcNotificationMenu.vue_vue_type_script_setup_true_lang.js +24 -24
  35. package/dist/lib/components/AcNumberInput.vue.d.ts +55 -45
  36. package/dist/lib/components/AcNumberInput.vue_vue_type_script_setup_true_lang.js +159 -99
  37. package/dist/lib/components/AcRadioCard.vue.d.ts +2 -2
  38. package/dist/lib/components/AcRadioCard.vue_vue_type_script_setup_true_lang.js +1 -1
  39. package/dist/lib/components/AcSelect.vue.d.ts +35 -6
  40. package/dist/lib/components/AcSelect.vue_vue_type_script_setup_true_lang.js +272 -176
  41. package/dist/lib/components/AcSidePanel.vue.d.ts +1 -1
  42. package/dist/lib/components/AcSlider.vue.d.ts +2 -2
  43. package/dist/lib/components/AcSwitch.vue_vue_type_script_setup_true_lang.js +23 -23
  44. package/dist/lib/components/AcTable.vue.d.ts +37 -4
  45. package/dist/lib/components/AcTable.vue_vue_type_script_setup_true_lang.js +239 -131
  46. package/dist/lib/components/AcTagInput.vue.d.ts +22 -3
  47. package/dist/lib/components/AcTagInput.vue_vue_type_script_setup_true_lang.js +126 -114
  48. package/dist/lib/components/AcTaintInput.js +5 -0
  49. package/dist/lib/components/AcTaintInput.vue.d.ts +44 -0
  50. package/dist/lib/components/AcTaintInput.vue_vue_type_script_setup_true_lang.js +208 -0
  51. package/dist/lib/components/AcTextarea.vue.d.ts +38 -4
  52. package/dist/lib/components/AcTextarea.vue_vue_type_script_setup_true_lang.js +113 -53
  53. package/dist/lib/components/AcTimePicker.vue.d.ts +15 -8
  54. package/dist/lib/components/AcTimePicker.vue_vue_type_script_setup_true_lang.js +102 -70
  55. package/dist/lib/components/AcTooltip.vue.d.ts +3 -3
  56. package/dist/lib/components/index.d.ts +1 -0
  57. package/dist/lib/composables/useToast.d.ts +2 -2
  58. package/dist/lib/index.d.ts +2 -1
  59. package/dist/lib/index.js +31 -30
  60. package/package.json +1 -1
@@ -2,35 +2,39 @@ import e from "./AcTooltip.js";
2
2
  import { copyText as t } from "../composables/copyText.js";
3
3
  import n from "./AcSegmentedControl.js";
4
4
  import { editorHighlight as r, editorPhrases as i, editorTheme as a } from "../editor/theme.js";
5
- import { Fragment as ee, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, mergeModels as f, nextTick as te, normalizeClass as p, normalizeStyle as ne, onBeforeUnmount as re, onMounted as ie, openBlock as m, ref as h, renderList as ae, renderSlot as oe, resolveDynamicComponent as se, shallowRef as ce, toDisplayString as g, unref as _, useId as le, useModel as ue, useSlots as de, vShow as fe, watch as v, withCtx as pe, withDirectives as me } from "vue";
6
- import { Check as he, CircleAlert as ge, Copy as _e, TriangleAlert as ve } from "@lucide/vue";
7
- import { closeBrackets as ye, closeBracketsKeymap as be } from "@codemirror/autocomplete";
8
- import { defaultKeymap as xe, history as Se, historyKeymap as Ce, indentWithTab as we, simplifySelection as Te, temporarilySetTabFocusMode as Ee } from "@codemirror/commands";
9
- import { json as De } from "@codemirror/lang-json";
10
- import { yaml as Oe } from "@codemirror/lang-yaml";
11
- import { StreamLanguage as ke, bracketMatching as Ae, foldGutter as je, foldKeymap as Me, indentOnInput as Ne, indentUnit as Pe } from "@codemirror/language";
12
- import { shell as Fe } from "@codemirror/legacy-modes/mode/shell";
13
- import { lintGutter as Ie, lintKeymap as Le, linter as Re } from "@codemirror/lint";
14
- import { highlightSelectionMatches as ze, search as Be, searchKeymap as Ve } from "@codemirror/search";
15
- import { Compartment as y, EditorState as b, Text as x } from "@codemirror/state";
16
- import { EditorView as S, drawSelection as He, dropCursor as Ue, highlightActiveLine as We, highlightActiveLineGutter as Ge, keymap as Ke, lineNumbers as C, placeholder as w } from "@codemirror/view";
5
+ import { Fragment as ee, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, defineComponent as d, mergeModels as f, nextTick as te, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as ne, onMounted as re, openBlock as h, ref as g, renderList as ie, renderSlot as ae, resolveDynamicComponent as oe, shallowRef as se, toDisplayString as _, unref as v, useId as ce, useModel as y, useSlots as le, vShow as ue, watch as b, withCtx as de, withDirectives as fe } from "vue";
6
+ import { Check as pe, CircleAlert as me, Copy as he, TriangleAlert as ge } from "@lucide/vue";
7
+ import { closeBrackets as _e, closeBracketsKeymap as ve } from "@codemirror/autocomplete";
8
+ import { defaultKeymap as ye, history as be, historyKeymap as xe, indentWithTab as Se, simplifySelection as Ce, temporarilySetTabFocusMode as we } from "@codemirror/commands";
9
+ import { json as Te } from "@codemirror/lang-json";
10
+ import { yaml as Ee } from "@codemirror/lang-yaml";
11
+ import { StreamLanguage as De, bracketMatching as Oe, foldGutter as ke, foldKeymap as Ae, indentOnInput as je, indentUnit as Me } from "@codemirror/language";
12
+ import { shell as Ne } from "@codemirror/legacy-modes/mode/shell";
13
+ import { lintGutter as Pe, lintKeymap as Fe, linter as Ie } from "@codemirror/lint";
14
+ import { highlightSelectionMatches as Le, search as Re, searchKeymap as ze } from "@codemirror/search";
15
+ import { Compartment as x, EditorState as S, Text as C } from "@codemirror/state";
16
+ import { EditorView as w, drawSelection as Be, dropCursor as Ve, highlightActiveLine as He, highlightActiveLineGutter as Ue, keymap as We, lineNumbers as Ge, placeholder as Ke } from "@codemirror/view";
17
17
  //#region src/lib/components/AcCodeEditor.vue?vue&type=script&setup=true&lang.ts
18
18
  var qe = {
19
19
  key: 0,
20
- class: "flex min-h-12 flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-border bg-surface-muted px-4 py-2"
20
+ class: "text-danger",
21
+ "aria-hidden": "true"
21
22
  }, Je = {
22
23
  key: 0,
23
- class: "min-w-0 truncate font-mono text-xs font-medium text-heading"
24
+ class: "flex min-h-12 flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-border bg-surface-muted px-4 py-2"
24
25
  }, Ye = {
26
+ key: 0,
27
+ class: "min-w-0 truncate font-mono text-xs font-medium text-heading"
28
+ }, Xe = {
25
29
  key: 1,
26
30
  class: "rounded-6 border border-border bg-surface px-1.5 text-xs leading-5 font-medium text-muted"
27
- }, Xe = {
31
+ }, Ze = {
28
32
  key: 2,
29
33
  class: "text-xs text-muted"
30
- }, Ze = { class: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-2" }, Qe = ["aria-label"], $e = ["id"], et = {
34
+ }, Qe = { class: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-2" }, $e = ["aria-label"], et = ["id"], tt = {
31
35
  class: "sr-only",
32
36
  "aria-live": "polite"
33
- }, tt = { class: "ac-scrollbar max-h-[calc(92px*var(--ac-scale))] py-1" }, nt = ["onClick"], rt = { class: "shrink-0 font-mono text-muted" }, it = { class: "min-w-0 [overflow-wrap:anywhere]" }, T = /*@__PURE__*/ d({
37
+ }, nt = { class: "ac-scrollbar max-h-[calc(92px*var(--ac-scale))] py-1" }, rt = ["onClick"], it = { class: "shrink-0 font-mono text-muted" }, at = { class: "min-w-0 [overflow-wrap:anywhere]" }, ot = /*@__PURE__*/ d({
34
38
  __name: "AcCodeEditor",
35
39
  props: /*@__PURE__*/ f({
36
40
  language: { default: "yaml" },
@@ -65,6 +69,19 @@ var qe = {
65
69
  bordered: {
66
70
  type: Boolean,
67
71
  default: !0
72
+ },
73
+ showLabel: {
74
+ type: Boolean,
75
+ default: !1
76
+ },
77
+ required: {
78
+ type: Boolean,
79
+ default: !1
80
+ },
81
+ errorMsg: { default: "" },
82
+ showProblems: {
83
+ type: Boolean,
84
+ default: !0
68
85
  }
69
86
  }, {
70
87
  modelValue: { default: "" },
@@ -77,188 +94,188 @@ var qe = {
77
94
  "focus",
78
95
  "blur"
79
96
  ], ["update:modelValue", "update:view"]),
80
- setup(d, { expose: f, emit: T }) {
81
- let E = d, D = ue(d, "modelValue"), O = ue(d, "view"), k = T, at = de(), ot, A = () => ot ??= import("@codemirror/merge"), st, ct = () => st ??= import("../editor/validate.js"), j = {
97
+ setup(d, { expose: f, emit: ot }) {
98
+ let T = d, E = y(d, "modelValue"), D = y(d, "view"), O = ot, st = le(), ct, k = () => ct ??= import("@codemirror/merge"), lt, ut = () => lt ??= import("../editor/validate.js"), dt = {
82
99
  yaml: "YAML",
83
100
  json: "JSON",
84
101
  shell: "Shell",
85
102
  text: "Text"
86
- }, M = {
103
+ }, ft = {
87
104
  margin: 3,
88
105
  minSize: 6
89
- }, lt = h(), N = h(), P = ce(), F, I = h([]), L = h(0), R = h(!1), ut = le(), z = o(() => E.original !== void 0 && !E.readonly), B = o(() => E.original !== void 0 && E.readonly), V = o(() => B.value || z.value && O.value === "changes"), dt = o(() => !!E.title || E.copyable || z.value || B.value || !!at.actions), ft = o(() => E.validate && (E.language === "yaml" || E.language === "json")), H = o(() => E.label || E.title || `${j[E.language]} editor`), pt = o(() => I.value.filter((e) => e.severity === "error").length), mt = o(() => [{
106
+ }, pt = g(), A = g(), j = se(), M, N = g([]), P = g(0), F = g(!1), I = ce(), mt = `${I}-label`, ht = `${I}-msg`, L = o(() => T.original !== void 0 && !T.readonly), R = o(() => T.original !== void 0 && T.readonly), z = o(() => R.value || L.value && D.value === "changes"), gt = o(() => !!T.title || T.copyable || L.value || R.value || !!st.actions), _t = o(() => T.validate && (T.language === "yaml" || T.language === "json")), B = o(() => T.label || T.title || `${dt[T.language]} editor`), V = o(() => T.showLabel && !!T.label || !!T.errorMsg), H = o(() => ["flex min-w-0 flex-col overflow-hidden bg-background", T.bordered && "rounded-10 border border-border transition-[border-color,box-shadow] duration-200 has-[.cm-editor.cm-focused]:focus-ring"]), U = o(() => N.value.filter((e) => e.severity === "error").length), vt = o(() => [{
90
107
  value: "edit",
91
108
  label: "Edit"
92
109
  }, {
93
110
  value: "changes",
94
- label: L.value ? `Changes · ${L.value}` : "Changes"
95
- }]), U = o(() => ({
96
- height: E.height === "auto" ? void 0 : E.height,
97
- maxHeight: E.maxHeight
111
+ label: P.value ? `Changes · ${P.value}` : "Changes"
112
+ }]), yt = o(() => ({
113
+ height: T.height === "auto" ? void 0 : T.height,
114
+ maxHeight: T.maxHeight
98
115
  })), W = {
99
- language: new y(),
100
- readonly: new y(),
101
- wrap: new y(),
102
- gutters: new y(),
103
- lint: new y(),
104
- placeholder: new y(),
105
- attributes: new y()
116
+ language: new x(),
117
+ readonly: new x(),
118
+ wrap: new x(),
119
+ gutters: new x(),
120
+ lint: new x(),
121
+ placeholder: new x(),
122
+ attributes: new x()
106
123
  };
107
124
  function G() {
108
- return E.language === "yaml" ? Oe() : E.language === "json" ? De() : E.language === "shell" ? ke.define(Fe) : [];
125
+ return T.language === "yaml" ? Ee() : T.language === "json" ? Te() : T.language === "shell" ? De.define(Ne) : [];
109
126
  }
110
- function ht() {
111
- return E.lineNumbers ? [
112
- C(),
113
- je({
127
+ function bt() {
128
+ return T.lineNumbers ? [
129
+ Ge(),
130
+ ke({
114
131
  openText: "▾",
115
132
  closedText: "▸"
116
133
  }),
117
- Ge()
134
+ Ue()
118
135
  ] : [];
119
136
  }
120
- function gt(e) {
121
- JSON.stringify(e) !== JSON.stringify(I.value) && (I.value = e, k("validate", e));
137
+ function xt(e) {
138
+ JSON.stringify(e) !== JSON.stringify(N.value) && (N.value = e, O("validate", e));
122
139
  }
123
- function _t() {
124
- return ft.value ? [Ie(), Re(async (e) => {
125
- let t = e.state.doc.toString(), { checkDocument: n, toProblems: r } = await ct(), i = await n(t, E.language, E.schema);
126
- return P.value?.state.doc.toString() === t && gt(r(i, e.state.doc)), i;
127
- }, { delay: 300 })] : (gt([]), []);
140
+ function St() {
141
+ return _t.value ? [Pe(), Ie(async (e) => {
142
+ let t = e.state.doc.toString(), { checkDocument: n, toProblems: r } = await ut(), i = await n(t, T.language, T.schema);
143
+ return j.value?.state.doc.toString() === t && xt(r(i, e.state.doc)), i;
144
+ }, { delay: 300 })] : (xt([]), []);
128
145
  }
129
- function vt() {
130
- return S.contentAttributes.of({
131
- "aria-label": H.value,
132
- ...E.readonly ? { "aria-readonly": "true" } : {},
133
- ...pt.value ? {
134
- "aria-invalid": "true",
135
- "aria-describedby": ut
136
- } : {}
146
+ function Ct() {
147
+ let e = [T.showProblems && U.value && I, T.errorMsg && ht].filter(Boolean).join(" ");
148
+ return w.contentAttributes.of({
149
+ "aria-label": B.value,
150
+ ...T.readonly ? { "aria-readonly": "true" } : {},
151
+ ...T.required ? { "aria-required": "true" } : {},
152
+ ...U.value || T.errorMsg ? { "aria-invalid": "true" } : {},
153
+ ...e ? { "aria-describedby": e } : {}
137
154
  });
138
155
  }
139
- let K = 0, yt = {
156
+ let K = 0, wt = {
140
157
  key: "Escape",
141
158
  run: (e) => {
142
159
  let t = Date.now();
143
- return t - K < 2e3 ? !1 : (K = t, Te(e), Ee(e));
160
+ return t - K < 2e3 ? !1 : (K = t, Ce(e), we(e));
144
161
  }
145
162
  };
146
- function bt() {
147
- P.value = new S({
148
- parent: lt.value,
149
- state: b.create({
150
- doc: D.value,
163
+ function Tt() {
164
+ j.value = new w({
165
+ parent: pt.value,
166
+ state: S.create({
167
+ doc: E.value,
151
168
  extensions: [
152
169
  a,
153
170
  r,
154
171
  i,
155
- Se(),
172
+ be(),
173
+ Be(),
174
+ Ve(),
175
+ je(),
176
+ Me.of(" "),
177
+ S.tabSize.of(2),
178
+ Oe(),
179
+ _e(),
156
180
  He(),
157
- Ue(),
158
- Ne(),
159
- Pe.of(" "),
160
- b.tabSize.of(2),
161
- Ae(),
162
- ye(),
163
- We(),
164
- ze(),
165
- Be({ top: !0 }),
166
- Ke.of([
167
- ...be,
168
- ...Ve,
169
- ...Me,
170
- ...Le,
171
- yt,
172
- we,
173
- ...Ce,
174
- ...xe
181
+ Le(),
182
+ Re({ top: !0 }),
183
+ We.of([
184
+ ...ve,
185
+ ...ze,
186
+ ...Ae,
187
+ ...Fe,
188
+ wt,
189
+ Se,
190
+ ...xe,
191
+ ...ye
175
192
  ]),
176
193
  W.language.of(G()),
177
- W.readonly.of(b.readOnly.of(E.readonly)),
178
- W.wrap.of(E.wrap ? S.lineWrapping : []),
179
- W.gutters.of(ht()),
180
- W.lint.of(_t()),
181
- W.placeholder.of(E.placeholder ? w(E.placeholder) : []),
182
- W.attributes.of(vt()),
183
- S.updateListener.of((e) => {
184
- e.docChanged && (D.value = e.state.doc.toString()), e.focusChanged && e.view.hasFocus ? k("focus") : e.focusChanged && k("blur");
194
+ W.readonly.of(S.readOnly.of(T.readonly)),
195
+ W.wrap.of(T.wrap ? w.lineWrapping : []),
196
+ W.gutters.of(bt()),
197
+ W.lint.of(St()),
198
+ W.placeholder.of(T.placeholder ? Ke(T.placeholder) : []),
199
+ W.attributes.of(Ct()),
200
+ w.updateListener.of((e) => {
201
+ e.docChanged && (E.value = e.state.doc.toString()), e.focusChanged && e.view.hasFocus ? O("focus") : e.focusChanged && O("blur");
185
202
  })
186
203
  ]
187
204
  })
188
205
  });
189
206
  }
190
207
  function q(e, t) {
191
- P.value?.dispatch({ effects: e.reconfigure(t) });
208
+ j.value?.dispatch({ effects: e.reconfigure(t) });
192
209
  }
193
210
  function J(e) {
194
211
  return [
195
212
  a,
196
213
  r,
197
214
  G(),
198
- b.readOnly.of(!0),
199
- b.tabSize.of(2),
200
- E.wrap ? S.lineWrapping : [],
201
- E.lineNumbers ? C() : [],
202
- S.contentAttributes.of({
215
+ S.readOnly.of(!0),
216
+ S.tabSize.of(2),
217
+ T.wrap ? w.lineWrapping : [],
218
+ T.lineNumbers ? Ge() : [],
219
+ w.contentAttributes.of({
203
220
  "aria-label": e,
204
221
  "aria-readonly": "true"
205
222
  })
206
223
  ];
207
224
  }
208
225
  function Y() {
209
- X++, F?.destroy(), F = void 0;
226
+ X++, M?.destroy(), M = void 0;
210
227
  }
211
228
  let X = 0;
212
229
  async function Z() {
213
- let e = ++X, { MergeView: t, unifiedMergeView: n } = await A();
214
- if (e !== X || !V.value || (Y(), !N.value)) return;
215
- let r = E.original ?? "";
216
- if (E.diffLayout === "split") {
217
- F = new t({
218
- parent: N.value,
230
+ let e = ++X, { MergeView: t, unifiedMergeView: n } = await k();
231
+ if (e !== X || !z.value || (Y(), !A.value)) return;
232
+ let r = T.original ?? "";
233
+ if (T.diffLayout === "split") {
234
+ M = new t({
235
+ parent: A.value,
219
236
  a: {
220
237
  doc: r,
221
- extensions: J(`Saved version of ${H.value}`)
238
+ extensions: J(`Saved version of ${B.value}`)
222
239
  },
223
240
  b: {
224
- doc: D.value,
225
- extensions: J(`Changed version of ${H.value}`)
241
+ doc: E.value,
242
+ extensions: J(`Changed version of ${B.value}`)
226
243
  },
227
244
  gutter: !0,
228
245
  highlightChanges: !0,
229
- collapseUnchanged: M
246
+ collapseUnchanged: ft
230
247
  });
231
248
  return;
232
249
  }
233
- F = new S({
234
- parent: N.value,
235
- doc: D.value,
236
- extensions: [J(`Changes to ${H.value}`), n({
250
+ M = new w({
251
+ parent: A.value,
252
+ doc: E.value,
253
+ extensions: [J(`Changes to ${B.value}`), n({
237
254
  original: r,
238
255
  mergeControls: !1,
239
256
  gutter: !0,
240
257
  highlightChanges: !0,
241
258
  syntaxHighlightDeletions: !0,
242
- collapseUnchanged: M
259
+ collapseUnchanged: ft
243
260
  })]
244
261
  });
245
262
  }
246
263
  let Q;
247
- function xt() {
248
- if (clearTimeout(Q), E.original === void 0) {
249
- L.value = 0;
264
+ function Et() {
265
+ if (clearTimeout(Q), T.original === void 0) {
266
+ P.value = 0;
250
267
  return;
251
268
  }
252
269
  Q = setTimeout(async () => {
253
- let { Chunk: e } = await A();
254
- E.original !== void 0 && (L.value = e.build(x.of(E.original.split("\n")), x.of(D.value.split("\n"))).length);
270
+ let { Chunk: e } = await k();
271
+ T.original !== void 0 && (P.value = e.build(C.of(T.original.split("\n")), C.of(E.value.split("\n"))).length);
255
272
  }, 250);
256
273
  }
257
- function St() {
258
- P.value?.focus();
274
+ function Dt() {
275
+ j.value?.focus();
259
276
  }
260
- function Ct(e) {
261
- let t = P.value;
277
+ function Ot(e) {
278
+ let t = j.value;
262
279
  t && (t.dispatch({
263
280
  selection: {
264
281
  anchor: e.from,
@@ -268,114 +285,130 @@ var qe = {
268
285
  }), t.focus());
269
286
  }
270
287
  let $;
271
- async function wt() {
288
+ async function kt() {
272
289
  try {
273
- await t(D.value), R.value = !0, clearTimeout($), $ = setTimeout(() => R.value = !1, 1500);
290
+ await t(E.value), F.value = !0, clearTimeout($), $ = setTimeout(() => F.value = !1, 1500);
274
291
  } catch {}
275
292
  }
276
- return v(D, (e) => {
277
- let t = P.value;
293
+ return b(E, (e) => {
294
+ let t = j.value;
278
295
  t && e !== t.state.doc.toString() && t.dispatch({ changes: {
279
296
  from: 0,
280
297
  to: t.state.doc.length,
281
298
  insert: e
282
299
  } });
283
- }), v(() => E.language, () => q(W.language, G())), v(() => E.readonly, (e) => q(W.readonly, b.readOnly.of(e))), v(() => E.wrap, (e) => q(W.wrap, e ? S.lineWrapping : [])), v(() => E.lineNumbers, () => q(W.gutters, ht())), v(() => E.placeholder, (e) => q(W.placeholder, e ? w(e) : [])), v([
284
- () => E.language,
285
- () => E.schema,
286
- () => E.validate
287
- ], () => q(W.lint, _t())), v([
288
- H,
289
- () => E.readonly,
290
- pt
291
- ], () => q(W.attributes, vt())), v([() => E.original, D], xt, { immediate: !0 }), v([
292
- V,
293
- () => E.diffLayout,
294
- () => E.original,
295
- () => E.language,
296
- () => E.wrap
300
+ }), b(() => T.language, () => q(W.language, G())), b(() => T.readonly, (e) => q(W.readonly, S.readOnly.of(e))), b(() => T.wrap, (e) => q(W.wrap, e ? w.lineWrapping : [])), b(() => T.lineNumbers, () => q(W.gutters, bt())), b(() => T.placeholder, (e) => q(W.placeholder, e ? Ke(e) : [])), b([
301
+ () => T.language,
302
+ () => T.schema,
303
+ () => T.validate
304
+ ], () => q(W.lint, St())), b([
305
+ B,
306
+ () => T.readonly,
307
+ U,
308
+ () => T.required,
309
+ () => T.errorMsg,
310
+ () => T.showProblems
311
+ ], () => q(W.attributes, Ct())), b([() => T.original, E], Et, { immediate: !0 }), b([
312
+ z,
313
+ () => T.diffLayout,
314
+ () => T.original,
315
+ () => T.language,
316
+ () => T.wrap
297
317
  ], async ([e]) => {
298
318
  if (!e) return Y();
299
319
  await te(), Z();
300
- }), v(D, () => V.value && Z()), ie(() => {
301
- bt(), V.value && Z();
302
- }), re(() => {
303
- clearTimeout(Q), clearTimeout($), Y(), P.value?.destroy();
320
+ }), b(E, () => z.value && Z()), re(() => {
321
+ Tt(), z.value && Z();
322
+ }), ne(() => {
323
+ clearTimeout(Q), clearTimeout($), Y(), j.value?.destroy();
304
324
  }), f({
305
- focus: St,
306
- editor: P
307
- }), (t, r) => (m(), l("div", {
308
- class: p(["flex min-w-0 flex-col overflow-hidden bg-background", d.bordered && "rounded-10 border border-border transition-[border-color,box-shadow] duration-200 has-[.cm-editor.cm-focused]:focus-ring"]),
325
+ focus: Dt,
326
+ editor: j
327
+ }), (t, r) => (h(), l("div", {
328
+ class: p(V.value ? "flex min-w-0 flex-col" : H.value),
309
329
  "data-ac-ds": "",
310
330
  "data-testid": "ac-code-editor"
311
331
  }, [
312
- dt.value ? (m(), l("div", qe, [
313
- d.title ? (m(), l("span", Je, g(d.title), 1)) : c("", !0),
314
- d.language === "text" ? c("", !0) : (m(), l("span", Ye, g(j[d.language]), 1)),
315
- B.value ? (m(), l("span", Xe, g(L.value ? `${L.value} ${L.value === 1 ? "change" : "changes"}` : "No changes"), 1)) : c("", !0),
316
- u("div", Ze, [
317
- oe(t.$slots, "actions"),
318
- z.value ? (m(), s(n, {
319
- key: 0,
320
- modelValue: O.value,
321
- "onUpdate:modelValue": r[0] ||= (e) => O.value = e,
322
- options: mt.value,
323
- size: "small",
324
- label: "Editor view"
325
- }, null, 8, ["modelValue", "options"])) : c("", !0),
326
- d.copyable ? (m(), s(e, {
327
- key: 1,
328
- content: R.value ? "Copied" : "Copy"
329
- }, {
330
- default: pe(() => [u("button", {
331
- type: "button",
332
- class: "inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-8 text-muted transition-colors duration-200 hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
333
- "aria-label": R.value ? "Copied" : "Copy to clipboard",
334
- onClick: wt
335
- }, [R.value ? (m(), s(_(he), {
332
+ V.value && d.showLabel && d.label ? (h(), l("div", {
333
+ key: 0,
334
+ id: mt,
335
+ class: "mb-2 flex items-center gap-1 text-base font-medium text-heading"
336
+ }, [u("span", null, _(d.label), 1), d.required ? (h(), l("span", qe, "*")) : c("", !0)])) : c("", !0),
337
+ u("div", { class: p(V.value ? H.value : "contents") }, [
338
+ gt.value ? (h(), l("div", Je, [
339
+ d.title ? (h(), l("span", Ye, _(d.title), 1)) : c("", !0),
340
+ d.language === "text" ? c("", !0) : (h(), l("span", Xe, _(dt[d.language]), 1)),
341
+ R.value ? (h(), l("span", Ze, _(P.value ? `${P.value} ${P.value === 1 ? "change" : "changes"}` : "No changes"), 1)) : c("", !0),
342
+ u("div", Qe, [
343
+ ae(t.$slots, "actions"),
344
+ L.value ? (h(), s(n, {
336
345
  key: 0,
337
- class: "size-4 text-success-strong",
338
- "aria-hidden": "true"
339
- })) : (m(), s(_(_e), {
346
+ modelValue: D.value,
347
+ "onUpdate:modelValue": r[0] ||= (e) => D.value = e,
348
+ options: vt.value,
349
+ size: "small",
350
+ label: "Editor view"
351
+ }, null, 8, ["modelValue", "options"])) : c("", !0),
352
+ d.copyable ? (h(), s(e, {
340
353
  key: 1,
341
- class: "size-4",
342
- "aria-hidden": "true"
343
- }))], 8, Qe)]),
344
- _: 1
345
- }, 8, ["content"])) : c("", !0)
346
- ])
347
- ])) : c("", !0),
348
- me(u("div", {
349
- ref_key: "host",
350
- ref: lt,
351
- class: p(["min-h-0 flex-auto [&>.cm-editor]:max-h-[inherit]", d.height === "auto" && "min-h-20"]),
352
- style: ne(U.value)
353
- }, null, 6), [[fe, !V.value]]),
354
- V.value ? (m(), l("div", {
354
+ content: F.value ? "Copied" : "Copy"
355
+ }, {
356
+ default: de(() => [u("button", {
357
+ type: "button",
358
+ class: "inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-8 text-muted transition-colors duration-200 hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
359
+ "aria-label": F.value ? "Copied" : "Copy to clipboard",
360
+ onClick: kt
361
+ }, [F.value ? (h(), s(v(pe), {
362
+ key: 0,
363
+ class: "size-4 text-success-strong",
364
+ "aria-hidden": "true"
365
+ })) : (h(), s(v(he), {
366
+ key: 1,
367
+ class: "size-4",
368
+ "aria-hidden": "true"
369
+ }))], 8, $e)]),
370
+ _: 1
371
+ }, 8, ["content"])) : c("", !0)
372
+ ])
373
+ ])) : c("", !0),
374
+ fe(u("div", {
375
+ ref_key: "host",
376
+ ref: pt,
377
+ class: p(["min-h-0 flex-auto [&>.cm-editor]:max-h-[inherit]", d.height === "auto" && "min-h-20"]),
378
+ style: m(yt.value)
379
+ }, null, 6), [[ue, !z.value]]),
380
+ z.value ? (h(), l("div", {
381
+ key: 1,
382
+ ref_key: "diffHost",
383
+ ref: A,
384
+ class: "min-h-0 flex-auto overflow-auto [&_.cm-mergeView]:h-full [&>.cm-editor]:max-h-[inherit]",
385
+ style: m(yt.value)
386
+ }, null, 4)) : c("", !0),
387
+ d.showProblems && N.value.length && !z.value ? (h(), l("div", {
388
+ key: 2,
389
+ id: v(I),
390
+ class: "border-t border-border bg-surface-muted"
391
+ }, [u("p", tt, _(N.value.length) + " " + _(N.value.length === 1 ? "problem" : "problems"), 1), u("ul", nt, [(h(!0), l(ee, null, ie(N.value, (e, t) => (h(), l("li", { key: t }, [u("button", {
392
+ type: "button",
393
+ class: "flex w-full cursor-pointer items-start gap-2 px-4 py-1 text-left text-xs leading-5 text-body transition-colors duration-200 hover:bg-accent-hover focus-visible:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset",
394
+ onClick: (t) => Ot(e)
395
+ }, [
396
+ (h(), s(oe(e.severity === "error" ? v(me) : v(ge)), {
397
+ class: p(["mt-0.75 size-3.5 shrink-0", e.severity === "error" ? "text-danger" : "text-warning"]),
398
+ "aria-hidden": "true"
399
+ }, null, 8, ["class"])),
400
+ u("span", it, "Ln " + _(e.line) + ", Col " + _(e.column), 1),
401
+ u("span", at, _(e.message), 1)
402
+ ], 8, rt)]))), 128))])], 8, et)) : c("", !0)
403
+ ], 2),
404
+ d.errorMsg ? (h(), l("p", {
355
405
  key: 1,
356
- ref_key: "diffHost",
357
- ref: N,
358
- class: "min-h-0 flex-auto overflow-auto [&_.cm-mergeView]:h-full [&>.cm-editor]:max-h-[inherit]",
359
- style: ne(U.value)
360
- }, null, 4)) : c("", !0),
361
- I.value.length && !V.value ? (m(), l("div", {
362
- key: 2,
363
- id: _(ut),
364
- class: "border-t border-border bg-surface-muted"
365
- }, [u("p", et, g(I.value.length) + " " + g(I.value.length === 1 ? "problem" : "problems"), 1), u("ul", tt, [(m(!0), l(ee, null, ae(I.value, (e, t) => (m(), l("li", { key: t }, [u("button", {
366
- type: "button",
367
- class: "flex w-full cursor-pointer items-start gap-2 px-4 py-1 text-left text-xs leading-5 text-body transition-colors duration-200 hover:bg-accent-hover focus-visible:bg-accent-hover focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-inset",
368
- onClick: (t) => Ct(e)
369
- }, [
370
- (m(), s(se(e.severity === "error" ? _(ge) : _(ve)), {
371
- class: p(["mt-0.75 size-3.5 shrink-0", e.severity === "error" ? "text-danger" : "text-warning"]),
372
- "aria-hidden": "true"
373
- }, null, 8, ["class"])),
374
- u("span", rt, "Ln " + g(e.line) + ", Col " + g(e.column), 1),
375
- u("span", it, g(e.message), 1)
376
- ], 8, nt)]))), 128))])], 8, $e)) : c("", !0)
406
+ id: ht,
407
+ class: "mt-2 text-xs text-danger-strong",
408
+ role: "alert"
409
+ }, _(d.errorMsg), 1)) : c("", !0)
377
410
  ], 2));
378
411
  }
379
412
  });
380
413
  //#endregion
381
- export { T as default };
414
+ export { ot as default };
@@ -21,8 +21,8 @@ export interface Props {
21
21
  errorMsg?: string;
22
22
  /** Help text between the label and the field. */
23
23
  hint?: string;
24
- /** `small` 36px or `normal` 42px tall. With `swatch-only`, a 40px or 48px swatch. */
25
- size?: "small" | "normal";
24
+ /** `small` 36px or `normal` 42px tall. With `swatch-only`, the swatch is `xs` 16px, `xsmall` 32px, `small` 40px, `normal` 48px or `large` 80px; without it, `xs` and `xsmall` look like `small` and `large` like `normal`. */
25
+ size?: "xs" | "xsmall" | "small" | "normal" | "large";
26
26
  /** Shows only the native colour swatch, with no hex field: cloud-ui's AcColorInput look. */
27
27
  swatchOnly?: boolean;
28
28
  }
@@ -46,7 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
46
46
  label: string;
47
47
  disabled: boolean;
48
48
  name: string;
49
- size: "small" | "normal";
49
+ size: "xs" | "xsmall" | "small" | "normal" | "large";
50
50
  hint: string;
51
51
  readonly: boolean;
52
52
  errorMsg: string;