@orion-studios/payload-studio 0.6.0-beta.112 → 0.6.0-beta.113

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.
@@ -1511,6 +1511,37 @@ var readStylePanelColor = (property) => {
1511
1511
  return swatchColor;
1512
1512
  };
1513
1513
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1514
+ var writeStylePanelLength = (property, value) => {
1515
+ const control = readStylePanelValue(property);
1516
+ const input = control?.querySelector("input");
1517
+ if (!input) {
1518
+ return;
1519
+ }
1520
+ const match = value.trim().match(/^(-?\d*\.?\d+)([a-z%]*)$/i);
1521
+ if (!match) {
1522
+ return;
1523
+ }
1524
+ const [, amount, unit = "px"] = match;
1525
+ const unitSelect = control?.querySelector("select");
1526
+ input.value = amount;
1527
+ if (unitSelect) {
1528
+ unitSelect.value = unit || "px";
1529
+ }
1530
+ };
1531
+ var spacingProperties = [
1532
+ "margin-top",
1533
+ "margin-bottom",
1534
+ "margin-left",
1535
+ "margin-right",
1536
+ "padding-top",
1537
+ "padding-bottom",
1538
+ "padding-left",
1539
+ "padding-right"
1540
+ ];
1541
+ var spacingTargetForComponent = (component) => {
1542
+ const element = component?.getEl?.();
1543
+ return element?.querySelector?.(".xo-builder-preview") || element || null;
1544
+ };
1514
1545
  var hasExplicitHorizontalAlign = (block) => {
1515
1546
  const settings = readNestedRecord(block, "settings");
1516
1547
  const typography = readNestedRecord(settings, "typography");
@@ -2264,6 +2295,16 @@ function GrapesPageEditor({
2264
2295
  hydrateSelectedTypographyStyleFromOrionBlock(component);
2265
2296
  rememberComponentSnapshot(component);
2266
2297
  refreshSelectedState(component);
2298
+ window.requestAnimationFrame(() => {
2299
+ const element = spacingTargetForComponent(component);
2300
+ if (!element) {
2301
+ return;
2302
+ }
2303
+ const computed = window.getComputedStyle(element);
2304
+ spacingProperties.forEach((property) => {
2305
+ writeStylePanelLength(property, computed.getPropertyValue(property));
2306
+ });
2307
+ });
2267
2308
  };
2268
2309
  const applyQuickLayout = (layout) => {
2269
2310
  const nextStyle = quickLayoutStyles[layout];
@@ -1387,6 +1387,37 @@ var readStylePanelColor = (property) => {
1387
1387
  return swatchColor;
1388
1388
  };
1389
1389
  var readStylePanelRadio = (property) => (readStylePanelValue(property)?.querySelector("input:checked")?.value || "").trim();
1390
+ var writeStylePanelLength = (property, value) => {
1391
+ const control = readStylePanelValue(property);
1392
+ const input = control?.querySelector("input");
1393
+ if (!input) {
1394
+ return;
1395
+ }
1396
+ const match = value.trim().match(/^(-?\d*\.?\d+)([a-z%]*)$/i);
1397
+ if (!match) {
1398
+ return;
1399
+ }
1400
+ const [, amount, unit = "px"] = match;
1401
+ const unitSelect = control?.querySelector("select");
1402
+ input.value = amount;
1403
+ if (unitSelect) {
1404
+ unitSelect.value = unit || "px";
1405
+ }
1406
+ };
1407
+ var spacingProperties = [
1408
+ "margin-top",
1409
+ "margin-bottom",
1410
+ "margin-left",
1411
+ "margin-right",
1412
+ "padding-top",
1413
+ "padding-bottom",
1414
+ "padding-left",
1415
+ "padding-right"
1416
+ ];
1417
+ var spacingTargetForComponent = (component) => {
1418
+ const element = component?.getEl?.();
1419
+ return element?.querySelector?.(".xo-builder-preview") || element || null;
1420
+ };
1390
1421
  var hasExplicitHorizontalAlign = (block) => {
1391
1422
  const settings = readNestedRecord(block, "settings");
1392
1423
  const typography = readNestedRecord(settings, "typography");
@@ -2140,6 +2171,16 @@ function GrapesPageEditor({
2140
2171
  hydrateSelectedTypographyStyleFromOrionBlock(component);
2141
2172
  rememberComponentSnapshot(component);
2142
2173
  refreshSelectedState(component);
2174
+ window.requestAnimationFrame(() => {
2175
+ const element = spacingTargetForComponent(component);
2176
+ if (!element) {
2177
+ return;
2178
+ }
2179
+ const computed = window.getComputedStyle(element);
2180
+ spacingProperties.forEach((property) => {
2181
+ writeStylePanelLength(property, computed.getPropertyValue(property));
2182
+ });
2183
+ });
2143
2184
  };
2144
2185
  const applyQuickLayout = (layout) => {
2145
2186
  const nextStyle = quickLayoutStyles[layout];
package/dist/index.mjs CHANGED
@@ -5,18 +5,18 @@ import {
5
5
  admin_app_exports
6
6
  } from "./chunk-RKTIFEUY.mjs";
7
7
  import "./chunk-W2UOCJDX.mjs";
8
+ import {
9
+ blocks_exports
10
+ } from "./chunk-JQAHXYAM.mjs";
8
11
  import {
9
12
  nextjs_exports
10
13
  } from "./chunk-ZADL33R6.mjs";
11
14
  import "./chunk-ZTXJG4K5.mjs";
12
- import {
13
- blocks_exports
14
- } from "./chunk-JQAHXYAM.mjs";
15
15
  import {
16
16
  studio_pages_exports
17
- } from "./chunk-276KAPGM.mjs";
18
- import "./chunk-7ZMXZRBP.mjs";
17
+ } from "./chunk-NGLIA2OE.mjs";
19
18
  import "./chunk-OQSEJXC4.mjs";
19
+ import "./chunk-7ZMXZRBP.mjs";
20
20
  import {
21
21
  studio_exports
22
22
  } from "./chunk-ADIIWIYL.mjs";
@@ -7,14 +7,14 @@ import {
7
7
  pageStudioModuleManifest,
8
8
  resolveBuilderThemeTokens,
9
9
  toEditorInitialDoc
10
- } from "../chunk-276KAPGM.mjs";
10
+ } from "../chunk-NGLIA2OE.mjs";
11
+ import "../chunk-OQSEJXC4.mjs";
11
12
  import {
12
13
  createDefaultStudioDocument,
13
14
  defaultBuilderThemeTokens,
14
15
  layoutToStudioDocument,
15
16
  studioDocumentToLayout
16
17
  } 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.112",
3
+ "version": "0.6.0-beta.113",
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,3 +1,6 @@
1
+ import {
2
+ sectionStyleDefaults
3
+ } from "./chunk-OQSEJXC4.mjs";
1
4
  import {
2
5
  createDefaultStudioDocument,
3
6
  defaultBuilderThemeTokens,
@@ -5,9 +8,6 @@ import {
5
8
  migrateBlockToSettingsV2,
6
9
  studioDocumentToLayout
7
10
  } from "./chunk-7ZMXZRBP.mjs";
8
- import {
9
- sectionStyleDefaults
10
- } from "./chunk-OQSEJXC4.mjs";
11
11
  import {
12
12
  assertStudioDocumentV1,
13
13
  compileStudioDocument,