@shadow-js/core 0.1.0 → 1.0.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 (387) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +2 -2
  3. package/README.md +134 -331
  4. package/dist/dev/action.d.ts +34 -0
  5. package/dist/dev/action.js +89 -0
  6. package/dist/dev/action.js.map +1 -0
  7. package/dist/dev/cache.d.ts +33 -0
  8. package/dist/dev/cache.js +61 -0
  9. package/dist/dev/cache.js.map +1 -0
  10. package/dist/dev/context.d.ts +104 -0
  11. package/dist/dev/context.js +110 -0
  12. package/dist/dev/context.js.map +1 -0
  13. package/dist/dev/effect.d.ts +120 -0
  14. package/dist/dev/effect.js +110 -0
  15. package/dist/dev/effect.js.map +1 -0
  16. package/dist/dev/env.d.ts +27 -0
  17. package/dist/dev/env.js +30 -0
  18. package/dist/dev/env.js.map +1 -0
  19. package/dist/dev/events.d.ts +26 -0
  20. package/dist/dev/events.js +32 -0
  21. package/dist/dev/events.js.map +1 -0
  22. package/dist/dev/extend/index.d.ts +329 -0
  23. package/dist/dev/extend/index.js +316 -0
  24. package/dist/dev/extend/index.js.map +1 -0
  25. package/dist/dev/external-store.d.ts +58 -0
  26. package/dist/dev/external-store.js +59 -0
  27. package/dist/dev/external-store.js.map +1 -0
  28. package/dist/dev/index.d.ts +29 -0
  29. package/dist/dev/index.js +26 -0
  30. package/dist/dev/internal/concurrency.d.ts +211 -0
  31. package/dist/dev/internal/concurrency.js +631 -0
  32. package/dist/dev/internal/concurrency.js.map +1 -0
  33. package/dist/dev/internal/devtools.d.ts +69 -0
  34. package/dist/dev/internal/devtools.js +76 -0
  35. package/dist/dev/internal/devtools.js.map +1 -0
  36. package/dist/dev/internal/diagnostics.d.ts +88 -0
  37. package/dist/dev/internal/diagnostics.js +101 -0
  38. package/dist/dev/internal/diagnostics.js.map +1 -0
  39. package/dist/dev/internal/dispose.d.ts +26 -0
  40. package/dist/dev/internal/dispose.js +48 -0
  41. package/dist/dev/internal/dispose.js.map +1 -0
  42. package/dist/dev/internal/flags.js +10 -0
  43. package/dist/dev/internal/flags.js.map +1 -0
  44. package/dist/dev/internal/graph.d.ts +231 -0
  45. package/dist/dev/internal/graph.js +577 -0
  46. package/dist/dev/internal/graph.js.map +1 -0
  47. package/dist/dev/internal/hydration-flag.d.ts +31 -0
  48. package/dist/dev/internal/hydration-flag.js +45 -0
  49. package/dist/dev/internal/hydration-flag.js.map +1 -0
  50. package/dist/dev/internal/messages.d.ts +54 -0
  51. package/dist/dev/internal/messages.js +53 -0
  52. package/dist/dev/internal/messages.js.map +1 -0
  53. package/dist/dev/internal/owner.d.ts +140 -0
  54. package/dist/dev/internal/owner.js +289 -0
  55. package/dist/dev/internal/owner.js.map +1 -0
  56. package/dist/dev/internal/queue.js +45 -0
  57. package/dist/dev/internal/queue.js.map +1 -0
  58. package/dist/dev/internal/scheduler.d.ts +111 -0
  59. package/dist/dev/internal/scheduler.js +286 -0
  60. package/dist/dev/internal/scheduler.js.map +1 -0
  61. package/dist/dev/internal/state.d.ts +139 -0
  62. package/dist/dev/internal/state.js +27 -0
  63. package/dist/dev/internal/state.js.map +1 -0
  64. package/dist/dev/internal/suspension.d.ts +41 -0
  65. package/dist/dev/internal/suspension.js +44 -0
  66. package/dist/dev/internal/suspension.js.map +1 -0
  67. package/dist/dev/internal/types.d.ts +44 -0
  68. package/dist/dev/list.d.ts +91 -0
  69. package/dist/dev/list.js +281 -0
  70. package/dist/dev/list.js.map +1 -0
  71. package/dist/dev/memo.d.ts +58 -0
  72. package/dist/dev/memo.js +40 -0
  73. package/dist/dev/memo.js.map +1 -0
  74. package/dist/dev/optimistic.d.ts +24 -0
  75. package/dist/dev/optimistic.js +44 -0
  76. package/dist/dev/optimistic.js.map +1 -0
  77. package/dist/dev/ownership.d.ts +202 -0
  78. package/dist/dev/ownership.js +260 -0
  79. package/dist/dev/ownership.js.map +1 -0
  80. package/dist/dev/props.d.ts +132 -0
  81. package/dist/dev/props.js +281 -0
  82. package/dist/dev/props.js.map +1 -0
  83. package/dist/dev/reaction.d.ts +27 -0
  84. package/dist/dev/reaction.js +60 -0
  85. package/dist/dev/reaction.js.map +1 -0
  86. package/dist/dev/reducer.d.ts +39 -0
  87. package/dist/dev/reducer.js +38 -0
  88. package/dist/dev/reducer.js.map +1 -0
  89. package/dist/dev/refs.d.ts +50 -0
  90. package/dist/dev/refs.js +57 -0
  91. package/dist/dev/refs.js.map +1 -0
  92. package/dist/dev/resource.d.ts +133 -0
  93. package/dist/dev/resource.js +176 -0
  94. package/dist/dev/resource.js.map +1 -0
  95. package/dist/dev/selector.d.ts +32 -0
  96. package/dist/dev/selector.js +117 -0
  97. package/dist/dev/selector.js.map +1 -0
  98. package/dist/dev/signal.d.ts +40 -0
  99. package/dist/dev/signal.js +38 -0
  100. package/dist/dev/signal.js.map +1 -0
  101. package/dist/dev/store/index.d.ts +5 -0
  102. package/dist/dev/store/index.js +4 -0
  103. package/dist/dev/store/nodes.js +191 -0
  104. package/dist/dev/store/nodes.js.map +1 -0
  105. package/dist/dev/store/proxies.js +159 -0
  106. package/dist/dev/store/proxies.js.map +1 -0
  107. package/dist/dev/store/read.d.ts +37 -0
  108. package/dist/dev/store/read.js +71 -0
  109. package/dist/dev/store/read.js.map +1 -0
  110. package/dist/dev/store/reconcile.d.ts +71 -0
  111. package/dist/dev/store/reconcile.js +185 -0
  112. package/dist/dev/store/reconcile.js.map +1 -0
  113. package/dist/dev/store/types.d.ts +104 -0
  114. package/dist/dev/store/use-store.d.ts +58 -0
  115. package/dist/dev/store/use-store.js +167 -0
  116. package/dist/dev/store/use-store.js.map +1 -0
  117. package/dist/dev/suspense.d.ts +99 -0
  118. package/dist/dev/suspense.js +44 -0
  119. package/dist/dev/suspense.js.map +1 -0
  120. package/dist/dev/transitions.d.ts +75 -0
  121. package/dist/dev/transitions.js +100 -0
  122. package/dist/dev/transitions.js.map +1 -0
  123. package/dist/prod/action.js +2 -0
  124. package/dist/prod/action.js.map +1 -0
  125. package/dist/prod/cache.js +2 -0
  126. package/dist/prod/cache.js.map +1 -0
  127. package/dist/prod/context.js +2 -0
  128. package/dist/prod/context.js.map +1 -0
  129. package/dist/prod/effect.js +2 -0
  130. package/dist/prod/effect.js.map +1 -0
  131. package/dist/prod/env.js +2 -0
  132. package/dist/prod/env.js.map +1 -0
  133. package/dist/prod/events.js +2 -0
  134. package/dist/prod/events.js.map +1 -0
  135. package/dist/prod/extend/index.js +2 -0
  136. package/dist/prod/extend/index.js.map +1 -0
  137. package/dist/prod/external-store.js +2 -0
  138. package/dist/prod/external-store.js.map +1 -0
  139. package/dist/prod/index.js +1 -0
  140. package/dist/prod/internal/concurrency.js +2 -0
  141. package/dist/prod/internal/concurrency.js.map +1 -0
  142. package/dist/prod/internal/devtools.js +2 -0
  143. package/dist/prod/internal/devtools.js.map +1 -0
  144. package/dist/prod/internal/diagnostics.js +2 -0
  145. package/dist/prod/internal/diagnostics.js.map +1 -0
  146. package/dist/prod/internal/dispose.js +2 -0
  147. package/dist/prod/internal/dispose.js.map +1 -0
  148. package/dist/prod/internal/flags.js +2 -0
  149. package/dist/prod/internal/flags.js.map +1 -0
  150. package/dist/prod/internal/graph.js +2 -0
  151. package/dist/prod/internal/graph.js.map +1 -0
  152. package/dist/prod/internal/hydration-flag.js +2 -0
  153. package/dist/prod/internal/hydration-flag.js.map +1 -0
  154. package/dist/prod/internal/messages.js +2 -0
  155. package/dist/prod/internal/messages.js.map +1 -0
  156. package/dist/prod/internal/owner.js +2 -0
  157. package/dist/prod/internal/owner.js.map +1 -0
  158. package/dist/prod/internal/queue.js +2 -0
  159. package/dist/prod/internal/queue.js.map +1 -0
  160. package/dist/prod/internal/scheduler.js +2 -0
  161. package/dist/prod/internal/scheduler.js.map +1 -0
  162. package/dist/prod/internal/state.js +2 -0
  163. package/dist/prod/internal/state.js.map +1 -0
  164. package/dist/prod/internal/suspension.js +2 -0
  165. package/dist/prod/internal/suspension.js.map +1 -0
  166. package/dist/prod/list.js +2 -0
  167. package/dist/prod/list.js.map +1 -0
  168. package/dist/prod/memo.js +2 -0
  169. package/dist/prod/memo.js.map +1 -0
  170. package/dist/prod/optimistic.js +2 -0
  171. package/dist/prod/optimistic.js.map +1 -0
  172. package/dist/prod/ownership.js +2 -0
  173. package/dist/prod/ownership.js.map +1 -0
  174. package/dist/prod/props.js +2 -0
  175. package/dist/prod/props.js.map +1 -0
  176. package/dist/prod/reaction.js +2 -0
  177. package/dist/prod/reaction.js.map +1 -0
  178. package/dist/prod/reducer.js +2 -0
  179. package/dist/prod/reducer.js.map +1 -0
  180. package/dist/prod/refs.js +2 -0
  181. package/dist/prod/refs.js.map +1 -0
  182. package/dist/prod/resource.js +2 -0
  183. package/dist/prod/resource.js.map +1 -0
  184. package/dist/prod/selector.js +2 -0
  185. package/dist/prod/selector.js.map +1 -0
  186. package/dist/prod/signal.js +2 -0
  187. package/dist/prod/signal.js.map +1 -0
  188. package/dist/prod/store/index.js +1 -0
  189. package/dist/prod/store/nodes.js +2 -0
  190. package/dist/prod/store/nodes.js.map +1 -0
  191. package/dist/prod/store/proxies.js +2 -0
  192. package/dist/prod/store/proxies.js.map +1 -0
  193. package/dist/prod/store/read.js +2 -0
  194. package/dist/prod/store/read.js.map +1 -0
  195. package/dist/prod/store/reconcile.js +2 -0
  196. package/dist/prod/store/reconcile.js.map +1 -0
  197. package/dist/prod/store/use-store.js +2 -0
  198. package/dist/prod/store/use-store.js.map +1 -0
  199. package/dist/prod/suspense.js +2 -0
  200. package/dist/prod/suspense.js.map +1 -0
  201. package/dist/prod/transitions.js +2 -0
  202. package/dist/prod/transitions.js.map +1 -0
  203. package/dist/server/action.js +2 -0
  204. package/dist/server/action.js.map +1 -0
  205. package/dist/server/cache.js +2 -0
  206. package/dist/server/cache.js.map +1 -0
  207. package/dist/server/context.js +2 -0
  208. package/dist/server/context.js.map +1 -0
  209. package/dist/server/effect.js +2 -0
  210. package/dist/server/effect.js.map +1 -0
  211. package/dist/server/env.js +2 -0
  212. package/dist/server/env.js.map +1 -0
  213. package/dist/server/events.js +2 -0
  214. package/dist/server/events.js.map +1 -0
  215. package/dist/server/extend/index.js +2 -0
  216. package/dist/server/extend/index.js.map +1 -0
  217. package/dist/server/external-store.js +2 -0
  218. package/dist/server/external-store.js.map +1 -0
  219. package/dist/server/index.js +1 -0
  220. package/dist/server/internal/concurrency.js +2 -0
  221. package/dist/server/internal/concurrency.js.map +1 -0
  222. package/dist/server/internal/devtools.js +2 -0
  223. package/dist/server/internal/devtools.js.map +1 -0
  224. package/dist/server/internal/diagnostics.js +2 -0
  225. package/dist/server/internal/diagnostics.js.map +1 -0
  226. package/dist/server/internal/dispose.js +2 -0
  227. package/dist/server/internal/dispose.js.map +1 -0
  228. package/dist/server/internal/flags.js +2 -0
  229. package/dist/server/internal/flags.js.map +1 -0
  230. package/dist/server/internal/graph.js +2 -0
  231. package/dist/server/internal/graph.js.map +1 -0
  232. package/dist/server/internal/hydration-flag.js +2 -0
  233. package/dist/server/internal/hydration-flag.js.map +1 -0
  234. package/dist/server/internal/messages.js +2 -0
  235. package/dist/server/internal/messages.js.map +1 -0
  236. package/dist/server/internal/owner.js +2 -0
  237. package/dist/server/internal/owner.js.map +1 -0
  238. package/dist/server/internal/queue.js +2 -0
  239. package/dist/server/internal/queue.js.map +1 -0
  240. package/dist/server/internal/scheduler.js +2 -0
  241. package/dist/server/internal/scheduler.js.map +1 -0
  242. package/dist/server/internal/state.js +2 -0
  243. package/dist/server/internal/state.js.map +1 -0
  244. package/dist/server/internal/suspension.js +2 -0
  245. package/dist/server/internal/suspension.js.map +1 -0
  246. package/dist/server/list.js +2 -0
  247. package/dist/server/list.js.map +1 -0
  248. package/dist/server/memo.js +2 -0
  249. package/dist/server/memo.js.map +1 -0
  250. package/dist/server/optimistic.js +2 -0
  251. package/dist/server/optimistic.js.map +1 -0
  252. package/dist/server/ownership.js +2 -0
  253. package/dist/server/ownership.js.map +1 -0
  254. package/dist/server/props.js +2 -0
  255. package/dist/server/props.js.map +1 -0
  256. package/dist/server/reaction.js +2 -0
  257. package/dist/server/reaction.js.map +1 -0
  258. package/dist/server/reducer.js +2 -0
  259. package/dist/server/reducer.js.map +1 -0
  260. package/dist/server/refs.js +2 -0
  261. package/dist/server/refs.js.map +1 -0
  262. package/dist/server/resource.js +2 -0
  263. package/dist/server/resource.js.map +1 -0
  264. package/dist/server/selector.js +2 -0
  265. package/dist/server/selector.js.map +1 -0
  266. package/dist/server/signal.js +2 -0
  267. package/dist/server/signal.js.map +1 -0
  268. package/dist/server/store/index.js +1 -0
  269. package/dist/server/store/nodes.js +2 -0
  270. package/dist/server/store/nodes.js.map +1 -0
  271. package/dist/server/store/proxies.js +2 -0
  272. package/dist/server/store/proxies.js.map +1 -0
  273. package/dist/server/store/read.js +2 -0
  274. package/dist/server/store/read.js.map +1 -0
  275. package/dist/server/store/reconcile.js +2 -0
  276. package/dist/server/store/reconcile.js.map +1 -0
  277. package/dist/server/store/use-store.js +2 -0
  278. package/dist/server/store/use-store.js.map +1 -0
  279. package/dist/server/suspense.js +2 -0
  280. package/dist/server/suspense.js.map +1 -0
  281. package/dist/server/transitions.js +2 -0
  282. package/dist/server/transitions.js.map +1 -0
  283. package/dist/server-dev/action.js +89 -0
  284. package/dist/server-dev/action.js.map +1 -0
  285. package/dist/server-dev/cache.js +61 -0
  286. package/dist/server-dev/cache.js.map +1 -0
  287. package/dist/server-dev/context.js +107 -0
  288. package/dist/server-dev/context.js.map +1 -0
  289. package/dist/server-dev/effect.js +55 -0
  290. package/dist/server-dev/effect.js.map +1 -0
  291. package/dist/server-dev/env.js +30 -0
  292. package/dist/server-dev/env.js.map +1 -0
  293. package/dist/server-dev/events.js +32 -0
  294. package/dist/server-dev/events.js.map +1 -0
  295. package/dist/server-dev/extend/index.js +316 -0
  296. package/dist/server-dev/extend/index.js.map +1 -0
  297. package/dist/server-dev/external-store.js +45 -0
  298. package/dist/server-dev/external-store.js.map +1 -0
  299. package/dist/server-dev/index.js +26 -0
  300. package/dist/server-dev/internal/concurrency.js +632 -0
  301. package/dist/server-dev/internal/concurrency.js.map +1 -0
  302. package/dist/server-dev/internal/devtools.js +76 -0
  303. package/dist/server-dev/internal/devtools.js.map +1 -0
  304. package/dist/server-dev/internal/diagnostics.js +101 -0
  305. package/dist/server-dev/internal/diagnostics.js.map +1 -0
  306. package/dist/server-dev/internal/dispose.js +48 -0
  307. package/dist/server-dev/internal/dispose.js.map +1 -0
  308. package/dist/server-dev/internal/flags.js +10 -0
  309. package/dist/server-dev/internal/flags.js.map +1 -0
  310. package/dist/server-dev/internal/graph.js +577 -0
  311. package/dist/server-dev/internal/graph.js.map +1 -0
  312. package/dist/server-dev/internal/hydration-flag.js +45 -0
  313. package/dist/server-dev/internal/hydration-flag.js.map +1 -0
  314. package/dist/server-dev/internal/messages.js +53 -0
  315. package/dist/server-dev/internal/messages.js.map +1 -0
  316. package/dist/server-dev/internal/owner.js +289 -0
  317. package/dist/server-dev/internal/owner.js.map +1 -0
  318. package/dist/server-dev/internal/queue.js +45 -0
  319. package/dist/server-dev/internal/queue.js.map +1 -0
  320. package/dist/server-dev/internal/scheduler.js +286 -0
  321. package/dist/server-dev/internal/scheduler.js.map +1 -0
  322. package/dist/server-dev/internal/state.js +27 -0
  323. package/dist/server-dev/internal/state.js.map +1 -0
  324. package/dist/server-dev/internal/suspension.js +44 -0
  325. package/dist/server-dev/internal/suspension.js.map +1 -0
  326. package/dist/server-dev/list.js +281 -0
  327. package/dist/server-dev/list.js.map +1 -0
  328. package/dist/server-dev/memo.js +40 -0
  329. package/dist/server-dev/memo.js.map +1 -0
  330. package/dist/server-dev/optimistic.js +44 -0
  331. package/dist/server-dev/optimistic.js.map +1 -0
  332. package/dist/server-dev/ownership.js +260 -0
  333. package/dist/server-dev/ownership.js.map +1 -0
  334. package/dist/server-dev/props.js +281 -0
  335. package/dist/server-dev/props.js.map +1 -0
  336. package/dist/server-dev/reaction.js +60 -0
  337. package/dist/server-dev/reaction.js.map +1 -0
  338. package/dist/server-dev/reducer.js +38 -0
  339. package/dist/server-dev/reducer.js.map +1 -0
  340. package/dist/server-dev/refs.js +57 -0
  341. package/dist/server-dev/refs.js.map +1 -0
  342. package/dist/server-dev/resource.js +175 -0
  343. package/dist/server-dev/resource.js.map +1 -0
  344. package/dist/server-dev/selector.js +81 -0
  345. package/dist/server-dev/selector.js.map +1 -0
  346. package/dist/server-dev/signal.js +38 -0
  347. package/dist/server-dev/signal.js.map +1 -0
  348. package/dist/server-dev/store/index.js +4 -0
  349. package/dist/server-dev/store/nodes.js +191 -0
  350. package/dist/server-dev/store/nodes.js.map +1 -0
  351. package/dist/server-dev/store/proxies.js +159 -0
  352. package/dist/server-dev/store/proxies.js.map +1 -0
  353. package/dist/server-dev/store/read.js +71 -0
  354. package/dist/server-dev/store/read.js.map +1 -0
  355. package/dist/server-dev/store/reconcile.js +185 -0
  356. package/dist/server-dev/store/reconcile.js.map +1 -0
  357. package/dist/server-dev/store/use-store.js +167 -0
  358. package/dist/server-dev/store/use-store.js.map +1 -0
  359. package/dist/server-dev/suspense.js +44 -0
  360. package/dist/server-dev/suspense.js.map +1 -0
  361. package/dist/server-dev/transitions.js +85 -0
  362. package/dist/server-dev/transitions.js.map +1 -0
  363. package/package.json +111 -50
  364. package/dist/chunk-6Y3CCWOY.js +0 -887
  365. package/dist/chunk-6Y3CCWOY.js.map +0 -1
  366. package/dist/chunk-B5FTYDUG.js +0 -3
  367. package/dist/chunk-B5FTYDUG.js.map +0 -1
  368. package/dist/index.cjs +0 -2000
  369. package/dist/index.cjs.map +0 -1
  370. package/dist/index.d.cts +0 -609
  371. package/dist/index.d.ts +0 -609
  372. package/dist/index.js +0 -1094
  373. package/dist/index.js.map +0 -1
  374. package/dist/jsx-Bugil6CJ.d.cts +0 -151
  375. package/dist/jsx-Bugil6CJ.d.ts +0 -151
  376. package/dist/jsx-dev-runtime.cjs +0 -742
  377. package/dist/jsx-dev-runtime.cjs.map +0 -1
  378. package/dist/jsx-dev-runtime.d.cts +0 -2
  379. package/dist/jsx-dev-runtime.d.ts +0 -2
  380. package/dist/jsx-dev-runtime.js +0 -4
  381. package/dist/jsx-dev-runtime.js.map +0 -1
  382. package/dist/jsx-runtime.cjs +0 -742
  383. package/dist/jsx-runtime.cjs.map +0 -1
  384. package/dist/jsx-runtime.d.cts +0 -36
  385. package/dist/jsx-runtime.d.ts +0 -36
  386. package/dist/jsx-runtime.js +0 -4
  387. package/dist/jsx-runtime.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concurrency.js","names":[],"sources":["../../../src/internal/concurrency.ts"],"sourcesContent":["import { runWithContext } from \"../context\";\nimport { SuspenseContext } from \"../suspense\";\nimport { DEVTOOLS_EVENT, report } from \"./devtools\";\nimport { ShadowError } from \"./diagnostics\";\nimport { disposeTree } from \"./dispose\";\nimport {\n CLEAN,\n DIRTY,\n FLAG_DISPOSED,\n FLAG_LANE,\n FLAG_PARKED,\n FLAG_QUEUED,\n FLAG_RENDER,\n FLAG_SUSPENDED,\n FLAG_TRANSITION,\n KIND_EFFECT,\n} from \"./flags\";\nimport {\n Computation,\n hasObservers,\n markObservers,\n readSignal,\n recompute,\n Signal,\n updateIfNecessary,\n} from \"./graph\";\nimport { addCleanup, handleError, Owner } from \"./owner\";\nimport { clearQueues, hasPending, place, renderQueue, userQueue } from \"./queue\";\nimport { byCreation, isOrdered, MAX_FLUSH_PASSES, reportUncaught, schedule } from \"./scheduler\";\nimport {\n type BoundaryHold,\n type Hooks,\n rt,\n type SlotBranch,\n type SlotChoice,\n type SlotOwned,\n type SlotState,\n type SlotSwap,\n type TransitionHold,\n} from \"./state\";\nimport { isSuspension, SUSPENSION } from \"./suspension\";\n\n/*\n * Transitions, Activity pauses and Suspense holds. Nothing here runs unless an API that needs it is\n * called (startTransition, useTransition, useDeferredValue, pauseOwner, a Suspense hold inside a\n * transition): the first of those creates the hooks (`ensureHooks`), and the engine reaches them only\n * through `rt.hooks`. Module level holds no state of its own: the queues, waiters and holds are\n * closure variables of `createHooks`.\n */\n\n/** Transition-lane effects run per macrotask; between two chunks urgent work and input can run. */\nconst LANE_CHUNK = 64;\n\n/** Visits `root` and every node below it. Iterative: the depth is user controlled. */\nfunction walk(root: Owner, visit: (node: Owner) => void): void {\n const stack: Owner[] = [root];\n while (stack.length > 0) {\n const node = stack.pop();\n if (node === undefined) break;\n visit(node);\n for (let child = node.lastChild; child !== null; child = child.prevSibling) stack.push(child);\n }\n}\n\n/** Creates the transition machinery. Called once, by the first API that needs it. */\nfunction createHooks(): Hooks {\n const laneRender: Computation[] = [];\n const laneUser: Computation[] = [];\n /** Resolvers of the transitions waiting for the lane to go idle. */\n const waiters: Array<() => void> = [];\n /** Memos and effects that caught a suspension; woken all at once when a boundary releases them. */\n const suspended: Computation[] = [];\n /** Suspense boundaries currently holding a transition (the lane is busy while any holds). */\n let holds = 0;\n let scheduled = false;\n\n const hasLanePending = (): boolean => laneRender.length > 0 || laneUser.length > 0;\n const laneBusy = (): boolean => hasLanePending() || holds > 0;\n\n /**\n * Runs one chunk of a lane queue. An entry without FLAG_TRANSITION was promoted to the urgent queue\n * after it was queued here; it is skipped (the urgent queue owns its FLAG_QUEUED).\n */\n const drainLane = (queue: Computation[], limit: number): number => {\n const batch = queue.splice(0, limit);\n if (!isOrdered(batch)) batch.sort(byCreation);\n for (const effect of batch) {\n if ((effect.flags & FLAG_TRANSITION) === 0) continue;\n effect.flags &= ~(FLAG_QUEUED | FLAG_TRANSITION);\n if ((effect.flags & FLAG_DISPOSED) !== 0) continue;\n if (effect.pauses > 0) {\n effect.flags |= FLAG_PARKED | FLAG_TRANSITION;\n continue;\n }\n try {\n if (effect.state === DIRTY) recompute(effect);\n else updateIfNecessary(effect);\n } catch (error) {\n handleError(error, effect);\n }\n }\n return batch.length;\n };\n\n /** Resolves the transitions that wait for the lane, once the lane is idle. */\n const settleLane = (): void => {\n if (laneBusy() || waiters.length === 0) return;\n const resolved = waiters.splice(0, waiters.length);\n if (__DEV__) report(DEVTOOLS_EVENT.TRANSITION_END, resolved.length);\n for (const resolve of resolved) resolve();\n };\n\n /** Asks for one lane macrotask (the timer lets the browser paint and take input first). */\n const scheduleLane = (): void => {\n if (scheduled) return;\n scheduled = true;\n setTimeout(flushLane, 0);\n };\n\n /**\n * Runs the transition lane: one chunk per macrotask, render effects first. Writes made here belong to\n * the lane, so the effects they wake join it. Errors nobody handled are reported, not thrown, because\n * no caller is waiting for this macrotask.\n */\n const flushLane = (): void => {\n scheduled = false;\n if (rt.flushing) {\n scheduleLane();\n return;\n }\n const previous = rt.inTransition;\n rt.inTransition = true;\n rt.flushing = true;\n let budget = LANE_CHUNK;\n let passes = 0;\n try {\n while (budget > 0 && hasLanePending()) {\n passes += 1;\n if (passes > MAX_FLUSH_PASSES) {\n clearQueues();\n rt.uncaught.push(new ShadowError(\"INFINITE_LOOP\"));\n break;\n }\n const queue = laneRender.length > 0 ? laneRender : laneUser;\n budget -= drainLane(queue, budget);\n }\n } finally {\n rt.inTransition = previous;\n rt.flushing = false;\n }\n const errors = rt.uncaught.splice(0, rt.uncaught.length);\n for (const error of errors) reportUncaught(error);\n if (hasLanePending()) scheduleLane();\n else settleLane();\n if (hasPending()) schedule();\n };\n\n const startTransition = (fn: () => void): Promise<void> => {\n // A user callback runs untracked and as a transition: its reads are not subscriptions of the caller.\n const previous = rt.inTransition;\n const listener = rt.listener;\n rt.inTransition = true;\n rt.listener = null;\n try {\n fn();\n } finally {\n rt.inTransition = previous;\n rt.listener = listener;\n }\n if (__DEV__) report(DEVTOOLS_EVENT.TRANSITION_START);\n const applied = new Promise<void>((resolve) => {\n waiters.push(resolve);\n });\n settleLane();\n return applied;\n };\n\n /** The hook's `place`: parks a paused effect or queues a lane effect. */\n const parkOrLane = (effect: Computation, inLane: boolean): void => {\n if (effect.pauses > 0) {\n // Paused: parked (unqueued) until the owner resumes. A lane effect keeps its lane.\n effect.flags = inLane\n ? effect.flags | FLAG_PARKED | FLAG_TRANSITION\n : (effect.flags | FLAG_PARKED) & ~FLAG_TRANSITION;\n return;\n }\n const render = (effect.flags & FLAG_RENDER) !== 0;\n effect.flags = (effect.flags & ~FLAG_PARKED) | FLAG_QUEUED | FLAG_TRANSITION;\n if (render) laneRender.push(effect);\n else laneUser.push(effect);\n scheduleLane();\n };\n\n const promote = (effect: Computation): void => {\n // Lane-only effects (useDeferredValue's watcher) and paused effects stay where they are.\n if ((effect.flags & FLAG_LANE) !== 0 || effect.pauses > 0) return;\n if ((effect.flags & FLAG_PARKED) !== 0) {\n place(effect, false);\n return;\n }\n if ((effect.flags & (FLAG_QUEUED | FLAG_TRANSITION)) !== (FLAG_QUEUED | FLAG_TRANSITION))\n return;\n // Still listed in the lane array; the lane skips entries that no longer carry FLAG_TRANSITION.\n effect.flags &= ~FLAG_TRANSITION;\n if ((effect.flags & FLAG_RENDER) !== 0) renderQueue.push(effect);\n else userQueue.push(effect);\n };\n\n const clear = (): void => {\n for (const queue of [laneRender, laneUser]) {\n for (const effect of queue) {\n effect.flags &= ~(FLAG_QUEUED | FLAG_TRANSITION);\n effect.state = CLEAN;\n }\n queue.length = 0;\n }\n };\n\n const suspend = (node: Computation, error: unknown): boolean => {\n if (error !== SUSPENSION) return false;\n node.flags |= FLAG_SUSPENDED;\n suspended.push(node);\n return true;\n };\n\n const holdReader = (tracker: { hold?(): boolean }): void => {\n if (tracker.hold?.() === true) throw SUSPENSION;\n };\n\n const beginHold = (): void => {\n holds += 1;\n };\n\n const endHold = (): void => {\n if (holds > 0) holds -= 1;\n if (hasLanePending()) scheduleLane();\n settleLane();\n };\n\n const wakeSuspended = (): void => {\n const waiting = suspended.splice(0, suspended.length);\n // The woken work is still the transition: it runs in the lane, so a resource it reads again is\n // held the same way, not shown as a fallback by an urgent pass.\n const previous = rt.inTransition;\n rt.inTransition = true;\n try {\n for (const node of waiting) {\n if ((node.flags & FLAG_SUSPENDED) === 0 || node.disposed) continue;\n node.flags &= ~FLAG_SUSPENDED;\n node.state = DIRTY;\n if (node.kind === KIND_EFFECT) place(node, true);\n else markObservers(node);\n }\n } finally {\n rt.inTransition = previous;\n }\n schedule();\n };\n\n const pause = (owner: Owner): void => {\n walk(owner, (node) => {\n node.pauses += 1;\n if (\n node instanceof Computation &&\n node.kind === KIND_EFFECT &&\n (node.flags & FLAG_RENDER) === 0 &&\n !node.disposed\n ) {\n node.runCleanups();\n }\n });\n };\n\n const createHold = (onSettled: () => void): TransitionHold => {\n let count = 0;\n let holding = false;\n let engagedOnce = false;\n const tracker = {\n increment(): void {\n count += 1;\n },\n decrement(): void {\n count -= 1;\n if (count !== 0) return;\n if (holding) {\n holding = false;\n // Everything that kept its value for this hold runs again, now that the data arrived.\n wakeSuspended();\n endHold();\n }\n onSettled();\n },\n hold(): boolean {\n engagedOnce = true;\n if (!holding) {\n holding = true;\n beginHold();\n }\n return true;\n },\n };\n return {\n run: (fn) => runWithContext(SuspenseContext, tracker, fn),\n count: () => count,\n engaged: () => engagedOnce,\n drop: () => {\n if (!holding) return;\n holding = false;\n endHold();\n },\n };\n };\n\n const resume = (owner: Owner): void => {\n walk(owner, (node) => {\n if (node.pauses > 0) node.pauses -= 1;\n if (!(node instanceof Computation) || node.pauses !== 0 || node.disposed) return;\n if (node.kind === KIND_EFFECT) {\n // A render effect that was not due while paused keeps its DOM: re-running it would rebuild its\n // subtree (a Provider's children, for one) and lose that state.\n if ((node.flags & FLAG_RENDER) !== 0 && (node.flags & FLAG_PARKED) === 0) return;\n node.state = DIRTY;\n place(node, false);\n } else if (node.state !== CLEAN) {\n // A memo that changed while paused was not recomputed, so its readers outside this owner were\n // not woken either (they read the frozen value). Wake them now that it can be recomputed.\n markObservers(node);\n }\n });\n schedule();\n };\n\n /** A Suspense boundary's hold: engaged by a transition read, released when its data arrived. */\n const boundaryHold = (): BoundaryHold => {\n let holding = false;\n return {\n engage: () => {\n if (!holding) {\n holding = true;\n beginHold();\n }\n return true;\n },\n release: () => {\n if (!holding) return;\n holding = false;\n // Everything that kept its value for this boundary runs again, with the data that arrived.\n wakeSuspended();\n endHold();\n },\n holding: () => holding,\n };\n };\n\n /**\n * The transition layer of one branch slot (Show, Switch). A change made during a transition, while a\n * branch is on screen, builds the new branch under a hold and keeps the shown one until the hold\n * settles; then it commits. The slot's output memo calls `step` first, so the usual path (its own\n * teardown) only runs when no transition is involved. Its state lives in `state`, which the memo\n * reads and writes.\n */\n const slotSwap = <C extends SlotChoice>(\n state: SlotState<C>,\n build: (choice: C, owned: SlotOwned, eager: boolean) => unknown,\n same: (a: C, b: C) => boolean,\n parent: Owner | null,\n ): SlotSwap<C> => {\n /** A transition's branch waiting for its reads; the shown branch stays until it is ready. */\n let pending: SlotBranch<C> | undefined;\n /** Owns the branches built during transitions: they live as long as the slot's owner. */\n const holder = new Owner(parent);\n /** Counts the settled holds; the memo reads it, so it runs again when a pending branch is ready. */\n const settled = new Signal<number>(0, false, undefined);\n\n const settle = (): void => {\n settled.value += 1;\n if (hasObservers(settled)) {\n markObservers(settled);\n schedule();\n }\n };\n\n /** Tears a branch down. Its owner is marked `disposing` first (see the accessors of Show). */\n const retireBranch = (branch: SlotBranch<C>): void => {\n branch.owned.disposing = true;\n try {\n branch.hold?.drop();\n branch.dispose?.();\n } finally {\n branch.owned.disposing = false;\n }\n };\n\n const commit = (branch: SlotBranch<C>): void => {\n const previous = state.live;\n state.live = branch;\n if (previous !== undefined) retireBranch(previous);\n };\n\n /** Builds a transition's branch under the holder. A held read leaves it pending, not shown. */\n const buildPending = (choice: C): SlotBranch<C> => {\n const owned: SlotOwned = { index: choice.index, value: choice.when, disposing: false };\n const hold: TransitionHold = createHold(() => {\n // Only the branch still waiting may commit; a dropped one must not wake the slot.\n if (pending !== undefined && pending.hold === hold) settle();\n });\n const root = new Owner(holder);\n const previousOwner = rt.owner;\n const previousListener = rt.listener;\n rt.owner = root;\n rt.listener = null;\n let result: unknown;\n try {\n // The branch's reads report to its own hold (not the boundary), so they do not bring the\n // fallback back. No Provider: its render effect would be re-run by the wake-up, rebuilding\n // the branch and starting its loads again.\n try {\n result = hold.run(() => build(choice, owned, true));\n } catch (error) {\n if (!isSuspension(error)) throw error;\n }\n const marker = new Owner(root);\n addCleanup(marker, () => {\n owned.disposing = true;\n });\n } finally {\n rt.owner = previousOwner;\n rt.listener = previousListener;\n }\n return {\n choice,\n owned,\n result,\n dispose: () => disposeTree(root),\n hold: hold.engaged() ? hold : null,\n };\n };\n\n return {\n step(choice: C): boolean {\n readSignal(settled);\n if (pending !== undefined) {\n if (!same(pending.choice, choice)) {\n const dropped = pending;\n pending = undefined;\n dropped.hold?.drop();\n dropped.dispose?.();\n } else if ((pending.hold?.count() ?? 0) > 0) {\n // Still waiting for data: the shown branch stays on screen, untouched.\n return true;\n } else {\n const ready = pending;\n pending = undefined;\n commit(ready);\n return true;\n }\n }\n // A transition replacing the shown branch: build it first, keep the shown one until it is ready.\n if (state.live !== undefined && rt.inTransition) {\n const built = buildPending(choice);\n if (built.hold === null) commit(built);\n else pending = built;\n return true;\n }\n // The usual path follows: the branch on screen is retired here (an unmanaged one is torn down).\n const live = state.live;\n state.live = undefined;\n if (live !== undefined) retireBranch(live);\n return false;\n },\n };\n };\n\n return {\n place: parkOrLane,\n promote,\n clear,\n suspend,\n holdReader,\n startTransition,\n beginHold,\n endHold,\n wakeSuspended,\n pause,\n resume,\n createHold,\n slotSwap,\n boundaryHold,\n };\n}\n\n/** Installs the transition machinery on first use; later calls return the same hooks. */\nfunction ensureHooks(): Hooks {\n const existing = rt.hooks;\n if (existing !== null) return existing;\n const created = createHooks();\n rt.hooks = created;\n return created;\n}\n\n/**\n * Installs the transition machinery (the transition lane, Activity pauses and Suspense holds) now\n * instead of at the first `startTransition`. The machinery is created on first use so that an\n * application that never uses transitions does not carry its code; call this from a primitive whose\n * later work needs the lane to exist, as `useDeferredValue` does. Calling it again does nothing.\n *\n * @example\n * import { registerTransitionLane } from \"@shadow-js/core/extend\";\n *\n * export function useBackgroundValue(): void {\n * registerTransitionLane(); // later lane-only effects of this hook find the lane\n * }\n * @see startTransition\n * @since 1.0.0\n */\nexport function registerTransitionLane(): void {\n ensureHooks();\n}\n\n/**\n * Runs `fn` as a transition: the effects its writes wake wait in the transition lane, which runs\n * after urgent work (in a macrotask, one chunk at a time). Reads see the writes at once; the DOM\n * catches up when the lane runs. Use it for an update that may be slow to render or load, so input\n * stays responsive and a Suspense boundary keeps its content instead of showing its fallback. `fn`\n * runs untracked. The returned promise resolves when the lane is idle and no Suspense boundary holds\n * the transition.\n *\n * On the server there are no effects, so `fn` simply runs and the promise is already resolved.\n *\n * @param fn Callback whose writes form the transition.\n * @returns A promise that resolves when the transition has been applied.\n * @throws What `fn` throws, synchronously; no transition is started then.\n * @example\n * import { startTransition, useSignal } from \"@shadow-js/core\";\n *\n * const [page, setPage] = useSignal(\"home\");\n * async function openReports(): Promise<void> {\n * await startTransition(() => setPage(\"reports\"));\n * console.log(`${page()} is on screen`);\n * }\n * @see inTransition\n * @since 1.0.0\n */\nexport function startTransition(fn: () => void): Promise<void> {\n if (__SERVER__) {\n fn();\n return Promise.resolve();\n }\n return ensureHooks().startTransition(fn);\n}\n\n/**\n * Starts a Suspense hold: the boundary keeps showing its current content while a transition waits\n * for data. Holds are counted, and the running transitions stay pending (`isPending` of\n * `useTransition`, the promise of `startTransition`) until every hold has ended. For renderers that\n * implement Suspense; each call needs one {@link endHold}. Does nothing before the transition\n * machinery exists (no transition has run).\n *\n * @example\n * import { beginHold, endHold, wakeSuspended } from \"@shadow-js/core/extend\";\n *\n * export function holdUntil(data: Promise<unknown>): void {\n * beginHold(); // the boundary keeps its content\n * void data.finally(() => {\n * wakeSuspended();\n * endHold();\n * });\n * }\n * @see endHold\n * @since 1.0.0\n */\nexport function beginHold(): void {\n rt.hooks?.beginHold();\n}\n\n/**\n * Ends a Suspense hold started with {@link beginHold}. Call {@link wakeSuspended} first, so the\n * memos and effects that waited are queued; this then schedules the lane for them and, once the lane\n * is idle and no hold remains, resolves the transitions that were waiting. Extra calls never take the\n * count below zero. Does nothing before the transition machinery exists.\n *\n * @example\n * import { endHold, wakeSuspended } from \"@shadow-js/core/extend\";\n *\n * export function release(): void {\n * wakeSuspended(); // the held readers run again with the data that arrived\n * endHold();\n * }\n * @see beginHold\n * @since 1.0.0\n */\nexport function endHold(): void {\n rt.hooks?.endHold();\n}\n\n/**\n * Wakes every memo and effect that kept its value for a transition (it caught {@link SUSPENSION}):\n * each runs again in the transition lane, so it reads the data that arrived. A Suspense boundary\n * calls it when it releases its hold, before {@link endHold}. Does nothing before the transition\n * machinery exists.\n *\n * @example\n * import { endHold, wakeSuspended } from \"@shadow-js/core/extend\";\n *\n * export function onDataArrived(): void {\n * wakeSuspended();\n * endHold();\n * }\n * @see endHold\n * @since 1.0.0\n */\nexport function wakeSuspended(): void {\n rt.hooks?.wakeSuspended();\n}\n\n/**\n * Lets a pending read inside a transition keep the boundary's content: when the tracker's `hold()`\n * returns true (the boundary holds its content for the transition), the reader throws\n * {@link SUSPENSION} and keeps its previous value until the boundary wakes it. Call it from a data\n * primitive's reader when its data is pending, the reader is tracked and {@link inTransition} is\n * true, as `useResource` does. Does nothing before the transition machinery exists, or when the\n * tracker has no `hold`.\n *\n * @param tracker The Suspense tracker of the nearest boundary (`SuspenseContext`).\n * @throws {@link SUSPENSION} (not an error) when the boundary holds its content.\n * @example\n * import { useContext, SuspenseContext } from \"@shadow-js/core\";\n * import { currentListener, holdReader, inTransition } from \"@shadow-js/core/extend\";\n *\n * export function readPending(): void {\n * const tracker = useContext(SuspenseContext);\n * if (tracker !== null && currentListener() !== null && inTransition()) holdReader(tracker);\n * }\n * @see isSuspension\n * @since 1.0.0\n */\nexport function holdReader(tracker: { hold?(): boolean }): void {\n rt.hooks?.holdReader(tracker);\n}\n\n/**\n * Tells whether a transition callback or a transition-lane run is active, so the writes made now\n * belong to the lane. Use it in a primitive that treats transition reads differently, such as a data\n * reader that holds the boundary only in a transition.\n *\n * @returns True inside `startTransition`'s callback and while the lane runs.\n * @example\n * import { startTransition } from \"@shadow-js/core\";\n * import { inTransition } from \"@shadow-js/core/extend\";\n *\n * void startTransition(() => {\n * console.log(inTransition()); // true in the browser\n * });\n * console.log(inTransition()); // false\n * @see startTransition\n * @since 1.0.0\n */\nexport function inTransition(): boolean {\n return rt.inTransition;\n}\n\n/**\n * Creates the hold of a value a transition builds (see {@link TransitionHold}): the reads that wait\n * for data inside `hold.run(...)` count against this hold instead of the Suspense boundary around the\n * value, so the value on screen stays until the new one is ready. For renderers that build values\n * during a transition.\n *\n * @param onSettled Called each time the number of waiting reads drops back to zero.\n * @returns The hold, or null when the transition machinery does not exist yet (no transition has run,\n * so nothing can be held).\n * @example\n * import { createTransitionHold } from \"@shadow-js/core/extend\";\n *\n * const hold = createTransitionHold(() => console.log(\"ready to commit\"));\n * const built = hold === null ? \"now\" : hold.run(() => \"pending\");\n * @see transitionHooks\n * @since 1.0.0\n */\nexport function createTransitionHold(onSettled: () => void): TransitionHold | null {\n const hooks = rt.hooks;\n return hooks === null ? null : hooks.createHold(onSettled);\n}\n\n/**\n * Returns the transition machinery while a transition is running, otherwise null. Renderers reach\n * the slot and boundary layers (`slotSwap`, `boundaryHold`) only through it: a transition can only be\n * running once the machinery exists, so this never creates it (a static call that did would keep the\n * whole machinery in every bundle that renders a Show).\n *\n * @returns The hooks during a transition callback or lane run, null otherwise.\n * @example\n * import { transitionHooks } from \"@shadow-js/core/extend\";\n *\n * export function boundaryHoldIfTransition() {\n * return transitionHooks()?.boundaryHold() ?? null;\n * }\n * @see inTransition\n * @since 1.0.0\n */\nexport function transitionHooks(): Hooks | null {\n return rt.inTransition ? rt.hooks : null;\n}\n\n/**\n * Pauses `owner` and everything below it (Activity hidden). User effects run their cleanups and wait.\n * DOM bindings (render effects) wait without a cleanup, so their nodes stay as they are. Memos keep their\n * last value, and effects created below are parked until the owner resumes. Pauses nest: each\n * `pauseOwner` needs one `resumeOwner`. Use it to hide a subtree while keeping its state.\n *\n * @param owner The owner to pause, with its whole subtree.\n * @example\n * import { createOwner, pauseOwner, resumeOwner } from \"@shadow-js/core/extend\";\n *\n * const hidden = createOwner(null);\n * pauseOwner(hidden); // its effects stop; its memos keep their values\n * resumeOwner(hidden); // its user effects run again with the latest values\n * @see resumeOwner\n * @since 1.0.0\n */\nexport function pauseOwner(owner: Owner): void {\n ensureHooks().pause(owner);\n}\n\n/**\n * Resumes an owner paused with {@link pauseOwner}; the subtree runs again once its last pause ends.\n * User effects below it run once more with the current values (their cleanups ran on pause). DOM\n * bindings run only if something they read changed while paused, so a hidden subtree is not rebuilt\n * on show. Memos that changed while paused wake their readers outside the owner. Call it once per\n * `pauseOwner`, not on an owner that is not paused.\n *\n * @param owner The paused owner.\n * @example\n * import { createOwner, pauseOwner, resumeOwner } from \"@shadow-js/core/extend\";\n *\n * const panel = createOwner(null);\n * pauseOwner(panel);\n * resumeOwner(panel); // every user effect below runs once with the latest values\n * @see pauseOwner\n * @since 1.0.0\n */\nexport function resumeOwner(owner: Owner): void {\n rt.hooks?.resume(owner);\n}\n"],"mappings":";;;;;;;;;;;;;;AAmDA,MAAM,aAAa;;AAGnB,SAAS,KAAK,MAAa,OAAoC;CAC7D,MAAM,QAAiB,CAAC,IAAI;CAC5B,OAAO,MAAM,SAAS,GAAG;EACvB,MAAM,OAAO,MAAM,IAAI;EACvB,IAAI,SAAS,KAAA,GAAW;EACxB,MAAM,IAAI;EACV,KAAK,IAAI,QAAQ,KAAK,WAAW,UAAU,MAAM,QAAQ,MAAM,aAAa,MAAM,KAAK,KAAK;CAC9F;AACF;;AAGA,SAAS,cAAqB;CAC5B,MAAM,aAA4B,CAAC;CACnC,MAAM,WAA0B,CAAC;;CAEjC,MAAM,UAA6B,CAAC;;CAEpC,MAAM,YAA2B,CAAC;;CAElC,IAAI,QAAQ;CACZ,IAAI,YAAY;CAEhB,MAAM,uBAAgC,WAAW,SAAS,KAAK,SAAS,SAAS;CACjF,MAAM,iBAA0B,eAAe,KAAK,QAAQ;;;;;CAM5D,MAAM,aAAa,OAAsB,UAA0B;EACjE,MAAM,QAAQ,MAAM,OAAO,GAAG,KAAK;EACnC,IAA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;;AAmBA,SAAgB,YAAY,OAAoB;CAC9C,GAAG,OAAO,OAAO,KAAK;AACxB"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * The runtime's side of the devtools protocol (version 1, see `@shadow-js/devtools`). The runtime
3
+ * does not import that package: it looks up a global hook, in development builds only, and every
4
+ * call site is wrapped as `if (__DEV__) report(...)` so production bundles drop it entirely.
5
+ */
6
+ /**
7
+ * The event kinds of the devtools protocol (version 1), numbered as `EVENT` in `@shadow-js/devtools`
8
+ * numbers them. Pass one to {@link devtoolsReport} when a custom primitive shows up in devtools; the
9
+ * meaning of the other arguments of each kind is in the protocol table of the devtools README.
10
+ *
11
+ * Kinds 16 and 17 are the transition events, reported by `internal/concurrency.ts`: `TRANSITION_START`
12
+ * (16) after a `transition()` callback has run, with no arguments; `TRANSITION_END` (17) when the
13
+ * transition lane is idle, with the number of transitions it resolved. The devtools agent does not use
14
+ * them yet.
15
+ *
16
+ * @example
17
+ * import { DEVTOOLS_EVENT } from "@shadow-js/core/extend";
18
+ *
19
+ * function describe(kind: number): string {
20
+ * if (kind === DEVTOOLS_EVENT.SIGNAL_WRITTEN) return "signal written";
21
+ * if (kind === DEVTOOLS_EVENT.ERROR) return "error";
22
+ * return `event ${kind}`;
23
+ * }
24
+ * @see devtoolsReport
25
+ * @since 1.0.0
26
+ */
27
+ export declare const DEVTOOLS_EVENT: {
28
+ readonly OWNER_CREATED: 1;
29
+ readonly OWNER_DISPOSED: 2;
30
+ readonly SIGNAL_CREATED: 3;
31
+ readonly SIGNAL_WRITTEN: 4;
32
+ readonly COMPUTATION_CREATED: 5;
33
+ readonly COMPUTATION_RUN: 6;
34
+ readonly COMPUTATION_DISPOSED: 7;
35
+ readonly COMPONENT_MOUNTED: 8;
36
+ readonly COMPONENT_UNMOUNTED: 9;
37
+ readonly RESOURCE_STATE: 10;
38
+ readonly ERROR: 11;
39
+ readonly HYDRATION_MISMATCH: 12;
40
+ readonly FLUSH_START: 13;
41
+ readonly FLUSH_END: 14;
42
+ readonly STORE_CREATED: 15;
43
+ readonly TRANSITION_START: 16;
44
+ readonly TRANSITION_END: 17;
45
+ };
46
+ /**
47
+ * Reports one event to the devtools hook (`globalThis.__SHADOWJS_DEVTOOLS_HOOK__`, protocol version
48
+ * 1) when one is installed. Does nothing without a hook, with a hook of another version, and in
49
+ * production builds. Exported from `@shadow-js/core/extend` as `devtoolsReport`. Pass the runtime's
50
+ * own objects, not copies, so a report allocates nothing.
51
+ *
52
+ * @param kind The event kind, one of {@link DEVTOOLS_EVENT}.
53
+ * @param a First argument of the event (see the protocol table of the devtools README).
54
+ * @param b Second argument of the event, or undefined when the kind has none.
55
+ * @param c Third argument of the event, or undefined when the kind has none.
56
+ * @param d Fourth argument of the event, or undefined when the kind has none.
57
+ * @param e Fifth argument of the event, or undefined when the kind has none.
58
+ * @example
59
+ * import { isDev } from "@shadow-js/core";
60
+ * import { currentOwner, DEVTOOLS_EVENT, devtoolsReport } from "@shadow-js/core/extend";
61
+ *
62
+ * function reportFailure(error: unknown): void {
63
+ * if (isDev) devtoolsReport(DEVTOOLS_EVENT.ERROR, currentOwner(), error, undefined);
64
+ * }
65
+ * @see DEVTOOLS_EVENT
66
+ * @since 1.0.0
67
+ */
68
+ export declare function report(kind: number, a?: unknown, b?: unknown, c?: unknown, d?: unknown, e?: unknown): void;
69
+ //# sourceMappingURL=devtools.d.ts.map
@@ -0,0 +1,76 @@
1
+ // src/internal/devtools.ts
2
+ /**
3
+ * The runtime's side of the devtools protocol (version 1, see `@shadow-js/devtools`). The runtime
4
+ * does not import that package: it looks up a global hook, in development builds only, and every
5
+ * call site is wrapped as `if (__DEV__) report(...)` so production bundles drop it entirely.
6
+ */
7
+ /**
8
+ * The event kinds of the devtools protocol (version 1), numbered as `EVENT` in `@shadow-js/devtools`
9
+ * numbers them. Pass one to {@link devtoolsReport} when a custom primitive shows up in devtools; the
10
+ * meaning of the other arguments of each kind is in the protocol table of the devtools README.
11
+ *
12
+ * Kinds 16 and 17 are the transition events, reported by `internal/concurrency.ts`: `TRANSITION_START`
13
+ * (16) after a `transition()` callback has run, with no arguments; `TRANSITION_END` (17) when the
14
+ * transition lane is idle, with the number of transitions it resolved. The devtools agent does not use
15
+ * them yet.
16
+ *
17
+ * @example
18
+ * import { DEVTOOLS_EVENT } from "@shadow-js/core/extend";
19
+ *
20
+ * function describe(kind: number): string {
21
+ * if (kind === DEVTOOLS_EVENT.SIGNAL_WRITTEN) return "signal written";
22
+ * if (kind === DEVTOOLS_EVENT.ERROR) return "error";
23
+ * return `event ${kind}`;
24
+ * }
25
+ * @see devtoolsReport
26
+ * @since 1.0.0
27
+ */
28
+ const DEVTOOLS_EVENT = {
29
+ OWNER_CREATED: 1,
30
+ OWNER_DISPOSED: 2,
31
+ SIGNAL_CREATED: 3,
32
+ SIGNAL_WRITTEN: 4,
33
+ COMPUTATION_CREATED: 5,
34
+ COMPUTATION_RUN: 6,
35
+ COMPUTATION_DISPOSED: 7,
36
+ COMPONENT_MOUNTED: 8,
37
+ COMPONENT_UNMOUNTED: 9,
38
+ RESOURCE_STATE: 10,
39
+ ERROR: 11,
40
+ HYDRATION_MISMATCH: 12,
41
+ FLUSH_START: 13,
42
+ FLUSH_END: 14,
43
+ STORE_CREATED: 15,
44
+ TRANSITION_START: 16,
45
+ TRANSITION_END: 17
46
+ };
47
+ const KEY = "__SHADOWJS_DEVTOOLS_HOOK__";
48
+ /**
49
+ * Reports one event to the devtools hook (`globalThis.__SHADOWJS_DEVTOOLS_HOOK__`, protocol version
50
+ * 1) when one is installed. Does nothing without a hook, with a hook of another version, and in
51
+ * production builds. Exported from `@shadow-js/core/extend` as `devtoolsReport`. Pass the runtime's
52
+ * own objects, not copies, so a report allocates nothing.
53
+ *
54
+ * @param kind The event kind, one of {@link DEVTOOLS_EVENT}.
55
+ * @param a First argument of the event (see the protocol table of the devtools README).
56
+ * @param b Second argument of the event, or undefined when the kind has none.
57
+ * @param c Third argument of the event, or undefined when the kind has none.
58
+ * @param d Fourth argument of the event, or undefined when the kind has none.
59
+ * @param e Fifth argument of the event, or undefined when the kind has none.
60
+ * @example
61
+ * import { isDev } from "@shadow-js/core";
62
+ * import { currentOwner, DEVTOOLS_EVENT, devtoolsReport } from "@shadow-js/core/extend";
63
+ *
64
+ * function reportFailure(error: unknown): void {
65
+ * if (isDev) devtoolsReport(DEVTOOLS_EVENT.ERROR, currentOwner(), error, undefined);
66
+ * }
67
+ * @see DEVTOOLS_EVENT
68
+ * @since 1.0.0
69
+ */
70
+ function report(kind, a, b, c, d, e) {
71
+ const hook = Reflect.get(globalThis, KEY);
72
+ if (hook !== void 0 && hook.version === 1) hook.report(kind, a, b, c, d, e);
73
+ }
74
+ export { DEVTOOLS_EVENT, report };
75
+
76
+ //# sourceMappingURL=devtools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools.js","names":[],"sources":["../../../src/internal/devtools.ts"],"sourcesContent":["/**\n * The runtime's side of the devtools protocol (version 1, see `@shadow-js/devtools`). The runtime\n * does not import that package: it looks up a global hook, in development builds only, and every\n * call site is wrapped as `if (__DEV__) report(...)` so production bundles drop it entirely.\n */\n\n/**\n * The event kinds of the devtools protocol (version 1), numbered as `EVENT` in `@shadow-js/devtools`\n * numbers them. Pass one to {@link devtoolsReport} when a custom primitive shows up in devtools; the\n * meaning of the other arguments of each kind is in the protocol table of the devtools README.\n *\n * Kinds 16 and 17 are the transition events, reported by `internal/concurrency.ts`: `TRANSITION_START`\n * (16) after a `transition()` callback has run, with no arguments; `TRANSITION_END` (17) when the\n * transition lane is idle, with the number of transitions it resolved. The devtools agent does not use\n * them yet.\n *\n * @example\n * import { DEVTOOLS_EVENT } from \"@shadow-js/core/extend\";\n *\n * function describe(kind: number): string {\n * if (kind === DEVTOOLS_EVENT.SIGNAL_WRITTEN) return \"signal written\";\n * if (kind === DEVTOOLS_EVENT.ERROR) return \"error\";\n * return `event ${kind}`;\n * }\n * @see devtoolsReport\n * @since 1.0.0\n */\nexport const DEVTOOLS_EVENT = {\n OWNER_CREATED: 1,\n OWNER_DISPOSED: 2,\n SIGNAL_CREATED: 3,\n SIGNAL_WRITTEN: 4,\n COMPUTATION_CREATED: 5,\n COMPUTATION_RUN: 6,\n COMPUTATION_DISPOSED: 7,\n COMPONENT_MOUNTED: 8,\n COMPONENT_UNMOUNTED: 9,\n RESOURCE_STATE: 10,\n ERROR: 11,\n HYDRATION_MISMATCH: 12,\n FLUSH_START: 13,\n FLUSH_END: 14,\n STORE_CREATED: 15,\n TRANSITION_START: 16,\n TRANSITION_END: 17,\n} as const;\n\nconst KEY = \"__SHADOWJS_DEVTOOLS_HOOK__\";\n\ninterface Hook {\n readonly version: number;\n report(kind: number, a?: unknown, b?: unknown, c?: unknown, d?: unknown, e?: unknown): void;\n}\n\n/**\n * Reports one event to the devtools hook (`globalThis.__SHADOWJS_DEVTOOLS_HOOK__`, protocol version\n * 1) when one is installed. Does nothing without a hook, with a hook of another version, and in\n * production builds. Exported from `@shadow-js/core/extend` as `devtoolsReport`. Pass the runtime's\n * own objects, not copies, so a report allocates nothing.\n *\n * @param kind The event kind, one of {@link DEVTOOLS_EVENT}.\n * @param a First argument of the event (see the protocol table of the devtools README).\n * @param b Second argument of the event, or undefined when the kind has none.\n * @param c Third argument of the event, or undefined when the kind has none.\n * @param d Fourth argument of the event, or undefined when the kind has none.\n * @param e Fifth argument of the event, or undefined when the kind has none.\n * @example\n * import { isDev } from \"@shadow-js/core\";\n * import { currentOwner, DEVTOOLS_EVENT, devtoolsReport } from \"@shadow-js/core/extend\";\n *\n * function reportFailure(error: unknown): void {\n * if (isDev) devtoolsReport(DEVTOOLS_EVENT.ERROR, currentOwner(), error, undefined);\n * }\n * @see DEVTOOLS_EVENT\n * @since 1.0.0\n */\nexport function report(\n kind: number,\n a?: unknown,\n b?: unknown,\n c?: unknown,\n d?: unknown,\n e?: unknown,\n): void {\n if (!__DEV__) return;\n const hook = Reflect.get(globalThis, KEY) as Hook | undefined;\n if (hook !== undefined && hook.version === 1) hook.report(kind, a, b, c, d, e);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,iBAAiB;CAC5B,eAAe;CACf,gBAAgB;CAChB,gBAAgB;CAChB,gBAAgB;CAChB,qBAAqB;CACrB,iBAAiB;CACjB,sBAAsB;CACtB,mBAAmB;CACnB,qBAAqB;CACrB,gBAAgB;CAChB,OAAO;CACP,oBAAoB;CACpB,aAAa;CACb,WAAW;CACX,eAAe;CACf,kBAAkB;CAClB,gBAAgB;AAClB;AAEA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;AA6BZ,SAAgB,OACd,MACA,GACA,GACA,GACA,GACA,GACM;CAEN,MAAM,OAAO,QAAQ,IAAI,YAAY,GAAG;CACxC,IAAI,SAAS,KAAA,KAAa,KAAK,YAAY,GAAG,KAAK,OAAO,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC;AAC/E"}
@@ -0,0 +1,88 @@
1
+ import { MessageCode } from "./messages.js";
2
+ /**
3
+ * The error class of every diagnostic the runtime throws, carrying a stable code next to the
4
+ * message. Match on `code` rather than the message: the message is the full text in development
5
+ * builds and only `SHADOW_<CODE>` in production builds. Throw it from a custom primitive to report a
6
+ * core diagnostic the same way the built-in hooks do.
7
+ *
8
+ * @example
9
+ * import { ShadowError } from "@shadow-js/core/extend";
10
+ *
11
+ * function isCycle(error: unknown): boolean {
12
+ * return error instanceof ShadowError && error.code === "CYCLE_DETECTED";
13
+ * }
14
+ * @see MESSAGES
15
+ * @since 1.0.0
16
+ */
17
+ export declare class ShadowError extends Error {
18
+ /** The diagnostic code, a key of {@link MESSAGES}; the same in development and production builds. */
19
+ readonly code: MessageCode;
20
+ /**
21
+ * Creates the error with the text of {@link formatMessage} for `code` and the name `"ShadowError"`.
22
+ * @param code The diagnostic code.
23
+ */
24
+ constructor(code: MessageCode);
25
+ }
26
+ /**
27
+ * A function that receives the warnings of {@link warn} instead of `console.warn`. Install one with
28
+ * {@link setWarningListener}.
29
+ * @param code The diagnostic code of the warning.
30
+ * @param message The text of {@link formatMessage} for that code.
31
+ * @since 1.0.0
32
+ */
33
+ export type WarningListener = (code: MessageCode, message: string) => void;
34
+ /**
35
+ * Sends every later warning to `next` instead of `console.warn`, for devtools and test helpers
36
+ * (`@shadow-js/testing`) that collect warnings. Deduplication still applies: the listener receives
37
+ * the first warning of each code only. Warnings exist in development builds only.
38
+ *
39
+ * @param next The listener to install. Undefined restores the default, `console.warn`.
40
+ * @returns The listener that was installed before, or undefined when it was the default, so the
41
+ * caller can restore it.
42
+ * @example
43
+ * import { type MessageCode, setWarningListener } from "@shadow-js/core/extend";
44
+ *
45
+ * const codes: MessageCode[] = [];
46
+ * const previous = setWarningListener((code) => {
47
+ * codes.push(code);
48
+ * });
49
+ * // ... run the code under test, then:
50
+ * setWarningListener(previous);
51
+ * @see warn
52
+ * @see resetWarningDedupe
53
+ * @since 1.0.0
54
+ */
55
+ export declare function setWarningListener(next: WarningListener | undefined): WarningListener | undefined;
56
+ /**
57
+ * Forgets which codes {@link warn} has already reported, so the next warning of each code is
58
+ * reported again. Use it between test cases and after a hot reload.
59
+ *
60
+ * @example
61
+ * import { resetWarningDedupe } from "@shadow-js/core/extend";
62
+ *
63
+ * function startTestCase(): void {
64
+ * resetWarningDedupe(); // each case sees its own first warnings
65
+ * }
66
+ * @see warn
67
+ * @since 1.0.0
68
+ */
69
+ export declare function resetWarningDedupe(): void;
70
+ /**
71
+ * Reports a development-only diagnostic. Only the first warning of each code is reported, for the
72
+ * whole program, until {@link resetWarningDedupe}; it goes to the listener of
73
+ * {@link setWarningListener}, or to `console.warn` with the text of {@link formatMessage}. Does
74
+ * nothing in production builds. Use it for a mistake that should not stop the app; throw
75
+ * {@link ShadowError} for one that must.
76
+ *
77
+ * @param code The diagnostic code to report.
78
+ * @example
79
+ * import { currentOwner, warn } from "@shadow-js/core/extend";
80
+ *
81
+ * export function useTicker(): void {
82
+ * if (currentOwner() === null) warn("NO_OWNER_CLEANUP");
83
+ * }
84
+ * @see setWarningListener
85
+ * @since 1.0.0
86
+ */
87
+ export declare function warn(code: MessageCode): void;
88
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1,101 @@
1
+ import { formatMessage } from "./messages.js";
2
+ // src/internal/diagnostics.ts
3
+ /**
4
+ * The error class of every diagnostic the runtime throws, carrying a stable code next to the
5
+ * message. Match on `code` rather than the message: the message is the full text in development
6
+ * builds and only `SHADOW_<CODE>` in production builds. Throw it from a custom primitive to report a
7
+ * core diagnostic the same way the built-in hooks do.
8
+ *
9
+ * @example
10
+ * import { ShadowError } from "@shadow-js/core/extend";
11
+ *
12
+ * function isCycle(error: unknown): boolean {
13
+ * return error instanceof ShadowError && error.code === "CYCLE_DETECTED";
14
+ * }
15
+ * @see MESSAGES
16
+ * @since 1.0.0
17
+ */
18
+ var ShadowError = class extends Error {
19
+ /** The diagnostic code, a key of {@link MESSAGES}; the same in development and production builds. */
20
+ code;
21
+ /**
22
+ * Creates the error with the text of {@link formatMessage} for `code` and the name `"ShadowError"`.
23
+ * @param code The diagnostic code.
24
+ */
25
+ constructor(code) {
26
+ super(formatMessage(code));
27
+ this.name = "ShadowError";
28
+ this.code = code;
29
+ }
30
+ };
31
+ const seen = /* @__PURE__ */ new Set();
32
+ let listener;
33
+ /**
34
+ * Sends every later warning to `next` instead of `console.warn`, for devtools and test helpers
35
+ * (`@shadow-js/testing`) that collect warnings. Deduplication still applies: the listener receives
36
+ * the first warning of each code only. Warnings exist in development builds only.
37
+ *
38
+ * @param next The listener to install. Undefined restores the default, `console.warn`.
39
+ * @returns The listener that was installed before, or undefined when it was the default, so the
40
+ * caller can restore it.
41
+ * @example
42
+ * import { type MessageCode, setWarningListener } from "@shadow-js/core/extend";
43
+ *
44
+ * const codes: MessageCode[] = [];
45
+ * const previous = setWarningListener((code) => {
46
+ * codes.push(code);
47
+ * });
48
+ * // ... run the code under test, then:
49
+ * setWarningListener(previous);
50
+ * @see warn
51
+ * @see resetWarningDedupe
52
+ * @since 1.0.0
53
+ */
54
+ function setWarningListener(next) {
55
+ const previous = listener;
56
+ listener = next;
57
+ return previous;
58
+ }
59
+ /**
60
+ * Forgets which codes {@link warn} has already reported, so the next warning of each code is
61
+ * reported again. Use it between test cases and after a hot reload.
62
+ *
63
+ * @example
64
+ * import { resetWarningDedupe } from "@shadow-js/core/extend";
65
+ *
66
+ * function startTestCase(): void {
67
+ * resetWarningDedupe(); // each case sees its own first warnings
68
+ * }
69
+ * @see warn
70
+ * @since 1.0.0
71
+ */
72
+ function resetWarningDedupe() {
73
+ seen.clear();
74
+ }
75
+ /**
76
+ * Reports a development-only diagnostic. Only the first warning of each code is reported, for the
77
+ * whole program, until {@link resetWarningDedupe}; it goes to the listener of
78
+ * {@link setWarningListener}, or to `console.warn` with the text of {@link formatMessage}. Does
79
+ * nothing in production builds. Use it for a mistake that should not stop the app; throw
80
+ * {@link ShadowError} for one that must.
81
+ *
82
+ * @param code The diagnostic code to report.
83
+ * @example
84
+ * import { currentOwner, warn } from "@shadow-js/core/extend";
85
+ *
86
+ * export function useTicker(): void {
87
+ * if (currentOwner() === null) warn("NO_OWNER_CLEANUP");
88
+ * }
89
+ * @see setWarningListener
90
+ * @since 1.0.0
91
+ */
92
+ function warn(code) {
93
+ if (seen.has(code)) return;
94
+ seen.add(code);
95
+ const message = formatMessage(code);
96
+ if (listener !== void 0) listener(code, message);
97
+ else console.warn(message);
98
+ }
99
+ export { ShadowError, resetWarningDedupe, setWarningListener, warn };
100
+
101
+ //# sourceMappingURL=diagnostics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.js","names":[],"sources":["../../../src/internal/diagnostics.ts"],"sourcesContent":["import { formatMessage, type MessageCode } from \"./messages\";\n\n/**\n * The error class of every diagnostic the runtime throws, carrying a stable code next to the\n * message. Match on `code` rather than the message: the message is the full text in development\n * builds and only `SHADOW_<CODE>` in production builds. Throw it from a custom primitive to report a\n * core diagnostic the same way the built-in hooks do.\n *\n * @example\n * import { ShadowError } from \"@shadow-js/core/extend\";\n *\n * function isCycle(error: unknown): boolean {\n * return error instanceof ShadowError && error.code === \"CYCLE_DETECTED\";\n * }\n * @see MESSAGES\n * @since 1.0.0\n */\nexport class ShadowError extends Error {\n /** The diagnostic code, a key of {@link MESSAGES}; the same in development and production builds. */\n readonly code: MessageCode;\n /**\n * Creates the error with the text of {@link formatMessage} for `code` and the name `\"ShadowError\"`.\n * @param code The diagnostic code.\n */\n constructor(code: MessageCode) {\n super(formatMessage(code));\n this.name = \"ShadowError\";\n this.code = code;\n }\n}\n\n/**\n * A function that receives the warnings of {@link warn} instead of `console.warn`. Install one with\n * {@link setWarningListener}.\n * @param code The diagnostic code of the warning.\n * @param message The text of {@link formatMessage} for that code.\n * @since 1.0.0\n */\nexport type WarningListener = (code: MessageCode, message: string) => void;\n\nconst seen = new Set<MessageCode>();\nlet listener: WarningListener | undefined;\n\n/**\n * Sends every later warning to `next` instead of `console.warn`, for devtools and test helpers\n * (`@shadow-js/testing`) that collect warnings. Deduplication still applies: the listener receives\n * the first warning of each code only. Warnings exist in development builds only.\n *\n * @param next The listener to install. Undefined restores the default, `console.warn`.\n * @returns The listener that was installed before, or undefined when it was the default, so the\n * caller can restore it.\n * @example\n * import { type MessageCode, setWarningListener } from \"@shadow-js/core/extend\";\n *\n * const codes: MessageCode[] = [];\n * const previous = setWarningListener((code) => {\n * codes.push(code);\n * });\n * // ... run the code under test, then:\n * setWarningListener(previous);\n * @see warn\n * @see resetWarningDedupe\n * @since 1.0.0\n */\nexport function setWarningListener(next: WarningListener | undefined): WarningListener | undefined {\n const previous = listener;\n listener = next;\n return previous;\n}\n\n/**\n * Forgets which codes {@link warn} has already reported, so the next warning of each code is\n * reported again. Use it between test cases and after a hot reload.\n *\n * @example\n * import { resetWarningDedupe } from \"@shadow-js/core/extend\";\n *\n * function startTestCase(): void {\n * resetWarningDedupe(); // each case sees its own first warnings\n * }\n * @see warn\n * @since 1.0.0\n */\nexport function resetWarningDedupe(): void {\n seen.clear();\n}\n\n/**\n * Reports a development-only diagnostic. Only the first warning of each code is reported, for the\n * whole program, until {@link resetWarningDedupe}; it goes to the listener of\n * {@link setWarningListener}, or to `console.warn` with the text of {@link formatMessage}. Does\n * nothing in production builds. Use it for a mistake that should not stop the app; throw\n * {@link ShadowError} for one that must.\n *\n * @param code The diagnostic code to report.\n * @example\n * import { currentOwner, warn } from \"@shadow-js/core/extend\";\n *\n * export function useTicker(): void {\n * if (currentOwner() === null) warn(\"NO_OWNER_CLEANUP\");\n * }\n * @see setWarningListener\n * @since 1.0.0\n */\nexport function warn(code: MessageCode): void {\n if (!__DEV__) return;\n if (seen.has(code)) return;\n seen.add(code);\n const message = formatMessage(code);\n if (listener !== undefined) listener(code, message);\n else console.warn(message);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,cAAb,cAAiC,MAAM;;CAErC;;;;;CAKA,YAAY,MAAmB;EAC7B,MAAM,cAAc,IAAI,CAAC;EACzB,KAAK,OAAO;EACZ,KAAK,OAAO;CACd;AACF;AAWA,MAAM,uBAAO,IAAI,IAAiB;AAClC,IAAI;;;;;;;;;;;;;;;;;;;;;;AAuBJ,SAAgB,mBAAmB,MAAgE;CACjG,MAAM,WAAW;CACjB,WAAW;CACX,OAAO;AACT;;;;;;;;;;;;;;AAeA,SAAgB,qBAA2B;CACzC,KAAK,MAAM;AACb;;;;;;;;;;;;;;;;;;AAmBA,SAAgB,KAAK,MAAyB;CAE5C,IAAI,KAAK,IAAI,IAAI,GAAG;CACpB,KAAK,IAAI,IAAI;CACb,MAAM,UAAU,cAAc,IAAI;CAClC,IAAI,aAAa,KAAA,GAAW,SAAS,MAAM,OAAO;MAC7C,QAAQ,KAAK,OAAO;AAC3B"}
@@ -0,0 +1,26 @@
1
+ import { Owner } from "./owner.js";
2
+ /**
3
+ * Disposes an owner and everything below it: children first, newest first, then each node's
4
+ * cleanups, newest first. Use it to end an owner made with `createOwner`; disposing an owner that is
5
+ * already disposed does nothing. Exported from `@shadow-js/core/extend` as `disposeOwner`.
6
+ *
7
+ * Cleanups run in an implicit batch (O-3): effects that depend on signals a cleanup wrote are
8
+ * flushed before this returns, unless the disposal happens inside a computation, a batch or a flush,
9
+ * whose own exit flushes.
10
+ *
11
+ * @param root The owner to dispose, with its whole subtree.
12
+ * @throws The error of a cleanup that no error handler caught, once the whole tree is disposed
13
+ * (several such errors are thrown together as an `AggregateError`); during a running flush, that
14
+ * flush throws them instead. An error of the flush that
15
+ * follows is thrown as is, or combined with the cleanup errors in an `AggregateError`.
16
+ * @example
17
+ * import { addCleanup, createOwner, disposeOwner } from "@shadow-js/core/extend";
18
+ *
19
+ * const owner = createOwner(null);
20
+ * addCleanup(owner, () => console.log("released"));
21
+ * disposeOwner(owner); // logs "released"
22
+ * @see addCleanup
23
+ * @since 1.0.0
24
+ */
25
+ export declare function disposeTree(root: Owner): void;
26
+ //# sourceMappingURL=dispose.d.ts.map
@@ -0,0 +1,48 @@
1
+ import { rt } from "./state.js";
2
+ import { disposeTree as disposeTree$1 } from "./owner.js";
3
+ import { hasPending } from "./queue.js";
4
+ import { flush } from "./scheduler.js";
5
+ // src/internal/dispose.ts
6
+ /**
7
+ * Disposes an owner and everything below it: children first, newest first, then each node's
8
+ * cleanups, newest first. Use it to end an owner made with `createOwner`; disposing an owner that is
9
+ * already disposed does nothing. Exported from `@shadow-js/core/extend` as `disposeOwner`.
10
+ *
11
+ * Cleanups run in an implicit batch (O-3): effects that depend on signals a cleanup wrote are
12
+ * flushed before this returns, unless the disposal happens inside a computation, a batch or a flush,
13
+ * whose own exit flushes.
14
+ *
15
+ * @param root The owner to dispose, with its whole subtree.
16
+ * @throws The error of a cleanup that no error handler caught, once the whole tree is disposed
17
+ * (several such errors are thrown together as an `AggregateError`); during a running flush, that
18
+ * flush throws them instead. An error of the flush that
19
+ * follows is thrown as is, or combined with the cleanup errors in an `AggregateError`.
20
+ * @example
21
+ * import { addCleanup, createOwner, disposeOwner } from "@shadow-js/core/extend";
22
+ *
23
+ * const owner = createOwner(null);
24
+ * addCleanup(owner, () => console.log("released"));
25
+ * disposeOwner(owner); // logs "released"
26
+ * @see addCleanup
27
+ * @since 1.0.0
28
+ */
29
+ function disposeTree(root) {
30
+ let failure;
31
+ let failed = false;
32
+ try {
33
+ disposeTree$1(root);
34
+ } catch (error) {
35
+ failed = true;
36
+ failure = error;
37
+ }
38
+ if (rt.running === null && rt.batchDepth === 0 && !rt.flushing && hasPending()) try {
39
+ flush();
40
+ } catch (error) {
41
+ if (!failed) throw error;
42
+ throw new AggregateError([failure, error], "Disposal and the following flush both threw.");
43
+ }
44
+ if (failed) throw failure;
45
+ }
46
+ export { disposeTree };
47
+
48
+ //# sourceMappingURL=dispose.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispose.js","names":[],"sources":["../../../src/internal/dispose.ts"],"sourcesContent":["import type { Owner } from \"./owner\";\nimport { disposeTree as disposeSubtree } from \"./owner\";\nimport { hasPending } from \"./queue\";\nimport { flush } from \"./scheduler\";\nimport { rt } from \"./state\";\n\n/**\n * Disposes an owner and everything below it: children first, newest first, then each node's\n * cleanups, newest first. Use it to end an owner made with `createOwner`; disposing an owner that is\n * already disposed does nothing. Exported from `@shadow-js/core/extend` as `disposeOwner`.\n *\n * Cleanups run in an implicit batch (O-3): effects that depend on signals a cleanup wrote are\n * flushed before this returns, unless the disposal happens inside a computation, a batch or a flush,\n * whose own exit flushes.\n *\n * @param root The owner to dispose, with its whole subtree.\n * @throws The error of a cleanup that no error handler caught, once the whole tree is disposed\n * (several such errors are thrown together as an `AggregateError`); during a running flush, that\n * flush throws them instead. An error of the flush that\n * follows is thrown as is, or combined with the cleanup errors in an `AggregateError`.\n * @example\n * import { addCleanup, createOwner, disposeOwner } from \"@shadow-js/core/extend\";\n *\n * const owner = createOwner(null);\n * addCleanup(owner, () => console.log(\"released\"));\n * disposeOwner(owner); // logs \"released\"\n * @see addCleanup\n * @since 1.0.0\n */\nexport function disposeTree(root: Owner): void {\n let failure: unknown;\n let failed = false;\n try {\n disposeSubtree(root);\n } catch (error) {\n failed = true;\n failure = error;\n }\n if (rt.running === null && rt.batchDepth === 0 && !rt.flushing && hasPending()) {\n try {\n flush();\n } catch (error) {\n if (!failed) throw error;\n throw new AggregateError(\n [failure, error],\n __DEV__ ? \"Disposal and the following flush both threw.\" : \"SHADOW_DISPOSE_FLUSH_ERRORS\",\n );\n }\n }\n if (failed) throw failure;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,SAAgB,YAAY,MAAmB;CAC7C,IAAI;CACJ,IAAI,SAAS;CACb,IAAI;EACF,cAAe,IAAI;CACrB,SAAS,OAAO;EACd,SAAS;EACT,UAAU;CACZ;CACA,IAAI,GAAG,YAAY,QAAQ,GAAG,eAAe,KAAK,CAAC,GAAG,YAAY,WAAW,GAC3E,IAAI;EACF,MAAM;CACR,SAAS,OAAO;EACd,IAAI,CAAC,QAAQ,MAAM;EACnB,MAAM,IAAI,eACR,CAAC,SAAS,KAAK,GACL,8CACZ;CACF;CAEF,IAAI,QAAQ,MAAM;AACpB"}
@@ -0,0 +1,10 @@
1
+ // src/internal/flags.ts
2
+ /** Effect is queued in (or parked from) the transition lane, not the urgent queues. */
3
+ const FLAG_TRANSITION = 1024;
4
+ /** Effect was due while its owner was paused: it waits, unqueued, until the owner resumes. */
5
+ const FLAG_PARKED = 2048;
6
+ /** Computation threw a suspension: it keeps its previous value until its boundary releases it. */
7
+ const FLAG_SUSPENDED = 4096;
8
+ export { FLAG_PARKED, FLAG_SUSPENDED, FLAG_TRANSITION };
9
+
10
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","names":[],"sources":["../../../src/internal/flags.ts"],"sourcesContent":["/** Node states: how stale a node is. Monotonic CLEAN < CHECK < DIRTY between two refreshes. */\nexport const CLEAN = 0;\n/** A transitive source changed; verify sources before recomputing. */\nexport const CHECK = 1;\n/** A direct source changed; recompute. */\nexport const DIRTY = 2;\n\n/** Node kinds. */\nexport const KIND_SIGNAL = 0;\nexport const KIND_MEMO = 1;\nexport const KIND_EFFECT = 2;\n\n/** Bit flags on computations. */\nexport const FLAG_RUNNING = 1;\nexport const FLAG_QUEUED = 2;\nexport const FLAG_DISPOSED = 4;\nexport const FLAG_HAS_ERROR = 8;\n/** Effect belongs to the render phase (runs before user effects, synchronously at creation). */\nexport const FLAG_RENDER = 16;\n/** Memo has not produced its first value yet. */\nexport const FLAG_UNINIT = 32;\n/** Explicit-dependency effect whose first apply is skipped. */\nexport const FLAG_DEFER = 64;\n/** Node is on the pull stack of updateIfNecessary (guards re-entrant ancestor refreshes). */\nexport const FLAG_REFRESHING = 128;\n/** Memo that builds components: its body may write signals (component setup does). */\nexport const FLAG_ALLOW_WRITES = 256;\n/** Effect always runs in the transition lane (the watcher behind useDeferredValue). */\nexport const FLAG_LANE = 512;\n/** Effect is queued in (or parked from) the transition lane, not the urgent queues. */\nexport const FLAG_TRANSITION = 1024;\n/** Effect was due while its owner was paused: it waits, unqueued, until the owner resumes. */\nexport const FLAG_PARKED = 2048;\n/** Computation threw a suspension: it keeps its previous value until its boundary releases it. */\nexport const FLAG_SUSPENDED = 4096;\n"],"mappings":";;AA8BA,MAAa,kBAAkB;;AAE/B,MAAa,cAAc;;AAE3B,MAAa,iBAAiB"}