@storystick/preview 0.2.0-rc.4 → 0.2.0-rc.6
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.
- package/PUBLIC-API.md +4 -2
- package/dist/.source-hash +1 -1
- package/dist/authoring/runtime-contract.d.ts +13 -2
- package/dist/authoring/runtime-contract.js +1 -1
- package/dist/channel-taxonomy.js +1 -0
- package/dist/framework/preview-copy.d.ts +42 -30
- package/dist/framework/preview-copy.js +19 -16
- package/dist/framework/preview-feedback.js +4 -1
- package/dist/identity/carriers/postmessage.js +7 -16
- package/dist/index.js +12 -17
- package/dist/overlay-label.d.ts +75 -1
- package/dist/overlay-label.js +93 -1
- package/dist/page-presentation.d.ts +11 -21
- package/dist/page-presentation.js +86 -8
- package/dist/provenance/comment-markers.d.ts +23 -0
- package/dist/provenance/comment-markers.js +65 -0
- package/dist/provenance/markers.js +2 -2
- package/dist/provenance/runtime-script.js +3 -0
- package/dist/query-render.d.ts +13 -0
- package/dist/query-render.js +33 -0
- package/dist/runtime/boot.js +15 -1
- package/dist/runtime/live-query-overlay.js +113 -4
- package/dist/runtime/preview-interaction-policy.js +4 -2
- package/dist/runtime/preview-overlay-painter.d.ts +1 -0
- package/dist/runtime/preview-overlay-painter.js +465 -64
- package/dist/runtime/standalone-overlay-controller.d.ts +3 -1
- package/dist/runtime/standalone-overlay-controller.js +11 -4
- package/dist/server/ordinary-read-provenance.js +4 -3
- package/dist/sha256.d.ts +3 -0
- package/dist/sha256.js +13 -0
- package/package.json +12 -4
|
@@ -1,24 +1,14 @@
|
|
|
1
1
|
/** Framework-independent presentation for Preview's opening and failure pages.
|
|
2
2
|
* The activation route can render the same surface before any React runtime. */
|
|
3
|
-
export declare const STORYSTICK_MARK_VIEW_BOX = "0 0
|
|
4
|
-
export declare const
|
|
5
|
-
readonly
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly width: 3;
|
|
14
|
-
readonly height: 11;
|
|
15
|
-
readonly rx: 1;
|
|
16
|
-
}, {
|
|
17
|
-
readonly x: 9;
|
|
18
|
-
readonly y: 6;
|
|
19
|
-
readonly width: 3;
|
|
20
|
-
readonly height: 5;
|
|
21
|
-
readonly rx: 1;
|
|
22
|
-
}];
|
|
3
|
+
export declare const STORYSTICK_MARK_VIEW_BOX = "0 0 18 18.001";
|
|
4
|
+
export declare const STORYSTICK_MARK_RECT: {
|
|
5
|
+
readonly y: 6.18701;
|
|
6
|
+
readonly width: 18;
|
|
7
|
+
readonly height: 5.62516;
|
|
8
|
+
readonly rx: 2.81258;
|
|
9
|
+
};
|
|
10
|
+
export declare const STORYSTICK_MARK_PATHS: readonly ["M0 2.81258C0 1.25923 1.25923 0 2.81258 0H14.1818V0C14.1818 3.10669 11.6634 5.62516 8.55666 5.62516H2.81258C1.25923 5.62516 0 4.36592 0 2.81258V2.81258Z", "M0 18.0002C0 14.8935 2.51847 12.375 5.62516 12.375H8.18182C9.68805 12.375 10.9091 13.596 10.9091 15.1023V15.1876C10.9091 16.7409 9.64986 18.0002 8.09651 18.0002H0V18.0002Z"];
|
|
11
|
+
export declare const STORYSTICK_WORDMARK_VIEW_BOX = "0 0 105 19";
|
|
12
|
+
export declare const STORYSTICK_WORDMARK_LETTERING = "M32.9265 6.55327C32.8701 6.03007 32.6347 5.62358 32.2202 5.33381C31.8097 5.04001 31.2744 4.89311 30.6143\n4.89311C30.1515 4.89311 29.7551 4.96153 29.4251 5.09837C29.0951 5.2352 28.8415 5.42436 28.6644 5.66584C28.4914\n5.90329 28.4048 6.17495 28.4048 6.48082C28.4008 6.73437 28.4571 6.95573 28.5739 7.14489C28.6946 7.33002 28.8556\n7.48698 29.0568 7.61577C29.258 7.74455 29.4814 7.85322 29.7269 7.94176C29.9764 8.0303 30.23 8.10476 30.4876\n8.16513L31.6406 8.4549C32.1155 8.56357 32.5703 8.71248 33.005 8.90163C33.4396 9.08677 33.828 9.32019 34.1701\n9.60192C34.5122 9.88364 34.7818 10.2237 34.979 10.6222C35.1803 11.0206 35.2809 11.4875 35.2809 12.0227C35.2809\n12.7512 35.0938 13.3911 34.7195 13.9425C34.3492 14.4898 33.8139 14.9184 33.1136 15.2283C32.4174 15.5342 31.5742\n15.6871 30.5842 15.6871C29.6183 15.6871 28.7791 15.5382 28.0668 15.2404C27.3584 14.9386 26.805 14.5019 26.4066\n13.9304C26.0082 13.3549 25.7929 12.6526 25.7607 11.8235H28.0004C28.0326 12.2541 28.1634 12.6123 28.3928\n12.8981C28.6222 13.1798 28.924 13.3931 29.2983 13.538C29.6766 13.6789 30.0972 13.7493 30.56 13.7493C31.043\n13.7493 31.4656 13.6768 31.8278 13.532C32.194 13.383 32.4798 13.1778 32.685 12.9162C32.8943 12.6546 32.9989\n12.3527 32.9989 12.0107C32.9989 11.6927 32.9064 11.4291 32.7212 11.2198C32.5401 11.0105 32.2846 10.8355 31.9545\n10.6946C31.6245 10.5497 31.2362 10.4209 30.7894 10.3082L29.3949 9.94602C28.3726 9.68442 27.5657 9.288 26.9741\n8.75675C26.3825 8.22147 26.0887 7.51113 26.0927 6.62571C26.0887 5.89323 26.2839 5.25331 26.6783 4.70597C27.0767\n4.15862 27.62 3.73201 28.3082 3.42614C28.9964 3.12026 29.7732 2.96733 30.6385 2.96733C31.5199 2.96733 32.2926\n3.12026 32.9567 3.42614C33.6248 3.72798 34.148 4.14856 34.5263 4.68785C34.9046 5.22715 35.0998 5.84896 35.1119\n6.55327H32.9265ZM41.2163 6.22727V7.94176H35.8676V6.22727H41.2163ZM37.1716 4.00568H39.3992V12.7049C39.3992\n12.9947 39.4435 13.216 39.532 13.369C39.6206 13.5179 39.7373 13.6205 39.8822 13.6768C40.0311 13.7332 40.1961\n13.7614 40.3772 13.7614C40.51 13.7614 40.6328 13.7513 40.7455 13.7312C40.8622 13.7111 40.9527 13.695 41.0171\n13.6829L41.3854 15.4034C41.2687 15.4437 41.1016 15.4879 40.8843 15.5362C40.667 15.5885 40.4034 15.6187 40.0935\n15.6268C39.5381 15.6429 39.039 15.5604 38.5963 15.3793C38.1576 15.1941 37.8095 14.9084 37.5519 14.522C37.2984\n14.1357 37.1716 13.6487 37.1716 13.0611V4.00568ZM46.3987 15.6811C45.4891 15.6811 44.7003 15.4819 44.0322\n15.0835C43.3681 14.685 42.853 14.1276 42.4868 13.4112C42.1245 12.6908 41.9434 11.8537 41.9434 10.8999C41.9434\n9.942 42.1245 9.10286 42.4868 8.38246C42.853 7.66205 43.3681 7.10263 44.0322 6.70419C44.7003 6.30575 45.4891\n6.10653 46.3987 6.10653C47.3042 6.10653 48.089 6.30575 48.7531 6.70419C49.4212 7.10263 49.9383 7.66205 50.3046\n8.38246C50.6708 9.10286 50.8539 9.942 50.8539 10.8999C50.8539 11.8537 50.6708 12.6908 50.3046 13.4112C49.9383\n14.1276 49.4212 14.685 48.7531 15.0835C48.089 15.4819 47.3042 15.6811 46.3987 15.6811ZM46.4047 13.9062C46.8957\n13.9062 47.3022 13.7734 47.6242 13.5078C47.9502 13.2382 48.1937 12.8759 48.3547 12.4212C48.5156 11.9624 48.5961\n11.4532 48.5961 10.8938C48.5961 10.3263 48.5156 9.81522 48.3547 9.36044C48.1937 8.90566 47.9502 8.54344 47.6242\n8.27379C47.3022 8.00012 46.8957 7.86328 46.4047 7.86328C45.9137 7.86328 45.5032 8.00012 45.1732 8.27379C44.8472\n8.54344 44.6037 8.90566 44.4427 9.36044C44.2817 9.81522 44.2012 10.3263 44.2012 10.8938C44.2012 11.4532 44.2817\n11.9624 44.4427 12.4212C44.6037 12.8759 44.8472 13.2382 45.1732 13.5078C45.5032 13.7734 45.9137 13.9062 46.4047\n13.9062ZM52.0836 15.5V6.22727H54.2388V7.77876H54.3354C54.5044 7.23947 54.7942 6.82493 55.2047 6.53516C55.6192\n6.24136 56.0921 6.09446 56.6234 6.09446C56.7441 6.09446 56.8789 6.1005 57.0279 6.11257C57.1808 6.12062 57.3076\n6.13672 57.4082 6.16087V8.19531C57.3116 8.16312 57.1627 8.13494 56.9614 8.1108C56.7602 8.08262 56.569 8.06854\n56.3879 8.06854C55.9895 8.06854 55.6333 8.15305 55.3194 8.32209C55.0055 8.49112 54.758 8.72656 54.5769\n9.02841C54.3998 9.33026 54.3112 9.67637 54.3112 10.0668V15.5H52.0836ZM59.9101 18.9773C59.6123 18.9773 59.3346\n18.9531 59.077 18.9048C58.8235 18.8606 58.6202 18.8062 58.4673 18.7418L58.9804 17.0213C59.2984 17.1139 59.5821\n17.1581 59.8316 17.1541C60.0812 17.1541 60.3005 17.0797 60.4897 16.9308C60.6788 16.7818 60.8378 16.5363 60.9666\n16.1942L61.1537 15.6992L57.7912 6.22727H60.1516L62.2645 13.212H62.3611L64.4861 6.22727H66.8526L63.1459\n16.6108C62.9729 17.1018 62.7435 17.5244 62.4577 17.8786C62.172 18.2327 61.8198 18.5044 61.4012 18.6935C60.9827\n18.8827 60.4856 18.9773 59.9101 18.9773ZM75.1153 8.70241L73.0808 8.90767C73.0285 8.70644 72.9319 8.51929 72.7911\n8.34624C72.6542 8.16915 72.4691 8.02628 72.2357 7.91761C72.0063 7.80895 71.7266 7.75462 71.3965 7.75462C70.9458\n7.75462 70.5675 7.85322 70.2616 8.05043C69.9598 8.24361 69.8088 8.49515 69.8088 8.80504C69.8088 9.06664 69.9094\n9.28196 70.1107 9.45099C70.3119 9.62003 70.6439 9.75687 71.1068 9.86151L72.7005 10.1996C73.5779 10.3887 74.2319\n10.6906 74.6625 11.1051C75.0932 11.5156 75.3105 12.0509 75.3145 12.7109C75.3105 13.2985 75.1394 13.8157 74.8014\n14.2624C74.4633 14.7092 73.9944 15.0573 73.3948 15.3068C72.7991 15.5563 72.1129 15.6811 71.3362 15.6811C70.1932\n15.6811 69.2736 15.4416 68.5773 14.9627C67.8851 14.4798 67.4705 13.8097 67.3337 12.9524L69.507 12.7592C69.5995\n13.1697 69.8028 13.4817 70.1167 13.695C70.4306 13.9042 70.8351 14.0089 71.3301 14.0089C71.8453 14.0089 72.2578\n13.9062 72.5677 13.701C72.8816 13.4917 73.0386 13.2301 73.0386 12.9162C73.0386 12.6546 72.936 12.4393 72.7307\n12.2702C72.5295 12.0972 72.2176 11.9664 71.795 11.8778L70.2073 11.5458C69.3178 11.3607 68.6598 11.0488 68.2332\n10.6101C67.8066 10.1674 67.5933 9.60795 67.5933 8.93182C67.5933 8.3563 67.7502 7.85724 68.0642 7.43466C68.3821\n7.01207 68.8248 6.68608 69.3923 6.45668C69.9598 6.22325 70.6178 6.10653 71.3664 6.10653C72.4611 6.10653 73.3223\n6.33996 73.9502 6.80682C74.582 7.27367 74.9704 7.90554 75.1153 8.70241ZM81.1564\n6.22727V7.94176H75.8077V6.22727H81.1564ZM77.1116 4.00568H79.3393V12.7049C79.3393 12.9947 79.3835 13.216 79.4721\n13.369C79.5606 13.5179 79.6773 13.6205 79.8222 13.6768C79.9711 13.7332 80.1361 13.7614 80.3173 13.7614C80.4501\n13.7614 80.5728 13.7513 80.6855 13.7312C80.8022 13.7111 80.8928 13.695 80.9572 13.6829L81.3254 15.4034C81.2087\n15.4437 81.0417 15.4879 80.8244 15.5362C80.607 15.5885 80.3434 15.6187 80.0335 15.6268C79.4781 15.6429 78.9791\n15.5604 78.5364 15.3793C78.0977 15.1941 77.7495 14.9084 77.492 14.522C77.2384 14.1357 77.1116 13.6487 77.1116\n13.0611V4.00568ZM82.3755 15.5V6.22727H84.6031V15.5H82.3755ZM83.4984 4.9233C83.1482 4.9233 82.8464 4.80658\n82.5928 4.57315C82.3433 4.33973 82.2185 4.058 82.2185 3.72798C82.2185 3.39796 82.3433 3.11624 82.5928\n2.88281C82.8464 2.64536 83.1482 2.52663 83.4984 2.52663C83.8485 2.52663 84.1483 2.64536 84.3979 2.88281C84.6474\n3.11624 84.7721 3.39796 84.7721 3.72798C84.7721 4.058 84.6474 4.33973 84.3979 4.57315C84.1483 4.80658 83.8485\n4.9233 83.4984 4.9233ZM90.2926 15.6811C89.3669 15.6811 88.57 15.4779 87.9019 15.0714C87.2379 14.6649 86.7267\n14.1035 86.3685 13.3871C86.0144 12.6667 85.8373 11.8376 85.8373 10.8999C85.8373 9.95407 86.0184 9.12098 86.3806\n8.40057C86.7428 7.68016 87.256 7.11873 87.92 6.71626C88.5841 6.30978 89.3689 6.10653 90.2744 6.10653C91.0351\n6.10653 91.7072 6.24538 92.2908 6.52308C92.8744 6.80078 93.3392 7.19117 93.6853 7.69425C94.0355 8.19732 94.2347\n8.78693 94.283 9.46307H92.158C92.0775 9.01231 91.8783 8.63802 91.5603 8.3402C91.2464 8.04238 90.8298 7.89347\n90.3107 7.89347C89.868 7.89347 89.4796 8.01219 89.1455 8.24964C88.8115 8.4871 88.5519 8.82718 88.3668\n9.26989C88.1857 9.71259 88.0951 10.2438 88.0951 10.8636C88.0951 11.4915 88.1857 12.0308 88.3668 12.4815C88.5479\n12.9283 88.8055 13.2724 89.1395 13.5138C89.4735 13.7553 89.8639 13.8761 90.3107 13.8761C90.6286 13.8761 90.9144\n13.8157 91.1679 13.695C91.4255 13.5702 91.6388 13.3911 91.8078 13.1577C91.9809 12.9242 92.0976 12.6405 92.158\n12.3065H94.283C94.2306 12.9705 94.0355 13.5561 93.6974 14.0632C93.3633 14.5703 92.9065 14.9667 92.327\n15.2525C91.7515 15.5382 91.0733 15.6811 90.2926 15.6811ZM97.4912 12.6143L97.4852 9.92791H97.8353L101.132\n6.22727H103.727L99.6404 10.8033H99.1755L97.4912 12.6143ZM95.4628 15.5V3.13636H97.6905V15.5H95.4628ZM101.282\n15.5L98.2881 11.2983L99.7913 9.72869L103.939 15.5H101.282Z";
|
|
23
13
|
export declare const PREVIEW_PAGE_BRAND_HTML: string;
|
|
24
|
-
export declare const PREVIEW_PAGE_STYLES = "\n [data-ss-preview-page] { box-sizing: border-box; display: flex; min-height: 100svh; width: 100%; padding: 32px 24px; background: var(--ss-surface-page, #fff); color: var(--ss-text-primary, oklch(.2 .007 258.364)); font: 400 14px/20px \"Storystick Inter\", \"Inter Variable\", ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color-scheme: light; }\n [data-ss-preview-page-content] { width: 100%; max-width: 360px; margin: auto; text-align: center; overflow-wrap: anywhere; }\n [data-ss-preview-page-brand] { display: flex; align-items: center; justify-content: center;
|
|
14
|
+
export declare const PREVIEW_PAGE_STYLES = "\n [data-ss-preview-page] { box-sizing: border-box; display: flex; min-height: 100svh; width: 100%; padding: 32px 24px; background: var(--ss-surface-page, #fff); color: var(--ss-text-primary, oklch(.2 .007 258.364)); font: 400 14px/20px \"Storystick Inter\", \"Inter Variable\", ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color-scheme: light; }\n [data-ss-preview-page-content] { width: 100%; max-width: 360px; margin: auto; text-align: center; overflow-wrap: anywhere; }\n [data-ss-preview-page-brand] { display: flex; align-items: center; justify-content: center; margin-bottom: 32px; }\n [data-ss-preview-page-brand] svg { flex: none; width: auto; height: 16px; }\n [data-ss-preview-page-heading] { display: flex; align-items: center; justify-content: center; gap: 10px; }\n [data-ss-preview-page-title] { margin: 0; color: inherit; font: inherit; font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -.025em; text-wrap: balance; }\n [data-ss-preview-page-description] { margin: 12px 0 0; color: var(--ss-text-secondary, oklch(.471 .006 258.364)); font: inherit; text-wrap: pretty; }\n [data-ss-preview-page-actions] { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 24px; }\n [data-ss-preview-page-action] { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 16px; border: 0; border-radius: 999px; background: var(--ss-surface-card, #fff); color: inherit; box-shadow: var(--ss-shadow-control, 0 0 1px rgb(0 0 0 / .22), 0 2px 4px rgb(0 0 0 / .04)); font: inherit; line-height: 20px; text-decoration: none; cursor: pointer; transition: background-color 140ms ease; }\n [data-ss-preview-page-action]:hover { background: var(--ss-surface-field, oklch(.958 .001 255)); }\n [data-ss-preview-page-action='primary'] { background: var(--ss-text-primary, oklch(.2 .007 258.364)); color: #fff; box-shadow: none; }\n [data-ss-preview-page-action='primary']:hover { background: #303034; }\n [data-ss-preview-page-action]:focus-visible, [data-ss-preview-page] summary:focus-visible { outline: 2px solid var(--ss-focus-color, oklch(.614 .194 257)); outline-offset: 3px; }\n [data-ss-preview-page] details { margin-top: 24px; color: var(--ss-text-secondary, oklch(.471 .006 258.364)); font-size: 12px; line-height: 18px; }\n [data-ss-preview-page] summary { width: fit-content; margin-inline: auto; border-radius: 4px; cursor: pointer; }\n [data-ss-preview-page] pre { box-sizing: border-box; max-height: 240px; margin: 12px 0 0; overflow: auto; padding: 12px; border-radius: 12px; background: var(--ss-surface-field, oklch(.958 .001 255)); font: 12px/18px ui-monospace, monospace; white-space: pre-wrap; text-align: left; }\n [data-ss-preview-page-progress] { position: relative; display: inline-block; flex: none; width: 15px; height: 15px; color: var(--ss-text-tertiary, oklch(.515 .006 258.364)); animation: ss-preview-page-orbit 720ms linear infinite; }\n [data-ss-preview-page-progress]::before { content: ''; position: absolute; inset: 0; box-sizing: border-box; border: 2px solid currentColor; border-radius: 50%; opacity: .2; }\n [data-ss-preview-page-progress]::after { content: ''; position: absolute; top: 1px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: currentColor; }\n @keyframes ss-preview-page-orbit { to { transform: rotate(360deg); } }\n @media (prefers-reduced-motion: reduce) { [data-ss-preview-page-progress] { animation: none; } [data-ss-preview-page-action] { transition: none; } }\n";
|
|
@@ -1,17 +1,95 @@
|
|
|
1
1
|
/** Framework-independent presentation for Preview's opening and failure pages.
|
|
2
2
|
* The activation route can render the same surface before any React runtime. */
|
|
3
|
-
|
|
4
|
-
export const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
// Storystick Design System, Figma 2127:20 and 2127:27 (same geometry).
|
|
4
|
+
export const STORYSTICK_MARK_VIEW_BOX = '0 0 18 18.001';
|
|
5
|
+
export const STORYSTICK_MARK_RECT = { y: 6.18701, width: 18, height: 5.62516, rx: 2.81258 };
|
|
6
|
+
export const STORYSTICK_MARK_PATHS = [
|
|
7
|
+
'M0 2.81258C0 1.25923 1.25923 0 2.81258 0H14.1818V0C14.1818 3.10669 11.6634 5.62516 8.55666 5.62516H2.81258C1.25923 5.62516 0 4.36592 0 2.81258V2.81258Z',
|
|
8
|
+
'M0 18.0002C0 14.8935 2.51847 12.375 5.62516 12.375H8.18182C9.68805 12.375 10.9091 13.596 10.9091 15.1023V15.1876C10.9091 16.7409 9.64986 18.0002 8.09651 18.0002H0V18.0002Z',
|
|
8
9
|
];
|
|
9
|
-
export const
|
|
10
|
+
export const STORYSTICK_WORDMARK_VIEW_BOX = '0 0 105 19';
|
|
11
|
+
export const STORYSTICK_WORDMARK_LETTERING = `M32.9265 6.55327C32.8701 6.03007 32.6347 5.62358 32.2202 5.33381C31.8097 5.04001 31.2744 4.89311 30.6143
|
|
12
|
+
4.89311C30.1515 4.89311 29.7551 4.96153 29.4251 5.09837C29.0951 5.2352 28.8415 5.42436 28.6644 5.66584C28.4914
|
|
13
|
+
5.90329 28.4048 6.17495 28.4048 6.48082C28.4008 6.73437 28.4571 6.95573 28.5739 7.14489C28.6946 7.33002 28.8556
|
|
14
|
+
7.48698 29.0568 7.61577C29.258 7.74455 29.4814 7.85322 29.7269 7.94176C29.9764 8.0303 30.23 8.10476 30.4876
|
|
15
|
+
8.16513L31.6406 8.4549C32.1155 8.56357 32.5703 8.71248 33.005 8.90163C33.4396 9.08677 33.828 9.32019 34.1701
|
|
16
|
+
9.60192C34.5122 9.88364 34.7818 10.2237 34.979 10.6222C35.1803 11.0206 35.2809 11.4875 35.2809 12.0227C35.2809
|
|
17
|
+
12.7512 35.0938 13.3911 34.7195 13.9425C34.3492 14.4898 33.8139 14.9184 33.1136 15.2283C32.4174 15.5342 31.5742
|
|
18
|
+
15.6871 30.5842 15.6871C29.6183 15.6871 28.7791 15.5382 28.0668 15.2404C27.3584 14.9386 26.805 14.5019 26.4066
|
|
19
|
+
13.9304C26.0082 13.3549 25.7929 12.6526 25.7607 11.8235H28.0004C28.0326 12.2541 28.1634 12.6123 28.3928
|
|
20
|
+
12.8981C28.6222 13.1798 28.924 13.3931 29.2983 13.538C29.6766 13.6789 30.0972 13.7493 30.56 13.7493C31.043
|
|
21
|
+
13.7493 31.4656 13.6768 31.8278 13.532C32.194 13.383 32.4798 13.1778 32.685 12.9162C32.8943 12.6546 32.9989
|
|
22
|
+
12.3527 32.9989 12.0107C32.9989 11.6927 32.9064 11.4291 32.7212 11.2198C32.5401 11.0105 32.2846 10.8355 31.9545
|
|
23
|
+
10.6946C31.6245 10.5497 31.2362 10.4209 30.7894 10.3082L29.3949 9.94602C28.3726 9.68442 27.5657 9.288 26.9741
|
|
24
|
+
8.75675C26.3825 8.22147 26.0887 7.51113 26.0927 6.62571C26.0887 5.89323 26.2839 5.25331 26.6783 4.70597C27.0767
|
|
25
|
+
4.15862 27.62 3.73201 28.3082 3.42614C28.9964 3.12026 29.7732 2.96733 30.6385 2.96733C31.5199 2.96733 32.2926
|
|
26
|
+
3.12026 32.9567 3.42614C33.6248 3.72798 34.148 4.14856 34.5263 4.68785C34.9046 5.22715 35.0998 5.84896 35.1119
|
|
27
|
+
6.55327H32.9265ZM41.2163 6.22727V7.94176H35.8676V6.22727H41.2163ZM37.1716 4.00568H39.3992V12.7049C39.3992
|
|
28
|
+
12.9947 39.4435 13.216 39.532 13.369C39.6206 13.5179 39.7373 13.6205 39.8822 13.6768C40.0311 13.7332 40.1961
|
|
29
|
+
13.7614 40.3772 13.7614C40.51 13.7614 40.6328 13.7513 40.7455 13.7312C40.8622 13.7111 40.9527 13.695 41.0171
|
|
30
|
+
13.6829L41.3854 15.4034C41.2687 15.4437 41.1016 15.4879 40.8843 15.5362C40.667 15.5885 40.4034 15.6187 40.0935
|
|
31
|
+
15.6268C39.5381 15.6429 39.039 15.5604 38.5963 15.3793C38.1576 15.1941 37.8095 14.9084 37.5519 14.522C37.2984
|
|
32
|
+
14.1357 37.1716 13.6487 37.1716 13.0611V4.00568ZM46.3987 15.6811C45.4891 15.6811 44.7003 15.4819 44.0322
|
|
33
|
+
15.0835C43.3681 14.685 42.853 14.1276 42.4868 13.4112C42.1245 12.6908 41.9434 11.8537 41.9434 10.8999C41.9434
|
|
34
|
+
9.942 42.1245 9.10286 42.4868 8.38246C42.853 7.66205 43.3681 7.10263 44.0322 6.70419C44.7003 6.30575 45.4891
|
|
35
|
+
6.10653 46.3987 6.10653C47.3042 6.10653 48.089 6.30575 48.7531 6.70419C49.4212 7.10263 49.9383 7.66205 50.3046
|
|
36
|
+
8.38246C50.6708 9.10286 50.8539 9.942 50.8539 10.8999C50.8539 11.8537 50.6708 12.6908 50.3046 13.4112C49.9383
|
|
37
|
+
14.1276 49.4212 14.685 48.7531 15.0835C48.089 15.4819 47.3042 15.6811 46.3987 15.6811ZM46.4047 13.9062C46.8957
|
|
38
|
+
13.9062 47.3022 13.7734 47.6242 13.5078C47.9502 13.2382 48.1937 12.8759 48.3547 12.4212C48.5156 11.9624 48.5961
|
|
39
|
+
11.4532 48.5961 10.8938C48.5961 10.3263 48.5156 9.81522 48.3547 9.36044C48.1937 8.90566 47.9502 8.54344 47.6242
|
|
40
|
+
8.27379C47.3022 8.00012 46.8957 7.86328 46.4047 7.86328C45.9137 7.86328 45.5032 8.00012 45.1732 8.27379C44.8472
|
|
41
|
+
8.54344 44.6037 8.90566 44.4427 9.36044C44.2817 9.81522 44.2012 10.3263 44.2012 10.8938C44.2012 11.4532 44.2817
|
|
42
|
+
11.9624 44.4427 12.4212C44.6037 12.8759 44.8472 13.2382 45.1732 13.5078C45.5032 13.7734 45.9137 13.9062 46.4047
|
|
43
|
+
13.9062ZM52.0836 15.5V6.22727H54.2388V7.77876H54.3354C54.5044 7.23947 54.7942 6.82493 55.2047 6.53516C55.6192
|
|
44
|
+
6.24136 56.0921 6.09446 56.6234 6.09446C56.7441 6.09446 56.8789 6.1005 57.0279 6.11257C57.1808 6.12062 57.3076
|
|
45
|
+
6.13672 57.4082 6.16087V8.19531C57.3116 8.16312 57.1627 8.13494 56.9614 8.1108C56.7602 8.08262 56.569 8.06854
|
|
46
|
+
56.3879 8.06854C55.9895 8.06854 55.6333 8.15305 55.3194 8.32209C55.0055 8.49112 54.758 8.72656 54.5769
|
|
47
|
+
9.02841C54.3998 9.33026 54.3112 9.67637 54.3112 10.0668V15.5H52.0836ZM59.9101 18.9773C59.6123 18.9773 59.3346
|
|
48
|
+
18.9531 59.077 18.9048C58.8235 18.8606 58.6202 18.8062 58.4673 18.7418L58.9804 17.0213C59.2984 17.1139 59.5821
|
|
49
|
+
17.1581 59.8316 17.1541C60.0812 17.1541 60.3005 17.0797 60.4897 16.9308C60.6788 16.7818 60.8378 16.5363 60.9666
|
|
50
|
+
16.1942L61.1537 15.6992L57.7912 6.22727H60.1516L62.2645 13.212H62.3611L64.4861 6.22727H66.8526L63.1459
|
|
51
|
+
16.6108C62.9729 17.1018 62.7435 17.5244 62.4577 17.8786C62.172 18.2327 61.8198 18.5044 61.4012 18.6935C60.9827
|
|
52
|
+
18.8827 60.4856 18.9773 59.9101 18.9773ZM75.1153 8.70241L73.0808 8.90767C73.0285 8.70644 72.9319 8.51929 72.7911
|
|
53
|
+
8.34624C72.6542 8.16915 72.4691 8.02628 72.2357 7.91761C72.0063 7.80895 71.7266 7.75462 71.3965 7.75462C70.9458
|
|
54
|
+
7.75462 70.5675 7.85322 70.2616 8.05043C69.9598 8.24361 69.8088 8.49515 69.8088 8.80504C69.8088 9.06664 69.9094
|
|
55
|
+
9.28196 70.1107 9.45099C70.3119 9.62003 70.6439 9.75687 71.1068 9.86151L72.7005 10.1996C73.5779 10.3887 74.2319
|
|
56
|
+
10.6906 74.6625 11.1051C75.0932 11.5156 75.3105 12.0509 75.3145 12.7109C75.3105 13.2985 75.1394 13.8157 74.8014
|
|
57
|
+
14.2624C74.4633 14.7092 73.9944 15.0573 73.3948 15.3068C72.7991 15.5563 72.1129 15.6811 71.3362 15.6811C70.1932
|
|
58
|
+
15.6811 69.2736 15.4416 68.5773 14.9627C67.8851 14.4798 67.4705 13.8097 67.3337 12.9524L69.507 12.7592C69.5995
|
|
59
|
+
13.1697 69.8028 13.4817 70.1167 13.695C70.4306 13.9042 70.8351 14.0089 71.3301 14.0089C71.8453 14.0089 72.2578
|
|
60
|
+
13.9062 72.5677 13.701C72.8816 13.4917 73.0386 13.2301 73.0386 12.9162C73.0386 12.6546 72.936 12.4393 72.7307
|
|
61
|
+
12.2702C72.5295 12.0972 72.2176 11.9664 71.795 11.8778L70.2073 11.5458C69.3178 11.3607 68.6598 11.0488 68.2332
|
|
62
|
+
10.6101C67.8066 10.1674 67.5933 9.60795 67.5933 8.93182C67.5933 8.3563 67.7502 7.85724 68.0642 7.43466C68.3821
|
|
63
|
+
7.01207 68.8248 6.68608 69.3923 6.45668C69.9598 6.22325 70.6178 6.10653 71.3664 6.10653C72.4611 6.10653 73.3223
|
|
64
|
+
6.33996 73.9502 6.80682C74.582 7.27367 74.9704 7.90554 75.1153 8.70241ZM81.1564
|
|
65
|
+
6.22727V7.94176H75.8077V6.22727H81.1564ZM77.1116 4.00568H79.3393V12.7049C79.3393 12.9947 79.3835 13.216 79.4721
|
|
66
|
+
13.369C79.5606 13.5179 79.6773 13.6205 79.8222 13.6768C79.9711 13.7332 80.1361 13.7614 80.3173 13.7614C80.4501
|
|
67
|
+
13.7614 80.5728 13.7513 80.6855 13.7312C80.8022 13.7111 80.8928 13.695 80.9572 13.6829L81.3254 15.4034C81.2087
|
|
68
|
+
15.4437 81.0417 15.4879 80.8244 15.5362C80.607 15.5885 80.3434 15.6187 80.0335 15.6268C79.4781 15.6429 78.9791
|
|
69
|
+
15.5604 78.5364 15.3793C78.0977 15.1941 77.7495 14.9084 77.492 14.522C77.2384 14.1357 77.1116 13.6487 77.1116
|
|
70
|
+
13.0611V4.00568ZM82.3755 15.5V6.22727H84.6031V15.5H82.3755ZM83.4984 4.9233C83.1482 4.9233 82.8464 4.80658
|
|
71
|
+
82.5928 4.57315C82.3433 4.33973 82.2185 4.058 82.2185 3.72798C82.2185 3.39796 82.3433 3.11624 82.5928
|
|
72
|
+
2.88281C82.8464 2.64536 83.1482 2.52663 83.4984 2.52663C83.8485 2.52663 84.1483 2.64536 84.3979 2.88281C84.6474
|
|
73
|
+
3.11624 84.7721 3.39796 84.7721 3.72798C84.7721 4.058 84.6474 4.33973 84.3979 4.57315C84.1483 4.80658 83.8485
|
|
74
|
+
4.9233 83.4984 4.9233ZM90.2926 15.6811C89.3669 15.6811 88.57 15.4779 87.9019 15.0714C87.2379 14.6649 86.7267
|
|
75
|
+
14.1035 86.3685 13.3871C86.0144 12.6667 85.8373 11.8376 85.8373 10.8999C85.8373 9.95407 86.0184 9.12098 86.3806
|
|
76
|
+
8.40057C86.7428 7.68016 87.256 7.11873 87.92 6.71626C88.5841 6.30978 89.3689 6.10653 90.2744 6.10653C91.0351
|
|
77
|
+
6.10653 91.7072 6.24538 92.2908 6.52308C92.8744 6.80078 93.3392 7.19117 93.6853 7.69425C94.0355 8.19732 94.2347
|
|
78
|
+
8.78693 94.283 9.46307H92.158C92.0775 9.01231 91.8783 8.63802 91.5603 8.3402C91.2464 8.04238 90.8298 7.89347
|
|
79
|
+
90.3107 7.89347C89.868 7.89347 89.4796 8.01219 89.1455 8.24964C88.8115 8.4871 88.5519 8.82718 88.3668
|
|
80
|
+
9.26989C88.1857 9.71259 88.0951 10.2438 88.0951 10.8636C88.0951 11.4915 88.1857 12.0308 88.3668 12.4815C88.5479
|
|
81
|
+
12.9283 88.8055 13.2724 89.1395 13.5138C89.4735 13.7553 89.8639 13.8761 90.3107 13.8761C90.6286 13.8761 90.9144
|
|
82
|
+
13.8157 91.1679 13.695C91.4255 13.5702 91.6388 13.3911 91.8078 13.1577C91.9809 12.9242 92.0976 12.6405 92.158
|
|
83
|
+
12.3065H94.283C94.2306 12.9705 94.0355 13.5561 93.6974 14.0632C93.3633 14.5703 92.9065 14.9667 92.327
|
|
84
|
+
15.2525C91.7515 15.5382 91.0733 15.6811 90.2926 15.6811ZM97.4912 12.6143L97.4852 9.92791H97.8353L101.132
|
|
85
|
+
6.22727H103.727L99.6404 10.8033H99.1755L97.4912 12.6143ZM95.4628 15.5V3.13636H97.6905V15.5H95.4628ZM101.282
|
|
86
|
+
15.5L98.2881 11.2983L99.7913 9.72869L103.939 15.5H101.282Z`;
|
|
87
|
+
export const PREVIEW_PAGE_BRAND_HTML = `<div data-ss-preview-page-brand><svg viewBox="${STORYSTICK_WORDMARK_VIEW_BOX}" fill="currentColor" role="img" aria-label="Storystick"><rect y="${STORYSTICK_MARK_RECT.y}" width="${STORYSTICK_MARK_RECT.width}" height="${STORYSTICK_MARK_RECT.height}" rx="${STORYSTICK_MARK_RECT.rx}" /><path d="${STORYSTICK_MARK_PATHS[0]}" /><path d="${STORYSTICK_MARK_PATHS[1]}" /><path d="${STORYSTICK_WORDMARK_LETTERING}" /></svg></div>`;
|
|
10
88
|
export const PREVIEW_PAGE_STYLES = `
|
|
11
89
|
[data-ss-preview-page] { box-sizing: border-box; display: flex; min-height: 100svh; width: 100%; padding: 32px 24px; background: var(--ss-surface-page, #fff); color: var(--ss-text-primary, oklch(.2 .007 258.364)); font: 400 14px/20px "Storystick Inter", "Inter Variable", ui-sans-serif, system-ui, sans-serif; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; color-scheme: light; }
|
|
12
90
|
[data-ss-preview-page-content] { width: 100%; max-width: 360px; margin: auto; text-align: center; overflow-wrap: anywhere; }
|
|
13
|
-
[data-ss-preview-page-brand] { display: flex; align-items: center; justify-content: center;
|
|
14
|
-
[data-ss-preview-page-brand] svg { flex: none; width:
|
|
91
|
+
[data-ss-preview-page-brand] { display: flex; align-items: center; justify-content: center; margin-bottom: 32px; }
|
|
92
|
+
[data-ss-preview-page-brand] svg { flex: none; width: auto; height: 16px; }
|
|
15
93
|
[data-ss-preview-page-heading] { display: flex; align-items: center; justify-content: center; gap: 10px; }
|
|
16
94
|
[data-ss-preview-page-title] { margin: 0; color: inherit; font: inherit; font-size: 20px; line-height: 28px; font-weight: 500; letter-spacing: -.025em; text-wrap: balance; }
|
|
17
95
|
[data-ss-preview-page-description] { margin: 12px 0 0; color: var(--ss-text-secondary, oklch(.471 .006 258.364)); font: inherit; text-wrap: pretty; }
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type EditorialAnchor, type EditorialTarget } from "@storystick/types/editorial-target";
|
|
2
|
+
import type { PreviewPerspective } from "@storystick/types/preview-query-targeting";
|
|
3
|
+
import type { PreviewCommentAvatar, PreviewOverlayMapPayload } from "@storystick/transport-allowlist";
|
|
4
|
+
import type { PreviewOverlayClickTarget } from "./overlay-projection.js";
|
|
5
|
+
/** Private metadata supplied by an admitted authoring host, never by page content. */
|
|
6
|
+
export interface PreviewCommentMarkers {
|
|
7
|
+
target: EditorialTarget;
|
|
8
|
+
markers: Array<{
|
|
9
|
+
anchor: EditorialAnchor;
|
|
10
|
+
unread: boolean;
|
|
11
|
+
participants?: Array<PreviewCommentAvatar & {
|
|
12
|
+
userId: string;
|
|
13
|
+
}>;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare function uniqueCommentParticipants<T extends {
|
|
17
|
+
userId: string;
|
|
18
|
+
}>(participants: Iterable<T>): T[];
|
|
19
|
+
export declare function previewCommentCount(address: PreviewOverlayClickTarget, state: PreviewCommentMarkers | null, perspective: PreviewPerspective | null): {
|
|
20
|
+
count: number;
|
|
21
|
+
unread: boolean;
|
|
22
|
+
};
|
|
23
|
+
export declare function withPreviewCommentMarkers(payload: PreviewOverlayMapPayload, targets: ReadonlyMap<string, PreviewOverlayClickTarget>, state: PreviewCommentMarkers | null, perspective: PreviewPerspective | null): PreviewOverlayMapPayload;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { editorialAnchorKey, editorialPathFromNavigation, } from "@storystick/types/editorial-target";
|
|
2
|
+
import { overlayEditorLocale, overlayEditorTarget } from "./editor-target.js";
|
|
3
|
+
export function uniqueCommentParticipants(participants) {
|
|
4
|
+
const unique = new Map();
|
|
5
|
+
for (const person of participants) {
|
|
6
|
+
if (!unique.has(person.userId))
|
|
7
|
+
unique.set(person.userId, person);
|
|
8
|
+
if (unique.size === 3)
|
|
9
|
+
break;
|
|
10
|
+
}
|
|
11
|
+
return [...unique.values()];
|
|
12
|
+
}
|
|
13
|
+
function matchingCommentMarkers(address, state, perspective) {
|
|
14
|
+
const navigation = overlayEditorTarget(address);
|
|
15
|
+
if (!state ||
|
|
16
|
+
!perspective ||
|
|
17
|
+
address.sourceKind === "model" ||
|
|
18
|
+
address.documentId !== state.target.documentId ||
|
|
19
|
+
navigation.kind !== "field" ||
|
|
20
|
+
(overlayEditorLocale(address, state.target.locale) ?? "default") !==
|
|
21
|
+
state.target.locale)
|
|
22
|
+
return [];
|
|
23
|
+
const scope = state.target.scope;
|
|
24
|
+
if (perspective.kind === "published"
|
|
25
|
+
? scope.kind !== "published"
|
|
26
|
+
: scope.kind === "published")
|
|
27
|
+
return [];
|
|
28
|
+
if (perspective.kind !== "published") {
|
|
29
|
+
const variantId = address.variantId ?? address.readScope?.appliedVariantId ?? null;
|
|
30
|
+
const releaseId = address.readScope?.appliedReleaseId ?? null;
|
|
31
|
+
if (variantId
|
|
32
|
+
? scope.kind !== "variant" || scope.variantId !== variantId
|
|
33
|
+
: releaseId
|
|
34
|
+
? scope.kind !== "release" || scope.releaseId !== releaseId
|
|
35
|
+
: scope.kind !== "living")
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const path = editorialPathFromNavigation(navigation.path, navigation.anchors);
|
|
39
|
+
if (!path)
|
|
40
|
+
return [];
|
|
41
|
+
const key = editorialAnchorKey({ kind: "field", path });
|
|
42
|
+
const rows = state.markers.filter((m) => m.anchor.kind !== "document" &&
|
|
43
|
+
editorialAnchorKey({ kind: "field", path: m.anchor.path }) === key);
|
|
44
|
+
return rows;
|
|
45
|
+
}
|
|
46
|
+
export function previewCommentCount(address, state, perspective) {
|
|
47
|
+
const rows = matchingCommentMarkers(address, state, perspective);
|
|
48
|
+
return { count: rows.length, unread: rows.some(row => row.unread) };
|
|
49
|
+
}
|
|
50
|
+
export function withPreviewCommentMarkers(payload, targets, state, perspective) {
|
|
51
|
+
return {
|
|
52
|
+
...payload,
|
|
53
|
+
items: payload.items.map((item) => {
|
|
54
|
+
const address = targets.get(item.paintKey);
|
|
55
|
+
const rows = address ? matchingCommentMarkers(address, state, perspective) : [];
|
|
56
|
+
return {
|
|
57
|
+
...item,
|
|
58
|
+
commentCount: rows.length,
|
|
59
|
+
commentUnread: rows.some(row => row.unread),
|
|
60
|
+
commentAvatars: uniqueCommentParticipants(rows.flatMap(row => row.participants ?? []))
|
|
61
|
+
.map(({ userId: _userId, ...avatar }) => avatar),
|
|
62
|
+
};
|
|
63
|
+
}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { normalizePreviewVariantId } from '../identity/preview-identity.js';
|
|
2
2
|
import { hasCoherentPreviewProvenanceSourceIdentity } from './source-identity.js';
|
|
3
|
+
import { sha256Bytes } from '../sha256.js';
|
|
3
4
|
export async function createDirectEditMarkerId(input) {
|
|
4
5
|
const payload = JSON.stringify([
|
|
5
6
|
input.sessionId ?? null,
|
|
@@ -11,8 +12,7 @@ export async function createDirectEditMarkerId(input) {
|
|
|
11
12
|
input.renderId,
|
|
12
13
|
input.sourceSetId,
|
|
13
14
|
]);
|
|
14
|
-
|
|
15
|
-
return `p_${base64url(new Uint8Array(digest)).slice(0, 22)}`;
|
|
15
|
+
return `p_${base64url(await sha256Bytes(payload)).slice(0, 22)}`;
|
|
16
16
|
}
|
|
17
17
|
export function validateProvenanceFrame(frame, authoritativeSet) {
|
|
18
18
|
if (frame.routeHash !== authoritativeSet.routeHash)
|
|
@@ -2213,5 +2213,8 @@ export const previewProvenanceRuntimeScript = /* @__PURE__ */ (() => String.raw
|
|
|
2213
2213
|
// to replay its current contract only after our message listener is installed;
|
|
2214
2214
|
// a previously posted render-mode cannot establish this reporter's identity.
|
|
2215
2215
|
if (window.parent !== window) window.parent.postMessage({ type: 'ready' }, studioTargetOrigin())
|
|
2216
|
+
// The entry flag guards against duplicate partial installations; completion
|
|
2217
|
+
// is separate so the framework loader can distinguish load from execution.
|
|
2218
|
+
window.__ssPreviewProvenanceRuntimeReady = true
|
|
2216
2219
|
})()
|
|
2217
2220
|
`)();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PreviewProvenanceReadLifecycle } from '@storystick/client/internal';
|
|
2
|
+
import type { PreviewProvenanceEditableTextPathManifest } from './provenance/editable-leaf.js';
|
|
3
|
+
import { type PreviewPrimaryPage } from './provenance/read-carrier.js';
|
|
4
|
+
/** Public render rules, never credentials or proof that a browser read occurred. */
|
|
5
|
+
export interface PreviewQueryRenderDefinition {
|
|
6
|
+
readonly version: 1;
|
|
7
|
+
readonly codeVersion: string;
|
|
8
|
+
readonly manifest: PreviewProvenanceEditableTextPathManifest;
|
|
9
|
+
/** Explicit route identity; attached only when that document is read again. */
|
|
10
|
+
readonly primaryPage?: PreviewPrimaryPage;
|
|
11
|
+
}
|
|
12
|
+
/** Use the same provenance preparation after a fresh, authenticated browser read. */
|
|
13
|
+
export declare function createPreviewQueryReadLifecycle(definition: PreviewQueryRenderDefinition, projectId: string): PreviewProvenanceReadLifecycle;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createPreviewReadLifecycle } from './server/read-lifecycle.js';
|
|
2
|
+
import { selectPreviewPrimaryPage } from './provenance/read-carrier.js';
|
|
3
|
+
/** Use the same provenance preparation after a fresh, authenticated browser read. */
|
|
4
|
+
export function createPreviewQueryReadLifecycle(definition, projectId) {
|
|
5
|
+
if (definition.version !== 1 || typeof definition.codeVersion !== 'string' ||
|
|
6
|
+
!definition.codeVersion || !definition.manifest || typeof definition.manifest !== 'object') {
|
|
7
|
+
throw new TypeError('Invalid Preview query render definition.');
|
|
8
|
+
}
|
|
9
|
+
if (definition.primaryPage && !selectPreviewPrimaryPage([definition.primaryPage], definition.primaryPage.publicPathname))
|
|
10
|
+
throw new TypeError('Invalid Preview primary page.');
|
|
11
|
+
const runtime = {
|
|
12
|
+
config: {
|
|
13
|
+
isEnabled: () => true,
|
|
14
|
+
isProduction: () => true,
|
|
15
|
+
resolveCodeVersion: () => definition.codeVersion,
|
|
16
|
+
resolveSemanticManifest: async () => definition.manifest,
|
|
17
|
+
resolveSemanticConfig: () => ({ enabled: true, fixtureEnabled: false,
|
|
18
|
+
sessionId: '', codeVersion: definition.codeVersion, fixture: null }),
|
|
19
|
+
},
|
|
20
|
+
recorder: {
|
|
21
|
+
markNoStore: () => { },
|
|
22
|
+
readSessionId: async () => null,
|
|
23
|
+
resolveRouteIdentity: async () => {
|
|
24
|
+
throw new Error('Browser query provenance requires its own read context.');
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
// Each mounted query owns its reads; no cross-query raw-response cache.
|
|
29
|
+
return createPreviewReadLifecycle({
|
|
30
|
+
projectId, endpoint: '', runtime, rawReadCache: new Map(),
|
|
31
|
+
primaryPage: definition.primaryPage,
|
|
32
|
+
});
|
|
33
|
+
}
|
package/dist/runtime/boot.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { bootSchema, startSchemaRetryLoop } from "./schema-store.js";
|
|
24
24
|
import { previewRuntime } from "./store.js";
|
|
25
|
-
import { applyPreviewOverlayMap, clearPreviewOverlayPaint, installPreviewEditInteractionGuard, revealPreviewV2SourceInIframe, } from "./preview-overlay-painter.js";
|
|
25
|
+
import { applyPreviewOverlayMap, clearPreviewOverlayPaint, dismissPreviewOverlayMenu, installPreviewEditInteractionGuard, revealPreviewV2SourceInIframe, } from "./preview-overlay-painter.js";
|
|
26
26
|
import { installPreviewWorkspaceShortcuts } from "./workspace-shortcuts.js";
|
|
27
27
|
import { installMomentaryNavigateKeyRelay } from "./momentary-navigate.js";
|
|
28
28
|
import { validateOverlayClear, validateOverlayMap, validatePreviewV2RevealSource, } from "../validators.js";
|
|
@@ -211,6 +211,20 @@ export function bootIframeRuntime(opts) {
|
|
|
211
211
|
const rawType = data !== null && typeof data === "object"
|
|
212
212
|
? data.type
|
|
213
213
|
: null;
|
|
214
|
+
if (rawType === "storystick.preview.host-interaction") {
|
|
215
|
+
const identity = previewRuntime.getState().identity;
|
|
216
|
+
if (identity === null || identity.parentOrigin === null)
|
|
217
|
+
return;
|
|
218
|
+
const base = validatePreviewEnvelope(data);
|
|
219
|
+
if (!base.ok || base.message.type !== "storystick.preview.host-interaction")
|
|
220
|
+
return;
|
|
221
|
+
if (ev.source !== view.parent || ev.origin !== identity.parentOrigin)
|
|
222
|
+
return;
|
|
223
|
+
if (base.message.sessionId !== identity.sessionId || base.message.projectId !== identity.projectId)
|
|
224
|
+
return;
|
|
225
|
+
dismissPreviewOverlayMenu();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
214
228
|
if (rawType === "storystick.preview.interaction-mode") {
|
|
215
229
|
const identity = previewRuntime.getState().identity;
|
|
216
230
|
if (identity === null || identity.parentOrigin === null)
|
|
@@ -2,6 +2,8 @@ import { decodePreviewProvenanceText, encodePreviewProvenanceText } from '@story
|
|
|
2
2
|
import { PREVIEW_LIVE_QUERY_MAX_QUERIES, PREVIEW_NAMESPACE, PREVIEW_PROTOCOL_VERSION, validatePreviewEnvelope, } from '@storystick/transport-allowlist';
|
|
3
3
|
import { estimatePreviewPayloadBytes, recordPreviewPerfMetric, } from './perf-metrics.js';
|
|
4
4
|
import { createPreviewRequestId } from './request-id.js';
|
|
5
|
+
import { decodePreviewReadCarrier, encodePreviewReadCarrier } from '../provenance/read-carrier.js';
|
|
6
|
+
import { fingerprintRenderedText } from '../provenance/normalize.js';
|
|
5
7
|
const NOOP_HANDLE = Object.freeze({
|
|
6
8
|
queryInstanceId: null,
|
|
7
9
|
getSnapshot: () => null,
|
|
@@ -375,9 +377,27 @@ function carryTextAddresses(previous, next) {
|
|
|
375
377
|
if (typeof previous === 'string' && typeof next === 'string') {
|
|
376
378
|
const { segments } = decodePreviewProvenanceText(previous);
|
|
377
379
|
const segment = segments.length === 1 ? segments[0] : undefined;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
380
|
+
if (segment?.markerStart !== 0 || segment.markerEnd !== previous.length) {
|
|
381
|
+
// Rich text is transported as JSON, with an address on each text leaf,
|
|
382
|
+
// not on the serialized document as a whole.
|
|
383
|
+
try {
|
|
384
|
+
const before = JSON.parse(previous), after = JSON.parse(next);
|
|
385
|
+
if (isRecord(before) && before.type === 'doc' && isRecord(after) && after.type === 'doc') {
|
|
386
|
+
return JSON.stringify(carryRichTextAddresses(before, after));
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
catch { /* An ordinary string has no nested addresses. */ }
|
|
390
|
+
return next;
|
|
391
|
+
}
|
|
392
|
+
const text = decodePreviewProvenanceText(next).text;
|
|
393
|
+
const carrier = decodePreviewReadCarrier(segment.markerId);
|
|
394
|
+
const marker = carrier?.sidecar.markers[0];
|
|
395
|
+
const markerId = carrier && marker
|
|
396
|
+
? encodePreviewReadCarrier(carrier.frameId, carrier.sidecar, {
|
|
397
|
+
...marker, renderedTextFingerprint: fingerprintRenderedText(text),
|
|
398
|
+
}, carrier.primaryPage)
|
|
399
|
+
: segment.markerId;
|
|
400
|
+
return encodePreviewProvenanceText(markerId, text);
|
|
381
401
|
}
|
|
382
402
|
if (Array.isArray(previous) && Array.isArray(next)) {
|
|
383
403
|
const keyOf = (value) => isRecord(value) && typeof value._key === 'string'
|
|
@@ -398,10 +418,99 @@ function carryTextAddresses(previous, next) {
|
|
|
398
418
|
});
|
|
399
419
|
}
|
|
400
420
|
if (isRecord(previous) && isRecord(next)) {
|
|
421
|
+
if (previous.type === 'doc' && next.type === 'doc')
|
|
422
|
+
return carryRichTextAddresses(previous, next);
|
|
401
423
|
// A replacement model/variation has different field ownership.
|
|
402
424
|
if (previous._type !== next._type || previous._model !== next._model || previous._variation !== next._variation)
|
|
403
425
|
return next;
|
|
404
|
-
|
|
426
|
+
const result = Object.fromEntries(Object.entries(next).map(([key, value]) => [key, carryTextAddresses(previous[key], value)]));
|
|
427
|
+
// Object addresses (images, links) are public read metadata, not authored
|
|
428
|
+
// fields. The live value omits them, but does not change this field's owner.
|
|
429
|
+
const marker = previous._ssMarker;
|
|
430
|
+
if (isRecord(marker) && marker.v === 'ss-marker-1' && typeof marker.m === 'string') {
|
|
431
|
+
result._ssMarker = marker;
|
|
432
|
+
}
|
|
433
|
+
return result;
|
|
405
434
|
}
|
|
406
435
|
return next;
|
|
407
436
|
}
|
|
437
|
+
/** Text ordinals describe a rendering, not an identity. Rebuild them from the
|
|
438
|
+
* live document using its attested field owner, so splitting one text leaf
|
|
439
|
+
* cannot invalidate every following paragraph. Never combine distinct owners. */
|
|
440
|
+
function carryRichTextAddresses(previous, next) {
|
|
441
|
+
const before = new Map();
|
|
442
|
+
const nodes = new Map();
|
|
443
|
+
let owner;
|
|
444
|
+
let ownerKey;
|
|
445
|
+
let mixedOwners = false;
|
|
446
|
+
const carriers = new Map();
|
|
447
|
+
function walk(node, path, state, collect) {
|
|
448
|
+
if (!isRecord(node))
|
|
449
|
+
return node;
|
|
450
|
+
const embed = node.type === 'sliceEmbed' ? state.embed++ : -1;
|
|
451
|
+
if (collect)
|
|
452
|
+
nodes.set(path, { node, embed });
|
|
453
|
+
if (node.type === 'text') {
|
|
454
|
+
const ordinal = state.ordinal++;
|
|
455
|
+
if (typeof node.text !== 'string')
|
|
456
|
+
return node;
|
|
457
|
+
if (collect) {
|
|
458
|
+
before.set(path, { text: node.text, ordinal });
|
|
459
|
+
const decoded = decodePreviewProvenanceText(node.text);
|
|
460
|
+
const segment = decoded.segments[0];
|
|
461
|
+
const carrier = decoded.segments.length === 1 && segment?.markerStart === 0 && segment.markerEnd === node.text.length
|
|
462
|
+
? decodePreviewReadCarrier(segment.markerId) : null;
|
|
463
|
+
const locator = carrier?.sidecar.markers[0]?.editLocator;
|
|
464
|
+
if (carrier && locator?.sourceKind === 'richtext') {
|
|
465
|
+
const { textNodeIndex: _index, sourceSetId: _sourceSet, ...fieldOwner } = locator;
|
|
466
|
+
const key = JSON.stringify([carrier.frameId, carrier.sidecar.dependencySet, fieldOwner]);
|
|
467
|
+
if (ownerKey !== undefined && ownerKey !== key)
|
|
468
|
+
mixedOwners = true;
|
|
469
|
+
ownerKey = key;
|
|
470
|
+
owner ??= carrier;
|
|
471
|
+
carriers.set(ordinal, carrier);
|
|
472
|
+
}
|
|
473
|
+
return node;
|
|
474
|
+
}
|
|
475
|
+
if (owner && !mixedOwners) {
|
|
476
|
+
const carrier = carriers.get(ordinal) ?? owner;
|
|
477
|
+
const marker = carrier.sidecar.markers[0];
|
|
478
|
+
const text = decodePreviewProvenanceText(node.text).text;
|
|
479
|
+
const markerId = carriers.has(ordinal) ? marker.markerId : `live_richtext_${fingerprintRenderedText(JSON.stringify([ownerKey, ordinal]))}`;
|
|
480
|
+
return { ...node, text: encodePreviewProvenanceText(encodePreviewReadCarrier(carrier.frameId, carrier.sidecar, {
|
|
481
|
+
...marker, markerId,
|
|
482
|
+
editLocator: { ...marker.editLocator, textNodeIndex: ordinal },
|
|
483
|
+
renderedTextFingerprint: fingerprintRenderedText(text),
|
|
484
|
+
}, carrier.primaryPage), text) };
|
|
485
|
+
}
|
|
486
|
+
const old = before.get(path);
|
|
487
|
+
return old?.ordinal === ordinal
|
|
488
|
+
? { ...node, text: carryTextAddresses(old.text, node.text) }
|
|
489
|
+
: node;
|
|
490
|
+
}
|
|
491
|
+
let result = node;
|
|
492
|
+
const old = nodes.get(path);
|
|
493
|
+
if (!collect && embed >= 0 && old?.embed === embed && isRecord(old.node.attrs) && isRecord(node.attrs)) {
|
|
494
|
+
// Embed locators include their ordinal. Carry nested image/link addresses
|
|
495
|
+
// only for the same keyed embed at the same ordinal and variation.
|
|
496
|
+
result = { ...node, attrs: carryTextAddresses(old.node.attrs, node.attrs) };
|
|
497
|
+
}
|
|
498
|
+
if (!Array.isArray(node.content))
|
|
499
|
+
return result;
|
|
500
|
+
const keys = node.content.map((child, index) => {
|
|
501
|
+
const attrs = isRecord(child) && isRecord(child.attrs) ? child.attrs : null;
|
|
502
|
+
return typeof attrs?._key === 'string' ? `key:${attrs._key}` : `index:${index}`;
|
|
503
|
+
});
|
|
504
|
+
const counts = new Map();
|
|
505
|
+
keys.forEach(key => counts.set(key, (counts.get(key) ?? 0) + 1));
|
|
506
|
+
const content = node.content.map((child, index) => {
|
|
507
|
+
const type = isRecord(child) ? child.type : null;
|
|
508
|
+
// Duplicated authored keys cannot establish an unambiguous owner.
|
|
509
|
+
const key = counts.get(keys[index]) === 1 ? keys[index] : `${collect ? 'old' : 'new'}:${index}`;
|
|
510
|
+
return walk(child, `${path}/${JSON.stringify([key, type])}`, state, collect);
|
|
511
|
+
});
|
|
512
|
+
return collect ? node : { ...result, content };
|
|
513
|
+
}
|
|
514
|
+
walk(previous, '', { ordinal: 0, embed: 0 }, true);
|
|
515
|
+
return walk(next, '', { ordinal: 0, embed: 0 }, false);
|
|
516
|
+
}
|
|
@@ -5,7 +5,8 @@ const INTERACTION_ATTR = "data-ss-preview-interaction";
|
|
|
5
5
|
// `:root` is stable state-free specificity. It keeps the policy above common
|
|
6
6
|
// customer utility classes that also declare an `!important` cursor, without
|
|
7
7
|
// putting any mutable interaction state back on a React-owned singleton.
|
|
8
|
-
|
|
8
|
+
function editInteractionCss() {
|
|
9
|
+
return `
|
|
9
10
|
html:root,
|
|
10
11
|
html:root body,
|
|
11
12
|
html:root body * {
|
|
@@ -14,6 +15,7 @@ const EDIT_INTERACTION_CSS = `
|
|
|
14
15
|
user-select: none !important;
|
|
15
16
|
}
|
|
16
17
|
`;
|
|
18
|
+
}
|
|
17
19
|
const POLICY_STATE_KEY = Symbol.for("storystick.preview.interaction-policy-state.v1");
|
|
18
20
|
export function installPreviewInteractionPolicy(win) {
|
|
19
21
|
const existing = getPolicyInstallation(win);
|
|
@@ -76,7 +78,7 @@ function applyInteractionMode(doc, mode) {
|
|
|
76
78
|
// remains the default across every route commit. Browse opts out by leaving
|
|
77
79
|
// the policy stylesheet empty, preserving the customer's own cursor rules.
|
|
78
80
|
style.setAttribute(INTERACTION_ATTR, mode);
|
|
79
|
-
const nextCss = mode === "edit" ?
|
|
81
|
+
const nextCss = mode === "edit" ? editInteractionCss() : "";
|
|
80
82
|
if (style.textContent !== nextCss)
|
|
81
83
|
style.textContent = nextCss;
|
|
82
84
|
}
|
|
@@ -23,5 +23,6 @@ export interface PreviewV2RevealResult {
|
|
|
23
23
|
}
|
|
24
24
|
export declare function applyPreviewOverlayMap(payload: PreviewOverlayMapPayload, win: Window, options?: PreviewOverlayPainterOptions | ((payload: PreviewOverlayClickPayload) => void)): PreviewOverlayPaintResult;
|
|
25
25
|
export declare function clearPreviewOverlayPaint(): void;
|
|
26
|
+
export declare function dismissPreviewOverlayMenu(): void;
|
|
26
27
|
export declare function installPreviewEditInteractionGuard(win: Window, options?: PreviewEditInteractionGuardOptions): () => void;
|
|
27
28
|
export declare function revealPreviewV2SourceInIframe(payload: PreviewV2RevealSourcePayload, win: Window): PreviewV2RevealResult;
|