@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
@@ -1,16 +1,30 @@
1
1
  export * from "./base.js";
2
2
  import { VElement, extend as extend_velement, wrapper as _wrapper, create_null as _create_null } from "./base.js";
3
+ import { register_element as _register_element } from "./register_element.js";
3
4
  export declare namespace Elements {
4
- function get(id: string): VElement;
5
- function get_by_id(id: string): VElement;
6
- function click(id: string): void;
7
- function register_type(type: any, tag?: string): void;
8
- function register<T extends {
9
- new (...args: any[]): {};
10
- }>(constructor: T): void;
11
- const wrapper: typeof _wrapper;
12
- const create_null: typeof _create_null;
13
- function submit(...elements: (string | VElement | HTMLElement)[]): Record<string, any>;
14
- function forward_func_to_child(func_name: string, child: any): (val?: any) => any;
15
- const extend: typeof extend_velement;
5
+ export const register_element: typeof _register_element;
6
+ export function get(id: string): VElement;
7
+ export function get_by_id(id: string): VElement;
8
+ export function click(id: string): void;
9
+ type Constructor<T = any> = new (...args: any[]) => T;
10
+ interface CreateOpts {
11
+ name: string;
12
+ tag?: string;
13
+ default_style?: Record<string, any>;
14
+ default_attributes?: Record<string, any>;
15
+ default_events?: Record<string, any>;
16
+ }
17
+ /**
18
+ * Class decorator factory.
19
+ * @example
20
+ * @create({ name: "Foo", tag?: "section", base: HTMLElement })
21
+ * class Foo extends HTMLElement { … }
22
+ */
23
+ export function create(opts: CreateOpts): <T extends Constructor>(constructor: T) => T;
24
+ export const wrapper: typeof _wrapper;
25
+ export const create_null: typeof _create_null;
26
+ export function submit(...elements: (string | VElement | HTMLElement)[]): Record<string, any>;
27
+ export function forward_func_to_child(func_name: string, child: any): (val?: any) => any;
28
+ export const extend: typeof extend_velement;
29
+ export {};
16
30
  }
@@ -5,8 +5,11 @@
5
5
  // Import elements create func.
6
6
  export * from "./base.js";
7
7
  import { extend as extend_velement, wrapper as _wrapper, create_null as _create_null, } from "./base.js";
8
+ import { register_element as _register_element } from "./register_element.js";
9
+ // Elements module.
8
10
  export var Elements;
9
11
  (function (Elements) {
12
+ Elements.register_element = _register_element;
10
13
  // Get by id.
11
14
  // @note: always use VElement as return type since this is most likely the case and avoids type casting for users.
12
15
  /* @docs:
@@ -61,39 +64,73 @@ export var Elements;
61
64
  }
62
65
  }
63
66
  Elements.click = click;
64
- // Register a custom type.
65
- /* @docs:
66
- @nav: Frontend
67
- @chapter: Elements
68
- @title: Register Custom Type
69
- @desc: Registers a custom element type.
70
- @param:
71
- @name: type
72
- @description The custom element type (class).
73
- @param:
74
- @name: tag
75
- @description Optional tag name to extend.
76
- */
77
- function register_type(type, tag) {
78
- type._is_registered = true;
79
- // customElements.define(type.name, type, { extends: tag || (type as any).element_tag });
80
- customElements.define("v-" + type.name.toLowerCase(), type, { extends: tag || type.element_tag });
81
- }
82
- Elements.register_type = register_type;
83
- // Register decorator.
84
- /* @docs:
85
- @nav: Frontend
86
- @chapter: Elements
87
- @title: Register Decorator
88
- @desc: Registers a class as a custom element.
89
- @param:
90
- @name: constructor
91
- @description The class constructor to register.
92
- */
93
- function register(constructor) {
94
- Elements.register_type(constructor);
67
+ /**
68
+ * Class decorator factory.
69
+ * @example
70
+ * @create({ name: "Foo", tag?: "section", base: HTMLElement })
71
+ * class Foo extends HTMLElement { … }
72
+ */
73
+ function create(opts) {
74
+ // Validate required options at factory time
75
+ if (typeof opts.name !== "string" || opts.name.trim() === "") {
76
+ throw new Error(`@Elements.create requires a non-empty string “name”`);
77
+ }
78
+ // Factory function
79
+ return function (constructor) {
80
+ const any_ctor = constructor;
81
+ // Define readonly static attributes.
82
+ any_ctor.element_name = opts.name;
83
+ // Object.defineProperty(any_ctor, "element_name", { value: opts.name, writable: false, enumerable: true, configurable: false });
84
+ if (opts.tag != null) {
85
+ any_ctor.element_tag = opts.tag;
86
+ // Object.defineProperty(any_ctor, "element_tag", { value: opts.tag, writable: false, enumerable: true, configurable: false });
87
+ }
88
+ if (opts.default_style != null) {
89
+ any_ctor.default_style = opts.default_style;
90
+ // Object.defineProperty(any_ctor, "default_style", { value: opts.default_style, writable: false, enumerable: true, configurable: false });
91
+ }
92
+ if (opts.default_attributes != null) {
93
+ any_ctor.default_attributes = opts.default_attributes;
94
+ // Object.defineProperty(any_ctor, "default_attributes", { value: opts.default_attributes, writable: false, enumerable: true, configurable: false });
95
+ }
96
+ if (opts.default_events != null) {
97
+ any_ctor.default_events = opts.default_events;
98
+ // Object.defineProperty(any_ctor, "default_events", { value: opts.default_events, writable: false, enumerable: true, configurable: false });
99
+ }
100
+ // Register custom element exactly once
101
+ _register_element(constructor);
102
+ return constructor;
103
+ };
95
104
  }
96
- Elements.register = register;
105
+ Elements.create = create;
106
+ // export function create<T extends { new(...args: any[]): {} }>(constructor: T): void {
107
+ // const any_con = constructor as any;
108
+ // // Register new html element.
109
+ // if (!any_con._volt_is_registered) {
110
+ // console.log({ type: constructor })
111
+ // if (!any_con.element_name) {
112
+ // throw new Error(`Static element attribute '${any_con.name}.element_name' should always be defined, create static attribute \"element_name: string\" and assign the name of the class to this attribute.`)
113
+ // }
114
+ // const name = any_con.element_name || any_con.name;
115
+ // let new_xml_name = "", count = 0;
116
+ // do {
117
+ // new_xml_name = "v-" + name.toLowerCase() + (count > 0 ? "-" + count : "");
118
+ // } while (registered_type_names.has(new_xml_name) && ++count);
119
+ // registered_type_names.add(new_xml_name);
120
+ // const ext = tag || any_con.element_tag;
121
+ // // @debug
122
+ // console.log("Registering custom element: ", {
123
+ // name,
124
+ // type: constructor,
125
+ // new_xml_name,
126
+ // extends: ext,
127
+ // element_name: any_con.element_name,
128
+ // });
129
+ // any_con._volt_is_registered = true;
130
+ // // customElements.define(type.name, type, { extends: tag || (type as any).element_tag });
131
+ // customElements.define(new_xml_name, any_con, { extends: ext });
132
+ // }
133
+ // }
97
134
  // Create a constructor wrapper.
98
135
  Elements.wrapper = _wrapper;
99
136
  // Create a shared null element mainly for typescript types.
@@ -0,0 +1,3 @@
1
+ /** Separate file for register_element() method to prevent recursive imports from base.ts and module.ts */
2
+ export declare const registered_names: Set<string>;
3
+ export declare function register_element(constructor: any): void;
@@ -0,0 +1,22 @@
1
+ /** Separate file for register_element() method to prevent recursive imports from base.ts and module.ts */
2
+ export const registered_names = new Set();
3
+ export function register_element(constructor) {
4
+ // @warning dont use any caching on the constructor, it will break the element registration since the constructor can be used as base class.
5
+ const any_ctor = constructor;
6
+ if (!any_ctor.element_name) {
7
+ console.error("Error constructor:", constructor);
8
+ throw new Error("Static element attribute 'element_name' should always be defined, create static attribute \"element_name: string\" and assign the name of the class to this attribute.");
9
+ }
10
+ const base_name = any_ctor.element_name;
11
+ let new_tag = "";
12
+ let count = 0;
13
+ do {
14
+ new_tag = `v-${base_name.toLowerCase()}${count ? `-${count}` : ""}`;
15
+ count++;
16
+ } while (registered_names.has(new_tag));
17
+ registered_names.add(new_tag);
18
+ const extend_options = any_ctor.element_tag
19
+ ? { extends: any_ctor.element_tag }
20
+ : undefined;
21
+ customElements.define(new_tag, any_ctor, extend_options);
22
+ }
@@ -43,3 +43,4 @@ export declare namespace Auth {
43
43
  }): Promise<Auth.ForgotPasswordResponse>;
44
44
  export {};
45
45
  }
46
+ export { Auth as auth };
@@ -32,7 +32,7 @@ export var Auth;
32
32
  @description The user's 2fa code. Only required when 2fa is enabled in the server.
33
33
  */
34
34
  function sign_in({ email = "", username = "", password = "", code = "", }) {
35
- return Utils.request({
35
+ return Utils.request_v1({
36
36
  method: "POST",
37
37
  url: "/volt/auth/signin",
38
38
  data: {
@@ -52,7 +52,7 @@ export var Auth;
52
52
  @desc: Make a sign up request.
53
53
  */
54
54
  function sign_up({ username = "", email = "", first_name = "", last_name = "", password = "", verify_password = "", phone_number = "", code = "", }) {
55
- return Utils.request({
55
+ return Utils.request_v1({
56
56
  method: "POST",
57
57
  url: "/volt/auth/signup",
58
58
  data: {
@@ -76,7 +76,7 @@ export var Auth;
76
76
  @desc: Make a sign out request.
77
77
  */
78
78
  function sign_out() {
79
- return Utils.request({
79
+ return Utils.request_v1({
80
80
  method: "POST",
81
81
  url: "/volt/auth/signout",
82
82
  });
@@ -93,7 +93,7 @@ export var Auth;
93
93
  @description The user's email.
94
94
  */
95
95
  function send_2fa(email) {
96
- return Utils.request({
96
+ return Utils.request_v1({
97
97
  method: "GET",
98
98
  url: "/volt/auth/2fa",
99
99
  data: {
@@ -122,7 +122,7 @@ export var Auth;
122
122
  @description The user's new password.
123
123
  */
124
124
  function forgot_password({ email = "", code = "", password = "", verify_password = "", }) {
125
- return Utils.request({
125
+ return Utils.request_v1({
126
126
  method: "POST",
127
127
  url: "/volt/auth/forgot_password",
128
128
  data: {
@@ -136,3 +136,4 @@ export var Auth;
136
136
  Auth.forgot_password = forgot_password;
137
137
  })(Auth || (Auth = {}));
138
138
  ;
139
+ export { Auth as auth }; // also export as lowercase for compatibility.
@@ -0,0 +1,159 @@
1
+ /**
2
+ * A utility class for color manipulation, conversion, and adjustment.
3
+ * Accepts colors in hex (e.g. "#ff0000"), RGB/RGBA strings (e.g. "rgb(255, 0, 0)" or "rgba(255,0,0,1)"),
4
+ * or as an array of numbers ([r, g, b] or [r, g, b, a]).
5
+ *
6
+ * All transformation methods (adjust_brightness, darken, lighten, interpolate, etc.) return a new Color instance,
7
+ * so they can be chained in a single line.
8
+ */
9
+ export declare class Color {
10
+ static readonly black: string;
11
+ static readonly red: string;
12
+ static readonly red_bold: string;
13
+ static readonly green: string;
14
+ static readonly yellow: string;
15
+ static readonly blue: string;
16
+ static readonly magenta: string;
17
+ static readonly cyan: string;
18
+ static readonly light_gray: string;
19
+ static readonly gray: string;
20
+ static readonly bold: string;
21
+ static readonly italic: string;
22
+ static readonly end: string;
23
+ static readonly purple: string;
24
+ static readonly bg: Record<'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white', string>;
25
+ static readonly bright_bg: Record<'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white', string>;
26
+ private readonly _rgba;
27
+ /**
28
+ * Creates a new Color instance.
29
+ * @param input - A hex string, an "rgb(...)" / "rgba(...)" string, or an array of numbers ([r, g, b] or [r, g, b, a]).
30
+ */
31
+ constructor(input: string | number[]);
32
+ /**
33
+ * Converts input into an RGBA object.
34
+ * @private
35
+ */
36
+ private static _from_input;
37
+ /**
38
+ * Converts a numeric array to an RGBA object.
39
+ * @param array - An array of numbers representing [r, g, b] or [r, g, b, a].
40
+ */
41
+ static array_to_rgba(array: number[]): {
42
+ r: number;
43
+ g: number;
44
+ b: number;
45
+ a: number;
46
+ };
47
+ /**
48
+ * Converts a hex color string to an RGBA object or an array.
49
+ * @param hex - The hex color string (with or without "#").
50
+ * @param as_array - If true, returns an array [r, g, b, a]; otherwise an object.
51
+ */
52
+ static hex_to_rgb(hex: string, as_array: true): number[];
53
+ static hex_to_rgb(hex: string, as_array?: false): {
54
+ r: number;
55
+ g: number;
56
+ b: number;
57
+ a: number;
58
+ };
59
+ /**
60
+ * Converts an "rgb(...)" or "rgba(...)" string to an RGBA object.
61
+ * @param color - The RGB(A) color string.
62
+ * @throws Error if the color format is invalid.
63
+ */
64
+ static rgb_to_obj(color: string): {
65
+ r: number;
66
+ g: number;
67
+ b: number;
68
+ a: number;
69
+ };
70
+ /**
71
+ * Converts RGBA values to a hex color string.
72
+ * @param r - Red channel value.
73
+ * @param g - Green channel value.
74
+ * @param b - Blue channel value.
75
+ * @param a - Alpha channel value (defaults to 1).
76
+ */
77
+ static rgb_to_hex(r: number, g: number, b: number, a?: number): string;
78
+ /**
79
+ * Converts RGBA values to an "rgb(...)" or "rgba(...)" string.
80
+ * @param r - Red channel.
81
+ * @param g - Green channel.
82
+ * @param b - Blue channel.
83
+ * @param a - Alpha channel (defaults to 1).
84
+ */
85
+ static rgb_to_str(r: number, g: number, b: number, a?: number): string;
86
+ /**
87
+ * Returns the hex string representation of this Color.
88
+ */
89
+ to_hex(): string;
90
+ hex(): string;
91
+ /**
92
+ * Returns the RGB(A) string representation of this Color.
93
+ */
94
+ str(): string;
95
+ to_str(): string;
96
+ to_rgb(): string;
97
+ rgb(): string;
98
+ /**
99
+ * Returns the brightness of the color.
100
+ * Uses the formula: (0.299*R + 0.587*G + 0.114*B) / 255.
101
+ * @returns A number between 0 (bright) and 1 (dark).
102
+ */
103
+ private get_brightness;
104
+ /**
105
+ * Adjusts the brightness of the color by adding a constant to each RGB channel.
106
+ * @param adjust - The value to add (can be negative).
107
+ * @returns A new Color instance with modified brightness.
108
+ */
109
+ adjust_brightness(adjust: number): Color;
110
+ /** Get opacity. */
111
+ get_opacity(): number;
112
+ /**
113
+ * Sets the opacity (alpha channel) of the color.
114
+ * @param opacity - A number between 0 and 1.
115
+ * @returns A new Color instance with the given opacity.
116
+ * @throws Error if the opacity is not within [0,1].
117
+ */
118
+ opacity(opacity?: number): Color;
119
+ /**
120
+ * Darkens the color by interpolating toward black.
121
+ * @param percent - The percentage to darken (between 0 and 1).
122
+ * @returns A new Color instance darkened by the specified percentage.
123
+ * @throws Error if the percentage is not within [0,1].
124
+ */
125
+ darken(percent?: number): Color;
126
+ /**
127
+ * Lightens the color by interpolating toward white.
128
+ * @param percent - The percentage to lighten (between 0 and 1).
129
+ * @returns A new Color instance lightened by the specified percentage.
130
+ * @throws Error if the percentage is not within [0,1].
131
+ */
132
+ lighten(percent?: number): Color;
133
+ /**
134
+ * Automatically darken when the color is bright or lighten when the color is dark.
135
+ *
136
+ * @param evaluation When the evaluation returns true the color will be darkened.
137
+ */
138
+ auto_darken_lighten(percent?: number, evaluation?: (brightness: number) => boolean): Color;
139
+ /**
140
+ * Interpolates between this color and an end color.
141
+ * When percent is 0 the original color is returned, and when 1 the end color is returned.
142
+ * @param end - The target color (hex string, rgb(a) string, number array, or Color).
143
+ * @param percent - The interpolation factor (0 to 1).
144
+ * @param alpha - The resulting alpha value (0 to 1).
145
+ * @returns A new Color instance representing the interpolated color.
146
+ * @throws Error if percent or alpha are out of range.
147
+ */
148
+ interpolate(end: string | number[] | Color, percent?: number, alpha?: number): Color;
149
+ /**
150
+ * Returns the opposite (contrasting) color.
151
+ * Returns black ("#000000") if the color is bright, or white ("#ffffff") if it is dark.
152
+ * @returns A new Color instance that is either black or white.
153
+ */
154
+ opposite(): Color;
155
+ static opposite_s(color: ConstructorParameters<typeof Color>[0]): Color;
156
+ opposite_hex(): "#000000" | "#ffffff";
157
+ static opposite_hex_s(color: ConstructorParameters<typeof Color>[0]): "#000000" | "#ffffff";
158
+ }
159
+ export { Color as color };