vlite3 0.6.7 → 0.6.8

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.
@@ -1,6 +1,6 @@
1
- import { defineComponent as B, computed as c, ref as p, onMounted as K, watch as E, openBlock as g, createElementBlock as A, normalizeClass as $, createVNode as Q, createBlock as b } from "vue";
1
+ import { defineComponent as B, computed as c, ref as f, onMounted as K, watch as E, openBlock as g, createElementBlock as A, normalizeClass as P, createVNode as Q, createBlock as b } from "vue";
2
2
  import U from "./PermissionTopBar.vue.js";
3
- import P from "./PermissionEditorList.vue.js";
3
+ import $ from "./PermissionEditorList.vue.js";
4
4
  import q from "./PermissionEditorMatrix.vue.js";
5
5
  import { getAllMatrixKeys as h } from "./utils.js";
6
6
  const D = /* @__PURE__ */ B({
@@ -20,17 +20,17 @@ const D = /* @__PURE__ */ B({
20
20
  },
21
21
  emits: ["update:modelValue"],
22
22
  setup(s, { emit: C }) {
23
- const a = s, f = C, i = c(() => a.layout === "matrix"), r = p(""), d = p([]), y = c(() => i.value ? a.matrixGroups : a.groups), x = c(
23
+ const t = s, p = C, i = c(() => t.layout === "matrix"), r = f(""), d = f([]), y = c(() => i.value ? t.matrixGroups : t.groups), x = c(
24
24
  () => y.value.map((l) => ({
25
25
  label: l.label,
26
26
  value: l.key,
27
27
  icon: l.icon
28
28
  }))
29
- ), n = p(/* @__PURE__ */ new Set()), v = p(/* @__PURE__ */ new Set());
29
+ ), n = f(/* @__PURE__ */ new Set()), v = f(/* @__PURE__ */ new Set());
30
30
  function k() {
31
- if (a.defaultExpanded && a.defaultExpanded.length > 0) {
31
+ if (t.defaultExpanded && t.defaultExpanded.length > 0) {
32
32
  const l = y.value.map((e) => e.key);
33
- return new Set(l.filter((e) => !a.defaultExpanded.includes(e)));
33
+ return new Set(l.filter((e) => !t.defaultExpanded.includes(e)));
34
34
  }
35
35
  return /* @__PURE__ */ new Set();
36
36
  }
@@ -41,79 +41,79 @@ const D = /* @__PURE__ */ B({
41
41
  if (l.trim()) {
42
42
  const e = l.toLowerCase(), o = /* @__PURE__ */ new Set();
43
43
  if (i.value)
44
- for (const t of a.matrixGroups)
45
- (t.label.toLowerCase().includes(e) || t.rows.some(
44
+ for (const a of t.matrixGroups)
45
+ (a.label.toLowerCase().includes(e) || a.rows.some(
46
46
  (m) => m.label.toLowerCase().includes(e) || m.key.toLowerCase().includes(e)
47
- )) && o.add(t.key);
47
+ )) && o.add(a.key);
48
48
  else
49
- for (const t of a.groups)
50
- (t.label.toLowerCase().includes(e) || t.permissions.some(
49
+ for (const a of t.groups)
50
+ (a.label.toLowerCase().includes(e) || a.permissions.some(
51
51
  (m) => m.label.toLowerCase().includes(e) || m.key.toLowerCase().includes(e)
52
- )) && o.add(t.key);
53
- const u = y.value.map((t) => t.key);
54
- n.value = new Set(u.filter((t) => !o.has(t)));
52
+ )) && o.add(a.key);
53
+ const u = y.value.map((a) => a.key);
54
+ n.value = new Set(u.filter((a) => !o.has(a)));
55
55
  } else
56
56
  n.value = new Set(v.value);
57
57
  });
58
58
  function w(l) {
59
- if (!a.collapsible) return;
59
+ if (!t.collapsible) return;
60
60
  const e = new Set(n.value);
61
61
  e.has(l) ? e.delete(l) : e.add(l), n.value = e, r.value.trim() || (v.value = new Set(e));
62
62
  }
63
63
  const G = c(() => {
64
- let l = a.groups;
64
+ let l = t.groups;
65
65
  if (d.value.length > 0 && (l = l.filter((e) => d.value.includes(e.key))), r.value.trim()) {
66
66
  const e = r.value.toLowerCase();
67
67
  l = l.map((o) => {
68
68
  const u = o.permissions.filter(
69
- (t) => t.label.toLowerCase().includes(e) || t.key.toLowerCase().includes(e) || o.label.toLowerCase().includes(e)
69
+ (a) => a.label.toLowerCase().includes(e) || a.key.toLowerCase().includes(e) || o.label.toLowerCase().includes(e)
70
70
  );
71
71
  return u.length === 0 ? null : { ...o, permissions: u };
72
72
  }).filter(Boolean);
73
73
  }
74
74
  return l;
75
- }), V = c(() => {
76
- let l = a.matrixGroups;
75
+ }), L = c(() => {
76
+ let l = t.matrixGroups;
77
77
  if (d.value.length > 0 && (l = l.filter((e) => d.value.includes(e.key))), r.value.trim()) {
78
78
  const e = r.value.toLowerCase();
79
79
  l = l.map((o) => {
80
80
  const u = o.rows.filter(
81
- (t) => t.label.toLowerCase().includes(e) || t.key.toLowerCase().includes(e) || o.label.toLowerCase().includes(e)
81
+ (a) => a.label.toLowerCase().includes(e) || a.key.toLowerCase().includes(e) || o.label.toLowerCase().includes(e)
82
82
  );
83
83
  return u.length === 0 ? null : { ...o, rows: u };
84
84
  }).filter(Boolean);
85
85
  }
86
86
  return l;
87
- }), L = c(() => i.value ? a.matrixGroups.reduce(
87
+ }), V = c(() => i.value ? t.matrixGroups.reduce(
88
88
  (l, e) => l + e.rows.reduce(
89
- (o, u) => o + u.actions.filter((t) => u.actions.includes(t?.key)).length,
89
+ (o, u) => o + u.actions.filter((a) => u.actions.includes(a?.key)).length,
90
90
  0
91
91
  ),
92
92
  0
93
- ) : a.groups.reduce((l, e) => l + e.permissions.length, 0));
93
+ ) : t.groups.reduce((l, e) => l + e.permissions.length, 0));
94
94
  function M() {
95
- if (!a.readonly)
95
+ if (!t.readonly)
96
96
  if (i.value) {
97
- const l = h(a.matrixGroups), e = a.modelValue.filter((o) => !l.includes(o));
98
- f("update:modelValue", [...e, ...l]);
97
+ const l = h(t.matrixGroups), e = t.modelValue.filter((o) => !l.includes(o));
98
+ p("update:modelValue", [...e, ...l]);
99
99
  } else {
100
- const l = a.groups.flatMap((e) => e.permissions.map((o) => o.key));
101
- f("update:modelValue", l);
100
+ const l = t.groups.flatMap((e) => e.permissions.map((o) => o.key));
101
+ p("update:modelValue", l);
102
102
  }
103
103
  }
104
104
  function S() {
105
- if (!a.readonly)
105
+ if (!t.readonly)
106
106
  if (i.value) {
107
- const l = new Set(h(a.matrixGroups));
108
- f(
107
+ const l = new Set(h(t.matrixGroups));
108
+ p(
109
109
  "update:modelValue",
110
- a.modelValue.filter((e) => !l.has(e))
110
+ t.modelValue.filter((e) => !l.has(e))
111
111
  );
112
112
  } else
113
- f("update:modelValue", []);
113
+ p("update:modelValue", []);
114
114
  }
115
115
  return (l, e) => (g(), A("div", {
116
- class: $(["permission-editor", a.class])
116
+ class: P(["permission-editor", t.class])
117
117
  }, [
118
118
  Q(U, {
119
119
  searchQuery: r.value,
@@ -123,7 +123,7 @@ const D = /* @__PURE__ */ B({
123
123
  searchable: s.searchable,
124
124
  size: s.size,
125
125
  readonly: s.readonly,
126
- "total-perms": L.value,
126
+ "total-perms": V.value,
127
127
  "selected-count": s.modelValue.length,
128
128
  "group-options": x.value,
129
129
  onSelectAll: M,
@@ -131,7 +131,7 @@ const D = /* @__PURE__ */ B({
131
131
  }, null, 8, ["searchQuery", "selectedGroupKeys", "searchable", "size", "readonly", "total-perms", "selected-count", "group-options"]),
132
132
  i.value ? (g(), b(q, {
133
133
  key: 0,
134
- "matrix-groups": V.value,
134
+ "matrix-groups": L.value,
135
135
  "model-value": s.modelValue,
136
136
  "collapsed-groups": n.value,
137
137
  "toggle-mode": s.toggleMode,
@@ -140,7 +140,7 @@ const D = /* @__PURE__ */ B({
140
140
  collapsible: s.collapsible,
141
141
  "onUpdate:modelValue": e[2] || (e[2] = (o) => l.$emit("update:modelValue", o)),
142
142
  onToggleCollapse: w
143
- }, null, 8, ["matrix-groups", "model-value", "collapsed-groups", "toggle-mode", "readonly", "size", "collapsible"])) : (g(), b(P, {
143
+ }, null, 8, ["matrix-groups", "model-value", "collapsed-groups", "toggle-mode", "readonly", "size", "collapsible"])) : (g(), b($, {
144
144
  key: 1,
145
145
  groups: G.value,
146
146
  "model-value": s.modelValue,
@@ -1,156 +1,7 @@
1
- import { defineComponent as M, computed as $, openBlock as o, createElementBlock as c, createVNode as w, createElementVNode as a, normalizeClass as r, Fragment as g, renderList as C, createBlock as u, createCommentVNode as y, toDisplayString as x, withModifiers as N, withCtx as P } from "vue";
2
- import U from "../CheckBox.vue.js";
3
- import B from "../Switch.vue.js";
4
- import k from "../Icon.vue.js";
5
- import E from "../Tooltip.vue.js";
6
- const S = {
7
- key: 0,
8
- class: "text-center py-12 text-muted-foreground"
9
- }, j = {
10
- key: 1,
11
- class: "space-y-0 border rounded-lg overflow-hidden"
12
- }, L = ["onClick"], A = { class: "flex items-center gap-2" }, D = { key: 0 }, F = { class: "flex items-center gap-2 pl-6" }, q = { class: "flex items-center" }, R = /* @__PURE__ */ M({
13
- __name: "PermissionEditorList",
14
- props: {
15
- groups: {},
16
- modelValue: {},
17
- collapsedGroups: {},
18
- toggleMode: {},
19
- readonly: { type: Boolean },
20
- size: {},
21
- collapsible: { type: Boolean }
22
- },
23
- emits: ["update:modelValue", "toggleCollapse"],
24
- setup(l, { emit: G }) {
25
- const s = l, b = G, h = $(() => s.size === "sm" ? "text-xs" : "text-sm"), p = $(() => s.size === "sm" ? "px-3 py-1.5" : "px-4 py-2.5");
26
- function m(n) {
27
- return s.modelValue.includes(n);
28
- }
29
- function V(n) {
30
- if (s.readonly) return;
31
- const i = m(n) ? s.modelValue.filter((e) => e !== n) : [...s.modelValue, n];
32
- b("update:modelValue", i);
33
- }
34
- function f(n) {
35
- const i = n.permissions, e = i.filter((d) => m(d.key));
36
- return e.length === 0 ? "none" : e.length === i.length ? "all" : "indeterminate";
37
- }
38
- function z(n) {
39
- if (s.readonly) return;
40
- const i = f(n), e = n.permissions.map((t) => t.key);
41
- let d;
42
- if (i === "all")
43
- d = s.modelValue.filter((t) => !e.includes(t));
44
- else {
45
- const t = e.filter((v) => !s.modelValue.includes(v));
46
- d = [...s.modelValue, ...t];
47
- }
48
- b("update:modelValue", d);
49
- }
50
- return (n, i) => l.groups.length === 0 ? (o(), c("div", S, [
51
- w(k, {
52
- icon: "lucide:search-x",
53
- class: "w-8 h-8 mx-auto mb-3 opacity-50"
54
- }),
55
- a("p", {
56
- class: r(h.value)
57
- }, "No permissions match your filters.", 2)
58
- ])) : (o(), c("div", j, [
59
- (o(!0), c(g, null, C(l.groups, (e, d) => (o(), c(g, {
60
- key: e.key
61
- }, [
62
- a("div", {
63
- class: r([
64
- p.value,
65
- "flex items-center justify-between bg-muted cursor-pointer select-none",
66
- d > 0 ? "border-t" : ""
67
- ]),
68
- onClick: (t) => n.$emit("toggleCollapse", e.key)
69
- }, [
70
- a("div", A, [
71
- l.collapsible ? (o(), u(k, {
72
- key: 0,
73
- icon: "lucide:chevron-right",
74
- class: r(["w-3.5 h-3.5 transition-transform duration-200 text-muted-foreground", { "rotate-90": !l.collapsedGroups.has(e.key) }])
75
- }, null, 8, ["class"])) : y("", !0),
76
- e.icon ? (o(), u(k, {
77
- key: 1,
78
- icon: e.icon,
79
- class: "w-4 h-4 text-muted-foreground"
80
- }, null, 8, ["icon"])) : y("", !0),
81
- a("span", {
82
- class: r([h.value, "font-semibold text-foreground"])
83
- }, x(e.label), 3),
84
- a("span", {
85
- class: r([l.size === "sm" ? "text-[10px]" : "text-xs", "text-muted-foreground"])
86
- }, " (" + x(e.permissions.filter((t) => m(t.key)).length) + "/" + x(e.permissions.length) + ") ", 3)
87
- ]),
88
- a("div", {
89
- class: "flex items-center",
90
- onClick: i[0] || (i[0] = N(() => {
91
- }, ["stop"]))
92
- }, [
93
- l.toggleMode === "checkbox" ? (o(), u(U, {
94
- key: 0,
95
- "model-value": f(e) === "all",
96
- indeterminate: f(e) === "indeterminate",
97
- disabled: l.readonly,
98
- size: l.size === "sm" ? "xs" : "sm",
99
- "onUpdate:modelValue": (t) => z(e)
100
- }, null, 8, ["model-value", "indeterminate", "disabled", "size", "onUpdate:modelValue"])) : (o(), u(B, {
101
- key: 1,
102
- "model-value": f(e) === "all",
103
- disabled: l.readonly,
104
- "onUpdate:modelValue": (t) => z(e)
105
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
106
- ])
107
- ], 10, L),
108
- l.collapsedGroups.has(e.key) ? y("", !0) : (o(), c("div", D, [
109
- (o(!0), c(g, null, C(e.permissions, (t) => (o(), c("div", {
110
- key: t.key,
111
- class: r([
112
- p.value,
113
- "flex items-center justify-between border-t hover:bg-accent/40 transition-colors duration-100"
114
- ])
115
- }, [
116
- a("div", F, [
117
- a("span", {
118
- class: r([h.value, "text-foreground"])
119
- }, x(t.label), 3),
120
- t.description ? (o(), u(E, {
121
- key: 0,
122
- content: t.description,
123
- placement: "top"
124
- }, {
125
- default: P(() => [
126
- w(k, {
127
- icon: "lucide:info",
128
- class: "w-3 h-3 text-muted-foreground cursor-auto shrink-0"
129
- })
130
- ]),
131
- _: 1
132
- }, 8, ["content"])) : y("", !0)
133
- ]),
134
- a("div", q, [
135
- l.toggleMode === "checkbox" ? (o(), u(U, {
136
- key: 0,
137
- "model-value": m(t.key),
138
- disabled: l.readonly,
139
- size: l.size === "sm" ? "xs" : "sm",
140
- "onUpdate:modelValue": (v) => V(t.key)
141
- }, null, 8, ["model-value", "disabled", "size", "onUpdate:modelValue"])) : (o(), u(B, {
142
- key: 1,
143
- "model-value": m(t.key),
144
- disabled: l.readonly,
145
- "onUpdate:modelValue": (v) => V(t.key)
146
- }, null, 8, ["model-value", "disabled", "onUpdate:modelValue"]))
147
- ])
148
- ], 2))), 128))
149
- ]))
150
- ], 64))), 128))
151
- ]));
152
- }
153
- });
1
+ import o from "./PermissionEditorList.vue2.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3adbf210"]]);
154
5
  export {
155
- R as default
6
+ m as default
156
7
  };
@@ -1,4 +1,162 @@
1
- import f from "./PermissionEditorList.vue.js";
1
+ import { defineComponent as N, computed as b, openBlock as s, createElementBlock as r, createVNode as p, createElementVNode as a, normalizeClass as m, normalizeStyle as E, Fragment as x, renderList as z, createBlock as c, createCommentVNode as f, toDisplayString as k, withModifiers as C, withCtx as P } from "vue";
2
+ import V from "../CheckBox.vue.js";
3
+ import w from "../Switch.vue.js";
4
+ import v from "../Icon.vue.js";
5
+ import j from "../Tooltip.vue.js";
6
+ const L = {
7
+ key: 0,
8
+ class: "text-center py-12 text-muted-foreground"
9
+ }, A = ["onClick"], D = { class: "flex items-center gap-2" }, F = ["onClick"], q = {
10
+ key: 0,
11
+ class: "custom-list-group-content"
12
+ }, H = ["onClick"], I = { class: "flex items-center gap-2 pl-6" }, J = { class: "flex items-center pointer-events-none" }, W = /* @__PURE__ */ N({
13
+ __name: "PermissionEditorList",
14
+ props: {
15
+ groups: {},
16
+ modelValue: {},
17
+ collapsedGroups: {},
18
+ toggleMode: {},
19
+ readonly: { type: Boolean },
20
+ size: {},
21
+ collapsible: { type: Boolean }
22
+ },
23
+ emits: ["update:modelValue", "toggleCollapse"],
24
+ setup(t, { emit: $ }) {
25
+ const n = t, g = $, h = b(() => n.size === "sm" ? "text-xs" : "text-sm"), B = b(() => ({
26
+ "--cell-py": n.size === "sm" ? "0.5rem" : "0.625rem",
27
+ "--cell-px": n.size === "sm" ? "0.75rem" : "1rem"
28
+ }));
29
+ function u(o) {
30
+ return n.modelValue.includes(o);
31
+ }
32
+ function G(o) {
33
+ if (n.readonly) return;
34
+ const i = u(o) ? n.modelValue.filter((e) => e !== o) : [...n.modelValue, o];
35
+ g("update:modelValue", i);
36
+ }
37
+ function y(o) {
38
+ const i = o.permissions.filter((e) => u(e.key));
39
+ return i.length === 0 ? "none" : i.length === o.permissions.length ? "all" : "indeterminate";
40
+ }
41
+ function S(o) {
42
+ if (n.readonly) return;
43
+ const i = y(o), e = o.permissions.map((d) => d.key);
44
+ let l;
45
+ if (i === "all")
46
+ l = n.modelValue.filter((d) => !e.includes(d));
47
+ else {
48
+ const d = e.filter((M) => !n.modelValue.includes(M));
49
+ l = [...n.modelValue, ...d];
50
+ }
51
+ g("update:modelValue", l);
52
+ }
53
+ return (o, i) => t.groups.length === 0 ? (s(), r("div", L, [
54
+ p(v, {
55
+ icon: "lucide:search-x",
56
+ class: "w-8 h-8 mx-auto mb-3 opacity-50"
57
+ }),
58
+ a("p", {
59
+ class: m(h.value)
60
+ }, "No permissions match your filters.", 2)
61
+ ])) : (s(), r("div", {
62
+ key: 1,
63
+ class: "permission-list-wrapper",
64
+ style: E(B.value)
65
+ }, [
66
+ (s(!0), r(x, null, z(t.groups, (e) => (s(), r(x, {
67
+ key: e.key
68
+ }, [
69
+ a("div", {
70
+ class: "custom-list-header flex items-center justify-between cursor-pointer select-none",
71
+ onClick: (l) => o.$emit("toggleCollapse", e.key)
72
+ }, [
73
+ a("div", D, [
74
+ t.collapsible ? (s(), c(v, {
75
+ key: 0,
76
+ icon: "lucide:chevron-right",
77
+ class: m(["w-3.5 h-3.5 transition-transform duration-200", { "rotate-90": !t.collapsedGroups.has(e.key) }]),
78
+ style: { color: "var(--color-muted-foreground)" }
79
+ }, null, 8, ["class"])) : f("", !0),
80
+ e.icon ? (s(), c(v, {
81
+ key: 1,
82
+ icon: e.icon,
83
+ class: "w-4 h-4",
84
+ style: { color: "var(--color-muted-foreground)" }
85
+ }, null, 8, ["icon"])) : f("", !0),
86
+ a("span", {
87
+ class: m([h.value, "font-semibold"]),
88
+ style: { color: "var(--color-foreground)" }
89
+ }, k(e.label), 3),
90
+ a("span", {
91
+ class: m([t.size === "sm" ? "text-[10px]" : "text-xs"]),
92
+ style: { color: "var(--color-muted-foreground)" }
93
+ }, " (" + k(e.permissions.filter((l) => u(l.key)).length) + "/" + k(e.permissions.length) + ") ", 3)
94
+ ]),
95
+ a("div", {
96
+ class: "flex items-center",
97
+ onClick: C((l) => S(e), ["stop"])
98
+ }, [
99
+ t.toggleMode === "checkbox" ? (s(), c(V, {
100
+ key: 0,
101
+ "model-value": y(e) === "all",
102
+ indeterminate: y(e) === "indeterminate",
103
+ disabled: t.readonly,
104
+ size: t.size === "sm" ? "xs" : "sm",
105
+ class: "pointer-events-none"
106
+ }, null, 8, ["model-value", "indeterminate", "disabled", "size"])) : (s(), c(w, {
107
+ key: 1,
108
+ "model-value": y(e) === "all",
109
+ disabled: t.readonly,
110
+ class: "pointer-events-none"
111
+ }, null, 8, ["model-value", "disabled"]))
112
+ ], 8, F)
113
+ ], 8, A),
114
+ t.collapsedGroups.has(e.key) ? f("", !0) : (s(), r("div", q, [
115
+ (s(!0), r(x, null, z(e.permissions, (l) => (s(), r("div", {
116
+ key: l.key,
117
+ class: m(["custom-list-item flex items-center justify-between transition-colors duration-100", { "cursor-pointer": !t.readonly }]),
118
+ onClick: (d) => G(l.key)
119
+ }, [
120
+ a("div", I, [
121
+ a("span", {
122
+ class: m([h.value]),
123
+ style: { color: "var(--color-foreground)" }
124
+ }, k(l.label), 3),
125
+ l.description ? (s(), c(j, {
126
+ key: 0,
127
+ content: l.description,
128
+ placement: "top"
129
+ }, {
130
+ default: P(() => [
131
+ p(v, {
132
+ icon: "lucide:info",
133
+ class: "w-3 h-3 cursor-auto shrink-0",
134
+ style: { color: "var(--color-muted-foreground)" },
135
+ onClick: i[0] || (i[0] = C(() => {
136
+ }, ["stop"]))
137
+ })
138
+ ]),
139
+ _: 1
140
+ }, 8, ["content"])) : f("", !0)
141
+ ]),
142
+ a("div", J, [
143
+ t.toggleMode === "checkbox" ? (s(), c(V, {
144
+ key: 0,
145
+ "model-value": u(l.key),
146
+ disabled: t.readonly,
147
+ size: t.size === "sm" ? "xs" : "sm"
148
+ }, null, 8, ["model-value", "disabled", "size"])) : (s(), c(w, {
149
+ key: 1,
150
+ "model-value": u(l.key),
151
+ disabled: t.readonly
152
+ }, null, 8, ["model-value", "disabled"]))
153
+ ])
154
+ ], 10, H))), 128))
155
+ ]))
156
+ ], 64))), 128))
157
+ ], 4));
158
+ }
159
+ });
2
160
  export {
3
- f as default
161
+ W as default
4
162
  };