@arcanewizards/sigil 0.1.4 → 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: [
@@ -247,7 +251,7 @@ ControlParagraph.displayName = "ControlParagraph";
247
251
  var ControlLabel = forwardRef2(
248
252
  ({ className, disabled, nonMicro, position = "label", subgrid, ...props }, ref) => {
249
253
  return /* @__PURE__ */ jsx2(
250
- "div",
254
+ "label",
251
255
  {
252
256
  ...props,
253
257
  ref,
@@ -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
  }
@@ -507,19 +518,9 @@ var ControlSelect = ({
507
518
  }
508
519
  );
509
520
  };
510
- var COLOR_OPTIONS = {
511
- red: { label: "Red", value: "red" },
512
- blue: { label: "Blue", value: "blue" },
513
- teal: { label: "Teal", value: "teal" },
514
- green: { label: "Green", value: "green" },
515
- yellow: { label: "Yellow", value: "yellow" },
516
- purple: { label: "Purple", value: "purple" },
517
- orange: { label: "Orange", value: "orange" },
518
- brown: { label: "Brown", value: "brown" },
519
- gray: { label: "Gray", value: "gray" }
520
- };
521
- var ControlColorSelect = ({
522
- color,
521
+ var ControlColoredSelect = ({
522
+ options,
523
+ value,
523
524
  onChange,
524
525
  variant,
525
526
  position,
@@ -527,13 +528,13 @@ var ControlColorSelect = ({
527
528
  placeholder,
528
529
  ...props
529
530
  }) => {
530
- const options = Object.values(COLOR_OPTIONS);
531
- const selectedColor = sigilColorUsage(color || "gray");
531
+ const selectedOption = options.find((option) => option.value === value);
532
+ const selectedColor = sigilColorUsage(selectedOption?.color ?? "gray");
532
533
  return /* @__PURE__ */ jsx5(
533
534
  ControlSelect,
534
535
  {
535
536
  options,
536
- value: color,
537
+ value,
537
538
  onChange,
538
539
  triggerButton: (option) => /* @__PURE__ */ jsx5(
539
540
  Select.Trigger,
@@ -587,7 +588,7 @@ var ControlColorSelect = ({
587
588
  {
588
589
  className: "",
589
590
  style: {
590
- color: `var(--sigil-usage-${option.value}-foreground)`
591
+ color: `var(--sigil-usage-${option.color}-foreground)`
591
592
  },
592
593
  children: option.label
593
594
  }
@@ -599,6 +600,31 @@ var ControlColorSelect = ({
599
600
  }
600
601
  );
601
602
  };
603
+ var COLOR_OPTIONS = {
604
+ red: { label: "Red", value: "red", color: "red" },
605
+ blue: { label: "Blue", value: "blue", color: "blue" },
606
+ teal: { label: "Teal", value: "teal", color: "teal" },
607
+ green: { label: "Green", value: "green", color: "green" },
608
+ yellow: { label: "Yellow", value: "yellow", color: "yellow" },
609
+ purple: { label: "Purple", value: "purple", color: "purple" },
610
+ orange: { label: "Orange", value: "orange", color: "orange" },
611
+ brown: { label: "Brown", value: "brown", color: "brown" },
612
+ gray: { label: "Gray", value: "gray", color: "gray" }
613
+ };
614
+ var COLOR_OPTIONS_ARRAY = Object.values(COLOR_OPTIONS);
615
+ var ControlColorSelect = ({
616
+ color,
617
+ ...props
618
+ }) => {
619
+ return /* @__PURE__ */ jsx5(
620
+ ControlColoredSelect,
621
+ {
622
+ options: COLOR_OPTIONS_ARRAY,
623
+ value: color,
624
+ ...props
625
+ }
626
+ );
627
+ };
602
628
 
603
629
  // src/frontend/dialogs.tsx
604
630
  import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -767,5 +793,6 @@ export {
767
793
  ControlInput,
768
794
  ControlPercent,
769
795
  ControlSelect,
796
+ ControlColoredSelect,
770
797
  ControlColorSelect
771
798
  };
@@ -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: [
@@ -247,7 +251,7 @@ ControlParagraph.displayName = "ControlParagraph";
247
251
  var ControlLabel = _react.forwardRef.call(void 0,
248
252
  ({ className, disabled, nonMicro, position = "label", subgrid, ...props }, ref) => {
249
253
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
250
- "div",
254
+ "label",
251
255
  {
252
256
  ...props,
253
257
  ref,
@@ -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
  }
@@ -507,19 +518,9 @@ var ControlSelect = ({
507
518
  }
508
519
  );
509
520
  };
510
- var COLOR_OPTIONS = {
511
- red: { label: "Red", value: "red" },
512
- blue: { label: "Blue", value: "blue" },
513
- teal: { label: "Teal", value: "teal" },
514
- green: { label: "Green", value: "green" },
515
- yellow: { label: "Yellow", value: "yellow" },
516
- purple: { label: "Purple", value: "purple" },
517
- orange: { label: "Orange", value: "orange" },
518
- brown: { label: "Brown", value: "brown" },
519
- gray: { label: "Gray", value: "gray" }
520
- };
521
- var ControlColorSelect = ({
522
- color,
521
+ var ControlColoredSelect = ({
522
+ options,
523
+ value,
523
524
  onChange,
524
525
  variant,
525
526
  position,
@@ -527,13 +528,13 @@ var ControlColorSelect = ({
527
528
  placeholder,
528
529
  ...props
529
530
  }) => {
530
- const options = Object.values(COLOR_OPTIONS);
531
- const selectedColor = _chunkTZJ4UXR3cjs.sigilColorUsage.call(void 0, color || "gray");
531
+ const selectedOption = options.find((option) => option.value === value);
532
+ const selectedColor = _chunkTZJ4UXR3cjs.sigilColorUsage.call(void 0, _nullishCoalesce(_optionalChain([selectedOption, 'optionalAccess', _6 => _6.color]), () => ( "gray")));
532
533
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
533
534
  ControlSelect,
534
535
  {
535
536
  options,
536
- value: color,
537
+ value,
537
538
  onChange,
538
539
  triggerButton: (option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
539
540
  _radixui.Select.Trigger,
@@ -542,7 +543,7 @@ var ControlColorSelect = ({
542
543
  className: clsControlButton({
543
544
  variant,
544
545
  position,
545
- active: _optionalChain([option, 'optionalAccess', _6 => _6.active])
546
+ active: _optionalChain([option, 'optionalAccess', _7 => _7.active])
546
547
  }),
547
548
  style: controlButtonColorVariables({
548
549
  bg: selectedColor.background,
@@ -569,7 +570,7 @@ var ControlColorSelect = ({
569
570
  )
570
571
  ] }),
571
572
  children: [
572
- _nullishCoalesce(_optionalChain([option, 'optionalAccess', _7 => _7.label]), () => ( placeholder)),
573
+ _nullishCoalesce(_optionalChain([option, 'optionalAccess', _8 => _8.label]), () => ( placeholder)),
573
574
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
574
575
  _core.Icon,
575
576
  {
@@ -587,7 +588,7 @@ var ControlColorSelect = ({
587
588
  {
588
589
  className: "",
589
590
  style: {
590
- color: `var(--sigil-usage-${option.value}-foreground)`
591
+ color: `var(--sigil-usage-${option.color}-foreground)`
591
592
  },
592
593
  children: option.label
593
594
  }
@@ -599,6 +600,31 @@ var ControlColorSelect = ({
599
600
  }
600
601
  );
601
602
  };
603
+ var COLOR_OPTIONS = {
604
+ red: { label: "Red", value: "red", color: "red" },
605
+ blue: { label: "Blue", value: "blue", color: "blue" },
606
+ teal: { label: "Teal", value: "teal", color: "teal" },
607
+ green: { label: "Green", value: "green", color: "green" },
608
+ yellow: { label: "Yellow", value: "yellow", color: "yellow" },
609
+ purple: { label: "Purple", value: "purple", color: "purple" },
610
+ orange: { label: "Orange", value: "orange", color: "orange" },
611
+ brown: { label: "Brown", value: "brown", color: "brown" },
612
+ gray: { label: "Gray", value: "gray", color: "gray" }
613
+ };
614
+ var COLOR_OPTIONS_ARRAY = Object.values(COLOR_OPTIONS);
615
+ var ControlColorSelect = ({
616
+ color,
617
+ ...props
618
+ }) => {
619
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
620
+ ControlColoredSelect,
621
+ {
622
+ options: COLOR_OPTIONS_ARRAY,
623
+ value: color,
624
+ ...props
625
+ }
626
+ );
627
+ };
602
628
 
603
629
  // src/frontend/dialogs.tsx
604
630
 
@@ -653,7 +679,7 @@ var Dialog = ({
653
679
  if (!dialogRef) return;
654
680
  dialogRef.showModal();
655
681
  }, [dialogRef]);
656
- const close = () => _optionalChain([dialogRef, 'optionalAccess', _8 => _8.close, 'call', _9 => _9()]);
682
+ const close = () => _optionalChain([dialogRef, 'optionalAccess', _9 => _9.close, 'call', _10 => _10()]);
657
683
  const onClose = (event) => {
658
684
  if (closable) {
659
685
  dialogClosed();
@@ -768,4 +794,5 @@ var DialogProvider = ({ children }) => {
768
794
 
769
795
 
770
796
 
771
- exports.clsControlPosition = clsControlPosition; exports.clsControlSubgridPosition = clsControlSubgridPosition; exports.controlPositionClass = controlPositionClass; exports.controlButtonColorVariable = controlButtonColorVariable; exports.controlButtonColorVariables = controlButtonColorVariables; exports.clsControlButton = clsControlButton; exports.ControlButton = ControlButton; exports.CheckboxControlButton = CheckboxControlButton; exports.LongPressableControlButton = LongPressableControlButton; exports.ControlButtonGroup = ControlButtonGroup; exports.ControlParagraph = ControlParagraph; exports.ControlLabel = ControlLabel; exports.ControlDetails = ControlDetails; exports.InputSpanningTitle = InputSpanningTitle; exports.DialogContext = DialogContext; exports.DialogTitle = DialogTitle; exports.DialogButtons = DialogButtons; exports.Dialog = Dialog; exports.DialogProvider = DialogProvider; exports.ControlDialogButtons = ControlDialogButtons; exports.ControlDialog = ControlDialog; exports.InputWithDelayedPropagation = InputWithDelayedPropagation; exports.ControlInput = ControlInput; exports.ControlPercent = ControlPercent; exports.ControlSelect = ControlSelect; exports.ControlColorSelect = ControlColorSelect;
797
+
798
+ exports.clsControlPosition = clsControlPosition; exports.clsControlSubgridPosition = clsControlSubgridPosition; exports.controlPositionClass = controlPositionClass; exports.controlButtonColorVariable = controlButtonColorVariable; exports.controlButtonColorVariables = controlButtonColorVariables; exports.clsControlButton = clsControlButton; exports.ControlButton = ControlButton; exports.CheckboxControlButton = CheckboxControlButton; exports.LongPressableControlButton = LongPressableControlButton; exports.ControlButtonGroup = ControlButtonGroup; exports.ControlParagraph = ControlParagraph; exports.ControlLabel = ControlLabel; exports.ControlDetails = ControlDetails; exports.InputSpanningTitle = InputSpanningTitle; exports.DialogContext = DialogContext; exports.DialogTitle = DialogTitle; exports.DialogButtons = DialogButtons; exports.Dialog = Dialog; exports.DialogProvider = DialogProvider; exports.ControlDialogButtons = ControlDialogButtons; exports.ControlDialog = ControlDialog; exports.InputWithDelayedPropagation = InputWithDelayedPropagation; exports.ControlInput = ControlInput; exports.ControlPercent = ControlPercent; exports.ControlSelect = ControlSelect; exports.ControlColoredSelect = ControlColoredSelect; exports.ControlColorSelect = ControlColorSelect;
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkCHVABPETcjs = require('../chunk-CHVABPET.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
- _chunkCHVABPETcjs.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
- _chunkCHVABPETcjs.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
- _chunkCHVABPETcjs.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
- _chunkCHVABPETcjs.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-E3VUC3Q4.js";
4
+ } from "../chunk-LDUYBGRY.js";
5
5
  import "../chunk-BIY5HAXP.js";
6
6
  import "../chunk-4PMRDURG.js";
7
7
  import "../chunk-WYUGJOEB.js";
@@ -20,7 +20,8 @@
20
20
 
21
21
 
22
22
 
23
- var _chunkCHVABPETcjs = require('../../chunk-CHVABPET.cjs');
23
+
24
+ var _chunkTVAGNQHJcjs = require('../../chunk-TVAGNQHJ.cjs');
24
25
  require('../../chunk-PEARNJ5G.cjs');
25
26
  require('../../chunk-RI33QVOD.cjs');
26
27
  require('../../chunk-TZJ4UXR3.cjs');
@@ -46,4 +47,5 @@ require('../../chunk-TZJ4UXR3.cjs');
46
47
 
47
48
 
48
49
 
49
- exports.CheckboxControlButton = _chunkCHVABPETcjs.CheckboxControlButton; exports.ControlButton = _chunkCHVABPETcjs.ControlButton; exports.ControlButtonGroup = _chunkCHVABPETcjs.ControlButtonGroup; exports.ControlColorSelect = _chunkCHVABPETcjs.ControlColorSelect; exports.ControlDetails = _chunkCHVABPETcjs.ControlDetails; exports.ControlDialog = _chunkCHVABPETcjs.ControlDialog; exports.ControlDialogButtons = _chunkCHVABPETcjs.ControlDialogButtons; exports.ControlInput = _chunkCHVABPETcjs.ControlInput; exports.ControlLabel = _chunkCHVABPETcjs.ControlLabel; exports.ControlParagraph = _chunkCHVABPETcjs.ControlParagraph; exports.ControlPercent = _chunkCHVABPETcjs.ControlPercent; exports.ControlSelect = _chunkCHVABPETcjs.ControlSelect; exports.InputSpanningTitle = _chunkCHVABPETcjs.InputSpanningTitle; exports.InputWithDelayedPropagation = _chunkCHVABPETcjs.InputWithDelayedPropagation; exports.LongPressableControlButton = _chunkCHVABPETcjs.LongPressableControlButton; exports.clsControlButton = _chunkCHVABPETcjs.clsControlButton; exports.clsControlPosition = _chunkCHVABPETcjs.clsControlPosition; exports.clsControlSubgridPosition = _chunkCHVABPETcjs.clsControlSubgridPosition; exports.controlButtonColorVariable = _chunkCHVABPETcjs.controlButtonColorVariable; exports.controlButtonColorVariables = _chunkCHVABPETcjs.controlButtonColorVariables; exports.controlPositionClass = _chunkCHVABPETcjs.controlPositionClass;
50
+
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;
@@ -86,18 +88,18 @@ declare const ControlParagraph: react.ForwardRefExoticComponent<Omit<react.Detai
86
88
  position?: ControlPosition;
87
89
  mode?: ControlParagraphMode;
88
90
  } & react.RefAttributes<HTMLParagraphElement>>;
89
- type ControlLabelProps = ComponentPropsWithoutRef<'div'> & {
91
+ type ControlLabelProps = ComponentPropsWithoutRef<'label'> & {
90
92
  subgrid?: boolean;
91
93
  position?: ControlPosition;
92
94
  disabled?: boolean;
93
95
  nonMicro?: boolean;
94
96
  };
95
- declare const ControlLabel: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
97
+ declare const ControlLabel: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
96
98
  subgrid?: boolean;
97
99
  position?: ControlPosition;
98
100
  disabled?: boolean;
99
101
  nonMicro?: boolean;
100
- } & react.RefAttributes<HTMLDivElement>>;
102
+ } & react.RefAttributes<HTMLLabelElement>>;
101
103
  type ControlDetailsProps = ComponentPropsWithoutRef<'div'> & {
102
104
  position?: ControlPosition;
103
105
  align?: 'start' | 'center' | 'end';
@@ -146,13 +148,13 @@ type SelectOption<T> = {
146
148
  */
147
149
  active?: boolean;
148
150
  };
149
- type SelectProps<T extends string | null> = {
150
- options: SelectOption<T>[];
151
+ type SelectProps<T extends string | null, O extends SelectOption<T>> = {
152
+ options: O[];
151
153
  value: T | '';
152
154
  onChange: (value: T) => void;
153
- triggerText?: (option: SelectOption<T>) => ReactNode;
154
- triggerButton?: (option: null | SelectOption<T>) => ReactNode;
155
- option?: (option: SelectOption<T>) => ReactNode;
155
+ triggerText?: (option: O) => ReactNode;
156
+ triggerButton?: (option: null | O) => ReactNode;
157
+ option?: (option: O) => ReactNode;
156
158
  variant: ControlButtonVariant;
157
159
  position?: ControlPosition;
158
160
  disabled?: boolean;
@@ -160,11 +162,15 @@ type SelectProps<T extends string | null> = {
160
162
  placeholder?: ReactNode;
161
163
  triggerClassName?: string;
162
164
  };
163
- declare const ControlSelect: <T extends string | null>({ options, value, onChange, triggerText, triggerButton, option, variant, position, disabled, tooltip, placeholder, triggerClassName: className, }: SelectProps<T>) => react_jsx_runtime.JSX.Element;
165
+ declare const ControlSelect: <T extends string | null, O extends SelectOption<T> = SelectOption<T>>({ options, value, onChange, triggerText, triggerButton, option, variant, position, disabled, tooltip, placeholder, triggerClassName: className, }: SelectProps<T, O>) => react_jsx_runtime.JSX.Element;
166
+ type SigilOptionWithColor<T> = SelectOption<T> & {
167
+ color: SigilColor;
168
+ };
169
+ type ControlColoredSelectProps<T extends string | null, O extends SigilOptionWithColor<T>> = SelectProps<T, O>;
170
+ declare const ControlColoredSelect: <T extends string | null, O extends SigilOptionWithColor<T> = SigilOptionWithColor<T>>({ options, value, onChange, variant, position, disabled, placeholder, ...props }: ControlColoredSelectProps<T, O>) => react_jsx_runtime.JSX.Element;
164
171
  type ControlColorSelectProps = {
165
172
  color: SigilColor | '';
166
- onChange: (color: SigilColor) => void;
167
- } & Pick<SelectProps<SigilColor>, 'variant' | 'position' | 'disabled' | 'tooltip' | 'placeholder'>;
168
- declare const ControlColorSelect: ({ color, onChange, variant, position, disabled, placeholder, ...props }: ControlColorSelectProps) => react_jsx_runtime.JSX.Element;
173
+ } & Omit<ControlColoredSelectProps<SigilColor, SigilOptionWithColor<SigilColor>>, 'value' | 'options'>;
174
+ declare const ControlColorSelect: ({ color, ...props }: ControlColorSelectProps) => react_jsx_runtime.JSX.Element;
169
175
 
170
- export { CheckboxControlButton, type CheckboxControlButtonProps, ControlButton, ControlButtonGroup, type ControlButtonGroupProps, type ControlButtonProps, type ControlButtonVariant, ControlColorSelect, ControlDetails, type ControlDetailsProps, ControlDialog, ControlDialogButtons, ControlInput, type ControlInputProps, ControlLabel, type ControlLabelProps, ControlParagraph, type ControlParagraphMode, type ControlParagraphProps, ControlPercent, type ControlPercentProps, type ControlPosition, ControlSelect, InputSpanningTitle, type InputSpanningTitleProps, InputWithDelayedPropagation, LongPressableControlButton, type LongPressableControlButtonProps, type SelectOption, clsControlButton, clsControlPosition, clsControlSubgridPosition, controlButtonColorVariable, controlButtonColorVariables, controlPositionClass };
176
+ export { CheckboxControlButton, type CheckboxControlButtonProps, ControlButton, ControlButtonGroup, type ControlButtonGroupProps, type ControlButtonProps, type ControlButtonVariant, ControlColorSelect, ControlColoredSelect, ControlDetails, type ControlDetailsProps, ControlDialog, ControlDialogButtons, ControlInput, type ControlInputProps, ControlLabel, type ControlLabelProps, ControlParagraph, type ControlParagraphMode, type ControlParagraphProps, ControlPercent, type ControlPercentProps, type ControlPosition, ControlSelect, InputSpanningTitle, type InputSpanningTitleProps, InputWithDelayedPropagation, LongPressableControlButton, type LongPressableControlButtonProps, type SelectOption, clsControlButton, clsControlPosition, clsControlSubgridPosition, controlButtonColorVariable, controlButtonColorVariables, 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;
@@ -86,18 +88,18 @@ declare const ControlParagraph: react.ForwardRefExoticComponent<Omit<react.Detai
86
88
  position?: ControlPosition;
87
89
  mode?: ControlParagraphMode;
88
90
  } & react.RefAttributes<HTMLParagraphElement>>;
89
- type ControlLabelProps = ComponentPropsWithoutRef<'div'> & {
91
+ type ControlLabelProps = ComponentPropsWithoutRef<'label'> & {
90
92
  subgrid?: boolean;
91
93
  position?: ControlPosition;
92
94
  disabled?: boolean;
93
95
  nonMicro?: boolean;
94
96
  };
95
- declare const ControlLabel: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
97
+ declare const ControlLabel: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
96
98
  subgrid?: boolean;
97
99
  position?: ControlPosition;
98
100
  disabled?: boolean;
99
101
  nonMicro?: boolean;
100
- } & react.RefAttributes<HTMLDivElement>>;
102
+ } & react.RefAttributes<HTMLLabelElement>>;
101
103
  type ControlDetailsProps = ComponentPropsWithoutRef<'div'> & {
102
104
  position?: ControlPosition;
103
105
  align?: 'start' | 'center' | 'end';
@@ -146,13 +148,13 @@ type SelectOption<T> = {
146
148
  */
147
149
  active?: boolean;
148
150
  };
149
- type SelectProps<T extends string | null> = {
150
- options: SelectOption<T>[];
151
+ type SelectProps<T extends string | null, O extends SelectOption<T>> = {
152
+ options: O[];
151
153
  value: T | '';
152
154
  onChange: (value: T) => void;
153
- triggerText?: (option: SelectOption<T>) => ReactNode;
154
- triggerButton?: (option: null | SelectOption<T>) => ReactNode;
155
- option?: (option: SelectOption<T>) => ReactNode;
155
+ triggerText?: (option: O) => ReactNode;
156
+ triggerButton?: (option: null | O) => ReactNode;
157
+ option?: (option: O) => ReactNode;
156
158
  variant: ControlButtonVariant;
157
159
  position?: ControlPosition;
158
160
  disabled?: boolean;
@@ -160,11 +162,15 @@ type SelectProps<T extends string | null> = {
160
162
  placeholder?: ReactNode;
161
163
  triggerClassName?: string;
162
164
  };
163
- declare const ControlSelect: <T extends string | null>({ options, value, onChange, triggerText, triggerButton, option, variant, position, disabled, tooltip, placeholder, triggerClassName: className, }: SelectProps<T>) => react_jsx_runtime.JSX.Element;
165
+ declare const ControlSelect: <T extends string | null, O extends SelectOption<T> = SelectOption<T>>({ options, value, onChange, triggerText, triggerButton, option, variant, position, disabled, tooltip, placeholder, triggerClassName: className, }: SelectProps<T, O>) => react_jsx_runtime.JSX.Element;
166
+ type SigilOptionWithColor<T> = SelectOption<T> & {
167
+ color: SigilColor;
168
+ };
169
+ type ControlColoredSelectProps<T extends string | null, O extends SigilOptionWithColor<T>> = SelectProps<T, O>;
170
+ declare const ControlColoredSelect: <T extends string | null, O extends SigilOptionWithColor<T> = SigilOptionWithColor<T>>({ options, value, onChange, variant, position, disabled, placeholder, ...props }: ControlColoredSelectProps<T, O>) => react_jsx_runtime.JSX.Element;
164
171
  type ControlColorSelectProps = {
165
172
  color: SigilColor | '';
166
- onChange: (color: SigilColor) => void;
167
- } & Pick<SelectProps<SigilColor>, 'variant' | 'position' | 'disabled' | 'tooltip' | 'placeholder'>;
168
- declare const ControlColorSelect: ({ color, onChange, variant, position, disabled, placeholder, ...props }: ControlColorSelectProps) => react_jsx_runtime.JSX.Element;
173
+ } & Omit<ControlColoredSelectProps<SigilColor, SigilOptionWithColor<SigilColor>>, 'value' | 'options'>;
174
+ declare const ControlColorSelect: ({ color, ...props }: ControlColorSelectProps) => react_jsx_runtime.JSX.Element;
169
175
 
170
- export { CheckboxControlButton, type CheckboxControlButtonProps, ControlButton, ControlButtonGroup, type ControlButtonGroupProps, type ControlButtonProps, type ControlButtonVariant, ControlColorSelect, ControlDetails, type ControlDetailsProps, ControlDialog, ControlDialogButtons, ControlInput, type ControlInputProps, ControlLabel, type ControlLabelProps, ControlParagraph, type ControlParagraphMode, type ControlParagraphProps, ControlPercent, type ControlPercentProps, type ControlPosition, ControlSelect, InputSpanningTitle, type InputSpanningTitleProps, InputWithDelayedPropagation, LongPressableControlButton, type LongPressableControlButtonProps, type SelectOption, clsControlButton, clsControlPosition, clsControlSubgridPosition, controlButtonColorVariable, controlButtonColorVariables, controlPositionClass };
176
+ export { CheckboxControlButton, type CheckboxControlButtonProps, ControlButton, ControlButtonGroup, type ControlButtonGroupProps, type ControlButtonProps, type ControlButtonVariant, ControlColorSelect, ControlColoredSelect, ControlDetails, type ControlDetailsProps, ControlDialog, ControlDialogButtons, ControlInput, type ControlInputProps, ControlLabel, type ControlLabelProps, ControlParagraph, type ControlParagraphMode, type ControlParagraphProps, ControlPercent, type ControlPercentProps, type ControlPosition, ControlSelect, InputSpanningTitle, type InputSpanningTitleProps, InputWithDelayedPropagation, LongPressableControlButton, type LongPressableControlButtonProps, type SelectOption, clsControlButton, clsControlPosition, clsControlSubgridPosition, controlButtonColorVariable, controlButtonColorVariables, controlPositionClass };
@@ -3,6 +3,7 @@ import {
3
3
  ControlButton,
4
4
  ControlButtonGroup,
5
5
  ControlColorSelect,
6
+ ControlColoredSelect,
6
7
  ControlDetails,
7
8
  ControlDialog,
8
9
  ControlDialogButtons,
@@ -20,7 +21,7 @@ import {
20
21
  controlButtonColorVariable,
21
22
  controlButtonColorVariables,
22
23
  controlPositionClass
23
- } from "../../chunk-E3VUC3Q4.js";
24
+ } from "../../chunk-LDUYBGRY.js";
24
25
  import "../../chunk-BIY5HAXP.js";
25
26
  import "../../chunk-4PMRDURG.js";
26
27
  import "../../chunk-WYUGJOEB.js";
@@ -29,6 +30,7 @@ export {
29
30
  ControlButton,
30
31
  ControlButtonGroup,
31
32
  ControlColorSelect,
33
+ ControlColoredSelect,
32
34
  ControlDetails,
33
35
  ControlDialog,
34
36
  ControlDialogButtons,
@@ -4,7 +4,7 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkCHVABPETcjs = require('../chunk-CHVABPET.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 = _chunkCHVABPETcjs.Dialog; exports.DialogButtons = _chunkCHVABPETcjs.DialogButtons; exports.DialogContext = _chunkCHVABPETcjs.DialogContext; exports.DialogProvider = _chunkCHVABPETcjs.DialogProvider; exports.DialogTitle = _chunkCHVABPETcjs.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-E3VUC3Q4.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 _chunkCHVABPETcjs = require('./chunk-CHVABPET.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
- _chunkCHVABPETcjs.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
- _chunkCHVABPETcjs.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, _chunkCHVABPETcjs.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-E3VUC3Q4.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.4",
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",