@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.
Files changed (287) hide show
  1. package/backend/dist/cjs/database.d.ts +41 -68
  2. package/backend/dist/cjs/database.js +127 -76
  3. package/backend/dist/cjs/endpoint.d.ts +23 -9
  4. package/backend/dist/cjs/endpoint.js +98 -21
  5. package/backend/dist/cjs/frontend.d.ts +0 -2
  6. package/backend/dist/cjs/frontend.js +9 -9
  7. package/backend/dist/cjs/image_endpoint.d.ts +3 -1
  8. package/backend/dist/cjs/image_endpoint.js +2 -1
  9. package/backend/dist/cjs/payments/paddle.js +10 -2
  10. package/backend/dist/cjs/plugins/css.d.ts +6 -5
  11. package/backend/dist/cjs/plugins/css.js +32 -7
  12. package/backend/dist/cjs/plugins/ts/compiler.d.ts +6 -1
  13. package/backend/dist/cjs/plugins/ts/compiler.js +26 -2
  14. package/backend/dist/cjs/plugins/ts/preprocessing.js +5 -3
  15. package/backend/dist/cjs/server.d.ts +7 -13
  16. package/backend/dist/cjs/server.js +184 -303
  17. package/backend/dist/cjs/status.d.ts +1 -0
  18. package/backend/dist/cjs/status.js +2 -1
  19. package/backend/dist/cjs/stream.d.ts +5 -3
  20. package/backend/dist/cjs/stream.js +13 -4
  21. package/backend/dist/cjs/users.d.ts +1 -1
  22. package/backend/dist/cjs/users.js +87 -72
  23. package/backend/dist/cjs/utils.d.ts +17 -9
  24. package/backend/dist/cjs/utils.js +22 -64
  25. package/backend/dist/cjs/view.d.ts +2 -2
  26. package/backend/dist/cjs/view.js +38 -40
  27. package/backend/dist/cjs/volt.d.ts +3 -2
  28. package/backend/dist/cjs/volt.js +2 -2
  29. package/backend/dist/css/volt.css +5 -0
  30. package/backend/dist/esm/database.d.ts +41 -68
  31. package/backend/dist/esm/database.js +127 -76
  32. package/backend/dist/esm/endpoint.d.ts +23 -9
  33. package/backend/dist/esm/endpoint.js +99 -22
  34. package/backend/dist/esm/frontend.d.ts +0 -2
  35. package/backend/dist/esm/frontend.js +9 -9
  36. package/backend/dist/esm/image_endpoint.d.ts +3 -1
  37. package/backend/dist/esm/image_endpoint.js +2 -1
  38. package/backend/dist/esm/payments/paddle.js +11 -3
  39. package/backend/dist/esm/plugins/css.d.ts +6 -5
  40. package/backend/dist/esm/plugins/css.js +32 -6
  41. package/backend/dist/esm/plugins/ts/compiler.d.ts +6 -1
  42. package/backend/dist/esm/plugins/ts/compiler.js +26 -2
  43. package/backend/dist/esm/plugins/ts/preprocessing.js +5 -3
  44. package/backend/dist/esm/server.d.ts +7 -13
  45. package/backend/dist/esm/server.js +182 -301
  46. package/backend/dist/esm/status.d.ts +1 -0
  47. package/backend/dist/esm/status.js +1 -0
  48. package/backend/dist/esm/stream.d.ts +5 -3
  49. package/backend/dist/esm/stream.js +13 -4
  50. package/backend/dist/esm/users.d.ts +1 -1
  51. package/backend/dist/esm/users.js +87 -72
  52. package/backend/dist/esm/utils.d.ts +17 -9
  53. package/backend/dist/esm/utils.js +21 -62
  54. package/backend/dist/esm/view.d.ts +2 -2
  55. package/backend/dist/esm/view.js +38 -40
  56. package/backend/dist/esm/volt.d.ts +3 -2
  57. package/backend/dist/esm/volt.js +2 -1
  58. package/backend/dist/esm-dev/blacklist.js +1 -1
  59. package/backend/dist/esm-dev/cli.js +2 -2
  60. package/backend/dist/esm-dev/database.d.ts +41 -68
  61. package/backend/dist/esm-dev/database.js +128 -77
  62. package/backend/dist/esm-dev/endpoint.d.ts +23 -9
  63. package/backend/dist/esm-dev/endpoint.js +100 -23
  64. package/backend/dist/esm-dev/file_watcher.js +1 -1
  65. package/backend/dist/esm-dev/frontend.d.ts +0 -2
  66. package/backend/dist/esm-dev/frontend.js +9 -9
  67. package/backend/dist/esm-dev/image_endpoint.d.ts +3 -1
  68. package/backend/dist/esm-dev/image_endpoint.js +2 -1
  69. package/backend/dist/esm-dev/logger.js +1 -1
  70. package/backend/dist/esm-dev/payments/paddle.js +12 -4
  71. package/backend/dist/esm-dev/plugins/css.d.ts +6 -5
  72. package/backend/dist/esm-dev/plugins/css.js +33 -7
  73. package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +6 -1
  74. package/backend/dist/esm-dev/plugins/ts/compiler.js +27 -3
  75. package/backend/dist/esm-dev/plugins/ts/preprocessing.js +7 -5
  76. package/backend/dist/esm-dev/rate_limit.js +1 -1
  77. package/backend/dist/esm-dev/server.d.ts +7 -13
  78. package/backend/dist/esm-dev/server.js +184 -303
  79. package/backend/dist/esm-dev/status.d.ts +1 -0
  80. package/backend/dist/esm-dev/status.js +1 -0
  81. package/backend/dist/esm-dev/stream.d.ts +5 -3
  82. package/backend/dist/esm-dev/stream.js +13 -4
  83. package/backend/dist/esm-dev/users.d.ts +1 -1
  84. package/backend/dist/esm-dev/users.js +88 -73
  85. package/backend/dist/esm-dev/utils.d.ts +17 -9
  86. package/backend/dist/esm-dev/utils.js +22 -63
  87. package/backend/dist/esm-dev/view.d.ts +2 -2
  88. package/backend/dist/esm-dev/view.js +39 -41
  89. package/backend/dist/esm-dev/volt.d.ts +3 -2
  90. package/backend/dist/esm-dev/volt.js +2 -1
  91. package/backend/src/database.ts +163 -152
  92. package/backend/src/endpoint.ts +123 -31
  93. package/backend/src/frontend.ts +9 -8
  94. package/backend/src/image_endpoint.ts +4 -0
  95. package/backend/src/payments/paddle.ts +11 -3
  96. package/backend/src/plugins/css.ts +36 -8
  97. package/backend/src/plugins/ts/compiler.ts +37 -1
  98. package/backend/src/plugins/ts/preprocessing.ts +5 -3
  99. package/backend/src/server.ts +167 -306
  100. package/backend/src/status.ts +1 -0
  101. package/backend/src/stream.ts +28 -8
  102. package/backend/src/users.ts +87 -72
  103. package/backend/src/utils.ts +58 -25
  104. package/backend/src/view.ts +30 -28
  105. package/backend/src/{volt.js → volt.ts} +2 -1
  106. package/backend/tsconfig.cjs.json +3 -3
  107. package/backend/tsconfig.esm.json +3 -3
  108. package/frontend/dist/elements/base.d.ts +397 -415
  109. package/frontend/dist/elements/base.js +565 -328
  110. package/frontend/dist/elements/module.d.ts +26 -12
  111. package/frontend/dist/elements/module.js +69 -32
  112. package/frontend/dist/elements/register_element.d.ts +3 -0
  113. package/frontend/dist/elements/register_element.js +22 -0
  114. package/frontend/dist/modules/auth.d.ts +1 -0
  115. package/frontend/dist/modules/auth.js +6 -5
  116. package/frontend/dist/modules/color.d.ts +159 -0
  117. package/frontend/dist/modules/color.js +315 -0
  118. package/frontend/dist/modules/colors.d.ts +1 -26
  119. package/frontend/dist/modules/colors.js +417 -338
  120. package/frontend/dist/modules/cookies.d.ts +1 -0
  121. package/frontend/dist/modules/cookies.js +1 -0
  122. package/frontend/dist/modules/events.d.ts +1 -0
  123. package/frontend/dist/modules/events.js +1 -0
  124. package/frontend/dist/modules/google.d.ts +1 -0
  125. package/frontend/dist/modules/google.js +1 -0
  126. package/frontend/dist/modules/meta.d.ts +1 -0
  127. package/frontend/dist/modules/meta.js +1 -0
  128. package/frontend/dist/modules/mutex.d.ts +1 -2
  129. package/frontend/dist/modules/mutex.js +3 -4
  130. package/frontend/dist/modules/paddle.d.ts +1 -0
  131. package/frontend/dist/modules/paddle.js +14 -13
  132. package/frontend/dist/modules/scheme.d.ts +1 -0
  133. package/frontend/dist/modules/scheme.js +4 -2
  134. package/frontend/dist/modules/statics.d.ts +1 -0
  135. package/frontend/dist/modules/statics.js +1 -0
  136. package/frontend/dist/modules/support.d.ts +1 -0
  137. package/frontend/dist/modules/support.js +3 -2
  138. package/frontend/dist/modules/theme.d.ts +56 -0
  139. package/frontend/dist/{ui → modules}/theme.js +186 -75
  140. package/frontend/dist/modules/themes.d.ts +1 -1
  141. package/frontend/dist/modules/themes.js +1 -0
  142. package/frontend/dist/modules/user.d.ts +1 -0
  143. package/frontend/dist/modules/user.js +11 -10
  144. package/frontend/dist/modules/utils.d.ts +23 -2
  145. package/frontend/dist/modules/utils.js +93 -1
  146. package/frontend/dist/types/gradient.js +4 -0
  147. package/frontend/dist/ui/border_button.d.ts +0 -25
  148. package/frontend/dist/ui/border_button.js +50 -51
  149. package/frontend/dist/ui/button.d.ts +0 -21
  150. package/frontend/dist/ui/button.js +41 -46
  151. package/frontend/dist/ui/canvas.js +15 -15
  152. package/frontend/dist/ui/checkbox.d.ts +3 -17
  153. package/frontend/dist/ui/checkbox.js +36 -30
  154. package/frontend/dist/ui/code.d.ts +15 -82
  155. package/frontend/dist/ui/code.js +150 -125
  156. package/frontend/dist/ui/color.d.ts +0 -1
  157. package/frontend/dist/ui/color.js +1 -1
  158. package/frontend/dist/ui/context_menu.d.ts +4 -2
  159. package/frontend/dist/ui/context_menu.js +16 -17
  160. package/frontend/dist/ui/css.js +2 -0
  161. package/frontend/dist/ui/divider.d.ts +0 -7
  162. package/frontend/dist/ui/divider.js +21 -25
  163. package/frontend/dist/ui/dropdown.d.ts +13 -7
  164. package/frontend/dist/ui/dropdown.js +65 -30
  165. package/frontend/dist/ui/for_each.d.ts +0 -5
  166. package/frontend/dist/ui/for_each.js +17 -22
  167. package/frontend/dist/ui/form.d.ts +17 -12
  168. package/frontend/dist/ui/form.js +21 -18
  169. package/frontend/dist/ui/frame_modes.d.ts +9 -12
  170. package/frontend/dist/ui/frame_modes.js +8 -10
  171. package/frontend/dist/ui/google_map.d.ts +0 -11
  172. package/frontend/dist/ui/google_map.js +23 -28
  173. package/frontend/dist/ui/gradient.d.ts +0 -5
  174. package/frontend/dist/ui/gradient.js +17 -22
  175. package/frontend/dist/ui/image.d.ts +27 -58
  176. package/frontend/dist/ui/image.js +99 -93
  177. package/frontend/dist/ui/input.d.ts +20 -97
  178. package/frontend/dist/ui/input.js +192 -170
  179. package/frontend/dist/ui/link.d.ts +0 -18
  180. package/frontend/dist/ui/link.js +42 -48
  181. package/frontend/dist/ui/list.js +36 -37
  182. package/frontend/dist/ui/loader_button.d.ts +4 -19
  183. package/frontend/dist/ui/loader_button.js +35 -37
  184. package/frontend/dist/ui/loaders.d.ts +0 -8
  185. package/frontend/dist/ui/loaders.js +20 -25
  186. package/frontend/dist/ui/popup.d.ts +11 -8
  187. package/frontend/dist/ui/popup.js +183 -24
  188. package/frontend/dist/ui/pseudo.d.ts +3 -3
  189. package/frontend/dist/ui/pseudo.js +14 -17
  190. package/frontend/dist/ui/scroller.d.ts +10 -48
  191. package/frontend/dist/ui/scroller.js +306 -300
  192. package/frontend/dist/ui/slider.d.ts +9 -3
  193. package/frontend/dist/ui/slider.js +31 -17
  194. package/frontend/dist/ui/spacer.d.ts +0 -9
  195. package/frontend/dist/ui/spacer.js +21 -26
  196. package/frontend/dist/ui/span.js +13 -15
  197. package/frontend/dist/ui/stack.d.ts +14 -75
  198. package/frontend/dist/ui/stack.js +166 -169
  199. package/frontend/dist/ui/steps.d.ts +10 -23
  200. package/frontend/dist/ui/steps.js +47 -34
  201. package/frontend/dist/ui/style.d.ts +4 -3
  202. package/frontend/dist/ui/style.js +13 -18
  203. package/frontend/dist/ui/switch.d.ts +10 -4
  204. package/frontend/dist/ui/switch.js +24 -16
  205. package/frontend/dist/ui/table.d.ts +0 -23
  206. package/frontend/dist/ui/table.js +113 -119
  207. package/frontend/dist/ui/tabs.d.ts +3 -19
  208. package/frontend/dist/ui/tabs.js +35 -29
  209. package/frontend/dist/ui/text.d.ts +0 -8
  210. package/frontend/dist/ui/text.js +20 -25
  211. package/frontend/dist/ui/title.d.ts +0 -15
  212. package/frontend/dist/ui/title.js +39 -45
  213. package/frontend/dist/ui/ui.d.ts +0 -2
  214. package/frontend/dist/ui/ui.js +0 -2
  215. package/frontend/dist/ui/view.d.ts +3 -17
  216. package/frontend/dist/ui/view.js +27 -32
  217. package/frontend/dist/volt.d.ts +2 -1
  218. package/frontend/dist/volt.js +3 -1
  219. package/frontend/examples/dashboard/dashboard.ts +774 -0
  220. package/frontend/examples/theme/theme.ts +58 -0
  221. package/frontend/src/css/volt.css +5 -0
  222. package/frontend/src/elements/base.ts +767 -545
  223. package/frontend/src/elements/module.ts +90 -29
  224. package/frontend/src/elements/register_element.ts +24 -0
  225. package/frontend/src/modules/auth.ts +7 -6
  226. package/frontend/src/modules/color.ts +348 -0
  227. package/frontend/src/modules/colors.ts +468 -449
  228. package/frontend/src/modules/cookies.ts +1 -0
  229. package/frontend/src/modules/events.ts +1 -0
  230. package/frontend/src/modules/google.ts +1 -0
  231. package/frontend/src/modules/meta.ts +2 -1
  232. package/frontend/src/modules/mutex.ts +2 -4
  233. package/frontend/src/modules/paddle.ts +21 -20
  234. package/frontend/src/modules/scheme.ts +4 -3
  235. package/frontend/src/modules/statics.ts +2 -1
  236. package/frontend/src/modules/support.ts +3 -2
  237. package/frontend/src/modules/theme.ts +413 -0
  238. package/frontend/src/modules/themes.ts +2 -1
  239. package/frontend/src/modules/user.ts +12 -11
  240. package/frontend/src/modules/utils.ts +125 -2
  241. package/frontend/src/ui/border_button.ts +41 -37
  242. package/frontend/src/ui/button.ts +33 -32
  243. package/frontend/src/ui/canvas.ts +5 -2
  244. package/frontend/src/ui/checkbox.ts +21 -22
  245. package/frontend/src/ui/code.ts +92 -86
  246. package/frontend/src/ui/context_menu.ts +7 -5
  247. package/frontend/src/ui/css.ts +1 -1
  248. package/frontend/src/ui/divider.ts +15 -10
  249. package/frontend/src/ui/dropdown.ts +38 -21
  250. package/frontend/src/ui/for_each.ts +9 -8
  251. package/frontend/src/ui/form.ts +26 -21
  252. package/frontend/src/ui/frame_modes.ts +13 -17
  253. package/frontend/src/ui/google_map.ts +15 -13
  254. package/frontend/src/ui/gradient.ts +9 -8
  255. package/frontend/src/ui/image.ts +108 -86
  256. package/frontend/src/ui/input.ts +145 -144
  257. package/frontend/src/ui/link.ts +25 -23
  258. package/frontend/src/ui/list.ts +12 -6
  259. package/frontend/src/ui/loader_button.ts +26 -25
  260. package/frontend/src/ui/loaders.ts +12 -11
  261. package/frontend/src/ui/popup.ts +168 -14
  262. package/frontend/src/ui/pseudo.ts +5 -3
  263. package/frontend/src/ui/scroller.ts +303 -294
  264. package/frontend/src/ui/slider.ts +15 -10
  265. package/frontend/src/ui/spacer.ts +14 -11
  266. package/frontend/src/ui/span.ts +6 -2
  267. package/frontend/src/ui/stack.ts +196 -183
  268. package/frontend/src/ui/steps.ts +38 -22
  269. package/frontend/src/ui/style.ts +7 -4
  270. package/frontend/src/ui/switch.ts +16 -11
  271. package/frontend/src/ui/table.ts +42 -34
  272. package/frontend/src/ui/tabs.ts +20 -19
  273. package/frontend/src/ui/text.ts +12 -11
  274. package/frontend/src/ui/title.ts +22 -20
  275. package/frontend/src/ui/ui.ts +0 -2
  276. package/frontend/src/ui/view.ts +20 -19
  277. package/frontend/src/volt.ts +3 -1
  278. package/frontend/{compile.js → tools/compile.old.js} +2 -2
  279. package/frontend/tools/embed_scripts.js +69 -0
  280. package/frontend/tsconfig.json +26 -0
  281. package/package.json +8 -8
  282. package/frontend/dist/ui/theme.d.ts +0 -25
  283. package/frontend/exports.json +0 -1340
  284. package/frontend/src/modules/date.js +0 -535
  285. package/frontend/src/ui/color.ts +0 -117
  286. package/frontend/src/ui/theme.ts +0 -279
  287. /package/backend/src/{vinc.dev.js → vinc.dev.ts} +0 -0
@@ -4,18 +4,16 @@
4
4
  */
5
5
 
6
6
  // Imports.
7
- import { Elements } from "../elements/module.js"
7
+ import { Elements, VElementBaseSignature, VElement, AppendType, VBaseElements } from "../elements/module.js"
8
8
 
9
9
  // Nodes type.
10
- export class FrameNodesType extends Array {
11
- constructor(...children: any[]) {
10
+ export class FrameNodes extends Array<VElement> {
11
+ constructor(...children: VElement[]) {
12
12
  super(...children)
13
13
  }
14
14
  }
15
- export const FrameNodes = Elements.wrapper(FrameNodesType);
16
- export const NullFrameNodes = Elements.create_null(FrameNodesType);
17
15
 
18
- type OnSet = (mode: string, nodes: FrameNodesType) => any
16
+ type OnSet = (mode: string, nodes: FrameNodes) => any
19
17
 
20
18
  // Frame mode used to switch easily between frames.
21
19
  /* @docs:
@@ -27,10 +25,10 @@ type OnSet = (mode: string, nodes: FrameNodesType) => any
27
25
 
28
26
  Afterwards the mode can be set using `MyMode.set("my_mode")`.
29
27
  */
30
- export class FrameModesType {
28
+ export class FrameModes {
31
29
 
32
30
  // Attributes.
33
- public modes: Record<string, FrameNodesType> = {};
31
+ public modes: Record<string, FrameNodes> = {};
34
32
  public active?: string;
35
33
  public _on_set?: OnSet;
36
34
 
@@ -40,17 +38,17 @@ export class FrameModesType {
40
38
  if (this.active == null) {
41
39
  this.active = mode;
42
40
  }
43
- this.modes[mode] = FrameNodes();
41
+ this.modes[mode] = new FrameNodes();
44
42
  }
45
43
  }
46
44
 
47
45
  // Get.
48
- get(mode: string) : FrameNodesType {
46
+ get(mode: string) : FrameNodes {
49
47
  const nodes = this.modes[mode];
50
48
  if (nodes === undefined) {
51
49
  throw new Error(`Requested mode "${mode}" does not exist.`);
52
50
  }
53
- return nodes as FrameNodesType;
51
+ return nodes as FrameNodes;
54
52
  }
55
53
 
56
54
  // Set mode.
@@ -90,14 +88,12 @@ export class FrameModesType {
90
88
  return this;
91
89
  }
92
90
  }
93
- export const FrameModes = Elements.wrapper(FrameModesType);
94
- export const NullFrameModes = Elements.create_null(FrameModesType);
95
91
 
96
92
  // Extend VElement.
97
93
  declare global {
98
94
  interface VElementExtensions {
99
- frame_mode(frame_mode: FrameNodesType): this;
100
- frame_mode(frame_modes: FrameModesType, mode_name: string): this;
95
+ frame_mode(frame_mode: FrameNodes): this;
96
+ frame_mode(frame_modes: FrameModes, mode_name: string): this;
101
97
  }
102
98
  }
103
99
  Elements.extend({
@@ -112,10 +108,10 @@ Elements.extend({
112
108
  * @return:
113
109
  * @description Returns the instance of the element for chaining.
114
110
  */
115
- frame_mode(this, ...args) {
111
+ frame_mode(this: VElement, ...args) {
116
112
  if (args.length === 1) {
117
113
  args[0].push(this);
118
- } else if (args.length === 2 && args[0] instanceof FrameModesType) {
114
+ } else if (args.length === 2 && args[0] instanceof FrameModes) {
119
115
  const frames_mode = args[0];
120
116
  const mode_name = args[1];
121
117
  if (mode_name !== frames_mode.active) {
@@ -4,25 +4,27 @@
4
4
  */
5
5
 
6
6
  // Imports.
7
- import { Elements, VElementTagMap } from "../elements/module.js"
7
+ import { Elements, VElementBaseSignature, VElement, VElementTagMap } from "../elements/module.js"
8
8
  import { Utils } from "../modules/utils.js"
9
9
  import { Google } from "../modules/google"
10
10
 
11
11
  // GoogleMap.
12
- @Elements.register
12
+ @Elements.create({
13
+ name: "GoogleMapElement",
14
+ default_style: {
15
+ "border": "0",
16
+ },
17
+ default_attributes: {
18
+ "width": "100%",
19
+ "height": "100%",
20
+ "frameborder": "0",
21
+ "style": "border:0",
22
+ "referrerpolicy": "no-referrer-when-downgrade",
23
+ "allowfullscreen": "true",
24
+ },
25
+ })
13
26
  export class GoogleMapElement extends VElementTagMap.iframe {
14
27
 
15
- static default_style = {
16
- "border": "0",
17
- };
18
- static default_attributes = {
19
- "width": "100%",
20
- "height": "100%",
21
- "frameborder": "0",
22
- "style": "border:0",
23
- "referrerpolicy": "no-referrer-when-downgrade",
24
- "allowfullscreen": "true",
25
- };
26
28
 
27
29
  // Constructor.
28
30
  constructor({
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  // Imports.
7
- import { Elements, VElementTagMap } from "../elements/module.js"
7
+ import { Elements, VElementBaseSignature, VElement, VElementTagMap } from "../elements/module.js"
8
8
  import { Utils } from "../modules/utils.js"
9
9
  import { GradientType } from "../types/gradient.js"
10
10
 
@@ -13,15 +13,16 @@ export const Gradient = Elements.wrapper(GradientType);
13
13
  export const NullGradient = Elements.create_null(GradientType);
14
14
 
15
15
  // Gradient border.
16
- @Elements.register
16
+ @Elements.create({
17
+ name: "GradientBorderElement",
18
+ default_style: {
19
+ "--child-border-width": "1px",
20
+ "--child-border-radius": "10px",
21
+ "--child-border-color": "black",
22
+ },
23
+ })
17
24
  export class GradientBorderElement extends VElementTagMap.div {
18
25
 
19
- static default_style = {
20
- "--child-border-width": "1px",
21
- "--child-border-radius": "10px",
22
- "--child-border-color": "black",
23
- };
24
-
25
26
  // Constructor.
26
27
  constructor() {
27
28
 
@@ -5,21 +5,22 @@
5
5
 
6
6
  // Imports.
7
7
  import { Utils } from "../modules/utils.js"
8
- import { Elements, VElementTagMap, VDivElement, VAnchorElement } from "../elements/module.js"
9
- import { Statics } from "../modules/statics"
10
- import { Settings } from "../modules/settings"
11
- import { AnchorElement } from "./link"
12
- import { VStack, VStackElement } from "./stack"
8
+ import { Elements, VElement, VElementBaseSignature, VElementTagMap, VDivElement, VAnchorElement } from "../elements/module.js"
9
+ import { Statics } from "../modules/statics.js"
10
+ import { Settings } from "../modules/settings.js"
11
+ import { AnchorElement } from "./link.js"
12
+ import { VStack, VStackElement } from "./stack.js"
13
13
 
14
14
  // Image.
15
- @Elements.register
16
- export class ImageElement extends VElementTagMap.img {
17
-
18
- static default_style = {
19
- "margin": "0px",
20
- "padding": "0px",
21
- "object-fit": "cover",
22
- };
15
+ @Elements.create({
16
+ name: "ImageElement",
17
+ default_style: {
18
+ "margin": "0px",
19
+ "padding": "0px",
20
+ "object-fit": "cover",
21
+ },
22
+ })
23
+ export class ImageElement extends VElementTagMap.img {;
23
24
 
24
25
  // Static attributes.
25
26
  static default_alt?: string;
@@ -133,9 +134,9 @@ export class ImageElement extends VElementTagMap.img {
133
134
  // }
134
135
 
135
136
  // Height, purely for safari.
136
- height(): string
137
- height(value: string, check_attribute?: boolean): this;
138
- height(value?: string, check_attribute: boolean = true): this | string {
137
+ height(): string | number
138
+ height(value: string | number, check_attribute?: boolean): this;
139
+ height(value?: string | number, check_attribute: boolean = true): this | string | number {
139
140
  if (this._e === undefined) {
140
141
  return super.height(value as any, check_attribute);
141
142
  }
@@ -151,9 +152,9 @@ export class ImageElement extends VElementTagMap.img {
151
152
  }
152
153
  return this;
153
154
  }
154
- min_height(): string
155
- min_height(value: string): this;
156
- min_height(value?: string): this | string {
155
+ min_height(): string | number
156
+ min_height(value: string | number): this;
157
+ min_height(value?: string | number): this | string | number {
157
158
  if (this._e === undefined) {
158
159
  return super.min_height(value as any);
159
160
  }
@@ -168,9 +169,9 @@ export class ImageElement extends VElementTagMap.img {
168
169
  }
169
170
  return this;
170
171
  }
171
- max_height(): string
172
- max_height(value: string): this;
173
- max_height(value?: string): this | string {
172
+ max_height(): string | number
173
+ max_height(value: string | number): this;
174
+ max_height(value?: string | number): this | string | number {
174
175
  if (this._e === undefined) {
175
176
  return super.max_height(value as any);
176
177
  }
@@ -188,8 +189,8 @@ export class ImageElement extends VElementTagMap.img {
188
189
 
189
190
  // Width, purely for safari.
190
191
  width(): string | number;
191
- width(value: string, check_attribute?: boolean): this;
192
- width(value?: string, check_attribute: boolean = true): this | number | string {
192
+ width(value: string | number, check_attribute?: boolean): this;
193
+ width(value?: string | number, check_attribute: boolean = true): this | number | string {
193
194
  if (this._e === undefined) {
194
195
  return super.width(value as any, check_attribute);
195
196
  }
@@ -205,9 +206,9 @@ export class ImageElement extends VElementTagMap.img {
205
206
  }
206
207
  return this;
207
208
  }
208
- min_width(): string
209
- min_width(value: string): this;
210
- min_width(value?: string): this | string {
209
+ min_width(): string | number
210
+ min_width(value: string | number): this;
211
+ min_width(value?: string | number): this | string | number {
211
212
  if (this._e === undefined) {
212
213
  return super.min_width(value as any);
213
214
  }
@@ -222,9 +223,9 @@ export class ImageElement extends VElementTagMap.img {
222
223
  }
223
224
  return this;
224
225
  }
225
- max_width(): string
226
- max_width(value: string): this;
227
- max_width(value?: string): this | string {
226
+ max_width(): string | number
227
+ max_width(value: string | number): this;
228
+ max_width(value?: string | number): this | string | number {
228
229
  if (this._e === undefined) {
229
230
  return super.max_width(value as any);
230
231
  }
@@ -276,17 +277,10 @@ declare module './any_element.d.ts' { interface AnyElementMap { ImageElement: Im
276
277
  // }
277
278
 
278
279
  // AnchorImage.
279
- @Elements.register
280
- export class AnchorImageElement extends AnchorElement {
281
-
282
- #macro ForwardFuncToImg(attr_name) \
283
- attr_name(): string; \
284
- attr_name(value: string): this; \
285
- attr_name(value?: string): this | string { if (value == null) { return this.image.attr_name(); } this.image.attr_name(value); return this; }
286
- #macro ForwardFuncToImgNr(attr_name) \
287
- attr_name(): string | number; \
288
- attr_name(value: string): this; \
289
- attr_name(value?: string): this | string | number { if (value == null) { return this.image.attr_name(); } this.image.attr_name(value); return this; }
280
+ @Elements.create({
281
+ name: "AnchorImageElement",
282
+ })
283
+ export class AnchorImageElement extends (AnchorElement as any as VElementBaseSignature) {
290
284
 
291
285
  // Default styling.
292
286
  public image: ImageElement;
@@ -296,7 +290,7 @@ export class AnchorImageElement extends AnchorElement {
296
290
 
297
291
  // Initialize base classes.
298
292
  super(href, alt);
299
- this._init_derived({
293
+ this._init({
300
294
  derived: AnchorImageElement,
301
295
  })
302
296
 
@@ -315,15 +309,41 @@ export class AnchorImageElement extends AnchorElement {
315
309
  }
316
310
 
317
311
  // ImageElement alias functions.
318
- #ForwardFuncToImg(src)
319
- #ForwardFuncToImg(alt)
320
- // ForwardFuncToImg(completed)
321
- #ForwardFuncToImg(height)
322
- #ForwardFuncToImg(min_height)
323
- #ForwardFuncToImg(max_height)
324
- #ForwardFuncToImgNr(width)
325
- #ForwardFuncToImg(min_width)
326
- #ForwardFuncToImg(max_width)
312
+ src(): string;
313
+ src(value: string): this;
314
+ src(value?: string): this | string { if (value == null) { return this.image.src(); } this.image.src(value); return this; }
315
+
316
+ alt(): string;
317
+ alt(value: string): this;
318
+ alt(value?: string): this | string { if (value == null) { return this.image.alt(); } this.image.alt(value); return this; }
319
+
320
+ // completed(): string;
321
+ // completed(value: string): this;
322
+ // completed(value?: string): this | string { if (value == null) { return this.image.completed(); } this.image.completed(value); return this; }
323
+
324
+ height(): string | number;
325
+ height(value: string | number): this;
326
+ height(value?: string | number): this | string | number { if (value == null) { return this.image.height(); } this.image.height(value); return this; }
327
+
328
+ min_height(): string | number;
329
+ min_height(value: string | number): this;
330
+ min_height(value?: string | number): this | string | number { if (value == null) { return this.image.min_height(); } this.image.min_height(value); return this; }
331
+
332
+ max_height(): string | number;
333
+ max_height(value: string | number): this;
334
+ max_height(value?: string | number): this | string | number { if (value == null) { return this.image.max_height(); } this.image.max_height(value); return this; }
335
+
336
+ width(): string | number;
337
+ width(value: string | number): this;
338
+ width(value?: string | number): this | string | number { if (value == null) { return this.image.width(); } this.image.width(value); return this; }
339
+
340
+ min_width(): string | number;
341
+ min_width(value: string | number): this;
342
+ min_width(value?: string | number): this | string | number { if (value == null) { return this.image.min_width(); } this.image.min_width(value); return this; }
343
+
344
+ max_width(): string | number;
345
+ max_width(value: string | number): this;
346
+ max_width(value?: string | number): this | string | number { if (value == null) { return this.image.max_width(); } this.image.max_width(value); return this; }
327
347
 
328
348
  // @ts-ignore
329
349
  loading(): string;
@@ -350,25 +370,26 @@ declare module './any_element.d.ts' { interface AnyElementMap { AnchorImageEleme
350
370
 
351
371
 
352
372
  // ImageMask.
353
- @Elements.register
373
+ @Elements.create({
374
+ name: "ImageMaskElement",
375
+ default_style: {
376
+ "margin": "0px",
377
+ "padding": "0px",
378
+ "object-fit": "cover",
379
+ "display": "inline-block",
380
+
381
+ // Anchor.
382
+ "font-family": "inherit",
383
+ "font-size": "inherit",
384
+ "color": "inherit",
385
+ "text-decoration": "none",
386
+ "text-underline-position": "none",
387
+ "outline": "none",
388
+ "border": "none",
389
+ },
390
+ })
354
391
  export class ImageMaskElement extends VElementTagMap.div {
355
392
 
356
- static default_style = {
357
- "margin": "0px",
358
- "padding": "0px",
359
- "object-fit": "cover",
360
- "display": "inline-block",
361
-
362
- // Anchor.
363
- "font-family": "inherit",
364
- "font-size": "inherit",
365
- "color": "inherit",
366
- "text-decoration": "none",
367
- "text-underline-position": "none",
368
- "outline": "none",
369
- "border": "none",
370
- };
371
-
372
393
  // Attributes.
373
394
  public mask_child: VStackElement;
374
395
  public _img_src?: string;
@@ -474,26 +495,27 @@ export const NullImageMask = Elements.create_null(ImageMaskElement);
474
495
  declare module './any_element.d.ts' { interface AnyElementMap { ImageMaskElement: ImageMaskElement }}
475
496
 
476
497
  // Exact copy of image mask.
477
- @Elements.register
498
+ @Elements.create({
499
+ name: "AnchorImageMaskElement",
500
+ default_style: {
501
+ "margin": "0px",
502
+ "padding": "0px",
503
+ "object-fit": "cover",
504
+ "display": "inline-block",
505
+
506
+ // Anchor.
507
+ "font-family": "inherit",
508
+ "font-size": "inherit",
509
+ "color": "inherit",
510
+ "text-decoration": "none",
511
+ "text-underline-position": "none",
512
+ "cursor": "pointer",
513
+ "outline": "none",
514
+ "border": "none",
515
+ },
516
+ })
478
517
  export class AnchorImageMaskElement extends VElementTagMap.a {
479
518
 
480
- static default_style = {
481
- "margin": "0px",
482
- "padding": "0px",
483
- "object-fit": "cover",
484
- "display": "inline-block",
485
-
486
- // Anchor.
487
- "font-family": "inherit",
488
- "font-size": "inherit",
489
- "color": "inherit",
490
- "text-decoration": "none",
491
- "text-underline-position": "none",
492
- "cursor": "pointer",
493
- "outline": "none",
494
- "border": "none",
495
- };
496
-
497
519
  // Attributes.
498
520
  public mask_child: VStackElement;
499
521
  public _img_src?: string;