dtwo 3.0.0 → 3.1.0
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/LICENSE +1 -1
- package/README.md +6 -2
- package/bin/dtwo.mjs +1 -1
- package/config.d.ts +1 -1
- package/dist/app/compat/idle-callback.d.ts +2 -0
- package/dist/app/compat/idle-callback.mjs +13 -0
- package/dist/app/components/dtwo-island.d.ts +33 -0
- package/dist/app/components/dtwo-island.mjs +62 -0
- package/dist/app/components/dtwo-link.d.ts +3 -3
- package/dist/app/components/dtwo-link.mjs +26 -28
- package/dist/app/components/dtwo-loading-indicator.d.ts +3 -3
- package/dist/app/components/dtwo-loading-indicator.mjs +8 -7
- package/dist/app/components/dtwo-root.kdu +10 -2
- package/dist/app/components/island-renderer.d.ts +20 -0
- package/dist/app/components/island-renderer.mjs +26 -0
- package/dist/app/components/layout.d.ts +1 -1
- package/dist/app/components/layout.mjs +12 -3
- package/dist/app/components/utils.mjs +1 -0
- package/dist/app/composables/asyncData.d.ts +4 -1
- package/dist/app/composables/asyncData.mjs +15 -2
- package/dist/app/composables/component.d.ts +1 -1
- package/dist/app/composables/cookie.d.ts +5 -4
- package/dist/app/composables/cookie.mjs +8 -2
- package/dist/app/composables/error.d.ts +1 -1
- package/dist/app/composables/fetch.d.ts +6 -6
- package/dist/app/composables/fetch.mjs +2 -1
- package/dist/app/composables/index.d.ts +2 -1
- package/dist/app/composables/index.mjs +2 -1
- package/dist/app/composables/ready.d.ts +1 -0
- package/dist/app/composables/ready.mjs +12 -0
- package/dist/app/composables/router.d.ts +1 -1
- package/dist/app/composables/router.mjs +5 -0
- package/dist/app/composables/ssr.d.ts +1 -1
- package/dist/app/config.mjs +1 -0
- package/dist/app/dtwo.d.ts +5 -4
- package/dist/app/plugins/cross-origin-prefetch.client.mjs +19 -14
- package/dist/app/plugins/router.mjs +13 -5
- package/dist/app/types/augments.d.ts +1 -1
- package/dist/components/runtime/server-component.d.ts +3 -0
- package/dist/components/runtime/server-component.mjs +87 -0
- package/dist/core/runtime/hole/renderer.d.ts +19 -0
- package/dist/core/runtime/hole/renderer.mjs +71 -9
- package/dist/head/runtime/components.d.ts +14 -14
- package/dist/head/runtime/components.mjs +12 -1
- package/dist/head/runtime/composables.d.ts +17 -0
- package/dist/head/runtime/composables.mjs +9 -0
- package/dist/head/runtime/lib/kduse-head.plugin.mjs +2 -1
- package/dist/index.mjs +298 -77
- package/dist/pages/runtime/composables.d.ts +1 -1
- package/dist/pages/runtime/page.d.ts +5 -1
- package/dist/pages/runtime/page.mjs +6 -3
- package/dist/pages/runtime/plugins/prefetch.client.mjs +36 -0
- package/dist/pages/runtime/{router.d.ts → plugins/router.d.ts} +1 -1
- package/dist/pages/runtime/{router.mjs → plugins/router.mjs} +11 -8
- package/dist/pages/runtime/utils.d.ts +1 -1
- package/dist/pages/runtime/utils.mjs +1 -1
- package/dist/pages/runtime/validate.mjs +4 -4
- package/package.json +51 -51
- package/types.d.ts +3 -0
- package/dist/head/runtime/lib/kdu-meta.plugin.mjs +0 -31
- /package/dist/{head/runtime/lib/kdu-meta.plugin.d.ts → pages/runtime/plugins/prefetch.client.d.ts} +0 -0
|
@@ -12,7 +12,7 @@ const globalProps = {
|
|
|
12
12
|
type: Boolean,
|
|
13
13
|
default: void 0
|
|
14
14
|
},
|
|
15
|
-
class: String,
|
|
15
|
+
class: [String, Object, Array],
|
|
16
16
|
contenteditable: {
|
|
17
17
|
type: Boolean,
|
|
18
18
|
default: void 0
|
|
@@ -71,6 +71,7 @@ export const NoScript = defineComponent({
|
|
|
71
71
|
})
|
|
72
72
|
});
|
|
73
73
|
export const Link = defineComponent({
|
|
74
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
74
75
|
name: "Link",
|
|
75
76
|
inheritAttrs: false,
|
|
76
77
|
props: {
|
|
@@ -94,7 +95,9 @@ export const Link = defineComponent({
|
|
|
94
95
|
sizes: String,
|
|
95
96
|
title: String,
|
|
96
97
|
type: String,
|
|
98
|
+
/** @deprecated **/
|
|
97
99
|
methods: String,
|
|
100
|
+
/** @deprecated **/
|
|
98
101
|
target: String,
|
|
99
102
|
body: Boolean,
|
|
100
103
|
renderPriority: [String, Number]
|
|
@@ -104,6 +107,7 @@ export const Link = defineComponent({
|
|
|
104
107
|
}))
|
|
105
108
|
});
|
|
106
109
|
export const Base = defineComponent({
|
|
110
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
107
111
|
name: "Base",
|
|
108
112
|
inheritAttrs: false,
|
|
109
113
|
props: {
|
|
@@ -116,6 +120,7 @@ export const Base = defineComponent({
|
|
|
116
120
|
}))
|
|
117
121
|
});
|
|
118
122
|
export const Title = defineComponent({
|
|
123
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
119
124
|
name: "Title",
|
|
120
125
|
inheritAttrs: false,
|
|
121
126
|
setup: setupForUseMeta((_, { slots }) => {
|
|
@@ -129,6 +134,7 @@ export const Title = defineComponent({
|
|
|
129
134
|
})
|
|
130
135
|
});
|
|
131
136
|
export const Meta = defineComponent({
|
|
137
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
132
138
|
name: "Meta",
|
|
133
139
|
inheritAttrs: false,
|
|
134
140
|
props: {
|
|
@@ -152,6 +158,7 @@ export const Meta = defineComponent({
|
|
|
152
158
|
})
|
|
153
159
|
});
|
|
154
160
|
export const Style = defineComponent({
|
|
161
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
155
162
|
name: "Style",
|
|
156
163
|
inheritAttrs: false,
|
|
157
164
|
props: {
|
|
@@ -160,6 +167,7 @@ export const Style = defineComponent({
|
|
|
160
167
|
media: String,
|
|
161
168
|
nonce: String,
|
|
162
169
|
title: String,
|
|
170
|
+
/** @deprecated **/
|
|
163
171
|
scoped: {
|
|
164
172
|
type: Boolean,
|
|
165
173
|
default: void 0
|
|
@@ -182,11 +190,13 @@ export const Style = defineComponent({
|
|
|
182
190
|
})
|
|
183
191
|
});
|
|
184
192
|
export const Head = defineComponent({
|
|
193
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
185
194
|
name: "Head",
|
|
186
195
|
inheritAttrs: false,
|
|
187
196
|
setup: (_props, ctx) => () => ctx.slots.default?.()
|
|
188
197
|
});
|
|
189
198
|
export const Html = defineComponent({
|
|
199
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
190
200
|
name: "Html",
|
|
191
201
|
inheritAttrs: false,
|
|
192
202
|
props: {
|
|
@@ -199,6 +209,7 @@ export const Html = defineComponent({
|
|
|
199
209
|
setup: setupForUseMeta((htmlAttrs) => ({ htmlAttrs }), true)
|
|
200
210
|
});
|
|
201
211
|
export const Body = defineComponent({
|
|
212
|
+
// eslint-disable-next-line kdu/no-reserved-component-names
|
|
202
213
|
name: "Body",
|
|
203
214
|
inheritAttrs: false,
|
|
204
215
|
props: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HeadEntryOptions, UseHeadInput, ActiveHeadEntry } from '@kduse/head';
|
|
2
2
|
import type { HeadAugmentations } from '@dtwo/schema';
|
|
3
|
+
import { useSeoMeta as _useSeoMeta } from '@kduse/head';
|
|
3
4
|
/**
|
|
4
5
|
* You can pass in a meta object, which has keys corresponding to meta tags:
|
|
5
6
|
* `title`, `base`, `script`, `style`, `meta` and `link`, as well as `htmlAttrs` and `bodyAttrs`.
|
|
@@ -8,3 +9,19 @@ import type { HeadAugmentations } from '@dtwo/schema';
|
|
|
8
9
|
* that returns a meta object.
|
|
9
10
|
*/
|
|
10
11
|
export declare function useHead<T extends HeadAugmentations>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void;
|
|
12
|
+
/**
|
|
13
|
+
* The `useSeoMeta` composable lets you define your site's SEO meta tags
|
|
14
|
+
* as a flat object with full TypeScript support.
|
|
15
|
+
*
|
|
16
|
+
* This helps you avoid typos and common mistakes, such as using `name`
|
|
17
|
+
* instead of `property`.
|
|
18
|
+
*
|
|
19
|
+
* It is advised to use `useServerSeoMeta` unless you _need_ client-side
|
|
20
|
+
* rendering of your SEO meta tags.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useSeoMeta: typeof _useSeoMeta;
|
|
23
|
+
/**
|
|
24
|
+
* The `useServerSeoMeta` composable is identical to `useSeoMeta` except that
|
|
25
|
+
* it will have no effect (and will return nothing) if called on the client.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useServerSeoMeta: typeof _useSeoMeta;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
+
import { useSeoMeta as _useSeoMeta } from "@kduse/head";
|
|
1
2
|
import { useDtwoApp } from "#app";
|
|
2
3
|
export function useHead(input, options) {
|
|
3
4
|
return useDtwoApp()._useHead(input, options);
|
|
4
5
|
}
|
|
6
|
+
export const useSeoMeta = (meta) => {
|
|
7
|
+
return _useSeoMeta(meta);
|
|
8
|
+
};
|
|
9
|
+
export const useServerSeoMeta = (meta) => {
|
|
10
|
+
if (process.server) {
|
|
11
|
+
return _useSeoMeta(meta);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createHead, useHead } from "@kduse/head";
|
|
2
|
+
import { renderSSRHead } from "@kdhead/ssr";
|
|
2
3
|
import { defineDtwoPlugin } from "#app";
|
|
3
4
|
import { appHead } from "#build/dtwo.config.mjs";
|
|
4
5
|
export default defineDtwoPlugin((dtwoApp) => {
|
|
@@ -23,11 +24,11 @@ export default defineDtwoPlugin((dtwoApp) => {
|
|
|
23
24
|
dtwoApp._useHead = useHead;
|
|
24
25
|
if (process.server) {
|
|
25
26
|
dtwoApp.ssrContext.renderMeta = async () => {
|
|
26
|
-
const { renderSSRHead } = await import("@kdhead/ssr");
|
|
27
27
|
const meta = await renderSSRHead(head.kdhead);
|
|
28
28
|
return {
|
|
29
29
|
...meta,
|
|
30
30
|
bodyScriptsPrepend: meta.bodyTagsOpen,
|
|
31
|
+
// resolves naming difference with DtwoMeta and @kduse/head
|
|
31
32
|
bodyScripts: meta.bodyTags
|
|
32
33
|
};
|
|
33
34
|
};
|