@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.
Files changed (127) hide show
  1. package/README.md +139 -120
  2. package/dist/component/component.d.ts.map +1 -1
  3. package/dist/component/index.d.ts +2 -0
  4. package/dist/component/index.d.ts.map +1 -1
  5. package/dist/component/library.d.ts +34 -0
  6. package/dist/component/library.d.ts.map +1 -0
  7. package/dist/component/types.d.ts +10 -6
  8. package/dist/component/types.d.ts.map +1 -1
  9. package/dist/component-CY5MVoYN.js +531 -0
  10. package/dist/component-CY5MVoYN.js.map +1 -0
  11. package/dist/component.es.mjs +6 -184
  12. package/dist/config-DRmZZno3.js +40 -0
  13. package/dist/config-DRmZZno3.js.map +1 -0
  14. package/dist/core-CK2Mfpf4.js +648 -0
  15. package/dist/core-CK2Mfpf4.js.map +1 -0
  16. package/dist/core-DPdbItcq.js +112 -0
  17. package/dist/core-DPdbItcq.js.map +1 -0
  18. package/dist/core.es.mjs +45 -1261
  19. package/dist/full.d.ts +6 -6
  20. package/dist/full.d.ts.map +1 -1
  21. package/dist/full.es.mjs +98 -92
  22. package/dist/full.iife.js +173 -3
  23. package/dist/full.iife.js.map +1 -1
  24. package/dist/full.umd.js +173 -3
  25. package/dist/full.umd.js.map +1 -1
  26. package/dist/index.es.mjs +143 -139
  27. package/dist/motion/transition.d.ts +1 -1
  28. package/dist/motion/transition.d.ts.map +1 -1
  29. package/dist/motion/types.d.ts +11 -1
  30. package/dist/motion/types.d.ts.map +1 -1
  31. package/dist/motion-C5DRdPnO.js +415 -0
  32. package/dist/motion-C5DRdPnO.js.map +1 -0
  33. package/dist/motion.es.mjs +25 -361
  34. package/dist/object-qGpWr6-J.js +38 -0
  35. package/dist/object-qGpWr6-J.js.map +1 -0
  36. package/dist/platform/announcer.d.ts +59 -0
  37. package/dist/platform/announcer.d.ts.map +1 -0
  38. package/dist/platform/config.d.ts +92 -0
  39. package/dist/platform/config.d.ts.map +1 -0
  40. package/dist/platform/cookies.d.ts +45 -0
  41. package/dist/platform/cookies.d.ts.map +1 -0
  42. package/dist/platform/index.d.ts +8 -0
  43. package/dist/platform/index.d.ts.map +1 -1
  44. package/dist/platform/meta.d.ts +62 -0
  45. package/dist/platform/meta.d.ts.map +1 -0
  46. package/dist/platform-B7JhGBc7.js +361 -0
  47. package/dist/platform-B7JhGBc7.js.map +1 -0
  48. package/dist/platform.es.mjs +11 -248
  49. package/dist/reactive/async-data.d.ts +114 -0
  50. package/dist/reactive/async-data.d.ts.map +1 -0
  51. package/dist/reactive/index.d.ts +2 -2
  52. package/dist/reactive/index.d.ts.map +1 -1
  53. package/dist/reactive/signal.d.ts +2 -0
  54. package/dist/reactive/signal.d.ts.map +1 -1
  55. package/dist/reactive-BDya-ia8.js +253 -0
  56. package/dist/reactive-BDya-ia8.js.map +1 -0
  57. package/dist/reactive.es.mjs +18 -34
  58. package/dist/router-CijiICxt.js +188 -0
  59. package/dist/router-CijiICxt.js.map +1 -0
  60. package/dist/router.es.mjs +11 -200
  61. package/dist/sanitize-jyJ2ryE2.js +302 -0
  62. package/dist/sanitize-jyJ2ryE2.js.map +1 -0
  63. package/dist/security/constants.d.ts.map +1 -1
  64. package/dist/security.es.mjs +10 -56
  65. package/dist/store-CPK9E62U.js +262 -0
  66. package/dist/store-CPK9E62U.js.map +1 -0
  67. package/dist/store.es.mjs +12 -25
  68. package/dist/view-Cdi0g-qo.js +396 -0
  69. package/dist/view-Cdi0g-qo.js.map +1 -0
  70. package/dist/view.es.mjs +10 -430
  71. package/package.json +15 -11
  72. package/src/component/component.ts +319 -289
  73. package/src/component/index.ts +42 -40
  74. package/src/component/library.ts +504 -0
  75. package/src/component/types.ts +91 -85
  76. package/src/core/collection.ts +628 -628
  77. package/src/core/element.ts +774 -774
  78. package/src/core/index.ts +48 -48
  79. package/src/core/utils/function.ts +151 -151
  80. package/src/full.ts +223 -187
  81. package/src/motion/animate.ts +113 -113
  82. package/src/motion/flip.ts +176 -176
  83. package/src/motion/scroll.ts +57 -57
  84. package/src/motion/spring.ts +150 -150
  85. package/src/motion/timeline.ts +246 -246
  86. package/src/motion/transition.ts +53 -7
  87. package/src/motion/types.ts +208 -198
  88. package/src/platform/announcer.ts +208 -0
  89. package/src/platform/config.ts +163 -0
  90. package/src/platform/cookies.ts +165 -0
  91. package/src/platform/index.ts +39 -18
  92. package/src/platform/meta.ts +168 -0
  93. package/src/platform/storage.ts +215 -215
  94. package/src/reactive/async-data.ts +486 -0
  95. package/src/reactive/core.ts +114 -114
  96. package/src/reactive/effect.ts +54 -54
  97. package/src/reactive/index.ts +37 -23
  98. package/src/reactive/internals.ts +122 -122
  99. package/src/reactive/signal.ts +29 -20
  100. package/src/security/constants.ts +211 -209
  101. package/src/security/sanitize-core.ts +364 -364
  102. package/src/view/evaluate.ts +290 -290
  103. package/dist/batch-x7b2eZST.js +0 -13
  104. package/dist/batch-x7b2eZST.js.map +0 -1
  105. package/dist/component.es.mjs.map +0 -1
  106. package/dist/core-BhpuvPhy.js +0 -170
  107. package/dist/core-BhpuvPhy.js.map +0 -1
  108. package/dist/core.es.mjs.map +0 -1
  109. package/dist/full.es.mjs.map +0 -1
  110. package/dist/index.es.mjs.map +0 -1
  111. package/dist/motion.es.mjs.map +0 -1
  112. package/dist/persisted-DHoi3uEs.js +0 -278
  113. package/dist/persisted-DHoi3uEs.js.map +0 -1
  114. package/dist/platform.es.mjs.map +0 -1
  115. package/dist/reactive.es.mjs.map +0 -1
  116. package/dist/router.es.mjs.map +0 -1
  117. package/dist/sanitize-Cxvxa-DX.js +0 -283
  118. package/dist/sanitize-Cxvxa-DX.js.map +0 -1
  119. package/dist/security.es.mjs.map +0 -1
  120. package/dist/store.es.mjs.map +0 -1
  121. package/dist/type-guards-BdKlYYlS.js +0 -32
  122. package/dist/type-guards-BdKlYYlS.js.map +0 -1
  123. package/dist/untrack-DNnnqdlR.js +0 -6
  124. package/dist/untrack-DNnnqdlR.js.map +0 -1
  125. package/dist/view.es.mjs.map +0 -1
  126. package/dist/watch-DXXv3iAI.js +0 -58
  127. package/dist/watch-DXXv3iAI.js.map +0 -1
package/src/core/index.ts CHANGED
@@ -1,48 +1,48 @@
1
- export { BQueryCollection } from './collection';
2
- export { BQueryElement } from './element';
3
- export { $, $$ } from './selector';
4
- // Re-export the utils namespace for backward compatibility
5
- export { utils } from './utils';
6
- // Export individual utilities (except internal helpers)
7
- export {
8
- chunk,
9
- compact,
10
- ensureArray,
11
- flatten,
12
- unique,
13
- debounce,
14
- noop,
15
- once,
16
- throttle,
17
- isEmpty,
18
- parseJson,
19
- sleep,
20
- uid,
21
- clamp,
22
- inRange,
23
- randomInt,
24
- toNumber,
25
- clone,
26
- hasOwn,
27
- isPlainObject,
28
- merge,
29
- omit,
30
- pick,
31
- capitalize,
32
- escapeRegExp,
33
- slugify,
34
- toCamelCase,
35
- toKebabCase,
36
- truncate,
37
- isArray,
38
- isBoolean,
39
- isCollection,
40
- isDate,
41
- isElement,
42
- isFunction,
43
- isNumber,
44
- isObject,
45
- isPromise,
46
- isString,
47
- } from './utils';
48
- export type { DebouncedFn, ThrottledFn } from './utils';
1
+ export { BQueryCollection } from './collection';
2
+ export { BQueryElement } from './element';
3
+ export { $, $$ } from './selector';
4
+ // Re-export the utils namespace for backward compatibility
5
+ export { utils } from './utils';
6
+ // Export individual utilities (except internal helpers)
7
+ export {
8
+ chunk,
9
+ compact,
10
+ ensureArray,
11
+ flatten,
12
+ unique,
13
+ debounce,
14
+ noop,
15
+ once,
16
+ throttle,
17
+ isEmpty,
18
+ parseJson,
19
+ sleep,
20
+ uid,
21
+ clamp,
22
+ inRange,
23
+ randomInt,
24
+ toNumber,
25
+ clone,
26
+ hasOwn,
27
+ isPlainObject,
28
+ merge,
29
+ omit,
30
+ pick,
31
+ capitalize,
32
+ escapeRegExp,
33
+ slugify,
34
+ toCamelCase,
35
+ toKebabCase,
36
+ truncate,
37
+ isArray,
38
+ isBoolean,
39
+ isCollection,
40
+ isDate,
41
+ isElement,
42
+ isFunction,
43
+ isNumber,
44
+ isObject,
45
+ isPromise,
46
+ isString,
47
+ } from './utils';
48
+ export type { DebouncedFn, ThrottledFn } from './utils';
@@ -1,151 +1,151 @@
1
- /**
2
- * Function-focused utility helpers.
3
- *
4
- * @module bquery/core/utils/function
5
- */
6
-
7
- /** A debounced function with a cancel method to clear the pending timeout. */
8
- export interface DebouncedFn<TArgs extends unknown[]> {
9
- (...args: TArgs): void;
10
- /** Cancels the pending debounced invocation. */
11
- cancel(): void;
12
- }
13
-
14
- /** A throttled function with a cancel method to reset the throttle timer. */
15
- export interface ThrottledFn<TArgs extends unknown[]> {
16
- (...args: TArgs): void;
17
- /** Resets the throttle timer, allowing the next call to execute immediately. */
18
- cancel(): void;
19
- }
20
-
21
- /**
22
- * Creates a debounced function that delays execution until after
23
- * the specified delay has elapsed since the last call.
24
- *
25
- * @template TArgs - The argument types of the function
26
- * @param fn - The function to debounce
27
- * @param delayMs - Delay in milliseconds
28
- * @returns A debounced version of the function with a `cancel()` method
29
- *
30
- * @example
31
- * ```ts
32
- * const search = debounce((query: string) => {
33
- * console.log('Searching:', query);
34
- * }, 300);
35
- *
36
- * search('h');
37
- * search('he');
38
- * search('hello'); // Only this call executes after 300ms
39
- *
40
- * search('cancel me');
41
- * search.cancel(); // Cancels the pending invocation
42
- * ```
43
- */
44
- export function debounce<TArgs extends unknown[]>(
45
- fn: (...args: TArgs) => void,
46
- delayMs: number
47
- ): DebouncedFn<TArgs> {
48
- let timeoutId: ReturnType<typeof setTimeout> | undefined;
49
- const debounced: DebouncedFn<TArgs> = Object.assign(
50
- (...args: TArgs) => {
51
- if (timeoutId !== undefined) {
52
- clearTimeout(timeoutId);
53
- }
54
- timeoutId = setTimeout(() => {
55
- timeoutId = undefined;
56
- fn(...args);
57
- }, delayMs);
58
- },
59
- {
60
- cancel: () => {
61
- if (timeoutId !== undefined) {
62
- clearTimeout(timeoutId);
63
- timeoutId = undefined;
64
- }
65
- },
66
- }
67
- );
68
- return debounced;
69
- }
70
-
71
- /**
72
- * Creates a throttled function that runs at most once per interval.
73
- *
74
- * @template TArgs - The argument types of the function
75
- * @param fn - The function to throttle
76
- * @param intervalMs - Minimum interval between calls in milliseconds
77
- * @returns A throttled version of the function with a `cancel()` method
78
- *
79
- * @example
80
- * ```ts
81
- * const handleScroll = throttle(() => {
82
- * console.log('Scroll position:', window.scrollY);
83
- * }, 100);
84
- *
85
- * window.addEventListener('scroll', handleScroll);
86
- *
87
- * handleScroll.cancel(); // Resets throttle, next call executes immediately
88
- * ```
89
- */
90
- export function throttle<TArgs extends unknown[]>(
91
- fn: (...args: TArgs) => void,
92
- intervalMs: number
93
- ): ThrottledFn<TArgs> {
94
- let lastRun = 0;
95
- const throttled: ThrottledFn<TArgs> = Object.assign(
96
- (...args: TArgs) => {
97
- const now = Date.now();
98
- if (now - lastRun >= intervalMs) {
99
- lastRun = now;
100
- fn(...args);
101
- }
102
- },
103
- {
104
- cancel: () => {
105
- lastRun = 0;
106
- },
107
- }
108
- );
109
- return throttled;
110
- }
111
-
112
- /**
113
- * Ensures a function only runs once. Subsequent calls return the first result.
114
- *
115
- * @template TArgs - The argument types of the function
116
- * @template TResult - The return type of the function
117
- * @param fn - The function to wrap
118
- * @returns A function that only runs once
119
- *
120
- * @example
121
- * ```ts
122
- * const init = once(() => ({ ready: true }));
123
- * init();
124
- * init(); // only runs once
125
- * ```
126
- */
127
- export function once<TArgs extends unknown[], TResult>(
128
- fn: (...args: TArgs) => TResult
129
- ): (...args: TArgs) => TResult {
130
- let hasRun = false;
131
- let result!: TResult;
132
- return (...args: TArgs) => {
133
- if (!hasRun) {
134
- result = fn(...args);
135
- hasRun = true;
136
- }
137
- return result;
138
- };
139
- }
140
-
141
- /**
142
- * A no-operation function.
143
- *
144
- * @example
145
- * ```ts
146
- * noop();
147
- * ```
148
- */
149
- export function noop(): void {
150
- // Intentionally empty
151
- }
1
+ /**
2
+ * Function-focused utility helpers.
3
+ *
4
+ * @module bquery/core/utils/function
5
+ */
6
+
7
+ /** A debounced function with a cancel method to clear the pending timeout. */
8
+ export interface DebouncedFn<TArgs extends unknown[]> {
9
+ (...args: TArgs): void;
10
+ /** Cancels the pending debounced invocation. */
11
+ cancel(): void;
12
+ }
13
+
14
+ /** A throttled function with a cancel method to reset the throttle timer. */
15
+ export interface ThrottledFn<TArgs extends unknown[]> {
16
+ (...args: TArgs): void;
17
+ /** Resets the throttle timer, allowing the next call to execute immediately. */
18
+ cancel(): void;
19
+ }
20
+
21
+ /**
22
+ * Creates a debounced function that delays execution until after
23
+ * the specified delay has elapsed since the last call.
24
+ *
25
+ * @template TArgs - The argument types of the function
26
+ * @param fn - The function to debounce
27
+ * @param delayMs - Delay in milliseconds
28
+ * @returns A debounced version of the function with a `cancel()` method
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const search = debounce((query: string) => {
33
+ * console.log('Searching:', query);
34
+ * }, 300);
35
+ *
36
+ * search('h');
37
+ * search('he');
38
+ * search('hello'); // Only this call executes after 300ms
39
+ *
40
+ * search('cancel me');
41
+ * search.cancel(); // Cancels the pending invocation
42
+ * ```
43
+ */
44
+ export function debounce<TArgs extends unknown[]>(
45
+ fn: (...args: TArgs) => void,
46
+ delayMs: number
47
+ ): DebouncedFn<TArgs> {
48
+ let timeoutId: ReturnType<typeof setTimeout> | undefined;
49
+ const debounced: DebouncedFn<TArgs> = Object.assign(
50
+ (...args: TArgs) => {
51
+ if (timeoutId !== undefined) {
52
+ clearTimeout(timeoutId);
53
+ }
54
+ timeoutId = setTimeout(() => {
55
+ timeoutId = undefined;
56
+ fn(...args);
57
+ }, delayMs);
58
+ },
59
+ {
60
+ cancel: () => {
61
+ if (timeoutId !== undefined) {
62
+ clearTimeout(timeoutId);
63
+ timeoutId = undefined;
64
+ }
65
+ },
66
+ }
67
+ );
68
+ return debounced;
69
+ }
70
+
71
+ /**
72
+ * Creates a throttled function that runs at most once per interval.
73
+ *
74
+ * @template TArgs - The argument types of the function
75
+ * @param fn - The function to throttle
76
+ * @param intervalMs - Minimum interval between calls in milliseconds
77
+ * @returns A throttled version of the function with a `cancel()` method
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const handleScroll = throttle(() => {
82
+ * console.log('Scroll position:', window.scrollY);
83
+ * }, 100);
84
+ *
85
+ * window.addEventListener('scroll', handleScroll);
86
+ *
87
+ * handleScroll.cancel(); // Resets throttle, next call executes immediately
88
+ * ```
89
+ */
90
+ export function throttle<TArgs extends unknown[]>(
91
+ fn: (...args: TArgs) => void,
92
+ intervalMs: number
93
+ ): ThrottledFn<TArgs> {
94
+ let lastRun = 0;
95
+ const throttled: ThrottledFn<TArgs> = Object.assign(
96
+ (...args: TArgs) => {
97
+ const now = Date.now();
98
+ if (now - lastRun >= intervalMs) {
99
+ lastRun = now;
100
+ fn(...args);
101
+ }
102
+ },
103
+ {
104
+ cancel: () => {
105
+ lastRun = 0;
106
+ },
107
+ }
108
+ );
109
+ return throttled;
110
+ }
111
+
112
+ /**
113
+ * Ensures a function only runs once. Subsequent calls return the first result.
114
+ *
115
+ * @template TArgs - The argument types of the function
116
+ * @template TResult - The return type of the function
117
+ * @param fn - The function to wrap
118
+ * @returns A function that only runs once
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * const init = once(() => ({ ready: true }));
123
+ * init();
124
+ * init(); // only runs once
125
+ * ```
126
+ */
127
+ export function once<TArgs extends unknown[], TResult>(
128
+ fn: (...args: TArgs) => TResult
129
+ ): (...args: TArgs) => TResult {
130
+ let hasRun = false;
131
+ let result!: TResult;
132
+ return (...args: TArgs) => {
133
+ if (!hasRun) {
134
+ result = fn(...args);
135
+ hasRun = true;
136
+ }
137
+ return result;
138
+ };
139
+ }
140
+
141
+ /**
142
+ * A no-operation function.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * noop();
147
+ * ```
148
+ */
149
+ export function noop(): void {
150
+ // Intentionally empty
151
+ }