@ac-design/design-system 1.0.0 → 1.0.2

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.
@@ -61,7 +61,6 @@ code:is([data-ac-ds], [data-ac-ds] *), kbd:is([data-ac-ds], [data-ac-ds] *), sam
61
61
  --color-primary-20: hsl(var(--primary-hue) var(--primary-saturation) 20%);
62
62
  --color-primary-30: hsl(var(--primary-hue) var(--primary-saturation) 30%);
63
63
  --color-primary-40: hsl(var(--primary-hue) var(--primary-saturation) 40%);
64
- --color-primary-60: hsl(var(--primary-hue) var(--primary-saturation) 60%);
65
64
  --color-primary-70: hsl(var(--primary-hue) var(--primary-saturation) 70%);
66
65
  --color-primary-80: hsl(var(--primary-hue) var(--primary-saturation) 80%);
67
66
  --color-primary-90: hsl(var(--primary-hue) var(--primary-saturation) 90%);
@@ -1476,6 +1475,12 @@ button:is([data-ac-ds], [data-ac-ds] *), input:where([type="button"], [type="res
1476
1475
  border-color: var(--color-primary) !important;
1477
1476
  box-shadow: 0 0 0 3px var(--color-ring) !important;
1478
1477
  }
1478
+ .border-\[color-mix\(in_srgb\,var\(--color-primary\)_38\%\,var\(--color-border\)\)\]:where([data-ac-ds], [data-ac-ds] *) {
1479
+ border-color: color-mix(in srgb,hsl(var(--primary-hue) var(--primary-saturation) var(--primary-light)) 38%,#e2e8f0) !important;
1480
+ @supports (color: color-mix(in lab, red, red)) {
1481
+ border-color: color-mix(in srgb,var(--color-primary) 38%,var(--color-border)) !important;
1482
+ }
1483
+ }
1479
1484
  .border-black\/10:where([data-ac-ds], [data-ac-ds] *) {
1480
1485
  border-color: color-mix(in srgb, hsl(0 0% 0%) 10%, transparent) !important;
1481
1486
  @supports (color: color-mix(in lab, red, red)) {
@@ -1530,9 +1535,6 @@ button:is([data-ac-ds], [data-ac-ds] *), input:where([type="button"], [type="res
1530
1535
  .border-primary:where([data-ac-ds], [data-ac-ds] *) {
1531
1536
  border-color: var(--color-primary) !important;
1532
1537
  }
1533
- .border-primary-70:where([data-ac-ds], [data-ac-ds] *) {
1534
- border-color: var(--color-primary-70) !important;
1535
- }
1536
1538
  .border-primary-80:where([data-ac-ds], [data-ac-ds] *) {
1537
1539
  border-color: var(--color-primary-80) !important;
1538
1540
  }
@@ -2934,12 +2936,17 @@ button:is([data-ac-ds], [data-ac-ds] *), input:where([type="button"], [type="res
2934
2936
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow) !important;
2935
2937
  }
2936
2938
  @media (hover: hover) {
2939
+ .hover\:border-\[color-mix\(in_srgb\,var\(--color-primary\)_60\%\,var\(--color-border\)\)\]:hover:where([data-ac-ds], [data-ac-ds] *) {
2940
+ border-color: color-mix(in srgb,hsl(var(--primary-hue) var(--primary-saturation) var(--primary-light)) 60%,#e2e8f0) !important;
2941
+ }
2942
+ @supports (color: color-mix(in lab, red, red)) {
2943
+ .hover\:border-\[color-mix\(in_srgb\,var\(--color-primary\)_60\%\,var\(--color-border\)\)\]:hover:where([data-ac-ds], [data-ac-ds] *) {
2944
+ border-color: color-mix(in srgb,var(--color-primary) 60%,var(--color-border)) !important;
2945
+ }
2946
+ }
2937
2947
  .hover\:border-border-dark:hover:where([data-ac-ds], [data-ac-ds] *) {
2938
2948
  border-color: var(--color-border-dark) !important;
2939
2949
  }
2940
- .hover\:border-primary-60:hover:where([data-ac-ds], [data-ac-ds] *) {
2941
- border-color: var(--color-primary-60) !important;
2942
- }
2943
2950
  .hover\:border-slate-60:hover:where([data-ac-ds], [data-ac-ds] *) {
2944
2951
  border-color: var(--color-slate-60) !important;
2945
2952
  }
@@ -33,7 +33,7 @@ var f = {
33
33
  primary: {
34
34
  solid: "bg-primary text-white border-black/15 shadow-button hover:bg-primary-hover",
35
35
  light: "bg-primary-95 text-primary-20 border-transparent hover:bg-primary-93",
36
- outlined: "bg-surface text-primary-20 border-primary-70 shadow-xs hover:bg-primary-97 hover:border-primary-60"
36
+ outlined: "bg-surface text-primary-20 border-[color-mix(in_srgb,var(--color-primary)_38%,var(--color-border))] shadow-xs hover:bg-primary-97 hover:border-[color-mix(in_srgb,var(--color-primary)_60%,var(--color-border))]"
37
37
  },
38
38
  info: {
39
39
  solid: "bg-info text-white border-black/15 shadow-button hover:bg-info-hover",
@@ -67,11 +67,11 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
67
67
  title: string;
68
68
  height: string;
69
69
  maxHeight: string;
70
+ readonly: boolean;
70
71
  wrap: boolean;
71
72
  schema: object;
72
73
  language: EditorLanguage;
73
74
  original: string;
74
- readonly: boolean;
75
75
  validate: boolean;
76
76
  lineNumbers: boolean;
77
77
  placeholder: string;
@@ -1,36 +1,38 @@
1
- import e from "./AcSegmentedControl.js";
2
- import { editorHighlight as t, editorPhrases as n, editorTheme as r } from "../editor/theme.js";
3
- import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, defineComponent as u, mergeModels as d, nextTick as ee, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as te, onMounted as ne, openBlock as m, ref as h, renderList as re, renderSlot as ie, resolveDynamicComponent as ae, shallowRef as oe, toDisplayString as g, unref as _, useId as se, useModel as ce, useSlots as le, vShow as ue, watch as v, withDirectives as de } from "vue";
4
- import { Check as fe, CircleAlert as pe, Copy as me, TriangleAlert as he } from "@lucide/vue";
5
- import { closeBrackets as ge, closeBracketsKeymap as _e } from "@codemirror/autocomplete";
6
- import { defaultKeymap as ve, history as ye, historyKeymap as be, indentWithTab as xe, simplifySelection as Se, temporarilySetTabFocusMode as Ce } from "@codemirror/commands";
7
- import { json as we } from "@codemirror/lang-json";
8
- import { yaml as Te } from "@codemirror/lang-yaml";
9
- import { StreamLanguage as Ee, bracketMatching as De, foldGutter as Oe, foldKeymap as ke, indentOnInput as Ae, indentUnit as je } from "@codemirror/language";
10
- import { shell as Me } from "@codemirror/legacy-modes/mode/shell";
11
- import { lintGutter as Ne, lintKeymap as Pe, linter as Fe } from "@codemirror/lint";
12
- import { highlightSelectionMatches as Ie, search as Le, searchKeymap as Re } from "@codemirror/search";
1
+ import e from "./AcTooltip.js";
2
+ import { copyText as t } from "../composables/copyText.js";
3
+ import n from "./AcSegmentedControl.js";
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";
13
15
  import { Compartment as y, EditorState as b, Text as x } from "@codemirror/state";
14
- import { EditorView as S, drawSelection as ze, dropCursor as Be, highlightActiveLine as Ve, highlightActiveLineGutter as He, keymap as Ue, lineNumbers as C, placeholder as w } from "@codemirror/view";
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";
15
17
  //#region src/lib/components/AcCodeEditor.vue?vue&type=script&setup=true&lang.ts
16
- var We = {
18
+ var qe = {
17
19
  key: 0,
18
20
  class: "flex min-h-11 flex-wrap items-center gap-x-3 gap-y-1.5 border-b border-border-light px-3 py-2"
19
- }, Ge = {
21
+ }, Je = {
20
22
  key: 0,
21
23
  class: "min-w-0 truncate font-mono text-xs font-medium text-heading"
22
- }, Ke = {
24
+ }, Ye = {
23
25
  key: 1,
24
26
  class: "rounded-4 bg-surface-sunken px-1.5 text-sm leading-5 font-medium text-muted"
25
- }, qe = {
27
+ }, Xe = {
26
28
  key: 2,
27
29
  class: "text-xs text-muted"
28
- }, Je = { class: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-2" }, Ye = ["aria-label", "title"], Xe = ["id"], Ze = {
30
+ }, Ze = { class: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-2" }, Qe = ["aria-label"], $e = ["id"], et = {
29
31
  class: "sr-only",
30
32
  "aria-live": "polite"
31
- }, Qe = { class: "ac-scrollbar max-h-[calc(92px*var(--ac-scale))] py-1" }, $e = ["onClick"], et = { class: "shrink-0 font-mono text-muted" }, tt = { class: "min-w-0 [overflow-wrap:anywhere]" }, T = /*@__PURE__*/ u({
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({
32
34
  __name: "AcCodeEditor",
33
- props: /*@__PURE__*/ d({
35
+ props: /*@__PURE__*/ f({
34
36
  language: { default: "yaml" },
35
37
  original: { default: void 0 },
36
38
  readonly: {
@@ -70,13 +72,13 @@ var We = {
70
72
  view: { default: "edit" },
71
73
  viewModifiers: {}
72
74
  }),
73
- emits: /*@__PURE__*/ d([
75
+ emits: /*@__PURE__*/ f([
74
76
  "validate",
75
77
  "focus",
76
78
  "blur"
77
79
  ], ["update:modelValue", "update:view"]),
78
- setup(u, { expose: d, emit: T }) {
79
- let E = u, D = ce(u, "modelValue"), O = ce(u, "view"), k = T, nt = le(), rt, A = () => rt ??= import("@codemirror/merge"), it, at = () => it ??= import("../editor/validate.js"), j = {
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 = {
80
82
  yaml: "YAML",
81
83
  json: "JSON",
82
84
  shell: "Shell",
@@ -84,16 +86,16 @@ var We = {
84
86
  }, M = {
85
87
  margin: 3,
86
88
  minSize: 6
87
- }, ot = h(), N = h(), P = oe(), F, I = h([]), L = h(0), R = h(!1), st = se(), z = a(() => E.original !== void 0 && !E.readonly), B = a(() => E.original !== void 0 && E.readonly), V = a(() => B.value || z.value && O.value === "changes"), ct = a(() => !!E.title || E.copyable || z.value || B.value || !!nt.actions), lt = a(() => E.validate && (E.language === "yaml" || E.language === "json")), H = a(() => E.label || E.title || `${j[E.language]} editor`), ut = a(() => I.value.filter((e) => e.severity === "error").length), dt = a(() => [{
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(() => [{
88
90
  value: "edit",
89
91
  label: "Edit"
90
92
  }, {
91
93
  value: "changes",
92
94
  label: L.value ? `Changes · ${L.value}` : "Changes"
93
- }]), ft = a(() => ({
95
+ }]), U = o(() => ({
94
96
  height: E.height === "auto" ? void 0 : E.height,
95
97
  maxHeight: E.maxHeight
96
- })), U = {
98
+ })), W = {
97
99
  language: new y(),
98
100
  readonly: new y(),
99
101
  wrap: new y(),
@@ -102,82 +104,82 @@ var We = {
102
104
  placeholder: new y(),
103
105
  attributes: new y()
104
106
  };
105
- function W() {
106
- return E.language === "yaml" ? Te() : E.language === "json" ? we() : E.language === "shell" ? Ee.define(Me) : [];
107
- }
108
107
  function G() {
108
+ return E.language === "yaml" ? Oe() : E.language === "json" ? De() : E.language === "shell" ? ke.define(Fe) : [];
109
+ }
110
+ function ht() {
109
111
  return E.lineNumbers ? [
110
112
  C(),
111
- Oe({
113
+ je({
112
114
  openText: "▾",
113
115
  closedText: "▸"
114
116
  }),
115
- He()
117
+ Ge()
116
118
  ] : [];
117
119
  }
118
- function pt(e) {
120
+ function gt(e) {
119
121
  JSON.stringify(e) !== JSON.stringify(I.value) && (I.value = e, k("validate", e));
120
122
  }
121
- function mt() {
122
- return lt.value ? [Ne(), Fe(async (e) => {
123
- let t = e.state.doc.toString(), { checkDocument: n, toProblems: r } = await at(), i = await n(t, E.language, E.schema);
124
- return P.value?.state.doc.toString() === t && pt(r(i, e.state.doc)), i;
125
- }, { delay: 300 })] : (pt([]), []);
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([]), []);
126
128
  }
127
- function ht() {
129
+ function vt() {
128
130
  return S.contentAttributes.of({
129
131
  "aria-label": H.value,
130
132
  ...E.readonly ? { "aria-readonly": "true" } : {},
131
- ...ut.value ? {
133
+ ...pt.value ? {
132
134
  "aria-invalid": "true",
133
- "aria-describedby": st
135
+ "aria-describedby": ut
134
136
  } : {}
135
137
  });
136
138
  }
137
- let K = 0, gt = {
139
+ let K = 0, yt = {
138
140
  key: "Escape",
139
141
  run: (e) => {
140
142
  let t = Date.now();
141
- return t - K < 2e3 ? !1 : (K = t, Se(e), Ce(e));
143
+ return t - K < 2e3 ? !1 : (K = t, Te(e), Ee(e));
142
144
  }
143
145
  };
144
- function _t() {
146
+ function bt() {
145
147
  P.value = new S({
146
- parent: ot.value,
148
+ parent: lt.value,
147
149
  state: b.create({
148
150
  doc: D.value,
149
151
  extensions: [
152
+ a,
150
153
  r,
151
- t,
152
- n,
154
+ i,
155
+ Se(),
156
+ He(),
157
+ Ue(),
158
+ Ne(),
159
+ Pe.of(" "),
160
+ b.tabSize.of(2),
161
+ Ae(),
153
162
  ye(),
163
+ We(),
154
164
  ze(),
155
- Be(),
156
- Ae(),
157
- je.of(" "),
158
- b.tabSize.of(2),
159
- De(),
160
- ge(),
161
- Ve(),
162
- Ie(),
163
- Le({ top: !0 }),
164
- Ue.of([
165
- ..._e,
166
- ...Re,
167
- ...ke,
168
- ...Pe,
169
- gt,
170
- xe,
165
+ Be({ top: !0 }),
166
+ Ke.of([
171
167
  ...be,
172
- ...ve
168
+ ...Ve,
169
+ ...Me,
170
+ ...Le,
171
+ yt,
172
+ we,
173
+ ...Ce,
174
+ ...xe
173
175
  ]),
174
- U.language.of(W()),
175
- U.readonly.of(b.readOnly.of(E.readonly)),
176
- U.wrap.of(E.wrap ? S.lineWrapping : []),
177
- U.gutters.of(G()),
178
- U.lint.of(mt()),
179
- U.placeholder.of(E.placeholder ? w(E.placeholder) : []),
180
- U.attributes.of(ht()),
176
+ 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()),
181
183
  S.updateListener.of((e) => {
182
184
  e.docChanged && (D.value = e.state.doc.toString()), e.focusChanged && e.view.hasFocus ? k("focus") : e.focusChanged && k("blur");
183
185
  })
@@ -190,9 +192,9 @@ var We = {
190
192
  }
191
193
  function J(e) {
192
194
  return [
195
+ a,
193
196
  r,
194
- t,
195
- W(),
197
+ G(),
196
198
  b.readOnly.of(!0),
197
199
  b.tabSize.of(2),
198
200
  E.wrap ? S.lineWrapping : [],
@@ -242,7 +244,7 @@ var We = {
242
244
  });
243
245
  }
244
246
  let Q;
245
- function vt() {
247
+ function xt() {
246
248
  if (clearTimeout(Q), E.original === void 0) {
247
249
  L.value = 0;
248
250
  return;
@@ -252,10 +254,10 @@ var We = {
252
254
  E.original !== void 0 && (L.value = e.build(x.of(E.original.split("\n")), x.of(D.value.split("\n"))).length);
253
255
  }, 250);
254
256
  }
255
- function yt() {
257
+ function St() {
256
258
  P.value?.focus();
257
259
  }
258
- function bt(e) {
260
+ function Ct(e) {
259
261
  let t = P.value;
260
262
  t && (t.dispatch({
261
263
  selection: {
@@ -266,9 +268,9 @@ var We = {
266
268
  }), t.focus());
267
269
  }
268
270
  let $;
269
- async function xt() {
271
+ async function wt() {
270
272
  try {
271
- await navigator.clipboard.writeText(D.value), R.value = !0, clearTimeout($), $ = setTimeout(() => R.value = !1, 1500);
273
+ await t(D.value), R.value = !0, clearTimeout($), $ = setTimeout(() => R.value = !1, 1500);
272
274
  } catch {}
273
275
  }
274
276
  return v(D, (e) => {
@@ -278,15 +280,15 @@ var We = {
278
280
  to: t.state.doc.length,
279
281
  insert: e
280
282
  } });
281
- }), v(() => E.language, () => q(U.language, W())), v(() => E.readonly, (e) => q(U.readonly, b.readOnly.of(e))), v(() => E.wrap, (e) => q(U.wrap, e ? S.lineWrapping : [])), v(() => E.lineNumbers, () => q(U.gutters, G())), v(() => E.placeholder, (e) => q(U.placeholder, e ? w(e) : [])), v([
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([
282
284
  () => E.language,
283
285
  () => E.schema,
284
286
  () => E.validate
285
- ], () => q(U.lint, mt())), v([
287
+ ], () => q(W.lint, _t())), v([
286
288
  H,
287
289
  () => E.readonly,
288
- ut
289
- ], () => q(U.attributes, ht())), v([() => E.original, D], vt, { immediate: !0 }), v([
290
+ pt
291
+ ], () => q(W.attributes, vt())), v([() => E.original, D], xt, { immediate: !0 }), v([
290
292
  V,
291
293
  () => E.diffLayout,
292
294
  () => E.original,
@@ -294,80 +296,84 @@ var We = {
294
296
  () => E.wrap
295
297
  ], async ([e]) => {
296
298
  if (!e) return Y();
297
- await ee(), Z();
298
- }), v(D, () => V.value && Z()), ne(() => {
299
- _t(), V.value && Z();
300
- }), te(() => {
299
+ await te(), Z();
300
+ }), v(D, () => V.value && Z()), ie(() => {
301
+ bt(), V.value && Z();
302
+ }), re(() => {
301
303
  clearTimeout(Q), clearTimeout($), Y(), P.value?.destroy();
302
- }), d({
303
- focus: yt,
304
+ }), f({
305
+ focus: St,
304
306
  editor: P
305
- }), (t, n) => (m(), c("div", {
306
- class: f(["flex min-w-0 flex-col overflow-hidden bg-surface", u.bordered && "rounded-10 border border-border shadow-xs transition-[border-color,box-shadow] has-[.cm-editor.cm-focused]:focus-ring"]),
307
+ }), (t, r) => (m(), l("div", {
308
+ class: p(["flex min-w-0 flex-col overflow-hidden bg-surface", d.bordered && "rounded-10 border border-border shadow-xs transition-[border-color,box-shadow] has-[.cm-editor.cm-focused]:focus-ring"]),
307
309
  "data-ac-ds": "",
308
310
  "data-testid": "ac-code-editor"
309
311
  }, [
310
- ct.value ? (m(), c("div", We, [
311
- u.title ? (m(), c("span", Ge, g(u.title), 1)) : s("", !0),
312
- u.language === "text" ? s("", !0) : (m(), c("span", Ke, g(j[u.language]), 1)),
313
- B.value ? (m(), c("span", qe, g(L.value ? `${L.value} ${L.value === 1 ? "change" : "changes"}` : "No changes"), 1)) : s("", !0),
314
- l("div", Je, [
315
- ie(t.$slots, "actions"),
316
- z.value ? (m(), o(e, {
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, {
317
319
  key: 0,
318
320
  modelValue: O.value,
319
- "onUpdate:modelValue": n[0] ||= (e) => O.value = e,
320
- options: dt.value,
321
+ "onUpdate:modelValue": r[0] ||= (e) => O.value = e,
322
+ options: mt.value,
321
323
  size: "small",
322
324
  label: "Editor view"
323
- }, null, 8, ["modelValue", "options"])) : s("", !0),
324
- u.copyable ? (m(), c("button", {
325
- key: 1,
326
- type: "button",
327
- class: "inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
328
- "aria-label": R.value ? "Copied" : "Copy to clipboard",
329
- title: R.value ? "Copied" : "Copy",
330
- onClick: xt
331
- }, [R.value ? (m(), o(_(fe), {
332
- key: 0,
333
- class: "size-3.5 text-success",
334
- "aria-hidden": "true"
335
- })) : (m(), o(_(me), {
325
+ }, null, 8, ["modelValue", "options"])) : c("", !0),
326
+ d.copyable ? (m(), s(e, {
336
327
  key: 1,
337
- class: "size-3.5",
338
- "aria-hidden": "true"
339
- }))], 8, Ye)) : s("", !0)
328
+ content: R.value ? "Copied" : "Copy"
329
+ }, {
330
+ default: pe(() => [u("button", {
331
+ type: "button",
332
+ class: "inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-6 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
333
+ "aria-label": R.value ? "Copied" : "Copy to clipboard",
334
+ onClick: wt
335
+ }, [R.value ? (m(), s(_(he), {
336
+ key: 0,
337
+ class: "size-3.5 text-success",
338
+ "aria-hidden": "true"
339
+ })) : (m(), s(_(_e), {
340
+ key: 1,
341
+ class: "size-3.5",
342
+ "aria-hidden": "true"
343
+ }))], 8, Qe)]),
344
+ _: 1
345
+ }, 8, ["content"])) : c("", !0)
340
346
  ])
341
- ])) : s("", !0),
342
- de(l("div", {
347
+ ])) : c("", !0),
348
+ me(u("div", {
343
349
  ref_key: "host",
344
- ref: ot,
345
- class: f(["min-h-0 flex-auto [&>.cm-editor]:max-h-[inherit]", u.height === "auto" && "min-h-20"]),
346
- style: p(ft.value)
347
- }, null, 6), [[ue, !V.value]]),
348
- V.value ? (m(), c("div", {
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", {
349
355
  key: 1,
350
356
  ref_key: "diffHost",
351
357
  ref: N,
352
358
  class: "min-h-0 flex-auto overflow-auto [&_.cm-mergeView]:h-full [&>.cm-editor]:max-h-[inherit]",
353
- style: p(ft.value)
354
- }, null, 4)) : s("", !0),
355
- I.value.length && !V.value ? (m(), c("div", {
359
+ style: ne(U.value)
360
+ }, null, 4)) : c("", !0),
361
+ I.value.length && !V.value ? (m(), l("div", {
356
362
  key: 2,
357
- id: _(st),
363
+ id: _(ut),
358
364
  class: "border-t border-border-light bg-surface-muted"
359
- }, [l("p", Ze, g(I.value.length) + " " + g(I.value.length === 1 ? "problem" : "problems"), 1), l("ul", Qe, [(m(!0), c(i, null, re(I.value, (e, t) => (m(), c("li", { key: t }, [l("button", {
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", {
360
366
  type: "button",
361
367
  class: "flex w-full cursor-pointer items-start gap-2 px-3 py-1 text-left text-xs leading-5 text-body hover:bg-surface-sunken focus-visible:bg-surface-sunken focus-visible:outline-none",
362
- onClick: (t) => bt(e)
368
+ onClick: (t) => Ct(e)
363
369
  }, [
364
- (m(), o(ae(e.severity === "error" ? _(pe) : _(he)), {
365
- class: f(["mt-0.75 size-3.5 shrink-0", e.severity === "error" ? "text-red-50" : "text-yellow-50"]),
370
+ (m(), s(se(e.severity === "error" ? _(ge) : _(ve)), {
371
+ class: p(["mt-0.75 size-3.5 shrink-0", e.severity === "error" ? "text-red-50" : "text-yellow-50"]),
366
372
  "aria-hidden": "true"
367
373
  }, null, 8, ["class"])),
368
- l("span", et, "Ln " + g(e.line) + ", Col " + g(e.column), 1),
369
- l("span", tt, g(e.message), 1)
370
- ], 8, $e)]))), 128))])], 8, Xe)) : s("", !0)
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)
371
377
  ], 2));
372
378
  }
373
379
  });
@@ -11,7 +11,7 @@ var o = /*@__PURE__*/ n({
11
11
  class: r(n.surface && "rounded-10 border border-border bg-surface shadow-xs"),
12
12
  "data-ac-ds": "",
13
13
  "data-testid": "ac-content-layout"
14
- }, [a(o.$slots, "header"), t("div", null, [a(o.$slots, "default")])], 2));
14
+ }, [a(o.$slots, "header"), t("div", { class: r(n.surface && ["overflow-hidden rounded-b-10", !o.$slots.header && "rounded-t-10"]) }, [a(o.$slots, "default")], 2)], 2));
15
15
  }
16
16
  });
17
17
  //#endregion
@@ -1,27 +1,25 @@
1
- import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, normalizeClass as c, onBeforeUnmount as l, openBlock as u, ref as d, renderList as f, renderSlot as p, resolveDynamicComponent as m, toDisplayString as h, unref as g } from "vue";
2
- import { Check as _, Copy as v, Eye as y, EyeOff as b } from "@lucide/vue";
1
+ import e from "./AcTooltip.js";
2
+ import { copyText as t } from "../composables/copyText.js";
3
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineComponent as l, normalizeClass as u, onBeforeUnmount as d, openBlock as f, ref as p, renderList as m, renderSlot as h, resolveDynamicComponent as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
4
+ import { Check as b, Copy as x, Eye as S, EyeOff as C } from "@lucide/vue";
3
5
  //#region src/lib/components/AcInfoTable.vue?vue&type=script&setup=true&lang.ts
4
- var x = {
6
+ var w = {
5
7
  key: 0,
6
8
  class: "text-lg leading-6 font-semibold tracking-[-0.01em] text-heading"
7
- }, S = {
9
+ }, T = {
8
10
  key: 1,
9
11
  class: "ml-auto flex shrink-0 items-center gap-2"
10
- }, C = ["aria-busy"], w = { class: "flex h-5 items-center" }, T = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-base text-heading" }, E = {
12
+ }, E = ["aria-busy"], D = { class: "flex h-5 items-center" }, O = { class: "flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-1 text-base text-heading" }, k = {
11
13
  key: 0,
12
14
  class: "text-muted"
13
- }, D = {
15
+ }, A = {
14
16
  key: 1,
15
17
  class: "flex min-w-0 items-start gap-1.5"
16
- }, O = [
18
+ }, j = [
17
19
  "aria-label",
18
20
  "aria-pressed",
19
21
  "onClick"
20
- ], k = [
21
- "aria-label",
22
- "title",
23
- "onClick"
24
- ], A = /*@__PURE__*/ s({
22
+ ], M = ["aria-label", "onClick"], N = /*@__PURE__*/ l({
25
23
  __name: "AcInfoTable",
26
24
  props: {
27
25
  items: { default: () => [] },
@@ -38,88 +36,92 @@ var x = {
38
36
  },
39
37
  emptyText: { default: "No details available" }
40
38
  },
41
- setup(s) {
42
- let A = s, j = [
39
+ setup(l) {
40
+ let N = l, P = [
43
41
  "w-40",
44
42
  "w-28",
45
43
  "w-52",
46
44
  "w-32",
47
45
  "w-44",
48
46
  "w-24"
49
- ], M = d(null), N = d(/* @__PURE__ */ new Set()), P, F = t(() => A.items.map((e) => ({
47
+ ], F = p(null), I = p(/* @__PURE__ */ new Set()), L, R = r(() => N.items.map((e) => ({
50
48
  item: e,
51
49
  key: e.key ?? e.label
52
- }))), I = t(() => [
50
+ }))), z = r(() => [
53
51
  "min-w-0 border-t border-border-light py-2.5 first:border-t-0",
54
- A.columns === 2 && "md:[&:nth-child(2)]:border-t-0",
55
- A.layout === "horizontal" ? "flex flex-col gap-0.5 sm:flex-row sm:items-baseline sm:gap-4" : "flex flex-col gap-1"
56
- ]), L = t(() => ["flex items-center gap-1.5 text-base text-muted", A.layout === "horizontal" && (A.columns === 2 ? "sm:w-36 sm:shrink-0" : "sm:w-48 sm:shrink-0")]);
57
- function R(e) {
52
+ N.columns === 2 && "md:[&:nth-child(2)]:border-t-0",
53
+ N.layout === "horizontal" ? "flex flex-col gap-0.5 sm:flex-row sm:items-baseline sm:gap-4" : "flex flex-col gap-1"
54
+ ]), B = r(() => ["flex items-center gap-1.5 text-base text-muted", N.layout === "horizontal" && (N.columns === 2 ? "sm:w-36 sm:shrink-0" : "sm:w-48 sm:shrink-0")]);
55
+ function V(e) {
58
56
  return e == null || e === "";
59
57
  }
60
- function z(e) {
61
- let t = new Set(N.value);
62
- t.delete(e) || t.add(e), N.value = t;
58
+ function H(e) {
59
+ let t = new Set(I.value);
60
+ t.delete(e) || t.add(e), I.value = t;
63
61
  }
64
- async function B(e, t) {
62
+ async function U(e, n) {
65
63
  try {
66
- await navigator.clipboard.writeText(String(t ?? "")), M.value = e, clearTimeout(P), P = setTimeout(() => M.value = null, 1500);
64
+ await t(String(n ?? "")), F.value = e, clearTimeout(L), L = setTimeout(() => F.value = null, 1500);
67
65
  } catch {}
68
66
  }
69
- return l(() => clearTimeout(P)), (t, l) => (u(), i("div", {
70
- class: c(s.bordered && "rounded-10 border border-border bg-surface shadow-xs"),
67
+ return d(() => clearTimeout(L)), (t, r) => (f(), o("div", {
68
+ class: u(l.bordered && "rounded-10 border border-border bg-surface shadow-xs"),
71
69
  "data-ac-ds": "",
72
70
  "data-testid": "ac-info-table"
73
- }, [s.title || t.$slots.actions ? (u(), i("div", {
71
+ }, [l.title || t.$slots.actions ? (f(), o("div", {
74
72
  key: 0,
75
- class: c(["flex items-center justify-between gap-4", s.bordered ? "border-b border-border-light px-5 py-3.5" : "mb-2"])
76
- }, [s.title ? (u(), i("h3", x, h(s.title), 1)) : r("", !0), t.$slots.actions ? (u(), i("div", S, [p(t.$slots, "actions")])) : r("", !0)], 2)) : r("", !0), !s.loading && !s.items.length ? (u(), i("p", {
73
+ class: u(["flex items-center justify-between gap-4", l.bordered ? "border-b border-border-light px-5 py-3.5" : "mb-2"])
74
+ }, [l.title ? (f(), o("h3", w, _(l.title), 1)) : a("", !0), t.$slots.actions ? (f(), o("div", T, [h(t.$slots, "actions")])) : a("", !0)], 2)) : a("", !0), !l.loading && !l.items.length ? (f(), o("p", {
77
75
  key: 1,
78
- class: c(["py-6 text-center text-base text-muted", s.bordered && "px-5"])
79
- }, h(s.emptyText), 3)) : (u(), i("dl", {
76
+ class: u(["py-6 text-center text-base text-muted", l.bordered && "px-5"])
77
+ }, _(l.emptyText), 3)) : (f(), o("dl", {
80
78
  key: 2,
81
- class: c(["grid", [s.columns === 2 && "md:grid-cols-2 md:gap-x-10", s.bordered ? "px-5 py-2" : ""]]),
82
- "aria-busy": s.loading || void 0
83
- }, [s.loading && !s.items.length ? (u(), i(e, { key: 0 }, f(j, (e, t) => a("div", {
79
+ class: u(["grid", [l.columns === 2 && "md:grid-cols-2 md:gap-x-10", l.bordered ? "px-5 py-2" : ""]]),
80
+ "aria-busy": l.loading || void 0
81
+ }, [l.loading && !l.items.length ? (f(), o(n, { key: 0 }, m(P, (e, t) => s("div", {
84
82
  key: t,
85
- class: c(I.value)
86
- }, [a("dt", { class: c(L.value) }, [...l[0] ||= [a("span", { class: "h-3 w-20 animate-pulse rounded-4 bg-surface-sunken" }, null, -1)]], 2), a("dd", w, [a("span", { class: c(["h-3 animate-pulse rounded-4 bg-surface-sunken", e]) }, null, 2)])], 2)), 64)) : r("", !0), (u(!0), i(e, null, f(F.value, ({ item: e, key: l }, d) => (u(), i("div", {
87
- key: l,
88
- class: c(I.value)
89
- }, [a("dt", { class: c(L.value) }, [p(t.$slots, `label-${l}`, { item: e }, () => [o(h(e.label), 1)])], 2), a("dd", T, [s.loading ? (u(), i("span", {
83
+ class: u(z.value)
84
+ }, [s("dt", { class: u(B.value) }, [...r[0] ||= [s("span", { class: "h-3 w-20 animate-pulse rounded-4 bg-surface-sunken" }, null, -1)]], 2), s("dd", D, [s("span", { class: u(["h-3 animate-pulse rounded-4 bg-surface-sunken", e]) }, null, 2)])], 2)), 64)) : a("", !0), (f(!0), o(n, null, m(R.value, ({ item: n, key: r }, d) => (f(), o("div", {
85
+ key: r,
86
+ class: u(z.value)
87
+ }, [s("dt", { class: u(B.value) }, [h(t.$slots, `label-${r}`, { item: n }, () => [c(_(n.label), 1)])], 2), s("dd", O, [l.loading ? (f(), o("span", {
90
88
  key: 0,
91
- class: c(["h-3 animate-pulse rounded-4 bg-surface-sunken", j[d % j.length]])
92
- }, null, 2)) : p(t.$slots, `value-${l}`, { item: e }, () => [R(e.value) ? (u(), i("span", E, "—")) : (u(), i("span", D, [
93
- a("span", { class: c(["min-w-0 [overflow-wrap:anywhere]", (e.mono || e.secret) && "font-mono text-xs leading-5"]) }, h(e.secret && !N.value.has(l) ? "••••••••••••" : e.value), 3),
94
- e.secret ? (u(), i("button", {
89
+ class: u(["h-3 animate-pulse rounded-4 bg-surface-sunken", P[d % P.length]])
90
+ }, null, 2)) : h(t.$slots, `value-${r}`, { item: n }, () => [V(n.value) ? (f(), o("span", k, "—")) : (f(), o("span", A, [
91
+ s("span", { class: u(["min-w-0 [overflow-wrap:anywhere]", (n.mono || n.secret) && "font-mono text-xs leading-5"]) }, _(n.secret && !I.value.has(r) ? "••••••••••••" : n.value), 3),
92
+ n.secret ? (f(), o("button", {
95
93
  key: 0,
96
94
  type: "button",
97
95
  class: "-my-0.5 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-4 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
98
- "aria-label": N.value.has(l) ? `Hide ${e.label}` : `Show ${e.label}`,
99
- "aria-pressed": N.value.has(l),
100
- onClick: (e) => z(l)
101
- }, [(u(), n(m(N.value.has(l) ? g(b) : g(y)), {
96
+ "aria-label": I.value.has(r) ? `Hide ${n.label}` : `Show ${n.label}`,
97
+ "aria-pressed": I.value.has(r),
98
+ onClick: (e) => H(r)
99
+ }, [(f(), i(g(I.value.has(r) ? v(C) : v(S)), {
102
100
  class: "size-3.5",
103
101
  "aria-hidden": "true"
104
- }))], 8, O)) : r("", !0),
105
- e.copyable ? (u(), i("button", {
102
+ }))], 8, j)) : a("", !0),
103
+ n.copyable ? (f(), i(e, {
106
104
  key: 1,
107
- type: "button",
108
- class: "-my-0.5 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-4 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
109
- "aria-label": M.value === l ? `${e.label} copied` : `Copy ${e.label}`,
110
- title: M.value === l ? "Copied" : "Copy",
111
- onClick: (t) => B(l, e.value)
112
- }, [M.value === l ? (u(), n(g(_), {
113
- key: 0,
114
- class: "size-3.5 text-success",
115
- "aria-hidden": "true"
116
- })) : (u(), n(g(v), {
117
- key: 1,
118
- class: "size-3.5",
119
- "aria-hidden": "true"
120
- }))], 8, k)) : r("", !0)
121
- ]))], void 0, 1)])], 2))), 128))], 10, C))], 2));
105
+ content: F.value === r ? "Copied" : "Copy"
106
+ }, {
107
+ default: y(() => [s("button", {
108
+ type: "button",
109
+ class: "-my-0.5 inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-4 text-muted transition hover:bg-surface-sunken hover:text-heading focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring",
110
+ "aria-label": F.value === r ? `${n.label} copied` : `Copy ${n.label}`,
111
+ onClick: (e) => U(r, n.value)
112
+ }, [F.value === r ? (f(), i(v(b), {
113
+ key: 0,
114
+ class: "size-3.5 text-success",
115
+ "aria-hidden": "true"
116
+ })) : (f(), i(v(x), {
117
+ key: 1,
118
+ class: "size-3.5",
119
+ "aria-hidden": "true"
120
+ }))], 8, M)]),
121
+ _: 2
122
+ }, 1032, ["content"])) : a("", !0)
123
+ ]))], void 0, 1)])], 2))), 128))], 10, E))], 2));
122
124
  }
123
125
  });
124
126
  //#endregion
125
- export { A as default };
127
+ export { N as default };
@@ -51,8 +51,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
51
51
  disabled: boolean;
52
52
  name: string;
53
53
  size: "small" | "normal";
54
- hint: string;
55
54
  readonly: boolean;
55
+ hint: string;
56
56
  errorMsg: string;
57
57
  addonLabel: string;
58
58
  addonIcon: Component;
@@ -3,7 +3,7 @@ export interface Props<T> {
3
3
  /** The choices: `{ value, label, description?, disabled?, group? }`. */
4
4
  options: SelectOption<T>[];
5
5
  /** How to tell whether two values are the same, for option values that are objects. A property name (`"id"`) or a function `(a, b) => boolean`. Without it values are compared with `===`, which is right for strings and numbers. */
6
- by?: (T extends object ? keyof T & string : never) | ((a: T, b: T) => boolean);
6
+ by?: string | ((a: T, b: T) => boolean);
7
7
  /** Floating label. It rests inside the field and rises when a value is chosen or the list opens. */
8
8
  label?: string;
9
9
  /** Text shown in the field when there's no label and nothing is selected. */
@@ -58,7 +58,7 @@ var ye = { class: "relative" }, be = [
58
58
  props: /*@__PURE__*/ f({
59
59
  options: {},
60
60
  by: {
61
- type: Function,
61
+ type: [String, Function],
62
62
  default: void 0
63
63
  },
64
64
  label: { default: "" },
@@ -41,8 +41,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
41
41
  disabled: boolean;
42
42
  name: string;
43
43
  rows: number;
44
- hint: string;
45
44
  readonly: boolean;
45
+ hint: string;
46
46
  errorMsg: string;
47
47
  mono: boolean;
48
48
  maxlength: number;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copies text to the clipboard. Uses the async Clipboard API, which browsers only expose on
3
+ * HTTPS and localhost, and falls back to a hidden textarea + `execCommand("copy")` so copying
4
+ * still works on plain-HTTP hosts such as `http://bb.test`. Throws when both are blocked.
5
+ */
6
+ export declare function copyText(text: string): Promise<void>;
@@ -0,0 +1,16 @@
1
+ //#region src/lib/composables/copyText.ts
2
+ async function e(e) {
3
+ if (navigator.clipboard?.writeText) {
4
+ await navigator.clipboard.writeText(e);
5
+ return;
6
+ }
7
+ let t = document.createElement("textarea");
8
+ t.value = e, t.setAttribute("readonly", ""), t.style.cssText = "position:fixed;top:0;left:0;opacity:0", document.body.appendChild(t), t.select();
9
+ try {
10
+ if (!document.execCommand("copy")) throw Error("copy command was rejected");
11
+ } finally {
12
+ t.remove();
13
+ }
14
+ }
15
+ //#endregion
16
+ export { e as copyText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ac-design/design-system",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "AppsCode design system: Tailwind CSS v4 theme and Vue 3 components.",
5
5
  "repository": {
6
6
  "type": "git",