otomate 0.0.3 → 0.0.4

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/otomate.js CHANGED
@@ -16730,15 +16730,26 @@ function o2(e) {
16730
16730
  return e in Ns;
16731
16731
  }
16732
16732
  function Bi(e) {
16733
- var i, s;
16733
+ var i, s, o, a, u;
16734
16734
  const t = e.tagName.toLowerCase();
16735
16735
  let n;
16736
16736
  if (t === "a") {
16737
- const o = { url: String(((i = e.properties) == null ? void 0 : i.href) ?? "") };
16738
- (s = e.properties) != null && s.title && (o.title = String(e.properties.title)), n = { type: "link", attrs: o };
16739
- } else Ns[t] && (n = Ns[t]());
16737
+ const c = { url: String(((i = e.properties) == null ? void 0 : i.href) ?? "") };
16738
+ (s = e.properties) != null && s.title && (c.title = String(e.properties.title)), n = { type: "link", attrs: c };
16739
+ } else if (Ns[t])
16740
+ n = Ns[t]();
16741
+ else if (t === "span") {
16742
+ const c = (o = e.properties) != null && o.className ? Array.isArray(e.properties.className) ? e.properties.className.map(String) : [String(e.properties.className)] : [], d = (a = e.properties) != null && a.style ? String(e.properties.style) : void 0, h = (u = e.properties) != null && u.id ? String(e.properties.id) : void 0;
16743
+ if (c.length > 0 || d || h) {
16744
+ const m = {};
16745
+ c.length > 0 && (m.className = c), d && (m.style = d), h && (m.id = h);
16746
+ for (const [f, E] of Object.entries(e.properties ?? {}))
16747
+ f.startsWith("data") && f !== "data" && (m[f] = E);
16748
+ n = { type: "custom", attrs: m };
16749
+ }
16750
+ }
16740
16751
  const r = Rt(e.children, "inline");
16741
- return n ? r.map((o) => u2(o, n)) : r;
16752
+ return n ? r.map((c) => u2(c, n)) : r;
16742
16753
  }
16743
16754
  function u2(e, t) {
16744
16755
  if (e.type === "text") {
@@ -17776,19 +17787,25 @@ const w_ = {
17776
17787
  code: "code"
17777
17788
  };
17778
17789
  function A_(e, t) {
17779
- var s, o;
17790
+ var s, o, a, u, c;
17780
17791
  const n = { type: "text", value: e.value };
17781
17792
  if (!e.marks || e.marks.length === 0)
17782
17793
  return n;
17783
17794
  let r = n;
17784
- const i = [...e.marks].sort((a, u) => a.type === "link" ? 1 : u.type === "link" ? -1 : 0);
17785
- for (const a of i)
17786
- if (a.type === "link") {
17787
- const u = {};
17788
- (s = a.attrs) != null && s.url && (u.href = String(a.attrs.url)), (o = a.attrs) != null && o.title && (u.title = String(a.attrs.title)), r = { type: "element", tagName: "a", properties: u, children: [r] };
17795
+ const i = [...e.marks].sort((d, h) => d.type === "link" ? 1 : h.type === "link" ? -1 : 0);
17796
+ for (const d of i)
17797
+ if (d.type === "link") {
17798
+ const h = {};
17799
+ (s = d.attrs) != null && s.url && (h.href = String(d.attrs.url)), (o = d.attrs) != null && o.title && (h.title = String(d.attrs.title)), r = { type: "element", tagName: "a", properties: h, children: [r] };
17800
+ } else if (d.type === "custom") {
17801
+ const h = {};
17802
+ (a = d.attrs) != null && a.className && (h.className = d.attrs.className), (u = d.attrs) != null && u.style && (h.style = String(d.attrs.style)), (c = d.attrs) != null && c.id && (h.id = String(d.attrs.id));
17803
+ for (const [m, f] of Object.entries(d.attrs ?? {}))
17804
+ m.startsWith("data") && m !== "data" && (h[m] = f);
17805
+ r = { type: "element", tagName: "span", properties: h, children: [r] };
17789
17806
  } else {
17790
- const u = w_[a.type];
17791
- u && (r = { type: "element", tagName: u, properties: {}, children: [r] });
17807
+ const h = w_[d.type];
17808
+ h && (r = { type: "element", tagName: h, properties: {}, children: [r] });
17792
17809
  }
17793
17810
  return r;
17794
17811
  }