@qwanyx/ai-editor 1.3.13 → 1.4.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.
Files changed (46) hide show
  1. package/dist/components/PageEditor.d.ts +10 -0
  2. package/dist/components/PageEditor.d.ts.map +1 -0
  3. package/dist/components/PageEditor.js +294 -0
  4. package/dist/components/PageViewer.d.ts +8 -0
  5. package/dist/components/PageViewer.d.ts.map +1 -0
  6. package/dist/components/PageViewer.js +38 -0
  7. package/dist/components/RichTextEditor.d.ts +5 -1
  8. package/dist/components/RichTextEditor.d.ts.map +1 -1
  9. package/dist/components/RichTextEditor.js +11 -2
  10. package/dist/components/RichTextViewer.d.ts +3 -1
  11. package/dist/components/RichTextViewer.d.ts.map +1 -1
  12. package/dist/components/RichTextViewer.js +7 -2
  13. package/dist/components/Section.d.ts +10 -0
  14. package/dist/components/Section.d.ts.map +1 -0
  15. package/dist/components/Section.js +117 -0
  16. package/dist/components/SmartEditor.d.ts +58 -0
  17. package/dist/components/SmartEditor.d.ts.map +1 -0
  18. package/dist/components/SmartEditor.js +123 -0
  19. package/dist/context/PageContext.d.ts +35 -0
  20. package/dist/context/PageContext.d.ts.map +1 -0
  21. package/dist/context/PageContext.js +277 -0
  22. package/dist/index.d.ts +17 -0
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +54 -1
  25. package/dist/layouts/OgilvyLayout.d.ts +5 -0
  26. package/dist/layouts/OgilvyLayout.d.ts.map +1 -0
  27. package/dist/layouts/OgilvyLayout.js +301 -0
  28. package/dist/layouts/RichTextLayout.d.ts +7 -0
  29. package/dist/layouts/RichTextLayout.d.ts.map +1 -0
  30. package/dist/layouts/RichTextLayout.js +47 -0
  31. package/dist/layouts/index.d.ts +30 -0
  32. package/dist/layouts/index.d.ts.map +1 -0
  33. package/dist/layouts/index.js +71 -0
  34. package/dist/types/index.d.ts +5 -0
  35. package/dist/types/index.d.ts.map +1 -0
  36. package/dist/types/index.js +20 -0
  37. package/dist/types/page.d.ts +151 -0
  38. package/dist/types/page.d.ts.map +1 -0
  39. package/dist/types/page.js +54 -0
  40. package/dist/utils/format.d.ts +71 -0
  41. package/dist/utils/format.d.ts.map +1 -0
  42. package/dist/utils/format.js +190 -0
  43. package/dist/utils/index.d.ts +5 -0
  44. package/dist/utils/index.d.ts.map +1 -0
  45. package/dist/utils/index.js +20 -0
  46. package/package.json +1 -1
@@ -0,0 +1,58 @@
1
+ import { PageDocument } from '../types/page';
2
+ import { RichTextEditorProps } from './RichTextEditor';
3
+ export interface SmartEditorProps {
4
+ /**
5
+ * Contenu initial - peut être:
6
+ * - Du JSON Lexical brut (ancien format)
7
+ * - Un PageDocument (nouveau format)
8
+ * - Vide
9
+ */
10
+ initialContent?: string | PageDocument;
11
+ /**
12
+ * Callback appelé quand le contenu change
13
+ * Reçoit le contenu dans le format approprié
14
+ */
15
+ onChange?: (content: string, document: PageDocument) => void;
16
+ /**
17
+ * Callback spécifique pour les requêtes AI (passé au RichTextEditor)
18
+ */
19
+ onAIRequest?: RichTextEditorProps['onAIRequest'];
20
+ /**
21
+ * Si true, sauvegarde en Lexical brut quand possible (rétrocompatibilité)
22
+ * @default true
23
+ */
24
+ preferLegacyFormat?: boolean;
25
+ /**
26
+ * Mode de l'éditeur
27
+ * - 'auto': Détecte automatiquement (Lexical simple → RichTextEditor, sinon PageEditor)
28
+ * - 'simple': Force le RichTextEditor classique
29
+ * - 'page': Force le PageEditor
30
+ * @default 'auto'
31
+ */
32
+ mode?: 'auto' | 'simple' | 'page';
33
+ /**
34
+ * Permet de passer en mode page depuis le mode simple
35
+ * @default true
36
+ */
37
+ allowUpgrade?: boolean;
38
+ /**
39
+ * Placeholder pour le mode simple
40
+ */
41
+ placeholder?: string;
42
+ /**
43
+ * Classe CSS
44
+ */
45
+ className?: string;
46
+ /**
47
+ * Hauteur minimale pour le mode simple
48
+ */
49
+ minHeight?: string;
50
+ }
51
+ export declare function SmartEditor({ initialContent, onChange, onAIRequest, preferLegacyFormat, mode, allowUpgrade, placeholder, className, minHeight, }: SmartEditorProps): import("react/jsx-runtime").JSX.Element;
52
+ export interface SmartViewerProps {
53
+ content?: string | PageDocument;
54
+ className?: string;
55
+ }
56
+ export declare function SmartViewer({ content, className }: SmartViewerProps): import("react/jsx-runtime").JSX.Element;
57
+ export default SmartEditor;
58
+ //# sourceMappingURL=SmartEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartEditor.d.ts","sourceRoot":"","sources":["../../src/components/SmartEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAetE,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;IAEtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;IAE5D;;OAEG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAEhD;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAE5B;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;IAEjC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IAEtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAkED,wBAAgB,WAAW,CAAC,EAC1B,cAAc,EACd,QAAQ,EACR,WAAW,EACX,kBAAyB,EACzB,IAAa,EACb,YAAmB,EACnB,WAAW,EACX,SAAS,EACT,SAAS,GACV,EAAE,gBAAgB,2CAkGlB;AAMD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAAA;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,gBAAgB,2CAcnE;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SmartEditor = SmartEditor;
5
+ exports.SmartViewer = SmartViewer;
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const RichTextEditor_1 = require("./RichTextEditor");
9
+ const PageEditor_1 = require("./PageEditor");
10
+ const format_1 = require("../utils/format");
11
+ // ============================================
12
+ // Styles
13
+ // ============================================
14
+ const styles = {
15
+ upgradeBar: {
16
+ display: 'flex',
17
+ justifyContent: 'flex-end',
18
+ padding: '0.5rem',
19
+ backgroundColor: '#f8f9fa',
20
+ borderBottom: '1px solid #e9ecef',
21
+ },
22
+ upgradeButton: {
23
+ padding: '0.5rem 1rem',
24
+ backgroundColor: 'transparent',
25
+ border: '1px solid #007bff',
26
+ color: '#007bff',
27
+ borderRadius: '4px',
28
+ cursor: 'pointer',
29
+ fontSize: '0.875rem',
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ gap: '0.5rem',
33
+ },
34
+ upgradeButtonHover: {
35
+ backgroundColor: '#007bff',
36
+ color: 'white',
37
+ },
38
+ };
39
+ function UpgradeButton({ onClick }) {
40
+ const [isHovered, setIsHovered] = (0, react_1.useState)(false);
41
+ return ((0, jsx_runtime_1.jsx)("div", { style: styles.upgradeBar, children: (0, jsx_runtime_1.jsxs)("button", { onClick: onClick, style: {
42
+ ...styles.upgradeButton,
43
+ ...(isHovered ? styles.upgradeButtonHover : {}),
44
+ }, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), title: "Passer en mode page pour ajouter des sections, images hero, colonnes, etc.", children: [(0, jsx_runtime_1.jsx)("span", { children: "+" }), "Ajouter des sections"] }) }));
45
+ }
46
+ // ============================================
47
+ // Smart Editor Component
48
+ // ============================================
49
+ function SmartEditor({ initialContent, onChange, onAIRequest, preferLegacyFormat = true, mode = 'auto', allowUpgrade = true, placeholder, className, minHeight, }) {
50
+ // Détecter le format initial
51
+ const initialDetection = (0, react_1.useMemo)(() => (0, format_1.detectFormat)(initialContent), [initialContent]);
52
+ // État pour savoir si on a "upgradé" vers le mode page
53
+ const [hasUpgraded, setHasUpgraded] = (0, react_1.useState)(false);
54
+ // Document de travail (toujours un PageDocument en interne)
55
+ const [document, setDocument] = (0, react_1.useState)(() => (0, format_1.ensurePageDocument)(initialContent));
56
+ // Déterminer le mode effectif
57
+ const effectiveMode = (0, react_1.useMemo)(() => {
58
+ if (mode === 'simple')
59
+ return 'simple';
60
+ if (mode === 'page')
61
+ return 'page';
62
+ // Mode auto
63
+ if (hasUpgraded)
64
+ return 'page';
65
+ // Si le format initial était Lexical ou vide, et qu'on n'a pas encore upgradé
66
+ if (initialDetection.format === 'lexical' || initialDetection.format === 'empty') {
67
+ // Vérifier si le document actuel est toujours simple
68
+ if ((0, format_1.isSimpleDocument)(document)) {
69
+ return 'simple';
70
+ }
71
+ }
72
+ return 'page';
73
+ }, [mode, hasUpgraded, initialDetection.format, document]);
74
+ // Handler pour le RichTextEditor (mode simple)
75
+ const handleSimpleChange = (0, react_1.useCallback)((_html, json) => {
76
+ // Mettre à jour le document interne
77
+ const newDoc = (0, format_1.ensurePageDocument)(json);
78
+ setDocument(newDoc);
79
+ // Notifier le parent
80
+ if (onChange) {
81
+ const output = preferLegacyFormat ? json : (0, format_1.prepareForSave)(newDoc);
82
+ onChange(output, newDoc);
83
+ }
84
+ }, [onChange, preferLegacyFormat]);
85
+ // Handler pour le PageEditor
86
+ const handlePageChange = (0, react_1.useCallback)((newDoc) => {
87
+ setDocument(newDoc);
88
+ if (onChange) {
89
+ const output = (0, format_1.prepareForSave)(newDoc, { preferLegacyFormat });
90
+ onChange(output, newDoc);
91
+ }
92
+ }, [onChange, preferLegacyFormat]);
93
+ // Handler pour l'upgrade vers le mode page
94
+ const handleUpgrade = (0, react_1.useCallback)(() => {
95
+ setHasUpgraded(true);
96
+ }, []);
97
+ // Contenu Lexical pour le mode simple
98
+ const simpleLexicalContent = (0, react_1.useMemo)(() => {
99
+ if (effectiveMode !== 'simple')
100
+ return '';
101
+ return (0, format_1.pageDocumentToLexical)(document) || '';
102
+ }, [effectiveMode, document]);
103
+ // Mode simple: RichTextEditor classique
104
+ if (effectiveMode === 'simple') {
105
+ return ((0, jsx_runtime_1.jsxs)("div", { className: className, children: [allowUpgrade && mode === 'auto' && ((0, jsx_runtime_1.jsx)(UpgradeButton, { onClick: handleUpgrade })), (0, jsx_runtime_1.jsx)(RichTextEditor_1.RichTextEditor, { initialContent: simpleLexicalContent, onChange: handleSimpleChange, onAIRequest: onAIRequest, placeholder: placeholder, minHeight: minHeight })] }));
106
+ }
107
+ // Mode page: PageEditor complet
108
+ return ((0, jsx_runtime_1.jsx)(PageEditor_1.PageEditor, { initialDocument: document, onChange: handlePageChange, className: className, isEditing: true }));
109
+ }
110
+ function SmartViewer({ content, className }) {
111
+ const document = (0, react_1.useMemo)(() => (0, format_1.ensurePageDocument)(content), [content]);
112
+ const detection = (0, react_1.useMemo)(() => (0, format_1.detectFormat)(content), [content]);
113
+ // Si c'est du Lexical simple, utiliser RichTextViewer
114
+ if (detection.format === 'lexical' || (0, format_1.isSimpleDocument)(document)) {
115
+ const { RichTextViewer } = require('./RichTextViewer');
116
+ const lexicalContent = (0, format_1.pageDocumentToLexical)(document) || '';
117
+ return (0, jsx_runtime_1.jsx)(RichTextViewer, { content: lexicalContent, className: className });
118
+ }
119
+ // Sinon, utiliser PageViewer
120
+ const { PageViewer } = require('./PageViewer');
121
+ return (0, jsx_runtime_1.jsx)(PageViewer, { document: document, className: className });
122
+ }
123
+ exports.default = SmartEditor;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { PageDocument, PageFormat, Section, LayoutType, PrintSize, VideoSize } from '../types/page';
3
+ interface PageContextValue {
4
+ document: PageDocument;
5
+ isEditing: boolean;
6
+ selectedSectionId: string | null;
7
+ setDocument: (doc: PageDocument) => void;
8
+ setFormat: (format: PageFormat) => void;
9
+ setPrintSize: (size: PrintSize) => void;
10
+ setVideoSize: (size: VideoSize) => void;
11
+ setTitle: (title: string) => void;
12
+ addSection: (layoutType: LayoutType, content: unknown, index?: number) => void;
13
+ updateSection: (id: string, content: unknown) => void;
14
+ updateSectionSettings: (id: string, settings: Partial<Section>) => void;
15
+ deleteSection: (id: string) => void;
16
+ moveSection: (id: string, direction: 'up' | 'down') => void;
17
+ reorderSections: (ids: string[]) => void;
18
+ duplicateSection: (id: string) => void;
19
+ selectSection: (id: string | null) => void;
20
+ getSectionById: (id: string) => Section | undefined;
21
+ getSectionIndex: (id: string) => number;
22
+ getSelectedSection: () => Section | undefined;
23
+ }
24
+ declare const PageContext: React.Context<PageContextValue | null>;
25
+ export declare function usePageContext(): PageContextValue;
26
+ export declare function usePageContextSafe(): PageContextValue | null;
27
+ interface PageProviderProps {
28
+ children: React.ReactNode;
29
+ initialDocument?: PageDocument;
30
+ isEditing?: boolean;
31
+ onChange?: (document: PageDocument) => void;
32
+ }
33
+ export declare function PageProvider({ children, initialDocument, isEditing, onChange, }: PageProviderProps): import("react/jsx-runtime").JSX.Element;
34
+ export { PageContext };
35
+ //# sourceMappingURL=PageContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageContext.d.ts","sourceRoot":"","sources":["../../src/context/PageContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAC1F,OAAO,EACL,YAAY,EACZ,UAAU,EACV,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,EAIV,MAAM,eAAe,CAAA;AAqKtB,UAAU,gBAAgB;IAExB,QAAQ,EAAE,YAAY,CAAA;IACtB,SAAS,EA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AM,WAAW,wCAA+C,CAAA;AAMhE,wBAAgB,cAAc,qBAM7B;AAGD,wBAAgB,kBAAkB,4BAEjC;AAMD,UAAU,iBAAiB;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,eAAe,CAAC,EAAE,YAAY,CAAA;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;CAC5C;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,eAAe,EACf,SAAgB,EAChB,QAAQ,GACT,EAAE,iBAAiB,2CAwInB;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ 'use client';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.PageContext = void 0;
38
+ exports.usePageContext = usePageContext;
39
+ exports.usePageContextSafe = usePageContextSafe;
40
+ exports.PageProvider = PageProvider;
41
+ const jsx_runtime_1 = require("react/jsx-runtime");
42
+ const react_1 = __importStar(require("react"));
43
+ const page_1 = require("../types/page");
44
+ // ============================================
45
+ // Reducer
46
+ // ============================================
47
+ function pageReducer(state, action) {
48
+ const now = new Date().toISOString();
49
+ switch (action.type) {
50
+ case 'SET_DOCUMENT':
51
+ return action.payload;
52
+ case 'SET_FORMAT':
53
+ return {
54
+ ...state,
55
+ format: action.payload,
56
+ updatedAt: now,
57
+ };
58
+ case 'SET_PRINT_SIZE':
59
+ return {
60
+ ...state,
61
+ printSize: action.payload,
62
+ updatedAt: now,
63
+ };
64
+ case 'SET_VIDEO_SIZE':
65
+ return {
66
+ ...state,
67
+ videoSize: action.payload,
68
+ updatedAt: now,
69
+ };
70
+ case 'SET_TITLE':
71
+ return {
72
+ ...state,
73
+ title: action.payload,
74
+ updatedAt: now,
75
+ };
76
+ case 'ADD_SECTION': {
77
+ const newSection = (0, page_1.createSection)(action.payload.layoutType, action.payload.content);
78
+ const sections = [...state.sections];
79
+ const index = action.payload.index ?? sections.length;
80
+ sections.splice(index, 0, newSection);
81
+ return {
82
+ ...state,
83
+ sections,
84
+ updatedAt: now,
85
+ };
86
+ }
87
+ case 'UPDATE_SECTION':
88
+ return {
89
+ ...state,
90
+ sections: state.sections.map((section) => section.id === action.payload.id
91
+ ? { ...section, content: action.payload.content }
92
+ : section),
93
+ updatedAt: now,
94
+ };
95
+ case 'UPDATE_SECTION_SETTINGS':
96
+ return {
97
+ ...state,
98
+ sections: state.sections.map((section) => section.id === action.payload.id
99
+ ? { ...section, ...action.payload.settings }
100
+ : section),
101
+ updatedAt: now,
102
+ };
103
+ case 'DELETE_SECTION':
104
+ return {
105
+ ...state,
106
+ sections: state.sections.filter((section) => section.id !== action.payload),
107
+ updatedAt: now,
108
+ };
109
+ case 'MOVE_SECTION': {
110
+ const { id, direction } = action.payload;
111
+ const sections = [...state.sections];
112
+ const index = sections.findIndex((s) => s.id === id);
113
+ if (index === -1)
114
+ return state;
115
+ const newIndex = direction === 'up' ? index - 1 : index + 1;
116
+ if (newIndex < 0 || newIndex >= sections.length)
117
+ return state;
118
+ [sections[index], sections[newIndex]] = [sections[newIndex], sections[index]];
119
+ return {
120
+ ...state,
121
+ sections,
122
+ updatedAt: now,
123
+ };
124
+ }
125
+ case 'REORDER_SECTIONS': {
126
+ const orderMap = new Map(action.payload.map((id, index) => [id, index]));
127
+ const sections = [...state.sections].sort((a, b) => {
128
+ const aIndex = orderMap.get(a.id) ?? 0;
129
+ const bIndex = orderMap.get(b.id) ?? 0;
130
+ return aIndex - bIndex;
131
+ });
132
+ return {
133
+ ...state,
134
+ sections,
135
+ updatedAt: now,
136
+ };
137
+ }
138
+ case 'DUPLICATE_SECTION': {
139
+ const sectionToDupe = state.sections.find((s) => s.id === action.payload);
140
+ if (!sectionToDupe)
141
+ return state;
142
+ const duplicated = {
143
+ ...sectionToDupe,
144
+ id: (0, page_1.generateId)(),
145
+ content: JSON.parse(JSON.stringify(sectionToDupe.content)), // Deep clone
146
+ };
147
+ const index = state.sections.findIndex((s) => s.id === action.payload);
148
+ const sections = [...state.sections];
149
+ sections.splice(index + 1, 0, duplicated);
150
+ return {
151
+ ...state,
152
+ sections,
153
+ updatedAt: now,
154
+ };
155
+ }
156
+ default:
157
+ return state;
158
+ }
159
+ }
160
+ const PageContext = (0, react_1.createContext)(null);
161
+ exports.PageContext = PageContext;
162
+ // ============================================
163
+ // Hook
164
+ // ============================================
165
+ function usePageContext() {
166
+ const context = (0, react_1.useContext)(PageContext);
167
+ if (!context) {
168
+ throw new Error('usePageContext must be used within a PageProvider');
169
+ }
170
+ return context;
171
+ }
172
+ // Optionnel: version qui ne throw pas (pour les composants qui peuvent être hors contexte)
173
+ function usePageContextSafe() {
174
+ return (0, react_1.useContext)(PageContext);
175
+ }
176
+ function PageProvider({ children, initialDocument, isEditing = true, onChange, }) {
177
+ const [document, dispatch] = (0, react_1.useReducer)(pageReducer, initialDocument ?? (0, page_1.createEmptyPage)('web'));
178
+ const [selectedSectionId, setSelectedSectionId] = react_1.default.useState(null);
179
+ // Notify parent of changes
180
+ react_1.default.useEffect(() => {
181
+ if (onChange) {
182
+ onChange(document);
183
+ }
184
+ }, [document, onChange]);
185
+ // Clear selection if selected section is deleted
186
+ react_1.default.useEffect(() => {
187
+ if (selectedSectionId && !document.sections.find(s => s.id === selectedSectionId)) {
188
+ setSelectedSectionId(null);
189
+ }
190
+ }, [document.sections, selectedSectionId]);
191
+ // Actions
192
+ const setDocument = (0, react_1.useCallback)((doc) => {
193
+ dispatch({ type: 'SET_DOCUMENT', payload: doc });
194
+ }, []);
195
+ const setFormat = (0, react_1.useCallback)((format) => {
196
+ dispatch({ type: 'SET_FORMAT', payload: format });
197
+ }, []);
198
+ const setPrintSize = (0, react_1.useCallback)((size) => {
199
+ dispatch({ type: 'SET_PRINT_SIZE', payload: size });
200
+ }, []);
201
+ const setVideoSize = (0, react_1.useCallback)((size) => {
202
+ dispatch({ type: 'SET_VIDEO_SIZE', payload: size });
203
+ }, []);
204
+ const setTitle = (0, react_1.useCallback)((title) => {
205
+ dispatch({ type: 'SET_TITLE', payload: title });
206
+ }, []);
207
+ const addSection = (0, react_1.useCallback)((layoutType, content, index) => {
208
+ dispatch({ type: 'ADD_SECTION', payload: { layoutType, content, index } });
209
+ }, []);
210
+ const updateSection = (0, react_1.useCallback)((id, content) => {
211
+ dispatch({ type: 'UPDATE_SECTION', payload: { id, content } });
212
+ }, []);
213
+ const updateSectionSettings = (0, react_1.useCallback)((id, settings) => {
214
+ dispatch({ type: 'UPDATE_SECTION_SETTINGS', payload: { id, settings } });
215
+ }, []);
216
+ const selectSection = (0, react_1.useCallback)((id) => {
217
+ setSelectedSectionId(id);
218
+ }, []);
219
+ const deleteSection = (0, react_1.useCallback)((id) => {
220
+ dispatch({ type: 'DELETE_SECTION', payload: id });
221
+ }, []);
222
+ const moveSection = (0, react_1.useCallback)((id, direction) => {
223
+ dispatch({ type: 'MOVE_SECTION', payload: { id, direction } });
224
+ }, []);
225
+ const reorderSections = (0, react_1.useCallback)((ids) => {
226
+ dispatch({ type: 'REORDER_SECTIONS', payload: ids });
227
+ }, []);
228
+ const duplicateSection = (0, react_1.useCallback)((id) => {
229
+ dispatch({ type: 'DUPLICATE_SECTION', payload: id });
230
+ }, []);
231
+ // Helpers
232
+ const getSectionById = (0, react_1.useCallback)((id) => document.sections.find((s) => s.id === id), [document.sections]);
233
+ const getSectionIndex = (0, react_1.useCallback)((id) => document.sections.findIndex((s) => s.id === id), [document.sections]);
234
+ const getSelectedSection = (0, react_1.useCallback)(() => selectedSectionId ? document.sections.find((s) => s.id === selectedSectionId) : undefined, [document.sections, selectedSectionId]);
235
+ const value = (0, react_1.useMemo)(() => ({
236
+ document,
237
+ isEditing,
238
+ selectedSectionId,
239
+ setDocument,
240
+ setFormat,
241
+ setPrintSize,
242
+ setVideoSize,
243
+ setTitle,
244
+ addSection,
245
+ updateSection,
246
+ updateSectionSettings,
247
+ deleteSection,
248
+ moveSection,
249
+ reorderSections,
250
+ duplicateSection,
251
+ selectSection,
252
+ getSectionById,
253
+ getSectionIndex,
254
+ getSelectedSection,
255
+ }), [
256
+ document,
257
+ isEditing,
258
+ selectedSectionId,
259
+ setDocument,
260
+ setFormat,
261
+ setPrintSize,
262
+ setVideoSize,
263
+ setTitle,
264
+ addSection,
265
+ updateSection,
266
+ updateSectionSettings,
267
+ deleteSection,
268
+ moveSection,
269
+ reorderSections,
270
+ duplicateSection,
271
+ selectSection,
272
+ getSectionById,
273
+ getSectionIndex,
274
+ getSelectedSection,
275
+ ]);
276
+ return (0, jsx_runtime_1.jsx)(PageContext.Provider, { value: value, children: children });
277
+ }
package/dist/index.d.ts CHANGED
@@ -14,5 +14,22 @@ export { InsertObjectPlugin, INSERT_OBJECT_COMMAND } from './plugins/InsertObjec
14
14
  export { ImageLinkPlugin } from './plugins/ImageLinkPlugin';
15
15
  export { SimpleLinkPlugin } from './plugins/LinkPlugin';
16
16
  export { EditorModeContext, EditorModeProvider, useEditorMode } from './context/EditorModeContext';
17
+ export { PageContext, PageProvider, usePageContext, usePageContextSafe } from './context/PageContext';
18
+ export { PageEditor } from './components/PageEditor';
19
+ export type { PageEditorProps } from './components/PageEditor';
20
+ export { PageViewer } from './components/PageViewer';
21
+ export type { PageViewerProps } from './components/PageViewer';
22
+ export { SectionComponent } from './components/Section';
23
+ export { SmartEditor, SmartViewer } from './components/SmartEditor';
24
+ export type { SmartEditorProps, SmartViewerProps } from './components/SmartEditor';
25
+ export { registerLayout, getLayout, getAllLayouts, getLayoutsByCategory, getLayoutComponent, getLayoutDefaultContent, initializeLayouts, } from './layouts';
26
+ export type { LayoutComponentProps, LayoutRegistryEntry } from './layouts';
27
+ export { OgilvyLayout, createDefaultOgilvyContent } from './layouts/OgilvyLayout';
28
+ export { RichTextLayout, createDefaultRichTextContent } from './layouts/RichTextLayout';
29
+ export type { RichTextContent } from './layouts/RichTextLayout';
30
+ export { detectFormat, isPageDocument, isLexicalState, lexicalToPageDocument, pageDocumentToLexical, ensurePageDocument, isSimpleDocument, prepareForSave, } from './utils/format';
31
+ export type { ContentFormat, FormatDetectionResult, SaveOptions } from './utils/format';
32
+ export type { PageDocument, PageFormat, Section, LayoutType, PrintSize, VideoSize, SectionAnimation, AnimationType, DropCapConfig, ImageData, OgilvyContent, HeroContent, TwoColumnsContent, ThreeColumnsContent, TextOnlyContent, ImageOnlyContent, QuoteContent, GalleryContent, LayoutDefinition, SectionProps, } from './types/page';
33
+ export { PRINT_PRESETS, VIDEO_PRESETS, DEFAULT_DROP_CAP, generateId, createSection, createEmptyPage, } from './types/page';
17
34
  export { RichTextEditor as AIEditor } from './components/RichTextEditor';
18
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACxH,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AACvH,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGzD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGlG,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":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AAGrB,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIEditor = exports.useEditorMode = exports.EditorModeProvider = exports.EditorModeContext = exports.SimpleLinkPlugin = exports.ImageLinkPlugin = exports.INSERT_OBJECT_COMMAND = exports.InsertObjectPlugin = exports.$wrapSelectionInSimpleLink = exports.$isSimpleLinkNode = exports.$createSimpleLinkNode = exports.SimpleLinkNode = exports.$wrapSelectionInImageLink = exports.$isImageLinkNode = exports.$createImageLinkNode = exports.ImageLinkNode = exports.$isImageNode = exports.$createImageNode = exports.ImageNode = exports.EditorToolbar = exports.RichTextViewer = exports.RichTextEditor = void 0;
3
+ exports.PRINT_PRESETS = exports.prepareForSave = exports.isSimpleDocument = exports.ensurePageDocument = exports.pageDocumentToLexical = exports.lexicalToPageDocument = exports.isLexicalState = exports.isPageDocument = exports.detectFormat = exports.createDefaultRichTextContent = exports.RichTextLayout = exports.createDefaultOgilvyContent = exports.OgilvyLayout = exports.initializeLayouts = exports.getLayoutDefaultContent = exports.getLayoutComponent = exports.getLayoutsByCategory = exports.getAllLayouts = exports.getLayout = exports.registerLayout = exports.SmartViewer = exports.SmartEditor = exports.SectionComponent = exports.PageViewer = exports.PageEditor = exports.usePageContextSafe = exports.usePageContext = exports.PageProvider = exports.PageContext = exports.useEditorMode = exports.EditorModeProvider = exports.EditorModeContext = exports.SimpleLinkPlugin = exports.ImageLinkPlugin = exports.INSERT_OBJECT_COMMAND = exports.InsertObjectPlugin = exports.$wrapSelectionInSimpleLink = exports.$isSimpleLinkNode = exports.$createSimpleLinkNode = exports.SimpleLinkNode = exports.$wrapSelectionInImageLink = exports.$isImageLinkNode = exports.$createImageLinkNode = exports.ImageLinkNode = exports.$isImageNode = exports.$createImageNode = exports.ImageNode = exports.EditorToolbar = exports.RichTextViewer = exports.RichTextEditor = void 0;
4
+ exports.AIEditor = exports.createEmptyPage = exports.createSection = exports.generateId = exports.DEFAULT_DROP_CAP = exports.VIDEO_PRESETS = void 0;
4
5
  // Main WYSIWYG editor component
5
6
  var RichTextEditor_1 = require("./components/RichTextEditor");
6
7
  Object.defineProperty(exports, "RichTextEditor", { enumerable: true, get: function () { return RichTextEditor_1.RichTextEditor; } });
@@ -38,6 +39,58 @@ var EditorModeContext_1 = require("./context/EditorModeContext");
38
39
  Object.defineProperty(exports, "EditorModeContext", { enumerable: true, get: function () { return EditorModeContext_1.EditorModeContext; } });
39
40
  Object.defineProperty(exports, "EditorModeProvider", { enumerable: true, get: function () { return EditorModeContext_1.EditorModeProvider; } });
40
41
  Object.defineProperty(exports, "useEditorMode", { enumerable: true, get: function () { return EditorModeContext_1.useEditorMode; } });
42
+ var PageContext_1 = require("./context/PageContext");
43
+ Object.defineProperty(exports, "PageContext", { enumerable: true, get: function () { return PageContext_1.PageContext; } });
44
+ Object.defineProperty(exports, "PageProvider", { enumerable: true, get: function () { return PageContext_1.PageProvider; } });
45
+ Object.defineProperty(exports, "usePageContext", { enumerable: true, get: function () { return PageContext_1.usePageContext; } });
46
+ Object.defineProperty(exports, "usePageContextSafe", { enumerable: true, get: function () { return PageContext_1.usePageContextSafe; } });
47
+ // ============================================
48
+ // Page Editor System (NEW)
49
+ // ============================================
50
+ // Page Editor components
51
+ var PageEditor_1 = require("./components/PageEditor");
52
+ Object.defineProperty(exports, "PageEditor", { enumerable: true, get: function () { return PageEditor_1.PageEditor; } });
53
+ var PageViewer_1 = require("./components/PageViewer");
54
+ Object.defineProperty(exports, "PageViewer", { enumerable: true, get: function () { return PageViewer_1.PageViewer; } });
55
+ var Section_1 = require("./components/Section");
56
+ Object.defineProperty(exports, "SectionComponent", { enumerable: true, get: function () { return Section_1.SectionComponent; } });
57
+ // Smart Editor (auto-détection du format)
58
+ var SmartEditor_1 = require("./components/SmartEditor");
59
+ Object.defineProperty(exports, "SmartEditor", { enumerable: true, get: function () { return SmartEditor_1.SmartEditor; } });
60
+ Object.defineProperty(exports, "SmartViewer", { enumerable: true, get: function () { return SmartEditor_1.SmartViewer; } });
61
+ // Layouts
62
+ var layouts_1 = require("./layouts");
63
+ Object.defineProperty(exports, "registerLayout", { enumerable: true, get: function () { return layouts_1.registerLayout; } });
64
+ Object.defineProperty(exports, "getLayout", { enumerable: true, get: function () { return layouts_1.getLayout; } });
65
+ Object.defineProperty(exports, "getAllLayouts", { enumerable: true, get: function () { return layouts_1.getAllLayouts; } });
66
+ Object.defineProperty(exports, "getLayoutsByCategory", { enumerable: true, get: function () { return layouts_1.getLayoutsByCategory; } });
67
+ Object.defineProperty(exports, "getLayoutComponent", { enumerable: true, get: function () { return layouts_1.getLayoutComponent; } });
68
+ Object.defineProperty(exports, "getLayoutDefaultContent", { enumerable: true, get: function () { return layouts_1.getLayoutDefaultContent; } });
69
+ Object.defineProperty(exports, "initializeLayouts", { enumerable: true, get: function () { return layouts_1.initializeLayouts; } });
70
+ var OgilvyLayout_1 = require("./layouts/OgilvyLayout");
71
+ Object.defineProperty(exports, "OgilvyLayout", { enumerable: true, get: function () { return OgilvyLayout_1.OgilvyLayout; } });
72
+ Object.defineProperty(exports, "createDefaultOgilvyContent", { enumerable: true, get: function () { return OgilvyLayout_1.createDefaultOgilvyContent; } });
73
+ var RichTextLayout_1 = require("./layouts/RichTextLayout");
74
+ Object.defineProperty(exports, "RichTextLayout", { enumerable: true, get: function () { return RichTextLayout_1.RichTextLayout; } });
75
+ Object.defineProperty(exports, "createDefaultRichTextContent", { enumerable: true, get: function () { return RichTextLayout_1.createDefaultRichTextContent; } });
76
+ // Format utilities (detection & conversion)
77
+ var format_1 = require("./utils/format");
78
+ Object.defineProperty(exports, "detectFormat", { enumerable: true, get: function () { return format_1.detectFormat; } });
79
+ Object.defineProperty(exports, "isPageDocument", { enumerable: true, get: function () { return format_1.isPageDocument; } });
80
+ Object.defineProperty(exports, "isLexicalState", { enumerable: true, get: function () { return format_1.isLexicalState; } });
81
+ Object.defineProperty(exports, "lexicalToPageDocument", { enumerable: true, get: function () { return format_1.lexicalToPageDocument; } });
82
+ Object.defineProperty(exports, "pageDocumentToLexical", { enumerable: true, get: function () { return format_1.pageDocumentToLexical; } });
83
+ Object.defineProperty(exports, "ensurePageDocument", { enumerable: true, get: function () { return format_1.ensurePageDocument; } });
84
+ Object.defineProperty(exports, "isSimpleDocument", { enumerable: true, get: function () { return format_1.isSimpleDocument; } });
85
+ Object.defineProperty(exports, "prepareForSave", { enumerable: true, get: function () { return format_1.prepareForSave; } });
86
+ // Helpers & Presets
87
+ var page_1 = require("./types/page");
88
+ Object.defineProperty(exports, "PRINT_PRESETS", { enumerable: true, get: function () { return page_1.PRINT_PRESETS; } });
89
+ Object.defineProperty(exports, "VIDEO_PRESETS", { enumerable: true, get: function () { return page_1.VIDEO_PRESETS; } });
90
+ Object.defineProperty(exports, "DEFAULT_DROP_CAP", { enumerable: true, get: function () { return page_1.DEFAULT_DROP_CAP; } });
91
+ Object.defineProperty(exports, "generateId", { enumerable: true, get: function () { return page_1.generateId; } });
92
+ Object.defineProperty(exports, "createSection", { enumerable: true, get: function () { return page_1.createSection; } });
93
+ Object.defineProperty(exports, "createEmptyPage", { enumerable: true, get: function () { return page_1.createEmptyPage; } });
41
94
  // Alias for backwards compatibility
42
95
  var RichTextEditor_2 = require("./components/RichTextEditor");
43
96
  Object.defineProperty(exports, "AIEditor", { enumerable: true, get: function () { return RichTextEditor_2.RichTextEditor; } });
@@ -0,0 +1,5 @@
1
+ import { OgilvyContent } from '../types/page';
2
+ import { LayoutComponentProps } from './index';
3
+ export declare function createDefaultOgilvyContent(): OgilvyContent;
4
+ export declare function OgilvyLayout({ section, isEditing, onContentChange, }: LayoutComponentProps<OgilvyContent>): import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=OgilvyLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OgilvyLayout.d.ts","sourceRoot":"","sources":["../../src/layouts/OgilvyLayout.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAId,MAAM,eAAe,CAAA;AACtB,OAAO,EAAkB,oBAAoB,EAAE,MAAM,SAAS,CAAA;AA0H9D,wBAAgB,0BAA0B,IAAI,aAAa,CAe1D;AAiUD,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,SAAS,EACT,eAAe,GAChB,EAAE,oBAAoB,CAAC,aAAa,CAAC,2CA8GrC"}