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.
@@ -112,16 +112,6 @@ function tryExtractName(file) {
112
112
  }
113
113
  var iterate = (count, func) => Array(count).fill(null).map((_, i) => func != null ? func(i) : void 0);
114
114
 
115
- // src/common/state.ts
116
- import { signal } from "@preact/signals";
117
- var isMobile = () => typeof window !== "undefined" && window.innerWidth < 800;
118
- var MOBILE = signal(isMobile());
119
- if (typeof window !== "undefined") {
120
- window.addEventListener("resize", () => {
121
- MOBILE.value = isMobile();
122
- });
123
- }
124
-
125
115
  export {
126
116
  addClass,
127
117
  addTitle,
@@ -139,6 +129,5 @@ export {
139
129
  addExt,
140
130
  removeDuplicates,
141
131
  tryExtractName,
142
- iterate,
143
- MOBILE
132
+ iterate
144
133
  };
@@ -0,0 +1,13 @@
1
+ // src/common/state.ts
2
+ import { signal } from "@preact/signals";
3
+ var isMobile = () => typeof window !== "undefined" && window.innerWidth < 800;
4
+ var MOBILE = signal(isMobile());
5
+ if (typeof window !== "undefined") {
6
+ window.addEventListener("resize", () => {
7
+ MOBILE.value = isMobile();
8
+ });
9
+ }
10
+
11
+ export {
12
+ MOBILE
13
+ };
@@ -1,6 +1,7 @@
1
- import "../chunk-TUAWAX6H.js";
2
1
  import {
3
- MOBILE,
2
+ MOBILE
3
+ } from "../chunk-AYIC7DTZ.js";
4
+ import {
4
5
  addClass,
5
6
  addExt,
6
7
  addStyles,
@@ -18,7 +19,7 @@ import {
18
19
  splitPath,
19
20
  syncWrap,
20
21
  tryExtractName
21
- } from "../chunk-CE4YXNWV.js";
22
+ } from "../chunk-4SMIDGNR.js";
22
23
  export {
23
24
  MOBILE,
24
25
  addClass,
@@ -278,6 +278,45 @@ a.button {
278
278
  }
279
279
  }
280
280
 
281
+ /* src/components/Checkbox/style.css */
282
+ .checkbox {
283
+ width: 25px;
284
+ height: 25px;
285
+ display: flex;
286
+ align-items: center;
287
+ justify-content: center;
288
+ background: var(--prim);
289
+ border-radius: 8px;
290
+ &:hover {
291
+ background: var(--prim-hover);
292
+ }
293
+ &.checked > svg {
294
+ transform: scale(1) rotateZ(360deg);
295
+ }
296
+ &.small {
297
+ width: 20px;
298
+ height: 20px;
299
+ > svg {
300
+ width: 12px;
301
+ height: 12px;
302
+ }
303
+ }
304
+ > svg {
305
+ stroke-width: 3px;
306
+ transition: transform var(--transition-medium);
307
+ transform-style: preserve-3d;
308
+ transform: scale(0) rotateZ(calc(360deg - 90deg));
309
+ }
310
+ }
311
+ .popout {
312
+ .checkbox {
313
+ background: var(--seco);
314
+ &:hover {
315
+ background: var(--seco-hover);
316
+ }
317
+ }
318
+ }
319
+
281
320
  /* src/components/ClickFade/style.css */
282
321
  .click-faded {
283
322
  position: relative;
@@ -309,6 +348,124 @@ a.button {
309
348
  }
310
349
  }
311
350
 
351
+ /* src/components/Text/style.css */
352
+ .text {
353
+ &.dim {
354
+ color: var(--text-dim);
355
+ }
356
+ &.dark {
357
+ color: var(--text-dark);
358
+ }
359
+ &.bold {
360
+ font-weight: bold;
361
+ }
362
+ &.big {
363
+ font-size: var(--font-size-big);
364
+ }
365
+ &.extra-big {
366
+ font-size: var(--font-size-extra-big);
367
+ }
368
+ &.big,
369
+ &.extra-big {
370
+ font-weight: bold;
371
+ font-family: "Lexend";
372
+ }
373
+ }
374
+
375
+ /* src/components/ColorPicker/style.css */
376
+ .color-picker {
377
+ > .button {
378
+ > .container {
379
+ display: block;
380
+ flex: 0 0 auto;
381
+ width: 19px;
382
+ height: 19px;
383
+ border: 1px solid var(--back-border);
384
+ border-radius: 5px;
385
+ }
386
+ }
387
+ }
388
+ .color-picker-popout {
389
+ width: 240px;
390
+ padding: 12px;
391
+ > .container {
392
+ gap: 12px;
393
+ }
394
+ .square {
395
+ position: relative;
396
+ width: 100%;
397
+ aspect-ratio: 1;
398
+ overflow: hidden;
399
+ border-radius: 7px;
400
+ cursor: crosshair;
401
+ touch-action: none;
402
+ background-image:
403
+ linear-gradient(
404
+ to bottom,
405
+ transparent,
406
+ #000),
407
+ linear-gradient(
408
+ to right,
409
+ #fff,
410
+ transparent);
411
+ > .container {
412
+ position: absolute;
413
+ width: 13px;
414
+ height: 13px;
415
+ border: 2px solid #fff;
416
+ border-radius: 50%;
417
+ box-shadow: 0 0 0 1px #0008, 0 1px 3px #0008;
418
+ transform: translate(-50%, -50%);
419
+ pointer-events: none;
420
+ }
421
+ }
422
+ .hue {
423
+ position: relative;
424
+ height: 14px;
425
+ border-radius: 99px;
426
+ cursor: pointer;
427
+ touch-action: none;
428
+ background:
429
+ linear-gradient(
430
+ to right,
431
+ #f00 0%,
432
+ #ff0 16.666%,
433
+ #0f0 33.333%,
434
+ #0ff 50%,
435
+ #00f 66.666%,
436
+ #f0f 83.333%,
437
+ #f00 100%);
438
+ > .container {
439
+ position: absolute;
440
+ top: 50%;
441
+ width: 18px;
442
+ height: 18px;
443
+ border: 2px solid #fff;
444
+ border-radius: 50%;
445
+ box-shadow: 0 0 0 1px #0008, 0 1px 3px #0008;
446
+ transform: translate(-50%, -50%);
447
+ pointer-events: none;
448
+ }
449
+ }
450
+ .hex-row {
451
+ gap: 9px;
452
+ > .container {
453
+ flex: 0 0 auto;
454
+ width: 29px;
455
+ height: 29px;
456
+ border: 1px solid var(--back-border);
457
+ border-radius: 5px;
458
+ }
459
+ > .input {
460
+ flex: 1;
461
+ min-width: 0;
462
+ padding: 6px 9px;
463
+ font-family: monospace;
464
+ text-transform: uppercase;
465
+ }
466
+ }
467
+ }
468
+
312
469
  /* src/components/Content/style.css */
313
470
  #app > div > main > main {
314
471
  flex: 1;
@@ -342,27 +499,6 @@ a.button {
342
499
  }
343
500
  }
344
501
 
345
- /* src/components/Text/style.css */
346
- .text {
347
- &.dim {
348
- color: var(--text-dim);
349
- }
350
- &.dark {
351
- color: var(--text-dark);
352
- }
353
- &.big {
354
- font-size: var(--font-size-big);
355
- }
356
- &.extra-big {
357
- font-size: var(--font-size-extra-big);
358
- }
359
- &.big,
360
- &.extra-big {
361
- font-weight: bold;
362
- font-family: "Lexend";
363
- }
364
- }
365
-
366
502
  /* src/components/ContextMenu/style.css */
367
503
  .context-menu {
368
504
  z-index: 1000;
@@ -478,6 +614,32 @@ a.button {
478
614
  align-items: center;
479
615
  }
480
616
 
617
+ /* src/components/Modal/style.css */
618
+ .modal-container {
619
+ position: fixed;
620
+ inset: 0;
621
+ z-index: 1000;
622
+ display: flex;
623
+ align-items: center;
624
+ justify-content: center;
625
+ background: var(--shadow-strong);
626
+ > div {
627
+ background: var(--prim);
628
+ border: 1px solid var(--prim-border);
629
+ border-radius: 15px;
630
+ padding: 20px;
631
+ }
632
+ animation: modal-backdrop-in var(--transition-normal) ease-out;
633
+ }
634
+ @keyframes modal-backdrop-in {
635
+ from {
636
+ opacity: 0;
637
+ }
638
+ to {
639
+ opacity: 1;
640
+ }
641
+ }
642
+
481
643
  /* src/components/PathInput/style.css */
482
644
  .path-input {
483
645
  padding: 3px;
@@ -690,6 +852,41 @@ a.button {
690
852
  }
691
853
  }
692
854
 
855
+ /* src/components/Toast/style.css */
856
+ .toast-container {
857
+ position: fixed;
858
+ top: 20px;
859
+ left: 50%;
860
+ transform: translateX(-50%);
861
+ display: flex;
862
+ flex-direction: column;
863
+ gap: 8px;
864
+ z-index: 1000;
865
+ }
866
+ .toast {
867
+ padding: 10px 16px;
868
+ background: var(--prim);
869
+ border-radius: 8px;
870
+ border: 1px solid var(--prim-border);
871
+ box-shadow: var(--shadow);
872
+ font-weight: bold;
873
+ transition: opacity 300ms ease, transform 300ms ease;
874
+ &.correct {
875
+ background: var(--correct);
876
+ border-color: var(--correct-border);
877
+ color: var(--text-on-light);
878
+ }
879
+ &.error {
880
+ background: var(--danger);
881
+ border-color: var(--danger-border);
882
+ color: var(--text-on-light);
883
+ }
884
+ &.fading {
885
+ opacity: 0;
886
+ transform: translateY(-4px);
887
+ }
888
+ }
889
+
693
890
  /* src/components/UploadBox/style.css */
694
891
  .upload-box {
695
892
  display: flex;
@@ -1,5 +1,5 @@
1
1
  import * as preact from 'preact';
2
- import { ComponentChildren, JSX, ComponentChild, ComponentProps, Ref } from 'preact';
2
+ import { ComponentChildren, JSX, ComponentChild, ComponentProps, CSSProperties, Ref } from 'preact';
3
3
  import { Signal } from '@preact/signals';
4
4
  import { S as Signalish, O as Option, C as CalendarDate, a as MaybeFunc, F as FileCategory, M as MaybeAsyncFunc, b as MaybeLoaded, c as MimeType } from '../mime-rhdyiokw.js';
5
5
  import { C as Comparable, n as nullish } from '../misc-BNzd_rCz.js';
@@ -56,6 +56,14 @@ declare function CalendarInput(props: {
56
56
  class?: string;
57
57
  }): preact.JSX.Element;
58
58
 
59
+ declare function Checkbox(props: {
60
+ value?: Signalish<boolean>;
61
+ onChange?: (value: boolean) => void;
62
+ dirty?: Signal<boolean>;
63
+ small?: boolean;
64
+ class?: string;
65
+ }): preact.JSX.Element;
66
+
59
67
  declare function ClickFade(props: {
60
68
  faded?: Signalish<boolean>;
61
69
  before: MaybeFunc<ComponentChild>;
@@ -63,6 +71,16 @@ declare function ClickFade(props: {
63
71
  onFade?: () => void;
64
72
  }): preact.JSX.Element;
65
73
 
74
+ declare function ColorPicker(props: {
75
+ value?: Signalish<string>;
76
+ onChange?: (value: string) => void;
77
+ dirty?: Signal<boolean>;
78
+ class?: string;
79
+ buttonClass?: string;
80
+ disabled?: boolean;
81
+ title?: string;
82
+ }): preact.JSX.Element;
83
+
66
84
  declare function If(props: {
67
85
  cond: MaybeFunc<Signalish<any>>;
68
86
  children?: MaybeFunc<ComponentChildren>;
@@ -185,6 +203,7 @@ declare function Image(props: {
185
203
  max_size?: number;
186
204
  class?: string;
187
205
  lazy?: boolean;
206
+ style?: CSSProperties;
188
207
  }): preact.JSX.Element;
189
208
 
190
209
  declare function ImageInput(props: {
@@ -229,6 +248,17 @@ declare function Loading(props: {
229
248
  class?: string;
230
249
  }): string | number | bigint | boolean | object | null;
231
250
 
251
+ declare function showModal<T>(content: (props: {
252
+ data: T;
253
+ }) => ComponentChildren, options?: {
254
+ closeOnBackdrop?: boolean;
255
+ data?: T;
256
+ }): {
257
+ close(): void;
258
+ };
259
+ declare function closeModal(): void;
260
+ declare function ModalHost(): preact.VNode<any> | null;
261
+
232
262
  declare function PathInput(props: {
233
263
  value?: Signalish<string>;
234
264
  editing?: Signal<boolean>;
@@ -244,13 +274,14 @@ type PopoutProps = {
244
274
  popoutClass?: string;
245
275
  children?: ComponentChildren;
246
276
  popout: () => ComponentChild;
277
+ top?: boolean;
278
+ unlockedWidth?: boolean;
247
279
  };
248
280
  declare function PopoutContainer(props: PopoutProps): preact.JSX.Element;
249
281
  type PopoutButtonProps = {
250
282
  buttonClass?: string;
251
283
  disabled?: boolean;
252
284
  extraPadding?: boolean;
253
- somePadding?: boolean;
254
285
  centered?: boolean;
255
286
  variant?: ButtonVariant;
256
287
  title?: string;
@@ -357,6 +388,23 @@ declare function Throbber(props: {
357
388
  size?: number;
358
389
  }): preact.JSX.Element;
359
390
 
391
+ type ToastStatus = "correct" | "error";
392
+ type Toast = {
393
+ id: number;
394
+ text: ComponentChildren;
395
+ status?: ToastStatus;
396
+ duration: number;
397
+ fading: boolean;
398
+ };
399
+ type ToastContext = {
400
+ show: (text: ComponentChildren, status?: ToastStatus, duration?: number) => void;
401
+ };
402
+ declare const ToastContext: preact.Context<ToastContext | null>;
403
+ declare function useToast(): ToastContext;
404
+ declare function ToastContainer(props: {
405
+ children?: ComponentChildren;
406
+ }): preact.JSX.Element;
407
+
360
408
  declare function UploadBox(props: {
361
409
  addFile?: (file: File) => void;
362
410
  mime?: MimeType[];
@@ -369,4 +417,4 @@ declare function WrapList(props: {
369
417
  min_size?: number;
370
418
  }): preact.JSX.Element;
371
419
 
372
- export { AsideContainer, Branch, Button, type ButtonProps, type ButtonVariant, CalendarInput, Case, ClickFade, Container, type ContainerProps, Content, type ContextMenuItem, type ContextMenuPosition, DotSeperator, Else, FileIcon, FilePath, FooterContainer, FormalInput, Header1, Header2, Header3, HeaderContainer, IconButton, IconLinkButton, If, Image, ImageInput, Input, Label, LinkButton, type LinkButtonProps, type Loaded, Loading, MainContainer, MiniHeader, PathInput, type PopoutButtonProps, PopoutContainer, PopoutIconButton, type PopoutProps, PopoutTextButton, PopoutTextIconButton, SelectBox, Seperator, Slider, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, Tag, TagList, TagListInput, Text, TextButton, TextIconButton, TextIconLinkButton, TextLinkButton, Textarea, Then, Throbber, UploadBox, WrapList, closeContextMenu, getFileIcon, openContextMenu, openContextMenuOn };
420
+ export { AsideContainer, Branch, Button, type ButtonProps, type ButtonVariant, CalendarInput, Case, Checkbox, ClickFade, ColorPicker, Container, type ContainerProps, Content, type ContextMenuItem, type ContextMenuPosition, DotSeperator, Else, FileIcon, FilePath, FooterContainer, FormalInput, Header1, Header2, Header3, HeaderContainer, IconButton, IconLinkButton, If, Image, ImageInput, Input, Label, LinkButton, type LinkButtonProps, type Loaded, Loading, MainContainer, MiniHeader, ModalHost, PathInput, type PopoutButtonProps, PopoutContainer, PopoutIconButton, type PopoutProps, PopoutTextButton, PopoutTextIconButton, SelectBox, Seperator, Slider, Switch, Table, TableBody, TableCell, TableHead, TableHeader, TableRow, Tabs, Tag, TagList, TagListInput, Text, TextButton, TextIconButton, TextIconLinkButton, TextLinkButton, Textarea, Then, Throbber, type Toast, ToastContainer, type ToastStatus, UploadBox, WrapList, closeContextMenu, closeModal, getFileIcon, openContextMenu, openContextMenuOn, showModal, useToast };
@@ -4,7 +4,9 @@ import {
4
4
  Button,
5
5
  CalendarInput,
6
6
  Case,
7
+ Checkbox,
7
8
  ClickFade,
9
+ ColorPicker,
8
10
  Container,
9
11
  Content,
10
12
  DotSeperator,
@@ -28,6 +30,7 @@ import {
28
30
  Loading,
29
31
  MainContainer,
30
32
  MiniHeader,
33
+ ModalHost,
31
34
  PathInput,
32
35
  PopoutContainer,
33
36
  PopoutIconButton,
@@ -55,14 +58,18 @@ import {
55
58
  Textarea,
56
59
  Then,
57
60
  Throbber,
61
+ ToastContainer,
58
62
  UploadBox,
59
63
  WrapList,
60
64
  closeContextMenu,
65
+ closeModal,
61
66
  getFileIcon,
62
67
  openContextMenu,
63
- openContextMenuOn
64
- } from "../chunk-G343EGOL.js";
65
- import "../chunk-CE4YXNWV.js";
68
+ openContextMenuOn,
69
+ showModal,
70
+ useToast
71
+ } from "../chunk-46MFYRTI.js";
72
+ import "../chunk-4SMIDGNR.js";
66
73
  import "../chunk-6G3G7N5D.js";
67
74
  export {
68
75
  AsideContainer,
@@ -70,7 +77,9 @@ export {
70
77
  Button,
71
78
  CalendarInput,
72
79
  Case,
80
+ Checkbox,
73
81
  ClickFade,
82
+ ColorPicker,
74
83
  Container,
75
84
  Content,
76
85
  DotSeperator,
@@ -94,6 +103,7 @@ export {
94
103
  Loading,
95
104
  MainContainer,
96
105
  MiniHeader,
106
+ ModalHost,
97
107
  PathInput,
98
108
  PopoutContainer,
99
109
  PopoutIconButton,
@@ -121,10 +131,14 @@ export {
121
131
  Textarea,
122
132
  Then,
123
133
  Throbber,
134
+ ToastContainer,
124
135
  UploadBox,
125
136
  WrapList,
126
137
  closeContextMenu,
138
+ closeModal,
127
139
  getFileIcon,
128
140
  openContextMenu,
129
- openContextMenuOn
141
+ openContextMenuOn,
142
+ showModal,
143
+ useToast
130
144
  };