@haklex/rich-litexml 0.32.0 → 0.34.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-
|
|
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";
|
|
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-
|
|
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";
|
|
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;
|
|
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"}
|
|
@@ -172,6 +172,26 @@ function imageLayoutAttr(el) {
|
|
|
172
172
|
const v = el.getAttribute("layout");
|
|
173
173
|
return v !== null && IMAGE_LAYOUTS.has(v) ? v : void 0;
|
|
174
174
|
}
|
|
175
|
+
var GALLERY_ASPECTS = /* @__PURE__ */ new Set([
|
|
176
|
+
"auto",
|
|
177
|
+
"1:1",
|
|
178
|
+
"4:3",
|
|
179
|
+
"16:9",
|
|
180
|
+
"3:4"
|
|
181
|
+
]);
|
|
182
|
+
var GALLERY_FITS = /* @__PURE__ */ new Set(["cover", "contain"]);
|
|
183
|
+
function galleryAspectAttr(el) {
|
|
184
|
+
const v = el.getAttribute("aspect");
|
|
185
|
+
return v !== null && GALLERY_ASPECTS.has(v) ? v : "auto";
|
|
186
|
+
}
|
|
187
|
+
function galleryFitAttr(el) {
|
|
188
|
+
const v = el.getAttribute("fit");
|
|
189
|
+
return v !== null && GALLERY_FITS.has(v) ? v : "cover";
|
|
190
|
+
}
|
|
191
|
+
function galleryMaxItemHeightAttr(el) {
|
|
192
|
+
const v = numAttr(el, "max-item-height");
|
|
193
|
+
return v !== void 0 && Number.isFinite(v) && v > 0 ? v : void 0;
|
|
194
|
+
}
|
|
175
195
|
/**
|
|
176
196
|
* Extract CDATA text content from an element.
|
|
177
197
|
* linkedom (HTML parser) converts <![CDATA[...]]> to a comment node
|
|
@@ -396,6 +416,9 @@ function registerCustomReaders(registry) {
|
|
|
396
416
|
...extractBlockId(el),
|
|
397
417
|
images,
|
|
398
418
|
layout: el.getAttribute("layout") ?? "grid",
|
|
419
|
+
aspect: galleryAspectAttr(el),
|
|
420
|
+
fit: galleryFitAttr(el),
|
|
421
|
+
maxItemHeight: galleryMaxItemHeightAttr(el),
|
|
399
422
|
version: 1
|
|
400
423
|
};
|
|
401
424
|
});
|
|
@@ -942,7 +965,10 @@ function registerCustomWriters(registry) {
|
|
|
942
965
|
tag: "gallery",
|
|
943
966
|
attrs: optAttr({
|
|
944
967
|
...blockId(n),
|
|
945
|
-
layout: n.layout
|
|
968
|
+
"layout": n.layout,
|
|
969
|
+
"aspect": n.aspect && n.aspect !== "auto" ? n.aspect : void 0,
|
|
970
|
+
"fit": n.fit && n.fit !== "cover" ? n.fit : void 0,
|
|
971
|
+
"max-item-height": n.maxItemHeight != null ? String(n.maxItemHeight) : void 0
|
|
946
972
|
}),
|
|
947
973
|
children: images
|
|
948
974
|
};
|
|
@@ -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,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-litexml",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Bidirectional Lexical SerializedNode <-> XML conversion with plugin registry",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,14 +30,14 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"lexical": "^0.
|
|
33
|
+
"lexical": "^0.49.0",
|
|
34
34
|
"linkedom": "^0.18.13",
|
|
35
35
|
"nanoid": "^6.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"typescript": "^7.0.2",
|
|
39
39
|
"unplugin-dts": "^1.0.3",
|
|
40
|
-
"vite": "^8.
|
|
40
|
+
"vite": "^8.2.0"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|