@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,409 @@
1
+ import { computed, defineComponent, h, inject, onBeforeUnmount, onMounted, provide, ref, resolveComponent, shallowRef } from "vue";
2
+ import { hasProtocol, joinURL, parseQuery, withTrailingSlash, withoutTrailingSlash } from "ufo";
3
+ import { preloadRouteComponents } from "../composables/preload.js";
4
+ import { onNuxtReady } from "../composables/ready.js";
5
+ import { navigateTo, resolveRouteObject, useRouter } from "../composables/router.js";
6
+ import { useNuxtApp, useRuntimeConfig } from "../nuxt.js";
7
+ import { cancelIdleCallback, requestIdleCallback } from "../compat/idle-callback.js";
8
+ import { nuxtLinkDefaults } from "#build/nuxt.config.mjs";
9
+ import { hashMode } from "#build/router.options";
10
+ const firstNonUndefined = (...args) => args.find((arg) => arg !== void 0);
11
+ const NuxtLinkDevKeySymbol = Symbol("nuxt-link-dev-key");
12
+ // @__NO_SIDE_EFFECTS__
13
+ export function defineNuxtLink(options) {
14
+ const componentName = options.componentName || "NuxtLink";
15
+ function checkPropConflicts(props, main, sub) {
16
+ if (import.meta.dev && props[main] !== void 0 && props[sub] !== void 0) {
17
+ console.warn(`[${componentName}] \`${main}\` and \`${sub}\` cannot be used together. \`${sub}\` will be ignored.`);
18
+ }
19
+ }
20
+ function isHashLinkWithoutHashMode(link) {
21
+ return !hashMode && typeof link === "string" && link.startsWith("#");
22
+ }
23
+ function resolveTrailingSlashBehavior(to, resolve, trailingSlash) {
24
+ const effectiveTrailingSlash = trailingSlash ?? options.trailingSlash;
25
+ if (!to || effectiveTrailingSlash !== "append" && effectiveTrailingSlash !== "remove") {
26
+ return to;
27
+ }
28
+ if (typeof to === "string") {
29
+ return applyTrailingSlashBehavior(to, effectiveTrailingSlash);
30
+ }
31
+ const path = "path" in to && to.path !== void 0 ? to.path : resolve(to).path;
32
+ const resolvedPath = {
33
+ ...to,
34
+ name: void 0,
35
+ // named routes would otherwise always override trailing slash behavior
36
+ path: applyTrailingSlashBehavior(path, effectiveTrailingSlash)
37
+ };
38
+ return resolvedPath;
39
+ }
40
+ function useNuxtLink(props) {
41
+ const router = useRouter();
42
+ const config = useRuntimeConfig();
43
+ const hasTarget = computed(() => !!props.target && props.target !== "_self");
44
+ const isAbsoluteUrl = computed(() => {
45
+ const path = props.to || props.href || "";
46
+ return typeof path === "string" && hasProtocol(path, { acceptRelative: true });
47
+ });
48
+ const builtinRouterLink = resolveComponent("RouterLink");
49
+ const useBuiltinLink = builtinRouterLink && typeof builtinRouterLink !== "string" ? builtinRouterLink.useLink : void 0;
50
+ const isExternal = computed(() => {
51
+ if (props.external) {
52
+ return true;
53
+ }
54
+ const path = props.to || props.href || "";
55
+ if (typeof path === "object") {
56
+ return false;
57
+ }
58
+ return path === "" || isAbsoluteUrl.value;
59
+ });
60
+ const to = computed(() => {
61
+ checkPropConflicts(props, "to", "href");
62
+ const path = props.to || props.href || "";
63
+ if (isExternal.value) {
64
+ return path;
65
+ }
66
+ return resolveTrailingSlashBehavior(path, router.resolve, props.trailingSlash);
67
+ });
68
+ const link = isExternal.value ? void 0 : useBuiltinLink?.({ ...props, to });
69
+ const href = computed(() => {
70
+ const effectiveTrailingSlash = props.trailingSlash ?? options.trailingSlash;
71
+ if (!to.value || isAbsoluteUrl.value || isHashLinkWithoutHashMode(to.value)) {
72
+ return to.value;
73
+ }
74
+ if (isExternal.value) {
75
+ const path = typeof to.value === "object" && "path" in to.value ? resolveRouteObject(to.value) : to.value;
76
+ const href2 = typeof path === "object" ? router.resolve(path).href : path;
77
+ return applyTrailingSlashBehavior(href2, effectiveTrailingSlash);
78
+ }
79
+ if (typeof to.value === "object") {
80
+ return router.resolve(to.value)?.href ?? null;
81
+ }
82
+ return applyTrailingSlashBehavior(joinURL(config.app.baseURL, to.value), effectiveTrailingSlash);
83
+ });
84
+ return {
85
+ to,
86
+ hasTarget,
87
+ isAbsoluteUrl,
88
+ isExternal,
89
+ //
90
+ href,
91
+ isActive: link?.isActive ?? computed(() => to.value === router.currentRoute.value.path),
92
+ isExactActive: link?.isExactActive ?? computed(() => to.value === router.currentRoute.value.path),
93
+ route: link?.route ?? computed(() => router.resolve(to.value)),
94
+ async navigate(_e) {
95
+ await navigateTo(href.value, { replace: props.replace, external: isExternal.value || hasTarget.value });
96
+ }
97
+ };
98
+ }
99
+ return defineComponent({
100
+ name: componentName,
101
+ props: {
102
+ // Routing
103
+ to: {
104
+ type: [String, Object],
105
+ default: void 0,
106
+ required: false
107
+ },
108
+ href: {
109
+ type: [String, Object],
110
+ default: void 0,
111
+ required: false
112
+ },
113
+ // Attributes
114
+ target: {
115
+ type: String,
116
+ default: void 0,
117
+ required: false
118
+ },
119
+ rel: {
120
+ type: String,
121
+ default: void 0,
122
+ required: false
123
+ },
124
+ noRel: {
125
+ type: Boolean,
126
+ default: void 0,
127
+ required: false
128
+ },
129
+ // Prefetching
130
+ prefetch: {
131
+ type: Boolean,
132
+ default: void 0,
133
+ required: false
134
+ },
135
+ prefetchOn: {
136
+ type: [String, Object],
137
+ default: void 0,
138
+ required: false
139
+ },
140
+ noPrefetch: {
141
+ type: Boolean,
142
+ default: void 0,
143
+ required: false
144
+ },
145
+ // Styling
146
+ activeClass: {
147
+ type: String,
148
+ default: void 0,
149
+ required: false
150
+ },
151
+ exactActiveClass: {
152
+ type: String,
153
+ default: void 0,
154
+ required: false
155
+ },
156
+ prefetchedClass: {
157
+ type: String,
158
+ default: void 0,
159
+ required: false
160
+ },
161
+ // Vue Router's `<RouterLink>` additional props
162
+ replace: {
163
+ type: Boolean,
164
+ default: void 0,
165
+ required: false
166
+ },
167
+ ariaCurrentValue: {
168
+ type: String,
169
+ default: void 0,
170
+ required: false
171
+ },
172
+ // Edge cases handling
173
+ external: {
174
+ type: Boolean,
175
+ default: void 0,
176
+ required: false
177
+ },
178
+ // Slot API
179
+ custom: {
180
+ type: Boolean,
181
+ default: void 0,
182
+ required: false
183
+ },
184
+ // Behavior
185
+ trailingSlash: {
186
+ type: String,
187
+ default: void 0,
188
+ required: false
189
+ }
190
+ },
191
+ useLink: useNuxtLink,
192
+ setup(props, { slots }) {
193
+ const router = useRouter();
194
+ const { to, href, navigate, isExternal, hasTarget, isAbsoluteUrl } = useNuxtLink(props);
195
+ const prefetched = shallowRef(false);
196
+ const el = import.meta.server ? void 0 : ref(null);
197
+ const elRef = import.meta.server ? void 0 : (ref2) => {
198
+ el.value = props.custom ? ref2?.$el?.nextElementSibling : ref2?.$el;
199
+ };
200
+ function shouldPrefetch(mode) {
201
+ if (import.meta.server) {
202
+ return;
203
+ }
204
+ return !prefetched.value && (typeof props.prefetchOn === "string" ? props.prefetchOn === mode : props.prefetchOn?.[mode] ?? options.prefetchOn?.[mode]) && (props.prefetch ?? options.prefetch) !== false && props.noPrefetch !== true && props.target !== "_blank" && !isSlowConnection();
205
+ }
206
+ async function prefetch(nuxtApp = useNuxtApp()) {
207
+ if (import.meta.server) {
208
+ return;
209
+ }
210
+ if (prefetched.value) {
211
+ return;
212
+ }
213
+ prefetched.value = true;
214
+ const path = typeof to.value === "string" ? to.value : isExternal.value ? resolveRouteObject(to.value) : router.resolve(to.value).fullPath;
215
+ const normalizedPath = isExternal.value ? new URL(path, window.location.href).href : path;
216
+ await Promise.all([
217
+ nuxtApp.hooks.callHook("link:prefetch", normalizedPath).catch(() => {
218
+ }),
219
+ !isExternal.value && !hasTarget.value && preloadRouteComponents(to.value, router).catch(() => {
220
+ })
221
+ ]);
222
+ }
223
+ if (import.meta.client) {
224
+ checkPropConflicts(props, "noPrefetch", "prefetch");
225
+ if (shouldPrefetch("visibility")) {
226
+ const nuxtApp = useNuxtApp();
227
+ let idleId;
228
+ let unobserve = null;
229
+ onMounted(() => {
230
+ const observer = useObserver();
231
+ onNuxtReady(() => {
232
+ idleId = requestIdleCallback(() => {
233
+ if (el?.value?.tagName) {
234
+ unobserve = observer.observe(el.value, async () => {
235
+ unobserve?.();
236
+ unobserve = null;
237
+ await prefetch(nuxtApp);
238
+ });
239
+ }
240
+ });
241
+ });
242
+ });
243
+ onBeforeUnmount(() => {
244
+ if (idleId) {
245
+ cancelIdleCallback(idleId);
246
+ }
247
+ unobserve?.();
248
+ unobserve = null;
249
+ });
250
+ }
251
+ }
252
+ if (import.meta.dev && import.meta.server && !props.custom) {
253
+ const isNuxtLinkChild = inject(NuxtLinkDevKeySymbol, false);
254
+ if (isNuxtLinkChild) {
255
+ console.log("[nuxt] [NuxtLink] You can't nest one <a> inside another <a>. This will cause a hydration error on client-side. You can pass the `custom` prop to take full control of the markup.");
256
+ } else {
257
+ provide(NuxtLinkDevKeySymbol, true);
258
+ }
259
+ }
260
+ return () => {
261
+ if (!isExternal.value && !hasTarget.value && !isHashLinkWithoutHashMode(to.value)) {
262
+ const routerLinkProps = {
263
+ ref: elRef,
264
+ to: to.value,
265
+ activeClass: props.activeClass || options.activeClass,
266
+ exactActiveClass: props.exactActiveClass || options.exactActiveClass,
267
+ replace: props.replace,
268
+ ariaCurrentValue: props.ariaCurrentValue,
269
+ custom: props.custom
270
+ };
271
+ if (!props.custom) {
272
+ if (import.meta.client) {
273
+ if (shouldPrefetch("interaction")) {
274
+ routerLinkProps.onPointerenter = prefetch.bind(null, void 0);
275
+ routerLinkProps.onFocus = prefetch.bind(null, void 0);
276
+ }
277
+ if (prefetched.value) {
278
+ routerLinkProps.class = props.prefetchedClass || options.prefetchedClass;
279
+ }
280
+ }
281
+ routerLinkProps.rel = props.rel || void 0;
282
+ }
283
+ return h(
284
+ resolveComponent("RouterLink"),
285
+ routerLinkProps,
286
+ slots.default
287
+ );
288
+ }
289
+ const target = props.target || null;
290
+ checkPropConflicts(props, "noRel", "rel");
291
+ const rel = firstNonUndefined(
292
+ // converts `""` to `null` to prevent the attribute from being added as empty (`rel=""`)
293
+ props.noRel ? "" : props.rel,
294
+ options.externalRelAttribute,
295
+ /*
296
+ * A fallback rel of `noopener noreferrer` is applied for external links or links that open in a new tab.
297
+ * This solves a reverse tabnapping security flaw in browsers pre-2021 as well as improving privacy.
298
+ */
299
+ isAbsoluteUrl.value || hasTarget.value ? "noopener noreferrer" : ""
300
+ ) || null;
301
+ if (props.custom) {
302
+ if (!slots.default) {
303
+ return null;
304
+ }
305
+ return slots.default({
306
+ href: href.value,
307
+ navigate,
308
+ prefetch,
309
+ get route() {
310
+ if (!href.value) {
311
+ return void 0;
312
+ }
313
+ const url = new URL(href.value, import.meta.client ? window.location.href : "http://localhost");
314
+ return {
315
+ path: url.pathname,
316
+ fullPath: url.pathname,
317
+ get query() {
318
+ return parseQuery(url.search);
319
+ },
320
+ hash: url.hash,
321
+ params: {},
322
+ name: void 0,
323
+ matched: [],
324
+ redirectedFrom: void 0,
325
+ meta: {},
326
+ href: href.value
327
+ };
328
+ },
329
+ rel,
330
+ target,
331
+ isExternal: isExternal.value || hasTarget.value,
332
+ isActive: false,
333
+ isExactActive: false
334
+ });
335
+ }
336
+ return h("a", {
337
+ ref: el,
338
+ href: href.value || null,
339
+ // converts `""` to `null` to prevent the attribute from being added as empty (`href=""`)
340
+ rel,
341
+ target,
342
+ onClick: (event) => {
343
+ if (isExternal.value || hasTarget.value) {
344
+ return;
345
+ }
346
+ event.preventDefault();
347
+ return props.replace ? router.replace(href.value) : router.push(href.value);
348
+ }
349
+ }, slots.default?.());
350
+ };
351
+ }
352
+ });
353
+ }
354
+ export default /* @__PURE__ */ defineNuxtLink(nuxtLinkDefaults);
355
+ function applyTrailingSlashBehavior(to, trailingSlash) {
356
+ const normalizeFn = trailingSlash === "append" ? withTrailingSlash : withoutTrailingSlash;
357
+ const hasProtocolDifferentFromHttp = hasProtocol(to) && !to.startsWith("http");
358
+ if (hasProtocolDifferentFromHttp) {
359
+ return to;
360
+ }
361
+ return normalizeFn(to, true);
362
+ }
363
+ function useObserver() {
364
+ if (import.meta.server) {
365
+ return;
366
+ }
367
+ const nuxtApp = useNuxtApp();
368
+ if (nuxtApp._observer) {
369
+ return nuxtApp._observer;
370
+ }
371
+ let observer = null;
372
+ const callbacks = /* @__PURE__ */ new Map();
373
+ const observe = (element, callback) => {
374
+ observer ||= new IntersectionObserver((entries) => {
375
+ for (const entry of entries) {
376
+ const callback2 = callbacks.get(entry.target);
377
+ const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
378
+ if (isVisible && callback2) {
379
+ callback2();
380
+ }
381
+ }
382
+ });
383
+ callbacks.set(element, callback);
384
+ observer.observe(element);
385
+ return () => {
386
+ callbacks.delete(element);
387
+ observer?.unobserve(element);
388
+ if (callbacks.size === 0) {
389
+ observer?.disconnect();
390
+ observer = null;
391
+ }
392
+ };
393
+ };
394
+ const _observer = nuxtApp._observer = {
395
+ observe
396
+ };
397
+ return _observer;
398
+ }
399
+ const IS_2G_RE = /2g/;
400
+ function isSlowConnection() {
401
+ if (import.meta.server) {
402
+ return;
403
+ }
404
+ const cn = navigator.connection;
405
+ if (cn && (cn.saveData || IS_2G_RE.test(cn.effectiveType))) {
406
+ return true;
407
+ }
408
+ return false;
409
+ }
@@ -0,0 +1,78 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ throttle: {
3
+ type: NumberConstructor;
4
+ default: number;
5
+ };
6
+ duration: {
7
+ type: NumberConstructor;
8
+ default: number;
9
+ };
10
+ hideDelay: {
11
+ type: NumberConstructor;
12
+ default: number;
13
+ };
14
+ resetDelay: {
15
+ type: NumberConstructor;
16
+ default: number;
17
+ };
18
+ height: {
19
+ type: NumberConstructor;
20
+ default: number;
21
+ };
22
+ color: {
23
+ type: (BooleanConstructor | StringConstructor)[];
24
+ default: string;
25
+ };
26
+ errorColor: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ estimatedProgress: {
31
+ type: () => (duration: number, elapsed: number) => number;
32
+ required: false;
33
+ };
34
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
35
+ [key: string]: any;
36
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
37
+ throttle: {
38
+ type: NumberConstructor;
39
+ default: number;
40
+ };
41
+ duration: {
42
+ type: NumberConstructor;
43
+ default: number;
44
+ };
45
+ hideDelay: {
46
+ type: NumberConstructor;
47
+ default: number;
48
+ };
49
+ resetDelay: {
50
+ type: NumberConstructor;
51
+ default: number;
52
+ };
53
+ height: {
54
+ type: NumberConstructor;
55
+ default: number;
56
+ };
57
+ color: {
58
+ type: (BooleanConstructor | StringConstructor)[];
59
+ default: string;
60
+ };
61
+ errorColor: {
62
+ type: StringConstructor;
63
+ default: string;
64
+ };
65
+ estimatedProgress: {
66
+ type: () => (duration: number, elapsed: number) => number;
67
+ required: false;
68
+ };
69
+ }>> & Readonly<{}>, {
70
+ duration: number;
71
+ height: number;
72
+ throttle: number;
73
+ hideDelay: number;
74
+ resetDelay: number;
75
+ color: string | boolean;
76
+ errorColor: string;
77
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
78
+ export default _default;
@@ -0,0 +1,75 @@
1
+ import { defineComponent, h } from "vue";
2
+ import { useLoadingIndicator } from "../composables/loading-indicator.js";
3
+ export default defineComponent({
4
+ name: "NuxtLoadingIndicator",
5
+ props: {
6
+ throttle: {
7
+ type: Number,
8
+ default: 200
9
+ },
10
+ duration: {
11
+ type: Number,
12
+ default: 2e3
13
+ },
14
+ hideDelay: {
15
+ type: Number,
16
+ default: 500
17
+ },
18
+ resetDelay: {
19
+ type: Number,
20
+ default: 400
21
+ },
22
+ height: {
23
+ type: Number,
24
+ default: 3
25
+ },
26
+ color: {
27
+ type: [String, Boolean],
28
+ default: "repeating-linear-gradient(to right,#00dc82 0%,#34cdfe 50%,#0047e1 100%)"
29
+ },
30
+ errorColor: {
31
+ type: String,
32
+ default: "repeating-linear-gradient(to right,#f87171 0%,#ef4444 100%)"
33
+ },
34
+ estimatedProgress: {
35
+ type: Function,
36
+ required: false
37
+ }
38
+ },
39
+ setup(props, { slots, expose }) {
40
+ const { progress, isLoading, error, start, finish, clear } = useLoadingIndicator({
41
+ duration: props.duration,
42
+ throttle: props.throttle,
43
+ hideDelay: props.hideDelay,
44
+ resetDelay: props.resetDelay,
45
+ estimatedProgress: props.estimatedProgress
46
+ });
47
+ expose({
48
+ progress,
49
+ isLoading,
50
+ error,
51
+ start,
52
+ finish,
53
+ clear
54
+ });
55
+ return () => h("div", {
56
+ class: "nuxt-loading-indicator",
57
+ style: {
58
+ position: "fixed",
59
+ top: 0,
60
+ right: 0,
61
+ left: 0,
62
+ pointerEvents: "none",
63
+ width: "auto",
64
+ height: `${props.height}px`,
65
+ opacity: isLoading.value ? 1 : 0,
66
+ background: error.value ? props.errorColor : props.color || void 0,
67
+ backgroundSize: `${progress.value > 0 ? 100 / progress.value * 100 : 0}% auto`,
68
+ transform: `scaleX(${progress.value}%)`,
69
+ transformOrigin: "left",
70
+ transition: "transform 0.1s, height 0.4s, opacity 0.4s",
71
+ zIndex: 999999
72
+ }
73
+ }, slots);
74
+ }
75
+ });
@@ -0,0 +1,3 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <Suspense @resolve="onResolve">
3
+ <div v-if="abortRender" />
4
+ <ErrorComponent
5
+ v-else-if="error"
6
+ :error="error"
7
+ />
8
+ <IslandRenderer
9
+ v-else-if="islandContext"
10
+ :context="islandContext"
11
+ />
12
+ <component
13
+ :is="SingleRenderer"
14
+ v-else-if="SingleRenderer"
15
+ />
16
+ <AppComponent v-else />
17
+ </Suspense>
18
+ </template>
19
+
20
+ <script setup>
21
+ import { defineAsyncComponent, onErrorCaptured, onServerPrefetch, provide } from "vue";
22
+ import { useNuxtApp } from "../nuxt";
23
+ import { isNuxtError, showError, useError } from "../composables/error";
24
+ import { useRoute, useRouter } from "../composables/router";
25
+ import { PageRouteSymbol } from "../components/injections";
26
+ import AppComponent from "#build/app-component.mjs";
27
+ import ErrorComponent from "#build/error-component.mjs";
28
+ import { componentIslands } from "#build/nuxt.config.mjs";
29
+ const IslandRenderer = import.meta.server && componentIslands ? defineAsyncComponent(() => import("./island-renderer").then((r) => r.default || r)) : () => null;
30
+ const nuxtApp = useNuxtApp();
31
+ const onResolve = nuxtApp.deferHydration();
32
+ if (import.meta.client && nuxtApp.isHydrating) {
33
+ const removeErrorHook = nuxtApp.hooks.hookOnce("app:error", onResolve);
34
+ useRouter().beforeEach(removeErrorHook);
35
+ }
36
+ const url = import.meta.server ? nuxtApp.ssrContext.url : window.location.pathname;
37
+ const SingleRenderer = import.meta.test && import.meta.dev && import.meta.server && url.startsWith("/__nuxt_component_test__/") && defineAsyncComponent(() => import("#build/test-component-wrapper.mjs").then((r) => r.default(import.meta.server ? url : window.location.href)));
38
+ provide(PageRouteSymbol, useRoute());
39
+ const results = nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
40
+ if (import.meta.dev && results && results.some((i) => i && "then" in i)) {
41
+ console.error("[nuxt] Error in `vue:setup`. Callbacks must be synchronous.");
42
+ }
43
+ const error = useError();
44
+ const abortRender = import.meta.server && error.value && !nuxtApp.ssrContext.error;
45
+ const BOT_RE = /bot\b|chrome-lighthouse|facebookexternalhit|google\b/i;
46
+ onErrorCaptured((err, target, info) => {
47
+ nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
48
+ if (import.meta.client && BOT_RE.test(navigator.userAgent)) {
49
+ nuxtApp.hooks.callHook("app:error", err);
50
+ console.error(`[nuxt] Not rendering error page for bot with user agent \`${navigator.userAgent}\`:`, err);
51
+ return false;
52
+ }
53
+ if (import.meta.server || isNuxtError(err) && (err.fatal || err.unhandled)) {
54
+ const p = nuxtApp.runWithContext(() => showError(err));
55
+ onServerPrefetch(() => p);
56
+ return false;
57
+ }
58
+ });
59
+ const islandContext = import.meta.server && nuxtApp.ssrContext.islandContext;
60
+ </script>
@@ -0,0 +1,3 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,26 @@
1
+ import type { Politeness } from 'nuxt/app';
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
3
+ atomic: {
4
+ type: BooleanConstructor;
5
+ default: boolean;
6
+ };
7
+ politeness: {
8
+ type: () => Politeness;
9
+ default: string;
10
+ };
11
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
12
+ [key: string]: any;
13
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
14
+ atomic: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ politeness: {
19
+ type: () => Politeness;
20
+ default: string;
21
+ };
22
+ }>> & Readonly<{}>, {
23
+ politeness: Politeness;
24
+ atomic: boolean;
25
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ export default _default;