@haklex/rich-litexml-cli 0.52.0 → 0.53.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +96 -0
  2. package/package.json +4 -4
package/dist/cli.mjs CHANGED
@@ -11762,6 +11762,16 @@ var GRID_CONTAINER_BLOCK_TRANSFORMER = {
11762
11762
  replace: NOOP,
11763
11763
  type: "element"
11764
11764
  };
11765
+ var STEPS_BLOCK_TRANSFORMER = {
11766
+ dependencies: [],
11767
+ export: (node) => {
11768
+ if (node.getType() !== "steps") return null;
11769
+ return `::: steps\n${(node.exportJSON().steps ?? []).map((s) => `::: step{title="${qA(String(s.title ?? ""))}"}\n${stateText(s.content)}\n:::`).join("\n")}\n:::`;
11770
+ },
11771
+ regExp: NEVER,
11772
+ replace: NOOP,
11773
+ type: "element"
11774
+ };
11765
11775
  var HORIZONTAL_RULE_BLOCK_TRANSFORMER = {
11766
11776
  dependencies: [],
11767
11777
  export: (node) => node.getType() === "horizontalrule" ? "---" : null,
@@ -11889,6 +11899,7 @@ var allHeadlessTransformers = [
11889
11899
  CHART_BLOCK_TRANSFORMER,
11890
11900
  NESTED_DOC_BLOCK_TRANSFORMER,
11891
11901
  GRID_CONTAINER_BLOCK_TRANSFORMER,
11902
+ STEPS_BLOCK_TRANSFORMER,
11892
11903
  HORIZONTAL_RULE_BLOCK_TRANSFORMER,
11893
11904
  TABLE_BLOCK_TRANSFORMER,
11894
11905
  CODE_SNIPPET_BLOCK_TRANSFORMER,
@@ -12498,6 +12509,48 @@ var customHeadlessNodes = [
12498
12509
  return this.__cells.map((cell) => extractText(cell)).join("\n");
12499
12510
  }
12500
12511
  },
12512
+ class StepsNode extends xl {
12513
+ static getType() {
12514
+ return "steps";
12515
+ }
12516
+ constructor(key) {
12517
+ super(key);
12518
+ this.__steps = [];
12519
+ }
12520
+ static clone(node) {
12521
+ const n = new StepsNode(node.__key);
12522
+ n.__steps = node.__steps;
12523
+ return n;
12524
+ }
12525
+ static importJSON(_json) {
12526
+ const node = new StepsNode();
12527
+ node.__steps = Array.isArray(_json.steps) ? _json.steps : [];
12528
+ return node.updateFromJSON(_json);
12529
+ }
12530
+ exportJSON() {
12531
+ return {
12532
+ ...super.exportJSON(),
12533
+ type: "steps",
12534
+ version: 1,
12535
+ steps: this.__steps
12536
+ };
12537
+ }
12538
+ createDOM() {
12539
+ return stubDOM();
12540
+ }
12541
+ updateDOM() {
12542
+ return false;
12543
+ }
12544
+ decorate() {
12545
+ return null;
12546
+ }
12547
+ isInline() {
12548
+ return false;
12549
+ }
12550
+ getTextContent() {
12551
+ return this.__steps.map((step) => [step.title, extractText(step.content)].filter(Boolean).join("\n")).join("\n");
12552
+ }
12553
+ },
12501
12554
  PollNode,
12502
12555
  ChatNode
12503
12556
  ];
@@ -24965,6 +25018,7 @@ var makePollIdSuffix = customAlphabet(idAlphabet, 10);
24965
25018
  var makeOptionIdSuffix = customAlphabet(idAlphabet, 6);
24966
25019
  var makeChatParticipantId = customAlphabet(idAlphabet, 6);
24967
25020
  var makeChatMessageId = customAlphabet(idAlphabet, 8);
25021
+ var makeStepId = customAlphabet(idAlphabet, 8);
24968
25022
  function extractBlockId(el) {
24969
25023
  const id = el.getAttribute("id");
24970
25024
  return id ? { $: { blockId: id } } : {};
@@ -25332,6 +25386,30 @@ function registerCustomReaders(registry) {
25332
25386
  version: 1
25333
25387
  };
25334
25388
  });
25389
+ registry.registerReader("steps", (el, ctx) => {
25390
+ const steps = [];
25391
+ for (const child of el.children) {
25392
+ if (child.tagName.toLowerCase() !== "step") continue;
25393
+ steps.push({
25394
+ id: child.getAttribute("id") || `s_${makeStepId()}`,
25395
+ title: child.getAttribute("title") ?? "",
25396
+ content: { root: {
25397
+ type: "root",
25398
+ children: ctx.parseChildren(child),
25399
+ direction: "ltr",
25400
+ format: "",
25401
+ indent: 0,
25402
+ version: 1
25403
+ } }
25404
+ });
25405
+ }
25406
+ return {
25407
+ type: "steps",
25408
+ ...extractBlockId(el),
25409
+ steps,
25410
+ version: 1
25411
+ };
25412
+ });
25335
25413
  registry.registerReader("chat", (el) => {
25336
25414
  const variant = el.getAttribute("variant") === "user-user" ? "user-user" : "user-agent";
25337
25415
  const participants = [];
@@ -25870,6 +25948,22 @@ function registerCustomWriters(registry) {
25870
25948
  children: files
25871
25949
  };
25872
25950
  });
25951
+ registry.registerWriter("steps", (node, ctx) => {
25952
+ const n = node;
25953
+ const steps = (n.steps ?? []).map((step) => ({
25954
+ tag: "step",
25955
+ attrs: optAttr({
25956
+ id: step.id,
25957
+ title: step.title
25958
+ }),
25959
+ children: ctx.serializeNestedState(step.content)
25960
+ }));
25961
+ return {
25962
+ tag: "steps",
25963
+ attrs: blockId(n),
25964
+ children: steps
25965
+ };
25966
+ });
25873
25967
  registry.registerWriter("chat", (node) => {
25874
25968
  const n = node;
25875
25969
  const participantsEl = {
@@ -26095,6 +26189,8 @@ var BLOCK_TAGS = /* @__PURE__ */ new Set([
26095
26189
  "footnote-section",
26096
26190
  "grid",
26097
26191
  "cell",
26192
+ "steps",
26193
+ "step",
26098
26194
  "excalidraw"
26099
26195
  ]);
26100
26196
  function isBlockContainer(element) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-litexml-cli",
3
- "version": "0.52.0",
3
+ "version": "0.53.1",
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",
@@ -16,9 +16,9 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@haklex/rich-compose": "0.52.0",
20
- "@haklex/rich-headless": "0.52.0",
21
- "@haklex/rich-litexml": "0.52.0",
19
+ "@haklex/rich-compose": "0.53.1",
20
+ "@haklex/rich-headless": "0.53.1",
21
+ "@haklex/rich-litexml": "0.53.1",
22
22
  "@lexical/headless": "^0.52.0",
23
23
  "lexical": "^0.52.0"
24
24
  },