@arcanewizards/sigil 0.1.5 → 0.1.6

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.
@@ -88,7 +88,8 @@ var clsControlButton = ({
88
88
  touching,
89
89
  position,
90
90
  className,
91
- primary
91
+ primary,
92
+ destructive
92
93
  }) => cn(
93
94
  `sigil-control-button`,
94
95
  cnd(variant === "border", `sigil-control-button-variant-border`),
@@ -101,6 +102,7 @@ var clsControlButton = ({
101
102
  cnd(active, `sigil-control-button-active`),
102
103
  cnd(touching && active, `sigil-control-button-active-touching`),
103
104
  cnd(primary, `sigil-control-button-primary`),
105
+ cnd(destructive, `sigil-control-button-destructive`),
104
106
  clsControlPosition(position),
105
107
  className
106
108
  );
@@ -118,6 +120,7 @@ var ControlButtonFrame = forwardRef(
118
120
  tooltipSide,
119
121
  position,
120
122
  primary,
123
+ destructive,
121
124
  ...props
122
125
  }, ref) => {
123
126
  const btn = /* @__PURE__ */ jsx(
@@ -133,6 +136,7 @@ var ControlButtonFrame = forwardRef(
133
136
  touching,
134
137
  position,
135
138
  primary,
139
+ destructive,
136
140
  className
137
141
  }),
138
142
  children: /* @__PURE__ */ jsxs("span", { children: [
@@ -301,10 +305,17 @@ import { forwardRef as forwardRef3 } from "react";
301
305
  import { cn as cn3 } from "@arcanejs/toolkit-frontend/util";
302
306
  import { jsx as jsx3 } from "react/jsx-runtime";
303
307
  var ControlDialogButtons = forwardRef3(({ children, className, ...props }, ref) => /* @__PURE__ */ jsx3(
304
- ControlButtonGroup,
308
+ "div",
305
309
  {
306
310
  ref,
307
- className: cn3("control-grid-pos-row", className),
311
+ className: cn3(
312
+ `
313
+ flex items-stretch gap-1
314
+ [&>button]:grow
315
+ `,
316
+ clsControlPosition("row"),
317
+ className
318
+ ),
308
319
  ...props,
309
320
  children
310
321
  }
@@ -88,7 +88,8 @@ var clsControlButton = ({
88
88
  touching,
89
89
  position,
90
90
  className,
91
- primary
91
+ primary,
92
+ destructive
92
93
  }) => _util.cn.call(void 0,
93
94
  `sigil-control-button`,
94
95
  _chunkTZJ4UXR3cjs.cnd.call(void 0, variant === "border", `sigil-control-button-variant-border`),
@@ -101,6 +102,7 @@ var clsControlButton = ({
101
102
  _chunkTZJ4UXR3cjs.cnd.call(void 0, active, `sigil-control-button-active`),
102
103
  _chunkTZJ4UXR3cjs.cnd.call(void 0, touching && active, `sigil-control-button-active-touching`),
103
104
  _chunkTZJ4UXR3cjs.cnd.call(void 0, primary, `sigil-control-button-primary`),
105
+ _chunkTZJ4UXR3cjs.cnd.call(void 0, destructive, `sigil-control-button-destructive`),
104
106
  clsControlPosition(position),
105
107
  className
106
108
  );
@@ -118,6 +120,7 @@ var ControlButtonFrame = _react.forwardRef.call(void 0,
118
120
  tooltipSide,
119
121
  position,
120
122
  primary,
123
+ destructive,
121
124
  ...props
122
125
  }, ref) => {
123
126
  const btn = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -133,6 +136,7 @@ var ControlButtonFrame = _react.forwardRef.call(void 0,
133
136
  touching,
134
137
  position,
135
138
  primary,
139
+ destructive,
136
140
  className
137
141
  }),
138
142
  children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { children: [
@@ -301,10 +305,17 @@ InputSpanningTitle.displayName = "InputSpanningTitle";
301
305
 
302
306
 
303
307
  var ControlDialogButtons = _react.forwardRef.call(void 0, ({ children, className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
304
- ControlButtonGroup,
308
+ "div",
305
309
  {
306
310
  ref,
307
- className: _util.cn.call(void 0, "control-grid-pos-row", className),
311
+ className: _util.cn.call(void 0,
312
+ `
313
+ flex items-stretch gap-1
314
+ [&>button]:grow
315
+ `,
316
+ clsControlPosition("row"),
317
+ className
318
+ ),
308
319
  ...props,
309
320
  children
310
321
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk5CAFJT5Tcjs = require('../chunk-5CAFJT5T.cjs');
4
+ var _chunkTVAGNQHJcjs = require('../chunk-TVAGNQHJ.cjs');
5
5
  require('../chunk-PEARNJ5G.cjs');
6
6
  require('../chunk-RI33QVOD.cjs');
7
7
  require('../chunk-TZJ4UXR3.cjs');
@@ -35,7 +35,7 @@ var AppearanceSwitcher = ({
35
35
  );
36
36
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "control-grid-pos-all flex flex-wrap items-stretch gap-2", children: [
37
37
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
38
- _chunk5CAFJT5Tcjs.ControlButton,
38
+ _chunkTVAGNQHJcjs.ControlButton,
39
39
  {
40
40
  onClick: selectDarkMode,
41
41
  active: colorSchemePreference === "dark",
@@ -48,7 +48,7 @@ var AppearanceSwitcher = ({
48
48
  }
49
49
  ),
50
50
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
51
- _chunk5CAFJT5Tcjs.ControlButton,
51
+ _chunkTVAGNQHJcjs.ControlButton,
52
52
  {
53
53
  onClick: selectLightMode,
54
54
  active: colorSchemePreference === "light",
@@ -61,7 +61,7 @@ var AppearanceSwitcher = ({
61
61
  }
62
62
  ),
63
63
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
64
- _chunk5CAFJT5Tcjs.ControlButton,
64
+ _chunkTVAGNQHJcjs.ControlButton,
65
65
  {
66
66
  onClick: selectSystemMode,
67
67
  active: colorSchemePreference === "auto",
@@ -74,7 +74,7 @@ var AppearanceSwitcher = ({
74
74
  }
75
75
  ),
76
76
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
77
- _chunk5CAFJT5Tcjs.ControlColorSelect,
77
+ _chunkTVAGNQHJcjs.ControlColorSelect,
78
78
  {
79
79
  color,
80
80
  onChange: updateHintColor,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ControlButton,
3
3
  ControlColorSelect
4
- } from "../chunk-LKKN6DFB.js";
4
+ } from "../chunk-LDUYBGRY.js";
5
5
  import "../chunk-BIY5HAXP.js";
6
6
  import "../chunk-4PMRDURG.js";
7
7
  import "../chunk-WYUGJOEB.js";
@@ -21,7 +21,7 @@
21
21
 
22
22
 
23
23
 
24
- var _chunk5CAFJT5Tcjs = require('../../chunk-5CAFJT5T.cjs');
24
+ var _chunkTVAGNQHJcjs = require('../../chunk-TVAGNQHJ.cjs');
25
25
  require('../../chunk-PEARNJ5G.cjs');
26
26
  require('../../chunk-RI33QVOD.cjs');
27
27
  require('../../chunk-TZJ4UXR3.cjs');
@@ -48,4 +48,4 @@ require('../../chunk-TZJ4UXR3.cjs');
48
48
 
49
49
 
50
50
 
51
- exports.CheckboxControlButton = _chunk5CAFJT5Tcjs.CheckboxControlButton; exports.ControlButton = _chunk5CAFJT5Tcjs.ControlButton; exports.ControlButtonGroup = _chunk5CAFJT5Tcjs.ControlButtonGroup; exports.ControlColorSelect = _chunk5CAFJT5Tcjs.ControlColorSelect; exports.ControlColoredSelect = _chunk5CAFJT5Tcjs.ControlColoredSelect; exports.ControlDetails = _chunk5CAFJT5Tcjs.ControlDetails; exports.ControlDialog = _chunk5CAFJT5Tcjs.ControlDialog; exports.ControlDialogButtons = _chunk5CAFJT5Tcjs.ControlDialogButtons; exports.ControlInput = _chunk5CAFJT5Tcjs.ControlInput; exports.ControlLabel = _chunk5CAFJT5Tcjs.ControlLabel; exports.ControlParagraph = _chunk5CAFJT5Tcjs.ControlParagraph; exports.ControlPercent = _chunk5CAFJT5Tcjs.ControlPercent; exports.ControlSelect = _chunk5CAFJT5Tcjs.ControlSelect; exports.InputSpanningTitle = _chunk5CAFJT5Tcjs.InputSpanningTitle; exports.InputWithDelayedPropagation = _chunk5CAFJT5Tcjs.InputWithDelayedPropagation; exports.LongPressableControlButton = _chunk5CAFJT5Tcjs.LongPressableControlButton; exports.clsControlButton = _chunk5CAFJT5Tcjs.clsControlButton; exports.clsControlPosition = _chunk5CAFJT5Tcjs.clsControlPosition; exports.clsControlSubgridPosition = _chunk5CAFJT5Tcjs.clsControlSubgridPosition; exports.controlButtonColorVariable = _chunk5CAFJT5Tcjs.controlButtonColorVariable; exports.controlButtonColorVariables = _chunk5CAFJT5Tcjs.controlButtonColorVariables; exports.controlPositionClass = _chunk5CAFJT5Tcjs.controlPositionClass;
51
+ exports.CheckboxControlButton = _chunkTVAGNQHJcjs.CheckboxControlButton; exports.ControlButton = _chunkTVAGNQHJcjs.ControlButton; exports.ControlButtonGroup = _chunkTVAGNQHJcjs.ControlButtonGroup; exports.ControlColorSelect = _chunkTVAGNQHJcjs.ControlColorSelect; exports.ControlColoredSelect = _chunkTVAGNQHJcjs.ControlColoredSelect; exports.ControlDetails = _chunkTVAGNQHJcjs.ControlDetails; exports.ControlDialog = _chunkTVAGNQHJcjs.ControlDialog; exports.ControlDialogButtons = _chunkTVAGNQHJcjs.ControlDialogButtons; exports.ControlInput = _chunkTVAGNQHJcjs.ControlInput; exports.ControlLabel = _chunkTVAGNQHJcjs.ControlLabel; exports.ControlParagraph = _chunkTVAGNQHJcjs.ControlParagraph; exports.ControlPercent = _chunkTVAGNQHJcjs.ControlPercent; exports.ControlSelect = _chunkTVAGNQHJcjs.ControlSelect; exports.InputSpanningTitle = _chunkTVAGNQHJcjs.InputSpanningTitle; exports.InputWithDelayedPropagation = _chunkTVAGNQHJcjs.InputWithDelayedPropagation; exports.LongPressableControlButton = _chunkTVAGNQHJcjs.LongPressableControlButton; exports.clsControlButton = _chunkTVAGNQHJcjs.clsControlButton; exports.clsControlPosition = _chunkTVAGNQHJcjs.clsControlPosition; exports.clsControlSubgridPosition = _chunkTVAGNQHJcjs.clsControlSubgridPosition; exports.controlButtonColorVariable = _chunkTVAGNQHJcjs.controlButtonColorVariable; exports.controlButtonColorVariables = _chunkTVAGNQHJcjs.controlButtonColorVariables; exports.controlPositionClass = _chunkTVAGNQHJcjs.controlPositionClass;
@@ -34,6 +34,7 @@ type ControlButtonProps = Omit<ComponentPropsWithoutRef<'button'>, 'children' |
34
34
  tooltipSide?: TooltipProps['side'];
35
35
  position?: ControlPosition;
36
36
  primary?: boolean;
37
+ destructive?: boolean;
37
38
  } & ({
38
39
  children: ReactNode;
39
40
  icon?: string;
@@ -51,8 +52,9 @@ type ControlButtonFrameProps = Omit<ComponentPropsWithoutRef<'button'>, 'childre
51
52
  tooltipSide?: TooltipProps['side'];
52
53
  position?: ControlPosition;
53
54
  primary?: boolean;
55
+ destructive?: boolean;
54
56
  };
55
- declare const clsControlButton: ({ variant, active, touching, position, className, primary, }: Pick<ControlButtonFrameProps, "variant" | "active" | "touching" | "position" | "className" | "primary">) => string;
57
+ declare const clsControlButton: ({ variant, active, touching, position, className, primary, destructive, }: Pick<ControlButtonFrameProps, "variant" | "active" | "touching" | "position" | "className" | "primary" | "destructive">) => string;
56
58
  declare const ControlButton: react.ForwardRefExoticComponent<ControlButtonProps & react.RefAttributes<HTMLButtonElement>>;
57
59
  type CheckboxControlButtonProps = Omit<ControlButtonProps, 'children' | 'icon'> & {
58
60
  label?: string;
@@ -34,6 +34,7 @@ type ControlButtonProps = Omit<ComponentPropsWithoutRef<'button'>, 'children' |
34
34
  tooltipSide?: TooltipProps['side'];
35
35
  position?: ControlPosition;
36
36
  primary?: boolean;
37
+ destructive?: boolean;
37
38
  } & ({
38
39
  children: ReactNode;
39
40
  icon?: string;
@@ -51,8 +52,9 @@ type ControlButtonFrameProps = Omit<ComponentPropsWithoutRef<'button'>, 'childre
51
52
  tooltipSide?: TooltipProps['side'];
52
53
  position?: ControlPosition;
53
54
  primary?: boolean;
55
+ destructive?: boolean;
54
56
  };
55
- declare const clsControlButton: ({ variant, active, touching, position, className, primary, }: Pick<ControlButtonFrameProps, "variant" | "active" | "touching" | "position" | "className" | "primary">) => string;
57
+ declare const clsControlButton: ({ variant, active, touching, position, className, primary, destructive, }: Pick<ControlButtonFrameProps, "variant" | "active" | "touching" | "position" | "className" | "primary" | "destructive">) => string;
56
58
  declare const ControlButton: react.ForwardRefExoticComponent<ControlButtonProps & react.RefAttributes<HTMLButtonElement>>;
57
59
  type CheckboxControlButtonProps = Omit<ControlButtonProps, 'children' | 'icon'> & {
58
60
  label?: string;
@@ -21,7 +21,7 @@ import {
21
21
  controlButtonColorVariable,
22
22
  controlButtonColorVariables,
23
23
  controlPositionClass
24
- } from "../../chunk-LKKN6DFB.js";
24
+ } from "../../chunk-LDUYBGRY.js";
25
25
  import "../../chunk-BIY5HAXP.js";
26
26
  import "../../chunk-4PMRDURG.js";
27
27
  import "../../chunk-WYUGJOEB.js";
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunk5CAFJT5Tcjs = require('../chunk-5CAFJT5T.cjs');
7
+ var _chunkTVAGNQHJcjs = require('../chunk-TVAGNQHJ.cjs');
8
8
  require('../chunk-PEARNJ5G.cjs');
9
9
  require('../chunk-RI33QVOD.cjs');
10
10
  require('../chunk-TZJ4UXR3.cjs');
@@ -14,4 +14,4 @@ require('../chunk-TZJ4UXR3.cjs');
14
14
 
15
15
 
16
16
 
17
- exports.Dialog = _chunk5CAFJT5Tcjs.Dialog; exports.DialogButtons = _chunk5CAFJT5Tcjs.DialogButtons; exports.DialogContext = _chunk5CAFJT5Tcjs.DialogContext; exports.DialogProvider = _chunk5CAFJT5Tcjs.DialogProvider; exports.DialogTitle = _chunk5CAFJT5Tcjs.DialogTitle;
17
+ exports.Dialog = _chunkTVAGNQHJcjs.Dialog; exports.DialogButtons = _chunkTVAGNQHJcjs.DialogButtons; exports.DialogContext = _chunkTVAGNQHJcjs.DialogContext; exports.DialogProvider = _chunkTVAGNQHJcjs.DialogProvider; exports.DialogTitle = _chunkTVAGNQHJcjs.DialogTitle;
@@ -4,7 +4,7 @@ import {
4
4
  DialogContext,
5
5
  DialogProvider,
6
6
  DialogTitle
7
- } from "../chunk-LKKN6DFB.js";
7
+ } from "../chunk-LDUYBGRY.js";
8
8
  import "../chunk-BIY5HAXP.js";
9
9
  import "../chunk-4PMRDURG.js";
10
10
  import "../chunk-WYUGJOEB.js";
@@ -489,6 +489,17 @@
489
489
  --tw-drop-shadow: drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.5));
490
490
  filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
491
491
  }
492
+ .sigil-control-button-destructive {
493
+ --sigil-control-button-bg: var(--sigil-usage-red-background);
494
+ --sigil-control-button-bg-hover: var(--sigil-usage-red-border);
495
+ --sigil-control-button-bg-active: var(--sigil-usage-red-border);
496
+ --sigil-control-button-fg: var(--sigil-usage-red-text);
497
+ --sigil-control-button-fg-hover: var(--sigil-usage-red-text);
498
+ --sigil-control-button-fg-active: var(--sigil-usage-red-text);
499
+ --sigil-control-button-border: transparent;
500
+ --sigil-control-button-border-hover: transparent;
501
+ --sigil-control-button-border-active: transparent;
502
+ }
492
503
  .sigil-control-button-primary {
493
504
  --sigil-control-button-bg: var(--sigil-usage-hint-background);
494
505
  --sigil-control-button-bg-hover: var(--sigil-usage-hint-border);
package/dist/frontend.cjs CHANGED
@@ -16,7 +16,7 @@ var _chunkCAYKPJIXcjs = require('./chunk-CAYKPJIX.cjs');
16
16
  var _chunkVZ4A6RRTcjs = require('./chunk-VZ4A6RRT.cjs');
17
17
 
18
18
 
19
- var _chunk5CAFJT5Tcjs = require('./chunk-5CAFJT5T.cjs');
19
+ var _chunkTVAGNQHJcjs = require('./chunk-TVAGNQHJ.cjs');
20
20
  require('./chunk-PEARNJ5G.cjs');
21
21
  require('./chunk-RI33QVOD.cjs');
22
22
 
@@ -106,6 +106,7 @@ var createBrowserMediaSession = () => {
106
106
  var _jsxruntime = require('react/jsx-runtime');
107
107
  var createDefaultBrowserContext = (browser) => {
108
108
  const defaults = {
109
+ appListenerChangesHandledExternally: false,
109
110
  openExternalLink: (url) => {
110
111
  window.open(url, "_blank", "noopener,noreferrer");
111
112
  },
@@ -242,7 +243,7 @@ var Debugger = ({ title, className }) => {
242
243
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "grow px-1", children: title }),
243
244
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkA5LYYZERcjs.ToolbarDivider, {}),
244
245
  openDevTools && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
245
- _chunk5CAFJT5Tcjs.ControlButton,
246
+ _chunkTVAGNQHJcjs.ControlButton,
246
247
  {
247
248
  onClick: openDevTools,
248
249
  variant: "toolbar",
@@ -251,7 +252,7 @@ var Debugger = ({ title, className }) => {
251
252
  }
252
253
  ),
253
254
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
254
- _chunk5CAFJT5Tcjs.ControlButton,
255
+ _chunkTVAGNQHJcjs.ControlButton,
255
256
  {
256
257
  onClick: handleRequestScrollToBottom,
257
258
  variant: "toolbar",
@@ -259,7 +260,7 @@ var Debugger = ({ title, className }) => {
259
260
  children: "Scroll to Bottom"
260
261
  }
261
262
  ),
262
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk5CAFJT5Tcjs.ControlButton, { onClick: exportLogs, variant: "toolbar", icon: "publish", children: "Export Logs" })
263
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkTVAGNQHJcjs.ControlButton, { onClick: exportLogs, variant: "toolbar", icon: "publish", children: "Export Logs" })
263
264
  ] }) }),
264
265
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
265
266
  "pre",
@@ -51,6 +51,7 @@ type NewWindowOptions = {
51
51
  mode?: string;
52
52
  };
53
53
  type BaseBrowserContext = {
54
+ appListenerChangesHandledExternally?: boolean;
54
55
  openExternalLink: (url: string) => void;
55
56
  openNewWidow: (url: string, options?: NewWindowOptions) => void;
56
57
  selectDirectory: (() => Promise<string | null>) | null;
@@ -51,6 +51,7 @@ type NewWindowOptions = {
51
51
  mode?: string;
52
52
  };
53
53
  type BaseBrowserContext = {
54
+ appListenerChangesHandledExternally?: boolean;
54
55
  openExternalLink: (url: string) => void;
55
56
  openNewWidow: (url: string, options?: NewWindowOptions) => void;
56
57
  selectDirectory: (() => Promise<string | null>) | null;
package/dist/frontend.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  } from "./chunk-EJNNLQ2S.js";
17
17
  import {
18
18
  ControlButton
19
- } from "./chunk-LKKN6DFB.js";
19
+ } from "./chunk-LDUYBGRY.js";
20
20
  import "./chunk-BIY5HAXP.js";
21
21
  import "./chunk-4PMRDURG.js";
22
22
  import {
@@ -106,6 +106,7 @@ var createBrowserMediaSession = () => {
106
106
  import { jsx } from "react/jsx-runtime";
107
107
  var createDefaultBrowserContext = (browser) => {
108
108
  const defaults = {
109
+ appListenerChangesHandledExternally: false,
109
110
  openExternalLink: (url) => {
110
111
  window.open(url, "_blank", "noopener,noreferrer");
111
112
  },
package/dist/index.cjs CHANGED
@@ -103,6 +103,7 @@ var _data = require('@arcanejs/react-toolkit/data');
103
103
 
104
104
  var _toolkit = require('@arcanejs/toolkit');
105
105
  var _events = require('events');
106
+ var _escapehtml = require('escape-html'); var _escapehtml2 = _interopRequireDefault(_escapehtml);
106
107
  var MAX_LOG_ENTRIES = 1e3;
107
108
  var getStackFramesFromError = (error) => {
108
109
  if (typeof error === "string") {
@@ -190,6 +191,26 @@ var runSigilApp = ({
190
191
  debug: upstreamLogger.debug.bind(upstreamLogger)
191
192
  },
192
193
  title,
194
+ htmlPage: (context) => `
195
+ <html>
196
+ <head>
197
+ <title>${_escapehtml2.default.call(void 0, context.title)}</title>
198
+ <meta charset="utf-8">
199
+ <meta name="viewport" content="width=device-width, user-scalable=no" />
200
+ <style type="text/css">
201
+ @font-face {
202
+ font-family: 'Material Symbols Outlined';
203
+ font-style: normal;
204
+ src: url(${context.coreAssets.materialSymbolsOutlined}) format('woff');
205
+ }
206
+ </style>
207
+ ${context.coreAssets.entrypointCss ? `<link rel="stylesheet" href="${context.coreAssets.entrypointCss}" />` : ""}
208
+ </head>
209
+ <body>
210
+ <div id="root"></div>
211
+ <script type="text/javascript" src="${context.coreAssets.entrypointJs}"></script>
212
+ </body>
213
+ </html>`,
193
214
  ...toolkitOptions
194
215
  });
195
216
  toolkit.start({
@@ -395,7 +416,8 @@ var AppListenerManager = ({
395
416
  const resolvedConnectionDetails = {
396
417
  config,
397
418
  host,
398
- port
419
+ port,
420
+ internal: !!config.interface && !!_optionalChain([interfaces, 'access', _9 => _9[config.interface], 'optionalAccess', _10 => _10.internal])
399
421
  };
400
422
  try {
401
423
  const listener = await toolkit.listen({
@@ -410,7 +432,7 @@ var AppListenerManager = ({
410
432
  listener,
411
433
  ...resolvedConnectionDetails
412
434
  };
413
- _optionalChain([appRegistration, 'optionalAccess', _9 => _9.setConnection, 'call', _10 => _10(key, {
435
+ _optionalChain([appRegistration, 'optionalAccess', _11 => _11.setConnection, 'call', _12 => _12(key, {
414
436
  ...basePortInformation,
415
437
  port,
416
438
  status: "active"
@@ -433,7 +455,7 @@ var AppListenerManager = ({
433
455
  config,
434
456
  error: `${error}`
435
457
  };
436
- _optionalChain([appRegistration, 'optionalAccess', _11 => _11.setConnection, 'call', _12 => _12(key, {
458
+ _optionalChain([appRegistration, 'optionalAccess', _13 => _13.setConnection, 'call', _14 => _14(key, {
437
459
  ...basePortInformation,
438
460
  status: "error",
439
461
  errors: [error.message]
@@ -466,11 +488,21 @@ var AppListenerManager = ({
466
488
  }, [appRegistration, listenerConfig, logger, toolkit, updateReactState]);
467
489
  _react.useEffect.call(void 0, () => {
468
490
  for (const state of Object.values(listenerState)) {
491
+ let preferredConnection = null;
469
492
  if (state.state === "connected") {
493
+ if (!preferredConnection) {
494
+ preferredConnection = state;
495
+ }
496
+ if (!preferredConnection.internal && state.internal) {
497
+ preferredConnection = state;
498
+ }
499
+ }
500
+ if (preferredConnection) {
470
501
  setWindowUrl(
471
- new URL(`http://${_nullishCoalesce(state.host, () => ( "localhost"))}:${state.port}/`)
502
+ new URL(
503
+ `http://${_nullishCoalesce(preferredConnection.host, () => ( "localhost"))}:${preferredConnection.port}/`
504
+ )
472
505
  );
473
- return;
474
506
  }
475
507
  }
476
508
  });
package/dist/index.d.cts CHANGED
@@ -13,7 +13,10 @@ import { IDMap } from '@arcanejs/toolkit/util';
13
13
  import { g as SigilNamespace, S as SigilAppRootComponent, a as AppRootGetLogsArgs, b as AppRootGetLogsReturn, e as SigilComponentCalls } from './proto-B-WcMUOE.cjs';
14
14
  export { A as AppRootGetLogs, c as SIGIL_NAMESPACE, d as SigilComponent, h as SigilComponentMessage, i as isSigilComponent, f as isSigilComponentCall } from './proto-B-WcMUOE.cjs';
15
15
  import { NetworkPortStatus } from '@arcanewizards/net-utils';
16
+ import { AllListenerConfig } from './shared/config.cjs';
17
+ export { ListenerConfig } from './shared/config.cjs';
16
18
  import '@arcanejs/diff';
19
+ import 'zod';
17
20
 
18
21
  type AppInformationContextData = {
19
22
  version: string;
@@ -113,14 +116,6 @@ declare const SIGIL_COMPONENTS: {
113
116
  } & react.RefAttributes<AppRoot>>;
114
117
  };
115
118
 
116
- type ListenerConfig = {
117
- port: number | {
118
- from: number;
119
- to: number;
120
- };
121
- interface?: string | undefined;
122
- };
123
- type AllListenerConfig = Record<string, ListenerConfig>;
124
119
  type AppListenerManagerAppRegistration = {
125
120
  removeConnection: (uuid: string) => void;
126
121
  setConnection: (uuid: string, details: NetworkPortStatus) => void;
@@ -133,4 +128,4 @@ type AppListenerManagerProps = {
133
128
  };
134
129
  declare const AppListenerManager: FC<AppListenerManagerProps>;
135
130
 
136
- export { type AllListenerConfig, AppInformationContext, type AppInformationContextData, AppListenerManager, type AppListenerManagerAppRegistration, AppRoot, AppRootGetLogsArgs, AppRootGetLogsReturn, AppRootLogEntry, AppShell, type AppShellProps, type ListenerConfig, LoggerContext, SIGIL_COMPONENTS, ShutdownContext, type ShutdownContextData, type SigilAppInstance, SigilAppRootComponent, SigilComponentCalls, type SigilRuntimeAppProps, type SigilRuntimeEventMap, type SigilRuntimeOptions, SystemInformation, createSystemInformation, runSigilApp, useLogger, useShutdownHandler };
131
+ export { AllListenerConfig, AppInformationContext, type AppInformationContextData, AppListenerManager, type AppListenerManagerAppRegistration, AppRoot, AppRootGetLogsArgs, AppRootGetLogsReturn, AppRootLogEntry, AppShell, type AppShellProps, LoggerContext, SIGIL_COMPONENTS, ShutdownContext, type ShutdownContextData, type SigilAppInstance, SigilAppRootComponent, SigilComponentCalls, type SigilRuntimeAppProps, type SigilRuntimeEventMap, type SigilRuntimeOptions, SystemInformation, createSystemInformation, runSigilApp, useLogger, useShutdownHandler };
package/dist/index.d.ts CHANGED
@@ -13,7 +13,10 @@ import { IDMap } from '@arcanejs/toolkit/util';
13
13
  import { g as SigilNamespace, S as SigilAppRootComponent, a as AppRootGetLogsArgs, b as AppRootGetLogsReturn, e as SigilComponentCalls } from './proto-kGDF-yWB.js';
14
14
  export { A as AppRootGetLogs, c as SIGIL_NAMESPACE, d as SigilComponent, h as SigilComponentMessage, i as isSigilComponent, f as isSigilComponentCall } from './proto-kGDF-yWB.js';
15
15
  import { NetworkPortStatus } from '@arcanewizards/net-utils';
16
+ import { AllListenerConfig } from './shared/config.js';
17
+ export { ListenerConfig } from './shared/config.js';
16
18
  import '@arcanejs/diff';
19
+ import 'zod';
17
20
 
18
21
  type AppInformationContextData = {
19
22
  version: string;
@@ -113,14 +116,6 @@ declare const SIGIL_COMPONENTS: {
113
116
  } & react.RefAttributes<AppRoot>>;
114
117
  };
115
118
 
116
- type ListenerConfig = {
117
- port: number | {
118
- from: number;
119
- to: number;
120
- };
121
- interface?: string | undefined;
122
- };
123
- type AllListenerConfig = Record<string, ListenerConfig>;
124
119
  type AppListenerManagerAppRegistration = {
125
120
  removeConnection: (uuid: string) => void;
126
121
  setConnection: (uuid: string, details: NetworkPortStatus) => void;
@@ -133,4 +128,4 @@ type AppListenerManagerProps = {
133
128
  };
134
129
  declare const AppListenerManager: FC<AppListenerManagerProps>;
135
130
 
136
- export { type AllListenerConfig, AppInformationContext, type AppInformationContextData, AppListenerManager, type AppListenerManagerAppRegistration, AppRoot, AppRootGetLogsArgs, AppRootGetLogsReturn, AppRootLogEntry, AppShell, type AppShellProps, type ListenerConfig, LoggerContext, SIGIL_COMPONENTS, ShutdownContext, type ShutdownContextData, type SigilAppInstance, SigilAppRootComponent, SigilComponentCalls, type SigilRuntimeAppProps, type SigilRuntimeEventMap, type SigilRuntimeOptions, SystemInformation, createSystemInformation, runSigilApp, useLogger, useShutdownHandler };
131
+ export { AllListenerConfig, AppInformationContext, type AppInformationContextData, AppListenerManager, type AppListenerManagerAppRegistration, AppRoot, AppRootGetLogsArgs, AppRootGetLogsReturn, AppRootLogEntry, AppShell, type AppShellProps, LoggerContext, SIGIL_COMPONENTS, ShutdownContext, type ShutdownContextData, type SigilAppInstance, SigilAppRootComponent, SigilComponentCalls, type SigilRuntimeAppProps, type SigilRuntimeEventMap, type SigilRuntimeOptions, SystemInformation, createSystemInformation, runSigilApp, useLogger, useShutdownHandler };
package/dist/index.js CHANGED
@@ -103,6 +103,7 @@ import { ArcaneDataFileError } from "@arcanejs/react-toolkit/data";
103
103
  import { CoreComponents, ToolkitRenderer } from "@arcanejs/react-toolkit";
104
104
  import { Toolkit } from "@arcanejs/toolkit";
105
105
  import { EventEmitter as EventEmitter2 } from "events";
106
+ import escapeHTML from "escape-html";
106
107
  var MAX_LOG_ENTRIES = 1e3;
107
108
  var getStackFramesFromError = (error) => {
108
109
  if (typeof error === "string") {
@@ -190,6 +191,26 @@ var runSigilApp = ({
190
191
  debug: upstreamLogger.debug.bind(upstreamLogger)
191
192
  },
192
193
  title,
194
+ htmlPage: (context) => `
195
+ <html>
196
+ <head>
197
+ <title>${escapeHTML(context.title)}</title>
198
+ <meta charset="utf-8">
199
+ <meta name="viewport" content="width=device-width, user-scalable=no" />
200
+ <style type="text/css">
201
+ @font-face {
202
+ font-family: 'Material Symbols Outlined';
203
+ font-style: normal;
204
+ src: url(${context.coreAssets.materialSymbolsOutlined}) format('woff');
205
+ }
206
+ </style>
207
+ ${context.coreAssets.entrypointCss ? `<link rel="stylesheet" href="${context.coreAssets.entrypointCss}" />` : ""}
208
+ </head>
209
+ <body>
210
+ <div id="root"></div>
211
+ <script type="text/javascript" src="${context.coreAssets.entrypointJs}"></script>
212
+ </body>
213
+ </html>`,
193
214
  ...toolkitOptions
194
215
  });
195
216
  toolkit.start({
@@ -395,7 +416,8 @@ var AppListenerManager = ({
395
416
  const resolvedConnectionDetails = {
396
417
  config,
397
418
  host,
398
- port
419
+ port,
420
+ internal: !!config.interface && !!interfaces[config.interface]?.internal
399
421
  };
400
422
  try {
401
423
  const listener = await toolkit.listen({
@@ -466,11 +488,21 @@ var AppListenerManager = ({
466
488
  }, [appRegistration, listenerConfig, logger, toolkit, updateReactState]);
467
489
  useEffect3(() => {
468
490
  for (const state of Object.values(listenerState)) {
491
+ let preferredConnection = null;
469
492
  if (state.state === "connected") {
493
+ if (!preferredConnection) {
494
+ preferredConnection = state;
495
+ }
496
+ if (!preferredConnection.internal && state.internal) {
497
+ preferredConnection = state;
498
+ }
499
+ }
500
+ if (preferredConnection) {
470
501
  setWindowUrl(
471
- new URL(`http://${state.host ?? "localhost"}:${state.port}/`)
502
+ new URL(
503
+ `http://${preferredConnection.host ?? "localhost"}:${preferredConnection.port}/`
504
+ )
472
505
  );
473
- return;
474
506
  }
475
507
  }
476
508
  });
@@ -0,0 +1,29 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/shared/config.ts
2
+ var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);
3
+ var APP_LISTENER_CONFIG = _zod2.default.object({
4
+ port: _zod2.default.union([
5
+ _zod2.default.number().int().min(1).max(65535),
6
+ _zod2.default.object({
7
+ from: _zod2.default.number().int().min(1).max(65535),
8
+ to: _zod2.default.number().int().min(1).max(65535)
9
+ }).refine((data) => data.to >= data.from, {
10
+ message: '"to" must be greater than or equal to "from"'
11
+ })
12
+ ]),
13
+ interface: _zod2.default.string().optional()
14
+ });
15
+ var ALL_APP_LISTENER_CONFIG = _zod2.default.record(
16
+ _zod2.default.string(),
17
+ APP_LISTENER_CONFIG
18
+ );
19
+ var portString = (port) => {
20
+ if (typeof port === "number") {
21
+ return port.toString();
22
+ }
23
+ return `${port.from}-${port.to}`;
24
+ };
25
+
26
+
27
+
28
+
29
+ exports.ALL_APP_LISTENER_CONFIG = ALL_APP_LISTENER_CONFIG; exports.APP_LISTENER_CONFIG = APP_LISTENER_CONFIG; exports.portString = portString;
@@ -0,0 +1,69 @@
1
+ import z from 'zod';
2
+
3
+ declare const APP_LISTENER_CONFIG: z.ZodObject<{
4
+ port: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodObject<{
5
+ from: z.ZodNumber;
6
+ to: z.ZodNumber;
7
+ }, "strip", z.ZodTypeAny, {
8
+ from: number;
9
+ to: number;
10
+ }, {
11
+ from: number;
12
+ to: number;
13
+ }>, {
14
+ from: number;
15
+ to: number;
16
+ }, {
17
+ from: number;
18
+ to: number;
19
+ }>]>;
20
+ interface: z.ZodOptional<z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ port: number | {
23
+ from: number;
24
+ to: number;
25
+ };
26
+ interface?: string | undefined;
27
+ }, {
28
+ port: number | {
29
+ from: number;
30
+ to: number;
31
+ };
32
+ interface?: string | undefined;
33
+ }>;
34
+ type ListenerConfig = z.infer<typeof APP_LISTENER_CONFIG>;
35
+ declare const ALL_APP_LISTENER_CONFIG: z.ZodRecord<z.ZodString, z.ZodObject<{
36
+ port: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodObject<{
37
+ from: z.ZodNumber;
38
+ to: z.ZodNumber;
39
+ }, "strip", z.ZodTypeAny, {
40
+ from: number;
41
+ to: number;
42
+ }, {
43
+ from: number;
44
+ to: number;
45
+ }>, {
46
+ from: number;
47
+ to: number;
48
+ }, {
49
+ from: number;
50
+ to: number;
51
+ }>]>;
52
+ interface: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ port: number | {
55
+ from: number;
56
+ to: number;
57
+ };
58
+ interface?: string | undefined;
59
+ }, {
60
+ port: number | {
61
+ from: number;
62
+ to: number;
63
+ };
64
+ interface?: string | undefined;
65
+ }>>;
66
+ type AllListenerConfig = z.infer<typeof ALL_APP_LISTENER_CONFIG>;
67
+ declare const portString: (port: ListenerConfig["port"]) => string;
68
+
69
+ export { ALL_APP_LISTENER_CONFIG, APP_LISTENER_CONFIG, type AllListenerConfig, type ListenerConfig, portString };
@@ -0,0 +1,69 @@
1
+ import z from 'zod';
2
+
3
+ declare const APP_LISTENER_CONFIG: z.ZodObject<{
4
+ port: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodObject<{
5
+ from: z.ZodNumber;
6
+ to: z.ZodNumber;
7
+ }, "strip", z.ZodTypeAny, {
8
+ from: number;
9
+ to: number;
10
+ }, {
11
+ from: number;
12
+ to: number;
13
+ }>, {
14
+ from: number;
15
+ to: number;
16
+ }, {
17
+ from: number;
18
+ to: number;
19
+ }>]>;
20
+ interface: z.ZodOptional<z.ZodString>;
21
+ }, "strip", z.ZodTypeAny, {
22
+ port: number | {
23
+ from: number;
24
+ to: number;
25
+ };
26
+ interface?: string | undefined;
27
+ }, {
28
+ port: number | {
29
+ from: number;
30
+ to: number;
31
+ };
32
+ interface?: string | undefined;
33
+ }>;
34
+ type ListenerConfig = z.infer<typeof APP_LISTENER_CONFIG>;
35
+ declare const ALL_APP_LISTENER_CONFIG: z.ZodRecord<z.ZodString, z.ZodObject<{
36
+ port: z.ZodUnion<[z.ZodNumber, z.ZodEffects<z.ZodObject<{
37
+ from: z.ZodNumber;
38
+ to: z.ZodNumber;
39
+ }, "strip", z.ZodTypeAny, {
40
+ from: number;
41
+ to: number;
42
+ }, {
43
+ from: number;
44
+ to: number;
45
+ }>, {
46
+ from: number;
47
+ to: number;
48
+ }, {
49
+ from: number;
50
+ to: number;
51
+ }>]>;
52
+ interface: z.ZodOptional<z.ZodString>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ port: number | {
55
+ from: number;
56
+ to: number;
57
+ };
58
+ interface?: string | undefined;
59
+ }, {
60
+ port: number | {
61
+ from: number;
62
+ to: number;
63
+ };
64
+ interface?: string | undefined;
65
+ }>>;
66
+ type AllListenerConfig = z.infer<typeof ALL_APP_LISTENER_CONFIG>;
67
+ declare const portString: (port: ListenerConfig["port"]) => string;
68
+
69
+ export { ALL_APP_LISTENER_CONFIG, APP_LISTENER_CONFIG, type AllListenerConfig, type ListenerConfig, portString };
@@ -0,0 +1,29 @@
1
+ // src/shared/config.ts
2
+ import z from "zod";
3
+ var APP_LISTENER_CONFIG = z.object({
4
+ port: z.union([
5
+ z.number().int().min(1).max(65535),
6
+ z.object({
7
+ from: z.number().int().min(1).max(65535),
8
+ to: z.number().int().min(1).max(65535)
9
+ }).refine((data) => data.to >= data.from, {
10
+ message: '"to" must be greater than or equal to "from"'
11
+ })
12
+ ]),
13
+ interface: z.string().optional()
14
+ });
15
+ var ALL_APP_LISTENER_CONFIG = z.record(
16
+ z.string(),
17
+ APP_LISTENER_CONFIG
18
+ );
19
+ var portString = (port) => {
20
+ if (typeof port === "number") {
21
+ return port.toString();
22
+ }
23
+ return `${port.from}-${port.to}`;
24
+ };
25
+ export {
26
+ ALL_APP_LISTENER_CONFIG,
27
+ APP_LISTENER_CONFIG,
28
+ portString
29
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arcanewizards/sigil",
3
3
  "description": "Application framework for A/V applications, built on-top of arcanejs",
4
- "version": "0.1.5",
4
+ "version": "0.1.6",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -92,6 +92,12 @@
92
92
  "./frontend/styles/base.css": {
93
93
  "default": "./dist/frontend/styles/base.css"
94
94
  },
95
+ "./shared/config": {
96
+ "@arcanewizards/source": "./src/shared/config.ts",
97
+ "types": "./dist/shared/config.d.ts",
98
+ "import": "./dist/shared/config.js",
99
+ "require": "./dist/shared/config.cjs"
100
+ },
95
101
  "./package.json": "./package.json"
96
102
  },
97
103
  "files": [
@@ -103,6 +109,8 @@
103
109
  "@arcanejs/react-toolkit": "^0.15.1",
104
110
  "@arcanejs/toolkit": "^8.0.0",
105
111
  "@arcanejs/toolkit-frontend": "^0.11.0",
112
+ "@types/escape-html": "^1.0.4",
113
+ "escape-html": "^1.0.3",
106
114
  "lodash": "^4.17.21",
107
115
  "pino": "^9.5.0",
108
116
  "radix-ui": "^1.4.3",
@@ -121,8 +129,8 @@
121
129
  "tailwindcss": "^4.1.13",
122
130
  "tsup": "^8.1.0",
123
131
  "typescript": "^5.7.3",
124
- "@arcanewizards/typescript-config": "^0.0.0",
125
- "@arcanewizards/eslint-config": "^0.0.0"
132
+ "@arcanewizards/eslint-config": "^0.0.0",
133
+ "@arcanewizards/typescript-config": "^0.0.0"
126
134
  },
127
135
  "scripts": {
128
136
  "build": "rm -rf dist && tsup && pnpm build:styles && check-export-map",