@stencil/templates 5.0.0-alpha.23 → 5.0.0-alpha.24
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/index.d.mts +24 -1
- package/dist/index.mjs +44 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -87,4 +87,27 @@ interface IndexHtmlSelections {
|
|
|
87
87
|
*/
|
|
88
88
|
declare function generateIndexHtml(sel: IndexHtmlSelections): string;
|
|
89
89
|
//#endregion
|
|
90
|
-
|
|
90
|
+
//#region src/generate/preview.d.ts
|
|
91
|
+
/**
|
|
92
|
+
* Returns the `usage/example.md` boilerplate for `stencil generate`. Read by the docs
|
|
93
|
+
* pipeline (readme / docs-json / custom-elements-manifest demos) and by the dev server's
|
|
94
|
+
* live component preview.
|
|
95
|
+
*
|
|
96
|
+
* @param tagName - Dash-case custom element tag name.
|
|
97
|
+
* @returns Markdown source string.
|
|
98
|
+
*/
|
|
99
|
+
declare function getUsageExampleBoilerplate(tagName: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a standalone index.html boilerplate for `stencil generate`, scoped to a single
|
|
102
|
+
* component's own directory. Its presence opts that directory out of the dev server's
|
|
103
|
+
* auto-generated preview, trading it for a hand-authored demo page.
|
|
104
|
+
*
|
|
105
|
+
* @param tagName - Dash-case custom element tag name.
|
|
106
|
+
* @param entryScriptSrc - Resolved src for the project's browser entry bundle (see
|
|
107
|
+
* `resolveEntryScriptSrc` in the CLI package), or `null` if the project has no browser-loadable
|
|
108
|
+
* output target (e.g. an SSR-only project) - the script tag is omitted in that case.
|
|
109
|
+
* @returns HTML source string.
|
|
110
|
+
*/
|
|
111
|
+
declare function getPreviewHtmlBoilerplate(tagName: string, entryScriptSrc: string | null): string;
|
|
112
|
+
//#endregion
|
|
113
|
+
export { type ConfigSelections, type DocKey, type IndexHtmlSelections, type OutputKey, PROJECT_TEMPLATES, type PackageJsonFields, type ProjectTemplateId, type StyleExtension, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getPreviewHtmlBoilerplate, getStyleBoilerplate, getTemplatePath, getUsageExampleBoilerplate, toPascalCase };
|
package/dist/index.mjs
CHANGED
|
@@ -164,4 +164,47 @@ function generateIndexHtml(sel) {
|
|
|
164
164
|
].join("\n");
|
|
165
165
|
}
|
|
166
166
|
//#endregion
|
|
167
|
-
|
|
167
|
+
//#region src/generate/preview.ts
|
|
168
|
+
/**
|
|
169
|
+
* Returns the `usage/example.md` boilerplate for `stencil generate`. Read by the docs
|
|
170
|
+
* pipeline (readme / docs-json / custom-elements-manifest demos) and by the dev server's
|
|
171
|
+
* live component preview.
|
|
172
|
+
*
|
|
173
|
+
* @param tagName - Dash-case custom element tag name.
|
|
174
|
+
* @returns Markdown source string.
|
|
175
|
+
*/
|
|
176
|
+
function getUsageExampleBoilerplate(tagName) {
|
|
177
|
+
return `# Example
|
|
178
|
+
|
|
179
|
+
\`\`\`html
|
|
180
|
+
<${tagName}></${tagName}>
|
|
181
|
+
\`\`\`
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Returns a standalone index.html boilerplate for `stencil generate`, scoped to a single
|
|
186
|
+
* component's own directory. Its presence opts that directory out of the dev server's
|
|
187
|
+
* auto-generated preview, trading it for a hand-authored demo page.
|
|
188
|
+
*
|
|
189
|
+
* @param tagName - Dash-case custom element tag name.
|
|
190
|
+
* @param entryScriptSrc - Resolved src for the project's browser entry bundle (see
|
|
191
|
+
* `resolveEntryScriptSrc` in the CLI package), or `null` if the project has no browser-loadable
|
|
192
|
+
* output target (e.g. an SSR-only project) - the script tag is omitted in that case.
|
|
193
|
+
* @returns HTML source string.
|
|
194
|
+
*/
|
|
195
|
+
function getPreviewHtmlBoilerplate(tagName, entryScriptSrc) {
|
|
196
|
+
return `<!doctype html>
|
|
197
|
+
<html lang="en">
|
|
198
|
+
<head>
|
|
199
|
+
<meta charset="UTF-8" />
|
|
200
|
+
<title>${tagName}</title>
|
|
201
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
202
|
+
${entryScriptSrc ? ` <script type="module" src="${entryScriptSrc}"><\/script>\n` : ` <!-- no browser-loadable output target configured - add your own entry script -->\n`} </head>
|
|
203
|
+
<body>
|
|
204
|
+
<${tagName}></${tagName}>
|
|
205
|
+
</body>
|
|
206
|
+
</html>
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
210
|
+
export { PROJECT_TEMPLATES, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getPreviewHtmlBoilerplate, getStyleBoilerplate, getTemplatePath, getUsageExampleBoilerplate, toPascalCase };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/templates",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.24",
|
|
4
4
|
"description": "Project and generate templates for Stencil",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"scaffolding",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"vitest": "^4.1.7"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@stencil/core": "^5.0.0 || 5.0.0-alpha.
|
|
36
|
+
"@stencil/core": "^5.0.0 || 5.0.0-alpha.24"
|
|
37
37
|
},
|
|
38
38
|
"volta": {
|
|
39
39
|
"extends": "../../package.json"
|