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