@etrepum/lexical-builder-table 0.0.35 → 0.0.36-nightly.20240813.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/dist/index.js +26 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { TableNode as N, TableRowNode as x, TableCellNode as T, INSERT_TABLE_COMMAND as y, $createTableNodeWithDimensions as B, $computeTableMapSkipCellCheck as _, $createTableCellNode as M, $isTableNode as A, $getNodeTriplet as I, $computeTableMap as D, $isTableRowNode as $, $isTableCellNode as H, applyTableHandlers as K } from "@lexical/table";
1
+ import { TableNode as N, TableRowNode as k, TableCellNode as T, INSERT_TABLE_COMMAND as x, $createTableNodeWithDimensions as B, $computeTableMapSkipCellCheck as _, $createTableCellNode as M, $isTableNode as A, $getNodeTriplet as I, $computeTableMap as D, $isTableRowNode as $, $isTableCellNode as H, applyTableHandlers as K } from "@lexical/table";
2
2
  import { mergeRegister as E, $insertNodeToNearestRoot as L, $insertFirst as O } from "@lexical/utils";
3
3
  import { $isTextNode as v, COMMAND_PRIORITY_EDITOR as P, $createParagraphNode as F, $getNodeByKey as j } from "lexical";
4
4
  import { definePlan as z, safeCast as V, Store as h, provideOutput as G, registerStoreToggle as m } from "@etrepum/lexical-builder";
@@ -8,9 +8,9 @@ function w(a, c, ...C) {
8
8
  C.reduce((f, p) => f.replace("%s", String(p)), c || "")
9
9
  );
10
10
  }
11
- const Q = "0.0.35", U = z({
11
+ const Q = "0.0.36-nightly.20240813.0", U = z({
12
12
  name: "@lexical/table",
13
- nodes: [N, x, T],
13
+ nodes: [N, k, T],
14
14
  config: V({
15
15
  hasCellMerge: !0,
16
16
  hasCellBackgroundColor: !0,
@@ -24,17 +24,17 @@ const Q = "0.0.35", U = z({
24
24
  };
25
25
  },
26
26
  register(a, c, C) {
27
- const f = C.getInitResult(), { hasCellMerge: p, hasCellBackgroundColor: k, hasTabHandler: R } = f;
27
+ const f = C.getInitResult(), { hasCellMerge: p, hasCellBackgroundColor: y, hasTabHandler: R } = f;
28
28
  return G(
29
29
  f,
30
30
  E(
31
31
  a.registerCommand(
32
- y,
33
- ({ columns: t, rows: o, includeHeaders: r }) => {
32
+ x,
33
+ ({ columns: t, rows: o, includeHeaders: n }) => {
34
34
  const e = B(
35
35
  Number(o),
36
36
  Number(t),
37
- r
37
+ n
38
38
  );
39
39
  L(e);
40
40
  const l = e.getFirstDescendant();
@@ -44,17 +44,17 @@ const Q = "0.0.35", U = z({
44
44
  ),
45
45
  a.registerNodeTransform(N, (t) => {
46
46
  const [o] = _(t, null, null);
47
- let r = 0;
47
+ let n = 0;
48
48
  for (const e of o)
49
- r = Math.max(r, e.length);
49
+ n = Math.max(n, e.length);
50
50
  for (const e of o) {
51
51
  const l = e.length;
52
- if (l === r || l === 0)
52
+ if (l === n || l === 0)
53
53
  continue;
54
- const n = e[l - 1].cell;
55
- for (let s = l; s < r; ++s) {
54
+ const r = e[l - 1].cell;
55
+ for (let s = l; s < n; ++s) {
56
56
  const d = M(0);
57
- d.append(F()), n.insertAfter(d);
57
+ d.append(F()), r.insertAfter(d);
58
58
  }
59
59
  }
60
60
  }),
@@ -64,18 +64,18 @@ const Q = "0.0.35", U = z({
64
64
  // function any time the value changes
65
65
  () => !0,
66
66
  () => {
67
- const t = R.get(), o = /* @__PURE__ */ new Map(), r = (e) => {
67
+ const t = R.get(), o = /* @__PURE__ */ new Map(), n = (e) => {
68
68
  const l = e.getKey(), i = a.getElementByKey(
69
69
  l
70
70
  );
71
71
  if (i && !o.has(l)) {
72
- const n = K(
72
+ const r = K(
73
73
  e,
74
74
  i,
75
75
  a,
76
76
  t
77
77
  );
78
- o.set(l, n);
78
+ o.set(l, r);
79
79
  }
80
80
  };
81
81
  return E(
@@ -85,12 +85,12 @@ const Q = "0.0.35", U = z({
85
85
  for (const [l, i] of e)
86
86
  if (i === "created")
87
87
  a.getEditorState().read(() => {
88
- const n = j(l);
89
- A(n) && r(n);
88
+ const r = j(l);
89
+ A(r) && n(r);
90
90
  });
91
91
  else if (i === "destroyed") {
92
- const n = o.get(l);
93
- n !== void 0 && (n.removeListeners(), o.delete(l));
92
+ const r = o.get(l);
93
+ r !== void 0 && (r.removeListeners(), o.delete(l));
94
94
  }
95
95
  },
96
96
  { skipInitialization: !1 }
@@ -109,13 +109,13 @@ const Q = "0.0.35", U = z({
109
109
  (t) => t,
110
110
  () => a.registerNodeTransform(T, (t) => {
111
111
  if (t.getColSpan() > 1 || t.getRowSpan() > 1) {
112
- const [, , o] = I(t), [r] = D(o, t, t);
112
+ const [, , o] = I(t), [n] = D(o, t, t);
113
113
  let e = o.getFirstChild();
114
114
  w(
115
115
  $(e),
116
116
  "Expected TableNode first child to be a RowNode"
117
117
  );
118
- const l = r.length, i = r[0].length, n = [];
118
+ const l = n.length, i = n[0].length, r = [];
119
119
  for (let s = 0; s < l; s++) {
120
120
  s !== 0 && (e = e.getNextSibling(), w(
121
121
  $(e),
@@ -123,9 +123,9 @@ const Q = "0.0.35", U = z({
123
123
  ));
124
124
  let d = null;
125
125
  for (let u = 0; u < i; u++) {
126
- const b = r[s][u], g = b.cell;
126
+ const b = n[s][u], g = b.cell;
127
127
  if (b.startRow === s && b.startColumn === u)
128
- d = g, n.push(g);
128
+ d = g, r.push(g);
129
129
  else if (g.getColSpan() > 1 || g.getRowSpan() > 1) {
130
130
  w(
131
131
  H(g),
@@ -136,13 +136,13 @@ const Q = "0.0.35", U = z({
136
136
  }
137
137
  }
138
138
  }
139
- for (const s of n)
139
+ for (const s of r)
140
140
  s.setColSpan(1), s.setRowSpan(1);
141
141
  }
142
142
  })
143
143
  ),
144
144
  m(
145
- k,
145
+ y,
146
146
  (t) => t,
147
147
  () => a.registerNodeTransform(T, (t) => {
148
148
  t.getBackgroundColor() !== null && t.setBackgroundColor(null);
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "test:watch": "vitest",
16
16
  "lint": "eslint"
17
17
  },
18
- "version": "0.0.35",
18
+ "version": "0.0.36-nightly.20240813.0",
19
19
  "license": "MIT",
20
20
  "repository": {
21
21
  "type": "git",