@rotki/ui-library 2.16.1 → 2.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/accordions/accordion/RuiAccordion.js.map +1 -1
- package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/accordions/accordion/RuiAccordion.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/buttons/button/RuiButton.js.map +1 -1
- package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.js +6 -2
- package/dist/components/buttons/button/RuiButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/buttons/button/button-styles.d.ts +6 -9
- package/dist/components/buttons/button/button-styles.js +42 -20
- package/dist/components/buttons/button/button-styles.js.map +1 -1
- package/dist/components/cards/RuiCard.js.map +1 -1
- package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/components/cards/RuiCard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-picker/RuiColorBoard.js.map +1 -1
- package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/color-picker/RuiColorBoard.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-picker/RuiColorHue.js.map +1 -1
- package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/color-picker/RuiColorHue.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/color-picker/RuiColorPicker.js.map +1 -1
- package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/color-picker/RuiColorPicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.js.map +1 -1
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/date-time-picker/RuiDateTimePicker.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.js.map +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue.d.ts +1 -1
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js +6 -3
- package/dist/components/forms/auto-complete/RuiAutoComplete.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/select/RuiMenuSelect.js.map +1 -1
- package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/forms/select/RuiMenuSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/forms/text-area/text-area-styles.js +2 -2
- package/dist/components/forms/text-area/text-area-styles.js.map +1 -1
- package/dist/components/forms/text-field/text-field-styles.js +3 -3
- package/dist/components/forms/text-field/text-field-styles.js.map +1 -1
- package/dist/components/forms/text-input-styles.js +2 -2
- package/dist/components/forms/text-input-styles.js.map +1 -1
- package/dist/components/loaders/RuiSkeletonLoader.js.map +1 -1
- package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js +15 -5
- package/dist/components/loaders/RuiSkeletonLoader.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/badge/RuiBadge.js.map +1 -1
- package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/overlays/badge/RuiBadge.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/menu/RuiMenu.js.map +1 -1
- package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js +6 -10
- package/dist/components/overlays/menu/RuiMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/notification/RuiNotification.js.map +1 -1
- package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js +8 -3
- package/dist/components/overlays/notification/RuiNotification.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/overlays/tooltip/RuiTooltip.js.map +1 -1
- package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js +13 -6
- package/dist/components/overlays/tooltip/RuiTooltip.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiDataTable.js.map +1 -1
- package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js +2 -6
- package/dist/components/tables/RuiDataTable.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tables/RuiTableHead.js.map +1 -1
- package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tables/RuiTableHead.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tab/RuiTab.js.map +1 -1
- package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tabs/tab/RuiTab.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tab-items/RuiTabItems.js.map +1 -1
- package/dist/components/tabs/tab-items/RuiTabItems.vue.d.ts +2 -2
- package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/tabs/tabs/RuiTabs.js.map +1 -1
- package/dist/components/tabs/tabs/RuiTabs.vue.d.ts +2 -2
- package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/tabs/tabs/RuiTabs.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/composables/forms/auto-complete/keyboard-navigation.d.ts +1 -1
- package/dist/composables/forms/auto-complete/keyboard-navigation.js +2 -2
- package/dist/composables/forms/auto-complete/keyboard-navigation.js.map +1 -1
- package/dist/composables/tables/data-table/expansion.d.ts +0 -1
- package/dist/composables/tables/data-table/expansion.js +2 -2
- package/dist/composables/tables/data-table/expansion.js.map +1 -1
- package/dist/style.css +79 -13
- package/dist/utils/tv.d.ts +6 -3
- package/dist/utils/tv.js +14 -4
- package/dist/utils/tv.js.map +1 -1
- package/dist/vite-plugin/index.js +1 -1
- package/dist/vite-plugin/index.js.map +1 -1
- package/dist/web-types.json +6 -4
- package/package.json +1 -1
package/dist/components/tabs/tab-items/RuiTabItems.vue_vue_type_script_setup_true_lang.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiTabItems.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../../src/components/tabs/tab-items/RuiTabItems.vue"],"sourcesContent":["<script lang=\"ts\" setup generic=\"T extends string | number\">\nimport { Fragment, isVNode } from 'vue';\n\ndefineOptions({\n name: 'RuiTabItems',\n inheritAttrs: false,\n});\n\nconst modelValue = defineModel<T>();\n\nconst slots = useSlots();\n\nconst reverse = ref<boolean>(false);\nconst currIndex = ref<number>(-1);\nconst activeIndex = ref<number>(-1);\nconst inner = useTemplateRef<HTMLDivElement>('inner');\n\nconst { height: innerHeight } = useElementSize(inner);\n\nconst children = computed<VNode[]>(() => {\n const slotContent = slots.default?.() ?? [];\n\n const tabs = getChildrenTabs(slotContent);\n\n let anyActive = false;\n const children = tabs.map((tab, index) => {\n const value = tab.props?.value ?? index;\n const active = get(modelValue) === value;\n if (active) {\n anyActive = true;\n if (index !== get(currIndex)) {\n set(reverse, index < get(currIndex));\n set(currIndex, index);\n }\n }\n\n return {\n ...tab,\n props: {\n value,\n ...tab.props,\n },\n };\n });\n\n if (!anyActive)\n set(currIndex, -1);\n\n return children;\n});\n\n// When using dynamic content with v-for the slot content can contain fragment,\n// Go through the fragment and always return RuiTabItem only\nfunction getChildrenTabs(children: VNode[]): VNode[] {\n return children\n .flatMap((item) => {\n if (item.type === Fragment && Array.isArray(item.children) && item.children.length > 0)\n return getChildrenTabs(item.children.filter(isVNode));\n\n return [item];\n })\n .flat();\n}\n\nwatch(currIndex, (index) => {\n nextTick(() => {\n set(activeIndex, index);\n });\n});\n</script>\n\n<template>\n <div\n class=\"grow transition-all overflow-hidden\"\n :style=\"{ height: `${innerHeight}px` }\"\n v-bind=\"$attrs\"\n >\n <div ref=\"inner\">\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n :reverse=\"reverse\"\n :active=\"i === activeIndex\"\n />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"RuiTabItems.vue_vue_type_script_setup_true_lang.js","names":["$attrs"],"sources":["../../../../src/components/tabs/tab-items/RuiTabItems.vue"],"sourcesContent":["<script lang=\"ts\" setup generic=\"T extends string | number\">\nimport { Fragment, isVNode } from 'vue';\n\ndefineOptions({\n name: 'RuiTabItems',\n inheritAttrs: false,\n});\n\n// Default matches RuiTabs' `defineModel<... >({ default: 0 })`. Without a\n// default, consumers that bind both components to the same ref (e.g.\n// `v-model=\"item.modelValue\"` on both RuiTabs and RuiTabItems, where the\n// ref starts as `undefined`) leave RuiTabItems with `modelValue === undefined`.\n// The `active = modelValue === value` check then fails for every tab — the\n// panel renders but stays height:0, so e2e `toHaveText` and `toBeVisible`\n// assertions pass the element but see no content.\nconst modelValue = defineModel<T>({ default: 0 as T });\n\nconst slots = useSlots();\n\nconst reverse = ref<boolean>(false);\nconst currIndex = ref<number>(-1);\nconst activeIndex = ref<number>(-1);\nconst inner = useTemplateRef<HTMLDivElement>('inner');\n\nconst { height: innerHeight } = useElementSize(inner);\n\nconst children = computed<VNode[]>(() => {\n const slotContent = slots.default?.() ?? [];\n\n const tabs = getChildrenTabs(slotContent);\n\n let anyActive = false;\n const children = tabs.map((tab, index) => {\n const value = tab.props?.value ?? index;\n const active = get(modelValue) === value;\n if (active) {\n anyActive = true;\n if (index !== get(currIndex)) {\n set(reverse, index < get(currIndex));\n set(currIndex, index);\n }\n }\n\n return {\n ...tab,\n props: {\n value,\n ...tab.props,\n },\n };\n });\n\n if (!anyActive)\n set(currIndex, -1);\n\n return children;\n});\n\n// When using dynamic content with v-for the slot content can contain fragment,\n// Go through the fragment and always return RuiTabItem only\nfunction getChildrenTabs(children: VNode[]): VNode[] {\n return children\n .flatMap((item) => {\n if (item.type === Fragment && Array.isArray(item.children) && item.children.length > 0)\n return getChildrenTabs(item.children.filter(isVNode));\n\n return [item];\n })\n .flat();\n}\n\nwatch(currIndex, (index) => {\n nextTick(() => {\n set(activeIndex, index);\n });\n});\n</script>\n\n<template>\n <div\n class=\"grow transition-all overflow-hidden\"\n :style=\"{ height: `${innerHeight}px` }\"\n v-bind=\"$attrs\"\n >\n <div ref=\"inner\">\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n :reverse=\"reverse\"\n :active=\"i === activeIndex\"\n />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAeA,MAAM,aAAa,SAAc,SAAA,aAAqB;EAEtD,MAAM,QAAQ,UAAU;EAExB,MAAM,UAAU,IAAa,MAAM;EACnC,MAAM,YAAY,IAAY,GAAG;EACjC,MAAM,cAAc,IAAY,GAAG;EACnC,MAAM,QAAQ,eAA+B,QAAQ;EAErD,MAAM,EAAE,QAAQ,gBAAgB,eAAe,MAAM;EAErD,MAAM,WAAW,eAAwB;GAGvC,MAAM,OAAO,gBAFO,MAAM,WAAW,IAAI,EAAE,CAEF;GAEzC,IAAI,YAAY;GAChB,MAAM,WAAW,KAAK,KAAK,KAAK,UAAU;IACxC,MAAM,QAAQ,IAAI,OAAO,SAAS;AAElC,QADe,MAAI,WAAW,KAAK,OACvB;AACV,iBAAY;AACZ,SAAI,UAAU,MAAI,UAAU,EAAE;AAC5B,YAAI,SAAS,QAAQ,MAAI,UAAU,CAAC;AACpC,YAAI,WAAW,MAAM;;;AAIzB,WAAO;KACL,GAAG;KACH,OAAO;MACL;MACA,GAAG,IAAI;;KAEV;KACD;AAEF,OAAI,CAAC,UACH,OAAI,WAAW,GAAG;AAEpB,UAAO;IACP;EAIF,SAAS,gBAAgB,UAA4B;AACnD,UAAO,SACJ,SAAS,SAAS;AACjB,QAAI,KAAK,SAAS,YAAY,MAAM,QAAQ,KAAK,SAAS,IAAI,KAAK,SAAS,SAAS,EACnF,QAAO,gBAAgB,KAAK,SAAS,OAAO,QAAQ,CAAC;AAEvD,WAAO,CAAC,KAAK;KACd,CACA,MAAM;;AAGX,QAAM,YAAY,UAAU;AAC1B,kBAAe;AACb,UAAI,aAAa,MAAM;KACvB;IACF;;uBAIA,mBAcM,OAdN,WAcM;IAbJ,OAAM;IACL,OAAK,EAAA,QAAA,GAAe,MAAA,YAAW,CAAA,KAAA;MACxBA,KAAAA,OAAM,EAAA,CAEd,mBAQM,OAAA;aARG;IAAJ,KAAI;yBACP,mBAME,UAAA,MAAA,WAJqB,MAAA,SAAQ,GAArB,OAAO,MAAC;wBAFlB,YAME,wBALK,MAAK,EAAA;KAET,KAAK;KACL,SAAS,MAAA,QAAO;KAChB,QAAQ,MAAM,MAAA,YAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiTabs.js","names":[],"sources":["../../../../src/components/tabs/tabs/RuiTabs.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport { Fragment, isVNode, type VNode } from 'vue';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { type TabAlignment, type TabIndicatorPosition, TabLayout } from '@/components/tabs/tab-props';\nimport { useTabRouting } from '@/components/tabs/tabs/use-tab-routing';\nimport { useTabScroll } from '@/components/tabs/tabs/use-tab-scroll';\nimport { tv } from '@/utils/tv';\n\ntype ChildNode = VNode & { props: Record<string, any> };\n\ninterface ResolvedTabProps {\n value?: string | number;\n to?: unknown;\n link?: boolean;\n exact?: boolean;\n exactPath?: boolean;\n}\n\nexport interface Props {\n color?: ContextColorsType;\n vertical?: boolean;\n disabled?: boolean;\n grow?: boolean;\n align?: TabAlignment;\n indicatorPosition?: TabIndicatorPosition;\n}\n\ndefineOptions({\n name: 'RuiTabs',\n});\n\nconst modelValue = defineModel<number | string>();\n\nconst {\n color,\n vertical = false,\n disabled = false,\n grow = false,\n align = 'center',\n indicatorPosition = 'end',\n} = defineProps<Props>();\n\nconst internalModelValue = ref<string | number>();\nconst bar = useTemplateRef<HTMLDivElement>('bar');\nconst wrapper = useTemplateRef<HTMLDivElement>('wrapper');\n\nconst tabs = tv({\n slots: {\n root: '',\n arrow: '',\n bar: 'no-scrollbar max-h-full overflow-auto',\n wrapper: 'h-full inline-flex max-w-none',\n },\n variants: {\n layout: {\n [TabLayout.horizontal]: {\n root: 'flex h-fit',\n arrow: 'h-[3rem] w-10',\n bar: 'h-[3rem]',\n wrapper: '',\n },\n [TabLayout.vertical]: {\n root: 'inline-flex flex-col',\n arrow: 'min-h-[3rem] w-full',\n bar: '',\n wrapper: 'flex-col h-auto',\n },\n },\n wide: {\n true: {\n bar: 'w-full',\n wrapper: 'min-w-full',\n },\n },\n },\n defaultVariants: { layout: TabLayout.horizontal },\n});\n\nconst slots = useSlots();\n\nconst {\n showArrows,\n prevArrowDisabled,\n nextArrowDisabled,\n onPrevSliderClick,\n onNextSliderClick,\n keepActiveTabVisible,\n} = useTabScroll({ bar, wrapper, vertical: () => vertical });\n\nconst { resolveRoute, isPathMatch } = useTabRouting({\n onRouteChange: () => applyNewValue(true),\n});\n\nconst layout = computed<TabLayout>(() => vertical ? TabLayout.vertical : TabLayout.horizontal);\nconst ui = computed<ReturnType<typeof tabs>>(() => tabs({ layout: get(layout), wide: vertical || grow }));\n\nconst children = computed<ChildNode[]>(() => {\n const slotContent = slots.default?.() ?? [];\n\n const tabs = getChildrenTabs(slotContent);\n\n const currentModelValue = get(internalModelValue);\n const inheritedProps = {\n color,\n grow,\n disabled,\n vertical,\n align,\n indicatorPosition,\n };\n\n return tabs.map((tab, index) => {\n let tabValue = tab.props?.value ?? index;\n if (tab.props?.link !== false && tab.props?.to)\n tabValue = tab.props.to;\n\n const active = currentModelValue === tabValue;\n return {\n ...tab,\n props: {\n value: tabValue,\n active,\n ...inheritedProps,\n ...tab.props,\n },\n };\n });\n});\n\n// When using dynamic content with v-for the slot content can contain fragment,\n// Go through the fragment and always return RuiTab only\nfunction getChildrenTabs(children: VNode[]): VNode[] {\n return children.flatMap((item) => {\n if (item.type === Fragment && Array.isArray(item.children) && item.children.length > 0)\n return getChildrenTabs(item.children.filter(isVNode));\n\n return [item];\n }).flat();\n}\n\nfunction updateModelValue(newModelValue: string | number): void {\n set(modelValue, newModelValue);\n set(internalModelValue, newModelValue);\n}\n\nfunction getTabRouteProps(props: Record<string, unknown>): ResolvedTabProps {\n return {\n value: typeof props.value === 'string' || typeof props.value === 'number' ? props.value : undefined,\n to: props.to ?? undefined,\n link: typeof props.link === 'boolean' ? props.link : undefined,\n exact: typeof props.exact === 'boolean' ? props.exact : undefined,\n exactPath: typeof props.exactPath === 'boolean' ? props.exactPath : undefined,\n };\n}\n\nfunction resolveActiveValue(onlyLink: boolean): string | number | undefined {\n const enabledChildren = get(children).filter(child => !child.props?.disabled);\n if (enabledChildren.length === 0)\n return undefined;\n\n let result: string | number = get(modelValue) || 0;\n enabledChildren.forEach((child, index) => {\n const tabProps = getTabRouteProps(child.props);\n if (!onlyLink && index === 0 && tabProps.value)\n result = tabProps.value;\n\n const fullPath = resolveRoute(tabProps.to);\n\n if (tabProps.link !== false && fullPath && isPathMatch(fullPath, tabProps))\n result = fullPath;\n });\n return result;\n}\n\nfunction applyNewValue(onlyLink = false): void {\n const value = resolveActiveValue(onlyLink);\n if (value !== undefined)\n updateModelValue(value);\n\n keepActiveTabVisible();\n}\n\nwatchImmediate(() => get(modelValue), (modelValue) => {\n set(internalModelValue, modelValue);\n});\n\nwatch(internalModelValue, () => {\n keepActiveTabVisible();\n});\n\nonMounted(() => {\n if (get(modelValue) !== undefined)\n return;\n\n applyNewValue();\n});\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n :data-vertical=\"vertical || undefined\"\n >\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"prevArrowDisabled\"\n @click=\"onPrevSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-up' : 'lu-chevron-left'\" />\n </RuiButton>\n </div>\n <div\n ref=\"bar\"\n :class=\"ui.bar()\"\n >\n <div\n ref=\"wrapper\"\n role=\"tablist\"\n data-id=\"tabs-wrapper\"\n :class=\"ui.wrapper()\"\n >\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n @click=\"updateModelValue($event)\"\n />\n </div>\n </div>\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"nextArrowDisabled\"\n @click=\"onNextSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-down' : 'lu-chevron-right'\" />\n </RuiButton>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"RuiTabs.js","names":[],"sources":["../../../../src/components/tabs/tabs/RuiTabs.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport { Fragment, isVNode, type VNode } from 'vue';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { type TabAlignment, type TabIndicatorPosition, TabLayout } from '@/components/tabs/tab-props';\nimport { useTabRouting } from '@/components/tabs/tabs/use-tab-routing';\nimport { useTabScroll } from '@/components/tabs/tabs/use-tab-scroll';\nimport { tv } from '@/utils/tv';\n\ntype ChildNode = VNode & { props: Record<string, any> };\n\ninterface ResolvedTabProps {\n value?: string | number;\n to?: unknown;\n link?: boolean;\n exact?: boolean;\n exactPath?: boolean;\n}\n\nexport interface Props {\n color?: ContextColorsType;\n vertical?: boolean;\n disabled?: boolean;\n grow?: boolean;\n align?: TabAlignment;\n indicatorPosition?: TabIndicatorPosition;\n}\n\ndefineOptions({\n name: 'RuiTabs',\n});\n\n// Default 0 (first tab) matches the existing internal fallback on line 163.\n// Providing a default narrows the `update:modelValue` emit payload from\n// `value?: number | string` to `value: number | string`, so consumers can\n// type their handler signatures without undefined unions.\nconst modelValue = defineModel<number | string>({ default: 0 });\n\nconst {\n color,\n vertical = false,\n disabled = false,\n grow = false,\n align = 'center',\n indicatorPosition = 'end',\n} = defineProps<Props>();\n\nconst internalModelValue = ref<string | number>();\nconst bar = useTemplateRef<HTMLDivElement>('bar');\nconst wrapper = useTemplateRef<HTMLDivElement>('wrapper');\n\nconst tabs = tv({\n slots: {\n root: '',\n arrow: '',\n bar: 'no-scrollbar max-h-full overflow-auto',\n wrapper: 'h-full inline-flex max-w-none',\n },\n variants: {\n layout: {\n [TabLayout.horizontal]: {\n root: 'flex h-fit',\n arrow: 'h-[3rem] w-10',\n bar: 'h-[3rem]',\n wrapper: '',\n },\n [TabLayout.vertical]: {\n root: 'inline-flex flex-col',\n arrow: 'min-h-[3rem] w-full',\n bar: '',\n wrapper: 'flex-col h-auto',\n },\n },\n wide: {\n true: {\n bar: 'w-full',\n wrapper: 'min-w-full',\n },\n },\n },\n defaultVariants: { layout: TabLayout.horizontal },\n});\n\nconst slots = useSlots();\n\nconst {\n showArrows,\n prevArrowDisabled,\n nextArrowDisabled,\n onPrevSliderClick,\n onNextSliderClick,\n keepActiveTabVisible,\n} = useTabScroll({ bar, wrapper, vertical: () => vertical });\n\nconst { resolveRoute, isPathMatch } = useTabRouting({\n onRouteChange: () => applyNewValue(true),\n});\n\nconst layout = computed<TabLayout>(() => vertical ? TabLayout.vertical : TabLayout.horizontal);\nconst ui = computed<ReturnType<typeof tabs>>(() => tabs({ layout: get(layout), wide: vertical || grow }));\n\nconst children = computed<ChildNode[]>(() => {\n const slotContent = slots.default?.() ?? [];\n\n const tabs = getChildrenTabs(slotContent);\n\n const currentModelValue = get(internalModelValue);\n const inheritedProps = {\n color,\n grow,\n disabled,\n vertical,\n align,\n indicatorPosition,\n };\n\n return tabs.map((tab, index) => {\n let tabValue = tab.props?.value ?? index;\n if (tab.props?.link !== false && tab.props?.to)\n tabValue = tab.props.to;\n\n const active = currentModelValue === tabValue;\n return {\n ...tab,\n props: {\n value: tabValue,\n active,\n ...inheritedProps,\n ...tab.props,\n },\n };\n });\n});\n\n// When using dynamic content with v-for the slot content can contain fragment,\n// Go through the fragment and always return RuiTab only\nfunction getChildrenTabs(children: VNode[]): VNode[] {\n return children.flatMap((item) => {\n if (item.type === Fragment && Array.isArray(item.children) && item.children.length > 0)\n return getChildrenTabs(item.children.filter(isVNode));\n\n return [item];\n }).flat();\n}\n\nfunction updateModelValue(newModelValue: string | number): void {\n set(modelValue, newModelValue);\n set(internalModelValue, newModelValue);\n}\n\nfunction getTabRouteProps(props: Record<string, unknown>): ResolvedTabProps {\n return {\n value: typeof props.value === 'string' || typeof props.value === 'number' ? props.value : undefined,\n to: props.to ?? undefined,\n link: typeof props.link === 'boolean' ? props.link : undefined,\n exact: typeof props.exact === 'boolean' ? props.exact : undefined,\n exactPath: typeof props.exactPath === 'boolean' ? props.exactPath : undefined,\n };\n}\n\nfunction resolveActiveValue(onlyLink: boolean): string | number | undefined {\n const enabledChildren = get(children).filter(child => !child.props?.disabled);\n if (enabledChildren.length === 0)\n return undefined;\n\n let result: string | number = get(modelValue) || 0;\n enabledChildren.forEach((child, index) => {\n const tabProps = getTabRouteProps(child.props);\n if (!onlyLink && index === 0 && tabProps.value)\n result = tabProps.value;\n\n const fullPath = resolveRoute(tabProps.to);\n\n if (tabProps.link !== false && fullPath && isPathMatch(fullPath, tabProps))\n result = fullPath;\n });\n return result;\n}\n\nfunction applyNewValue(onlyLink = false): void {\n const value = resolveActiveValue(onlyLink);\n if (value !== undefined)\n updateModelValue(value);\n\n keepActiveTabVisible();\n}\n\nwatchImmediate(() => get(modelValue), (modelValue) => {\n set(internalModelValue, modelValue);\n});\n\nwatch(internalModelValue, () => {\n keepActiveTabVisible();\n});\n\nonMounted(() => {\n if (get(modelValue) !== undefined)\n return;\n\n applyNewValue();\n});\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n :data-vertical=\"vertical || undefined\"\n >\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"prevArrowDisabled\"\n @click=\"onPrevSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-up' : 'lu-chevron-left'\" />\n </RuiButton>\n </div>\n <div\n ref=\"bar\"\n :class=\"ui.bar()\"\n >\n <div\n ref=\"wrapper\"\n role=\"tablist\"\n data-id=\"tabs-wrapper\"\n :class=\"ui.wrapper()\"\n >\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n @click=\"updateModelValue($event)\"\n />\n </div>\n </div>\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"nextArrowDisabled\"\n @click=\"onNextSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-down' : 'lu-chevron-right'\" />\n </RuiButton>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -14,9 +14,9 @@ type __VLS_ModelProps = {
|
|
|
14
14
|
};
|
|
15
15
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
16
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
-
"update:modelValue": (value: string | number
|
|
17
|
+
"update:modelValue": (value: string | number) => any;
|
|
18
18
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
-
"onUpdate:modelValue"?: ((value: string | number
|
|
19
|
+
"onUpdate:modelValue"?: ((value: string | number) => any) | undefined;
|
|
20
20
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
21
|
declare const _default: typeof __VLS_export;
|
|
22
22
|
export default _default;
|
|
@@ -29,7 +29,7 @@ var RuiTabs_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
29
29
|
align: { default: "center" },
|
|
30
30
|
indicatorPosition: { default: "end" }
|
|
31
31
|
}, {
|
|
32
|
-
"modelValue": {},
|
|
32
|
+
"modelValue": { default: 0 },
|
|
33
33
|
"modelModifiers": {}
|
|
34
34
|
}),
|
|
35
35
|
emits: ["update:modelValue"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuiTabs.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../src/components/tabs/tabs/RuiTabs.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport { Fragment, isVNode, type VNode } from 'vue';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { type TabAlignment, type TabIndicatorPosition, TabLayout } from '@/components/tabs/tab-props';\nimport { useTabRouting } from '@/components/tabs/tabs/use-tab-routing';\nimport { useTabScroll } from '@/components/tabs/tabs/use-tab-scroll';\nimport { tv } from '@/utils/tv';\n\ntype ChildNode = VNode & { props: Record<string, any> };\n\ninterface ResolvedTabProps {\n value?: string | number;\n to?: unknown;\n link?: boolean;\n exact?: boolean;\n exactPath?: boolean;\n}\n\nexport interface Props {\n color?: ContextColorsType;\n vertical?: boolean;\n disabled?: boolean;\n grow?: boolean;\n align?: TabAlignment;\n indicatorPosition?: TabIndicatorPosition;\n}\n\ndefineOptions({\n name: 'RuiTabs',\n});\n\nconst modelValue = defineModel<number | string>();\n\nconst {\n color,\n vertical = false,\n disabled = false,\n grow = false,\n align = 'center',\n indicatorPosition = 'end',\n} = defineProps<Props>();\n\nconst internalModelValue = ref<string | number>();\nconst bar = useTemplateRef<HTMLDivElement>('bar');\nconst wrapper = useTemplateRef<HTMLDivElement>('wrapper');\n\nconst tabs = tv({\n slots: {\n root: '',\n arrow: '',\n bar: 'no-scrollbar max-h-full overflow-auto',\n wrapper: 'h-full inline-flex max-w-none',\n },\n variants: {\n layout: {\n [TabLayout.horizontal]: {\n root: 'flex h-fit',\n arrow: 'h-[3rem] w-10',\n bar: 'h-[3rem]',\n wrapper: '',\n },\n [TabLayout.vertical]: {\n root: 'inline-flex flex-col',\n arrow: 'min-h-[3rem] w-full',\n bar: '',\n wrapper: 'flex-col h-auto',\n },\n },\n wide: {\n true: {\n bar: 'w-full',\n wrapper: 'min-w-full',\n },\n },\n },\n defaultVariants: { layout: TabLayout.horizontal },\n});\n\nconst slots = useSlots();\n\nconst {\n showArrows,\n prevArrowDisabled,\n nextArrowDisabled,\n onPrevSliderClick,\n onNextSliderClick,\n keepActiveTabVisible,\n} = useTabScroll({ bar, wrapper, vertical: () => vertical });\n\nconst { resolveRoute, isPathMatch } = useTabRouting({\n onRouteChange: () => applyNewValue(true),\n});\n\nconst layout = computed<TabLayout>(() => vertical ? TabLayout.vertical : TabLayout.horizontal);\nconst ui = computed<ReturnType<typeof tabs>>(() => tabs({ layout: get(layout), wide: vertical || grow }));\n\nconst children = computed<ChildNode[]>(() => {\n const slotContent = slots.default?.() ?? [];\n\n const tabs = getChildrenTabs(slotContent);\n\n const currentModelValue = get(internalModelValue);\n const inheritedProps = {\n color,\n grow,\n disabled,\n vertical,\n align,\n indicatorPosition,\n };\n\n return tabs.map((tab, index) => {\n let tabValue = tab.props?.value ?? index;\n if (tab.props?.link !== false && tab.props?.to)\n tabValue = tab.props.to;\n\n const active = currentModelValue === tabValue;\n return {\n ...tab,\n props: {\n value: tabValue,\n active,\n ...inheritedProps,\n ...tab.props,\n },\n };\n });\n});\n\n// When using dynamic content with v-for the slot content can contain fragment,\n// Go through the fragment and always return RuiTab only\nfunction getChildrenTabs(children: VNode[]): VNode[] {\n return children.flatMap((item) => {\n if (item.type === Fragment && Array.isArray(item.children) && item.children.length > 0)\n return getChildrenTabs(item.children.filter(isVNode));\n\n return [item];\n }).flat();\n}\n\nfunction updateModelValue(newModelValue: string | number): void {\n set(modelValue, newModelValue);\n set(internalModelValue, newModelValue);\n}\n\nfunction getTabRouteProps(props: Record<string, unknown>): ResolvedTabProps {\n return {\n value: typeof props.value === 'string' || typeof props.value === 'number' ? props.value : undefined,\n to: props.to ?? undefined,\n link: typeof props.link === 'boolean' ? props.link : undefined,\n exact: typeof props.exact === 'boolean' ? props.exact : undefined,\n exactPath: typeof props.exactPath === 'boolean' ? props.exactPath : undefined,\n };\n}\n\nfunction resolveActiveValue(onlyLink: boolean): string | number | undefined {\n const enabledChildren = get(children).filter(child => !child.props?.disabled);\n if (enabledChildren.length === 0)\n return undefined;\n\n let result: string | number = get(modelValue) || 0;\n enabledChildren.forEach((child, index) => {\n const tabProps = getTabRouteProps(child.props);\n if (!onlyLink && index === 0 && tabProps.value)\n result = tabProps.value;\n\n const fullPath = resolveRoute(tabProps.to);\n\n if (tabProps.link !== false && fullPath && isPathMatch(fullPath, tabProps))\n result = fullPath;\n });\n return result;\n}\n\nfunction applyNewValue(onlyLink = false): void {\n const value = resolveActiveValue(onlyLink);\n if (value !== undefined)\n updateModelValue(value);\n\n keepActiveTabVisible();\n}\n\nwatchImmediate(() => get(modelValue), (modelValue) => {\n set(internalModelValue, modelValue);\n});\n\nwatch(internalModelValue, () => {\n keepActiveTabVisible();\n});\n\nonMounted(() => {\n if (get(modelValue) !== undefined)\n return;\n\n applyNewValue();\n});\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n :data-vertical=\"vertical || undefined\"\n >\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"prevArrowDisabled\"\n @click=\"onPrevSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-up' : 'lu-chevron-left'\" />\n </RuiButton>\n </div>\n <div\n ref=\"bar\"\n :class=\"ui.bar()\"\n >\n <div\n ref=\"wrapper\"\n role=\"tablist\"\n data-id=\"tabs-wrapper\"\n :class=\"ui.wrapper()\"\n >\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n @click=\"updateModelValue($event)\"\n />\n </div>\n </div>\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"nextArrowDisabled\"\n @click=\"onNextSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-down' : 'lu-chevron-right'\" />\n </RuiButton>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCA,MAAM,aAAa,SAA4B,SAAA,aAAE;EAWjD,MAAM,qBAAqB,KAAsB;EACjD,MAAM,MAAM,eAA+B,MAAM;EACjD,MAAM,UAAU,eAA+B,UAAU;EAEzD,MAAM,OAAO,GAAG;GACd,OAAO;IACL,MAAM;IACN,OAAO;IACP,KAAK;IACL,SAAS;IACV;GACD,UAAU;IACR,QAAQ;MACL,UAAU,aAAa;MACtB,MAAM;MACN,OAAO;MACP,KAAK;MACL,SAAS;MACV;MACA,UAAU,WAAW;MACpB,MAAM;MACN,OAAO;MACP,KAAK;MACL,SAAS;;KAEZ;IACD,MAAM,EACJ,MAAM;KACJ,KAAK;KACL,SAAS;KACV,EAAA;IAEJ;GACD,iBAAiB,EAAE,QAAQ,UAAU,YAAA;GACtC,CAAC;EAEF,MAAM,QAAQ,UAAU;EAExB,MAAM,EACJ,YACA,mBACA,mBACA,mBACA,mBACA,yBACE,aAAa;GAAE;GAAK;GAAS,gBAAgB,QAAA;GAAU,CAAC;EAE5D,MAAM,EAAE,cAAc,gBAAgB,cAA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iB,EAAA;;4BAEyC,CAAlE,YAAkE,iBAAA,EAAxD,MAAM,QAAA,WAAQ,kBAAA,mBAAA,EAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA;;;IAG5B,mBAiBM,OAAA;cAhBA;KAAJ,KAAI;KACH,OAAK,eAAE,MAAA,GAAE,CAAC,KAAG,CAAA;QAEd,mBAYM,OAAA;cAXA;KAAJ,KAAI;KACJ,MAAK;KACL,WAAQ;KACP,OAAK,eAAE,MAAA,GAAE,CAAC,SAAO,CAAA;0BAElB,mBAKE,UAAA,MAAA,WAHqB,MAAA,SAAQ,GAArB,OAAO,MAAC;yBAFlB,YAKE,wBAJK,MAAK,EAAA;MAET,KAAK;MACL,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,iBAAiB,OAAM;;;IAK7B,MAAA,WAAU,IAAA,WAAA,EADlB,mBAaM,OAAA;;KAXH,OAAK,eAAE,MAAA,GAAE,CAAC,OAAK,CAAA;QAEhB,YAQY,mBAAA;KAPV,OAAM;KACN,SAAQ;KACP,OAAO,QAAA;KACP,UAAU,MAAA,kBAAiB;KAC3B,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,kBAAiB,EAAA;;4BAE4C,CAArE,YAAqE,iBAAA,EAA3D,MAAM,QAAA,WAAQ,oBAAA,oBAAA,EAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"RuiTabs.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../../../src/components/tabs/tabs/RuiTabs.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type { ContextColorsType } from '@/consts/colors';\nimport { Fragment, isVNode, type VNode } from 'vue';\nimport RuiButton from '@/components/buttons/button/RuiButton.vue';\nimport RuiIcon from '@/components/icons/RuiIcon.vue';\nimport { type TabAlignment, type TabIndicatorPosition, TabLayout } from '@/components/tabs/tab-props';\nimport { useTabRouting } from '@/components/tabs/tabs/use-tab-routing';\nimport { useTabScroll } from '@/components/tabs/tabs/use-tab-scroll';\nimport { tv } from '@/utils/tv';\n\ntype ChildNode = VNode & { props: Record<string, any> };\n\ninterface ResolvedTabProps {\n value?: string | number;\n to?: unknown;\n link?: boolean;\n exact?: boolean;\n exactPath?: boolean;\n}\n\nexport interface Props {\n color?: ContextColorsType;\n vertical?: boolean;\n disabled?: boolean;\n grow?: boolean;\n align?: TabAlignment;\n indicatorPosition?: TabIndicatorPosition;\n}\n\ndefineOptions({\n name: 'RuiTabs',\n});\n\n// Default 0 (first tab) matches the existing internal fallback on line 163.\n// Providing a default narrows the `update:modelValue` emit payload from\n// `value?: number | string` to `value: number | string`, so consumers can\n// type their handler signatures without undefined unions.\nconst modelValue = defineModel<number | string>({ default: 0 });\n\nconst {\n color,\n vertical = false,\n disabled = false,\n grow = false,\n align = 'center',\n indicatorPosition = 'end',\n} = defineProps<Props>();\n\nconst internalModelValue = ref<string | number>();\nconst bar = useTemplateRef<HTMLDivElement>('bar');\nconst wrapper = useTemplateRef<HTMLDivElement>('wrapper');\n\nconst tabs = tv({\n slots: {\n root: '',\n arrow: '',\n bar: 'no-scrollbar max-h-full overflow-auto',\n wrapper: 'h-full inline-flex max-w-none',\n },\n variants: {\n layout: {\n [TabLayout.horizontal]: {\n root: 'flex h-fit',\n arrow: 'h-[3rem] w-10',\n bar: 'h-[3rem]',\n wrapper: '',\n },\n [TabLayout.vertical]: {\n root: 'inline-flex flex-col',\n arrow: 'min-h-[3rem] w-full',\n bar: '',\n wrapper: 'flex-col h-auto',\n },\n },\n wide: {\n true: {\n bar: 'w-full',\n wrapper: 'min-w-full',\n },\n },\n },\n defaultVariants: { layout: TabLayout.horizontal },\n});\n\nconst slots = useSlots();\n\nconst {\n showArrows,\n prevArrowDisabled,\n nextArrowDisabled,\n onPrevSliderClick,\n onNextSliderClick,\n keepActiveTabVisible,\n} = useTabScroll({ bar, wrapper, vertical: () => vertical });\n\nconst { resolveRoute, isPathMatch } = useTabRouting({\n onRouteChange: () => applyNewValue(true),\n});\n\nconst layout = computed<TabLayout>(() => vertical ? TabLayout.vertical : TabLayout.horizontal);\nconst ui = computed<ReturnType<typeof tabs>>(() => tabs({ layout: get(layout), wide: vertical || grow }));\n\nconst children = computed<ChildNode[]>(() => {\n const slotContent = slots.default?.() ?? [];\n\n const tabs = getChildrenTabs(slotContent);\n\n const currentModelValue = get(internalModelValue);\n const inheritedProps = {\n color,\n grow,\n disabled,\n vertical,\n align,\n indicatorPosition,\n };\n\n return tabs.map((tab, index) => {\n let tabValue = tab.props?.value ?? index;\n if (tab.props?.link !== false && tab.props?.to)\n tabValue = tab.props.to;\n\n const active = currentModelValue === tabValue;\n return {\n ...tab,\n props: {\n value: tabValue,\n active,\n ...inheritedProps,\n ...tab.props,\n },\n };\n });\n});\n\n// When using dynamic content with v-for the slot content can contain fragment,\n// Go through the fragment and always return RuiTab only\nfunction getChildrenTabs(children: VNode[]): VNode[] {\n return children.flatMap((item) => {\n if (item.type === Fragment && Array.isArray(item.children) && item.children.length > 0)\n return getChildrenTabs(item.children.filter(isVNode));\n\n return [item];\n }).flat();\n}\n\nfunction updateModelValue(newModelValue: string | number): void {\n set(modelValue, newModelValue);\n set(internalModelValue, newModelValue);\n}\n\nfunction getTabRouteProps(props: Record<string, unknown>): ResolvedTabProps {\n return {\n value: typeof props.value === 'string' || typeof props.value === 'number' ? props.value : undefined,\n to: props.to ?? undefined,\n link: typeof props.link === 'boolean' ? props.link : undefined,\n exact: typeof props.exact === 'boolean' ? props.exact : undefined,\n exactPath: typeof props.exactPath === 'boolean' ? props.exactPath : undefined,\n };\n}\n\nfunction resolveActiveValue(onlyLink: boolean): string | number | undefined {\n const enabledChildren = get(children).filter(child => !child.props?.disabled);\n if (enabledChildren.length === 0)\n return undefined;\n\n let result: string | number = get(modelValue) || 0;\n enabledChildren.forEach((child, index) => {\n const tabProps = getTabRouteProps(child.props);\n if (!onlyLink && index === 0 && tabProps.value)\n result = tabProps.value;\n\n const fullPath = resolveRoute(tabProps.to);\n\n if (tabProps.link !== false && fullPath && isPathMatch(fullPath, tabProps))\n result = fullPath;\n });\n return result;\n}\n\nfunction applyNewValue(onlyLink = false): void {\n const value = resolveActiveValue(onlyLink);\n if (value !== undefined)\n updateModelValue(value);\n\n keepActiveTabVisible();\n}\n\nwatchImmediate(() => get(modelValue), (modelValue) => {\n set(internalModelValue, modelValue);\n});\n\nwatch(internalModelValue, () => {\n keepActiveTabVisible();\n});\n\nonMounted(() => {\n if (get(modelValue) !== undefined)\n return;\n\n applyNewValue();\n});\n</script>\n\n<template>\n <div\n :class=\"ui.root()\"\n :data-vertical=\"vertical || undefined\"\n >\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"prevArrowDisabled\"\n @click=\"onPrevSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-up' : 'lu-chevron-left'\" />\n </RuiButton>\n </div>\n <div\n ref=\"bar\"\n :class=\"ui.bar()\"\n >\n <div\n ref=\"wrapper\"\n role=\"tablist\"\n data-id=\"tabs-wrapper\"\n :class=\"ui.wrapper()\"\n >\n <Component\n :is=\"child\"\n v-for=\"(child, i) in children\"\n :key=\"i\"\n @click=\"updateModelValue($event)\"\n />\n </div>\n </div>\n <div\n v-if=\"showArrows\"\n :class=\"ui.arrow()\"\n >\n <RuiButton\n class=\"w-full h-full !rounded-none\"\n variant=\"text\"\n :color=\"color\"\n :disabled=\"nextArrowDisabled\"\n @click=\"onNextSliderClick()\"\n >\n <RuiIcon :name=\"vertical ? 'lu-chevron-down' : 'lu-chevron-right'\" />\n </RuiButton>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,MAAM,aAAa,SAA4B,SAAA,aAAgB;EAW/D,MAAM,qBAAqB,KAAsB;EACjD,MAAM,MAAM,eAA+B,MAAM;EACjD,MAAM,UAAU,eAA+B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A,OAAA,OAAA,MAAA,WAAE,MAAA,kBAAiB,EAAA;;4BAE4C,CAArE,YAAqE,iBAAA,EAA3D,MAAM,QAAA,WAAQ,oBAAA,oBAAA,EAAA,MAAA,GAAA,CAAA,OAAA,CAAA,CAAA,CAAA"}
|
|
@@ -23,7 +23,7 @@ export interface UseAutoCompleteKeyboardNavigationDeps<TItem> {
|
|
|
23
23
|
activator: Ref<HTMLElement | undefined> | TemplateRef<HTMLElement>;
|
|
24
24
|
}
|
|
25
25
|
export interface UseAutoCompleteKeyboardNavigationReturn {
|
|
26
|
-
focusedValueIndex:
|
|
26
|
+
focusedValueIndex: Ref<number>;
|
|
27
27
|
moveSelectedValueHighlight: (event: KeyboardEvent, next: boolean) => void;
|
|
28
28
|
onEnter: (event: KeyboardEvent) => void;
|
|
29
29
|
onTab: (event: KeyboardEvent) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nextTick,
|
|
1
|
+
import { nextTick, ref, toValue, watch } from "vue";
|
|
2
2
|
import { get, set } from "@vueuse/shared";
|
|
3
3
|
//#region src/composables/forms/auto-complete/keyboard-navigation.ts
|
|
4
4
|
function useAutoCompleteKeyboardNavigation(options, deps) {
|
|
@@ -105,7 +105,7 @@ function useAutoCompleteKeyboardNavigation(options, deps) {
|
|
|
105
105
|
});
|
|
106
106
|
});
|
|
107
107
|
return {
|
|
108
|
-
focusedValueIndex
|
|
108
|
+
focusedValueIndex,
|
|
109
109
|
moveSelectedValueHighlight,
|
|
110
110
|
onEnter,
|
|
111
111
|
onInputDeletePressed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-navigation.js","names":[],"sources":["../../../../src/composables/forms/auto-complete/keyboard-navigation.ts"],"sourcesContent":["import type { MaybeRefOrGetter, Ref, TemplateRef } from 'vue';\nimport { get, set } from '@vueuse/shared';\n\nexport interface UseAutoCompleteKeyboardNavigationOptions {\n /** Whether multiple items can be selected. */\n multiple: MaybeRefOrGetter<boolean>;\n /** Whether custom (free-text) values are allowed. */\n customValue: MaybeRefOrGetter<boolean>;\n /** Whether selected values are displayed as chips. */\n chips: MaybeRefOrGetter<boolean>;\n}\n\nexport interface UseAutoCompleteKeyboardNavigationDeps<TItem> {\n internalSearch: Ref<string>;\n value: Ref<TItem[]>;\n filteredOptions: Ref<TItem[]>;\n isOpen: Ref<boolean>;\n highlightedIndex: Ref<number>;\n userNavigated: Ref<boolean>;\n searchInputFocused: Ref<boolean>;\n applyHighlighted: () => void;\n clear: () => void;\n removeValue: (item: TItem) => void;\n setSearchAsValue: () => void;\n getText: (item: TItem) => string | undefined;\n activator: Ref<HTMLElement | undefined> | TemplateRef<HTMLElement>;\n}\n\nexport interface UseAutoCompleteKeyboardNavigationReturn {\n focusedValueIndex:
|
|
1
|
+
{"version":3,"file":"keyboard-navigation.js","names":[],"sources":["../../../../src/composables/forms/auto-complete/keyboard-navigation.ts"],"sourcesContent":["import type { MaybeRefOrGetter, Ref, TemplateRef } from 'vue';\nimport { get, set } from '@vueuse/shared';\n\nexport interface UseAutoCompleteKeyboardNavigationOptions {\n /** Whether multiple items can be selected. */\n multiple: MaybeRefOrGetter<boolean>;\n /** Whether custom (free-text) values are allowed. */\n customValue: MaybeRefOrGetter<boolean>;\n /** Whether selected values are displayed as chips. */\n chips: MaybeRefOrGetter<boolean>;\n}\n\nexport interface UseAutoCompleteKeyboardNavigationDeps<TItem> {\n internalSearch: Ref<string>;\n value: Ref<TItem[]>;\n filteredOptions: Ref<TItem[]>;\n isOpen: Ref<boolean>;\n highlightedIndex: Ref<number>;\n userNavigated: Ref<boolean>;\n searchInputFocused: Ref<boolean>;\n applyHighlighted: () => void;\n clear: () => void;\n removeValue: (item: TItem) => void;\n setSearchAsValue: () => void;\n getText: (item: TItem) => string | undefined;\n activator: Ref<HTMLElement | undefined> | TemplateRef<HTMLElement>;\n}\n\nexport interface UseAutoCompleteKeyboardNavigationReturn {\n focusedValueIndex: Ref<number>;\n moveSelectedValueHighlight: (event: KeyboardEvent, next: boolean) => void;\n onEnter: (event: KeyboardEvent) => void;\n onTab: (event: KeyboardEvent) => void;\n onInputDeletePressed: () => void;\n setValueFocus: (index: number) => void;\n}\n\nexport function useAutoCompleteKeyboardNavigation<TItem>(\n options: UseAutoCompleteKeyboardNavigationOptions,\n deps: UseAutoCompleteKeyboardNavigationDeps<TItem>,\n): UseAutoCompleteKeyboardNavigationReturn {\n const focusedValueIndex = ref<number>(-1);\n\n function setValueFocus(index: number): void {\n set(focusedValueIndex, index);\n }\n\n function moveSelectedValueHighlight(event: KeyboardEvent, next: boolean): void {\n const multiple = toValue(options.multiple);\n const internalSearchValue = get(deps.internalSearch);\n\n if (!multiple || internalSearchValue.length > 0)\n return;\n\n event.preventDefault();\n const total = get(deps.value).length;\n\n let current = get(focusedValueIndex);\n\n if (current === -1) {\n set(focusedValueIndex, next ? 0 : total - 1);\n return;\n }\n\n const move = next ? 1 : -1;\n current += move;\n\n if (current < 0 || current >= total) {\n set(focusedValueIndex, -1);\n set(deps.searchInputFocused, true);\n }\n else {\n set(focusedValueIndex, current);\n }\n }\n\n function highlightedMatchesSearch(filteredOptions: TItem[], highlightedIndex: number, search: string): boolean {\n if (highlightedIndex < 0 || highlightedIndex >= filteredOptions.length)\n return false;\n\n const option = filteredOptions[highlightedIndex];\n if (typeof option === 'string')\n return option === search;\n\n if (option && typeof option === 'object')\n return (deps.getText(option) ?? '') === search;\n\n return false;\n }\n\n function applyCustomValue(event: KeyboardEvent, multiple: boolean): void {\n deps.setSearchAsValue();\n if (!multiple)\n set(deps.isOpen, false);\n event.preventDefault();\n }\n\n function submitClosestForm(): void {\n const activator = get(deps.activator);\n const form = activator?.closest('form');\n form?.dispatchEvent(new Event('submit'));\n }\n\n function handleOpenMenuEnter(event: KeyboardEvent): boolean {\n const filteredOptions = get(deps.filteredOptions);\n const highlightedIndex = get(deps.highlightedIndex);\n const customValue = toValue(options.customValue);\n const multiple = toValue(options.multiple);\n const internalSearch = get(deps.internalSearch);\n\n const userNavigated = get(deps.userNavigated);\n\n if (userNavigated && highlightedIndex > -1 && filteredOptions.length > 0) {\n deps.applyHighlighted();\n event.preventDefault();\n return true;\n }\n\n if (customValue && internalSearch && !highlightedMatchesSearch(filteredOptions, highlightedIndex, internalSearch)) {\n applyCustomValue(event, multiple);\n return true;\n }\n\n if (highlightedIndex > -1 && filteredOptions.length > 0) {\n deps.applyHighlighted();\n event.preventDefault();\n return true;\n }\n\n if (filteredOptions.length === 0 && customValue && internalSearch) {\n applyCustomValue(event, multiple);\n return true;\n }\n\n return false;\n }\n\n function onEnter(event: KeyboardEvent): void {\n if (get(deps.isOpen) && handleOpenMenuEnter(event))\n return;\n\n // Nothing selected, menu closed: open menu\n if (!get(deps.isOpen) && get(deps.value).length === 0) {\n set(deps.isOpen, true);\n return event.preventDefault();\n }\n\n // Fallback: submit parent form\n submitClosestForm();\n }\n\n function onTab(event: KeyboardEvent): void {\n const isOpen = get(deps.isOpen);\n const filteredOptions = get(deps.filteredOptions);\n const highlightedIndex = get(deps.highlightedIndex);\n const multiple = toValue(options.multiple);\n\n if (isOpen && filteredOptions.length > 0 && highlightedIndex > -1 && !multiple) {\n deps.applyHighlighted();\n event.preventDefault();\n }\n }\n\n function onInputDeletePressed(): void {\n const internalSearch = get(deps.internalSearch);\n const value = get(deps.value);\n const total = value.length;\n const multiple = toValue(options.multiple);\n\n if (!internalSearch && total > 0) {\n if (multiple) {\n if (toValue(options.chips)) {\n set(focusedValueIndex, total - 1);\n }\n else {\n const lastItem = value[total - 1];\n if (lastItem !== undefined)\n deps.removeValue(lastItem);\n }\n }\n else {\n deps.clear();\n }\n }\n }\n\n // Watch value changes to reset focused index\n watch(deps.value, () => {\n setValueFocus(-1);\n });\n\n // Watch focused value index to handle chip focus\n watch(focusedValueIndex, async (index) => {\n const multiple = toValue(options.multiple);\n if (index === -1 || !multiple)\n return;\n\n await nextTick(() => {\n const activator = get(deps.activator);\n const element = activator?.querySelector<HTMLElement>(`[data-index=\"${index}\"]`);\n element?.focus();\n });\n });\n\n return {\n // eslint-disable-next-line @rotki/composable-return-readonly -- written by focus.ts onInputFocused\n focusedValueIndex,\n moveSelectedValueHighlight,\n onEnter,\n onInputDeletePressed,\n onTab,\n setValueFocus,\n };\n}\n"],"mappings":";;;AAqCA,SAAgB,kCACd,SACA,MACyC;CACzC,MAAM,oBAAoB,IAAY,GAAG;CAEzC,SAAS,cAAc,OAAqB;AAC1C,MAAI,mBAAmB,MAAM;;CAG/B,SAAS,2BAA2B,OAAsB,MAAqB;EAC7E,MAAM,WAAW,QAAQ,QAAQ,SAAS;EAC1C,MAAM,sBAAsB,IAAI,KAAK,eAAe;AAEpD,MAAI,CAAC,YAAY,oBAAoB,SAAS,EAC5C;AAEF,QAAM,gBAAgB;EACtB,MAAM,QAAQ,IAAI,KAAK,MAAM,CAAC;EAE9B,IAAI,UAAU,IAAI,kBAAkB;AAEpC,MAAI,YAAY,IAAI;AAClB,OAAI,mBAAmB,OAAO,IAAI,QAAQ,EAAE;AAC5C;;AAIF,aADa,OAAO,IAAI;AAGxB,MAAI,UAAU,KAAK,WAAW,OAAO;AACnC,OAAI,mBAAmB,GAAG;AAC1B,OAAI,KAAK,oBAAoB,KAAK;QAGlC,KAAI,mBAAmB,QAAQ;;CAInC,SAAS,yBAAyB,iBAA0B,kBAA0B,QAAyB;AAC7G,MAAI,mBAAmB,KAAK,oBAAoB,gBAAgB,OAC9D,QAAO;EAET,MAAM,SAAS,gBAAgB;AAC/B,MAAI,OAAO,WAAW,SACpB,QAAO,WAAW;AAEpB,MAAI,UAAU,OAAO,WAAW,SAC9B,SAAQ,KAAK,QAAQ,OAAO,IAAI,QAAQ;AAE1C,SAAO;;CAGT,SAAS,iBAAiB,OAAsB,UAAyB;AACvE,OAAK,kBAAkB;AACvB,MAAI,CAAC,SACH,KAAI,KAAK,QAAQ,MAAM;AACzB,QAAM,gBAAgB;;CAGxB,SAAS,oBAA0B;AAGjC,GAFkB,IAAI,KAAK,UAAU,EACb,QAAQ,OAAO,GACjC,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AI1B,SAAS,uBAA6B;EACpC,MAAM,iBAAiB,IAAI,KAAK,eAAe;EAC/C,MAAM,QAAQ,IAAI,KAAK,MAAM;EAC7B,MAAM,QAAQ,MAAM;EACpB,MAAM,WAAW,QAAQ,QAAQ,SAAS;AAE1C,MAAI,CAAC,kBAAkB,QAAQ,EAC7B,KAAI,SACF,KAAI,QAAQ,QAAQ,MAAM,CACxB,KAAI,mBAAmB,QAAQ,EAAE;OAE9B;GACH,MAAM,WAAW,MAAM,QAAQ;AAC/B,OAAI,aAAa,KAAA,EACf,MAAK,YAAY,SAAS;;MAI9B,MAAK,OAAO;;AAMlB,OAAM,KAAK,aAAa;AACtB,gBAAc,GAAG;GACjB;AAGF,OAAM,mBAAmB,OAAO,UAAU;EACxC,MAAM,WAAW,QAAQ,QAAQ,SAAS;AAC1C,MAAI,UAAU,MAAM,CAAC,SACnB;AAEF,QAAM,eAAe;AAGnB,IAFkB,IAAI,KAAK,UAAU,EACV,cAA2B,gBAAgB,MAAM,IAAI,GACvE,OAAO;IAChB;GACF;AAEF,QAAO;EAEL;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -7,7 +7,6 @@ export interface UseTableExpansionOptions<T extends object, IdType extends keyof
|
|
|
7
7
|
}
|
|
8
8
|
export interface UseTableExpansionDeps<T extends object> {
|
|
9
9
|
expanded: Ref<T[] | undefined>;
|
|
10
|
-
hasExpandedItemSlot: Ref<boolean>;
|
|
11
10
|
}
|
|
12
11
|
export interface UseTableExpansionReturn<T extends object, IdType extends keyof T> {
|
|
13
12
|
expandable: ComputedRef<boolean>;
|
|
@@ -3,8 +3,8 @@ import { get, set } from "@vueuse/shared";
|
|
|
3
3
|
//#region src/composables/tables/data-table/expansion.ts
|
|
4
4
|
function useTableExpansion(options, deps) {
|
|
5
5
|
const { rowAttr, singleExpand } = options;
|
|
6
|
-
const { expanded
|
|
7
|
-
const expandable = computed(() => !!get(expanded)
|
|
6
|
+
const { expanded } = deps;
|
|
7
|
+
const expandable = computed(() => !!get(expanded));
|
|
8
8
|
const expandedSet = computed(() => {
|
|
9
9
|
const expandedVal = get(expanded);
|
|
10
10
|
if (!expandedVal?.length) return /* @__PURE__ */ new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expansion.js","names":[],"sources":["../../../../src/composables/tables/data-table/expansion.ts"],"sourcesContent":["import type { ComputedRef, Ref } from 'vue';\n\nexport interface UseTableExpansionOptions<T extends object, IdType extends keyof T> {\n /** The property on each row used as the unique row identifier. */\n rowAttr: IdType;\n /** Whether only one row can be expanded at a time. */\n singleExpand: boolean;\n}\n\nexport interface UseTableExpansionDeps<T extends object> {\n expanded: Ref<T[] | undefined>;\n
|
|
1
|
+
{"version":3,"file":"expansion.js","names":[],"sources":["../../../../src/composables/tables/data-table/expansion.ts"],"sourcesContent":["import type { ComputedRef, Ref } from 'vue';\n\nexport interface UseTableExpansionOptions<T extends object, IdType extends keyof T> {\n /** The property on each row used as the unique row identifier. */\n rowAttr: IdType;\n /** Whether only one row can be expanded at a time. */\n singleExpand: boolean;\n}\n\nexport interface UseTableExpansionDeps<T extends object> {\n expanded: Ref<T[] | undefined>;\n}\n\nexport interface UseTableExpansionReturn<T extends object, IdType extends keyof T> {\n expandable: ComputedRef<boolean>;\n isExpanded: (identifier: T[IdType]) => boolean;\n onToggleExpand: (row: T) => void;\n}\n\nexport function useTableExpansion<T extends object, IdType extends keyof T>(\n options: UseTableExpansionOptions<T, IdType>,\n deps: UseTableExpansionDeps<T>,\n): UseTableExpansionReturn<T, IdType> {\n const { rowAttr, singleExpand } = options;\n const { expanded } = deps;\n\n // `expandable` only tracks whether the consumer has wired a two-way\n // `expanded` model. Whether an `#expanded-item` slot is present is\n // checked fresh in the template (`!!$slots['expanded-item']`) so that\n // consumers which gate the slot with `v-if` (e.g. only after data\n // loads) don't get stuck on the first-render slot snapshot — Vue's\n // `slots` object is not reactive to property access inside a computed.\n const expandable = computed<boolean>(() => !!get(expanded));\n\n const expandedSet = computed<Set<T[IdType]>>(() => {\n const expandedVal = get(expanded);\n if (!expandedVal?.length)\n return new Set<T[IdType]>();\n return new Set<T[IdType]>(expandedVal.map(row => row[rowAttr]));\n });\n\n function isExpanded(identifier: T[IdType]): boolean {\n return get(expandedSet).has(identifier);\n }\n\n function onToggleExpand(row: T): void {\n const expandedVal = get(expanded);\n if (!expandedVal)\n return;\n\n const key = rowAttr;\n const rowExpanded = isExpanded(row[key]);\n\n if (singleExpand)\n return set(expanded, rowExpanded ? [] : [row]);\n\n return set(\n expanded,\n rowExpanded ? expandedVal.filter(item => item[key] !== row[key]) : [...expandedVal, row],\n );\n }\n\n return {\n expandable,\n isExpanded,\n onToggleExpand,\n };\n}\n"],"mappings":";;;AAmBA,SAAgB,kBACd,SACA,MACoC;CACpC,MAAM,EAAE,SAAS,iBAAiB;CAClC,MAAM,EAAE,aAAa;CAQrB,MAAM,aAAa,eAAwB,CAAC,CAAC,IAAI,SAAS,CAAC;CAE3D,MAAM,cAAc,eAA+B;EACjD,MAAM,cAAc,IAAI,SAAS;AACjC,MAAI,CAAC,aAAa,OAChB,wBAAO,IAAI,KAAgB;AAC7B,SAAO,IAAI,IAAe,YAAY,KAAI,QAAO,IAAI,SAAS,CAAC;GAC/D;CAEF,SAAS,WAAW,YAAgC;AAClD,SAAO,IAAI,YAAY,CAAC,IAAI,WAAW;;CAGzC,SAAS,eAAe,KAAc;EACpC,MAAM,cAAc,IAAI,SAAS;AACjC,MAAI,CAAC,YACH;EAEF,MAAM,MAAM;EACZ,MAAM,cAAc,WAAW,IAAI,KAAK;AAExC,MAAI,aACF,QAAO,IAAI,UAAU,cAAc,EAAE,GAAG,CAAC,IAAI,CAAC;AAEhD,SAAO,IACL,UACA,cAAc,YAAY,QAAO,SAAQ,KAAK,SAAS,IAAI,KAAK,GAAG,CAAC,GAAG,aAAa,IAAI,CACzF;;AAGH,QAAO;EACL;EACA;EACA;EACD"}
|
package/dist/style.css
CHANGED
|
@@ -1278,10 +1278,6 @@ html[data-theme="dark"], html.dark {
|
|
|
1278
1278
|
height: 0px !important;
|
|
1279
1279
|
}
|
|
1280
1280
|
|
|
1281
|
-
.\!h-\[3rem\] {
|
|
1282
|
-
height: 3rem !important;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
1281
|
.\!h-auto {
|
|
1286
1282
|
height: auto !important;
|
|
1287
1283
|
}
|
|
@@ -1427,6 +1423,10 @@ html[data-theme="dark"], html.dark {
|
|
|
1427
1423
|
min-height: 2rem !important;
|
|
1428
1424
|
}
|
|
1429
1425
|
|
|
1426
|
+
.\!min-h-\[3rem\] {
|
|
1427
|
+
min-height: 3rem !important;
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
1430
|
.min-h-1\.5 {
|
|
1431
1431
|
min-height: 0.375rem;
|
|
1432
1432
|
}
|
|
@@ -1559,6 +1559,10 @@ html[data-theme="dark"], html.dark {
|
|
|
1559
1559
|
width: 200%;
|
|
1560
1560
|
}
|
|
1561
1561
|
|
|
1562
|
+
.w-\[20rem\] {
|
|
1563
|
+
width: 20rem;
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1562
1566
|
.w-\[3\.625rem\] {
|
|
1563
1567
|
width: 3.625rem;
|
|
1564
1568
|
}
|
|
@@ -1941,6 +1945,10 @@ html[data-theme="dark"], html.dark {
|
|
|
1941
1945
|
animation: slide-rail 1.6s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
|
|
1942
1946
|
}
|
|
1943
1947
|
|
|
1948
|
+
.\!cursor-progress {
|
|
1949
|
+
cursor: progress !important;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1944
1952
|
.cursor-default {
|
|
1945
1953
|
cursor: default;
|
|
1946
1954
|
}
|
|
@@ -2973,6 +2981,11 @@ html[data-theme="dark"], html.dark {
|
|
|
2973
2981
|
padding-right: 0.5rem;
|
|
2974
2982
|
}
|
|
2975
2983
|
|
|
2984
|
+
.px-2\.5 {
|
|
2985
|
+
padding-left: 0.625rem;
|
|
2986
|
+
padding-right: 0.625rem;
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2976
2989
|
.px-3 {
|
|
2977
2990
|
padding-left: 0.75rem;
|
|
2978
2991
|
padding-right: 0.75rem;
|
|
@@ -2988,11 +3001,6 @@ html[data-theme="dark"], html.dark {
|
|
|
2988
3001
|
padding-right: 1.5rem;
|
|
2989
3002
|
}
|
|
2990
3003
|
|
|
2991
|
-
.px-8 {
|
|
2992
|
-
padding-left: 2rem;
|
|
2993
|
-
padding-right: 2rem;
|
|
2994
|
-
}
|
|
2995
|
-
|
|
2996
3004
|
.py-1 {
|
|
2997
3005
|
padding-top: 0.25rem;
|
|
2998
3006
|
padding-bottom: 0.25rem;
|
|
@@ -3190,6 +3198,10 @@ html[data-theme="dark"], html.dark {
|
|
|
3190
3198
|
font-size: 0.6rem;
|
|
3191
3199
|
}
|
|
3192
3200
|
|
|
3201
|
+
.text-\[0\.75rem\] {
|
|
3202
|
+
font-size: 0.75rem;
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3193
3205
|
.text-\[0\.7rem\] {
|
|
3194
3206
|
font-size: 0.7rem;
|
|
3195
3207
|
}
|
|
@@ -3198,10 +3210,18 @@ html[data-theme="dark"], html.dark {
|
|
|
3198
3210
|
font-size: 0.8125rem;
|
|
3199
3211
|
}
|
|
3200
3212
|
|
|
3213
|
+
.text-\[0\.875rem\] {
|
|
3214
|
+
font-size: 0.875rem;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3201
3217
|
.text-\[1\.25rem\] {
|
|
3202
3218
|
font-size: 1.25rem;
|
|
3203
3219
|
}
|
|
3204
3220
|
|
|
3221
|
+
.text-\[1rem\] {
|
|
3222
|
+
font-size: 1rem;
|
|
3223
|
+
}
|
|
3224
|
+
|
|
3205
3225
|
.text-base {
|
|
3206
3226
|
font-size: 1rem;
|
|
3207
3227
|
line-height: 1.5rem;
|
|
@@ -3259,6 +3279,10 @@ html[data-theme="dark"], html.dark {
|
|
|
3259
3279
|
line-height: .75rem;
|
|
3260
3280
|
}
|
|
3261
3281
|
|
|
3282
|
+
.leading-4 {
|
|
3283
|
+
line-height: 1rem;
|
|
3284
|
+
}
|
|
3285
|
+
|
|
3262
3286
|
.leading-5 {
|
|
3263
3287
|
line-height: 1.25rem;
|
|
3264
3288
|
}
|
|
@@ -4635,6 +4659,18 @@ body {
|
|
|
4635
4659
|
background-color: rgba(var(--rui-primary-main), 0.1);
|
|
4636
4660
|
}
|
|
4637
4661
|
|
|
4662
|
+
.focus-visible\:\!ring-0:focus-visible {
|
|
4663
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;
|
|
4664
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;
|
|
4665
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4668
|
+
.focus-visible\:\!ring-2:focus-visible {
|
|
4669
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color) !important;
|
|
4670
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color) !important;
|
|
4671
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000) !important;
|
|
4672
|
+
}
|
|
4673
|
+
|
|
4638
4674
|
.active\:bg-black\/10:active {
|
|
4639
4675
|
background-color: rgb(0 0 0 / 0.1);
|
|
4640
4676
|
}
|
|
@@ -4719,14 +4755,30 @@ body {
|
|
|
4719
4755
|
cursor: default;
|
|
4720
4756
|
}
|
|
4721
4757
|
|
|
4758
|
+
.disabled\:cursor-not-allowed:disabled {
|
|
4759
|
+
cursor: not-allowed;
|
|
4760
|
+
}
|
|
4761
|
+
|
|
4722
4762
|
.disabled\:border-transparent:disabled {
|
|
4723
4763
|
border-color: transparent;
|
|
4724
4764
|
}
|
|
4725
4765
|
|
|
4766
|
+
.disabled\:\!bg-black\/\[\.12\]:disabled {
|
|
4767
|
+
background-color: rgb(0 0 0 / .12) !important;
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
.disabled\:\!bg-transparent:disabled {
|
|
4771
|
+
background-color: transparent !important;
|
|
4772
|
+
}
|
|
4773
|
+
|
|
4726
4774
|
.disabled\:bg-black\/\[\.12\]:disabled {
|
|
4727
4775
|
background-color: rgb(0 0 0 / .12);
|
|
4728
4776
|
}
|
|
4729
4777
|
|
|
4778
|
+
.disabled\:\!text-rui-text-disabled:disabled {
|
|
4779
|
+
color: var(--rui-text-disabled) !important;
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4730
4782
|
.disabled\:text-rui-text-disabled:disabled {
|
|
4731
4783
|
color: var(--rui-text-disabled);
|
|
4732
4784
|
}
|
|
@@ -4735,6 +4787,14 @@ body {
|
|
|
4735
4787
|
outline-color: var(--rui-text-disabled);
|
|
4736
4788
|
}
|
|
4737
4789
|
|
|
4790
|
+
.disabled\:active\:\!bg-transparent:active:disabled {
|
|
4791
|
+
background-color: transparent !important;
|
|
4792
|
+
}
|
|
4793
|
+
|
|
4794
|
+
.disabled\:active\:\!text-rui-text-disabled:active:disabled {
|
|
4795
|
+
color: var(--rui-text-disabled) !important;
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4738
4798
|
.disabled\:active\:text-rui-text-disabled:active:disabled {
|
|
4739
4799
|
color: var(--rui-text-disabled);
|
|
4740
4800
|
}
|
|
@@ -4759,14 +4819,12 @@ body {
|
|
|
4759
4819
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
4760
4820
|
}
|
|
4761
4821
|
|
|
4762
|
-
.peer:-webkit-autofill ~ .peer-autofill\:text
|
|
4822
|
+
.peer:-webkit-autofill ~ .peer-autofill\:text-\[0\.75rem\] {
|
|
4763
4823
|
font-size: 0.75rem;
|
|
4764
|
-
line-height: 1rem;
|
|
4765
4824
|
}
|
|
4766
4825
|
|
|
4767
|
-
.peer:autofill ~ .peer-autofill\:text
|
|
4826
|
+
.peer:autofill ~ .peer-autofill\:text-\[0\.75rem\] {
|
|
4768
4827
|
font-size: 0.75rem;
|
|
4769
|
-
line-height: 1rem;
|
|
4770
4828
|
}
|
|
4771
4829
|
|
|
4772
4830
|
.peer:-webkit-autofill ~ .peer-autofill\:leading-tight {
|
|
@@ -5329,6 +5387,14 @@ body {
|
|
|
5329
5387
|
background-color: rgb(255 255 255 / 0.1);
|
|
5330
5388
|
}
|
|
5331
5389
|
|
|
5390
|
+
.dark\:disabled\:\!bg-transparent:disabled:is([data-theme="dark"] *) {
|
|
5391
|
+
background-color: transparent !important;
|
|
5392
|
+
}
|
|
5393
|
+
|
|
5394
|
+
.dark\:disabled\:\!bg-white\/\[\.12\]:disabled:is([data-theme="dark"] *) {
|
|
5395
|
+
background-color: rgb(255 255 255 / .12) !important;
|
|
5396
|
+
}
|
|
5397
|
+
|
|
5332
5398
|
.dark\:disabled\:bg-white\/10:disabled:is([data-theme="dark"] *) {
|
|
5333
5399
|
background-color: rgb(255 255 255 / 0.1);
|
|
5334
5400
|
}
|
package/dist/utils/tv.d.ts
CHANGED
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
* @see https://www.tailwind-variants.org/docs/introduction
|
|
9
9
|
*/
|
|
10
10
|
import type { VueClassValue } from '../types/class-value';
|
|
11
|
+
import { type ClassValue } from 'vue';
|
|
11
12
|
export declare const tv: import("tailwind-variants").TV;
|
|
12
13
|
/**
|
|
13
|
-
* Normalizes
|
|
14
|
-
* compatible with tailwind-variants' class
|
|
14
|
+
* Normalizes any Vue `:class` binding value (string, object, array, nullish
|
|
15
|
+
* or `false`) to a plain string compatible with tailwind-variants' `class`
|
|
16
|
+
* parameter. Accepts Vue's runtime `ClassValue` so call sites can pass
|
|
17
|
+
* `$attrs.class` directly without casting.
|
|
15
18
|
*/
|
|
16
|
-
export declare function cn(value: VueClassValue | undefined): string | undefined;
|
|
19
|
+
export declare function cn(value: ClassValue | VueClassValue | undefined): string | undefined;
|
package/dist/utils/tv.js
CHANGED
|
@@ -6,14 +6,24 @@ var tv = /* @__PURE__ */ createTV({ twMergeConfig: { classGroups: {
|
|
|
6
6
|
"bg-tint": [{ "bg-tint": [isAny] }],
|
|
7
7
|
"bg-shade": [{ "bg-shade": [isAny] }],
|
|
8
8
|
"text-tint": [{ "text-tint": [isAny] }],
|
|
9
|
-
"text-shade": [{ "text-shade": [isAny] }]
|
|
9
|
+
"text-shade": [{ "text-shade": [isAny] }],
|
|
10
|
+
"text-color": [{ "text-rui": [isAny] }],
|
|
11
|
+
"font-size": [
|
|
12
|
+
{ "text-body": [isAny] },
|
|
13
|
+
"text-caption",
|
|
14
|
+
"text-overline",
|
|
15
|
+
{ "text-h": [isAny] },
|
|
16
|
+
{ "text-subtitle": [isAny] }
|
|
17
|
+
]
|
|
10
18
|
} } });
|
|
11
19
|
/**
|
|
12
|
-
* Normalizes
|
|
13
|
-
* compatible with tailwind-variants' class
|
|
20
|
+
* Normalizes any Vue `:class` binding value (string, object, array, nullish
|
|
21
|
+
* or `false`) to a plain string compatible with tailwind-variants' `class`
|
|
22
|
+
* parameter. Accepts Vue's runtime `ClassValue` so call sites can pass
|
|
23
|
+
* `$attrs.class` directly without casting.
|
|
14
24
|
*/
|
|
15
25
|
function cn(value) {
|
|
16
|
-
if (value == null) return void 0;
|
|
26
|
+
if (value == null || value === false) return void 0;
|
|
17
27
|
if (typeof value === "string") return value || void 0;
|
|
18
28
|
return normalizeClass(value) || void 0;
|
|
19
29
|
}
|
package/dist/utils/tv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tv.js","names":[],"sources":["../../src/utils/tv.ts"],"sourcesContent":["/**\n * Tailwind Variants wrapper.\n *\n * Re-exports `tv` from `tailwind-variants` with project-level configuration.\n * Uses `createTV()` so we can extend twMerge config for custom theme classes\n * (e.g., `text-rui-primary`) in the future.\n *\n * @see https://www.tailwind-variants.org/docs/introduction\n */\n\nimport type { VueClassValue } from '@/types/class-value';\nimport { createTV } from 'tailwind-variants';\nimport { normalizeClass } from 'vue';\n\nconst isAny: (v: string) => boolean = () => true;\n\nexport const tv = /* @__PURE__ */ createTV({\n twMergeConfig: {\n classGroups: {\n 'bg-tint': [{ 'bg-tint': [isAny] }],\n 'bg-shade': [{ 'bg-shade': [isAny] }],\n 'text-tint': [{ 'text-tint': [isAny] }],\n 'text-shade': [{ 'text-shade': [isAny] }],\n },\n },\n});\n\n/**\n * Normalizes
|
|
1
|
+
{"version":3,"file":"tv.js","names":[],"sources":["../../src/utils/tv.ts"],"sourcesContent":["/**\n * Tailwind Variants wrapper.\n *\n * Re-exports `tv` from `tailwind-variants` with project-level configuration.\n * Uses `createTV()` so we can extend twMerge config for custom theme classes\n * (e.g., `text-rui-primary`) in the future.\n *\n * @see https://www.tailwind-variants.org/docs/introduction\n */\n\nimport type { VueClassValue } from '@/types/class-value';\nimport { createTV } from 'tailwind-variants';\nimport { type ClassValue, normalizeClass } from 'vue';\n\nconst isAny: (v: string) => boolean = () => true;\n\nexport const tv = /* @__PURE__ */ createTV({\n twMergeConfig: {\n classGroups: {\n 'bg-tint': [{ 'bg-tint': [isAny] }],\n 'bg-shade': [{ 'bg-shade': [isAny] }],\n 'text-tint': [{ 'text-tint': [isAny] }],\n 'text-shade': [{ 'text-shade': [isAny] }],\n // Custom theme colors (text-rui-*) belong to the text-color group so\n // they don't conflict with the custom typography utilities below, which\n // tw-merge would otherwise both classify as font-size.\n 'text-color': [{ 'text-rui': [isAny] }],\n 'font-size': [\n { 'text-body': [isAny] },\n 'text-caption',\n 'text-overline',\n { 'text-h': [isAny] },\n { 'text-subtitle': [isAny] },\n ],\n },\n },\n});\n\n/**\n * Normalizes any Vue `:class` binding value (string, object, array, nullish\n * or `false`) to a plain string compatible with tailwind-variants' `class`\n * parameter. Accepts Vue's runtime `ClassValue` so call sites can pass\n * `$attrs.class` directly without casting.\n */\nexport function cn(value: ClassValue | VueClassValue | undefined): string | undefined {\n if (value == null || value === false)\n return undefined;\n if (typeof value === 'string')\n return value || undefined;\n const result = normalizeClass(value);\n return result || undefined;\n}\n"],"mappings":";;;AAcA,IAAM,cAAsC;AAE5C,IAAa,KAAqB,yBAAS,EACzC,eAAe,EACb,aAAa;CACX,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;CACnC,YAAY,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;CACrC,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC;CACvC,cAAc,CAAC,EAAE,cAAc,CAAC,MAAM,EAAE,CAAC;CAIzC,cAAc,CAAC,EAAE,YAAY,CAAC,MAAM,EAAE,CAAC;CACvC,aAAa;EACX,EAAE,aAAa,CAAC,MAAM,EAAE;EACxB;EACA;EACA,EAAE,UAAU,CAAC,MAAM,EAAE;EACrB,EAAE,iBAAiB,CAAC,MAAM,EAAE;EAC7B;CACF,EACF,EACF,CAAC;;;;;;;AAQF,SAAgB,GAAG,OAAmE;AACpF,KAAI,SAAS,QAAQ,UAAU,MAC7B,QAAO,KAAA;AACT,KAAI,OAAO,UAAU,SACnB,QAAO,SAAS,KAAA;AAElB,QADe,eAAe,MAAM,IACnB,KAAA"}
|
|
@@ -23,7 +23,7 @@ function loadValidIcons() {
|
|
|
23
23
|
try {
|
|
24
24
|
const distPath = resolve(__dirname, "../icons/index.js");
|
|
25
25
|
if (existsSync(distPath)) {
|
|
26
|
-
const match = readFileSync(distPath, "utf-8").match(/const RuiIcons = \[(.*?)]
|
|
26
|
+
const match = readFileSync(distPath, "utf-8").match(/(?:const|var|let) RuiIcons = \[(.*?)];?/s);
|
|
27
27
|
if (match?.[1]) {
|
|
28
28
|
const icons = match[1].match(/"([^"]+)"/g)?.map((s) => s.slice(1, -1)) || [];
|
|
29
29
|
return new Set(icons);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite-plugin/index.ts"],"sourcesContent":["import type { Plugin, ViteDevServer } from 'vite';\nimport type { RuiIconsPluginOptions, ScanResult } from './types';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n extractIconsFromSource,\n generateVirtualModule,\n validateIcons,\n} from './scanner';\n\nconst VIRTUAL_MODULE_ID = 'virtual:rotki-icons';\nconst RESOLVED_VIRTUAL_MODULE_ID = `\\0${VIRTUAL_MODULE_ID}`;\n\nconst DEFAULT_SCAN_PATTERNS = ['**/*.vue', '**/*.ts', '**/*.tsx'];\nconst EXCLUDED_PATTERNS = ['**/node_modules/**', '**/dist/**', '**/.git/**'];\n\n// Get __dirname equivalent in ES modules\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Loads the valid RuiIcons array from the library\n */\nfunction loadValidIcons(): Set<string> {\n // Import the RuiIcons array from the icons module\n // This will be resolved at build time\n try {\n // Try to load from the built dist first (for consumers)\n const distPath = resolve(__dirname, '../icons/index.js');\n if (existsSync(distPath)) {\n // Read and parse the file to extract the RuiIcons array\n const content = readFileSync(distPath, 'utf-8');\n // eslint-disable-next-line regexp/strict\n const match = content.match(/const RuiIcons = \\[(.*?)]
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/vite-plugin/index.ts"],"sourcesContent":["import type { Plugin, ViteDevServer } from 'vite';\nimport type { RuiIconsPluginOptions, ScanResult } from './types';\nimport { existsSync, readFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport {\n extractIconsFromSource,\n generateVirtualModule,\n validateIcons,\n} from './scanner';\n\nconst VIRTUAL_MODULE_ID = 'virtual:rotki-icons';\nconst RESOLVED_VIRTUAL_MODULE_ID = `\\0${VIRTUAL_MODULE_ID}`;\n\nconst DEFAULT_SCAN_PATTERNS = ['**/*.vue', '**/*.ts', '**/*.tsx'];\nconst EXCLUDED_PATTERNS = ['**/node_modules/**', '**/dist/**', '**/.git/**'];\n\n// Get __dirname equivalent in ES modules\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\n/**\n * Loads the valid RuiIcons array from the library\n */\nfunction loadValidIcons(): Set<string> {\n // Import the RuiIcons array from the icons module\n // This will be resolved at build time\n try {\n // Try to load from the built dist first (for consumers)\n const distPath = resolve(__dirname, '../icons/index.js');\n if (existsSync(distPath)) {\n // Read and parse the file to extract the RuiIcons array\n const content = readFileSync(distPath, 'utf-8');\n // eslint-disable-next-line regexp/strict\n const match = content.match(/(?:const|var|let) RuiIcons = \\[(.*?)];?/s);\n if (match?.[1]) {\n const iconsStr = match[1];\n const icons = iconsStr.match(/\"([^\"]+)\"/g)?.map(s => s.slice(1, -1)) || [];\n return new Set(icons);\n }\n }\n }\n catch {\n // Fallback: parse the icons source file directly\n }\n\n // Fallback: read and parse the source file\n const sourcePath = resolve(__dirname, '../icons/index.ts');\n if (existsSync(sourcePath)) {\n const content = readFileSync(sourcePath, 'utf-8');\n // eslint-disable-next-line regexp/strict\n const match = content.match(/export const RuiIcons = \\[(.*?)] as const/s);\n if (match?.[1]) {\n const iconsStr = match[1];\n const icons = iconsStr.match(/\"([^\"]+)\"/g)?.map(s => s.slice(1, -1)) || [];\n return new Set(icons);\n }\n }\n\n console.warn('[@rotki/ui-library] Could not load RuiIcons list, validation disabled');\n return new Set();\n}\n\n/**\n * Vite plugin for automatic icon detection and registration\n */\nexport function ruiIconsPlugin(options: RuiIconsPluginOptions = {}): Plugin {\n const {\n include = [],\n scanPatterns = DEFAULT_SCAN_PATTERNS,\n strict = false,\n debug = false,\n } = options;\n\n let validIcons: Set<string>;\n let scanResult: ScanResult;\n let server: ViteDevServer | null = null;\n let root: string;\n\n const log = (message: string): void => {\n if (debug) {\n // eslint-disable-next-line no-console\n console.log(`[@rotki/ui-library/icons] ${message}`);\n }\n };\n\n const warn = (message: string): void => {\n console.warn(`[@rotki/ui-library/icons] ${message}`);\n };\n\n /**\n * Scans all matching files for icon usage\n */\n async function scanFiles(): Promise<void> {\n const fg = await import('fast-glob');\n const glob = fg.default || fg;\n\n scanResult = {\n icons: new Set(include),\n invalidIcons: new Map(),\n };\n\n const files = glob.sync(scanPatterns, {\n cwd: root,\n ignore: EXCLUDED_PATTERNS,\n absolute: true,\n });\n\n log(`Scanning ${files.length} files for icon usage...`);\n\n for (const filePath of files) {\n try {\n const content = readFileSync(filePath, 'utf-8');\n const detectedIcons = extractIconsFromSource(content);\n\n if (detectedIcons.size > 0) {\n log(`Found ${detectedIcons.size} potential icons in ${filePath}`);\n validateIcons(detectedIcons, validIcons, filePath, scanResult);\n }\n }\n catch {\n warn(`Failed to read file: ${filePath}`);\n }\n }\n\n // Add manually included icons\n for (const icon of include) {\n if (validIcons.has(icon)) {\n scanResult.icons.add(icon);\n }\n else {\n warn(`Included icon \"${icon}\" is not a valid RuiIcon`);\n }\n }\n\n log(`Detected ${scanResult.icons.size} valid icons`);\n\n // Report invalid icons\n if (scanResult.invalidIcons.size > 0) {\n const invalidList = [...scanResult.invalidIcons.entries()]\n .map(([icon, files]) => ` - \"${icon}\" in: ${files.join(', ')}`)\n .join('\\n');\n\n const message = `Found ${scanResult.invalidIcons.size} invalid icon name(s):\\n${invalidList}`;\n\n if (strict) {\n throw new Error(message);\n }\n else {\n warn(message);\n }\n }\n }\n\n /**\n * Handles file changes in dev mode\n */\n function handleFileChange(filePath: string): void {\n // Check if the changed file matches our scan patterns\n const isRelevantFile = scanPatterns.some((pattern) => {\n const ext = filePath.split('.').pop();\n return pattern.includes(`*.${ext}`);\n });\n\n if (!isRelevantFile)\n return;\n\n try {\n const content = readFileSync(filePath, 'utf-8');\n const detectedIcons = extractIconsFromSource(content);\n const previousSize = scanResult.icons.size;\n\n validateIcons(detectedIcons, validIcons, filePath, scanResult);\n\n // If new icons were detected, invalidate the virtual module\n if (scanResult.icons.size > previousSize) {\n log(`New icons detected in ${filePath}, invalidating virtual module...`);\n\n // Invalidate the virtual module to trigger re-import\n const mod = server?.moduleGraph.getModuleById(RESOLVED_VIRTUAL_MODULE_ID);\n if (mod) {\n server?.moduleGraph.invalidateModule(mod);\n // Trigger HMR update\n server?.ws.send({\n type: 'full-reload',\n path: '*',\n });\n }\n }\n }\n catch {\n // Ignore read errors\n }\n }\n\n return {\n name: 'rotki-ui-library-icons',\n enforce: 'pre',\n\n configResolved(config) {\n root = config.root;\n validIcons = loadValidIcons();\n log(`Loaded ${validIcons.size} valid icon names`);\n },\n\n configureServer(_server) {\n server = _server;\n\n // Watch for file changes\n server.watcher.on('change', handleFileChange);\n server.watcher.on('add', handleFileChange);\n },\n\n async buildStart() {\n await scanFiles();\n },\n\n resolveId(id) {\n if (id === VIRTUAL_MODULE_ID) {\n return RESOLVED_VIRTUAL_MODULE_ID;\n }\n },\n\n load(id) {\n if (id === RESOLVED_VIRTUAL_MODULE_ID) {\n const moduleContent = generateVirtualModule(scanResult.icons);\n log(`Generated virtual module with ${scanResult.icons.size} icons`);\n return moduleContent;\n }\n },\n };\n}\n\nexport type { RuiIconsPluginOptions } from './types';\n\n// eslint-disable-next-line import/no-default-export\nexport default ruiIconsPlugin;\n"],"mappings":";;;;;AAWA,IAAM,oBAAoB;AAC1B,IAAM,6BAA6B,KAAK;AAExC,IAAM,wBAAwB;CAAC;CAAY;CAAW;CAAW;AACjE,IAAM,oBAAoB;CAAC;CAAsB;CAAc;CAAa;AAI5E,IAAM,YAAY,QADC,cAAc,OAAO,KAAK,IAAI,CACZ;;;;AAKrC,SAAS,iBAA8B;AAGrC,KAAI;EAEF,MAAM,WAAW,QAAQ,WAAW,oBAAoB;AACxD,MAAI,WAAW,SAAS,EAAE;GAIxB,MAAM,QAFU,aAAa,UAAU,QAAQ,CAEzB,MAAM,2CAA2C;AACvE,OAAI,QAAQ,IAAI;IAEd,MAAM,QADW,MAAM,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AAO,QAAQ,GAAG,UAAU,iBAAiB;AAC7C,UAAO,QAAQ,GAAG,OAAO,iBAAiB;;EAG5C,MAAM,aAAa;AACjB,SAAM,WAAW;;EAGnB,UAAU,IAAI;AACZ,OAAI,OAAO,kBACT,QAAO;;EAIX,KAAK,IAAI;AACP,OAAI,OAAO,4BAA4B;IACrC,MAAM,gBAAgB,sBAAsB,WAAW,MAAM;AAC7D,QAAI,iCAAiC,WAAW,MAAM,KAAK,QAAQ;AACnE,WAAO;;;EAGZ"}
|
package/dist/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "http://json.schemastore.org/web-types",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@rotki/ui-library",
|
|
5
|
-
"version": "2.16.
|
|
5
|
+
"version": "2.16.2",
|
|
6
6
|
"js-types-syntax": "typescript",
|
|
7
7
|
"description-markup": "markdown",
|
|
8
8
|
"contributions": {
|
|
@@ -3746,7 +3746,7 @@
|
|
|
3746
3746
|
},
|
|
3747
3747
|
{
|
|
3748
3748
|
"name": "chipAttrs",
|
|
3749
|
-
"type": "Record<string, unknown>
|
|
3749
|
+
"type": "Record<string, unknown>"
|
|
3750
3750
|
}
|
|
3751
3751
|
]
|
|
3752
3752
|
},
|
|
@@ -6752,6 +6752,7 @@
|
|
|
6752
6752
|
"name": "model-value",
|
|
6753
6753
|
"description": "",
|
|
6754
6754
|
"required": false,
|
|
6755
|
+
"default": "0 as T",
|
|
6755
6756
|
"value": {
|
|
6756
6757
|
"kind": "expression",
|
|
6757
6758
|
"type": "T | undefined"
|
|
@@ -6766,7 +6767,7 @@
|
|
|
6766
6767
|
"arguments": [
|
|
6767
6768
|
{
|
|
6768
6769
|
"name": "argument",
|
|
6769
|
-
"type": "[value: T
|
|
6770
|
+
"type": "[value: T]"
|
|
6770
6771
|
}
|
|
6771
6772
|
]
|
|
6772
6773
|
}
|
|
@@ -6847,6 +6848,7 @@
|
|
|
6847
6848
|
"name": "model-value",
|
|
6848
6849
|
"description": "",
|
|
6849
6850
|
"required": false,
|
|
6851
|
+
"default": "0",
|
|
6850
6852
|
"value": {
|
|
6851
6853
|
"kind": "expression",
|
|
6852
6854
|
"type": "string | number | undefined"
|
|
@@ -6861,7 +6863,7 @@
|
|
|
6861
6863
|
"arguments": [
|
|
6862
6864
|
{
|
|
6863
6865
|
"name": "argument",
|
|
6864
|
-
"type": "[value: string | number
|
|
6866
|
+
"type": "[value: string | number]"
|
|
6865
6867
|
}
|
|
6866
6868
|
]
|
|
6867
6869
|
}
|