vitral 0.7.2 → 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 +2 -0
- 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.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 };
|
package/dist/react.js
CHANGED
|
@@ -1,156 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
Remote,
|
|
4
|
+
preload,
|
|
5
|
+
reactRemote,
|
|
6
|
+
useEvent,
|
|
7
|
+
useEventValue,
|
|
8
|
+
usePortalContainer,
|
|
9
|
+
useShared,
|
|
10
|
+
useVitral
|
|
11
|
+
} from "./chunk-4IWZIFAL.js";
|
|
12
|
+
import "./chunk-B2MPYF4M.js";
|
|
13
|
+
import "./chunk-ZJ4IM2PZ.js";
|
|
14
|
+
import "./chunk-NTXMEZIZ.js";
|
|
9
15
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
same,
|
|
14
|
-
shared
|
|
15
|
-
} from "./chunk-O7DV3EVB.js";
|
|
16
|
-
import "./chunk-72H4FXMD.js";
|
|
16
|
+
events
|
|
17
|
+
} from "./chunk-EQZOJU3B.js";
|
|
18
|
+
import "./chunk-6T25WKNK.js";
|
|
17
19
|
import "./chunk-KU6HF2EW.js";
|
|
18
20
|
import "./chunk-TW7KYJQ6.js";
|
|
19
21
|
import "./chunk-463H6B56.js";
|
|
20
|
-
import
|
|
21
|
-
protocol
|
|
22
|
-
} from "./chunk-GNPFWISJ.js";
|
|
23
|
-
|
|
24
|
-
// src/react.tsx
|
|
25
|
-
import {
|
|
26
|
-
useContext,
|
|
27
|
-
useEffect,
|
|
28
|
-
useMemo,
|
|
29
|
-
useRef,
|
|
30
|
-
useState,
|
|
31
|
-
useSyncExternalStore
|
|
32
|
-
} from "react";
|
|
33
|
-
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
34
|
-
import * as ReactAll from "react";
|
|
35
|
-
import * as ReactDOM from "react-dom";
|
|
36
|
-
import * as ReactDOMClient from "react-dom/client";
|
|
37
|
-
import * as JSXRuntime from "react/jsx-runtime";
|
|
38
|
-
import * as JSXDevRuntime from "react/jsx-dev-runtime";
|
|
39
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
40
|
-
function reactRemote(Component) {
|
|
41
|
-
const start = (el, props, ctx, hydrate) => {
|
|
42
|
-
const tree = (p) => /* @__PURE__ */ jsx(RemoteTree, { Component, props: p, ctx });
|
|
43
|
-
const options = { onUncaughtError: (e) => ctx.reportError(e) };
|
|
44
|
-
const root = hydrate ? hydrateRoot(el, tree(props), options) : createRoot(el, options);
|
|
45
|
-
const render = (p) => root.render(tree(p));
|
|
46
|
-
if (!hydrate) render(props);
|
|
47
|
-
return { update: render, unmount: () => root.unmount() };
|
|
48
|
-
};
|
|
49
|
-
return defineRemote({
|
|
50
|
-
mount: (el, props, ctx) => start(el, props, ctx, false),
|
|
51
|
-
hydrate: (el, props, ctx) => start(el, props, ctx, true)
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function useVitral() {
|
|
55
|
-
return useContext(VitralContext);
|
|
56
|
-
}
|
|
57
|
-
function usePortalContainer() {
|
|
58
|
-
return useVitral()?.portalContainer;
|
|
59
|
-
}
|
|
60
|
-
function useEvent(type, handler) {
|
|
61
|
-
const ref = useRef(handler);
|
|
62
|
-
ref.current = handler;
|
|
63
|
-
useEffect(() => events.on(type, (p) => ref.current(p)), [type]);
|
|
64
|
-
}
|
|
65
|
-
function useEventValue(type) {
|
|
66
|
-
const [value, setValue] = useState(() => events.last(type));
|
|
67
|
-
useEvent(type, setValue);
|
|
68
|
-
return value;
|
|
69
|
-
}
|
|
70
|
-
function useShared(key, select = same) {
|
|
71
|
-
const handle = useMemo(() => shared(key), [key]);
|
|
72
|
-
const [pick] = useState(memoSelect);
|
|
73
|
-
return useSyncExternalStore(
|
|
74
|
-
handle.subscribe,
|
|
75
|
-
() => pick(handle.get(), select),
|
|
76
|
-
() => pick(void 0, select)
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
var offeredTo;
|
|
80
|
-
function offerReact() {
|
|
81
|
-
const p = protocol();
|
|
82
|
-
if (offeredTo === p) return;
|
|
83
|
-
offeredTo = p;
|
|
84
|
-
const compiler = ReactAll.__COMPILER_RUNTIME;
|
|
85
|
-
const modules = {
|
|
86
|
-
react: ReactAll,
|
|
87
|
-
"react-dom": ReactDOM,
|
|
88
|
-
"react-dom/client": ReactDOMClient,
|
|
89
|
-
"react/jsx-runtime": JSXRuntime,
|
|
90
|
-
"react/jsx-dev-runtime": JSXDevRuntime,
|
|
91
|
-
// O React 19 expõe o react/compiler-runtime pelo próprio react.
|
|
92
|
-
...compiler && { "react/compiler-runtime": compiler }
|
|
93
|
-
};
|
|
94
|
-
p.pending(import("./dedupe-S7BHQMOZ.js").then((m) => m.offer(p, { react: { version: ReactAll.version, modules } })).catch(() => {
|
|
95
|
-
}));
|
|
96
|
-
}
|
|
97
|
-
function Remote({
|
|
98
|
-
name,
|
|
99
|
-
src,
|
|
100
|
-
props,
|
|
101
|
-
isolate,
|
|
102
|
-
fallback = null,
|
|
103
|
-
error,
|
|
104
|
-
onError,
|
|
105
|
-
className,
|
|
106
|
-
loading,
|
|
107
|
-
prefetch,
|
|
108
|
-
priority,
|
|
109
|
-
keepAlive
|
|
110
|
-
}) {
|
|
111
|
-
const target = useRef(null);
|
|
112
|
-
const slot = useRef(null);
|
|
113
|
-
const [state, setState] = useState({ status: "loading", error: null });
|
|
114
|
-
const onErrorRef = useRef(onError);
|
|
115
|
-
onErrorRef.current = onError;
|
|
116
|
-
useEffect(() => {
|
|
117
|
-
offerReact();
|
|
118
|
-
const s = hostSlot(target.current, {
|
|
119
|
-
name,
|
|
120
|
-
src,
|
|
121
|
-
props: props ?? {},
|
|
122
|
-
isolate,
|
|
123
|
-
loading,
|
|
124
|
-
prefetch,
|
|
125
|
-
priority,
|
|
126
|
-
keepAlive,
|
|
127
|
-
onStatus(status2, e) {
|
|
128
|
-
setState({ status: status2, error: e });
|
|
129
|
-
if (e) {
|
|
130
|
-
if (onErrorRef.current) onErrorRef.current(e);
|
|
131
|
-
else console.error(e);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
slot.current = s;
|
|
136
|
-
return () => {
|
|
137
|
-
slot.current = null;
|
|
138
|
-
queueMicrotask(() => s.destroy());
|
|
139
|
-
};
|
|
140
|
-
}, []);
|
|
141
|
-
useEffect(() => slot.current?.set({ name, src, isolate }), [name, src, isolate]);
|
|
142
|
-
useEffect(() => slot.current?.update(props ?? {}), [props]);
|
|
143
|
-
const retry = () => slot.current?.retry();
|
|
144
|
-
const { status, error: err } = state;
|
|
145
|
-
return /* @__PURE__ */ jsxs("div", { className, "data-vitral": name ?? src, "data-vitral-status": status, children: [
|
|
146
|
-
status === "loading" && fallback,
|
|
147
|
-
status === "error" && err && (typeof error === "function" ? error(err, retry) : error ?? null),
|
|
148
|
-
/* @__PURE__ */ jsx("div", { ref: target })
|
|
149
|
-
] });
|
|
150
|
-
}
|
|
22
|
+
import "./chunk-GNPFWISJ.js";
|
|
151
23
|
export {
|
|
152
24
|
Remote,
|
|
153
25
|
events,
|
|
26
|
+
preload,
|
|
154
27
|
reactRemote,
|
|
155
28
|
useEvent,
|
|
156
29
|
useEventValue,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
splitName
|
|
3
|
-
} from "./chunk-4NSPG6NK.js";
|
|
4
1
|
import {
|
|
5
2
|
verifyIntegrity
|
|
6
3
|
} from "./chunk-UYOPJ4XQ.js";
|
|
4
|
+
import {
|
|
5
|
+
splitName
|
|
6
|
+
} from "./chunk-PQXS2UDM.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveEntry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6T25WKNK.js";
|
|
10
10
|
import {
|
|
11
11
|
prefetchCss
|
|
12
12
|
} from "./chunk-KU6HF2EW.js";
|
package/dist/routes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { R as Routes, a as RouteMatch } from './match-CMBM_jLW.js';
|
|
2
|
-
import { P as Props } from './types-
|
|
3
|
-
import { S as SlotStatus } from './slot-
|
|
2
|
+
import { P as Props } from './types-wsKR1gfx.js';
|
|
3
|
+
import { S as SlotStatus } from './slot-Dhczjs1E.js';
|
|
4
4
|
import './errors-kjBv6IH_.js';
|
|
5
5
|
|
|
6
6
|
interface RoutesOptions {
|
package/dist/routes.js
CHANGED
|
@@ -2,12 +2,14 @@ import {
|
|
|
2
2
|
matchRoute
|
|
3
3
|
} from "./chunk-OVVGVPIV.js";
|
|
4
4
|
import {
|
|
5
|
-
createSlot
|
|
5
|
+
createSlot
|
|
6
|
+
} from "./chunk-NTXMEZIZ.js";
|
|
7
|
+
import {
|
|
6
8
|
navigate
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EQZOJU3B.js";
|
|
8
10
|
import {
|
|
9
11
|
warmSsr
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6T25WKNK.js";
|
|
11
13
|
import "./chunk-KU6HF2EW.js";
|
|
12
14
|
import "./chunk-TW7KYJQ6.js";
|
|
13
15
|
import "./chunk-463H6B56.js";
|
|
@@ -115,7 +117,7 @@ var VitralOutletElement = class extends Base {
|
|
|
115
117
|
if (ssr?.getAttribute("data-vitral-slot") === name) {
|
|
116
118
|
this.#status("loading", null);
|
|
117
119
|
warmSsr(ssr);
|
|
118
|
-
import("./hydrate-
|
|
120
|
+
import("./hydrate-6NE4MYOD.js").then((m) => {
|
|
119
121
|
if (this.#route === name && !this.#slot) this.#slot = m.hydrateSlot(this, ssr, { ...options, props: this.#props });
|
|
120
122
|
else ssr.remove();
|
|
121
123
|
});
|
package/dist/single-spa.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { R as RemoteError } from './errors-kjBv6IH_.js';
|
|
2
|
-
import { P as Props, I as Isolation, d as StyleOptions } from './types-
|
|
2
|
+
import { P as Props, I as Isolation, d as StyleOptions } from './types-wsKR1gfx.js';
|
|
3
3
|
|
|
4
4
|
type SlotStatus = 'loading' | 'ready' | 'error';
|
|
5
5
|
interface SlotOptions<P extends Props = Props> {
|
package/dist/solid.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JSX, Component, Accessor } from 'solid-js';
|
|
2
|
-
import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-
|
|
3
|
-
export { R as RemoteContext } from './types-
|
|
2
|
+
import { P as Props, I as Isolation, C as CheckedProps, a as RemoteModule, S as Shared } from './types-wsKR1gfx.js';
|
|
3
|
+
export { R as RemoteContext } from './types-wsKR1gfx.js';
|
|
4
4
|
import { R as RemoteError } from './errors-kjBv6IH_.js';
|
|
5
|
-
export { e as events } from './events-
|
|
5
|
+
export { e as events } from './events-Cieg_far.js';
|
|
6
6
|
export { n as navigate } from './navigate-BRG1WJUM.js';
|
|
7
7
|
import { L as Loading, P as Prefetch } from './host-slot-Cz6EiGsB.js';
|
|
8
8
|
|
package/dist/solid.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";
|