@tecof/theme-editor 0.0.39 → 0.0.40

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/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # @tecof/theme-editor
2
2
 
3
- Tecof platform için Puck CMS tabanlı **sayfa editörü**, **render motoru** ve **gelişmiş alan bileşenleri** kütüphanesi.
3
+ Tecof platform için **sayfa editörü**, **render motoru** ve **gelişmiş alan bileşenleri** kütüphanesi.
4
4
 
5
- > API Client, Context Provider, Puck wrapper bileşenleri, çok dilli alan yöneticileri, medya yöneticisi, link seçici, resim görüntüleyici ve tema araçları içerir.
5
+ > API Client, Context Provider, Tecof Studio editörü, çok dilli alan yöneticileri, medya yöneticisi, link seçici, resim görüntüleyici ve tema araçları içerir.
6
6
 
7
7
  ---
8
8
 
9
9
  ## Kurulum
10
10
 
11
11
  ```bash
12
- npm install @tecof/theme-editor @puckeditor/core react react-dom
12
+ npm install @tecof/theme-editor react react-dom
13
13
  ```
14
14
 
15
15
  ## Hızlı Başlangıç
@@ -22,7 +22,6 @@ import { TecofProvider } from "@tecof/theme-editor";
22
22
  <TecofProvider
23
23
  apiUrl="https://api.example.com"
24
24
  secretKey="your-merchant-secret-key"
25
- config={puckConfig}
26
25
  >
27
26
  {children}
28
27
  </TecofProvider>
@@ -33,10 +32,10 @@ import { TecofProvider } from "@tecof/theme-editor";
33
32
  ```tsx
34
33
  "use client";
35
34
  import { TecofEditor } from "@tecof/theme-editor";
36
- import { puckConfig } from "@/puck-config";
35
+ import { tecofConfig } from "@/tecof-config";
37
36
 
38
37
  export default function EditorPage({ params }) {
39
- return <TecofEditor pageId={params.id} />;
38
+ return <TecofEditor pageId={params.id} config={tecofConfig} />;
40
39
  }
41
40
  ```
42
41
 
@@ -45,11 +44,7 @@ export default function EditorPage({ params }) {
45
44
  ```tsx
46
45
  import { TecofRender } from "@tecof/theme-editor";
47
46
 
48
- // Slug ile otomatik fetch
49
- <TecofRender slug="home" />
50
-
51
- // Direkt data ile
52
- <TecofRender data={puckData} />
47
+ <TecofRender data={pageData} config={tecofConfig} />
53
48
  ```
54
49
 
55
50
  ---
@@ -58,36 +53,37 @@ import { TecofRender } from "@tecof/theme-editor";
58
53
 
59
54
  ### `<TecofProvider />`
60
55
 
61
- Tüm Tecof bileşenlerini sarar, API client ve config context'i sağlar.
56
+ Tüm Tecof bileşenlerini sarar ve API client context'i sağlar.
62
57
 
63
58
  | Prop | Tip | Açıklama |
64
59
  |------|-----|----------|
65
60
  | `apiUrl` | `string` | Backend API base URL |
66
61
  | `secretKey` | `string` | Merchant secret key |
67
- | `config` | `Config` | Puck component configuration |
68
62
  | `children` | `ReactNode` | Alt bileşenler |
69
63
 
70
64
  ### `<TecofEditor />`
71
65
 
72
- Puck wrapper sayfa editörü. Otomatik fetch/save ve iframe postMessage desteği.
66
+ Tecof Studio sayfa editörü. Otomatik fetch/save, iframe postMessage desteği, canvas DnD, katman paneli ve inspector içerir.
73
67
 
74
68
  | Prop | Tip | Açıklama |
75
69
  |------|-----|----------|
76
70
  | `pageId` | `string` | Düzenlenecek sayfa ID'si |
71
+ | `config` | `Config` | Tecof/Puck-compatible component configuration |
72
+ | `accessToken` | `string` | Kayıt isteklerinde Authorization header |
77
73
  | `onSave` | `(data) => void` | Kayıt sonrası callback |
78
- | `onPublish` | `(data) => void` | Yayınlama sonrası callback |
79
74
  | `onChange` | `(data) => void` | Her değişiklikte callback |
80
- | `overrides` | `object` | Puck UI override'ları |
75
+ | `className` | `string` | Ek CSS sınıfı |
81
76
 
82
77
  ### `<TecofRender />`
83
78
 
84
- Yayınlanmış sayfaları render eder.
79
+ Önceden yüklenmiş sayfa verisini render eder. Fetch akışı için `TecofApiClient.getPublishedPage(slug, locale?)` kullanılıp dönen `draftData`/sayfa verisi bu bileşene verilir.
85
80
 
86
81
  | Prop | Tip | Açıklama |
87
82
  |------|-----|----------|
88
- | `slug` | `string` | Sayfa slug'ı (otomatik fetch) |
89
- | `data` | `PuckPageData` | Direkt puck data (fetch yapmaz) |
90
- | `fallback` | `ReactNode` | Yükleme sırasında gösterilen bileşen |
83
+ | `data` | `PuckPageData` | Sayfa verisi |
84
+ | `config` | `Config` | Tecof/Puck-compatible component configuration |
85
+ | `cmsData` | `object` | CMS template sayfaları için ham kayıt verisi |
86
+ | `className` | `string` | Ek CSS sınıfı |
91
87
 
92
88
  ### `<TecofPicture />`
93
89
 
@@ -126,9 +122,9 @@ import Image from "next/image";
126
122
 
127
123
  ---
128
124
 
129
- ## Custom Fields (Puck Alanları)
125
+ ## Custom Fields (Editör Alanları)
130
126
 
131
- Tüm alanlar `createXField()` factory fonksiyonları ile Puck config'e entegre edilir.
127
+ Tüm alanlar `createXField()` factory fonksiyonları ile Tecof/Puck-compatible config'e entegre edilir.
132
128
 
133
129
  ### LanguageField — Çok Dilli Metin
134
130
 
@@ -325,7 +321,7 @@ Tüm `create*Field()` factory fonksiyonları aşağıdaki ortak seçenekleri des
325
321
 
326
322
  | Option | Tip | Açıklama |
327
323
  |--------|-----|----------|
328
- | `label` | `string` | Puck sidebar'da görünen alan etiketi |
324
+ | `label` | `string` | Inspector'da görünen alan etiketi |
329
325
  | `labelIcon` | `ReactElement` | Etiketin yanında gösterilen ikon (ör: Lucide) |
330
326
  | `visible` | `boolean` | Alanın sidebar'da görünür olup olmadığı |
331
327
 
@@ -422,6 +418,7 @@ import {
422
418
 
423
419
  ```ts
424
420
  // Parent → Editor
421
+ iframe.postMessage({ type: "puck:save" }, "*");
425
422
  iframe.postMessage({ type: "puck:publish" }, "*");
426
423
  iframe.postMessage({ type: "puck:undo" }, "*");
427
424
  iframe.postMessage({ type: "puck:redo" }, "*");
@@ -429,8 +426,9 @@ iframe.postMessage({ type: "puck:viewport", width: "375px" }, "*");
429
426
 
430
427
  // Editor → Parent
431
428
  window.addEventListener("message", (e) => {
432
- if (e.data.type === "puck:save") { /* değişiklik var */ }
433
- if (e.data.type === "puck:saved") { /* başarıyla kaydedildi */ }
429
+ if (e.data.type === "puck:changed") { /* değişiklik var */ }
430
+ if (e.data.type === "puck:saved") { /* başarıyla kaydedildi, e.data.data güncel draft */ }
431
+ if (e.data.type === "puck:saveError") { /* kayıt hatası */ }
434
432
  });
435
433
  ```
436
434
 
@@ -442,6 +440,8 @@ Kütüphane %100 oranında izole bir CSS altyapısı sunar. Önceden kullanılan
442
440
 
443
441
  Tasarım çakışmalarını önlemek için kütüphanenin sunduğu tüm CSS sınıfları sadece `.tecof-[component]-[element]` (örnek: `.tecof-upload-file-list`) ön ekini kullanır. `:root` altındaki renk değişkenlerinden (örn: `--tecof-primary-500`) beslenir.
444
442
 
443
+ Studio arayüzü de aynı sistemdedir: canvas, drop zone, selection overlay, inspector ve field loader'ları `src/styles.css` içindeki lime-green accent token'larını ve skeleton primitive'lerini kullanır. Inline style yalnızca gerçek runtime değerleri için bırakılır (örn. seçili node overlay koordinatı, layer indent CSS değişkeni, kullanıcı renk swatch'ı veya dışarıdan gelen render style prop'u).
444
+
445
445
  Editör alanlarının tam verimle (FilePond, Doka Editor vs.) düzgün işleyebilmesi için bu CSS dosyasını layout ana dosyanıza dahil edin:
446
446
 
447
447
  ```tsx
package/dist/index.d.mts CHANGED
@@ -90,7 +90,7 @@ interface TecofProviderProps {
90
90
  interface TecofEditorProps {
91
91
  /** Page ID to load and edit */
92
92
  pageId: string;
93
- /** Puck component configuration (Config from @puckeditor/core) */
93
+ /** Tecof/Puck-compatible component configuration */
94
94
  config: any;
95
95
  /** Access token for save operations (sent as Authorization header) */
96
96
  accessToken?: string;
@@ -98,17 +98,17 @@ interface TecofEditorProps {
98
98
  onSave?: (data: PuckPageData) => void;
99
99
  /** Called on every editor change */
100
100
  onChange?: (data: PuckPageData) => void;
101
- /** Puck UI overrides */
101
+ /** Legacy editor UI overrides (reserved, currently ignored by TecofStudio) */
102
102
  overrides?: Record<string, any>;
103
- /** Additional Puck plugins */
103
+ /** Additional editor plugins (reserved for host integrations) */
104
104
  plugins?: any[];
105
105
  /** Additional class name */
106
106
  className?: string;
107
107
  }
108
108
  interface TecofRenderProps {
109
- /** Pre-fetched puck data */
109
+ /** Pre-fetched page data */
110
110
  data: PuckPageData;
111
- /** Puck component configuration (Config from @puckeditor/core) */
111
+ /** Tecof/Puck-compatible component configuration */
112
112
  config: any;
113
113
  /** Additional class name */
114
114
  className?: string;
@@ -253,7 +253,7 @@ declare const TecofStudio: ({ pageId, config, accessToken, onSave, onChange, cla
253
253
  /**
254
254
  * TecofRender — Puck-compatible native page renderer.
255
255
  *
256
- * Pass `data` (PuckPageData) and `config` (Puck Config) directly.
256
+ * Pass `data` (PuckPageData-compatible page data) and Tecof component `config` directly.
257
257
  * Optionally pass `cmsData` to make CMS item data available to all
258
258
  * components via `puck.metadata.cmsData`.
259
259
  *
package/dist/index.d.ts CHANGED
@@ -90,7 +90,7 @@ interface TecofProviderProps {
90
90
  interface TecofEditorProps {
91
91
  /** Page ID to load and edit */
92
92
  pageId: string;
93
- /** Puck component configuration (Config from @puckeditor/core) */
93
+ /** Tecof/Puck-compatible component configuration */
94
94
  config: any;
95
95
  /** Access token for save operations (sent as Authorization header) */
96
96
  accessToken?: string;
@@ -98,17 +98,17 @@ interface TecofEditorProps {
98
98
  onSave?: (data: PuckPageData) => void;
99
99
  /** Called on every editor change */
100
100
  onChange?: (data: PuckPageData) => void;
101
- /** Puck UI overrides */
101
+ /** Legacy editor UI overrides (reserved, currently ignored by TecofStudio) */
102
102
  overrides?: Record<string, any>;
103
- /** Additional Puck plugins */
103
+ /** Additional editor plugins (reserved for host integrations) */
104
104
  plugins?: any[];
105
105
  /** Additional class name */
106
106
  className?: string;
107
107
  }
108
108
  interface TecofRenderProps {
109
- /** Pre-fetched puck data */
109
+ /** Pre-fetched page data */
110
110
  data: PuckPageData;
111
- /** Puck component configuration (Config from @puckeditor/core) */
111
+ /** Tecof/Puck-compatible component configuration */
112
112
  config: any;
113
113
  /** Additional class name */
114
114
  className?: string;
@@ -253,7 +253,7 @@ declare const TecofStudio: ({ pageId, config, accessToken, onSave, onChange, cla
253
253
  /**
254
254
  * TecofRender — Puck-compatible native page renderer.
255
255
  *
256
- * Pass `data` (PuckPageData) and `config` (Puck Config) directly.
256
+ * Pass `data` (PuckPageData-compatible page data) and Tecof component `config` directly.
257
257
  * Optionally pass `cmsData` to make CMS item data available to all
258
258
  * components via `puck.metadata.cmsData`.
259
259
  *