@haklex/rich-litexml-cli 0.36.0 → 0.37.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/cli.mjs +94 -38
- package/package.json +6 -6
package/dist/cli.mjs
CHANGED
|
@@ -149,7 +149,7 @@ function renderJson(state, compact) {
|
|
|
149
149
|
return JSON.stringify(state, null, compact ? 0 : 2);
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
|
-
//#region \0@oxc-project+runtime@0.
|
|
152
|
+
//#region \0@oxc-project+runtime@0.146.0/helpers/esm/typeof.js
|
|
153
153
|
function _typeof(o) {
|
|
154
154
|
"@babel/helpers - typeof";
|
|
155
155
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -159,7 +159,7 @@ function _typeof(o) {
|
|
|
159
159
|
}, _typeof(o);
|
|
160
160
|
}
|
|
161
161
|
//#endregion
|
|
162
|
-
//#region \0@oxc-project+runtime@0.
|
|
162
|
+
//#region \0@oxc-project+runtime@0.146.0/helpers/esm/toPrimitive.js
|
|
163
163
|
function toPrimitive(t, r) {
|
|
164
164
|
if ("object" != _typeof(t) || !t) return t;
|
|
165
165
|
var e = t[Symbol.toPrimitive];
|
|
@@ -171,13 +171,13 @@ function toPrimitive(t, r) {
|
|
|
171
171
|
return ("string" === r ? String : Number)(t);
|
|
172
172
|
}
|
|
173
173
|
//#endregion
|
|
174
|
-
//#region \0@oxc-project+runtime@0.
|
|
174
|
+
//#region \0@oxc-project+runtime@0.146.0/helpers/esm/toPropertyKey.js
|
|
175
175
|
function toPropertyKey(t) {
|
|
176
176
|
var i = toPrimitive(t, "string");
|
|
177
177
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
178
178
|
}
|
|
179
179
|
//#endregion
|
|
180
|
-
//#region \0@oxc-project+runtime@0.
|
|
180
|
+
//#region \0@oxc-project+runtime@0.146.0/helpers/esm/defineProperty.js
|
|
181
181
|
function _defineProperty(e, r, t) {
|
|
182
182
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
183
183
|
value: t,
|
|
@@ -235,6 +235,10 @@ var M = 6;
|
|
|
235
235
|
var A = a || l || d ? "\xA0" : "";
|
|
236
236
|
var D = "\n\n";
|
|
237
237
|
var F = i ? "\xA0" : A;
|
|
238
|
+
var P = "֑-߿יִ-﷽ﹰ-ﻼ";
|
|
239
|
+
var I = "A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--";
|
|
240
|
+
new RegExp("^[^" + I + "]*[" + P + "]");
|
|
241
|
+
new RegExp("^[^" + P + "]*[" + I + "]");
|
|
238
242
|
var z = {
|
|
239
243
|
bold: 1,
|
|
240
244
|
capitalize: 1024,
|
|
@@ -10935,6 +10939,21 @@ var VideoNode = headlessDecorator("video", [
|
|
|
10935
10939
|
width: void 0,
|
|
10936
10940
|
height: void 0
|
|
10937
10941
|
});
|
|
10942
|
+
var FileNode = headlessDecorator("file", [
|
|
10943
|
+
"src",
|
|
10944
|
+
"name",
|
|
10945
|
+
"size",
|
|
10946
|
+
"mimeType",
|
|
10947
|
+
"ext",
|
|
10948
|
+
"display"
|
|
10949
|
+
], {
|
|
10950
|
+
src: "",
|
|
10951
|
+
name: "",
|
|
10952
|
+
size: void 0,
|
|
10953
|
+
mimeType: void 0,
|
|
10954
|
+
ext: void 0,
|
|
10955
|
+
display: "block"
|
|
10956
|
+
});
|
|
10938
10957
|
var LinkCardNode = headlessDecorator("link-card", [
|
|
10939
10958
|
"url",
|
|
10940
10959
|
"source",
|
|
@@ -11031,6 +11050,7 @@ var customHeadlessNodes = [
|
|
|
11031
11050
|
RichQuoteNode,
|
|
11032
11051
|
ImageNode,
|
|
11033
11052
|
VideoNode,
|
|
11053
|
+
FileNode,
|
|
11034
11054
|
LinkCardNode,
|
|
11035
11055
|
KaTeXInlineNode,
|
|
11036
11056
|
KaTeXBlockNode,
|
|
@@ -12412,9 +12432,10 @@ var Tokenizer = class {
|
|
|
12412
12432
|
handleTrailingData() {
|
|
12413
12433
|
const endIndex = this.buffer.length + this.offset;
|
|
12414
12434
|
if (this.sectionStart >= endIndex) return;
|
|
12415
|
-
if (this.state === State.InCommentLike)
|
|
12416
|
-
|
|
12417
|
-
|
|
12435
|
+
if (this.state === State.InCommentLike) {
|
|
12436
|
+
if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, endIndex, 0);
|
|
12437
|
+
else this.cbs.oncomment(this.sectionStart, endIndex, 0);
|
|
12438
|
+
} else if (this.state === State.InTagName || this.state === State.BeforeAttributeName || this.state === State.BeforeAttributeValue || this.state === State.AfterAttributeName || this.state === State.InAttributeName || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueDq || this.state === State.InAttributeValueNq || this.state === State.InClosingTagName) {} else this.cbs.ontext(this.sectionStart, endIndex);
|
|
12418
12439
|
}
|
|
12419
12440
|
emitCodePoint(cp, consumed) {
|
|
12420
12441
|
if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
|
|
@@ -16094,19 +16115,21 @@ function parseSelector(subselects, selector, selectorIndex) {
|
|
|
16094
16115
|
break;
|
|
16095
16116
|
}
|
|
16096
16117
|
let data = null;
|
|
16097
|
-
if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis)
|
|
16098
|
-
if (
|
|
16099
|
-
|
|
16100
|
-
|
|
16101
|
-
|
|
16102
|
-
|
|
16103
|
-
|
|
16104
|
-
|
|
16105
|
-
|
|
16106
|
-
|
|
16107
|
-
|
|
16118
|
+
if (selector.charCodeAt(selectorIndex) === CharCode.LeftParenthesis) {
|
|
16119
|
+
if (unpackPseudos.has(name)) {
|
|
16120
|
+
if (isQuote(selector.charCodeAt(selectorIndex + 1))) throw new Error(`Pseudo-selector ${name} cannot be quoted`);
|
|
16121
|
+
data = [];
|
|
16122
|
+
selectorIndex = parseSelector(data, selector, selectorIndex + 1);
|
|
16123
|
+
if (selector.charCodeAt(selectorIndex) !== CharCode.RightParenthesis) throw new Error(`Missing closing parenthesis in :${name} (${selector})`);
|
|
16124
|
+
selectorIndex += 1;
|
|
16125
|
+
} else {
|
|
16126
|
+
data = readValueWithParenthesis();
|
|
16127
|
+
if (stripQuotesFromPseudos.has(name)) {
|
|
16128
|
+
const quot = data.charCodeAt(0);
|
|
16129
|
+
if (quot === data.charCodeAt(data.length - 1) && isQuote(quot)) data = data.slice(1, -1);
|
|
16130
|
+
}
|
|
16131
|
+
data = unescapeCSS(data);
|
|
16108
16132
|
}
|
|
16109
|
-
data = unescapeCSS(data);
|
|
16110
16133
|
}
|
|
16111
16134
|
tokens.push({
|
|
16112
16135
|
type: SelectorType.Pseudo,
|
|
@@ -21013,9 +21036,10 @@ var require_CSSValueExpression = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21013
21036
|
expression += character;
|
|
21014
21037
|
break;
|
|
21015
21038
|
case "/":
|
|
21016
|
-
if (info = this._parseJSComment(token, idx))
|
|
21017
|
-
|
|
21018
|
-
|
|
21039
|
+
if (info = this._parseJSComment(token, idx)) {
|
|
21040
|
+
if (info.error) error = "css expression error: unfinished comment in expression!";
|
|
21041
|
+
else idx = info.idx;
|
|
21042
|
+
} else if (info = this._parseJSRexExp(token, idx)) {
|
|
21019
21043
|
idx = info.idx;
|
|
21020
21044
|
expression += info.text;
|
|
21021
21045
|
} else expression += character;
|
|
@@ -21455,19 +21479,20 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
21455
21479
|
} else buffer += character;
|
|
21456
21480
|
break;
|
|
21457
21481
|
case "(":
|
|
21458
|
-
if (state === "value")
|
|
21459
|
-
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21482
|
+
if (state === "value") {
|
|
21483
|
+
if (buffer.trim() === "expression") {
|
|
21484
|
+
var info = new CSSOM.CSSValueExpression(token, i).parse();
|
|
21485
|
+
if (info.error) parseError(info.error);
|
|
21486
|
+
else {
|
|
21487
|
+
buffer += info.expression;
|
|
21488
|
+
i = info.idx;
|
|
21489
|
+
}
|
|
21490
|
+
} else {
|
|
21491
|
+
state = "value-parenthesis";
|
|
21492
|
+
valueParenthesisDepth = 1;
|
|
21493
|
+
buffer += character;
|
|
21464
21494
|
}
|
|
21465
|
-
} else {
|
|
21466
|
-
state = "value-parenthesis";
|
|
21467
|
-
valueParenthesisDepth = 1;
|
|
21468
|
-
buffer += character;
|
|
21469
|
-
}
|
|
21470
|
-
else if (state === "value-parenthesis") {
|
|
21495
|
+
} else if (state === "value-parenthesis") {
|
|
21471
21496
|
valueParenthesisDepth++;
|
|
21472
21497
|
buffer += character;
|
|
21473
21498
|
} else buffer += character;
|
|
@@ -23783,6 +23808,17 @@ function registerCustomReaders(registry) {
|
|
|
23783
23808
|
height: numAttr(el, "height"),
|
|
23784
23809
|
version: 1
|
|
23785
23810
|
}));
|
|
23811
|
+
registry.registerReader("attachment", (el) => ({
|
|
23812
|
+
type: "file",
|
|
23813
|
+
...extractBlockId(el),
|
|
23814
|
+
src: el.getAttribute("src") ?? "",
|
|
23815
|
+
name: el.getAttribute("name") ?? "",
|
|
23816
|
+
size: numAttr(el, "size"),
|
|
23817
|
+
mimeType: el.getAttribute("mime-type") ?? void 0,
|
|
23818
|
+
ext: el.getAttribute("ext") ?? void 0,
|
|
23819
|
+
display: el.getAttribute("display") === "inline" ? "inline" : "block",
|
|
23820
|
+
version: 1
|
|
23821
|
+
}));
|
|
23786
23822
|
registry.registerReader("link-card", (el) => ({
|
|
23787
23823
|
type: "link-card",
|
|
23788
23824
|
...extractBlockId(el),
|
|
@@ -24269,6 +24305,22 @@ function registerCustomWriters(registry) {
|
|
|
24269
24305
|
selfClosing: true
|
|
24270
24306
|
};
|
|
24271
24307
|
});
|
|
24308
|
+
registry.registerWriter("file", (node) => {
|
|
24309
|
+
const n = node;
|
|
24310
|
+
return {
|
|
24311
|
+
tag: "attachment",
|
|
24312
|
+
attrs: optAttr({
|
|
24313
|
+
...blockId(n),
|
|
24314
|
+
"src": n.src,
|
|
24315
|
+
"name": n.name,
|
|
24316
|
+
"size": n.size != null ? String(n.size) : void 0,
|
|
24317
|
+
"mime-type": n.mimeType,
|
|
24318
|
+
"ext": n.ext,
|
|
24319
|
+
"display": n.display === "inline" ? "inline" : void 0
|
|
24320
|
+
}),
|
|
24321
|
+
selfClosing: true
|
|
24322
|
+
};
|
|
24323
|
+
});
|
|
24272
24324
|
registry.registerWriter("link-card", (node) => {
|
|
24273
24325
|
const n = node;
|
|
24274
24326
|
return {
|
|
@@ -24752,8 +24804,10 @@ function createReaderContext(registry) {
|
|
|
24752
24804
|
else if (child.nodeType === 1) {
|
|
24753
24805
|
flushText();
|
|
24754
24806
|
const parsed = parseElement(child, registry, ctx, 0);
|
|
24755
|
-
if (parsed)
|
|
24756
|
-
|
|
24807
|
+
if (parsed) {
|
|
24808
|
+
if (Array.isArray(parsed)) nodes.push(...parsed);
|
|
24809
|
+
else nodes.push(parsed);
|
|
24810
|
+
}
|
|
24757
24811
|
}
|
|
24758
24812
|
flushText();
|
|
24759
24813
|
return nodes;
|
|
@@ -24791,8 +24845,10 @@ function parseInlineChildren(element, registry, ctx, format) {
|
|
|
24791
24845
|
else if (child.nodeType === 1) {
|
|
24792
24846
|
flushText();
|
|
24793
24847
|
const parsed = parseElement(child, registry, ctx, format);
|
|
24794
|
-
if (parsed)
|
|
24795
|
-
|
|
24848
|
+
if (parsed) {
|
|
24849
|
+
if (Array.isArray(parsed)) nodes.push(...parsed);
|
|
24850
|
+
else nodes.push(parsed);
|
|
24851
|
+
}
|
|
24796
24852
|
}
|
|
24797
24853
|
flushText();
|
|
24798
24854
|
return nodes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-litexml-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "Unified CLI for haklex LiteXML: convert LiteXML or Lexical JSON to HTML, JSON, or Markdown.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@lexical/headless": "^0.49.0",
|
|
20
20
|
"lexical": "^0.49.0",
|
|
21
|
-
"@haklex/rich-
|
|
22
|
-
"@haklex/rich-headless": "0.
|
|
23
|
-
"@haklex/rich-
|
|
21
|
+
"@haklex/rich-litexml": "0.37.0",
|
|
22
|
+
"@haklex/rich-headless": "0.37.0",
|
|
23
|
+
"@haklex/rich-compose": "0.37.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "26.1.0",
|
|
27
27
|
"typescript": "^7.0.2",
|
|
28
|
-
"vite": "^8.2.
|
|
29
|
-
"vitest": "^4.1.
|
|
28
|
+
"vite": "^8.2.2",
|
|
29
|
+
"vitest": "^4.1.11"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|