@halo-dev/shiki-code-element 1.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.
- package/LICENSE +674 -0
- package/README.md +108 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1021 -0
- package/dist/shiki-code.d.ts +37 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/utils/copy-to-clipboard.d.ts +1 -0
- package/dist/variants/base.d.ts +8 -0
- package/dist/variants/mac.d.ts +11 -0
- package/dist/variants/simple.d.ts +10 -0
- package/package.json +39 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1021 @@
|
|
|
1
|
+
const J = '*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}';
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
const O = globalThis, K = O.ShadowRoot && (O.ShadyCSS === void 0 || O.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, Z = Symbol(), st = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
let gt = class {
|
|
9
|
+
constructor(t, e, i) {
|
|
10
|
+
if (this._$cssResult$ = !0, i !== Z) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
11
|
+
this.cssText = t, this.t = e;
|
|
12
|
+
}
|
|
13
|
+
get styleSheet() {
|
|
14
|
+
let t = this.o;
|
|
15
|
+
const e = this.t;
|
|
16
|
+
if (K && t === void 0) {
|
|
17
|
+
const i = e !== void 0 && e.length === 1;
|
|
18
|
+
i && (t = st.get(e)), t === void 0 && ((this.o = t = new CSSStyleSheet()).replaceSync(this.cssText), i && st.set(e, t));
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
toString() {
|
|
23
|
+
return this.cssText;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const C = (s) => new gt(typeof s == "string" ? s : s + "", void 0, Z), G = (s, ...t) => {
|
|
27
|
+
const e = s.length === 1 ? s[0] : t.reduce(((i, n, r) => i + ((o) => {
|
|
28
|
+
if (o._$cssResult$ === !0) return o.cssText;
|
|
29
|
+
if (typeof o == "number") return o;
|
|
30
|
+
throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
|
31
|
+
})(n) + s[r + 1]), s[0]);
|
|
32
|
+
return new gt(e, s, Z);
|
|
33
|
+
}, kt = (s, t) => {
|
|
34
|
+
if (K) s.adoptedStyleSheets = t.map(((e) => e instanceof CSSStyleSheet ? e : e.styleSheet));
|
|
35
|
+
else for (const e of t) {
|
|
36
|
+
const i = document.createElement("style"), n = O.litNonce;
|
|
37
|
+
n !== void 0 && i.setAttribute("nonce", n), i.textContent = e.cssText, s.appendChild(i);
|
|
38
|
+
}
|
|
39
|
+
}, rt = K ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((t) => {
|
|
40
|
+
let e = "";
|
|
41
|
+
for (const i of t.cssRules) e += i.cssText;
|
|
42
|
+
return C(e);
|
|
43
|
+
})(s) : s;
|
|
44
|
+
/**
|
|
45
|
+
* @license
|
|
46
|
+
* Copyright 2017 Google LLC
|
|
47
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
|
+
*/
|
|
49
|
+
const { is: _t, defineProperty: xt, getOwnPropertyDescriptor: At, getOwnPropertyNames: Ct, getOwnPropertySymbols: Et, getPrototypeOf: zt } = Object, D = globalThis, ot = D.trustedTypes, St = ot ? ot.emptyScript : "", Tt = D.reactiveElementPolyfillSupport, T = (s, t) => s, j = { toAttribute(s, t) {
|
|
50
|
+
switch (t) {
|
|
51
|
+
case Boolean:
|
|
52
|
+
s = s ? St : null;
|
|
53
|
+
break;
|
|
54
|
+
case Object:
|
|
55
|
+
case Array:
|
|
56
|
+
s = s == null ? s : JSON.stringify(s);
|
|
57
|
+
}
|
|
58
|
+
return s;
|
|
59
|
+
}, fromAttribute(s, t) {
|
|
60
|
+
let e = s;
|
|
61
|
+
switch (t) {
|
|
62
|
+
case Boolean:
|
|
63
|
+
e = s !== null;
|
|
64
|
+
break;
|
|
65
|
+
case Number:
|
|
66
|
+
e = s === null ? null : Number(s);
|
|
67
|
+
break;
|
|
68
|
+
case Object:
|
|
69
|
+
case Array:
|
|
70
|
+
try {
|
|
71
|
+
e = JSON.parse(s);
|
|
72
|
+
} catch {
|
|
73
|
+
e = null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return e;
|
|
77
|
+
} }, Q = (s, t) => !_t(s, t), at = { attribute: !0, type: String, converter: j, reflect: !1, useDefault: !1, hasChanged: Q };
|
|
78
|
+
Symbol.metadata ??= Symbol("metadata"), D.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
79
|
+
let x = class extends HTMLElement {
|
|
80
|
+
static addInitializer(t) {
|
|
81
|
+
this._$Ei(), (this.l ??= []).push(t);
|
|
82
|
+
}
|
|
83
|
+
static get observedAttributes() {
|
|
84
|
+
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
85
|
+
}
|
|
86
|
+
static createProperty(t, e = at) {
|
|
87
|
+
if (e.state && (e.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(t) && ((e = Object.create(e)).wrapped = !0), this.elementProperties.set(t, e), !e.noAccessor) {
|
|
88
|
+
const i = Symbol(), n = this.getPropertyDescriptor(t, i, e);
|
|
89
|
+
n !== void 0 && xt(this.prototype, t, n);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
static getPropertyDescriptor(t, e, i) {
|
|
93
|
+
const { get: n, set: r } = At(this.prototype, t) ?? { get() {
|
|
94
|
+
return this[e];
|
|
95
|
+
}, set(o) {
|
|
96
|
+
this[e] = o;
|
|
97
|
+
} };
|
|
98
|
+
return { get: n, set(o) {
|
|
99
|
+
const l = n?.call(this);
|
|
100
|
+
r?.call(this, o), this.requestUpdate(t, l, i);
|
|
101
|
+
}, configurable: !0, enumerable: !0 };
|
|
102
|
+
}
|
|
103
|
+
static getPropertyOptions(t) {
|
|
104
|
+
return this.elementProperties.get(t) ?? at;
|
|
105
|
+
}
|
|
106
|
+
static _$Ei() {
|
|
107
|
+
if (this.hasOwnProperty(T("elementProperties"))) return;
|
|
108
|
+
const t = zt(this);
|
|
109
|
+
t.finalize(), t.l !== void 0 && (this.l = [...t.l]), this.elementProperties = new Map(t.elementProperties);
|
|
110
|
+
}
|
|
111
|
+
static finalize() {
|
|
112
|
+
if (this.hasOwnProperty(T("finalized"))) return;
|
|
113
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(T("properties"))) {
|
|
114
|
+
const e = this.properties, i = [...Ct(e), ...Et(e)];
|
|
115
|
+
for (const n of i) this.createProperty(n, e[n]);
|
|
116
|
+
}
|
|
117
|
+
const t = this[Symbol.metadata];
|
|
118
|
+
if (t !== null) {
|
|
119
|
+
const e = litPropertyMetadata.get(t);
|
|
120
|
+
if (e !== void 0) for (const [i, n] of e) this.elementProperties.set(i, n);
|
|
121
|
+
}
|
|
122
|
+
this._$Eh = /* @__PURE__ */ new Map();
|
|
123
|
+
for (const [e, i] of this.elementProperties) {
|
|
124
|
+
const n = this._$Eu(e, i);
|
|
125
|
+
n !== void 0 && this._$Eh.set(n, e);
|
|
126
|
+
}
|
|
127
|
+
this.elementStyles = this.finalizeStyles(this.styles);
|
|
128
|
+
}
|
|
129
|
+
static finalizeStyles(t) {
|
|
130
|
+
const e = [];
|
|
131
|
+
if (Array.isArray(t)) {
|
|
132
|
+
const i = new Set(t.flat(1 / 0).reverse());
|
|
133
|
+
for (const n of i) e.unshift(rt(n));
|
|
134
|
+
} else t !== void 0 && e.push(rt(t));
|
|
135
|
+
return e;
|
|
136
|
+
}
|
|
137
|
+
static _$Eu(t, e) {
|
|
138
|
+
const i = e.attribute;
|
|
139
|
+
return i === !1 ? void 0 : typeof i == "string" ? i : typeof t == "string" ? t.toLowerCase() : void 0;
|
|
140
|
+
}
|
|
141
|
+
constructor() {
|
|
142
|
+
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
143
|
+
}
|
|
144
|
+
_$Ev() {
|
|
145
|
+
this._$ES = new Promise(((t) => this.enableUpdating = t)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t) => t(this)));
|
|
146
|
+
}
|
|
147
|
+
addController(t) {
|
|
148
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(t), this.renderRoot !== void 0 && this.isConnected && t.hostConnected?.();
|
|
149
|
+
}
|
|
150
|
+
removeController(t) {
|
|
151
|
+
this._$EO?.delete(t);
|
|
152
|
+
}
|
|
153
|
+
_$E_() {
|
|
154
|
+
const t = /* @__PURE__ */ new Map(), e = this.constructor.elementProperties;
|
|
155
|
+
for (const i of e.keys()) this.hasOwnProperty(i) && (t.set(i, this[i]), delete this[i]);
|
|
156
|
+
t.size > 0 && (this._$Ep = t);
|
|
157
|
+
}
|
|
158
|
+
createRenderRoot() {
|
|
159
|
+
const t = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
160
|
+
return kt(t, this.constructor.elementStyles), t;
|
|
161
|
+
}
|
|
162
|
+
connectedCallback() {
|
|
163
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((t) => t.hostConnected?.()));
|
|
164
|
+
}
|
|
165
|
+
enableUpdating(t) {
|
|
166
|
+
}
|
|
167
|
+
disconnectedCallback() {
|
|
168
|
+
this._$EO?.forEach(((t) => t.hostDisconnected?.()));
|
|
169
|
+
}
|
|
170
|
+
attributeChangedCallback(t, e, i) {
|
|
171
|
+
this._$AK(t, i);
|
|
172
|
+
}
|
|
173
|
+
_$ET(t, e) {
|
|
174
|
+
const i = this.constructor.elementProperties.get(t), n = this.constructor._$Eu(t, i);
|
|
175
|
+
if (n !== void 0 && i.reflect === !0) {
|
|
176
|
+
const r = (i.converter?.toAttribute !== void 0 ? i.converter : j).toAttribute(e, i.type);
|
|
177
|
+
this._$Em = t, r == null ? this.removeAttribute(n) : this.setAttribute(n, r), this._$Em = null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
_$AK(t, e) {
|
|
181
|
+
const i = this.constructor, n = i._$Eh.get(t);
|
|
182
|
+
if (n !== void 0 && this._$Em !== n) {
|
|
183
|
+
const r = i.getPropertyOptions(n), o = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute !== void 0 ? r.converter : j;
|
|
184
|
+
this._$Em = n;
|
|
185
|
+
const l = o.fromAttribute(e, r.type);
|
|
186
|
+
this[n] = l ?? this._$Ej?.get(n) ?? l, this._$Em = null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
requestUpdate(t, e, i) {
|
|
190
|
+
if (t !== void 0) {
|
|
191
|
+
const n = this.constructor, r = this[t];
|
|
192
|
+
if (i ??= n.getPropertyOptions(t), !((i.hasChanged ?? Q)(r, e) || i.useDefault && i.reflect && r === this._$Ej?.get(t) && !this.hasAttribute(n._$Eu(t, i)))) return;
|
|
193
|
+
this.C(t, e, i);
|
|
194
|
+
}
|
|
195
|
+
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
196
|
+
}
|
|
197
|
+
C(t, e, { useDefault: i, reflect: n, wrapped: r }, o) {
|
|
198
|
+
i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t) && (this._$Ej.set(t, o ?? e ?? this[t]), r !== !0 || o !== void 0) || (this._$AL.has(t) || (this.hasUpdated || i || (e = void 0), this._$AL.set(t, e)), n === !0 && this._$Em !== t && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t));
|
|
199
|
+
}
|
|
200
|
+
async _$EP() {
|
|
201
|
+
this.isUpdatePending = !0;
|
|
202
|
+
try {
|
|
203
|
+
await this._$ES;
|
|
204
|
+
} catch (e) {
|
|
205
|
+
Promise.reject(e);
|
|
206
|
+
}
|
|
207
|
+
const t = this.scheduleUpdate();
|
|
208
|
+
return t != null && await t, !this.isUpdatePending;
|
|
209
|
+
}
|
|
210
|
+
scheduleUpdate() {
|
|
211
|
+
return this.performUpdate();
|
|
212
|
+
}
|
|
213
|
+
performUpdate() {
|
|
214
|
+
if (!this.isUpdatePending) return;
|
|
215
|
+
if (!this.hasUpdated) {
|
|
216
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
217
|
+
for (const [n, r] of this._$Ep) this[n] = r;
|
|
218
|
+
this._$Ep = void 0;
|
|
219
|
+
}
|
|
220
|
+
const i = this.constructor.elementProperties;
|
|
221
|
+
if (i.size > 0) for (const [n, r] of i) {
|
|
222
|
+
const { wrapped: o } = r, l = this[n];
|
|
223
|
+
o !== !0 || this._$AL.has(n) || l === void 0 || this.C(n, void 0, r, l);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
let t = !1;
|
|
227
|
+
const e = this._$AL;
|
|
228
|
+
try {
|
|
229
|
+
t = this.shouldUpdate(e), t ? (this.willUpdate(e), this._$EO?.forEach(((i) => i.hostUpdate?.())), this.update(e)) : this._$EM();
|
|
230
|
+
} catch (i) {
|
|
231
|
+
throw t = !1, this._$EM(), i;
|
|
232
|
+
}
|
|
233
|
+
t && this._$AE(e);
|
|
234
|
+
}
|
|
235
|
+
willUpdate(t) {
|
|
236
|
+
}
|
|
237
|
+
_$AE(t) {
|
|
238
|
+
this._$EO?.forEach(((e) => e.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(t)), this.updated(t);
|
|
239
|
+
}
|
|
240
|
+
_$EM() {
|
|
241
|
+
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
242
|
+
}
|
|
243
|
+
get updateComplete() {
|
|
244
|
+
return this.getUpdateComplete();
|
|
245
|
+
}
|
|
246
|
+
getUpdateComplete() {
|
|
247
|
+
return this._$ES;
|
|
248
|
+
}
|
|
249
|
+
shouldUpdate(t) {
|
|
250
|
+
return !0;
|
|
251
|
+
}
|
|
252
|
+
update(t) {
|
|
253
|
+
this._$Eq &&= this._$Eq.forEach(((e) => this._$ET(e, this[e]))), this._$EM();
|
|
254
|
+
}
|
|
255
|
+
updated(t) {
|
|
256
|
+
}
|
|
257
|
+
firstUpdated(t) {
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
x.elementStyles = [], x.shadowRootOptions = { mode: "open" }, x[T("elementProperties")] = /* @__PURE__ */ new Map(), x[T("finalized")] = /* @__PURE__ */ new Map(), Tt?.({ ReactiveElement: x }), (D.reactiveElementVersions ??= []).push("2.1.1");
|
|
261
|
+
/**
|
|
262
|
+
* @license
|
|
263
|
+
* Copyright 2017 Google LLC
|
|
264
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
265
|
+
*/
|
|
266
|
+
const X = globalThis, L = X.trustedTypes, lt = L ? L.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, mt = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, ft = "?" + v, Pt = `<${ft}>`, k = document, P = () => k.createComment(""), M = (s) => s === null || typeof s != "object" && typeof s != "function", Y = Array.isArray, Mt = (s) => Y(s) || typeof s?.[Symbol.iterator] == "function", F = `[
|
|
267
|
+
\f\r]`, S = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ht = /-->/g, ct = />/g, $ = RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^
|
|
268
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ut = /'/g, dt = /"/g, bt = /^(?:script|style|textarea|title)$/i, Nt = (s) => (t, ...e) => ({ _$litType$: s, strings: t, values: e }), g = Nt(1), _ = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), pt = /* @__PURE__ */ new WeakMap(), w = k.createTreeWalker(k, 129);
|
|
269
|
+
function yt(s, t) {
|
|
270
|
+
if (!Y(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
271
|
+
return lt !== void 0 ? lt.createHTML(t) : t;
|
|
272
|
+
}
|
|
273
|
+
const Ut = (s, t) => {
|
|
274
|
+
const e = s.length - 1, i = [];
|
|
275
|
+
let n, r = t === 2 ? "<svg>" : t === 3 ? "<math>" : "", o = S;
|
|
276
|
+
for (let l = 0; l < e; l++) {
|
|
277
|
+
const a = s[l];
|
|
278
|
+
let u, p, h = -1, b = 0;
|
|
279
|
+
for (; b < a.length && (o.lastIndex = b, p = o.exec(a), p !== null); ) b = o.lastIndex, o === S ? p[1] === "!--" ? o = ht : p[1] !== void 0 ? o = ct : p[2] !== void 0 ? (bt.test(p[2]) && (n = RegExp("</" + p[2], "g")), o = $) : p[3] !== void 0 && (o = $) : o === $ ? p[0] === ">" ? (o = n ?? S, h = -1) : p[1] === void 0 ? h = -2 : (h = o.lastIndex - p[2].length, u = p[1], o = p[3] === void 0 ? $ : p[3] === '"' ? dt : ut) : o === dt || o === ut ? o = $ : o === ht || o === ct ? o = S : (o = $, n = void 0);
|
|
280
|
+
const y = o === $ && s[l + 1].startsWith("/>") ? " " : "";
|
|
281
|
+
r += o === S ? a + Pt : h >= 0 ? (i.push(u), a.slice(0, h) + mt + a.slice(h) + v + y) : a + v + (h === -2 ? l : y);
|
|
282
|
+
}
|
|
283
|
+
return [yt(s, r + (s[e] || "<?>") + (t === 2 ? "</svg>" : t === 3 ? "</math>" : "")), i];
|
|
284
|
+
};
|
|
285
|
+
class N {
|
|
286
|
+
constructor({ strings: t, _$litType$: e }, i) {
|
|
287
|
+
let n;
|
|
288
|
+
this.parts = [];
|
|
289
|
+
let r = 0, o = 0;
|
|
290
|
+
const l = t.length - 1, a = this.parts, [u, p] = Ut(t, e);
|
|
291
|
+
if (this.el = N.createElement(u, i), w.currentNode = this.el.content, e === 2 || e === 3) {
|
|
292
|
+
const h = this.el.content.firstChild;
|
|
293
|
+
h.replaceWith(...h.childNodes);
|
|
294
|
+
}
|
|
295
|
+
for (; (n = w.nextNode()) !== null && a.length < l; ) {
|
|
296
|
+
if (n.nodeType === 1) {
|
|
297
|
+
if (n.hasAttributes()) for (const h of n.getAttributeNames()) if (h.endsWith(mt)) {
|
|
298
|
+
const b = p[o++], y = n.getAttribute(h).split(v), H = /([.?@])?(.*)/.exec(b);
|
|
299
|
+
a.push({ type: 1, index: r, name: H[2], strings: y, ctor: H[1] === "." ? Ot : H[1] === "?" ? Rt : H[1] === "@" ? jt : q }), n.removeAttribute(h);
|
|
300
|
+
} else h.startsWith(v) && (a.push({ type: 6, index: r }), n.removeAttribute(h));
|
|
301
|
+
if (bt.test(n.tagName)) {
|
|
302
|
+
const h = n.textContent.split(v), b = h.length - 1;
|
|
303
|
+
if (b > 0) {
|
|
304
|
+
n.textContent = L ? L.emptyScript : "";
|
|
305
|
+
for (let y = 0; y < b; y++) n.append(h[y], P()), w.nextNode(), a.push({ type: 2, index: ++r });
|
|
306
|
+
n.append(h[b], P());
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
} else if (n.nodeType === 8) if (n.data === ft) a.push({ type: 2, index: r });
|
|
310
|
+
else {
|
|
311
|
+
let h = -1;
|
|
312
|
+
for (; (h = n.data.indexOf(v, h + 1)) !== -1; ) a.push({ type: 7, index: r }), h += v.length - 1;
|
|
313
|
+
}
|
|
314
|
+
r++;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
static createElement(t, e) {
|
|
318
|
+
const i = k.createElement("template");
|
|
319
|
+
return i.innerHTML = t, i;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
function E(s, t, e = s, i) {
|
|
323
|
+
if (t === _) return t;
|
|
324
|
+
let n = i !== void 0 ? e._$Co?.[i] : e._$Cl;
|
|
325
|
+
const r = M(t) ? void 0 : t._$litDirective$;
|
|
326
|
+
return n?.constructor !== r && (n?._$AO?.(!1), r === void 0 ? n = void 0 : (n = new r(s), n._$AT(s, e, i)), i !== void 0 ? (e._$Co ??= [])[i] = n : e._$Cl = n), n !== void 0 && (t = E(s, n._$AS(s, t.values), n, i)), t;
|
|
327
|
+
}
|
|
328
|
+
class Ht {
|
|
329
|
+
constructor(t, e) {
|
|
330
|
+
this._$AV = [], this._$AN = void 0, this._$AD = t, this._$AM = e;
|
|
331
|
+
}
|
|
332
|
+
get parentNode() {
|
|
333
|
+
return this._$AM.parentNode;
|
|
334
|
+
}
|
|
335
|
+
get _$AU() {
|
|
336
|
+
return this._$AM._$AU;
|
|
337
|
+
}
|
|
338
|
+
u(t) {
|
|
339
|
+
const { el: { content: e }, parts: i } = this._$AD, n = (t?.creationScope ?? k).importNode(e, !0);
|
|
340
|
+
w.currentNode = n;
|
|
341
|
+
let r = w.nextNode(), o = 0, l = 0, a = i[0];
|
|
342
|
+
for (; a !== void 0; ) {
|
|
343
|
+
if (o === a.index) {
|
|
344
|
+
let u;
|
|
345
|
+
a.type === 2 ? u = new U(r, r.nextSibling, this, t) : a.type === 1 ? u = new a.ctor(r, a.name, a.strings, this, t) : a.type === 6 && (u = new Lt(r, this, t)), this._$AV.push(u), a = i[++l];
|
|
346
|
+
}
|
|
347
|
+
o !== a?.index && (r = w.nextNode(), o++);
|
|
348
|
+
}
|
|
349
|
+
return w.currentNode = k, n;
|
|
350
|
+
}
|
|
351
|
+
p(t) {
|
|
352
|
+
let e = 0;
|
|
353
|
+
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(t, i, e), e += i.strings.length - 2) : i._$AI(t[e])), e++;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
class U {
|
|
357
|
+
get _$AU() {
|
|
358
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
359
|
+
}
|
|
360
|
+
constructor(t, e, i, n) {
|
|
361
|
+
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = t, this._$AB = e, this._$AM = i, this.options = n, this._$Cv = n?.isConnected ?? !0;
|
|
362
|
+
}
|
|
363
|
+
get parentNode() {
|
|
364
|
+
let t = this._$AA.parentNode;
|
|
365
|
+
const e = this._$AM;
|
|
366
|
+
return e !== void 0 && t?.nodeType === 11 && (t = e.parentNode), t;
|
|
367
|
+
}
|
|
368
|
+
get startNode() {
|
|
369
|
+
return this._$AA;
|
|
370
|
+
}
|
|
371
|
+
get endNode() {
|
|
372
|
+
return this._$AB;
|
|
373
|
+
}
|
|
374
|
+
_$AI(t, e = this) {
|
|
375
|
+
t = E(this, t, e), M(t) ? t === c || t == null || t === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : t !== this._$AH && t !== _ && this._(t) : t._$litType$ !== void 0 ? this.$(t) : t.nodeType !== void 0 ? this.T(t) : Mt(t) ? this.k(t) : this._(t);
|
|
376
|
+
}
|
|
377
|
+
O(t) {
|
|
378
|
+
return this._$AA.parentNode.insertBefore(t, this._$AB);
|
|
379
|
+
}
|
|
380
|
+
T(t) {
|
|
381
|
+
this._$AH !== t && (this._$AR(), this._$AH = this.O(t));
|
|
382
|
+
}
|
|
383
|
+
_(t) {
|
|
384
|
+
this._$AH !== c && M(this._$AH) ? this._$AA.nextSibling.data = t : this.T(k.createTextNode(t)), this._$AH = t;
|
|
385
|
+
}
|
|
386
|
+
$(t) {
|
|
387
|
+
const { values: e, _$litType$: i } = t, n = typeof i == "number" ? this._$AC(t) : (i.el === void 0 && (i.el = N.createElement(yt(i.h, i.h[0]), this.options)), i);
|
|
388
|
+
if (this._$AH?._$AD === n) this._$AH.p(e);
|
|
389
|
+
else {
|
|
390
|
+
const r = new Ht(n, this), o = r.u(this.options);
|
|
391
|
+
r.p(e), this.T(o), this._$AH = r;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
_$AC(t) {
|
|
395
|
+
let e = pt.get(t.strings);
|
|
396
|
+
return e === void 0 && pt.set(t.strings, e = new N(t)), e;
|
|
397
|
+
}
|
|
398
|
+
k(t) {
|
|
399
|
+
Y(this._$AH) || (this._$AH = [], this._$AR());
|
|
400
|
+
const e = this._$AH;
|
|
401
|
+
let i, n = 0;
|
|
402
|
+
for (const r of t) n === e.length ? e.push(i = new U(this.O(P()), this.O(P()), this, this.options)) : i = e[n], i._$AI(r), n++;
|
|
403
|
+
n < e.length && (this._$AR(i && i._$AB.nextSibling, n), e.length = n);
|
|
404
|
+
}
|
|
405
|
+
_$AR(t = this._$AA.nextSibling, e) {
|
|
406
|
+
for (this._$AP?.(!1, !0, e); t !== this._$AB; ) {
|
|
407
|
+
const i = t.nextSibling;
|
|
408
|
+
t.remove(), t = i;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
setConnected(t) {
|
|
412
|
+
this._$AM === void 0 && (this._$Cv = t, this._$AP?.(t));
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
class q {
|
|
416
|
+
get tagName() {
|
|
417
|
+
return this.element.tagName;
|
|
418
|
+
}
|
|
419
|
+
get _$AU() {
|
|
420
|
+
return this._$AM._$AU;
|
|
421
|
+
}
|
|
422
|
+
constructor(t, e, i, n, r) {
|
|
423
|
+
this.type = 1, this._$AH = c, this._$AN = void 0, this.element = t, this.name = e, this._$AM = n, this.options = r, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = c;
|
|
424
|
+
}
|
|
425
|
+
_$AI(t, e = this, i, n) {
|
|
426
|
+
const r = this.strings;
|
|
427
|
+
let o = !1;
|
|
428
|
+
if (r === void 0) t = E(this, t, e, 0), o = !M(t) || t !== this._$AH && t !== _, o && (this._$AH = t);
|
|
429
|
+
else {
|
|
430
|
+
const l = t;
|
|
431
|
+
let a, u;
|
|
432
|
+
for (t = r[0], a = 0; a < r.length - 1; a++) u = E(this, l[i + a], e, a), u === _ && (u = this._$AH[a]), o ||= !M(u) || u !== this._$AH[a], u === c ? t = c : t !== c && (t += (u ?? "") + r[a + 1]), this._$AH[a] = u;
|
|
433
|
+
}
|
|
434
|
+
o && !n && this.j(t);
|
|
435
|
+
}
|
|
436
|
+
j(t) {
|
|
437
|
+
t === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t ?? "");
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
class Ot extends q {
|
|
441
|
+
constructor() {
|
|
442
|
+
super(...arguments), this.type = 3;
|
|
443
|
+
}
|
|
444
|
+
j(t) {
|
|
445
|
+
this.element[this.name] = t === c ? void 0 : t;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
class Rt extends q {
|
|
449
|
+
constructor() {
|
|
450
|
+
super(...arguments), this.type = 4;
|
|
451
|
+
}
|
|
452
|
+
j(t) {
|
|
453
|
+
this.element.toggleAttribute(this.name, !!t && t !== c);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
class jt extends q {
|
|
457
|
+
constructor(t, e, i, n, r) {
|
|
458
|
+
super(t, e, i, n, r), this.type = 5;
|
|
459
|
+
}
|
|
460
|
+
_$AI(t, e = this) {
|
|
461
|
+
if ((t = E(this, t, e, 0) ?? c) === _) return;
|
|
462
|
+
const i = this._$AH, n = t === c && i !== c || t.capture !== i.capture || t.once !== i.once || t.passive !== i.passive, r = t !== c && (i === c || n);
|
|
463
|
+
n && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, t), this._$AH = t;
|
|
464
|
+
}
|
|
465
|
+
handleEvent(t) {
|
|
466
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, t) : this._$AH.handleEvent(t);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
class Lt {
|
|
470
|
+
constructor(t, e, i) {
|
|
471
|
+
this.element = t, this.type = 6, this._$AN = void 0, this._$AM = e, this.options = i;
|
|
472
|
+
}
|
|
473
|
+
get _$AU() {
|
|
474
|
+
return this._$AM._$AU;
|
|
475
|
+
}
|
|
476
|
+
_$AI(t) {
|
|
477
|
+
E(this, t);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
const Bt = X.litHtmlPolyfillSupport;
|
|
481
|
+
Bt?.(N, U), (X.litHtmlVersions ??= []).push("3.3.1");
|
|
482
|
+
const Dt = (s, t, e) => {
|
|
483
|
+
const i = e?.renderBefore ?? t;
|
|
484
|
+
let n = i._$litPart$;
|
|
485
|
+
if (n === void 0) {
|
|
486
|
+
const r = e?.renderBefore ?? null;
|
|
487
|
+
i._$litPart$ = n = new U(t.insertBefore(P(), r), r, void 0, e ?? {});
|
|
488
|
+
}
|
|
489
|
+
return n._$AI(s), n;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* @license
|
|
493
|
+
* Copyright 2017 Google LLC
|
|
494
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
495
|
+
*/
|
|
496
|
+
const tt = globalThis;
|
|
497
|
+
let A = class extends x {
|
|
498
|
+
constructor() {
|
|
499
|
+
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
|
500
|
+
}
|
|
501
|
+
createRenderRoot() {
|
|
502
|
+
const t = super.createRenderRoot();
|
|
503
|
+
return this.renderOptions.renderBefore ??= t.firstChild, t;
|
|
504
|
+
}
|
|
505
|
+
update(t) {
|
|
506
|
+
const e = this.render();
|
|
507
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t), this._$Do = Dt(e, this.renderRoot, this.renderOptions);
|
|
508
|
+
}
|
|
509
|
+
connectedCallback() {
|
|
510
|
+
super.connectedCallback(), this._$Do?.setConnected(!0);
|
|
511
|
+
}
|
|
512
|
+
disconnectedCallback() {
|
|
513
|
+
super.disconnectedCallback(), this._$Do?.setConnected(!1);
|
|
514
|
+
}
|
|
515
|
+
render() {
|
|
516
|
+
return _;
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
A._$litElement$ = !0, A.finalized = !0, tt.litElementHydrateSupport?.({ LitElement: A });
|
|
520
|
+
const qt = tt.litElementPolyfillSupport;
|
|
521
|
+
qt?.({ LitElement: A });
|
|
522
|
+
(tt.litElementVersions ??= []).push("4.2.1");
|
|
523
|
+
/**
|
|
524
|
+
* @license
|
|
525
|
+
* Copyright 2017 Google LLC
|
|
526
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
527
|
+
*/
|
|
528
|
+
const It = { attribute: !0, type: String, converter: j, reflect: !1, hasChanged: Q }, Ft = (s = It, t, e) => {
|
|
529
|
+
const { kind: i, metadata: n } = e;
|
|
530
|
+
let r = globalThis.litPropertyMetadata.get(n);
|
|
531
|
+
if (r === void 0 && globalThis.litPropertyMetadata.set(n, r = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), r.set(e.name, s), i === "accessor") {
|
|
532
|
+
const { name: o } = e;
|
|
533
|
+
return { set(l) {
|
|
534
|
+
const a = t.get.call(this);
|
|
535
|
+
t.set.call(this, l), this.requestUpdate(o, a, s);
|
|
536
|
+
}, init(l) {
|
|
537
|
+
return l !== void 0 && this.C(o, void 0, s, l), l;
|
|
538
|
+
} };
|
|
539
|
+
}
|
|
540
|
+
if (i === "setter") {
|
|
541
|
+
const { name: o } = e;
|
|
542
|
+
return function(l) {
|
|
543
|
+
const a = this[o];
|
|
544
|
+
t.call(this, l), this.requestUpdate(o, a, s);
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
throw Error("Unsupported decorator location: " + i);
|
|
548
|
+
};
|
|
549
|
+
function z(s) {
|
|
550
|
+
return (t, e) => typeof e == "object" ? Ft(s, t, e) : ((i, n, r) => {
|
|
551
|
+
const o = n.hasOwnProperty(r);
|
|
552
|
+
return n.constructor.createProperty(r, i), o ? Object.getOwnPropertyDescriptor(n, r) : void 0;
|
|
553
|
+
})(s, t, e);
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* @license
|
|
557
|
+
* Copyright 2017 Google LLC
|
|
558
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
559
|
+
*/
|
|
560
|
+
function f(s) {
|
|
561
|
+
return z({ ...s, state: !0, attribute: !1 });
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* @license
|
|
565
|
+
* Copyright 2017 Google LLC
|
|
566
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
567
|
+
*/
|
|
568
|
+
const Vt = { CHILD: 2 }, Wt = (s) => (...t) => ({ _$litDirective$: s, values: t });
|
|
569
|
+
class Jt {
|
|
570
|
+
constructor(t) {
|
|
571
|
+
}
|
|
572
|
+
get _$AU() {
|
|
573
|
+
return this._$AM._$AU;
|
|
574
|
+
}
|
|
575
|
+
_$AT(t, e, i) {
|
|
576
|
+
this._$Ct = t, this._$AM = e, this._$Ci = i;
|
|
577
|
+
}
|
|
578
|
+
_$AS(t, e) {
|
|
579
|
+
return this.update(t, e);
|
|
580
|
+
}
|
|
581
|
+
update(t, e) {
|
|
582
|
+
return this.render(...e);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* @license
|
|
587
|
+
* Copyright 2017 Google LLC
|
|
588
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
589
|
+
*/
|
|
590
|
+
class V extends Jt {
|
|
591
|
+
constructor(t) {
|
|
592
|
+
if (super(t), this.it = c, t.type !== Vt.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
593
|
+
}
|
|
594
|
+
render(t) {
|
|
595
|
+
if (t === c || t == null) return this._t = void 0, this.it = t;
|
|
596
|
+
if (t === _) return t;
|
|
597
|
+
if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
598
|
+
if (t === this.it) return this._t;
|
|
599
|
+
this.it = t;
|
|
600
|
+
const e = [t];
|
|
601
|
+
return e.raw = e, this._t = { _$litType$: this.constructor.resultType, strings: e, values: [] };
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
V.directiveName = "unsafeHTML", V.resultType = 1;
|
|
605
|
+
const vt = Wt(V);
|
|
606
|
+
/**
|
|
607
|
+
* @license
|
|
608
|
+
* Copyright 2021 Google LLC
|
|
609
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
610
|
+
*/
|
|
611
|
+
function R(s, t, e) {
|
|
612
|
+
return s ? t(s) : e?.(s);
|
|
613
|
+
}
|
|
614
|
+
const $t = '.shiki{padding:.875em;overflow-x:auto;color-scheme:var(--shiki-theme-type, light)}code{z-index:0;display:block;width:max-content;position:relative;min-width:100%;font-size:var(--font-size, .875em)}code{counter-reset:step;counter-increment:step 0}code .line:before{content:counter(step);counter-increment:step;width:1rem;margin-right:1.5rem;display:inline-block;text-align:right;color:#738a9480}code .line:last-child:empty:before{content:none;counter-increment:none}.has-diff .diff,.has-highlighted .highlighted{width:100%;display:inline-block;position:relative}.has-diff .diff.remove:before{content:"-"}.has-diff .diff.add:before{content:"+"}.has-diff .diff.remove:after{content:"";position:absolute;top:0;bottom:0;left:-1rem;right:-1rem;background:#ef444426;border-left:1px solid rgb(239 68 68 / .8);z-index:-1}.has-diff .diff.add:after{content:"";position:absolute;top:0;bottom:0;left:-1rem;right:-1rem;background:#22c55e26;border-left:1px solid rgb(34 197 94 / .8);z-index:-1}.has-focused .line:not(.focused){opacity:.7;filter:blur(.095rem);transition:filter .35s,opacity .35s}.has-focused:hover .line:not(.focused){opacity:1;filter:blur(0)}.has-highlighted .highlighted:after{content:"";position:absolute;top:0;bottom:0;left:-1rem;right:-1rem;background:#65758529;border-left:1px solid rgba(34,197,94,.8);z-index:-1}.has-highlighted .highlighted.error:after{background:#f43f5e29!important}.has-highlighted .highlighted.warning:after{background:#eab30829!important}:host([color-scheme="dark"]) .shiki,:host([color-scheme="dark"]) .shiki span{color:var(--shiki-dark)!important}:host([color-scheme="dark"]) .shiki{background-color:var(--shiki-dark-bg)!important}';
|
|
615
|
+
function Kt(s, t) {
|
|
616
|
+
if (navigator.clipboard)
|
|
617
|
+
navigator.clipboard.writeText(s).then(() => {
|
|
618
|
+
t();
|
|
619
|
+
});
|
|
620
|
+
else {
|
|
621
|
+
const e = document.createElement("textarea");
|
|
622
|
+
e.value = s, e.style.position = "fixed", e.style.opacity = "0", document.body.appendChild(e), e.focus(), e.select();
|
|
623
|
+
try {
|
|
624
|
+
document.execCommand("copy") && t();
|
|
625
|
+
} catch (i) {
|
|
626
|
+
console.error("Fallback: Oops, unable to copy", i);
|
|
627
|
+
}
|
|
628
|
+
document.body.removeChild(e);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
var Zt = Object.defineProperty, wt = (s, t, e, i) => {
|
|
632
|
+
for (var n = void 0, r = s.length - 1, o; r >= 0; r--)
|
|
633
|
+
(o = s[r]) && (n = o(t, e, n) || n);
|
|
634
|
+
return n && Zt(t, e, n), n;
|
|
635
|
+
};
|
|
636
|
+
class I extends A {
|
|
637
|
+
constructor() {
|
|
638
|
+
super(...arguments), this.options = {
|
|
639
|
+
html: "",
|
|
640
|
+
code: "",
|
|
641
|
+
languageName: "Unknown",
|
|
642
|
+
colorScheme: "light",
|
|
643
|
+
theme: null,
|
|
644
|
+
fontSize: "0.875em"
|
|
645
|
+
}, this.copied = !1;
|
|
646
|
+
}
|
|
647
|
+
updated(t) {
|
|
648
|
+
t.has("options") && (this.setAttribute("color-scheme", this.options.colorScheme), this.style.setProperty(
|
|
649
|
+
"--shiki-theme-type",
|
|
650
|
+
this.options.theme?.type || "light"
|
|
651
|
+
), this.style.setProperty("--font-size", this.options.fontSize || "0.875em"));
|
|
652
|
+
}
|
|
653
|
+
handleCopyCode() {
|
|
654
|
+
Kt(this.options.code, () => {
|
|
655
|
+
this.copied = !0, setTimeout(() => {
|
|
656
|
+
this.copied = !1;
|
|
657
|
+
}, 2e3);
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
wt([
|
|
662
|
+
z({ type: Object })
|
|
663
|
+
], I.prototype, "options");
|
|
664
|
+
wt([
|
|
665
|
+
f()
|
|
666
|
+
], I.prototype, "copied");
|
|
667
|
+
const et = class et extends I {
|
|
668
|
+
render() {
|
|
669
|
+
return g`
|
|
670
|
+
<div class="shadow rounded-lg relative group">
|
|
671
|
+
${vt(this.options.html)}
|
|
672
|
+
<div
|
|
673
|
+
class="absolute select-none top-1 text-xs right-2 group-hover:opacity-0 transition-opacity"
|
|
674
|
+
style="color: ${this.options.theme?.fg}"
|
|
675
|
+
>
|
|
676
|
+
${this.options.languageName}
|
|
677
|
+
</div>
|
|
678
|
+
<button
|
|
679
|
+
class="opacity-0 z-2 select-none group-hover:opacity-100 transition-opacity absolute top-2 rounded right-2 size-8 inline-flex items-center justify-center"
|
|
680
|
+
style="background-color: ${this.options.theme?.bg};"
|
|
681
|
+
@click=${this.handleCopyCode}
|
|
682
|
+
tabindex="-1"
|
|
683
|
+
>
|
|
684
|
+
${R(
|
|
685
|
+
this.copied,
|
|
686
|
+
() => g`<i class="i-tabler-check block" style="color: ${this.options.theme?.fg}"></i>`,
|
|
687
|
+
() => g`<i class="i-tabler-copy block" style="color: ${this.options.theme?.fg}"></i>`
|
|
688
|
+
)}
|
|
689
|
+
</button>
|
|
690
|
+
</div>
|
|
691
|
+
`;
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
et.styles = [
|
|
695
|
+
C(J),
|
|
696
|
+
C($t),
|
|
697
|
+
G`
|
|
698
|
+
.shiki {
|
|
699
|
+
border-radius: inherit;
|
|
700
|
+
}
|
|
701
|
+
/* layer: preflights */
|
|
702
|
+
*,::before,::after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}
|
|
703
|
+
/* layer: icons */
|
|
704
|
+
.i-tabler-check{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5 12l5 5L20 7'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
|
|
705
|
+
.i-tabler-copy{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z'/%3E%3Cpath d='M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
|
|
706
|
+
/* layer: default */
|
|
707
|
+
.absolute{position:absolute;}
|
|
708
|
+
.relative{position:relative;}
|
|
709
|
+
.static{position:static;}
|
|
710
|
+
.right-2{right:0.5rem;}
|
|
711
|
+
.top-1{top:0.25rem;}
|
|
712
|
+
.top-2{top:0.5rem;}
|
|
713
|
+
.z-2{z-index:2;}
|
|
714
|
+
.block{display:block;}
|
|
715
|
+
.size-8{width:2rem;height:2rem;}
|
|
716
|
+
.inline-flex{display:inline-flex;}
|
|
717
|
+
.select-none{-webkit-user-select:none;user-select:none;}
|
|
718
|
+
.items-center{align-items:center;}
|
|
719
|
+
.justify-center{justify-content:center;}
|
|
720
|
+
.rounded{border-radius:0.25rem;}
|
|
721
|
+
.rounded-lg{border-radius:0.5rem;}
|
|
722
|
+
.text-xs{font-size:0.75rem;line-height:1rem;}
|
|
723
|
+
.opacity-0,
|
|
724
|
+
.group:hover .group-hover\\:opacity-0{opacity:0;}
|
|
725
|
+
.group:hover .group-hover\\:opacity-100{opacity:1;}
|
|
726
|
+
.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / 0.1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / 0.1));box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);}
|
|
727
|
+
.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;};
|
|
728
|
+
`
|
|
729
|
+
];
|
|
730
|
+
let W = et;
|
|
731
|
+
customElements.get("shiki-code-simple-variant") || customElements.define("shiki-code-simple-variant", W);
|
|
732
|
+
var Gt = Object.defineProperty, Qt = (s, t, e, i) => {
|
|
733
|
+
for (var n = void 0, r = s.length - 1, o; r >= 0; r--)
|
|
734
|
+
(o = s[r]) && (n = o(t, e, n) || n);
|
|
735
|
+
return n && Gt(t, e, n), n;
|
|
736
|
+
};
|
|
737
|
+
const it = class it extends I {
|
|
738
|
+
constructor() {
|
|
739
|
+
super(...arguments), this.fold = !1;
|
|
740
|
+
}
|
|
741
|
+
render() {
|
|
742
|
+
return g`
|
|
743
|
+
<div class="shadow rounded-lg overflow-hidden relative group">
|
|
744
|
+
<header
|
|
745
|
+
class="flex items-center h-10 justify-between px-4.5 opacity-95"
|
|
746
|
+
style="background-color: ${this.options.theme?.bg};"
|
|
747
|
+
>
|
|
748
|
+
<div class="flex gap-2">
|
|
749
|
+
<div class="bg-[#FF5C60] size-3 rounded-full"></div>
|
|
750
|
+
<div class="bg-[#FAC800] size-3 rounded-full"></div>
|
|
751
|
+
<div class="bg-[#35C759] size-3 rounded-full"></div>
|
|
752
|
+
</div>
|
|
753
|
+
<div class="select-none font-semibold" style="color: ${this.options.theme?.fg}">
|
|
754
|
+
${this.options.languageName}
|
|
755
|
+
</div>
|
|
756
|
+
<div class="inline-flex items-center gap-2">
|
|
757
|
+
<button
|
|
758
|
+
class="select-none"
|
|
759
|
+
tabindex="-1"
|
|
760
|
+
@click=${() => {
|
|
761
|
+
this.fold = !this.fold;
|
|
762
|
+
}}
|
|
763
|
+
>
|
|
764
|
+
${R(
|
|
765
|
+
this.fold,
|
|
766
|
+
() => g`<i
|
|
767
|
+
class="i-mingcute-left-line block"
|
|
768
|
+
style="color: ${this.options.theme?.fg}"
|
|
769
|
+
></i>`,
|
|
770
|
+
() => g`<i
|
|
771
|
+
class="i-mingcute-down-line block"
|
|
772
|
+
style="color: ${this.options.theme?.fg}"
|
|
773
|
+
></i>`
|
|
774
|
+
)}
|
|
775
|
+
</button>
|
|
776
|
+
<button class="select-none" tabindex="-1" @click=${this.handleCopyCode}>
|
|
777
|
+
${R(
|
|
778
|
+
this.copied,
|
|
779
|
+
() => g`<i class="i-tabler-check block" style="color: ${this.options.theme?.fg}"></i>`,
|
|
780
|
+
() => g`<i class="i-tabler-copy block" style="color: ${this.options.theme?.fg}"></i>`
|
|
781
|
+
)}
|
|
782
|
+
</button>
|
|
783
|
+
</div>
|
|
784
|
+
</header>
|
|
785
|
+
${R(
|
|
786
|
+
this.fold,
|
|
787
|
+
() => g``,
|
|
788
|
+
() => g`${vt(this.options.html)}`
|
|
789
|
+
)}
|
|
790
|
+
</div>
|
|
791
|
+
`;
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
it.styles = [
|
|
795
|
+
C(J),
|
|
796
|
+
C($t),
|
|
797
|
+
G`
|
|
798
|
+
/* layer: preflights */
|
|
799
|
+
*,::before,::after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}
|
|
800
|
+
/* layer: icons */
|
|
801
|
+
.i-mingcute-down-line{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath d='M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z'/%3E%3Cpath fill='currentColor' d='M12.707 15.707a1 1 0 0 1-1.414 0L5.636 10.05A1 1 0 1 1 7.05 8.636l4.95 4.95l4.95-4.95a1 1 0 0 1 1.414 1.414z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
|
|
802
|
+
.i-mingcute-left-line{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cpath d='M24 0v24H0V0zM12.593 23.258l-.011.002l-.071.035l-.02.004l-.014-.004l-.071-.035q-.016-.005-.024.005l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.017-.018m.265-.113l-.013.002l-.185.093l-.01.01l-.003.011l.018.43l.005.012l.008.007l.201.093q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.004-.011l.017-.43l-.003-.012l-.01-.01z'/%3E%3Cpath fill='currentColor' d='M8.293 12.707a1 1 0 0 1 0-1.414l5.657-5.657a1 1 0 1 1 1.414 1.414L10.414 12l4.95 4.95a1 1 0 0 1-1.414 1.414z'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
|
|
803
|
+
.i-tabler-check{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m5 12l5 5L20 7'/%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
|
|
804
|
+
.i-tabler-copy{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 24 24' width='1em' height='1em' xmlns='http://www.w3.org/2000/svg' %3E%3Cg fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z'/%3E%3Cpath d='M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1'/%3E%3C/g%3E%3C/svg%3E");-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;background-color:currentColor;color:inherit;width:1em;height:1em;}
|
|
805
|
+
/* layer: default */
|
|
806
|
+
.relative{position:relative;}
|
|
807
|
+
.static{position:static;}
|
|
808
|
+
.block{display:block;}
|
|
809
|
+
.size-3{width:0.75rem;height:0.75rem;}
|
|
810
|
+
.h-10{height:2.5rem;}
|
|
811
|
+
.flex{display:flex;}
|
|
812
|
+
.inline-flex{display:inline-flex;}
|
|
813
|
+
.select-none{-webkit-user-select:none;user-select:none;}
|
|
814
|
+
.items-center{align-items:center;}
|
|
815
|
+
.justify-between{justify-content:space-between;}
|
|
816
|
+
.gap-2{gap:0.5rem;}
|
|
817
|
+
.overflow-hidden{overflow:hidden;}
|
|
818
|
+
.rounded-full{border-radius:9999px;}
|
|
819
|
+
.rounded-lg{border-radius:0.5rem;}
|
|
820
|
+
.bg-\\[\\#35C759\\]{--un-bg-opacity:1;background-color:rgb(53 199 89 / var(--un-bg-opacity)) /* #35C759 */;}
|
|
821
|
+
.bg-\\[\\#FAC800\\]{--un-bg-opacity:1;background-color:rgb(250 200 0 / var(--un-bg-opacity)) /* #FAC800 */;}
|
|
822
|
+
.bg-\\[\\#FF5C60\\]{--un-bg-opacity:1;background-color:rgb(255 92 96 / var(--un-bg-opacity)) /* #FF5C60 */;}
|
|
823
|
+
.px-4\\.5{padding-left:1.125rem;padding-right:1.125rem;}
|
|
824
|
+
.font-semibold{font-weight:600;}
|
|
825
|
+
.opacity-95{opacity:0.95;}
|
|
826
|
+
.shadow{--un-shadow:var(--un-shadow-inset) 0 1px 3px 0 var(--un-shadow-color, rgb(0 0 0 / 0.1)),var(--un-shadow-inset) 0 1px 2px -1px var(--un-shadow-color, rgb(0 0 0 / 0.1));box-shadow:var(--un-ring-offset-shadow), var(--un-ring-shadow), var(--un-shadow);};
|
|
827
|
+
`
|
|
828
|
+
];
|
|
829
|
+
let B = it;
|
|
830
|
+
Qt([
|
|
831
|
+
f()
|
|
832
|
+
], B.prototype, "fold");
|
|
833
|
+
customElements.get("shiki-code-mac-variant") || customElements.define("shiki-code-mac-variant", B);
|
|
834
|
+
var Xt = Object.defineProperty, m = (s, t, e, i) => {
|
|
835
|
+
for (var n = void 0, r = s.length - 1, o; r >= 0; r--)
|
|
836
|
+
(o = s[r]) && (n = o(t, e, n) || n);
|
|
837
|
+
return n && Xt(t, e, n), n;
|
|
838
|
+
};
|
|
839
|
+
const nt = class nt extends A {
|
|
840
|
+
constructor() {
|
|
841
|
+
super(...arguments), this.lightTheme = "github-light", this.darkTheme = "github-dark", this.variant = "simple", this.fontSize = "0.875em", this.loading = !0, this.html = "", this.languageCode = "", this.languageName = "", this.lightThemeRegistration = null, this.darkThemeRegistration = null, this.code = "", this.copied = !1, this.error = "", this._observer = null, this._media = null, this._colorScheme = "light";
|
|
842
|
+
}
|
|
843
|
+
get _themeRegistration() {
|
|
844
|
+
return this._colorScheme === "dark" ? this.darkThemeRegistration : this.lightThemeRegistration;
|
|
845
|
+
}
|
|
846
|
+
connectedCallback() {
|
|
847
|
+
this._media = window.matchMedia("(prefers-color-scheme: dark)"), this.updateTheme(), this._observer = new MutationObserver(() => this.updateTheme()), this._observer.observe(document.documentElement, {
|
|
848
|
+
attributes: !0,
|
|
849
|
+
attributeFilter: ["class", "data-color-scheme"]
|
|
850
|
+
}), this._observer.observe(document.body, {
|
|
851
|
+
attributes: !0,
|
|
852
|
+
attributeFilter: ["class", "data-color-scheme"]
|
|
853
|
+
}), this._media.addEventListener("change", () => this.updateTheme()), super.connectedCallback();
|
|
854
|
+
}
|
|
855
|
+
disconnectedCallback() {
|
|
856
|
+
this._observer?.disconnect(), this._media?.removeEventListener("change", () => this.updateTheme()), super.disconnectedCallback();
|
|
857
|
+
}
|
|
858
|
+
isDarkMode() {
|
|
859
|
+
const t = document.documentElement, e = document.body, i = (r, o) => r?.classList.contains(o), n = (r, o, l) => r?.getAttribute(o) === l;
|
|
860
|
+
return i(t, "color-scheme-auto") || i(e, "color-scheme-auto") || n(t, "data-color-scheme", "auto") || n(e, "data-color-scheme", "auto") ? this._media?.matches : !!(i(t, "color-scheme-dark") || i(t, "dark") || n(t, "data-color-scheme", "dark") || i(e, "color-scheme-dark") || i(e, "dark") || n(e, "data-color-scheme", "dark"));
|
|
861
|
+
}
|
|
862
|
+
updateTheme() {
|
|
863
|
+
this._colorScheme = this.isDarkMode() ? "dark" : "light";
|
|
864
|
+
}
|
|
865
|
+
render() {
|
|
866
|
+
return g`<slot @slotchange=${this.handleSlotchange}></slot> ${this.renderCodeBlockBody()}`;
|
|
867
|
+
}
|
|
868
|
+
renderCodeBlockBody() {
|
|
869
|
+
if (this.loading)
|
|
870
|
+
return g``;
|
|
871
|
+
if (this.error)
|
|
872
|
+
return g`<div class="text-sm text-red-500">错误: ${this.error}</div>`;
|
|
873
|
+
const t = {
|
|
874
|
+
code: this.code,
|
|
875
|
+
html: this.html,
|
|
876
|
+
languageName: this.languageName,
|
|
877
|
+
colorScheme: this._colorScheme,
|
|
878
|
+
theme: this._themeRegistration,
|
|
879
|
+
fontSize: this.fontSize
|
|
880
|
+
};
|
|
881
|
+
if (this.variant === "mac")
|
|
882
|
+
return g`<shiki-code-mac-variant .options=${t}></shiki-code-mac-variant>`;
|
|
883
|
+
if (this.variant === "simple")
|
|
884
|
+
return g`<shiki-code-simple-variant .options=${t}></shiki-code-simple-variant>`;
|
|
885
|
+
}
|
|
886
|
+
handleSlotchange(t) {
|
|
887
|
+
const e = t.target.assignedElements({
|
|
888
|
+
flatten: !0
|
|
889
|
+
});
|
|
890
|
+
if (!e.length) return;
|
|
891
|
+
const i = e[0];
|
|
892
|
+
if (i.tagName === "PRE") {
|
|
893
|
+
const n = i.querySelector("code");
|
|
894
|
+
n && this.process(n);
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
async process(t) {
|
|
898
|
+
try {
|
|
899
|
+
this.languageCode = this.extractLanguageCode(t.classList) || "plaintext", this.languageCode === "auto" && (this.languageCode = "plaintext"), this.code = t.textContent || "";
|
|
900
|
+
const e = await this.renderCodeAsHtml(
|
|
901
|
+
this.code || "",
|
|
902
|
+
this.languageCode
|
|
903
|
+
);
|
|
904
|
+
this.html = e;
|
|
905
|
+
const { getSingletonHighlighter: i } = await import("shiki"), n = await i();
|
|
906
|
+
if (this.languageCode !== "plaintext") {
|
|
907
|
+
const r = n.getLanguage(this.languageCode);
|
|
908
|
+
this.languageName = r.name;
|
|
909
|
+
} else
|
|
910
|
+
this.languageName = "plaintext";
|
|
911
|
+
this.lightThemeRegistration = n.getTheme(this.lightTheme), this.darkThemeRegistration = n.getTheme(
|
|
912
|
+
this.darkTheme || this.lightTheme
|
|
913
|
+
);
|
|
914
|
+
} catch (e) {
|
|
915
|
+
e instanceof Error && (this.error = e.message);
|
|
916
|
+
} finally {
|
|
917
|
+
this.shadowRoot?.querySelector("slot")?.assignedElements().forEach((e) => {
|
|
918
|
+
e instanceof HTMLElement && e.setAttribute("style", "display: none !important;");
|
|
919
|
+
}), this.loading = !1;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
extractLanguageCode(t) {
|
|
923
|
+
const e = ["language-", "lang-"];
|
|
924
|
+
for (let i = 0; i < t.length; i++) {
|
|
925
|
+
const n = t[i];
|
|
926
|
+
for (let r = 0; r < e.length; r++) {
|
|
927
|
+
const o = e[r];
|
|
928
|
+
if (n.startsWith(o))
|
|
929
|
+
return n.substring(o.length).toLowerCase();
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
return null;
|
|
933
|
+
}
|
|
934
|
+
async renderCodeAsHtml(t, e) {
|
|
935
|
+
const { codeToHtml: i } = await import("shiki"), {
|
|
936
|
+
transformerNotationDiff: n,
|
|
937
|
+
transformerNotationHighlight: r,
|
|
938
|
+
transformerNotationFocus: o,
|
|
939
|
+
transformerNotationErrorLevel: l
|
|
940
|
+
} = await import("@shikijs/transformers");
|
|
941
|
+
return await i(t, {
|
|
942
|
+
lang: e,
|
|
943
|
+
themes: {
|
|
944
|
+
light: this.lightTheme,
|
|
945
|
+
dark: this.darkTheme || this.lightTheme
|
|
946
|
+
},
|
|
947
|
+
transformers: [
|
|
948
|
+
n(),
|
|
949
|
+
r(),
|
|
950
|
+
o(),
|
|
951
|
+
l()
|
|
952
|
+
]
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
nt.styles = [
|
|
957
|
+
C(J),
|
|
958
|
+
G`
|
|
959
|
+
:host {
|
|
960
|
+
display: block;
|
|
961
|
+
margin: 1rem 0 !important;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/* layer: preflights */
|
|
965
|
+
*,::before,::after{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(147 197 253 / 0.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: ;}
|
|
966
|
+
/* layer: default */
|
|
967
|
+
.static{position:static;}
|
|
968
|
+
.block{display:block;}
|
|
969
|
+
.color-scheme-auto{color-scheme:auto;}
|
|
970
|
+
.color-scheme-dark{color-scheme:dark;}
|
|
971
|
+
.text-sm{font-size:0.875rem;line-height:1.25rem;}
|
|
972
|
+
.text-red-500{--un-text-opacity:1;color:rgb(239 68 68 / var(--un-text-opacity)) /* #ef4444 */;};
|
|
973
|
+
`
|
|
974
|
+
];
|
|
975
|
+
let d = nt;
|
|
976
|
+
m([
|
|
977
|
+
z({ type: String, attribute: "light-theme" })
|
|
978
|
+
], d.prototype, "lightTheme");
|
|
979
|
+
m([
|
|
980
|
+
z({ type: String, attribute: "dark-theme" })
|
|
981
|
+
], d.prototype, "darkTheme");
|
|
982
|
+
m([
|
|
983
|
+
z({ type: String })
|
|
984
|
+
], d.prototype, "variant");
|
|
985
|
+
m([
|
|
986
|
+
z({ type: String, attribute: "font-size" })
|
|
987
|
+
], d.prototype, "fontSize");
|
|
988
|
+
m([
|
|
989
|
+
f()
|
|
990
|
+
], d.prototype, "loading");
|
|
991
|
+
m([
|
|
992
|
+
f()
|
|
993
|
+
], d.prototype, "html");
|
|
994
|
+
m([
|
|
995
|
+
f()
|
|
996
|
+
], d.prototype, "languageCode");
|
|
997
|
+
m([
|
|
998
|
+
f()
|
|
999
|
+
], d.prototype, "languageName");
|
|
1000
|
+
m([
|
|
1001
|
+
f()
|
|
1002
|
+
], d.prototype, "lightThemeRegistration");
|
|
1003
|
+
m([
|
|
1004
|
+
f()
|
|
1005
|
+
], d.prototype, "darkThemeRegistration");
|
|
1006
|
+
m([
|
|
1007
|
+
f()
|
|
1008
|
+
], d.prototype, "code");
|
|
1009
|
+
m([
|
|
1010
|
+
f()
|
|
1011
|
+
], d.prototype, "copied");
|
|
1012
|
+
m([
|
|
1013
|
+
f()
|
|
1014
|
+
], d.prototype, "error");
|
|
1015
|
+
m([
|
|
1016
|
+
f()
|
|
1017
|
+
], d.prototype, "_colorScheme");
|
|
1018
|
+
customElements.get("shiki-code") || customElements.define("shiki-code", d);
|
|
1019
|
+
export {
|
|
1020
|
+
d as ShikiCode
|
|
1021
|
+
};
|