@vandenberghinc/volt 1.1.4 → 1.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.
Files changed (290) hide show
  1. package/backend/dist/cjs/database.d.ts +41 -68
  2. package/backend/dist/cjs/database.js +136 -78
  3. package/backend/dist/cjs/endpoint.d.ts +23 -9
  4. package/backend/dist/cjs/endpoint.js +98 -21
  5. package/backend/dist/cjs/file_watcher.js +2 -2
  6. package/backend/dist/cjs/frontend.d.ts +0 -2
  7. package/backend/dist/cjs/frontend.js +9 -9
  8. package/backend/dist/cjs/image_endpoint.d.ts +3 -1
  9. package/backend/dist/cjs/image_endpoint.js +2 -1
  10. package/backend/dist/cjs/payments/paddle.js +10 -2
  11. package/backend/dist/cjs/plugins/css.d.ts +6 -5
  12. package/backend/dist/cjs/plugins/css.js +32 -7
  13. package/backend/dist/cjs/plugins/ts/compiler.d.ts +6 -1
  14. package/backend/dist/cjs/plugins/ts/compiler.js +26 -2
  15. package/backend/dist/cjs/plugins/ts/preprocessing.js +5 -3
  16. package/backend/dist/cjs/server.d.ts +7 -13
  17. package/backend/dist/cjs/server.js +184 -303
  18. package/backend/dist/cjs/status.d.ts +1 -0
  19. package/backend/dist/cjs/status.js +2 -1
  20. package/backend/dist/cjs/stream.d.ts +5 -3
  21. package/backend/dist/cjs/stream.js +13 -4
  22. package/backend/dist/cjs/users.d.ts +1 -1
  23. package/backend/dist/cjs/users.js +87 -72
  24. package/backend/dist/cjs/utils.d.ts +17 -9
  25. package/backend/dist/cjs/utils.js +22 -64
  26. package/backend/dist/cjs/view.d.ts +2 -2
  27. package/backend/dist/cjs/view.js +38 -40
  28. package/backend/dist/cjs/volt.d.ts +3 -2
  29. package/backend/dist/cjs/volt.js +2 -2
  30. package/backend/dist/css/volt.css +5 -0
  31. package/backend/dist/esm/database.d.ts +41 -68
  32. package/backend/dist/esm/database.js +137 -79
  33. package/backend/dist/esm/endpoint.d.ts +23 -9
  34. package/backend/dist/esm/endpoint.js +99 -22
  35. package/backend/dist/esm/file_watcher.js +2 -2
  36. package/backend/dist/esm/frontend.d.ts +0 -2
  37. package/backend/dist/esm/frontend.js +9 -9
  38. package/backend/dist/esm/image_endpoint.d.ts +3 -1
  39. package/backend/dist/esm/image_endpoint.js +2 -1
  40. package/backend/dist/esm/payments/paddle.js +11 -3
  41. package/backend/dist/esm/plugins/css.d.ts +6 -5
  42. package/backend/dist/esm/plugins/css.js +32 -6
  43. package/backend/dist/esm/plugins/ts/compiler.d.ts +6 -1
  44. package/backend/dist/esm/plugins/ts/compiler.js +26 -2
  45. package/backend/dist/esm/plugins/ts/preprocessing.js +5 -3
  46. package/backend/dist/esm/server.d.ts +7 -13
  47. package/backend/dist/esm/server.js +182 -301
  48. package/backend/dist/esm/status.d.ts +1 -0
  49. package/backend/dist/esm/status.js +1 -0
  50. package/backend/dist/esm/stream.d.ts +5 -3
  51. package/backend/dist/esm/stream.js +13 -4
  52. package/backend/dist/esm/users.d.ts +1 -1
  53. package/backend/dist/esm/users.js +87 -72
  54. package/backend/dist/esm/utils.d.ts +17 -9
  55. package/backend/dist/esm/utils.js +21 -62
  56. package/backend/dist/esm/view.d.ts +2 -2
  57. package/backend/dist/esm/view.js +38 -40
  58. package/backend/dist/esm/volt.d.ts +3 -2
  59. package/backend/dist/esm/volt.js +2 -1
  60. package/backend/dist/esm-dev/blacklist.js +1 -1
  61. package/backend/dist/esm-dev/cli.js +2 -2
  62. package/backend/dist/esm-dev/database.d.ts +41 -68
  63. package/backend/dist/esm-dev/database.js +138 -80
  64. package/backend/dist/esm-dev/endpoint.d.ts +23 -9
  65. package/backend/dist/esm-dev/endpoint.js +100 -23
  66. package/backend/dist/esm-dev/file_watcher.js +3 -3
  67. package/backend/dist/esm-dev/frontend.d.ts +0 -2
  68. package/backend/dist/esm-dev/frontend.js +9 -9
  69. package/backend/dist/esm-dev/image_endpoint.d.ts +3 -1
  70. package/backend/dist/esm-dev/image_endpoint.js +2 -1
  71. package/backend/dist/esm-dev/logger.js +1 -1
  72. package/backend/dist/esm-dev/payments/paddle.js +12 -4
  73. package/backend/dist/esm-dev/plugins/css.d.ts +6 -5
  74. package/backend/dist/esm-dev/plugins/css.js +33 -7
  75. package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +6 -1
  76. package/backend/dist/esm-dev/plugins/ts/compiler.js +27 -3
  77. package/backend/dist/esm-dev/plugins/ts/preprocessing.js +7 -5
  78. package/backend/dist/esm-dev/rate_limit.js +1 -1
  79. package/backend/dist/esm-dev/server.d.ts +7 -13
  80. package/backend/dist/esm-dev/server.js +184 -303
  81. package/backend/dist/esm-dev/status.d.ts +1 -0
  82. package/backend/dist/esm-dev/status.js +1 -0
  83. package/backend/dist/esm-dev/stream.d.ts +5 -3
  84. package/backend/dist/esm-dev/stream.js +13 -4
  85. package/backend/dist/esm-dev/users.d.ts +1 -1
  86. package/backend/dist/esm-dev/users.js +88 -73
  87. package/backend/dist/esm-dev/utils.d.ts +17 -9
  88. package/backend/dist/esm-dev/utils.js +22 -63
  89. package/backend/dist/esm-dev/view.d.ts +2 -2
  90. package/backend/dist/esm-dev/view.js +39 -41
  91. package/backend/dist/esm-dev/volt.d.ts +3 -2
  92. package/backend/dist/esm-dev/volt.js +2 -1
  93. package/backend/src/database.ts +173 -155
  94. package/backend/src/endpoint.ts +123 -31
  95. package/backend/src/file_watcher.ts +2 -2
  96. package/backend/src/frontend.ts +9 -8
  97. package/backend/src/image_endpoint.ts +4 -0
  98. package/backend/src/payments/paddle.ts +11 -3
  99. package/backend/src/plugins/css.ts +36 -8
  100. package/backend/src/plugins/ts/compiler.ts +37 -1
  101. package/backend/src/plugins/ts/preprocessing.ts +5 -3
  102. package/backend/src/server.ts +167 -306
  103. package/backend/src/status.ts +1 -0
  104. package/backend/src/stream.ts +28 -8
  105. package/backend/src/users.ts +87 -72
  106. package/backend/src/utils.ts +58 -25
  107. package/backend/src/view.ts +30 -28
  108. package/backend/src/{volt.js → volt.ts} +2 -1
  109. package/backend/tsconfig.cjs.json +3 -3
  110. package/backend/tsconfig.esm.json +3 -3
  111. package/frontend/dist/elements/base.d.ts +414 -432
  112. package/frontend/dist/elements/base.js +566 -329
  113. package/frontend/dist/elements/module.d.ts +26 -12
  114. package/frontend/dist/elements/module.js +69 -32
  115. package/frontend/dist/elements/register_element.d.ts +3 -0
  116. package/frontend/dist/elements/register_element.js +22 -0
  117. package/frontend/dist/modules/auth.d.ts +1 -0
  118. package/frontend/dist/modules/auth.js +6 -5
  119. package/frontend/dist/modules/color.d.ts +159 -0
  120. package/frontend/dist/modules/color.js +315 -0
  121. package/frontend/dist/modules/colors.d.ts +1 -26
  122. package/frontend/dist/modules/colors.js +417 -340
  123. package/frontend/dist/modules/cookies.d.ts +1 -0
  124. package/frontend/dist/modules/cookies.js +1 -0
  125. package/frontend/dist/modules/events.d.ts +1 -0
  126. package/frontend/dist/modules/events.js +1 -0
  127. package/frontend/dist/modules/google.d.ts +1 -0
  128. package/frontend/dist/modules/google.js +1 -0
  129. package/frontend/dist/modules/meta.d.ts +1 -0
  130. package/frontend/dist/modules/meta.js +1 -0
  131. package/frontend/dist/modules/mutex.d.ts +1 -2
  132. package/frontend/dist/modules/mutex.js +3 -4
  133. package/frontend/dist/modules/paddle.d.ts +1 -0
  134. package/frontend/dist/modules/paddle.js +14 -13
  135. package/frontend/dist/modules/scheme.d.ts +1 -0
  136. package/frontend/dist/modules/scheme.js +5 -3
  137. package/frontend/dist/modules/statics.d.ts +1 -0
  138. package/frontend/dist/modules/statics.js +1 -0
  139. package/frontend/dist/modules/support.d.ts +1 -0
  140. package/frontend/dist/modules/support.js +3 -2
  141. package/frontend/dist/modules/theme.d.ts +56 -0
  142. package/frontend/dist/{ui → modules}/theme.js +186 -75
  143. package/frontend/dist/modules/themes.d.ts +1 -1
  144. package/frontend/dist/modules/themes.js +1 -0
  145. package/frontend/dist/modules/user.d.ts +1 -0
  146. package/frontend/dist/modules/user.js +11 -10
  147. package/frontend/dist/modules/utils.d.ts +23 -2
  148. package/frontend/dist/modules/utils.js +93 -1
  149. package/frontend/dist/types/gradient.js +4 -0
  150. package/frontend/dist/ui/border_button.d.ts +0 -25
  151. package/frontend/dist/ui/border_button.js +50 -51
  152. package/frontend/dist/ui/button.d.ts +0 -21
  153. package/frontend/dist/ui/button.js +41 -46
  154. package/frontend/dist/ui/canvas.js +15 -15
  155. package/frontend/dist/ui/checkbox.d.ts +3 -17
  156. package/frontend/dist/ui/checkbox.js +36 -30
  157. package/frontend/dist/ui/code.d.ts +15 -82
  158. package/frontend/dist/ui/code.js +150 -125
  159. package/frontend/dist/ui/color.d.ts +0 -1
  160. package/frontend/dist/ui/color.js +1 -1
  161. package/frontend/dist/ui/context_menu.d.ts +4 -2
  162. package/frontend/dist/ui/context_menu.js +16 -17
  163. package/frontend/dist/ui/css.js +2 -0
  164. package/frontend/dist/ui/divider.d.ts +0 -7
  165. package/frontend/dist/ui/divider.js +21 -25
  166. package/frontend/dist/ui/dropdown.d.ts +13 -7
  167. package/frontend/dist/ui/dropdown.js +65 -30
  168. package/frontend/dist/ui/for_each.d.ts +0 -5
  169. package/frontend/dist/ui/for_each.js +17 -22
  170. package/frontend/dist/ui/form.d.ts +17 -12
  171. package/frontend/dist/ui/form.js +21 -18
  172. package/frontend/dist/ui/frame_modes.d.ts +9 -12
  173. package/frontend/dist/ui/frame_modes.js +8 -10
  174. package/frontend/dist/ui/google_map.d.ts +0 -11
  175. package/frontend/dist/ui/google_map.js +23 -28
  176. package/frontend/dist/ui/gradient.d.ts +0 -5
  177. package/frontend/dist/ui/gradient.js +17 -22
  178. package/frontend/dist/ui/image.d.ts +27 -58
  179. package/frontend/dist/ui/image.js +99 -93
  180. package/frontend/dist/ui/input.d.ts +20 -97
  181. package/frontend/dist/ui/input.js +192 -170
  182. package/frontend/dist/ui/link.d.ts +0 -18
  183. package/frontend/dist/ui/link.js +42 -48
  184. package/frontend/dist/ui/list.js +36 -37
  185. package/frontend/dist/ui/loader_button.d.ts +4 -19
  186. package/frontend/dist/ui/loader_button.js +35 -37
  187. package/frontend/dist/ui/loaders.d.ts +0 -8
  188. package/frontend/dist/ui/loaders.js +20 -25
  189. package/frontend/dist/ui/popup.d.ts +11 -8
  190. package/frontend/dist/ui/popup.js +183 -24
  191. package/frontend/dist/ui/pseudo.d.ts +3 -3
  192. package/frontend/dist/ui/pseudo.js +14 -17
  193. package/frontend/dist/ui/scroller.d.ts +10 -48
  194. package/frontend/dist/ui/scroller.js +306 -300
  195. package/frontend/dist/ui/slider.d.ts +9 -3
  196. package/frontend/dist/ui/slider.js +31 -17
  197. package/frontend/dist/ui/spacer.d.ts +0 -9
  198. package/frontend/dist/ui/spacer.js +21 -26
  199. package/frontend/dist/ui/span.js +13 -15
  200. package/frontend/dist/ui/stack.d.ts +14 -75
  201. package/frontend/dist/ui/stack.js +166 -169
  202. package/frontend/dist/ui/steps.d.ts +10 -23
  203. package/frontend/dist/ui/steps.js +47 -34
  204. package/frontend/dist/ui/style.d.ts +4 -3
  205. package/frontend/dist/ui/style.js +13 -18
  206. package/frontend/dist/ui/switch.d.ts +10 -4
  207. package/frontend/dist/ui/switch.js +24 -16
  208. package/frontend/dist/ui/table.d.ts +0 -23
  209. package/frontend/dist/ui/table.js +113 -119
  210. package/frontend/dist/ui/tabs.d.ts +3 -19
  211. package/frontend/dist/ui/tabs.js +35 -29
  212. package/frontend/dist/ui/text.d.ts +0 -8
  213. package/frontend/dist/ui/text.js +20 -25
  214. package/frontend/dist/ui/title.d.ts +0 -15
  215. package/frontend/dist/ui/title.js +39 -45
  216. package/frontend/dist/ui/ui.d.ts +0 -2
  217. package/frontend/dist/ui/ui.js +0 -2
  218. package/frontend/dist/ui/view.d.ts +3 -17
  219. package/frontend/dist/ui/view.js +27 -32
  220. package/frontend/dist/volt.d.ts +2 -1
  221. package/frontend/dist/volt.js +3 -1
  222. package/frontend/examples/dashboard/dashboard.ts +774 -0
  223. package/frontend/examples/theme/theme.ts +58 -0
  224. package/frontend/src/css/volt.css +5 -0
  225. package/frontend/src/elements/base.ts +767 -545
  226. package/frontend/src/elements/module.ts +90 -29
  227. package/frontend/src/elements/register_element.ts +24 -0
  228. package/frontend/src/modules/auth.ts +7 -6
  229. package/frontend/src/modules/color.ts +348 -0
  230. package/frontend/src/modules/colors.ts +468 -449
  231. package/frontend/src/modules/cookies.ts +1 -0
  232. package/frontend/src/modules/events.ts +1 -0
  233. package/frontend/src/modules/google.ts +1 -0
  234. package/frontend/src/modules/meta.ts +2 -1
  235. package/frontend/src/modules/mutex.ts +2 -4
  236. package/frontend/src/modules/paddle.ts +21 -20
  237. package/frontend/src/modules/scheme.ts +5 -4
  238. package/frontend/src/modules/statics.ts +2 -1
  239. package/frontend/src/modules/support.ts +3 -2
  240. package/frontend/src/modules/theme.ts +413 -0
  241. package/frontend/src/modules/themes.ts +2 -1
  242. package/frontend/src/modules/user.ts +12 -11
  243. package/frontend/src/modules/utils.ts +125 -2
  244. package/frontend/src/ui/border_button.ts +41 -37
  245. package/frontend/src/ui/button.ts +33 -32
  246. package/frontend/src/ui/canvas.ts +5 -2
  247. package/frontend/src/ui/checkbox.ts +21 -22
  248. package/frontend/src/ui/code.ts +92 -86
  249. package/frontend/src/ui/context_menu.ts +7 -5
  250. package/frontend/src/ui/css.ts +1 -1
  251. package/frontend/src/ui/divider.ts +15 -10
  252. package/frontend/src/ui/dropdown.ts +38 -21
  253. package/frontend/src/ui/for_each.ts +9 -8
  254. package/frontend/src/ui/form.ts +26 -21
  255. package/frontend/src/ui/frame_modes.ts +13 -17
  256. package/frontend/src/ui/google_map.ts +15 -13
  257. package/frontend/src/ui/gradient.ts +9 -8
  258. package/frontend/src/ui/image.ts +108 -86
  259. package/frontend/src/ui/input.ts +145 -144
  260. package/frontend/src/ui/link.ts +25 -23
  261. package/frontend/src/ui/list.ts +12 -6
  262. package/frontend/src/ui/loader_button.ts +26 -25
  263. package/frontend/src/ui/loaders.ts +12 -11
  264. package/frontend/src/ui/popup.ts +168 -14
  265. package/frontend/src/ui/pseudo.ts +5 -3
  266. package/frontend/src/ui/scroller.ts +303 -294
  267. package/frontend/src/ui/slider.ts +15 -10
  268. package/frontend/src/ui/spacer.ts +14 -11
  269. package/frontend/src/ui/span.ts +6 -2
  270. package/frontend/src/ui/stack.ts +196 -183
  271. package/frontend/src/ui/steps.ts +38 -22
  272. package/frontend/src/ui/style.ts +7 -4
  273. package/frontend/src/ui/switch.ts +16 -11
  274. package/frontend/src/ui/table.ts +42 -34
  275. package/frontend/src/ui/tabs.ts +20 -19
  276. package/frontend/src/ui/text.ts +12 -11
  277. package/frontend/src/ui/title.ts +22 -20
  278. package/frontend/src/ui/ui.ts +0 -2
  279. package/frontend/src/ui/view.ts +20 -19
  280. package/frontend/src/volt.ts +3 -1
  281. package/frontend/{compile.js → tools/compile.old.js} +2 -2
  282. package/frontend/tools/embed_scripts.js +69 -0
  283. package/frontend/tsconfig.json +26 -0
  284. package/package.json +7 -6
  285. package/frontend/dist/ui/theme.d.ts +0 -25
  286. package/frontend/exports.json +0 -1340
  287. package/frontend/src/modules/date.js +0 -535
  288. package/frontend/src/ui/color.ts +0 -117
  289. package/frontend/src/ui/theme.ts +0 -279
  290. /package/backend/src/{vinc.dev.js → vinc.dev.ts} +0 -0
@@ -36,25 +36,62 @@ var __runInitializers = (this && this.__runInitializers) || function (thisArg, i
36
36
  }
37
37
  return useValue ? value : void 0;
38
38
  };
39
- var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
40
- if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
41
- return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
42
- };
43
39
  // Imports.
44
40
  import { Elements, VElementTagMap } from "../elements/module.js";
45
41
  import { Utils } from "../modules/utils.js";
46
- import { Span } from "./span";
47
42
  import { VStack, VStackElement } from "./stack";
48
43
  // Scroller.
49
44
  // - Warning: Setting padding on element attribute "content" may cause undefined behaviour.
50
45
  let ScrollerElement = (() => {
51
- var _a;
52
- let _classDecorators = [(_a = Elements).register.bind(_a)];
46
+ let _classDecorators = [Elements.create({
47
+ name: "ScrollerElement",
48
+ default_style: {
49
+ "position": "relative", // is required for attribute "track"
50
+ "margin": "0px",
51
+ "padding": "0px",
52
+ // "clear": "both",
53
+ "display": "flex", // to support vertical spacers.
54
+ "overflow": "hidden",
55
+ // "flex": "1", // disabled to support horizontal spacers in VStacks.
56
+ "align-content": "flex-start", // align items at start, do not stretch / space when inside HStack.
57
+ "flex-direction": "column",
58
+ // "text-align": "start",
59
+ "scroll-behavior": "auto",
60
+ "overscroll-behavior": "auto", // relay to parent to resume scroll when local scroll has ended.
61
+ "height": "fit-content", // set height to max compared to parents non overflow, so scrolling can take effect.
62
+ "content-visibility": "auto", // improve rendering.
63
+ // "align-content": "flex-start", // align items at start, do not stretch / space when inside HStack.
64
+ // "align-items": "flex-start", // align items at start, do not stretch / space when inside HStack.
65
+ },
66
+ })];
53
67
  let _classDescriptor;
54
68
  let _classExtraInitializers = [];
55
69
  let _classThis;
56
70
  let _classSuper = VElementTagMap.div;
57
- var ScrollerElement = _classThis = class extends _classSuper {
71
+ var ScrollerElement = class extends _classSuper {
72
+ static { _classThis = this; }
73
+ static {
74
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
75
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
76
+ ScrollerElement = _classThis = _classDescriptor.value;
77
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
78
+ __runInitializers(_classThis, _classExtraInitializers);
79
+ }
80
+ // @ts-expect-error
81
+ content;
82
+ thumb;
83
+ track;
84
+ on_scroll_callbacks;
85
+ iterate;
86
+ iterate_nodes;
87
+ m_delay;
88
+ _h_alignment;
89
+ _current_h_alignment;
90
+ _v_alignment;
91
+ _current_v_alignment;
92
+ _alignment_callback_activated;
93
+ _alignment_callback;
94
+ _fadeout_timeout;
58
95
  // Constructor.
59
96
  constructor(...children) {
60
97
  // Initialize base class.
@@ -497,34 +534,6 @@ let ScrollerElement = (() => {
497
534
  return this;
498
535
  }
499
536
  };
500
- __setFunctionName(_classThis, "ScrollerElement");
501
- (() => {
502
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
503
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
504
- ScrollerElement = _classThis = _classDescriptor.value;
505
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
506
- })();
507
- _classThis.default_style = {
508
- "position": "relative", // is required for attribute "track"
509
- "margin": "0px",
510
- "padding": "0px",
511
- // "clear": "both",
512
- "display": "flex", // to support vertical spacers.
513
- "overflow": "hidden",
514
- // "flex": "1", // disabled to support horizontal spacers in VStacks.
515
- "align-content": "flex-start", // align items at start, do not stretch / space when inside HStack.
516
- "flex-direction": "column",
517
- // "text-align": "start",
518
- "scroll-behavior": "auto",
519
- "overscroll-behavior": "auto", // relay to parent to resume scroll when local scroll has ended.
520
- "height": "fit-content", // set height to max compared to parents non overflow, so scrolling can take effect.
521
- "content-visibility": "auto", // improve rendering.
522
- // "align-content": "flex-start", // align items at start, do not stretch / space when inside HStack.
523
- // "align-items": "flex-start", // align items at start, do not stretch / space when inside HStack.
524
- };
525
- (() => {
526
- __runInitializers(_classThis, _classExtraInitializers);
527
- })();
528
537
  return ScrollerElement = _classThis;
529
538
  })();
530
539
  export { ScrollerElement };
@@ -555,258 +564,250 @@ export const NullScroller = Elements.create_null(ScrollerElement);
555
564
  @description: The elements children.
556
565
  @type: array[Node]
557
566
  */
558
- let VirtualScrollerElement = (() => {
559
- var _a;
560
- let _classDecorators = [(_a = Elements).register.bind(_a)];
561
- let _classDescriptor;
562
- let _classExtraInitializers = [];
563
- let _classThis;
564
- let _classSuper = ScrollerElement;
565
- var VirtualScrollerElement = _classThis = class extends _classSuper {
566
- // Constructor.
567
- constructor(...children) {
568
- // Initialize base class.
569
- super();
570
- this._init_derived({ derived: VirtualScrollerElement, });
571
- // Virtual children.
572
- this._v_children = [];
573
- // Attributes.
574
- this.top_diff = 0;
575
- this.scroll_top_value = 0;
576
- this._last_v_children = 0;
577
- // Append children.
578
- this.append(...children);
579
- // The visible container with the scroll dimensions and positioned children inside.
580
- this.visible_container = VStack()
581
- .position("relative")
582
- .overflow_x("visible")
583
- .overflow_y("hidden")
584
- .styles({
585
- "content-visibility": "auto",
586
- });
587
- this.content.append(this.visible_container);
588
- // The height measurer.
589
- this.height_measurer = Span()
590
- .visibility("hidden");
591
- this.content.append(this.height_measurer);
592
- // Render.
593
- this.render();
594
- // Set scroll event listener.
595
- // @todo set_scroll_top_without event wont work with this new scroll event.
596
- this.content.addEventListener("scroll", () => this.render());
597
- }
598
- // Set default since it inherits HStackElement.
599
- set_default() {
600
- return super.set_default(VirtualScrollerElement);
601
- }
602
- overflow(value) {
603
- if (value == null) {
604
- return this.content.overflow();
605
- }
606
- this.content.overflow(value);
607
- this.visible_container.overflow_x(value.split(" ")[0]);
608
- return this;
609
- }
610
- overflow_x(value) {
611
- if (value == null) {
612
- return this.content.overflow_x();
613
- }
614
- this.content.overflow_x(value);
615
- this.visible_container.overflow_x(value);
616
- return this;
617
- }
618
- // keep overflow y on this.visible_container always hidden otherwise it may mess with expanding this.content and cause an infinite scroll event.
619
- // Set remove children to content.
620
- remove_children() {
621
- this._v_children = [];
622
- this.visible_container.min_height(0);
623
- this.visible_container.max_height(0);
624
- this.visible_container.inner_html("");
625
- return this;
626
- }
627
- // Render the visible content.
628
- render() {
629
- // Do not use a clearTimeout setTimout structure cause that will cause some elements to be appended too late on a very fast sroll.
630
- // Get scroll direction.
631
- const last_scroll_top = this.scroll_top_value;
632
- this.scroll_top_value = this.content.scrollTop;
633
- const last_v_children = this._last_v_children;
634
- this._last_v_children = this._v_children.length;
635
- let scrolling_down = true;
636
- if (this.scroll_top_value > last_scroll_top) {
637
- scrolling_down = true;
638
- }
639
- else if (this.scroll_top_value < last_scroll_top) {
640
- scrolling_down = false;
641
- }
642
- // Disable forced behaviour because when height edits are made it should also be updated, but this is easily forgotten by the user.
643
- // else if (!forced && this.last_v_children == last_v_children) {
644
- // return null; // horizontal scroll.
645
- // }
646
- // Get the start and end y.
647
- const start_y = this.content.scrollTop;
648
- const end_y = start_y + this.content.offsetHeight + this.top_diff;
649
- // Iterate.
650
- let is_first = true;
651
- let is_visible = false;
652
- let total_height = 0;
653
- let visible_height = 0;
654
- this._v_children.iterate((child) => {
655
- // Child vars.
656
- const height = child.v_height !== undefined ? child.v_height : this.get_height(child);
657
- if (height == 0) {
658
- return null; // no fixed height or no height.
659
- }
660
- const child_start_y = total_height;
661
- const child_end_y = total_height + height; // Adjust as needed
662
- total_height += height;
663
- // First item.
664
- if (is_first && child_end_y >= start_y) {
665
- child.transform(`translateY(${child_start_y}px)`); // also update when still visible but height changes may have been made to an element.
666
- visible_height += height;
667
- is_first = false;
668
- is_visible = true;
669
- if (!child.rendered) {
670
- if (scrolling_down) {
671
- this.visible_container.appendChild(child);
672
- }
673
- else {
674
- this.visible_container.insertBefore(child, this.visible_container.firstChild);
675
- }
676
- child.rendered = true;
677
- }
678
- }
679
- // Last visible element.
680
- else if (is_visible && child_start_y >= end_y) {
681
- child.transform(`translateY(${child_start_y - visible_height}px)`); // also update when still visible but height changes may have been made to an element.
682
- visible_height += height;
683
- is_visible = false;
684
- if (!child.rendered) {
685
- if (scrolling_down) {
686
- this.visible_container.appendChild(child);
687
- }
688
- else {
689
- this.visible_container.insertBefore(child, this.visible_container.firstChild);
690
- }
691
- child.rendered = true;
692
- }
693
- }
694
- // Visible elements.
695
- else if (is_visible) {
696
- child.transform(`translateY(${child_start_y - visible_height}px)`); // also update when still visible but height changes may have been made to an element.
697
- visible_height += height;
698
- if (!child.rendered) {
699
- if (scrolling_down) {
700
- this.visible_container.appendChild(child);
701
- }
702
- else {
703
- this.visible_container.insertBefore(child, this.visible_container.firstChild);
704
- }
705
- child.rendered = true;
706
- }
707
- }
708
- // Invisible elements.
709
- else if (child.rendered) {
710
- child.remove();
711
- child.rendered = false;
712
- }
713
- });
714
- // Set scroll dimension.
715
- this.visible_container.min_height(total_height);
716
- this.visible_container.max_height(total_height);
717
- // Return this.
718
- return this;
719
- }
720
- // Update heights.
721
- update_heights() {
722
- this._v_children.iterate((child) => {
723
- child.v_height = this.get_height(child, false);
724
- });
725
- return this;
726
- }
727
- // Update height of a certain child.
728
- update_height(child) {
729
- child.v_height = this.get_height(child, false);
730
- return this;
731
- }
732
- // Get the height of an element.
733
- get_height(element, fixed = true) {
734
- let height;
735
- // Get fixed height.
736
- if (fixed) {
737
- height = parseFloat(element.style.height);
738
- if (isNaN(height)) {
739
- console.error("Every element in the virtual scroller must have a fixed height, ignoring element: " + element);
740
- element.style.display = "none";
741
- return 0;
742
- }
743
- }
744
- // Append to document and get height.
745
- // Does not require fixed heights but is slow.
746
- else {
747
- element.rendered = false; // set rendered to false because this will remove the child from this.visible_container when it was rendered.
748
- this.height_measurer.appendChild(element);
749
- height = element.offsetHeight;
750
- this.height_measurer.removeChild(element);
751
- }
752
- // Add margin.
753
- const margin_top = parseFloat(element.style.marginTop);
754
- if (!isNaN(margin_top)) {
755
- height += margin_top;
756
- }
757
- const margin_bottom = parseFloat(element.style.marginBottom);
758
- if (!isNaN(margin_bottom)) {
759
- height += margin_bottom;
760
- }
761
- // Handler.
762
- return height;
763
- }
764
- // Custom append function.
765
- append(...children) {
766
- for (let i = 0; i < children.length; i++) {
767
- const child = children[i];
768
- if (child != null) {
769
- // VWeb element.
770
- if (child.element_type != null) {
771
- if (child.element_type == "ForEach" ||
772
- child.element_type == "If" ||
773
- child.element_type == "IfDeviceWith") {
774
- child.append_children_to(this);
775
- }
776
- else {
777
- this._v_children.push(child);
778
- }
779
- }
780
- // Execute function.
781
- else if (Utils.is_func(child)) {
782
- this.append(child());
783
- }
784
- // Node element.
785
- else if (child instanceof Node) {
786
- this._v_children.push(child);
787
- }
788
- // Append text.
789
- else if (Utils.is_string(child)) {
790
- this._v_children.push(document.createTextNode(child));
791
- }
792
- }
793
- }
794
- return this;
795
- }
796
- };
797
- __setFunctionName(_classThis, "VirtualScrollerElement");
798
- (() => {
799
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
800
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
801
- VirtualScrollerElement = _classThis = _classDescriptor.value;
802
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
803
- __runInitializers(_classThis, _classExtraInitializers);
804
- })();
805
- return VirtualScrollerElement = _classThis;
806
- })();
807
- export { VirtualScrollerElement };
808
- export const VirtualScroller = Elements.wrapper(VirtualScrollerElement);
809
- export const NullVirtualScroller = Elements.create_null(VirtualScrollerElement);
567
+ // @Elements.register
568
+ // export class VirtualScrollerElement extends (ScrollerElement as any as VElementBaseSignature) {
569
+ // public _v_children: any[];
570
+ // public top_diff: number;
571
+ // public scroll_top_value: number;
572
+ // public _last_v_children: number;
573
+ // public visible_container: VStackElement;
574
+ // public height_measurer: any;
575
+ // // Constructor.
576
+ // constructor(...children: AppendType[]) {
577
+ // // Initialize base class.
578
+ // super();
579
+ // this._init_derived({ derived: VirtualScrollerElement, })
580
+ // // Virtual children.
581
+ // this._v_children = [];
582
+ // // Attributes.
583
+ // this.top_diff = 0;
584
+ // this.scroll_top_value = 0;
585
+ // this._last_v_children = 0;
586
+ // // Append children.
587
+ // this.append(...children);
588
+ // // The visible container with the scroll dimensions and positioned children inside.
589
+ // this.visible_container = VStack()
590
+ // .position("relative")
591
+ // .overflow_x("visible")
592
+ // .overflow_y("hidden")
593
+ // .styles({
594
+ // "content-visibility": "auto",
595
+ // })
596
+ // this.content.append(this.visible_container)
597
+ // // The height measurer.
598
+ // this.height_measurer = Span()
599
+ // .visibility("hidden")
600
+ // this.content.append(this.height_measurer)
601
+ // // Render.
602
+ // this.render();
603
+ // // Set scroll event listener.
604
+ // // @todo set_scroll_top_without event wont work with this new scroll event.
605
+ // this.content.addEventListener("scroll", () => this.render())
606
+ // }
607
+ // // Set default since it inherits HStackElement.
608
+ // set_default(): this {
609
+ // return super.set_default(VirtualScrollerElement);
610
+ // }
611
+ // // Replace overflow.
612
+ // overflow(): string;
613
+ // overflow(value: string): this;
614
+ // overflow(value?: string): string | this {
615
+ // if (value == null) {
616
+ // return this.content.overflow();
617
+ // }
618
+ // this.content.overflow(value);
619
+ // this.visible_container.overflow_x(value.split(" ")[0]);
620
+ // return this;
621
+ // }
622
+ // overflow_x(): string;
623
+ // overflow_x(value: string): this;
624
+ // overflow_x(value?: string): string | this {
625
+ // if (value == null) {
626
+ // return this.content.overflow_x();
627
+ // }
628
+ // this.content.overflow_x(value);
629
+ // this.visible_container.overflow_x(value);
630
+ // return this;
631
+ // }
632
+ // // keep overflow y on this.visible_container always hidden otherwise it may mess with expanding this.content and cause an infinite scroll event.
633
+ // // Set remove children to content.
634
+ // remove_children(): this {
635
+ // this._v_children = [];
636
+ // this.visible_container.min_height(0);
637
+ // this.visible_container.max_height(0);
638
+ // this.visible_container.inner_html("");
639
+ // return this;
640
+ // }
641
+ // // Render the visible content.
642
+ // render(): this {
643
+ // // Do not use a clearTimeout setTimout structure cause that will cause some elements to be appended too late on a very fast sroll.
644
+ // // Get scroll direction.
645
+ // const last_scroll_top = this.scroll_top_value;
646
+ // this.scroll_top_value = this.content.scrollTop;
647
+ // const last_v_children = this._last_v_children;
648
+ // this._last_v_children = this._v_children.length;
649
+ // let scrolling_down = true;
650
+ // if (this.scroll_top_value > last_scroll_top) {
651
+ // scrolling_down = true;
652
+ // } else if (this.scroll_top_value < last_scroll_top) {
653
+ // scrolling_down = false;
654
+ // }
655
+ // // Disable forced behaviour because when height edits are made it should also be updated, but this is easily forgotten by the user.
656
+ // // else if (!forced && this.last_v_children == last_v_children) {
657
+ // // return null; // horizontal scroll.
658
+ // // }
659
+ // // Get the start and end y.
660
+ // const start_y = this.content.scrollTop;
661
+ // const end_y = start_y + this.content.offsetHeight + this.top_diff;
662
+ // // Iterate.
663
+ // let is_first = true;
664
+ // let is_visible = false;
665
+ // let total_height = 0;
666
+ // let visible_height = 0;
667
+ // this._v_children.iterate((child) => {
668
+ // // Child vars.
669
+ // const height = child.v_height !== undefined ? child.v_height : this.get_height(child);
670
+ // if (height == 0) {
671
+ // return null; // no fixed height or no height.
672
+ // }
673
+ // const child_start_y = total_height;
674
+ // const child_end_y = total_height + height; // Adjust as needed
675
+ // total_height += height;
676
+ // // First item.
677
+ // if (is_first && child_end_y >= start_y) {
678
+ // child.transform(`translateY(${child_start_y}px)`); // also update when still visible but height changes may have been made to an element.
679
+ // visible_height += height;
680
+ // is_first = false;
681
+ // is_visible = true;
682
+ // if (!child.rendered) {
683
+ // if (scrolling_down) {
684
+ // this.visible_container.appendChild(child);
685
+ // } else {
686
+ // this.visible_container.insertBefore(child, this.visible_container.firstChild);
687
+ // }
688
+ // child.rendered = true;
689
+ // }
690
+ // }
691
+ // // Last visible element.
692
+ // else if (is_visible && child_start_y >= end_y) {
693
+ // child.transform(`translateY(${child_start_y - visible_height}px)`); // also update when still visible but height changes may have been made to an element.
694
+ // visible_height += height;
695
+ // is_visible = false;
696
+ // if (!child.rendered) {
697
+ // if (scrolling_down) {
698
+ // this.visible_container.appendChild(child);
699
+ // } else {
700
+ // this.visible_container.insertBefore(child, this.visible_container.firstChild);
701
+ // }
702
+ // child.rendered = true;
703
+ // }
704
+ // }
705
+ // // Visible elements.
706
+ // else if (is_visible) {
707
+ // child.transform(`translateY(${child_start_y - visible_height}px)`); // also update when still visible but height changes may have been made to an element.
708
+ // visible_height += height;
709
+ // if (!child.rendered) {
710
+ // if (scrolling_down) {
711
+ // this.visible_container.appendChild(child);
712
+ // } else {
713
+ // this.visible_container.insertBefore(child, this.visible_container.firstChild);
714
+ // }
715
+ // child.rendered = true;
716
+ // }
717
+ // }
718
+ // // Invisible elements.
719
+ // else if (child.rendered) {
720
+ // child.remove();
721
+ // child.rendered = false;
722
+ // }
723
+ // })
724
+ // // Set scroll dimension.
725
+ // this.visible_container.min_height(total_height);
726
+ // this.visible_container.max_height(total_height);
727
+ // // Return this.
728
+ // return this;
729
+ // }
730
+ // // Update heights.
731
+ // update_heights(): this {
732
+ // this._v_children.iterate((child) => {
733
+ // child.v_height = this.get_height(child, false);
734
+ // })
735
+ // return this;
736
+ // }
737
+ // // Update height of a certain child.
738
+ // update_height(child: any): this {
739
+ // child.v_height = this.get_height(child, false);
740
+ // return this;
741
+ // }
742
+ // // Get the height of an element.
743
+ // get_height(element, fixed = true): number {
744
+ // let height;
745
+ // // Get fixed height.
746
+ // if (fixed) {
747
+ // height = parseFloat(element.style.height);
748
+ // if (isNaN(height)) {
749
+ // console.error("Every element in the virtual scroller must have a fixed height, ignoring element: " + element);
750
+ // element.style.display = "none";
751
+ // return 0;
752
+ // }
753
+ // }
754
+ // // Append to document and get height.
755
+ // // Does not require fixed heights but is slow.
756
+ // else {
757
+ // element.rendered = false; // set rendered to false because this will remove the child from this.visible_container when it was rendered.
758
+ // this.height_measurer.appendChild(element);
759
+ // height = element.offsetHeight;
760
+ // this.height_measurer.removeChild(element);
761
+ // }
762
+ // // Add margin.
763
+ // const margin_top = parseFloat(element.style.marginTop);
764
+ // if (!isNaN(margin_top)) {
765
+ // height += margin_top;
766
+ // }
767
+ // const margin_bottom = parseFloat(element.style.marginBottom);
768
+ // if (!isNaN(margin_bottom)) {
769
+ // height += margin_bottom;
770
+ // }
771
+ // // Handler.
772
+ // return height;
773
+ // }
774
+ // // Custom append function.
775
+ // append(...children: AppendType[]): this {
776
+ // for (let i = 0; i < children.length; i++) {
777
+ // const child = children[i];
778
+ // if (child != null) {
779
+ // // VWeb element.
780
+ // if (child.element_name != null) {
781
+ // if (
782
+ // child.element_name == "ForEachElement" ||
783
+ // child.element_name == "IfElement" ||
784
+ // child.element_name == "IfDeviceWithElement"
785
+ // ) {
786
+ // child.append_children_to(this);
787
+ // } else {
788
+ // this._v_children.push(child);
789
+ // }
790
+ // }
791
+ // // Execute function.
792
+ // else if (Utils.is_func(child)) {
793
+ // this.append(child());
794
+ // }
795
+ // // Node element.
796
+ // else if (child instanceof Node) {
797
+ // this._v_children.push(child);
798
+ // }
799
+ // // Append text.
800
+ // else if (Utils.is_string(child)) {
801
+ // this._v_children.push(document.createTextNode(child));
802
+ // }
803
+ // }
804
+ // }
805
+ // return this;
806
+ // }
807
+ // }
808
+ // export const VirtualScroller = Elements.wrapper(VirtualScrollerElement);
809
+ // export const NullVirtualScroller = Elements.create_null(VirtualScrollerElement);
810
+ // declare module './any_element.d.ts' { interface AnyElementMap { VirtualScrollerElement: VirtualScrollerElement }}
810
811
  /* @docs:
811
812
  @nav: Frontend
812
813
  @chapter: Elements
@@ -819,17 +820,29 @@ export const NullVirtualScroller = Elements.create_null(VirtualScrollerElement);
819
820
  This class is still experimental.
820
821
  */
821
822
  let SnapScrollerElement = (() => {
822
- var _a;
823
- let _classDecorators = [(_a = Elements).register.bind(_a)];
823
+ let _classDecorators = [Elements.create({
824
+ name: "SnapScrollerElement",
825
+ })];
824
826
  let _classDescriptor;
825
827
  let _classExtraInitializers = [];
826
828
  let _classThis;
827
829
  let _classSuper = VStackElement;
828
- var SnapScrollerElement = _classThis = class extends _classSuper {
830
+ var SnapScrollerElement = class extends _classSuper {
831
+ static { _classThis = this; }
832
+ static {
833
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
834
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
835
+ SnapScrollerElement = _classThis = _classDescriptor.value;
836
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
837
+ __runInitializers(_classThis, _classExtraInitializers);
838
+ }
839
+ // Constructor.
829
840
  constructor(...children) {
830
841
  // Base.
831
842
  super();
832
- this._init_derived({ derived: SnapScrollerElement, });
843
+ this._init({
844
+ derived: SnapScrollerElement,
845
+ });
833
846
  // Style.
834
847
  this.overflow_y("scroll");
835
848
  this.scroll_snap_type("y mandatory");
@@ -837,6 +850,7 @@ let SnapScrollerElement = (() => {
837
850
  this.append(...children);
838
851
  }
839
852
  // Append.
853
+ // @ts-ignore base type accepts more input types, this one only accepts velements
840
854
  append(...children) {
841
855
  for (let i = 0; i < children.length; i++) {
842
856
  const win = children[i];
@@ -888,14 +902,6 @@ let SnapScrollerElement = (() => {
888
902
  return this;
889
903
  }
890
904
  };
891
- __setFunctionName(_classThis, "SnapScrollerElement");
892
- (() => {
893
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
894
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
895
- SnapScrollerElement = _classThis = _classDescriptor.value;
896
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
897
- __runInitializers(_classThis, _classExtraInitializers);
898
- })();
899
905
  return SnapScrollerElement = _classThis;
900
906
  })();
901
907
  export { SnapScrollerElement };