@drawnagency/primitives 0.1.51 → 0.1.53
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.
|
@@ -11,8 +11,6 @@ export interface PagesModalProps {
|
|
|
11
11
|
onSetFields: (pageId: string, patch: Partial<Pick<Page, "title" | "slug" | "showInNav">>) => void;
|
|
12
12
|
onSetAudience: (pageId: string, access: string[]) => void;
|
|
13
13
|
onConfirmDelete: (pageId: string) => void;
|
|
14
|
-
/** Navigate the editor to this page (the shell also closes the modal). */
|
|
15
|
-
onNavigate: (pageId: string) => void;
|
|
16
14
|
}
|
|
17
15
|
export declare function PagesModal(props: PagesModalProps): import("react/jsx-runtime").JSX.Element;
|
|
18
16
|
//# sourceMappingURL=PagesModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PagesModal.d.ts","sourceRoot":"","sources":["../../../src/components/editor/PagesModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAUjD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,+EAA+E;IAC/E,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAClG,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1D,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"PagesModal.d.ts","sourceRoot":"","sources":["../../../src/components/editor/PagesModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAUjD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,+EAA+E;IAC/E,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAClG,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1D,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,2CA2EhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,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,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CA22BP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawnagency/primitives",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.10",
|
|
59
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.5",
|
|
59
60
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
60
61
|
"@tiptap/core": "^3.20.4",
|
|
61
62
|
"@tiptap/extension-link": "^3.20.4",
|
|
@@ -22,8 +22,6 @@ export interface PagesModalProps {
|
|
|
22
22
|
onSetFields: (pageId: string, patch: Partial<Pick<Page, "title" | "slug" | "showInNav">>) => void;
|
|
23
23
|
onSetAudience: (pageId: string, access: string[]) => void;
|
|
24
24
|
onConfirmDelete: (pageId: string) => void;
|
|
25
|
-
/** Navigate the editor to this page (the shell also closes the modal). */
|
|
26
|
-
onNavigate: (pageId: string) => void;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
export function PagesModal(props: PagesModalProps) {
|
|
@@ -61,7 +59,6 @@ export function PagesModal(props: PagesModalProps) {
|
|
|
61
59
|
dragIndex={dragIndex}
|
|
62
60
|
onReorder={props.onReorder}
|
|
63
61
|
onToggleExpand={() => toggleExpand(page.id)}
|
|
64
|
-
onNavigate={() => props.onNavigate(page.id)}
|
|
65
62
|
onSetHome={() => props.onSetHome(page.id)}
|
|
66
63
|
onSetArchived={(v) => {
|
|
67
64
|
// Archiving/restoring remounts the row in its new group, so end the
|
|
@@ -105,12 +102,12 @@ export function PagesModal(props: PagesModalProps) {
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
function PageRow({
|
|
108
|
-
page, audiences, expanded, isNew, otherSlugs, dragIndex, onReorder, onToggleExpand,
|
|
105
|
+
page, audiences, expanded, isNew, otherSlugs, dragIndex, onReorder, onToggleExpand, onSetHome, onSetArchived, onSetFields, onSetAudience, onRequestDelete,
|
|
109
106
|
}: {
|
|
110
107
|
page: Page; audiences: Audience[]; expanded: boolean;
|
|
111
108
|
isNew: boolean; otherSlugs: string[];
|
|
112
109
|
dragIndex?: number; onReorder: (fromIndex: number, toIndex: number) => void;
|
|
113
|
-
onToggleExpand: () => void;
|
|
110
|
+
onToggleExpand: () => void; onSetHome: () => void; onSetArchived: (v: boolean) => void;
|
|
114
111
|
onSetFields: (patch: Partial<Pick<Page, "title" | "slug" | "showInNav">>) => void;
|
|
115
112
|
onSetAudience: (access: string[]) => void; onRequestDelete: () => void;
|
|
116
113
|
}) {
|
|
@@ -277,22 +274,17 @@ function PageRow({
|
|
|
277
274
|
<DragHandle ref={handleRef} />
|
|
278
275
|
</div>
|
|
279
276
|
)}
|
|
280
|
-
<
|
|
281
|
-
type="button"
|
|
282
|
-
aria-label={`Go to ${pageDisplayTitle(page.title)}`}
|
|
283
|
-
onClick={onNavigate}
|
|
284
|
-
className="group min-w-0 flex-1 cursor-pointer text-left"
|
|
285
|
-
>
|
|
277
|
+
<div className="min-w-0 flex-1">
|
|
286
278
|
<div className="flex items-center gap-2">
|
|
287
|
-
<span className={cn("truncate text-sm font-medium text-base-contrast
|
|
279
|
+
<span className={cn("truncate text-sm font-medium text-base-contrast", !page.title && "italic text-base-contrast/60")}>
|
|
288
280
|
{pageDisplayTitle(page.title)}
|
|
289
281
|
</span>
|
|
290
282
|
{page.isHome && <span className="rounded bg-primary px-1.5 py-0.5 text-xs font-medium text-primary-contrast">Home page</span>}
|
|
291
283
|
{!page.showInNav && <span className="rounded bg-base-100 px-1.5 py-0.5 text-xs font-medium text-base-contrast">Hidden</span>}
|
|
292
284
|
{page.status === "archived" && <span className="rounded bg-base-100 px-1.5 py-0.5 text-xs font-medium text-base-contrast">Archived</span>}
|
|
293
285
|
</div>
|
|
294
|
-
<div className="text-xs text-base-contrast/70
|
|
295
|
-
</
|
|
286
|
+
<div className="text-xs text-base-contrast/70">{page.isHome ? "/" : `/${page.slug}`}</div>
|
|
287
|
+
</div>
|
|
296
288
|
<button
|
|
297
289
|
type="button"
|
|
298
290
|
aria-label={`Edit settings for ${pageDisplayTitle(page.title)}`}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Fragment, useState, useCallback, useEffect, useRef, useMemo, type ReactNode } from "react";
|
|
2
2
|
|
|
3
3
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
4
|
+
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
5
|
+
import { autoScrollWindowForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
4
6
|
import type { LoadedSection } from "../../lib/loader";
|
|
5
7
|
import type { SectionContent } from "../../schemas/sections";
|
|
6
8
|
import type { SiteIndex, SiteConfig, Page } from "../../schemas/site-config";
|
|
@@ -948,10 +950,6 @@ export default function EditorShell({
|
|
|
948
950
|
onSetFields={handleSetPageFields}
|
|
949
951
|
onSetAudience={handleSetPageAudience}
|
|
950
952
|
onConfirmDelete={handleDeletePage}
|
|
951
|
-
onNavigate={(id) => {
|
|
952
|
-
goToPage(id);
|
|
953
|
-
setShowPagesModal(false);
|
|
954
|
-
}}
|
|
955
953
|
/>
|
|
956
954
|
</EditorModal>
|
|
957
955
|
<EditorModal isOpen={movingSectionId !== null} onClose={() => setMovingSectionId(null)} title="Move to page">
|
|
@@ -1155,13 +1153,20 @@ function EditorContent({
|
|
|
1155
1153
|
: sections;
|
|
1156
1154
|
|
|
1157
1155
|
useEffect(() => {
|
|
1158
|
-
return
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1156
|
+
return combine(
|
|
1157
|
+
monitorForElements({
|
|
1158
|
+
onDragStart: ({ source }) => {
|
|
1159
|
+
if (source.data.dragType === "section") {
|
|
1160
|
+
setPendingInsertIndex(null);
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
}),
|
|
1164
|
+
// Gradually scroll the window when a section drag nears the viewport
|
|
1165
|
+
// edge, so long reorders don't require repeated drag-and-release
|
|
1166
|
+
autoScrollWindowForElements({
|
|
1167
|
+
canScroll: ({ source }) => source.data.dragType === "section",
|
|
1168
|
+
}),
|
|
1169
|
+
);
|
|
1165
1170
|
}, []);
|
|
1166
1171
|
|
|
1167
1172
|
return (
|