@salesforcedevs/dx-components 1.18.8-layoutfix-alpha → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +12 -0
- package/package.json +3 -2
- package/src/modules/dx/toc/toc.css +1 -1
- package/src/modules/dxUtils/shiki/shiki.ts +35 -53
- package/src/modules/dxUtils/shikiGrammars/shikiGrammars.html +3 -0
- package/src/modules/dxUtils/shikiGrammars/shikiGrammars.ts +2165 -0
- package/src/modules/dxUtils/shiki/customLanguages/afscript.tmLanguage.json +0 -855
- package/src/modules/dxUtils/shiki/customLanguages/ampscript.tmLanguage.json +0 -176
- package/src/modules/dxUtils/shiki/customLanguages/dataweave.tmLanguage.json +0 -1130
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -45,5 +45,6 @@
|
|
|
45
45
|
},
|
|
46
46
|
"volta": {
|
|
47
47
|
"node": "20.19.0"
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "18457421a078c6a84588aa18d03c976c32058600"
|
|
49
50
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as shiki from "shiki";
|
|
2
|
+
|
|
2
3
|
import type { BundledLanguage, BundledTheme } from "shiki";
|
|
3
|
-
import { createOnigurumaEngine } from "shiki/engine/oniguruma";
|
|
4
4
|
import { transformerColorizedBrackets } from "@shikijs/colorized-brackets";
|
|
5
|
+
import { getCustomLanguageGrammars } from "dxUtils/shikiGrammars";
|
|
6
|
+
|
|
5
7
|
interface ShikiSingleton {
|
|
6
|
-
highlighter: HighlighterCore | null;
|
|
8
|
+
highlighter: shiki.HighlighterCore | null;
|
|
7
9
|
initialized: boolean;
|
|
8
|
-
initPromise: Promise<HighlighterCore> | null;
|
|
10
|
+
initPromise: Promise<shiki.HighlighterCore> | null;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const shikiInstance: ShikiSingleton = {
|
|
@@ -50,58 +52,47 @@ const LANGUAGE_MAP: Record<string, BundledLanguage> = {
|
|
|
50
52
|
|
|
51
53
|
// Core languages that should be loaded immediately for best performance
|
|
52
54
|
const CORE_LANGUAGES = [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
() => import("@shikijs/langs/sql"),
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
() => import("@shikijs/langs/bash"),
|
|
67
|
-
// @ts-ignore
|
|
68
|
-
() => import("@shikijs/langs/xml"),
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
() => import("@shikijs/langs/graphql"),
|
|
71
|
-
// @ts-ignore
|
|
72
|
-
() => import("@shikijs/langs/jsx"),
|
|
73
|
-
// @ts-ignore
|
|
74
|
-
() => import("./customLanguages/ampscript.tmLanguage.json")
|
|
55
|
+
"apex",
|
|
56
|
+
"javascript",
|
|
57
|
+
"html",
|
|
58
|
+
"css",
|
|
59
|
+
"json",
|
|
60
|
+
"sql",
|
|
61
|
+
"bash",
|
|
62
|
+
"xml",
|
|
63
|
+
"graphql",
|
|
64
|
+
"jsx",
|
|
65
|
+
getCustomLanguageGrammars().ampscript
|
|
75
66
|
];
|
|
76
67
|
|
|
77
68
|
// Non-critical languages that can be loaded asynchronously when needed
|
|
78
|
-
const OPTIONAL_LANGUAGES: Record<string,
|
|
69
|
+
const OPTIONAL_LANGUAGES: Record<string, any> = {
|
|
79
70
|
// @ts-ignore
|
|
80
|
-
typescript:
|
|
71
|
+
typescript: "typescript",
|
|
81
72
|
// @ts-ignore
|
|
82
|
-
markdown:
|
|
73
|
+
markdown: "markdown",
|
|
83
74
|
// @ts-ignore
|
|
84
|
-
python:
|
|
75
|
+
python: "python",
|
|
85
76
|
// @ts-ignore
|
|
86
|
-
java:
|
|
77
|
+
java: "java",
|
|
87
78
|
// @ts-ignore
|
|
88
|
-
yaml:
|
|
79
|
+
yaml: "yaml",
|
|
89
80
|
// @ts-ignore
|
|
90
|
-
php:
|
|
81
|
+
php: "php",
|
|
91
82
|
// @ts-ignore
|
|
92
|
-
swift:
|
|
83
|
+
swift: "swift",
|
|
93
84
|
// @ts-ignore
|
|
94
|
-
kotlin:
|
|
85
|
+
kotlin: "kotlin",
|
|
95
86
|
// @ts-ignore
|
|
96
|
-
handlebars:
|
|
87
|
+
handlebars: "handlebars",
|
|
97
88
|
// @ts-ignore
|
|
98
|
-
dataweave: ()
|
|
89
|
+
dataweave: getCustomLanguageGrammars().dataweave,
|
|
99
90
|
// @ts-ignore
|
|
100
|
-
afscript: ()
|
|
91
|
+
afscript: getCustomLanguageGrammars().afscript
|
|
101
92
|
};
|
|
102
93
|
|
|
103
94
|
// Initialize Shiki highlighter with fine-grained modules for better performance
|
|
104
|
-
async function initializeShiki(): Promise<HighlighterCore> {
|
|
95
|
+
async function initializeShiki(): Promise<shiki.HighlighterCore> {
|
|
105
96
|
if (shikiInstance.highlighter) {
|
|
106
97
|
return shikiInstance.highlighter;
|
|
107
98
|
}
|
|
@@ -110,15 +101,9 @@ async function initializeShiki(): Promise<HighlighterCore> {
|
|
|
110
101
|
return shikiInstance.initPromise;
|
|
111
102
|
}
|
|
112
103
|
|
|
113
|
-
shikiInstance.initPromise =
|
|
114
|
-
themes: [
|
|
115
|
-
|
|
116
|
-
import("@shikijs/themes/light-plus"),
|
|
117
|
-
// @ts-ignore
|
|
118
|
-
import("@shikijs/themes/material-theme-darker")
|
|
119
|
-
],
|
|
120
|
-
langs: CORE_LANGUAGES,
|
|
121
|
-
engine: createOnigurumaEngine(import("shiki/wasm"))
|
|
104
|
+
shikiInstance.initPromise = shiki.createHighlighter({
|
|
105
|
+
themes: ["light-plus", "material-theme-darker"],
|
|
106
|
+
langs: CORE_LANGUAGES
|
|
122
107
|
});
|
|
123
108
|
|
|
124
109
|
try {
|
|
@@ -134,7 +119,7 @@ async function initializeShiki(): Promise<HighlighterCore> {
|
|
|
134
119
|
|
|
135
120
|
// Async function to load additional languages when needed
|
|
136
121
|
async function loadLanguageIfNeeded(
|
|
137
|
-
highlighter: HighlighterCore,
|
|
122
|
+
highlighter: shiki.HighlighterCore,
|
|
138
123
|
language: string
|
|
139
124
|
): Promise<void> {
|
|
140
125
|
const loadedLanguages = highlighter.getLoadedLanguages();
|
|
@@ -145,10 +130,7 @@ async function loadLanguageIfNeeded(
|
|
|
145
130
|
|
|
146
131
|
if (languageLoader) {
|
|
147
132
|
try {
|
|
148
|
-
|
|
149
|
-
await highlighter.loadLanguage(
|
|
150
|
-
languageModule.default || languageModule
|
|
151
|
-
);
|
|
133
|
+
await highlighter.loadLanguage(languageLoader);
|
|
152
134
|
} catch (error) {
|
|
153
135
|
console.warn(
|
|
154
136
|
`Failed to load optional language ${language}:`,
|