tungsten 0.6.2 → 0.7.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 (486) hide show
  1. package/dist/.build-complete +1 -1
  2. package/dist/Brands.d.ts +16 -0
  3. package/dist/Brands.d.ts.map +1 -0
  4. package/dist/Brands.js +22 -0
  5. package/dist/Components.d.ts +4 -1
  6. package/dist/Components.d.ts.map +1 -1
  7. package/dist/Components.js +24 -6
  8. package/dist/ContentNode.d.ts +3 -2
  9. package/dist/ContentNode.d.ts.map +1 -1
  10. package/dist/ContentNode.js +11 -0
  11. package/dist/Framework.d.ts.map +1 -1
  12. package/dist/Framework.js +23 -4
  13. package/dist/FrameworkConfig.d.ts +7 -1
  14. package/dist/FrameworkConfig.d.ts.map +1 -1
  15. package/dist/FunctionComponent.d.ts +1 -0
  16. package/dist/FunctionComponent.d.ts.map +1 -1
  17. package/dist/FunctionComponentStandIn.d.ts.map +1 -1
  18. package/dist/Instance/Instance.d.ts +29 -12
  19. package/dist/Instance/Instance.d.ts.map +1 -1
  20. package/dist/Instance/Instance.js +59 -21
  21. package/dist/Instance/InstanceConfig.d.ts +2 -1
  22. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  23. package/dist/RenderedContentNode.d.ts.map +1 -1
  24. package/dist/RenderingNode.d.ts.map +1 -1
  25. package/dist/Servers/DevServer.d.ts +4 -2
  26. package/dist/Servers/DevServer.d.ts.map +1 -1
  27. package/dist/Servers/DevServer.js +62 -20
  28. package/dist/Servers/ProdServer.d.ts +4 -2
  29. package/dist/Servers/ProdServer.d.ts.map +1 -1
  30. package/dist/Servers/ProdServer.js +77 -18
  31. package/dist/Servers/StaticSiteServer.d.ts +1 -1
  32. package/dist/Servers/StaticSiteServer.d.ts.map +1 -1
  33. package/dist/Servers/TungstenServer.d.ts +2 -1
  34. package/dist/Servers/TungstenServer.d.ts.map +1 -1
  35. package/dist/Servers/TungstenServer.js +7 -0
  36. package/dist/Servers/cacheVersioned.d.ts +3 -0
  37. package/dist/Servers/cacheVersioned.d.ts.map +1 -0
  38. package/dist/Servers/cacheVersioned.js +23 -0
  39. package/dist/Servers/devErrorPageAutoRetry.d.ts.map +1 -1
  40. package/dist/Servers/devErrorPageAutoRetry.js +1 -0
  41. package/dist/Servers/initStores.d.ts +4 -4
  42. package/dist/Servers/initStores.d.ts.map +1 -1
  43. package/dist/Servers/initStores.js +2 -2
  44. package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
  45. package/dist/Servers/loadEnvsDev.js +7 -6
  46. package/dist/Servers/resetRegistrations.d.ts +2 -0
  47. package/dist/Servers/resetRegistrations.d.ts.map +1 -0
  48. package/dist/Servers/resetRegistrations.js +13 -0
  49. package/dist/Servers/routing.d.ts +3 -2
  50. package/dist/Servers/routing.d.ts.map +1 -1
  51. package/dist/Servers/routing.js +3 -2
  52. package/dist/Store/InternalStoreSchema.d.ts +1 -1
  53. package/dist/Store/Store.js +2 -1
  54. package/dist/Store/StoreSchemaClass.d.ts +6 -3
  55. package/dist/Store/StoreSchemaClass.d.ts.map +1 -1
  56. package/dist/Store/StoreSchemaClass.js +8 -1
  57. package/dist/Store/TypeSafeStore.js +2 -1
  58. package/dist/Store/createStores.d.ts +3 -3
  59. package/dist/Store/createStores.d.ts.map +1 -1
  60. package/dist/Store/createStores.js +7 -2
  61. package/dist/Store/getInternalStore.d.ts.map +1 -1
  62. package/dist/Store/registerStore.d.ts.map +1 -1
  63. package/dist/Store/registerStore.js +2 -2
  64. package/dist/Store/storeCreators.d.ts +2 -2
  65. package/dist/Store/storeCreators.d.ts.map +1 -1
  66. package/dist/TungstenApp.d.ts +3 -3
  67. package/dist/TungstenApp.d.ts.map +1 -1
  68. package/dist/_client/cjsHelpers.d.ts.map +1 -1
  69. package/dist/_client/cjsHelpers.js +5 -3
  70. package/dist/_client/client.d.ts +2 -0
  71. package/dist/_client/client.d.ts.map +1 -1
  72. package/dist/_client/client.js +10 -3
  73. package/dist/api/getApiRoutes.d.ts.map +1 -1
  74. package/dist/api/getExport.d.ts +1 -1
  75. package/dist/api/getExport.d.ts.map +1 -1
  76. package/dist/api/getExport.js +2 -1
  77. package/dist/api/getExportDev.d.ts +1 -1
  78. package/dist/api/getExportDev.d.ts.map +1 -1
  79. package/dist/appBuilder.d.ts +69 -0
  80. package/dist/appBuilder.d.ts.map +1 -0
  81. package/dist/appBuilder.js +98 -0
  82. package/dist/appBuilder.types.test.d.ts +110 -0
  83. package/dist/appBuilder.types.test.d.ts.map +1 -0
  84. package/dist/appBuilder.types.test.js +240 -0
  85. package/dist/babelPlugins/BabelTransformBindDirect.js +7 -7
  86. package/dist/babelPlugins/BabelTransformBindVar.js +7 -7
  87. package/dist/babelPlugins/BabelTransformComponentState.d.ts.map +1 -1
  88. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
  89. package/dist/babelPlugins/BabelTransformComponentStyles.js +5 -5
  90. package/dist/babelPlugins/BabelTransformCssImports.d.ts.map +1 -1
  91. package/dist/babelPlugins/BabelTransformCssImports.js +2 -2
  92. package/dist/babelPlugins/BabelTransformDeproxyState.d.ts.map +1 -1
  93. package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
  94. package/dist/babelPlugins/BabelTransformPackageImports.js +11 -6
  95. package/dist/babelPlugins/BabelTransformRemoveDevBlocks.d.ts.map +1 -1
  96. package/dist/babelPlugins/BabelTransformRemoveServerBlocks.d.ts.map +1 -1
  97. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  98. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.d.ts.map +1 -1
  99. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsCjs.js +1 -1
  100. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.d.ts.map +1 -1
  101. package/dist/babelPlugins/transformPackageImports/BabelTransformDependencyImportsEsm.js +2 -2
  102. package/dist/bin/commands/compile.d.ts.map +1 -1
  103. package/dist/bin/commands/compile.js +2 -1
  104. package/dist/build/CompilationInfo.d.ts +3 -0
  105. package/dist/build/CompilationInfo.d.ts.map +1 -1
  106. package/dist/build/assetVersions.d.ts +9 -0
  107. package/dist/build/assetVersions.d.ts.map +1 -0
  108. package/dist/build/assetVersions.js +39 -0
  109. package/dist/build/babel.user.common.config.d.ts.map +1 -1
  110. package/dist/build/bundle.d.ts.map +1 -1
  111. package/dist/build/bundle.js +2 -1
  112. package/dist/build/bundleBabelOptions.d.ts.map +1 -1
  113. package/dist/build/clientRoutesFile.d.ts +2 -0
  114. package/dist/build/clientRoutesFile.d.ts.map +1 -0
  115. package/dist/build/clientRoutesFile.js +13 -0
  116. package/dist/build/compileJavascript.d.ts.map +1 -1
  117. package/dist/build/compileJavascript.js +4 -3
  118. package/dist/build/compileStyles.d.ts +2 -1
  119. package/dist/build/compileStyles.d.ts.map +1 -1
  120. package/dist/build/compileStyles.js +38 -83
  121. package/dist/build/compileUserApp.d.ts.map +1 -1
  122. package/dist/build/componentStylesCache.d.ts.map +1 -1
  123. package/dist/build/componentStylesCache.js +3 -2
  124. package/dist/build/copyAssets.d.ts.map +1 -1
  125. package/dist/build/copyAssets.js +2 -1
  126. package/dist/build/copyPackageModulesToPackagesFolder.d.ts.map +1 -1
  127. package/dist/build/copyPackageModulesToPackagesFolder.js +1 -1
  128. package/dist/build/copyPublicFiles.d.ts.map +1 -1
  129. package/dist/build/copyPublicFiles.js +2 -1
  130. package/dist/build/createClientFiles.d.ts.map +1 -1
  131. package/dist/build/createClientFiles.js +9 -5
  132. package/dist/build/createInstanceConfigFile.d.ts +1 -1
  133. package/dist/build/createInstanceConfigFile.d.ts.map +1 -1
  134. package/dist/build/createInstanceConfigFile.js +9 -3
  135. package/dist/build/frameworkDestLocation.d.ts.map +1 -1
  136. package/dist/build/frameworkDestLocation.js +5 -6
  137. package/dist/build/frameworkStylesheets.d.ts.map +1 -1
  138. package/dist/build/frameworkStylesheets.js +1 -1
  139. package/dist/build/makeBabelRawConfig.d.ts.map +1 -1
  140. package/dist/build/makeBabelUserDevConfig.d.ts +2 -2
  141. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  142. package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
  143. package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
  144. package/dist/build/rollup.user.prod.config.js +5 -3
  145. package/dist/build/rollupProdConstants.d.ts +5 -0
  146. package/dist/build/rollupProdConstants.d.ts.map +1 -0
  147. package/dist/build/rollupProdConstants.js +21 -0
  148. package/dist/cacheControl.d.ts +13 -0
  149. package/dist/cacheControl.d.ts.map +1 -0
  150. package/dist/cacheControl.js +22 -0
  151. package/dist/compat/types.d.ts +1 -1
  152. package/dist/compat/types.d.ts.map +1 -1
  153. package/dist/componentHelpers.d.ts +18 -0
  154. package/dist/componentHelpers.d.ts.map +1 -0
  155. package/dist/componentHelpers.js +28 -0
  156. package/dist/componentProxyHandlers.d.ts.map +1 -1
  157. package/dist/components/Fragment.d.ts +8 -0
  158. package/dist/components/Fragment.d.ts.map +1 -0
  159. package/dist/components/Fragment.js +10 -0
  160. package/dist/components/Link.d.ts +4 -3
  161. package/dist/components/Link.d.ts.map +1 -1
  162. package/dist/components/Link.js +1 -0
  163. package/dist/components/NoEscape.d.ts +8 -0
  164. package/dist/components/NoEscape.d.ts.map +1 -0
  165. package/dist/components/NoEscape.js +6 -0
  166. package/dist/components/RouteRedirectComponent.d.ts.map +1 -1
  167. package/dist/components/RouteRedirectComponent.js +1 -1
  168. package/dist/components/WebRedirectComponent.d.ts.map +1 -1
  169. package/dist/components/WebRedirectComponent.js +1 -1
  170. package/dist/components/bindable/BindVariable.d.ts +1 -0
  171. package/dist/components/bindable/BindVariable.d.ts.map +1 -1
  172. package/dist/components/bindable/BindableCheckbox.d.ts +7 -7
  173. package/dist/components/bindable/BindableCheckbox.d.ts.map +1 -1
  174. package/dist/components/bindable/BindableInput.d.ts +7 -7
  175. package/dist/components/bindable/BindableInput.d.ts.map +1 -1
  176. package/dist/components/bindable/BindableInputNonString.d.ts +2 -2
  177. package/dist/components/bindable/BindableInputNonString.d.ts.map +1 -1
  178. package/dist/components/bindable/BindableInputString.d.ts +2 -2
  179. package/dist/components/bindable/BindableInputString.d.ts.map +1 -1
  180. package/dist/components/bindable/BindableInputTyped.d.ts +3 -3
  181. package/dist/components/bindable/BindableInputTyped.d.ts.map +1 -1
  182. package/dist/components/bindable/BindableInputTypedLegacy.d.ts +3 -3
  183. package/dist/components/bindable/BindableInputTypedLegacy.d.ts.map +1 -1
  184. package/dist/components/bindable/BindableRadio.js +2 -2
  185. package/dist/components/bindable/BindableSelect.d.ts +13 -10
  186. package/dist/components/bindable/BindableSelect.d.ts.map +1 -1
  187. package/dist/components/bindable/BindableSelectNaive.js +3 -3
  188. package/dist/components/bindable/BindableTextarea.d.ts +7 -7
  189. package/dist/components/bindable/BindableTextarea.d.ts.map +1 -1
  190. package/dist/components/bindable/bindableCandidates.comparison.d.ts +136 -0
  191. package/dist/components/bindable/bindableCandidates.comparison.d.ts.map +1 -0
  192. package/dist/components/bindable/bindableCandidates.comparison.js +268 -0
  193. package/dist/components/bindable/bindableProps.types.test.d.ts +50 -0
  194. package/dist/components/bindable/bindableProps.types.test.d.ts.map +1 -0
  195. package/dist/components/bindable/bindableProps.types.test.js +252 -0
  196. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -1
  197. package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -1
  198. package/dist/components/makeTypedLink.d.ts +9 -0
  199. package/dist/components/makeTypedLink.d.ts.map +1 -0
  200. package/dist/components/makeTypedLink.js +15 -0
  201. package/dist/context/registerContext.d.ts +22 -0
  202. package/dist/context/registerContext.d.ts.map +1 -0
  203. package/dist/context/registerContext.js +18 -0
  204. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  205. package/dist/env/getEnvSchemas.js +2 -1
  206. package/dist/fileVersions.d.ts +9 -0
  207. package/dist/fileVersions.d.ts.map +1 -0
  208. package/dist/fileVersions.js +28 -0
  209. package/dist/findUserConfig.d.ts +1 -1
  210. package/dist/findUserConfig.d.ts.map +1 -1
  211. package/dist/findUserConfig.js +2 -1
  212. package/dist/frameworkConfigSchema.d.ts +14 -2
  213. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  214. package/dist/frameworkConfigSchema.js +11 -2
  215. package/dist/getComponent.d.ts.map +1 -1
  216. package/dist/getComponent.js +4 -3
  217. package/dist/getRoutes.d.ts.map +1 -1
  218. package/dist/getRoutes.js +9 -8
  219. package/dist/hmr/applyHmrModule.d.ts.map +1 -1
  220. package/dist/hmr/componentIdentity.js +1 -1
  221. package/dist/hooks/getCurrentComponent.d.ts +1 -1
  222. package/dist/hooks/getCurrentComponent.d.ts.map +1 -1
  223. package/dist/hydrate/hydrate.d.ts +5 -1
  224. package/dist/hydrate/hydrate.d.ts.map +1 -1
  225. package/dist/hydrate/hydrate.js +59 -46
  226. package/dist/hydrate/hydrateGlobalData.d.ts +4 -3
  227. package/dist/hydrate/hydrateGlobalData.d.ts.map +1 -1
  228. package/dist/hydrate/reconcileHydratedAttributes.d.ts +2 -1
  229. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  230. package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
  231. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -1
  232. package/dist/hydrate/renderHydrationMismatchBanner.js +2 -1
  233. package/dist/importDevModuleWithRetry.d.ts +2 -1
  234. package/dist/importDevModuleWithRetry.d.ts.map +1 -1
  235. package/dist/importDevModuleWithRetry.js +2 -1
  236. package/dist/importModule.d.ts +3 -0
  237. package/dist/importModule.d.ts.map +1 -0
  238. package/dist/importModule.js +4 -0
  239. package/dist/index.js +2 -1
  240. package/dist/indexInner.d.ts +30 -7
  241. package/dist/indexInner.d.ts.map +1 -1
  242. package/dist/indexInner.js +37 -2
  243. package/dist/json.d.ts +12 -0
  244. package/dist/json.d.ts.map +1 -0
  245. package/dist/json.js +8 -0
  246. package/dist/jsxHelpers.d.ts +3 -0
  247. package/dist/jsxHelpers.d.ts.map +1 -0
  248. package/dist/jsxHelpers.js +6 -0
  249. package/dist/jsxRuntime.d.ts +1 -0
  250. package/dist/jsxRuntime.d.ts.map +1 -1
  251. package/dist/jsxRuntime.js +3 -1
  252. package/dist/jsxRuntimeSignals.d.ts.map +1 -1
  253. package/dist/jsxRuntimeSignals.js +1 -0
  254. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  255. package/dist/makeInstanceConfigFromFrameworkConfig.js +1 -0
  256. package/dist/mergeConfigs.d.ts.map +1 -1
  257. package/dist/mergeConfigs.js +2 -6
  258. package/dist/nbsp.d.ts +1 -2
  259. package/dist/nbsp.d.ts.map +1 -1
  260. package/dist/nbsp.js +3 -7
  261. package/dist/objectMap.d.ts +1 -1
  262. package/dist/objectMap.d.ts.map +1 -1
  263. package/dist/pipeline/PipelineRequestHandler.d.ts +25 -0
  264. package/dist/pipeline/PipelineRequestHandler.d.ts.map +1 -0
  265. package/dist/pipeline/PipelineRequestHandler.js +96 -0
  266. package/dist/pipeline/contextStore.d.ts +12 -0
  267. package/dist/pipeline/contextStore.d.ts.map +1 -0
  268. package/dist/pipeline/contextStore.js +13 -0
  269. package/dist/pipeline/hydratePipeline.d.ts +4 -0
  270. package/dist/pipeline/hydratePipeline.d.ts.map +1 -0
  271. package/dist/pipeline/hydratePipeline.js +64 -0
  272. package/dist/pipeline/importRoutesModule.d.ts +6 -0
  273. package/dist/pipeline/importRoutesModule.d.ts.map +1 -0
  274. package/dist/pipeline/importRoutesModule.js +33 -0
  275. package/dist/pipeline/networkedTransport.d.ts +11 -0
  276. package/dist/pipeline/networkedTransport.d.ts.map +1 -0
  277. package/dist/pipeline/networkedTransport.js +54 -0
  278. package/dist/pipeline/pipeline.d.ts +105 -0
  279. package/dist/pipeline/pipeline.d.ts.map +1 -0
  280. package/dist/pipeline/pipeline.js +108 -0
  281. package/dist/pipeline/pipeline.types.test.d.ts +650 -0
  282. package/dist/pipeline/pipeline.types.test.d.ts.map +1 -0
  283. package/dist/pipeline/pipeline.types.test.js +342 -0
  284. package/dist/pipeline/pipelineDefinition.d.ts +67 -0
  285. package/dist/pipeline/pipelineDefinition.d.ts.map +1 -0
  286. package/dist/pipeline/pipelineDefinition.js +11 -0
  287. package/dist/pipeline/pipelineSplit.types.test.d.ts +1971 -0
  288. package/dist/pipeline/pipelineSplit.types.test.d.ts.map +1 -0
  289. package/dist/pipeline/pipelineSplit.types.test.js +440 -0
  290. package/dist/pipeline/runPipeline.d.ts +31 -0
  291. package/dist/pipeline/runPipeline.d.ts.map +1 -0
  292. package/dist/pipeline/runPipeline.js +71 -0
  293. package/dist/pipeline/runSplitPipeline.d.ts +10 -0
  294. package/dist/pipeline/runSplitPipeline.d.ts.map +1 -0
  295. package/dist/pipeline/runSplitPipeline.js +48 -0
  296. package/dist/pipeline/splitPipeline.d.ts +62 -0
  297. package/dist/pipeline/splitPipeline.d.ts.map +1 -0
  298. package/dist/pipeline/splitPipeline.js +76 -0
  299. package/dist/pop.js +1 -1
  300. package/dist/rawHtml/filterContentNode.d.ts.map +1 -1
  301. package/dist/render/HeadData.d.ts +3 -1
  302. package/dist/render/HeadData.d.ts.map +1 -1
  303. package/dist/render/classComponentNodeToRenderingTree.d.ts.map +1 -1
  304. package/dist/render/componentNodeToRenderingTree.d.ts.map +1 -1
  305. package/dist/render/contentToHtml.d.ts +2 -2
  306. package/dist/render/contentToHtml.d.ts.map +1 -1
  307. package/dist/render/contentToHtml.js +2 -1
  308. package/dist/render/contentToHtmlDev.d.ts +1 -1
  309. package/dist/render/contentToHtmlDev.d.ts.map +1 -1
  310. package/dist/render/contentTreeToRenderingTree.d.ts.map +1 -1
  311. package/dist/render/contentTreeToRenderingTree.js +2 -1
  312. package/dist/render/functionComponentNodeToRenderingTree.d.ts.map +1 -1
  313. package/dist/render/functionComponentNodeToRenderingTree.js +2 -2
  314. package/dist/render/instantiateComponent.d.ts.map +1 -1
  315. package/dist/render/processHead.d.ts.map +1 -1
  316. package/dist/render/processHead.js +12 -18
  317. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  318. package/dist/render/renderingTreeToHtml.js +6 -3
  319. package/dist/render/rootToHtml.d.ts +2 -2
  320. package/dist/render/rootToHtml.d.ts.map +1 -1
  321. package/dist/requests/fetch/delete.d.ts.map +1 -1
  322. package/dist/requests/fetch/delete.js +5 -2
  323. package/dist/requests/fetch/get.js +1 -1
  324. package/dist/requests/fetch/patch.d.ts.map +1 -1
  325. package/dist/requests/fetch/patch.js +5 -2
  326. package/dist/requests/fetch/post.d.ts.map +1 -1
  327. package/dist/requests/fetch/post.js +5 -2
  328. package/dist/requests/fetch/put.d.ts.map +1 -1
  329. package/dist/requests/fetch/put.js +5 -2
  330. package/dist/routesLocationParts.d.ts +6 -0
  331. package/dist/routesLocationParts.d.ts.map +1 -0
  332. package/dist/routesLocationParts.js +10 -0
  333. package/dist/routing/AppRoutes.d.ts +5 -3
  334. package/dist/routing/AppRoutes.d.ts.map +1 -1
  335. package/dist/routing/MatchedRouteInfo.d.ts +11 -0
  336. package/dist/routing/MatchedRouteInfo.d.ts.map +1 -0
  337. package/dist/routing/RouteContentFunction.d.ts +1 -2
  338. package/dist/routing/RouteContentFunction.d.ts.map +1 -1
  339. package/dist/routing/RouteDataFunction.type.d.ts +4 -2
  340. package/dist/routing/RouteDataFunction.type.d.ts.map +1 -1
  341. package/dist/routing/RoutePaths.d.ts +12 -0
  342. package/dist/routing/RoutePaths.d.ts.map +1 -0
  343. package/dist/routing/RoutePaths.js +1 -0
  344. package/dist/routing/RouteTypes.d.ts +6 -4
  345. package/dist/routing/RouteTypes.d.ts.map +1 -1
  346. package/dist/routing/Routes.d.ts +17 -11
  347. package/dist/routing/Routes.d.ts.map +1 -1
  348. package/dist/routing/RoutesFunction.d.ts +11 -2
  349. package/dist/routing/RoutesFunction.d.ts.map +1 -1
  350. package/dist/routing/Serializable.d.ts +5 -0
  351. package/dist/routing/Serializable.d.ts.map +1 -0
  352. package/dist/routing/Serializable.js +1 -0
  353. package/dist/routing/builder.d.ts +99 -0
  354. package/dist/routing/builder.d.ts.map +1 -0
  355. package/dist/routing/builder.js +213 -0
  356. package/dist/routing/builder.trial.d.ts +2 -0
  357. package/dist/routing/builder.trial.d.ts.map +1 -0
  358. package/dist/routing/builder.trial.js +85 -0
  359. package/dist/routing/defineRoutes.d.ts +8 -0
  360. package/dist/routing/defineRoutes.d.ts.map +1 -0
  361. package/dist/routing/defineRoutes.js +3 -0
  362. package/dist/routing/pyramidRouting.d.ts +2 -0
  363. package/dist/routing/pyramidRouting.d.ts.map +1 -0
  364. package/dist/routing/pyramidRouting.js +13 -0
  365. package/dist/routing/registerGlobalData.d.ts +11 -3
  366. package/dist/routing/registerGlobalData.d.ts.map +1 -1
  367. package/dist/routing/registerGlobalData.js +6 -0
  368. package/dist/routing/registerParts.types.test.d.ts +2 -0
  369. package/dist/routing/registerParts.types.test.d.ts.map +1 -0
  370. package/dist/routing/registerParts.types.test.js +139 -0
  371. package/dist/routing/registerRoutes.d.ts +10 -0
  372. package/dist/routing/registerRoutes.d.ts.map +1 -0
  373. package/dist/routing/registerRoutes.js +9 -0
  374. package/dist/routing/registerRouting.d.ts +36 -0
  375. package/dist/routing/registerRouting.d.ts.map +1 -0
  376. package/dist/routing/registerRouting.js +34 -0
  377. package/dist/routing/registerRouting.types.test.d.ts +80 -0
  378. package/dist/routing/registerRouting.types.test.d.ts.map +1 -0
  379. package/dist/routing/registerRouting.types.test.js +120 -0
  380. package/dist/routing/registrationTypes.d.ts +11 -0
  381. package/dist/routing/registrationTypes.d.ts.map +1 -0
  382. package/dist/routing/registrationTypes.js +1 -0
  383. package/dist/routing/resolveAppRoutes.d.ts +5 -0
  384. package/dist/routing/resolveAppRoutes.d.ts.map +1 -0
  385. package/dist/routing/resolveAppRoutes.js +25 -0
  386. package/dist/routing/routeUrl.d.ts +4 -0
  387. package/dist/routing/routeUrl.d.ts.map +1 -1
  388. package/dist/routing/routeUrl.js +4 -0
  389. package/dist/routing/routesArray.d.ts +23 -0
  390. package/dist/routing/routesArray.d.ts.map +1 -0
  391. package/dist/routing/routesArray.js +20 -0
  392. package/dist/routing/routesArray.types.test.d.ts +2 -0
  393. package/dist/routing/routesArray.types.test.d.ts.map +1 -0
  394. package/dist/routing/routesArray.types.test.js +132 -0
  395. package/dist/routing/routingBuilder.d.ts +34 -0
  396. package/dist/routing/routingBuilder.d.ts.map +1 -0
  397. package/dist/routing/routingBuilder.js +33 -0
  398. package/dist/routing/routingBuilder.types.test.d.ts +2 -0
  399. package/dist/routing/routingBuilder.types.test.d.ts.map +1 -0
  400. package/dist/routing/routingBuilder.types.test.js +171 -0
  401. package/dist/routing/routingRegistry.d.ts +19 -0
  402. package/dist/routing/routingRegistry.d.ts.map +1 -0
  403. package/dist/routing/routingRegistry.js +29 -0
  404. package/dist/staticGen/getAppRoutes.d.ts +2 -2
  405. package/dist/staticGen/getAppRoutes.d.ts.map +1 -1
  406. package/dist/staticGen/getAppRoutes.js +9 -6
  407. package/dist/staticGen/staticGen.d.ts.map +1 -1
  408. package/dist/staticGen/staticGen.js +8 -2
  409. package/dist/style/styleContentSxy.d.ts.map +1 -1
  410. package/dist/sync/index.d.ts.map +1 -1
  411. package/dist/sync/index.js +2 -0
  412. package/dist/syncServer/index.cjs +1 -2
  413. package/dist/syncServer/preload.js +2 -0
  414. package/dist/testing/createTestApp.d.ts +25 -1
  415. package/dist/testing/createTestApp.d.ts.map +1 -1
  416. package/dist/testing/createTestApp.js +12 -3
  417. package/dist/testing/createTestPipelineApp.d.ts +25 -0
  418. package/dist/testing/createTestPipelineApp.d.ts.map +1 -0
  419. package/dist/testing/createTestPipelineApp.js +153 -0
  420. package/dist/testing/ensure.d.ts +108 -0
  421. package/dist/testing/ensure.d.ts.map +1 -0
  422. package/dist/testing/ensure.js +522 -0
  423. package/dist/testing/ensure.trial.d.ts +2 -0
  424. package/dist/testing/ensure.trial.d.ts.map +1 -0
  425. package/dist/testing/ensure.trial.js +9 -0
  426. package/dist/testing/helpers/contentHtmlElements.d.ts.map +1 -1
  427. package/dist/testing/host.d.ts +80 -9
  428. package/dist/testing/host.d.ts.map +1 -1
  429. package/dist/testing/host.js +81 -20
  430. package/dist/testing/hostPipeline.d.ts +157 -0
  431. package/dist/testing/hostPipeline.d.ts.map +1 -0
  432. package/dist/testing/hostPipeline.js +341 -0
  433. package/dist/testing/hydrateTestApp.d.ts +17 -0
  434. package/dist/testing/hydrateTestApp.d.ts.map +1 -1
  435. package/dist/testing/hydrateTestApp.js +26 -6
  436. package/dist/testing/hydrateTestPipelineApp.d.ts +30 -0
  437. package/dist/testing/hydrateTestPipelineApp.d.ts.map +1 -0
  438. package/dist/testing/hydrateTestPipelineApp.js +190 -0
  439. package/dist/testing/index.d.ts +6 -3
  440. package/dist/testing/index.d.ts.map +1 -1
  441. package/dist/testing/index.js +4 -1
  442. package/dist/testing/resolveContent.d.ts +16 -0
  443. package/dist/testing/resolveContent.d.ts.map +1 -0
  444. package/dist/testing/resolveContent.js +65 -0
  445. package/dist/testing/testingComponentPackage.d.ts +3 -1
  446. package/dist/testing/testingComponentPackage.d.ts.map +1 -1
  447. package/dist/testing/testingComponentPackage.js +16 -1
  448. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  449. package/dist/update/integrateUpdateVdom.js +35 -31
  450. package/dist/update/integrateUpdateVdomPrebuild.js +20 -20
  451. package/dist/validChildren.d.ts.map +1 -1
  452. package/dist/zones/react.d.ts.map +1 -1
  453. package/package.json +20 -18
  454. package/types/helpers.d.ts +11 -2
  455. package/types/jsx/html.d.ts +29 -25
  456. package/types/jsx/jsx.d.ts +8 -8
  457. package/types/modules.d.ts +14 -3
  458. package/types/testing.d.ts +0 -0
  459. package/vendor/babel-core.js +5 -5
  460. package/vendor/babel-parser.js +1 -1
  461. package/vendor/babel-preset-react.js +32 -34
  462. package/vendor/babel-preset-typescript.js +5 -5
  463. package/vendor/chalk-extensions.js +3 -146
  464. package/vendor/chokidar.js +311 -5
  465. package/vendor/chunk-B34JUlnS.js +169 -0
  466. package/vendor/{chunk-Bu8ZRE-c.js → chunk-B9ttgKqg.js} +28 -25
  467. package/vendor/{chunk-D2EnpcLg.js → chunk-BGvapINa.js} +3 -164
  468. package/vendor/{chunk-Cqrj-Zqr.js → chunk-BmAiqUzD.js} +22 -8
  469. package/vendor/{chunk-BiUcnLhT.js → chunk-But4T5N_.js} +8 -3
  470. package/vendor/{chunk-OUnVY4Wm.js → chunk-DuR6SGzI.js} +162 -35
  471. package/vendor/dotenv.js +2 -2
  472. package/vendor/express.js +61 -10
  473. package/vendor/manifest.json +2 -2
  474. package/vendor/postcss.js +1 -1
  475. package/vendor/precinct.js +5914 -3591
  476. package/vendor/valibot.js +418 -504
  477. package/dist/Servers/MatchedRouteInfo.d.ts +0 -11
  478. package/dist/Servers/MatchedRouteInfo.d.ts.map +0 -1
  479. package/dist/routing/__fluentRouteBuilder.d.ts +0 -80
  480. package/dist/routing/__fluentRouteBuilder.d.ts.map +0 -1
  481. package/dist/routing/__fluentRouteBuilder.js +0 -183
  482. package/dist/routing/__fluentRoutes.d.ts +0 -2
  483. package/dist/routing/__fluentRoutes.d.ts.map +0 -1
  484. package/dist/routing/__fluentRoutes.js +0 -59
  485. package/vendor/chunk-Hy-cCmu-.js +0 -23
  486. /package/dist/{Servers → routing}/MatchedRouteInfo.js +0 -0
@@ -0,0 +1,522 @@
1
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
2
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
+ import { styleText } from 'node:util';
5
+ import deepEqual from 'deep-eql';
6
+ import { ContentNodeElementIsComponent, ContentNodeElementIsHtml, ContentNodeIsArray, ContentNodeIsElement, ContentNodeIsLiteral, IsContentNode } from '../ContentNode.js';
7
+ import { $fragment, $props, $type } from '../contentNodeSymbols.js';
8
+ import { componentTypeIdentityKey } from '../hmr/componentIdentity.js';
9
+ // exported after
10
+ const _ensure = withMembers(ensure, quantifiers(fact => fact));
11
+ export { _ensure as ensure }; // naming
12
+ // read once: an ends object holds no run state, as each run starts its facts afresh
13
+ export const {
14
+ no,
15
+ none,
16
+ one,
17
+ two,
18
+ three,
19
+ a,
20
+ an,
21
+ some,
22
+ all,
23
+ count
24
+ } = _ensure;
25
+ function quantifiers(finish) {
26
+ return {
27
+ get no() {
28
+ return ends('no', counting(count => count === 0, 0), finish);
29
+ },
30
+ get none() {
31
+ return ends('none', counting(count => count === 0, 0), finish, 'no');
32
+ },
33
+ get one() {
34
+ return ends('one', counting(count => count === 1, 1), finish);
35
+ },
36
+ get two() {
37
+ return ends('two', counting(count => count === 2, 2), finish);
38
+ },
39
+ get three() {
40
+ return ends('three', counting(count => count === 3, 3), finish);
41
+ },
42
+ get a() {
43
+ return ends('a', counting(count => count === 1, 1), finish);
44
+ },
45
+ get an() {
46
+ return ends('an', counting(count => count === 1, 1), finish);
47
+ },
48
+ count: num => ends(`count(${num})`, counting(count => count === num, num), finish, String(num)),
49
+ get some() {
50
+ return ends('some', () => {
51
+ let count = 0;
52
+ return [match => {
53
+ if (match) ++count;
54
+ return count > 0;
55
+ }, () => count > 0 ? undefined : {
56
+ actual: 0,
57
+ expected: '1 or more',
58
+ saw: 'saw 0',
59
+ showDiff: false
60
+ }];
61
+ }, finish);
62
+ },
63
+ // every sighting of its kind must match, and there must be one: all of none proves nothing
64
+ get all() {
65
+ return ends('all', () => {
66
+ let count = 0;
67
+ return [match => {
68
+ if (match) ++count;
69
+ }, ofKind => ofKind > 0 && count === ofKind ? undefined : {
70
+ actual: count,
71
+ expected: ofKind,
72
+ saw: `saw ${count} of ${ofKind}`,
73
+ showDiff: ofKind > 0
74
+ }];
75
+ }, finish, 'every');
76
+ }
77
+ };
78
+ }
79
+ // the facts of a list as prose, joined: (one <li> and no <b>)
80
+ const spokenList = facts => `(${facts.map(fact => fact[5]).join(' and ')})`;
81
+ // a value as JSX writes it in a prop: title="x", size={3}
82
+ const jsxValue = value => typeof value === 'string' ? `"${value}"` : `{${display(value)}}`;
83
+ // each end says only what a sighting must be, and how it reads in a failure;
84
+ // ensure() starts the requirement
85
+ // spoken: the quantifier as prose, where it differs - none as no, count(3) as 3
86
+ function ends(quantifier, requirement, finish, spoken = quantifier) {
87
+ const fact = (kind, test, end, prose, explain) => finish([kind, test, requirement, quantifier, end, `${spoken} ${prose}`, explain]);
88
+ const many = !['one', 'a', 'an', 'every', '1'].includes(spoken);
89
+ const noun = word => !many ? word : word.endsWith('s') ? `${word}es` : `${word}s`;
90
+ // a scoped fact is the outer kind, passing where the inner facts pass on the sightings
91
+ // scopeOf gives for a sighting
92
+ const scoped = (kind, end, prose, scopeOf) => (inner, to, proseTo) => {
93
+ const facts = inner.map(each => forKind(each, kind));
94
+ return fact(kind, scopeTest(scopeOf, facts), `${end}.${to}`, `${prose} ${proseTo}`, scopeExplain(scopeOf, facts));
95
+ };
96
+ // alone: present. with: facts on the element itself, its children among them
97
+ const element = (kind, end, prose, own) => {
98
+ const within = scoped(kind, end, prose, seen => own(seen));
99
+ const below = scoped(kind, end, prose, childrenScope);
100
+ const children = withMembers(facts => below(facts, `with.children(${listed(facts)})`, `with ${spokenList(facts)} in its children`), quantifiers(inner => below([inner], `with.children.${chained(inner)}`, `with ${inner[5]} in its children`)));
101
+ return Object.assign(fact(kind, () => true, end, prose), {
102
+ // facts, or a fn given the props for what facts cannot say
103
+ with: withMembers(withMembers(facts => Array.isArray(facts) ? within(facts, `with(${listed(facts)})`, `with ${spokenList(facts)}`) : fact(kind, seen => facts(seen), `${end}.with(${fnName(facts)})`, `${prose} passing ${fnName(facts)}`), quantifiers(inner => within([inner], `with.${chained(inner)}`, `with ${inner[5]}`))), {
104
+ children
105
+ })
106
+ });
107
+ };
108
+ // the text ends differ only in the sighting they read and whether case matters
109
+ const stringEnd = (kind, name, what, ci = false) => {
110
+ const norm = text => ci ? lower(text) : text;
111
+ const read = (seen, met) => typeof seen === 'string' && met(norm(seen));
112
+ const said = (ci ? 'case-insensitive ' : '') + noun(what);
113
+ return Object.assign(text => fact(kind, seen => read(seen, found => found === norm(text)), `${name}('${text}')`, (ci ? 'case-insensitive ' : '') + `'${text}' ${noun(what)}`), {
114
+ contains: substring => fact(kind, seen => read(seen, found => found.includes(norm(substring))), `${name}.contains('${substring}')`, `${said} containing '${substring}'`),
115
+ matches: regex => fact(kind, matching(regex, ci ? 'i' : ''), `${name}.matches(${String(regex)})`, `${said} matching ${String(regex)}`)
116
+ });
117
+ };
118
+ return {
119
+ text: stringEnd('text', 'text', 'text node'),
120
+ textCi: stringEnd('text', 'textCi', 'text node', true),
121
+ interruptedText: stringEnd('interruptedText', 'interruptedText', 'element text'),
122
+ html: tag => element(`html:${tag}`, `html('${tag}')`, `<${tag}>`, props => htmlOwnSightings(tag, props)),
123
+ component: name => element(`component:${name}`, `component('${name}')`, `<${name}>`, props => componentOwnSightings(name, props)),
124
+ fragment: () => fact('fragment', () => true, 'fragment()', noun('fragment')),
125
+ className: className => fact('className', seen => className === undefined || seen === className, className === undefined ? 'className()' : `className('${className}')`, className === undefined ? noun('class') : `class="${className}"`),
126
+ id: id => fact('id', seen => id === undefined || seen === id, id === undefined ? 'id()' : `id('${id}')`, id === undefined ? noun('id') : `id="${id}"`),
127
+ // prop() alone: passed, whatever the value - undefined included, as the tree has the key.
128
+ // .is: the value raw, compared by ===, so a handler or ref is matched by reference
129
+ prop: prop => Object.assign(fact(`prop:${prop}`, () => true, `prop('${prop}')`, `${prop} ${noun('prop')}`), {
130
+ is: value => fact(`prop:${prop}`, seen => seen === value, `prop('${prop}').is(${display(value)})`, `${prop}=${jsxValue(value)}`),
131
+ contains: substring => fact(`prop:${prop}`, seen => typeof seen === 'string' && seen.includes(substring), `prop('${prop}').contains('${substring}')`, `${prop} containing '${substring}'`),
132
+ matches: regex => fact(`prop:${prop}`, matching(regex), `prop('${prop}').matches(${String(regex)})`, `${prop} matching ${String(regex)}`),
133
+ // chai's deep.equal, which is deep-eql
134
+ exact: value => fact(`prop:${prop}`, seen => deepEqual(seen, value), `prop('${prop}').exact(${display(value)})`, `${prop} deep-equal to ${display(value)}`),
135
+ subset: shape => fact(`prop:${prop}`, seen => contains(shape, seen, 'anywhere'), `prop('${prop}').subset(${display(shape)})`, `${prop} with subset ${display(shape)}`),
136
+ duck: shape => fact(`prop:${prop}`, seen => contains(shape, seen, 'inPlace'), `prop('${prop}').duck(${display(shape)})`, `${prop} shaped like ${display(shape)}`),
137
+ // opt-in: a content-like prop may not be rendered, so it is walked only on asking.
138
+ // Alone: the value is content; with: facts on its whole tree, root included
139
+ content: () => {
140
+ const end = `prop('${prop}').content()`;
141
+ const prose = `${prop} holding content`;
142
+ const within = scoped(`prop:${prop}`, end, prose, seen => IsContentNode(seen) ? contentSightings(seen) : undefined);
143
+ return Object.assign(fact(`prop:${prop}`, IsContentNode, end, prose), {
144
+ with: withMembers(facts => within(facts, `with(${listed(facts)})`, `with ${spokenList(facts)}`), quantifiers(inner => within([inner], `with.${chained(inner)}`, `with ${inner[5]}`)))
145
+ });
146
+ }
147
+ })
148
+ };
149
+ }
150
+ // fields as sxy-assert's, for a runner to read; showDiff where actual and expected are counts
151
+ export class EnsureError extends Error {
152
+ constructor(message, actual, expected, operator, showDiff) {
153
+ super(message);
154
+ _defineProperty(this, "actual", void 0);
155
+ _defineProperty(this, "expected", void 0);
156
+ _defineProperty(this, "operator", void 0);
157
+ _defineProperty(this, "showDiff", void 0);
158
+ _defineProperty(this, "name", 'EnsureError');
159
+ this.actual = actual;
160
+ this.expected = expected;
161
+ this.operator = operator;
162
+ this.showDiff = showDiff;
163
+ Error.captureStackTrace(this, ensure); // the stack starts at the test's ensure() call
164
+ }
165
+ }
166
+ function ensure(tree, facts, options = {}) {
167
+ const sightings = contentSightings(tree);
168
+ const miss = check(sightings, facts);
169
+ if (miss === undefined) return;
170
+ const [fact, failure] = miss;
171
+ const {
172
+ readable = true,
173
+ color = process.stdout.isTTY && process.stdout.hasColors()
174
+ } = options;
175
+ const style = {
176
+ readable,
177
+ paint: color ? (tint, text) => styleText(tint, text, {
178
+ validateStream: false
179
+ }) : (_, text) => text
180
+ };
181
+ const message = `expected ${readable ? fact.spoken : fact.chained}, ${failure.saw}`
182
+ // the · holds the gap until sxy-test-runner keeps blank lines
183
+ + (readable ? `\n rule: ${fact.chained}\n ·` : '') + `\n ${seenLine(fact, sightings, style, true)}`;
184
+ const {
185
+ actual,
186
+ expected,
187
+ showDiff
188
+ } = failure;
189
+ throw new EnsureError(message, actual, expected, fact.operator, showDiff);
190
+ }
191
+ // each fact started and told of its sightings, ready to decide
192
+ function tracked(sightings, facts) {
193
+ const started = buildFacts(facts);
194
+ const byKind = new Map();
195
+ for (const fact of started) byKind.set(fact.kind, [...(byKind.get(fact.kind) ?? []), fact]);
196
+ for (const [kind, value] of sightings) {
197
+ for (const fact of byKind.get(kind) ?? []) fact.track(fact.test(value));
198
+ }
199
+ return started;
200
+ }
201
+ const ofKind = (sightings, kind) => sightings.filter(([seenKind]) => seenKind === kind).length;
202
+ // the first fact to fail, with what it saw.
203
+ // Every fact decides, including those of a kind the tree never showed
204
+ function check(sightings, facts) {
205
+ for (const fact of tracked(sightings, facts)) {
206
+ const failure = fact.decide(ofKind(sightings, fact.kind));
207
+ if (failure !== undefined) return [fact, failure];
208
+ }
209
+ return undefined;
210
+ }
211
+ // matching: whether a sighting meets a scope's inner facts, stopping at the first miss
212
+ const scopeTest = (scopeOf, inner) => seen => {
213
+ const sightings = scopeOf(seen);
214
+ return sightings !== undefined && check(sightings, inner) === undefined;
215
+ };
216
+ // reporting, once a fact has failed: every inner fact a sighting missed and met.
217
+ // Its score: 2 for each fact met, 1 for each missed whose kind it holds
218
+ const scopeExplain = (scopeOf, inner) => seen => {
219
+ const sightings = scopeOf(seen);
220
+ if (sightings === undefined) return 'not content';
221
+ const misses = [];
222
+ const met = [];
223
+ let score = 0;
224
+ for (const fact of tracked(sightings, inner)) {
225
+ const seenOfKind = ofKind(sightings, fact.kind);
226
+ const failure = fact.decide(seenOfKind);
227
+ if (failure === undefined) {
228
+ score += 2;
229
+ met.push(fact);
230
+ } else {
231
+ if (seenOfKind > 0) score += 1;
232
+ misses.push({
233
+ fact,
234
+ failure,
235
+ sightings
236
+ });
237
+ }
238
+ }
239
+ return misses.length === 0 ? undefined : {
240
+ misses,
241
+ met,
242
+ score
243
+ };
244
+ };
245
+ // a scoped inner fact lists its own sightings with their reasons, down to the miss;
246
+ // its description would only repeat the rest of the outer one
247
+ function explained(outcome, style) {
248
+ const {
249
+ readable,
250
+ paint
251
+ } = style;
252
+ if (outcome === 'not content') return paint('red', outcome);
253
+ const label = fact => readable ? fact.spoken : fact.chained;
254
+ const missed = outcome.misses.map(({
255
+ fact,
256
+ failure,
257
+ sightings
258
+ }) => {
259
+ if (fact.explain === undefined) return paint('red', `${label(fact)}: ${failure.saw}`);
260
+ // a children fact's one sighting is its element, so listing it would repeat the element
261
+ const element = fact.operator === '' ? sightings.find(([kind]) => kind === fact.kind) : undefined;
262
+ const inner = element === undefined ? undefined : fact.explain(element[1]);
263
+ if (inner !== undefined) {
264
+ return `${readable ? 'in its children,' : 'children:'} ${explained(inner, style)}`;
265
+ }
266
+ return `${paint('red', `${failure.saw};`)} ${seenLine(fact, sightings, style)}`;
267
+ });
268
+ const met = outcome.met.length === 0 ? [] : [paint('green', `met: ${outcome.met.map(label).join(', ')}`)];
269
+ return [...missed, ...met].join('; ');
270
+ }
271
+ // met: first; not content: last
272
+ const rank = outcome => outcome === undefined ? Infinity : outcome === 'not content' ? -1 : outcome.score;
273
+ const fnName = fn => fn.name === '' ? 'fn' : fn.name;
274
+ // a fact as it reads inside a scope: one.prop('href'); a children fact carries no quantifier
275
+ const chained = ([,,, quantifier, end]) => quantifier === '' ? end : `${quantifier}.${end}`;
276
+ const listed = facts => `[${facts.map(chained).join(', ')}]`;
277
+ const childrenKind = 'children';
278
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
279
+ const childrenScope = seen => contentSightings(seen.children);
280
+ // a children fact takes the kind of the element whose with list holds it
281
+ const forKind = (fact, kind) => fact[0] === childrenKind ? [kind, fact[1], fact[2], fact[3], fact[4], fact[5], fact[6]] : fact;
282
+ // a with list holds one sighting of its element's kind - the element itself - so a children fact
283
+ // passes where the element's content meets its inner facts
284
+ function childrenFact(inner, end, spoken) {
285
+ return [childrenKind, scopeTest(childrenScope, inner), counting(count => count === 1, 1), '', end, `${spoken} in its children`, scopeExplain(childrenScope, inner)];
286
+ }
287
+ // the element's children as a tree, for a with list, beside the element's own facts:
288
+ // with([one.className('x'), children.one.html('li')]), or with([children([…])]) for a list of them
289
+ export const children = withMembers(facts => childrenFact(facts, `children(${listed(facts)})`, spokenList(facts)), quantifiers(inner => childrenFact([inner], `children.${chained(inner)}`, inner[5])));
290
+ function withMembers(fn, members) {
291
+ Object.defineProperties(fn, Object.getOwnPropertyDescriptors(members));
292
+ return fn; // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion
293
+ }
294
+ // each fact's requirement started for this run, with its own state
295
+ function buildFacts(facts) {
296
+ return facts.map(fact => {
297
+ const [kind, test, requirement, quantifier,, spoken, explain] = fact;
298
+ const [track, decide] = requirement();
299
+ return {
300
+ kind,
301
+ test,
302
+ track,
303
+ decide,
304
+ explain,
305
+ spoken,
306
+ chained: chained(fact),
307
+ operator: quantifier
308
+ };
309
+ });
310
+ }
311
+ const countFailure = (actual, expected) => ({
312
+ actual,
313
+ expected,
314
+ saw: `saw ${actual}`,
315
+ showDiff: true
316
+ });
317
+ // counts every match, so a failure reports the full count, not the one it stopped at
318
+ function counting(pass, expected) {
319
+ return () => {
320
+ let count = 0;
321
+ return [match => {
322
+ if (match) ++count;
323
+ }, () => pass(count) ? undefined : countFailure(count, expected)];
324
+ };
325
+ }
326
+ const seenListed = 10;
327
+ // only those listed are shown, as a nested reason is costly to build
328
+ function listing(items, show, separator = ', ') {
329
+ return items.slice(0, seenListed).map(show).join(separator) + (items.length > seenListed ? `${separator}… ${items.length - seenListed} more` : '');
330
+ }
331
+ // each sighting with why it missed, where the fact can say, the nearest first;
332
+ // none of an element kind seen: list the other tags or components, as a near miss.
333
+ // Top level elements a line each, as their props and reasons run long; nested ones stay inline
334
+ function seenLine({
335
+ kind,
336
+ explain
337
+ }, sightings, style, top = false) {
338
+ const {
339
+ readable,
340
+ paint
341
+ } = style;
342
+ const separator = top && /^(html|component):/.test(kind) ? '\n ' : ', ';
343
+ const named = readable ? spokenKind(kind) : kind;
344
+ const seen = sightings.filter(([seenKind]) => seenKind === kind).map(sighting => ({
345
+ sighting,
346
+ outcome: explain?.(sighting[1])
347
+ }));
348
+ if (seen.length > 0) {
349
+ // stable, so sightings as near as each other stay in document order
350
+ if (explain !== undefined) seen.sort((a, b) => rank(b.outcome) - rank(a.outcome));
351
+ const opening = separator === ', ' ? ' ' : separator;
352
+ const shown = listing(seen, ({
353
+ sighting,
354
+ outcome
355
+ }) => paint('white', displaySighting(sighting)) + (outcome === undefined ? '' : ` (${explained(outcome, style)})`), separator);
356
+ const heading = readable && seen.length > 1 ? plural(named) : named;
357
+ return `${paint('white', `${heading} seen:`)}${opening}${shown}`;
358
+ }
359
+ const family = /^(html|component):/.exec(kind)?.[1];
360
+ if (family === undefined) return `no ${named} seen`;
361
+ const others = sightings.filter(([seenKind]) => seenKind.startsWith(`${family}:`)).map(([seenKind]) => seenKind.slice(family.length + 1));
362
+ return others.length === 0 ? `no ${named} seen` : `no ${named} seen; ${family} seen: ${listing(others, name => name)}`;
363
+ }
364
+ // <button>s, title props, classes
365
+ const plural = named => named.endsWith('s') ? `${named}es` : `${named}s`;
366
+ // a kind as prose: <button>, title prop, element text
367
+ function spokenKind(kind) {
368
+ const [family, name] = kind.split(/:(.*)/);
369
+ if (family === 'html' || family === 'component') return `<${name}>`;
370
+ if (family === 'prop') return `${name} prop`;
371
+ const plain = {
372
+ text: 'text node',
373
+ interruptedText: 'element text',
374
+ className: 'class'
375
+ };
376
+ return plain[kind] ?? kind;
377
+ }
378
+ // an element as its tag or name and props, as written: <a href='/x'>
379
+ function displaySighting([kind, value]) {
380
+ if (kind === 'fragment') return '<>';
381
+ const element = /^(?:html|component):(.*)$/.exec(kind)?.[1];
382
+ if (element === undefined) return display(value);
383
+ const props = Object.entries(value).filter(([name]) => name !== 'children').map(([name, prop]) => ` ${name}=${display(prop)}`);
384
+ return `<${element}${props.join('')}>`;
385
+ }
386
+ const displayed = 5; // entries shown of an array or object
387
+ const displayDepth = 2;
388
+ // a value as a failure message shows it; arrays and objects shortened by length and depth
389
+ function display(value, depth = 0) {
390
+ if (typeof value === 'string') return `'${value}'`;
391
+ if (typeof value === 'function') {
392
+ return value.name === '' ? '[function]' : `[function ${value.name}]`;
393
+ }
394
+ if (typeof value !== 'object' || value === null) {
395
+ return String(value); // a number, boolean, bigint, symbol, null or undefined
396
+ }
397
+ if (value instanceof Date) {
398
+ return isNaN(value.getTime()) ? 'Date(invalid)' : `Date(${value.toISOString()})`;
399
+ }
400
+ // an element held as a value, as in a prop: by tag or name, as its symbol keys hide it as data
401
+ if ($type in value && IsContentNode(value) && ContentNodeIsElement(value)) {
402
+ const type = value[$type];
403
+ if (type === $fragment) return '<>';
404
+ return `<${typeof type === 'string' ? type : componentTypeIdentityKey(type)}>`;
405
+ }
406
+ const shown = entries => depth >= displayDepth ? '…' : entries.slice(0, displayed).join(', ') + (entries.length > displayed ? ', …' : '');
407
+ if (Array.isArray(value)) {
408
+ return value.length === 0 ? '[]' : `[${shown(value.map(each => display(each, depth + 1)))}]`;
409
+ }
410
+ if (value instanceof Set) {
411
+ return `Set { ${shown([...value].map(each => display(each, depth + 1)))} }`;
412
+ }
413
+ if (value instanceof Map) {
414
+ const pairs = [...value].map(([key, each]) => `${display(key, depth + 1)} => ${display(each, depth + 1)}`);
415
+ return `Map { ${shown(pairs)} }`;
416
+ }
417
+ const entries = Object.entries(value).map(([key, each]) => `${key}: ${display(each, depth + 1)}`);
418
+ return entries.length === 0 ? '{}' : `{ ${shown(entries)} }`;
419
+ }
420
+ // an element's edge: text either side of one is not one run of text
421
+ const edge = Symbol('edge');
422
+ // in document order; the unrendered tree: a component is seen by name, its content not expanded.
423
+ // Adjacent text is one sighting, as the page shows it: JSX splits `Hi, {name}.` into three
424
+ function contentSightings(content) {
425
+ const sightings = [];
426
+ let run; // the text sighting still open to joining
427
+ for (const token of contentTokens(content)) {
428
+ if (token === edge) run = undefined;
429
+ // a fragment is seen but is no break, as it renders nothing of its own
430
+ else if (token[0] === 'fragment') sightings.push([...token]);else if (token[0] === 'text') {
431
+ if (run === undefined) {
432
+ run = ['text', token[1]];
433
+ sightings.push(run);
434
+ } else run[1] += token[1];
435
+ } else {
436
+ run = undefined;
437
+ sightings.push([...token]);
438
+ }
439
+ }
440
+ return sightings;
441
+ }
442
+ // fragments, arrays and non-rendered values add no edge: their text runs on into their neighbours'
443
+ function contentTokens(content) {
444
+ if (ContentNodeIsArray(content)) return content.flatMap(contentTokens);
445
+ if (ContentNodeIsLiteral(content)) return [['text', String(content)]];
446
+ if (!ContentNodeIsElement(content)) return []; // null, undefined, boolean
447
+ const props = content[$props];
448
+ if (ContentNodeElementIsHtml(content)) {
449
+ const descendants = contentTokens(props.children);
450
+ return [edge, ...htmlOwnSightings(content[$type], props), ...descendants, edge];
451
+ }
452
+ if (ContentNodeElementIsComponent(content)) {
453
+ // the name stylesheets match by
454
+ const name = componentTypeIdentityKey(content[$type]);
455
+ /// TODO children is a prop the component may render or not, so the walk arguably should
456
+ /// stop here and leave what it holds to children() - but too much breaks without it for now
457
+ return [edge, ...componentOwnSightings(name, props), ...contentTokens(props.children), edge];
458
+ /// TODO components can have classNames, ids too...
459
+ }
460
+ const fragment = ['fragment', props]; // seen, but unwrapped: its content is walked
461
+ return [fragment, ...contentTokens(props.children)];
462
+ }
463
+ // an element's sightings of itself, its content left out
464
+ function htmlOwnSightings(tag, props) {
465
+ // class and id only on html: a component's className is still a prop, not a class
466
+ const classes = props.className ?? props.class;
467
+ const classNames = typeof classes === 'string' ? classes.split(/\s+/).filter(c => c !== '') : [];
468
+ const id = typeof props.id === 'string' ? [['id', props.id]] : [];
469
+ const text = contentText(props.children);
470
+ const interrupted = text === '' ? [] : [['interruptedText', text]];
471
+ return [[`html:${tag}`, props], ...classNames.map(c => ['className', c]), ...id, ...interrupted, ...propSightings(props)];
472
+ }
473
+ // an element's whole text, the markup between the words ignored, as textContent reads it.
474
+ // A component's children count, as the walk takes them: the two say the same about a tree
475
+ function contentText(content) {
476
+ if (ContentNodeIsArray(content)) return content.map(contentText).join('');
477
+ if (ContentNodeIsLiteral(content)) return String(content);
478
+ if (!ContentNodeIsElement(content)) return ''; // null, undefined, boolean
479
+ return contentText(content[$props].children);
480
+ }
481
+ function componentOwnSightings(name, props) {
482
+ return [[`component:${name}`, props], ...propSightings(props)];
483
+ }
484
+ const lower = text => text.toLowerCase();
485
+ // g and y would carry lastIndex from one sighting's test to the next, so they are dropped
486
+ function matching(regex, addFlags = '') {
487
+ const flags = [...new Set(regex.flags.replace(/[gy]/g, '') + addFlags)].join('');
488
+ const plain = new RegExp(regex.source, flags);
489
+ return seen => typeof seen === 'string' && plain.test(seen);
490
+ }
491
+ // subset: chai-subset's containSubset, but a function in the shape is compared by reference, not
492
+ // called: extra keys and array elements pass, each shape element matching some element, any order.
493
+ // duck: as TS structural typing - extra keys pass, but an array is a tuple: same length, in place.
494
+ // Beyond chai-subset: Object.is, as deep-eql, so NaN matches; Map and Set shapes are subsets too.
495
+ // As chai-subset: a key undefined in the shape matches a missing one
496
+ function contains(shape, value, arrays) {
497
+ const within = (inner, seen) => contains(inner, seen, arrays);
498
+ if (Object.is(shape, value)) return true;
499
+ if (typeof shape !== 'object' || shape === null) return false;
500
+ if (typeof value !== 'object' || value === null) return false;
501
+ const someOf = (values, each) => values.some(seen => within(each, seen));
502
+ if (Array.isArray(shape)) {
503
+ if (!('length' in value) || typeof value.length !== 'number') return false;
504
+ const values = Array.from(value);
505
+ return arrays === 'inPlace' ? shape.length === values.length && shape.every((each, i) => within(each, values[i])) : shape.every(each => someOf(values, each));
506
+ }
507
+ if (shape instanceof Date) {
508
+ return value instanceof Date && Object.is(shape.getTime(), value.getTime());
509
+ }
510
+ if (shape instanceof Set) {
511
+ return value instanceof Set && [...shape].every(each => someOf([...value], each));
512
+ }
513
+ if (shape instanceof Map) {
514
+ return value instanceof Map && [...shape].every(([key, each]) => value.has(key) && within(each, value.get(key)));
515
+ }
516
+ const record = value;
517
+ return Object.entries(shape).every(([key, each]) => within(each, record[key]));
518
+ }
519
+ // every prop but children, whose content is walked instead
520
+ function propSightings(props) {
521
+ return Object.entries(props).filter(([name]) => name !== 'children').map(([name, value]) => [`prop:${name}`, value]);
522
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ensure.trial.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure.trial.d.ts","sourceRoot":"","sources":["../../src/testing/ensure.trial.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ import { $props, $type } from '../contentNodeSymbols.js';
2
+ import { ensure } from './ensure.js';
3
+ const content = {
4
+ [$type]: 'span',
5
+ [$props]: {
6
+ children: 'Bob'
7
+ }
8
+ };
9
+ ensure(content, [ensure.one.text('Bob'), ensure.one.text.contains('o'), ensure.one.prop('to').is('foo')]);
@@ -1 +1 @@
1
- {"version":3,"file":"contentHtmlElements.d.ts","sourceRoot":"","sources":["../../../src/testing/helpers/contentHtmlElements.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,WAAW,EAChB,KAAK,eAAe,EACvB,MAAM,sBAAsB,CAAA;AAG7B,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,eAAe,EAUzE,CAAA"}
1
+ {"version":3,"file":"contentHtmlElements.d.ts","sourceRoot":"","sources":["../../../src/testing/helpers/contentHtmlElements.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,WAAW,EAAE,KAAK,eAAe,EAEzC,MAAM,sBAAsB,CAAA;AAG7B,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,eAAe,EAUzE,CAAA"}