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.
package/dist/index.css CHANGED
@@ -24,6 +24,7 @@
24
24
  --back-border: #232323;
25
25
  --prim-border: #262626;
26
26
  --shadow: #0a0a0a45;
27
+ --shadow-strong: #0a0a0a9a;
27
28
  --shadow-raised: 1px 4px 10px 0px var(--shadow);
28
29
  --transition-fast: .1s;
29
30
  --transition-normal: .2s;
@@ -389,6 +390,45 @@ a.button {
389
390
  }
390
391
  }
391
392
 
393
+ /* src/components/Checkbox/style.css */
394
+ .checkbox {
395
+ width: 25px;
396
+ height: 25px;
397
+ display: flex;
398
+ align-items: center;
399
+ justify-content: center;
400
+ background: var(--prim);
401
+ border-radius: 8px;
402
+ &:hover {
403
+ background: var(--prim-hover);
404
+ }
405
+ &.checked > svg {
406
+ transform: scale(1) rotateZ(360deg);
407
+ }
408
+ &.small {
409
+ width: 20px;
410
+ height: 20px;
411
+ > svg {
412
+ width: 12px;
413
+ height: 12px;
414
+ }
415
+ }
416
+ > svg {
417
+ stroke-width: 3px;
418
+ transition: transform var(--transition-medium);
419
+ transform-style: preserve-3d;
420
+ transform: scale(0) rotateZ(calc(360deg - 90deg));
421
+ }
422
+ }
423
+ .popout {
424
+ .checkbox {
425
+ background: var(--seco);
426
+ &:hover {
427
+ background: var(--seco-hover);
428
+ }
429
+ }
430
+ }
431
+
392
432
  /* src/components/ClickFade/style.css */
393
433
  .click-faded {
394
434
  position: relative;
@@ -420,8 +460,126 @@ a.button {
420
460
  }
421
461
  }
422
462
 
463
+ /* src/components/Text/style.css */
464
+ .text {
465
+ &.dim {
466
+ color: var(--text-dim);
467
+ }
468
+ &.dark {
469
+ color: var(--text-dark);
470
+ }
471
+ &.bold {
472
+ font-weight: bold;
473
+ }
474
+ &.big {
475
+ font-size: var(--font-size-big);
476
+ }
477
+ &.extra-big {
478
+ font-size: var(--font-size-extra-big);
479
+ }
480
+ &.big,
481
+ &.extra-big {
482
+ font-weight: bold;
483
+ font-family: "Lexend";
484
+ }
485
+ }
486
+
487
+ /* src/components/ColorPicker/style.css */
488
+ .color-picker {
489
+ > .button {
490
+ > .container {
491
+ display: block;
492
+ flex: 0 0 auto;
493
+ width: 19px;
494
+ height: 19px;
495
+ border: 1px solid var(--back-border);
496
+ border-radius: 5px;
497
+ }
498
+ }
499
+ }
500
+ .color-picker-popout {
501
+ width: 240px;
502
+ padding: 12px;
503
+ > .container {
504
+ gap: 12px;
505
+ }
506
+ .square {
507
+ position: relative;
508
+ width: 100%;
509
+ aspect-ratio: 1;
510
+ overflow: hidden;
511
+ border-radius: 7px;
512
+ cursor: crosshair;
513
+ touch-action: none;
514
+ background-image:
515
+ linear-gradient(
516
+ to bottom,
517
+ transparent,
518
+ #000),
519
+ linear-gradient(
520
+ to right,
521
+ #fff,
522
+ transparent);
523
+ > .container {
524
+ position: absolute;
525
+ width: 13px;
526
+ height: 13px;
527
+ border: 2px solid #fff;
528
+ border-radius: 50%;
529
+ box-shadow: 0 0 0 1px #0008, 0 1px 3px #0008;
530
+ transform: translate(-50%, -50%);
531
+ pointer-events: none;
532
+ }
533
+ }
534
+ .hue {
535
+ position: relative;
536
+ height: 14px;
537
+ border-radius: 99px;
538
+ cursor: pointer;
539
+ touch-action: none;
540
+ background:
541
+ linear-gradient(
542
+ to right,
543
+ #f00 0%,
544
+ #ff0 16.666%,
545
+ #0f0 33.333%,
546
+ #0ff 50%,
547
+ #00f 66.666%,
548
+ #f0f 83.333%,
549
+ #f00 100%);
550
+ > .container {
551
+ position: absolute;
552
+ top: 50%;
553
+ width: 18px;
554
+ height: 18px;
555
+ border: 2px solid #fff;
556
+ border-radius: 50%;
557
+ box-shadow: 0 0 0 1px #0008, 0 1px 3px #0008;
558
+ transform: translate(-50%, -50%);
559
+ pointer-events: none;
560
+ }
561
+ }
562
+ .hex-row {
563
+ gap: 9px;
564
+ > .container {
565
+ flex: 0 0 auto;
566
+ width: 29px;
567
+ height: 29px;
568
+ border: 1px solid var(--back-border);
569
+ border-radius: 5px;
570
+ }
571
+ > .input {
572
+ flex: 1;
573
+ min-width: 0;
574
+ padding: 6px 9px;
575
+ font-family: monospace;
576
+ text-transform: uppercase;
577
+ }
578
+ }
579
+ }
580
+
423
581
  /* src/components/Content/style.css */
424
- #app > div > main > main {
582
+ .content {
425
583
  flex: 1;
426
584
  display: flex;
427
585
  flex-direction: column;
@@ -453,27 +611,6 @@ a.button {
453
611
  }
454
612
  }
455
613
 
456
- /* src/components/Text/style.css */
457
- .text {
458
- &.dim {
459
- color: var(--text-dim);
460
- }
461
- &.dark {
462
- color: var(--text-dark);
463
- }
464
- &.big {
465
- font-size: var(--font-size-big);
466
- }
467
- &.extra-big {
468
- font-size: var(--font-size-extra-big);
469
- }
470
- &.big,
471
- &.extra-big {
472
- font-weight: bold;
473
- font-family: "Lexend";
474
- }
475
- }
476
-
477
614
  /* src/components/ContextMenu/style.css */
478
615
  .context-menu {
479
616
  z-index: 1000;
@@ -589,6 +726,32 @@ a.button {
589
726
  align-items: center;
590
727
  }
591
728
 
729
+ /* src/components/Modal/style.css */
730
+ .modal-container {
731
+ position: fixed;
732
+ inset: 0;
733
+ z-index: 1000;
734
+ display: flex;
735
+ align-items: center;
736
+ justify-content: center;
737
+ background: var(--shadow-strong);
738
+ > div {
739
+ background: var(--prim);
740
+ border: 1px solid var(--prim-border);
741
+ border-radius: 15px;
742
+ padding: 20px;
743
+ }
744
+ animation: modal-backdrop-in var(--transition-normal) ease-out;
745
+ }
746
+ @keyframes modal-backdrop-in {
747
+ from {
748
+ opacity: 0;
749
+ }
750
+ to {
751
+ opacity: 1;
752
+ }
753
+ }
754
+
592
755
  /* src/components/PathInput/style.css */
593
756
  .path-input {
594
757
  padding: 3px;
@@ -801,6 +964,41 @@ a.button {
801
964
  }
802
965
  }
803
966
 
967
+ /* src/components/Toast/style.css */
968
+ .toast-container {
969
+ position: fixed;
970
+ top: 20px;
971
+ left: 50%;
972
+ transform: translateX(-50%);
973
+ display: flex;
974
+ flex-direction: column;
975
+ gap: 8px;
976
+ z-index: 1000;
977
+ }
978
+ .toast {
979
+ padding: 10px 16px;
980
+ background: var(--prim);
981
+ border-radius: 8px;
982
+ border: 1px solid var(--prim-border);
983
+ box-shadow: var(--shadow);
984
+ font-weight: bold;
985
+ transition: opacity 300ms ease, transform 300ms ease;
986
+ &.correct {
987
+ background: var(--correct);
988
+ border-color: var(--correct-border);
989
+ color: var(--text-on-light);
990
+ }
991
+ &.error {
992
+ background: var(--danger);
993
+ border-color: var(--danger-border);
994
+ color: var(--text-on-light);
995
+ }
996
+ &.fading {
997
+ opacity: 0;
998
+ transform: translateY(-4px);
999
+ }
1000
+ }
1001
+
804
1002
  /* src/components/UploadBox/style.css */
805
1003
  .upload-box {
806
1004
  display: flex;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { AsideContainer, Branch, Button, ButtonProps, ButtonVariant, CalendarInput, Case, ClickFade, Container, ContainerProps, Content, ContextMenuItem, ContextMenuPosition, DotSeperator, Else, FileIcon, FilePath, FooterContainer, FormalInput, Header1, Header2, Header3, HeaderContainer, IconButton, IconLinkButton, If, Image, ImageInput, Input, Label, LinkButton, LinkButtonProps, Loaded, Loading, MainContainer, MiniHeader, PathInput, PopoutButtonProps, PopoutContainer, PopoutIconButton, 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 } from './components/index.js';
1
+ export { AsideContainer, Branch, Button, ButtonProps, ButtonVariant, CalendarInput, Case, Checkbox, ClickFade, ColorPicker, Container, ContainerProps, Content, ContextMenuItem, ContextMenuPosition, DotSeperator, Else, FileIcon, FilePath, FooterContainer, FormalInput, Header1, Header2, Header3, HeaderContainer, IconButton, IconLinkButton, If, Image, ImageInput, Input, Label, LinkButton, LinkButtonProps, Loaded, Loading, MainContainer, MiniHeader, ModalHost, PathInput, PopoutButtonProps, PopoutContainer, PopoutIconButton, 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, Toast, ToastContainer, ToastStatus, UploadBox, WrapList, closeContextMenu, closeModal, getFileIcon, openContextMenu, openContextMenuOn, showModal, useToast } from './components/index.js';
2
2
  export { C as CalendarDate, F as FileCategory, M as MaybeAsyncFunc, a as MaybeFunc, b as MaybeLoaded, c as MimeType, O as Option, S as Signalish, d as audioMimeTypes, e as convertPossibleNullishSignalToMaybeLoaded, f as convertPossibleNullishToMaybeLoaded, i as imageMimeTypes, g as isMaybeLoaded, h as isMime, j as isSignal, l as loaded, m as maybeLoadedIsLoaded, k as maybeLoadedIsNotLoaded, n as maybeLoadedMap, o as maybeLoadedUnwrap, p as notLoaded, q as peekSignalish, r as resolveMaybeAsyncFunc, s as resolveMaybeFunc, t as resolveSignalish } from './mime-rhdyiokw.js';
3
3
  export { C as Comparable, n as nullish } from './misc-BNzd_rCz.js';
4
4
  export { Result, Uuid, err, generateUuid, isResult, isUuid, ok, resultEqual, resultIsErr, resultIsOk, resultMap, resultMapErr, resultUnwrap, resultUnwrapErr } from './types/index.js';
package/dist/index.js CHANGED
@@ -1,11 +1,15 @@
1
- import "./chunk-TUAWAX6H.js";
1
+ import {
2
+ MOBILE
3
+ } from "./chunk-AYIC7DTZ.js";
2
4
  import {
3
5
  AsideContainer,
4
6
  Branch,
5
7
  Button,
6
8
  CalendarInput,
7
9
  Case,
10
+ Checkbox,
8
11
  ClickFade,
12
+ ColorPicker,
9
13
  Container,
10
14
  Content,
11
15
  DotSeperator,
@@ -29,6 +33,7 @@ import {
29
33
  Loading,
30
34
  MainContainer,
31
35
  MiniHeader,
36
+ ModalHost,
32
37
  PathInput,
33
38
  PopoutContainer,
34
39
  PopoutIconButton,
@@ -56,15 +61,18 @@ import {
56
61
  Textarea,
57
62
  Then,
58
63
  Throbber,
64
+ ToastContainer,
59
65
  UploadBox,
60
66
  WrapList,
61
67
  closeContextMenu,
68
+ closeModal,
62
69
  getFileIcon,
63
70
  openContextMenu,
64
- openContextMenuOn
65
- } from "./chunk-G343EGOL.js";
71
+ openContextMenuOn,
72
+ showModal,
73
+ useToast
74
+ } from "./chunk-2S7QGUTX.js";
66
75
  import {
67
- MOBILE,
68
76
  addClass,
69
77
  addExt,
70
78
  addStyles,
@@ -82,7 +90,7 @@ import {
82
90
  splitPath,
83
91
  syncWrap,
84
92
  tryExtractName
85
- } from "./chunk-CE4YXNWV.js";
93
+ } from "./chunk-4SMIDGNR.js";
86
94
  import {
87
95
  audioMimeTypes,
88
96
  err,
@@ -124,7 +132,9 @@ export {
124
132
  CalendarDate,
125
133
  CalendarInput,
126
134
  Case,
135
+ Checkbox,
127
136
  ClickFade,
137
+ ColorPicker,
128
138
  Container,
129
139
  Content,
130
140
  DotSeperator,
@@ -149,6 +159,7 @@ export {
149
159
  MOBILE,
150
160
  MainContainer,
151
161
  MiniHeader,
162
+ ModalHost,
152
163
  PathInput,
153
164
  PopoutContainer,
154
165
  PopoutIconButton,
@@ -176,6 +187,7 @@ export {
176
187
  Textarea,
177
188
  Then,
178
189
  Throbber,
190
+ ToastContainer,
179
191
  UploadBox,
180
192
  WrapList,
181
193
  addClass,
@@ -185,6 +197,7 @@ export {
185
197
  audioMimeTypes,
186
198
  calcHeight,
187
199
  closeContextMenu,
200
+ closeModal,
188
201
  convertPossibleNullishSignalToMaybeLoaded,
189
202
  convertPossibleNullishToMaybeLoaded,
190
203
  createQuery,
@@ -224,8 +237,10 @@ export {
224
237
  resultMapErr,
225
238
  resultUnwrap,
226
239
  resultUnwrapErr,
240
+ showModal,
227
241
  splitFilePath,
228
242
  splitPath,
229
243
  syncWrap,
230
- tryExtractName
244
+ tryExtractName,
245
+ useToast
231
246
  };
package/dist/style.css CHANGED
@@ -24,6 +24,7 @@
24
24
  --back-border: #232323;
25
25
  --prim-border: #262626;
26
26
  --shadow: #0a0a0a45;
27
+ --shadow-strong: #0a0a0a9a;
27
28
  --shadow-raised: 1px 4px 10px 0px var(--shadow);
28
29
  --transition-fast: .1s;
29
30
  --transition-normal: .2s;
@@ -389,6 +390,45 @@ a.button {
389
390
  }
390
391
  }
391
392
 
393
+ /* src/components/Checkbox/style.css */
394
+ .checkbox {
395
+ width: 25px;
396
+ height: 25px;
397
+ display: flex;
398
+ align-items: center;
399
+ justify-content: center;
400
+ background: var(--prim);
401
+ border-radius: 8px;
402
+ &:hover {
403
+ background: var(--prim-hover);
404
+ }
405
+ &.checked > svg {
406
+ transform: scale(1) rotateZ(360deg);
407
+ }
408
+ &.small {
409
+ width: 20px;
410
+ height: 20px;
411
+ > svg {
412
+ width: 12px;
413
+ height: 12px;
414
+ }
415
+ }
416
+ > svg {
417
+ stroke-width: 3px;
418
+ transition: transform var(--transition-medium);
419
+ transform-style: preserve-3d;
420
+ transform: scale(0) rotateZ(calc(360deg - 90deg));
421
+ }
422
+ }
423
+ .popout {
424
+ .checkbox {
425
+ background: var(--seco);
426
+ &:hover {
427
+ background: var(--seco-hover);
428
+ }
429
+ }
430
+ }
431
+
392
432
  /* src/components/ClickFade/style.css */
393
433
  .click-faded {
394
434
  position: relative;
@@ -420,8 +460,126 @@ a.button {
420
460
  }
421
461
  }
422
462
 
463
+ /* src/components/Text/style.css */
464
+ .text {
465
+ &.dim {
466
+ color: var(--text-dim);
467
+ }
468
+ &.dark {
469
+ color: var(--text-dark);
470
+ }
471
+ &.bold {
472
+ font-weight: bold;
473
+ }
474
+ &.big {
475
+ font-size: var(--font-size-big);
476
+ }
477
+ &.extra-big {
478
+ font-size: var(--font-size-extra-big);
479
+ }
480
+ &.big,
481
+ &.extra-big {
482
+ font-weight: bold;
483
+ font-family: "Lexend";
484
+ }
485
+ }
486
+
487
+ /* src/components/ColorPicker/style.css */
488
+ .color-picker {
489
+ > .button {
490
+ > .container {
491
+ display: block;
492
+ flex: 0 0 auto;
493
+ width: 19px;
494
+ height: 19px;
495
+ border: 1px solid var(--back-border);
496
+ border-radius: 5px;
497
+ }
498
+ }
499
+ }
500
+ .color-picker-popout {
501
+ width: 240px;
502
+ padding: 12px;
503
+ > .container {
504
+ gap: 12px;
505
+ }
506
+ .square {
507
+ position: relative;
508
+ width: 100%;
509
+ aspect-ratio: 1;
510
+ overflow: hidden;
511
+ border-radius: 7px;
512
+ cursor: crosshair;
513
+ touch-action: none;
514
+ background-image:
515
+ linear-gradient(
516
+ to bottom,
517
+ transparent,
518
+ #000),
519
+ linear-gradient(
520
+ to right,
521
+ #fff,
522
+ transparent);
523
+ > .container {
524
+ position: absolute;
525
+ width: 13px;
526
+ height: 13px;
527
+ border: 2px solid #fff;
528
+ border-radius: 50%;
529
+ box-shadow: 0 0 0 1px #0008, 0 1px 3px #0008;
530
+ transform: translate(-50%, -50%);
531
+ pointer-events: none;
532
+ }
533
+ }
534
+ .hue {
535
+ position: relative;
536
+ height: 14px;
537
+ border-radius: 99px;
538
+ cursor: pointer;
539
+ touch-action: none;
540
+ background:
541
+ linear-gradient(
542
+ to right,
543
+ #f00 0%,
544
+ #ff0 16.666%,
545
+ #0f0 33.333%,
546
+ #0ff 50%,
547
+ #00f 66.666%,
548
+ #f0f 83.333%,
549
+ #f00 100%);
550
+ > .container {
551
+ position: absolute;
552
+ top: 50%;
553
+ width: 18px;
554
+ height: 18px;
555
+ border: 2px solid #fff;
556
+ border-radius: 50%;
557
+ box-shadow: 0 0 0 1px #0008, 0 1px 3px #0008;
558
+ transform: translate(-50%, -50%);
559
+ pointer-events: none;
560
+ }
561
+ }
562
+ .hex-row {
563
+ gap: 9px;
564
+ > .container {
565
+ flex: 0 0 auto;
566
+ width: 29px;
567
+ height: 29px;
568
+ border: 1px solid var(--back-border);
569
+ border-radius: 5px;
570
+ }
571
+ > .input {
572
+ flex: 1;
573
+ min-width: 0;
574
+ padding: 6px 9px;
575
+ font-family: monospace;
576
+ text-transform: uppercase;
577
+ }
578
+ }
579
+ }
580
+
423
581
  /* src/components/Content/style.css */
424
- #app > div > main > main {
582
+ .content {
425
583
  flex: 1;
426
584
  display: flex;
427
585
  flex-direction: column;
@@ -453,27 +611,6 @@ a.button {
453
611
  }
454
612
  }
455
613
 
456
- /* src/components/Text/style.css */
457
- .text {
458
- &.dim {
459
- color: var(--text-dim);
460
- }
461
- &.dark {
462
- color: var(--text-dark);
463
- }
464
- &.big {
465
- font-size: var(--font-size-big);
466
- }
467
- &.extra-big {
468
- font-size: var(--font-size-extra-big);
469
- }
470
- &.big,
471
- &.extra-big {
472
- font-weight: bold;
473
- font-family: "Lexend";
474
- }
475
- }
476
-
477
614
  /* src/components/ContextMenu/style.css */
478
615
  .context-menu {
479
616
  z-index: 1000;
@@ -589,6 +726,32 @@ a.button {
589
726
  align-items: center;
590
727
  }
591
728
 
729
+ /* src/components/Modal/style.css */
730
+ .modal-container {
731
+ position: fixed;
732
+ inset: 0;
733
+ z-index: 1000;
734
+ display: flex;
735
+ align-items: center;
736
+ justify-content: center;
737
+ background: var(--shadow-strong);
738
+ > div {
739
+ background: var(--prim);
740
+ border: 1px solid var(--prim-border);
741
+ border-radius: 15px;
742
+ padding: 20px;
743
+ }
744
+ animation: modal-backdrop-in var(--transition-normal) ease-out;
745
+ }
746
+ @keyframes modal-backdrop-in {
747
+ from {
748
+ opacity: 0;
749
+ }
750
+ to {
751
+ opacity: 1;
752
+ }
753
+ }
754
+
592
755
  /* src/components/PathInput/style.css */
593
756
  .path-input {
594
757
  padding: 3px;
@@ -801,6 +964,41 @@ a.button {
801
964
  }
802
965
  }
803
966
 
967
+ /* src/components/Toast/style.css */
968
+ .toast-container {
969
+ position: fixed;
970
+ top: 20px;
971
+ left: 50%;
972
+ transform: translateX(-50%);
973
+ display: flex;
974
+ flex-direction: column;
975
+ gap: 8px;
976
+ z-index: 1000;
977
+ }
978
+ .toast {
979
+ padding: 10px 16px;
980
+ background: var(--prim);
981
+ border-radius: 8px;
982
+ border: 1px solid var(--prim-border);
983
+ box-shadow: var(--shadow);
984
+ font-weight: bold;
985
+ transition: opacity 300ms ease, transform 300ms ease;
986
+ &.correct {
987
+ background: var(--correct);
988
+ border-color: var(--correct-border);
989
+ color: var(--text-on-light);
990
+ }
991
+ &.error {
992
+ background: var(--danger);
993
+ border-color: var(--danger-border);
994
+ color: var(--text-on-light);
995
+ }
996
+ &.fading {
997
+ opacity: 0;
998
+ transform: translateY(-4px);
999
+ }
1000
+ }
1001
+
804
1002
  /* src/components/UploadBox/style.css */
805
1003
  .upload-box {
806
1004
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flufi-ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "source": "src/index.ts",
6
6
  "main": "./dist/index.js",
@@ -31,7 +31,9 @@
31
31
  "**/*.css"
32
32
  ],
33
33
  "scripts": {
34
- "build": "rm -rf dist && tsup src/index.ts src/types/index.ts src/components/index.ts src/common/index.ts --format esm --dts --external preact && cp dist/index.css dist/style.css",
34
+ "typecheck": "tsc --noEmit",
35
+ "build": "npm run typecheck && rm -rf dist && tsup src/index.ts src/types/index.ts src/components/index.ts src/common/index.ts --format esm --dts --external preact && cp dist/index.css dist/style.css",
36
+ "test": "npm run build && node --test tests/*.test.mjs",
35
37
  "prepare": "npm run build"
36
38
  },
37
39
  "peerDependencies": {
@@ -39,6 +41,7 @@
39
41
  "preact": "^10"
40
42
  },
41
43
  "devDependencies": {
44
+ "happy-dom": "^21.0.4",
42
45
  "tsup": "^8",
43
46
  "typescript": "^5"
44
47
  },
File without changes