@bitrix24/b24ui-nuxt 0.6.7 → 0.7.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/.nuxt/b24ui/accordion.ts +20 -0
- package/.nuxt/b24ui/advice.ts +2 -10
- package/.nuxt/b24ui/alert.ts +2 -15
- package/.nuxt/b24ui/avatar-group.ts +2 -10
- package/.nuxt/b24ui/avatar.ts +3 -11
- package/.nuxt/b24ui/badge.ts +48 -13
- package/.nuxt/b24ui/button-group.ts +2 -22
- package/.nuxt/b24ui/button.ts +4 -17
- package/.nuxt/b24ui/calendar.ts +3 -11
- package/.nuxt/b24ui/checkbox.ts +75 -11
- package/.nuxt/b24ui/chip.ts +2 -10
- package/.nuxt/b24ui/collapsible.ts +2 -10
- package/.nuxt/b24ui/container.ts +2 -10
- package/.nuxt/b24ui/countdown.ts +2 -10
- package/.nuxt/b24ui/description-list.ts +2 -15
- package/.nuxt/b24ui/dropdown-menu.ts +4 -11
- package/.nuxt/b24ui/form-field.ts +3 -10
- package/.nuxt/b24ui/form.ts +2 -10
- package/.nuxt/b24ui/index.ts +1 -0
- package/.nuxt/b24ui/input-menu.ts +6 -30
- package/.nuxt/b24ui/input-number.ts +15 -10
- package/.nuxt/b24ui/input.ts +4 -17
- package/.nuxt/b24ui/kbd.ts +2 -10
- package/.nuxt/b24ui/link.ts +11 -17
- package/.nuxt/b24ui/modal.ts +3 -11
- package/.nuxt/b24ui/navbar-divider.ts +2 -10
- package/.nuxt/b24ui/navbar-section.ts +2 -10
- package/.nuxt/b24ui/navbar-spacer.ts +2 -10
- package/.nuxt/b24ui/navbar.ts +2 -10
- package/.nuxt/b24ui/navigation-menu.ts +69 -60
- package/.nuxt/b24ui/popover.ts +2 -10
- package/.nuxt/b24ui/progress.ts +2 -10
- package/.nuxt/b24ui/radio-group.ts +3 -11
- package/.nuxt/b24ui/range.ts +2 -10
- package/.nuxt/b24ui/select-menu.ts +10 -40
- package/.nuxt/b24ui/select.ts +10 -40
- package/.nuxt/b24ui/separator.ts +2 -10
- package/.nuxt/b24ui/sidebar-body.ts +2 -10
- package/.nuxt/b24ui/sidebar-footer.ts +2 -10
- package/.nuxt/b24ui/sidebar-header.ts +2 -10
- package/.nuxt/b24ui/sidebar-heading.ts +2 -10
- package/.nuxt/b24ui/sidebar-layout.ts +2 -10
- package/.nuxt/b24ui/sidebar-section.ts +2 -10
- package/.nuxt/b24ui/sidebar-spacer.ts +2 -10
- package/.nuxt/b24ui/sidebar.ts +2 -10
- package/.nuxt/b24ui/skeleton.ts +2 -10
- package/.nuxt/b24ui/slideover.ts +2 -10
- package/.nuxt/b24ui/stacked-layout.ts +2 -10
- package/.nuxt/b24ui/switch.ts +2 -10
- package/.nuxt/b24ui/tabs.ts +6 -13
- package/.nuxt/b24ui/textarea.ts +4 -17
- package/.nuxt/b24ui/toast.ts +2 -15
- package/.nuxt/b24ui/toaster.ts +3 -11
- package/.nuxt/b24ui/tooltip.ts +3 -11
- package/.nuxt/b24ui.css +1 -1
- package/cli/templates.mjs +2 -2
- package/dist/meta.d.mts +38368 -18666
- package/dist/meta.mjs +38368 -18666
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -3
- package/dist/runtime/components/Accordion.vue +96 -0
- package/dist/runtime/components/Accordion.vue.d.ts +78 -0
- package/dist/runtime/components/Advice.vue +1 -1
- package/dist/runtime/components/Alert.vue +1 -1
- package/dist/runtime/components/Avatar.vue +11 -3
- package/dist/runtime/components/Avatar.vue.d.ts +2 -1
- package/dist/runtime/components/AvatarGroup.vue +1 -1
- package/dist/runtime/components/Badge.vue +5 -3
- package/dist/runtime/components/Badge.vue.d.ts +2 -0
- package/dist/runtime/components/Button.vue +2 -3
- package/dist/runtime/components/Button.vue.d.ts +1 -1
- package/dist/runtime/components/Calendar.vue +6 -2
- package/dist/runtime/components/Checkbox.vue +14 -5
- package/dist/runtime/components/Checkbox.vue.d.ts +9 -0
- package/dist/runtime/components/Chip.vue +1 -1
- package/dist/runtime/components/Collapsible.vue +1 -1
- package/dist/runtime/components/Countdown.vue +1 -1
- package/dist/runtime/components/Countdown.vue.d.ts +2 -2
- package/dist/runtime/components/DescriptionList.vue +3 -2
- package/dist/runtime/components/DescriptionList.vue.d.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +2 -0
- package/dist/runtime/components/DropdownMenuContent.vue +74 -72
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +4 -20
- package/dist/runtime/components/Form.vue +6 -6
- package/dist/runtime/components/Form.vue.d.ts +12 -11
- package/dist/runtime/components/FormField.vue +4 -4
- package/dist/runtime/components/Input.vue +12 -8
- package/dist/runtime/components/Input.vue.d.ts +31 -30
- package/dist/runtime/components/InputMenu.vue +23 -20
- package/dist/runtime/components/InputMenu.vue.d.ts +214 -4
- package/dist/runtime/components/InputNumber.vue +17 -10
- package/dist/runtime/components/InputNumber.vue.d.ts +80 -3
- package/dist/runtime/components/Link.vue +5 -13
- package/dist/runtime/components/Modal.vue +22 -14
- package/dist/runtime/components/Modal.vue.d.ts +18 -5
- package/dist/runtime/components/Navbar.vue +1 -1
- package/dist/runtime/components/NavbarDivider.vue +1 -1
- package/dist/runtime/components/NavbarSection.vue +1 -1
- package/dist/runtime/components/NavbarSpacer.vue +1 -1
- package/dist/runtime/components/NavigationMenu.vue +186 -44
- package/dist/runtime/components/NavigationMenu.vue.d.ts +39 -8
- package/dist/runtime/components/OverlayProvider.vue +2 -2
- package/dist/runtime/components/Popover.vue +4 -0
- package/dist/runtime/components/Popover.vue.d.ts +2 -1
- package/dist/runtime/components/Progress.vue +3 -2
- package/dist/runtime/components/Progress.vue.d.ts +2 -2
- package/dist/runtime/components/RadioGroup.vue +26 -10
- package/dist/runtime/components/RadioGroup.vue.d.ts +3 -1
- package/dist/runtime/components/Range.vue +2 -2
- package/dist/runtime/components/Range.vue.d.ts +19 -20
- package/dist/runtime/components/Select.vue +57 -31
- package/dist/runtime/components/Select.vue.d.ts +110 -2
- package/dist/runtime/components/SelectMenu.vue +77 -23
- package/dist/runtime/components/SelectMenu.vue.d.ts +111 -5
- package/dist/runtime/components/Separator.vue +3 -3
- package/dist/runtime/components/Sidebar.vue +1 -1
- package/dist/runtime/components/SidebarBody.vue +1 -1
- package/dist/runtime/components/SidebarFooter.vue +1 -1
- package/dist/runtime/components/SidebarHeader.vue +1 -1
- package/dist/runtime/components/SidebarHeading.vue +1 -1
- package/dist/runtime/components/SidebarLayout.vue +1 -1
- package/dist/runtime/components/SidebarSection.vue +1 -1
- package/dist/runtime/components/SidebarSpacer.vue +1 -1
- package/dist/runtime/components/Slideover.vue +23 -15
- package/dist/runtime/components/Slideover.vue.d.ts +18 -5
- package/dist/runtime/components/StackedLayout.vue +1 -1
- package/dist/runtime/components/Switch.vue +1 -1
- package/dist/runtime/components/Tabs.vue +28 -7
- package/dist/runtime/components/Tabs.vue.d.ts +6 -1
- package/dist/runtime/components/Textarea.vue +13 -9
- package/dist/runtime/components/Textarea.vue.d.ts +31 -30
- package/dist/runtime/components/Toast.vue +7 -6
- package/dist/runtime/components/Toast.vue.d.ts +6 -0
- package/dist/runtime/components/Toaster.vue +4 -4
- package/dist/runtime/components/Toaster.vue.d.ts +6 -0
- package/dist/runtime/components/Tooltip.vue +9 -2
- package/dist/runtime/components/Tooltip.vue.d.ts +2 -1
- package/dist/runtime/components/content/TableWrapper.vue +1 -1
- package/dist/runtime/composables/defineLocale.d.ts +2 -0
- package/dist/runtime/composables/defineLocale.js +4 -0
- package/dist/runtime/composables/defineShortcuts.js +8 -2
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +2 -1
- package/dist/runtime/composables/useKbd.d.ts +1 -0
- package/dist/runtime/composables/useKbd.js +4 -3
- package/dist/runtime/composables/useOverlay.d.ts +11 -11
- package/dist/runtime/composables/useOverlay.js +17 -11
- package/dist/runtime/inertia/components/Link.vue +45 -60
- package/dist/runtime/inertia/components/Link.vue.d.ts +1 -1
- package/dist/runtime/inertia/components/LinkBase.vue +68 -0
- package/dist/runtime/inertia/components/LinkBase.vue.d.ts +25 -0
- package/dist/runtime/inertia/stubs.d.ts +1 -1
- package/dist/runtime/inertia/stubs.js +1 -1
- package/dist/runtime/prose/A.vue +1 -1
- package/dist/runtime/prose/Blockquote.vue +1 -1
- package/dist/runtime/prose/Code.vue +1 -1
- package/dist/runtime/prose/Em.vue +1 -1
- package/dist/runtime/prose/H1.vue +1 -1
- package/dist/runtime/prose/H2.vue +1 -1
- package/dist/runtime/prose/H3.vue +1 -1
- package/dist/runtime/prose/H4.vue +1 -1
- package/dist/runtime/prose/H5.vue +1 -1
- package/dist/runtime/prose/H6.vue +1 -1
- package/dist/runtime/prose/Hr.vue +1 -1
- package/dist/runtime/prose/Img.vue +1 -1
- package/dist/runtime/prose/Li.vue +1 -1
- package/dist/runtime/prose/Ol.vue +1 -1
- package/dist/runtime/prose/P.vue +1 -1
- package/dist/runtime/prose/Pre.vue +1 -1
- package/dist/runtime/prose/Strong.vue +1 -1
- package/dist/runtime/prose/Table.vue +1 -1
- package/dist/runtime/prose/Tbody.vue +1 -1
- package/dist/runtime/prose/Td.vue +1 -1
- package/dist/runtime/prose/Th.vue +1 -1
- package/dist/runtime/prose/Thead.vue +1 -1
- package/dist/runtime/prose/Tr.vue +1 -1
- package/dist/runtime/prose/Ul.vue +1 -1
- package/dist/runtime/types/form.d.ts +11 -10
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/locale.d.ts +1 -0
- package/dist/runtime/types/tv.d.ts +53 -0
- package/dist/runtime/types/tv.js +0 -0
- package/dist/runtime/types/utils.d.ts +4 -51
- package/dist/runtime/types/utils.js +1 -0
- package/dist/runtime/utils/link.d.ts +1 -0
- package/dist/runtime/utils/link.js +12 -0
- package/dist/runtime/vue/components/Link.vue +26 -40
- package/dist/runtime/vue/composables/useAppConfig.js +3 -1
- package/dist/runtime/vue/stubs.d.ts +1 -1
- package/dist/runtime/vue/stubs.js +1 -1
- package/dist/shared/{b24ui-nuxt.jU270f-Q.mjs → b24ui-nuxt.C-kZb5Ac.mjs} +267 -121
- package/dist/unplugin.d.mts +2 -2
- package/dist/unplugin.mjs +6 -3
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +41 -40
|
@@ -20,7 +20,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<template>
|
|
23
|
-
<Primitive :as="as" :class="b24ui.root({ class: [props.
|
|
23
|
+
<Primitive :as="as" :class="b24ui.root({ class: [props.b24ui?.root, props.class] })" :style="props.style">
|
|
24
24
|
<pre
|
|
25
25
|
:class="b24ui.base({ class: props.b24ui?.base })"
|
|
26
26
|
><slot /></pre>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<strong :class="b24ui.base({ class: [props.
|
|
19
|
+
<strong :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</strong>
|
|
22
22
|
</template>
|
|
@@ -25,7 +25,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
25
25
|
<template>
|
|
26
26
|
<B24TableWrapper
|
|
27
27
|
:as="as"
|
|
28
|
-
:class="b24ui.root({ class: [props.
|
|
28
|
+
:class="b24ui.root({ class: [props.b24ui?.root, props.class] })"
|
|
29
29
|
:zebra="props.zebra"
|
|
30
30
|
:row-hover="props.rowHover"
|
|
31
31
|
:rounded="props.rounded"
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<tbody :class="b24ui.base({ class: [props.
|
|
19
|
+
<tbody :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</tbody>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<td :class="b24ui.base({ class: [props.
|
|
19
|
+
<td :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</td>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<th :class="b24ui.base({ class: [props.
|
|
19
|
+
<th :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</th>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<thead :class="b24ui.base({ class: [props.
|
|
19
|
+
<thead :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</thead>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<tr :class="b24ui.base({ class: [props.
|
|
19
|
+
<tr :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</tr>
|
|
22
22
|
</template>
|
|
@@ -16,7 +16,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.prose?.
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<template>
|
|
19
|
-
<ul :class="b24ui.base({ class: [props.
|
|
19
|
+
<ul :class="b24ui.base({ class: [props.b24ui?.base, props.class] })">
|
|
20
20
|
<slot />
|
|
21
21
|
</ul>
|
|
22
22
|
</template>
|
|
@@ -4,28 +4,29 @@ import type { Schema as JoiSchema } from 'joi';
|
|
|
4
4
|
import type { ObjectSchema as YupObjectSchema } from 'yup';
|
|
5
5
|
import type { GetObjectField } from './utils';
|
|
6
6
|
import type { Struct as SuperstructSchema } from 'superstruct';
|
|
7
|
-
export interface Form<
|
|
8
|
-
validate(opts?: {
|
|
9
|
-
name?: keyof
|
|
7
|
+
export interface Form<S extends FormSchema> {
|
|
8
|
+
validate<T extends boolean>(opts?: {
|
|
9
|
+
name?: keyof FormData<S, false> | (keyof FormData<S, false>)[];
|
|
10
10
|
silent?: boolean;
|
|
11
11
|
nested?: boolean;
|
|
12
|
-
transform?:
|
|
13
|
-
}): Promise<T | false>;
|
|
12
|
+
transform?: T;
|
|
13
|
+
}): Promise<FormData<S, T> | false>;
|
|
14
14
|
clear(path?: string): void;
|
|
15
15
|
errors: Ref<FormError[]>;
|
|
16
|
-
setErrors(errs: FormError[], name?: keyof
|
|
17
|
-
getErrors(name?: keyof
|
|
16
|
+
setErrors(errs: FormError[], name?: keyof FormData<S, false>): void;
|
|
17
|
+
getErrors(name?: keyof FormData<S, false>): FormError[];
|
|
18
18
|
submit(): Promise<void>;
|
|
19
19
|
disabled: ComputedRef<boolean>;
|
|
20
20
|
dirty: ComputedRef<boolean>;
|
|
21
21
|
loading: Ref<boolean>;
|
|
22
|
-
dirtyFields: DeepReadonly<
|
|
23
|
-
touchedFields: DeepReadonly<
|
|
24
|
-
blurredFields: DeepReadonly<
|
|
22
|
+
dirtyFields: ReadonlySet<DeepReadonly<keyof FormData<S, false>>>;
|
|
23
|
+
touchedFields: ReadonlySet<DeepReadonly<keyof FormData<S, false>>>;
|
|
24
|
+
blurredFields: ReadonlySet<DeepReadonly<keyof FormData<S, false>>>;
|
|
25
25
|
}
|
|
26
26
|
export type FormSchema<I extends object = object, O extends object = I> = YupObjectSchema<I> | JoiSchema<I> | SuperstructSchema<any, any> | StandardSchemaV1<I, O>;
|
|
27
27
|
export type InferInput<Schema> = Schema extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Schema> : Schema extends YupObjectSchema<infer I> ? I : Schema extends JoiSchema<infer I> ? I : Schema extends SuperstructSchema<infer I, any> ? I : Schema extends StandardSchemaV1 ? StandardSchemaV1.InferInput<Schema> : never;
|
|
28
28
|
export type InferOutput<Schema> = Schema extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<Schema> : Schema extends YupObjectSchema<infer O> ? O : Schema extends JoiSchema<infer O> ? O : Schema extends SuperstructSchema<infer O, any> ? O : never;
|
|
29
|
+
export type FormData<S extends FormSchema, T extends boolean = true> = T extends true ? InferOutput<S> : InferInput<S>;
|
|
29
30
|
export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
|
|
30
31
|
export interface FormError<P extends string = string> {
|
|
31
32
|
name?: P;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ClassValue, TVVariants, TVCompoundVariants, TVDefaultVariants } from 'tailwind-variants';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the AppConfig object based on the tailwind-variants configuration.
|
|
4
|
+
*/
|
|
5
|
+
export type TVConfig<T extends Record<string, any>> = {
|
|
6
|
+
[P in keyof T]?: {
|
|
7
|
+
[K in keyof T[P] as K extends 'base' | 'slots' | 'variants' | 'compoundVariants' | 'defaultVariants' ? K : never]?: K extends 'base' ? ClassValue : K extends 'slots' ? {
|
|
8
|
+
[S in keyof T[P]['slots']]?: ClassValue;
|
|
9
|
+
} : K extends 'variants' ? TVVariants<T[P]['slots'], ClassValue, T[P]['variants']> : K extends 'compoundVariants' ? TVCompoundVariants<T[P]['variants'], T[P]['slots'], ClassValue, object, undefined> : K extends 'defaultVariants' ? TVDefaultVariants<T[P]['variants'], T[P]['slots'], object, undefined> : never;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Utility type to flatten intersection types for better IDE hover information.
|
|
14
|
+
* @template T The type to flatten.
|
|
15
|
+
*/
|
|
16
|
+
type Id<T> = {} & {
|
|
17
|
+
[P in keyof T]: T[P];
|
|
18
|
+
};
|
|
19
|
+
type ComponentVariants<T extends {
|
|
20
|
+
variants?: Record<string, Record<string, any>>;
|
|
21
|
+
}> = {
|
|
22
|
+
[K in keyof T['variants']]: keyof T['variants'][K];
|
|
23
|
+
};
|
|
24
|
+
type ComponentSlots<T extends {
|
|
25
|
+
slots?: Record<string, any>;
|
|
26
|
+
}> = Id<{
|
|
27
|
+
[K in keyof T['slots']]?: ClassValue;
|
|
28
|
+
}>;
|
|
29
|
+
type GetComponentAppConfig<A, U extends string, K extends string> = A extends Record<U, Record<K, any>> ? A[U][K] : {};
|
|
30
|
+
type ComponentAppConfig<T, A extends Record<string, any>, K extends string, U extends string = 'b24ui' | 'b24ui.content' | 'b24ui.prose'> = A & (U extends 'b24ui' ? {
|
|
31
|
+
b24ui?: Record<K, Partial<T>>;
|
|
32
|
+
} : U extends 'b24ui.content' ? {
|
|
33
|
+
b24ui?: {
|
|
34
|
+
content?: Record<K, Partial<T>>;
|
|
35
|
+
};
|
|
36
|
+
} : U extends 'b24ui.prose' ? {
|
|
37
|
+
b24ui?: {
|
|
38
|
+
prose?: Record<K, Partial<T>>;
|
|
39
|
+
};
|
|
40
|
+
} : never);
|
|
41
|
+
/**
|
|
42
|
+
* Defines the configuration shape expected for a component.
|
|
43
|
+
* @template T The component's theme imported from `#build/b24ui/*`.
|
|
44
|
+
* @template A The base AppConfig type from `@nuxt/schema`.
|
|
45
|
+
* @template K The key identifying the component (e.g., 'badge').
|
|
46
|
+
* @template U The top-level key in AppConfig ('b24ui').
|
|
47
|
+
*/
|
|
48
|
+
export type ComponentConfig<T extends Record<string, any>, A extends Record<string, any>, K extends string, U extends 'b24ui' | 'b24ui.content' | 'b24ui.prose' = 'b24ui'> = {
|
|
49
|
+
AppConfig: ComponentAppConfig<T, A, K, U>;
|
|
50
|
+
variants: ComponentVariants<T & GetComponentAppConfig<A, U, K>>;
|
|
51
|
+
slots: ComponentSlots<T>;
|
|
52
|
+
};
|
|
53
|
+
export {};
|
|
File without changes
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import type { AcceptableValue as _AcceptableValue } from 'reka-ui';
|
|
2
|
-
import type { ClassValue } from 'tailwind-variants';
|
|
3
1
|
import type { VNode } from 'vue';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export type DeepPartial<T, O = any> = {
|
|
8
|
-
[P in keyof T]?: T[P] extends Array<string> ? string : T[P] extends object ? DeepPartial<T[P], O> : T[P];
|
|
9
|
-
} & {
|
|
10
|
-
[key: string]: O | TightMap<O>;
|
|
2
|
+
import type { AcceptableValue as _AcceptableValue } from 'reka-ui';
|
|
3
|
+
export type DeepPartial<T> = {
|
|
4
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P] | undefined;
|
|
11
5
|
};
|
|
12
6
|
export type DynamicSlotsKeys<Name extends string | undefined, Suffix extends string | undefined = undefined> = (Name extends string ? Suffix extends string ? Name | `${Name}-${Suffix}` : Name : never);
|
|
13
7
|
export type DynamicSlots<T extends {
|
|
@@ -44,45 +38,4 @@ export type StringOrVNode = string | VNode | (() => VNode);
|
|
|
44
38
|
export type EmitsToProps<T> = {
|
|
45
39
|
[K in keyof T as `on${Capitalize<string & K>}`]: T[K] extends [...args: infer Args] ? (...args: Args) => void : never;
|
|
46
40
|
};
|
|
47
|
-
|
|
48
|
-
* Utility type to flatten intersection types for better IDE hover information.
|
|
49
|
-
* @template T The type to flatten.
|
|
50
|
-
*/
|
|
51
|
-
type Id<T> = {} & {
|
|
52
|
-
[P in keyof T]: T[P];
|
|
53
|
-
};
|
|
54
|
-
type ComponentVariants<T extends {
|
|
55
|
-
variants?: Record<string, Record<string, any>>;
|
|
56
|
-
}> = {
|
|
57
|
-
[K in keyof T['variants']]: keyof T['variants'][K];
|
|
58
|
-
};
|
|
59
|
-
type ComponentSlots<T extends {
|
|
60
|
-
slots?: Record<string, any>;
|
|
61
|
-
}> = Id<{
|
|
62
|
-
[K in keyof T['slots']]?: ClassValue;
|
|
63
|
-
}>;
|
|
64
|
-
type GetComponentAppConfig<A, U extends string, K extends string> = A extends Record<U, Record<K, any>> ? A[U][K] : {};
|
|
65
|
-
type ComponentAppConfig<T, A extends Record<string, any>, K extends string, U extends string = 'b24ui' | 'b24ui.content' | 'b24ui.prose'> = A & (U extends 'b24ui' ? {
|
|
66
|
-
b24ui?: Record<K, Partial<T>>;
|
|
67
|
-
} : U extends 'b24ui.content' ? {
|
|
68
|
-
b24ui?: {
|
|
69
|
-
content?: Record<K, Partial<T>>;
|
|
70
|
-
};
|
|
71
|
-
} : U extends 'b24ui.prose' ? {
|
|
72
|
-
b24ui?: {
|
|
73
|
-
prose?: Record<K, Partial<T>>;
|
|
74
|
-
};
|
|
75
|
-
} : never);
|
|
76
|
-
/**
|
|
77
|
-
* Defines the configuration shape expected for a component.
|
|
78
|
-
* @template T The component's theme imported from `#build/b24ui/*`.
|
|
79
|
-
* @template A The base AppConfig type from `@nuxt/schema`.
|
|
80
|
-
* @template K The key identifying the component (e.g., 'badge').
|
|
81
|
-
* @template U The top-level key in AppConfig ('b24ui').
|
|
82
|
-
*/
|
|
83
|
-
export type ComponentConfig<T extends Record<string, any>, A extends Record<string, any>, K extends string, U extends 'b24ui' | 'b24ui.content' | 'b24ui.prose' = 'b24ui'> = {
|
|
84
|
-
AppConfig: ComponentAppConfig<T, A, K, U>;
|
|
85
|
-
variants: ComponentVariants<T & GetComponentAppConfig<A, U, K>>;
|
|
86
|
-
slots: ComponentSlots<T>;
|
|
87
|
-
};
|
|
88
|
-
export {};
|
|
41
|
+
export * from './tv';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tv.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { reactivePick } from "@vueuse/core";
|
|
2
|
+
import { isEqual, diff } from "ohash/utils";
|
|
2
3
|
export function pickLinkProps(link) {
|
|
3
4
|
const keys = Object.keys(link);
|
|
4
5
|
const ariaKeys = keys.filter((key) => key.startsWith("aria-"));
|
|
@@ -33,3 +34,14 @@ export function pickLinkProps(link) {
|
|
|
33
34
|
];
|
|
34
35
|
return reactivePick(link, ...propsToInclude);
|
|
35
36
|
}
|
|
37
|
+
export function isPartiallyEqual(item1, item2) {
|
|
38
|
+
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
39
|
+
if (q.type === "added") {
|
|
40
|
+
filtered.add(q.key);
|
|
41
|
+
}
|
|
42
|
+
return filtered;
|
|
43
|
+
}, /* @__PURE__ */ new Set());
|
|
44
|
+
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
45
|
+
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
46
|
+
return isEqual(item1Filtered, item2Filtered);
|
|
47
|
+
}
|
|
@@ -3,15 +3,16 @@ import theme from "#build/b24ui/link";
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
|
-
import { computed
|
|
6
|
+
import { computed } from "vue";
|
|
7
7
|
import { defu } from "defu";
|
|
8
|
-
import { isEqual
|
|
8
|
+
import { isEqual } from "ohash/utils";
|
|
9
9
|
import { useForwardProps } from "reka-ui";
|
|
10
10
|
import { reactiveOmit } from "@vueuse/core";
|
|
11
11
|
import { hasProtocol } from "ufo";
|
|
12
12
|
import { useRoute, RouterLink } from "vue-router";
|
|
13
13
|
import { useAppConfig } from "#imports";
|
|
14
14
|
import { tv } from "../../utils/tv";
|
|
15
|
+
import { isPartiallyEqual } from "../../utils/link";
|
|
15
16
|
import B24LinkBase from "./../../components/LinkBase.vue";
|
|
16
17
|
defineOptions({ inheritAttrs: false });
|
|
17
18
|
const props = defineProps({
|
|
@@ -44,20 +45,9 @@ const props = defineProps({
|
|
|
44
45
|
replace: { type: Boolean, required: false }
|
|
45
46
|
});
|
|
46
47
|
defineSlots();
|
|
47
|
-
const
|
|
48
|
-
const app = getCurrentInstance()?.appContext.app;
|
|
49
|
-
return !!app?.config?.globalProperties?.$router;
|
|
50
|
-
});
|
|
51
|
-
const route = computed(() => {
|
|
52
|
-
if (!hasRouter.value) return null;
|
|
53
|
-
try {
|
|
54
|
-
return useRoute();
|
|
55
|
-
} catch {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
48
|
+
const route = useRoute();
|
|
59
49
|
const appConfig = useAppConfig();
|
|
60
|
-
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "raw", "class"));
|
|
50
|
+
const routerLinkProps = useForwardProps(reactiveOmit(props, "as", "type", "disabled", "active", "exact", "exactQuery", "exactHash", "activeClass", "inactiveClass", "to", "href", "raw", "custom", "class"));
|
|
61
51
|
const b24ui = computed(() => tv({
|
|
62
52
|
extend: tv(theme),
|
|
63
53
|
...defu({
|
|
@@ -69,34 +59,29 @@ const b24ui = computed(() => tv({
|
|
|
69
59
|
}
|
|
70
60
|
}, appConfig.b24ui?.link || {})
|
|
71
61
|
}));
|
|
72
|
-
|
|
73
|
-
const diffedKeys = diff(item1, item2).reduce((filtered, q) => {
|
|
74
|
-
if (q.type === "added") {
|
|
75
|
-
filtered.add(q.key);
|
|
76
|
-
}
|
|
77
|
-
return filtered;
|
|
78
|
-
}, /* @__PURE__ */ new Set());
|
|
79
|
-
const item1Filtered = Object.fromEntries(Object.entries(item1).filter(([key]) => !diffedKeys.has(key)));
|
|
80
|
-
const item2Filtered = Object.fromEntries(Object.entries(item2).filter(([key]) => !diffedKeys.has(key)));
|
|
81
|
-
return isEqual(item1Filtered, item2Filtered);
|
|
82
|
-
}
|
|
62
|
+
const to = computed(() => props.to ?? props.href);
|
|
83
63
|
const isExternal = computed(() => {
|
|
84
|
-
if (
|
|
85
|
-
|
|
64
|
+
if (props.external) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
if (!to.value) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return typeof to.value === "string" && hasProtocol(to.value, { acceptRelative: true });
|
|
86
71
|
});
|
|
87
72
|
function isLinkActive({ route: linkRoute, isActive, isExactActive }) {
|
|
88
73
|
if (props.active !== void 0) {
|
|
89
74
|
return props.active;
|
|
90
75
|
}
|
|
91
|
-
if (!
|
|
76
|
+
if (!to.value) {
|
|
92
77
|
return false;
|
|
93
78
|
}
|
|
94
79
|
if (props.exactQuery === "partial") {
|
|
95
|
-
if (!isPartiallyEqual(linkRoute.query, route.
|
|
80
|
+
if (!isPartiallyEqual(linkRoute.query, route.query)) return false;
|
|
96
81
|
} else if (props.exactQuery === true) {
|
|
97
|
-
if (!isEqual(linkRoute.query, route.
|
|
82
|
+
if (!isEqual(linkRoute.query, route.query)) return false;
|
|
98
83
|
}
|
|
99
|
-
if (props.exactHash && linkRoute.hash !== route.
|
|
84
|
+
if (props.exactHash && linkRoute.hash !== route.hash) {
|
|
100
85
|
return false;
|
|
101
86
|
}
|
|
102
87
|
if (props.exact && isExactActive) {
|
|
@@ -122,8 +107,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
122
107
|
</script>
|
|
123
108
|
|
|
124
109
|
<template>
|
|
125
|
-
<template v-if="
|
|
126
|
-
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to
|
|
110
|
+
<template v-if="!isExternal && !!to">
|
|
111
|
+
<RouterLink v-slot="{ href, navigate, route: linkRoute, isActive, isExactActive }" v-bind="routerLinkProps" :to="to" custom>
|
|
127
112
|
<template v-if="custom">
|
|
128
113
|
<slot
|
|
129
114
|
v-bind="{
|
|
@@ -133,7 +118,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
133
118
|
type,
|
|
134
119
|
disabled,
|
|
135
120
|
target: props.target ? props.target : void 0,
|
|
136
|
-
href
|
|
121
|
+
href,
|
|
137
122
|
navigate,
|
|
138
123
|
active: isLinkActive({ route: linkRoute, isActive, isExactActive })
|
|
139
124
|
}"
|
|
@@ -147,7 +132,7 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
147
132
|
as,
|
|
148
133
|
type,
|
|
149
134
|
disabled,
|
|
150
|
-
href
|
|
135
|
+
href,
|
|
151
136
|
navigate
|
|
152
137
|
}"
|
|
153
138
|
:class="resolveLinkClass({ route: linkRoute, isActive, isExactActive })"
|
|
@@ -167,7 +152,8 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
167
152
|
disabled,
|
|
168
153
|
href: to,
|
|
169
154
|
target: isExternal ? '_blank' : void 0,
|
|
170
|
-
active
|
|
155
|
+
active,
|
|
156
|
+
isExternal
|
|
171
157
|
}"
|
|
172
158
|
/>
|
|
173
159
|
</template>
|
|
@@ -179,12 +165,12 @@ function resolveLinkClass({ route: route2, isActive, isExactActive } = {}) {
|
|
|
179
165
|
type,
|
|
180
166
|
disabled,
|
|
181
167
|
href: to,
|
|
182
|
-
target: isExternal ? '_blank' : void 0
|
|
168
|
+
target: isExternal ? '_blank' : void 0,
|
|
169
|
+
isExternal
|
|
183
170
|
}"
|
|
184
|
-
:is-external="isExternal"
|
|
185
171
|
:class="resolveLinkClass()"
|
|
186
172
|
>
|
|
187
|
-
<slot :active="
|
|
173
|
+
<slot :active="active" />
|
|
188
174
|
</B24LinkBase>
|
|
189
175
|
</template>
|
|
190
176
|
</template>
|
|
@@ -2,6 +2,7 @@ import type { Ref } from 'vue';
|
|
|
2
2
|
import type { NuxtApp } from '#app';
|
|
3
3
|
export { useHead } from '@unhead/vue';
|
|
4
4
|
export { useRoute, useRouter } from 'vue-router';
|
|
5
|
+
export { useAppConfig } from './composables/useAppConfig';
|
|
5
6
|
export { defineShortcuts } from '../composables/defineShortcuts';
|
|
6
7
|
export { defineLocale } from '../composables/defineLocale';
|
|
7
8
|
export { useLocale } from '../composables/useLocale';
|
|
@@ -16,7 +17,6 @@ export declare const useColorMode: () => {
|
|
|
16
17
|
readonly value: import("@vueuse/core").BasicColorMode;
|
|
17
18
|
forced: boolean;
|
|
18
19
|
};
|
|
19
|
-
export declare const useAppConfig: () => any;
|
|
20
20
|
export declare const useCookie: <T = string>(_name: string, _options?: Record<string, any>) => {
|
|
21
21
|
value: Ref<T, T>;
|
|
22
22
|
get: () => T;
|
|
@@ -4,6 +4,7 @@ import appConfig from "#build/app.config";
|
|
|
4
4
|
import { useColorMode as useColorModeVueUse } from "@vueuse/core";
|
|
5
5
|
export { useHead } from "@unhead/vue";
|
|
6
6
|
export { useRoute, useRouter } from "vue-router";
|
|
7
|
+
export { useAppConfig } from "./composables/useAppConfig.js";
|
|
7
8
|
export { defineShortcuts } from "../composables/defineShortcuts.js";
|
|
8
9
|
export { defineLocale } from "../composables/defineLocale.js";
|
|
9
10
|
export { useLocale } from "../composables/useLocale.js";
|
|
@@ -29,7 +30,6 @@ export const useColorMode = () => {
|
|
|
29
30
|
forced: false
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
|
-
export const useAppConfig = () => appConfig;
|
|
33
33
|
export const useCookie = (_name, _options = {}) => {
|
|
34
34
|
const value = ref(null);
|
|
35
35
|
return {
|