@depup/nuxt 4.2.2-depup.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 (233) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +117 -0
  3. package/app.d.ts +1 -0
  4. package/bin/nuxt.mjs +2 -0
  5. package/config.cjs +7 -0
  6. package/config.d.ts +8 -0
  7. package/config.js +5 -0
  8. package/dist/app/compat/capi.d.ts +4 -0
  9. package/dist/app/compat/capi.js +19 -0
  10. package/dist/app/compat/idle-callback.d.ts +2 -0
  11. package/dist/app/compat/idle-callback.js +15 -0
  12. package/dist/app/compat/interval.d.ts +1 -0
  13. package/dist/app/compat/interval.js +11 -0
  14. package/dist/app/compat/vue-demi.d.ts +4 -0
  15. package/dist/app/compat/vue-demi.js +4 -0
  16. package/dist/app/components/client-fallback.client.d.ts +50 -0
  17. package/dist/app/components/client-fallback.client.js +50 -0
  18. package/dist/app/components/client-fallback.server.d.ts +57 -0
  19. package/dist/app/components/client-fallback.server.js +80 -0
  20. package/dist/app/components/client-only.d.ts +26 -0
  21. package/dist/app/components/client-only.js +130 -0
  22. package/dist/app/components/dev-only.d.ts +11 -0
  23. package/dist/app/components/dev-only.js +14 -0
  24. package/dist/app/components/error-404.d.vue.ts +51 -0
  25. package/dist/app/components/error-404.vue +48 -0
  26. package/dist/app/components/error-404.vue.d.ts +51 -0
  27. package/dist/app/components/error-500.d.vue.ts +51 -0
  28. package/dist/app/components/error-500.vue +46 -0
  29. package/dist/app/components/error-500.vue.d.ts +51 -0
  30. package/dist/app/components/index.d.ts +3 -0
  31. package/dist/app/components/index.js +1 -0
  32. package/dist/app/components/injections.d.ts +7 -0
  33. package/dist/app/components/injections.js +2 -0
  34. package/dist/app/components/island-renderer.d.ts +20 -0
  35. package/dist/app/components/island-renderer.js +28 -0
  36. package/dist/app/components/nuxt-error-boundary.d.vue.ts +24 -0
  37. package/dist/app/components/nuxt-error-boundary.vue +46 -0
  38. package/dist/app/components/nuxt-error-boundary.vue.d.ts +24 -0
  39. package/dist/app/components/nuxt-error-page.d.vue.ts +7 -0
  40. package/dist/app/components/nuxt-error-page.vue +27 -0
  41. package/dist/app/components/nuxt-error-page.vue.d.ts +7 -0
  42. package/dist/app/components/nuxt-island.d.ts +70 -0
  43. package/dist/app/components/nuxt-island.js +331 -0
  44. package/dist/app/components/nuxt-layout.d.ts +14 -0
  45. package/dist/app/components/nuxt-layout.js +171 -0
  46. package/dist/app/components/nuxt-link.d.ts +101 -0
  47. package/dist/app/components/nuxt-link.js +409 -0
  48. package/dist/app/components/nuxt-loading-indicator.d.ts +78 -0
  49. package/dist/app/components/nuxt-loading-indicator.js +75 -0
  50. package/dist/app/components/nuxt-root.d.vue.ts +3 -0
  51. package/dist/app/components/nuxt-root.vue +60 -0
  52. package/dist/app/components/nuxt-root.vue.d.ts +3 -0
  53. package/dist/app/components/nuxt-route-announcer.d.ts +26 -0
  54. package/dist/app/components/nuxt-route-announcer.js +48 -0
  55. package/dist/app/components/nuxt-stubs.d.ts +6 -0
  56. package/dist/app/components/nuxt-stubs.js +14 -0
  57. package/dist/app/components/nuxt-teleport-island-component.d.ts +22 -0
  58. package/dist/app/components/nuxt-teleport-island-component.js +38 -0
  59. package/dist/app/components/nuxt-teleport-island-slot.d.ts +32 -0
  60. package/dist/app/components/nuxt-teleport-island-slot.js +53 -0
  61. package/dist/app/components/nuxt-time.d.vue.ts +37 -0
  62. package/dist/app/components/nuxt-time.vue +148 -0
  63. package/dist/app/components/nuxt-time.vue.d.ts +37 -0
  64. package/dist/app/components/route-provider.d.ts +48 -0
  65. package/dist/app/components/route-provider.js +49 -0
  66. package/dist/app/components/server-placeholder.d.ts +2 -0
  67. package/dist/app/components/server-placeholder.js +7 -0
  68. package/dist/app/components/test-component-wrapper.d.ts +4 -0
  69. package/dist/app/components/test-component-wrapper.js +27 -0
  70. package/dist/app/components/utils.d.ts +48 -0
  71. package/dist/app/components/utils.js +126 -0
  72. package/dist/app/components/welcome.d.vue.ts +24 -0
  73. package/dist/app/components/welcome.vue +34 -0
  74. package/dist/app/components/welcome.vue.d.ts +24 -0
  75. package/dist/app/composables/asyncContext.d.ts +2 -0
  76. package/dist/app/composables/asyncContext.js +7 -0
  77. package/dist/app/composables/asyncData.d.ts +146 -0
  78. package/dist/app/composables/asyncData.js +491 -0
  79. package/dist/app/composables/chunk.d.ts +25 -0
  80. package/dist/app/composables/chunk.js +30 -0
  81. package/dist/app/composables/component.d.ts +4 -0
  82. package/dist/app/composables/component.js +82 -0
  83. package/dist/app/composables/cookie.d.ts +22 -0
  84. package/dist/app/composables/cookie.js +205 -0
  85. package/dist/app/composables/error.d.ts +25 -0
  86. package/dist/app/composables/error.js +39 -0
  87. package/dist/app/composables/fetch.d.ts +37 -0
  88. package/dist/app/composables/fetch.js +123 -0
  89. package/dist/app/composables/head.d.ts +1 -0
  90. package/dist/app/composables/head.js +1 -0
  91. package/dist/app/composables/hydrate.d.ts +9 -0
  92. package/dist/app/composables/hydrate.js +14 -0
  93. package/dist/app/composables/id.d.ts +3 -0
  94. package/dist/app/composables/id.js +2 -0
  95. package/dist/app/composables/index.d.ts +29 -0
  96. package/dist/app/composables/index.js +21 -0
  97. package/dist/app/composables/lazy-hydration.d.ts +40 -0
  98. package/dist/app/composables/lazy-hydration.js +2 -0
  99. package/dist/app/composables/loading-indicator.d.ts +39 -0
  100. package/dist/app/composables/loading-indicator.js +142 -0
  101. package/dist/app/composables/manifest.d.ts +20 -0
  102. package/dist/app/composables/manifest.js +59 -0
  103. package/dist/app/composables/once.d.ts +14 -0
  104. package/dist/app/composables/once.js +49 -0
  105. package/dist/app/composables/payload.d.ts +27 -0
  106. package/dist/app/composables/payload.js +137 -0
  107. package/dist/app/composables/preload.d.ts +20 -0
  108. package/dist/app/composables/preload.js +55 -0
  109. package/dist/app/composables/preview.d.ts +38 -0
  110. package/dist/app/composables/preview.js +61 -0
  111. package/dist/app/composables/ready.d.ts +2 -0
  112. package/dist/app/composables/ready.js +15 -0
  113. package/dist/app/composables/route-announcer.d.ts +19 -0
  114. package/dist/app/composables/route-announcer.js +55 -0
  115. package/dist/app/composables/router.d.ts +96 -0
  116. package/dist/app/composables/router.js +197 -0
  117. package/dist/app/composables/runtime-hook.d.ts +9 -0
  118. package/dist/app/composables/runtime-hook.js +7 -0
  119. package/dist/app/composables/script-stubs.d.ts +32 -0
  120. package/dist/app/composables/script-stubs.js +104 -0
  121. package/dist/app/composables/ssr.d.ts +33 -0
  122. package/dist/app/composables/ssr.js +113 -0
  123. package/dist/app/composables/state.d.ts +11 -0
  124. package/dist/app/composables/state.js +40 -0
  125. package/dist/app/composables/url.d.ts +3 -0
  126. package/dist/app/composables/url.js +8 -0
  127. package/dist/app/config.d.ts +14 -0
  128. package/dist/app/config.js +72 -0
  129. package/dist/app/entry-spa.d.ts +2 -0
  130. package/dist/app/entry-spa.js +2 -0
  131. package/dist/app/entry.async.d.ts +3 -0
  132. package/dist/app/entry.async.js +5 -0
  133. package/dist/app/entry.d.ts +7 -0
  134. package/dist/app/entry.js +78 -0
  135. package/dist/app/index.d.ts +12 -0
  136. package/dist/app/index.js +8 -0
  137. package/dist/app/middleware/manifest-route-rule.d.ts +2 -0
  138. package/dist/app/middleware/manifest-route-rule.js +17 -0
  139. package/dist/app/nuxt.d.ts +271 -0
  140. package/dist/app/nuxt.js +279 -0
  141. package/dist/app/plugins/browser-devtools-timing.client.d.ts +2 -0
  142. package/dist/app/plugins/browser-devtools-timing.client.js +23 -0
  143. package/dist/app/plugins/check-if-layout-used.d.ts +2 -0
  144. package/dist/app/plugins/check-if-layout-used.js +28 -0
  145. package/dist/app/plugins/check-outdated-build.client.d.ts +2 -0
  146. package/dist/app/plugins/check-outdated-build.client.js +39 -0
  147. package/dist/app/plugins/chunk-reload-immediate.client.d.ts +2 -0
  148. package/dist/app/plugins/chunk-reload-immediate.client.js +20 -0
  149. package/dist/app/plugins/chunk-reload.client.d.ts +2 -0
  150. package/dist/app/plugins/chunk-reload.client.js +30 -0
  151. package/dist/app/plugins/cross-origin-prefetch.client.d.ts +2 -0
  152. package/dist/app/plugins/cross-origin-prefetch.client.js +37 -0
  153. package/dist/app/plugins/debug-hooks.d.ts +2 -0
  154. package/dist/app/plugins/debug-hooks.js +9 -0
  155. package/dist/app/plugins/dev-server-logs.d.ts +2 -0
  156. package/dist/app/plugins/dev-server-logs.js +60 -0
  157. package/dist/app/plugins/navigation-repaint.client.d.ts +2 -0
  158. package/dist/app/plugins/navigation-repaint.client.js +16 -0
  159. package/dist/app/plugins/payload.client.d.ts +2 -0
  160. package/dist/app/plugins/payload.client.js +50 -0
  161. package/dist/app/plugins/preload.server.d.ts +2 -0
  162. package/dist/app/plugins/preload.server.js +13 -0
  163. package/dist/app/plugins/restore-state.client.d.ts +2 -0
  164. package/dist/app/plugins/restore-state.client.js +18 -0
  165. package/dist/app/plugins/revive-payload.client.d.ts +2 -0
  166. package/dist/app/plugins/revive-payload.client.js +44 -0
  167. package/dist/app/plugins/revive-payload.server.d.ts +2 -0
  168. package/dist/app/plugins/revive-payload.server.js +26 -0
  169. package/dist/app/plugins/router.d.ts +59 -0
  170. package/dist/app/plugins/router.js +222 -0
  171. package/dist/app/plugins/utils.d.ts +1 -0
  172. package/dist/app/plugins/utils.js +4 -0
  173. package/dist/app/plugins/view-transitions.client.d.ts +2 -0
  174. package/dist/app/plugins/view-transitions.client.js +55 -0
  175. package/dist/app/plugins/warn.dev.server.d.ts +2 -0
  176. package/dist/app/plugins/warn.dev.server.js +6 -0
  177. package/dist/app/types/augments.d.ts +49 -0
  178. package/dist/app/types/augments.js +0 -0
  179. package/dist/app/types.d.ts +39 -0
  180. package/dist/app/types.js +0 -0
  181. package/dist/app/utils.d.ts +13 -0
  182. package/dist/app/utils.js +34 -0
  183. package/dist/components/runtime/client-component.d.ts +2 -0
  184. package/dist/components/runtime/client-component.js +59 -0
  185. package/dist/components/runtime/lazy-hydrated-component.d.ts +124 -0
  186. package/dist/components/runtime/lazy-hydrated-component.js +101 -0
  187. package/dist/components/runtime/server-component.d.ts +20 -0
  188. package/dist/components/runtime/server-component.js +69 -0
  189. package/dist/head/runtime/components.d.ts +1058 -0
  190. package/dist/head/runtime/components.js +297 -0
  191. package/dist/head/runtime/composables.d.ts +25 -0
  192. package/dist/head/runtime/composables.js +47 -0
  193. package/dist/head/runtime/plugins/unhead.d.ts +2 -0
  194. package/dist/head/runtime/plugins/unhead.js +31 -0
  195. package/dist/head/runtime/types.d.ts +7 -0
  196. package/dist/head/runtime/types.js +0 -0
  197. package/dist/index.d.mts +9 -0
  198. package/dist/index.d.ts +9 -0
  199. package/dist/index.mjs +6974 -0
  200. package/dist/pages/runtime/app.d.vue.ts +3 -0
  201. package/dist/pages/runtime/app.vue +6 -0
  202. package/dist/pages/runtime/app.vue.d.ts +3 -0
  203. package/dist/pages/runtime/component-stub.d.ts +2 -0
  204. package/dist/pages/runtime/component-stub.js +1 -0
  205. package/dist/pages/runtime/composables.d.ts +58 -0
  206. package/dist/pages/runtime/composables.js +24 -0
  207. package/dist/pages/runtime/index.d.ts +3 -0
  208. package/dist/pages/runtime/index.js +1 -0
  209. package/dist/pages/runtime/page-placeholder.d.ts +4 -0
  210. package/dist/pages/runtime/page-placeholder.js +11 -0
  211. package/dist/pages/runtime/page.d.ts +30 -0
  212. package/dist/pages/runtime/page.js +212 -0
  213. package/dist/pages/runtime/plugins/check-if-page-unused.d.ts +2 -0
  214. package/dist/pages/runtime/plugins/check-if-page-unused.js +29 -0
  215. package/dist/pages/runtime/plugins/prefetch.client.d.ts +2 -0
  216. package/dist/pages/runtime/plugins/prefetch.client.js +41 -0
  217. package/dist/pages/runtime/plugins/prerender.server.d.ts +2 -0
  218. package/dist/pages/runtime/plugins/prerender.server.js +47 -0
  219. package/dist/pages/runtime/plugins/router.d.ts +6 -0
  220. package/dist/pages/runtime/plugins/router.js +236 -0
  221. package/dist/pages/runtime/router.options.d.ts +3 -0
  222. package/dist/pages/runtime/router.options.js +60 -0
  223. package/dist/pages/runtime/utils.d.ts +11 -0
  224. package/dist/pages/runtime/utils.js +18 -0
  225. package/dist/pages/runtime/validate.d.ts +2 -0
  226. package/dist/pages/runtime/validate.js +23 -0
  227. package/kit.d.ts +1 -0
  228. package/kit.js +1 -0
  229. package/package.json +156 -0
  230. package/schema.d.ts +1 -0
  231. package/schema.js +1 -0
  232. package/types.d.mts +14 -0
  233. package/types.d.ts +14 -0
@@ -0,0 +1,48 @@
1
+ import { defineComponent, h } from "vue";
2
+ import { useRouteAnnouncer } from "../composables/route-announcer.js";
3
+ export default defineComponent({
4
+ name: "NuxtRouteAnnouncer",
5
+ props: {
6
+ atomic: {
7
+ type: Boolean,
8
+ default: false
9
+ },
10
+ politeness: {
11
+ type: String,
12
+ default: "polite"
13
+ }
14
+ },
15
+ setup(props, { slots, expose }) {
16
+ const { set, polite, assertive, message, politeness } = useRouteAnnouncer({ politeness: props.politeness });
17
+ expose({
18
+ set,
19
+ polite,
20
+ assertive,
21
+ message,
22
+ politeness
23
+ });
24
+ return () => h("span", {
25
+ class: "nuxt-route-announcer",
26
+ style: {
27
+ position: "absolute"
28
+ }
29
+ }, h("span", {
30
+ "role": "alert",
31
+ "aria-live": politeness.value,
32
+ "aria-atomic": props.atomic,
33
+ "style": {
34
+ "border": "0",
35
+ "clip": "rect(0 0 0 0)",
36
+ "clip-path": "inset(50%)",
37
+ "height": "1px",
38
+ "width": "1px",
39
+ "overflow": "hidden",
40
+ "position": "absolute",
41
+ "white-space": "nowrap",
42
+ "word-wrap": "normal",
43
+ "margin": "-1px",
44
+ "padding": "0"
45
+ }
46
+ }, slots.default ? slots.default({ message: message.value }) : message.value));
47
+ }
48
+ });
@@ -0,0 +1,6 @@
1
+ export declare const NuxtImg: {
2
+ setup: () => void;
3
+ };
4
+ export declare const NuxtPicture: {
5
+ setup: () => void;
6
+ };
@@ -0,0 +1,14 @@
1
+ import { createError } from "../composables/error.js";
2
+ function renderStubMessage(name) {
3
+ throw createError({
4
+ fatal: true,
5
+ statusCode: 500,
6
+ statusMessage: `${name} is provided by @nuxt/image. Check your console to install it or run 'npx nuxt module add @nuxt/image'`
7
+ });
8
+ }
9
+ export const NuxtImg = {
10
+ setup: () => renderStubMessage("<NuxtImg>")
11
+ };
12
+ export const NuxtPicture = {
13
+ setup: () => renderStubMessage("<NuxtPicture>")
14
+ };
@@ -0,0 +1,22 @@
1
+ import type { InjectionKey } from 'vue';
2
+ export declare const NuxtTeleportIslandSymbol: InjectionKey<false | string>;
3
+ /**
4
+ * component only used with componentsIsland
5
+ * this teleport the component in SSR only if it needs to be hydrated on client
6
+ */
7
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ nuxtClient: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ nuxtClient: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ }>> & Readonly<{}>, {
20
+ nuxtClient: boolean;
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
22
+ export default _default;
@@ -0,0 +1,38 @@
1
+ import { Teleport, defineComponent, h, inject, provide, useId } from "vue";
2
+ import { useNuxtApp } from "../nuxt.js";
3
+ import paths from "#build/component-chunk";
4
+ import { buildAssetsURL } from "#internal/nuxt/paths";
5
+ export const NuxtTeleportIslandSymbol = Symbol("NuxtTeleportIslandComponent");
6
+ export default defineComponent({
7
+ name: "NuxtTeleportIslandComponent",
8
+ inheritAttrs: false,
9
+ props: {
10
+ nuxtClient: {
11
+ type: Boolean,
12
+ default: false
13
+ }
14
+ },
15
+ setup(props, { slots }) {
16
+ const nuxtApp = useNuxtApp();
17
+ const to = useId();
18
+ if (!nuxtApp.ssrContext?.islandContext || !props.nuxtClient || inject(NuxtTeleportIslandSymbol, false)) {
19
+ return () => slots.default?.();
20
+ }
21
+ provide(NuxtTeleportIslandSymbol, to);
22
+ const islandContext = nuxtApp.ssrContext.islandContext;
23
+ return () => {
24
+ const slot = slots.default()[0];
25
+ const slotType = slot.type;
26
+ const name = slotType.__name || slotType.name;
27
+ islandContext.components[to] = {
28
+ chunk: import.meta.dev ? buildAssetsURL(paths[name]) : paths[name],
29
+ props: slot.props || {}
30
+ };
31
+ return [h("div", {
32
+ "style": "display: contents;",
33
+ "data-island-uid": "",
34
+ "data-island-component": to
35
+ }, []), h(Teleport, { to }, slot)];
36
+ };
37
+ }
38
+ });
@@ -0,0 +1,32 @@
1
+ import type { VNode } from 'vue';
2
+ /**
3
+ * component only used within islands for slot teleport
4
+ */
5
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ name: {
7
+ type: StringConstructor;
8
+ required: true;
9
+ };
10
+ /**
11
+ * must be an array to handle v-for
12
+ */
13
+ props: {
14
+ type: () => Array<any>;
15
+ };
16
+ }>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
17
+ [key: string]: any;
18
+ }> | undefined) | (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
19
+ [key: string]: any;
20
+ }>[]), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
21
+ name: {
22
+ type: StringConstructor;
23
+ required: true;
24
+ };
25
+ /**
26
+ * must be an array to handle v-for
27
+ */
28
+ props: {
29
+ type: () => Array<any>;
30
+ };
31
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
+ export default _default;
@@ -0,0 +1,53 @@
1
+ import { Teleport, createVNode, defineComponent, h, inject } from "vue";
2
+ import { useNuxtApp } from "../nuxt.js";
3
+ import { NuxtTeleportIslandSymbol } from "./nuxt-teleport-island-component.js";
4
+ export default defineComponent({
5
+ name: "NuxtTeleportIslandSlot",
6
+ inheritAttrs: false,
7
+ props: {
8
+ name: {
9
+ type: String,
10
+ required: true
11
+ },
12
+ /**
13
+ * must be an array to handle v-for
14
+ */
15
+ props: {
16
+ type: Object
17
+ }
18
+ },
19
+ setup(props, { slots }) {
20
+ const nuxtApp = useNuxtApp();
21
+ const islandContext = nuxtApp.ssrContext?.islandContext;
22
+ if (!islandContext) {
23
+ return () => slots.default?.()[0];
24
+ }
25
+ const componentName = inject(NuxtTeleportIslandSymbol, false);
26
+ islandContext.slots[props.name] = {
27
+ props: props.props || []
28
+ };
29
+ return () => {
30
+ const vnodes = [];
31
+ if (nuxtApp.ssrContext?.islandContext && slots.default) {
32
+ vnodes.push(h("div", {
33
+ "style": "display: contents;",
34
+ "data-island-uid": "",
35
+ "data-island-slot": props.name
36
+ }, {
37
+ // Teleport in slot to not be hydrated client-side with the staticVNode
38
+ default: () => [createVNode(Teleport, { to: `island-slot=${componentName};${props.name}` }, slots.default?.())]
39
+ }));
40
+ } else {
41
+ vnodes.push(h("div", {
42
+ "style": "display: contents;",
43
+ "data-island-uid": "",
44
+ "data-island-slot": props.name
45
+ }));
46
+ }
47
+ if (slots.fallback) {
48
+ vnodes.push(h(Teleport, { to: `island-fallback=${props.name}` }, slots.fallback()));
49
+ }
50
+ return vnodes;
51
+ };
52
+ }
53
+ });
@@ -0,0 +1,37 @@
1
+ export interface NuxtTimeProps {
2
+ locale?: string;
3
+ datetime: string | number | Date;
4
+ localeMatcher?: 'best fit' | 'lookup';
5
+ weekday?: 'long' | 'short' | 'narrow';
6
+ era?: 'long' | 'short' | 'narrow';
7
+ year?: 'numeric' | '2-digit';
8
+ month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';
9
+ day?: 'numeric' | '2-digit';
10
+ hour?: 'numeric' | '2-digit';
11
+ minute?: 'numeric' | '2-digit';
12
+ second?: 'numeric' | '2-digit';
13
+ timeZoneName?: 'short' | 'long' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric';
14
+ formatMatcher?: 'best fit' | 'basic';
15
+ hour12?: boolean;
16
+ timeZone?: string;
17
+ calendar?: string;
18
+ dayPeriod?: 'narrow' | 'short' | 'long';
19
+ numberingSystem?: string;
20
+ dateStyle?: 'full' | 'long' | 'medium' | 'short';
21
+ timeStyle?: 'full' | 'long' | 'medium' | 'short';
22
+ hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
23
+ relative?: boolean;
24
+ numeric?: 'always' | 'auto';
25
+ relativeStyle?: 'long' | 'short' | 'narrow';
26
+ title?: boolean | string;
27
+ }
28
+ declare global {
29
+ interface Window {
30
+ _nuxtTimeNow?: number;
31
+ }
32
+ }
33
+ declare const __VLS_export: import("vue").DefineComponent<NuxtTimeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NuxtTimeProps> & Readonly<{}>, {
34
+ hour12: boolean;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
@@ -0,0 +1,148 @@
1
+ <script setup>
2
+ import { computed, getCurrentInstance, onBeforeUnmount, ref } from "vue";
3
+ import { onPrehydrate } from "../composables/ssr";
4
+ import { useNuxtApp } from "../nuxt";
5
+ const props = defineProps({
6
+ locale: { type: String, required: false },
7
+ datetime: { type: [String, Number, Date], required: true },
8
+ localeMatcher: { type: String, required: false },
9
+ weekday: { type: String, required: false },
10
+ era: { type: String, required: false },
11
+ year: { type: String, required: false },
12
+ month: { type: String, required: false },
13
+ day: { type: String, required: false },
14
+ hour: { type: String, required: false },
15
+ minute: { type: String, required: false },
16
+ second: { type: String, required: false },
17
+ timeZoneName: { type: String, required: false },
18
+ formatMatcher: { type: String, required: false },
19
+ hour12: { type: Boolean, required: false, default: void 0 },
20
+ timeZone: { type: String, required: false },
21
+ calendar: { type: String, required: false },
22
+ dayPeriod: { type: String, required: false },
23
+ numberingSystem: { type: String, required: false },
24
+ dateStyle: { type: String, required: false },
25
+ timeStyle: { type: String, required: false },
26
+ hourCycle: { type: String, required: false },
27
+ relative: { type: Boolean, required: false },
28
+ numeric: { type: String, required: false },
29
+ relativeStyle: { type: String, required: false },
30
+ title: { type: [Boolean, String], required: false }
31
+ });
32
+ const el = getCurrentInstance()?.vnode.el;
33
+ const renderedDate = el?.getAttribute("datetime");
34
+ const _locale = el?.getAttribute("data-locale");
35
+ const nuxtApp = useNuxtApp();
36
+ const date = computed(() => {
37
+ const date2 = props.datetime;
38
+ if (renderedDate && nuxtApp.isHydrating) {
39
+ return new Date(renderedDate);
40
+ }
41
+ if (!props.datetime) {
42
+ return /* @__PURE__ */ new Date();
43
+ }
44
+ return new Date(date2);
45
+ });
46
+ const now = ref(import.meta.client && nuxtApp.isHydrating && window._nuxtTimeNow ? new Date(window._nuxtTimeNow) : /* @__PURE__ */ new Date());
47
+ if (import.meta.client && props.relative) {
48
+ const handler = () => {
49
+ now.value = /* @__PURE__ */ new Date();
50
+ };
51
+ const interval = setInterval(handler, 1e3);
52
+ onBeforeUnmount(() => clearInterval(interval));
53
+ }
54
+ const formatter = computed(() => {
55
+ const { locale: propsLocale, relative, relativeStyle, ...rest } = props;
56
+ if (relative) {
57
+ return new Intl.RelativeTimeFormat(_locale ?? propsLocale, { ...rest, style: relativeStyle });
58
+ }
59
+ return new Intl.DateTimeFormat(_locale ?? propsLocale, rest);
60
+ });
61
+ const formattedDate = computed(() => {
62
+ if (!props.relative) {
63
+ return formatter.value.format(date.value);
64
+ }
65
+ const diffInSeconds = (date.value.getTime() - now.value.getTime()) / 1e3;
66
+ const units = [
67
+ { unit: "second", seconds: 1, threshold: 60 },
68
+ // 60 seconds → minute
69
+ { unit: "minute", seconds: 60, threshold: 60 },
70
+ // 60 minutes → hour
71
+ { unit: "hour", seconds: 3600, threshold: 24 },
72
+ // 24 hours → day
73
+ { unit: "day", seconds: 86400, threshold: 30 },
74
+ // ~30 days → month
75
+ { unit: "month", seconds: 2592e3, threshold: 12 },
76
+ // 12 months → year
77
+ { unit: "year", seconds: 31536e3, threshold: Infinity }
78
+ ];
79
+ const { unit, seconds } = units.find(({ seconds: seconds2, threshold }) => Math.abs(diffInSeconds / seconds2) < threshold) || units[units.length - 1];
80
+ const value = diffInSeconds / seconds;
81
+ return formatter.value.format(Math.round(value), unit);
82
+ });
83
+ const isoDate = computed(() => date.value.toISOString());
84
+ const title = computed(() => props.title === true ? isoDate.value : typeof props.title === "string" ? props.title : void 0);
85
+ const dataset = {};
86
+ if (import.meta.server) {
87
+ for (const prop in props) {
88
+ if (prop !== "datetime") {
89
+ const value = props?.[prop];
90
+ if (value) {
91
+ const propInKebabCase = prop.split(/(?=[A-Z])/).join("-");
92
+ dataset[`data-${propInKebabCase}`] = props?.[prop];
93
+ }
94
+ }
95
+ }
96
+ onPrehydrate((el2) => {
97
+ const now2 = window._nuxtTimeNow ||= Date.now();
98
+ const toCamelCase = (name, index) => {
99
+ if (index > 0) {
100
+ return name[0].toUpperCase() + name.slice(1);
101
+ }
102
+ return name;
103
+ };
104
+ const date2 = new Date(el2.getAttribute("datetime"));
105
+ const options = {};
106
+ for (const name of el2.getAttributeNames()) {
107
+ if (name.startsWith("data-")) {
108
+ let optionName = name.slice(5).split("-").map(toCamelCase).join("");
109
+ if (optionName === "relativeStyle") {
110
+ optionName = "style";
111
+ }
112
+ options[optionName] = el2.getAttribute(name);
113
+ }
114
+ }
115
+ if (options.relative) {
116
+ const diffInSeconds = (date2.getTime() - now2) / 1e3;
117
+ const units = [
118
+ { unit: "second", seconds: 1, threshold: 60 },
119
+ // 60 seconds → minute
120
+ { unit: "minute", seconds: 60, threshold: 60 },
121
+ // 60 minutes → hour
122
+ { unit: "hour", seconds: 3600, threshold: 24 },
123
+ // 24 hours → day
124
+ { unit: "day", seconds: 86400, threshold: 30 },
125
+ // ~30 days → month
126
+ { unit: "month", seconds: 2592e3, threshold: 12 },
127
+ // 12 months → year
128
+ { unit: "year", seconds: 31536e3, threshold: Infinity }
129
+ ];
130
+ const { unit, seconds } = units.find(({ seconds: seconds2, threshold }) => Math.abs(diffInSeconds / seconds2) < threshold) || units[units.length - 1];
131
+ const value = diffInSeconds / seconds;
132
+ const formatter2 = new Intl.RelativeTimeFormat(options.locale, options);
133
+ el2.textContent = formatter2.format(Math.round(value), unit);
134
+ } else {
135
+ const formatter2 = new Intl.DateTimeFormat(options.locale, options);
136
+ el2.textContent = formatter2.format(date2);
137
+ }
138
+ });
139
+ }
140
+ </script>
141
+
142
+ <template>
143
+ <time
144
+ v-bind="dataset"
145
+ :datetime="isoDate"
146
+ :title="title"
147
+ >{{ formattedDate }}</time>
148
+ </template>
@@ -0,0 +1,37 @@
1
+ export interface NuxtTimeProps {
2
+ locale?: string;
3
+ datetime: string | number | Date;
4
+ localeMatcher?: 'best fit' | 'lookup';
5
+ weekday?: 'long' | 'short' | 'narrow';
6
+ era?: 'long' | 'short' | 'narrow';
7
+ year?: 'numeric' | '2-digit';
8
+ month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';
9
+ day?: 'numeric' | '2-digit';
10
+ hour?: 'numeric' | '2-digit';
11
+ minute?: 'numeric' | '2-digit';
12
+ second?: 'numeric' | '2-digit';
13
+ timeZoneName?: 'short' | 'long' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric';
14
+ formatMatcher?: 'best fit' | 'basic';
15
+ hour12?: boolean;
16
+ timeZone?: string;
17
+ calendar?: string;
18
+ dayPeriod?: 'narrow' | 'short' | 'long';
19
+ numberingSystem?: string;
20
+ dateStyle?: 'full' | 'long' | 'medium' | 'short';
21
+ timeStyle?: 'full' | 'long' | 'medium' | 'short';
22
+ hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
23
+ relative?: boolean;
24
+ numeric?: 'always' | 'auto';
25
+ relativeStyle?: 'long' | 'short' | 'narrow';
26
+ title?: boolean | string;
27
+ }
28
+ declare global {
29
+ interface Window {
30
+ _nuxtTimeNow?: number;
31
+ }
32
+ }
33
+ declare const __VLS_export: import("vue").DefineComponent<NuxtTimeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<NuxtTimeProps> & Readonly<{}>, {
34
+ hour12: boolean;
35
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
+ declare const _default: typeof __VLS_export;
37
+ export default _default;
@@ -0,0 +1,48 @@
1
+ import type { Ref, VNode } from 'vue';
2
+ import type { RouteLocationNormalizedLoaded } from 'vue-router';
3
+ export declare const defineRouteProvider: (name?: string) => import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ route: {
5
+ type: () => RouteLocationNormalizedLoaded;
6
+ required: true;
7
+ };
8
+ vnode: () => VNode;
9
+ vnodeRef: () => Ref<any>;
10
+ renderKey: StringConstructor;
11
+ trackRootNodes: BooleanConstructor;
12
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
13
+ [key: string]: any;
14
+ }> | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ route: {
16
+ type: () => RouteLocationNormalizedLoaded;
17
+ required: true;
18
+ };
19
+ vnode: () => VNode;
20
+ vnodeRef: () => Ref<any>;
21
+ renderKey: StringConstructor;
22
+ trackRootNodes: BooleanConstructor;
23
+ }>> & Readonly<{}>, {
24
+ trackRootNodes: boolean;
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ export declare const RouteProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
27
+ route: {
28
+ type: () => RouteLocationNormalizedLoaded;
29
+ required: true;
30
+ };
31
+ vnode: () => VNode;
32
+ vnodeRef: () => Ref<any>;
33
+ renderKey: StringConstructor;
34
+ trackRootNodes: BooleanConstructor;
35
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
+ [key: string]: any;
37
+ }> | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
38
+ route: {
39
+ type: () => RouteLocationNormalizedLoaded;
40
+ required: true;
41
+ };
42
+ vnode: () => VNode;
43
+ vnodeRef: () => Ref<any>;
44
+ renderKey: StringConstructor;
45
+ trackRootNodes: BooleanConstructor;
46
+ }>> & Readonly<{}>, {
47
+ trackRootNodes: boolean;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,49 @@
1
+ import { defineComponent, h, nextTick, onMounted, provide, shallowReactive } from "vue";
2
+ import { PageRouteSymbol } from "./injections.js";
3
+ export const defineRouteProvider = (name = "RouteProvider") => defineComponent({
4
+ name,
5
+ props: {
6
+ route: {
7
+ type: Object,
8
+ required: true
9
+ },
10
+ vnode: Object,
11
+ vnodeRef: Object,
12
+ renderKey: String,
13
+ trackRootNodes: Boolean
14
+ },
15
+ setup(props) {
16
+ const previousKey = props.renderKey;
17
+ const previousRoute = props.route;
18
+ const route = {};
19
+ for (const key in props.route) {
20
+ Object.defineProperty(route, key, {
21
+ get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key],
22
+ enumerable: true
23
+ });
24
+ }
25
+ provide(PageRouteSymbol, shallowReactive(route));
26
+ let vnode;
27
+ if (import.meta.dev && import.meta.client && props.trackRootNodes) {
28
+ onMounted(() => {
29
+ nextTick(() => {
30
+ if (["#comment", "#text"].includes(vnode?.el?.nodeName)) {
31
+ const filename = vnode?.type?.__file;
32
+ console.warn(`[nuxt] \`${filename}\` does not have a single root node and will cause errors when navigating between routes.`);
33
+ }
34
+ });
35
+ });
36
+ }
37
+ return () => {
38
+ if (!props.vnode) {
39
+ return props.vnode;
40
+ }
41
+ if (import.meta.dev && import.meta.client) {
42
+ vnode = h(props.vnode, { ref: props.vnodeRef });
43
+ return vnode;
44
+ }
45
+ return h(props.vnode, { ref: props.vnodeRef });
46
+ };
47
+ }
48
+ });
49
+ export const RouteProvider = defineRouteProvider();
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ export default _default;
@@ -0,0 +1,7 @@
1
+ import { createElementBlock, defineComponent } from "vue";
2
+ export default defineComponent({
3
+ name: "ServerPlaceholder",
4
+ render() {
5
+ return createElementBlock("div");
6
+ }
7
+ });
@@ -0,0 +1,4 @@
1
+ declare const _default: (url: string) => import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ [key: string]: any;
3
+ }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ export default _default;
@@ -0,0 +1,27 @@
1
+ import { defineComponent, h } from "vue";
2
+ import { parseQuery } from "vue-router";
3
+ import { resolve } from "pathe";
4
+ import destr from "destr";
5
+ import { devRootDir } from "#build/nuxt.config.mjs";
6
+ export default (url) => defineComponent({
7
+ name: "NuxtTestComponentWrapper",
8
+ inheritAttrs: false,
9
+ async setup(props, { attrs }) {
10
+ const query = parseQuery(new URL(url, "http://localhost").search);
11
+ const urlProps = query.props ? destr(query.props) : {};
12
+ const path = resolve(query.path);
13
+ if (!path.startsWith(devRootDir)) {
14
+ throw new Error(`[nuxt] Cannot access path outside of project root directory: \`${path}\`.`);
15
+ }
16
+ const comp = await import(
17
+ /* @vite-ignore */
18
+ path
19
+ ).then((r) => r.default);
20
+ return () => [
21
+ h("div", "Component Test Wrapper for " + path),
22
+ h("div", { id: "nuxt-component-root" }, [
23
+ h(comp, { ...attrs, ...props, ...urlProps })
24
+ ])
25
+ ];
26
+ }
27
+ });
@@ -0,0 +1,48 @@
1
+ import type { RendererNode, VNode } from 'vue';
2
+ import type { RouteLocationNormalized } from 'vue-router';
3
+ /**
4
+ * Internal utility
5
+ * @private
6
+ */
7
+ export declare const _wrapInTransition: (props: any, children: any) => {
8
+ default: () => any;
9
+ };
10
+ /**
11
+ * Utility used within router guards
12
+ * return true if the route has been changed with a page change during navigation
13
+ */
14
+ export declare function isChangingPage(to: RouteLocationNormalized, from: RouteLocationNormalized): boolean;
15
+ export type SSRBuffer = SSRBufferItem[] & {
16
+ hasAsync?: boolean;
17
+ };
18
+ export type SSRBufferItem = string | SSRBuffer | Promise<SSRBuffer>;
19
+ /**
20
+ * create buffer retrieved from @vue/server-renderer
21
+ * @see https://github.com/vuejs/core/blob/9617dd4b2abc07a5dc40de6e5b759e851b4d0da1/packages/server-renderer/src/render.ts#L57
22
+ * @private
23
+ */
24
+ export declare function createBuffer(): {
25
+ getBuffer(): SSRBuffer;
26
+ push(item: SSRBufferItem): void;
27
+ };
28
+ /**
29
+ * helper for NuxtIsland to generate a correct array for scoped data
30
+ */
31
+ export declare function vforToArray(source: any): any[];
32
+ /**
33
+ * Retrieve the HTML content from an element
34
+ * Handles `<!--[-->` Fragment elements
35
+ * @param element the element to retrieve the HTML
36
+ * @param withoutSlots purge all slots from the HTML string retrieved
37
+ * @returns {string[]|undefined} An array of string which represent the content of each element. Use `.join('')` to retrieve a component vnode.el HTML
38
+ */
39
+ export declare function getFragmentHTML(element: RendererNode | null, withoutSlots?: boolean): string[] | undefined;
40
+ /**
41
+ * Return a static vnode from an element
42
+ * Default to a div if the element is not found and if a fallback is not provided
43
+ * @param el renderer node retrieved from the component internal instance
44
+ * @param staticNodeFallback fallback string to use if the element is not found. Must be a valid HTML string
45
+ */
46
+ export declare function elToStaticVNode(el: RendererNode | null, staticNodeFallback?: string): VNode;
47
+ export declare function isStartFragment(element: RendererNode): boolean;
48
+ export declare function isEndFragment(element: RendererNode): boolean;