@stonecrop/code-editor 0.2.5 → 0.2.7

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,779 +0,0 @@
1
- import { defineComponent as _, ref as C, onMounted as $, openBlock as x, createElementBlock as q, createElementVNode as D } from "vue";
2
- function B(e, n, r) {
3
- return n in e ? Object.defineProperty(e, n, {
4
- value: r,
5
- enumerable: !0,
6
- configurable: !0,
7
- writable: !0
8
- }) : e[n] = r, e;
9
- }
10
- function k(e, n) {
11
- var r = Object.keys(e);
12
- if (Object.getOwnPropertySymbols) {
13
- var t = Object.getOwnPropertySymbols(e);
14
- n && (t = t.filter(function(o) {
15
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
16
- })), r.push.apply(r, t);
17
- }
18
- return r;
19
- }
20
- function y(e) {
21
- for (var n = 1; n < arguments.length; n++) {
22
- var r = arguments[n] != null ? arguments[n] : {};
23
- n % 2 ? k(Object(r), !0).forEach(function(t) {
24
- B(e, t, r[t]);
25
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : k(Object(r)).forEach(function(t) {
26
- Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
27
- });
28
- }
29
- return e;
30
- }
31
- function L(e, n) {
32
- if (e == null)
33
- return {};
34
- var r = {}, t = Object.keys(e), o, i;
35
- for (i = 0; i < t.length; i++)
36
- o = t[i], !(n.indexOf(o) >= 0) && (r[o] = e[o]);
37
- return r;
38
- }
39
- function H(e, n) {
40
- if (e == null)
41
- return {};
42
- var r = L(e, n), t, o;
43
- if (Object.getOwnPropertySymbols) {
44
- var i = Object.getOwnPropertySymbols(e);
45
- for (o = 0; o < i.length; o++)
46
- t = i[o], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(e, t) && (r[t] = e[t]);
47
- }
48
- return r;
49
- }
50
- function M(e, n) {
51
- return R(e) || z(e, n) || F(e, n) || W();
52
- }
53
- function R(e) {
54
- if (Array.isArray(e))
55
- return e;
56
- }
57
- function z(e, n) {
58
- if (!(typeof Symbol > "u" || !(Symbol.iterator in Object(e)))) {
59
- var r = [], t = !0, o = !1, i = void 0;
60
- try {
61
- for (var a = e[Symbol.iterator](), u; !(t = (u = a.next()).done) && (r.push(u.value), !(n && r.length === n)); t = !0)
62
- ;
63
- } catch (c) {
64
- o = !0, i = c;
65
- } finally {
66
- try {
67
- !t && a.return != null && a.return();
68
- } finally {
69
- if (o)
70
- throw i;
71
- }
72
- }
73
- return r;
74
- }
75
- }
76
- function F(e, n) {
77
- if (e) {
78
- if (typeof e == "string")
79
- return O(e, n);
80
- var r = Object.prototype.toString.call(e).slice(8, -1);
81
- if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set")
82
- return Array.from(e);
83
- if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
84
- return O(e, n);
85
- }
86
- }
87
- function O(e, n) {
88
- (n == null || n > e.length) && (n = e.length);
89
- for (var r = 0, t = new Array(n); r < n; r++)
90
- t[r] = e[r];
91
- return t;
92
- }
93
- function W() {
94
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
95
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
96
- }
97
- function G(e, n, r) {
98
- return n in e ? Object.defineProperty(e, n, {
99
- value: r,
100
- enumerable: !0,
101
- configurable: !0,
102
- writable: !0
103
- }) : e[n] = r, e;
104
- }
105
- function w(e, n) {
106
- var r = Object.keys(e);
107
- if (Object.getOwnPropertySymbols) {
108
- var t = Object.getOwnPropertySymbols(e);
109
- n && (t = t.filter(function(o) {
110
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
111
- })), r.push.apply(r, t);
112
- }
113
- return r;
114
- }
115
- function j(e) {
116
- for (var n = 1; n < arguments.length; n++) {
117
- var r = arguments[n] != null ? arguments[n] : {};
118
- n % 2 ? w(Object(r), !0).forEach(function(t) {
119
- G(e, t, r[t]);
120
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : w(Object(r)).forEach(function(t) {
121
- Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
122
- });
123
- }
124
- return e;
125
- }
126
- function N() {
127
- for (var e = arguments.length, n = new Array(e), r = 0; r < e; r++)
128
- n[r] = arguments[r];
129
- return function(t) {
130
- return n.reduceRight(function(o, i) {
131
- return i(o);
132
- }, t);
133
- };
134
- }
135
- function d(e) {
136
- return function n() {
137
- for (var r = this, t = arguments.length, o = new Array(t), i = 0; i < t; i++)
138
- o[i] = arguments[i];
139
- return o.length >= e.length ? e.apply(this, o) : function() {
140
- for (var a = arguments.length, u = new Array(a), c = 0; c < a; c++)
141
- u[c] = arguments[c];
142
- return n.apply(r, [].concat(o, u));
143
- };
144
- };
145
- }
146
- function m(e) {
147
- return {}.toString.call(e).includes("Object");
148
- }
149
- function U(e) {
150
- return !Object.keys(e).length;
151
- }
152
- function l(e) {
153
- return typeof e == "function";
154
- }
155
- function K(e, n) {
156
- return Object.prototype.hasOwnProperty.call(e, n);
157
- }
158
- function V(e, n) {
159
- return m(n) || f("changeType"), Object.keys(n).some(function(r) {
160
- return !K(e, r);
161
- }) && f("changeField"), n;
162
- }
163
- function Y(e) {
164
- l(e) || f("selectorType");
165
- }
166
- function J(e) {
167
- l(e) || m(e) || f("handlerType"), m(e) && Object.values(e).some(function(n) {
168
- return !l(n);
169
- }) && f("handlersType");
170
- }
171
- function Q(e) {
172
- e || f("initialIsRequired"), m(e) || f("initialType"), U(e) && f("initialContent");
173
- }
174
- function X(e, n) {
175
- throw new Error(e[n] || e.default);
176
- }
177
- var Z = {
178
- initialIsRequired: "initial state is required",
179
- initialType: "initial state should be an object",
180
- initialContent: "initial state shouldn't be an empty object",
181
- handlerType: "handler should be an object or a function",
182
- handlersType: "all handlers should be a functions",
183
- selectorType: "selector should be a function",
184
- changeType: "provided value of changes should be an object",
185
- changeField: 'it seams you want to change a field in the state which is not specified in the "initial" state',
186
- default: "an unknown error accured in `state-local` package"
187
- }, f = d(X)(Z), p = {
188
- changes: V,
189
- selector: Y,
190
- handler: J,
191
- initial: Q
192
- };
193
- function ee(e) {
194
- var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
195
- p.initial(e), p.handler(n);
196
- var r = {
197
- current: e
198
- }, t = d(te)(r, n), o = d(re)(r), i = d(p.changes)(e), a = d(ne)(r);
199
- function u() {
200
- var s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function(T) {
201
- return T;
202
- };
203
- return p.selector(s), s(r.current);
204
- }
205
- function c(s) {
206
- N(t, o, i, a)(s);
207
- }
208
- return [u, c];
209
- }
210
- function ne(e, n) {
211
- return l(n) ? n(e.current) : n;
212
- }
213
- function re(e, n) {
214
- return e.current = j(j({}, e.current), n), n;
215
- }
216
- function te(e, n, r) {
217
- return l(n) ? n(e.current) : Object.keys(r).forEach(function(t) {
218
- var o;
219
- return (o = n[t]) === null || o === void 0 ? void 0 : o.call(n, e.current[t]);
220
- }), r;
221
- }
222
- var oe = {
223
- create: ee
224
- }, ie = {
225
- paths: {
226
- vs: "https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/min/vs"
227
- }
228
- };
229
- function ae(e) {
230
- return function n() {
231
- for (var r = this, t = arguments.length, o = new Array(t), i = 0; i < t; i++)
232
- o[i] = arguments[i];
233
- return o.length >= e.length ? e.apply(this, o) : function() {
234
- for (var a = arguments.length, u = new Array(a), c = 0; c < a; c++)
235
- u[c] = arguments[c];
236
- return n.apply(r, [].concat(o, u));
237
- };
238
- };
239
- }
240
- function ce(e) {
241
- return {}.toString.call(e).includes("Object");
242
- }
243
- function ue(e) {
244
- return e || S("configIsRequired"), ce(e) || S("configType"), e.urls ? (fe(), {
245
- paths: {
246
- vs: e.urls.monacoBase
247
- }
248
- }) : e;
249
- }
250
- function fe() {
251
- console.warn(P.deprecation);
252
- }
253
- function de(e, n) {
254
- throw new Error(e[n] || e.default);
255
- }
256
- var P = {
257
- configIsRequired: "the configuration object is required",
258
- configType: "the configuration object should be an object",
259
- default: "an unknown error accured in `@monaco-editor/loader` package",
260
- deprecation: `Deprecation warning!
261
- You are using deprecated way of configuration.
262
-
263
- Instead of using
264
- monaco.config({ urls: { monacoBase: '...' } })
265
- use
266
- monaco.config({ paths: { vs: '...' } })
267
-
268
- For more please check the link https://github.com/suren-atoyan/monaco-loader#config
269
- `
270
- }, S = ae(de)(P), le = {
271
- config: ue
272
- }, ge = function() {
273
- for (var n = arguments.length, r = new Array(n), t = 0; t < n; t++)
274
- r[t] = arguments[t];
275
- return function(o) {
276
- return r.reduceRight(function(i, a) {
277
- return a(i);
278
- }, o);
279
- };
280
- };
281
- function I(e, n) {
282
- return Object.keys(n).forEach(function(r) {
283
- n[r] instanceof Object && e[r] && Object.assign(n[r], I(e[r], n[r]));
284
- }), y(y({}, e), n);
285
- }
286
- var se = {
287
- type: "cancelation",
288
- msg: "operation is manually canceled"
289
- };
290
- function h(e) {
291
- var n = !1, r = new Promise(function(t, o) {
292
- e.then(function(i) {
293
- return n ? o(se) : t(i);
294
- }), e.catch(o);
295
- });
296
- return r.cancel = function() {
297
- return n = !0;
298
- }, r;
299
- }
300
- var pe = oe.create({
301
- config: ie,
302
- isInitialized: !1,
303
- resolve: null,
304
- reject: null,
305
- monaco: null
306
- }), E = M(pe, 2), g = E[0], b = E[1];
307
- function me(e) {
308
- var n = le.config(e), r = n.monaco, t = H(n, ["monaco"]);
309
- b(function(o) {
310
- return {
311
- config: I(o.config, t),
312
- monaco: r
313
- };
314
- });
315
- }
316
- function be() {
317
- var e = g(function(n) {
318
- var r = n.monaco, t = n.isInitialized, o = n.resolve;
319
- return {
320
- monaco: r,
321
- isInitialized: t,
322
- resolve: o
323
- };
324
- });
325
- if (!e.isInitialized) {
326
- if (b({
327
- isInitialized: !0
328
- }), e.monaco)
329
- return e.resolve(e.monaco), h(v);
330
- if (window.monaco && window.monaco.editor)
331
- return A(window.monaco), e.resolve(window.monaco), h(v);
332
- ge(he, ke)(ye);
333
- }
334
- return h(v);
335
- }
336
- function he(e) {
337
- return document.body.appendChild(e);
338
- }
339
- function ve(e) {
340
- var n = document.createElement("script");
341
- return e && (n.src = e), n;
342
- }
343
- function ke(e) {
344
- var n = g(function(t) {
345
- var o = t.config, i = t.reject;
346
- return {
347
- config: o,
348
- reject: i
349
- };
350
- }), r = ve("".concat(n.config.paths.vs, "/loader.js"));
351
- return r.onload = function() {
352
- return e();
353
- }, r.onerror = n.reject, r;
354
- }
355
- function ye() {
356
- var e = g(function(r) {
357
- var t = r.config, o = r.resolve, i = r.reject;
358
- return {
359
- config: t,
360
- resolve: o,
361
- reject: i
362
- };
363
- }), n = window.require;
364
- n.config(e.config), n(["vs/editor/editor.main"], function(r) {
365
- A(r), e.resolve(r);
366
- }, function(r) {
367
- e.reject(r);
368
- });
369
- }
370
- function A(e) {
371
- g().monaco || b({
372
- monaco: e
373
- });
374
- }
375
- function Oe() {
376
- return g(function(e) {
377
- var n = e.monaco;
378
- return n;
379
- });
380
- }
381
- var v = new Promise(function(e, n) {
382
- return b({
383
- resolve: e,
384
- reject: n
385
- });
386
- }), we = {
387
- config: me,
388
- init: be,
389
- __getMonacoInstance: Oe
390
- };
391
- const je = {
392
- base: "vs",
393
- inherit: !0,
394
- colors: {
395
- "editor.foreground": "#24292e",
396
- "editor.background": "#ffffff",
397
- "editor.selectionBackground": "#c8c8fa",
398
- "editor.inactiveSelectionBackground": "#fafbfc",
399
- "editor.lineHighlightBackground": "#fafbfc",
400
- "editorCursor.foreground": "#24292e",
401
- "editorWhitespace.foreground": "#959da5",
402
- "editorIndentGuide.background": "#959da5",
403
- "editorIndentGuide.activeBackground": "#24292e",
404
- "editor.selectionHighlightBorder": "#fafbfc"
405
- },
406
- rules: [
407
- {
408
- background: "ffffff",
409
- token: ""
410
- },
411
- {
412
- foreground: "6a737d",
413
- token: "comment"
414
- },
415
- {
416
- foreground: "6a737d",
417
- token: "punctuation.definition.comment"
418
- },
419
- {
420
- foreground: "6a737d",
421
- token: "string.comment"
422
- },
423
- {
424
- foreground: "005cc5",
425
- token: "constant"
426
- },
427
- {
428
- foreground: "005cc5",
429
- token: "entity.name.constant"
430
- },
431
- {
432
- foreground: "005cc5",
433
- token: "variable.other.constant"
434
- },
435
- {
436
- foreground: "005cc5",
437
- token: "variable.language"
438
- },
439
- {
440
- foreground: "6f42c1",
441
- token: "entity"
442
- },
443
- {
444
- foreground: "6f42c1",
445
- token: "entity.name"
446
- },
447
- {
448
- foreground: "24292e",
449
- token: "variable.parameter.function"
450
- },
451
- {
452
- foreground: "22863a",
453
- token: "entity.name.tag"
454
- },
455
- {
456
- foreground: "d73a49",
457
- token: "keyword"
458
- },
459
- {
460
- foreground: "d73a49",
461
- token: "storage"
462
- },
463
- {
464
- foreground: "d73a49",
465
- token: "storage.type"
466
- },
467
- {
468
- foreground: "24292e",
469
- token: "storage.modifier.package"
470
- },
471
- {
472
- foreground: "24292e",
473
- token: "storage.modifier.import"
474
- },
475
- {
476
- foreground: "24292e",
477
- token: "storage.type.java"
478
- },
479
- {
480
- foreground: "032f62",
481
- token: "string"
482
- },
483
- {
484
- foreground: "032f62",
485
- token: "punctuation.definition.string"
486
- },
487
- {
488
- foreground: "032f62",
489
- token: "string punctuation.section.embedded source"
490
- },
491
- {
492
- foreground: "005cc5",
493
- token: "support"
494
- },
495
- {
496
- foreground: "005cc5",
497
- token: "meta.property-name"
498
- },
499
- {
500
- foreground: "e36209",
501
- token: "variable"
502
- },
503
- {
504
- foreground: "24292e",
505
- token: "variable.other"
506
- },
507
- {
508
- foreground: "b31d28",
509
- fontStyle: "bold italic underline",
510
- token: "invalid.broken"
511
- },
512
- {
513
- foreground: "b31d28",
514
- fontStyle: "bold italic underline",
515
- token: "invalid.deprecated"
516
- },
517
- {
518
- foreground: "fafbfc",
519
- background: "b31d28",
520
- fontStyle: "italic underline",
521
- token: "invalid.illegal"
522
- },
523
- {
524
- foreground: "fafbfc",
525
- background: "d73a49",
526
- fontStyle: "italic underline",
527
- token: "carriage-return"
528
- },
529
- {
530
- foreground: "b31d28",
531
- fontStyle: "bold italic underline",
532
- token: "invalid.unimplemented"
533
- },
534
- {
535
- foreground: "b31d28",
536
- token: "message.error"
537
- },
538
- {
539
- foreground: "24292e",
540
- token: "string source"
541
- },
542
- {
543
- foreground: "005cc5",
544
- token: "string variable"
545
- },
546
- {
547
- foreground: "032f62",
548
- token: "source.regexp"
549
- },
550
- {
551
- foreground: "032f62",
552
- token: "string.regexp"
553
- },
554
- {
555
- foreground: "032f62",
556
- token: "string.regexp.character-class"
557
- },
558
- {
559
- foreground: "032f62",
560
- token: "string.regexp constant.character.escape"
561
- },
562
- {
563
- foreground: "032f62",
564
- token: "string.regexp source.ruby.embedded"
565
- },
566
- {
567
- foreground: "032f62",
568
- token: "string.regexp string.regexp.arbitrary-repitition"
569
- },
570
- {
571
- foreground: "22863a",
572
- fontStyle: "bold",
573
- token: "string.regexp constant.character.escape"
574
- },
575
- {
576
- foreground: "005cc5",
577
- token: "support.constant"
578
- },
579
- {
580
- foreground: "005cc5",
581
- token: "support.variable"
582
- },
583
- {
584
- foreground: "005cc5",
585
- token: "meta.module-reference"
586
- },
587
- {
588
- foreground: "735c0f",
589
- token: "markup.list"
590
- },
591
- {
592
- foreground: "005cc5",
593
- fontStyle: "bold",
594
- token: "markup.heading"
595
- },
596
- {
597
- foreground: "005cc5",
598
- fontStyle: "bold",
599
- token: "markup.heading entity.name"
600
- },
601
- {
602
- foreground: "22863a",
603
- token: "markup.quote"
604
- },
605
- {
606
- foreground: "24292e",
607
- fontStyle: "italic",
608
- token: "markup.italic"
609
- },
610
- {
611
- foreground: "24292e",
612
- fontStyle: "bold",
613
- token: "markup.bold"
614
- },
615
- {
616
- foreground: "005cc5",
617
- token: "markup.raw"
618
- },
619
- {
620
- foreground: "b31d28",
621
- background: "ffeef0",
622
- token: "markup.deleted"
623
- },
624
- {
625
- foreground: "b31d28",
626
- background: "ffeef0",
627
- token: "meta.diff.header.from-file"
628
- },
629
- {
630
- foreground: "b31d28",
631
- background: "ffeef0",
632
- token: "punctuation.definition.deleted"
633
- },
634
- {
635
- foreground: "22863a",
636
- background: "f0fff4",
637
- token: "markup.inserted"
638
- },
639
- {
640
- foreground: "22863a",
641
- background: "f0fff4",
642
- token: "meta.diff.header.to-file"
643
- },
644
- {
645
- foreground: "22863a",
646
- background: "f0fff4",
647
- token: "punctuation.definition.inserted"
648
- },
649
- {
650
- foreground: "e36209",
651
- background: "ffebda",
652
- token: "markup.changed"
653
- },
654
- {
655
- foreground: "e36209",
656
- background: "ffebda",
657
- token: "punctuation.definition.changed"
658
- },
659
- {
660
- foreground: "f6f8fa",
661
- background: "005cc5",
662
- token: "markup.ignored"
663
- },
664
- {
665
- foreground: "f6f8fa",
666
- background: "005cc5",
667
- token: "markup.untracked"
668
- },
669
- {
670
- foreground: "6f42c1",
671
- fontStyle: "bold",
672
- token: "meta.diff.range"
673
- },
674
- {
675
- foreground: "005cc5",
676
- token: "meta.diff.header"
677
- },
678
- {
679
- foreground: "005cc5",
680
- fontStyle: "bold",
681
- token: "meta.separator"
682
- },
683
- {
684
- foreground: "005cc5",
685
- token: "meta.output"
686
- },
687
- {
688
- foreground: "586069",
689
- token: "brackethighlighter.tag"
690
- },
691
- {
692
- foreground: "586069",
693
- token: "brackethighlighter.curly"
694
- },
695
- {
696
- foreground: "586069",
697
- token: "brackethighlighter.round"
698
- },
699
- {
700
- foreground: "586069",
701
- token: "brackethighlighter.square"
702
- },
703
- {
704
- foreground: "586069",
705
- token: "brackethighlighter.angle"
706
- },
707
- {
708
- foreground: "586069",
709
- token: "brackethighlighter.quote"
710
- },
711
- {
712
- foreground: "b31d28",
713
- token: "brackethighlighter.unmatched"
714
- },
715
- {
716
- foreground: "b31d28",
717
- token: "sublimelinter.mark.error"
718
- },
719
- {
720
- foreground: "e36209",
721
- token: "sublimelinter.mark.warning"
722
- },
723
- {
724
- foreground: "959da5",
725
- token: "sublimelinter.gutter-mark"
726
- },
727
- {
728
- foreground: "032f62",
729
- fontStyle: "underline",
730
- token: "constant.other.reference.link"
731
- },
732
- {
733
- foreground: "032f62",
734
- fontStyle: "underline",
735
- token: "string.other.link"
736
- }
737
- ]
738
- }, Se = {
739
- ref: "editorContainer",
740
- id: "editor-container"
741
- }, Pe = /* @__PURE__ */ _({
742
- __name: "ACodeEditor",
743
- props: {
744
- options: {}
745
- },
746
- setup(e) {
747
- const n = e, r = C(null), t = {
748
- ...n.options,
749
- automaticLayout: !0,
750
- colorDecorators: !0,
751
- lineHeight: 24,
752
- scrollBeyondLastLine: !1
753
- };
754
- return $(async () => {
755
- const i = (await we.init()).editor;
756
- i.defineTheme("agritheory", je), i.setTheme("agritheory"), i.create(r.value, t);
757
- }), (o, i) => (x(), q("div", Se, [
758
- D("div", {
759
- ref_key: "aCodeEditor",
760
- ref: r,
761
- id: "editor-area"
762
- }, null, 512)
763
- ], 512));
764
- }
765
- });
766
- const Ie = (e, n) => {
767
- const r = e.__vccOpts || e;
768
- for (const [t, o] of n)
769
- r[t] = o;
770
- return r;
771
- }, Ee = /* @__PURE__ */ Ie(Pe, [["__scopeId", "data-v-28cc715a"]]);
772
- function Te(e) {
773
- e.component("ACodeEditor", Ee);
774
- }
775
- export {
776
- Ee as ACodeEditor,
777
- Te as install
778
- };
779
- //# sourceMappingURL=code-editor.js.map