@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.
- package/backend/dist/cjs/database.d.ts +41 -68
- package/backend/dist/cjs/database.js +136 -78
- package/backend/dist/cjs/endpoint.d.ts +23 -9
- package/backend/dist/cjs/endpoint.js +98 -21
- package/backend/dist/cjs/file_watcher.js +2 -2
- package/backend/dist/cjs/frontend.d.ts +0 -2
- package/backend/dist/cjs/frontend.js +9 -9
- package/backend/dist/cjs/image_endpoint.d.ts +3 -1
- package/backend/dist/cjs/image_endpoint.js +2 -1
- package/backend/dist/cjs/payments/paddle.js +10 -2
- package/backend/dist/cjs/plugins/css.d.ts +6 -5
- package/backend/dist/cjs/plugins/css.js +32 -7
- package/backend/dist/cjs/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/cjs/plugins/ts/compiler.js +26 -2
- package/backend/dist/cjs/plugins/ts/preprocessing.js +5 -3
- package/backend/dist/cjs/server.d.ts +7 -13
- package/backend/dist/cjs/server.js +184 -303
- package/backend/dist/cjs/status.d.ts +1 -0
- package/backend/dist/cjs/status.js +2 -1
- package/backend/dist/cjs/stream.d.ts +5 -3
- package/backend/dist/cjs/stream.js +13 -4
- package/backend/dist/cjs/users.d.ts +1 -1
- package/backend/dist/cjs/users.js +87 -72
- package/backend/dist/cjs/utils.d.ts +17 -9
- package/backend/dist/cjs/utils.js +22 -64
- package/backend/dist/cjs/view.d.ts +2 -2
- package/backend/dist/cjs/view.js +38 -40
- package/backend/dist/cjs/volt.d.ts +3 -2
- package/backend/dist/cjs/volt.js +2 -2
- package/backend/dist/css/volt.css +5 -0
- package/backend/dist/esm/database.d.ts +41 -68
- package/backend/dist/esm/database.js +137 -79
- package/backend/dist/esm/endpoint.d.ts +23 -9
- package/backend/dist/esm/endpoint.js +99 -22
- package/backend/dist/esm/file_watcher.js +2 -2
- package/backend/dist/esm/frontend.d.ts +0 -2
- package/backend/dist/esm/frontend.js +9 -9
- package/backend/dist/esm/image_endpoint.d.ts +3 -1
- package/backend/dist/esm/image_endpoint.js +2 -1
- package/backend/dist/esm/payments/paddle.js +11 -3
- package/backend/dist/esm/plugins/css.d.ts +6 -5
- package/backend/dist/esm/plugins/css.js +32 -6
- package/backend/dist/esm/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/esm/plugins/ts/compiler.js +26 -2
- package/backend/dist/esm/plugins/ts/preprocessing.js +5 -3
- package/backend/dist/esm/server.d.ts +7 -13
- package/backend/dist/esm/server.js +182 -301
- package/backend/dist/esm/status.d.ts +1 -0
- package/backend/dist/esm/status.js +1 -0
- package/backend/dist/esm/stream.d.ts +5 -3
- package/backend/dist/esm/stream.js +13 -4
- package/backend/dist/esm/users.d.ts +1 -1
- package/backend/dist/esm/users.js +87 -72
- package/backend/dist/esm/utils.d.ts +17 -9
- package/backend/dist/esm/utils.js +21 -62
- package/backend/dist/esm/view.d.ts +2 -2
- package/backend/dist/esm/view.js +38 -40
- package/backend/dist/esm/volt.d.ts +3 -2
- package/backend/dist/esm/volt.js +2 -1
- package/backend/dist/esm-dev/blacklist.js +1 -1
- package/backend/dist/esm-dev/cli.js +2 -2
- package/backend/dist/esm-dev/database.d.ts +41 -68
- package/backend/dist/esm-dev/database.js +138 -80
- package/backend/dist/esm-dev/endpoint.d.ts +23 -9
- package/backend/dist/esm-dev/endpoint.js +100 -23
- package/backend/dist/esm-dev/file_watcher.js +3 -3
- package/backend/dist/esm-dev/frontend.d.ts +0 -2
- package/backend/dist/esm-dev/frontend.js +9 -9
- package/backend/dist/esm-dev/image_endpoint.d.ts +3 -1
- package/backend/dist/esm-dev/image_endpoint.js +2 -1
- package/backend/dist/esm-dev/logger.js +1 -1
- package/backend/dist/esm-dev/payments/paddle.js +12 -4
- package/backend/dist/esm-dev/plugins/css.d.ts +6 -5
- package/backend/dist/esm-dev/plugins/css.js +33 -7
- package/backend/dist/esm-dev/plugins/ts/compiler.d.ts +6 -1
- package/backend/dist/esm-dev/plugins/ts/compiler.js +27 -3
- package/backend/dist/esm-dev/plugins/ts/preprocessing.js +7 -5
- package/backend/dist/esm-dev/rate_limit.js +1 -1
- package/backend/dist/esm-dev/server.d.ts +7 -13
- package/backend/dist/esm-dev/server.js +184 -303
- package/backend/dist/esm-dev/status.d.ts +1 -0
- package/backend/dist/esm-dev/status.js +1 -0
- package/backend/dist/esm-dev/stream.d.ts +5 -3
- package/backend/dist/esm-dev/stream.js +13 -4
- package/backend/dist/esm-dev/users.d.ts +1 -1
- package/backend/dist/esm-dev/users.js +88 -73
- package/backend/dist/esm-dev/utils.d.ts +17 -9
- package/backend/dist/esm-dev/utils.js +22 -63
- package/backend/dist/esm-dev/view.d.ts +2 -2
- package/backend/dist/esm-dev/view.js +39 -41
- package/backend/dist/esm-dev/volt.d.ts +3 -2
- package/backend/dist/esm-dev/volt.js +2 -1
- package/backend/src/database.ts +173 -155
- package/backend/src/endpoint.ts +123 -31
- package/backend/src/file_watcher.ts +2 -2
- package/backend/src/frontend.ts +9 -8
- package/backend/src/image_endpoint.ts +4 -0
- package/backend/src/payments/paddle.ts +11 -3
- package/backend/src/plugins/css.ts +36 -8
- package/backend/src/plugins/ts/compiler.ts +37 -1
- package/backend/src/plugins/ts/preprocessing.ts +5 -3
- package/backend/src/server.ts +167 -306
- package/backend/src/status.ts +1 -0
- package/backend/src/stream.ts +28 -8
- package/backend/src/users.ts +87 -72
- package/backend/src/utils.ts +58 -25
- package/backend/src/view.ts +30 -28
- package/backend/src/{volt.js → volt.ts} +2 -1
- package/backend/tsconfig.cjs.json +3 -3
- package/backend/tsconfig.esm.json +3 -3
- package/frontend/dist/elements/base.d.ts +414 -432
- package/frontend/dist/elements/base.js +566 -329
- package/frontend/dist/elements/module.d.ts +26 -12
- package/frontend/dist/elements/module.js +69 -32
- package/frontend/dist/elements/register_element.d.ts +3 -0
- package/frontend/dist/elements/register_element.js +22 -0
- package/frontend/dist/modules/auth.d.ts +1 -0
- package/frontend/dist/modules/auth.js +6 -5
- package/frontend/dist/modules/color.d.ts +159 -0
- package/frontend/dist/modules/color.js +315 -0
- package/frontend/dist/modules/colors.d.ts +1 -26
- package/frontend/dist/modules/colors.js +417 -340
- package/frontend/dist/modules/cookies.d.ts +1 -0
- package/frontend/dist/modules/cookies.js +1 -0
- package/frontend/dist/modules/events.d.ts +1 -0
- package/frontend/dist/modules/events.js +1 -0
- package/frontend/dist/modules/google.d.ts +1 -0
- package/frontend/dist/modules/google.js +1 -0
- package/frontend/dist/modules/meta.d.ts +1 -0
- package/frontend/dist/modules/meta.js +1 -0
- package/frontend/dist/modules/mutex.d.ts +1 -2
- package/frontend/dist/modules/mutex.js +3 -4
- package/frontend/dist/modules/paddle.d.ts +1 -0
- package/frontend/dist/modules/paddle.js +14 -13
- package/frontend/dist/modules/scheme.d.ts +1 -0
- package/frontend/dist/modules/scheme.js +5 -3
- package/frontend/dist/modules/statics.d.ts +1 -0
- package/frontend/dist/modules/statics.js +1 -0
- package/frontend/dist/modules/support.d.ts +1 -0
- package/frontend/dist/modules/support.js +3 -2
- package/frontend/dist/modules/theme.d.ts +56 -0
- package/frontend/dist/{ui → modules}/theme.js +186 -75
- package/frontend/dist/modules/themes.d.ts +1 -1
- package/frontend/dist/modules/themes.js +1 -0
- package/frontend/dist/modules/user.d.ts +1 -0
- package/frontend/dist/modules/user.js +11 -10
- package/frontend/dist/modules/utils.d.ts +23 -2
- package/frontend/dist/modules/utils.js +93 -1
- package/frontend/dist/types/gradient.js +4 -0
- package/frontend/dist/ui/border_button.d.ts +0 -25
- package/frontend/dist/ui/border_button.js +50 -51
- package/frontend/dist/ui/button.d.ts +0 -21
- package/frontend/dist/ui/button.js +41 -46
- package/frontend/dist/ui/canvas.js +15 -15
- package/frontend/dist/ui/checkbox.d.ts +3 -17
- package/frontend/dist/ui/checkbox.js +36 -30
- package/frontend/dist/ui/code.d.ts +15 -82
- package/frontend/dist/ui/code.js +150 -125
- package/frontend/dist/ui/color.d.ts +0 -1
- package/frontend/dist/ui/color.js +1 -1
- package/frontend/dist/ui/context_menu.d.ts +4 -2
- package/frontend/dist/ui/context_menu.js +16 -17
- package/frontend/dist/ui/css.js +2 -0
- package/frontend/dist/ui/divider.d.ts +0 -7
- package/frontend/dist/ui/divider.js +21 -25
- package/frontend/dist/ui/dropdown.d.ts +13 -7
- package/frontend/dist/ui/dropdown.js +65 -30
- package/frontend/dist/ui/for_each.d.ts +0 -5
- package/frontend/dist/ui/for_each.js +17 -22
- package/frontend/dist/ui/form.d.ts +17 -12
- package/frontend/dist/ui/form.js +21 -18
- package/frontend/dist/ui/frame_modes.d.ts +9 -12
- package/frontend/dist/ui/frame_modes.js +8 -10
- package/frontend/dist/ui/google_map.d.ts +0 -11
- package/frontend/dist/ui/google_map.js +23 -28
- package/frontend/dist/ui/gradient.d.ts +0 -5
- package/frontend/dist/ui/gradient.js +17 -22
- package/frontend/dist/ui/image.d.ts +27 -58
- package/frontend/dist/ui/image.js +99 -93
- package/frontend/dist/ui/input.d.ts +20 -97
- package/frontend/dist/ui/input.js +192 -170
- package/frontend/dist/ui/link.d.ts +0 -18
- package/frontend/dist/ui/link.js +42 -48
- package/frontend/dist/ui/list.js +36 -37
- package/frontend/dist/ui/loader_button.d.ts +4 -19
- package/frontend/dist/ui/loader_button.js +35 -37
- package/frontend/dist/ui/loaders.d.ts +0 -8
- package/frontend/dist/ui/loaders.js +20 -25
- package/frontend/dist/ui/popup.d.ts +11 -8
- package/frontend/dist/ui/popup.js +183 -24
- package/frontend/dist/ui/pseudo.d.ts +3 -3
- package/frontend/dist/ui/pseudo.js +14 -17
- package/frontend/dist/ui/scroller.d.ts +10 -48
- package/frontend/dist/ui/scroller.js +306 -300
- package/frontend/dist/ui/slider.d.ts +9 -3
- package/frontend/dist/ui/slider.js +31 -17
- package/frontend/dist/ui/spacer.d.ts +0 -9
- package/frontend/dist/ui/spacer.js +21 -26
- package/frontend/dist/ui/span.js +13 -15
- package/frontend/dist/ui/stack.d.ts +14 -75
- package/frontend/dist/ui/stack.js +166 -169
- package/frontend/dist/ui/steps.d.ts +10 -23
- package/frontend/dist/ui/steps.js +47 -34
- package/frontend/dist/ui/style.d.ts +4 -3
- package/frontend/dist/ui/style.js +13 -18
- package/frontend/dist/ui/switch.d.ts +10 -4
- package/frontend/dist/ui/switch.js +24 -16
- package/frontend/dist/ui/table.d.ts +0 -23
- package/frontend/dist/ui/table.js +113 -119
- package/frontend/dist/ui/tabs.d.ts +3 -19
- package/frontend/dist/ui/tabs.js +35 -29
- package/frontend/dist/ui/text.d.ts +0 -8
- package/frontend/dist/ui/text.js +20 -25
- package/frontend/dist/ui/title.d.ts +0 -15
- package/frontend/dist/ui/title.js +39 -45
- package/frontend/dist/ui/ui.d.ts +0 -2
- package/frontend/dist/ui/ui.js +0 -2
- package/frontend/dist/ui/view.d.ts +3 -17
- package/frontend/dist/ui/view.js +27 -32
- package/frontend/dist/volt.d.ts +2 -1
- package/frontend/dist/volt.js +3 -1
- package/frontend/examples/dashboard/dashboard.ts +774 -0
- package/frontend/examples/theme/theme.ts +58 -0
- package/frontend/src/css/volt.css +5 -0
- package/frontend/src/elements/base.ts +767 -545
- package/frontend/src/elements/module.ts +90 -29
- package/frontend/src/elements/register_element.ts +24 -0
- package/frontend/src/modules/auth.ts +7 -6
- package/frontend/src/modules/color.ts +348 -0
- package/frontend/src/modules/colors.ts +468 -449
- package/frontend/src/modules/cookies.ts +1 -0
- package/frontend/src/modules/events.ts +1 -0
- package/frontend/src/modules/google.ts +1 -0
- package/frontend/src/modules/meta.ts +2 -1
- package/frontend/src/modules/mutex.ts +2 -4
- package/frontend/src/modules/paddle.ts +21 -20
- package/frontend/src/modules/scheme.ts +5 -4
- package/frontend/src/modules/statics.ts +2 -1
- package/frontend/src/modules/support.ts +3 -2
- package/frontend/src/modules/theme.ts +413 -0
- package/frontend/src/modules/themes.ts +2 -1
- package/frontend/src/modules/user.ts +12 -11
- package/frontend/src/modules/utils.ts +125 -2
- package/frontend/src/ui/border_button.ts +41 -37
- package/frontend/src/ui/button.ts +33 -32
- package/frontend/src/ui/canvas.ts +5 -2
- package/frontend/src/ui/checkbox.ts +21 -22
- package/frontend/src/ui/code.ts +92 -86
- package/frontend/src/ui/context_menu.ts +7 -5
- package/frontend/src/ui/css.ts +1 -1
- package/frontend/src/ui/divider.ts +15 -10
- package/frontend/src/ui/dropdown.ts +38 -21
- package/frontend/src/ui/for_each.ts +9 -8
- package/frontend/src/ui/form.ts +26 -21
- package/frontend/src/ui/frame_modes.ts +13 -17
- package/frontend/src/ui/google_map.ts +15 -13
- package/frontend/src/ui/gradient.ts +9 -8
- package/frontend/src/ui/image.ts +108 -86
- package/frontend/src/ui/input.ts +145 -144
- package/frontend/src/ui/link.ts +25 -23
- package/frontend/src/ui/list.ts +12 -6
- package/frontend/src/ui/loader_button.ts +26 -25
- package/frontend/src/ui/loaders.ts +12 -11
- package/frontend/src/ui/popup.ts +168 -14
- package/frontend/src/ui/pseudo.ts +5 -3
- package/frontend/src/ui/scroller.ts +303 -294
- package/frontend/src/ui/slider.ts +15 -10
- package/frontend/src/ui/spacer.ts +14 -11
- package/frontend/src/ui/span.ts +6 -2
- package/frontend/src/ui/stack.ts +196 -183
- package/frontend/src/ui/steps.ts +38 -22
- package/frontend/src/ui/style.ts +7 -4
- package/frontend/src/ui/switch.ts +16 -11
- package/frontend/src/ui/table.ts +42 -34
- package/frontend/src/ui/tabs.ts +20 -19
- package/frontend/src/ui/text.ts +12 -11
- package/frontend/src/ui/title.ts +22 -20
- package/frontend/src/ui/ui.ts +0 -2
- package/frontend/src/ui/view.ts +20 -19
- package/frontend/src/volt.ts +3 -1
- package/frontend/{compile.js → tools/compile.old.js} +2 -2
- package/frontend/tools/embed_scripts.js +69 -0
- package/frontend/tsconfig.json +26 -0
- package/package.json +7 -6
- package/frontend/dist/ui/theme.d.ts +0 -25
- package/frontend/exports.json +0 -1340
- package/frontend/src/modules/date.js +0 -535
- package/frontend/src/ui/color.ts +0 -117
- package/frontend/src/ui/theme.ts +0 -279
- /package/backend/src/{vinc.dev.js → vinc.dev.ts} +0 -0
|
@@ -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
|
-
|
|
5
|
-
function
|
|
6
|
-
function
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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.
|
|
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,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
|
+
}
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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 };
|