initial commit
This commit is contained in:
22
node_modules/nuxt/dist/app/components/client-only.d.mts
generated
vendored
Normal file
22
node_modules/nuxt/dist/app/components/client-only.d.mts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export function createClientOnly(component: any): any;
|
||||
declare const _default: import("vue").DefineComponent<Readonly<{
|
||||
fallback?: any;
|
||||
placeholder?: any;
|
||||
placeholderTag?: any;
|
||||
fallbackTag?: any;
|
||||
}>, (props: any) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}> | undefined, any, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<Readonly<{
|
||||
fallback?: any;
|
||||
placeholder?: any;
|
||||
placeholderTag?: any;
|
||||
fallbackTag?: any;
|
||||
}>>>, {
|
||||
readonly fallback?: any;
|
||||
readonly placeholder?: any;
|
||||
readonly placeholderTag?: any;
|
||||
readonly fallbackTag?: any;
|
||||
}>;
|
||||
export default _default;
|
||||
75
node_modules/nuxt/dist/app/components/client-only.mjs
generated
vendored
Normal file
75
node_modules/nuxt/dist/app/components/client-only.mjs
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import { ref, onMounted, defineComponent, createElementBlock, h, createElementVNode } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ClientOnly',
|
||||
inheritAttrs: false,
|
||||
// eslint-disable-next-line vue/require-prop-types
|
||||
props: ['fallback', 'placeholder', 'placeholderTag', 'fallbackTag'],
|
||||
setup (_, { slots, attrs }) {
|
||||
const mounted = ref(false)
|
||||
onMounted(() => { mounted.value = true })
|
||||
return (props) => {
|
||||
if (mounted.value) { return slots.default?.() }
|
||||
const slot = slots.fallback || slots.placeholder
|
||||
if (slot) { return slot() }
|
||||
const fallbackStr = props.fallback || props.placeholder || ''
|
||||
const fallbackTag = props.fallbackTag || props.placeholderTag || 'span'
|
||||
return createElementBlock(fallbackTag, attrs, fallbackStr)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const cache = new WeakMap()
|
||||
|
||||
export function createClientOnly (component) {
|
||||
if (cache.has(component)) {
|
||||
return cache.get(component)
|
||||
}
|
||||
|
||||
const clone = { ...component }
|
||||
|
||||
if (clone.render) {
|
||||
// override the component render (non script setup component)
|
||||
clone.render = (ctx, ...args) => {
|
||||
if (ctx.mounted$) {
|
||||
const res = component.render(ctx, ...args)
|
||||
return (res.children === null || typeof res.children === 'string')
|
||||
? createElementVNode(res.type, res.props, res.children, res.patchFlag, res.dynamicProps, res.shapeFlag)
|
||||
: h(res)
|
||||
} else {
|
||||
return h('div', ctx.$attrs ?? ctx._.attrs)
|
||||
}
|
||||
}
|
||||
} else if (clone.template) {
|
||||
// handle runtime-compiler template
|
||||
clone.template = `
|
||||
<template v-if="mounted$">${component.template}</template>
|
||||
<template v-else><div></div></template>
|
||||
`
|
||||
}
|
||||
|
||||
clone.setup = (props, ctx) => {
|
||||
const mounted$ = ref(false)
|
||||
onMounted(() => { mounted$.value = true })
|
||||
|
||||
return Promise.resolve(component.setup?.(props, ctx) || {})
|
||||
.then((setupState) => {
|
||||
return typeof setupState !== 'function'
|
||||
? { ...setupState, mounted$ }
|
||||
: (...args) => {
|
||||
if (mounted$.value) {
|
||||
const res = setupState(...args)
|
||||
return (res.children === null || typeof res.children === 'string')
|
||||
? createElementVNode(res.type, res.props, res.children, res.patchFlag, res.dynamicProps, res.shapeFlag)
|
||||
: h(res)
|
||||
} else {
|
||||
return h('div', ctx.attrs)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
cache.set(component, clone)
|
||||
|
||||
return clone
|
||||
}
|
||||
4
node_modules/nuxt/dist/app/components/dev-only.d.mts
generated
vendored
Normal file
4
node_modules/nuxt/dist/app/components/dev-only.d.mts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
declare const _default: import("vue").DefineComponent<{}, (() => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined) | (() => null), {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
||||
export default _default;
|
||||
11
node_modules/nuxt/dist/app/components/dev-only.mjs
generated
vendored
Normal file
11
node_modules/nuxt/dist/app/components/dev-only.mjs
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'DevOnly',
|
||||
setup (_, props) {
|
||||
if (process.dev) {
|
||||
return () => props.slots.default?.()
|
||||
}
|
||||
return () => null
|
||||
}
|
||||
})
|
||||
2
node_modules/nuxt/dist/app/components/index.d.ts
generated
vendored
Normal file
2
node_modules/nuxt/dist/app/components/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export { defineNuxtLink } from './nuxt-link';
|
||||
export type { NuxtLinkOptions, NuxtLinkProps } from './nuxt-link';
|
||||
1
node_modules/nuxt/dist/app/components/index.mjs
generated
vendored
Normal file
1
node_modules/nuxt/dist/app/components/index.mjs
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { defineNuxtLink } from "./nuxt-link.mjs";
|
||||
17
node_modules/nuxt/dist/app/components/layout.d.ts
generated
vendored
Normal file
17
node_modules/nuxt/dist/app/components/layout.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Ref, VNode } from 'vue';
|
||||
declare const _default: import("vue").DefineComponent<{
|
||||
name: {
|
||||
type: () => string | false | Ref<string | false>;
|
||||
default: null;
|
||||
};
|
||||
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
name: {
|
||||
type: () => string | false | Ref<string | false>;
|
||||
default: null;
|
||||
};
|
||||
}>>, {
|
||||
name: string | false | Ref<string | false>;
|
||||
}>;
|
||||
export default _default;
|
||||
66
node_modules/nuxt/dist/app/components/layout.mjs
generated
vendored
Normal file
66
node_modules/nuxt/dist/app/components/layout.mjs
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
import { computed, defineComponent, h, inject, nextTick, onMounted, Transition, unref } from "vue";
|
||||
import { _wrapIf } from "./utils.mjs";
|
||||
import { useRoute } from "#app";
|
||||
import { useRoute as useVueRouterRoute } from "#build/pages";
|
||||
import layouts from "#build/layouts";
|
||||
import { appLayoutTransition as defaultLayoutTransition } from "#build/nuxt.config.mjs";
|
||||
const LayoutLoader = defineComponent({
|
||||
props: {
|
||||
name: String,
|
||||
...process.dev ? { hasTransition: Boolean } : {}
|
||||
},
|
||||
async setup(props, context) {
|
||||
let vnode;
|
||||
if (process.dev && process.client) {
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
if (props.name && ["#comment", "#text"].includes(vnode?.el?.nodeName)) {
|
||||
console.warn(`[nuxt] \`${props.name}\` layout does not have a single root node and will cause errors when navigating between routes.`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
const LayoutComponent = await layouts[props.name]().then((r) => r.default || r);
|
||||
return () => {
|
||||
if (process.dev && process.client && props.hasTransition) {
|
||||
vnode = h(LayoutComponent, {}, context.slots);
|
||||
return vnode;
|
||||
}
|
||||
return h(LayoutComponent, {}, context.slots);
|
||||
};
|
||||
}
|
||||
});
|
||||
export default defineComponent({
|
||||
props: {
|
||||
name: {
|
||||
type: [String, Boolean, Object],
|
||||
default: null
|
||||
}
|
||||
},
|
||||
setup(props, context) {
|
||||
const injectedRoute = inject("_route");
|
||||
const route = injectedRoute === useRoute() ? useVueRouterRoute() : injectedRoute;
|
||||
const layout = computed(() => unref(props.name) ?? route.meta.layout ?? "default");
|
||||
let vnode;
|
||||
let _layout;
|
||||
if (process.dev && process.client) {
|
||||
onMounted(() => {
|
||||
nextTick(() => {
|
||||
if (_layout && _layout in layouts && ["#comment", "#text"].includes(vnode?.el?.nodeName)) {
|
||||
console.warn(`[nuxt] \`${_layout}\` layout does not have a single root node and will cause errors when navigating between routes.`);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
const hasLayout = layout.value && layout.value in layouts;
|
||||
if (process.dev && layout.value && !hasLayout && layout.value !== "default") {
|
||||
console.warn(`Invalid layout \`${layout.value}\` selected.`);
|
||||
}
|
||||
const transitionProps = route.meta.layoutTransition ?? defaultLayoutTransition;
|
||||
return _wrapIf(Transition, hasLayout && transitionProps, {
|
||||
default: () => _wrapIf(LayoutLoader, hasLayout && { key: layout.value, name: layout.value, hasTransition: process.dev ? !!transitionProps : void 0 }, context.slots).default()
|
||||
}).default();
|
||||
};
|
||||
}
|
||||
});
|
||||
8
node_modules/nuxt/dist/app/components/nuxt-error-boundary.d.ts
generated
vendored
Normal file
8
node_modules/nuxt/dist/app/components/nuxt-error-boundary.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
declare const _default: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
||||
error(_error: unknown): boolean;
|
||||
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>> & {
|
||||
onError?: ((_error: unknown) => any) | undefined;
|
||||
}, {}>;
|
||||
export default _default;
|
||||
21
node_modules/nuxt/dist/app/components/nuxt-error-boundary.mjs
generated
vendored
Normal file
21
node_modules/nuxt/dist/app/components/nuxt-error-boundary.mjs
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { defineComponent, ref, onErrorCaptured } from "vue";
|
||||
import { useNuxtApp } from "#app";
|
||||
export default defineComponent({
|
||||
emits: {
|
||||
error(_error) {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
setup(_props, { slots, emit }) {
|
||||
const error = ref(null);
|
||||
const nuxtApp = useNuxtApp();
|
||||
onErrorCaptured((err) => {
|
||||
if (process.client && !nuxtApp.isHydrating) {
|
||||
emit("error", err);
|
||||
error.value = err;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return () => error.value ? slots.error?.({ error }) : slots.default?.();
|
||||
}
|
||||
});
|
||||
46
node_modules/nuxt/dist/app/components/nuxt-error-page.vue
generated
vendored
Normal file
46
node_modules/nuxt/dist/app/components/nuxt-error-page.vue
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<ErrorTemplate v-bind="{ statusCode, statusMessage, description, stack }" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineAsyncComponent } from 'vue'
|
||||
|
||||
// Deliberately prevent reactive update when error is cleared
|
||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
||||
const { error } = defineProps({
|
||||
error: Object
|
||||
})
|
||||
|
||||
// TODO: extract to a separate utility
|
||||
const stacktrace = (error.stack || '')
|
||||
.split('\n')
|
||||
.splice(1)
|
||||
.map((line) => {
|
||||
const text = line
|
||||
.replace('webpack:/', '')
|
||||
.replace('.vue', '.js') // TODO: Support sourcemap
|
||||
.trim()
|
||||
return {
|
||||
text,
|
||||
internal: (line.includes('node_modules') && !line.includes('.cache')) ||
|
||||
line.includes('internal') ||
|
||||
line.includes('new Promise')
|
||||
}
|
||||
}).map(i => `<span class="stack${i.internal ? ' internal' : ''}">${i.text}</span>`).join('\n')
|
||||
|
||||
// Error page props
|
||||
const statusCode = Number(error.statusCode || 500)
|
||||
const is404 = statusCode === 404
|
||||
|
||||
const statusMessage = error.statusMessage ?? (is404 ? 'Page Not Found' : 'Internal Server Error')
|
||||
const description = error.message || error.toString()
|
||||
const stack = process.dev && !is404 ? error.description || `<pre>${stacktrace}</pre>` : undefined
|
||||
|
||||
// TODO: Investigate side-effect issue with imports
|
||||
const _Error404 = defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-404.vue').then(r => r.default || r))
|
||||
const _Error = process.dev
|
||||
? defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-dev.vue').then(r => r.default || r))
|
||||
: defineAsyncComponent(() => import('@nuxt/ui-templates/templates/error-500.vue').then(r => r.default || r))
|
||||
|
||||
const ErrorTemplate = is404 ? _Error404 : _Error
|
||||
</script>
|
||||
27
node_modules/nuxt/dist/app/components/nuxt-link.d.ts
generated
vendored
Normal file
27
node_modules/nuxt/dist/app/components/nuxt-link.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { DefineComponent } from 'vue';
|
||||
import type { RouteLocationRaw } from 'vue-router';
|
||||
export type NuxtLinkOptions = {
|
||||
componentName?: string;
|
||||
externalRelAttribute?: string | null;
|
||||
activeClass?: string;
|
||||
exactActiveClass?: string;
|
||||
prefetchedClass?: string;
|
||||
};
|
||||
export type NuxtLinkProps = {
|
||||
to?: string | RouteLocationRaw;
|
||||
href?: string | RouteLocationRaw;
|
||||
external?: boolean;
|
||||
replace?: boolean;
|
||||
custom?: boolean;
|
||||
target?: '_blank' | '_parent' | '_self' | '_top' | (string & {}) | null;
|
||||
rel?: string | null;
|
||||
noRel?: boolean;
|
||||
prefetch?: boolean;
|
||||
noPrefetch?: boolean;
|
||||
activeClass?: string;
|
||||
exactActiveClass?: string;
|
||||
ariaCurrentValue?: string;
|
||||
};
|
||||
export declare function defineNuxtLink(options: NuxtLinkOptions): DefineComponent<NuxtLinkProps, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<NuxtLinkProps>, {}>;
|
||||
declare const _default: DefineComponent<NuxtLinkProps, {}, {}, import("vue").ComputedOptions, import("vue").MethodOptions, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<NuxtLinkProps>, {}>;
|
||||
export default _default;
|
||||
248
node_modules/nuxt/dist/app/components/nuxt-link.mjs
generated
vendored
Normal file
248
node_modules/nuxt/dist/app/components/nuxt-link.mjs
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
import { defineComponent, h, ref, resolveComponent, computed, onMounted, onBeforeUnmount } from "vue";
|
||||
import { hasProtocol } from "ufo";
|
||||
import { preloadRouteComponents } from "../composables/preload.mjs";
|
||||
import { navigateTo, useRouter } from "../composables/router.mjs";
|
||||
import { useNuxtApp } from "../nuxt.mjs";
|
||||
const firstNonUndefined = (...args) => args.find((arg) => arg !== void 0);
|
||||
const DEFAULT_EXTERNAL_REL_ATTRIBUTE = "noopener noreferrer";
|
||||
const requestIdleCallback = process.server ? void 0 : globalThis.requestIdleCallback || ((cb) => {
|
||||
const start = Date.now();
|
||||
const idleDeadline = {
|
||||
didTimeout: false,
|
||||
timeRemaining: () => Math.max(0, 50 - (Date.now() - start))
|
||||
};
|
||||
return setTimeout(() => {
|
||||
cb(idleDeadline);
|
||||
}, 1);
|
||||
});
|
||||
const cancelIdleCallback = process.server ? null : globalThis.cancelIdleCallback || ((id) => {
|
||||
clearTimeout(id);
|
||||
});
|
||||
export function defineNuxtLink(options) {
|
||||
const componentName = options.componentName || "NuxtLink";
|
||||
const checkPropConflicts = (props, main, sub) => {
|
||||
if (process.dev && props[main] !== void 0 && props[sub] !== void 0) {
|
||||
console.warn(`[${componentName}] \`${main}\` and \`${sub}\` cannot be used together. \`${sub}\` will be ignored.`);
|
||||
}
|
||||
};
|
||||
return defineComponent({
|
||||
name: componentName,
|
||||
props: {
|
||||
to: {
|
||||
type: [String, Object],
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
href: {
|
||||
type: [String, Object],
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
target: {
|
||||
type: String,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
rel: {
|
||||
type: String,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
noRel: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
prefetch: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
noPrefetch: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
activeClass: {
|
||||
type: String,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
exactActiveClass: {
|
||||
type: String,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
prefetchedClass: {
|
||||
type: String,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
replace: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
ariaCurrentValue: {
|
||||
type: String,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
external: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
},
|
||||
custom: {
|
||||
type: Boolean,
|
||||
default: void 0,
|
||||
required: false
|
||||
}
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const router = useRouter();
|
||||
const to = computed(() => {
|
||||
checkPropConflicts(props, "to", "href");
|
||||
return props.to || props.href || "";
|
||||
});
|
||||
const isExternal = computed(() => {
|
||||
if (props.external) {
|
||||
return true;
|
||||
}
|
||||
if (props.target && props.target !== "_self") {
|
||||
return true;
|
||||
}
|
||||
if (typeof to.value === "object") {
|
||||
return false;
|
||||
}
|
||||
return to.value === "" || hasProtocol(to.value, true);
|
||||
});
|
||||
const prefetched = ref(false);
|
||||
const el = process.server ? void 0 : ref(null);
|
||||
if (process.client) {
|
||||
checkPropConflicts(props, "prefetch", "noPrefetch");
|
||||
const shouldPrefetch = props.prefetch !== false && props.noPrefetch !== true && typeof to.value === "string" && props.target !== "_blank" && !isSlowConnection();
|
||||
if (shouldPrefetch) {
|
||||
const nuxtApp = useNuxtApp();
|
||||
const observer = useObserver();
|
||||
let idleId;
|
||||
let unobserve = null;
|
||||
onMounted(() => {
|
||||
idleId = requestIdleCallback(() => {
|
||||
if (el?.value?.tagName) {
|
||||
unobserve = observer.observe(el.value, async () => {
|
||||
unobserve?.();
|
||||
unobserve = null;
|
||||
await Promise.all([
|
||||
nuxtApp.hooks.callHook("link:prefetch", to.value).catch(() => {
|
||||
}),
|
||||
!isExternal.value && preloadRouteComponents(to.value, router).catch(() => {
|
||||
})
|
||||
]);
|
||||
prefetched.value = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
onBeforeUnmount(() => {
|
||||
if (idleId) {
|
||||
cancelIdleCallback(idleId);
|
||||
}
|
||||
unobserve?.();
|
||||
unobserve = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
return () => {
|
||||
if (!isExternal.value) {
|
||||
return h(
|
||||
resolveComponent("RouterLink"),
|
||||
{
|
||||
ref: process.server ? void 0 : (ref2) => {
|
||||
el.value = ref2?.$el;
|
||||
},
|
||||
to: to.value,
|
||||
...prefetched.value && !props.custom ? { class: props.prefetchedClass || options.prefetchedClass } : {},
|
||||
activeClass: props.activeClass || options.activeClass,
|
||||
exactActiveClass: props.exactActiveClass || options.exactActiveClass,
|
||||
replace: props.replace,
|
||||
ariaCurrentValue: props.ariaCurrentValue,
|
||||
custom: props.custom
|
||||
},
|
||||
slots.default
|
||||
);
|
||||
}
|
||||
const href = typeof to.value === "object" ? router.resolve(to.value)?.href ?? null : to.value || null;
|
||||
const target = props.target || null;
|
||||
checkPropConflicts(props, "noRel", "rel");
|
||||
const rel = props.noRel ? null : firstNonUndefined(props.rel, options.externalRelAttribute, href ? DEFAULT_EXTERNAL_REL_ATTRIBUTE : "") || null;
|
||||
const navigate = () => navigateTo(href, { replace: props.replace });
|
||||
if (props.custom) {
|
||||
if (!slots.default) {
|
||||
return null;
|
||||
}
|
||||
return slots.default({
|
||||
href,
|
||||
navigate,
|
||||
route: router.resolve(href),
|
||||
rel,
|
||||
target,
|
||||
isExternal: isExternal.value,
|
||||
isActive: false,
|
||||
isExactActive: false
|
||||
});
|
||||
}
|
||||
return h("a", { ref: el, href, rel, target }, slots.default?.());
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
export default defineNuxtLink({ componentName: "NuxtLink" });
|
||||
function useObserver() {
|
||||
if (process.server) {
|
||||
return;
|
||||
}
|
||||
const nuxtApp = useNuxtApp();
|
||||
if (nuxtApp._observer) {
|
||||
return nuxtApp._observer;
|
||||
}
|
||||
let observer = null;
|
||||
const callbacks = /* @__PURE__ */ new Map();
|
||||
const observe = (element, callback) => {
|
||||
if (!observer) {
|
||||
observer = new IntersectionObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
const callback2 = callbacks.get(entry.target);
|
||||
const isVisible = entry.isIntersecting || entry.intersectionRatio > 0;
|
||||
if (isVisible && callback2) {
|
||||
callback2();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
callbacks.set(element, callback);
|
||||
observer.observe(element);
|
||||
return () => {
|
||||
callbacks.delete(element);
|
||||
observer.unobserve(element);
|
||||
if (callbacks.size === 0) {
|
||||
observer.disconnect();
|
||||
observer = null;
|
||||
}
|
||||
};
|
||||
};
|
||||
const _observer = nuxtApp._observer = {
|
||||
observe
|
||||
};
|
||||
return _observer;
|
||||
}
|
||||
function isSlowConnection() {
|
||||
if (process.server) {
|
||||
return;
|
||||
}
|
||||
const cn = navigator.connection;
|
||||
if (cn && (cn.saveData || /2g/.test(cn.effectiveType))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
43
node_modules/nuxt/dist/app/components/nuxt-loading-indicator.d.ts
generated
vendored
Normal file
43
node_modules/nuxt/dist/app/components/nuxt-loading-indicator.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
declare const _default: import("vue").DefineComponent<{
|
||||
throttle: {
|
||||
type: NumberConstructor;
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: NumberConstructor;
|
||||
default: number;
|
||||
};
|
||||
height: {
|
||||
type: NumberConstructor;
|
||||
default: number;
|
||||
};
|
||||
color: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
||||
throttle: {
|
||||
type: NumberConstructor;
|
||||
default: number;
|
||||
};
|
||||
duration: {
|
||||
type: NumberConstructor;
|
||||
default: number;
|
||||
};
|
||||
height: {
|
||||
type: NumberConstructor;
|
||||
default: number;
|
||||
};
|
||||
color: {
|
||||
type: StringConstructor;
|
||||
default: string;
|
||||
};
|
||||
}>>, {
|
||||
throttle: number;
|
||||
duration: number;
|
||||
height: number;
|
||||
color: string;
|
||||
}>;
|
||||
export default _default;
|
||||
107
node_modules/nuxt/dist/app/components/nuxt-loading-indicator.mjs
generated
vendored
Normal file
107
node_modules/nuxt/dist/app/components/nuxt-loading-indicator.mjs
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
import { computed, defineComponent, h, onBeforeUnmount, ref } from "vue";
|
||||
import { useNuxtApp } from "#app";
|
||||
export default defineComponent({
|
||||
name: "NuxtLoadingIndicator",
|
||||
props: {
|
||||
throttle: {
|
||||
type: Number,
|
||||
default: 200
|
||||
},
|
||||
duration: {
|
||||
type: Number,
|
||||
default: 2e3
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
default: 3
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: "repeating-linear-gradient(to right,#00dc82 0%,#34cdfe 50%,#0047e1 100%)"
|
||||
}
|
||||
},
|
||||
setup(props, { slots }) {
|
||||
const indicator = useLoadingIndicator({
|
||||
duration: props.duration,
|
||||
throttle: props.throttle
|
||||
});
|
||||
const nuxtApp = useNuxtApp();
|
||||
nuxtApp.hook("page:start", indicator.start);
|
||||
nuxtApp.hook("page:finish", indicator.finish);
|
||||
onBeforeUnmount(() => indicator.clear);
|
||||
return () => h("div", {
|
||||
class: "nuxt-loading-indicator",
|
||||
style: {
|
||||
position: "fixed",
|
||||
top: 0,
|
||||
right: 0,
|
||||
left: 0,
|
||||
pointerEvents: "none",
|
||||
width: `${indicator.progress.value}%`,
|
||||
height: `${props.height}px`,
|
||||
opacity: indicator.isLoading.value ? 1 : 0,
|
||||
background: props.color,
|
||||
backgroundSize: `${100 / indicator.progress.value * 100}% auto`,
|
||||
transition: "width 0.1s, height 0.4s, opacity 0.4s",
|
||||
zIndex: 999999
|
||||
}
|
||||
}, slots);
|
||||
}
|
||||
});
|
||||
function useLoadingIndicator(opts) {
|
||||
const progress = ref(0);
|
||||
const isLoading = ref(false);
|
||||
const step = computed(() => 1e4 / opts.duration);
|
||||
let _timer = null;
|
||||
let _throttle = null;
|
||||
function start() {
|
||||
clear();
|
||||
progress.value = 0;
|
||||
isLoading.value = true;
|
||||
if (opts.throttle) {
|
||||
if (process.client) {
|
||||
_throttle = setTimeout(_startTimer, opts.throttle);
|
||||
}
|
||||
} else {
|
||||
_startTimer();
|
||||
}
|
||||
}
|
||||
function finish() {
|
||||
progress.value = 100;
|
||||
_hide();
|
||||
}
|
||||
function clear() {
|
||||
clearInterval(_timer);
|
||||
clearTimeout(_throttle);
|
||||
_timer = null;
|
||||
_throttle = null;
|
||||
}
|
||||
function _increase(num) {
|
||||
progress.value = Math.min(100, progress.value + num);
|
||||
}
|
||||
function _hide() {
|
||||
clear();
|
||||
if (process.client) {
|
||||
setTimeout(() => {
|
||||
isLoading.value = false;
|
||||
setTimeout(() => {
|
||||
progress.value = 0;
|
||||
}, 400);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
function _startTimer() {
|
||||
if (process.client) {
|
||||
_timer = setInterval(() => {
|
||||
_increase(step.value);
|
||||
}, 100);
|
||||
}
|
||||
}
|
||||
return {
|
||||
progress,
|
||||
isLoading,
|
||||
start,
|
||||
finish,
|
||||
clear
|
||||
};
|
||||
}
|
||||
35
node_modules/nuxt/dist/app/components/nuxt-root.vue
generated
vendored
Normal file
35
node_modules/nuxt/dist/app/components/nuxt-root.vue
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<template>
|
||||
<Suspense @resolve="onResolve">
|
||||
<ErrorComponent v-if="error" :error="error" />
|
||||
<AppComponent v-else />
|
||||
</Suspense>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineAsyncComponent, onErrorCaptured, provide } from 'vue'
|
||||
import { callWithNuxt, isNuxtError, showError, useError, useRoute, useNuxtApp } from '#app'
|
||||
import AppComponent from '#build/app-component.mjs'
|
||||
|
||||
const ErrorComponent = defineAsyncComponent(() => import('#build/error-component.mjs').then(r => r.default || r))
|
||||
|
||||
const nuxtApp = useNuxtApp()
|
||||
const onResolve = nuxtApp.deferHydration()
|
||||
|
||||
// Inject default route (outside of pages) as active route
|
||||
provide('_route', useRoute())
|
||||
|
||||
// vue:setup hook
|
||||
const results = nuxtApp.hooks.callHookWith(hooks => hooks.map(hook => hook()), 'vue:setup')
|
||||
if (process.dev && results && results.some(i => i && 'then' in i)) {
|
||||
console.error('[nuxt] Error in `vue:setup`. Callbacks must be synchronous.')
|
||||
}
|
||||
|
||||
// error handling
|
||||
const error = useError()
|
||||
onErrorCaptured((err, target, info) => {
|
||||
nuxtApp.hooks.callHook('vue:error', err, target, info).catch(hookError => console.error('[nuxt] Error in `vue:error` hook', hookError))
|
||||
if (process.server || (isNuxtError(err) && (err.fatal || err.unhandled))) {
|
||||
callWithNuxt(nuxtApp, showError, [err])
|
||||
}
|
||||
})
|
||||
</script>
|
||||
2
node_modules/nuxt/dist/app/components/server-placeholder.d.ts
generated
vendored
Normal file
2
node_modules/nuxt/dist/app/components/server-placeholder.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
||||
export default _default;
|
||||
7
node_modules/nuxt/dist/app/components/server-placeholder.mjs
generated
vendored
Normal file
7
node_modules/nuxt/dist/app/components/server-placeholder.mjs
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineComponent, createElementBlock } from "vue";
|
||||
export default defineComponent({
|
||||
name: "ServerPlaceholder",
|
||||
render() {
|
||||
return createElementBlock("div");
|
||||
}
|
||||
});
|
||||
11
node_modules/nuxt/dist/app/components/utils.d.ts
generated
vendored
Normal file
11
node_modules/nuxt/dist/app/components/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import type { Component } from 'vue';
|
||||
/**
|
||||
* Internal utility
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
export declare const _wrapIf: (component: Component, props: any, slots: any) => {
|
||||
default: () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
||||
[key: string]: any;
|
||||
}>;
|
||||
};
|
||||
9
node_modules/nuxt/dist/app/components/utils.mjs
generated
vendored
Normal file
9
node_modules/nuxt/dist/app/components/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { defineComponent, h } from "vue";
|
||||
const Fragment = defineComponent({
|
||||
setup(_props, { slots }) {
|
||||
return () => slots.default?.();
|
||||
}
|
||||
});
|
||||
export const _wrapIf = (component, props, slots) => {
|
||||
return { default: () => props ? h(component, props === true ? {} : props, slots) : h(Fragment, {}, slots) };
|
||||
};
|
||||
Reference in New Issue
Block a user