@layers-app/editor 0.0.10 → 0.0.12

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.
@@ -1,6 +1,6 @@
1
- import { jsx as o, jsxs as C } from "react/jsx-runtime";
2
- import { useMemo as I, useState as D, useRef as S, useCallback as $, useEffect as R } from "react";
3
- import { b as V, a as j, w as P, R as x, C as k, l as b, N as E, k as w, K as v, e as B, r as y, B as A, m as T, n as W } from "./DSD.CLhKx58f.js";
1
+ import { jsx as o, jsxs as g } from "react/jsx-runtime";
2
+ import { useMemo as I, useState as D, useRef as S, useCallback as $, useEffect as V } from "react";
3
+ import { u as j, f as E, w as P, g as x, c as k, x as b, N as R, k as w, K as v, m as y, r as B, B as A, y as T, l as W } from "./layers.D0SxWFme.js";
4
4
  function O(...t) {
5
5
  return t.filter(Boolean).join(" ");
6
6
  }
@@ -14,19 +14,19 @@ function L({
14
14
  totalVotes: a,
15
15
  withPollNode: p
16
16
  }) {
17
- const { clientID: r } = W(), _ = S(null), m = t.votes, f = m.indexOf(r) !== -1, i = m.length, h = t.text;
18
- return /* @__PURE__ */ C("div", { className: "PollNode__optionContainer", children: [
17
+ const { clientID: r } = W(), h = S(null), m = t.votes, _ = m.indexOf(r) !== -1, i = m.length, f = t.text;
18
+ return /* @__PURE__ */ g("div", { className: "PollNode__optionContainer", children: [
19
19
  /* @__PURE__ */ o(
20
20
  "div",
21
21
  {
22
22
  className: O(
23
23
  "PollNode__optionCheckboxWrapper",
24
- f && "PollNode__optionCheckboxChecked"
24
+ _ && "PollNode__optionCheckboxChecked"
25
25
  ),
26
26
  children: /* @__PURE__ */ o(
27
27
  "input",
28
28
  {
29
- ref: _,
29
+ ref: h,
30
30
  className: "PollNode__optionCheckbox",
31
31
  type: "checkbox",
32
32
  onChange: () => {
@@ -34,12 +34,12 @@ function L({
34
34
  d.toggleVote(t, r);
35
35
  });
36
36
  },
37
- checked: f
37
+ checked: _
38
38
  }
39
39
  )
40
40
  }
41
41
  ),
42
- /* @__PURE__ */ C("div", { className: "PollNode__optionInputWrapper", children: [
42
+ /* @__PURE__ */ g("div", { className: "PollNode__optionInputWrapper", children: [
43
43
  /* @__PURE__ */ o(
44
44
  "div",
45
45
  {
@@ -53,7 +53,7 @@ function L({
53
53
  {
54
54
  className: "PollNode__optionInput",
55
55
  type: "text",
56
- value: h,
56
+ value: f,
57
57
  onChange: (d) => {
58
58
  const u = d.target, N = u.value, e = u.selectionStart, l = u.selectionEnd;
59
59
  p(
@@ -92,7 +92,7 @@ function z({
92
92
  options: c,
93
93
  nodeKey: n
94
94
  }) {
95
- const [a] = V(), p = I(() => F(c), [c]), [r, _, m] = j(n), [g, f] = D(null), i = S(null), h = $(
95
+ const [a] = j(), p = I(() => F(c), [c]), [r, h, m] = E(n), [C, _] = D(null), i = S(null), f = $(
96
96
  (e) => {
97
97
  if (r && P(x())) {
98
98
  e.preventDefault();
@@ -103,29 +103,29 @@ function z({
103
103
  },
104
104
  [r, n]
105
105
  );
106
- R(() => E(
106
+ V(() => R(
107
107
  a.registerUpdateListener(({ editorState: e }) => {
108
- f(e.read(() => x()));
108
+ _(e.read(() => x()));
109
109
  }),
110
110
  a.registerCommand(
111
- y,
111
+ B,
112
112
  (e) => {
113
113
  const l = e;
114
- return l.target === i.current ? (l.shiftKey || m(), _(!r), !0) : !1;
114
+ return l.target === i.current ? (l.shiftKey || m(), h(!r), !0) : !1;
115
115
  },
116
116
  v
117
117
  ),
118
118
  a.registerCommand(
119
- B,
120
- h,
119
+ y,
120
+ f,
121
121
  v
122
122
  ),
123
123
  a.registerCommand(
124
124
  w,
125
- h,
125
+ f,
126
126
  v
127
127
  )
128
- ), [m, a, r, n, h, _]);
128
+ ), [m, a, r, n, f, h]);
129
129
  const d = (e, l) => {
130
130
  a.update(
131
131
  () => {
@@ -138,13 +138,13 @@ function z({
138
138
  d((e) => {
139
139
  e.addOption(T());
140
140
  });
141
- }, N = P(g) && r;
141
+ }, N = P(C) && r;
142
142
  return /* @__PURE__ */ o(
143
143
  "div",
144
144
  {
145
145
  className: `PollNode__container ${N ? "focused" : ""}`,
146
146
  ref: i,
147
- children: /* @__PURE__ */ C("div", { className: "PollNode__inner", children: [
147
+ children: /* @__PURE__ */ g("div", { className: "PollNode__inner", children: [
148
148
  /* @__PURE__ */ o("h2", { className: "PollNode__heading", children: t }),
149
149
  c.map((e, l) => {
150
150
  const s = e.uid;
@@ -1,4 +1,4 @@
1
- import { a6 as p, a7 as k, n as E } from "./DSD.CLhKx58f.js";
1
+ import { ae as p, af as k, l as E } from "./layers.D0SxWFme.js";
2
2
  import { useRef as O, useContext as P, useMemo as D, useEffect as h } from "react";
3
3
  import { jsx as _ } from "react/jsx-runtime";
4
4
  function K(e) {
@@ -19,18 +19,18 @@ function S({ initialEditor: e, children: t, initialNodes: o, initialTheme: g, sk
19
19
  i == null && C(9);
20
20
  const [l, { getTheme: w }] = i, x = D(() => {
21
21
  const a = g || w() || void 0, y = k(i, a);
22
- if (a !== void 0 && (e._config.theme = a), e._parentEditor = l, o) for (let n of o) {
23
- let s = null, r = null;
24
- if (typeof n != "function") {
25
- const d = n;
26
- n = d.replace, s = d.with, r = d.withKlass || null;
22
+ if (a !== void 0 && (e._config.theme = a), e._parentEditor = l, o) for (let r of o) {
23
+ let s = null, n = null;
24
+ if (typeof r != "function") {
25
+ const d = r;
26
+ r = d.replace, s = d.with, n = d.withKlass || null;
27
27
  }
28
- const u = e._nodes.get(n.getType());
29
- e._nodes.set(n.getType(), { exportDOM: u ? u.exportDOM : void 0, klass: n, replace: s, replaceWithKlass: r, transforms: m(n) });
28
+ const u = e._nodes.get(r.getType());
29
+ e._nodes.set(r.getType(), { exportDOM: u ? u.exportDOM : void 0, klass: r, replace: s, replaceWithKlass: n, transforms: m(r) });
30
30
  }
31
31
  else {
32
- const n = e._nodes = new Map(l._nodes);
33
- for (const [s, r] of n) e._nodes.set(s, { exportDOM: r.exportDOM, klass: r.klass, replace: r.replace, replaceWithKlass: r.replaceWithKlass, transforms: m(r.klass) });
32
+ const r = e._nodes = new Map(l._nodes);
33
+ for (const [s, n] of r) e._nodes.set(s, { exportDOM: n.exportDOM, klass: n.klass, replace: n.replace, replaceWithKlass: n.replaceWithKlass, transforms: m(n.klass) });
34
34
  }
35
35
  return e._config.namespace = l._config.namespace, e._editable = l._editable, [e, y];
36
36
  }, []), { isCollabActive: M, yjsDocMap: b } = E(), c = v || f.current || b.has(e.getKey());