@vizejs/musea-nuxt 0.429.0 → 0.429.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +132 -4
- package/dist/index.mjs +115 -77
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -300,10 +300,119 @@ declare function useId(): string;
|
|
|
300
300
|
declare function reloadNuxtApp(_options?: Record<string, unknown>): Promise<void>;
|
|
301
301
|
//#endregion
|
|
302
302
|
//#region src/mocks/components.d.ts
|
|
303
|
+
/** Mock NuxtLink. Renders an anchor, or the custom slot when `custom` is set. */
|
|
304
|
+
declare const NuxtLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
305
|
+
to: {
|
|
306
|
+
type: PropType<NuxtMuseaNavigationTarget>;
|
|
307
|
+
default: string;
|
|
308
|
+
};
|
|
309
|
+
href: {
|
|
310
|
+
type: StringConstructor;
|
|
311
|
+
default: undefined;
|
|
312
|
+
};
|
|
313
|
+
target: {
|
|
314
|
+
type: StringConstructor;
|
|
315
|
+
default: undefined;
|
|
316
|
+
};
|
|
317
|
+
rel: {
|
|
318
|
+
type: StringConstructor;
|
|
319
|
+
default: undefined;
|
|
320
|
+
};
|
|
321
|
+
external: {
|
|
322
|
+
type: BooleanConstructor;
|
|
323
|
+
default: boolean;
|
|
324
|
+
};
|
|
325
|
+
replace: {
|
|
326
|
+
type: BooleanConstructor;
|
|
327
|
+
default: boolean;
|
|
328
|
+
};
|
|
329
|
+
prefetch: {
|
|
330
|
+
type: BooleanConstructor;
|
|
331
|
+
default: boolean;
|
|
332
|
+
};
|
|
333
|
+
noPrefetch: {
|
|
334
|
+
type: BooleanConstructor;
|
|
335
|
+
default: boolean;
|
|
336
|
+
};
|
|
337
|
+
activeClass: {
|
|
338
|
+
type: StringConstructor;
|
|
339
|
+
default: string;
|
|
340
|
+
};
|
|
341
|
+
exactActiveClass: {
|
|
342
|
+
type: StringConstructor;
|
|
343
|
+
default: string;
|
|
344
|
+
};
|
|
345
|
+
custom: {
|
|
346
|
+
type: BooleanConstructor;
|
|
347
|
+
default: boolean;
|
|
348
|
+
};
|
|
349
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
350
|
+
[key: string]: any;
|
|
351
|
+
}> | import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
352
|
+
[key: string]: any;
|
|
353
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
354
|
+
to: {
|
|
355
|
+
type: PropType<NuxtMuseaNavigationTarget>;
|
|
356
|
+
default: string;
|
|
357
|
+
};
|
|
358
|
+
href: {
|
|
359
|
+
type: StringConstructor;
|
|
360
|
+
default: undefined;
|
|
361
|
+
};
|
|
362
|
+
target: {
|
|
363
|
+
type: StringConstructor;
|
|
364
|
+
default: undefined;
|
|
365
|
+
};
|
|
366
|
+
rel: {
|
|
367
|
+
type: StringConstructor;
|
|
368
|
+
default: undefined;
|
|
369
|
+
};
|
|
370
|
+
external: {
|
|
371
|
+
type: BooleanConstructor;
|
|
372
|
+
default: boolean;
|
|
373
|
+
};
|
|
374
|
+
replace: {
|
|
375
|
+
type: BooleanConstructor;
|
|
376
|
+
default: boolean;
|
|
377
|
+
};
|
|
378
|
+
prefetch: {
|
|
379
|
+
type: BooleanConstructor;
|
|
380
|
+
default: boolean;
|
|
381
|
+
};
|
|
382
|
+
noPrefetch: {
|
|
383
|
+
type: BooleanConstructor;
|
|
384
|
+
default: boolean;
|
|
385
|
+
};
|
|
386
|
+
activeClass: {
|
|
387
|
+
type: StringConstructor;
|
|
388
|
+
default: string;
|
|
389
|
+
};
|
|
390
|
+
exactActiveClass: {
|
|
391
|
+
type: StringConstructor;
|
|
392
|
+
default: string;
|
|
393
|
+
};
|
|
394
|
+
custom: {
|
|
395
|
+
type: BooleanConstructor;
|
|
396
|
+
default: boolean;
|
|
397
|
+
};
|
|
398
|
+
}>> & Readonly<{}>, {
|
|
399
|
+
to: NuxtMuseaNavigationTarget;
|
|
400
|
+
href: string;
|
|
401
|
+
target: string;
|
|
402
|
+
rel: string;
|
|
403
|
+
external: boolean;
|
|
404
|
+
replace: boolean;
|
|
405
|
+
prefetch: boolean;
|
|
406
|
+
noPrefetch: boolean;
|
|
407
|
+
activeClass: string;
|
|
408
|
+
exactActiveClass: string;
|
|
409
|
+
custom: boolean;
|
|
410
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
303
411
|
/**
|
|
304
|
-
* Mock
|
|
412
|
+
* Mock RouterLink for previews that have not installed vue-router.
|
|
413
|
+
* Same anchor rendering as NuxtLink, including the custom slot.
|
|
305
414
|
*/
|
|
306
|
-
declare const
|
|
415
|
+
declare const RouterLink: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
307
416
|
to: {
|
|
308
417
|
type: PropType<NuxtMuseaNavigationTarget>;
|
|
309
418
|
default: string;
|
|
@@ -411,7 +520,26 @@ declare const NuxtLink: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
411
520
|
custom: boolean;
|
|
412
521
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
413
522
|
/**
|
|
414
|
-
* Mock
|
|
523
|
+
* Mock RouterView for previews that have not installed vue-router.
|
|
524
|
+
* Renders a plain element so `<RouterView>` does not fall through as an unknown tag.
|
|
525
|
+
*/
|
|
526
|
+
declare const RouterView: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
527
|
+
name: {
|
|
528
|
+
type: StringConstructor;
|
|
529
|
+
default: string;
|
|
530
|
+
};
|
|
531
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
532
|
+
[key: string]: any;
|
|
533
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
534
|
+
name: {
|
|
535
|
+
type: StringConstructor;
|
|
536
|
+
default: string;
|
|
537
|
+
};
|
|
538
|
+
}>> & Readonly<{}>, {
|
|
539
|
+
name: string;
|
|
540
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
541
|
+
/**
|
|
542
|
+
* Mock NuxtPage - renders slot content or a placeholder.
|
|
415
543
|
*/
|
|
416
544
|
declare const NuxtPage: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
417
545
|
name: {
|
|
@@ -595,4 +723,4 @@ declare const NuxtPicture: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
595
723
|
*/
|
|
596
724
|
declare function nuxtMusea(options?: NuxtMuseaOptions): Plugin;
|
|
597
725
|
//#endregion
|
|
598
|
-
export { ClientOnly, NuxtClientFallback, NuxtErrorBoundary, NuxtImg, NuxtIsland, NuxtLayout, NuxtLink, NuxtLoadingIndicator, type NuxtMuseaOptions, NuxtPage, NuxtPicture, NuxtRouteAnnouncer, NuxtWelcome, abortNavigation, callOnce, clearError, clearNuxtData, clearNuxtState, configureNuxtMuseaMocks, createError, createNuxtMuseaPreviewSetup, defineNuxtComponent, defineNuxtPlugin, defineNuxtRouteMiddleware, definePageMeta, getAppConfigState, getRouteState, getRuntimeConfigState, installNuxtMuseaMocks, navigateTo, nuxtMusea, onNuxtReady, prefetchComponents, preloadComponents, preloadRouteComponents, refreshNuxtData, reloadNuxtApp, resetNuxtMuseaMocks, setPageLayout, showError, updateAppConfig, useAppConfig, useAsyncData, useCookie, useError, useFetch, useHead, useHeadSafe, useId, useLazyAsyncData, useLazyFetch, useNuxtApp, useNuxtData, useRequestEvent, useRequestFetch, useRequestHeaders, useRequestURL, useRoute, useRouter, useRuntimeConfig, useSeoMeta, useServerSeoMeta, useState };
|
|
726
|
+
export { ClientOnly, NuxtClientFallback, NuxtErrorBoundary, NuxtImg, NuxtIsland, NuxtLayout, NuxtLink, NuxtLoadingIndicator, type NuxtMuseaOptions, NuxtPage, NuxtPicture, NuxtRouteAnnouncer, NuxtWelcome, RouterLink, RouterView, abortNavigation, callOnce, clearError, clearNuxtData, clearNuxtState, configureNuxtMuseaMocks, createError, createNuxtMuseaPreviewSetup, defineNuxtComponent, defineNuxtPlugin, defineNuxtRouteMiddleware, definePageMeta, getAppConfigState, getRouteState, getRuntimeConfigState, installNuxtMuseaMocks, navigateTo, nuxtMusea, onNuxtReady, prefetchComponents, preloadComponents, preloadRouteComponents, refreshNuxtData, reloadNuxtApp, resetNuxtMuseaMocks, setPageLayout, showError, updateAppConfig, useAppConfig, useAsyncData, useCookie, useError, useFetch, useHead, useHeadSafe, useId, useLazyAsyncData, useLazyFetch, useNuxtApp, useNuxtData, useRequestEvent, useRequestFetch, useRequestHeaders, useRequestURL, useRoute, useRouter, useRuntimeConfig, useSeoMeta, useServerSeoMeta, useState };
|
package/dist/index.mjs
CHANGED
|
@@ -62,6 +62,8 @@ export {
|
|
|
62
62
|
NuxtClientFallback,
|
|
63
63
|
NuxtImg,
|
|
64
64
|
NuxtPicture,
|
|
65
|
+
RouterLink,
|
|
66
|
+
RouterView,
|
|
65
67
|
} from '${path.join(srcDir, "mocks", "components.js").replace(/\\/g, "/")}';
|
|
66
68
|
`;
|
|
67
69
|
}
|
|
@@ -319,85 +321,110 @@ function useRouter() {
|
|
|
319
321
|
/**
|
|
320
322
|
* Mock Nuxt built-in components.
|
|
321
323
|
*/
|
|
324
|
+
const anchorLinkProps = {
|
|
325
|
+
to: {
|
|
326
|
+
type: [String, Object],
|
|
327
|
+
default: "/"
|
|
328
|
+
},
|
|
329
|
+
href: {
|
|
330
|
+
type: String,
|
|
331
|
+
default: void 0
|
|
332
|
+
},
|
|
333
|
+
target: {
|
|
334
|
+
type: String,
|
|
335
|
+
default: void 0
|
|
336
|
+
},
|
|
337
|
+
rel: {
|
|
338
|
+
type: String,
|
|
339
|
+
default: void 0
|
|
340
|
+
},
|
|
341
|
+
external: {
|
|
342
|
+
type: Boolean,
|
|
343
|
+
default: false
|
|
344
|
+
},
|
|
345
|
+
replace: {
|
|
346
|
+
type: Boolean,
|
|
347
|
+
default: false
|
|
348
|
+
},
|
|
349
|
+
prefetch: {
|
|
350
|
+
type: Boolean,
|
|
351
|
+
default: true
|
|
352
|
+
},
|
|
353
|
+
noPrefetch: {
|
|
354
|
+
type: Boolean,
|
|
355
|
+
default: false
|
|
356
|
+
},
|
|
357
|
+
activeClass: {
|
|
358
|
+
type: String,
|
|
359
|
+
default: "router-link-active"
|
|
360
|
+
},
|
|
361
|
+
exactActiveClass: {
|
|
362
|
+
type: String,
|
|
363
|
+
default: "router-link-exact-active"
|
|
364
|
+
},
|
|
365
|
+
custom: {
|
|
366
|
+
type: Boolean,
|
|
367
|
+
default: false
|
|
368
|
+
}
|
|
369
|
+
};
|
|
322
370
|
/**
|
|
323
|
-
*
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
default: true
|
|
355
|
-
},
|
|
356
|
-
noPrefetch: {
|
|
357
|
-
type: Boolean,
|
|
358
|
-
default: false
|
|
359
|
-
},
|
|
360
|
-
activeClass: {
|
|
361
|
-
type: String,
|
|
362
|
-
default: "router-link-active"
|
|
363
|
-
},
|
|
364
|
-
exactActiveClass: {
|
|
365
|
-
type: String,
|
|
366
|
-
default: "router-link-exact-active"
|
|
367
|
-
},
|
|
368
|
-
custom: {
|
|
369
|
-
type: Boolean,
|
|
370
|
-
default: false
|
|
371
|
+
* Anchor link used by the NuxtLink and RouterLink mocks.
|
|
372
|
+
* `custom` exposes the same slot props as NuxtLink.
|
|
373
|
+
*/
|
|
374
|
+
function createAnchorLink(name, dataAttr) {
|
|
375
|
+
return defineComponent({
|
|
376
|
+
name,
|
|
377
|
+
props: anchorLinkProps,
|
|
378
|
+
setup(props, { slots }) {
|
|
379
|
+
return () => {
|
|
380
|
+
const target = props.href ?? props.to;
|
|
381
|
+
const href = typeof target === "string" ? target : routeTargetToHref(target);
|
|
382
|
+
const navigate = () => navigateTo(target, { replace: props.replace });
|
|
383
|
+
if (props.custom) return slots.default?.({
|
|
384
|
+
href,
|
|
385
|
+
navigate,
|
|
386
|
+
route: useRoute(),
|
|
387
|
+
isActive: false,
|
|
388
|
+
isExactActive: false
|
|
389
|
+
});
|
|
390
|
+
return h("a", {
|
|
391
|
+
[dataAttr]: "",
|
|
392
|
+
href,
|
|
393
|
+
target: props.target,
|
|
394
|
+
rel: props.rel ?? (props.target === "_blank" ? "noopener noreferrer" : void 0),
|
|
395
|
+
onClick: (event) => {
|
|
396
|
+
if (props.external || props.target === "_blank" || isExternalHref(href)) return;
|
|
397
|
+
event.preventDefault();
|
|
398
|
+
navigate();
|
|
399
|
+
}
|
|
400
|
+
}, slots.default?.());
|
|
401
|
+
};
|
|
371
402
|
}
|
|
372
|
-
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
/** Mock NuxtLink. Renders an anchor, or the custom slot when `custom` is set. */
|
|
406
|
+
const NuxtLink = createAnchorLink("NuxtLink", "data-nuxt-link");
|
|
407
|
+
/**
|
|
408
|
+
* Mock RouterLink for previews that have not installed vue-router.
|
|
409
|
+
* Same anchor rendering as NuxtLink, including the custom slot.
|
|
410
|
+
*/
|
|
411
|
+
const RouterLink = createAnchorLink("RouterLink", "data-router-link");
|
|
412
|
+
/**
|
|
413
|
+
* Mock RouterView for previews that have not installed vue-router.
|
|
414
|
+
* Renders a plain element so `<RouterView>` does not fall through as an unknown tag.
|
|
415
|
+
*/
|
|
416
|
+
const RouterView = defineComponent({
|
|
417
|
+
name: "RouterView",
|
|
418
|
+
props: { name: {
|
|
419
|
+
type: String,
|
|
420
|
+
default: "default"
|
|
421
|
+
} },
|
|
373
422
|
setup(props, { slots }) {
|
|
374
|
-
return () => {
|
|
375
|
-
const target = props.href ?? props.to;
|
|
376
|
-
const href = typeof target === "string" ? target : routeTargetToHref(target);
|
|
377
|
-
const navigate = () => navigateTo(target, { replace: props.replace });
|
|
378
|
-
if (props.custom) return slots.default?.({
|
|
379
|
-
href,
|
|
380
|
-
navigate,
|
|
381
|
-
route: useRoute(),
|
|
382
|
-
isActive: false,
|
|
383
|
-
isExactActive: false
|
|
384
|
-
});
|
|
385
|
-
return h("a", {
|
|
386
|
-
"data-nuxt-link": "",
|
|
387
|
-
href,
|
|
388
|
-
target: props.target,
|
|
389
|
-
rel: props.rel ?? (props.target === "_blank" ? "noopener noreferrer" : void 0),
|
|
390
|
-
onClick: (event) => {
|
|
391
|
-
if (props.external || props.target === "_blank" || isExternalHref(href)) return;
|
|
392
|
-
event.preventDefault();
|
|
393
|
-
navigate();
|
|
394
|
-
}
|
|
395
|
-
}, slots.default?.());
|
|
396
|
-
};
|
|
423
|
+
return () => h("div", { "data-router-view": props.name }, slots.default?.());
|
|
397
424
|
}
|
|
398
425
|
});
|
|
399
426
|
/**
|
|
400
|
-
* Mock NuxtPage - renders
|
|
427
|
+
* Mock NuxtPage - renders slot content or a placeholder.
|
|
401
428
|
*/
|
|
402
429
|
const NuxtPage = defineComponent({
|
|
403
430
|
name: "NuxtPage",
|
|
@@ -677,12 +704,23 @@ const builtInComponents = {
|
|
|
677
704
|
function installNuxtMuseaMocks(app, options = {}) {
|
|
678
705
|
configureNuxtMuseaMocks(options);
|
|
679
706
|
for (const [name, component] of Object.entries(builtInComponents)) app.component(name, component);
|
|
680
|
-
app
|
|
681
|
-
app
|
|
682
|
-
app.config.globalProperties
|
|
707
|
+
registerUnlessPresent(app, "RouterLink", RouterLink);
|
|
708
|
+
registerUnlessPresent(app, "RouterView", RouterView);
|
|
709
|
+
const globals = app.config.globalProperties;
|
|
710
|
+
globals.$config = useRuntimeConfig();
|
|
711
|
+
assignGlobalUnlessDefined(globals, "$route", useRoute());
|
|
712
|
+
assignGlobalUnlessDefined(globals, "$router", useRouter());
|
|
683
713
|
app.provide("nuxt-app", useNuxtApp());
|
|
684
714
|
return app;
|
|
685
715
|
}
|
|
716
|
+
function registerUnlessPresent(app, name, component) {
|
|
717
|
+
if (app.component(name)) return;
|
|
718
|
+
app.component(name, component);
|
|
719
|
+
}
|
|
720
|
+
function assignGlobalUnlessDefined(target, key, value) {
|
|
721
|
+
if (Object.getOwnPropertyDescriptor(target, key)) return;
|
|
722
|
+
target[key] = value;
|
|
723
|
+
}
|
|
686
724
|
function createNuxtMuseaPreviewSetup(options = {}) {
|
|
687
725
|
return (app) => {
|
|
688
726
|
installNuxtMuseaMocks(app, options);
|
|
@@ -855,4 +893,4 @@ function nuxtMusea(options = {}) {
|
|
|
855
893
|
return createNuxtMuseaPlugin(options);
|
|
856
894
|
}
|
|
857
895
|
//#endregion
|
|
858
|
-
export { ClientOnly, NuxtClientFallback, NuxtErrorBoundary, NuxtImg, NuxtIsland, NuxtLayout, NuxtLink, NuxtLoadingIndicator, NuxtPage, NuxtPicture, NuxtRouteAnnouncer, NuxtWelcome, abortNavigation, callOnce, clearError, clearNuxtData, clearNuxtState, configureNuxtMuseaMocks, createError, createNuxtMuseaPreviewSetup, defineNuxtComponent, defineNuxtPlugin, defineNuxtRouteMiddleware, definePageMeta, getAppConfigState, getRouteState, getRuntimeConfigState, installNuxtMuseaMocks, navigateTo, nuxtMusea, onNuxtReady, prefetchComponents, preloadComponents, preloadRouteComponents, refreshNuxtData, reloadNuxtApp, resetNuxtMuseaMocks, setPageLayout, showError, updateAppConfig, useAppConfig, useAsyncData, useCookie, useError, useFetch, useHead, useHeadSafe, useId, useLazyAsyncData, useLazyFetch, useNuxtApp, useNuxtData, useRequestEvent, useRequestFetch, useRequestHeaders, useRequestURL, useRoute, useRouter, useRuntimeConfig, useSeoMeta, useServerSeoMeta, useState };
|
|
896
|
+
export { ClientOnly, NuxtClientFallback, NuxtErrorBoundary, NuxtImg, NuxtIsland, NuxtLayout, NuxtLink, NuxtLoadingIndicator, NuxtPage, NuxtPicture, NuxtRouteAnnouncer, NuxtWelcome, RouterLink, RouterView, abortNavigation, callOnce, clearError, clearNuxtData, clearNuxtState, configureNuxtMuseaMocks, createError, createNuxtMuseaPreviewSetup, defineNuxtComponent, defineNuxtPlugin, defineNuxtRouteMiddleware, definePageMeta, getAppConfigState, getRouteState, getRuntimeConfigState, installNuxtMuseaMocks, navigateTo, nuxtMusea, onNuxtReady, prefetchComponents, preloadComponents, preloadRouteComponents, refreshNuxtData, reloadNuxtApp, resetNuxtMuseaMocks, setPageLayout, showError, updateAppConfig, useAppConfig, useAsyncData, useCookie, useError, useFetch, useHead, useHeadSafe, useId, useLazyAsyncData, useLazyFetch, useNuxtApp, useNuxtData, useRequestEvent, useRequestFetch, useRequestHeaders, useRequestURL, useRoute, useRouter, useRuntimeConfig, useSeoMeta, useServerSeoMeta, useState };
|