@imfusion/web-ui 0.5.1-dev.45.gf3889fa8 → 0.5.1-dev.47.gb58b7411
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.
|
@@ -4,4 +4,4 @@ export type LanguagePattern = {
|
|
|
4
4
|
group?: number;
|
|
5
5
|
regex: RegExp;
|
|
6
6
|
};
|
|
7
|
-
export declare function collectPatternRanges(code: string, patterns: readonly LanguagePattern[]): TokenRange[];
|
|
7
|
+
export declare function collectPatternRanges(code: string, patterns: readonly LanguagePattern[], initialRanges?: readonly TokenRange[]): TokenRange[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const python: import('@tanstack/highlight/core').LanguageDefinition<"python">;
|
|
@@ -6,37 +6,38 @@ import { createHighlighter as s, defineLanguage as c, renderNodesToHtml as l, re
|
|
|
6
6
|
import { css as d } from "@tanstack/highlight/languages/css";
|
|
7
7
|
import { json as f } from "@tanstack/highlight/languages/json";
|
|
8
8
|
import { plaintext as p } from "@tanstack/highlight/languages/plaintext";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
import { shell as m } from "@tanstack/highlight/languages/shell";
|
|
10
|
+
import { ts as h } from "@tanstack/highlight/languages/ts";
|
|
11
|
+
import { tsx as g } from "@tanstack/highlight/languages/tsx";
|
|
12
|
+
import { python as _ } from "@tanstack/highlight/languages/python";
|
|
13
13
|
//#region src/integrations/code-highlight/language-patterns.ts
|
|
14
|
-
function v(e, t) {
|
|
15
|
-
let
|
|
16
|
-
for (let
|
|
17
|
-
|
|
14
|
+
function v(e, t, n = []) {
|
|
15
|
+
let r = [], i = new Uint8Array(e.length);
|
|
16
|
+
for (let { start: e, end: t } of n) i.fill(1, e, t);
|
|
17
|
+
for (let n of t) {
|
|
18
|
+
let t = new RegExp(n.regex.source, n.regex.flags.includes("g") ? n.regex.flags : `${n.regex.flags}g`), a;
|
|
18
19
|
for (; (a = t.exec(e)) !== null;) {
|
|
19
|
-
let e =
|
|
20
|
+
let e = n.group == null ? a[0] : a[n.group];
|
|
20
21
|
if (e === "") {
|
|
21
22
|
a[0] === "" && (t.lastIndex += 1);
|
|
22
23
|
continue;
|
|
23
24
|
}
|
|
24
|
-
let o =
|
|
25
|
+
let o = n.group == null ? 0 : a[0].indexOf(e), s = a.index + o, c = s + e.length;
|
|
25
26
|
if (s < c) {
|
|
26
27
|
let e = !1;
|
|
27
|
-
for (let t = s; t < c; t += 1) if (
|
|
28
|
+
for (let t = s; t < c; t += 1) if (i[t]) {
|
|
28
29
|
e = !0;
|
|
29
30
|
break;
|
|
30
31
|
}
|
|
31
|
-
e || (
|
|
32
|
+
e || (r.push({
|
|
32
33
|
start: s,
|
|
33
34
|
end: c,
|
|
34
|
-
className:
|
|
35
|
-
}),
|
|
35
|
+
className: n.className
|
|
36
|
+
}), i.fill(1, s, c));
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
return
|
|
40
|
+
return r;
|
|
40
41
|
}
|
|
41
42
|
//#endregion
|
|
42
43
|
//#region src/integrations/code-highlight/languages/cmake.ts
|
|
@@ -126,7 +127,17 @@ var y = [
|
|
|
126
127
|
tokenize(e) {
|
|
127
128
|
return v(e, x);
|
|
128
129
|
}
|
|
129
|
-
}), C = {
|
|
130
|
+
}), C = [{
|
|
131
|
+
className: "function",
|
|
132
|
+
regex: /\b[A-Za-z_]\w*(?=\s*\()/g
|
|
133
|
+
}], w = c({
|
|
134
|
+
name: "python",
|
|
135
|
+
aliases: ["py"],
|
|
136
|
+
tokenize(e, t) {
|
|
137
|
+
let n = _.tokenize(e, t), r = v(e, C, n);
|
|
138
|
+
return [...n, ...r];
|
|
139
|
+
}
|
|
140
|
+
}), T = {
|
|
130
141
|
tsx: { aliases: ["typescriptreact"] },
|
|
131
142
|
ts: { aliases: ["typescript"] },
|
|
132
143
|
css: { aliases: ["scss"] },
|
|
@@ -145,49 +156,49 @@ var y = [
|
|
|
145
156
|
] },
|
|
146
157
|
python: { aliases: ["py"] },
|
|
147
158
|
cmake: { aliases: [] }
|
|
148
|
-
},
|
|
149
|
-
function
|
|
150
|
-
return
|
|
159
|
+
}, E = Object.keys(T), D = [...E, ...Object.values(T).flatMap(({ aliases: e }) => e)];
|
|
160
|
+
function O(e) {
|
|
161
|
+
return D.includes(e);
|
|
151
162
|
}
|
|
152
|
-
function
|
|
163
|
+
function k(e, t) {
|
|
153
164
|
return e.aliases.includes(t);
|
|
154
165
|
}
|
|
155
|
-
function
|
|
156
|
-
for (let [t, n] of Object.entries(
|
|
166
|
+
function A(e) {
|
|
167
|
+
for (let [t, n] of Object.entries(T)) if (k(n, e)) return t;
|
|
157
168
|
return e;
|
|
158
169
|
}
|
|
159
|
-
var
|
|
170
|
+
var j = s({
|
|
160
171
|
languages: [
|
|
161
|
-
_,
|
|
162
172
|
g,
|
|
163
|
-
d,
|
|
164
173
|
h,
|
|
174
|
+
d,
|
|
175
|
+
m,
|
|
165
176
|
f,
|
|
166
177
|
S,
|
|
167
|
-
|
|
178
|
+
w,
|
|
168
179
|
b,
|
|
169
180
|
p
|
|
170
181
|
],
|
|
171
182
|
fallbackLanguage: "plaintext"
|
|
172
183
|
});
|
|
173
|
-
function
|
|
174
|
-
let n =
|
|
184
|
+
function M(e, t) {
|
|
185
|
+
let n = A(t), { tokens: r } = j.tokenize(e, { lang: n });
|
|
175
186
|
return l(u(r));
|
|
176
187
|
}
|
|
177
188
|
//#endregion
|
|
178
189
|
//#region src/integrations/code-highlight/code-highlight.tsx
|
|
179
|
-
var
|
|
180
|
-
Block: () =>
|
|
181
|
-
Inline: () =>
|
|
190
|
+
var N = /* @__PURE__ */ e({
|
|
191
|
+
Block: () => F,
|
|
192
|
+
Inline: () => I,
|
|
182
193
|
InlineLink: () => n
|
|
183
194
|
});
|
|
184
|
-
function
|
|
195
|
+
function P(e, t) {
|
|
185
196
|
return a(() => {
|
|
186
|
-
if (!(t == null || e === "")) return /* @__PURE__ */ o("span", { dangerouslySetInnerHTML: { __html:
|
|
197
|
+
if (!(t == null || e === "")) return /* @__PURE__ */ o("span", { dangerouslySetInnerHTML: { __html: M(e, t) } });
|
|
187
198
|
}, [e, t]);
|
|
188
199
|
}
|
|
189
|
-
function
|
|
190
|
-
let i =
|
|
200
|
+
function F({ language: e, children: t, ...n }) {
|
|
201
|
+
let i = P(t, e);
|
|
191
202
|
return /* @__PURE__ */ o(r, {
|
|
192
203
|
...n,
|
|
193
204
|
language: e,
|
|
@@ -195,19 +206,19 @@ function N({ language: e, children: t, ...n }) {
|
|
|
195
206
|
children: t
|
|
196
207
|
});
|
|
197
208
|
}
|
|
198
|
-
|
|
199
|
-
function
|
|
200
|
-
let r =
|
|
209
|
+
F.displayName = "Code.Block";
|
|
210
|
+
function I({ language: e, children: t, ...n }) {
|
|
211
|
+
let r = P(t, e);
|
|
201
212
|
return /* @__PURE__ */ o(i, {
|
|
202
213
|
...n,
|
|
203
214
|
highlighted: r,
|
|
204
215
|
children: t
|
|
205
216
|
});
|
|
206
217
|
}
|
|
207
|
-
|
|
218
|
+
I.displayName = "Code.Inline";
|
|
208
219
|
//#endregion
|
|
209
220
|
//#region src/integrations/code-highlight/code-highlight.meta.ts
|
|
210
|
-
var
|
|
221
|
+
var L = {
|
|
211
222
|
name: "CodeHighlight",
|
|
212
223
|
category: t.display,
|
|
213
224
|
status: "experimental",
|
|
@@ -223,4 +234,4 @@ var F = {
|
|
|
223
234
|
}
|
|
224
235
|
};
|
|
225
236
|
//#endregion
|
|
226
|
-
export {
|
|
237
|
+
export { N as Code, E as SUPPORTED_LANGUAGES, L as codeHighlightMeta, O as isSupportedLanguage };
|