@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 CHANGED
@@ -1,18 +1,39 @@
1
- # Vue 3 + TypeScript + Vite
1
+ ## Usage
2
+ ### Import single component
2
3
 
3
- This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
4
+ ```js
5
+ import NavLink from "@phila/phila-ui-nav-link";
4
6
 
5
- ## Recommended IDE Setup
7
+ //register it locally...
8
+ components: {
9
+ NavLink,
10
+ }
6
11
 
7
- - [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
12
+ //... or register it globally
13
+ Vue.component('NavLink', NavLink);
14
+ ```
8
15
 
9
- ## Type Support For `.vue` Imports in TS
16
+ ## router-link
10
17
 
11
- TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
18
+ The NavLink props when using it as a **router-link**.
12
19
 
13
- If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
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
- 1. Disable the built-in TypeScript Extension
16
- 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
17
- 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
18
- 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.
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 i, resolveComponent as c, openBlock as n, createElementBlock as s, mergeProps as o, toHandlers as l, toDisplayString as r, createBlock as p, withCtx as k, createElementVNode as f } from "vue";
2
- const h = ["href"], m = ["href", "onClick"], y = /* @__PURE__ */ i({
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(u) {
14
- return (e, v) => {
15
- const a = c("router-link");
16
- return e.type === "native" ? (n(), s("a", o({ key: 0 }, e.attrs, {
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
- }, l(e.click ? { click: e.click } : {}, !0)), r(e.text), 17, h)) : (n(), p(a, {
19
+ }, c(e.click ? { click: e.click } : {}, !0)), r(e.text), 17, u)) : (t(), l(n, o({
20
20
  key: 1,
21
- to: { name: e.href }
22
- }, {
23
- default: k((t) => [
24
- f("a", o({
25
- href: t.href
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
- }, 8, ["to"]));
28
+ }, 16, ["to", "class"]));
33
29
  };
34
30
  }
35
31
  });
36
32
  export {
37
- y as default
33
+ v as default
38
34
  };
@@ -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"],o=["href","onClick"];return e.defineComponent({__name:"NavLink",props:{type:{},href:{},text:{},active:{type:Boolean},click:{type:[Function,null]},attrs:{},submenu:{}},setup(c){return(t,a)=>{const r=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(r,{key:1,to:{name:t.href}},{default:e.withCtx(i=>[e.createElementVNode("a",e.mergeProps({href:i.href},t.attrs,{class:{"is-active":i.isExactActive},onClick:i.navigate}),e.toDisplayString(t.text),17,o)]),_:1},8,["to"]))}}})});
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"]))}}})});
@@ -1,12 +1,3 @@
1
1
  import { NavLinkProps } from './types';
2
- declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<NavLinkProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<NavLinkProps>>>, {}, {}>;
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?: string;
11
+ href?: RouteLocationRaw;
11
12
  text?: string;
12
13
  active?: boolean;
13
14
  click?: ClickFunction | null;
14
- attrs?: Record<PropertyKey, never>;
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.10",
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.2.2",
25
+ "typescript": "^5.8.2",
26
26
  "vite": "^5.0.0",
27
27
  "vite-plugin-dts": "^3.6.4",
28
- "vue-tsc": "^1.8.22"
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": "17ea0e29f4566d58fe5eccba43c916d4453129ad"
34
+ "gitHead": "f00518592815b1bf558d88f77fc4b6b3a30296e5"
35
35
  }