react-pebble-editor 0.0.1 → 0.3.1
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/components/PebbleEditor.d.ts +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/react-pebble-editor.es.js +120 -698
- package/dist/react-pebble-editor.umd.js +1 -30
- package/dist/utils/monaco-loader.d.ts +1 -0
- package/package.json +15 -9
- package/example/README.md +0 -13
- package/example/eslint.config.js +0 -23
- package/example/index.html +0 -25
- package/example/package-lock.json +0 -1823
- package/example/package.json +0 -25
- package/example/public/examples/hello-pluts.pebble +0 -40
- package/example/public/examples/sample.pebble +0 -58
- package/example/public/vite.svg +0 -1
- package/example/src/App.css +0 -42
- package/example/src/App.js +0 -21
- package/example/src/App.tsx +0 -36
- package/example/src/assets/react.svg +0 -1
- package/example/src/index.css +0 -68
- package/example/src/main.js +0 -5
- package/example/src/main.tsx +0 -9
- package/example/tsconfig.json +0 -17
- package/example/tsconfig.tsbuildinfo +0 -1
- package/example/vite.config.ts +0 -43
- package/tsconfig.json +0 -19
- package/vite.config.ts +0 -23
|
@@ -1,700 +1,122 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function vr() {
|
|
14
|
-
if (Te) return I;
|
|
15
|
-
Te = 1;
|
|
16
|
-
var O = Oe, m = Symbol.for("react.element"), h = Symbol.for("react.fragment"), R = Object.prototype.hasOwnProperty, S = O.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, T = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
17
|
-
function y(_, s, b) {
|
|
18
|
-
var c, d = {}, w = null, W = null;
|
|
19
|
-
b !== void 0 && (w = "" + b), s.key !== void 0 && (w = "" + s.key), s.ref !== void 0 && (W = s.ref);
|
|
20
|
-
for (c in s) R.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: m, type: _, key: w, ref: W, props: d, _owner: S.current };
|
|
23
|
-
}
|
|
24
|
-
return I.Fragment = h, I.jsx = y, I.jsxs = y, I;
|
|
1
|
+
import { forwardRef as e, useEffect as t, useImperativeHandle as n, useRef as r } from "react";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
//#region src/utils/monaco-loader.tsx
|
|
4
|
+
function a() {
|
|
5
|
+
return new Promise((e, t) => {
|
|
6
|
+
if (window.require) return e(window.require);
|
|
7
|
+
let n = document.createElement("script");
|
|
8
|
+
n.src = "/vs/loader.js", n.onload = () => {
|
|
9
|
+
if (!window.require) return t(/* @__PURE__ */ Error("RequireJS not available"));
|
|
10
|
+
window.require.config({ paths: { vs: "/vs" } }), e(window.require);
|
|
11
|
+
}, n.onerror = t, document.body.appendChild(n);
|
|
12
|
+
});
|
|
25
13
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
function We() {
|
|
133
|
-
{
|
|
134
|
-
if (A === 0) {
|
|
135
|
-
ee = console.log, re = console.info, te = console.warn, ne = console.error, ae = console.group, oe = console.groupCollapsed, ie = console.groupEnd;
|
|
136
|
-
var e = {
|
|
137
|
-
configurable: !0,
|
|
138
|
-
enumerable: !0,
|
|
139
|
-
value: ue,
|
|
140
|
-
writable: !0
|
|
141
|
-
};
|
|
142
|
-
Object.defineProperties(console, {
|
|
143
|
-
info: e,
|
|
144
|
-
log: e,
|
|
145
|
-
warn: e,
|
|
146
|
-
error: e,
|
|
147
|
-
group: e,
|
|
148
|
-
groupCollapsed: e,
|
|
149
|
-
groupEnd: e
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
A++;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function Ye() {
|
|
156
|
-
{
|
|
157
|
-
if (A--, A === 0) {
|
|
158
|
-
var e = {
|
|
159
|
-
configurable: !0,
|
|
160
|
-
enumerable: !0,
|
|
161
|
-
writable: !0
|
|
162
|
-
};
|
|
163
|
-
Object.defineProperties(console, {
|
|
164
|
-
log: k({}, e, {
|
|
165
|
-
value: ee
|
|
166
|
-
}),
|
|
167
|
-
info: k({}, e, {
|
|
168
|
-
value: re
|
|
169
|
-
}),
|
|
170
|
-
warn: k({}, e, {
|
|
171
|
-
value: te
|
|
172
|
-
}),
|
|
173
|
-
error: k({}, e, {
|
|
174
|
-
value: ne
|
|
175
|
-
}),
|
|
176
|
-
group: k({}, e, {
|
|
177
|
-
value: ae
|
|
178
|
-
}),
|
|
179
|
-
groupCollapsed: k({}, e, {
|
|
180
|
-
value: oe
|
|
181
|
-
}),
|
|
182
|
-
groupEnd: k({}, e, {
|
|
183
|
-
value: ie
|
|
184
|
-
})
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
A < 0 && v("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
var U = j.ReactCurrentDispatcher, q;
|
|
191
|
-
function Y(e, r, t) {
|
|
192
|
-
{
|
|
193
|
-
if (q === void 0)
|
|
194
|
-
try {
|
|
195
|
-
throw Error();
|
|
196
|
-
} catch (i) {
|
|
197
|
-
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
-
q = n && n[1] || "";
|
|
199
|
-
}
|
|
200
|
-
return `
|
|
201
|
-
` + q + e;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
var B = !1, L;
|
|
205
|
-
{
|
|
206
|
-
var Le = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
|
-
L = new Le();
|
|
208
|
-
}
|
|
209
|
-
function se(e, r) {
|
|
210
|
-
if (!e || B)
|
|
211
|
-
return "";
|
|
212
|
-
{
|
|
213
|
-
var t = L.get(e);
|
|
214
|
-
if (t !== void 0)
|
|
215
|
-
return t;
|
|
216
|
-
}
|
|
217
|
-
var n;
|
|
218
|
-
B = !0;
|
|
219
|
-
var i = Error.prepareStackTrace;
|
|
220
|
-
Error.prepareStackTrace = void 0;
|
|
221
|
-
var u;
|
|
222
|
-
u = U.current, U.current = null, We();
|
|
223
|
-
try {
|
|
224
|
-
if (r) {
|
|
225
|
-
var o = function() {
|
|
226
|
-
throw Error();
|
|
227
|
-
};
|
|
228
|
-
if (Object.defineProperty(o.prototype, "props", {
|
|
229
|
-
set: function() {
|
|
230
|
-
throw Error();
|
|
231
|
-
}
|
|
232
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
233
|
-
try {
|
|
234
|
-
Reflect.construct(o, []);
|
|
235
|
-
} catch (g) {
|
|
236
|
-
n = g;
|
|
237
|
-
}
|
|
238
|
-
Reflect.construct(e, [], o);
|
|
239
|
-
} else {
|
|
240
|
-
try {
|
|
241
|
-
o.call();
|
|
242
|
-
} catch (g) {
|
|
243
|
-
n = g;
|
|
244
|
-
}
|
|
245
|
-
e.call(o.prototype);
|
|
246
|
-
}
|
|
247
|
-
} else {
|
|
248
|
-
try {
|
|
249
|
-
throw Error();
|
|
250
|
-
} catch (g) {
|
|
251
|
-
n = g;
|
|
252
|
-
}
|
|
253
|
-
e();
|
|
254
|
-
}
|
|
255
|
-
} catch (g) {
|
|
256
|
-
if (g && n && typeof g.stack == "string") {
|
|
257
|
-
for (var a = g.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
|
-
do
|
|
265
|
-
if (l--, f--, f < 0 || a[l] !== p[f]) {
|
|
266
|
-
var E = `
|
|
267
|
-
` + a[l].replace(" at new ", " at ");
|
|
268
|
-
return e.displayName && E.includes("<anonymous>") && (E = E.replace("<anonymous>", e.displayName)), typeof e == "function" && L.set(e, E), E;
|
|
269
|
-
}
|
|
270
|
-
while (l >= 1 && f >= 0);
|
|
271
|
-
break;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
} finally {
|
|
275
|
-
B = !1, U.current = u, Ye(), Error.prepareStackTrace = i;
|
|
276
|
-
}
|
|
277
|
-
var D = e ? e.displayName || e.name : "", P = D ? Y(D) : "";
|
|
278
|
-
return typeof e == "function" && L.set(e, P), P;
|
|
279
|
-
}
|
|
280
|
-
function Ve(e, r, t) {
|
|
281
|
-
return se(e, !1);
|
|
282
|
-
}
|
|
283
|
-
function Me(e) {
|
|
284
|
-
var r = e.prototype;
|
|
285
|
-
return !!(r && r.isReactComponent);
|
|
286
|
-
}
|
|
287
|
-
function V(e, r, t) {
|
|
288
|
-
if (e == null)
|
|
289
|
-
return "";
|
|
290
|
-
if (typeof e == "function")
|
|
291
|
-
return se(e, Me(e));
|
|
292
|
-
if (typeof e == "string")
|
|
293
|
-
return Y(e);
|
|
294
|
-
switch (e) {
|
|
295
|
-
case b:
|
|
296
|
-
return Y("Suspense");
|
|
297
|
-
case c:
|
|
298
|
-
return Y("SuspenseList");
|
|
299
|
-
}
|
|
300
|
-
if (typeof e == "object")
|
|
301
|
-
switch (e.$$typeof) {
|
|
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
|
-
try {
|
|
309
|
-
return V(u(i), r, t);
|
|
310
|
-
} catch {
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return "";
|
|
315
|
-
}
|
|
316
|
-
var F = Object.prototype.hasOwnProperty, le = {}, fe = j.ReactDebugCurrentFrame;
|
|
317
|
-
function M(e) {
|
|
318
|
-
if (e) {
|
|
319
|
-
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
320
|
-
fe.setExtraStackFrame(t);
|
|
321
|
-
} else
|
|
322
|
-
fe.setExtraStackFrame(null);
|
|
323
|
-
}
|
|
324
|
-
function Ue(e, r, t, n, i) {
|
|
325
|
-
{
|
|
326
|
-
var u = Function.call.bind(F);
|
|
327
|
-
for (var o in e)
|
|
328
|
-
if (u(e, o)) {
|
|
329
|
-
var a = void 0;
|
|
330
|
-
try {
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
var qe = Array.isArray;
|
|
344
|
-
function N(e) {
|
|
345
|
-
return qe(e);
|
|
346
|
-
}
|
|
347
|
-
function Be(e) {
|
|
348
|
-
{
|
|
349
|
-
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
|
-
return t;
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
function Ne(e) {
|
|
354
|
-
try {
|
|
355
|
-
return ce(e), !1;
|
|
356
|
-
} catch {
|
|
357
|
-
return !0;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function ce(e) {
|
|
361
|
-
return "" + e;
|
|
362
|
-
}
|
|
363
|
-
function de(e) {
|
|
364
|
-
if (Ne(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.", Be(e)), ce(e);
|
|
366
|
-
}
|
|
367
|
-
var ve = j.ReactCurrentOwner, Je = {
|
|
368
|
-
key: !0,
|
|
369
|
-
ref: !0,
|
|
370
|
-
__self: !0,
|
|
371
|
-
__source: !0
|
|
372
|
-
}, pe, be;
|
|
373
|
-
function ze(e) {
|
|
374
|
-
if (F.call(e, "ref")) {
|
|
375
|
-
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
|
-
if (r && r.isReactWarning)
|
|
377
|
-
return !1;
|
|
378
|
-
}
|
|
379
|
-
return e.ref !== void 0;
|
|
380
|
-
}
|
|
381
|
-
function Ke(e) {
|
|
382
|
-
if (F.call(e, "key")) {
|
|
383
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
|
-
if (r && r.isReactWarning)
|
|
385
|
-
return !1;
|
|
386
|
-
}
|
|
387
|
-
return e.key !== void 0;
|
|
388
|
-
}
|
|
389
|
-
function Ge(e, r) {
|
|
390
|
-
typeof e.ref == "string" && ve.current;
|
|
391
|
-
}
|
|
392
|
-
function Xe(e, r) {
|
|
393
|
-
{
|
|
394
|
-
var t = function() {
|
|
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
|
-
};
|
|
397
|
-
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
398
|
-
get: t,
|
|
399
|
-
configurable: !0
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
function He(e, r) {
|
|
404
|
-
{
|
|
405
|
-
var t = function() {
|
|
406
|
-
be || (be = !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
|
-
};
|
|
408
|
-
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
409
|
-
get: t,
|
|
410
|
-
configurable: !0
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
var Ze = function(e, r, t, n, i, u, o) {
|
|
415
|
-
var a = {
|
|
416
|
-
// This tag allows us to uniquely identify this as a React Element
|
|
417
|
-
$$typeof: m,
|
|
418
|
-
// Built-in properties that belong on the element
|
|
419
|
-
type: e,
|
|
420
|
-
key: r,
|
|
421
|
-
ref: t,
|
|
422
|
-
props: o,
|
|
423
|
-
// Record the component responsible for creating this element.
|
|
424
|
-
_owner: u
|
|
425
|
-
};
|
|
426
|
-
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
427
|
-
configurable: !1,
|
|
428
|
-
enumerable: !1,
|
|
429
|
-
writable: !0,
|
|
430
|
-
value: !1
|
|
431
|
-
}), Object.defineProperty(a, "_self", {
|
|
432
|
-
configurable: !1,
|
|
433
|
-
enumerable: !1,
|
|
434
|
-
writable: !1,
|
|
435
|
-
value: n
|
|
436
|
-
}), Object.defineProperty(a, "_source", {
|
|
437
|
-
configurable: !1,
|
|
438
|
-
enumerable: !1,
|
|
439
|
-
writable: !1,
|
|
440
|
-
value: i
|
|
441
|
-
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
442
|
-
};
|
|
443
|
-
function Qe(e, r, t, n, i) {
|
|
444
|
-
{
|
|
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
|
-
for (u in r)
|
|
448
|
-
F.call(r, u) && !Je.hasOwnProperty(u) && (o[u] = r[u]);
|
|
449
|
-
if (e && e.defaultProps) {
|
|
450
|
-
var l = e.defaultProps;
|
|
451
|
-
for (u in l)
|
|
452
|
-
o[u] === void 0 && (o[u] = l[u]);
|
|
453
|
-
}
|
|
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
|
-
}
|
|
458
|
-
return Ze(e, a, p, i, n, ve.current, o);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
var J = j.ReactCurrentOwner, ge = j.ReactDebugCurrentFrame;
|
|
462
|
-
function x(e) {
|
|
463
|
-
if (e) {
|
|
464
|
-
var r = e._owner, t = V(e.type, e._source, r ? r.type : null);
|
|
465
|
-
ge.setExtraStackFrame(t);
|
|
466
|
-
} else
|
|
467
|
-
ge.setExtraStackFrame(null);
|
|
468
|
-
}
|
|
469
|
-
var z;
|
|
470
|
-
z = !1;
|
|
471
|
-
function K(e) {
|
|
472
|
-
return typeof e == "object" && e !== null && e.$$typeof === m;
|
|
473
|
-
}
|
|
474
|
-
function Ee() {
|
|
475
|
-
{
|
|
476
|
-
if (J.current) {
|
|
477
|
-
var e = C(J.current.type);
|
|
478
|
-
if (e)
|
|
479
|
-
return `
|
|
480
|
-
|
|
481
|
-
Check the render method of \`` + e + "`.";
|
|
482
|
-
}
|
|
483
|
-
return "";
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function er(e) {
|
|
487
|
-
return "";
|
|
488
|
-
}
|
|
489
|
-
var me = {};
|
|
490
|
-
function rr(e) {
|
|
491
|
-
{
|
|
492
|
-
var r = Ee();
|
|
493
|
-
if (!r) {
|
|
494
|
-
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
495
|
-
t && (r = `
|
|
496
|
-
|
|
497
|
-
Check the top-level render call using <` + t + ">.");
|
|
498
|
-
}
|
|
499
|
-
return r;
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
function ye(e, r) {
|
|
503
|
-
{
|
|
504
|
-
if (!e._store || e._store.validated || e.key != null)
|
|
505
|
-
return;
|
|
506
|
-
e._store.validated = !0;
|
|
507
|
-
var t = rr(r);
|
|
508
|
-
if (me[t])
|
|
509
|
-
return;
|
|
510
|
-
me[t] = !0;
|
|
511
|
-
var n = "";
|
|
512
|
-
e && e._owner && e._owner !== J.current && (n = " It was passed a child from " + C(e._owner.type) + "."), x(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), x(null);
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
function he(e, r) {
|
|
516
|
-
{
|
|
517
|
-
if (typeof e != "object")
|
|
518
|
-
return;
|
|
519
|
-
if (N(e))
|
|
520
|
-
for (var t = 0; t < e.length; t++) {
|
|
521
|
-
var n = e[t];
|
|
522
|
-
K(n) && ye(n, r);
|
|
523
|
-
}
|
|
524
|
-
else if (K(e))
|
|
525
|
-
e._store && (e._store.validated = !0);
|
|
526
|
-
else if (e) {
|
|
527
|
-
var i = Pe(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
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
function tr(e) {
|
|
535
|
-
{
|
|
536
|
-
var r = e.type;
|
|
537
|
-
if (r == null || typeof r == "string")
|
|
538
|
-
return;
|
|
539
|
-
var t;
|
|
540
|
-
if (typeof r == "function")
|
|
541
|
-
t = r.propTypes;
|
|
542
|
-
else if (typeof r == "object" && (r.$$typeof === s || // Note: Memo only checks outer props here.
|
|
543
|
-
// Inner props are checked in the reconciler.
|
|
544
|
-
r.$$typeof === d))
|
|
545
|
-
t = r.propTypes;
|
|
546
|
-
else
|
|
547
|
-
return;
|
|
548
|
-
if (t) {
|
|
549
|
-
var n = C(r);
|
|
550
|
-
Ue(t, e.props, "prop", n, e);
|
|
551
|
-
} else if (r.PropTypes !== void 0 && !z) {
|
|
552
|
-
z = !0;
|
|
553
|
-
var i = C(r);
|
|
554
|
-
v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", i || "Unknown");
|
|
555
|
-
}
|
|
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
|
-
}
|
|
558
|
-
}
|
|
559
|
-
function nr(e) {
|
|
560
|
-
{
|
|
561
|
-
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
562
|
-
var n = r[t];
|
|
563
|
-
if (n !== "children" && n !== "key") {
|
|
564
|
-
x(e), v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), x(null);
|
|
565
|
-
break;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
e.ref !== null && (x(e), v("Invalid attribute `ref` supplied to `React.Fragment`."), x(null));
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
var Re = {};
|
|
572
|
-
function _e(e, r, t, n, i, u) {
|
|
573
|
-
{
|
|
574
|
-
var o = Ie(e);
|
|
575
|
-
if (!o) {
|
|
576
|
-
var a = "";
|
|
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 p = er();
|
|
579
|
-
p ? a += p : a += Ee();
|
|
580
|
-
var l;
|
|
581
|
-
e === null ? l = "null" : N(e) ? l = "array" : e !== void 0 && e.$$typeof === m ? (l = "<" + (C(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
|
-
}
|
|
583
|
-
var f = Qe(e, r, t, i, u);
|
|
584
|
-
if (f == null)
|
|
585
|
-
return f;
|
|
586
|
-
if (o) {
|
|
587
|
-
var E = r.children;
|
|
588
|
-
if (E !== void 0)
|
|
589
|
-
if (n)
|
|
590
|
-
if (N(E)) {
|
|
591
|
-
for (var D = 0; D < E.length; D++)
|
|
592
|
-
he(E[D], e);
|
|
593
|
-
Object.freeze && Object.freeze(E);
|
|
594
|
-
} else
|
|
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
|
-
else
|
|
597
|
-
he(E, e);
|
|
598
|
-
}
|
|
599
|
-
if (F.call(r, "key")) {
|
|
600
|
-
var P = C(e), g = Object.keys(r).filter(function(lr) {
|
|
601
|
-
return lr !== "key";
|
|
602
|
-
}), G = g.length > 0 ? "{key: someKey, " + g.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
-
if (!Re[P + G]) {
|
|
604
|
-
var sr = g.length > 0 ? "{" + g.join(": ..., ") + ": ...}" : "{}";
|
|
605
|
-
v(`A props object containing a "key" prop is being spread into JSX:
|
|
606
|
-
let props = %s;
|
|
607
|
-
<%s {...props} />
|
|
608
|
-
React keys must be passed directly to JSX without using spread:
|
|
609
|
-
let props = %s;
|
|
610
|
-
<%s key={someKey} {...props} />`, G, P, sr, P), Re[P + G] = !0;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
return e === R ? nr(f) : tr(f), f;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
function ar(e, r, t) {
|
|
617
|
-
return _e(e, r, t, !0);
|
|
618
|
-
}
|
|
619
|
-
function or(e, r, t) {
|
|
620
|
-
return _e(e, r, t, !1);
|
|
621
|
-
}
|
|
622
|
-
var ir = or, ur = ar;
|
|
623
|
-
$.Fragment = R, $.jsx = ir, $.jsxs = ur;
|
|
624
|
-
}()), $;
|
|
625
|
-
}
|
|
626
|
-
process.env.NODE_ENV === "production" ? X.exports = vr() : X.exports = pr();
|
|
627
|
-
var br = X.exports;
|
|
628
|
-
function gr() {
|
|
629
|
-
return new Promise((O, m) => {
|
|
630
|
-
if (window.require) return O(window.require);
|
|
631
|
-
const h = document.createElement("script");
|
|
632
|
-
h.src = "/vs/loader.js", h.onload = () => {
|
|
633
|
-
if (!window.require) return m(new Error("RequireJS not available"));
|
|
634
|
-
window.require.config({ paths: { vs: "/vs" } }), O(window.require);
|
|
635
|
-
}, h.onerror = m, document.body.appendChild(h);
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
const mr = fr(function({ value: m, theme: h, onChange: R }, S) {
|
|
639
|
-
const T = we(null), y = we(null);
|
|
640
|
-
cr(S, () => ({
|
|
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, b = y.current;
|
|
651
|
-
if (!s || !b) return;
|
|
652
|
-
const { width: c, height: d } = s.getBoundingClientRect();
|
|
653
|
-
b.layout({ width: c, height: d });
|
|
654
|
-
}
|
|
655
|
-
return dr(() => {
|
|
656
|
-
const s = T.current;
|
|
657
|
-
if (!s) return;
|
|
658
|
-
let b = null;
|
|
659
|
-
const c = () => {
|
|
660
|
-
requestAnimationFrame(() => _());
|
|
661
|
-
};
|
|
662
|
-
return gr().then((d) => {
|
|
663
|
-
d(["vs/editor/editor.main"], () => {
|
|
664
|
-
const w = window.monaco;
|
|
665
|
-
s && (w.editor.defineTheme("pebble-dark", {
|
|
666
|
-
base: "vs-dark",
|
|
667
|
-
inherit: !0,
|
|
668
|
-
rules: [
|
|
669
|
-
{ token: "keyword.pebble", foreground: "569CD6" },
|
|
670
|
-
{ token: "keyword.control.pebble", foreground: "C586C0" },
|
|
671
|
-
{ token: "identifier.pebble", foreground: "9CDCFE" },
|
|
672
|
-
{ token: "identifier.constant.pebble", foreground: "4FC1FF" },
|
|
673
|
-
{ token: "type.identifier.pebble", foreground: "4EC9B0" },
|
|
674
|
-
{ token: "entity.name.function.pebble", foreground: "DCDCAA" },
|
|
675
|
-
{ token: "number.pebble", foreground: "B5CEA8" },
|
|
676
|
-
{ token: "number.float.pebble", foreground: "B5CEA8" },
|
|
677
|
-
{ token: "string.pebble", foreground: "CE9178" },
|
|
678
|
-
{ token: "comment.pebble", foreground: "6A9955" },
|
|
679
|
-
{ token: "comment.doc.pebble", foreground: "6A9955" },
|
|
680
|
-
{ token: "delimiter.pebble", foreground: "D4D4D4" },
|
|
681
|
-
{ token: "delimiter.bracket.pebble", foreground: "D4D4D4" }
|
|
682
|
-
],
|
|
683
|
-
colors: {}
|
|
684
|
-
}), b = w.editor.create(s, {
|
|
685
|
-
value: m,
|
|
686
|
-
language: "pebble",
|
|
687
|
-
theme: h || "pebble-dark"
|
|
688
|
-
}), y.current = b, b.onDidChangeModelContent(() => {
|
|
689
|
-
R == null || R(b.getValue());
|
|
690
|
-
}), window.addEventListener("resize", c));
|
|
691
|
-
});
|
|
692
|
-
}), () => {
|
|
693
|
-
var d;
|
|
694
|
-
window.removeEventListener("resize", c), (d = y.current) == null || d.dispose(), y.current = null;
|
|
695
|
-
};
|
|
696
|
-
}, [m]), /* @__PURE__ */ br.jsx("div", { ref: T, style: { height: "100%", width: "100%" } });
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/components/PebbleEditor.tsx
|
|
16
|
+
var o = e(function({ value: e, theme: o, onChange: s }, c) {
|
|
17
|
+
let l = r(null), u = r(null);
|
|
18
|
+
n(c, () => ({
|
|
19
|
+
getValue() {
|
|
20
|
+
return u.current?.getValue() ?? "";
|
|
21
|
+
},
|
|
22
|
+
layout() {
|
|
23
|
+
d();
|
|
24
|
+
}
|
|
25
|
+
}));
|
|
26
|
+
function d() {
|
|
27
|
+
let e = l.current, t = u.current;
|
|
28
|
+
if (!e || !t) return;
|
|
29
|
+
let { width: n, height: r } = e.getBoundingClientRect();
|
|
30
|
+
t.layout({
|
|
31
|
+
width: n,
|
|
32
|
+
height: r
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return t(() => {
|
|
36
|
+
let t = l.current;
|
|
37
|
+
if (!t) return;
|
|
38
|
+
let n = null, r = () => {
|
|
39
|
+
requestAnimationFrame(() => d());
|
|
40
|
+
};
|
|
41
|
+
return a().then((i) => {
|
|
42
|
+
i(["vs/editor/editor.main"], () => {
|
|
43
|
+
let i = window.monaco;
|
|
44
|
+
t && (i.editor.defineTheme("pebble-dark", {
|
|
45
|
+
base: "vs-dark",
|
|
46
|
+
inherit: !0,
|
|
47
|
+
rules: [
|
|
48
|
+
{
|
|
49
|
+
token: "keyword.pebble",
|
|
50
|
+
foreground: "569CD6"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
token: "keyword.control.pebble",
|
|
54
|
+
foreground: "C586C0"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
token: "identifier.pebble",
|
|
58
|
+
foreground: "9CDCFE"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
token: "identifier.constant.pebble",
|
|
62
|
+
foreground: "4FC1FF"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
token: "type.identifier.pebble",
|
|
66
|
+
foreground: "4EC9B0"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
token: "entity.name.function.pebble",
|
|
70
|
+
foreground: "DCDCAA"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
token: "number.pebble",
|
|
74
|
+
foreground: "B5CEA8"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
token: "number.float.pebble",
|
|
78
|
+
foreground: "B5CEA8"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
token: "string.pebble",
|
|
82
|
+
foreground: "CE9178"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
token: "comment.pebble",
|
|
86
|
+
foreground: "6A9955"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
token: "comment.doc.pebble",
|
|
90
|
+
foreground: "6A9955"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
token: "delimiter.pebble",
|
|
94
|
+
foreground: "D4D4D4"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
token: "delimiter.bracket.pebble",
|
|
98
|
+
foreground: "D4D4D4"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
colors: {}
|
|
102
|
+
}), n = i.editor.create(t, {
|
|
103
|
+
value: e,
|
|
104
|
+
language: "pebble",
|
|
105
|
+
theme: o || "pebble-dark"
|
|
106
|
+
}), u.current = n, n.onDidChangeModelContent(() => {
|
|
107
|
+
s?.(n.getValue());
|
|
108
|
+
}), window.addEventListener("resize", r));
|
|
109
|
+
});
|
|
110
|
+
}), () => {
|
|
111
|
+
window.removeEventListener("resize", r), u.current?.dispose(), u.current = null;
|
|
112
|
+
};
|
|
113
|
+
}, [e]), /* @__PURE__ */ i("div", {
|
|
114
|
+
ref: l,
|
|
115
|
+
style: {
|
|
116
|
+
height: "100%",
|
|
117
|
+
width: "100%"
|
|
118
|
+
}
|
|
119
|
+
});
|
|
697
120
|
});
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
};
|
|
121
|
+
//#endregion
|
|
122
|
+
export { o as PebbleEditor };
|