@haklex/rich-litexml 0.35.0 → 0.36.0

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/browser.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as createDefaultRegistry, c as LitexmlRegistry, d as registerParseHTML, i as deserializeNodesFromXml, l as registerCustomReaders, n as serializeToXml, o as registerCustomWriters, r as deserializeFromXml, s as registerBuiltinWriters, t as serializeNodesToXml, u as registerBuiltinReaders } from "./src-BeDSuguH.js";
1
+ import { a as createDefaultRegistry, c as LitexmlRegistry, d as registerParseHTML, i as deserializeNodesFromXml, l as registerCustomReaders, n as serializeToXml, o as registerCustomWriters, r as deserializeFromXml, s as registerBuiltinWriters, t as serializeNodesToXml, u as registerBuiltinReaders } from "./src-DKDBBSml.js";
2
2
  //#region src/index-browser.ts
3
3
  registerParseHTML((html) => new DOMParser().parseFromString(html, "text/html"));
4
4
  //#endregion
package/dist/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as createDefaultRegistry, c as LitexmlRegistry, d as registerParseHTML, i as deserializeNodesFromXml, l as registerCustomReaders, n as serializeToXml, o as registerCustomWriters, r as deserializeFromXml, s as registerBuiltinWriters, t as serializeNodesToXml, u as registerBuiltinReaders } from "./src-BeDSuguH.js";
1
+ import { a as createDefaultRegistry, c as LitexmlRegistry, d as registerParseHTML, i as deserializeNodesFromXml, l as registerCustomReaders, n as serializeToXml, o as registerCustomWriters, r as deserializeFromXml, s as registerBuiltinWriters, t as serializeNodesToXml, u as registerBuiltinReaders } from "./src-DKDBBSml.js";
2
2
  import { parseHTML } from "linkedom";
3
3
  //#region src/index-node.ts
4
4
  registerParseHTML((html) => parseHTML(html).document);
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/readers/custom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuEnD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CA6erE"}
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/readers/custom.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA0FnD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CA6erE"}
@@ -168,6 +168,19 @@ function imageDisplayWidthAttr(el) {
168
168
  const v = numAttr(el, "display-width");
169
169
  return v !== void 0 && Number.isFinite(v) && v >= 10 && v <= 100 ? v : void 0;
170
170
  }
171
+ function imageFixedPxAttr(el, name) {
172
+ const v = numAttr(el, name);
173
+ return v !== void 0 && Number.isFinite(v) && v > 0 ? Math.round(v) : void 0;
174
+ }
175
+ function exclusiveImageDisplayAttrs(el) {
176
+ const displayWidth = imageDisplayWidthAttr(el);
177
+ if (displayWidth !== void 0) return { displayWidth };
178
+ const fixedWidth = imageFixedPxAttr(el, "fixed-width");
179
+ if (fixedWidth !== void 0) return { fixedWidth };
180
+ const fixedHeight = imageFixedPxAttr(el, "fixed-height");
181
+ if (fixedHeight !== void 0) return { fixedHeight };
182
+ return {};
183
+ }
171
184
  function imageLayoutAttr(el) {
172
185
  const v = el.getAttribute("layout");
173
186
  return v !== null && IMAGE_LAYOUTS.has(v) ? v : void 0;
@@ -220,7 +233,7 @@ function registerCustomReaders(registry) {
220
233
  caption: el.getAttribute("caption") ?? void 0,
221
234
  thumbhash: el.getAttribute("thumbhash") ?? void 0,
222
235
  accent: el.getAttribute("accent") ?? void 0,
223
- displayWidth: imageDisplayWidthAttr(el),
236
+ ...exclusiveImageDisplayAttrs(el),
224
237
  layout: imageLayoutAttr(el),
225
238
  version: 1
226
239
  };
@@ -701,6 +714,8 @@ function registerCustomWriters(registry) {
701
714
  "thumbhash": n.thumbhash,
702
715
  "accent": n.accent,
703
716
  "display-width": n.displayWidth != null ? String(n.displayWidth) : void 0,
717
+ "fixed-width": n.fixedWidth != null ? String(n.fixedWidth) : void 0,
718
+ "fixed-height": n.fixedHeight != null ? String(n.fixedHeight) : void 0,
704
719
  "layout": n.layout
705
720
  }),
706
721
  selfClosing: true
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/writers/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAenD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAiWrE"}
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../src/writers/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAenD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAmWrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-litexml",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Bidirectional Lexical SerializedNode <-> XML conversion with plugin registry",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,12 +32,12 @@
32
32
  "dependencies": {
33
33
  "lexical": "^0.49.0",
34
34
  "linkedom": "^0.18.13",
35
- "nanoid": "^6.0.0"
35
+ "nanoid": "^6.0.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "typescript": "^7.0.2",
39
39
  "unplugin-dts": "^1.0.3",
40
- "vite": "^8.2.0"
40
+ "vite": "^8.2.1"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"