@storystick/preview 0.0.0-stage → 0.2.0-rc.1

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 (247) hide show
  1. package/LICENSE +112 -0
  2. package/PUBLIC-API.md +56 -0
  3. package/README.md +42 -2
  4. package/dist/.source-hash +1 -0
  5. package/dist/authoring/runtime-contract.d.ts +92 -0
  6. package/dist/authoring/runtime-contract.js +28 -0
  7. package/dist/channel-taxonomy.d.ts +17 -0
  8. package/dist/channel-taxonomy.js +46 -0
  9. package/dist/context-command.d.ts +18 -0
  10. package/dist/context-command.js +38 -0
  11. package/dist/dev/suspicious-codeword-detector.d.ts +15 -0
  12. package/dist/dev/suspicious-codeword-detector.js +220 -0
  13. package/dist/dev/suspicious-codeword-detector.noop.d.ts +3 -0
  14. package/dist/dev/suspicious-codeword-detector.noop.js +4 -0
  15. package/dist/framework/browser-context.d.ts +2 -0
  16. package/dist/framework/browser-context.js +2 -0
  17. package/dist/framework/generation-refresh.d.ts +23 -0
  18. package/dist/framework/generation-refresh.js +82 -0
  19. package/dist/framework/generation-signal.d.ts +8 -0
  20. package/dist/framework/generation-signal.js +17 -0
  21. package/dist/framework/projection-generation-watch.d.ts +5 -0
  22. package/dist/framework/projection-generation-watch.js +53 -0
  23. package/dist/framework/render-receipt.d.ts +8 -0
  24. package/dist/framework/render-receipt.js +10 -0
  25. package/dist/framework/runtime-adapter-store.d.ts +30 -0
  26. package/dist/framework/runtime-adapter-store.js +81 -0
  27. package/dist/grant-coordinator.d.ts +53 -0
  28. package/dist/grant-coordinator.js +329 -0
  29. package/dist/grant-lifecycle.d.ts +52 -0
  30. package/dist/grant-lifecycle.js +74 -0
  31. package/dist/identity/__test-adapter.d.ts +34 -0
  32. package/dist/identity/__test-adapter.js +59 -0
  33. package/dist/identity/browser-context-gate.d.ts +4 -0
  34. package/dist/identity/browser-context-gate.js +22 -0
  35. package/dist/identity/browser-context.d.ts +13 -0
  36. package/dist/identity/browser-context.js +22 -0
  37. package/dist/identity/carriers/postmessage.d.ts +84 -0
  38. package/dist/identity/carriers/postmessage.js +177 -0
  39. package/dist/identity/carriers/storage-state.d.ts +41 -0
  40. package/dist/identity/carriers/storage-state.js +99 -0
  41. package/dist/identity/carriers/storage.d.ts +39 -0
  42. package/dist/identity/carriers/storage.js +182 -0
  43. package/dist/identity/carriers/url.d.ts +19 -0
  44. package/dist/identity/carriers/url.js +38 -0
  45. package/dist/identity/identity-state-machine.d.ts +70 -0
  46. package/dist/identity/identity-state-machine.js +244 -0
  47. package/dist/identity/identity-types.d.ts +192 -0
  48. package/dist/identity/identity-types.js +22 -0
  49. package/dist/identity/index.d.ts +18 -0
  50. package/dist/identity/index.js +16 -0
  51. package/dist/identity/preview-cookie.d.ts +9 -0
  52. package/dist/identity/preview-cookie.js +12 -0
  53. package/dist/identity/preview-draft.d.ts +6 -0
  54. package/dist/identity/preview-draft.js +25 -0
  55. package/dist/identity/preview-identity.d.ts +28 -0
  56. package/dist/identity/preview-identity.js +84 -0
  57. package/dist/identity/preview-scope.d.ts +28 -0
  58. package/dist/identity/preview-scope.js +47 -0
  59. package/dist/identity/resolver.d.ts +110 -0
  60. package/dist/identity/resolver.js +334 -0
  61. package/dist/identity/session-query.d.ts +4 -0
  62. package/dist/identity/session-query.js +19 -0
  63. package/dist/index.d.ts +90 -0
  64. package/dist/index.js +788 -0
  65. package/dist/interaction-mode.d.ts +58 -0
  66. package/dist/interaction-mode.js +93 -0
  67. package/dist/nav-handler.d.ts +95 -0
  68. package/dist/nav-handler.js +84 -0
  69. package/dist/overlay-label.d.ts +79 -0
  70. package/dist/overlay-label.js +73 -0
  71. package/dist/page-presentation.d.ts +24 -0
  72. package/dist/page-presentation.js +32 -0
  73. package/dist/provenance/anchor-map.d.ts +95 -0
  74. package/dist/provenance/anchor-map.js +177 -0
  75. package/dist/provenance/carrier-plan.d.ts +51 -0
  76. package/dist/provenance/carrier-plan.js +90 -0
  77. package/dist/provenance/coded-text.d.ts +20 -0
  78. package/dist/provenance/coded-text.js +302 -0
  79. package/dist/provenance/direct-edit-locator.d.ts +29 -0
  80. package/dist/provenance/direct-edit-locator.js +218 -0
  81. package/dist/provenance/editable-leaf.d.ts +134 -0
  82. package/dist/provenance/editable-leaf.js +483 -0
  83. package/dist/provenance/editor-target.d.ts +29 -0
  84. package/dist/provenance/editor-target.js +46 -0
  85. package/dist/provenance/field-leaf-walker.d.ts +21 -0
  86. package/dist/provenance/field-leaf-walker.js +98 -0
  87. package/dist/provenance/frame-dependencies.d.ts +212 -0
  88. package/dist/provenance/frame-dependencies.js +550 -0
  89. package/dist/provenance/index.d.ts +26 -0
  90. package/dist/provenance/index.js +26 -0
  91. package/dist/provenance/local-events.d.ts +1 -0
  92. package/dist/provenance/local-events.js +1 -0
  93. package/dist/provenance/markers.d.ts +21 -0
  94. package/dist/provenance/markers.js +70 -0
  95. package/dist/provenance/multi-frame-anchor-map.d.ts +54 -0
  96. package/dist/provenance/multi-frame-anchor-map.js +109 -0
  97. package/dist/provenance/normalize.d.ts +2 -0
  98. package/dist/provenance/normalize.js +19 -0
  99. package/dist/provenance/overlay-focus-echo.d.ts +17 -0
  100. package/dist/provenance/overlay-focus-echo.js +16 -0
  101. package/dist/provenance/overlay-projection.d.ts +65 -0
  102. package/dist/provenance/overlay-projection.js +201 -0
  103. package/dist/provenance/owner-map.d.ts +55 -0
  104. package/dist/provenance/owner-map.js +239 -0
  105. package/dist/provenance/read-carrier.d.ts +22 -0
  106. package/dist/provenance/read-carrier.js +92 -0
  107. package/dist/provenance/recorder.d.ts +38 -0
  108. package/dist/provenance/recorder.js +82 -0
  109. package/dist/provenance/render-context.d.ts +106 -0
  110. package/dist/provenance/render-context.js +338 -0
  111. package/dist/provenance/reveal-contract.d.ts +44 -0
  112. package/dist/provenance/reveal-contract.js +1 -0
  113. package/dist/provenance/richtext-slice-embed-address.d.ts +20 -0
  114. package/dist/provenance/richtext-slice-embed-address.js +35 -0
  115. package/dist/provenance/runtime-script.d.ts +1 -0
  116. package/dist/provenance/runtime-script.js +2217 -0
  117. package/dist/provenance/sidecar-store.d.ts +63 -0
  118. package/dist/provenance/sidecar-store.js +151 -0
  119. package/dist/provenance/sidecar.d.ts +34 -0
  120. package/dist/provenance/sidecar.js +227 -0
  121. package/dist/provenance/slice-model.d.ts +28 -0
  122. package/dist/provenance/slice-model.js +86 -0
  123. package/dist/provenance/source-identity.d.ts +3 -0
  124. package/dist/provenance/source-identity.js +7 -0
  125. package/dist/provenance/source-map-materializer.d.ts +76 -0
  126. package/dist/provenance/source-map-materializer.js +286 -0
  127. package/dist/provenance/source-registry.d.ts +103 -0
  128. package/dist/provenance/source-registry.js +562 -0
  129. package/dist/provenance/transformed-output-gate.d.ts +161 -0
  130. package/dist/provenance/transformed-output-gate.js +171 -0
  131. package/dist/provenance/types.d.ts +102 -0
  132. package/dist/provenance/types.js +1 -0
  133. package/dist/refresh-policy.d.ts +11 -0
  134. package/dist/refresh-policy.js +14 -0
  135. package/dist/reveal-target.d.ts +8 -0
  136. package/dist/reveal-target.js +47 -0
  137. package/dist/route-paths.d.ts +11 -0
  138. package/dist/route-paths.js +14 -0
  139. package/dist/router-subscriber.d.ts +92 -0
  140. package/dist/router-subscriber.js +44 -0
  141. package/dist/runtime/anchor-types.d.ts +5 -0
  142. package/dist/runtime/anchor-types.js +1 -0
  143. package/dist/runtime/authority-store.d.ts +31 -0
  144. package/dist/runtime/authority-store.js +56 -0
  145. package/dist/runtime/boot.d.ts +52 -0
  146. package/dist/runtime/boot.js +379 -0
  147. package/dist/runtime/content-refresh.d.ts +30 -0
  148. package/dist/runtime/content-refresh.js +68 -0
  149. package/dist/runtime/emit-runtime-error.d.ts +51 -0
  150. package/dist/runtime/emit-runtime-error.js +64 -0
  151. package/dist/runtime/field-proxy.d.ts +112 -0
  152. package/dist/runtime/field-proxy.js +471 -0
  153. package/dist/runtime/form-contract-reporter.d.ts +99 -0
  154. package/dist/runtime/form-contract-reporter.js +391 -0
  155. package/dist/runtime/invalidation-adapter.d.ts +17 -0
  156. package/dist/runtime/invalidation-adapter.js +42 -0
  157. package/dist/runtime/live-query-overlay.d.ts +39 -0
  158. package/dist/runtime/live-query-overlay.js +345 -0
  159. package/dist/runtime/momentary-navigate.d.ts +16 -0
  160. package/dist/runtime/momentary-navigate.js +106 -0
  161. package/dist/runtime/observation-scheduler.d.ts +15 -0
  162. package/dist/runtime/observation-scheduler.js +42 -0
  163. package/dist/runtime/perf-metrics.d.ts +28 -0
  164. package/dist/runtime/perf-metrics.js +90 -0
  165. package/dist/runtime/preview-interaction-policy.d.ts +1 -0
  166. package/dist/runtime/preview-interaction-policy.js +103 -0
  167. package/dist/runtime/preview-overlay-painter.d.ts +27 -0
  168. package/dist/runtime/preview-overlay-painter.js +1732 -0
  169. package/dist/runtime/preview-overlay-sidecar.d.ts +26 -0
  170. package/dist/runtime/preview-overlay-sidecar.js +45 -0
  171. package/dist/runtime/preview-perspective-alignment.d.ts +15 -0
  172. package/dist/runtime/preview-perspective-alignment.js +40 -0
  173. package/dist/runtime/preview-perspective-intent-state.d.ts +23 -0
  174. package/dist/runtime/preview-perspective-intent-state.js +5 -0
  175. package/dist/runtime/preview-transition-state.d.ts +142 -0
  176. package/dist/runtime/preview-transition-state.js +257 -0
  177. package/dist/runtime/render-mode-state.d.ts +51 -0
  178. package/dist/runtime/render-mode-state.js +76 -0
  179. package/dist/runtime/request-id.d.ts +4 -0
  180. package/dist/runtime/request-id.js +8 -0
  181. package/dist/runtime/resolve-schema-field.d.ts +99 -0
  182. package/dist/runtime/resolve-schema-field.js +356 -0
  183. package/dist/runtime/runtime-error-dispatch.d.ts +23 -0
  184. package/dist/runtime/runtime-error-dispatch.js +75 -0
  185. package/dist/runtime/schema-store.d.ts +121 -0
  186. package/dist/runtime/schema-store.js +667 -0
  187. package/dist/runtime/snapshot-assembly.d.ts +104 -0
  188. package/dist/runtime/snapshot-assembly.js +553 -0
  189. package/dist/runtime/snapshot-reporter.d.ts +55 -0
  190. package/dist/runtime/snapshot-reporter.js +375 -0
  191. package/dist/runtime/standalone-overlay-controller.d.ts +33 -0
  192. package/dist/runtime/standalone-overlay-controller.js +281 -0
  193. package/dist/runtime/store.d.ts +307 -0
  194. package/dist/runtime/store.js +1026 -0
  195. package/dist/runtime/windowed-minimap-projection.d.ts +28 -0
  196. package/dist/runtime/windowed-minimap-projection.js +189 -0
  197. package/dist/runtime/workspace-shortcuts.d.ts +30 -0
  198. package/dist/runtime/workspace-shortcuts.js +188 -0
  199. package/dist/sdk-error-copy.d.ts +48 -0
  200. package/dist/sdk-error-copy.js +182 -0
  201. package/dist/select-cursor.d.ts +2 -0
  202. package/dist/select-cursor.js +23 -0
  203. package/dist/server/admission-cookie.d.ts +38 -0
  204. package/dist/server/admission-cookie.js +122 -0
  205. package/dist/server/control-client.d.ts +29 -0
  206. package/dist/server/control-client.js +22 -0
  207. package/dist/server/control-errors.d.ts +22 -0
  208. package/dist/server/control-errors.js +182 -0
  209. package/dist/server/draft-route.d.ts +12 -0
  210. package/dist/server/draft-route.js +45 -0
  211. package/dist/server/extract-token.d.ts +30 -0
  212. package/dist/server/extract-token.js +98 -0
  213. package/dist/server/grant.d.ts +128 -0
  214. package/dist/server/grant.js +395 -0
  215. package/dist/server/ordinary-read-provenance.d.ts +11 -0
  216. package/dist/server/ordinary-read-provenance.js +124 -0
  217. package/dist/server/preview-read-metadata.d.ts +10 -0
  218. package/dist/server/preview-read-metadata.js +27 -0
  219. package/dist/server/provenance-frame-builder.d.ts +53 -0
  220. package/dist/server/provenance-frame-builder.js +102 -0
  221. package/dist/server/provenance-runtime.d.ts +70 -0
  222. package/dist/server/provenance-runtime.js +46 -0
  223. package/dist/server/read-context-command.d.ts +11 -0
  224. package/dist/server/read-context-command.js +53 -0
  225. package/dist/server/read-identity.d.ts +3 -0
  226. package/dist/server/read-identity.js +63 -0
  227. package/dist/server/read-lifecycle.d.ts +17 -0
  228. package/dist/server/read-lifecycle.js +52 -0
  229. package/dist/server/render-frame-provenance.d.ts +133 -0
  230. package/dist/server/render-frame-provenance.js +676 -0
  231. package/dist/server/render-id.d.ts +15 -0
  232. package/dist/server/render-id.js +22 -0
  233. package/dist/server/route-document-provenance.d.ts +77 -0
  234. package/dist/server/route-document-provenance.js +1327 -0
  235. package/dist/server/route-session-cookie.d.ts +33 -0
  236. package/dist/server/route-session-cookie.js +54 -0
  237. package/dist/session-projections.d.ts +33 -0
  238. package/dist/session-projections.js +43 -0
  239. package/dist/session-subscriber.d.ts +124 -0
  240. package/dist/session-subscriber.js +79 -0
  241. package/dist/sha256-fallback.d.ts +30 -0
  242. package/dist/sha256-fallback.js +126 -0
  243. package/dist/types.d.ts +446 -0
  244. package/dist/types.js +85 -0
  245. package/dist/validators.d.ts +61 -0
  246. package/dist/validators.js +110 -0
  247. package/package.json +210 -3
package/LICENSE ADDED
@@ -0,0 +1,112 @@
1
+ # Functional Source License, Version 1.1, MIT Future License
2
+
3
+ ## Abbreviation
4
+
5
+ FSL-1.1-MIT
6
+
7
+ ## Notice
8
+
9
+ Copyright 2026 Tanguy Freycon
10
+
11
+ ## Terms and Conditions
12
+
13
+ ### Licensor ("We")
14
+
15
+ The party offering the Software under these Terms and Conditions.
16
+
17
+ ### The Software
18
+
19
+ The "Software" is each version of the software that we make available under
20
+ these Terms and Conditions, as indicated by our inclusion of these Terms and
21
+ Conditions with the Software.
22
+
23
+ ### License Grant
24
+
25
+ Subject to your compliance with this License Grant and the Patents,
26
+ Redistribution and Trademark clauses below, we hereby grant you the right to
27
+ use, copy, modify, create derivative works, publicly perform, publicly display
28
+ and redistribute the Software for any Permitted Purpose identified below.
29
+
30
+ ### Permitted Purpose
31
+
32
+ A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
33
+ means making the Software available to others in a commercial product or
34
+ service that:
35
+
36
+ 1. substitutes for the Software;
37
+
38
+ 2. substitutes for any other product or service we offer using the Software
39
+ that exists as of the date we make the Software available; or
40
+
41
+ 3. offers the same or substantially similar functionality as the Software.
42
+
43
+ Permitted Purposes specifically include using the Software:
44
+
45
+ 1. for your internal use and access;
46
+
47
+ 2. for non-commercial education;
48
+
49
+ 3. for non-commercial research; and
50
+
51
+ 4. in connection with professional services that you provide to a licensee
52
+ using the Software in accordance with these Terms and Conditions.
53
+
54
+ ### Patents
55
+
56
+ To the extent your use for a Permitted Purpose would necessarily infringe our
57
+ patents, the license grant above includes a license under our patents. If you
58
+ make a claim against any party that the Software infringes or contributes to
59
+ the infringement of any patent, then your patent license to the Software ends
60
+ immediately.
61
+
62
+ ### Redistribution
63
+
64
+ The Terms and Conditions apply to all copies, modifications and derivatives of
65
+ the Software.
66
+
67
+ If you redistribute any copies, modifications or derivatives of the Software,
68
+ you must include a copy of or a link to these Terms and Conditions and not
69
+ remove any copyright notices provided in or with the Software.
70
+
71
+ ### Disclaimer
72
+
73
+ THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
74
+ IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
75
+ PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
76
+
77
+ IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
78
+ SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
79
+ EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
80
+
81
+ ### Trademarks
82
+
83
+ Except for displaying the License Details and identifying us as the origin of
84
+ the Software, you have no right under these Terms and Conditions to use our
85
+ trademarks, trade names, service marks or product names.
86
+
87
+ ## Grant of Future License
88
+
89
+ We hereby irrevocably grant you an additional license to use the Software under
90
+ the MIT license that is effective on the second anniversary of the date we make
91
+ the Software available. On or after that date, you may use the Software under
92
+ the MIT license, in which case the following will apply:
93
+
94
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
95
+ this software and associated documentation files (the "Software"), to deal in
96
+ the Software without restriction, including without limitation the rights to
97
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
98
+ of the Software, and to permit persons to whom the Software is furnished to do
99
+ so, subject to the following conditions:
100
+
101
+ The above copyright notice and this permission notice shall be included in all
102
+ copies or substantial portions of the Software.
103
+
104
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
105
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
106
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
107
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
108
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
109
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
110
+ SOFTWARE.
111
+
112
+ This Agreement shall be governed by the laws of France.
package/PUBLIC-API.md ADDED
@@ -0,0 +1,56 @@
1
+ # @storystick/preview API contract
2
+
3
+ Install this candidate explicitly with `@storystick/preview@0.2.0-rc.1` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
4
+
5
+ Version 0.2.0-rc.1, cohort `sdk-0.2.0-rc.1`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
6
+
7
+ This package supports the integration facades; installing it directly is an advanced use. Reserved contracts are required between SDK packages and must be upgraded with the same cohort. Their public export paths do not promise independent stability.
8
+
9
+ | Entry | Status |
10
+ | --- | --- |
11
+ | `.` | Reserved SDK contract |
12
+ | `./runtime/store` | Reserved SDK contract |
13
+ | `./runtime/request-id` | Reserved SDK contract |
14
+ | `./runtime/authority` | Reserved SDK contract |
15
+ | `./overlay-label` | Reserved SDK contract |
16
+ | `./select-cursor` | Reserved SDK contract |
17
+ | `./runtime/boot` | Reserved SDK contract |
18
+ | `./runtime/perf-metrics` | Reserved SDK contract |
19
+ | `./runtime/live-query-overlay` | Reserved SDK contract |
20
+ | `./refresh-policy` | Reserved SDK contract |
21
+ | `./runtime/emit-runtime-error` | Reserved SDK contract |
22
+ | `./runtime/workspace-shortcuts` | Reserved SDK contract |
23
+ | `./runtime/momentary-navigate` | Reserved SDK contract |
24
+ | `./runtime/content-refresh` | Reserved SDK contract |
25
+ | `./runtime/standalone-overlays` | Reserved SDK contract |
26
+ | `./runtime/invalidation` | Reserved SDK contract |
27
+ | `./dev/suspicious-codeword-detector` | Reserved SDK contract |
28
+ | `./channel-taxonomy` | Reserved SDK contract |
29
+ | `./session-projections` | Reserved SDK contract |
30
+ | `./nav-handler` | Reserved SDK contract |
31
+ | `./router-subscriber` | Reserved SDK contract |
32
+ | `./identity/preview-cookie` | Reserved SDK contract |
33
+ | `./identity/browser-context` | Reserved SDK contract |
34
+ | `./identity` | Reserved SDK contract |
35
+ | `./provenance` | Reserved SDK contract |
36
+ | `./provenance/richtext-slice-embed-address` | Reserved SDK contract |
37
+ | `./authoring/runtime-contract` | Reserved SDK contract |
38
+ | `./page-presentation` | Reserved SDK contract |
39
+ | `./sdk-error-copy` | Reserved SDK contract |
40
+ | `./session-subscriber` | Reserved SDK contract |
41
+ | `./provenance/source-registry` | Reserved SDK contract |
42
+ | `./runtime/preview-transition-state` | Reserved SDK contract |
43
+ | `./runtime/preview-perspective-intent-state` | Reserved SDK contract |
44
+ | `./runtime/preview-perspective-alignment` | Reserved SDK contract |
45
+ | `./reveal-target` | Reserved SDK contract |
46
+ | `./framework/*` | Reserved SDK contract |
47
+ | `./routes` | Reserved SDK contract |
48
+ | `./server/*` | Reserved SDK contract |
49
+ | `./provenance/render-context` | Reserved SDK contract |
50
+ | `./provenance/slice-model` | Reserved SDK contract |
51
+
52
+ The qualified toolchain is Node 24.19.0 and pnpm 9.15.9. Next uses App Router 15.5.28, Sharp 0.35.5 and React/React DOM 19.2.8; Astro uses 7.4.4 with the Node adapter 11.1.9. Browser delivery is verified by bundling; hosted Preview activation and cross-browser behavior require the staging manual check. Source/CLI are Node tools, server entries belong on the server, and browser entries must never receive a server API key.
53
+
54
+ This is a support/tooling contract. It does not independently grant project access or permission to perform effects.
55
+
56
+ The repository is private. Public package availability does not make the monorepo public, and npm provenance from that repository is unavailable. Product and pilot support: [Storystick](https://storystick.app).
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
1
+ # @storystick/preview
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Low-level Preview runtime used by the Storystick React and Next.js SDKs.
4
+
5
+ Application code normally installs this package alongside the public SDK
6
+ surface rather than importing it directly:
7
+
8
+ ```bash
9
+ pnpm add @storystick/client @storystick/media @storystick/next @storystick/preview @storystick/react
10
+ ```
11
+
12
+ Its documented subpaths are runtime contracts consumed by the SDK packages.
13
+ They are published so an application installed exclusively from registry
14
+ tarballs has the same Preview behavior as the Storystick monorepo.
15
+
16
+
17
+ ## Workspace shortcuts in an embedded Preview
18
+
19
+ The Preview integration reserves Studio workspace shortcuts while attached to
20
+ an authorized Studio session, in both Edit and Navigate modes, including inside
21
+ site inputs. The Studio supplies the platform bindings from its command catalog:
22
+ navigation, Preview, Details and Assistant panels, the command palette, and
23
+ F6/Shift+F6 region navigation. These chords take priority over site handlers.
24
+ Ordinary typing, clipboard operations, local Undo/Redo, Find and Escape remain
25
+ with the site. Outside an attached session nothing is reserved. Nested third-party
26
+ frames and pages without the Preview runtime do not participate.
27
+
28
+ `runtime/workspace-shortcuts` implements this opt-in SDK contract without reading
29
+ customer DOM state or sending input content. The `storystick.preview.shortcuts`
30
+ UI channel exchanges `ready`, `probe`, `configure` and `invoke` messages. It is
31
+ bound to the active iframe window, exact origins, project/session and a fresh
32
+ realm identifier. Each Studio connection has its own configuration identity, so
33
+ reconnecting to a surviving iframe cannot inherit stale revisions. Configuration
34
+ revisions and invocation sequence numbers reject
35
+ stale/duplicate commands. The Studio rechecks current action and modal ownership
36
+ before dispatch. The shared installer covers framework boot, adapters and the
37
+ early provenance script, and suspends its bindings across pagehide/session changes.
38
+
39
+ ## Candidate distribution contract
40
+
41
+ See [PUBLIC-API.md](./PUBLIC-API.md) for supported entries, reserved SDK contracts,
42
+ the qualified runtime matrix and the candidate cohort. Upgrade Storystick
43
+ packages together.
@@ -0,0 +1 @@
1
+ bd76a6ce0bc6a45860a5c7a43beca2a761804917b32721b33339d3cbe862a05d
@@ -0,0 +1,92 @@
1
+ import type { PreviewPerspective, PreviewReadContext } from '@storystick/types/preview-query-targeting';
2
+ import type { PreviewV2RevealSourceRequest, PreviewV2RevealSliceRequest } from '../provenance/reveal-contract.js';
3
+ import type { ImperativeEditorNavigationTarget } from '@storystick/types/editor-destination';
4
+ export declare const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION: 11;
5
+ export declare const STORYSTICK_AUTHORING_RUNTIME_GLOBAL: "StorystickAuthoringRuntime";
6
+ export declare const STORYSTICK_AUTHORING_RUNTIME_PATH: "/authoring-runtime/authoring-runtime.js";
7
+ export interface PreviewAuthoringAdmission {
8
+ connection: {
9
+ id: string;
10
+ expiresAt: number;
11
+ };
12
+ projectId: string;
13
+ projectShortId: string;
14
+ contentShapeCapability: string;
15
+ token: string;
16
+ /** Project/admission-bound Convex RPC authority; never use the public SDK token. */
17
+ rpcToken: string;
18
+ expiresAt: number;
19
+ files: {
20
+ id: string;
21
+ token: string;
22
+ expiresAt: number;
23
+ userId: string;
24
+ sessionId: string;
25
+ };
26
+ }
27
+ export interface PreviewAuthoringTarget {
28
+ documentId: string;
29
+ locale: string;
30
+ variantId?: string;
31
+ releaseId?: string;
32
+ published?: boolean;
33
+ position?: ImperativeEditorNavigationTarget;
34
+ }
35
+ export interface PreviewAuthoringPresentation {
36
+ /** Absent for a public route; present for a routable document without a pathname. */
37
+ draftDocumentId?: string;
38
+ documentId: string;
39
+ locale: string;
40
+ pathname: string;
41
+ perspective: PreviewPerspective;
42
+ }
43
+ export type PreviewAuthoringSurface = 'editor' | 'assistant';
44
+ export interface PreviewAuthoringRuntimeMountOptions {
45
+ root: ShadowRoot;
46
+ container: HTMLElement;
47
+ target?: PreviewAuthoringTarget;
48
+ surface?: PreviewAuthoringSurface | null;
49
+ header?: {
50
+ leading: HTMLElement;
51
+ title: HTMLElement;
52
+ trailing: HTMLElement;
53
+ };
54
+ assistantThreadId?: string | null;
55
+ onSurface?(surface: PreviewAuthoringSurface): void;
56
+ onAssistantThread?(threadId: string | null): void;
57
+ /** A project control can be mounted before there is an edited document. */
58
+ context?: {
59
+ container: HTMLElement;
60
+ getSnapshot(): PreviewReadContext | null;
61
+ subscribe(listener: () => void): () => void;
62
+ change(perspective: PreviewPerspective): Promise<PreviewReadContext>;
63
+ };
64
+ studioUrl?: string;
65
+ getPresentation?(): PreviewAuthoringPresentation | null;
66
+ /** Resolves after context acceptance and navigation dispatch. Site rendering
67
+ * is observed separately and must not hold the editor's target transition. */
68
+ present?(destination: PreviewAuthoringPresentation,
69
+ /** The edited owner can differ from the page being presented. */
70
+ editorTarget?: PreviewAuthoringTarget): Promise<PreviewReadContext>;
71
+ admission: PreviewAuthoringAdmission;
72
+ refreshAdmission(force?: boolean): Promise<PreviewAuthoringAdmission>;
73
+ closeAdmission(): void;
74
+ revealSource?(request: PreviewV2RevealSourceRequest): boolean;
75
+ revealSlice?(request: PreviewV2RevealSliceRequest): boolean;
76
+ onTarget?(target: PreviewAuthoringTarget): void;
77
+ onStatus?(status: PreviewAuthoringRuntimeStatus): void;
78
+ }
79
+ export declare function isPreviewAuthoringAdmission(value: unknown, now?: number): value is PreviewAuthoringAdmission;
80
+ export type PreviewAuthoringRuntimeStatus = 'connecting' | 'ready' | 'unauthorized' | 'disposed';
81
+ export interface PreviewAuthoringRuntimeHandle {
82
+ setSurface(surface: PreviewAuthoringSurface | null): void;
83
+ /** A host observation may become obsolete while the current draft is saved. */
84
+ open(target: PreviewAuthoringTarget, isCurrent?: () => boolean): Promise<void>;
85
+ dispose(): Promise<void>;
86
+ }
87
+ export interface PreviewAuthoringRuntimeModule {
88
+ readonly contractVersion: typeof STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION;
89
+ /** Fetch code only. Admission, queries and mounting still require an explicit open. */
90
+ preload(surface: PreviewAuthoringSurface): Promise<void>;
91
+ mount(options: PreviewAuthoringRuntimeMountOptions): PreviewAuthoringRuntimeHandle;
92
+ }
@@ -0,0 +1,28 @@
1
+ export const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION = 11;
2
+ export const STORYSTICK_AUTHORING_RUNTIME_GLOBAL = 'StorystickAuthoringRuntime';
3
+ export const STORYSTICK_AUTHORING_RUNTIME_PATH = '/authoring-runtime/authoring-runtime.js';
4
+ export function isPreviewAuthoringAdmission(value, now = Date.now()) {
5
+ if (!value || typeof value !== 'object')
6
+ return false;
7
+ const entry = value;
8
+ const connection = entry.connection;
9
+ if (!connection ||
10
+ typeof connection.id !== 'string' ||
11
+ connection.id.length === 0 ||
12
+ !Number.isFinite(connection.expiresAt) ||
13
+ connection.expiresAt <= now)
14
+ return false;
15
+ const files = entry.files;
16
+ if (!files ||
17
+ !['id', 'token', 'userId', 'sessionId'].every((key) => typeof files[key] ===
18
+ 'string' &&
19
+ files[key] !== '') ||
20
+ !files.token.startsWith('stf_') ||
21
+ !Number.isFinite(files.expiresAt) ||
22
+ files.expiresAt <= now)
23
+ return false;
24
+ return (['projectId', 'projectShortId', 'contentShapeCapability', 'token', 'rpcToken'].every((key) => typeof entry[key] === 'string' && entry[key] !== '') &&
25
+ typeof entry.expiresAt === 'number' &&
26
+ Number.isFinite(entry.expiresAt) &&
27
+ entry.expiresAt > now);
28
+ }
@@ -0,0 +1,17 @@
1
+ import type { PreviewMessageType } from '@storystick/transport-allowlist';
2
+ import type { IframeToStudio, StudioToIframe } from './types.js';
3
+ export type PreviewPostMessageFamily = 'session' | 'navigation' | 'location' | 'render-ack' | 'runtime-status' | 'overlay' | 'selection' | 'live-query';
4
+ export type PreviewUiSignalFamily = 'ui-signal';
5
+ export type PreviewContentSignalFamily = 'content-refresh';
6
+ export type PreviewChannelFamily = PreviewPostMessageFamily | PreviewUiSignalFamily | PreviewContentSignalFamily;
7
+ export declare const PREVIEW_CONTENT_REFRESH_CHANNEL: "preview-session-content-revision";
8
+ /**
9
+ * Taxonomy for the secure preview envelope protocol. This classifies the
10
+ * existing wire types only; it does not change or version the envelopes.
11
+ */
12
+ export declare function classifyPreviewEnvelopeType(type: PreviewMessageType): PreviewPostMessageFamily;
13
+ /**
14
+ * Legacy/non-envelope Studio UI signals. These are postMessage UI commands and
15
+ * diagnostics, not content freshness signals.
16
+ */
17
+ export declare function classifyPreviewUiSignalType(type: StudioToIframe['type'] | IframeToStudio['type']): PreviewUiSignalFamily;
@@ -0,0 +1,46 @@
1
+ export const PREVIEW_CONTENT_REFRESH_CHANNEL = 'preview-session-content-revision';
2
+ /**
3
+ * Taxonomy for the secure preview envelope protocol. This classifies the
4
+ * existing wire types only; it does not change or version the envelopes.
5
+ */
6
+ export function classifyPreviewEnvelopeType(type) {
7
+ switch (type) {
8
+ case 'storystick.preview.session-broadcast':
9
+ case 'storystick.preview.session-request':
10
+ return 'session';
11
+ case 'storystick.preview.navigate':
12
+ case 'storystick.preview.reload':
13
+ case 'storystick.preview.interaction-mode':
14
+ return 'navigation';
15
+ case 'storystick.preview.navigation-start':
16
+ case 'storystick.preview.location':
17
+ return 'location';
18
+ case 'storystick.preview.route-rendered':
19
+ return 'render-ack';
20
+ case 'storystick.preview.runtime-error':
21
+ case 'storystick.preview.runtime-recovered':
22
+ case 'storystick.preview.lifecycle':
23
+ return 'runtime-status';
24
+ case 'storystick.preview.overlay-map':
25
+ case 'storystick.preview.overlay-clear':
26
+ case 'storystick.preview.overlay-ready':
27
+ case 'storystick.preview.overlay-click':
28
+ case 'storystick.preview.iframe-interaction':
29
+ return 'overlay';
30
+ case 'storystick.preview.v2.reveal-source':
31
+ case 'storystick.preview.v2.reveal-result':
32
+ return 'selection';
33
+ case 'storystick.preview.live-query.register':
34
+ case 'storystick.preview.live-query.unregister':
35
+ case 'storystick.preview.live-query.projection':
36
+ return 'live-query';
37
+ }
38
+ }
39
+ /**
40
+ * Legacy/non-envelope Studio UI signals. These are postMessage UI commands and
41
+ * diagnostics, not content freshness signals.
42
+ */
43
+ export function classifyPreviewUiSignalType(type) {
44
+ void type;
45
+ return 'ui-signal';
46
+ }
@@ -0,0 +1,18 @@
1
+ import { type PreviewPerspective, type PreviewReadContext } from '@storystick/types/preview-query-targeting';
2
+ export interface PreviewPerspectiveCommand {
3
+ commandId: string;
4
+ expectedContextId: string;
5
+ expectedRevision: number;
6
+ perspective: PreviewPerspective | null;
7
+ }
8
+ export type PreviewPerspectiveCommandResult = {
9
+ context: PreviewReadContext;
10
+ ended: boolean;
11
+ } & ({
12
+ status: 'applied';
13
+ appliedRevision: number;
14
+ } | {
15
+ status: 'conflict';
16
+ });
17
+ /** A network-uncertain mutation is retried only with its original identity. */
18
+ export declare function sendPreviewPerspectiveCommand(route: string, command: PreviewPerspectiveCommand, fetchFn?: typeof fetch): Promise<PreviewPerspectiveCommandResult>;
@@ -0,0 +1,38 @@
1
+ import { isPreviewReadContext, } from '@storystick/types/preview-query-targeting';
2
+ /** A network-uncertain mutation is retried only with its original identity. */
3
+ export async function sendPreviewPerspectiveCommand(route, command, fetchFn = fetch) {
4
+ const body = JSON.stringify(command);
5
+ const send = () => fetchFn(route, {
6
+ method: 'POST', credentials: 'same-origin', cache: 'no-store',
7
+ headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body,
8
+ });
9
+ let response;
10
+ try {
11
+ response = await send();
12
+ }
13
+ catch {
14
+ // Read back before retrying. A concurrent context change never changes
15
+ // the original command's fence or turns it into a new intent.
16
+ const read = await fetchFn(route, { credentials: 'same-origin', cache: 'no-store' });
17
+ if (!read.ok)
18
+ throw new Error('Preview context readback is unavailable.');
19
+ const snapshot = await read.json();
20
+ if (!isRecord(snapshot) || !isPreviewReadContext(snapshot.context) ||
21
+ snapshot.context.contextId !== command.expectedContextId) {
22
+ throw new Error('Invalid Preview context readback.');
23
+ }
24
+ response = await send();
25
+ }
26
+ const result = await response.json();
27
+ if ((response.status !== 200 && response.status !== 409) || !isRecord(result) ||
28
+ (result.status !== 'applied' && result.status !== 'conflict') ||
29
+ !isPreviewReadContext(result.context) || typeof result.ended !== 'boolean' ||
30
+ (result.status === 'applied' && (!Number.isSafeInteger(result.appliedRevision) ||
31
+ result.appliedRevision < 1 || result.appliedRevision > result.context.revision))) {
32
+ throw new Error('Preview perspective change is unavailable.');
33
+ }
34
+ return result;
35
+ }
36
+ function isRecord(value) {
37
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
38
+ }
@@ -0,0 +1,15 @@
1
+ export type SuspiciousPreviewCodewordKind = 'attribute' | 'head' | 'script' | 'style' | 'form-value' | 'url';
2
+ export interface SuspiciousPreviewCodewordReport {
3
+ readonly kind: SuspiciousPreviewCodewordKind;
4
+ readonly element?: Element;
5
+ readonly attribute?: string;
6
+ readonly value: string;
7
+ readonly cleaned: string;
8
+ readonly markerIds: readonly string[];
9
+ }
10
+ /**
11
+ * Dev-only audit for coded text in sinks where the invisible payload is
12
+ * intrinsically dangerous. Rendered text is deliberately ignored: coded text
13
+ * is expected there, and treating it as suspicious would create false positives.
14
+ */
15
+ export declare function observeSuspiciousPreviewCodewords(doc: Document, onReports: (reports: readonly SuspiciousPreviewCodewordReport[]) => void): () => void;