react-pebble-editor 0.0.1-dev2 → 0.0.1-dev4
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/react-pebble-editor.es.js +264 -243
- package/dist/react-pebble-editor.umd.js +10 -10
- package/package.json +3 -3
- package/src/components/PebbleEditor.tsx +48 -10
- package/src/index.ts +1 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Pe, { forwardRef as fr, useRef as we, useImperativeHandle as cr, useEffect as dr } from "react";
|
|
2
2
|
var X = { exports: {} }, I = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -9,19 +9,19 @@ var X = { exports: {} }, I = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
for (
|
|
21
|
-
if (
|
|
22
|
-
return { $$typeof: h, type:
|
|
12
|
+
var Te;
|
|
13
|
+
function vr() {
|
|
14
|
+
if (Te) return I;
|
|
15
|
+
Te = 1;
|
|
16
|
+
var P = Pe, h = Symbol.for("react.element"), R = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, j = P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, T = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
+
function y(_, s, g) {
|
|
18
|
+
var c, d = {}, w = null, W = null;
|
|
19
|
+
g !== void 0 && (w = "" + g), s.key !== void 0 && (w = "" + s.key), s.ref !== void 0 && (W = s.ref);
|
|
20
|
+
for (c in s) m.call(s, c) && !T.hasOwnProperty(c) && (d[c] = s[c]);
|
|
21
|
+
if (_ && _.defaultProps) for (c in s = _.defaultProps, s) d[c] === void 0 && (d[c] = s[c]);
|
|
22
|
+
return { $$typeof: h, type: _, key: w, ref: W, props: d, _owner: j.current };
|
|
23
23
|
}
|
|
24
|
-
return I.Fragment =
|
|
24
|
+
return I.Fragment = R, I.jsx = y, I.jsxs = y, I;
|
|
25
25
|
}
|
|
26
26
|
var $ = {};
|
|
27
27
|
/**
|
|
@@ -33,91 +33,91 @@ var $ = {};
|
|
|
33
33
|
* This source code is licensed under the MIT license found in the
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
35
|
*/
|
|
36
|
-
var
|
|
37
|
-
function
|
|
38
|
-
return
|
|
39
|
-
var
|
|
40
|
-
function
|
|
36
|
+
var Oe;
|
|
37
|
+
function pr() {
|
|
38
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && function() {
|
|
39
|
+
var P = Pe, h = Symbol.for("react.element"), R = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), j = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), y = Symbol.for("react.provider"), _ = Symbol.for("react.context"), s = Symbol.for("react.forward_ref"), g = Symbol.for("react.suspense"), c = Symbol.for("react.suspense_list"), d = Symbol.for("react.memo"), w = Symbol.for("react.lazy"), W = Symbol.for("react.offscreen"), H = Symbol.iterator, Se = "@@iterator";
|
|
40
|
+
function Ce(e) {
|
|
41
41
|
if (e === null || typeof e != "object")
|
|
42
42
|
return null;
|
|
43
|
-
var r = H && e[H] || e[
|
|
43
|
+
var r = H && e[H] || e[Se];
|
|
44
44
|
return typeof r == "function" ? r : null;
|
|
45
45
|
}
|
|
46
|
-
var x =
|
|
47
|
-
function
|
|
46
|
+
var x = P.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
|
+
function v(e) {
|
|
48
48
|
{
|
|
49
49
|
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
50
50
|
t[n - 1] = arguments[n];
|
|
51
|
-
|
|
51
|
+
je("error", e, t);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function je(e, r, t) {
|
|
55
55
|
{
|
|
56
|
-
var n = x.ReactDebugCurrentFrame,
|
|
57
|
-
|
|
58
|
-
var u = t.map(function(
|
|
59
|
-
return String(
|
|
56
|
+
var n = x.ReactDebugCurrentFrame, i = n.getStackAddendum();
|
|
57
|
+
i !== "" && (r += "%s", t = t.concat([i]));
|
|
58
|
+
var u = t.map(function(o) {
|
|
59
|
+
return String(o);
|
|
60
60
|
});
|
|
61
61
|
u.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, u);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
var
|
|
64
|
+
var xe = !1, ke = !1, De = !1, Fe = !1, Ae = !1, Z;
|
|
65
65
|
Z = Symbol.for("react.module.reference");
|
|
66
|
-
function
|
|
67
|
-
return !!(typeof e == "string" || typeof e == "function" || e ===
|
|
66
|
+
function Ie(e) {
|
|
67
|
+
return !!(typeof e == "string" || typeof e == "function" || e === m || e === T || Ae || e === j || e === g || e === c || Fe || e === W || xe || ke || De || typeof e == "object" && e !== null && (e.$$typeof === w || e.$$typeof === d || e.$$typeof === y || e.$$typeof === _ || e.$$typeof === s || // This needs to include all possible module reference object
|
|
68
68
|
// types supported by any Flight configuration anywhere since
|
|
69
69
|
// we don't know which Flight build this will end up being used
|
|
70
70
|
// with.
|
|
71
71
|
e.$$typeof === Z || e.getModuleId !== void 0));
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function $e(e, r, t) {
|
|
74
74
|
var n = e.displayName;
|
|
75
75
|
if (n)
|
|
76
76
|
return n;
|
|
77
|
-
var
|
|
78
|
-
return
|
|
77
|
+
var i = r.displayName || r.name || "";
|
|
78
|
+
return i !== "" ? t + "(" + i + ")" : t;
|
|
79
79
|
}
|
|
80
80
|
function Q(e) {
|
|
81
81
|
return e.displayName || "Context";
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function O(e) {
|
|
84
84
|
if (e == null)
|
|
85
85
|
return null;
|
|
86
|
-
if (typeof e.tag == "number" &&
|
|
86
|
+
if (typeof e.tag == "number" && v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
87
87
|
return e.displayName || e.name || null;
|
|
88
88
|
if (typeof e == "string")
|
|
89
89
|
return e;
|
|
90
90
|
switch (e) {
|
|
91
|
-
case
|
|
91
|
+
case m:
|
|
92
92
|
return "Fragment";
|
|
93
|
-
case
|
|
93
|
+
case R:
|
|
94
94
|
return "Portal";
|
|
95
|
-
case
|
|
95
|
+
case T:
|
|
96
96
|
return "Profiler";
|
|
97
|
-
case E:
|
|
98
|
-
return "StrictMode";
|
|
99
97
|
case j:
|
|
98
|
+
return "StrictMode";
|
|
99
|
+
case g:
|
|
100
100
|
return "Suspense";
|
|
101
|
-
case
|
|
101
|
+
case c:
|
|
102
102
|
return "SuspenseList";
|
|
103
103
|
}
|
|
104
104
|
if (typeof e == "object")
|
|
105
105
|
switch (e.$$typeof) {
|
|
106
|
-
case
|
|
106
|
+
case _:
|
|
107
107
|
var r = e;
|
|
108
108
|
return Q(r) + ".Consumer";
|
|
109
|
-
case
|
|
109
|
+
case y:
|
|
110
110
|
var t = e;
|
|
111
111
|
return Q(t._context) + ".Provider";
|
|
112
|
-
case
|
|
113
|
-
return
|
|
114
|
-
case
|
|
112
|
+
case s:
|
|
113
|
+
return $e(e, e.render, "ForwardRef");
|
|
114
|
+
case d:
|
|
115
115
|
var n = e.displayName || null;
|
|
116
|
-
return n !== null ? n :
|
|
117
|
-
case
|
|
118
|
-
var
|
|
116
|
+
return n !== null ? n : O(e.type) || "Memo";
|
|
117
|
+
case w: {
|
|
118
|
+
var i = e, u = i._payload, o = i._init;
|
|
119
119
|
try {
|
|
120
|
-
return
|
|
120
|
+
return O(o(u));
|
|
121
121
|
} catch {
|
|
122
122
|
return null;
|
|
123
123
|
}
|
|
@@ -125,14 +125,14 @@ function dr() {
|
|
|
125
125
|
}
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
-
var
|
|
128
|
+
var S = Object.assign, F = 0, ee, re, te, ne, ae, oe, ie;
|
|
129
129
|
function ue() {
|
|
130
130
|
}
|
|
131
131
|
ue.__reactDisabledLog = !0;
|
|
132
|
-
function
|
|
132
|
+
function We() {
|
|
133
133
|
{
|
|
134
134
|
if (F === 0) {
|
|
135
|
-
ee = console.log, re = console.info, te = console.warn, ne = console.error, ae = console.group,
|
|
135
|
+
ee = console.log, re = console.info, te = console.warn, ne = console.error, ae = console.group, oe = console.groupCollapsed, ie = console.groupEnd;
|
|
136
136
|
var e = {
|
|
137
137
|
configurable: !0,
|
|
138
138
|
enumerable: !0,
|
|
@@ -152,7 +152,7 @@ function dr() {
|
|
|
152
152
|
F++;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function Ye() {
|
|
156
156
|
{
|
|
157
157
|
if (F--, F === 0) {
|
|
158
158
|
var e = {
|
|
@@ -161,30 +161,30 @@ function dr() {
|
|
|
161
161
|
writable: !0
|
|
162
162
|
};
|
|
163
163
|
Object.defineProperties(console, {
|
|
164
|
-
log:
|
|
164
|
+
log: S({}, e, {
|
|
165
165
|
value: ee
|
|
166
166
|
}),
|
|
167
|
-
info:
|
|
167
|
+
info: S({}, e, {
|
|
168
168
|
value: re
|
|
169
169
|
}),
|
|
170
|
-
warn:
|
|
170
|
+
warn: S({}, e, {
|
|
171
171
|
value: te
|
|
172
172
|
}),
|
|
173
|
-
error:
|
|
173
|
+
error: S({}, e, {
|
|
174
174
|
value: ne
|
|
175
175
|
}),
|
|
176
|
-
group:
|
|
176
|
+
group: S({}, e, {
|
|
177
177
|
value: ae
|
|
178
178
|
}),
|
|
179
|
-
groupCollapsed:
|
|
180
|
-
value: ie
|
|
181
|
-
}),
|
|
182
|
-
groupEnd: P({}, e, {
|
|
179
|
+
groupCollapsed: S({}, e, {
|
|
183
180
|
value: oe
|
|
181
|
+
}),
|
|
182
|
+
groupEnd: S({}, e, {
|
|
183
|
+
value: ie
|
|
184
184
|
})
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
F < 0 &&
|
|
187
|
+
F < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
var U = x.ReactCurrentDispatcher, q;
|
|
@@ -193,8 +193,8 @@ function dr() {
|
|
|
193
193
|
if (q === void 0)
|
|
194
194
|
try {
|
|
195
195
|
throw Error();
|
|
196
|
-
} catch (
|
|
197
|
-
var n =
|
|
196
|
+
} catch (i) {
|
|
197
|
+
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
198
198
|
q = n && n[1] || "";
|
|
199
199
|
}
|
|
200
200
|
return `
|
|
@@ -203,8 +203,8 @@ function dr() {
|
|
|
203
203
|
}
|
|
204
204
|
var N = !1, L;
|
|
205
205
|
{
|
|
206
|
-
var
|
|
207
|
-
L = new
|
|
206
|
+
var Le = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
+
L = new Le();
|
|
208
208
|
}
|
|
209
209
|
function se(e, r) {
|
|
210
210
|
if (!e || N)
|
|
@@ -216,75 +216,75 @@ function dr() {
|
|
|
216
216
|
}
|
|
217
217
|
var n;
|
|
218
218
|
N = !0;
|
|
219
|
-
var
|
|
219
|
+
var i = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
221
|
var u;
|
|
222
|
-
u = U.current, U.current = null,
|
|
222
|
+
u = U.current, U.current = null, We();
|
|
223
223
|
try {
|
|
224
224
|
if (r) {
|
|
225
|
-
var
|
|
225
|
+
var o = function() {
|
|
226
226
|
throw Error();
|
|
227
227
|
};
|
|
228
|
-
if (Object.defineProperty(
|
|
228
|
+
if (Object.defineProperty(o.prototype, "props", {
|
|
229
229
|
set: function() {
|
|
230
230
|
throw Error();
|
|
231
231
|
}
|
|
232
232
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
233
|
try {
|
|
234
|
-
Reflect.construct(
|
|
235
|
-
} catch (
|
|
236
|
-
n =
|
|
234
|
+
Reflect.construct(o, []);
|
|
235
|
+
} catch (E) {
|
|
236
|
+
n = E;
|
|
237
237
|
}
|
|
238
|
-
Reflect.construct(e, [],
|
|
238
|
+
Reflect.construct(e, [], o);
|
|
239
239
|
} else {
|
|
240
240
|
try {
|
|
241
|
-
|
|
242
|
-
} catch (
|
|
243
|
-
n =
|
|
241
|
+
o.call();
|
|
242
|
+
} catch (E) {
|
|
243
|
+
n = E;
|
|
244
244
|
}
|
|
245
|
-
e.call(
|
|
245
|
+
e.call(o.prototype);
|
|
246
246
|
}
|
|
247
247
|
} else {
|
|
248
248
|
try {
|
|
249
249
|
throw Error();
|
|
250
|
-
} catch (
|
|
251
|
-
n =
|
|
250
|
+
} catch (E) {
|
|
251
|
+
n = E;
|
|
252
252
|
}
|
|
253
253
|
e();
|
|
254
254
|
}
|
|
255
|
-
} catch (
|
|
256
|
-
if (
|
|
257
|
-
for (var a =
|
|
258
|
-
`),
|
|
259
|
-
`),
|
|
260
|
-
|
|
261
|
-
for (;
|
|
262
|
-
if (a[
|
|
263
|
-
if (
|
|
255
|
+
} catch (E) {
|
|
256
|
+
if (E && n && typeof E.stack == "string") {
|
|
257
|
+
for (var a = E.stack.split(`
|
|
258
|
+
`), p = n.stack.split(`
|
|
259
|
+
`), l = a.length - 1, f = p.length - 1; l >= 1 && f >= 0 && a[l] !== p[f]; )
|
|
260
|
+
f--;
|
|
261
|
+
for (; l >= 1 && f >= 0; l--, f--)
|
|
262
|
+
if (a[l] !== p[f]) {
|
|
263
|
+
if (l !== 1 || f !== 1)
|
|
264
264
|
do
|
|
265
|
-
if (
|
|
266
|
-
var
|
|
267
|
-
` + a[
|
|
268
|
-
return e.displayName &&
|
|
265
|
+
if (l--, f--, f < 0 || a[l] !== p[f]) {
|
|
266
|
+
var b = `
|
|
267
|
+
` + a[l].replace(" at new ", " at ");
|
|
268
|
+
return e.displayName && b.includes("<anonymous>") && (b = b.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, b), b;
|
|
269
269
|
}
|
|
270
|
-
while (
|
|
270
|
+
while (l >= 1 && f >= 0);
|
|
271
271
|
break;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
} finally {
|
|
275
|
-
N = !1, U.current = u,
|
|
275
|
+
N = !1, U.current = u, Ye(), Error.prepareStackTrace = i;
|
|
276
276
|
}
|
|
277
|
-
var D = e ? e.displayName || e.name : "",
|
|
278
|
-
return typeof e == "function" && L.set(e,
|
|
277
|
+
var D = e ? e.displayName || e.name : "", C = D ? Y(D) : "";
|
|
278
|
+
return typeof e == "function" && L.set(e, C), C;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
280
|
+
function Ve(e, r, t) {
|
|
281
281
|
return se(e, !1);
|
|
282
282
|
}
|
|
283
283
|
function Me(e) {
|
|
284
284
|
var r = e.prototype;
|
|
285
285
|
return !!(r && r.isReactComponent);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function V(e, r, t) {
|
|
288
288
|
if (e == null)
|
|
289
289
|
return "";
|
|
290
290
|
if (typeof e == "function")
|
|
@@ -292,21 +292,21 @@ function dr() {
|
|
|
292
292
|
if (typeof e == "string")
|
|
293
293
|
return Y(e);
|
|
294
294
|
switch (e) {
|
|
295
|
-
case
|
|
295
|
+
case g:
|
|
296
296
|
return Y("Suspense");
|
|
297
|
-
case
|
|
297
|
+
case c:
|
|
298
298
|
return Y("SuspenseList");
|
|
299
299
|
}
|
|
300
300
|
if (typeof e == "object")
|
|
301
301
|
switch (e.$$typeof) {
|
|
302
|
-
case
|
|
303
|
-
return
|
|
304
|
-
case
|
|
305
|
-
return
|
|
306
|
-
case
|
|
307
|
-
var n = e,
|
|
302
|
+
case s:
|
|
303
|
+
return Ve(e.render);
|
|
304
|
+
case d:
|
|
305
|
+
return V(e.type, r, t);
|
|
306
|
+
case w: {
|
|
307
|
+
var n = e, i = n._payload, u = n._init;
|
|
308
308
|
try {
|
|
309
|
-
return
|
|
309
|
+
return V(u(i), r, t);
|
|
310
310
|
} catch {
|
|
311
311
|
}
|
|
312
312
|
}
|
|
@@ -314,43 +314,43 @@ function dr() {
|
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
316
|
var A = Object.prototype.hasOwnProperty, le = {}, fe = x.ReactDebugCurrentFrame;
|
|
317
|
-
function
|
|
317
|
+
function M(e) {
|
|
318
318
|
if (e) {
|
|
319
|
-
var r = e._owner, t =
|
|
319
|
+
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
320
320
|
fe.setExtraStackFrame(t);
|
|
321
321
|
} else
|
|
322
322
|
fe.setExtraStackFrame(null);
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Ue(e, r, t, n, i) {
|
|
325
325
|
{
|
|
326
326
|
var u = Function.call.bind(A);
|
|
327
|
-
for (var
|
|
328
|
-
if (u(e,
|
|
327
|
+
for (var o in e)
|
|
328
|
+
if (u(e, o)) {
|
|
329
329
|
var a = void 0;
|
|
330
330
|
try {
|
|
331
|
-
if (typeof e[
|
|
332
|
-
var
|
|
333
|
-
throw
|
|
331
|
+
if (typeof e[o] != "function") {
|
|
332
|
+
var p = Error((n || "React class") + ": " + t + " type `" + o + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[o] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
333
|
+
throw p.name = "Invariant Violation", p;
|
|
334
334
|
}
|
|
335
|
-
a = e[
|
|
336
|
-
} catch (
|
|
337
|
-
a =
|
|
335
|
+
a = e[o](r, o, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
336
|
+
} catch (l) {
|
|
337
|
+
a = l;
|
|
338
338
|
}
|
|
339
|
-
a && !(a instanceof Error) && (
|
|
339
|
+
a && !(a instanceof Error) && (M(i), v("%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).", n || "React class", t, o, typeof a), M(null)), a instanceof Error && !(a.message in le) && (le[a.message] = !0, M(i), v("Failed %s type: %s", t, a.message), M(null));
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
var
|
|
344
|
-
function
|
|
345
|
-
return
|
|
343
|
+
var qe = Array.isArray;
|
|
344
|
+
function B(e) {
|
|
345
|
+
return qe(e);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Ne(e) {
|
|
348
348
|
{
|
|
349
349
|
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
350
|
return t;
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Be(e) {
|
|
354
354
|
try {
|
|
355
355
|
return ce(e), !1;
|
|
356
356
|
} catch {
|
|
@@ -361,16 +361,16 @@ function dr() {
|
|
|
361
361
|
return "" + e;
|
|
362
362
|
}
|
|
363
363
|
function de(e) {
|
|
364
|
-
if (
|
|
365
|
-
return
|
|
364
|
+
if (Be(e))
|
|
365
|
+
return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ne(e)), ce(e);
|
|
366
366
|
}
|
|
367
367
|
var ve = x.ReactCurrentOwner, Je = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
371
371
|
__source: !0
|
|
372
|
-
}, pe,
|
|
373
|
-
function
|
|
372
|
+
}, pe, ge;
|
|
373
|
+
function ze(e) {
|
|
374
374
|
if (A.call(e, "ref")) {
|
|
375
375
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
376
|
if (r && r.isReactWarning)
|
|
@@ -389,10 +389,10 @@ function dr() {
|
|
|
389
389
|
function Ge(e, r) {
|
|
390
390
|
typeof e.ref == "string" && ve.current;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function Xe(e, r) {
|
|
393
393
|
{
|
|
394
394
|
var t = function() {
|
|
395
|
-
pe || (pe = !0,
|
|
395
|
+
pe || (pe = !0, v("%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));
|
|
396
396
|
};
|
|
397
397
|
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
398
|
get: t,
|
|
@@ -400,10 +400,10 @@ function dr() {
|
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
function
|
|
403
|
+
function He(e, r) {
|
|
404
404
|
{
|
|
405
405
|
var t = function() {
|
|
406
|
-
|
|
406
|
+
ge || (ge = !0, v("%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));
|
|
407
407
|
};
|
|
408
408
|
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
409
|
get: t,
|
|
@@ -411,7 +411,7 @@ function dr() {
|
|
|
411
411
|
});
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
var
|
|
414
|
+
var Ze = function(e, r, t, n, i, u, o) {
|
|
415
415
|
var a = {
|
|
416
416
|
// This tag allows us to uniquely identify this as a React Element
|
|
417
417
|
$$typeof: h,
|
|
@@ -419,7 +419,7 @@ function dr() {
|
|
|
419
419
|
type: e,
|
|
420
420
|
key: r,
|
|
421
421
|
ref: t,
|
|
422
|
-
props:
|
|
422
|
+
props: o,
|
|
423
423
|
// Record the component responsible for creating this element.
|
|
424
424
|
_owner: u
|
|
425
425
|
};
|
|
@@ -437,44 +437,44 @@ function dr() {
|
|
|
437
437
|
configurable: !1,
|
|
438
438
|
enumerable: !1,
|
|
439
439
|
writable: !1,
|
|
440
|
-
value:
|
|
440
|
+
value: i
|
|
441
441
|
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
442
442
|
};
|
|
443
|
-
function
|
|
443
|
+
function Qe(e, r, t, n, i) {
|
|
444
444
|
{
|
|
445
|
-
var u,
|
|
446
|
-
t !== void 0 && (de(t), a = "" + t), Ke(r) && (de(r.key), a = "" + r.key),
|
|
445
|
+
var u, o = {}, a = null, p = null;
|
|
446
|
+
t !== void 0 && (de(t), a = "" + t), Ke(r) && (de(r.key), a = "" + r.key), ze(r) && (p = r.ref, Ge(r, i));
|
|
447
447
|
for (u in r)
|
|
448
|
-
A.call(r, u) && !Je.hasOwnProperty(u) && (
|
|
448
|
+
A.call(r, u) && !Je.hasOwnProperty(u) && (o[u] = r[u]);
|
|
449
449
|
if (e && e.defaultProps) {
|
|
450
|
-
var
|
|
451
|
-
for (u in
|
|
452
|
-
|
|
450
|
+
var l = e.defaultProps;
|
|
451
|
+
for (u in l)
|
|
452
|
+
o[u] === void 0 && (o[u] = l[u]);
|
|
453
453
|
}
|
|
454
|
-
if (a ||
|
|
455
|
-
var
|
|
456
|
-
a &&
|
|
454
|
+
if (a || p) {
|
|
455
|
+
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
+
a && Xe(o, f), p && He(o, f);
|
|
457
457
|
}
|
|
458
|
-
return
|
|
458
|
+
return Ze(e, a, p, i, n, ve.current, o);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
var
|
|
461
|
+
var J = x.ReactCurrentOwner, Ee = x.ReactDebugCurrentFrame;
|
|
462
462
|
function k(e) {
|
|
463
463
|
if (e) {
|
|
464
|
-
var r = e._owner, t =
|
|
465
|
-
|
|
464
|
+
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
465
|
+
Ee.setExtraStackFrame(t);
|
|
466
466
|
} else
|
|
467
|
-
|
|
467
|
+
Ee.setExtraStackFrame(null);
|
|
468
468
|
}
|
|
469
|
-
var
|
|
470
|
-
|
|
471
|
-
function
|
|
469
|
+
var z;
|
|
470
|
+
z = !1;
|
|
471
|
+
function K(e) {
|
|
472
472
|
return typeof e == "object" && e !== null && e.$$typeof === h;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function be() {
|
|
475
475
|
{
|
|
476
|
-
if (
|
|
477
|
-
var e =
|
|
476
|
+
if (J.current) {
|
|
477
|
+
var e = O(J.current.type);
|
|
478
478
|
if (e)
|
|
479
479
|
return `
|
|
480
480
|
|
|
@@ -483,13 +483,13 @@ Check the render method of \`` + e + "`.";
|
|
|
483
483
|
return "";
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function er(e) {
|
|
487
487
|
return "";
|
|
488
488
|
}
|
|
489
489
|
var he = {};
|
|
490
|
-
function
|
|
490
|
+
function rr(e) {
|
|
491
491
|
{
|
|
492
|
-
var r =
|
|
492
|
+
var r = be();
|
|
493
493
|
if (!r) {
|
|
494
494
|
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
495
495
|
t && (r = `
|
|
@@ -504,34 +504,34 @@ Check the top-level render call using <` + t + ">.");
|
|
|
504
504
|
if (!e._store || e._store.validated || e.key != null)
|
|
505
505
|
return;
|
|
506
506
|
e._store.validated = !0;
|
|
507
|
-
var t =
|
|
507
|
+
var t = rr(r);
|
|
508
508
|
if (he[t])
|
|
509
509
|
return;
|
|
510
510
|
he[t] = !0;
|
|
511
511
|
var n = "";
|
|
512
|
-
e && e._owner && e._owner !==
|
|
512
|
+
e && e._owner && e._owner !== J.current && (n = " It was passed a child from " + O(e._owner.type) + "."), k(e), v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), k(null);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
function Re(e, r) {
|
|
516
516
|
{
|
|
517
517
|
if (typeof e != "object")
|
|
518
518
|
return;
|
|
519
|
-
if (
|
|
519
|
+
if (B(e))
|
|
520
520
|
for (var t = 0; t < e.length; t++) {
|
|
521
521
|
var n = e[t];
|
|
522
|
-
|
|
522
|
+
K(n) && ye(n, r);
|
|
523
523
|
}
|
|
524
|
-
else if (
|
|
524
|
+
else if (K(e))
|
|
525
525
|
e._store && (e._store.validated = !0);
|
|
526
526
|
else if (e) {
|
|
527
|
-
var
|
|
528
|
-
if (typeof
|
|
529
|
-
for (var u =
|
|
530
|
-
|
|
527
|
+
var i = Ce(e);
|
|
528
|
+
if (typeof i == "function" && i !== e.entries)
|
|
529
|
+
for (var u = i.call(e), o; !(o = u.next()).done; )
|
|
530
|
+
K(o.value) && ye(o.value, r);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function tr(e) {
|
|
535
535
|
{
|
|
536
536
|
var r = e.type;
|
|
537
537
|
if (r == null || typeof r == "string")
|
|
@@ -539,122 +539,143 @@ Check the top-level render call using <` + t + ">.");
|
|
|
539
539
|
var t;
|
|
540
540
|
if (typeof r == "function")
|
|
541
541
|
t = r.propTypes;
|
|
542
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
542
|
+
else if (typeof r == "object" && (r.$$typeof === s || // Note: Memo only checks outer props here.
|
|
543
543
|
// Inner props are checked in the reconciler.
|
|
544
|
-
r.$$typeof ===
|
|
544
|
+
r.$$typeof === d))
|
|
545
545
|
t = r.propTypes;
|
|
546
546
|
else
|
|
547
547
|
return;
|
|
548
548
|
if (t) {
|
|
549
|
-
var n =
|
|
550
|
-
|
|
551
|
-
} else if (r.PropTypes !== void 0 && !
|
|
552
|
-
|
|
553
|
-
var
|
|
554
|
-
|
|
549
|
+
var n = O(r);
|
|
550
|
+
Ue(t, e.props, "prop", n, e);
|
|
551
|
+
} else if (r.PropTypes !== void 0 && !z) {
|
|
552
|
+
z = !0;
|
|
553
|
+
var i = O(r);
|
|
554
|
+
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
555
555
|
}
|
|
556
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved &&
|
|
556
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
function
|
|
559
|
+
function nr(e) {
|
|
560
560
|
{
|
|
561
561
|
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
562
562
|
var n = r[t];
|
|
563
563
|
if (n !== "children" && n !== "key") {
|
|
564
|
-
k(e),
|
|
564
|
+
k(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), k(null);
|
|
565
565
|
break;
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
e.ref !== null && (k(e),
|
|
568
|
+
e.ref !== null && (k(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), k(null));
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
var
|
|
572
|
-
function
|
|
571
|
+
var me = {};
|
|
572
|
+
function _e(e, r, t, n, i, u) {
|
|
573
573
|
{
|
|
574
|
-
var
|
|
575
|
-
if (!
|
|
574
|
+
var o = Ie(e);
|
|
575
|
+
if (!o) {
|
|
576
576
|
var a = "";
|
|
577
577
|
(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.");
|
|
578
|
-
var
|
|
579
|
-
|
|
580
|
-
var
|
|
581
|
-
e === null ?
|
|
578
|
+
var p = er();
|
|
579
|
+
p ? a += p : a += be();
|
|
580
|
+
var l;
|
|
581
|
+
e === null ? l = "null" : B(e) ? l = "array" : e !== void 0 && e.$$typeof === h ? (l = "<" + (O(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
|
|
582
582
|
}
|
|
583
|
-
var
|
|
584
|
-
if (
|
|
585
|
-
return
|
|
586
|
-
if (
|
|
587
|
-
var
|
|
588
|
-
if (
|
|
583
|
+
var f = Qe(e, r, t, i, u);
|
|
584
|
+
if (f == null)
|
|
585
|
+
return f;
|
|
586
|
+
if (o) {
|
|
587
|
+
var b = r.children;
|
|
588
|
+
if (b !== void 0)
|
|
589
589
|
if (n)
|
|
590
|
-
if (
|
|
591
|
-
for (var D = 0; D <
|
|
592
|
-
Re(
|
|
593
|
-
Object.freeze && Object.freeze(
|
|
590
|
+
if (B(b)) {
|
|
591
|
+
for (var D = 0; D < b.length; D++)
|
|
592
|
+
Re(b[D], e);
|
|
593
|
+
Object.freeze && Object.freeze(b);
|
|
594
594
|
} else
|
|
595
|
-
|
|
595
|
+
v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
596
596
|
else
|
|
597
|
-
Re(
|
|
597
|
+
Re(b, e);
|
|
598
598
|
}
|
|
599
599
|
if (A.call(r, "key")) {
|
|
600
|
-
var
|
|
601
|
-
return
|
|
602
|
-
}),
|
|
603
|
-
if (!
|
|
604
|
-
var
|
|
605
|
-
|
|
600
|
+
var C = O(e), E = Object.keys(r).filter(function(lr) {
|
|
601
|
+
return lr !== "key";
|
|
602
|
+
}), G = E.length > 0 ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!me[C + G]) {
|
|
604
|
+
var sr = E.length > 0 ? "{" + E.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
+
v(`A props object containing a "key" prop is being spread into JSX:
|
|
606
606
|
let props = %s;
|
|
607
607
|
<%s {...props} />
|
|
608
608
|
React keys must be passed directly to JSX without using spread:
|
|
609
609
|
let props = %s;
|
|
610
|
-
<%s key={someKey} {...props} />`,
|
|
610
|
+
<%s key={someKey} {...props} />`, G, C, sr, C), me[C + G] = !0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
return e ===
|
|
613
|
+
return e === m ? nr(f) : tr(f), f;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
function nr(e, r, t) {
|
|
617
|
-
return me(e, r, t, !0);
|
|
618
|
-
}
|
|
619
616
|
function ar(e, r, t) {
|
|
620
|
-
return
|
|
617
|
+
return _e(e, r, t, !0);
|
|
618
|
+
}
|
|
619
|
+
function or(e, r, t) {
|
|
620
|
+
return _e(e, r, t, !1);
|
|
621
621
|
}
|
|
622
|
-
var ir =
|
|
623
|
-
$.Fragment =
|
|
622
|
+
var ir = or, ur = ar;
|
|
623
|
+
$.Fragment = m, $.jsx = ir, $.jsxs = ur;
|
|
624
624
|
}()), $;
|
|
625
625
|
}
|
|
626
|
-
process.env.NODE_ENV === "production" ? X.exports =
|
|
627
|
-
var
|
|
628
|
-
function
|
|
629
|
-
return new Promise((
|
|
630
|
-
if (window.require) return
|
|
631
|
-
const
|
|
632
|
-
|
|
626
|
+
process.env.NODE_ENV === "production" ? X.exports = vr() : X.exports = pr();
|
|
627
|
+
var gr = X.exports;
|
|
628
|
+
function Er() {
|
|
629
|
+
return new Promise((P, h) => {
|
|
630
|
+
if (window.require) return P(window.require);
|
|
631
|
+
const R = document.createElement("script");
|
|
632
|
+
R.src = "/vs/loader.js", R.onload = () => {
|
|
633
633
|
if (!window.require) return h(new Error("RequireJS not available"));
|
|
634
|
-
window.require.config({ paths: { vs: "/vs" } }),
|
|
635
|
-
},
|
|
634
|
+
window.require.config({ paths: { vs: "/vs" } }), P(window.require);
|
|
635
|
+
}, R.onerror = h, document.body.appendChild(R);
|
|
636
636
|
});
|
|
637
637
|
}
|
|
638
|
-
|
|
639
|
-
const y =
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
638
|
+
const hr = fr(function({ value: h, theme: R, onChange: m }, j) {
|
|
639
|
+
const T = we(null), y = we(null);
|
|
640
|
+
cr(j, () => ({
|
|
641
|
+
getValue() {
|
|
642
|
+
var s;
|
|
643
|
+
return ((s = y.current) == null ? void 0 : s.getValue()) ?? "";
|
|
644
|
+
},
|
|
645
|
+
layout() {
|
|
646
|
+
_();
|
|
647
|
+
}
|
|
648
|
+
}));
|
|
649
|
+
function _() {
|
|
650
|
+
const s = T.current, g = y.current;
|
|
651
|
+
if (!s || !g) return;
|
|
652
|
+
const { width: c, height: d } = s.getBoundingClientRect();
|
|
653
|
+
g.layout({ width: c, height: d });
|
|
654
|
+
}
|
|
655
|
+
return dr(() => {
|
|
656
|
+
const s = T.current;
|
|
657
|
+
if (!s) return;
|
|
658
|
+
let g = null;
|
|
659
|
+
const c = () => {
|
|
660
|
+
requestAnimationFrame(() => _());
|
|
661
|
+
};
|
|
662
|
+
return Er().then((d) => {
|
|
663
|
+
d(["vs/editor/editor.main"], () => {
|
|
644
664
|
const w = window.monaco;
|
|
645
|
-
|
|
646
|
-
value:
|
|
665
|
+
s && (g = w.editor.create(s, {
|
|
666
|
+
value: h,
|
|
647
667
|
language: "pebble",
|
|
648
|
-
theme:
|
|
649
|
-
}),
|
|
650
|
-
|
|
651
|
-
}));
|
|
668
|
+
theme: R || "vs-dark"
|
|
669
|
+
}), y.current = g, g.onDidChangeModelContent(() => {
|
|
670
|
+
m == null || m(g.getValue());
|
|
671
|
+
}), window.addEventListener("resize", c));
|
|
652
672
|
});
|
|
653
673
|
}), () => {
|
|
654
|
-
|
|
674
|
+
var d;
|
|
675
|
+
window.removeEventListener("resize", c), (d = y.current) == null || d.dispose(), y.current = null;
|
|
655
676
|
};
|
|
656
|
-
}, [
|
|
657
|
-
}
|
|
677
|
+
}, [h]), /* @__PURE__ */ gr.jsx("div", { ref: T, style: { height: "100%", width: "100%" } });
|
|
678
|
+
});
|
|
658
679
|
export {
|
|
659
|
-
|
|
680
|
+
hr as PebbleEditor
|
|
660
681
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(S,y){typeof exports=="object"&&typeof module<"u"?y(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],y):(S=typeof globalThis<"u"?globalThis:S||self,y(S.ReactPebbleEditor={},S.React))})(this,function(S,y){"use strict";var B={exports:{}},I={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Q;function Se(){if(Q)return I;Q=1;var
|
|
9
|
+
*/var Q;function Se(){if(Q)return I;Q=1;var C=y,h=Symbol.for("react.element"),m=Symbol.for("react.fragment"),_=Object.prototype.hasOwnProperty,k=C.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O={key:!0,ref:!0,__self:!0,__source:!0};function R(w,s,b){var c,d={},T=null,V=null;b!==void 0&&(T=""+b),s.key!==void 0&&(T=""+s.key),s.ref!==void 0&&(V=s.ref);for(c in s)_.call(s,c)&&!O.hasOwnProperty(c)&&(d[c]=s[c]);if(w&&w.defaultProps)for(c in s=w.defaultProps,s)d[c]===void 0&&(d[c]=s[c]);return{$$typeof:h,type:w,key:T,ref:V,props:d,_owner:k.current}}return I.Fragment=m,I.jsx=R,I.jsxs=R,I}var W={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,17 +14,17 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ee;function Ce(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+a[
|
|
17
|
+
*/var ee;function Ce(){return ee||(ee=1,process.env.NODE_ENV!=="production"&&function(){var C=y,h=Symbol.for("react.element"),m=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),w=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),V=Symbol.for("react.offscreen"),re=Symbol.iterator,De="@@iterator";function Fe(e){if(e===null||typeof e!="object")return null;var r=re&&e[re]||e[De];return typeof r=="function"?r:null}var D=C.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ae("error",e,t)}}function Ae(e,r,t){{var n=D.ReactDebugCurrentFrame,i=n.getStackAddendum();i!==""&&(r+="%s",t=t.concat([i]));var u=t.map(function(o){return String(o)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var Ie=!1,We=!1,Ye=!1,Le=!1,Ve=!1,te;te=Symbol.for("react.module.reference");function Me(e){return!!(typeof e=="string"||typeof e=="function"||e===_||e===O||Ve||e===k||e===b||e===c||Le||e===V||Ie||We||Ye||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===d||e.$$typeof===R||e.$$typeof===w||e.$$typeof===s||e.$$typeof===te||e.getModuleId!==void 0))}function Ue(e,r,t){var n=e.displayName;if(n)return n;var i=r.displayName||r.name||"";return i!==""?t+"("+i+")":t}function ne(e){return e.displayName||"Context"}function P(e){if(e==null)return null;if(typeof e.tag=="number"&&v("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 _:return"Fragment";case m:return"Portal";case O:return"Profiler";case k:return"StrictMode";case b:return"Suspense";case c:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return ne(r)+".Consumer";case R:var t=e;return ne(t._context)+".Provider";case s:return Ue(e,e.render,"ForwardRef");case d:var n=e.displayName||null;return n!==null?n:P(e.type)||"Memo";case T:{var i=e,u=i._payload,o=i._init;try{return P(o(u))}catch{return null}}}return null}var j=Object.assign,Y=0,ae,oe,ie,ue,se,le,fe;function ce(){}ce.__reactDisabledLog=!0;function Ne(){{if(Y===0){ae=console.log,oe=console.info,ie=console.warn,ue=console.error,se=console.group,le=console.groupCollapsed,fe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}Y++}}function $e(){{if(Y--,Y===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:j({},e,{value:ae}),info:j({},e,{value:oe}),warn:j({},e,{value:ie}),error:j({},e,{value:ue}),group:j({},e,{value:se}),groupCollapsed:j({},e,{value:le}),groupEnd:j({},e,{value:fe})})}Y<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var J=D.ReactCurrentDispatcher,q;function M(e,r,t){{if(q===void 0)try{throw Error()}catch(i){var n=i.stack.trim().match(/\n( *(at )?)/);q=n&&n[1]||""}return`
|
|
18
|
+
`+q+e}}var z=!1,U;{var Be=typeof WeakMap=="function"?WeakMap:Map;U=new Be}function de(e,r){if(!e||z)return"";{var t=U.get(e);if(t!==void 0)return t}var n;z=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=J.current,J.current=null,Ne();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(g){n=g}Reflect.construct(e,[],o)}else{try{o.call()}catch(g){n=g}e.call(o.prototype)}}else{try{throw Error()}catch(g){n=g}e()}}catch(g){if(g&&n&&typeof g.stack=="string"){for(var a=g.stack.split(`
|
|
19
|
+
`),p=n.stack.split(`
|
|
20
|
+
`),l=a.length-1,f=p.length-1;l>=1&&f>=0&&a[l]!==p[f];)f--;for(;l>=1&&f>=0;l--,f--)if(a[l]!==p[f]){if(l!==1||f!==1)do if(l--,f--,f<0||a[l]!==p[f]){var E=`
|
|
21
|
+
`+a[l].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,E),E}while(l>=1&&f>=0);break}}}finally{z=!1,J.current=u,$e(),Error.prepareStackTrace=i}var A=e?e.displayName||e.name:"",x=A?M(A):"";return typeof e=="function"&&U.set(e,x),x}function Je(e,r,t){return de(e,!1)}function qe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function N(e,r,t){if(e==null)return"";if(typeof e=="function")return de(e,qe(e));if(typeof e=="string")return M(e);switch(e){case b:return M("Suspense");case c:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case s:return Je(e.render);case d:return N(e.type,r,t);case T:{var n=e,i=n._payload,u=n._init;try{return N(u(i),r,t)}catch{}}}return""}var L=Object.prototype.hasOwnProperty,ve={},pe=D.ReactDebugCurrentFrame;function $(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);pe.setExtraStackFrame(t)}else pe.setExtraStackFrame(null)}function ze(e,r,t,n,i){{var u=Function.call.bind(L);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var p=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw p.name="Invariant Violation",p}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(l){a=l}a&&!(a instanceof Error)&&($(i),v("%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).",n||"React class",t,o,typeof a),$(null)),a instanceof Error&&!(a.message in ve)&&(ve[a.message]=!0,$(i),v("Failed %s type: %s",t,a.message),$(null))}}}var Ke=Array.isArray;function K(e){return Ke(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Xe(e){try{return be(e),!1}catch{return!0}}function be(e){return""+e}function ge(e){if(Xe(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),be(e)}var Ee=D.ReactCurrentOwner,He={key:!0,ref:!0,__self:!0,__source:!0},ye,he;function Ze(e){if(L.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Qe(e){if(L.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function er(e,r){typeof e.ref=="string"&&Ee.current}function rr(e,r){{var t=function(){ye||(ye=!0,v("%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))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function tr(e,r){{var t=function(){he||(he=!0,v("%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))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var nr=function(e,r,t,n,i,u,o){var a={$$typeof:h,type:e,key:r,ref:t,props:o,_owner:u};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:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ar(e,r,t,n,i){{var u,o={},a=null,p=null;t!==void 0&&(ge(t),a=""+t),Qe(r)&&(ge(r.key),a=""+r.key),Ze(r)&&(p=r.ref,er(r,i));for(u in r)L.call(r,u)&&!He.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var l=e.defaultProps;for(u in l)o[u]===void 0&&(o[u]=l[u])}if(a||p){var f=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&rr(o,f),p&&tr(o,f)}return nr(e,a,p,i,n,Ee.current,o)}}var G=D.ReactCurrentOwner,Re=D.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=N(e.type,e._source,r?r.type:null);Re.setExtraStackFrame(t)}else Re.setExtraStackFrame(null)}var X;X=!1;function H(e){return typeof e=="object"&&e!==null&&e.$$typeof===h}function me(){{if(G.current){var e=P(G.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function or(e){return""}var _e={};function ir(e){{var r=me();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function we(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ir(r);if(_e[t])return;_e[t]=!0;var n="";e&&e._owner&&e._owner!==G.current&&(n=" It was passed a child from "+P(e._owner.type)+"."),F(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function Te(e,r){{if(typeof e!="object")return;if(K(e))for(var t=0;t<e.length;t++){var n=e[t];H(n)&&we(n,r)}else if(H(e))e._store&&(e._store.validated=!0);else if(e){var i=Fe(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)H(o.value)&&we(o.value,r)}}}function ur(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===s||r.$$typeof===d))t=r.propTypes;else return;if(t){var n=P(r);ze(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!X){X=!0;var i=P(r);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}var Oe={};function Pe(e,r,t,n,i,u){{var o=Me(e);if(!o){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 p=or();p?a+=p:a+=me();var l;e===null?l="null":K(e)?l="array":e!==void 0&&e.$$typeof===h?(l="<"+(P(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):l=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",l,a)}var f=ar(e,r,t,i,u);if(f==null)return f;if(o){var E=r.children;if(E!==void 0)if(n)if(K(E)){for(var A=0;A<E.length;A++)Te(E[A],e);Object.freeze&&Object.freeze(E)}else v("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 Te(E,e)}if(L.call(r,"key")){var x=P(e),g=Object.keys(r).filter(function(pr){return pr!=="key"}),Z=g.length>0?"{key: someKey, "+g.join(": ..., ")+": ...}":"{key: someKey}";if(!Oe[x+Z]){var vr=g.length>0?"{"+g.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Z,
|
|
30
|
+
<%s key={someKey} {...props} />`,Z,x,vr,x),Oe[x+Z]=!0}}return e===_?sr(f):ur(f),f}}function lr(e,r,t){return Pe(e,r,t,!0)}function fr(e,r,t){return Pe(e,r,t,!1)}var cr=fr,dr=lr;W.Fragment=_,W.jsx=cr,W.jsxs=dr}()),W}process.env.NODE_ENV==="production"?B.exports=Se():B.exports=Ce();var je=B.exports;function xe(){return new Promise((C,h)=>{if(window.require)return C(window.require);const m=document.createElement("script");m.src="/vs/loader.js",m.onload=()=>{if(!window.require)return h(new Error("RequireJS not available"));window.require.config({paths:{vs:"/vs"}}),C(window.require)},m.onerror=h,document.body.appendChild(m)})}const ke=y.forwardRef(function({value:h,theme:m,onChange:_},k){const O=y.useRef(null),R=y.useRef(null);y.useImperativeHandle(k,()=>({getValue(){var s;return((s=R.current)==null?void 0:s.getValue())??""},layout(){w()}}));function w(){const s=O.current,b=R.current;if(!s||!b)return;const{width:c,height:d}=s.getBoundingClientRect();b.layout({width:c,height:d})}return y.useEffect(()=>{const s=O.current;if(!s)return;let b=null;const c=()=>{requestAnimationFrame(()=>w())};return xe().then(d=>{d(["vs/editor/editor.main"],()=>{const T=window.monaco;s&&(b=T.editor.create(s,{value:h,language:"pebble",theme:m||"vs-dark"}),R.current=b,b.onDidChangeModelContent(()=>{_==null||_(b.getValue())}),window.addEventListener("resize",c))})}),()=>{var d;window.removeEventListener("resize",c),(d=R.current)==null||d.dispose(),R.current=null}},[h]),je.jsx("div",{ref:O,style:{height:"100%",width:"100%"}})});S.PebbleEditor=ke,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-pebble-editor",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-dev4",
|
|
4
4
|
"description": "React wrap component for monaco pebble editor",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@harmoniclabs/
|
|
21
|
+
"@harmoniclabs/pebble": "0.1.3-dev4",
|
|
22
22
|
"@types/node": "18.0.0",
|
|
23
23
|
"@types/react": "^18.0.0",
|
|
24
24
|
"@types/react-dom": "^18.0.0",
|
|
@@ -30,6 +30,6 @@
|
|
|
30
30
|
"vite": "^5.0.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@harmoniclabs/monaco-editor": "^0.1.
|
|
33
|
+
"@harmoniclabs/monaco-editor": "^0.1.1"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,36 +1,74 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
2
2
|
import { loadMonacoLoader } from '../utils/monaco-loader';
|
|
3
3
|
|
|
4
|
+
export interface PebbleEditorHandle {
|
|
5
|
+
getValue(): string;
|
|
6
|
+
layout(): void;
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
const PebbleEditor = forwardRef<PebbleEditorHandle, {
|
|
6
10
|
value: string;
|
|
7
11
|
theme?: string;
|
|
8
12
|
onChange?: (v: string) => void;
|
|
9
|
-
}) {
|
|
10
|
-
const
|
|
13
|
+
}>(function PebbleEditor({ value, theme, onChange }, ref) {
|
|
14
|
+
const outerRef = useRef<HTMLDivElement>(null);
|
|
15
|
+
const editorRef = useRef<any>(null);
|
|
16
|
+
|
|
17
|
+
useImperativeHandle(ref, () => ({
|
|
18
|
+
getValue() {
|
|
19
|
+
return editorRef.current?.getValue() ?? '';
|
|
20
|
+
},
|
|
21
|
+
layout() {
|
|
22
|
+
doLayout();
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
function doLayout() {
|
|
27
|
+
const outer = outerRef.current;
|
|
28
|
+
const editor = editorRef.current;
|
|
29
|
+
if (!outer || !editor) return;
|
|
30
|
+
// Read size from the outer div which is sized by CSS, not by Monaco
|
|
31
|
+
const { width, height } = outer.getBoundingClientRect();
|
|
32
|
+
editor.layout({ width, height });
|
|
33
|
+
}
|
|
11
34
|
|
|
12
35
|
useEffect(() => {
|
|
13
|
-
|
|
36
|
+
const outer = outerRef.current;
|
|
37
|
+
if (!outer) return;
|
|
38
|
+
|
|
39
|
+
let editor: any = null;
|
|
40
|
+
|
|
41
|
+
const onResize = () => {
|
|
42
|
+
requestAnimationFrame(() => doLayout());
|
|
43
|
+
};
|
|
44
|
+
|
|
14
45
|
loadMonacoLoader().then((require) => {
|
|
15
46
|
require(['vs/editor/editor.main'], () => {
|
|
16
47
|
const monaco = window.monaco;
|
|
17
|
-
if (!
|
|
18
|
-
editor = monaco.editor.create(
|
|
48
|
+
if (!outer) return;
|
|
49
|
+
editor = monaco.editor.create(outer, {
|
|
19
50
|
value,
|
|
20
51
|
language: 'pebble',
|
|
21
52
|
theme: theme || 'vs-dark',
|
|
22
53
|
});
|
|
54
|
+
editorRef.current = editor;
|
|
23
55
|
|
|
24
56
|
editor.onDidChangeModelContent(() => {
|
|
25
57
|
onChange?.(editor.getValue());
|
|
26
58
|
});
|
|
59
|
+
|
|
60
|
+
window.addEventListener('resize', onResize);
|
|
27
61
|
});
|
|
28
62
|
});
|
|
29
63
|
|
|
30
64
|
return () => {
|
|
31
|
-
|
|
65
|
+
window.removeEventListener('resize', onResize);
|
|
66
|
+
editorRef.current?.dispose();
|
|
67
|
+
editorRef.current = null;
|
|
32
68
|
};
|
|
33
69
|
}, [value]);
|
|
34
70
|
|
|
35
|
-
return <div ref={
|
|
36
|
-
}
|
|
71
|
+
return <div ref={outerRef} style={{ height: '100%', width: '100%' }} />;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export default PebbleEditor;
|
package/src/index.ts
CHANGED