@topol.io/editor-react 0.0.0-alfa.0 → 0.0.0-alfa.2

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,93 +1,680 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import require$$0, { useEffect } from "react";
21
- var loadScript = function load(src, opts, cb) {
22
- var head = document.head || document.getElementsByTagName("head")[0];
23
- var script = document.createElement("script");
24
- if (typeof opts === "function") {
25
- cb = opts;
26
- opts = {};
27
- }
28
- opts = opts || {};
29
- cb = cb || function() {
30
- };
31
- script.type = opts.type || "text/javascript";
32
- script.charset = opts.charset || "utf8";
33
- script.async = "async" in opts ? !!opts.async : true;
34
- script.src = src;
35
- if (opts.attrs) {
36
- setAttributes(script, opts.attrs);
37
- }
38
- if (opts.text) {
39
- script.text = "" + opts.text;
40
- }
41
- var onend = "onload" in script ? stdOnEnd : ieOnEnd;
42
- onend(script, cb);
43
- if (!script.onload) {
44
- stdOnEnd(script, cb);
1
+ import Se, { useEffect as lr } from "react";
2
+ var K = { exports: {} }, D = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.min.js
6
+ *
7
+ * Copyright (c) Facebook, Inc. and its affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var _e;
13
+ function sr() {
14
+ if (_e)
15
+ return D;
16
+ _e = 1;
17
+ var t = Se, u = Symbol.for("react.element"), g = Symbol.for("react.fragment"), l = Object.prototype.hasOwnProperty, f = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, m = { key: !0, ref: !0, __self: !0, __source: !0 };
18
+ function j(T, h, O) {
19
+ var E, R = {}, P = null, $ = null;
20
+ O !== void 0 && (P = "" + O), h.key !== void 0 && (P = "" + h.key), h.ref !== void 0 && ($ = h.ref);
21
+ for (E in h)
22
+ l.call(h, E) && !m.hasOwnProperty(E) && (R[E] = h[E]);
23
+ if (T && T.defaultProps)
24
+ for (E in h = T.defaultProps, h)
25
+ R[E] === void 0 && (R[E] = h[E]);
26
+ return { $$typeof: u, type: T, key: P, ref: $, props: R, _owner: f.current };
45
27
  }
46
- head.appendChild(script);
28
+ return D.Fragment = g, D.jsx = j, D.jsxs = j, D;
29
+ }
30
+ var I = {};
31
+ /**
32
+ * @license React
33
+ * react-jsx-runtime.development.js
34
+ *
35
+ * Copyright (c) Facebook, Inc. and its affiliates.
36
+ *
37
+ * This source code is licensed under the MIT license found in the
38
+ * LICENSE file in the root directory of this source tree.
39
+ */
40
+ var we;
41
+ function cr() {
42
+ return we || (we = 1, process.env.NODE_ENV !== "production" && function() {
43
+ var t = Se, u = Symbol.for("react.element"), g = Symbol.for("react.portal"), l = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), j = Symbol.for("react.provider"), T = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), R = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), $ = Symbol.for("react.offscreen"), X = Symbol.iterator, Oe = "@@iterator";
44
+ function Ce(e) {
45
+ if (e === null || typeof e != "object")
46
+ return null;
47
+ var r = X && e[X] || e[Oe];
48
+ return typeof r == "function" ? r : null;
49
+ }
50
+ var C = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
51
+ function p(e) {
52
+ {
53
+ for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), a = 1; a < r; a++)
54
+ n[a - 1] = arguments[a];
55
+ ke("error", e, n);
56
+ }
57
+ }
58
+ function ke(e, r, n) {
59
+ {
60
+ var a = C.ReactDebugCurrentFrame, s = a.getStackAddendum();
61
+ s !== "" && (r += "%s", n = n.concat([s]));
62
+ var c = n.map(function(i) {
63
+ return String(i);
64
+ });
65
+ c.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, c);
66
+ }
67
+ }
68
+ var xe = !1, je = !1, Ae = !1, Fe = !1, De = !1, Z;
69
+ Z = Symbol.for("react.module.reference");
70
+ function Ie(e) {
71
+ return !!(typeof e == "string" || typeof e == "function" || e === l || e === m || De || e === f || e === O || e === E || Fe || e === $ || xe || je || Ae || typeof e == "object" && e !== null && (e.$$typeof === P || e.$$typeof === R || e.$$typeof === j || e.$$typeof === T || e.$$typeof === h || // This needs to include all possible module reference object
72
+ // types supported by any Flight configuration anywhere since
73
+ // we don't know which Flight build this will end up being used
74
+ // with.
75
+ e.$$typeof === Z || e.getModuleId !== void 0));
76
+ }
77
+ function $e(e, r, n) {
78
+ var a = e.displayName;
79
+ if (a)
80
+ return a;
81
+ var s = r.displayName || r.name || "";
82
+ return s !== "" ? n + "(" + s + ")" : n;
83
+ }
84
+ function Q(e) {
85
+ return e.displayName || "Context";
86
+ }
87
+ function _(e) {
88
+ if (e == null)
89
+ return null;
90
+ if (typeof e.tag == "number" && p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
91
+ return e.displayName || e.name || null;
92
+ if (typeof e == "string")
93
+ return e;
94
+ switch (e) {
95
+ case l:
96
+ return "Fragment";
97
+ case g:
98
+ return "Portal";
99
+ case m:
100
+ return "Profiler";
101
+ case f:
102
+ return "StrictMode";
103
+ case O:
104
+ return "Suspense";
105
+ case E:
106
+ return "SuspenseList";
107
+ }
108
+ if (typeof e == "object")
109
+ switch (e.$$typeof) {
110
+ case T:
111
+ var r = e;
112
+ return Q(r) + ".Consumer";
113
+ case j:
114
+ var n = e;
115
+ return Q(n._context) + ".Provider";
116
+ case h:
117
+ return $e(e, e.render, "ForwardRef");
118
+ case R:
119
+ var a = e.displayName || null;
120
+ return a !== null ? a : _(e.type) || "Memo";
121
+ case P: {
122
+ var s = e, c = s._payload, i = s._init;
123
+ try {
124
+ return _(i(c));
125
+ } catch {
126
+ return null;
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+ var S = Object.assign, A = 0, ee, re, ne, te, ae, oe, ie;
133
+ function ue() {
134
+ }
135
+ ue.__reactDisabledLog = !0;
136
+ function We() {
137
+ {
138
+ if (A === 0) {
139
+ ee = console.log, re = console.info, ne = console.warn, te = console.error, ae = console.group, oe = console.groupCollapsed, ie = console.groupEnd;
140
+ var e = {
141
+ configurable: !0,
142
+ enumerable: !0,
143
+ value: ue,
144
+ writable: !0
145
+ };
146
+ Object.defineProperties(console, {
147
+ info: e,
148
+ log: e,
149
+ warn: e,
150
+ error: e,
151
+ group: e,
152
+ groupCollapsed: e,
153
+ groupEnd: e
154
+ });
155
+ }
156
+ A++;
157
+ }
158
+ }
159
+ function Be() {
160
+ {
161
+ if (A--, A === 0) {
162
+ var e = {
163
+ configurable: !0,
164
+ enumerable: !0,
165
+ writable: !0
166
+ };
167
+ Object.defineProperties(console, {
168
+ log: S({}, e, {
169
+ value: ee
170
+ }),
171
+ info: S({}, e, {
172
+ value: re
173
+ }),
174
+ warn: S({}, e, {
175
+ value: ne
176
+ }),
177
+ error: S({}, e, {
178
+ value: te
179
+ }),
180
+ group: S({}, e, {
181
+ value: ae
182
+ }),
183
+ groupCollapsed: S({}, e, {
184
+ value: oe
185
+ }),
186
+ groupEnd: S({}, e, {
187
+ value: ie
188
+ })
189
+ });
190
+ }
191
+ A < 0 && p("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
192
+ }
193
+ }
194
+ var N = C.ReactCurrentDispatcher, U;
195
+ function W(e, r, n) {
196
+ {
197
+ if (U === void 0)
198
+ try {
199
+ throw Error();
200
+ } catch (s) {
201
+ var a = s.stack.trim().match(/\n( *(at )?)/);
202
+ U = a && a[1] || "";
203
+ }
204
+ return `
205
+ ` + U + e;
206
+ }
207
+ }
208
+ var V = !1, B;
209
+ {
210
+ var Me = typeof WeakMap == "function" ? WeakMap : Map;
211
+ B = new Me();
212
+ }
213
+ function le(e, r) {
214
+ if (!e || V)
215
+ return "";
216
+ {
217
+ var n = B.get(e);
218
+ if (n !== void 0)
219
+ return n;
220
+ }
221
+ var a;
222
+ V = !0;
223
+ var s = Error.prepareStackTrace;
224
+ Error.prepareStackTrace = void 0;
225
+ var c;
226
+ c = N.current, N.current = null, We();
227
+ try {
228
+ if (r) {
229
+ var i = function() {
230
+ throw Error();
231
+ };
232
+ if (Object.defineProperty(i.prototype, "props", {
233
+ set: function() {
234
+ throw Error();
235
+ }
236
+ }), typeof Reflect == "object" && Reflect.construct) {
237
+ try {
238
+ Reflect.construct(i, []);
239
+ } catch (w) {
240
+ a = w;
241
+ }
242
+ Reflect.construct(e, [], i);
243
+ } else {
244
+ try {
245
+ i.call();
246
+ } catch (w) {
247
+ a = w;
248
+ }
249
+ e.call(i.prototype);
250
+ }
251
+ } else {
252
+ try {
253
+ throw Error();
254
+ } catch (w) {
255
+ a = w;
256
+ }
257
+ e();
258
+ }
259
+ } catch (w) {
260
+ if (w && a && typeof w.stack == "string") {
261
+ for (var o = w.stack.split(`
262
+ `), y = a.stack.split(`
263
+ `), d = o.length - 1, v = y.length - 1; d >= 1 && v >= 0 && o[d] !== y[v]; )
264
+ v--;
265
+ for (; d >= 1 && v >= 0; d--, v--)
266
+ if (o[d] !== y[v]) {
267
+ if (d !== 1 || v !== 1)
268
+ do
269
+ if (d--, v--, v < 0 || o[d] !== y[v]) {
270
+ var b = `
271
+ ` + o[d].replace(" at new ", " at ");
272
+ return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && B.set(e, b), b;
273
+ }
274
+ while (d >= 1 && v >= 0);
275
+ break;
276
+ }
277
+ }
278
+ } finally {
279
+ V = !1, N.current = c, Be(), Error.prepareStackTrace = s;
280
+ }
281
+ var x = e ? e.displayName || e.name : "", Re = x ? W(x) : "";
282
+ return typeof e == "function" && B.set(e, Re), Re;
283
+ }
284
+ function Ye(e, r, n) {
285
+ return le(e, !1);
286
+ }
287
+ function Le(e) {
288
+ var r = e.prototype;
289
+ return !!(r && r.isReactComponent);
290
+ }
291
+ function M(e, r, n) {
292
+ if (e == null)
293
+ return "";
294
+ if (typeof e == "function")
295
+ return le(e, Le(e));
296
+ if (typeof e == "string")
297
+ return W(e);
298
+ switch (e) {
299
+ case O:
300
+ return W("Suspense");
301
+ case E:
302
+ return W("SuspenseList");
303
+ }
304
+ if (typeof e == "object")
305
+ switch (e.$$typeof) {
306
+ case h:
307
+ return Ye(e.render);
308
+ case R:
309
+ return M(e.type, r, n);
310
+ case P: {
311
+ var a = e, s = a._payload, c = a._init;
312
+ try {
313
+ return M(c(s), r, n);
314
+ } catch {
315
+ }
316
+ }
317
+ }
318
+ return "";
319
+ }
320
+ var Y = Object.prototype.hasOwnProperty, se = {}, ce = C.ReactDebugCurrentFrame;
321
+ function L(e) {
322
+ if (e) {
323
+ var r = e._owner, n = M(e.type, e._source, r ? r.type : null);
324
+ ce.setExtraStackFrame(n);
325
+ } else
326
+ ce.setExtraStackFrame(null);
327
+ }
328
+ function Ne(e, r, n, a, s) {
329
+ {
330
+ var c = Function.call.bind(Y);
331
+ for (var i in e)
332
+ if (c(e, i)) {
333
+ var o = void 0;
334
+ try {
335
+ if (typeof e[i] != "function") {
336
+ var y = Error((a || "React class") + ": " + n + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
337
+ throw y.name = "Invariant Violation", y;
338
+ }
339
+ o = e[i](r, i, a, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
340
+ } catch (d) {
341
+ o = d;
342
+ }
343
+ o && !(o instanceof Error) && (L(s), p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", a || "React class", n, i, typeof o), L(null)), o instanceof Error && !(o.message in se) && (se[o.message] = !0, L(s), p("Failed %s type: %s", n, o.message), L(null));
344
+ }
345
+ }
346
+ }
347
+ var Ue = Array.isArray;
348
+ function z(e) {
349
+ return Ue(e);
350
+ }
351
+ function Ve(e) {
352
+ {
353
+ var r = typeof Symbol == "function" && Symbol.toStringTag, n = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
354
+ return n;
355
+ }
356
+ }
357
+ function ze(e) {
358
+ try {
359
+ return fe(e), !1;
360
+ } catch {
361
+ return !0;
362
+ }
363
+ }
364
+ function fe(e) {
365
+ return "" + e;
366
+ }
367
+ function de(e) {
368
+ if (ze(e))
369
+ return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ve(e)), fe(e);
370
+ }
371
+ var F = C.ReactCurrentOwner, qe = {
372
+ key: !0,
373
+ ref: !0,
374
+ __self: !0,
375
+ __source: !0
376
+ }, ve, ge, q;
377
+ q = {};
378
+ function Je(e) {
379
+ if (Y.call(e, "ref")) {
380
+ var r = Object.getOwnPropertyDescriptor(e, "ref").get;
381
+ if (r && r.isReactWarning)
382
+ return !1;
383
+ }
384
+ return e.ref !== void 0;
385
+ }
386
+ function Ge(e) {
387
+ if (Y.call(e, "key")) {
388
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
389
+ if (r && r.isReactWarning)
390
+ return !1;
391
+ }
392
+ return e.key !== void 0;
393
+ }
394
+ function He(e, r) {
395
+ if (typeof e.ref == "string" && F.current && r && F.current.stateNode !== r) {
396
+ var n = _(F.current.type);
397
+ q[n] || (p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', _(F.current.type), e.ref), q[n] = !0);
398
+ }
399
+ }
400
+ function Ke(e, r) {
401
+ {
402
+ var n = function() {
403
+ ve || (ve = !0, p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
404
+ };
405
+ n.isReactWarning = !0, Object.defineProperty(e, "key", {
406
+ get: n,
407
+ configurable: !0
408
+ });
409
+ }
410
+ }
411
+ function Xe(e, r) {
412
+ {
413
+ var n = function() {
414
+ ge || (ge = !0, p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
415
+ };
416
+ n.isReactWarning = !0, Object.defineProperty(e, "ref", {
417
+ get: n,
418
+ configurable: !0
419
+ });
420
+ }
421
+ }
422
+ var Ze = function(e, r, n, a, s, c, i) {
423
+ var o = {
424
+ // This tag allows us to uniquely identify this as a React Element
425
+ $$typeof: u,
426
+ // Built-in properties that belong on the element
427
+ type: e,
428
+ key: r,
429
+ ref: n,
430
+ props: i,
431
+ // Record the component responsible for creating this element.
432
+ _owner: c
433
+ };
434
+ return o._store = {}, Object.defineProperty(o._store, "validated", {
435
+ configurable: !1,
436
+ enumerable: !1,
437
+ writable: !0,
438
+ value: !1
439
+ }), Object.defineProperty(o, "_self", {
440
+ configurable: !1,
441
+ enumerable: !1,
442
+ writable: !1,
443
+ value: a
444
+ }), Object.defineProperty(o, "_source", {
445
+ configurable: !1,
446
+ enumerable: !1,
447
+ writable: !1,
448
+ value: s
449
+ }), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
450
+ };
451
+ function Qe(e, r, n, a, s) {
452
+ {
453
+ var c, i = {}, o = null, y = null;
454
+ n !== void 0 && (de(n), o = "" + n), Ge(r) && (de(r.key), o = "" + r.key), Je(r) && (y = r.ref, He(r, s));
455
+ for (c in r)
456
+ Y.call(r, c) && !qe.hasOwnProperty(c) && (i[c] = r[c]);
457
+ if (e && e.defaultProps) {
458
+ var d = e.defaultProps;
459
+ for (c in d)
460
+ i[c] === void 0 && (i[c] = d[c]);
461
+ }
462
+ if (o || y) {
463
+ var v = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
464
+ o && Ke(i, v), y && Xe(i, v);
465
+ }
466
+ return Ze(e, o, y, s, a, F.current, i);
467
+ }
468
+ }
469
+ var J = C.ReactCurrentOwner, he = C.ReactDebugCurrentFrame;
470
+ function k(e) {
471
+ if (e) {
472
+ var r = e._owner, n = M(e.type, e._source, r ? r.type : null);
473
+ he.setExtraStackFrame(n);
474
+ } else
475
+ he.setExtraStackFrame(null);
476
+ }
477
+ var G;
478
+ G = !1;
479
+ function H(e) {
480
+ return typeof e == "object" && e !== null && e.$$typeof === u;
481
+ }
482
+ function pe() {
483
+ {
484
+ if (J.current) {
485
+ var e = _(J.current.type);
486
+ if (e)
487
+ return `
488
+
489
+ Check the render method of \`` + e + "`.";
490
+ }
491
+ return "";
492
+ }
493
+ }
494
+ function er(e) {
495
+ {
496
+ if (e !== void 0) {
497
+ var r = e.fileName.replace(/^.*[\\\/]/, ""), n = e.lineNumber;
498
+ return `
499
+
500
+ Check your code at ` + r + ":" + n + ".";
501
+ }
502
+ return "";
503
+ }
504
+ }
505
+ var ye = {};
506
+ function rr(e) {
507
+ {
508
+ var r = pe();
509
+ if (!r) {
510
+ var n = typeof e == "string" ? e : e.displayName || e.name;
511
+ n && (r = `
512
+
513
+ Check the top-level render call using <` + n + ">.");
514
+ }
515
+ return r;
516
+ }
517
+ }
518
+ function Ee(e, r) {
519
+ {
520
+ if (!e._store || e._store.validated || e.key != null)
521
+ return;
522
+ e._store.validated = !0;
523
+ var n = rr(r);
524
+ if (ye[n])
525
+ return;
526
+ ye[n] = !0;
527
+ var a = "";
528
+ e && e._owner && e._owner !== J.current && (a = " It was passed a child from " + _(e._owner.type) + "."), k(e), p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, a), k(null);
529
+ }
530
+ }
531
+ function be(e, r) {
532
+ {
533
+ if (typeof e != "object")
534
+ return;
535
+ if (z(e))
536
+ for (var n = 0; n < e.length; n++) {
537
+ var a = e[n];
538
+ H(a) && Ee(a, r);
539
+ }
540
+ else if (H(e))
541
+ e._store && (e._store.validated = !0);
542
+ else if (e) {
543
+ var s = Ce(e);
544
+ if (typeof s == "function" && s !== e.entries)
545
+ for (var c = s.call(e), i; !(i = c.next()).done; )
546
+ H(i.value) && Ee(i.value, r);
547
+ }
548
+ }
549
+ }
550
+ function nr(e) {
551
+ {
552
+ var r = e.type;
553
+ if (r == null || typeof r == "string")
554
+ return;
555
+ var n;
556
+ if (typeof r == "function")
557
+ n = r.propTypes;
558
+ else if (typeof r == "object" && (r.$$typeof === h || // Note: Memo only checks outer props here.
559
+ // Inner props are checked in the reconciler.
560
+ r.$$typeof === R))
561
+ n = r.propTypes;
562
+ else
563
+ return;
564
+ if (n) {
565
+ var a = _(r);
566
+ Ne(n, e.props, "prop", a, e);
567
+ } else if (r.PropTypes !== void 0 && !G) {
568
+ G = !0;
569
+ var s = _(r);
570
+ p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", s || "Unknown");
571
+ }
572
+ typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
573
+ }
574
+ }
575
+ function tr(e) {
576
+ {
577
+ for (var r = Object.keys(e.props), n = 0; n < r.length; n++) {
578
+ var a = r[n];
579
+ if (a !== "children" && a !== "key") {
580
+ k(e), p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", a), k(null);
581
+ break;
582
+ }
583
+ }
584
+ e.ref !== null && (k(e), p("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
585
+ }
586
+ }
587
+ function me(e, r, n, a, s, c) {
588
+ {
589
+ var i = Ie(e);
590
+ if (!i) {
591
+ var o = "";
592
+ (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (o += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
593
+ var y = er(s);
594
+ y ? o += y : o += pe();
595
+ var d;
596
+ e === null ? d = "null" : z(e) ? d = "array" : e !== void 0 && e.$$typeof === u ? (d = "<" + (_(e.type) || "Unknown") + " />", o = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, o);
597
+ }
598
+ var v = Qe(e, r, n, s, c);
599
+ if (v == null)
600
+ return v;
601
+ if (i) {
602
+ var b = r.children;
603
+ if (b !== void 0)
604
+ if (a)
605
+ if (z(b)) {
606
+ for (var x = 0; x < b.length; x++)
607
+ be(b[x], e);
608
+ Object.freeze && Object.freeze(b);
609
+ } else
610
+ p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
611
+ else
612
+ be(b, e);
613
+ }
614
+ return e === l ? tr(v) : nr(v), v;
615
+ }
616
+ }
617
+ function ar(e, r, n) {
618
+ return me(e, r, n, !0);
619
+ }
620
+ function or(e, r, n) {
621
+ return me(e, r, n, !1);
622
+ }
623
+ var ir = or, ur = ar;
624
+ I.Fragment = l, I.jsx = ir, I.jsxs = ur;
625
+ }()), I;
626
+ }
627
+ process.env.NODE_ENV === "production" ? K.exports = sr() : K.exports = cr();
628
+ var fr = K.exports;
629
+ function dr(t) {
630
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
631
+ }
632
+ var vr = function(t, u, g) {
633
+ var l = document.head || document.getElementsByTagName("head")[0], f = document.createElement("script");
634
+ typeof u == "function" && (g = u, u = {}), u = u || {}, g = g || function() {
635
+ }, f.type = u.type || "text/javascript", f.charset = u.charset || "utf8", f.async = "async" in u ? !!u.async : !0, f.src = t, u.attrs && gr(f, u.attrs), u.text && (f.text = "" + u.text);
636
+ var m = "onload" in f ? Te : hr;
637
+ m(f, g), f.onload || Te(f, g), l.appendChild(f);
47
638
  };
48
- function setAttributes(script, attrs) {
49
- for (var attr in attrs) {
50
- script.setAttribute(attr, attrs[attr]);
51
- }
639
+ function gr(t, u) {
640
+ for (var g in u)
641
+ t.setAttribute(g, u[g]);
52
642
  }
53
- function stdOnEnd(script, cb) {
54
- script.onload = function() {
55
- this.onerror = this.onload = null;
56
- cb(null, script);
57
- };
58
- script.onerror = function() {
59
- this.onerror = this.onload = null;
60
- cb(new Error("Failed to load " + this.src), script);
643
+ function Te(t, u) {
644
+ t.onload = function() {
645
+ this.onerror = this.onload = null, u(null, t);
646
+ }, t.onerror = function() {
647
+ this.onerror = this.onload = null, u(new Error("Failed to load " + this.src), t);
61
648
  };
62
649
  }
63
- function ieOnEnd(script, cb) {
64
- script.onreadystatechange = function() {
65
- if (this.readyState != "complete" && this.readyState != "loaded")
66
- return;
67
- this.onreadystatechange = null;
68
- cb(null, script);
650
+ function hr(t, u) {
651
+ t.onreadystatechange = function() {
652
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, u(null, t));
69
653
  };
70
654
  }
71
- const TOPOL_URL = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js";
72
- const TOPOL_DEV_URL = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js";
73
- const TopolPlugin = {
74
- init: (topolOptions, options) => {
75
- return new Promise((resolve, reject) => {
76
- const topolURl = (options == null ? void 0 : options.dev) === true ? TOPOL_DEV_URL : TOPOL_URL;
77
- loadScript(topolURl, (err) => {
78
- if (err !== null) {
79
- reject(err);
80
- }
81
- window.TopolPlugin.init(topolOptions);
82
- resolve(true);
83
- });
655
+ const pr = /* @__PURE__ */ dr(vr), yr = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", Er = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", br = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
656
+ function mr(t = "production") {
657
+ switch (t) {
658
+ case "dev":
659
+ return Er;
660
+ case "staging":
661
+ return br;
662
+ default:
663
+ return yr;
664
+ }
665
+ }
666
+ const Pe = {
667
+ init: (t, u) => new Promise((g, l) => {
668
+ const f = mr(u == null ? void 0 : u.stage);
669
+ pr(f, (m) => {
670
+ m !== null && l(m), window.TopolPlugin.init(t), g(!0);
84
671
  });
85
- },
672
+ }),
86
673
  save: () => {
87
674
  window.TopolPlugin.save();
88
675
  },
89
- load: (json) => {
90
- window.TopolPlugin.load(json);
676
+ load: (t) => {
677
+ window.TopolPlugin.load(t);
91
678
  },
92
679
  togglePreview: () => {
93
680
  window.TopolPlugin.togglePreview();
@@ -95,8 +682,8 @@ const TopolPlugin = {
95
682
  togglePreviewSize: () => {
96
683
  window.TopolPlugin.togglePreviewSize();
97
684
  },
98
- chooseFile: (url) => {
99
- window.TopolPlugin.chooseFile(url);
685
+ chooseFile: (t) => {
686
+ window.TopolPlugin.chooseFile(t);
100
687
  },
101
688
  undo: () => {
102
689
  window.TopolPlugin.undo();
@@ -104,11 +691,11 @@ const TopolPlugin = {
104
691
  redo: () => {
105
692
  window.TopolPlugin.redo();
106
693
  },
107
- setSavedBlocks: (savedBlocks) => {
108
- window.TopolPlugin.setSavedBlocks(savedBlocks);
694
+ setSavedBlocks: (t) => {
695
+ window.TopolPlugin.setSavedBlocks(t);
109
696
  },
110
- createNotification: (notification) => {
111
- window.TopolPlugin.createNotification(notification);
697
+ createNotification: (t) => {
698
+ window.TopolPlugin.createNotification(t);
112
699
  },
113
700
  changeEmailToMobile: () => {
114
701
  window.TopolPlugin.changeEmailToMobile();
@@ -122,206 +709,60 @@ const TopolPlugin = {
122
709
  destroy: () => {
123
710
  window.TopolPlugin.destroy();
124
711
  }
125
- };
126
- var jsxRuntime = { exports: {} };
127
- var reactJsxRuntime_production_min = {};
128
- /*
129
- object-assign
130
- (c) Sindre Sorhus
131
- @license MIT
132
- */
133
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
134
- var hasOwnProperty = Object.prototype.hasOwnProperty;
135
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
136
- function toObject(val) {
137
- if (val === null || val === void 0) {
138
- throw new TypeError("Object.assign cannot be called with null or undefined");
139
- }
140
- return Object(val);
141
- }
142
- function shouldUseNative() {
143
- try {
144
- if (!Object.assign) {
145
- return false;
146
- }
147
- var test1 = new String("abc");
148
- test1[5] = "de";
149
- if (Object.getOwnPropertyNames(test1)[0] === "5") {
150
- return false;
151
- }
152
- var test2 = {};
153
- for (var i = 0; i < 10; i++) {
154
- test2["_" + String.fromCharCode(i)] = i;
155
- }
156
- var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
157
- return test2[n2];
158
- });
159
- if (order2.join("") !== "0123456789") {
160
- return false;
161
- }
162
- var test3 = {};
163
- "abcdefghijklmnopqrst".split("").forEach(function(letter) {
164
- test3[letter] = letter;
165
- });
166
- if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
167
- return false;
168
- }
169
- return true;
170
- } catch (err) {
171
- return false;
172
- }
173
- }
174
- shouldUseNative() ? Object.assign : function(target, source) {
175
- var from;
176
- var to = toObject(target);
177
- var symbols;
178
- for (var s = 1; s < arguments.length; s++) {
179
- from = Object(arguments[s]);
180
- for (var key in from) {
181
- if (hasOwnProperty.call(from, key)) {
182
- to[key] = from[key];
183
- }
184
- }
185
- if (getOwnPropertySymbols) {
186
- symbols = getOwnPropertySymbols(from);
187
- for (var i = 0; i < symbols.length; i++) {
188
- if (propIsEnumerable.call(from, symbols[i])) {
189
- to[symbols[i]] = from[symbols[i]];
190
- }
191
- }
192
- }
193
- }
194
- return to;
195
- };
196
- /** @license React v17.0.2
197
- * react-jsx-runtime.production.min.js
198
- *
199
- * Copyright (c) Facebook, Inc. and its affiliates.
200
- *
201
- * This source code is licensed under the MIT license found in the
202
- * LICENSE file in the root directory of this source tree.
203
- */
204
- var f = require$$0, g = 60103;
205
- reactJsxRuntime_production_min.Fragment = 60107;
206
- if (typeof Symbol === "function" && Symbol.for) {
207
- var h = Symbol.for;
208
- g = h("react.element");
209
- reactJsxRuntime_production_min.Fragment = h("react.fragment");
210
- }
211
- var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
212
- function q(c, a, k) {
213
- var b, d = {}, e = null, l = null;
214
- k !== void 0 && (e = "" + k);
215
- a.key !== void 0 && (e = "" + a.key);
216
- a.ref !== void 0 && (l = a.ref);
217
- for (b in a)
218
- n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
219
- if (c && c.defaultProps)
220
- for (b in a = c.defaultProps, a)
221
- d[b] === void 0 && (d[b] = a[b]);
222
- return { $$typeof: g, type: c, key: e, ref: l, props: d, _owner: m.current };
223
- }
224
- reactJsxRuntime_production_min.jsx = q;
225
- reactJsxRuntime_production_min.jsxs = q;
226
- {
227
- jsxRuntime.exports = reactJsxRuntime_production_min;
228
- }
229
- const jsx = jsxRuntime.exports.jsx;
230
- const EDITOR_HTML_ID = "editor";
231
- function TopolEditor(props) {
232
- const mergeOptions = () => {
233
- const callbacks = {
234
- onSave(json, html) {
235
- if (props.onSave !== void 0) {
236
- props.onSave(json, html);
237
- }
712
+ }, Rr = "editor";
713
+ function wr(t) {
714
+ const u = () => {
715
+ const g = {
716
+ onSave(l, f) {
717
+ t.onSave !== void 0 && t.onSave(l, f);
238
718
  },
239
- onSaveAndClose(json, html) {
240
- if (props.onSaveAndClose !== void 0) {
241
- props.onSaveAndClose(json, html);
242
- }
719
+ onSaveAndClose(l, f) {
720
+ t.onSaveAndClose !== void 0 && t.onSaveAndClose(l, f);
243
721
  },
244
- onTestSend(email, json, html) {
245
- if (props.onTestSend !== void 0) {
246
- props.onTestSend(email, json, html);
247
- }
722
+ onTestSend(l, f, m) {
723
+ t.onTestSend !== void 0 && t.onTestSend(l, f, m);
248
724
  },
249
725
  onOpenFileManager() {
250
- if (props.onOpenFileManager !== void 0) {
251
- props.onOpenFileManager();
252
- }
726
+ t.onOpenFileManager !== void 0 && t.onOpenFileManager();
253
727
  },
254
728
  onLoaded() {
255
- if (props.onLoaded !== void 0) {
256
- props.onLoaded();
257
- }
729
+ t.onLoaded !== void 0 && t.onLoaded();
258
730
  },
259
- onBlockSave(block) {
260
- if (props.onBlockSave !== void 0) {
261
- props.onBlockSave(block);
262
- }
731
+ onBlockSave(l) {
732
+ t.onBlockSave !== void 0 && t.onBlockSave(l);
263
733
  },
264
- onBlockRemove(blockId) {
265
- if (props.onBlockRemove !== void 0) {
266
- props.onBlockRemove(blockId);
267
- }
734
+ onBlockRemove(l) {
735
+ t.onBlockRemove !== void 0 && t.onBlockRemove(l);
268
736
  },
269
- onBlockEdit(blockId) {
270
- if (props.onBlockEdit !== void 0) {
271
- props.onBlockEdit(blockId);
272
- }
737
+ onBlockEdit(l) {
738
+ t.onBlockEdit !== void 0 && t.onBlockEdit(l);
273
739
  },
274
740
  onInit() {
275
- if (props.onInit !== void 0) {
276
- props.onInit();
277
- }
741
+ t.onInit !== void 0 && t.onInit();
278
742
  },
279
- onUndoChange(count) {
280
- if (props.onUndoChange !== void 0) {
281
- props.onUndoChange(count);
282
- }
743
+ onUndoChange(l) {
744
+ t.onUndoChange !== void 0 && t.onUndoChange(l);
283
745
  },
284
- onRedoChange(count) {
285
- if (props.onRedoChange !== void 0) {
286
- props.onRedoChange(count);
287
- }
746
+ onRedoChange(l) {
747
+ t.onRedoChange !== void 0 && t.onRedoChange(l);
288
748
  },
289
- onPreview(html) {
290
- if (props.onPreview !== void 0) {
291
- props.onPreview(html);
292
- }
749
+ onPreview(l) {
750
+ t.onPreview !== void 0 && t.onPreview(l);
293
751
  },
294
- onAlert(notification) {
295
- if (props.onAlert !== void 0) {
296
- props.onAlert(notification);
297
- }
752
+ onAlert(l) {
753
+ t.onAlert !== void 0 && t.onAlert(l);
298
754
  }
299
755
  };
300
- return __spreadProps(__spreadValues({
301
- id: "#" + EDITOR_HTML_ID
302
- }, props.options), {
303
- callbacks: __spreadValues({}, callbacks)
304
- });
756
+ return { id: "#" + Rr, ...t.options, callbacks: { ...g } };
305
757
  };
306
- useEffect(() => {
307
- const initializeEditor = async () => {
308
- const mergedTopolOptinos = mergeOptions();
309
- await TopolPlugin.init(mergedTopolOptinos, {
310
- dev: props.dev !== void 0 ? props.dev : false
311
- });
312
- };
313
- initializeEditor();
314
- return () => {
315
- TopolPlugin.destroy();
316
- };
317
- }, []);
318
- return /* @__PURE__ */ jsx("div", {
319
- id: "editor",
320
- style: {
321
- position: "absolute",
322
- height: "100vh",
323
- width: "100%"
324
- }
325
- });
758
+ return lr(() => ((async () => {
759
+ const l = u();
760
+ await Pe.init(l, { stage: t.stage || "production" });
761
+ })(), () => {
762
+ Pe.destroy();
763
+ }), []), /* @__PURE__ */ fr.jsx("div", { id: "editor", style: { position: "absolute", height: "100vh", width: "100%" } });
326
764
  }
327
- export { TopolPlugin, TopolEditor as default };
765
+ export {
766
+ Pe as TopolPlugin,
767
+ wr as default
768
+ };
@@ -1,12 +1,27 @@
1
- var M=Object.defineProperty,q=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var P=(l,a,d)=>a in l?M(l,a,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[a]=d,v=(l,a)=>{for(var d in a||(a={}))V.call(a,d)&&P(l,d,a[d]);if(b)for(var d of b(a))$.call(a,d)&&P(l,d,a[d]);return l},T=(l,a)=>q(l,z(a));(function(l,a){typeof exports=="object"&&typeof module!="undefined"?a(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],a):(l=typeof globalThis!="undefined"?globalThis:l||self,a(l["topol-editor-react"]={},l.React))})(this,function(l,a){"use strict";function d(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var S=d(a),j=function(t,o,n){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("script");typeof o=="function"&&(n=o,o={}),o=o||{},n=n||function(){},i.type=o.type||"text/javascript",i.charset=o.charset||"utf8",i.async="async"in o?!!o.async:!0,i.src=t,o.attrs&&_(i,o.attrs),o.text&&(i.text=""+o.text);var u="onload"in i?g:E;u(i,n),i.onload||g(i,n),r.appendChild(i)};function _(e,t){for(var o in t)e.setAttribute(o,t[o])}function g(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function E(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const k="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",R="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",s={init:(e,t)=>new Promise((o,n)=>{const r=(t==null?void 0:t.dev)===!0?R:k;j(r,i=>{i!==null&&n(i),window.TopolPlugin.init(e),o(!0)})}),save:()=>{window.TopolPlugin.save()},load:e=>{window.TopolPlugin.load(e)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:e=>{window.TopolPlugin.chooseFile(e)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},setSavedBlocks:e=>{window.TopolPlugin.setSavedBlocks(e)},createNotification:e=>{window.TopolPlugin.createNotification(e)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},destroy:()=>{window.TopolPlugin.destroy()}};var w={exports:{}},c={};/*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */var h=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable;function p(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function x(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var t={},o=0;o<10;o++)t["_"+String.fromCharCode(o)]=o;var n=Object.getOwnPropertyNames(t).map(function(i){return t[i]});if(n.join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(i){r[i]=i}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}x();/** @license React v17.0.2
1
+ (function(w,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],P):(w=typeof globalThis<"u"?globalThis:w||self,P(w["topol-editor-react"]={},w.React))})(this,function(w,P){"use strict";var $={exports:{}},F={};/**
2
+ * @license React
6
3
  * react-jsx-runtime.production.min.js
7
4
  *
8
5
  * Copyright (c) Facebook, Inc. and its affiliates.
9
6
  *
10
7
  * This source code is licensed under the MIT license found in the
11
8
  * LICENSE file in the root directory of this source tree.
12
- */var L=S.default,y=60103;if(c.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var m=Symbol.for;y=m("react.element"),c.Fragment=m("react.fragment")}var A=L.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,I=Object.prototype.hasOwnProperty,F={key:!0,ref:!0,__self:!0,__source:!0};function O(e,t,o){var n,r={},i=null,u=null;o!==void 0&&(i=""+o),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(u=t.ref);for(n in t)I.call(t,n)&&!F.hasOwnProperty(n)&&(r[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps,t)r[n]===void 0&&(r[n]=t[n]);return{$$typeof:y,type:e,key:i,ref:u,props:r,_owner:A.current}}c.jsx=O,c.jsxs=O,w.exports=c;const N=w.exports.jsx,U="editor";function D(e){const t=()=>{const o={onSave(n,r){e.onSave!==void 0&&e.onSave(n,r)},onSaveAndClose(n,r){e.onSaveAndClose!==void 0&&e.onSaveAndClose(n,r)},onTestSend(n,r,i){e.onTestSend!==void 0&&e.onTestSend(n,r,i)},onOpenFileManager(){e.onOpenFileManager!==void 0&&e.onOpenFileManager()},onLoaded(){e.onLoaded!==void 0&&e.onLoaded()},onBlockSave(n){e.onBlockSave!==void 0&&e.onBlockSave(n)},onBlockRemove(n){e.onBlockRemove!==void 0&&e.onBlockRemove(n)},onBlockEdit(n){e.onBlockEdit!==void 0&&e.onBlockEdit(n)},onInit(){e.onInit!==void 0&&e.onInit()},onUndoChange(n){e.onUndoChange!==void 0&&e.onUndoChange(n)},onRedoChange(n){e.onRedoChange!==void 0&&e.onRedoChange(n)},onPreview(n){e.onPreview!==void 0&&e.onPreview(n)},onAlert(n){e.onAlert!==void 0&&e.onAlert(n)}};return T(v({id:"#"+U},e.options),{callbacks:v({},o)})};return a.useEffect(()=>((async()=>{const n=t();await s.init(n,{dev:e.dev!==void 0?e.dev:!1})})(),()=>{s.destroy()}),[]),N("div",{id:"editor",style:{position:"absolute",height:"100vh",width:"100%"}})}l.TopolPlugin=s,l.default=D,Object.defineProperty(l,"__esModule",{value:!0}),l[Symbol.toStringTag]="Module"});
9
+ */var ee;function Ce(){if(ee)return F;ee=1;var t=P,u=Symbol.for("react.element"),g=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,f=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,m={key:!0,ref:!0,__self:!0,__source:!0};function I(S,h,k){var b,R={},O=null,B=null;k!==void 0&&(O=""+k),h.key!==void 0&&(O=""+h.key),h.ref!==void 0&&(B=h.ref);for(b in h)l.call(h,b)&&!m.hasOwnProperty(b)&&(R[b]=h[b]);if(S&&S.defaultProps)for(b in h=S.defaultProps,h)R[b]===void 0&&(R[b]=h[b]);return{$$typeof:u,type:S,key:O,ref:B,props:R,_owner:f.current}}return F.Fragment=g,F.jsx=I,F.jsxs=I,F}var D={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var re;function ke(){return re||(re=1,process.env.NODE_ENV!=="production"&&function(){var t=P,u=Symbol.for("react.element"),g=Symbol.for("react.portal"),l=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),m=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),S=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),B=Symbol.for("react.offscreen"),te=Symbol.iterator,Ue="@@iterator";function Ve(e){if(e===null||typeof e!="object")return null;var r=te&&e[te]||e[Ue];return typeof r=="function"?r:null}var j=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function p(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];$e("error",e,n)}}function $e(e,r,n){{var o=j.ReactDebugCurrentFrame,s=o.getStackAddendum();s!==""&&(r+="%s",n=n.concat([s]));var c=n.map(function(i){return String(i)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var ze=!1,Je=!1,qe=!1,Ge=!1,He=!1,oe;oe=Symbol.for("react.module.reference");function Ke(e){return!!(typeof e=="string"||typeof e=="function"||e===l||e===m||He||e===f||e===k||e===b||Ge||e===B||ze||Je||qe||typeof e=="object"&&e!==null&&(e.$$typeof===O||e.$$typeof===R||e.$$typeof===I||e.$$typeof===S||e.$$typeof===h||e.$$typeof===oe||e.getModuleId!==void 0))}function Xe(e,r,n){var o=e.displayName;if(o)return o;var s=r.displayName||r.name||"";return s!==""?n+"("+s+")":n}function ae(e){return e.displayName||"Context"}function _(e){if(e==null)return null;if(typeof e.tag=="number"&&p("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case l:return"Fragment";case g:return"Portal";case m:return"Profiler";case f:return"StrictMode";case k:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case S:var r=e;return ae(r)+".Consumer";case I:var n=e;return ae(n._context)+".Provider";case h:return Xe(e,e.render,"ForwardRef");case R:var o=e.displayName||null;return o!==null?o:_(e.type)||"Memo";case O:{var s=e,c=s._payload,i=s._init;try{return _(i(c))}catch{return null}}}return null}var C=Object.assign,M=0,ie,ue,le,se,ce,fe,de;function ve(){}ve.__reactDisabledLog=!0;function Ze(){{if(M===0){ie=console.log,ue=console.info,le=console.warn,se=console.error,ce=console.group,fe=console.groupCollapsed,de=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ve,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}M++}}function Qe(){{if(M--,M===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:C({},e,{value:ie}),info:C({},e,{value:ue}),warn:C({},e,{value:le}),error:C({},e,{value:se}),group:C({},e,{value:ce}),groupCollapsed:C({},e,{value:fe}),groupEnd:C({},e,{value:de})})}M<0&&p("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var J=j.ReactCurrentDispatcher,q;function Y(e,r,n){{if(q===void 0)try{throw Error()}catch(s){var o=s.stack.trim().match(/\n( *(at )?)/);q=o&&o[1]||""}return`
18
+ `+q+e}}var G=!1,L;{var er=typeof WeakMap=="function"?WeakMap:Map;L=new er}function ge(e,r){if(!e||G)return"";{var n=L.get(e);if(n!==void 0)return n}var o;G=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=J.current,J.current=null,Ze();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(T){o=T}Reflect.construct(e,[],i)}else{try{i.call()}catch(T){o=T}e.call(i.prototype)}}else{try{throw Error()}catch(T){o=T}e()}}catch(T){if(T&&o&&typeof T.stack=="string"){for(var a=T.stack.split(`
19
+ `),y=o.stack.split(`
20
+ `),d=a.length-1,v=y.length-1;d>=1&&v>=0&&a[d]!==y[v];)v--;for(;d>=1&&v>=0;d--,v--)if(a[d]!==y[v]){if(d!==1||v!==1)do if(d--,v--,v<0||a[d]!==y[v]){var E=`
21
+ `+a[d].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),typeof e=="function"&&L.set(e,E),E}while(d>=1&&v>=0);break}}}finally{G=!1,J.current=c,Qe(),Error.prepareStackTrace=s}var A=e?e.displayName||e.name:"",Oe=A?Y(A):"";return typeof e=="function"&&L.set(e,Oe),Oe}function rr(e,r,n){return ge(e,!1)}function nr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function N(e,r,n){if(e==null)return"";if(typeof e=="function")return ge(e,nr(e));if(typeof e=="string")return Y(e);switch(e){case k:return Y("Suspense");case b:return Y("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case h:return rr(e.render);case R:return N(e.type,r,n);case O:{var o=e,s=o._payload,c=o._init;try{return N(c(s),r,n)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,he={},pe=j.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,n=N(e.type,e._source,r?r.type:null);pe.setExtraStackFrame(n)}else pe.setExtraStackFrame(null)}function tr(e,r,n,o,s){{var c=Function.call.bind(U);for(var i in e)if(c(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var y=Error((o||"React class")+": "+n+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw y.name="Invariant Violation",y}a=e[i](r,i,o,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}a&&!(a instanceof Error)&&(V(s),p("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",n,i,typeof a),V(null)),a instanceof Error&&!(a.message in he)&&(he[a.message]=!0,V(s),p("Failed %s type: %s",n,a.message),V(null))}}}var or=Array.isArray;function H(e){return or(e)}function ar(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function ir(e){try{return ye(e),!1}catch{return!0}}function ye(e){return""+e}function be(e){if(ir(e))return p("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ar(e)),ye(e)}var W=j.ReactCurrentOwner,ur={key:!0,ref:!0,__self:!0,__source:!0},Ee,me,K;K={};function lr(e){if(U.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function sr(e){if(U.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function cr(e,r){if(typeof e.ref=="string"&&W.current&&r&&W.current.stateNode!==r){var n=_(W.current.type);K[n]||(p('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',_(W.current.type),e.ref),K[n]=!0)}}function fr(e,r){{var n=function(){Ee||(Ee=!0,p("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function dr(e,r){{var n=function(){me||(me=!0,p("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var vr=function(e,r,n,o,s,c,i){var a={$$typeof:u,type:e,key:r,ref:n,props:i,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function gr(e,r,n,o,s){{var c,i={},a=null,y=null;n!==void 0&&(be(n),a=""+n),sr(r)&&(be(r.key),a=""+r.key),lr(r)&&(y=r.ref,cr(r,s));for(c in r)U.call(r,c)&&!ur.hasOwnProperty(c)&&(i[c]=r[c]);if(e&&e.defaultProps){var d=e.defaultProps;for(c in d)i[c]===void 0&&(i[c]=d[c])}if(a||y){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&fr(i,v),y&&dr(i,v)}return vr(e,a,y,s,o,W.current,i)}}var X=j.ReactCurrentOwner,Re=j.ReactDebugCurrentFrame;function x(e){if(e){var r=e._owner,n=N(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(n)}else Re.setExtraStackFrame(null)}var Z;Z=!1;function Q(e){return typeof e=="object"&&e!==null&&e.$$typeof===u}function _e(){{if(X.current){var e=_(X.current.type);if(e)return`
22
+
23
+ Check the render method of \``+e+"`."}return""}}function hr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),n=e.lineNumber;return`
24
+
25
+ Check your code at `+r+":"+n+"."}return""}}var Te={};function pr(e){{var r=_e();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
26
+
27
+ Check the top-level render call using <`+n+">.")}return r}}function we(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=pr(r);if(Te[n])return;Te[n]=!0;var o="";e&&e._owner&&e._owner!==X.current&&(o=" It was passed a child from "+_(e._owner.type)+"."),x(e),p('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,o),x(null)}}function Pe(e,r){{if(typeof e!="object")return;if(H(e))for(var n=0;n<e.length;n++){var o=e[n];Q(o)&&we(o,r)}else if(Q(e))e._store&&(e._store.validated=!0);else if(e){var s=Ve(e);if(typeof s=="function"&&s!==e.entries)for(var c=s.call(e),i;!(i=c.next()).done;)Q(i.value)&&we(i.value,r)}}}function yr(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===h||r.$$typeof===R))n=r.propTypes;else return;if(n){var o=_(r);tr(n,e.props,"prop",o,e)}else if(r.PropTypes!==void 0&&!Z){Z=!0;var s=_(r);p("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",s||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&p("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function br(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var o=r[n];if(o!=="children"&&o!=="key"){x(e),p("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),x(null);break}}e.ref!==null&&(x(e),p("Invalid attribute `ref` supplied to `React.Fragment`."),x(null))}}function Se(e,r,n,o,s,c){{var i=Ke(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var y=hr(s);y?a+=y:a+=_e();var d;e===null?d="null":H(e)?d="array":e!==void 0&&e.$$typeof===u?(d="<"+(_(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,p("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,a)}var v=gr(e,r,n,s,c);if(v==null)return v;if(i){var E=r.children;if(E!==void 0)if(o)if(H(E)){for(var A=0;A<E.length;A++)Pe(E[A],e);Object.freeze&&Object.freeze(E)}else p("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Pe(E,e)}return e===l?br(v):yr(v),v}}function Er(e,r,n){return Se(e,r,n,!0)}function mr(e,r,n){return Se(e,r,n,!1)}var Rr=mr,_r=Er;D.Fragment=l,D.jsx=Rr,D.jsxs=_r}()),D}process.env.NODE_ENV==="production"?$.exports=Ce():$.exports=ke();var je=$.exports;function xe(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ae=function(t,u,g){var l=document.head||document.getElementsByTagName("head")[0],f=document.createElement("script");typeof u=="function"&&(g=u,u={}),u=u||{},g=g||function(){},f.type=u.type||"text/javascript",f.charset=u.charset||"utf8",f.async="async"in u?!!u.async:!0,f.src=t,u.attrs&&Fe(f,u.attrs),u.text&&(f.text=""+u.text);var m="onload"in f?ne:De;m(f,g),f.onload||ne(f,g),l.appendChild(f)};function Fe(t,u){for(var g in u)t.setAttribute(g,u[g])}function ne(t,u){t.onload=function(){this.onerror=this.onload=null,u(null,t)},t.onerror=function(){this.onerror=this.onload=null,u(new Error("Failed to load "+this.src),t)}}function De(t,u){t.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,u(null,t))}}const Ie=xe(Ae),Me="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",We="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",Be="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function Ye(t="production"){switch(t){case"dev":return We;case"staging":return Be;default:return Me}}const z={init:(t,u)=>new Promise((g,l)=>{const f=Ye(u==null?void 0:u.stage);Ie(f,m=>{m!==null&&l(m),window.TopolPlugin.init(t),g(!0)})}),save:()=>{window.TopolPlugin.save()},load:t=>{window.TopolPlugin.load(t)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:t=>{window.TopolPlugin.chooseFile(t)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},setSavedBlocks:t=>{window.TopolPlugin.setSavedBlocks(t)},createNotification:t=>{window.TopolPlugin.createNotification(t)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},destroy:()=>{window.TopolPlugin.destroy()}},Le="editor";function Ne(t){const u=()=>{const g={onSave(l,f){t.onSave!==void 0&&t.onSave(l,f)},onSaveAndClose(l,f){t.onSaveAndClose!==void 0&&t.onSaveAndClose(l,f)},onTestSend(l,f,m){t.onTestSend!==void 0&&t.onTestSend(l,f,m)},onOpenFileManager(){t.onOpenFileManager!==void 0&&t.onOpenFileManager()},onLoaded(){t.onLoaded!==void 0&&t.onLoaded()},onBlockSave(l){t.onBlockSave!==void 0&&t.onBlockSave(l)},onBlockRemove(l){t.onBlockRemove!==void 0&&t.onBlockRemove(l)},onBlockEdit(l){t.onBlockEdit!==void 0&&t.onBlockEdit(l)},onInit(){t.onInit!==void 0&&t.onInit()},onUndoChange(l){t.onUndoChange!==void 0&&t.onUndoChange(l)},onRedoChange(l){t.onRedoChange!==void 0&&t.onRedoChange(l)},onPreview(l){t.onPreview!==void 0&&t.onPreview(l)},onAlert(l){t.onAlert!==void 0&&t.onAlert(l)}};return{id:"#"+Le,...t.options,callbacks:{...g}}};return P.useEffect(()=>((async()=>{const l=u();await z.init(l,{stage:t.stage||"production"})})(),()=>{z.destroy()}),[]),je.jsx("div",{id:"editor",style:{position:"absolute",height:"100vh",width:"100%"}})}w.TopolPlugin=z,w.default=Ne,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -1,9 +1,8 @@
1
- /// <reference types="react" />
2
- import TopolPlugin, { INotification, ISavedBlock } from "@topol.io/editor";
3
- import IReactTopolOptions from '../types/IReactTopolOptions';
4
- declare type TopolEditorProps = {
1
+ import TopolPlugin, { INotification, ISavedBlock, IStage } from "@topol.io/editor";
2
+ import { IReactTopolOptions } from '../types/IReactTopolOptions';
3
+ type TopolEditorProps = {
5
4
  options: IReactTopolOptions;
6
- dev?: boolean;
5
+ stage?: IStage;
7
6
  onSave?(json: unknown, html: unknown): void;
8
7
  onSaveAndClose?(json: unknown, html: unknown): void;
9
8
  onTestSend?(email: string, json: unknown, html: unknown): void;
@@ -18,6 +17,6 @@ declare type TopolEditorProps = {
18
17
  onPreview?(html: unknown): void;
19
18
  onAlert?(notification: INotification): void;
20
19
  };
21
- export default function TopolEditor(props: TopolEditorProps): JSX.Element;
20
+ export default function TopolEditor(props: TopolEditorProps): import("react/jsx-runtime").JSX.Element;
22
21
  export type { IReactTopolOptions, INotification, ISavedBlock };
23
22
  export { TopolPlugin };
@@ -1,33 +1,2 @@
1
- import { ISavedBlock, IMergeTagGroup, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI } from "@topol.io/editor";
2
- export default interface IReactOptions {
3
- authorize: {
4
- apiKey: string;
5
- userId: string | number;
6
- };
7
- title?: string;
8
- removeTopBar?: boolean;
9
- topBarOptions?: Array<string>;
10
- mainMenuAlign?: "left" | "right";
11
- disableAlerts?: boolean;
12
- customFileManager?: boolean;
13
- language?: string;
14
- light?: boolean;
15
- theme?: ITheme;
16
- hideSettingsTab?: boolean;
17
- imageEditor?: boolean;
18
- premadeBlocks?: unknown | boolean;
19
- savedBlocks?: Array<ISavedBlock> | boolean;
20
- mergeTags?: Array<IMergeTagGroup>;
21
- enableAutosaves?: boolean;
22
- htmlMinified?: boolean;
23
- apiAuthorizationHeader?: IAuthHeaderConfig | string;
24
- contentBlocks?: IContentBlockOptions[];
25
- api?: IAPI;
26
- mobileFirstEnabled?: boolean;
27
- fonts?: Array<IFont>;
28
- tinyConfig?: unknown;
29
- fontSizes?: Array<number>;
30
- colors?: Array<string>;
31
- googleApiKey?: string;
32
- role?: "manager" | "editor" | "reader";
33
- }
1
+ import { ITopolOptions } from "@topol.io/editor";
2
+ export type IReactTopolOptions = Omit<ITopolOptions, 'id'>;
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "email-react",
12
12
  "email templates"
13
13
  ],
14
- "version": "0.0.0-alfa.0",
14
+ "version": "0.0.0-alfa.2",
15
15
  "author": "Topol.io",
16
16
  "homepage": "https://topol.io",
17
17
  "license": "Apache-2.0",
@@ -34,17 +34,17 @@
34
34
  "build:types": "tsc -p tsconfig.prod.json"
35
35
  },
36
36
  "dependencies": {
37
- "@topol.io/editor": "^0.0.0-alfa.13"
37
+ "@topol.io/editor": "^0.0.0-alfa.23"
38
38
  },
39
39
  "devDependencies": {
40
- "react": "^17.0.2",
41
- "react-dom": "^17.0.2",
42
- "@types/node": "^17.0.16",
43
- "@types/react": "^17.0.33",
44
- "@types/react-dom": "^17.0.10",
45
- "@vitejs/plugin-react": "^1.0.7",
46
- "typescript": "^4.5.4",
47
- "vite": "^2.8.0"
40
+ "@types/node": "^20.7.0",
41
+ "@types/react": "^18.2.22",
42
+ "@types/react-dom": "^18.2.7",
43
+ "@vitejs/plugin-react": "^4.1.0",
44
+ "react": "^18.2.0",
45
+ "react-dom": "^18.2.0",
46
+ "typescript": "^5.2.2",
47
+ "vite": "^4.4.9"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"