dtwo 3.0.0-rc.14 → 3.1.0-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.
Files changed (61) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -2
  3. package/bin/dtwo.mjs +1 -1
  4. package/config.d.ts +1 -1
  5. package/dist/app/compat/idle-callback.d.ts +2 -0
  6. package/dist/app/compat/idle-callback.mjs +13 -0
  7. package/dist/app/components/dtwo-island.d.ts +33 -0
  8. package/dist/app/components/dtwo-island.mjs +62 -0
  9. package/dist/app/components/dtwo-link.d.ts +3 -3
  10. package/dist/app/components/dtwo-link.mjs +26 -28
  11. package/dist/app/components/dtwo-loading-indicator.d.ts +3 -3
  12. package/dist/app/components/dtwo-loading-indicator.mjs +8 -7
  13. package/dist/app/components/dtwo-root.kdu +10 -2
  14. package/dist/app/components/island-renderer.d.ts +20 -0
  15. package/dist/app/components/island-renderer.mjs +26 -0
  16. package/dist/app/components/layout.d.ts +1 -1
  17. package/dist/app/components/layout.mjs +12 -3
  18. package/dist/app/components/utils.mjs +1 -0
  19. package/dist/app/composables/asyncData.d.ts +5 -2
  20. package/dist/app/composables/asyncData.mjs +15 -2
  21. package/dist/app/composables/component.d.ts +1 -1
  22. package/dist/app/composables/cookie.d.ts +5 -4
  23. package/dist/app/composables/cookie.mjs +8 -2
  24. package/dist/app/composables/error.d.ts +1 -1
  25. package/dist/app/composables/fetch.d.ts +6 -6
  26. package/dist/app/composables/fetch.mjs +2 -1
  27. package/dist/app/composables/index.d.ts +2 -1
  28. package/dist/app/composables/index.mjs +2 -1
  29. package/dist/app/composables/ready.d.ts +1 -0
  30. package/dist/app/composables/ready.mjs +12 -0
  31. package/dist/app/composables/router.d.ts +1 -1
  32. package/dist/app/composables/router.mjs +5 -0
  33. package/dist/app/composables/ssr.d.ts +1 -1
  34. package/dist/app/config.mjs +1 -0
  35. package/dist/app/dtwo.d.ts +5 -4
  36. package/dist/app/plugins/cross-origin-prefetch.client.mjs +19 -14
  37. package/dist/app/plugins/router.mjs +13 -5
  38. package/dist/app/types/augments.d.ts +1 -1
  39. package/dist/components/runtime/server-component.d.ts +3 -0
  40. package/dist/components/runtime/server-component.mjs +87 -0
  41. package/dist/core/runtime/hole/renderer.d.ts +19 -0
  42. package/dist/core/runtime/hole/renderer.mjs +71 -9
  43. package/dist/head/runtime/components.d.ts +14 -14
  44. package/dist/head/runtime/components.mjs +12 -1
  45. package/dist/head/runtime/composables.d.ts +17 -0
  46. package/dist/head/runtime/composables.mjs +9 -0
  47. package/dist/head/runtime/lib/kduse-head.plugin.mjs +2 -1
  48. package/dist/index.mjs +298 -79
  49. package/dist/pages/runtime/composables.d.ts +1 -1
  50. package/dist/pages/runtime/page.d.ts +5 -1
  51. package/dist/pages/runtime/page.mjs +6 -3
  52. package/dist/pages/runtime/plugins/prefetch.client.mjs +36 -0
  53. package/dist/pages/runtime/{router.d.ts → plugins/router.d.ts} +1 -1
  54. package/dist/pages/runtime/{router.mjs → plugins/router.mjs} +11 -8
  55. package/dist/pages/runtime/utils.d.ts +1 -1
  56. package/dist/pages/runtime/utils.mjs +1 -1
  57. package/dist/pages/runtime/validate.mjs +4 -4
  58. package/package.json +51 -51
  59. package/types.d.ts +3 -0
  60. package/dist/head/runtime/lib/kdu-meta.plugin.mjs +0 -31
  61. /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
  };