@veltra/desktop 1.3.0 → 1.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.
Files changed (51) hide show
  1. package/dist/components/action/action-group.vue.d.ts +2 -2
  2. package/dist/components/action/action.vue.d.ts +1 -1
  3. package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
  4. package/dist/components/breadcrumb/style2.css +1 -2
  5. package/dist/components/button/style2.css +3 -3
  6. package/dist/components/card/style2.css +1 -1
  7. package/dist/components/cascade/cascade.vue.d.ts +4 -4
  8. package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
  9. package/dist/components/code-editor/lang-loaders.js +1 -0
  10. package/dist/components/code-editor/lang-loaders.js.map +1 -1
  11. package/dist/components/condition-editor/style2.css +2 -4
  12. package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
  13. package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
  14. package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
  15. package/dist/components/input/input.vue.d.ts +3 -3
  16. package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
  17. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +4 -4
  18. package/dist/components/number-input/number-input.vue.d.ts +3 -3
  19. package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
  20. package/dist/components/rich-text-editor/style2.css +1 -1
  21. package/dist/components/select/select.vue.d.ts +1 -1
  22. package/dist/components/textarea/textarea.vue.d.ts +3 -3
  23. package/dist/components/tree-select/tree-select.vue.d.ts +3 -3
  24. package/dist/node_modules/.bun/@codemirror_autocomplete@6.20.3/node_modules/@codemirror/autocomplete/dist/index.js +1 -1
  25. package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js +914 -0
  26. package/dist/node_modules/.bun/@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js.map +1 -0
  27. package/dist/node_modules/.bun/@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js +994 -0
  28. package/dist/node_modules/.bun/@codemirror_lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js.map +1 -0
  29. package/dist/node_modules/.bun/@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js +1 -1
  30. package/dist/node_modules/.bun/@codemirror_lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js +471 -0
  31. package/dist/node_modules/.bun/@codemirror_lang-markdown@6.5.1/node_modules/@codemirror/lang-markdown/dist/index.js.map +1 -0
  32. package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js +71 -1
  33. package/dist/node_modules/.bun/@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js.map +1 -1
  34. package/dist/node_modules/.bun/@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js +326 -2
  35. package/dist/node_modules/.bun/@lezer_common@1.5.2/node_modules/@lezer/common/dist/index.js.map +1 -1
  36. package/dist/node_modules/.bun/@lezer_css@1.3.4/node_modules/@lezer/css/dist/index.js +250 -0
  37. package/dist/node_modules/.bun/@lezer_css@1.3.4/node_modules/@lezer/css/dist/index.js.map +1 -0
  38. package/dist/node_modules/.bun/@lezer_highlight@1.2.3/node_modules/@lezer/highlight/dist/index.js +1 -1
  39. package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js +438 -0
  40. package/dist/node_modules/.bun/@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js.map +1 -0
  41. package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js +1952 -0
  42. package/dist/node_modules/.bun/@lezer_markdown@1.7.2/node_modules/@lezer/markdown/dist/index.js.map +1 -0
  43. package/dist/types/code-editor.d.ts +1 -1
  44. package/package.json +7 -6
  45. package/src/components/breadcrumb/style.scss +1 -2
  46. package/src/components/button/style.scss +6 -4
  47. package/src/components/card/style.scss +1 -1
  48. package/src/components/code-editor/lang-loaders.ts +1 -0
  49. package/src/components/condition-editor/style.scss +2 -4
  50. package/src/components/rich-text-editor/style.scss +1 -1
  51. package/src/types/code-editor.ts +9 -1
@@ -0,0 +1,994 @@
1
+ import { EditorSelection } from "../../../../../@codemirror_state@6.7.0/node_modules/@codemirror/state/dist/index.js";
2
+ import { EditorView } from "../../../../../@codemirror_view@6.43.4/node_modules/@codemirror/view/dist/index.js";
3
+ import { LRLanguage, LanguageSupport, bracketMatchingHandle, foldNodeProp, indentNodeProp, syntaxTree } from "../../../../../@codemirror_language@6.12.4/node_modules/@codemirror/language/dist/index.js";
4
+ import { javascript, javascriptLanguage, jsxLanguage, tsxLanguage, typescriptLanguage } from "../../../../../@codemirror_lang-javascript@6.2.5/node_modules/@codemirror/lang-javascript/dist/index.js";
5
+ import { configureNesting, parser } from "../../../../../@lezer_html@1.3.13/node_modules/@lezer/html/dist/index.js";
6
+ import { css, cssLanguage } from "../../../../../@codemirror_lang-css@6.3.1/node_modules/@codemirror/lang-css/dist/index.js";
7
+ //#region ../../node_modules/.bun/@codemirror+lang-html@6.4.11/node_modules/@codemirror/lang-html/dist/index.js
8
+ const Targets = [
9
+ "_blank",
10
+ "_self",
11
+ "_top",
12
+ "_parent"
13
+ ];
14
+ const Charsets = [
15
+ "ascii",
16
+ "utf-8",
17
+ "utf-16",
18
+ "latin1",
19
+ "latin1"
20
+ ];
21
+ const Methods = [
22
+ "get",
23
+ "post",
24
+ "put",
25
+ "delete"
26
+ ];
27
+ const Encs = [
28
+ "application/x-www-form-urlencoded",
29
+ "multipart/form-data",
30
+ "text/plain"
31
+ ];
32
+ const Bool = ["true", "false"];
33
+ const S = {};
34
+ const Tags = {
35
+ a: { attrs: {
36
+ href: null,
37
+ ping: null,
38
+ type: null,
39
+ media: null,
40
+ target: Targets,
41
+ hreflang: null
42
+ } },
43
+ abbr: S,
44
+ address: S,
45
+ area: { attrs: {
46
+ alt: null,
47
+ coords: null,
48
+ href: null,
49
+ target: null,
50
+ ping: null,
51
+ media: null,
52
+ hreflang: null,
53
+ type: null,
54
+ shape: [
55
+ "default",
56
+ "rect",
57
+ "circle",
58
+ "poly"
59
+ ]
60
+ } },
61
+ article: S,
62
+ aside: S,
63
+ audio: { attrs: {
64
+ src: null,
65
+ mediagroup: null,
66
+ crossorigin: ["anonymous", "use-credentials"],
67
+ preload: [
68
+ "none",
69
+ "metadata",
70
+ "auto"
71
+ ],
72
+ autoplay: ["autoplay"],
73
+ loop: ["loop"],
74
+ controls: ["controls"]
75
+ } },
76
+ b: S,
77
+ base: { attrs: {
78
+ href: null,
79
+ target: Targets
80
+ } },
81
+ bdi: S,
82
+ bdo: S,
83
+ blockquote: { attrs: { cite: null } },
84
+ body: S,
85
+ br: S,
86
+ button: { attrs: {
87
+ form: null,
88
+ formaction: null,
89
+ name: null,
90
+ value: null,
91
+ autofocus: ["autofocus"],
92
+ disabled: ["autofocus"],
93
+ formenctype: Encs,
94
+ formmethod: Methods,
95
+ formnovalidate: ["novalidate"],
96
+ formtarget: Targets,
97
+ type: [
98
+ "submit",
99
+ "reset",
100
+ "button"
101
+ ]
102
+ } },
103
+ canvas: { attrs: {
104
+ width: null,
105
+ height: null
106
+ } },
107
+ caption: S,
108
+ center: S,
109
+ cite: S,
110
+ code: S,
111
+ col: { attrs: { span: null } },
112
+ colgroup: { attrs: { span: null } },
113
+ command: { attrs: {
114
+ type: [
115
+ "command",
116
+ "checkbox",
117
+ "radio"
118
+ ],
119
+ label: null,
120
+ icon: null,
121
+ radiogroup: null,
122
+ command: null,
123
+ title: null,
124
+ disabled: ["disabled"],
125
+ checked: ["checked"]
126
+ } },
127
+ data: { attrs: { value: null } },
128
+ datagrid: { attrs: {
129
+ disabled: ["disabled"],
130
+ multiple: ["multiple"]
131
+ } },
132
+ datalist: { attrs: { data: null } },
133
+ dd: S,
134
+ del: { attrs: {
135
+ cite: null,
136
+ datetime: null
137
+ } },
138
+ details: { attrs: { open: ["open"] } },
139
+ dfn: S,
140
+ div: S,
141
+ dl: S,
142
+ dt: S,
143
+ em: S,
144
+ embed: { attrs: {
145
+ src: null,
146
+ type: null,
147
+ width: null,
148
+ height: null
149
+ } },
150
+ eventsource: { attrs: { src: null } },
151
+ fieldset: { attrs: {
152
+ disabled: ["disabled"],
153
+ form: null,
154
+ name: null
155
+ } },
156
+ figcaption: S,
157
+ figure: S,
158
+ footer: S,
159
+ form: { attrs: {
160
+ action: null,
161
+ name: null,
162
+ "accept-charset": Charsets,
163
+ autocomplete: ["on", "off"],
164
+ enctype: Encs,
165
+ method: Methods,
166
+ novalidate: ["novalidate"],
167
+ target: Targets
168
+ } },
169
+ h1: S,
170
+ h2: S,
171
+ h3: S,
172
+ h4: S,
173
+ h5: S,
174
+ h6: S,
175
+ head: { children: [
176
+ "title",
177
+ "base",
178
+ "link",
179
+ "style",
180
+ "meta",
181
+ "script",
182
+ "noscript",
183
+ "command"
184
+ ] },
185
+ header: S,
186
+ hgroup: S,
187
+ hr: S,
188
+ html: { attrs: { manifest: null } },
189
+ i: S,
190
+ iframe: { attrs: {
191
+ src: null,
192
+ srcdoc: null,
193
+ name: null,
194
+ width: null,
195
+ height: null,
196
+ sandbox: [
197
+ "allow-top-navigation",
198
+ "allow-same-origin",
199
+ "allow-forms",
200
+ "allow-scripts"
201
+ ],
202
+ seamless: ["seamless"]
203
+ } },
204
+ img: { attrs: {
205
+ alt: null,
206
+ src: null,
207
+ ismap: null,
208
+ usemap: null,
209
+ width: null,
210
+ height: null,
211
+ crossorigin: ["anonymous", "use-credentials"]
212
+ } },
213
+ input: { attrs: {
214
+ alt: null,
215
+ dirname: null,
216
+ form: null,
217
+ formaction: null,
218
+ height: null,
219
+ list: null,
220
+ max: null,
221
+ maxlength: null,
222
+ min: null,
223
+ name: null,
224
+ pattern: null,
225
+ placeholder: null,
226
+ size: null,
227
+ src: null,
228
+ step: null,
229
+ value: null,
230
+ width: null,
231
+ accept: [
232
+ "audio/*",
233
+ "video/*",
234
+ "image/*"
235
+ ],
236
+ autocomplete: ["on", "off"],
237
+ autofocus: ["autofocus"],
238
+ checked: ["checked"],
239
+ disabled: ["disabled"],
240
+ formenctype: Encs,
241
+ formmethod: Methods,
242
+ formnovalidate: ["novalidate"],
243
+ formtarget: Targets,
244
+ multiple: ["multiple"],
245
+ readonly: ["readonly"],
246
+ required: ["required"],
247
+ type: [
248
+ "hidden",
249
+ "text",
250
+ "search",
251
+ "tel",
252
+ "url",
253
+ "email",
254
+ "password",
255
+ "datetime",
256
+ "date",
257
+ "month",
258
+ "week",
259
+ "time",
260
+ "datetime-local",
261
+ "number",
262
+ "range",
263
+ "color",
264
+ "checkbox",
265
+ "radio",
266
+ "file",
267
+ "submit",
268
+ "image",
269
+ "reset",
270
+ "button"
271
+ ]
272
+ } },
273
+ ins: { attrs: {
274
+ cite: null,
275
+ datetime: null
276
+ } },
277
+ kbd: S,
278
+ keygen: { attrs: {
279
+ challenge: null,
280
+ form: null,
281
+ name: null,
282
+ autofocus: ["autofocus"],
283
+ disabled: ["disabled"],
284
+ keytype: ["RSA"]
285
+ } },
286
+ label: { attrs: {
287
+ for: null,
288
+ form: null
289
+ } },
290
+ legend: S,
291
+ li: { attrs: { value: null } },
292
+ link: { attrs: {
293
+ href: null,
294
+ type: null,
295
+ hreflang: null,
296
+ media: null,
297
+ sizes: [
298
+ "all",
299
+ "16x16",
300
+ "16x16 32x32",
301
+ "16x16 32x32 64x64"
302
+ ]
303
+ } },
304
+ map: { attrs: { name: null } },
305
+ mark: S,
306
+ menu: { attrs: {
307
+ label: null,
308
+ type: [
309
+ "list",
310
+ "context",
311
+ "toolbar"
312
+ ]
313
+ } },
314
+ meta: { attrs: {
315
+ content: null,
316
+ charset: Charsets,
317
+ name: [
318
+ "viewport",
319
+ "application-name",
320
+ "author",
321
+ "description",
322
+ "generator",
323
+ "keywords"
324
+ ],
325
+ "http-equiv": [
326
+ "content-language",
327
+ "content-type",
328
+ "default-style",
329
+ "refresh"
330
+ ]
331
+ } },
332
+ meter: { attrs: {
333
+ value: null,
334
+ min: null,
335
+ low: null,
336
+ high: null,
337
+ max: null,
338
+ optimum: null
339
+ } },
340
+ nav: S,
341
+ noscript: S,
342
+ object: { attrs: {
343
+ data: null,
344
+ type: null,
345
+ name: null,
346
+ usemap: null,
347
+ form: null,
348
+ width: null,
349
+ height: null,
350
+ typemustmatch: ["typemustmatch"]
351
+ } },
352
+ ol: {
353
+ attrs: {
354
+ reversed: ["reversed"],
355
+ start: null,
356
+ type: [
357
+ "1",
358
+ "a",
359
+ "A",
360
+ "i",
361
+ "I"
362
+ ]
363
+ },
364
+ children: [
365
+ "li",
366
+ "script",
367
+ "template",
368
+ "ul",
369
+ "ol"
370
+ ]
371
+ },
372
+ optgroup: { attrs: {
373
+ disabled: ["disabled"],
374
+ label: null
375
+ } },
376
+ option: { attrs: {
377
+ disabled: ["disabled"],
378
+ label: null,
379
+ selected: ["selected"],
380
+ value: null
381
+ } },
382
+ output: { attrs: {
383
+ for: null,
384
+ form: null,
385
+ name: null
386
+ } },
387
+ p: S,
388
+ param: { attrs: {
389
+ name: null,
390
+ value: null
391
+ } },
392
+ pre: S,
393
+ progress: { attrs: {
394
+ value: null,
395
+ max: null
396
+ } },
397
+ q: { attrs: { cite: null } },
398
+ rp: S,
399
+ rt: S,
400
+ ruby: S,
401
+ samp: S,
402
+ script: { attrs: {
403
+ type: ["text/javascript"],
404
+ src: null,
405
+ async: ["async"],
406
+ defer: ["defer"],
407
+ charset: Charsets
408
+ } },
409
+ section: S,
410
+ select: { attrs: {
411
+ form: null,
412
+ name: null,
413
+ size: null,
414
+ autofocus: ["autofocus"],
415
+ disabled: ["disabled"],
416
+ multiple: ["multiple"]
417
+ } },
418
+ slot: { attrs: { name: null } },
419
+ small: S,
420
+ source: { attrs: {
421
+ src: null,
422
+ type: null,
423
+ media: null
424
+ } },
425
+ span: S,
426
+ strong: S,
427
+ style: { attrs: {
428
+ type: ["text/css"],
429
+ media: null,
430
+ scoped: null
431
+ } },
432
+ sub: S,
433
+ summary: S,
434
+ sup: S,
435
+ table: S,
436
+ tbody: S,
437
+ td: { attrs: {
438
+ colspan: null,
439
+ rowspan: null,
440
+ headers: null
441
+ } },
442
+ template: S,
443
+ textarea: { attrs: {
444
+ dirname: null,
445
+ form: null,
446
+ maxlength: null,
447
+ name: null,
448
+ placeholder: null,
449
+ rows: null,
450
+ cols: null,
451
+ autofocus: ["autofocus"],
452
+ disabled: ["disabled"],
453
+ readonly: ["readonly"],
454
+ required: ["required"],
455
+ wrap: ["soft", "hard"]
456
+ } },
457
+ tfoot: S,
458
+ th: { attrs: {
459
+ colspan: null,
460
+ rowspan: null,
461
+ headers: null,
462
+ scope: [
463
+ "row",
464
+ "col",
465
+ "rowgroup",
466
+ "colgroup"
467
+ ]
468
+ } },
469
+ thead: S,
470
+ time: { attrs: { datetime: null } },
471
+ title: S,
472
+ tr: S,
473
+ track: { attrs: {
474
+ src: null,
475
+ label: null,
476
+ default: null,
477
+ kind: [
478
+ "subtitles",
479
+ "captions",
480
+ "descriptions",
481
+ "chapters",
482
+ "metadata"
483
+ ],
484
+ srclang: null
485
+ } },
486
+ ul: { children: [
487
+ "li",
488
+ "script",
489
+ "template",
490
+ "ul",
491
+ "ol"
492
+ ] },
493
+ var: S,
494
+ video: { attrs: {
495
+ src: null,
496
+ poster: null,
497
+ width: null,
498
+ height: null,
499
+ crossorigin: ["anonymous", "use-credentials"],
500
+ preload: [
501
+ "auto",
502
+ "metadata",
503
+ "none"
504
+ ],
505
+ autoplay: ["autoplay"],
506
+ mediagroup: ["movie"],
507
+ muted: ["muted"],
508
+ controls: ["controls"]
509
+ } },
510
+ wbr: S
511
+ };
512
+ const GlobalAttrs = {
513
+ accesskey: null,
514
+ class: null,
515
+ contenteditable: Bool,
516
+ contextmenu: null,
517
+ dir: [
518
+ "ltr",
519
+ "rtl",
520
+ "auto"
521
+ ],
522
+ draggable: [
523
+ "true",
524
+ "false",
525
+ "auto"
526
+ ],
527
+ dropzone: [
528
+ "copy",
529
+ "move",
530
+ "link",
531
+ "string:",
532
+ "file:"
533
+ ],
534
+ hidden: ["hidden"],
535
+ id: null,
536
+ inert: ["inert"],
537
+ itemid: null,
538
+ itemprop: null,
539
+ itemref: null,
540
+ itemscope: ["itemscope"],
541
+ itemtype: null,
542
+ lang: [
543
+ "ar",
544
+ "bn",
545
+ "de",
546
+ "en-GB",
547
+ "en-US",
548
+ "es",
549
+ "fr",
550
+ "hi",
551
+ "id",
552
+ "ja",
553
+ "pa",
554
+ "pt",
555
+ "ru",
556
+ "tr",
557
+ "zh"
558
+ ],
559
+ spellcheck: Bool,
560
+ autocorrect: Bool,
561
+ autocapitalize: Bool,
562
+ style: null,
563
+ tabindex: null,
564
+ title: null,
565
+ translate: ["yes", "no"],
566
+ rel: [
567
+ "stylesheet",
568
+ "alternate",
569
+ "author",
570
+ "bookmark",
571
+ "help",
572
+ "license",
573
+ "next",
574
+ "nofollow",
575
+ "noreferrer",
576
+ "prefetch",
577
+ "prev",
578
+ "search",
579
+ "tag"
580
+ ],
581
+ role: /*@__PURE__*/ "alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),
582
+ "aria-activedescendant": null,
583
+ "aria-atomic": Bool,
584
+ "aria-autocomplete": [
585
+ "inline",
586
+ "list",
587
+ "both",
588
+ "none"
589
+ ],
590
+ "aria-busy": Bool,
591
+ "aria-checked": [
592
+ "true",
593
+ "false",
594
+ "mixed",
595
+ "undefined"
596
+ ],
597
+ "aria-controls": null,
598
+ "aria-describedby": null,
599
+ "aria-disabled": Bool,
600
+ "aria-dropeffect": null,
601
+ "aria-expanded": [
602
+ "true",
603
+ "false",
604
+ "undefined"
605
+ ],
606
+ "aria-flowto": null,
607
+ "aria-grabbed": [
608
+ "true",
609
+ "false",
610
+ "undefined"
611
+ ],
612
+ "aria-haspopup": Bool,
613
+ "aria-hidden": Bool,
614
+ "aria-invalid": [
615
+ "true",
616
+ "false",
617
+ "grammar",
618
+ "spelling"
619
+ ],
620
+ "aria-label": null,
621
+ "aria-labelledby": null,
622
+ "aria-level": null,
623
+ "aria-live": [
624
+ "off",
625
+ "polite",
626
+ "assertive"
627
+ ],
628
+ "aria-multiline": Bool,
629
+ "aria-multiselectable": Bool,
630
+ "aria-owns": null,
631
+ "aria-posinset": null,
632
+ "aria-pressed": [
633
+ "true",
634
+ "false",
635
+ "mixed",
636
+ "undefined"
637
+ ],
638
+ "aria-readonly": Bool,
639
+ "aria-relevant": null,
640
+ "aria-required": Bool,
641
+ "aria-selected": [
642
+ "true",
643
+ "false",
644
+ "undefined"
645
+ ],
646
+ "aria-setsize": null,
647
+ "aria-sort": [
648
+ "ascending",
649
+ "descending",
650
+ "none",
651
+ "other"
652
+ ],
653
+ "aria-valuemax": null,
654
+ "aria-valuemin": null,
655
+ "aria-valuenow": null,
656
+ "aria-valuetext": null
657
+ };
658
+ const eventAttributes = /*@__PURE__*/ "beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((n) => "on" + n);
659
+ for (let a of eventAttributes) GlobalAttrs[a] = null;
660
+ var Schema = class {
661
+ constructor(extraTags, extraAttrs) {
662
+ this.tags = {
663
+ ...Tags,
664
+ ...extraTags
665
+ };
666
+ this.globalAttrs = {
667
+ ...GlobalAttrs,
668
+ ...extraAttrs
669
+ };
670
+ this.allTags = Object.keys(this.tags);
671
+ this.globalAttrNames = Object.keys(this.globalAttrs);
672
+ }
673
+ };
674
+ Schema.default = /*@__PURE__*/ new Schema();
675
+ function elementName(doc, tree, max = doc.length) {
676
+ if (!tree) return "";
677
+ let tag = tree.firstChild;
678
+ let name = tag && tag.getChild("TagName");
679
+ return name ? doc.sliceString(name.from, Math.min(name.to, max)) : "";
680
+ }
681
+ function findParentElement(tree, skip = false) {
682
+ for (; tree; tree = tree.parent) if (tree.name == "Element") if (skip) skip = false;
683
+ else return tree;
684
+ return null;
685
+ }
686
+ function allowedChildren(doc, tree, schema) {
687
+ let parentInfo = schema.tags[elementName(doc, findParentElement(tree))];
688
+ return (parentInfo === null || parentInfo === void 0 ? void 0 : parentInfo.children) || schema.allTags;
689
+ }
690
+ function openTags(doc, tree) {
691
+ let open = [];
692
+ for (let parent = findParentElement(tree); parent && !parent.type.isTop; parent = findParentElement(parent.parent)) {
693
+ let tagName = elementName(doc, parent);
694
+ if (tagName && parent.lastChild.name == "CloseTag") break;
695
+ if (tagName && open.indexOf(tagName) < 0 && (tree.name == "EndTag" || tree.from >= parent.firstChild.to)) open.push(tagName);
696
+ }
697
+ return open;
698
+ }
699
+ const identifier = /^[:\-\.\w\u00b7-\uffff]*$/;
700
+ function completeTag(state, schema, tree, from, to) {
701
+ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
702
+ let parent = findParentElement(tree, tree.name == "StartTag" || tree.name == "TagName");
703
+ return {
704
+ from,
705
+ to,
706
+ options: allowedChildren(state.doc, parent, schema).map((tagName) => ({
707
+ label: tagName,
708
+ type: "type"
709
+ })).concat(openTags(state.doc, tree).map((tag, i) => ({
710
+ label: "/" + tag,
711
+ apply: "/" + tag + end,
712
+ type: "type",
713
+ boost: 99 - i
714
+ }))),
715
+ validFor: /^\/?[:\-\.\w\u00b7-\uffff]*$/
716
+ };
717
+ }
718
+ function completeCloseTag(state, tree, from, to) {
719
+ let end = /\s*>/.test(state.sliceDoc(to, to + 5)) ? "" : ">";
720
+ return {
721
+ from,
722
+ to,
723
+ options: openTags(state.doc, tree).map((tag, i) => ({
724
+ label: tag,
725
+ apply: tag + end,
726
+ type: "type",
727
+ boost: 99 - i
728
+ })),
729
+ validFor: identifier
730
+ };
731
+ }
732
+ function completeStartTag(state, schema, tree, pos) {
733
+ let options = [], level = 0;
734
+ for (let tagName of allowedChildren(state.doc, tree, schema)) options.push({
735
+ label: "<" + tagName,
736
+ type: "type"
737
+ });
738
+ for (let open of openTags(state.doc, tree)) options.push({
739
+ label: "</" + open + ">",
740
+ type: "type",
741
+ boost: 99 - level++
742
+ });
743
+ return {
744
+ from: pos,
745
+ to: pos,
746
+ options,
747
+ validFor: /^<\/?[:\-\.\w\u00b7-\uffff]*$/
748
+ };
749
+ }
750
+ function completeAttrName(state, schema, tree, from, to) {
751
+ let elt = findParentElement(tree), info = elt ? schema.tags[elementName(state.doc, elt)] : null;
752
+ let localAttrs = info && info.attrs ? Object.keys(info.attrs) : [];
753
+ return {
754
+ from,
755
+ to,
756
+ options: (info && info.globalAttrs === false ? localAttrs : localAttrs.length ? localAttrs.concat(schema.globalAttrNames) : schema.globalAttrNames).map((attrName) => ({
757
+ label: attrName,
758
+ type: "property"
759
+ })),
760
+ validFor: identifier
761
+ };
762
+ }
763
+ function completeAttrValue(state, schema, tree, from, to) {
764
+ var _a;
765
+ let nameNode = (_a = tree.parent) === null || _a === void 0 ? void 0 : _a.getChild("AttributeName");
766
+ let options = [], token = void 0;
767
+ if (nameNode) {
768
+ let attrName = state.sliceDoc(nameNode.from, nameNode.to);
769
+ let attrs = schema.globalAttrs[attrName];
770
+ if (!attrs) {
771
+ let elt = findParentElement(tree), info = elt ? schema.tags[elementName(state.doc, elt)] : null;
772
+ attrs = (info === null || info === void 0 ? void 0 : info.attrs) && info.attrs[attrName];
773
+ }
774
+ if (attrs) {
775
+ let base = state.sliceDoc(from, to).toLowerCase(), quoteStart = "\"", quoteEnd = "\"";
776
+ if (/^['"]/.test(base)) {
777
+ token = base[0] == "\"" ? /^[^"]*$/ : /^[^']*$/;
778
+ quoteStart = "";
779
+ quoteEnd = state.sliceDoc(to, to + 1) == base[0] ? "" : base[0];
780
+ base = base.slice(1);
781
+ from++;
782
+ } else token = /^[^\s<>='"]*$/;
783
+ for (let value of attrs) options.push({
784
+ label: value,
785
+ apply: quoteStart + value + quoteEnd,
786
+ type: "constant"
787
+ });
788
+ }
789
+ }
790
+ return {
791
+ from,
792
+ to,
793
+ options,
794
+ validFor: token
795
+ };
796
+ }
797
+ function htmlCompletionFor(schema, context) {
798
+ let { state, pos } = context, tree = syntaxTree(state).resolveInner(pos, -1), around = tree.resolve(pos);
799
+ for (let scan = pos, before; around == tree && (before = tree.childBefore(scan));) {
800
+ let last = before.lastChild;
801
+ if (!last || !last.type.isError || last.from < last.to) break;
802
+ around = tree = before;
803
+ scan = last.from;
804
+ }
805
+ if (tree.name == "TagName") return tree.parent && /CloseTag$/.test(tree.parent.name) ? completeCloseTag(state, tree, tree.from, pos) : completeTag(state, schema, tree, tree.from, pos);
806
+ else if (tree.name == "StartTag" || tree.name == "IncompleteTag") return completeTag(state, schema, tree, pos, pos);
807
+ else if (tree.name == "StartCloseTag" || tree.name == "IncompleteCloseTag") return completeCloseTag(state, tree, pos, pos);
808
+ else if (tree.name == "OpenTag" || tree.name == "SelfClosingTag" || tree.name == "AttributeName") return completeAttrName(state, schema, tree, tree.name == "AttributeName" ? tree.from : pos, pos);
809
+ else if (tree.name == "Is" || tree.name == "AttributeValue" || tree.name == "UnquotedAttributeValue") return completeAttrValue(state, schema, tree, tree.name == "Is" ? pos : tree.from, pos);
810
+ else if (context.explicit && (around.name == "Element" || around.name == "Text" || around.name == "Document")) return completeStartTag(state, schema, tree, pos);
811
+ else return null;
812
+ }
813
+ /**
814
+ HTML tag completion. Opens and closes tags and attributes in a
815
+ context-aware way.
816
+ */
817
+ function htmlCompletionSource(context) {
818
+ return htmlCompletionFor(Schema.default, context);
819
+ }
820
+ /**
821
+ Create a completion source for HTML extended with additional tags
822
+ or attributes.
823
+ */
824
+ function htmlCompletionSourceWith(config) {
825
+ let { extraTags, extraGlobalAttributes: extraAttrs } = config;
826
+ let schema = extraAttrs || extraTags ? new Schema(extraTags, extraAttrs) : Schema.default;
827
+ return (context) => htmlCompletionFor(schema, context);
828
+ }
829
+ const jsonParser = /*@__PURE__*/ javascriptLanguage.parser.configure({ top: "SingleExpression" });
830
+ const defaultNesting = [
831
+ {
832
+ tag: "script",
833
+ attrs: (attrs) => attrs.type == "text/typescript" || attrs.lang == "ts",
834
+ parser: typescriptLanguage.parser
835
+ },
836
+ {
837
+ tag: "script",
838
+ attrs: (attrs) => attrs.type == "text/babel" || attrs.type == "text/jsx",
839
+ parser: jsxLanguage.parser
840
+ },
841
+ {
842
+ tag: "script",
843
+ attrs: (attrs) => attrs.type == "text/typescript-jsx",
844
+ parser: tsxLanguage.parser
845
+ },
846
+ {
847
+ tag: "script",
848
+ attrs(attrs) {
849
+ return /^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(attrs.type);
850
+ },
851
+ parser: jsonParser
852
+ },
853
+ {
854
+ tag: "script",
855
+ attrs(attrs) {
856
+ return !attrs.type || /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(attrs.type);
857
+ },
858
+ parser: javascriptLanguage.parser
859
+ },
860
+ {
861
+ tag: "style",
862
+ attrs(attrs) {
863
+ return (!attrs.lang || attrs.lang == "css") && (!attrs.type || /^(text\/)?(x-)?(stylesheet|css)$/i.test(attrs.type));
864
+ },
865
+ parser: cssLanguage.parser
866
+ }
867
+ ];
868
+ const defaultAttrs = /*@__PURE__*/ [{
869
+ name: "style",
870
+ parser: /*@__PURE__*/ cssLanguage.parser.configure({ top: "Styles" })
871
+ }].concat(/*@__PURE__*/ eventAttributes.map((name) => ({
872
+ name,
873
+ parser: javascriptLanguage.parser
874
+ })));
875
+ const htmlPlain = /*@__PURE__*/ LRLanguage.define({
876
+ name: "html",
877
+ parser: /*@__PURE__*/ parser.configure({ props: [
878
+ /*@__PURE__*/ indentNodeProp.add({
879
+ Element(context) {
880
+ let after = /^(\s*)(<\/)?/.exec(context.textAfter);
881
+ if (context.node.to <= context.pos + after[0].length) return context.continue();
882
+ return context.lineIndent(context.node.from) + (after[2] ? 0 : context.unit);
883
+ },
884
+ "OpenTag CloseTag SelfClosingTag"(context) {
885
+ return context.column(context.node.from) + context.unit;
886
+ },
887
+ Document(context) {
888
+ if (context.pos + /\s*/.exec(context.textAfter)[0].length < context.node.to) return context.continue();
889
+ let endElt = null, close;
890
+ for (let cur = context.node;;) {
891
+ let last = cur.lastChild;
892
+ if (!last || last.name != "Element" || last.to != cur.to) break;
893
+ endElt = cur = last;
894
+ }
895
+ if (endElt && !((close = endElt.lastChild) && (close.name == "CloseTag" || close.name == "SelfClosingTag"))) return context.lineIndent(endElt.from) + context.unit;
896
+ return null;
897
+ }
898
+ }),
899
+ /*@__PURE__*/ foldNodeProp.add({ Element(node) {
900
+ let first = node.firstChild, last = node.lastChild;
901
+ if (!first || first.name != "OpenTag") return null;
902
+ return {
903
+ from: first.to,
904
+ to: last.name == "CloseTag" ? last.from : node.to
905
+ };
906
+ } }),
907
+ /*@__PURE__*/ bracketMatchingHandle.add({ "OpenTag CloseTag": (node) => node.getChild("TagName") })
908
+ ] }),
909
+ languageData: {
910
+ commentTokens: { block: {
911
+ open: "<!--",
912
+ close: "-->"
913
+ } },
914
+ indentOnInput: /^\s*<\/\w+\W$/,
915
+ wordChars: "-_"
916
+ }
917
+ });
918
+ /**
919
+ A language provider based on the [Lezer HTML
920
+ parser](https://github.com/lezer-parser/html), extended with the
921
+ JavaScript and CSS parsers to parse the content of `<script>` and
922
+ `<style>` tags.
923
+ */
924
+ const htmlLanguage = /*@__PURE__*/ htmlPlain.configure({ wrap: /*@__PURE__*/ configureNesting(defaultNesting, defaultAttrs) });
925
+ /**
926
+ Language support for HTML, including
927
+ [`htmlCompletion`](https://codemirror.net/6/docs/ref/#lang-html.htmlCompletion) and JavaScript and
928
+ CSS support extensions.
929
+ */
930
+ function html(config = {}) {
931
+ let dialect = "", wrap;
932
+ if (config.matchClosingTags === false) dialect = "noMatch";
933
+ if (config.selfClosingTags === true) dialect = (dialect ? dialect + " " : "") + "selfClosing";
934
+ if (config.nestedLanguages && config.nestedLanguages.length || config.nestedAttributes && config.nestedAttributes.length) wrap = configureNesting((config.nestedLanguages || []).concat(defaultNesting), (config.nestedAttributes || []).concat(defaultAttrs));
935
+ return new LanguageSupport(wrap ? htmlPlain.configure({
936
+ wrap,
937
+ dialect
938
+ }) : dialect ? htmlLanguage.configure({ dialect }) : htmlLanguage, [
939
+ htmlLanguage.data.of({ autocomplete: htmlCompletionSourceWith(config) }),
940
+ config.autoCloseTags !== false ? autoCloseTags : [],
941
+ javascript().support,
942
+ css().support
943
+ ]);
944
+ }
945
+ const selfClosers = /*@__PURE__*/ new Set(/*@__PURE__*/ "area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));
946
+ /**
947
+ Extension that will automatically insert close tags when a `>` or
948
+ `/` is typed.
949
+ */
950
+ const autoCloseTags = /*@__PURE__*/ EditorView.inputHandler.of((view, from, to, text, insertTransaction) => {
951
+ if (view.composing || view.state.readOnly || from != to || text != ">" && text != "/" || !htmlLanguage.isActiveAt(view.state, from, -1)) return false;
952
+ let base = insertTransaction(), { state } = base;
953
+ let closeTags = state.changeByRange((range) => {
954
+ var _a, _b, _c;
955
+ let didType = state.doc.sliceString(range.from - 1, range.to) == text;
956
+ let { head } = range, after = syntaxTree(state).resolveInner(head, -1), name;
957
+ if (didType && text == ">" && after.name == "EndTag") {
958
+ let tag = after.parent;
959
+ if (((_b = (_a = tag.parent) === null || _a === void 0 ? void 0 : _a.lastChild) === null || _b === void 0 ? void 0 : _b.name) != "CloseTag" && (name = elementName(state.doc, tag.parent, head)) && !selfClosers.has(name)) return {
960
+ range,
961
+ changes: {
962
+ from: head,
963
+ to: head + (state.doc.sliceString(head, head + 1) === ">" ? 1 : 0),
964
+ insert: `</${name}>`
965
+ }
966
+ };
967
+ } else if (didType && text == "/" && after.name == "IncompleteCloseTag") {
968
+ let tag = after.parent;
969
+ if (after.from == head - 2 && ((_c = tag.lastChild) === null || _c === void 0 ? void 0 : _c.name) != "CloseTag" && (name = elementName(state.doc, tag, head)) && !selfClosers.has(name)) {
970
+ let to = head + (state.doc.sliceString(head, head + 1) === ">" ? 1 : 0);
971
+ let insert = `${name}>`;
972
+ return {
973
+ range: EditorSelection.cursor(head + insert.length, -1),
974
+ changes: {
975
+ from: head,
976
+ to,
977
+ insert
978
+ }
979
+ };
980
+ }
981
+ }
982
+ return { range };
983
+ });
984
+ if (closeTags.changes.empty) return false;
985
+ view.dispatch([base, state.update(closeTags, {
986
+ userEvent: "input.complete",
987
+ scrollIntoView: true
988
+ })]);
989
+ return true;
990
+ });
991
+ //#endregion
992
+ export { html, htmlCompletionSource };
993
+
994
+ //# sourceMappingURL=index.js.map