@alepha/react 0.15.0 → 0.15.1
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/auth/index.browser.js +603 -242
- package/dist/auth/index.browser.js.map +1 -1
- package/dist/auth/index.d.ts +6 -6
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1296 -922
- package/dist/auth/index.js.map +1 -1
- package/dist/core/index.d.ts +128 -128
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +20 -20
- package/dist/core/index.js.map +1 -1
- package/dist/form/index.d.ts +36 -36
- package/dist/form/index.d.ts.map +1 -1
- package/dist/form/index.js +15 -15
- package/dist/form/index.js.map +1 -1
- package/dist/head/index.browser.js +20 -0
- package/dist/head/index.browser.js.map +1 -1
- package/dist/head/index.d.ts +73 -65
- package/dist/head/index.d.ts.map +1 -1
- package/dist/head/index.js +20 -0
- package/dist/head/index.js.map +1 -1
- package/dist/i18n/index.d.ts +37 -37
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/router/index.browser.js +605 -244
- package/dist/router/index.browser.js.map +1 -1
- package/dist/router/index.d.ts +539 -550
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +1296 -922
- package/dist/router/index.js.map +1 -1
- package/dist/websocket/index.d.ts +38 -38
- package/dist/websocket/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/auth/__tests__/$auth.spec.ts +162 -147
- package/src/auth/index.ts +9 -3
- package/src/auth/services/ReactAuth.ts +15 -5
- package/src/core/hooks/useAction.ts +1 -2
- package/src/core/index.ts +4 -4
- package/src/form/errors/FormValidationError.ts +4 -6
- package/src/form/hooks/useFormState.ts +1 -1
- package/src/form/index.ts +1 -1
- package/src/form/services/FormModel.ts +31 -25
- package/src/head/helpers/SeoExpander.ts +2 -1
- package/src/head/hooks/useHead.spec.tsx +2 -2
- package/src/head/index.browser.ts +2 -2
- package/src/head/index.ts +4 -4
- package/src/head/interfaces/Head.ts +15 -3
- package/src/head/primitives/$head.ts +2 -5
- package/src/head/providers/BrowserHeadProvider.ts +55 -0
- package/src/head/providers/HeadProvider.ts +4 -1
- package/src/i18n/__tests__/integration.spec.tsx +1 -1
- package/src/i18n/components/Localize.spec.tsx +2 -2
- package/src/i18n/hooks/useI18n.browser.spec.tsx +2 -2
- package/src/i18n/index.ts +1 -1
- package/src/i18n/primitives/$dictionary.ts +1 -1
- package/src/i18n/providers/I18nProvider.spec.ts +1 -1
- package/src/i18n/providers/I18nProvider.ts +1 -1
- package/src/router/__tests__/page-head-browser.browser.spec.ts +5 -1
- package/src/router/__tests__/page-head.spec.ts +11 -7
- package/src/router/__tests__/seo-head.spec.ts +7 -3
- package/src/router/atoms/ssrManifestAtom.ts +2 -11
- package/src/router/components/ErrorViewer.tsx +626 -167
- package/src/router/components/Link.tsx +4 -2
- package/src/router/components/NestedView.tsx +7 -9
- package/src/router/components/NotFound.tsx +2 -2
- package/src/router/hooks/useQueryParams.ts +1 -1
- package/src/router/hooks/useRouter.ts +1 -1
- package/src/router/hooks/useRouterState.ts +1 -1
- package/src/router/index.browser.ts +10 -11
- package/src/router/index.shared.ts +7 -7
- package/src/router/index.ts +10 -7
- package/src/router/primitives/$page.browser.spec.tsx +6 -1
- package/src/router/primitives/$page.spec.tsx +7 -1
- package/src/router/primitives/$page.ts +5 -9
- package/src/router/providers/ReactBrowserProvider.ts +17 -6
- package/src/router/providers/ReactBrowserRouterProvider.ts +1 -1
- package/src/router/providers/ReactPageProvider.ts +4 -3
- package/src/router/providers/ReactServerProvider.ts +29 -37
- package/src/router/providers/ReactServerTemplateProvider.ts +300 -137
- package/src/router/providers/SSRManifestProvider.ts +17 -60
- package/src/router/services/ReactPageService.ts +4 -1
- package/src/router/services/ReactRouter.ts +6 -5
|
@@ -1,15 +1,24 @@
|
|
|
1
|
+
import { AlephaContext, AlephaReact, ClientOnly, ErrorBoundary, useAlepha, useEvents, useInject, useStore } from "@alepha/react";
|
|
1
2
|
import { $atom, $env, $hook, $inject, $module, $use, Alepha, AlephaError, KIND, Primitive, createPrimitive, t } from "alepha";
|
|
2
3
|
import { AlephaDateTime, DateTimeProvider } from "alepha/datetime";
|
|
3
|
-
import {
|
|
4
|
+
import { AlephaServer } from "alepha/server";
|
|
4
5
|
import { AlephaServerLinks, LinkProvider } from "alepha/server/links";
|
|
5
6
|
import { BrowserHeadProvider } from "@alepha/react/head";
|
|
7
|
+
import { $logger } from "alepha/logger";
|
|
6
8
|
import { RouterProvider } from "alepha/router";
|
|
7
9
|
import { StrictMode, createContext, createElement, memo, use, useEffect, useRef, useState } from "react";
|
|
8
10
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { AlephaContext, AlephaReact, ClientOnly, ErrorBoundary, useAlepha, useEvents, useInject, useStore } from "@alepha/react";
|
|
10
11
|
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
11
|
-
import { AlephaServer } from "alepha/server";
|
|
12
12
|
|
|
13
|
+
//#region ../../src/router/constants/PAGE_PRELOAD_KEY.ts
|
|
14
|
+
/**
|
|
15
|
+
* Symbol key for SSR module preloading path.
|
|
16
|
+
* Using Symbol.for() allows the Vite plugin to inject this at build time.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
const PAGE_PRELOAD_KEY = Symbol.for("alepha.page.preload");
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
13
22
|
//#region ../../src/router/services/ReactPageService.ts
|
|
14
23
|
/**
|
|
15
24
|
* $page methods interface.
|
|
@@ -23,15 +32,6 @@ var ReactPageService = class {
|
|
|
23
32
|
}
|
|
24
33
|
};
|
|
25
34
|
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region ../../src/router/constants/PAGE_PRELOAD_KEY.ts
|
|
28
|
-
/**
|
|
29
|
-
* Symbol key for SSR module preloading path.
|
|
30
|
-
* Using Symbol.for() allows the Vite plugin to inject this at build time.
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
const PAGE_PRELOAD_KEY = Symbol.for("alepha.page.preload");
|
|
34
|
-
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region ../../src/router/primitives/$page.ts
|
|
37
37
|
/**
|
|
@@ -196,33 +196,177 @@ var NotFound_default = NotFound;
|
|
|
196
196
|
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region ../../src/router/components/ErrorViewer.tsx
|
|
199
|
+
const isBrowser = typeof window !== "undefined";
|
|
199
200
|
/**
|
|
200
|
-
* Error viewer component
|
|
201
|
+
* Error viewer component - Terminal/brutalist aesthetic
|
|
201
202
|
*/
|
|
202
203
|
const ErrorViewer = ({ error, alepha }) => {
|
|
203
204
|
const [expanded, setExpanded] = useState(false);
|
|
204
|
-
|
|
205
|
+
const [showNodeModules, setShowNodeModules] = useState(false);
|
|
206
|
+
const [visible, setVisible] = useState(false);
|
|
207
|
+
const containerRef = useRef(null);
|
|
208
|
+
const isProduction = alepha.isProduction();
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
const timer = setTimeout(() => setVisible(true), 10);
|
|
211
|
+
return () => clearTimeout(timer);
|
|
212
|
+
}, []);
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
if (!isBrowser) return;
|
|
215
|
+
const handler = (e) => {
|
|
216
|
+
if (e.key === "c" && !e.metaKey && !e.ctrlKey) copyToClipboard(error.stack || error.message);
|
|
217
|
+
};
|
|
218
|
+
window.addEventListener("keydown", handler);
|
|
219
|
+
return () => window.removeEventListener("keydown", handler);
|
|
220
|
+
}, [error]);
|
|
221
|
+
if (isProduction) return /* @__PURE__ */ jsx(ErrorViewerProduction, {});
|
|
205
222
|
const frames = parseStackTrace(error.stack);
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
223
|
+
const appFrames = frames.filter((f) => !f.isNodeModules);
|
|
224
|
+
const nodeModulesFrames = frames.filter((f) => f.isNodeModules);
|
|
225
|
+
const visibleAppFrames = expanded ? appFrames : appFrames.slice(0, 5);
|
|
226
|
+
const hiddenAppCount = appFrames.length - 5;
|
|
227
|
+
const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
|
|
228
|
+
hour12: false,
|
|
229
|
+
hour: "2-digit",
|
|
230
|
+
minute: "2-digit",
|
|
231
|
+
second: "2-digit"
|
|
232
|
+
});
|
|
233
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
234
|
+
ref: containerRef,
|
|
235
|
+
style: {
|
|
236
|
+
...styles.overlay,
|
|
237
|
+
opacity: visible ? 1 : 0
|
|
238
|
+
},
|
|
239
|
+
role: "alertdialog",
|
|
240
|
+
"aria-modal": "true",
|
|
241
|
+
"aria-labelledby": "error-viewer-title",
|
|
242
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
243
|
+
style: styles.scanlines,
|
|
244
|
+
"aria-hidden": "true"
|
|
245
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
246
|
+
style: {
|
|
247
|
+
...styles.container,
|
|
248
|
+
transform: visible ? "translateY(0)" : "translateY(-20px)",
|
|
249
|
+
opacity: visible ? 1 : 0
|
|
250
|
+
},
|
|
251
|
+
children: [
|
|
252
|
+
/* @__PURE__ */ jsxs("div", {
|
|
253
|
+
style: styles.terminalBar,
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ jsxs("div", {
|
|
256
|
+
style: styles.terminalDots,
|
|
257
|
+
children: [
|
|
258
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
259
|
+
...styles.dot,
|
|
260
|
+
backgroundColor: "#ff5f57"
|
|
261
|
+
} }),
|
|
262
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
263
|
+
...styles.dot,
|
|
264
|
+
backgroundColor: "#febc2e"
|
|
265
|
+
} }),
|
|
266
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
267
|
+
...styles.dot,
|
|
268
|
+
backgroundColor: "#28c840"
|
|
269
|
+
} })
|
|
270
|
+
]
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx("div", {
|
|
273
|
+
style: styles.terminalTitle,
|
|
274
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
275
|
+
style: styles.terminalTitleText,
|
|
276
|
+
children: ["error — ", timestamp]
|
|
277
|
+
})
|
|
278
|
+
}),
|
|
279
|
+
/* @__PURE__ */ jsxs("div", {
|
|
280
|
+
style: styles.terminalActions,
|
|
281
|
+
children: [/* @__PURE__ */ jsx("kbd", {
|
|
282
|
+
style: styles.kbd,
|
|
283
|
+
children: "C"
|
|
284
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
285
|
+
style: styles.kbdLabel,
|
|
286
|
+
children: "copy"
|
|
287
|
+
})]
|
|
288
|
+
})
|
|
289
|
+
]
|
|
290
|
+
}),
|
|
291
|
+
/* @__PURE__ */ jsx(Header, { error }),
|
|
292
|
+
/* @__PURE__ */ jsxs("div", {
|
|
293
|
+
style: styles.stackSection,
|
|
294
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
295
|
+
style: styles.stackHeader,
|
|
296
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
297
|
+
style: styles.stackHeaderText,
|
|
298
|
+
children: "STACK TRACE"
|
|
299
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
300
|
+
style: styles.stackCount,
|
|
301
|
+
children: [
|
|
302
|
+
appFrames.length,
|
|
303
|
+
" frames",
|
|
304
|
+
nodeModulesFrames.length > 0 && ` · ${nodeModulesFrames.length} in node_modules`
|
|
305
|
+
]
|
|
306
|
+
})]
|
|
307
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
308
|
+
style: styles.frameList,
|
|
309
|
+
children: [
|
|
310
|
+
visibleAppFrames.map((frame, i) => /* @__PURE__ */ jsx(StackFrameRow, {
|
|
311
|
+
frame,
|
|
312
|
+
index: i
|
|
313
|
+
}, `${frame.raw}-${i}`)),
|
|
314
|
+
hiddenAppCount > 0 && !expanded && /* @__PURE__ */ jsx(ExpandButton, {
|
|
315
|
+
onClick: () => setExpanded(true),
|
|
316
|
+
label: `Show ${hiddenAppCount} more frames`
|
|
317
|
+
}),
|
|
318
|
+
expanded && hiddenAppCount > 0 && /* @__PURE__ */ jsx(ExpandButton, {
|
|
319
|
+
onClick: () => setExpanded(false),
|
|
320
|
+
label: "Collapse"
|
|
321
|
+
}),
|
|
322
|
+
nodeModulesFrames.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("button", {
|
|
323
|
+
type: "button",
|
|
324
|
+
onClick: () => setShowNodeModules(!showNodeModules),
|
|
325
|
+
style: styles.nodeModulesToggle,
|
|
326
|
+
children: [
|
|
327
|
+
/* @__PURE__ */ jsx("span", {
|
|
328
|
+
style: styles.nodeModulesIcon,
|
|
329
|
+
children: showNodeModules ? "▼" : "▶"
|
|
330
|
+
}),
|
|
331
|
+
/* @__PURE__ */ jsx("span", {
|
|
332
|
+
style: styles.nodeModulesLabel,
|
|
333
|
+
children: "node_modules"
|
|
334
|
+
}),
|
|
335
|
+
/* @__PURE__ */ jsx("span", {
|
|
336
|
+
style: styles.nodeModulesCount,
|
|
337
|
+
children: nodeModulesFrames.length
|
|
338
|
+
})
|
|
339
|
+
]
|
|
340
|
+
}), showNodeModules && /* @__PURE__ */ jsx("div", {
|
|
341
|
+
style: styles.nodeModulesFrames,
|
|
342
|
+
children: nodeModulesFrames.map((frame, i) => /* @__PURE__ */ jsx(StackFrameRow, {
|
|
343
|
+
frame,
|
|
344
|
+
index: appFrames.length + i,
|
|
345
|
+
dimmed: true
|
|
346
|
+
}, `nm-${frame.raw}-${i}`))
|
|
347
|
+
})] })
|
|
348
|
+
]
|
|
349
|
+
})]
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ jsx("div", {
|
|
352
|
+
style: styles.footer,
|
|
353
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
354
|
+
style: styles.footerText,
|
|
355
|
+
children: [
|
|
356
|
+
"Press ",
|
|
357
|
+
/* @__PURE__ */ jsx("kbd", {
|
|
358
|
+
style: styles.kbdInline,
|
|
359
|
+
children: "C"
|
|
360
|
+
}),
|
|
361
|
+
" to copy stack trace"
|
|
362
|
+
]
|
|
363
|
+
})
|
|
364
|
+
})
|
|
365
|
+
]
|
|
366
|
+
})]
|
|
220
367
|
});
|
|
221
368
|
};
|
|
222
369
|
var ErrorViewer_default = ErrorViewer;
|
|
223
|
-
/**
|
|
224
|
-
* Parse stack trace string into structured frames
|
|
225
|
-
*/
|
|
226
370
|
function parseStackTrace(stack) {
|
|
227
371
|
if (!stack) return [];
|
|
228
372
|
const lines = stack.split("\n").slice(1);
|
|
@@ -235,17 +379,16 @@ function parseStackTrace(stack) {
|
|
|
235
379
|
}
|
|
236
380
|
return frames;
|
|
237
381
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Parse a single stack trace line into a structured frame
|
|
240
|
-
*/
|
|
241
382
|
function parseStackLine(line) {
|
|
383
|
+
const isNodeModules = line.includes("node_modules") || line.includes("node:");
|
|
242
384
|
const withFn = line.match(/^at\s+(.+?)\s+\((.+):(\d+):(\d+)\)$/);
|
|
243
385
|
if (withFn) return {
|
|
244
386
|
fn: withFn[1],
|
|
245
387
|
file: withFn[2],
|
|
246
388
|
line: withFn[3],
|
|
247
389
|
col: withFn[4],
|
|
248
|
-
raw: line
|
|
390
|
+
raw: line,
|
|
391
|
+
isNodeModules
|
|
249
392
|
};
|
|
250
393
|
const withoutFn = line.match(/^at\s+(.+):(\d+):(\d+)$/);
|
|
251
394
|
if (withoutFn) return {
|
|
@@ -253,236 +396,412 @@ function parseStackLine(line) {
|
|
|
253
396
|
file: withoutFn[1],
|
|
254
397
|
line: withoutFn[2],
|
|
255
398
|
col: withoutFn[3],
|
|
256
|
-
raw: line
|
|
399
|
+
raw: line,
|
|
400
|
+
isNodeModules
|
|
257
401
|
};
|
|
258
402
|
return {
|
|
259
403
|
fn: "",
|
|
260
404
|
file: line.replace(/^at\s+/, ""),
|
|
261
405
|
line: "",
|
|
262
406
|
col: "",
|
|
263
|
-
raw: line
|
|
407
|
+
raw: line,
|
|
408
|
+
isNodeModules
|
|
264
409
|
};
|
|
265
410
|
}
|
|
266
|
-
/**
|
|
267
|
-
* Copy text to clipboard
|
|
268
|
-
*/
|
|
269
411
|
function copyToClipboard(text) {
|
|
270
|
-
navigator.clipboard
|
|
271
|
-
|
|
272
|
-
});
|
|
412
|
+
if (!isBrowser || !navigator.clipboard) return Promise.resolve(false);
|
|
413
|
+
return navigator.clipboard.writeText(text).then(() => true).catch(() => false);
|
|
273
414
|
}
|
|
274
415
|
/**
|
|
275
|
-
* Header
|
|
416
|
+
* Header with error badge and message
|
|
276
417
|
*/
|
|
277
418
|
function Header({ error }) {
|
|
278
419
|
const [copied, setCopied] = useState(false);
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
setTimeout(() => setCopied(false), 2e3);
|
|
420
|
+
const [hovered, setHovered] = useState(false);
|
|
421
|
+
useEffect(() => {
|
|
422
|
+
if (!copied) return;
|
|
423
|
+
const timer = setTimeout(() => setCopied(false), 2e3);
|
|
424
|
+
return () => clearTimeout(timer);
|
|
425
|
+
}, [copied]);
|
|
426
|
+
const handleCopy = async () => {
|
|
427
|
+
if (await copyToClipboard(error.stack || error.message)) setCopied(true);
|
|
283
428
|
};
|
|
284
429
|
return /* @__PURE__ */ jsxs("div", {
|
|
285
430
|
style: styles.header,
|
|
286
431
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
287
|
-
style: styles.
|
|
288
|
-
children: [/* @__PURE__ */
|
|
289
|
-
style: styles.
|
|
290
|
-
children:
|
|
432
|
+
style: styles.headerRow,
|
|
433
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
434
|
+
style: styles.errorIndicator,
|
|
435
|
+
children: [/* @__PURE__ */ jsx("div", { style: styles.errorGlow }), /* @__PURE__ */ jsx("div", {
|
|
436
|
+
style: styles.errorBadge,
|
|
437
|
+
children: error.name
|
|
438
|
+
})]
|
|
291
439
|
}), /* @__PURE__ */ jsx("button", {
|
|
292
440
|
type: "button",
|
|
293
441
|
onClick: handleCopy,
|
|
294
|
-
|
|
295
|
-
|
|
442
|
+
onMouseEnter: () => setHovered(true),
|
|
443
|
+
onMouseLeave: () => setHovered(false),
|
|
444
|
+
style: {
|
|
445
|
+
...styles.copyBtn,
|
|
446
|
+
...hovered ? styles.copyBtnHover : {}
|
|
447
|
+
},
|
|
448
|
+
children: copied ? "✓ Copied" : "Copy"
|
|
296
449
|
})]
|
|
297
450
|
}), /* @__PURE__ */ jsx("h1", {
|
|
451
|
+
id: "error-viewer-title",
|
|
298
452
|
style: styles.message,
|
|
299
453
|
children: error.message
|
|
300
454
|
})]
|
|
301
455
|
});
|
|
302
456
|
}
|
|
303
457
|
/**
|
|
304
|
-
*
|
|
458
|
+
* Single stack frame row
|
|
305
459
|
*/
|
|
306
|
-
function
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
460
|
+
function StackFrameRow({ frame, index, dimmed = false }) {
|
|
461
|
+
const [hovered, setHovered] = useState(false);
|
|
462
|
+
const isFirst = index === 0 && !dimmed;
|
|
463
|
+
const fileName = frame.file.split("/").pop() || frame.file;
|
|
464
|
+
const dirPath = frame.file.substring(0, frame.file.length - fileName.length);
|
|
465
|
+
const vsCodeLink = frame.file && frame.line ? `vscode://file${frame.file}:${frame.line}:${frame.col || 1}` : null;
|
|
466
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
467
|
+
style: {
|
|
468
|
+
...styles.frameIndex,
|
|
469
|
+
color: isFirst ? "#ff6b6b" : dimmed ? "#555" : "#666"
|
|
470
|
+
},
|
|
471
|
+
children: String(index + 1).padStart(2, "0")
|
|
472
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
473
|
+
style: styles.frameContent,
|
|
474
|
+
children: [frame.fn && /* @__PURE__ */ jsx("div", {
|
|
475
|
+
style: {
|
|
476
|
+
...styles.fnName,
|
|
477
|
+
color: dimmed ? "#888" : "#f0f0f0"
|
|
478
|
+
},
|
|
479
|
+
children: formatFunctionName(frame.fn)
|
|
313
480
|
}), /* @__PURE__ */ jsxs("div", {
|
|
314
|
-
style: styles.
|
|
481
|
+
style: styles.filePath,
|
|
315
482
|
children: [
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
483
|
+
/* @__PURE__ */ jsx("span", {
|
|
484
|
+
style: {
|
|
485
|
+
...styles.dirPath,
|
|
486
|
+
opacity: dimmed ? .6 : .8
|
|
487
|
+
},
|
|
488
|
+
children: dirPath
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ jsx("span", {
|
|
491
|
+
style: {
|
|
492
|
+
...styles.fileName,
|
|
493
|
+
color: dimmed ? "#5a9aba" : "#7cc4eb"
|
|
494
|
+
},
|
|
495
|
+
children: fileName
|
|
496
|
+
}),
|
|
497
|
+
frame.line && /* @__PURE__ */ jsxs("span", {
|
|
498
|
+
style: {
|
|
499
|
+
...styles.lineCol,
|
|
500
|
+
color: dimmed ? "#9a8a40" : "#e5b83a"
|
|
501
|
+
},
|
|
324
502
|
children: [
|
|
325
|
-
"
|
|
326
|
-
|
|
327
|
-
|
|
503
|
+
":",
|
|
504
|
+
frame.line,
|
|
505
|
+
frame.col && `:${frame.col}`
|
|
328
506
|
]
|
|
329
|
-
}),
|
|
330
|
-
expanded && hiddenCount > 0 && /* @__PURE__ */ jsx("button", {
|
|
331
|
-
type: "button",
|
|
332
|
-
onClick: onToggle,
|
|
333
|
-
style: styles.expandBtn,
|
|
334
|
-
children: "Show less"
|
|
335
507
|
})
|
|
336
508
|
]
|
|
337
509
|
})]
|
|
510
|
+
})] });
|
|
511
|
+
const rowStyles = {
|
|
512
|
+
...styles.frame,
|
|
513
|
+
...isFirst ? styles.frameFirst : {},
|
|
514
|
+
backgroundColor: hovered ? "rgba(255,255,255,0.03)" : "transparent"
|
|
515
|
+
};
|
|
516
|
+
if (vsCodeLink && isBrowser) return /* @__PURE__ */ jsx("a", {
|
|
517
|
+
href: vsCodeLink,
|
|
518
|
+
style: {
|
|
519
|
+
...rowStyles,
|
|
520
|
+
textDecoration: "none"
|
|
521
|
+
},
|
|
522
|
+
onMouseEnter: () => setHovered(true),
|
|
523
|
+
onMouseLeave: () => setHovered(false),
|
|
524
|
+
children: content
|
|
525
|
+
});
|
|
526
|
+
return /* @__PURE__ */ jsx("div", {
|
|
527
|
+
style: rowStyles,
|
|
528
|
+
children: content
|
|
338
529
|
});
|
|
339
530
|
}
|
|
340
531
|
/**
|
|
341
|
-
*
|
|
532
|
+
* Format function name with syntax highlighting
|
|
342
533
|
*/
|
|
343
|
-
function
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
534
|
+
function formatFunctionName(fn) {
|
|
535
|
+
const asyncMatch = fn.match(/^(async\s+)?(.+)$/);
|
|
536
|
+
if (asyncMatch?.[1]) return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
|
|
537
|
+
style: { color: "#c678dd" },
|
|
538
|
+
children: "async "
|
|
539
|
+
}), /* @__PURE__ */ jsx("span", { children: asyncMatch[2] })] });
|
|
540
|
+
const methodMatch = fn.match(/^(.+)\.([^.]+)$/);
|
|
541
|
+
if (methodMatch) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
542
|
+
/* @__PURE__ */ jsx("span", {
|
|
543
|
+
style: { color: "#e5c07b" },
|
|
544
|
+
children: methodMatch[1]
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx("span", {
|
|
547
|
+
style: { color: "#666" },
|
|
548
|
+
children: "."
|
|
549
|
+
}),
|
|
550
|
+
/* @__PURE__ */ jsx("span", { children: methodMatch[2] })
|
|
551
|
+
] });
|
|
552
|
+
return fn;
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Expand/collapse button
|
|
556
|
+
*/
|
|
557
|
+
function ExpandButton({ onClick, label }) {
|
|
558
|
+
const [hovered, setHovered] = useState(false);
|
|
559
|
+
return /* @__PURE__ */ jsx("button", {
|
|
560
|
+
type: "button",
|
|
561
|
+
onClick,
|
|
562
|
+
onMouseEnter: () => setHovered(true),
|
|
563
|
+
onMouseLeave: () => setHovered(false),
|
|
348
564
|
style: {
|
|
349
|
-
...styles.
|
|
350
|
-
|
|
565
|
+
...styles.expandBtn,
|
|
566
|
+
backgroundColor: hovered ? "rgba(255,255,255,0.05)" : "transparent",
|
|
567
|
+
color: hovered ? "#aaa" : "#777"
|
|
351
568
|
},
|
|
352
|
-
children:
|
|
353
|
-
style: styles.frameIndex,
|
|
354
|
-
children: index + 1
|
|
355
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
356
|
-
style: styles.frameContent,
|
|
357
|
-
children: [frame.fn && /* @__PURE__ */ jsx("div", {
|
|
358
|
-
style: styles.fnName,
|
|
359
|
-
children: frame.fn
|
|
360
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
361
|
-
style: styles.filePath,
|
|
362
|
-
children: [
|
|
363
|
-
/* @__PURE__ */ jsx("span", {
|
|
364
|
-
style: styles.dirPath,
|
|
365
|
-
children: dirPath
|
|
366
|
-
}),
|
|
367
|
-
/* @__PURE__ */ jsx("span", {
|
|
368
|
-
style: styles.fileName,
|
|
369
|
-
children: fileName
|
|
370
|
-
}),
|
|
371
|
-
frame.line && /* @__PURE__ */ jsxs("span", {
|
|
372
|
-
style: styles.lineCol,
|
|
373
|
-
children: [
|
|
374
|
-
":",
|
|
375
|
-
frame.line,
|
|
376
|
-
":",
|
|
377
|
-
frame.col
|
|
378
|
-
]
|
|
379
|
-
})
|
|
380
|
-
]
|
|
381
|
-
})]
|
|
382
|
-
})]
|
|
569
|
+
children: label
|
|
383
570
|
});
|
|
384
571
|
}
|
|
385
572
|
/**
|
|
386
|
-
* Production error view - minimal
|
|
573
|
+
* Production error view - minimal, user-friendly
|
|
387
574
|
*/
|
|
388
575
|
function ErrorViewerProduction() {
|
|
576
|
+
const [hovered, setHovered] = useState(false);
|
|
577
|
+
const handleReload = () => {
|
|
578
|
+
if (isBrowser) window.location.reload();
|
|
579
|
+
};
|
|
389
580
|
return /* @__PURE__ */ jsx("div", {
|
|
390
581
|
style: styles.overlay,
|
|
582
|
+
role: "alertdialog",
|
|
583
|
+
"aria-modal": "true",
|
|
391
584
|
children: /* @__PURE__ */ jsxs("div", {
|
|
392
585
|
style: styles.prodContainer,
|
|
393
586
|
children: [
|
|
394
587
|
/* @__PURE__ */ jsx("div", {
|
|
395
588
|
style: styles.prodIcon,
|
|
396
|
-
children: "
|
|
589
|
+
children: /* @__PURE__ */ jsxs("svg", {
|
|
590
|
+
width: "32",
|
|
591
|
+
height: "32",
|
|
592
|
+
viewBox: "0 0 24 24",
|
|
593
|
+
fill: "none",
|
|
594
|
+
stroke: "currentColor",
|
|
595
|
+
strokeWidth: "2",
|
|
596
|
+
children: [
|
|
597
|
+
/* @__PURE__ */ jsx("circle", {
|
|
598
|
+
cx: "12",
|
|
599
|
+
cy: "12",
|
|
600
|
+
r: "10"
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ jsx("line", {
|
|
603
|
+
x1: "12",
|
|
604
|
+
y1: "8",
|
|
605
|
+
x2: "12",
|
|
606
|
+
y2: "12"
|
|
607
|
+
}),
|
|
608
|
+
/* @__PURE__ */ jsx("line", {
|
|
609
|
+
x1: "12",
|
|
610
|
+
y1: "16",
|
|
611
|
+
x2: "12.01",
|
|
612
|
+
y2: "16"
|
|
613
|
+
})
|
|
614
|
+
]
|
|
615
|
+
})
|
|
397
616
|
}),
|
|
398
617
|
/* @__PURE__ */ jsx("h1", {
|
|
399
618
|
style: styles.prodTitle,
|
|
400
|
-
children: "
|
|
619
|
+
children: "Something went wrong"
|
|
401
620
|
}),
|
|
402
621
|
/* @__PURE__ */ jsx("p", {
|
|
403
622
|
style: styles.prodMessage,
|
|
404
|
-
children: "
|
|
623
|
+
children: "We encountered an unexpected error. Please try again."
|
|
405
624
|
}),
|
|
406
625
|
/* @__PURE__ */ jsx("button", {
|
|
407
626
|
type: "button",
|
|
408
|
-
onClick:
|
|
409
|
-
|
|
410
|
-
|
|
627
|
+
onClick: handleReload,
|
|
628
|
+
onMouseEnter: () => setHovered(true),
|
|
629
|
+
onMouseLeave: () => setHovered(false),
|
|
630
|
+
style: {
|
|
631
|
+
...styles.prodButton,
|
|
632
|
+
backgroundColor: hovered ? "#333" : "#222",
|
|
633
|
+
borderColor: hovered ? "#555" : "#444"
|
|
634
|
+
},
|
|
635
|
+
children: "Reload page"
|
|
411
636
|
})
|
|
412
637
|
]
|
|
413
638
|
})
|
|
414
639
|
});
|
|
415
640
|
}
|
|
641
|
+
const MONO_FONT = "ui-monospace, \"JetBrains Mono\", \"Fira Code\", SFMono-Regular, Menlo, Monaco, Consolas, monospace";
|
|
416
642
|
const styles = {
|
|
417
643
|
overlay: {
|
|
418
644
|
position: "fixed",
|
|
419
645
|
inset: 0,
|
|
420
|
-
backgroundColor: "rgba(0, 0, 0, 0.
|
|
646
|
+
backgroundColor: "rgba(0, 0, 0, 0.92)",
|
|
421
647
|
display: "flex",
|
|
422
648
|
alignItems: "flex-start",
|
|
423
649
|
justifyContent: "center",
|
|
424
650
|
padding: "40px 20px",
|
|
425
651
|
overflow: "auto",
|
|
426
|
-
fontFamily:
|
|
427
|
-
|
|
652
|
+
fontFamily: MONO_FONT,
|
|
653
|
+
fontSize: "13px",
|
|
654
|
+
zIndex: 99999,
|
|
655
|
+
transition: "opacity 0.2s ease-out"
|
|
656
|
+
},
|
|
657
|
+
scanlines: {
|
|
658
|
+
position: "fixed",
|
|
659
|
+
inset: 0,
|
|
660
|
+
background: "repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.1) 2px, rgba(0,0,0,0.1) 4px)",
|
|
661
|
+
pointerEvents: "none",
|
|
662
|
+
zIndex: 1e5
|
|
428
663
|
},
|
|
429
664
|
container: {
|
|
430
665
|
width: "100%",
|
|
431
|
-
maxWidth: "
|
|
432
|
-
backgroundColor: "#
|
|
433
|
-
borderRadius: "
|
|
666
|
+
maxWidth: "900px",
|
|
667
|
+
backgroundColor: "#0d0d0d",
|
|
668
|
+
borderRadius: "8px",
|
|
434
669
|
overflow: "hidden",
|
|
435
|
-
boxShadow: "0 25px
|
|
670
|
+
boxShadow: "0 0 0 1px #333, 0 25px 80px -12px rgba(0, 0, 0, 0.8)",
|
|
671
|
+
transition: "transform 0.3s ease-out, opacity 0.3s ease-out"
|
|
672
|
+
},
|
|
673
|
+
terminalBar: {
|
|
674
|
+
display: "flex",
|
|
675
|
+
alignItems: "center",
|
|
676
|
+
padding: "12px 16px",
|
|
677
|
+
backgroundColor: "#1a1a1a",
|
|
678
|
+
borderBottom: "1px solid #333"
|
|
679
|
+
},
|
|
680
|
+
terminalDots: {
|
|
681
|
+
display: "flex",
|
|
682
|
+
gap: "8px"
|
|
683
|
+
},
|
|
684
|
+
dot: {
|
|
685
|
+
width: "12px",
|
|
686
|
+
height: "12px",
|
|
687
|
+
borderRadius: "50%"
|
|
688
|
+
},
|
|
689
|
+
terminalTitle: {
|
|
690
|
+
flex: 1,
|
|
691
|
+
textAlign: "center"
|
|
692
|
+
},
|
|
693
|
+
terminalTitleText: {
|
|
694
|
+
color: "#777",
|
|
695
|
+
fontSize: "12px",
|
|
696
|
+
letterSpacing: "0.5px"
|
|
697
|
+
},
|
|
698
|
+
terminalActions: {
|
|
699
|
+
display: "flex",
|
|
700
|
+
alignItems: "center",
|
|
701
|
+
gap: "6px"
|
|
702
|
+
},
|
|
703
|
+
kbd: {
|
|
704
|
+
display: "inline-block",
|
|
705
|
+
padding: "2px 6px",
|
|
706
|
+
backgroundColor: "#2a2a2a",
|
|
707
|
+
borderRadius: "4px",
|
|
708
|
+
fontSize: "11px",
|
|
709
|
+
color: "#aaa",
|
|
710
|
+
border: "1px solid #444"
|
|
711
|
+
},
|
|
712
|
+
kbdInline: {
|
|
713
|
+
display: "inline-block",
|
|
714
|
+
padding: "1px 5px",
|
|
715
|
+
backgroundColor: "#222",
|
|
716
|
+
borderRadius: "3px",
|
|
717
|
+
fontSize: "11px",
|
|
718
|
+
color: "#888",
|
|
719
|
+
border: "1px solid #444",
|
|
720
|
+
marginLeft: "4px",
|
|
721
|
+
marginRight: "4px"
|
|
722
|
+
},
|
|
723
|
+
kbdLabel: {
|
|
724
|
+
color: "#777",
|
|
725
|
+
fontSize: "11px"
|
|
436
726
|
},
|
|
437
727
|
header: {
|
|
438
|
-
padding: "24px
|
|
439
|
-
borderBottom: "1px solid #333"
|
|
440
|
-
background: "linear-gradient(to bottom, #1f1f1f, #1a1a1a)"
|
|
728
|
+
padding: "24px",
|
|
729
|
+
borderBottom: "1px solid #333"
|
|
441
730
|
},
|
|
442
|
-
|
|
731
|
+
headerRow: {
|
|
443
732
|
display: "flex",
|
|
444
733
|
alignItems: "center",
|
|
445
734
|
justifyContent: "space-between",
|
|
446
735
|
marginBottom: "16px"
|
|
447
736
|
},
|
|
448
|
-
|
|
737
|
+
errorIndicator: {
|
|
738
|
+
position: "relative",
|
|
739
|
+
display: "inline-flex"
|
|
740
|
+
},
|
|
741
|
+
errorGlow: {
|
|
742
|
+
position: "absolute",
|
|
743
|
+
inset: "-4px",
|
|
744
|
+
background: "radial-gradient(ellipse at center, rgba(255,80,80,0.3) 0%, transparent 70%)",
|
|
745
|
+
borderRadius: "12px",
|
|
746
|
+
filter: "blur(8px)"
|
|
747
|
+
},
|
|
748
|
+
errorBadge: {
|
|
749
|
+
position: "relative",
|
|
449
750
|
display: "inline-block",
|
|
450
|
-
padding: "6px
|
|
451
|
-
backgroundColor: "#
|
|
452
|
-
color: "#
|
|
751
|
+
padding: "6px 14px",
|
|
752
|
+
backgroundColor: "#3d1a1a",
|
|
753
|
+
color: "#ff7b7b",
|
|
453
754
|
fontSize: "12px",
|
|
454
755
|
fontWeight: 600,
|
|
455
756
|
borderRadius: "6px",
|
|
456
|
-
|
|
757
|
+
border: "1px solid #5a2828",
|
|
758
|
+
letterSpacing: "0.5px"
|
|
457
759
|
},
|
|
458
760
|
copyBtn: {
|
|
459
|
-
padding: "8px
|
|
761
|
+
padding: "8px 14px",
|
|
460
762
|
backgroundColor: "transparent",
|
|
461
763
|
color: "#888",
|
|
462
|
-
fontSize: "
|
|
764
|
+
fontSize: "12px",
|
|
463
765
|
fontWeight: 500,
|
|
464
|
-
|
|
766
|
+
borderWidth: "1px",
|
|
767
|
+
borderStyle: "solid",
|
|
768
|
+
borderColor: "#444",
|
|
465
769
|
borderRadius: "6px",
|
|
466
770
|
cursor: "pointer",
|
|
467
|
-
transition: "all 0.15s"
|
|
771
|
+
transition: "all 0.15s",
|
|
772
|
+
fontFamily: MONO_FONT
|
|
773
|
+
},
|
|
774
|
+
copyBtnHover: {
|
|
775
|
+
backgroundColor: "#252525",
|
|
776
|
+
color: "#bbb",
|
|
777
|
+
borderColor: "#555"
|
|
468
778
|
},
|
|
469
779
|
message: {
|
|
470
780
|
margin: 0,
|
|
471
|
-
fontSize: "
|
|
472
|
-
fontWeight:
|
|
473
|
-
color: "#
|
|
474
|
-
lineHeight: 1.
|
|
475
|
-
wordBreak: "break-word"
|
|
781
|
+
fontSize: "18px",
|
|
782
|
+
fontWeight: 400,
|
|
783
|
+
color: "#e8e8e8",
|
|
784
|
+
lineHeight: 1.6,
|
|
785
|
+
wordBreak: "break-word",
|
|
786
|
+
fontFamily: MONO_FONT
|
|
476
787
|
},
|
|
477
|
-
stackSection: {
|
|
788
|
+
stackSection: { borderTop: "1px solid #2a2a2a" },
|
|
478
789
|
stackHeader: {
|
|
479
|
-
|
|
480
|
-
|
|
790
|
+
display: "flex",
|
|
791
|
+
alignItems: "center",
|
|
792
|
+
justifyContent: "space-between",
|
|
793
|
+
padding: "14px 24px",
|
|
794
|
+
borderBottom: "1px solid #2a2a2a"
|
|
795
|
+
},
|
|
796
|
+
stackHeaderText: {
|
|
797
|
+
fontSize: "10px",
|
|
481
798
|
fontWeight: 600,
|
|
482
799
|
color: "#666",
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
800
|
+
letterSpacing: "1.5px"
|
|
801
|
+
},
|
|
802
|
+
stackCount: {
|
|
803
|
+
fontSize: "11px",
|
|
804
|
+
color: "#555"
|
|
486
805
|
},
|
|
487
806
|
frameList: {
|
|
488
807
|
display: "flex",
|
|
@@ -491,92 +810,134 @@ const styles = {
|
|
|
491
810
|
frame: {
|
|
492
811
|
display: "flex",
|
|
493
812
|
alignItems: "flex-start",
|
|
494
|
-
padding: "
|
|
495
|
-
borderBottom: "1px solid #
|
|
496
|
-
transition: "background-color 0.
|
|
813
|
+
padding: "12px 24px",
|
|
814
|
+
borderBottom: "1px solid #222",
|
|
815
|
+
transition: "background-color 0.1s",
|
|
816
|
+
cursor: "pointer"
|
|
817
|
+
},
|
|
818
|
+
frameFirst: {
|
|
819
|
+
backgroundColor: "rgba(255, 80, 80, 0.08)",
|
|
820
|
+
borderLeft: "2px solid #ff6b6b"
|
|
497
821
|
},
|
|
498
|
-
frameFirst: { backgroundColor: "rgba(220, 38, 38, 0.1)" },
|
|
499
822
|
frameIndex: {
|
|
500
823
|
width: "28px",
|
|
501
824
|
flexShrink: 0,
|
|
502
|
-
fontSize: "
|
|
825
|
+
fontSize: "11px",
|
|
503
826
|
fontWeight: 500,
|
|
504
|
-
|
|
505
|
-
fontFamily: "monospace"
|
|
827
|
+
fontFamily: MONO_FONT
|
|
506
828
|
},
|
|
507
829
|
frameContent: {
|
|
508
830
|
flex: 1,
|
|
509
831
|
minWidth: 0
|
|
510
832
|
},
|
|
511
833
|
fnName: {
|
|
512
|
-
fontSize: "
|
|
834
|
+
fontSize: "13px",
|
|
513
835
|
fontWeight: 500,
|
|
514
|
-
color: "#e5e5e5",
|
|
515
836
|
marginBottom: "4px",
|
|
516
|
-
fontFamily:
|
|
837
|
+
fontFamily: MONO_FONT
|
|
517
838
|
},
|
|
518
839
|
filePath: {
|
|
519
|
-
fontSize: "
|
|
840
|
+
fontSize: "12px",
|
|
520
841
|
color: "#888",
|
|
521
|
-
fontFamily:
|
|
842
|
+
fontFamily: MONO_FONT,
|
|
522
843
|
wordBreak: "break-all"
|
|
523
844
|
},
|
|
524
|
-
dirPath: { color: "#
|
|
525
|
-
fileName: { color: "#
|
|
526
|
-
lineCol: { color: "#
|
|
845
|
+
dirPath: { color: "#666" },
|
|
846
|
+
fileName: { color: "#7cc4eb" },
|
|
847
|
+
lineCol: { color: "#e5b83a" },
|
|
527
848
|
expandBtn: {
|
|
528
|
-
|
|
849
|
+
width: "100%",
|
|
850
|
+
padding: "14px 24px",
|
|
529
851
|
backgroundColor: "transparent",
|
|
852
|
+
color: "#777",
|
|
853
|
+
fontSize: "12px",
|
|
854
|
+
fontWeight: 500,
|
|
855
|
+
border: "none",
|
|
856
|
+
borderTop: "1px solid #2a2a2a",
|
|
857
|
+
cursor: "pointer",
|
|
858
|
+
textAlign: "left",
|
|
859
|
+
transition: "all 0.15s",
|
|
860
|
+
fontFamily: MONO_FONT
|
|
861
|
+
},
|
|
862
|
+
nodeModulesToggle: {
|
|
863
|
+
display: "flex",
|
|
864
|
+
alignItems: "center",
|
|
865
|
+
gap: "10px",
|
|
866
|
+
width: "100%",
|
|
867
|
+
padding: "12px 24px",
|
|
868
|
+
backgroundColor: "#0a0a0a",
|
|
530
869
|
color: "#666",
|
|
531
|
-
fontSize: "
|
|
870
|
+
fontSize: "11px",
|
|
532
871
|
fontWeight: 500,
|
|
533
872
|
border: "none",
|
|
534
|
-
borderTop: "1px solid #
|
|
873
|
+
borderTop: "1px solid #2a2a2a",
|
|
535
874
|
cursor: "pointer",
|
|
536
875
|
textAlign: "left",
|
|
537
|
-
|
|
876
|
+
fontFamily: MONO_FONT
|
|
877
|
+
},
|
|
878
|
+
nodeModulesIcon: {
|
|
879
|
+
fontSize: "8px",
|
|
880
|
+
color: "#555"
|
|
881
|
+
},
|
|
882
|
+
nodeModulesLabel: {
|
|
883
|
+
flex: 1,
|
|
884
|
+
letterSpacing: "0.5px"
|
|
885
|
+
},
|
|
886
|
+
nodeModulesCount: { color: "#555" },
|
|
887
|
+
nodeModulesFrames: { backgroundColor: "#080808" },
|
|
888
|
+
footer: {
|
|
889
|
+
padding: "14px 24px",
|
|
890
|
+
borderTop: "1px solid #2a2a2a",
|
|
891
|
+
backgroundColor: "#0a0a0a"
|
|
892
|
+
},
|
|
893
|
+
footerText: {
|
|
894
|
+
fontSize: "11px",
|
|
895
|
+
color: "#555"
|
|
538
896
|
},
|
|
539
897
|
prodContainer: {
|
|
540
898
|
textAlign: "center",
|
|
541
899
|
padding: "60px 40px",
|
|
542
|
-
backgroundColor: "#
|
|
543
|
-
borderRadius: "
|
|
544
|
-
maxWidth: "400px"
|
|
900
|
+
backgroundColor: "#0d0d0d",
|
|
901
|
+
borderRadius: "8px",
|
|
902
|
+
maxWidth: "400px",
|
|
903
|
+
border: "1px solid #333"
|
|
545
904
|
},
|
|
546
905
|
prodIcon: {
|
|
547
906
|
width: "64px",
|
|
548
907
|
height: "64px",
|
|
549
908
|
margin: "0 auto 24px",
|
|
550
|
-
|
|
551
|
-
borderRadius: "50%",
|
|
909
|
+
color: "#666",
|
|
552
910
|
display: "flex",
|
|
553
911
|
alignItems: "center",
|
|
554
|
-
justifyContent: "center"
|
|
555
|
-
fontSize: "32px",
|
|
556
|
-
fontWeight: 700,
|
|
557
|
-
color: "#fff"
|
|
912
|
+
justifyContent: "center"
|
|
558
913
|
},
|
|
559
914
|
prodTitle: {
|
|
560
915
|
margin: "0 0 12px",
|
|
561
|
-
fontSize: "
|
|
562
|
-
fontWeight:
|
|
563
|
-
color: "#
|
|
916
|
+
fontSize: "18px",
|
|
917
|
+
fontWeight: 500,
|
|
918
|
+
color: "#f0f0f0",
|
|
919
|
+
fontFamily: MONO_FONT
|
|
564
920
|
},
|
|
565
921
|
prodMessage: {
|
|
566
922
|
margin: "0 0 28px",
|
|
567
|
-
fontSize: "
|
|
923
|
+
fontSize: "13px",
|
|
568
924
|
color: "#888",
|
|
569
|
-
lineHeight: 1.6
|
|
925
|
+
lineHeight: 1.6,
|
|
926
|
+
fontFamily: MONO_FONT
|
|
570
927
|
},
|
|
571
928
|
prodButton: {
|
|
572
929
|
padding: "12px 24px",
|
|
573
|
-
backgroundColor: "#
|
|
574
|
-
color: "#
|
|
575
|
-
fontSize: "
|
|
576
|
-
fontWeight:
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
930
|
+
backgroundColor: "#222",
|
|
931
|
+
color: "#bbb",
|
|
932
|
+
fontSize: "13px",
|
|
933
|
+
fontWeight: 500,
|
|
934
|
+
borderWidth: "1px",
|
|
935
|
+
borderStyle: "solid",
|
|
936
|
+
borderColor: "#444",
|
|
937
|
+
borderRadius: "6px",
|
|
938
|
+
cursor: "pointer",
|
|
939
|
+
transition: "all 0.15s",
|
|
940
|
+
fontFamily: MONO_FONT
|
|
580
941
|
}
|
|
581
942
|
};
|
|
582
943
|
|
|
@@ -654,11 +1015,11 @@ const NestedView = (props) => {
|
|
|
654
1015
|
const animationExitDuration = useRef(0);
|
|
655
1016
|
const animationExitNow = useRef(0);
|
|
656
1017
|
useEvents({
|
|
657
|
-
"react:transition:begin": async ({ previous, state
|
|
1018
|
+
"react:transition:begin": async ({ previous, state }) => {
|
|
658
1019
|
const layer = previous.layers[index];
|
|
659
1020
|
if (!layer) return;
|
|
660
|
-
if (`${state
|
|
661
|
-
const animationExit = parseAnimation(layer.route?.animation, state
|
|
1021
|
+
if (`${state.url.pathname}/`.startsWith(`${layer.path}/`)) return;
|
|
1022
|
+
const animationExit = parseAnimation(layer.route?.animation, state, "exit");
|
|
662
1023
|
if (animationExit) {
|
|
663
1024
|
const duration = animationExit.duration || 200;
|
|
664
1025
|
animationExitNow.current = Date.now();
|
|
@@ -670,8 +1031,8 @@ const NestedView = (props) => {
|
|
|
670
1031
|
setAnimation("");
|
|
671
1032
|
}
|
|
672
1033
|
},
|
|
673
|
-
"react:transition:end": async ({ state
|
|
674
|
-
const layer = state
|
|
1034
|
+
"react:transition:end": async ({ state }) => {
|
|
1035
|
+
const layer = state.layers[index];
|
|
675
1036
|
if (animationExitNow.current) {
|
|
676
1037
|
const duration = animationExitDuration.current;
|
|
677
1038
|
const diff = Date.now() - animationExitNow.current;
|
|
@@ -679,7 +1040,7 @@ const NestedView = (props) => {
|
|
|
679
1040
|
}
|
|
680
1041
|
if (!layer?.cache) {
|
|
681
1042
|
setView(layer?.element);
|
|
682
|
-
const animationEnter = parseAnimation(layer?.route?.animation, state
|
|
1043
|
+
const animationEnter = parseAnimation(layer?.route?.animation, state, "enter");
|
|
683
1044
|
if (animationEnter) setAnimation(animationEnter.animation);
|
|
684
1045
|
else setAnimation("");
|
|
685
1046
|
}
|
|
@@ -842,29 +1203,29 @@ var ReactPageProvider = class {
|
|
|
842
1203
|
let forceRefresh = false;
|
|
843
1204
|
for (let i = 0; i < stack.length; i++) {
|
|
844
1205
|
const it = stack[i];
|
|
845
|
-
const route
|
|
1206
|
+
const route = it.route;
|
|
846
1207
|
const config = {};
|
|
847
1208
|
try {
|
|
848
|
-
this.convertStringObjectToObject(route
|
|
849
|
-
config.query = route
|
|
1209
|
+
this.convertStringObjectToObject(route.schema?.query, state.query);
|
|
1210
|
+
config.query = route.schema?.query ? this.alepha.codec.decode(route.schema.query, state.query) : {};
|
|
850
1211
|
} catch (e) {
|
|
851
1212
|
it.error = e;
|
|
852
1213
|
break;
|
|
853
1214
|
}
|
|
854
1215
|
try {
|
|
855
|
-
config.params = route
|
|
1216
|
+
config.params = route.schema?.params ? this.alepha.codec.decode(route.schema.params, state.params) : {};
|
|
856
1217
|
} catch (e) {
|
|
857
1218
|
it.error = e;
|
|
858
1219
|
break;
|
|
859
1220
|
}
|
|
860
1221
|
it.config = { ...config };
|
|
861
|
-
if (previous?.[i] && !forceRefresh && previous[i].name === route
|
|
1222
|
+
if (previous?.[i] && !forceRefresh && previous[i].name === route.name) {
|
|
862
1223
|
const url = (str) => str ? str.replace(/\/\/+/g, "/") : "/";
|
|
863
1224
|
if (JSON.stringify({
|
|
864
1225
|
part: url(previous[i].part),
|
|
865
1226
|
params: previous[i].config?.params ?? {}
|
|
866
1227
|
}) === JSON.stringify({
|
|
867
|
-
part: url(route
|
|
1228
|
+
part: url(route.path),
|
|
868
1229
|
params: config.params ?? {}
|
|
869
1230
|
})) {
|
|
870
1231
|
it.props = previous[i].props;
|
|
@@ -878,11 +1239,11 @@ var ReactPageProvider = class {
|
|
|
878
1239
|
}
|
|
879
1240
|
forceRefresh = true;
|
|
880
1241
|
}
|
|
881
|
-
if (!route
|
|
1242
|
+
if (!route.loader) continue;
|
|
882
1243
|
try {
|
|
883
1244
|
const args = Object.create(state);
|
|
884
1245
|
Object.assign(args, config, context);
|
|
885
|
-
const props = await route
|
|
1246
|
+
const props = await route.loader?.(args) ?? {};
|
|
886
1247
|
it.props = { ...props };
|
|
887
1248
|
context = {
|
|
888
1249
|
...context,
|
|
@@ -907,9 +1268,9 @@ var ReactPageProvider = class {
|
|
|
907
1268
|
const localErrorHandler = this.getErrorHandler(it.route);
|
|
908
1269
|
if (localErrorHandler) {
|
|
909
1270
|
const onErrorParent = state.onError;
|
|
910
|
-
state.onError = (error, context
|
|
911
|
-
const result = localErrorHandler(error, context
|
|
912
|
-
if (result === void 0) return onErrorParent(error, context
|
|
1271
|
+
state.onError = (error, context) => {
|
|
1272
|
+
const result = localErrorHandler(error, context);
|
|
1273
|
+
if (result === void 0) return onErrorParent(error, context);
|
|
913
1274
|
return result;
|
|
914
1275
|
};
|
|
915
1276
|
}
|
|
@@ -1032,9 +1393,9 @@ var ReactPageProvider = class {
|
|
|
1032
1393
|
map(pages, target) {
|
|
1033
1394
|
const children = target.options.children ? Array.isArray(target.options.children) ? target.options.children : target.options.children() : [];
|
|
1034
1395
|
const getChildrenFromParent = (it) => {
|
|
1035
|
-
const children
|
|
1036
|
-
for (const page of pages) if (page.options.parent === it) children
|
|
1037
|
-
return children
|
|
1396
|
+
const children = [];
|
|
1397
|
+
for (const page of pages) if (page.options.parent === it) children.push(page);
|
|
1398
|
+
return children;
|
|
1038
1399
|
};
|
|
1039
1400
|
children.push(...getChildrenFromParent(target));
|
|
1040
1401
|
return {
|
|
@@ -1311,7 +1672,7 @@ var ReactBrowserProvider = class {
|
|
|
1311
1672
|
const hydration = this.getHydrationState();
|
|
1312
1673
|
const previous = hydration?.layers ?? [];
|
|
1313
1674
|
if (hydration) {
|
|
1314
|
-
for (const [key, value] of Object.entries(hydration)) if (key !== "layers") this.alepha.
|
|
1675
|
+
for (const [key, value] of Object.entries(hydration)) if (key !== "layers") this.alepha.set(key, value);
|
|
1315
1676
|
}
|
|
1316
1677
|
await this.render({ previous });
|
|
1317
1678
|
const element = this.router.root(this.state);
|
|
@@ -1331,6 +1692,29 @@ var ReactBrowserProvider = class {
|
|
|
1331
1692
|
});
|
|
1332
1693
|
};
|
|
1333
1694
|
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region ../../src/router/providers/ReactBrowserRendererProvider.ts
|
|
1697
|
+
/**
|
|
1698
|
+
* Browser specific React renderer (react-dom/client interface)
|
|
1699
|
+
*/
|
|
1700
|
+
var ReactBrowserRendererProvider = class {
|
|
1701
|
+
log = $logger();
|
|
1702
|
+
root;
|
|
1703
|
+
onBrowserRender = $hook({
|
|
1704
|
+
on: "react:browser:render",
|
|
1705
|
+
handler: async ({ hydration, root, element }) => {
|
|
1706
|
+
if (hydration?.layers) {
|
|
1707
|
+
this.root = hydrateRoot(root, element);
|
|
1708
|
+
this.log.info("Hydrated root element");
|
|
1709
|
+
} else {
|
|
1710
|
+
this.root ??= createRoot(root);
|
|
1711
|
+
this.root.render(element);
|
|
1712
|
+
this.log.info("Created root element");
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
});
|
|
1716
|
+
};
|
|
1717
|
+
|
|
1334
1718
|
//#endregion
|
|
1335
1719
|
//#region ../../src/router/services/ReactRouter.ts
|
|
1336
1720
|
/**
|
|
@@ -1463,29 +1847,6 @@ var ReactRouter = class {
|
|
|
1463
1847
|
}
|
|
1464
1848
|
};
|
|
1465
1849
|
|
|
1466
|
-
//#endregion
|
|
1467
|
-
//#region ../../src/router/providers/ReactBrowserRendererProvider.ts
|
|
1468
|
-
/**
|
|
1469
|
-
* Browser specific React renderer (react-dom/client interface)
|
|
1470
|
-
*/
|
|
1471
|
-
var ReactBrowserRendererProvider = class {
|
|
1472
|
-
log = $logger();
|
|
1473
|
-
root;
|
|
1474
|
-
onBrowserRender = $hook({
|
|
1475
|
-
on: "react:browser:render",
|
|
1476
|
-
handler: async ({ hydration, root, element }) => {
|
|
1477
|
-
if (hydration?.layers) {
|
|
1478
|
-
this.root = hydrateRoot(root, element);
|
|
1479
|
-
this.log.info("Hydrated root element");
|
|
1480
|
-
} else {
|
|
1481
|
-
this.root ??= createRoot(root);
|
|
1482
|
-
this.root.render(element);
|
|
1483
|
-
this.log.info("Created root element");
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
});
|
|
1487
|
-
};
|
|
1488
|
-
|
|
1489
1850
|
//#endregion
|
|
1490
1851
|
//#region ../../src/router/hooks/useRouter.ts
|
|
1491
1852
|
/**
|
|
@@ -1573,12 +1934,12 @@ const useQueryParams = (schema, options = {}) => {
|
|
|
1573
1934
|
useEffect(() => {
|
|
1574
1935
|
setQueryParams(decode(alepha, schema, querystring));
|
|
1575
1936
|
}, [querystring]);
|
|
1576
|
-
return [queryParams, (queryParams
|
|
1577
|
-
setQueryParams(queryParams
|
|
1937
|
+
return [queryParams, (queryParams) => {
|
|
1938
|
+
setQueryParams(queryParams);
|
|
1578
1939
|
router.setQueryParams((data) => {
|
|
1579
1940
|
return {
|
|
1580
1941
|
...data,
|
|
1581
|
-
[key]: encode(alepha, schema, queryParams
|
|
1942
|
+
[key]: encode(alepha, schema, queryParams)
|
|
1582
1943
|
};
|
|
1583
1944
|
});
|
|
1584
1945
|
}];
|