tungsten 0.3.2 → 0.3.3

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 (278) hide show
  1. package/dist/.build-complete +1 -0
  2. package/dist/Framework.d.ts +2 -0
  3. package/dist/Framework.d.ts.map +1 -1
  4. package/dist/Framework.js +68 -57
  5. package/dist/FrameworkConfig.d.ts +2 -0
  6. package/dist/FrameworkConfig.d.ts.map +1 -1
  7. package/dist/Instance/Instance.d.ts.map +1 -1
  8. package/dist/Instance/Instance.js +18 -1
  9. package/dist/Instance/InstanceConfig.d.ts +1 -0
  10. package/dist/Instance/InstanceConfig.d.ts.map +1 -1
  11. package/dist/PopMessage.type.d.ts +6 -0
  12. package/dist/PopMessage.type.d.ts.map +1 -0
  13. package/dist/PopMessage.type.js +1 -0
  14. package/dist/Servers/DevServer.d.ts +2 -0
  15. package/dist/Servers/DevServer.d.ts.map +1 -1
  16. package/dist/Servers/DevServer.js +84 -8
  17. package/dist/Servers/MatchedRouteInfo.d.ts +1 -1
  18. package/dist/Servers/MatchedRouteInfo.d.ts.map +1 -1
  19. package/dist/Servers/ProdServer.d.ts +1 -0
  20. package/dist/Servers/ProdServer.d.ts.map +1 -1
  21. package/dist/Servers/ProdServer.js +79 -5
  22. package/dist/Servers/hono/DevServerHono.js +25 -29
  23. package/dist/Servers/hono/ProdServerHono.js +49 -142
  24. package/dist/Servers/hono/TungstenServerHono.d.ts +1 -1
  25. package/dist/Servers/hono/TungstenServerHono.d.ts.map +1 -1
  26. package/dist/Servers/hono/TungstenServerHono.js +12 -29
  27. package/dist/Servers/routing.d.ts.map +1 -1
  28. package/dist/Servers/routing.js +10 -6
  29. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts +0 -3
  30. package/dist/Servers/tungstenCorePrivateEnvSchema.d.ts.map +1 -1
  31. package/dist/Servers/tungstenCorePrivateEnvSchema.js +3 -3
  32. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts +8 -0
  33. package/dist/Servers/tungstenCorePublicEnvSchema.d.ts.map +1 -0
  34. package/dist/Servers/tungstenCorePublicEnvSchema.js +14 -0
  35. package/dist/Store/InternalStoreSchema.d.ts +2 -0
  36. package/dist/Store/InternalStoreSchema.d.ts.map +1 -1
  37. package/dist/Store/InternalStoreSchema.js +1 -0
  38. package/dist/api/Request.d.ts +1 -1
  39. package/dist/api/Request.d.ts.map +1 -1
  40. package/dist/api/Response.d.ts +1 -1
  41. package/dist/api/Response.d.ts.map +1 -1
  42. package/dist/babelPlugins/BabelTypes.d.ts +2 -2
  43. package/dist/babelPlugins/BabelTypes.d.ts.map +1 -1
  44. package/dist/babelPlugins/BabelTypes.js +0 -1
  45. package/dist/bin/commands/build.d.ts.map +1 -1
  46. package/dist/bin/commands/build.js +3 -0
  47. package/dist/bin/commands/dev.d.ts.map +1 -1
  48. package/dist/bin/commands/dev.js +15 -4
  49. package/dist/bin/commands/devmon.d.ts +2 -0
  50. package/dist/bin/commands/devmon.d.ts.map +1 -0
  51. package/dist/bin/commands/devmon.js +66 -0
  52. package/dist/bin/index.d.ts.map +1 -1
  53. package/dist/bin/index.js +6 -0
  54. package/dist/booleanAttributeValue.d.ts +21 -0
  55. package/dist/booleanAttributeValue.d.ts.map +1 -0
  56. package/dist/booleanAttributeValue.js +23 -0
  57. package/dist/build/compileJavascript.js +1 -1
  58. package/dist/build/compileUserApp.d.ts +2 -1
  59. package/dist/build/compileUserApp.d.ts.map +1 -1
  60. package/dist/build/compileUserApp.js +8 -7
  61. package/dist/build/createInstanceConfigFile.js +1 -1
  62. package/dist/compat/types.d.ts +1 -1
  63. package/dist/compat/types.d.ts.map +1 -1
  64. package/dist/components/PopMessages.d.ts +12 -0
  65. package/dist/components/PopMessages.d.ts.map +1 -0
  66. package/dist/components/PopMessages.js +45 -0
  67. package/dist/defaultConfig.d.ts +1 -0
  68. package/dist/defaultConfig.d.ts.map +1 -1
  69. package/dist/defaultConfig.js +2 -1
  70. package/dist/env/Interfaces.d.ts +2 -1
  71. package/dist/env/Interfaces.d.ts.map +1 -1
  72. package/dist/env/getEnvSchemas.d.ts +1 -1
  73. package/dist/env/getEnvSchemas.d.ts.map +1 -1
  74. package/dist/env/publicEnv.d.ts.map +1 -1
  75. package/dist/env/publicEnv.js +4 -1
  76. package/dist/frameworkConfigSchema.d.ts +4 -0
  77. package/dist/frameworkConfigSchema.d.ts.map +1 -1
  78. package/dist/frameworkConfigSchema.js +2 -1
  79. package/dist/hooks/index.d.ts +1 -0
  80. package/dist/hooks/index.d.ts.map +1 -1
  81. package/dist/hooks/index.js +1 -0
  82. package/dist/hooks/useInstance.d.ts +3 -0
  83. package/dist/hooks/useInstance.d.ts.map +1 -0
  84. package/dist/hooks/useInstance.js +4 -0
  85. package/dist/hydrate/hydrate.d.ts +6 -4
  86. package/dist/hydrate/hydrate.d.ts.map +1 -1
  87. package/dist/hydrate/hydrate.js +51 -13
  88. package/dist/hydrate/reconcileHydratedAttributes.d.ts.map +1 -1
  89. package/dist/hydrate/reconcileHydratedAttributes.js +4 -3
  90. package/dist/hydrate/renderHydrationMismatchBanner.d.ts +7 -0
  91. package/dist/hydrate/renderHydrationMismatchBanner.d.ts.map +1 -0
  92. package/dist/hydrate/renderHydrationMismatchBanner.js +69 -0
  93. package/dist/indexInner.d.ts +8 -0
  94. package/dist/indexInner.d.ts.map +1 -1
  95. package/dist/indexInner.js +7 -1
  96. package/dist/makeInstanceConfigFromFrameworkConfig.d.ts.map +1 -1
  97. package/dist/makeInstanceConfigFromFrameworkConfig.js +2 -1
  98. package/dist/pop.d.ts +10 -0
  99. package/dist/pop.d.ts.map +1 -0
  100. package/dist/pop.js +49 -0
  101. package/dist/rawHtml/filterContentNode.d.ts +20 -0
  102. package/dist/rawHtml/filterContentNode.d.ts.map +1 -0
  103. package/dist/rawHtml/filterContentNode.js +96 -0
  104. package/dist/rawHtml/parseHtml.d.ts +14 -0
  105. package/dist/rawHtml/parseHtml.d.ts.map +1 -1
  106. package/dist/rawHtml/parseHtml.js +4 -4
  107. package/dist/rawHtml/sanitizeHtml.d.ts +17 -0
  108. package/dist/rawHtml/sanitizeHtml.d.ts.map +1 -0
  109. package/dist/rawHtml/sanitizeHtml.js +19 -0
  110. package/dist/render/HeadData.d.ts +1 -0
  111. package/dist/render/HeadData.d.ts.map +1 -1
  112. package/dist/render/contentNodeToHtml.d.ts +18 -0
  113. package/dist/render/contentNodeToHtml.d.ts.map +1 -0
  114. package/dist/render/contentNodeToHtml.js +66 -0
  115. package/dist/render/contentToHtml.d.ts.map +1 -1
  116. package/dist/render/contentToHtml.js +2 -1
  117. package/dist/render/processHead.d.ts.map +1 -1
  118. package/dist/render/processHead.js +8 -2
  119. package/dist/render/renderingTreeToHtml.d.ts.map +1 -1
  120. package/dist/render/renderingTreeToHtml.js +8 -1
  121. package/dist/routing/ErrorRouteType.d.ts +6 -0
  122. package/dist/routing/ErrorRouteType.d.ts.map +1 -0
  123. package/dist/routing/ErrorRouteType.js +1 -0
  124. package/dist/routing/RouteTypes.d.ts +2 -1
  125. package/dist/routing/RouteTypes.d.ts.map +1 -1
  126. package/dist/routing/Routes.d.ts +5 -0
  127. package/dist/routing/Routes.d.ts.map +1 -1
  128. package/dist/routing/TungstenErrorInfo.d.ts +6 -0
  129. package/dist/routing/TungstenErrorInfo.d.ts.map +1 -0
  130. package/dist/routing/TungstenErrorInfo.js +6 -0
  131. package/dist/style/styleContentSxy.js +21 -0
  132. package/dist/testing/hydrateTestApp.d.ts +38 -0
  133. package/dist/testing/hydrateTestApp.d.ts.map +1 -0
  134. package/dist/testing/hydrateTestApp.js +242 -0
  135. package/dist/testing/index.d.ts +4 -3
  136. package/dist/testing/index.d.ts.map +1 -1
  137. package/dist/testing/index.js +16 -2
  138. package/dist/timeProfiler.d.ts +6 -0
  139. package/dist/timeProfiler.d.ts.map +1 -0
  140. package/dist/timeProfiler.js +31 -0
  141. package/dist/update/integrateUpdateVdom.d.ts +11 -0
  142. package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
  143. package/dist/update/integrateUpdateVdom.js +9 -3
  144. package/dist/warnOnFrameworkChange.d.ts.map +1 -1
  145. package/dist/warnOnFrameworkChange.js +8 -8
  146. package/package.json +18 -16
  147. package/dist/FunctionComponentStandIn.sxyt.d.ts +0 -2
  148. package/dist/FunctionComponentStandIn.sxyt.d.ts.map +0 -1
  149. package/dist/FunctionComponentStandIn.sxyt.js +0 -52
  150. package/dist/Instance/gotoRedirect.sxyt.d.ts +0 -2
  151. package/dist/Instance/gotoRedirect.sxyt.d.ts.map +0 -1
  152. package/dist/Instance/gotoRedirect.sxyt.js +0 -148
  153. package/dist/Instance/runTrackedWork.sxyt.d.ts +0 -2
  154. package/dist/Instance/runTrackedWork.sxyt.d.ts.map +0 -1
  155. package/dist/Instance/runTrackedWork.sxyt.js +0 -35
  156. package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts +0 -2
  157. package/dist/Servers/devErrorPageAutoRetry.sxyt.d.ts.map +0 -1
  158. package/dist/Servers/devErrorPageAutoRetry.sxyt.js +0 -117
  159. package/dist/_client/cjsHelpers.sxyt.d.ts +0 -2
  160. package/dist/_client/cjsHelpers.sxyt.d.ts.map +0 -1
  161. package/dist/_client/cjsHelpers.sxyt.js +0 -45
  162. package/dist/auth/passwordHashing.sxyt.d.ts +0 -2
  163. package/dist/auth/passwordHashing.sxyt.d.ts.map +0 -1
  164. package/dist/auth/passwordHashing.sxyt.js +0 -46
  165. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts +0 -2
  166. package/dist/auth/ref/checkPasswordResetToken.sxyt.d.ts.map +0 -1
  167. package/dist/auth/ref/checkPasswordResetToken.sxyt.js +0 -40
  168. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts +0 -2
  169. package/dist/auth/ref/createPasswordResetToken.sxyt.d.ts.map +0 -1
  170. package/dist/auth/ref/createPasswordResetToken.sxyt.js +0 -10
  171. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts +0 -2
  172. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.d.ts.map +0 -1
  173. package/dist/babelPlugins/BabelAddDevCacheBust.sxyt.js +0 -138
  174. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts +0 -2
  175. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.d.ts.map +0 -1
  176. package/dist/babelPlugins/fixImportsInSassErrorMessage.sxyt.js +0 -108
  177. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts +0 -2
  178. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.d.ts.map +0 -1
  179. package/dist/babelPlugins/transformPackageImports/resolveBareImport.sxyt.js +0 -104
  180. package/dist/bin/commands/compile.sxyt.d.ts +0 -2
  181. package/dist/bin/commands/compile.sxyt.d.ts.map +0 -1
  182. package/dist/bin/commands/compile.sxyt.js +0 -255
  183. package/dist/build/modifySassImports.sxyt.d.ts +0 -2
  184. package/dist/build/modifySassImports.sxyt.d.ts.map +0 -1
  185. package/dist/build/modifySassImports.sxyt.js +0 -55
  186. package/dist/build/sassImportParser.sxyt.d.ts +0 -2
  187. package/dist/build/sassImportParser.sxyt.d.ts.map +0 -1
  188. package/dist/build/sassImportParser.sxyt.js +0 -110
  189. package/dist/build/scssImportParserChatgpt.sxyt.d.ts +0 -2
  190. package/dist/build/scssImportParserChatgpt.sxyt.d.ts.map +0 -1
  191. package/dist/build/scssImportParserChatgpt.sxyt.js +0 -120
  192. package/dist/clone.sxyt.d.ts +0 -2
  193. package/dist/clone.sxyt.d.ts.map +0 -1
  194. package/dist/clone.sxyt.js +0 -24
  195. package/dist/componentProxyHandlers.sxyt.d.ts +0 -2
  196. package/dist/componentProxyHandlers.sxyt.d.ts.map +0 -1
  197. package/dist/componentProxyHandlers.sxyt.js +0 -130
  198. package/dist/components/RawHtml.sxyt.d.ts +0 -2
  199. package/dist/components/RawHtml.sxyt.d.ts.map +0 -1
  200. package/dist/components/RawHtml.sxyt.js +0 -104
  201. package/dist/components/bindable/BindableSelect.sxyt.d.ts +0 -2
  202. package/dist/components/bindable/BindableSelect.sxyt.d.ts.map +0 -1
  203. package/dist/components/bindable/BindableSelect.sxyt.js +0 -186
  204. package/dist/env/injectEnv.sxyt.d.ts +0 -2
  205. package/dist/env/injectEnv.sxyt.d.ts.map +0 -1
  206. package/dist/env/injectEnv.sxyt.js +0 -20
  207. package/dist/env/parseEnv.sxyt.d.ts +0 -2
  208. package/dist/env/parseEnv.sxyt.d.ts.map +0 -1
  209. package/dist/env/parseEnv.sxyt.js +0 -11
  210. package/dist/findProjectDir.sxyt.d.ts +0 -2
  211. package/dist/findProjectDir.sxyt.d.ts.map +0 -1
  212. package/dist/findProjectDir.sxyt.js +0 -82
  213. package/dist/hmr/applyHmrModule.sxyt.d.ts +0 -2
  214. package/dist/hmr/applyHmrModule.sxyt.d.ts.map +0 -1
  215. package/dist/hmr/applyHmrModule.sxyt.js +0 -182
  216. package/dist/hmr/instanceRegistry.sxyt.d.ts +0 -2
  217. package/dist/hmr/instanceRegistry.sxyt.d.ts.map +0 -1
  218. package/dist/hmr/instanceRegistry.sxyt.js +0 -24
  219. package/dist/hmr/refreshStylesheets.sxyt.d.ts +0 -2
  220. package/dist/hmr/refreshStylesheets.sxyt.d.ts.map +0 -1
  221. package/dist/hmr/refreshStylesheets.sxyt.js +0 -46
  222. package/dist/hydrate/hydrate.sxyt.d.ts +0 -2
  223. package/dist/hydrate/hydrate.sxyt.d.ts.map +0 -1
  224. package/dist/hydrate/hydrate.sxyt.js +0 -302
  225. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts +0 -2
  226. package/dist/hydrate/reconcileHydratedAttributes.sxyt.d.ts.map +0 -1
  227. package/dist/hydrate/reconcileHydratedAttributes.sxyt.js +0 -190
  228. package/dist/importDevModuleWithRetry.sxyt.d.ts +0 -2
  229. package/dist/importDevModuleWithRetry.sxyt.d.ts.map +0 -1
  230. package/dist/importDevModuleWithRetry.sxyt.js +0 -104
  231. package/dist/innerHtmlFromProps.sxyt.d.ts +0 -2
  232. package/dist/innerHtmlFromProps.sxyt.d.ts.map +0 -1
  233. package/dist/innerHtmlFromProps.sxyt.js +0 -99
  234. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts +0 -2
  235. package/dist/postcssPlugins/parseSelectors.sxyt.d.ts.map +0 -1
  236. package/dist/postcssPlugins/parseSelectors.sxyt.js +0 -62
  237. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts +0 -2
  238. package/dist/postcssPlugins/parseSelectorsRich.sxyt.d.ts.map +0 -1
  239. package/dist/postcssPlugins/parseSelectorsRich.sxyt.js +0 -155
  240. package/dist/rawHtml/parseHtml.sxyt.d.ts +0 -2
  241. package/dist/rawHtml/parseHtml.sxyt.d.ts.map +0 -1
  242. package/dist/rawHtml/parseHtml.sxyt.js +0 -239
  243. package/dist/render/getFunctionBodyAsString.sxyt.d.ts +0 -2
  244. package/dist/render/getFunctionBodyAsString.sxyt.d.ts.map +0 -1
  245. package/dist/render/getFunctionBodyAsString.sxyt.js +0 -37
  246. package/dist/render/processHead.sxyt.d.ts +0 -2
  247. package/dist/render/processHead.sxyt.d.ts.map +0 -1
  248. package/dist/render/processHead.sxyt.js +0 -93
  249. package/dist/render/processProps.sxyt.d.ts +0 -2
  250. package/dist/render/processProps.sxyt.d.ts.map +0 -1
  251. package/dist/render/processProps.sxyt.js +0 -90
  252. package/dist/routing/compareRequestToRegex.sxyt.d.ts +0 -2
  253. package/dist/routing/compareRequestToRegex.sxyt.d.ts.map +0 -1
  254. package/dist/routing/compareRequestToRegex.sxyt.js +0 -65
  255. package/dist/routing/getPathPriority.sxyt.d.ts +0 -2
  256. package/dist/routing/getPathPriority.sxyt.d.ts.map +0 -1
  257. package/dist/routing/getPathPriority.sxyt.js +0 -24
  258. package/dist/routing/matchPath.sxyt.d.ts +0 -2
  259. package/dist/routing/matchPath.sxyt.d.ts.map +0 -1
  260. package/dist/routing/matchPath.sxyt.js +0 -41
  261. package/dist/routing/patternToRegex.sxyt.d.ts +0 -2
  262. package/dist/routing/patternToRegex.sxyt.d.ts.map +0 -1
  263. package/dist/routing/patternToRegex.sxyt.js +0 -69
  264. package/dist/routing/splitRequest.sxyt.d.ts +0 -2
  265. package/dist/routing/splitRequest.sxyt.d.ts.map +0 -1
  266. package/dist/routing/splitRequest.sxyt.js +0 -47
  267. package/dist/style/jssToCss.sxyt.d.ts +0 -2
  268. package/dist/style/jssToCss.sxyt.d.ts.map +0 -1
  269. package/dist/style/jssToCss.sxyt.js +0 -17
  270. package/dist/testing/createTestApp.sxyt.d.ts +0 -2
  271. package/dist/testing/createTestApp.sxyt.d.ts.map +0 -1
  272. package/dist/testing/createTestApp.sxyt.js +0 -470
  273. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts +0 -2
  274. package/dist/testing/ensureTestEnvLoaded.sxyt.d.ts.map +0 -1
  275. package/dist/testing/ensureTestEnvLoaded.sxyt.js +0 -20
  276. package/dist/update/hotSwap.sxyt.d.ts +0 -2
  277. package/dist/update/hotSwap.sxyt.d.ts.map +0 -1
  278. package/dist/update/hotSwap.sxyt.js +0 -252
@@ -22,5 +22,6 @@ export const defaultConfig = {
22
22
  suppressNoHeadWarning: false,
23
23
  suppressOriginMismatchWarning: false,
24
24
  warnOnFrameworkChange: true,
25
- hmr: true
25
+ hmr: true,
26
+ csr: false
26
27
  };
@@ -1,8 +1,9 @@
1
1
  import type { TungstenCorePrivateEnv } from '../Servers/tungstenCorePrivateEnvSchema.js';
2
+ import type { TungstenCorePublicEnv } from '../Servers/tungstenCorePublicEnvSchema.js';
2
3
  declare global {
3
4
  interface TungstenPrivateEnv extends TungstenCorePrivateEnv {
4
5
  }
5
- export interface TungstenPublicEnv {
6
+ export interface TungstenPublicEnv extends TungstenCorePublicEnv {
6
7
  }
7
8
  }
8
9
  //# sourceMappingURL=Interfaces.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../src/env/Interfaces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AAExF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,kBAAmB,SAAQ,sBAAsB;KAAG;IAC9D,MAAM,WAAW,iBAAiB;KAAG;CACxC"}
1
+ {"version":3,"file":"Interfaces.d.ts","sourceRoot":"","sources":["../../src/env/Interfaces.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AACxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAA;AAEtF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,kBAAmB,SAAQ,sBAAsB;KAAG;IAC9D,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;KAAG;CACtE"}
@@ -3,7 +3,7 @@ import { ZodType } from 'zod';
3
3
  import { TungstenEnv } from './types.js';
4
4
  export type EnvSchemas = {
5
5
  privateEnvSchema?: ZodType<TungstenEnv & TungstenPrivateEnv>;
6
- publicEnvSchema?: ZodType<TungstenEnv>;
6
+ publicEnvSchema?: ZodType<TungstenEnv & TungstenPublicEnv>;
7
7
  };
8
8
  export declare function getEnvSchemas(config: FrameworkConfigComplete, iteration: number, dev: 'dev'): Promise<EnvSchemas>;
9
9
  export declare function getEnvSchemas(config: FrameworkConfigComplete, iteration?: null, dev?: 'prod'): Promise<EnvSchemas>;
@@ -1 +1 @@
1
- {"version":3,"file":"getEnvSchemas.d.ts","sourceRoot":"","sources":["../../src/env/getEnvSchemas.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEpE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAK7B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC,MAAM,MAAM,UAAU,GAAG;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC,CAAC;IAC7D,eAAe,CAAC,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v.d.ts","sourceRoot":"","sources":["../../src/env/publicEnv.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAG/D"}
1
+ {"version":3,"file":"publicEnv.d.ts","sourceRoot":"","sources":["../../src/env/publicEnv.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAK/D"}
@@ -1,5 +1,8 @@
1
1
  import { throwError } from "../throwError.js";
2
2
  export function publicEnv(key) {
3
- if (tungstenPublicEnv === undefined) throwError('publicEnv', 'Tungsten Public Env is undefined - do you have a .env.public file?');
3
+ if (tungstenPublicEnv === undefined) {
4
+ // eslint-disable-line @typescript-eslint/no-unnecessary-condition
5
+ throwError('publicEnv', 'Tungsten Public Env is undefined - do you have a .env.public file?');
6
+ }
4
7
  return tungstenPublicEnv[key];
5
8
  }
@@ -42,6 +42,7 @@ declare const frameworkConfigWithRootComponentValidator: import("arktype/interna
42
42
  serverMiddleware?: [string, string, string];
43
43
  apiRoutes?: string;
44
44
  apiPath?: string;
45
+ csr?: boolean;
45
46
  rootComponent: string;
46
47
  useRootComponent?: true;
47
48
  }, {}>;
@@ -87,6 +88,7 @@ declare const frameworkConfigWithoutRootComponentValidator: import("arktype/inte
87
88
  serverMiddleware?: [string, string, string];
88
89
  apiRoutes?: string;
89
90
  apiPath?: string;
91
+ csr?: boolean;
90
92
  useRootComponent: false;
91
93
  }, {}>;
92
94
  export declare const frameworkConfigValidator: import("arktype/internal/variants/object.ts").ObjectType<{
@@ -131,6 +133,7 @@ export declare const frameworkConfigValidator: import("arktype/internal/variants
131
133
  serverMiddleware?: [string, string, string];
132
134
  apiRoutes?: string;
133
135
  apiPath?: string;
136
+ csr?: boolean;
134
137
  rootComponent: string;
135
138
  useRootComponent?: true;
136
139
  } | {
@@ -175,6 +178,7 @@ export declare const frameworkConfigValidator: import("arktype/internal/variants
175
178
  serverMiddleware?: [string, string, string];
176
179
  apiRoutes?: string;
177
180
  apiPath?: string;
181
+ csr?: boolean;
178
182
  useRootComponent: false;
179
183
  }, {}>;
180
184
  type ArkFrameworkConfigWithRootComponent = typeof frameworkConfigWithRootComponentValidator.infer;
@@ -1 +1 @@
1
- {"version":3,"file":"frameworkConfigSchema.d.ts","sourceRoot":"","sources":["../src/frameworkConfigSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAyDnD,QAAA,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAK7C,CAAA;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIhD,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEoB,CAAA;AAEzD,KAAK,mCAAmC,GAAG,OAAO,yCAAyC,CAAC,KAAK,CAAA;AACjG,KAAK,sCAAsC,GAAG,OAAO,4CAA4C,CAAC,KAAK,CAAA;AAIvG,UAAU,gCACN,SAAQ,IAAI,CAAC,mCAAmC,EAAE,cAAc,GAAG,cAAc,CAAC;IAClF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,UAAU,mCACN,SAAQ,IAAI,CAAC,sCAAsC,EAAE,cAAc,GAAG,cAAc,CAAC;IACrF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,MAAM,MAAM,eAAe,GAAG,gCAAgC,GAAG,mCAAmC,CAAA"}
1
+ {"version":3,"file":"frameworkConfigSchema.d.ts","sourceRoot":"","sources":["../src/frameworkConfigSchema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AA0DnD,QAAA,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAK7C,CAAA;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAIhD,CAAA;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEoB,CAAA;AAEzD,KAAK,mCAAmC,GAAG,OAAO,yCAAyC,CAAC,KAAK,CAAA;AACjG,KAAK,sCAAsC,GAAG,OAAO,4CAA4C,CAAC,KAAK,CAAA;AAIvG,UAAU,gCACN,SAAQ,IAAI,CAAC,mCAAmC,EAAE,cAAc,GAAG,cAAc,CAAC;IAClF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,UAAU,mCACN,SAAQ,IAAI,CAAC,sCAAsC,EAAE,cAAc,GAAG,cAAc,CAAC;IACrF,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,YAAY,CAAC,EAAE,kBAAkB,CAAA;CACpC;AAED,MAAM,MAAM,eAAe,GAAG,gCAAgC,GAAG,mCAAmC,CAAA"}
@@ -50,7 +50,8 @@ const frameworkConfigBaseValidator = arkType({
50
50
  'skipPackageCompilation?': 'string | string[]',
51
51
  'serverMiddleware?': ['string', 'string', 'string'],
52
52
  'apiRoutes?': 'string',
53
- 'apiPath?': 'string'
53
+ 'apiPath?': 'string',
54
+ 'csr?': 'boolean'
54
55
  });
55
56
  const frameworkConfigWithRootComponentValidator = arkType({
56
57
  '...': frameworkConfigBaseValidator,
@@ -1,4 +1,5 @@
1
1
  export * from './useCallback.js';
2
+ export * from './useInstance.js';
2
3
  export * from './useMemo.js';
3
4
  export * from './useRef.js';
4
5
  export * from './useState.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA"}
@@ -1,4 +1,5 @@
1
1
  export * from "./useCallback.js";
2
+ export * from "./useInstance.js";
2
3
  export * from "./useMemo.js";
3
4
  export * from "./useRef.js";
4
5
  export * from "./useState.js";
@@ -0,0 +1,3 @@
1
+ import type { Instance } from '../Instance/Instance.js';
2
+ export declare function useInstance(): Instance;
3
+ //# sourceMappingURL=useInstance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useInstance.d.ts","sourceRoot":"","sources":["../../src/hooks/useInstance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvD,wBAAgB,WAAW,IAAI,QAAQ,CAEtC"}
@@ -0,0 +1,4 @@
1
+ import { getCurrentComponent } from "./getCurrentComponent.js";
2
+ export function useInstance() {
3
+ return getCurrentComponent().__instance;
4
+ }
@@ -1,13 +1,15 @@
1
1
  import type { InstanceConfig } from '../Instance/InstanceConfig.js';
2
2
  import type { AppRoutes } from '../routing/AppRoutes.js';
3
3
  import { DomPointer } from '../DomPointer.js';
4
- import { TungstenBaseComponentType, TungstenBaseComponent } from '../Components.jsx';
4
+ import { TungstenBaseComponentType } from '../Components.jsx';
5
5
  import { Instance } from '../Instance/Instance.js';
6
+ import { type TaggedAttributeMismatch } from './renderHydrationMismatchBanner.js';
6
7
  import '../hmr/applyHmrModule.js';
7
- type HydrateMeta = {
8
+ export type HydrateMeta = {
8
9
  insideForm: boolean;
10
+ mismatches: TaggedAttributeMismatch[];
9
11
  };
10
12
  export declare function hydrate(appRoutes: AppRoutes, RootComponent: TungstenBaseComponentType | null, instanceConfig: InstanceConfig): Promise<void>;
11
- export declare function hydrateRootComponent(instance: Instance, RootComponent: TungstenBaseComponentType, domPointer: DomPointer, meta: HydrateMeta): Promise<TungstenBaseComponent<object, undefined>>;
12
- export {};
13
+ export declare function hydrateRootComponent<ComponentType extends TungstenBaseComponentType<any, any>>(instance: Instance, RootComponent: ComponentType, domPointer: DomPointer, meta: HydrateMeta, props?: InstanceType<ComponentType>['props'], // eslint-disable-line no-type-assertion/no-type-assertion -- default only reached when Props is empty, same as the hardcoded {} this replaces
14
+ routeParams?: Record<string, string>, routeData?: unknown): Promise<InstanceType<ComponentType>>;
13
15
  //# sourceMappingURL=hydrate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../src/hydrate/hydrate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAoBxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAM7C,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAA6B,MAAM,mBAAmB,CAAA;AAE/G,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA0BlD,OAAO,0BAA0B,CAAA;AASjC,KAAK,WAAW,GAAG;IACf,UAAU,EAAE,OAAO,CAAA;CACtB,CAAA;AAKD,wBAAsB,OAAO,CACzB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,yBAAy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AY,CAAC,aAAa,CAAC,CAAC,CA6DtC"}
@@ -1,4 +1,4 @@
1
- import { integrateElementUpdateVdom } from "../update/integrateUpdateVdom.js";
1
+ import { applyUpdate, integrateElementUpdateVdom } from "../update/integrateUpdateVdom.js";
2
2
  //import type { RouteType } from '../routing/RouteType.js'
3
3
  import { $number, $string, makeRenderedContentNodeNonRendered, makeRenderedContentNodeClassComponent, makeRenderedContentNodeFunctionComponent } from "../RenderedContentNode.js";
4
4
  import { ContentNodeElementIsHtml, ContentNodeIsHtml, ContentNodeIsComponent, ContentNodeComponentIsClassComponent, ContentNodeIsElement } from "../ContentNode.js";
@@ -29,6 +29,7 @@ import { MatchedRoute } from "../routing/MatchedRoute.js";
29
29
  import { isDev } from "../isDev.js";
30
30
  import { warn } from "../appOutput.js";
31
31
  import { reconcileHydratedAttributes } from "./reconcileHydratedAttributes.js";
32
+ import { renderHydrationMismatchBanner } from "./renderHydrationMismatchBanner.js";
32
33
  import { setCurrentInstance } from "../hmr/instanceRegistry.js";
33
34
  // side-effect only: pulls applyHmrModule.js (and its clean, non-dynamic-import dependencies)
34
35
  // into the framework's traced dependency graph so it gets copied to .packages/ and is servable
@@ -39,12 +40,13 @@ import { setCurrentInstance } from "../hmr/instanceRegistry.js";
39
40
  import "../hmr/applyHmrModule.js";
40
41
  import { jsx as _jsx } from "tungsten/jsxRuntime.js";
41
42
  function debug(...texts) {
42
- console.log(...texts);
43
+ //console.log(...texts)
43
44
  //console.log(getStackTrace().split('\n')[2])
44
45
  }
45
46
  function makeDefaultHydrateMeta() {
46
47
  return {
47
- insideForm: false
48
+ insideForm: false,
49
+ mismatches: []
48
50
  };
49
51
  } // can we opto this out in production?
50
52
  export async function hydrate(appRoutes, RootComponent, instanceConfig) {
@@ -89,6 +91,7 @@ export async function hydrate(appRoutes, RootComponent, instanceConfig) {
89
91
  // hydrateNode(content, null, domPointer, instance, meta)
90
92
  }
91
93
  instance.hydrationComplete = true;
94
+ if (isDev) renderHydrationMismatchBanner(meta.mismatches);
92
95
  //// Can components update while hydrating is still taking place
93
96
  //// -- probably yes
94
97
  //// Can we pause any further update until hydration completes, to retain coherency?
@@ -114,12 +117,20 @@ routes) {
114
117
  };
115
118
  }
116
119
  }
117
- export async function hydrateRootComponent(instance, RootComponent, domPointer, meta) {
120
+ export async function hydrateRootComponent(instance, RootComponent, domPointer, meta,
121
+ // Real app hydration (hydrate(), above) always hydrates a root with no props of its own -
122
+ // route data comes through the store instead - so the default reproduces that. A test
123
+ // harness hydrating an arbitrary component (see testing/hydrateTestApp.ts) passes its own.
124
+ props = {},
125
+ // eslint-disable-line no-type-assertion/no-type-assertion -- default only reached when Props is empty, same as the hardcoded {} this replaces
126
+ routeParams, routeData) {
118
127
  debug('hydrateRootComponent');
128
+ // matches createTungstenRootComponent's identical cast, the create-path equivalent of this function
129
+ // eslint-disable-next-line no-type-assertion/no-type-assertion
119
130
  const element = new RootComponent({
120
- props: {},
121
- routeParams: undefined,
122
- routeData: undefined,
131
+ props,
132
+ routeParams,
133
+ routeData,
123
134
  instance,
124
135
  parentElement: null
125
136
  });
@@ -489,7 +500,7 @@ async function hydrateNodeSingle(node, parentElement, domPointer, instance, meta
489
500
  // node[$props].ref.current = domNode
490
501
  // }
491
502
  debug('hydarating atts');
492
- hydrateAttributes(node, domNode);
503
+ hydrateAttributes(node, domNode, meta);
493
504
  //!!! node.domElement = domNode
494
505
  const props = node[$props];
495
506
  if (node[$type] === 'textarea') {
@@ -525,7 +536,22 @@ async function hydrateNodeSingle(node, parentElement, domPointer, instance, meta
525
536
  debug('valid children', validChildren(node[$props].children), node[$props].children);
526
537
  const children = node[$props].children;
527
538
  let renderedChildren = $contentNull;
528
- if (node[$props].__opaque !== true && validChildren(children)) {
539
+ if (node[$type] === 'body' && instance.config.csr) {
540
+ // CSR: body shipped empty on purpose, nothing to hydrate against - create fresh.
541
+ if (parentElement === null) {
542
+ throwError('hydrateNodeSingle', 'CSR hydration reached <body> with no owning component');
543
+ }
544
+ const childDomPointer = new DomPointer(domNode);
545
+ renderedChildren = await applyUpdate({
546
+ tungstenElement: parentElement,
547
+ instance,
548
+ newNode: children,
549
+ oldNode: $contentNull,
550
+ domRegion: null,
551
+ domPointer: childDomPointer,
552
+ parentNode: null
553
+ });
554
+ } else if (node[$props].__opaque !== true && validChildren(children)) {
529
555
  debug('node.props.children', children);
530
556
  const childDomPointer = new DomPointer(domNode);
531
557
  renderedChildren = await hydrateNode(children, parentElement, childDomPointer, instance, meta);
@@ -570,17 +596,27 @@ async function hydrateNodeComponent(node, parentElement, domPointer, instance, m
570
596
  }
571
597
  // export type HTMLBindableElement = HTMLButtonElement | HTMLDataElement | HTMLInputElement | HTMLLIElement
572
598
  // | HTMLMeterElement | HTMLOptionElement | HTMLParamElement | HTMLProgressElement | HTMLSelectElement | HTMLTextAreaElement
573
- function hydrateAttributes(node, domNode) {
599
+ function hydrateAttributes(node, domNode, meta) {
574
600
  // handle bind attributes and merge together event handlers
575
601
  processAttributes(node);
576
602
  // Bring the server's attributes into line with what this render produced.
577
603
  // Runs in production as well as development: leaving a known-wrong value in
578
604
  // place is not better in production, it is only quieter. Only genuine
579
605
  // differences are written, so a page that matches costs reads and no
580
- // writes. The report is dev-only, because a mismatch is a bug in the
581
- // application's rendering rather than something a user can act on.
606
+ // writes. Collection always runs (it is what a hydration-test harness reads
607
+ // to assert on - see testing/hydrateTestApp.ts); only the console report and
608
+ // the on-page banner (hydrate(), below) are dev-only, because a mismatch is
609
+ // a bug in the application's rendering rather than something a user can act on.
582
610
  if (ContentNodeElementIsHtml(node)) {
583
- reconcileHydratedAttributes(node, domNode, isDev ? mismatch => warn(`hydration mismatch on <${node[$type]}>:` + ` ${mismatch.name} rendered as ${JSON.stringify(mismatch.expected)}` + ` but the server sent ${JSON.stringify(mismatch.actual)}.` + ` The rendered value has been applied.`) : undefined);
611
+ reconcileHydratedAttributes(node, domNode, mismatch => {
612
+ meta.mismatches.push({
613
+ tagName: node[$type],
614
+ ...mismatch
615
+ });
616
+ if (isDev) {
617
+ warn(`hydration mismatch on <${node[$type]}>:` + ` ${mismatch.name} rendered as ${JSON.stringify(mismatch.expected)}` + ` but the server sent ${JSON.stringify(mismatch.actual)}.` + ` The rendered value has been applied.`);
618
+ }
619
+ });
584
620
  }
585
621
  debug('--\nhydrateAttributes', domNode);
586
622
  for (const key in node[$props]) {
@@ -698,6 +734,8 @@ function hydrateAttributes(node, domNode) {
698
734
  function processAttributes(node) {
699
735
  const props = node[$props];
700
736
  debug('--\nprocessAttributes', node);
737
+ // set a button without specified type to button, so buttons don't submit forms unless instructed to
738
+ if (node[$type] === 'button' && !('type' in props)) props.type = 'button';
701
739
  for (const key in node[$props]) {
702
740
  if (key === 'bind' && ContentNodeElementIsHtml(node)) {
703
741
  const eventName = 'onInput';
@@ -1 +1 @@
1
- {"version":3,"file":"reconcileHydratedAttributes.d.ts","sourceRoot":"","sources":["../../src/hydrate/reconcileHydratedAttributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAIxD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,gFAAgF;IAChF,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB,CAAA;AA6BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,GACnD,IAAI,CAuCN"}
1
+ {"version":3,"file":"reconcileHydratedAttributes.d.ts","sourceRoot":"","sources":["../../src/hydrate/reconcileHydratedAttributes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAKxD,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,gFAAgF;IAChF,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,2EAA2E;IAC3E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB,CAAA;AA6BD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,WAAW,EACpB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,GACnD,IAAI,CAuCN"}
@@ -1,5 +1,6 @@
1
1
  import { $props } from "../contentNodeSymbols.js";
2
2
  import { processProps } from "../render/processProps.js";
3
+ import { booleanAttributeValue } from "../booleanAttributeValue.js";
3
4
  /**
4
5
  * The attribute value a render produces for a prop, or null for "no attribute".
5
6
  *
@@ -7,8 +8,8 @@ import { processProps } from "../render/processProps.js";
7
8
  * the server and `addAttributes()` on the client — so that a value which
8
9
  * round-trips unchanged compares equal here.
9
10
  */
10
- function attributeValue(value) {
11
- if (typeof value === 'boolean') return value ? '' : null;
11
+ function attributeValue(name, value) {
12
+ if (typeof value === 'boolean') return booleanAttributeValue(name, value);
12
13
  if (value === undefined || value === null) return null;
13
14
  return String(value);
14
15
  }
@@ -55,7 +56,7 @@ export function reconcileHydratedAttributes(node, domNode, onMismatch) {
55
56
  const handled = new Set();
56
57
  for (const name in expected) {
57
58
  handled.add(name.toLowerCase());
58
- const value = attributeValue(expected[name]);
59
+ const value = attributeValue(name, expected[name]);
59
60
  const actual = domNode.getAttribute(name);
60
61
  if (value === actual) continue;
61
62
  if (value === null) removeAttribute(domNode, name);else setAttribute(domNode, name, value);
@@ -0,0 +1,7 @@
1
+ import type { AttributeMismatch } from './reconcileHydratedAttributes.js';
2
+ export type TaggedAttributeMismatch = AttributeMismatch & {
3
+ tagName: string;
4
+ };
5
+ export declare const hydrationMismatchAttribute = "data-tungsten-hydration-mismatches";
6
+ export declare function renderHydrationMismatchBanner(mismatches: readonly TaggedAttributeMismatch[], doc?: Document): void;
7
+ //# sourceMappingURL=renderHydrationMismatchBanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderHydrationMismatchBanner.d.ts","sourceRoot":"","sources":["../../src/hydrate/renderHydrationMismatchBanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAI7E,eAAO,MAAM,0BAA0B,uCAAuC,CAAA;AA2C9E,wBAAgB,6BAA6B,CACzC,UAAU,EAAE,SAAS,uBAAuB,EAAE,EAC9C,GAAG,GAAE,QAAmB,GACzB,IAAI,CA4BN"}
@@ -0,0 +1,69 @@
1
+ // Read by the CSS rule below via attr() - not by Tungsten. Exported so an
2
+ // application that wants different styling can target the same selector.
3
+ export const hydrationMismatchAttribute = 'data-tungsten-hydration-mismatches';
4
+ const styleId = 'tungsten-hydration-mismatches-style';
5
+ // Reports hydration mismatches in the page, not only the console, without
6
+ // adding a real DOM node to the hydrated tree.
7
+ //
8
+ // A real element - even one appended after hydration finishes and never
9
+ // touched again by this code - is not actually safe here. Every container
10
+ // Tungsten re-renders gets a fresh `new DomRegion(containerDomNode)` built
11
+ // from whatever is *actually* in its childNodes at that moment, and every
12
+ // position Tungsten writes to next is a raw index into that same list
13
+ // (DomPointer.get/next/prev, and several inline `childNodes[domPointer.index]`
14
+ // reads in integrateUpdateVdom.ts/hydrate.tsx). An extra, untracked child
15
+ // shifts every index after it, so the next update touching that container
16
+ // - body, in a typical app - would compare and write to the wrong nodes.
17
+ // There is no flag on an element that makes the walker skip it; it would
18
+ // have to be built into DomPointer/DomRegion and every direct childNodes
19
+ // access alongside them, which is a core-framework change, not a banner.
20
+ //
21
+ // Attributes are a different story: reconcileHydratedAttributes only runs
22
+ // once, during hydration, before this ever runs, and every later update
23
+ // (updateAttributes) diffs against domNode.__tungsten_oldAttributes - its
24
+ // own private record of what it last set - never the DOM's live attribute
25
+ // list. A plain setAttribute() here is in neither its old props nor its new
26
+ // props, so it is never visited, and never removed.
27
+ //
28
+ // So: set an attribute on <html> (outside Tungsten's own bookkeeping, so
29
+ // permanently untouched by it) and let a `content: attr(...)` pseudo-element
30
+ // display it. A pseudo-element is not a real node - never in .childNodes,
31
+ // never visited by DomPointer or DomRegion - so this carries zero index risk
32
+ // for the app's own reconciliation, at the cost of one small, deliberately
33
+ // hacky wrinkle: a single <style> tag inserted into <head> once.
34
+ //
35
+ // head is not structurally exempt from diffing in general - it currently
36
+ // just never gets diffed node-by-node during hydration (hydrateNodeSingle's
37
+ // 'head' case skips it outright, a known hack, not a guarantee), and nothing
38
+ // in a typical app changes head's vdom children after mount, so the general
39
+ // update path never exercises it either. That could change. What head does
40
+ // already have is a marker for exactly this situation - data--t-persist,
41
+ // used by processHead.ts for framework-injected head content (the entry
42
+ // script, the component CSS link) that isn't part of the app's own vdom and
43
+ // must survive hydration - so this style tag carries it too, rather than
44
+ // riding on the blanket skip alone.
45
+ export function renderHydrationMismatchBanner(mismatches, doc = document) {
46
+ if (mismatches.length === 0) return;
47
+ if (doc.getElementById(styleId) === null) {
48
+ const style = doc.createElement('style');
49
+ style.id = styleId;
50
+ style.setAttribute('data--t-persist', 'true');
51
+ style.textContent = `
52
+ html[${hydrationMismatchAttribute}]::before {
53
+ content: attr(${hydrationMismatchAttribute});
54
+ display: block;
55
+ background: #7a1f1f;
56
+ color: #fff;
57
+ font: 13px/1.5 monospace;
58
+ padding: 8px 12px;
59
+ max-height: 33vh;
60
+ overflow: auto;
61
+ white-space: pre-wrap;
62
+ }
63
+ `;
64
+ doc.head.appendChild(style);
65
+ }
66
+ const heading = `Tungsten: ${mismatches.length} hydration mismatch${mismatches.length === 1 ? '' : 'es'} (dev only)`;
67
+ const lines = mismatches.map(mismatch => `<${mismatch.tagName}> ${mismatch.name}: ` + `rendered ${JSON.stringify(mismatch.expected)}, server sent ${JSON.stringify(mismatch.actual)}`);
68
+ doc.documentElement.setAttribute(hydrationMismatchAttribute, [heading, ...lines].join('\n'));
69
+ }
@@ -16,13 +16,18 @@ export * from './components/bindable/BindableTextarea.jsx';
16
16
  export * from './components/GoToComponent.jsx';
17
17
  export * from './components/Lazy.js';
18
18
  export * from './components/Link.jsx';
19
+ export * from './components/PopMessages.jsx';
19
20
  export * from './components/RawHtml.jsx';
20
21
  export * from './components/RouteRedirectComponent.jsx';
21
22
  export { parseHtml, type ParseHtmlOptions } from './rawHtml/parseHtml.js';
22
23
  export { safeHtmlAllowList } from './rawHtml/safeHtmlAllowList.js';
23
24
  export type { HtmlAllowList } from './rawHtml/HtmlAllowList.js';
25
+ export { sanitizeHtml, type SanitizeHtmlOptions } from './rawHtml/sanitizeHtml.js';
26
+ export { filterContentNode } from './rawHtml/filterContentNode.js';
27
+ export { contentNodeToHtml } from './render/contentNodeToHtml.js';
24
28
  export * from './components/WebRedirectComponent.jsx';
25
29
  export * from './nbsp.js';
30
+ export { pop, dismissPop } from './pop.js';
26
31
  export * from './browserStorage.js';
27
32
  export { createElement } from './createElement.js';
28
33
  export * from './createRef.js';
@@ -64,12 +69,15 @@ export * from './ContentNode.js';
64
69
  export type { GenericObject } from './GenericObject.type.js';
65
70
  export type { Instance } from './Instance/Instance.js';
66
71
  export type { Key } from './Key.js';
72
+ export type { PopMessage } from './PopMessage.type.js';
67
73
  export type { ReqRes, ReqResOrNull } from './ReqRes.js';
68
74
  export type { Params } from './routing/Params.js';
69
75
  export type { ParamsFromPath } from './routing/ParamsFromPath.js';
70
76
  export type { RouteType, Route } from './routing/RouteType.js';
71
77
  export { type RouteKey, type Path, type Path as RoutePath, StringIsPath, RouteKeyIsPath } from './routing/RouteTypes.js';
72
78
  export type { Routes, CustomRoutes } from './routing/Routes.js';
79
+ export type { ErrorRouteType } from './routing/ErrorRouteType.js';
80
+ export { type TungstenErrorInfo, makeTungstenErrorInfo } from './routing/TungstenErrorInfo.js';
73
81
  export type { RouteParams } from './routing/RouteParams.type.js';
74
82
  export type { RouteData } from './routing/RouteData.js';
75
83
  export type { RouteDataFunction } from './routing/RouteDataFunction.type.js';
@@ -1 +1 @@
1
- {"version":3,"file":"indexInner.d.ts","sourceRoot":"","sources":["../src/indexInner.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACH,uBAAuB,EAAE,uBAAuB,IAAI,eAAe,EAAE,mBAAmB;AACxF,yBAAyB,EAAE,yBAAyB,IAAI,iBAAiB,EAAE,qBAAqB;AAEhG,gCAAgC,EAAE,gCAAgC,IAAI,wBAAwB,EAC9F,kCAAkC,EAAE,kCAAkC,IAAI,0BAA0B,GACvG,MAAM,kBAAkB,CAAA;AAEzB,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,uBAAuB,CAAA;AACrC,cAAc,4CAA4C,CAAA;AAC1D,cAAc,yCAAyC,CAAA;AACvD,cAAc,8CAA8C,CAAA;AAC5D,cAAc,yCAAyC,CAAA;AACvD,cAAc,0CAA0C,CAAA;AACxD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,gCAAgC,CAAA;AAC9C,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,yCAAyC,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,YAAY,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC/D,cAAc,uCAAuC,CAAA;AACrD,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,cAAc,gBAAgB,CAAA;AAG9B,OAAO,EAAE,OAAO,EAAE,MAAM,cA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,EAAE,MAAM,eAAe,CAAA;AAG7C,mBAAmB,mBAAmB,CAAA"}
@@ -21,12 +21,17 @@ export * from "./components/bindable/BindableTextarea.js";
21
21
  export * from "./components/GoToComponent.js";
22
22
  export * from "./components/Lazy.js";
23
23
  export * from "./components/Link.js";
24
+ export * from "./components/PopMessages.js";
24
25
  export * from "./components/RawHtml.js";
25
26
  export * from "./components/RouteRedirectComponent.js";
26
27
  export { parseHtml } from "./rawHtml/parseHtml.js";
27
28
  export { safeHtmlAllowList } from "./rawHtml/safeHtmlAllowList.js";
29
+ export { sanitizeHtml } from "./rawHtml/sanitizeHtml.js";
30
+ export { filterContentNode } from "./rawHtml/filterContentNode.js";
31
+ export { contentNodeToHtml } from "./render/contentNodeToHtml.js";
28
32
  export * from "./components/WebRedirectComponent.js";
29
33
  export * from "./nbsp.js";
34
+ export { pop, dismissPop } from "./pop.js";
30
35
  export * from "./browserStorage.js";
31
36
  export { createElement } from "./createElement.js";
32
37
  export * from "./createRef.js";
@@ -66,4 +71,5 @@ export * from "./components/Stylesheet.js";
66
71
  export { TungstenError } from "./TungstenError.js";
67
72
  export * from "./__deproxy.js";
68
73
  export * from "./ContentNode.js"; // types and type guards
69
- export { StringIsPath, RouteKeyIsPath } from "./routing/RouteTypes.js";
74
+ export { StringIsPath, RouteKeyIsPath } from "./routing/RouteTypes.js";
75
+ export { makeTungstenErrorInfo } from "./routing/TungstenErrorInfo.js";
@@ -1 +1 @@
1
- {"version":3,"file":"makeInstanceConfigFromFrameworkConfig.d.ts","sourceRoot":"","sources":["../src/makeInstanceConfigFromFrameworkConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,wBAAgB,qCAAqC,CACjD,eAAe,EAAE,uBAAuB,EAAE,GAAG,GAAE,OAAe,GAC/D,cAAc,CAUhB"}
1
+ {"version":3,"file":"makeInstanceConfigFromFrameworkConfig.d.ts","sourceRoot":"","sources":["../src/makeInstanceConfigFromFrameworkConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAEnE,wBAAgB,qCAAqC,CACjD,eAAe,EAAE,uBAAuB,EAAE,GAAG,GAAE,OAAe,GAC/D,cAAc,CAWhB"}
@@ -5,7 +5,8 @@ export function makeInstanceConfigFromFrameworkConfig(frameworkConfig, dev = fal
5
5
  useRootComponent: frameworkConfig.useRootComponent,
6
6
  clientSideNav: frameworkConfig.clientSideNav,
7
7
  siteBasePath: dev ? '' : frameworkConfig.siteBasePath,
8
- staticSite: frameworkConfig.staticSite
8
+ staticSite: frameworkConfig.staticSite,
9
+ csr: frameworkConfig.csr
9
10
  };
10
11
  if ('sourceDir' in frameworkConfig) c.sourceDir = frameworkConfig.sourceDir;
11
12
  return c;
package/dist/pop.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { Instance } from './Instance/Instance.js';
2
+ export declare function registerPopInstance(newInstance: Instance): void;
3
+ export declare function dismissPop(id: number): void;
4
+ export declare function pop(text: string): void;
5
+ type PopFunction = typeof pop;
6
+ declare global {
7
+ var pop: PopFunction;
8
+ }
9
+ export {};
10
+ //# sourceMappingURL=pop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pop.d.ts","sourceRoot":"","sources":["../src/pop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAStD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,QAAQ,GAAG,IAAI,CAE/D;AAQD,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAO3C;AAID,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAatC;AAMD,KAAK,WAAW,GAAG,OAAO,GAAG,CAAA;AAE7B,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,GAAG,EAAE,WAAW,CAAA;CACvB"}
package/dist/pop.js ADDED
@@ -0,0 +1,49 @@
1
+ import { isServer } from "./isServer.js";
2
+ import { log, warn } from "./appOutput.js";
3
+ // Set once by PopMessages.clientInit, from this.__instance - one Instance per app, shared
4
+ // across the whole client lifetime, so no per-component proxy/subscription is needed here.
5
+ let instance = null;
6
+ export function registerPopInstance(newInstance) {
7
+ instance = newInstance;
8
+ }
9
+ let nextId = 0;
10
+ const AUTO_DISMISS_MS = 3000;
11
+ const LEAVE_MS = 200; // match .pop-message.leaving's transition duration in PopMessages.tsx
12
+ // Shared by pop()'s auto-dismiss and PopMessages' click-to-dismiss, so both leave the same way.
13
+ export function dismissPop(id) {
14
+ if (instance === null) return;
15
+ const {
16
+ popMessages
17
+ } = instance.internalStore;
18
+ popMessages.set(popMessages.get().map(message => message.id === id ? {
19
+ ...message,
20
+ leaving: true
21
+ } : message));
22
+ setTimeout(() => {
23
+ popMessages.set(popMessages.get().filter(message => message.id !== id));
24
+ }, LEAVE_MS);
25
+ }
26
+ // Shows a dismissible banner via <PopMessages/> (an app mounts one in its Root). Also available
27
+ // as global.pop / window.pop for ad-hoc use outside component code, on server and client alike.
28
+ export function pop(text) {
29
+ if (isServer) {
30
+ log('pop: ' + text);
31
+ return;
32
+ }
33
+ if (instance === null) {
34
+ warn('pop() called before the app finished mounting; message dropped:', text);
35
+ return;
36
+ }
37
+ const message = {
38
+ id: nextId++,
39
+ text
40
+ };
41
+ const {
42
+ popMessages
43
+ } = instance.internalStore;
44
+ popMessages.set([...popMessages.get(), message]);
45
+ setTimeout(() => dismissPop(message.id), AUTO_DISMISS_MS);
46
+ }
47
+ // Assigned at module load in both environments, so a pre-mount browser call hits pop()'s
48
+ // no-bridge branch instead of throwing.
49
+ globalThis.pop = pop;
@@ -0,0 +1,20 @@
1
+ import type { ContentNode } from '../ContentNode.js';
2
+ import type { HtmlAllowList } from './HtmlAllowList.js';
3
+ /**
4
+ * Applies an allow list to a content tree that already exists, rather than
5
+ * one being built - the same decisions `parseHtml(html, { allowList })` makes
6
+ * while parsing, for a tree that did not come from parsing HTML at all (one
7
+ * rebuilt from storage, for instance) and so never had the chance to.
8
+ *
9
+ * A disallowed element is unwrapped, keeping its children in its place, so
10
+ * filtering a tag never costs the reader the words inside it - the same rule
11
+ * `parseHtml` applies. An element holding program text rather than prose
12
+ * (`<script>`, and anything on the same footing as `<script>` even under a
13
+ * permissive allow list) is dropped whole instead. `on*` props, `ref`, and
14
+ * `dangerouslySetInnerHTML` are always stripped - the tree-shape equivalent
15
+ * of what `parseHtml` refuses to produce in the first place - and a `href`/
16
+ * `src`/... value using an executable scheme (`javascript:`, `vbscript:`) or,
17
+ * on a navigating attribute, `data:` is dropped the same way.
18
+ */
19
+ export declare function filterContentNode(node: ContentNode, allowList: HtmlAllowList): ContentNode;
20
+ //# sourceMappingURL=filterContentNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterContentNode.d.ts","sourceRoot":"","sources":["../../src/rawHtml/filterContentNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAA;AAI/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAyFvD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,aAAa,GAAG,WAAW,CAE1F"}