@imfusion/web-ui 0.6.4-dev.36.ga02df89a → 0.6.4-dev.38.gc77c6321
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/integrations/code-highlight/highlighter.d.ts +1 -56
- package/dist/integrations/code-highlight.js +39 -187
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/src/docgen/doc.gen.json +2 -2
- package/dist/integrations/code-highlight/languages/cmake.d.ts +0 -1
- package/dist/integrations/code-highlight/languages/cpp.d.ts +0 -1
|
@@ -1,59 +1,4 @@
|
|
|
1
|
-
declare const LANGUAGE_DEFINITIONS: {
|
|
2
|
-
readonly tsx: {
|
|
3
|
-
readonly aliases: readonly ["typescriptreact"];
|
|
4
|
-
};
|
|
5
|
-
readonly ts: {
|
|
6
|
-
readonly aliases: readonly ["typescript"];
|
|
7
|
-
};
|
|
8
|
-
readonly css: {
|
|
9
|
-
readonly aliases: readonly ["scss"];
|
|
10
|
-
};
|
|
11
|
-
readonly shell: {
|
|
12
|
-
readonly aliases: readonly ["bash", "sh", "zsh", "shellscript"];
|
|
13
|
-
};
|
|
14
|
-
readonly json: {
|
|
15
|
-
readonly aliases: readonly [];
|
|
16
|
-
};
|
|
17
|
-
readonly cpp: {
|
|
18
|
-
readonly aliases: readonly ["c++", "cc", "cxx", "hpp"];
|
|
19
|
-
};
|
|
20
|
-
readonly python: {
|
|
21
|
-
readonly aliases: readonly ["py"];
|
|
22
|
-
};
|
|
23
|
-
readonly cmake: {
|
|
24
|
-
readonly aliases: readonly [];
|
|
25
|
-
};
|
|
26
|
-
readonly html: {
|
|
27
|
-
readonly aliases: readonly ["htm", "xml", "angular-html"];
|
|
28
|
-
};
|
|
29
|
-
readonly js: {
|
|
30
|
-
readonly aliases: readonly ["javascript", "mjs", "cjs", "js-vue"];
|
|
31
|
-
};
|
|
32
|
-
readonly jsx: {
|
|
33
|
-
readonly aliases: readonly [];
|
|
34
|
-
};
|
|
35
|
-
readonly markdown: {
|
|
36
|
-
readonly aliases: readonly ["md"];
|
|
37
|
-
};
|
|
38
|
-
readonly yaml: {
|
|
39
|
-
readonly aliases: readonly ["yml"];
|
|
40
|
-
};
|
|
41
|
-
readonly sql: {
|
|
42
|
-
readonly aliases: readonly [];
|
|
43
|
-
};
|
|
44
|
-
readonly dockerfile: {
|
|
45
|
-
readonly aliases: readonly [];
|
|
46
|
-
};
|
|
47
|
-
readonly toml: {
|
|
48
|
-
readonly aliases: readonly [];
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
1
|
export declare const SUPPORTED_LANGUAGES: string[];
|
|
52
|
-
type
|
|
53
|
-
type LanguageAlias = {
|
|
54
|
-
[Language in CanonicalLanguage]: (typeof LANGUAGE_DEFINITIONS)[Language]["aliases"][number];
|
|
55
|
-
}[CanonicalLanguage];
|
|
56
|
-
export type SupportedLanguage = CanonicalLanguage | LanguageAlias;
|
|
2
|
+
export type SupportedLanguage = string;
|
|
57
3
|
export declare function isSupportedLanguage(value: string): value is SupportedLanguage;
|
|
58
4
|
export declare function highlightToHtml(code: string, language: SupportedLanguage): string;
|
|
59
|
-
export {};
|
|
@@ -4,23 +4,10 @@ import { i as n, n as r, r as i } from "../code-D2lwxHgd.js";
|
|
|
4
4
|
import { jsx as a } from "react/jsx-runtime";
|
|
5
5
|
import { cloneElement as o, useMemo as s } from "react";
|
|
6
6
|
import { createHighlighter as c, defineLanguage as l, renderNodesToHtml as u, renderTokens as d } from "@tanstack/highlight/core";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { html as m } from "@tanstack/highlight/languages/html";
|
|
10
|
-
import { js as h } from "@tanstack/highlight/languages/js";
|
|
11
|
-
import { jsx as g } from "@tanstack/highlight/languages/jsx";
|
|
12
|
-
import { json as _ } from "@tanstack/highlight/languages/json";
|
|
13
|
-
import { markdown as v } from "@tanstack/highlight/languages/markdown";
|
|
14
|
-
import { plaintext as y } from "@tanstack/highlight/languages/plaintext";
|
|
15
|
-
import { shell as b } from "@tanstack/highlight/languages/shell";
|
|
16
|
-
import { sql as x } from "@tanstack/highlight/languages/sql";
|
|
17
|
-
import { toml as S } from "@tanstack/highlight/languages/toml";
|
|
18
|
-
import { ts as C } from "@tanstack/highlight/languages/ts";
|
|
19
|
-
import { tsx as w } from "@tanstack/highlight/languages/tsx";
|
|
20
|
-
import { yaml as T } from "@tanstack/highlight/languages/yaml";
|
|
21
|
-
import { python as E } from "@tanstack/highlight/languages/python";
|
|
7
|
+
import * as f from "@tanstack/highlight/languages";
|
|
8
|
+
import { python as p } from "@tanstack/highlight/languages/python";
|
|
22
9
|
//#region src/integrations/code-highlight/language-patterns.ts
|
|
23
|
-
function
|
|
10
|
+
function m(e, t, n = []) {
|
|
24
11
|
let r = [], i = new Uint8Array(e.length);
|
|
25
12
|
for (let { start: e, end: t } of n) i.fill(1, e, t);
|
|
26
13
|
for (let n of t) {
|
|
@@ -49,208 +36,73 @@ function D(e, t, n = []) {
|
|
|
49
36
|
return r;
|
|
50
37
|
}
|
|
51
38
|
//#endregion
|
|
52
|
-
//#region src/integrations/code-highlight/languages/
|
|
53
|
-
var
|
|
54
|
-
{
|
|
55
|
-
className: "string",
|
|
56
|
-
regex: /"(?:\\.|[^"\\\n])*"|\[(=*)\[[\s\S]*?\]\1\]/g
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
className: "comment",
|
|
60
|
-
regex: /#[^\n]*/g
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
className: "variable",
|
|
64
|
-
regex: /\$(?:ENV|CACHE)?\{[^}\n]+\}/g
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
className: "keyword",
|
|
68
|
-
regex: /\b(?:break|continue|else|elseif|endforeach|endfunction|endif|endmacro|endwhile|if|include|macro|return|while)\b/gi
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
className: "literal",
|
|
72
|
-
regex: /\b(?:FALSE|IGNORE|NOTFOUND|NO|OFF|ON|TRUE|YES)\b/gi
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
className: "function",
|
|
76
|
-
regex: /\b[A-Za-z_][\w-]*(?=\s*\()/g
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
className: "number",
|
|
80
|
-
regex: /\b\d+(?:\.\d+)?\b/g
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
className: "operator",
|
|
84
|
-
regex: /(?:LESS_EQUAL|GREATER_EQUAL|STREQUAL|IN_LIST|MATCHES|EQUAL|LESS|GREATER|AND|OR|NOT|[=<>+*/!-])/gi
|
|
85
|
-
}
|
|
86
|
-
], k = l({
|
|
87
|
-
name: "cmake",
|
|
88
|
-
tokenize(e) {
|
|
89
|
-
return D(e, O);
|
|
90
|
-
}
|
|
91
|
-
}), A = [
|
|
92
|
-
{
|
|
93
|
-
className: "comment",
|
|
94
|
-
regex: /\/\/[^\n]*|\/\*[\s\S]*?\*\//g
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
className: "string",
|
|
98
|
-
regex: /"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'/g
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
className: "meta",
|
|
102
|
-
regex: /^[ \t]*#[ \t]*(?:include|define|if|ifdef|ifndef|elif|else|endif|pragma|undef|error|warning)\b/gm
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
className: "keyword",
|
|
106
|
-
regex: /\b(?:alignas|alignof|and|asm|atomic_cancel|atomic_commit|atomic_noexcept|auto|bitand|bitor|break|case|catch|co_await|co_return|co_yield|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|default|delete|do|dynamic_cast|else|enum|explicit|export|extern|for|friend|goto|if|inline|mutable|namespace|new|noexcept|not|operator|or|private|protected|public|reflexpr|register|reinterpret_cast|requires|return|sizeof|static|static_assert|static_cast|struct|switch|synchronized|template|this|thread_local|throw|try|typedef|typeid|typename|union|using|virtual|volatile|while|xor)\b/g
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
className: "type",
|
|
110
|
-
regex: /\b(?:bool|char|char8_t|char16_t|char32_t|double|float|int|long|short|signed|unsigned|void|wchar_t)\b/g
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
className: "literal",
|
|
114
|
-
regex: /\b(?:NULL|nullptr|true|false)\b/g
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
className: "function",
|
|
118
|
-
regex: /\b[A-Za-z_]\w*(?=\s*\()/g
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
className: "number",
|
|
122
|
-
regex: /\b(?:0[xX][\da-fA-F']+|0[bB][01']+|\d[\d']*(?:\.\d[\d']*)?(?:[eE][+-]?\d[\d']*)?[uUlLfF]*)\b/g
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
className: "operator",
|
|
126
|
-
regex: /(?:<<=?|>>=?|->\*|->|\+\+|--|&&|\|\||==|!=|<=|>=|::|\+=|-=|\*=|\/=|%=|&=|\|=|\^=|[-+*/%=&|^!<>?:~])/g
|
|
127
|
-
}
|
|
128
|
-
], j = l({
|
|
129
|
-
name: "cpp",
|
|
130
|
-
aliases: [
|
|
131
|
-
"c++",
|
|
132
|
-
"cc",
|
|
133
|
-
"cxx",
|
|
134
|
-
"hpp"
|
|
135
|
-
],
|
|
136
|
-
tokenize(e) {
|
|
137
|
-
return D(e, A);
|
|
138
|
-
}
|
|
139
|
-
}), M = [{
|
|
39
|
+
//#region src/integrations/code-highlight/languages/python.ts
|
|
40
|
+
var h = [{
|
|
140
41
|
className: "function",
|
|
141
42
|
regex: /\b[A-Za-z_]\w*(?=\s*\()/g
|
|
142
|
-
}],
|
|
43
|
+
}], g = l({
|
|
143
44
|
name: "python",
|
|
144
45
|
aliases: ["py"],
|
|
145
46
|
tokenize(e, t) {
|
|
146
|
-
let n =
|
|
47
|
+
let n = p.tokenize(e, t), r = m(e, h, n);
|
|
147
48
|
return [...n, ...r];
|
|
148
49
|
}
|
|
149
|
-
}),
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
cpp: { aliases: [
|
|
161
|
-
"c++",
|
|
162
|
-
"cc",
|
|
163
|
-
"cxx",
|
|
164
|
-
"hpp"
|
|
165
|
-
] },
|
|
166
|
-
python: { aliases: ["py"] },
|
|
167
|
-
cmake: { aliases: [] },
|
|
168
|
-
html: { aliases: [
|
|
169
|
-
"htm",
|
|
170
|
-
"xml",
|
|
171
|
-
"angular-html"
|
|
172
|
-
] },
|
|
173
|
-
js: { aliases: [
|
|
174
|
-
"javascript",
|
|
175
|
-
"mjs",
|
|
176
|
-
"cjs",
|
|
177
|
-
"js-vue"
|
|
178
|
-
] },
|
|
179
|
-
jsx: { aliases: [] },
|
|
180
|
-
markdown: { aliases: ["md"] },
|
|
181
|
-
yaml: { aliases: ["yml"] },
|
|
182
|
-
sql: { aliases: [] },
|
|
183
|
-
dockerfile: { aliases: [] },
|
|
184
|
-
toml: { aliases: [] }
|
|
185
|
-
}, F = Object.keys(P), I = [...F, ...Object.values(P).flatMap(({ aliases: e }) => e)];
|
|
186
|
-
function L(e) {
|
|
187
|
-
return I.includes(e);
|
|
188
|
-
}
|
|
189
|
-
function R(e, t) {
|
|
190
|
-
return e.aliases.includes(t);
|
|
50
|
+
}), _ = {
|
|
51
|
+
css: ["scss"],
|
|
52
|
+
shell: ["shellscript"],
|
|
53
|
+
tsx: ["typescriptreact"]
|
|
54
|
+
};
|
|
55
|
+
function v(e) {
|
|
56
|
+
let t = _[e.name];
|
|
57
|
+
return t == null ? e : {
|
|
58
|
+
...e,
|
|
59
|
+
aliases: [...e.aliases ?? [], ...t]
|
|
60
|
+
};
|
|
191
61
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
return e;
|
|
62
|
+
var y = Object.values(f).map((e) => e.name === g.name ? g : e).map(v), b = [...new Set(y.flatMap(({ aliases: e = [], name: t }) => [t, ...e]))];
|
|
63
|
+
function x(e) {
|
|
64
|
+
return b.some((t) => t.toLowerCase() === e.trim().toLowerCase());
|
|
195
65
|
}
|
|
196
|
-
var
|
|
197
|
-
languages:
|
|
198
|
-
w,
|
|
199
|
-
C,
|
|
200
|
-
f,
|
|
201
|
-
b,
|
|
202
|
-
_,
|
|
203
|
-
j,
|
|
204
|
-
N,
|
|
205
|
-
k,
|
|
206
|
-
m,
|
|
207
|
-
h,
|
|
208
|
-
g,
|
|
209
|
-
v,
|
|
210
|
-
T,
|
|
211
|
-
x,
|
|
212
|
-
p,
|
|
213
|
-
S,
|
|
214
|
-
y
|
|
215
|
-
],
|
|
66
|
+
var S = c({
|
|
67
|
+
languages: y,
|
|
216
68
|
fallbackLanguage: "plaintext"
|
|
217
69
|
});
|
|
218
|
-
function
|
|
219
|
-
let
|
|
220
|
-
return u(d(
|
|
70
|
+
function C(e, t) {
|
|
71
|
+
let { tokens: n } = S.tokenize(e, { lang: t });
|
|
72
|
+
return u(d(n));
|
|
221
73
|
}
|
|
222
74
|
//#endregion
|
|
223
75
|
//#region src/integrations/code-highlight/code-highlight.tsx
|
|
224
|
-
var
|
|
225
|
-
Block: () =>
|
|
226
|
-
Inline: () =>
|
|
76
|
+
var w = /* @__PURE__ */ e({
|
|
77
|
+
Block: () => E,
|
|
78
|
+
Inline: () => D,
|
|
227
79
|
InlineLink: () => n
|
|
228
80
|
});
|
|
229
|
-
function
|
|
81
|
+
function T(e, t) {
|
|
230
82
|
return s(() => {
|
|
231
|
-
if (!(t == null || e === "")) return /* @__PURE__ */ a("span", { dangerouslySetInnerHTML: { __html:
|
|
83
|
+
if (!(t == null || e === "")) return /* @__PURE__ */ a("span", { dangerouslySetInnerHTML: { __html: C(e, t) } });
|
|
232
84
|
}, [e, t]);
|
|
233
85
|
}
|
|
234
|
-
function
|
|
235
|
-
let i =
|
|
86
|
+
function E({ language: e, children: t, ...n }) {
|
|
87
|
+
let i = T(t, e);
|
|
236
88
|
return o(/* @__PURE__ */ a(r, {
|
|
237
89
|
...n,
|
|
238
90
|
language: e,
|
|
239
91
|
children: t
|
|
240
92
|
}), { children: i ?? t });
|
|
241
93
|
}
|
|
242
|
-
|
|
243
|
-
function
|
|
244
|
-
let r =
|
|
94
|
+
E.displayName = "Code.Block";
|
|
95
|
+
function D({ language: e, children: t, ...n }) {
|
|
96
|
+
let r = T(t, e);
|
|
245
97
|
return o(/* @__PURE__ */ a(i, {
|
|
246
98
|
...n,
|
|
247
99
|
children: t
|
|
248
100
|
}), { children: r ?? t });
|
|
249
101
|
}
|
|
250
|
-
|
|
102
|
+
D.displayName = "Code.Inline";
|
|
251
103
|
//#endregion
|
|
252
104
|
//#region src/integrations/code-highlight/code-highlight.meta.ts
|
|
253
|
-
var
|
|
105
|
+
var O = {
|
|
254
106
|
name: "CodeHighlight",
|
|
255
107
|
category: t.display,
|
|
256
108
|
status: "experimental",
|
|
@@ -266,4 +118,4 @@ var K = {
|
|
|
266
118
|
}
|
|
267
119
|
};
|
|
268
120
|
//#endregion
|
|
269
|
-
export {
|
|
121
|
+
export { w as Code, b as SUPPORTED_LANGUAGES, O as codeHighlightMeta, x as isSupportedLanguage };
|