@etrepum/lexical-builder-devtools-core 0.0.28-nightly.20240705.0 → 0.0.28

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,3 @@
1
- import { AnyLexicalPlan } from '@etrepum/lexical-builder';
2
1
  import { LexicalEditor } from 'lexical';
3
2
  import { ComponentProps } from 'react';
4
3
 
@@ -6,7 +5,6 @@ export interface BuilderGraphComponentProps {
6
5
  editor: LexicalEditor;
7
6
  className?: string;
8
7
  }
9
- export declare function displayName(plan: AnyLexicalPlan): string;
10
8
  export declare function BuilderGraphComponent({ editor, ...rest }: BuilderGraphComponentProps & ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
11
9
  export default BuilderGraphComponent;
12
10
  //# sourceMappingURL=BuilderGraphComponent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuilderGraphComponent.d.ts","sourceRoot":"","sources":["../src/BuilderGraphComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,cAAc,EAAiB,MAAM,OAAO,CAAC;AAMtD,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,cAAc,UAS/C;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,GAAG,IAAI,EACR,EAAE,0BAA0B,GAAG,cAAc,CAAC,KAAK,CAAC,2CAmBpD;AAED,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"BuilderGraphComponent.d.ts","sourceRoot":"","sources":["../src/BuilderGraphComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,KAAK,cAAc,EAAiB,MAAM,OAAO,CAAC;AAM3D,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,GAAG,IAAI,EACR,EAAE,0BAA0B,GAAG,cAAc,CAAC,KAAK,CAAC,2CAoBpD;AAED,eAAe,qBAAqB,CAAC"}
@@ -1,5 +1,4 @@
1
- export declare const BuilderGraphComponent: import('react').LazyExoticComponent<typeof import('./BuilderGraphComponent').BuilderGraphComponent>;
2
- export declare const BuilderGraphPlan: import('@etrepum/lexical-builder').LexicalPlan<import('@etrepum/lexical-builder').PlanConfigBase, "@etrepum/lexical-builder-devtools-core/BuilderGraphPlan", {
1
+ export declare const BuilderGraphPlan: import('@etrepum/lexical-builder').LexicalPlan<import('@etrepum/lexical-builder').PlanConfigBase, "@etrepum/lexical-builder-devtools-core/BuilderGraph", {
3
2
  Component: () => import("react/jsx-runtime").JSX.Element;
4
3
  }, unknown>;
5
4
  //# sourceMappingURL=BuilderGraphPlan.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BuilderGraphPlan.d.ts","sourceRoot":"","sources":["../src/BuilderGraphPlan.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,qGAEjC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;WAY3B,CAAC"}
1
+ {"version":3,"file":"BuilderGraphPlan.d.ts","sourceRoot":"","sources":["../src/BuilderGraphPlan.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;WAY3B,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import m from "mermaid";
3
+ import { useState as c, useEffect as s, useRef as f } from "react";
4
+ let l = 0;
5
+ function p() {
6
+ return `mermaid-tmp-${String(++l)}`;
7
+ }
8
+ function S(t, n) {
9
+ const [i, e] = c();
10
+ return s(() => {
11
+ const r = p();
12
+ let o = !1;
13
+ return m.mermaidAPI.initialize({
14
+ startOnLoad: !1,
15
+ ...n
16
+ }), m.render(r, t).then(
17
+ (u) => {
18
+ o || e(u);
19
+ },
20
+ (u) => {
21
+ var d;
22
+ throw (d = document.querySelector(`#d${r}`)) == null || d.remove(), u;
23
+ }
24
+ ), () => {
25
+ o = !0;
26
+ };
27
+ }, [t, n]), i;
28
+ }
29
+ function R({ text: t, config: n, ...i }) {
30
+ const e = S(t, n), r = f(null);
31
+ return s(() => {
32
+ e != null && e.bindFunctions && r.current && e.bindFunctions(r.current);
33
+ }, [e]), e != null && e.svg ? /* @__PURE__ */ a(
34
+ "div",
35
+ {
36
+ ...i,
37
+ ref: r,
38
+ dangerouslySetInnerHTML: { __html: e.svg }
39
+ }
40
+ ) : null;
41
+ }
42
+ export {
43
+ R as Mermaid,
44
+ R as default,
45
+ S as useMermaidRenderResult
46
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"Mermaid.d.ts","sourceRoot":"","sources":["../src/Mermaid.tsx"],"names":[],"mappings":"AAAA,OAAgB,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,cAAc,EAA+B,MAAM,OAAO,CAAC;AAEpE,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,KAAK,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAMD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,aAAa,GACrB,YAAY,GAAG,SAAS,CAsB1B;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,kDAe/D;AAED,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Mermaid.d.ts","sourceRoot":"","sources":["../src/Mermaid.tsx"],"names":[],"mappings":"AAAA,OAAgB,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,KAAK,cAAc,EAA+B,MAAM,OAAO,CAAC;AAEzE,MAAM,WAAW,YAAa,SAAQ,cAAc,CAAC,KAAK,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAMD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,aAAa,GACrB,YAAY,GAAG,SAAS,CA0B1B;AAED,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,YAAY,kDAe/D;AAED,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildGraph.d.ts","sourceRoot":"","sources":["../src/buildGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA4BxD"}
1
+ {"version":3,"file":"buildGraph.d.ts","sourceRoot":"","sources":["../src/buildGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C,wBAAgB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CA4BxD"}
@@ -0,0 +1,4 @@
1
+ import { AnyLexicalPlan } from '@etrepum/lexical-builder';
2
+
3
+ export declare function displayName(plan: AnyLexicalPlan): string;
4
+ //# sourceMappingURL=displayName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"displayName.d.ts","sourceRoot":"","sources":["../src/displayName.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,wBAAgB,WAAW,CAAC,IAAI,EAAE,cAAc,UAS/C"}
@@ -1 +1 @@
1
- {"version":3,"file":"getMermaidLiveUrl.d.ts","sourceRoot":"","sources":["../src/getMermaidLiveUrl.tsx"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CActD"}
1
+ {"version":3,"file":"getMermaidLiveUrl.d.ts","sourceRoot":"","sources":["../src/getMermaidLiveUrl.tsx"],"names":[],"mappings":"AAGA,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAatD"}
package/dist/index.js CHANGED
@@ -1,35 +1,41 @@
1
- import { jsxs as h, jsx as d } from "react/jsx-runtime";
2
- import { lazy as u, useMemo as g, Suspense as y } from "react";
3
- import { LexicalBuilder as $, definePlan as v, provideOutput as x } from "@etrepum/lexical-builder";
4
- import { deflate as B } from "pako";
5
- import { fromUint8Array as G } from "js-base64";
6
- import { ReactPlan as P } from "@etrepum/lexical-react-plan";
7
- function b(t) {
8
- const r = $.fromEditor(t), e = ["flowchart TB"];
9
- function a(n) {
1
+ import { jsxs as m, jsx as c } from "react/jsx-runtime";
2
+ import { lazy as u, useMemo as f, Suspense as h } from "react";
3
+ import { LexicalBuilder as g, definePlan as y, provideOutput as $ } from "@etrepum/lexical-builder";
4
+ import { deflate as x } from "pako";
5
+ import { fromUint8Array as v } from "js-base64";
6
+ import { ReactPlan as A } from "@etrepum/lexical-react-plan";
7
+ function N(t) {
8
+ const { name: r } = t, e = r.split(/\//g);
9
+ for (; e.length > 1 && /^plan$/i.test(e[e.length - 1] ?? ""); )
10
+ e.pop();
11
+ return (e[e.length - 1] || r).replaceAll("/", "-").replaceAll(/[\\"<>]/g, "");
12
+ }
13
+ function P(t) {
14
+ const r = g.fromEditor(t), e = ["flowchart TB"];
15
+ function i(n) {
10
16
  e.push(n);
11
17
  }
12
- const i = [...r.sortedPlanReps()], l = {};
13
- for (let n = 0; n < i.length; n++)
14
- l[i[n].plan.name] = `P${n}`;
18
+ const a = r.sortedPlanReps(), l = {};
19
+ for (let n = 0; n < a.length; n++)
20
+ l[a[n].plan.name] = `P${String(n)}`;
15
21
  function p(n) {
16
22
  return l[n.name];
17
23
  }
18
- for (const n of i) {
24
+ for (const n of a) {
19
25
  const { plan: o } = n;
20
- a(`${p(o)}["${f(o)}"]`);
26
+ i(`${p(o)}["${N(o)}"]`);
21
27
  for (const s of o.dependencies || [])
22
- a(`${p(o)} --> ${p(Array.isArray(s) ? s[0] : s)}`);
28
+ i(`${p(o)} --> ${p(Array.isArray(s) ? s[0] : s)}`);
23
29
  for (const [s] of o.peerDependencies || []) {
24
- const c = r.planNameMap.get(s);
25
- c && a(`${p(o)} -.-> ${p(c.plan)}`);
30
+ const d = r.planNameMap.get(s);
31
+ d && i(`${p(o)} -.-> ${p(d.plan)}`);
26
32
  }
27
33
  }
28
- return e.join(`
29
- `) + `
34
+ return `${e.join(`
35
+ `)}
30
36
  `;
31
37
  }
32
- function A(t) {
38
+ function S(t) {
33
39
  const r = JSON.stringify({
34
40
  code: t,
35
41
  mermaid: JSON.stringify({ theme: "dark" }, null, 2),
@@ -39,51 +45,40 @@ function A(t) {
39
45
  updateEditor: !1,
40
46
  editorMode: "code"
41
47
  });
42
- return "https://mermaid.live/edit#pako:" + G(B(new TextEncoder().encode(r), { level: 9 }));
43
- }
44
- const C = u(() => import("./Mermaid-Dwi2amgd.js"));
45
- function f(t) {
46
- const { name: r } = t, e = r.split(/\//g);
47
- for (; e.length > 1 && /^plan$/i.test(e[e.length - 1] ?? ""); )
48
- e.pop();
49
- return (e[e.length - 1] || r).replaceAll("/", "-").replaceAll(/[\\"<>]/g, "");
48
+ return `https://mermaid.live/edit#pako:${v(
49
+ x(new TextEncoder().encode(r), { level: 9 })
50
+ )}`;
50
51
  }
51
- function m({
52
+ const B = u(() => import("./Mermaid-hdIyOO2O.js"));
53
+ function E({
52
54
  editor: t,
53
55
  ...r
54
56
  }) {
55
- const { text: e, href: a } = g(() => {
56
- const l = b(t);
57
+ const { text: e, href: i } = f(() => {
58
+ const l = P(t);
57
59
  return {
58
60
  text: l,
59
- href: A(l)
61
+ href: S(l)
60
62
  };
61
- }, [t]), i = r.className ? {} : { style: { display: "grid", gap: "1rem" } };
62
- return /* @__PURE__ */ h("div", { ...i, ...r, children: [
63
- /* @__PURE__ */ d("a", { href: a, target: "_blank", children: "mermaid.live" }),
64
- /* @__PURE__ */ d(C, { text: e })
63
+ }, [t]), a = r.className ? {} : { style: { display: "grid", gap: "1rem" } };
64
+ return /* @__PURE__ */ m("div", { ...a, ...r, children: [
65
+ /* @__PURE__ */ c("a", { href: i, target: "_blank", rel: "noopener", children: "mermaid.live" }),
66
+ /* @__PURE__ */ c(B, { text: e })
65
67
  ] });
66
68
  }
67
- const S = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
68
- __proto__: null,
69
- BuilderGraphComponent: m,
70
- default: m,
71
- displayName: f
72
- }, Symbol.toStringTag, { value: "Module" })), M = u(
73
- () => Promise.resolve().then(() => S)
74
- ), T = v({
75
- name: "@etrepum/lexical-builder-devtools-core/BuilderGraphPlan",
76
- dependencies: [P],
69
+ const k = y({
70
+ name: "@etrepum/lexical-builder-devtools-core/BuilderGraph",
71
+ dependencies: [A],
77
72
  register(t) {
78
- return x({
79
- Component: () => /* @__PURE__ */ d(y, { children: /* @__PURE__ */ d(M, { editor: t }) })
73
+ return $({
74
+ Component: () => /* @__PURE__ */ c(h, { children: /* @__PURE__ */ c(E, { editor: t }) })
80
75
  });
81
76
  }
82
- }), k = "0.0.28-nightly.20240705.0";
77
+ }), w = "0.0.28";
83
78
  export {
84
- m as BuilderGraphComponent,
85
- T as BuilderGraphPlan,
86
- k as PACKAGE_VERSION,
87
- b as buildGraph,
88
- A as getMermaidLiveUrl
79
+ E as BuilderGraphComponent,
80
+ k as BuilderGraphPlan,
81
+ w as PACKAGE_VERSION,
82
+ P as buildGraph,
83
+ S as getMermaidLiveUrl
89
84
  };
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "lint": "eslint",
17
17
  "test:watch": "vitest"
18
18
  },
19
- "version": "0.0.28-nightly.20240705.0",
19
+ "version": "0.0.28",
20
20
  "license": "MIT",
21
21
  "repository": {
22
22
  "type": "git",
@@ -1,44 +0,0 @@
1
- import { jsx as m } from "react/jsx-runtime";
2
- import d from "mermaid";
3
- import { useState as a, useEffect as l, useRef as c } from "react";
4
- let f = 0;
5
- function p() {
6
- return `mermaid-tmp-${++f}`;
7
- }
8
- function v(t, n) {
9
- const [u, e] = a();
10
- return l(() => {
11
- const r = p();
12
- let s = !1;
13
- return d.mermaidAPI.initialize({
14
- startOnLoad: !1,
15
- ...n
16
- }), d.render(r, t).then(
17
- (i) => s ? null : e(i),
18
- (i) => {
19
- var o;
20
- throw (o = document.querySelector(`#d${r}`)) == null || o.remove(), i;
21
- }
22
- ), () => {
23
- s = !0;
24
- };
25
- }, [t, n]), u;
26
- }
27
- function g({ text: t, config: n, ...u }) {
28
- const e = v(t, n), r = c(null);
29
- return l(() => {
30
- e && e.bindFunctions && r.current && e.bindFunctions(r.current);
31
- }, [e]), e && e.svg ? /* @__PURE__ */ m(
32
- "div",
33
- {
34
- ...u,
35
- ref: r,
36
- dangerouslySetInnerHTML: { __html: e.svg }
37
- }
38
- ) : null;
39
- }
40
- export {
41
- g as Mermaid,
42
- g as default,
43
- v as useMermaidRenderResult
44
- };