@sveltia/ui 0.75.6 → 0.76.1
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/components/text-editor/shiki/version.d.ts +1 -1
- package/dist/components/text-editor/shiki/version.js +1 -1
- package/dist/components/util/font-links.svelte +9 -3
- package/dist/components/util/font-links.svelte.d.ts +7 -0
- package/dist/components/util/fonts.d.ts +19 -0
- package/dist/components/util/fonts.js +168 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/self-hosted/fonts/material-symbols-outlined-latin-wght-normal.woff2 +0 -0
- package/dist/self-hosted/fonts/material-symbols-outlined.LICENSE.txt +93 -0
- package/dist/self-hosted/fonts/noto-mono-latin-400-normal.woff2 +0 -0
- package/dist/self-hosted/fonts/noto-mono.LICENSE.txt +94 -0
- package/dist/self-hosted/fonts/source-sans-3-latin-wght-normal.woff2 +0 -0
- package/dist/self-hosted/fonts/source-sans-3.LICENSE.txt +93 -0
- package/dist/self-hosted/generated.d.ts +12 -0
- package/dist/self-hosted/generated.js +261 -0
- package/dist/self-hosted/index.d.ts +1 -0
- package/dist/self-hosted/index.js +47 -0
- package/dist/shiki-engine.d.ts +6 -0
- package/dist/typedefs.d.ts +46 -0
- package/dist/typedefs.js +16 -0
- package/package.json +16 -3
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Load the web fonts used by the components from the Fontsource CDN. The `@font-face` rules are
|
|
4
|
+
static, so they end up in the app’s stylesheet; fonts set with `setFontURLs()`, e.g. by
|
|
5
|
+
`@sveltia/ui/self-hosted`, take precedence over them. See `fonts.js` for the definitions, which a
|
|
6
|
+
test keeps in sync with the rules. There’s no `preconnect` hint: the rules and the text using the
|
|
7
|
+
fonts are rendered at the same time, so it wouldn’t start the connection any earlier.
|
|
8
|
+
-->
|
|
3
9
|
<style>
|
|
4
10
|
/* https://fontsource.org/fonts/source-sans-3/cdn */
|
|
5
11
|
@font-face {
|
|
@@ -31,7 +37,7 @@
|
|
|
31
37
|
font-style: normal;
|
|
32
38
|
font-display: block;
|
|
33
39
|
font-weight: 400;
|
|
34
|
-
src: url(https://cdn.jsdelivr.net/fontsource/fonts/material-symbols-outlined:vf@5.3.
|
|
40
|
+
src: url(https://cdn.jsdelivr.net/fontsource/fonts/material-symbols-outlined:vf@5.3.7/latin-wght-normal.woff2)
|
|
35
41
|
format('woff2-variations');
|
|
36
42
|
unicode-range:
|
|
37
43
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
@@ -6,6 +6,13 @@ type FontLinks = SvelteComponent<{
|
|
|
6
6
|
}, {}> & {
|
|
7
7
|
$$bindings?: string | undefined;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Load the web fonts used by the components from the Fontsource CDN. The `@font-face` rules are
|
|
11
|
+
* static, so they end up in the app’s stylesheet; fonts set with `setFontURLs()`, e.g. by
|
|
12
|
+
* `@sveltia/ui/self-hosted`, take precedence over them. See `fonts.js` for the definitions, which a
|
|
13
|
+
* test keeps in sync with the rules. There’s no `preconnect` hint: the rules and the text using the
|
|
14
|
+
* fonts are rendered at the same time, so it wouldn’t start the connection any earlier.
|
|
15
|
+
*/
|
|
9
16
|
declare const FontLinks: $$__sveltets_2_IsomorphicComponent<{
|
|
10
17
|
[x: string]: never;
|
|
11
18
|
}, {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { FontDefinition } from '../../typedefs';
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Base URL of the Fontsource files on jsDelivr, from which the fonts are loaded by default.
|
|
6
|
+
* @see https://fontsource.org/docs/getting-started/cdn
|
|
7
|
+
*/
|
|
8
|
+
export const FONT_CDN_BASE_URL: "https://cdn.jsdelivr.net/fontsource/fonts";
|
|
9
|
+
/**
|
|
10
|
+
* Web fonts used by the components. Each version is kept in sync with the Fontsource package in
|
|
11
|
+
* `devDependencies` by `scripts/copy-fonts.js`, which also copies the file for self-hosting.
|
|
12
|
+
* @type {FontDefinition[]}
|
|
13
|
+
*/
|
|
14
|
+
export const FONTS: FontDefinition[];
|
|
15
|
+
export function getFontFileName({ packageName, subset }: FontDefinition): string;
|
|
16
|
+
export function getCDNFontURL({ cdnId, version, subset }: FontDefinition): string;
|
|
17
|
+
export function getFontFaceDescriptors({ weight, display, unicodeRange, sizeAdjust }: FontDefinition): FontFaceDescriptors;
|
|
18
|
+
export function setFontURLs(urls: Record<string, string>): void;
|
|
19
|
+
import type { FontDefinition } from '../../typedefs';
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import { FontDefinition } from '../../typedefs';
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base URL of the Fontsource files on jsDelivr, from which the fonts are loaded by default.
|
|
7
|
+
* @see https://fontsource.org/docs/getting-started/cdn
|
|
8
|
+
*/
|
|
9
|
+
export const FONT_CDN_BASE_URL = 'https://cdn.jsdelivr.net/fontsource/fonts';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Get the Unicode range of the Latin subset, which is the only one we use. It varies slightly by
|
|
13
|
+
* font, as Fontsource only lists the code points a font covers.
|
|
14
|
+
* @param {string[]} [extra] Extra code points covered by the font.
|
|
15
|
+
* @returns {string} Unicode range.
|
|
16
|
+
*/
|
|
17
|
+
const getLatinUnicodeRange = (extra = []) =>
|
|
18
|
+
[
|
|
19
|
+
'U+0000-00FF',
|
|
20
|
+
'U+0131',
|
|
21
|
+
'U+0152-0153',
|
|
22
|
+
'U+02BB-02BC',
|
|
23
|
+
'U+02C6',
|
|
24
|
+
'U+02DA',
|
|
25
|
+
'U+02DC',
|
|
26
|
+
'U+0304',
|
|
27
|
+
'U+0308',
|
|
28
|
+
'U+0329',
|
|
29
|
+
'U+2000-206F',
|
|
30
|
+
...extra,
|
|
31
|
+
'U+20AC',
|
|
32
|
+
'U+2122',
|
|
33
|
+
'U+2191',
|
|
34
|
+
'U+2193',
|
|
35
|
+
'U+2212',
|
|
36
|
+
'U+2215',
|
|
37
|
+
'U+FEFF',
|
|
38
|
+
'U+FFFD',
|
|
39
|
+
].join(', ');
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Web fonts used by the components. Each version is kept in sync with the Fontsource package in
|
|
43
|
+
* `devDependencies` by `scripts/copy-fonts.js`, which also copies the file for self-hosting.
|
|
44
|
+
* @type {FontDefinition[]}
|
|
45
|
+
*/
|
|
46
|
+
export const FONTS = [
|
|
47
|
+
{
|
|
48
|
+
family: 'Source Sans 3',
|
|
49
|
+
packageName: '@fontsource-variable/source-sans-3',
|
|
50
|
+
version: '5.3.0',
|
|
51
|
+
cdnId: 'source-sans-3:vf',
|
|
52
|
+
subset: 'latin-wght-normal',
|
|
53
|
+
format: 'woff2-variations',
|
|
54
|
+
weight: '200 900',
|
|
55
|
+
display: 'swap',
|
|
56
|
+
unicodeRange: getLatinUnicodeRange(),
|
|
57
|
+
sizeAdjust: '110%',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
family: 'Noto Mono',
|
|
61
|
+
packageName: '@fontsource/noto-mono',
|
|
62
|
+
version: '5.3.0',
|
|
63
|
+
cdnId: 'noto-mono',
|
|
64
|
+
subset: 'latin-400-normal',
|
|
65
|
+
format: 'woff2',
|
|
66
|
+
weight: '400',
|
|
67
|
+
display: 'swap',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
family: 'Material Symbols Outlined',
|
|
71
|
+
packageName: '@fontsource-variable/material-symbols-outlined',
|
|
72
|
+
version: '5.3.7',
|
|
73
|
+
cdnId: 'material-symbols-outlined:vf',
|
|
74
|
+
subset: 'latin-wght-normal',
|
|
75
|
+
format: 'woff2-variations',
|
|
76
|
+
weight: '400',
|
|
77
|
+
display: 'block',
|
|
78
|
+
unicodeRange: getLatinUnicodeRange(['U+2074']),
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get the name of a font file, as published in the Fontsource package, e.g.
|
|
84
|
+
* `source-sans-3-latin-wght-normal.woff2`.
|
|
85
|
+
* @param {FontDefinition} font Font.
|
|
86
|
+
* @returns {string} File name.
|
|
87
|
+
*/
|
|
88
|
+
export const getFontFileName = ({ packageName, subset }) =>
|
|
89
|
+
`${packageName.split('/')[1]}-${subset}.woff2`;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the URL of a font file on the CDN.
|
|
93
|
+
* @param {FontDefinition} font Font.
|
|
94
|
+
* @returns {string} URL.
|
|
95
|
+
*/
|
|
96
|
+
export const getCDNFontURL = ({ cdnId, version, subset }) =>
|
|
97
|
+
`${FONT_CDN_BASE_URL}/${cdnId}@${version}/${subset}.woff2`;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Font faces registered with {@link setFontURLs}, removed again when the URLs are replaced.
|
|
101
|
+
* @type {FontFace[]}
|
|
102
|
+
*/
|
|
103
|
+
let registeredFontFaces = [];
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get the descriptors of a font, as `@font-face` in `font-links.svelte` declares them for the CDN.
|
|
107
|
+
* A registered font face only takes over from the CDN one if they match.
|
|
108
|
+
* @param {FontDefinition} font Font.
|
|
109
|
+
* @returns {FontFaceDescriptors} Descriptors.
|
|
110
|
+
*/
|
|
111
|
+
export const getFontFaceDescriptors = ({ weight, display, unicodeRange, sizeAdjust }) => ({
|
|
112
|
+
style: 'normal',
|
|
113
|
+
weight,
|
|
114
|
+
display: /** @type {FontDisplay} */ (display),
|
|
115
|
+
...(unicodeRange ? { unicodeRange } : {}),
|
|
116
|
+
...(sizeAdjust ? { sizeAdjust } : {}),
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Load the fonts from the given URLs instead of the CDN, so they can be self-hosted. The
|
|
121
|
+
* `setupSelfHostedAssets()` function of `@sveltia/ui/self-hosted` calls this with the fonts
|
|
122
|
+
* bundled with the package.
|
|
123
|
+
*
|
|
124
|
+
* The fonts are registered with the CSS Font Loading API, which is subject to the `font-src`
|
|
125
|
+
* directive of a Content Security Policy but not `style-src`. A font face added to the document’s
|
|
126
|
+
* font set takes precedence over the `@font-face` rule for the CDN with the same descriptors, so
|
|
127
|
+
* the CDN file is never fetched. This only works in the browser: in a
|
|
128
|
+
* server-rendered app, the first paint happens with the CDN fonts before the app is hydrated.
|
|
129
|
+
* Call it before the `AppShell` component is mounted, so no font is fetched from the CDN first.
|
|
130
|
+
* @param {Record<string, string>} urls URLs keyed with the Fontsource file name, e.g.
|
|
131
|
+
* `source-sans-3-latin-wght-normal.woff2`. Any font omitted, or whose file fails to load, is still
|
|
132
|
+
* loaded from the CDN; a failure is reported in the console.
|
|
133
|
+
*/
|
|
134
|
+
export const setFontURLs = (urls) => {
|
|
135
|
+
if (typeof document === 'undefined' || !document.fonts) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
registeredFontFaces.forEach((fontFace) => document.fonts.delete(fontFace));
|
|
140
|
+
|
|
141
|
+
registeredFontFaces = FONTS.flatMap((font) => {
|
|
142
|
+
const url = urls[getFontFileName(font)];
|
|
143
|
+
|
|
144
|
+
if (!url) {
|
|
145
|
+
return [];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const fontFace = new FontFace(
|
|
149
|
+
font.family,
|
|
150
|
+
`url(${JSON.stringify(url)}) format('${font.format}')`,
|
|
151
|
+
getFontFaceDescriptors(font),
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
document.fonts.add(fontFace);
|
|
155
|
+
|
|
156
|
+
// The browser falls back to the `@font-face` rule for the CDN if the file can’t be loaded,
|
|
157
|
+
// which goes unnoticed otherwise. `loaded` settles once the font is used, without forcing a
|
|
158
|
+
// download
|
|
159
|
+
fontFace.loaded.catch(() => {
|
|
160
|
+
// eslint-disable-next-line no-console
|
|
161
|
+
console.warn(
|
|
162
|
+
`Failed to load the ${font.family} font from ${url}. It’s loaded from the CDN instead.`,
|
|
163
|
+
);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return [fontFace];
|
|
167
|
+
});
|
|
168
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -86,5 +86,6 @@ export { loadCodeHighlighter } from "./components/text-editor/core.js";
|
|
|
86
86
|
export { setCodeHighlighterCacheEnabled } from "./components/text-editor/shiki/cache.js";
|
|
87
87
|
export { highlightCodeToHTML } from "./components/text-editor/shiki/facade.js";
|
|
88
88
|
export { setCodeHighlighterLoaders } from "./components/text-editor/shiki/loader.js";
|
|
89
|
+
export { setFontURLs } from "./components/util/fonts.js";
|
|
89
90
|
export * from "./typedefs.js";
|
|
90
91
|
export { initLocales, strings } from "./services/i18n.js";
|
package/dist/index.js
CHANGED
|
@@ -86,6 +86,7 @@ export { loadCodeHighlighter } from './components/text-editor/core.js';
|
|
|
86
86
|
export { setCodeHighlighterCacheEnabled } from './components/text-editor/shiki/cache.js';
|
|
87
87
|
export { highlightCodeToHTML } from './components/text-editor/shiki/facade.js';
|
|
88
88
|
export { setCodeHighlighterLoaders } from './components/text-editor/shiki/loader.js';
|
|
89
|
+
export { setFontURLs } from './components/util/fonts.js';
|
|
89
90
|
export { initLocales, strings } from './services/i18n.js';
|
|
90
91
|
|
|
91
92
|
// eslint-disable-next-line import/export
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Google Inc.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Copyright 2018 The Noto Project Authors (github.com/googlei18n/noto-fonts)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License,
|
|
4
|
+
Version 1.1.
|
|
5
|
+
|
|
6
|
+
This license is copied below, and is also available with a FAQ at:
|
|
7
|
+
http://scripts.sil.org/OFL
|
|
8
|
+
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
11
|
+
-----------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
PREAMBLE
|
|
14
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
15
|
+
development of collaborative font projects, to support the font
|
|
16
|
+
creation efforts of academic and linguistic communities, and to
|
|
17
|
+
provide a free and open framework in which fonts may be shared and
|
|
18
|
+
improved in partnership with others.
|
|
19
|
+
|
|
20
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
21
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
22
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
23
|
+
redistributed and/or sold with any software provided that any reserved
|
|
24
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
25
|
+
however, cannot be released under any other type of license. The
|
|
26
|
+
requirement for fonts to remain under this license does not apply to
|
|
27
|
+
any document created using the fonts or their derivatives.
|
|
28
|
+
|
|
29
|
+
DEFINITIONS
|
|
30
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
31
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
32
|
+
include source files, build scripts and documentation.
|
|
33
|
+
|
|
34
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
35
|
+
copyright statement(s).
|
|
36
|
+
|
|
37
|
+
"Original Version" refers to the collection of Font Software
|
|
38
|
+
components as distributed by the Copyright Holder(s).
|
|
39
|
+
|
|
40
|
+
"Modified Version" refers to any derivative made by adding to,
|
|
41
|
+
deleting, or substituting -- in part or in whole -- any of the
|
|
42
|
+
components of the Original Version, by changing formats or by porting
|
|
43
|
+
the Font Software to a new environment.
|
|
44
|
+
|
|
45
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
46
|
+
writer or other person who contributed to the Font Software.
|
|
47
|
+
|
|
48
|
+
PERMISSION & CONDITIONS
|
|
49
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
50
|
+
a copy of the Font Software, to use, study, copy, merge, embed,
|
|
51
|
+
modify, redistribute, and sell modified and unmodified copies of the
|
|
52
|
+
Font Software, subject to the following conditions:
|
|
53
|
+
|
|
54
|
+
1) Neither the Font Software nor any of its individual components, in
|
|
55
|
+
Original or Modified Versions, may be sold by itself.
|
|
56
|
+
|
|
57
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
58
|
+
redistributed and/or sold with any software, provided that each copy
|
|
59
|
+
contains the above copyright notice and this license. These can be
|
|
60
|
+
included either as stand-alone text files, human-readable headers or
|
|
61
|
+
in the appropriate machine-readable metadata fields within text or
|
|
62
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
63
|
+
|
|
64
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
65
|
+
Name(s) unless explicit written permission is granted by the
|
|
66
|
+
corresponding Copyright Holder. This restriction only applies to the
|
|
67
|
+
primary font name as presented to the users.
|
|
68
|
+
|
|
69
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
70
|
+
Software shall not be used to promote, endorse or advertise any
|
|
71
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
72
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
73
|
+
permission.
|
|
74
|
+
|
|
75
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
76
|
+
must be distributed entirely under this license, and must not be
|
|
77
|
+
distributed under any other license. The requirement for fonts to
|
|
78
|
+
remain under this license does not apply to any document created using
|
|
79
|
+
the Font Software.
|
|
80
|
+
|
|
81
|
+
TERMINATION
|
|
82
|
+
This license becomes null and void if any of the above conditions are
|
|
83
|
+
not met.
|
|
84
|
+
|
|
85
|
+
DISCLAIMER
|
|
86
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
87
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
88
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
89
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
90
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
91
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
92
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
93
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
94
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Google Inc.
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loaders of the syntax highlighting grammars, keyed with the canonical language ID.
|
|
3
|
+
* @type {Record<string, () => Promise<any>>}
|
|
4
|
+
*/
|
|
5
|
+
export const LANGUAGE_LOADERS: Record<string, () => Promise<any>>;
|
|
6
|
+
/**
|
|
7
|
+
* Loaders of the syntax highlighting themes, keyed with the theme ID. Only the themes the code
|
|
8
|
+
* editor uses are included, so the other themes aren’t published with the consumer’s app; a theme
|
|
9
|
+
* without a loader leaves code as plain text.
|
|
10
|
+
* @type {Record<string, () => Promise<any>>}
|
|
11
|
+
*/
|
|
12
|
+
export const THEME_LOADERS: Record<string, () => Promise<any>>;
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// Generated by `scripts/generate-shiki-metadata.js`. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Loaders of the syntax highlighting grammars, keyed with the canonical language ID.
|
|
5
|
+
* @type {Record<string, () => Promise<any>>}
|
|
6
|
+
*/
|
|
7
|
+
export const LANGUAGE_LOADERS = {
|
|
8
|
+
"bsl": () => import('@shikijs/langs/bsl'),
|
|
9
|
+
"sdbl": () => import('@shikijs/langs/sdbl'),
|
|
10
|
+
"abap": () => import('@shikijs/langs/abap'),
|
|
11
|
+
"actionscript-3": () => import('@shikijs/langs/actionscript-3'),
|
|
12
|
+
"ada": () => import('@shikijs/langs/ada'),
|
|
13
|
+
"angular-html": () => import('@shikijs/langs/angular-html'),
|
|
14
|
+
"angular-ts": () => import('@shikijs/langs/angular-ts'),
|
|
15
|
+
"apache": () => import('@shikijs/langs/apache'),
|
|
16
|
+
"apex": () => import('@shikijs/langs/apex'),
|
|
17
|
+
"apl": () => import('@shikijs/langs/apl'),
|
|
18
|
+
"applescript": () => import('@shikijs/langs/applescript'),
|
|
19
|
+
"ara": () => import('@shikijs/langs/ara'),
|
|
20
|
+
"asciidoc": () => import('@shikijs/langs/asciidoc'),
|
|
21
|
+
"razor": () => import('@shikijs/langs/razor'),
|
|
22
|
+
"asm": () => import('@shikijs/langs/asm'),
|
|
23
|
+
"astro": () => import('@shikijs/langs/astro'),
|
|
24
|
+
"ahk": () => import('@shikijs/langs/ahk'),
|
|
25
|
+
"ahk2": () => import('@shikijs/langs/ahk2'),
|
|
26
|
+
"awk": () => import('@shikijs/langs/awk'),
|
|
27
|
+
"ballerina": () => import('@shikijs/langs/ballerina'),
|
|
28
|
+
"bat": () => import('@shikijs/langs/bat'),
|
|
29
|
+
"beancount": () => import('@shikijs/langs/beancount'),
|
|
30
|
+
"berry": () => import('@shikijs/langs/berry'),
|
|
31
|
+
"bibtex": () => import('@shikijs/langs/bibtex'),
|
|
32
|
+
"bicep": () => import('@shikijs/langs/bicep'),
|
|
33
|
+
"bird2": () => import('@shikijs/langs/bird2'),
|
|
34
|
+
"blade": () => import('@shikijs/langs/blade'),
|
|
35
|
+
"c": () => import('@shikijs/langs/c'),
|
|
36
|
+
"csharp": () => import('@shikijs/langs/csharp'),
|
|
37
|
+
"cpp": () => import('@shikijs/langs/cpp'),
|
|
38
|
+
"c3": () => import('@shikijs/langs/c3'),
|
|
39
|
+
"cadence": () => import('@shikijs/langs/cadence'),
|
|
40
|
+
"cairo": () => import('@shikijs/langs/cairo'),
|
|
41
|
+
"chapel": () => import('@shikijs/langs/chapel'),
|
|
42
|
+
"clarity": () => import('@shikijs/langs/clarity'),
|
|
43
|
+
"clojure": () => import('@shikijs/langs/clojure'),
|
|
44
|
+
"soy": () => import('@shikijs/langs/soy'),
|
|
45
|
+
"cmake": () => import('@shikijs/langs/cmake'),
|
|
46
|
+
"cobol": () => import('@shikijs/langs/cobol'),
|
|
47
|
+
"codeowners": () => import('@shikijs/langs/codeowners'),
|
|
48
|
+
"codeql": () => import('@shikijs/langs/codeql'),
|
|
49
|
+
"coffee": () => import('@shikijs/langs/coffee'),
|
|
50
|
+
"common-lisp": () => import('@shikijs/langs/common-lisp'),
|
|
51
|
+
"crystal": () => import('@shikijs/langs/crystal'),
|
|
52
|
+
"css": () => import('@shikijs/langs/css'),
|
|
53
|
+
"csv": () => import('@shikijs/langs/csv'),
|
|
54
|
+
"cue": () => import('@shikijs/langs/cue'),
|
|
55
|
+
"cypher": () => import('@shikijs/langs/cypher'),
|
|
56
|
+
"d": () => import('@shikijs/langs/d'),
|
|
57
|
+
"dart": () => import('@shikijs/langs/dart'),
|
|
58
|
+
"dax": () => import('@shikijs/langs/dax'),
|
|
59
|
+
"desktop": () => import('@shikijs/langs/desktop'),
|
|
60
|
+
"diff": () => import('@shikijs/langs/diff'),
|
|
61
|
+
"docker": () => import('@shikijs/langs/docker'),
|
|
62
|
+
"dotenv": () => import('@shikijs/langs/dotenv'),
|
|
63
|
+
"dream-maker": () => import('@shikijs/langs/dream-maker'),
|
|
64
|
+
"edge": () => import('@shikijs/langs/edge'),
|
|
65
|
+
"elixir": () => import('@shikijs/langs/elixir'),
|
|
66
|
+
"elm": () => import('@shikijs/langs/elm'),
|
|
67
|
+
"emacs-lisp": () => import('@shikijs/langs/emacs-lisp'),
|
|
68
|
+
"erb": () => import('@shikijs/langs/erb'),
|
|
69
|
+
"erlang": () => import('@shikijs/langs/erlang'),
|
|
70
|
+
"fsharp": () => import('@shikijs/langs/fsharp'),
|
|
71
|
+
"fennel": () => import('@shikijs/langs/fennel'),
|
|
72
|
+
"fish": () => import('@shikijs/langs/fish'),
|
|
73
|
+
"fluent": () => import('@shikijs/langs/fluent'),
|
|
74
|
+
"fortran-fixed-form": () => import('@shikijs/langs/fortran-fixed-form'),
|
|
75
|
+
"fortran-free-form": () => import('@shikijs/langs/fortran-free-form'),
|
|
76
|
+
"gdresource": () => import('@shikijs/langs/gdresource'),
|
|
77
|
+
"gdscript": () => import('@shikijs/langs/gdscript'),
|
|
78
|
+
"gdshader": () => import('@shikijs/langs/gdshader'),
|
|
79
|
+
"genie": () => import('@shikijs/langs/genie'),
|
|
80
|
+
"po": () => import('@shikijs/langs/po'),
|
|
81
|
+
"gherkin": () => import('@shikijs/langs/gherkin'),
|
|
82
|
+
"git-commit": () => import('@shikijs/langs/git-commit'),
|
|
83
|
+
"git-rebase": () => import('@shikijs/langs/git-rebase'),
|
|
84
|
+
"gleam": () => import('@shikijs/langs/gleam'),
|
|
85
|
+
"glimmer-js": () => import('@shikijs/langs/glimmer-js'),
|
|
86
|
+
"glimmer-ts": () => import('@shikijs/langs/glimmer-ts'),
|
|
87
|
+
"glsl": () => import('@shikijs/langs/glsl'),
|
|
88
|
+
"gn": () => import('@shikijs/langs/gn'),
|
|
89
|
+
"smalltalk": () => import('@shikijs/langs/smalltalk'),
|
|
90
|
+
"gnuplot": () => import('@shikijs/langs/gnuplot'),
|
|
91
|
+
"go": () => import('@shikijs/langs/go'),
|
|
92
|
+
"graphql": () => import('@shikijs/langs/graphql'),
|
|
93
|
+
"groovy": () => import('@shikijs/langs/groovy'),
|
|
94
|
+
"hack": () => import('@shikijs/langs/hack'),
|
|
95
|
+
"handlebars": () => import('@shikijs/langs/handlebars'),
|
|
96
|
+
"hcl": () => import('@shikijs/langs/hcl'),
|
|
97
|
+
"haskell": () => import('@shikijs/langs/haskell'),
|
|
98
|
+
"haxe": () => import('@shikijs/langs/haxe'),
|
|
99
|
+
"hjson": () => import('@shikijs/langs/hjson'),
|
|
100
|
+
"hlsl": () => import('@shikijs/langs/hlsl'),
|
|
101
|
+
"html": () => import('@shikijs/langs/html'),
|
|
102
|
+
"html-derivative": () => import('@shikijs/langs/html-derivative'),
|
|
103
|
+
"http": () => import('@shikijs/langs/http'),
|
|
104
|
+
"hurl": () => import('@shikijs/langs/hurl'),
|
|
105
|
+
"hxml": () => import('@shikijs/langs/hxml'),
|
|
106
|
+
"hy": () => import('@shikijs/langs/hy'),
|
|
107
|
+
"imba": () => import('@shikijs/langs/imba'),
|
|
108
|
+
"ini": () => import('@shikijs/langs/ini'),
|
|
109
|
+
"java": () => import('@shikijs/langs/java'),
|
|
110
|
+
"javascript": () => import('@shikijs/langs/javascript'),
|
|
111
|
+
"jinja": () => import('@shikijs/langs/jinja'),
|
|
112
|
+
"jison": () => import('@shikijs/langs/jison'),
|
|
113
|
+
"json": () => import('@shikijs/langs/json'),
|
|
114
|
+
"jsonl": () => import('@shikijs/langs/jsonl'),
|
|
115
|
+
"jsonc": () => import('@shikijs/langs/jsonc'),
|
|
116
|
+
"json5": () => import('@shikijs/langs/json5'),
|
|
117
|
+
"jsonnet": () => import('@shikijs/langs/jsonnet'),
|
|
118
|
+
"jssm": () => import('@shikijs/langs/jssm'),
|
|
119
|
+
"jsx": () => import('@shikijs/langs/jsx'),
|
|
120
|
+
"julia": () => import('@shikijs/langs/julia'),
|
|
121
|
+
"just": () => import('@shikijs/langs/just'),
|
|
122
|
+
"kdl": () => import('@shikijs/langs/kdl'),
|
|
123
|
+
"kotlin": () => import('@shikijs/langs/kotlin'),
|
|
124
|
+
"kusto": () => import('@shikijs/langs/kusto'),
|
|
125
|
+
"latex": () => import('@shikijs/langs/latex'),
|
|
126
|
+
"lean": () => import('@shikijs/langs/lean'),
|
|
127
|
+
"less": () => import('@shikijs/langs/less'),
|
|
128
|
+
"liquid": () => import('@shikijs/langs/liquid'),
|
|
129
|
+
"llvm": () => import('@shikijs/langs/llvm'),
|
|
130
|
+
"log": () => import('@shikijs/langs/log'),
|
|
131
|
+
"logo": () => import('@shikijs/langs/logo'),
|
|
132
|
+
"lua": () => import('@shikijs/langs/lua'),
|
|
133
|
+
"luau": () => import('@shikijs/langs/luau'),
|
|
134
|
+
"make": () => import('@shikijs/langs/make'),
|
|
135
|
+
"markdown": () => import('@shikijs/langs/markdown'),
|
|
136
|
+
"marko": () => import('@shikijs/langs/marko'),
|
|
137
|
+
"matlab": () => import('@shikijs/langs/matlab'),
|
|
138
|
+
"mdc": () => import('@shikijs/langs/mdc'),
|
|
139
|
+
"mdx": () => import('@shikijs/langs/mdx'),
|
|
140
|
+
"mermaid": () => import('@shikijs/langs/mermaid'),
|
|
141
|
+
"mipsasm": () => import('@shikijs/langs/mipsasm'),
|
|
142
|
+
"mojo": () => import('@shikijs/langs/mojo'),
|
|
143
|
+
"moonbit": () => import('@shikijs/langs/moonbit'),
|
|
144
|
+
"move": () => import('@shikijs/langs/move'),
|
|
145
|
+
"narrat": () => import('@shikijs/langs/narrat'),
|
|
146
|
+
"nextflow": () => import('@shikijs/langs/nextflow'),
|
|
147
|
+
"nextflow-groovy": () => import('@shikijs/langs/nextflow-groovy'),
|
|
148
|
+
"nginx": () => import('@shikijs/langs/nginx'),
|
|
149
|
+
"nim": () => import('@shikijs/langs/nim'),
|
|
150
|
+
"nix": () => import('@shikijs/langs/nix'),
|
|
151
|
+
"nsis": () => import('@shikijs/langs/nsis'),
|
|
152
|
+
"nushell": () => import('@shikijs/langs/nushell'),
|
|
153
|
+
"objective-c": () => import('@shikijs/langs/objective-c'),
|
|
154
|
+
"objective-cpp": () => import('@shikijs/langs/objective-cpp'),
|
|
155
|
+
"ocaml": () => import('@shikijs/langs/ocaml'),
|
|
156
|
+
"odin": () => import('@shikijs/langs/odin'),
|
|
157
|
+
"openscad": () => import('@shikijs/langs/openscad'),
|
|
158
|
+
"org": () => import('@shikijs/langs/org'),
|
|
159
|
+
"pascal": () => import('@shikijs/langs/pascal'),
|
|
160
|
+
"perl": () => import('@shikijs/langs/perl'),
|
|
161
|
+
"php": () => import('@shikijs/langs/php'),
|
|
162
|
+
"pkl": () => import('@shikijs/langs/pkl'),
|
|
163
|
+
"plsql": () => import('@shikijs/langs/plsql'),
|
|
164
|
+
"polar": () => import('@shikijs/langs/polar'),
|
|
165
|
+
"postcss": () => import('@shikijs/langs/postcss'),
|
|
166
|
+
"powerquery": () => import('@shikijs/langs/powerquery'),
|
|
167
|
+
"powershell": () => import('@shikijs/langs/powershell'),
|
|
168
|
+
"prisma": () => import('@shikijs/langs/prisma'),
|
|
169
|
+
"prolog": () => import('@shikijs/langs/prolog'),
|
|
170
|
+
"proto": () => import('@shikijs/langs/proto'),
|
|
171
|
+
"pug": () => import('@shikijs/langs/pug'),
|
|
172
|
+
"puppet": () => import('@shikijs/langs/puppet'),
|
|
173
|
+
"purescript": () => import('@shikijs/langs/purescript'),
|
|
174
|
+
"python": () => import('@shikijs/langs/python'),
|
|
175
|
+
"qml": () => import('@shikijs/langs/qml'),
|
|
176
|
+
"qmldir": () => import('@shikijs/langs/qmldir'),
|
|
177
|
+
"qss": () => import('@shikijs/langs/qss'),
|
|
178
|
+
"r": () => import('@shikijs/langs/r'),
|
|
179
|
+
"racket": () => import('@shikijs/langs/racket'),
|
|
180
|
+
"raku": () => import('@shikijs/langs/raku'),
|
|
181
|
+
"rbs": () => import('@shikijs/langs/rbs'),
|
|
182
|
+
"regexp": () => import('@shikijs/langs/regexp'),
|
|
183
|
+
"rel": () => import('@shikijs/langs/rel'),
|
|
184
|
+
"rst": () => import('@shikijs/langs/rst'),
|
|
185
|
+
"riscv": () => import('@shikijs/langs/riscv'),
|
|
186
|
+
"coq": () => import('@shikijs/langs/coq'),
|
|
187
|
+
"ron": () => import('@shikijs/langs/ron'),
|
|
188
|
+
"rosmsg": () => import('@shikijs/langs/rosmsg'),
|
|
189
|
+
"ruby": () => import('@shikijs/langs/ruby'),
|
|
190
|
+
"haml": () => import('@shikijs/langs/haml'),
|
|
191
|
+
"rust": () => import('@shikijs/langs/rust'),
|
|
192
|
+
"sas": () => import('@shikijs/langs/sas'),
|
|
193
|
+
"sass": () => import('@shikijs/langs/sass'),
|
|
194
|
+
"scala": () => import('@shikijs/langs/scala'),
|
|
195
|
+
"scheme": () => import('@shikijs/langs/scheme'),
|
|
196
|
+
"scss": () => import('@shikijs/langs/scss'),
|
|
197
|
+
"shaderlab": () => import('@shikijs/langs/shaderlab'),
|
|
198
|
+
"shellscript": () => import('@shikijs/langs/shellscript'),
|
|
199
|
+
"shellsession": () => import('@shikijs/langs/shellsession'),
|
|
200
|
+
"smithy": () => import('@shikijs/langs/smithy'),
|
|
201
|
+
"solidity": () => import('@shikijs/langs/solidity'),
|
|
202
|
+
"sparql": () => import('@shikijs/langs/sparql'),
|
|
203
|
+
"splunk": () => import('@shikijs/langs/splunk'),
|
|
204
|
+
"sql": () => import('@shikijs/langs/sql'),
|
|
205
|
+
"ssh-config": () => import('@shikijs/langs/ssh-config'),
|
|
206
|
+
"stata": () => import('@shikijs/langs/stata'),
|
|
207
|
+
"stylus": () => import('@shikijs/langs/stylus'),
|
|
208
|
+
"surrealql": () => import('@shikijs/langs/surrealql'),
|
|
209
|
+
"svelte": () => import('@shikijs/langs/svelte'),
|
|
210
|
+
"swift": () => import('@shikijs/langs/swift'),
|
|
211
|
+
"systemd": () => import('@shikijs/langs/systemd'),
|
|
212
|
+
"system-verilog": () => import('@shikijs/langs/system-verilog'),
|
|
213
|
+
"talonscript": () => import('@shikijs/langs/talonscript'),
|
|
214
|
+
"tasl": () => import('@shikijs/langs/tasl'),
|
|
215
|
+
"tcl": () => import('@shikijs/langs/tcl'),
|
|
216
|
+
"templ": () => import('@shikijs/langs/templ'),
|
|
217
|
+
"terraform": () => import('@shikijs/langs/terraform'),
|
|
218
|
+
"tex": () => import('@shikijs/langs/tex'),
|
|
219
|
+
"toml": () => import('@shikijs/langs/toml'),
|
|
220
|
+
"tsv": () => import('@shikijs/langs/tsv'),
|
|
221
|
+
"tsx": () => import('@shikijs/langs/tsx'),
|
|
222
|
+
"turtle": () => import('@shikijs/langs/turtle'),
|
|
223
|
+
"twig": () => import('@shikijs/langs/twig'),
|
|
224
|
+
"typescript": () => import('@shikijs/langs/typescript'),
|
|
225
|
+
"ts-tags": () => import('@shikijs/langs/ts-tags'),
|
|
226
|
+
"typespec": () => import('@shikijs/langs/typespec'),
|
|
227
|
+
"typst": () => import('@shikijs/langs/typst'),
|
|
228
|
+
"v": () => import('@shikijs/langs/v'),
|
|
229
|
+
"vala": () => import('@shikijs/langs/vala'),
|
|
230
|
+
"verilog": () => import('@shikijs/langs/verilog'),
|
|
231
|
+
"vhdl": () => import('@shikijs/langs/vhdl'),
|
|
232
|
+
"viml": () => import('@shikijs/langs/viml'),
|
|
233
|
+
"vb": () => import('@shikijs/langs/vb'),
|
|
234
|
+
"vue": () => import('@shikijs/langs/vue'),
|
|
235
|
+
"vue-html": () => import('@shikijs/langs/vue-html'),
|
|
236
|
+
"vue-vine": () => import('@shikijs/langs/vue-vine'),
|
|
237
|
+
"vyper": () => import('@shikijs/langs/vyper'),
|
|
238
|
+
"wasm": () => import('@shikijs/langs/wasm'),
|
|
239
|
+
"wit": () => import('@shikijs/langs/wit'),
|
|
240
|
+
"wenyan": () => import('@shikijs/langs/wenyan'),
|
|
241
|
+
"wgsl": () => import('@shikijs/langs/wgsl'),
|
|
242
|
+
"wikitext": () => import('@shikijs/langs/wikitext'),
|
|
243
|
+
"reg": () => import('@shikijs/langs/reg'),
|
|
244
|
+
"wolfram": () => import('@shikijs/langs/wolfram'),
|
|
245
|
+
"xml": () => import('@shikijs/langs/xml'),
|
|
246
|
+
"xsl": () => import('@shikijs/langs/xsl'),
|
|
247
|
+
"yaml": () => import('@shikijs/langs/yaml'),
|
|
248
|
+
"zenscript": () => import('@shikijs/langs/zenscript'),
|
|
249
|
+
"zig": () => import('@shikijs/langs/zig'),
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Loaders of the syntax highlighting themes, keyed with the theme ID. Only the themes the code
|
|
254
|
+
* editor uses are included, so the other themes aren’t published with the consumer’s app; a theme
|
|
255
|
+
* without a loader leaves code as plain text.
|
|
256
|
+
* @type {Record<string, () => Promise<any>>}
|
|
257
|
+
*/
|
|
258
|
+
export const THEME_LOADERS = {
|
|
259
|
+
"github-light": () => import('@shikijs/themes/github-light'),
|
|
260
|
+
"github-dark": () => import('@shikijs/themes/github-dark'),
|
|
261
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function setupSelfHostedAssets(): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { setCodeHighlighterLoaders } from '../components/text-editor/shiki/loader.js';
|
|
2
|
+
import { setFontURLs } from '../components/util/fonts.js';
|
|
3
|
+
import { LANGUAGE_LOADERS, THEME_LOADERS } from './generated.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Serve the fonts and the syntax highlighting engine, grammars and themes from the app itself
|
|
7
|
+
* rather than the CDNs, so the components don’t contact any third party. Only the light and dark
|
|
8
|
+
* themes the code editor uses are included; add loaders with `setCodeHighlighterLoaders()` to pass
|
|
9
|
+
* another theme to `highlightCodeToHTML()`. Every file becomes a
|
|
10
|
+
* separate asset or chunk of the consumer’s bundle, only loaded when needed. Call this before the
|
|
11
|
+
* `AppShell` component is mounted.
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* import { setupSelfHostedAssets } from '@sveltia/ui/self-hosted';
|
|
15
|
+
*
|
|
16
|
+
* setupSelfHostedAssets();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const setupSelfHostedAssets = () => {
|
|
20
|
+
// Spelled out one by one, as a bundler only picks up a literal `new URL()` as an asset
|
|
21
|
+
setFontURLs({
|
|
22
|
+
'source-sans-3-latin-wght-normal.woff2': new URL(
|
|
23
|
+
'./fonts/source-sans-3-latin-wght-normal.woff2',
|
|
24
|
+
import.meta.url,
|
|
25
|
+
).href,
|
|
26
|
+
'noto-mono-latin-400-normal.woff2': new URL(
|
|
27
|
+
'./fonts/noto-mono-latin-400-normal.woff2',
|
|
28
|
+
import.meta.url,
|
|
29
|
+
).href,
|
|
30
|
+
'material-symbols-outlined-latin-wght-normal.woff2': new URL(
|
|
31
|
+
'./fonts/material-symbols-outlined-latin-wght-normal.woff2',
|
|
32
|
+
import.meta.url,
|
|
33
|
+
).href,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
setCodeHighlighterLoaders({
|
|
37
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
38
|
+
loadEngine: () =>
|
|
39
|
+
// @ts-ignore The engine is built into `dist` by `scripts/build-shiki-engine.js`, so it can’t
|
|
40
|
+
// be resolved before a build, e.g. when the types are checked in CI
|
|
41
|
+
import('@sveltia/ui/shiki-engine'),
|
|
42
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
43
|
+
loadLanguage: (id) => LANGUAGE_LOADERS[id]?.(),
|
|
44
|
+
// eslint-disable-next-line jsdoc/require-jsdoc
|
|
45
|
+
loadTheme: (id) => THEME_LOADERS[id]?.(),
|
|
46
|
+
});
|
|
47
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const createHighlighterCoreSync: (...args: any[]) => any;
|
|
2
|
+
export declare const createJavaScriptRegexEngine: (...args: any[]) => any;
|
|
3
|
+
export declare const getTokenStyleObject: (...args: any[]) => any;
|
|
4
|
+
export declare const isSpecialLang: (...args: any[]) => any;
|
|
5
|
+
export declare const isSpecialTheme: (...args: any[]) => any;
|
|
6
|
+
export declare const stringifyTokenStyle: (...args: any[]) => any;
|
package/dist/typedefs.d.ts
CHANGED
|
@@ -862,6 +862,52 @@ export type CodeHighlighterLoaders = {
|
|
|
862
862
|
*/
|
|
863
863
|
loadTheme: (id: string) => Promise<any>;
|
|
864
864
|
};
|
|
865
|
+
/**
|
|
866
|
+
* Web font used by the components, published on Fontsource.
|
|
867
|
+
*/
|
|
868
|
+
export type FontDefinition = {
|
|
869
|
+
/**
|
|
870
|
+
* Font family name.
|
|
871
|
+
*/
|
|
872
|
+
family: string;
|
|
873
|
+
/**
|
|
874
|
+
* Fontsource package name, e.g. `@fontsource/noto-mono`.
|
|
875
|
+
*/
|
|
876
|
+
packageName: string;
|
|
877
|
+
/**
|
|
878
|
+
* Fontsource package version.
|
|
879
|
+
*/
|
|
880
|
+
version: string;
|
|
881
|
+
/**
|
|
882
|
+
* Font ID on the Fontsource CDN, e.g. `noto-mono`, with a `:vf` suffix
|
|
883
|
+
* for a variable font.
|
|
884
|
+
*/
|
|
885
|
+
cdnId: string;
|
|
886
|
+
/**
|
|
887
|
+
* Subset, weight and style of the file, e.g. `latin-400-normal`.
|
|
888
|
+
*/
|
|
889
|
+
subset: string;
|
|
890
|
+
/**
|
|
891
|
+
* `@font-face` format hint.
|
|
892
|
+
*/
|
|
893
|
+
format: string;
|
|
894
|
+
/**
|
|
895
|
+
* `@font-face` weight, or weight range for a variable font.
|
|
896
|
+
*/
|
|
897
|
+
weight: string;
|
|
898
|
+
/**
|
|
899
|
+
* `@font-face` display strategy.
|
|
900
|
+
*/
|
|
901
|
+
display: string;
|
|
902
|
+
/**
|
|
903
|
+
* `@font-face` Unicode range.
|
|
904
|
+
*/
|
|
905
|
+
unicodeRange?: string | undefined;
|
|
906
|
+
/**
|
|
907
|
+
* `@font-face` size adjustment.
|
|
908
|
+
*/
|
|
909
|
+
sizeAdjust?: string | undefined;
|
|
910
|
+
};
|
|
865
911
|
export type CodeTokenizer = {
|
|
866
912
|
/**
|
|
867
913
|
* Language to fall back to when a code node doesn’t carry
|
package/dist/typedefs.js
CHANGED
|
@@ -369,6 +369,22 @@
|
|
|
369
369
|
* @property {(id: string) => Promise<any>} loadTheme Load a theme by ID.
|
|
370
370
|
*/
|
|
371
371
|
|
|
372
|
+
/**
|
|
373
|
+
* Web font used by the components, published on Fontsource.
|
|
374
|
+
* @typedef {object} FontDefinition
|
|
375
|
+
* @property {string} family Font family name.
|
|
376
|
+
* @property {string} packageName Fontsource package name, e.g. `@fontsource/noto-mono`.
|
|
377
|
+
* @property {string} version Fontsource package version.
|
|
378
|
+
* @property {string} cdnId Font ID on the Fontsource CDN, e.g. `noto-mono`, with a `:vf` suffix
|
|
379
|
+
* for a variable font.
|
|
380
|
+
* @property {string} subset Subset, weight and style of the file, e.g. `latin-400-normal`.
|
|
381
|
+
* @property {string} format `@font-face` format hint.
|
|
382
|
+
* @property {string} weight `@font-face` weight, or weight range for a variable font.
|
|
383
|
+
* @property {string} display `@font-face` display strategy.
|
|
384
|
+
* @property {string} [unicodeRange] `@font-face` Unicode range.
|
|
385
|
+
* @property {string} [sizeAdjust] `@font-face` size adjustment.
|
|
386
|
+
*/
|
|
387
|
+
|
|
372
388
|
/**
|
|
373
389
|
* @typedef {object} CodeTokenizer
|
|
374
390
|
* @property {string | null} defaultLanguage Language to fall back to when a code node doesn’t carry
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.1",
|
|
4
4
|
"description": "A collection of Svelte components and utilities for building user interfaces.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,14 @@
|
|
|
20
20
|
"default": "./dist/index.js"
|
|
21
21
|
},
|
|
22
22
|
"./locales/*": "./dist/locales/*",
|
|
23
|
-
"./
|
|
23
|
+
"./self-hosted": {
|
|
24
|
+
"types": "./dist/self-hosted/index.d.ts",
|
|
25
|
+
"default": "./dist/self-hosted/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./shiki-engine": {
|
|
28
|
+
"types": "./dist/shiki-engine.d.ts",
|
|
29
|
+
"default": "./dist/shiki-engine.js"
|
|
30
|
+
}
|
|
24
31
|
},
|
|
25
32
|
"svelte": "./dist/index.js",
|
|
26
33
|
"typesVersions": {
|
|
@@ -47,11 +54,16 @@
|
|
|
47
54
|
"@lexical/selection": "^0.51.0",
|
|
48
55
|
"@lexical/table": "^0.51.0",
|
|
49
56
|
"@lexical/utils": "^0.51.0",
|
|
57
|
+
"@shikijs/langs": "4.4.3",
|
|
58
|
+
"@shikijs/themes": "4.4.3",
|
|
50
59
|
"@sveltia/i18n": "^1.4.0",
|
|
51
60
|
"@sveltia/utils": "^0.12.1",
|
|
52
61
|
"lexical": "^0.51.0"
|
|
53
62
|
},
|
|
54
63
|
"devDependencies": {
|
|
64
|
+
"@fontsource-variable/material-symbols-outlined": "5.3.7",
|
|
65
|
+
"@fontsource-variable/source-sans-3": "5.3.0",
|
|
66
|
+
"@fontsource/noto-mono": "5.3.0",
|
|
55
67
|
"@rollup/plugin-yaml": "^5.0.0",
|
|
56
68
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
57
69
|
"@sveltejs/kit": "^2.70.3",
|
|
@@ -97,7 +109,7 @@
|
|
|
97
109
|
"provenance": true
|
|
98
110
|
},
|
|
99
111
|
"scripts": {
|
|
100
|
-
"build": "npm run generate:shiki && svelte-kit sync && svelte-package && node scripts/build-shiki-engine.js",
|
|
112
|
+
"build": "npm run generate:shiki && npm run generate:fonts && svelte-kit sync && svelte-package && node scripts/build-shiki-engine.js",
|
|
101
113
|
"build:watch": "svelte-kit sync && svelte-package --watch",
|
|
102
114
|
"check": "pnpm run --no-bail '/^check:.*/'",
|
|
103
115
|
"check:audit": "pnpm audit --ignore-registry-errors",
|
|
@@ -110,6 +122,7 @@
|
|
|
110
122
|
"dev": "vite dev",
|
|
111
123
|
"format": "prettier --write .",
|
|
112
124
|
"generate:emoji": "node scripts/generate-emoji-data.js",
|
|
125
|
+
"generate:fonts": "node scripts/copy-fonts.js",
|
|
113
126
|
"generate:shiki": "node scripts/generate-shiki-metadata.js",
|
|
114
127
|
"preview": "vite preview",
|
|
115
128
|
"test": "vitest run",
|