@plitzi/sdk-shared 0.37.2 → 0.37.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 (280) hide show
  1. package/CHANGELOG.md +1162 -0
  2. package/dist/actions/access.d.ts +12 -0
  3. package/dist/actions/access.mjs +13 -0
  4. package/dist/actions/functions.d.ts +27 -0
  5. package/dist/actions/functions.mjs +18 -0
  6. package/dist/actions/index.d.ts +4 -0
  7. package/dist/actions/index.mjs +9 -7
  8. package/dist/auth/index.d.ts +2 -1
  9. package/dist/auth/index.mjs +2 -2
  10. package/dist/auth/visitorRoles.d.ts +27 -0
  11. package/dist/auth/visitorRoles.mjs +48 -0
  12. package/dist/authoring/builder.mjs +1 -0
  13. package/dist/authoring/declare.d.ts +53 -0
  14. package/dist/authoring/declare.mjs +2 -2
  15. package/dist/authoring/index.mjs +5 -5
  16. package/dist/authoring/paramSpec.d.ts +1 -1
  17. package/dist/authoring/paramSpec.mjs +1 -0
  18. package/dist/authoring/spaceCallbacks.mjs +2 -2
  19. package/dist/dataSource/computed.d.ts +21 -0
  20. package/dist/dataSource/computed.mjs +45 -0
  21. package/dist/dataSource/getBindingsDetails.mjs +35 -34
  22. package/dist/dataSource/index.d.ts +1 -0
  23. package/dist/dataSource/index.mjs +7 -6
  24. package/dist/dataSource/utility/not.mjs +4 -7
  25. package/dist/dataSource/utility/stringToArray.mjs +1 -1
  26. package/dist/dataSource/utility/truthiness.d.ts +1 -0
  27. package/dist/dataSource/utility/truthiness.mjs +8 -0
  28. package/dist/dataSource/utility/twigTemplate.d.ts +2 -1
  29. package/dist/dataSource/utility/twigTemplate.mjs +29 -17
  30. package/dist/devTools/utils/PlitziConsole.mjs +22 -22
  31. package/dist/helpers/cookies.d.ts +10 -0
  32. package/dist/helpers/cookies.mjs +19 -0
  33. package/dist/helpers/fetchManifest.d.ts +9 -0
  34. package/dist/helpers/fetchManifest.mjs +3 -6
  35. package/dist/helpers/formatDate.d.ts +5 -3
  36. package/dist/helpers/formatDate.mjs +34 -36
  37. package/dist/helpers/index.d.ts +2 -1
  38. package/dist/helpers/index.mjs +17 -14
  39. package/dist/helpers/isDate.d.ts +7 -0
  40. package/dist/helpers/isDate.mjs +15 -0
  41. package/dist/helpers/keys.d.ts +42 -0
  42. package/dist/helpers/keys.mjs +91 -0
  43. package/dist/helpers/twigWrapper/AST.d.ts +2 -2
  44. package/dist/helpers/twigWrapper/Evaluator/Evaluator.d.ts +12 -2
  45. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +57 -34
  46. package/dist/helpers/twigWrapper/Evaluator/index.d.ts +1 -1
  47. package/dist/helpers/twigWrapper/Evaluator/index.mjs +2 -2
  48. package/dist/helpers/twigWrapper/Parser/ExpressionParser.d.ts +2 -2
  49. package/dist/helpers/twigWrapper/Parser/ExpressionParser.mjs +147 -34
  50. package/dist/helpers/twigWrapper/Parser/Parser.d.ts +2 -1
  51. package/dist/helpers/twigWrapper/Parser/Parser.mjs +21 -20
  52. package/dist/helpers/twigWrapper/filters/filters.mjs +130 -112
  53. package/dist/helpers/twigWrapper/index.d.ts +5 -2
  54. package/dist/helpers/twigWrapper/index.mjs +7 -5
  55. package/dist/helpers/twigWrapper/inspectTemplate.d.ts +23 -0
  56. package/dist/helpers/twigWrapper/inspectTemplate.mjs +110 -0
  57. package/dist/helpers/twigWrapper/processTwig/helpers.d.ts +7 -0
  58. package/dist/helpers/twigWrapper/processTwig/helpers.mjs +2 -1
  59. package/dist/helpers/twigWrapper/processTwig/index.d.ts +2 -1
  60. package/dist/helpers/twigWrapper/processTwig/index.mjs +3 -2
  61. package/dist/helpers/twigWrapper/processTwig/processTwig.d.ts +28 -0
  62. package/dist/helpers/twigWrapper/processTwig/processTwig.mjs +73 -16
  63. package/dist/helpers/twigWrapper/processTwig/resolveStepParam.d.ts +17 -0
  64. package/dist/helpers/twigWrapper/processTwig/resolveStepParam.mjs +14 -0
  65. package/dist/helpers/twigWrapper/templateRoots.d.ts +11 -0
  66. package/dist/helpers/twigWrapper/templateRoots.mjs +4 -4
  67. package/dist/helpers/twigWrapper/tokens/hasTemplateSyntax.d.ts +1 -1
  68. package/dist/history/describe.d.ts +29 -0
  69. package/dist/history/describe.mjs +93 -0
  70. package/dist/history/diff.d.ts +33 -0
  71. package/dist/history/diff.mjs +73 -0
  72. package/dist/history/index.d.ts +3 -0
  73. package/dist/history/index.mjs +3 -0
  74. package/dist/history/types.d.ts +48 -0
  75. package/dist/history/types.mjs +0 -0
  76. package/dist/index.d.ts +1 -0
  77. package/dist/index.mjs +76 -67
  78. package/dist/navigation/index.d.ts +1 -1
  79. package/dist/navigation/index.mjs +2 -2
  80. package/dist/navigation/routes.d.ts +11 -1
  81. package/dist/navigation/routes.mjs +15 -10
  82. package/dist/network/graphql/builder/Mutations/Segment/SegmentAddMutation.mjs +1 -1
  83. package/dist/network/graphql/builder/Mutations/Segment/SegmentAddTemplateMutation.mjs +1 -1
  84. package/dist/network/graphql/builder/Mutations/Segment/SegmentPublishMutation.mjs +1 -1
  85. package/dist/network/graphql/builder/Mutations/Segment/SegmentRemoveMutation.mjs +1 -1
  86. package/dist/network/graphql/builder/Mutations/Segment/SegmentUpdateMutation.mjs +1 -1
  87. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentAddElementMutation.mjs +1 -1
  88. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentCloneElementMutation.mjs +1 -1
  89. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentMoveElementMutation.mjs +1 -1
  90. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRemoveElementMutation.mjs +1 -1
  91. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentRenameElementMutation.mjs +1 -1
  92. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementMutation.mjs +1 -1
  93. package/dist/network/graphql/builder/Mutations/Segment/space/elements/SegmentUpdateElementsMutation.mjs +1 -1
  94. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceAddVariableMutation.mjs +1 -1
  95. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceRemoveVariableMutation.mjs +1 -1
  96. package/dist/network/graphql/builder/Mutations/Segment/space/variables/SegmentSpaceUpdateVariableMutation.mjs +1 -1
  97. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleAddSelectorVariableMutation.mjs +1 -1
  98. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleRemoveSelectorVariableMutation.mjs +1 -1
  99. package/dist/network/graphql/builder/Mutations/Segment/style/selectorVariables/SegmentStyleUpdateSelectorVariableMutation.mjs +1 -1
  100. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleAddSelectorMutation.mjs +1 -1
  101. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorMutation.mjs +1 -1
  102. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleRemoveSelectorsMutation.mjs +1 -1
  103. package/dist/network/graphql/builder/Mutations/Segment/style/selectors/SegmentStyleUpdateSelectorMutation.mjs +1 -1
  104. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleAddVariableMutation.mjs +1 -1
  105. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleRemoveVariableMutation.mjs +1 -1
  106. package/dist/network/graphql/builder/Mutations/Segment/style/variables/SegmentStyleUpdateVariableMutation.mjs +1 -1
  107. package/dist/network/graphql/builder/Mutations/Space/SpaceAddElementMutation.mjs +1 -1
  108. package/dist/network/graphql/builder/Mutations/Space/SpaceAddPluginMutation.mjs +1 -1
  109. package/dist/network/graphql/builder/Mutations/Space/SpaceAddTemplateMutation.mjs +1 -1
  110. package/dist/network/graphql/builder/Mutations/Space/SpaceCloneElementMutation.mjs +1 -1
  111. package/dist/network/graphql/builder/Mutations/Space/SpaceDeployMutation.mjs +1 -1
  112. package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.d.ts +14 -0
  113. package/dist/network/graphql/builder/Mutations/Space/SpaceFixIssuesMutation.mjs +16 -0
  114. package/dist/network/graphql/builder/Mutations/Space/SpaceMoveElementMutation.mjs +1 -1
  115. package/dist/network/graphql/builder/Mutations/Space/SpacePublishMutation.mjs +1 -1
  116. package/dist/network/graphql/builder/Mutations/Space/SpaceRemoveElementMutation.mjs +1 -1
  117. package/dist/network/graphql/builder/Mutations/Space/SpaceRemovePluginMutation.mjs +1 -1
  118. package/dist/network/graphql/builder/Mutations/Space/SpaceRenameElementMutation.mjs +1 -1
  119. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateElementMutation.mjs +1 -1
  120. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateElementsMutation.mjs +1 -1
  121. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateMutation.mjs +1 -1
  122. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.d.ts +4 -0
  123. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdatePluginMutation.mjs +3 -3
  124. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSchemaMutation.mjs +1 -1
  125. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -1
  126. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceAddActionMutation.mjs +1 -1
  127. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRemoveActionMutation.mjs +1 -1
  128. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceRunActionMutation.mjs +2 -1
  129. package/dist/network/graphql/builder/Mutations/Space/actions/SpaceUpdateActionMutation.mjs +1 -1
  130. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceAddCdnMutation.mjs +1 -1
  131. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceRemoveCdnMutation.mjs +1 -1
  132. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceSetCdnCredentialMutation.mjs +1 -1
  133. package/dist/network/graphql/builder/Mutations/Space/cdns/SpaceUpdateCdnMutation.mjs +1 -1
  134. package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceAddConnectorMutation.mjs +1 -1
  135. package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceRemoveConnectorMutation.mjs +1 -1
  136. package/dist/network/graphql/builder/Mutations/Space/connectors/SpaceUpdateConnectorMutation.mjs +1 -1
  137. package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceAddCredentialMutation.mjs +1 -1
  138. package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceRemoveCredentialMutation.mjs +1 -1
  139. package/dist/network/graphql/builder/Mutations/Space/credentials/SpaceUpdateCredentialMutation.mjs +1 -1
  140. package/dist/network/graphql/builder/Mutations/Space/folders/SpaceAddPageFolderMutation.mjs +1 -1
  141. package/dist/network/graphql/builder/Mutations/Space/folders/SpaceRemovePageFolderMutation.mjs +1 -1
  142. package/dist/network/graphql/builder/Mutations/Space/folders/SpaceUpdatePageFolderMutation.mjs +1 -1
  143. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.d.ts +3 -0
  144. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceRemoveFunctionsMutation.mjs +9 -0
  145. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.d.ts +11 -0
  146. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceSaveFunctionsMutation.mjs +24 -0
  147. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.d.ts +4 -0
  148. package/dist/network/graphql/builder/Mutations/Space/functions/SpaceTryFunctionMutation.mjs +15 -0
  149. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceAddPageMutation.mjs +1 -1
  150. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceHomePageMutation.mjs +1 -1
  151. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceRemovePageMutation.mjs +1 -1
  152. package/dist/network/graphql/builder/Mutations/Space/pages/SpaceUpdatePageMutation.mjs +1 -1
  153. package/dist/network/graphql/builder/Mutations/Space/resources/SpaceAddResourceMutation.mjs +1 -1
  154. package/dist/network/graphql/builder/Mutations/Space/resources/SpaceMoveResourceMutation.mjs +1 -1
  155. package/dist/network/graphql/builder/Mutations/Space/resources/SpaceRemoveResourceMutation.mjs +1 -1
  156. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.d.ts +2 -0
  157. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeMutation.mjs +9 -0
  158. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.d.ts +2 -0
  159. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceRemoveRuntimeVariableMutation.mjs +9 -0
  160. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.d.ts +2 -0
  161. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeSizeMutation.mjs +9 -0
  162. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.d.ts +2 -0
  163. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceSetRuntimeVariableMutation.mjs +9 -0
  164. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.d.ts +2 -0
  165. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStartRuntimeMutation.mjs +9 -0
  166. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.d.ts +2 -0
  167. package/dist/network/graphql/builder/Mutations/Space/runtime/SpaceStopRuntimeMutation.mjs +9 -0
  168. package/dist/network/graphql/builder/Mutations/Space/variables/SpaceAddVariableMutation.mjs +1 -1
  169. package/dist/network/graphql/builder/Mutations/Space/variables/SpaceRemoveVariableMutation.mjs +1 -1
  170. package/dist/network/graphql/builder/Mutations/Space/variables/SpaceUpdateVariableMutation.mjs +1 -1
  171. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.d.ts +2 -0
  172. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceAddVisitorMutation.mjs +11 -0
  173. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.d.ts +2 -0
  174. package/dist/network/graphql/builder/Mutations/Space/visitors/SpaceRemoveVisitorMutation.mjs +11 -0
  175. package/dist/network/graphql/builder/Mutations/Style/StyleUpdateMutation.mjs +1 -1
  176. package/dist/network/graphql/builder/Mutations/Style/StyleUpdateSettingsMutation.mjs +1 -1
  177. package/dist/network/graphql/builder/Mutations/Style/fonts/StyleAddFontMutation.mjs +1 -1
  178. package/dist/network/graphql/builder/Mutations/Style/fonts/StyleRemoveFontMutation.mjs +1 -1
  179. package/dist/network/graphql/builder/Mutations/Style/fonts/StyleUpdateFontMutation.mjs +1 -1
  180. package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleAddSelectorVariableMutation.mjs +1 -1
  181. package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleRemoveSelectorVariableMutation.mjs +1 -1
  182. package/dist/network/graphql/builder/Mutations/Style/selectorVariables/StyleUpdateSelectorVariableMutation.mjs +1 -1
  183. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleAddSelectorMutation.mjs +1 -1
  184. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleRemoveSelectorMutation.mjs +1 -1
  185. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleRemoveSelectorsMutation.mjs +1 -1
  186. package/dist/network/graphql/builder/Mutations/Style/selectors/StyleUpdateSelectorMutation.mjs +1 -1
  187. package/dist/network/graphql/builder/Mutations/Style/variables/StyleAddVariableMutation.mjs +1 -1
  188. package/dist/network/graphql/builder/Mutations/Style/variables/StyleRemoveVariableMutation.mjs +1 -1
  189. package/dist/network/graphql/builder/Mutations/Style/variables/StyleUpdateVariableMutation.mjs +1 -1
  190. package/dist/network/graphql/builder/Mutations/index.d.ts +28 -0
  191. package/dist/network/graphql/builder/Mutations/index.mjs +108 -84
  192. package/dist/network/graphql/builder/Queries/InitQuery.mjs +1 -1
  193. package/dist/network/graphql/builder/Queries/Segment/SegmentQuery.mjs +1 -1
  194. package/dist/network/graphql/builder/Queries/Segment/SegmentsQuery.mjs +1 -1
  195. package/dist/network/graphql/builder/Queries/Space/SpaceActionEventsQuery.mjs +1 -1
  196. package/dist/network/graphql/builder/Queries/Space/SpaceActionTasksQuery.mjs +1 -1
  197. package/dist/network/graphql/builder/Queries/Space/SpaceActionsQuery.mjs +1 -1
  198. package/dist/network/graphql/builder/Queries/Space/SpaceCdnsQuery.mjs +1 -1
  199. package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.d.ts +23 -0
  200. package/dist/network/graphql/builder/Queries/Space/SpaceChangesQuery.mjs +49 -0
  201. package/dist/network/graphql/builder/Queries/Space/SpaceCheckActionQuery.mjs +1 -1
  202. package/dist/network/graphql/builder/Queries/Space/SpaceConnectorsQuery.mjs +1 -1
  203. package/dist/network/graphql/builder/Queries/Space/SpaceCredentialsQuery.mjs +1 -1
  204. package/dist/network/graphql/builder/Queries/Space/SpaceDeploymentsQuery.mjs +1 -1
  205. package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.d.ts +6 -0
  206. package/dist/network/graphql/builder/Queries/Space/SpaceFunctionsQuery.mjs +13 -0
  207. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.d.ts +17 -0
  208. package/dist/network/graphql/builder/Queries/Space/SpaceIssuesQuery.mjs +22 -0
  209. package/dist/network/graphql/builder/Queries/Space/SpaceLatestRevisionQuery.mjs +1 -1
  210. package/dist/network/graphql/builder/Queries/Space/SpaceQuotaQuery.mjs +1 -1
  211. package/dist/network/graphql/builder/Queries/Space/SpaceResourcesQuery.mjs +1 -1
  212. package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.d.ts +6 -0
  213. package/dist/network/graphql/builder/Queries/Space/SpaceRuntimeQuery.mjs +32 -0
  214. package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.d.ts +6 -0
  215. package/dist/network/graphql/builder/Queries/Space/SpaceVisitorsQuery.mjs +16 -0
  216. package/dist/network/graphql/builder/Queries/index.d.ts +17 -3
  217. package/dist/network/graphql/builder/Queries/index.mjs +30 -22
  218. package/dist/network/graphql/builder/Subscriptions/SpaceEventSubscription.mjs +1 -1
  219. package/dist/network/graphql/sdk/Mutations/index.d.ts +1 -1
  220. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +1 -1
  221. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +2 -91
  222. package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.d.ts +1 -1
  223. package/dist/network/graphql/sdk/Queries/Segment/SegmentQuery.mjs +2 -44
  224. package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.d.ts +1 -1
  225. package/dist/network/graphql/sdk/Queries/Segment/SegmentsQuery.mjs +2 -55
  226. package/dist/network/graphql/sdk/Queries/index.d.ts +1 -5
  227. package/dist/network/index.mjs +7 -7
  228. package/dist/network/spaceEvents.d.ts +33 -3
  229. package/dist/network/spaceEvents.mjs +102 -89
  230. package/dist/realtime/client.d.ts +46 -0
  231. package/dist/realtime/client.mjs +192 -0
  232. package/dist/realtime/index.d.ts +6 -0
  233. package/dist/realtime/index.mjs +4 -0
  234. package/dist/realtime/presence.d.ts +38 -0
  235. package/dist/realtime/presence.mjs +70 -0
  236. package/dist/realtime/topics.d.ts +36 -0
  237. package/dist/realtime/topics.mjs +25 -0
  238. package/dist/server/actions/useRealtimeSync.d.ts +9 -0
  239. package/dist/server/actions/useRealtimeSync.mjs +7 -0
  240. package/dist/state/index.d.ts +1 -0
  241. package/dist/state/index.mjs +3 -2
  242. package/dist/state/paintedState.d.ts +52 -0
  243. package/dist/state/paintedState.mjs +37 -0
  244. package/dist/state/runtimeStatePersist.d.ts +8 -1
  245. package/dist/state/runtimeStatePersist.mjs +79 -29
  246. package/dist/store/index.d.ts +45 -45
  247. package/dist/store/renderSettings.d.ts +6 -3
  248. package/dist/store/tracing/index.d.ts +1 -0
  249. package/dist/store/tracing/tracingCollector.d.ts +17 -1
  250. package/dist/store/tracing/tracingCollector.mjs +5 -0
  251. package/dist/style/index.d.ts +1 -0
  252. package/dist/style/index.mjs +3 -2
  253. package/dist/style/runtimeStyle.d.ts +29 -0
  254. package/dist/style/runtimeStyle.mjs +7 -0
  255. package/dist/style/styleConstants.d.ts +3 -2
  256. package/dist/style/styleConstants.mjs +2 -0
  257. package/dist/style/styleStates.d.ts +14 -1
  258. package/dist/style/styleStates.mjs +10 -7
  259. package/dist/theme/ThemeProvider.mjs +35 -29
  260. package/dist/theme/themeCookie.mjs +11 -15
  261. package/dist/types/ActionTypes.d.ts +4 -0
  262. package/dist/types/AuthTypes.d.ts +11 -1
  263. package/dist/types/CommonTypes.d.ts +6 -0
  264. package/dist/types/FunctionTypes.d.ts +52 -0
  265. package/dist/types/FunctionTypes.mjs +0 -0
  266. package/dist/types/PluginTypes.d.ts +0 -1
  267. package/dist/types/RealtimeTypes.d.ts +94 -0
  268. package/dist/types/RealtimeTypes.mjs +0 -0
  269. package/dist/types/SchemaTypes.d.ts +54 -0
  270. package/dist/types/SchemaTypes.mjs +8 -0
  271. package/dist/types/ServerTypes.d.ts +259 -15
  272. package/dist/types/SpaceTypes.d.ts +53 -0
  273. package/dist/types/StateTypes.d.ts +6 -0
  274. package/dist/types/StoreTypes.d.ts +11 -0
  275. package/dist/types/index.d.ts +2 -0
  276. package/dist/types/index.mjs +3 -2
  277. package/package.json +180 -11
  278. package/vite.config.ts +0 -12
  279. package/dist/network/graphql/builder/Queries/PluginsQuery.d.ts +0 -9
  280. package/dist/network/graphql/builder/Queries/PluginsQuery.mjs +0 -54
@@ -0,0 +1,70 @@
1
+ import { PRESENCE_TYPE as e } from "./topics.mjs";
2
+ //#region src/realtime/presence.ts
3
+ var t = 2e4, n = 65e3, r = /* @__PURE__ */ new WeakMap(), i = (r, i, a) => {
4
+ let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l, u = !1, d = () => [...u && r.me ? [{
5
+ from: r.me,
6
+ state: l,
7
+ me: !0
8
+ }] : [], ...[...o.values()].map((e) => e.member)], f = () => {
9
+ let e = d();
10
+ c.forEach((t) => t.onChange(e));
11
+ }, p = (e) => {
12
+ let t = e.flatMap((e) => {
13
+ let t = o.get(e);
14
+ return o.delete(e), t ? [t.member] : [];
15
+ });
16
+ if (t.length) {
17
+ f();
18
+ for (let e of t) c.forEach((t) => t.onDepart?.(e));
19
+ }
20
+ }, m = () => {
21
+ u && r.publish(i, e, l);
22
+ }, h = r.subscribe(i, (e) => {
23
+ if (e.from !== r.me) {
24
+ if (e.type === "$presence") {
25
+ let t = {
26
+ from: e.from,
27
+ ...e.user ? { user: e.user } : {},
28
+ state: e.data,
29
+ me: !1
30
+ }, n = !o.has(e.from) && s.delete(e.from);
31
+ o.set(e.from, {
32
+ member: t,
33
+ heardAt: Date.now()
34
+ }), f(), n && c.forEach((e) => e.onArrive?.(t));
35
+ } else e.type === "$leave" ? (s.delete(e.from), p([e.from])) : e.type === "$join" ? (s.add(e.from), m()) : e.type === "$revoked" && e.from === "server" && (o.clear(), s.clear(), f());
36
+ c.forEach((t) => t.onMessage?.(e));
37
+ }
38
+ }), g = r.onStatus((e) => {
39
+ e === "open" && (m(), f());
40
+ }), _ = setInterval(() => {
41
+ m();
42
+ let e = Date.now();
43
+ p([...o].filter(([, t]) => e - t.heardAt > n).map(([e]) => e));
44
+ }, t);
45
+ return {
46
+ members: d,
47
+ set: (e) => {
48
+ l = e, u = !0, m(), f();
49
+ },
50
+ listeners: c,
51
+ teardown: () => {
52
+ clearInterval(_), g(), h(), a();
53
+ }
54
+ };
55
+ }, a = (e, t, n) => {
56
+ let a = r.get(e) ?? /* @__PURE__ */ new Map();
57
+ r.set(e, a);
58
+ let o = a.get(t) ?? i(e, t, () => a.delete(t));
59
+ a.set(t, o), o.listeners.add(n);
60
+ let s = o.members();
61
+ return s.length && n.onChange(s), {
62
+ set: o.set,
63
+ members: o.members,
64
+ stop: () => {
65
+ o.listeners.delete(n) && !o.listeners.size && o.teardown();
66
+ }
67
+ };
68
+ };
69
+ //#endregion
70
+ export { a as trackPresence };
@@ -0,0 +1,36 @@
1
+ import { ChannelDeclaration, ChannelDeclarations } from '../types/RealtimeTypes';
2
+ export declare const isValidTopic: (topic: string) => boolean;
3
+ export type ChannelMatch = {
4
+ pattern: string;
5
+ declaration: ChannelDeclaration;
6
+ };
7
+ /**
8
+ * The declaration a topic falls under — the first pattern that matches it — or `undefined` when none does.
9
+ *
10
+ * One function for the server that authorises a subscription, the linter that checks a page's topic and the client
11
+ * that opens it, so the three cannot disagree about what `board:{id}` covers.
12
+ */
13
+ export declare const matchChannel: (topic: string, declarations: ChannelDeclarations | undefined) => ChannelMatch | undefined;
14
+ /**
15
+ * What is wrong with one channel of a space, each as a sentence that says how to write it — empty when nothing is.
16
+ *
17
+ * One check for every writer: authoring refuses the first, `lintSpace` reports them all for what the builder and an
18
+ * agent write, and the server never has to guess what a malformed declaration meant. Read as `unknown`, because a
19
+ * space from JSON or from an agent has no type to hold it.
20
+ */
21
+ export declare const channelProblems: (pattern: string, declaration: unknown) => string[];
22
+ /** Channel limits, with the defaults a declaration leaves out. */
23
+ export declare const channelLimits: (declaration: ChannelDeclaration) => {
24
+ maxMessageBytes: number;
25
+ messagesPerSecond: number;
26
+ };
27
+ /** The types a channel keeps for itself: a member's state, a member gone, a member arrived. */
28
+ export declare const PRESENCE_TYPE = "$presence";
29
+ export declare const LEAVE_TYPE = "$leave";
30
+ /** A member arrived: the others answer with their `$presence`, so the newcomer sees everyone at once. */
31
+ export declare const JOIN_TYPE = "$join";
32
+ /**
33
+ * What a page hears on a topic when the grant it opened it with is revoked (`realtime.revoke`): it is let go of the
34
+ * topic, and hears nothing more on it until a new grant opens it again.
35
+ */
36
+ export declare const REVOKED_TYPE = "$revoked";
@@ -0,0 +1,25 @@
1
+ //#region src/realtime/topics.ts
2
+ var e = /^[A-Za-z0-9:_.-]{1,128}$/, t = (t) => e.test(t), n = (e) => RegExp(`^${e.split(/(\{[A-Za-z0-9_]+\})/).map((e) => /^\{[A-Za-z0-9_]+\}$/.test(e) ? "[A-Za-z0-9_.-]{1,64}" : e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("")}$`), r = (e, r) => {
3
+ if (!r || !t(e)) return;
4
+ let i = Object.keys(r).find((t) => n(t).test(e));
5
+ return i === void 0 ? void 0 : {
6
+ pattern: i,
7
+ declaration: r[i]
8
+ };
9
+ }, i = /^(?=.)[A-Za-z0-9:_.-]*(\{[A-Za-z0-9_]+\}[A-Za-z0-9:_.-]*)*$/, a = /* @__PURE__ */ new Set([
10
+ "public",
11
+ "session",
12
+ "role"
13
+ ]), o = (e) => typeof e == "object" && !!e && !Array.isArray(e), s = (e, t) => {
14
+ let n = [];
15
+ if (i.test(e) || n.push("a pattern is letters, digits and `:_.-`, with `{name}` for the part a page fills in — `board:{id}`"), !o(t)) return [...n, "a channel is an object: `{ access: { mode: \"public\" } }`"];
16
+ let { access: r, publish: s, presence: c, grant: l, maxMessageBytes: u, messagesPerSecond: d } = t, f = o(r) ? r.mode : void 0;
17
+ typeof f != "string" || !a.has(f) ? n.push("`access` is { mode: \"public\" }, { mode: \"session\" } or { mode: \"role\", permissions: […] }") : f === "role" && !(o(r) && Array.isArray(r.permissions) && r.permissions.every((e) => typeof e == "string")) && n.push("`access: { mode: \"role\" }` names the permissions it needs: `permissions: [\"boardEdit\"]`"), s !== void 0 && s !== "clients" && s !== "server" && n.push("`publish` is \"clients\" (pages send) or \"server\" (only a flow's realtime.publish)"), c !== void 0 && typeof c != "boolean" && n.push("`presence` is true or false"), l !== void 0 && typeof l != "boolean" && n.push("`grant` is true (a page needs a grant from `realtime.grant` to open a topic) or false");
18
+ for (let [e, t] of [["maxMessageBytes", u], ["messagesPerSecond", d]]) t !== void 0 && (typeof t != "number" || !Number.isInteger(t) || t <= 0) && n.push(`\`${e}\` is a whole number above zero`);
19
+ return n;
20
+ }, c = (e) => ({
21
+ maxMessageBytes: e.maxMessageBytes ?? 4096,
22
+ messagesPerSecond: e.messagesPerSecond ?? 30
23
+ }), l = "$presence", u = "$leave", d = "$join", f = "$revoked";
24
+ //#endregion
25
+ export { d as JOIN_TYPE, u as LEAVE_TYPE, l as PRESENCE_TYPE, f as REVOKED_TYPE, c as channelLimits, s as channelProblems, t as isValidTopic, r as matchChannel };
@@ -0,0 +1,9 @@
1
+ import { ServerSSR } from '../../types';
2
+ /**
3
+ * Seeds where this origin's realtime channels answer, once, at the SDK root — as `useActionsSync` does for actions.
4
+ *
5
+ * Only a server that mounts the endpoint publishes the path, so a render without one (the builder, an embed, an
6
+ * offline widget) leaves every `channel` closed rather than reconnecting forever to a 404.
7
+ */
8
+ declare const useRealtimeSync: (ssr?: ServerSSR) => void;
9
+ export default useRealtimeSync;
@@ -0,0 +1,7 @@
1
+ import { useCommonStoreSync as e } from "../../store/index.mjs";
2
+ //#region src/server/actions/useRealtimeSync.ts
3
+ var t = (t) => {
4
+ e(["realtime.endpoint", "realtime.transport"], [t?.realtimePath, t?.realtimeTransport]);
5
+ };
6
+ //#endregion
7
+ export { t as default };
@@ -1 +1,2 @@
1
+ export * from './paintedState';
1
2
  export * from './runtimeStatePersist';
@@ -1,2 +1,3 @@
1
- import { runtimeStatePersist as e, stateOwner as t } from "./runtimeStatePersist.mjs";
2
- export { e as runtimeStatePersist, t as stateOwner };
1
+ import { PAINTED_STATE_BUDGET as e, clearPaintedEntry as t, paintedEntryFromCookies as n, paintedKeys as r, paintedStateCookieName as i, paintedStateFor as a, pickPainted as o, readPaintedEntry as s, writePaintedEntry as c } from "./paintedState.mjs";
2
+ import { runtimeStatePersist as l, stateOwner as u } from "./runtimeStatePersist.mjs";
3
+ export { e as PAINTED_STATE_BUDGET, t as clearPaintedEntry, n as paintedEntryFromCookies, r as paintedKeys, i as paintedStateCookieName, a as paintedStateFor, o as pickPainted, s as readPaintedEntry, l as runtimeStatePersist, u as stateOwner, c as writePaintedEntry };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * The kept state a space's first paint depends on, where the server can read it.
3
+ *
4
+ * Kept state (`keepState`) lives in web storage, which only the browser can read, and it is restored after hydration
5
+ * — it has to be: restored during it, the markup would differ from the server's and React would throw the tree away.
6
+ * So anything kept that changes what is drawn arrives a moment late: the server paints the space's defaults, and the
7
+ * page swaps in what the visitor chose. A toolbar showing the tool last picked, a name in an avatar, a panel left off.
8
+ *
9
+ * The keys a space declares in `settings.paintedState` are written to a cookie as well. The server reads it, renders
10
+ * with those values and hands them to the page as its starting state — so the first paint is already the visitor's,
11
+ * and the restore that follows finds nothing to change. Everything else stays in web storage: the cookie travels with
12
+ * every request, so it holds only what the first paint needs, and never more than {@link PAINTED_STATE_BUDGET}.
13
+ *
14
+ * The entry carries who wrote it, as the kept state in web storage does, and a page that finds it written by somebody
15
+ * else discards what it rendered with. The server cannot tell — who the visitor is, for a space with its own sign-in,
16
+ * is only settled in the browser.
17
+ */
18
+ /** Bytes of the encoded value: well inside the 4096 a browser allows a cookie, name and attributes included. */
19
+ export declare const PAINTED_STATE_BUDGET = 3072;
20
+ export type PaintedEntry = {
21
+ owner: string;
22
+ values: Record<string, unknown>;
23
+ };
24
+ /**
25
+ * Per space, as the web storage key is (`plitzi_<webId>_state`) — and per port, because a cookie's scope is the host
26
+ * without it: two spaces served from `localhost` on two ports would otherwise read each other's. See `debugCookieName`.
27
+ */
28
+ export declare const paintedStateCookieName: (webId: number, host: string | undefined) => string;
29
+ /** The keys a space declared, as a set — an empty one when it declared none. */
30
+ export declare const paintedKeys: (settings: {
31
+ paintedState?: unknown;
32
+ } | undefined) => Set<string>;
33
+ /** The declared keys' values out of `runtime.state` — a key with no value is left out, not written as `undefined`. */
34
+ export declare const pickPainted: (state: unknown, keys: ReadonlySet<string>) => Record<string, unknown>;
35
+ /**
36
+ * The entry in a `Cookie` header, or `undefined` when there is none or it is not one — a cookie is the visitor's to
37
+ * edit, so its shape is checked rather than assumed.
38
+ */
39
+ export declare const paintedEntryFromCookies: (cookies: string | undefined, name: string) => PaintedEntry | undefined;
40
+ /**
41
+ * What the server renders with: the entry's values for the keys the space declares — a key it no longer declares, or
42
+ * one the visitor added, is not the server's to render.
43
+ */
44
+ export declare const paintedStateFor: (cookies: string | undefined, name: string, keys: ReadonlySet<string>) => Record<string, unknown> | undefined;
45
+ /** The entry in this document's cookies. */
46
+ export declare const readPaintedEntry: (name: string) => PaintedEntry | undefined;
47
+ /**
48
+ * Writes the entry, or says why it did not: `too-large` over the budget — the cookie is then removed, so a stale value
49
+ * is not rendered in its place — and `unavailable` where cookies may not be written at all.
50
+ */
51
+ export declare const writePaintedEntry: (name: string, entry: PaintedEntry) => "written" | "too-large" | "unavailable";
52
+ export declare const clearPaintedEntry: (name: string) => void;
@@ -0,0 +1,37 @@
1
+ import { cookieFromHeader as e, documentCookies as t } from "../helpers/cookies.mjs";
2
+ //#region src/state/paintedState.ts
3
+ var n = 3072, r = 31536e3, i = (e, t) => {
4
+ let n = t?.split(":")[1];
5
+ return n ? `plitzi_${e}_painted_${n}` : `plitzi_${e}_painted`;
6
+ }, a = (e) => typeof e == "object" && !!e && !Array.isArray(e), o = (e) => new Set(Array.isArray(e?.paintedState) ? e.paintedState.filter((e) => typeof e == "string" && e !== "") : []), s = (e, t) => a(e) ? Object.fromEntries(Object.entries(e).filter(([e, n]) => t.has(e) && n !== void 0)) : {}, c = (t, n) => {
7
+ let r = e(t, n);
8
+ if (r !== void 0) try {
9
+ let e = JSON.parse(r);
10
+ return a(e) && typeof e.owner == "string" && a(e.values) ? {
11
+ owner: e.owner,
12
+ values: e.values
13
+ } : void 0;
14
+ } catch {
15
+ return;
16
+ }
17
+ }, l = (e, t, n) => {
18
+ if (n.size === 0) return;
19
+ let r = c(e, t);
20
+ if (!r) return;
21
+ let i = s(r.values, n);
22
+ return Object.keys(i).length > 0 ? i : void 0;
23
+ }, u = (e) => c(t(), e), d = (e, t) => {
24
+ let n = encodeURIComponent(JSON.stringify(t));
25
+ if (n.length > 3072) return f(e), "too-large";
26
+ try {
27
+ return document.cookie = `${e}=${n};path=/;max-age=${r};SameSite=Lax`, "written";
28
+ } catch {
29
+ return "unavailable";
30
+ }
31
+ }, f = (e) => {
32
+ try {
33
+ document.cookie = `${e}=;path=/;max-age=0;SameSite=Lax`;
34
+ } catch {}
35
+ };
36
+ //#endregion
37
+ export { n as PAINTED_STATE_BUDGET, f as clearPaintedEntry, c as paintedEntryFromCookies, o as paintedKeys, i as paintedStateCookieName, l as paintedStateFor, s as pickPainted, u as readPaintedEntry, d as writePaintedEntry };
@@ -15,6 +15,13 @@ export type StateOwner = {
15
15
  kind: 'account';
16
16
  id: string;
17
17
  };
18
- /** `undefined` while auth has not settled: nothing kept can be told apart yet from somebody else's. */
18
+ /**
19
+ * `undefined` while nobody can say yet: nothing kept can be told apart from somebody else's.
20
+ *
21
+ * That includes the moment before the `auth` source EXISTS. GlobalSources publishes it for every space — `{}` for one
22
+ * with no accounts, a `status` for one with a provider — but only once it mounts, and the store is asked for its
23
+ * storage before that. Read as "the browser" there, the first read of every visit found the guest's entry, called it
24
+ * somebody else's, and deleted it: a space with `keepState` kept nothing past a reload.
25
+ */
19
26
  export declare const stateOwner: (state: CommonState) => StateOwner | undefined;
20
27
  export declare const runtimeStatePersist: <TState extends CommonState>(webId: number) => StoreMiddleware<TState>;
@@ -1,23 +1,27 @@
1
- import { persistMiddleware as e } from "@plitzi/nexus";
1
+ import { pConsole as e } from "../devTools/utils/PlitziConsole.mjs";
2
+ import { clearPaintedEntry as t, paintedKeys as n, paintedStateCookieName as r, pickPainted as i, readPaintedEntry as a, writePaintedEntry as o } from "./paintedState.mjs";
3
+ import { persistMiddleware as s } from "@plitzi/nexus";
2
4
  //#region src/state/runtimeStatePersist.ts
3
- var t = /* @__PURE__ */ new Set([
5
+ var c = /* @__PURE__ */ new Set([
4
6
  "init",
5
7
  "initLoading",
6
8
  "authenticating"
7
- ]), n = (e) => {
8
- let n = e.runtime?.sources.auth;
9
- if (!n || n.status === void 0) return { kind: "browser" };
10
- if (!t.has(n.status)) return n.isAuthenticated && n.details?.id !== void 0 ? {
11
- kind: "account",
12
- id: String(n.details.id)
13
- } : { kind: "guest" };
14
- }, r = (e) => {
9
+ ]), l = (e) => {
10
+ let t = e.runtime?.sources.auth;
11
+ if (t) {
12
+ if (t.status === void 0) return { kind: "browser" };
13
+ if (!c.has(t.status)) return t.isAuthenticated && t.details?.id !== void 0 ? {
14
+ kind: "account",
15
+ id: String(t.details.id)
16
+ } : { kind: "guest" };
17
+ }
18
+ }, u = (e) => {
15
19
  switch (e.kind) {
16
20
  case "account": return `user:${e.id}`;
17
21
  case "guest": return "guest";
18
22
  case "browser": return "";
19
23
  }
20
- }, i = (e, t) => ({
24
+ }, d = (e, t) => ({
21
25
  getItem: (n) => {
22
26
  let r = e.getItem(n);
23
27
  if (r === null) return null;
@@ -32,35 +36,81 @@ var t = /* @__PURE__ */ new Set([
32
36
  payload: r
33
37
  })),
34
38
  removeItem: (t) => e.removeItem(t)
35
- }), a = (e) => {
39
+ }), f = "runtime.state", p = (e) => typeof e == "object" && !!e && !Array.isArray(e), m = (e, t) => Object.fromEntries(Object.entries(e).filter(([e]) => !t.has(e))), h = (e, t) => p(e) ? Object.fromEntries(Object.entries(e).filter(([e]) => t.has(e))) : {}, g = (e) => e.schema?.settings, _ = (e) => new Set((e?.transientState ?? []).filter((e) => typeof e == "string" && e !== "")), v = (e) => {
36
40
  try {
37
41
  return e === "session" ? globalThis.sessionStorage : globalThis.localStorage;
38
42
  } catch {
39
43
  return;
40
44
  }
41
- }, o = (t) => {
42
- let o = e({
43
- key: `plitzi_${t}_state`,
44
- paths: ["runtime.state"],
45
+ }, y = (s, c) => {
46
+ let d = r(c, typeof window > "u" ? void 0 : window.location.host), f = !1, h;
47
+ return () => {
48
+ let r = s.getState();
49
+ if (typeof document > "u" || r.render?.isHydrating && !r.render.hydrated) return;
50
+ let c = g(r), _ = n(c), v = l(r);
51
+ if (!c?.keepState || _.size === 0 || v === void 0) return;
52
+ let y = u(v), b = r.runtime?.state;
53
+ if (!f) {
54
+ f = !0;
55
+ let e = a(d);
56
+ if (e && e.owner !== y && (t(d), p(b) && [..._].some((e) => e in b))) {
57
+ s.setState("runtime.state", m(b, _));
58
+ return;
59
+ }
60
+ h = e?.owner === y ? JSON.stringify(i(e.values, _)) : void 0;
61
+ }
62
+ let x = i(b, _), S = JSON.stringify(x);
63
+ if (S !== h) {
64
+ if (h = S, Object.keys(x).length === 0) {
65
+ t(d);
66
+ return;
67
+ }
68
+ o(d, {
69
+ owner: y,
70
+ values: x
71
+ }) === "too-large" && e.warning("store", `settings.paintedState holds more than a cookie can carry — the first paint uses the space's defaults for ${[..._].join(", ")}. Declare only what the first paint shows.`, {
72
+ storeName: "runtime",
73
+ path: "runtime.state",
74
+ prev: void 0,
75
+ next: x
76
+ });
77
+ }
78
+ };
79
+ }, b = (e) => {
80
+ let t = s({
81
+ key: `plitzi_${e}_state`,
82
+ paths: [f],
83
+ partializePath: (e, t, n) => p(t) ? m(t, _(g(n))) : t,
84
+ mergePath: (e, t, n, r) => {
85
+ let i = _(g(r));
86
+ return i.size > 0 && p(t) ? {
87
+ ...m(t, i),
88
+ ...h(n, i)
89
+ } : t;
90
+ },
45
91
  storage: (e) => {
46
- let { schema: t, render: o } = e;
47
- if (o?.isHydrating && !o.hydrated) return !1;
48
- let s = t?.settings, c = n(e);
49
- if (!s?.keepState || c === void 0) return !1;
50
- let l = a(s.stateStorage === "sessionStorage" ? "session" : "local");
51
- return l ? i(l, r(c)) : !1;
92
+ let { render: t } = e;
93
+ if (t?.isHydrating && !t.hydrated) return !1;
94
+ let n = g(e), r = l(e);
95
+ if (!n?.keepState || r === void 0) return !1;
96
+ let i = v(n.stateStorage === "sessionStorage" ? "session" : "local");
97
+ return i ? d(i, u(r)) : !1;
52
98
  }
53
99
  });
54
- return (e) => {
55
- let t = o(e), i = e.getState().runtime?.state, a = n(e.getState());
100
+ return (r) => {
101
+ let i = t(r), a = r.getState().runtime?.state, o = l(r.getState()), s = y(r, e);
56
102
  return {
57
- ...t,
58
- onChange: (o) => {
59
- let s = a, c = n(e.getState());
60
- c !== void 0 && (a = c), s?.kind === "account" && c !== void 0 && r(c) !== r(s) && e.setState("runtime.state", i), t?.onChange?.(o);
103
+ ...i,
104
+ onChange: (e) => {
105
+ let t = o, c = l(r.getState());
106
+ if (c !== void 0 && (o = c), t?.kind === "account" && c !== void 0 && u(c) !== u(t)) {
107
+ let e = p(a) ? m(a, n(g(r.getState()))) : a;
108
+ r.setState("runtime.state", e);
109
+ }
110
+ i?.onChange?.(e), s();
61
111
  }
62
112
  };
63
113
  };
64
114
  };
65
115
  //#endregion
66
- export { o as runtimeStatePersist, n as stateOwner };
116
+ export { b as runtimeStatePersist, l as stateOwner };