zero-query 1.1.1 → 1.2.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 (154) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -0
  3. package/cli/args.js +33 -33
  4. package/cli/commands/build-api.js +443 -442
  5. package/cli/commands/build.js +254 -247
  6. package/cli/commands/bundle.js +1228 -1224
  7. package/cli/commands/create.js +137 -121
  8. package/cli/commands/dev/devtools/index.js +56 -56
  9. package/cli/commands/dev/devtools/js/components.js +49 -49
  10. package/cli/commands/dev/devtools/js/core.js +423 -423
  11. package/cli/commands/dev/devtools/js/elements.js +421 -421
  12. package/cli/commands/dev/devtools/js/network.js +166 -166
  13. package/cli/commands/dev/devtools/js/performance.js +73 -73
  14. package/cli/commands/dev/devtools/js/router.js +105 -105
  15. package/cli/commands/dev/devtools/js/source.js +132 -132
  16. package/cli/commands/dev/devtools/js/stats.js +35 -35
  17. package/cli/commands/dev/devtools/js/tabs.js +79 -79
  18. package/cli/commands/dev/devtools/panel.html +95 -95
  19. package/cli/commands/dev/devtools/styles.css +244 -244
  20. package/cli/commands/dev/index.js +107 -107
  21. package/cli/commands/dev/logger.js +75 -75
  22. package/cli/commands/dev/overlay.js +858 -858
  23. package/cli/commands/dev/server.js +220 -220
  24. package/cli/commands/dev/validator.js +94 -94
  25. package/cli/commands/dev/watcher.js +172 -172
  26. package/cli/help.js +114 -112
  27. package/cli/index.js +52 -52
  28. package/cli/scaffold/default/LICENSE +21 -21
  29. package/cli/scaffold/default/app/app.js +207 -207
  30. package/cli/scaffold/default/app/components/about.js +201 -201
  31. package/cli/scaffold/default/app/components/api-demo.js +143 -143
  32. package/cli/scaffold/default/app/components/contact-card.js +231 -231
  33. package/cli/scaffold/default/app/components/contacts/contacts.css +706 -706
  34. package/cli/scaffold/default/app/components/contacts/contacts.html +200 -200
  35. package/cli/scaffold/default/app/components/contacts/contacts.js +196 -196
  36. package/cli/scaffold/default/app/components/counter.js +127 -127
  37. package/cli/scaffold/default/app/components/home.js +249 -249
  38. package/cli/scaffold/default/app/components/not-found.js +16 -16
  39. package/cli/scaffold/default/app/components/playground/playground.css +115 -115
  40. package/cli/scaffold/default/app/components/playground/playground.html +161 -161
  41. package/cli/scaffold/default/app/components/playground/playground.js +116 -116
  42. package/cli/scaffold/default/app/components/todos.js +225 -225
  43. package/cli/scaffold/default/app/components/toolkit/toolkit.css +97 -97
  44. package/cli/scaffold/default/app/components/toolkit/toolkit.html +146 -146
  45. package/cli/scaffold/default/app/components/toolkit/toolkit.js +280 -280
  46. package/cli/scaffold/default/app/routes.js +15 -15
  47. package/cli/scaffold/default/app/store.js +101 -101
  48. package/cli/scaffold/default/global.css +552 -552
  49. package/cli/scaffold/default/index.html +99 -99
  50. package/cli/scaffold/minimal/app/app.js +85 -85
  51. package/cli/scaffold/minimal/app/components/about.js +68 -68
  52. package/cli/scaffold/minimal/app/components/counter.js +122 -122
  53. package/cli/scaffold/minimal/app/components/home.js +68 -68
  54. package/cli/scaffold/minimal/app/components/not-found.js +16 -16
  55. package/cli/scaffold/minimal/app/routes.js +9 -9
  56. package/cli/scaffold/minimal/app/store.js +36 -36
  57. package/cli/scaffold/minimal/global.css +300 -300
  58. package/cli/scaffold/minimal/index.html +44 -44
  59. package/cli/scaffold/ssr/app/app.js +41 -41
  60. package/cli/scaffold/ssr/app/components/about.js +55 -55
  61. package/cli/scaffold/ssr/app/components/blog/index.js +65 -65
  62. package/cli/scaffold/ssr/app/components/blog/post.js +86 -86
  63. package/cli/scaffold/ssr/app/components/home.js +37 -37
  64. package/cli/scaffold/ssr/app/components/not-found.js +15 -15
  65. package/cli/scaffold/ssr/app/routes.js +8 -8
  66. package/cli/scaffold/ssr/global.css +228 -228
  67. package/cli/scaffold/ssr/index.html +37 -37
  68. package/cli/scaffold/ssr/package.json +8 -8
  69. package/cli/scaffold/ssr/server/data/posts.js +144 -144
  70. package/cli/scaffold/ssr/server/index.js +213 -213
  71. package/cli/scaffold/webrtc/app/app.js +11 -0
  72. package/cli/scaffold/webrtc/app/components/video-room.js +295 -0
  73. package/cli/scaffold/webrtc/app/lib/room.js +252 -0
  74. package/cli/scaffold/webrtc/assets/.gitkeep +0 -0
  75. package/cli/scaffold/webrtc/global.css +250 -0
  76. package/cli/scaffold/webrtc/index.html +21 -0
  77. package/cli/utils.js +305 -287
  78. package/dist/API.md +661 -0
  79. package/dist/zquery.dist.zip +0 -0
  80. package/dist/zquery.js +10313 -6614
  81. package/dist/zquery.min.js +8 -631
  82. package/index.d.ts +570 -371
  83. package/index.js +311 -240
  84. package/package.json +76 -70
  85. package/src/component.js +1709 -1691
  86. package/src/core.js +921 -921
  87. package/src/diff.js +497 -497
  88. package/src/errors.js +209 -209
  89. package/src/expression.js +922 -922
  90. package/src/http.js +242 -242
  91. package/src/package.json +1 -1
  92. package/src/reactive.js +255 -255
  93. package/src/router.js +843 -843
  94. package/src/ssr.js +418 -418
  95. package/src/store.js +318 -318
  96. package/src/utils.js +515 -515
  97. package/src/webrtc/e2ee.js +351 -0
  98. package/src/webrtc/errors.js +116 -0
  99. package/src/webrtc/ice.js +301 -0
  100. package/src/webrtc/index.js +131 -0
  101. package/src/webrtc/joinToken.js +119 -0
  102. package/src/webrtc/observe.js +172 -0
  103. package/src/webrtc/peer.js +351 -0
  104. package/src/webrtc/reactive.js +268 -0
  105. package/src/webrtc/room.js +625 -0
  106. package/src/webrtc/sdp.js +302 -0
  107. package/src/webrtc/sfu/index.js +43 -0
  108. package/src/webrtc/sfu/livekit.js +131 -0
  109. package/src/webrtc/sfu/mediasoup.js +150 -0
  110. package/src/webrtc/signaling.js +373 -0
  111. package/src/webrtc/turn.js +237 -0
  112. package/tests/_helpers/webrtcFakes.js +289 -0
  113. package/tests/audit.test.js +4158 -4158
  114. package/tests/cli.test.js +1136 -1103
  115. package/tests/compare.test.js +497 -486
  116. package/tests/component.test.js +3969 -3938
  117. package/tests/core.test.js +1910 -1910
  118. package/tests/dev-server.test.js +489 -489
  119. package/tests/diff.test.js +1416 -1416
  120. package/tests/docs.test.js +1664 -1650
  121. package/tests/electron-features.test.js +864 -864
  122. package/tests/errors.test.js +619 -619
  123. package/tests/expression.test.js +1056 -1056
  124. package/tests/http.test.js +648 -648
  125. package/tests/reactive.test.js +819 -819
  126. package/tests/router.test.js +2327 -2327
  127. package/tests/ssr.test.js +870 -870
  128. package/tests/store.test.js +830 -830
  129. package/tests/test-minifier.js +153 -153
  130. package/tests/test-ssr.js +27 -27
  131. package/tests/utils.test.js +1377 -1377
  132. package/tests/webrtc/e2ee.test.js +283 -0
  133. package/tests/webrtc/ice.test.js +202 -0
  134. package/tests/webrtc/joinToken.test.js +89 -0
  135. package/tests/webrtc/observe.test.js +111 -0
  136. package/tests/webrtc/peer.test.js +373 -0
  137. package/tests/webrtc/reactive.test.js +235 -0
  138. package/tests/webrtc/room.test.js +406 -0
  139. package/tests/webrtc/sdp.test.js +151 -0
  140. package/tests/webrtc/sfu-livekit.test.js +119 -0
  141. package/tests/webrtc/sfu.test.js +160 -0
  142. package/tests/webrtc/signaling.test.js +251 -0
  143. package/tests/webrtc/turn.test.js +256 -0
  144. package/types/collection.d.ts +383 -383
  145. package/types/component.d.ts +186 -186
  146. package/types/errors.d.ts +135 -135
  147. package/types/http.d.ts +92 -92
  148. package/types/misc.d.ts +201 -201
  149. package/types/reactive.d.ts +98 -98
  150. package/types/router.d.ts +190 -190
  151. package/types/ssr.d.ts +102 -102
  152. package/types/store.d.ts +146 -146
  153. package/types/utils.d.ts +245 -245
  154. package/types/webrtc.d.ts +653 -0
package/index.js CHANGED
@@ -1,240 +1,311 @@
1
- /**
2
- * ┌---------------------------------------------------------┐
3
- * │ zQuery (zeroQuery) - Lightweight Frontend Library │
4
- * │ │
5
- * │ jQuery-like selectors · Reactive components │
6
- * │ SPA router · State management · Zero dependencies │
7
- * │ │
8
- * │ https://github.com/tonywied17/zero-query │
9
- * └---------------------------------------------------------┘
10
- */
11
-
12
- import { query, queryAll, ZQueryCollection } from './src/core.js';
13
- import { reactive, Signal, signal, computed, effect, batch, untracked } from './src/reactive.js';
14
- import { component, mount, mountAll, getInstance, destroy, getRegistry, prefetch, style } from './src/component.js';
15
- import { createRouter, getRouter, matchRoute } from './src/router.js';
16
- import { createStore, getStore, connectStore } from './src/store.js';
17
- import { http } from './src/http.js';
18
- import { morph, morphElement } from './src/diff.js';
19
- import { safeEval } from './src/expression.js';
20
- import {
21
- debounce, throttle, pipe, once, sleep,
22
- escapeHtml, stripHtml, html, trust, TrustedHTML, uuid, camelCase, kebabCase,
23
- deepClone, deepMerge, isEqual, param, parseQuery,
24
- storage, session, EventBus, bus,
25
- range, unique, chunk, groupBy,
26
- pick, omit, getPath, setPath, isEmpty,
27
- capitalize, truncate, clamp,
28
- memoize, retry, timeout,
29
- } from './src/utils.js';
30
- import { ZQueryError, ErrorCode, onError, reportError, guardCallback, guardAsync, validate, formatError } from './src/errors.js';
31
-
32
-
33
- // ---------------------------------------------------------------------------
34
- // $ - The main function & namespace
35
- // ---------------------------------------------------------------------------
36
-
37
- /**
38
- * Main selector function - always returns a ZQueryCollection (like jQuery).
39
- *
40
- * $('selector') → ZQueryCollection (querySelectorAll)
41
- * $('<div>hello</div>') → ZQueryCollection from created elements
42
- * $(element) → ZQueryCollection wrapping the element
43
- * $(fn) → DOMContentLoaded shorthand
44
- *
45
- * @param {string|Element|NodeList|Function} selector
46
- * @param {string|Element} [context]
47
- * @returns {ZQueryCollection}
48
- */
49
- function $(selector, context) {
50
- // $(fn) → DOM ready shorthand
51
- if (typeof selector === 'function') {
52
- query.ready(selector);
53
- return;
54
- }
55
- return query(selector, context);
56
- }
57
-
58
-
59
- // --- Quick refs (DOM selectors) --------------------------------------------
60
- $.id = query.id;
61
- $.class = query.class;
62
- $.classes = query.classes;
63
- $.tag = query.tag;
64
- Object.defineProperty($, 'name', {
65
- value: query.name, writable: true, configurable: true
66
- });
67
- $.children = query.children;
68
- $.qs = query.qs;
69
- $.qsa = query.qsa;
70
-
71
- // --- Collection selector ---------------------------------------------------
72
- /**
73
- * Collection selector (like jQuery's $)
74
- *
75
- * $.all('selector') → ZQueryCollection (querySelectorAll)
76
- * $.all('<div>hello</div>') create elements as collection
77
- * $.all(element) → wrap element in collection
78
- * $.all(nodeList) → wrap NodeList in collection
79
- *
80
- * @param {string|Element|NodeList|Array} selector
81
- * @param {string|Element} [context]
82
- * @returns {ZQueryCollection}
83
- */
84
- $.all = function(selector, context) {
85
- return queryAll(selector, context);
86
- };
87
-
88
- // --- DOM helpers -----------------------------------------------------------
89
- $.create = query.create;
90
- $.ready = query.ready;
91
- $.on = query.on;
92
- $.off = query.off;
93
- $.fn = query.fn;
94
-
95
- // --- Reactive primitives ---------------------------------------------------
96
- $.reactive = reactive;
97
- $.Signal = Signal;
98
- $.signal = signal;
99
- $.computed = computed;
100
- $.effect = effect;
101
- $.batch = batch;
102
- $.untracked = untracked;
103
-
104
- // --- Components ------------------------------------------------------------
105
- $.component = component;
106
- $.mount = mount;
107
- $.mountAll = mountAll;
108
- $.getInstance = getInstance;
109
- $.destroy = destroy;
110
- $.components = getRegistry;
111
- $.prefetch = prefetch;
112
- $.style = style;
113
- $.morph = morph;
114
- $.morphElement = morphElement;
115
- $.safeEval = safeEval;
116
-
117
- // --- Router ----------------------------------------------------------------
118
- $.router = createRouter;
119
- $.getRouter = getRouter;
120
- $.matchRoute = matchRoute;
121
-
122
- // --- Store -----------------------------------------------------------------
123
- $.store = createStore;
124
- $.getStore = getStore;
125
- $.connectStore = connectStore;
126
-
127
- // --- HTTP ------------------------------------------------------------------
128
- $.http = http;
129
- $.get = http.get;
130
- $.post = http.post;
131
- $.put = http.put;
132
- $.patch = http.patch;
133
- $.delete = http.delete;
134
- $.head = http.head;
135
-
136
- // --- Utilities -------------------------------------------------------------
137
- $.debounce = debounce;
138
- $.throttle = throttle;
139
- $.pipe = pipe;
140
- $.once = once;
141
- $.sleep = sleep;
142
- $.escapeHtml = escapeHtml;
143
- $.stripHtml = stripHtml;
144
- $.html = html;
145
- $.trust = trust;
146
- $.TrustedHTML = TrustedHTML;
147
- $.uuid = uuid;
148
- $.camelCase = camelCase;
149
- $.kebabCase = kebabCase;
150
- $.deepClone = deepClone;
151
- $.deepMerge = deepMerge;
152
- $.isEqual = isEqual;
153
- $.param = param;
154
- $.parseQuery = parseQuery;
155
- $.storage = storage;
156
- $.session = session;
157
- $.EventBus = EventBus;
158
- $.bus = bus;
159
- $.range = range;
160
- $.unique = unique;
161
- $.chunk = chunk;
162
- $.groupBy = groupBy;
163
- $.pick = pick;
164
- $.omit = omit;
165
- $.getPath = getPath;
166
- $.setPath = setPath;
167
- $.isEmpty = isEmpty;
168
- $.capitalize = capitalize;
169
- $.truncate = truncate;
170
- $.clamp = clamp;
171
- $.memoize = memoize;
172
- $.retry = retry;
173
- $.timeout = timeout;
174
-
175
- // --- Error handling --------------------------------------------------------
176
- $.onError = onError;
177
- $.ZQueryError = ZQueryError;
178
- $.ErrorCode = ErrorCode;
179
- $.guardCallback = guardCallback;
180
- $.guardAsync = guardAsync;
181
- $.validate = validate;
182
- $.formatError = formatError;
183
-
184
- // --- Meta ------------------------------------------------------------------
185
- $.version = '__VERSION__';
186
- $.libSize = '__LIB_SIZE__';
187
- $.unitTests = '__UNIT_TESTS__';
188
- $.meta = {}; // populated at build time by CLI bundler
189
-
190
- // --- Environment detection -------------------------------------------------
191
- $.isElectron = typeof navigator !== 'undefined' && /Electron/i.test(navigator.userAgent)
192
- || typeof process !== 'undefined' && process.versions != null && !!process.versions.electron;
193
- $.platform = $.isElectron ? 'electron'
194
- : typeof window !== 'undefined' ? 'browser'
195
- : 'node';
196
-
197
- $.noConflict = () => {
198
- if (typeof window !== 'undefined' && window.$ === $) {
199
- delete window.$;
200
- }
201
- return $;
202
- };
203
-
204
-
205
- // ---------------------------------------------------------------------------
206
- // Global exposure (browser)
207
- // ---------------------------------------------------------------------------
208
- if (typeof window !== 'undefined') {
209
- window.$ = $;
210
- window.zQuery = $;
211
- }
212
-
213
-
214
- // ---------------------------------------------------------------------------
215
- // Named exports (ES modules)
216
- // ---------------------------------------------------------------------------
217
- export {
218
- $,
219
- $ as zQuery,
220
- ZQueryCollection,
221
- queryAll,
222
- reactive, Signal, signal, computed, effect, batch, untracked,
223
- component, mount, mountAll, getInstance, destroy, getRegistry, prefetch, style,
224
- morph, morphElement,
225
- safeEval,
226
- createRouter, getRouter, matchRoute,
227
- createStore, getStore, connectStore,
228
- http,
229
- ZQueryError, ErrorCode, onError, reportError, guardCallback, guardAsync, validate, formatError,
230
- debounce, throttle, pipe, once, sleep,
231
- escapeHtml, stripHtml, html, trust, TrustedHTML, uuid, camelCase, kebabCase,
232
- deepClone, deepMerge, isEqual, param, parseQuery,
233
- storage, session, EventBus, bus,
234
- range, unique, chunk, groupBy,
235
- pick, omit, getPath, setPath, isEmpty,
236
- capitalize, truncate, clamp,
237
- memoize, retry, timeout,
238
- };
239
-
240
- export default $;
1
+ /**
2
+ * ┌---------------------------------------------------------┐
3
+ * │ zQuery (zeroQuery) - Lightweight Frontend Library │
4
+ * │ │
5
+ * │ jQuery-like selectors · Reactive components │
6
+ * │ SPA router · State management · Zero dependencies │
7
+ * │ │
8
+ * │ https://github.com/tonywied17/zero-query │
9
+ * └---------------------------------------------------------┘
10
+ */
11
+
12
+ import { query, queryAll, ZQueryCollection } from './src/core.js';
13
+ import { reactive, Signal, signal, computed, effect, batch, untracked } from './src/reactive.js';
14
+ import { component, mount, mountAll, getInstance, destroy, getRegistry, prefetch, style } from './src/component.js';
15
+ import { createRouter, getRouter, matchRoute } from './src/router.js';
16
+ import { createStore, getStore, connectStore } from './src/store.js';
17
+ import { http } from './src/http.js';
18
+ import { morph, morphElement } from './src/diff.js';
19
+ import { safeEval } from './src/expression.js';
20
+ import {
21
+ debounce, throttle, pipe, once, sleep,
22
+ escapeHtml, stripHtml, html, trust, TrustedHTML, uuid, camelCase, kebabCase,
23
+ deepClone, deepMerge, isEqual, param, parseQuery,
24
+ storage, session, EventBus, bus,
25
+ range, unique, chunk, groupBy,
26
+ pick, omit, getPath, setPath, isEmpty,
27
+ capitalize, truncate, clamp,
28
+ memoize, retry, timeout,
29
+ } from './src/utils.js';
30
+ import { ZQueryError, ErrorCode, onError, reportError, guardCallback, guardAsync, validate, formatError } from './src/errors.js';
31
+ import {
32
+ webrtc,
33
+ SignalingClient,
34
+ Peer,
35
+ Room, join as webrtcJoin,
36
+ useRoom, usePeer, useTracks, useDataChannel, useConnectionQuality,
37
+ fetchTurnCredentials, mergeIceServers, createTurnRefresher,
38
+ deriveSFrameKey, generateSFrameKey, SFrameContext,
39
+ encryptFrame, decryptFrame, attachE2ee,
40
+ loadSfuAdapter,
41
+ decodeJoinToken, isJoinTokenExpired,
42
+ samplePeerStats, createStatsSampler, classifyStats,
43
+ parseSdp, validateSdp,
44
+ parseCandidate, stringifyCandidate, filterCandidates,
45
+ isPrivateIp, isLoopbackIp, isLinkLocalIp, isMdnsHostname,
46
+ WebRtcError, SignalingError, IceError, SdpError, TurnError, E2eeError, SfuError,
47
+ } from './src/webrtc/index.js';
48
+
49
+
50
+ // ---------------------------------------------------------------------------
51
+ // $ - The main function & namespace
52
+ // ---------------------------------------------------------------------------
53
+
54
+ /**
55
+ * Main selector function - always returns a ZQueryCollection (like jQuery).
56
+ *
57
+ * $('selector') → ZQueryCollection (querySelectorAll)
58
+ * $('<div>hello</div>') → ZQueryCollection from created elements
59
+ * $(element) → ZQueryCollection wrapping the element
60
+ * $(fn) → DOMContentLoaded shorthand
61
+ *
62
+ * @param {string|Element|NodeList|Function} selector
63
+ * @param {string|Element} [context]
64
+ * @returns {ZQueryCollection}
65
+ */
66
+ function $(selector, context) {
67
+ // $(fn) → DOM ready shorthand
68
+ if (typeof selector === 'function') {
69
+ query.ready(selector);
70
+ return;
71
+ }
72
+ return query(selector, context);
73
+ }
74
+
75
+
76
+ // --- Quick refs (DOM selectors) --------------------------------------------
77
+ $.id = query.id;
78
+ $.class = query.class;
79
+ $.classes = query.classes;
80
+ $.tag = query.tag;
81
+ Object.defineProperty($, 'name', {
82
+ value: query.name, writable: true, configurable: true
83
+ });
84
+ $.children = query.children;
85
+ $.qs = query.qs;
86
+ $.qsa = query.qsa;
87
+
88
+ // --- Collection selector ---------------------------------------------------
89
+ /**
90
+ * Collection selector (like jQuery's $)
91
+ *
92
+ * $.all('selector') → ZQueryCollection (querySelectorAll)
93
+ * $.all('<div>hello</div>') → create elements as collection
94
+ * $.all(element) → wrap element in collection
95
+ * $.all(nodeList) → wrap NodeList in collection
96
+ *
97
+ * @param {string|Element|NodeList|Array} selector
98
+ * @param {string|Element} [context]
99
+ * @returns {ZQueryCollection}
100
+ */
101
+ $.all = function(selector, context) {
102
+ return queryAll(selector, context);
103
+ };
104
+
105
+ // --- DOM helpers -----------------------------------------------------------
106
+ $.create = query.create;
107
+ $.ready = query.ready;
108
+ $.on = query.on;
109
+ $.off = query.off;
110
+ $.fn = query.fn;
111
+
112
+ // --- Reactive primitives ---------------------------------------------------
113
+ $.reactive = reactive;
114
+ $.Signal = Signal;
115
+ $.signal = signal;
116
+ $.computed = computed;
117
+ $.effect = effect;
118
+ $.batch = batch;
119
+ $.untracked = untracked;
120
+
121
+ // --- Components ------------------------------------------------------------
122
+ $.component = component;
123
+ $.mount = mount;
124
+ $.mountAll = mountAll;
125
+ $.getInstance = getInstance;
126
+ $.destroy = destroy;
127
+ $.components = getRegistry;
128
+ $.prefetch = prefetch;
129
+ $.style = style;
130
+ $.morph = morph;
131
+ $.morphElement = morphElement;
132
+ $.safeEval = safeEval;
133
+
134
+ // --- Router ----------------------------------------------------------------
135
+ $.router = createRouter;
136
+ $.getRouter = getRouter;
137
+ $.matchRoute = matchRoute;
138
+
139
+ // --- Store -----------------------------------------------------------------
140
+ $.store = createStore;
141
+ $.getStore = getStore;
142
+ $.connectStore = connectStore;
143
+
144
+ // --- HTTP ------------------------------------------------------------------
145
+ $.http = http;
146
+ $.get = http.get;
147
+ $.post = http.post;
148
+ $.put = http.put;
149
+ $.patch = http.patch;
150
+ $.delete = http.delete;
151
+ $.head = http.head;
152
+
153
+ // --- Utilities -------------------------------------------------------------
154
+ $.debounce = debounce;
155
+ $.throttle = throttle;
156
+ $.pipe = pipe;
157
+ $.once = once;
158
+ $.sleep = sleep;
159
+ $.escapeHtml = escapeHtml;
160
+ $.stripHtml = stripHtml;
161
+ $.html = html;
162
+ $.trust = trust;
163
+ $.TrustedHTML = TrustedHTML;
164
+ $.uuid = uuid;
165
+ $.camelCase = camelCase;
166
+ $.kebabCase = kebabCase;
167
+ $.deepClone = deepClone;
168
+ $.deepMerge = deepMerge;
169
+ $.isEqual = isEqual;
170
+ $.param = param;
171
+ $.parseQuery = parseQuery;
172
+ $.storage = storage;
173
+ $.session = session;
174
+ $.EventBus = EventBus;
175
+ $.bus = bus;
176
+ $.range = range;
177
+ $.unique = unique;
178
+ $.chunk = chunk;
179
+ $.groupBy = groupBy;
180
+ $.pick = pick;
181
+ $.omit = omit;
182
+ $.getPath = getPath;
183
+ $.setPath = setPath;
184
+ $.isEmpty = isEmpty;
185
+ $.capitalize = capitalize;
186
+ $.truncate = truncate;
187
+ $.clamp = clamp;
188
+ $.memoize = memoize;
189
+ $.retry = retry;
190
+ $.timeout = timeout;
191
+
192
+ // --- Error handling --------------------------------------------------------
193
+ $.onError = onError;
194
+ $.ZQueryError = ZQueryError;
195
+ $.ErrorCode = ErrorCode;
196
+ $.guardCallback = guardCallback;
197
+ $.guardAsync = guardAsync;
198
+ $.validate = validate;
199
+ $.formatError = formatError;
200
+
201
+ // --- WebRTC ----------------------------------------------------------------
202
+ $.webrtc = webrtc;
203
+ $.SignalingClient = SignalingClient;
204
+ $.Peer = Peer;
205
+ $.Room = Room;
206
+ $.useRoom = useRoom;
207
+ $.usePeer = usePeer;
208
+ $.useTracks = useTracks;
209
+ $.useDataChannel = useDataChannel;
210
+ $.useConnectionQuality = useConnectionQuality;
211
+ $.fetchTurnCredentials = fetchTurnCredentials;
212
+ $.mergeIceServers = mergeIceServers;
213
+ $.createTurnRefresher = createTurnRefresher;
214
+ $.deriveSFrameKey = deriveSFrameKey;
215
+ $.generateSFrameKey = generateSFrameKey;
216
+ $.SFrameContext = SFrameContext;
217
+ $.encryptFrame = encryptFrame;
218
+ $.decryptFrame = decryptFrame;
219
+ $.attachE2ee = attachE2ee;
220
+ $.loadSfuAdapter = loadSfuAdapter;
221
+ $.SfuError = SfuError;
222
+ $.decodeJoinToken = decodeJoinToken;
223
+ $.isJoinTokenExpired = isJoinTokenExpired;
224
+ $.samplePeerStats = samplePeerStats;
225
+ $.createStatsSampler = createStatsSampler;
226
+ $.classifyStats = classifyStats;
227
+ $.parseSdp = parseSdp;
228
+ $.validateSdp = validateSdp;
229
+ $.parseCandidate = parseCandidate;
230
+ $.stringifyCandidate = stringifyCandidate;
231
+ $.filterCandidates = filterCandidates;
232
+ $.isPrivateIp = isPrivateIp;
233
+ $.isLoopbackIp = isLoopbackIp;
234
+ $.isLinkLocalIp = isLinkLocalIp;
235
+ $.isMdnsHostname = isMdnsHostname;
236
+ $.WebRtcError = WebRtcError;
237
+ $.SignalingError = SignalingError;
238
+ $.IceError = IceError;
239
+ $.SdpError = SdpError;
240
+ $.TurnError = TurnError;
241
+ $.E2eeError = E2eeError;
242
+
243
+ // --- Meta ------------------------------------------------------------------
244
+ $.version = '__VERSION__';
245
+ $.libSize = '__LIB_SIZE__';
246
+ $.unitTests = '__UNIT_TESTS__';
247
+ $.meta = {}; // populated at build time by CLI bundler
248
+
249
+ // --- Environment detection -------------------------------------------------
250
+ $.isElectron = typeof navigator !== 'undefined' && /Electron/i.test(navigator.userAgent)
251
+ || typeof process !== 'undefined' && process.versions != null && !!process.versions.electron;
252
+ $.platform = $.isElectron ? 'electron'
253
+ : typeof window !== 'undefined' ? 'browser'
254
+ : 'node';
255
+
256
+ $.noConflict = () => {
257
+ if (typeof window !== 'undefined' && window.$ === $) {
258
+ delete window.$;
259
+ }
260
+ return $;
261
+ };
262
+
263
+
264
+ // ---------------------------------------------------------------------------
265
+ // Global exposure (browser)
266
+ // ---------------------------------------------------------------------------
267
+ if (typeof window !== 'undefined') {
268
+ window.$ = $;
269
+ window.zQuery = $;
270
+ }
271
+
272
+
273
+ // ---------------------------------------------------------------------------
274
+ // Named exports (ES modules)
275
+ // ---------------------------------------------------------------------------
276
+ export {
277
+ $,
278
+ $ as zQuery,
279
+ ZQueryCollection,
280
+ queryAll,
281
+ reactive, Signal, signal, computed, effect, batch, untracked,
282
+ component, mount, mountAll, getInstance, destroy, getRegistry, prefetch, style,
283
+ morph, morphElement,
284
+ safeEval,
285
+ createRouter, getRouter, matchRoute,
286
+ createStore, getStore, connectStore,
287
+ http,
288
+ ZQueryError, ErrorCode, onError, reportError, guardCallback, guardAsync, validate, formatError,
289
+ webrtc, SignalingClient, Peer, Room, webrtcJoin,
290
+ useRoom, usePeer, useTracks, useDataChannel, useConnectionQuality,
291
+ fetchTurnCredentials, mergeIceServers, createTurnRefresher,
292
+ deriveSFrameKey, generateSFrameKey, SFrameContext,
293
+ encryptFrame, decryptFrame, attachE2ee,
294
+ loadSfuAdapter, SfuError,
295
+ decodeJoinToken, isJoinTokenExpired,
296
+ samplePeerStats, createStatsSampler, classifyStats,
297
+ parseSdp, validateSdp,
298
+ parseCandidate, stringifyCandidate, filterCandidates,
299
+ isPrivateIp, isLoopbackIp, isLinkLocalIp, isMdnsHostname,
300
+ WebRtcError, SignalingError, IceError, SdpError, TurnError, E2eeError,
301
+ debounce, throttle, pipe, once, sleep,
302
+ escapeHtml, stripHtml, html, trust, TrustedHTML, uuid, camelCase, kebabCase,
303
+ deepClone, deepMerge, isEqual, param, parseQuery,
304
+ storage, session, EventBus, bus,
305
+ range, unique, chunk, groupBy,
306
+ pick, omit, getPath, setPath, isEmpty,
307
+ capitalize, truncate, clamp,
308
+ memoize, retry, timeout,
309
+ };
310
+
311
+ export default $;