@storystick/react 0.2.0-rc.5 → 0.2.0-rc.7
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 +2 -2
- package/dist/.source-hash +1 -1
- package/dist/preview-host/preview-standalone-controls.js +7 -6
- package/dist/preview-interaction-control.d.ts +1 -1
- package/dist/preview-interaction-control.js +20 -10
- package/dist/preview-page-state.js +2 -2
- package/dist/preview-toolbar-shell.js +1 -1
- package/dist/storystick-mark.d.ts +1 -1
- package/dist/storystick-mark.js +13 -4
- package/dist/use-generated-query.js +3 -0
- package/package.json +5 -5
package/PUBLIC-API.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @storystick/react API contract
|
|
2
2
|
|
|
3
|
-
Install this candidate explicitly with `@storystick/react@0.2.0-rc.
|
|
3
|
+
Install this candidate explicitly with `@storystick/react@0.2.0-rc.7` 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.7, cohort `sdk-0.2.0-rc.7`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
|
|
6
6
|
|
|
7
7
|
This package is a product integration facade. 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
|
|
package/dist/.source-hash
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
f5cb9659aa9e70bbc5501063c8076a2d02daf9bab488cd87e6c2931833b8a039
|
|
@@ -82,6 +82,7 @@ export function PreviewStandaloneControls({ state, projectId, recovery, basePath
|
|
|
82
82
|
const target = targetRequest?.target ?? null;
|
|
83
83
|
const [connectAttempt, setConnectAttempt] = useState(0);
|
|
84
84
|
const [error, setError] = useState(null);
|
|
85
|
+
const needsReopen = error?.kind === 'reopen';
|
|
85
86
|
useEffect(() => {
|
|
86
87
|
const next = readPreviewEditorNavigation(projectId, state.sessionId);
|
|
87
88
|
if (!next || runtimeHandle.current)
|
|
@@ -408,7 +409,7 @@ export function PreviewStandaloneControls({ state, projectId, recovery, basePath
|
|
|
408
409
|
setEditorStatus('connecting');
|
|
409
410
|
if (status === 'unauthorized') {
|
|
410
411
|
setEditorStatus('error');
|
|
411
|
-
setError(PREVIEW_COPY['editing-forbidden'].title);
|
|
412
|
+
setError({ kind: 'unavailable', message: PREVIEW_COPY['editing-forbidden'].title });
|
|
412
413
|
}
|
|
413
414
|
},
|
|
414
415
|
});
|
|
@@ -483,8 +484,8 @@ export function PreviewStandaloneControls({ state, projectId, recovery, basePath
|
|
|
483
484
|
overlayNotice ||
|
|
484
485
|
(!rendered && connected) ||
|
|
485
486
|
recovery?.error ||
|
|
486
|
-
error) && (_jsxs("div", { className: "notices", children: [connectionNotice && _jsx("p", { role: "status", children: connectionNotice }), notice && _jsx("p", { children: notice }), overlayNotice && _jsx("p", { role: "status", children: overlayNotice }), connected && !rendered && (_jsxs("p", { children: [PREVIEW_COPY.updating.body, ' ', _jsx("button", { type: "button", onClick: () => window.location.reload(), children: "Reload" })] })), recovery?.error && (_jsxs("p", { role: "alert", children: [PREVIEW_COPY['connection-interrupted'].body, ' ', _jsx("button", { type: "button", onClick: recovery.retry, disabled: false, children: "Retry" })] })), error && _jsxs("p", { role: "alert", children: [error, ' ', editorStatus === 'error' && !runtimeHandle.current ? (_jsx("button", { type: "button", onClick: () => setConnectAttempt(value => value + 1), children: "Retry" })) : null] })] }))] }), panel: _jsxs(_Fragment, { children: [surface === 'editor' && target === null && committedTarget === null && !continuation && (_jsxs("div", { className: "editor-empty", children: [_jsx(EditIcon, {}), _jsx("strong", { children: PREVIEW_COPY['element-empty'].title }), _jsx("p", { children: PREVIEW_COPY['element-empty'].body })] })), (editorStatus === 'idle' || editorStatus === 'connecting') &&
|
|
487
|
-
(surface === 'assistant' || target || continuation) && (_jsx("div", { className: "editor-loading", children: _jsx(AuthoringPanelSkeleton, { surface: surface === 'assistant' ? 'assistant' : 'editor' }) })), editorStatus === 'error' && error && (_jsx("div", { className: "panel-state-overlay", children: _jsx(PreviewPanelState, { title: surface === 'assistant' ? 'Assistant unavailable' : PREVIEW_COPY['editor-unavailable'].title, description: error, actions: _jsx(PreviewPanelAction, { onClick: () => {
|
|
487
|
+
error) && (_jsxs("div", { className: "notices", children: [connectionNotice && _jsx("p", { role: "status", children: connectionNotice }), notice && _jsx("p", { children: notice }), overlayNotice && _jsx("p", { role: "status", children: overlayNotice }), connected && !rendered && (_jsxs("p", { children: [PREVIEW_COPY.updating.body, ' ', _jsx("button", { type: "button", onClick: () => window.location.reload(), children: "Reload" })] })), recovery?.error && (_jsxs("p", { role: "alert", children: [PREVIEW_COPY['connection-interrupted'].body, ' ', _jsx("button", { type: "button", onClick: recovery.retry, disabled: false, children: "Retry" })] })), error && _jsxs("p", { role: "alert", children: [error.message, ' ', editorStatus === 'error' && !runtimeHandle.current && !needsReopen ? (_jsx("button", { type: "button", onClick: () => setConnectAttempt(value => value + 1), children: "Retry" })) : null] })] }))] }), panel: _jsxs(_Fragment, { children: [surface === 'editor' && target === null && committedTarget === null && !continuation && (_jsxs("div", { className: "editor-empty", children: [_jsx(EditIcon, {}), _jsx("strong", { children: PREVIEW_COPY['element-empty'].title }), _jsx("p", { children: PREVIEW_COPY['element-empty'].body })] })), (editorStatus === 'idle' || editorStatus === 'connecting') &&
|
|
488
|
+
(surface === 'assistant' || target || continuation) && (_jsx("div", { className: "editor-loading", children: _jsx(AuthoringPanelSkeleton, { surface: surface === 'assistant' ? 'assistant' : 'editor' }) })), editorStatus === 'error' && error && (_jsx("div", { className: "panel-state-overlay", children: _jsx(PreviewPanelState, { title: needsReopen ? 'Reopen Preview to edit' : surface === 'assistant' ? 'Assistant unavailable' : PREVIEW_COPY['editor-unavailable'].title, description: error.message, actions: needsReopen ? destination && _jsx("a", { "data-ss-panel-action": "", href: destination.href, target: "_blank", rel: "noopener noreferrer", children: "Open in Studio" }) : _jsx(PreviewPanelAction, { onClick: () => {
|
|
488
489
|
setError(null);
|
|
489
490
|
if (runtimeHandle.current && (committedTarget ?? target))
|
|
490
491
|
requestEditorTarget({ ...(committedTarget ?? target) });
|
|
@@ -522,10 +523,10 @@ function authoringErrorMessage(error) {
|
|
|
522
523
|
const code = error instanceof Error ? error.message : '';
|
|
523
524
|
console.warn('[storystick] Preview authoring connection failed:', /^[A-Z][A-Z0-9_]{0,80}$/.test(code) ? code : 'AUTHORING_RUNTIME_ERROR');
|
|
524
525
|
if (code.includes('AUTHORING_WRITE_FORBIDDEN')) {
|
|
525
|
-
return PREVIEW_COPY['editing-forbidden'].title;
|
|
526
|
+
return { kind: 'unavailable', message: PREVIEW_COPY['editing-forbidden'].title };
|
|
526
527
|
}
|
|
527
528
|
if (code.includes('CONTENT_SHAPE_RELOAD_REQUIRED')) {
|
|
528
|
-
return
|
|
529
|
+
return { kind: 'reopen', message: 'The project or site has changed since this Preview was opened. Open a new Preview from Studio to continue editing.' };
|
|
529
530
|
}
|
|
530
|
-
return PREVIEW_COPY['editor-unavailable'].body;
|
|
531
|
+
return { kind: 'unavailable', message: PREVIEW_COPY['editor-unavailable'].body };
|
|
531
532
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type PreviewInteractionMode = "edit" | "browse";
|
|
2
|
-
/**
|
|
2
|
+
/** Shared toolbar control, also available before loading the authoring theme. */
|
|
3
3
|
export declare function PreviewInteractionControl({ interactionMode, onChange, }: {
|
|
4
4
|
interactionMode: PreviewInteractionMode;
|
|
5
5
|
onChange(mode: PreviewInteractionMode): void;
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Radio } from "@base-ui/react/radio";
|
|
4
4
|
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
5
|
-
/**
|
|
5
|
+
/** Shared toolbar control, also available before loading the authoring theme. */
|
|
6
6
|
export function PreviewInteractionControl({ interactionMode, onChange, }) {
|
|
7
7
|
return (_jsx(RadioGroup, { value: interactionMode, onValueChange: onChange, "aria-label": "Preview interaction mode", "data-slot": "preview-frame-interaction-mode", style: {
|
|
8
8
|
display: "inline-flex",
|
|
9
9
|
alignItems: "center",
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
boxSizing: "border-box",
|
|
11
|
+
height: 36,
|
|
12
|
+
padding: "var(--ss-space-2, 2px)",
|
|
13
|
+
gap: "var(--ss-space-2, 2px)",
|
|
12
14
|
borderRadius: 999,
|
|
13
|
-
background: "var(--
|
|
14
|
-
color: "var(--
|
|
15
|
-
boxShadow: "var(--ss-shadow-
|
|
15
|
+
background: "var(--ss-surface-card, #fff)",
|
|
16
|
+
color: "var(--ss-text-primary, oklch(0.2 0.007 258.364))",
|
|
17
|
+
boxShadow: "var(--ss-shadow-hub, 0 0 0 1px rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05), 0 6px 16px -10px rgb(0 0 0 / 0.1), 0 16px 34px -24px rgb(0 0 0 / 0.12))",
|
|
16
18
|
}, children: ["edit", "browse"].map((mode) => (_jsx(Radio.Root, { value: mode, nativeButton: true, render: _jsx("button", { type: "button" }), "data-slot": `preview-frame-interaction-${mode}`, "aria-label": mode === "edit"
|
|
17
19
|
? "Inspect: select content to edit"
|
|
18
20
|
: "Navigate: use site links", title: mode === "edit"
|
|
@@ -22,18 +24,26 @@ export function PreviewInteractionControl({ interactionMode, onChange, }) {
|
|
|
22
24
|
display: "inline-flex",
|
|
23
25
|
alignItems: "center",
|
|
24
26
|
justifyContent: "center",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
boxSizing: "border-box",
|
|
28
|
+
flexShrink: 0,
|
|
29
|
+
height: 32,
|
|
30
|
+
width: mode === "edit" ? 32 : undefined,
|
|
31
|
+
margin: 0,
|
|
32
|
+
padding: mode === "edit" ? 0 : "0 var(--ss-space-8, 8px)",
|
|
27
33
|
border: 0,
|
|
28
34
|
borderRadius: 999,
|
|
29
35
|
cursor: "pointer",
|
|
30
36
|
background: interactionMode === mode
|
|
31
|
-
? "var(--
|
|
37
|
+
? "var(--ss-surface-field, oklch(0.958 0.001 255))"
|
|
32
38
|
: "transparent",
|
|
33
|
-
color:
|
|
39
|
+
color: interactionMode === mode
|
|
40
|
+
? "inherit"
|
|
41
|
+
: "var(--ss-text-secondary, oklch(0.471 0.006 258.364))",
|
|
34
42
|
fontFamily: "inherit",
|
|
35
43
|
fontSize: 13,
|
|
36
44
|
fontWeight: 500,
|
|
37
45
|
lineHeight: "17px",
|
|
46
|
+
whiteSpace: "nowrap",
|
|
47
|
+
outlineOffset: -2,
|
|
38
48
|
}, children: mode === "edit" ? (_jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: (1.25 * 24) / 14, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [_jsx("path", { d: "M2 10h6V4" }), _jsx("path", { d: "m2 4 6 6" }), _jsx("path", { d: "M21 10V7a2 2 0 0 0-2-2h-7" }), _jsx("path", { d: "M3 14v2a2 2 0 0 0 2 2h3" }), _jsx("rect", { x: "12", y: "14", width: "10", height: "7", rx: "1" })] })) : ("Navigate") }, mode))) }));
|
|
39
49
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { PREVIEW_PAGE_STYLES } from '@storystick/preview/page-presentation';
|
|
3
|
-
import {
|
|
3
|
+
import { StorystickWordmark } from './storystick-mark.js';
|
|
4
4
|
/** One page composition for launch, activation and terminal Preview feedback.
|
|
5
5
|
* Actions and progress belong to the caller's existing lifecycle. */
|
|
6
6
|
export function PreviewPageState({ title, description, role, indicator, actions, children }) {
|
|
7
|
-
return _jsxs(_Fragment, { children: [_jsx("style", { children: PREVIEW_PAGE_STYLES }), _jsx("main", { "data-ss-preview-page": "", children: _jsxs("div", { "data-ss-preview-page-content": "", children: [
|
|
7
|
+
return _jsxs(_Fragment, { children: [_jsx("style", { children: PREVIEW_PAGE_STYLES }), _jsx("main", { "data-ss-preview-page": "", children: _jsxs("div", { "data-ss-preview-page-content": "", children: [_jsx("div", { "data-ss-preview-page-brand": "", children: _jsx(StorystickWordmark, {}) }), _jsxs("div", { role: role, children: [_jsxs("div", { "data-ss-preview-page-heading": "", children: [indicator, _jsx("h1", { "data-ss-preview-page-title": "", children: title })] }), _jsx("p", { "data-ss-preview-page-description": "", children: description })] }), actions ? _jsx("div", { "data-ss-preview-page-actions": "", children: actions }) : null, children] }) })] });
|
|
8
8
|
}
|
|
9
9
|
export function PreviewPageProgress() {
|
|
10
10
|
return _jsx("span", { "data-ss-preview-page-progress": "", "aria-hidden": "true" });
|
|
@@ -79,7 +79,7 @@ const CONTROL_STYLES = `
|
|
|
79
79
|
.bubble { pointer-events: auto; touch-action: none; user-select: none; position: fixed; top: 0; left: 0; z-index: 2; width: 40px; height: 40px; display: grid; place-items: center; color: inherit; background: var(--ss-surface-card, #fff); border: 0; border-radius: 999px; transition: background-color 140ms ease, transform 180ms ease-out; }
|
|
80
80
|
.bubble:hover { background: var(--ss-surface-field, oklch(0.958 0.001 255)); }
|
|
81
81
|
.bubble:focus-visible, .menu-action:focus-visible, .panel-close:focus-visible, .panel-drag-handle:focus-visible { outline: 2px solid var(--ss-focus-color, oklch(0.614 0.194 257)); outline-offset: -2px; }
|
|
82
|
-
.storystick-brand { width:
|
|
82
|
+
.storystick-brand { width: 13px; height: 13px; }
|
|
83
83
|
.menu-positioner { z-index: 3; pointer-events: auto; }
|
|
84
84
|
.menu { width: min(240px, calc(100vw - ${TOOLBAR_GAP * 2}px)); max-height: min(var(--available-height), calc(100dvh - ${TOOLBAR_GAP * 2}px)); overflow: auto; overscroll-behavior: contain; padding: 5px; }
|
|
85
85
|
/* Keep the bubble's relief stable before and after the authoring styles load. */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ComponentPropsWithoutRef } from 'react';
|
|
2
|
-
/** Canonical brand geometry, shared by Studio and the lightweight preview host. */
|
|
3
2
|
export declare function StorystickMark(props: ComponentPropsWithoutRef<'svg'>): import("react").JSX.Element;
|
|
3
|
+
export declare function StorystickWordmark(props: ComponentPropsWithoutRef<'svg'>): import("react").JSX.Element;
|
package/dist/storystick-mark.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { STORYSTICK_MARK_PATHS, STORYSTICK_MARK_RECT, STORYSTICK_MARK_VIEW_BOX, STORYSTICK_WORDMARK_LETTERING, STORYSTICK_WORDMARK_VIEW_BOX, } from '@storystick/preview/page-presentation';
|
|
3
|
+
// The social image renderer only accepts native SVG nodes inside an SVG.
|
|
4
|
+
function renderMark() {
|
|
5
|
+
return [
|
|
6
|
+
_jsx("rect", { ...STORYSTICK_MARK_RECT }, "middle"),
|
|
7
|
+
...STORYSTICK_MARK_PATHS.map(path => _jsx("path", { d: path }, path)),
|
|
8
|
+
];
|
|
9
|
+
}
|
|
4
10
|
export function StorystickMark(props) {
|
|
5
|
-
return (_jsx("svg", { ...props, "data-slot": "storystick-mark", viewBox: STORYSTICK_MARK_VIEW_BOX,
|
|
11
|
+
return (_jsx("svg", { fill: "currentColor", ...props, "data-slot": "storystick-mark", viewBox: STORYSTICK_MARK_VIEW_BOX, focusable: "false", "aria-hidden": "true", children: renderMark() }));
|
|
12
|
+
}
|
|
13
|
+
export function StorystickWordmark(props) {
|
|
14
|
+
return (_jsxs("svg", { fill: "currentColor", role: "img", "aria-label": "Storystick", ...props, "data-slot": "storystick-wordmark", viewBox: STORYSTICK_WORDMARK_VIEW_BOX, focusable: "false", children: [renderMark(), _jsx("path", { d: STORYSTICK_WORDMARK_LETTERING })] }));
|
|
6
15
|
}
|
|
@@ -93,6 +93,9 @@ export function useQuery(executableQuery, options = {}) {
|
|
|
93
93
|
initialData: currentInitialResult,
|
|
94
94
|
// A seed is not a fresh browser read and carries no query receipt.
|
|
95
95
|
initialDataUpdatedAt: 0,
|
|
96
|
+
// Transport proofs live in WeakMaps. Deep-sharing an HTTP result with
|
|
97
|
+
// an SSR seed would keep equal JSON but discard the fresh read receipt.
|
|
98
|
+
structuralSharing: false,
|
|
96
99
|
retry: false,
|
|
97
100
|
staleTime: Infinity,
|
|
98
101
|
gcTime: 5 * 60 * 1_000,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storystick/react",
|
|
3
|
-
"version": "0.2.0-rc.
|
|
3
|
+
"version": "0.2.0-rc.7",
|
|
4
4
|
"license": "FSL-1.1-MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -116,10 +116,10 @@
|
|
|
116
116
|
"dependencies": {
|
|
117
117
|
"@tanstack/query-core": "5.101.4",
|
|
118
118
|
"@base-ui/react": "1.3.0",
|
|
119
|
-
"@storystick/
|
|
120
|
-
"@storystick/client": "0.2.0-rc.
|
|
121
|
-
"@storystick/types": "0.1.0-rc.
|
|
122
|
-
"@storystick/
|
|
119
|
+
"@storystick/preview": "0.2.0-rc.5",
|
|
120
|
+
"@storystick/client": "0.2.0-rc.5",
|
|
121
|
+
"@storystick/types": "0.1.0-rc.4",
|
|
122
|
+
"@storystick/media": "0.2.0-rc.4"
|
|
123
123
|
},
|
|
124
124
|
"peerDependencies": {
|
|
125
125
|
"react": "^19.2.8",
|