@squaredr/fieldcraft-pro 1.6.1 → 1.6.2

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.
@@ -1044,9 +1044,6 @@ function ThemeEditorInner({
1044
1044
  const [theme, setTheme] = useState(resolvedInitial);
1045
1045
  const [activeSection, setActiveSection] = useState("colors");
1046
1046
  const [presetKey, setPresetKey] = useState("custom");
1047
- const [mode, setMode] = useState(
1048
- () => isDarkTheme(resolvedInitial) ? "dark" : "light"
1049
- );
1050
1047
  const [showPalette, setShowPalette] = useState(false);
1051
1048
  const [showComparison, setShowComparison] = useState(false);
1052
1049
  const themeRef = useRef(theme);
@@ -1076,30 +1073,18 @@ function ThemeEditorInner({
1076
1073
  [onChange]
1077
1074
  );
1078
1075
  const loadPreset = useCallback(
1079
- (key, forceMode) => {
1076
+ (key) => {
1080
1077
  const family = PRESET_FAMILIES[key];
1081
1078
  if (family) {
1082
- const m = forceMode ?? mode;
1083
- const preset = family[m];
1079
+ const variant = isDarkTheme(theme) ? "dark" : "light";
1080
+ const preset = family[variant];
1084
1081
  setTheme(preset);
1085
1082
  setPresetKey(key);
1086
1083
  onChange?.(preset);
1087
1084
  }
1088
1085
  },
1089
- [onChange, mode]
1086
+ [onChange, theme]
1090
1087
  );
1091
- const toggleMode = useCallback(() => {
1092
- setMode((prev) => {
1093
- const next = prev === "light" ? "dark" : "light";
1094
- const family = PRESET_FAMILIES[presetKey];
1095
- if (family) {
1096
- const preset = family[next];
1097
- setTheme(preset);
1098
- onChange?.(preset);
1099
- }
1100
- return next;
1101
- });
1102
- }, [presetKey, onChange]);
1103
1088
  const exportJson = useCallback(() => {
1104
1089
  const blob = new Blob([JSON.stringify(theme, null, 2)], { type: "application/json" });
1105
1090
  const url = URL.createObjectURL(blob);
@@ -1168,15 +1153,6 @@ function ThemeEditorInner({
1168
1153
  Object.entries(PRESET_FAMILIES).map(([k, fam]) => /* @__PURE__ */ jsx("option", { value: k, children: fam.label }, k))
1169
1154
  ]
1170
1155
  }
1171
- ),
1172
- /* @__PURE__ */ jsx(
1173
- "button",
1174
- {
1175
- onClick: toggleMode,
1176
- className: "fcte-btn fcte-btn--secondary fcte-toolbar__mode",
1177
- title: mode === "light" ? "Switch to dark mode" : "Switch to light mode",
1178
- children: mode === "light" ? "\u2600" : "\u263E"
1179
- }
1180
1156
  )
1181
1157
  ] }),
1182
1158
  /* @__PURE__ */ jsxs("div", { className: "fcte-toolbar__right", children: [
package/dist/index.js CHANGED
@@ -8540,9 +8540,6 @@ function ThemeEditorInner({
8540
8540
  const [theme, setTheme] = react.useState(resolvedInitial);
8541
8541
  const [activeSection, setActiveSection] = react.useState("colors");
8542
8542
  const [presetKey, setPresetKey] = react.useState("custom");
8543
- const [mode, setMode] = react.useState(
8544
- () => isDarkTheme(resolvedInitial) ? "dark" : "light"
8545
- );
8546
8543
  const [showPalette, setShowPalette] = react.useState(false);
8547
8544
  const [showComparison, setShowComparison] = react.useState(false);
8548
8545
  const themeRef = react.useRef(theme);
@@ -8572,30 +8569,18 @@ function ThemeEditorInner({
8572
8569
  [onChange]
8573
8570
  );
8574
8571
  const loadPreset = react.useCallback(
8575
- (key, forceMode) => {
8572
+ (key) => {
8576
8573
  const family = PRESET_FAMILIES[key];
8577
8574
  if (family) {
8578
- const m = forceMode ?? mode;
8579
- const preset = family[m];
8575
+ const variant = isDarkTheme(theme) ? "dark" : "light";
8576
+ const preset = family[variant];
8580
8577
  setTheme(preset);
8581
8578
  setPresetKey(key);
8582
8579
  onChange?.(preset);
8583
8580
  }
8584
8581
  },
8585
- [onChange, mode]
8582
+ [onChange, theme]
8586
8583
  );
8587
- const toggleMode = react.useCallback(() => {
8588
- setMode((prev) => {
8589
- const next = prev === "light" ? "dark" : "light";
8590
- const family = PRESET_FAMILIES[presetKey];
8591
- if (family) {
8592
- const preset = family[next];
8593
- setTheme(preset);
8594
- onChange?.(preset);
8595
- }
8596
- return next;
8597
- });
8598
- }, [presetKey, onChange]);
8599
8584
  const exportJson = react.useCallback(() => {
8600
8585
  const blob = new Blob([JSON.stringify(theme, null, 2)], { type: "application/json" });
8601
8586
  const url = URL.createObjectURL(blob);
@@ -8664,15 +8649,6 @@ function ThemeEditorInner({
8664
8649
  Object.entries(PRESET_FAMILIES).map(([k, fam]) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: k, children: fam.label }, k))
8665
8650
  ]
8666
8651
  }
8667
- ),
8668
- /* @__PURE__ */ jsxRuntime.jsx(
8669
- "button",
8670
- {
8671
- onClick: toggleMode,
8672
- className: "fcte-btn fcte-btn--secondary fcte-toolbar__mode",
8673
- title: mode === "light" ? "Switch to dark mode" : "Switch to light mode",
8674
- children: mode === "light" ? "\u2600" : "\u263E"
8675
- }
8676
8652
  )
8677
8653
  ] }),
8678
8654
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fcte-toolbar__right", children: [
@@ -8872,7 +8848,7 @@ var themeEditorDarkPreset = {
8872
8848
  // src/index.ts
8873
8849
  if (typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" && globalThis.process.env?.NODE_ENV !== "production") {
8874
8850
  const _fc_banner = `
8875
- %c FieldCraft Pro %c v1.6.1
8851
+ %c FieldCraft Pro %c v1.6.2
8876
8852
 
8877
8853
  %cForm Builder \xB7 Response Viewer \xB7 Theme Editor
8878
8854
 
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  export { DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, addOption, addQuestion, addSection, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo } from './chunk-ANBMT5AW.mjs';
2
2
  export { ResponseViewer } from './chunk-5LKGCZAW.mjs';
3
3
  export { cn } from './chunk-QQ4JZGTD.mjs';
4
- export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from './chunk-IKGS2ZXV.mjs';
4
+ export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from './chunk-Y6JWJY3A.mjs';
5
5
  export { FieldCraftProProvider, UnlicensedOverlay, isProductionEnvironment, requireLicense, useLicense, validateLicense } from './chunk-VECQKSWS.mjs';
6
6
  import { useState, useEffect, Suspense } from 'react';
7
7
  import { FieldWrapper } from '@squaredr/fieldcraft-react';
@@ -277,7 +277,7 @@ var PRO_FIELD_OVERRIDES = {
277
277
  // src/index.ts
278
278
  if (typeof globalThis !== "undefined" && typeof globalThis.process !== "undefined" && globalThis.process.env?.NODE_ENV !== "production") {
279
279
  const _fc_banner = `
280
- %c FieldCraft Pro %c v1.6.1
280
+ %c FieldCraft Pro %c v1.6.2
281
281
 
282
282
  %cForm Builder \xB7 Response Viewer \xB7 Theme Editor
283
283
 
@@ -1368,9 +1368,6 @@ function ThemeEditorInner({
1368
1368
  const [theme, setTheme] = react.useState(resolvedInitial);
1369
1369
  const [activeSection, setActiveSection] = react.useState("colors");
1370
1370
  const [presetKey, setPresetKey] = react.useState("custom");
1371
- const [mode, setMode] = react.useState(
1372
- () => isDarkTheme(resolvedInitial) ? "dark" : "light"
1373
- );
1374
1371
  const [showPalette, setShowPalette] = react.useState(false);
1375
1372
  const [showComparison, setShowComparison] = react.useState(false);
1376
1373
  const themeRef = react.useRef(theme);
@@ -1400,30 +1397,18 @@ function ThemeEditorInner({
1400
1397
  [onChange]
1401
1398
  );
1402
1399
  const loadPreset = react.useCallback(
1403
- (key, forceMode) => {
1400
+ (key) => {
1404
1401
  const family = PRESET_FAMILIES[key];
1405
1402
  if (family) {
1406
- const m = forceMode ?? mode;
1407
- const preset = family[m];
1403
+ const variant = isDarkTheme(theme) ? "dark" : "light";
1404
+ const preset = family[variant];
1408
1405
  setTheme(preset);
1409
1406
  setPresetKey(key);
1410
1407
  onChange?.(preset);
1411
1408
  }
1412
1409
  },
1413
- [onChange, mode]
1410
+ [onChange, theme]
1414
1411
  );
1415
- const toggleMode = react.useCallback(() => {
1416
- setMode((prev) => {
1417
- const next = prev === "light" ? "dark" : "light";
1418
- const family = PRESET_FAMILIES[presetKey];
1419
- if (family) {
1420
- const preset = family[next];
1421
- setTheme(preset);
1422
- onChange?.(preset);
1423
- }
1424
- return next;
1425
- });
1426
- }, [presetKey, onChange]);
1427
1412
  const exportJson = react.useCallback(() => {
1428
1413
  const blob = new Blob([JSON.stringify(theme, null, 2)], { type: "application/json" });
1429
1414
  const url = URL.createObjectURL(blob);
@@ -1492,15 +1477,6 @@ function ThemeEditorInner({
1492
1477
  Object.entries(PRESET_FAMILIES).map(([k, fam]) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: k, children: fam.label }, k))
1493
1478
  ]
1494
1479
  }
1495
- ),
1496
- /* @__PURE__ */ jsxRuntime.jsx(
1497
- "button",
1498
- {
1499
- onClick: toggleMode,
1500
- className: "fcte-btn fcte-btn--secondary fcte-toolbar__mode",
1501
- title: mode === "light" ? "Switch to dark mode" : "Switch to light mode",
1502
- children: mode === "light" ? "\u2600" : "\u263E"
1503
- }
1504
1480
  )
1505
1481
  ] }),
1506
1482
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fcte-toolbar__right", children: [
@@ -1,2 +1,2 @@
1
- export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from '../chunk-IKGS2ZXV.mjs';
1
+ export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorInner, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from '../chunk-Y6JWJY3A.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.6.1",
3
+ "version": "1.6.2",
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",
@@ -1,8 +1,10 @@
1
1
  /* FieldCraft Pro Theme Editor
2
- Chrome theming follows the FormBuilder pattern:
2
+ Chrome theming uses shadcn variable names (--background, --foreground, etc.)
3
+ matching FormBuilder and ResponseViewer for consistent host page inheritance.
4
+
3
5
  1. ThemeEditorThemeProvider wraps children in <div data-fcte-root="" style={cssVars}>
4
- 2. :where([data-fcte-root]) defines zero-specificity fallback defaults
5
- 3. Host page :root variables naturally cascade through (higher specificity)
6
+ 2. --fcte-* variables reference shadcn vars via var(--shadcn-var, fallback)
7
+ 3. Host page :root variables naturally cascade through
6
8
  4. Provider inline styles override everything when a theme prop is passed
7
9
  5. All editor chrome references var(--fcte-*) — fully themeable
8
10
  */
@@ -13,23 +15,22 @@
13
15
  height: 100%;
14
16
  }
15
17
 
16
- /* ─── Default theme variables (zero specificity) ───────────────── */
17
- /* :where() gives these zero specificity so host page :root
18
- variables naturally override them. When no host defines
19
- these vars, the fallback values apply. Inline styles from
20
- ThemeEditorThemeProvider override everything. */
21
- :where([data-fcte-root]) {
22
- --fcte-bg: var(--bg, #F4F7F8);
23
- --fcte-surface: var(--surface, #FFFFFF);
24
- --fcte-surface-hover: var(--wash, #EDF3F2);
25
- --fcte-text: var(--ink, #12222A);
26
- --fcte-text-muted: var(--muted-text, #6A7B85);
27
- --fcte-text-dim: var(--placeholder, #96A5AD);
28
- --fcte-border: var(--rule, #DCE4E8);
29
- --fcte-border-strong: var(--teal-border, #B9D1CF);
30
- --fcte-input-bg: var(--surface2, #FAFCFC);
31
- --fcte-accent: var(--teal, #1F6B6E);
32
- --fcte-accent-text: var(--teal-on, #FFFFFF);
18
+ /* ─── Default theme variables ──────────────────────────────────── */
19
+ /* References shadcn variable names so the chrome inherits from any
20
+ host page that defines --background, --foreground, --card, etc.
21
+ Fallback values are Drafting Teal light defaults. */
22
+ [data-fcte-root] {
23
+ --fcte-bg: var(--background, #F4F7F8);
24
+ --fcte-surface: var(--card, #FFFFFF);
25
+ --fcte-surface-hover: var(--accent, #EDF3F2);
26
+ --fcte-text: var(--foreground, #12222A);
27
+ --fcte-text-muted: var(--muted-foreground, #6A7B85);
28
+ --fcte-text-dim: var(--muted-foreground, #96A5AD);
29
+ --fcte-border: var(--border, #DCE4E8);
30
+ --fcte-border-strong: var(--border, #B9D1CF);
31
+ --fcte-input-bg: var(--card, #FAFCFC);
32
+ --fcte-accent: var(--primary, #1F6B6E);
33
+ --fcte-accent-text: var(--primary-foreground, #FFFFFF);
33
34
  }
34
35
 
35
36
  /* ─── Root element ──────────────────────────────────────────────── */
@@ -83,16 +84,6 @@
83
84
  cursor: pointer;
84
85
  }
85
86
 
86
- .fcte-toolbar__mode {
87
- padding: 4px 8px;
88
- font-size: 14px;
89
- line-height: 1;
90
- min-width: 28px;
91
- display: flex;
92
- align-items: center;
93
- justify-content: center;
94
- }
95
-
96
87
  /* ─── Buttons ───────────────────────────────────────────────────── */
97
88
  .fcte-btn {
98
89
  padding: 5px 12px;