@drawnagency/primitives 0.1.62 → 0.1.63
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/dist/{chunk-FJBDGYHE.js → chunk-FECCYOPJ.js} +1 -1
- package/dist/{chunk-JRT4KWHU.js → chunk-QYQ3DQHI.js} +1 -1
- package/dist/{chunk-QWDOJUUO.js → chunk-VMDKWUMT.js} +4 -0
- package/dist/components/primitives/index.js +2 -2
- package/dist/components/sections/Media/MediaBlock.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +2 -2
- package/dist/components/sections/register-schemas.js +3 -3
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/view-branch.d.ts +12 -0
- package/dist/components/shell/view-branch.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/sections/Media/MediaBlock.tsx +9 -0
- package/src/components/shell/EditorShell.tsx +7 -5
- package/src/components/shell/view-branch.ts +14 -0
|
@@ -264,10 +264,14 @@ function MediaBlock({ refValue, options, link, isEditMode, onRefChange }) {
|
|
|
264
264
|
const showBorder = refValue.border ?? options.border;
|
|
265
265
|
const captionStr = refValue.caption ? Array.isArray(refValue.caption) ? refValue.caption.join("\n") : refValue.caption : "";
|
|
266
266
|
const replace = onRefChange ? (imageId) => onRefChange({ ...refValue, imageId }) : void 0;
|
|
267
|
+
const baked = refValue;
|
|
267
268
|
const resolved = /* @__PURE__ */ jsx3(
|
|
268
269
|
ResolvedMedia,
|
|
269
270
|
{
|
|
270
271
|
imageId: refValue.imageId || void 0,
|
|
272
|
+
src: baked.src,
|
|
273
|
+
srcset: baked.srcset,
|
|
274
|
+
alt: baked.alt,
|
|
271
275
|
className: "h-full w-full",
|
|
272
276
|
imgClassName: fitClass,
|
|
273
277
|
invertFrom: refValue.invertFrom
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
EditableRichText,
|
|
3
3
|
LinkPopover,
|
|
4
4
|
defineHeadingSection
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-FECCYOPJ.js";
|
|
6
6
|
import {
|
|
7
7
|
EditableGrid,
|
|
8
8
|
EditablePlainText,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
MediaBlock,
|
|
11
11
|
ResolvedMedia,
|
|
12
12
|
useEditableCollection
|
|
13
|
-
} from "../../chunk-
|
|
13
|
+
} from "../../chunk-VMDKWUMT.js";
|
|
14
14
|
import "../../chunk-4E66N6UV.js";
|
|
15
15
|
import {
|
|
16
16
|
DeleteIcon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Media/MediaBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOvD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC;IACxG,4EAA4E;IAC5E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"MediaBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/sections/Media/MediaBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOvD,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,OAAO,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,CAAC;IACxG,4EAA4E;IAC5E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,eAAe,2CAoF/F"}
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ColorItemSchema,
|
|
3
3
|
ColorSpaceSchema,
|
|
4
4
|
brandGuideSectionDefs
|
|
5
|
-
} from "../../chunk-
|
|
5
|
+
} from "../../chunk-QYQ3DQHI.js";
|
|
6
6
|
import "../../chunk-5THS4K5D.js";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-VMDKWUMT.js";
|
|
8
8
|
import "../../chunk-I5737FJY.js";
|
|
9
9
|
import "../../chunk-CBWK3KPV.js";
|
|
10
10
|
import "../../chunk-3DCG4DNU.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
pluralize,
|
|
4
4
|
stripHtmlToPlainText,
|
|
5
5
|
truncate
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-QYQ3DQHI.js";
|
|
7
7
|
import {
|
|
8
8
|
DeleteButton,
|
|
9
9
|
DragHandle,
|
|
@@ -20,7 +20,7 @@ import "../../chunk-5THS4K5D.js";
|
|
|
20
20
|
import {
|
|
21
21
|
EditableRichText,
|
|
22
22
|
defineHeadingSection
|
|
23
|
-
} from "../../chunk-
|
|
23
|
+
} from "../../chunk-FECCYOPJ.js";
|
|
24
24
|
import {
|
|
25
25
|
EditablePlainText,
|
|
26
26
|
MAX_CONTAINER_COLUMNS,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
colSpanClass,
|
|
29
29
|
containerGridClass,
|
|
30
30
|
spacerHiddenClass
|
|
31
|
-
} from "../../chunk-
|
|
31
|
+
} from "../../chunk-VMDKWUMT.js";
|
|
32
32
|
import "../../chunk-4E66N6UV.js";
|
|
33
33
|
import "../../chunk-I5737FJY.js";
|
|
34
34
|
import "../../chunk-CBWK3KPV.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAsEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAIhB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO,CAAC;QACf,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAE,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,YAAY,EACZ,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CAo6BP"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ViewBranch = "saved" | "live";
|
|
2
|
+
/**
|
|
3
|
+
* Section visibility for the editor's view-mode toggle.
|
|
4
|
+
*
|
|
5
|
+
* - `"live"` ("Published"): mirrors what an anonymous visitor sees on the
|
|
6
|
+
* deployed site — only `status === "live"` (the same predicate the real viewer
|
|
7
|
+
* applies in `viewer-page.ts`).
|
|
8
|
+
* - `"saved"` ("Unpublished"): all in-progress edits — every status EXCEPT
|
|
9
|
+
* `archived` — so edits to live content show alongside drafts.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isSectionVisibleInViewBranch(status: string, viewBranch: ViewBranch): boolean;
|
|
12
|
+
//# sourceMappingURL=view-branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-branch.d.ts","sourceRoot":"","sources":["../../../src/components/shell/view-branch.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE1C;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAE5F"}
|
package/package.json
CHANGED
|
@@ -27,9 +27,18 @@ export function MediaBlock({ refValue, options, link, isEditMode, onRefChange }:
|
|
|
27
27
|
|
|
28
28
|
const replace = onRefChange ? (imageId: string) => onRefChange({ ...refValue, imageId }) : undefined;
|
|
29
29
|
|
|
30
|
+
// The zero-JS viewer has no MediaLibraryContext, so useResolvedMedia() can't
|
|
31
|
+
// resolve the URL. The SSR pass (resolveManifestReferences) bakes src/srcset/alt
|
|
32
|
+
// onto the ref instead — forward them so a real <img> renders rather than the
|
|
33
|
+
// placeholder. In edit mode these are absent and ResolvedMedia falls back to the
|
|
34
|
+
// live manifest via context. (Mirrors a3e8913, which did this for MediaGrid/SplitContent.)
|
|
35
|
+
const baked = refValue as Record<string, unknown>;
|
|
30
36
|
const resolved = (
|
|
31
37
|
<ResolvedMedia
|
|
32
38
|
imageId={refValue.imageId || undefined}
|
|
39
|
+
src={baked.src as string | undefined}
|
|
40
|
+
srcset={baked.srcset as string | undefined}
|
|
41
|
+
alt={baked.alt as string | undefined}
|
|
33
42
|
className="h-full w-full"
|
|
34
43
|
imgClassName={fitClass}
|
|
35
44
|
invertFrom={refValue.invertFrom}
|
|
@@ -69,6 +69,7 @@ import { Button } from "../shared/Button";
|
|
|
69
69
|
import { SplitButton } from "../shared/SplitButton";
|
|
70
70
|
import { IconButton } from "../shared/IconButton";
|
|
71
71
|
import { SegmentedControl } from "../shared/SegmentedControl";
|
|
72
|
+
import { isSectionVisibleInViewBranch } from "./view-branch";
|
|
72
73
|
import { SettingsIcon } from "../shared/icons";
|
|
73
74
|
import { ImageIcon, ListOrderedIcon, FilesIcon, X } from "lucide-react";
|
|
74
75
|
import { ErrorBoundary } from "../shared/ErrorBoundary";
|
|
@@ -1216,12 +1217,13 @@ function EditorContent({
|
|
|
1216
1217
|
const editingEnabled = isEditMode && !isPublishing;
|
|
1217
1218
|
|
|
1218
1219
|
// View mode: render the active page's sections from the fetched branch, in page
|
|
1219
|
-
// order (
|
|
1220
|
-
//
|
|
1220
|
+
// order. "Published" (live) shows only status === "live"; "Unpublished" (saved)
|
|
1221
|
+
// shows all in-progress edits except archived (see view-branch.ts). Edit mode:
|
|
1222
|
+
// the active page's in-memory sections (the `sections` prop is already `activeSections`).
|
|
1221
1223
|
const displaySections = !isEditMode && viewSections !== null
|
|
1222
1224
|
? activePageSectionIds
|
|
1223
1225
|
.map((id) => viewSections.find((s) => s.section.id === id))
|
|
1224
|
-
.filter((s): s is LoadedSection => !!s && (
|
|
1226
|
+
.filter((s): s is LoadedSection => !!s && isSectionVisibleInViewBranch(s.meta.status, viewBranch))
|
|
1225
1227
|
: sections;
|
|
1226
1228
|
|
|
1227
1229
|
useEffect(() => {
|
|
@@ -1642,8 +1644,8 @@ function EditorToolbar({
|
|
|
1642
1644
|
<div className="mx-auto max-w-screen-xl flex items-center justify-center px-4 py-2">
|
|
1643
1645
|
<SegmentedControl
|
|
1644
1646
|
options={[
|
|
1645
|
-
{ value: "
|
|
1646
|
-
{ value: "
|
|
1647
|
+
{ value: "live", label: "Published" },
|
|
1648
|
+
{ value: "saved", label: "Unpublished" },
|
|
1647
1649
|
]}
|
|
1648
1650
|
value={viewBranch}
|
|
1649
1651
|
onChange={(v) => setViewBranch(v as "saved" | "live")}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ViewBranch = "saved" | "live";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Section visibility for the editor's view-mode toggle.
|
|
5
|
+
*
|
|
6
|
+
* - `"live"` ("Published"): mirrors what an anonymous visitor sees on the
|
|
7
|
+
* deployed site — only `status === "live"` (the same predicate the real viewer
|
|
8
|
+
* applies in `viewer-page.ts`).
|
|
9
|
+
* - `"saved"` ("Unpublished"): all in-progress edits — every status EXCEPT
|
|
10
|
+
* `archived` — so edits to live content show alongside drafts.
|
|
11
|
+
*/
|
|
12
|
+
export function isSectionVisibleInViewBranch(status: string, viewBranch: ViewBranch): boolean {
|
|
13
|
+
return viewBranch === "live" ? status === "live" : status !== "archived";
|
|
14
|
+
}
|