flufi-ui 0.1.5 → 0.1.7

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,20 @@ 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(
842
+ "content",
529
843
  props.class && `content-${props.class}`,
530
844
  props.wrapped && "wrapped",
531
845
  props.centered && "centered"
532
- ), children: props.wrapped ? /* @__PURE__ */ jsx8("div", { children: props.children }) : props.children });
846
+ ), children: props.wrapped ? /* @__PURE__ */ jsx11("div", { children: props.children }) : props.children });
533
847
  }
534
848
 
535
849
  // src/components/ContextMenu/ContextMenu.tsx
536
850
  import { render } from "preact";
537
851
  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
- }
852
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "preact/hooks";
554
853
 
555
854
  // src/components/ContextMenu/position.ts
556
855
  function getContextMenuPlacement(target, size, viewport) {
@@ -586,7 +885,7 @@ function getContextMenuPlacement(target, size, viewport) {
586
885
  }
587
886
 
588
887
  // src/components/ContextMenu/ContextMenu.tsx
589
- import { jsx as jsx10, jsxs as jsxs4 } from "preact/jsx-runtime";
888
+ import { jsx as jsx12, jsxs as jsxs5 } from "preact/jsx-runtime";
590
889
  var currentMenu;
591
890
  var pointerPosition;
592
891
  if (typeof window !== "undefined") {
@@ -621,7 +920,7 @@ function openMenu(items, target) {
621
920
  };
622
921
  currentMenu = menu;
623
922
  document.body.appendChild(menu.host);
624
- render(/* @__PURE__ */ jsx10(ContextMenu, { items, target, instance: menu }), menu.host);
923
+ render(/* @__PURE__ */ jsx12(ContextMenu, { items, target, instance: menu }), menu.host);
625
924
  }
626
925
  function openContextMenu(items, position) {
627
926
  if (position && "preventDefault" in position)
@@ -633,7 +932,7 @@ function openContextMenuOn(items, element) {
633
932
  openMenu(items, element);
634
933
  }
635
934
  function ContextMenu(props) {
636
- const menuRef = useRef3(null);
935
+ const menuRef = useRef4(null);
637
936
  useLayoutEffect2(() => {
638
937
  const menu = menuRef.current;
639
938
  const anchor = props.target instanceof Element ? props.target : void 0;
@@ -728,7 +1027,7 @@ function ContextMenu(props) {
728
1027
  };
729
1028
  }, []);
730
1029
  return createPortal2(
731
- /* @__PURE__ */ jsx10(
1030
+ /* @__PURE__ */ jsx12(
732
1031
  Container,
733
1032
  {
734
1033
  class: "context-menu popout",
@@ -740,7 +1039,7 @@ function ContextMenu(props) {
740
1039
  tabIndex: -1,
741
1040
  onContextMenu: (event) => event.preventDefault()
742
1041
  },
743
- children: props.items.map((item, index) => /* @__PURE__ */ jsx10(ContextMenuItemView, { item, instance: props.instance }, index))
1042
+ children: props.items.map((item, index) => /* @__PURE__ */ jsx12(ContextMenuItemView, { item, instance: props.instance }, index))
744
1043
  }
745
1044
  ),
746
1045
  document.body
@@ -748,13 +1047,13 @@ function ContextMenu(props) {
748
1047
  }
749
1048
  function ContextMenuItemView({ item, instance }) {
750
1049
  if (item === "---" || typeof item !== "string" && item.type === "separator")
751
- return /* @__PURE__ */ jsx10("div", { class: "context-menu-separator", role: "separator" });
1050
+ return /* @__PURE__ */ jsx12("div", { class: "context-menu-separator", role: "separator" });
752
1051
  if (typeof item === "string" || item.type === "header") {
753
1052
  const label = typeof item === "string" ? item : item.label;
754
- return /* @__PURE__ */ jsx10(Container, { class: "context-menu-header", other: { role: "presentation" }, children: renderLabel(label, true) });
1053
+ return /* @__PURE__ */ jsx12(Container, { class: "context-menu-header", other: { role: "presentation" }, children: renderLabel(label, true) });
755
1054
  }
756
1055
  const MenuButton = "href" in item ? item.icon ? TextIconLinkButton : TextLinkButton : item.icon ? TextIconButton : TextButton;
757
- return /* @__PURE__ */ jsxs4(
1056
+ return /* @__PURE__ */ jsxs5(
758
1057
  MenuButton,
759
1058
  {
760
1059
  role: "menuitem",
@@ -775,13 +1074,13 @@ function ContextMenuItemView({ item, instance }) {
775
1074
  );
776
1075
  }
777
1076
  function renderLabel(label, dim = false) {
778
- return typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ jsx10(Text, { content: label, dim }) : label;
1077
+ return typeof label === "string" || typeof label === "number" ? /* @__PURE__ */ jsx12(Text, { content: label, dim }) : label;
779
1078
  }
780
1079
 
781
1080
  // src/components/DotSeperator/DotSeperator.tsx
782
- import { jsx as jsx11 } from "preact/jsx-runtime";
1081
+ import { jsx as jsx13 } from "preact/jsx-runtime";
783
1082
  function DotSeperator(props) {
784
- return /* @__PURE__ */ jsx11("span", { class: addClass(
1083
+ return /* @__PURE__ */ jsx13("span", { class: addClass(
785
1084
  "dot-seperator",
786
1085
  props.noMargin && "no-margin",
787
1086
  props.containerTextMargin && "container-text-margin"
@@ -808,7 +1107,7 @@ import {
808
1107
  Binary,
809
1108
  FileQuestion
810
1109
  } from "lucide-preact";
811
- import { jsx as jsx12 } from "preact/jsx-runtime";
1110
+ import { jsx as jsx14 } from "preact/jsx-runtime";
812
1111
  function getFileIcon(category) {
813
1112
  switch (category) {
814
1113
  case "directory":
@@ -849,38 +1148,38 @@ function getFileIcon(category) {
849
1148
  }
850
1149
  function FileIcon(props) {
851
1150
  const Icon = getFileIcon(props.category);
852
- return /* @__PURE__ */ jsx12(Icon, { size: props.size });
1151
+ return /* @__PURE__ */ jsx14(Icon, { size: props.size });
853
1152
  }
854
1153
 
855
1154
  // src/components/FilePath.tsx
856
- import { Fragment, jsx as jsx13, jsxs as jsxs5 } from "preact/jsx-runtime";
1155
+ import { Fragment, jsx as jsx15, jsxs as jsxs6 } from "preact/jsx-runtime";
857
1156
  function FilePath(props) {
858
1157
  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] })
1158
+ return /* @__PURE__ */ jsxs6(Fragment, { children: [
1159
+ /* @__PURE__ */ jsx15(Text, { content: parts[0] + parts[1] }),
1160
+ parts[2] && /* @__PURE__ */ jsx15(Text, { class: "type", dim: true, content: "." + parts[2] })
862
1161
  ] });
863
1162
  }
864
1163
 
865
1164
  // src/components/Label/Label.tsx
866
- import { jsx as jsx14 } from "preact/jsx-runtime";
1165
+ import { jsx as jsx16 } from "preact/jsx-runtime";
867
1166
  function Label(props) {
868
- return /* @__PURE__ */ jsx14("span", { class: "label", children: props.text });
1167
+ return /* @__PURE__ */ jsx16("span", { class: "label", children: props.text });
869
1168
  }
870
1169
 
871
1170
  // src/components/FormalInput/FormalInput.tsx
872
- import { jsx as jsx15, jsxs as jsxs6 } from "preact/jsx-runtime";
1171
+ import { jsx as jsx17, jsxs as jsxs7 } from "preact/jsx-runtime";
873
1172
  function FormalInput(props) {
874
- return /* @__PURE__ */ jsxs6(Container, { class: "formal-input", children: [
875
- /* @__PURE__ */ jsx15(Label, { text: props.label }),
1173
+ return /* @__PURE__ */ jsxs7(Container, { class: "formal-input", children: [
1174
+ /* @__PURE__ */ jsx17(Label, { text: props.label }),
876
1175
  props.children
877
1176
  ] });
878
1177
  }
879
1178
 
880
1179
  // src/components/Header/Header.tsx
881
- import { jsx as jsx16 } from "preact/jsx-runtime";
1180
+ import { jsx as jsx18 } from "preact/jsx-runtime";
882
1181
  function Header1(props) {
883
- return /* @__PURE__ */ jsx16(
1182
+ return /* @__PURE__ */ jsx18(
884
1183
  "h1",
885
1184
  {
886
1185
  class: addClass(
@@ -893,7 +1192,7 @@ function Header1(props) {
893
1192
  );
894
1193
  }
895
1194
  function Header2(props) {
896
- return /* @__PURE__ */ jsx16(
1195
+ return /* @__PURE__ */ jsx18(
897
1196
  "h2",
898
1197
  {
899
1198
  class: addClass(
@@ -906,7 +1205,7 @@ function Header2(props) {
906
1205
  );
907
1206
  }
908
1207
  function Header3(props) {
909
- return /* @__PURE__ */ jsx16(
1208
+ return /* @__PURE__ */ jsx18(
910
1209
  "h3",
911
1210
  {
912
1211
  class: addClass(
@@ -919,7 +1218,7 @@ function Header3(props) {
919
1218
  );
920
1219
  }
921
1220
  function MiniHeader(props) {
922
- return /* @__PURE__ */ jsx16(
1221
+ return /* @__PURE__ */ jsx18(
923
1222
  "h6",
924
1223
  {
925
1224
  class: addClass(
@@ -934,27 +1233,21 @@ function MiniHeader(props) {
934
1233
  }
935
1234
 
936
1235
  // 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";
1236
+ import { useEffect as useEffect4, useState as useState2 } from "preact/hooks";
1237
+ import { jsx as jsx19 } from "preact/jsx-runtime";
939
1238
  function Image2(props) {
940
1239
  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)
1240
+ const newSrc = resolveSignalish(props.src);
1241
+ useEffect4(() => {
1242
+ if (newSrc == null || typeof newSrc == "string") {
1243
+ setSrc(newSrc ?? void 0);
947
1244
  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
1245
  }
956
- }, [props.src]);
957
- return /* @__PURE__ */ jsx17(
1246
+ const url = URL.createObjectURL(newSrc);
1247
+ setSrc(url);
1248
+ return () => URL.revokeObjectURL(url);
1249
+ }, [props.src, newSrc]);
1250
+ return /* @__PURE__ */ jsx19(
958
1251
  "img",
959
1252
  {
960
1253
  src,
@@ -968,7 +1261,8 @@ function Image2(props) {
968
1261
  props.max_size != null && {
969
1262
  maxWidth: props.max_size + "px",
970
1263
  maxHeight: props.max_size + "px"
971
- }
1264
+ },
1265
+ props.style
972
1266
  )
973
1267
  }
974
1268
  );
@@ -976,19 +1270,19 @@ function Image2(props) {
976
1270
 
977
1271
  // src/components/ImageInput/ImageInput.tsx
978
1272
  import { useRef as useRef5 } from "preact/hooks";
979
- import { useSignal as useSignal5 } from "@preact/signals";
1273
+ import { useSignal as useSignal7 } from "@preact/signals";
980
1274
  import { CloudUpload } from "lucide-preact";
981
- import { jsx as jsx18, jsxs as jsxs7 } from "preact/jsx-runtime";
1275
+ import { jsx as jsx20, jsxs as jsxs8 } from "preact/jsx-runtime";
982
1276
  function ImageInput(props) {
983
1277
  const inputRef = useRef5();
984
1278
  let value;
985
1279
  if (props.value == null)
986
- value = useSignal5(null);
1280
+ value = useSignal7(null);
987
1281
  else if (isSignal(props.value))
988
1282
  value = props.value;
989
1283
  else
990
- value = useSignal5(props.value);
991
- return /* @__PURE__ */ jsxs7(
1284
+ value = useSignal7(props.value);
1285
+ return /* @__PURE__ */ jsxs8(
992
1286
  "div",
993
1287
  {
994
1288
  class: addClass(
@@ -1004,7 +1298,7 @@ function ImageInput(props) {
1004
1298
  inputRef.current?.click();
1005
1299
  },
1006
1300
  children: [
1007
- /* @__PURE__ */ jsx18(
1301
+ /* @__PURE__ */ jsx20(
1008
1302
  "input",
1009
1303
  {
1010
1304
  ref: inputRef,
@@ -1020,15 +1314,15 @@ function ImageInput(props) {
1020
1314
  }
1021
1315
  }
1022
1316
  ),
1023
- /* @__PURE__ */ jsxs7(Branch, { cond: value, children: [
1024
- /* @__PURE__ */ jsx18(Then, { children: () => /* @__PURE__ */ jsx18(
1317
+ /* @__PURE__ */ jsxs8(Branch, { cond: value, children: [
1318
+ /* @__PURE__ */ jsx20(Then, { children: () => /* @__PURE__ */ jsx20(
1025
1319
  Image2,
1026
1320
  {
1027
1321
  src: value,
1028
1322
  class: "preview"
1029
1323
  }
1030
1324
  ) }),
1031
- /* @__PURE__ */ jsx18(Else, { children: props.children ?? /* @__PURE__ */ jsx18(CloudUpload, { size: 16 }) })
1325
+ /* @__PURE__ */ jsx20(Else, { children: props.children ?? /* @__PURE__ */ jsx20(CloudUpload, { size: 16 }) })
1032
1326
  ] })
1033
1327
  ]
1034
1328
  }
@@ -1036,19 +1330,19 @@ function ImageInput(props) {
1036
1330
  }
1037
1331
 
1038
1332
  // src/components/Input/Textarea.tsx
1039
- import { useSignal as useSignal6 } from "@preact/signals";
1333
+ import { useSignal as useSignal8 } from "@preact/signals";
1040
1334
  import { useRef as useRef6 } from "preact/hooks";
1041
- import { jsx as jsx19 } from "preact/jsx-runtime";
1335
+ import { jsx as jsx21 } from "preact/jsx-runtime";
1042
1336
  function Textarea(props) {
1043
1337
  const inputRef = useRef6();
1044
1338
  let value;
1045
1339
  if (props.value == null)
1046
- value = useSignal6("");
1340
+ value = useSignal8("");
1047
1341
  else if (isSignal(props.value))
1048
1342
  value = props.value;
1049
1343
  else
1050
- value = useSignal6(props.value);
1051
- return /* @__PURE__ */ jsx19(
1344
+ value = useSignal8(props.value);
1345
+ return /* @__PURE__ */ jsx21(
1052
1346
  "textarea",
1053
1347
  {
1054
1348
  class: addClass(
@@ -1069,17 +1363,17 @@ function Textarea(props) {
1069
1363
  }
1070
1364
 
1071
1365
  // src/components/Loading/Loading.tsx
1072
- import { useEffect as useEffect3, useState as useState3 } from "preact/hooks";
1366
+ import { useEffect as useEffect5, useState as useState3 } from "preact/hooks";
1073
1367
 
1074
1368
  // src/components/Throbber/Throbber.tsx
1075
1369
  import { Loader2 } from "lucide-preact";
1076
- import { jsx as jsx20 } from "preact/jsx-runtime";
1370
+ import { jsx as jsx22 } from "preact/jsx-runtime";
1077
1371
  function Throbber(props) {
1078
- return /* @__PURE__ */ jsx20("span", { class: "throbber", children: /* @__PURE__ */ jsx20(Loader2, { size: props.size }) });
1372
+ return /* @__PURE__ */ jsx22("span", { class: "throbber", children: /* @__PURE__ */ jsx22(Loader2, { size: props.size }) });
1079
1373
  }
1080
1374
 
1081
1375
  // src/components/Loading/Loading.tsx
1082
- import { jsx as jsx21, jsxs as jsxs8 } from "preact/jsx-runtime";
1376
+ import { jsx as jsx23, jsxs as jsxs9 } from "preact/jsx-runtime";
1083
1377
  function Loading(props) {
1084
1378
  const [loaded, setLoaded] = useState3(false);
1085
1379
  {
@@ -1088,36 +1382,80 @@ function Loading(props) {
1088
1382
  setLoaded(resolveSignalish(out));
1089
1383
  }
1090
1384
  }
1091
- useEffect3(syncWrap(async () => {
1385
+ useEffect5(syncWrap(async () => {
1092
1386
  let data = resolveSignalish(await resolveMaybeAsyncFunc(props.loaded));
1093
1387
  setLoaded(data);
1094
1388
  }), [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 })
1389
+ return loaded ? resolveMaybeFunc(props.children ?? null) : /* @__PURE__ */ jsxs9("div", { class: addClass("loading", props.class), children: [
1390
+ /* @__PURE__ */ jsx23(Throbber, { size: props.throbber_size }),
1391
+ loaded && /* @__PURE__ */ jsx23("p", { children: loaded })
1098
1392
  ] });
1099
1393
  }
1100
1394
 
1395
+ // src/components/Modal/Modal.tsx
1396
+ import { createPortal as createPortal3 } from "preact/compat";
1397
+ import { signal } from "@preact/signals";
1398
+ import { jsx as jsx24 } from "preact/jsx-runtime";
1399
+ var modal = signal(null);
1400
+ function showModal(content, options = {}) {
1401
+ const nextModal = {
1402
+ content,
1403
+ closeOnBackdrop: options.closeOnBackdrop ?? true,
1404
+ data: options.data
1405
+ };
1406
+ modal.value = nextModal;
1407
+ return {
1408
+ close() {
1409
+ if (modal.peek() === nextModal)
1410
+ closeModal();
1411
+ }
1412
+ };
1413
+ }
1414
+ function closeModal() {
1415
+ modal.value = null;
1416
+ }
1417
+ function ModalHost() {
1418
+ if (modal.value == null) {
1419
+ return null;
1420
+ }
1421
+ const Comp = modal.value.content;
1422
+ return createPortal3(
1423
+ /* @__PURE__ */ jsx24(
1424
+ "div",
1425
+ {
1426
+ class: "modal-container",
1427
+ onClick: (event) => {
1428
+ if (modal.value?.closeOnBackdrop && event.target === event.currentTarget) {
1429
+ closeModal();
1430
+ }
1431
+ },
1432
+ children: /* @__PURE__ */ jsx24(Comp, { data: modal.value?.data })
1433
+ }
1434
+ ),
1435
+ document.body
1436
+ );
1437
+ }
1438
+
1101
1439
  // src/components/PathInput/PathInput.tsx
1102
- import { useSignal as useSignal7 } from "@preact/signals";
1440
+ import { useSignal as useSignal9 } from "@preact/signals";
1103
1441
  import { Fragment as Fragment2 } from "preact";
1104
- import { useEffect as useEffect4, useRef as useRef7 } from "preact/hooks";
1442
+ import { useEffect as useEffect6, useRef as useRef7 } from "preact/hooks";
1105
1443
  import { ChevronRight as ChevronRight2 } from "lucide-preact";
1106
- import { jsx as jsx22, jsxs as jsxs9 } from "preact/jsx-runtime";
1444
+ import { jsx as jsx25, jsxs as jsxs10 } from "preact/jsx-runtime";
1107
1445
  function PathInput(props) {
1108
1446
  let parts;
1109
1447
  if (props.value == null)
1110
- parts = useSignal7(["~", "Documents", "Projects"]);
1448
+ parts = useSignal9(["~", "Documents", "Projects"]);
1111
1449
  else if (isSignal(props.value))
1112
- parts = useSignal7(splitPath(props.value.peek()));
1450
+ parts = useSignal9(splitPath(props.value.peek()));
1113
1451
  else
1114
- parts = useSignal7(splitPath(props.value));
1452
+ parts = useSignal9(splitPath(props.value));
1115
1453
  let combined;
1116
1454
  if (isSignal(props.value))
1117
1455
  combined = props.value;
1118
1456
  else
1119
- combined = useSignal7(joinPathParts(parts.peek()));
1120
- const editing = props.editing ?? useSignal7(false);
1457
+ combined = useSignal9(joinPathParts(parts.peek()));
1458
+ const editing = props.editing ?? useSignal9(false);
1121
1459
  const inputRef = useRef7(null);
1122
1460
  const pathRef = useRef7(null);
1123
1461
  function commit(newParts) {
@@ -1132,13 +1470,13 @@ function PathInput(props) {
1132
1470
  const end = combined.peek().length;
1133
1471
  inputRef.current?.setSelectionRange(end, end);
1134
1472
  }
1135
- useEffect4(() => {
1473
+ useEffect6(() => {
1136
1474
  if (!isSignal(props.value)) return;
1137
1475
  return props.value.subscribe((val) => {
1138
1476
  if (!editing.peek()) parts.value = splitPath(val);
1139
1477
  });
1140
1478
  }, [props.value]);
1141
- useEffect4(() => {
1479
+ useEffect6(() => {
1142
1480
  const el = pathRef.current;
1143
1481
  if (!el) return;
1144
1482
  requestAnimationFrame(() => {
@@ -1148,13 +1486,13 @@ function PathInput(props) {
1148
1486
  });
1149
1487
  });
1150
1488
  }, [parts.value]);
1151
- return /* @__PURE__ */ jsx22(Container, { horizontal: true, class: "path-input", children: /* @__PURE__ */ jsx22(
1489
+ return /* @__PURE__ */ jsx25(Container, { horizontal: true, class: "path-input", children: /* @__PURE__ */ jsx25(
1152
1490
  ClickFade,
1153
1491
  {
1154
1492
  faded: editing,
1155
1493
  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(
1494
+ before: /* @__PURE__ */ jsx25(Container, { horizontal: true, class: "input", centered_y: true, other: { ref: pathRef }, children: parts.value.map((p, i) => /* @__PURE__ */ jsxs10(Fragment2, { children: [
1495
+ /* @__PURE__ */ jsx25(
1158
1496
  Button,
1159
1497
  {
1160
1498
  variant: "always-transparent",
@@ -1162,7 +1500,7 @@ function PathInput(props) {
1162
1500
  e.stopImmediatePropagation();
1163
1501
  commit(parts.peek().slice(0, i + 1));
1164
1502
  },
1165
- children: /* @__PURE__ */ jsx22(
1503
+ children: /* @__PURE__ */ jsx25(
1166
1504
  Text,
1167
1505
  {
1168
1506
  content: p
@@ -1170,9 +1508,9 @@ function PathInput(props) {
1170
1508
  )
1171
1509
  }
1172
1510
  ),
1173
- /* @__PURE__ */ jsx22(If, { cond: i < parts.value.length - 1, children: /* @__PURE__ */ jsx22(ChevronRight2, { size: 12 }) })
1511
+ /* @__PURE__ */ jsx25(If, { cond: i < parts.value.length - 1, children: /* @__PURE__ */ jsx25(ChevronRight2, { size: 12 }) })
1174
1512
  ] }, i)) }),
1175
- after: /* @__PURE__ */ jsx22(
1513
+ after: /* @__PURE__ */ jsx25(
1176
1514
  Input,
1177
1515
  {
1178
1516
  inputRef,
@@ -1194,18 +1532,18 @@ function PathInput(props) {
1194
1532
  }
1195
1533
 
1196
1534
  // src/components/SelectBox/SelectBox.tsx
1197
- import { useSignal as useSignal8 } from "@preact/signals";
1535
+ import { useSignal as useSignal10 } from "@preact/signals";
1198
1536
  import { ChevronDown } from "lucide-preact";
1199
- import { jsx as jsx23, jsxs as jsxs10 } from "preact/jsx-runtime";
1537
+ import { jsx as jsx26, jsxs as jsxs11 } from "preact/jsx-runtime";
1200
1538
  function SelectBox(props) {
1201
1539
  let value;
1202
1540
  if (props.value == null)
1203
- value = useSignal8(null);
1541
+ value = useSignal10(null);
1204
1542
  else if (isSignal(props.value))
1205
1543
  value = props.value;
1206
1544
  else
1207
- value = useSignal8(props.value);
1208
- const popoutOpen = useSignal8(false);
1545
+ value = useSignal10(props.value);
1546
+ const popoutOpen = useSignal10(false);
1209
1547
  const temp_options = resolveSignalish(props.options);
1210
1548
  const options = isMaybeLoaded(temp_options) ? maybeLoadedIsLoaded(temp_options) ? maybeLoadedUnwrap(temp_options) : null : temp_options;
1211
1549
  const selected = options != null ? options.find(
@@ -1218,7 +1556,7 @@ function SelectBox(props) {
1218
1556
  props.dirty.value = true;
1219
1557
  popoutOpen.value = false;
1220
1558
  }
1221
- return /* @__PURE__ */ jsxs10(
1559
+ return /* @__PURE__ */ jsxs11(
1222
1560
  PopoutTextButton,
1223
1561
  {
1224
1562
  class: addClass(
@@ -1229,7 +1567,7 @@ function SelectBox(props) {
1229
1567
  buttonClass: "input",
1230
1568
  open: popoutOpen,
1231
1569
  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(
1570
+ popout: () => /* @__PURE__ */ jsx26(Container, { children: /* @__PURE__ */ jsx26(Loading, { loaded: options != null, throbber_size: 15, children: () => options.map((option) => /* @__PURE__ */ jsx26(
1233
1571
  TextButton,
1234
1572
  {
1235
1573
  class: addClass(
@@ -1240,38 +1578,38 @@ function SelectBox(props) {
1240
1578
  }
1241
1579
  )) }) }),
1242
1580
  children: [
1243
- /* @__PURE__ */ jsx23("span", { class: addClass(
1581
+ /* @__PURE__ */ jsx26("span", { class: addClass(
1244
1582
  selected == null && "default"
1245
1583
  ), children: selected?.label ?? "Select..." }),
1246
- /* @__PURE__ */ jsx23(ChevronDown, { size: 15 })
1584
+ /* @__PURE__ */ jsx26(ChevronDown, { size: 15 })
1247
1585
  ]
1248
1586
  }
1249
1587
  );
1250
1588
  }
1251
1589
 
1252
1590
  // src/components/Seperator/Seperator.tsx
1253
- import { jsx as jsx24 } from "preact/jsx-runtime";
1591
+ import { jsx as jsx27 } from "preact/jsx-runtime";
1254
1592
  function Seperator() {
1255
- return /* @__PURE__ */ jsx24("div", { class: "seperator" });
1593
+ return /* @__PURE__ */ jsx27("div", { class: "seperator" });
1256
1594
  }
1257
1595
 
1258
1596
  // 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";
1597
+ import { useSignal as useSignal11 } from "@preact/signals";
1598
+ import { useEffect as useEffect7, useRef as useRef8 } from "preact/hooks";
1599
+ import { jsx as jsx28, jsxs as jsxs12 } from "preact/jsx-runtime";
1262
1600
  function Slider(props) {
1263
1601
  let start = props.start ?? 0;
1264
1602
  let end = props.end ?? 1;
1265
1603
  let value;
1266
1604
  if (props.value == null)
1267
- value = useSignal9(0);
1605
+ value = useSignal11(0);
1268
1606
  else if (isSignal(props.value))
1269
1607
  value = props.value;
1270
1608
  else
1271
- value = useSignal9(props.value);
1609
+ value = useSignal11(props.value);
1272
1610
  const ref = useRef8(null);
1273
- const dragging = props.dragging ?? useSignal9(false);
1274
- useEffect5(() => {
1611
+ const dragging = props.dragging ?? useSignal11(false);
1612
+ useEffect7(() => {
1275
1613
  dragging.subscribe((d) => {
1276
1614
  if (d)
1277
1615
  document.addEventListener("pointermove", updateFromEvent);
@@ -1300,7 +1638,7 @@ function Slider(props) {
1300
1638
  update(progress * (end - start) + start);
1301
1639
  }
1302
1640
  let percentValue = (value.value - start) / (end - start);
1303
- return /* @__PURE__ */ jsx25(
1641
+ return /* @__PURE__ */ jsx28(
1304
1642
  "div",
1305
1643
  {
1306
1644
  ref,
@@ -1323,8 +1661,8 @@ function Slider(props) {
1323
1661
  const direction = Math.sign(e.deltaY);
1324
1662
  update(value.value - direction * step * (props.scroll_speed ?? 1));
1325
1663
  },
1326
- children: /* @__PURE__ */ jsxs11("div", { children: [
1327
- /* @__PURE__ */ jsx25(
1664
+ children: /* @__PURE__ */ jsxs12("div", { children: [
1665
+ /* @__PURE__ */ jsx28(
1328
1666
  "div",
1329
1667
  {
1330
1668
  class: "progress",
@@ -1333,46 +1671,46 @@ function Slider(props) {
1333
1671
  }
1334
1672
  }
1335
1673
  ),
1336
- /* @__PURE__ */ jsx25("div", { class: "handle" })
1674
+ /* @__PURE__ */ jsx28("div", { class: "handle" })
1337
1675
  ] })
1338
1676
  }
1339
1677
  );
1340
1678
  }
1341
1679
 
1342
1680
  // src/components/Table/Table.tsx
1343
- import { jsx as jsx26 } from "preact/jsx-runtime";
1681
+ import { jsx as jsx29 } from "preact/jsx-runtime";
1344
1682
  function Table(props) {
1345
- return /* @__PURE__ */ jsx26("table", { class: addClass("table", props.class), children: props.children });
1683
+ return /* @__PURE__ */ jsx29("table", { class: addClass("table", props.class), children: props.children });
1346
1684
  }
1347
1685
  function TableHead(props) {
1348
- return /* @__PURE__ */ jsx26("thead", { class: props.class, children: props.children });
1686
+ return /* @__PURE__ */ jsx29("thead", { class: props.class, children: props.children });
1349
1687
  }
1350
1688
  function TableBody(props) {
1351
- return /* @__PURE__ */ jsx26("tbody", { class: props.class, children: props.children });
1689
+ return /* @__PURE__ */ jsx29("tbody", { class: props.class, children: props.children });
1352
1690
  }
1353
1691
  function TableRow(props) {
1354
- return /* @__PURE__ */ jsx26("tr", { class: props.class, children: props.children });
1692
+ return /* @__PURE__ */ jsx29("tr", { class: props.class, children: props.children });
1355
1693
  }
1356
1694
  function TableCell(props) {
1357
- return /* @__PURE__ */ jsx26("td", { class: props.class, children: props.children });
1695
+ return /* @__PURE__ */ jsx29("td", { class: props.class, children: props.children });
1358
1696
  }
1359
1697
  function TableHeader(props) {
1360
- return /* @__PURE__ */ jsx26("th", { class: props.class, children: props.children });
1698
+ return /* @__PURE__ */ jsx29("th", { class: props.class, children: props.children });
1361
1699
  }
1362
1700
 
1363
1701
  // src/components/Tabs/Tabs.tsx
1364
- import { useSignal as useSignal10 } from "@preact/signals";
1702
+ import { useSignal as useSignal12 } from "@preact/signals";
1365
1703
  import { X } from "lucide-preact";
1366
- import { jsx as jsx27, jsxs as jsxs12 } from "preact/jsx-runtime";
1704
+ import { jsx as jsx30, jsxs as jsxs13 } from "preact/jsx-runtime";
1367
1705
  function Tabs(props) {
1368
1706
  let value;
1369
1707
  if (isSignal(props.value))
1370
1708
  value = props.value;
1371
1709
  else
1372
- value = useSignal10(props.value);
1373
- return /* @__PURE__ */ jsx27("div", { class: addClass(
1710
+ value = useSignal12(props.value);
1711
+ return /* @__PURE__ */ jsx30("div", { class: addClass(
1374
1712
  "tabs"
1375
- ), children: props.tabs.map((t) => /* @__PURE__ */ jsx27(
1713
+ ), children: props.tabs.map((t) => /* @__PURE__ */ jsx30(
1376
1714
  Tab,
1377
1715
  {
1378
1716
  name: t.name,
@@ -1389,21 +1727,21 @@ function Tabs(props) {
1389
1727
  )) });
1390
1728
  }
1391
1729
  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) => {
1730
+ return /* @__PURE__ */ jsxs13(Branch, { cond: props.onClose != null, children: [
1731
+ /* @__PURE__ */ jsx30(Then, { children: /* @__PURE__ */ jsxs13(Container, { horizontal: true, no_gap: true, centered_y: true, class: addClass("tab-with-close", props.selected && "selected"), children: [
1732
+ /* @__PURE__ */ jsx30("button", { class: "tab-label", onClick: props.onClick, children: /* @__PURE__ */ jsx30(Text, { content: props.name }) }),
1733
+ /* @__PURE__ */ jsx30(IconButton, { class: "tab-close", title: `Close ${props.name}`, onClick: (event) => {
1396
1734
  event.stopPropagation();
1397
1735
  props.onClose?.();
1398
- }, children: /* @__PURE__ */ jsx27(X, { size: 14 }) })
1736
+ }, children: /* @__PURE__ */ jsx30(X, { size: 14 }) })
1399
1737
  ] }) }),
1400
- /* @__PURE__ */ jsx27(Else, { children: /* @__PURE__ */ jsx27(
1738
+ /* @__PURE__ */ jsx30(Else, { children: /* @__PURE__ */ jsx30(
1401
1739
  "button",
1402
1740
  {
1403
1741
  type: "button",
1404
1742
  class: addClass(props.selected && "selected"),
1405
1743
  onClick: props.onClick,
1406
- children: /* @__PURE__ */ jsx27("span", { children: props.name })
1744
+ children: /* @__PURE__ */ jsx30("span", { children: props.name })
1407
1745
  }
1408
1746
  ) })
1409
1747
  ] });
@@ -1411,9 +1749,9 @@ function Tab(props) {
1411
1749
 
1412
1750
  // src/components/TagList/TagList.tsx
1413
1751
  import { X as X2 } from "lucide-preact";
1414
- import { jsx as jsx28, jsxs as jsxs13 } from "preact/jsx-runtime";
1752
+ import { jsx as jsx31, jsxs as jsxs14 } from "preact/jsx-runtime";
1415
1753
  function TagList(props) {
1416
- return /* @__PURE__ */ jsx28("div", { class: "tag-list", children: resolveSignalish(props.tags).map((t) => /* @__PURE__ */ jsx28(
1754
+ return /* @__PURE__ */ jsx31("div", { class: "tag-list", children: resolveSignalish(props.tags).map((t) => /* @__PURE__ */ jsx31(
1417
1755
  Tag,
1418
1756
  {
1419
1757
  tag: t
@@ -1421,31 +1759,31 @@ function TagList(props) {
1421
1759
  )) });
1422
1760
  }
1423
1761
  function Tag(props) {
1424
- return /* @__PURE__ */ jsxs13("div", { class: addClass(
1762
+ return /* @__PURE__ */ jsxs14("div", { class: addClass(
1425
1763
  "tag",
1426
1764
  props.small && "small"
1427
1765
  ), children: [
1428
- /* @__PURE__ */ jsx28("span", { children: props.tag }),
1429
- props.onDelete && /* @__PURE__ */ jsx28("button", { onClick: props.onDelete, children: /* @__PURE__ */ jsx28(X2, { size: 13 }) })
1766
+ /* @__PURE__ */ jsx31("span", { children: props.tag }),
1767
+ props.onDelete && /* @__PURE__ */ jsx31("button", { onClick: props.onDelete, children: /* @__PURE__ */ jsx31(X2, { size: 13 }) })
1430
1768
  ] });
1431
1769
  }
1432
1770
 
1433
1771
  // src/components/TagList/TagListInput.tsx
1434
- import { useSignal as useSignal11 } from "@preact/signals";
1772
+ import { useSignal as useSignal13 } from "@preact/signals";
1435
1773
  import { useRef as useRef9, useState as useState4 } from "preact/hooks";
1436
- import { jsx as jsx29, jsxs as jsxs14 } from "preact/jsx-runtime";
1774
+ import { jsx as jsx32, jsxs as jsxs15 } from "preact/jsx-runtime";
1437
1775
  function TagListInput(props) {
1438
1776
  let value;
1439
1777
  if (props.value == null)
1440
- value = useSignal11([]);
1778
+ value = useSignal13([]);
1441
1779
  else if (isSignal(props.value))
1442
1780
  value = props.value;
1443
1781
  else
1444
- value = useSignal11(props.value);
1782
+ value = useSignal13(props.value);
1445
1783
  const inputRef = useRef9();
1446
1784
  const [inputValue, setInputValue] = useState4("");
1447
- return /* @__PURE__ */ jsxs14("div", { class: "tag-list", children: [
1448
- value.value.map((t, i) => /* @__PURE__ */ jsx29(
1785
+ return /* @__PURE__ */ jsxs15("div", { class: "tag-list", children: [
1786
+ value.value.map((t, i) => /* @__PURE__ */ jsx32(
1449
1787
  Tag,
1450
1788
  {
1451
1789
  tag: t,
@@ -1457,7 +1795,7 @@ function TagListInput(props) {
1457
1795
  }
1458
1796
  }
1459
1797
  )),
1460
- /* @__PURE__ */ jsx29(
1798
+ /* @__PURE__ */ jsx32(
1461
1799
  "input",
1462
1800
  {
1463
1801
  ref: inputRef,
@@ -1489,12 +1827,82 @@ function TagListInput(props) {
1489
1827
  ] });
1490
1828
  }
1491
1829
 
1830
+ // src/components/Toast/Toast.tsx
1831
+ import { createContext as createContext2 } from "preact";
1832
+ import { useContext as useContext2, useEffect as useEffect8, useRef as useRef10, useState as useState5 } from "preact/hooks";
1833
+ import { jsx as jsx33, jsxs as jsxs16 } from "preact/jsx-runtime";
1834
+ var ToastContext = createContext2(null);
1835
+ var nextToastId = 0;
1836
+ function useToast() {
1837
+ const context = useContext2(ToastContext);
1838
+ if (!context) {
1839
+ throw new Error("useToast() must be used inside a ToastContainer");
1840
+ }
1841
+ return context;
1842
+ }
1843
+ function ToastContainer(props) {
1844
+ const [toasts, setToasts] = useState5([]);
1845
+ const timers = useRef10(/* @__PURE__ */ new Set());
1846
+ useEffect8(() => () => {
1847
+ for (const timer of timers.current)
1848
+ window.clearTimeout(timer);
1849
+ timers.current.clear();
1850
+ }, []);
1851
+ function schedule(callback, delay) {
1852
+ const timer = window.setTimeout(() => {
1853
+ timers.current.delete(timer);
1854
+ callback();
1855
+ }, delay);
1856
+ timers.current.add(timer);
1857
+ }
1858
+ function show(text, status, duration = 3e3) {
1859
+ const id = nextToastId++;
1860
+ setToasts((current) => [
1861
+ ...current,
1862
+ {
1863
+ id,
1864
+ text,
1865
+ status,
1866
+ duration,
1867
+ fading: false
1868
+ }
1869
+ ]);
1870
+ schedule(() => {
1871
+ setToasts(
1872
+ (current) => current.map(
1873
+ (toast) => toast.id === id ? { ...toast, fading: true } : toast
1874
+ )
1875
+ );
1876
+ }, duration);
1877
+ schedule(() => {
1878
+ setToasts(
1879
+ (current) => current.filter((toast) => toast.id !== id)
1880
+ );
1881
+ }, duration + 300);
1882
+ }
1883
+ return /* @__PURE__ */ jsxs16(ToastContext.Provider, { value: { show }, children: [
1884
+ props.children,
1885
+ /* @__PURE__ */ jsx33(Container, { class: "toast-container", children: toasts.map((toast) => /* @__PURE__ */ jsx33(
1886
+ Container,
1887
+ {
1888
+ class: addClass(
1889
+ "toast",
1890
+ toast.status,
1891
+ toast.fading && "fading"
1892
+ ),
1893
+ children: toast.text
1894
+ },
1895
+ toast.id
1896
+ )) })
1897
+ ] });
1898
+ }
1899
+
1492
1900
  // 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";
1901
+ import { useEffect as useEffect9, useRef as useRef11, useState as useState6 } from "preact/hooks";
1902
+ import { jsx as jsx34, jsxs as jsxs17 } from "preact/jsx-runtime";
1495
1903
  function UploadBox(props) {
1496
- const inputRef = useRef10(null);
1497
- const [dragging, setDragging] = useState5(false);
1904
+ const inputRef = useRef11(null);
1905
+ const [dragging, setDragging] = useState6(false);
1498
1906
  function handleFiles(files) {
1499
1907
  files = Array.from(files);
1500
1908
  if (!props.addFile)
@@ -1504,7 +1912,7 @@ function UploadBox(props) {
1504
1912
  ;
1505
1913
  }
1506
1914
  }
1507
- useEffect6(() => {
1915
+ useEffect9(() => {
1508
1916
  const onPaste = (e) => {
1509
1917
  const files = e.clipboardData?.files;
1510
1918
  if (files && files.length > 0)
@@ -1515,7 +1923,7 @@ function UploadBox(props) {
1515
1923
  window.removeEventListener("paste", onPaste);
1516
1924
  };
1517
1925
  }, []);
1518
- return /* @__PURE__ */ jsxs15(
1926
+ return /* @__PURE__ */ jsxs17(
1519
1927
  "div",
1520
1928
  {
1521
1929
  class: addClass(
@@ -1544,7 +1952,7 @@ function UploadBox(props) {
1544
1952
  handleFiles(e.dataTransfer.files);
1545
1953
  },
1546
1954
  children: [
1547
- /* @__PURE__ */ jsx30(
1955
+ /* @__PURE__ */ jsx34(
1548
1956
  "input",
1549
1957
  {
1550
1958
  ref: inputRef,
@@ -1567,9 +1975,9 @@ function UploadBox(props) {
1567
1975
  }
1568
1976
 
1569
1977
  // src/components/WrapList/WrapList.tsx
1570
- import { jsx as jsx31 } from "preact/jsx-runtime";
1978
+ import { jsx as jsx35 } from "preact/jsx-runtime";
1571
1979
  function WrapList(props) {
1572
- return /* @__PURE__ */ jsx31(
1980
+ return /* @__PURE__ */ jsx35(
1573
1981
  "div",
1574
1982
  {
1575
1983
  class: "wrap-list",
@@ -1601,7 +2009,10 @@ export {
1601
2009
  PopoutTextIconButton,
1602
2010
  Input,
1603
2011
  CalendarInput,
2012
+ Checkbox,
1604
2013
  ClickFade,
2014
+ Text,
2015
+ ColorPicker,
1605
2016
  If,
1606
2017
  Switch,
1607
2018
  Case,
@@ -1609,7 +2020,6 @@ export {
1609
2020
  Then,
1610
2021
  Else,
1611
2022
  Content,
1612
- Text,
1613
2023
  closeContextMenu,
1614
2024
  openContextMenu,
1615
2025
  openContextMenuOn,
@@ -1628,6 +2038,9 @@ export {
1628
2038
  Textarea,
1629
2039
  Throbber,
1630
2040
  Loading,
2041
+ showModal,
2042
+ closeModal,
2043
+ ModalHost,
1631
2044
  PathInput,
1632
2045
  SelectBox,
1633
2046
  Seperator,
@@ -1642,6 +2055,8 @@ export {
1642
2055
  TagList,
1643
2056
  Tag,
1644
2057
  TagListInput,
2058
+ useToast,
2059
+ ToastContainer,
1645
2060
  UploadBox,
1646
2061
  WrapList
1647
2062
  };