@bquery/bquery 1.9.0 → 1.11.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 (216) hide show
  1. package/README.md +221 -40
  2. package/dist/{a11y-_9X-kt-_.js → a11y-DgUQ8-fI.js} +3 -3
  3. package/dist/{a11y-_9X-kt-_.js.map → a11y-DgUQ8-fI.js.map} +1 -1
  4. package/dist/a11y.es.mjs +1 -1
  5. package/dist/{component-L3-JfOFz.js → component-D8ydhe58.js} +20 -19
  6. package/dist/{component-L3-JfOFz.js.map → component-D8ydhe58.js.map} +1 -1
  7. package/dist/component.es.mjs +1 -1
  8. package/dist/concurrency/errors.d.ts +29 -0
  9. package/dist/concurrency/errors.d.ts.map +1 -0
  10. package/dist/concurrency/high-level.d.ts +85 -0
  11. package/dist/concurrency/high-level.d.ts.map +1 -0
  12. package/dist/concurrency/index.d.ts +19 -0
  13. package/dist/concurrency/index.d.ts.map +1 -0
  14. package/dist/concurrency/internal.d.ts +26 -0
  15. package/dist/concurrency/internal.d.ts.map +1 -0
  16. package/dist/concurrency/pipeline.d.ts +30 -0
  17. package/dist/concurrency/pipeline.d.ts.map +1 -0
  18. package/dist/concurrency/pool.d.ts +48 -0
  19. package/dist/concurrency/pool.d.ts.map +1 -0
  20. package/dist/concurrency/reactive.d.ts +107 -0
  21. package/dist/concurrency/reactive.d.ts.map +1 -0
  22. package/dist/concurrency/rpc.d.ts +46 -0
  23. package/dist/concurrency/rpc.d.ts.map +1 -0
  24. package/dist/concurrency/support.d.ts +23 -0
  25. package/dist/concurrency/support.d.ts.map +1 -0
  26. package/dist/concurrency/task.d.ts +31 -0
  27. package/dist/concurrency/task.d.ts.map +1 -0
  28. package/dist/concurrency/types.d.ts +343 -0
  29. package/dist/concurrency/types.d.ts.map +1 -0
  30. package/dist/concurrency-BU1wPEsZ.js +826 -0
  31. package/dist/concurrency-BU1wPEsZ.js.map +1 -0
  32. package/dist/concurrency.es.mjs +29 -0
  33. package/dist/{constraints-D5RHQLmP.js → constraints-Dlbx_m1b.js} +1 -1
  34. package/dist/{constraints-D5RHQLmP.js.map → constraints-Dlbx_m1b.js.map} +1 -1
  35. package/dist/core-CongXJuo.js +87 -0
  36. package/dist/core-CongXJuo.js.map +1 -0
  37. package/dist/{core-EMYSLzaT.js → core-tOP6QOrY.js} +2 -2
  38. package/dist/{core-EMYSLzaT.js.map → core-tOP6QOrY.js.map} +1 -1
  39. package/dist/core.es.mjs +1 -1
  40. package/dist/{custom-directives-Dr4C5lVV.js → custom-directives-5DlKqvd2.js} +1 -1
  41. package/dist/{custom-directives-Dr4C5lVV.js.map → custom-directives-5DlKqvd2.js.map} +1 -1
  42. package/dist/{devtools-BhB2iDPT.js → devtools-QosAqo0T.js} +2 -2
  43. package/dist/{devtools-BhB2iDPT.js.map → devtools-QosAqo0T.js.map} +1 -1
  44. package/dist/devtools.es.mjs +1 -1
  45. package/dist/{dnd-NwZBYh4l.js → dnd-d2OU4len.js} +1 -1
  46. package/dist/{dnd-NwZBYh4l.js.map → dnd-d2OU4len.js.map} +1 -1
  47. package/dist/dnd.es.mjs +1 -1
  48. package/dist/effect-Cc51IH91.js +87 -0
  49. package/dist/effect-Cc51IH91.js.map +1 -0
  50. package/dist/{env-CTdvLaH2.js → env-PvwYHnJq.js} +1 -1
  51. package/dist/{env-CTdvLaH2.js.map → env-PvwYHnJq.js.map} +1 -1
  52. package/dist/{forms-UhAeJEoO.js → forms-BLx4ZzT7.js} +41 -40
  53. package/dist/{forms-UhAeJEoO.js.map → forms-BLx4ZzT7.js.map} +1 -1
  54. package/dist/forms.es.mjs +1 -1
  55. package/dist/full.d.ts +6 -2
  56. package/dist/full.d.ts.map +1 -1
  57. package/dist/full.es.mjs +282 -214
  58. package/dist/full.iife.js +108 -20
  59. package/dist/full.iife.js.map +1 -1
  60. package/dist/full.umd.js +108 -20
  61. package/dist/full.umd.js.map +1 -1
  62. package/dist/{i18n-kuF6Ekj6.js → i18n--p7PM-9r.js} +3 -3
  63. package/dist/{i18n-kuF6Ekj6.js.map → i18n--p7PM-9r.js.map} +1 -1
  64. package/dist/i18n.es.mjs +1 -1
  65. package/dist/index.d.ts +2 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.es.mjs +320 -252
  68. package/dist/match-CrZRVC4z.js +174 -0
  69. package/dist/match-CrZRVC4z.js.map +1 -0
  70. package/dist/media/observers.d.ts.map +1 -1
  71. package/dist/{media-D4zLj9t-.js → media-gjbWNq50.js} +3 -3
  72. package/dist/{media-D4zLj9t-.js.map → media-gjbWNq50.js.map} +1 -1
  73. package/dist/media.es.mjs +1 -1
  74. package/dist/{motion-BJsAuULb.js → motion-BBMso9Ir.js} +1 -1
  75. package/dist/{motion-BJsAuULb.js.map → motion-BBMso9Ir.js.map} +1 -1
  76. package/dist/motion.es.mjs +1 -1
  77. package/dist/{mount-B-JvH6Y0.js → mount-0A9qtcRJ.js} +11 -10
  78. package/dist/{mount-B-JvH6Y0.js.map → mount-0A9qtcRJ.js.map} +1 -1
  79. package/dist/{platform-Dw2gE3zI.js → platform-BPHIXbw8.js} +17 -16
  80. package/dist/{platform-Dw2gE3zI.js.map → platform-BPHIXbw8.js.map} +1 -1
  81. package/dist/platform.es.mjs +1 -1
  82. package/dist/{plugin-C2WuC8SF.js → plugin-SZEirbwq.js} +2 -2
  83. package/dist/{plugin-C2WuC8SF.js.map → plugin-SZEirbwq.js.map} +1 -1
  84. package/dist/plugin.es.mjs +1 -1
  85. package/dist/reactive/watch.d.ts.map +1 -1
  86. package/dist/reactive/websocket.d.ts +6 -3
  87. package/dist/reactive/websocket.d.ts.map +1 -1
  88. package/dist/{reactive-BjpLkclt.js → reactive-BAd2hfl8.js} +436 -449
  89. package/dist/reactive-BAd2hfl8.js.map +1 -0
  90. package/dist/reactive.es.mjs +42 -40
  91. package/dist/readonly-C0ZwS1Tf.js +35 -0
  92. package/dist/readonly-C0ZwS1Tf.js.map +1 -0
  93. package/dist/{registry-B08iilIh.js → registry-jpUQHf4E.js} +1 -1
  94. package/dist/{registry-B08iilIh.js.map → registry-jpUQHf4E.js.map} +1 -1
  95. package/dist/router-C4weu0QL.js +333 -0
  96. package/dist/router-C4weu0QL.js.map +1 -0
  97. package/dist/router.es.mjs +1 -1
  98. package/dist/{sanitize-B1V4JswB.js → sanitize-DOMkRO9G.js} +12 -7
  99. package/dist/{sanitize-B1V4JswB.js.map → sanitize-DOMkRO9G.js.map} +1 -1
  100. package/dist/security.es.mjs +1 -1
  101. package/dist/server/create-server.d.ts +25 -0
  102. package/dist/server/create-server.d.ts.map +1 -0
  103. package/dist/server/index.d.ts +11 -0
  104. package/dist/server/index.d.ts.map +1 -0
  105. package/dist/server/types.d.ts +396 -0
  106. package/dist/server/types.d.ts.map +1 -0
  107. package/dist/server-QdyKtCS1.js +349 -0
  108. package/dist/server-QdyKtCS1.js.map +1 -0
  109. package/dist/server.es.mjs +6 -0
  110. package/dist/ssr/adapters.d.ts +74 -0
  111. package/dist/ssr/adapters.d.ts.map +1 -0
  112. package/dist/ssr/async.d.ts +40 -0
  113. package/dist/ssr/async.d.ts.map +1 -0
  114. package/dist/ssr/config.d.ts +60 -0
  115. package/dist/ssr/config.d.ts.map +1 -0
  116. package/dist/ssr/context.d.ts +73 -0
  117. package/dist/ssr/context.d.ts.map +1 -0
  118. package/dist/ssr/defer-brand.d.ts +5 -0
  119. package/dist/ssr/defer-brand.d.ts.map +1 -0
  120. package/dist/ssr/escape.d.ts +17 -0
  121. package/dist/ssr/escape.d.ts.map +1 -0
  122. package/dist/ssr/expression.d.ts +44 -0
  123. package/dist/ssr/expression.d.ts.map +1 -0
  124. package/dist/ssr/hash.d.ts +39 -0
  125. package/dist/ssr/hash.d.ts.map +1 -0
  126. package/dist/ssr/head.d.ts +102 -0
  127. package/dist/ssr/head.d.ts.map +1 -0
  128. package/dist/ssr/html-parser.d.ts +58 -0
  129. package/dist/ssr/html-parser.d.ts.map +1 -0
  130. package/dist/ssr/index.d.ts +49 -43
  131. package/dist/ssr/index.d.ts.map +1 -1
  132. package/dist/ssr/mismatch.d.ts +60 -0
  133. package/dist/ssr/mismatch.d.ts.map +1 -0
  134. package/dist/ssr/render-async.d.ts +84 -0
  135. package/dist/ssr/render-async.d.ts.map +1 -0
  136. package/dist/ssr/render.d.ts.map +1 -1
  137. package/dist/ssr/renderer.d.ts +25 -0
  138. package/dist/ssr/renderer.d.ts.map +1 -0
  139. package/dist/ssr/resumability.d.ts +65 -0
  140. package/dist/ssr/resumability.d.ts.map +1 -0
  141. package/dist/ssr/router-bridge.d.ts +101 -0
  142. package/dist/ssr/router-bridge.d.ts.map +1 -0
  143. package/dist/ssr/runtime.d.ts +63 -0
  144. package/dist/ssr/runtime.d.ts.map +1 -0
  145. package/dist/ssr/serialize.d.ts.map +1 -1
  146. package/dist/ssr/store-snapshot.d.ts +87 -0
  147. package/dist/ssr/store-snapshot.d.ts.map +1 -0
  148. package/dist/ssr/strategies.d.ts +43 -0
  149. package/dist/ssr/strategies.d.ts.map +1 -0
  150. package/dist/ssr/suspense.d.ts +47 -0
  151. package/dist/ssr/suspense.d.ts.map +1 -0
  152. package/dist/ssr/types.d.ts +17 -0
  153. package/dist/ssr/types.d.ts.map +1 -1
  154. package/dist/ssr-Bt6BQA3J.js +2127 -0
  155. package/dist/ssr-Bt6BQA3J.js.map +1 -0
  156. package/dist/ssr.es.mjs +42 -7
  157. package/dist/{store-CY6sjTW3.js → store-DnXuu6Li.js} +6 -6
  158. package/dist/{store-CY6sjTW3.js.map → store-DnXuu6Li.js.map} +1 -1
  159. package/dist/store.es.mjs +2 -2
  160. package/dist/storybook.es.mjs +1 -1
  161. package/dist/{testing-UjAtu9aQ.js → testing-CeMUwrRD.js} +7 -7
  162. package/dist/{testing-UjAtu9aQ.js.map → testing-CeMUwrRD.js.map} +1 -1
  163. package/dist/testing.es.mjs +1 -1
  164. package/dist/{untrack-D0fnO5k2.js → untrack-bjWDNdyE.js} +11 -10
  165. package/dist/{untrack-D0fnO5k2.js.map → untrack-bjWDNdyE.js.map} +1 -1
  166. package/dist/view.es.mjs +12 -11
  167. package/package.json +24 -15
  168. package/src/concurrency/errors.ts +57 -0
  169. package/src/concurrency/high-level.ts +387 -0
  170. package/src/concurrency/index.ts +63 -0
  171. package/src/concurrency/internal.ts +100 -0
  172. package/src/concurrency/pipeline.ts +133 -0
  173. package/src/concurrency/pool.ts +450 -0
  174. package/src/concurrency/reactive.ts +339 -0
  175. package/src/concurrency/rpc.ts +380 -0
  176. package/src/concurrency/support.ts +44 -0
  177. package/src/concurrency/task.ts +318 -0
  178. package/src/concurrency/types.ts +431 -0
  179. package/src/full.ts +164 -0
  180. package/src/index.ts +6 -0
  181. package/src/media/observers.ts +5 -8
  182. package/src/reactive/watch.ts +10 -9
  183. package/src/reactive/websocket.ts +31 -8
  184. package/src/server/create-server.ts +754 -0
  185. package/src/server/index.ts +33 -0
  186. package/src/server/types.ts +490 -0
  187. package/src/ssr/adapters.ts +330 -0
  188. package/src/ssr/async.ts +125 -0
  189. package/src/ssr/config.ts +86 -0
  190. package/src/ssr/context.ts +245 -0
  191. package/src/ssr/defer-brand.ts +3 -0
  192. package/src/ssr/escape.ts +25 -0
  193. package/src/ssr/expression.ts +669 -0
  194. package/src/ssr/hash.ts +71 -0
  195. package/src/ssr/head.ts +240 -0
  196. package/src/ssr/html-parser.ts +387 -0
  197. package/src/ssr/index.ts +136 -43
  198. package/src/ssr/mismatch.ts +110 -0
  199. package/src/ssr/render-async.ts +286 -0
  200. package/src/ssr/render.ts +130 -59
  201. package/src/ssr/renderer.ts +453 -0
  202. package/src/ssr/resumability.ts +142 -0
  203. package/src/ssr/router-bridge.ts +177 -0
  204. package/src/ssr/runtime.ts +131 -0
  205. package/src/ssr/serialize.ts +1 -27
  206. package/src/ssr/store-snapshot.ts +209 -0
  207. package/src/ssr/strategies.ts +245 -0
  208. package/src/ssr/suspense.ts +504 -0
  209. package/src/ssr/types.ts +18 -0
  210. package/dist/core-DdtZHzsS.js +0 -168
  211. package/dist/core-DdtZHzsS.js.map +0 -1
  212. package/dist/reactive-BjpLkclt.js.map +0 -1
  213. package/dist/router-BieVwgci.js +0 -492
  214. package/dist/router-BieVwgci.js.map +0 -1
  215. package/dist/ssr-CrGSJySz.js +0 -248
  216. package/dist/ssr-CrGSJySz.js.map +0 -1
package/README.md CHANGED
@@ -1,10 +1,6 @@
1
- <p align="center">
2
- <img src="https://raw.githubusercontent.com/bQuery/bQuery/main/assets/bquerry-logo.svg" alt="bQuery.js Logo" width="120" />
3
- </p>
1
+ # bQuery.js
4
2
 
5
- <h1 align="center">bQuery.js</h1>
6
-
7
- <p align="center">
3
+ ![bQuery.js Logo](https://raw.githubusercontent.com/bQuery/bQuery/main/assets/bquerry-logo.svg)
8
4
 
9
5
  [![Repo](https://img.shields.io/badge/github-bquery%2Fbquery-24292f?logo=github)](https://github.com/bQuery/bQuery)
10
6
  [![Stars](https://img.shields.io/github/stars/bquery/bquery?style=flat&logo=github)](https://github.com/bQuery/bQuery/stargazers)
@@ -16,18 +12,17 @@
16
12
  [![CodeFactor](https://www.codefactor.io/repository/github/bquery/bquery/badge)](https://www.codefactor.io/repository/github/bquery/bquery)
17
13
  [![JsDelivr](https://data.jsdelivr.com/v1/package/npm/@bquery/bquery/badge)](https://www.jsdelivr.com/package/npm/@bquery/bquery)
18
14
 
19
- </p>
20
-
21
15
  **The jQuery for the modern Web Platform.**
22
16
 
23
- bQuery.js is a slim, TypeScript-first library that combines jQuery's direct DOM workflow with modern features like reactivity, async data composables, HTTP clients, polling and pagination helpers, realtime transports, REST workflows, Web Components, motion utilities, routing, stores, declarative views, accessibility helpers, forms, i18n, media signals, drag-and-drop, plugins, devtools, testing utilities, and SSR — without a mandatory build step.
17
+ bQuery.js is a slim, TypeScript-first library that combines jQuery's direct DOM workflow with modern features like reactivity, zero-build worker tasks, async data composables, HTTP clients, polling and pagination helpers, realtime transports, REST workflows, lightweight server middleware and WebSocket session routing, Web Components, motion utilities, routing, stores, declarative views, accessibility helpers, forms, i18n, media signals, drag-and-drop, plugins, devtools, testing utilities, and SSR — without a mandatory build step.
24
18
 
25
- > **New in 1.9.0:** `watchDebounce()` / `watchThrottle()` smooth signal watchers, the View module adds `bq-error` and `bq-aria`, and the Media module now includes `useIntersectionObserver()`, `useResizeObserver()`, and `useMutationObserver()`.
19
+ > **New in 1.11.0:** Runtime-agnostic SSR now adds DOM-free fallback rendering, `renderToStringAsync()`, `renderToStream()`, `renderToResponse()`, runtime adapters, hydration strategies, store snapshots, and resumability hooks, alongside the new `@bquery/bquery/server` entry point for dependency-free backend routing and WebSocket sessions.
26
20
 
27
21
  ## Highlights
28
22
 
29
23
  - **Zero-build capable**: runs directly in the browser; build tools are optional.
30
24
  - **Transport-ready reactive data**: fetch composables, HTTP clients, polling, pagination, debounced/throttled watchers, WebSocket / SSE, REST helpers, and request coordination plug directly into signals.
25
+ - **Explicit concurrency primitives**: zero-build worker tasks, RPC helpers, bounded pools, reactive worker state mirrors, and collection helpers keep off-main-thread work predictable.
31
26
  - **Declarative UI bindings**: built-in directives now cover content, events, forms, error output, and reactive ARIA attributes.
32
27
  - **Security-focused**: DOM writes are sanitized by default; Trusted Types supported.
33
28
  - **Modular**: the core stays small; extra modules are opt-in.
@@ -127,6 +122,30 @@ import {
127
122
  deduplicateRequest,
128
123
  } from '@bquery/bquery/reactive';
129
124
 
125
+ // Concurrency only
126
+ import {
127
+ batchTasks,
128
+ callWorkerMethod,
129
+ createReactiveRpcPool,
130
+ createReactiveRpcWorker,
131
+ createReactiveTaskPool,
132
+ createReactiveTaskWorker,
133
+ createRpcPool,
134
+ createRpcWorker,
135
+ createTaskPool,
136
+ createTaskWorker,
137
+ every,
138
+ filter,
139
+ find,
140
+ getConcurrencySupport,
141
+ map,
142
+ parallel,
143
+ pipeline,
144
+ reduce,
145
+ runTask,
146
+ some,
147
+ } from '@bquery/bquery/concurrency';
148
+
130
149
  // Components only
131
150
  import {
132
151
  bool,
@@ -164,11 +183,12 @@ import {
164
183
  clipboard,
165
184
  } from '@bquery/bquery/media';
166
185
 
167
- // Plugins, devtools, testing, SSR
186
+ // Plugins, devtools, testing, SSR, server
168
187
  import { use } from '@bquery/bquery/plugin';
169
188
  import { enableDevtools, inspectSignals } from '@bquery/bquery/devtools';
170
189
  import { renderComponent, fireEvent, waitFor } from '@bquery/bquery/testing';
171
190
  import { renderToString, hydrateMount, serializeStoreState } from '@bquery/bquery/ssr';
191
+ import { createServer } from '@bquery/bquery/server';
172
192
 
173
193
  // Storybook helpers
174
194
  import { storyHtml, when } from '@bquery/bquery/storybook';
@@ -176,29 +196,33 @@ import { storyHtml, when } from '@bquery/bquery/storybook';
176
196
 
177
197
  ## Modules at a glance
178
198
 
179
- | Module | Description |
180
- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
181
- | **Core** | Selectors, DOM manipulation, events, traversal, and typed utilities |
182
- | **Reactive** | `signal`, `computed`, `effect`, `watchDebounce`, `watchThrottle`, async data, HTTP clients, polling, pagination, WebSocket / SSE, and REST helpers |
183
- | **Component** | Typed Web Components with scoped reactivity and configurable Shadow DOM |
184
- | **Storybook** | Safe story template helpers with boolean-attribute shorthand |
185
- | **Motion** | View transitions, FLIP, morphing, parallax, typewriter, springs, and timelines |
186
- | **Security** | HTML sanitization, Trusted Types, CSP helpers, and trusted fragment composition |
187
- | **Platform** | Storage, cache, cookies, page metadata, announcers, and shared runtime config |
188
- | **Router** | SPA routing, constrained params, redirects, guards, `useRoute()`, and `<bq-link>` |
189
- | **Store** | Signal-based state management, persistence, migrations, and action hooks |
190
- | **View** | Declarative DOM bindings with `bq-*` directives for content, classes, forms, errors, ARIA, and plugins |
191
- | **Forms** | Reactive form state with sync/async validation and submit handling |
192
- | **i18n** | Reactive locales, interpolation, pluralization, lazy loading, and Intl formatting |
193
- | **A11y** | Focus traps, live-region announcements, roving tabindex, skip links, and audits |
194
- | **DnD** | Draggable elements, droppable zones, and sortable lists |
195
- | **Media** | Reactive browser/device signals for viewport, network, battery, geolocation, clipboard, and DOM observers |
196
- | **Plugin** | Global plugin registration for custom directives and Web Components |
197
- | **Devtools** | Runtime inspection helpers for signals, stores, components, and timelines |
198
- | **Testing** | Component mounting, mock signals/router helpers, and async test utilities |
199
- | **SSR** | Server-side rendering, hydration, and store-state serialization |
200
-
201
- Storybook authoring helpers are also available as a dedicated entry point via `@bquery/bquery/storybook`.
199
+ | Module | Description |
200
+ | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
201
+ | **Core** | Selectors, DOM manipulation, events, traversal, and typed utilities |
202
+ | **Reactive** | `signal`, `computed`, `effect`, `watchDebounce`, `watchThrottle`, async data, HTTP clients, polling, pagination, WebSocket / SSE, and REST helpers |
203
+ | **Concurrency** | Zero-build worker tasks, explicit RPC helpers, optional reactive state wrappers, bounded worker pools, high-level collection helpers, and an optional fluent pipeline layer |
204
+ | **Component** | Typed Web Components with scoped reactivity and configurable Shadow DOM |
205
+ | **Storybook** | Safe story template helpers with boolean-attribute shorthand |
206
+ | **Motion** | View transitions, FLIP, morphing, parallax, typewriter, springs, and timelines |
207
+ | **Security** | HTML sanitization, Trusted Types, CSP helpers, and trusted fragment composition |
208
+ | **Platform** | Storage, cache, cookies, page metadata, announcers, and shared runtime config |
209
+ | **Router** | SPA routing, constrained params, redirects, guards, `useRoute()`, and `<bq-link>` |
210
+ | **Store** | Signal-based state management, persistence, migrations, and action hooks |
211
+ | **View** | Declarative DOM bindings with `bq-*` directives for content, classes, forms, errors, ARIA, and plugins |
212
+ | **Forms** | Reactive form state with sync/async validation and submit handling |
213
+ | **i18n** | Reactive locales, interpolation, pluralization, lazy loading, and Intl formatting |
214
+ | **A11y** | Focus traps, live-region announcements, roving tabindex, skip links, and audits |
215
+ | **DnD** | Draggable elements, droppable zones, and sortable lists |
216
+ | **Media** | Reactive browser/device signals for viewport, network, battery, geolocation, clipboard, and DOM observers |
217
+ | **Plugin** | Global plugin registration for custom directives and Web Components |
218
+ | **Devtools** | Runtime inspection helpers for signals, stores, components, and timelines |
219
+ | **Testing** | Component mounting, mock signals/router helpers, and async test utilities |
220
+ | **SSR** | Runtime-agnostic server-side rendering (Node ≥ 24, Deno, Bun), streaming, async loaders, hydration islands, head/asset/CSP-nonce management, runtime adapters |
221
+ | **Server** | Express-inspired backend routing, middleware, safe response helpers, SSR-aware request handling, and runtime-agnostic WebSocket sessions |
222
+
223
+ Storybook authoring helpers are also available as a dedicated entry point via `@bquery/bquery/storybook`. Worker-task, RPC, worker-pool, high-level task-list / collection helpers, and the optional fluent pipeline layer ship as a dedicated entry point via `@bquery/bquery/concurrency`. Server-side middleware, HTTP routing, and runtime-agnostic WebSocket session helpers ship as a dedicated entry point via `@bquery/bquery/server`.
224
+
225
+ Reusable workers and pools can also opt into readonly signal mirrors such as `state$`, `busy$`, `pending$`, and `size$` through the `createReactive*()` concurrency wrappers.
202
226
 
203
227
  ## Quick examples
204
228
 
@@ -283,6 +307,134 @@ const fullName = linkedSignal(
283
307
  fullName.value = 'Grace Hopper';
284
308
  ```
285
309
 
310
+ ### Concurrency – worker tasks
311
+
312
+ ```ts
313
+ import { runTask } from '@bquery/bquery/concurrency';
314
+
315
+ const total = await runTask(
316
+ ({ values }: { values: number[] }) => values.reduce((sum, value) => sum + value, 0),
317
+ { values: [1, 2, 3, 4] },
318
+ { timeout: 1_000 }
319
+ );
320
+
321
+ console.log(total); // 10
322
+ ```
323
+
324
+ ### Concurrency – RPC-style worker methods
325
+
326
+ ```ts
327
+ import { createRpcWorker } from '@bquery/bquery/concurrency';
328
+
329
+ const rpc = createRpcWorker({
330
+ formatUser: ({ first, last }: { first: string; last: string }) => `${last}, ${first}`,
331
+ sum: ({ values }: { values: number[] }) => values.reduce((total, value) => total + value, 0),
332
+ });
333
+
334
+ console.log(await rpc.call('formatUser', { first: 'Ada', last: 'Lovelace' }));
335
+ console.log(await rpc.call('sum', { values: [1, 2, 3] }));
336
+
337
+ rpc.terminate();
338
+ ```
339
+
340
+ ### Concurrency – pooled worker execution
341
+
342
+ ```ts
343
+ import { createTaskPool } from '@bquery/bquery/concurrency';
344
+
345
+ const pool = createTaskPool(({ value }: { value: number }) => value * 2, {
346
+ concurrency: 4,
347
+ maxQueue: 16,
348
+ name: 'double-pool',
349
+ });
350
+
351
+ const results = await Promise.all([
352
+ pool.run({ value: 1 }),
353
+ pool.run({ value: 2 }),
354
+ pool.run({ value: 3 }),
355
+ ]);
356
+
357
+ console.log(results); // [2, 4, 6]
358
+ pool.terminate();
359
+ ```
360
+
361
+ ### Concurrency – reactive pool state
362
+
363
+ ```ts
364
+ import { createReactiveTaskPool } from '@bquery/bquery/concurrency';
365
+ import { effect } from '@bquery/bquery/reactive';
366
+
367
+ const pool = createReactiveTaskPool(
368
+ async ({ delay, value }: { delay: number; value: number }) => {
369
+ await new Promise((resolve) => setTimeout(resolve, delay));
370
+ return value * 2;
371
+ },
372
+ { concurrency: 2, maxQueue: 8 }
373
+ );
374
+
375
+ effect(() => {
376
+ console.log(pool.state$.value, pool.pending$.value, pool.size$.value);
377
+ });
378
+
379
+ await Promise.all([
380
+ pool.run({ delay: 20, value: 1 }),
381
+ pool.run({ delay: 20, value: 2 }),
382
+ pool.run({ delay: 0, value: 3 }),
383
+ ]);
384
+
385
+ pool.terminate();
386
+ ```
387
+
388
+ ### Concurrency – task lists, collection helpers & pipelines
389
+
390
+ ```ts
391
+ import {
392
+ batchTasks,
393
+ every,
394
+ filter,
395
+ find,
396
+ map,
397
+ parallel,
398
+ pipeline,
399
+ reduce,
400
+ some,
401
+ } from '@bquery/bquery/concurrency';
402
+
403
+ const tasks = await parallel([
404
+ { handler: (value: number) => value * 2, input: 5 },
405
+ {
406
+ handler: ({ first, last }: { first: string; last: string }) => `${last}, ${first}`,
407
+ input: { first: 'Ada', last: 'Lovelace' },
408
+ },
409
+ ]);
410
+
411
+ const batched = await batchTasks(
412
+ [
413
+ { handler: (value: number) => value * 2, input: 1 },
414
+ { handler: (value: number) => value * 2, input: 2 },
415
+ { handler: (value: number) => value * 2, input: 3 },
416
+ ],
417
+ 2
418
+ );
419
+
420
+ const mapped = await map([1, 2, 3, 4], (value, index) => value + index, {
421
+ batchSize: 2,
422
+ concurrency: 2,
423
+ });
424
+
425
+ const filtered = await filter([5, 2, 9, 4], (value) => value % 2 === 1);
426
+ const hasEven = await some([1, 3, 4], (value) => value % 2 === 0);
427
+ const allEven = await every([2, 4, 6], (value) => value % 2 === 0);
428
+ const firstLarge = await find([3, 8, 11, 14], (value) => value > 10);
429
+ const reduced = await reduce([1, 2, 3, 4], (accumulator, value) => accumulator + value, 0);
430
+ const piped = await pipeline([1, 2, 3, 4], { batchSize: 2, concurrency: 2 })
431
+ .map((value) => value * 2)
432
+ .filter((value) => value > 4)
433
+ .toArray();
434
+
435
+ console.log(tasks, batched, mapped, filtered, hasEven, allEven, firstLarge, reduced, piped);
436
+ ```
437
+
286
438
  ### Reactive – async data & fetch
287
439
 
288
440
  ```ts
@@ -628,13 +780,14 @@ drag.destroy();
628
780
  modalTrap.release();
629
781
  ```
630
782
 
631
- ### Plugins, devtools, testing, and SSR
783
+ ### Plugins, devtools, testing, SSR, and server
632
784
 
633
785
  ```ts
634
786
  import { use } from '@bquery/bquery/plugin';
635
787
  import { enableDevtools, getTimeline } from '@bquery/bquery/devtools';
636
788
  import { renderComponent, fireEvent } from '@bquery/bquery/testing';
637
789
  import { renderToString } from '@bquery/bquery/ssr';
790
+ import { createServer } from '@bquery/bquery/server';
638
791
 
639
792
  use({
640
793
  name: 'focus-plugin',
@@ -652,6 +805,20 @@ fireEvent(mounted.el, 'click');
652
805
  const { html } = renderToString('<p bq-text="label"></p>', { label: 'Hello SSR' });
653
806
  console.log(html);
654
807
 
808
+ const app = createServer();
809
+ app.get('/hello/:name', (ctx) => ctx.json({ name: ctx.params.name, q: ctx.query.q }));
810
+
811
+ // Runtime-agnostic async render with head injection (works on Node, Deno, Bun):
812
+ import { createSSRContext, renderToResponse } from '@bquery/bquery/ssr';
813
+ const ctx = createSSRContext({ request: new Request('http://localhost/') });
814
+ ctx.head.add({ title: 'Home' });
815
+ ctx.assets.module('/app.js');
816
+ const response = await renderToResponse(
817
+ '<html><head></head><body><p bq-text="label"></p></body></html>',
818
+ { label: 'Hello' },
819
+ { context: ctx, etag: true }
820
+ );
821
+
655
822
  mounted.unmount();
656
823
  ```
657
824
 
@@ -728,10 +895,10 @@ mount('#app', {
728
895
 
729
896
  | Browser | Version | Support |
730
897
  | ------- | ------- | ------- |
731
- | Chrome | 90+ | ✅ Full |
732
- | Firefox | 90+ | ✅ Full |
733
- | Safari | 15+ | ✅ Full |
734
- | Edge | 90+ | ✅ Full |
898
+ | Chrome | 90+ | ✅ Full |
899
+ | Firefox | 90+ | ✅ Full |
900
+ | Safari | 15+ | ✅ Full |
901
+ | Edge | 90+ | ✅ Full |
735
902
 
736
903
  > **No IE support** by design.
737
904
 
@@ -758,9 +925,12 @@ mount('#app', {
758
925
  - **Devtools**: [docs/guide/devtools.md](docs/guide/devtools.md)
759
926
  - **Testing Utilities**: [docs/guide/testing.md](docs/guide/testing.md)
760
927
  - **SSR / Hydration**: [docs/guide/ssr.md](docs/guide/ssr.md)
928
+ - **Server**: [docs/guide/server.md](docs/guide/server.md)
761
929
 
762
930
  ## Local Development
763
931
 
932
+ The cross-runtime SSR examples in [`examples/`](examples/) import directly from `src/`, so you can run them from a repo checkout without building `dist/` first.
933
+
764
934
  ```bash
765
935
  # Install dependencies
766
936
  bun install
@@ -777,11 +947,19 @@ bun test
777
947
  # Build library
778
948
  bun run build
779
949
 
950
+ # Verify AI guidance / release metadata sync
951
+ bun run check:ai-guidance
952
+
780
953
  # Build docs
781
954
  bun run build:docs
782
955
 
783
956
  # Generate API documentation
784
957
  bun run docs:api
958
+
959
+ # Run the cross-runtime SSR examples directly from source
960
+ bun examples/ssr-bun/serve.ts
961
+ deno run -A examples/ssr-deno/serve.ts
962
+ node --experimental-strip-types examples/ssr-node/serve.ts
785
963
  ```
786
964
 
787
965
  ## Project Structure
@@ -791,6 +969,7 @@ bQuery.js
791
969
  ├── src/
792
970
  │ ├── core/ # Selectors, DOM ops, events, utils
793
971
  │ ├── reactive/ # Signals, computed, effects, async data
972
+ │ ├── concurrency/ # Zero-build worker tasks, RPC, pools, collection helpers
794
973
  │ ├── component/ # Web Components helper + default library
795
974
  │ ├── storybook/ # Story template helpers
796
975
  │ ├── motion/ # View transitions, FLIP, springs
@@ -807,7 +986,8 @@ bQuery.js
807
986
  │ ├── plugin/ # Global plugin system
808
987
  │ ├── devtools/ # Runtime inspection helpers
809
988
  │ ├── testing/ # Test utilities
810
- └── ssr/ # Server-side rendering + hydration
989
+ ├── ssr/ # Runtime-agnostic server-side rendering + hydration
990
+ │ └── server/ # Backend helpers and WebSocket sessions
811
991
  ├── docs/ # VitePress documentation
812
992
  ├── .storybook/ # Storybook config
813
993
  ├── stories/ # Component stories
@@ -826,6 +1006,7 @@ This project provides dedicated context files for AI coding agents:
826
1006
  - **[AGENT.md](AGENT.md)** — Architecture, module API reference, coding conventions, common tasks
827
1007
  - **[llms.txt](llms.txt)** — Compact LLM-optimized project summary
828
1008
  - **[.github/copilot-instructions.md](.github/copilot-instructions.md)** — GitHub Copilot context
1009
+ - **`bun run check:ai-guidance`** — Lightweight sync check for version / engine / AI guidance drift
829
1010
 
830
1011
  ## License
831
1012
 
@@ -1,5 +1,5 @@
1
- import { n as E } from "./core-DdtZHzsS.js";
2
- import { g as I } from "./reactive-BjpLkclt.js";
1
+ import { n as E } from "./core-CongXJuo.js";
2
+ import { n as I } from "./readonly-C0ZwS1Tf.js";
3
3
  var w = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), q = 50, M = (e) => {
4
4
  const t = w.get(e);
5
5
  if (t && t.isConnected) return t;
@@ -418,4 +418,4 @@ export {
418
418
  G as u
419
419
  };
420
420
 
421
- //# sourceMappingURL=a11y-_9X-kt-_.js.map
421
+ //# sourceMappingURL=a11y-DgUQ8-fI.js.map