@pwfabric/runtime 0.0.0-stage → 1.0.0-rc.1

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 (447) hide show
  1. package/LICENSE +90 -0
  2. package/README.md +43 -2
  3. package/dist/a11y/announcer.d.ts +65 -0
  4. package/dist/a11y/announcer.js +140 -0
  5. package/dist/a11y/announcer.js.map +1 -0
  6. package/dist/a11y/contrast.d.ts +54 -0
  7. package/dist/a11y/contrast.js +93 -0
  8. package/dist/a11y/contrast.js.map +1 -0
  9. package/dist/a11y/focus.d.ts +123 -0
  10. package/dist/a11y/focus.js +282 -0
  11. package/dist/a11y/focus.js.map +1 -0
  12. package/dist/a11y/index.d.ts +21 -0
  13. package/dist/a11y/index.js +18 -0
  14. package/dist/a11y/index.js.map +1 -0
  15. package/dist/a11y/keyboard.d.ts +144 -0
  16. package/dist/a11y/keyboard.js +317 -0
  17. package/dist/a11y/keyboard.js.map +1 -0
  18. package/dist/adapters/default-image.d.ts +25 -0
  19. package/dist/adapters/default-image.js +37 -0
  20. package/dist/adapters/default-image.js.map +1 -0
  21. package/dist/adapters/index.d.ts +27 -0
  22. package/dist/adapters/index.js +28 -0
  23. package/dist/adapters/index.js.map +1 -0
  24. package/dist/adapters/next-image.d.ts +38 -0
  25. package/dist/adapters/next-image.js +124 -0
  26. package/dist/adapters/next-image.js.map +1 -0
  27. package/dist/adapters/types.d.ts +61 -0
  28. package/dist/adapters/types.js +11 -0
  29. package/dist/adapters/types.js.map +1 -0
  30. package/dist/analytics/index.d.ts +14 -0
  31. package/dist/analytics/index.js +15 -0
  32. package/dist/analytics/index.js.map +1 -0
  33. package/dist/analytics/tracker.d.ts +65 -0
  34. package/dist/analytics/tracker.js +251 -0
  35. package/dist/analytics/tracker.js.map +1 -0
  36. package/dist/analytics/types.d.ts +130 -0
  37. package/dist/analytics/types.js +11 -0
  38. package/dist/analytics/types.js.map +1 -0
  39. package/dist/auth/index.d.ts +15 -0
  40. package/dist/auth/index.js +14 -0
  41. package/dist/auth/index.js.map +1 -0
  42. package/dist/auth/provider.d.ts +132 -0
  43. package/dist/auth/provider.js +473 -0
  44. package/dist/auth/provider.js.map +1 -0
  45. package/dist/auth/types.d.ts +117 -0
  46. package/dist/auth/types.js +9 -0
  47. package/dist/auth/types.js.map +1 -0
  48. package/dist/binding/collection.d.ts +190 -0
  49. package/dist/binding/collection.js +358 -0
  50. package/dist/binding/collection.js.map +1 -0
  51. package/dist/binding/datasource.d.ts +319 -0
  52. package/dist/binding/datasource.js +556 -0
  53. package/dist/binding/datasource.js.map +1 -0
  54. package/dist/binding/engine.d.ts +65 -0
  55. package/dist/binding/engine.js +268 -0
  56. package/dist/binding/engine.js.map +1 -0
  57. package/dist/binding/expression.d.ts +150 -0
  58. package/dist/binding/expression.js +787 -0
  59. package/dist/binding/expression.js.map +1 -0
  60. package/dist/binding/index.d.ts +19 -0
  61. package/dist/binding/index.js +14 -0
  62. package/dist/binding/index.js.map +1 -0
  63. package/dist/binding/two-way.d.ts +149 -0
  64. package/dist/binding/two-way.js +462 -0
  65. package/dist/binding/two-way.js.map +1 -0
  66. package/dist/binding/types.d.ts +119 -0
  67. package/dist/binding/types.js +9 -0
  68. package/dist/binding/types.js.map +1 -0
  69. package/dist/blocks/component-types.d.ts +81 -0
  70. package/dist/blocks/component-types.js +11 -0
  71. package/dist/blocks/component-types.js.map +1 -0
  72. package/dist/blocks/composition-rules.d.ts +168 -0
  73. package/dist/blocks/composition-rules.js +391 -0
  74. package/dist/blocks/composition-rules.js.map +1 -0
  75. package/dist/blocks/hooks.d.ts +31 -0
  76. package/dist/blocks/hooks.js +42 -0
  77. package/dist/blocks/hooks.js.map +1 -0
  78. package/dist/blocks/index.d.ts +14 -0
  79. package/dist/blocks/index.js +23 -0
  80. package/dist/blocks/index.js.map +1 -0
  81. package/dist/blocks/registry.d.ts +84 -0
  82. package/dist/blocks/registry.js +136 -0
  83. package/dist/blocks/registry.js.map +1 -0
  84. package/dist/blocks/rule-engine.d.ts +131 -0
  85. package/dist/blocks/rule-engine.js +321 -0
  86. package/dist/blocks/rule-engine.js.map +1 -0
  87. package/dist/blocks/surface-event-context.d.ts +13 -0
  88. package/dist/blocks/surface-event-context.js +14 -0
  89. package/dist/blocks/surface-event-context.js.map +1 -0
  90. package/dist/blocks/surface-id-context.d.ts +13 -0
  91. package/dist/blocks/surface-id-context.js +15 -0
  92. package/dist/blocks/surface-id-context.js.map +1 -0
  93. package/dist/bus.d.ts +41 -0
  94. package/dist/bus.js +158 -0
  95. package/dist/bus.js.map +1 -0
  96. package/dist/cache/index.d.ts +9 -0
  97. package/dist/cache/index.js +10 -0
  98. package/dist/cache/index.js.map +1 -0
  99. package/dist/cache/memory.d.ts +32 -0
  100. package/dist/cache/memory.js +138 -0
  101. package/dist/cache/memory.js.map +1 -0
  102. package/dist/cache/types.d.ts +62 -0
  103. package/dist/cache/types.js +9 -0
  104. package/dist/cache/types.js.map +1 -0
  105. package/dist/capability/index.d.ts +72 -0
  106. package/dist/capability/index.js +87 -0
  107. package/dist/capability/index.js.map +1 -0
  108. package/dist/capability/kernel-capabilities.d.ts +31 -0
  109. package/dist/capability/kernel-capabilities.js +36 -0
  110. package/dist/capability/kernel-capabilities.js.map +1 -0
  111. package/dist/capability/platform-capabilities.d.ts +71 -0
  112. package/dist/capability/platform-capabilities.js +267 -0
  113. package/dist/capability/platform-capabilities.js.map +1 -0
  114. package/dist/capability/type-mapping.d.ts +70 -0
  115. package/dist/capability/type-mapping.js +107 -0
  116. package/dist/capability/type-mapping.js.map +1 -0
  117. package/dist/capability/validation.d.ts +46 -0
  118. package/dist/capability/validation.js +54 -0
  119. package/dist/capability/validation.js.map +1 -0
  120. package/dist/connectors/declared-connector.d.ts +48 -0
  121. package/dist/connectors/declared-connector.js +333 -0
  122. package/dist/connectors/declared-connector.js.map +1 -0
  123. package/dist/connectors/engine-registry.d.ts +50 -0
  124. package/dist/connectors/engine-registry.js +135 -0
  125. package/dist/connectors/engine-registry.js.map +1 -0
  126. package/dist/connectors/index.d.ts +14 -0
  127. package/dist/connectors/index.js +14 -0
  128. package/dist/connectors/index.js.map +1 -0
  129. package/dist/connectors/module-loader.d.ts +70 -0
  130. package/dist/connectors/module-loader.js +143 -0
  131. package/dist/connectors/module-loader.js.map +1 -0
  132. package/dist/connectors/types.d.ts +174 -0
  133. package/dist/connectors/types.js +23 -0
  134. package/dist/connectors/types.js.map +1 -0
  135. package/dist/context.d.ts +27 -0
  136. package/dist/context.js +38 -0
  137. package/dist/context.js.map +1 -0
  138. package/dist/data/DataCapabilityProvider.d.ts +39 -0
  139. package/dist/data/DataCapabilityProvider.js +58 -0
  140. package/dist/data/DataCapabilityProvider.js.map +1 -0
  141. package/dist/data/index.d.ts +17 -0
  142. package/dist/data/index.js +18 -0
  143. package/dist/data/index.js.map +1 -0
  144. package/dist/data/manager.d.ts +40 -0
  145. package/dist/data/manager.js +442 -0
  146. package/dist/data/manager.js.map +1 -0
  147. package/dist/data/types.d.ts +218 -0
  148. package/dist/data/types.js +2 -0
  149. package/dist/data/types.js.map +1 -0
  150. package/dist/entity/aggregate.d.ts +8 -0
  151. package/dist/entity/aggregate.js +24 -0
  152. package/dist/entity/aggregate.js.map +1 -0
  153. package/dist/entity/apply-query.d.ts +58 -0
  154. package/dist/entity/apply-query.js +264 -0
  155. package/dist/entity/apply-query.js.map +1 -0
  156. package/dist/entity/behavior.d.ts +94 -0
  157. package/dist/entity/behavior.js +78 -0
  158. package/dist/entity/behavior.js.map +1 -0
  159. package/dist/entity/connector.d.ts +141 -0
  160. package/dist/entity/connector.js +89 -0
  161. package/dist/entity/connector.js.map +1 -0
  162. package/dist/entity/connectors/index.d.ts +12 -0
  163. package/dist/entity/connectors/index.js +11 -0
  164. package/dist/entity/connectors/index.js.map +1 -0
  165. package/dist/entity/connectors/static.d.ts +51 -0
  166. package/dist/entity/connectors/static.js +245 -0
  167. package/dist/entity/connectors/static.js.map +1 -0
  168. package/dist/entity/entity-datasource.d.ts +50 -0
  169. package/dist/entity/entity-datasource.js +33 -0
  170. package/dist/entity/entity-datasource.js.map +1 -0
  171. package/dist/entity/facade.d.ts +70 -0
  172. package/dist/entity/facade.js +70 -0
  173. package/dist/entity/facade.js.map +1 -0
  174. package/dist/entity/http-connector.d.ts +123 -0
  175. package/dist/entity/http-connector.js +295 -0
  176. package/dist/entity/http-connector.js.map +1 -0
  177. package/dist/entity/index.d.ts +38 -0
  178. package/dist/entity/index.js +31 -0
  179. package/dist/entity/index.js.map +1 -0
  180. package/dist/entity/postgres-connector.d.ts +64 -0
  181. package/dist/entity/postgres-connector.js +239 -0
  182. package/dist/entity/postgres-connector.js.map +1 -0
  183. package/dist/entity/registry.d.ts +59 -0
  184. package/dist/entity/registry.js +90 -0
  185. package/dist/entity/registry.js.map +1 -0
  186. package/dist/entity/store.d.ts +66 -0
  187. package/dist/entity/store.js +349 -0
  188. package/dist/entity/store.js.map +1 -0
  189. package/dist/entity/types.d.ts +180 -0
  190. package/dist/entity/types.js +10 -0
  191. package/dist/entity/types.js.map +1 -0
  192. package/dist/execution-context.d.ts +88 -0
  193. package/dist/execution-context.js +146 -0
  194. package/dist/execution-context.js.map +1 -0
  195. package/dist/executor.d.ts +27 -0
  196. package/dist/executor.js +33 -0
  197. package/dist/executor.js.map +1 -0
  198. package/dist/forms/form-entity-bridge.d.ts +94 -0
  199. package/dist/forms/form-entity-bridge.js +96 -0
  200. package/dist/forms/form-entity-bridge.js.map +1 -0
  201. package/dist/forms/form-write-target.d.ts +34 -0
  202. package/dist/forms/form-write-target.js +81 -0
  203. package/dist/forms/form-write-target.js.map +1 -0
  204. package/dist/forms/index.d.ts +22 -0
  205. package/dist/forms/index.js +25 -0
  206. package/dist/forms/index.js.map +1 -0
  207. package/dist/forms/named-control-values.d.ts +27 -0
  208. package/dist/forms/named-control-values.js +42 -0
  209. package/dist/forms/named-control-values.js.map +1 -0
  210. package/dist/forms/processor.d.ts +55 -0
  211. package/dist/forms/processor.js +154 -0
  212. package/dist/forms/processor.js.map +1 -0
  213. package/dist/forms/types.d.ts +174 -0
  214. package/dist/forms/types.js +33 -0
  215. package/dist/forms/types.js.map +1 -0
  216. package/dist/forms/validator.d.ts +61 -0
  217. package/dist/forms/validator.js +218 -0
  218. package/dist/forms/validator.js.map +1 -0
  219. package/dist/graph/index.d.ts +10 -0
  220. package/dist/graph/index.js +9 -0
  221. package/dist/graph/index.js.map +1 -0
  222. package/dist/graph/resolver.d.ts +66 -0
  223. package/dist/graph/resolver.js +243 -0
  224. package/dist/graph/resolver.js.map +1 -0
  225. package/dist/graph/types.d.ts +125 -0
  226. package/dist/graph/types.js +9 -0
  227. package/dist/graph/types.js.map +1 -0
  228. package/dist/hooks/useInstalledAtoms.d.ts +96 -0
  229. package/dist/hooks/useInstalledAtoms.js +92 -0
  230. package/dist/hooks/useInstalledAtoms.js.map +1 -0
  231. package/dist/i18n/index.d.ts +15 -0
  232. package/dist/i18n/index.js +14 -0
  233. package/dist/i18n/index.js.map +1 -0
  234. package/dist/i18n/translator.d.ts +76 -0
  235. package/dist/i18n/translator.js +357 -0
  236. package/dist/i18n/translator.js.map +1 -0
  237. package/dist/i18n/types.d.ts +93 -0
  238. package/dist/i18n/types.js +9 -0
  239. package/dist/i18n/types.js.map +1 -0
  240. package/dist/index.d.ts +64 -0
  241. package/dist/index.js +95 -0
  242. package/dist/index.js.map +1 -0
  243. package/dist/kernel.d.ts +47 -0
  244. package/dist/kernel.js +258 -0
  245. package/dist/kernel.js.map +1 -0
  246. package/dist/perf/budget.d.ts +92 -0
  247. package/dist/perf/budget.js +122 -0
  248. package/dist/perf/budget.js.map +1 -0
  249. package/dist/perf/index.d.ts +16 -0
  250. package/dist/perf/index.js +13 -0
  251. package/dist/perf/index.js.map +1 -0
  252. package/dist/perf/render-timer.d.ts +90 -0
  253. package/dist/perf/render-timer.js +136 -0
  254. package/dist/perf/render-timer.js.map +1 -0
  255. package/dist/perf/reporter.d.ts +126 -0
  256. package/dist/perf/reporter.js +241 -0
  257. package/dist/perf/reporter.js.map +1 -0
  258. package/dist/perf/web-vitals.d.ts +111 -0
  259. package/dist/perf/web-vitals.js +268 -0
  260. package/dist/perf/web-vitals.js.map +1 -0
  261. package/dist/registry.d.ts +63 -0
  262. package/dist/registry.js +126 -0
  263. package/dist/registry.js.map +1 -0
  264. package/dist/render/BehaviorSurfaceProvider.d.ts +65 -0
  265. package/dist/render/BehaviorSurfaceProvider.js +185 -0
  266. package/dist/render/BehaviorSurfaceProvider.js.map +1 -0
  267. package/dist/render/BlockErrorBoundary.d.ts +26 -0
  268. package/dist/render/BlockErrorBoundary.js +41 -0
  269. package/dist/render/BlockErrorBoundary.js.map +1 -0
  270. package/dist/render/DataBoundSurfaceRenderer.d.ts +78 -0
  271. package/dist/render/DataBoundSurfaceRenderer.js +998 -0
  272. package/dist/render/DataBoundSurfaceRenderer.js.map +1 -0
  273. package/dist/render/DynamicBlockWrapper.d.ts +23 -0
  274. package/dist/render/DynamicBlockWrapper.js +117 -0
  275. package/dist/render/DynamicBlockWrapper.js.map +1 -0
  276. package/dist/render/appearance-resolver.d.ts +50 -0
  277. package/dist/render/appearance-resolver.js +78 -0
  278. package/dist/render/appearance-resolver.js.map +1 -0
  279. package/dist/render/capability-gate.d.ts +69 -0
  280. package/dist/render/capability-gate.js +94 -0
  281. package/dist/render/capability-gate.js.map +1 -0
  282. package/dist/render/conditional-states-css.d.ts +41 -0
  283. package/dist/render/conditional-states-css.js +82 -0
  284. package/dist/render/conditional-states-css.js.map +1 -0
  285. package/dist/render/connections-context.d.ts +31 -0
  286. package/dist/render/connections-context.js +34 -0
  287. package/dist/render/connections-context.js.map +1 -0
  288. package/dist/render/dark-theme-css.d.ts +36 -0
  289. package/dist/render/dark-theme-css.js +67 -0
  290. package/dist/render/dark-theme-css.js.map +1 -0
  291. package/dist/render/data-binding-types.d.ts +191 -0
  292. package/dist/render/data-binding-types.js +11 -0
  293. package/dist/render/data-binding-types.js.map +1 -0
  294. package/dist/render/data-cache.d.ts +30 -0
  295. package/dist/render/data-cache.js +37 -0
  296. package/dist/render/data-cache.js.map +1 -0
  297. package/dist/render/derive-dark-theme.d.ts +17 -0
  298. package/dist/render/derive-dark-theme.js +18 -0
  299. package/dist/render/derive-dark-theme.js.map +1 -0
  300. package/dist/render/dynamic-artifact-context.d.ts +77 -0
  301. package/dist/render/dynamic-artifact-context.js +89 -0
  302. package/dist/render/dynamic-artifact-context.js.map +1 -0
  303. package/dist/render/dynamic-block-loader.d.ts +80 -0
  304. package/dist/render/dynamic-block-loader.js +197 -0
  305. package/dist/render/dynamic-block-loader.js.map +1 -0
  306. package/dist/render/endpoint.d.ts +18 -0
  307. package/dist/render/endpoint.js +109 -0
  308. package/dist/render/endpoint.js.map +1 -0
  309. package/dist/render/entity-facade-context.d.ts +34 -0
  310. package/dist/render/entity-facade-context.js +37 -0
  311. package/dist/render/entity-facade-context.js.map +1 -0
  312. package/dist/render/group-states-css.d.ts +41 -0
  313. package/dist/render/group-states-css.js +73 -0
  314. package/dist/render/group-states-css.js.map +1 -0
  315. package/dist/render/hooks/useSurfaceEvents.d.ts +8 -0
  316. package/dist/render/hooks/useSurfaceEvents.js +9 -0
  317. package/dist/render/hooks/useSurfaceEvents.js.map +1 -0
  318. package/dist/render/hooks/useSurfaceId.d.ts +8 -0
  319. package/dist/render/hooks/useSurfaceId.js +9 -0
  320. package/dist/render/hooks/useSurfaceId.js.map +1 -0
  321. package/dist/render/index.d.ts +48 -0
  322. package/dist/render/index.js +61 -0
  323. package/dist/render/index.js.map +1 -0
  324. package/dist/render/interaction-rule-engine.d.ts +12 -0
  325. package/dist/render/interaction-rule-engine.js +47 -0
  326. package/dist/render/interaction-rule-engine.js.map +1 -0
  327. package/dist/render/keyframes-css.d.ts +31 -0
  328. package/dist/render/keyframes-css.js +44 -0
  329. package/dist/render/keyframes-css.js.map +1 -0
  330. package/dist/render/query-state.d.ts +3 -0
  331. package/dist/render/query-state.js +70 -0
  332. package/dist/render/query-state.js.map +1 -0
  333. package/dist/render/renderer.d.ts +44 -0
  334. package/dist/render/renderer.js +937 -0
  335. package/dist/render/renderer.js.map +1 -0
  336. package/dist/render/resolve-expressions.d.ts +37 -0
  337. package/dist/render/resolve-expressions.js +309 -0
  338. package/dist/render/resolve-expressions.js.map +1 -0
  339. package/dist/render/responsive-style-css.d.ts +42 -0
  340. package/dist/render/responsive-style-css.js +123 -0
  341. package/dist/render/responsive-style-css.js.map +1 -0
  342. package/dist/render/responsive.d.ts +49 -0
  343. package/dist/render/responsive.js +99 -0
  344. package/dist/render/responsive.js.map +1 -0
  345. package/dist/render/scoped-css.d.ts +71 -0
  346. package/dist/render/scoped-css.js +102 -0
  347. package/dist/render/scoped-css.js.map +1 -0
  348. package/dist/render/shell-selection.d.ts +69 -0
  349. package/dist/render/shell-selection.js +117 -0
  350. package/dist/render/shell-selection.js.map +1 -0
  351. package/dist/render/states-css.d.ts +32 -0
  352. package/dist/render/states-css.js +63 -0
  353. package/dist/render/states-css.js.map +1 -0
  354. package/dist/render/surface-data-context.d.ts +18 -0
  355. package/dist/render/surface-data-context.js +21 -0
  356. package/dist/render/surface-data-context.js.map +1 -0
  357. package/dist/render/surface-event-bus.d.ts +19 -0
  358. package/dist/render/surface-event-bus.js +68 -0
  359. package/dist/render/surface-event-bus.js.map +1 -0
  360. package/dist/render/surface-event-context.d.ts +11 -0
  361. package/dist/render/surface-event-context.js +12 -0
  362. package/dist/render/surface-event-context.js.map +1 -0
  363. package/dist/render/surface-id-context.d.ts +8 -0
  364. package/dist/render/surface-id-context.js +9 -0
  365. package/dist/render/surface-id-context.js.map +1 -0
  366. package/dist/render/theme-utils.d.ts +14 -0
  367. package/dist/render/theme-utils.js +15 -0
  368. package/dist/render/theme-utils.js.map +1 -0
  369. package/dist/render/types.d.ts +282 -0
  370. package/dist/render/types.js +9 -0
  371. package/dist/render/types.js.map +1 -0
  372. package/dist/render/visibility-css.d.ts +42 -0
  373. package/dist/render/visibility-css.js +119 -0
  374. package/dist/render/visibility-css.js.map +1 -0
  375. package/dist/render/width-scope.d.ts +34 -0
  376. package/dist/render/width-scope.js +44 -0
  377. package/dist/render/width-scope.js.map +1 -0
  378. package/dist/render/write-only-sources.d.ts +33 -0
  379. package/dist/render/write-only-sources.js +99 -0
  380. package/dist/render/write-only-sources.js.map +1 -0
  381. package/dist/routing/index.d.ts +14 -0
  382. package/dist/routing/index.js +15 -0
  383. package/dist/routing/index.js.map +1 -0
  384. package/dist/routing/router.d.ts +42 -0
  385. package/dist/routing/router.js +218 -0
  386. package/dist/routing/router.js.map +1 -0
  387. package/dist/routing/types.d.ts +124 -0
  388. package/dist/routing/types.js +9 -0
  389. package/dist/routing/types.js.map +1 -0
  390. package/dist/seo/generator.d.ts +39 -0
  391. package/dist/seo/generator.js +236 -0
  392. package/dist/seo/generator.js.map +1 -0
  393. package/dist/seo/index.d.ts +14 -0
  394. package/dist/seo/index.js +15 -0
  395. package/dist/seo/index.js.map +1 -0
  396. package/dist/seo/types.d.ts +181 -0
  397. package/dist/seo/types.js +9 -0
  398. package/dist/seo/types.js.map +1 -0
  399. package/dist/state/index.d.ts +15 -0
  400. package/dist/state/index.js +16 -0
  401. package/dist/state/index.js.map +1 -0
  402. package/dist/state/manager.d.ts +33 -0
  403. package/dist/state/manager.js +81 -0
  404. package/dist/state/manager.js.map +1 -0
  405. package/dist/state/store.d.ts +40 -0
  406. package/dist/state/store.js +145 -0
  407. package/dist/state/store.js.map +1 -0
  408. package/dist/state/types.d.ts +107 -0
  409. package/dist/state/types.js +9 -0
  410. package/dist/state/types.js.map +1 -0
  411. package/dist/surface/expression.d.ts +65 -0
  412. package/dist/surface/expression.js +179 -0
  413. package/dist/surface/expression.js.map +1 -0
  414. package/dist/surface/index.d.ts +32 -0
  415. package/dist/surface/index.js +25 -0
  416. package/dist/surface/index.js.map +1 -0
  417. package/dist/surface/interpreter.d.ts +96 -0
  418. package/dist/surface/interpreter.js +231 -0
  419. package/dist/surface/interpreter.js.map +1 -0
  420. package/dist/surface/layout.d.ts +54 -0
  421. package/dist/surface/layout.js +288 -0
  422. package/dist/surface/layout.js.map +1 -0
  423. package/dist/surface/output.d.ts +90 -0
  424. package/dist/surface/output.js +104 -0
  425. package/dist/surface/output.js.map +1 -0
  426. package/dist/surface/primitives.d.ts +180 -0
  427. package/dist/surface/primitives.js +339 -0
  428. package/dist/surface/primitives.js.map +1 -0
  429. package/dist/surface/renderer.d.ts +96 -0
  430. package/dist/surface/renderer.js +190 -0
  431. package/dist/surface/renderer.js.map +1 -0
  432. package/dist/surface/schemas.d.ts +181 -0
  433. package/dist/surface/schemas.js +142 -0
  434. package/dist/surface/schemas.js.map +1 -0
  435. package/dist/surface/transforms.d.ts +144 -0
  436. package/dist/surface/transforms.js +120 -0
  437. package/dist/surface/transforms.js.map +1 -0
  438. package/dist/surface/types.d.ts +160 -0
  439. package/dist/surface/types.js +51 -0
  440. package/dist/surface/types.js.map +1 -0
  441. package/dist/surface/validation.d.ts +123 -0
  442. package/dist/surface/validation.js +147 -0
  443. package/dist/surface/validation.js.map +1 -0
  444. package/dist/validator.d.ts +55 -0
  445. package/dist/validator.js +100 -0
  446. package/dist/validator.js.map +1 -0
  447. package/package.json +106 -3
package/LICENSE ADDED
@@ -0,0 +1,90 @@
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: PhiMajor Solutions
6
+ Licensed Work: @pwfabric/runtime 1.0.0
7
+ The Licensed Work is (c) 2026 PhiMajor Solutions.
8
+ Additional Use Grant: You may make production use of the Licensed Work,
9
+ including building applications with it and hosting
10
+ those applications for yourself or for your own
11
+ customers, provided you do not offer the Licensed Work
12
+ to third parties as a hosted or managed service where
13
+ the service gives them substantially the functionality
14
+ of the Licensed Work.
15
+ Change Date: 2030-08-21
16
+ Change License: Apache License, Version 2.0
17
+
18
+ For information about alternative licensing arrangements for the Licensed
19
+ Work, please contact licensing@phimajor.com.
20
+
21
+ Notice
22
+
23
+ Business Source License 1.1
24
+
25
+ Terms
26
+
27
+ The Licensor hereby grants you the right to copy, modify, create derivative
28
+ works, redistribute, and make non-production use of the Licensed Work. The
29
+ Licensor may make an Additional Use Grant, above, permitting limited
30
+ production use.
31
+
32
+ Effective on the Change Date, or the fourth anniversary of the first publicly
33
+ available distribution of a specific version of the Licensed Work under this
34
+ License, whichever comes first, the Licensor hereby grants you rights under
35
+ the terms of the Change License, and the rights granted in the paragraph
36
+ above terminate.
37
+
38
+ If your use of the Licensed Work does not comply with the requirements
39
+ currently in effect as described in this License, you must purchase a
40
+ commercial license from the Licensor, its affiliated entities, or authorized
41
+ resellers, or you must refrain from using the Licensed Work.
42
+
43
+ All copies of the original and modified Licensed Work, and derivative works
44
+ of the Licensed Work, are subject to this License. This License applies
45
+ separately for each version of the Licensed Work and the Change Date may vary
46
+ for each version of the Licensed Work released by Licensor.
47
+
48
+ You must conspicuously display this License on each original or modified copy
49
+ of the Licensed Work. If you receive the Licensed Work in original or
50
+ modified form from a third party, the terms and conditions set forth in this
51
+ License apply to your use of that work.
52
+
53
+ Any use of the Licensed Work in violation of this License will automatically
54
+ terminate your rights under this License for the current and all other
55
+ versions of the Licensed Work.
56
+
57
+ This License does not grant you any right in any trademark or logo of
58
+ Licensor or its affiliates (provided that you may use a trademark or logo of
59
+ Licensor as expressly required by this License).
60
+
61
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
62
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
63
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
64
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
65
+ TITLE.
66
+
67
+ MariaDB hereby grants you permission to use this License's text to license
68
+ your works, and to refer to it using the trademark "Business Source License",
69
+ as long as you comply with the Covenants of Licensor below.
70
+
71
+ Covenants of Licensor
72
+
73
+ In consideration of the right to use this License's text and the "Business
74
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
75
+ other recipients of the licensed work to be provided by Licensor:
76
+
77
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
78
+ or a license that is compatible with GPL Version 2.0 or a later version,
79
+ where "compatible" means that software provided under the Change License
80
+ can be included in a program with software provided under GPL Version 2.0
81
+ or a later version. Licensor may specify additional Change Licenses
82
+ without limitation.
83
+
84
+ 2. To either: (a) specify an additional grant of rights to use that does not
85
+ impose any additional restriction on the right granted in this License, as
86
+ the Additional Use Grant; or (b) insert the text "None".
87
+
88
+ 3. To specify a Change Date.
89
+
90
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @pwfabric/runtime
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The engine that renders a surface: the React surface and block renderers, data binding,
4
+ forms, entities, connectors, routing, SEO, state and the capability kernel. It
5
+ re-exports `@pwfabric/contracts`.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @pwfabric/runtime@rc zod@3 react react-dom
11
+ ```
12
+
13
+ ESM only: import it from an ES module (`"type": "module"` or `.mjs`). Node 22+. Peers: `react` and `react-dom` 18 or 19; `next` 14–16 only if you use the
14
+ Next.js image adapter.
15
+
16
+ ## Main exports
17
+
18
+ | Export | What it is |
19
+ |--------|------------|
20
+ | everything from `@pwfabric/contracts` | Re-exported |
21
+ | `BlockSurfaceRenderer`, `DataBoundSurfaceRenderer`, `BlockRenderer`, `BlockErrorBoundary` | Render a surface and its blocks |
22
+ | `createFabric`, `FabricKernel`, `createRegistry`, `createEventBus` | The capability kernel |
23
+ | `useSurfaceEvents`, `useSurfaceId`, `useSurfaceConnections`, `useEntitlements` | Hooks for block components |
24
+ | binding, forms, entity, connector, routing, SEO, state and cache APIs | Re-exported from their modules |
25
+ | `DefaultImageAdapter`, `NextImageAdapter` | Image adapters |
26
+
27
+ ## Entry points
28
+
29
+ | Import | Contents |
30
+ |--------|----------|
31
+ | `@pwfabric/runtime` | Everything above |
32
+ | `@pwfabric/runtime/adapters` | Image adapters (`DefaultImageAdapter`, `NextImageAdapter`) |
33
+ | `@pwfabric/runtime/capability` | The platform capability catalogue and lookups |
34
+ | `@pwfabric/runtime/blocks` | Block registry, component types, composition rules |
35
+ | `@pwfabric/runtime/auth` | Auth providers (`createAuthProvider`, `ApiKeyAuthProvider`, `MsalAuthProvider`) |
36
+ | `@pwfabric/runtime/data` | `DataService`, `createDataService` and the data capability provider |
37
+ | `@pwfabric/runtime/blocks/*` | One module of `blocks/`, e.g. `@pwfabric/runtime/blocks/hooks` |
38
+ | `@pwfabric/runtime/render/*` | One module of `render/`, e.g. `@pwfabric/runtime/render/renderer` |
39
+
40
+ ## Licence
41
+
42
+ Business Source License 1.1 — see `LICENSE`. Use it, change it, and host what you build with it, for yourself or your own customers; do not offer PWFabric itself as a service. Each version becomes Apache-2.0 on the Change Date in `LICENSE`. See [licensing](https://pwfabric.com/licence).
43
+
44
+ Part of [PWFabric](https://pwfabric.com) — the engine that renders an app. Source: [github.com/pwfabric/pwfabric](https://github.com/pwfabric/pwfabric).
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Screen Reader Live Region Announcer
3
+ *
4
+ * Manages ARIA live regions for dynamic screen reader announcements.
5
+ * Works in both browser and SSR environments (SSR is a safe no-op).
6
+ *
7
+ * @module @pwfabric/runtime/a11y/announcer
8
+ */
9
+ /** Politeness level for ARIA live region announcements */
10
+ export type AnnouncementLevel = 'polite' | 'assertive';
11
+ /** Configuration for a live region */
12
+ export interface LiveRegionConfig {
13
+ /** Politeness level of the announcement */
14
+ level: AnnouncementLevel;
15
+ /** Milliseconds before the announcement is cleared (default 5000) */
16
+ timeout?: number;
17
+ }
18
+ /**
19
+ * Manages ARIA live regions for screen reader announcements.
20
+ *
21
+ * Creates visually hidden DOM elements with `aria-live` attributes
22
+ * that screen readers monitor for content changes. Supports both
23
+ * `polite` (waits for idle) and `assertive` (interrupts) modes.
24
+ *
25
+ * In SSR environments, all operations are safe no-ops.
26
+ */
27
+ export declare class LiveRegionAnnouncer {
28
+ private regions;
29
+ constructor();
30
+ /**
31
+ * Create a live region DOM element for the given politeness level.
32
+ * In SSR environments this is a no-op.
33
+ *
34
+ * @param level - The ARIA live politeness level
35
+ */
36
+ createRegion(level: AnnouncementLevel): void;
37
+ /**
38
+ * Announce a message to screen readers via the specified live region.
39
+ *
40
+ * If the region has not been created yet, it will be created automatically.
41
+ * The message is cleared after the configured timeout (default 5000ms).
42
+ *
43
+ * @param message - The text to announce
44
+ * @param level - The politeness level (default 'polite')
45
+ * @param timeout - Milliseconds before clearing (default 5000)
46
+ */
47
+ announce(message: string, level?: AnnouncementLevel, timeout?: number): void;
48
+ /**
49
+ * Clear the announced message for a specific level or all levels.
50
+ *
51
+ * @param level - The level to clear, or undefined to clear all
52
+ */
53
+ clear(level?: AnnouncementLevel): void;
54
+ /**
55
+ * Remove all live region DOM elements and clear timers.
56
+ * Call this when the announcer is no longer needed.
57
+ */
58
+ dispose(): void;
59
+ }
60
+ /**
61
+ * Create a new LiveRegionAnnouncer instance.
62
+ *
63
+ * @returns A new LiveRegionAnnouncer
64
+ */
65
+ export declare function createAnnouncer(): LiveRegionAnnouncer;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Screen Reader Live Region Announcer
3
+ *
4
+ * Manages ARIA live regions for dynamic screen reader announcements.
5
+ * Works in both browser and SSR environments (SSR is a safe no-op).
6
+ *
7
+ * @module @pwfabric/runtime/a11y/announcer
8
+ */
9
+ // ============================================================
10
+ // CONSTANTS
11
+ // ============================================================
12
+ const DEFAULT_TIMEOUT = 5000;
13
+ const LIVE_REGION_STYLES = 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;';
14
+ // ============================================================
15
+ // LIVE REGION ANNOUNCER
16
+ // ============================================================
17
+ /**
18
+ * Manages ARIA live regions for screen reader announcements.
19
+ *
20
+ * Creates visually hidden DOM elements with `aria-live` attributes
21
+ * that screen readers monitor for content changes. Supports both
22
+ * `polite` (waits for idle) and `assertive` (interrupts) modes.
23
+ *
24
+ * In SSR environments, all operations are safe no-ops.
25
+ */
26
+ export class LiveRegionAnnouncer {
27
+ regions;
28
+ constructor() {
29
+ this.regions = new Map();
30
+ }
31
+ /**
32
+ * Create a live region DOM element for the given politeness level.
33
+ * In SSR environments this is a no-op.
34
+ *
35
+ * @param level - The ARIA live politeness level
36
+ */
37
+ createRegion(level) {
38
+ if (typeof document === 'undefined')
39
+ return;
40
+ if (this.regions.has(level))
41
+ return;
42
+ const element = document.createElement('div');
43
+ element.setAttribute('aria-live', level);
44
+ element.setAttribute('aria-atomic', 'true');
45
+ element.setAttribute('role', 'status');
46
+ element.setAttribute('style', LIVE_REGION_STYLES);
47
+ element.setAttribute('data-pw-a11y-announcer', level);
48
+ document.body.appendChild(element);
49
+ this.regions.set(level, { element });
50
+ }
51
+ /**
52
+ * Announce a message to screen readers via the specified live region.
53
+ *
54
+ * If the region has not been created yet, it will be created automatically.
55
+ * The message is cleared after the configured timeout (default 5000ms).
56
+ *
57
+ * @param message - The text to announce
58
+ * @param level - The politeness level (default 'polite')
59
+ * @param timeout - Milliseconds before clearing (default 5000)
60
+ */
61
+ announce(message, level = 'polite', timeout = DEFAULT_TIMEOUT) {
62
+ if (typeof document === 'undefined')
63
+ return;
64
+ if (!this.regions.has(level)) {
65
+ this.createRegion(level);
66
+ }
67
+ const region = this.regions.get(level);
68
+ if (!region?.element)
69
+ return;
70
+ // Clear any pending timer
71
+ if (region.timer !== undefined) {
72
+ clearTimeout(region.timer);
73
+ }
74
+ // Clear and re-set to force screen reader re-announcement
75
+ region.element.textContent = '';
76
+ // Use a microtask to ensure the empty state is processed before the new content
77
+ requestAnimationFrame(() => {
78
+ if (region.element) {
79
+ region.element.textContent = message;
80
+ }
81
+ });
82
+ // Auto-clear after timeout
83
+ region.timer = setTimeout(() => {
84
+ this.clear(level);
85
+ }, timeout);
86
+ }
87
+ /**
88
+ * Clear the announced message for a specific level or all levels.
89
+ *
90
+ * @param level - The level to clear, or undefined to clear all
91
+ */
92
+ clear(level) {
93
+ if (typeof document === 'undefined')
94
+ return;
95
+ if (level !== undefined) {
96
+ const region = this.regions.get(level);
97
+ if (region) {
98
+ if (region.timer !== undefined) {
99
+ clearTimeout(region.timer);
100
+ region.timer = undefined;
101
+ }
102
+ if (region.element) {
103
+ region.element.textContent = '';
104
+ }
105
+ }
106
+ }
107
+ else {
108
+ for (const regionLevel of this.regions.keys()) {
109
+ this.clear(regionLevel);
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * Remove all live region DOM elements and clear timers.
115
+ * Call this when the announcer is no longer needed.
116
+ */
117
+ dispose() {
118
+ for (const [, region] of this.regions) {
119
+ if (region.timer !== undefined) {
120
+ clearTimeout(region.timer);
121
+ }
122
+ if (region.element && typeof document !== 'undefined') {
123
+ region.element.remove();
124
+ }
125
+ }
126
+ this.regions.clear();
127
+ }
128
+ }
129
+ // ============================================================
130
+ // FACTORY FUNCTION
131
+ // ============================================================
132
+ /**
133
+ * Create a new LiveRegionAnnouncer instance.
134
+ *
135
+ * @returns A new LiveRegionAnnouncer
136
+ */
137
+ export function createAnnouncer() {
138
+ return new LiveRegionAnnouncer();
139
+ }
140
+ //# sourceMappingURL=announcer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcer.js","sourceRoot":"","sources":["../../src/a11y/announcer.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAE/D,MAAM,eAAe,GAAG,IAAI,CAAA;AAC5B,MAAM,kBAAkB,GACtB,8HAA8H,CAAA;AAWhI,+DAA+D;AAC/D,wBAAwB;AACxB,+DAA+D;AAE/D;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IACtB,OAAO,CAAyC;IAExD;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAA;IAC1B,CAAC;IAED;;;;;OAKG;IACH,YAAY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K,SAAS,EAAE,CAAC;gBAC/B,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAC5B,CAAC;YACD,IAAI,MAAM,CAAC,OAAO,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;gBACtD,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAA;YACzB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;CACF;AAED,+DAA+D;AAC/D,mBAAmB;AACnB,+DAA+D;AAE/D;;;;GAIG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,mBAAmB,EAAE,CAAA;AAClC,CAAC","sourcesContent":["/**\n * Screen Reader Live Region Announcer\n *\n * Manages ARIA live regions for dynamic screen reader announcements.\n * Works in both browser and SSR environments (SSR is a safe no-op).\n *\n * @module @pwfabric/runtime/a11y/announcer\n */\n\n// ============================================================\n// TYPES\n// ============================================================\n\n/** Politeness level for ARIA live region announcements */\nexport type AnnouncementLevel = 'polite' | 'assertive'\n\n/** Configuration for a live region */\nexport interface LiveRegionConfig {\n /** Politeness level of the announcement */\n level: AnnouncementLevel\n /** Milliseconds before the announcement is cleared (default 5000) */\n timeout?: number\n}\n\n// ============================================================\n// CONSTANTS\n// ============================================================\n\nconst DEFAULT_TIMEOUT = 5000\nconst LIVE_REGION_STYLES =\n 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;'\n\n// ============================================================\n// LIVE REGION STATE\n// ============================================================\n\ninterface LiveRegionState {\n element: HTMLElement | null\n timer?: ReturnType<typeof setTimeout> | undefined\n}\n\n// ============================================================\n// LIVE REGION ANNOUNCER\n// ============================================================\n\n/**\n * Manages ARIA live regions for screen reader announcements.\n *\n * Creates visually hidden DOM elements with `aria-live` attributes\n * that screen readers monitor for content changes. Supports both\n * `polite` (waits for idle) and `assertive` (interrupts) modes.\n *\n * In SSR environments, all operations are safe no-ops.\n */\nexport class LiveRegionAnnouncer {\n private regions: Map<AnnouncementLevel, LiveRegionState>\n\n constructor() {\n this.regions = new Map()\n }\n\n /**\n * Create a live region DOM element for the given politeness level.\n * In SSR environments this is a no-op.\n *\n * @param level - The ARIA live politeness level\n */\n createRegion(level: AnnouncementLevel): void {\n if (typeof document === 'undefined') return\n if (this.regions.has(level)) return\n\n const element = document.createElement('div')\n element.setAttribute('aria-live', level)\n element.setAttribute('aria-atomic', 'true')\n element.setAttribute('role', 'status')\n element.setAttribute('style', LIVE_REGION_STYLES)\n element.setAttribute('data-pw-a11y-announcer', level)\n\n document.body.appendChild(element)\n\n this.regions.set(level, { element })\n }\n\n /**\n * Announce a message to screen readers via the specified live region.\n *\n * If the region has not been created yet, it will be created automatically.\n * The message is cleared after the configured timeout (default 5000ms).\n *\n * @param message - The text to announce\n * @param level - The politeness level (default 'polite')\n * @param timeout - Milliseconds before clearing (default 5000)\n */\n announce(\n message: string,\n level: AnnouncementLevel = 'polite',\n timeout: number = DEFAULT_TIMEOUT\n ): void {\n if (typeof document === 'undefined') return\n\n if (!this.regions.has(level)) {\n this.createRegion(level)\n }\n\n const region = this.regions.get(level)\n if (!region?.element) return\n\n // Clear any pending timer\n if (region.timer !== undefined) {\n clearTimeout(region.timer)\n }\n\n // Clear and re-set to force screen reader re-announcement\n region.element.textContent = ''\n\n // Use a microtask to ensure the empty state is processed before the new content\n requestAnimationFrame(() => {\n if (region.element) {\n region.element.textContent = message\n }\n })\n\n // Auto-clear after timeout\n region.timer = setTimeout(() => {\n this.clear(level)\n }, timeout)\n }\n\n /**\n * Clear the announced message for a specific level or all levels.\n *\n * @param level - The level to clear, or undefined to clear all\n */\n clear(level?: AnnouncementLevel): void {\n if (typeof document === 'undefined') return\n\n if (level !== undefined) {\n const region = this.regions.get(level)\n if (region) {\n if (region.timer !== undefined) {\n clearTimeout(region.timer)\n region.timer = undefined\n }\n if (region.element) {\n region.element.textContent = ''\n }\n }\n } else {\n for (const regionLevel of this.regions.keys()) {\n this.clear(regionLevel)\n }\n }\n }\n\n /**\n * Remove all live region DOM elements and clear timers.\n * Call this when the announcer is no longer needed.\n */\n dispose(): void {\n for (const [, region] of this.regions) {\n if (region.timer !== undefined) {\n clearTimeout(region.timer)\n }\n if (region.element && typeof document !== 'undefined') {\n region.element.remove()\n }\n }\n this.regions.clear()\n }\n}\n\n// ============================================================\n// FACTORY FUNCTION\n// ============================================================\n\n/**\n * Create a new LiveRegionAnnouncer instance.\n *\n * @returns A new LiveRegionAnnouncer\n */\nexport function createAnnouncer(): LiveRegionAnnouncer {\n return new LiveRegionAnnouncer()\n}\n"]}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * WCAG Color Contrast Checking
3
+ *
4
+ * Implements the WCAG 2.0 contrast ratio algorithm for verifying
5
+ * text and UI component color accessibility. Supports AA and AAA
6
+ * conformance levels for both normal and large text.
7
+ *
8
+ * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef
9
+ * @module @pwfabric/runtime/a11y/contrast
10
+ */
11
+ /** Result of a WCAG contrast check */
12
+ export interface ContrastResult {
13
+ /** The calculated contrast ratio (e.g. 4.5) */
14
+ ratio: number;
15
+ /** Meets WCAG AA for normal text (>= 4.5:1) */
16
+ meetsAA: boolean;
17
+ /** Meets WCAG AAA for normal text (>= 7:1) */
18
+ meetsAAA: boolean;
19
+ /** Meets WCAG AA for large text (>= 3:1) */
20
+ meetsAALarge: boolean;
21
+ /** Meets WCAG AAA for large text (>= 4.5:1) */
22
+ meetsAAALarge: boolean;
23
+ }
24
+ import { hexToRgb, relativeLuminance } from '@pwfabric/contracts';
25
+ export { hexToRgb, relativeLuminance };
26
+ /**
27
+ * Calculate the contrast ratio between two hex colors.
28
+ *
29
+ * The ratio is always >= 1, with 1 meaning identical colors
30
+ * and 21 being the maximum (black vs white).
31
+ *
32
+ * @param color1 - First hex color string
33
+ * @param color2 - Second hex color string
34
+ * @returns Contrast ratio, or 0 if either color is invalid
35
+ */
36
+ export declare function contrastRatio(color1: string, color2: string): number;
37
+ /**
38
+ * Check a foreground/background color pair against all WCAG contrast levels.
39
+ *
40
+ * @param foreground - Foreground (text) hex color
41
+ * @param background - Background hex color
42
+ * @returns ContrastResult with ratio and pass/fail for each WCAG level
43
+ */
44
+ export declare function checkContrast(foreground: string, background: string): ContrastResult;
45
+ /**
46
+ * Quick check whether a color pair meets a specific WCAG conformance level.
47
+ *
48
+ * @param foreground - Foreground (text) hex color
49
+ * @param background - Background hex color
50
+ * @param level - WCAG conformance level ('AA' or 'AAA')
51
+ * @param large - Whether the text is "large" (>= 18pt or >= 14pt bold) (default false)
52
+ * @returns `true` if the contrast ratio meets the specified level
53
+ */
54
+ export declare function meetsWCAG(foreground: string, background: string, level: 'AA' | 'AAA', large?: boolean): boolean;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * WCAG Color Contrast Checking
3
+ *
4
+ * Implements the WCAG 2.0 contrast ratio algorithm for verifying
5
+ * text and UI component color accessibility. Supports AA and AAA
6
+ * conformance levels for both normal and large text.
7
+ *
8
+ * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef
9
+ * @module @pwfabric/runtime/a11y/contrast
10
+ */
11
+ // ============================================================
12
+ // CONSTANTS
13
+ // ============================================================
14
+ /** WCAG 2.0 contrast ratio thresholds */
15
+ const THRESHOLDS = {
16
+ AA_NORMAL: 4.5,
17
+ AAA_NORMAL: 7,
18
+ AA_LARGE: 3,
19
+ AAA_LARGE: 4.5,
20
+ };
21
+ // ============================================================
22
+ // COLOR PRIMITIVES
23
+ // ============================================================
24
+ // `hexToRgb` / `relativeLuminance` MOVED to
25
+ // `@pwfabric/contracts` (`fabric/appearance-cascade`) in the
26
+ // the appearance cascade derives on-card ink from luminance
27
+ // and the dark variant from HSL, and it now lives in `contracts` so runtime,
28
+ // the exporter and the composer share ONE implementation. Re-exported here so the a11y
29
+ // module keeps its full public surface and existing imports keep working.
30
+ import { hexToRgb, relativeLuminance } from '@pwfabric/contracts';
31
+ export { hexToRgb, relativeLuminance };
32
+ // ============================================================
33
+ // CONTRAST RATIO
34
+ // ============================================================
35
+ /**
36
+ * Calculate the contrast ratio between two hex colors.
37
+ *
38
+ * The ratio is always >= 1, with 1 meaning identical colors
39
+ * and 21 being the maximum (black vs white).
40
+ *
41
+ * @param color1 - First hex color string
42
+ * @param color2 - Second hex color string
43
+ * @returns Contrast ratio, or 0 if either color is invalid
44
+ */
45
+ export function contrastRatio(color1, color2) {
46
+ const rgb1 = hexToRgb(color1);
47
+ const rgb2 = hexToRgb(color2);
48
+ if (!rgb1 || !rgb2)
49
+ return 0;
50
+ const lum1 = relativeLuminance(rgb1.r, rgb1.g, rgb1.b);
51
+ const lum2 = relativeLuminance(rgb2.r, rgb2.g, rgb2.b);
52
+ const lighter = Math.max(lum1, lum2);
53
+ const darker = Math.min(lum1, lum2);
54
+ return (lighter + 0.05) / (darker + 0.05);
55
+ }
56
+ // ============================================================
57
+ // WCAG CHECKS
58
+ // ============================================================
59
+ /**
60
+ * Check a foreground/background color pair against all WCAG contrast levels.
61
+ *
62
+ * @param foreground - Foreground (text) hex color
63
+ * @param background - Background hex color
64
+ * @returns ContrastResult with ratio and pass/fail for each WCAG level
65
+ */
66
+ export function checkContrast(foreground, background) {
67
+ const ratio = contrastRatio(foreground, background);
68
+ return {
69
+ ratio,
70
+ meetsAA: ratio >= THRESHOLDS.AA_NORMAL,
71
+ meetsAAA: ratio >= THRESHOLDS.AAA_NORMAL,
72
+ meetsAALarge: ratio >= THRESHOLDS.AA_LARGE,
73
+ meetsAAALarge: ratio >= THRESHOLDS.AAA_LARGE,
74
+ };
75
+ }
76
+ /**
77
+ * Quick check whether a color pair meets a specific WCAG conformance level.
78
+ *
79
+ * @param foreground - Foreground (text) hex color
80
+ * @param background - Background hex color
81
+ * @param level - WCAG conformance level ('AA' or 'AAA')
82
+ * @param large - Whether the text is "large" (>= 18pt or >= 14pt bold) (default false)
83
+ * @returns `true` if the contrast ratio meets the specified level
84
+ */
85
+ export function meetsWCAG(foreground, background, level, large = false) {
86
+ const ratio = contrastRatio(foreground, background);
87
+ if (level === 'AA') {
88
+ return large ? ratio >= THRESHOLDS.AA_LARGE : ratio >= THRESHOLDS.AA_NORMAL;
89
+ }
90
+ // AAA
91
+ return large ? ratio >= THRESHOLDS.AAA_LARGE : ratio >= THRESHOLDS.AAA_NORMAL;
92
+ }
93
+ //# sourceMappingURL=contrast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrast.js","sourceRoot":"","sources":["../../src/a11y/contrast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoBH,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAE/D,yCAAyC;AACzC,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE,GAAG;IACd,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,GAAG;CACN,CAAA;AAEV,+DAA+D;AAC/D,mBAAmB;AACnB,+DAA+D;AAE/D,4CAA4C;AAC5C,6DAA6D;AAC7D,4DAA4D;AAC5D,6EAA6E;AAC7E,uFAAuF;AACvF,0EAA0E;AAC1E,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEjE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAA;AAEtC,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,MAAc;IAC1D,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;IAC7B,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAA;IAE7B,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI;QAAE,OAAO,CAAC,CAAA;IAE5B,MAAM,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACtD,MAAM,IAAI,GAAG,iBA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AAU,CAAA;AAC/E,CAAC","sourcesContent":["/**\n * WCAG Color Contrast Checking\n *\n * Implements the WCAG 2.0 contrast ratio algorithm for verifying\n * text and UI component color accessibility. Supports AA and AAA\n * conformance levels for both normal and large text.\n *\n * @see https://www.w3.org/TR/WCAG20/#contrast-ratiodef\n * @module @pwfabric/runtime/a11y/contrast\n */\n\n// ============================================================\n// TYPES\n// ============================================================\n\n/** Result of a WCAG contrast check */\nexport interface ContrastResult {\n /** The calculated contrast ratio (e.g. 4.5) */\n ratio: number\n /** Meets WCAG AA for normal text (>= 4.5:1) */\n meetsAA: boolean\n /** Meets WCAG AAA for normal text (>= 7:1) */\n meetsAAA: boolean\n /** Meets WCAG AA for large text (>= 3:1) */\n meetsAALarge: boolean\n /** Meets WCAG AAA for large text (>= 4.5:1) */\n meetsAAALarge: boolean\n}\n\n// ============================================================\n// CONSTANTS\n// ============================================================\n\n/** WCAG 2.0 contrast ratio thresholds */\nconst THRESHOLDS = {\n AA_NORMAL: 4.5,\n AAA_NORMAL: 7,\n AA_LARGE: 3,\n AAA_LARGE: 4.5,\n} as const\n\n// ============================================================\n// COLOR PRIMITIVES\n// ============================================================\n\n// `hexToRgb` / `relativeLuminance` MOVED to\n// `@pwfabric/contracts` (`fabric/appearance-cascade`) in the\n// the appearance cascade derives on-card ink from luminance\n// and the dark variant from HSL, and it now lives in `contracts` so runtime,\n// the exporter and the composer share ONE implementation. Re-exported here so the a11y\n// module keeps its full public surface and existing imports keep working.\nimport { hexToRgb, relativeLuminance } from '@pwfabric/contracts'\n\nexport { hexToRgb, relativeLuminance }\n\n// ============================================================\n// CONTRAST RATIO\n// ============================================================\n\n/**\n * Calculate the contrast ratio between two hex colors.\n *\n * The ratio is always >= 1, with 1 meaning identical colors\n * and 21 being the maximum (black vs white).\n *\n * @param color1 - First hex color string\n * @param color2 - Second hex color string\n * @returns Contrast ratio, or 0 if either color is invalid\n */\nexport function contrastRatio(color1: string, color2: string): number {\n const rgb1 = hexToRgb(color1)\n const rgb2 = hexToRgb(color2)\n\n if (!rgb1 || !rgb2) return 0\n\n const lum1 = relativeLuminance(rgb1.r, rgb1.g, rgb1.b)\n const lum2 = relativeLuminance(rgb2.r, rgb2.g, rgb2.b)\n\n const lighter = Math.max(lum1, lum2)\n const darker = Math.min(lum1, lum2)\n\n return (lighter + 0.05) / (darker + 0.05)\n}\n\n// ============================================================\n// WCAG CHECKS\n// ============================================================\n\n/**\n * Check a foreground/background color pair against all WCAG contrast levels.\n *\n * @param foreground - Foreground (text) hex color\n * @param background - Background hex color\n * @returns ContrastResult with ratio and pass/fail for each WCAG level\n */\nexport function checkContrast(foreground: string, background: string): ContrastResult {\n const ratio = contrastRatio(foreground, background)\n\n return {\n ratio,\n meetsAA: ratio >= THRESHOLDS.AA_NORMAL,\n meetsAAA: ratio >= THRESHOLDS.AAA_NORMAL,\n meetsAALarge: ratio >= THRESHOLDS.AA_LARGE,\n meetsAAALarge: ratio >= THRESHOLDS.AAA_LARGE,\n }\n}\n\n/**\n * Quick check whether a color pair meets a specific WCAG conformance level.\n *\n * @param foreground - Foreground (text) hex color\n * @param background - Background hex color\n * @param level - WCAG conformance level ('AA' or 'AAA')\n * @param large - Whether the text is \"large\" (>= 18pt or >= 14pt bold) (default false)\n * @returns `true` if the contrast ratio meets the specified level\n */\nexport function meetsWCAG(\n foreground: string,\n background: string,\n level: 'AA' | 'AAA',\n large = false\n): boolean {\n const ratio = contrastRatio(foreground, background)\n\n if (level === 'AA') {\n return large ? ratio >= THRESHOLDS.AA_LARGE : ratio >= THRESHOLDS.AA_NORMAL\n }\n\n // AAA\n return large ? ratio >= THRESHOLDS.AAA_LARGE : ratio >= THRESHOLDS.AAA_NORMAL\n}\n"]}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Focus Management Utilities
3
+ *
4
+ * Provides focus trapping, focus restoration, and skip-link helpers
5
+ * for accessible modal dialogs, drawers, and navigation patterns.
6
+ * All DOM operations are SSR-safe.
7
+ *
8
+ * @module @pwfabric/runtime/a11y/focus
9
+ */
10
+ /** Configuration for a focus trap */
11
+ export interface FocusTrapConfig {
12
+ /** The container element to trap focus within */
13
+ container: HTMLElement | null;
14
+ /** Initial element to focus, or a CSS selector to find it */
15
+ initialFocus?: HTMLElement | string;
16
+ /** Whether to return focus to the previously focused element on deactivate (default true) */
17
+ returnFocus?: boolean;
18
+ /** Whether pressing Escape deactivates the trap (default true) */
19
+ escapeDeactivates?: boolean;
20
+ }
21
+ /**
22
+ * Manages focus trapping within a container element.
23
+ *
24
+ * When activated, Tab and Shift+Tab keypresses are intercepted to
25
+ * keep focus cycling within the container's focusable elements.
26
+ * Optionally deactivates on Escape key press.
27
+ *
28
+ * Used for modal dialogs, slide-over panels, and other overlay patterns
29
+ * that require focus to remain within the component for accessibility.
30
+ */
31
+ export declare class FocusTrapManager {
32
+ private active;
33
+ private config;
34
+ private previousFocus;
35
+ private readonly boundHandleKeyDown;
36
+ constructor();
37
+ /**
38
+ * Activate the focus trap with the given configuration.
39
+ *
40
+ * Saves the currently focused element, attaches a keydown listener,
41
+ * and moves focus to the initial focus target (if specified) or the
42
+ * first focusable element in the container.
43
+ *
44
+ * @param config - Focus trap configuration
45
+ */
46
+ activate(config: FocusTrapConfig): void;
47
+ /**
48
+ * Deactivate the focus trap and optionally return focus to the
49
+ * previously focused element.
50
+ */
51
+ deactivate(): void;
52
+ /**
53
+ * Check whether the focus trap is currently active.
54
+ *
55
+ * @returns `true` if the trap is active
56
+ */
57
+ isActive(): boolean;
58
+ /**
59
+ * Dispose of the focus trap, deactivating it and cleaning up resources.
60
+ */
61
+ dispose(): void;
62
+ /**
63
+ * Resolve the initial focus target from the config.
64
+ * Handles both HTMLElement references and CSS selector strings.
65
+ */
66
+ private resolveInitialFocus;
67
+ /**
68
+ * Get all focusable elements within the trap container, sorted in DOM order.
69
+ *
70
+ * @returns Array of focusable HTMLElements
71
+ */
72
+ private getFocusableElements;
73
+ /**
74
+ * Handle keydown events to trap Tab focus and optionally deactivate on Escape.
75
+ */
76
+ private handleKeyDown;
77
+ }
78
+ /**
79
+ * Manages a stack of focus positions for nested focus contexts.
80
+ *
81
+ * Useful when opening nested dialogs or panels where each level
82
+ * needs to save and restore the previous focus target.
83
+ */
84
+ export declare class FocusRestorer {
85
+ private stack;
86
+ constructor();
87
+ /**
88
+ * Save the currently focused element onto the stack.
89
+ */
90
+ save(): void;
91
+ /**
92
+ * Pop the most recently saved element from the stack and restore focus to it.
93
+ */
94
+ restore(): void;
95
+ }
96
+ /**
97
+ * Create a skip-to-content link configuration.
98
+ *
99
+ * Returns the href, label, and click handler for a skip link that
100
+ * jumps focus to the element with the specified ID. The target element
101
+ * is given a `tabindex` of `-1` if it does not already have one so
102
+ * it can receive programmatic focus.
103
+ *
104
+ * @param targetId - The ID of the element to skip to
105
+ * @returns Skip link configuration object
106
+ */
107
+ export declare function createSkipLink(targetId: string): {
108
+ href: string;
109
+ label: string;
110
+ handleClick: (e: Event) => void;
111
+ };
112
+ /**
113
+ * Create a new FocusTrapManager instance.
114
+ *
115
+ * @returns A new FocusTrapManager
116
+ */
117
+ export declare function createFocusTrap(): FocusTrapManager;
118
+ /**
119
+ * Create a new FocusRestorer instance.
120
+ *
121
+ * @returns A new FocusRestorer
122
+ */
123
+ export declare function createFocusRestorer(): FocusRestorer;