@drawnagency/primitives 0.1.78 → 0.1.80
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-BAQYZSFF.js → chunk-4TVODHD2.js} +5 -5
- package/dist/{chunk-NS3UTJ3E.js → chunk-7XWER6YR.js} +18 -11
- package/dist/{chunk-UA6OCJJK.js → chunk-KVQFMVXE.js} +79 -26
- package/dist/{chunk-MK4POMLZ.js → chunk-QB5Q23G2.js} +1 -1
- package/dist/{chunk-4SIWBWKZ.js → chunk-RSITF24B.js} +8 -0
- package/dist/{chunk-Z5IYWUW3.js → chunk-UNUJPLZV.js} +1 -1
- package/dist/{chunk-K4JD6FD3.js → chunk-VI26O4E3.js} +1 -1
- package/dist/components/brandguide/Colors.d.ts +2 -1
- package/dist/components/brandguide/Colors.d.ts.map +1 -1
- package/dist/components/editor/index.js +1 -1
- package/dist/components/primitives/EditableGrid.d.ts +11 -1
- package/dist/components/primitives/EditableGrid.d.ts.map +1 -1
- package/dist/components/primitives/gridDrop.d.ts +18 -0
- package/dist/components/primitives/gridDrop.d.ts.map +1 -0
- package/dist/components/primitives/index.js +3 -3
- package/dist/components/primitives/useEditableCollection.d.ts +1 -0
- package/dist/components/primitives/useEditableCollection.d.ts.map +1 -1
- package/dist/components/sections/Colors/index.d.ts.map +1 -1
- package/dist/components/sections/brand-guide.js +3 -3
- package/dist/components/sections/register-schemas.js +5 -5
- package/dist/components/sections/register.js +5 -5
- package/dist/components/shell/EditorContext.d.ts +2 -0
- package/dist/components/shell/EditorContext.d.ts.map +1 -1
- package/dist/components/shell/EditorShell.d.ts +13 -0
- package/dist/components/shell/EditorShell.d.ts.map +1 -1
- package/dist/components/shell/HistoryToolbar.d.ts +8 -1
- package/dist/components/shell/HistoryToolbar.d.ts.map +1 -1
- package/dist/components/shell/SiteSettingsDisplay.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/lib/corner-radius.d.ts +6 -0
- package/dist/lib/corner-radius.d.ts.map +1 -0
- package/dist/lib/index.js +2 -2
- package/dist/lib/registry.d.ts +3 -0
- package/dist/lib/registry.d.ts.map +1 -1
- package/dist/media/index.js +1 -1
- package/dist/schemas/index.js +2 -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/brandguide/Colors.tsx +15 -5
- package/src/components/chat/ChatPanel.tsx +8 -8
- package/src/components/primitives/EditableGrid.tsx +86 -24
- package/src/components/primitives/ResolvedMedia.tsx +1 -1
- package/src/components/primitives/gridDrop.ts +26 -0
- package/src/components/primitives/useEditableCollection.ts +16 -1
- package/src/components/sections/Button/CTAButton.tsx +1 -1
- package/src/components/sections/Colors/index.tsx +2 -1
- package/src/components/sections/Media/MediaBlock.tsx +1 -1
- package/src/components/shared/Navigation.tsx +5 -5
- package/src/components/shell/EditorContext.tsx +6 -1
- package/src/components/shell/EditorModal.tsx +7 -7
- package/src/components/shell/EditorShell.tsx +46 -5
- package/src/components/shell/HistoryToolbar.tsx +24 -2
- package/src/components/shell/SiteSettingsDisplay.tsx +19 -0
- package/src/lib/corner-radius.ts +22 -0
- package/src/lib/registry.ts +3 -0
- package/src/schemas/site-config.ts +4 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Audience } from "../../auth/types";
|
|
2
|
+
import { type HistoryState } from "./EditorContext";
|
|
2
3
|
import type { CollabBootstrap } from "../../collab/types";
|
|
3
4
|
export { useMediaLibrary } from "./MediaLibraryContext";
|
|
4
5
|
interface Props {
|
|
@@ -22,4 +23,16 @@ interface Props {
|
|
|
22
23
|
collabBootstrap?: CollabBootstrap | null;
|
|
23
24
|
}
|
|
24
25
|
export default function EditorShell({ headSha, draftHeadSha, siteId, audiences: initialAudiences, capabilities, currentUser, chatbotPlatformEnabled, collabBootstrap, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/** Resolve which historical page to show: explicit selection → the page the
|
|
27
|
+
* editor is currently on (if it existed at that version) → home → first. */
|
|
28
|
+
export declare function resolveHistoryPage(historyState: NonNullable<HistoryState>, historyPageId: string | null, preferredPageId: string | null): {
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
slug: string;
|
|
32
|
+
isHome: boolean;
|
|
33
|
+
showInNav: boolean;
|
|
34
|
+
status: "live" | "archived";
|
|
35
|
+
access: string[];
|
|
36
|
+
order: string[];
|
|
37
|
+
};
|
|
25
38
|
//# sourceMappingURL=EditorShell.d.ts.map
|
|
@@ -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;AAKjD,OAAO,EAAoC,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA6CtF,OAAO,KAAK,EAAE,eAAe,EAA2D,MAAM,oBAAoB,CAAC;AAmCnH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoBxD,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;IAIhE,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAKjC,eAAe,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,YAAY,EACZ,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,EACX,sBAA8B,EAC9B,eAAe,GAChB,EAAE,KAAK,2CA88CP;AA2DD;6EAC6E;AAC7E,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,EACvC,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,eAAe,EAAE,MAAM,GAAG,IAAI;;;;;;;;;EAK/B"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
interface HistoryPageOption {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
}
|
|
1
5
|
interface HistoryToolbarProps {
|
|
2
6
|
date: string;
|
|
7
|
+
pages: HistoryPageOption[];
|
|
8
|
+
activePageId: string;
|
|
9
|
+
onPageChange: (pageId: string) => void;
|
|
3
10
|
onBackToCurrent: () => void;
|
|
4
11
|
onRestore: () => void;
|
|
5
12
|
}
|
|
6
|
-
export declare function HistoryToolbar({ date, onBackToCurrent, onRestore }: HistoryToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function HistoryToolbar({ date, pages, activePageId, onPageChange, onBackToCurrent, onRestore }: HistoryToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
7
14
|
export {};
|
|
8
15
|
//# sourceMappingURL=HistoryToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HistoryToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/shell/HistoryToolbar.tsx"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"HistoryToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/shell/HistoryToolbar.tsx"],"names":[],"mappings":"AAGA,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,mBAAmB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,cAAc,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,mBAAmB,2CAoC1H"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SiteSettingsDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/shell/SiteSettingsDisplay.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,KAAK;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;
|
|
1
|
+
{"version":3,"file":"SiteSettingsDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/shell/SiteSettingsDisplay.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,UAAU,KAAK;IACb,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxC;AAkBD,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,KAAK,2CA6KlE"}
|
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
AudienceNameSchema,
|
|
50
50
|
MediaGridOptionsSchema,
|
|
51
51
|
slugifyAudienceName
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-QB5Q23G2.js";
|
|
53
53
|
import {
|
|
54
54
|
AudienceSchema,
|
|
55
55
|
RoleSchema,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
loadStaticSiteContent,
|
|
72
72
|
mergeSiteContent,
|
|
73
73
|
safeRedirect
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-UNUJPLZV.js";
|
|
75
75
|
import {
|
|
76
76
|
createEvent,
|
|
77
77
|
darkModeEvent,
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
TextLineSchema,
|
|
125
125
|
VariantSchema,
|
|
126
126
|
normalizeSiteIndex
|
|
127
|
-
} from "./chunk-
|
|
127
|
+
} from "./chunk-RSITF24B.js";
|
|
128
128
|
import {
|
|
129
129
|
clearRegistry,
|
|
130
130
|
createRegistry,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CORNER_RADIUS_OPTIONS: readonly ["none", "small", "medium", "large"];
|
|
2
|
+
export type CornerRadius = (typeof CORNER_RADIUS_OPTIONS)[number];
|
|
3
|
+
export declare const CORNER_RADIUS_VALUES: Record<CornerRadius, string>;
|
|
4
|
+
/** CSS length for `--radius-outer`; unknown/missing values fall back to medium. */
|
|
5
|
+
export declare function cornerRadiusValue(radius?: string | null): string;
|
|
6
|
+
//# sourceMappingURL=corner-radius.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"corner-radius.d.ts","sourceRoot":"","sources":["../../src/lib/corner-radius.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,qBAAqB,+CAAgD,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAIlE,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAK7D,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEhE"}
|
package/dist/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
loadStaticSiteContent,
|
|
8
8
|
mergeSiteContent,
|
|
9
9
|
safeRedirect
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-UNUJPLZV.js";
|
|
11
11
|
import {
|
|
12
12
|
createEvent,
|
|
13
13
|
darkModeEvent,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
audiencePasses
|
|
34
34
|
} from "../chunk-4YEOTFVU.js";
|
|
35
35
|
import "../chunk-TZQPOR5A.js";
|
|
36
|
-
import "../chunk-
|
|
36
|
+
import "../chunk-RSITF24B.js";
|
|
37
37
|
import {
|
|
38
38
|
clearRegistry,
|
|
39
39
|
createRegistry,
|
package/dist/lib/registry.d.ts
CHANGED
|
@@ -72,6 +72,9 @@ export interface SectionProps<T = unknown> {
|
|
|
72
72
|
onChange?: (content: T) => void;
|
|
73
73
|
isEditMode: boolean;
|
|
74
74
|
openModal?: (title: string, content: ReactNode) => void;
|
|
75
|
+
/** Delete this whole section. Used e.g. when a colors section's last swatch
|
|
76
|
+
* is dragged into another section, leaving it empty. */
|
|
77
|
+
onDelete?: () => void;
|
|
75
78
|
}
|
|
76
79
|
export interface WrapperProps {
|
|
77
80
|
sectionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lib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,MAAM,EAAE,GAAG,IAAI,CAE9E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAEjE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEtE;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE3D;AAED,wBAAgB,cAAc,IAAI,iBAAiB,EAAE,CAEpD;AAED,wBAAgB,aAAa,IAAI,OAAO,EAAE,CAEzC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
package/dist/media/index.js
CHANGED
package/dist/schemas/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
AudienceNameSchema,
|
|
4
4
|
MediaGridOptionsSchema,
|
|
5
5
|
slugifyAudienceName
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-QB5Q23G2.js";
|
|
7
7
|
import {
|
|
8
8
|
AudienceSchema,
|
|
9
9
|
RoleSchema,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
TextLineSchema,
|
|
41
41
|
VariantSchema,
|
|
42
42
|
normalizeSiteIndex
|
|
43
|
-
} from "../chunk-
|
|
43
|
+
} from "../chunk-RSITF24B.js";
|
|
44
44
|
import "../chunk-VKAGMEKE.js";
|
|
45
45
|
import "../chunk-NSCT3AMV.js";
|
|
46
46
|
import "../chunk-JSBRDJBE.js";
|
|
@@ -179,6 +179,12 @@ export declare const SiteConfigSchema: z.ZodObject<{
|
|
|
179
179
|
light: "light";
|
|
180
180
|
dark: "dark";
|
|
181
181
|
}>>;
|
|
182
|
+
cornerRadius: z.ZodDefault<z.ZodEnum<{
|
|
183
|
+
none: "none";
|
|
184
|
+
small: "small";
|
|
185
|
+
medium: "medium";
|
|
186
|
+
large: "large";
|
|
187
|
+
}>>;
|
|
182
188
|
headingFont: z.ZodDefault<z.ZodString>;
|
|
183
189
|
bodyFont: z.ZodDefault<z.ZodString>;
|
|
184
190
|
uppercaseHeadings: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"site-config.d.ts","sourceRoot":"","sources":["../../src/schemas/site-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"site-config.d.ts","sourceRoot":"","sources":["../../src/schemas/site-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,eAAO,MAAM,iBAAiB;;;;;;;;;iBAI5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAO5D,eAAO,MAAM,cAAc,0DAA2D,CAAC;AAEvF,eAAO,MAAM,gBAAgB;;;EAA+B,CAAC;AAE7D,eAAO,MAAM,UAAU;;;;;;;;;;;;iBASrB,CAAC;AAEH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AA0C9C,QAAA,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6CtB,CAAC;AAEL,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAyE,CAAC;AAElG,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE7D,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAE1D;AAMD,eAAO,MAAM,iBAAiB;;;;;iBAM5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAwB5B,CAAC;AACL,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4B3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ interface Props {
|
|
|
17
17
|
showLabel?: boolean;
|
|
18
18
|
onChange?: (content: SectionContent) => void;
|
|
19
19
|
openModal?: (title: string, content: ReactNode) => void;
|
|
20
|
+
onDelete?: () => void;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
function getContrastClass(hex: string | undefined): string {
|
|
@@ -49,7 +50,7 @@ function buildContent(
|
|
|
49
50
|
};
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
export default function Colors({ colors, columns = 3, label, collapsing, showLabel = true, onChange, openModal }: Props) {
|
|
53
|
+
export default function Colors({ colors, columns = 3, label, collapsing, showLabel = true, onChange, openModal, onDelete }: Props) {
|
|
53
54
|
if (onChange && openModal) {
|
|
54
55
|
return (
|
|
55
56
|
<ColorsEditable
|
|
@@ -60,6 +61,7 @@ export default function Colors({ colors, columns = 3, label, collapsing, showLab
|
|
|
60
61
|
showLabel={showLabel}
|
|
61
62
|
onChange={onChange}
|
|
62
63
|
openModal={openModal}
|
|
64
|
+
onDelete={onDelete}
|
|
63
65
|
/>
|
|
64
66
|
);
|
|
65
67
|
}
|
|
@@ -125,7 +127,7 @@ function ColorsView({
|
|
|
125
127
|
const hex = color.spaces[0]?.hex;
|
|
126
128
|
const contrast = getContrastClass(hex);
|
|
127
129
|
return (
|
|
128
|
-
<div key={i} className="overflow-hidden rounded-
|
|
130
|
+
<div key={i} className="flex h-full flex-col overflow-hidden rounded-outer border border-base-200">
|
|
129
131
|
<div className={cn("relative flex min-h-[80px] items-end p-3", contrast)} style={{ backgroundColor: hex || "#ccc" }}>
|
|
130
132
|
{color.name && <span className="text-sm font-bold">{color.name}</span>}
|
|
131
133
|
{copiedIndex === i && (
|
|
@@ -138,7 +140,8 @@ function ColorsView({
|
|
|
138
140
|
)}
|
|
139
141
|
</div>
|
|
140
142
|
{expanded && (
|
|
141
|
-
|
|
143
|
+
// flex-1 so every swatch's label block grows to the tallest in its row.
|
|
144
|
+
<div className="flex-1 space-y-1 bg-base-accent p-3 text-sm">
|
|
142
145
|
{color.spaces.map((space, j) =>
|
|
143
146
|
Object.entries(space).map(([key, value]) =>
|
|
144
147
|
value ? (
|
|
@@ -168,6 +171,7 @@ function ColorsEditable({
|
|
|
168
171
|
showLabel,
|
|
169
172
|
onChange,
|
|
170
173
|
openModal,
|
|
174
|
+
onDelete,
|
|
171
175
|
}: {
|
|
172
176
|
colors: ColorItem[];
|
|
173
177
|
columns: number;
|
|
@@ -176,6 +180,7 @@ function ColorsEditable({
|
|
|
176
180
|
showLabel?: boolean;
|
|
177
181
|
onChange: (content: SectionContent) => void;
|
|
178
182
|
openModal: (title: string, content: ReactNode) => void;
|
|
183
|
+
onDelete?: () => void;
|
|
179
184
|
}) {
|
|
180
185
|
const [expanded, setExpanded] = useState(!collapsing);
|
|
181
186
|
const options = { label, columns, collapsing, showLabel };
|
|
@@ -224,6 +229,10 @@ function ColorsEditable({
|
|
|
224
229
|
<EditableGrid
|
|
225
230
|
items={colors}
|
|
226
231
|
columns={columns}
|
|
232
|
+
// Shared group lets a swatch be dragged from one colors section into another.
|
|
233
|
+
group="colors"
|
|
234
|
+
// When the last swatch is dragged out to another section, delete this now-empty one.
|
|
235
|
+
onEmptied={onDelete}
|
|
227
236
|
onChange={(newColors) => onChange(buildContent(newColors, options))}
|
|
228
237
|
createItem={createColorItem}
|
|
229
238
|
isEditMode={true}
|
|
@@ -267,7 +276,7 @@ function ColorSwatchEditable({
|
|
|
267
276
|
};
|
|
268
277
|
|
|
269
278
|
return (
|
|
270
|
-
<div className="overflow-hidden rounded-
|
|
279
|
+
<div className="flex h-full flex-col overflow-hidden rounded-outer border border-base-200">
|
|
271
280
|
<div className={cn("flex min-h-[80px] items-end p-3", contrast)} style={{ backgroundColor: hex || "#ccc" }}>
|
|
272
281
|
<EditablePlainText
|
|
273
282
|
tag="span"
|
|
@@ -279,7 +288,8 @@ function ColorSwatchEditable({
|
|
|
279
288
|
/>
|
|
280
289
|
</div>
|
|
281
290
|
{expanded && (
|
|
282
|
-
|
|
291
|
+
// flex-1 so every swatch's label block grows to the tallest in its row.
|
|
292
|
+
<div className="flex-1 space-y-1 bg-base-accent p-3 text-sm">
|
|
283
293
|
{color.spaces.map((space, j) =>
|
|
284
294
|
Object.entries(space).map(([key, value]) =>
|
|
285
295
|
value ? (
|
|
@@ -39,8 +39,8 @@ const MD_STYLES =
|
|
|
39
39
|
"[&_p:not(:first-child)]:mt-2 [&_ul]:mt-1 [&_ul]:list-disc [&_ul]:pl-4 " +
|
|
40
40
|
"[&_ol]:mt-1 [&_ol]:list-decimal [&_ol]:pl-4 [&_li:not(:first-child)]:mt-1 " +
|
|
41
41
|
"[&_a]:underline [&_a]:underline-offset-2 [&_a]:text-primary " +
|
|
42
|
-
"[&_code]:rounded [&_code]:bg-base-200 [&_code]:px-1 [&_code]:font-mono [&_code]:text-[0.8em] " +
|
|
43
|
-
"[&_pre]:mt-2 [&_pre]:overflow-x-auto [&_pre]:rounded [&_pre]:bg-base-200 [&_pre]:p-2 " +
|
|
42
|
+
"[&_code]:rounded-inner [&_code]:bg-base-200 [&_code]:px-1 [&_code]:font-mono [&_code]:text-[0.8em] " +
|
|
43
|
+
"[&_pre]:mt-2 [&_pre]:overflow-x-auto [&_pre]:rounded-inner [&_pre]:bg-base-200 [&_pre]:p-2 " +
|
|
44
44
|
"[&_h1]:mt-2 [&_h1]:font-semibold [&_h2]:mt-2 [&_h2]:font-semibold " +
|
|
45
45
|
"[&_h3]:mt-2 [&_h3]:font-semibold [&_h4]:mt-2 [&_h4]:font-semibold " +
|
|
46
46
|
"[&_blockquote]:mt-2 [&_blockquote]:border-l-2 [&_blockquote]:border-base-200 [&_blockquote]:pl-2";
|
|
@@ -209,13 +209,13 @@ export default function ChatPanel({ open, onClose, siteName, tasks, isEditor, dr
|
|
|
209
209
|
return (
|
|
210
210
|
<div role="dialog" aria-label={`Chat with ${siteName}`}
|
|
211
211
|
className={cn(
|
|
212
|
-
"fixed z-40 flex h-[28rem] w-80 flex-col rounded-
|
|
212
|
+
"fixed z-40 flex h-[28rem] w-80 flex-col rounded-outer border border-base-200 bg-base shadow-xl",
|
|
213
213
|
variant === "editor" ? "bottom-4 fab-panel-left max-w-[calc(100vw-5.25rem)]" : "bottom-20 right-4",
|
|
214
214
|
)}>
|
|
215
215
|
|
|
216
216
|
<div className="flex items-center justify-between gap-2 border-b border-base-200 px-3 py-2">
|
|
217
217
|
<span className="text-sm font-medium text-base-contrast">Portal Assistant</span>
|
|
218
|
-
<IconButton icon={<RemoveIcon size={18} />} label="Close chat" onClick={onClose} className="rounded-
|
|
218
|
+
<IconButton icon={<RemoveIcon size={18} />} label="Close chat" onClick={onClose} className="rounded-inner hover:bg-base-accent" />
|
|
219
219
|
</div>
|
|
220
220
|
{tasks.length > 0 && (
|
|
221
221
|
<div className="border-b border-base-200 px-3 py-2">
|
|
@@ -233,11 +233,11 @@ export default function ChatPanel({ open, onClose, siteName, tasks, isEditor, dr
|
|
|
233
233
|
m.role === "assistant" && mdReady && m.content ? (
|
|
234
234
|
<div
|
|
235
235
|
key={i}
|
|
236
|
-
className={cn("max-w-[85%] rounded-
|
|
236
|
+
className={cn("max-w-[85%] rounded-outer bg-base-accent px-3 py-2 text-sm text-base-contrast", MD_STYLES)}
|
|
237
237
|
dangerouslySetInnerHTML={{ __html: assistantHtml(m.content) }}
|
|
238
238
|
/>
|
|
239
239
|
) : (
|
|
240
|
-
<div key={i} className={cn("max-w-[85%] whitespace-pre-wrap rounded-
|
|
240
|
+
<div key={i} className={cn("max-w-[85%] whitespace-pre-wrap rounded-outer px-3 py-2 text-sm",
|
|
241
241
|
m.role === "user" ? "ml-auto bg-primary text-primary-contrast" : "bg-base-accent text-base-contrast")}>
|
|
242
242
|
{m.content || (busy && i === messages.length - 1 ? "…" : m.content)}
|
|
243
243
|
</div>
|
|
@@ -254,10 +254,10 @@ export default function ChatPanel({ open, onClose, siteName, tasks, isEditor, dr
|
|
|
254
254
|
onKeyDown={onComposerKeyDown}
|
|
255
255
|
placeholder={`Ask about ${siteName}…`}
|
|
256
256
|
maxLength={4000}
|
|
257
|
-
className="max-h-[5.625rem] min-w-0 flex-1 resize-none overflow-y-auto rounded border border-base-200 bg-base px-2 py-1 text-sm text-base-contrast focus:outline-none focus:bg-[color-mix(in_srgb,var(--color-base),var(--color-base-contrast)_5%)]"
|
|
257
|
+
className="max-h-[5.625rem] min-w-0 flex-1 resize-none overflow-y-auto rounded-inner border border-base-200 bg-base px-2 py-1 text-sm text-base-contrast focus:outline-none focus:bg-[color-mix(in_srgb,var(--color-base),var(--color-base-contrast)_5%)]"
|
|
258
258
|
/>
|
|
259
259
|
<button type="submit" aria-label="Send" disabled={busy}
|
|
260
|
-
className="rounded bg-primary px-3 py-1 text-sm text-primary-contrast disabled:opacity-50">→</button>
|
|
260
|
+
className="rounded-inner bg-primary px-3 py-1 text-sm text-primary-contrast disabled:opacity-50">→</button>
|
|
261
261
|
</form>
|
|
262
262
|
{isEditor && <p className="border-t border-base-200 px-3 py-1 text-[10px] text-base-contrast-light">Editor view — answers ground on published content.</p>}
|
|
263
263
|
</div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { useRef, useEffect, useState, type ReactNode } from "react";
|
|
1
|
+
import { useRef, useEffect, useState, useId, type ReactNode } from "react";
|
|
2
2
|
import { ImageIcon } from "lucide-react";
|
|
3
3
|
import { AddIcon, DragHandle, DeleteIcon, SettingsIcon } from "../shared/icons";
|
|
4
4
|
import { IconButton } from "../shared/IconButton";
|
|
5
5
|
import { cn } from "../../lib/cn";
|
|
6
6
|
import { containerGridClass } from "../../lib/container-grid";
|
|
7
7
|
import { useEditableCollection } from "./useEditableCollection";
|
|
8
|
+
import { resolveDropIndex } from "./gridDrop";
|
|
8
9
|
|
|
9
10
|
interface EditableGridProps<T> {
|
|
10
11
|
items: T[];
|
|
@@ -17,6 +18,16 @@ interface EditableGridProps<T> {
|
|
|
17
18
|
onItemImageClick?: (index: number) => void;
|
|
18
19
|
chromeTopClass?: string;
|
|
19
20
|
className?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Items can be dragged BETWEEN two EditableGrids that share the same non-null
|
|
23
|
+
* `group` (e.g. two colors sections). Without a group, a grid only reorders
|
|
24
|
+
* its own items. Only pass the same group to grids whose item shape matches —
|
|
25
|
+
* a cross-grid drop inserts the source item verbatim into the destination.
|
|
26
|
+
*/
|
|
27
|
+
group?: string;
|
|
28
|
+
/** Called instead of removing the last item when it is dragged out to another
|
|
29
|
+
* grid — lets the owner tear down a now-empty container (e.g. delete the section). */
|
|
30
|
+
onEmptied?: () => void;
|
|
20
31
|
}
|
|
21
32
|
|
|
22
33
|
export function EditableGrid<T>({
|
|
@@ -30,8 +41,11 @@ export function EditableGrid<T>({
|
|
|
30
41
|
onItemImageClick,
|
|
31
42
|
chromeTopClass,
|
|
32
43
|
className,
|
|
44
|
+
group,
|
|
45
|
+
onEmptied,
|
|
33
46
|
}: EditableGridProps<T>) {
|
|
34
|
-
const
|
|
47
|
+
const gridId = useId();
|
|
48
|
+
const { wrappedItems, onReorder, onAdd, onInsert, onInsertItem, onRemove } = useEditableCollection({
|
|
35
49
|
items,
|
|
36
50
|
onChange,
|
|
37
51
|
createItem,
|
|
@@ -44,18 +58,63 @@ export function EditableGrid<T>({
|
|
|
44
58
|
|
|
45
59
|
const [isDragging, setIsDragging] = useState(false);
|
|
46
60
|
|
|
61
|
+
// The drop transaction is centralized here (not in each GridCell) because this
|
|
62
|
+
// monitor is GLOBAL: it fires for every grid-cell drop on the page, so the
|
|
63
|
+
// source grid and destination grid each see the same drop and act on their own
|
|
64
|
+
// collection — source removes, destination inserts, same-grid reorders. Keep
|
|
65
|
+
// the latest handlers/config in a ref so the monitor can be set up once.
|
|
66
|
+
const cfgRef = useRef({ gridId, group, itemCount: wrappedItems.length, onReorder, onRemove, onInsertItem, onEmptied });
|
|
67
|
+
cfgRef.current = { gridId, group, itemCount: wrappedItems.length, onReorder, onRemove, onInsertItem, onEmptied };
|
|
68
|
+
|
|
47
69
|
useEffect(() => {
|
|
48
70
|
let cleanup: (() => void) | undefined;
|
|
49
71
|
let cancelled = false;
|
|
50
72
|
|
|
51
|
-
|
|
73
|
+
Promise.all([
|
|
74
|
+
import("@atlaskit/pragmatic-drag-and-drop/element/adapter"),
|
|
75
|
+
import("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge"),
|
|
76
|
+
]).then(([{ monitorForElements }, { extractClosestEdge }]) => {
|
|
52
77
|
if (cancelled) return;
|
|
53
78
|
cleanup = monitorForElements({
|
|
54
79
|
onDragStart: ({ source }) => {
|
|
55
80
|
if (source.data.dragType === "grid-cell") setIsDragging(true);
|
|
56
81
|
},
|
|
57
|
-
onDrop: ({ source }) => {
|
|
58
|
-
if (source.data.dragType
|
|
82
|
+
onDrop: ({ source, location }) => {
|
|
83
|
+
if (source.data.dragType !== "grid-cell") return;
|
|
84
|
+
setIsDragging(false);
|
|
85
|
+
// Every grid clears its own indicator on any drop — this is what stops
|
|
86
|
+
// the destination grid's drop line from sticking after a cross-grid drop.
|
|
87
|
+
setDragState({ sourceId: null, closestEdge: null });
|
|
88
|
+
|
|
89
|
+
const { gridId: my, group: myGroup, itemCount, onReorder, onRemove, onInsertItem, onEmptied } = cfgRef.current;
|
|
90
|
+
const srcGridId = source.data.gridId as string;
|
|
91
|
+
const target = location.current.dropTargets[0];
|
|
92
|
+
const dstGridId = target?.data.gridId as string | undefined;
|
|
93
|
+
|
|
94
|
+
// Same-grid reorder — only the owning grid acts on it.
|
|
95
|
+
if (srcGridId === my && dstGridId === my && target) {
|
|
96
|
+
const fromIndex = source.data.index as number;
|
|
97
|
+
const edge = extractClosestEdge(target.data) as "left" | "right" | null;
|
|
98
|
+
const toIndex = resolveDropIndex({ fromIndex, targetIndex: target.data.index as number, edge, sameCollection: true });
|
|
99
|
+
if (fromIndex !== toIndex) onReorder(fromIndex, toIndex);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Cross-grid transfer requires a shared group. The source grid removes
|
|
104
|
+
// its item; the destination grid inserts it. Two grids, two updates.
|
|
105
|
+
const crossAllowed = myGroup != null && source.data.group === myGroup;
|
|
106
|
+
if (!crossAllowed) return;
|
|
107
|
+
|
|
108
|
+
if (srcGridId === my && dstGridId && dstGridId !== my) {
|
|
109
|
+
// Dragging the last item out empties this grid — let the owner tear
|
|
110
|
+
// down the now-empty container instead of leaving it behind.
|
|
111
|
+
if (itemCount <= 1 && onEmptied) onEmptied();
|
|
112
|
+
else onRemove(source.data.id as string);
|
|
113
|
+
} else if (dstGridId === my && srcGridId !== my && target) {
|
|
114
|
+
const edge = extractClosestEdge(target.data) as "left" | "right" | null;
|
|
115
|
+
const toIndex = resolveDropIndex({ fromIndex: source.data.index as number, targetIndex: target.data.index as number, edge, sameCollection: false });
|
|
116
|
+
onInsertItem(toIndex, source.data.item as T);
|
|
117
|
+
}
|
|
59
118
|
},
|
|
60
119
|
});
|
|
61
120
|
});
|
|
@@ -88,9 +147,11 @@ export function EditableGrid<T>({
|
|
|
88
147
|
key={wrapped.id}
|
|
89
148
|
id={wrapped.id}
|
|
90
149
|
index={index}
|
|
150
|
+
gridId={gridId}
|
|
151
|
+
group={group}
|
|
152
|
+
item={wrapped.data}
|
|
91
153
|
isLast={index === wrappedItems.length - 1}
|
|
92
154
|
isDragging={isDragging}
|
|
93
|
-
onReorder={onReorder}
|
|
94
155
|
onRemove={onRemove}
|
|
95
156
|
onInsert={onInsert}
|
|
96
157
|
onSettings={onItemSettings ? () => onItemSettings(index) : undefined}
|
|
@@ -117,12 +178,14 @@ export function EditableGrid<T>({
|
|
|
117
178
|
);
|
|
118
179
|
}
|
|
119
180
|
|
|
120
|
-
function GridCell({
|
|
181
|
+
function GridCell<T>({
|
|
121
182
|
id,
|
|
122
183
|
index,
|
|
184
|
+
gridId,
|
|
185
|
+
group,
|
|
186
|
+
item,
|
|
123
187
|
isLast,
|
|
124
188
|
isDragging,
|
|
125
|
-
onReorder,
|
|
126
189
|
onRemove,
|
|
127
190
|
onInsert,
|
|
128
191
|
onSettings,
|
|
@@ -134,9 +197,11 @@ function GridCell({
|
|
|
134
197
|
}: {
|
|
135
198
|
id: string;
|
|
136
199
|
index: number;
|
|
200
|
+
gridId: string;
|
|
201
|
+
group?: string;
|
|
202
|
+
item: T;
|
|
137
203
|
isLast: boolean;
|
|
138
204
|
isDragging: boolean;
|
|
139
|
-
onReorder: (from: number, to: number) => void;
|
|
140
205
|
onRemove: (id: string) => void;
|
|
141
206
|
onInsert: (index: number) => void;
|
|
142
207
|
onSettings?: () => void;
|
|
@@ -165,17 +230,22 @@ function GridCell({
|
|
|
165
230
|
|
|
166
231
|
const cleanupDraggable = draggable({
|
|
167
232
|
element: handle,
|
|
168
|
-
|
|
233
|
+
// `item` rides along so a cross-grid destination can insert it verbatim.
|
|
234
|
+
getInitialData: () => ({ dragType: "grid-cell", gridId, group, id, index, item }),
|
|
169
235
|
onDragStart: () => setDragState({ sourceId: id, closestEdge: null }),
|
|
170
236
|
onDrop: () => setDragState({ sourceId: null, closestEdge: null }),
|
|
171
237
|
});
|
|
172
238
|
|
|
173
239
|
const cleanupDropTarget = dropTargetForElements({
|
|
174
240
|
element: cell,
|
|
175
|
-
|
|
241
|
+
// Accept a reorder within this grid, or a transfer from another grid in
|
|
242
|
+
// the same group. The actual move is performed by the grid-level monitor.
|
|
243
|
+
canDrop: ({ source }) =>
|
|
244
|
+
source.data.dragType === "grid-cell" &&
|
|
245
|
+
(source.data.gridId === gridId || (group != null && source.data.group === group)),
|
|
176
246
|
getData: ({ input, element }) =>
|
|
177
247
|
attachClosestEdge(
|
|
178
|
-
{ id, index },
|
|
248
|
+
{ gridId, id, index },
|
|
179
249
|
{ input, element, allowedEdges: ["left", "right"] },
|
|
180
250
|
),
|
|
181
251
|
onDragEnter: ({ self }) => {
|
|
@@ -189,16 +259,6 @@ function GridCell({
|
|
|
189
259
|
onDragLeave: () => {
|
|
190
260
|
setDragState((prev) => prev.closestEdge?.id === id ? { ...prev, closestEdge: null } : prev);
|
|
191
261
|
},
|
|
192
|
-
onDrop: ({ source, self }) => {
|
|
193
|
-
const fromIndex = source.data.index as number;
|
|
194
|
-
const edge = extractClosestEdge(self.data);
|
|
195
|
-
let toIndex = index;
|
|
196
|
-
if (edge === "right") toIndex = index + 1;
|
|
197
|
-
if (fromIndex < toIndex) toIndex--;
|
|
198
|
-
if (fromIndex !== toIndex) {
|
|
199
|
-
onReorder(fromIndex, toIndex);
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
262
|
});
|
|
203
263
|
|
|
204
264
|
cleanup = () => {
|
|
@@ -211,7 +271,7 @@ function GridCell({
|
|
|
211
271
|
cancelled = true;
|
|
212
272
|
cleanup?.();
|
|
213
273
|
};
|
|
214
|
-
}, [id, index,
|
|
274
|
+
}, [id, index, gridId, group, item, setDragState]);
|
|
215
275
|
|
|
216
276
|
const isCellDragging = dragState.sourceId === id;
|
|
217
277
|
const showLeftEdge = dragState.closestEdge?.id === id && dragState.closestEdge.edge === "left" && dragState.sourceId !== id;
|
|
@@ -221,7 +281,9 @@ function GridCell({
|
|
|
221
281
|
<div
|
|
222
282
|
ref={cellRef}
|
|
223
283
|
className={cn(
|
|
224
|
-
|
|
284
|
+
// h-full so a full-height renderItem (e.g. a colors swatch) fills the
|
|
285
|
+
// stretched grid track and can equalize height across the row.
|
|
286
|
+
"group/cell relative h-full",
|
|
225
287
|
isCellDragging && "opacity-50",
|
|
226
288
|
)}
|
|
227
289
|
>
|
|
@@ -93,7 +93,7 @@ export function ResolvedMedia({
|
|
|
93
93
|
)}
|
|
94
94
|
</>
|
|
95
95
|
) : (
|
|
96
|
-
<div className="flex aspect-video h-full w-full flex-col items-center justify-center gap-1 rounded bg-base-accent text-base-contrast-light/50">
|
|
96
|
+
<div className="flex aspect-video h-full w-full flex-col items-center justify-center gap-1 rounded-outer bg-base-accent text-base-contrast-light/50">
|
|
97
97
|
<ImageIcon size={24} />
|
|
98
98
|
<span className="text-sm">No Image</span>
|
|
99
99
|
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert a drop target (the cell being dropped onto + the closest edge) into
|
|
3
|
+
* the destination index for the moved item.
|
|
4
|
+
*
|
|
5
|
+
* Same-collection reorder: the dragged item is spliced OUT of the array before
|
|
6
|
+
* being re-inserted, so a destination past its original position shifts down by
|
|
7
|
+
* one — hence the `fromIndex < toIndex` decrement.
|
|
8
|
+
*
|
|
9
|
+
* Cross-collection insert: nothing is removed from the destination array, so no
|
|
10
|
+
* shift adjustment applies.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveDropIndex({
|
|
13
|
+
fromIndex,
|
|
14
|
+
targetIndex,
|
|
15
|
+
edge,
|
|
16
|
+
sameCollection,
|
|
17
|
+
}: {
|
|
18
|
+
fromIndex: number;
|
|
19
|
+
targetIndex: number;
|
|
20
|
+
edge: "left" | "right" | null;
|
|
21
|
+
sameCollection: boolean;
|
|
22
|
+
}): number {
|
|
23
|
+
let toIndex = targetIndex + (edge === "right" ? 1 : 0);
|
|
24
|
+
if (sameCollection && fromIndex < toIndex) toIndex--;
|
|
25
|
+
return toIndex;
|
|
26
|
+
}
|