@squaredr/fieldcraft-pro 1.3.0 → 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.
@@ -1,2 +1,2 @@
1
- export { PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner } from '../chunk-7LQW5QYT.mjs';
1
+ export { PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider, draftingTealDarkPreset, draftingTealPreset, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from '../chunk-22T5PY6L.mjs';
2
2
  import '../chunk-VECQKSWS.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squaredr/fieldcraft-pro",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Pro components for FieldCraft — visual drag-and-drop Form Builder, Response Viewer, and Theme Editor for React",
5
5
  "keywords": [
6
6
  "fieldcraft",
@@ -57,19 +57,21 @@
57
57
  "@dnd-kit/core": "^6.1.0",
58
58
  "@dnd-kit/sortable": "^8.0.0",
59
59
  "@dnd-kit/utilities": "^3.2.2",
60
+ "@monaco-editor/react": "^4.6.0",
61
+ "@xyflow/react": "^12.11.3",
60
62
  "clsx": "^2.1.1",
61
63
  "lucide-react": "^1.16.0",
62
64
  "tailwind-merge": "^3.6.0"
63
65
  },
64
66
  "peerDependencies": {
65
- "@squaredr/fieldcraft-core": "^1.4.0",
66
- "@squaredr/fieldcraft-react": "^1.3.0",
67
+ "@squaredr/fieldcraft-core": "^1.5.0",
68
+ "@squaredr/fieldcraft-react": "^1.4.0",
67
69
  "react": "^18 || ^19",
68
70
  "react-dom": "^18 || ^19"
69
71
  },
70
72
  "devDependencies": {
71
- "@squaredr/fieldcraft-core": "^1.4.0",
72
- "@squaredr/fieldcraft-react": "^1.3.0",
73
+ "@squaredr/fieldcraft-core": "^1.5.0",
74
+ "@squaredr/fieldcraft-react": "^1.4.0",
73
75
  "@tailwindcss/cli": "^4.3.0",
74
76
  "@types/react": "^19.2.14",
75
77
  "@types/react-dom": "^19.2.3",
@@ -94,7 +96,7 @@
94
96
  "url": "https://github.com/SquaredR98/fieldcraft-pro/issues"
95
97
  },
96
98
  "scripts": {
97
- "build": "tsup && npx @tailwindcss/cli -i src/form-builder/styles/formbuilder.css -o dist/styles.css --minify",
99
+ "build": "tsup && npx @tailwindcss/cli -i src/form-builder/styles/formbuilder.css -o dist/styles.css --minify && node -e \"require('fs').copyFileSync('src/theme-editor/styles.css','theme-editor/styles.css')\"",
98
100
  "build:css": "npx @tailwindcss/cli -i src/form-builder/styles/formbuilder.css -o dist/styles.css --minify",
99
101
  "dev": "tsup && npx @tailwindcss/cli -i src/form-builder/styles/formbuilder.css -o dist/styles.css && npx concurrently \"tsup --watch\" \"npx @tailwindcss/cli -i src/form-builder/styles/formbuilder.css -o dist/styles.css --watch\"",
100
102
  "test": "vitest run",
@@ -1,33 +1,34 @@
1
1
  /* FieldCraft Pro Theme Editor
2
- All colors use CSS custom properties with dark defaults.
3
- Override on .fcte-root to match your app's theme:
4
-
5
- .fcte-root {
6
- --fcte-bg: #ffffff;
7
- --fcte-surface: #f5f5f5;
8
- --fcte-text: #1a1a1a;
9
- --fcte-text-muted: #6b7280;
10
- --fcte-border: #e0e0e0;
11
- --fcte-input-bg: #f9fafb;
12
- --fcte-accent: #2563eb;
13
- --fcte-accent-text: #ffffff;
14
- }
2
+ Chrome theming follows the FormBuilder pattern:
3
+ 1. ThemeEditorThemeProvider wraps children in <div data-fcte-root="" style={cssVars}>
4
+ 2. [data-fcte-root] defines fallback defaults (Drafting Teal light)
5
+ 3. Provider inline styles override these when a theme prop is passed
6
+ 4. All editor chrome references var(--fcte-*) — fully themeable
15
7
  */
16
8
 
17
- .fcte-root {
18
- /* Configurable tokens — override these to theme the editor UI */
19
- --fcte-bg: #0a0a0b;
20
- --fcte-surface: #111113;
21
- --fcte-surface-hover: #1c1c20;
22
- --fcte-text: #e8e8ea;
23
- --fcte-text-muted: #8a8a95;
24
- --fcte-text-dim: #5a5a66;
25
- --fcte-border: #1c1c20;
26
- --fcte-border-strong: #26262c;
27
- --fcte-input-bg: #17171a;
28
- --fcte-accent: oklch(0.82 0.14 210);
29
- --fcte-accent-text: #0a0a0b;
9
+ /* ─── Provider root ─────────────────────────────────────────────── */
10
+ .fcte-provider-root {
11
+ width: 100%;
12
+ height: 100%;
13
+ }
30
14
 
15
+ /* ─── Default theme variables — inherit from host app tokens ────── */
16
+ [data-fcte-root] {
17
+ --fcte-bg: var(--bg, #F4F7F8);
18
+ --fcte-surface: var(--surface, #FFFFFF);
19
+ --fcte-surface-hover: var(--wash, #EDF3F2);
20
+ --fcte-text: var(--ink, #12222A);
21
+ --fcte-text-muted: var(--muted-text, #6A7B85);
22
+ --fcte-text-dim: var(--placeholder, #96A5AD);
23
+ --fcte-border: var(--rule, #DCE4E8);
24
+ --fcte-border-strong: var(--teal-border, #B9D1CF);
25
+ --fcte-input-bg: var(--surface2, #FAFCFC);
26
+ --fcte-accent: var(--teal, #1F6B6E);
27
+ --fcte-accent-text: var(--teal-on, #FFFFFF);
28
+ }
29
+
30
+ /* ─── Root element ──────────────────────────────────────────────── */
31
+ .fcte-root {
31
32
  display: flex;
32
33
  flex-direction: column;
33
34
  font-family: system-ui, -apple-system, sans-serif;
@@ -37,7 +38,7 @@
37
38
  overflow: hidden;
38
39
  }
39
40
 
40
- /* Toolbar */
41
+ /* ─── Toolbar ───────────────────────────────────────────────────── */
41
42
  .fcte-toolbar {
42
43
  display: flex;
43
44
  align-items: center;
@@ -69,7 +70,7 @@
69
70
 
70
71
  .fcte-toolbar__preset {
71
72
  padding: 4px 8px;
72
- border-radius: 4px;
73
+ border-radius: 0;
73
74
  border: 1px solid var(--fcte-border-strong);
74
75
  background: var(--fcte-input-bg);
75
76
  color: var(--fcte-text);
@@ -77,10 +78,10 @@
77
78
  cursor: pointer;
78
79
  }
79
80
 
80
- /* Buttons */
81
+ /* ─── Buttons ───────────────────────────────────────────────────── */
81
82
  .fcte-btn {
82
83
  padding: 5px 12px;
83
- border-radius: 4px;
84
+ border-radius: 0;
84
85
  border: none;
85
86
  font-size: 12px;
86
87
  font-weight: 500;
@@ -107,7 +108,12 @@
107
108
  background: var(--fcte-surface-hover);
108
109
  }
109
110
 
110
- /* Body split */
111
+ .fcte-btn--sm {
112
+ padding: 3px 8px;
113
+ font-size: 11px;
114
+ }
115
+
116
+ /* ─── Body split ────────────────────────────────────────────────── */
111
117
  .fcte-body {
112
118
  display: flex;
113
119
  flex: 1;
@@ -115,7 +121,7 @@
115
121
  overflow: hidden;
116
122
  }
117
123
 
118
- /* Editor panel */
124
+ /* ─── Editor panel ──────────────────────────────────────────────── */
119
125
  .fcte-editor {
120
126
  width: 320px;
121
127
  min-width: 280px;
@@ -125,37 +131,19 @@
125
131
  background: var(--fcte-surface);
126
132
  }
127
133
 
128
- /* Section tabs */
129
- .fcte-tabs {
130
- display: flex;
134
+ /* ─── Section selector dropdown ─────────────────────────────────── */
135
+ .fcte-section-select {
136
+ padding: 8px 12px;
131
137
  border-bottom: 1px solid var(--fcte-border);
132
- overflow-x: auto;
133
138
  flex-shrink: 0;
134
139
  }
135
140
 
136
- .fcte-tab {
137
- padding: 8px 12px;
138
- font-size: 12px;
139
- font-weight: 500;
140
- color: var(--fcte-text-muted);
141
- border: none;
142
- background: none;
143
- cursor: pointer;
144
- white-space: nowrap;
145
- border-bottom: 2px solid transparent;
146
- transition: color 0.15s, border-color 0.15s;
147
- }
148
-
149
- .fcte-tab:hover {
150
- color: var(--fcte-text);
151
- }
152
-
153
- .fcte-tab--active {
154
- color: var(--fcte-text);
155
- border-bottom-color: var(--fcte-accent);
141
+ .fcte-section-select .fcte-field__select {
142
+ font-weight: 600;
143
+ font-size: 13px;
156
144
  }
157
145
 
158
- /* Fields area */
146
+ /* ─── Fields area ───────────────────────────────────────────────── */
159
147
  .fcte-fields {
160
148
  flex: 1;
161
149
  overflow-y: auto;
@@ -165,7 +153,7 @@
165
153
  gap: 10px;
166
154
  }
167
155
 
168
- /* Individual field */
156
+ /* ─── Individual field ──────────────────────────────────────────── */
169
157
  .fcte-field {
170
158
  display: flex;
171
159
  flex-direction: column;
@@ -190,7 +178,7 @@
190
178
  width: 28px;
191
179
  height: 28px;
192
180
  border: 1px solid var(--fcte-border-strong);
193
- border-radius: 4px;
181
+ border-radius: 0;
194
182
  padding: 0;
195
183
  cursor: pointer;
196
184
  background: none;
@@ -203,14 +191,14 @@
203
191
 
204
192
  .fcte-field__swatch::-webkit-color-swatch {
205
193
  border: none;
206
- border-radius: 2px;
194
+ border-radius: 0;
207
195
  }
208
196
 
209
197
  .fcte-field__text,
210
198
  .fcte-field__select,
211
199
  .fcte-field__number {
212
200
  padding: 5px 8px;
213
- border-radius: 4px;
201
+ border-radius: 0;
214
202
  border: 1px solid var(--fcte-border-strong);
215
203
  background: var(--fcte-input-bg);
216
204
  color: var(--fcte-text);
@@ -243,7 +231,7 @@
243
231
  color: var(--fcte-text-dim);
244
232
  }
245
233
 
246
- /* Preview panel */
234
+ /* ─── Preview panel ─────────────────────────────────────────────── */
247
235
  .fcte-preview {
248
236
  flex: 1;
249
237
  overflow: auto;
@@ -254,3 +242,219 @@
254
242
  padding: 24px;
255
243
  min-height: 100%;
256
244
  }
245
+
246
+ /* ─── Palette Generator ─────────────────────────────────────────── */
247
+ .fcte-palette {
248
+ border-bottom: 1px solid var(--fcte-border);
249
+ background: var(--fcte-surface);
250
+ }
251
+
252
+ .fcte-palette__header {
253
+ display: flex;
254
+ align-items: center;
255
+ justify-content: space-between;
256
+ padding: 8px 12px;
257
+ border-bottom: 1px solid var(--fcte-border);
258
+ }
259
+
260
+ .fcte-palette__title {
261
+ font-size: 12px;
262
+ font-weight: 600;
263
+ }
264
+
265
+ .fcte-palette__body {
266
+ padding: 12px;
267
+ display: flex;
268
+ flex-direction: column;
269
+ gap: 12px;
270
+ }
271
+
272
+ .fcte-palette__picker {
273
+ display: flex;
274
+ flex-direction: column;
275
+ gap: 4px;
276
+ }
277
+
278
+ .fcte-palette__label {
279
+ font-size: 11px;
280
+ font-weight: 500;
281
+ color: var(--fcte-text-muted);
282
+ text-transform: uppercase;
283
+ letter-spacing: 0.03em;
284
+ }
285
+
286
+ .fcte-palette__input-row {
287
+ display: flex;
288
+ align-items: center;
289
+ gap: 6px;
290
+ }
291
+
292
+ .fcte-palette__input-row .fcte-field__text {
293
+ width: 120px;
294
+ }
295
+
296
+ .fcte-palette__swatches {
297
+ display: flex;
298
+ flex-wrap: wrap;
299
+ gap: 8px;
300
+ }
301
+
302
+ .fcte-palette__swatch {
303
+ display: flex;
304
+ flex-direction: column;
305
+ align-items: center;
306
+ gap: 3px;
307
+ width: 56px;
308
+ }
309
+
310
+ .fcte-palette__swatch-color {
311
+ width: 40px;
312
+ height: 28px;
313
+ border-radius: 0;
314
+ border: 1px solid var(--fcte-border-strong);
315
+ }
316
+
317
+ .fcte-palette__swatch-label {
318
+ font-size: 10px;
319
+ color: var(--fcte-text-muted);
320
+ text-align: center;
321
+ }
322
+
323
+ .fcte-palette__swatch-hex {
324
+ font-size: 9px;
325
+ color: var(--fcte-text-dim);
326
+ font-family: monospace;
327
+ }
328
+
329
+ /* ─── Theme Comparison ──────────────────────────────────────────── */
330
+ .fcte-compare {
331
+ flex: 1;
332
+ display: flex;
333
+ flex-direction: column;
334
+ min-height: 0;
335
+ overflow: hidden;
336
+ }
337
+
338
+ .fcte-compare__header {
339
+ display: flex;
340
+ align-items: center;
341
+ justify-content: space-between;
342
+ padding: 8px 12px;
343
+ border-bottom: 1px solid var(--fcte-border);
344
+ background: var(--fcte-surface);
345
+ flex-shrink: 0;
346
+ }
347
+
348
+ .fcte-compare__title {
349
+ font-size: 12px;
350
+ font-weight: 600;
351
+ }
352
+
353
+ .fcte-compare__controls {
354
+ display: flex;
355
+ align-items: center;
356
+ gap: 8px;
357
+ }
358
+
359
+ .fcte-compare__label {
360
+ font-size: 11px;
361
+ color: var(--fcte-text-muted);
362
+ }
363
+
364
+ .fcte-compare__diffs {
365
+ padding: 8px 12px;
366
+ border-bottom: 1px solid var(--fcte-border);
367
+ background: var(--fcte-surface);
368
+ flex-shrink: 0;
369
+ }
370
+
371
+ .fcte-compare__diff-count {
372
+ font-size: 11px;
373
+ font-weight: 600;
374
+ color: var(--fcte-text-muted);
375
+ display: block;
376
+ margin-bottom: 6px;
377
+ }
378
+
379
+ .fcte-compare__diff-list {
380
+ display: flex;
381
+ flex-wrap: wrap;
382
+ gap: 6px;
383
+ }
384
+
385
+ .fcte-compare__diff-item {
386
+ display: flex;
387
+ align-items: center;
388
+ gap: 4px;
389
+ padding: 2px 6px;
390
+ border-radius: 0;
391
+ background: var(--fcte-input-bg);
392
+ border: 1px solid var(--fcte-border);
393
+ font-size: 10px;
394
+ }
395
+
396
+ .fcte-compare__diff-label {
397
+ color: var(--fcte-text-muted);
398
+ font-size: 10px;
399
+ }
400
+
401
+ .fcte-compare__diff-swatches {
402
+ display: flex;
403
+ align-items: center;
404
+ gap: 2px;
405
+ }
406
+
407
+ .fcte-compare__diff-swatch {
408
+ width: 14px;
409
+ height: 14px;
410
+ border-radius: 0;
411
+ border: 1px solid var(--fcte-border-strong);
412
+ }
413
+
414
+ .fcte-compare__diff-arrow {
415
+ font-size: 9px;
416
+ color: var(--fcte-text-dim);
417
+ }
418
+
419
+ .fcte-compare__diff-more {
420
+ font-size: 10px;
421
+ color: var(--fcte-text-dim);
422
+ align-self: center;
423
+ }
424
+
425
+ .fcte-compare__panels {
426
+ display: flex;
427
+ flex: 1;
428
+ min-height: 0;
429
+ overflow: hidden;
430
+ }
431
+
432
+ .fcte-compare__panel {
433
+ flex: 1;
434
+ display: flex;
435
+ flex-direction: column;
436
+ min-width: 0;
437
+ overflow: hidden;
438
+ }
439
+
440
+ .fcte-compare__panel + .fcte-compare__panel {
441
+ border-left: 1px solid var(--fcte-border);
442
+ }
443
+
444
+ .fcte-compare__panel-label {
445
+ padding: 6px 12px;
446
+ font-size: 11px;
447
+ font-weight: 600;
448
+ color: var(--fcte-text-muted);
449
+ text-transform: uppercase;
450
+ letter-spacing: 0.03em;
451
+ border-bottom: 1px solid var(--fcte-border);
452
+ background: var(--fcte-surface);
453
+ flex-shrink: 0;
454
+ }
455
+
456
+ .fcte-compare__panel-preview {
457
+ flex: 1;
458
+ overflow: auto;
459
+ padding: 16px;
460
+ }