@xleddyl/nuxt-cms 0.10.1 → 0.11.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.json +1 -1
- package/dist/module.mjs +12 -0
- package/dist/runtime/app/composables/cms-entry-disabled.d.ts +16 -10
- package/dist/runtime/app/composables/cms-entry-disabled.js +18 -0
- package/dist/runtime/app/composables/cms-entry.d.ts +16 -10
- package/dist/runtime/app/composables/cms-entry.js +74 -47
- package/dist/runtime/app/css-inline.d.ts +4 -0
- package/dist/runtime/app/pages/admin-preview.vue +2 -2
- package/dist/runtime/app/preview/CmsPreviewBanner.vue +6 -7
- package/package.json +1 -1
- package/dist/runtime/app/css-url.d.ts +0 -4
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2302,6 +2302,12 @@ ${webhooks.errors.join("\n")}`);
|
|
|
2302
2302
|
{ name: "useCmsContents", from: entryStub },
|
|
2303
2303
|
{ name: "useCmsContent", from: entryStub },
|
|
2304
2304
|
{ name: "useCmsRoute", from: entryStub },
|
|
2305
|
+
{ name: "$cmsSingle", from: entryStub },
|
|
2306
|
+
{ name: "$cmsCollection", from: entryStub },
|
|
2307
|
+
{ name: "$cmsPage", from: entryStub },
|
|
2308
|
+
{ name: "$cmsContents", from: entryStub },
|
|
2309
|
+
{ name: "$cmsContent", from: entryStub },
|
|
2310
|
+
{ name: "$cmsRoute", from: entryStub },
|
|
2305
2311
|
{
|
|
2306
2312
|
name: "useCmsSite",
|
|
2307
2313
|
from: resolver.resolve("./runtime/app/composables/cms-site-disabled")
|
|
@@ -2415,6 +2421,12 @@ ${webhooks.errors.join("\n")}`);
|
|
|
2415
2421
|
{ name: "useCmsContents", from: entryComposables },
|
|
2416
2422
|
{ name: "useCmsContent", from: entryComposables },
|
|
2417
2423
|
{ name: "useCmsRoute", from: entryComposables },
|
|
2424
|
+
{ name: "$cmsSingle", from: entryComposables },
|
|
2425
|
+
{ name: "$cmsCollection", from: entryComposables },
|
|
2426
|
+
{ name: "$cmsPage", from: entryComposables },
|
|
2427
|
+
{ name: "$cmsContents", from: entryComposables },
|
|
2428
|
+
{ name: "$cmsContent", from: entryComposables },
|
|
2429
|
+
{ name: "$cmsRoute", from: entryComposables },
|
|
2418
2430
|
{
|
|
2419
2431
|
name: "useCmsPreviewMode",
|
|
2420
2432
|
from: resolver.resolve("./runtime/app/composables/cms-preview-mode")
|
|
@@ -5,26 +5,32 @@ export interface CmsSortInput<Entry> {
|
|
|
5
5
|
field: Extract<keyof Entry, string>;
|
|
6
6
|
direction?: 'asc' | 'desc';
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface CmsEntryQuery {
|
|
9
9
|
locale?: string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
12
|
-
locale?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface CmsCollectionOptions<ResT, DefaultT, Entry> extends CmsAsyncDataOptions<ResT, DefaultT> {
|
|
15
|
-
locale?: string;
|
|
11
|
+
export interface CmsListQuery<Entry> extends CmsEntryQuery {
|
|
16
12
|
filters?: Record<string, unknown>;
|
|
17
13
|
sort?: CmsSortInput<Entry>[];
|
|
18
14
|
limit?: number;
|
|
19
15
|
offset?: number;
|
|
20
16
|
}
|
|
21
|
-
export interface
|
|
22
|
-
|
|
17
|
+
export interface CmsSingleOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
18
|
+
}
|
|
19
|
+
export interface CmsPageOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
20
|
+
}
|
|
21
|
+
export interface CmsCollectionOptions<ResT, DefaultT, Entry> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsListQuery<Entry> {
|
|
22
|
+
}
|
|
23
|
+
export interface CmsContentOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
23
24
|
}
|
|
24
25
|
export type CmsContentsOptions<ResT, DefaultT, Entry> = CmsCollectionOptions<ResT, DefaultT, Entry>;
|
|
25
|
-
export interface CmsRouteOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT
|
|
26
|
-
locale?: string;
|
|
26
|
+
export interface CmsRouteOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
27
27
|
}
|
|
28
|
+
export declare function $cmsSingle<K extends CmsSingleName>(name: K, query?: CmsEntryQuery): Promise<CmsSingleTypes[K] | null>;
|
|
29
|
+
export declare function $cmsCollection<K extends CmsCollectionName>(name: K, query?: CmsListQuery<CmsCollectionTypes[K]>): Promise<CmsCollectionTypes[K][]>;
|
|
30
|
+
export declare function $cmsContents<K extends CmsContentName>(name: K, query?: CmsListQuery<CmsContentTypes[K]>): Promise<CmsContentTypes[K][]>;
|
|
31
|
+
export declare function $cmsContent<K extends CmsContentName>(name: K, slug: string, query?: CmsEntryQuery): Promise<CmsContentTypes[K] | null>;
|
|
32
|
+
export declare function $cmsPage<P extends CmsPagePath>(path: P, query?: CmsEntryQuery): Promise<CmsPageTypes[P] | null>;
|
|
33
|
+
export declare function $cmsRoute(path: string, query?: CmsEntryQuery): Promise<CmsContentRouteMatch | null>;
|
|
28
34
|
export declare function useCmsSingle<K extends CmsSingleName, DefaultT = null>(name: K, options?: CmsSingleOptions<CmsSingleTypes[K] | null, DefaultT>): AsyncData<CmsSingleTypes[K] | DefaultT | null, Error | undefined>;
|
|
29
35
|
export declare function useCmsCollection<K extends CmsCollectionName, DefaultT = CmsCollectionTypes[K][]>(name: K, options?: CmsCollectionOptions<CmsCollectionTypes[K][], DefaultT, CmsCollectionTypes[K]>): AsyncData<CmsCollectionTypes[K][] | DefaultT, Error | undefined>;
|
|
30
36
|
export declare function useCmsContents<K extends CmsContentName, DefaultT = CmsContentTypes[K][]>(name: K, options?: CmsContentsOptions<CmsContentTypes[K][], DefaultT, CmsContentTypes[K]>): AsyncData<CmsContentTypes[K][] | DefaultT, Error | undefined>;
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { useAsyncData } from "#imports";
|
|
2
|
+
export async function $cmsSingle(name, query = {}) {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
export async function $cmsCollection(name, query = {}) {
|
|
6
|
+
return [];
|
|
7
|
+
}
|
|
8
|
+
export async function $cmsContents(name, query = {}) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
export async function $cmsContent(name, slug, query = {}) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
export async function $cmsPage(path, query = {}) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
export async function $cmsRoute(path, query = {}) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
2
20
|
export function useCmsSingle(name, options = {}) {
|
|
3
21
|
const { locale, key, default: fallback } = options;
|
|
4
22
|
return useAsyncData(
|
|
@@ -5,26 +5,32 @@ export interface CmsSortInput<Entry> {
|
|
|
5
5
|
field: Extract<keyof Entry, string>;
|
|
6
6
|
direction?: 'asc' | 'desc';
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface CmsEntryQuery {
|
|
9
9
|
locale?: string;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
12
|
-
locale?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface CmsCollectionOptions<ResT, DefaultT, Entry> extends CmsAsyncDataOptions<ResT, DefaultT> {
|
|
15
|
-
locale?: string;
|
|
11
|
+
export interface CmsListQuery<Entry> extends CmsEntryQuery {
|
|
16
12
|
filters?: Record<string, unknown>;
|
|
17
13
|
sort?: CmsSortInput<Entry>[];
|
|
18
14
|
limit?: number;
|
|
19
15
|
offset?: number;
|
|
20
16
|
}
|
|
21
|
-
export interface
|
|
22
|
-
|
|
17
|
+
export interface CmsSingleOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
18
|
+
}
|
|
19
|
+
export interface CmsPageOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
20
|
+
}
|
|
21
|
+
export interface CmsCollectionOptions<ResT, DefaultT, Entry> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsListQuery<Entry> {
|
|
22
|
+
}
|
|
23
|
+
export interface CmsContentOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
23
24
|
}
|
|
24
25
|
export type CmsContentsOptions<ResT, DefaultT, Entry> = CmsCollectionOptions<ResT, DefaultT, Entry>;
|
|
25
|
-
export interface CmsRouteOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT
|
|
26
|
-
locale?: string;
|
|
26
|
+
export interface CmsRouteOptions<ResT, DefaultT> extends CmsAsyncDataOptions<ResT, DefaultT>, CmsEntryQuery {
|
|
27
27
|
}
|
|
28
|
+
export declare function $cmsSingle<K extends CmsSingleName>(name: K, query?: CmsEntryQuery): Promise<CmsSingleTypes[K] | null>;
|
|
29
|
+
export declare function $cmsCollection<K extends CmsCollectionName>(name: K, query?: CmsListQuery<CmsCollectionTypes[K]>): Promise<CmsCollectionTypes[K][]>;
|
|
30
|
+
export declare function $cmsContents<K extends CmsContentName>(name: K, query?: CmsListQuery<CmsContentTypes[K]>): Promise<CmsContentTypes[K][]>;
|
|
31
|
+
export declare function $cmsContent<K extends CmsContentName>(name: K, slug: string, query?: CmsEntryQuery): Promise<CmsContentTypes[K] | null>;
|
|
32
|
+
export declare function $cmsPage<P extends CmsPagePath>(path: P, query?: CmsEntryQuery): Promise<CmsPageTypes[P] | null>;
|
|
33
|
+
export declare function $cmsRoute(path: string, query?: CmsEntryQuery): Promise<null>;
|
|
28
34
|
export declare function useCmsSingle<K extends CmsSingleName, DefaultT = null>(name: K, options?: CmsSingleOptions<CmsSingleTypes[K] | null, DefaultT>): AsyncData<CmsSingleTypes[K] | DefaultT | null, Error | undefined>;
|
|
29
35
|
export declare function useCmsCollection<K extends CmsCollectionName, DefaultT = CmsCollectionTypes[K][]>(name: K, options?: CmsCollectionOptions<CmsCollectionTypes[K][], DefaultT, CmsCollectionTypes[K]>): AsyncData<CmsCollectionTypes[K][] | DefaultT, Error | undefined>;
|
|
30
36
|
export declare function useCmsContents<K extends CmsContentName, DefaultT = CmsContentTypes[K][]>(name: K, options?: CmsContentsOptions<CmsContentTypes[K][], DefaultT, CmsContentTypes[K]>): AsyncData<CmsContentTypes[K][] | DefaultT, Error | undefined>;
|
|
@@ -12,18 +12,75 @@ import { cmsPreviewKey, cmsPreviewToken, cmsQueryWithPreview } from "./cms-query
|
|
|
12
12
|
function unknownEntry(name) {
|
|
13
13
|
throw new Error(`[nuxt-cms] no generated query for "${name}"; check cms.config.ts`);
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
function listVariables({ locale, filters, sort, limit, offset }) {
|
|
16
|
+
return { locale, filters, sort, limit, offset };
|
|
17
|
+
}
|
|
18
|
+
async function fetchSingle(name, { locale }, preview) {
|
|
17
19
|
const entryName = String(name);
|
|
18
20
|
const query = cmsSingleQueries[entryName];
|
|
21
|
+
if (!query) unknownEntry(entryName);
|
|
22
|
+
const result = await cmsQueryWithPreview(query, { locale }, preview);
|
|
23
|
+
return result?.[entryName] ?? null;
|
|
24
|
+
}
|
|
25
|
+
async function fetchCollection(name, listQuery, preview) {
|
|
26
|
+
const entryName = String(name);
|
|
27
|
+
const query = cmsCollectionQueries[entryName];
|
|
28
|
+
if (!query) unknownEntry(entryName);
|
|
29
|
+
const result = await cmsQueryWithPreview(query, listVariables(listQuery), preview);
|
|
30
|
+
return result?.[entryName] ?? [];
|
|
31
|
+
}
|
|
32
|
+
async function fetchContents(name, listQuery, preview) {
|
|
33
|
+
const entryName = String(name);
|
|
34
|
+
const query = cmsContentQueries[entryName];
|
|
35
|
+
if (!query) unknownEntry(entryName);
|
|
36
|
+
const result = await cmsQueryWithPreview(query, listVariables(listQuery), preview);
|
|
37
|
+
return result?.[entryName] ?? [];
|
|
38
|
+
}
|
|
39
|
+
async function fetchContent(name, slug, { locale }, preview) {
|
|
40
|
+
const entryName = String(name);
|
|
41
|
+
const query = cmsContentItemQueries[entryName];
|
|
42
|
+
if (!query) unknownEntry(entryName);
|
|
43
|
+
const result = await cmsQueryWithPreview(query, { slug, locale }, preview);
|
|
44
|
+
return result?.item ?? null;
|
|
45
|
+
}
|
|
46
|
+
async function fetchPage(path, { locale }, preview) {
|
|
47
|
+
const pagePath = String(path);
|
|
48
|
+
const query = cmsPageQueries[pagePath];
|
|
49
|
+
if (!query) unknownEntry(pagePath);
|
|
50
|
+
const result = await cmsQueryWithPreview(query, { path: pagePath, locale }, preview);
|
|
51
|
+
return result?.page ?? null;
|
|
52
|
+
}
|
|
53
|
+
async function fetchRoute(path, { locale }, preview) {
|
|
54
|
+
if (!cmsRouteQuery) return null;
|
|
55
|
+
const result = await cmsQueryWithPreview(cmsRouteQuery, { path, locale }, preview);
|
|
56
|
+
const entry = cmsRouteEntries.find((name) => result?.[name]);
|
|
57
|
+
if (!entry) return null;
|
|
58
|
+
return { entry, item: result[entry] };
|
|
59
|
+
}
|
|
60
|
+
export function $cmsSingle(name, query = {}) {
|
|
61
|
+
return fetchSingle(name, query, cmsPreviewToken());
|
|
62
|
+
}
|
|
63
|
+
export function $cmsCollection(name, query = {}) {
|
|
64
|
+
return fetchCollection(name, query, cmsPreviewToken());
|
|
65
|
+
}
|
|
66
|
+
export function $cmsContents(name, query = {}) {
|
|
67
|
+
return fetchContents(name, query, cmsPreviewToken());
|
|
68
|
+
}
|
|
69
|
+
export function $cmsContent(name, slug, query = {}) {
|
|
70
|
+
return fetchContent(name, slug, query, cmsPreviewToken());
|
|
71
|
+
}
|
|
72
|
+
export function $cmsPage(path, query = {}) {
|
|
73
|
+
return fetchPage(path, query, cmsPreviewToken());
|
|
74
|
+
}
|
|
75
|
+
export function $cmsRoute(path, query = {}) {
|
|
76
|
+
return fetchRoute(path, query, cmsPreviewToken());
|
|
77
|
+
}
|
|
78
|
+
export function useCmsSingle(name, options = {}) {
|
|
79
|
+
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
19
80
|
const preview = cmsPreviewToken();
|
|
20
81
|
return useAsyncData(
|
|
21
|
-
key ?? cmsPreviewKey(`cms-single:${
|
|
22
|
-
|
|
23
|
-
if (!query) unknownEntry(entryName);
|
|
24
|
-
const result = await cmsQueryWithPreview(query, { locale }, preview);
|
|
25
|
-
return result?.[entryName] ?? null;
|
|
26
|
-
},
|
|
82
|
+
key ?? cmsPreviewKey(`cms-single:${String(name)}:${locale ?? ""}`, preview),
|
|
83
|
+
() => fetchSingle(name, { locale }, preview),
|
|
27
84
|
{
|
|
28
85
|
default: fallback ?? (() => null),
|
|
29
86
|
...asyncDataOptions
|
|
@@ -41,17 +98,11 @@ export function useCmsCollection(name, options = {}) {
|
|
|
41
98
|
default: fallback,
|
|
42
99
|
...asyncDataOptions
|
|
43
100
|
} = options;
|
|
44
|
-
const entryName = String(name);
|
|
45
|
-
const query = cmsCollectionQueries[entryName];
|
|
46
101
|
const variables = { locale, filters, sort, limit, offset };
|
|
47
102
|
const preview = cmsPreviewToken();
|
|
48
103
|
return useAsyncData(
|
|
49
|
-
key ?? cmsPreviewKey(`cms-collection:${
|
|
50
|
-
|
|
51
|
-
if (!query) unknownEntry(entryName);
|
|
52
|
-
const result = await cmsQueryWithPreview(query, variables, preview);
|
|
53
|
-
return result?.[entryName] ?? [];
|
|
54
|
-
},
|
|
104
|
+
key ?? cmsPreviewKey(`cms-collection:${String(name)}:${JSON.stringify(variables)}`, preview),
|
|
105
|
+
() => fetchCollection(name, variables, preview),
|
|
55
106
|
{
|
|
56
107
|
default: fallback ?? (() => []),
|
|
57
108
|
...asyncDataOptions
|
|
@@ -69,17 +120,11 @@ export function useCmsContents(name, options = {}) {
|
|
|
69
120
|
default: fallback,
|
|
70
121
|
...asyncDataOptions
|
|
71
122
|
} = options;
|
|
72
|
-
const entryName = String(name);
|
|
73
|
-
const query = cmsContentQueries[entryName];
|
|
74
123
|
const variables = { locale, filters, sort, limit, offset };
|
|
75
124
|
const preview = cmsPreviewToken();
|
|
76
125
|
return useAsyncData(
|
|
77
|
-
key ?? cmsPreviewKey(`cms-contents:${
|
|
78
|
-
|
|
79
|
-
if (!query) unknownEntry(entryName);
|
|
80
|
-
const result = await cmsQueryWithPreview(query, variables, preview);
|
|
81
|
-
return result?.[entryName] ?? [];
|
|
82
|
-
},
|
|
126
|
+
key ?? cmsPreviewKey(`cms-contents:${String(name)}:${JSON.stringify(variables)}`, preview),
|
|
127
|
+
() => fetchContents(name, variables, preview),
|
|
83
128
|
{
|
|
84
129
|
default: fallback ?? (() => []),
|
|
85
130
|
...asyncDataOptions
|
|
@@ -88,16 +133,10 @@ export function useCmsContents(name, options = {}) {
|
|
|
88
133
|
}
|
|
89
134
|
export function useCmsContent(name, slug, options = {}) {
|
|
90
135
|
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
91
|
-
const entryName = String(name);
|
|
92
|
-
const query = cmsContentItemQueries[entryName];
|
|
93
136
|
const preview = cmsPreviewToken();
|
|
94
137
|
return useAsyncData(
|
|
95
|
-
key ?? cmsPreviewKey(`cms-content:${
|
|
96
|
-
|
|
97
|
-
if (!query) unknownEntry(entryName);
|
|
98
|
-
const result = await cmsQueryWithPreview(query, { slug, locale }, preview);
|
|
99
|
-
return result?.item ?? null;
|
|
100
|
-
},
|
|
138
|
+
key ?? cmsPreviewKey(`cms-content:${String(name)}:${slug}:${locale ?? ""}`, preview),
|
|
139
|
+
() => fetchContent(name, slug, { locale }, preview),
|
|
101
140
|
{
|
|
102
141
|
default: fallback ?? (() => null),
|
|
103
142
|
...asyncDataOptions
|
|
@@ -106,16 +145,10 @@ export function useCmsContent(name, slug, options = {}) {
|
|
|
106
145
|
}
|
|
107
146
|
export function useCmsPage(path, options = {}) {
|
|
108
147
|
const { locale, key, default: fallback, ...asyncDataOptions } = options;
|
|
109
|
-
const pagePath = String(path);
|
|
110
|
-
const query = cmsPageQueries[pagePath];
|
|
111
148
|
const preview = cmsPreviewToken();
|
|
112
149
|
return useAsyncData(
|
|
113
|
-
key ?? cmsPreviewKey(`cms-page:${
|
|
114
|
-
|
|
115
|
-
if (!query) unknownEntry(pagePath);
|
|
116
|
-
const result = await cmsQueryWithPreview(query, { path: pagePath, locale }, preview);
|
|
117
|
-
return result?.page ?? null;
|
|
118
|
-
},
|
|
150
|
+
key ?? cmsPreviewKey(`cms-page:${String(path)}:${locale ?? ""}`, preview),
|
|
151
|
+
() => fetchPage(path, { locale }, preview),
|
|
119
152
|
{
|
|
120
153
|
default: fallback ?? (() => null),
|
|
121
154
|
...asyncDataOptions
|
|
@@ -127,13 +160,7 @@ export function useCmsRoute(path, options = {}) {
|
|
|
127
160
|
const preview = cmsPreviewToken();
|
|
128
161
|
return useAsyncData(
|
|
129
162
|
key ?? cmsPreviewKey(`cms-route:${path}:${locale ?? ""}`, preview),
|
|
130
|
-
|
|
131
|
-
if (!cmsRouteQuery) return null;
|
|
132
|
-
const result = await cmsQueryWithPreview(cmsRouteQuery, { path, locale }, preview);
|
|
133
|
-
const entry = cmsRouteEntries.find((name) => result?.[name]);
|
|
134
|
-
if (!entry) return null;
|
|
135
|
-
return { entry, item: result[entry] };
|
|
136
|
-
},
|
|
163
|
+
() => fetchRoute(path, { locale }, preview),
|
|
137
164
|
{
|
|
138
165
|
default: fallback ?? (() => null),
|
|
139
166
|
...asyncDataOptions
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
watch
|
|
87
87
|
} from "#imports";
|
|
88
88
|
import { Icon as KIcon } from "@xleddyl/443-components-vue";
|
|
89
|
-
import
|
|
89
|
+
import tokensCss from "@xleddyl/443-components-vue/tokens.css?inline";
|
|
90
90
|
import cmsConfig from "#cms-config";
|
|
91
91
|
import { cmsPreviewComponents } from "#cms-blocks";
|
|
92
92
|
import {
|
|
@@ -117,7 +117,7 @@ const inline = shallowRef(null);
|
|
|
117
117
|
useHead({
|
|
118
118
|
title: "Preview",
|
|
119
119
|
meta: [{ name: "robots", content: "noindex, nofollow" }],
|
|
120
|
-
|
|
120
|
+
style: [{ key: "cms-tokens", innerHTML: tokensCss }],
|
|
121
121
|
htmlAttrs: { lang: computed(() => state.value?.locale) }
|
|
122
122
|
});
|
|
123
123
|
const entry = computed(
|
|
@@ -31,19 +31,18 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script setup>
|
|
34
|
-
import
|
|
34
|
+
import tokensCss from "@xleddyl/443-components-vue/tokens.css?inline";
|
|
35
35
|
import { computed, onMounted, ref, watch } from "vue";
|
|
36
36
|
const props = defineProps({
|
|
37
37
|
mode: { type: Object, required: true }
|
|
38
38
|
});
|
|
39
39
|
const dismissed = ref(false);
|
|
40
40
|
onMounted(() => {
|
|
41
|
-
if (document.querySelector("
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
document.head.appendChild(link);
|
|
41
|
+
if (document.querySelector("style[data-cms-tokens]")) return;
|
|
42
|
+
const style = document.createElement("style");
|
|
43
|
+
style.textContent = tokensCss;
|
|
44
|
+
style.dataset.cmsTokens = "";
|
|
45
|
+
document.head.appendChild(style);
|
|
47
46
|
});
|
|
48
47
|
watch(
|
|
49
48
|
() => props.mode.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xleddyl/nuxt-cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Lightweight CMS that ships with your Nuxt app: runs on the Nitro server, content types defined in code, /cms admin panel, GraphQL API, SQLite or Postgres. No external CMS needed!",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Edoardo Alberti (https://github.com/xleddyl)",
|