@arcanewizards/sigil 0.1.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/dist/chunk-4PMRDURG.js +66 -0
- package/dist/chunk-5DRI7C4U.cjs +66 -0
- package/dist/chunk-A5LYYZER.cjs +103 -0
- package/dist/chunk-BIY5HAXP.js +125 -0
- package/dist/chunk-CAYKPJIX.cjs +10 -0
- package/dist/chunk-EJNNLQ2S.js +72 -0
- package/dist/chunk-FHXT3DAL.js +103 -0
- package/dist/chunk-H4U4Z4GM.js +66 -0
- package/dist/chunk-LSHKAVON.js +10 -0
- package/dist/chunk-MXDDIFIO.cjs +767 -0
- package/dist/chunk-PEARNJ5G.cjs +125 -0
- package/dist/chunk-RI33QVOD.cjs +66 -0
- package/dist/chunk-VZ4A6RRT.cjs +72 -0
- package/dist/chunk-XAK7WC3D.js +767 -0
- package/dist/frontend/appearance.cjs +88 -0
- package/dist/frontend/appearance.d.cts +11 -0
- package/dist/frontend/appearance.d.ts +11 -0
- package/dist/frontend/appearance.js +88 -0
- package/dist/frontend/context.cjs +16 -0
- package/dist/frontend/context.d.cts +32 -0
- package/dist/frontend/context.d.ts +32 -0
- package/dist/frontend/context.js +16 -0
- package/dist/frontend/controls/index.cjs +49 -0
- package/dist/frontend/controls/index.d.cts +168 -0
- package/dist/frontend/controls/index.d.ts +168 -0
- package/dist/frontend/controls/index.js +49 -0
- package/dist/frontend/dialogs.cjs +17 -0
- package/dist/frontend/dialogs.d.cts +36 -0
- package/dist/frontend/dialogs.d.ts +36 -0
- package/dist/frontend/dialogs.js +17 -0
- package/dist/frontend/input.cjs +8 -0
- package/dist/frontend/input.d.cts +33 -0
- package/dist/frontend/input.d.ts +33 -0
- package/dist/frontend/input.js +8 -0
- package/dist/frontend/preferences.cjs +54 -0
- package/dist/frontend/preferences.d.cts +14 -0
- package/dist/frontend/preferences.d.ts +14 -0
- package/dist/frontend/preferences.js +54 -0
- package/dist/frontend/styles/base.css +321 -0
- package/dist/frontend/styles/sigil.css +785 -0
- package/dist/frontend/styles/theme.css +625 -0
- package/dist/frontend/styling.cjs +18 -0
- package/dist/frontend/styling.d.cts +32 -0
- package/dist/frontend/styling.d.ts +32 -0
- package/dist/frontend/styling.js +18 -0
- package/dist/frontend/toolbars.cjs +18 -0
- package/dist/frontend/toolbars.d.cts +11 -0
- package/dist/frontend/toolbars.d.ts +11 -0
- package/dist/frontend/toolbars.js +18 -0
- package/dist/frontend/tooltip.cjs +10 -0
- package/dist/frontend/tooltip.d.cts +16 -0
- package/dist/frontend/tooltip.d.ts +16 -0
- package/dist/frontend/tooltip.js +10 -0
- package/dist/frontend.cjs +359 -0
- package/dist/frontend.d.cts +90 -0
- package/dist/frontend.d.ts +90 -0
- package/dist/frontend.js +359 -0
- package/dist/index.cjs +492 -0
- package/dist/index.d.cts +134 -0
- package/dist/index.d.ts +134 -0
- package/dist/index.js +492 -0
- package/dist/proto-B-WcMUOE.d.cts +33 -0
- package/dist/proto-kGDF-yWB.d.ts +33 -0
- package/dist/types-X8O95zmC.d.cts +23 -0
- package/dist/types-X8O95zmC.d.ts +23 -0
- package/package.json +123 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const SIGIL_COLOR: z.ZodEnum<["purple", "blue", "teal", "red", "green", "yellow", "brown", "orange", "gray"]>;
|
|
5
|
+
type SigilColor = z.infer<typeof SIGIL_COLOR>;
|
|
6
|
+
type SigilUsageColor = SigilColor | 'unknown';
|
|
7
|
+
type SigilUsageColorUsage = {
|
|
8
|
+
text: string;
|
|
9
|
+
foreground: string;
|
|
10
|
+
background: string;
|
|
11
|
+
border: string;
|
|
12
|
+
dragBorder: string;
|
|
13
|
+
selectedBackground: string;
|
|
14
|
+
selectedBorder: string;
|
|
15
|
+
selectedText: string;
|
|
16
|
+
dimmedBackground: string;
|
|
17
|
+
dimmedBorder: string;
|
|
18
|
+
gradientLight: string;
|
|
19
|
+
gradientDark: string;
|
|
20
|
+
};
|
|
21
|
+
declare const sigilColorUsage: (color: SigilUsageColor) => SigilUsageColorUsage;
|
|
22
|
+
declare const cssSigilColorUsageVariables: (prefix: string, usage: SigilUsageColorUsage) => CSSProperties;
|
|
23
|
+
declare const cssHintColorVariables: (color: SigilColor) => CSSProperties;
|
|
24
|
+
/**
|
|
25
|
+
* Hook that will adjust the root hint color based on the given color.
|
|
26
|
+
*/
|
|
27
|
+
declare const useRootHintVariables: (color: SigilColor) => void;
|
|
28
|
+
declare const cssVariables: (variables: Partial<Record<`--${string}`, string | number>>) => CSSProperties;
|
|
29
|
+
declare function cnd<T extends string>(condition: unknown, truthyClassName: T): T | undefined;
|
|
30
|
+
declare function cnd<T extends string, F extends string>(condition: unknown, truthyClassName: T, falseyClassName: F): T | F;
|
|
31
|
+
|
|
32
|
+
export { SIGIL_COLOR, type SigilColor, type SigilUsageColor, type SigilUsageColorUsage, cnd, cssHintColorVariables, cssSigilColorUsageVariables, cssVariables, sigilColorUsage, useRootHintVariables };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SIGIL_COLOR,
|
|
3
|
+
cnd,
|
|
4
|
+
cssHintColorVariables,
|
|
5
|
+
cssSigilColorUsageVariables,
|
|
6
|
+
cssVariables,
|
|
7
|
+
sigilColorUsage,
|
|
8
|
+
useRootHintVariables
|
|
9
|
+
} from "../chunk-H4U4Z4GM.js";
|
|
10
|
+
export {
|
|
11
|
+
SIGIL_COLOR,
|
|
12
|
+
cnd,
|
|
13
|
+
cssHintColorVariables,
|
|
14
|
+
cssSigilColorUsageVariables,
|
|
15
|
+
cssVariables,
|
|
16
|
+
sigilColorUsage,
|
|
17
|
+
useRootHintVariables
|
|
18
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkA5LYYZERcjs = require('../chunk-A5LYYZER.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
exports.ToolbarDivider = _chunkA5LYYZERcjs.ToolbarDivider; exports.ToolbarGrow = _chunkA5LYYZERcjs.ToolbarGrow; exports.ToolbarRow = _chunkA5LYYZERcjs.ToolbarRow; exports.ToolbarRowTall = _chunkA5LYYZERcjs.ToolbarRowTall; exports.ToolbarSegment = _chunkA5LYYZERcjs.ToolbarSegment; exports.ToolbarSpacer = _chunkA5LYYZERcjs.ToolbarSpacer; exports.ToolbarWrapper = _chunkA5LYYZERcjs.ToolbarWrapper;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
declare const ToolbarWrapper: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const ToolbarRow: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const ToolbarRowTall: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const ToolbarSegment: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const ToolbarDivider: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const ToolbarSpacer: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const ToolbarGrow: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
|
|
11
|
+
export { ToolbarDivider, ToolbarGrow, ToolbarRow, ToolbarRowTall, ToolbarSegment, ToolbarSpacer, ToolbarWrapper };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
declare const ToolbarWrapper: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const ToolbarRow: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const ToolbarRowTall: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
declare const ToolbarSegment: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const ToolbarDivider: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const ToolbarSpacer: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const ToolbarGrow: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
|
|
11
|
+
export { ToolbarDivider, ToolbarGrow, ToolbarRow, ToolbarRowTall, ToolbarSegment, ToolbarSpacer, ToolbarWrapper };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ToolbarDivider,
|
|
3
|
+
ToolbarGrow,
|
|
4
|
+
ToolbarRow,
|
|
5
|
+
ToolbarRowTall,
|
|
6
|
+
ToolbarSegment,
|
|
7
|
+
ToolbarSpacer,
|
|
8
|
+
ToolbarWrapper
|
|
9
|
+
} from "../chunk-FHXT3DAL.js";
|
|
10
|
+
export {
|
|
11
|
+
ToolbarDivider,
|
|
12
|
+
ToolbarGrow,
|
|
13
|
+
ToolbarRow,
|
|
14
|
+
ToolbarRowTall,
|
|
15
|
+
ToolbarSegment,
|
|
16
|
+
ToolbarSpacer,
|
|
17
|
+
ToolbarWrapper
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkPEARNJ5Gcjs = require('../chunk-PEARNJ5G.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.TooltipBoundary = _chunkPEARNJ5Gcjs.TooltipBoundary; exports.TooltipWrapper = _chunkPEARNJ5Gcjs.TooltipWrapper; exports.keyboardShortcutTooltip = _chunkPEARNJ5Gcjs.keyboardShortcutTooltip;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { FC, ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
4
|
+
import { RegisteredBinding, KeyboardBinding } from './input.cjs';
|
|
5
|
+
|
|
6
|
+
type TooltipBoundaryProps = ComponentPropsWithoutRef<'div'>;
|
|
7
|
+
declare const TooltipBoundary: FC<TooltipBoundaryProps>;
|
|
8
|
+
type TooltipProps = {
|
|
9
|
+
tooltip: string | ReactNode | null;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
12
|
+
};
|
|
13
|
+
declare const TooltipWrapper: FC<TooltipProps>;
|
|
14
|
+
declare const keyboardShortcutTooltip: (label: ReactNode, keyboardBinding?: RegisteredBinding, extraBindings?: KeyboardBinding[]) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
15
|
+
|
|
16
|
+
export { TooltipBoundary, type TooltipBoundaryProps, type TooltipProps, TooltipWrapper, keyboardShortcutTooltip };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { FC, ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
4
|
+
import { RegisteredBinding, KeyboardBinding } from './input.js';
|
|
5
|
+
|
|
6
|
+
type TooltipBoundaryProps = ComponentPropsWithoutRef<'div'>;
|
|
7
|
+
declare const TooltipBoundary: FC<TooltipBoundaryProps>;
|
|
8
|
+
type TooltipProps = {
|
|
9
|
+
tooltip: string | ReactNode | null;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
12
|
+
};
|
|
13
|
+
declare const TooltipWrapper: FC<TooltipProps>;
|
|
14
|
+
declare const keyboardShortcutTooltip: (label: ReactNode, keyboardBinding?: RegisteredBinding, extraBindings?: KeyboardBinding[]) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
15
|
+
|
|
16
|
+
export { TooltipBoundary, type TooltipBoundaryProps, type TooltipProps, TooltipWrapper, keyboardShortcutTooltip };
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkA5LYYZERcjs = require('./chunk-A5LYYZER.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkCAYKPJIXcjs = require('./chunk-CAYKPJIX.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkVZ4A6RRTcjs = require('./chunk-VZ4A6RRT.cjs');
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkMXDDIFIOcjs = require('./chunk-MXDDIFIO.cjs');
|
|
20
|
+
require('./chunk-PEARNJ5G.cjs');
|
|
21
|
+
require('./chunk-RI33QVOD.cjs');
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
var _chunk5DRI7C4Ucjs = require('./chunk-5DRI7C4U.cjs');
|
|
25
|
+
|
|
26
|
+
// src/frontend/app-root.tsx
|
|
27
|
+
var _toolkitfrontend = require('@arcanejs/toolkit-frontend');
|
|
28
|
+
var _radixui = require('radix-ui');
|
|
29
|
+
var _react = require('react');
|
|
30
|
+
|
|
31
|
+
// src/frontend/browser-context.tsx
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// src/frontend/media-session.ts
|
|
35
|
+
var NOOP_MEDIA_SESSION = {
|
|
36
|
+
setMetaData: () => {
|
|
37
|
+
},
|
|
38
|
+
setHandler: () => {
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var createBrowserMediaSession = () => {
|
|
42
|
+
if (typeof navigator === "undefined" || !("mediaSession" in navigator) || !navigator.mediaSession) {
|
|
43
|
+
return NOOP_MEDIA_SESSION;
|
|
44
|
+
}
|
|
45
|
+
let handler = null;
|
|
46
|
+
const setMetaData = (data) => {
|
|
47
|
+
if (!data) {
|
|
48
|
+
navigator.mediaSession.metadata = null;
|
|
49
|
+
navigator.mediaSession.playbackState = "none";
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const { title, artist, durationMillis, state } = data;
|
|
53
|
+
navigator.mediaSession.metadata = new MediaMetadata({
|
|
54
|
+
title,
|
|
55
|
+
artist
|
|
56
|
+
});
|
|
57
|
+
if (state.state === "playing") {
|
|
58
|
+
navigator.mediaSession.playbackState = "playing";
|
|
59
|
+
navigator.mediaSession.setPositionState({
|
|
60
|
+
duration: durationMillis / 1e3,
|
|
61
|
+
position: Math.max(0, (Date.now() - state.effectiveStartTime) * state.speed) / 1e3,
|
|
62
|
+
playbackRate: state.speed
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
navigator.mediaSession.playbackState = "paused";
|
|
67
|
+
navigator.mediaSession.setPositionState({
|
|
68
|
+
duration: durationMillis / 1e3,
|
|
69
|
+
position: state.currentTimeMillis / 1e3
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const setHandler = (value) => {
|
|
73
|
+
handler = value;
|
|
74
|
+
};
|
|
75
|
+
navigator.mediaSession.setActionHandler("play", () => {
|
|
76
|
+
_optionalChain([handler, 'optionalCall', _ => _({ action: "play" })]);
|
|
77
|
+
});
|
|
78
|
+
navigator.mediaSession.setActionHandler("pause", () => {
|
|
79
|
+
_optionalChain([handler, 'optionalCall', _2 => _2({ action: "pause" })]);
|
|
80
|
+
});
|
|
81
|
+
const handleSeekAction = (action) => {
|
|
82
|
+
if (action.action === "seekto") {
|
|
83
|
+
_optionalChain([handler, 'optionalCall', _3 => _3({
|
|
84
|
+
action: "seekto",
|
|
85
|
+
seekTimeMillis: (_nullishCoalesce(action.seekTime, () => ( 0))) * 1e3
|
|
86
|
+
})]);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (action.action === "seekbackward" || action.action === "seekforward") {
|
|
90
|
+
_optionalChain([handler, 'optionalCall', _4 => _4({
|
|
91
|
+
action: action.action,
|
|
92
|
+
seekOffsetMillis: (_nullishCoalesce(action.seekOffset, () => ( 0))) * 1e3
|
|
93
|
+
})]);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
navigator.mediaSession.setActionHandler("seekto", handleSeekAction);
|
|
97
|
+
navigator.mediaSession.setActionHandler("seekbackward", handleSeekAction);
|
|
98
|
+
navigator.mediaSession.setActionHandler("seekforward", handleSeekAction);
|
|
99
|
+
return {
|
|
100
|
+
setMetaData,
|
|
101
|
+
setHandler
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/frontend/browser-context.tsx
|
|
106
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
107
|
+
var createDefaultBrowserContext = (browser) => {
|
|
108
|
+
const defaults = {
|
|
109
|
+
openExternalLink: (url) => {
|
|
110
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
111
|
+
},
|
|
112
|
+
openNewWidow: (url) => {
|
|
113
|
+
window.open(url, "_blank", "noopener,noreferrer");
|
|
114
|
+
},
|
|
115
|
+
selectDirectory: null,
|
|
116
|
+
openDevTools: null,
|
|
117
|
+
confirmClose: () => {
|
|
118
|
+
},
|
|
119
|
+
mediaSession: createBrowserMediaSession()
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
...defaults,
|
|
123
|
+
...browser
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
var BrowserContext = _react.createContext.call(void 0,
|
|
127
|
+
new Proxy({}, {
|
|
128
|
+
get: () => {
|
|
129
|
+
throw new Error("BrowserContext not provided.");
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
var BrowserContextProvider = ({
|
|
134
|
+
browser,
|
|
135
|
+
children
|
|
136
|
+
}) => {
|
|
137
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BrowserContext.Provider, { value: browser, children });
|
|
138
|
+
};
|
|
139
|
+
var useBrowserContext = () => _react.useContext.call(void 0, BrowserContext);
|
|
140
|
+
|
|
141
|
+
// src/frontend/app-root.tsx
|
|
142
|
+
|
|
143
|
+
var AppRoot = ({
|
|
144
|
+
info,
|
|
145
|
+
browser
|
|
146
|
+
}) => {
|
|
147
|
+
const { child, lastLog } = info;
|
|
148
|
+
const { renderComponent, call } = _react.useContext.call(void 0, _toolkitfrontend.StageContext);
|
|
149
|
+
const [logs, setLogs] = _react.useState.call(void 0, { lastLog: -1, logs: [] });
|
|
150
|
+
const [debugMode, setDebugMode] = _react.useState.call(void 0, false);
|
|
151
|
+
_react.useEffect.call(void 0, () => {
|
|
152
|
+
if (!debugMode || !call) return;
|
|
153
|
+
const lastLogId = _nullishCoalesce(_optionalChain([logs, 'access', _5 => _5.logs, 'access', _6 => _6[logs.logs.length - 1], 'optionalAccess', _7 => _7.index]), () => ( -1));
|
|
154
|
+
call({
|
|
155
|
+
namespace: "sigil",
|
|
156
|
+
type: "component-call",
|
|
157
|
+
componentKey: info.key,
|
|
158
|
+
action: "app-root-get-logs",
|
|
159
|
+
after: lastLogId
|
|
160
|
+
}).then(({ logs: newLogs }) => {
|
|
161
|
+
if (newLogs.length === 0) return;
|
|
162
|
+
setLogs({
|
|
163
|
+
lastLog,
|
|
164
|
+
logs: [...logs.logs, ...newLogs]
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}, [call, debugMode, info.key, lastLog, logs]);
|
|
168
|
+
const debuggerContext = _react.useMemo.call(void 0,
|
|
169
|
+
() => ({
|
|
170
|
+
logs: logs.logs,
|
|
171
|
+
setDebugMode
|
|
172
|
+
}),
|
|
173
|
+
[logs.logs]
|
|
174
|
+
);
|
|
175
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVZ4A6RRTcjs.SystemInformationContext.Provider, { value: info.system, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BrowserContextProvider, { browser, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVZ4A6RRTcjs.DebuggerContext.Provider, { value: debuggerContext, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _radixui.Tooltip.Provider, { children: child && renderComponent(child) }) }) }) });
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/frontend/debugger.tsx
|
|
179
|
+
|
|
180
|
+
var _util = require('@arcanejs/toolkit-frontend/util');
|
|
181
|
+
|
|
182
|
+
var TIME_FORMATTER = new Intl.DateTimeFormat("en-US", {
|
|
183
|
+
hour: "2-digit",
|
|
184
|
+
minute: "2-digit",
|
|
185
|
+
second: "2-digit",
|
|
186
|
+
fractionalSecondDigits: 3
|
|
187
|
+
});
|
|
188
|
+
var unwrapErrorStack = (error) => {
|
|
189
|
+
let stack = `${error.message}
|
|
190
|
+
${_nullishCoalesce(error.stack, () => ( ""))}`;
|
|
191
|
+
if (error.cause) {
|
|
192
|
+
stack += `
|
|
193
|
+
Caused by: ${unwrapErrorStack(error.cause)}`;
|
|
194
|
+
}
|
|
195
|
+
return stack;
|
|
196
|
+
};
|
|
197
|
+
var Debugger = ({ title, className }) => {
|
|
198
|
+
const scrollRef = _react.useRef.call(void 0, null);
|
|
199
|
+
const shouldScrollToBottom = _react.useRef.call(void 0, true);
|
|
200
|
+
const { openDevTools } = useBrowserContext();
|
|
201
|
+
const { setDebugMode, logs } = _chunkVZ4A6RRTcjs.useDebuggerContext.call(void 0, );
|
|
202
|
+
const system = _chunkVZ4A6RRTcjs.useSystemInformation.call(void 0, );
|
|
203
|
+
_react.useEffect.call(void 0, () => {
|
|
204
|
+
setDebugMode(true);
|
|
205
|
+
return () => {
|
|
206
|
+
setDebugMode(false);
|
|
207
|
+
};
|
|
208
|
+
}, [setDebugMode]);
|
|
209
|
+
const handleScroll = () => {
|
|
210
|
+
if (!scrollRef.current) return;
|
|
211
|
+
const { scrollTop, scrollHeight, clientHeight } = scrollRef.current;
|
|
212
|
+
shouldScrollToBottom.current = scrollTop + clientHeight >= scrollHeight - 10;
|
|
213
|
+
};
|
|
214
|
+
const scrollToBottomIfRequired = _react.useCallback.call(void 0, () => {
|
|
215
|
+
if (shouldScrollToBottom.current && scrollRef.current) {
|
|
216
|
+
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
217
|
+
}
|
|
218
|
+
}, []);
|
|
219
|
+
_react.useEffect.call(void 0, scrollToBottomIfRequired, [logs, scrollToBottomIfRequired]);
|
|
220
|
+
_react.useEffect.call(void 0, () => {
|
|
221
|
+
window.addEventListener("resize", scrollToBottomIfRequired);
|
|
222
|
+
return () => {
|
|
223
|
+
window.removeEventListener("resize", scrollToBottomIfRequired);
|
|
224
|
+
};
|
|
225
|
+
}, [scrollToBottomIfRequired]);
|
|
226
|
+
const exportLogs = _react.useCallback.call(void 0, () => {
|
|
227
|
+
const logText = JSON.stringify({ system, logs }, null, 2);
|
|
228
|
+
const blob = new Blob([logText], { type: "application/json" });
|
|
229
|
+
const url = URL.createObjectURL(blob);
|
|
230
|
+
const link = document.createElement("a");
|
|
231
|
+
link.href = url;
|
|
232
|
+
link.download = `sigil-logs-${(/* @__PURE__ */ new Date()).toISOString()}.json`;
|
|
233
|
+
link.click();
|
|
234
|
+
URL.revokeObjectURL(url);
|
|
235
|
+
}, [system, logs]);
|
|
236
|
+
const handleRequestScrollToBottom = _react.useCallback.call(void 0, () => {
|
|
237
|
+
shouldScrollToBottom.current = true;
|
|
238
|
+
scrollToBottomIfRequired();
|
|
239
|
+
}, [scrollToBottomIfRequired]);
|
|
240
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _util.cn.call(void 0, "flex flex-col", className), children: [
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5LYYZERcjs.ToolbarWrapper, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkA5LYYZERcjs.ToolbarRow, { children: [
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "grow px-1", children: title }),
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5LYYZERcjs.ToolbarDivider, {}),
|
|
244
|
+
openDevTools && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
245
|
+
_chunkMXDDIFIOcjs.ControlButton,
|
|
246
|
+
{
|
|
247
|
+
onClick: openDevTools,
|
|
248
|
+
variant: "toolbar",
|
|
249
|
+
icon: "build",
|
|
250
|
+
children: "Open Dev Tools"
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
254
|
+
_chunkMXDDIFIOcjs.ControlButton,
|
|
255
|
+
{
|
|
256
|
+
onClick: handleRequestScrollToBottom,
|
|
257
|
+
variant: "toolbar",
|
|
258
|
+
icon: "south",
|
|
259
|
+
children: "Scroll to Bottom"
|
|
260
|
+
}
|
|
261
|
+
),
|
|
262
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkMXDDIFIOcjs.ControlButton, { onClick: exportLogs, variant: "toolbar", icon: "publish", children: "Export Logs" })
|
|
263
|
+
] }) }),
|
|
264
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
265
|
+
"pre",
|
|
266
|
+
{
|
|
267
|
+
className: "\n m-0 overflow-x-auto border-b border-sigil-border bg-sigil-bg-dark p-2\n scrollbar-sigil\n ",
|
|
268
|
+
children: `OS: ${system.os}
|
|
269
|
+
Version: ${system.version}
|
|
270
|
+
App Path: ${system.appPath}
|
|
271
|
+
CWD: ${system.cwd}
|
|
272
|
+
Data Directory: ${system.dataDirectory}`
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
276
|
+
"div",
|
|
277
|
+
{
|
|
278
|
+
ref: scrollRef,
|
|
279
|
+
onScroll: handleScroll,
|
|
280
|
+
className: "flex-1 overflow-auto scrollbar-sigil",
|
|
281
|
+
children: logs.map((log) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-arcane whitespace-pre-wrap", children: [
|
|
282
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { children: [
|
|
283
|
+
TIME_FORMATTER.format(log.timestamp),
|
|
284
|
+
" - ",
|
|
285
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
286
|
+
"span",
|
|
287
|
+
{
|
|
288
|
+
className: _util.cn.call(void 0,
|
|
289
|
+
_chunk5DRI7C4Ucjs.cnd.call(void 0, log.level === "error", "text-sigil-usage-red-foreground"),
|
|
290
|
+
_chunk5DRI7C4Ucjs.cnd.call(void 0,
|
|
291
|
+
log.level === "warn",
|
|
292
|
+
"text-sigil-usage-yellow-foreground"
|
|
293
|
+
),
|
|
294
|
+
_chunk5DRI7C4Ucjs.cnd.call(void 0, log.level === "info", "text-sigil-usage-blue-foreground")
|
|
295
|
+
),
|
|
296
|
+
children: log.level
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
" - ",
|
|
300
|
+
log.message
|
|
301
|
+
] }),
|
|
302
|
+
log.stack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "pre", { className: "m-0 ml-2", children: unwrapErrorStack(log.stack) })
|
|
303
|
+
] }, log.index))
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] });
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
// src/frontend/index.tsx
|
|
310
|
+
var _frontend = require('@arcanejs/toolkit/frontend');
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
var createSigilFrontendRenderer = (browser) => ({
|
|
314
|
+
namespace: _chunkCAYKPJIXcjs.SIGIL_NAMESPACE,
|
|
315
|
+
render: (info) => {
|
|
316
|
+
if (!_chunkCAYKPJIXcjs.isSigilComponent.call(void 0, info)) {
|
|
317
|
+
throw new Error(`Cannot render component ${info.namespace}`);
|
|
318
|
+
}
|
|
319
|
+
switch (info.component) {
|
|
320
|
+
case "app-root":
|
|
321
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AppRoot, { browser, info });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
var defaultLoadingState = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { width: "100%", textAlign: "center", padding: "2rem" }, children: "Loading..." });
|
|
326
|
+
var startSigilFrontend = ({
|
|
327
|
+
browser,
|
|
328
|
+
appRenderers,
|
|
329
|
+
loadingState = defaultLoadingState
|
|
330
|
+
}) => {
|
|
331
|
+
const resolvedBrowser = createDefaultBrowserContext(browser);
|
|
332
|
+
_frontend.startArcaneFrontend.call(void 0, {
|
|
333
|
+
renderers: [
|
|
334
|
+
_toolkitfrontend.CORE_FRONTEND_COMPONENT_RENDERER,
|
|
335
|
+
createSigilFrontendRenderer(resolvedBrowser),
|
|
336
|
+
...appRenderers
|
|
337
|
+
],
|
|
338
|
+
loadingState
|
|
339
|
+
});
|
|
340
|
+
return resolvedBrowser;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
exports.BrowserContext = BrowserContext; exports.BrowserContextProvider = BrowserContextProvider; exports.Debugger = Debugger; exports.DebuggerContext = _chunkVZ4A6RRTcjs.DebuggerContext; exports.SIGIL_NAMESPACE = _chunkCAYKPJIXcjs.SIGIL_NAMESPACE; exports.SigilAppRoot = AppRoot; exports.SystemInformationContext = _chunkVZ4A6RRTcjs.SystemInformationContext; exports.createBrowserMediaSession = createBrowserMediaSession; exports.createDefaultBrowserContext = createDefaultBrowserContext; exports.createSigilFrontendRenderer = createSigilFrontendRenderer; exports.isSigilComponent = _chunkCAYKPJIXcjs.isSigilComponent; exports.isSigilComponentCall = _chunkCAYKPJIXcjs.isSigilComponentCall; exports.startSigilFrontend = startSigilFrontend; exports.useBrowserContext = useBrowserContext; exports.useDebuggerContext = _chunkVZ4A6RRTcjs.useDebuggerContext; exports.useSystemInformation = _chunkVZ4A6RRTcjs.useSystemInformation;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { S as SigilAppRootComponent } from './proto-B-WcMUOE.cjs';
|
|
3
|
+
export { A as AppRootGetLogs, a as AppRootGetLogsArgs, b as AppRootGetLogsReturn, c as SIGIL_NAMESPACE, d as SigilComponent, e as SigilComponentCalls, i as isSigilComponent, f as isSigilComponentCall } from './proto-B-WcMUOE.cjs';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import { PropsWithChildren, FC, ReactNode } from 'react';
|
|
6
|
+
import { FrontendComponentRenderer } from '@arcanejs/toolkit-frontend/types';
|
|
7
|
+
export { DebuggerContext, SystemInformationContext, useDebuggerContext, useSystemInformation } from './frontend/context.cjs';
|
|
8
|
+
export { A as AppRootLogEntry, a as AppRootLogEntryStackFrame, S as SystemInformation } from './types-X8O95zmC.cjs';
|
|
9
|
+
import '@arcanejs/protocol';
|
|
10
|
+
import '@arcanejs/diff';
|
|
11
|
+
|
|
12
|
+
type MediaSessionAction = {
|
|
13
|
+
action: 'play' | 'pause' | 'playpause';
|
|
14
|
+
} | {
|
|
15
|
+
action: 'seekto';
|
|
16
|
+
seekTimeMillis: number;
|
|
17
|
+
} | {
|
|
18
|
+
action: 'seekbackward' | 'seekforward';
|
|
19
|
+
seekOffsetMillis?: number;
|
|
20
|
+
};
|
|
21
|
+
type MediaSessionHandler = (action: MediaSessionAction) => void;
|
|
22
|
+
type MediaPlayState = {
|
|
23
|
+
state: 'playing';
|
|
24
|
+
effectiveStartTime: number;
|
|
25
|
+
speed: number;
|
|
26
|
+
} | {
|
|
27
|
+
state: 'stopped';
|
|
28
|
+
speed: number;
|
|
29
|
+
currentTimeMillis: number;
|
|
30
|
+
};
|
|
31
|
+
type MediaMetadata = {
|
|
32
|
+
title?: string;
|
|
33
|
+
artist?: string;
|
|
34
|
+
durationMillis: number;
|
|
35
|
+
state: MediaPlayState;
|
|
36
|
+
};
|
|
37
|
+
type MediaSessionControl = {
|
|
38
|
+
setMetaData: (metadata: MediaMetadata | null) => void;
|
|
39
|
+
setHandler: (handler: MediaSessionHandler | null) => void;
|
|
40
|
+
};
|
|
41
|
+
type NewWindowOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* If true, try and find an existing window with the same URL,
|
|
44
|
+
* and just bring it into focus instead of opening a new one.
|
|
45
|
+
*/
|
|
46
|
+
canUseExisting?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* If supported by the the electron environment,
|
|
49
|
+
* specify a string mode identifier to configure the window behavior.
|
|
50
|
+
*/
|
|
51
|
+
mode?: string;
|
|
52
|
+
};
|
|
53
|
+
type BaseBrowserContext = {
|
|
54
|
+
openExternalLink: (url: string) => void;
|
|
55
|
+
openNewWidow: (url: string, options?: NewWindowOptions) => void;
|
|
56
|
+
selectDirectory: (() => Promise<string | null>) | null;
|
|
57
|
+
openDevTools: (() => Promise<null>) | null;
|
|
58
|
+
confirmClose: (message: string) => void;
|
|
59
|
+
mediaSession: MediaSessionControl;
|
|
60
|
+
};
|
|
61
|
+
declare const createDefaultBrowserContext: <TBrowserContext extends BaseBrowserContext = BaseBrowserContext>(browser?: Partial<TBrowserContext> | null) => TBrowserContext;
|
|
62
|
+
declare const BrowserContext: react.Context<BaseBrowserContext>;
|
|
63
|
+
declare const BrowserContextProvider: <TBrowserContext extends BaseBrowserContext>({ browser, children, }: PropsWithChildren<{
|
|
64
|
+
browser: TBrowserContext;
|
|
65
|
+
}>) => react_jsx_runtime.JSX.Element;
|
|
66
|
+
declare const useBrowserContext: <TBrowserContext extends BaseBrowserContext = BaseBrowserContext>() => TBrowserContext;
|
|
67
|
+
|
|
68
|
+
type Props<TBrowserContext extends BaseBrowserContext> = {
|
|
69
|
+
info: SigilAppRootComponent;
|
|
70
|
+
browser: TBrowserContext;
|
|
71
|
+
};
|
|
72
|
+
declare const AppRoot: <TBrowserContext extends BaseBrowserContext>({ info, browser, }: Props<TBrowserContext>) => react_jsx_runtime.JSX.Element;
|
|
73
|
+
|
|
74
|
+
type DebuggerProps = {
|
|
75
|
+
title: ReactNode;
|
|
76
|
+
className?: string;
|
|
77
|
+
};
|
|
78
|
+
declare const Debugger: FC<DebuggerProps>;
|
|
79
|
+
|
|
80
|
+
declare const createSigilFrontendRenderer: <TBrowserContext extends BaseBrowserContext>(browser: TBrowserContext) => FrontendComponentRenderer;
|
|
81
|
+
type StartSigilFrontendOptions<TBrowserContext extends BaseBrowserContext> = {
|
|
82
|
+
browser?: Partial<TBrowserContext> | null;
|
|
83
|
+
appRenderers: FrontendComponentRenderer[];
|
|
84
|
+
loadingState?: () => ReactNode;
|
|
85
|
+
};
|
|
86
|
+
declare const startSigilFrontend: <TBrowserContext extends BaseBrowserContext>({ browser, appRenderers, loadingState, }: StartSigilFrontendOptions<TBrowserContext>) => TBrowserContext;
|
|
87
|
+
|
|
88
|
+
declare const createBrowserMediaSession: () => MediaSessionControl;
|
|
89
|
+
|
|
90
|
+
export { type BaseBrowserContext, BrowserContext, BrowserContextProvider, Debugger, type MediaMetadata, type MediaPlayState, type MediaSessionAction, type MediaSessionControl, type MediaSessionHandler, type NewWindowOptions, AppRoot as SigilAppRoot, SigilAppRootComponent, type StartSigilFrontendOptions, createBrowserMediaSession, createDefaultBrowserContext, createSigilFrontendRenderer, startSigilFrontend, useBrowserContext };
|