@scrider/formatter 1.3.7 → 1.4.1

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.
package/dist/index.d.cts CHANGED
@@ -1293,18 +1293,24 @@ declare function validateDelta(delta: Delta, registry: Registry): boolean;
1293
1293
  declare function cloneDelta(delta: Delta): Delta;
1294
1294
 
1295
1295
  /**
1296
+
1296
1297
  * Document-level HTML presentation for deltaToHtml (clipboard, export).
1297
- * Not stored in Delta — mirrors editor Settings (line spacing, first-line indent).
1298
+
1299
+ * Not stored in Delta — mirrors editor Settings (line spacing, indents).
1300
+
1298
1301
  */
1299
1302
  interface DocumentPresentation {
1300
1303
  /** Line spacing multiplier, e.g. 1.5 */
1301
1304
  lineSpacing?: number;
1302
- /** First-line indent in centimeters, e.g. 1.25 */
1305
+ /** First-line indent in cm on `<p>` only (lists: use listBlockIndentCm). */
1303
1306
  textIndentCm?: number;
1307
+ /** Extra left padding on top-level `<ul>`/`<ol>` — shifts marker + text as a block. */
1308
+ listBlockIndentCm?: number;
1304
1309
  }
1305
1310
  interface ResolvedDocumentPresentation {
1306
1311
  lineSpacing: number | undefined;
1307
1312
  textIndentCm: number | undefined;
1313
+ listBlockIndentCm: number | undefined;
1308
1314
  }
1309
1315
  declare function resolveDocumentPresentation(presentation?: DocumentPresentation): ResolvedDocumentPresentation | undefined;
1310
1316
  declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
package/dist/index.d.ts CHANGED
@@ -1293,18 +1293,24 @@ declare function validateDelta(delta: Delta, registry: Registry): boolean;
1293
1293
  declare function cloneDelta(delta: Delta): Delta;
1294
1294
 
1295
1295
  /**
1296
+
1296
1297
  * Document-level HTML presentation for deltaToHtml (clipboard, export).
1297
- * Not stored in Delta — mirrors editor Settings (line spacing, first-line indent).
1298
+
1299
+ * Not stored in Delta — mirrors editor Settings (line spacing, indents).
1300
+
1298
1301
  */
1299
1302
  interface DocumentPresentation {
1300
1303
  /** Line spacing multiplier, e.g. 1.5 */
1301
1304
  lineSpacing?: number;
1302
- /** First-line indent in centimeters, e.g. 1.25 */
1305
+ /** First-line indent in cm on `<p>` only (lists: use listBlockIndentCm). */
1303
1306
  textIndentCm?: number;
1307
+ /** Extra left padding on top-level `<ul>`/`<ol>` — shifts marker + text as a block. */
1308
+ listBlockIndentCm?: number;
1304
1309
  }
1305
1310
  interface ResolvedDocumentPresentation {
1306
1311
  lineSpacing: number | undefined;
1307
1312
  textIndentCm: number | undefined;
1313
+ listBlockIndentCm: number | undefined;
1308
1314
  }
1309
1315
  declare function resolveDocumentPresentation(presentation?: DocumentPresentation): ResolvedDocumentPresentation | undefined;
1310
1316
  declare function documentPresentationStyleParts(tag: string, resolved: ResolvedDocumentPresentation | undefined): string[];
package/dist/index.js CHANGED
@@ -2498,14 +2498,20 @@ function resolveDocumentPresentation(presentation) {
2498
2498
  if (!presentation) return void 0;
2499
2499
  const lineSpacing = typeof presentation.lineSpacing === "number" && presentation.lineSpacing > 0 ? presentation.lineSpacing : void 0;
2500
2500
  const textIndentCm = typeof presentation.textIndentCm === "number" && presentation.textIndentCm > 0 ? presentation.textIndentCm : void 0;
2501
- if (lineSpacing === void 0 && textIndentCm === void 0) return void 0;
2502
- return { lineSpacing, textIndentCm };
2501
+ const listBlockIndentCm = typeof presentation.listBlockIndentCm === "number" && presentation.listBlockIndentCm > 0 ? presentation.listBlockIndentCm : void 0;
2502
+ if (lineSpacing === void 0 && textIndentCm === void 0 && listBlockIndentCm === void 0) {
2503
+ return void 0;
2504
+ }
2505
+ return { lineSpacing, textIndentCm, listBlockIndentCm };
2503
2506
  }
2504
2507
  var LINE_HEIGHT_TAGS = /* @__PURE__ */ new Set(["p", "li", "blockquote"]);
2505
2508
  var TEXT_INDENT_TAGS = /* @__PURE__ */ new Set(["p"]);
2506
2509
  function documentPresentationListWrapperStyleParts(resolved) {
2507
- if (!resolved?.textIndentCm) return [];
2508
- return [`padding-left:calc(1.5em + ${resolved.textIndentCm}cm)`];
2510
+ if (!resolved?.listBlockIndentCm) return [];
2511
+ return [
2512
+ `padding-left:1.25em`,
2513
+ `margin-left:${resolved.listBlockIndentCm}cm`
2514
+ ];
2509
2515
  }
2510
2516
  function documentPresentationStyleParts(tag, resolved) {
2511
2517
  if (!resolved) return [];