@plumile/ui 0.1.146 → 0.1.147
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/README.md +3 -0
- package/lib/esm/atomic/molecules/markdown/components/MarkdownArticleContainer.css.js +1 -0
- package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeCopyButton.js +19 -35
- package/lib/esm/atomic/molecules/markdown/components/MarkdownCodeCopyButton.js.map +1 -1
- package/lib/esm/atomic/molecules/markdown/components/MarkdownEmphasis.css.js +0 -1
- package/lib/esm/backoffice/atoms/copyable_text/CopyableText.js +22 -42
- package/lib/esm/backoffice/atoms/copyable_text/CopyableText.js.map +1 -1
- package/lib/esm/backoffice/molecules/backoffice_json_viewer/BackofficeJsonViewer.js +2 -1
- package/lib/esm/backoffice/molecules/backoffice_json_viewer/BackofficeJsonViewer.js.map +1 -1
- package/lib/esm/backoffice/shared/copyWithExecCommand.js +1 -14
- package/lib/esm/hooks/useClipboardCopy.js +31 -0
- package/lib/esm/hooks/useClipboardCopy.js.map +1 -0
- package/lib/esm/index.js +223 -221
- package/lib/esm/node_modules/@shikijs/core/dist/index.js +99 -96
- package/lib/esm/node_modules/@shikijs/core/dist/index.js.map +1 -1
- package/lib/esm/node_modules/@shikijs/core/node_modules/@shikijs/types/dist/index.js.map +1 -1
- package/lib/esm/node_modules/@shikijs/primitive/dist/index.js +91 -85
- package/lib/esm/node_modules/@shikijs/primitive/dist/index.js.map +1 -1
- package/lib/esm/node_modules/@shikijs/primitive/node_modules/@shikijs/types/dist/index.js.map +1 -1
- package/lib/esm/node_modules/cytoscape/dist/cytoscape.esm.js +1 -1
- package/lib/esm/node_modules/cytoscape/dist/cytoscape.esm.js.map +1 -1
- package/lib/esm/node_modules/react-shiki/dist/index.js +1 -1
- package/lib/esm/node_modules/shiki/dist/bundle-full.js +1 -1
- package/lib/esm/node_modules/shiki/dist/bundle-full.js.map +1 -1
- package/lib/esm/node_modules/shiki/dist/{chunk-CtajNgzt.js → chunk-D1SwGrFN.js} +2 -2
- package/lib/esm/node_modules/shiki/dist/chunk-D1SwGrFN.js.map +1 -0
- package/lib/esm/node_modules/shiki/dist/engine-oniguruma.js +1 -1
- package/lib/esm/node_modules/shiki/dist/engine-oniguruma.js.map +1 -1
- package/lib/esm/node_modules/shiki/dist/{langs-bundle-full-DfKZStlK.js → langs-bundle-full-YTHnHqaM.js} +2 -2
- package/lib/esm/node_modules/shiki/dist/{langs-bundle-full-DfKZStlK.js.map → langs-bundle-full-YTHnHqaM.js.map} +1 -1
- package/lib/esm/node_modules/shiki/dist/themes.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/engine-oniguruma/dist/index.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/apex.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/apex.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/c3.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/c3.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/csharp.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/csharp.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/hack.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/hack.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/julia.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/julia.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/just.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/just.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/latex.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/latex.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/luau.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/luau.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/php.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/php.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/sql.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/langs/dist/sql.js.map +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/themes/dist/vesper.js +1 -1
- package/lib/esm/node_modules/shiki/node_modules/@shikijs/themes/dist/vesper.js.map +1 -1
- package/lib/esm/shared/clipboard.js +55 -0
- package/lib/esm/shared/clipboard.js.map +1 -0
- package/lib/types/atomic/molecules/markdown/components/MarkdownCodeCopyButton.d.ts.map +1 -1
- package/lib/types/backoffice/atoms/copyable_text/CopyableText.d.ts.map +1 -1
- package/lib/types/backoffice/shared/copyWithExecCommand.d.ts +1 -1
- package/lib/types/backoffice/shared/copyWithExecCommand.d.ts.map +1 -1
- package/lib/types/hooks/useClipboardCopy.d.ts +9 -0
- package/lib/types/hooks/useClipboardCopy.d.ts.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/shared/clipboard.d.ts +9 -0
- package/lib/types/shared/clipboard.d.ts.map +1 -0
- package/package.json +4 -4
- package/lib/esm/backoffice/shared/copyWithExecCommand.js.map +0 -1
- package/lib/esm/node_modules/shiki/dist/chunk-CtajNgzt.js.map +0 -1
|
@@ -32,30 +32,31 @@ function d(e) {
|
|
|
32
32
|
function f(e) {
|
|
33
33
|
return d(e);
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
var p = /(\r?\n)/g;
|
|
36
|
+
function m(e, t = !1) {
|
|
36
37
|
if (e.length === 0) return [["", 0]];
|
|
37
|
-
let n = e.split(
|
|
38
|
+
let n = e.split(p), r = 0, i = [];
|
|
38
39
|
for (let e = 0; e < n.length; e += 2) {
|
|
39
40
|
let a = t ? n[e] + (n[e + 1] || "") : n[e];
|
|
40
41
|
i.push([a, r]), r += n[e].length, r += n[e + 1]?.length || 0;
|
|
41
42
|
}
|
|
42
43
|
return i;
|
|
43
44
|
}
|
|
44
|
-
var
|
|
45
|
+
var h = {
|
|
45
46
|
light: "#333333",
|
|
46
47
|
dark: "#bbbbbb"
|
|
47
|
-
},
|
|
48
|
+
}, g = {
|
|
48
49
|
light: "#fffffe",
|
|
49
50
|
dark: "#1e1e1e"
|
|
50
|
-
},
|
|
51
|
-
function
|
|
52
|
-
if (e?.[
|
|
51
|
+
}, _ = "__shiki_resolved";
|
|
52
|
+
function v(e) {
|
|
53
|
+
if (e?.[_]) return e;
|
|
53
54
|
let t = { ...e };
|
|
54
55
|
t.tokenColors && !t.settings && (t.settings = t.tokenColors, delete t.tokenColors), t.type ||= "dark", t.colorReplacements = { ...t.colorReplacements }, t.settings ||= [];
|
|
55
56
|
let { bg: n, fg: r } = t;
|
|
56
57
|
if (!n || !r) {
|
|
57
58
|
let e = t.settings ? t.settings.find((e) => !e.name && !e.scope) : void 0;
|
|
58
|
-
e?.settings?.foreground && (r = e.settings.foreground), e?.settings?.background && (n = e.settings.background), !r && t?.colors?.["editor.foreground"] && (r = t.colors["editor.foreground"]), !n && t?.colors?.["editor.background"] && (n = t.colors["editor.background"]), r ||= t.type === "light" ?
|
|
59
|
+
e?.settings?.foreground && (r = e.settings.foreground), e?.settings?.background && (n = e.settings.background), !r && t?.colors?.["editor.foreground"] && (r = t.colors["editor.foreground"]), !n && t?.colors?.["editor.background"] && (n = t.colors["editor.background"]), r ||= t.type === "light" ? h.light : h.dark, n ||= t.type === "light" ? g.light : g.dark, t.fg = r, t.bg = n;
|
|
59
60
|
}
|
|
60
61
|
t.settings[0] && t.settings[0].settings && !t.settings[0].scope || t.settings.unshift({ settings: {
|
|
61
62
|
foreground: t.fg,
|
|
@@ -89,30 +90,34 @@ function _(e) {
|
|
|
89
90
|
let n = o(t.colors[e]);
|
|
90
91
|
t.colorReplacements[n] = t.colors[e], t.colors[e] = n;
|
|
91
92
|
}
|
|
92
|
-
return Object.defineProperty(t,
|
|
93
|
+
return Object.defineProperty(t, _, {
|
|
93
94
|
enumerable: !1,
|
|
94
95
|
writable: !1,
|
|
95
96
|
value: !0
|
|
96
97
|
}), t;
|
|
97
98
|
}
|
|
98
|
-
async function v(e) {
|
|
99
|
-
return Array.from(new Set((await Promise.all(e.filter((e) => !u(e)).map(async (e) => await c(e).then((e) => Array.isArray(e) ? e : [e])))).flat()));
|
|
100
|
-
}
|
|
101
99
|
async function y(e) {
|
|
102
|
-
return (await Promise.all(e.
|
|
100
|
+
return [...new Set((await Promise.all(e.filter((e) => !u(e)).map(async (e) => await c(e).then((e) => Array.isArray(e) ? e : [e])))).flat())];
|
|
101
|
+
}
|
|
102
|
+
async function b(e) {
|
|
103
|
+
return (await Promise.all(e.map(async (e) => f(e) ? null : v(await c(e))))).filter((e) => !!e);
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
+
function x(t, n) {
|
|
105
106
|
if (!n) return t;
|
|
106
107
|
if (n[t]) {
|
|
107
108
|
let r = new Set([t]);
|
|
108
109
|
for (; n[t];) {
|
|
109
|
-
if (t = n[t], r.has(t)) throw new e(`Circular alias \`${
|
|
110
|
+
if (t = n[t], r.has(t)) throw new e(`Circular alias \`${[...r].join(" -> ")} -> ${t}\``);
|
|
110
111
|
r.add(t);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
return t;
|
|
114
115
|
}
|
|
115
|
-
var
|
|
116
|
+
var S = class extends r {
|
|
117
|
+
_resolver;
|
|
118
|
+
_themes;
|
|
119
|
+
_langs;
|
|
120
|
+
_alias;
|
|
116
121
|
_resolvedThemes = /* @__PURE__ */ new Map();
|
|
117
122
|
_resolvedGrammars = /* @__PURE__ */ new Map();
|
|
118
123
|
_langMap = /* @__PURE__ */ new Map();
|
|
@@ -127,7 +132,7 @@ var x = class extends r {
|
|
|
127
132
|
return typeof e == "string" ? this._resolvedThemes.get(e) : this.loadTheme(e);
|
|
128
133
|
}
|
|
129
134
|
loadTheme(e) {
|
|
130
|
-
let t =
|
|
135
|
+
let t = v(e);
|
|
131
136
|
return t.name && (this._resolvedThemes.set(t.name, t), this._loadedThemesCache = null), t;
|
|
132
137
|
}
|
|
133
138
|
getLoadedThemes() {
|
|
@@ -138,7 +143,7 @@ var x = class extends r {
|
|
|
138
143
|
t || (t = i.createFromRawTheme(e), this._textmateThemeCache.set(e, t)), this._syncRegistry.setTheme(t);
|
|
139
144
|
}
|
|
140
145
|
getGrammar(e) {
|
|
141
|
-
return e =
|
|
146
|
+
return e = x(e, this._alias), this._resolvedGrammars.get(e);
|
|
142
147
|
}
|
|
143
148
|
loadLanguage(e) {
|
|
144
149
|
if (this.getGrammar(e.name)) return;
|
|
@@ -159,7 +164,7 @@ var x = class extends r {
|
|
|
159
164
|
}
|
|
160
165
|
loadLanguages(t) {
|
|
161
166
|
for (let e of t) this.resolveEmbeddedLanguages(e);
|
|
162
|
-
let n =
|
|
167
|
+
let n = [...this._langGraph.entries()], r = n.filter(([e, t]) => !t);
|
|
163
168
|
if (r.length) {
|
|
164
169
|
let t = n.filter(([e, t]) => t ? (t.embeddedLanguages || t.embeddedLangs)?.some((e) => r.map(([e]) => e).includes(e)) : !1).filter((e) => !r.includes(e));
|
|
165
170
|
throw new e(`Missing languages ${r.map(([e]) => `\`${e}\``).join(", ")}, required by ${t.map(([e]) => `\`${e}\``).join(", ")}`);
|
|
@@ -175,7 +180,7 @@ var x = class extends r {
|
|
|
175
180
|
let t = e.embeddedLanguages ?? e.embeddedLangs;
|
|
176
181
|
if (t) for (let e of t) this._langGraph.set(e, this._langMap.get(e));
|
|
177
182
|
}
|
|
178
|
-
},
|
|
183
|
+
}, C = class {
|
|
179
184
|
_langs = /* @__PURE__ */ new Map();
|
|
180
185
|
_scopeToLang = /* @__PURE__ */ new Map();
|
|
181
186
|
_injections = /* @__PURE__ */ new Map();
|
|
@@ -210,17 +215,17 @@ var x = class extends r {
|
|
|
210
215
|
}
|
|
211
216
|
return n;
|
|
212
217
|
}
|
|
213
|
-
},
|
|
214
|
-
function
|
|
215
|
-
|
|
218
|
+
}, w = 0;
|
|
219
|
+
function T(t) {
|
|
220
|
+
w += 1, t.warnings !== !1 && w >= 10 && w % 10 == 0 && console.warn(`[Shiki] ${w} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);
|
|
216
221
|
let n = !1;
|
|
217
222
|
if (!t.engine) throw new e("`engine` option is required for synchronous mode");
|
|
218
|
-
let r = (t.langs || []).flat(1), i = (t.themes || []).flat(1).map(
|
|
223
|
+
let r = (t.langs || []).flat(1), i = (t.themes || []).flat(1).map(v), a = new S(new C(t.engine, r), i, r, t.langAlias), o;
|
|
219
224
|
function s(e) {
|
|
220
|
-
return
|
|
225
|
+
return x(e, t.langAlias);
|
|
221
226
|
}
|
|
222
227
|
function c(t) {
|
|
223
|
-
|
|
228
|
+
_();
|
|
224
229
|
let n = a.getGrammar(typeof t == "string" ? t : t.name);
|
|
225
230
|
if (!n) throw new e(`Language \`${t}\` not found, you may need to load it first`);
|
|
226
231
|
return n;
|
|
@@ -233,13 +238,13 @@ function w(t) {
|
|
|
233
238
|
settings: [],
|
|
234
239
|
type: "dark"
|
|
235
240
|
};
|
|
236
|
-
|
|
241
|
+
_();
|
|
237
242
|
let n = a.getTheme(t);
|
|
238
243
|
if (!n) throw new e(`Theme \`${t}\` not found, you may need to load it first`);
|
|
239
244
|
return n;
|
|
240
245
|
}
|
|
241
246
|
function u(e) {
|
|
242
|
-
|
|
247
|
+
_();
|
|
243
248
|
let t = l(e);
|
|
244
249
|
return o !== e && (a.setTheme(t), o = e), {
|
|
245
250
|
theme: t,
|
|
@@ -247,29 +252,29 @@ function w(t) {
|
|
|
247
252
|
};
|
|
248
253
|
}
|
|
249
254
|
function d() {
|
|
250
|
-
return
|
|
255
|
+
return _(), a.getLoadedThemes();
|
|
251
256
|
}
|
|
252
257
|
function f() {
|
|
253
|
-
return
|
|
258
|
+
return _(), a.getLoadedLanguages();
|
|
254
259
|
}
|
|
255
260
|
function p(...e) {
|
|
256
|
-
|
|
261
|
+
_(), a.loadLanguages(e.flat(1));
|
|
257
262
|
}
|
|
258
263
|
async function m(...e) {
|
|
259
|
-
return p(await
|
|
264
|
+
return p(await y(e));
|
|
260
265
|
}
|
|
261
266
|
function h(...e) {
|
|
262
|
-
|
|
267
|
+
_();
|
|
263
268
|
for (let t of e.flat(1)) a.loadTheme(t);
|
|
264
269
|
}
|
|
265
270
|
async function g(...e) {
|
|
266
|
-
return
|
|
271
|
+
return _(), h(await b(e));
|
|
267
272
|
}
|
|
268
|
-
function
|
|
273
|
+
function _() {
|
|
269
274
|
if (n) throw new e("Shiki instance has been disposed");
|
|
270
275
|
}
|
|
271
276
|
function T() {
|
|
272
|
-
n || (n = !0, a.dispose(), --
|
|
277
|
+
n || (n = !0, a.dispose(), --w);
|
|
273
278
|
}
|
|
274
279
|
return {
|
|
275
280
|
setTheme: u,
|
|
@@ -286,28 +291,28 @@ function w(t) {
|
|
|
286
291
|
[Symbol.dispose]: T
|
|
287
292
|
};
|
|
288
293
|
}
|
|
289
|
-
async function
|
|
294
|
+
async function E(e) {
|
|
290
295
|
e.engine || console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");
|
|
291
296
|
let [t, n, r] = await Promise.all([
|
|
292
|
-
|
|
293
|
-
|
|
297
|
+
b(e.themes || []),
|
|
298
|
+
y(e.langs || []),
|
|
294
299
|
e.engine
|
|
295
300
|
]);
|
|
296
|
-
return
|
|
301
|
+
return T({
|
|
297
302
|
...e,
|
|
298
303
|
themes: t,
|
|
299
304
|
langs: n,
|
|
300
305
|
engine: r
|
|
301
306
|
});
|
|
302
307
|
}
|
|
303
|
-
var
|
|
304
|
-
function
|
|
305
|
-
|
|
308
|
+
var D = /* @__PURE__ */ new WeakMap();
|
|
309
|
+
function O(e, t) {
|
|
310
|
+
D.set(e, t);
|
|
306
311
|
}
|
|
307
|
-
function
|
|
308
|
-
return
|
|
312
|
+
function k(e) {
|
|
313
|
+
return D.get(e);
|
|
309
314
|
}
|
|
310
|
-
var
|
|
315
|
+
var A = class e {
|
|
311
316
|
_stacks = {};
|
|
312
317
|
lang;
|
|
313
318
|
get themes() {
|
|
@@ -335,7 +340,7 @@ var k = class e {
|
|
|
335
340
|
return this._stacks[e];
|
|
336
341
|
}
|
|
337
342
|
getScopes(e = this.theme) {
|
|
338
|
-
return
|
|
343
|
+
return j(this._stacks[e]);
|
|
339
344
|
}
|
|
340
345
|
toJSON() {
|
|
341
346
|
return {
|
|
@@ -346,7 +351,7 @@ var k = class e {
|
|
|
346
351
|
};
|
|
347
352
|
}
|
|
348
353
|
};
|
|
349
|
-
function
|
|
354
|
+
function j(e) {
|
|
350
355
|
let t = [], n = /* @__PURE__ */ new Set();
|
|
351
356
|
function r(e) {
|
|
352
357
|
if (n.has(e)) return;
|
|
@@ -356,13 +361,14 @@ function A(e) {
|
|
|
356
361
|
}
|
|
357
362
|
return r(e), t;
|
|
358
363
|
}
|
|
359
|
-
function
|
|
360
|
-
if (!(t instanceof
|
|
364
|
+
function M(t, n) {
|
|
365
|
+
if (!(t instanceof A)) throw new e("Invalid grammar state");
|
|
361
366
|
return t.getInternalStack(n);
|
|
362
367
|
}
|
|
363
|
-
|
|
368
|
+
var N = /,/, P = / /;
|
|
369
|
+
function F(t, n, r = {}) {
|
|
364
370
|
let { theme: i = t.getLoadedThemes()[0] } = r;
|
|
365
|
-
if (l(t.resolveLangAlias(r.lang || "text")) || d(i)) return
|
|
371
|
+
if (l(t.resolveLangAlias(r.lang || "text")) || d(i)) return m(n).map((e) => [{
|
|
366
372
|
content: e[0],
|
|
367
373
|
offset: e[1]
|
|
368
374
|
}]);
|
|
@@ -371,22 +377,22 @@ function M(t, n, r = {}) {
|
|
|
371
377
|
if (r.grammarState.lang !== s.name) throw new e(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${s.name}"`);
|
|
372
378
|
if (!r.grammarState.themes.includes(a.name)) throw new e(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${a.name}"`);
|
|
373
379
|
}
|
|
374
|
-
return
|
|
380
|
+
return L(n, s, a, o, r);
|
|
375
381
|
}
|
|
376
|
-
function
|
|
377
|
-
if (t.length === 2) return
|
|
382
|
+
function I(...t) {
|
|
383
|
+
if (t.length === 2) return k(t[1]);
|
|
378
384
|
let [n, r, i = {}] = t, { lang: a = "text", theme: o = n.getLoadedThemes()[0] } = i;
|
|
379
385
|
if (l(a) || d(o)) throw new e("Plain language does not have grammar state");
|
|
380
386
|
if (a === "ansi") throw new e("ANSI language does not have grammar state");
|
|
381
387
|
let { theme: s, colorMap: c } = n.setTheme(o), u = n.getLanguage(a);
|
|
382
|
-
return new
|
|
388
|
+
return new A(R(r, u, s, c, i).stateStack, u.name, s.name);
|
|
383
389
|
}
|
|
384
|
-
function
|
|
385
|
-
let a =
|
|
386
|
-
return
|
|
390
|
+
function L(e, t, n, r, i) {
|
|
391
|
+
let a = R(e, t, n, r, i), o = new A(a.stateStack, t.name, n.name);
|
|
392
|
+
return O(a.tokens, o), a.tokens;
|
|
387
393
|
}
|
|
388
|
-
function
|
|
389
|
-
let l = a(i, c), { tokenizeMaxLineLength: u = 0, tokenizeTimeLimit: d = 500 } = c, f =
|
|
394
|
+
function R(e, r, i, s, c) {
|
|
395
|
+
let l = a(i, c), { tokenizeMaxLineLength: u = 0, tokenizeTimeLimit: d = 500 } = c, f = m(e), p = c.grammarState ? M(c.grammarState, i.name) ?? n : c.grammarContextCode == null ? n : R(c.grammarContextCode, r, i, s, {
|
|
390
396
|
...c,
|
|
391
397
|
grammarState: void 0,
|
|
392
398
|
grammarContextCode: void 0
|
|
@@ -406,9 +412,9 @@ function F(e, r, i, s, c) {
|
|
|
406
412
|
}]);
|
|
407
413
|
continue;
|
|
408
414
|
}
|
|
409
|
-
let
|
|
410
|
-
c.includeExplanation && (
|
|
411
|
-
let y = r.tokenizeLine2(n,
|
|
415
|
+
let m, _, v;
|
|
416
|
+
c.includeExplanation && (m = r.tokenizeLine(n, p, d), _ = m.tokens, v = 0);
|
|
417
|
+
let y = r.tokenizeLine2(n, p, d), b = y.tokens.length / 2;
|
|
412
418
|
for (let e = 0; e < b; e++) {
|
|
413
419
|
let r = y.tokens[2 * e], u = e + 1 < b ? y.tokens[2 * e + 2] : n.length;
|
|
414
420
|
if (r === u) continue;
|
|
@@ -424,7 +430,7 @@ function F(e, r, i, s, c) {
|
|
|
424
430
|
let n;
|
|
425
431
|
switch (typeof t.scope) {
|
|
426
432
|
case "string":
|
|
427
|
-
n = t.scope.split(
|
|
433
|
+
n = t.scope.split(N).map((e) => e.trim());
|
|
428
434
|
break;
|
|
429
435
|
case "object":
|
|
430
436
|
n = t.scope;
|
|
@@ -433,7 +439,7 @@ function F(e, r, i, s, c) {
|
|
|
433
439
|
}
|
|
434
440
|
e.push({
|
|
435
441
|
settings: t,
|
|
436
|
-
selectors: n.map((e) => e.split(
|
|
442
|
+
selectors: n.map((e) => e.split(P))
|
|
437
443
|
});
|
|
438
444
|
}
|
|
439
445
|
m.explanation = [];
|
|
@@ -442,51 +448,51 @@ function F(e, r, i, s, c) {
|
|
|
442
448
|
let r = _[v], i = n.substring(r.startIndex, r.endIndex);
|
|
443
449
|
t += i.length, m.explanation.push({
|
|
444
450
|
content: i,
|
|
445
|
-
scopes: c.includeExplanation === "scopeName" ?
|
|
451
|
+
scopes: c.includeExplanation === "scopeName" ? z(r.scopes) : B(e, r.scopes)
|
|
446
452
|
}), v += 1;
|
|
447
453
|
}
|
|
448
454
|
}
|
|
449
455
|
h.push(m);
|
|
450
456
|
}
|
|
451
|
-
g.push(h), h = [],
|
|
457
|
+
g.push(h), h = [], p = y.ruleStack;
|
|
452
458
|
}
|
|
453
459
|
return {
|
|
454
460
|
tokens: g,
|
|
455
|
-
stateStack:
|
|
461
|
+
stateStack: p
|
|
456
462
|
};
|
|
457
463
|
}
|
|
458
|
-
function
|
|
464
|
+
function z(e) {
|
|
459
465
|
return e.map((e) => ({ scopeName: e }));
|
|
460
466
|
}
|
|
461
|
-
function
|
|
467
|
+
function B(e, t) {
|
|
462
468
|
let n = [];
|
|
463
469
|
for (let r = 0, i = t.length; r < i; r++) {
|
|
464
470
|
let i = t[r];
|
|
465
471
|
n[r] = {
|
|
466
472
|
scopeName: i,
|
|
467
|
-
themeMatches:
|
|
473
|
+
themeMatches: U(e, i, t.slice(0, r))
|
|
468
474
|
};
|
|
469
475
|
}
|
|
470
476
|
return n;
|
|
471
477
|
}
|
|
472
|
-
function
|
|
478
|
+
function V(e, t) {
|
|
473
479
|
return e === t || t.substring(0, e.length) === e && t[e.length] === ".";
|
|
474
480
|
}
|
|
475
|
-
function
|
|
476
|
-
if (!
|
|
481
|
+
function H(e, t, n) {
|
|
482
|
+
if (!V(e.at(-1), t)) return !1;
|
|
477
483
|
let r = e.length - 2, i = n.length - 1;
|
|
478
|
-
for (; r >= 0 && i >= 0;)
|
|
484
|
+
for (; r >= 0 && i >= 0;) V(e[r], n[i]) && --r, --i;
|
|
479
485
|
return r === -1;
|
|
480
486
|
}
|
|
481
|
-
function
|
|
487
|
+
function U(e, t, n) {
|
|
482
488
|
let r = [];
|
|
483
|
-
for (let { selectors: i, settings: a } of e) for (let e of i) if (
|
|
489
|
+
for (let { selectors: i, settings: a } of e) for (let e of i) if (H(e, t, n)) {
|
|
484
490
|
r.push(a);
|
|
485
491
|
break;
|
|
486
492
|
}
|
|
487
493
|
return r;
|
|
488
494
|
}
|
|
489
|
-
function
|
|
495
|
+
function W(e, t, n, r = F) {
|
|
490
496
|
let i = Object.entries(n.themes).filter((e) => e[1]).map((e) => ({
|
|
491
497
|
color: e[0],
|
|
492
498
|
theme: e[1]
|
|
@@ -497,10 +503,10 @@ function V(e, t, n, r = M) {
|
|
|
497
503
|
});
|
|
498
504
|
return {
|
|
499
505
|
tokens: a,
|
|
500
|
-
state:
|
|
506
|
+
state: k(a),
|
|
501
507
|
theme: typeof i.theme == "string" ? i.theme : i.theme.name
|
|
502
508
|
};
|
|
503
|
-
}), o =
|
|
509
|
+
}), o = G(...a.map((e) => e.tokens)), s = o[0].map((e, t) => e.map((e, r) => {
|
|
504
510
|
let a = {
|
|
505
511
|
content: e.content,
|
|
506
512
|
variants: {},
|
|
@@ -510,10 +516,10 @@ function V(e, t, n, r = M) {
|
|
|
510
516
|
let { content: o, explanation: s, offset: c, ...l } = e[t][r];
|
|
511
517
|
a.variants[i[n].color] = l;
|
|
512
518
|
}), a;
|
|
513
|
-
})), c = a[0].state ? new
|
|
514
|
-
return c &&
|
|
519
|
+
})), c = a[0].state ? new A(Object.fromEntries(a.map((e) => [e.theme, e.state?.getInternalStack(e.theme)])), a[0].state.lang) : void 0;
|
|
520
|
+
return c && O(s, c), s;
|
|
515
521
|
}
|
|
516
|
-
function
|
|
522
|
+
function G(...e) {
|
|
517
523
|
let t = e.map(() => []), n = e.length;
|
|
518
524
|
for (let r = 0; r < e[0].length; r++) {
|
|
519
525
|
let i = e.map((e) => e[r]), a = t.map(() => []);
|
|
@@ -537,6 +543,6 @@ function H(...e) {
|
|
|
537
543
|
return t;
|
|
538
544
|
}
|
|
539
545
|
//#endregion
|
|
540
|
-
export { o as applyColorReplacements,
|
|
546
|
+
export { o as applyColorReplacements, F as codeToTokensBase, W as codeToTokensWithThemes, T as createShikiPrimitive, E as createShikiPrimitiveAsync, I as getLastGrammarState, k as getLastGrammarStateFromMap, d as isNoneTheme, l as isPlainLang, u as isSpecialLang, f as isSpecialTheme, c as normalizeGetter, v as normalizeTheme, a as resolveColorReplacements, O as setLastGrammarStateToMap, m as splitLines, s as toArray, L as tokenizeWithTheme };
|
|
541
547
|
|
|
542
548
|
//# sourceMappingURL=index.js.map
|