@spearwolf/shadow-objects 0.33.0 → 0.35.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 (312) hide show
  1. package/CHANGELOG.md +350 -61
  2. package/README.md +66 -13
  3. package/bundle.js +6 -53
  4. package/package.json +15 -3
  5. package/src/ChangeTrailRefusedError.d.ts +27 -0
  6. package/src/ChangeTrailRefusedError.d.ts.map +1 -0
  7. package/src/ChangeTrailRefusedError.js +12 -0
  8. package/src/ChangeTrailRefusedError.js.map +7 -0
  9. package/src/EntityUuidInUseError.d.ts +19 -0
  10. package/src/EntityUuidInUseError.d.ts.map +1 -0
  11. package/src/EntityUuidInUseError.js +11 -0
  12. package/src/EntityUuidInUseError.js.map +7 -0
  13. package/src/WorkerTimeoutError.d.ts +26 -0
  14. package/src/WorkerTimeoutError.d.ts.map +1 -0
  15. package/src/WorkerTimeoutError.js +12 -0
  16. package/src/WorkerTimeoutError.js.map +7 -0
  17. package/src/bundle.d.ts +1 -1
  18. package/src/bundle.d.ts.map +1 -1
  19. package/src/bundle.js +1 -1
  20. package/src/bundle.js.map +2 -2
  21. package/src/constants.d.ts +13 -2
  22. package/src/constants.d.ts.map +1 -1
  23. package/src/constants.js +7 -1
  24. package/src/constants.js.map +2 -2
  25. package/src/create-worker.bundle.d.ts +1 -1
  26. package/src/create-worker.bundle.d.ts.map +1 -1
  27. package/src/create-worker.bundle.js.map +1 -1
  28. package/src/create-worker.d.ts +1 -1
  29. package/src/create-worker.d.ts.map +1 -1
  30. package/src/create-worker.js.map +1 -1
  31. package/src/elements/ShaeElement.d.ts +70 -2
  32. package/src/elements/ShaeElement.d.ts.map +1 -1
  33. package/src/elements/ShaeElement.js +129 -25
  34. package/src/elements/ShaeElement.js.map +3 -3
  35. package/src/elements/ShaeEntElement.d.ts +39 -1
  36. package/src/elements/ShaeEntElement.d.ts.map +1 -1
  37. package/src/elements/ShaeEntElement.js +397 -167
  38. package/src/elements/ShaeEntElement.js.map +2 -2
  39. package/src/elements/ShaeLifecycleElement.d.ts +71 -0
  40. package/src/elements/ShaeLifecycleElement.d.ts.map +1 -0
  41. package/src/elements/ShaeLifecycleElement.js +83 -0
  42. package/src/elements/ShaeLifecycleElement.js.map +7 -0
  43. package/src/elements/ShaePropElement.d.ts +61 -2
  44. package/src/elements/ShaePropElement.d.ts.map +1 -1
  45. package/src/elements/ShaePropElement.js +264 -219
  46. package/src/elements/ShaePropElement.js.map +2 -2
  47. package/src/elements/ShaeWorkerElement.d.ts +59 -5
  48. package/src/elements/ShaeWorkerElement.d.ts.map +1 -1
  49. package/src/elements/ShaeWorkerElement.js +271 -73
  50. package/src/elements/ShaeWorkerElement.js.map +2 -2
  51. package/src/elements/constants.d.ts +9 -0
  52. package/src/elements/constants.d.ts.map +1 -1
  53. package/src/elements/constants.js +18 -0
  54. package/src/elements/constants.js.map +2 -2
  55. package/src/elements/deferredTeardown.d.ts +24 -0
  56. package/src/elements/deferredTeardown.d.ts.map +1 -0
  57. package/src/elements/deferredTeardown.js +30 -0
  58. package/src/elements/deferredTeardown.js.map +7 -0
  59. package/src/elements/displayContentsRule.d.ts +25 -0
  60. package/src/elements/displayContentsRule.d.ts.map +1 -0
  61. package/src/elements/displayContentsRule.js +37 -0
  62. package/src/elements/displayContentsRule.js.map +7 -0
  63. package/src/elements/events.d.ts +10 -7
  64. package/src/elements/events.d.ts.map +1 -1
  65. package/src/elements/forwardCustomEvents.d.ts +19 -0
  66. package/src/elements/forwardCustomEvents.d.ts.map +1 -0
  67. package/src/elements/forwardCustomEvents.js +47 -0
  68. package/src/elements/forwardCustomEvents.js.map +7 -0
  69. package/src/elements/hostedSlots.d.ts +36 -0
  70. package/src/elements/hostedSlots.d.ts.map +1 -0
  71. package/src/elements/hostedSlots.js +118 -0
  72. package/src/elements/hostedSlots.js.map +7 -0
  73. package/src/elements/parentRemoval.d.ts +18 -0
  74. package/src/elements/parentRemoval.d.ts.map +1 -0
  75. package/src/elements/parentRemoval.js +60 -0
  76. package/src/elements/parentRemoval.js.map +7 -0
  77. package/src/elements/propValueConverters.d.ts +3 -0
  78. package/src/elements/propValueConverters.d.ts.map +1 -0
  79. package/src/elements/propValueConverters.js +54 -0
  80. package/src/elements/propValueConverters.js.map +7 -0
  81. package/src/elements/requestEntAncestor.d.ts +32 -0
  82. package/src/elements/requestEntAncestor.d.ts.map +1 -0
  83. package/src/elements/requestEntAncestor.js +16 -0
  84. package/src/elements/requestEntAncestor.js.map +7 -0
  85. package/src/elements.js.map +1 -1
  86. package/src/in-the-dark/Entity.d.ts +143 -3
  87. package/src/in-the-dark/Entity.d.ts.map +1 -1
  88. package/src/in-the-dark/Entity.js +330 -63
  89. package/src/in-the-dark/Entity.js.map +3 -3
  90. package/src/in-the-dark/Kernel.d.ts +98 -16
  91. package/src/in-the-dark/Kernel.d.ts.map +1 -1
  92. package/src/in-the-dark/Kernel.js +466 -379
  93. package/src/in-the-dark/Kernel.js.map +3 -3
  94. package/src/in-the-dark/Registry.d.ts +7 -1
  95. package/src/in-the-dark/Registry.d.ts.map +1 -1
  96. package/src/in-the-dark/Registry.js +112 -14
  97. package/src/in-the-dark/Registry.js.map +2 -2
  98. package/src/in-the-dark/ShadowObject.d.ts.map +1 -1
  99. package/src/in-the-dark/ShadowObject.js +1 -0
  100. package/src/in-the-dark/ShadowObject.js.map +2 -2
  101. package/src/in-the-dark/ShadowObjectCreationScope.d.ts +133 -0
  102. package/src/in-the-dark/ShadowObjectCreationScope.d.ts.map +1 -0
  103. package/src/in-the-dark/ShadowObjectCreationScope.js +603 -0
  104. package/src/in-the-dark/ShadowObjectCreationScope.js.map +7 -0
  105. package/src/in-the-dark/SignalsPath.d.ts +2 -0
  106. package/src/in-the-dark/SignalsPath.d.ts.map +1 -1
  107. package/src/in-the-dark/SignalsPath.js +6 -2
  108. package/src/in-the-dark/SignalsPath.js.map +2 -2
  109. package/src/in-the-dark/displayName.d.ts +4 -0
  110. package/src/in-the-dark/displayName.d.ts.map +1 -0
  111. package/src/in-the-dark/displayName.js +5 -0
  112. package/src/in-the-dark/displayName.js.map +7 -0
  113. package/src/in-the-dark/events.js.map +1 -1
  114. package/src/in-the-dark/importModule.d.ts +7 -0
  115. package/src/in-the-dark/importModule.d.ts.map +1 -1
  116. package/src/in-the-dark/importModule.js +5 -2
  117. package/src/in-the-dark/importModule.js.map +2 -2
  118. package/src/index.d.ts +9 -1
  119. package/src/index.d.ts.map +1 -1
  120. package/src/index.js +9 -1
  121. package/src/index.js.map +2 -2
  122. package/src/inspect/createKernelSnapshot.d.ts +17 -0
  123. package/src/inspect/createKernelSnapshot.d.ts.map +1 -0
  124. package/src/inspect/createKernelSnapshot.js +247 -0
  125. package/src/inspect/createKernelSnapshot.js.map +7 -0
  126. package/src/inspect/createViewSnapshot.d.ts +10 -0
  127. package/src/inspect/createViewSnapshot.d.ts.map +1 -0
  128. package/src/inspect/createViewSnapshot.js +143 -0
  129. package/src/inspect/createViewSnapshot.js.map +7 -0
  130. package/src/inspect/normalizeInspectRequest.d.ts +32 -0
  131. package/src/inspect/normalizeInspectRequest.d.ts.map +1 -0
  132. package/src/inspect/normalizeInspectRequest.js +55 -0
  133. package/src/inspect/normalizeInspectRequest.js.map +7 -0
  134. package/src/inspect/serializeValue.d.ts +13 -0
  135. package/src/inspect/serializeValue.d.ts.map +1 -0
  136. package/src/inspect/serializeValue.js +149 -0
  137. package/src/inspect/serializeValue.js.map +7 -0
  138. package/src/inspect/types.d.ts +260 -0
  139. package/src/inspect/types.d.ts.map +1 -0
  140. package/src/inspect/types.js +1 -0
  141. package/src/inspect/types.js.map +7 -0
  142. package/src/model-context/ModelContextLike.d.ts +59 -0
  143. package/src/model-context/ModelContextLike.d.ts.map +1 -0
  144. package/src/model-context/ModelContextLike.js +15 -0
  145. package/src/model-context/ModelContextLike.js.map +7 -0
  146. package/src/model-context/exposeShadowEnvsToModelContext.d.ts +48 -0
  147. package/src/model-context/exposeShadowEnvsToModelContext.d.ts.map +1 -0
  148. package/src/model-context/exposeShadowEnvsToModelContext.js +39 -0
  149. package/src/model-context/exposeShadowEnvsToModelContext.js.map +7 -0
  150. package/src/model-context/redactProps.d.ts +14 -0
  151. package/src/model-context/redactProps.d.ts.map +1 -0
  152. package/src/model-context/redactProps.js +22 -0
  153. package/src/model-context/redactProps.js.map +7 -0
  154. package/src/model-context/sharedExposure.d.ts +32 -0
  155. package/src/model-context/sharedExposure.d.ts.map +1 -0
  156. package/src/model-context/sharedExposure.js +108 -0
  157. package/src/model-context/sharedExposure.js.map +7 -0
  158. package/src/model-context/toolSupport.d.ts +72 -0
  159. package/src/model-context/toolSupport.d.ts.map +1 -0
  160. package/src/model-context/toolSupport.js +145 -0
  161. package/src/model-context/toolSupport.js.map +7 -0
  162. package/src/model-context/tools/findEntities.d.ts +15 -0
  163. package/src/model-context/tools/findEntities.d.ts.map +1 -0
  164. package/src/model-context/tools/findEntities.js +71 -0
  165. package/src/model-context/tools/findEntities.js.map +7 -0
  166. package/src/model-context/tools/getEntity.d.ts +16 -0
  167. package/src/model-context/tools/getEntity.d.ts.map +1 -0
  168. package/src/model-context/tools/getEntity.js +65 -0
  169. package/src/model-context/tools/getEntity.js.map +7 -0
  170. package/src/model-context/tools/getEntityTree.d.ts +4 -0
  171. package/src/model-context/tools/getEntityTree.d.ts.map +1 -0
  172. package/src/model-context/tools/getEntityTree.js +58 -0
  173. package/src/model-context/tools/getEntityTree.js.map +7 -0
  174. package/src/model-context/tools/getRegistry.d.ts +14 -0
  175. package/src/model-context/tools/getRegistry.d.ts.map +1 -0
  176. package/src/model-context/tools/getRegistry.js +39 -0
  177. package/src/model-context/tools/getRegistry.js.map +7 -0
  178. package/src/model-context/tools/index.d.ts +9 -0
  179. package/src/model-context/tools/index.d.ts.map +1 -0
  180. package/src/model-context/tools/index.js +16 -0
  181. package/src/model-context/tools/index.js.map +7 -0
  182. package/src/model-context/tools/listEnvs.d.ts +33 -0
  183. package/src/model-context/tools/listEnvs.d.ts.map +1 -0
  184. package/src/model-context/tools/listEnvs.js +37 -0
  185. package/src/model-context/tools/listEnvs.js.map +7 -0
  186. package/src/model-context.d.ts +13 -0
  187. package/src/model-context.d.ts.map +1 -0
  188. package/src/model-context.js +15 -0
  189. package/src/model-context.js.map +7 -0
  190. package/src/shadow-objects.d.ts +4 -0
  191. package/src/shadow-objects.d.ts.map +1 -1
  192. package/src/shadow-objects.js +6 -0
  193. package/src/shadow-objects.js.map +2 -2
  194. package/src/shadow-objects.worker.js +0 -1
  195. package/src/shadow-objects.worker.js.map +2 -2
  196. package/src/shae-ent.js.map +1 -1
  197. package/src/shae-prop.js +2 -2
  198. package/src/shae-prop.js.map +2 -2
  199. package/src/shae-worker.js.map +1 -1
  200. package/src/testing/TestEntity.d.ts +79 -0
  201. package/src/testing/TestEntity.d.ts.map +1 -0
  202. package/src/testing/TestEntity.js +135 -0
  203. package/src/testing/TestEntity.js.map +7 -0
  204. package/src/testing/createTestKernel.d.ts +11 -0
  205. package/src/testing/createTestKernel.d.ts.map +1 -0
  206. package/src/testing/createTestKernel.js +132 -0
  207. package/src/testing/createTestKernel.js.map +7 -0
  208. package/src/testing/mountShadowObject.d.ts +21 -0
  209. package/src/testing/mountShadowObject.d.ts.map +1 -0
  210. package/src/testing/mountShadowObject.js +72 -0
  211. package/src/testing/mountShadowObject.js.map +7 -0
  212. package/src/testing/recordKernelErrors.d.ts +21 -0
  213. package/src/testing/recordKernelErrors.d.ts.map +1 -0
  214. package/src/testing/recordKernelErrors.js +39 -0
  215. package/src/testing/recordKernelErrors.js.map +7 -0
  216. package/src/testing/settle.d.ts +15 -0
  217. package/src/testing/settle.d.ts.map +1 -0
  218. package/src/testing/settle.js +19 -0
  219. package/src/testing/settle.js.map +7 -0
  220. package/src/testing/types.d.ts +119 -0
  221. package/src/testing/types.d.ts.map +1 -0
  222. package/src/testing/types.js +1 -0
  223. package/src/testing/types.js.map +7 -0
  224. package/src/testing.d.ts +14 -0
  225. package/src/testing.d.ts.map +1 -0
  226. package/src/testing.js +11 -0
  227. package/src/testing.js.map +7 -0
  228. package/src/types.d.ts +185 -14
  229. package/src/types.d.ts.map +1 -1
  230. package/src/utils/ConsoleLogger.d.ts +45 -10
  231. package/src/utils/ConsoleLogger.d.ts.map +1 -1
  232. package/src/utils/ConsoleLogger.js +51 -26
  233. package/src/utils/ConsoleLogger.js.map +2 -2
  234. package/src/utils/FrameLoop.d.ts +42 -3
  235. package/src/utils/FrameLoop.d.ts.map +1 -1
  236. package/src/utils/FrameLoop.js +71 -10
  237. package/src/utils/FrameLoop.js.map +2 -2
  238. package/src/utils/MicrotaskCollector.d.ts +45 -0
  239. package/src/utils/MicrotaskCollector.d.ts.map +1 -0
  240. package/src/utils/MicrotaskCollector.js +33 -0
  241. package/src/utils/MicrotaskCollector.js.map +7 -0
  242. package/src/utils/MicrotaskGate.d.ts +17 -0
  243. package/src/utils/MicrotaskGate.d.ts.map +1 -0
  244. package/src/utils/MicrotaskGate.js +20 -0
  245. package/src/utils/MicrotaskGate.js.map +7 -0
  246. package/src/utils/array-utils.js.map +1 -1
  247. package/src/utils/attr-utils.d.ts +11 -0
  248. package/src/utils/attr-utils.d.ts.map +1 -1
  249. package/src/utils/attr-utils.js +5 -1
  250. package/src/utils/attr-utils.js.map +2 -2
  251. package/src/utils/constants.js.map +1 -1
  252. package/src/utils/generateUUID.d.ts +11 -0
  253. package/src/utils/generateUUID.d.ts.map +1 -1
  254. package/src/utils/generateUUID.js +31 -266
  255. package/src/utils/generateUUID.js.map +2 -2
  256. package/src/utils/props-utils.d.ts +3 -2
  257. package/src/utils/props-utils.d.ts.map +1 -1
  258. package/src/utils/props-utils.js +13 -24
  259. package/src/utils/props-utils.js.map +2 -2
  260. package/src/utils/runGuarded.d.ts +27 -0
  261. package/src/utils/runGuarded.d.ts.map +1 -0
  262. package/src/utils/runGuarded.js +11 -0
  263. package/src/utils/runGuarded.js.map +7 -0
  264. package/src/utils/toMaybe.d.ts.map +1 -1
  265. package/src/utils/toMaybe.js.map +1 -1
  266. package/src/utils/toNamespace.d.ts.map +1 -1
  267. package/src/utils/toNamespace.js.map +1 -1
  268. package/src/utils/toUrlString.d.ts +12 -0
  269. package/src/utils/toUrlString.d.ts.map +1 -1
  270. package/src/utils/toUrlString.js.map +2 -2
  271. package/src/utils/waitForMessageOfType.d.ts +12 -1
  272. package/src/utils/waitForMessageOfType.d.ts.map +1 -1
  273. package/src/utils/waitForMessageOfType.js +16 -1
  274. package/src/utils/waitForMessageOfType.js.map +2 -2
  275. package/src/view/ComponentChanges.d.ts +88 -1
  276. package/src/view/ComponentChanges.d.ts.map +1 -1
  277. package/src/view/ComponentChanges.js +243 -73
  278. package/src/view/ComponentChanges.js.map +2 -2
  279. package/src/view/ComponentContext.d.ts +206 -16
  280. package/src/view/ComponentContext.d.ts.map +1 -1
  281. package/src/view/ComponentContext.js +548 -91
  282. package/src/view/ComponentContext.js.map +2 -2
  283. package/src/view/ComponentMemory.d.ts +3 -3
  284. package/src/view/ComponentMemory.d.ts.map +1 -1
  285. package/src/view/ComponentMemory.js.map +1 -1
  286. package/src/view/IShadowObjectEnvProxy.d.ts +38 -3
  287. package/src/view/IShadowObjectEnvProxy.d.ts.map +1 -1
  288. package/src/view/LocalShadowObjectEnv.d.ts +8 -1
  289. package/src/view/LocalShadowObjectEnv.d.ts.map +1 -1
  290. package/src/view/LocalShadowObjectEnv.js +23 -7
  291. package/src/view/LocalShadowObjectEnv.js.map +2 -2
  292. package/src/view/RemoteWorkerEnv.d.ts +108 -5
  293. package/src/view/RemoteWorkerEnv.d.ts.map +1 -1
  294. package/src/view/RemoteWorkerEnv.js +244 -77
  295. package/src/view/RemoteWorkerEnv.js.map +2 -2
  296. package/src/view/ShadowEnv.d.ts +79 -2
  297. package/src/view/ShadowEnv.d.ts.map +1 -1
  298. package/src/view/ShadowEnv.js +323 -59
  299. package/src/view/ShadowEnv.js.map +3 -3
  300. package/src/view/ViewComponent.d.ts +78 -14
  301. package/src/view/ViewComponent.d.ts.map +1 -1
  302. package/src/view/ViewComponent.js +90 -14
  303. package/src/view/ViewComponent.js.map +2 -2
  304. package/src/view/cloneChangeTrail.js.map +2 -2
  305. package/src/worker/MessageRouter.d.ts +14 -0
  306. package/src/worker/MessageRouter.d.ts.map +1 -1
  307. package/src/worker/MessageRouter.js +98 -15
  308. package/src/worker/MessageRouter.js.map +2 -2
  309. package/src/worker/WorkerRuntime.d.ts +22 -1
  310. package/src/worker/WorkerRuntime.d.ts.map +1 -1
  311. package/src/worker/WorkerRuntime.js +60 -8
  312. package/src/worker/WorkerRuntime.js.map +2 -2
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@spearwolf/shadow-objects",
3
3
  "description": "a reactive entity-component framework that feels at home in the shadows",
4
4
  "homepage": "https://github.com/spearwolf/shadow-objects/",
5
- "version": "0.33.0",
5
+ "version": "0.35.0",
6
6
  "author": {
7
7
  "name": "Wolfger Schramm",
8
8
  "email": "wolfger@spearwolf.de",
@@ -54,6 +54,18 @@
54
54
  "./ConsoleLogger.js": {
55
55
  "import": "./src/utils/ConsoleLogger.js",
56
56
  "types": "./src/utils/ConsoleLogger.d.ts"
57
+ },
58
+ "./FrameLoop.js": {
59
+ "import": "./src/utils/FrameLoop.js",
60
+ "types": "./src/utils/FrameLoop.d.ts"
61
+ },
62
+ "./model-context.js": {
63
+ "import": "./src/model-context.js",
64
+ "types": "./src/model-context.d.ts"
65
+ },
66
+ "./testing.js": {
67
+ "import": "./src/testing.js",
68
+ "types": "./src/testing.d.ts"
57
69
  }
58
70
  },
59
71
  "sideEffects": [
@@ -69,7 +81,7 @@
69
81
  "src/shae-worker.js"
70
82
  ],
71
83
  "dependencies": {
72
- "@spearwolf/eventize": "^5.0.0",
73
- "@spearwolf/signalize": "^0.30.0"
84
+ "@spearwolf/eventize": "^6.2.0",
85
+ "@spearwolf/signalize": "^1.0.0"
74
86
  }
75
87
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The reason a Shadow Environment refuses a change trail it could only apply in part.
3
+ *
4
+ * A change trail is applied entry by entry and the first throw ends the run, so what the Kernel
5
+ * holds afterwards is always a prefix of the trail: the entries in `[0, appliedCount)` are
6
+ * applied, the entry at `appliedCount` is the one that threw, and everything behind it was never
7
+ * attempted. That single number is therefore the whole answer to "how far did it get" — the view
8
+ * side folds the prefix into its bookkeeping and sends the rest again with the next trail.
9
+ *
10
+ * `cause` carries what the entry actually threw. Across a worker boundary that is a
11
+ * `WorkerReportedError` carrying the wording and the name of the throw; the class of the original
12
+ * error and the fields it added do not cross the boundary.
13
+ *
14
+ * A refusal for a reason that says nothing about how far the Kernel got — a confirmation window
15
+ * that ran out, a worker that died, a proxy of someone else's making — is not one of these. The
16
+ * view reads such a reason as "the whole trail may well have been applied", which is the safe
17
+ * direction: a creation the Kernel already holds an entity for is refused, and the same trail
18
+ * comes back to the same refusal for as long as the view keeps sending it.
19
+ */
20
+ export declare class ChangeTrailRefusedError extends Error {
21
+ /** how many entries of the change trail the Kernel applied before it stopped */
22
+ readonly appliedCount: number;
23
+ /** how many entries the change trail carried */
24
+ readonly entryCount: number;
25
+ constructor(appliedCount: number, entryCount: number, options?: ErrorOptions);
26
+ }
27
+ //# sourceMappingURL=ChangeTrailRefusedError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChangeTrailRefusedError.d.ts","sourceRoot":"","sources":["../../src/ChangeTrailRefusedError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,gFAAgF;IAChF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,YAAY,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAK3E;CACF"}
@@ -0,0 +1,12 @@
1
+ class ChangeTrailRefusedError extends Error {
2
+ constructor(appliedCount, entryCount, options) {
3
+ super(`the kernel applied ${appliedCount} of ${entryCount} change trail entries`, options);
4
+ this.name = "ChangeTrailRefusedError";
5
+ this.appliedCount = appliedCount;
6
+ this.entryCount = entryCount;
7
+ }
8
+ }
9
+ export {
10
+ ChangeTrailRefusedError
11
+ };
12
+ //# sourceMappingURL=ChangeTrailRefusedError.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ChangeTrailRefusedError.ts"],
4
+ "sourcesContent": ["/**\n * The reason a Shadow Environment refuses a change trail it could only apply in part.\n *\n * A change trail is applied entry by entry and the first throw ends the run, so what the Kernel\n * holds afterwards is always a prefix of the trail: the entries in `[0, appliedCount)` are\n * applied, the entry at `appliedCount` is the one that threw, and everything behind it was never\n * attempted. That single number is therefore the whole answer to \"how far did it get\" \u2014 the view\n * side folds the prefix into its bookkeeping and sends the rest again with the next trail.\n *\n * `cause` carries what the entry actually threw. Across a worker boundary that is a\n * `WorkerReportedError` carrying the wording and the name of the throw; the class of the original\n * error and the fields it added do not cross the boundary.\n *\n * A refusal for a reason that says nothing about how far the Kernel got \u2014 a confirmation window\n * that ran out, a worker that died, a proxy of someone else's making \u2014 is not one of these. The\n * view reads such a reason as \"the whole trail may well have been applied\", which is the safe\n * direction: a creation the Kernel already holds an entity for is refused, and the same trail\n * comes back to the same refusal for as long as the view keeps sending it.\n */\nexport class ChangeTrailRefusedError extends Error {\n /** how many entries of the change trail the Kernel applied before it stopped */\n readonly appliedCount: number;\n\n /** how many entries the change trail carried */\n readonly entryCount: number;\n\n constructor(appliedCount: number, entryCount: number, options?: ErrorOptions) {\n super(`the kernel applied ${appliedCount} of ${entryCount} change trail entries`, options);\n this.name = 'ChangeTrailRefusedError';\n this.appliedCount = appliedCount;\n this.entryCount = entryCount;\n }\n}\n"],
5
+ "mappings": "AAmBO,MAAM,gCAAgC,MAAM;AAAA,EAOjD,YAAY,cAAsB,YAAoB,SAAwB;AAC5E,UAAM,sBAAsB,YAAY,OAAO,UAAU,yBAAyB,OAAO;AACzF,SAAK,OAAO;AACZ,SAAK,eAAe;AACpB,SAAK,aAAa;AAAA,EACpB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Thrown when the Kernel is asked to create an entity under a uuid it already holds an entity for.
3
+ *
4
+ * A uuid names one entity at a time. The entity behind it keeps its shadow objects, its signals,
5
+ * its contexts, its token and its properties; the creation that was refused leaves nothing of
6
+ * itself anywhere, because the guard stands ahead of every write it would make.
7
+ *
8
+ * The uuid is free again once `Kernel.destroyEntity()` has been through: whoever wants an entity
9
+ * built anew under the same uuid destroys the one that stands first.
10
+ *
11
+ * In a change trail this is the reason underneath a `ChangeTrailRefusedError`: the trail is
12
+ * refused at that entry, and `appliedCount` names the prefix the Kernel did apply.
13
+ */
14
+ export declare class EntityUuidInUseError extends Error {
15
+ /** the uuid the kernel already holds an entity for */
16
+ readonly uuid: string;
17
+ constructor(uuid: string);
18
+ }
19
+ //# sourceMappingURL=EntityUuidInUseError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityUuidInUseError.d.ts","sourceRoot":"","sources":["../../src/EntityUuidInUseError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAIvB;CACF"}
@@ -0,0 +1,11 @@
1
+ class EntityUuidInUseError extends Error {
2
+ constructor(uuid) {
3
+ super(`the kernel cannot create an entity because the uuid ${uuid} is already held by another entity`);
4
+ this.name = "EntityUuidInUseError";
5
+ this.uuid = uuid;
6
+ }
7
+ }
8
+ export {
9
+ EntityUuidInUseError
10
+ };
11
+ //# sourceMappingURL=EntityUuidInUseError.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/EntityUuidInUseError.ts"],
4
+ "sourcesContent": ["/**\n * Thrown when the Kernel is asked to create an entity under a uuid it already holds an entity for.\n *\n * A uuid names one entity at a time. The entity behind it keeps its shadow objects, its signals,\n * its contexts, its token and its properties; the creation that was refused leaves nothing of\n * itself anywhere, because the guard stands ahead of every write it would make.\n *\n * The uuid is free again once `Kernel.destroyEntity()` has been through: whoever wants an entity\n * built anew under the same uuid destroys the one that stands first.\n *\n * In a change trail this is the reason underneath a `ChangeTrailRefusedError`: the trail is\n * refused at that entry, and `appliedCount` names the prefix the Kernel did apply.\n */\nexport class EntityUuidInUseError extends Error {\n /** the uuid the kernel already holds an entity for */\n readonly uuid: string;\n\n constructor(uuid: string) {\n super(`the kernel cannot create an entity because the uuid ${uuid} is already held by another entity`);\n this.name = 'EntityUuidInUseError';\n this.uuid = uuid;\n }\n}\n"],
5
+ "mappings": "AAaO,MAAM,6BAA6B,MAAM;AAAA,EAI9C,YAAY,MAAc;AACxB,UAAM,uDAAuD,IAAI,oCAAoC;AACrG,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ import type { WorkerReplyType } from './constants.js';
2
+ /**
3
+ * The reason a reply from the worker did not arrive in time.
4
+ *
5
+ * Five replies of a `RemoteWorkerEnv` have a deadline, and `messageType` names the one that stayed
6
+ * out: the `Loaded` greeting of the load handshake, the `ImportedModule` answer to an
7
+ * `importScript()`, the `AppliedChangeTrail` confirmation of a change trail sent with
8
+ * `waitForConfirmation`, the `Inspected` answer to an `inspect()`, and the `Destroyed` receipt of
9
+ * a teardown.
10
+ *
11
+ * `timeout` carries the number of milliseconds that were waited, so a diagnosis knows which of the
12
+ * five values was in force without reaching for the `timeouts` of the `RemoteWorkerEnv`.
13
+ *
14
+ * The error says nothing about what the worker did with the request. A confirmation window that
15
+ * ran out leaves a Shadow Environment that may well have applied the whole change trail, which is
16
+ * why `ShadowEnv` books it as applied; `ChangeTrailRefusedError` is the only refusal that names a
17
+ * number.
18
+ */
19
+ export declare class WorkerTimeoutError extends Error {
20
+ /** the type of the message that did not arrive */
21
+ readonly messageType: WorkerReplyType;
22
+ /** how many milliseconds were waited for it */
23
+ readonly timeout: number;
24
+ constructor(messageType: WorkerReplyType, timeout: number);
25
+ }
26
+ //# sourceMappingURL=WorkerTimeoutError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkerTimeoutError.d.ts","sourceRoot":"","sources":["../../src/WorkerTimeoutError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,kDAAkD;IAClD,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC;IAEtC,+CAA+C;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,YAAY,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAKxD;CACF"}
@@ -0,0 +1,12 @@
1
+ class WorkerTimeoutError extends Error {
2
+ constructor(messageType, timeout) {
3
+ super(`no ${messageType} message arrived from the worker within ${timeout}ms`);
4
+ this.name = "WorkerTimeoutError";
5
+ this.messageType = messageType;
6
+ this.timeout = timeout;
7
+ }
8
+ }
9
+ export {
10
+ WorkerTimeoutError
11
+ };
12
+ //# sourceMappingURL=WorkerTimeoutError.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/WorkerTimeoutError.ts"],
4
+ "sourcesContent": ["import type {WorkerReplyType} from './constants.js';\n\n/**\n * The reason a reply from the worker did not arrive in time.\n *\n * Five replies of a `RemoteWorkerEnv` have a deadline, and `messageType` names the one that stayed\n * out: the `Loaded` greeting of the load handshake, the `ImportedModule` answer to an\n * `importScript()`, the `AppliedChangeTrail` confirmation of a change trail sent with\n * `waitForConfirmation`, the `Inspected` answer to an `inspect()`, and the `Destroyed` receipt of\n * a teardown.\n *\n * `timeout` carries the number of milliseconds that were waited, so a diagnosis knows which of the\n * five values was in force without reaching for the `timeouts` of the `RemoteWorkerEnv`.\n *\n * The error says nothing about what the worker did with the request. A confirmation window that\n * ran out leaves a Shadow Environment that may well have applied the whole change trail, which is\n * why `ShadowEnv` books it as applied; `ChangeTrailRefusedError` is the only refusal that names a\n * number.\n */\nexport class WorkerTimeoutError extends Error {\n /** the type of the message that did not arrive */\n readonly messageType: WorkerReplyType;\n\n /** how many milliseconds were waited for it */\n readonly timeout: number;\n\n constructor(messageType: WorkerReplyType, timeout: number) {\n super(`no ${messageType} message arrived from the worker within ${timeout}ms`);\n this.name = 'WorkerTimeoutError';\n this.messageType = messageType;\n this.timeout = timeout;\n }\n}\n"],
5
+ "mappings": "AAmBO,MAAM,2BAA2B,MAAM;AAAA,EAO5C,YAAY,aAA8B,SAAiB;AACzD,UAAM,MAAM,WAAW,2CAA2C,OAAO,IAAI;AAC7E,SAAK,OAAO;AACZ,SAAK,cAAc;AACnB,SAAK,UAAU;AAAA,EACjB;AACF;",
6
+ "names": []
7
+ }
package/src/bundle.d.ts CHANGED
@@ -2,6 +2,6 @@ import './shae-ent.js';
2
2
  import './shae-prop.js';
3
3
  import './shae-worker.js';
4
4
  declare global {
5
- var SHADOW_ENTS_BUNDLE_LOADED: boolean;
5
+ var SHADOW_OBJECTS_BUNDLE_LOADED: boolean;
6
6
  }
7
7
  //# sourceMappingURL=bundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AAE1B,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,yBAAyB,EAAE,OAAO,CAAC;CACxC"}
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundle.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,gBAAgB,CAAC;AACxB,OAAO,kBAAkB,CAAC;AAE1B,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,4BAA4B,EAAE,OAAO,CAAC;CAC3C"}
package/src/bundle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./shae-ent.js";
2
2
  import "./shae-prop.js";
3
3
  import "./shae-worker.js";
4
- globalThis.SHADOW_ENTS_BUNDLE_LOADED = true;
4
+ globalThis.SHADOW_OBJECTS_BUNDLE_LOADED = true;
5
5
  //# sourceMappingURL=bundle.js.map
package/src/bundle.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/bundle.ts"],
4
- "sourcesContent": ["import './shae-ent.js';\nimport './shae-prop.js';\nimport './shae-worker.js';\n\ndeclare global {\n // eslint-disable-next-line no-var\n var SHADOW_ENTS_BUNDLE_LOADED: boolean;\n}\n\nglobalThis.SHADOW_ENTS_BUNDLE_LOADED = true;"],
5
- "mappings": "AAAA,OAAO;AACP,OAAO;AACP,OAAO;AAOP,WAAW,4BAA4B;",
4
+ "sourcesContent": ["import './shae-ent.js';\nimport './shae-prop.js';\nimport './shae-worker.js';\n\ndeclare global {\n var SHADOW_OBJECTS_BUNDLE_LOADED: boolean;\n}\n\nglobalThis.SHADOW_OBJECTS_BUNDLE_LOADED = true;\n"],
5
+ "mappings": "AAAA,OAAO;AACP,OAAO;AACP,OAAO;AAMP,WAAW,+BAA+B;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,4 @@
1
- import type { NamespaceType } from './types.ts';
1
+ import type { NamespaceType } from './types.js';
2
2
  export declare enum ChangeTrailPhase {
3
3
  StructuralChanges = 1,
4
4
  ContentUpdates = 2,
@@ -16,17 +16,27 @@ export declare enum ComponentChangeType {
16
16
  export declare const GlobalNS: NamespaceType;
17
17
  export declare const VoidToken = "#void";
18
18
  /**
19
- * The event is dispatched by {@link ComponentContext.reCreateChanges} and forwarded to all {@link ViewComponent}.
19
+ * The event is dispatched by `ComponentContext.reCreateChanges` and forwarded to all `ViewComponent`.
20
20
  * The event itself has no other data.
21
21
  */
22
22
  export declare const ContextLost = "contextLost";
23
23
  export declare const Configure = "configure";
24
24
  export declare const ChangeTrail = "changeTrail";
25
+ export declare const Inspect = "inspect";
25
26
  export declare const Destroy = "destroy";
26
27
  export declare const Loaded = "loaded";
27
28
  export declare const AppliedChangeTrail = "appliedChangeTrail";
28
29
  export declare const ImportedModule = "importedModule";
29
30
  export declare const Destroyed = "destroyed";
31
+ export declare const Inspected = "inspected";
32
+ /**
33
+ * The five replies a `RemoteWorkerEnv` waits for, each behind a deadline of its own: the `Loaded`
34
+ * greeting of the load handshake, the `ImportedModule` answer to an `importScript()`, the
35
+ * `AppliedChangeTrail` confirmation of a change trail sent with `waitForConfirmation`, the
36
+ * `Inspected` answer to an `inspect()`, and the `Destroyed` receipt of a teardown. A `switch` over
37
+ * the five is exhaustive.
38
+ */
39
+ export type WorkerReplyType = typeof Loaded | typeof AppliedChangeTrail | typeof ImportedModule | typeof Inspected | typeof Destroyed;
30
40
  /**
31
41
  * The `messageToView` event is fired when the kernel receives a message from an entity (to its view component counterpart)
32
42
  */
@@ -34,6 +44,7 @@ export declare const MessageToView = "messageToView";
34
44
  export declare const WorkerLoadTimeout = 60000;
35
45
  export declare const WorkerConfigureTimeout = 60000;
36
46
  export declare const WorkerChangeTrailTimeout = 5000;
47
+ export declare const WorkerInspectTimeout = 5000;
37
48
  export declare const WorkerDestroyTimeout = 5000;
38
49
  export declare const ShadowObjectsExport = "shadowObjects";
39
50
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAE9C,oBAAY,gBAAgB;IAC1B,iBAAiB,IAAI;IACrB,cAAc,IAAA;IACd,OAAO,IAAA;CACR;AAED,oBAAY,mBAAmB;IAC7B,cAAc,IAAI;IAClB,eAAe,IAAA;IACf,SAAS,IAAA;IACT,WAAW,IAAA;IACX,gBAAgB,IAAA;IAChB,WAAW,IAAA;IACX,UAAU,IAAA;CACX;AAED,eAAO,MAAM,QAAQ,EAAE,aAAgD,CAAC;AAExE,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,OAAO,YAAY,CAAC;AAEjC,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AACvC,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,eAAO,MAAM,mBAAmB,kBAAkB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAE9C,oBAAY,gBAAgB;IAC1B,iBAAiB,IAAI;IACrB,cAAc,IAAA;IACd,OAAO,IAAA;CACR;AAED,oBAAY,mBAAmB;IAC7B,cAAc,IAAI;IAClB,eAAe,IAAA;IACf,SAAS,IAAA;IACT,WAAW,IAAA;IACX,gBAAgB,IAAA;IAChB,WAAW,IAAA;IACX,UAAU,IAAA;CACX;AAED,eAAO,MAAM,QAAQ,EAAE,aAAmD,CAAC;AAE3E,eAAO,MAAM,SAAS,UAAU,CAAC;AAEjC;;;GAGG;AACH,eAAO,MAAM,WAAW,gBAAgB,CAAC;AAEzC,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,OAAO,YAAY,CAAC;AACjC,eAAO,MAAM,OAAO,YAAY,CAAC;AAEjC,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AACvD,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,SAAS,cAAc,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,OAAO,MAAM,GACb,OAAO,kBAAkB,GACzB,OAAO,cAAc,GACrB,OAAO,SAAS,GAChB,OAAO,SAAS,CAAC;AAErB;;GAEG;AACH,eAAO,MAAM,aAAa,kBAAkB,CAAC;AAE7C,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AACvC,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAC7C,eAAO,MAAM,oBAAoB,OAAO,CAAC;AACzC,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,eAAO,MAAM,mBAAmB,kBAAkB,CAAC"}
package/src/constants.js CHANGED
@@ -14,20 +14,23 @@ var ComponentChangeType = /* @__PURE__ */ ((ComponentChangeType2) => {
14
14
  ComponentChangeType2[ComponentChangeType2["SendEvents"] = 7] = "SendEvents";
15
15
  return ComponentChangeType2;
16
16
  })(ComponentChangeType || {});
17
- const GlobalNS = /* @__PURE__ */ Symbol.for("ShadowEntsGlobalNS");
17
+ const GlobalNS = /* @__PURE__ */ Symbol.for("ShadowObjectsGlobalNS");
18
18
  const VoidToken = "#void";
19
19
  const ContextLost = "contextLost";
20
20
  const Configure = "configure";
21
21
  const ChangeTrail = "changeTrail";
22
+ const Inspect = "inspect";
22
23
  const Destroy = "destroy";
23
24
  const Loaded = "loaded";
24
25
  const AppliedChangeTrail = "appliedChangeTrail";
25
26
  const ImportedModule = "importedModule";
26
27
  const Destroyed = "destroyed";
28
+ const Inspected = "inspected";
27
29
  const MessageToView = "messageToView";
28
30
  const WorkerLoadTimeout = 6e4;
29
31
  const WorkerConfigureTimeout = 6e4;
30
32
  const WorkerChangeTrailTimeout = 5e3;
33
+ const WorkerInspectTimeout = 5e3;
31
34
  const WorkerDestroyTimeout = 5e3;
32
35
  const ShadowObjectsExport = "shadowObjects";
33
36
  export {
@@ -41,6 +44,8 @@ export {
41
44
  Destroyed,
42
45
  GlobalNS,
43
46
  ImportedModule,
47
+ Inspect,
48
+ Inspected,
44
49
  Loaded,
45
50
  MessageToView,
46
51
  ShadowObjectsExport,
@@ -48,6 +53,7 @@ export {
48
53
  WorkerChangeTrailTimeout,
49
54
  WorkerConfigureTimeout,
50
55
  WorkerDestroyTimeout,
56
+ WorkerInspectTimeout,
51
57
  WorkerLoadTimeout
52
58
  };
53
59
  //# sourceMappingURL=constants.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants.ts"],
4
- "sourcesContent": ["import type {NamespaceType} from './types.ts';\n\nexport enum ChangeTrailPhase {\n StructuralChanges = 1,\n ContentUpdates,\n Removal,\n}\n\nexport enum ComponentChangeType {\n CreateEntities = 1,\n DestroyEntities,\n SetParent,\n UpdateOrder,\n ChangeProperties,\n ChangeToken,\n SendEvents,\n}\n\nexport const GlobalNS: NamespaceType = Symbol.for('ShadowEntsGlobalNS');\n\nexport const VoidToken = '#void';\n\n/**\n * The event is dispatched by {@link ComponentContext.reCreateChanges} and forwarded to all {@link ViewComponent}.\n * The event itself has no other data.\n */\nexport const ContextLost = 'contextLost';\n\nexport const Configure = 'configure';\nexport const ChangeTrail = 'changeTrail';\nexport const Destroy = 'destroy';\n\nexport const Loaded = 'loaded';\nexport const AppliedChangeTrail = 'appliedChangeTrail';\nexport const ImportedModule = 'importedModule';\nexport const Destroyed = 'destroyed';\n\n/**\n * The `messageToView` event is fired when the kernel receives a message from an entity (to its view component counterpart)\n */\nexport const MessageToView = 'messageToView';\n\nexport const WorkerLoadTimeout = 60000;\nexport const WorkerConfigureTimeout = 60000;\nexport const WorkerChangeTrailTimeout = 5000;\nexport const WorkerDestroyTimeout = 5000;\n\nexport const ShadowObjectsExport = 'shadowObjects';"],
5
- "mappings": "AAEO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,oCAAA,uBAAoB,KAApB;AACA,EAAAA,oCAAA;AACA,EAAAA,oCAAA;AAHU,SAAAA;AAAA,GAAA;AAML,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,0CAAA,oBAAiB,KAAjB;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AAPU,SAAAA;AAAA,GAAA;AAUL,MAAM,WAA0B,uBAAO,IAAI,oBAAoB;AAE/D,MAAM,YAAY;AAMlB,MAAM,cAAc;AAEpB,MAAM,YAAY;AAClB,MAAM,cAAc;AACpB,MAAM,UAAU;AAEhB,MAAM,SAAS;AACf,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB;AACvB,MAAM,YAAY;AAKlB,MAAM,gBAAgB;AAEtB,MAAM,oBAAoB;AAC1B,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AACjC,MAAM,uBAAuB;AAE7B,MAAM,sBAAsB;",
4
+ "sourcesContent": ["import type {NamespaceType} from './types.js';\n\nexport enum ChangeTrailPhase {\n StructuralChanges = 1,\n ContentUpdates,\n Removal,\n}\n\nexport enum ComponentChangeType {\n CreateEntities = 1,\n DestroyEntities,\n SetParent,\n UpdateOrder,\n ChangeProperties,\n ChangeToken,\n SendEvents,\n}\n\nexport const GlobalNS: NamespaceType = Symbol.for('ShadowObjectsGlobalNS');\n\nexport const VoidToken = '#void';\n\n/**\n * The event is dispatched by `ComponentContext.reCreateChanges` and forwarded to all `ViewComponent`.\n * The event itself has no other data.\n */\nexport const ContextLost = 'contextLost';\n\nexport const Configure = 'configure';\nexport const ChangeTrail = 'changeTrail';\nexport const Inspect = 'inspect';\nexport const Destroy = 'destroy';\n\nexport const Loaded = 'loaded';\nexport const AppliedChangeTrail = 'appliedChangeTrail';\nexport const ImportedModule = 'importedModule';\nexport const Destroyed = 'destroyed';\nexport const Inspected = 'inspected';\n\n/**\n * The five replies a `RemoteWorkerEnv` waits for, each behind a deadline of its own: the `Loaded`\n * greeting of the load handshake, the `ImportedModule` answer to an `importScript()`, the\n * `AppliedChangeTrail` confirmation of a change trail sent with `waitForConfirmation`, the\n * `Inspected` answer to an `inspect()`, and the `Destroyed` receipt of a teardown. A `switch` over\n * the five is exhaustive.\n */\nexport type WorkerReplyType =\n | typeof Loaded\n | typeof AppliedChangeTrail\n | typeof ImportedModule\n | typeof Inspected\n | typeof Destroyed;\n\n/**\n * The `messageToView` event is fired when the kernel receives a message from an entity (to its view component counterpart)\n */\nexport const MessageToView = 'messageToView';\n\nexport const WorkerLoadTimeout = 60000;\nexport const WorkerConfigureTimeout = 60000;\nexport const WorkerChangeTrailTimeout = 5000;\nexport const WorkerInspectTimeout = 5000;\nexport const WorkerDestroyTimeout = 5000;\n\nexport const ShadowObjectsExport = 'shadowObjects';\n"],
5
+ "mappings": "AAEO,IAAK,mBAAL,kBAAKA,sBAAL;AACL,EAAAA,oCAAA,uBAAoB,KAApB;AACA,EAAAA,oCAAA;AACA,EAAAA,oCAAA;AAHU,SAAAA;AAAA,GAAA;AAML,IAAK,sBAAL,kBAAKC,yBAAL;AACL,EAAAA,0CAAA,oBAAiB,KAAjB;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AACA,EAAAA,0CAAA;AAPU,SAAAA;AAAA,GAAA;AAUL,MAAM,WAA0B,uBAAO,IAAI,uBAAuB;AAElE,MAAM,YAAY;AAMlB,MAAM,cAAc;AAEpB,MAAM,YAAY;AAClB,MAAM,cAAc;AACpB,MAAM,UAAU;AAChB,MAAM,UAAU;AAEhB,MAAM,SAAS;AACf,MAAM,qBAAqB;AAC3B,MAAM,iBAAiB;AACvB,MAAM,YAAY;AAClB,MAAM,YAAY;AAmBlB,MAAM,gBAAgB;AAEtB,MAAM,oBAAoB;AAC1B,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AACjC,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAE7B,MAAM,sBAAsB;",
6
6
  "names": ["ChangeTrailPhase", "ComponentChangeType"]
7
7
  }
@@ -1,3 +1,3 @@
1
- declare const _default: () => any;
2
1
  export default _default;
2
+ declare function _default(): any;
3
3
  //# sourceMappingURL=create-worker.bundle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-worker.bundle.d.ts","sourceRoot":"","sources":["../../src/create-worker.bundle.ts"],"names":[],"mappings":";AAQA,wBAAkC"}
1
+ {"version":3,"file":"create-worker.bundle.d.ts","sourceRoot":"","sources":["../../src/create-worker.bundle.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/create-worker.bundle.ts"],
4
- "sourcesContent": ["// @ts-ignore\nimport Worker from './bundle.worker.js';\n\n// This module is converted to __inline__ worker code using the esbuild-plugin-inline-worker plugin.\n// It is done in the `bundle.mjs` build script.\n//\n// `worker/WorkerRuntime.ts` => `shadow-objects.worker.js` => `bundle.worker.js`\n\nexport default () => new Worker();"],
4
+ "sourcesContent": ["// @ts-ignore\nimport Worker from './bundle.worker.js';\n\n// This module is converted to __inline__ worker code using the esbuild-plugin-inline-worker plugin.\n// It is done in the `bundle.mjs` build script.\n//\n// `worker/WorkerRuntime.ts` => `shadow-objects.worker.js` => `bundle.worker.js`\n\nexport default () => new Worker();\n"],
5
5
  "mappings": "AACA,OAAO,YAAY;AAOnB,IAAO,+BAAQ,MAAM,IAAI,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,3 @@
1
- declare const _default: () => Worker;
2
1
  export default _default;
2
+ declare function _default(): Worker;
3
3
  //# sourceMappingURL=create-worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-worker.d.ts","sourceRoot":"","sources":["../../src/create-worker.ts"],"names":[],"mappings":";AAAA,wBAA0G"}
1
+ {"version":3,"file":"create-worker.d.ts","sourceRoot":"","sources":["../../src/create-worker.ts"],"names":[],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/create-worker.ts"],
4
- "sourcesContent": ["export default () => new Worker(new URL('./shadow-objects.worker.js', import.meta.url), {type: 'module'});"],
4
+ "sourcesContent": ["export default () => new Worker(new URL('./shadow-objects.worker.js', import.meta.url), {type: 'module'});\n"],
5
5
  "mappings": "AAAA,IAAO,wBAAQ,MAAM,IAAI,OAAO,IAAI,IAAI,8BAA8B,YAAY,GAAG,GAAG,EAAC,MAAM,SAAQ,CAAC;",
6
6
  "names": []
7
7
  }
@@ -1,13 +1,81 @@
1
1
  import { Signal } from '@spearwolf/signalize';
2
- import type { NamespaceType } from '../types.ts';
3
- export declare class ShaeElement extends HTMLElement {
2
+ import type { NamespaceType } from '../types.js';
3
+ import { ShaeLifecycleElement } from './ShaeLifecycleElement.js';
4
+ /**
5
+ * The base of the custom elements that pick an environment through their `ns` attribute.
6
+ *
7
+ * What it adds to {@link ShaeLifecycleElement} is the namespace: the `ns` attribute, the signal
8
+ * behind it, the reflection back onto the attribute, and the two ways to hand an environment on to
9
+ * the next sync. When such an element starts listening and when it lets go is the base's answer,
10
+ * and it is the same answer `<shae-prop>` gets, which shares that base without this layer.
11
+ */
12
+ export declare class ShaeElement extends ShaeLifecycleElement {
13
+ #private;
4
14
  static observedAttributes: string[];
5
15
  readonly isShaeElement = true;
6
16
  readonly ns$: Signal<NamespaceType>;
7
17
  get ns(): NamespaceType;
8
18
  set ns(ns: NamespaceType);
9
19
  constructor();
20
+ /**
21
+ * Take the namespace subscription up, and catch up on what changed while nothing was listening.
22
+ * The namespace half of {@link ShaeLifecycleElement.restore}.
23
+ *
24
+ * The catch-up is the half that is easy to leave out and expensive to miss. A released element
25
+ * still takes writes — the signals are alive — but nothing carries them onto the attributes, so
26
+ * the two drift apart. Writing the signal's value back here settles that before anything reads an
27
+ * attribute again: without it, the attribute read on the way in would push the *old* value back
28
+ * into the signal and the write would be lost without a word. At the first connect the same
29
+ * write is what carries the normalisation of the constructor's attribute read onto the attribute.
30
+ */
31
+ protected restore(): void;
32
+ /**
33
+ * Writes an attribute back from a signal, or holds the write until the element first connects.
34
+ *
35
+ * A write is parked whenever it happens before the element has connected once — `restore()`'s
36
+ * own writes on the very first connect are one source, carrying every reflecting signal out to
37
+ * its attribute, including whatever the constructor's attribute read normalised; any other
38
+ * write that lands ahead of that first connect is parked the same way. `restore()`'s call sits
39
+ * in front of the gate on purpose: a `setAttribute` from inside it would re-enter
40
+ * `attributeChangedCallback` while the subscriptions are still being set up, and running the
41
+ * writes a few lines further on, once the element is whole, is cheaper than making every
42
+ * subscription survive being read halfway through. A later write for the same attribute
43
+ * replaces the parked one — only the value the signal ends up with is worth writing.
44
+ *
45
+ * What is written back on connect is what the signals already carry, so the
46
+ * `attributeChangedCallback` it triggers sets each signal to the value it is already on. For a
47
+ * signal holding a scalar that is no change and reaches no handler at all; for one holding a
48
+ * fresh object on every read — `forward-custom-events` builds a new `Set` per read — the write
49
+ * counts as a change by identity and the reflecting handler runs once more, where the guard on
50
+ * the attribute value it already wrote stops the second write. Either way the attribute ends up
51
+ * on the value the signal carries.
52
+ */
53
+ protected reflectAttribute(name: string, write: () => void): void;
54
+ connectedCallback(): void;
55
+ /**
56
+ * Release the namespace reflection. The namespace half of {@link ShaeLifecycleElement.teardown}.
57
+ *
58
+ * `#pendingReflections` is left alone on purpose: it holds every write parked before the
59
+ * element's first connect, and that connect is what drains it — a `destroy()` reached first
60
+ * leaves the map standing for whichever connect comes next.
61
+ */
62
+ protected teardown(): void;
10
63
  attributeChangedCallback(name: string): void;
64
+ /**
65
+ * Hand the environment of this element's namespace on to the next `sync()` — the unconfirmed
66
+ * path.
67
+ *
68
+ * Over a worker it learns nothing of a confirmation the Shadow Environment refused, and no
69
+ * `syncfailed` event follows. Whoever needs to know switches `auto-sync` off and runs
70
+ * `syncWait()` from their own loop.
71
+ */
11
72
  syncShadowObjects(): void;
73
+ /**
74
+ * Sync the environment of `ns` instead of the one this element sits in right now.
75
+ *
76
+ * For the moment an element changes namespaces: the environment it leaves has a change trail
77
+ * waiting for it, and `this.ns` no longer points at it.
78
+ */
79
+ protected syncShadowObjectsOf(ns: NamespaceType): void;
12
80
  }
13
81
  //# sourceMappingURL=ShaeElement.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ShaeElement.d.ts","sourceRoot":"","sources":["../../../src/elements/ShaeElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AA2B/C,qBAAa,WAAY,SAAQ,WAAW;IAC1C,MAAM,CAAC,kBAAkB,WAAa;IAEtC,QAAQ,CAAC,aAAa,QAAQ;IAE9B,QAAQ,CAAC,GAAG,wBAAyC;IAErD,IAAI,EAAE,IAAI,aAAa,CAEtB;IAED,IAAI,EAAE,CAAC,EAAE,EAAE,aAAa,EAMvB;;IAkBD,wBAAwB,CAAC,IAAI,EAAE,MAAM;IAMrC,iBAAiB;CAGlB"}
1
+ {"version":3,"file":"ShaeElement.d.ts","sourceRoot":"","sources":["../../../src/elements/ShaeElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAQ/C,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AA0B/D;;;;;;;GAOG;AACH,qBAAa,WAAY,SAAQ,oBAAoB;;IACnD,MAAM,CAAC,kBAAkB,WAAa;IAEtC,QAAQ,CAAC,aAAa,QAAQ;IAE9B,QAAQ,CAAC,GAAG,wBAAyC;IAErD,IAAI,EAAE,IAAI,aAAa,CAEtB;IAED,IAAI,EAAE,CAAC,EAAE,EAAE,aAAa,EAMvB;IAWD,cAQC;IAyBD;;;;;;;;;;OAUG;IACH,UAAmB,OAAO,IAAI,IAAI,CAKjC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAOhE;IAEQ,iBAAiB,SAwBzB;IAED;;;;;;OAMG;IACH,UAAmB,QAAQ,IAAI,IAAI,CAKlC;IAED,wBAAwB,CAAC,IAAI,EAAE,MAAM,QAIpC;IAED;;;;;;;OAOG;IACH,iBAAiB,SAEhB;IAED;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,CAAC,EAAE,EAAE,aAAa,QAE9C;CACF"}