@ciwergrp/nuxid 1.0.2-release
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/README.md +119 -0
- package/bin/kiban.mjs +41 -0
- package/console/request.mjs +337 -0
- package/dist/module.d.mts +188 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +439 -0
- package/dist/runtime/form.d.ts +21 -0
- package/dist/runtime/form.js +161 -0
- package/dist/runtime/helper/array/collapse.d.ts +1 -0
- package/dist/runtime/helper/array/collapse.js +9 -0
- package/dist/runtime/helper/array/crossJoin.d.ts +1 -0
- package/dist/runtime/helper/array/crossJoin.js +17 -0
- package/dist/runtime/helper/array/every.d.ts +1 -0
- package/dist/runtime/helper/array/every.js +3 -0
- package/dist/runtime/helper/array/first.d.ts +1 -0
- package/dist/runtime/helper/array/first.js +11 -0
- package/dist/runtime/helper/array/flatten.d.ts +1 -0
- package/dist/runtime/helper/array/flatten.js +14 -0
- package/dist/runtime/helper/array/index.d.ts +46 -0
- package/dist/runtime/helper/array/index.js +69 -0
- package/dist/runtime/helper/array/join.d.ts +1 -0
- package/dist/runtime/helper/array/join.js +11 -0
- package/dist/runtime/helper/array/last.d.ts +1 -0
- package/dist/runtime/helper/array/last.js +11 -0
- package/dist/runtime/helper/array/map.d.ts +1 -0
- package/dist/runtime/helper/array/map.js +3 -0
- package/dist/runtime/helper/array/mapSpread.d.ts +1 -0
- package/dist/runtime/helper/array/mapSpread.js +3 -0
- package/dist/runtime/helper/array/partition.d.ts +1 -0
- package/dist/runtime/helper/array/partition.js +12 -0
- package/dist/runtime/helper/array/random.d.ts +1 -0
- package/dist/runtime/helper/array/random.js +19 -0
- package/dist/runtime/helper/array/reject.d.ts +1 -0
- package/dist/runtime/helper/array/reject.js +3 -0
- package/dist/runtime/helper/array/shuffle.d.ts +1 -0
- package/dist/runtime/helper/array/shuffle.js +8 -0
- package/dist/runtime/helper/array/sole.d.ts +1 -0
- package/dist/runtime/helper/array/sole.js +7 -0
- package/dist/runtime/helper/array/some.d.ts +1 -0
- package/dist/runtime/helper/array/some.js +3 -0
- package/dist/runtime/helper/array/sort.d.ts +1 -0
- package/dist/runtime/helper/array/sort.js +4 -0
- package/dist/runtime/helper/array/sortDesc.d.ts +1 -0
- package/dist/runtime/helper/array/sortDesc.js +9 -0
- package/dist/runtime/helper/array/take.d.ts +1 -0
- package/dist/runtime/helper/array/take.js +9 -0
- package/dist/runtime/helper/array/where.d.ts +1 -0
- package/dist/runtime/helper/array/where.js +3 -0
- package/dist/runtime/helper/array/whereNotNull.d.ts +1 -0
- package/dist/runtime/helper/array/whereNotNull.js +3 -0
- package/dist/runtime/helper/array/wrap.d.ts +1 -0
- package/dist/runtime/helper/array/wrap.js +6 -0
- package/dist/runtime/helper/index.d.ts +4 -0
- package/dist/runtime/helper/index.js +4 -0
- package/dist/runtime/helper/number/clamp.d.ts +1 -0
- package/dist/runtime/helper/number/clamp.js +3 -0
- package/dist/runtime/helper/number/currency.d.ts +1 -0
- package/dist/runtime/helper/number/currency.js +14 -0
- package/dist/runtime/helper/number/fileSize.d.ts +1 -0
- package/dist/runtime/helper/number/fileSize.js +12 -0
- package/dist/runtime/helper/number/format.d.ts +1 -0
- package/dist/runtime/helper/number/format.js +12 -0
- package/dist/runtime/helper/number/humanize.d.ts +5 -0
- package/dist/runtime/helper/number/humanize.js +39 -0
- package/dist/runtime/helper/number/index.d.ts +37 -0
- package/dist/runtime/helper/number/index.js +60 -0
- package/dist/runtime/helper/number/intl.d.ts +5 -0
- package/dist/runtime/helper/number/intl.js +32 -0
- package/dist/runtime/helper/number/ordinal.d.ts +1 -0
- package/dist/runtime/helper/number/ordinal.js +26 -0
- package/dist/runtime/helper/number/pairs.d.ts +1 -0
- package/dist/runtime/helper/number/pairs.js +11 -0
- package/dist/runtime/helper/number/parse.d.ts +4 -0
- package/dist/runtime/helper/number/parse.js +19 -0
- package/dist/runtime/helper/number/percentage.d.ts +1 -0
- package/dist/runtime/helper/number/percentage.js +14 -0
- package/dist/runtime/helper/number/spell.d.ts +2 -0
- package/dist/runtime/helper/number/spell.js +145 -0
- package/dist/runtime/helper/number/state.d.ts +1 -0
- package/dist/runtime/helper/number/state.js +8 -0
- package/dist/runtime/helper/number/trim.d.ts +1 -0
- package/dist/runtime/helper/number/trim.js +3 -0
- package/dist/runtime/helper/object/add.d.ts +2 -0
- package/dist/runtime/helper/object/add.js +8 -0
- package/dist/runtime/helper/object/dot.d.ts +1 -0
- package/dist/runtime/helper/object/dot.js +19 -0
- package/dist/runtime/helper/object/except.d.ts +2 -0
- package/dist/runtime/helper/object/except.js +10 -0
- package/dist/runtime/helper/object/forget.d.ts +2 -0
- package/dist/runtime/helper/object/forget.js +24 -0
- package/dist/runtime/helper/object/get.d.ts +2 -0
- package/dist/runtime/helper/object/get.js +15 -0
- package/dist/runtime/helper/object/has.d.ts +2 -0
- package/dist/runtime/helper/object/has.js +5 -0
- package/dist/runtime/helper/object/index.d.ts +22 -0
- package/dist/runtime/helper/object/index.js +33 -0
- package/dist/runtime/helper/object/only.d.ts +2 -0
- package/dist/runtime/helper/object/only.js +12 -0
- package/dist/runtime/helper/object/set.d.ts +2 -0
- package/dist/runtime/helper/object/set.js +23 -0
- package/dist/runtime/helper/object/undot.d.ts +1 -0
- package/dist/runtime/helper/object/undot.js +8 -0
- package/dist/runtime/helper/object/utils.d.ts +3 -0
- package/dist/runtime/helper/object/utils.js +10 -0
- package/dist/runtime/helper/state.d.ts +6 -0
- package/dist/runtime/helper/state.js +50 -0
- package/dist/runtime/helper/string/basic.d.ts +7 -0
- package/dist/runtime/helper/string/basic.js +42 -0
- package/dist/runtime/helper/string/bounds.d.ts +6 -0
- package/dist/runtime/helper/string/bounds.js +42 -0
- package/dist/runtime/helper/string/case.d.ts +9 -0
- package/dist/runtime/helper/string/case.js +50 -0
- package/dist/runtime/helper/string/index.d.ts +57 -0
- package/dist/runtime/helper/string/index.js +100 -0
- package/dist/runtime/helper/string/locale.d.ts +1 -0
- package/dist/runtime/helper/string/locale.js +1 -0
- package/dist/runtime/helper/string/match.d.ts +4 -0
- package/dist/runtime/helper/string/match.js +15 -0
- package/dist/runtime/helper/string/pad.d.ts +3 -0
- package/dist/runtime/helper/string/pad.js +12 -0
- package/dist/runtime/helper/string/plural.d.ts +3 -0
- package/dist/runtime/helper/string/plural.js +16 -0
- package/dist/runtime/helper/string/replace.d.ts +4 -0
- package/dist/runtime/helper/string/replace.js +25 -0
- package/dist/runtime/helper/string/slug.d.ts +1 -0
- package/dist/runtime/helper/string/slug.js +8 -0
- package/dist/runtime/helper/string/transliterate.d.ts +2 -0
- package/dist/runtime/helper/string/transliterate.js +8 -0
- package/dist/runtime/helper/string/words.d.ts +2 -0
- package/dist/runtime/helper/string/words.js +13 -0
- package/dist/runtime/lodash.d.ts +1 -0
- package/dist/runtime/lodash.js +1 -0
- package/dist/runtime/pinia/composables.d.ts +2 -0
- package/dist/runtime/pinia/composables.js +3 -0
- package/dist/runtime/pinia/payload-plugin.d.ts +5 -0
- package/dist/runtime/pinia/payload-plugin.js +15 -0
- package/dist/runtime/pinia/plugin.d.ts +6 -0
- package/dist/runtime/pinia/plugin.js +22 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +4 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/validator.d.ts +13 -0
- package/dist/runtime/validator.js +445 -0
- package/dist/types.d.mts +11 -0
- package/package.json +90 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { after, afterLast, before, beforeLast, between, betweenFirst } from './bounds.js';
|
|
2
|
+
import { length, ltrim, rtrim, start, finish } from './basic.js';
|
|
3
|
+
import { camel, kebab, lcfirst, lower, snake, studly, title, ucfirst, upper } from './case.js';
|
|
4
|
+
import { contains, containsAll, endsWith, startsWith } from './match.js';
|
|
5
|
+
import { defaultLocale, useLocale, withLocale } from './locale.js';
|
|
6
|
+
import { padBoth, padLeft, padRight } from './pad.js';
|
|
7
|
+
import { plural, pluralStudly, singular } from './plural.js';
|
|
8
|
+
import { remove, replace, replaceFirst, replaceLast } from './replace.js';
|
|
9
|
+
import { slug } from './slug.js';
|
|
10
|
+
import { ascii, transliterate } from './transliterate.js';
|
|
11
|
+
import { wordCount, words } from './words.js';
|
|
12
|
+
export interface StringHelper {
|
|
13
|
+
after: typeof after;
|
|
14
|
+
afterLast: typeof afterLast;
|
|
15
|
+
ascii: typeof ascii;
|
|
16
|
+
before: typeof before;
|
|
17
|
+
beforeLast: typeof beforeLast;
|
|
18
|
+
between: typeof between;
|
|
19
|
+
betweenFirst: typeof betweenFirst;
|
|
20
|
+
camel: typeof camel;
|
|
21
|
+
contains: typeof contains;
|
|
22
|
+
containsAll: typeof containsAll;
|
|
23
|
+
endsWith: typeof endsWith;
|
|
24
|
+
finish: typeof finish;
|
|
25
|
+
defaultLocale: typeof defaultLocale;
|
|
26
|
+
kebab: typeof kebab;
|
|
27
|
+
lcfirst: typeof lcfirst;
|
|
28
|
+
length: typeof length;
|
|
29
|
+
lower: typeof lower;
|
|
30
|
+
ltrim: typeof ltrim;
|
|
31
|
+
padBoth: typeof padBoth;
|
|
32
|
+
padLeft: typeof padLeft;
|
|
33
|
+
padRight: typeof padRight;
|
|
34
|
+
plural: typeof plural;
|
|
35
|
+
pluralStudly: typeof pluralStudly;
|
|
36
|
+
remove: typeof remove;
|
|
37
|
+
replace: typeof replace;
|
|
38
|
+
replaceFirst: typeof replaceFirst;
|
|
39
|
+
replaceLast: typeof replaceLast;
|
|
40
|
+
rtrim: typeof rtrim;
|
|
41
|
+
singular: typeof singular;
|
|
42
|
+
slug: typeof slug;
|
|
43
|
+
snake: typeof snake;
|
|
44
|
+
start: typeof start;
|
|
45
|
+
startsWith: typeof startsWith;
|
|
46
|
+
studly: typeof studly;
|
|
47
|
+
title: typeof title;
|
|
48
|
+
transliterate: typeof transliterate;
|
|
49
|
+
ucfirst: typeof ucfirst;
|
|
50
|
+
upper: typeof upper;
|
|
51
|
+
wordCount: typeof wordCount;
|
|
52
|
+
words: typeof words;
|
|
53
|
+
useLocale: typeof useLocale;
|
|
54
|
+
withLocale: typeof withLocale;
|
|
55
|
+
}
|
|
56
|
+
export declare function string(): StringHelper;
|
|
57
|
+
export { after, afterLast, ascii, before, beforeLast, between, betweenFirst, defaultLocale, camel, contains, containsAll, endsWith, finish, kebab, lcfirst, length, lower, padBoth, padLeft, padRight, plural, pluralStudly, remove, replace, replaceFirst, replaceLast, rtrim, singular, slug, snake, start, startsWith, studly, title, transliterate, ucfirst, upper, wordCount, words, useLocale, withLocale, };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { after, afterLast, before, beforeLast, between, betweenFirst } from "./bounds.js";
|
|
2
|
+
import { length, ltrim, rtrim, start, finish } from "./basic.js";
|
|
3
|
+
import { camel, kebab, lcfirst, lower, snake, studly, title, ucfirst, upper } from "./case.js";
|
|
4
|
+
import { contains, containsAll, endsWith, startsWith } from "./match.js";
|
|
5
|
+
import { defaultLocale, useLocale, withLocale } from "./locale.js";
|
|
6
|
+
import { padBoth, padLeft, padRight } from "./pad.js";
|
|
7
|
+
import { plural, pluralStudly, singular } from "./plural.js";
|
|
8
|
+
import { remove, replace, replaceFirst, replaceLast } from "./replace.js";
|
|
9
|
+
import { slug } from "./slug.js";
|
|
10
|
+
import { ascii, transliterate } from "./transliterate.js";
|
|
11
|
+
import { wordCount, words } from "./words.js";
|
|
12
|
+
export function string() {
|
|
13
|
+
return {
|
|
14
|
+
after,
|
|
15
|
+
afterLast,
|
|
16
|
+
ascii,
|
|
17
|
+
before,
|
|
18
|
+
beforeLast,
|
|
19
|
+
between,
|
|
20
|
+
betweenFirst,
|
|
21
|
+
camel,
|
|
22
|
+
contains,
|
|
23
|
+
containsAll,
|
|
24
|
+
defaultLocale,
|
|
25
|
+
endsWith,
|
|
26
|
+
finish,
|
|
27
|
+
kebab,
|
|
28
|
+
lcfirst,
|
|
29
|
+
length,
|
|
30
|
+
lower,
|
|
31
|
+
ltrim,
|
|
32
|
+
padBoth,
|
|
33
|
+
padLeft,
|
|
34
|
+
padRight,
|
|
35
|
+
plural,
|
|
36
|
+
pluralStudly,
|
|
37
|
+
remove,
|
|
38
|
+
replace,
|
|
39
|
+
replaceFirst,
|
|
40
|
+
replaceLast,
|
|
41
|
+
rtrim,
|
|
42
|
+
singular,
|
|
43
|
+
slug,
|
|
44
|
+
snake,
|
|
45
|
+
start,
|
|
46
|
+
startsWith,
|
|
47
|
+
studly,
|
|
48
|
+
title,
|
|
49
|
+
transliterate,
|
|
50
|
+
ucfirst,
|
|
51
|
+
upper,
|
|
52
|
+
wordCount,
|
|
53
|
+
words,
|
|
54
|
+
useLocale,
|
|
55
|
+
withLocale
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
after,
|
|
60
|
+
afterLast,
|
|
61
|
+
ascii,
|
|
62
|
+
before,
|
|
63
|
+
beforeLast,
|
|
64
|
+
between,
|
|
65
|
+
betweenFirst,
|
|
66
|
+
defaultLocale,
|
|
67
|
+
camel,
|
|
68
|
+
contains,
|
|
69
|
+
containsAll,
|
|
70
|
+
endsWith,
|
|
71
|
+
finish,
|
|
72
|
+
kebab,
|
|
73
|
+
lcfirst,
|
|
74
|
+
length,
|
|
75
|
+
lower,
|
|
76
|
+
padBoth,
|
|
77
|
+
padLeft,
|
|
78
|
+
padRight,
|
|
79
|
+
plural,
|
|
80
|
+
pluralStudly,
|
|
81
|
+
remove,
|
|
82
|
+
replace,
|
|
83
|
+
replaceFirst,
|
|
84
|
+
replaceLast,
|
|
85
|
+
rtrim,
|
|
86
|
+
singular,
|
|
87
|
+
slug,
|
|
88
|
+
snake,
|
|
89
|
+
start,
|
|
90
|
+
startsWith,
|
|
91
|
+
studly,
|
|
92
|
+
title,
|
|
93
|
+
transliterate,
|
|
94
|
+
ucfirst,
|
|
95
|
+
upper,
|
|
96
|
+
wordCount,
|
|
97
|
+
words,
|
|
98
|
+
useLocale,
|
|
99
|
+
withLocale
|
|
100
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defaultLocale, useLocale, withLocale } from '../state.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { defaultLocale, useLocale, withLocale } from "../state.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function contains(value: string, search: string | string[]): boolean;
|
|
2
|
+
export declare function containsAll(value: string, search: string[]): boolean;
|
|
3
|
+
export declare function startsWith(value: string, search: string | string[]): boolean;
|
|
4
|
+
export declare function endsWith(value: string, search: string | string[]): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function contains(value, search) {
|
|
2
|
+
const list = Array.isArray(search) ? search : [search];
|
|
3
|
+
return list.some((entry) => entry !== "" && value.includes(entry));
|
|
4
|
+
}
|
|
5
|
+
export function containsAll(value, search) {
|
|
6
|
+
return search.every((entry) => entry !== "" && value.includes(entry));
|
|
7
|
+
}
|
|
8
|
+
export function startsWith(value, search) {
|
|
9
|
+
const list = Array.isArray(search) ? search : [search];
|
|
10
|
+
return list.some((entry) => value.startsWith(entry));
|
|
11
|
+
}
|
|
12
|
+
export function endsWith(value, search) {
|
|
13
|
+
const list = Array.isArray(search) ? search : [search];
|
|
14
|
+
return list.some((entry) => value.endsWith(entry));
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function padLeft(value, length, pad = " ") {
|
|
2
|
+
return value.padStart(length, pad);
|
|
3
|
+
}
|
|
4
|
+
export function padRight(value, length, pad = " ") {
|
|
5
|
+
return value.padEnd(length, pad);
|
|
6
|
+
}
|
|
7
|
+
export function padBoth(value, length, pad = " ") {
|
|
8
|
+
const total = Math.max(length - value.length, 0);
|
|
9
|
+
const left = Math.floor(total / 2);
|
|
10
|
+
const right = total - left;
|
|
11
|
+
return `${pad.repeat(Math.ceil(left / pad.length)).slice(0, left)}${value}${pad.repeat(Math.ceil(right / pad.length)).slice(0, right)}`;
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import pluralize from "pluralize";
|
|
2
|
+
import { studly } from "./case.js";
|
|
3
|
+
export function plural(value, count) {
|
|
4
|
+
if (typeof count === "number") {
|
|
5
|
+
return pluralize(value, count);
|
|
6
|
+
}
|
|
7
|
+
return pluralize(value);
|
|
8
|
+
}
|
|
9
|
+
export function singular(value) {
|
|
10
|
+
return pluralize.singular(value);
|
|
11
|
+
}
|
|
12
|
+
export function pluralStudly(value, count) {
|
|
13
|
+
const studlyValue = studly(value);
|
|
14
|
+
const inflected = plural(studlyValue, count);
|
|
15
|
+
return count === 1 ? studlyValue : inflected;
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function replace(value: string, search: string | RegExp, replaceWith: string): string;
|
|
2
|
+
export declare function replaceFirst(value: string, search: string | RegExp, replaceWith: string): string;
|
|
3
|
+
export declare function replaceLast(value: string, search: string, replaceWith: string): string;
|
|
4
|
+
export declare function remove(value: string, search: string | string[]): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function replace(value, search, replaceWith) {
|
|
2
|
+
return value.replace(search, replaceWith);
|
|
3
|
+
}
|
|
4
|
+
export function replaceFirst(value, search, replaceWith) {
|
|
5
|
+
if (search instanceof RegExp) {
|
|
6
|
+
const flags = search.flags.includes("g") ? search.flags.replace("g", "") : search.flags;
|
|
7
|
+
return value.replace(new RegExp(search.source, flags), replaceWith);
|
|
8
|
+
}
|
|
9
|
+
const index = value.indexOf(search);
|
|
10
|
+
if (index === -1) {
|
|
11
|
+
return value;
|
|
12
|
+
}
|
|
13
|
+
return value.slice(0, index) + replaceWith + value.slice(index + search.length);
|
|
14
|
+
}
|
|
15
|
+
export function replaceLast(value, search, replaceWith) {
|
|
16
|
+
const index = value.lastIndexOf(search);
|
|
17
|
+
if (index === -1) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return value.slice(0, index) + replaceWith + value.slice(index + search.length);
|
|
21
|
+
}
|
|
22
|
+
export function remove(value, search) {
|
|
23
|
+
const list = Array.isArray(search) ? search : [search];
|
|
24
|
+
return list.reduce((carry, item) => carry.split(item).join(""), value);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function slug(value: string, separator?: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import transliterateLib from "@sindresorhus/transliterate";
|
|
2
|
+
export function transliterate(value) {
|
|
3
|
+
return transliterateLib(value);
|
|
4
|
+
}
|
|
5
|
+
export function ascii(value) {
|
|
6
|
+
const converted = transliterate(value);
|
|
7
|
+
return Array.from(converted).filter((char) => (char.codePointAt(0) ?? 0) <= 127).join("");
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function words(value, wordsCount, end = "...") {
|
|
2
|
+
if (wordsCount <= 0) {
|
|
3
|
+
return "";
|
|
4
|
+
}
|
|
5
|
+
const parts = value.trim().split(/\s+/);
|
|
6
|
+
if (parts.length <= wordsCount) {
|
|
7
|
+
return value.trim();
|
|
8
|
+
}
|
|
9
|
+
return `${parts.slice(0, wordsCount).join(" ")}${end}`;
|
|
10
|
+
}
|
|
11
|
+
export function wordCount(value) {
|
|
12
|
+
return value.trim() ? value.trim().split(/\s+/).length : 0;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from 'lodash-es';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "lodash-es";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
definePayloadPlugin,
|
|
3
|
+
definePayloadReducer,
|
|
4
|
+
definePayloadReviver
|
|
5
|
+
} from "#imports";
|
|
6
|
+
import { shouldHydrate } from "pinia";
|
|
7
|
+
const payloadPlugin = definePayloadPlugin(() => {
|
|
8
|
+
definePayloadReducer(
|
|
9
|
+
"skipHydrate",
|
|
10
|
+
// We need to return something truthy to be treated as a match
|
|
11
|
+
(data) => !shouldHydrate(data) && 1
|
|
12
|
+
);
|
|
13
|
+
definePayloadReviver("skipHydrate", (_data) => void 0);
|
|
14
|
+
});
|
|
15
|
+
export default payloadPlugin;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createPinia, setActivePinia } from "pinia";
|
|
2
|
+
import { defineNuxtPlugin } from "#app";
|
|
3
|
+
import { toRaw } from "vue";
|
|
4
|
+
const plugin = defineNuxtPlugin({
|
|
5
|
+
name: "pinia",
|
|
6
|
+
setup(nuxtApp) {
|
|
7
|
+
const pinia = createPinia();
|
|
8
|
+
nuxtApp.vueApp.use(pinia);
|
|
9
|
+
setActivePinia(pinia);
|
|
10
|
+
if (import.meta.server) {
|
|
11
|
+
nuxtApp.payload.pinia = toRaw(pinia.state.value);
|
|
12
|
+
} else if (nuxtApp.payload && nuxtApp.payload.pinia) {
|
|
13
|
+
pinia.state.value = nuxtApp.payload.pinia;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
provide: {
|
|
17
|
+
pinia
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export default plugin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FormRules } from 'element-plus';
|
|
2
|
+
export type ValidationRule = 'required' | 'string' | 'nullable' | 'email' | `min:${number}` | `max:${number}` | `same:${string}` | 'alpha' | 'alpha_num' | 'alpha_dash' | 'alphanumeric_space' | 'alpha_space' | 'numeric' | 'integer' | 'bail' | `different:${string}` | `gt:${string}` | `gte:${string}` | `lt:${string}` | `lte:${string}` | `starts_with:${string}` | `ends_with:${string}` | `regex:${string}` | 'date' | `before:${string}` | `after:${string}` | 'array' | 'url' | 'ip' | 'hex_color' | `in:${string}`;
|
|
3
|
+
export interface ValidationOptions {
|
|
4
|
+
messages?: Record<string, string>;
|
|
5
|
+
attributes?: Record<string, string>;
|
|
6
|
+
authorize?: () => boolean;
|
|
7
|
+
prepareForValidation?: (data: Record<string, any>) => Record<string, any>;
|
|
8
|
+
trigger?: Record<string, string | string[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare const createValidationRules: (definitions: Record<string, ValidationRule[] | {
|
|
11
|
+
rules: ValidationRule[];
|
|
12
|
+
sometimes: (data: Record<string, any>) => boolean;
|
|
13
|
+
}>, formState: Record<string, any>, options?: ValidationOptions) => FormRules;
|