@pubinfo-pr/devtools 0.204.5 → 0.220.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{core-DZ0_U_pO.js → core-D6JqxgYq.js} +134 -133
- package/dist/client/assets/{engine-oniguruma-Cxk0otvy.js → engine-oniguruma-n-bafM3H.js} +8 -8
- package/dist/client/assets/{fetch-Df05JmPt.js → fetch-DxuBXEk3.js} +2 -3
- package/dist/client/assets/{index-Blntvu93.css → index-D7UL6pHD.css} +1 -1
- package/dist/client/assets/{index-Cn9-H915.js → index-DcEJJh1_.js} +1143 -1115
- package/dist/client/assets/{pages-BdQpgtx4.js → pages-CfWIiNIx.js} +2 -2
- package/dist/client/assets/{server-router-BHD-n_Wi.js → server-router-Bu5965f8.js} +14 -15
- package/dist/client/assets/vue-DZSPIjN6.js +27 -0
- package/dist/client/index.html +2 -2
- package/dist/constants.d.mts +1 -2
- package/dist/dirs.mjs +15 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.mjs +2 -2
- package/dist/panel/index.mjs +1 -3798
- package/package.json +20 -17
- package/dist/client/assets/vue-Be3tcD1h.js +0 -27
- package/dist/dirs2.mjs +0 -17
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __exportAll = (all, no_symbols) => {
|
|
3
3
|
let target = {};
|
|
4
|
-
for (var name in all
|
|
5
|
-
get: all
|
|
4
|
+
for (var name in all) __defProp(target, name, {
|
|
5
|
+
get: all[name],
|
|
6
6
|
enumerable: true
|
|
7
7
|
});
|
|
8
|
-
if (
|
|
8
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
9
9
|
return target;
|
|
10
10
|
};
|
|
11
11
|
var ShikiError = class extends Error {
|
|
@@ -30,12 +30,12 @@ function cloneArray(arr) {
|
|
|
30
30
|
}
|
|
31
31
|
function cloneObj(obj) {
|
|
32
32
|
let r = {};
|
|
33
|
-
for (let key
|
|
33
|
+
for (let key in obj) r[key] = doClone(obj[key]);
|
|
34
34
|
return r;
|
|
35
35
|
}
|
|
36
36
|
function mergeObjects(target, ...sources) {
|
|
37
37
|
sources.forEach((source) => {
|
|
38
|
-
for (let key
|
|
38
|
+
for (let key in source) target[key] = source[key];
|
|
39
39
|
});
|
|
40
40
|
return target;
|
|
41
41
|
}
|
|
@@ -102,10 +102,10 @@ var CachedFn = class {
|
|
|
102
102
|
this.fn = fn;
|
|
103
103
|
}
|
|
104
104
|
cache = /* @__PURE__ */ new Map();
|
|
105
|
-
get(key
|
|
106
|
-
if (this.cache.has(key
|
|
107
|
-
const value = this.fn(key
|
|
108
|
-
this.cache.set(key
|
|
105
|
+
get(key) {
|
|
106
|
+
if (this.cache.has(key)) return this.cache.get(key);
|
|
107
|
+
const value = this.fn(key);
|
|
108
|
+
this.cache.set(key, value);
|
|
109
109
|
return value;
|
|
110
110
|
}
|
|
111
111
|
};
|
|
@@ -301,12 +301,12 @@ function resolveParsedThemeRules(parsedThemeRules, _colorMap) {
|
|
|
301
301
|
}
|
|
302
302
|
let colorMap = new ColorMap(_colorMap);
|
|
303
303
|
let defaults = new StyleAttributes(defaultFontStyle, colorMap.getId(defaultForeground), colorMap.getId(defaultBackground));
|
|
304
|
-
let root
|
|
304
|
+
let root = new ThemeTrieElement(new ThemeTrieElementRule(0, null, -1, 0, 0), []);
|
|
305
305
|
for (let i = 0, len = parsedThemeRules.length; i < len; i++) {
|
|
306
306
|
let rule = parsedThemeRules[i];
|
|
307
|
-
root
|
|
307
|
+
root.insert(0, rule.scope, rule.parentScopes, rule.fontStyle, colorMap.getId(rule.foreground), colorMap.getId(rule.background));
|
|
308
308
|
}
|
|
309
|
-
return new Theme(colorMap, defaults, root
|
|
309
|
+
return new Theme(colorMap, defaults, root);
|
|
310
310
|
}
|
|
311
311
|
var ColorMap = class {
|
|
312
312
|
_isFrozen;
|
|
@@ -395,16 +395,16 @@ var ThemeTrieElement = class _ThemeTrieElement {
|
|
|
395
395
|
match(scope) {
|
|
396
396
|
if (scope !== "") {
|
|
397
397
|
let dotIndex = scope.indexOf(".");
|
|
398
|
-
let head
|
|
398
|
+
let head;
|
|
399
399
|
let tail;
|
|
400
400
|
if (dotIndex === -1) {
|
|
401
|
-
head
|
|
401
|
+
head = scope;
|
|
402
402
|
tail = "";
|
|
403
403
|
} else {
|
|
404
|
-
head
|
|
404
|
+
head = scope.substring(0, dotIndex);
|
|
405
405
|
tail = scope.substring(dotIndex + 1);
|
|
406
406
|
}
|
|
407
|
-
if (this._children.hasOwnProperty(head
|
|
407
|
+
if (this._children.hasOwnProperty(head)) return this._children[head].match(tail);
|
|
408
408
|
}
|
|
409
409
|
const rules = this._rulesWithParentScopes.concat(this._mainRule);
|
|
410
410
|
rules.sort(_ThemeTrieElement._cmpBySpecificity);
|
|
@@ -416,20 +416,20 @@ var ThemeTrieElement = class _ThemeTrieElement {
|
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
418
|
let dotIndex = scope.indexOf(".");
|
|
419
|
-
let head
|
|
419
|
+
let head;
|
|
420
420
|
let tail;
|
|
421
421
|
if (dotIndex === -1) {
|
|
422
|
-
head
|
|
422
|
+
head = scope;
|
|
423
423
|
tail = "";
|
|
424
424
|
} else {
|
|
425
|
-
head
|
|
425
|
+
head = scope.substring(0, dotIndex);
|
|
426
426
|
tail = scope.substring(dotIndex + 1);
|
|
427
427
|
}
|
|
428
428
|
let child;
|
|
429
|
-
if (this._children.hasOwnProperty(head
|
|
429
|
+
if (this._children.hasOwnProperty(head)) child = this._children[head];
|
|
430
430
|
else {
|
|
431
431
|
child = new _ThemeTrieElement(this._mainRule.clone(), ThemeTrieElementRule.cloneArr(this._rulesWithParentScopes));
|
|
432
|
-
this._children[head
|
|
432
|
+
this._children[head] = child;
|
|
433
433
|
}
|
|
434
434
|
child.insert(scopeDepth + 1, tail, parentScopes, fontStyle, foreground, background);
|
|
435
435
|
}
|
|
@@ -622,9 +622,9 @@ var ExternalReferenceCollector = class {
|
|
|
622
622
|
}
|
|
623
623
|
visitedRule = /* @__PURE__ */ new Set();
|
|
624
624
|
add(reference) {
|
|
625
|
-
const key
|
|
626
|
-
if (this._seenReferenceKeys.has(key
|
|
627
|
-
this._seenReferenceKeys.add(key
|
|
625
|
+
const key = reference.toKey();
|
|
626
|
+
if (this._seenReferenceKeys.has(key)) return;
|
|
627
|
+
this._seenReferenceKeys.add(key);
|
|
628
628
|
this._references.push(reference);
|
|
629
629
|
}
|
|
630
630
|
};
|
|
@@ -2294,7 +2294,7 @@ Info.prototype.overloadedBoolean = false;
|
|
|
2294
2294
|
Info.prototype.property = "";
|
|
2295
2295
|
Info.prototype.spaceSeparated = false;
|
|
2296
2296
|
Info.prototype.space = void 0;
|
|
2297
|
-
var types_exports = /* @__PURE__ */
|
|
2297
|
+
var types_exports = /* @__PURE__ */ __exportAll({
|
|
2298
2298
|
boolean: () => boolean,
|
|
2299
2299
|
booleanish: () => booleanish,
|
|
2300
2300
|
commaOrSpaceSeparated: () => commaOrSpaceSeparated,
|
|
@@ -2302,7 +2302,7 @@ var types_exports = /* @__PURE__ */ __export({
|
|
|
2302
2302
|
number: () => number,
|
|
2303
2303
|
overloadedBoolean: () => overloadedBoolean,
|
|
2304
2304
|
spaceSeparated: () => spaceSeparated
|
|
2305
|
-
}
|
|
2305
|
+
});
|
|
2306
2306
|
var powers = 0;
|
|
2307
2307
|
const boolean = increment();
|
|
2308
2308
|
const booleanish = increment();
|
|
@@ -2327,8 +2327,8 @@ var DefinedInfo = class extends Info {
|
|
|
2327
2327
|
}
|
|
2328
2328
|
};
|
|
2329
2329
|
DefinedInfo.prototype.defined = true;
|
|
2330
|
-
function mark(values, key
|
|
2331
|
-
if (value) values[key
|
|
2330
|
+
function mark(values, key, value) {
|
|
2331
|
+
if (value) values[key] = value;
|
|
2332
2332
|
}
|
|
2333
2333
|
function create(definition) {
|
|
2334
2334
|
const properties = {};
|
|
@@ -3350,21 +3350,21 @@ const svg = merge([
|
|
|
3350
3350
|
xml
|
|
3351
3351
|
], "svg");
|
|
3352
3352
|
var own$2 = {}.hasOwnProperty;
|
|
3353
|
-
function zwitch(key
|
|
3353
|
+
function zwitch(key, options) {
|
|
3354
3354
|
const settings = options || {};
|
|
3355
|
-
function one
|
|
3356
|
-
let fn = one
|
|
3357
|
-
const handlers = one
|
|
3358
|
-
if (value && own$2.call(value, key
|
|
3359
|
-
const id = String(value[key
|
|
3360
|
-
fn = own$2.call(handlers, id) ? handlers[id] : one
|
|
3355
|
+
function one(value, ...parameters) {
|
|
3356
|
+
let fn = one.invalid;
|
|
3357
|
+
const handlers = one.handlers;
|
|
3358
|
+
if (value && own$2.call(value, key)) {
|
|
3359
|
+
const id = String(value[key]);
|
|
3360
|
+
fn = own$2.call(handlers, id) ? handlers[id] : one.unknown;
|
|
3361
3361
|
}
|
|
3362
3362
|
if (fn) return fn.call(this, value, ...parameters);
|
|
3363
3363
|
}
|
|
3364
|
-
one
|
|
3365
|
-
one
|
|
3366
|
-
one
|
|
3367
|
-
return one
|
|
3364
|
+
one.handlers = settings.handlers || {};
|
|
3365
|
+
one.invalid = settings.invalid;
|
|
3366
|
+
one.unknown = settings.unknown;
|
|
3367
|
+
return one;
|
|
3368
3368
|
}
|
|
3369
3369
|
var defaultSubsetRegex = /["&'<>`]/g;
|
|
3370
3370
|
var surrogatePairsRegex = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
|
|
@@ -3375,11 +3375,11 @@ function core(value, options) {
|
|
|
3375
3375
|
value = value.replace(options.subset ? charactersToExpressionCached(options.subset) : defaultSubsetRegex, basic);
|
|
3376
3376
|
if (options.subset || options.escapeOnly) return value;
|
|
3377
3377
|
return value.replace(surrogatePairsRegex, surrogate).replace(controlCharactersRegex, basic);
|
|
3378
|
-
function surrogate(pair, index, all
|
|
3379
|
-
return options.format((pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536, all
|
|
3378
|
+
function surrogate(pair, index, all) {
|
|
3379
|
+
return options.format((pair.charCodeAt(0) - 55296) * 1024 + pair.charCodeAt(1) - 56320 + 65536, all.charCodeAt(index + 2), options);
|
|
3380
3380
|
}
|
|
3381
|
-
function basic(character, index, all
|
|
3382
|
-
return options.format(character.charCodeAt(0), all
|
|
3381
|
+
function basic(character, index, all) {
|
|
3382
|
+
return options.format(character.charCodeAt(0), all.charCodeAt(index + 1), options);
|
|
3383
3383
|
}
|
|
3384
3384
|
}
|
|
3385
3385
|
function charactersToExpressionCached(subset) {
|
|
@@ -3846,15 +3846,15 @@ function empty(value) {
|
|
|
3846
3846
|
const siblingAfter = siblings(1);
|
|
3847
3847
|
const siblingBefore = siblings(-1);
|
|
3848
3848
|
var emptyChildren$1 = [];
|
|
3849
|
-
function siblings(increment
|
|
3849
|
+
function siblings(increment) {
|
|
3850
3850
|
return sibling;
|
|
3851
3851
|
function sibling(parent, index, includeWhitespace) {
|
|
3852
|
-
const siblings
|
|
3853
|
-
let offset = (index || 0) + increment
|
|
3854
|
-
let next = siblings
|
|
3852
|
+
const siblings = parent ? parent.children : emptyChildren$1;
|
|
3853
|
+
let offset = (index || 0) + increment;
|
|
3854
|
+
let next = siblings[offset];
|
|
3855
3855
|
if (!includeWhitespace) while (next && whitespace(next)) {
|
|
3856
|
-
offset += increment
|
|
3857
|
-
next = siblings
|
|
3856
|
+
offset += increment;
|
|
3857
|
+
next = siblings[offset];
|
|
3858
3858
|
}
|
|
3859
3859
|
return next;
|
|
3860
3860
|
}
|
|
@@ -3954,33 +3954,33 @@ const opening = omission({
|
|
|
3954
3954
|
tbody
|
|
3955
3955
|
});
|
|
3956
3956
|
function html(node) {
|
|
3957
|
-
const head
|
|
3958
|
-
return !head
|
|
3957
|
+
const head = siblingAfter(node, -1);
|
|
3958
|
+
return !head || head.type !== "comment";
|
|
3959
3959
|
}
|
|
3960
3960
|
function head(node) {
|
|
3961
3961
|
const seen = /* @__PURE__ */ new Set();
|
|
3962
|
-
for (const child
|
|
3963
|
-
if (seen.has(child
|
|
3964
|
-
seen.add(child
|
|
3962
|
+
for (const child of node.children) if (child.type === "element" && (child.tagName === "base" || child.tagName === "title")) {
|
|
3963
|
+
if (seen.has(child.tagName)) return false;
|
|
3964
|
+
seen.add(child.tagName);
|
|
3965
3965
|
}
|
|
3966
3966
|
const child = node.children[0];
|
|
3967
3967
|
return !child || child.type === "element";
|
|
3968
3968
|
}
|
|
3969
3969
|
function body(node) {
|
|
3970
|
-
const head
|
|
3971
|
-
return !head
|
|
3970
|
+
const head = siblingAfter(node, -1, true);
|
|
3971
|
+
return !head || head.type !== "comment" && !(head.type === "text" && whitespace(head.value.charAt(0))) && !(head.type === "element" && (head.tagName === "meta" || head.tagName === "link" || head.tagName === "script" || head.tagName === "style" || head.tagName === "template"));
|
|
3972
3972
|
}
|
|
3973
3973
|
function colgroup(node, index, parent) {
|
|
3974
3974
|
const previous = siblingBefore(parent, index);
|
|
3975
|
-
const head
|
|
3975
|
+
const head = siblingAfter(node, -1, true);
|
|
3976
3976
|
if (parent && previous && previous.type === "element" && previous.tagName === "colgroup" && closing(previous, parent.children.indexOf(previous), parent)) return false;
|
|
3977
|
-
return Boolean(head
|
|
3977
|
+
return Boolean(head && head.type === "element" && head.tagName === "col");
|
|
3978
3978
|
}
|
|
3979
3979
|
function tbody(node, index, parent) {
|
|
3980
3980
|
const previous = siblingBefore(parent, index);
|
|
3981
|
-
const head
|
|
3981
|
+
const head = siblingAfter(node, -1);
|
|
3982
3982
|
if (parent && previous && previous.type === "element" && (previous.tagName === "thead" || previous.tagName === "tbody") && closing(previous, parent.children.indexOf(previous), parent)) return false;
|
|
3983
|
-
return Boolean(head
|
|
3983
|
+
return Boolean(head && head.type === "element" && head.tagName === "tr");
|
|
3984
3984
|
}
|
|
3985
3985
|
var constants = {
|
|
3986
3986
|
name: [[" \n\f\r &/=>".split(""), " \n\f\r \"&'/=>`".split("")], ["\0 \n\f\r \"&'/<=>".split(""), "\0 \n\f\r \"&'/<=>`".split("")]],
|
|
@@ -4015,10 +4015,10 @@ function element(node, index, parent, state) {
|
|
|
4015
4015
|
function serializeAttributes(state, properties) {
|
|
4016
4016
|
const values = [];
|
|
4017
4017
|
let index = -1;
|
|
4018
|
-
let key
|
|
4018
|
+
let key;
|
|
4019
4019
|
if (properties) {
|
|
4020
|
-
for (key
|
|
4021
|
-
const value = serializeAttribute(state, key
|
|
4020
|
+
for (key in properties) if (properties[key] !== null && properties[key] !== void 0) {
|
|
4021
|
+
const value = serializeAttribute(state, key, properties[key]);
|
|
4022
4022
|
if (value) values.push(value);
|
|
4023
4023
|
}
|
|
4024
4024
|
}
|
|
@@ -4028,8 +4028,8 @@ function serializeAttributes(state, properties) {
|
|
|
4028
4028
|
}
|
|
4029
4029
|
return values.join("");
|
|
4030
4030
|
}
|
|
4031
|
-
function serializeAttribute(state, key
|
|
4032
|
-
const info = find(state.schema, key
|
|
4031
|
+
function serializeAttribute(state, key, value) {
|
|
4032
|
+
const info = find(state.schema, key);
|
|
4033
4033
|
const x = state.settings.allowParseErrors && state.schema.space === "html" ? 0 : 1;
|
|
4034
4034
|
const y = state.settings.allowDangerousCharacters ? 0 : 1;
|
|
4035
4035
|
let quote = state.quote;
|
|
@@ -4134,8 +4134,8 @@ function all(parent) {
|
|
|
4134
4134
|
function resolveColorReplacements(theme, options) {
|
|
4135
4135
|
const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
|
|
4136
4136
|
const themeName = typeof theme === "string" ? theme : theme.name;
|
|
4137
|
-
for (const [key
|
|
4138
|
-
else if (key
|
|
4137
|
+
for (const [key, value] of Object.entries(options?.colorReplacements || {})) if (typeof value === "string") replacements[key] = value;
|
|
4138
|
+
else if (key === themeName) Object.assign(replacements, value);
|
|
4139
4139
|
return replacements;
|
|
4140
4140
|
}
|
|
4141
4141
|
function applyColorReplacements(color, replacements) {
|
|
@@ -4145,8 +4145,8 @@ function applyColorReplacements(color, replacements) {
|
|
|
4145
4145
|
function toArray(x) {
|
|
4146
4146
|
return Array.isArray(x) ? x : [x];
|
|
4147
4147
|
}
|
|
4148
|
-
async function normalizeGetter(p
|
|
4149
|
-
return Promise.resolve(typeof p
|
|
4148
|
+
async function normalizeGetter(p) {
|
|
4149
|
+
return Promise.resolve(typeof p === "function" ? p() : p).then((r) => r.default || r);
|
|
4150
4150
|
}
|
|
4151
4151
|
function isPlainLang(lang) {
|
|
4152
4152
|
return !lang || [
|
|
@@ -4282,21 +4282,21 @@ function flatTokenVariants(merged, variantsOrder, cssVariablePrefix, defaultColo
|
|
|
4282
4282
|
const styles = variantsOrder.map((t) => getTokenStyleObject(merged.variants[t]));
|
|
4283
4283
|
const styleKeys = new Set(styles.flatMap((t) => Object.keys(t)));
|
|
4284
4284
|
const mergedStyles = {};
|
|
4285
|
-
const varKey = (idx, key
|
|
4286
|
-
const keyName = key
|
|
4287
|
-
return cssVariablePrefix + variantsOrder[idx] + (key
|
|
4285
|
+
const varKey = (idx, key) => {
|
|
4286
|
+
const keyName = key === "color" ? "" : key === "background-color" ? "-bg" : `-${key}`;
|
|
4287
|
+
return cssVariablePrefix + variantsOrder[idx] + (key === "color" ? "" : keyName);
|
|
4288
4288
|
};
|
|
4289
4289
|
styles.forEach((cur, idx) => {
|
|
4290
|
-
for (const key
|
|
4291
|
-
const value = cur[key
|
|
4292
|
-
if (idx === 0 && defaultColor && COLOR_KEYS.includes(key
|
|
4290
|
+
for (const key of styleKeys) {
|
|
4291
|
+
const value = cur[key] || "inherit";
|
|
4292
|
+
if (idx === 0 && defaultColor && COLOR_KEYS.includes(key)) if (defaultColor === DEFAULT_COLOR_LIGHT_DARK && styles.length > 1) {
|
|
4293
4293
|
const lightIndex = variantsOrder.findIndex((t) => t === "light");
|
|
4294
4294
|
const darkIndex = variantsOrder.findIndex((t) => t === "dark");
|
|
4295
4295
|
if (lightIndex === -1 || darkIndex === -1) throw new ShikiError("When using `defaultColor: \"light-dark()\"`, you must provide both `light` and `dark` themes");
|
|
4296
|
-
mergedStyles[key
|
|
4297
|
-
if (colorsRendering === "css-vars") mergedStyles[varKey(idx, key
|
|
4298
|
-
} else mergedStyles[key
|
|
4299
|
-
else if (colorsRendering === "css-vars") mergedStyles[varKey(idx, key
|
|
4296
|
+
mergedStyles[key] = `light-dark(${styles[lightIndex][key] || "inherit"}, ${styles[darkIndex][key] || "inherit"})`;
|
|
4297
|
+
if (colorsRendering === "css-vars") mergedStyles[varKey(idx, key)] = value;
|
|
4298
|
+
} else mergedStyles[key] = value;
|
|
4299
|
+
else if (colorsRendering === "css-vars") mergedStyles[varKey(idx, key)] = value;
|
|
4300
4300
|
}
|
|
4301
4301
|
});
|
|
4302
4302
|
token.htmlStyle = mergedStyles;
|
|
@@ -4309,16 +4309,16 @@ function getTokenStyleObject(token) {
|
|
|
4309
4309
|
if (token.fontStyle) {
|
|
4310
4310
|
if (token.fontStyle & FontStyle.Italic) styles["font-style"] = "italic";
|
|
4311
4311
|
if (token.fontStyle & FontStyle.Bold) styles["font-weight"] = "bold";
|
|
4312
|
-
const decorations
|
|
4313
|
-
if (token.fontStyle & FontStyle.Underline) decorations
|
|
4314
|
-
if (token.fontStyle & FontStyle.Strikethrough) decorations
|
|
4315
|
-
if (decorations
|
|
4312
|
+
const decorations = [];
|
|
4313
|
+
if (token.fontStyle & FontStyle.Underline) decorations.push("underline");
|
|
4314
|
+
if (token.fontStyle & FontStyle.Strikethrough) decorations.push("line-through");
|
|
4315
|
+
if (decorations.length) styles["text-decoration"] = decorations.join(" ");
|
|
4316
4316
|
}
|
|
4317
4317
|
return styles;
|
|
4318
4318
|
}
|
|
4319
4319
|
function stringifyTokenStyle(token) {
|
|
4320
4320
|
if (typeof token === "string") return token;
|
|
4321
|
-
return Object.entries(token).map(([key
|
|
4321
|
+
return Object.entries(token).map(([key, value]) => `${key}:${value}`).join(";");
|
|
4322
4322
|
}
|
|
4323
4323
|
var _grammarStateMap = /* @__PURE__ */ new WeakMap();
|
|
4324
4324
|
function setLastGrammarStateToMap(keys, state) {
|
|
@@ -4389,35 +4389,35 @@ function transformerDecorations() {
|
|
|
4389
4389
|
const map = /* @__PURE__ */ new WeakMap();
|
|
4390
4390
|
function getContext(shiki) {
|
|
4391
4391
|
if (!map.has(shiki.meta)) {
|
|
4392
|
-
let normalizePosition = function(p
|
|
4393
|
-
if (typeof p
|
|
4394
|
-
if (p
|
|
4392
|
+
let normalizePosition = function(p) {
|
|
4393
|
+
if (typeof p === "number") {
|
|
4394
|
+
if (p < 0 || p > shiki.source.length) throw new ShikiError(`Invalid decoration offset: ${p}. Code length: ${shiki.source.length}`);
|
|
4395
4395
|
return {
|
|
4396
|
-
...converter.indexToPos(p
|
|
4397
|
-
offset: p
|
|
4396
|
+
...converter.indexToPos(p),
|
|
4397
|
+
offset: p
|
|
4398
4398
|
};
|
|
4399
4399
|
} else {
|
|
4400
|
-
const line = converter.lines[p
|
|
4401
|
-
if (line === void 0) throw new ShikiError(`Invalid decoration position ${JSON.stringify(p
|
|
4402
|
-
let character = p
|
|
4400
|
+
const line = converter.lines[p.line];
|
|
4401
|
+
if (line === void 0) throw new ShikiError(`Invalid decoration position ${JSON.stringify(p)}. Lines length: ${converter.lines.length}`);
|
|
4402
|
+
let character = p.character;
|
|
4403
4403
|
if (character < 0) character = line.length + character;
|
|
4404
|
-
if (character < 0 || character > line.length) throw new ShikiError(`Invalid decoration position ${JSON.stringify(p
|
|
4404
|
+
if (character < 0 || character > line.length) throw new ShikiError(`Invalid decoration position ${JSON.stringify(p)}. Line ${p.line} length: ${line.length}`);
|
|
4405
4405
|
return {
|
|
4406
|
-
...p
|
|
4406
|
+
...p,
|
|
4407
4407
|
character,
|
|
4408
|
-
offset: converter.posToIndex(p
|
|
4408
|
+
offset: converter.posToIndex(p.line, character)
|
|
4409
4409
|
};
|
|
4410
4410
|
}
|
|
4411
4411
|
};
|
|
4412
4412
|
const converter = createPositionConverter(shiki.source);
|
|
4413
|
-
const decorations
|
|
4413
|
+
const decorations = (shiki.options.decorations || []).map((d) => ({
|
|
4414
4414
|
...d,
|
|
4415
4415
|
start: normalizePosition(d.start),
|
|
4416
4416
|
end: normalizePosition(d.end)
|
|
4417
4417
|
}));
|
|
4418
|
-
verifyIntersections(decorations
|
|
4418
|
+
verifyIntersections(decorations);
|
|
4419
4419
|
map.set(shiki.meta, {
|
|
4420
|
-
decorations
|
|
4420
|
+
decorations,
|
|
4421
4421
|
converter,
|
|
4422
4422
|
source: shiki.source
|
|
4423
4423
|
});
|
|
@@ -4437,16 +4437,16 @@ function transformerDecorations() {
|
|
|
4437
4437
|
if (lines.length !== ctx.converter.lines.length) throw new ShikiError(`Number of lines in code element (${lines.length}) does not match the number of lines in the source (${ctx.converter.lines.length}). Failed to apply decorations.`);
|
|
4438
4438
|
function applyLineSection(line, start, end, decoration) {
|
|
4439
4439
|
const lineEl = lines[line];
|
|
4440
|
-
let text
|
|
4440
|
+
let text = "";
|
|
4441
4441
|
let startIndex = -1;
|
|
4442
4442
|
let endIndex = -1;
|
|
4443
4443
|
if (start === 0) startIndex = 0;
|
|
4444
4444
|
if (end === 0) endIndex = 0;
|
|
4445
4445
|
if (end === Number.POSITIVE_INFINITY) endIndex = lineEl.children.length;
|
|
4446
4446
|
if (startIndex === -1 || endIndex === -1) for (let i = 0; i < lineEl.children.length; i++) {
|
|
4447
|
-
text
|
|
4448
|
-
if (startIndex === -1 && text
|
|
4449
|
-
if (endIndex === -1 && text
|
|
4447
|
+
text += stringify(lineEl.children[i]);
|
|
4448
|
+
if (startIndex === -1 && text.length === start) startIndex = i + 1;
|
|
4449
|
+
if (endIndex === -1 && text.length === end) endIndex = i + 1;
|
|
4450
4450
|
}
|
|
4451
4451
|
if (startIndex === -1) throw new ShikiError(`Failed to find start index for decoration ${JSON.stringify(decoration.start)}`);
|
|
4452
4452
|
if (endIndex === -1) throw new ShikiError(`Failed to find end index for decoration ${JSON.stringify(decoration.end)}`);
|
|
@@ -4694,9 +4694,9 @@ function createAnsiSequenceParser() {
|
|
|
4694
4694
|
let position = 0;
|
|
4695
4695
|
do {
|
|
4696
4696
|
const findResult = findSequence(value, position);
|
|
4697
|
-
const text
|
|
4698
|
-
if (text
|
|
4699
|
-
value: text
|
|
4697
|
+
const text = findResult.sequence ? value.substring(position, findResult.startPosition) : value.substring(position);
|
|
4698
|
+
if (text.length > 0) tokens.push({
|
|
4699
|
+
value: text,
|
|
4700
4700
|
foreground,
|
|
4701
4701
|
background,
|
|
4702
4702
|
decorations: new Set(decorations2)
|
|
@@ -4804,8 +4804,8 @@ function tokenizeAnsiWithTheme(theme, fileContents, options) {
|
|
|
4804
4804
|
const colorReplacements = resolveColorReplacements(theme, options);
|
|
4805
4805
|
const lines = splitLines(fileContents);
|
|
4806
4806
|
const colorPalette = createColorPalette(Object.fromEntries(namedColors.map((name) => {
|
|
4807
|
-
const key
|
|
4808
|
-
return [name, theme.colors?.[key
|
|
4807
|
+
const key = `terminal.ansi${name[0].toUpperCase()}${name.substring(1)}`;
|
|
4808
|
+
return [name, theme.colors?.[key] || defaultAnsiColors[name]];
|
|
4809
4809
|
})));
|
|
4810
4810
|
const parser = createAnsiSequenceParser();
|
|
4811
4811
|
return lines.map((line) => parser.parse(line[0]).map((token) => {
|
|
@@ -5180,7 +5180,7 @@ function codeToHast(internal, code, options, transformerContext = {
|
|
|
5180
5180
|
function tokensToHast(tokens, options, transformerContext, grammarState = getLastGrammarStateFromMap(tokens)) {
|
|
5181
5181
|
const transformers = getTransformers(options);
|
|
5182
5182
|
const lines = [];
|
|
5183
|
-
const root
|
|
5183
|
+
const root = {
|
|
5184
5184
|
type: "root",
|
|
5185
5185
|
children: []
|
|
5186
5186
|
};
|
|
@@ -5189,12 +5189,13 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5189
5189
|
if (options.rootStyle !== false) if (options.rootStyle != null) properties.style = options.rootStyle;
|
|
5190
5190
|
else properties.style = `background-color:${options.bg};color:${options.fg}`;
|
|
5191
5191
|
if (tabindex !== false && tabindex != null) properties.tabindex = tabindex.toString();
|
|
5192
|
-
for (const [key
|
|
5192
|
+
for (const [key, value] of Object.entries(options.meta || {})) if (!key.startsWith("_")) properties[key] = value;
|
|
5193
5193
|
let preNode = {
|
|
5194
5194
|
type: "element",
|
|
5195
5195
|
tagName: "pre",
|
|
5196
5196
|
properties,
|
|
5197
|
-
children: []
|
|
5197
|
+
children: [],
|
|
5198
|
+
data: options.data
|
|
5198
5199
|
};
|
|
5199
5200
|
let codeNode = {
|
|
5200
5201
|
type: "element",
|
|
@@ -5217,7 +5218,7 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5217
5218
|
return options;
|
|
5218
5219
|
},
|
|
5219
5220
|
get root() {
|
|
5220
|
-
return root
|
|
5221
|
+
return root;
|
|
5221
5222
|
},
|
|
5222
5223
|
get pre() {
|
|
5223
5224
|
return preNode;
|
|
@@ -5231,7 +5232,7 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5231
5232
|
};
|
|
5232
5233
|
tokens.forEach((line, idx) => {
|
|
5233
5234
|
if (idx) {
|
|
5234
|
-
if (structure === "inline") root
|
|
5235
|
+
if (structure === "inline") root.children.push({
|
|
5235
5236
|
type: "element",
|
|
5236
5237
|
tagName: "br",
|
|
5237
5238
|
properties: {},
|
|
@@ -5262,7 +5263,7 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5262
5263
|
const style = stringifyTokenStyle(token.htmlStyle || getTokenStyleObject(token));
|
|
5263
5264
|
if (style) tokenNode.properties.style = style;
|
|
5264
5265
|
for (const transformer of transformers) tokenNode = transformer?.span?.call(context, tokenNode, idx + 1, col, lineNode, token) || tokenNode;
|
|
5265
|
-
if (structure === "inline") root
|
|
5266
|
+
if (structure === "inline") root.children.push(tokenNode);
|
|
5266
5267
|
else if (structure === "classic") lineNode.children.push(tokenNode);
|
|
5267
5268
|
col += token.content.length;
|
|
5268
5269
|
}
|
|
@@ -5276,7 +5277,7 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5276
5277
|
for (const transformer of transformers) codeNode = transformer?.code?.call(context, codeNode) || codeNode;
|
|
5277
5278
|
preNode.children.push(codeNode);
|
|
5278
5279
|
for (const transformer of transformers) preNode = transformer?.pre?.call(context, preNode) || preNode;
|
|
5279
|
-
root
|
|
5280
|
+
root.children.push(preNode);
|
|
5280
5281
|
} else if (structure === "inline") {
|
|
5281
5282
|
const syntheticLines = [];
|
|
5282
5283
|
let currentLine = {
|
|
@@ -5285,7 +5286,7 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5285
5286
|
properties: { class: "line" },
|
|
5286
5287
|
children: []
|
|
5287
5288
|
};
|
|
5288
|
-
for (const child of root
|
|
5289
|
+
for (const child of root.children) if (child.type === "element" && child.tagName === "br") {
|
|
5289
5290
|
syntheticLines.push(currentLine);
|
|
5290
5291
|
currentLine = {
|
|
5291
5292
|
type: "element",
|
|
@@ -5302,19 +5303,19 @@ function tokensToHast(tokens, options, transformerContext, grammarState = getLas
|
|
|
5302
5303
|
children: syntheticLines
|
|
5303
5304
|
};
|
|
5304
5305
|
for (const transformer of transformers) transformedCode = transformer?.code?.call(context, transformedCode) || transformedCode;
|
|
5305
|
-
root
|
|
5306
|
+
root.children = [];
|
|
5306
5307
|
for (let i = 0; i < transformedCode.children.length; i++) {
|
|
5307
|
-
if (i > 0) root
|
|
5308
|
+
if (i > 0) root.children.push({
|
|
5308
5309
|
type: "element",
|
|
5309
5310
|
tagName: "br",
|
|
5310
5311
|
properties: {},
|
|
5311
5312
|
children: []
|
|
5312
5313
|
});
|
|
5313
5314
|
const line = transformedCode.children[i];
|
|
5314
|
-
if (line.type === "element") root
|
|
5315
|
+
if (line.type === "element") root.children.push(...line.children);
|
|
5315
5316
|
}
|
|
5316
5317
|
}
|
|
5317
|
-
let result = root
|
|
5318
|
+
let result = root;
|
|
5318
5319
|
for (const transformer of transformers) result = transformer?.root?.call(context, result) || result;
|
|
5319
5320
|
if (grammarState) setLastGrammarStateToMap(result, grammarState);
|
|
5320
5321
|
return result;
|
|
@@ -5451,27 +5452,27 @@ function normalizeTheme(rawTheme) {
|
|
|
5451
5452
|
const replaceFg = setting.settings?.foreground && !setting.settings.foreground.startsWith("#");
|
|
5452
5453
|
const replaceBg = setting.settings?.background && !setting.settings.background.startsWith("#");
|
|
5453
5454
|
if (!replaceFg && !replaceBg) return setting;
|
|
5454
|
-
const clone
|
|
5455
|
+
const clone = {
|
|
5455
5456
|
...setting,
|
|
5456
5457
|
settings: { ...setting.settings }
|
|
5457
5458
|
};
|
|
5458
5459
|
if (replaceFg) {
|
|
5459
5460
|
const replacement = getReplacementColor(setting.settings.foreground);
|
|
5460
5461
|
theme.colorReplacements[replacement] = setting.settings.foreground;
|
|
5461
|
-
clone
|
|
5462
|
+
clone.settings.foreground = replacement;
|
|
5462
5463
|
}
|
|
5463
5464
|
if (replaceBg) {
|
|
5464
5465
|
const replacement = getReplacementColor(setting.settings.background);
|
|
5465
5466
|
theme.colorReplacements[replacement] = setting.settings.background;
|
|
5466
|
-
clone
|
|
5467
|
+
clone.settings.background = replacement;
|
|
5467
5468
|
}
|
|
5468
|
-
return clone
|
|
5469
|
+
return clone;
|
|
5469
5470
|
});
|
|
5470
|
-
for (const key
|
|
5471
|
-
if (!theme.colors[key
|
|
5472
|
-
const replacement = getReplacementColor(theme.colors[key
|
|
5473
|
-
theme.colorReplacements[replacement] = theme.colors[key
|
|
5474
|
-
theme.colors[key
|
|
5471
|
+
for (const key of Object.keys(theme.colors || {})) if (key === "editor.foreground" || key === "editor.background" || key.startsWith("terminal.ansi")) {
|
|
5472
|
+
if (!theme.colors[key]?.startsWith("#")) {
|
|
5473
|
+
const replacement = getReplacementColor(theme.colors[key]);
|
|
5474
|
+
theme.colorReplacements[replacement] = theme.colors[key];
|
|
5475
|
+
theme.colors[key] = replacement;
|
|
5475
5476
|
}
|
|
5476
5477
|
}
|
|
5477
5478
|
Object.defineProperty(theme, RESOLVED_KEY, {
|
|
@@ -5841,19 +5842,19 @@ function createBundledHighlighter(options) {
|
|
|
5841
5842
|
}
|
|
5842
5843
|
const _themes = (options2.themes ?? []).map((i) => resolveTheme(i));
|
|
5843
5844
|
const langs = (options2.langs ?? []).map((i) => resolveLang(i));
|
|
5844
|
-
const core
|
|
5845
|
+
const core = await createHighlighterCore({
|
|
5845
5846
|
engine: options2.engine ?? engine(),
|
|
5846
5847
|
...options2,
|
|
5847
5848
|
themes: _themes,
|
|
5848
5849
|
langs
|
|
5849
5850
|
});
|
|
5850
5851
|
return {
|
|
5851
|
-
...core
|
|
5852
|
+
...core,
|
|
5852
5853
|
loadLanguage(...langs2) {
|
|
5853
|
-
return core
|
|
5854
|
+
return core.loadLanguage(...langs2.map(resolveLang));
|
|
5854
5855
|
},
|
|
5855
5856
|
loadTheme(...themes) {
|
|
5856
|
-
return core
|
|
5857
|
+
return core.loadTheme(...themes.map(resolveTheme));
|
|
5857
5858
|
},
|
|
5858
5859
|
getBundledLanguages() {
|
|
5859
5860
|
return bundledLanguages;
|
|
@@ -205,9 +205,9 @@ var UtfString = class UtfString {
|
|
|
205
205
|
return result;
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
var _OnigString = class _OnigString
|
|
208
|
+
var _OnigString = class _OnigString {
|
|
209
209
|
constructor(str) {
|
|
210
|
-
__publicField(this, "id", ++_OnigString
|
|
210
|
+
__publicField(this, "id", ++_OnigString.LAST_ID);
|
|
211
211
|
__publicField(this, "_onigBinding");
|
|
212
212
|
__publicField(this, "content");
|
|
213
213
|
__publicField(this, "utf16Length");
|
|
@@ -223,11 +223,11 @@ var _OnigString = class _OnigString$1 {
|
|
|
223
223
|
this.utf8Length = utfString.utf8Length;
|
|
224
224
|
this.utf16OffsetToUtf8 = utfString.utf16OffsetToUtf8;
|
|
225
225
|
this.utf8OffsetToUtf16 = utfString.utf8OffsetToUtf16;
|
|
226
|
-
if (this.utf8Length < 1e4 && !_OnigString
|
|
227
|
-
if (!_OnigString
|
|
228
|
-
_OnigString
|
|
229
|
-
onigBinding.HEAPU8.set(utfString.utf8Value, _OnigString
|
|
230
|
-
this.ptr = _OnigString
|
|
226
|
+
if (this.utf8Length < 1e4 && !_OnigString._sharedPtrInUse) {
|
|
227
|
+
if (!_OnigString._sharedPtr) _OnigString._sharedPtr = onigBinding.omalloc(1e4);
|
|
228
|
+
_OnigString._sharedPtrInUse = true;
|
|
229
|
+
onigBinding.HEAPU8.set(utfString.utf8Value, _OnigString._sharedPtr);
|
|
230
|
+
this.ptr = _OnigString._sharedPtr;
|
|
231
231
|
} else this.ptr = utfString.createString(onigBinding);
|
|
232
232
|
}
|
|
233
233
|
convertUtf8OffsetToUtf16(utf8Offset) {
|
|
@@ -247,7 +247,7 @@ var _OnigString = class _OnigString$1 {
|
|
|
247
247
|
return utf16Offset;
|
|
248
248
|
}
|
|
249
249
|
dispose() {
|
|
250
|
-
if (this.ptr === _OnigString
|
|
250
|
+
if (this.ptr === _OnigString._sharedPtr) _OnigString._sharedPtrInUse = false;
|
|
251
251
|
else this._onigBinding.ofree(this.ptr);
|
|
252
252
|
}
|
|
253
253
|
};
|