@ciwergrp/nuxid 1.5.14 → 1.6.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.
- package/dist/module.d.mts +12 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +30 -1
- package/dist/runtime/page/breadcrumb.d.ts +16 -0
- package/dist/runtime/page/breadcrumb.js +21 -0
- package/dist/runtime/page/index.d.ts +2 -0
- package/dist/runtime/page/index.js +2 -0
- package/dist/runtime/page/title.d.ts +5 -0
- package/dist/runtime/page/title.js +19 -0
- package/dist/runtime/route/index.d.ts +2 -0
- package/dist/runtime/route/index.js +2 -0
- package/dist/runtime/route/query-filters.d.ts +29 -0
- package/dist/runtime/route/query-filters.js +61 -0
- package/dist/runtime/route/route-query.d.ts +3 -0
- package/dist/runtime/route/route-query.js +17 -0
- package/dist/runtime/version-updater/index.d.ts +3 -0
- package/dist/runtime/version-updater/index.js +12 -0
- package/dist/types.d.mts +4 -0
- package/package.json +20 -17
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
export * from '../dist/runtime/form.js';
|
|
3
3
|
export { default as useHttp } from '../dist/runtime/form.js';
|
|
4
|
+
export { useBreadcrumbs, useTitle } from '../dist/runtime/page/index.js';
|
|
5
|
+
export { ActiveQueryFilter, QueryFilterDefinition, useQueryFilters, useRouteQuery } from '../dist/runtime/route/index.js';
|
|
4
6
|
export * from '../dist/runtime/validator.js';
|
|
5
7
|
export * from '../dist/runtime/helper/index.js';
|
|
6
8
|
export * from '../dist/runtime/fetcher/index.js';
|
|
@@ -211,6 +213,15 @@ interface FetcherOptions {
|
|
|
211
213
|
}
|
|
212
214
|
type FetcherFeatureInput = boolean | Partial<FetcherOptions> | undefined;
|
|
213
215
|
|
|
216
|
+
interface VersionUpdaterOptions {
|
|
217
|
+
/**
|
|
218
|
+
* Enable version updater composable auto-import
|
|
219
|
+
* @default true
|
|
220
|
+
*/
|
|
221
|
+
enabled: boolean;
|
|
222
|
+
}
|
|
223
|
+
type VersionUpdaterFeatureInput = boolean | Partial<VersionUpdaterOptions> | undefined;
|
|
224
|
+
|
|
214
225
|
interface ModuleOptions {
|
|
215
226
|
lodash?: LodashFeatureInput;
|
|
216
227
|
validator?: ValidatorFeatureInput;
|
|
@@ -221,6 +232,7 @@ interface ModuleOptions {
|
|
|
221
232
|
pinia?: PiniaFeatureInput;
|
|
222
233
|
vueuse?: VueUseFeatureInput;
|
|
223
234
|
fetcher?: FetcherFeatureInput;
|
|
235
|
+
versionUpdater?: VersionUpdaterFeatureInput;
|
|
224
236
|
}
|
|
225
237
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
226
238
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,6 +3,8 @@ import * as lodash from 'lodash-es';
|
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
export * from '../dist/runtime/form.js';
|
|
5
5
|
export { default as useHttp } from '../dist/runtime/form.js';
|
|
6
|
+
export { useBreadcrumbs, useTitle } from '../dist/runtime/page/index.js';
|
|
7
|
+
export { ActiveQueryFilter, QueryFilterDefinition, useQueryFilters, useRouteQuery } from '../dist/runtime/route/index.js';
|
|
6
8
|
export * from '../dist/runtime/validator.js';
|
|
7
9
|
export * from '../dist/runtime/helper/index.js';
|
|
8
10
|
export * from '../dist/runtime/fetcher/index.js';
|
|
@@ -577,6 +579,27 @@ function registerFetcherFeature(options, { from }) {
|
|
|
577
579
|
addImports({ name: "CursorFetchOptions", as: "CursorFetchOptions", from, type: true });
|
|
578
580
|
}
|
|
579
581
|
|
|
582
|
+
const versionUpdaterDefaults = {
|
|
583
|
+
enabled: true
|
|
584
|
+
};
|
|
585
|
+
function resolveVersionUpdaterOptions(input) {
|
|
586
|
+
if (input === false) {
|
|
587
|
+
return { ...versionUpdaterDefaults, enabled: false };
|
|
588
|
+
}
|
|
589
|
+
const overrides = typeof input === "boolean" || input === void 0 ? {} : input;
|
|
590
|
+
return {
|
|
591
|
+
...versionUpdaterDefaults,
|
|
592
|
+
...overrides,
|
|
593
|
+
enabled: overrides?.enabled ?? true
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function registerVersionUpdaterFeature(options, { from }) {
|
|
597
|
+
if (!options.enabled) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
addImports({ name: "useVersionUpdater", as: "useVersionUpdater", from });
|
|
601
|
+
}
|
|
602
|
+
|
|
580
603
|
const module$1 = defineNuxtModule({
|
|
581
604
|
meta: {
|
|
582
605
|
name: "@ciwergrp/nuxid",
|
|
@@ -585,7 +608,7 @@ const module$1 = defineNuxtModule({
|
|
|
585
608
|
moduleDependencies() {
|
|
586
609
|
const dependencies = {
|
|
587
610
|
"@sentry/nuxt": {
|
|
588
|
-
version: "10
|
|
611
|
+
version: "^10"
|
|
589
612
|
}
|
|
590
613
|
};
|
|
591
614
|
return dependencies;
|
|
@@ -601,6 +624,7 @@ const module$1 = defineNuxtModule({
|
|
|
601
624
|
const piniaOptions = resolvePiniaOptions(options.pinia);
|
|
602
625
|
const vueuseOptions = resolveVueUseOptions(options.vueuse);
|
|
603
626
|
const fetcherOptions = resolveFetcherOptions(options.fetcher);
|
|
627
|
+
const versionUpdaterOptions = resolveVersionUpdaterOptions(options.versionUpdater);
|
|
604
628
|
if (iconOptions.enabled) {
|
|
605
629
|
await installModule("@nuxt/icon", iconOptions.config);
|
|
606
630
|
}
|
|
@@ -630,6 +654,11 @@ const module$1 = defineNuxtModule({
|
|
|
630
654
|
from: resolver.resolve("./runtime/fetcher")
|
|
631
655
|
});
|
|
632
656
|
}
|
|
657
|
+
if (versionUpdaterOptions.enabled) {
|
|
658
|
+
registerVersionUpdaterFeature(versionUpdaterOptions, {
|
|
659
|
+
from: resolver.resolve("./runtime/version-updater")
|
|
660
|
+
});
|
|
661
|
+
}
|
|
633
662
|
if (piniaOptions.enabled) {
|
|
634
663
|
const piniaRuntimeDir = fileURLToPath(new URL("./runtime/pinia", import.meta.url));
|
|
635
664
|
registerPiniaFeature(piniaOptions, nuxt, {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface BreadcrumbItem {
|
|
2
|
+
name: string;
|
|
3
|
+
path: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function useBreadcrumbs(): {
|
|
6
|
+
breadcrumbs: Readonly<import("vue").Ref<readonly {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly path: string;
|
|
9
|
+
}[], readonly {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly path: string;
|
|
12
|
+
}[]>>;
|
|
13
|
+
activeBreadcrumb: import("vue").ComputedRef<BreadcrumbItem | null>;
|
|
14
|
+
setBreadcrumbs: (value: BreadcrumbItem[]) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { computed, readonly, ref } from "vue";
|
|
2
|
+
const items = ref([]);
|
|
3
|
+
export function useBreadcrumbs() {
|
|
4
|
+
const activeBreadcrumb = computed(() => {
|
|
5
|
+
if (!items.value.length) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
return items.value[items.value.length - 1] ?? null;
|
|
9
|
+
});
|
|
10
|
+
function setBreadcrumbs(value) {
|
|
11
|
+
items.value = value.map((item) => ({
|
|
12
|
+
name: item.name,
|
|
13
|
+
path: item.path
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
breadcrumbs: readonly(items),
|
|
18
|
+
activeBreadcrumb,
|
|
19
|
+
setBreadcrumbs
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useHead } from "@unhead/vue";
|
|
2
|
+
import { ref, readonly } from "vue";
|
|
3
|
+
const title = ref("");
|
|
4
|
+
export function useTitle() {
|
|
5
|
+
const getTitle = () => {
|
|
6
|
+
return title.value;
|
|
7
|
+
};
|
|
8
|
+
const setTitle = (value) => {
|
|
9
|
+
title.value = value;
|
|
10
|
+
useHead({
|
|
11
|
+
title: title.value
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
title: readonly(title),
|
|
16
|
+
getTitle,
|
|
17
|
+
setTitle
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { LocationQuery, LocationQueryValue } from 'vue-router';
|
|
2
|
+
export interface ActiveQueryFilter {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
displayValue: string;
|
|
7
|
+
}
|
|
8
|
+
export interface QueryFilterDefinition {
|
|
9
|
+
key: string;
|
|
10
|
+
label: string;
|
|
11
|
+
clearQueryKeys: string[];
|
|
12
|
+
resolve: (query: LocationQuery) => {
|
|
13
|
+
value: string;
|
|
14
|
+
displayValue: string;
|
|
15
|
+
} | null;
|
|
16
|
+
}
|
|
17
|
+
interface FilterChangePayload {
|
|
18
|
+
key: string;
|
|
19
|
+
active: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare function normalizeQueryValue(value: LocationQueryValue | LocationQueryValue[] | undefined): LocationQueryValue | undefined;
|
|
22
|
+
export declare function useQueryFilters(definitions: QueryFilterDefinition[]): {
|
|
23
|
+
activeFilters: import("vue").ComputedRef<ActiveQueryFilter[]>;
|
|
24
|
+
applyFilters: (query: Record<string, any>, callback?: () => void | Promise<void>) => Promise<void>;
|
|
25
|
+
resetFilters: (queryKeys: string[], callback?: () => void | Promise<void>) => Promise<void>;
|
|
26
|
+
handleFilterChange: (payload: FilterChangePayload, callback?: () => void | Promise<void>) => Promise<void>;
|
|
27
|
+
normalizeQueryValue: typeof normalizeQueryValue;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useRoute } from "vue-router";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useRouteQuery } from "./route-query.js";
|
|
4
|
+
function normalizeQueryValue(value) {
|
|
5
|
+
if (Array.isArray(value)) {
|
|
6
|
+
return value[0];
|
|
7
|
+
}
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
export function useQueryFilters(definitions) {
|
|
11
|
+
const route = useRoute();
|
|
12
|
+
const { URLRouteQuery } = useRouteQuery();
|
|
13
|
+
const activeFilters = computed(() => {
|
|
14
|
+
return definitions.map((definition) => {
|
|
15
|
+
const resolved = definition.resolve(route.query);
|
|
16
|
+
if (!resolved) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
key: definition.key,
|
|
21
|
+
label: definition.label,
|
|
22
|
+
value: resolved.value,
|
|
23
|
+
displayValue: resolved.displayValue
|
|
24
|
+
};
|
|
25
|
+
}).filter((filter) => filter !== null);
|
|
26
|
+
});
|
|
27
|
+
async function applyFilters(query, callback) {
|
|
28
|
+
await URLRouteQuery(query);
|
|
29
|
+
await callback?.();
|
|
30
|
+
}
|
|
31
|
+
async function resetFilters(queryKeys, callback) {
|
|
32
|
+
const query = {};
|
|
33
|
+
for (const key of queryKeys) {
|
|
34
|
+
query[key] = void 0;
|
|
35
|
+
}
|
|
36
|
+
await URLRouteQuery(query);
|
|
37
|
+
await callback?.();
|
|
38
|
+
}
|
|
39
|
+
async function handleFilterChange(payload, callback) {
|
|
40
|
+
if (payload.active) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const definition = definitions.find((filter) => filter.key === payload.key);
|
|
44
|
+
if (!definition) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const query = {};
|
|
48
|
+
for (const key of definition.clearQueryKeys) {
|
|
49
|
+
query[key] = void 0;
|
|
50
|
+
}
|
|
51
|
+
await URLRouteQuery(query);
|
|
52
|
+
await callback?.();
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
activeFilters,
|
|
56
|
+
applyFilters,
|
|
57
|
+
resetFilters,
|
|
58
|
+
handleFilterChange,
|
|
59
|
+
normalizeQueryValue
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useRoute, useRouter } from "vue-router";
|
|
2
|
+
export function useRouteQuery() {
|
|
3
|
+
const URLRouteQuery = (query, route) => {
|
|
4
|
+
const $route = useRoute();
|
|
5
|
+
const router = useRouter();
|
|
6
|
+
return router.push({
|
|
7
|
+
path: route,
|
|
8
|
+
query: {
|
|
9
|
+
...$route.query,
|
|
10
|
+
...query
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
URLRouteQuery
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useNuxtApp } from "nuxt/app";
|
|
2
|
+
import { ref, readonly } from "vue";
|
|
3
|
+
export function useVersionUpdater() {
|
|
4
|
+
const isNewVersionAvailable = ref(false);
|
|
5
|
+
const nuxtApp = useNuxtApp();
|
|
6
|
+
nuxtApp.hooks.hookOnce("app:manifest:update", () => {
|
|
7
|
+
isNewVersionAvailable.value = true;
|
|
8
|
+
});
|
|
9
|
+
return {
|
|
10
|
+
isNewVersionAvailable: readonly(isNewVersionAvailable)
|
|
11
|
+
};
|
|
12
|
+
}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { type useHttp } from '../dist/runtime/form.js'
|
|
2
2
|
|
|
3
|
+
export { type useBreadcrumbs, type useTitle } from '../dist/runtime/page/index.js'
|
|
4
|
+
|
|
5
|
+
export { type ActiveQueryFilter, type QueryFilterDefinition, type useQueryFilters, type useRouteQuery } from '../dist/runtime/route/index.js'
|
|
6
|
+
|
|
3
7
|
export { default } from './module.mjs'
|
|
4
8
|
|
|
5
9
|
export { type ModuleOptions } from './module.mjs'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ciwergrp/nuxid",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "All-in-one essential modules for Nuxt",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -45,35 +45,38 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@element-plus/nuxt": "1.1.
|
|
49
|
-
"@formatjs/intl": "4.1.
|
|
50
|
-
"@inquirer/prompts": "8.
|
|
48
|
+
"@element-plus/nuxt": "1.1.5",
|
|
49
|
+
"@formatjs/intl": "4.1.2",
|
|
50
|
+
"@inquirer/prompts": "8.3.0",
|
|
51
51
|
"@nuxt/icon": "2.2.1",
|
|
52
|
-
"@nuxt/kit": "4.3.
|
|
53
|
-
"@sentry/nuxt": "10.
|
|
52
|
+
"@nuxt/kit": "4.3.1",
|
|
53
|
+
"@sentry/nuxt": "10.40.0",
|
|
54
54
|
"@sindresorhus/slugify": "3.0.0",
|
|
55
55
|
"@sindresorhus/transliterate": "2.3.1",
|
|
56
|
-
"@
|
|
56
|
+
"@tailwindcss/vite": "^4.2.1",
|
|
57
|
+
"@vueuse/nuxt": "14.2.1",
|
|
57
58
|
"date-fns": "4.1.0",
|
|
58
|
-
"element-plus": "2.13.
|
|
59
|
+
"element-plus": "2.13.2",
|
|
59
60
|
"hls.js": "1.6.15",
|
|
60
61
|
"lodash-es": "4.17.23",
|
|
61
62
|
"pinia": "3.0.4",
|
|
62
|
-
"socket.io-client": "4.8.3"
|
|
63
|
+
"socket.io-client": "4.8.3",
|
|
64
|
+
"tailwindcss": "4.2.1",
|
|
65
|
+
"vite": "7.3.1"
|
|
63
66
|
},
|
|
64
67
|
"devDependencies": {
|
|
65
|
-
"@nuxt/devtools": "^3.
|
|
66
|
-
"@nuxt/eslint-config": "^1.
|
|
68
|
+
"@nuxt/devtools": "^3.2.2",
|
|
69
|
+
"@nuxt/eslint-config": "^1.15.2",
|
|
67
70
|
"@nuxt/module-builder": "^1.0.2",
|
|
68
|
-
"@nuxt/schema": "^4.
|
|
69
|
-
"@nuxt/test-utils": "^
|
|
71
|
+
"@nuxt/schema": "^4.3.1",
|
|
72
|
+
"@nuxt/test-utils": "^4.0.0",
|
|
70
73
|
"@types/lodash-es": "^4.17.12",
|
|
71
74
|
"@types/node": "^22",
|
|
72
|
-
"eslint": "^
|
|
73
|
-
"nuxt": "^4.
|
|
75
|
+
"eslint": "^10.0.2",
|
|
76
|
+
"nuxt": "^4.3.1",
|
|
74
77
|
"typescript": "^5.9.3",
|
|
75
|
-
"vitest": "^4.0.
|
|
76
|
-
"vue-tsc": "^3.2.
|
|
78
|
+
"vitest": "^4.0.18",
|
|
79
|
+
"vue-tsc": "^3.2.5"
|
|
77
80
|
},
|
|
78
81
|
"scripts": {
|
|
79
82
|
"dev": "npm run dev:prepare && nuxi dev playground",
|