@bitrix24/b24ui-nuxt 0.1.1

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.
Files changed (159) hide show
  1. package/.nuxt/b24ui/advice.ts +52 -0
  2. package/.nuxt/b24ui/alert.ts +118 -0
  3. package/.nuxt/b24ui/avatar-group.ts +52 -0
  4. package/.nuxt/b24ui/avatar.ts +63 -0
  5. package/.nuxt/b24ui/badge.ts +256 -0
  6. package/.nuxt/b24ui/button-group.ts +27 -0
  7. package/.nuxt/b24ui/button.ts +342 -0
  8. package/.nuxt/b24ui/checkbox.ts +128 -0
  9. package/.nuxt/b24ui/chip.ts +205 -0
  10. package/.nuxt/b24ui/container.ts +3 -0
  11. package/.nuxt/b24ui/content/description-list.ts +62 -0
  12. package/.nuxt/b24ui/countdown.ts +94 -0
  13. package/.nuxt/b24ui/form-field.ts +57 -0
  14. package/.nuxt/b24ui/form.ts +3 -0
  15. package/.nuxt/b24ui/index.ts +28 -0
  16. package/.nuxt/b24ui/input.ts +472 -0
  17. package/.nuxt/b24ui/kbd.ts +31 -0
  18. package/.nuxt/b24ui/link.ts +20 -0
  19. package/.nuxt/b24ui/progress.ts +303 -0
  20. package/.nuxt/b24ui/radio-group.ts +135 -0
  21. package/.nuxt/b24ui/range.ts +172 -0
  22. package/.nuxt/b24ui/select.ts +550 -0
  23. package/.nuxt/b24ui/separator.ts +176 -0
  24. package/.nuxt/b24ui/skeleton.ts +3 -0
  25. package/.nuxt/b24ui/switch.ts +134 -0
  26. package/.nuxt/b24ui/tabs.ts +341 -0
  27. package/.nuxt/b24ui/textarea.ts +332 -0
  28. package/.nuxt/b24ui/toast.ts +89 -0
  29. package/.nuxt/b24ui/toaster.ts +91 -0
  30. package/.nuxt/b24ui/tooltip.ts +16 -0
  31. package/LICENSE +21 -0
  32. package/README.md +101 -0
  33. package/cli/commands/make/component.mjs +95 -0
  34. package/cli/commands/make/index.mjs +14 -0
  35. package/cli/commands/make/locale.mjs +64 -0
  36. package/cli/index.mjs +15 -0
  37. package/cli/package.json +13 -0
  38. package/cli/templates.mjs +240 -0
  39. package/cli/utils.mjs +31 -0
  40. package/dist/meta.cjs +23610 -0
  41. package/dist/meta.d.cts +23608 -0
  42. package/dist/meta.d.mts +23608 -0
  43. package/dist/meta.d.ts +23608 -0
  44. package/dist/meta.mjs +23608 -0
  45. package/dist/module.cjs +54 -0
  46. package/dist/module.d.cts +14 -0
  47. package/dist/module.d.mts +14 -0
  48. package/dist/module.d.ts +14 -0
  49. package/dist/module.json +13 -0
  50. package/dist/module.mjs +51 -0
  51. package/dist/runtime/components/Advice.vue +115 -0
  52. package/dist/runtime/components/Alert.vue +136 -0
  53. package/dist/runtime/components/App.vue +52 -0
  54. package/dist/runtime/components/Avatar.vue +118 -0
  55. package/dist/runtime/components/AvatarGroup.vue +99 -0
  56. package/dist/runtime/components/Badge.vue +114 -0
  57. package/dist/runtime/components/Button.vue +177 -0
  58. package/dist/runtime/components/ButtonGroup.vue +58 -0
  59. package/dist/runtime/components/Checkbox.vue +110 -0
  60. package/dist/runtime/components/Chip.vue +81 -0
  61. package/dist/runtime/components/Container.vue +36 -0
  62. package/dist/runtime/components/Countdown.vue +498 -0
  63. package/dist/runtime/components/Form.vue +271 -0
  64. package/dist/runtime/components/FormField.vue +128 -0
  65. package/dist/runtime/components/Input.vue +224 -0
  66. package/dist/runtime/components/Kbd.vue +50 -0
  67. package/dist/runtime/components/Link.vue +219 -0
  68. package/dist/runtime/components/LinkBase.vue +63 -0
  69. package/dist/runtime/components/Progress.vue +182 -0
  70. package/dist/runtime/components/RadioGroup.vue +178 -0
  71. package/dist/runtime/components/Range.vue +114 -0
  72. package/dist/runtime/components/Select.vue +328 -0
  73. package/dist/runtime/components/Separator.vue +82 -0
  74. package/dist/runtime/components/Skeleton.vue +31 -0
  75. package/dist/runtime/components/Switch.vue +133 -0
  76. package/dist/runtime/components/Tabs.vue +127 -0
  77. package/dist/runtime/components/Textarea.vue +216 -0
  78. package/dist/runtime/components/Toast.vue +168 -0
  79. package/dist/runtime/components/Toaster.vue +143 -0
  80. package/dist/runtime/components/Tooltip.vue +94 -0
  81. package/dist/runtime/components/content/DescriptionList.vue +220 -0
  82. package/dist/runtime/composables/defineLocale.d.ts +9 -0
  83. package/dist/runtime/composables/defineLocale.js +4 -0
  84. package/dist/runtime/composables/defineShortcuts.d.ts +15 -0
  85. package/dist/runtime/composables/defineShortcuts.js +135 -0
  86. package/dist/runtime/composables/useAvatarGroup.d.ts +10 -0
  87. package/dist/runtime/composables/useAvatarGroup.js +10 -0
  88. package/dist/runtime/composables/useButtonGroup.d.ts +17 -0
  89. package/dist/runtime/composables/useButtonGroup.js +10 -0
  90. package/dist/runtime/composables/useComponentIcons.d.ts +20 -0
  91. package/dist/runtime/composables/useComponentIcons.js +25 -0
  92. package/dist/runtime/composables/useFormField.d.ts +42 -0
  93. package/dist/runtime/composables/useFormField.js +65 -0
  94. package/dist/runtime/composables/useKbd.d.ts +35 -0
  95. package/dist/runtime/composables/useKbd.js +52 -0
  96. package/dist/runtime/composables/useLocale.d.ts +4 -0
  97. package/dist/runtime/composables/useLocale.js +10 -0
  98. package/dist/runtime/composables/useToast.d.ts +12 -0
  99. package/dist/runtime/composables/useToast.js +62 -0
  100. package/dist/runtime/dictionary/icons.d.ts +20 -0
  101. package/dist/runtime/dictionary/icons.js +35 -0
  102. package/dist/runtime/index.css +1 -0
  103. package/dist/runtime/keyframes.css +1 -0
  104. package/dist/runtime/locale/en.d.ts +2 -0
  105. package/dist/runtime/locale/en.js +48 -0
  106. package/dist/runtime/locale/es.d.ts +2 -0
  107. package/dist/runtime/locale/es.js +48 -0
  108. package/dist/runtime/locale/index.d.ts +3 -0
  109. package/dist/runtime/locale/index.js +3 -0
  110. package/dist/runtime/locale/ru.d.ts +2 -0
  111. package/dist/runtime/locale/ru.js +48 -0
  112. package/dist/runtime/plugins/colors.d.ts +2 -0
  113. package/dist/runtime/plugins/colors.js +40 -0
  114. package/dist/runtime/types/app.config.d.ts +6 -0
  115. package/dist/runtime/types/form.d.ts +84 -0
  116. package/dist/runtime/types/form.js +12 -0
  117. package/dist/runtime/types/icons.d.ts +3 -0
  118. package/dist/runtime/types/icons.js +0 -0
  119. package/dist/runtime/types/index.d.ts +33 -0
  120. package/dist/runtime/types/index.js +33 -0
  121. package/dist/runtime/types/locale.d.ts +50 -0
  122. package/dist/runtime/types/locale.js +0 -0
  123. package/dist/runtime/types/utils.d.ts +22 -0
  124. package/dist/runtime/types/utils.js +0 -0
  125. package/dist/runtime/utils/form.d.ts +17 -0
  126. package/dist/runtime/utils/form.js +153 -0
  127. package/dist/runtime/utils/fuse.d.ts +4 -0
  128. package/dist/runtime/utils/fuse.js +63 -0
  129. package/dist/runtime/utils/index.d.ts +6 -0
  130. package/dist/runtime/utils/index.js +63 -0
  131. package/dist/runtime/utils/link.d.ts +29 -0
  132. package/dist/runtime/utils/link.js +4 -0
  133. package/dist/runtime/utils/locale.d.ts +15 -0
  134. package/dist/runtime/utils/locale.js +25 -0
  135. package/dist/runtime/utils/tv.d.ts +1 -0
  136. package/dist/runtime/utils/tv.js +4 -0
  137. package/dist/runtime/vue/components/Link.vue +203 -0
  138. package/dist/runtime/vue/plugins/color-mode.d.ts +4 -0
  139. package/dist/runtime/vue/plugins/color-mode.js +6 -0
  140. package/dist/runtime/vue/plugins/head.d.ts +4 -0
  141. package/dist/runtime/vue/plugins/head.js +6 -0
  142. package/dist/runtime/vue/stubs.d.ts +15 -0
  143. package/dist/runtime/vue/stubs.js +27 -0
  144. package/dist/shared/b24ui-nuxt.CNGvMe2S.mjs +4074 -0
  145. package/dist/shared/b24ui-nuxt.D22QQtm8.cjs +4079 -0
  146. package/dist/types.d.mts +1 -0
  147. package/dist/types.d.ts +1 -0
  148. package/dist/unplugin.cjs +213 -0
  149. package/dist/unplugin.d.cts +22 -0
  150. package/dist/unplugin.d.mts +22 -0
  151. package/dist/unplugin.d.ts +22 -0
  152. package/dist/unplugin.mjs +202 -0
  153. package/dist/vite.cjs +21 -0
  154. package/dist/vite.d.cts +12 -0
  155. package/dist/vite.d.mts +12 -0
  156. package/dist/vite.d.ts +12 -0
  157. package/dist/vite.mjs +19 -0
  158. package/package.json +166 -0
  159. package/vue-plugin.d.ts +5 -0
@@ -0,0 +1,84 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import type { ComputedRef, DeepReadonly, Ref } from 'vue';
3
+ import type { ZodSchema } from 'zod';
4
+ import type { Schema as JoiSchema } from 'joi';
5
+ import type { ObjectSchema as YupObjectSchema } from 'yup';
6
+ import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
7
+ import type { GetObjectField } from './utils';
8
+ import type { Struct as SuperstructSchema } from 'superstruct';
9
+ export interface Form<T extends object> {
10
+ validate(opts?: {
11
+ name?: keyof T | (keyof T)[];
12
+ silent?: boolean;
13
+ nested?: boolean;
14
+ transform?: boolean;
15
+ }): Promise<T | false>;
16
+ clear(path?: string): void;
17
+ errors: Ref<FormError[]>;
18
+ setErrors(errs: FormError[], name?: keyof T): void;
19
+ getErrors(name?: keyof T): FormError[];
20
+ submit(): Promise<void>;
21
+ disabled: ComputedRef<boolean>;
22
+ dirty: ComputedRef<boolean>;
23
+ dirtyFields: DeepReadonly<Set<keyof T>>;
24
+ touchedFields: DeepReadonly<Set<keyof T>>;
25
+ blurredFields: DeepReadonly<Set<keyof T>>;
26
+ }
27
+ export type FormSchema<T extends object> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
28
+ export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
29
+ export interface FormError<P extends string = string> {
30
+ name: P;
31
+ message: string;
32
+ }
33
+ export interface FormErrorWithId extends FormError {
34
+ id?: string;
35
+ }
36
+ export type FormSubmitEvent<T> = SubmitEvent & {
37
+ data: T;
38
+ };
39
+ export type FormValidationError = {
40
+ errors: FormErrorWithId[];
41
+ children?: FormValidationError[];
42
+ };
43
+ export type FormErrorEvent = SubmitEvent & FormValidationError;
44
+ export type FormEventType = FormInputEvents;
45
+ export type FormChildAttachEvent = {
46
+ type: 'attach';
47
+ formId: string | number;
48
+ validate: Form<any>['validate'];
49
+ };
50
+ export type FormChildDetachEvent = {
51
+ type: 'detach';
52
+ formId: string | number;
53
+ };
54
+ export type FormInputEvent<T extends object> = {
55
+ type: FormEventType;
56
+ name: keyof T;
57
+ eager?: boolean;
58
+ };
59
+ export type FormEvent<T extends object> = FormInputEvent<T> | FormChildAttachEvent | FormChildDetachEvent;
60
+ export interface FormInjectedOptions {
61
+ disabled?: boolean;
62
+ validateOnInputDelay?: number;
63
+ }
64
+ export interface FormFieldInjectedOptions<T> {
65
+ name?: string;
66
+ size?: GetObjectField<T, 'size'>;
67
+ error?: string | boolean;
68
+ eagerValidation?: boolean;
69
+ validateOnInputDelay?: number;
70
+ errorPattern?: RegExp;
71
+ hint?: string;
72
+ description?: string;
73
+ ariaId: string;
74
+ }
75
+ export interface ValidateReturnSchema<T> {
76
+ result: T;
77
+ errors: FormError[] | null;
78
+ }
79
+ export declare class FormValidationException extends Error {
80
+ formId: string | number;
81
+ errors: FormErrorWithId[];
82
+ children?: FormValidationException[];
83
+ constructor(formId: string | number, errors: FormErrorWithId[], childErrors?: FormValidationException[]);
84
+ }
@@ -0,0 +1,12 @@
1
+ export class FormValidationException extends Error {
2
+ formId;
3
+ errors;
4
+ children;
5
+ constructor(formId, errors, childErrors) {
6
+ super("Form validation exception");
7
+ this.formId = formId;
8
+ this.errors = errors;
9
+ this.children = childErrors;
10
+ Object.setPrototypeOf(this, FormValidationException.prototype);
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ import type { FunctionalComponent, HTMLAttributes, VNodeProps } from 'vue';
2
+ export interface IconComponent extends FunctionalComponent<HTMLAttributes & VNodeProps, {}, any, {}> {
3
+ }
File without changes
@@ -0,0 +1,33 @@
1
+ export * from '../components/Advice.vue';
2
+ export * from '../components/Alert.vue';
3
+ export * from '../components/App.vue';
4
+ export * from '../components/Avatar.vue';
5
+ export * from '../components/AvatarGroup.vue';
6
+ export * from '../components/Badge.vue';
7
+ export * from '../components/Button.vue';
8
+ export * from '../components/ButtonGroup.vue';
9
+ export * from '../components/Checkbox.vue';
10
+ export * from '../components/Chip.vue';
11
+ export * from '../components/Container.vue';
12
+ export * from '../components/Countdown.vue';
13
+ export * from '../components/Form.vue';
14
+ export * from '../components/FormField.vue';
15
+ export * from '../components/Input.vue';
16
+ export * from '../components/Kbd.vue';
17
+ export * from '../components/Link.vue';
18
+ export * from '../components/Progress.vue';
19
+ export * from '../components/RadioGroup.vue';
20
+ export * from '../components/Range.vue';
21
+ export * from '../components/Select.vue';
22
+ export * from '../components/Separator.vue';
23
+ export * from '../components/Skeleton.vue';
24
+ export * from '../components/Switch.vue';
25
+ export * from '../components/Tabs.vue';
26
+ export * from '../components/Textarea.vue';
27
+ export * from '../components/Toast.vue';
28
+ export * from '../components/Toaster.vue';
29
+ export * from '../components/Tooltip.vue';
30
+ export * from '../components/content/DescriptionList.vue';
31
+ export * from './form';
32
+ export * from './locale';
33
+ export * from './icons';
@@ -0,0 +1,33 @@
1
+ export * from "../components/Advice.vue";
2
+ export * from "../components/Alert.vue";
3
+ export * from "../components/App.vue";
4
+ export * from "../components/Avatar.vue";
5
+ export * from "../components/AvatarGroup.vue";
6
+ export * from "../components/Badge.vue";
7
+ export * from "../components/Button.vue";
8
+ export * from "../components/ButtonGroup.vue";
9
+ export * from "../components/Checkbox.vue";
10
+ export * from "../components/Chip.vue";
11
+ export * from "../components/Container.vue";
12
+ export * from "../components/Countdown.vue";
13
+ export * from "../components/Form.vue";
14
+ export * from "../components/FormField.vue";
15
+ export * from "../components/Input.vue";
16
+ export * from "../components/Kbd.vue";
17
+ export * from "../components/Link.vue";
18
+ export * from "../components/Progress.vue";
19
+ export * from "../components/RadioGroup.vue";
20
+ export * from "../components/Range.vue";
21
+ export * from "../components/Select.vue";
22
+ export * from "../components/Separator.vue";
23
+ export * from "../components/Skeleton.vue";
24
+ export * from "../components/Switch.vue";
25
+ export * from "../components/Tabs.vue";
26
+ export * from "../components/Textarea.vue";
27
+ export * from "../components/Toast.vue";
28
+ export * from "../components/Toaster.vue";
29
+ export * from "../components/Tooltip.vue";
30
+ export * from "../components/content/DescriptionList.vue";
31
+ export * from "./form.js";
32
+ export * from "./locale.js";
33
+ export * from "./icons.js";
@@ -0,0 +1,50 @@
1
+ export type Messages = {
2
+ inputMenu: {
3
+ noMatch: string;
4
+ noData: string;
5
+ create: string;
6
+ };
7
+ inputNumber: {
8
+ increment: string;
9
+ decrement: string;
10
+ };
11
+ commandPalette: {
12
+ placeholder: string;
13
+ noMatch: string;
14
+ noData: string;
15
+ close: string;
16
+ };
17
+ selectMenu: {
18
+ noMatch: string;
19
+ noData: string;
20
+ create: string;
21
+ search: string;
22
+ };
23
+ toast: {
24
+ close: string;
25
+ };
26
+ carousel: {
27
+ prev: string;
28
+ next: string;
29
+ goto: string;
30
+ };
31
+ modal: {
32
+ close: string;
33
+ };
34
+ slideover: {
35
+ close: string;
36
+ };
37
+ alert: {
38
+ close: string;
39
+ };
40
+ table: {
41
+ noData: string;
42
+ };
43
+ };
44
+ export type Direction = 'ltr' | 'rtl';
45
+ export type Locale = {
46
+ name: string;
47
+ code: string;
48
+ dir: Direction;
49
+ messages: Messages;
50
+ };
File without changes
@@ -0,0 +1,22 @@
1
+ export interface TightMap<O = any> {
2
+ [key: string]: TightMap | O;
3
+ }
4
+ export type DeepPartial<T, O = any> = {
5
+ [P in keyof T]?: T[P] extends Array<string> ? string : T[P] extends object ? DeepPartial<T[P], O> : T[P];
6
+ } & {
7
+ [key: string]: O | TightMap<O>;
8
+ };
9
+ export type DynamicSlots<T extends {
10
+ slot?: string;
11
+ }, SlotProps, Slot = T['slot']> = Record<string, SlotProps> & (Slot extends string ? Record<Slot, SlotProps> : Record<string, never>);
12
+ export type GetObjectField<MaybeObject, Key extends string> = MaybeObject extends Record<string, any> ? MaybeObject[Key] : never;
13
+ export type PartialString<T> = {
14
+ [K in keyof T]?: string;
15
+ };
16
+ export type MaybeArrayOfArray<T> = T[] | T[][];
17
+ export type MaybeArrayOfArrayItem<I> = I extends Array<infer T> ? T extends Array<infer U> ? U : T : never;
18
+ export type SelectModelValue<T, V, M extends boolean = false, DV = T> = (T extends Record<string, any> ? V extends keyof T ? T[V] : DV : T) extends infer U ? M extends true ? U[] : U : never;
19
+ export type SelectItemKey<T> = T extends Record<string, any> ? keyof T : string;
20
+ export type SelectModelValueEmits<T, V, M extends boolean = false, DV = T> = {
21
+ 'update:modelValue': [payload: SelectModelValue<T, V, M, DV>];
22
+ };
File without changes
@@ -0,0 +1,17 @@
1
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import type { ZodSchema } from 'zod';
3
+ import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi';
4
+ import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup';
5
+ import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
6
+ import type { Struct } from 'superstruct';
7
+ import type { FormSchema, ValidateReturnSchema } from '../types/form';
8
+ export declare function isYupSchema(schema: any): schema is YupObjectSchema<any>;
9
+ export declare function isYupError(error: any): error is YupError;
10
+ export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
11
+ export declare function isZodSchema(schema: any): schema is ZodSchema;
12
+ export declare function isJoiSchema(schema: any): schema is JoiSchema;
13
+ export declare function isJoiError(error: any): error is JoiError;
14
+ export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
15
+ export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
16
+ export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
17
+ export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
@@ -0,0 +1,153 @@
1
+ export function isYupSchema(schema) {
2
+ return schema.validate && schema.__isYupSchema__;
3
+ }
4
+ export function isYupError(error) {
5
+ return error.inner !== void 0;
6
+ }
7
+ export function isSuperStructSchema(schema) {
8
+ return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
9
+ }
10
+ export function isZodSchema(schema) {
11
+ return schema.parse !== void 0;
12
+ }
13
+ export function isJoiSchema(schema) {
14
+ return schema.validateAsync !== void 0 && schema.id !== void 0;
15
+ }
16
+ export function isJoiError(error) {
17
+ return error.isJoi === true;
18
+ }
19
+ export function isValibotSchema(schema) {
20
+ return "_run" in schema || typeof schema === "function" && "schema" in schema;
21
+ }
22
+ export function isStandardSchema(schema) {
23
+ return "~standard" in schema;
24
+ }
25
+ export async function validateStandardSchema(state, schema) {
26
+ const result = await schema["~standard"].validate(state);
27
+ if (result.issues) {
28
+ return {
29
+ errors: result.issues?.map((issue) => ({
30
+ name: issue.path?.map((item) => typeof item === "object" ? item.key : item).join(".") || "",
31
+ message: issue.message
32
+ })) || [],
33
+ result: null
34
+ };
35
+ }
36
+ return {
37
+ errors: null,
38
+ result: result.value
39
+ };
40
+ }
41
+ async function validateYupSchema(state, schema) {
42
+ try {
43
+ const result = await schema.validate(state, { abortEarly: false });
44
+ return {
45
+ errors: null,
46
+ result
47
+ };
48
+ } catch (error) {
49
+ if (isYupError(error)) {
50
+ const errors = error.inner.map((issue) => ({
51
+ name: issue.path ?? "",
52
+ message: issue.message
53
+ }));
54
+ return {
55
+ errors,
56
+ result: null
57
+ };
58
+ } else {
59
+ throw error;
60
+ }
61
+ }
62
+ }
63
+ async function validateSuperstructSchema(state, schema) {
64
+ const [err, result] = schema.validate(state);
65
+ if (err) {
66
+ const errors = err.failures().map((error) => ({
67
+ message: error.message,
68
+ name: error.path.join(".")
69
+ }));
70
+ return {
71
+ errors,
72
+ result: null
73
+ };
74
+ }
75
+ return {
76
+ errors: null,
77
+ result
78
+ };
79
+ }
80
+ async function validateZodSchema(state, schema) {
81
+ const result = await schema.safeParseAsync(state);
82
+ if (result.success === false) {
83
+ const errors = result.error.issues.map((issue) => ({
84
+ name: issue.path.join("."),
85
+ message: issue.message
86
+ }));
87
+ return {
88
+ errors,
89
+ result: null
90
+ };
91
+ }
92
+ return {
93
+ result: result.data,
94
+ errors: null
95
+ };
96
+ }
97
+ async function validateJoiSchema(state, schema) {
98
+ try {
99
+ const result = await schema.validateAsync(state, { abortEarly: false });
100
+ return {
101
+ errors: null,
102
+ result
103
+ };
104
+ } catch (error) {
105
+ if (isJoiError(error)) {
106
+ const errors = error.details.map((issue) => ({
107
+ name: issue.path.join("."),
108
+ message: issue.message
109
+ }));
110
+ return {
111
+ errors,
112
+ result: null
113
+ };
114
+ } else {
115
+ throw error;
116
+ }
117
+ }
118
+ }
119
+ async function validateValibotSchema(state, schema) {
120
+ const result = await ("_run" in schema ? schema._run({ typed: false, value: state }, {}) : schema(state));
121
+ if (!result.issues || result.issues.length === 0) {
122
+ const output = "output" in result ? result.output : "value" in result ? result.value : null;
123
+ return {
124
+ errors: null,
125
+ result: output
126
+ };
127
+ }
128
+ const errors = result.issues.map((issue) => ({
129
+ name: issue.path?.map((item) => item.key).join(".") || "",
130
+ message: issue.message
131
+ }));
132
+ return {
133
+ errors,
134
+ result: null
135
+ };
136
+ }
137
+ export function validateSchema(state, schema) {
138
+ if (isZodSchema(schema)) {
139
+ return validateZodSchema(state, schema);
140
+ } else if (isJoiSchema(schema)) {
141
+ return validateJoiSchema(state, schema);
142
+ } else if (isStandardSchema(schema)) {
143
+ return validateStandardSchema(state, schema);
144
+ } else if (isValibotSchema(schema)) {
145
+ return validateValibotSchema(state, schema);
146
+ } else if (isYupSchema(schema)) {
147
+ return validateYupSchema(state, schema);
148
+ } else if (isSuperStructSchema(schema)) {
149
+ return validateSuperstructSchema(state, schema);
150
+ } else {
151
+ throw new Error("Form validation failed: Unsupported form schema");
152
+ }
153
+ }
@@ -0,0 +1,4 @@
1
+ import type { FuseResult } from 'fuse.js';
2
+ export declare function highlight<T>(item: T & {
3
+ matches?: FuseResult<T>['matches'];
4
+ }, searchTerm: string, forceKey?: string, omitKeys?: string[]): string | undefined;
@@ -0,0 +1,63 @@
1
+ function truncateHTMLFromStart(html, maxLength) {
2
+ let truncated = "";
3
+ let totalLength = 0;
4
+ let insideTag = false;
5
+ for (let i = html.length - 1; i >= 0; i--) {
6
+ if (html[i] === ">") {
7
+ insideTag = true;
8
+ } else if (html[i] === "<") {
9
+ insideTag = false;
10
+ truncated = html[i] + truncated;
11
+ continue;
12
+ }
13
+ if (!insideTag) {
14
+ totalLength++;
15
+ }
16
+ if (totalLength <= maxLength) {
17
+ truncated = html[i] + truncated;
18
+ } else {
19
+ truncated = "..." + truncated;
20
+ break;
21
+ }
22
+ }
23
+ return truncated;
24
+ }
25
+ export function highlight(item, searchTerm, forceKey, omitKeys) {
26
+ function generateHighlightedText(value, indices = []) {
27
+ value = value || "";
28
+ let content = "";
29
+ let nextUnhighlightedRegionStartingIndex = 0;
30
+ indices.forEach((region) => {
31
+ if (region.length === 2 && region[0] === region[1]) {
32
+ return;
33
+ }
34
+ const lastIndiceNextIndex = region[1] + 1;
35
+ const isMatched = lastIndiceNextIndex - region[0] >= searchTerm.length;
36
+ content += [
37
+ value.substring(nextUnhighlightedRegionStartingIndex, region[0]),
38
+ isMatched && `<mark>`,
39
+ value.substring(region[0], lastIndiceNextIndex),
40
+ isMatched && "</mark>"
41
+ ].filter(Boolean).join("");
42
+ nextUnhighlightedRegionStartingIndex = lastIndiceNextIndex;
43
+ });
44
+ content += value.substring(nextUnhighlightedRegionStartingIndex);
45
+ const markIndex = content.indexOf("<mark>");
46
+ if (markIndex !== -1) {
47
+ content = truncateHTMLFromStart(content, content.length - markIndex);
48
+ }
49
+ return content;
50
+ }
51
+ if (!item.matches?.length) {
52
+ return;
53
+ }
54
+ for (const match of item.matches) {
55
+ if (forceKey && match.key !== forceKey) {
56
+ continue;
57
+ }
58
+ if (omitKeys?.includes(match.key)) {
59
+ continue;
60
+ }
61
+ return generateHighlightedText(match.value, match.indices);
62
+ }
63
+ }
@@ -0,0 +1,6 @@
1
+ export declare function pick<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Pick<Data, Keys>;
2
+ export declare function omit<Data extends object, Keys extends keyof Data>(data: Data, keys: Keys[]): Omit<Data, Keys>;
3
+ export declare function get(object: Record<string, any> | undefined, path: (string | number)[] | string, defaultValue?: any): any;
4
+ export declare function set(object: Record<string, any>, path: (string | number)[] | string, value: any): void;
5
+ export declare function looseToNumber(val: any): any;
6
+ export declare function compare<T>(value?: T, currentValue?: T, comparator?: string | ((a: T, b: T) => boolean)): boolean;
@@ -0,0 +1,63 @@
1
+ import { isEqual } from "ohash";
2
+ export function pick(data, keys) {
3
+ const result = {};
4
+ for (const key of keys) {
5
+ result[key] = data[key];
6
+ }
7
+ return result;
8
+ }
9
+ export function omit(data, keys) {
10
+ const result = { ...data };
11
+ for (const key of keys) {
12
+ delete result[key];
13
+ }
14
+ return result;
15
+ }
16
+ export function get(object, path, defaultValue) {
17
+ if (typeof path === "string") {
18
+ path = path.split(".").map((key) => {
19
+ const numKey = Number(key);
20
+ return Number.isNaN(numKey) ? key : numKey;
21
+ });
22
+ }
23
+ let result = object;
24
+ for (const key of path) {
25
+ if (result === void 0 || result === null) {
26
+ return defaultValue;
27
+ }
28
+ result = result[key];
29
+ }
30
+ return result !== void 0 ? result : defaultValue;
31
+ }
32
+ export function set(object, path, value) {
33
+ if (typeof path === "string") {
34
+ path = path.split(".").map((key) => {
35
+ const numKey = Number(key);
36
+ return Number.isNaN(numKey) ? key : numKey;
37
+ });
38
+ }
39
+ path.reduce((acc, key, i) => {
40
+ if (acc[key] === void 0) acc[key] = {};
41
+ if (i === path.length - 1) acc[key] = value;
42
+ return acc[key];
43
+ }, object);
44
+ }
45
+ export function looseToNumber(val) {
46
+ const n = Number.parseFloat(val);
47
+ return Number.isNaN(n) ? val : n;
48
+ }
49
+ export function compare(value, currentValue, comparator) {
50
+ if (value === void 0 || currentValue === void 0) {
51
+ return false;
52
+ }
53
+ if (typeof value === "string") {
54
+ return value === currentValue;
55
+ }
56
+ if (typeof comparator === "function") {
57
+ return comparator(value, currentValue);
58
+ }
59
+ if (typeof comparator === "string") {
60
+ return get(value, comparator) === get(currentValue, comparator);
61
+ }
62
+ return isEqual(value, currentValue);
63
+ }
@@ -0,0 +1,29 @@
1
+ import type { LinkProps } from '../types';
2
+ export declare function pickLinkProps(link: LinkProps & {
3
+ ariaLabel?: string;
4
+ title?: string;
5
+ }): {
6
+ replace: any;
7
+ type: any;
8
+ title: any;
9
+ exact: any;
10
+ active: any;
11
+ activeClass: any;
12
+ ariaCurrentValue: any;
13
+ ariaLabel: any;
14
+ as: any;
15
+ disabled: any;
16
+ exactActiveClass: any;
17
+ exactHash: any;
18
+ exactQuery: any;
19
+ external: any;
20
+ href: any;
21
+ inactiveClass: any;
22
+ noPrefetch: any;
23
+ noRel: any;
24
+ prefetch: any;
25
+ prefetchedClass: any;
26
+ rel: any;
27
+ target: any;
28
+ to: any;
29
+ };
@@ -0,0 +1,4 @@
1
+ import { reactivePick } from "@vueuse/core";
2
+ export function pickLinkProps(link) {
3
+ return reactivePick(link, "active", "activeClass", "ariaCurrentValue", "ariaLabel", "as", "disabled", "exact", "exactActiveClass", "exactHash", "exactQuery", "external", "href", "inactiveClass", "noPrefetch", "noRel", "prefetch", "prefetchedClass", "rel", "replace", "target", "to", "type", "title");
4
+ }
@@ -0,0 +1,15 @@
1
+ import type { Ref } from 'vue';
2
+ import type { Locale, Direction } from '../types/locale';
3
+ import type { MaybeRef } from '@vueuse/core';
4
+ export type TranslatorOption = Record<string, string | number>;
5
+ export type Translator = (path: string, option?: TranslatorOption) => string;
6
+ export type LocaleContext = {
7
+ locale: Ref<Locale>;
8
+ lang: Ref<string>;
9
+ dir: Ref<Direction>;
10
+ code: Ref<string>;
11
+ t: Translator;
12
+ };
13
+ export declare function buildTranslator(locale: MaybeRef<Locale>): Translator;
14
+ export declare function translate(path: string, option: undefined | TranslatorOption, locale: Locale): string;
15
+ export declare function buildLocaleContext(locale: MaybeRef<Locale>): LocaleContext;
@@ -0,0 +1,25 @@
1
+ import { computed, isRef, ref, unref } from "vue";
2
+ import { get } from "./index.js";
3
+ export function buildTranslator(locale) {
4
+ return (path, option) => translate(path, option, unref(locale));
5
+ }
6
+ export function translate(path, option, locale) {
7
+ const prop = get(locale, `messages.${path}`, path);
8
+ return prop.replace(
9
+ /\{(\w+)\}/g,
10
+ (_, key) => `${option?.[key] ?? `{${key}}`}`
11
+ );
12
+ }
13
+ export function buildLocaleContext(locale) {
14
+ const lang = computed(() => unref(locale).name);
15
+ const code = computed(() => unref(locale).code);
16
+ const dir = computed(() => unref(locale).dir);
17
+ const localeRef = isRef(locale) ? locale : ref(locale);
18
+ return {
19
+ lang,
20
+ code,
21
+ dir,
22
+ locale: localeRef,
23
+ t: buildTranslator(locale)
24
+ };
25
+ }
@@ -0,0 +1 @@
1
+ export declare const tv: import("tailwind-variants").CreateTV<boolean | (string | number | symbol)[] | {} | undefined>;
@@ -0,0 +1,4 @@
1
+ import { createTV } from "tailwind-variants";
2
+ import _appConfig from "#build/app.config";
3
+ const appConfigTv = _appConfig;
4
+ export const tv = createTV(appConfigTv.b24ui?.tv);