@fiscozen/link
Advanced tools
| export * from './src/index' |
+70
| import { defineComponent as i, computed as l, resolveComponent as c, openBlock as a, createElementBlock as d, normalizeClass as r, renderSlot as o, createBlock as m, withCtx as g } from "vue"; | ||
| const k = ["href", "target"], v = /* @__PURE__ */ i({ | ||
| __name: "FzLink", | ||
| props: { | ||
| to: {}, | ||
| replace: { type: Boolean, default: !1 }, | ||
| type: { default: "default" }, | ||
| linkStyle: { default: "default" }, | ||
| size: { default: "lg" }, | ||
| disabled: { type: Boolean, default: !1 }, | ||
| target: {}, | ||
| external: { type: Boolean, default: !1 } | ||
| }, | ||
| setup(u) { | ||
| const t = u, s = l(() => [ | ||
| "border-1 border-transparent", | ||
| { | ||
| "text-xs": t.size === "xs", | ||
| "text-sm": t.size === "sm", | ||
| "text-md": t.size === "md", | ||
| "text-lg": t.size === "lg", | ||
| underline: t.linkStyle === "underline" | ||
| } | ||
| ]), n = l(() => [ | ||
| ...s.value, | ||
| "hover:underline", | ||
| { | ||
| "text-blue-500 hover:text-blue-600 focus:text-blue-600 focus:border-blue-600": t.type === "default", | ||
| "text-semantic-error hover:text-red-600 focus:text-red-600 focus:border-red-600": t.type === "danger" | ||
| } | ||
| ]), p = l(() => [ | ||
| ...s.value, | ||
| "cursor-not-allowed", | ||
| { | ||
| "text-red-200": t.type === "danger", | ||
| "text-blue-200": t.type === "default" | ||
| } | ||
| ]); | ||
| return (e, y) => { | ||
| const f = c("router-link"); | ||
| return e.disabled ? (a(), d("span", { | ||
| key: 0, | ||
| class: r(p.value) | ||
| }, [ | ||
| o(e.$slots, "default") | ||
| ], 2)) : e.external ? (a(), d("a", { | ||
| key: 1, | ||
| href: e.to.toString(), | ||
| class: r(n.value), | ||
| target: e.target | ||
| }, [ | ||
| o(e.$slots, "default") | ||
| ], 10, k)) : (a(), m(f, { | ||
| key: 2, | ||
| to: e.to, | ||
| replace: e.replace, | ||
| class: r(n.value), | ||
| target: e.target | ||
| }, { | ||
| default: g(() => [ | ||
| o(e.$slots, "default") | ||
| ]), | ||
| _: 3 | ||
| }, 8, ["to", "replace", "class", "target"])); | ||
| }; | ||
| } | ||
| }); | ||
| export { | ||
| v as FzLink | ||
| }; |
| (function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.FzLink={},o.Vue))})(this,function(o,e){"use strict";const s=["href","target"],a=e.defineComponent({__name:"FzLink",props:{to:{},replace:{type:Boolean,default:!1},type:{default:"default"},linkStyle:{default:"default"},size:{default:"lg"},disabled:{type:Boolean,default:!1},target:{},external:{type:Boolean,default:!1}},setup(d){const l=d,n=e.computed(()=>["border-1 border-transparent",{"text-xs":l.size==="xs","text-sm":l.size==="sm","text-md":l.size==="md","text-lg":l.size==="lg",underline:l.linkStyle==="underline"}]),r=e.computed(()=>[...n.value,"hover:underline",{"text-blue-500 hover:text-blue-600 focus:text-blue-600 focus:border-blue-600":l.type==="default","text-semantic-error hover:text-red-600 focus:text-red-600 focus:border-red-600":l.type==="danger"}]),i=e.computed(()=>[...n.value,"cursor-not-allowed",{"text-red-200":l.type==="danger","text-blue-200":l.type==="default"}]);return(t,p)=>{const f=e.resolveComponent("router-link");return t.disabled?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(i.value)},[e.renderSlot(t.$slots,"default")],2)):t.external?(e.openBlock(),e.createElementBlock("a",{key:1,href:t.to.toString(),class:e.normalizeClass(r.value),target:t.target},[e.renderSlot(t.$slots,"default")],10,s)):(e.openBlock(),e.createBlock(f,{key:2,to:t.to,replace:t.replace,class:e.normalizeClass(r.value),target:t.target},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"default")]),_:3},8,["to","replace","class","target"]))}}});o.FzLink=a,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}); |
| import { FzLinkProps } from './types'; | ||
| declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FzLinkProps>, { | ||
| type: string; | ||
| linkStyle: string; | ||
| size: string; | ||
| disabled: boolean; | ||
| replace: boolean; | ||
| external: boolean; | ||
| }>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<FzLinkProps>, { | ||
| type: string; | ||
| linkStyle: string; | ||
| size: string; | ||
| disabled: boolean; | ||
| replace: boolean; | ||
| external: boolean; | ||
| }>>>, { | ||
| replace: boolean; | ||
| type: "default" | "danger"; | ||
| linkStyle: "default" | "underline"; | ||
| size: "xs" | "sm" | "md" | "lg"; | ||
| disabled: boolean; | ||
| external: boolean; | ||
| }, {}>, { | ||
| default?(_: {}): any; | ||
| }>; | ||
| export default _default; | ||
| type __VLS_NonUndefinedable<T> = T extends undefined ? never : T; | ||
| type __VLS_TypePropsToRuntimeProps<T> = { | ||
| [K in keyof T]-?: {} extends Pick<T, K> ? { | ||
| type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>; | ||
| } : { | ||
| type: import('vue').PropType<T[K]>; | ||
| required: true; | ||
| }; | ||
| }; | ||
| type __VLS_WithDefaults<P, D> = { | ||
| [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & { | ||
| default: D[K]; | ||
| }> : P[K]; | ||
| }; | ||
| type __VLS_Prettify<T> = { | ||
| [K in keyof T]: T[K]; | ||
| } & {}; | ||
| type __VLS_WithTemplateSlots<T, S> = T & { | ||
| new (): { | ||
| $slots: S; | ||
| }; | ||
| }; |
| export { default as FzLink } from './FzLink.vue'; | ||
| export type * from './types'; |
| import { RouteLocationRaw } from 'vue-router'; | ||
| type FzLinkProps = { | ||
| /** | ||
| * Route Location the link should navigate to when clicked on. | ||
| */ | ||
| to: RouteLocationRaw; | ||
| /** | ||
| * Calls `router.replace` instead of `router.push`. | ||
| */ | ||
| replace?: boolean; | ||
| /** | ||
| * The purpose of the link | ||
| */ | ||
| type?: 'default' | 'danger'; | ||
| /** | ||
| * The appearance of the link | ||
| */ | ||
| linkStyle?: 'default' | 'underline'; | ||
| /** | ||
| * Size of the link | ||
| */ | ||
| size?: 'xs' | 'sm' | 'md' | 'lg'; | ||
| /** | ||
| * Whether the link is disabled | ||
| */ | ||
| disabled?: boolean; | ||
| /** | ||
| * Target of the link | ||
| */ | ||
| target?: string; | ||
| /** | ||
| * Whether the link is for an external page or not | ||
| */ | ||
| external?: boolean; | ||
| }; | ||
| export { FzLinkProps }; |
+21
| MIT License | ||
| Copyright (c) 2024 Fiscozen | ||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
Sorry, the diff of this file is not supported yet
+13
-13
| { | ||
| "name": "@fiscozen/link", | ||
| "version": "0.1.3", | ||
| "version": "0.1.4", | ||
| "description": "Design System Link component", | ||
| "scripts": { | ||
| "coverage": "vitest run --coverage", | ||
| "format": "prettier --write src/", | ||
| "test:unit": "vitest run", | ||
| "build": "vue-tsc && vite build" | ||
| }, | ||
| "main": "src/index.ts", | ||
@@ -21,5 +15,2 @@ "type": "module", | ||
| "devDependencies": { | ||
| "@fiscozen/eslint-config": "workspace:^", | ||
| "@fiscozen/prettier-config": "workspace:^", | ||
| "@fiscozen/tsconfig": "workspace:^", | ||
| "@rushstack/eslint-patch": "^1.3.3", | ||
@@ -39,5 +30,14 @@ "@types/jsdom": "^21.1.6", | ||
| "vitest": "^1.2.0", | ||
| "vue-tsc": "^1.8.25" | ||
| "vue-tsc": "^1.8.25", | ||
| "@fiscozen/eslint-config": "^0.1.0", | ||
| "@fiscozen/prettier-config": "^0.1.0", | ||
| "@fiscozen/tsconfig": "^0.1.0" | ||
| }, | ||
| "license": "MIT" | ||
| } | ||
| "license": "MIT", | ||
| "scripts": { | ||
| "coverage": "vitest run --coverage", | ||
| "format": "prettier --write src/", | ||
| "test:unit": "vitest run", | ||
| "build": "vue-tsc && vite build" | ||
| } | ||
| } |
+2
-2
@@ -23,7 +23,7 @@ <template> | ||
| replace: false, | ||
| external: false, | ||
| external: false | ||
| }) | ||
| const commonClass = computed(() => [ | ||
| 'border-1 border-transparent', | ||
| 'border-1 border-transparent inline-block', | ||
| { | ||
@@ -30,0 +30,0 @@ 'text-xs': props.size === 'xs', |
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
23756
191.23%20
66.67%389
72.89%0
-100%3
50%