@actuate-media/cms-admin 0.72.2 → 0.73.0
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/CHANGELOG.md +39 -0
- package/dist/__tests__/components/resizable-aside.test.d.ts +2 -0
- package/dist/__tests__/components/resizable-aside.test.d.ts.map +1 -0
- package/dist/__tests__/components/resizable-aside.test.js +77 -0
- package/dist/__tests__/components/resizable-aside.test.js.map +1 -0
- package/dist/__tests__/components/toggle.test.d.ts +2 -0
- package/dist/__tests__/components/toggle.test.d.ts.map +1 -0
- package/dist/__tests__/components/toggle.test.js +17 -0
- package/dist/__tests__/components/toggle.test.js.map +1 -0
- package/dist/__tests__/views/post-fields-modal.render.test.js +38 -0
- package/dist/__tests__/views/post-fields-modal.render.test.js.map +1 -1
- package/dist/actuate-admin.css +1 -1
- package/dist/components/MediaPickerModal.d.ts.map +1 -1
- package/dist/components/MediaPickerModal.js +1 -1
- package/dist/components/MediaPickerModal.js.map +1 -1
- package/dist/components/TagInput.js +1 -1
- package/dist/components/TagInput.js.map +1 -1
- package/dist/components/ui/Modal.d.ts +17 -1
- package/dist/components/ui/Modal.d.ts.map +1 -1
- package/dist/components/ui/Modal.js +29 -3
- package/dist/components/ui/Modal.js.map +1 -1
- package/dist/components/ui/ResizableAside.d.ts +38 -0
- package/dist/components/ui/ResizableAside.d.ts.map +1 -0
- package/dist/components/ui/ResizableAside.js +209 -0
- package/dist/components/ui/ResizableAside.js.map +1 -0
- package/dist/components/ui/Toggle.d.ts.map +1 -1
- package/dist/components/ui/Toggle.js +4 -3
- package/dist/components/ui/Toggle.js.map +1 -1
- package/dist/fields/RichTextField.d.ts +3 -1
- package/dist/fields/RichTextField.d.ts.map +1 -1
- package/dist/fields/RichTextField.js +2 -2
- package/dist/fields/RichTextField.js.map +1 -1
- package/dist/views/Dashboard.d.ts.map +1 -1
- package/dist/views/Dashboard.js +1 -1
- package/dist/views/Dashboard.js.map +1 -1
- package/dist/views/page-editor/PageSectionEditor.js +1 -1
- package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
- package/dist/views/page-editor/SectionInspector.d.ts +4 -1
- package/dist/views/page-editor/SectionInspector.d.ts.map +1 -1
- package/dist/views/page-editor/SectionInspector.js +14 -3
- package/dist/views/page-editor/SectionInspector.js.map +1 -1
- package/dist/views/post-editor/PostFieldsModal.d.ts +1 -1
- package/dist/views/post-editor/PostFieldsModal.d.ts.map +1 -1
- package/dist/views/post-editor/PostFieldsModal.js +152 -13
- package/dist/views/post-editor/PostFieldsModal.js.map +1 -1
- package/dist/views/post-editor/PostHeaderPanel.d.ts.map +1 -1
- package/dist/views/post-editor/PostHeaderPanel.js +2 -1
- package/dist/views/post-editor/PostHeaderPanel.js.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.js +6 -1
- package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
- package/dist/views/post-editor/PostTemplateEditor.js +1 -1
- package/dist/views/post-editor/PostTemplateEditor.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/components/resizable-aside.test.tsx +130 -0
- package/src/__tests__/components/toggle.test.tsx +17 -0
- package/src/__tests__/views/post-fields-modal.render.test.tsx +54 -0
- package/src/components/MediaPickerModal.tsx +6 -2
- package/src/components/TagInput.tsx +1 -1
- package/src/components/ui/Modal.tsx +46 -3
- package/src/components/ui/ResizableAside.tsx +317 -0
- package/src/components/ui/Toggle.tsx +4 -3
- package/src/fields/RichTextField.tsx +4 -1
- package/src/styles/actuate-tokens.css +7 -2
- package/src/views/Dashboard.tsx +2 -1
- package/src/views/page-editor/PageSectionEditor.tsx +1 -1
- package/src/views/page-editor/SectionInspector.tsx +54 -26
- package/src/views/post-editor/PostFieldsModal.tsx +412 -174
- package/src/views/post-editor/PostHeaderPanel.tsx +15 -11
- package/src/views/post-editor/PostSectionEditor.tsx +9 -1
- package/src/views/post-editor/PostTemplateEditor.tsx +1 -1
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
declare const MODAL_SIZE_CLASS: {
|
|
3
|
+
readonly md: "max-w-lg";
|
|
4
|
+
readonly lg: "max-w-3xl";
|
|
5
|
+
/** Wide form dialogs (post/page field editors) — body scrolls inside the shell. */
|
|
6
|
+
readonly xl: "flex max-h-[min(92vh,880px)] max-w-5xl flex-col";
|
|
7
|
+
};
|
|
8
|
+
export type ModalSize = keyof typeof MODAL_SIZE_CLASS;
|
|
2
9
|
export interface ModalProps {
|
|
3
10
|
open: boolean;
|
|
4
11
|
onClose: () => void;
|
|
5
12
|
title: string;
|
|
6
13
|
children: ReactNode;
|
|
7
14
|
actions?: ReactNode;
|
|
15
|
+
/** Dialog width preset. Defaults to `md` (512px). */
|
|
16
|
+
size?: ModalSize;
|
|
8
17
|
/**
|
|
9
18
|
* Accessible description for the dialog, announced after the title. Optional —
|
|
10
19
|
* omit when the body content is self-explanatory.
|
|
@@ -16,6 +25,12 @@ export interface ModalProps {
|
|
|
16
25
|
* form dialogs where the user should land in the first input.
|
|
17
26
|
*/
|
|
18
27
|
initialFocusRef?: RefObject<HTMLElement | null>;
|
|
28
|
+
/**
|
|
29
|
+
* When set, overlay click, Escape, and the header X invoke this instead of
|
|
30
|
+
* closing immediately — use to confirm before discarding unsaved edits.
|
|
31
|
+
* The dialog stays open until the parent calls `onClose()`.
|
|
32
|
+
*/
|
|
33
|
+
onDismiss?: () => void;
|
|
19
34
|
}
|
|
20
35
|
/**
|
|
21
36
|
* The canonical admin modal. Built on Radix `Dialog`, which provides the
|
|
@@ -28,5 +43,6 @@ export interface ModalProps {
|
|
|
28
43
|
* dialog inherits theme tokens and dark mode instead of rendering unstyled on
|
|
29
44
|
* `document.body`.
|
|
30
45
|
*/
|
|
31
|
-
export declare function Modal({ open, onClose, title, children, actions, description, initialFocusRef, }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function Modal({ open, onClose, title, children, actions, size, description, initialFocusRef, onDismiss, }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export {};
|
|
32
48
|
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Modal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Modal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtD,QAAA,MAAM,gBAAgB;;;IAGpB,mFAAmF;;CAE3E,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,gBAAgB,CAAA;AAErD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,SAAS,CAAA;IACnB,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,qDAAqD;IACrD,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAC/C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAW,EACX,WAAW,EACX,eAAe,EACf,SAAS,GACV,EAAE,UAAU,2CAmEZ"}
|
|
@@ -3,6 +3,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import * as Dialog from '@radix-ui/react-dialog';
|
|
4
4
|
import { X } from 'lucide-react';
|
|
5
5
|
import { adminPortalContainer } from '../../lib/portal-container.js';
|
|
6
|
+
const MODAL_SIZE_CLASS = {
|
|
7
|
+
md: 'max-w-lg',
|
|
8
|
+
lg: 'max-w-3xl',
|
|
9
|
+
/** Wide form dialogs (post/page field editors) — body scrolls inside the shell. */
|
|
10
|
+
xl: 'flex max-h-[min(92vh,880px)] max-w-5xl flex-col',
|
|
11
|
+
};
|
|
6
12
|
/**
|
|
7
13
|
* The canonical admin modal. Built on Radix `Dialog`, which provides the
|
|
8
14
|
* accessibility contract for free: focus is trapped while open and restored to
|
|
@@ -14,14 +20,34 @@ import { adminPortalContainer } from '../../lib/portal-container.js';
|
|
|
14
20
|
* dialog inherits theme tokens and dark mode instead of rendering unstyled on
|
|
15
21
|
* `document.body`.
|
|
16
22
|
*/
|
|
17
|
-
export function Modal({ open, onClose, title, children, actions, description, initialFocusRef, }) {
|
|
18
|
-
|
|
23
|
+
export function Modal({ open, onClose, title, children, actions, size = 'md', description, initialFocusRef, onDismiss, }) {
|
|
24
|
+
const scrollBody = size === 'xl';
|
|
25
|
+
function handleDismissAttempt() {
|
|
26
|
+
if (onDismiss)
|
|
27
|
+
onDismiss();
|
|
28
|
+
else
|
|
29
|
+
onClose();
|
|
30
|
+
}
|
|
31
|
+
return (_jsx(Dialog.Root, { open: open, onOpenChange: (next) => {
|
|
32
|
+
if (!next)
|
|
33
|
+
handleDismissAttempt();
|
|
34
|
+
}, children: _jsxs(Dialog.Portal, { container: adminPortalContainer(), children: [_jsx(Dialog.Overlay, { className: "fixed inset-0 z-60 bg-black/50" }), _jsxs(Dialog.Content, { className: `bg-card text-card-foreground border-border fixed top-1/2 left-1/2 z-60 w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 rounded-lg border shadow-xl focus:outline-none ${MODAL_SIZE_CLASS[size]}`, onInteractOutside: (event) => {
|
|
35
|
+
if (!onDismiss)
|
|
36
|
+
return;
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
handleDismissAttempt();
|
|
39
|
+
}, onEscapeKeyDown: (event) => {
|
|
40
|
+
if (!onDismiss)
|
|
41
|
+
return;
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
handleDismissAttempt();
|
|
44
|
+
}, onOpenAutoFocus: initialFocusRef
|
|
19
45
|
? (event) => {
|
|
20
46
|
if (initialFocusRef.current) {
|
|
21
47
|
event.preventDefault();
|
|
22
48
|
initialFocusRef.current.focus();
|
|
23
49
|
}
|
|
24
50
|
}
|
|
25
|
-
: undefined, children: [_jsxs("div", { className: "border-border flex items-center justify-between border-b px-6 py-4", children: [_jsx(Dialog.Title, { className: "text-foreground text-lg font-medium", children: title }), _jsx(Dialog.Close, { asChild: true, children: _jsx("button", { type: "button", "aria-label": "Close dialog", className: "text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md p-1 transition-colors focus-visible:ring-2 focus-visible:outline-none", children: _jsx(X, { className: "h-4 w-4", "aria-hidden": true }) }) })] }), description && (_jsx(Dialog.Description, { className: "text-muted-foreground px-6 pt-4 text-sm", children: description })), _jsx("div", { className:
|
|
51
|
+
: undefined, children: [_jsxs("div", { className: "border-border flex items-center justify-between border-b px-6 py-4", children: [_jsx(Dialog.Title, { className: "text-foreground text-lg font-medium", children: title }), _jsx(Dialog.Close, { asChild: true, children: _jsx("button", { type: "button", "aria-label": "Close dialog", className: "text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md p-1 transition-colors focus-visible:ring-2 focus-visible:outline-none", children: _jsx(X, { className: "h-4 w-4", "aria-hidden": true }) }) })] }), description && (_jsx(Dialog.Description, { className: "text-muted-foreground px-6 pt-4 text-sm", children: description })), _jsx("div", { className: scrollBody ? 'min-h-0 flex-1 overflow-y-auto px-6 py-4' : 'px-6 py-4', children: children }), actions && (_jsx("div", { className: "border-border flex justify-end gap-2 border-t px-6 py-4", children: actions }))] })] }) }));
|
|
26
52
|
}
|
|
27
53
|
//# sourceMappingURL=Modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/ui/Modal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/components/ui/Modal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAEhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,gBAAgB,GAAG;IACvB,EAAE,EAAE,UAAU;IACd,EAAE,EAAE,WAAW;IACf,mFAAmF;IACnF,EAAE,EAAE,iDAAiD;CAC7C,CAAA;AA+BV;;;;;;;;;;GAUG;AACH,MAAM,UAAU,KAAK,CAAC,EACpB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,IAAI,GAAG,IAAI,EACX,WAAW,EACX,eAAe,EACf,SAAS,GACE;IACX,MAAM,UAAU,GAAG,IAAI,KAAK,IA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QAAQ,gBACF,cAAc,EACzB,SAAS,EAAC,sKAAsK,YAEhL,KAAC,CAAC,IAAC,SAAS,EAAC,SAAS,wBAAe,GAC9B,GACI,IACX,EACL,WAAW,IAAI,CACd,KAAC,MAAM,CAAC,WAAW,IAAC,SAAS,EAAC,yCAAyC,YACpE,WAAW,GACO,CACtB,EACD,cAAK,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC,CAAC,WAAW,YAClF,QAAQ,GACL,EACL,OAAO,IAAI,CACV,cAAK,SAAS,EAAC,yDAAyD,YAAE,OAAO,GAAO,CACzF,IACc,IACH,GACJ,CACf,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ReactNode } from 'react';
|
|
2
|
+
export declare const SECTION_INSPECTOR_WIDTH_KEY = "actuate:section-inspector-width";
|
|
3
|
+
export declare const SECTION_INSPECTOR_DEFAULT_WIDTH = 320;
|
|
4
|
+
export declare const SECTION_INSPECTOR_MIN_WIDTH = 280;
|
|
5
|
+
export declare const SECTION_INSPECTOR_MAX_WIDTH = 640;
|
|
6
|
+
export declare const SECTION_INSPECTOR_MIN_CANVAS_WIDTH = 96;
|
|
7
|
+
/** Below this editor-row width the expand action uses an overlay panel. */
|
|
8
|
+
export declare const SECTION_INSPECTOR_OVERLAY_BREAKPOINT = 768;
|
|
9
|
+
export declare const SECTION_INSPECTOR_OVERLAY_MAX_WIDTH = 480;
|
|
10
|
+
/** Max inline width given the surrounding editor row. */
|
|
11
|
+
export declare function computeInspectorMaxWidth(containerWidth: number): number;
|
|
12
|
+
/** Width when expanded as an overlay on tablet/mobile. */
|
|
13
|
+
export declare function computeInspectorOverlayWidth(containerWidth: number): number;
|
|
14
|
+
export declare function readSectionInspectorWidth(): number;
|
|
15
|
+
interface InspectorResizeContextValue {
|
|
16
|
+
width: number;
|
|
17
|
+
maxWidth: number;
|
|
18
|
+
isExpanded: boolean;
|
|
19
|
+
canExpand: boolean;
|
|
20
|
+
toggleExpanded: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useInspectorResize(): InspectorResizeContextValue | null;
|
|
23
|
+
interface ResizableAsideProps extends ComponentPropsWithoutRef<'aside'> {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Right-hand editor shell with a draggable left edge. Used by the page/post
|
|
28
|
+
* section inspector and post header panel (default 320px, persisted in
|
|
29
|
+
* localStorage). On tablet/mobile the handle uses a 44px touch target and
|
|
30
|
+
* the header expand button can grow the panel to an overlay width.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ResizableAside({ children, className, style, ...props }: ResizableAsideProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
/** One-tap expand/collapse for tablet and mobile inspector panels. */
|
|
34
|
+
export declare function InspectorExpandButton({ className }: {
|
|
35
|
+
className?: string;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=ResizableAside.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizableAside.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ResizableAside.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOL,KAAK,wBAAwB,EAG7B,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAGd,eAAO,MAAM,2BAA2B,oCAAoC,CAAA;AAC5E,eAAO,MAAM,+BAA+B,MAAM,CAAA;AAClD,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAC9C,eAAO,MAAM,2BAA2B,MAAM,CAAA;AAC9C,eAAO,MAAM,kCAAkC,KAAK,CAAA;AACpD,2EAA2E;AAC3E,eAAO,MAAM,oCAAoC,MAAM,CAAA;AACvD,eAAO,MAAM,mCAAmC,MAAM,CAAA;AAMtD,yDAAyD;AACzD,wBAAgB,wBAAwB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CASvE;AAED,0DAA0D;AAC1D,wBAAgB,4BAA4B,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAQ3E;AAED,wBAAgB,yBAAyB,IAAI,MAAM,CAWlD;AAUD,UAAU,2BAA2B;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,OAAO,CAAA;IACnB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B;AAID,wBAAgB,kBAAkB,IAAI,2BAA2B,GAAG,IAAI,CAEvE;AAED,UAAU,mBAAoB,SAAQ,wBAAwB,CAAC,OAAO,CAAC;IACrE,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,2CA+L3F;AAKD,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,kDAsB1E"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { Maximize2, Minimize2 } from 'lucide-react';
|
|
5
|
+
export const SECTION_INSPECTOR_WIDTH_KEY = 'actuate:section-inspector-width';
|
|
6
|
+
export const SECTION_INSPECTOR_DEFAULT_WIDTH = 320;
|
|
7
|
+
export const SECTION_INSPECTOR_MIN_WIDTH = 280;
|
|
8
|
+
export const SECTION_INSPECTOR_MAX_WIDTH = 640;
|
|
9
|
+
export const SECTION_INSPECTOR_MIN_CANVAS_WIDTH = 96;
|
|
10
|
+
/** Below this editor-row width the expand action uses an overlay panel. */
|
|
11
|
+
export const SECTION_INSPECTOR_OVERLAY_BREAKPOINT = 768;
|
|
12
|
+
export const SECTION_INSPECTOR_OVERLAY_MAX_WIDTH = 480;
|
|
13
|
+
function clampWidth(width, max = SECTION_INSPECTOR_MAX_WIDTH) {
|
|
14
|
+
return Math.min(max, Math.max(SECTION_INSPECTOR_MIN_WIDTH, width));
|
|
15
|
+
}
|
|
16
|
+
/** Max inline width given the surrounding editor row. */
|
|
17
|
+
export function computeInspectorMaxWidth(containerWidth) {
|
|
18
|
+
if (!Number.isFinite(containerWidth) || containerWidth <= 0) {
|
|
19
|
+
return SECTION_INSPECTOR_MAX_WIDTH;
|
|
20
|
+
}
|
|
21
|
+
const containerCap = Math.max(SECTION_INSPECTOR_MIN_WIDTH, containerWidth - SECTION_INSPECTOR_MIN_CANVAS_WIDTH);
|
|
22
|
+
return Math.min(SECTION_INSPECTOR_MAX_WIDTH, containerCap);
|
|
23
|
+
}
|
|
24
|
+
/** Width when expanded as an overlay on tablet/mobile. */
|
|
25
|
+
export function computeInspectorOverlayWidth(containerWidth) {
|
|
26
|
+
if (!Number.isFinite(containerWidth) || containerWidth <= 0) {
|
|
27
|
+
return SECTION_INSPECTOR_OVERLAY_MAX_WIDTH;
|
|
28
|
+
}
|
|
29
|
+
return Math.min(SECTION_INSPECTOR_OVERLAY_MAX_WIDTH, Math.max(SECTION_INSPECTOR_MIN_WIDTH, containerWidth - 32));
|
|
30
|
+
}
|
|
31
|
+
export function readSectionInspectorWidth() {
|
|
32
|
+
if (typeof window === 'undefined')
|
|
33
|
+
return SECTION_INSPECTOR_DEFAULT_WIDTH;
|
|
34
|
+
try {
|
|
35
|
+
const raw = localStorage.getItem(SECTION_INSPECTOR_WIDTH_KEY);
|
|
36
|
+
if (!raw)
|
|
37
|
+
return SECTION_INSPECTOR_DEFAULT_WIDTH;
|
|
38
|
+
const parsed = Number.parseInt(raw, 10);
|
|
39
|
+
if (!Number.isFinite(parsed))
|
|
40
|
+
return SECTION_INSPECTOR_DEFAULT_WIDTH;
|
|
41
|
+
return clampWidth(parsed);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return SECTION_INSPECTOR_DEFAULT_WIDTH;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function persistSectionInspectorWidth(width, max = SECTION_INSPECTOR_MAX_WIDTH) {
|
|
48
|
+
try {
|
|
49
|
+
localStorage.setItem(SECTION_INSPECTOR_WIDTH_KEY, String(clampWidth(width, max)));
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Storage may be unavailable in private mode.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const InspectorResizeContext = createContext(null);
|
|
56
|
+
export function useInspectorResize() {
|
|
57
|
+
return useContext(InspectorResizeContext);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Right-hand editor shell with a draggable left edge. Used by the page/post
|
|
61
|
+
* section inspector and post header panel (default 320px, persisted in
|
|
62
|
+
* localStorage). On tablet/mobile the handle uses a 44px touch target and
|
|
63
|
+
* the header expand button can grow the panel to an overlay width.
|
|
64
|
+
*/
|
|
65
|
+
export function ResizableAside({ children, className, style, ...props }) {
|
|
66
|
+
const asideRef = useRef(null);
|
|
67
|
+
const [width, setWidth] = useState(SECTION_INSPECTOR_DEFAULT_WIDTH);
|
|
68
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
69
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
70
|
+
const [dragging, setDragging] = useState(false);
|
|
71
|
+
const widthRef = useRef(width);
|
|
72
|
+
const compactWidthRef = useRef(SECTION_INSPECTOR_DEFAULT_WIDTH);
|
|
73
|
+
const dragRef = useRef(null);
|
|
74
|
+
const inlineMax = computeInspectorMaxWidth(containerWidth);
|
|
75
|
+
const overlayMax = computeInspectorOverlayWidth(containerWidth);
|
|
76
|
+
const useOverlay = containerWidth > 0 && containerWidth < SECTION_INSPECTOR_OVERLAY_BREAKPOINT && isExpanded;
|
|
77
|
+
const effectiveMax = useOverlay ? overlayMax : inlineMax;
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
setWidth(readSectionInspectorWidth());
|
|
80
|
+
}, []);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
widthRef.current = width;
|
|
83
|
+
}, [width]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
const parent = asideRef.current?.parentElement;
|
|
86
|
+
if (!parent)
|
|
87
|
+
return;
|
|
88
|
+
const update = (nextWidth) => {
|
|
89
|
+
setContainerWidth(nextWidth);
|
|
90
|
+
};
|
|
91
|
+
update(parent.getBoundingClientRect().width);
|
|
92
|
+
const observer = new ResizeObserver((entries) => {
|
|
93
|
+
const entry = entries[0];
|
|
94
|
+
if (!entry)
|
|
95
|
+
return;
|
|
96
|
+
update(entry.contentRect.width);
|
|
97
|
+
});
|
|
98
|
+
observer.observe(parent);
|
|
99
|
+
return () => observer.disconnect();
|
|
100
|
+
}, []);
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
setWidth((current) => clampWidth(current, effectiveMax));
|
|
103
|
+
}, [effectiveMax]);
|
|
104
|
+
const endDrag = useCallback(() => {
|
|
105
|
+
dragRef.current = null;
|
|
106
|
+
setDragging(false);
|
|
107
|
+
document.body.style.cursor = '';
|
|
108
|
+
document.body.style.userSelect = '';
|
|
109
|
+
persistSectionInspectorWidth(widthRef.current, inlineMax);
|
|
110
|
+
if (widthRef.current < effectiveMax - 24) {
|
|
111
|
+
setIsExpanded(false);
|
|
112
|
+
}
|
|
113
|
+
}, [effectiveMax, inlineMax]);
|
|
114
|
+
const onPointerDown = useCallback((event) => {
|
|
115
|
+
if (event.button !== 0)
|
|
116
|
+
return;
|
|
117
|
+
dragRef.current = { startX: event.clientX, startWidth: widthRef.current };
|
|
118
|
+
setDragging(true);
|
|
119
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
120
|
+
document.body.style.cursor = 'col-resize';
|
|
121
|
+
document.body.style.userSelect = 'none';
|
|
122
|
+
}, []);
|
|
123
|
+
const onPointerMove = useCallback((event) => {
|
|
124
|
+
if (!dragRef.current)
|
|
125
|
+
return;
|
|
126
|
+
const delta = dragRef.current.startX - event.clientX;
|
|
127
|
+
setWidth(clampWidth(dragRef.current.startWidth + delta, effectiveMax));
|
|
128
|
+
}, [effectiveMax]);
|
|
129
|
+
const onPointerUp = useCallback((event) => {
|
|
130
|
+
if (!dragRef.current)
|
|
131
|
+
return;
|
|
132
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
133
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
134
|
+
}
|
|
135
|
+
endDrag();
|
|
136
|
+
}, [endDrag]);
|
|
137
|
+
const nudgeWidth = useCallback((delta) => {
|
|
138
|
+
setWidth((current) => {
|
|
139
|
+
const next = clampWidth(current + delta, effectiveMax);
|
|
140
|
+
persistSectionInspectorWidth(next, inlineMax);
|
|
141
|
+
if (next < effectiveMax - 24)
|
|
142
|
+
setIsExpanded(false);
|
|
143
|
+
return next;
|
|
144
|
+
});
|
|
145
|
+
}, [effectiveMax, inlineMax]);
|
|
146
|
+
const onKeyDown = useCallback((event) => {
|
|
147
|
+
if (event.key === 'ArrowLeft') {
|
|
148
|
+
event.preventDefault();
|
|
149
|
+
nudgeWidth(16);
|
|
150
|
+
}
|
|
151
|
+
else if (event.key === 'ArrowRight') {
|
|
152
|
+
event.preventDefault();
|
|
153
|
+
nudgeWidth(-16);
|
|
154
|
+
}
|
|
155
|
+
else if (event.key === 'Home') {
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
setIsExpanded(false);
|
|
158
|
+
setWidth(SECTION_INSPECTOR_MIN_WIDTH);
|
|
159
|
+
persistSectionInspectorWidth(SECTION_INSPECTOR_MIN_WIDTH, inlineMax);
|
|
160
|
+
}
|
|
161
|
+
else if (event.key === 'End') {
|
|
162
|
+
event.preventDefault();
|
|
163
|
+
setWidth(effectiveMax);
|
|
164
|
+
persistSectionInspectorWidth(effectiveMax, inlineMax);
|
|
165
|
+
setIsExpanded(effectiveMax >= inlineMax - 8);
|
|
166
|
+
}
|
|
167
|
+
}, [effectiveMax, inlineMax, nudgeWidth]);
|
|
168
|
+
const toggleExpanded = useCallback(() => {
|
|
169
|
+
if (isExpanded) {
|
|
170
|
+
const restored = clampWidth(compactWidthRef.current, inlineMax);
|
|
171
|
+
setIsExpanded(false);
|
|
172
|
+
setWidth(restored);
|
|
173
|
+
persistSectionInspectorWidth(restored, inlineMax);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
compactWidthRef.current = widthRef.current;
|
|
177
|
+
const target = containerWidth > 0 && containerWidth < SECTION_INSPECTOR_OVERLAY_BREAKPOINT
|
|
178
|
+
? overlayMax
|
|
179
|
+
: inlineMax;
|
|
180
|
+
setIsExpanded(true);
|
|
181
|
+
setWidth(target);
|
|
182
|
+
persistSectionInspectorWidth(target, inlineMax);
|
|
183
|
+
}, [containerWidth, inlineMax, isExpanded, overlayMax]);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
return () => {
|
|
186
|
+
if (dragRef.current)
|
|
187
|
+
endDrag();
|
|
188
|
+
};
|
|
189
|
+
}, [endDrag]);
|
|
190
|
+
const canExpand = !isExpanded &&
|
|
191
|
+
(containerWidth > 0 && containerWidth < SECTION_INSPECTOR_OVERLAY_BREAKPOINT
|
|
192
|
+
? overlayMax > width + 8
|
|
193
|
+
: inlineMax > width + 8);
|
|
194
|
+
return (_jsx(InspectorResizeContext.Provider, { value: { width, maxWidth: effectiveMax, isExpanded, canExpand, toggleExpanded }, children: _jsxs("aside", { ...props, ref: asideRef, "data-overlay": useOverlay ? '' : undefined, className: `relative shrink-0 ${useOverlay ? 'absolute top-0 right-0 bottom-0 z-20 shadow-lg' : ''} ${className ?? ''}`, style: { width, ...style }, children: [_jsx("div", { role: "separator", "aria-orientation": "vertical", "aria-label": "Resize inspector panel", "aria-valuemin": SECTION_INSPECTOR_MIN_WIDTH, "aria-valuemax": effectiveMax, "aria-valuenow": width, tabIndex: 0, "data-dragging": dragging ? '' : undefined, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, onKeyDown: onKeyDown, className: "group absolute inset-y-0 -left-5 z-10 flex w-11 -translate-x-1/2 cursor-col-resize touch-none focus-visible:outline-none md:-left-1 md:w-3 md:translate-x-0", children: _jsx("div", { className: `mx-auto h-full w-px motion-safe:transition-colors md:mx-0 ${dragging
|
|
195
|
+
? 'bg-primary'
|
|
196
|
+
: 'bg-border group-hover:bg-primary/50 group-focus-visible:bg-primary/50'}` }) }), children] }) }));
|
|
197
|
+
}
|
|
198
|
+
const EXPAND_BUTTON_CLASS = 'text-muted-foreground hover:text-foreground hover:bg-accent flex h-9 w-9 items-center justify-center rounded-md transition-colors focus-visible:ring-ring focus-visible:ring-2 focus-visible:outline-none md:h-7 md:w-7';
|
|
199
|
+
/** One-tap expand/collapse for tablet and mobile inspector panels. */
|
|
200
|
+
export function InspectorExpandButton({ className }) {
|
|
201
|
+
const ctx = useInspectorResize();
|
|
202
|
+
if (!ctx)
|
|
203
|
+
return null;
|
|
204
|
+
const { isExpanded, canExpand, toggleExpanded } = ctx;
|
|
205
|
+
if (!canExpand && !isExpanded)
|
|
206
|
+
return null;
|
|
207
|
+
return (_jsx("button", { type: "button", onClick: toggleExpanded, "aria-label": isExpanded ? 'Collapse inspector panel' : 'Expand inspector panel', "aria-pressed": isExpanded, className: className ?? EXPAND_BUTTON_CLASS, children: isExpanded ? (_jsx(Minimize2, { className: "h-4 w-4", "aria-hidden": true })) : (_jsx(Maximize2, { className: "h-4 w-4", "aria-hidden": true })) }));
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=ResizableAside.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ResizableAside.js","sourceRoot":"","sources":["../../../src/components/ui/ResizableAside.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,GAKT,MAAM,OAAO,CA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AC9C,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,SAAS,EAAC,SAAS,wBAAe,CAC9C,GACM,CACV,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Toggle.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEvD,QAAA,MAAM,WAAW;;;;;;yBAoBhB,CAAA;AAED,QAAA,MAAM,WAAW;;;;;
|
|
1
|
+
{"version":3,"file":"Toggle.d.ts","sourceRoot":"","sources":["../../../src/components/ui/Toggle.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEvD,QAAA,MAAM,WAAW;;;;;;yBAoBhB,CAAA;AAED,QAAA,MAAM,WAAW;;;;;yBAahB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAA;AAE7D,MAAM,WAAW,WAAY,SAAQ,cAAc;IACjD,OAAO,EAAE,OAAO,CAAA;IAChB,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,eAAe,EACf,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,EAAE,EACF,YAAY,EAAE,SAAS,EACvB,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,GACpC,EAAE,WAAW,2CAeb;AAED,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,WAAW,IAAI,mBAAmB,EAAE,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import * as Switch from '@radix-ui/react-switch';
|
|
4
4
|
import { cv } from '../../lib/cv.js';
|
|
5
|
-
const toggleTrack = cv('relative inline-
|
|
5
|
+
const toggleTrack = cv('relative inline-block shrink-0 cursor-pointer rounded-[var(--r-pill)] border-0 p-0 transition-colors duration-[var(--motion-base)] focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50', {
|
|
6
6
|
variants: {
|
|
7
7
|
variant: {
|
|
8
8
|
/** Design system default — accent when on. */
|
|
@@ -20,10 +20,11 @@ const toggleTrack = cv('relative inline-flex shrink-0 cursor-pointer rounded-[va
|
|
|
20
20
|
size: 'md',
|
|
21
21
|
},
|
|
22
22
|
});
|
|
23
|
-
const toggleThumb = cv('pointer-events-none block rounded-full bg-[var(--toggle-thumb)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] transition-
|
|
23
|
+
const toggleThumb = cv('pointer-events-none absolute top-[2.5px] left-[2.5px] block rounded-full bg-[var(--toggle-thumb)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] transition-[left] duration-[var(--motion-base)] data-[state=checked]:left-[19.5px]', {
|
|
24
24
|
variants: {
|
|
25
25
|
size: {
|
|
26
|
-
|
|
26
|
+
/** Matches `.tog-thumb` in the design system handoff (16×16). */
|
|
27
|
+
md: 'h-4 w-4',
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
30
|
defaultVariants: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../../src/components/ui/Toggle.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,EAAE,EAAqB,MAAM,iBAAiB,CAAA;AAEvD,MAAM,WAA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,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC,GAAI,GACtC,CACf,CAAA;AACH,CAAC;AAED,OAAO,EAAE,WAAW,IAAI,mBAAmB,EAAE,WAAW,IAAI,mBAAmB,EAAE,CAAA"}
|
|
@@ -4,6 +4,8 @@ export interface RichTextFieldProps {
|
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
5
|
required?: boolean;
|
|
6
6
|
helpText?: string;
|
|
7
|
+
/** Passed through to the underlying editor shell (e.g. max-height). */
|
|
8
|
+
className?: string;
|
|
7
9
|
}
|
|
8
|
-
export declare function RichTextField({ label, value, onChange, required, helpText, }: RichTextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function RichTextField({ label, value, onChange, required, helpText, className, }: RichTextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
//# sourceMappingURL=RichTextField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextField.d.ts","sourceRoot":"","sources":["../../src/fields/RichTextField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"RichTextField.d.ts","sourceRoot":"","sources":["../../src/fields/RichTextField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uEAAuE;IACvE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,KAAU,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE,kBAAkB,2CAWpB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { TipTapEditor } from '../components/TipTapEditor.js';
|
|
4
|
-
export function RichTextField({ label, value = '', onChange, required, helpText, }) {
|
|
5
|
-
return (_jsxs("div", { children: [_jsxs("label", { className: "mb-1 block text-sm font-medium", children: [label, required && _jsx("span", { className: "ml-0.5 text-[var(--destructive)]", children: "*" })] }), _jsx(TipTapEditor, { content: value, onChange: onChange }), helpText && _jsx("p", { className: "mt-1 text-xs text-[var(--muted-foreground)]", children: helpText })] }));
|
|
4
|
+
export function RichTextField({ label, value = '', onChange, required, helpText, className, }) {
|
|
5
|
+
return (_jsxs("div", { children: [_jsxs("label", { className: "mb-1 block text-sm font-medium", children: [label, required && _jsx("span", { className: "ml-0.5 text-[var(--destructive)]", children: "*" })] }), _jsx(TipTapEditor, { content: value, onChange: onChange, className: className }), helpText && _jsx("p", { className: "mt-1 text-xs text-[var(--muted-foreground)]", children: helpText })] }));
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=RichTextField.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextField.js","sourceRoot":"","sources":["../../src/fields/RichTextField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"RichTextField.js","sourceRoot":"","sources":["../../src/fields/RichTextField.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAY5D,MAAM,UAAU,aAAa,CAAC,EAC5B,KAAK,EACL,KAAK,GAAG,EAAE,EACV,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,GACU;IACnB,OAAO,CACL,0BACE,iBAAO,SAAS,EAAC,gCAAgC,aAC9C,KAAK,EACL,QAAQ,IAAI,eAAM,SAAS,EAAC,kCAAkC,kBAAS,IAClE,EACR,KAAC,YAAY,IAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAI,EACzE,QAAQ,IAAI,YAAG,SAAS,EAAC,6CAA6C,YAAE,QAAQ,GAAK,IAClF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/views/Dashboard.tsx"],"names":[],"mappings":"AAsGA,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAgHD,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/views/Dashboard.tsx"],"names":[],"mappings":"AAsGA,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAgHD,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,cAAc,2CA+sBxE"}
|
package/dist/views/Dashboard.js
CHANGED
|
@@ -401,7 +401,7 @@ export function Dashboard({ config, session, onNavigate }) {
|
|
|
401
401
|
: `Some CMS models are missing: ${Object.entries(health.models)
|
|
402
402
|
.filter(([, v]) => !v)
|
|
403
403
|
.map(([k]) => k)
|
|
404
|
-
.join(', ')}. Run your database migrations.` })] })] })), error && exhausted && (_jsxs("div", { className: "border-warning/30 bg-warning/10 flex items-center gap-3 rounded-lg border p-3", children: [_jsx(AlertTriangle, { className: "text-warning h-5 w-5 shrink-0" }), _jsx("span", { className: "text-warning flex-1 text-sm", children: "Some dashboard data may be unavailable." }), _jsx("button", { onClick: refetch, className: "border-warning/40 text-warning hover:bg-warning/10 rounded-lg border px-3 py-1 text-sm transition-colors", children: "Retry" })] })), _jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1 sm:gap-0.5", children: [_jsxs("h1", { className: "text-foreground", children: [greeting, ", ", userName, " ", _jsx("span", { "aria-hidden": true, children: "\uD83D\uDC4B" })] }), _jsxs("p", { className: "text-muted-foreground text-sm", children: [dateStr, totalIssues > 0 && (_jsxs("span", { className: "hidden sm:inline", children: [' · ', totalIssues, " content item", totalIssues === 1 ? '' : 's', " need attention"] }))] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("button", { type: "button", onClick: () => nav(heroNewPostPath), className: "bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-ring inline-flex items-center gap-1.5 rounded-lg px-3.5 py-1.5 text-sm font-medium shadow-sm transition-colors focus:outline-none focus-visible:ring-2", children: [_jsx(Plus, { className: "h-3.5 w-3.5", "aria-hidden": true }), "New Post"] }), siteUrl ? (_jsxs("a", { href: siteUrl, target: "_blank", rel: "noopener noreferrer", className: "border-border bg-card text-foreground hover:bg-accent inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-sm font-medium transition-colors", children: [_jsx(ExternalLink, { className: "h-3.5 w-3.5", "aria-hidden": true }), "View Site"] })) : null] })] }), _jsx("div", { className: "-mx-1 flex gap-2 overflow-x-auto px-1 pb-1 [scrollbar-width:thin]", children: quickActions.map((a) => (_jsxs("button", { onClick: a.onClick, className: "border-border bg-card hover:border-brand/50 hover:bg-brand/10 hover:text-brand inline-flex shrink-0 items-center gap-1.5 rounded-lg border px-3.5 py-2 text-sm shadow-sm transition-colors", children: [_jsx(a.icon, { className: "h-3.5 w-3.5" }), a.label] }, a.label))) }), _jsx("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5", children: statCards.map((card) => {
|
|
404
|
+
.join(', ')}. Run your database migrations.` })] })] })), error && exhausted && (_jsxs("div", { className: "border-warning/30 bg-warning/10 flex items-center gap-3 rounded-lg border p-3", children: [_jsx(AlertTriangle, { className: "text-warning h-5 w-5 shrink-0" }), _jsx("span", { className: "text-warning flex-1 text-sm", children: "Some dashboard data may be unavailable." }), _jsx("button", { onClick: refetch, className: "border-warning/40 text-warning hover:bg-warning/10 rounded-lg border px-3 py-1 text-sm transition-colors", children: "Retry" })] })), _jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1 sm:gap-0.5", children: [_jsxs("h1", { className: "text-foreground", children: [greeting, ", ", userName, " ", _jsx("span", { "aria-hidden": true, children: "\uD83D\uDC4B" })] }), _jsxs("p", { className: "text-muted-foreground text-sm", "data-volatile": true, children: [dateStr, totalIssues > 0 && (_jsxs("span", { className: "hidden sm:inline", children: [' · ', totalIssues, " content item", totalIssues === 1 ? '' : 's', " need attention"] }))] })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("button", { type: "button", onClick: () => nav(heroNewPostPath), className: "bg-primary text-primary-foreground hover:bg-primary/90 focus-visible:ring-ring inline-flex items-center gap-1.5 rounded-lg px-3.5 py-1.5 text-sm font-medium shadow-sm transition-colors focus:outline-none focus-visible:ring-2", children: [_jsx(Plus, { className: "h-3.5 w-3.5", "aria-hidden": true }), "New Post"] }), siteUrl ? (_jsxs("a", { href: siteUrl, target: "_blank", rel: "noopener noreferrer", className: "border-border bg-card text-foreground hover:bg-accent inline-flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-sm font-medium transition-colors", children: [_jsx(ExternalLink, { className: "h-3.5 w-3.5", "aria-hidden": true }), "View Site"] })) : null] })] }), _jsx("div", { className: "-mx-1 flex gap-2 overflow-x-auto px-1 pb-1 [scrollbar-width:thin]", children: quickActions.map((a) => (_jsxs("button", { onClick: a.onClick, className: "border-border bg-card hover:border-brand/50 hover:bg-brand/10 hover:text-brand inline-flex shrink-0 items-center gap-1.5 rounded-lg border px-3.5 py-2 text-sm shadow-sm transition-colors", children: [_jsx(a.icon, { className: "h-3.5 w-3.5" }), a.label] }, a.label))) }), _jsx("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5", children: statCards.map((card) => {
|
|
405
405
|
const Inner = (_jsxs(_Fragment, { children: [_jsx("div", { className: `mb-3 flex h-8 w-8 items-center justify-center rounded-lg ${card.iconBg}`, children: _jsx(card.icon, { className: `h-4 w-4 ${card.iconColor}` }) }), _jsxs("div", { className: "flex items-baseline gap-1", children: [_jsx("span", { className: "text-foreground text-2xl leading-none font-medium tracking-tight", children: card.value }), card.unit && (_jsx("span", { className: "text-muted-foreground text-sm font-medium", children: card.unit }))] }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: card.label }), card.hint && (_jsx("p", { className: `mt-1.5 text-[11px] ${card.hintUp ? 'text-success' : 'text-muted-foreground'}`, children: card.hint }))] }));
|
|
406
406
|
return card.href ? (_jsx("button", { type: "button", onClick: () => nav(card.href), className: "bg-card border-border rounded-xl border p-4 text-left shadow-sm transition-shadow hover:shadow-md", children: Inner }, card.label)) : (_jsx("div", { className: "bg-card border-border rounded-xl border p-4 shadow-sm", children: Inner }, card.label));
|
|
407
407
|
}) }), showOnboarding ? (_jsx(OnboardingBlock, { signals: onboardingSignals, onNavigate: onNavigate })) : (_jsxs("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-[minmax(0,1fr)_320px]", children: [_jsxs("section", { className: "bg-card border-border overflow-hidden rounded-xl border shadow-sm", children: [_jsxs("header", { className: "border-border flex items-center justify-between border-b px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "text-foreground text-sm font-medium", children: "Recent Activity" }), _jsx("p", { className: "text-muted-foreground mt-0.5 text-xs", children: "Last 7 days across all content" })] }), (stats?.recentDocuments?.length ?? 0) > 8 && (_jsx("button", { className: "text-brand text-xs font-medium hover:underline", onClick: () => setActivityLimit((n) => (n >= 20 ? 8 : 20)), children: activityLimit >= 20 ? 'Show less' : 'Show more' }))] }), activity.length === 0 ? (_jsx(EmptyState, { icon: Activity, title: "No activity yet", subtitle: "Content changes will appear here as your team works." })) : (_jsx("ul", { role: "list", className: "divide-border divide-y", children: activity.map((it) => (_jsx("li", { children: _jsx("button", { type: "button", onClick: () => nav(it.editPath), className: "hover:bg-accent/50 focus-visible:bg-accent/50 w-full cursor-pointer px-4 py-3 text-left transition-colors", children: _jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [_jsx("div", { className: "mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[11px] font-medium text-white", style: { background: it.avatar.color }, "aria-hidden": true, children: it.avatar.initials }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("p", { className: "text-foreground truncate text-sm leading-snug", children: [_jsxs("span", { className: "font-medium", children: ["\u201C", it.title || 'Untitled', "\u201D"] }), ' ', _jsxs("span", { className: "text-muted-foreground", children: ["\u2014 ", it.typeLabel] })] }), _jsxs("div", { className: "text-muted-foreground mt-1 flex flex-wrap items-center gap-2 text-[11px]", children: [_jsx("span", { className: `inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium ${it.statusInfo.cls}`, children: it.statusInfo.label }), _jsx("span", { className: "max-w-[120px] truncate", children: it.author }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsx("span", { children: it.relTime })] })] })] }) }) }, it.id))) }))] }), _jsxs("aside", { className: "flex min-w-0 flex-col gap-4", children: [_jsxs("section", { className: "bg-card border-border overflow-hidden rounded-xl border shadow-sm", children: [_jsxs("header", { className: "border-border flex items-center justify-between border-b px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "text-foreground text-sm font-medium", children: "Publishing Queue" }), _jsxs("p", { className: "text-muted-foreground mt-0.5 text-xs", children: [publishQueue.length, " item", publishQueue.length === 1 ? '' : 's', " scheduled"] })] }), _jsx("button", { className: "text-brand text-xs font-medium hover:underline disabled:cursor-default disabled:no-underline disabled:opacity-50", disabled: publishQueue.length === 0, onClick: () => {
|