@apipass/design-system 3.3.0 → 4.0.0

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 (59) hide show
  1. package/dist/lib/embedded-styles.js +1 -1
  2. package/dist/lib/json-viewer.index.cjs +2 -0
  3. package/dist/lib/json-viewer.index.cjs.map +1 -0
  4. package/dist/lib/json-viewer.index.js +5 -0
  5. package/dist/lib/json-viewer.index.js.map +1 -0
  6. package/dist/lib/lib.index.cjs +1 -1
  7. package/dist/lib/lib.index.js +742 -744
  8. package/dist/lib/lib.index.js.map +1 -1
  9. package/dist/lib/style.css +1 -1
  10. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs +1 -1
  11. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs.map +1 -1
  12. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js +8 -8
  13. package/dist/types/json-viewer.index.d.ts +1 -0
  14. package/dist/types/ui/primitives/index.d.ts +0 -1
  15. package/package.json +34 -7
  16. package/dist/lib/vendor/@codemirror/lang-json/dist/index.cjs +0 -2
  17. package/dist/lib/vendor/@codemirror/lang-json/dist/index.cjs.map +0 -1
  18. package/dist/lib/vendor/@codemirror/lang-json/dist/index.js +0 -28
  19. package/dist/lib/vendor/@codemirror/lang-json/dist/index.js.map +0 -1
  20. package/dist/lib/vendor/@codemirror/language/dist/index.cjs +0 -2
  21. package/dist/lib/vendor/@codemirror/language/dist/index.cjs.map +0 -1
  22. package/dist/lib/vendor/@codemirror/language/dist/index.js +0 -791
  23. package/dist/lib/vendor/@codemirror/language/dist/index.js.map +0 -1
  24. package/dist/lib/vendor/@codemirror/state/dist/index.cjs +0 -6
  25. package/dist/lib/vendor/@codemirror/state/dist/index.cjs.map +0 -1
  26. package/dist/lib/vendor/@codemirror/state/dist/index.js +0 -2633
  27. package/dist/lib/vendor/@codemirror/state/dist/index.js.map +0 -1
  28. package/dist/lib/vendor/@codemirror/view/dist/index.cjs +0 -5
  29. package/dist/lib/vendor/@codemirror/view/dist/index.cjs.map +0 -1
  30. package/dist/lib/vendor/@codemirror/view/dist/index.js +0 -6068
  31. package/dist/lib/vendor/@codemirror/view/dist/index.js.map +0 -1
  32. package/dist/lib/vendor/@lezer/common/dist/index.cjs +0 -2
  33. package/dist/lib/vendor/@lezer/common/dist/index.cjs.map +0 -1
  34. package/dist/lib/vendor/@lezer/common/dist/index.js +0 -1392
  35. package/dist/lib/vendor/@lezer/common/dist/index.js.map +0 -1
  36. package/dist/lib/vendor/@lezer/highlight/dist/index.cjs +0 -2
  37. package/dist/lib/vendor/@lezer/highlight/dist/index.cjs.map +0 -1
  38. package/dist/lib/vendor/@lezer/highlight/dist/index.js +0 -638
  39. package/dist/lib/vendor/@lezer/highlight/dist/index.js.map +0 -1
  40. package/dist/lib/vendor/@lezer/json/dist/index.cjs +0 -2
  41. package/dist/lib/vendor/@lezer/json/dist/index.cjs.map +0 -1
  42. package/dist/lib/vendor/@lezer/json/dist/index.js +0 -35
  43. package/dist/lib/vendor/@lezer/json/dist/index.js.map +0 -1
  44. package/dist/lib/vendor/@lezer/lr/dist/index.cjs +0 -2
  45. package/dist/lib/vendor/@lezer/lr/dist/index.cjs.map +0 -1
  46. package/dist/lib/vendor/@lezer/lr/dist/index.js +0 -1269
  47. package/dist/lib/vendor/@lezer/lr/dist/index.js.map +0 -1
  48. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.cjs +0 -2
  49. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.cjs.map +0 -1
  50. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.js +0 -70
  51. package/dist/lib/vendor/@marijn/find-cluster-break/src/index.js.map +0 -1
  52. package/dist/lib/vendor/style-mod/src/style-mod.cjs +0 -4
  53. package/dist/lib/vendor/style-mod/src/style-mod.cjs.map +0 -1
  54. package/dist/lib/vendor/style-mod/src/style-mod.js +0 -110
  55. package/dist/lib/vendor/style-mod/src/style-mod.js.map +0 -1
  56. package/dist/lib/vendor/w3c-keyname/index.cjs +0 -2
  57. package/dist/lib/vendor/w3c-keyname/index.cjs.map +0 -1
  58. package/dist/lib/vendor/w3c-keyname/index.js +0 -89
  59. package/dist/lib/vendor/w3c-keyname/index.js.map +0 -1
@@ -1,791 +0,0 @@
1
- import { NodeProp as x, Tree as m, IterMode as G, TreeFragment as P, Parser as ae, NodeType as R } from "../../../@lezer/common/dist/index.js";
2
- import { Facet as v, StateField as ee, RangeSetBuilder as te, Prec as he, StateEffect as H, EditorState as A, combineConfig as ce, RangeSet as fe } from "../../state/dist/index.js";
3
- import { ViewPlugin as j, gutter as ue, EditorView as w, GutterMarker as de, Decoration as u, logException as pe, WidgetType as re, Direction as V } from "../../view/dist/index.js";
4
- import { tagHighlighter as ge, highlightTree as me, tags as ke, styleTags as we } from "../../../@lezer/highlight/dist/index.js";
5
- import { StyleModule as $ } from "../../../style-mod/src/style-mod.js";
6
- var N;
7
- const k = /* @__PURE__ */ new x();
8
- function ye(r) {
9
- return v.define({
10
- combine: r ? (e) => e.concat(r) : void 0
11
- });
12
- }
13
- const ve = /* @__PURE__ */ new x();
14
- class f {
15
- /**
16
- Construct a language object. If you need to invoke this
17
- directly, first define a data facet with
18
- [`defineLanguageFacet`](https://codemirror.net/6/docs/ref/#language.defineLanguageFacet), and then
19
- configure your parser to [attach](https://codemirror.net/6/docs/ref/#language.languageDataProp) it
20
- to the language's outer syntax node.
21
- */
22
- constructor(e, t, s = [], i = "") {
23
- this.data = e, this.name = i, A.prototype.hasOwnProperty("tree") || Object.defineProperty(A.prototype, "tree", { get() {
24
- return d(this);
25
- } }), this.parser = t, this.extension = [
26
- p.of(this),
27
- A.languageData.of((n, o, l) => {
28
- let a = J(n, o, l), h = a.type.prop(k);
29
- if (!h)
30
- return [];
31
- let c = n.facet(h), g = a.type.prop(ve);
32
- if (g) {
33
- let O = a.resolve(o - a.from, l);
34
- for (let D of g)
35
- if (D.test(O, n)) {
36
- let U = n.facet(D.facet);
37
- return D.type == "replace" ? U : U.concat(c);
38
- }
39
- }
40
- return c;
41
- })
42
- ].concat(s);
43
- }
44
- /**
45
- Query whether this language is active at the given position.
46
- */
47
- isActiveAt(e, t, s = -1) {
48
- return J(e, t, s).type.prop(k) == this.data;
49
- }
50
- /**
51
- Find the document regions that were parsed using this language.
52
- The returned regions will _include_ any nested languages rooted
53
- in this language, when those exist.
54
- */
55
- findRegions(e) {
56
- let t = e.facet(p);
57
- if ((t == null ? void 0 : t.data) == this.data)
58
- return [{ from: 0, to: e.doc.length }];
59
- if (!t || !t.allowsNesting)
60
- return [];
61
- let s = [], i = (n, o) => {
62
- if (n.prop(k) == this.data) {
63
- s.push({ from: o, to: o + n.length });
64
- return;
65
- }
66
- let l = n.prop(x.mounted);
67
- if (l) {
68
- if (l.tree.prop(k) == this.data) {
69
- if (l.overlay)
70
- for (let a of l.overlay)
71
- s.push({ from: a.from + o, to: a.to + o });
72
- else
73
- s.push({ from: o, to: o + n.length });
74
- return;
75
- } else if (l.overlay) {
76
- let a = s.length;
77
- if (i(l.tree, l.overlay[0].from + o), s.length > a)
78
- return;
79
- }
80
- }
81
- for (let a = 0; a < n.children.length; a++) {
82
- let h = n.children[a];
83
- h instanceof m && i(h, n.positions[a] + o);
84
- }
85
- };
86
- return i(d(e), 0), s;
87
- }
88
- /**
89
- Indicates whether this language allows nested languages. The
90
- default implementation returns true.
91
- */
92
- get allowsNesting() {
93
- return !0;
94
- }
95
- }
96
- f.setState = /* @__PURE__ */ H.define();
97
- function J(r, e, t) {
98
- let s = r.facet(p), i = d(r).topNode;
99
- if (!s || s.allowsNesting)
100
- for (let n = i; n; n = n.enter(e, t, G.ExcludeBuffers | G.EnterBracketed))
101
- n.type.isTop && (i = n);
102
- return i;
103
- }
104
- class L extends f {
105
- constructor(e, t, s) {
106
- super(e, t, [], s), this.parser = t;
107
- }
108
- /**
109
- Define a language from a parser.
110
- */
111
- static define(e) {
112
- let t = ye(e.languageData);
113
- return new L(t, e.parser.configure({
114
- props: [k.add((s) => s.isTop ? t : void 0)]
115
- }), e.name);
116
- }
117
- /**
118
- Create a new instance of this language with a reconfigured
119
- version of its parser and optionally a new name.
120
- */
121
- configure(e, t) {
122
- return new L(this.data, this.parser.configure(e), t || this.name);
123
- }
124
- get allowsNesting() {
125
- return this.parser.hasWrappers();
126
- }
127
- }
128
- function d(r) {
129
- let e = r.field(f.state, !1);
130
- return e ? e.tree : m.empty;
131
- }
132
- class be {
133
- /**
134
- Create an input object for the given document.
135
- */
136
- constructor(e) {
137
- this.doc = e, this.cursorPos = 0, this.string = "", this.cursor = e.iter();
138
- }
139
- get length() {
140
- return this.doc.length;
141
- }
142
- syncTo(e) {
143
- return this.string = this.cursor.next(e - this.cursorPos).value, this.cursorPos = e + this.string.length, this.cursorPos - this.string.length;
144
- }
145
- chunk(e) {
146
- return this.syncTo(e), this.string;
147
- }
148
- get lineChunks() {
149
- return !0;
150
- }
151
- read(e, t) {
152
- let s = this.cursorPos - this.string.length;
153
- return e < s || t >= this.cursorPos ? this.doc.sliceString(e, t) : this.string.slice(e - s, t - s);
154
- }
155
- }
156
- let b = null;
157
- class S {
158
- constructor(e, t, s = [], i, n, o, l, a) {
159
- this.parser = e, this.state = t, this.fragments = s, this.tree = i, this.treeLen = n, this.viewport = o, this.skipped = l, this.scheduleOn = a, this.parse = null, this.tempSkipped = [];
160
- }
161
- /**
162
- @internal
163
- */
164
- static create(e, t, s) {
165
- return new S(e, t, [], m.empty, 0, s, [], null);
166
- }
167
- startParse() {
168
- return this.parser.startParse(new be(this.state.doc), this.fragments);
169
- }
170
- /**
171
- @internal
172
- */
173
- work(e, t) {
174
- return t != null && t >= this.state.doc.length && (t = void 0), this.tree != m.empty && this.isDone(t ?? this.state.doc.length) ? (this.takeTree(), !0) : this.withContext(() => {
175
- var s;
176
- if (typeof e == "number") {
177
- let i = Date.now() + e;
178
- e = () => Date.now() > i;
179
- }
180
- for (this.parse || (this.parse = this.startParse()), t != null && (this.parse.stoppedAt == null || this.parse.stoppedAt > t) && t < this.state.doc.length && this.parse.stopAt(t); ; ) {
181
- let i = this.parse.advance();
182
- if (i)
183
- if (this.fragments = this.withoutTempSkipped(P.addTree(i, this.fragments, this.parse.stoppedAt != null)), this.treeLen = (s = this.parse.stoppedAt) !== null && s !== void 0 ? s : this.state.doc.length, this.tree = i, this.parse = null, this.treeLen < (t ?? this.state.doc.length))
184
- this.parse = this.startParse();
185
- else
186
- return !0;
187
- if (e())
188
- return !1;
189
- }
190
- });
191
- }
192
- /**
193
- @internal
194
- */
195
- takeTree() {
196
- let e, t;
197
- this.parse && (e = this.parse.parsedPos) >= this.treeLen && ((this.parse.stoppedAt == null || this.parse.stoppedAt > e) && this.parse.stopAt(e), this.withContext(() => {
198
- for (; !(t = this.parse.advance()); )
199
- ;
200
- }), this.treeLen = e, this.tree = t, this.fragments = this.withoutTempSkipped(P.addTree(this.tree, this.fragments, !0)), this.parse = null);
201
- }
202
- withContext(e) {
203
- let t = b;
204
- b = this;
205
- try {
206
- return e();
207
- } finally {
208
- b = t;
209
- }
210
- }
211
- withoutTempSkipped(e) {
212
- for (let t; t = this.tempSkipped.pop(); )
213
- e = z(e, t.from, t.to);
214
- return e;
215
- }
216
- /**
217
- @internal
218
- */
219
- changes(e, t) {
220
- let { fragments: s, tree: i, treeLen: n, viewport: o, skipped: l } = this;
221
- if (this.takeTree(), !e.empty) {
222
- let a = [];
223
- if (e.iterChangedRanges((h, c, g, O) => a.push({ fromA: h, toA: c, fromB: g, toB: O })), s = P.applyChanges(s, a), i = m.empty, n = 0, o = { from: e.mapPos(o.from, -1), to: e.mapPos(o.to, 1) }, this.skipped.length) {
224
- l = [];
225
- for (let h of this.skipped) {
226
- let c = e.mapPos(h.from, 1), g = e.mapPos(h.to, -1);
227
- c < g && l.push({ from: c, to: g });
228
- }
229
- }
230
- }
231
- return new S(this.parser, t, s, i, n, o, l, this.scheduleOn);
232
- }
233
- /**
234
- @internal
235
- */
236
- updateViewport(e) {
237
- if (this.viewport.from == e.from && this.viewport.to == e.to)
238
- return !1;
239
- this.viewport = e;
240
- let t = this.skipped.length;
241
- for (let s = 0; s < this.skipped.length; s++) {
242
- let { from: i, to: n } = this.skipped[s];
243
- i < e.to && n > e.from && (this.fragments = z(this.fragments, i, n), this.skipped.splice(s--, 1));
244
- }
245
- return this.skipped.length >= t ? !1 : (this.reset(), !0);
246
- }
247
- /**
248
- @internal
249
- */
250
- reset() {
251
- this.parse && (this.takeTree(), this.parse = null);
252
- }
253
- /**
254
- Notify the parse scheduler that the given region was skipped
255
- because it wasn't in view, and the parse should be restarted
256
- when it comes into view.
257
- */
258
- skipUntilInView(e, t) {
259
- this.skipped.push({ from: e, to: t });
260
- }
261
- /**
262
- Returns a parser intended to be used as placeholder when
263
- asynchronously loading a nested parser. It'll skip its input and
264
- mark it as not-really-parsed, so that the next update will parse
265
- it again.
266
-
267
- When `until` is given, a reparse will be scheduled when that
268
- promise resolves.
269
- */
270
- static getSkippingParser(e) {
271
- return new class extends ae {
272
- createParse(t, s, i) {
273
- let n = i[0].from, o = i[i.length - 1].to;
274
- return {
275
- parsedPos: n,
276
- advance() {
277
- let a = b;
278
- if (a) {
279
- for (let h of i)
280
- a.tempSkipped.push(h);
281
- e && (a.scheduleOn = a.scheduleOn ? Promise.all([a.scheduleOn, e]) : e);
282
- }
283
- return this.parsedPos = o, new m(R.none, [], [], o - n);
284
- },
285
- stoppedAt: null,
286
- stopAt() {
287
- }
288
- };
289
- }
290
- }();
291
- }
292
- /**
293
- @internal
294
- */
295
- isDone(e) {
296
- e = Math.min(e, this.state.doc.length);
297
- let t = this.fragments;
298
- return this.treeLen >= e && t.length && t[0].from == 0 && t[0].to >= e;
299
- }
300
- /**
301
- Get the context for the current parse, or `null` if no editor
302
- parse is in progress.
303
- */
304
- static get() {
305
- return b;
306
- }
307
- }
308
- function z(r, e, t) {
309
- return P.applyChanges(r, [{ fromA: e, toA: t, fromB: e, toB: t }]);
310
- }
311
- class y {
312
- constructor(e) {
313
- this.context = e, this.tree = e.tree;
314
- }
315
- apply(e) {
316
- if (!e.docChanged && this.tree == this.context.tree)
317
- return this;
318
- let t = this.context.changes(e.changes, e.state), s = this.context.treeLen == e.startState.doc.length ? void 0 : Math.max(e.changes.mapPos(this.context.treeLen), t.viewport.to);
319
- return t.work(20, s) || t.takeTree(), new y(t);
320
- }
321
- static init(e) {
322
- let t = Math.min(3e3, e.doc.length), s = S.create(e.facet(p).parser, e, { from: 0, to: t });
323
- return s.work(20, t) || s.takeTree(), new y(s);
324
- }
325
- }
326
- f.state = /* @__PURE__ */ ee.define({
327
- create: y.init,
328
- update(r, e) {
329
- for (let t of e.effects)
330
- if (t.is(f.setState))
331
- return t.value;
332
- return e.startState.facet(p) != e.state.facet(p) ? y.init(e.state) : r.apply(e);
333
- }
334
- });
335
- let se = (r) => {
336
- let e = setTimeout(
337
- () => r(),
338
- 500
339
- /* Work.MaxPause */
340
- );
341
- return () => clearTimeout(e);
342
- };
343
- typeof requestIdleCallback < "u" && (se = (r) => {
344
- let e = -1, t = setTimeout(
345
- () => {
346
- e = requestIdleCallback(r, {
347
- timeout: 400
348
- /* Work.MinPause */
349
- });
350
- },
351
- 100
352
- /* Work.MinPause */
353
- );
354
- return () => e < 0 ? clearTimeout(t) : cancelIdleCallback(e);
355
- });
356
- const M = typeof navigator < "u" && (!((N = navigator.scheduling) === null || N === void 0) && N.isInputPending) ? () => navigator.scheduling.isInputPending() : null, Te = /* @__PURE__ */ j.fromClass(class {
357
- constructor(e) {
358
- this.view = e, this.working = null, this.workScheduled = 0, this.chunkEnd = -1, this.chunkBudget = -1, this.work = this.work.bind(this), this.scheduleWork();
359
- }
360
- update(e) {
361
- let t = this.view.state.field(f.state).context;
362
- (t.updateViewport(e.view.viewport) || this.view.viewport.to > t.treeLen) && this.scheduleWork(), (e.docChanged || e.selectionSet) && (this.view.hasFocus && (this.chunkBudget += 50), this.scheduleWork()), this.checkAsyncSchedule(t);
363
- }
364
- scheduleWork() {
365
- if (this.working)
366
- return;
367
- let { state: e } = this.view, t = e.field(f.state);
368
- (t.tree != t.context.tree || !t.context.isDone(e.doc.length)) && (this.working = se(this.work));
369
- }
370
- work(e) {
371
- this.working = null;
372
- let t = Date.now();
373
- if (this.chunkEnd < t && (this.chunkEnd < 0 || this.view.hasFocus) && (this.chunkEnd = t + 3e4, this.chunkBudget = 3e3), this.chunkBudget <= 0)
374
- return;
375
- let { state: s, viewport: { to: i } } = this.view, n = s.field(f.state);
376
- if (n.tree == n.context.tree && n.context.isDone(
377
- i + 1e5
378
- /* Work.MaxParseAhead */
379
- ))
380
- return;
381
- let o = Date.now() + Math.min(this.chunkBudget, 100, e && !M ? Math.max(25, e.timeRemaining() - 5) : 1e9), l = n.context.treeLen < i && s.doc.length > i + 1e3, a = n.context.work(() => M && M() || Date.now() > o, i + (l ? 0 : 1e5));
382
- this.chunkBudget -= Date.now() - t, (a || this.chunkBudget <= 0) && (n.context.takeTree(), this.view.dispatch({ effects: f.setState.of(new y(n.context)) })), this.chunkBudget > 0 && !(a && !l) && this.scheduleWork(), this.checkAsyncSchedule(n.context);
383
- }
384
- checkAsyncSchedule(e) {
385
- e.scheduleOn && (this.workScheduled++, e.scheduleOn.then(() => this.scheduleWork()).catch((t) => pe(this.view.state, t)).then(() => this.workScheduled--), e.scheduleOn = null);
386
- }
387
- destroy() {
388
- this.working && this.working();
389
- }
390
- isWorking() {
391
- return !!(this.working || this.workScheduled > 0);
392
- }
393
- }, {
394
- eventHandlers: { focus() {
395
- this.scheduleWork();
396
- } }
397
- }), p = /* @__PURE__ */ v.define({
398
- combine(r) {
399
- return r.length ? r[0] : null;
400
- },
401
- enables: (r) => [
402
- f.state,
403
- Te,
404
- w.contentAttributes.compute([r], (e) => {
405
- let t = e.facet(r);
406
- return t && t.name ? { "data-language": t.name } : {};
407
- })
408
- ]
409
- });
410
- class $e {
411
- /**
412
- Create a language support object.
413
- */
414
- constructor(e, t = []) {
415
- this.language = e, this.support = t, this.extension = [e, t];
416
- }
417
- }
418
- const Je = /* @__PURE__ */ new x();
419
- function ze({ except: r, units: e = 1 } = {}) {
420
- return (t) => {
421
- let s = r && r.test(t.textAfter);
422
- return t.baseIndent + (s ? 0 : e * t.unit);
423
- };
424
- }
425
- const xe = /* @__PURE__ */ v.define(), Pe = /* @__PURE__ */ new x();
426
- function Ke(r) {
427
- let e = r.firstChild, t = r.lastChild;
428
- return e && e.to < t.from ? { from: e.to, to: t.type.isError ? r.to : t.from } : null;
429
- }
430
- function Se(r, e, t) {
431
- let s = d(r);
432
- if (s.length < t)
433
- return null;
434
- let i = s.resolveStack(t, 1), n = null;
435
- for (let o = i; o; o = o.next) {
436
- let l = o.node;
437
- if (l.to <= t || l.from > t)
438
- continue;
439
- if (n && l.from < e)
440
- break;
441
- let a = l.type.prop(Pe);
442
- if (a && (l.to < s.length - 50 || s.length == r.doc.length || !Ce(l))) {
443
- let h = a(l, r);
444
- h && h.from <= t && h.from >= e && h.to > t && (n = h);
445
- }
446
- }
447
- return n;
448
- }
449
- function Ce(r) {
450
- let e = r.lastChild;
451
- return e && e.to == r.to && e.type.isError;
452
- }
453
- function K(r, e, t) {
454
- for (let s of r.facet(xe)) {
455
- let i = s(r, e, t);
456
- if (i)
457
- return i;
458
- }
459
- return Se(r, e, t);
460
- }
461
- function ie(r, e) {
462
- let t = e.mapPos(r.from, 1), s = e.mapPos(r.to, -1);
463
- return t >= s ? void 0 : { from: t, to: s };
464
- }
465
- const ne = /* @__PURE__ */ H.define({ map: ie }), C = /* @__PURE__ */ H.define({ map: ie }), T = /* @__PURE__ */ ee.define({
466
- create() {
467
- return u.none;
468
- },
469
- update(r, e) {
470
- e.isUserEvent("delete") && e.changes.iterChangedRanges((s, i) => r = Q(r, s, i)), r = r.map(e.changes);
471
- let t = [];
472
- for (let s of e.effects)
473
- s.is(ne) && !Oe(r, s.value.from, s.value.to) ? t.push(s.value) : s.is(C) && (r = r.update({
474
- filter: (i, n) => s.value.from != i || s.value.to != n,
475
- filterFrom: s.value.from,
476
- filterTo: s.value.to
477
- }));
478
- if (t.length) {
479
- let { preparePlaceholder: s } = e.state.facet(oe), i = t.map((n) => (s ? u.replace({ widget: new Ne(s(e.state, n)) }) : X).range(n.from, n.to));
480
- r = r.update({ add: i });
481
- }
482
- return e.selection && (r = Q(r, e.selection.main.head)), r;
483
- },
484
- provide: (r) => w.decorations.from(r),
485
- toJSON(r, e) {
486
- let t = [];
487
- return r.between(0, e.doc.length, (s, i) => {
488
- t.push(s, i);
489
- }), t;
490
- },
491
- fromJSON(r) {
492
- if (!Array.isArray(r) || r.length % 2)
493
- throw new RangeError("Invalid JSON for fold state");
494
- let e = [];
495
- for (let t = 0; t < r.length; ) {
496
- let s = r[t++], i = r[t++];
497
- if (typeof s != "number" || typeof i != "number")
498
- throw new RangeError("Invalid JSON for fold state");
499
- e.push(X.range(s, i));
500
- }
501
- return u.set(e, !0);
502
- }
503
- });
504
- function Q(r, e, t = e) {
505
- let s = !1;
506
- return r.between(e, t, (i, n) => {
507
- i < t && n > e && (s = !0);
508
- }), s ? r.update({
509
- filterFrom: e,
510
- filterTo: t,
511
- filter: (i, n) => i >= t || n <= e
512
- }) : r;
513
- }
514
- function B(r, e, t) {
515
- var s;
516
- let i = null;
517
- return (s = r.field(T, !1)) === null || s === void 0 || s.between(e, t, (n, o) => {
518
- (!i || i.from > n) && (i = { from: n, to: o });
519
- }), i;
520
- }
521
- function Oe(r, e, t) {
522
- let s = !1;
523
- return r.between(e, e, (i, n) => {
524
- i == e && n == t && (s = !0);
525
- }), s;
526
- }
527
- const Qe = (r) => {
528
- let e = r.state.field(T, !1);
529
- if (!e || !e.size)
530
- return !1;
531
- let t = [];
532
- return e.between(0, r.state.doc.length, (s, i) => {
533
- t.push(C.of({ from: s, to: i }));
534
- }), r.dispatch({ effects: t }), !0;
535
- }, De = {
536
- placeholderDOM: null,
537
- preparePlaceholder: null,
538
- placeholderText: "…"
539
- }, oe = /* @__PURE__ */ v.define({
540
- combine(r) {
541
- return ce(r, De);
542
- }
543
- });
544
- function Ae(r) {
545
- return [T, Ee];
546
- }
547
- function le(r, e) {
548
- let { state: t } = r, s = t.facet(oe), i = (o) => {
549
- let l = r.lineBlockAt(r.posAtDOM(o.target)), a = B(r.state, l.from, l.to);
550
- a && r.dispatch({ effects: C.of(a) }), o.preventDefault();
551
- };
552
- if (s.placeholderDOM)
553
- return s.placeholderDOM(r, i, e);
554
- let n = document.createElement("span");
555
- return n.textContent = s.placeholderText, n.setAttribute("aria-label", t.phrase("folded code")), n.title = t.phrase("unfold"), n.className = "cm-foldPlaceholder", n.onclick = i, n;
556
- }
557
- const X = /* @__PURE__ */ u.replace({ widget: /* @__PURE__ */ new class extends re {
558
- toDOM(r) {
559
- return le(r, null);
560
- }
561
- }() });
562
- class Ne extends re {
563
- constructor(e) {
564
- super(), this.value = e;
565
- }
566
- eq(e) {
567
- return this.value == e.value;
568
- }
569
- toDOM(e) {
570
- return le(e, this.value);
571
- }
572
- }
573
- const Me = {
574
- openText: "⌄",
575
- closedText: "›",
576
- markerDOM: null,
577
- domEventHandlers: {},
578
- foldingChanged: () => !1
579
- };
580
- class E extends de {
581
- constructor(e, t) {
582
- super(), this.config = e, this.open = t;
583
- }
584
- eq(e) {
585
- return this.config == e.config && this.open == e.open;
586
- }
587
- toDOM(e) {
588
- if (this.config.markerDOM)
589
- return this.config.markerDOM(this.open);
590
- let t = document.createElement("span");
591
- return t.textContent = this.open ? this.config.openText : this.config.closedText, t.title = e.state.phrase(this.open ? "Fold line" : "Unfold line"), t;
592
- }
593
- }
594
- function Xe(r = {}) {
595
- let e = { ...Me, ...r }, t = new E(e, !0), s = new E(e, !1), i = j.fromClass(class {
596
- constructor(o) {
597
- this.from = o.viewport.from, this.markers = this.buildMarkers(o);
598
- }
599
- update(o) {
600
- (o.docChanged || o.viewportChanged || o.startState.facet(p) != o.state.facet(p) || o.startState.field(T, !1) != o.state.field(T, !1) || d(o.startState) != d(o.state) || e.foldingChanged(o)) && (this.markers = this.buildMarkers(o.view));
601
- }
602
- buildMarkers(o) {
603
- let l = new te();
604
- for (let a of o.viewportLineBlocks) {
605
- let h = B(o.state, a.from, a.to) ? s : K(o.state, a.from, a.to) ? t : null;
606
- h && l.add(a.from, a.from, h);
607
- }
608
- return l.finish();
609
- }
610
- }), { domEventHandlers: n } = e;
611
- return [
612
- i,
613
- ue({
614
- class: "cm-foldGutter",
615
- markers(o) {
616
- var l;
617
- return ((l = o.plugin(i)) === null || l === void 0 ? void 0 : l.markers) || fe.empty;
618
- },
619
- initialSpacer() {
620
- return new E(e, !1);
621
- },
622
- domEventHandlers: {
623
- ...n,
624
- click: (o, l, a) => {
625
- if (n.click && n.click(o, l, a))
626
- return !0;
627
- let h = B(o.state, l.from, l.to);
628
- if (h)
629
- return o.dispatch({ effects: C.of(h) }), !0;
630
- let c = K(o.state, l.from, l.to);
631
- return c ? (o.dispatch({ effects: ne.of(c) }), !0) : !1;
632
- }
633
- }
634
- }),
635
- Ae()
636
- ];
637
- }
638
- const Ee = /* @__PURE__ */ w.baseTheme({
639
- ".cm-foldPlaceholder": {
640
- backgroundColor: "#eee",
641
- border: "1px solid #ddd",
642
- color: "#888",
643
- borderRadius: ".2em",
644
- margin: "0 1px",
645
- padding: "0 1px",
646
- cursor: "pointer"
647
- },
648
- ".cm-foldGutter span": {
649
- padding: "0 1px",
650
- cursor: "pointer"
651
- }
652
- });
653
- class q {
654
- constructor(e, t) {
655
- this.specs = e;
656
- let s;
657
- function i(l) {
658
- let a = $.newName();
659
- return (s || (s = /* @__PURE__ */ Object.create(null)))["." + a] = l, a;
660
- }
661
- const n = typeof t.all == "string" ? t.all : t.all ? i(t.all) : void 0, o = t.scope;
662
- this.scope = o instanceof f ? (l) => l.prop(k) == o.data : o ? (l) => l == o : void 0, this.style = ge(e.map((l) => ({
663
- tag: l.tag,
664
- class: l.class || i(Object.assign({}, l, { tag: null }))
665
- })), {
666
- all: n
667
- }).style, this.module = s ? new $(s) : null, this.themeType = t.themeType;
668
- }
669
- /**
670
- Create a highlighter style that associates the given styles to
671
- the given tags. The specs must be objects that hold a style tag
672
- or array of tags in their `tag` property, and either a single
673
- `class` property providing a static CSS class (for highlighter
674
- that rely on external styling), or a
675
- [`style-mod`](https://code.haverbeke.berlin/marijn/style-mod#documentation)-style
676
- set of CSS properties (which define the styling for those tags).
677
-
678
- The CSS rules created for a highlighter will be emitted in the
679
- order of the spec's properties. That means that for elements that
680
- have multiple tags associated with them, styles defined further
681
- down in the list will have a higher CSS precedence than styles
682
- defined earlier.
683
- */
684
- static define(e, t) {
685
- return new q(e, t || {});
686
- }
687
- }
688
- const W = /* @__PURE__ */ v.define(), Fe = /* @__PURE__ */ v.define({
689
- combine(r) {
690
- return r.length ? [r[0]] : null;
691
- }
692
- });
693
- function F(r) {
694
- let e = r.facet(W);
695
- return e.length ? e : r.facet(Fe);
696
- }
697
- function Ye(r, e) {
698
- let t = [Le], s;
699
- return r instanceof q && (r.module && t.push(w.styleModule.of(r.module)), s = r.themeType), s ? t.push(W.computeN([w.darkTheme], (i) => i.facet(w.darkTheme) == (s == "dark") ? [r] : [])) : t.push(W.of(r)), t;
700
- }
701
- class Ie {
702
- constructor(e) {
703
- this.markCache = /* @__PURE__ */ Object.create(null), this.tree = d(e.state), this.decorations = this.buildDeco(e, F(e.state)), this.decoratedTo = e.viewport.to;
704
- }
705
- update(e) {
706
- let t = d(e.state), s = F(e.state), i = s != F(e.startState), { viewport: n } = e.view, o = e.changes.mapPos(this.decoratedTo, 1);
707
- t.length < n.to && !i && t.type == this.tree.type && o >= n.to ? (this.decorations = this.decorations.map(e.changes), this.decoratedTo = o) : (t != this.tree || e.viewportChanged || i) && (this.tree = t, this.decorations = this.buildDeco(e.view, s), this.decoratedTo = n.to);
708
- }
709
- buildDeco(e, t) {
710
- if (!t || !this.tree.length)
711
- return u.none;
712
- let s = new te();
713
- for (let { from: i, to: n } of e.visibleRanges)
714
- me(this.tree, t, (o, l, a) => {
715
- s.add(o, l, this.markCache[a] || (this.markCache[a] = u.mark({ class: a })));
716
- }, i, n);
717
- return s.finish();
718
- }
719
- }
720
- const Le = /* @__PURE__ */ he.high(/* @__PURE__ */ j.fromClass(Ie, {
721
- decorations: (r) => r.decorations
722
- })), Be = /* @__PURE__ */ Object.create(null), Y = [R.none], Z = [], _ = /* @__PURE__ */ Object.create(null), We = /* @__PURE__ */ Object.create(null);
723
- for (let [r, e] of [
724
- ["variable", "variableName"],
725
- ["variable-2", "variableName.special"],
726
- ["string-2", "string.special"],
727
- ["def", "variableName.definition"],
728
- ["tag", "tagName"],
729
- ["attribute", "attributeName"],
730
- ["type", "typeName"],
731
- ["builtin", "variableName.standard"],
732
- ["qualifier", "modifier"],
733
- ["error", "invalid"],
734
- ["header", "heading"],
735
- ["property", "propertyName"]
736
- ])
737
- We[r] = /* @__PURE__ */ Re(Be, e);
738
- function I(r, e) {
739
- Z.indexOf(r) > -1 || (Z.push(r), console.warn(e));
740
- }
741
- function Re(r, e) {
742
- let t = [];
743
- for (let l of e.split(" ")) {
744
- let a = [];
745
- for (let h of l.split(".")) {
746
- let c = r[h] || ke[h];
747
- c ? typeof c == "function" ? a.length ? a = a.map(c) : I(h, `Modifier ${h} used at start of tag`) : a.length ? I(h, `Tag ${h} used as modifier`) : a = Array.isArray(c) ? c : [c] : I(h, `Unknown highlighting tag ${h}`);
748
- }
749
- for (let h of a)
750
- t.push(h);
751
- }
752
- if (!t.length)
753
- return 0;
754
- let s = e.replace(/ /g, "_"), i = s + " " + t.map((l) => l.id), n = _[i];
755
- if (n)
756
- return n.id;
757
- let o = _[i] = R.define({
758
- id: Y.length,
759
- name: s,
760
- props: [we({ [s]: t })]
761
- });
762
- return Y.push(o), o.id;
763
- }
764
- V.RTL, V.LTR;
765
- export {
766
- be as DocInput,
767
- q as HighlightStyle,
768
- L as LRLanguage,
769
- f as Language,
770
- $e as LanguageSupport,
771
- S as ParseContext,
772
- Ae as codeFolding,
773
- ze as continuedIndent,
774
- ye as defineLanguageFacet,
775
- ne as foldEffect,
776
- Xe as foldGutter,
777
- Ke as foldInside,
778
- Pe as foldNodeProp,
779
- xe as foldService,
780
- T as foldState,
781
- K as foldable,
782
- Je as indentNodeProp,
783
- p as language,
784
- k as languageDataProp,
785
- ve as sublanguageProp,
786
- Ye as syntaxHighlighting,
787
- d as syntaxTree,
788
- Qe as unfoldAll,
789
- C as unfoldEffect
790
- };
791
- //# sourceMappingURL=index.js.map