@vandenberghinc/volt 1.1.5 → 1.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/backend/dist/cjs/database.d.ts +41 -68
- package/backend/dist/cjs/database.js +127 -76
- package/backend/dist/cjs/endpoint.d.ts +23 -9
- package/backend/dist/cjs/endpoint.js +98 -21
- package/backend/dist/cjs/frontend.d.ts +0 -2
- package/backend/dist/cjs/frontend.js +9 -9
- package/backend/dist/cjs/image_endpoint.d.ts +3 -1
- package/backend/dist/cjs/image_endpoint.js +2 -1
- package/backend/dist/cjs/payments/paddle.js +10 -2
- package/backend/dist/cjs/plugins/css.d.ts +6 -5
- package/backend/dist/cjs/plugins/css.js +32 -7
- package/backend/dist/cjs/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/cjs/plugins/ts/compiler.js +26 -2
- package/backend/dist/cjs/plugins/ts/preprocessing.js +5 -3
- package/backend/dist/cjs/server.d.ts +7 -13
- package/backend/dist/cjs/server.js +184 -303
- package/backend/dist/cjs/status.d.ts +1 -0
- package/backend/dist/cjs/status.js +2 -1
- package/backend/dist/cjs/stream.d.ts +5 -3
- package/backend/dist/cjs/stream.js +13 -4
- package/backend/dist/cjs/users.d.ts +1 -1
- package/backend/dist/cjs/users.js +87 -72
- package/backend/dist/cjs/utils.d.ts +17 -9
- package/backend/dist/cjs/utils.js +22 -64
- package/backend/dist/cjs/view.d.ts +2 -2
- package/backend/dist/cjs/view.js +38 -40
- package/backend/dist/cjs/volt.d.ts +3 -2
- package/backend/dist/cjs/volt.js +2 -2
- package/backend/dist/css/volt.css +5 -0
- package/backend/dist/esm/database.d.ts +41 -68
- package/backend/dist/esm/database.js +127 -76
- package/backend/dist/esm/endpoint.d.ts +23 -9
- package/backend/dist/esm/endpoint.js +99 -22
- package/backend/dist/esm/frontend.d.ts +0 -2
- package/backend/dist/esm/frontend.js +9 -9
- package/backend/dist/esm/image_endpoint.d.ts +3 -1
- package/backend/dist/esm/image_endpoint.js +2 -1
- package/backend/dist/esm/payments/paddle.js +11 -3
- package/backend/dist/esm/plugins/css.d.ts +6 -5
- package/backend/dist/esm/plugins/css.js +32 -6
- package/backend/dist/esm/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/esm/plugins/ts/compiler.js +26 -2
- package/backend/dist/esm/plugins/ts/preprocessing.js +5 -3
- package/backend/dist/esm/server.d.ts +7 -13
- package/backend/dist/esm/server.js +182 -301
- package/backend/dist/esm/status.d.ts +1 -0
- package/backend/dist/esm/status.js +1 -0
- package/backend/dist/esm/stream.d.ts +5 -3
- package/backend/dist/esm/stream.js +13 -4
- package/backend/dist/esm/users.d.ts +1 -1
- package/backend/dist/esm/users.js +87 -72
- package/backend/dist/esm/utils.d.ts +17 -9
- package/backend/dist/esm/utils.js +21 -62
- package/backend/dist/esm/view.d.ts +2 -2
- package/backend/dist/esm/view.js +38 -40
- package/backend/dist/esm/volt.d.ts +3 -2
- package/backend/dist/esm/volt.js +2 -1
- package/backend/dist/esm-dev/blacklist.js +1 -1
- package/backend/dist/esm-dev/cli.js +2 -2
- package/backend/dist/esm-dev/database.d.ts +41 -68
- package/backend/dist/esm-dev/database.js +128 -77
- package/backend/dist/esm-dev/endpoint.d.ts +23 -9
- package/backend/dist/esm-dev/endpoint.js +100 -23
- package/backend/dist/esm-dev/file_watcher.js +1 -1
- package/backend/dist/esm-dev/frontend.d.ts +0 -2
- package/backend/dist/esm-dev/frontend.js +9 -9
- package/backend/dist/esm-dev/image_endpoint.d.ts +3 -1
- package/backend/dist/esm-dev/image_endpoint.js +2 -1
- package/backend/dist/esm-dev/logger.js +1 -1
- package/backend/dist/esm-dev/payments/paddle.js +12 -4
- package/backend/dist/esm-dev/plugins/css.d.ts +6 -5
- package/backend/dist/esm-dev/plugins/css.js +33 -7
- package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/esm-dev/plugins/ts/compiler.js +27 -3
- package/backend/dist/esm-dev/plugins/ts/preprocessing.js +7 -5
- package/backend/dist/esm-dev/rate_limit.js +1 -1
- package/backend/dist/esm-dev/server.d.ts +7 -13
- package/backend/dist/esm-dev/server.js +184 -303
- package/backend/dist/esm-dev/status.d.ts +1 -0
- package/backend/dist/esm-dev/status.js +1 -0
- package/backend/dist/esm-dev/stream.d.ts +5 -3
- package/backend/dist/esm-dev/stream.js +13 -4
- package/backend/dist/esm-dev/users.d.ts +1 -1
- package/backend/dist/esm-dev/users.js +88 -73
- package/backend/dist/esm-dev/utils.d.ts +17 -9
- package/backend/dist/esm-dev/utils.js +22 -63
- package/backend/dist/esm-dev/view.d.ts +2 -2
- package/backend/dist/esm-dev/view.js +39 -41
- package/backend/dist/esm-dev/volt.d.ts +3 -2
- package/backend/dist/esm-dev/volt.js +2 -1
- package/backend/src/database.ts +163 -152
- package/backend/src/endpoint.ts +123 -31
- package/backend/src/frontend.ts +9 -8
- package/backend/src/image_endpoint.ts +4 -0
- package/backend/src/payments/paddle.ts +11 -3
- package/backend/src/plugins/css.ts +36 -8
- package/backend/src/plugins/ts/compiler.ts +37 -1
- package/backend/src/plugins/ts/preprocessing.ts +5 -3
- package/backend/src/server.ts +167 -306
- package/backend/src/status.ts +1 -0
- package/backend/src/stream.ts +28 -8
- package/backend/src/users.ts +87 -72
- package/backend/src/utils.ts +58 -25
- package/backend/src/view.ts +30 -28
- package/backend/src/{volt.js → volt.ts} +2 -1
- package/backend/tsconfig.cjs.json +3 -3
- package/backend/tsconfig.esm.json +3 -3
- package/frontend/dist/elements/base.d.ts +397 -415
- package/frontend/dist/elements/base.js +565 -328
- package/frontend/dist/elements/module.d.ts +26 -12
- package/frontend/dist/elements/module.js +69 -32
- package/frontend/dist/elements/register_element.d.ts +3 -0
- package/frontend/dist/elements/register_element.js +22 -0
- package/frontend/dist/modules/auth.d.ts +1 -0
- package/frontend/dist/modules/auth.js +6 -5
- package/frontend/dist/modules/color.d.ts +159 -0
- package/frontend/dist/modules/color.js +315 -0
- package/frontend/dist/modules/colors.d.ts +1 -26
- package/frontend/dist/modules/colors.js +417 -338
- package/frontend/dist/modules/cookies.d.ts +1 -0
- package/frontend/dist/modules/cookies.js +1 -0
- package/frontend/dist/modules/events.d.ts +1 -0
- package/frontend/dist/modules/events.js +1 -0
- package/frontend/dist/modules/google.d.ts +1 -0
- package/frontend/dist/modules/google.js +1 -0
- package/frontend/dist/modules/meta.d.ts +1 -0
- package/frontend/dist/modules/meta.js +1 -0
- package/frontend/dist/modules/mutex.d.ts +1 -2
- package/frontend/dist/modules/mutex.js +3 -4
- package/frontend/dist/modules/paddle.d.ts +1 -0
- package/frontend/dist/modules/paddle.js +14 -13
- package/frontend/dist/modules/scheme.d.ts +1 -0
- package/frontend/dist/modules/scheme.js +4 -2
- package/frontend/dist/modules/statics.d.ts +1 -0
- package/frontend/dist/modules/statics.js +1 -0
- package/frontend/dist/modules/support.d.ts +1 -0
- package/frontend/dist/modules/support.js +3 -2
- package/frontend/dist/modules/theme.d.ts +56 -0
- package/frontend/dist/{ui → modules}/theme.js +186 -75
- package/frontend/dist/modules/themes.d.ts +1 -1
- package/frontend/dist/modules/themes.js +1 -0
- package/frontend/dist/modules/user.d.ts +1 -0
- package/frontend/dist/modules/user.js +11 -10
- package/frontend/dist/modules/utils.d.ts +23 -2
- package/frontend/dist/modules/utils.js +93 -1
- package/frontend/dist/types/gradient.js +4 -0
- package/frontend/dist/ui/border_button.d.ts +0 -25
- package/frontend/dist/ui/border_button.js +50 -51
- package/frontend/dist/ui/button.d.ts +0 -21
- package/frontend/dist/ui/button.js +41 -46
- package/frontend/dist/ui/canvas.js +15 -15
- package/frontend/dist/ui/checkbox.d.ts +3 -17
- package/frontend/dist/ui/checkbox.js +36 -30
- package/frontend/dist/ui/code.d.ts +15 -82
- package/frontend/dist/ui/code.js +150 -125
- package/frontend/dist/ui/color.d.ts +0 -1
- package/frontend/dist/ui/color.js +1 -1
- package/frontend/dist/ui/context_menu.d.ts +4 -2
- package/frontend/dist/ui/context_menu.js +16 -17
- package/frontend/dist/ui/css.js +2 -0
- package/frontend/dist/ui/divider.d.ts +0 -7
- package/frontend/dist/ui/divider.js +21 -25
- package/frontend/dist/ui/dropdown.d.ts +13 -7
- package/frontend/dist/ui/dropdown.js +65 -30
- package/frontend/dist/ui/for_each.d.ts +0 -5
- package/frontend/dist/ui/for_each.js +17 -22
- package/frontend/dist/ui/form.d.ts +17 -12
- package/frontend/dist/ui/form.js +21 -18
- package/frontend/dist/ui/frame_modes.d.ts +9 -12
- package/frontend/dist/ui/frame_modes.js +8 -10
- package/frontend/dist/ui/google_map.d.ts +0 -11
- package/frontend/dist/ui/google_map.js +23 -28
- package/frontend/dist/ui/gradient.d.ts +0 -5
- package/frontend/dist/ui/gradient.js +17 -22
- package/frontend/dist/ui/image.d.ts +27 -58
- package/frontend/dist/ui/image.js +99 -93
- package/frontend/dist/ui/input.d.ts +20 -97
- package/frontend/dist/ui/input.js +192 -170
- package/frontend/dist/ui/link.d.ts +0 -18
- package/frontend/dist/ui/link.js +42 -48
- package/frontend/dist/ui/list.js +36 -37
- package/frontend/dist/ui/loader_button.d.ts +4 -19
- package/frontend/dist/ui/loader_button.js +35 -37
- package/frontend/dist/ui/loaders.d.ts +0 -8
- package/frontend/dist/ui/loaders.js +20 -25
- package/frontend/dist/ui/popup.d.ts +11 -8
- package/frontend/dist/ui/popup.js +183 -24
- package/frontend/dist/ui/pseudo.d.ts +3 -3
- package/frontend/dist/ui/pseudo.js +14 -17
- package/frontend/dist/ui/scroller.d.ts +10 -48
- package/frontend/dist/ui/scroller.js +306 -300
- package/frontend/dist/ui/slider.d.ts +9 -3
- package/frontend/dist/ui/slider.js +31 -17
- package/frontend/dist/ui/spacer.d.ts +0 -9
- package/frontend/dist/ui/spacer.js +21 -26
- package/frontend/dist/ui/span.js +13 -15
- package/frontend/dist/ui/stack.d.ts +14 -75
- package/frontend/dist/ui/stack.js +166 -169
- package/frontend/dist/ui/steps.d.ts +10 -23
- package/frontend/dist/ui/steps.js +47 -34
- package/frontend/dist/ui/style.d.ts +4 -3
- package/frontend/dist/ui/style.js +13 -18
- package/frontend/dist/ui/switch.d.ts +10 -4
- package/frontend/dist/ui/switch.js +24 -16
- package/frontend/dist/ui/table.d.ts +0 -23
- package/frontend/dist/ui/table.js +113 -119
- package/frontend/dist/ui/tabs.d.ts +3 -19
- package/frontend/dist/ui/tabs.js +35 -29
- package/frontend/dist/ui/text.d.ts +0 -8
- package/frontend/dist/ui/text.js +20 -25
- package/frontend/dist/ui/title.d.ts +0 -15
- package/frontend/dist/ui/title.js +39 -45
- package/frontend/dist/ui/ui.d.ts +0 -2
- package/frontend/dist/ui/ui.js +0 -2
- package/frontend/dist/ui/view.d.ts +3 -17
- package/frontend/dist/ui/view.js +27 -32
- package/frontend/dist/volt.d.ts +2 -1
- package/frontend/dist/volt.js +3 -1
- package/frontend/examples/dashboard/dashboard.ts +774 -0
- package/frontend/examples/theme/theme.ts +58 -0
- package/frontend/src/css/volt.css +5 -0
- package/frontend/src/elements/base.ts +767 -545
- package/frontend/src/elements/module.ts +90 -29
- package/frontend/src/elements/register_element.ts +24 -0
- package/frontend/src/modules/auth.ts +7 -6
- package/frontend/src/modules/color.ts +348 -0
- package/frontend/src/modules/colors.ts +468 -449
- package/frontend/src/modules/cookies.ts +1 -0
- package/frontend/src/modules/events.ts +1 -0
- package/frontend/src/modules/google.ts +1 -0
- package/frontend/src/modules/meta.ts +2 -1
- package/frontend/src/modules/mutex.ts +2 -4
- package/frontend/src/modules/paddle.ts +21 -20
- package/frontend/src/modules/scheme.ts +4 -3
- package/frontend/src/modules/statics.ts +2 -1
- package/frontend/src/modules/support.ts +3 -2
- package/frontend/src/modules/theme.ts +413 -0
- package/frontend/src/modules/themes.ts +2 -1
- package/frontend/src/modules/user.ts +12 -11
- package/frontend/src/modules/utils.ts +125 -2
- package/frontend/src/ui/border_button.ts +41 -37
- package/frontend/src/ui/button.ts +33 -32
- package/frontend/src/ui/canvas.ts +5 -2
- package/frontend/src/ui/checkbox.ts +21 -22
- package/frontend/src/ui/code.ts +92 -86
- package/frontend/src/ui/context_menu.ts +7 -5
- package/frontend/src/ui/css.ts +1 -1
- package/frontend/src/ui/divider.ts +15 -10
- package/frontend/src/ui/dropdown.ts +38 -21
- package/frontend/src/ui/for_each.ts +9 -8
- package/frontend/src/ui/form.ts +26 -21
- package/frontend/src/ui/frame_modes.ts +13 -17
- package/frontend/src/ui/google_map.ts +15 -13
- package/frontend/src/ui/gradient.ts +9 -8
- package/frontend/src/ui/image.ts +108 -86
- package/frontend/src/ui/input.ts +145 -144
- package/frontend/src/ui/link.ts +25 -23
- package/frontend/src/ui/list.ts +12 -6
- package/frontend/src/ui/loader_button.ts +26 -25
- package/frontend/src/ui/loaders.ts +12 -11
- package/frontend/src/ui/popup.ts +168 -14
- package/frontend/src/ui/pseudo.ts +5 -3
- package/frontend/src/ui/scroller.ts +303 -294
- package/frontend/src/ui/slider.ts +15 -10
- package/frontend/src/ui/spacer.ts +14 -11
- package/frontend/src/ui/span.ts +6 -2
- package/frontend/src/ui/stack.ts +196 -183
- package/frontend/src/ui/steps.ts +38 -22
- package/frontend/src/ui/style.ts +7 -4
- package/frontend/src/ui/switch.ts +16 -11
- package/frontend/src/ui/table.ts +42 -34
- package/frontend/src/ui/tabs.ts +20 -19
- package/frontend/src/ui/text.ts +12 -11
- package/frontend/src/ui/title.ts +22 -20
- package/frontend/src/ui/ui.ts +0 -2
- package/frontend/src/ui/view.ts +20 -19
- package/frontend/src/volt.ts +3 -1
- package/frontend/{compile.js → tools/compile.old.js} +2 -2
- package/frontend/tools/embed_scripts.js +69 -0
- package/frontend/tsconfig.json +26 -0
- package/package.json +8 -8
- package/frontend/dist/ui/theme.d.ts +0 -25
- package/frontend/exports.json +0 -1340
- package/frontend/src/modules/date.js +0 -535
- package/frontend/src/ui/color.ts +0 -117
- package/frontend/src/ui/theme.ts +0 -279
- /package/backend/src/{vinc.dev.js → vinc.dev.ts} +0 -0
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// Imports.
|
|
7
|
-
import { Elements, VElementTagMap } from "../elements/module.js"
|
|
7
|
+
import { Elements, VElementBaseSignature, VElement, VElementTagMap, AppendType } from "../elements/module.js"
|
|
8
8
|
import { Utils } from "../modules/utils.js"
|
|
9
|
+
import { AnyElement } from "./any_element.js";
|
|
9
10
|
import { Span } from "./span"
|
|
10
11
|
import { VStack, VStackElement } from "./stack"
|
|
11
12
|
|
|
@@ -19,10 +20,9 @@ interface ScrollCallbackItem {
|
|
|
19
20
|
|
|
20
21
|
// Scroller.
|
|
21
22
|
// - Warning: Setting padding on element attribute "content" may cause undefined behaviour.
|
|
22
|
-
@Elements.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
static default_style = {
|
|
23
|
+
@Elements.create({
|
|
24
|
+
name: "ScrollerElement",
|
|
25
|
+
default_style: {
|
|
26
26
|
"position": "relative", // is required for attribute "track"
|
|
27
27
|
"margin": "0px",
|
|
28
28
|
"padding": "0px",
|
|
@@ -39,7 +39,9 @@ export class ScrollerElement extends VElementTagMap.div {
|
|
|
39
39
|
"content-visibility": "auto", // improve rendering.
|
|
40
40
|
// "align-content": "flex-start", // align items at start, do not stretch / space when inside HStack.
|
|
41
41
|
// "align-items": "flex-start", // align items at start, do not stretch / space when inside HStack.
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
export class ScrollerElement extends VElementTagMap.div {
|
|
43
45
|
|
|
44
46
|
// @ts-expect-error
|
|
45
47
|
public content: VStackElement;
|
|
@@ -60,7 +62,7 @@ export class ScrollerElement extends VElementTagMap.div {
|
|
|
60
62
|
public _fadeout_timeout: any;
|
|
61
63
|
|
|
62
64
|
// Constructor.
|
|
63
|
-
constructor(...children:
|
|
65
|
+
constructor(...children: AppendType[]) {
|
|
64
66
|
|
|
65
67
|
// Initialize base class.
|
|
66
68
|
super({
|
|
@@ -340,7 +342,7 @@ export class ScrollerElement extends VElementTagMap.div {
|
|
|
340
342
|
}
|
|
341
343
|
|
|
342
344
|
// By default append items to the content.
|
|
343
|
-
append(...children:
|
|
345
|
+
append(...children: AppendType[]): this {
|
|
344
346
|
this.content.append(...children);
|
|
345
347
|
return this;
|
|
346
348
|
}
|
|
@@ -608,287 +610,287 @@ declare module './any_element.d.ts' { interface AnyElementMap { ScrollerElement:
|
|
|
608
610
|
@description: The elements children.
|
|
609
611
|
@type: array[Node]
|
|
610
612
|
*/
|
|
611
|
-
@Elements.register
|
|
612
|
-
export class VirtualScrollerElement extends ScrollerElement {
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
export const VirtualScroller = Elements.wrapper(VirtualScrollerElement);
|
|
890
|
-
export const NullVirtualScroller = Elements.create_null(VirtualScrollerElement);
|
|
891
|
-
declare module './any_element.d.ts' { interface AnyElementMap { VirtualScrollerElement: VirtualScrollerElement }}
|
|
613
|
+
// @Elements.register
|
|
614
|
+
// export class VirtualScrollerElement extends (ScrollerElement as any as VElementBaseSignature) {
|
|
615
|
+
|
|
616
|
+
// public _v_children: any[];
|
|
617
|
+
// public top_diff: number;
|
|
618
|
+
// public scroll_top_value: number;
|
|
619
|
+
// public _last_v_children: number;
|
|
620
|
+
// public visible_container: VStackElement;
|
|
621
|
+
// public height_measurer: any;
|
|
622
|
+
|
|
623
|
+
// // Constructor.
|
|
624
|
+
// constructor(...children: AppendType[]) {
|
|
625
|
+
|
|
626
|
+
// // Initialize base class.
|
|
627
|
+
// super();
|
|
628
|
+
// this._init_derived({ derived: VirtualScrollerElement, })
|
|
629
|
+
|
|
630
|
+
// // Virtual children.
|
|
631
|
+
// this._v_children = [];
|
|
632
|
+
|
|
633
|
+
// // Attributes.
|
|
634
|
+
// this.top_diff = 0;
|
|
635
|
+
// this.scroll_top_value = 0;
|
|
636
|
+
// this._last_v_children = 0;
|
|
637
|
+
|
|
638
|
+
// // Append children.
|
|
639
|
+
// this.append(...children);
|
|
640
|
+
|
|
641
|
+
// // The visible container with the scroll dimensions and positioned children inside.
|
|
642
|
+
// this.visible_container = VStack()
|
|
643
|
+
// .position("relative")
|
|
644
|
+
// .overflow_x("visible")
|
|
645
|
+
// .overflow_y("hidden")
|
|
646
|
+
// .styles({
|
|
647
|
+
// "content-visibility": "auto",
|
|
648
|
+
// })
|
|
649
|
+
// this.content.append(this.visible_container)
|
|
650
|
+
|
|
651
|
+
// // The height measurer.
|
|
652
|
+
// this.height_measurer = Span()
|
|
653
|
+
// .visibility("hidden")
|
|
654
|
+
// this.content.append(this.height_measurer)
|
|
655
|
+
|
|
656
|
+
// // Render.
|
|
657
|
+
// this.render();
|
|
658
|
+
|
|
659
|
+
// // Set scroll event listener.
|
|
660
|
+
// // @todo set_scroll_top_without event wont work with this new scroll event.
|
|
661
|
+
// this.content.addEventListener("scroll", () => this.render())
|
|
662
|
+
|
|
663
|
+
// }
|
|
664
|
+
|
|
665
|
+
// // Set default since it inherits HStackElement.
|
|
666
|
+
// set_default(): this {
|
|
667
|
+
// return super.set_default(VirtualScrollerElement);
|
|
668
|
+
// }
|
|
669
|
+
|
|
670
|
+
// // Replace overflow.
|
|
671
|
+
// overflow(): string;
|
|
672
|
+
// overflow(value: string): this;
|
|
673
|
+
// overflow(value?: string): string | this {
|
|
674
|
+
// if (value == null) {
|
|
675
|
+
// return this.content.overflow();
|
|
676
|
+
// }
|
|
677
|
+
// this.content.overflow(value);
|
|
678
|
+
// this.visible_container.overflow_x(value.split(" ")[0]);
|
|
679
|
+
// return this;
|
|
680
|
+
// }
|
|
681
|
+
// overflow_x(): string;
|
|
682
|
+
// overflow_x(value: string): this;
|
|
683
|
+
// overflow_x(value?: string): string | this {
|
|
684
|
+
// if (value == null) {
|
|
685
|
+
// return this.content.overflow_x();
|
|
686
|
+
// }
|
|
687
|
+
// this.content.overflow_x(value);
|
|
688
|
+
// this.visible_container.overflow_x(value);
|
|
689
|
+
// return this;
|
|
690
|
+
// }
|
|
691
|
+
// // keep overflow y on this.visible_container always hidden otherwise it may mess with expanding this.content and cause an infinite scroll event.
|
|
692
|
+
|
|
693
|
+
// // Set remove children to content.
|
|
694
|
+
// remove_children(): this {
|
|
695
|
+
// this._v_children = [];
|
|
696
|
+
// this.visible_container.min_height(0);
|
|
697
|
+
// this.visible_container.max_height(0);
|
|
698
|
+
// this.visible_container.inner_html("");
|
|
699
|
+
// return this;
|
|
700
|
+
// }
|
|
701
|
+
|
|
702
|
+
// // Render the visible content.
|
|
703
|
+
// render(): this {
|
|
704
|
+
// // Do not use a clearTimeout setTimout structure cause that will cause some elements to be appended too late on a very fast sroll.
|
|
705
|
+
|
|
706
|
+
// // Get scroll direction.
|
|
707
|
+
// const last_scroll_top = this.scroll_top_value;
|
|
708
|
+
// this.scroll_top_value = this.content.scrollTop;
|
|
709
|
+
// const last_v_children = this._last_v_children;
|
|
710
|
+
// this._last_v_children = this._v_children.length;
|
|
711
|
+
// let scrolling_down = true;
|
|
712
|
+
// if (this.scroll_top_value > last_scroll_top) {
|
|
713
|
+
// scrolling_down = true;
|
|
714
|
+
// } else if (this.scroll_top_value < last_scroll_top) {
|
|
715
|
+
// scrolling_down = false;
|
|
716
|
+
// }
|
|
717
|
+
// // Disable forced behaviour because when height edits are made it should also be updated, but this is easily forgotten by the user.
|
|
718
|
+
// // else if (!forced && this.last_v_children == last_v_children) {
|
|
719
|
+
// // return null; // horizontal scroll.
|
|
720
|
+
// // }
|
|
721
|
+
|
|
722
|
+
// // Get the start and end y.
|
|
723
|
+
// const start_y = this.content.scrollTop;
|
|
724
|
+
// const end_y = start_y + this.content.offsetHeight + this.top_diff;
|
|
725
|
+
|
|
726
|
+
// // Iterate.
|
|
727
|
+
// let is_first = true;
|
|
728
|
+
// let is_visible = false;
|
|
729
|
+
// let total_height = 0;
|
|
730
|
+
// let visible_height = 0;
|
|
731
|
+
// this._v_children.iterate((child) => {
|
|
732
|
+
|
|
733
|
+
// // Child vars.
|
|
734
|
+
// const height = child.v_height !== undefined ? child.v_height : this.get_height(child);
|
|
735
|
+
// if (height == 0) {
|
|
736
|
+
// return null; // no fixed height or no height.
|
|
737
|
+
// }
|
|
738
|
+
// const child_start_y = total_height;
|
|
739
|
+
// const child_end_y = total_height + height; // Adjust as needed
|
|
740
|
+
// total_height += height;
|
|
741
|
+
|
|
742
|
+
// // First item.
|
|
743
|
+
// if (is_first && child_end_y >= start_y) {
|
|
744
|
+
// child.transform(`translateY(${child_start_y}px)`); // also update when still visible but height changes may have been made to an element.
|
|
745
|
+
// visible_height += height;
|
|
746
|
+
// is_first = false;
|
|
747
|
+
// is_visible = true;
|
|
748
|
+
// if (!child.rendered) {
|
|
749
|
+
// if (scrolling_down) {
|
|
750
|
+
// this.visible_container.appendChild(child);
|
|
751
|
+
// } else {
|
|
752
|
+
// this.visible_container.insertBefore(child, this.visible_container.firstChild);
|
|
753
|
+
// }
|
|
754
|
+
// child.rendered = true;
|
|
755
|
+
// }
|
|
756
|
+
// }
|
|
757
|
+
|
|
758
|
+
// // Last visible element.
|
|
759
|
+
// else if (is_visible && child_start_y >= end_y) {
|
|
760
|
+
// child.transform(`translateY(${child_start_y - visible_height}px)`); // also update when still visible but height changes may have been made to an element.
|
|
761
|
+
// visible_height += height;
|
|
762
|
+
// is_visible = false;
|
|
763
|
+
// if (!child.rendered) {
|
|
764
|
+
// if (scrolling_down) {
|
|
765
|
+
// this.visible_container.appendChild(child);
|
|
766
|
+
// } else {
|
|
767
|
+
// this.visible_container.insertBefore(child, this.visible_container.firstChild);
|
|
768
|
+
// }
|
|
769
|
+
// child.rendered = true;
|
|
770
|
+
// }
|
|
771
|
+
// }
|
|
772
|
+
|
|
773
|
+
// // Visible elements.
|
|
774
|
+
// else if (is_visible) {
|
|
775
|
+
// child.transform(`translateY(${child_start_y - visible_height}px)`); // also update when still visible but height changes may have been made to an element.
|
|
776
|
+
// visible_height += height;
|
|
777
|
+
// if (!child.rendered) {
|
|
778
|
+
// if (scrolling_down) {
|
|
779
|
+
// this.visible_container.appendChild(child);
|
|
780
|
+
// } else {
|
|
781
|
+
// this.visible_container.insertBefore(child, this.visible_container.firstChild);
|
|
782
|
+
// }
|
|
783
|
+
// child.rendered = true;
|
|
784
|
+
// }
|
|
785
|
+
// }
|
|
786
|
+
|
|
787
|
+
// // Invisible elements.
|
|
788
|
+
// else if (child.rendered) {
|
|
789
|
+
// child.remove();
|
|
790
|
+
// child.rendered = false;
|
|
791
|
+
// }
|
|
792
|
+
// })
|
|
793
|
+
|
|
794
|
+
// // Set scroll dimension.
|
|
795
|
+
// this.visible_container.min_height(total_height);
|
|
796
|
+
// this.visible_container.max_height(total_height);
|
|
797
|
+
|
|
798
|
+
// // Return this.
|
|
799
|
+
// return this;
|
|
800
|
+
// }
|
|
801
|
+
|
|
802
|
+
// // Update heights.
|
|
803
|
+
// update_heights(): this {
|
|
804
|
+
// this._v_children.iterate((child) => {
|
|
805
|
+
// child.v_height = this.get_height(child, false);
|
|
806
|
+
// })
|
|
807
|
+
// return this;
|
|
808
|
+
// }
|
|
809
|
+
|
|
810
|
+
// // Update height of a certain child.
|
|
811
|
+
// update_height(child: any): this {
|
|
812
|
+
// child.v_height = this.get_height(child, false);
|
|
813
|
+
// return this;
|
|
814
|
+
// }
|
|
815
|
+
|
|
816
|
+
// // Get the height of an element.
|
|
817
|
+
// get_height(element, fixed = true): number {
|
|
818
|
+
// let height;
|
|
819
|
+
|
|
820
|
+
// // Get fixed height.
|
|
821
|
+
// if (fixed) {
|
|
822
|
+
// height = parseFloat(element.style.height);
|
|
823
|
+
// if (isNaN(height)) {
|
|
824
|
+
// console.error("Every element in the virtual scroller must have a fixed height, ignoring element: " + element);
|
|
825
|
+
// element.style.display = "none";
|
|
826
|
+
// return 0;
|
|
827
|
+
// }
|
|
828
|
+
// }
|
|
829
|
+
|
|
830
|
+
// // Append to document and get height.
|
|
831
|
+
// // Does not require fixed heights but is slow.
|
|
832
|
+
// else {
|
|
833
|
+
// element.rendered = false; // set rendered to false because this will remove the child from this.visible_container when it was rendered.
|
|
834
|
+
// this.height_measurer.appendChild(element);
|
|
835
|
+
// height = element.offsetHeight;
|
|
836
|
+
// this.height_measurer.removeChild(element);
|
|
837
|
+
// }
|
|
838
|
+
|
|
839
|
+
// // Add margin.
|
|
840
|
+
// const margin_top = parseFloat(element.style.marginTop);
|
|
841
|
+
// if (!isNaN(margin_top)) {
|
|
842
|
+
// height += margin_top;
|
|
843
|
+
// }
|
|
844
|
+
// const margin_bottom = parseFloat(element.style.marginBottom);
|
|
845
|
+
// if (!isNaN(margin_bottom)) {
|
|
846
|
+
// height += margin_bottom;
|
|
847
|
+
// }
|
|
848
|
+
|
|
849
|
+
// // Handler.
|
|
850
|
+
// return height;
|
|
851
|
+
// }
|
|
852
|
+
|
|
853
|
+
// // Custom append function.
|
|
854
|
+
// append(...children: AppendType[]): this {
|
|
855
|
+
// for (let i = 0; i < children.length; i++) {
|
|
856
|
+
// const child = children[i];
|
|
857
|
+
// if (child != null) {
|
|
858
|
+
|
|
859
|
+
// // VWeb element.
|
|
860
|
+
// if (child.element_name != null) {
|
|
861
|
+
// if (
|
|
862
|
+
// child.element_name == "ForEachElement" ||
|
|
863
|
+
// child.element_name == "IfElement" ||
|
|
864
|
+
// child.element_name == "IfDeviceWithElement"
|
|
865
|
+
// ) {
|
|
866
|
+
// child.append_children_to(this);
|
|
867
|
+
// } else {
|
|
868
|
+
// this._v_children.push(child);
|
|
869
|
+
// }
|
|
870
|
+
// }
|
|
871
|
+
|
|
872
|
+
// // Execute function.
|
|
873
|
+
// else if (Utils.is_func(child)) {
|
|
874
|
+
// this.append(child());
|
|
875
|
+
// }
|
|
876
|
+
|
|
877
|
+
// // Node element.
|
|
878
|
+
// else if (child instanceof Node) {
|
|
879
|
+
// this._v_children.push(child);
|
|
880
|
+
// }
|
|
881
|
+
|
|
882
|
+
// // Append text.
|
|
883
|
+
// else if (Utils.is_string(child)) {
|
|
884
|
+
// this._v_children.push(document.createTextNode(child));
|
|
885
|
+
// }
|
|
886
|
+
// }
|
|
887
|
+
// }
|
|
888
|
+
// return this;
|
|
889
|
+
// }
|
|
890
|
+
// }
|
|
891
|
+
// export const VirtualScroller = Elements.wrapper(VirtualScrollerElement);
|
|
892
|
+
// export const NullVirtualScroller = Elements.create_null(VirtualScrollerElement);
|
|
893
|
+
// declare module './any_element.d.ts' { interface AnyElementMap { VirtualScrollerElement: VirtualScrollerElement }}
|
|
892
894
|
|
|
893
895
|
/* @docs:
|
|
894
896
|
@nav: Frontend
|
|
@@ -901,13 +903,19 @@ declare module './any_element.d.ts' { interface AnyElementMap { VirtualScrollerE
|
|
|
901
903
|
|
|
902
904
|
This class is still experimental.
|
|
903
905
|
*/
|
|
904
|
-
@Elements.
|
|
905
|
-
|
|
906
|
-
|
|
906
|
+
@Elements.create({
|
|
907
|
+
name: "SnapScrollerElement",
|
|
908
|
+
})
|
|
909
|
+
export class SnapScrollerElement extends (VStackElement as any as VElementBaseSignature) {
|
|
910
|
+
|
|
911
|
+
// Constructor.
|
|
912
|
+
constructor(...children: VElement[]) {
|
|
907
913
|
|
|
908
914
|
// Base.
|
|
909
915
|
super();
|
|
910
|
-
this.
|
|
916
|
+
this._init({
|
|
917
|
+
derived: SnapScrollerElement,
|
|
918
|
+
})
|
|
911
919
|
|
|
912
920
|
// Style.
|
|
913
921
|
this.overflow_y("scroll");
|
|
@@ -918,7 +926,8 @@ export class SnapScrollerElement extends VStackElement {
|
|
|
918
926
|
}
|
|
919
927
|
|
|
920
928
|
// Append.
|
|
921
|
-
|
|
929
|
+
// @ts-ignore base type accepts more input types, this one only accepts velements
|
|
930
|
+
append(...children: AnyElement[]): this {
|
|
922
931
|
for (let i = 0; i < children.length; i++) {
|
|
923
932
|
const win = children[i];
|
|
924
933
|
if (win == null) { continue; }
|