@knitify/vue 0.0.0 → 0.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.
package/dist/index.es.js CHANGED
@@ -1,206 +1,71 @@
1
- import { defineComponent as b, openBlock as i, createElementBlock as v, createElementVNode as u, reactive as j, inject as C, computed as f, h as B, unref as _, getCurrentInstance as q, watchEffect as z, resolveComponent as V, Fragment as F, renderList as U, createBlock as x, withCtx as G, normalizeClass as h, createVNode as O, toDisplayString as H, createCommentVNode as g, useSlots as J, renderSlot as E } from "vue";
2
- const Q = {
1
+ import { defineComponent as d, openBlock as e, createElementBlock as a, createElementVNode as s, resolveComponent as m, Fragment as k, renderList as C, createBlock as p, unref as g, withCtx as y, normalizeClass as c, createVNode as u, toDisplayString as I, createCommentVNode as l, useSlots as M, renderSlot as _ } from "vue";
2
+ import { RouterLink as x } from "vue-router";
3
+ const S = {
3
4
  class: "KIcon",
4
5
  title: "icon",
5
6
  role: "img"
6
- }, W = ["href"], X = /* @__PURE__ */ b({
7
+ }, B = ["href"], V = /* @__PURE__ */ d({
7
8
  __name: "KIcon",
8
9
  props: {
9
10
  href: { default: "" }
10
11
  },
11
- setup(e) {
12
- return (t, n) => (i(), v("svg", Q, [
13
- u("use", {
14
- href: `#${e.href.replace(/^#/, "")}`
15
- }, null, 8, W)
12
+ setup(t) {
13
+ return (o, r) => (e(), a("svg", S, [
14
+ s("use", {
15
+ href: `#${t.href.replace(/^#/, "")}`
16
+ }, null, 8, B)
16
17
  ]));
17
18
  }
18
- });
19
- const Y = typeof document < "u", Z = () => {
20
- }, N = Array.isArray;
21
- process.env.NODE_ENV;
22
- process.env.NODE_ENV;
23
- process.env.NODE_ENV;
24
- const P = /* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "router" : ""), ee = /* @__PURE__ */ Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
25
- process.env.NODE_ENV;
26
- function S(e) {
27
- const t = Array.from(arguments).slice(1);
28
- console.warn.apply(console, ["[Vue Router warn]: " + e].concat(t));
29
- }
30
- function $(e, t) {
31
- return (e.aliasOf || e) === (t.aliasOf || t);
32
- }
33
- function te(e, t) {
34
- if (Object.keys(e).length !== Object.keys(t).length) return !1;
35
- for (var n in e) if (!ne(e[n], t[n])) return !1;
36
- return !0;
37
- }
38
- function ne(e, t) {
39
- return N(e) ? I(e, t) : N(t) ? I(t, e) : (e && e.valueOf()) === (t && t.valueOf());
40
- }
41
- function I(e, t) {
42
- return N(t) ? e.length === t.length && e.every((n, a) => n === t[a]) : e.length === 1 && e[0] === t;
43
- }
44
- function w(e) {
45
- return typeof e == "string" || e && typeof e == "object";
46
- }
47
- function D(e) {
48
- const t = C(P), n = C(ee);
49
- let a = !1, c = null;
50
- const o = f(() => {
51
- const r = _(e.to);
52
- return process.env.NODE_ENV !== "production" && (!a || r !== c) && (w(r) || (a ? S(`Invalid value for prop "to" in useLink()
53
- - to:`, r, `
54
- - previous to:`, c, `
55
- - props:`, e) : S(`Invalid value for prop "to" in useLink()
56
- - to:`, r, `
57
- - props:`, e)), c = r, a = !0), t.resolve(r);
58
- }), l = f(() => {
59
- const { matched: r } = o.value, { length: s } = r, K = r[s - 1], m = n.matched;
60
- if (!K || !m.length) return -1;
61
- const k = m.findIndex($.bind(null, K));
62
- if (k > -1) return k;
63
- const A = L(r[s - 2]);
64
- return s > 1 && L(K) === A && m[m.length - 1].path !== A ? m.findIndex($.bind(null, r[s - 2])) : k;
65
- }), d = f(() => l.value > -1 && ce(n.params, o.value.params)), p = f(() => l.value > -1 && l.value === n.matched.length - 1 && te(n.params, o.value.params));
66
- function y(r = {}) {
67
- if (se(r)) {
68
- const s = t[_(e.replace) ? "replace" : "push"](_(e.to)).catch(Z);
69
- return e.viewTransition && typeof document < "u" && "startViewTransition" in document && document.startViewTransition(() => s), s;
70
- }
71
- return Promise.resolve();
72
- }
73
- if (process.env.NODE_ENV !== "production" && Y) {
74
- const r = q();
75
- if (r) {
76
- const s = {
77
- route: o.value,
78
- isActive: d.value,
79
- isExactActive: p.value,
80
- error: null
81
- };
82
- r.__vrl_devtools = r.__vrl_devtools || [], r.__vrl_devtools.push(s), z(() => {
83
- s.route = o.value, s.isActive = d.value, s.isExactActive = p.value, s.error = w(_(e.to)) ? null : 'Invalid "to" value';
84
- }, { flush: "post" });
85
- }
86
- }
87
- return {
88
- route: o,
89
- href: f(() => o.value.href),
90
- isActive: d,
91
- isExactActive: p,
92
- navigate: y
93
- };
94
- }
95
- function oe(e) {
96
- return e.length === 1 ? e[0] : e;
97
- }
98
- const re = /* @__PURE__ */ b({
99
- name: "RouterLink",
100
- compatConfig: { MODE: 3 },
101
- props: {
102
- to: {
103
- type: [String, Object],
104
- required: !0
105
- },
106
- replace: Boolean,
107
- activeClass: String,
108
- exactActiveClass: String,
109
- custom: Boolean,
110
- ariaCurrentValue: {
111
- type: String,
112
- default: "page"
113
- },
114
- viewTransition: Boolean
115
- },
116
- useLink: D,
117
- setup(e, { slots: t }) {
118
- const n = j(D(e)), { options: a } = C(P), c = f(() => ({
119
- [R(e.activeClass, a.linkActiveClass, "router-link-active")]: n.isActive,
120
- [R(e.exactActiveClass, a.linkExactActiveClass, "router-link-exact-active")]: n.isExactActive
121
- }));
122
- return () => {
123
- const o = t.default && oe(t.default(n));
124
- return e.custom ? o : B("a", {
125
- "aria-current": n.isExactActive ? e.ariaCurrentValue : null,
126
- href: n.href,
127
- onClick: n.navigate,
128
- class: c.value
129
- }, o);
130
- };
131
- }
132
- }), ae = re;
133
- function se(e) {
134
- if (!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && !e.defaultPrevented && !(e.button !== void 0 && e.button !== 0)) {
135
- if (e.currentTarget && e.currentTarget.getAttribute) {
136
- const t = e.currentTarget.getAttribute("target");
137
- if (/\b_blank\b/i.test(t)) return;
138
- }
139
- return e.preventDefault && e.preventDefault(), !0;
140
- }
141
- }
142
- function ce(e, t) {
143
- for (const n in t) {
144
- const a = t[n], c = e[n];
145
- if (typeof a == "string") {
146
- if (a !== c) return !1;
147
- } else if (!N(c) || c.length !== a.length || a.some((o, l) => o.valueOf() !== c[l].valueOf())) return !1;
148
- }
149
- return !0;
150
- }
151
- function L(e) {
152
- return e ? e.aliasOf ? e.aliasOf.path : e.path : "";
153
- }
154
- const R = (e, t, n) => e ?? t ?? n, ie = { class: "KNavbar-menu" }, le = ["href", "onClick"], ue = { class: "KNavbar-icon" }, ve = {
155
- class: /* @__PURE__ */ h(["KNavbar-text"])
156
- }, fe = {
19
+ }), j = { class: "KNavbar-menu" }, z = ["href", "onClick"], E = { class: "KNavbar-icon" }, L = {
20
+ class: /* @__PURE__ */ c(["KNavbar-text"])
21
+ }, O = {
157
22
  key: 0,
158
- class: /* @__PURE__ */ h(["KNavbar-caret", "KCollapse-toggle"]),
23
+ class: /* @__PURE__ */ c(["KNavbar-caret", "KCollapse-toggle"]),
159
24
  "data-collapse-toggle": ""
160
- }, T = /* @__PURE__ */ b({
25
+ }, K = /* @__PURE__ */ d({
161
26
  __name: "KNavbarMenu",
162
27
  props: {
163
28
  items: { default: () => [] }
164
29
  },
165
- setup(e) {
166
- return (t, n) => {
167
- const a = V("KIcon"), c = V("KNavbarMenu", !0);
168
- return i(), v("ul", ie, [
169
- (i(!0), v(F, null, U(e.items, (o, l) => (i(), x(_(ae), {
170
- key: `navbar-menu-item-${l}`,
171
- to: o.route,
30
+ setup(t) {
31
+ return (o, r) => {
32
+ const i = m("KIcon"), b = m("KNavbarMenu", !0);
33
+ return e(), a("ul", j, [
34
+ (e(!0), a(k, null, C(t.items, (n, h) => (e(), p(g(x), {
35
+ key: `navbar-menu-item-${h}`,
36
+ to: n.route,
172
37
  custom: ""
173
38
  }, {
174
- default: G(({ isActive: d, href: p, navigate: y }) => [
175
- u("li", {
176
- class: h([
39
+ default: y(({ isActive: f, href: N, navigate: $ }) => [
40
+ s("li", {
41
+ class: c([
177
42
  "KNavbar-item",
178
43
  "KCollapse is-collapsed",
179
- d && "KNavbar-item-is-active"
44
+ f && "KNavbar-item-is-active"
180
45
  ]),
181
46
  "data-collapse": ""
182
47
  }, [
183
- u("a", {
184
- class: h(["KNavbar-link"]),
185
- href: p,
186
- onClick: y
48
+ s("a", {
49
+ class: c(["KNavbar-link"]),
50
+ href: N,
51
+ onClick: $
187
52
  }, [
188
- u("span", ue, [
189
- O(a, {
190
- href: o.icon
53
+ s("span", E, [
54
+ u(i, {
55
+ href: n.icon
191
56
  }, null, 8, ["href"])
192
57
  ]),
193
- u("span", ve, H(o.text), 1),
194
- o.children ? (i(), v("span", fe, [
195
- O(a, { href: "#caretUp" })
196
- ])) : g("", !0)
197
- ], 8, le),
198
- o.children ? (i(), x(c, {
58
+ s("span", L, I(n.text), 1),
59
+ n.children ? (e(), a("span", O, [
60
+ u(i, { href: "#caretUp" })
61
+ ])) : l("", !0)
62
+ ], 8, z),
63
+ n.children ? (e(), p(b, {
199
64
  key: 0,
200
- items: o.children,
65
+ items: n.children,
201
66
  class: "KCollapse-content",
202
67
  "data-collapse-content": ""
203
- }, null, 8, ["items"])) : g("", !0)
68
+ }, null, 8, ["items"])) : l("", !0)
204
69
  ], 2)
205
70
  ]),
206
71
  _: 2
@@ -208,52 +73,52 @@ const R = (e, t, n) => e ?? t ?? n, ie = { class: "KNavbar-menu" }, le = ["href"
208
73
  ]);
209
74
  };
210
75
  }
211
- }), de = { class: "KNavbar" }, pe = { class: "KNavbar-inner" }, me = {
76
+ }), w = { class: "KNavbar" }, D = { class: "KNavbar-inner" }, F = {
212
77
  key: 0,
213
78
  class: "KNavbar-brand"
214
- }, _e = { class: "KNavbar-body" }, he = {
79
+ }, P = { class: "KNavbar-body" }, R = {
215
80
  key: 1,
216
81
  class: "KNavbar-footer"
217
- }, ge = /* @__PURE__ */ b({
82
+ }, T = /* @__PURE__ */ d({
218
83
  __name: "KNavbar",
219
84
  props: {
220
85
  items: {}
221
86
  },
222
- setup(e) {
223
- const t = J();
224
- return (n, a) => (i(), v("aside", de, [
225
- u("div", pe, [
226
- t.brand ? (i(), v("div", me, [
227
- E(n.$slots, "brand")
228
- ])) : g("", !0),
229
- u("nav", _e, [
230
- E(n.$slots, "default", {}, () => [
231
- O(T, { items: e.items }, null, 8, ["items"])
87
+ setup(t) {
88
+ const o = M();
89
+ return (r, i) => (e(), a("aside", w, [
90
+ s("div", D, [
91
+ o.brand ? (e(), a("div", F, [
92
+ _(r.$slots, "brand")
93
+ ])) : l("", !0),
94
+ s("nav", P, [
95
+ _(r.$slots, "default", {}, () => [
96
+ u(K, { items: t.items }, null, 8, ["items"])
232
97
  ])
233
98
  ]),
234
- t.footer ? (i(), v("div", he, [
235
- E(n.$slots, "footer")
236
- ])) : g("", !0)
99
+ o.footer ? (e(), a("div", R, [
100
+ _(r.$slots, "footer")
101
+ ])) : l("", !0)
237
102
  ])
238
103
  ]));
239
104
  }
240
- }), M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
105
+ }), v = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
241
106
  __proto__: null,
242
- KIcon: X,
243
- KNavbar: ge,
244
- KNavbarMenu: T
245
- }, Symbol.toStringTag, { value: "Module" })), be = {
246
- install(e) {
247
- for (const t in M)
248
- e.component(
249
- t,
250
- M[t]
107
+ KIcon: V,
108
+ KNavbar: T,
109
+ KNavbarMenu: K
110
+ }, Symbol.toStringTag, { value: "Module" })), A = {
111
+ install(t) {
112
+ for (const o in v)
113
+ t.component(
114
+ o,
115
+ v[o]
251
116
  );
252
117
  }
253
118
  };
254
119
  export {
255
- X as KIcon,
256
- ge as KNavbar,
257
- T as KNavbarMenu,
258
- be as default
120
+ V as KIcon,
121
+ T as KNavbar,
122
+ K as KNavbarMenu,
123
+ A as default
259
124
  };
package/dist/index.umd.js CHANGED
@@ -1,6 +1 @@
1
- (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["knitify-vue"]={},i.Vue))})(this,(function(i,e){"use strict";const x={class:"KIcon",title:"icon",role:"img"},I=["href"],k=e.defineComponent({__name:"KIcon",props:{href:{default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("svg",x,[e.createElementVNode("use",{href:`#${t.href.replace(/^#/,"")}`},null,8,I)]))}});const $=typeof document<"u",w=()=>{},p=Array.isArray;process.env.NODE_ENV,process.env.NODE_ENV,process.env.NODE_ENV;const v=Symbol(process.env.NODE_ENV!=="production"?"router":""),D=Symbol(process.env.NODE_ENV!=="production"?"route location":"");process.env.NODE_ENV;function y(t){const n=Array.from(arguments).slice(1);console.warn.apply(console,["[Vue Router warn]: "+t].concat(n))}function E(t,n){return(t.aliasOf||t)===(n.aliasOf||n)}function L(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(var o in t)if(!R(t[o],n[o]))return!1;return!0}function R(t,n){return p(t)?b(t,n):p(n)?b(n,t):(t&&t.valueOf())===(n&&n.valueOf())}function b(t,n){return p(n)?t.length===n.length&&t.every((o,c)=>o===n[c]):t.length===1&&t[0]===n}function K(t){return typeof t=="string"||t&&typeof t=="object"}function C(t){const n=e.inject(v),o=e.inject(D);let c=!1,l=null;const r=e.computed(()=>{const a=e.unref(t.to);return process.env.NODE_ENV!=="production"&&(!c||a!==l)&&(K(a)||(c?y(`Invalid value for prop "to" in useLink()
2
- - to:`,a,`
3
- - previous to:`,l,`
4
- - props:`,t):y(`Invalid value for prop "to" in useLink()
5
- - to:`,a,`
6
- - props:`,t)),l=a,c=!0),n.resolve(a)}),u=e.computed(()=>{const{matched:a}=r.value,{length:s}=a,N=a[s-1],m=o.matched;if(!N||!m.length)return-1;const g=m.findIndex(E.bind(null,N));if(g>-1)return g;const A=V(a[s-2]);return s>1&&V(N)===A&&m[m.length-1].path!==A?m.findIndex(E.bind(null,a[s-2])):g}),d=e.computed(()=>u.value>-1&&P(o.params,r.value.params)),f=e.computed(()=>u.value>-1&&u.value===o.matched.length-1&&L(o.params,r.value.params));function h(a={}){if(M(a)){const s=n[e.unref(t.replace)?"replace":"push"](e.unref(t.to)).catch(w);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>s),s}return Promise.resolve()}if(process.env.NODE_ENV!=="production"&&$){const a=e.getCurrentInstance();if(a){const s={route:r.value,isActive:d.value,isExactActive:f.value,error:null};a.__vrl_devtools=a.__vrl_devtools||[],a.__vrl_devtools.push(s),e.watchEffect(()=>{s.route=r.value,s.isActive=d.value,s.isExactActive=f.value,s.error=K(e.unref(t.to))?null:'Invalid "to" value'},{flush:"post"})}}return{route:r,href:e.computed(()=>r.value.href),isActive:d,isExactActive:f,navigate:h}}function T(t){return t.length===1?t[0]:t}const j=e.defineComponent({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:C,setup(t,{slots:n}){const o=e.reactive(C(t)),{options:c}=e.inject(v),l=e.computed(()=>({[O(t.activeClass,c.linkActiveClass,"router-link-active")]:o.isActive,[O(t.exactActiveClass,c.linkExactActiveClass,"router-link-exact-active")]:o.isExactActive}));return()=>{const r=n.default&&T(n.default(o));return t.custom?r:e.h("a",{"aria-current":o.isExactActive?t.ariaCurrentValue:null,href:o.href,onClick:o.navigate,class:l.value},r)}}});function M(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const n=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(n))return}return t.preventDefault&&t.preventDefault(),!0}}function P(t,n){for(const o in n){const c=n[o],l=t[o];if(typeof c=="string"){if(c!==l)return!1}else if(!p(l)||l.length!==c.length||c.some((r,u)=>r.valueOf()!==l[u].valueOf()))return!1}return!0}function V(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const O=(t,n,o)=>t??n??o,z={class:"KNavbar-menu"},q=["href","onClick"],F={class:"KNavbar-icon"},U={class:e.normalizeClass(["KNavbar-text"])},G={key:0,class:e.normalizeClass(["KNavbar-caret","KCollapse-toggle"]),"data-collapse-toggle":""},_=e.defineComponent({__name:"KNavbarMenu",props:{items:{default:()=>[]}},setup(t){return(n,o)=>{const c=e.resolveComponent("KIcon"),l=e.resolveComponent("KNavbarMenu",!0);return e.openBlock(),e.createElementBlock("ul",z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(r,u)=>(e.openBlock(),e.createBlock(e.unref(j),{key:`navbar-menu-item-${u}`,to:r.route,custom:""},{default:e.withCtx(({isActive:d,href:f,navigate:h})=>[e.createElementVNode("li",{class:e.normalizeClass(["KNavbar-item","KCollapse is-collapsed",d&&"KNavbar-item-is-active"]),"data-collapse":""},[e.createElementVNode("a",{class:e.normalizeClass(["KNavbar-link"]),href:f,onClick:h},[e.createElementVNode("span",F,[e.createVNode(c,{href:r.icon},null,8,["href"])]),e.createElementVNode("span",U,e.toDisplayString(r.text),1),r.children?(e.openBlock(),e.createElementBlock("span",G,[e.createVNode(c,{href:"#caretUp"})])):e.createCommentVNode("",!0)],8,q),r.children?(e.openBlock(),e.createBlock(l,{key:0,items:r.children,class:"KCollapse-content","data-collapse-content":""},null,8,["items"])):e.createCommentVNode("",!0)],2)]),_:2},1032,["to"]))),128))])}}}),H={class:"KNavbar"},J={class:"KNavbar-inner"},Q={key:0,class:"KNavbar-brand"},W={class:"KNavbar-body"},X={key:1,class:"KNavbar-footer"},S=e.defineComponent({__name:"KNavbar",props:{items:{}},setup(t){const n=e.useSlots();return(o,c)=>(e.openBlock(),e.createElementBlock("aside",H,[e.createElementVNode("div",J,[n.brand?(e.openBlock(),e.createElementBlock("div",Q,[e.renderSlot(o.$slots,"brand")])):e.createCommentVNode("",!0),e.createElementVNode("nav",W,[e.renderSlot(o.$slots,"default",{},()=>[e.createVNode(_,{items:t.items},null,8,["items"])])]),n.footer?(e.openBlock(),e.createElementBlock("div",X,[e.renderSlot(o.$slots,"footer")])):e.createCommentVNode("",!0)])]))}}),B=Object.freeze(Object.defineProperty({__proto__:null,KIcon:k,KNavbar:S,KNavbarMenu:_},Symbol.toStringTag,{value:"Module"})),Y={install(t){for(const n in B)t.component(n,B[n])}};i.KIcon=k,i.KNavbar=S,i.KNavbarMenu=_,i.default=Y,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(t,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(t=typeof globalThis<"u"?globalThis:t||self,e(t["knitify-vue"]={},t.Vue,t.vueRouter))})(this,(function(t,e,m){"use strict";const _={class:"KIcon",title:"icon",role:"img"},p=["href"],l=e.defineComponent({__name:"KIcon",props:{href:{default:""}},setup(o){return(n,r)=>(e.openBlock(),e.createElementBlock("svg",_,[e.createElementVNode("use",{href:`#${o.href.replace(/^#/,"")}`},null,8,p)]))}}),f={class:"KNavbar-menu"},N=["href","onClick"],h={class:"KNavbar-icon"},b={class:e.normalizeClass(["KNavbar-text"])},K={key:0,class:e.normalizeClass(["KNavbar-caret","KCollapse-toggle"]),"data-collapse-toggle":""},s=e.defineComponent({__name:"KNavbarMenu",props:{items:{default:()=>[]}},setup(o){return(n,r)=>{const c=e.resolveComponent("KIcon"),$=e.resolveComponent("KNavbarMenu",!0);return e.openBlock(),e.createElementBlock("ul",f,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,(a,y)=>(e.openBlock(),e.createBlock(e.unref(m.RouterLink),{key:`navbar-menu-item-${y}`,to:a.route,custom:""},{default:e.withCtx(({isActive:g,href:S,navigate:M})=>[e.createElementVNode("li",{class:e.normalizeClass(["KNavbar-item","KCollapse is-collapsed",g&&"KNavbar-item-is-active"]),"data-collapse":""},[e.createElementVNode("a",{class:e.normalizeClass(["KNavbar-link"]),href:S,onClick:M},[e.createElementVNode("span",h,[e.createVNode(c,{href:a.icon},null,8,["href"])]),e.createElementVNode("span",b,e.toDisplayString(a.text),1),a.children?(e.openBlock(),e.createElementBlock("span",K,[e.createVNode(c,{href:"#caretUp"})])):e.createCommentVNode("",!0)],8,N),a.children?(e.openBlock(),e.createBlock($,{key:0,items:a.children,class:"KCollapse-content","data-collapse-content":""},null,8,["items"])):e.createCommentVNode("",!0)],2)]),_:2},1032,["to"]))),128))])}}}),k={class:"KNavbar"},C={class:"KNavbar-inner"},u={key:0,class:"KNavbar-brand"},B={class:"KNavbar-body"},V={key:1,class:"KNavbar-footer"},i=e.defineComponent({__name:"KNavbar",props:{items:{}},setup(o){const n=e.useSlots();return(r,c)=>(e.openBlock(),e.createElementBlock("aside",k,[e.createElementVNode("div",C,[n.brand?(e.openBlock(),e.createElementBlock("div",u,[e.renderSlot(r.$slots,"brand")])):e.createCommentVNode("",!0),e.createElementVNode("nav",B,[e.renderSlot(r.$slots,"default",{},()=>[e.createVNode(s,{items:o.items},null,8,["items"])])]),n.footer?(e.openBlock(),e.createElementBlock("div",V,[e.renderSlot(r.$slots,"footer")])):e.createCommentVNode("",!0)])]))}}),d=Object.freeze(Object.defineProperty({__proto__:null,KIcon:l,KNavbar:i,KNavbarMenu:s},Symbol.toStringTag,{value:"Module"})),E={install(o){for(const n in d)o.component(n,d[n])}};t.KIcon=l,t.KNavbar=i,t.KNavbarMenu=s,t.default=E,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knitify/vue",
3
- "version": "0.0.0",
3
+ "version": "0.0.2",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -8,18 +8,22 @@
8
8
  "main": "dist/index.umd.js",
9
9
  "module": "dist/index.es.js",
10
10
  "types": "dist/types/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
11
14
  "devDependencies": {
12
15
  "@vitejs/plugin-vue": "^6.0.4",
13
16
  "typescript": "^5.9.3",
14
17
  "vite": "^7.3.1",
15
- "vue": "^3.5.30",
18
+ "vue": "^3.5.12",
19
+ "vue-router": "^4.0.3",
16
20
  "vue-tsc": "^3.2.5",
17
21
  "@knitify/core": "1.0.2"
18
22
  },
19
23
  "peerDependencies": {
20
24
  "@knitify/core": "^1.0.1",
21
- "vue": "^3.5.30",
22
- "vue-router": "^5.0.4"
25
+ "vue": "^3.5.12",
26
+ "vue-router": "^4.0.3"
23
27
  },
24
28
  "publishConfig": {
25
29
  "access": "public"
@@ -1,30 +0,0 @@
1
- <script setup lang="ts">
2
- import { onMounted, onUnmounted } from 'vue'
3
- import '@knitify/core/main.css'
4
- import Knitify from '@knitify/core'
5
-
6
- onMounted(() => {
7
- Knitify.init()
8
- })
9
-
10
- onUnmounted(() => {
11
- Knitify.destroy()
12
- })
13
- </script>
14
-
15
- <template>
16
- <div>
17
- <RouterView />
18
- </div>
19
- </template>
20
-
21
- <style>
22
- html {
23
- box-sizing: border-box;
24
- }
25
- *,
26
- *::before,
27
- *::after {
28
- box-sizing: inherit;
29
- }
30
- </style>
@@ -1,11 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>Playground</title>
6
- </head>
7
- <body>
8
- <div id="app"></div>
9
- <script type="module" src="/main.ts"></script>
10
- </body>
11
- </html>
@@ -1,23 +0,0 @@
1
- import { createApp } from 'vue'
2
- import App from './App.vue'
3
- import knitifyVue from '../src'
4
- import { createRouter, createWebHashHistory } from 'vue-router'
5
-
6
- const app = createApp(App)
7
-
8
- app.use(knitifyVue)
9
-
10
- const router = createRouter({
11
- history: createWebHashHistory('/'),
12
- routes: [
13
- {
14
- name: 'main',
15
- path: '',
16
- component: () => import('./views/MainView.vue'),
17
- },
18
- ],
19
- })
20
-
21
- app.use(router)
22
-
23
- app.mount('#app')
@@ -1,13 +0,0 @@
1
- <template>
2
- <KNavbar
3
- :items="[
4
- {
5
- text: 'HR Hub',
6
- icon: '#moduleHrhubColored',
7
- route: '/',
8
- children: [{ text: 'Child', icon: '#moduleWeavesColored', route: '/' }],
9
- },
10
- { text: 'Weaves', icon: '#moduleWeavesColored', route: '/' },
11
- ]"
12
- />
13
- </template>
@@ -1,11 +0,0 @@
1
- <script setup lang="ts">
2
- import { KIconProps } from './types'
3
-
4
- const { href = '' } = defineProps<KIconProps>()
5
- </script>
6
-
7
- <template>
8
- <svg class="KIcon" title="icon" role="img">
9
- <use :href="`#${href.replace(/^#/, '')}`"></use>
10
- </svg>
11
- </template>
@@ -1,3 +0,0 @@
1
- export type KIconProps = {
2
- href: string
3
- }
@@ -1,25 +0,0 @@
1
- <script setup lang="ts">
2
- import { KNavbarProps, KNavbarSlots } from './types'
3
- import KNavbarMenu from './KNavbarMenu.vue'
4
-
5
- const { items } = defineProps<KNavbarProps>()
6
- const slots = defineSlots<KNavbarSlots>()
7
- </script>
8
-
9
- <template>
10
- <aside class="KNavbar">
11
- <div class="KNavbar-inner">
12
- <div v-if="slots.brand" class="KNavbar-brand">
13
- <slot name="brand"></slot>
14
- </div>
15
- <nav class="KNavbar-body">
16
- <slot>
17
- <KNavbarMenu :items="items" />
18
- </slot>
19
- </nav>
20
- <div v-if="slots.footer" class="KNavbar-footer">
21
- <slot name="footer"></slot>
22
- </div>
23
- </div>
24
- </aside>
25
- </template>
@@ -1,47 +0,0 @@
1
- <script setup lang="ts">
2
- import { KNavbarMenuProps } from './types'
3
- import { RouterLink } from 'vue-router'
4
-
5
- const { items = [] } = defineProps<KNavbarMenuProps>()
6
- </script>
7
-
8
- <template>
9
- <ul class="KNavbar-menu">
10
- <RouterLink
11
- v-for="(item, index) in items"
12
- :key="`navbar-menu-item-${index}`"
13
- :to="item.route"
14
- custom
15
- v-slot="{ isActive, href, navigate }"
16
- >
17
- <li
18
- :class="[
19
- 'KNavbar-item',
20
- 'KCollapse is-collapsed',
21
- isActive && 'KNavbar-item-is-active',
22
- ]"
23
- data-collapse
24
- >
25
- <a :class="['KNavbar-link']" :href="href" @click="navigate">
26
- <span class="KNavbar-icon">
27
- <KIcon :href="item.icon" />
28
- </span>
29
- <span :class="['KNavbar-text']">{{ item.text }}</span>
30
- <span
31
- v-if="item.children"
32
- :class="['KNavbar-caret', 'KCollapse-toggle']"
33
- data-collapse-toggle
34
- >
35
- <KIcon href="#caretUp" />
36
- </span>
37
- </a>
38
- <KNavbarMenu
39
- v-if="item.children"
40
- :items="item.children"
41
- class="KCollapse-content"
42
- data-collapse-content
43
- />
44
- </li>
45
- </RouterLink>
46
- </ul>
47
- </template>
@@ -1,22 +0,0 @@
1
- import { RouteLocationRaw } from 'vue-router'
2
-
3
- export type MenuItem = {
4
- text: string
5
- route: RouteLocationRaw
6
- children?: MenuItem[]
7
- icon?: string
8
- }
9
-
10
- export type KNavbarProps = {
11
- items: MenuItem[]
12
- }
13
-
14
- export type KNavbarSlots = {
15
- brand?(): any
16
- default?(): any
17
- footer?(): any
18
- }
19
-
20
- export type KNavbarMenuProps = {
21
- items: MenuItem[]
22
- }
@@ -1,3 +0,0 @@
1
- export { default as KIcon } from './Icon/KIcon.vue'
2
- export { default as KNavbar } from './Navbar/KNavbar.vue'
3
- export { default as KNavbarMenu } from './Navbar/KNavbarMenu.vue'
@@ -1,2 +0,0 @@
1
- export * from './Icon/types'
2
- export * from './Navbar/types'
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { App } from 'vue'
2
- import * as Components from './components'
3
-
4
- export * from './components/types'
5
- export * from './components'
6
-
7
- export default {
8
- install(app: App) {
9
- for (const componentName in Components) {
10
- app.component(
11
- componentName,
12
- Components[componentName as keyof typeof Components]
13
- )
14
- }
15
- },
16
- }
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "module": "ESNext",
5
- "moduleResolution": "Node",
6
- "declaration": true,
7
- "declarationDir": "dist/types",
8
- "outDir": "dist",
9
- "strict": true,
10
- "jsx": "preserve",
11
- "esModuleInterop": true,
12
- "skipLibCheck": true
13
- },
14
- "include": ["src"],
15
- "exclude": ["node_modules", "dist"]
16
- }
package/vite.config.ts DELETED
@@ -1,25 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import vue from '@vitejs/plugin-vue'
3
- import path from 'path'
4
-
5
- export default defineConfig(({ mode }) => ({
6
- plugins: [vue()],
7
-
8
- build: {
9
- lib: {
10
- entry: path.resolve(__dirname, 'src/index.ts'),
11
- name: 'knitify-vue',
12
- fileName: (format, name) => `${name}.${format}.js`,
13
- },
14
- rollupOptions: {
15
- external: ['vue', 'vue-router'],
16
- output: {
17
- globals: {
18
- vue: 'Vue',
19
- },
20
- },
21
- },
22
- },
23
-
24
- root: mode === 'development' ? 'playground' : '.',
25
- }))