@bquery/bquery 1.4.0 → 1.5.0
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/README.md +139 -120
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/index.d.ts +2 -0
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/library.d.ts +34 -0
- package/dist/component/library.d.ts.map +1 -0
- package/dist/component/types.d.ts +10 -6
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component-CY5MVoYN.js +531 -0
- package/dist/component-CY5MVoYN.js.map +1 -0
- package/dist/component.es.mjs +6 -184
- package/dist/config-DRmZZno3.js +40 -0
- package/dist/config-DRmZZno3.js.map +1 -0
- package/dist/core-CK2Mfpf4.js +648 -0
- package/dist/core-CK2Mfpf4.js.map +1 -0
- package/dist/core-DPdbItcq.js +112 -0
- package/dist/core-DPdbItcq.js.map +1 -0
- package/dist/core.es.mjs +45 -1261
- package/dist/full.d.ts +6 -6
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +98 -92
- package/dist/full.iife.js +173 -3
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +173 -3
- package/dist/full.umd.js.map +1 -1
- package/dist/index.es.mjs +143 -139
- package/dist/motion/transition.d.ts +1 -1
- package/dist/motion/transition.d.ts.map +1 -1
- package/dist/motion/types.d.ts +11 -1
- package/dist/motion/types.d.ts.map +1 -1
- package/dist/motion-C5DRdPnO.js +415 -0
- package/dist/motion-C5DRdPnO.js.map +1 -0
- package/dist/motion.es.mjs +25 -361
- package/dist/object-qGpWr6-J.js +38 -0
- package/dist/object-qGpWr6-J.js.map +1 -0
- package/dist/platform/announcer.d.ts +59 -0
- package/dist/platform/announcer.d.ts.map +1 -0
- package/dist/platform/config.d.ts +92 -0
- package/dist/platform/config.d.ts.map +1 -0
- package/dist/platform/cookies.d.ts +45 -0
- package/dist/platform/cookies.d.ts.map +1 -0
- package/dist/platform/index.d.ts +8 -0
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/meta.d.ts +62 -0
- package/dist/platform/meta.d.ts.map +1 -0
- package/dist/platform-B7JhGBc7.js +361 -0
- package/dist/platform-B7JhGBc7.js.map +1 -0
- package/dist/platform.es.mjs +11 -248
- package/dist/reactive/async-data.d.ts +114 -0
- package/dist/reactive/async-data.d.ts.map +1 -0
- package/dist/reactive/index.d.ts +2 -2
- package/dist/reactive/index.d.ts.map +1 -1
- package/dist/reactive/signal.d.ts +2 -0
- package/dist/reactive/signal.d.ts.map +1 -1
- package/dist/reactive-BDya-ia8.js +253 -0
- package/dist/reactive-BDya-ia8.js.map +1 -0
- package/dist/reactive.es.mjs +18 -34
- package/dist/router-CijiICxt.js +188 -0
- package/dist/router-CijiICxt.js.map +1 -0
- package/dist/router.es.mjs +11 -200
- package/dist/sanitize-jyJ2ryE2.js +302 -0
- package/dist/sanitize-jyJ2ryE2.js.map +1 -0
- package/dist/security/constants.d.ts.map +1 -1
- package/dist/security.es.mjs +10 -56
- package/dist/store-CPK9E62U.js +262 -0
- package/dist/store-CPK9E62U.js.map +1 -0
- package/dist/store.es.mjs +12 -25
- package/dist/view-Cdi0g-qo.js +396 -0
- package/dist/view-Cdi0g-qo.js.map +1 -0
- package/dist/view.es.mjs +10 -430
- package/package.json +15 -11
- package/src/component/component.ts +319 -289
- package/src/component/index.ts +42 -40
- package/src/component/library.ts +504 -0
- package/src/component/types.ts +91 -85
- package/src/core/collection.ts +628 -628
- package/src/core/element.ts +774 -774
- package/src/core/index.ts +48 -48
- package/src/core/utils/function.ts +151 -151
- package/src/full.ts +223 -187
- package/src/motion/animate.ts +113 -113
- package/src/motion/flip.ts +176 -176
- package/src/motion/scroll.ts +57 -57
- package/src/motion/spring.ts +150 -150
- package/src/motion/timeline.ts +246 -246
- package/src/motion/transition.ts +53 -7
- package/src/motion/types.ts +208 -198
- package/src/platform/announcer.ts +208 -0
- package/src/platform/config.ts +163 -0
- package/src/platform/cookies.ts +165 -0
- package/src/platform/index.ts +39 -18
- package/src/platform/meta.ts +168 -0
- package/src/platform/storage.ts +215 -215
- package/src/reactive/async-data.ts +486 -0
- package/src/reactive/core.ts +114 -114
- package/src/reactive/effect.ts +54 -54
- package/src/reactive/index.ts +37 -23
- package/src/reactive/internals.ts +122 -122
- package/src/reactive/signal.ts +29 -20
- package/src/security/constants.ts +211 -209
- package/src/security/sanitize-core.ts +364 -364
- package/src/view/evaluate.ts +290 -290
- package/dist/batch-x7b2eZST.js +0 -13
- package/dist/batch-x7b2eZST.js.map +0 -1
- package/dist/component.es.mjs.map +0 -1
- package/dist/core-BhpuvPhy.js +0 -170
- package/dist/core-BhpuvPhy.js.map +0 -1
- package/dist/core.es.mjs.map +0 -1
- package/dist/full.es.mjs.map +0 -1
- package/dist/index.es.mjs.map +0 -1
- package/dist/motion.es.mjs.map +0 -1
- package/dist/persisted-DHoi3uEs.js +0 -278
- package/dist/persisted-DHoi3uEs.js.map +0 -1
- package/dist/platform.es.mjs.map +0 -1
- package/dist/reactive.es.mjs.map +0 -1
- package/dist/router.es.mjs.map +0 -1
- package/dist/sanitize-Cxvxa-DX.js +0 -283
- package/dist/sanitize-Cxvxa-DX.js.map +0 -1
- package/dist/security.es.mjs.map +0 -1
- package/dist/store.es.mjs.map +0 -1
- package/dist/type-guards-BdKlYYlS.js +0 -32
- package/dist/type-guards-BdKlYYlS.js.map +0 -1
- package/dist/untrack-DNnnqdlR.js +0 -6
- package/dist/untrack-DNnnqdlR.js.map +0 -1
- package/dist/view.es.mjs.map +0 -1
- package/dist/watch-DXXv3iAI.js +0 -58
- package/dist/watch-DXXv3iAI.js.map +0 -1
package/src/component/types.ts
CHANGED
|
@@ -1,85 +1,91 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Component types and render context definitions.
|
|
3
|
-
*
|
|
4
|
-
* @module bquery/component
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Defines a single prop's type and configuration.
|
|
9
|
-
*
|
|
10
|
-
* @template T - The TypeScript type of the prop value
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* const myProp: PropDefinition<number> = {
|
|
15
|
-
* type: Number,
|
|
16
|
-
* required: false,
|
|
17
|
-
* default: 0,
|
|
18
|
-
* };
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export type PropDefinition<T = unknown> = {
|
|
22
|
-
/** Constructor or converter function for the prop type */
|
|
23
|
-
type:
|
|
24
|
-
| StringConstructor
|
|
25
|
-
| NumberConstructor
|
|
26
|
-
| BooleanConstructor
|
|
27
|
-
| ObjectConstructor
|
|
28
|
-
| ArrayConstructor
|
|
29
|
-
| { new (value: unknown): T }
|
|
30
|
-
| ((value: unknown) => T);
|
|
31
|
-
/** Whether the prop must be provided */
|
|
32
|
-
required?: boolean;
|
|
33
|
-
/** Default value when prop is not provided */
|
|
34
|
-
default?: T;
|
|
35
|
-
/** Optional validator function to validate prop values */
|
|
36
|
-
validator?: (value: T) => boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Explicitly control whether to invoke `type` with `new` (constructor) or as a plain function.
|
|
39
|
-
* - `true`: Always use `new type(value)` (for class constructors, Date, etc.)
|
|
40
|
-
* - `false`: Always call `type(value)` (for converter functions)
|
|
41
|
-
* - `undefined` (default): Auto-detect based on heuristics with fallback
|
|
42
|
-
*/
|
|
43
|
-
construct?: boolean;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Render context passed into a component render function.
|
|
48
|
-
*/
|
|
49
|
-
export type ComponentRenderContext<TProps extends Record<string, unknown>> = {
|
|
50
|
-
/** Typed props object populated from attributes */
|
|
51
|
-
props: TProps;
|
|
52
|
-
/** Internal mutable state object */
|
|
53
|
-
state: Record<string, unknown>;
|
|
54
|
-
/** Emit a custom event from the component */
|
|
55
|
-
emit: (event: string, detail?: unknown) => void;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Complete component definition including props, state, styles, and lifecycle.
|
|
60
|
-
*
|
|
61
|
-
* @template TProps - Type of the component's props
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
|
|
77
|
-
/** Lifecycle hook called before
|
|
78
|
-
|
|
79
|
-
/** Lifecycle hook called
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Component types and render context definitions.
|
|
3
|
+
*
|
|
4
|
+
* @module bquery/component
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Defines a single prop's type and configuration.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The TypeScript type of the prop value
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const myProp: PropDefinition<number> = {
|
|
15
|
+
* type: Number,
|
|
16
|
+
* required: false,
|
|
17
|
+
* default: 0,
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export type PropDefinition<T = unknown> = {
|
|
22
|
+
/** Constructor or converter function for the prop type */
|
|
23
|
+
type:
|
|
24
|
+
| StringConstructor
|
|
25
|
+
| NumberConstructor
|
|
26
|
+
| BooleanConstructor
|
|
27
|
+
| ObjectConstructor
|
|
28
|
+
| ArrayConstructor
|
|
29
|
+
| { new (value: unknown): T }
|
|
30
|
+
| ((value: unknown) => T);
|
|
31
|
+
/** Whether the prop must be provided */
|
|
32
|
+
required?: boolean;
|
|
33
|
+
/** Default value when prop is not provided */
|
|
34
|
+
default?: T;
|
|
35
|
+
/** Optional validator function to validate prop values */
|
|
36
|
+
validator?: (value: T) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Explicitly control whether to invoke `type` with `new` (constructor) or as a plain function.
|
|
39
|
+
* - `true`: Always use `new type(value)` (for class constructors, Date, etc.)
|
|
40
|
+
* - `false`: Always call `type(value)` (for converter functions)
|
|
41
|
+
* - `undefined` (default): Auto-detect based on heuristics with fallback
|
|
42
|
+
*/
|
|
43
|
+
construct?: boolean;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Render context passed into a component render function.
|
|
48
|
+
*/
|
|
49
|
+
export type ComponentRenderContext<TProps extends Record<string, unknown>> = {
|
|
50
|
+
/** Typed props object populated from attributes */
|
|
51
|
+
props: TProps;
|
|
52
|
+
/** Internal mutable state object */
|
|
53
|
+
state: Record<string, unknown>;
|
|
54
|
+
/** Emit a custom event from the component */
|
|
55
|
+
emit: (event: string, detail?: unknown) => void;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Complete component definition including props, state, styles, and lifecycle.
|
|
60
|
+
*
|
|
61
|
+
* @template TProps - Type of the component's props
|
|
62
|
+
*/
|
|
63
|
+
type ComponentHook<TResult = void> = ((this: HTMLElement) => TResult) | (() => TResult);
|
|
64
|
+
type ComponentHookWithProps<TProps extends Record<string, unknown>, TResult = void> =
|
|
65
|
+
| ((this: HTMLElement, props: TProps) => TResult)
|
|
66
|
+
| ((props: TProps) => TResult);
|
|
67
|
+
type ComponentErrorHook = ((this: HTMLElement, error: Error) => void) | ((error: Error) => void);
|
|
68
|
+
|
|
69
|
+
export type ComponentDefinition<TProps extends Record<string, unknown> = Record<string, unknown>> =
|
|
70
|
+
{
|
|
71
|
+
/** Prop definitions with types and defaults */
|
|
72
|
+
props?: Record<keyof TProps, PropDefinition>;
|
|
73
|
+
/** Initial internal state */
|
|
74
|
+
state?: Record<string, unknown>;
|
|
75
|
+
/** CSS styles scoped to the component's shadow DOM */
|
|
76
|
+
styles?: string;
|
|
77
|
+
/** Lifecycle hook called before the component mounts (before first render) */
|
|
78
|
+
beforeMount?: ComponentHook;
|
|
79
|
+
/** Lifecycle hook called when component is added to DOM */
|
|
80
|
+
connected?: ComponentHook;
|
|
81
|
+
/** Lifecycle hook called when component is removed from DOM */
|
|
82
|
+
disconnected?: ComponentHook;
|
|
83
|
+
/** Lifecycle hook called before an update render; return false to prevent */
|
|
84
|
+
beforeUpdate?: ComponentHookWithProps<TProps, boolean | void>;
|
|
85
|
+
/** Lifecycle hook called after reactive updates trigger a render */
|
|
86
|
+
updated?: ComponentHook;
|
|
87
|
+
/** Error handler for errors during rendering or lifecycle */
|
|
88
|
+
onError?: ComponentErrorHook;
|
|
89
|
+
/** Render function returning HTML string */
|
|
90
|
+
render: (context: ComponentRenderContext<TProps>) => string;
|
|
91
|
+
};
|