tungsten 0.3.2 → 0.3.4

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 (397) hide show
  1. package/dist/.build-complete +1 -0
  2. package/dist/Components.d.ts +6 -1
  3. package/dist/Components.d.ts.map +1 -1
  4. package/dist/Components.js +103 -40
  5. package/dist/DomPointer.d.ts +11 -0
  6. package/dist/DomPointer.d.ts.map +1 -1
  7. package/dist/DomPointer.js +15 -0
  8. package/dist/DomRegion.d.ts +2 -0
  9. package/dist/DomRegion.d.ts.map +1 -1
  10. package/dist/DomRegion.js +23 -3
  11. package/dist/Framework.d.ts +2 -0
  12. package/dist/Framework.d.ts.map +1 -1
  13. package/dist/Framework.js +94 -61
  14. package/dist/FrameworkConfig.d.ts +4 -0
  15. package/dist/FrameworkConfig.d.ts.map +1 -1
  16. package/dist/Instance/Instance.d.ts +1 -1
  17. package/dist/Instance/Instance.d.ts.map +1 -1
  18. package/dist/Instance/Instance.js +18 -1
  19. package/dist/Instance/InstanceConfig.d.ts +1 -0
  20. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  21. package/dist/PopMessage.type.d.ts +6 -0
  22. package/dist/PopMessage.type.d.ts.map +1 -0
  23. package/dist/PopMessage.type.js +1 -0
  24. package/dist/Servers/DevServer.d.ts +2 -0
  25. package/dist/Servers/DevServer.d.ts.map +1 -1
  26. package/dist/Servers/DevServer.js +87 -11
  27. package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
  28. package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
  29. package/dist/Servers/ProdServer.d.ts +2 -1
  30. package/dist/Servers/ProdServer.d.ts.map +1 -1
  31. package/dist/Servers/ProdServer.js +92 -8
  32. package/dist/Servers/hono/DevServerHono.js +25 -29
  33. package/dist/Servers/hono/ProdServerHono.js +49 -142
  34. package/dist/Servers/hono/TungstenServerHono.d.ts +1 -1
  35. package/dist/Servers/hono/TungstenServerHono.d.ts.map +1 -1
  36. package/dist/Servers/hono/TungstenServerHono.js +12 -29
  37. package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
  38. package/dist/Servers/loadEnvsDev.js +16 -5
  39. package/dist/Servers/routing.d.ts.map +1 -1
  40. package/dist/Servers/routing.js +10 -6
  41. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts +0 -3
  42. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts.map +1 -1
  43. package/dist/Servers/tungstenCorePrivateEnvSchema.js +3 -3
  44. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts +8 -0
  45. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts.map +1 -0
  46. package/dist/Servers/tungstenCorePublicEnvSchema.js +14 -0
  47. package/dist/Store/InternalStoreSchema.d.ts +2 -0
  48. package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
  49. package/dist/Store/InternalStoreSchema.js +1 -0
  50. package/dist/api/Request.d.ts +1 -1
  51. package/dist/api/Request.d.ts.map +1 -1
  52. package/dist/api/Response.d.ts +1 -1
  53. package/dist/api/Response.d.ts.map +1 -1
  54. package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts +13 -0
  55. package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts.map +1 -0
  56. package/dist/babelPlugins/BabelExtractComponentStylesheet.js +24 -0
  57. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts +2 -0
  58. package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
  59. package/dist/babelPlugins/BabelTransformComponentStyles.js +21 -5
  60. package/dist/babelPlugins/BabelTransformPackageImports.d.ts +1 -0
  61. package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
  62. package/dist/babelPlugins/BabelTransformPackageImports.js +21 -9
  63. package/dist/babelPlugins/BabelTypes.d.ts +2 -2
  64. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  65. package/dist/babelPlugins/BabelTypes.js +0 -1
  66. package/dist/bin/commands/build.d.ts.map +1 -1
  67. package/dist/bin/commands/build.js +12 -2
  68. package/dist/bin/commands/compile.d.ts.map +1 -1
  69. package/dist/bin/commands/compile.js +7 -2
  70. package/dist/bin/commands/dev.d.ts.map +1 -1
  71. package/dist/bin/commands/dev.js +15 -4
  72. package/dist/bin/commands/devmon.d.ts +2 -0
  73. package/dist/bin/commands/devmon.d.ts.map +1 -0
  74. package/dist/bin/commands/devmon.js +66 -0
  75. package/dist/bin/index.d.ts.map +1 -1
  76. package/dist/bin/index.js +6 -0
  77. package/dist/booleanAttributeValue.d.ts +21 -0
  78. package/dist/booleanAttributeValue.d.ts.map +1 -0
  79. package/dist/booleanAttributeValue.js +23 -0
  80. package/dist/build/CompilationInfo.d.ts +1 -0
  81. package/dist/build/CompilationInfo.d.ts.map +1 -1
  82. package/dist/build/combineComponentCss.d.ts +1 -1
  83. package/dist/build/combineComponentCss.d.ts.map +1 -1
  84. package/dist/build/combineComponentCss.js +3 -3
  85. package/dist/build/compileJavascript.d.ts.map +1 -1
  86. package/dist/build/compileJavascript.js +3 -3
  87. package/dist/build/compileUserApp.d.ts +2 -1
  88. package/dist/build/compileUserApp.d.ts.map +1 -1
  89. package/dist/build/compileUserApp.js +18 -8
  90. package/dist/build/createInstanceConfigFile.js +1 -1
  91. package/dist/build/frameworkStylesheets.d.ts +5 -0
  92. package/dist/build/frameworkStylesheets.d.ts.map +1 -0
  93. package/dist/build/frameworkStylesheets.js +49 -0
  94. package/dist/build/getPackageDirForFile.d.ts +2 -0
  95. package/dist/build/getPackageDirForFile.d.ts.map +1 -0
  96. package/dist/build/getPackageDirForFile.js +11 -0
  97. package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
  98. package/dist/build/getSxyClientPackageAliases.js +3 -1
  99. package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
  100. package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
  101. package/dist/build/makeBabelUserDevConfig.js +3 -2
  102. package/dist/build/makeBabelUserProdConfig.d.ts +1 -1
  103. package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
  104. package/dist/build/makeBabelUserProdConfig.js +4 -2
  105. package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
  106. package/dist/build/rollup.user.prod.config.js +4 -1
  107. package/dist/build/rollupExtractComponentStylesheets.d.ts +12 -0
  108. package/dist/build/rollupExtractComponentStylesheets.d.ts.map +1 -0
  109. package/dist/build/rollupExtractComponentStylesheets.js +35 -0
  110. package/dist/compat/context.d.ts +1 -1
  111. package/dist/compat/context.d.ts.map +1 -1
  112. package/dist/compat/types.d.ts +1 -1
  113. package/dist/compat/types.d.ts.map +1 -1
  114. package/dist/componentCss/i/T-components-library-RichTextEditor-RichTextEditor.css +115 -0
  115. package/dist/componentCss/i/T-components-library-__StatefulMessage-StatefulMessage.css +25 -0
  116. package/dist/componentCss/tungsten.css +2 -0
  117. package/dist/componentProxyHandlers.d.ts +2 -1
  118. package/dist/componentProxyHandlers.d.ts.map +1 -1
  119. package/dist/componentProxyHandlers.js +45 -9
  120. package/dist/components/GoToComponent.d.ts +1 -1
  121. package/dist/components/GoToComponent.d.ts.map +1 -1
  122. package/dist/components/PopMessages.d.ts +12 -0
  123. package/dist/components/PopMessages.d.ts.map +1 -0
  124. package/dist/components/PopMessages.js +45 -0
  125. package/dist/components/_GoToComponent.d.ts +10 -0
  126. package/dist/components/_GoToComponent.d.ts.map +1 -0
  127. package/dist/components/_GoToComponent.js +13 -0
  128. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts +50 -0
  129. package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -0
  130. package/dist/components/library/RichTextEditor/RichTextEditor.js +458 -0
  131. package/dist/components/library/RichTextEditor/StoredContentNode.d.ts +5 -0
  132. package/dist/components/library/RichTextEditor/StoredContentNode.d.ts.map +1 -0
  133. package/dist/components/library/RichTextEditor/StoredContentNode.js +1 -0
  134. package/dist/components/library/RichTextEditor/activeFormats.d.ts +20 -0
  135. package/dist/components/library/RichTextEditor/activeFormats.d.ts.map +1 -0
  136. package/dist/components/library/RichTextEditor/activeFormats.js +48 -0
  137. package/dist/components/library/RichTextEditor/contentTree.d.ts +30 -0
  138. package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -0
  139. package/dist/components/library/RichTextEditor/contentTree.js +81 -0
  140. package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts +30 -0
  141. package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts.map +1 -0
  142. package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.js +97 -0
  143. package/dist/components/library/__StatefulMessage/MessageData.d.ts +7 -0
  144. package/dist/components/library/__StatefulMessage/MessageData.d.ts.map +1 -0
  145. package/dist/components/library/__StatefulMessage/MessageData.js +1 -0
  146. package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts +22 -0
  147. package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts.map +1 -0
  148. package/dist/components/library/__StatefulMessage/StatefulMessage.js +88 -0
  149. package/dist/components/library/index.d.ts +5 -0
  150. package/dist/components/library/index.d.ts.map +1 -0
  151. package/dist/components/library/index.js +7 -0
  152. package/dist/defaultConfig.d.ts +2 -0
  153. package/dist/defaultConfig.d.ts.map +1 -1
  154. package/dist/defaultConfig.js +3 -1
  155. package/dist/env/Interfaces.d.ts +2 -1
  156. package/dist/env/Interfaces.d.ts.map +1 -1
  157. package/dist/env/getEnvSchemas.d.ts +1 -1
  158. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  159. package/dist/env/injectEnv.d.ts +1 -1
  160. package/dist/env/injectEnv.d.ts.map +1 -1
  161. package/dist/env/injectEnv.js +16 -6
  162. package/dist/env/publicEnv.d.ts.map +1 -1
  163. package/dist/env/publicEnv.js +4 -1
  164. package/dist/findUserConfig.d.ts +1 -1
  165. package/dist/frameworkConfigSchema.d.ts +4 -0
  166. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  167. package/dist/frameworkConfigSchema.js +2 -1
  168. package/dist/hooks/index.d.ts +1 -0
  169. package/dist/hooks/index.d.ts.map +1 -1
  170. package/dist/hooks/index.js +1 -0
  171. package/dist/hooks/useInstance.d.ts +3 -0
  172. package/dist/hooks/useInstance.d.ts.map +1 -0
  173. package/dist/hooks/useInstance.js +4 -0
  174. package/dist/hydrate/hydrate.d.ts +6 -4
  175. package/dist/hydrate/hydrate.d.ts.map +1 -1
  176. package/dist/hydrate/hydrate.js +51 -13
  177. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  178. package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
  179. package/dist/hydrate/renderHydrationMismatchBanner.d.ts +7 -0
  180. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -0
  181. package/dist/hydrate/renderHydrationMismatchBanner.js +69 -0
  182. package/dist/indexInner.d.ts +13 -5
  183. package/dist/indexInner.d.ts.map +1 -1
  184. package/dist/indexInner.js +9 -2
  185. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  186. package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -1
  187. package/dist/pop.d.ts +10 -0
  188. package/dist/pop.d.ts.map +1 -0
  189. package/dist/pop.js +49 -0
  190. package/dist/postcssPlugins/TransformCssNames.d.ts.map +1 -1
  191. package/dist/postcssPlugins/TransformCssNames.js +10 -2
  192. package/dist/propsAreEqual.d.ts +8 -0
  193. package/dist/propsAreEqual.d.ts.map +1 -0
  194. package/dist/propsAreEqual.js +97 -0
  195. package/dist/rawHtml/filterContentNode.d.ts +20 -0
  196. package/dist/rawHtml/filterContentNode.d.ts.map +1 -0
  197. package/dist/rawHtml/filterContentNode.js +96 -0
  198. package/dist/rawHtml/parseHtml.d.ts +14 -0
  199. package/dist/rawHtml/parseHtml.d.ts.map +1 -1
  200. package/dist/rawHtml/parseHtml.js +4 -4
  201. package/dist/rawHtml/sanitizeHtml.d.ts +17 -0
  202. package/dist/rawHtml/sanitizeHtml.d.ts.map +1 -0
  203. package/dist/rawHtml/sanitizeHtml.js +19 -0
  204. package/dist/render/HeadData.d.ts +2 -0
  205. package/dist/render/HeadData.d.ts.map +1 -1
  206. package/dist/render/contentNodeToHtml.d.ts +18 -0
  207. package/dist/render/contentNodeToHtml.d.ts.map +1 -0
  208. package/dist/render/contentNodeToHtml.js +66 -0
  209. package/dist/render/contentToHtml.d.ts.map +1 -1
  210. package/dist/render/contentToHtml.js +3 -1
  211. package/dist/render/instantiateClassComponent.d.ts.map +1 -1
  212. package/dist/render/instantiateClassComponent.js +4 -0
  213. package/dist/render/processHead.d.ts.map +1 -1
  214. package/dist/render/processHead.js +22 -3
  215. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  216. package/dist/render/renderingTreeToHtml.js +8 -1
  217. package/dist/routing/ErrorRouteType.d.ts +6 -0
  218. package/dist/routing/ErrorRouteType.d.ts.map +1 -0
  219. package/dist/routing/ErrorRouteType.js +1 -0
  220. package/dist/routing/RouteTypes.d.ts +2 -1
  221. package/dist/routing/RouteTypes.d.ts.map +1 -1
  222. package/dist/routing/Routes.d.ts +5 -0
  223. package/dist/routing/Routes.d.ts.map +1 -1
  224. package/dist/routing/TungstenErrorInfo.d.ts +6 -0
  225. package/dist/routing/TungstenErrorInfo.d.ts.map +1 -0
  226. package/dist/routing/TungstenErrorInfo.js +6 -0
  227. package/dist/settings.d.ts +2 -0
  228. package/dist/settings.d.ts.map +1 -1
  229. package/dist/settings.js +3 -0
  230. package/dist/stateTracking.d.ts +47 -0
  231. package/dist/stateTracking.d.ts.map +1 -0
  232. package/dist/stateTracking.js +83 -0
  233. package/dist/staticGen/staticGen.d.ts.map +1 -1
  234. package/dist/staticGen/staticGen.js +117 -107
  235. package/dist/style/styleContentSxy.js +21 -0
  236. package/dist/testing/hydrateTestApp.d.ts +38 -0
  237. package/dist/testing/hydrateTestApp.d.ts.map +1 -0
  238. package/dist/testing/hydrateTestApp.js +242 -0
  239. package/dist/testing/index.d.ts +4 -3
  240. package/dist/testing/index.d.ts.map +1 -1
  241. package/dist/testing/index.js +16 -2
  242. package/dist/testing/installTestStyleProcessors.d.ts +2 -0
  243. package/dist/testing/installTestStyleProcessors.d.ts.map +1 -0
  244. package/dist/testing/installTestStyleProcessors.js +21 -0
  245. package/dist/testing/temp/componentPackageMock.d.ts +18 -0
  246. package/dist/testing/temp/componentPackageMock.d.ts.map +1 -0
  247. package/dist/testing/temp/componentPackageMock.js +37 -0
  248. package/dist/testing/temp/contentHtmlElements.d.ts +3 -0
  249. package/dist/testing/temp/contentHtmlElements.d.ts.map +1 -0
  250. package/dist/testing/temp/contentHtmlElements.js +12 -0
  251. package/dist/timeProfiler.d.ts +6 -0
  252. package/dist/timeProfiler.d.ts.map +1 -0
  253. package/dist/timeProfiler.js +31 -0
  254. package/dist/update/integrateUpdateVdom.d.ts +11 -0
  255. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  256. package/dist/update/integrateUpdateVdom.js +169 -54
  257. package/dist/update/pendingMounts.d.ts +25 -0
  258. package/dist/update/pendingMounts.d.ts.map +1 -0
  259. package/dist/update/pendingMounts.js +55 -0
  260. package/dist/warnOnFrameworkChange.d.ts.map +1 -1
  261. package/dist/warnOnFrameworkChange.js +8 -8
  262. package/package.json +21 -17
  263. package/dist/FunctionComponentStandIn.sxyt.d.ts +0 -2
  264. package/dist/FunctionComponentStandIn.sxyt.d.ts.map +0 -1
  265. package/dist/FunctionComponentStandIn.sxyt.js +0 -52
  266. package/dist/Instance/gotoRedirect.sxyt.d.ts +0 -2
  267. package/dist/Instance/gotoRedirect.sxyt.d.ts.map +0 -1
  268. package/dist/Instance/gotoRedirect.sxyt.js +0 -148
  269. package/dist/Instance/runTrackedWork.sxyt.d.ts +0 -2
  270. package/dist/Instance/runTrackedWork.sxyt.d.ts.map +0 -1
  271. package/dist/Instance/runTrackedWork.sxyt.js +0 -35
  272. package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts +0 -2
  273. package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts.map +0 -1
  274. package/dist/Servers/devErrorPageAutoRetry.sxyt.js +0 -117
  275. package/dist/_client/cjsHelpers.sxyt.d.ts +0 -2
  276. package/dist/_client/cjsHelpers.sxyt.d.ts.map +0 -1
  277. package/dist/_client/cjsHelpers.sxyt.js +0 -45
  278. package/dist/auth/passwordHashing.sxyt.d.ts +0 -2
  279. package/dist/auth/passwordHashing.sxyt.d.ts.map +0 -1
  280. package/dist/auth/passwordHashing.sxyt.js +0 -46
  281. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts +0 -2
  282. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts.map +0 -1
  283. package/dist/auth/ref/checkPasswordResetToken.sxyt.js +0 -40
  284. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts +0 -2
  285. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts.map +0 -1
  286. package/dist/auth/ref/createPasswordResetToken.sxyt.js +0 -10
  287. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts +0 -2
  288. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts.map +0 -1
  289. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.js +0 -138
  290. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts +0 -2
  291. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts.map +0 -1
  292. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.js +0 -108
  293. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts +0 -2
  294. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts.map +0 -1
  295. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.js +0 -104
  296. package/dist/bin/commands/compile.sxyt.d.ts +0 -2
  297. package/dist/bin/commands/compile.sxyt.d.ts.map +0 -1
  298. package/dist/bin/commands/compile.sxyt.js +0 -255
  299. package/dist/build/modifySassImports.sxyt.d.ts +0 -2
  300. package/dist/build/modifySassImports.sxyt.d.ts.map +0 -1
  301. package/dist/build/modifySassImports.sxyt.js +0 -55
  302. package/dist/build/sassImportParser.sxyt.d.ts +0 -2
  303. package/dist/build/sassImportParser.sxyt.d.ts.map +0 -1
  304. package/dist/build/sassImportParser.sxyt.js +0 -110
  305. package/dist/build/scssImportParserChatgpt.sxyt.d.ts +0 -2
  306. package/dist/build/scssImportParserChatgpt.sxyt.d.ts.map +0 -1
  307. package/dist/build/scssImportParserChatgpt.sxyt.js +0 -120
  308. package/dist/clone.sxyt.d.ts +0 -2
  309. package/dist/clone.sxyt.d.ts.map +0 -1
  310. package/dist/clone.sxyt.js +0 -24
  311. package/dist/componentProxyHandlers.sxyt.d.ts +0 -2
  312. package/dist/componentProxyHandlers.sxyt.d.ts.map +0 -1
  313. package/dist/componentProxyHandlers.sxyt.js +0 -130
  314. package/dist/components/RawHtml.sxyt.d.ts +0 -2
  315. package/dist/components/RawHtml.sxyt.d.ts.map +0 -1
  316. package/dist/components/RawHtml.sxyt.js +0 -104
  317. package/dist/components/bindable/BindableSelect.sxyt.d.ts +0 -2
  318. package/dist/components/bindable/BindableSelect.sxyt.d.ts.map +0 -1
  319. package/dist/components/bindable/BindableSelect.sxyt.js +0 -186
  320. package/dist/env/injectEnv.sxyt.d.ts +0 -2
  321. package/dist/env/injectEnv.sxyt.d.ts.map +0 -1
  322. package/dist/env/injectEnv.sxyt.js +0 -20
  323. package/dist/env/parseEnv.d.ts +0 -2
  324. package/dist/env/parseEnv.d.ts.map +0 -1
  325. package/dist/env/parseEnv.js +0 -14
  326. package/dist/env/parseEnv.sxyt.d.ts +0 -2
  327. package/dist/env/parseEnv.sxyt.d.ts.map +0 -1
  328. package/dist/env/parseEnv.sxyt.js +0 -11
  329. package/dist/findProjectDir.sxyt.d.ts +0 -2
  330. package/dist/findProjectDir.sxyt.d.ts.map +0 -1
  331. package/dist/findProjectDir.sxyt.js +0 -82
  332. package/dist/hmr/applyHmrModule.sxyt.d.ts +0 -2
  333. package/dist/hmr/applyHmrModule.sxyt.d.ts.map +0 -1
  334. package/dist/hmr/applyHmrModule.sxyt.js +0 -182
  335. package/dist/hmr/instanceRegistry.sxyt.d.ts +0 -2
  336. package/dist/hmr/instanceRegistry.sxyt.d.ts.map +0 -1
  337. package/dist/hmr/instanceRegistry.sxyt.js +0 -24
  338. package/dist/hmr/refreshStylesheets.sxyt.d.ts +0 -2
  339. package/dist/hmr/refreshStylesheets.sxyt.d.ts.map +0 -1
  340. package/dist/hmr/refreshStylesheets.sxyt.js +0 -46
  341. package/dist/hydrate/hydrate.sxyt.d.ts +0 -2
  342. package/dist/hydrate/hydrate.sxyt.d.ts.map +0 -1
  343. package/dist/hydrate/hydrate.sxyt.js +0 -302
  344. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
  345. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
  346. package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -190
  347. package/dist/importDevModuleWithRetry.sxyt.d.ts +0 -2
  348. package/dist/importDevModuleWithRetry.sxyt.d.ts.map +0 -1
  349. package/dist/importDevModuleWithRetry.sxyt.js +0 -104
  350. package/dist/innerHtmlFromProps.sxyt.d.ts +0 -2
  351. package/dist/innerHtmlFromProps.sxyt.d.ts.map +0 -1
  352. package/dist/innerHtmlFromProps.sxyt.js +0 -99
  353. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts +0 -2
  354. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts.map +0 -1
  355. package/dist/postcssPlugins/parseSelectors.sxyt.js +0 -62
  356. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts +0 -2
  357. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts.map +0 -1
  358. package/dist/postcssPlugins/parseSelectorsRich.sxyt.js +0 -155
  359. package/dist/rawHtml/parseHtml.sxyt.d.ts +0 -2
  360. package/dist/rawHtml/parseHtml.sxyt.d.ts.map +0 -1
  361. package/dist/rawHtml/parseHtml.sxyt.js +0 -239
  362. package/dist/render/getFunctionBodyAsString.sxyt.d.ts +0 -2
  363. package/dist/render/getFunctionBodyAsString.sxyt.d.ts.map +0 -1
  364. package/dist/render/getFunctionBodyAsString.sxyt.js +0 -37
  365. package/dist/render/processHead.sxyt.d.ts +0 -2
  366. package/dist/render/processHead.sxyt.d.ts.map +0 -1
  367. package/dist/render/processHead.sxyt.js +0 -93
  368. package/dist/render/processProps.sxyt.d.ts +0 -2
  369. package/dist/render/processProps.sxyt.d.ts.map +0 -1
  370. package/dist/render/processProps.sxyt.js +0 -90
  371. package/dist/routing/compareRequestToRegex.sxyt.d.ts +0 -2
  372. package/dist/routing/compareRequestToRegex.sxyt.d.ts.map +0 -1
  373. package/dist/routing/compareRequestToRegex.sxyt.js +0 -65
  374. package/dist/routing/getPathPriority.sxyt.d.ts +0 -2
  375. package/dist/routing/getPathPriority.sxyt.d.ts.map +0 -1
  376. package/dist/routing/getPathPriority.sxyt.js +0 -24
  377. package/dist/routing/matchPath.sxyt.d.ts +0 -2
  378. package/dist/routing/matchPath.sxyt.d.ts.map +0 -1
  379. package/dist/routing/matchPath.sxyt.js +0 -41
  380. package/dist/routing/patternToRegex.sxyt.d.ts +0 -2
  381. package/dist/routing/patternToRegex.sxyt.d.ts.map +0 -1
  382. package/dist/routing/patternToRegex.sxyt.js +0 -69
  383. package/dist/routing/splitRequest.sxyt.d.ts +0 -2
  384. package/dist/routing/splitRequest.sxyt.d.ts.map +0 -1
  385. package/dist/routing/splitRequest.sxyt.js +0 -47
  386. package/dist/style/jssToCss.sxyt.d.ts +0 -2
  387. package/dist/style/jssToCss.sxyt.d.ts.map +0 -1
  388. package/dist/style/jssToCss.sxyt.js +0 -17
  389. package/dist/testing/createTestApp.sxyt.d.ts +0 -2
  390. package/dist/testing/createTestApp.sxyt.d.ts.map +0 -1
  391. package/dist/testing/createTestApp.sxyt.js +0 -470
  392. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts +0 -2
  393. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts.map +0 -1
  394. package/dist/testing/ensureTestEnvLoaded.sxyt.js +0 -20
  395. package/dist/update/hotSwap.sxyt.d.ts +0 -2
  396. package/dist/update/hotSwap.sxyt.d.ts.map +0 -1
  397. package/dist/update/hotSwap.sxyt.js +0 -252
@@ -1,239 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { parseHtml } from "./parseHtml.js";
4
- import { safeHtmlAllowList } from "./safeHtmlAllowList.js";
5
- import { decodeHtmlEntities } from "./decodeHtmlEntities.js";
6
- import { tokenizeHtml } from "./tokenizeHtml.js";
7
- import { renderingNodeToHtml } from "../render/renderingTreeToHtml.js";
8
- import { $props, $type } from "../contentNodeSymbols.js";
9
- // `found: true` short-circuits the <head> handling these tests do not need.
10
- // eslint-disable-next-line no-type-assertion/no-type-assertion
11
- const noHeadData = {
12
- found: true
13
- };
14
- // Renders a parsed tree back to markup. The renderer takes a RenderingNode,
15
- // which for plain HTML content is structurally what parseHtml returns.
16
- const render = async content => renderingNodeToHtml(
17
- // eslint-disable-next-line no-type-assertion/no-type-assertion
18
- content, false, noHeadData, null);
19
- const roundTrip = html => render(parseHtml(html));
20
- describe('decodeHtmlEntities()', ({
21
- it
22
- }) => {
23
- it('decodes named, decimal and hex references', () => {
24
- expect(decodeHtmlEntities('&pound;100 &amp; more')).to.equal('£100 & more');
25
- expect(decodeHtmlEntities('&#65;&#66;')).to.equal('AB');
26
- expect(decodeHtmlEntities('&#x41;&#X42;')).to.equal('AB');
27
- });
28
- it('leaves unknown and malformed references exactly as written', () => {
29
- expect(decodeHtmlEntities('&notareal; &amp')).to.equal('&notareal; &amp');
30
- expect(decodeHtmlEntities('a & b')).to.equal('a & b');
31
- });
32
- it('does not throw on out-of-range numeric references', () => {
33
- expect(decodeHtmlEntities('&#xFFFFFFFF;')).to.equal('&#xFFFFFFFF;');
34
- expect(decodeHtmlEntities('&#0;')).to.equal('&#0;');
35
- expect(decodeHtmlEntities('&#xD800;')).to.equal('&#xD800;');
36
- });
37
- });
38
- describe('tokenizeHtml()', ({
39
- it
40
- }) => {
41
- it('reads attributes in every quoting style', () => {
42
- const [token] = tokenizeHtml('<a href="/x" title=\'y\' data-n=3 hidden>');
43
- expect(token?.kind).to.equal('open');
44
- expect(token?.kind === 'open' && token.attributes).to.deep.equal({
45
- href: '/x',
46
- title: 'y',
47
- 'data-n': '3',
48
- hidden: true
49
- });
50
- });
51
- it('drops comments and doctypes', () => {
52
- expect(tokenizeHtml('<!doctype html><!-- hi --><b>x</b>').map(token => token.kind)).to.deep.equal(['open', 'text', 'close']);
53
- });
54
- it('treats a bare < as text', () => {
55
- expect(tokenizeHtml('5 < 6 and 7 > 2')).to.deep.equal([{
56
- kind: 'text',
57
- text: '5 < 6 and 7 > 2'
58
- }]);
59
- });
60
- it('takes script content as literal text, not markup', () => {
61
- expect(tokenizeHtml('<script>if (a<b) x()</script>').map(token => token.kind)).to.deep.equal(['open', 'text', 'close']);
62
- });
63
- // scanning for the first > would cut this tag short and build a tree the
64
- // browser disagrees with
65
- it('does not end a tag at a > inside a quoted attribute value', () => {
66
- const [token] = tokenizeHtml('<a title="a > b" href="/x">');
67
- expect(token?.kind === 'open' && token.attributes).to.deep.equal({
68
- title: 'a > b',
69
- href: '/x'
70
- });
71
- });
72
- });
73
- describe('parseHtml()', ({
74
- it
75
- }) => {
76
- it('returns null for empty and non-string input', () => {
77
- expect(parseHtml('')).to.equal(null);
78
- // eslint-disable-next-line no-type-assertion/no-type-assertion
79
- expect(parseHtml(undefined)).to.equal(null);
80
- });
81
- it('builds an element tree with decoded text', async () => {
82
- const content = parseHtml('<p>Bonus &pound;100</p>');
83
- // eslint-disable-next-line no-type-assertion/no-type-assertion
84
- const node = content;
85
- expect(node[$type]).to.equal('p');
86
- expect(node[$props].children).to.equal('Bonus £100');
87
- });
88
- it('maps class to className and style to css, which the renderer expects', async () => {
89
- expect(await roundTrip('<p class="a b" style="color: red">x</p>')).to.equal('<p class="a b" style="color: red">x</p>');
90
- });
91
- it('keeps sibling paragraphs as siblings rather than nesting them', async () => {
92
- expect(await roundTrip('<p>one</p><p>two</p>')).to.equal('<p>one</p><p>two</p>');
93
- });
94
- // The rule that broke the dashboard: a browser closes an open <p> at the
95
- // next block-level start tag, so the parser must too, or the tree and the
96
- // DOM disagree and hydration walks off the end.
97
- it('applies the implied end tag that closes a p at a block element', async () => {
98
- expect(await roundTrip('<p>one<div>two</div>')).to.equal('<p>one</p><div>two</div>');
99
- });
100
- it('closes list items and table cells implicitly', async () => {
101
- expect(await roundTrip('<ul><li>a<li>b</ul>')).to.equal('<ul><li>a</li><li>b</li></ul>');
102
- expect(await roundTrip('<table><tbody><tr><td>a<td>b</tbody></table>')).to.equal('<table><tbody><tr><td>a</td><td>b</td></tr></tbody></table>');
103
- });
104
- // Parsers disagree over whether whitespace survives inside a table, so the
105
- // markup carries none — the tree and the DOM then agree either way.
106
- it('drops whitespace between table tags', async () => {
107
- expect(await roundTrip('<table>\n<tbody>\n<tr><td>a</td></tr>\n</tbody>\n</table>')).to.equal('<table><tbody><tr><td>a</td></tr></tbody></table>');
108
- });
109
- it('foster-parents real text out to just before the table', async () => {
110
- expect(await roundTrip('<table><tbody>stray<tr><td>a</td></tr></tbody></table>')).to.equal('stray<table><tbody><tr><td>a</td></tr></tbody></table>');
111
- });
112
- it('leaves stray text alone in lists and selects, which do not relocate it', async () => {
113
- expect(await roundTrip('<ul>loose<li>a</li></ul>')).to.equal('<ul>loose<li>a</li></ul>');
114
- });
115
- it('handles void and self-closing elements', async () => {
116
- expect(await roundTrip('<p>a<br>b<img src="/x" />c</p>')).to.equal('<p>a<br />b<img src="/x" />c</p>');
117
- });
118
- });
119
- describe('parseHtml() resilience', ({
120
- it
121
- }) => {
122
- // "Safe" here means it always produces something renderable, whatever it
123
- // is handed. None of these may throw.
124
- const malformed = ['<p>unclosed', '</p>stray end tag', '<p><b>crossed</p></b>', '<<>><p>x</p>', '<p class="unterminated>x</p>', '<!-- never closed', '<p', '<>', '<p><p><p><p>deep', '&&&;&#;&#x;', '<div><span></div></span>', '<TABLE><TR><TD>caps</TD></TR></TABLE>'];
125
- for (const html of malformed) {
126
- it(`does not throw on ${JSON.stringify(html)}`, async () => {
127
- const content = parseHtml(html);
128
- const rendered = await render(content);
129
- expect(rendered).to.be.a('string');
130
- });
131
- }
132
- it('keeps the text of an unclosed element', async () => {
133
- expect(await roundTrip('<p>unclosed')).to.equal('<p>unclosed</p>');
134
- });
135
- it('ignores a stray end tag but keeps its text', async () => {
136
- expect(await roundTrip('</p>after')).to.equal('after');
137
- });
138
- });
139
- describe('parseHtml() sanitizing', ({
140
- it
141
- }) => {
142
- it('drops script elements together with their contents', async () => {
143
- expect(await roundTrip('<p>a</p><script>alert(1)</script><p>b</p>')).to.equal('<p>a</p><p>b</p>');
144
- });
145
- it('drops on* handler attributes', async () => {
146
- expect(await roundTrip('<p onclick="alert(1)" onerror="x()" title="keep">a</p>')).to.equal('<p title="keep">a</p>');
147
- });
148
- it('drops javascript: urls, including obfuscated ones', async () => {
149
- expect(await roundTrip('<a href="javascript:alert(1)">x</a>')).to.equal('<a>x</a>');
150
- expect(await roundTrip('<a href=" JaVaScRiPt:alert(1)">x</a>')).to.equal('<a>x</a>');
151
- // browsers ignore control characters inside the scheme, so this runs
152
- expect(await roundTrip('<a href="java\tscript:alert(1)">x</a>')).to.equal('<a>x</a>');
153
- expect(await roundTrip('<a href="vbscript:x">x</a>')).to.equal('<a>x</a>');
154
- expect(await roundTrip('<a href="/safe">x</a>')).to.equal('<a href="/safe">x</a>');
155
- expect(await roundTrip('<a href="https://x.test/">x</a>')).to.equal('<a href="https://x.test/">x</a>');
156
- });
157
- it('bars data: urls from navigation but allows them as image sources', async () => {
158
- expect(await roundTrip('<a href="data:text/html,hello">x</a>')).to.equal('<a>x</a>');
159
- expect(await roundTrip('<img src="data:image/png;base64,AAAA" />')).to.equal('<img src="data:image/png;base64,AAAA" />');
160
- });
161
- it('keeps handler attributes out even when sanitizing is off', async () => {
162
- // Tungsten reads on* props as event listeners, so a string there is a
163
- // hydration fault, not just a security question.
164
- const content = parseHtml('<p onclick="alert(1)">a</p>', {
165
- sanitize: false
166
- });
167
- expect(await render(content)).to.equal('<p>a</p>');
168
- });
169
- it('keeps scripts when sanitizing is turned off', async () => {
170
- const content = parseHtml('<div><script>x()</script></div>', {
171
- sanitize: false
172
- });
173
- expect(await render(content)).to.equal('<div><script>x()</script></div>');
174
- });
175
- });
176
- describe('parseHtml() allow lists', ({
177
- it
178
- }) => {
179
- const withList = (html, allowList) => render(parseHtml(html, {
180
- allowList
181
- }));
182
- const onlyEmphasis = {
183
- tags: ['p', 'em'],
184
- attributes: []
185
- };
186
- it('keeps listed tags and unwraps unlisted ones, preserving their text', async () => {
187
- expect(await withList('<p>keep <em>this</em> and <b>that</b></p>', onlyEmphasis)).to.equal('<p>keep <em>this</em> and that</p>');
188
- });
189
- it('unwraps an unlisted element without losing its listed descendants', async () => {
190
- expect(await withList('<div><p>inner</p></div>', onlyEmphasis)).to.equal('<p>inner</p>');
191
- });
192
- it('drops program-text elements entirely rather than unwrapping them', async () => {
193
- // unwrapping <style> would put its CSS on the page as visible text
194
- expect(await withList('<p>a</p><style>p { color: red }</style>', onlyEmphasis)).to.equal('<p>a</p>');
195
- });
196
- it('keeps only listed attributes', async () => {
197
- const list = {
198
- tags: ['p'],
199
- attributes: ['title']
200
- };
201
- expect(await withList('<p title="t" id="i" data-x="1">a</p>', list)).to.equal('<p title="t">a</p>');
202
- });
203
- it('applies per-tag attributes only to their own tag', async () => {
204
- const list = {
205
- tags: ['a', 'p'],
206
- attributes: [],
207
- tagAttributes: {
208
- a: ['href']
209
- }
210
- };
211
- expect(await withList('<a href="/x">link</a><p href="/y">para</p>', list)).to.equal('<a href="/x">link</a><p>para</p>');
212
- });
213
- });
214
- describe('safeHtmlAllowList', ({
215
- it
216
- }) => {
217
- const safely = html => render(parseHtml(html, {
218
- allowList: safeHtmlAllowList
219
- }));
220
- it('keeps ordinary authored rich text intact', async () => {
221
- const html = '<h2>Title</h2><p>Some <strong>bold</strong> and <em>italic</em>.</p>' + '<ul><li>one</li><li>two</li></ul>';
222
- expect(await safely(html)).to.equal(html);
223
- });
224
- it('keeps tables with their layout attributes', async () => {
225
- const html = '<table><tbody><tr><th align="left">H</th><td colspan="2">C</td></tr></tbody></table>';
226
- expect(await safely(html)).to.equal(html);
227
- });
228
- it('keeps links and images with their own attributes', async () => {
229
- expect(await safely('<a href="/x" target="_blank" rel="noopener">go</a>')).to.equal('<a href="/x" target="_blank" rel="noopener">go</a>');
230
- expect(await safely('<img src="/a.png" alt="a" width="10" />')).to.equal('<img src="/a.png" alt="a" width="10" />');
231
- });
232
- it('strips style attributes, which can disguise the page without any script', async () => {
233
- expect(await safely('<p style="position:fixed;top:0">a</p>')).to.equal('<p>a</p>');
234
- });
235
- it('removes embedding and form elements but keeps their text', async () => {
236
- expect(await safely('<iframe src="//evil"></iframe><p>a</p>')).to.equal('<p>a</p>');
237
- expect(await safely('<form><p>a</p></form>')).to.equal('<p>a</p>');
238
- });
239
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getFunctionBodyAsString.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFunctionBodyAsString.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/getFunctionBodyAsString.sxyt.ts"],"names":[],"mappings":""}
@@ -1,37 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { should as setupShould } from 'chai';
3
- const should = setupShould(); // eslint-disable-line @typescript-eslint/no-unused-vars
4
- import { getFunctionBodyAsString } from "./getFunctionBodyAsString.js";
5
- describe('getFunctionBodyAsString()', ({
6
- it
7
- }) => {
8
- it('should return the function body of a conventional function as a string', () => {
9
- const func = function () {
10
- return 'Hello World';
11
- };
12
- const body = getFunctionBodyAsString(func);
13
- //console.log('body', body)
14
- body.should.equal('return \'Hello World\';');
15
- });
16
- it('should handle multi line conventional functions', () => {
17
- const func = function () {
18
- return 'Hello World';
19
- };
20
- const body = getFunctionBodyAsString(func);
21
- //console.log('body', body)
22
- body.should.equal('return \'Hello World\';');
23
- });
24
- it('should return the function body of a braceless arrow function as a string', () => {
25
- const func = () => 'Hello World';
26
- const body = getFunctionBodyAsString(func);
27
- //console.log('body', body)
28
- body.should.equal('return \'Hello World\';');
29
- });
30
- it('should handle multi line braceless arrow functions', () => {
31
- const func = () => 'Hello' + ' World';
32
- const body = getFunctionBodyAsString(func);
33
- //console.log('body', body)
34
- body.should.equal('return \'Hello\' + \' World\';');
35
- //body.should.equal('return \'Hello\'\n+ \' World\';')
36
- });
37
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=processHead.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processHead.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/processHead.sxyt.ts"],"names":[],"mappings":""}
@@ -1,93 +0,0 @@
1
- import { expect } from 'chai';
2
- import { Window } from 'happy-dom';
3
- import { describe } from 'sxy-test-runner';
4
- import { processHead } from "./processHead.js";
5
- import { $props, $type } from "../contentNodeSymbols.js";
6
- import { Instance } from "../Instance/Instance.js";
7
- import { initStores } from "../Servers/initStores.js";
8
- import { UpdateScheduler } from "../update/UpdateScheduler.js";
9
- function makeHeadData(hmr) {
10
- const location = '/';
11
- const globalData = {};
12
- const matchedRouteInfo = {
13
- key: null,
14
- params: {},
15
- content: null
16
- };
17
- const {
18
- internalStore,
19
- stores,
20
- storeSubscriptions
21
- } = initStores(location, null, globalData, matchedRouteInfo);
22
- const instanceConfig = {
23
- prod: false,
24
- useRootComponent: true,
25
- clientSideNav: false,
26
- siteBasePath: '/',
27
- staticSite: false
28
- };
29
- const emptyRoutes = {}; // eslint-disable-line no-type-assertion/no-type-assertion -- not exercised by this test
30
- const window = new Window();
31
- const document = window.document; // eslint-disable-line no-type-assertion/no-type-assertion -- happy-dom's Document is structurally compatible
32
- const scheduler = new UpdateScheduler();
33
- // navigation: false sidesteps Instance's popstate listener setup, which reaches for the
34
- // process-wide `window` global when no runtimeContext is given at all - see hydrate.sxyt.tsx
35
- const instance = new Instance(location, instanceConfig, null, emptyRoutes, emptyRoutes,
36
- // eslint-disable-line no-type-assertion/no-type-assertion
37
- internalStore, stores, storeSubscriptions, globalData, matchedRouteInfo, {
38
- document,
39
- window: document.defaultView,
40
- scheduler,
41
- navigation: false
42
- });
43
- return {
44
- found: false,
45
- instance,
46
- clientImportAliases: {},
47
- importAliases: {},
48
- compilationLocation: '',
49
- dev: true,
50
- tungstenPublicEnv: undefined,
51
- siteBasePath: '',
52
- hmr
53
- };
54
- }
55
- function reloadScriptText(headNode) {
56
- const children = headNode[$props].children ?? [];
57
- const scripts = children.filter(node => node[$type] === 'script');
58
- const reloadScript = scripts.find(node => typeof node[$props].children === 'string' && node[$props].children.includes('__tungsten_live_reload__'));
59
- return reloadScript?.[$props].children; // eslint-disable-line no-type-assertion/no-type-assertion -- narrowed by the find() predicate above
60
- }
61
- describe('processHead() - hmr config option', ({
62
- it
63
- }) => {
64
- it('injects the full Tier 2 hot-swap script when hmr is true', () => {
65
- const headNode = {
66
- [$type]: 'head',
67
- [$props]: {}
68
- };
69
- processHead(headNode, makeHeadData(true));
70
- const script = reloadScriptText(headNode);
71
- expect(script).to.contain('applyHmrModule');
72
- expect(script).to.contain('refreshStylesheets');
73
- });
74
- it(`injects only the Tier 1 always-full-reload script when hmr is 'reload'`, () => {
75
- const headNode = {
76
- [$type]: 'head',
77
- [$props]: {}
78
- };
79
- processHead(headNode, makeHeadData('reload'));
80
- const script = reloadScriptText(headNode);
81
- expect(script).to.not.contain('applyHmrModule');
82
- expect(script).to.not.contain('refreshStylesheets');
83
- expect(script).to.contain('location.reload()');
84
- });
85
- it('injects no live-reload script at all when hmr is false', () => {
86
- const headNode = {
87
- [$type]: 'head',
88
- [$props]: {}
89
- };
90
- processHead(headNode, makeHeadData(false));
91
- expect(reloadScriptText(headNode)).to.equal(undefined);
92
- });
93
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=processProps.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processProps.sxyt.d.ts","sourceRoot":"","sources":["../../src/render/processProps.sxyt.ts"],"names":[],"mappings":""}
@@ -1,90 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { processProps } from "./processProps.js";
4
- import { htmlEvents } from "../htmlEvents.js";
5
- describe('processProps()', ({
6
- it
7
- }) => {
8
- it('keeps ordinary attributes', () => {
9
- expect(processProps({
10
- name: 'a',
11
- title: 't',
12
- 'data-x': '1'
13
- })).to.deep.equal({
14
- name: 'a',
15
- title: 't',
16
- 'data-x': '1'
17
- });
18
- });
19
- // The list of handlers used to be written out by hand and missed most of
20
- // them, so anything not named leaked into the markup as an attribute
21
- // holding a stringified function.
22
- it('strips every event handler Tungsten recognises, not a hand-picked few', () => {
23
- const handlers = Object.fromEntries(Object.keys(htmlEvents).map(name => [name, () => undefined]));
24
- expect(processProps({
25
- ...handlers,
26
- name: 'a'
27
- })).to.deep.equal({
28
- name: 'a'
29
- });
30
- });
31
- it('strips the handlers that were missing from the old list', () => {
32
- const kept = processProps({
33
- onInput: () => undefined,
34
- onFocus: () => undefined,
35
- onBlur: () => undefined,
36
- onScroll: () => undefined,
37
- onPaste: () => undefined,
38
- name: 'a'
39
- });
40
- expect(Object.keys(kept)).to.deep.equal(['name']);
41
- });
42
- it('strips props that are instructions to Tungsten rather than attributes', () => {
43
- const kept = processProps({
44
- ref: {
45
- current: null
46
- },
47
- __zoneHtml: '<b>x</b>',
48
- __opaque: true,
49
- dangerouslySetInnerHTML: {
50
- __html: '<b>x</b>'
51
- },
52
- name: 'a'
53
- });
54
- expect(Object.keys(kept)).to.deep.equal(['name']);
55
- });
56
- it('renames className to class', () => {
57
- expect(processProps({
58
- className: 'a b'
59
- })).to.deep.equal({
60
- class: 'a b'
61
- });
62
- // a raw class prop is dropped; className is the one that reaches HTML
63
- expect(processProps({
64
- class: 'ignored'
65
- })).to.deep.equal({});
66
- });
67
- it('turns a style object into a css string', () => {
68
- expect(processProps({
69
- style: {
70
- backgroundColor: 'red'
71
- }
72
- }).style).to.equal('background-color: red;');
73
- });
74
- it('folds css into style and does not leave css behind as an attribute', () => {
75
- const kept = processProps({
76
- css: 'color: red'
77
- });
78
- expect(kept.style).to.equal('color: red');
79
- expect('css' in kept).to.equal(false);
80
- });
81
- it('does not mutate the props it is given', () => {
82
- const props = {
83
- className: 'a',
84
- onClick: () => undefined,
85
- name: 'n'
86
- };
87
- processProps(props);
88
- expect(Object.keys(props).sort()).to.deep.equal(['className', 'name', 'onClick']);
89
- });
90
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=compareRequestToRegex.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compareRequestToRegex.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/compareRequestToRegex.sxyt.ts"],"names":[],"mappings":""}
@@ -1,65 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { objects } from 'sxy-lib';
4
- import { compareRequestToRegex } from "./compareRequestToRegex.js";
5
- import { patternToRegex } from "./patternToRegex.js";
6
- describe('routing/compareRequestToRegex()', ({
7
- it
8
- }) => {
9
- it(`/foo matches /foo no params`, () => {
10
- const pattern = '/foo';
11
- const request = '/foo';
12
- const {
13
- regex,
14
- keys
15
- } = patternToRegex(pattern);
16
- const {
17
- success,
18
- params
19
- } = compareRequestToRegex(request, regex, keys);
20
- success.should.equal(true);
21
- objects.count(params).should.equal(0);
22
- });
23
- it(`/foo does not match /foo/bar`, () => {
24
- const pattern = '/foo';
25
- const request = '/foo/bar';
26
- const {
27
- regex,
28
- keys
29
- } = patternToRegex(pattern);
30
- const {
31
- success,
32
- params
33
- } = compareRequestToRegex(request, regex, keys); // eslint-disable-line @typescript-eslint/no-unused-vars
34
- success.should.equal(false);
35
- });
36
- it(`/foo/:bar matches /foo/bing with the params { bar: 'bing' }"`, () => {
37
- const pattern = '/foo/:bar';
38
- const request = '/foo/bing';
39
- const {
40
- regex,
41
- keys
42
- } = patternToRegex(pattern);
43
- const c = compareRequestToRegex(request, regex, keys);
44
- const {
45
- success,
46
- params
47
- } = c;
48
- success.should.equal(true);
49
- objects.count(params).should.equal(1);
50
- expect(params.bar).to.equal('bing');
51
- });
52
- it(`/foo/:bar does not match /foo/"`, () => {
53
- const pattern = '/foo/:bar';
54
- const request = '/foo/';
55
- const {
56
- regex,
57
- keys
58
- } = patternToRegex(pattern);
59
- const {
60
- success,
61
- params
62
- } = compareRequestToRegex(request, regex, keys); // eslint-disable-line @typescript-eslint/no-unused-vars
63
- success.should.equal(false);
64
- });
65
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=getPathPriority.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getPathPriority.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/getPathPriority.sxyt.ts"],"names":[],"mappings":""}
@@ -1,24 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { getPathPriority } from "./getPathPriority.js";
3
- describe('routing/compareRequestToRegex()', ({
4
- it
5
- }) => {
6
- it(`/foo returns priority 2`, () => {
7
- const pattern = '/foo';
8
- const priority = getPathPriority(pattern);
9
- //console.log('priority', priority)
10
- priority.should.equal(2);
11
- });
12
- it(`/foo/:bar/foo returns priority 212`, () => {
13
- const pattern = '/foo/:bar/foo';
14
- const priority = getPathPriority(pattern);
15
- //console.log('priority', priority)
16
- priority.should.equal(212);
17
- });
18
- it(`/foo/:bar([^\\/])/foo returns priority 212`, () => {
19
- const pattern = '/foo/:bar([^\\/])/foo';
20
- const priority = getPathPriority(pattern);
21
- //console.log('priority', priority)
22
- priority.should.equal(212);
23
- });
24
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=matchPath.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"matchPath.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/matchPath.sxyt.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- import { describe } from 'sxy-test-runner';
2
- import { expect } from 'chai';
3
- import { matchPath } from "./matchPath.js";
4
- describe('routing/matchPath()', ({
5
- it
6
- }) => {
7
- it(`returns null for /foo against /bar`, () => {
8
- expect(matchPath('/foo', '/bar')).to.equal(null);
9
- });
10
- it(`returns match object for /foo against /foo`, () => {
11
- const match = matchPath('/foo', '/foo');
12
- expect(match).not.to.equal(null);
13
- });
14
- it(`returns match object for /foo/ against /foo`, () => {
15
- const match = matchPath('/foo/', '/foo');
16
- expect(match).not.to.equal(null);
17
- });
18
- it(`matches /foo when the request has a query string`, () => {
19
- const match = matchPath('/foo', '/foo?bar=1');
20
- expect(match).not.to.equal(null);
21
- expect(match.query).to.deep.equal({
22
- bar: '1'
23
- });
24
- expect(match.pathname).to.equal('/foo');
25
- });
26
- it(`matches /foo when the request has a hash fragment`, () => {
27
- const match = matchPath('/foo', '/foo#section');
28
- expect(match).not.to.equal(null);
29
- expect(match.hash).to.equal('section');
30
- });
31
- it(`matches a dynamic route with a query string and captures the param`, () => {
32
- const match = matchPath('/leads/:id/details', '/leads/5/details?queue=1');
33
- expect(match).not.to.equal(null);
34
- expect(match.params).to.deep.equal({
35
- id: '5'
36
- });
37
- expect(match.query).to.deep.equal({
38
- queue: '1'
39
- });
40
- });
41
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=patternToRegex.sxyt.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patternToRegex.sxyt.d.ts","sourceRoot":"","sources":["../../src/routing/patternToRegex.sxyt.ts"],"names":[],"mappings":""}