@orion-studios/payload-studio 0.6.0-beta.163 → 0.6.0-beta.165

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.
@@ -1400,15 +1400,13 @@ var decorateBuilderNumericSteppers = (root = document) => {
1400
1400
  input.inputMode = "decimal";
1401
1401
  field.querySelector("select")?.setAttribute("tabindex", "-1");
1402
1402
  if (property.startsWith("padding-")) {
1403
- const keepNegativePaddingValue = (event) => {
1404
- if (!input.value.trim().startsWith("-")) {
1405
- delete input.dataset.orionRawValue;
1403
+ input.addEventListener("input", () => {
1404
+ if (input.value.trim().startsWith("-")) {
1406
1405
  return;
1407
1406
  }
1408
- input.dataset.orionRawValue = input.value.trim();
1409
- };
1410
- input.addEventListener("input", keepNegativePaddingValue, true);
1411
- input.addEventListener("change", keepNegativePaddingValue, true);
1407
+ delete input.dataset.orionPaddingBase;
1408
+ delete input.dataset.orionPaddingDraft;
1409
+ });
1412
1410
  }
1413
1411
  input.addEventListener(
1414
1412
  "keydown",
@@ -1416,25 +1414,25 @@ var decorateBuilderNumericSteppers = (root = document) => {
1416
1414
  if (property.startsWith("padding-")) {
1417
1415
  const selectionStart2 = input.selectionStart ?? 0;
1418
1416
  const selectionEnd2 = input.selectionEnd ?? selectionStart2;
1419
- const value2 = input.dataset.orionRawValue || input.value || "";
1417
+ const value2 = input.dataset.orionPaddingDraft || input.value || "";
1420
1418
  const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
1421
- const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionRawValue?.startsWith("-")) || event.key === "-";
1419
+ const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionPaddingDraft?.startsWith("-")) || event.key === "-";
1422
1420
  if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
1423
1421
  event.preventDefault();
1424
1422
  event.stopImmediatePropagation();
1425
- if (!input.dataset.orionRawValue) {
1423
+ if (!input.dataset.orionPaddingDraft) {
1426
1424
  input.dataset.orionPaddingBase = input.value || "0";
1427
1425
  }
1428
1426
  const inserted = event.key === "-" ? "-" : event.key;
1429
1427
  const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
1430
1428
  const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
1431
1429
  input.value = nextValue2;
1432
- input.dataset.orionRawValue = nextValue2;
1430
+ input.dataset.orionPaddingDraft = nextValue2;
1433
1431
  const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
1434
1432
  input.setSelectionRange(nextCursor2, nextCursor2);
1435
1433
  window.dispatchEvent(
1436
1434
  new CustomEvent("orion-builder-v2-negative-padding-input", {
1437
- detail: { property, value: nextValue2 }
1435
+ detail: { baseValue: input.dataset.orionPaddingBase || "0", property, value: nextValue2 }
1438
1436
  })
1439
1437
  );
1440
1438
  return;
@@ -1914,7 +1912,7 @@ var readStylePanelValue = (property) => {
1914
1912
  var readStylePanelLength = (property) => {
1915
1913
  const control = readStylePanelValue(property);
1916
1914
  const input = control?.querySelector("input");
1917
- const value = (input?.dataset.orionRawValue || input?.value || "").trim();
1915
+ const value = (input?.value || "").trim();
1918
1916
  const unit = control?.querySelector("select")?.value.trim() || "";
1919
1917
  if (!value) {
1920
1918
  return "";
@@ -1936,13 +1934,14 @@ var readStylePanelColor = (property) => {
1936
1934
  return swatchColor;
1937
1935
  };
1938
1936
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1939
- var negativePaddingVariableForProperty = (property) => property === "padding-top" ? "--orion-builder-negative-padding-top" : property === "padding-right" ? "--orion-builder-negative-padding-right" : property === "padding-bottom" ? "--orion-builder-negative-padding-bottom" : property === "padding-left" ? "--orion-builder-negative-padding-left" : "";
1940
- var negativePaddingVariables = [
1941
- "--orion-builder-negative-padding-top",
1942
- "--orion-builder-negative-padding-right",
1943
- "--orion-builder-negative-padding-bottom",
1944
- "--orion-builder-negative-padding-left"
1945
- ];
1937
+ var cssPixelValue = (value) => {
1938
+ const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
1939
+ if (!match) {
1940
+ return null;
1941
+ }
1942
+ const parsed = Number.parseFloat(match[1]);
1943
+ return Number.isFinite(parsed) ? parsed : null;
1944
+ };
1946
1945
  var propertyNameFromStyleControl = (element) => {
1947
1946
  const property = element?.closest(".gjs-sm-property");
1948
1947
  const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
@@ -2558,41 +2557,25 @@ function GrapesPageEditor({
2558
2557
  const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2559
2558
  selectedComponentRef.current = selected;
2560
2559
  lastSelectedComponentRef.current = selected;
2561
- if (property.startsWith("padding-") && !value.startsWith("-")) {
2562
- clearNegativePaddingForProperty(selected, property);
2563
- }
2564
2560
  selected.addStyle?.({ [property]: value });
2565
2561
  editorRef.current?.select?.(selected);
2566
2562
  };
2567
- const clearNegativePaddingForProperty = (component, property) => {
2568
- const variable = negativePaddingVariableForProperty(property);
2569
- if (!variable) {
2570
- return;
2571
- }
2572
- component.removeStyle?.(variable);
2573
- const style = component.getStyle?.() || {};
2574
- const hasNegativePadding = negativePaddingVariables.some((candidate) => candidate !== variable && Boolean(style[candidate]));
2575
- if (!hasNegativePadding) {
2576
- component.removeClass?.("orion-builder-v2-has-negative-padding");
2577
- }
2578
- };
2579
- const applyNegativePaddingInput = (property, value) => {
2563
+ const applyNegativePaddingInput = (property, value, baseValue) => {
2580
2564
  const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
2581
- const variable = negativePaddingVariableForProperty(property);
2582
- if (!selected || !variable || !value.startsWith("-")) {
2565
+ if (!selected || !property.startsWith("padding-") || !value.startsWith("-")) {
2583
2566
  return;
2584
2567
  }
2585
2568
  const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
2586
- const amount = Math.abs(Number.parseFloat(value));
2587
- if (!Number.isFinite(amount) || amount <= 0) {
2588
- clearNegativePaddingForProperty(selected, property);
2569
+ const base = cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0;
2570
+ const adjustment = Number.parseFloat(value);
2571
+ if (!Number.isFinite(adjustment)) {
2589
2572
  return;
2590
2573
  }
2591
- const styleValue = `${Number.isInteger(amount) ? amount : Number(amount.toFixed(2))}${unit}`;
2574
+ const next = Math.max(0, base + adjustment);
2575
+ const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2592
2576
  selectedComponentRef.current = selected;
2593
2577
  lastSelectedComponentRef.current = selected;
2594
- selected.addClass?.("orion-builder-v2-has-negative-padding");
2595
- selected.addStyle?.({ [variable]: styleValue });
2578
+ selected.addStyle?.({ [property]: styleValue });
2596
2579
  editorRef.current?.select?.(selected);
2597
2580
  };
2598
2581
  const updateSelectedOrionBlock = (updates) => {
@@ -3673,7 +3656,7 @@ function GrapesPageEditor({
3673
3656
  const onStylePanelInput = (event) => {
3674
3657
  const target = event.target;
3675
3658
  if (target?.closest("#orion-builder-v2-styles")) {
3676
- if (target?.dataset?.orionRawValue?.startsWith("-")) {
3659
+ if (target?.dataset?.orionPaddingDraft?.startsWith("-")) {
3677
3660
  return;
3678
3661
  }
3679
3662
  const activeElement = document.activeElement;
@@ -3735,7 +3718,7 @@ function GrapesPageEditor({
3735
3718
  if (!detail.property || !detail.value) {
3736
3719
  return;
3737
3720
  }
3738
- applyNegativePaddingInput(detail.property, detail.value);
3721
+ applyNegativePaddingInput(detail.property, detail.value, detail.baseValue || "0");
3739
3722
  };
3740
3723
  const observer = new MutationObserver(() => {
3741
3724
  decorateBuilderControls();
@@ -1276,15 +1276,13 @@ var decorateBuilderNumericSteppers = (root = document) => {
1276
1276
  input.inputMode = "decimal";
1277
1277
  field.querySelector("select")?.setAttribute("tabindex", "-1");
1278
1278
  if (property.startsWith("padding-")) {
1279
- const keepNegativePaddingValue = (event) => {
1280
- if (!input.value.trim().startsWith("-")) {
1281
- delete input.dataset.orionRawValue;
1279
+ input.addEventListener("input", () => {
1280
+ if (input.value.trim().startsWith("-")) {
1282
1281
  return;
1283
1282
  }
1284
- input.dataset.orionRawValue = input.value.trim();
1285
- };
1286
- input.addEventListener("input", keepNegativePaddingValue, true);
1287
- input.addEventListener("change", keepNegativePaddingValue, true);
1283
+ delete input.dataset.orionPaddingBase;
1284
+ delete input.dataset.orionPaddingDraft;
1285
+ });
1288
1286
  }
1289
1287
  input.addEventListener(
1290
1288
  "keydown",
@@ -1292,25 +1290,25 @@ var decorateBuilderNumericSteppers = (root = document) => {
1292
1290
  if (property.startsWith("padding-")) {
1293
1291
  const selectionStart2 = input.selectionStart ?? 0;
1294
1292
  const selectionEnd2 = input.selectionEnd ?? selectionStart2;
1295
- const value2 = input.dataset.orionRawValue || input.value || "";
1293
+ const value2 = input.dataset.orionPaddingDraft || input.value || "";
1296
1294
  const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
1297
- const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionRawValue?.startsWith("-")) || event.key === "-";
1295
+ const isNegativeEntry = value2.startsWith("-") || Boolean(input.dataset.orionPaddingDraft?.startsWith("-")) || event.key === "-";
1298
1296
  if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
1299
1297
  event.preventDefault();
1300
1298
  event.stopImmediatePropagation();
1301
- if (!input.dataset.orionRawValue) {
1299
+ if (!input.dataset.orionPaddingDraft) {
1302
1300
  input.dataset.orionPaddingBase = input.value || "0";
1303
1301
  }
1304
1302
  const inserted = event.key === "-" ? "-" : event.key;
1305
1303
  const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
1306
1304
  const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
1307
1305
  input.value = nextValue2;
1308
- input.dataset.orionRawValue = nextValue2;
1306
+ input.dataset.orionPaddingDraft = nextValue2;
1309
1307
  const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
1310
1308
  input.setSelectionRange(nextCursor2, nextCursor2);
1311
1309
  window.dispatchEvent(
1312
1310
  new CustomEvent("orion-builder-v2-negative-padding-input", {
1313
- detail: { property, value: nextValue2 }
1311
+ detail: { baseValue: input.dataset.orionPaddingBase || "0", property, value: nextValue2 }
1314
1312
  })
1315
1313
  );
1316
1314
  return;
@@ -1790,7 +1788,7 @@ var readStylePanelValue = (property) => {
1790
1788
  var readStylePanelLength = (property) => {
1791
1789
  const control = readStylePanelValue(property);
1792
1790
  const input = control?.querySelector("input");
1793
- const value = (input?.dataset.orionRawValue || input?.value || "").trim();
1791
+ const value = (input?.value || "").trim();
1794
1792
  const unit = control?.querySelector("select")?.value.trim() || "";
1795
1793
  if (!value) {
1796
1794
  return "";
@@ -1812,13 +1810,14 @@ var readStylePanelColor = (property) => {
1812
1810
  return swatchColor;
1813
1811
  };
1814
1812
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1815
- var negativePaddingVariableForProperty = (property) => property === "padding-top" ? "--orion-builder-negative-padding-top" : property === "padding-right" ? "--orion-builder-negative-padding-right" : property === "padding-bottom" ? "--orion-builder-negative-padding-bottom" : property === "padding-left" ? "--orion-builder-negative-padding-left" : "";
1816
- var negativePaddingVariables = [
1817
- "--orion-builder-negative-padding-top",
1818
- "--orion-builder-negative-padding-right",
1819
- "--orion-builder-negative-padding-bottom",
1820
- "--orion-builder-negative-padding-left"
1821
- ];
1813
+ var cssPixelValue = (value) => {
1814
+ const match = value.trim().match(/^(-?\d*\.?\d+)(px)?$/i);
1815
+ if (!match) {
1816
+ return null;
1817
+ }
1818
+ const parsed = Number.parseFloat(match[1]);
1819
+ return Number.isFinite(parsed) ? parsed : null;
1820
+ };
1822
1821
  var propertyNameFromStyleControl = (element) => {
1823
1822
  const property = element?.closest(".gjs-sm-property");
1824
1823
  const className = Array.from(property?.classList || []).find((name) => name.startsWith("gjs-sm-property__"));
@@ -2434,41 +2433,25 @@ function GrapesPageEditor({
2434
2433
  const value = property === "font-weight" ? normalizeFontWeightValue(readStylePanelSelect(property)) || readStylePanelInput(property) : property === "opacity" ? readStylePanelInput(property) : readStylePanelLength(property) || readStylePanelInput(property) || readStylePanelSelect(property) || readStylePanelRadio(property);
2435
2434
  selectedComponentRef.current = selected;
2436
2435
  lastSelectedComponentRef.current = selected;
2437
- if (property.startsWith("padding-") && !value.startsWith("-")) {
2438
- clearNegativePaddingForProperty(selected, property);
2439
- }
2440
2436
  selected.addStyle?.({ [property]: value });
2441
2437
  editorRef.current?.select?.(selected);
2442
2438
  };
2443
- const clearNegativePaddingForProperty = (component, property) => {
2444
- const variable = negativePaddingVariableForProperty(property);
2445
- if (!variable) {
2446
- return;
2447
- }
2448
- component.removeStyle?.(variable);
2449
- const style = component.getStyle?.() || {};
2450
- const hasNegativePadding = negativePaddingVariables.some((candidate) => candidate !== variable && Boolean(style[candidate]));
2451
- if (!hasNegativePadding) {
2452
- component.removeClass?.("orion-builder-v2-has-negative-padding");
2453
- }
2454
- };
2455
- const applyNegativePaddingInput = (property, value) => {
2439
+ const applyNegativePaddingInput = (property, value, baseValue) => {
2456
2440
  const selected = getCurrentOrionBlockTarget(getCurrentStyleTarget());
2457
- const variable = negativePaddingVariableForProperty(property);
2458
- if (!selected || !variable || !value.startsWith("-")) {
2441
+ if (!selected || !property.startsWith("padding-") || !value.startsWith("-")) {
2459
2442
  return;
2460
2443
  }
2461
2444
  const unit = readStylePanelValue(property)?.querySelector("select")?.value.trim() || "px";
2462
- const amount = Math.abs(Number.parseFloat(value));
2463
- if (!Number.isFinite(amount) || amount <= 0) {
2464
- clearNegativePaddingForProperty(selected, property);
2445
+ const base = cssPixelValue(`${baseValue}${unit}`) ?? cssPixelValue(baseValue) ?? 0;
2446
+ const adjustment = Number.parseFloat(value);
2447
+ if (!Number.isFinite(adjustment)) {
2465
2448
  return;
2466
2449
  }
2467
- const styleValue = `${Number.isInteger(amount) ? amount : Number(amount.toFixed(2))}${unit}`;
2450
+ const next = Math.max(0, base + adjustment);
2451
+ const styleValue = `${Number.isInteger(next) ? next : Number(next.toFixed(2))}${unit}`;
2468
2452
  selectedComponentRef.current = selected;
2469
2453
  lastSelectedComponentRef.current = selected;
2470
- selected.addClass?.("orion-builder-v2-has-negative-padding");
2471
- selected.addStyle?.({ [variable]: styleValue });
2454
+ selected.addStyle?.({ [property]: styleValue });
2472
2455
  editorRef.current?.select?.(selected);
2473
2456
  };
2474
2457
  const updateSelectedOrionBlock = (updates) => {
@@ -3549,7 +3532,7 @@ function GrapesPageEditor({
3549
3532
  const onStylePanelInput = (event) => {
3550
3533
  const target = event.target;
3551
3534
  if (target?.closest("#orion-builder-v2-styles")) {
3552
- if (target?.dataset?.orionRawValue?.startsWith("-")) {
3535
+ if (target?.dataset?.orionPaddingDraft?.startsWith("-")) {
3553
3536
  return;
3554
3537
  }
3555
3538
  const activeElement = document.activeElement;
@@ -3611,7 +3594,7 @@ function GrapesPageEditor({
3611
3594
  if (!detail.property || !detail.value) {
3612
3595
  return;
3613
3596
  }
3614
- applyNegativePaddingInput(detail.property, detail.value);
3597
+ applyNegativePaddingInput(detail.property, detail.value, detail.baseValue || "0");
3615
3598
  };
3616
3599
  const observer = new MutationObserver(() => {
3617
3600
  decorateBuilderControls();
@@ -2385,14 +2385,6 @@
2385
2385
  letter-spacing: 0;
2386
2386
  }
2387
2387
 
2388
- .orion-builder-v2-has-negative-padding > .xo-builder-preview,
2389
- .orion-builder-v2-runtime .orion-builder-v2-has-negative-padding > * {
2390
- margin-top: calc(var(--orion-builder-negative-padding-top, 0px) * -1) !important;
2391
- margin-right: calc(var(--orion-builder-negative-padding-right, 0px) * -1) !important;
2392
- margin-bottom: calc(var(--orion-builder-negative-padding-bottom, 0px) * -1) !important;
2393
- margin-left: calc(var(--orion-builder-negative-padding-left, 0px) * -1) !important;
2394
- }
2395
-
2396
2388
  .xo-builder-preview *,
2397
2389
  .xo-builder-preview *::before,
2398
2390
  .xo-builder-preview *::after {
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  admin_exports
3
3
  } from "./chunk-KHK6RTGC.mjs";
4
- import {
5
- blocks_exports
6
- } from "./chunk-JQAHXYAM.mjs";
7
4
  import {
8
5
  nextjs_exports
9
6
  } from "./chunk-ZADL33R6.mjs";
10
7
  import "./chunk-ZTXJG4K5.mjs";
8
+ import {
9
+ blocks_exports
10
+ } from "./chunk-JQAHXYAM.mjs";
11
11
  import {
12
12
  studio_pages_exports
13
- } from "./chunk-NGLIA2OE.mjs";
14
- import "./chunk-OQSEJXC4.mjs";
13
+ } from "./chunk-276KAPGM.mjs";
15
14
  import "./chunk-7ZMXZRBP.mjs";
15
+ import "./chunk-OQSEJXC4.mjs";
16
16
  import {
17
17
  studio_exports
18
18
  } from "./chunk-ADIIWIYL.mjs";
@@ -7,14 +7,14 @@ import {
7
7
  pageStudioModuleManifest,
8
8
  resolveBuilderThemeTokens,
9
9
  toEditorInitialDoc
10
- } from "../chunk-NGLIA2OE.mjs";
11
- import "../chunk-OQSEJXC4.mjs";
10
+ } from "../chunk-276KAPGM.mjs";
12
11
  import {
13
12
  createDefaultStudioDocument,
14
13
  defaultBuilderThemeTokens,
15
14
  layoutToStudioDocument,
16
15
  studioDocumentToLayout
17
16
  } from "../chunk-7ZMXZRBP.mjs";
17
+ import "../chunk-OQSEJXC4.mjs";
18
18
  import "../chunk-ADIIWIYL.mjs";
19
19
  import "../chunk-6BWS3CLP.mjs";
20
20
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.163",
3
+ "version": "0.6.0-beta.165",
4
4
  "description": "Base CMS, builder, and custom admin toolkit for Orion Studios websites",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,3 @@
1
- import {
2
- sectionStyleDefaults
3
- } from "./chunk-OQSEJXC4.mjs";
4
1
  import {
5
2
  createDefaultStudioDocument,
6
3
  defaultBuilderThemeTokens,
@@ -8,6 +5,9 @@ import {
8
5
  migrateBlockToSettingsV2,
9
6
  studioDocumentToLayout
10
7
  } from "./chunk-7ZMXZRBP.mjs";
8
+ import {
9
+ sectionStyleDefaults
10
+ } from "./chunk-OQSEJXC4.mjs";
11
11
  import {
12
12
  assertStudioDocumentV1,
13
13
  compileStudioDocument,