flufi-ui 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.
@@ -1,5 +1,4 @@
1
1
  import {
2
- MOBILE,
3
2
  addClass,
4
3
  addStyles,
5
4
  addTitle,
@@ -8,7 +7,7 @@ import {
8
7
  splitFilePath,
9
8
  splitPath,
10
9
  syncWrap
11
- } from "./chunk-CE4YXNWV.js";
10
+ } from "./chunk-4SMIDGNR.js";
12
11
  import {
13
12
  CalendarDate,
14
13
  isMaybeLoaded,
@@ -142,21 +141,23 @@ function getPopoutTop(anchor, height, viewportHeight) {
142
141
  // src/components/Popout/Popout.tsx
143
142
  import { jsx as jsx4, jsxs } from "preact/jsx-runtime";
144
143
  function PopoutContainer(props) {
145
- const open = props.open ?? useSignal(false);
144
+ const localOpen = useSignal(false);
145
+ const open = props.open ?? localOpen;
146
146
  const anchorRef = useRef(null);
147
147
  const popoutRef = useRef(null);
148
148
  useLayoutEffect(() => {
149
149
  if (!open.value)
150
150
  return;
151
- const popout = popoutRef.current;
152
151
  function updateRect() {
153
- const rect = anchorRef.current?.getBoundingClientRect();
154
- if (!rect)
152
+ const anchor = anchorRef.current;
153
+ const popout = popoutRef.current;
154
+ if (!anchor || !popout)
155
155
  return;
156
+ const rect = anchor.getBoundingClientRect();
156
157
  popout.style.left = `${rect.left}px`;
157
- popout.style.width = `${Math.max(0, rect.width - 2)}px`;
158
+ popout.style.width = props.unlockedWidth ? "" : `${Math.max(0, rect.width - 2)}px`;
158
159
  const height = popout.getBoundingClientRect().height;
159
- popout.style.top = `${getPopoutTop(rect, height, window.innerHeight)}px`;
160
+ popout.style.top = `${props.top ? rect.top - height - 5 : getPopoutTop(rect, height, window.innerHeight)}px`;
160
161
  popout.style.visibility = "visible";
161
162
  }
162
163
  function onPointerDown(e) {
@@ -165,6 +166,9 @@ function PopoutContainer(props) {
165
166
  return;
166
167
  if (popoutRef.current?.contains(target))
167
168
  return;
169
+ const popout = target.closest?.(".popout");
170
+ if (popout)
171
+ return;
168
172
  open.value = false;
169
173
  }
170
174
  function onKeyDown(e) {
@@ -173,8 +177,8 @@ function PopoutContainer(props) {
173
177
  }
174
178
  updateRect();
175
179
  const observer = new ResizeObserver(updateRect);
176
- observer.observe(popout);
177
180
  observer.observe(anchorRef.current);
181
+ observer.observe(popoutRef.current);
178
182
  document.addEventListener("mousedown", onPointerDown);
179
183
  document.addEventListener("keydown", onKeyDown);
180
184
  window.addEventListener("resize", updateRect);
@@ -186,7 +190,7 @@ function PopoutContainer(props) {
186
190
  window.removeEventListener("resize", updateRect);
187
191
  window.removeEventListener("scroll", updateRect, true);
188
192
  };
189
- }, [open.value]);
193
+ }, [open, open.value, props.top, props.unlockedWidth]);
190
194
  return /* @__PURE__ */ jsxs("div", { ref: anchorRef, class: addClass(
191
195
  "popout-container",
192
196
  open.value && "open",
@@ -200,7 +204,6 @@ function PopoutContainer(props) {
200
204
  ref: popoutRef,
201
205
  class: addClass(
202
206
  "popout",
203
- MOBILE.value && "mobile-popout",
204
207
  props.popoutClass
205
208
  ),
206
209
  style: { visibility: "hidden" },
@@ -212,7 +215,8 @@ function PopoutContainer(props) {
212
215
  ] });
213
216
  }
214
217
  function PopoutTextButton(props) {
215
- const open = props.open ?? useSignal(false);
218
+ const localOpen = useSignal(false);
219
+ const open = props.open ?? localOpen;
216
220
  return /* @__PURE__ */ jsx4(PopoutContainer, { ...props, class: addClass(props.class, "popout-button"), open, children: /* @__PURE__ */ jsx4(
217
221
  TextButton,
218
222
  {
@@ -220,7 +224,6 @@ function PopoutTextButton(props) {
220
224
  onClick: () => open.value = !open.peek(),
221
225
  disabled: props.disabled,
222
226
  extraPadding: props.extraPadding,
223
- somePadding: props.somePadding,
224
227
  centered: props.centered,
225
228
  variant: props.variant,
226
229
  title: props.title,
@@ -229,7 +232,8 @@ function PopoutTextButton(props) {
229
232
  ) });
230
233
  }
231
234
  function PopoutIconButton(props) {
232
- const open = props.open ?? useSignal(false);
235
+ const localOpen = useSignal(false);
236
+ const open = props.open ?? localOpen;
233
237
  return /* @__PURE__ */ jsx4(PopoutContainer, { ...props, class: addClass(props.class, "popout-button"), open, children: /* @__PURE__ */ jsx4(
234
238
  IconButton,
235
239
  {
@@ -237,7 +241,6 @@ function PopoutIconButton(props) {
237
241
  onClick: () => open.value = !open.peek(),
238
242
  disabled: props.disabled,
239
243
  extraPadding: props.extraPadding,
240
- somePadding: props.somePadding,
241
244
  centered: props.centered,
242
245
  variant: props.variant,
243
246
  title: props.title,
@@ -246,7 +249,8 @@ function PopoutIconButton(props) {
246
249
  ) });
247
250
  }
248
251
  function PopoutTextIconButton(props) {
249
- const open = props.open ?? useSignal(false);
252
+ const localOpen = useSignal(false);
253
+ const open = props.open ?? localOpen;
250
254
  return /* @__PURE__ */ jsx4(PopoutContainer, { ...props, class: addClass(props.class, "popout-button"), open, children: /* @__PURE__ */ jsx4(
251
255
  TextIconButton,
252
256
  {
@@ -254,7 +258,6 @@ function PopoutTextIconButton(props) {
254
258
  onClick: () => open.value = !open.peek(),
255
259
  disabled: props.disabled,
256
260
  extraPadding: props.extraPadding,
257
- somePadding: props.somePadding,
258
261
  centered: props.centered,
259
262
  variant: props.variant,
260
263
  title: props.title,
@@ -456,17 +459,55 @@ function CalendarInput(props) {
456
459
  );
457
460
  }
458
461
 
459
- // src/components/ClickFade/ClickFade.tsx
462
+ // src/components/Checkbox/Checkbox.tsx
460
463
  import { useSignal as useSignal4 } from "@preact/signals";
464
+ import { useEffect as useEffect2 } from "preact/hooks";
465
+ import { Check } from "lucide-preact";
466
+ import { jsx as jsx7 } from "preact/jsx-runtime";
467
+ function Checkbox(props) {
468
+ const localValue = useSignal4(isSignal(props.value) ? props.value.peek() : props.value ?? false);
469
+ const value = isSignal(props.value) ? props.value : localValue;
470
+ useEffect2(() => {
471
+ if (!isSignal(props.value))
472
+ localValue.value = props.value ?? false;
473
+ }, [props.value]);
474
+ function commit(val) {
475
+ value.value = val;
476
+ if (props.dirty)
477
+ props.dirty.value = true;
478
+ props.onChange?.(val);
479
+ }
480
+ return /* @__PURE__ */ jsx7(
481
+ "button",
482
+ {
483
+ type: "button",
484
+ role: "checkbox",
485
+ "aria-checked": value.value,
486
+ class: addClass(
487
+ "checkbox",
488
+ props.class,
489
+ props.small && "small",
490
+ value.value && "checked"
491
+ ),
492
+ onClick: () => {
493
+ commit(!value.peek());
494
+ },
495
+ children: /* @__PURE__ */ jsx7(Check, { size: 14 })
496
+ }
497
+ );
498
+ }
499
+
500
+ // src/components/ClickFade/ClickFade.tsx
501
+ import { useSignal as useSignal5 } from "@preact/signals";
461
502
  import { jsxs as jsxs3 } from "preact/jsx-runtime";
462
503
  function ClickFade(props) {
463
504
  let faded;
464
505
  if (props.faded == null)
465
- faded = useSignal4(false);
506
+ faded = useSignal5(false);
466
507
  else if (isSignal(props.faded))
467
508
  faded = props.faded;
468
509
  else
469
- faded = useSignal4(props.faded);
510
+ faded = useSignal5(props.faded);
470
511
  return /* @__PURE__ */ jsxs3(
471
512
  "button",
472
513
  {
@@ -486,10 +527,282 @@ function ClickFade(props) {
486
527
  );
487
528
  }
488
529
 
530
+ // src/components/ColorPicker/ColorPicker.tsx
531
+ import { useSignal as useSignal6 } from "@preact/signals";
532
+ import { useEffect as useEffect3, useRef as useRef3 } from "preact/hooks";
533
+
534
+ // src/components/Text/Text.tsx
535
+ import { jsx as jsx8 } from "preact/jsx-runtime";
536
+ function Text(props) {
537
+ const content = resolveSignalish(props.content);
538
+ return content != null && /* @__PURE__ */ jsx8("span", { class: addClass(
539
+ "text",
540
+ props.big && "big",
541
+ props.extra_big && "extra-big",
542
+ props.dim && "dim",
543
+ props.dark && "dark",
544
+ props.selectable && "selectable",
545
+ props.class
546
+ ), children: content });
547
+ }
548
+
549
+ // src/components/ColorPicker/ColorPicker.tsx
550
+ import { jsx as jsx9, jsxs as jsxs4 } from "preact/jsx-runtime";
551
+ function parseHex(value) {
552
+ const match = value.trim().match(/^#?([\da-f]{3}|[\da-f]{6})$/i);
553
+ if (!match)
554
+ return null;
555
+ let hex = match[1];
556
+ if (hex.length === 3)
557
+ hex = [...hex].map((char) => char + char).join("");
558
+ return {
559
+ red: parseInt(hex.slice(0, 2), 16),
560
+ green: parseInt(hex.slice(2, 4), 16),
561
+ blue: parseInt(hex.slice(4, 6), 16)
562
+ };
563
+ }
564
+ function rgbToHsv({ red, green, blue }) {
565
+ const r = red / 255;
566
+ const g = green / 255;
567
+ const b = blue / 255;
568
+ const max = Math.max(r, g, b);
569
+ const min = Math.min(r, g, b);
570
+ const delta = max - min;
571
+ let hue = 0;
572
+ if (delta !== 0) {
573
+ if (max === r)
574
+ hue = 60 * ((g - b) / delta % 6);
575
+ else if (max === g)
576
+ hue = 60 * ((b - r) / delta + 2);
577
+ else
578
+ hue = 60 * ((r - g) / delta + 4);
579
+ }
580
+ return {
581
+ hue: (hue + 360) % 360,
582
+ saturation: max === 0 ? 0 : delta / max,
583
+ value: max
584
+ };
585
+ }
586
+ function hsvToHex({ hue, saturation, value }) {
587
+ const chroma = value * saturation;
588
+ const hueSection = (hue % 360 + 360) % 360 / 60;
589
+ const secondary = chroma * (1 - Math.abs(hueSection % 2 - 1));
590
+ const match = value - chroma;
591
+ let rgb;
592
+ if (hueSection < 1)
593
+ rgb = [chroma, secondary, 0];
594
+ else if (hueSection < 2)
595
+ rgb = [secondary, chroma, 0];
596
+ else if (hueSection < 3)
597
+ rgb = [0, chroma, secondary];
598
+ else if (hueSection < 4)
599
+ rgb = [0, secondary, chroma];
600
+ else if (hueSection < 5)
601
+ rgb = [secondary, 0, chroma];
602
+ else
603
+ rgb = [chroma, 0, secondary];
604
+ return `#${rgb.map((channel) => Math.round((channel + match) * 255).toString(16).padStart(2, "0")).join("")}`.toUpperCase();
605
+ }
606
+ function ColorPicker(props) {
607
+ const initialColor = props.value == null ? "#FF0000" : resolveSignalish(props.value);
608
+ const localColor = useSignal6(initialColor);
609
+ const color = isSignal(props.value) ? props.value : localColor;
610
+ const initialHSV = rgbToHsv(parseHex(initialColor) ?? { red: 255, green: 0, blue: 0 });
611
+ const hsv = useSignal6(initialHSV);
612
+ const hexDraft = useSignal6(initialColor);
613
+ const lastWrittenColor = useRef3(null);
614
+ const squareRef = useRef3(null);
615
+ const hueRef = useRef3(null);
616
+ useEffect3(() => {
617
+ if (!isSignal(props.value))
618
+ localColor.value = props.value ?? "#FF0000";
619
+ }, [props.value]);
620
+ useEffect3(() => {
621
+ const parsed = parseHex(color.value);
622
+ if (!parsed)
623
+ return;
624
+ const normalized = hsvToHex(rgbToHsv(parsed));
625
+ hexDraft.value = normalized;
626
+ if (lastWrittenColor.current === color.value) {
627
+ lastWrittenColor.current = null;
628
+ return;
629
+ }
630
+ hsv.value = rgbToHsv(parsed);
631
+ }, [color.value]);
632
+ function setColor(nextHSV) {
633
+ hsv.value = nextHSV;
634
+ const nextColor = hsvToHex(nextHSV);
635
+ hexDraft.value = nextColor;
636
+ lastWrittenColor.current = nextColor;
637
+ color.value = nextColor;
638
+ props.onChange?.(nextColor);
639
+ if (props.dirty)
640
+ props.dirty.value = true;
641
+ }
642
+ function updateSquareFromEvent(e) {
643
+ const square = squareRef.current;
644
+ if (!square)
645
+ return;
646
+ const rect = square.getBoundingClientRect();
647
+ setColor({
648
+ ...hsv.value,
649
+ saturation: Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width)),
650
+ value: 1 - Math.max(0, Math.min(1, (e.clientY - rect.top) / rect.height))
651
+ });
652
+ }
653
+ function updateHueFromEvent(e) {
654
+ const slider = hueRef.current;
655
+ if (!slider)
656
+ return;
657
+ const rect = slider.getBoundingClientRect();
658
+ setColor({
659
+ ...hsv.value,
660
+ hue: Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width)) * 360
661
+ });
662
+ }
663
+ function updateFromHex(value) {
664
+ hexDraft.value = value;
665
+ const parsed = parseHex(value);
666
+ if (!parsed)
667
+ return;
668
+ const nextColor = hsvToHex(rgbToHsv(parsed));
669
+ hsv.value = rgbToHsv(parsed);
670
+ lastWrittenColor.current = nextColor;
671
+ color.value = nextColor;
672
+ props.onChange?.(nextColor);
673
+ if (props.dirty)
674
+ props.dirty.value = true;
675
+ }
676
+ const hueColor = `hsl(${hsv.value.hue}, 100%, 50%)`;
677
+ return /* @__PURE__ */ jsxs4(
678
+ PopoutTextButton,
679
+ {
680
+ class: addClass("color-picker", props.class),
681
+ buttonClass: addClass("input", props.buttonClass),
682
+ disabled: props.disabled,
683
+ title: props.title,
684
+ unlockedWidth: true,
685
+ popoutClass: "color-picker-popout",
686
+ popout: () => /* @__PURE__ */ jsxs4(Container, { children: [
687
+ /* @__PURE__ */ jsx9(
688
+ Container,
689
+ {
690
+ class: "square",
691
+ other: {
692
+ ref: squareRef,
693
+ tabIndex: 0,
694
+ role: "group",
695
+ "aria-label": "Color saturation and brightness",
696
+ style: { backgroundColor: hueColor },
697
+ onPointerDown: (e) => {
698
+ e.currentTarget.setPointerCapture(e.pointerId);
699
+ updateSquareFromEvent(e);
700
+ },
701
+ onPointerMove: (e) => {
702
+ if (e.currentTarget.hasPointerCapture(e.pointerId))
703
+ updateSquareFromEvent(e);
704
+ },
705
+ onPointerUp: (e) => updateSquareFromEvent(e),
706
+ onKeyDown: (e) => {
707
+ const next = { ...hsv.value };
708
+ if (e.key === "ArrowLeft")
709
+ next.saturation -= 0.01;
710
+ else if (e.key === "ArrowRight")
711
+ next.saturation += 0.01;
712
+ else if (e.key === "ArrowUp")
713
+ next.value += 0.01;
714
+ else if (e.key === "ArrowDown")
715
+ next.value -= 0.01;
716
+ else
717
+ return;
718
+ e.preventDefault();
719
+ setColor({
720
+ ...next,
721
+ saturation: Math.max(0, Math.min(1, next.saturation)),
722
+ value: Math.max(0, Math.min(1, next.value))
723
+ });
724
+ }
725
+ },
726
+ children: /* @__PURE__ */ jsx9(Container, { other: {
727
+ style: {
728
+ left: `${hsv.value.saturation * 100}%`,
729
+ top: `${(1 - hsv.value.value) * 100}%`,
730
+ backgroundColor: color.value
731
+ }
732
+ } })
733
+ }
734
+ ),
735
+ /* @__PURE__ */ jsx9(
736
+ Container,
737
+ {
738
+ class: "hue",
739
+ other: {
740
+ ref: hueRef,
741
+ tabIndex: 0,
742
+ role: "slider",
743
+ "aria-label": "Hue",
744
+ "aria-valuemin": 0,
745
+ "aria-valuemax": 360,
746
+ "aria-valuenow": hsv.value.hue,
747
+ onPointerDown: (e) => {
748
+ e.currentTarget.setPointerCapture(e.pointerId);
749
+ updateHueFromEvent(e);
750
+ },
751
+ onPointerMove: (e) => {
752
+ if (e.currentTarget.hasPointerCapture(e.pointerId))
753
+ updateHueFromEvent(e);
754
+ },
755
+ onPointerUp: (e) => updateHueFromEvent(e),
756
+ onKeyDown: (e) => {
757
+ if (e.key !== "ArrowLeft" && e.key !== "ArrowRight")
758
+ return;
759
+ e.preventDefault();
760
+ setColor({
761
+ ...hsv.value,
762
+ hue: (hsv.value.hue + (e.key === "ArrowRight" ? 1 : 359)) % 360
763
+ });
764
+ }
765
+ },
766
+ children: /* @__PURE__ */ jsx9(Container, { other: {
767
+ style: {
768
+ left: `${hsv.value.hue / 360 * 100}%`,
769
+ backgroundColor: hueColor
770
+ }
771
+ } })
772
+ }
773
+ ),
774
+ /* @__PURE__ */ jsxs4(Container, { class: "hex-row", horizontal: true, centered_y: true, children: [
775
+ /* @__PURE__ */ jsx9(Container, { other: { style: { backgroundColor: color.value } } }),
776
+ /* @__PURE__ */ jsx9(
777
+ Input,
778
+ {
779
+ value: hexDraft,
780
+ placeholder: "#RRGGBB",
781
+ onInput: updateFromHex,
782
+ onUnFocus: () => {
783
+ if (!parseHex(hexDraft.value))
784
+ hexDraft.value = color.value;
785
+ }
786
+ }
787
+ )
788
+ ] })
789
+ ] }),
790
+ children: [
791
+ /* @__PURE__ */ jsx9(Container, { other: {
792
+ style: {
793
+ backgroundColor: color.value
794
+ }
795
+ } }),
796
+ /* @__PURE__ */ jsx9(Text, { content: color.value.toUpperCase() })
797
+ ]
798
+ }
799
+ );
800
+ }
801
+
489
802
  // src/components/Conditional.tsx
490
803
  import { createContext } from "preact";
491
804
  import { useContext } from "preact/hooks";
492
- import { jsx as jsx7 } from "preact/jsx-runtime";
805
+ import { jsx as jsx10 } from "preact/jsx-runtime";
493
806
  function If(props) {
494
807
  if (resolveSignalish(resolveMaybeFunc(props.cond)))
495
808
  return resolveMaybeFunc(props.children);
@@ -497,7 +810,7 @@ function If(props) {
497
810
  }
498
811
  var SwitchValue = createContext(null);
499
812
  function Switch(props) {
500
- return /* @__PURE__ */ jsx7(SwitchValue.Provider, { value: resolveSignalish(resolveMaybeFunc(props.value)), children: props.children });
813
+ return /* @__PURE__ */ jsx10(SwitchValue.Provider, { value: resolveSignalish(resolveMaybeFunc(props.value)), children: props.children });
501
814
  }
502
815
  function Case(props) {
503
816
  const value = useContext(SwitchValue);
@@ -507,7 +820,7 @@ function Case(props) {
507
820
  }
508
821
  var BranchValue = createContext(false);
509
822
  function Branch(props) {
510
- return /* @__PURE__ */ jsx7(BranchValue.Provider, { value: !!resolveSignalish(resolveMaybeFunc(props.cond)), children: props.children });
823
+ return /* @__PURE__ */ jsx10(BranchValue.Provider, { value: !!resolveSignalish(resolveMaybeFunc(props.cond)), children: props.children });
511
824
  }
512
825
  function Then(props) {
513
826
  const value = useContext(BranchValue);
@@ -523,34 +836,19 @@ function Else(props) {
523
836
  }
524
837
 
525
838
  // src/components/Content/Content.tsx
526
- import { jsx as jsx8 } from "preact/jsx-runtime";
839
+ import { jsx as jsx11 } from "preact/jsx-runtime";
527
840
  function Content(props) {
528
- return /* @__PURE__ */ jsx8("main", { class: addClass(
841
+ return /* @__PURE__ */ jsx11("main", { class: addClass(
529
842
  props.class && `content-${props.class}`,
530
843
  props.wrapped && "wrapped",
531
844
  props.centered && "centered"
532
- ), children: props.wrapped ? /* @__PURE__ */ jsx8("div", { children: props.children }) : props.children });
845
+ ), children: props.wrapped ? /* @__PURE__ */ jsx11("div", { children: props.children }) : props.children });
533
846
  }
534
847
 
535
848
  // src/components/ContextMenu/ContextMenu.tsx
536
849
  import { render } from "preact";
537
850
  import { createPortal as createPortal2 } from "preact/compat";
538
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef3 } from "preact/hooks";
539
-
540
- // src/components/Text/Text.tsx
541
- import { jsx as jsx9 } from "preact/jsx-runtime";
542
- function Text(props) {
543
- const content = resolveSignalish(props.content);
544
- return content != null && /* @__PURE__ */ jsx9("span", { class: addClass(
545
- "text",
546
- props.big && "big",
547
- props.extra_big && "extra-big",
548
- props.dim && "dim",
549
- props.dark && "dark",
550
- props.selectable && "selectable",
551
- props.class
552
- ), children: content });
553
- }
851
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "preact/hooks";
554
852
 
555
853
  // src/components/ContextMenu/position.ts
556
854
  function getContextMenuPlacement(target, size, viewport) {
@@ -586,7 +884,7 @@ function getContextMenuPlacement(target, size, viewport) {
586
884
  }
587
885
 
588
886
  // src/components/ContextMenu/ContextMenu.tsx
589
- import { jsx as jsx10, jsxs as jsxs4 } from "preact/jsx-runtime";
887
+ import { jsx as jsx12, jsxs as jsxs5 } from "preact/jsx-runtime";
590
888
  var currentMenu;
591
889
  var pointerPosition;
592
890
  if (typeof window !== "undefined") {
@@ -621,7 +919,7 @@ function openMenu(items, target) {
621
919
  };
622
920
  currentMenu = menu;
623
921
  document.body.appendChild(menu.host);
624
- render(/* @__PURE__ */ jsx10(ContextMenu, { items, target, instance: menu }), menu.host);
922
+ render(/* @__PURE__ */ jsx12(ContextMenu, { items, target, instance: menu }), menu.host);
625
923
  }
626
924
  function openContextMenu(items, position) {
627
925
  if (position && "preventDefault" in position)
@@ -633,7 +931,7 @@ function openContextMenuOn(items, element) {
633
931
  openMenu(items, element);
634
932
  }
635
933
  function ContextMenu(props) {
636
- const menuRef = useRef3(null);
934
+ const menuRef = useRef4(null);
637
935
  useLayoutEffect2(() => {
638
936
  const menu = menuRef.current;
639
937
  const anchor = props.target instanceof Element ? props.target : void 0;
@@ -728,7 +1026,7 @@ function ContextMenu(props) {
728
1026
  };
729
1027
  }, []);
730
1028
  return createPortal2(
731
- /* @__PURE__ */ jsx10(
1029
+ /* @__PURE__ */ jsx12(
732
1030
  Container,
733
1031
  {
734
1032
  class: "context-menu popout",
@@ -740,7 +1038,7 @@ function ContextMenu(props) {
740
1038
  tabIndex: -1,
741
1039
  onContextMenu: (event) => event.preventDefault()
742
1040
  },
743
- children: props.items.map((item, index) => /* @__PURE__ */ jsx10(ContextMenuItemView, { item, instance: props.instance }, index))
1041
+ children: props.items.map((item, index) => /* @__PURE__ */ jsx12(ContextMenuItemView, { item, instance: props.instance }, index))
744
1042
  }
745
1043
  ),
746
1044
  document.body
@@ -748,13 +1046,13 @@ function ContextMenu(props) {
748
1046
  }
749
1047
  function ContextMenuItemView({ item, instance }) {
750
1048
  if (item === "---" || typeof item !== "string" && item.type === "separator")
751
- return /* @__PURE__ */ jsx10("div", { class: "context-menu-separator", role: "separator" });
1049
+ return /* @__PURE__ */ jsx12("div", { class: "context-menu-separator", role: "separator" });
752
1050
  if (typeof item === "string" || item.type === "header") {
753
1051
  const label = typeof item === "string" ? item : item.label;
754
- return /* @__PURE__ */ jsx10(Container, { class: "context-menu-header", other: { role: "presentation" }, children: renderLabel(label, true) });
1052
+ return /* @__PURE__ */ jsx12(Container, { class: "context-menu-header", other: { role: "presentation" }, children: renderLabel(label, true) });
755
1053
  }
756
1054
  const MenuButton = "href" in item ? item.icon ? TextIconLinkButton : TextLinkButton : item.icon ? TextIconButton : TextButton;
757
- return /* @__PURE__ */ jsxs4(
1055
+ return /* @__PURE__ */ jsxs5(
758
1056
  MenuButton,
759
1057
  {
760
1058
  role: "menuitem",
@@ -775,13 +1073,13 @@ function ContextMenuItemView({ item, instance }) {
775
1073
  );
776
1074
  }
777
1075
  function renderLabel(label, dim = false) {
778
- return typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ jsx10(Text, { content: label, dim }) : label;
1076
+ return typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ jsx12(Text, { content: label, dim }) : label;
779
1077
  }
780
1078
 
781
1079
  // src/components/DotSeperator/DotSeperator.tsx
782
- import { jsx as jsx11 } from "preact/jsx-runtime";
1080
+ import { jsx as jsx13 } from "preact/jsx-runtime";
783
1081
  function DotSeperator(props) {
784
- return /* @__PURE__ */ jsx11("span", { class: addClass(
1082
+ return /* @__PURE__ */ jsx13("span", { class: addClass(
785
1083
  "dot-seperator",
786
1084
  props.noMargin && "no-margin",
787
1085
  props.containerTextMargin && "container-text-margin"
@@ -808,7 +1106,7 @@ import {
808
1106
  Binary,
809
1107
  FileQuestion
810
1108
  } from "lucide-preact";
811
- import { jsx as jsx12 } from "preact/jsx-runtime";
1109
+ import { jsx as jsx14 } from "preact/jsx-runtime";
812
1110
  function getFileIcon(category) {
813
1111
  switch (category) {
814
1112
  case "directory":
@@ -849,38 +1147,38 @@ function getFileIcon(category) {
849
1147
  }
850
1148
  function FileIcon(props) {
851
1149
  const Icon = getFileIcon(props.category);
852
- return /* @__PURE__ */ jsx12(Icon, { size: props.size });
1150
+ return /* @__PURE__ */ jsx14(Icon, { size: props.size });
853
1151
  }
854
1152
 
855
1153
  // src/components/FilePath.tsx
856
- import { Fragment, jsx as jsx13, jsxs as jsxs5 } from "preact/jsx-runtime";
1154
+ import { Fragment, jsx as jsx15, jsxs as jsxs6 } from "preact/jsx-runtime";
857
1155
  function FilePath(props) {
858
1156
  const parts = splitFilePath(props.path);
859
- return /* @__PURE__ */ jsxs5(Fragment, { children: [
860
- /* @__PURE__ */ jsx13(Text, { content: parts[0] + parts[1] }),
861
- parts[2] && /* @__PURE__ */ jsx13(Text, { class: "type", dim: true, content: "." + parts[2] })
1157
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
1158
+ /* @__PURE__ */ jsx15(Text, { content: parts[0] + parts[1] }),
1159
+ parts[2] && /* @__PURE__ */ jsx15(Text, { class: "type", dim: true, content: "." + parts[2] })
862
1160
  ] });
863
1161
  }
864
1162
 
865
1163
  // src/components/Label/Label.tsx
866
- import { jsx as jsx14 } from "preact/jsx-runtime";
1164
+ import { jsx as jsx16 } from "preact/jsx-runtime";
867
1165
  function Label(props) {
868
- return /* @__PURE__ */ jsx14("span", { class: "label", children: props.text });
1166
+ return /* @__PURE__ */ jsx16("span", { class: "label", children: props.text });
869
1167
  }
870
1168
 
871
1169
  // src/components/FormalInput/FormalInput.tsx
872
- import { jsx as jsx15, jsxs as jsxs6 } from "preact/jsx-runtime";
1170
+ import { jsx as jsx17, jsxs as jsxs7 } from "preact/jsx-runtime";
873
1171
  function FormalInput(props) {
874
- return /* @__PURE__ */ jsxs6(Container, { class: "formal-input", children: [
875
- /* @__PURE__ */ jsx15(Label, { text: props.label }),
1172
+ return /* @__PURE__ */ jsxs7(Container, { class: "formal-input", children: [
1173
+ /* @__PURE__ */ jsx17(Label, { text: props.label }),
876
1174
  props.children
877
1175
  ] });
878
1176
  }
879
1177
 
880
1178
  // src/components/Header/Header.tsx
881
- import { jsx as jsx16 } from "preact/jsx-runtime";
1179
+ import { jsx as jsx18 } from "preact/jsx-runtime";
882
1180
  function Header1(props) {
883
- return /* @__PURE__ */ jsx16(
1181
+ return /* @__PURE__ */ jsx18(
884
1182
  "h1",
885
1183
  {
886
1184
  class: addClass(
@@ -893,7 +1191,7 @@ function Header1(props) {
893
1191
  );
894
1192
  }
895
1193
  function Header2(props) {
896
- return /* @__PURE__ */ jsx16(
1194
+ return /* @__PURE__ */ jsx18(
897
1195
  "h2",
898
1196
  {
899
1197
  class: addClass(
@@ -906,7 +1204,7 @@ function Header2(props) {
906
1204
  );
907
1205
  }
908
1206
  function Header3(props) {
909
- return /* @__PURE__ */ jsx16(
1207
+ return /* @__PURE__ */ jsx18(
910
1208
  "h3",
911
1209
  {
912
1210
  class: addClass(
@@ -919,7 +1217,7 @@ function Header3(props) {
919
1217
  );
920
1218
  }
921
1219
  function MiniHeader(props) {
922
- return /* @__PURE__ */ jsx16(
1220
+ return /* @__PURE__ */ jsx18(
923
1221
  "h6",
924
1222
  {
925
1223
  class: addClass(
@@ -934,27 +1232,21 @@ function MiniHeader(props) {
934
1232
  }
935
1233
 
936
1234
  // src/components/Image/Image.tsx
937
- import { useEffect as useEffect2, useRef as useRef4, useState as useState2 } from "preact/hooks";
938
- import { jsx as jsx17 } from "preact/jsx-runtime";
1235
+ import { useEffect as useEffect4, useState as useState2 } from "preact/hooks";
1236
+ import { jsx as jsx19 } from "preact/jsx-runtime";
939
1237
  function Image2(props) {
940
1238
  const [src, setSrc] = useState2();
941
- const lastSrc = useRef4();
942
- useEffect2(() => {
943
- if (lastSrc.current)
944
- URL.revokeObjectURL(lastSrc.current);
945
- const newSrc = resolveSignalish(props.src);
946
- if (newSrc == null)
1239
+ const newSrc = resolveSignalish(props.src);
1240
+ useEffect4(() => {
1241
+ if (newSrc == null || typeof newSrc == "string") {
1242
+ setSrc(newSrc ?? void 0);
947
1243
  return;
948
- if (typeof newSrc == "string") {
949
- setSrc(newSrc);
950
- lastSrc.current = newSrc;
951
- } else {
952
- const newObjectURL = URL.createObjectURL(newSrc);
953
- setSrc(newObjectURL);
954
- lastSrc.current = newObjectURL;
955
1244
  }
956
- }, [props.src]);
957
- return /* @__PURE__ */ jsx17(
1245
+ const url = URL.createObjectURL(newSrc);
1246
+ setSrc(url);
1247
+ return () => URL.revokeObjectURL(url);
1248
+ }, [props.src, newSrc]);
1249
+ return /* @__PURE__ */ jsx19(
958
1250
  "img",
959
1251
  {
960
1252
  src,
@@ -968,7 +1260,8 @@ function Image2(props) {
968
1260
  props.max_size != null && {
969
1261
  maxWidth: props.max_size + "px",
970
1262
  maxHeight: props.max_size + "px"
971
- }
1263
+ },
1264
+ props.style
972
1265
  )
973
1266
  }
974
1267
  );
@@ -976,19 +1269,19 @@ function Image2(props) {
976
1269
 
977
1270
  // src/components/ImageInput/ImageInput.tsx
978
1271
  import { useRef as useRef5 } from "preact/hooks";
979
- import { useSignal as useSignal5 } from "@preact/signals";
1272
+ import { useSignal as useSignal7 } from "@preact/signals";
980
1273
  import { CloudUpload } from "lucide-preact";
981
- import { jsx as jsx18, jsxs as jsxs7 } from "preact/jsx-runtime";
1274
+ import { jsx as jsx20, jsxs as jsxs8 } from "preact/jsx-runtime";
982
1275
  function ImageInput(props) {
983
1276
  const inputRef = useRef5();
984
1277
  let value;
985
1278
  if (props.value == null)
986
- value = useSignal5(null);
1279
+ value = useSignal7(null);
987
1280
  else if (isSignal(props.value))
988
1281
  value = props.value;
989
1282
  else
990
- value = useSignal5(props.value);
991
- return /* @__PURE__ */ jsxs7(
1283
+ value = useSignal7(props.value);
1284
+ return /* @__PURE__ */ jsxs8(
992
1285
  "div",
993
1286
  {
994
1287
  class: addClass(
@@ -1004,7 +1297,7 @@ function ImageInput(props) {
1004
1297
  inputRef.current?.click();
1005
1298
  },
1006
1299
  children: [
1007
- /* @__PURE__ */ jsx18(
1300
+ /* @__PURE__ */ jsx20(
1008
1301
  "input",
1009
1302
  {
1010
1303
  ref: inputRef,
@@ -1020,15 +1313,15 @@ function ImageInput(props) {
1020
1313
  }
1021
1314
  }
1022
1315
  ),
1023
- /* @__PURE__ */ jsxs7(Branch, { cond: value, children: [
1024
- /* @__PURE__ */ jsx18(Then, { children: () => /* @__PURE__ */ jsx18(
1316
+ /* @__PURE__ */ jsxs8(Branch, { cond: value, children: [
1317
+ /* @__PURE__ */ jsx20(Then, { children: () => /* @__PURE__ */ jsx20(
1025
1318
  Image2,
1026
1319
  {
1027
1320
  src: value,
1028
1321
  class: "preview"
1029
1322
  }
1030
1323
  ) }),
1031
- /* @__PURE__ */ jsx18(Else, { children: props.children ?? /* @__PURE__ */ jsx18(CloudUpload, { size: 16 }) })
1324
+ /* @__PURE__ */ jsx20(Else, { children: props.children ?? /* @__PURE__ */ jsx20(CloudUpload, { size: 16 }) })
1032
1325
  ] })
1033
1326
  ]
1034
1327
  }
@@ -1036,19 +1329,19 @@ function ImageInput(props) {
1036
1329
  }
1037
1330
 
1038
1331
  // src/components/Input/Textarea.tsx
1039
- import { useSignal as useSignal6 } from "@preact/signals";
1332
+ import { useSignal as useSignal8 } from "@preact/signals";
1040
1333
  import { useRef as useRef6 } from "preact/hooks";
1041
- import { jsx as jsx19 } from "preact/jsx-runtime";
1334
+ import { jsx as jsx21 } from "preact/jsx-runtime";
1042
1335
  function Textarea(props) {
1043
1336
  const inputRef = useRef6();
1044
1337
  let value;
1045
1338
  if (props.value == null)
1046
- value = useSignal6("");
1339
+ value = useSignal8("");
1047
1340
  else if (isSignal(props.value))
1048
1341
  value = props.value;
1049
1342
  else
1050
- value = useSignal6(props.value);
1051
- return /* @__PURE__ */ jsx19(
1343
+ value = useSignal8(props.value);
1344
+ return /* @__PURE__ */ jsx21(
1052
1345
  "textarea",
1053
1346
  {
1054
1347
  class: addClass(
@@ -1069,17 +1362,17 @@ function Textarea(props) {
1069
1362
  }
1070
1363
 
1071
1364
  // src/components/Loading/Loading.tsx
1072
- import { useEffect as useEffect3, useState as useState3 } from "preact/hooks";
1365
+ import { useEffect as useEffect5, useState as useState3 } from "preact/hooks";
1073
1366
 
1074
1367
  // src/components/Throbber/Throbber.tsx
1075
1368
  import { Loader2 } from "lucide-preact";
1076
- import { jsx as jsx20 } from "preact/jsx-runtime";
1369
+ import { jsx as jsx22 } from "preact/jsx-runtime";
1077
1370
  function Throbber(props) {
1078
- return /* @__PURE__ */ jsx20("span", { class: "throbber", children: /* @__PURE__ */ jsx20(Loader2, { size: props.size }) });
1371
+ return /* @__PURE__ */ jsx22("span", { class: "throbber", children: /* @__PURE__ */ jsx22(Loader2, { size: props.size }) });
1079
1372
  }
1080
1373
 
1081
1374
  // src/components/Loading/Loading.tsx
1082
- import { jsx as jsx21, jsxs as jsxs8 } from "preact/jsx-runtime";
1375
+ import { jsx as jsx23, jsxs as jsxs9 } from "preact/jsx-runtime";
1083
1376
  function Loading(props) {
1084
1377
  const [loaded, setLoaded] = useState3(false);
1085
1378
  {
@@ -1088,36 +1381,80 @@ function Loading(props) {
1088
1381
  setLoaded(resolveSignalish(out));
1089
1382
  }
1090
1383
  }
1091
- useEffect3(syncWrap(async () => {
1384
+ useEffect5(syncWrap(async () => {
1092
1385
  let data = resolveSignalish(await resolveMaybeAsyncFunc(props.loaded));
1093
1386
  setLoaded(data);
1094
1387
  }), [props.loaded]);
1095
- return loaded ? resolveMaybeFunc(props.children ?? null) : /* @__PURE__ */ jsxs8("div", { class: addClass("loading", props.class), children: [
1096
- /* @__PURE__ */ jsx21(Throbber, { size: props.throbber_size }),
1097
- loaded && /* @__PURE__ */ jsx21("p", { children: loaded })
1388
+ return loaded ? resolveMaybeFunc(props.children ?? null) : /* @__PURE__ */ jsxs9("div", { class: addClass("loading", props.class), children: [
1389
+ /* @__PURE__ */ jsx23(Throbber, { size: props.throbber_size }),
1390
+ loaded && /* @__PURE__ */ jsx23("p", { children: loaded })
1098
1391
  ] });
1099
1392
  }
1100
1393
 
1394
+ // src/components/Modal/Modal.tsx
1395
+ import { createPortal as createPortal3 } from "preact/compat";
1396
+ import { signal } from "@preact/signals";
1397
+ import { jsx as jsx24 } from "preact/jsx-runtime";
1398
+ var modal = signal(null);
1399
+ function showModal(content, options = {}) {
1400
+ const nextModal = {
1401
+ content,
1402
+ closeOnBackdrop: options.closeOnBackdrop ?? true,
1403
+ data: options.data
1404
+ };
1405
+ modal.value = nextModal;
1406
+ return {
1407
+ close() {
1408
+ if (modal.peek() === nextModal)
1409
+ closeModal();
1410
+ }
1411
+ };
1412
+ }
1413
+ function closeModal() {
1414
+ modal.value = null;
1415
+ }
1416
+ function ModalHost() {
1417
+ if (modal.value == null) {
1418
+ return null;
1419
+ }
1420
+ const Comp = modal.value.content;
1421
+ return createPortal3(
1422
+ /* @__PURE__ */ jsx24(
1423
+ "div",
1424
+ {
1425
+ class: "modal-container",
1426
+ onClick: (event) => {
1427
+ if (modal.value?.closeOnBackdrop && event.target === event.currentTarget) {
1428
+ closeModal();
1429
+ }
1430
+ },
1431
+ children: /* @__PURE__ */ jsx24(Comp, { data: modal.value?.data })
1432
+ }
1433
+ ),
1434
+ document.body
1435
+ );
1436
+ }
1437
+
1101
1438
  // src/components/PathInput/PathInput.tsx
1102
- import { useSignal as useSignal7 } from "@preact/signals";
1439
+ import { useSignal as useSignal9 } from "@preact/signals";
1103
1440
  import { Fragment as Fragment2 } from "preact";
1104
- import { useEffect as useEffect4, useRef as useRef7 } from "preact/hooks";
1441
+ import { useEffect as useEffect6, useRef as useRef7 } from "preact/hooks";
1105
1442
  import { ChevronRight as ChevronRight2 } from "lucide-preact";
1106
- import { jsx as jsx22, jsxs as jsxs9 } from "preact/jsx-runtime";
1443
+ import { jsx as jsx25, jsxs as jsxs10 } from "preact/jsx-runtime";
1107
1444
  function PathInput(props) {
1108
1445
  let parts;
1109
1446
  if (props.value == null)
1110
- parts = useSignal7(["~", "Documents", "Projects"]);
1447
+ parts = useSignal9(["~", "Documents", "Projects"]);
1111
1448
  else if (isSignal(props.value))
1112
- parts = useSignal7(splitPath(props.value.peek()));
1449
+ parts = useSignal9(splitPath(props.value.peek()));
1113
1450
  else
1114
- parts = useSignal7(splitPath(props.value));
1451
+ parts = useSignal9(splitPath(props.value));
1115
1452
  let combined;
1116
1453
  if (isSignal(props.value))
1117
1454
  combined = props.value;
1118
1455
  else
1119
- combined = useSignal7(joinPathParts(parts.peek()));
1120
- const editing = props.editing ?? useSignal7(false);
1456
+ combined = useSignal9(joinPathParts(parts.peek()));
1457
+ const editing = props.editing ?? useSignal9(false);
1121
1458
  const inputRef = useRef7(null);
1122
1459
  const pathRef = useRef7(null);
1123
1460
  function commit(newParts) {
@@ -1132,13 +1469,13 @@ function PathInput(props) {
1132
1469
  const end = combined.peek().length;
1133
1470
  inputRef.current?.setSelectionRange(end, end);
1134
1471
  }
1135
- useEffect4(() => {
1472
+ useEffect6(() => {
1136
1473
  if (!isSignal(props.value)) return;
1137
1474
  return props.value.subscribe((val) => {
1138
1475
  if (!editing.peek()) parts.value = splitPath(val);
1139
1476
  });
1140
1477
  }, [props.value]);
1141
- useEffect4(() => {
1478
+ useEffect6(() => {
1142
1479
  const el = pathRef.current;
1143
1480
  if (!el) return;
1144
1481
  requestAnimationFrame(() => {
@@ -1148,13 +1485,13 @@ function PathInput(props) {
1148
1485
  });
1149
1486
  });
1150
1487
  }, [parts.value]);
1151
- return /* @__PURE__ */ jsx22(Container, { horizontal: true, class: "path-input", children: /* @__PURE__ */ jsx22(
1488
+ return /* @__PURE__ */ jsx25(Container, { horizontal: true, class: "path-input", children: /* @__PURE__ */ jsx25(
1152
1489
  ClickFade,
1153
1490
  {
1154
1491
  faded: editing,
1155
1492
  onFade: focus,
1156
- before: /* @__PURE__ */ jsx22(Container, { horizontal: true, class: "input", centered_y: true, other: { ref: pathRef }, children: parts.value.map((p, i) => /* @__PURE__ */ jsxs9(Fragment2, { children: [
1157
- /* @__PURE__ */ jsx22(
1493
+ before: /* @__PURE__ */ jsx25(Container, { horizontal: true, class: "input", centered_y: true, other: { ref: pathRef }, children: parts.value.map((p, i) => /* @__PURE__ */ jsxs10(Fragment2, { children: [
1494
+ /* @__PURE__ */ jsx25(
1158
1495
  Button,
1159
1496
  {
1160
1497
  variant: "always-transparent",
@@ -1162,7 +1499,7 @@ function PathInput(props) {
1162
1499
  e.stopImmediatePropagation();
1163
1500
  commit(parts.peek().slice(0, i + 1));
1164
1501
  },
1165
- children: /* @__PURE__ */ jsx22(
1502
+ children: /* @__PURE__ */ jsx25(
1166
1503
  Text,
1167
1504
  {
1168
1505
  content: p
@@ -1170,9 +1507,9 @@ function PathInput(props) {
1170
1507
  )
1171
1508
  }
1172
1509
  ),
1173
- /* @__PURE__ */ jsx22(If, { cond: i < parts.value.length - 1, children: /* @__PURE__ */ jsx22(ChevronRight2, { size: 12 }) })
1510
+ /* @__PURE__ */ jsx25(If, { cond: i < parts.value.length - 1, children: /* @__PURE__ */ jsx25(ChevronRight2, { size: 12 }) })
1174
1511
  ] }, i)) }),
1175
- after: /* @__PURE__ */ jsx22(
1512
+ after: /* @__PURE__ */ jsx25(
1176
1513
  Input,
1177
1514
  {
1178
1515
  inputRef,
@@ -1194,18 +1531,18 @@ function PathInput(props) {
1194
1531
  }
1195
1532
 
1196
1533
  // src/components/SelectBox/SelectBox.tsx
1197
- import { useSignal as useSignal8 } from "@preact/signals";
1534
+ import { useSignal as useSignal10 } from "@preact/signals";
1198
1535
  import { ChevronDown } from "lucide-preact";
1199
- import { jsx as jsx23, jsxs as jsxs10 } from "preact/jsx-runtime";
1536
+ import { jsx as jsx26, jsxs as jsxs11 } from "preact/jsx-runtime";
1200
1537
  function SelectBox(props) {
1201
1538
  let value;
1202
1539
  if (props.value == null)
1203
- value = useSignal8(null);
1540
+ value = useSignal10(null);
1204
1541
  else if (isSignal(props.value))
1205
1542
  value = props.value;
1206
1543
  else
1207
- value = useSignal8(props.value);
1208
- const popoutOpen = useSignal8(false);
1544
+ value = useSignal10(props.value);
1545
+ const popoutOpen = useSignal10(false);
1209
1546
  const temp_options = resolveSignalish(props.options);
1210
1547
  const options = isMaybeLoaded(temp_options) ? maybeLoadedIsLoaded(temp_options) ? maybeLoadedUnwrap(temp_options) : null : temp_options;
1211
1548
  const selected = options != null ? options.find(
@@ -1218,7 +1555,7 @@ function SelectBox(props) {
1218
1555
  props.dirty.value = true;
1219
1556
  popoutOpen.value = false;
1220
1557
  }
1221
- return /* @__PURE__ */ jsxs10(
1558
+ return /* @__PURE__ */ jsxs11(
1222
1559
  PopoutTextButton,
1223
1560
  {
1224
1561
  class: addClass(
@@ -1229,7 +1566,7 @@ function SelectBox(props) {
1229
1566
  buttonClass: "input",
1230
1567
  open: popoutOpen,
1231
1568
  popoutClass: "select-box-popout",
1232
- popout: () => /* @__PURE__ */ jsx23(Container, { children: /* @__PURE__ */ jsx23(Loading, { loaded: options != null, throbber_size: 15, children: () => options.map((option) => /* @__PURE__ */ jsx23(
1569
+ popout: () => /* @__PURE__ */ jsx26(Container, { children: /* @__PURE__ */ jsx26(Loading, { loaded: options != null, throbber_size: 15, children: () => options.map((option) => /* @__PURE__ */ jsx26(
1233
1570
  TextButton,
1234
1571
  {
1235
1572
  class: addClass(
@@ -1240,38 +1577,38 @@ function SelectBox(props) {
1240
1577
  }
1241
1578
  )) }) }),
1242
1579
  children: [
1243
- /* @__PURE__ */ jsx23("span", { class: addClass(
1580
+ /* @__PURE__ */ jsx26("span", { class: addClass(
1244
1581
  selected == null && "default"
1245
1582
  ), children: selected?.label ?? "Select..." }),
1246
- /* @__PURE__ */ jsx23(ChevronDown, { size: 15 })
1583
+ /* @__PURE__ */ jsx26(ChevronDown, { size: 15 })
1247
1584
  ]
1248
1585
  }
1249
1586
  );
1250
1587
  }
1251
1588
 
1252
1589
  // src/components/Seperator/Seperator.tsx
1253
- import { jsx as jsx24 } from "preact/jsx-runtime";
1590
+ import { jsx as jsx27 } from "preact/jsx-runtime";
1254
1591
  function Seperator() {
1255
- return /* @__PURE__ */ jsx24("div", { class: "seperator" });
1592
+ return /* @__PURE__ */ jsx27("div", { class: "seperator" });
1256
1593
  }
1257
1594
 
1258
1595
  // src/components/Slider/Slider.tsx
1259
- import { useSignal as useSignal9 } from "@preact/signals";
1260
- import { useEffect as useEffect5, useRef as useRef8 } from "preact/hooks";
1261
- import { jsx as jsx25, jsxs as jsxs11 } from "preact/jsx-runtime";
1596
+ import { useSignal as useSignal11 } from "@preact/signals";
1597
+ import { useEffect as useEffect7, useRef as useRef8 } from "preact/hooks";
1598
+ import { jsx as jsx28, jsxs as jsxs12 } from "preact/jsx-runtime";
1262
1599
  function Slider(props) {
1263
1600
  let start = props.start ?? 0;
1264
1601
  let end = props.end ?? 1;
1265
1602
  let value;
1266
1603
  if (props.value == null)
1267
- value = useSignal9(0);
1604
+ value = useSignal11(0);
1268
1605
  else if (isSignal(props.value))
1269
1606
  value = props.value;
1270
1607
  else
1271
- value = useSignal9(props.value);
1608
+ value = useSignal11(props.value);
1272
1609
  const ref = useRef8(null);
1273
- const dragging = props.dragging ?? useSignal9(false);
1274
- useEffect5(() => {
1610
+ const dragging = props.dragging ?? useSignal11(false);
1611
+ useEffect7(() => {
1275
1612
  dragging.subscribe((d) => {
1276
1613
  if (d)
1277
1614
  document.addEventListener("pointermove", updateFromEvent);
@@ -1300,7 +1637,7 @@ function Slider(props) {
1300
1637
  update(progress * (end - start) + start);
1301
1638
  }
1302
1639
  let percentValue = (value.value - start) / (end - start);
1303
- return /* @__PURE__ */ jsx25(
1640
+ return /* @__PURE__ */ jsx28(
1304
1641
  "div",
1305
1642
  {
1306
1643
  ref,
@@ -1323,8 +1660,8 @@ function Slider(props) {
1323
1660
  const direction = Math.sign(e.deltaY);
1324
1661
  update(value.value - direction * step * (props.scroll_speed ?? 1));
1325
1662
  },
1326
- children: /* @__PURE__ */ jsxs11("div", { children: [
1327
- /* @__PURE__ */ jsx25(
1663
+ children: /* @__PURE__ */ jsxs12("div", { children: [
1664
+ /* @__PURE__ */ jsx28(
1328
1665
  "div",
1329
1666
  {
1330
1667
  class: "progress",
@@ -1333,46 +1670,46 @@ function Slider(props) {
1333
1670
  }
1334
1671
  }
1335
1672
  ),
1336
- /* @__PURE__ */ jsx25("div", { class: "handle" })
1673
+ /* @__PURE__ */ jsx28("div", { class: "handle" })
1337
1674
  ] })
1338
1675
  }
1339
1676
  );
1340
1677
  }
1341
1678
 
1342
1679
  // src/components/Table/Table.tsx
1343
- import { jsx as jsx26 } from "preact/jsx-runtime";
1680
+ import { jsx as jsx29 } from "preact/jsx-runtime";
1344
1681
  function Table(props) {
1345
- return /* @__PURE__ */ jsx26("table", { class: addClass("table", props.class), children: props.children });
1682
+ return /* @__PURE__ */ jsx29("table", { class: addClass("table", props.class), children: props.children });
1346
1683
  }
1347
1684
  function TableHead(props) {
1348
- return /* @__PURE__ */ jsx26("thead", { class: props.class, children: props.children });
1685
+ return /* @__PURE__ */ jsx29("thead", { class: props.class, children: props.children });
1349
1686
  }
1350
1687
  function TableBody(props) {
1351
- return /* @__PURE__ */ jsx26("tbody", { class: props.class, children: props.children });
1688
+ return /* @__PURE__ */ jsx29("tbody", { class: props.class, children: props.children });
1352
1689
  }
1353
1690
  function TableRow(props) {
1354
- return /* @__PURE__ */ jsx26("tr", { class: props.class, children: props.children });
1691
+ return /* @__PURE__ */ jsx29("tr", { class: props.class, children: props.children });
1355
1692
  }
1356
1693
  function TableCell(props) {
1357
- return /* @__PURE__ */ jsx26("td", { class: props.class, children: props.children });
1694
+ return /* @__PURE__ */ jsx29("td", { class: props.class, children: props.children });
1358
1695
  }
1359
1696
  function TableHeader(props) {
1360
- return /* @__PURE__ */ jsx26("th", { class: props.class, children: props.children });
1697
+ return /* @__PURE__ */ jsx29("th", { class: props.class, children: props.children });
1361
1698
  }
1362
1699
 
1363
1700
  // src/components/Tabs/Tabs.tsx
1364
- import { useSignal as useSignal10 } from "@preact/signals";
1701
+ import { useSignal as useSignal12 } from "@preact/signals";
1365
1702
  import { X } from "lucide-preact";
1366
- import { jsx as jsx27, jsxs as jsxs12 } from "preact/jsx-runtime";
1703
+ import { jsx as jsx30, jsxs as jsxs13 } from "preact/jsx-runtime";
1367
1704
  function Tabs(props) {
1368
1705
  let value;
1369
1706
  if (isSignal(props.value))
1370
1707
  value = props.value;
1371
1708
  else
1372
- value = useSignal10(props.value);
1373
- return /* @__PURE__ */ jsx27("div", { class: addClass(
1709
+ value = useSignal12(props.value);
1710
+ return /* @__PURE__ */ jsx30("div", { class: addClass(
1374
1711
  "tabs"
1375
- ), children: props.tabs.map((t) => /* @__PURE__ */ jsx27(
1712
+ ), children: props.tabs.map((t) => /* @__PURE__ */ jsx30(
1376
1713
  Tab,
1377
1714
  {
1378
1715
  name: t.name,
@@ -1389,21 +1726,21 @@ function Tabs(props) {
1389
1726
  )) });
1390
1727
  }
1391
1728
  function Tab(props) {
1392
- return /* @__PURE__ */ jsxs12(Branch, { cond: props.onClose != null, children: [
1393
- /* @__PURE__ */ jsx27(Then, { children: /* @__PURE__ */ jsxs12(Container, { horizontal: true, no_gap: true, centered_y: true, class: addClass("tab-with-close", props.selected && "selected"), children: [
1394
- /* @__PURE__ */ jsx27("button", { class: "tab-label", onClick: props.onClick, children: /* @__PURE__ */ jsx27(Text, { content: props.name }) }),
1395
- /* @__PURE__ */ jsx27(IconButton, { class: "tab-close", title: `Close ${props.name}`, onClick: (event) => {
1729
+ return /* @__PURE__ */ jsxs13(Branch, { cond: props.onClose != null, children: [
1730
+ /* @__PURE__ */ jsx30(Then, { children: /* @__PURE__ */ jsxs13(Container, { horizontal: true, no_gap: true, centered_y: true, class: addClass("tab-with-close", props.selected && "selected"), children: [
1731
+ /* @__PURE__ */ jsx30("button", { class: "tab-label", onClick: props.onClick, children: /* @__PURE__ */ jsx30(Text, { content: props.name }) }),
1732
+ /* @__PURE__ */ jsx30(IconButton, { class: "tab-close", title: `Close ${props.name}`, onClick: (event) => {
1396
1733
  event.stopPropagation();
1397
1734
  props.onClose?.();
1398
- }, children: /* @__PURE__ */ jsx27(X, { size: 14 }) })
1735
+ }, children: /* @__PURE__ */ jsx30(X, { size: 14 }) })
1399
1736
  ] }) }),
1400
- /* @__PURE__ */ jsx27(Else, { children: /* @__PURE__ */ jsx27(
1737
+ /* @__PURE__ */ jsx30(Else, { children: /* @__PURE__ */ jsx30(
1401
1738
  "button",
1402
1739
  {
1403
1740
  type: "button",
1404
1741
  class: addClass(props.selected && "selected"),
1405
1742
  onClick: props.onClick,
1406
- children: /* @__PURE__ */ jsx27("span", { children: props.name })
1743
+ children: /* @__PURE__ */ jsx30("span", { children: props.name })
1407
1744
  }
1408
1745
  ) })
1409
1746
  ] });
@@ -1411,9 +1748,9 @@ function Tab(props) {
1411
1748
 
1412
1749
  // src/components/TagList/TagList.tsx
1413
1750
  import { X as X2 } from "lucide-preact";
1414
- import { jsx as jsx28, jsxs as jsxs13 } from "preact/jsx-runtime";
1751
+ import { jsx as jsx31, jsxs as jsxs14 } from "preact/jsx-runtime";
1415
1752
  function TagList(props) {
1416
- return /* @__PURE__ */ jsx28("div", { class: "tag-list", children: resolveSignalish(props.tags).map((t) => /* @__PURE__ */ jsx28(
1753
+ return /* @__PURE__ */ jsx31("div", { class: "tag-list", children: resolveSignalish(props.tags).map((t) => /* @__PURE__ */ jsx31(
1417
1754
  Tag,
1418
1755
  {
1419
1756
  tag: t
@@ -1421,31 +1758,31 @@ function TagList(props) {
1421
1758
  )) });
1422
1759
  }
1423
1760
  function Tag(props) {
1424
- return /* @__PURE__ */ jsxs13("div", { class: addClass(
1761
+ return /* @__PURE__ */ jsxs14("div", { class: addClass(
1425
1762
  "tag",
1426
1763
  props.small && "small"
1427
1764
  ), children: [
1428
- /* @__PURE__ */ jsx28("span", { children: props.tag }),
1429
- props.onDelete && /* @__PURE__ */ jsx28("button", { onClick: props.onDelete, children: /* @__PURE__ */ jsx28(X2, { size: 13 }) })
1765
+ /* @__PURE__ */ jsx31("span", { children: props.tag }),
1766
+ props.onDelete && /* @__PURE__ */ jsx31("button", { onClick: props.onDelete, children: /* @__PURE__ */ jsx31(X2, { size: 13 }) })
1430
1767
  ] });
1431
1768
  }
1432
1769
 
1433
1770
  // src/components/TagList/TagListInput.tsx
1434
- import { useSignal as useSignal11 } from "@preact/signals";
1771
+ import { useSignal as useSignal13 } from "@preact/signals";
1435
1772
  import { useRef as useRef9, useState as useState4 } from "preact/hooks";
1436
- import { jsx as jsx29, jsxs as jsxs14 } from "preact/jsx-runtime";
1773
+ import { jsx as jsx32, jsxs as jsxs15 } from "preact/jsx-runtime";
1437
1774
  function TagListInput(props) {
1438
1775
  let value;
1439
1776
  if (props.value == null)
1440
- value = useSignal11([]);
1777
+ value = useSignal13([]);
1441
1778
  else if (isSignal(props.value))
1442
1779
  value = props.value;
1443
1780
  else
1444
- value = useSignal11(props.value);
1781
+ value = useSignal13(props.value);
1445
1782
  const inputRef = useRef9();
1446
1783
  const [inputValue, setInputValue] = useState4("");
1447
- return /* @__PURE__ */ jsxs14("div", { class: "tag-list", children: [
1448
- value.value.map((t, i) => /* @__PURE__ */ jsx29(
1784
+ return /* @__PURE__ */ jsxs15("div", { class: "tag-list", children: [
1785
+ value.value.map((t, i) => /* @__PURE__ */ jsx32(
1449
1786
  Tag,
1450
1787
  {
1451
1788
  tag: t,
@@ -1457,7 +1794,7 @@ function TagListInput(props) {
1457
1794
  }
1458
1795
  }
1459
1796
  )),
1460
- /* @__PURE__ */ jsx29(
1797
+ /* @__PURE__ */ jsx32(
1461
1798
  "input",
1462
1799
  {
1463
1800
  ref: inputRef,
@@ -1489,12 +1826,82 @@ function TagListInput(props) {
1489
1826
  ] });
1490
1827
  }
1491
1828
 
1829
+ // src/components/Toast/Toast.tsx
1830
+ import { createContext as createContext2 } from "preact";
1831
+ import { useContext as useContext2, useEffect as useEffect8, useRef as useRef10, useState as useState5 } from "preact/hooks";
1832
+ import { jsx as jsx33, jsxs as jsxs16 } from "preact/jsx-runtime";
1833
+ var ToastContext = createContext2(null);
1834
+ var nextToastId = 0;
1835
+ function useToast() {
1836
+ const context = useContext2(ToastContext);
1837
+ if (!context) {
1838
+ throw new Error("useToast() must be used inside a ToastContainer");
1839
+ }
1840
+ return context;
1841
+ }
1842
+ function ToastContainer(props) {
1843
+ const [toasts, setToasts] = useState5([]);
1844
+ const timers = useRef10(/* @__PURE__ */ new Set());
1845
+ useEffect8(() => () => {
1846
+ for (const timer of timers.current)
1847
+ window.clearTimeout(timer);
1848
+ timers.current.clear();
1849
+ }, []);
1850
+ function schedule(callback, delay) {
1851
+ const timer = window.setTimeout(() => {
1852
+ timers.current.delete(timer);
1853
+ callback();
1854
+ }, delay);
1855
+ timers.current.add(timer);
1856
+ }
1857
+ function show(text, status, duration = 3e3) {
1858
+ const id = nextToastId++;
1859
+ setToasts((current) => [
1860
+ ...current,
1861
+ {
1862
+ id,
1863
+ text,
1864
+ status,
1865
+ duration,
1866
+ fading: false
1867
+ }
1868
+ ]);
1869
+ schedule(() => {
1870
+ setToasts(
1871
+ (current) => current.map(
1872
+ (toast) => toast.id === id ? { ...toast, fading: true } : toast
1873
+ )
1874
+ );
1875
+ }, duration);
1876
+ schedule(() => {
1877
+ setToasts(
1878
+ (current) => current.filter((toast) => toast.id !== id)
1879
+ );
1880
+ }, duration + 300);
1881
+ }
1882
+ return /* @__PURE__ */ jsxs16(ToastContext.Provider, { value: { show }, children: [
1883
+ props.children,
1884
+ /* @__PURE__ */ jsx33(Container, { class: "toast-container", children: toasts.map((toast) => /* @__PURE__ */ jsx33(
1885
+ Container,
1886
+ {
1887
+ class: addClass(
1888
+ "toast",
1889
+ toast.status,
1890
+ toast.fading && "fading"
1891
+ ),
1892
+ children: toast.text
1893
+ },
1894
+ toast.id
1895
+ )) })
1896
+ ] });
1897
+ }
1898
+
1492
1899
  // src/components/UploadBox/UploadBox.tsx
1493
- import { useEffect as useEffect6, useRef as useRef10, useState as useState5 } from "preact/hooks";
1494
- import { jsx as jsx30, jsxs as jsxs15 } from "preact/jsx-runtime";
1900
+ import { useEffect as useEffect9, useRef as useRef11, useState as useState6 } from "preact/hooks";
1901
+ import { jsx as jsx34, jsxs as jsxs17 } from "preact/jsx-runtime";
1495
1902
  function UploadBox(props) {
1496
- const inputRef = useRef10(null);
1497
- const [dragging, setDragging] = useState5(false);
1903
+ const inputRef = useRef11(null);
1904
+ const [dragging, setDragging] = useState6(false);
1498
1905
  function handleFiles(files) {
1499
1906
  files = Array.from(files);
1500
1907
  if (!props.addFile)
@@ -1504,7 +1911,7 @@ function UploadBox(props) {
1504
1911
  ;
1505
1912
  }
1506
1913
  }
1507
- useEffect6(() => {
1914
+ useEffect9(() => {
1508
1915
  const onPaste = (e) => {
1509
1916
  const files = e.clipboardData?.files;
1510
1917
  if (files && files.length > 0)
@@ -1515,7 +1922,7 @@ function UploadBox(props) {
1515
1922
  window.removeEventListener("paste", onPaste);
1516
1923
  };
1517
1924
  }, []);
1518
- return /* @__PURE__ */ jsxs15(
1925
+ return /* @__PURE__ */ jsxs17(
1519
1926
  "div",
1520
1927
  {
1521
1928
  class: addClass(
@@ -1544,7 +1951,7 @@ function UploadBox(props) {
1544
1951
  handleFiles(e.dataTransfer.files);
1545
1952
  },
1546
1953
  children: [
1547
- /* @__PURE__ */ jsx30(
1954
+ /* @__PURE__ */ jsx34(
1548
1955
  "input",
1549
1956
  {
1550
1957
  ref: inputRef,
@@ -1567,9 +1974,9 @@ function UploadBox(props) {
1567
1974
  }
1568
1975
 
1569
1976
  // src/components/WrapList/WrapList.tsx
1570
- import { jsx as jsx31 } from "preact/jsx-runtime";
1977
+ import { jsx as jsx35 } from "preact/jsx-runtime";
1571
1978
  function WrapList(props) {
1572
- return /* @__PURE__ */ jsx31(
1979
+ return /* @__PURE__ */ jsx35(
1573
1980
  "div",
1574
1981
  {
1575
1982
  class: "wrap-list",
@@ -1601,7 +2008,10 @@ export {
1601
2008
  PopoutTextIconButton,
1602
2009
  Input,
1603
2010
  CalendarInput,
2011
+ Checkbox,
1604
2012
  ClickFade,
2013
+ Text,
2014
+ ColorPicker,
1605
2015
  If,
1606
2016
  Switch,
1607
2017
  Case,
@@ -1609,7 +2019,6 @@ export {
1609
2019
  Then,
1610
2020
  Else,
1611
2021
  Content,
1612
- Text,
1613
2022
  closeContextMenu,
1614
2023
  openContextMenu,
1615
2024
  openContextMenuOn,
@@ -1628,6 +2037,9 @@ export {
1628
2037
  Textarea,
1629
2038
  Throbber,
1630
2039
  Loading,
2040
+ showModal,
2041
+ closeModal,
2042
+ ModalHost,
1631
2043
  PathInput,
1632
2044
  SelectBox,
1633
2045
  Seperator,
@@ -1642,6 +2054,8 @@ export {
1642
2054
  TagList,
1643
2055
  Tag,
1644
2056
  TagListInput,
2057
+ useToast,
2058
+ ToastContainer,
1645
2059
  UploadBox,
1646
2060
  WrapList
1647
2061
  };