vlite3 1.5.7 → 1.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -173,8 +173,8 @@ createVLite({
173
173
 
174
174
  Available modes are `online`, `hybrid` (local first, online fallback), and
175
175
  `offline` (local data only, with no Iconify API request for missing names).
176
- `@iconify/vue@^5` is a peer dependency so registration and rendering share one
177
- predictable runtime registry.
176
+ `@iconify/vue@^5` is installed automatically with vlite3 so registration and
177
+ rendering share one predictable runtime registry.
178
178
 
179
179
  For selected-icon Vite bundles, complete collections, dynamic icon inclusion,
180
180
  manual registration, and offline picker behavior, see
@@ -50,10 +50,10 @@ const j = ["role", "tabindex"], E = {
50
50
  subtle: "bg-transparent text-foreground border-transparent",
51
51
  /* Base Semantics — foreground only */
52
52
  secondary: "bg-transparent text-secondary-subtle-fg border-transparent",
53
- success: "bg-transparent text-success-subtle-fg border-transparent",
54
- warning: "bg-transparent text-warning-subtle-fg border-transparent",
55
- danger: "bg-transparent text-danger-subtle-fg border-transparent",
56
- info: "bg-transparent text-info-subtle-fg border-transparent",
53
+ success: "bg-transparent text-success border-transparent",
54
+ warning: "bg-transparent text-warning border-transparent",
55
+ danger: "bg-transparent text-danger border-transparent",
56
+ info: "bg-transparent text-info border-transparent",
57
57
  /* Extended Semantics — foreground only */
58
58
  purple: "bg-transparent text-purple-subtle-fg border-transparent",
59
59
  teal: "bg-transparent text-teal-subtle-fg border-transparent",
@@ -1,30 +1,10 @@
1
- import { ButtonVariant, ButtonSize, ButtonRounded, ButtonDirection } from '../types';
2
- export interface ClipboardProps {
3
- /** The content to be copied to the clipboard */
4
- textToCopy: string;
5
- variant?: ButtonVariant;
6
- size?: ButtonSize;
7
- rounded?: ButtonRounded;
8
- class?: any;
9
- disabled?: boolean;
10
- defaultIcon?: string;
11
- copiedIcon?: string;
12
- defaultText?: string;
13
- copiedText?: string;
14
- defaultTextI18n?: string;
15
- copiedTextI18n?: string;
16
- asIcon?: boolean;
17
- /**
18
- * Text/icon layout direction (passed to Button).
19
- * `auto` follows nearest ancestor `dir`, then `html[dir]`.
20
- */
21
- dir?: ButtonDirection;
22
- }
1
+ import { ClipboardProps } from '../types';
23
2
  declare function __VLS_template(): {
24
3
  attrs: Partial<{}>;
25
4
  slots: {
26
5
  default?(_: {
27
6
  copied: boolean;
7
+ loading: boolean;
28
8
  }): any;
29
9
  };
30
10
  refs: {};
@@ -33,21 +13,22 @@ declare function __VLS_template(): {
33
13
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
34
14
  declare const __VLS_component: import('vue').DefineComponent<ClipboardProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
35
15
  error: (err: Error) => any;
36
- copy: (text: string) => any;
16
+ copy: (text?: string) => any;
37
17
  }, string, import('vue').PublicProps, Readonly<ClipboardProps> & Readonly<{
38
18
  onError?: (err: Error) => any;
39
- onCopy?: (text: string) => any;
19
+ onCopy?: (text?: string) => any;
40
20
  }>, {
41
- variant: ButtonVariant;
42
- size: ButtonSize;
43
- rounded: ButtonRounded;
44
- dir: ButtonDirection;
21
+ variant: import('../types').ButtonVariant;
22
+ size: import('../types').ButtonSize;
23
+ rounded: import('../types').ButtonRounded;
24
+ dir: import('../types').ButtonDirection;
45
25
  asIcon: boolean;
46
26
  defaultIcon: string;
47
27
  copiedIcon: string;
48
28
  defaultTextI18n: string;
49
29
  copiedTextI18n: string;
50
- }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
30
+ confirmationDuration: number;
31
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
51
32
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
52
33
  export default _default;
53
34
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1,10 +1,14 @@
1
- import { defineComponent as f, ref as p, computed as n, openBlock as x, createBlock as m, normalizeClass as T, withCtx as v, renderSlot as y, createCommentVNode as I } from "vue";
2
- import C from "./Button.vue.js";
3
- import { $t as r } from "../utils/i18n.js";
4
- const B = /* @__PURE__ */ f({
1
+ import { defineComponent as b, useSlots as h, ref as v, computed as d, onUnmounted as g, openBlock as k, createBlock as w, normalizeClass as z, withCtx as B, unref as E, renderSlot as S, createCommentVNode as D } from "vue";
2
+ import $ from "./Button.vue.js";
3
+ import { copyToClipboard as M } from "../utils/functions.js";
4
+ import { $t as x } from "../utils/i18n.js";
5
+ import "../core/config.js";
6
+ import "@vueuse/core";
7
+ const F = /* @__PURE__ */ b({
5
8
  __name: "Clipboard",
6
9
  props: {
7
10
  textToCopy: {},
11
+ action: {},
8
12
  variant: { default: "outline" },
9
13
  size: { default: "md" },
10
14
  rounded: { default: "full" },
@@ -16,56 +20,79 @@ const B = /* @__PURE__ */ f({
16
20
  copiedText: {},
17
21
  defaultTextI18n: { default: "vlite.clipboard.copy" },
18
22
  copiedTextI18n: { default: "vlite.clipboard.copied" },
23
+ confirmationDuration: { default: 400 },
19
24
  asIcon: { type: Boolean, default: !1 },
20
25
  dir: { default: "auto" }
21
26
  },
22
27
  emits: ["copy", "error"],
23
- setup(o, { emit: c }) {
24
- const e = o, i = c, a = p(!1);
25
- let d = null;
26
- const u = n(() => a.value ? e.copiedIcon : e.defaultIcon), l = n(() => {
27
- if (!e.asIcon)
28
- if (a.value) {
29
- if (e.copiedText) return e.copiedText;
30
- const t = r(e.copiedTextI18n);
31
- return t !== e.copiedTextI18n ? t : "Copied";
32
- } else {
33
- if (e.defaultText) return e.defaultText;
34
- const t = r(e.defaultTextI18n);
35
- return t !== e.defaultTextI18n ? t : "Copy";
36
- }
37
- }), s = async () => {
38
- if (!e.disabled)
39
- try {
40
- await navigator.clipboard.writeText(e.textToCopy), a.value = !0, i("copy", e.textToCopy), d && clearTimeout(d), d = setTimeout(() => {
41
- a.value = !1;
42
- }, 500);
43
- } catch (t) {
44
- i("error", t instanceof Error ? t : new Error("Copy failed"));
28
+ setup(t, { emit: y }) {
29
+ const e = t, c = y, f = h(), n = v(!1), l = v(!1);
30
+ let r = null, i = 0, u = !0;
31
+ const s = d(
32
+ () => typeof e.action == "function" || typeof e.textToCopy == "string"
33
+ ), T = d(() => n.value ? e.copiedIcon : e.defaultIcon), p = d(() => {
34
+ if (n.value) {
35
+ if (e.copiedText) return e.copiedText;
36
+ const a = x(e.copiedTextI18n);
37
+ return a !== e.copiedTextI18n ? a : "Copied";
38
+ }
39
+ if (e.defaultText) return e.defaultText;
40
+ const o = x(e.defaultTextI18n);
41
+ return o !== e.defaultTextI18n ? o : "Copy";
42
+ }), C = d(() => e.asIcon || f.default ? void 0 : p.value);
43
+ function m() {
44
+ r && (clearTimeout(r), r = null);
45
+ }
46
+ const I = async () => {
47
+ if (e.disabled || l.value || !s.value) return;
48
+ const o = ++i;
49
+ m(), n.value = !1, l.value = !0;
50
+ try {
51
+ const a = e.action ? await e.action() : await M(e.textToCopy);
52
+ if (!u || o !== i) return;
53
+ if (a === !1) {
54
+ e.action || c("error", new Error("Copy failed"));
55
+ return;
45
56
  }
57
+ n.value = !0, c("copy", e.action ? void 0 : e.textToCopy), r = setTimeout(
58
+ () => {
59
+ !u || o !== i || (n.value = !1, r = null);
60
+ },
61
+ Math.max(0, e.confirmationDuration)
62
+ );
63
+ } catch (a) {
64
+ u && o === i && (n.value = !1, c("error", a instanceof Error ? a : new Error("Copy failed")));
65
+ } finally {
66
+ u && o === i && (l.value = !1);
67
+ }
46
68
  };
47
- return (t, b) => (x(), m(C, {
48
- variant: o.variant,
49
- size: o.size,
50
- rounded: o.rounded,
51
- class: T(e.class),
52
- disabled: o.disabled,
53
- icon: u.value,
54
- text: l.value,
55
- "as-icon": o.asIcon,
56
- dir: o.dir === "auto" ? void 0 : o.dir,
57
- onClick: s
69
+ return g(() => {
70
+ u = !1, i += 1, m();
71
+ }), (o, a) => (k(), w($, {
72
+ variant: t.variant,
73
+ size: t.size,
74
+ rounded: t.rounded,
75
+ class: z(e.class),
76
+ disabled: t.disabled || !s.value,
77
+ loading: l.value,
78
+ icon: T.value,
79
+ text: C.value,
80
+ "as-icon": t.asIcon,
81
+ "aria-label": t.asIcon ? p.value : void 0,
82
+ dir: t.dir === "auto" ? void 0 : t.dir,
83
+ onClick: I
58
84
  }, {
59
- default: v(() => [
60
- !o.asIcon && !l.value ? y(t.$slots, "default", {
85
+ default: B(() => [
86
+ !t.asIcon && E(f).default ? S(o.$slots, "default", {
61
87
  key: 0,
62
- copied: a.value
63
- }) : I("", !0)
88
+ copied: n.value,
89
+ loading: l.value
90
+ }) : D("", !0)
64
91
  ]),
65
92
  _: 3
66
- }, 8, ["variant", "size", "rounded", "class", "disabled", "icon", "text", "as-icon", "dir"]));
93
+ }, 8, ["variant", "size", "rounded", "class", "disabled", "loading", "icon", "text", "as-icon", "aria-label", "dir"]));
67
94
  }
68
95
  });
69
96
  export {
70
- B as default
97
+ F as default
71
98
  };
@@ -4,7 +4,7 @@ import k from "../Icon.vue.js";
4
4
  import { $t as E } from "../../utils/i18n.js";
5
5
  import { useCommandPaletteItems as Y } from "./useCommandPaletteItems.js";
6
6
  import { useCommandPaletteNav as Z } from "./useCommandPaletteNav.js";
7
- import ee from "./CommandPaletteItem.vue.js";
7
+ import ee from "./CommandPaletteItem.vue2.js";
8
8
  const te = { class: "command-palette-content flex flex-col w-full h-full max-h-[70vh]" }, oe = { class: "flex items-center gap-3 px-4 py-3 border-b border-border/80 shrink-0" }, se = ["placeholder"], ne = ["aria-label"], re = {
9
9
  key: 0,
10
10
  class: "flex flex-col items-center justify-center py-14 px-6 text-center select-none",
@@ -1,5 +1,5 @@
1
1
  import t from "./CommandPaletteItem.vue3.js";
2
- /* empty css */
2
+ /* empty css */
3
3
  import o from "../../_virtual/_plugin-vue_export-helper.js";
4
4
  const r = /* @__PURE__ */ o(t, [["__scopeId", "data-v-66b1ae06"]]);
5
5
  export {
@@ -1,7 +1,7 @@
1
1
  import a from "./DataTableHeader.vue2.js";
2
2
  /* empty css */
3
- import o from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ o(a, [["__scopeId", "data-v-8735eb06"]]);
3
+ import e from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const d = /* @__PURE__ */ e(a, [["__scopeId", "data-v-b5d9d2ee"]]);
5
5
  export {
6
- m as default
6
+ d as default
7
7
  };
@@ -1,14 +1,14 @@
1
- import { defineComponent as S, computed as r, openBlock as d, createElementBlock as u, normalizeStyle as R, normalizeClass as o, createElementVNode as c, toDisplayString as M, createVNode as $, createCommentVNode as h, withModifiers as p } from "vue";
2
- import K from "../Icon.vue.js";
3
- import { $t as D } from "../../utils/i18n.js";
4
- const A = ["data-vlite-col"], E = {
1
+ import { defineComponent as C, computed as r, openBlock as s, createElementBlock as d, normalizeClass as o, createElementVNode as c, toDisplayString as S, createVNode as R, createCommentVNode as h, withModifiers as p } from "vue";
2
+ import M from "../Icon.vue.js";
3
+ import { $t as $ } from "../../utils/i18n.js";
4
+ const K = ["data-vlite-col"], D = {
5
5
  "data-vlite-header-title": "",
6
6
  class: "truncate text-xs font-bold! uppercase tracking-wider text-gray-900"
7
- }, I = {
7
+ }, A = {
8
8
  key: 0,
9
9
  "data-vlite-header-action": "",
10
10
  class: "h-4 w-4 shrink-0"
11
- }, V = ["aria-label", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext"], L = /* @__PURE__ */ S({
11
+ }, V = ["aria-label", "aria-valuenow", "aria-valuemin", "aria-valuemax", "aria-valuetext"], W = /* @__PURE__ */ C({
12
12
  __name: "DataTableHeader",
13
13
  props: {
14
14
  header: {},
@@ -28,16 +28,16 @@ const A = ["data-vlite-col"], E = {
28
28
  },
29
29
  emits: ["sort", "resizeStart", "resizeKeyboard", "resizeReset"],
30
30
  setup(a, { emit: m }) {
31
- const e = a, l = m, f = r(() => e.header.sortKey || e.header.field), z = r(
32
- () => e.sortConfig?.field === f.value && e.sortConfig?.order
33
- ), y = r(() => !e.sortConfig || e.sortConfig.field !== f.value ? "lucide:chevrons-up-down" : e.sortConfig.order === "asc" ? "lucide:arrow-up" : e.sortConfig.order === "desc" ? "lucide:arrow-down" : "lucide:chevrons-up-down"), n = r(() => {
31
+ const e = a, l = m, u = r(() => e.header.sortKey || e.header.field), z = r(
32
+ () => e.sortConfig?.field === u.value && e.sortConfig?.order
33
+ ), y = r(() => !e.sortConfig || e.sortConfig.field !== u.value ? "lucide:chevrons-up-down" : e.sortConfig.order === "asc" ? "lucide:arrow-up" : e.sortConfig.order === "desc" ? "lucide:arrow-down" : "lucide:chevrons-up-down"), n = r(() => {
34
34
  const t = !!e.header.title || !!e.header.titleI18n;
35
35
  return e.tableSortable && e.header.sortable !== !1 && t;
36
- }), s = r(() => e.resizable && e.header.resizable !== !1), v = r(() => s.value && e.resizeHandleVisible), g = () => {
36
+ }), f = r(() => e.resizable && e.header.resizable !== !1), b = r(() => f.value && e.resizeHandleVisible), v = () => {
37
37
  n.value && l("sort", e.header.field);
38
38
  }, x = (t) => {
39
- !s.value || t.button !== 0 || (t.preventDefault(), t.stopPropagation(), l("resizeStart", t));
40
- }, b = (t) => {
39
+ !f.value || t.button !== 0 || (t.preventDefault(), t.stopPropagation(), l("resizeStart", t));
40
+ }, g = (t) => {
41
41
  if (t.key === "ArrowLeft" || t.key === "ArrowRight") {
42
42
  t.preventDefault(), t.stopPropagation(), l("resizeKeyboard", t.key === "ArrowRight" ? 1 : -1, t.shiftKey);
43
43
  return;
@@ -48,11 +48,9 @@ const A = ["data-vlite-col"], E = {
48
48
  center: "justify-center text-center",
49
49
  right: "justify-end text-right"
50
50
  })[e.header.align || "left"]), k = r(
51
- () => e.header.titleI18n ? D(e.header.titleI18n) : e.header.title
52
- ), B = r(() => e.size === "xs" || e.compact ? `py-1.5! ${e.cellBordered ? "px-3!" : ""}` : e.size === "sm" ? `py-2! ${e.cellBordered ? "px-3!" : ""}` : e.size === "lg" ? `py-4! ${e.cellBordered ? "px-4!" : ""}` : `py-3! ${e.cellBordered ? "px-3.5!" : ""}`), C = r(
53
- () => s.value ? { paddingInlineEnd: "1rem !important" } : void 0
54
- );
55
- return (t, i) => (d(), u("th", {
51
+ () => e.header.titleI18n ? $(e.header.titleI18n) : e.header.title
52
+ ), B = r(() => e.size === "xs" || e.compact ? `py-1.5! ${e.cellBordered ? "px-3!" : ""}` : e.size === "sm" ? `py-2! ${e.cellBordered ? "px-3!" : ""}` : e.size === "lg" ? `py-4! ${e.cellBordered ? "px-4!" : ""}` : `py-3! ${e.cellBordered ? "px-3.5!" : ""}`);
53
+ return (t, i) => (s(), d("th", {
56
54
  scope: "col",
57
55
  "data-vlite-col": a.header.field,
58
56
  class: o(["group/th relative px-3 text-left align-middle font-medium text-muted-foreground transition-colors [&:has([role=checkbox])]:pr-0", [
@@ -61,16 +59,18 @@ const A = ["data-vlite-col"], E = {
61
59
  n.value ? "cursor-pointer hover:bg-muted/50" : "",
62
60
  a.header.hideOnMobile ? "hidden md:table-cell" : ""
63
61
  ]]),
64
- style: R(C.value),
65
- onClick: g
62
+ onClick: v
66
63
  }, [
67
64
  c("div", {
68
65
  "data-vlite-header-content": "",
69
- class: o(["flex min-w-0 items-center gap-2 overflow-hidden", w.value])
66
+ class: o(["flex min-w-0 items-center gap-2 overflow-hidden", [
67
+ w.value,
68
+ a.resizable ? "data-table-header__content--resizable" : ""
69
+ ]])
70
70
  }, [
71
- c("span", E, M(k.value), 1),
72
- n.value ? (d(), u("span", I, [
73
- $(K, {
71
+ c("span", D, S(k.value), 1),
72
+ n.value ? (s(), d("span", A, [
73
+ R(M, {
74
74
  icon: y.value,
75
75
  class: o(["mt-0.5 h-3.5 w-3.5 text-muted-foreground transition-all", [
76
76
  z.value ? "opacity-100 text-foreground" : "opacity-0 group-hover/th:opacity-100"
@@ -78,7 +78,7 @@ const A = ["data-vlite-col"], E = {
78
78
  }, null, 8, ["icon", "class"])
79
79
  ])) : h("", !0)
80
80
  ], 2),
81
- v.value ? (d(), u("span", {
81
+ b.value ? (s(), d("span", {
82
82
  key: 0,
83
83
  class: o(["data-table-header__resize-handle", a.resizeActive ? "data-table-header__resize-handle--active" : ""]),
84
84
  role: "separator",
@@ -92,17 +92,17 @@ const A = ["data-vlite-col"], E = {
92
92
  onPointerdown: x,
93
93
  onClick: i[0] || (i[0] = p(() => {
94
94
  }, ["stop"])),
95
- onDblclick: i[1] || (i[1] = p((H) => l("resizeReset"), ["stop", "prevent"])),
96
- onKeydown: b
95
+ onDblclick: i[1] || (i[1] = p((E) => l("resizeReset"), ["stop", "prevent"])),
96
+ onKeydown: g
97
97
  }, [...i[2] || (i[2] = [
98
98
  c("span", {
99
99
  class: "data-table-header__resize-line",
100
100
  "aria-hidden": "true"
101
101
  }, null, -1)
102
102
  ])], 42, V)) : h("", !0)
103
- ], 14, A));
103
+ ], 10, K));
104
104
  }
105
105
  });
106
106
  export {
107
- L as default
107
+ W as default
108
108
  };