@phila/phila-ui-nav-link 0.0.10 → 0.0.13
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 +32 -11
- package/dist/NavLink.js +14 -18
- package/dist/NavLink.umd.cjs +1 -1
- package/dist/NavLink.vue.d.ts +1 -10
- package/dist/types.d.ts +3 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
## Usage
|
|
2
|
+
### Import single component
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
```js
|
|
5
|
+
import NavLink from "@phila/phila-ui-nav-link";
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
//register it locally...
|
|
8
|
+
components: {
|
|
9
|
+
NavLink,
|
|
10
|
+
}
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
//... or register it globally
|
|
13
|
+
Vue.component('NavLink', NavLink);
|
|
14
|
+
```
|
|
8
15
|
|
|
9
|
-
##
|
|
16
|
+
## router-link
|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
The NavLink props when using it as a **router-link**.
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
```js
|
|
21
|
+
{
|
|
22
|
+
href: 'vue-router route name', //the route name is used, and not the path
|
|
23
|
+
text: 'My Link',
|
|
24
|
+
attrs: Object //any other html anchor attributes
|
|
25
|
+
}
|
|
26
|
+
```
|
|
14
27
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
28
|
+
## Regular link
|
|
29
|
+
The NavLink props when using it as a **regular/native** link.
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
{
|
|
33
|
+
type: 'native',
|
|
34
|
+
href: String, //url
|
|
35
|
+
active: Boolean,
|
|
36
|
+
click: Function,
|
|
37
|
+
attrs: Object //any other html anchor attributes
|
|
38
|
+
}
|
|
39
|
+
```
|
package/dist/NavLink.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as a, resolveComponent as s, createElementBlock as i, createBlock as l, openBlock as t, mergeProps as o, toHandlers as c, toDisplayString as r, withCtx as p, createTextVNode as k } from "vue";
|
|
2
|
+
const u = ["href"], v = /* @__PURE__ */ a({
|
|
3
3
|
__name: "NavLink",
|
|
4
4
|
props: {
|
|
5
5
|
type: {},
|
|
@@ -10,29 +10,25 @@ const h = ["href"], m = ["href", "onClick"], y = /* @__PURE__ */ i({
|
|
|
10
10
|
attrs: {},
|
|
11
11
|
submenu: {}
|
|
12
12
|
},
|
|
13
|
-
setup(
|
|
14
|
-
return (e,
|
|
15
|
-
const
|
|
16
|
-
return e.type === "native" ? (
|
|
13
|
+
setup(f) {
|
|
14
|
+
return (e, m) => {
|
|
15
|
+
const n = s("router-link");
|
|
16
|
+
return e.type === "native" ? (t(), i("a", o({ key: 0 }, e.attrs, {
|
|
17
17
|
href: e.href,
|
|
18
18
|
class: { "is-active": e.active }
|
|
19
|
-
},
|
|
19
|
+
}, c(e.click ? { click: e.click } : {}, !0)), r(e.text), 17, u)) : (t(), l(n, o({
|
|
20
20
|
key: 1,
|
|
21
|
-
to:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, e.attrs, {
|
|
27
|
-
class: { "is-active": t.isExactActive },
|
|
28
|
-
onClick: t.navigate
|
|
29
|
-
}), r(e.text), 17, m)
|
|
21
|
+
to: e.href,
|
|
22
|
+
class: { "is-active": e.active }
|
|
23
|
+
}, e.attrs), {
|
|
24
|
+
default: p(() => [
|
|
25
|
+
k(r(e.text), 1)
|
|
30
26
|
]),
|
|
31
27
|
_: 1
|
|
32
|
-
},
|
|
28
|
+
}, 16, ["to", "class"]));
|
|
33
29
|
};
|
|
34
30
|
}
|
|
35
31
|
});
|
|
36
32
|
export {
|
|
37
|
-
|
|
33
|
+
v as default
|
|
38
34
|
};
|
package/dist/NavLink.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.NavLink=n(e.Vue))})(this,function(e){"use strict";const n=["href"]
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("vue")):typeof define=="function"&&define.amd?define(["vue"],n):(e=typeof globalThis<"u"?globalThis:e||self,e.NavLink=n(e.Vue))})(this,function(e){"use strict";const n=["href"];return e.defineComponent({__name:"NavLink",props:{type:{},href:{},text:{},active:{type:Boolean},click:{type:[Function,null]},attrs:{},submenu:{}},setup(r){return(t,s)=>{const o=e.resolveComponent("router-link");return t.type==="native"?(e.openBlock(),e.createElementBlock("a",e.mergeProps({key:0},t.attrs,{href:t.href,class:{"is-active":t.active}},e.toHandlers(t.click?{click:t.click}:{},!0)),e.toDisplayString(t.text),17,n)):(e.openBlock(),e.createBlock(o,e.mergeProps({key:1,to:t.href,class:{"is-active":t.active}},t.attrs),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.text),1)]),_:1},16,["to","class"]))}}})});
|
package/dist/NavLink.vue.d.ts
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
import { NavLinkProps } from './types';
|
|
2
|
-
declare const _default: import("vue").DefineComponent<
|
|
2
|
+
declare const _default: import("vue").DefineComponent<NavLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NavLinkProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
3
|
export default _default;
|
|
4
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
5
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
6
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
7
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
8
|
-
} : {
|
|
9
|
-
type: import('vue').PropType<T[K]>;
|
|
10
|
-
required: true;
|
|
11
|
-
};
|
|
12
|
-
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import NavLink from './NavLink.vue';
|
|
2
|
+
import { type RouteLocationRaw } from "vue-router";
|
|
2
3
|
declare module "vue" {
|
|
3
4
|
interface GlobalComponents {
|
|
4
5
|
NavLink: typeof NavLink;
|
|
@@ -7,11 +8,11 @@ declare module "vue" {
|
|
|
7
8
|
type ClickFunction = (event: MouseEvent) => void;
|
|
8
9
|
export interface NavLinkProps {
|
|
9
10
|
type?: string;
|
|
10
|
-
href?:
|
|
11
|
+
href?: RouteLocationRaw;
|
|
11
12
|
text?: string;
|
|
12
13
|
active?: boolean;
|
|
13
14
|
click?: ClickFunction | null;
|
|
14
|
-
attrs?: Record<PropertyKey,
|
|
15
|
+
attrs?: Record<PropertyKey, unknown>;
|
|
15
16
|
submenu?: NavLinkProps[];
|
|
16
17
|
}
|
|
17
18
|
export default NavLink;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-nav-link",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^20.10.3",
|
|
24
24
|
"@vitejs/plugin-vue": "^4.5.0",
|
|
25
|
-
"typescript": "^5.
|
|
25
|
+
"typescript": "^5.8.2",
|
|
26
26
|
"vite": "^5.0.0",
|
|
27
27
|
"vite-plugin-dts": "^3.6.4",
|
|
28
|
-
"vue-tsc": "^
|
|
28
|
+
"vue-tsc": "^2.2.8"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"registry": "https://registry.npmjs.com/",
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "f00518592815b1bf558d88f77fc4b6b3a30296e5"
|
|
35
35
|
}
|