@pwfabric/runtime 0.0.0-stage → 1.0.0-rc.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 (603) hide show
  1. package/LICENSE +90 -0
  2. package/README.md +13 -2
  3. package/dist/__tests__/dom-test-setup.d.ts +21 -0
  4. package/dist/__tests__/dom-test-setup.d.ts.map +1 -0
  5. package/dist/__tests__/dom-test-setup.js +36 -0
  6. package/dist/__tests__/dom-test-setup.js.map +1 -0
  7. package/dist/a11y/announcer.d.ts +66 -0
  8. package/dist/a11y/announcer.d.ts.map +1 -0
  9. package/dist/a11y/announcer.js +140 -0
  10. package/dist/a11y/announcer.js.map +1 -0
  11. package/dist/a11y/contrast.d.ts +55 -0
  12. package/dist/a11y/contrast.d.ts.map +1 -0
  13. package/dist/a11y/contrast.js +93 -0
  14. package/dist/a11y/contrast.js.map +1 -0
  15. package/dist/a11y/focus.d.ts +124 -0
  16. package/dist/a11y/focus.d.ts.map +1 -0
  17. package/dist/a11y/focus.js +282 -0
  18. package/dist/a11y/focus.js.map +1 -0
  19. package/dist/a11y/index.d.ts +22 -0
  20. package/dist/a11y/index.d.ts.map +1 -0
  21. package/dist/a11y/index.js +18 -0
  22. package/dist/a11y/index.js.map +1 -0
  23. package/dist/a11y/keyboard.d.ts +145 -0
  24. package/dist/a11y/keyboard.d.ts.map +1 -0
  25. package/dist/a11y/keyboard.js +317 -0
  26. package/dist/a11y/keyboard.js.map +1 -0
  27. package/dist/adapters/default-image.d.ts +26 -0
  28. package/dist/adapters/default-image.d.ts.map +1 -0
  29. package/dist/adapters/default-image.js +37 -0
  30. package/dist/adapters/default-image.js.map +1 -0
  31. package/dist/adapters/index.d.ts +28 -0
  32. package/dist/adapters/index.d.ts.map +1 -0
  33. package/dist/adapters/index.js +28 -0
  34. package/dist/adapters/index.js.map +1 -0
  35. package/dist/adapters/next-image.d.ts +39 -0
  36. package/dist/adapters/next-image.d.ts.map +1 -0
  37. package/dist/adapters/next-image.js +124 -0
  38. package/dist/adapters/next-image.js.map +1 -0
  39. package/dist/adapters/types.d.ts +62 -0
  40. package/dist/adapters/types.d.ts.map +1 -0
  41. package/dist/adapters/types.js +11 -0
  42. package/dist/adapters/types.js.map +1 -0
  43. package/dist/analytics/index.d.ts +15 -0
  44. package/dist/analytics/index.d.ts.map +1 -0
  45. package/dist/analytics/index.js +15 -0
  46. package/dist/analytics/index.js.map +1 -0
  47. package/dist/analytics/tracker.d.ts +66 -0
  48. package/dist/analytics/tracker.d.ts.map +1 -0
  49. package/dist/analytics/tracker.js +251 -0
  50. package/dist/analytics/tracker.js.map +1 -0
  51. package/dist/analytics/types.d.ts +131 -0
  52. package/dist/analytics/types.d.ts.map +1 -0
  53. package/dist/analytics/types.js +11 -0
  54. package/dist/analytics/types.js.map +1 -0
  55. package/dist/auth/index.d.ts +16 -0
  56. package/dist/auth/index.d.ts.map +1 -0
  57. package/dist/auth/index.js +14 -0
  58. package/dist/auth/index.js.map +1 -0
  59. package/dist/auth/provider.d.ts +133 -0
  60. package/dist/auth/provider.d.ts.map +1 -0
  61. package/dist/auth/provider.js +473 -0
  62. package/dist/auth/provider.js.map +1 -0
  63. package/dist/auth/types.d.ts +118 -0
  64. package/dist/auth/types.d.ts.map +1 -0
  65. package/dist/auth/types.js +9 -0
  66. package/dist/auth/types.js.map +1 -0
  67. package/dist/binding/collection.d.ts +191 -0
  68. package/dist/binding/collection.d.ts.map +1 -0
  69. package/dist/binding/collection.js +358 -0
  70. package/dist/binding/collection.js.map +1 -0
  71. package/dist/binding/datasource.d.ts +320 -0
  72. package/dist/binding/datasource.d.ts.map +1 -0
  73. package/dist/binding/datasource.js +556 -0
  74. package/dist/binding/datasource.js.map +1 -0
  75. package/dist/binding/engine.d.ts +66 -0
  76. package/dist/binding/engine.d.ts.map +1 -0
  77. package/dist/binding/engine.js +268 -0
  78. package/dist/binding/engine.js.map +1 -0
  79. package/dist/binding/expression.d.ts +151 -0
  80. package/dist/binding/expression.d.ts.map +1 -0
  81. package/dist/binding/expression.js +787 -0
  82. package/dist/binding/expression.js.map +1 -0
  83. package/dist/binding/index.d.ts +20 -0
  84. package/dist/binding/index.d.ts.map +1 -0
  85. package/dist/binding/index.js +14 -0
  86. package/dist/binding/index.js.map +1 -0
  87. package/dist/binding/two-way.d.ts +150 -0
  88. package/dist/binding/two-way.d.ts.map +1 -0
  89. package/dist/binding/two-way.js +462 -0
  90. package/dist/binding/two-way.js.map +1 -0
  91. package/dist/binding/types.d.ts +120 -0
  92. package/dist/binding/types.d.ts.map +1 -0
  93. package/dist/binding/types.js +9 -0
  94. package/dist/binding/types.js.map +1 -0
  95. package/dist/blocks/__test-fixtures__/block-fixtures.d.ts +40 -0
  96. package/dist/blocks/__test-fixtures__/block-fixtures.d.ts.map +1 -0
  97. package/dist/blocks/__test-fixtures__/block-fixtures.js +506 -0
  98. package/dist/blocks/__test-fixtures__/block-fixtures.js.map +1 -0
  99. package/dist/blocks/component-types.d.ts +82 -0
  100. package/dist/blocks/component-types.d.ts.map +1 -0
  101. package/dist/blocks/component-types.js +11 -0
  102. package/dist/blocks/component-types.js.map +1 -0
  103. package/dist/blocks/composition-rules.d.ts +169 -0
  104. package/dist/blocks/composition-rules.d.ts.map +1 -0
  105. package/dist/blocks/composition-rules.js +391 -0
  106. package/dist/blocks/composition-rules.js.map +1 -0
  107. package/dist/blocks/hooks.d.ts +32 -0
  108. package/dist/blocks/hooks.d.ts.map +1 -0
  109. package/dist/blocks/hooks.js +42 -0
  110. package/dist/blocks/hooks.js.map +1 -0
  111. package/dist/blocks/index.d.ts +16 -0
  112. package/dist/blocks/index.d.ts.map +1 -0
  113. package/dist/blocks/index.js +24 -0
  114. package/dist/blocks/index.js.map +1 -0
  115. package/dist/blocks/registry.d.ts +85 -0
  116. package/dist/blocks/registry.d.ts.map +1 -0
  117. package/dist/blocks/registry.js +136 -0
  118. package/dist/blocks/registry.js.map +1 -0
  119. package/dist/blocks/rule-engine.d.ts +132 -0
  120. package/dist/blocks/rule-engine.d.ts.map +1 -0
  121. package/dist/blocks/rule-engine.js +321 -0
  122. package/dist/blocks/rule-engine.js.map +1 -0
  123. package/dist/blocks/surface-event-context.d.ts +14 -0
  124. package/dist/blocks/surface-event-context.d.ts.map +1 -0
  125. package/dist/blocks/surface-event-context.js +14 -0
  126. package/dist/blocks/surface-event-context.js.map +1 -0
  127. package/dist/blocks/surface-id-context.d.ts +14 -0
  128. package/dist/blocks/surface-id-context.d.ts.map +1 -0
  129. package/dist/blocks/surface-id-context.js +15 -0
  130. package/dist/blocks/surface-id-context.js.map +1 -0
  131. package/dist/bus.d.ts +42 -0
  132. package/dist/bus.d.ts.map +1 -0
  133. package/dist/bus.js +158 -0
  134. package/dist/bus.js.map +1 -0
  135. package/dist/cache/index.d.ts +10 -0
  136. package/dist/cache/index.d.ts.map +1 -0
  137. package/dist/cache/index.js +10 -0
  138. package/dist/cache/index.js.map +1 -0
  139. package/dist/cache/memory.d.ts +33 -0
  140. package/dist/cache/memory.d.ts.map +1 -0
  141. package/dist/cache/memory.js +138 -0
  142. package/dist/cache/memory.js.map +1 -0
  143. package/dist/cache/types.d.ts +63 -0
  144. package/dist/cache/types.d.ts.map +1 -0
  145. package/dist/cache/types.js +9 -0
  146. package/dist/cache/types.js.map +1 -0
  147. package/dist/capability/index.d.ts +73 -0
  148. package/dist/capability/index.d.ts.map +1 -0
  149. package/dist/capability/index.js +87 -0
  150. package/dist/capability/index.js.map +1 -0
  151. package/dist/capability/kernel-capabilities.d.ts +32 -0
  152. package/dist/capability/kernel-capabilities.d.ts.map +1 -0
  153. package/dist/capability/kernel-capabilities.js +36 -0
  154. package/dist/capability/kernel-capabilities.js.map +1 -0
  155. package/dist/capability/platform-capabilities.d.ts +72 -0
  156. package/dist/capability/platform-capabilities.d.ts.map +1 -0
  157. package/dist/capability/platform-capabilities.js +267 -0
  158. package/dist/capability/platform-capabilities.js.map +1 -0
  159. package/dist/capability/type-mapping.d.ts +71 -0
  160. package/dist/capability/type-mapping.d.ts.map +1 -0
  161. package/dist/capability/type-mapping.js +107 -0
  162. package/dist/capability/type-mapping.js.map +1 -0
  163. package/dist/capability/validation.d.ts +47 -0
  164. package/dist/capability/validation.d.ts.map +1 -0
  165. package/dist/capability/validation.js +54 -0
  166. package/dist/capability/validation.js.map +1 -0
  167. package/dist/connectors/declared-connector.d.ts +49 -0
  168. package/dist/connectors/declared-connector.d.ts.map +1 -0
  169. package/dist/connectors/declared-connector.js +333 -0
  170. package/dist/connectors/declared-connector.js.map +1 -0
  171. package/dist/connectors/engine-registry.d.ts +51 -0
  172. package/dist/connectors/engine-registry.d.ts.map +1 -0
  173. package/dist/connectors/engine-registry.js +135 -0
  174. package/dist/connectors/engine-registry.js.map +1 -0
  175. package/dist/connectors/index.d.ts +15 -0
  176. package/dist/connectors/index.d.ts.map +1 -0
  177. package/dist/connectors/index.js +14 -0
  178. package/dist/connectors/index.js.map +1 -0
  179. package/dist/connectors/module-loader.d.ts +71 -0
  180. package/dist/connectors/module-loader.d.ts.map +1 -0
  181. package/dist/connectors/module-loader.js +143 -0
  182. package/dist/connectors/module-loader.js.map +1 -0
  183. package/dist/connectors/types.d.ts +175 -0
  184. package/dist/connectors/types.d.ts.map +1 -0
  185. package/dist/connectors/types.js +23 -0
  186. package/dist/connectors/types.js.map +1 -0
  187. package/dist/context.d.ts +28 -0
  188. package/dist/context.d.ts.map +1 -0
  189. package/dist/context.js +38 -0
  190. package/dist/context.js.map +1 -0
  191. package/dist/data/DataCapabilityProvider.d.ts +40 -0
  192. package/dist/data/DataCapabilityProvider.d.ts.map +1 -0
  193. package/dist/data/DataCapabilityProvider.js +58 -0
  194. package/dist/data/DataCapabilityProvider.js.map +1 -0
  195. package/dist/data/index.d.ts +18 -0
  196. package/dist/data/index.d.ts.map +1 -0
  197. package/dist/data/index.js +18 -0
  198. package/dist/data/index.js.map +1 -0
  199. package/dist/data/manager.d.ts +41 -0
  200. package/dist/data/manager.d.ts.map +1 -0
  201. package/dist/data/manager.js +442 -0
  202. package/dist/data/manager.js.map +1 -0
  203. package/dist/data/types.d.ts +219 -0
  204. package/dist/data/types.d.ts.map +1 -0
  205. package/dist/data/types.js +2 -0
  206. package/dist/data/types.js.map +1 -0
  207. package/dist/entity/aggregate.d.ts +9 -0
  208. package/dist/entity/aggregate.d.ts.map +1 -0
  209. package/dist/entity/aggregate.js +24 -0
  210. package/dist/entity/aggregate.js.map +1 -0
  211. package/dist/entity/apply-query.d.ts +59 -0
  212. package/dist/entity/apply-query.d.ts.map +1 -0
  213. package/dist/entity/apply-query.js +264 -0
  214. package/dist/entity/apply-query.js.map +1 -0
  215. package/dist/entity/behavior.d.ts +95 -0
  216. package/dist/entity/behavior.d.ts.map +1 -0
  217. package/dist/entity/behavior.js +78 -0
  218. package/dist/entity/behavior.js.map +1 -0
  219. package/dist/entity/connector.d.ts +142 -0
  220. package/dist/entity/connector.d.ts.map +1 -0
  221. package/dist/entity/connector.js +89 -0
  222. package/dist/entity/connector.js.map +1 -0
  223. package/dist/entity/connectors/index.d.ts +13 -0
  224. package/dist/entity/connectors/index.d.ts.map +1 -0
  225. package/dist/entity/connectors/index.js +11 -0
  226. package/dist/entity/connectors/index.js.map +1 -0
  227. package/dist/entity/connectors/static.d.ts +52 -0
  228. package/dist/entity/connectors/static.d.ts.map +1 -0
  229. package/dist/entity/connectors/static.js +245 -0
  230. package/dist/entity/connectors/static.js.map +1 -0
  231. package/dist/entity/entity-datasource.d.ts +51 -0
  232. package/dist/entity/entity-datasource.d.ts.map +1 -0
  233. package/dist/entity/entity-datasource.js +33 -0
  234. package/dist/entity/entity-datasource.js.map +1 -0
  235. package/dist/entity/facade.d.ts +71 -0
  236. package/dist/entity/facade.d.ts.map +1 -0
  237. package/dist/entity/facade.js +70 -0
  238. package/dist/entity/facade.js.map +1 -0
  239. package/dist/entity/http-connector.d.ts +124 -0
  240. package/dist/entity/http-connector.d.ts.map +1 -0
  241. package/dist/entity/http-connector.js +295 -0
  242. package/dist/entity/http-connector.js.map +1 -0
  243. package/dist/entity/index.d.ts +39 -0
  244. package/dist/entity/index.d.ts.map +1 -0
  245. package/dist/entity/index.js +31 -0
  246. package/dist/entity/index.js.map +1 -0
  247. package/dist/entity/postgres-connector.d.ts +65 -0
  248. package/dist/entity/postgres-connector.d.ts.map +1 -0
  249. package/dist/entity/postgres-connector.js +239 -0
  250. package/dist/entity/postgres-connector.js.map +1 -0
  251. package/dist/entity/registry.d.ts +60 -0
  252. package/dist/entity/registry.d.ts.map +1 -0
  253. package/dist/entity/registry.js +90 -0
  254. package/dist/entity/registry.js.map +1 -0
  255. package/dist/entity/store.d.ts +67 -0
  256. package/dist/entity/store.d.ts.map +1 -0
  257. package/dist/entity/store.js +349 -0
  258. package/dist/entity/store.js.map +1 -0
  259. package/dist/entity/types.d.ts +181 -0
  260. package/dist/entity/types.d.ts.map +1 -0
  261. package/dist/entity/types.js +10 -0
  262. package/dist/entity/types.js.map +1 -0
  263. package/dist/execution-context.d.ts +89 -0
  264. package/dist/execution-context.d.ts.map +1 -0
  265. package/dist/execution-context.js +146 -0
  266. package/dist/execution-context.js.map +1 -0
  267. package/dist/executor.d.ts +28 -0
  268. package/dist/executor.d.ts.map +1 -0
  269. package/dist/executor.js +33 -0
  270. package/dist/executor.js.map +1 -0
  271. package/dist/forms/form-entity-bridge.d.ts +95 -0
  272. package/dist/forms/form-entity-bridge.d.ts.map +1 -0
  273. package/dist/forms/form-entity-bridge.js +96 -0
  274. package/dist/forms/form-entity-bridge.js.map +1 -0
  275. package/dist/forms/form-write-target.d.ts +35 -0
  276. package/dist/forms/form-write-target.d.ts.map +1 -0
  277. package/dist/forms/form-write-target.js +81 -0
  278. package/dist/forms/form-write-target.js.map +1 -0
  279. package/dist/forms/index.d.ts +23 -0
  280. package/dist/forms/index.d.ts.map +1 -0
  281. package/dist/forms/index.js +25 -0
  282. package/dist/forms/index.js.map +1 -0
  283. package/dist/forms/named-control-values.d.ts +28 -0
  284. package/dist/forms/named-control-values.d.ts.map +1 -0
  285. package/dist/forms/named-control-values.js +42 -0
  286. package/dist/forms/named-control-values.js.map +1 -0
  287. package/dist/forms/processor.d.ts +56 -0
  288. package/dist/forms/processor.d.ts.map +1 -0
  289. package/dist/forms/processor.js +154 -0
  290. package/dist/forms/processor.js.map +1 -0
  291. package/dist/forms/types.d.ts +175 -0
  292. package/dist/forms/types.d.ts.map +1 -0
  293. package/dist/forms/types.js +33 -0
  294. package/dist/forms/types.js.map +1 -0
  295. package/dist/forms/validator.d.ts +62 -0
  296. package/dist/forms/validator.d.ts.map +1 -0
  297. package/dist/forms/validator.js +218 -0
  298. package/dist/forms/validator.js.map +1 -0
  299. package/dist/graph/index.d.ts +11 -0
  300. package/dist/graph/index.d.ts.map +1 -0
  301. package/dist/graph/index.js +9 -0
  302. package/dist/graph/index.js.map +1 -0
  303. package/dist/graph/resolver.d.ts +67 -0
  304. package/dist/graph/resolver.d.ts.map +1 -0
  305. package/dist/graph/resolver.js +243 -0
  306. package/dist/graph/resolver.js.map +1 -0
  307. package/dist/graph/types.d.ts +126 -0
  308. package/dist/graph/types.d.ts.map +1 -0
  309. package/dist/graph/types.js +9 -0
  310. package/dist/graph/types.js.map +1 -0
  311. package/dist/hooks/useInstalledAtoms.d.ts +97 -0
  312. package/dist/hooks/useInstalledAtoms.d.ts.map +1 -0
  313. package/dist/hooks/useInstalledAtoms.js +92 -0
  314. package/dist/hooks/useInstalledAtoms.js.map +1 -0
  315. package/dist/i18n/index.d.ts +16 -0
  316. package/dist/i18n/index.d.ts.map +1 -0
  317. package/dist/i18n/index.js +14 -0
  318. package/dist/i18n/index.js.map +1 -0
  319. package/dist/i18n/translator.d.ts +77 -0
  320. package/dist/i18n/translator.d.ts.map +1 -0
  321. package/dist/i18n/translator.js +357 -0
  322. package/dist/i18n/translator.js.map +1 -0
  323. package/dist/i18n/types.d.ts +94 -0
  324. package/dist/i18n/types.d.ts.map +1 -0
  325. package/dist/i18n/types.js +9 -0
  326. package/dist/i18n/types.js.map +1 -0
  327. package/dist/index.d.ts +65 -0
  328. package/dist/index.d.ts.map +1 -0
  329. package/dist/index.js +95 -0
  330. package/dist/index.js.map +1 -0
  331. package/dist/kernel.d.ts +48 -0
  332. package/dist/kernel.d.ts.map +1 -0
  333. package/dist/kernel.js +258 -0
  334. package/dist/kernel.js.map +1 -0
  335. package/dist/perf/budget.d.ts +93 -0
  336. package/dist/perf/budget.d.ts.map +1 -0
  337. package/dist/perf/budget.js +122 -0
  338. package/dist/perf/budget.js.map +1 -0
  339. package/dist/perf/index.d.ts +17 -0
  340. package/dist/perf/index.d.ts.map +1 -0
  341. package/dist/perf/index.js +13 -0
  342. package/dist/perf/index.js.map +1 -0
  343. package/dist/perf/render-timer.d.ts +91 -0
  344. package/dist/perf/render-timer.d.ts.map +1 -0
  345. package/dist/perf/render-timer.js +136 -0
  346. package/dist/perf/render-timer.js.map +1 -0
  347. package/dist/perf/reporter.d.ts +127 -0
  348. package/dist/perf/reporter.d.ts.map +1 -0
  349. package/dist/perf/reporter.js +241 -0
  350. package/dist/perf/reporter.js.map +1 -0
  351. package/dist/perf/web-vitals.d.ts +112 -0
  352. package/dist/perf/web-vitals.d.ts.map +1 -0
  353. package/dist/perf/web-vitals.js +268 -0
  354. package/dist/perf/web-vitals.js.map +1 -0
  355. package/dist/registry.d.ts +64 -0
  356. package/dist/registry.d.ts.map +1 -0
  357. package/dist/registry.js +126 -0
  358. package/dist/registry.js.map +1 -0
  359. package/dist/render/BehaviorSurfaceProvider.d.ts +66 -0
  360. package/dist/render/BehaviorSurfaceProvider.d.ts.map +1 -0
  361. package/dist/render/BehaviorSurfaceProvider.js +185 -0
  362. package/dist/render/BehaviorSurfaceProvider.js.map +1 -0
  363. package/dist/render/BlockErrorBoundary.d.ts +27 -0
  364. package/dist/render/BlockErrorBoundary.d.ts.map +1 -0
  365. package/dist/render/BlockErrorBoundary.js +41 -0
  366. package/dist/render/BlockErrorBoundary.js.map +1 -0
  367. package/dist/render/DataBoundSurfaceRenderer.d.ts +79 -0
  368. package/dist/render/DataBoundSurfaceRenderer.d.ts.map +1 -0
  369. package/dist/render/DataBoundSurfaceRenderer.js +998 -0
  370. package/dist/render/DataBoundSurfaceRenderer.js.map +1 -0
  371. package/dist/render/DynamicBlockWrapper.d.ts +24 -0
  372. package/dist/render/DynamicBlockWrapper.d.ts.map +1 -0
  373. package/dist/render/DynamicBlockWrapper.js +117 -0
  374. package/dist/render/DynamicBlockWrapper.js.map +1 -0
  375. package/dist/render/appearance-resolver.d.ts +51 -0
  376. package/dist/render/appearance-resolver.d.ts.map +1 -0
  377. package/dist/render/appearance-resolver.js +78 -0
  378. package/dist/render/appearance-resolver.js.map +1 -0
  379. package/dist/render/capability-gate.d.ts +70 -0
  380. package/dist/render/capability-gate.d.ts.map +1 -0
  381. package/dist/render/capability-gate.js +94 -0
  382. package/dist/render/capability-gate.js.map +1 -0
  383. package/dist/render/conditional-states-css.d.ts +42 -0
  384. package/dist/render/conditional-states-css.d.ts.map +1 -0
  385. package/dist/render/conditional-states-css.js +82 -0
  386. package/dist/render/conditional-states-css.js.map +1 -0
  387. package/dist/render/connections-context.d.ts +32 -0
  388. package/dist/render/connections-context.d.ts.map +1 -0
  389. package/dist/render/connections-context.js +34 -0
  390. package/dist/render/connections-context.js.map +1 -0
  391. package/dist/render/dark-theme-css.d.ts +37 -0
  392. package/dist/render/dark-theme-css.d.ts.map +1 -0
  393. package/dist/render/dark-theme-css.js +67 -0
  394. package/dist/render/dark-theme-css.js.map +1 -0
  395. package/dist/render/data-binding-types.d.ts +192 -0
  396. package/dist/render/data-binding-types.d.ts.map +1 -0
  397. package/dist/render/data-binding-types.js +11 -0
  398. package/dist/render/data-binding-types.js.map +1 -0
  399. package/dist/render/data-cache.d.ts +31 -0
  400. package/dist/render/data-cache.d.ts.map +1 -0
  401. package/dist/render/data-cache.js +37 -0
  402. package/dist/render/data-cache.js.map +1 -0
  403. package/dist/render/derive-dark-theme.d.ts +18 -0
  404. package/dist/render/derive-dark-theme.d.ts.map +1 -0
  405. package/dist/render/derive-dark-theme.js +18 -0
  406. package/dist/render/derive-dark-theme.js.map +1 -0
  407. package/dist/render/dynamic-artifact-context.d.ts +78 -0
  408. package/dist/render/dynamic-artifact-context.d.ts.map +1 -0
  409. package/dist/render/dynamic-artifact-context.js +89 -0
  410. package/dist/render/dynamic-artifact-context.js.map +1 -0
  411. package/dist/render/dynamic-block-loader.d.ts +81 -0
  412. package/dist/render/dynamic-block-loader.d.ts.map +1 -0
  413. package/dist/render/dynamic-block-loader.js +197 -0
  414. package/dist/render/dynamic-block-loader.js.map +1 -0
  415. package/dist/render/endpoint.d.ts +19 -0
  416. package/dist/render/endpoint.d.ts.map +1 -0
  417. package/dist/render/endpoint.js +109 -0
  418. package/dist/render/endpoint.js.map +1 -0
  419. package/dist/render/entity-facade-context.d.ts +35 -0
  420. package/dist/render/entity-facade-context.d.ts.map +1 -0
  421. package/dist/render/entity-facade-context.js +37 -0
  422. package/dist/render/entity-facade-context.js.map +1 -0
  423. package/dist/render/group-states-css.d.ts +42 -0
  424. package/dist/render/group-states-css.d.ts.map +1 -0
  425. package/dist/render/group-states-css.js +73 -0
  426. package/dist/render/group-states-css.js.map +1 -0
  427. package/dist/render/hooks/useSurfaceEvents.d.ts +9 -0
  428. package/dist/render/hooks/useSurfaceEvents.d.ts.map +1 -0
  429. package/dist/render/hooks/useSurfaceEvents.js +9 -0
  430. package/dist/render/hooks/useSurfaceEvents.js.map +1 -0
  431. package/dist/render/hooks/useSurfaceId.d.ts +9 -0
  432. package/dist/render/hooks/useSurfaceId.d.ts.map +1 -0
  433. package/dist/render/hooks/useSurfaceId.js +9 -0
  434. package/dist/render/hooks/useSurfaceId.js.map +1 -0
  435. package/dist/render/index.d.ts +49 -0
  436. package/dist/render/index.d.ts.map +1 -0
  437. package/dist/render/index.js +61 -0
  438. package/dist/render/index.js.map +1 -0
  439. package/dist/render/interaction-rule-engine.d.ts +13 -0
  440. package/dist/render/interaction-rule-engine.d.ts.map +1 -0
  441. package/dist/render/interaction-rule-engine.js +47 -0
  442. package/dist/render/interaction-rule-engine.js.map +1 -0
  443. package/dist/render/keyframes-css.d.ts +32 -0
  444. package/dist/render/keyframes-css.d.ts.map +1 -0
  445. package/dist/render/keyframes-css.js +44 -0
  446. package/dist/render/keyframes-css.js.map +1 -0
  447. package/dist/render/query-state.d.ts +4 -0
  448. package/dist/render/query-state.d.ts.map +1 -0
  449. package/dist/render/query-state.js +70 -0
  450. package/dist/render/query-state.js.map +1 -0
  451. package/dist/render/renderer.d.ts +45 -0
  452. package/dist/render/renderer.d.ts.map +1 -0
  453. package/dist/render/renderer.js +937 -0
  454. package/dist/render/renderer.js.map +1 -0
  455. package/dist/render/resolve-expressions.d.ts +38 -0
  456. package/dist/render/resolve-expressions.d.ts.map +1 -0
  457. package/dist/render/resolve-expressions.js +309 -0
  458. package/dist/render/resolve-expressions.js.map +1 -0
  459. package/dist/render/responsive-style-css.d.ts +43 -0
  460. package/dist/render/responsive-style-css.d.ts.map +1 -0
  461. package/dist/render/responsive-style-css.js +123 -0
  462. package/dist/render/responsive-style-css.js.map +1 -0
  463. package/dist/render/responsive.d.ts +50 -0
  464. package/dist/render/responsive.d.ts.map +1 -0
  465. package/dist/render/responsive.js +99 -0
  466. package/dist/render/responsive.js.map +1 -0
  467. package/dist/render/scoped-css.d.ts +72 -0
  468. package/dist/render/scoped-css.d.ts.map +1 -0
  469. package/dist/render/scoped-css.js +102 -0
  470. package/dist/render/scoped-css.js.map +1 -0
  471. package/dist/render/shell-selection.d.ts +70 -0
  472. package/dist/render/shell-selection.d.ts.map +1 -0
  473. package/dist/render/shell-selection.js +117 -0
  474. package/dist/render/shell-selection.js.map +1 -0
  475. package/dist/render/states-css.d.ts +33 -0
  476. package/dist/render/states-css.d.ts.map +1 -0
  477. package/dist/render/states-css.js +63 -0
  478. package/dist/render/states-css.js.map +1 -0
  479. package/dist/render/surface-data-context.d.ts +19 -0
  480. package/dist/render/surface-data-context.d.ts.map +1 -0
  481. package/dist/render/surface-data-context.js +21 -0
  482. package/dist/render/surface-data-context.js.map +1 -0
  483. package/dist/render/surface-event-bus.d.ts +20 -0
  484. package/dist/render/surface-event-bus.d.ts.map +1 -0
  485. package/dist/render/surface-event-bus.js +68 -0
  486. package/dist/render/surface-event-bus.js.map +1 -0
  487. package/dist/render/surface-event-context.d.ts +12 -0
  488. package/dist/render/surface-event-context.d.ts.map +1 -0
  489. package/dist/render/surface-event-context.js +12 -0
  490. package/dist/render/surface-event-context.js.map +1 -0
  491. package/dist/render/surface-id-context.d.ts +9 -0
  492. package/dist/render/surface-id-context.d.ts.map +1 -0
  493. package/dist/render/surface-id-context.js +9 -0
  494. package/dist/render/surface-id-context.js.map +1 -0
  495. package/dist/render/theme-utils.d.ts +15 -0
  496. package/dist/render/theme-utils.d.ts.map +1 -0
  497. package/dist/render/theme-utils.js +15 -0
  498. package/dist/render/theme-utils.js.map +1 -0
  499. package/dist/render/types.d.ts +283 -0
  500. package/dist/render/types.d.ts.map +1 -0
  501. package/dist/render/types.js +9 -0
  502. package/dist/render/types.js.map +1 -0
  503. package/dist/render/visibility-css.d.ts +43 -0
  504. package/dist/render/visibility-css.d.ts.map +1 -0
  505. package/dist/render/visibility-css.js +119 -0
  506. package/dist/render/visibility-css.js.map +1 -0
  507. package/dist/render/width-scope.d.ts +35 -0
  508. package/dist/render/width-scope.d.ts.map +1 -0
  509. package/dist/render/width-scope.js +44 -0
  510. package/dist/render/width-scope.js.map +1 -0
  511. package/dist/render/write-only-sources.d.ts +34 -0
  512. package/dist/render/write-only-sources.d.ts.map +1 -0
  513. package/dist/render/write-only-sources.js +99 -0
  514. package/dist/render/write-only-sources.js.map +1 -0
  515. package/dist/routing/index.d.ts +15 -0
  516. package/dist/routing/index.d.ts.map +1 -0
  517. package/dist/routing/index.js +15 -0
  518. package/dist/routing/index.js.map +1 -0
  519. package/dist/routing/router.d.ts +43 -0
  520. package/dist/routing/router.d.ts.map +1 -0
  521. package/dist/routing/router.js +218 -0
  522. package/dist/routing/router.js.map +1 -0
  523. package/dist/routing/types.d.ts +125 -0
  524. package/dist/routing/types.d.ts.map +1 -0
  525. package/dist/routing/types.js +9 -0
  526. package/dist/routing/types.js.map +1 -0
  527. package/dist/seo/generator.d.ts +40 -0
  528. package/dist/seo/generator.d.ts.map +1 -0
  529. package/dist/seo/generator.js +236 -0
  530. package/dist/seo/generator.js.map +1 -0
  531. package/dist/seo/index.d.ts +15 -0
  532. package/dist/seo/index.d.ts.map +1 -0
  533. package/dist/seo/index.js +15 -0
  534. package/dist/seo/index.js.map +1 -0
  535. package/dist/seo/types.d.ts +182 -0
  536. package/dist/seo/types.d.ts.map +1 -0
  537. package/dist/seo/types.js +9 -0
  538. package/dist/seo/types.js.map +1 -0
  539. package/dist/state/index.d.ts +16 -0
  540. package/dist/state/index.d.ts.map +1 -0
  541. package/dist/state/index.js +16 -0
  542. package/dist/state/index.js.map +1 -0
  543. package/dist/state/manager.d.ts +34 -0
  544. package/dist/state/manager.d.ts.map +1 -0
  545. package/dist/state/manager.js +81 -0
  546. package/dist/state/manager.js.map +1 -0
  547. package/dist/state/store.d.ts +41 -0
  548. package/dist/state/store.d.ts.map +1 -0
  549. package/dist/state/store.js +145 -0
  550. package/dist/state/store.js.map +1 -0
  551. package/dist/state/types.d.ts +108 -0
  552. package/dist/state/types.d.ts.map +1 -0
  553. package/dist/state/types.js +9 -0
  554. package/dist/state/types.js.map +1 -0
  555. package/dist/surface/expression.d.ts +66 -0
  556. package/dist/surface/expression.d.ts.map +1 -0
  557. package/dist/surface/expression.js +179 -0
  558. package/dist/surface/expression.js.map +1 -0
  559. package/dist/surface/index.d.ts +33 -0
  560. package/dist/surface/index.d.ts.map +1 -0
  561. package/dist/surface/index.js +25 -0
  562. package/dist/surface/index.js.map +1 -0
  563. package/dist/surface/interpreter.d.ts +97 -0
  564. package/dist/surface/interpreter.d.ts.map +1 -0
  565. package/dist/surface/interpreter.js +231 -0
  566. package/dist/surface/interpreter.js.map +1 -0
  567. package/dist/surface/layout.d.ts +55 -0
  568. package/dist/surface/layout.d.ts.map +1 -0
  569. package/dist/surface/layout.js +288 -0
  570. package/dist/surface/layout.js.map +1 -0
  571. package/dist/surface/output.d.ts +91 -0
  572. package/dist/surface/output.d.ts.map +1 -0
  573. package/dist/surface/output.js +104 -0
  574. package/dist/surface/output.js.map +1 -0
  575. package/dist/surface/primitives.d.ts +181 -0
  576. package/dist/surface/primitives.d.ts.map +1 -0
  577. package/dist/surface/primitives.js +339 -0
  578. package/dist/surface/primitives.js.map +1 -0
  579. package/dist/surface/renderer.d.ts +97 -0
  580. package/dist/surface/renderer.d.ts.map +1 -0
  581. package/dist/surface/renderer.js +190 -0
  582. package/dist/surface/renderer.js.map +1 -0
  583. package/dist/surface/schemas.d.ts +182 -0
  584. package/dist/surface/schemas.d.ts.map +1 -0
  585. package/dist/surface/schemas.js +142 -0
  586. package/dist/surface/schemas.js.map +1 -0
  587. package/dist/surface/transforms.d.ts +145 -0
  588. package/dist/surface/transforms.d.ts.map +1 -0
  589. package/dist/surface/transforms.js +120 -0
  590. package/dist/surface/transforms.js.map +1 -0
  591. package/dist/surface/types.d.ts +161 -0
  592. package/dist/surface/types.d.ts.map +1 -0
  593. package/dist/surface/types.js +51 -0
  594. package/dist/surface/types.js.map +1 -0
  595. package/dist/surface/validation.d.ts +124 -0
  596. package/dist/surface/validation.d.ts.map +1 -0
  597. package/dist/surface/validation.js +147 -0
  598. package/dist/surface/validation.js.map +1 -0
  599. package/dist/validator.d.ts +56 -0
  600. package/dist/validator.d.ts.map +1 -0
  601. package/dist/validator.js +100 -0
  602. package/dist/validator.js.map +1 -0
  603. package/package.json +105 -3
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Responsive Rendering Utilities
3
+ *
4
+ * Viewport-aware layout resolution for runtime rendering.
5
+ * Re-exports pure functions from @pwfabric/core and provides
6
+ * React-specific viewport hook.
7
+ *
8
+ * @module @pwfabric/runtime/render/responsive
9
+ */
10
+ import * as React from 'react';
11
+ import type { BlockLayout, BreakpointName } from '@pwfabric/core';
12
+ export { resolveResponsiveValue, resolveSpanAtBreakpoint, getColumnsAtBreakpoint, getBreakpointForWidth, } from '@pwfabric/core';
13
+ /**
14
+ * Resolve the complete block layout at a given viewport breakpoint.
15
+ * Returns span, offset, order, and hidden values.
16
+ */
17
+ export declare function resolveBlockLayout(layout: BlockLayout, viewport: BreakpointName): {
18
+ span: number;
19
+ offset: number | undefined;
20
+ order: number | undefined;
21
+ hidden: boolean | undefined;
22
+ };
23
+ /**
24
+ * Surface root — carries NO MEASURE.
25
+ *
26
+ * If the root carried both the 12-column grid and
27
+ * `maxWidth: var(--pw-layout-container-max-width)` + `margin: 0 auto`,
28
+ * persistent chrome would sit inside the centred box too (a persistent rail
29
+ * would start well in from the screen edge, as part of the narrower container).
30
+ *
31
+ * The measure goes to the inner container through `resolveMeasureStyle`;
32
+ * the root is flow only.
33
+ */
34
+ export declare function resolveSurfaceRootStyle(gap?: string | number, padding?: string | number): React.CSSProperties;
35
+ /**
36
+ * Measured container — the wrapper of `container`-scoped blocks.
37
+ *
38
+ * The 12-column grid and `containerMaxWidth` live HERE. Blocks that declare
39
+ * `widthScope:'viewport'` are drawn as SIBLINGS of this container, not its
40
+ * children — the escape is placement, not a CSS trick (see render/width-scope.ts).
41
+ */
42
+ export declare function resolveMeasureStyle(viewport: BreakpointName, gap?: string | number, padding?: string | number, containerMaxWidth?: string): React.CSSProperties;
43
+ /**
44
+ * React hook that returns the current viewport breakpoint.
45
+ * Uses matchMedia for efficient viewport detection.
46
+ *
47
+ * Returns 'lg' on server (SSR fallback).
48
+ */
49
+ export declare function useViewport(): BreakpointName;
50
+ //# sourceMappingURL=responsive.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../src/render/responsive.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAUjE,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAMvB;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,cAAc,GACvB;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;CAC5B,CAOA;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,GAAE,MAAM,GAAG,MAAW,EACzB,OAAO,GAAE,MAAM,GAAG,MAAU,GAC3B,KAAK,CAAC,aAAa,CAOrB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,cAAc,EACxB,GAAG,GAAE,MAAM,GAAG,MAAW,EACzB,OAAO,GAAE,MAAM,GAAG,MAAW,EAC7B,iBAAiB,SAAyC,GACzD,KAAK,CAAC,aAAa,CAWrB;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,cAAc,CA2B5C"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Responsive Rendering Utilities
3
+ *
4
+ * Viewport-aware layout resolution for runtime rendering.
5
+ * Re-exports pure functions from @pwfabric/core and provides
6
+ * React-specific viewport hook.
7
+ *
8
+ * @module @pwfabric/runtime/render/responsive
9
+ */
10
+ import * as React from 'react';
11
+ import { BREAKPOINTS, resolveSpanAtBreakpoint, resolveResponsiveValue, getColumnsAtBreakpoint, getBreakpointForWidth, } from '@pwfabric/core';
12
+ // Re-export pure functions for convenience
13
+ export { resolveResponsiveValue, resolveSpanAtBreakpoint, getColumnsAtBreakpoint, getBreakpointForWidth, } from '@pwfabric/core';
14
+ // ============================================================
15
+ // BLOCK STYLE RESOLUTION
16
+ // ============================================================
17
+ /**
18
+ * Resolve the complete block layout at a given viewport breakpoint.
19
+ * Returns span, offset, order, and hidden values.
20
+ */
21
+ export function resolveBlockLayout(layout, viewport) {
22
+ return {
23
+ span: resolveSpanAtBreakpoint(layout, viewport),
24
+ offset: resolveResponsiveValue(layout.offset, viewport),
25
+ order: resolveResponsiveValue(layout.order, viewport),
26
+ hidden: resolveResponsiveValue(layout.hidden, viewport),
27
+ };
28
+ }
29
+ /**
30
+ * Surface root — carries NO MEASURE.
31
+ *
32
+ * If the root carried both the 12-column grid and
33
+ * `maxWidth: var(--pw-layout-container-max-width)` + `margin: 0 auto`,
34
+ * persistent chrome would sit inside the centred box too (a persistent rail
35
+ * would start well in from the screen edge, as part of the narrower container).
36
+ *
37
+ * The measure goes to the inner container through `resolveMeasureStyle`;
38
+ * the root is flow only.
39
+ */
40
+ export function resolveSurfaceRootStyle(gap = 16, padding = 0) {
41
+ return {
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ gap: typeof gap === 'number' ? `${gap}px` : gap,
45
+ padding: typeof padding === 'number' ? `${padding}px` : padding,
46
+ };
47
+ }
48
+ /**
49
+ * Measured container — the wrapper of `container`-scoped blocks.
50
+ *
51
+ * The 12-column grid and `containerMaxWidth` live HERE. Blocks that declare
52
+ * `widthScope:'viewport'` are drawn as SIBLINGS of this container, not its
53
+ * children — the escape is placement, not a CSS trick (see render/width-scope.ts).
54
+ */
55
+ export function resolveMeasureStyle(viewport, gap = 16, padding = 24, containerMaxWidth = 'var(--pw-layout-container-max-width)') {
56
+ const columns = getColumnsAtBreakpoint(viewport);
57
+ return {
58
+ display: 'grid',
59
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
60
+ gap: typeof gap === 'number' ? `${gap}px` : gap,
61
+ padding: typeof padding === 'number' ? `${padding}px` : padding,
62
+ maxWidth: containerMaxWidth,
63
+ margin: '0 auto',
64
+ width: '100%',
65
+ };
66
+ }
67
+ // ============================================================
68
+ // VIEWPORT HOOK
69
+ // ============================================================
70
+ /**
71
+ * React hook that returns the current viewport breakpoint.
72
+ * Uses matchMedia for efficient viewport detection.
73
+ *
74
+ * Returns 'lg' on server (SSR fallback).
75
+ */
76
+ export function useViewport() {
77
+ const [breakpoint, setBreakpoint] = React.useState('lg');
78
+ React.useEffect(() => {
79
+ // Set initial value from current window width
80
+ setBreakpoint(getBreakpointForWidth(window.innerWidth));
81
+ // Create media query listeners for each breakpoint transition
82
+ const listeners = [];
83
+ for (const bp of BREAKPOINTS) {
84
+ const mql = window.matchMedia(`(min-width: ${bp.minWidth}px)`);
85
+ const handler = () => {
86
+ setBreakpoint(getBreakpointForWidth(window.innerWidth));
87
+ };
88
+ mql.addEventListener('change', handler);
89
+ listeners.push({ mql, handler });
90
+ }
91
+ return () => {
92
+ for (const { mql, handler } of listeners) {
93
+ mql.removeEventListener('change', handler);
94
+ }
95
+ };
96
+ }, []);
97
+ return breakpoint;
98
+ }
99
+ //# sourceMappingURL=responsive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responsive.js","sourceRoot":"","sources":["../../src/render/responsive.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAEvB,2CAA2C;AAC3C,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gBAAgB,CAAA;AAEvB,+DAA+D;AAC/D,yBAAyB;AACzB,+DAA+D;AAE/D;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAmB,EACnB,QAAwB;IAOxB,OAAO;QACL,IAAI,EAAE,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC;QAC/C,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC;QACvD,KAAK,EAAE,sBAAsB,CAAC,MAAM,CA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AC,CAAA;IAExE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,8CAA8C;QAC9C,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;QAEvD,8DAA8D;QAC9D,MAAM,SAAS,GAAmD,EAAE,CAAA;QAEpE,KAAK,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,QAAQ,KAAK,CAAC,CAAA;YAC9D,MAAM,OAAO,GAAG,GAAS,EAAE;gBACzB,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAA;YACzD,CAAC,CAAA;YACD,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACvC,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;QAClC,CAAC;QAED,OAAO,GAAG,EAAE;YACV,KAAK,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,SAAS,EAAE,CAAC;gBACzC,GAAG,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAC5C,CAAC;QACH,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,UAAU,CAAA;AACnB,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Shared helpers for the scoped per-block CSS collectors.
3
+ *
4
+ * The runtime emits several kinds of scoped `<style>` rules keyed by a block's
5
+ * stable `data-block-id` (visibility / interaction-states / responsive-style /
6
+ * conditional-states / group-states). They all share the SAME primitives:
7
+ *
8
+ * - `cssEscapeId(id)` — conservative attribute-value escaper for block ids.
9
+ * - `camelToKebab(prop)` — CSS camelCase property name → kebab-case.
10
+ * - `blockSelector(id)` — `[data-pw-surface] [data-block-id="<escaped>"]`,
11
+ * the scoped base selector every rule attaches to.
12
+ * - `collectScopedCss(blocks, perBlockFn)` — walk the block tree (including
13
+ * children) and concatenate each block's CSS as
14
+ * produced by `perBlockFn(block)`.
15
+ *
16
+ * Centralising these keeps the per-collector files focused on their own
17
+ * selector/declaration semantics and guarantees byte-identical output across
18
+ * the family (the same escaper, the same selector string, the same walk order).
19
+ *
20
+ * @module @pwfabric/runtime/render/scoped-css
21
+ */
22
+ import type { Block } from '@pwfabric/core';
23
+ /** Conservative CSS attribute-selector value escaper (block ids are slugs, but be safe). */
24
+ export declare function cssEscapeId(id: string): string;
25
+ /** camelCase CSS property → kebab-case (e.g. `backgroundColor` → `background-color`). */
26
+ export declare function camelToKebab(prop: string): string;
27
+ /** The bare `[data-block-id="<escaped-id>"]` attribute selector (no surface scope). */
28
+ export declare function blockIdAttr(id: string): string;
29
+ /**
30
+ * The surface-root selector a scoped rule hangs off.
31
+ *
32
+ * With a `surfaceId` this is `[data-pw-surface="<id>"]` — scope carried by the
33
+ * attribute's VALUE, not merely its presence. That matters because the embed
34
+ * autoloader hydrates EVERY `[data-pw-surface]` element in a document, so a host
35
+ * page can hold several surfaces at once; a value-less selector makes each
36
+ * surface's rules apply to all of them, and the last one in document order wins.
37
+ *
38
+ * Without a `surfaceId` it degrades to the historical `[data-pw-surface]`, which
39
+ * is correct for rules whose content is identical for every surface (the base
40
+ * CSS) and for unit tests that render a single surface.
41
+ */
42
+ export declare function surfaceScope(surfaceId?: string): string;
43
+ /**
44
+ * The scoped base selector a per-block rule attaches to:
45
+ * `[data-pw-surface="<sid>"] [data-block-id="<escaped-id>"]`. Scoped under the
46
+ * surface root so a rule can never leak to the host page — and, when the surface
47
+ * id is supplied, never to a SIBLING surface that happens to reuse a block id.
48
+ */
49
+ export declare function blockSelector(id: string, surfaceId?: string): string;
50
+ /**
51
+ * Walk a surface block tree (depth-first, children after their parent — the
52
+ * order all collectors used) and concatenate the per-block CSS produced by
53
+ * `perBlockFn(block)`. Blocks for which `perBlockFn` returns '' contribute zero
54
+ * bytes, so existing surfaces stay byte-identical.
55
+ */
56
+ export declare function collectScopedCss(blocks: readonly Block[], perBlockFn: (block: Block) => string): string;
57
+ /**
58
+ * Style keys HOISTED to the wrapper — kept here so the renderer and the
59
+ * responsive CSS generator see the SAME list.
60
+ *
61
+ * This list is a RULE: these keys apply to the outer wrapper, not the
62
+ * component root. For flat values the renderer hoists them; for responsive
63
+ * values the value leaves the inline style entirely and lands in CSS, so the
64
+ * same rule has to be expressed on the selector side — otherwise the rule
65
+ * matches both the wrapper and the root and the value is applied TWICE
66
+ * (`marginTop:'-40%'` would move content by both -335px and -256px).
67
+ */
68
+ export declare const FLEX_HOIST_KEYS: readonly ["flex", "flexGrow", "flexShrink", "flexBasis"];
69
+ export declare const LAYOUT_HOIST_KEYS: readonly ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "maxWidth", "minWidth", "flex", "flexGrow", "flexShrink", "flexBasis"];
70
+ /** The attribute that tells the wrapper from the component root (the same marker states-css uses). */
71
+ export declare const WRAPPER_ATTR = "[data-block-wrapper]";
72
+ //# sourceMappingURL=scoped-css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoped-css.d.ts","sourceRoot":"","sources":["../../src/render/scoped-css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE3C,4FAA4F;AAC5F,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,yFAAyF;AACzF,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,uFAAuF;AACvF,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GACnC,MAAM,CAUR;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,0DAA2D,CAAA;AAEvF,eAAO,MAAM,iBAAiB,sJASpB,CAAA;AAEV,sGAAsG;AACtG,eAAO,MAAM,YAAY,yBAAyB,CAAA"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Shared helpers for the scoped per-block CSS collectors.
3
+ *
4
+ * The runtime emits several kinds of scoped `<style>` rules keyed by a block's
5
+ * stable `data-block-id` (visibility / interaction-states / responsive-style /
6
+ * conditional-states / group-states). They all share the SAME primitives:
7
+ *
8
+ * - `cssEscapeId(id)` — conservative attribute-value escaper for block ids.
9
+ * - `camelToKebab(prop)` — CSS camelCase property name → kebab-case.
10
+ * - `blockSelector(id)` — `[data-pw-surface] [data-block-id="<escaped>"]`,
11
+ * the scoped base selector every rule attaches to.
12
+ * - `collectScopedCss(blocks, perBlockFn)` — walk the block tree (including
13
+ * children) and concatenate each block's CSS as
14
+ * produced by `perBlockFn(block)`.
15
+ *
16
+ * Centralising these keeps the per-collector files focused on their own
17
+ * selector/declaration semantics and guarantees byte-identical output across
18
+ * the family (the same escaper, the same selector string, the same walk order).
19
+ *
20
+ * @module @pwfabric/runtime/render/scoped-css
21
+ */
22
+ /** Conservative CSS attribute-selector value escaper (block ids are slugs, but be safe). */
23
+ export function cssEscapeId(id) {
24
+ return id.replace(/["\\]/g, '\\$&');
25
+ }
26
+ /** camelCase CSS property → kebab-case (e.g. `backgroundColor` → `background-color`). */
27
+ export function camelToKebab(prop) {
28
+ return prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
29
+ }
30
+ /** The bare `[data-block-id="<escaped-id>"]` attribute selector (no surface scope). */
31
+ export function blockIdAttr(id) {
32
+ return `[data-block-id="${cssEscapeId(id)}"]`;
33
+ }
34
+ /**
35
+ * The surface-root selector a scoped rule hangs off.
36
+ *
37
+ * With a `surfaceId` this is `[data-pw-surface="<id>"]` — scope carried by the
38
+ * attribute's VALUE, not merely its presence. That matters because the embed
39
+ * autoloader hydrates EVERY `[data-pw-surface]` element in a document, so a host
40
+ * page can hold several surfaces at once; a value-less selector makes each
41
+ * surface's rules apply to all of them, and the last one in document order wins.
42
+ *
43
+ * Without a `surfaceId` it degrades to the historical `[data-pw-surface]`, which
44
+ * is correct for rules whose content is identical for every surface (the base
45
+ * CSS) and for unit tests that render a single surface.
46
+ */
47
+ export function surfaceScope(surfaceId) {
48
+ return surfaceId ? `[data-pw-surface="${cssEscapeId(surfaceId)}"]` : '[data-pw-surface]';
49
+ }
50
+ /**
51
+ * The scoped base selector a per-block rule attaches to:
52
+ * `[data-pw-surface="<sid>"] [data-block-id="<escaped-id>"]`. Scoped under the
53
+ * surface root so a rule can never leak to the host page — and, when the surface
54
+ * id is supplied, never to a SIBLING surface that happens to reuse a block id.
55
+ */
56
+ export function blockSelector(id, surfaceId) {
57
+ return `${surfaceScope(surfaceId)} ${blockIdAttr(id)}`;
58
+ }
59
+ /**
60
+ * Walk a surface block tree (depth-first, children after their parent — the
61
+ * order all collectors used) and concatenate the per-block CSS produced by
62
+ * `perBlockFn(block)`. Blocks for which `perBlockFn` returns '' contribute zero
63
+ * bytes, so existing surfaces stay byte-identical.
64
+ */
65
+ export function collectScopedCss(blocks, perBlockFn) {
66
+ let css = '';
67
+ const walk = (block) => {
68
+ css += perBlockFn(block);
69
+ if (block.children) {
70
+ for (const child of block.children)
71
+ walk(child);
72
+ }
73
+ };
74
+ for (const block of blocks)
75
+ walk(block);
76
+ return css;
77
+ }
78
+ /**
79
+ * Style keys HOISTED to the wrapper — kept here so the renderer and the
80
+ * responsive CSS generator see the SAME list.
81
+ *
82
+ * This list is a RULE: these keys apply to the outer wrapper, not the
83
+ * component root. For flat values the renderer hoists them; for responsive
84
+ * values the value leaves the inline style entirely and lands in CSS, so the
85
+ * same rule has to be expressed on the selector side — otherwise the rule
86
+ * matches both the wrapper and the root and the value is applied TWICE
87
+ * (`marginTop:'-40%'` would move content by both -335px and -256px).
88
+ */
89
+ export const FLEX_HOIST_KEYS = ['flex', 'flexGrow', 'flexShrink', 'flexBasis'];
90
+ export const LAYOUT_HOIST_KEYS = [
91
+ 'margin',
92
+ 'marginTop',
93
+ 'marginRight',
94
+ 'marginBottom',
95
+ 'marginLeft',
96
+ 'maxWidth',
97
+ 'minWidth',
98
+ ...FLEX_HOIST_KEYS,
99
+ ];
100
+ /** The attribute that tells the wrapper from the component root (the same marker states-css uses). */
101
+ export const WRAPPER_ATTR = '[data-block-wrapper]';
102
+ //# sourceMappingURL=scoped-css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scoped-css.js","sourceRoot":"","sources":["../../src/render/scoped-css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAIH,4FAA4F;AAC5F,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AACrC,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7D,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,WAAW,CAAC,EAAU;IACpC,OAAO,mBAAmB,WAAW,CAAC,EAAE,CAAC,IAAI,CAAA;AAC/C,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,SAAkB;IAC7C,OAAO,SAAS,CAAC,CAAC,CAAC,qBAAqB,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAA;AAC1F,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,EAAU,EAAE,SAAkB;IAC1D,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE,CAAA;AACxD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAwB,EACxB,UAAoC;IAEpC,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,MAAM,IAAI,GAAG,CAAC,KAAY,EAAQ,EAAE;QAClC,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;QACxB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ;gBAAE,IAAI,CAAC,KAAK,CAAC,CAAA;QACjD,CAAC;IACH,CAAC,CAAA;IACD,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,IAAI,CAAC,KAAK,CAAC,CAAA;IACvC,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,CAAU,CAAA;AAEvF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,QAAQ;IACR,WAAW;IACX,aAAa;IACb,cAAc;IACd,YAAY;IACZ,UAAU;IACV,UAAU;IACV,GAAG,eAAe;CACV,CAAA;AAEV,sGAAsG;AACtG,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAA"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Shell selection — the state a SPLIT shell runs on.
3
+ *
4
+ * WHY THIS IS IN THE RUNTIME AND NOT IN THE BLOCK. A split surface (list on the
5
+ * left, detail on the right) has exactly one piece of state: which item is
6
+ * selected. Kept inside the block it is invisible to everything else — the URL
7
+ * does not move, so the page cannot be linked to, the browser Back button does
8
+ * nothing, and a second block on the same surface (a header showing the
9
+ * selected record's title, a toolbar acting on it) has no way to read it.
10
+ *
11
+ * So selection is a SURFACE-level fact with a URL projection:
12
+ *
13
+ * ?<key>=<itemId>
14
+ *
15
+ * and this module is the single place that reads and writes it.
16
+ *
17
+ * THE URL IS THE SOURCE OF TRUTH when syncing is on. React state mirrors it
18
+ * rather than the other way round, which is what makes a pasted link, a Back
19
+ * press and a click on the list all land in the same place — three paths, one
20
+ * rule.
21
+ *
22
+ * INERT HOSTS DO NOT NAVIGATE. An editor or preview canvas renders the same
23
+ * block with `interactionMode: 'inert'`; there the selection stays in memory and
24
+ * the host's own URL is never touched. That mirrors the existing rule for blocks
25
+ * that navigate or write data.
26
+ */
27
+ import * as React from 'react';
28
+ type Listener = () => void;
29
+ export interface ShellSelectionStore {
30
+ /** Current selection for a key, or undefined when nothing is selected. */
31
+ get(key: string): string | undefined;
32
+ /** Select an item. Writes the URL when this store syncs. */
33
+ set(key: string, id: string | undefined): void;
34
+ subscribe(listener: Listener): () => void;
35
+ readonly syncUrl: boolean;
36
+ }
37
+ /**
38
+ * Create a selection store.
39
+ *
40
+ * `syncUrl: false` gives an in-memory store with identical semantics — the same
41
+ * hook, the same cross-block sharing, no address-bar side effects.
42
+ */
43
+ export declare function createShellSelectionStore(syncUrl: boolean): ShellSelectionStore;
44
+ export declare const ShellSelectionContext: React.Context<ShellSelectionStore | null>;
45
+ export interface ShellSelectionProviderProps {
46
+ /** Off for editor/preview canvases — selection works, the address bar does not move. */
47
+ readonly syncUrl?: boolean;
48
+ readonly children: React.ReactNode;
49
+ }
50
+ export declare function ShellSelectionProvider({ syncUrl, children, }: ShellSelectionProviderProps): React.ReactElement;
51
+ export interface ShellSelectionOptions {
52
+ /** Selected when the URL carries nothing — normally the first list item. */
53
+ readonly fallback?: string | undefined;
54
+ /**
55
+ * Override the provider. A block rendered inert must not move the host's URL
56
+ * even when the surrounding surface is live.
57
+ */
58
+ readonly syncUrl?: boolean;
59
+ }
60
+ /**
61
+ * Read and write the shell selection for `key`.
62
+ *
63
+ * Works with OR without a provider: with no `ShellSelectionProvider` above it,
64
+ * the hook makes its own store, so a block dropped into a bare React tree keeps
65
+ * behaving instead of throwing. The provider only widens the scope — one store
66
+ * per surface means two blocks reading the same key see the same value.
67
+ */
68
+ export declare function useShellSelection(key: string, options?: ShellSelectionOptions): readonly [string | undefined, (id: string | undefined) => void];
69
+ export {};
70
+ //# sourceMappingURL=shell-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-selection.d.ts","sourceRoot":"","sources":["../../src/render/shell-selection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAA;AAE1B,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACpC,4DAA4D;IAC5D,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAC9C,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAA;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B;AAQD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,mBAAmB,CAuC/E;AAMD,eAAO,MAAM,qBAAqB,2CAAwD,CAAA;AAE1F,MAAM,WAAW,2BAA2B;IAC1C,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CACnC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,OAAc,EACd,QAAQ,GACT,EAAE,2BAA2B,GAAG,KAAK,CAAC,YAAY,CAGlD;AAMD,MAAM,WAAW,qBAAqB;IACpC,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,qBAA0B,GAClC,SAAS,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC,CA4BjE"}
@@ -0,0 +1,117 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Shell selection — the state a SPLIT shell runs on.
4
+ *
5
+ * WHY THIS IS IN THE RUNTIME AND NOT IN THE BLOCK. A split surface (list on the
6
+ * left, detail on the right) has exactly one piece of state: which item is
7
+ * selected. Kept inside the block it is invisible to everything else — the URL
8
+ * does not move, so the page cannot be linked to, the browser Back button does
9
+ * nothing, and a second block on the same surface (a header showing the
10
+ * selected record's title, a toolbar acting on it) has no way to read it.
11
+ *
12
+ * So selection is a SURFACE-level fact with a URL projection:
13
+ *
14
+ * ?<key>=<itemId>
15
+ *
16
+ * and this module is the single place that reads and writes it.
17
+ *
18
+ * THE URL IS THE SOURCE OF TRUTH when syncing is on. React state mirrors it
19
+ * rather than the other way round, which is what makes a pasted link, a Back
20
+ * press and a click on the list all land in the same place — three paths, one
21
+ * rule.
22
+ *
23
+ * INERT HOSTS DO NOT NAVIGATE. An editor or preview canvas renders the same
24
+ * block with `interactionMode: 'inert'`; there the selection stays in memory and
25
+ * the host's own URL is never touched. That mirrors the existing rule for blocks
26
+ * that navigate or write data.
27
+ */
28
+ import * as React from 'react';
29
+ function readFromUrl(key) {
30
+ if (typeof window === 'undefined')
31
+ return undefined;
32
+ const value = new URLSearchParams(window.location.search).get(key);
33
+ return value === null || value === '' ? undefined : value;
34
+ }
35
+ /**
36
+ * Create a selection store.
37
+ *
38
+ * `syncUrl: false` gives an in-memory store with identical semantics — the same
39
+ * hook, the same cross-block sharing, no address-bar side effects.
40
+ */
41
+ export function createShellSelectionStore(syncUrl) {
42
+ const memory = new Map();
43
+ const listeners = new Set();
44
+ const emit = () => {
45
+ for (const l of [...listeners])
46
+ l();
47
+ };
48
+ if (syncUrl && typeof window !== 'undefined') {
49
+ window.addEventListener('popstate', emit);
50
+ }
51
+ return {
52
+ syncUrl,
53
+ get(key) {
54
+ // URL first: a Back press changes the address without going through
55
+ // `set`, so reading memory would serve a stale value.
56
+ if (syncUrl)
57
+ return readFromUrl(key) ?? memory.get(key);
58
+ return memory.get(key);
59
+ },
60
+ set(key, id) {
61
+ memory.set(key, id);
62
+ if (syncUrl && typeof window !== 'undefined') {
63
+ const url = new URL(window.location.href);
64
+ if (id === undefined)
65
+ url.searchParams.delete(key);
66
+ else
67
+ url.searchParams.set(key, id);
68
+ // pushState, not replaceState: selecting a record is a navigation the
69
+ // user expects Back to undo. That is the whole point of putting it in
70
+ // the URL rather than in a ref.
71
+ if (url.href !== window.location.href)
72
+ window.history.pushState({}, '', url);
73
+ }
74
+ emit();
75
+ },
76
+ subscribe(listener) {
77
+ listeners.add(listener);
78
+ return () => {
79
+ listeners.delete(listener);
80
+ };
81
+ },
82
+ };
83
+ }
84
+ // ============================================================
85
+ // CONTEXT
86
+ // ============================================================
87
+ export const ShellSelectionContext = React.createContext(null);
88
+ export function ShellSelectionProvider({ syncUrl = true, children, }) {
89
+ const store = React.useMemo(() => createShellSelectionStore(syncUrl), [syncUrl]);
90
+ return _jsx(ShellSelectionContext.Provider, { value: store, children: children });
91
+ }
92
+ /**
93
+ * Read and write the shell selection for `key`.
94
+ *
95
+ * Works with OR without a provider: with no `ShellSelectionProvider` above it,
96
+ * the hook makes its own store, so a block dropped into a bare React tree keeps
97
+ * behaving instead of throwing. The provider only widens the scope — one store
98
+ * per surface means two blocks reading the same key see the same value.
99
+ */
100
+ export function useShellSelection(key, options = {}) {
101
+ const provided = React.useContext(ShellSelectionContext);
102
+ const wantsSync = options.syncUrl ?? provided?.syncUrl ?? true;
103
+ // A provider whose sync setting disagrees with this block's is not usable —
104
+ // an inert block inside a live surface must not push history.
105
+ const usable = provided && provided.syncUrl === wantsSync ? provided : null;
106
+ const fallbackStore = React.useMemo(() => (usable ? null : createShellSelectionStore(wantsSync)), [usable, wantsSync]);
107
+ const store = usable ?? fallbackStore;
108
+ const subscribe = React.useCallback((l) => store.subscribe(l), [store]);
109
+ const selected = React.useSyncExternalStore(subscribe, () => store.get(key),
110
+ // Server render: no URL, no memory — the fallback is the honest answer.
111
+ () => undefined);
112
+ const select = React.useCallback((id) => {
113
+ store.set(key, id);
114
+ }, [store, key]);
115
+ return [selected ?? options.fallback, select];
116
+ }
117
+ //# sourceMappingURL=shell-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell-selection.js","sourceRoot":"","sources":["../../src/render/shell-selection.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAiB9B,SAAS,WAAW,CAAC,GAAW;IAC9B,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,SAAS,CAAA;IACnD,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAClE,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAA;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,MAAM,GAAG,IAAI,GAAG,EAA8B,CAAA;IACpD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAY,CAAA;IACrC,MAAM,IAAI,GAAG,GAAS,EAAE;QACtB,KAAK,MAAM,CAAC,IAAI,CAAC,G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CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACjF,MAAM,QAAQ,GAAG,KAAK,CAAC,oBAAoB,CACzC,SAAS,EACT,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACpB,wEAAwE;IACxE,GAAG,EAAE,CAAC,SAAS,CAChB,CAAA;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAC9B,CAAC,EAAsB,EAAE,EAAE;QACzB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACpB,CAAC,EACD,CAAC,KAAK,EAAE,GAAG,CAAC,CACb,CAAA;IAED,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAU,CAAA;AACxD,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Interaction-state CSS generation (token-driven hover/active/focus).
3
+ *
4
+ * `block.style` sits inline and cannot express pseudo-classes, so per-state
5
+ * styling lives in `block.states` and the runtime emits scoped CSS rules —
6
+ * keyed by the block's `data-block-id` — into the surface's generated
7
+ * `<style>` (the SAME mechanism `layout.hideOn`/`showOn` use). For a block
8
+ * with `states`, the runtime emits:
9
+ *
10
+ * `[data-pw-surface] [data-block-id="<id>"]:hover{ … }`
11
+ * `[data-pw-surface] [data-block-id="<id>"]:active{ … }`
12
+ * `[data-pw-surface] [data-block-id="<id>"]:focus-visible{ … }`
13
+ *
14
+ * Keys are CSS camelCase property names (converted to kebab-case); values pass
15
+ * through untouched, so `var(--pw-color-primary-subtle)` works. Blocks without
16
+ * `states` emit zero bytes so existing surfaces are byte-identical.
17
+ *
18
+ * @module @pwfabric/runtime/render/states-css
19
+ */
20
+ import type { Block } from '@pwfabric/core';
21
+ /**
22
+ * Emit the scoped CSS rule(s) for a single block's interaction states. Targets
23
+ * `[data-block-id="<id>"]<pseudo>` scoped under the surface root so it cannot
24
+ * leak to the host page. Returns '' when the block declares no non-empty state.
25
+ */
26
+ export declare function blockStatesCss(blockId: string, states: NonNullable<Block['states']>, surfaceId?: string): string;
27
+ /**
28
+ * Walk a surface block tree and concatenate the per-block interaction-state CSS
29
+ * for every block declaring `states`. Blocks without `states` are skipped (zero
30
+ * bytes emitted) so existing surfaces are byte-identical.
31
+ */
32
+ export declare function collectStatesCss(blocks: readonly Block[], surfaceId?: string): string;
33
+ //# sourceMappingURL=states-css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"states-css.d.ts","sourceRoot":"","sources":["../../src/render/states-css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAiB3C;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAeR;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAIrF"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Interaction-state CSS generation (token-driven hover/active/focus).
3
+ *
4
+ * `block.style` sits inline and cannot express pseudo-classes, so per-state
5
+ * styling lives in `block.states` and the runtime emits scoped CSS rules —
6
+ * keyed by the block's `data-block-id` — into the surface's generated
7
+ * `<style>` (the SAME mechanism `layout.hideOn`/`showOn` use). For a block
8
+ * with `states`, the runtime emits:
9
+ *
10
+ * `[data-pw-surface] [data-block-id="<id>"]:hover{ … }`
11
+ * `[data-pw-surface] [data-block-id="<id>"]:active{ … }`
12
+ * `[data-pw-surface] [data-block-id="<id>"]:focus-visible{ … }`
13
+ *
14
+ * Keys are CSS camelCase property names (converted to kebab-case); values pass
15
+ * through untouched, so `var(--pw-color-primary-subtle)` works. Blocks without
16
+ * `states` emit zero bytes so existing surfaces are byte-identical.
17
+ *
18
+ * @module @pwfabric/runtime/render/states-css
19
+ */
20
+ import { blockSelector, camelToKebab, collectScopedCss } from './scoped-css.js';
21
+ /** Pseudo-state → selector suffix. `focus` maps to `:focus-visible`. */
22
+ const STATE_SELECTORS = {
23
+ hover: ':hover',
24
+ active: ':active',
25
+ focus: ':focus-visible',
26
+ };
27
+ /** Serialize a camelCase decl record to `prop:value;…` (values pass through). */
28
+ function declsToCss(decls) {
29
+ return Object.entries(decls)
30
+ .map(([prop, value]) => `${camelToKebab(prop)}:${value}`)
31
+ .join(';');
32
+ }
33
+ /**
34
+ * Emit the scoped CSS rule(s) for a single block's interaction states. Targets
35
+ * `[data-block-id="<id>"]<pseudo>` scoped under the surface root so it cannot
36
+ * leak to the host page. Returns '' when the block declares no non-empty state.
37
+ */
38
+ export function blockStatesCss(blockId, states, surfaceId) {
39
+ const selector = blockSelector(blockId, surfaceId);
40
+ let css = '';
41
+ for (const key of ['hover', 'active', 'focus']) {
42
+ const decls = states[key];
43
+ if (!decls || Object.keys(decls).length === 0)
44
+ continue;
45
+ // `data-block-id` lives on BOTH the renderer wrapper and the component root
46
+ // (the wrapper keeps `data-block-wrapper`). A state rule keyed on the bare
47
+ // id therefore fired twice: the square wrapper took the hover box-shadow
48
+ // (square corners bleeding out from under a rounded card) and transforms
49
+ // compounded. Exclude the wrapper — visual states belong to the styled
50
+ // component root only.
51
+ css += `${selector}:not([data-block-wrapper])${STATE_SELECTORS[key]}{${declsToCss(decls)}}`;
52
+ }
53
+ return css;
54
+ }
55
+ /**
56
+ * Walk a surface block tree and concatenate the per-block interaction-state CSS
57
+ * for every block declaring `states`. Blocks without `states` are skipped (zero
58
+ * bytes emitted) so existing surfaces are byte-identical.
59
+ */
60
+ export function collectStatesCss(blocks, surfaceId) {
61
+ return collectScopedCss(blocks, (block) => block.states ? blockStatesCss(block.id, block.states, surfaceId) : '');
62
+ }
63
+ //# sourceMappingURL=states-css.js.map
@@ -0,0 +1 @@
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