@telperion/elements 6.1.0 → 7.1.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/.build-manifest.json +22 -1
- package/README.md +40 -5
- package/_chunks/code-cdn-element-ClAO2lep.d.cts +200 -0
- package/_chunks/code-cdn-element-ClAO2lep.d.ts +200 -0
- package/code/bundled-language-loader.cjs +18 -0
- package/code/bundled-language-loader.cjs.map +1 -0
- package/code/bundled-language-loader.js +16 -0
- package/code/bundled-language-loader.js.map +1 -0
- package/code/cdn-language-loader.cjs +41 -0
- package/code/cdn-language-loader.cjs.map +1 -0
- package/code/cdn-language-loader.js +36 -0
- package/code/cdn-language-loader.js.map +1 -0
- package/code/cdn.cjs +21 -0
- package/code/cdn.cjs.map +1 -0
- package/code/cdn.d.cts +3 -0
- package/code/cdn.d.ts +3 -0
- package/code/cdn.js +16 -0
- package/code/cdn.js.map +1 -0
- package/code/code-element-base.cjs +241 -0
- package/code/code-element-base.cjs.map +1 -0
- package/code/code-element-base.js +239 -0
- package/code/code-element-base.js.map +1 -0
- package/code/code-element.cjs +16 -0
- package/code/code-element.cjs.map +1 -0
- package/code/code-element.js +14 -0
- package/code/code-element.js.map +1 -0
- package/code/copy.cjs +41 -0
- package/code/copy.cjs.map +1 -0
- package/code/copy.js +39 -0
- package/code/copy.js.map +1 -0
- package/code/css-variables-theme.cjs +24 -0
- package/code/css-variables-theme.cjs.map +1 -0
- package/code/css-variables-theme.js +21 -0
- package/code/css-variables-theme.js.map +1 -0
- package/code/highlighter.cjs +84 -0
- package/code/highlighter.cjs.map +1 -0
- package/code/highlighter.js +80 -0
- package/code/highlighter.js.map +1 -0
- package/code/index.cjs +19 -0
- package/code/index.cjs.map +1 -0
- package/code/index.d.cts +13 -0
- package/code/index.d.ts +13 -0
- package/code/index.js +6 -0
- package/code/index.js.map +1 -0
- package/code/language-loader.cjs +22 -0
- package/code/language-loader.cjs.map +1 -0
- package/code/language-loader.js +19 -0
- package/code/language-loader.js.map +1 -0
- package/code/line-ranges.cjs +28 -0
- package/code/line-ranges.cjs.map +1 -0
- package/code/line-ranges.js +25 -0
- package/code/line-ranges.js.map +1 -0
- package/code/source.cjs +52 -0
- package/code/source.cjs.map +1 -0
- package/code/source.js +48 -0
- package/code/source.js.map +1 -0
- package/code/styles.cjs +183 -0
- package/code/styles.cjs.map +1 -0
- package/code/styles.js +181 -0
- package/code/styles.js.map +1 -0
- package/code/templates.cjs +66 -0
- package/code/templates.cjs.map +1 -0
- package/code/templates.js +63 -0
- package/code/templates.js.map +1 -0
- package/custom-elements.json +3993 -2377
- package/fesm/elements.mjs +501 -216
- package/fesm/elements.mjs.map +1 -1
- package/iife/code/cdn.js +263 -0
- package/iife/code/cdn.js.map +1 -0
- package/iife/elements.js +36 -36
- package/iife/elements.js.map +1 -1
- package/iife/router/index.js +23 -23
- package/iife/router/index.js.map +1 -1
- package/index.cjs +23 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/index.js +8 -6
- package/index.js.map +1 -1
- package/package.json +39 -2
- package/router/history-managed.cjs +1 -1
- package/router/history-managed.cjs.map +1 -1
- package/router/history-managed.js +1 -1
- package/router/history-managed.js.map +1 -1
- package/router/index.cjs +23 -18
- package/router/index.cjs.map +1 -1
- package/router/index.d.cts +273 -168
- package/router/index.d.ts +273 -168
- package/router/index.js +8 -6
- package/router/index.js.map +1 -1
- package/router/route-element.cjs +244 -0
- package/router/route-element.cjs.map +1 -0
- package/router/route-element.js +239 -0
- package/router/route-element.js.map +1 -0
- package/router/route-events.cjs +14 -0
- package/router/route-events.cjs.map +1 -0
- package/router/route-events.js +10 -0
- package/router/route-events.js.map +1 -0
- package/router/route-source.cjs +134 -0
- package/router/route-source.cjs.map +1 -0
- package/router/route-source.js +129 -0
- package/router/route-source.js.map +1 -0
- package/router/route-templates.cjs +18 -0
- package/router/route-templates.cjs.map +1 -0
- package/router/route-templates.js +16 -0
- package/router/route-templates.js.map +1 -0
- package/router/{tha-router-config.cjs → router-config-element.cjs} +51 -51
- package/router/router-config-element.cjs.map +1 -0
- package/router/{tha-router-config.js → router-config-element.js} +52 -52
- package/router/router-config-element.js.map +1 -0
- package/router/{tha-router.cjs → router-element.cjs} +47 -33
- package/router/router-element.cjs.map +1 -0
- package/router/{tha-router.js → router-element.js} +47 -33
- package/router/router-element.js.map +1 -0
- package/router/{tha-router-link.cjs → router-link-element.cjs} +15 -15
- package/router/router-link-element.cjs.map +1 -0
- package/router/{tha-router-link.js → router-link-element.js} +16 -16
- package/router/router-link-element.js.map +1 -0
- package/router/{tha-router-outlet.cjs → router-outlet-element.cjs} +44 -31
- package/router/router-outlet-element.cjs.map +1 -0
- package/router/{tha-router-outlet.js → router-outlet-element.js} +43 -30
- package/router/router-outlet-element.js.map +1 -0
- package/router/{tha-router-param.cjs → router-param-element.cjs} +62 -62
- package/router/router-param-element.cjs.map +1 -0
- package/router/{tha-router-param.js → router-param-element.js} +62 -62
- package/router/router-param-element.js.map +1 -0
- package/router/tha-route.cjs +0 -128
- package/router/tha-route.cjs.map +0 -1
- package/router/tha-route.js +0 -125
- package/router/tha-route.js.map +0 -1
- package/router/tha-router-config.cjs.map +0 -1
- package/router/tha-router-config.js.map +0 -1
- package/router/tha-router-link.cjs.map +0 -1
- package/router/tha-router-link.js.map +0 -1
- package/router/tha-router-outlet.cjs.map +0 -1
- package/router/tha-router-outlet.js.map +0 -1
- package/router/tha-router-param.cjs.map +0 -1
- package/router/tha-router-param.js.map +0 -1
- package/router/tha-router.cjs.map +0 -1
- package/router/tha-router.js.map +0 -1
package/code/cdn.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { cdnLanguageLoader } from './cdn-language-loader.js';
|
|
2
|
+
export { SHIKI_LANGS_VERSION, languageCdnUrl, setLanguageCdnBaseUrl } from './cdn-language-loader.js';
|
|
3
|
+
import { CodeElement } from './code-element-base.js';
|
|
4
|
+
import { setLanguageLoader } from './language-loader.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* CDN entry for `<tp-code>` (used by the self-contained IIFE build): grammars
|
|
8
|
+
* are imported at runtime from jsDelivr instead of being bundled, since an
|
|
9
|
+
* IIFE cannot code-split. Point it elsewhere with `setLanguageCdnBaseUrl()`.
|
|
10
|
+
*/
|
|
11
|
+
setLanguageLoader(cdnLanguageLoader);
|
|
12
|
+
if (!customElements.get("tp-code"))
|
|
13
|
+
customElements.define("tp-code", CodeElement);
|
|
14
|
+
|
|
15
|
+
export { CodeElement, setLanguageLoader };
|
|
16
|
+
//# sourceMappingURL=cdn.js.map
|
package/code/cdn.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.js","sources":["../../../../libs/elements/src/code/code-cdn-element.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAIA;;;;AAIG;AACH,iBAAiB,CAAC,iBAAiB,CAAC;AAEpC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;AAAE,IAAA,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;;;;"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib = require('tslib');
|
|
4
|
+
var lit = require('lit');
|
|
5
|
+
var decorators_js = require('lit/decorators.js');
|
|
6
|
+
var copy = require('./copy.cjs');
|
|
7
|
+
var highlighter = require('./highlighter.cjs');
|
|
8
|
+
var lineRanges = require('./line-ranges.cjs');
|
|
9
|
+
var source = require('./source.cjs');
|
|
10
|
+
var styles = require('./styles.cjs');
|
|
11
|
+
var templates = require('./templates.cjs');
|
|
12
|
+
|
|
13
|
+
const COPIED_RESET_MS = 2000;
|
|
14
|
+
/**
|
|
15
|
+
* `<tp-code>` — syntax-highlighted code powered by [Shiki](https://shiki.style).
|
|
16
|
+
*
|
|
17
|
+
* - **Source**: the element's text content, a direct `<template>` child (for
|
|
18
|
+
* HTML samples, no escaping needed), or the `code` property. Light-DOM
|
|
19
|
+
* changes are observed and re-highlighted.
|
|
20
|
+
* - **Languages**: any Shiki language id or alias via `language`, loaded lazily
|
|
21
|
+
* once per page. Unknown languages render as plain text.
|
|
22
|
+
* - **Rendering**: into shadow DOM, so the light DOM stays the untouched
|
|
23
|
+
* source of truth; style through `--tp-code-*` variables and `::part()`.
|
|
24
|
+
* - **Async**: plain text renders immediately and is swapped for highlighted
|
|
25
|
+
* tokens once the grammar loads — same line layout, no shift.
|
|
26
|
+
*
|
|
27
|
+
* @element tp-code
|
|
28
|
+
*
|
|
29
|
+
* @attr {"inline" | "block"} [variant="inline"] - Layout.
|
|
30
|
+
* @attr {string} [language=""] - Shiki language id or alias (`ts`, `html`, `sh`, …). Empty, `text`, or unknown → plain text.
|
|
31
|
+
* @attr {boolean} [line-numbers=false] - Block only. Shows line numbers.
|
|
32
|
+
* @attr {number} [line-start=1] - Block only. Number of the first line.
|
|
33
|
+
* @attr {string} [highlight-lines=""] - Block only. Lines to emphasize, e.g. `"2, 4-6"` (in displayed line numbers).
|
|
34
|
+
* @attr {boolean} [copyable=false] - Block only. Shows a copy-to-clipboard button.
|
|
35
|
+
*
|
|
36
|
+
* @fires tp-code-highlight - After each highlight pass. `detail: { language, highlighted }`.
|
|
37
|
+
* @fires tp-code-copy - After the copy button is used. `detail: { code, success }`.
|
|
38
|
+
*
|
|
39
|
+
* @csspart pre - Block wrapper (`<pre>`).
|
|
40
|
+
* @csspart code - The `<code>` element (both variants).
|
|
41
|
+
* @csspart line - Every line (block).
|
|
42
|
+
* @csspart highlighted-line - Lines matched by `highlight-lines`.
|
|
43
|
+
* @csspart copy-button - The copy button.
|
|
44
|
+
*
|
|
45
|
+
* @cssprop --tp-code-foreground - Text color. Defaults to `--tp-color-contrast`.
|
|
46
|
+
* @cssprop --tp-code-background - Surface color. Defaults to a 6% tint of the foreground.
|
|
47
|
+
* @cssprop --tp-code-font-family - Monospace font stack.
|
|
48
|
+
* @cssprop --tp-code-font-size - Defaults to `0.875em`.
|
|
49
|
+
* @cssprop --tp-code-line-height - Block line height. Defaults to `1.6`.
|
|
50
|
+
* @cssprop --tp-code-tab-size - Defaults to `2`.
|
|
51
|
+
* @cssprop --tp-code-radius - Corner radius (`0.3em` inline, `0.5em` block).
|
|
52
|
+
* @cssprop --tp-code-inline-padding - Inline padding. Defaults to `0.1em 0.35em`.
|
|
53
|
+
* @cssprop --tp-code-padding-block - Block vertical padding. Defaults to `1em`.
|
|
54
|
+
* @cssprop --tp-code-padding-inline - Block horizontal padding per line. Defaults to `1em`.
|
|
55
|
+
* @cssprop --tp-code-accent-strength - How much of the palette color token defaults keep vs. the foreground. Defaults to `80%`.
|
|
56
|
+
* @cssprop --tp-code-token-keyword - Keywords. Defaults from `--tp-color-secondary`.
|
|
57
|
+
* @cssprop --tp-code-token-function - Functions. Defaults from `--tp-color-primary`.
|
|
58
|
+
* @cssprop --tp-code-token-constant - Constants, numbers, variables.
|
|
59
|
+
* @cssprop --tp-code-token-string - Strings. Defaults from `--tp-color-success`.
|
|
60
|
+
* @cssprop --tp-code-token-string-expression - Template/string expressions.
|
|
61
|
+
* @cssprop --tp-code-token-parameter - Parameters. Defaults from `--tp-color-warning`.
|
|
62
|
+
* @cssprop --tp-code-token-comment - Comments.
|
|
63
|
+
* @cssprop --tp-code-token-punctuation - Punctuation.
|
|
64
|
+
* @cssprop --tp-code-token-link - Links.
|
|
65
|
+
* @cssprop --tp-code-token-inserted - Diff insertions.
|
|
66
|
+
* @cssprop --tp-code-token-deleted - Diff deletions. Defaults from `--tp-color-danger`.
|
|
67
|
+
* @cssprop --tp-code-token-changed - Diff changes.
|
|
68
|
+
* @cssprop --tp-code-ansi-black - ANSI colors (also `-red`, `-green`, `-yellow`, `-blue`, `-magenta`, `-cyan`, `-white` and their `-bright-*` variants) for `ansi` code.
|
|
69
|
+
* @cssprop --tp-code-line-number-color - Line number color.
|
|
70
|
+
* @cssprop --tp-code-line-number-gap - Space between line numbers and code. Defaults to `1.5em`.
|
|
71
|
+
* @cssprop --tp-code-line-highlight-background - Highlighted line background. Defaults from `--tp-color-primary`.
|
|
72
|
+
* @cssprop --tp-code-line-highlight-border-color - Highlighted line edge marker.
|
|
73
|
+
* @cssprop --tp-code-copy-background - Copy button background. Defaults to `Canvas`.
|
|
74
|
+
* @cssprop --tp-code-copy-color - Copy button icon color.
|
|
75
|
+
* @cssprop --tp-code-copy-success-color - Copy button color after a successful copy.
|
|
76
|
+
*/
|
|
77
|
+
class CodeElement extends lit.LitElement {
|
|
78
|
+
constructor() {
|
|
79
|
+
super(...arguments);
|
|
80
|
+
/** Layout: `inline` (default) or `block`. */
|
|
81
|
+
this.variant = "inline";
|
|
82
|
+
/** Shiki language id or alias. Empty/`text`/unknown renders plain text. */
|
|
83
|
+
this.language = "";
|
|
84
|
+
/** Block only. Shows line numbers. */
|
|
85
|
+
this.lineNumbers = false;
|
|
86
|
+
/** Block only. Number of the first line. */
|
|
87
|
+
this.lineStart = 1;
|
|
88
|
+
/** Block only. Lines to emphasize, e.g. `"2, 4-6"`. */
|
|
89
|
+
this.highlightLines = "";
|
|
90
|
+
/** Block only. Shows a copy-to-clipboard button. */
|
|
91
|
+
this.copyable = false;
|
|
92
|
+
/** Raw source read from `code` or the light DOM. */
|
|
93
|
+
this.rawSource = "";
|
|
94
|
+
this.copied = false;
|
|
95
|
+
this.#source = "";
|
|
96
|
+
this.#ranges = [];
|
|
97
|
+
this.#request = 0;
|
|
98
|
+
this.#highlightDone = Promise.resolve();
|
|
99
|
+
}
|
|
100
|
+
static { this.styles = styles.codeStyles; }
|
|
101
|
+
#source;
|
|
102
|
+
#ranges;
|
|
103
|
+
#observer;
|
|
104
|
+
#request;
|
|
105
|
+
#highlightDone;
|
|
106
|
+
#copiedTimer;
|
|
107
|
+
/** The normalized source being displayed (dedented for blocks, trimmed inline). */
|
|
108
|
+
get source() {
|
|
109
|
+
return this.#source;
|
|
110
|
+
}
|
|
111
|
+
/** Resolves once the current highlight pass (if any) has rendered. */
|
|
112
|
+
get highlightComplete() {
|
|
113
|
+
return this.#highlightDone;
|
|
114
|
+
}
|
|
115
|
+
connectedCallback() {
|
|
116
|
+
super.connectedCallback();
|
|
117
|
+
this.#observer ??= new MutationObserver(() => this.#syncSource());
|
|
118
|
+
this.#observer.observe(this, { childList: true, characterData: true, subtree: true });
|
|
119
|
+
this.#syncSource();
|
|
120
|
+
}
|
|
121
|
+
disconnectedCallback() {
|
|
122
|
+
super.disconnectedCallback();
|
|
123
|
+
this.#observer?.disconnect();
|
|
124
|
+
clearTimeout(this.#copiedTimer);
|
|
125
|
+
this.copied = false;
|
|
126
|
+
}
|
|
127
|
+
willUpdate(changed) {
|
|
128
|
+
if (changed.has("code"))
|
|
129
|
+
this.#syncSource();
|
|
130
|
+
if (changed.has("highlightLines"))
|
|
131
|
+
this.#ranges = lineRanges.parseLineRanges(this.highlightLines);
|
|
132
|
+
if (changed.has("rawSource") || changed.has("variant")) {
|
|
133
|
+
const source$1 = source.normalizeSource(this.rawSource, this.variant);
|
|
134
|
+
if (source$1 !== this.#source) {
|
|
135
|
+
this.#source = source$1;
|
|
136
|
+
this.#highlight();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (changed.has("language"))
|
|
141
|
+
this.#highlight();
|
|
142
|
+
}
|
|
143
|
+
render() {
|
|
144
|
+
const lines = this.tokens ?? this.#source.split("\n");
|
|
145
|
+
if (this.variant !== "block")
|
|
146
|
+
return templates.renderInline(lines);
|
|
147
|
+
return templates.renderBlock({
|
|
148
|
+
lines,
|
|
149
|
+
lineNumbers: this.lineNumbers,
|
|
150
|
+
lineStart: Number.isFinite(this.lineStart) ? Math.trunc(this.lineStart) : 1,
|
|
151
|
+
highlightedLines: this.#ranges,
|
|
152
|
+
copyable: this.copyable,
|
|
153
|
+
copied: this.copied,
|
|
154
|
+
onCopy: () => void this.copy(),
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Copies the displayed source to the clipboard and fires `tp-code-copy`.
|
|
159
|
+
*
|
|
160
|
+
* @returns Whether the copy succeeded.
|
|
161
|
+
*/
|
|
162
|
+
async copy() {
|
|
163
|
+
const code = this.#source;
|
|
164
|
+
const success = await copy.copyText(code);
|
|
165
|
+
clearTimeout(this.#copiedTimer);
|
|
166
|
+
this.copied = success;
|
|
167
|
+
if (success)
|
|
168
|
+
this.#copiedTimer = setTimeout(() => (this.copied = false), COPIED_RESET_MS);
|
|
169
|
+
this.dispatchEvent(new CustomEvent("tp-code-copy", {
|
|
170
|
+
bubbles: true,
|
|
171
|
+
composed: true,
|
|
172
|
+
detail: { code, success },
|
|
173
|
+
}));
|
|
174
|
+
return success;
|
|
175
|
+
}
|
|
176
|
+
#syncSource() {
|
|
177
|
+
this.rawSource = this.code ?? source.readSource(this);
|
|
178
|
+
}
|
|
179
|
+
/** Starts a highlight pass; results from superseded passes are dropped. */
|
|
180
|
+
#highlight() {
|
|
181
|
+
const request = ++this.#request;
|
|
182
|
+
const source = this.#source;
|
|
183
|
+
const language = this.language;
|
|
184
|
+
// Plain text renders right away; tokens replace it when ready.
|
|
185
|
+
this.tokens = undefined;
|
|
186
|
+
this.#highlightDone = highlighter.tokenize(source, language).then(async (tokens) => {
|
|
187
|
+
if (request !== this.#request)
|
|
188
|
+
return;
|
|
189
|
+
this.tokens = tokens;
|
|
190
|
+
await this.updateComplete;
|
|
191
|
+
this.dispatchEvent(new CustomEvent("tp-code-highlight", {
|
|
192
|
+
bubbles: true,
|
|
193
|
+
composed: true,
|
|
194
|
+
detail: { language, highlighted: !!tokens },
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
tslib.__decorate([
|
|
200
|
+
decorators_js.property({ reflect: true }),
|
|
201
|
+
tslib.__metadata("design:type", String)
|
|
202
|
+
], CodeElement.prototype, "variant", void 0);
|
|
203
|
+
tslib.__decorate([
|
|
204
|
+
decorators_js.property({ reflect: true }),
|
|
205
|
+
tslib.__metadata("design:type", Object)
|
|
206
|
+
], CodeElement.prototype, "language", void 0);
|
|
207
|
+
tslib.__decorate([
|
|
208
|
+
decorators_js.property({ type: Boolean, reflect: true, attribute: "line-numbers" }),
|
|
209
|
+
tslib.__metadata("design:type", Object)
|
|
210
|
+
], CodeElement.prototype, "lineNumbers", void 0);
|
|
211
|
+
tslib.__decorate([
|
|
212
|
+
decorators_js.property({ type: Number, attribute: "line-start" }),
|
|
213
|
+
tslib.__metadata("design:type", Object)
|
|
214
|
+
], CodeElement.prototype, "lineStart", void 0);
|
|
215
|
+
tslib.__decorate([
|
|
216
|
+
decorators_js.property({ attribute: "highlight-lines" }),
|
|
217
|
+
tslib.__metadata("design:type", Object)
|
|
218
|
+
], CodeElement.prototype, "highlightLines", void 0);
|
|
219
|
+
tslib.__decorate([
|
|
220
|
+
decorators_js.property({ type: Boolean, reflect: true }),
|
|
221
|
+
tslib.__metadata("design:type", Object)
|
|
222
|
+
], CodeElement.prototype, "copyable", void 0);
|
|
223
|
+
tslib.__decorate([
|
|
224
|
+
decorators_js.property({ attribute: false }),
|
|
225
|
+
tslib.__metadata("design:type", String)
|
|
226
|
+
], CodeElement.prototype, "code", void 0);
|
|
227
|
+
tslib.__decorate([
|
|
228
|
+
decorators_js.state(),
|
|
229
|
+
tslib.__metadata("design:type", Object)
|
|
230
|
+
], CodeElement.prototype, "rawSource", void 0);
|
|
231
|
+
tslib.__decorate([
|
|
232
|
+
decorators_js.state(),
|
|
233
|
+
tslib.__metadata("design:type", Array)
|
|
234
|
+
], CodeElement.prototype, "tokens", void 0);
|
|
235
|
+
tslib.__decorate([
|
|
236
|
+
decorators_js.state(),
|
|
237
|
+
tslib.__metadata("design:type", Object)
|
|
238
|
+
], CodeElement.prototype, "copied", void 0);
|
|
239
|
+
|
|
240
|
+
exports.CodeElement = CodeElement;
|
|
241
|
+
//# sourceMappingURL=code-element-base.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-element-base.cjs","sources":["../../../../libs/elements/src/code/code-element-base.ts"],"sourcesContent":[null],"names":["LitElement","codeStyles","parseLineRanges","source","normalizeSource","renderInline","renderBlock","copyText","readSource","tokenize","__decorate","property","state"],"mappings":";;;;;;;;;;;;AAYA,MAAM,eAAe,GAAG,IAAI;AAgC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DG;AACG,MAAO,WAAY,SAAQA,cAAU,CAAA;AAA3C,IAAA,WAAA,GAAA;;;QAKE,IAAA,CAAA,OAAO,GAAgB,QAAQ;;QAI/B,IAAA,CAAA,QAAQ,GAAG,EAAE;;QAIb,IAAA,CAAA,WAAW,GAAG,KAAK;;QAInB,IAAA,CAAA,SAAS,GAAG,CAAC;;QAIb,IAAA,CAAA,cAAc,GAAG,EAAE;;QAInB,IAAA,CAAA,QAAQ,GAAG,KAAK;;QAWR,IAAA,CAAA,SAAS,GAAG,EAAE;QAMd,IAAA,CAAA,MAAM,GAAG,KAAK;QAEtB,IAAA,CAAA,OAAO,GAAG,EAAE;QACZ,IAAA,CAAA,OAAO,GAAe,EAAE;QAExB,IAAA,CAAA,QAAQ,GAAG,CAAC;AACZ,QAAA,IAAA,CAAA,cAAc,GAAkB,OAAO,CAAC,OAAO,EAAE;IAqHnD;aApKkB,IAAA,CAAA,MAAM,GAAGC,iBAAH,CAAc;AA2CpC,IAAA,OAAO;AACP,IAAA,OAAO;AACP,IAAA,SAAS;AACT,IAAA,QAAQ;AACR,IAAA,cAAc;AACd,IAAA,YAAY;;AAGZ,IAAA,IAAI,MAAM,GAAA;QACR,OAAO,IAAI,CAAC,OAAO;IACrB;;AAGA,IAAA,IAAI,iBAAiB,GAAA;QACnB,OAAO,IAAI,CAAC,cAAc;IAC5B;IAES,iBAAiB,GAAA;QACxB,KAAK,CAAC,iBAAiB,EAAE;AAEzB,QAAA,IAAI,CAAC,SAAS,KAAK,IAAI,gBAAgB,CAAC,MAAM,IAAI,CAAC,WAAW,E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EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;;AACtC,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAIdD,gBAAA,CAAA;AADC,IAAAC,sBAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;;AACvB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAIpBD,gBAAA,CAAA;IADCC,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC1B,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAOjBD,gBAAA,CAAA;AADC,IAAAC,sBAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;AACjB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAIND,gBAAA,CAAA;AADP,IAAAE,mBAAK,EAAE;;AACe,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGfF,gBAAA,CAAA;AADP,IAAAE,mBAAK,EAAE;;AACyB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAGzBF,gBAAA,CAAA;AADP,IAAAE,mBAAK,EAAE;;AACe,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { __decorate, __metadata } from 'tslib';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { property, state } from 'lit/decorators.js';
|
|
4
|
+
import { copyText } from './copy.js';
|
|
5
|
+
import { tokenize } from './highlighter.js';
|
|
6
|
+
import { parseLineRanges } from './line-ranges.js';
|
|
7
|
+
import { normalizeSource, readSource } from './source.js';
|
|
8
|
+
import { codeStyles } from './styles.js';
|
|
9
|
+
import { renderInline, renderBlock } from './templates.js';
|
|
10
|
+
|
|
11
|
+
const COPIED_RESET_MS = 2000;
|
|
12
|
+
/**
|
|
13
|
+
* `<tp-code>` — syntax-highlighted code powered by [Shiki](https://shiki.style).
|
|
14
|
+
*
|
|
15
|
+
* - **Source**: the element's text content, a direct `<template>` child (for
|
|
16
|
+
* HTML samples, no escaping needed), or the `code` property. Light-DOM
|
|
17
|
+
* changes are observed and re-highlighted.
|
|
18
|
+
* - **Languages**: any Shiki language id or alias via `language`, loaded lazily
|
|
19
|
+
* once per page. Unknown languages render as plain text.
|
|
20
|
+
* - **Rendering**: into shadow DOM, so the light DOM stays the untouched
|
|
21
|
+
* source of truth; style through `--tp-code-*` variables and `::part()`.
|
|
22
|
+
* - **Async**: plain text renders immediately and is swapped for highlighted
|
|
23
|
+
* tokens once the grammar loads — same line layout, no shift.
|
|
24
|
+
*
|
|
25
|
+
* @element tp-code
|
|
26
|
+
*
|
|
27
|
+
* @attr {"inline" | "block"} [variant="inline"] - Layout.
|
|
28
|
+
* @attr {string} [language=""] - Shiki language id or alias (`ts`, `html`, `sh`, …). Empty, `text`, or unknown → plain text.
|
|
29
|
+
* @attr {boolean} [line-numbers=false] - Block only. Shows line numbers.
|
|
30
|
+
* @attr {number} [line-start=1] - Block only. Number of the first line.
|
|
31
|
+
* @attr {string} [highlight-lines=""] - Block only. Lines to emphasize, e.g. `"2, 4-6"` (in displayed line numbers).
|
|
32
|
+
* @attr {boolean} [copyable=false] - Block only. Shows a copy-to-clipboard button.
|
|
33
|
+
*
|
|
34
|
+
* @fires tp-code-highlight - After each highlight pass. `detail: { language, highlighted }`.
|
|
35
|
+
* @fires tp-code-copy - After the copy button is used. `detail: { code, success }`.
|
|
36
|
+
*
|
|
37
|
+
* @csspart pre - Block wrapper (`<pre>`).
|
|
38
|
+
* @csspart code - The `<code>` element (both variants).
|
|
39
|
+
* @csspart line - Every line (block).
|
|
40
|
+
* @csspart highlighted-line - Lines matched by `highlight-lines`.
|
|
41
|
+
* @csspart copy-button - The copy button.
|
|
42
|
+
*
|
|
43
|
+
* @cssprop --tp-code-foreground - Text color. Defaults to `--tp-color-contrast`.
|
|
44
|
+
* @cssprop --tp-code-background - Surface color. Defaults to a 6% tint of the foreground.
|
|
45
|
+
* @cssprop --tp-code-font-family - Monospace font stack.
|
|
46
|
+
* @cssprop --tp-code-font-size - Defaults to `0.875em`.
|
|
47
|
+
* @cssprop --tp-code-line-height - Block line height. Defaults to `1.6`.
|
|
48
|
+
* @cssprop --tp-code-tab-size - Defaults to `2`.
|
|
49
|
+
* @cssprop --tp-code-radius - Corner radius (`0.3em` inline, `0.5em` block).
|
|
50
|
+
* @cssprop --tp-code-inline-padding - Inline padding. Defaults to `0.1em 0.35em`.
|
|
51
|
+
* @cssprop --tp-code-padding-block - Block vertical padding. Defaults to `1em`.
|
|
52
|
+
* @cssprop --tp-code-padding-inline - Block horizontal padding per line. Defaults to `1em`.
|
|
53
|
+
* @cssprop --tp-code-accent-strength - How much of the palette color token defaults keep vs. the foreground. Defaults to `80%`.
|
|
54
|
+
* @cssprop --tp-code-token-keyword - Keywords. Defaults from `--tp-color-secondary`.
|
|
55
|
+
* @cssprop --tp-code-token-function - Functions. Defaults from `--tp-color-primary`.
|
|
56
|
+
* @cssprop --tp-code-token-constant - Constants, numbers, variables.
|
|
57
|
+
* @cssprop --tp-code-token-string - Strings. Defaults from `--tp-color-success`.
|
|
58
|
+
* @cssprop --tp-code-token-string-expression - Template/string expressions.
|
|
59
|
+
* @cssprop --tp-code-token-parameter - Parameters. Defaults from `--tp-color-warning`.
|
|
60
|
+
* @cssprop --tp-code-token-comment - Comments.
|
|
61
|
+
* @cssprop --tp-code-token-punctuation - Punctuation.
|
|
62
|
+
* @cssprop --tp-code-token-link - Links.
|
|
63
|
+
* @cssprop --tp-code-token-inserted - Diff insertions.
|
|
64
|
+
* @cssprop --tp-code-token-deleted - Diff deletions. Defaults from `--tp-color-danger`.
|
|
65
|
+
* @cssprop --tp-code-token-changed - Diff changes.
|
|
66
|
+
* @cssprop --tp-code-ansi-black - ANSI colors (also `-red`, `-green`, `-yellow`, `-blue`, `-magenta`, `-cyan`, `-white` and their `-bright-*` variants) for `ansi` code.
|
|
67
|
+
* @cssprop --tp-code-line-number-color - Line number color.
|
|
68
|
+
* @cssprop --tp-code-line-number-gap - Space between line numbers and code. Defaults to `1.5em`.
|
|
69
|
+
* @cssprop --tp-code-line-highlight-background - Highlighted line background. Defaults from `--tp-color-primary`.
|
|
70
|
+
* @cssprop --tp-code-line-highlight-border-color - Highlighted line edge marker.
|
|
71
|
+
* @cssprop --tp-code-copy-background - Copy button background. Defaults to `Canvas`.
|
|
72
|
+
* @cssprop --tp-code-copy-color - Copy button icon color.
|
|
73
|
+
* @cssprop --tp-code-copy-success-color - Copy button color after a successful copy.
|
|
74
|
+
*/
|
|
75
|
+
class CodeElement extends LitElement {
|
|
76
|
+
constructor() {
|
|
77
|
+
super(...arguments);
|
|
78
|
+
/** Layout: `inline` (default) or `block`. */
|
|
79
|
+
this.variant = "inline";
|
|
80
|
+
/** Shiki language id or alias. Empty/`text`/unknown renders plain text. */
|
|
81
|
+
this.language = "";
|
|
82
|
+
/** Block only. Shows line numbers. */
|
|
83
|
+
this.lineNumbers = false;
|
|
84
|
+
/** Block only. Number of the first line. */
|
|
85
|
+
this.lineStart = 1;
|
|
86
|
+
/** Block only. Lines to emphasize, e.g. `"2, 4-6"`. */
|
|
87
|
+
this.highlightLines = "";
|
|
88
|
+
/** Block only. Shows a copy-to-clipboard button. */
|
|
89
|
+
this.copyable = false;
|
|
90
|
+
/** Raw source read from `code` or the light DOM. */
|
|
91
|
+
this.rawSource = "";
|
|
92
|
+
this.copied = false;
|
|
93
|
+
this.#source = "";
|
|
94
|
+
this.#ranges = [];
|
|
95
|
+
this.#request = 0;
|
|
96
|
+
this.#highlightDone = Promise.resolve();
|
|
97
|
+
}
|
|
98
|
+
static { this.styles = codeStyles; }
|
|
99
|
+
#source;
|
|
100
|
+
#ranges;
|
|
101
|
+
#observer;
|
|
102
|
+
#request;
|
|
103
|
+
#highlightDone;
|
|
104
|
+
#copiedTimer;
|
|
105
|
+
/** The normalized source being displayed (dedented for blocks, trimmed inline). */
|
|
106
|
+
get source() {
|
|
107
|
+
return this.#source;
|
|
108
|
+
}
|
|
109
|
+
/** Resolves once the current highlight pass (if any) has rendered. */
|
|
110
|
+
get highlightComplete() {
|
|
111
|
+
return this.#highlightDone;
|
|
112
|
+
}
|
|
113
|
+
connectedCallback() {
|
|
114
|
+
super.connectedCallback();
|
|
115
|
+
this.#observer ??= new MutationObserver(() => this.#syncSource());
|
|
116
|
+
this.#observer.observe(this, { childList: true, characterData: true, subtree: true });
|
|
117
|
+
this.#syncSource();
|
|
118
|
+
}
|
|
119
|
+
disconnectedCallback() {
|
|
120
|
+
super.disconnectedCallback();
|
|
121
|
+
this.#observer?.disconnect();
|
|
122
|
+
clearTimeout(this.#copiedTimer);
|
|
123
|
+
this.copied = false;
|
|
124
|
+
}
|
|
125
|
+
willUpdate(changed) {
|
|
126
|
+
if (changed.has("code"))
|
|
127
|
+
this.#syncSource();
|
|
128
|
+
if (changed.has("highlightLines"))
|
|
129
|
+
this.#ranges = parseLineRanges(this.highlightLines);
|
|
130
|
+
if (changed.has("rawSource") || changed.has("variant")) {
|
|
131
|
+
const source = normalizeSource(this.rawSource, this.variant);
|
|
132
|
+
if (source !== this.#source) {
|
|
133
|
+
this.#source = source;
|
|
134
|
+
this.#highlight();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (changed.has("language"))
|
|
139
|
+
this.#highlight();
|
|
140
|
+
}
|
|
141
|
+
render() {
|
|
142
|
+
const lines = this.tokens ?? this.#source.split("\n");
|
|
143
|
+
if (this.variant !== "block")
|
|
144
|
+
return renderInline(lines);
|
|
145
|
+
return renderBlock({
|
|
146
|
+
lines,
|
|
147
|
+
lineNumbers: this.lineNumbers,
|
|
148
|
+
lineStart: Number.isFinite(this.lineStart) ? Math.trunc(this.lineStart) : 1,
|
|
149
|
+
highlightedLines: this.#ranges,
|
|
150
|
+
copyable: this.copyable,
|
|
151
|
+
copied: this.copied,
|
|
152
|
+
onCopy: () => void this.copy(),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Copies the displayed source to the clipboard and fires `tp-code-copy`.
|
|
157
|
+
*
|
|
158
|
+
* @returns Whether the copy succeeded.
|
|
159
|
+
*/
|
|
160
|
+
async copy() {
|
|
161
|
+
const code = this.#source;
|
|
162
|
+
const success = await copyText(code);
|
|
163
|
+
clearTimeout(this.#copiedTimer);
|
|
164
|
+
this.copied = success;
|
|
165
|
+
if (success)
|
|
166
|
+
this.#copiedTimer = setTimeout(() => (this.copied = false), COPIED_RESET_MS);
|
|
167
|
+
this.dispatchEvent(new CustomEvent("tp-code-copy", {
|
|
168
|
+
bubbles: true,
|
|
169
|
+
composed: true,
|
|
170
|
+
detail: { code, success },
|
|
171
|
+
}));
|
|
172
|
+
return success;
|
|
173
|
+
}
|
|
174
|
+
#syncSource() {
|
|
175
|
+
this.rawSource = this.code ?? readSource(this);
|
|
176
|
+
}
|
|
177
|
+
/** Starts a highlight pass; results from superseded passes are dropped. */
|
|
178
|
+
#highlight() {
|
|
179
|
+
const request = ++this.#request;
|
|
180
|
+
const source = this.#source;
|
|
181
|
+
const language = this.language;
|
|
182
|
+
// Plain text renders right away; tokens replace it when ready.
|
|
183
|
+
this.tokens = undefined;
|
|
184
|
+
this.#highlightDone = tokenize(source, language).then(async (tokens) => {
|
|
185
|
+
if (request !== this.#request)
|
|
186
|
+
return;
|
|
187
|
+
this.tokens = tokens;
|
|
188
|
+
await this.updateComplete;
|
|
189
|
+
this.dispatchEvent(new CustomEvent("tp-code-highlight", {
|
|
190
|
+
bubbles: true,
|
|
191
|
+
composed: true,
|
|
192
|
+
detail: { language, highlighted: !!tokens },
|
|
193
|
+
}));
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
__decorate([
|
|
198
|
+
property({ reflect: true }),
|
|
199
|
+
__metadata("design:type", String)
|
|
200
|
+
], CodeElement.prototype, "variant", void 0);
|
|
201
|
+
__decorate([
|
|
202
|
+
property({ reflect: true }),
|
|
203
|
+
__metadata("design:type", Object)
|
|
204
|
+
], CodeElement.prototype, "language", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
property({ type: Boolean, reflect: true, attribute: "line-numbers" }),
|
|
207
|
+
__metadata("design:type", Object)
|
|
208
|
+
], CodeElement.prototype, "lineNumbers", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: Number, attribute: "line-start" }),
|
|
211
|
+
__metadata("design:type", Object)
|
|
212
|
+
], CodeElement.prototype, "lineStart", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ attribute: "highlight-lines" }),
|
|
215
|
+
__metadata("design:type", Object)
|
|
216
|
+
], CodeElement.prototype, "highlightLines", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ type: Boolean, reflect: true }),
|
|
219
|
+
__metadata("design:type", Object)
|
|
220
|
+
], CodeElement.prototype, "copyable", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ attribute: false }),
|
|
223
|
+
__metadata("design:type", String)
|
|
224
|
+
], CodeElement.prototype, "code", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
state(),
|
|
227
|
+
__metadata("design:type", Object)
|
|
228
|
+
], CodeElement.prototype, "rawSource", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
state(),
|
|
231
|
+
__metadata("design:type", Array)
|
|
232
|
+
], CodeElement.prototype, "tokens", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
state(),
|
|
235
|
+
__metadata("design:type", Object)
|
|
236
|
+
], CodeElement.prototype, "copied", void 0);
|
|
237
|
+
|
|
238
|
+
export { CodeElement };
|
|
239
|
+
//# sourceMappingURL=code-element-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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A,MAAA,CAAA;AAId,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;;AACvB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAIpB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC1B,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAOjB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;;AACjB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAIN,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACe,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAGf,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACyB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAGzB,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;;AACe,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var bundledLanguageLoader = require('./bundled-language-loader.cjs');
|
|
4
|
+
var codeElementBase = require('./code-element-base.cjs');
|
|
5
|
+
var languageLoader = require('./language-loader.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Bundler entry for `<tp-code>`: grammars load lazily through Shiki's bundled
|
|
9
|
+
* `import()`s, so every language becomes its own chunk.
|
|
10
|
+
*/
|
|
11
|
+
languageLoader.setLanguageLoader(bundledLanguageLoader.bundledLanguageLoader);
|
|
12
|
+
if (!customElements.get("tp-code"))
|
|
13
|
+
customElements.define("tp-code", codeElementBase.CodeElement);
|
|
14
|
+
|
|
15
|
+
exports.CodeElement = codeElementBase.CodeElement;
|
|
16
|
+
//# sourceMappingURL=code-element.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-element.cjs","sources":["../../../../libs/elements/src/code/code-element.ts"],"sourcesContent":[null],"names":["setLanguageLoader","bundledLanguageLoader","CodeElement"],"mappings":";;;;;;AAIA;;;AAGG;AACHA,gCAAiB,CAACC,2CAAqB,CAAC;AAExC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;AAAE,IAAA,cAAc,CAAC,MAAM,CAAC,SAAS,EAAEC,2BAAW,CAAC;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { bundledLanguageLoader } from './bundled-language-loader.js';
|
|
2
|
+
import { CodeElement } from './code-element-base.js';
|
|
3
|
+
import { setLanguageLoader } from './language-loader.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Bundler entry for `<tp-code>`: grammars load lazily through Shiki's bundled
|
|
7
|
+
* `import()`s, so every language becomes its own chunk.
|
|
8
|
+
*/
|
|
9
|
+
setLanguageLoader(bundledLanguageLoader);
|
|
10
|
+
if (!customElements.get("tp-code"))
|
|
11
|
+
customElements.define("tp-code", CodeElement);
|
|
12
|
+
|
|
13
|
+
export { CodeElement };
|
|
14
|
+
//# sourceMappingURL=code-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-element.js","sources":["../../../../libs/elements/src/code/code-element.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA;;;AAGG;AACH,iBAAiB,CAAC,qBAAqB,CAAC;AAExC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC;AAAE,IAAA,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC;;;;"}
|
package/code/copy.cjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Writes `text` to the clipboard. Prefers the async Clipboard API and falls
|
|
5
|
+
* back to `document.execCommand("copy")` (insecure contexts, older browsers).
|
|
6
|
+
*
|
|
7
|
+
* @returns `true` when the text was copied.
|
|
8
|
+
*/
|
|
9
|
+
async function copyText(text) {
|
|
10
|
+
try {
|
|
11
|
+
if (navigator.clipboard?.writeText) {
|
|
12
|
+
await navigator.clipboard.writeText(text);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
/* permission denied / insecure context — try the legacy path */
|
|
18
|
+
}
|
|
19
|
+
return legacyCopy(text);
|
|
20
|
+
}
|
|
21
|
+
function legacyCopy(text) {
|
|
22
|
+
const textarea = document.createElement("textarea");
|
|
23
|
+
textarea.value = text;
|
|
24
|
+
textarea.setAttribute("readonly", "");
|
|
25
|
+
textarea.style.position = "fixed";
|
|
26
|
+
textarea.style.opacity = "0";
|
|
27
|
+
document.body.append(textarea);
|
|
28
|
+
try {
|
|
29
|
+
textarea.select();
|
|
30
|
+
return document.execCommand?.("copy") ?? false;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
textarea.remove();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.copyText = copyText;
|
|
41
|
+
//# sourceMappingURL=copy.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.cjs","sources":["../../../../libs/elements/src/code/copy.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AACI,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,IAAI;AACF,QAAA,IAAI,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE;YAClC,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AAEzC,YAAA,OAAO,IAAI;QACb;IACF;AAAE,IAAA,MAAM;;IAER;AAEA,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC;AACzB;AAEA,SAAS,UAAU,CAAC,IAAY,EAAA;IAC9B,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC;AAEnD,IAAA,QAAQ,CAAC,KAAK,GAAG,IAAI;AACrB,IAAA,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC;AACrC,IAAA,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO;AACjC,IAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG;AAC5B,IAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;AAE9B,IAAA,IAAI;QACF,QAAQ,CAAC,MAAM,EAAE;QAEjB,OAAO,QAAQ,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,KAAK;IAChD;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;YAAU;QACR,QAAQ,CAAC,MAAM,EAAE;IACnB;AACF;;;;"}
|
package/code/copy.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes `text` to the clipboard. Prefers the async Clipboard API and falls
|
|
3
|
+
* back to `document.execCommand("copy")` (insecure contexts, older browsers).
|
|
4
|
+
*
|
|
5
|
+
* @returns `true` when the text was copied.
|
|
6
|
+
*/
|
|
7
|
+
async function copyText(text) {
|
|
8
|
+
try {
|
|
9
|
+
if (navigator.clipboard?.writeText) {
|
|
10
|
+
await navigator.clipboard.writeText(text);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
/* permission denied / insecure context — try the legacy path */
|
|
16
|
+
}
|
|
17
|
+
return legacyCopy(text);
|
|
18
|
+
}
|
|
19
|
+
function legacyCopy(text) {
|
|
20
|
+
const textarea = document.createElement("textarea");
|
|
21
|
+
textarea.value = text;
|
|
22
|
+
textarea.setAttribute("readonly", "");
|
|
23
|
+
textarea.style.position = "fixed";
|
|
24
|
+
textarea.style.opacity = "0";
|
|
25
|
+
document.body.append(textarea);
|
|
26
|
+
try {
|
|
27
|
+
textarea.select();
|
|
28
|
+
return document.execCommand?.("copy") ?? false;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
textarea.remove();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { copyText };
|
|
39
|
+
//# sourceMappingURL=copy.js.map
|
package/code/copy.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.js","sources":["../../../../libs/elements/src/code/copy.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;AAKG;AACI,eAAe,QAAQ,CAAC,IAAY,EAAA;AACzC,IAAA,IAAI;AACF,QAAA,IAAI,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE;YAClC,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AAEzC,YAAA,OAAO,IAAI;QACb;IACF;AAAE,IAAA,MAAM;;IAER;AAEA,IAAA,OAAO,UAAU,CAAC,IAAI,CAAC;AACzB;AAEA,SAAS,UAAU,CAAC,IAAY,EAAA;IAC9B,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC;AAEnD,IAAA,QAAQ,CAAC,KAAK,GAAG,IAAI;AACrB,IAAA,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,EAAE,CAAC;AACrC,IAAA,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO;AACjC,IAAA,QAAQ,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG;AAC5B,IAAA,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;AAE9B,IAAA,IAAI;QACF,QAAQ,CAAC,MAAM,EAAE;QAEjB,OAAO,QAAQ,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,KAAK;IAChD;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;YAAU;QACR,QAAQ,CAAC,MAAM,EAAE;IACnB;AACF;;;;"}
|