@drawnagency/primitives 0.1.89 → 0.1.91
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-75P6HWPN.js → chunk-5BM2Y3NJ.js} +5 -3
- package/dist/{chunk-VK5KNH73.js → chunk-AGWE2LJG.js} +2 -2
- package/dist/{chunk-2QXJ2KGB.js → chunk-KBQNJZUX.js} +1 -1
- package/dist/{chunk-WCBYXNAG.js → chunk-KMQZYORS.js} +1 -0
- package/dist/{chunk-Y24T75HT.js → chunk-MK7YB2A4.js} +1 -1
- package/dist/{chunk-QFV5TSPO.js → chunk-SIYQ37QY.js} +12 -4
- package/dist/{chunk-J75XGXYD.js → chunk-XKRQMTE4.js} +9 -0
- package/dist/{chunk-L2MAJKKC.js → chunk-XUIJHYKI.js} +2 -2
- package/dist/{chunk-MVX4ULYE.js → chunk-ZLG7S54V.js} +241 -82
- package/dist/components/chat/ChatPanel.d.ts +14 -6
- package/dist/components/chat/ChatPanel.d.ts.map +1 -1
- package/dist/components/chat/ChatWidget.d.ts.map +1 -1
- package/dist/components/editor/AudienceIndicator.d.ts +6 -0
- package/dist/components/editor/AudienceIndicator.d.ts.map +1 -1
- package/dist/components/editor/ChildBlockWrapper.d.ts.map +1 -1
- package/dist/components/editor/ColSpanControl.d.ts.map +1 -1
- package/dist/components/editor/DragHandle.d.ts +3 -1
- package/dist/components/editor/DragHandle.d.ts.map +1 -1
- package/dist/components/editor/SectionWrapper.d.ts.map +1 -1
- package/dist/components/editor/StatusIndicator.d.ts +7 -0
- package/dist/components/editor/StatusIndicator.d.ts.map +1 -1
- package/dist/components/editor/index.js +98 -76
- package/dist/components/primitives/index.js +3 -3
- package/dist/components/sections/Container/Container.d.ts +3 -2
- package/dist/components/sections/Container/Container.d.ts.map +1 -1
- package/dist/components/sections/Container/ContainerSettingsForm.d.ts +4 -2
- package/dist/components/sections/Container/ContainerSettingsForm.d.ts.map +1 -1
- package/dist/components/sections/Container/index.d.ts +8 -2
- package/dist/components/sections/Container/index.d.ts.map +1 -1
- package/dist/components/sections/SectionLayout.d.ts +3 -1
- package/dist/components/sections/SectionLayout.d.ts.map +1 -1
- package/dist/components/sections/ViewRenderer.d.ts +3 -1
- package/dist/components/sections/ViewRenderer.d.ts.map +1 -1
- package/dist/components/sections/all-sections.d.ts +8 -2
- package/dist/components/sections/all-sections.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +3 -3
- package/dist/components/sections/core-sections.d.ts +8 -2
- package/dist/components/sections/core-sections.d.ts.map +1 -1
- package/dist/components/sections/register-schemas.js +6 -6
- package/dist/components/sections/register.js +6 -6
- package/dist/components/shared/Fab.d.ts +37 -0
- package/dist/components/shared/Fab.d.ts.map +1 -0
- package/dist/components/shared/Tooltip.d.ts +8 -1
- package/dist/components/shared/Tooltip.d.ts.map +1 -1
- package/dist/components/shell/AudiencePreviewMenu.d.ts +7 -0
- package/dist/components/shell/AudiencePreviewMenu.d.ts.map +1 -0
- package/dist/components/shell/AuthoringDefaultsMenu.d.ts +10 -0
- package/dist/components/shell/AuthoringDefaultsMenu.d.ts.map +1 -0
- package/dist/components/shell/BugReportFAB.d.ts.map +1 -1
- package/dist/components/shell/EditorContext.d.ts +3 -0
- package/dist/components/shell/EditorContext.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsChatbot.d.ts.map +1 -1
- package/dist/hooks/useBuildStatus.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/lib/authoring-defaults.d.ts +17 -0
- package/dist/lib/authoring-defaults.d.ts.map +1 -0
- package/dist/lib/container-grid.d.ts +6 -0
- package/dist/lib/container-grid.d.ts.map +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/lib/migrate-sections-transform.js +1 -1
- package/dist/media/index.js +1 -1
- package/dist/schemas/index.js +4 -2
- package/dist/schemas/site-config.d.ts +6 -0
- package/dist/schemas/site-config.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/chat/ChatPanel.tsx +51 -19
- package/src/components/chat/ChatWidget.tsx +113 -51
- package/src/components/editor/AudienceIndicator.tsx +50 -37
- package/src/components/editor/ChildBlockWrapper.tsx +8 -7
- package/src/components/editor/ColSpanControl.tsx +14 -11
- package/src/components/editor/DragHandle.tsx +5 -2
- package/src/components/editor/PagesModal.tsx +10 -10
- package/src/components/editor/SectionWrapper.tsx +32 -21
- package/src/components/editor/StatusIndicator.tsx +37 -24
- package/src/components/sections/Container/Container.tsx +185 -43
- package/src/components/sections/Container/ContainerSettingsForm.tsx +64 -24
- package/src/components/sections/Container/index.tsx +45 -20
- package/src/components/sections/SectionLayout.tsx +13 -3
- package/src/components/sections/ViewRenderer.tsx +11 -2
- package/src/components/shared/Fab.tsx +57 -0
- package/src/components/shared/Tooltip.tsx +18 -2
- package/src/components/shell/AudiencePreviewMenu.tsx +73 -0
- package/src/components/shell/AuthoringDefaultsMenu.tsx +54 -0
- package/src/components/shell/BugReportFAB.tsx +3 -7
- package/src/components/shell/EditorContext.tsx +5 -1
- package/src/components/shell/EditorShell.tsx +80 -25
- package/src/components/shell/SiteSettingsChatbot.tsx +2 -1
- package/src/hooks/useBuildStatus.ts +35 -4
- package/src/lib/authoring-defaults.ts +42 -0
- package/src/lib/container-grid.ts +14 -0
- package/src/lib/migrate-sections-transform.ts +5 -3
- package/src/schemas/site-config.ts +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { StatusSchema } from "../schemas/site-config";
|
|
3
|
+
import type { Audience } from "../auth/types";
|
|
4
|
+
|
|
5
|
+
export const AuthoringDefaultsSchema = z.object({
|
|
6
|
+
status: StatusSchema,
|
|
7
|
+
access: z.array(z.string()),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type AuthoringDefaults = z.infer<typeof AuthoringDefaultsSchema>;
|
|
11
|
+
|
|
12
|
+
export const FALLBACK_AUTHORING_DEFAULTS: AuthoringDefaults = { status: "draft", access: [] };
|
|
13
|
+
|
|
14
|
+
// Per-origin key — every client site is its own domain, so the preference is
|
|
15
|
+
// automatically per-site.
|
|
16
|
+
const STORAGE_KEY = "portal-authoring-defaults";
|
|
17
|
+
|
|
18
|
+
export function loadAuthoringDefaults(): AuthoringDefaults {
|
|
19
|
+
if (typeof localStorage === "undefined") return FALLBACK_AUTHORING_DEFAULTS;
|
|
20
|
+
try {
|
|
21
|
+
const raw = localStorage.getItem(STORAGE_KEY);
|
|
22
|
+
if (!raw) return FALLBACK_AUTHORING_DEFAULTS;
|
|
23
|
+
return AuthoringDefaultsSchema.parse(JSON.parse(raw));
|
|
24
|
+
} catch {
|
|
25
|
+
return FALLBACK_AUTHORING_DEFAULTS;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function saveAuthoringDefaults(defaults: AuthoringDefaults): void {
|
|
30
|
+
if (typeof localStorage === "undefined") return;
|
|
31
|
+
try {
|
|
32
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(defaults));
|
|
33
|
+
} catch {
|
|
34
|
+
// Quota/private-mode failures just lose the preference.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Stored default audiences can outlive the audiences themselves — drop any
|
|
39
|
+
// name the site no longer has before stamping it onto a new section's access.
|
|
40
|
+
export function filterAccessToKnown(access: string[], audiences: Audience[]): string[] {
|
|
41
|
+
return access.filter((name) => audiences.some((a) => a.name === name));
|
|
42
|
+
}
|
|
@@ -42,6 +42,20 @@ export const gapClass: Record<string, string> = {
|
|
|
42
42
|
lg: "gap-8",
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Column count -> `columns-N` classes for masonry (CSS multi-column), mirroring
|
|
47
|
+
* `containerGridClass`'s collapse curve (`grid-cols-`→`columns-`). Full static
|
|
48
|
+
* strings so Tailwind's source scan generates them.
|
|
49
|
+
*/
|
|
50
|
+
export const masonryColumnsClass: Record<number, string> = {
|
|
51
|
+
1: "columns-1",
|
|
52
|
+
2: "columns-1 @sm:columns-2",
|
|
53
|
+
3: "columns-1 @sm:columns-2 @lg:columns-3",
|
|
54
|
+
4: "columns-1 @xs:columns-2 @lg:columns-4",
|
|
55
|
+
5: "columns-1 @xs:columns-2 @md:columns-3 @xl:columns-5",
|
|
56
|
+
6: "columns-1 @xs:columns-2 @md:columns-3 @2xl:columns-6",
|
|
57
|
+
};
|
|
58
|
+
|
|
45
59
|
/**
|
|
46
60
|
* Per-column-count container-query classes that HIDE a spacer cell once the container
|
|
47
61
|
* collapses to a single column (mobile). Mirrors `containerGridClass`'s collapse curve:
|
|
@@ -99,7 +99,8 @@ function upgradeGrid(section: Obj): Obj {
|
|
|
99
99
|
type: "container",
|
|
100
100
|
content: {
|
|
101
101
|
columns: content.columns,
|
|
102
|
-
|
|
102
|
+
layout: "grid",
|
|
103
|
+
equalizeRowHeight: false,
|
|
103
104
|
children: media.map((item, i) => mapRefItem(item, id, i)),
|
|
104
105
|
},
|
|
105
106
|
};
|
|
@@ -126,7 +127,7 @@ function upgradeSplitContent(section: Obj): Obj {
|
|
|
126
127
|
};
|
|
127
128
|
const children = options.imagePosition === "right" ? [proseChild, mediaChild] : [mediaChild, proseChild];
|
|
128
129
|
|
|
129
|
-
const out: Obj = { id, type: "container", content: { columns: 2,
|
|
130
|
+
const out: Obj = { id, type: "container", content: { columns: 2, layout: "grid", equalizeRowHeight: false, children } };
|
|
130
131
|
if (section.layout !== undefined) out.layout = section.layout;
|
|
131
132
|
return out;
|
|
132
133
|
}
|
|
@@ -163,7 +164,8 @@ function upgradeDoDont(section: Obj): Obj {
|
|
|
163
164
|
type: "container",
|
|
164
165
|
content: {
|
|
165
166
|
columns: 2,
|
|
166
|
-
|
|
167
|
+
layout: "grid",
|
|
168
|
+
equalizeRowHeight: false,
|
|
167
169
|
children: [
|
|
168
170
|
dodontChild(doItems, id, 0, "do", childOptions),
|
|
169
171
|
dodontChild(dontItems, id, 1, "dont", childOptions),
|
|
@@ -7,7 +7,7 @@ import { CORNER_RADIUS_OPTIONS } from "../lib/corner-radius";
|
|
|
7
7
|
// document options block onto PageSchema.
|
|
8
8
|
import { documentOptionsSchema } from "../document/engine/settings";
|
|
9
9
|
|
|
10
|
-
const StatusSchema = z.enum(["draft", "live", "archived", "published"]).transform(
|
|
10
|
+
export const StatusSchema = z.enum(["draft", "live", "archived", "published"]).transform(
|
|
11
11
|
(val) => val === "published" ? "live" as const : val,
|
|
12
12
|
);
|
|
13
13
|
|