@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
package/PUBLIC-API.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
# @storystick/preview API contract
|
|
2
2
|
|
|
3
|
-
Install this candidate explicitly with `@storystick/preview@0.2.0-rc.
|
|
3
|
+
Install this candidate explicitly with `@storystick/preview@0.2.0-rc.6` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
|
|
4
4
|
|
|
5
|
-
Version 0.2.0-rc.
|
|
5
|
+
Version 0.2.0-rc.6, cohort `sdk-0.2.0-rc.8`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
|
|
6
6
|
|
|
7
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
8
|
|
|
9
9
|
| Entry | Status |
|
|
10
10
|
| --- | --- |
|
|
11
|
+
| `./provenance/comment-markers` | Reserved SDK contract |
|
|
11
12
|
| `.` | Reserved SDK contract |
|
|
12
13
|
| `./runtime/store` | Reserved SDK contract |
|
|
13
14
|
| `./runtime/request-id` | Reserved SDK contract |
|
|
@@ -48,6 +49,7 @@ This package supports the integration facades; installing it directly is an adva
|
|
|
48
49
|
| `./server/*` | Reserved SDK contract |
|
|
49
50
|
| `./provenance/render-context` | Reserved SDK contract |
|
|
50
51
|
| `./provenance/slice-model` | Reserved SDK contract |
|
|
52
|
+
| `./query-render` | Reserved SDK contract |
|
|
51
53
|
|
|
52
54
|
Supported consumer Node versions: `^22.13.0 || ^24.19.0`. The release build toolchain remains 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
55
|
|
package/dist/.source-hash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
ef6958bd732af5b1c0635ec7ec883ee0f7e48cc0fd66bff5c1d9977a56096cf3
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { PreviewCommentMarkers } from '../provenance/comment-markers.js';
|
|
2
|
+
import type { EditorialAnchor } from '@storystick/types/editorial-target';
|
|
1
3
|
import { type StudioContentShapeDescriptor } from '@storystick/types';
|
|
2
4
|
import type { PreviewPerspective, PreviewReadContext } from '@storystick/types/preview-query-targeting';
|
|
3
5
|
import type { PreviewV2RevealSourceRequest, PreviewV2RevealSliceRequest } from '../provenance/reveal-contract.js';
|
|
4
6
|
import type { ImperativeEditorNavigationTarget } from '@storystick/types/editor-destination';
|
|
5
|
-
export declare const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION:
|
|
7
|
+
export declare const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION: 13;
|
|
6
8
|
export declare const STORYSTICK_AUTHORING_RUNTIME_GLOBAL: "StorystickAuthoringRuntime";
|
|
7
9
|
export declare const STORYSTICK_AUTHORING_RUNTIME_PATH: "/authoring-runtime/authoring-runtime.js";
|
|
8
10
|
export interface PreviewAuthoringAdmission {
|
|
@@ -42,7 +44,13 @@ export interface PreviewAuthoringPresentation {
|
|
|
42
44
|
pathname: string;
|
|
43
45
|
perspective: PreviewPerspective;
|
|
44
46
|
}
|
|
45
|
-
export type PreviewAuthoringSurface = 'editor' | 'assistant';
|
|
47
|
+
export type PreviewAuthoringSurface = 'editor' | 'assistant' | 'comments';
|
|
48
|
+
export interface PreviewCommentRequest {
|
|
49
|
+
intent?: 'create' | 'view';
|
|
50
|
+
target: PreviewAuthoringTarget;
|
|
51
|
+
anchor?: EditorialAnchor;
|
|
52
|
+
quote?: string;
|
|
53
|
+
}
|
|
46
54
|
export interface PreviewAuthoringRuntimeMountOptions {
|
|
47
55
|
root: ShadowRoot;
|
|
48
56
|
container: HTMLElement;
|
|
@@ -53,6 +61,8 @@ export interface PreviewAuthoringRuntimeMountOptions {
|
|
|
53
61
|
title: HTMLElement;
|
|
54
62
|
trailing: HTMLElement;
|
|
55
63
|
};
|
|
64
|
+
commentRequest?: PreviewCommentRequest;
|
|
65
|
+
onCommentMarkers?(state: PreviewCommentMarkers | null): void;
|
|
56
66
|
assistantThreadId?: string | null;
|
|
57
67
|
onSurface?(surface: PreviewAuthoringSurface): void;
|
|
58
68
|
onAssistantThread?(threadId: string | null): void;
|
|
@@ -82,6 +92,7 @@ export declare function isPreviewAuthoringAdmission(value: unknown, now?: number
|
|
|
82
92
|
export type PreviewAuthoringRuntimeStatus = 'connecting' | 'ready' | 'unauthorized' | 'disposed';
|
|
83
93
|
export interface PreviewAuthoringRuntimeHandle {
|
|
84
94
|
setSurface(surface: PreviewAuthoringSurface | null): void;
|
|
95
|
+
openComments(request: PreviewCommentRequest): void;
|
|
85
96
|
/** A host observation may become obsolete while the current draft is saved. */
|
|
86
97
|
open(target: PreviewAuthoringTarget, isCurrent?: () => boolean): Promise<void>;
|
|
87
98
|
dispose(): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isStudioContentShapeDescriptor } from '@storystick/types';
|
|
2
|
-
export const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION =
|
|
2
|
+
export const STORYSTICK_AUTHORING_RUNTIME_CONTRACT_VERSION = 13;
|
|
3
3
|
export const STORYSTICK_AUTHORING_RUNTIME_GLOBAL = 'StorystickAuthoringRuntime';
|
|
4
4
|
export const STORYSTICK_AUTHORING_RUNTIME_PATH = '/authoring-runtime/authoring-runtime.js';
|
|
5
5
|
export function isPreviewAuthoringAdmission(value, now = Date.now()) {
|
package/dist/channel-taxonomy.js
CHANGED
|
@@ -26,6 +26,7 @@ export function classifyPreviewEnvelopeType(type) {
|
|
|
26
26
|
case 'storystick.preview.overlay-ready':
|
|
27
27
|
case 'storystick.preview.overlay-click':
|
|
28
28
|
case 'storystick.preview.iframe-interaction':
|
|
29
|
+
case 'storystick.preview.host-interaction':
|
|
29
30
|
return 'overlay';
|
|
30
31
|
case 'storystick.preview.v2.reveal-source':
|
|
31
32
|
case 'storystick.preview.v2.reveal-result':
|
|
@@ -52,25 +52,33 @@ export declare const PREVIEW_COPY: {
|
|
|
52
52
|
readonly title: "Connecting preview";
|
|
53
53
|
readonly body: "Connecting this site to Studio.";
|
|
54
54
|
};
|
|
55
|
+
readonly "connection-delayed": {
|
|
56
|
+
readonly title: "Preview is taking longer";
|
|
57
|
+
readonly body: "We’re still waiting for the preview connection.";
|
|
58
|
+
};
|
|
59
|
+
readonly "connection-unconfirmed": {
|
|
60
|
+
readonly title: "Preview couldn’t connect";
|
|
61
|
+
readonly body: "The site didn’t confirm its connection to Studio. Check that it is running and accessible, then retry.";
|
|
62
|
+
};
|
|
55
63
|
readonly "workspace-creating": {
|
|
56
|
-
readonly title: "Starting
|
|
57
|
-
readonly body: "Preparing the
|
|
64
|
+
readonly title: "Starting computer";
|
|
65
|
+
readonly body: "Preparing the computer for this working version.";
|
|
58
66
|
};
|
|
59
67
|
readonly "workspace-restoring": {
|
|
60
|
-
readonly title: "
|
|
61
|
-
readonly body: "Restoring
|
|
68
|
+
readonly title: "Waking computer";
|
|
69
|
+
readonly body: "Restoring its saved work.";
|
|
62
70
|
};
|
|
63
71
|
readonly "workspace-installing": {
|
|
64
|
-
readonly title: "Preparing
|
|
65
|
-
readonly body: "Installing the project’s dependencies. The first
|
|
72
|
+
readonly title: "Preparing computer";
|
|
73
|
+
readonly body: "Installing the project’s dependencies. The first wake can take longer.";
|
|
66
74
|
};
|
|
67
75
|
readonly "workspace-checking": {
|
|
68
76
|
readonly title: "Checking the project";
|
|
69
77
|
readonly body: "Checking this version before starting the site.";
|
|
70
78
|
};
|
|
71
79
|
readonly "workspace-launching": {
|
|
72
|
-
readonly title: "Starting
|
|
73
|
-
readonly body: "
|
|
80
|
+
readonly title: "Starting preview";
|
|
81
|
+
readonly body: "Launching the site on this computer.";
|
|
74
82
|
};
|
|
75
83
|
readonly "retained-loading": {
|
|
76
84
|
readonly title: "Loading {page}";
|
|
@@ -201,56 +209,60 @@ export declare const PREVIEW_COPY: {
|
|
|
201
209
|
readonly body: "";
|
|
202
210
|
};
|
|
203
211
|
readonly "workspace-unavailable": {
|
|
204
|
-
readonly title: "
|
|
205
|
-
readonly body: "This
|
|
212
|
+
readonly title: "Computer unavailable";
|
|
213
|
+
readonly body: "This computer isn’t available right now. Try opening it again.";
|
|
206
214
|
};
|
|
207
215
|
readonly "workspace-configuration": {
|
|
208
|
-
readonly title: "
|
|
209
|
-
readonly body: "A project administrator needs to complete
|
|
216
|
+
readonly title: "Computer needs setup";
|
|
217
|
+
readonly body: "A project administrator needs to complete setup before this computer can wake.";
|
|
218
|
+
};
|
|
219
|
+
readonly "workspace-network-configuration": {
|
|
220
|
+
readonly title: "Computer needs a private connection";
|
|
221
|
+
readonly body: "An administrator needs to configure its private preview connection. Code editing remains available.";
|
|
210
222
|
};
|
|
211
223
|
readonly "workspace-unconfirmed": {
|
|
212
|
-
readonly title: "
|
|
213
|
-
readonly body: "The
|
|
224
|
+
readonly title: "Computer status is unconfirmed";
|
|
225
|
+
readonly body: "The computer hasn’t confirmed the last operation. A project administrator can check its status before another attempt.";
|
|
214
226
|
};
|
|
215
227
|
readonly "workspace-stopped": {
|
|
216
|
-
readonly title: "
|
|
217
|
-
readonly body: "
|
|
228
|
+
readonly title: "Computer is asleep";
|
|
229
|
+
readonly body: "Wake it to preview this working version.";
|
|
218
230
|
};
|
|
219
231
|
readonly "workspace-start-failed": {
|
|
220
|
-
readonly title: "
|
|
221
|
-
readonly body: "
|
|
232
|
+
readonly title: "Computer couldn’t wake";
|
|
233
|
+
readonly body: "Try waking it again.";
|
|
222
234
|
};
|
|
223
235
|
readonly "workspace-not-prepared": {
|
|
224
|
-
readonly title: "
|
|
225
|
-
readonly body: "A project administrator needs to prepare this working version before
|
|
236
|
+
readonly title: "Computer isn’t set up";
|
|
237
|
+
readonly body: "A project administrator needs to prepare this working version before its computer can wake.";
|
|
226
238
|
};
|
|
227
239
|
readonly "workspace-forbidden": {
|
|
228
|
-
readonly title: "
|
|
229
|
-
readonly body: "A project administrator needs to
|
|
240
|
+
readonly title: "Computer needs project access";
|
|
241
|
+
readonly body: "A project administrator needs to wake this working version’s computer.";
|
|
230
242
|
};
|
|
231
243
|
readonly "workspace-limit": {
|
|
232
|
-
readonly title: "
|
|
233
|
-
readonly body: "This
|
|
244
|
+
readonly title: "Computer limit reached";
|
|
245
|
+
readonly body: "This computer has reached its usage limit. A project administrator can review it.";
|
|
234
246
|
};
|
|
235
247
|
readonly "workspace-near-limit": {
|
|
236
|
-
readonly title: "
|
|
248
|
+
readonly title: "Computer is nearing its limit";
|
|
237
249
|
readonly body: "";
|
|
238
250
|
};
|
|
239
251
|
readonly "workspace-recovery": {
|
|
240
252
|
readonly title: "Working files need recovery";
|
|
241
|
-
readonly body: "Some file changes need to be recovered before this
|
|
253
|
+
readonly body: "Some file changes need to be recovered before this computer can wake.";
|
|
242
254
|
};
|
|
243
255
|
readonly "workspace-switch-failed": {
|
|
244
256
|
readonly title: "Environment couldn’t change";
|
|
245
257
|
readonly body: "The requested environment couldn’t be selected.";
|
|
246
258
|
};
|
|
247
259
|
readonly "workspace-stop-failed": {
|
|
248
|
-
readonly title: "
|
|
249
|
-
readonly body: "The
|
|
260
|
+
readonly title: "Computer couldn’t sleep";
|
|
261
|
+
readonly body: "The computer didn’t confirm that it went to sleep.";
|
|
250
262
|
};
|
|
251
263
|
readonly "workspace-stopped-recovery": {
|
|
252
|
-
readonly title: "
|
|
253
|
-
readonly body: "Some file changes still need to be recovered before this
|
|
264
|
+
readonly title: "Computer asleep, files need recovery";
|
|
265
|
+
readonly body: "Some file changes still need to be recovered before this computer is used again.";
|
|
254
266
|
};
|
|
255
267
|
readonly "workspace-release": {
|
|
256
268
|
readonly title: "Select this working version’s content";
|
|
@@ -11,11 +11,13 @@ export const PREVIEW_COPY = {
|
|
|
11
11
|
"preparing": { "title": "Preparing preview", "body": "Your site will appear here when it’s ready." },
|
|
12
12
|
"page-loading": { "title": "Loading your site", "body": "Waiting for the page to respond." },
|
|
13
13
|
"connecting": { "title": "Connecting preview", "body": "Connecting this site to Studio." },
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"workspace-
|
|
14
|
+
"connection-delayed": { "title": "Preview is taking longer", "body": "We’re still waiting for the preview connection." },
|
|
15
|
+
"connection-unconfirmed": { "title": "Preview couldn’t connect", "body": "The site didn’t confirm its connection to Studio. Check that it is running and accessible, then retry." },
|
|
16
|
+
"workspace-creating": { "title": "Starting computer", "body": "Preparing the computer for this working version." },
|
|
17
|
+
"workspace-restoring": { "title": "Waking computer", "body": "Restoring its saved work." },
|
|
18
|
+
"workspace-installing": { "title": "Preparing computer", "body": "Installing the project’s dependencies. The first wake can take longer." },
|
|
17
19
|
"workspace-checking": { "title": "Checking the project", "body": "Checking this version before starting the site." },
|
|
18
|
-
"workspace-launching": { "title": "Starting
|
|
20
|
+
"workspace-launching": { "title": "Starting preview", "body": "Launching the site on this computer." },
|
|
19
21
|
"retained-loading": { "title": "Loading {page}", "body": "The previous page is still shown." },
|
|
20
22
|
"updating": { "title": "Updating preview", "body": "Waiting for the updated page." },
|
|
21
23
|
"taking-longer": { "title": "Preview is taking longer", "body": "We’re still waiting for the requested page." },
|
|
@@ -48,19 +50,20 @@ export const PREVIEW_COPY = {
|
|
|
48
50
|
"visual-unavailable": { "title": "Page selection unavailable", "body": "The page’s editing controls couldn’t be confirmed. You can continue editing in Studio." },
|
|
49
51
|
"minimap-unavailable": { "title": "Minimap unavailable for this page", "body": "Open Preview to view this page without the minimap." },
|
|
50
52
|
"marker-diagnostic": { "title": "Editing markers need attention", "body": "" },
|
|
51
|
-
"workspace-unavailable": { "title": "
|
|
52
|
-
"workspace-configuration": { "title": "
|
|
53
|
-
"workspace-
|
|
54
|
-
"workspace-
|
|
55
|
-
"workspace-
|
|
56
|
-
"workspace-
|
|
57
|
-
"workspace-
|
|
58
|
-
"workspace-
|
|
59
|
-
"workspace-
|
|
60
|
-
"workspace-
|
|
53
|
+
"workspace-unavailable": { "title": "Computer unavailable", "body": "This computer isn’t available right now. Try opening it again." },
|
|
54
|
+
"workspace-configuration": { "title": "Computer needs setup", "body": "A project administrator needs to complete setup before this computer can wake." },
|
|
55
|
+
"workspace-network-configuration": { "title": "Computer needs a private connection", "body": "An administrator needs to configure its private preview connection. Code editing remains available." },
|
|
56
|
+
"workspace-unconfirmed": { "title": "Computer status is unconfirmed", "body": "The computer hasn’t confirmed the last operation. A project administrator can check its status before another attempt." },
|
|
57
|
+
"workspace-stopped": { "title": "Computer is asleep", "body": "Wake it to preview this working version." },
|
|
58
|
+
"workspace-start-failed": { "title": "Computer couldn’t wake", "body": "Try waking it again." },
|
|
59
|
+
"workspace-not-prepared": { "title": "Computer isn’t set up", "body": "A project administrator needs to prepare this working version before its computer can wake." },
|
|
60
|
+
"workspace-forbidden": { "title": "Computer needs project access", "body": "A project administrator needs to wake this working version’s computer." },
|
|
61
|
+
"workspace-limit": { "title": "Computer limit reached", "body": "This computer has reached its usage limit. A project administrator can review it." },
|
|
62
|
+
"workspace-near-limit": { "title": "Computer is nearing its limit", "body": "" },
|
|
63
|
+
"workspace-recovery": { "title": "Working files need recovery", "body": "Some file changes need to be recovered before this computer can wake." },
|
|
61
64
|
"workspace-switch-failed": { "title": "Environment couldn’t change", "body": "The requested environment couldn’t be selected." },
|
|
62
|
-
"workspace-stop-failed": { "title": "
|
|
63
|
-
"workspace-stopped-recovery": { "title": "
|
|
65
|
+
"workspace-stop-failed": { "title": "Computer couldn’t sleep", "body": "The computer didn’t confirm that it went to sleep." },
|
|
66
|
+
"workspace-stopped-recovery": { "title": "Computer asleep, files need recovery", "body": "Some file changes still need to be recovered before this computer is used again." },
|
|
64
67
|
"workspace-release": { "title": "Select this working version’s content", "body": "This environment belongs to {release}. Select it to preview its content." },
|
|
65
68
|
"workspace-selection-failed": { "title": "Working version couldn’t be selected", "body": "The requested content version couldn’t be applied." },
|
|
66
69
|
"field-hidden": { "title": "This field isn’t visible here", "body": "It’s on this page, but isn’t currently visible." },
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PREVIEW_COPY } from './preview-copy.js';
|
|
2
2
|
const ACTION_LABELS = {
|
|
3
3
|
configure: 'Configure preview', reconnect: 'Reconnect preview', retry: 'Try again',
|
|
4
|
-
'retry-page': 'Retry this page', 'retry-start': 'Retry
|
|
4
|
+
'retry-page': 'Retry this page', 'retry-start': 'Retry wake', resume: 'Wake computer',
|
|
5
5
|
'current-site': 'Use current site', studio: 'Return to Studio', 'open-preview': 'Open Preview',
|
|
6
6
|
exit: 'Retry exit', editor: 'Open editor', 'choose-version': 'Choose a version',
|
|
7
7
|
};
|
|
@@ -62,11 +62,13 @@ export const PREVIEW_FEEDBACK = {
|
|
|
62
62
|
'runtime.preview_read_unavailable': feedback('content-unavailable', 'page', 'retry-page'),
|
|
63
63
|
'runtime.customer_render_failed': feedback('render-failed', 'page', 'retry-page'),
|
|
64
64
|
PREVIEW_CONVERGENCE_STOPPED: feedback('update-failed', 'page', 'retry-page'),
|
|
65
|
+
PREVIEW_CONNECTION_UNCONFIRMED: feedback('connection-unconfirmed', 'connection', 'retry-page'),
|
|
65
66
|
'runtime.PREVIEW_SCOPE_MISMATCH': feedback('scope-mismatch', 'page', 'retry-page', 'attention', { invalidatesPresentation: true }),
|
|
66
67
|
'runtime.PREVIEW_RELEASE_SCOPE_MISMATCH': feedback('scope-mismatch', 'page', 'retry-page', 'attention', { invalidatesPresentation: true }),
|
|
67
68
|
'runtime.preview_context_superseded': feedback('selection-superseded', 'page', 'choose-version', 'attention', { invalidatesPresentation: true }),
|
|
68
69
|
'runtime.schema_sync_delayed': feedback('visual-connecting', 'visual-editing', null, 'neutral'),
|
|
69
70
|
'runtime.cache_unavailable': visualLimited,
|
|
71
|
+
'runtime.provenance_unavailable': visualLimited,
|
|
70
72
|
'runtime.schema_delivery_failed': visualLimited,
|
|
71
73
|
'runtime.schema_upgrade_required': feedback('visual-update', 'visual-editing', 'editor', 'attention'),
|
|
72
74
|
'runtime.suspicious_codeword_sink': feedback('marker-diagnostic', 'visual-editing', null, 'attention', { audience: 'developer' }),
|
|
@@ -77,6 +79,7 @@ export const PREVIEW_FEEDBACK = {
|
|
|
77
79
|
PROJECT_WORKSPACE_NOT_ENABLED: workspaceSetup,
|
|
78
80
|
PROJECT_WORKSPACE_EXECUTION_DISABLED: workspaceSetup,
|
|
79
81
|
PROJECT_WORKSPACE_PROVIDER_NOT_CONFIGURED: workspaceSetup,
|
|
82
|
+
PROJECT_WORKSPACE_NETWORK_NOT_CONFIGURED: feedback('workspace-network-configuration', 'environment', 'current-site', 'attention', { diagnostic: false }),
|
|
80
83
|
PROJECT_WORKSPACE_PROVIDER_NAMESPACE_UNKNOWN: workspaceSetup,
|
|
81
84
|
PROJECT_WORKSPACE_PROVIDER_NAMESPACE_CHANGED: workspaceSetup,
|
|
82
85
|
PROJECT_WORKSPACE_RECIPE_CHANGED: workspaceSetup,
|
|
@@ -116,23 +116,14 @@ export function attachBroadcastListener(args) {
|
|
|
116
116
|
if (!parsed.ok)
|
|
117
117
|
return;
|
|
118
118
|
args.onBroadcast(parsed.identity, event.origin);
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
// postMessage as a liveness proof. An authenticated + idle
|
|
122
|
-
// iframe doesn't naturally produce any reply postMessage when it
|
|
123
|
-
// receives a broadcast, so the alive path would false-negative
|
|
124
|
-
// (codex review R2 P2). Echo the broadcast back to Studio as a
|
|
125
|
-
// session-request envelope — handleSessionRequestEnvelope already
|
|
126
|
-
// routes session-requests for the queue-drain flow, and the
|
|
127
|
-
// existing 8/10s per-Window rate limiter caps the extra traffic.
|
|
128
|
-
// Origin policy : reply to `event.origin` (the broadcast's
|
|
129
|
-
// sender), not '*' — once the iframe has received a confirmed
|
|
130
|
-
// broadcast the parent origin is known.
|
|
119
|
+
// Reply within the existing recovery envelope. The broadcast request ID
|
|
120
|
+
// and confirmed session correlate a wake probe without a new wire type.
|
|
131
121
|
try {
|
|
132
|
-
const reply =
|
|
133
|
-
projectId: args.expectedProjectId,
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
const reply = {
|
|
123
|
+
...buildSessionRequest({ projectId: args.expectedProjectId, reason: 'recovery' }),
|
|
124
|
+
sessionId: parsed.identity.sessionId,
|
|
125
|
+
requestId: event.data.requestId,
|
|
126
|
+
};
|
|
136
127
|
// `event.source` is typed as MessageEventSource (Window | MessagePort | ServiceWorker)
|
|
137
128
|
// ; postMessage exists on Window. Defensive try/catch handles
|
|
138
129
|
// exotic source types without breaking the broadcast handler.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readStandalonePreviewSessionId } from './identity/browser-context.js';
|
|
2
2
|
import { createPreviewRequestId } from './runtime/request-id.js';
|
|
3
|
+
import { sha256Hex as computeRouteHash } from './sha256.js';
|
|
3
4
|
/**
|
|
4
5
|
* @storystick/preview — Visual editing overlay
|
|
5
6
|
*
|
|
@@ -35,25 +36,9 @@ import { startStandaloneOverlayController } from './runtime/standalone-overlay-c
|
|
|
35
36
|
* of FIPS PUB 180-4 §6.2. Production paths (HTTPS↔HTTPS) always hit
|
|
36
37
|
* the Web Crypto branch.
|
|
37
38
|
*/
|
|
38
|
-
async function computeRouteHash(routeUrl) {
|
|
39
|
-
// crypto.subtle returns undefined in non-secure contexts ; guard
|
|
40
|
-
// explicitly rather than letting `crypto.subtle.digest` throw a
|
|
41
|
-
// `TypeError: Cannot read properties of undefined` every snapshot tick.
|
|
42
|
-
if (typeof crypto !== 'undefined' &&
|
|
43
|
-
crypto.subtle !== undefined &&
|
|
44
|
-
typeof crypto.subtle.digest === 'function') {
|
|
45
|
-
const bytes = new TextEncoder().encode(routeUrl);
|
|
46
|
-
const digest = await crypto.subtle.digest('SHA-256', bytes);
|
|
47
|
-
return Array.from(new Uint8Array(digest))
|
|
48
|
-
.map((b) => b.toString(16).padStart(2, '0'))
|
|
49
|
-
.join('');
|
|
50
|
-
}
|
|
51
|
-
const { sha256HexFallback } = await import('./sha256-fallback.js');
|
|
52
|
-
return sha256HexFallback(routeUrl);
|
|
53
|
-
}
|
|
54
39
|
import { startFormContractReporter, } from './runtime/form-contract-reporter.js';
|
|
55
40
|
import { validateNavigate, validateOverlayClear, validateOverlayMap, } from './validators.js';
|
|
56
|
-
import { applyPreviewOverlayMap, clearPreviewOverlayPaint, installPreviewEditInteractionGuard, } from './runtime/preview-overlay-painter.js';
|
|
41
|
+
import { applyPreviewOverlayMap, clearPreviewOverlayPaint, dismissPreviewOverlayMenu, installPreviewEditInteractionGuard, } from './runtime/preview-overlay-painter.js';
|
|
57
42
|
import { getAnchorFromPreviewClickEvent, installMomentaryNavigateKeyRelay, normalizeMomentaryNavigateLinkClick, } from './runtime/momentary-navigate.js';
|
|
58
43
|
import { getNavigateHandler, getReloadHandler, hasNavigateHandler, } from './nav-handler.js';
|
|
59
44
|
import { setRouterSubscriber, } from './router-subscriber.js';
|
|
@@ -594,6 +579,16 @@ export function activate(config) {
|
|
|
594
579
|
return;
|
|
595
580
|
}
|
|
596
581
|
}
|
|
582
|
+
if (base.ok && base.message.type === 'storystick.preview.host-interaction') {
|
|
583
|
+
if (parentOriginLock === null || event.source !== window.parent)
|
|
584
|
+
return;
|
|
585
|
+
if (event.origin !== parentOriginLock)
|
|
586
|
+
return;
|
|
587
|
+
if (base.message.sessionId !== config.sessionId || base.message.projectId !== projectId)
|
|
588
|
+
return;
|
|
589
|
+
dismissPreviewOverlayMenu();
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
597
592
|
// ADR-108 D2 — interaction-mode envelope routed first because
|
|
598
593
|
// it has its own discriminator + parentOrigin lock guard. The
|
|
599
594
|
// `validateNavigate` path below short-circuits on the wrong
|
package/dist/overlay-label.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared visual
|
|
2
|
+
* Shared visual primitives for preview overlay labels and discussion pins.
|
|
3
3
|
*
|
|
4
4
|
* Studio renders slice labels in its React overlay while the preview runtime
|
|
5
5
|
* renders field labels directly in the customer iframe. They intentionally
|
|
@@ -7,6 +7,68 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const PREVIEW_OVERLAY_LABEL_GAP_PX = 4;
|
|
9
9
|
export declare const PREVIEW_OVERLAY_LABEL_HEIGHT_PX = 20;
|
|
10
|
+
/** One compact pin vocabulary in the Studio and the isolated iframe painter. */
|
|
11
|
+
export declare const COMMENT_MARKER_SIZE_PX = 28;
|
|
12
|
+
export declare const COMMENT_MARKER_GAP_PX = 6;
|
|
13
|
+
export declare const COMMENT_AVATAR_STEP_PX = 12;
|
|
14
|
+
export type CommentMarkerAnchorCorner = 'top-left' | 'bottom-right';
|
|
15
|
+
/** Match the pointer to the final placement, including collision adjustments. */
|
|
16
|
+
export declare function commentMarkerAnchorCorner(target: {
|
|
17
|
+
top: number;
|
|
18
|
+
}, position: {
|
|
19
|
+
y: number;
|
|
20
|
+
}): CommentMarkerAnchorCorner;
|
|
21
|
+
export declare function commentMarkerWidth(avatarCount?: number): number;
|
|
22
|
+
export declare function commentAvatarVisualStyle(index: number, hue: number, anchorCorner?: CommentMarkerAnchorCorner): {
|
|
23
|
+
readonly position: "absolute";
|
|
24
|
+
readonly left: string;
|
|
25
|
+
readonly right: string;
|
|
26
|
+
readonly top: "2px";
|
|
27
|
+
readonly width: "24px";
|
|
28
|
+
readonly height: "24px";
|
|
29
|
+
readonly boxSizing: "border-box";
|
|
30
|
+
readonly borderRadius: "50%";
|
|
31
|
+
readonly border: "2px solid var(--ss-surface-card, #fff)";
|
|
32
|
+
readonly overflow: "hidden";
|
|
33
|
+
readonly zIndex: number;
|
|
34
|
+
readonly display: "inline-flex";
|
|
35
|
+
readonly alignItems: "center";
|
|
36
|
+
readonly justifyContent: "center";
|
|
37
|
+
readonly background: `oklch(0.93 0.035 ${number})`;
|
|
38
|
+
readonly color: `oklch(0.34 0.07 ${number})`;
|
|
39
|
+
readonly font: "600 10px/1 \"Inter Variable\", ui-sans-serif, system-ui, sans-serif";
|
|
40
|
+
};
|
|
41
|
+
export declare function commentMarkerVisualStyle(unread: boolean, anchorCorner?: CommentMarkerAnchorCorner): {
|
|
42
|
+
readonly width: "28px";
|
|
43
|
+
readonly boxSizing: "border-box";
|
|
44
|
+
readonly minWidth: "28px";
|
|
45
|
+
readonly height: "28px";
|
|
46
|
+
readonly padding: "0";
|
|
47
|
+
readonly border: "2px solid var(--ss-surface-card, #fff)";
|
|
48
|
+
readonly borderRadius: "50% 50% 5px 50%" | "5px 50% 50% 50%";
|
|
49
|
+
readonly left: "0" | "auto";
|
|
50
|
+
readonly right: "0" | "auto";
|
|
51
|
+
readonly background: "var(--ss-color-notification-dot, oklch(0.58 0.19 253))" | "var(--ss-text-secondary, #666)";
|
|
52
|
+
readonly color: "var(--ss-surface-card, #fff)";
|
|
53
|
+
readonly boxShadow: "0 1px 4px rgb(0 0 0 / .18)";
|
|
54
|
+
readonly font: "600 11px/1 \"Inter Variable\", ui-sans-serif, system-ui, sans-serif";
|
|
55
|
+
readonly fontVariantNumeric: "tabular-nums";
|
|
56
|
+
};
|
|
57
|
+
/** Keep pins beside their target, inside the viewport and clear of earlier pins. */
|
|
58
|
+
export declare function placeCommentMarker(target: {
|
|
59
|
+
right: number;
|
|
60
|
+
top: number;
|
|
61
|
+
}, viewport: {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
}, occupied?: ReadonlyArray<{
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
width?: number;
|
|
68
|
+
}>, width?: number): {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
};
|
|
10
72
|
export type PreviewOverlayTone = 'default' | 'model';
|
|
11
73
|
export declare const PREVIEW_OVERLAY_VISUAL_STYLES: {
|
|
12
74
|
readonly default: {
|
|
@@ -58,6 +120,18 @@ export declare function previewOverlayLabelVisualStyle(tone: PreviewOverlayTone)
|
|
|
58
120
|
readonly color: "white";
|
|
59
121
|
readonly boxShadow: "0 0 0 1px oklch(1 0 0 / 0.72)";
|
|
60
122
|
};
|
|
123
|
+
/** A compact action tab joined to the overlay's top-right edge. */
|
|
124
|
+
export declare function previewOverlayActionVisualStyle(tone: PreviewOverlayTone): {
|
|
125
|
+
readonly width: "24px";
|
|
126
|
+
readonly minWidth: "24px";
|
|
127
|
+
readonly height: "20px";
|
|
128
|
+
readonly padding: "0";
|
|
129
|
+
readonly border: "0";
|
|
130
|
+
readonly borderRadius: "0 0 0 4px";
|
|
131
|
+
readonly color: "white";
|
|
132
|
+
readonly background: "oklch(0.614 0.194 257 / 0.9)" | "oklch(0.635 0.19 322 / 0.9)";
|
|
133
|
+
readonly boxShadow: "none";
|
|
134
|
+
};
|
|
61
135
|
export interface PreviewOverlayLabelHorizontalPositionInput {
|
|
62
136
|
targetLeft: number;
|
|
63
137
|
targetWidth: number;
|
package/dist/overlay-label.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared visual
|
|
2
|
+
* Shared visual primitives for preview overlay labels and discussion pins.
|
|
3
3
|
*
|
|
4
4
|
* Studio renders slice labels in its React overlay while the preview runtime
|
|
5
5
|
* renders field labels directly in the customer iframe. They intentionally
|
|
@@ -7,6 +7,84 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export const PREVIEW_OVERLAY_LABEL_GAP_PX = 4;
|
|
9
9
|
export const PREVIEW_OVERLAY_LABEL_HEIGHT_PX = 20;
|
|
10
|
+
/** One compact pin vocabulary in the Studio and the isolated iframe painter. */
|
|
11
|
+
export const COMMENT_MARKER_SIZE_PX = 28;
|
|
12
|
+
export const COMMENT_MARKER_GAP_PX = 6;
|
|
13
|
+
export const COMMENT_AVATAR_STEP_PX = 12;
|
|
14
|
+
/** Match the pointer to the final placement, including collision adjustments. */
|
|
15
|
+
export function commentMarkerAnchorCorner(target, position) {
|
|
16
|
+
return position.y + COMMENT_MARKER_SIZE_PX <= target.top ? 'bottom-right' : 'top-left';
|
|
17
|
+
}
|
|
18
|
+
export function commentMarkerWidth(avatarCount = 0) {
|
|
19
|
+
return COMMENT_MARKER_SIZE_PX + Math.min(3, Math.max(0, avatarCount)) * COMMENT_AVATAR_STEP_PX;
|
|
20
|
+
}
|
|
21
|
+
export function commentAvatarVisualStyle(index, hue, anchorCorner = 'top-left') {
|
|
22
|
+
const offset = `${4 + (index + 1) * COMMENT_AVATAR_STEP_PX}px`;
|
|
23
|
+
return {
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
left: anchorCorner === 'bottom-right' ? 'auto' : offset,
|
|
26
|
+
right: anchorCorner === 'bottom-right' ? offset : 'auto',
|
|
27
|
+
top: '2px',
|
|
28
|
+
width: '24px', height: '24px', boxSizing: 'border-box', borderRadius: '50%',
|
|
29
|
+
border: '2px solid var(--ss-surface-card, #fff)', overflow: 'hidden',
|
|
30
|
+
zIndex: 3 - index, display: 'inline-flex', alignItems: 'center', justifyContent: 'center',
|
|
31
|
+
background: `oklch(0.93 0.035 ${hue})`, color: `oklch(0.34 0.07 ${hue})`,
|
|
32
|
+
font: '600 10px/1 "Inter Variable", ui-sans-serif, system-ui, sans-serif',
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function commentMarkerVisualStyle(unread, anchorCorner = 'top-left') {
|
|
36
|
+
return {
|
|
37
|
+
width: `${COMMENT_MARKER_SIZE_PX}px`,
|
|
38
|
+
boxSizing: 'border-box',
|
|
39
|
+
minWidth: `${COMMENT_MARKER_SIZE_PX}px`,
|
|
40
|
+
height: `${COMMENT_MARKER_SIZE_PX}px`,
|
|
41
|
+
padding: '0',
|
|
42
|
+
border: '2px solid var(--ss-surface-card, #fff)',
|
|
43
|
+
borderRadius: anchorCorner === 'bottom-right' ? '50% 50% 5px 50%' : '5px 50% 50% 50%',
|
|
44
|
+
left: anchorCorner === 'bottom-right' ? 'auto' : '0',
|
|
45
|
+
right: anchorCorner === 'bottom-right' ? '0' : 'auto',
|
|
46
|
+
background: unread
|
|
47
|
+
? 'var(--ss-color-notification-dot, oklch(0.58 0.19 253))'
|
|
48
|
+
: 'var(--ss-text-secondary, #666)',
|
|
49
|
+
color: 'var(--ss-surface-card, #fff)',
|
|
50
|
+
boxShadow: '0 1px 4px rgb(0 0 0 / .18)',
|
|
51
|
+
font: '600 11px/1 "Inter Variable", ui-sans-serif, system-ui, sans-serif',
|
|
52
|
+
fontVariantNumeric: 'tabular-nums',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Keep pins beside their target, inside the viewport and clear of earlier pins. */
|
|
56
|
+
export function placeCommentMarker(target, viewport, occupied = [], width = COMMENT_MARKER_SIZE_PX) {
|
|
57
|
+
const size = COMMENT_MARKER_SIZE_PX;
|
|
58
|
+
const step = size + COMMENT_MARKER_GAP_PX;
|
|
59
|
+
const maxX = Math.max(4, viewport.width - width - 4);
|
|
60
|
+
const maxY = Math.max(4, viewport.height - size - 4);
|
|
61
|
+
const clamp = ({ x, y }) => ({
|
|
62
|
+
x: Math.max(4, Math.min(maxX, x)),
|
|
63
|
+
y: Math.max(4, Math.min(maxY, y)),
|
|
64
|
+
});
|
|
65
|
+
const fitsBeside = target.right + COMMENT_MARKER_GAP_PX <= maxX;
|
|
66
|
+
const desired = clamp({
|
|
67
|
+
x: fitsBeside
|
|
68
|
+
? target.right + COMMENT_MARKER_GAP_PX
|
|
69
|
+
: target.right - width - COMMENT_MARKER_GAP_PX,
|
|
70
|
+
// The inset fallback stays above the overlay's top-right menu tab.
|
|
71
|
+
y: fitsBeside ? target.top : target.top >= step + 4 ? target.top - step : target.top + 26,
|
|
72
|
+
});
|
|
73
|
+
const candidates = [desired, ...occupied.flatMap(pin => [
|
|
74
|
+
{ x: desired.x, y: pin.y + step },
|
|
75
|
+
{ x: desired.x, y: pin.y - step },
|
|
76
|
+
{ x: pin.x - width - COMMENT_MARKER_GAP_PX, y: desired.y },
|
|
77
|
+
{ x: pin.x + (pin.width ?? size) + COMMENT_MARKER_GAP_PX, y: desired.y },
|
|
78
|
+
])].map(clamp);
|
|
79
|
+
candidates.sort((a, b) => Math.hypot(a.x - desired.x, a.y - desired.y) - Math.hypot(b.x - desired.x, b.y - desired.y));
|
|
80
|
+
return candidates.find(pin => {
|
|
81
|
+
const overlapsMenu = pin.x < target.right + 4 && pin.x + width > target.right - 28 &&
|
|
82
|
+
pin.y < target.top + 24 && pin.y + size > target.top - 4;
|
|
83
|
+
return !overlapsMenu && occupied.every(other => pin.x + width + COMMENT_MARKER_GAP_PX <= other.x ||
|
|
84
|
+
other.x + (other.width ?? size) + COMMENT_MARKER_GAP_PX <= pin.x ||
|
|
85
|
+
Math.abs(pin.y - other.y) >= step);
|
|
86
|
+
}) ?? desired;
|
|
87
|
+
}
|
|
10
88
|
export const PREVIEW_OVERLAY_VISUAL_STYLES = {
|
|
11
89
|
default: {
|
|
12
90
|
color: 'oklch(0.614 0.194 257 / 0.9)',
|
|
@@ -40,6 +118,20 @@ export function previewOverlayVisualStyle(tone) {
|
|
|
40
118
|
export function previewOverlayLabelVisualStyle(tone) {
|
|
41
119
|
return PREVIEW_OVERLAY_LABEL_VISUAL_STYLES[tone];
|
|
42
120
|
}
|
|
121
|
+
/** A compact action tab joined to the overlay's top-right edge. */
|
|
122
|
+
export function previewOverlayActionVisualStyle(tone) {
|
|
123
|
+
return {
|
|
124
|
+
width: '24px',
|
|
125
|
+
minWidth: '24px',
|
|
126
|
+
height: `${PREVIEW_OVERLAY_LABEL_HEIGHT_PX}px`,
|
|
127
|
+
padding: '0',
|
|
128
|
+
border: '0',
|
|
129
|
+
borderRadius: '0 0 0 4px',
|
|
130
|
+
color: 'white',
|
|
131
|
+
background: PREVIEW_OVERLAY_VISUAL_STYLES[tone].color,
|
|
132
|
+
boxShadow: 'none',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
43
135
|
/**
|
|
44
136
|
* Prefer the target's right edge while the label fits inside it. A label wider
|
|
45
137
|
* than its target instead grows from the target's left edge, unless that would
|