@stencil/templates 5.0.0-alpha.21 → 5.0.0-alpha.23

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 CHANGED
@@ -72,4 +72,19 @@ declare function generateStencilConfig(sel: ConfigSelections): string | null;
72
72
  */
73
73
  declare function generatePackageJsonFields(outputs: ReadonlyArray<OutputKey>): PackageJsonFields;
74
74
  //#endregion
75
- export { type ConfigSelections, type DocKey, type OutputKey, PROJECT_TEMPLATES, type PackageJsonFields, type ProjectTemplateId, type StyleExtension, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getStyleBoilerplate, getTemplatePath, toPascalCase };
75
+ //#region src/project/index-html.d.ts
76
+ interface IndexHtmlSelections {
77
+ projectName: string;
78
+ namespace: string;
79
+ globalStyle: boolean;
80
+ }
81
+ /**
82
+ * Returns src/index.html source for a `www`-output project: entry <script> tag pointing
83
+ * at the compiled bundle, and a <link> to the global stylesheet if one was selected.
84
+ *
85
+ * @param sel - Wizard selections to encode into the HTML file.
86
+ * @returns HTML source string.
87
+ */
88
+ declare function generateIndexHtml(sel: IndexHtmlSelections): string;
89
+ //#endregion
90
+ export { type ConfigSelections, type DocKey, type IndexHtmlSelections, type OutputKey, PROJECT_TEMPLATES, type PackageJsonFields, type ProjectTemplateId, type StyleExtension, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getStyleBoilerplate, getTemplatePath, toPascalCase };
package/dist/index.mjs CHANGED
@@ -133,4 +133,35 @@ function generatePackageJsonFields(outputs) {
133
133
  return {};
134
134
  }
135
135
  //#endregion
136
- export { PROJECT_TEMPLATES, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getStyleBoilerplate, getTemplatePath, toPascalCase };
136
+ //#region src/project/index-html.ts
137
+ /**
138
+ * Returns src/index.html source for a `www`-output project: entry <script> tag pointing
139
+ * at the compiled bundle, and a <link> to the global stylesheet if one was selected.
140
+ *
141
+ * @param sel - Wizard selections to encode into the HTML file.
142
+ * @returns HTML source string.
143
+ */
144
+ function generateIndexHtml(sel) {
145
+ const fsNamespace = sel.namespace.toLowerCase();
146
+ const headLines = [
147
+ ` <meta charset="UTF-8" />`,
148
+ ` <title>${sel.projectName}</title>`,
149
+ ` <meta name="viewport" content="width=device-width, initial-scale=1" />`
150
+ ];
151
+ if (sel.globalStyle) headLines.push(` <link rel="stylesheet" href="/build/${fsNamespace}.css" />`);
152
+ headLines.push(` <script type="module" src="/build/${fsNamespace}.js"><\/script>`);
153
+ return [
154
+ `<!doctype html>`,
155
+ `<html lang="en">`,
156
+ ` <head>`,
157
+ ...headLines,
158
+ ` </head>`,
159
+ ` <body>`,
160
+ ` <my-component first="Stencil" last="'Don't call me a framework' JS"></my-component>`,
161
+ ` </body>`,
162
+ `</html>`,
163
+ ``
164
+ ].join("\n");
165
+ }
166
+ //#endregion
167
+ export { PROJECT_TEMPLATES, generateIndexHtml, generatePackageJsonFields, generateStencilConfig, getComponentBoilerplate, getStyleBoilerplate, getTemplatePath, toPascalCase };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/templates",
3
- "version": "5.0.0-alpha.21",
3
+ "version": "5.0.0-alpha.23",
4
4
  "description": "Project and generate templates for Stencil",
5
5
  "keywords": [
6
6
  "scaffolding",
@@ -32,6 +32,9 @@
32
32
  "typescript": ">4.0.0 <7.0.0",
33
33
  "vitest": "^4.1.7"
34
34
  },
35
+ "peerDependencies": {
36
+ "@stencil/core": "^5.0.0 || 5.0.0-alpha.23"
37
+ },
35
38
  "volta": {
36
39
  "extends": "../../package.json"
37
40
  },