vitral 0.7.1 → 0.8.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.
- package/README.md +74 -14
- package/dist/angular.d.ts +2 -2
- package/dist/angular.js +8 -6
- package/dist/auto.js +5 -4
- package/dist/chunk-4IWZIFAL.js +165 -0
- package/dist/chunk-6AFVJCQG.js +311 -0
- package/dist/{chunk-72H4FXMD.js → chunk-6T25WKNK.js} +44 -13
- package/dist/chunk-EQZOJU3B.js +48 -0
- package/dist/{chunk-O7DV3EVB.js → chunk-NTXMEZIZ.js} +9 -46
- package/dist/{chunk-4NSPG6NK.js → chunk-PQXS2UDM.js} +1 -1
- package/dist/{chunk-TXSHK3SK.js → chunk-ZJ4IM2PZ.js} +2 -2
- package/dist/{chunk-V24ZNHUF.js → chunk-ZRAGLT3I.js} +4 -4
- package/dist/cli.js +1 -1
- package/dist/{contract-46EZFQPQ.js → contract-OMHCH6LI.js} +1 -1
- package/dist/{dedupe-S7BHQMOZ.js → dedupe-PZCSKL3L.js} +1 -1
- package/dist/edge.d.ts +1 -1
- package/dist/element.d.ts +2 -2
- package/dist/element.js +5 -4
- package/dist/embed.js +2 -2
- package/dist/{events-DLdbFqBM.d.ts → events-Cieg_far.d.ts} +1 -1
- package/dist/{expose-ZLYQZUP2.js → expose-V5ASGX4E.js} +2 -2
- package/dist/federation.d.ts +1 -1
- package/dist/{hydrate-NFZZMYWT.js → hydrate-6NE4MYOD.js} +7 -5
- package/dist/iframe.js +9 -7
- package/dist/index.d.ts +6 -19
- package/dist/index.js +6 -4
- package/dist/loader-BIXjuvvp.d.ts +25 -0
- package/dist/next-config.d.ts +95 -0
- package/dist/next-config.js +149 -0
- package/dist/next-host.d.ts +26 -0
- package/dist/next-host.js +92 -0
- package/dist/next.d.ts +190 -0
- package/dist/next.js +287 -0
- package/dist/preact.d.ts +4 -4
- package/dist/preact.js +7 -5
- package/dist/prefetch.js +2 -2
- package/dist/react-server.d.ts +1 -1
- package/dist/react.d.ts +11 -4
- package/dist/react.js +17 -144
- package/dist/{reframe-7K5S6JC6.js → reframe-3ZN5CHEG.js} +4 -4
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +6 -4
- package/dist/single-spa.d.ts +1 -1
- package/dist/{slot-Ddzp7AgL.d.ts → slot-Dhczjs1E.d.ts} +1 -1
- package/dist/solid.d.ts +3 -3
- package/dist/solid.js +7 -5
- package/dist/{sri-576GTDIA.js → sri-TBZ6PYYY.js} +39 -24
- package/dist/svelte.d.ts +4 -4
- package/dist/svelte.js +6 -4
- package/dist/sw.d.ts +8 -0
- package/dist/sw.js +21 -0
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +3 -2
- package/dist/{types-EOz1rOHs.d.ts → types-wsKR1gfx.d.ts} +19 -3
- package/dist/vite.d.ts +33 -1
- package/dist/vite.js +353 -158
- package/dist/vue.d.ts +3 -3
- package/dist/vue.js +6 -4
- package/package.json +28 -12
package/dist/next.d.ts
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode, ImgHTMLAttributes, AnchorHTMLAttributes, ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
/** `basePath` do `next.config`. O plugin chama ao carregar os módulos `next/*`. */
|
|
5
|
+
declare function setBasePath(path?: string): void;
|
|
6
|
+
type Query = Record<string, string | string[] | undefined>;
|
|
7
|
+
type Url = string | {
|
|
8
|
+
pathname?: string | null;
|
|
9
|
+
query?: Query | string | null;
|
|
10
|
+
hash?: string | null;
|
|
11
|
+
};
|
|
12
|
+
interface NextRouter {
|
|
13
|
+
pathname: string;
|
|
14
|
+
route: string;
|
|
15
|
+
asPath: string;
|
|
16
|
+
query: Query;
|
|
17
|
+
basePath: string;
|
|
18
|
+
isReady: boolean;
|
|
19
|
+
isFallback: boolean;
|
|
20
|
+
isPreview: boolean;
|
|
21
|
+
isLocaleDomain: boolean;
|
|
22
|
+
locale?: string;
|
|
23
|
+
push(url: Url, as?: Url, options?: {
|
|
24
|
+
scroll?: boolean;
|
|
25
|
+
}): Promise<boolean>;
|
|
26
|
+
replace(url: Url, as?: Url, options?: {
|
|
27
|
+
scroll?: boolean;
|
|
28
|
+
}): Promise<boolean>;
|
|
29
|
+
back(): void;
|
|
30
|
+
forward(): void;
|
|
31
|
+
reload(): void;
|
|
32
|
+
prefetch(url: string): Promise<void>;
|
|
33
|
+
beforePopState(cb: unknown): void;
|
|
34
|
+
events: {
|
|
35
|
+
on(type: string, fn: (...args: any[]) => void): void;
|
|
36
|
+
off(type: string, fn: (...args: any[]) => void): void;
|
|
37
|
+
emit(type: string, ...args: any[]): void;
|
|
38
|
+
};
|
|
39
|
+
/** Só no roteador do host (`NextRemote`): o `href` que o `<Link>` mostra, já com a rota pública. */
|
|
40
|
+
hrefOf?(path: string): string;
|
|
41
|
+
}
|
|
42
|
+
/** O contexto que o `useRouter` do Next lê. O host que manda na rota fornece um. */
|
|
43
|
+
declare const RouterContext: react.Context<NextRouter | null>;
|
|
44
|
+
/** `href` do Next (texto ou objeto) como texto. */
|
|
45
|
+
declare function formatUrl(url: Url): string;
|
|
46
|
+
/** `useRouter` de `next/router`: o do `RouterContext`, se houver, senão o da URL. */
|
|
47
|
+
declare function useRouter(): NextRouter;
|
|
48
|
+
/** `Router` (export default de `next/router`): o do host dentro do `NextRemote`, senão o da URL. */
|
|
49
|
+
declare const Router: NextRouter;
|
|
50
|
+
declare function withRouter<P extends object>(Component: ComponentType<P & {
|
|
51
|
+
router: NextRouter;
|
|
52
|
+
}>): ComponentType<P>;
|
|
53
|
+
interface AppRouter {
|
|
54
|
+
push(href: string, options?: {
|
|
55
|
+
scroll?: boolean;
|
|
56
|
+
}): void;
|
|
57
|
+
replace(href: string, options?: {
|
|
58
|
+
scroll?: boolean;
|
|
59
|
+
}): void;
|
|
60
|
+
back(): void;
|
|
61
|
+
forward(): void;
|
|
62
|
+
refresh(): void;
|
|
63
|
+
prefetch(href: string): void;
|
|
64
|
+
}
|
|
65
|
+
/** `useRouter` de `next/navigation`. */
|
|
66
|
+
declare function useAppRouter(): AppRouter;
|
|
67
|
+
declare function usePathname(): string;
|
|
68
|
+
declare function useSearchParams(): URLSearchParams;
|
|
69
|
+
declare function useParams<T extends Record<string, string | string[]> = Record<string, string | string[]>>(): T;
|
|
70
|
+
declare function redirect(url: string): never;
|
|
71
|
+
declare function notFound(): never;
|
|
72
|
+
type LinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
|
|
73
|
+
href: Url;
|
|
74
|
+
as?: Url;
|
|
75
|
+
replace?: boolean;
|
|
76
|
+
scroll?: boolean;
|
|
77
|
+
shallow?: boolean;
|
|
78
|
+
prefetch?: boolean | null;
|
|
79
|
+
passHref?: boolean;
|
|
80
|
+
legacyBehavior?: boolean;
|
|
81
|
+
locale?: string | false;
|
|
82
|
+
children?: ReactNode;
|
|
83
|
+
};
|
|
84
|
+
declare const Link: react.ForwardRefExoticComponent<Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "href"> & {
|
|
85
|
+
href: Url;
|
|
86
|
+
as?: Url;
|
|
87
|
+
replace?: boolean;
|
|
88
|
+
scroll?: boolean;
|
|
89
|
+
shallow?: boolean;
|
|
90
|
+
prefetch?: boolean | null;
|
|
91
|
+
passHref?: boolean;
|
|
92
|
+
legacyBehavior?: boolean;
|
|
93
|
+
locale?: string | false;
|
|
94
|
+
children?: ReactNode;
|
|
95
|
+
} & react.RefAttributes<HTMLAnchorElement>>;
|
|
96
|
+
type StaticImage = {
|
|
97
|
+
src: string;
|
|
98
|
+
width?: number;
|
|
99
|
+
height?: number;
|
|
100
|
+
};
|
|
101
|
+
type ImageProps = Omit<ImgHTMLAttributes<HTMLImageElement>, 'src' | 'width' | 'height' | 'loading'> & {
|
|
102
|
+
src: string | StaticImage;
|
|
103
|
+
alt: string;
|
|
104
|
+
width?: number | string;
|
|
105
|
+
height?: number | string;
|
|
106
|
+
fill?: boolean;
|
|
107
|
+
priority?: boolean;
|
|
108
|
+
loading?: 'eager' | 'lazy';
|
|
109
|
+
quality?: number | string;
|
|
110
|
+
placeholder?: string;
|
|
111
|
+
blurDataURL?: string;
|
|
112
|
+
unoptimized?: boolean;
|
|
113
|
+
overrideSrc?: string;
|
|
114
|
+
loader?: (p: {
|
|
115
|
+
src: string;
|
|
116
|
+
width: number;
|
|
117
|
+
quality?: number;
|
|
118
|
+
}) => string;
|
|
119
|
+
onLoadingComplete?: (img: HTMLImageElement) => void;
|
|
120
|
+
};
|
|
121
|
+
declare const Image: react.ForwardRefExoticComponent<Omit<ImgHTMLAttributes<HTMLImageElement>, "loading" | "src" | "width" | "height"> & {
|
|
122
|
+
src: string | StaticImage;
|
|
123
|
+
alt: string;
|
|
124
|
+
width?: number | string;
|
|
125
|
+
height?: number | string;
|
|
126
|
+
fill?: boolean;
|
|
127
|
+
priority?: boolean;
|
|
128
|
+
loading?: "eager" | "lazy";
|
|
129
|
+
quality?: number | string;
|
|
130
|
+
placeholder?: string;
|
|
131
|
+
blurDataURL?: string;
|
|
132
|
+
unoptimized?: boolean;
|
|
133
|
+
overrideSrc?: string;
|
|
134
|
+
loader?: (p: {
|
|
135
|
+
src: string;
|
|
136
|
+
width: number;
|
|
137
|
+
quality?: number;
|
|
138
|
+
}) => string;
|
|
139
|
+
onLoadingComplete?: (img: HTMLImageElement) => void;
|
|
140
|
+
} & react.RefAttributes<HTMLImageElement>>;
|
|
141
|
+
/** O React 19 já leva `<title>`, `<meta>` e `<link>` para o `<head>`. */
|
|
142
|
+
declare function Head({ children }: {
|
|
143
|
+
children?: ReactNode;
|
|
144
|
+
}): react.FunctionComponentElement<react.FragmentProps>;
|
|
145
|
+
type Loader<P> = () => Promise<ComponentType<P> | {
|
|
146
|
+
default: ComponentType<P>;
|
|
147
|
+
}>;
|
|
148
|
+
declare function dynamic<P extends object = object>(loader: Loader<P> | Promise<ComponentType<P> | {
|
|
149
|
+
default: ComponentType<P>;
|
|
150
|
+
}>, options?: {
|
|
151
|
+
loading?: ComponentType<any>;
|
|
152
|
+
ssr?: boolean;
|
|
153
|
+
}): ComponentType<P>;
|
|
154
|
+
/** Rota pública do host e o caminho dela na zona (como no `rewrites` do Multi-Zones). */
|
|
155
|
+
interface ZoneRoute {
|
|
156
|
+
public: string;
|
|
157
|
+
zone: string;
|
|
158
|
+
}
|
|
159
|
+
/** O que o `NextRemote` do host passa ao remote, na prop `__next`. */
|
|
160
|
+
interface HostRouter {
|
|
161
|
+
/** `asPath` do host: a URL do navegador. */
|
|
162
|
+
asPath: string;
|
|
163
|
+
/** `basePath` do remote, como no `next.config` da zona. */
|
|
164
|
+
basePath?: string;
|
|
165
|
+
routes?: ZoneRoute[];
|
|
166
|
+
push(url: string, options?: {
|
|
167
|
+
scroll?: boolean;
|
|
168
|
+
}): void;
|
|
169
|
+
replace(url: string, options?: {
|
|
170
|
+
scroll?: boolean;
|
|
171
|
+
}): void;
|
|
172
|
+
/** `Router.events` do host: `routeChangeStart`, `routeChangeComplete`… chegam ao remote. */
|
|
173
|
+
events?: NextRouter['events'];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* O roteador que o remote vê dentro do host: caminhos como numa zona com
|
|
177
|
+
* `basePath` (a URL pública vira o caminho da zona, sem o `basePath`), e
|
|
178
|
+
* `push` volta pelo roteador do host, com a rota pública.
|
|
179
|
+
*/
|
|
180
|
+
declare function hostRouter(host: HostRouter): NextRouter;
|
|
181
|
+
/**
|
|
182
|
+
* Embrulha o `export default` do remote no modo `next` do plugin: com a prop
|
|
183
|
+
* `__next` (vinda do `NextRemote` do host), os componentes leem o roteador do
|
|
184
|
+
* host; sem ela, o da URL.
|
|
185
|
+
*/
|
|
186
|
+
declare function nextRemote<P extends object>(Component: ComponentType<P>): ComponentType<P & {
|
|
187
|
+
__next?: HostRouter;
|
|
188
|
+
}>;
|
|
189
|
+
|
|
190
|
+
export { type AppRouter, Head, type HostRouter, Image, type ImageProps, Link, type LinkProps, type NextRouter, Router, RouterContext, type Url, type ZoneRoute, dynamic, formatUrl, hostRouter, nextRemote, notFound, redirect, setBasePath, useAppRouter, useParams, usePathname, useRouter, useSearchParams, withRouter };
|
package/dist/next.js
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
navigate
|
|
4
|
+
} from "./chunk-EQZOJU3B.js";
|
|
5
|
+
import "./chunk-GNPFWISJ.js";
|
|
6
|
+
|
|
7
|
+
// src/next.tsx
|
|
8
|
+
import {
|
|
9
|
+
Children,
|
|
10
|
+
cloneElement,
|
|
11
|
+
createContext,
|
|
12
|
+
createElement,
|
|
13
|
+
forwardRef,
|
|
14
|
+
Fragment,
|
|
15
|
+
isValidElement,
|
|
16
|
+
lazy,
|
|
17
|
+
Suspense,
|
|
18
|
+
useContext,
|
|
19
|
+
useEffect,
|
|
20
|
+
useMemo,
|
|
21
|
+
useSyncExternalStore
|
|
22
|
+
} from "react";
|
|
23
|
+
var base = "";
|
|
24
|
+
function setBasePath(path = "") {
|
|
25
|
+
base = path.replace(/\/+$/, "");
|
|
26
|
+
}
|
|
27
|
+
var RouterContext = createContext(null);
|
|
28
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
29
|
+
var changed = () => listeners.forEach((fn) => fn());
|
|
30
|
+
function subscribe(fn) {
|
|
31
|
+
listeners.add(fn);
|
|
32
|
+
addEventListener("popstate", fn);
|
|
33
|
+
return () => {
|
|
34
|
+
listeners.delete(fn);
|
|
35
|
+
removeEventListener("popstate", fn);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
var here = () => typeof location === "undefined" ? "/" : location.pathname + location.search + location.hash;
|
|
39
|
+
var inBase = (path) => !base || path === base || path.startsWith(base + "/");
|
|
40
|
+
function strip(path) {
|
|
41
|
+
return base && inBase(path) ? path.slice(base.length) || "/" : path;
|
|
42
|
+
}
|
|
43
|
+
function queryString(query) {
|
|
44
|
+
if (!query) return "";
|
|
45
|
+
if (typeof query === "string") return query.replace(/^\??/, query ? "?" : "");
|
|
46
|
+
const params = new URLSearchParams();
|
|
47
|
+
for (const [k, v] of Object.entries(query)) {
|
|
48
|
+
if (Array.isArray(v)) v.forEach((x) => params.append(k, x));
|
|
49
|
+
else if (v != null) params.append(k, String(v));
|
|
50
|
+
}
|
|
51
|
+
const s = params.toString();
|
|
52
|
+
return s ? "?" + s : "";
|
|
53
|
+
}
|
|
54
|
+
function formatUrl(url) {
|
|
55
|
+
if (typeof url === "string") return url;
|
|
56
|
+
const hash = url.hash ? "#" + url.hash.replace(/^#/, "") : "";
|
|
57
|
+
return (url.pathname ?? "") + queryString(url.query) + hash;
|
|
58
|
+
}
|
|
59
|
+
function withBase(href, prefix = base) {
|
|
60
|
+
return prefix && href.startsWith("/") && !href.startsWith("//") ? prefix + (href === "/" ? "" : href) : href;
|
|
61
|
+
}
|
|
62
|
+
var isExternal = (href) => /^[a-z][a-z\d+.-]*:/i.test(href) || href.startsWith("//");
|
|
63
|
+
function go(url, replace) {
|
|
64
|
+
const target = new URL(withBase(formatUrl(url)), location.href);
|
|
65
|
+
if (target.origin !== location.origin || !inBase(target.pathname)) {
|
|
66
|
+
navigate(target.href, { replace });
|
|
67
|
+
return Promise.resolve(true);
|
|
68
|
+
}
|
|
69
|
+
history[replace ? "replaceState" : "pushState"](history.state, "", target.href);
|
|
70
|
+
changed();
|
|
71
|
+
return Promise.resolve(true);
|
|
72
|
+
}
|
|
73
|
+
function emitter() {
|
|
74
|
+
const map = /* @__PURE__ */ new Map();
|
|
75
|
+
return {
|
|
76
|
+
on: (t, fn) => void (map.get(t) ?? map.set(t, /* @__PURE__ */ new Set()).get(t)).add(fn),
|
|
77
|
+
off: (t, fn) => void map.get(t)?.delete(fn),
|
|
78
|
+
emit: (t, ...args) => map.get(t)?.forEach((fn) => fn(...args))
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
var routerEvents = emitter();
|
|
82
|
+
function locationRouter(current) {
|
|
83
|
+
const url = new URL(current, "http://x");
|
|
84
|
+
const query = {};
|
|
85
|
+
url.searchParams.forEach((v, k) => {
|
|
86
|
+
const prev = query[k];
|
|
87
|
+
query[k] = prev === void 0 ? v : [].concat(prev, v);
|
|
88
|
+
});
|
|
89
|
+
const pathname = strip(url.pathname);
|
|
90
|
+
return {
|
|
91
|
+
pathname,
|
|
92
|
+
route: pathname,
|
|
93
|
+
asPath: pathname + url.search + url.hash,
|
|
94
|
+
// shortcut: sem tabela de rotas, os segmentos dinâmicos ([id]) não entram em `query`; passe-os por props ou por RouterContext.
|
|
95
|
+
query,
|
|
96
|
+
basePath: base,
|
|
97
|
+
isReady: true,
|
|
98
|
+
isFallback: false,
|
|
99
|
+
isPreview: false,
|
|
100
|
+
isLocaleDomain: false,
|
|
101
|
+
push: (u, as) => go(as ?? u, false),
|
|
102
|
+
replace: (u, as) => go(as ?? u, true),
|
|
103
|
+
back: () => history.back(),
|
|
104
|
+
forward: () => history.forward(),
|
|
105
|
+
reload: () => location.reload(),
|
|
106
|
+
prefetch: () => Promise.resolve(),
|
|
107
|
+
beforePopState: () => {
|
|
108
|
+
},
|
|
109
|
+
events: routerEvents
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function useRouter() {
|
|
113
|
+
const provided = useContext(RouterContext);
|
|
114
|
+
const current = useSyncExternalStore(subscribe, here, () => "/");
|
|
115
|
+
const own = useMemo(() => locationRouter(current), [current]);
|
|
116
|
+
return provided ?? own;
|
|
117
|
+
}
|
|
118
|
+
var mounted = null;
|
|
119
|
+
var Router = new Proxy({}, {
|
|
120
|
+
get: (_, key) => (mounted ?? locationRouter(here()))[key]
|
|
121
|
+
});
|
|
122
|
+
function withRouter(Component) {
|
|
123
|
+
return (props) => createElement(Component, { ...props, router: useRouter() });
|
|
124
|
+
}
|
|
125
|
+
function useAppRouter() {
|
|
126
|
+
const router = useRouter();
|
|
127
|
+
return useMemo(
|
|
128
|
+
() => ({
|
|
129
|
+
push: (href) => void router.push(href),
|
|
130
|
+
replace: (href) => void router.replace(href),
|
|
131
|
+
back: () => router.back(),
|
|
132
|
+
forward: () => router.forward(),
|
|
133
|
+
refresh: changed,
|
|
134
|
+
prefetch: () => {
|
|
135
|
+
}
|
|
136
|
+
}),
|
|
137
|
+
[router]
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
function usePathname() {
|
|
141
|
+
return useRouter().pathname;
|
|
142
|
+
}
|
|
143
|
+
function useSearchParams() {
|
|
144
|
+
const { asPath } = useRouter();
|
|
145
|
+
return useMemo(() => new URL(asPath, "http://x").searchParams, [asPath]);
|
|
146
|
+
}
|
|
147
|
+
var noParams = Object.freeze({});
|
|
148
|
+
function useParams() {
|
|
149
|
+
return noParams;
|
|
150
|
+
}
|
|
151
|
+
function redirect(url) {
|
|
152
|
+
void (mounted ? mounted.replace(url) : go(url, true));
|
|
153
|
+
throw new Error(`NEXT_REDIRECT;${url}`);
|
|
154
|
+
}
|
|
155
|
+
function notFound() {
|
|
156
|
+
throw new Error("NEXT_NOT_FOUND");
|
|
157
|
+
}
|
|
158
|
+
var Link = forwardRef(function Link2({ href, as, replace, scroll, shallow: _s, prefetch: _p, passHref: _ph, legacyBehavior, locale: _l, onClick, children, ...rest }, ref) {
|
|
159
|
+
const router = useRouter();
|
|
160
|
+
const target = formatUrl(as ?? href);
|
|
161
|
+
const external = isExternal(target);
|
|
162
|
+
const shown = external ? target : router.hrefOf?.(target) ?? withBase(target, router.basePath);
|
|
163
|
+
const click = (e) => {
|
|
164
|
+
onClick?.(e);
|
|
165
|
+
const self = !rest.target || rest.target === "_self";
|
|
166
|
+
if (e.defaultPrevented || external || !self || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
|
167
|
+
e.preventDefault();
|
|
168
|
+
void (replace ? router.replace(target) : router.push(target));
|
|
169
|
+
if (scroll !== false && typeof scrollTo === "function") scrollTo(0, 0);
|
|
170
|
+
};
|
|
171
|
+
if (legacyBehavior && isValidElement(children)) {
|
|
172
|
+
const child = Children.only(children);
|
|
173
|
+
return cloneElement(child, { href: shown, ref, onClick: (e) => (child.props.onClick?.(e), click(e)) });
|
|
174
|
+
}
|
|
175
|
+
return createElement("a", { ...rest, href: shown, ref, onClick: click }, children);
|
|
176
|
+
});
|
|
177
|
+
var Image = forwardRef(function Image2({ src, width, height, fill, priority, loading, quality, placeholder: _ph, blurDataURL: _b, unoptimized: _u, overrideSrc, loader, onLoadingComplete, onLoad, style, ...rest }, ref) {
|
|
178
|
+
const image = typeof src === "object" ? src : void 0;
|
|
179
|
+
const raw = image?.src ?? src;
|
|
180
|
+
const w = width ?? image?.width;
|
|
181
|
+
const h = height ?? image?.height;
|
|
182
|
+
const url = overrideSrc ?? (loader ? loader({ src: raw, width: Number(w) || 0, quality: quality == null ? void 0 : Number(quality) }) : raw);
|
|
183
|
+
const fillStyle = fill ? { position: "absolute", inset: 0, width: "100%", height: "100%" } : void 0;
|
|
184
|
+
return createElement("img", {
|
|
185
|
+
...rest,
|
|
186
|
+
ref,
|
|
187
|
+
src: url,
|
|
188
|
+
width: fill ? void 0 : w,
|
|
189
|
+
height: fill ? void 0 : h,
|
|
190
|
+
decoding: "async",
|
|
191
|
+
loading: priority ? "eager" : loading ?? "lazy",
|
|
192
|
+
fetchPriority: priority ? "high" : void 0,
|
|
193
|
+
style: fillStyle ? { ...fillStyle, ...style } : style,
|
|
194
|
+
onLoad: (e) => (onLoad?.(e), onLoadingComplete?.(e.currentTarget))
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
function Head({ children }) {
|
|
198
|
+
return createElement(Fragment, null, children);
|
|
199
|
+
}
|
|
200
|
+
function dynamic(loader, options = {}) {
|
|
201
|
+
const Lazy = lazy(async () => {
|
|
202
|
+
const m = await (typeof loader === "function" ? loader() : loader);
|
|
203
|
+
return { default: m && typeof m === "object" && "default" in m ? m.default : m };
|
|
204
|
+
});
|
|
205
|
+
const fallback = options.loading ? createElement(options.loading, { isLoading: true, pastDelay: true, error: null }) : null;
|
|
206
|
+
return (props) => createElement(Suspense, { fallback }, createElement(Lazy, props));
|
|
207
|
+
}
|
|
208
|
+
var under = (path, prefix) => path === prefix || path.startsWith(prefix + "/");
|
|
209
|
+
function mapPath(path, routes, from) {
|
|
210
|
+
const to = from === "public" ? "zone" : "public";
|
|
211
|
+
let best;
|
|
212
|
+
for (const r of routes) if (under(path, r[from]) && (!best || r[from].length > best[from].length)) best = r;
|
|
213
|
+
return best ? best[to] + path.slice(best[from].length) : path;
|
|
214
|
+
}
|
|
215
|
+
function hostRouter(host) {
|
|
216
|
+
const basePath = (host.basePath ?? base).replace(/\/+$/, "");
|
|
217
|
+
const routes = host.routes ?? [];
|
|
218
|
+
const url = new URL(host.asPath, "http://x");
|
|
219
|
+
const zone = mapPath(url.pathname, routes, "public");
|
|
220
|
+
const pathname = basePath && under(zone, basePath) ? zone.slice(basePath.length) || "/" : zone;
|
|
221
|
+
const query = {};
|
|
222
|
+
url.searchParams.forEach((v, k) => {
|
|
223
|
+
const prev = query[k];
|
|
224
|
+
query[k] = prev === void 0 ? v : [].concat(prev, v);
|
|
225
|
+
});
|
|
226
|
+
const hrefOf = (path) => path.startsWith("/") && !path.startsWith("//") ? mapPath(withBase(path, basePath) || "/", routes, "zone") : path;
|
|
227
|
+
const go2 = (target, replace, options) => {
|
|
228
|
+
const next = formatUrl(target);
|
|
229
|
+
if (isExternal(next)) navigate(next, { replace });
|
|
230
|
+
else (replace ? host.replace : host.push)(hrefOf(next), options);
|
|
231
|
+
return Promise.resolve(true);
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
pathname,
|
|
235
|
+
route: pathname,
|
|
236
|
+
asPath: pathname + url.search + url.hash,
|
|
237
|
+
query,
|
|
238
|
+
basePath,
|
|
239
|
+
isReady: true,
|
|
240
|
+
isFallback: false,
|
|
241
|
+
isPreview: false,
|
|
242
|
+
isLocaleDomain: false,
|
|
243
|
+
push: (u, as, o) => go2(as ?? u, false, o),
|
|
244
|
+
replace: (u, as, o) => go2(as ?? u, true, o),
|
|
245
|
+
back: () => history.back(),
|
|
246
|
+
forward: () => history.forward(),
|
|
247
|
+
reload: () => location.reload(),
|
|
248
|
+
prefetch: () => Promise.resolve(),
|
|
249
|
+
beforePopState: () => {
|
|
250
|
+
},
|
|
251
|
+
events: host.events ?? routerEvents,
|
|
252
|
+
hrefOf
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function nextRemote(Component) {
|
|
256
|
+
return function NextRemote({ __next: host, ...props }) {
|
|
257
|
+
const router = useMemo(() => host && hostRouter(host), [host?.asPath, host?.basePath, host?.routes, host?.push, host?.replace, host?.events]);
|
|
258
|
+
if (router) mounted = router;
|
|
259
|
+
useEffect(() => {
|
|
260
|
+
if (!router) return;
|
|
261
|
+
mounted = router;
|
|
262
|
+
return () => void (mounted === router && (mounted = null));
|
|
263
|
+
}, [router]);
|
|
264
|
+
const app = createElement(Component, props);
|
|
265
|
+
return router ? createElement(RouterContext.Provider, { value: router }, app) : app;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
export {
|
|
269
|
+
Head,
|
|
270
|
+
Image,
|
|
271
|
+
Link,
|
|
272
|
+
Router,
|
|
273
|
+
RouterContext,
|
|
274
|
+
dynamic,
|
|
275
|
+
formatUrl,
|
|
276
|
+
hostRouter,
|
|
277
|
+
nextRemote,
|
|
278
|
+
notFound,
|
|
279
|
+
redirect,
|
|
280
|
+
setBasePath,
|
|
281
|
+
useAppRouter,
|
|
282
|
+
useParams,
|
|
283
|
+
usePathname,
|
|
284
|
+
useRouter,
|
|
285
|
+
useSearchParams,
|
|
286
|
+
withRouter
|
|
287
|
+
};
|
package/dist/preact.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as preact from 'preact';
|
|
2
2
|
import { VNode, ComponentType } from 'preact';
|
|
3
|
-
import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-
|
|
4
|
-
export { R as RemoteContext } from './types-
|
|
3
|
+
import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-wsKR1gfx.js';
|
|
4
|
+
export { R as RemoteContext } from './types-wsKR1gfx.js';
|
|
5
5
|
import { R as RemoteError } from './errors-kjBv6IH_.js';
|
|
6
|
-
import { S as SlotStatus } from './slot-
|
|
7
|
-
export { e as events } from './events-
|
|
6
|
+
import { S as SlotStatus } from './slot-Dhczjs1E.js';
|
|
7
|
+
export { e as events } from './events-Cieg_far.js';
|
|
8
8
|
export { n as navigate } from './navigate-BRG1WJUM.js';
|
|
9
9
|
import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
|
|
10
10
|
|
package/dist/preact.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hostSlot
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZJ4IM2PZ.js";
|
|
4
4
|
import {
|
|
5
5
|
defineRemote,
|
|
6
|
-
events,
|
|
7
6
|
memoSelect,
|
|
8
|
-
navigate,
|
|
9
7
|
same,
|
|
10
8
|
shared
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import
|
|
9
|
+
} from "./chunk-NTXMEZIZ.js";
|
|
10
|
+
import {
|
|
11
|
+
events,
|
|
12
|
+
navigate
|
|
13
|
+
} from "./chunk-EQZOJU3B.js";
|
|
14
|
+
import "./chunk-6T25WKNK.js";
|
|
13
15
|
import "./chunk-KU6HF2EW.js";
|
|
14
16
|
import "./chunk-TW7KYJQ6.js";
|
|
15
17
|
import "./chunk-463H6B56.js";
|
package/dist/prefetch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveEntry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6T25WKNK.js";
|
|
4
4
|
import "./chunk-KU6HF2EW.js";
|
|
5
5
|
import {
|
|
6
6
|
addLink
|
|
@@ -151,7 +151,7 @@ function modulepreload(href) {
|
|
|
151
151
|
}
|
|
152
152
|
async function verifiedOnly(r) {
|
|
153
153
|
const b = r.split ?? { entry: r.entry, chunks: [], sri: { [r.entry]: r.integrity }, priority: "low" };
|
|
154
|
-
const { verified } = await import("./sri-
|
|
154
|
+
const { verified } = await import("./sri-TBZ6PYYY.js");
|
|
155
155
|
const url = await verified(b);
|
|
156
156
|
if (!url) await Promise.all([...b.chunks, b.entry].map(heat));
|
|
157
157
|
else if (!document.querySelector(`link[rel=modulepreload][href="${CSS.escape(url)}"]`)) await heat(url);
|
package/dist/react-server.d.ts
CHANGED
package/dist/react.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode, ComponentType } from 'react';
|
|
2
2
|
import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
|
|
3
3
|
import * as JSXRuntime from 'react/jsx-runtime';
|
|
4
|
-
import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared, R as RemoteContext } from './types-
|
|
5
|
-
export { E as EventBus } from './types-
|
|
6
|
-
|
|
4
|
+
import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared, R as RemoteContext } from './types-wsKR1gfx.js';
|
|
5
|
+
export { E as EventBus } from './types-wsKR1gfx.js';
|
|
6
|
+
import { P as PreloadOptions } from './loader-BIXjuvvp.js';
|
|
7
|
+
export { e as events } from './events-Cieg_far.js';
|
|
7
8
|
import './errors-kjBv6IH_.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -64,6 +65,12 @@ interface RemoteProps<P extends Props = Props> {
|
|
|
64
65
|
/** Ao sair da página, guarda o remote montado (LRU, padrão 5) e na volta só atualiza as props. */
|
|
65
66
|
keepAlive?: boolean | number;
|
|
66
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Começa a baixar um remote antes de algum `<Remote>` montar (no ocioso, no
|
|
70
|
+
* hover). Já oferece o React do host, para o remote com `dedupe` não baixar
|
|
71
|
+
* a própria cópia.
|
|
72
|
+
*/
|
|
73
|
+
declare function preload(name: string, options?: PreloadOptions): void;
|
|
67
74
|
/**
|
|
68
75
|
* Renderiza um remote. No servidor (Next SSR) renderiza só o fallback; o
|
|
69
76
|
* remote monta no cliente, então não há erro de hidratação. Com o nome em
|
|
@@ -71,4 +78,4 @@ interface RemoteProps<P extends Props = Props> {
|
|
|
71
78
|
*/
|
|
72
79
|
declare function Remote<P extends Props = Props, N extends string = string>({ name, src, props, isolate, fallback, error, onError, className, loading, prefetch, priority, keepAlive, }: RemoteProps<P> & CheckedProps<N>): JSXRuntime.JSX.Element;
|
|
73
80
|
|
|
74
|
-
export { Remote, type RemoteProps, reactRemote, useEvent, useEventValue, usePortalContainer, useShared, useVitral };
|
|
81
|
+
export { Remote, type RemoteProps, preload, reactRemote, useEvent, useEventValue, usePortalContainer, useShared, useVitral };
|