@orion-studios/payload-studio 0.6.0-beta.155 → 0.6.0-beta.157

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.
@@ -1399,9 +1399,40 @@ var decorateBuilderNumericSteppers = (root = document) => {
1399
1399
  input.type = "text";
1400
1400
  input.inputMode = "decimal";
1401
1401
  field.querySelector("select")?.setAttribute("tabindex", "-1");
1402
+ if (property.startsWith("padding-")) {
1403
+ const keepNegativePaddingValue = (event) => {
1404
+ if (!input.value.trim().startsWith("-")) {
1405
+ return;
1406
+ }
1407
+ event.stopPropagation();
1408
+ };
1409
+ input.addEventListener("input", keepNegativePaddingValue, true);
1410
+ input.addEventListener("change", keepNegativePaddingValue, true);
1411
+ }
1402
1412
  input.addEventListener(
1403
1413
  "keydown",
1404
1414
  (event) => {
1415
+ if (property.startsWith("padding-")) {
1416
+ const selectionStart2 = input.selectionStart ?? 0;
1417
+ const selectionEnd2 = input.selectionEnd ?? selectionStart2;
1418
+ const value2 = input.value || "";
1419
+ const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
1420
+ const isNegativeEntry = value2.startsWith("-") || event.key === "-";
1421
+ if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
1422
+ event.preventDefault();
1423
+ event.stopImmediatePropagation();
1424
+ const inserted = event.key === "-" ? "-" : event.key;
1425
+ const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
1426
+ const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
1427
+ input.value = nextValue2;
1428
+ const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
1429
+ input.setSelectionRange(nextCursor2, nextCursor2);
1430
+ return;
1431
+ }
1432
+ if (value2.startsWith("-") && (event.key === "Backspace" || event.key === "Delete")) {
1433
+ return;
1434
+ }
1435
+ }
1405
1436
  if (event.key !== "-" || event.metaKey || event.ctrlKey || event.altKey) {
1406
1437
  return;
1407
1438
  }
@@ -1275,9 +1275,40 @@ var decorateBuilderNumericSteppers = (root = document) => {
1275
1275
  input.type = "text";
1276
1276
  input.inputMode = "decimal";
1277
1277
  field.querySelector("select")?.setAttribute("tabindex", "-1");
1278
+ if (property.startsWith("padding-")) {
1279
+ const keepNegativePaddingValue = (event) => {
1280
+ if (!input.value.trim().startsWith("-")) {
1281
+ return;
1282
+ }
1283
+ event.stopPropagation();
1284
+ };
1285
+ input.addEventListener("input", keepNegativePaddingValue, true);
1286
+ input.addEventListener("change", keepNegativePaddingValue, true);
1287
+ }
1278
1288
  input.addEventListener(
1279
1289
  "keydown",
1280
1290
  (event) => {
1291
+ if (property.startsWith("padding-")) {
1292
+ const selectionStart2 = input.selectionStart ?? 0;
1293
+ const selectionEnd2 = input.selectionEnd ?? selectionStart2;
1294
+ const value2 = input.value || "";
1295
+ const isReplacingAll = selectionStart2 === 0 && selectionEnd2 === value2.length;
1296
+ const isNegativeEntry = value2.startsWith("-") || event.key === "-";
1297
+ if (isNegativeEntry && event.key.length === 1 && /^[-.\d]$/.test(event.key)) {
1298
+ event.preventDefault();
1299
+ event.stopImmediatePropagation();
1300
+ const inserted = event.key === "-" ? "-" : event.key;
1301
+ const rawValue = value2.startsWith("-") && event.key === "-" && selectionStart2 === 0 && selectionEnd2 <= 1 ? value2.slice(1) : isReplacingAll ? inserted : `${value2.slice(0, selectionStart2)}${inserted}${value2.slice(selectionEnd2)}`;
1302
+ const nextValue2 = rawValue.replace(/(?!^)-/g, "").replace(/^(-?[^.]*\.).*\./, "$1");
1303
+ input.value = nextValue2;
1304
+ const nextCursor2 = Math.min((isReplacingAll ? 0 : selectionStart2) + inserted.length, nextValue2.length);
1305
+ input.setSelectionRange(nextCursor2, nextCursor2);
1306
+ return;
1307
+ }
1308
+ if (value2.startsWith("-") && (event.key === "Backspace" || event.key === "Delete")) {
1309
+ return;
1310
+ }
1311
+ }
1281
1312
  if (event.key !== "-" || event.metaKey || event.ctrlKey || event.altKey) {
1282
1313
  return;
1283
1314
  }
package/dist/index.mjs CHANGED
@@ -10,12 +10,12 @@ import {
10
10
  } from "./chunk-JQAHXYAM.mjs";
11
11
  import {
12
12
  studio_pages_exports
13
- } from "./chunk-276KAPGM.mjs";
13
+ } from "./chunk-7HME6R2V.mjs";
14
14
  import "./chunk-7ZMXZRBP.mjs";
15
- import "./chunk-OQSEJXC4.mjs";
16
15
  import {
17
16
  studio_exports
18
17
  } from "./chunk-ADIIWIYL.mjs";
18
+ import "./chunk-OQSEJXC4.mjs";
19
19
  import {
20
20
  admin_app_exports
21
21
  } from "./chunk-RKTIFEUY.mjs";
@@ -7,15 +7,15 @@ import {
7
7
  pageStudioModuleManifest,
8
8
  resolveBuilderThemeTokens,
9
9
  toEditorInitialDoc
10
- } from "../chunk-276KAPGM.mjs";
10
+ } from "../chunk-7HME6R2V.mjs";
11
11
  import {
12
12
  createDefaultStudioDocument,
13
13
  defaultBuilderThemeTokens,
14
14
  layoutToStudioDocument,
15
15
  studioDocumentToLayout
16
16
  } from "../chunk-7ZMXZRBP.mjs";
17
- import "../chunk-OQSEJXC4.mjs";
18
17
  import "../chunk-ADIIWIYL.mjs";
18
+ import "../chunk-OQSEJXC4.mjs";
19
19
  import "../chunk-6BWS3CLP.mjs";
20
20
  export {
21
21
  createDefaultStudioDocument,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.6.0-beta.155",
3
+ "version": "0.6.0-beta.157",
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",
@@ -5,15 +5,15 @@ import {
5
5
  migrateBlockToSettingsV2,
6
6
  studioDocumentToLayout
7
7
  } from "./chunk-7ZMXZRBP.mjs";
8
- import {
9
- sectionStyleDefaults
10
- } from "./chunk-OQSEJXC4.mjs";
11
8
  import {
12
9
  assertStudioDocumentV1,
13
10
  compileStudioDocument,
14
11
  createEmptyStudioDocument,
15
12
  validateStudioDocument
16
13
  } from "./chunk-ADIIWIYL.mjs";
14
+ import {
15
+ sectionStyleDefaults
16
+ } from "./chunk-OQSEJXC4.mjs";
17
17
  import {
18
18
  __export
19
19
  } from "./chunk-6BWS3CLP.mjs";