@ciwergrp/nuxid 1.6.2 → 1.6.3

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 (30) hide show
  1. package/dist/module.json +1 -1
  2. package/docs/.docs/built-in-modules/element-plus.md +28 -0
  3. package/docs/.docs/built-in-modules/index.md +15 -0
  4. package/docs/.docs/built-in-modules/lodash.md +14 -0
  5. package/docs/.docs/built-in-modules/nuxt-icon.md +31 -0
  6. package/docs/.docs/built-in-modules/sentry.md +13 -0
  7. package/docs/.docs/built-in-modules/vueuse.md +28 -0
  8. package/docs/.docs/composables/use-breadcrumbs.md +53 -0
  9. package/docs/.docs/composables/use-cursor-http.md +56 -0
  10. package/docs/.docs/composables/use-http.md +57 -0
  11. package/docs/.docs/composables/use-pinia.md +65 -0
  12. package/docs/.docs/composables/use-query-filters.md +88 -0
  13. package/docs/.docs/composables/use-route-query.md +39 -0
  14. package/docs/.docs/composables/use-title.md +48 -0
  15. package/docs/.docs/composables/use-version-updater.md +38 -0
  16. package/docs/.docs/configuration.md +164 -0
  17. package/docs/.docs/form-validation/create-validation-rules.md +130 -0
  18. package/docs/.docs/form-validation/quick-start.md +67 -0
  19. package/docs/.docs/form-validation/request-generator.md +38 -0
  20. package/docs/.docs/form-validation/rules.md +418 -0
  21. package/docs/.docs/forms/use-form.md +58 -0
  22. package/docs/.docs/helpers/array.md +169 -0
  23. package/docs/.docs/helpers/date.md +702 -0
  24. package/docs/.docs/helpers/index.md +34 -0
  25. package/docs/.docs/helpers/number.md +169 -0
  26. package/docs/.docs/helpers/object.md +85 -0
  27. package/docs/.docs/helpers/string.md +316 -0
  28. package/docs/.docs/index.md +17 -0
  29. package/docs/.docs/structure-directory.md +28 -0
  30. package/package.json +3 -1
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: Helpers
3
+ ---
4
+
5
+ # Helpers
6
+
7
+ Nuxus exposes helper utilities for arrays, objects, numbers, strings, and dates.
8
+
9
+ Helpers can be used in two styles:
10
+ - Factory style (default): `array().first(...)`, `string().slug(...)`, `dt().now()`.
11
+ - Prefix style: `First(...)`, `Slug(...)`, `Now(...)`.
12
+
13
+ Configure the style in `nuxt.config.ts`:
14
+
15
+ ```ts
16
+ export default defineNuxtConfig({
17
+ nuxid: {
18
+ helper: {
19
+ enabled: true,
20
+ config: {
21
+ style: 'factory',
22
+ },
23
+ },
24
+ },
25
+ })
26
+ ```
27
+
28
+ ## Categories
29
+
30
+ - [Array](/helpers/array)
31
+ - [Object](/helpers/object)
32
+ - [Number](/helpers/number)
33
+ - [String](/helpers/string)
34
+ - [Date](/helpers/date)
@@ -0,0 +1,169 @@
1
+ ---
2
+ title: Number Helpers
3
+ outline: [2, 3]
4
+ ---
5
+
6
+ # Number Helpers
7
+
8
+ Number helpers handle formatting, parsing, units, and locale-aware output.
9
+
10
+ Factory style:
11
+
12
+ ```ts
13
+ const label = number().abbreviate(1200000)
14
+ ```
15
+
16
+ Prefix style:
17
+
18
+ ```ts
19
+ const label = Abbreviate(1200000)
20
+ ```
21
+
22
+ ## Methods
23
+
24
+ ### abbreviate
25
+ Summary: Compacts large numbers using unit thresholds and `Intl.NumberFormat`.
26
+ Parameters: `number` (number), `precision` (number, optional), `maxPrecision` (number | null, optional).
27
+ - Returns: `string`.
28
+ - Simple usage: `number().abbreviate(1500)` = `'1.5K'`
29
+ - Advanced usage: `number().abbreviate(1500, 1, 2)` = `'1.5K'`
30
+
31
+ ### forHumans
32
+ Summary: Outputs verbose unit labels using the same scale logic.
33
+ Parameters: `number` (number), `precision` (number, optional), `maxPrecision` (number | null, optional).
34
+ - Returns: `string`.
35
+ - Simple usage: `number().forHumans(1200000)` = `'1.2 million'`
36
+ - Advanced usage: `number().forHumans(1200000, 2)` = `'1.20 million'`
37
+
38
+ ### clamp
39
+ Summary: Clamps a number between min and max with `Math.min/Math.max`.
40
+ Parameters: `number` (number), `min` (number), `max` (number).
41
+ - Returns: `number`.
42
+ - Simple usage: `number().clamp(120, 0, 100)` = `100`
43
+ - Advanced usage: `number().clamp(42, 0, 100)` = `42`
44
+
45
+ ### currency
46
+ Summary: Formats currency with `Intl.NumberFormat` and a currency code.
47
+ Parameters: `number` (number), `inCurrency` (string, optional), `locale` (string | null, optional), `precision` (number | null, optional).
48
+ - Returns: `string`.
49
+ - Simple usage: `number().currency(100, 'USD')` = `'$100.00'`
50
+ - Advanced usage: `number().currency(100, 'EUR', 'de-DE', 2)` = `'100,00 €'`
51
+
52
+ ### defaultCurrency
53
+ Summary: Returns the current default currency code from module state.
54
+ Parameters: none.
55
+ - Returns: `string`.
56
+ - Simple usage: `number().defaultCurrency()` = `'USD'`
57
+ - Advanced usage: `const code = number().defaultCurrency()` = `'USD'`
58
+
59
+ ### defaultLocale
60
+ Summary: Returns the current default locale from module state.
61
+ Parameters: none.
62
+ - Returns: `string`.
63
+ - Simple usage: `number().defaultLocale()` = `'en'`
64
+ - Advanced usage: `const locale = number().defaultLocale()` = `'en'`
65
+
66
+ ### fileSize
67
+ Summary: Formats bytes into human units using 1024 scaling and `format`.
68
+ Parameters: `bytes` (number), `precision` (number, optional), `maxPrecision` (number | null, optional).
69
+ - Returns: `string`.
70
+ - Simple usage: `number().fileSize(1024 * 1024)` = `'1 MB'`
71
+ - Advanced usage: `number().fileSize(1024 * 1024 * 3, 1, 2)` = `'3.0 MB'`
72
+
73
+ ### format
74
+ Summary: Locale-aware number formatting with optional precision settings.
75
+ Parameters: `number` (number), `precision` (number | null, optional), `maxPrecision` (number | null, optional), `locale` (string | null, optional).
76
+ - Returns: `string`.
77
+ - Simple usage: `number().format(1200.5)` = `'1,200.5'`
78
+ - Advanced usage: `number().format(1200.5, 2, 2, 'id-ID')` = `'1.200,50'`
79
+
80
+ ### ordinal
81
+ Summary: Adds ordinal suffix using `Intl.PluralRules`.
82
+ Parameters: `number` (number), `locale` (string | null, optional).
83
+ - Returns: `string`.
84
+ - Simple usage: `number().ordinal(3)` = `'3rd'`
85
+ - Advanced usage: `number().ordinal(21, 'en-US')` = `'21st'`
86
+
87
+ ### pairs
88
+ Summary: Creates range pairs by stepping through the range.
89
+ Parameters: `to` (number), `by` (number), `start` (number, optional), `offset` (number, optional).
90
+ - Returns: `Array<[number, number]>`.
91
+ - Simple usage: `number().pairs(10, 5)` = `[[0, 4], [5, 9]]`
92
+ - Advanced usage: `number().pairs(20, 10, 0, 1)` = `[[0, 9], [10, 19]]`
93
+
94
+ ### parse
95
+ Summary: Parses localized numeric strings after normalization.
96
+ Parameters: `value` (string), `type` ('float' | 'int', optional), `locale` (string, optional).
97
+ - Returns: `number | false`.
98
+ - Simple usage: `number().parse('1,234.5')` = `1234.5`
99
+ - Advanced usage: `number().parse('1.234,5', 'float', 'de-DE')` = `1234.5`
100
+
101
+ ### parseIntNumber
102
+ Summary: Parses localized integer strings using `parse`.
103
+ Parameters: `value` (string), `locale` (string, optional).
104
+ - Returns: `number | false`.
105
+ - Simple usage: `number().parseIntNumber('1,234')` = `1234`
106
+ - Advanced usage: `number().parseIntNumber('1.234', 'de-DE')` = `1234`
107
+
108
+ ### parseFloatNumber
109
+ Summary: Parses localized float strings using `parse`.
110
+ Parameters: `value` (string), `locale` (string, optional).
111
+ - Returns: `number | false`.
112
+ - Simple usage: `number().parseFloatNumber('1,234.5')` = `1234.5`
113
+ - Advanced usage: `number().parseFloatNumber('1.234,5', 'de-DE')` = `1234.5`
114
+
115
+ ### percentage
116
+ Summary: Formats values as percentages using `Intl.NumberFormat`.
117
+ Parameters: `number` (number), `precision` (number, optional), `maxPrecision` (number | null, optional), `locale` (string | null, optional).
118
+ - Returns: `string`.
119
+ - Simple usage: `number().percentage(25)` = `'25%'`
120
+ - Advanced usage: `number().percentage(12.5, 2, 2, 'id-ID')` = `'12,50%'`
121
+
122
+ ### spell
123
+ Summary: Spells numbers in English, with optional range thresholds.
124
+ Parameters: `number` (number), `locale` (string | null, optional), `after` (number | null, optional), `until` (number | null, optional).
125
+ - Returns: `string`.
126
+ - Simple usage: `number().spell(42)` = `'forty-two'`
127
+ - Advanced usage: `number().spell(42, 'en', 0, 1000)` = `'forty-two'`
128
+
129
+ ### spellOrdinal
130
+ Summary: Spells ordinal words based on `spell` output.
131
+ Parameters: `number` (number), `locale` (string | null, optional).
132
+ - Returns: `string`.
133
+ - Simple usage: `number().spellOrdinal(3)` = `'third'`
134
+ - Advanced usage: `number().spellOrdinal(21, 'en')` = `'twenty-first'`
135
+
136
+ ### trim
137
+ Summary: Removes trailing zeros by re-parsing the number.
138
+ Parameters: `number` (number).
139
+ - Returns: `number`.
140
+ - Simple usage: `number().trim(10.0)` = `10`
141
+ - Advanced usage: `number().trim(10.5000)` = `10.5`
142
+
143
+ ### useLocale
144
+ Summary: Sets the default locale in module state.
145
+ Parameters: `locale` (string).
146
+ - Returns: `void`.
147
+ - Simple usage: `number().useLocale('id-ID')` = `undefined`
148
+ - Advanced usage: `number().useLocale(locale.value)` = `undefined`
149
+
150
+ ### withLocale
151
+ Summary: Temporarily sets locale around a callback and restores afterward.
152
+ Parameters: `locale` (string), `callback` (`() => T | Promise<T>`).
153
+ - Returns: `T | Promise<T>`.
154
+ - Simple usage: `number().withLocale('id-ID', () => number().format(1000))` = `'1.000'`
155
+ - Advanced usage: `await number().withLocale('id-ID', async () => number().currency(100))` = `'$100.00'`
156
+
157
+ ### useCurrency
158
+ Summary: Sets the default currency in module state.
159
+ Parameters: `currency` (string).
160
+ - Returns: `void`.
161
+ - Simple usage: `number().useCurrency('EUR')` = `undefined`
162
+ - Advanced usage: `number().useCurrency(userCurrency)` = `undefined`
163
+
164
+ ### withCurrency
165
+ Summary: Temporarily sets currency around a callback and restores afterward.
166
+ Parameters: `currency` (string), `callback` (`() => T | Promise<T>`).
167
+ - Returns: `T | Promise<T>`.
168
+ - Simple usage: `number().withCurrency('EUR', () => number().currency(100))` = `'€100.00'`
169
+ - Advanced usage: `await number().withCurrency('EUR', async () => number().currency(100))` = `'€100.00'`
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: Object Helpers
3
+ outline: [2, 3]
4
+ ---
5
+
6
+ # Object Helpers
7
+
8
+ Object helpers provide safe access and mutation utilities with dot-path support.
9
+
10
+ Factory style:
11
+
12
+ ```ts
13
+ const value = object().get({ a: { b: 1 } }, 'a.b')
14
+ ```
15
+
16
+ Prefix style:
17
+
18
+ ```ts
19
+ const value = Get({ a: { b: 1 } }, 'a.b')
20
+ ```
21
+
22
+ ## Methods
23
+
24
+ ### add
25
+ Summary: Sets a value only if the path is missing or null by combining `get` and `set`.
26
+ Parameters: `target` (Record<string, any>), `path` (Path), `value` (any).
27
+ - Returns: `T`.
28
+ - Simple usage: `object().add(profile, 'name', 'Guest')` = `{ name: 'Guest' }`
29
+ - Advanced usage: `object().add({ features: [{}] }, ['features', 0, 'enabled'], true)` = `{ features: [{ enabled: true }] }`
30
+
31
+ ### dot
32
+ Summary: Flattens nested objects into dot-key paths via recursive traversal.
33
+ Parameters: `target` (Record<string, any>), `prefix` (string, optional).
34
+ - Returns: `Record<string, any>`.
35
+ - Simple usage: `object().dot({ a: { b: 1 } })` = `{ 'a.b': 1 }`
36
+ - Advanced usage: `object().dot({ a: { b: { c: 2 } } }, 'root')` = `{ 'root.a.b.c': 2 }`
37
+
38
+ ### except
39
+ Summary: Omits top-level keys by copying entries that are not excluded.
40
+ Parameters: `target` (Record<string, any>), `keys` (Path | Path[]).
41
+ - Returns: `Record<string, any>`.
42
+ - Simple usage: `object().except({ a: 1, b: 2 }, ['b'])` = `{ a: 1 }`
43
+ - Advanced usage: `object().except({ id: 1, name: 'User', token: 'x' }, ['token'])` = `{ id: 1, name: 'User' }`
44
+
45
+ ### forget
46
+ Summary: Removes a path from an object or array by traversing and deleting.
47
+ Parameters: `target` (any), `paths` (Path | Path[]).
48
+ - Returns: `any`.
49
+ - Simple usage: `object().forget({ a: { b: 1 } }, 'a.b')` = `{ a: {} }`
50
+ - Advanced usage: `object().forget([{ id: 1 }, { id: 2 }], [0, 'id'])` = `[{ id: 2 }]`
51
+
52
+ ### get
53
+ Summary: Reads a value by dot path using `toPathArray` traversal.
54
+ Parameters: `value` (any), `path` (Path), `defaultValue` (T, optional).
55
+ - Returns: `T | undefined`.
56
+ - Simple usage: `object().get({ a: { b: 1 } }, 'a.b')` = `1`
57
+ - Advanced usage: `object().get({}, 'missing.key', 'fallback')` = `'fallback'`
58
+
59
+ ### has
60
+ Summary: Checks if all provided paths exist using `get`.
61
+ Parameters: `target` (any), `paths` (Path | Path[]).
62
+ - Returns: `boolean`.
63
+ - Simple usage: `object().has({ a: 1 }, 'a')` = `true`
64
+ - Advanced usage: `object().has({ a: { b: 1 }, c: { d: 2 } }, ['a.b', 'c.d'])` = `true`
65
+
66
+ ### only
67
+ Summary: Picks specific keys/paths by reading values and building a new object.
68
+ Parameters: `target` (Record<string, any>), `keys` (Path | Path[]).
69
+ - Returns: `Record<string, any>`.
70
+ - Simple usage: `object().only({ a: 1, b: 2 }, ['a'])` = `{ a: 1 }`
71
+ - Advanced usage: `object().only({ user: { id: 1, email: 'a@b.com' } }, ['user.id', 'user.email'])` = `{ 'user.id': 1, 'user.email': 'a@b.com' }`
72
+
73
+ ### set
74
+ Summary: Sets a value by dot path and creates missing objects/arrays.
75
+ Parameters: `target` (Record<string, any>), `path` (Path), `value` (any).
76
+ - Returns: `T`.
77
+ - Simple usage: `object().set({}, 'a.b', 1)` = `{ a: { b: 1 } }`
78
+ - Advanced usage: `object().set({}, ['items', 0, 'name'], 'Item')` = `{ items: [{ name: 'Item' }] }`
79
+
80
+ ### undot
81
+ Summary: Converts dot-key objects into nested objects using `set`.
82
+ Parameters: `target` (Record<string, any>).
83
+ - Returns: `Record<string, any>`.
84
+ - Simple usage: `object().undot({ 'a.b': 1 })` = `{ a: { b: 1 } }`
85
+ - Advanced usage: `object().undot({ 'a.0.name': 'Item' })` = `{ a: [{ name: 'Item' }] }`
@@ -0,0 +1,316 @@
1
+ ---
2
+ title: String Helpers
3
+ outline: [2, 3]
4
+ ---
5
+
6
+ # String Helpers
7
+
8
+ String helpers cover casing, trimming, matching, and slug formatting.
9
+
10
+ Factory style:
11
+
12
+ ```ts
13
+ const slug = string().slug('Hello World')
14
+ ```
15
+
16
+ Prefix style:
17
+
18
+ ```ts
19
+ const slug = Slug('Hello World')
20
+ ```
21
+
22
+ ## Methods
23
+
24
+ ### after
25
+ Summary: Returns substring after the first occurrence using `indexOf` and `slice`.
26
+ Parameters: `value` (string), `search` (string).
27
+ - Returns: `string`.
28
+ - Simple usage: `string().after('foo-bar', '-')` = `'bar'`
29
+ - Advanced usage: `string().after('foo-bar-baz', '-')` = `'bar-baz'`
30
+
31
+ ### afterLast
32
+ Summary: Returns substring after the last occurrence using `lastIndexOf`.
33
+ Parameters: `value` (string), `search` (string).
34
+ - Returns: `string`.
35
+ - Simple usage: `string().afterLast('foo-bar', '-')` = `'bar'`
36
+ - Advanced usage: `string().afterLast('foo-bar-baz', '-')` = `'baz'`
37
+
38
+ ### ascii
39
+ Summary: Transliterate and strip non-ASCII characters.
40
+ Parameters: `value` (string).
41
+ - Returns: `string`.
42
+ - Simple usage: `string().ascii('Café')` = `'Cafe'`
43
+ - Advanced usage: `string().ascii('你好 Cafe')` = `' Cafe'`
44
+
45
+ ### before
46
+ Summary: Returns substring before the first occurrence.
47
+ Parameters: `value` (string), `search` (string).
48
+ - Returns: `string`.
49
+ - Simple usage: `string().before('foo-bar', '-')` = `'foo'`
50
+ - Advanced usage: `string().before('foo-bar-baz', '-')` = `'foo'`
51
+
52
+ ### beforeLast
53
+ Summary: Returns substring before the last occurrence.
54
+ Parameters: `value` (string), `search` (string).
55
+ - Returns: `string`.
56
+ - Simple usage: `string().beforeLast('foo-bar', '-')` = `'foo'`
57
+ - Advanced usage: `string().beforeLast('foo-bar-baz', '-')` = `'foo-bar'`
58
+
59
+ ### between
60
+ Summary: Returns substring between markers using `after` then `before`.
61
+ Parameters: `value` (string), `from` (string), `to` (string).
62
+ - Returns: `string`.
63
+ - Simple usage: `string().between('foo[bar]baz', '[', ']')` = `'bar'`
64
+ - Advanced usage: `string().between('a{b}c{d}', '{', '}')` = `'b'`
65
+
66
+ ### betweenFirst
67
+ Summary: Returns substring between the first pair of markers.
68
+ Parameters: `value` (string), `from` (string), `to` (string).
69
+ - Returns: `string`.
70
+ - Simple usage: `string().betweenFirst('foo[bar]baz', '[', ']')` = `'bar'`
71
+ - Advanced usage: `string().betweenFirst('a{b}c{d}', '{', '}')` = `'b'`
72
+
73
+ ### camel
74
+ Summary: Converts to camelCase by splitting words and capitalizing.
75
+ Parameters: `value` (string).
76
+ - Returns: `string`.
77
+ - Simple usage: `string().camel('hello world')` = `'helloWorld'`
78
+ - Advanced usage: `string().camel('hello-world_test')` = `'helloWorldTest'`
79
+
80
+ ### contains
81
+ Summary: Checks if any substring exists using `includes`.
82
+ Parameters: `value` (string), `search` (string | string[]).
83
+ - Returns: `boolean`.
84
+ - Simple usage: `string().contains('hello', 'ell')` = `true`
85
+ - Advanced usage: `string().contains('hello', ['x', 'ell'])` = `true`
86
+
87
+ ### containsAll
88
+ Summary: Checks if all substrings exist using `includes`.
89
+ Parameters: `value` (string), `search` (string[]).
90
+ - Returns: `boolean`.
91
+ - Simple usage: `string().containsAll('hello', ['he', 'lo'])` = `true`
92
+ - Advanced usage: `string().containsAll('hello world', ['hello', 'world'])` = `true`
93
+
94
+ ### endsWith
95
+ Summary: Checks suffix match with one or more candidates.
96
+ Parameters: `value` (string), `search` (string | string[]).
97
+ - Returns: `boolean`.
98
+ - Simple usage: `string().endsWith('file.ts', '.ts')` = `true`
99
+ - Advanced usage: `string().endsWith('file.ts', ['.js', '.ts'])` = `true`
100
+
101
+ ### finish
102
+ Summary: Ensures the string ends with a suffix.
103
+ Parameters: `value` (string), `suffix` (string).
104
+ - Returns: `string`.
105
+ - Simple usage: `string().finish('path', '/')` = `'path/'`
106
+ - Advanced usage: `string().finish('path/', '/')` = `'path/'`
107
+
108
+ ### defaultLocale
109
+ Summary: Returns the current default locale for string helpers.
110
+ Parameters: none.
111
+ - Returns: `string`.
112
+ - Simple usage: `string().defaultLocale()` = `'en'`
113
+ - Advanced usage: `const locale = string().defaultLocale()` = `'en'`
114
+
115
+ ### kebab
116
+ Summary: Converts to kebab-case by splitting words and joining with `-`.
117
+ Parameters: `value` (string).
118
+ - Returns: `string`.
119
+ - Simple usage: `string().kebab('HelloWorld')` = `'hello-world'`
120
+ - Advanced usage: `string().kebab('hello_world test')` = `'hello-world-test'`
121
+
122
+ ### lcfirst
123
+ Summary: Lowercases the first character.
124
+ Parameters: `value` (string).
125
+ - Returns: `string`.
126
+ - Simple usage: `string().lcfirst('Hello')` = `'hello'`
127
+ - Advanced usage: `string().lcfirst('URLValue')` = `'uRLValue'`
128
+
129
+ ### length
130
+ Summary: Returns Unicode-aware character length.
131
+ Parameters: `value` (string).
132
+ - Returns: `number`.
133
+ - Simple usage: `string().length('hello')` = `5`
134
+ - Advanced usage: `string().length('👋🌍')` = `2`
135
+
136
+ ### lower
137
+ Summary: Lowercases the string with `toLowerCase`.
138
+ Parameters: `value` (string).
139
+ - Returns: `string`.
140
+ - Simple usage: `string().lower('Hello')` = `'hello'`
141
+ - Advanced usage: `string().lower('HELLO WORLD')` = `'hello world'`
142
+
143
+ ### ltrim
144
+ Summary: Trims left side using `trimStart` or a mask regex.
145
+ Parameters: `value` (string), `mask` (string, optional).
146
+ - Returns: `string`.
147
+ - Simple usage: `string().ltrim(' hello ')` = `'hello'`
148
+ - Advanced usage: `string().ltrim('--hello', '-')` = `'hello'`
149
+
150
+ ### padBoth
151
+ Summary: Pads both sides to a target length.
152
+ Parameters: `value` (string), `length` (number), `pad` (string, optional).
153
+ - Returns: `string`.
154
+ - Simple usage: `string().padBoth('a', 3, '_')` = `_a_`
155
+ - Advanced usage: `string().padBoth('hello', 10, '.')` = `'..hello...'`
156
+
157
+ ### padLeft
158
+ Summary: Pads on the left using `padStart`.
159
+ Parameters: `value` (string), `length` (number), `pad` (string, optional).
160
+ - Returns: `string`.
161
+ - Simple usage: `string().padLeft('1', 3, '0')` = `'001'`
162
+ - Advanced usage: `string().padLeft('abc', 5, '-')` = `'--abc'`
163
+
164
+ ### padRight
165
+ Summary: Pads on the right using `padEnd`.
166
+ Parameters: `value` (string), `length` (number), `pad` (string, optional).
167
+ - Returns: `string`.
168
+ - Simple usage: `string().padRight('1', 3, '0')` = `'100'`
169
+ - Advanced usage: `string().padRight('abc', 5, '-')` = `'abc--'`
170
+
171
+ ### plural
172
+ Summary: Pluralizes using the `pluralize` library.
173
+ Parameters: `value` (string), `count` (number, optional).
174
+ - Returns: `string`.
175
+ - Simple usage: `string().plural('car')` = `'cars'`
176
+ - Advanced usage: `string().plural('car', 2)` = `'cars'`
177
+
178
+ ### pluralStudly
179
+ Summary: Pluralizes a StudlyCase version of the input.
180
+ Parameters: `value` (string), `count` (number, optional).
181
+ - Returns: `string`.
182
+ - Simple usage: `string().pluralStudly('user')` = `'Users'`
183
+ - Advanced usage: `string().pluralStudly('user_profile', 2)` = `'UserProfiles'`
184
+
185
+ ### remove
186
+ Summary: Removes substrings by split/join.
187
+ Parameters: `value` (string), `search` (string | string[]).
188
+ - Returns: `string`.
189
+ - Simple usage: `string().remove('foo-bar', '-')` = `'foobar'`
190
+ - Advanced usage: `string().remove('foo-bar-baz', ['-', 'baz'])` = `'foo-bar-'`
191
+
192
+ ### replace
193
+ Summary: Replaces matches using `String.prototype.replace`.
194
+ Parameters: `value` (string), `search` (string | RegExp), `replaceWith` (string).
195
+ - Returns: `string`.
196
+ - Simple usage: `string().replace('foo', 'o', '0')` = `'f0o'`
197
+ - Advanced usage: `string().replace('foo', /o/g, '0')` = `'f00'`
198
+
199
+ ### replaceFirst
200
+ Summary: Replaces the first occurrence only.
201
+ Parameters: `value` (string), `search` (string | RegExp), `replaceWith` (string).
202
+ - Returns: `string`.
203
+ - Simple usage: `string().replaceFirst('foo', 'o', '0')` = `'f0o'`
204
+ - Advanced usage: `string().replaceFirst('foo', /o/g, '0')` = `'f0o'`
205
+
206
+ ### replaceLast
207
+ Summary: Replaces the last occurrence.
208
+ Parameters: `value` (string), `search` (string), `replaceWith` (string).
209
+ - Returns: `string`.
210
+ - Simple usage: `string().replaceLast('foo', 'o', '0')` = `'fo0'`
211
+ - Advanced usage: `string().replaceLast('foo-bar-foo', 'foo', '0')` = `'foo-bar-0'`
212
+
213
+ ### rtrim
214
+ Summary: Trims right side using `trimEnd` or a mask regex.
215
+ Parameters: `value` (string), `mask` (string, optional).
216
+ - Returns: `string`.
217
+ - Simple usage: `string().rtrim(' hello ')` = `'hello'`
218
+ - Advanced usage: `string().rtrim('hello---', '-')` = `'hello'`
219
+
220
+ ### singular
221
+ Summary: Singularizes using the `pluralize` library.
222
+ Parameters: `value` (string).
223
+ - Returns: `string`.
224
+ - Simple usage: `string().singular('cars')` = `'car'`
225
+ - Advanced usage: `string().singular('people')` = `'person'`
226
+
227
+ ### slug
228
+ Summary: Slugifies with `@sindresorhus/slugify` and locale support.
229
+ Parameters: `value` (string), `separator` (string, optional).
230
+ - Returns: `string`.
231
+ - Simple usage: `string().slug('Hello World')` = `'hello-world'`
232
+ - Advanced usage: `string().slug('Hello World', '_')` = `'hello_world'`
233
+
234
+ ### snake
235
+ Summary: Converts to snake_case by splitting words and joining with `_`.
236
+ Parameters: `value` (string).
237
+ - Returns: `string`.
238
+ - Simple usage: `string().snake('HelloWorld')` = `'hello_world'`
239
+ - Advanced usage: `string().snake('hello-world test')` = `'hello_world_test'`
240
+
241
+ ### start
242
+ Summary: Ensures the string starts with a prefix.
243
+ Parameters: `value` (string), `prefix` (string).
244
+ - Returns: `string`.
245
+ - Simple usage: `string().start('path', '/')` = `'/path'`
246
+ - Advanced usage: `string().start('/path', '/')` = `'/path'`
247
+
248
+ ### startsWith
249
+ Summary: Checks prefix match with one or more candidates.
250
+ Parameters: `value` (string), `search` (string | string[]).
251
+ - Returns: `boolean`.
252
+ - Simple usage: `string().startsWith('file.ts', 'file')` = `true`
253
+ - Advanced usage: `string().startsWith('file.ts', ['file', 'app'])` = `true`
254
+
255
+ ### studly
256
+ Summary: Converts to StudlyCase by word splitting and capitalizing.
257
+ Parameters: `value` (string).
258
+ - Returns: `string`.
259
+ - Simple usage: `string().studly('hello world')` = `'HelloWorld'`
260
+ - Advanced usage: `string().studly('hello-world_test')` = `'HelloWorldTest'`
261
+
262
+ ### title
263
+ Summary: Converts to Title Case by word splitting and capitalizing.
264
+ Parameters: `value` (string).
265
+ - Returns: `string`.
266
+ - Simple usage: `string().title('hello world')` = `'Hello World'`
267
+ - Advanced usage: `string().title('hello-world_test')` = `'Hello World Test'`
268
+
269
+ ### transliterate
270
+ Summary: Converts to Latin characters using transliteration.
271
+ Parameters: `value` (string).
272
+ - Returns: `string`.
273
+ - Simple usage: `string().transliterate('你好')` = `'Ni Hao'`
274
+ - Advanced usage: `string().transliterate('Café')` = `'Cafe'`
275
+
276
+ ### ucfirst
277
+ Summary: Uppercases the first character.
278
+ Parameters: `value` (string).
279
+ - Returns: `string`.
280
+ - Simple usage: `string().ucfirst('hello')` = `'Hello'`
281
+ - Advanced usage: `string().ucfirst('hELLO')` = `'HELLO'`
282
+
283
+ ### upper
284
+ Summary: Uppercases the string with `toUpperCase`.
285
+ Parameters: `value` (string).
286
+ - Returns: `string`.
287
+ - Simple usage: `string().upper('Hello')` = `'HELLO'`
288
+ - Advanced usage: `string().upper('hello world')` = `'HELLO WORLD'`
289
+
290
+ ### wordCount
291
+ Summary: Counts words by trimming and splitting on whitespace.
292
+ Parameters: `value` (string).
293
+ - Returns: `number`.
294
+ - Simple usage: `string().wordCount('hello world')` = `2`
295
+ - Advanced usage: `string().wordCount(' hello world ')` = `2`
296
+
297
+ ### words
298
+ Summary: Limits to a word count and appends a suffix.
299
+ Parameters: `value` (string), `wordsCount` (number), `end` (string, optional).
300
+ - Returns: `string`.
301
+ - Simple usage: `string().words('hello world', 1)` = `'hello...'`
302
+ - Advanced usage: `string().words('hello world', 1, ' (more)')` = `'hello (more)'`
303
+
304
+ ### useLocale
305
+ Summary: Sets the default locale for string helpers.
306
+ Parameters: `locale` (string).
307
+ - Returns: `void`.
308
+ - Simple usage: `string().useLocale('id-ID')` = `undefined`
309
+ - Advanced usage: `string().useLocale(locale.value)` = `undefined`
310
+
311
+ ### withLocale
312
+ Summary: Temporarily sets locale around a callback and restores afterward.
313
+ Parameters: `locale` (string), `callback` (`() => T | Promise<T>`).
314
+ - Returns: `T | Promise<T>`.
315
+ - Simple usage: `string().withLocale('id-ID', () => string().slug('Halo Dunia'))` = `'halo-dunia'`
316
+ - Advanced usage: `await string().withLocale('id-ID', async () => string().slug('Halo Dunia'))` = `'halo-dunia'`
@@ -0,0 +1,17 @@
1
+ # Nuxid Docs
2
+
3
+ Nuxid is a list of type-safe helpers specifically made for Nuxt version >= 4 for developers who need to quickly hop into the business logic development, skipping all the unnecessary times needed to develop helpers like validations, transformers, or composables.
4
+
5
+ - [Quick Start](/form-validation/quick-start)
6
+ - [createValidationRules](/form-validation/create-validation-rules)
7
+ - [Request Generator](/form-validation/request-generator)
8
+ - [Available Rules](/form-validation/rules)
9
+ - [Configuration](/configuration)
10
+ - [Structure Directory](/structure-directory)
11
+ - [Helpers](/helpers/)
12
+ - [Data Fetching](/composables/use-http)
13
+ - [useTitle](/composables/use-title)
14
+ - [useBreadcrumbs](/composables/use-breadcrumbs)
15
+ - [useRouteQuery](/composables/use-route-query)
16
+ - [useQueryFilters](/composables/use-query-filters)
17
+ - [useVersionUpdater](/composables/use-version-updater)
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: Structure Directory
3
+ ---
4
+
5
+ # Structure Directory
6
+
7
+ This module is optimized for a Nuxt + pnpm monorepo where each product/domain is a separate Nuxt app under `apps/`, while shared functionality lives in `layers/` as Nuxt layers. The repository root is the single workspace that owns dependency versions, linting, TypeScript config, and other tooling, so all apps and layers stay in sync. By keeping apps thin and moving cross-cutting concerns into layers (UI, composables, config, and utilities), you avoid duplication while keeping ownership clear and scaling across multiple teams or products.
8
+
9
+ Recommended top-level structure (layout overview):
10
+
11
+ ```
12
+ root/
13
+ apps/ # per-domain Nuxt apps
14
+ layers/ # shared Nuxt layers (ui, config, composables, etc.)
15
+ package.json # workspace dependencies
16
+ pnpm-workspace.yaml # workspace map
17
+ eslint.config.mjs # shared lint config
18
+ tsconfig.json # shared TS config
19
+ docker-compose.yml # local infra (optional)
20
+ README.md # repo-level docs
21
+ ```
22
+
23
+ Inside `apps/`, each app represents a specific domain or product and owns its `nuxt.config.ts`, routes, and app-only modules. Inside `layers/`, each folder is a Nuxt layer that can expose components, composables, auto-imports, or module defaults to any app that extends it. This keeps shared functionality centralized while still allowing each app to compose only the layers it needs.
24
+
25
+ Example paths:
26
+
27
+ - `apps/admin/nuxt.config.ts`
28
+ - `layers/ui/nuxt.config.ts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ciwergrp/nuxid",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "All-in-one essential modules for Nuxt",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,6 +17,7 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "type": "module",
20
+ "types": "./dist/types.d.mts",
20
21
  "exports": {
21
22
  ".": {
22
23
  "types": "./dist/types.d.mts",
@@ -38,6 +39,7 @@
38
39
  "dist",
39
40
  "bin",
40
41
  "console",
42
+ "docs/.docs",
41
43
  "package.json",
42
44
  "README.md"
43
45
  ],