lkt-menu 2.0.5 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/build.css CHANGED
@@ -1 +1 @@
1
- .lkt-menu{background:var(--lkt-menu--background);padding:var(--lkt-menu--padding);max-width:var(--lkt-menu--max-width);width:var(--lkt-menu--width);height:100%;display:var(--lkt-menu--display);flex-direction:var(--lkt-menu--flex-direction);align-items:var(--lkt-menu--align-items);gap:var(--lkt-menu--entry--gap)}.lkt-menu-entry-toggle-inner{transition:all linear .2s}.lkt-menu-entry-toggle-inner.is-opened{transform:rotate(180deg)}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:var(--lkt-menu--gap)}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.lkt-menu-entry{padding:var(--lkt-menu--entry--padding)}.lkt-menu-entry .lkt-anchor{width:100%}.lkt-menu-entry-main{display:flex;justify-content:space-between;position:relative}.lkt-entry-content{font-size:var(--lkt-menu--font-size);width:100%}.lkt-menu-outside{position:fixed;top:64px;right:0;left:0;bottom:0;background:var(--lkt-menu--outside--background);z-index:-1}.lkt-menu-entry-children{padding:var(--lkt-menu--children--padding)}.lkt-menu-entry-text{padding:var(--lkt-menu--text-without-icon--padding)}.lkt-menu.has-icon .lkt-menu-entry-text{padding:var(--lkt-menu--text--padding)}.lkt-menu.has-icon .lkt-menu-entry-icon+.lkt-menu-entry-text{padding:var(--lkt-menu--text-with-icon--padding)}
1
+ .lkt-menu-main{background:var(--lkt-menu--background);padding:var(--lkt-menu--padding);max-width:var(--lkt-menu--max-width);width:var(--lkt-menu--width);height:100%;display:var(--lkt-menu--display);flex-direction:var(--lkt-menu--flex-direction);align-items:var(--lkt-menu--align-items);gap:var(--lkt-menu--entry--gap)}.lkt-menu-entry-toggle-inner{transition:all linear .2s}.lkt-menu-entry-toggle-inner.is-opened{transform:rotate(180deg)}.lkt-entry-content{display:inline-flex;flex-direction:row;gap:var(--lkt-menu--gap)}.lkt-menu-entry-toggle{display:inline-flex;flex-direction:row;align-items:center;justify-content:center}.lkt-menu-entry{padding:var(--lkt-menu--entry--padding)}.lkt-menu-entry .lkt-anchor{width:100%}.lkt-menu-entry-main{display:flex;justify-content:space-between;position:relative}.lkt-entry-content{font-size:var(--lkt-menu--font-size);width:100%}.lkt-menu-outside{position:absolute;top:0;right:0;left:0;bottom:0;background:var(--lkt-menu--outside--background);z-index:-1}.lkt-menu-entry-children{padding:var(--lkt-menu--children--padding)}.lkt-menu-entry-text{padding:var(--lkt-menu--text-without-icon--padding)}.lkt-menu.has-icon .lkt-menu-entry-text{padding:var(--lkt-menu--text--padding)}.lkt-menu.has-icon .lkt-menu-entry-icon+.lkt-menu-entry-text{padding:var(--lkt-menu--text-with-icon--padding)}
package/dist/build.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- declare namespace ge {
1
+ declare namespace _e {
2
2
  function install(r: any): void;
3
3
  }
4
- declare function _e(r: any): boolean;
5
- export { ge as default, _e as setMenuToggleSlot };
4
+ declare function Ve(r: any): boolean;
5
+ export { _e as default, Ve as setMenuToggleSlot };
package/dist/build.js CHANGED
@@ -1,14 +1,14 @@
1
- import { defineComponent as G, ref as F, useSlots as H, computed as p, watch as R, onMounted as X, resolveComponent as K, createElementBlock as d, openBlock as s, normalizeClass as O, createElementVNode as $, createCommentVNode as S, createBlock as g, unref as k, normalizeProps as q, mergeProps as L, createSlots as P, withCtx as f, renderSlot as h, toDisplayString as Y, resolveDynamicComponent as Z, Fragment as Q, renderList as j, mergeDefaults as x } from "vue";
1
+ import { defineComponent as G, ref as F, useSlots as H, computed as p, watch as R, onMounted as X, resolveComponent as K, createElementBlock as d, openBlock as s, normalizeClass as b, createElementVNode as V, createCommentVNode as g, createBlock as _, unref as m, normalizeProps as q, mergeProps as L, createSlots as P, withCtx as h, renderSlot as f, toDisplayString as Y, resolveDynamicComponent as Z, Fragment as Q, renderList as j, mergeDefaults as x } from "vue";
2
2
  import { MenuEntryType as z, getDefaultValues as ee, Menu as te } from "lkt-vue-kernel";
3
3
  import { useRouter as le } from "vue-router";
4
4
  import { DataState as ne } from "lkt-data-state";
5
5
  import { httpCall as oe } from "lkt-http-client";
6
- const W = (r, _) => (_.forEach((a) => {
6
+ const W = (r, $) => ($.forEach((a) => {
7
7
  a.key && !r.includes(a.key) && r.push(a.key), a.children && a.children.length > 0 && W(r, a.children);
8
8
  }), r), T = class T {
9
9
  };
10
10
  T.toggleSlot = "", T.debugEnabled = !1;
11
- let b = T;
11
+ let O = T;
12
12
  const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }, ae = {
13
13
  key: 0,
14
14
  class: "lkt-menu-entry-icon"
@@ -26,8 +26,8 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
26
26
  emits: [
27
27
  "update:modelValue"
28
28
  ],
29
- setup(r, { emit: _ }) {
30
- const a = _, v = r, e = F(v.modelValue), i = H(), V = le(), y = F(!1), A = () => {
29
+ setup(r, { emit: $ }) {
30
+ const a = $, v = r, e = F(v.modelValue), i = H(), C = le(), y = F(!1), A = () => {
31
31
  e.value.isOpened = !e.value.isOpened;
32
32
  }, U = () => {
33
33
  var t, o;
@@ -47,102 +47,102 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
47
47
  return t;
48
48
  }), n = p(() => e.value.isActive ? !0 : typeof e.value.isActiveChecker == "function" ? !!e.value.isActiveChecker({
49
49
  entry: e.value
50
- }) : !1), u = p(() => !!b.toggleSlot), c = p(() => b.toggleSlot);
50
+ }) : !1), u = p(() => !!O.toggleSlot), c = p(() => O.toggleSlot);
51
51
  return R(() => v.modelValue, (t) => {
52
52
  e.value = t;
53
53
  }, { deep: !0 }), R(e, (t) => {
54
54
  a("update:modelValue", t);
55
55
  }, { deep: !0 }), X(() => {
56
- var o, E, C;
57
- let t = V == null ? void 0 : V.currentRoute;
56
+ var o, E, S;
57
+ let t = C == null ? void 0 : C.currentRoute;
58
58
  if (t) {
59
59
  if (t.value.path === ((o = e.value.anchor) == null ? void 0 : o.to))
60
60
  e.value.isOpened = !0;
61
61
  else if (typeof e.value.children < "u" && ((E = e.value.children) == null ? void 0 : E.length) > 0) {
62
62
  let I = !1;
63
- (C = e.value.children) == null || C.forEach((B) => {
64
- var m;
65
- t.value.path === ((m = B.anchor) == null ? void 0 : m.to) && (I = !0);
63
+ (S = e.value.children) == null || S.forEach((B) => {
64
+ var k;
65
+ t.value.path === ((k = B.anchor) == null ? void 0 : k.to) && (I = !0);
66
66
  }), I && (e.value.isOpened = !0);
67
67
  }
68
68
  }
69
69
  }), (t, o) => {
70
70
  var B;
71
- const E = K("lkt-button"), C = K("lkt-anchor"), I = K("menu-item", !0);
71
+ const E = K("lkt-button"), S = K("lkt-anchor"), I = K("menu-item", !0);
72
72
  return s(), d("div", {
73
- class: O(["lkt-menu-entry", w.value])
73
+ class: b(["lkt-menu-entry", w.value])
74
74
  }, [
75
- $("div", ue, [
76
- e.value.type === k(z).Button ? (s(), g(E, q(L({ key: 0 }, e.value.button)), P({ _: 2 }, [
77
- k(i).tooltip ? {
75
+ V("div", ue, [
76
+ e.value.type === m(z).Button ? (s(), _(E, q(L({ key: 0 }, e.value.button)), P({ _: 2 }, [
77
+ m(i).tooltip ? {
78
78
  name: "tooltip",
79
- fn: f(() => [
80
- h(t.$slots, "tooltip")
79
+ fn: h(() => [
80
+ f(t.$slots, "tooltip")
81
81
  ]),
82
82
  key: "0"
83
83
  } : void 0,
84
- k(i).split ? {
84
+ m(i).split ? {
85
85
  name: "split",
86
- fn: f(() => [
87
- h(t.$slots, "split")
86
+ fn: h(() => [
87
+ f(t.$slots, "split")
88
88
  ]),
89
89
  key: "1"
90
90
  } : void 0
91
- ]), 1040)) : e.value.type === k(z).Anchor ? (s(), g(C, q(L({ key: 1 }, e.value.anchor)), null, 16)) : (s(), g(C, L({ key: 2 }, e.value.anchor, {
91
+ ]), 1040)) : e.value.type === m(z).Anchor ? (s(), _(S, q(L({ key: 1 }, e.value.anchor)), null, 16)) : (s(), _(S, L({ key: 2 }, e.value.anchor, {
92
92
  "on-click": U,
93
93
  "is-active": n.value,
94
- onActive: o[0] || (o[0] = (m) => y.value = m)
94
+ onActive: o[0] || (o[0] = (k) => y.value = k)
95
95
  }), {
96
- text: f(({ text: m }) => [
97
- $("div", se, [
96
+ text: h(({ text: k }) => [
97
+ V("div", se, [
98
98
  D.value ? (s(), d("div", ae, [
99
- k(i)["icon-" + e.value.key] ? h(t.$slots, "icon-" + e.value.key, {
99
+ m(i)["icon-" + e.value.key] ? f(t.$slots, "icon-" + e.value.key, {
100
100
  key: e.value.key,
101
101
  entry: e.value
102
102
  }) : e.value.icon !== "" ? (s(), d("i", {
103
103
  key: 1,
104
- class: O(e.value.icon)
105
- }, null, 2)) : S("", !0)
106
- ])) : S("", !0),
107
- m !== "" ? (s(), d("div", re, Y(m), 1)) : S("", !0)
104
+ class: b(e.value.icon)
105
+ }, null, 2)) : g("", !0)
106
+ ])) : g("", !0),
107
+ k !== "" ? (s(), d("div", re, Y(k), 1)) : g("", !0)
108
108
  ])
109
109
  ]),
110
110
  _: 3
111
111
  }, 16, ["is-active"])),
112
- e.value.type !== k(z).Button && e.value.children && ((B = e.value.children) == null ? void 0 : B.length) > 0 ? (s(), d("div", {
112
+ e.value.type !== m(z).Button && e.value.children && ((B = e.value.children) == null ? void 0 : B.length) > 0 ? (s(), d("div", {
113
113
  key: 3,
114
114
  class: "lkt-menu-entry-toggle",
115
115
  onClick: A
116
116
  }, [
117
- u.value ? (s(), g(Z(c.value), {
117
+ u.value ? (s(), _(Z(c.value), {
118
118
  key: 0,
119
- class: O(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
119
+ class: b(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
120
120
  }, null, 8, ["class"])) : (s(), d("div", {
121
121
  key: 1,
122
- class: O(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
122
+ class: b(["lkt-menu-entry-toggle-inner", e.value.isOpened ? "is-opened" : ""])
123
123
  }, o[1] || (o[1] = [
124
- $("i", { class: "lkt-icn-angle-bottom" }, null, -1)
124
+ V("i", { class: "lkt-icn-angle-bottom" }, null, -1)
125
125
  ]), 2))
126
- ])) : S("", !0)
126
+ ])) : g("", !0)
127
127
  ]),
128
128
  e.value.isOpened ? (s(), d("div", ie, [
129
- (s(!0), d(Q, null, j(e.value.children, (m, J) => (s(), g(I, {
129
+ (s(!0), d(Q, null, j(e.value.children, (k, J) => (s(), _(I, {
130
130
  modelValue: e.value.children[J],
131
131
  "onUpdate:modelValue": (N) => e.value.children[J] = N,
132
132
  key: e.value.children[J].key
133
133
  }, P({ _: 2 }, [
134
134
  j(l.value, (N) => ({
135
135
  name: N,
136
- fn: f(() => [
137
- h(t.$slots, N)
136
+ fn: h(() => [
137
+ f(t.$slots, N)
138
138
  ])
139
139
  }))
140
140
  ]), 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
141
- ])) : S("", !0)
141
+ ])) : g("", !0)
142
142
  ], 2);
143
143
  };
144
144
  }
145
- }), de = { class: "lkt-menu-container" }, ve = { class: "lkt-menu" }, pe = /* @__PURE__ */ G({
145
+ }), de = { class: "lkt-menu" }, ve = { class: "lkt-menu-main" }, pe = { class: "lkt-menu-entries" }, me = /* @__PURE__ */ G({
146
146
  __name: "LktMenu",
147
147
  props: /* @__PURE__ */ x({
148
148
  modelValue: {},
@@ -156,9 +156,9 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
156
156
  "response",
157
157
  "error"
158
158
  ],
159
- setup(r, { emit: _ }) {
159
+ setup(r, { emit: $ }) {
160
160
  var M;
161
- const a = r, v = _, e = H(), i = F(a.modelValue), V = (l) => {
161
+ const a = r, v = $, e = H(), i = F(a.modelValue), C = (l) => {
162
162
  let n = {};
163
163
  typeof l == "object" && Object.keys(l).length > 0 && (n = JSON.parse(JSON.stringify(l)));
164
164
  for (let u in n)
@@ -166,7 +166,7 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
166
166
  return n;
167
167
  };
168
168
  let y = new ne({});
169
- y.increment(V(((M = a.http) == null ? void 0 : M.data) ?? {}));
169
+ y.increment(C(((M = a.http) == null ? void 0 : M.data) ?? {}));
170
170
  const A = p(() => W([], i.value)), U = p(() => {
171
171
  let l = [];
172
172
  for (let n in e)
@@ -189,47 +189,50 @@ const ue = { class: "lkt-menu-entry-main" }, se = { class: "lkt-entry-content" }
189
189
  }, { deep: !0 }), R(i, (l) => {
190
190
  v("update:modelValue", l);
191
191
  }, { deep: !0 }), D(), (l, n) => (s(), d("div", de, [
192
- $("div", ve, [
193
- (s(!0), d(Q, null, j(i.value, (u, c) => (s(), g(ce, {
194
- modelValue: i.value[c],
195
- "onUpdate:modelValue": (t) => i.value[c] = t,
196
- key: u.key,
197
- class: O(u.class)
198
- }, P({ _: 2 }, [
199
- j(U.value, (t) => ({
200
- name: t,
201
- fn: f(() => [
202
- h(l.$slots, t)
203
- ])
204
- })),
205
- k(e)[`tooltip-${u.key}`] ? {
206
- name: "tooltip",
207
- fn: f(() => [
208
- h(l.$slots, `tooltip-${u.key}`)
209
- ]),
210
- key: "0"
211
- } : void 0,
212
- k(e)[`split-${u.key}`] ? {
213
- name: "split",
214
- fn: f(() => [
215
- h(l.$slots, `split-${u.key}`)
216
- ]),
217
- key: "1"
218
- } : void 0
219
- ]), 1032, ["modelValue", "onUpdate:modelValue", "class"]))), 128))
192
+ V("div", ve, [
193
+ m(e).before ? f(l.$slots, "before", { key: 0 }) : g("", !0),
194
+ V("div", pe, [
195
+ (s(!0), d(Q, null, j(i.value, (u, c) => (s(), _(ce, {
196
+ modelValue: i.value[c],
197
+ "onUpdate:modelValue": (t) => i.value[c] = t,
198
+ key: u.key,
199
+ class: b(u.class)
200
+ }, P({ _: 2 }, [
201
+ j(U.value, (t) => ({
202
+ name: t,
203
+ fn: h(() => [
204
+ f(l.$slots, t)
205
+ ])
206
+ })),
207
+ m(e)[`tooltip-${u.key}`] ? {
208
+ name: "tooltip",
209
+ fn: h(() => [
210
+ f(l.$slots, `tooltip-${u.key}`)
211
+ ]),
212
+ key: "0"
213
+ } : void 0,
214
+ m(e)[`split-${u.key}`] ? {
215
+ name: "split",
216
+ fn: h(() => [
217
+ f(l.$slots, `split-${u.key}`)
218
+ ]),
219
+ key: "1"
220
+ } : void 0
221
+ ]), 1032, ["modelValue", "onUpdate:modelValue", "class"]))), 128))
222
+ ])
220
223
  ]),
221
- $("div", {
224
+ V("div", {
222
225
  class: "lkt-menu-outside",
223
226
  onClick: w
224
227
  })
225
228
  ]));
226
229
  }
227
- }), ge = {
230
+ }), _e = {
228
231
  install: (r) => {
229
- r.component("lkt-menu") === void 0 && r.component("lkt-menu", pe);
232
+ r.component("lkt-menu") === void 0 && r.component("lkt-menu", me);
230
233
  }
231
- }, _e = (r) => (b.toggleSlot = r, !0);
234
+ }, Ve = (r) => (O.toggleSlot = r, !0);
232
235
  export {
233
- ge as default,
234
- _e as setMenuToggleSlot
236
+ _e as default,
237
+ Ve as setMenuToggleSlot
235
238
  };
@@ -2363,13 +2363,15 @@ declare const entries: import("vue").Ref<{
2363
2363
  declare const entryIconSlots: import("vue").ComputedRef<LktObject>;
2364
2364
  declare const onClickOutside: () => void;
2365
2365
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
2366
- declare var __VLS_5: any, __VLS_6: {}, __VLS_9: `tooltip-${string}`, __VLS_10: {}, __VLS_13: `split-${string}`, __VLS_14: {};
2366
+ declare var __VLS_1: {}, __VLS_7: any, __VLS_8: {}, __VLS_11: `tooltip-${string}`, __VLS_12: {}, __VLS_15: `split-${string}`, __VLS_16: {};
2367
2367
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
2368
- [K in NonNullable<typeof __VLS_5>]?: (props: typeof __VLS_6) => any;
2368
+ [K in NonNullable<typeof __VLS_7>]?: (props: typeof __VLS_8) => any;
2369
2369
  } & {
2370
- [K in NonNullable<typeof __VLS_9>]?: (props: typeof __VLS_10) => any;
2370
+ [K in NonNullable<typeof __VLS_11>]?: (props: typeof __VLS_12) => any;
2371
2371
  } & {
2372
- [K in NonNullable<typeof __VLS_13>]?: (props: typeof __VLS_14) => any;
2372
+ [K in NonNullable<typeof __VLS_15>]?: (props: typeof __VLS_16) => any;
2373
+ } & {
2374
+ before?: (props: typeof __VLS_1) => any;
2373
2375
  }>;
2374
2376
  declare const __VLS_self: import("vue").DefineComponent<MenuConfig, {
2375
2377
  MenuItem: typeof MenuItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-menu",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -85,21 +85,26 @@
85
85
  </script>
86
86
 
87
87
  <template>
88
- <div class="lkt-menu-container">
89
- <div class="lkt-menu">
90
- <menu-item v-for="(entry, i) in entries" v-model="entries[i]" :key="entry.key" :class="entry.class">
91
- <template v-for="slot in entryIconSlots" v-slot:[slot]>
92
- <slot :name="slot" />
93
- </template>
94
-
95
- <template v-if="slots[`tooltip-${entry.key}`]" #tooltip>
96
- <slot :name="`tooltip-${entry.key}`"/>
97
- </template>
98
-
99
- <template v-if="slots[`split-${entry.key}`]" #split>
100
- <slot :name="`split-${entry.key}`"/>
101
- </template>
102
- </menu-item>
88
+ <div class="lkt-menu">
89
+ <div class="lkt-menu-main">
90
+ <template v-if="slots.before">
91
+ <slot name="before"/>
92
+ </template>
93
+ <div class="lkt-menu-entries">
94
+ <menu-item v-for="(entry, i) in entries" v-model="entries[i]" :key="entry.key" :class="entry.class">
95
+ <template v-for="slot in entryIconSlots" v-slot:[slot]>
96
+ <slot :name="slot" />
97
+ </template>
98
+
99
+ <template v-if="slots[`tooltip-${entry.key}`]" #tooltip>
100
+ <slot :name="`tooltip-${entry.key}`"/>
101
+ </template>
102
+
103
+ <template v-if="slots[`split-${entry.key}`]" #split>
104
+ <slot :name="`split-${entry.key}`"/>
105
+ </template>
106
+ </menu-item>
107
+ </div>
103
108
  </div>
104
109
  <div class="lkt-menu-outside" v-on:click="onClickOutside" />
105
110
  </div>