@storystick/preview 0.0.0-stage → 0.2.0-rc.0
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/LICENSE +112 -0
- package/PUBLIC-API.md +55 -0
- package/README.md +42 -2
- package/dist/.source-hash +1 -0
- package/dist/authoring/runtime-contract.d.ts +89 -0
- package/dist/authoring/runtime-contract.js +28 -0
- package/dist/channel-taxonomy.d.ts +17 -0
- package/dist/channel-taxonomy.js +46 -0
- package/dist/context-command.d.ts +18 -0
- package/dist/context-command.js +38 -0
- package/dist/dev/suspicious-codeword-detector.d.ts +15 -0
- package/dist/dev/suspicious-codeword-detector.js +220 -0
- package/dist/dev/suspicious-codeword-detector.noop.d.ts +3 -0
- package/dist/dev/suspicious-codeword-detector.noop.js +4 -0
- package/dist/framework/browser-context.d.ts +2 -0
- package/dist/framework/browser-context.js +2 -0
- package/dist/framework/generation-refresh.d.ts +23 -0
- package/dist/framework/generation-refresh.js +82 -0
- package/dist/framework/generation-signal.d.ts +8 -0
- package/dist/framework/generation-signal.js +17 -0
- package/dist/framework/projection-generation-watch.d.ts +5 -0
- package/dist/framework/projection-generation-watch.js +53 -0
- package/dist/framework/render-receipt.d.ts +8 -0
- package/dist/framework/render-receipt.js +10 -0
- package/dist/framework/runtime-adapter-store.d.ts +30 -0
- package/dist/framework/runtime-adapter-store.js +81 -0
- package/dist/grant-coordinator.d.ts +53 -0
- package/dist/grant-coordinator.js +329 -0
- package/dist/grant-lifecycle.d.ts +52 -0
- package/dist/grant-lifecycle.js +74 -0
- package/dist/identity/__test-adapter.d.ts +34 -0
- package/dist/identity/__test-adapter.js +59 -0
- package/dist/identity/browser-context-gate.d.ts +4 -0
- package/dist/identity/browser-context-gate.js +22 -0
- package/dist/identity/browser-context.d.ts +13 -0
- package/dist/identity/browser-context.js +22 -0
- package/dist/identity/carriers/postmessage.d.ts +84 -0
- package/dist/identity/carriers/postmessage.js +177 -0
- package/dist/identity/carriers/storage-state.d.ts +41 -0
- package/dist/identity/carriers/storage-state.js +99 -0
- package/dist/identity/carriers/storage.d.ts +39 -0
- package/dist/identity/carriers/storage.js +182 -0
- package/dist/identity/carriers/url.d.ts +19 -0
- package/dist/identity/carriers/url.js +38 -0
- package/dist/identity/identity-state-machine.d.ts +70 -0
- package/dist/identity/identity-state-machine.js +244 -0
- package/dist/identity/identity-types.d.ts +192 -0
- package/dist/identity/identity-types.js +22 -0
- package/dist/identity/index.d.ts +18 -0
- package/dist/identity/index.js +16 -0
- package/dist/identity/preview-cookie.d.ts +9 -0
- package/dist/identity/preview-cookie.js +12 -0
- package/dist/identity/preview-draft.d.ts +6 -0
- package/dist/identity/preview-draft.js +25 -0
- package/dist/identity/preview-identity.d.ts +28 -0
- package/dist/identity/preview-identity.js +84 -0
- package/dist/identity/preview-scope.d.ts +28 -0
- package/dist/identity/preview-scope.js +47 -0
- package/dist/identity/resolver.d.ts +110 -0
- package/dist/identity/resolver.js +334 -0
- package/dist/identity/session-query.d.ts +4 -0
- package/dist/identity/session-query.js +19 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +788 -0
- package/dist/interaction-mode.d.ts +58 -0
- package/dist/interaction-mode.js +93 -0
- package/dist/nav-handler.d.ts +95 -0
- package/dist/nav-handler.js +84 -0
- package/dist/overlay-label.d.ts +79 -0
- package/dist/overlay-label.js +73 -0
- package/dist/provenance/anchor-map.d.ts +95 -0
- package/dist/provenance/anchor-map.js +177 -0
- package/dist/provenance/carrier-plan.d.ts +51 -0
- package/dist/provenance/carrier-plan.js +90 -0
- package/dist/provenance/coded-text.d.ts +20 -0
- package/dist/provenance/coded-text.js +302 -0
- package/dist/provenance/direct-edit-locator.d.ts +29 -0
- package/dist/provenance/direct-edit-locator.js +218 -0
- package/dist/provenance/editable-leaf.d.ts +134 -0
- package/dist/provenance/editable-leaf.js +483 -0
- package/dist/provenance/editor-target.d.ts +29 -0
- package/dist/provenance/editor-target.js +46 -0
- package/dist/provenance/field-leaf-walker.d.ts +21 -0
- package/dist/provenance/field-leaf-walker.js +98 -0
- package/dist/provenance/frame-dependencies.d.ts +212 -0
- package/dist/provenance/frame-dependencies.js +550 -0
- package/dist/provenance/index.d.ts +26 -0
- package/dist/provenance/index.js +26 -0
- package/dist/provenance/local-events.d.ts +1 -0
- package/dist/provenance/local-events.js +1 -0
- package/dist/provenance/markers.d.ts +21 -0
- package/dist/provenance/markers.js +70 -0
- package/dist/provenance/multi-frame-anchor-map.d.ts +54 -0
- package/dist/provenance/multi-frame-anchor-map.js +109 -0
- package/dist/provenance/normalize.d.ts +2 -0
- package/dist/provenance/normalize.js +19 -0
- package/dist/provenance/overlay-focus-echo.d.ts +17 -0
- package/dist/provenance/overlay-focus-echo.js +16 -0
- package/dist/provenance/overlay-projection.d.ts +65 -0
- package/dist/provenance/overlay-projection.js +201 -0
- package/dist/provenance/owner-map.d.ts +55 -0
- package/dist/provenance/owner-map.js +239 -0
- package/dist/provenance/read-carrier.d.ts +22 -0
- package/dist/provenance/read-carrier.js +92 -0
- package/dist/provenance/recorder.d.ts +38 -0
- package/dist/provenance/recorder.js +82 -0
- package/dist/provenance/render-context.d.ts +106 -0
- package/dist/provenance/render-context.js +338 -0
- package/dist/provenance/reveal-contract.d.ts +44 -0
- package/dist/provenance/reveal-contract.js +1 -0
- package/dist/provenance/richtext-slice-embed-address.d.ts +20 -0
- package/dist/provenance/richtext-slice-embed-address.js +35 -0
- package/dist/provenance/runtime-script.d.ts +1 -0
- package/dist/provenance/runtime-script.js +2217 -0
- package/dist/provenance/sidecar-store.d.ts +63 -0
- package/dist/provenance/sidecar-store.js +151 -0
- package/dist/provenance/sidecar.d.ts +34 -0
- package/dist/provenance/sidecar.js +227 -0
- package/dist/provenance/slice-model.d.ts +28 -0
- package/dist/provenance/slice-model.js +86 -0
- package/dist/provenance/source-identity.d.ts +3 -0
- package/dist/provenance/source-identity.js +7 -0
- package/dist/provenance/source-map-materializer.d.ts +76 -0
- package/dist/provenance/source-map-materializer.js +286 -0
- package/dist/provenance/source-registry.d.ts +103 -0
- package/dist/provenance/source-registry.js +562 -0
- package/dist/provenance/transformed-output-gate.d.ts +161 -0
- package/dist/provenance/transformed-output-gate.js +171 -0
- package/dist/provenance/types.d.ts +102 -0
- package/dist/provenance/types.js +1 -0
- package/dist/refresh-policy.d.ts +11 -0
- package/dist/refresh-policy.js +14 -0
- package/dist/reveal-target.d.ts +8 -0
- package/dist/reveal-target.js +47 -0
- package/dist/route-paths.d.ts +11 -0
- package/dist/route-paths.js +14 -0
- package/dist/router-subscriber.d.ts +92 -0
- package/dist/router-subscriber.js +44 -0
- package/dist/runtime/anchor-types.d.ts +5 -0
- package/dist/runtime/anchor-types.js +1 -0
- package/dist/runtime/authority-store.d.ts +31 -0
- package/dist/runtime/authority-store.js +56 -0
- package/dist/runtime/boot.d.ts +52 -0
- package/dist/runtime/boot.js +379 -0
- package/dist/runtime/content-refresh.d.ts +30 -0
- package/dist/runtime/content-refresh.js +68 -0
- package/dist/runtime/emit-runtime-error.d.ts +51 -0
- package/dist/runtime/emit-runtime-error.js +64 -0
- package/dist/runtime/field-proxy.d.ts +112 -0
- package/dist/runtime/field-proxy.js +471 -0
- package/dist/runtime/form-contract-reporter.d.ts +99 -0
- package/dist/runtime/form-contract-reporter.js +391 -0
- package/dist/runtime/invalidation-adapter.d.ts +17 -0
- package/dist/runtime/invalidation-adapter.js +42 -0
- package/dist/runtime/live-query-overlay.d.ts +39 -0
- package/dist/runtime/live-query-overlay.js +345 -0
- package/dist/runtime/momentary-navigate.d.ts +16 -0
- package/dist/runtime/momentary-navigate.js +106 -0
- package/dist/runtime/observation-scheduler.d.ts +15 -0
- package/dist/runtime/observation-scheduler.js +42 -0
- package/dist/runtime/perf-metrics.d.ts +28 -0
- package/dist/runtime/perf-metrics.js +90 -0
- package/dist/runtime/preview-interaction-policy.d.ts +1 -0
- package/dist/runtime/preview-interaction-policy.js +103 -0
- package/dist/runtime/preview-overlay-painter.d.ts +27 -0
- package/dist/runtime/preview-overlay-painter.js +1732 -0
- package/dist/runtime/preview-overlay-sidecar.d.ts +26 -0
- package/dist/runtime/preview-overlay-sidecar.js +45 -0
- package/dist/runtime/preview-perspective-alignment.d.ts +15 -0
- package/dist/runtime/preview-perspective-alignment.js +40 -0
- package/dist/runtime/preview-perspective-intent-state.d.ts +23 -0
- package/dist/runtime/preview-perspective-intent-state.js +5 -0
- package/dist/runtime/preview-transition-state.d.ts +142 -0
- package/dist/runtime/preview-transition-state.js +257 -0
- package/dist/runtime/render-mode-state.d.ts +51 -0
- package/dist/runtime/render-mode-state.js +76 -0
- package/dist/runtime/request-id.d.ts +4 -0
- package/dist/runtime/request-id.js +8 -0
- package/dist/runtime/resolve-schema-field.d.ts +99 -0
- package/dist/runtime/resolve-schema-field.js +356 -0
- package/dist/runtime/runtime-error-dispatch.d.ts +23 -0
- package/dist/runtime/runtime-error-dispatch.js +75 -0
- package/dist/runtime/schema-store.d.ts +121 -0
- package/dist/runtime/schema-store.js +667 -0
- package/dist/runtime/snapshot-assembly.d.ts +104 -0
- package/dist/runtime/snapshot-assembly.js +553 -0
- package/dist/runtime/snapshot-reporter.d.ts +55 -0
- package/dist/runtime/snapshot-reporter.js +375 -0
- package/dist/runtime/standalone-overlay-controller.d.ts +33 -0
- package/dist/runtime/standalone-overlay-controller.js +281 -0
- package/dist/runtime/store.d.ts +307 -0
- package/dist/runtime/store.js +1026 -0
- package/dist/runtime/windowed-minimap-projection.d.ts +28 -0
- package/dist/runtime/windowed-minimap-projection.js +189 -0
- package/dist/runtime/workspace-shortcuts.d.ts +30 -0
- package/dist/runtime/workspace-shortcuts.js +188 -0
- package/dist/sdk-error-copy.d.ts +48 -0
- package/dist/sdk-error-copy.js +182 -0
- package/dist/select-cursor.d.ts +2 -0
- package/dist/select-cursor.js +23 -0
- package/dist/server/admission-cookie.d.ts +38 -0
- package/dist/server/admission-cookie.js +122 -0
- package/dist/server/control-client.d.ts +29 -0
- package/dist/server/control-client.js +22 -0
- package/dist/server/control-errors.d.ts +22 -0
- package/dist/server/control-errors.js +165 -0
- package/dist/server/draft-route.d.ts +12 -0
- package/dist/server/draft-route.js +45 -0
- package/dist/server/extract-token.d.ts +30 -0
- package/dist/server/extract-token.js +98 -0
- package/dist/server/grant.d.ts +128 -0
- package/dist/server/grant.js +395 -0
- package/dist/server/ordinary-read-provenance.d.ts +11 -0
- package/dist/server/ordinary-read-provenance.js +124 -0
- package/dist/server/preview-read-metadata.d.ts +10 -0
- package/dist/server/preview-read-metadata.js +27 -0
- package/dist/server/provenance-frame-builder.d.ts +53 -0
- package/dist/server/provenance-frame-builder.js +102 -0
- package/dist/server/provenance-runtime.d.ts +70 -0
- package/dist/server/provenance-runtime.js +46 -0
- package/dist/server/read-context-command.d.ts +11 -0
- package/dist/server/read-context-command.js +53 -0
- package/dist/server/read-identity.d.ts +3 -0
- package/dist/server/read-identity.js +63 -0
- package/dist/server/read-lifecycle.d.ts +17 -0
- package/dist/server/read-lifecycle.js +52 -0
- package/dist/server/render-frame-provenance.d.ts +133 -0
- package/dist/server/render-frame-provenance.js +676 -0
- package/dist/server/render-id.d.ts +15 -0
- package/dist/server/render-id.js +22 -0
- package/dist/server/route-document-provenance.d.ts +77 -0
- package/dist/server/route-document-provenance.js +1327 -0
- package/dist/server/route-session-cookie.d.ts +33 -0
- package/dist/server/route-session-cookie.js +54 -0
- package/dist/session-projections.d.ts +33 -0
- package/dist/session-projections.js +43 -0
- package/dist/session-subscriber.d.ts +124 -0
- package/dist/session-subscriber.js +79 -0
- package/dist/sha256-fallback.d.ts +30 -0
- package/dist/sha256-fallback.js +126 -0
- package/dist/types.d.ts +446 -0
- package/dist/types.js +85 -0
- package/dist/validators.d.ts +61 -0
- package/dist/validators.js +110 -0
- package/package.json +206 -3
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deterministic preview render-id derivation.
|
|
3
|
+
*
|
|
4
|
+
* Marker identity (HMAC) incorporates the renderId, so the stability of
|
|
5
|
+
* every provenance marker across refreshes rests on this derivation
|
|
6
|
+
* having ZERO temporal or random components. Pinned by
|
|
7
|
+
* tests/preview-provenance-render-id.test.ts — do not add Date/random
|
|
8
|
+
* inputs here.
|
|
9
|
+
*/
|
|
10
|
+
export function defaultPreviewProvenanceRenderId(input) {
|
|
11
|
+
if (input.frameId === 'route')
|
|
12
|
+
return `render:${input.routeHash}`;
|
|
13
|
+
return `render:frame:${safeRenderFramePart(input.frameId)}:${input.routeHash}`;
|
|
14
|
+
}
|
|
15
|
+
/** Independent mounts of the same document must not replace each other's frame. */
|
|
16
|
+
export function createPreviewOccurrenceId() {
|
|
17
|
+
return `frame_${crypto.randomUUID()}`;
|
|
18
|
+
}
|
|
19
|
+
function safeRenderFramePart(value) {
|
|
20
|
+
return value.replace(/[^A-Za-z0-9]+/g, '_').replace(/^_+|_+$/g, '') ||
|
|
21
|
+
'frame';
|
|
22
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type PreviewFrameDependency, type PreviewProvenanceEditableTextPathManifest, type PreviewProvenanceQueryResultLike, type ProvenanceFrame, type PublicProvenanceSidecar } from '@storystick/preview/provenance';
|
|
2
|
+
import { type PreviewProvenanceAttrsByKey } from '../provenance/render-context.js';
|
|
3
|
+
import { type BuildPreviewRenderFrameOptions, type PreviewRenderFrameDiagnostics, type PreviewRenderFrameFixtureOptions } from './render-frame-provenance.js';
|
|
4
|
+
import { type PreviewProvenanceRuntime } from './provenance-runtime.js';
|
|
5
|
+
export type PreviewRouteFieldBindingsSidecar = Record<string, PreviewRouteEffectiveFieldBindings>;
|
|
6
|
+
export interface PreviewRouteEffectiveFieldBindings {
|
|
7
|
+
readonly base: Record<string, PreviewRouteDocPathBindingRef>;
|
|
8
|
+
readonly variations: Record<string, Record<string, PreviewRouteDocPathBindingRef>>;
|
|
9
|
+
}
|
|
10
|
+
export type PreviewRouteModelFields = Record<string, unknown>;
|
|
11
|
+
export interface PreviewRouteModelReadScope {
|
|
12
|
+
readonly requestedLocale?: string;
|
|
13
|
+
readonly appliedLocale?: string;
|
|
14
|
+
readonly appliedReleaseId?: string;
|
|
15
|
+
readonly releaseMemberState?: 'active' | 'archived' | 'missing' | 'locale-removed';
|
|
16
|
+
}
|
|
17
|
+
export type PreviewRouteModelSidecar = Record<string, PreviewRouteModelFields | undefined> & {
|
|
18
|
+
byId?: Record<string, PreviewRouteModelFields>;
|
|
19
|
+
byRef?: Record<string, PreviewRouteModelFields>;
|
|
20
|
+
scopeById?: Record<string, PreviewRouteModelReadScope>;
|
|
21
|
+
scopeByRef?: Record<string, PreviewRouteModelReadScope>;
|
|
22
|
+
};
|
|
23
|
+
export interface PreviewRouteDocPathBindingRef {
|
|
24
|
+
readonly kind: 'docPath';
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PreviewRouteDocumentFixtureOptions extends PreviewRenderFrameFixtureOptions {
|
|
28
|
+
}
|
|
29
|
+
export interface BuildPreviewRouteDocumentFrameOptions<TDocument extends PreviewProvenanceQueryResultLike, TContext = unknown> {
|
|
30
|
+
readonly enabled?: boolean;
|
|
31
|
+
readonly document: TDocument;
|
|
32
|
+
readonly pathname: string;
|
|
33
|
+
readonly context?: TContext;
|
|
34
|
+
readonly manifest: PreviewProvenanceEditableTextPathManifest;
|
|
35
|
+
readonly frameId?: string;
|
|
36
|
+
readonly routeHash?: string;
|
|
37
|
+
readonly variantId?: string | null;
|
|
38
|
+
readonly sessionId?: string | null;
|
|
39
|
+
readonly codeVersion?: string;
|
|
40
|
+
readonly renderId?: string;
|
|
41
|
+
readonly generation?: number;
|
|
42
|
+
readonly renderNonce?: string;
|
|
43
|
+
readonly emissionRevision?: number;
|
|
44
|
+
readonly authoritativeDocumentIds?: readonly string[];
|
|
45
|
+
readonly dependencies?: readonly PreviewFrameDependency[];
|
|
46
|
+
readonly fieldBindingsFallback?: PreviewRouteFieldBindingsSidecar | null;
|
|
47
|
+
readonly fixture?: PreviewRouteDocumentFixtureOptions | null;
|
|
48
|
+
readonly projectId?: string;
|
|
49
|
+
readonly endpoint?: string;
|
|
50
|
+
readonly convexUrl?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface PreviewRouteDocumentFrame<TDocument extends PreviewProvenanceQueryResultLike = PreviewProvenanceQueryResultLike, TContext = unknown> {
|
|
53
|
+
readonly frameId: string;
|
|
54
|
+
readonly sessionId?: string;
|
|
55
|
+
readonly routeHash: string;
|
|
56
|
+
readonly variantId: string | null;
|
|
57
|
+
readonly attrsByKey: PreviewProvenanceAttrsByKey;
|
|
58
|
+
readonly codedDocument?: TDocument;
|
|
59
|
+
readonly codedContext?: TContext;
|
|
60
|
+
readonly renderFrame: ProvenanceFrame;
|
|
61
|
+
readonly publicSidecar: PublicProvenanceSidecar | null;
|
|
62
|
+
readonly validationOk: boolean;
|
|
63
|
+
readonly diagnostics: PreviewRouteDocumentDiagnostics;
|
|
64
|
+
}
|
|
65
|
+
export interface PreviewRouteDocumentDiagnostics extends PreviewRenderFrameDiagnostics {
|
|
66
|
+
}
|
|
67
|
+
export declare function unstable_buildPreviewRouteDocumentFrameWithRuntime<TDocument extends PreviewProvenanceQueryResultLike, TContext = unknown>(options: BuildPreviewRouteDocumentFrameOptions<TDocument, TContext>, runtime: PreviewProvenanceRuntime): Promise<PreviewRouteDocumentFrame<TDocument, TContext> | null>;
|
|
68
|
+
/** Internal planning shared by routes and independently mounted server components. */
|
|
69
|
+
export declare function planPreviewDocumentRender<TDocument extends PreviewProvenanceQueryResultLike, TContext = unknown>(options: Omit<BuildPreviewRouteDocumentFrameOptions<TDocument, TContext>, 'pathname'> & {
|
|
70
|
+
readonly pathname?: string;
|
|
71
|
+
}, runtime: PreviewProvenanceRuntime): BuildPreviewRenderFrameOptions<TDocument, TContext> | null;
|
|
72
|
+
export declare function stripPreviewRouteMetadata<TDocument extends PreviewProvenanceQueryResultLike>(document: TDocument): TDocument;
|
|
73
|
+
export declare function unstable_attachPreviewProvenanceRenderContext<T>(value: T, attrsByKey: PreviewProvenanceAttrsByKey | null | undefined): T;
|
|
74
|
+
export declare function unstable_attachPreviewRouteFrameContext<TDocument extends PreviewProvenanceQueryResultLike, TContext = unknown>(frame: PreviewRouteDocumentFrame<TDocument, TContext> | null | undefined): TDocument | null;
|
|
75
|
+
export declare function unstable_attachPreviewRouteMetadataContext<TValue, TDocument extends PreviewProvenanceQueryResultLike, TContext = unknown>(value: TValue, frame: PreviewRouteDocumentFrame<TDocument, TContext> | null | undefined): TValue;
|
|
76
|
+
export declare function unstable_attachPreviewRouteRenderContext<TValue, TDocument extends PreviewProvenanceQueryResultLike, TContext = unknown>(value: TValue, frame: PreviewRouteDocumentFrame<TDocument, TContext> | null | undefined): TValue;
|
|
77
|
+
export declare function unstable_collectPreviewRouteDocumentSliceTypes(document: PreviewProvenanceQueryResultLike): ReadonlySet<string>;
|