@tecof/theme-editor 0.0.1
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/LICENSE +21 -0
- package/README.md +212 -0
- package/dist/index.d.mts +170 -0
- package/dist/index.d.ts +170 -0
- package/dist/index.js +411 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +398 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { createContext, useMemo, useContext, useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { fieldsPlugin, Puck, Render } from '@puckeditor/core';
|
|
4
|
+
|
|
5
|
+
// src/components/TecofProvider.tsx
|
|
6
|
+
|
|
7
|
+
// src/api.ts
|
|
8
|
+
var TecofApiClient = class {
|
|
9
|
+
constructor(apiUrl, secretKey) {
|
|
10
|
+
this.apiUrl = apiUrl.replace(/\/+$/, "");
|
|
11
|
+
this.secretKey = secretKey;
|
|
12
|
+
}
|
|
13
|
+
get headers() {
|
|
14
|
+
return {
|
|
15
|
+
"x-secret-key": this.secretKey,
|
|
16
|
+
Accept: "application/json",
|
|
17
|
+
"Content-Type": "application/json"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Fetch a page by ID (for the editor)
|
|
22
|
+
*/
|
|
23
|
+
async getPage(pageId) {
|
|
24
|
+
try {
|
|
25
|
+
const res = await fetch(`${this.apiUrl}/api/store/editor/${pageId}`, {
|
|
26
|
+
method: "GET",
|
|
27
|
+
headers: this.headers
|
|
28
|
+
});
|
|
29
|
+
return await res.json();
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return {
|
|
32
|
+
success: false,
|
|
33
|
+
message: error instanceof Error ? error.message : "Failed to fetch page"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Save a page by ID
|
|
39
|
+
*/
|
|
40
|
+
async savePage(pageId, puckData, title) {
|
|
41
|
+
try {
|
|
42
|
+
const res = await fetch(`${this.apiUrl}/api/store/editor/${pageId}`, {
|
|
43
|
+
method: "PUT",
|
|
44
|
+
headers: this.headers,
|
|
45
|
+
body: JSON.stringify({ puckData, ...title && { title } })
|
|
46
|
+
});
|
|
47
|
+
return await res.json();
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
success: false,
|
|
51
|
+
message: error instanceof Error ? error.message : "Failed to save page"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var TecofContext = createContext(null);
|
|
57
|
+
var TecofProvider = ({ apiUrl, secretKey, children }) => {
|
|
58
|
+
const value = useMemo(
|
|
59
|
+
() => ({
|
|
60
|
+
apiClient: new TecofApiClient(apiUrl, secretKey),
|
|
61
|
+
secretKey,
|
|
62
|
+
apiUrl
|
|
63
|
+
}),
|
|
64
|
+
[apiUrl, secretKey]
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ jsx(TecofContext.Provider, { value, children });
|
|
67
|
+
};
|
|
68
|
+
function useTecof() {
|
|
69
|
+
const ctx = useContext(TecofContext);
|
|
70
|
+
if (!ctx) {
|
|
71
|
+
throw new Error("useTecof must be used within a <TecofProvider>");
|
|
72
|
+
}
|
|
73
|
+
return ctx;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/components/styles.ts
|
|
77
|
+
var editorStyles = {
|
|
78
|
+
wrapper: {
|
|
79
|
+
position: "relative",
|
|
80
|
+
width: "100%",
|
|
81
|
+
height: "100%"
|
|
82
|
+
},
|
|
83
|
+
loading: {
|
|
84
|
+
display: "flex",
|
|
85
|
+
alignItems: "center",
|
|
86
|
+
justifyContent: "center",
|
|
87
|
+
minHeight: "100vh",
|
|
88
|
+
background: "#fafafa"
|
|
89
|
+
},
|
|
90
|
+
loadingInner: {
|
|
91
|
+
textAlign: "center"
|
|
92
|
+
},
|
|
93
|
+
loadingText: {
|
|
94
|
+
fontSize: "14px",
|
|
95
|
+
color: "#71717a",
|
|
96
|
+
fontFamily: "'Inter', system-ui, sans-serif"
|
|
97
|
+
},
|
|
98
|
+
saveIndicator: {
|
|
99
|
+
position: "fixed",
|
|
100
|
+
bottom: "20px",
|
|
101
|
+
right: "20px",
|
|
102
|
+
padding: "8px 16px",
|
|
103
|
+
background: "#18181b",
|
|
104
|
+
color: "#ffffff",
|
|
105
|
+
fontSize: "13px",
|
|
106
|
+
fontWeight: 500,
|
|
107
|
+
borderRadius: "8px",
|
|
108
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.15)",
|
|
109
|
+
zIndex: 9999,
|
|
110
|
+
fontFamily: "'Inter', system-ui, sans-serif"
|
|
111
|
+
},
|
|
112
|
+
spinner: {
|
|
113
|
+
width: "40px",
|
|
114
|
+
height: "40px",
|
|
115
|
+
border: "3px solid #e4e4e7",
|
|
116
|
+
borderTopColor: "#18181b",
|
|
117
|
+
borderRadius: "50%",
|
|
118
|
+
margin: "0 auto 12px",
|
|
119
|
+
animation: "tecof-spin 0.7s linear infinite"
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
var keyframesInjected = false;
|
|
123
|
+
var injectKeyframes = () => {
|
|
124
|
+
if (keyframesInjected || typeof document === "undefined") return;
|
|
125
|
+
const style = document.createElement("style");
|
|
126
|
+
style.textContent = `@keyframes tecof-spin { to { transform: rotate(360deg); } }`;
|
|
127
|
+
document.head.appendChild(style);
|
|
128
|
+
keyframesInjected = true;
|
|
129
|
+
};
|
|
130
|
+
var EMPTY_PAGE = { content: [], root: { props: {} }, zones: {} };
|
|
131
|
+
var TecofEditor = ({
|
|
132
|
+
pageId,
|
|
133
|
+
config,
|
|
134
|
+
onSave,
|
|
135
|
+
onPublish,
|
|
136
|
+
onChange,
|
|
137
|
+
overrides,
|
|
138
|
+
plugins: extraPlugins,
|
|
139
|
+
className
|
|
140
|
+
}) => {
|
|
141
|
+
const { apiClient } = useTecof();
|
|
142
|
+
const [initialData, setInitialData] = useState(null);
|
|
143
|
+
const [loading, setLoading] = useState(true);
|
|
144
|
+
const [saving, setSaving] = useState(false);
|
|
145
|
+
const [saveStatus, setSaveStatus] = useState("idle");
|
|
146
|
+
const puckDataRef = useRef(null);
|
|
147
|
+
const isEmbedded = typeof window !== "undefined" && window.parent !== window;
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
injectKeyframes();
|
|
150
|
+
}, []);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
let cancelled = false;
|
|
153
|
+
const load = async () => {
|
|
154
|
+
setLoading(true);
|
|
155
|
+
const res = await apiClient.getPage(pageId);
|
|
156
|
+
if (cancelled) return;
|
|
157
|
+
setInitialData(res.success && res.data?.puckData ? res.data.puckData : EMPTY_PAGE);
|
|
158
|
+
setLoading(false);
|
|
159
|
+
};
|
|
160
|
+
load();
|
|
161
|
+
return () => {
|
|
162
|
+
cancelled = true;
|
|
163
|
+
};
|
|
164
|
+
}, [pageId, apiClient]);
|
|
165
|
+
const handlePublish = useCallback(
|
|
166
|
+
async (data) => {
|
|
167
|
+
const puckData = data;
|
|
168
|
+
setSaving(true);
|
|
169
|
+
setSaveStatus("idle");
|
|
170
|
+
const res = await apiClient.savePage(pageId, puckData);
|
|
171
|
+
if (res.success) {
|
|
172
|
+
setSaveStatus("success");
|
|
173
|
+
setTimeout(() => setSaveStatus("idle"), 3e3);
|
|
174
|
+
onSave?.(puckData);
|
|
175
|
+
onPublish?.(puckData);
|
|
176
|
+
if (isEmbedded) window.parent.postMessage({ type: "puck:saved" }, "*");
|
|
177
|
+
} else {
|
|
178
|
+
setSaveStatus("error");
|
|
179
|
+
}
|
|
180
|
+
setSaving(false);
|
|
181
|
+
},
|
|
182
|
+
[pageId, apiClient, isEmbedded, onSave, onPublish]
|
|
183
|
+
);
|
|
184
|
+
const handleChange = useCallback(
|
|
185
|
+
(data) => {
|
|
186
|
+
const puckData = data;
|
|
187
|
+
puckDataRef.current = puckData;
|
|
188
|
+
onChange?.(puckData);
|
|
189
|
+
if (isEmbedded) window.parent.postMessage({ type: "puck:save" }, "*");
|
|
190
|
+
},
|
|
191
|
+
[onChange, isEmbedded]
|
|
192
|
+
);
|
|
193
|
+
useEffect(() => {
|
|
194
|
+
if (!isEmbedded) return;
|
|
195
|
+
const onMessage = (e) => {
|
|
196
|
+
switch (e.data?.type) {
|
|
197
|
+
case "puck:publish": {
|
|
198
|
+
const btn = document.querySelector('[data-testid="puck-publish"]');
|
|
199
|
+
btn ? btn.click() : puckDataRef.current && handlePublish(puckDataRef.current);
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
case "puck:undo":
|
|
203
|
+
document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, bubbles: true }));
|
|
204
|
+
break;
|
|
205
|
+
case "puck:redo":
|
|
206
|
+
document.dispatchEvent(new KeyboardEvent("keydown", { key: "z", code: "KeyZ", ctrlKey: true, shiftKey: true, bubbles: true }));
|
|
207
|
+
break;
|
|
208
|
+
case "puck:viewport": {
|
|
209
|
+
const frame = document.querySelector('[data-testid="puck-frame"]');
|
|
210
|
+
if (frame) {
|
|
211
|
+
const w = e.data.width || "100%";
|
|
212
|
+
frame.style.maxWidth = w;
|
|
213
|
+
frame.style.margin = w === "100%" ? "0" : "0 auto";
|
|
214
|
+
frame.style.transition = "max-width 0.3s ease";
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
window.addEventListener("message", onMessage);
|
|
221
|
+
return () => window.removeEventListener("message", onMessage);
|
|
222
|
+
}, [isEmbedded, handlePublish]);
|
|
223
|
+
if (loading || !initialData) {
|
|
224
|
+
return /* @__PURE__ */ jsx("div", { style: editorStyles.loading, className, children: /* @__PURE__ */ jsxs("div", { style: editorStyles.loadingInner, children: [
|
|
225
|
+
/* @__PURE__ */ jsx("div", { style: editorStyles.spinner }),
|
|
226
|
+
/* @__PURE__ */ jsx("p", { style: editorStyles.loadingText, children: "Loading editor..." })
|
|
227
|
+
] }) });
|
|
228
|
+
}
|
|
229
|
+
const plugins = [
|
|
230
|
+
...fieldsPlugin ? [fieldsPlugin({ desktopSideBar: "left" })] : [],
|
|
231
|
+
...extraPlugins || []
|
|
232
|
+
];
|
|
233
|
+
const mergedOverrides = { header: () => /* @__PURE__ */ jsx(Fragment, {}), ...overrides || {} };
|
|
234
|
+
return /* @__PURE__ */ jsxs("div", { style: editorStyles.wrapper, className, children: [
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
Puck,
|
|
237
|
+
{
|
|
238
|
+
plugins,
|
|
239
|
+
config,
|
|
240
|
+
data: initialData,
|
|
241
|
+
onPublish: handlePublish,
|
|
242
|
+
onChange: handleChange,
|
|
243
|
+
overrides: mergedOverrides
|
|
244
|
+
}
|
|
245
|
+
),
|
|
246
|
+
saving && /* @__PURE__ */ jsx("div", { style: editorStyles.saveIndicator, children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
247
|
+
] });
|
|
248
|
+
};
|
|
249
|
+
var TecofRender = ({ data, config, className }) => {
|
|
250
|
+
if (!data) return null;
|
|
251
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(Render, { config, data }) });
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
// src/utils/index.ts
|
|
255
|
+
function hexToHsl(hex) {
|
|
256
|
+
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
257
|
+
if (!result) return { h: 0, s: 0, l: 0 };
|
|
258
|
+
let r = parseInt(result[1], 16) / 255;
|
|
259
|
+
let g = parseInt(result[2], 16) / 255;
|
|
260
|
+
let b = parseInt(result[3], 16) / 255;
|
|
261
|
+
const max = Math.max(r, g, b);
|
|
262
|
+
const min = Math.min(r, g, b);
|
|
263
|
+
let h = 0;
|
|
264
|
+
let s = 0;
|
|
265
|
+
const l = (max + min) / 2;
|
|
266
|
+
if (max !== min) {
|
|
267
|
+
const d = max - min;
|
|
268
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
269
|
+
switch (max) {
|
|
270
|
+
case r:
|
|
271
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6;
|
|
272
|
+
break;
|
|
273
|
+
case g:
|
|
274
|
+
h = ((b - r) / d + 2) / 6;
|
|
275
|
+
break;
|
|
276
|
+
case b:
|
|
277
|
+
h = ((r - g) / d + 4) / 6;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
h: Math.round(h * 360),
|
|
283
|
+
s: Math.round(s * 100),
|
|
284
|
+
l: Math.round(l * 100)
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function hslToHex(h, s, l) {
|
|
288
|
+
const sNorm = s / 100;
|
|
289
|
+
const lNorm = l / 100;
|
|
290
|
+
const a = sNorm * Math.min(lNorm, 1 - lNorm);
|
|
291
|
+
const f = (n) => {
|
|
292
|
+
const k = (n + h / 30) % 12;
|
|
293
|
+
const color = lNorm - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
|
294
|
+
return Math.round(255 * color).toString(16).padStart(2, "0");
|
|
295
|
+
};
|
|
296
|
+
return `#${f(0)}${f(8)}${f(4)}`;
|
|
297
|
+
}
|
|
298
|
+
function lighten(hex, amount) {
|
|
299
|
+
const { h, s, l } = hexToHsl(hex);
|
|
300
|
+
return hslToHex(h, s, Math.min(100, l + amount));
|
|
301
|
+
}
|
|
302
|
+
function darken(hex, amount) {
|
|
303
|
+
const { h, s, l } = hexToHsl(hex);
|
|
304
|
+
return hslToHex(h, s, Math.max(0, l - amount));
|
|
305
|
+
}
|
|
306
|
+
function generateCSSVariables(theme) {
|
|
307
|
+
const lines = [":root {"];
|
|
308
|
+
for (const [key, value] of Object.entries(theme.colors)) {
|
|
309
|
+
const cssKey = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
310
|
+
lines.push(` --theme-color-${cssKey}: ${value};`);
|
|
311
|
+
}
|
|
312
|
+
lines.push(` --theme-font-family: ${theme.typography.fontFamily};`);
|
|
313
|
+
lines.push(` --theme-heading-font-family: ${theme.typography.headingFontFamily};`);
|
|
314
|
+
lines.push(` --theme-font-size-base: ${theme.typography.baseFontSize}px;`);
|
|
315
|
+
lines.push(` --theme-line-height: ${theme.typography.lineHeight};`);
|
|
316
|
+
lines.push(` --theme-font-weight-normal: ${theme.typography.fontWeightNormal};`);
|
|
317
|
+
lines.push(` --theme-font-weight-medium: ${theme.typography.fontWeightMedium};`);
|
|
318
|
+
lines.push(` --theme-font-weight-bold: ${theme.typography.fontWeightBold};`);
|
|
319
|
+
for (const [level, scale] of Object.entries(theme.typography.headingScale)) {
|
|
320
|
+
lines.push(` --theme-heading-${level}: ${scale}rem;`);
|
|
321
|
+
}
|
|
322
|
+
lines.push(` --theme-container-max-width: ${theme.spacing.containerMaxWidth}px;`);
|
|
323
|
+
lines.push(` --theme-section-padding-y: ${theme.spacing.sectionPaddingY}px;`);
|
|
324
|
+
lines.push(` --theme-section-padding-x: ${theme.spacing.sectionPaddingX}px;`);
|
|
325
|
+
lines.push(` --theme-component-gap: ${theme.spacing.componentGap}px;`);
|
|
326
|
+
lines.push(` --theme-border-radius: ${theme.spacing.borderRadius}px;`);
|
|
327
|
+
lines.push(` --theme-border-radius-lg: ${theme.spacing.borderRadiusLg}px;`);
|
|
328
|
+
lines.push(` --theme-border-radius-sm: ${theme.spacing.borderRadiusSm}px;`);
|
|
329
|
+
if (theme.customTokens) {
|
|
330
|
+
for (const [key, value] of Object.entries(theme.customTokens)) {
|
|
331
|
+
lines.push(` --theme-${key}: ${value};`);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
lines.push("}");
|
|
335
|
+
return lines.join("\n");
|
|
336
|
+
}
|
|
337
|
+
function getDefaultTheme() {
|
|
338
|
+
return {
|
|
339
|
+
colors: {
|
|
340
|
+
primary: "#18181b",
|
|
341
|
+
secondary: "#f4f4f5",
|
|
342
|
+
accent: "#3b82f6",
|
|
343
|
+
background: "#ffffff",
|
|
344
|
+
foreground: "#09090b",
|
|
345
|
+
muted: "#f4f4f5",
|
|
346
|
+
mutedForeground: "#71717a",
|
|
347
|
+
border: "#e4e4e7",
|
|
348
|
+
card: "#ffffff",
|
|
349
|
+
cardForeground: "#09090b",
|
|
350
|
+
destructive: "#ef4444"
|
|
351
|
+
},
|
|
352
|
+
typography: {
|
|
353
|
+
fontFamily: "'Inter', system-ui, -apple-system, sans-serif",
|
|
354
|
+
headingFontFamily: "'Inter', system-ui, -apple-system, sans-serif",
|
|
355
|
+
baseFontSize: 16,
|
|
356
|
+
lineHeight: 1.6,
|
|
357
|
+
headingScale: {
|
|
358
|
+
h1: 3,
|
|
359
|
+
h2: 2.25,
|
|
360
|
+
h3: 1.875,
|
|
361
|
+
h4: 1.5,
|
|
362
|
+
h5: 1.25,
|
|
363
|
+
h6: 1
|
|
364
|
+
},
|
|
365
|
+
fontWeightNormal: 400,
|
|
366
|
+
fontWeightMedium: 500,
|
|
367
|
+
fontWeightBold: 700
|
|
368
|
+
},
|
|
369
|
+
spacing: {
|
|
370
|
+
containerMaxWidth: 1280,
|
|
371
|
+
sectionPaddingY: 80,
|
|
372
|
+
sectionPaddingX: 24,
|
|
373
|
+
componentGap: 24,
|
|
374
|
+
borderRadius: 8,
|
|
375
|
+
borderRadiusLg: 12,
|
|
376
|
+
borderRadiusSm: 4
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function mergeTheme(base, overrides) {
|
|
381
|
+
const result = {
|
|
382
|
+
colors: { ...base.colors, ...overrides.colors ?? {} },
|
|
383
|
+
typography: { ...base.typography, ...overrides.typography ?? {} },
|
|
384
|
+
spacing: { ...base.spacing, ...overrides.spacing ?? {} },
|
|
385
|
+
customTokens: { ...base.customTokens ?? {}, ...overrides.customTokens ?? {} }
|
|
386
|
+
};
|
|
387
|
+
if (overrides.typography?.headingScale) {
|
|
388
|
+
result.typography.headingScale = {
|
|
389
|
+
...base.typography.headingScale,
|
|
390
|
+
...overrides.typography.headingScale
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
export { TecofApiClient, TecofEditor, TecofProvider, TecofRender, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
397
|
+
//# sourceMappingURL=index.mjs.map
|
|
398
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api.ts","../src/components/TecofProvider.tsx","../src/components/styles.ts","../src/components/TecofEditor.tsx","../src/components/TecofRender.tsx","../src/utils/index.ts"],"names":["jsx"],"mappings":";;;;;;;AAUO,IAAM,iBAAN,MAAqB;AAAA,EAI1B,WAAA,CAAY,QAAgB,SAAA,EAAmB;AAE7C,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA,CAAO,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AACvC,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AAAA,EACnB;AAAA,EAEA,IAAY,OAAA,GAAkC;AAC5C,IAAA,OAAO;AAAA,MACL,gBAAgB,IAAA,CAAK,SAAA;AAAA,MACrB,MAAA,EAAQ,kBAAA;AAAA,MACR,cAAA,EAAgB;AAAA,KAClB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAQ,MAAA,EAAmD;AAC/D,IAAA,IAAI;AACF,MAAA,MAAM,GAAA,GAAM,MAAM,KAAA,CAAM,CAAA,EAAG,KAAK,MAAM,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAA,EAAI;AAAA,QACnE,MAAA,EAAQ,KAAA;AAAA,QACR,SAAS,IAAA,CAAK;AAAA,OACf,CAAA;AACD,MAAA,OAAO,MAAM,IAAI,IAAA,EAAK;AAA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;AAAA,OACN;AAAA,MACA,gBAAA,EAAkB,GAAA;AAAA,MAClB,gBAAA,EAAkB,GAAA;AAAA,MAClB,cAAA,EAAgB;AAAA,KAClB;AAAA,IACA,OAAA,EAAS;AAAA,MACP,iBAAA,EAAmB,IAAA;AAAA,MACnB,eAAA,EAAiB,EAAA;AAAA,MACjB,eAAA,EAAiB,EAAA;AAAA,MACjB,YAAA,EAAc,EAAA;AAAA,MACd,YAAA,EAAc,CAAA;AAAA,MACd,cAAA,EAAgB,EAAA;AAAA,MAChB,cAAA,EAAgB;AAAA;AAClB,GACF;AACF;AAQO,SAAS,UAAA,CAAW,MAAmB,SAAA,EAA8C;AAC1F,EAAA,MAAM,MAAA,GAAsB;AAAA,IAC1B,MAAA,EAAQ,EAAE,GAAG,IAAA,CAAK,QAAQ,GAAI,SAAA,CAAU,MAAA,IAAU,EAAC,EAAG;AAAA,IACtD,UAAA,EAAY,EAAE,GAAG,IAAA,CAAK,YAAY,GAAI,SAAA,CAAU,UAAA,IAAc,EAAC,EAAG;AAAA,IAClE,OAAA,EAAS,EAAE,GAAG,IAAA,CAAK,SAAS,GAAI,SAAA,CAAU,OAAA,IAAW,EAAC,EAAG;AAAA,IACzD,YAAA,EAAc,EAAE,GAAI,IAAA,CAAK,YAAA,IAAgB,EAAC,EAAI,GAAI,SAAA,CAAU,YAAA,IAAgB,EAAC;AAAG,GAClF;AAGA,EAAA,IAAI,SAAA,CAAU,YAAY,YAAA,EAAc;AACtC,IAAA,MAAA,CAAO,WAAW,YAAA,GAAe;AAAA,MAC/B,GAAG,KAAK,UAAA,CAAW,YAAA;AAAA,MACnB,GAAG,UAAU,UAAA,CAAW;AAAA,KAC1B;AAAA,EACF;AAEA,EAAA,OAAO,MAAA;AACT","file":"index.mjs","sourcesContent":["import type { ApiResponse, PuckPageData, PageApiData } from './types';\n\n/**\n * Tecof API Client — handles communication with the Tecof backend\n * for page CRUD operations using merchant secret key.\n *\n * Endpoints:\n * - GET /api/store/editor/:id → get page by ID\n * - PUT /api/store/editor/:id → save page by ID\n */\nexport class TecofApiClient {\n private apiUrl: string;\n private secretKey: string;\n\n constructor(apiUrl: string, secretKey: string) {\n // Remove trailing slash\n this.apiUrl = apiUrl.replace(/\\/+$/, '');\n this.secretKey = secretKey;\n }\n\n private get headers(): Record<string, string> {\n return {\n 'x-secret-key': this.secretKey,\n Accept: 'application/json',\n 'Content-Type': 'application/json',\n };\n }\n\n /**\n * Fetch a page by ID (for the editor)\n */\n async getPage(pageId: string): Promise<ApiResponse<PageApiData>> {\n try {\n const res = await fetch(`${this.apiUrl}/api/store/editor/${pageId}`, {\n method: 'GET',\n headers: this.headers,\n });\n return await res.json();\n } catch (error) {\n return {\n success: false,\n message: error instanceof Error ? error.message : 'Failed to fetch page',\n };\n }\n }\n\n /**\n * Save a page by ID\n */\n async savePage(\n pageId: string,\n puckData: PuckPageData,\n title?: string\n ): Promise<ApiResponse<PageApiData>> {\n try {\n const res = await fetch(`${this.apiUrl}/api/store/editor/${pageId}`, {\n method: 'PUT',\n headers: this.headers,\n body: JSON.stringify({ puckData, ...(title && { title }) }),\n });\n return await res.json();\n } catch (error) {\n return {\n success: false,\n message: error instanceof Error ? error.message : 'Failed to save page',\n };\n }\n }\n}\n\nexport default TecofApiClient;\n","import { createContext, useContext, useMemo } from 'react';\nimport { TecofApiClient } from '../api';\nimport type { TecofProviderProps } from '../types';\n\n/* ─── Context ─── */\n\ninterface TecofContextValue {\n apiClient: TecofApiClient;\n secretKey: string;\n apiUrl: string;\n}\n\nconst TecofContext = createContext<TecofContextValue | null>(null);\n\n/* ─── Provider ─── */\n\nexport const TecofProvider = ({ apiUrl, secretKey, children }: TecofProviderProps) => {\n const value = useMemo<TecofContextValue>(\n () => ({\n apiClient: new TecofApiClient(apiUrl, secretKey),\n secretKey,\n apiUrl,\n }),\n [apiUrl, secretKey]\n );\n\n return <TecofContext.Provider value={value}>{children}</TecofContext.Provider>;\n};\n\n/* ─── Hook ─── */\n\nexport function useTecof(): TecofContextValue {\n const ctx = useContext(TecofContext);\n if (!ctx) {\n throw new Error('useTecof must be used within a <TecofProvider>');\n }\n return ctx;\n}\n\nexport default TecofProvider;\n","/**\n * Scoped styles for TecofEditor — inlined to avoid CSS module build issues.\n * These are internal styles, not exposed to consumers.\n */\nexport const editorStyles = {\n wrapper: {\n position: 'relative' as const,\n width: '100%',\n height: '100%',\n },\n loading: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '100vh',\n background: '#fafafa',\n },\n loadingInner: {\n textAlign: 'center' as const,\n },\n loadingText: {\n fontSize: '14px',\n color: '#71717a',\n fontFamily: \"'Inter', system-ui, sans-serif\",\n },\n error: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '200px',\n padding: '24px',\n fontSize: '14px',\n color: '#ef4444',\n fontFamily: \"'Inter', system-ui, sans-serif\",\n },\n saveIndicator: {\n position: 'fixed' as const,\n bottom: '20px',\n right: '20px',\n padding: '8px 16px',\n background: '#18181b',\n color: '#ffffff',\n fontSize: '13px',\n fontWeight: 500,\n borderRadius: '8px',\n boxShadow: '0 4px 12px rgba(0,0,0,0.15)',\n zIndex: 9999,\n fontFamily: \"'Inter', system-ui, sans-serif\",\n },\n spinner: {\n width: '40px',\n height: '40px',\n border: '3px solid #e4e4e7',\n borderTopColor: '#18181b',\n borderRadius: '50%',\n margin: '0 auto 12px',\n animation: 'tecof-spin 0.7s linear infinite',\n },\n} as const;\n\n/** Spinner keyframes — injected once into the document */\nlet keyframesInjected = false;\nexport const injectKeyframes = () => {\n if (keyframesInjected || typeof document === 'undefined') return;\n const style = document.createElement('style');\n style.textContent = `@keyframes tecof-spin { to { transform: rotate(360deg); } }`;\n document.head.appendChild(style);\n keyframesInjected = true;\n};\n","import { useCallback, useEffect, useRef, useState } from 'react';\nimport { Puck, fieldsPlugin, type Data, type Config } from '@puckeditor/core';\nimport { useTecof } from './TecofProvider';\nimport { editorStyles, injectKeyframes } from './styles';\nimport type { TecofEditorProps, PuckPageData } from '../types';\n\nconst EMPTY_PAGE: PuckPageData = { content: [], root: { props: {} }, zones: {} };\n\n/**\n * TecofEditor — Puck CMS page editor.\n *\n * - Fetches page by ID via secretKey auth\n * - Saves on publish\n * - Supports iframe postMessage (undo/redo/publish/viewport)\n *\n * Requires `<TecofProvider>` ancestor for API client.\n */\nexport const TecofEditor = ({\n pageId,\n config,\n onSave,\n onPublish,\n onChange,\n overrides,\n plugins: extraPlugins,\n className,\n}: TecofEditorProps) => {\n const { apiClient } = useTecof();\n\n const [initialData, setInitialData] = useState<PuckPageData | null>(null);\n const [loading, setLoading] = useState(true);\n const [saving, setSaving] = useState(false);\n const [saveStatus, setSaveStatus] = useState<'idle' | 'success' | 'error'>('idle');\n\n const puckDataRef = useRef<PuckPageData | null>(null);\n const isEmbedded = typeof window !== 'undefined' && window.parent !== window;\n\n // Inject spinner keyframes once\n useEffect(() => { injectKeyframes(); }, []);\n\n /* ── Fetch page ── */\n useEffect(() => {\n let cancelled = false;\n const load = async () => {\n setLoading(true);\n const res = await apiClient.getPage(pageId);\n if (cancelled) return;\n setInitialData(res.success && res.data?.puckData ? res.data.puckData : EMPTY_PAGE);\n setLoading(false);\n };\n load();\n return () => { cancelled = true; };\n }, [pageId, apiClient]);\n\n /* ── Save / Publish ── */\n const handlePublish = useCallback(\n async (data: Data) => {\n const puckData = data as unknown as PuckPageData;\n setSaving(true);\n setSaveStatus('idle');\n\n const res = await apiClient.savePage(pageId, puckData);\n\n if (res.success) {\n setSaveStatus('success');\n setTimeout(() => setSaveStatus('idle'), 3000);\n onSave?.(puckData);\n onPublish?.(puckData);\n if (isEmbedded) window.parent.postMessage({ type: 'puck:saved' }, '*');\n } else {\n setSaveStatus('error');\n }\n\n setSaving(false);\n },\n [pageId, apiClient, isEmbedded, onSave, onPublish]\n );\n\n /* ── Change ── */\n const handleChange = useCallback(\n (data: Data) => {\n const puckData = data as unknown as PuckPageData;\n puckDataRef.current = puckData;\n onChange?.(puckData);\n if (isEmbedded) window.parent.postMessage({ type: 'puck:save' }, '*');\n },\n [onChange, isEmbedded]\n );\n\n /* ── iframe postMessage ── */\n useEffect(() => {\n if (!isEmbedded) return;\n\n const onMessage = (e: MessageEvent) => {\n switch (e.data?.type) {\n case 'puck:publish': {\n const btn = document.querySelector('[data-testid=\"puck-publish\"]') as HTMLButtonElement;\n btn ? btn.click() : puckDataRef.current && handlePublish(puckDataRef.current);\n break;\n }\n case 'puck:undo':\n document.dispatchEvent(new KeyboardEvent('keydown', { key: 'z', code: 'KeyZ', ctrlKey: true, bubbles: true }));\n break;\n case 'puck:redo':\n document.dispatchEvent(new KeyboardEvent('keydown', { key: 'z', code: 'KeyZ', ctrlKey: true, shiftKey: true, bubbles: true }));\n break;\n case 'puck:viewport': {\n const frame = document.querySelector('[data-testid=\"puck-frame\"]') as HTMLElement;\n if (frame) {\n const w = e.data.width || '100%';\n frame.style.maxWidth = w;\n frame.style.margin = w === '100%' ? '0' : '0 auto';\n frame.style.transition = 'max-width 0.3s ease';\n }\n break;\n }\n }\n };\n\n window.addEventListener('message', onMessage);\n return () => window.removeEventListener('message', onMessage);\n }, [isEmbedded, handlePublish]);\n\n /* ── Loading ── */\n if (loading || !initialData) {\n return (\n <div style={editorStyles.loading} className={className}>\n <div style={editorStyles.loadingInner}>\n <div style={editorStyles.spinner} />\n <p style={editorStyles.loadingText}>Loading editor...</p>\n </div>\n </div>\n );\n }\n\n /* ── Plugins & Overrides ── */\n const plugins = [\n ...(fieldsPlugin ? [fieldsPlugin({ desktopSideBar: 'left' })] : []),\n ...(extraPlugins || []),\n ];\n\n const mergedOverrides = { header: () => <></>, ...(overrides || {}) };\n\n return (\n <div style={editorStyles.wrapper} className={className}>\n <Puck\n plugins={plugins}\n config={config as Config}\n data={initialData}\n onPublish={handlePublish}\n onChange={handleChange}\n overrides={mergedOverrides}\n />\n {saving && (\n <div style={editorStyles.saveIndicator}>\n {saveStatus === 'error' ? 'Save failed' : 'Saving...'}\n </div>\n )}\n </div>\n );\n};\n\nexport default TecofEditor;","import { Render, type Config } from '@puckeditor/core';\nimport type { TecofRenderProps } from '../types';\n\n/**\n * TecofRender — Puck page renderer.\n *\n * Pass `data` (PuckPageData) and `config` (Puck Config) directly.\n * No API fetch, no provider required.\n */\nexport const TecofRender = ({ data, config, className }: TecofRenderProps) => {\n if (!data) return null;\n\n return (\n <div className={className}>\n <Render config={config as Config} data={data} />\n </div>\n );\n};\n\nexport default TecofRender;\n","import type { ThemeConfig, HSL } from '../types';\n\n/* ─── Color Converters ─── */\n\nexport function hexToHsl(hex: string): HSL {\n const result = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(hex);\n if (!result) return { h: 0, s: 0, l: 0 };\n\n let r = parseInt(result[1], 16) / 255;\n let g = parseInt(result[2], 16) / 255;\n let b = parseInt(result[3], 16) / 255;\n\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n let h = 0;\n let s = 0;\n const l = (max + min) / 2;\n\n if (max !== min) {\n const d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = ((g - b) / d + (g < b ? 6 : 0)) / 6;\n break;\n case g:\n h = ((b - r) / d + 2) / 6;\n break;\n case b:\n h = ((r - g) / d + 4) / 6;\n break;\n }\n }\n\n return {\n h: Math.round(h * 360),\n s: Math.round(s * 100),\n l: Math.round(l * 100),\n };\n}\n\nexport function hslToHex(h: number, s: number, l: number): string {\n const sNorm = s / 100;\n const lNorm = l / 100;\n const a = sNorm * Math.min(lNorm, 1 - lNorm);\n\n const f = (n: number) => {\n const k = (n + h / 30) % 12;\n const color = lNorm - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);\n return Math.round(255 * color)\n .toString(16)\n .padStart(2, '0');\n };\n\n return `#${f(0)}${f(8)}${f(4)}`;\n}\n\n/* ─── Color Manipulation ─── */\n\nexport function lighten(hex: string, amount: number): string {\n const { h, s, l } = hexToHsl(hex);\n return hslToHex(h, s, Math.min(100, l + amount));\n}\n\nexport function darken(hex: string, amount: number): string {\n const { h, s, l } = hexToHsl(hex);\n return hslToHex(h, s, Math.max(0, l - amount));\n}\n\n/* ─── CSS Variable Generation ─── */\n\nexport function generateCSSVariables(theme: ThemeConfig): string {\n const lines: string[] = [':root {'];\n\n // Colors\n for (const [key, value] of Object.entries(theme.colors)) {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();\n lines.push(` --theme-color-${cssKey}: ${value};`);\n }\n\n // Typography\n lines.push(` --theme-font-family: ${theme.typography.fontFamily};`);\n lines.push(` --theme-heading-font-family: ${theme.typography.headingFontFamily};`);\n lines.push(` --theme-font-size-base: ${theme.typography.baseFontSize}px;`);\n lines.push(` --theme-line-height: ${theme.typography.lineHeight};`);\n lines.push(` --theme-font-weight-normal: ${theme.typography.fontWeightNormal};`);\n lines.push(` --theme-font-weight-medium: ${theme.typography.fontWeightMedium};`);\n lines.push(` --theme-font-weight-bold: ${theme.typography.fontWeightBold};`);\n\n for (const [level, scale] of Object.entries(theme.typography.headingScale)) {\n lines.push(` --theme-heading-${level}: ${scale}rem;`);\n }\n\n // Spacing\n lines.push(` --theme-container-max-width: ${theme.spacing.containerMaxWidth}px;`);\n lines.push(` --theme-section-padding-y: ${theme.spacing.sectionPaddingY}px;`);\n lines.push(` --theme-section-padding-x: ${theme.spacing.sectionPaddingX}px;`);\n lines.push(` --theme-component-gap: ${theme.spacing.componentGap}px;`);\n lines.push(` --theme-border-radius: ${theme.spacing.borderRadius}px;`);\n lines.push(` --theme-border-radius-lg: ${theme.spacing.borderRadiusLg}px;`);\n lines.push(` --theme-border-radius-sm: ${theme.spacing.borderRadiusSm}px;`);\n\n // Custom tokens\n if (theme.customTokens) {\n for (const [key, value] of Object.entries(theme.customTokens)) {\n lines.push(` --theme-${key}: ${value};`);\n }\n }\n\n lines.push('}');\n return lines.join('\\n');\n}\n\n/* ─── Default Theme ─── */\n\nexport function getDefaultTheme(): ThemeConfig {\n return {\n colors: {\n primary: '#18181b',\n secondary: '#f4f4f5',\n accent: '#3b82f6',\n background: '#ffffff',\n foreground: '#09090b',\n muted: '#f4f4f5',\n mutedForeground: '#71717a',\n border: '#e4e4e7',\n card: '#ffffff',\n cardForeground: '#09090b',\n destructive: '#ef4444',\n },\n typography: {\n fontFamily: \"'Inter', system-ui, -apple-system, sans-serif\",\n headingFontFamily: \"'Inter', system-ui, -apple-system, sans-serif\",\n baseFontSize: 16,\n lineHeight: 1.6,\n headingScale: {\n h1: 3,\n h2: 2.25,\n h3: 1.875,\n h4: 1.5,\n h5: 1.25,\n h6: 1,\n },\n fontWeightNormal: 400,\n fontWeightMedium: 500,\n fontWeightBold: 700,\n },\n spacing: {\n containerMaxWidth: 1280,\n sectionPaddingY: 80,\n sectionPaddingX: 24,\n componentGap: 24,\n borderRadius: 8,\n borderRadiusLg: 12,\n borderRadiusSm: 4,\n },\n };\n}\n\n/* ─── Deep Merge ─── */\n\nfunction isObject(item: unknown): item is Record<string, unknown> {\n return Boolean(item && typeof item === 'object' && !Array.isArray(item));\n}\n\nexport function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig {\n const result: ThemeConfig = {\n colors: { ...base.colors, ...(overrides.colors ?? {}) },\n typography: { ...base.typography, ...(overrides.typography ?? {}) },\n spacing: { ...base.spacing, ...(overrides.spacing ?? {}) },\n customTokens: { ...(base.customTokens ?? {}), ...(overrides.customTokens ?? {}) },\n };\n\n // Deep-merge headingScale if provided\n if (overrides.typography?.headingScale) {\n result.typography.headingScale = {\n ...base.typography.headingScale,\n ...overrides.typography.headingScale,\n };\n }\n\n return result;\n}\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tecof/theme-editor",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "React theme editor library for Tecof projects",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./puck.css": "./dist/puck.css"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": [
|
|
20
|
+
"*.css"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "tsup src/index.ts --watch --dts --format esm,cjs",
|
|
24
|
+
"build": "tsup src/index.ts --dts --format esm,cjs",
|
|
25
|
+
"lint": "eslint .",
|
|
26
|
+
"test": "vitest",
|
|
27
|
+
"storybook": "storybook dev -p 6006",
|
|
28
|
+
"build-storybook": "storybook build",
|
|
29
|
+
"changeset": "changeset",
|
|
30
|
+
"release": "changeset publish"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@puckeditor/core": "^0.x",
|
|
34
|
+
"react": "^18 || ^19",
|
|
35
|
+
"react-dom": "^18 || ^19"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@puckeditor/core": "^0.21.1",
|
|
39
|
+
"@storybook/react-vite": "^8.0.0",
|
|
40
|
+
"@types/react": "^19.0.0",
|
|
41
|
+
"@types/react-dom": "^19.0.0",
|
|
42
|
+
"eslint": "^9.0.0",
|
|
43
|
+
"prettier": "^3.0.0",
|
|
44
|
+
"tsup": "^8.0.0",
|
|
45
|
+
"typescript": "^5.0.0",
|
|
46
|
+
"vitest": "^3.0.0"
|
|
47
|
+
}
|
|
48
|
+
}
|