@treeui/vue 0.20.0 → 0.21.0
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/components/TAppShell.vue.d.ts +1 -1
- package/dist/components/TAppShell.vue.d.ts.map +1 -1
- package/dist/components/TBrandLockup.cjs +2 -0
- package/dist/components/TBrandLockup.cjs.map +1 -0
- package/dist/components/TBrandLockup.js +7 -0
- package/dist/components/TBrandLockup.js.map +1 -0
- package/dist/components/TBrandLockup.vue.d.ts +43 -0
- package/dist/components/TBrandLockup.vue.d.ts.map +1 -0
- package/dist/components/TBrandLockup.vue_vue_type_script_setup_true_lang.cjs +2 -0
- package/dist/components/TBrandLockup.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/TBrandLockup.vue_vue_type_script_setup_true_lang.js +54 -0
- package/dist/components/TBrandLockup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/TButton.cjs.map +1 -1
- package/dist/components/TButton.js.map +1 -1
- package/dist/components/TButton.vue.d.ts.map +1 -1
- package/dist/components/TButton.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/TButton.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
- package/dist/components/TButton.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/components/TButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/TCheckbox.vue.d.ts +1 -1
- package/dist/components/TCheckbox.vue.d.ts.map +1 -1
- package/dist/components/TCodeBlock.cjs +2 -0
- package/dist/components/TCodeBlock.cjs.map +1 -0
- package/dist/components/TCodeBlock.js +7 -0
- package/dist/components/TCodeBlock.js.map +1 -0
- package/dist/components/TCodeBlock.vue.d.ts +47 -0
- package/dist/components/TCodeBlock.vue.d.ts.map +1 -0
- package/dist/components/TCodeBlock.vue_vue_type_script_setup_true_lang.cjs +2 -0
- package/dist/components/TCodeBlock.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/TCodeBlock.vue_vue_type_script_setup_true_lang.js +53 -0
- package/dist/components/TCodeBlock.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/TCombobox.vue.d.ts +2 -2
- package/dist/components/TCombobox.vue.d.ts.map +1 -1
- package/dist/components/TConfirmDialog.vue.d.ts +2 -2
- package/dist/components/TDatePicker.vue.d.ts +2 -2
- package/dist/components/TDatePicker.vue.d.ts.map +1 -1
- package/dist/components/TDateTimePicker.vue.d.ts +4 -4
- package/dist/components/TDateTimePicker.vue.d.ts.map +1 -1
- package/dist/components/TFileUpload.vue.d.ts +1 -1
- package/dist/components/TFileUpload.vue.d.ts.map +1 -1
- package/dist/components/TGrid.vue.d.ts +1 -1
- package/dist/components/TGrid.vue.d.ts.map +1 -1
- package/dist/components/TInput.vue.d.ts +1 -1
- package/dist/components/TInput.vue.d.ts.map +1 -1
- package/dist/components/TLanguageSelect.vue.d.ts +2 -2
- package/dist/components/TLanguageSelect.vue.d.ts.map +1 -1
- package/dist/components/TLanguageSelect.vue_vue_type_script_setup_true_lang.cjs +1 -1
- package/dist/components/TLanguageSelect.vue_vue_type_script_setup_true_lang.js +15 -15
- package/dist/components/TLinkTile.cjs +2 -0
- package/dist/components/TLinkTile.cjs.map +1 -0
- package/dist/components/TLinkTile.js +7 -0
- package/dist/components/TLinkTile.js.map +1 -0
- package/dist/components/TLinkTile.vue.d.ts +41 -0
- package/dist/components/TLinkTile.vue.d.ts.map +1 -0
- package/dist/components/TLinkTile.vue_vue_type_script_setup_true_lang.cjs +2 -0
- package/dist/components/TLinkTile.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
- package/dist/components/TLinkTile.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/components/TLinkTile.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/TMultiSelect.vue.d.ts +2 -2
- package/dist/components/TMultiSelect.vue.d.ts.map +1 -1
- package/dist/components/TNavMenu.vue.d.ts +1 -1
- package/dist/components/TNavMenu.vue.d.ts.map +1 -1
- package/dist/components/TNumberInput.vue.d.ts +1 -1
- package/dist/components/TNumberInput.vue.d.ts.map +1 -1
- package/dist/components/TPage.vue.d.ts +1 -1
- package/dist/components/TPage.vue.d.ts.map +1 -1
- package/dist/components/TPageHeader.vue.d.ts +1 -1
- package/dist/components/TPageHeader.vue.d.ts.map +1 -1
- package/dist/components/TRadioGroup.vue.d.ts +1 -1
- package/dist/components/TRadioGroup.vue.d.ts.map +1 -1
- package/dist/components/TSelect.vue.d.ts +2 -2
- package/dist/components/TSelect.vue.d.ts.map +1 -1
- package/dist/components/TSidebar.vue.d.ts +1 -1
- package/dist/components/TSidebar.vue.d.ts.map +1 -1
- package/dist/components/TSparkline.vue.d.ts +1 -1
- package/dist/components/TSparkline.vue.d.ts.map +1 -1
- package/dist/components/TSplit.vue.d.ts +1 -1
- package/dist/components/TSplit.vue.d.ts.map +1 -1
- package/dist/components/TStack.vue.d.ts +2 -2
- package/dist/components/TStack.vue.d.ts.map +1 -1
- package/dist/components/TTextarea.vue.d.ts +1 -1
- package/dist/components/TTextarea.vue.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +74 -71
- package/dist/index.cjs +1 -1
- package/dist/index.js +84 -81
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +148 -142
- package/dist/plugin.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -108,12 +108,12 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
|
|
|
108
108
|
}>, {
|
|
109
109
|
collapsible: boolean;
|
|
110
110
|
as: string;
|
|
111
|
+
collapsed: boolean;
|
|
111
112
|
mobile: boolean;
|
|
112
113
|
closeOnEscape: boolean;
|
|
113
114
|
closeOnOverlay: boolean;
|
|
114
115
|
closeLabel: string;
|
|
115
116
|
side: TSidebarSide;
|
|
116
|
-
collapsed: boolean;
|
|
117
117
|
defaultCollapsed: boolean;
|
|
118
118
|
collapsedWidth: string;
|
|
119
119
|
collapseLabel: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TAppShell.vue.d.ts","sourceRoot":"","sources":["../../src/components/TAppShell.vue"],"names":[],"mappings":"AAgoBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAUnD,KAAK,WAAW,GAAG;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAuCJ,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EA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ources":["../../src/components/TBrandLockup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, type Component } from 'vue';\nimport type { TSize } from '../types/contracts';\nimport TText from './TText.vue';\n\nconst props = withDefaults(\n defineProps<{\n /** Product name. Truncates on overflow. */\n title?: string;\n /** Optional supporting line under the title. Truncates on overflow. */\n subtitle?: string;\n size?: TSize;\n /**\n * Collapse to the logo only, hiding the text — for a shell's collapsed rail.\n * When collapsed and used as a link, supply an accessible name on the logo\n * (e.g. `alt` on the `<img>`) since the visible text is gone.\n */\n collapsed?: boolean;\n /** Native href. Renders the lockup as an anchor. */\n href?: string;\n /** Route target. Renders as RouterLink when vue-router is available. */\n to?: string | Record<string, unknown>;\n }>(),\n {\n title: undefined,\n subtitle: undefined,\n size: 'md',\n collapsed: false,\n href: undefined,\n to: undefined,\n },\n);\n\nconst instance = getCurrentInstance();\n\nconst routerLink = computed<Component | null>(() => {\n if (!props.to) return null;\n return (instance?.appContext.components.RouterLink as Component | undefined) ?? null;\n});\n\nconst isLink = computed(() => Boolean(props.href || props.to));\n\nconst tag = computed<string | Component>(() => {\n if (props.to && routerLink.value) return routerLink.value;\n if (isLink.value) return 'a';\n return 'div';\n});\n\nconst linkProps = computed(() => {\n if (props.to && routerLink.value) return { to: props.to };\n if (isLink.value) {\n return { href: props.href ?? (typeof props.to === 'string' ? props.to : undefined) };\n }\n return {};\n});\n\nconst classes = computed(() => [\n 't-brand-lockup',\n `t-brand-lockup--${props.size}`,\n { 'is-collapsed': props.collapsed },\n]);\n\nconst showText = computed(() => !props.collapsed && Boolean(props.title || props.subtitle));\n</script>\n\n<template>\n <component\n :is=\"tag\"\n v-bind=\"linkProps\"\n :class=\"classes\"\n >\n <span class=\"t-brand-lockup__logo\">\n <slot name=\"logo\" />\n </span>\n <span\n v-if=\"showText\"\n class=\"t-brand-lockup__text\"\n >\n <TText\n v-if=\"title\"\n as=\"span\"\n class=\"t-brand-lockup__title\"\n weight=\"semibold\"\n truncate\n >\n {{ title }}\n </TText>\n <TText\n v-if=\"subtitle\"\n as=\"span\"\n class=\"t-brand-lockup__subtitle\"\n tone=\"muted\"\n size=\"sm\"\n truncate\n >\n {{ subtitle }}\n </TText>\n </span>\n </component>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TBrandLockup.js","names":[],"sources":["../../src/components/TBrandLockup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, type Component } from 'vue';\nimport type { TSize } from '../types/contracts';\nimport TText from './TText.vue';\n\nconst props = withDefaults(\n defineProps<{\n /** Product name. Truncates on overflow. */\n title?: string;\n /** Optional supporting line under the title. Truncates on overflow. */\n subtitle?: string;\n size?: TSize;\n /**\n * Collapse to the logo only, hiding the text — for a shell's collapsed rail.\n * When collapsed and used as a link, supply an accessible name on the logo\n * (e.g. `alt` on the `<img>`) since the visible text is gone.\n */\n collapsed?: boolean;\n /** Native href. Renders the lockup as an anchor. */\n href?: string;\n /** Route target. Renders as RouterLink when vue-router is available. */\n to?: string | Record<string, unknown>;\n }>(),\n {\n title: undefined,\n subtitle: undefined,\n size: 'md',\n collapsed: false,\n href: undefined,\n to: undefined,\n },\n);\n\nconst instance = getCurrentInstance();\n\nconst routerLink = computed<Component | null>(() => {\n if (!props.to) return null;\n return (instance?.appContext.components.RouterLink as Component | undefined) ?? null;\n});\n\nconst isLink = computed(() => Boolean(props.href || props.to));\n\nconst tag = computed<string | Component>(() => {\n if (props.to && routerLink.value) return routerLink.value;\n if (isLink.value) return 'a';\n return 'div';\n});\n\nconst linkProps = computed(() => {\n if (props.to && routerLink.value) return { to: props.to };\n if (isLink.value) {\n return { href: props.href ?? (typeof props.to === 'string' ? props.to : undefined) };\n }\n return {};\n});\n\nconst classes = computed(() => [\n 't-brand-lockup',\n `t-brand-lockup--${props.size}`,\n { 'is-collapsed': props.collapsed },\n]);\n\nconst showText = computed(() => !props.collapsed && Boolean(props.title || props.subtitle));\n</script>\n\n<template>\n <component\n :is=\"tag\"\n v-bind=\"linkProps\"\n :class=\"classes\"\n >\n <span class=\"t-brand-lockup__logo\">\n <slot name=\"logo\" />\n </span>\n <span\n v-if=\"showText\"\n class=\"t-brand-lockup__text\"\n >\n <TText\n v-if=\"title\"\n as=\"span\"\n class=\"t-brand-lockup__title\"\n weight=\"semibold\"\n truncate\n >\n {{ title }}\n </TText>\n <TText\n v-if=\"subtitle\"\n as=\"span\"\n class=\"t-brand-lockup__subtitle\"\n tone=\"muted\"\n size=\"sm\"\n truncate\n >\n {{ subtitle }}\n </TText>\n </span>\n </component>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TSize } from '../types/contracts';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Product name. Truncates on overflow. */
|
|
4
|
+
title?: string;
|
|
5
|
+
/** Optional supporting line under the title. Truncates on overflow. */
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
size?: TSize;
|
|
8
|
+
/**
|
|
9
|
+
* Collapse to the logo only, hiding the text — for a shell's collapsed rail.
|
|
10
|
+
* When collapsed and used as a link, supply an accessible name on the logo
|
|
11
|
+
* (e.g. `alt` on the `<img>`) since the visible text is gone.
|
|
12
|
+
*/
|
|
13
|
+
collapsed?: boolean;
|
|
14
|
+
/** Native href. Renders the lockup as an anchor. */
|
|
15
|
+
href?: string;
|
|
16
|
+
/** Route target. Renders as RouterLink when vue-router is available. */
|
|
17
|
+
to?: string | Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
declare function __VLS_template(): {
|
|
20
|
+
attrs: Partial<{}>;
|
|
21
|
+
slots: {
|
|
22
|
+
logo?(_: {}): any;
|
|
23
|
+
};
|
|
24
|
+
refs: {};
|
|
25
|
+
rootEl: any;
|
|
26
|
+
};
|
|
27
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
28
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
29
|
+
size: TSize;
|
|
30
|
+
title: string;
|
|
31
|
+
href: string;
|
|
32
|
+
to: string | Record<string, unknown>;
|
|
33
|
+
subtitle: string;
|
|
34
|
+
collapsed: boolean;
|
|
35
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
36
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
37
|
+
export default _default;
|
|
38
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
39
|
+
new (): {
|
|
40
|
+
$slots: S;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=TBrandLockup.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TBrandLockup.vue.d.ts","sourceRoot":"","sources":["../../src/components/TBrandLockup.vue"],"names":[],"mappings":"AAuGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,KAAK,WAAW,GAAG;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,CAAC;AAsDJ,iBAAS,cAAc;WAoFT,OAAO,IAA6B;;sBAVxB,GAAG;;;;EAe5B;AAcD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;UAzKV,KAAK;WAHJ,MAAM;UAWP,MAAM;QAER,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;cAX1B,MAAM;eAOL,OAAO;6EA2KrB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./TText.cjs");let t=require("vue");var n={class:`t-brand-lockup__logo`},r={key:0,class:`t-brand-lockup__text`},i=(0,t.defineComponent)({__name:`TBrandLockup`,props:{title:{default:void 0},subtitle:{default:void 0},size:{default:`md`},collapsed:{type:Boolean,default:!1},href:{default:void 0},to:{default:void 0}},setup(i){let a=i,o=(0,t.getCurrentInstance)(),s=(0,t.computed)(()=>a.to?o?.appContext.components.RouterLink??null:null),c=(0,t.computed)(()=>!!(a.href||a.to)),l=(0,t.computed)(()=>a.to&&s.value?s.value:c.value?`a`:`div`),u=(0,t.computed)(()=>a.to&&s.value?{to:a.to}:c.value?{href:a.href??(typeof a.to==`string`?a.to:void 0)}:{}),d=(0,t.computed)(()=>[`t-brand-lockup`,`t-brand-lockup--${a.size}`,{"is-collapsed":a.collapsed}]),f=(0,t.computed)(()=>!a.collapsed&&!!(a.title||a.subtitle));return(a,o)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(l.value),(0,t.mergeProps)(u.value,{class:d.value}),{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,n,[(0,t.renderSlot)(a.$slots,`logo`)]),f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,r,[i.title?((0,t.openBlock)(),(0,t.createBlock)(e.default,{key:0,as:`span`,class:`t-brand-lockup__title`,weight:`semibold`,truncate:``},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(i.title),1)]),_:1})):(0,t.createCommentVNode)(``,!0),i.subtitle?((0,t.openBlock)(),(0,t.createBlock)(e.default,{key:1,as:`span`,class:`t-brand-lockup__subtitle`,tone:`muted`,size:`sm`,truncate:``},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(i.subtitle),1)]),_:1})):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0)]),_:3},16,[`class`]))}});exports.default=i;
|
|
2
|
+
//# sourceMappingURL=TBrandLockup.vue_vue_type_script_setup_true_lang.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TBrandLockup.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/components/TBrandLockup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, type Component } from 'vue';\nimport type { TSize } from '../types/contracts';\nimport TText from './TText.vue';\n\nconst props = withDefaults(\n defineProps<{\n /** Product name. Truncates on overflow. */\n title?: string;\n /** Optional supporting line under the title. Truncates on overflow. */\n subtitle?: string;\n size?: TSize;\n /**\n * Collapse to the logo only, hiding the text — for a shell's collapsed rail.\n * When collapsed and used as a link, supply an accessible name on the logo\n * (e.g. `alt` on the `<img>`) since the visible text is gone.\n */\n collapsed?: boolean;\n /** Native href. Renders the lockup as an anchor. */\n href?: string;\n /** Route target. Renders as RouterLink when vue-router is available. */\n to?: string | Record<string, unknown>;\n }>(),\n {\n title: undefined,\n subtitle: undefined,\n size: 'md',\n collapsed: false,\n href: undefined,\n to: undefined,\n },\n);\n\nconst instance = getCurrentInstance();\n\nconst routerLink = computed<Component | null>(() => {\n if (!props.to) return null;\n return (instance?.appContext.components.RouterLink as Component | undefined) ?? null;\n});\n\nconst isLink = computed(() => Boolean(props.href || props.to));\n\nconst tag = computed<string | Component>(() => {\n if (props.to && routerLink.value) return routerLink.value;\n if (isLink.value) return 'a';\n return 'div';\n});\n\nconst linkProps = computed(() => {\n if (props.to && routerLink.value) return { to: props.to };\n if (isLink.value) {\n return { href: props.href ?? (typeof props.to === 'string' ? props.to : undefined) };\n }\n return {};\n});\n\nconst classes = computed(() => [\n 't-brand-lockup',\n `t-brand-lockup--${props.size}`,\n { 'is-collapsed': props.collapsed },\n]);\n\nconst showText = computed(() => !props.collapsed && Boolean(props.title || props.subtitle));\n</script>\n\n<template>\n <component\n :is=\"tag\"\n v-bind=\"linkProps\"\n :class=\"classes\"\n >\n <span class=\"t-brand-lockup__logo\">\n <slot name=\"logo\" />\n </span>\n <span\n v-if=\"showText\"\n class=\"t-brand-lockup__text\"\n >\n <TText\n v-if=\"title\"\n as=\"span\"\n class=\"t-brand-lockup__title\"\n weight=\"semibold\"\n truncate\n >\n {{ title }}\n </TText>\n <TText\n v-if=\"subtitle\"\n as=\"span\"\n class=\"t-brand-lockup__subtitle\"\n tone=\"muted\"\n size=\"sm\"\n truncate\n >\n {{ subtitle }}\n </TText>\n </span>\n </component>\n</template>\n"],"mappings":"mVAKA,IAAM,EAAQ,EA4BR,GAAA,EAAA,EAAA,mBAAA,CAA8B,EAE9B,GAAA,EAAA,EAAA,SAAA,KACC,EAAM,GACH,GAAU,WAAW,WAAW,YAAwC,KAD1D,IAEvB,EAEK,GAAA,EAAA,EAAA,SAAA,KAAwB,GAAQ,EAAM,MAAQ,EAAM,GAAG,EAEvD,GAAA,EAAA,EAAA,SAAA,KACA,EAAM,IAAM,EAAW,MAAc,EAAW,MAChD,EAAO,MAAc,IAClB,KACR,EAEK,GAAA,EAAA,EAAA,SAAA,KACA,EAAM,IAAM,EAAW,MAAc,CAAE,GAAI,EAAM,EAAG,EACpD,EAAO,MACF,CAAE,KAAM,EAAM,OAAS,OAAO,EAAM,IAAO,SAAW,EAAM,GAAK,IAAA,GAAW,EAE9E,CAAC,CACT,EAEK,GAAA,EAAA,EAAA,SAAA,KAAyB,CAC7B,iBACA,mBAAmB,EAAM,OACzB,CAAE,eAAgB,EAAM,SAAU,CACpC,CAAC,EAEK,GAAA,EAAA,EAAA,SAAA,KAA0B,CAAC,EAAM,WAAa,GAAQ,EAAM,OAAS,EAAM,SAAS,kFAKjF,EAAA,KAAG,GAAA,EAAA,EAAA,WAAA,CACA,EA8BE,MA9BO,CAChB,MAAO,EAAA,KAAO,CAAA,EAAA,2BAIR,EAAA,EAAA,EAAA,mBAAA,CAAA,OAFP,EAEO,EAAA,EAAA,EAAA,WAAA,CADe,EAAA,OAAA,MAAA,CAAA,CAAA,EAGd,EAAA,QAAA,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,mBAAA,CAsBD,OAvBP,EAuBO,CAlBG,EAAA,QAAA,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,YAAA,CAOA,EAAA,QAAA,OANN,GAAG,OACH,MAAM,wBACN,OAAO,WACP,SAAA,+BAEW,EAAA,EAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,gBAAA,CAAR,EAAA,KAAK,EAAA,CAAA,CAAA,CAAA,yCAGF,EAAA,WAAA,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,YAAA,CAQA,EAAA,QAAA,OAPN,GAAG,OACH,MAAM,2BACN,KAAK,QACL,KAAK,KACL,SAAA,+BAEc,EAAA,EAAA,EAAA,gBAAA,EAAA,EAAA,EAAA,gBAAA,CAAX,EAAA,QAAQ,EAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import e from "./TText.js";
|
|
2
|
+
import { computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, defineComponent as s, getCurrentInstance as c, mergeProps as l, openBlock as u, renderSlot as d, resolveDynamicComponent as f, toDisplayString as p, withCtx as m } from "vue";
|
|
3
|
+
//#region src/components/TBrandLockup.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var h = { class: "t-brand-lockup__logo" }, g = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "t-brand-lockup__text"
|
|
7
|
+
}, _ = /*@__PURE__*/ s({
|
|
8
|
+
__name: "TBrandLockup",
|
|
9
|
+
props: {
|
|
10
|
+
title: { default: void 0 },
|
|
11
|
+
subtitle: { default: void 0 },
|
|
12
|
+
size: { default: "md" },
|
|
13
|
+
collapsed: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
},
|
|
17
|
+
href: { default: void 0 },
|
|
18
|
+
to: { default: void 0 }
|
|
19
|
+
},
|
|
20
|
+
setup(s) {
|
|
21
|
+
let _ = s, v = c(), y = t(() => _.to ? v?.appContext.components.RouterLink ?? null : null), b = t(() => !!(_.href || _.to)), x = t(() => _.to && y.value ? y.value : b.value ? "a" : "div"), S = t(() => _.to && y.value ? { to: _.to } : b.value ? { href: _.href ?? (typeof _.to == "string" ? _.to : void 0) } : {}), C = t(() => [
|
|
22
|
+
"t-brand-lockup",
|
|
23
|
+
`t-brand-lockup--${_.size}`,
|
|
24
|
+
{ "is-collapsed": _.collapsed }
|
|
25
|
+
]), w = t(() => !_.collapsed && !!(_.title || _.subtitle));
|
|
26
|
+
return (t, c) => (u(), n(f(x.value), l(S.value, { class: C.value }), {
|
|
27
|
+
default: m(() => [a("span", h, [d(t.$slots, "logo")]), w.value ? (u(), i("span", g, [s.title ? (u(), n(e, {
|
|
28
|
+
key: 0,
|
|
29
|
+
as: "span",
|
|
30
|
+
class: "t-brand-lockup__title",
|
|
31
|
+
weight: "semibold",
|
|
32
|
+
truncate: ""
|
|
33
|
+
}, {
|
|
34
|
+
default: m(() => [o(p(s.title), 1)]),
|
|
35
|
+
_: 1
|
|
36
|
+
})) : r("", !0), s.subtitle ? (u(), n(e, {
|
|
37
|
+
key: 1,
|
|
38
|
+
as: "span",
|
|
39
|
+
class: "t-brand-lockup__subtitle",
|
|
40
|
+
tone: "muted",
|
|
41
|
+
size: "sm",
|
|
42
|
+
truncate: ""
|
|
43
|
+
}, {
|
|
44
|
+
default: m(() => [o(p(s.subtitle), 1)]),
|
|
45
|
+
_: 1
|
|
46
|
+
})) : r("", !0)])) : r("", !0)]),
|
|
47
|
+
_: 3
|
|
48
|
+
}, 16, ["class"]));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
//#endregion
|
|
52
|
+
export { _ as default };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=TBrandLockup.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TBrandLockup.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/TBrandLockup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, getCurrentInstance, type Component } from 'vue';\nimport type { TSize } from '../types/contracts';\nimport TText from './TText.vue';\n\nconst props = withDefaults(\n defineProps<{\n /** Product name. Truncates on overflow. */\n title?: string;\n /** Optional supporting line under the title. Truncates on overflow. */\n subtitle?: string;\n size?: TSize;\n /**\n * Collapse to the logo only, hiding the text — for a shell's collapsed rail.\n * When collapsed and used as a link, supply an accessible name on the logo\n * (e.g. `alt` on the `<img>`) since the visible text is gone.\n */\n collapsed?: boolean;\n /** Native href. Renders the lockup as an anchor. */\n href?: string;\n /** Route target. Renders as RouterLink when vue-router is available. */\n to?: string | Record<string, unknown>;\n }>(),\n {\n title: undefined,\n subtitle: undefined,\n size: 'md',\n collapsed: false,\n href: undefined,\n to: undefined,\n },\n);\n\nconst instance = getCurrentInstance();\n\nconst routerLink = computed<Component | null>(() => {\n if (!props.to) return null;\n return (instance?.appContext.components.RouterLink as Component | undefined) ?? null;\n});\n\nconst isLink = computed(() => Boolean(props.href || props.to));\n\nconst tag = computed<string | Component>(() => {\n if (props.to && routerLink.value) return routerLink.value;\n if (isLink.value) return 'a';\n return 'div';\n});\n\nconst linkProps = computed(() => {\n if (props.to && routerLink.value) return { to: props.to };\n if (isLink.value) {\n return { href: props.href ?? (typeof props.to === 'string' ? props.to : undefined) };\n }\n return {};\n});\n\nconst classes = computed(() => [\n 't-brand-lockup',\n `t-brand-lockup--${props.size}`,\n { 'is-collapsed': props.collapsed },\n]);\n\nconst showText = computed(() => !props.collapsed && Boolean(props.title || props.subtitle));\n</script>\n\n<template>\n <component\n :is=\"tag\"\n v-bind=\"linkProps\"\n :class=\"classes\"\n >\n <span class=\"t-brand-lockup__logo\">\n <slot name=\"logo\" />\n </span>\n <span\n v-if=\"showText\"\n class=\"t-brand-lockup__text\"\n >\n <TText\n v-if=\"title\"\n as=\"span\"\n class=\"t-brand-lockup__title\"\n weight=\"semibold\"\n truncate\n >\n {{ title }}\n </TText>\n <TText\n v-if=\"subtitle\"\n as=\"span\"\n class=\"t-brand-lockup__subtitle\"\n tone=\"muted\"\n size=\"sm\"\n truncate\n >\n {{ subtitle }}\n </TText>\n </span>\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAKA,IAAM,IAAQ,GA4BR,IAAW,EAAmB,GAE9B,IAAa,QACZ,EAAM,KACH,GAAU,WAAW,WAAW,cAAwC,OAD1D,IAEvB,GAEK,IAAS,QAAe,GAAQ,EAAM,QAAQ,EAAM,GAAG,GAEvD,IAAM,QACN,EAAM,MAAM,EAAW,QAAc,EAAW,QAChD,EAAO,QAAc,MAClB,KACR,GAEK,IAAY,QACZ,EAAM,MAAM,EAAW,QAAc,EAAE,IAAI,EAAM,GAAG,IACpD,EAAO,QACF,EAAE,MAAM,EAAM,SAAS,OAAO,EAAM,MAAO,WAAW,EAAM,KAAK,KAAA,GAAW,IAE9E,CAAC,CACT,GAEK,IAAU,QAAe;GAC7B;GACA,mBAAmB,EAAM;GACzB,EAAE,gBAAgB,EAAM,UAAU;EACpC,CAAC,GAEK,IAAW,QAAe,CAAC,EAAM,aAAa,GAAQ,EAAM,SAAS,EAAM,SAAS;yBAIxF,EAgCY,EA/BL,EAAA,KAAG,GADV,EAEU,EA8BE,OA9BO,EAChB,OAAO,EAAA,MAAO,CAAA,GAAA;oBAIR,CAFP,EAEO,QAFP,GAEO,CADL,EAAoB,EAAA,QAAA,MAAA,CAAA,CAAA,GAGd,EAAA,SAAA,EAAA,GADR,EAuBO,QAvBP,GAuBO,CAlBG,EAAA,SAAA,EAAA,GADR,EAQQ,GAAA;;IANN,IAAG;IACH,OAAM;IACN,QAAO;IACP,UAAA;;qBAEW,CAAA,EAAA,EAAR,EAAA,KAAK,GAAA,CAAA,CAAA,CAAA;;oBAGF,EAAA,YAAA,EAAA,GADR,EASQ,GAAA;;IAPN,IAAG;IACH,OAAM;IACN,MAAK;IACL,MAAK;IACL,UAAA;;qBAEc,CAAA,EAAA,EAAX,EAAA,QAAQ,GAAA,CAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TButton.cjs","names":[],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\
|
|
1
|
+
{"version":3,"file":"TButton.cjs","names":[],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n as?: string;\n variant?: TVariant | 'brand';\n size?: TSize;\n disabled?: boolean;\n loading?: boolean;\n /**\n * Accessible announcement while `loading`, forwarded to the spinner.\n * The default is English; pass the active locale's string to localize it.\n */\n loadingLabel?: string;\n /**\n * While `loading`, hide the `icon` slot so the spinner replaces the icon\n * instead of rendering beside it. Set to `false` to keep both visible.\n */\n hideIconWhileLoading?: boolean;\n /**\n * Square, icon-only button. The visible label is dropped, so an accessible\n * name is required — pass `label` (or `aria-label`).\n */\n iconOnly?: boolean;\n /** Accessible name, rendered as `aria-label`. Required when `iconOnly`. */\n label?: string;\n type?: 'button' | 'submit' | 'reset';\n /** Stretch to the full width of the container. */\n block?: boolean;\n /** Content alignment — only meaningful together with `block`. */\n align?: 'start' | 'center' | 'end';\n }>(),\n {\n as: 'button',\n variant: 'solid',\n size: 'md',\n disabled: false,\n loading: false,\n loadingLabel: 'Loading',\n hideIconWhileLoading: true,\n iconOnly: false,\n label: undefined,\n type: 'button',\n block: false,\n align: 'center',\n },\n);\n\nconst emit = defineEmits<{\n click: [event: MouseEvent];\n}>();\n\nconst buttonClass = tv({\n base: 't-button',\n variants: {\n variant: {\n solid: 't-button--solid',\n outline: 't-button--outline',\n ghost: 't-button--ghost',\n soft: 't-button--soft',\n danger: 't-button--danger',\n brand: 't-button--brand',\n },\n size: {\n sm: 't-button--sm',\n md: 't-button--md',\n lg: 't-button--lg',\n },\n },\n});\n\nconst attrs = useAttrs();\nconst isNativeButton = computed(() => props.as === 'button');\nconst isDisabled = computed(() => props.disabled || props.loading);\n\n// An icon-only button has no visible text and an aria-hidden icon, so without a\n// name it is unlabelled for assistive tech. This is a BARE `process.env.NODE_ENV`\n// compare, inlined (no `typeof process` guard, no function wrapper): the\n// consumer's bundler statically replaces it, so the whole block runs in their\n// dev build and is dead-code-eliminated — string literals included — from their\n// production build. A `typeof process` guard would be `false` in the browser\n// (where `process` does not exist), silently disabling the warning; a function\n// wrapper would be opaque to tree-shaking. TreeUI's own build keeps\n// `process.env.NODE_ENV` as a runtime reference (vite.config `define`) so the\n// decision belongs to the consumer's environment, not this build.\nif (process.env.NODE_ENV !== 'production') {\n watchEffect(() => {\n if (\n props.iconOnly &&\n !props.label &&\n !attrs['aria-label'] &&\n !attrs['aria-labelledby']\n ) {\n console.warn(\n '[TButton] `iconOnly` needs an accessible name — pass the `label` prop (or `aria-label`).',\n );\n }\n });\n}\n\n// The spinner takes the icon's leading position, so rendering both would show\n// two glyphs and widen the button mid-action.\nconst isIconHidden = computed(() => props.loading && props.hideIconWhileLoading);\n\nconst classes = computed(() =>\n buttonClass({\n variant: props.variant,\n size: props.size,\n class: {\n 'is-loading': props.loading,\n 'is-disabled': isDisabled.value,\n 't-button--block': props.block,\n 't-button--icon': props.iconOnly,\n 't-button--align-start': props.align === 'start',\n 't-button--align-end': props.align === 'end',\n },\n }),\n);\n\nconst onClick = (event: MouseEvent) => {\n if (isDisabled.value) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n emit('click', event);\n};\n</script>\n\n<template>\n <component\n :is=\"as\"\n :type=\"isNativeButton ? type : undefined\"\n :class=\"classes\"\n :disabled=\"isNativeButton ? isDisabled : undefined\"\n :aria-disabled=\"!isNativeButton && isDisabled ? 'true' : undefined\"\n :aria-busy=\"loading || undefined\"\n :aria-label=\"label\"\n :tabindex=\"!isNativeButton && isDisabled ? -1 : undefined\"\n @click=\"onClick\"\n >\n <span\n v-if=\"loading\"\n class=\"t-button__spinner\"\n >\n <TSpinner\n size=\"sm\"\n :label=\"loadingLabel\"\n />\n </span>\n <span\n v-if=\"$slots.icon && !isIconHidden\"\n class=\"t-button__icon\"\n aria-hidden=\"true\"\n >\n <slot name=\"icon\" />\n </span>\n <span\n v-if=\"!iconOnly\"\n class=\"t-button__label\"\n >\n <slot />\n </span>\n </component>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TButton.js","names":[],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\
|
|
1
|
+
{"version":3,"file":"TButton.js","names":[],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n as?: string;\n variant?: TVariant | 'brand';\n size?: TSize;\n disabled?: boolean;\n loading?: boolean;\n /**\n * Accessible announcement while `loading`, forwarded to the spinner.\n * The default is English; pass the active locale's string to localize it.\n */\n loadingLabel?: string;\n /**\n * While `loading`, hide the `icon` slot so the spinner replaces the icon\n * instead of rendering beside it. Set to `false` to keep both visible.\n */\n hideIconWhileLoading?: boolean;\n /**\n * Square, icon-only button. The visible label is dropped, so an accessible\n * name is required — pass `label` (or `aria-label`).\n */\n iconOnly?: boolean;\n /** Accessible name, rendered as `aria-label`. Required when `iconOnly`. */\n label?: string;\n type?: 'button' | 'submit' | 'reset';\n /** Stretch to the full width of the container. */\n block?: boolean;\n /** Content alignment — only meaningful together with `block`. */\n align?: 'start' | 'center' | 'end';\n }>(),\n {\n as: 'button',\n variant: 'solid',\n size: 'md',\n disabled: false,\n loading: false,\n loadingLabel: 'Loading',\n hideIconWhileLoading: true,\n iconOnly: false,\n label: undefined,\n type: 'button',\n block: false,\n align: 'center',\n },\n);\n\nconst emit = defineEmits<{\n click: [event: MouseEvent];\n}>();\n\nconst buttonClass = tv({\n base: 't-button',\n variants: {\n variant: {\n solid: 't-button--solid',\n outline: 't-button--outline',\n ghost: 't-button--ghost',\n soft: 't-button--soft',\n danger: 't-button--danger',\n brand: 't-button--brand',\n },\n size: {\n sm: 't-button--sm',\n md: 't-button--md',\n lg: 't-button--lg',\n },\n },\n});\n\nconst attrs = useAttrs();\nconst isNativeButton = computed(() => props.as === 'button');\nconst isDisabled = computed(() => props.disabled || props.loading);\n\n// An icon-only button has no visible text and an aria-hidden icon, so without a\n// name it is unlabelled for assistive tech. This is a BARE `process.env.NODE_ENV`\n// compare, inlined (no `typeof process` guard, no function wrapper): the\n// consumer's bundler statically replaces it, so the whole block runs in their\n// dev build and is dead-code-eliminated — string literals included — from their\n// production build. A `typeof process` guard would be `false` in the browser\n// (where `process` does not exist), silently disabling the warning; a function\n// wrapper would be opaque to tree-shaking. TreeUI's own build keeps\n// `process.env.NODE_ENV` as a runtime reference (vite.config `define`) so the\n// decision belongs to the consumer's environment, not this build.\nif (process.env.NODE_ENV !== 'production') {\n watchEffect(() => {\n if (\n props.iconOnly &&\n !props.label &&\n !attrs['aria-label'] &&\n !attrs['aria-labelledby']\n ) {\n console.warn(\n '[TButton] `iconOnly` needs an accessible name — pass the `label` prop (or `aria-label`).',\n );\n }\n });\n}\n\n// The spinner takes the icon's leading position, so rendering both would show\n// two glyphs and widen the button mid-action.\nconst isIconHidden = computed(() => props.loading && props.hideIconWhileLoading);\n\nconst classes = computed(() =>\n buttonClass({\n variant: props.variant,\n size: props.size,\n class: {\n 'is-loading': props.loading,\n 'is-disabled': isDisabled.value,\n 't-button--block': props.block,\n 't-button--icon': props.iconOnly,\n 't-button--align-start': props.align === 'start',\n 't-button--align-end': props.align === 'end',\n },\n }),\n);\n\nconst onClick = (event: MouseEvent) => {\n if (isDisabled.value) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n emit('click', event);\n};\n</script>\n\n<template>\n <component\n :is=\"as\"\n :type=\"isNativeButton ? type : undefined\"\n :class=\"classes\"\n :disabled=\"isNativeButton ? isDisabled : undefined\"\n :aria-disabled=\"!isNativeButton && isDisabled ? 'true' : undefined\"\n :aria-busy=\"loading || undefined\"\n :aria-label=\"label\"\n :tabindex=\"!isNativeButton && isDisabled ? -1 : undefined\"\n @click=\"onClick\"\n >\n <span\n v-if=\"loading\"\n class=\"t-button__spinner\"\n >\n <TSpinner\n size=\"sm\"\n :label=\"loadingLabel\"\n />\n </span>\n <span\n v-if=\"$slots.icon && !isIconHidden\"\n class=\"t-button__icon\"\n aria-hidden=\"true\"\n >\n <slot name=\"icon\" />\n </span>\n <span\n v-if=\"!iconOnly\"\n class=\"t-button__label\"\n >\n <slot />\n </span>\n </component>\n</template>\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TButton.vue.d.ts","sourceRoot":"","sources":["../../src/components/TButton.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TButton.vue.d.ts","sourceRoot":"","sources":["../../src/components/TButton.vue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AAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./TSpinner.cjs");let t=require("vue"),n=require("@treeui/utils");var r={key:0,class:`t-button__spinner`},i={key:1,class:`t-button__icon`,"aria-hidden":`true`},a={key:2,class:`t-button__label`},o=(0,t.defineComponent)({__name:`TButton`,props:{as:{default:`button`},variant:{default:`solid`},size:{default:`md`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingLabel:{default:`Loading`},hideIconWhileLoading:{type:Boolean,default:!0},iconOnly:{type:Boolean,default:!1},label:{default:void 0},type:{default:`button`},block:{type:Boolean,default:!1},align:{default:`center`}},emits:[`click`],setup(o,{emit:s}){let c=
|
|
1
|
+
const e=require("./TSpinner.cjs");let t=require("vue"),n=require("@treeui/utils");var r={key:0,class:`t-button__spinner`},i={key:1,class:`t-button__icon`,"aria-hidden":`true`},a={key:2,class:`t-button__label`},o=(0,t.defineComponent)({__name:`TButton`,props:{as:{default:`button`},variant:{default:`solid`},size:{default:`md`},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingLabel:{default:`Loading`},hideIconWhileLoading:{type:Boolean,default:!0},iconOnly:{type:Boolean,default:!1},label:{default:void 0},type:{default:`button`},block:{type:Boolean,default:!1},align:{default:`center`}},emits:[`click`],setup(o,{emit:s}){let c=o,l=s,u=(0,n.tv)({base:`t-button`,variants:{variant:{solid:`t-button--solid`,outline:`t-button--outline`,ghost:`t-button--ghost`,soft:`t-button--soft`,danger:`t-button--danger`,brand:`t-button--brand`},size:{sm:`t-button--sm`,md:`t-button--md`,lg:`t-button--lg`}}}),d=(0,t.useAttrs)(),f=(0,t.computed)(()=>c.as===`button`),p=(0,t.computed)(()=>c.disabled||c.loading);process.env.NODE_ENV!==`production`&&(0,t.watchEffect)(()=>{c.iconOnly&&!c.label&&!d[`aria-label`]&&!d[`aria-labelledby`]&&console.warn("[TButton] `iconOnly` needs an accessible name — pass the `label` prop (or `aria-label`).")});let m=(0,t.computed)(()=>c.loading&&c.hideIconWhileLoading),h=(0,t.computed)(()=>u({variant:c.variant,size:c.size,class:{"is-loading":c.loading,"is-disabled":p.value,"t-button--block":c.block,"t-button--icon":c.iconOnly,"t-button--align-start":c.align===`start`,"t-button--align-end":c.align===`end`}})),g=e=>{if(p.value){e.preventDefault(),e.stopPropagation();return}l(`click`,e)};return(n,s)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(o.as),{type:f.value?o.type:void 0,class:(0,t.normalizeClass)(h.value),disabled:f.value?p.value:void 0,"aria-disabled":!f.value&&p.value?`true`:void 0,"aria-busy":o.loading||void 0,"aria-label":o.label,tabindex:!f.value&&p.value?-1:void 0,onClick:g},{default:(0,t.withCtx)(()=>[o.loading?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,r,[(0,t.createVNode)(e.default,{size:`sm`,label:o.loadingLabel},null,8,[`label`])])):(0,t.createCommentVNode)(``,!0),n.$slots.icon&&!m.value?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,i,[(0,t.renderSlot)(n.$slots,`icon`)])):(0,t.createCommentVNode)(``,!0),o.iconOnly?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,a,[(0,t.renderSlot)(n.$slots,`default`)]))]),_:3},8,[`type`,`class`,`disabled`,`aria-disabled`,`aria-busy`,`aria-label`,`tabindex`]))}});exports.default=o;
|
|
2
2
|
//# sourceMappingURL=TButton.vue_vue_type_script_setup_true_lang.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TButton.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\
|
|
1
|
+
{"version":3,"file":"TButton.vue_vue_type_script_setup_true_lang.cjs","names":["$slots"],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n as?: string;\n variant?: TVariant | 'brand';\n size?: TSize;\n disabled?: boolean;\n loading?: boolean;\n /**\n * Accessible announcement while `loading`, forwarded to the spinner.\n * The default is English; pass the active locale's string to localize it.\n */\n loadingLabel?: string;\n /**\n * While `loading`, hide the `icon` slot so the spinner replaces the icon\n * instead of rendering beside it. Set to `false` to keep both visible.\n */\n hideIconWhileLoading?: boolean;\n /**\n * Square, icon-only button. The visible label is dropped, so an accessible\n * name is required — pass `label` (or `aria-label`).\n */\n iconOnly?: boolean;\n /** Accessible name, rendered as `aria-label`. Required when `iconOnly`. */\n label?: string;\n type?: 'button' | 'submit' | 'reset';\n /** Stretch to the full width of the container. */\n block?: boolean;\n /** Content alignment — only meaningful together with `block`. */\n align?: 'start' | 'center' | 'end';\n }>(),\n {\n as: 'button',\n variant: 'solid',\n size: 'md',\n disabled: false,\n loading: false,\n loadingLabel: 'Loading',\n hideIconWhileLoading: true,\n iconOnly: false,\n label: undefined,\n type: 'button',\n block: false,\n align: 'center',\n },\n);\n\nconst emit = defineEmits<{\n click: [event: MouseEvent];\n}>();\n\nconst buttonClass = tv({\n base: 't-button',\n variants: {\n variant: {\n solid: 't-button--solid',\n outline: 't-button--outline',\n ghost: 't-button--ghost',\n soft: 't-button--soft',\n danger: 't-button--danger',\n brand: 't-button--brand',\n },\n size: {\n sm: 't-button--sm',\n md: 't-button--md',\n lg: 't-button--lg',\n },\n },\n});\n\nconst attrs = useAttrs();\nconst isNativeButton = computed(() => props.as === 'button');\nconst isDisabled = computed(() => props.disabled || props.loading);\n\n// An icon-only button has no visible text and an aria-hidden icon, so without a\n// name it is unlabelled for assistive tech. This is a BARE `process.env.NODE_ENV`\n// compare, inlined (no `typeof process` guard, no function wrapper): the\n// consumer's bundler statically replaces it, so the whole block runs in their\n// dev build and is dead-code-eliminated — string literals included — from their\n// production build. A `typeof process` guard would be `false` in the browser\n// (where `process` does not exist), silently disabling the warning; a function\n// wrapper would be opaque to tree-shaking. TreeUI's own build keeps\n// `process.env.NODE_ENV` as a runtime reference (vite.config `define`) so the\n// decision belongs to the consumer's environment, not this build.\nif (process.env.NODE_ENV !== 'production') {\n watchEffect(() => {\n if (\n props.iconOnly &&\n !props.label &&\n !attrs['aria-label'] &&\n !attrs['aria-labelledby']\n ) {\n console.warn(\n '[TButton] `iconOnly` needs an accessible name — pass the `label` prop (or `aria-label`).',\n );\n }\n });\n}\n\n// The spinner takes the icon's leading position, so rendering both would show\n// two glyphs and widen the button mid-action.\nconst isIconHidden = computed(() => props.loading && props.hideIconWhileLoading);\n\nconst classes = computed(() =>\n buttonClass({\n variant: props.variant,\n size: props.size,\n class: {\n 'is-loading': props.loading,\n 'is-disabled': isDisabled.value,\n 't-button--block': props.block,\n 't-button--icon': props.iconOnly,\n 't-button--align-start': props.align === 'start',\n 't-button--align-end': props.align === 'end',\n },\n }),\n);\n\nconst onClick = (event: MouseEvent) => {\n if (isDisabled.value) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n emit('click', event);\n};\n</script>\n\n<template>\n <component\n :is=\"as\"\n :type=\"isNativeButton ? type : undefined\"\n :class=\"classes\"\n :disabled=\"isNativeButton ? isDisabled : undefined\"\n :aria-disabled=\"!isNativeButton && isDisabled ? 'true' : undefined\"\n :aria-busy=\"loading || undefined\"\n :aria-label=\"label\"\n :tabindex=\"!isNativeButton && isDisabled ? -1 : undefined\"\n @click=\"onClick\"\n >\n <span\n v-if=\"loading\"\n class=\"t-button__spinner\"\n >\n <TSpinner\n size=\"sm\"\n :label=\"loadingLabel\"\n />\n </span>\n <span\n v-if=\"$slots.icon && !isIconHidden\"\n class=\"t-button__icon\"\n aria-hidden=\"true\"\n >\n <slot name=\"icon\" />\n </span>\n <span\n v-if=\"!iconOnly\"\n class=\"t-button__label\"\n >\n <slot />\n </span>\n </component>\n</template>\n"],"mappings":"0oBAMA,IAAM,EAAQ,EA8CR,EAAO,EAIP,GAAA,EAAA,EAAA,GAAA,CAAiB,CACrB,KAAM,WACN,SAAU,CACR,QAAS,CACP,MAAO,kBACP,QAAS,oBACT,MAAO,kBACP,KAAM,iBACN,OAAQ,mBACR,MAAO,iBACT,EACA,KAAM,CACJ,GAAI,eACJ,GAAI,eACJ,GAAI,cACN,CACF,CACF,CAAC,EAEK,GAAA,EAAA,EAAA,SAAA,CAAiB,EACjB,GAAA,EAAA,EAAA,SAAA,KAAgC,EAAM,KAAO,QAAQ,EACrD,GAAA,EAAA,EAAA,SAAA,KAA4B,EAAM,UAAY,EAAM,OAAO,EAYjE,QAAA,IAAA,WAA6B,eAC3B,EAAA,EAAA,YAAA,KAAkB,CAEd,EAAM,UACN,CAAC,EAAM,OACP,CAAC,EAAM,eACP,CAAC,EAAM,oBAEP,QAAQ,KACN,0FACF,CAEJ,CAAC,EAKH,IAAM,GAAA,EAAA,EAAA,SAAA,KAA8B,EAAM,SAAW,EAAM,oBAAoB,EAEzE,GAAA,EAAA,EAAA,SAAA,KACJ,EAAY,CACV,QAAS,EAAM,QACf,KAAM,EAAM,KACZ,MAAO,CACL,aAAc,EAAM,QACpB,cAAe,EAAW,MAC1B,kBAAmB,EAAM,MACzB,iBAAkB,EAAM,SACxB,wBAAyB,EAAM,QAAU,QACzC,sBAAuB,EAAM,QAAU,KACzC,CACF,CAAC,CACH,EAEM,EAAW,GAAsB,CACrC,GAAI,EAAW,MAAO,CACpB,EAAM,eAAe,EACrB,EAAM,gBAAgB,EACtB,MACF,CAEA,EAAK,QAAS,CAAK,CACrB,kFAKS,EAAA,EAAE,EAAA,CACN,KAAM,EAAA,MAAiB,EAAA,KAAO,IAAA,GAC9B,OAAA,EAAA,EAAA,eAAA,CAAO,EAAA,KAAO,EACd,SAAU,EAAA,MAAiB,EAAA,MAAa,IAAA,GACxC,gBAAa,CAAG,EAAA,OAAkB,EAAA,MAAU,OAAY,IAAA,GACxD,YAAW,EAAA,SAAW,IAAA,GACtB,aAAY,EAAA,MACZ,SAAQ,CAAG,EAAA,OAAkB,EAAA,MAAU,GAAQ,IAAA,GACxC,sCAUD,CAPC,EAAA,UAAA,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,mBAAA,CAOD,OARP,EAQO,EAAA,EAAA,EAAA,YAAA,CADH,EAAA,QAAA,CAFA,KAAK,KACJ,MAAO,EAAA,mEAIJA,EAAAA,OAAO,MAAI,CAAK,EAAA,QAAA,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,mBAAA,CAKjB,OANP,EAMO,EAAA,EAAA,EAAA,WAAA,CADe,EAAA,OAAA,MAAA,CAAA,CAAA,IAAA,EAAA,EAAA,mBAAA,CAAA,GAAA,EAAA,EAGb,EAAA,UAGC,EAAA,EAAA,mBAAA,CAAA,GAAA,EAAA,IAHD,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,mBAAA,CAIF,OALP,EAKO,EAAA,EAAA,EAAA,WAAA,CADG,EAAA,OAAA,SAAA,CAAA,CAAA"}
|
|
@@ -45,7 +45,7 @@ var h = {
|
|
|
45
45
|
},
|
|
46
46
|
emits: ["click"],
|
|
47
47
|
setup(o, { emit: v }) {
|
|
48
|
-
let y =
|
|
48
|
+
let y = o, b = v, x = m({
|
|
49
49
|
base: "t-button",
|
|
50
50
|
variants: {
|
|
51
51
|
variant: {
|
|
@@ -62,44 +62,44 @@ var h = {
|
|
|
62
62
|
lg: "t-button--lg"
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
}),
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
}), S = d(), C = t(() => y.as === "button"), w = t(() => y.disabled || y.loading);
|
|
66
|
+
process.env.NODE_ENV !== "production" && f(() => {
|
|
67
|
+
y.iconOnly && !y.label && !S["aria-label"] && !S["aria-labelledby"] && console.warn("[TButton] `iconOnly` needs an accessible name — pass the `label` prop (or `aria-label`).");
|
|
68
68
|
});
|
|
69
|
-
let
|
|
70
|
-
variant:
|
|
71
|
-
size:
|
|
69
|
+
let T = t(() => y.loading && y.hideIconWhileLoading), E = t(() => x({
|
|
70
|
+
variant: y.variant,
|
|
71
|
+
size: y.size,
|
|
72
72
|
class: {
|
|
73
|
-
"is-loading":
|
|
74
|
-
"is-disabled":
|
|
75
|
-
"t-button--block":
|
|
76
|
-
"t-button--icon":
|
|
77
|
-
"t-button--align-start":
|
|
78
|
-
"t-button--align-end":
|
|
73
|
+
"is-loading": y.loading,
|
|
74
|
+
"is-disabled": w.value,
|
|
75
|
+
"t-button--block": y.block,
|
|
76
|
+
"t-button--icon": y.iconOnly,
|
|
77
|
+
"t-button--align-start": y.align === "start",
|
|
78
|
+
"t-button--align-end": y.align === "end"
|
|
79
79
|
}
|
|
80
|
-
})),
|
|
81
|
-
if (
|
|
80
|
+
})), D = (e) => {
|
|
81
|
+
if (w.value) {
|
|
82
82
|
e.preventDefault(), e.stopPropagation();
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
b("click", e);
|
|
86
86
|
};
|
|
87
87
|
return (t, d) => (c(), n(u(o.as), {
|
|
88
|
-
type:
|
|
89
|
-
class: s(
|
|
90
|
-
disabled:
|
|
91
|
-
"aria-disabled": !
|
|
88
|
+
type: C.value ? o.type : void 0,
|
|
89
|
+
class: s(E.value),
|
|
90
|
+
disabled: C.value ? w.value : void 0,
|
|
91
|
+
"aria-disabled": !C.value && w.value ? "true" : void 0,
|
|
92
92
|
"aria-busy": o.loading || void 0,
|
|
93
93
|
"aria-label": o.label,
|
|
94
|
-
tabindex: !
|
|
95
|
-
onClick:
|
|
94
|
+
tabindex: !C.value && w.value ? -1 : void 0,
|
|
95
|
+
onClick: D
|
|
96
96
|
}, {
|
|
97
97
|
default: p(() => [
|
|
98
98
|
o.loading ? (c(), i("span", h, [a(e, {
|
|
99
99
|
size: "sm",
|
|
100
100
|
label: o.loadingLabel
|
|
101
101
|
}, null, 8, ["label"])])) : r("", !0),
|
|
102
|
-
t.$slots.icon && !
|
|
102
|
+
t.$slots.icon && !T.value ? (c(), i("span", g, [l(t.$slots, "icon")])) : r("", !0),
|
|
103
103
|
o.iconOnly ? r("", !0) : (c(), i("span", _, [l(t.$slots, "default")]))
|
|
104
104
|
]),
|
|
105
105
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TButton.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\
|
|
1
|
+
{"version":3,"file":"TButton.vue_vue_type_script_setup_true_lang.js","names":["$slots"],"sources":["../../src/components/TButton.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useAttrs, watchEffect } from 'vue';\nimport { tv } from '@treeui/utils';\nimport type { TSize, TVariant } from '../types/contracts';\nimport TSpinner from './TSpinner.vue';\n\nconst props = withDefaults(\n defineProps<{\n as?: string;\n variant?: TVariant | 'brand';\n size?: TSize;\n disabled?: boolean;\n loading?: boolean;\n /**\n * Accessible announcement while `loading`, forwarded to the spinner.\n * The default is English; pass the active locale's string to localize it.\n */\n loadingLabel?: string;\n /**\n * While `loading`, hide the `icon` slot so the spinner replaces the icon\n * instead of rendering beside it. Set to `false` to keep both visible.\n */\n hideIconWhileLoading?: boolean;\n /**\n * Square, icon-only button. The visible label is dropped, so an accessible\n * name is required — pass `label` (or `aria-label`).\n */\n iconOnly?: boolean;\n /** Accessible name, rendered as `aria-label`. Required when `iconOnly`. */\n label?: string;\n type?: 'button' | 'submit' | 'reset';\n /** Stretch to the full width of the container. */\n block?: boolean;\n /** Content alignment — only meaningful together with `block`. */\n align?: 'start' | 'center' | 'end';\n }>(),\n {\n as: 'button',\n variant: 'solid',\n size: 'md',\n disabled: false,\n loading: false,\n loadingLabel: 'Loading',\n hideIconWhileLoading: true,\n iconOnly: false,\n label: undefined,\n type: 'button',\n block: false,\n align: 'center',\n },\n);\n\nconst emit = defineEmits<{\n click: [event: MouseEvent];\n}>();\n\nconst buttonClass = tv({\n base: 't-button',\n variants: {\n variant: {\n solid: 't-button--solid',\n outline: 't-button--outline',\n ghost: 't-button--ghost',\n soft: 't-button--soft',\n danger: 't-button--danger',\n brand: 't-button--brand',\n },\n size: {\n sm: 't-button--sm',\n md: 't-button--md',\n lg: 't-button--lg',\n },\n },\n});\n\nconst attrs = useAttrs();\nconst isNativeButton = computed(() => props.as === 'button');\nconst isDisabled = computed(() => props.disabled || props.loading);\n\n// An icon-only button has no visible text and an aria-hidden icon, so without a\n// name it is unlabelled for assistive tech. This is a BARE `process.env.NODE_ENV`\n// compare, inlined (no `typeof process` guard, no function wrapper): the\n// consumer's bundler statically replaces it, so the whole block runs in their\n// dev build and is dead-code-eliminated — string literals included — from their\n// production build. A `typeof process` guard would be `false` in the browser\n// (where `process` does not exist), silently disabling the warning; a function\n// wrapper would be opaque to tree-shaking. TreeUI's own build keeps\n// `process.env.NODE_ENV` as a runtime reference (vite.config `define`) so the\n// decision belongs to the consumer's environment, not this build.\nif (process.env.NODE_ENV !== 'production') {\n watchEffect(() => {\n if (\n props.iconOnly &&\n !props.label &&\n !attrs['aria-label'] &&\n !attrs['aria-labelledby']\n ) {\n console.warn(\n '[TButton] `iconOnly` needs an accessible name — pass the `label` prop (or `aria-label`).',\n );\n }\n });\n}\n\n// The spinner takes the icon's leading position, so rendering both would show\n// two glyphs and widen the button mid-action.\nconst isIconHidden = computed(() => props.loading && props.hideIconWhileLoading);\n\nconst classes = computed(() =>\n buttonClass({\n variant: props.variant,\n size: props.size,\n class: {\n 'is-loading': props.loading,\n 'is-disabled': isDisabled.value,\n 't-button--block': props.block,\n 't-button--icon': props.iconOnly,\n 't-button--align-start': props.align === 'start',\n 't-button--align-end': props.align === 'end',\n },\n }),\n);\n\nconst onClick = (event: MouseEvent) => {\n if (isDisabled.value) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n emit('click', event);\n};\n</script>\n\n<template>\n <component\n :is=\"as\"\n :type=\"isNativeButton ? type : undefined\"\n :class=\"classes\"\n :disabled=\"isNativeButton ? isDisabled : undefined\"\n :aria-disabled=\"!isNativeButton && isDisabled ? 'true' : undefined\"\n :aria-busy=\"loading || undefined\"\n :aria-label=\"label\"\n :tabindex=\"!isNativeButton && isDisabled ? -1 : undefined\"\n @click=\"onClick\"\n >\n <span\n v-if=\"loading\"\n class=\"t-button__spinner\"\n >\n <TSpinner\n size=\"sm\"\n :label=\"loadingLabel\"\n />\n </span>\n <span\n v-if=\"$slots.icon && !isIconHidden\"\n class=\"t-button__icon\"\n aria-hidden=\"true\"\n >\n <slot name=\"icon\" />\n </span>\n <span\n v-if=\"!iconOnly\"\n class=\"t-button__label\"\n >\n <slot />\n </span>\n </component>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA,IAAM,IAAQ,GA8CR,IAAO,GAIP,IAAc,EAAG;GACrB,MAAM;GACN,UAAU;IACR,SAAS;KACP,OAAO;KACP,SAAS;KACT,OAAO;KACP,MAAM;KACN,QAAQ;KACR,OAAO;IACT;IACA,MAAM;KACJ,IAAI;KACJ,IAAI;KACJ,IAAI;IACN;GACF;EACF,CAAC,GAEK,IAAQ,EAAS,GACjB,IAAiB,QAAe,EAAM,OAAO,QAAQ,GACrD,IAAa,QAAe,EAAM,YAAY,EAAM,OAAO;EAYjE,AAAA,QAAA,IAAA,aAA6B,gBAC3B,QAAkB;GAChB,AACE,EAAM,YACN,CAAC,EAAM,SACP,CAAC,EAAM,iBACP,CAAC,EAAM,sBAEP,QAAQ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27
|
size: TSize;
|
|
28
|
-
indeterminate: boolean;
|
|
29
28
|
invalid: boolean;
|
|
29
|
+
indeterminate: boolean;
|
|
30
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
|
|
31
31
|
inputRef: HTMLInputElement;
|
|
32
32
|
}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TCheckbox.vue.d.ts","sourceRoot":"","sources":["../../src/components/TCheckbox.vue"],"names":[],"mappings":"AAmIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMhD,KAAK,WAAW,GAAG;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAmEJ,iBAAS,cAAc;WA8ET,OAAO,IAA6B;;yBAXrB,GAAG;;;;;;EAgB/B;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;gBA3KJ,OAAO;cAET,OAAO;UADX,KAAK;
|
|
1
|
+
{"version":3,"file":"TCheckbox.vue.d.ts","sourceRoot":"","sources":["../../src/components/TCheckbox.vue"],"names":[],"mappings":"AAmIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAMhD,KAAK,WAAW,GAAG;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAmEJ,iBAAS,cAAc;WA8ET,OAAO,IAA6B;;yBAXrB,GAAG;;;;;;EAgB/B;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;gBA3KJ,OAAO;cAET,OAAO;UADX,KAAK;aAGF,OAAO;mBADD,OAAO;;;OAiLzB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCodeBlock.cjs","names":[],"sources":["../../src/components/TCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport TIcon from './TIcon.vue';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * Code as a string. Rendered as the block content and used by the built-in\n * copy button. Omit and use the default slot for pre-formatted markup.\n */\n code?: string;\n /**\n * Line wrapping. `false` (default) keeps lines intact and scrolls\n * horizontally — right for logs. `true` wraps long lines (`pre-wrap`) — right\n * for JSON.\n */\n wrap?: boolean;\n /** Max height before the block scrolls vertically. Any CSS length. */\n maxBlockSize?: string;\n /** Show the built-in copy button. Requires `code` (nothing to copy from a slot). */\n copyable?: boolean;\n /** Accessible name for the scrollable region and the copy button. */\n label?: string;\n }>(),\n {\n code: undefined,\n wrap: false,\n maxBlockSize: undefined,\n copyable: false,\n label: 'Code',\n },\n);\n\nconst emit = defineEmits<{\n copy: [text: string];\n}>();\n\nconst copied = ref(false);\nlet resetTimer: ReturnType<typeof setTimeout> | undefined;\n\nconst showCopy = computed(() => props.copyable && props.code != null);\nconst hasToolbar = computed(() => showCopy.value);\n\nconst preStyle = computed(() =>\n props.maxBlockSize ? { maxBlockSize: props.maxBlockSize } : undefined,\n);\n\nconst classes = computed(() => ['t-code-block', { 'is-wrap': props.wrap }]);\n\nasync function onCopy() {\n if (props.code == null) return;\n try {\n await navigator.clipboard?.writeText(props.code);\n emit('copy', props.code);\n copied.value = true;\n clearTimeout(resetTimer);\n resetTimer = setTimeout(() => {\n copied.value = false;\n }, 2000);\n } catch {\n // Clipboard can reject (permissions, insecure context); leave state as-is.\n }\n}\n</script>\n\n<template>\n <div :class=\"classes\">\n <div\n v-if=\"hasToolbar\"\n class=\"t-code-block__toolbar\"\n >\n <button\n v-if=\"showCopy\"\n type=\"button\"\n class=\"t-code-block__copy\"\n :aria-label=\"copied ? 'Copied' : `Copy ${label}`\"\n @click=\"onCopy\"\n >\n <TIcon\n :name=\"copied ? 'check' : 'copy'\"\n :size=\"16\"\n />\n </button>\n </div>\n <pre\n class=\"t-code-block__pre\"\n role=\"region\"\n :aria-label=\"label\"\n tabindex=\"0\"\n :style=\"preStyle\"\n ><code class=\"t-code-block__code\"><slot>{{ code }}</slot></code></pre>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCodeBlock.js","names":[],"sources":["../../src/components/TCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport TIcon from './TIcon.vue';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * Code as a string. Rendered as the block content and used by the built-in\n * copy button. Omit and use the default slot for pre-formatted markup.\n */\n code?: string;\n /**\n * Line wrapping. `false` (default) keeps lines intact and scrolls\n * horizontally — right for logs. `true` wraps long lines (`pre-wrap`) — right\n * for JSON.\n */\n wrap?: boolean;\n /** Max height before the block scrolls vertically. Any CSS length. */\n maxBlockSize?: string;\n /** Show the built-in copy button. Requires `code` (nothing to copy from a slot). */\n copyable?: boolean;\n /** Accessible name for the scrollable region and the copy button. */\n label?: string;\n }>(),\n {\n code: undefined,\n wrap: false,\n maxBlockSize: undefined,\n copyable: false,\n label: 'Code',\n },\n);\n\nconst emit = defineEmits<{\n copy: [text: string];\n}>();\n\nconst copied = ref(false);\nlet resetTimer: ReturnType<typeof setTimeout> | undefined;\n\nconst showCopy = computed(() => props.copyable && props.code != null);\nconst hasToolbar = computed(() => showCopy.value);\n\nconst preStyle = computed(() =>\n props.maxBlockSize ? { maxBlockSize: props.maxBlockSize } : undefined,\n);\n\nconst classes = computed(() => ['t-code-block', { 'is-wrap': props.wrap }]);\n\nasync function onCopy() {\n if (props.code == null) return;\n try {\n await navigator.clipboard?.writeText(props.code);\n emit('copy', props.code);\n copied.value = true;\n clearTimeout(resetTimer);\n resetTimer = setTimeout(() => {\n copied.value = false;\n }, 2000);\n } catch {\n // Clipboard can reject (permissions, insecure context); leave state as-is.\n }\n}\n</script>\n\n<template>\n <div :class=\"classes\">\n <div\n v-if=\"hasToolbar\"\n class=\"t-code-block__toolbar\"\n >\n <button\n v-if=\"showCopy\"\n type=\"button\"\n class=\"t-code-block__copy\"\n :aria-label=\"copied ? 'Copied' : `Copy ${label}`\"\n @click=\"onCopy\"\n >\n <TIcon\n :name=\"copied ? 'check' : 'copy'\"\n :size=\"16\"\n />\n </button>\n </div>\n <pre\n class=\"t-code-block__pre\"\n role=\"region\"\n :aria-label=\"label\"\n tabindex=\"0\"\n :style=\"preStyle\"\n ><code class=\"t-code-block__code\"><slot>{{ code }}</slot></code></pre>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
/**
|
|
3
|
+
* Code as a string. Rendered as the block content and used by the built-in
|
|
4
|
+
* copy button. Omit and use the default slot for pre-formatted markup.
|
|
5
|
+
*/
|
|
6
|
+
code?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Line wrapping. `false` (default) keeps lines intact and scrolls
|
|
9
|
+
* horizontally — right for logs. `true` wraps long lines (`pre-wrap`) — right
|
|
10
|
+
* for JSON.
|
|
11
|
+
*/
|
|
12
|
+
wrap?: boolean;
|
|
13
|
+
/** Max height before the block scrolls vertically. Any CSS length. */
|
|
14
|
+
maxBlockSize?: string;
|
|
15
|
+
/** Show the built-in copy button. Requires `code` (nothing to copy from a slot). */
|
|
16
|
+
copyable?: boolean;
|
|
17
|
+
/** Accessible name for the scrollable region and the copy button. */
|
|
18
|
+
label?: string;
|
|
19
|
+
};
|
|
20
|
+
declare function __VLS_template(): {
|
|
21
|
+
attrs: Partial<{}>;
|
|
22
|
+
slots: {
|
|
23
|
+
default?(_: {}): any;
|
|
24
|
+
};
|
|
25
|
+
refs: {};
|
|
26
|
+
rootEl: HTMLDivElement;
|
|
27
|
+
};
|
|
28
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
29
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
30
|
+
copy: (text: string) => any;
|
|
31
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
32
|
+
onCopy?: ((text: string) => any) | undefined;
|
|
33
|
+
}>, {
|
|
34
|
+
code: string;
|
|
35
|
+
label: string;
|
|
36
|
+
wrap: boolean;
|
|
37
|
+
maxBlockSize: string;
|
|
38
|
+
copyable: boolean;
|
|
39
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
40
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
41
|
+
export default _default;
|
|
42
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
43
|
+
new (): {
|
|
44
|
+
$slots: S;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=TCodeBlock.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCodeBlock.vue.d.ts","sourceRoot":"","sources":["../../src/components/TCodeBlock.vue"],"names":[],"mappings":"AAkGA,KAAK,WAAW,GAAG;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,sEAAsE;IACtE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqDJ,iBAAS,cAAc;WA2DT,OAAO,IAA6B;;yBAVrB,GAAG;;;;EAe/B;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;UApJV,MAAM;WAYL,MAAM;UANP,OAAO;kBAEC,MAAM;cAEV,OAAO;wFAmJpB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAapG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e=require("./TIcon.cjs");let t=require("vue");var n={key:0,class:`t-code-block__toolbar`},r=[`aria-label`],i=[`aria-label`],a={class:`t-code-block__code`},o=(0,t.defineComponent)({__name:`TCodeBlock`,props:{code:{default:void 0},wrap:{type:Boolean,default:!1},maxBlockSize:{default:void 0},copyable:{type:Boolean,default:!1},label:{default:`Code`}},emits:[`copy`],setup(o,{emit:s}){let c=o,l=s,u=(0,t.ref)(!1),d,f=(0,t.computed)(()=>c.copyable&&c.code!=null),p=(0,t.computed)(()=>f.value),m=(0,t.computed)(()=>c.maxBlockSize?{maxBlockSize:c.maxBlockSize}:void 0),h=(0,t.computed)(()=>[`t-code-block`,{"is-wrap":c.wrap}]);async function g(){if(c.code!=null)try{await navigator.clipboard?.writeText(c.code),l(`copy`,c.code),u.value=!0,clearTimeout(d),d=setTimeout(()=>{u.value=!1},2e3)}catch{}}return(s,c)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)(h.value)},[p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,n,[f.value?((0,t.openBlock)(),(0,t.createElementBlock)(`button`,{key:0,type:`button`,class:`t-code-block__copy`,"aria-label":u.value?`Copied`:`Copy ${o.label}`,onClick:g},[(0,t.createVNode)(e.default,{name:u.value?`check`:`copy`,size:16},null,8,[`name`])],8,r)):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`pre`,{class:`t-code-block__pre`,role:`region`,"aria-label":o.label,tabindex:`0`,style:(0,t.normalizeStyle)(m.value)},[(0,t.createElementVNode)(`code`,a,[(0,t.renderSlot)(s.$slots,`default`,{},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(o.code),1)])])],12,i)],2))}});exports.default=o;
|
|
2
|
+
//# sourceMappingURL=TCodeBlock.vue_vue_type_script_setup_true_lang.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TCodeBlock.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/components/TCodeBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref } from 'vue';\nimport TIcon from './TIcon.vue';\n\nconst props = withDefaults(\n defineProps<{\n /**\n * Code as a string. Rendered as the block content and used by the built-in\n * copy button. Omit and use the default slot for pre-formatted markup.\n */\n code?: string;\n /**\n * Line wrapping. `false` (default) keeps lines intact and scrolls\n * horizontally — right for logs. `true` wraps long lines (`pre-wrap`) — right\n * for JSON.\n */\n wrap?: boolean;\n /** Max height before the block scrolls vertically. Any CSS length. */\n maxBlockSize?: string;\n /** Show the built-in copy button. Requires `code` (nothing to copy from a slot). */\n copyable?: boolean;\n /** Accessible name for the scrollable region and the copy button. */\n label?: string;\n }>(),\n {\n code: undefined,\n wrap: false,\n maxBlockSize: undefined,\n copyable: false,\n label: 'Code',\n },\n);\n\nconst emit = defineEmits<{\n copy: [text: string];\n}>();\n\nconst copied = ref(false);\nlet resetTimer: ReturnType<typeof setTimeout> | undefined;\n\nconst showCopy = computed(() => props.copyable && props.code != null);\nconst hasToolbar = computed(() => showCopy.value);\n\nconst preStyle = computed(() =>\n props.maxBlockSize ? { maxBlockSize: props.maxBlockSize } : undefined,\n);\n\nconst classes = computed(() => ['t-code-block', { 'is-wrap': props.wrap }]);\n\nasync function onCopy() {\n if (props.code == null) return;\n try {\n await navigator.clipboard?.writeText(props.code);\n emit('copy', props.code);\n copied.value = true;\n clearTimeout(resetTimer);\n resetTimer = setTimeout(() => {\n copied.value = false;\n }, 2000);\n } catch {\n // Clipboard can reject (permissions, insecure context); leave state as-is.\n }\n}\n</script>\n\n<template>\n <div :class=\"classes\">\n <div\n v-if=\"hasToolbar\"\n class=\"t-code-block__toolbar\"\n >\n <button\n v-if=\"showCopy\"\n type=\"button\"\n class=\"t-code-block__copy\"\n :aria-label=\"copied ? 'Copied' : `Copy ${label}`\"\n @click=\"onCopy\"\n >\n <TIcon\n :name=\"copied ? 'check' : 'copy'\"\n :size=\"16\"\n />\n </button>\n </div>\n <pre\n class=\"t-code-block__pre\"\n role=\"region\"\n :aria-label=\"label\"\n tabindex=\"0\"\n :style=\"preStyle\"\n ><code class=\"t-code-block__code\"><slot>{{ code }}</slot></code></pre>\n </div>\n</template>\n"],"mappings":"oYAIA,IAAM,EAAQ,EA6BR,EAAO,EAIP,GAAA,EAAA,EAAA,IAAA,CAAa,EAAK,EACpB,EAEE,GAAA,EAAA,EAAA,SAAA,KAA0B,EAAM,UAAY,EAAM,MAAQ,IAAI,EAC9D,GAAA,EAAA,EAAA,SAAA,KAA4B,EAAS,KAAK,EAE1C,GAAA,EAAA,EAAA,SAAA,KACJ,EAAM,aAAe,CAAE,aAAc,EAAM,YAAa,EAAI,IAAA,EAC9D,EAEM,GAAA,EAAA,EAAA,SAAA,KAAyB,CAAC,eAAgB,CAAE,UAAW,EAAM,IAAK,CAAC,CAAC,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