@haxtheweb/create 10.0.0 → 10.0.3
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/create.js +65 -3
- package/dist/lib/logging.js +7 -2
- package/dist/lib/programs/site.js +82 -6
- package/dist/templates/sitetheme/base-theme.js +45 -0
- package/dist/templates/sitetheme/flex-theme.js +66 -0
- package/dist/templates/sitetheme/sidebar-theme.js +112 -0
- package/dist/templates/webcomponent/hax/package.json +2 -2
- package/package.json +3 -3
package/dist/create.js
CHANGED
|
@@ -35,7 +35,7 @@ async function main() {
|
|
|
35
35
|
.option('--org <char>', 'organization for package.json').option('--author <char>', 'author for site / package.json').option('--writeHaxProperties', 'Write haxProperties for the element')
|
|
36
36
|
|
|
37
37
|
// options for site
|
|
38
|
-
.option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--node-op <char>', 'node operation to perform').option('--item-id <char>', 'node ID to operate on').option('--name <char>', 'name of the project').option('--domain <char>', 'published domain name').option('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--items-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').version(await HAXCMS.getHAXCMSVersion()).helpCommand(true);
|
|
38
|
+
.option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--node-op <char>', 'node operation to perform').option('--item-id <char>', 'node ID to operate on').option('--name <char>', 'name of the project').option('--domain <char>', 'published domain name').option('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--items-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').option('--custom-theme-name <char>', 'custom theme name').option('--custom-theme-template <char>', 'custom theme template; (options: base, polaris-flex, polaris-sidebar)').version(await HAXCMS.getHAXCMSVersion()).helpCommand(true);
|
|
39
39
|
|
|
40
40
|
// default command which runs interactively
|
|
41
41
|
_commander.program.command('start').description('Select which hax sub-program to run').action(() => {
|
|
@@ -61,7 +61,7 @@ async function main() {
|
|
|
61
61
|
commandRun.arguments.action = action;
|
|
62
62
|
commandRun.options.skip = true;
|
|
63
63
|
}
|
|
64
|
-
}).option('--v', 'Verbose output').option('--debug', 'Output for developers').option('--format <char>', 'Output format; json (default), yaml').option('--path <char>', 'where to perform operation').option('--npm-client <char>', 'npm client to use (must be installed) npm, yarn, pnpm', 'npm').option('--y', 'yes to all questions').option('--skip', 'skip frills like animations').option('--quiet', 'remove console logging').option('--auto', 'yes to all questions, alias of y').option('--no-i', 'prevent interactions / sub-process, good for scripting').option('--to-file <char>', 'redirect command output to a file').option('--no-extras', 'skip all extra / automatic command processing').option('--root <char>', 'root location to execute the command from').option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--name <char>', 'name of the site (when creating a new one)').option('--domain <char>', 'published domain name').option('--node-op <char>', 'node operation to perform').option('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--item-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').version(await HAXCMS.getHAXCMSVersion());
|
|
64
|
+
}).option('--v', 'Verbose output').option('--debug', 'Output for developers').option('--format <char>', 'Output format; json (default), yaml').option('--path <char>', 'where to perform operation').option('--npm-client <char>', 'npm client to use (must be installed) npm, yarn, pnpm', 'npm').option('--y', 'yes to all questions').option('--skip', 'skip frills like animations').option('--quiet', 'remove console logging').option('--auto', 'yes to all questions, alias of y').option('--no-i', 'prevent interactions / sub-process, good for scripting').option('--to-file <char>', 'redirect command output to a file').option('--no-extras', 'skip all extra / automatic command processing').option('--root <char>', 'root location to execute the command from').option('--import-site <char>', 'URL of site to import').option('--import-structure <char>', `import method to use:\n\rpressbooksToSite\n\relmslnToSite\n\rhaxcmsToSite\n\rnotionToSite\n\rgitbookToSite\n\revolutionToSite\n\rhtmlToSite\n\rdocxToSite`).option('--name <char>', 'name of the site (when creating a new one)').option('--domain <char>', 'published domain name').option('--node-op <char>', 'node operation to perform').option('--title-scrape <char>', 'CSS Selector for `title` in resource').option('--content-scrape <char>', 'CSS Selector for `body` in resource').option('--item-import <char>', 'import items from a file / site').option('--recipe <char>', 'path to recipe file').option('--custom-theme-name <char>', 'custom theme name').option('--custom-theme-template <char>', 'custom theme template (options: base, polaris-flex, polaris-sidebar)').version(await HAXCMS.getHAXCMSVersion());
|
|
65
65
|
let siteNodeOps = (0, _site.siteNodeOperations)();
|
|
66
66
|
for (var i in siteNodeOps) {
|
|
67
67
|
_commander.program.option(`--${(0, _utils.camelToDash)(siteNodeOps[i].value)} <char>`, `${siteNodeOps[i].label}`);
|
|
@@ -134,6 +134,10 @@ async function main() {
|
|
|
134
134
|
commandRun.options.author = author;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
// validate theme cli commands
|
|
138
|
+
if (commandRun.options.theme !== 'custom-theme' && (commandRun.options.customThemeName || commandRun.options.customThemeTemplate)) {
|
|
139
|
+
_commander.program.error(_picocolors.default.red('ERROR: You can only use the --custom-theme-name option with --theme custom-theme'));
|
|
140
|
+
}
|
|
137
141
|
let packageData = {};
|
|
138
142
|
let testPackages = [path.join(process.cwd(), 'package.json'), path.join(process.cwd(), '../', 'package.json'), path.join(process.cwd(), '../', '../', 'package.json')];
|
|
139
143
|
// test within reason, for package.json files seeing if anything is available to suggest
|
|
@@ -262,6 +266,14 @@ async function main() {
|
|
|
262
266
|
activeProject = project.type;
|
|
263
267
|
// silly but this way we don't have to take options for quitting
|
|
264
268
|
if (project.type !== 'quit') {
|
|
269
|
+
// also silly temp spot
|
|
270
|
+
let themes = await (0, _site.siteThemeList)();
|
|
271
|
+
const custom = {
|
|
272
|
+
value: 'custom-theme',
|
|
273
|
+
label: 'Create Custom Theme'
|
|
274
|
+
};
|
|
275
|
+
// Append custom option to list of core themes
|
|
276
|
+
themes.push(custom);
|
|
265
277
|
project = await p.group({
|
|
266
278
|
type: ({
|
|
267
279
|
results
|
|
@@ -362,7 +374,6 @@ async function main() {
|
|
|
362
374
|
theme: async ({
|
|
363
375
|
results
|
|
364
376
|
}) => {
|
|
365
|
-
let themes = await (0, _site.siteThemeList)();
|
|
366
377
|
if (results.type === "site" && !commandRun.options.theme) {
|
|
367
378
|
// support having no theme but autoselecting
|
|
368
379
|
if (commandRun.options.auto && commandRun.options.skip) {
|
|
@@ -377,6 +388,57 @@ async function main() {
|
|
|
377
388
|
}
|
|
378
389
|
}
|
|
379
390
|
},
|
|
391
|
+
customThemeName: async ({
|
|
392
|
+
results
|
|
393
|
+
}) => {
|
|
394
|
+
if (results.theme === "custom-theme") {
|
|
395
|
+
let tmpCustomName = await p.text({
|
|
396
|
+
message: 'Theme Name:',
|
|
397
|
+
placeholder: `${results.name}`,
|
|
398
|
+
required: false,
|
|
399
|
+
validate: value => {
|
|
400
|
+
if (!value) {
|
|
401
|
+
return "Theme name is required (tab writes default)";
|
|
402
|
+
}
|
|
403
|
+
if (themes.some(theme => theme.value === value)) {
|
|
404
|
+
return "Theme name is already in use";
|
|
405
|
+
}
|
|
406
|
+
if (/^\d/.test(value)) {
|
|
407
|
+
return "Theme name cannot start with a number";
|
|
408
|
+
}
|
|
409
|
+
if (/[A-Z]/.test(value)) {
|
|
410
|
+
return "No uppercase letters allowed in theme name";
|
|
411
|
+
}
|
|
412
|
+
if (value.indexOf(' ') !== -1) {
|
|
413
|
+
return "No spaces allowed in theme name";
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
return tmpCustomName;
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
customThemeTemplate: ({
|
|
421
|
+
results
|
|
422
|
+
}) => {
|
|
423
|
+
if (results.theme === "custom-theme") {
|
|
424
|
+
const options = [{
|
|
425
|
+
value: 'base',
|
|
426
|
+
label: 'Vanilla Theme with Hearty Documentation'
|
|
427
|
+
}, {
|
|
428
|
+
value: 'polaris-flex',
|
|
429
|
+
label: 'Minimalist Theme with Horizontal Nav'
|
|
430
|
+
}, {
|
|
431
|
+
value: 'polaris-sidebar',
|
|
432
|
+
label: 'Content-Focused Theme with Flexible Sidebar'
|
|
433
|
+
}];
|
|
434
|
+
return p.select({
|
|
435
|
+
message: 'Template:',
|
|
436
|
+
required: false,
|
|
437
|
+
options: options,
|
|
438
|
+
initialValue: `${results.theme}`
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
},
|
|
380
442
|
extras: ({
|
|
381
443
|
results
|
|
382
444
|
}) => {
|
package/dist/lib/logging.js
CHANGED
|
@@ -14,7 +14,12 @@ var winston = _interopRequireWildcard(require("winston"));
|
|
|
14
14
|
var _utils = require("./utils.js");
|
|
15
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
16
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
-
|
|
17
|
+
// check for vercel running which is not allowed to write to home in logs
|
|
18
|
+
let baseLogPath = (0, _nodeOs.homedir)();
|
|
19
|
+
if (process.env.VERCEL_ENV) {
|
|
20
|
+
baseLogPath = "/tmp/";
|
|
21
|
+
}
|
|
22
|
+
const logFileName = path.join(baseLogPath, '.haxtheweb', 'create.log');
|
|
18
23
|
const consoleTransport = exports.consoleTransport = new winston.transports.Console({
|
|
19
24
|
format: winston.format.simple()
|
|
20
25
|
});
|
|
@@ -35,7 +40,7 @@ const logger = exports.logger = winston.createLogger({
|
|
|
35
40
|
transports: [consoleTransport, logFile]
|
|
36
41
|
});
|
|
37
42
|
function haxCliEnvOptions() {
|
|
38
|
-
return ['skip', 'npmClient', 'i', 'extras', 'root', 'path', 'org', 'author', 'y', 'auto'];
|
|
43
|
+
return ['skip', 'npmClient', 'i', 'extras', 'root', 'path', 'org', 'author', 'y', 'auto', 'domain'];
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
// wrapper so we can silence all log messages at the same time
|
|
@@ -15,11 +15,13 @@ var _promises = require("node:timers/promises");
|
|
|
15
15
|
var fs = _interopRequireWildcard(require("node:fs"));
|
|
16
16
|
var path = _interopRequireWildcard(require("node:path"));
|
|
17
17
|
var p = _interopRequireWildcard(require("@clack/prompts"));
|
|
18
|
+
var ejs = _interopRequireWildcard(require("ejs"));
|
|
18
19
|
var _picocolors = _interopRequireDefault(require("picocolors"));
|
|
19
20
|
var _jsYaml = require("js-yaml");
|
|
20
21
|
var winston = _interopRequireWildcard(require("winston"));
|
|
21
22
|
var _nodeHtmlParser = require("node-html-parser");
|
|
22
23
|
var _statements = require("../statements.js");
|
|
24
|
+
var _utils = require("../utils.js");
|
|
23
25
|
var _logging = require("../logging.js");
|
|
24
26
|
var _microFrontendRegistry = require("../micro-frontend-registry.js");
|
|
25
27
|
var haxcmsNodejsCli = _interopRequireWildcard(require("@haxtheweb/haxcms-nodejs/dist/cli.js"));
|
|
@@ -752,12 +754,12 @@ async function siteCommandDetected(commandRun) {
|
|
|
752
754
|
initialValue: val,
|
|
753
755
|
options: list
|
|
754
756
|
});
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
757
|
+
}
|
|
758
|
+
let themes = await HAXCMS.getThemes();
|
|
759
|
+
if (themes && commandRun.options.theme && themes[commandRun.options.theme]) {
|
|
760
|
+
activeHaxsite.manifest.metadata.theme = themes[commandRun.options.theme];
|
|
761
|
+
activeHaxsite.manifest.save(false);
|
|
762
|
+
recipe.log(siteLoggingName, (0, _logging.commandString)(commandRun));
|
|
761
763
|
}
|
|
762
764
|
} catch (e) {
|
|
763
765
|
(0, _logging.log)(e.stderr);
|
|
@@ -1208,6 +1210,13 @@ async function siteProcess(commandRun, project, port = '3000') {
|
|
|
1208
1210
|
s.stop((0, _statements.merlinSays)(`${project.name} created!`));
|
|
1209
1211
|
await (0, _promises.setTimeout)(500);
|
|
1210
1212
|
}
|
|
1213
|
+
|
|
1214
|
+
// Write theme template to site/custom
|
|
1215
|
+
if (commandRun.options.theme === 'custom-theme' && commandRun.options.customThemeName && commandRun.options.customThemeTemplate || project.customThemeName && project.customThemeTemplate) {
|
|
1216
|
+
s.start((0, _statements.merlinSays)(`Creating new theme: ${commandRun.options.customThemeName ? commandRun.options.customThemeName : project.customThemeName}`));
|
|
1217
|
+
await customSiteTheme(commandRun, project);
|
|
1218
|
+
s.stop((0, _statements.merlinSays)(`${commandRun.options.customThemeName ? commandRun.options.customThemeName : project.customThemeName} theme created!`));
|
|
1219
|
+
}
|
|
1211
1220
|
if (project.gitRepo && !commandRun.options.isMonorepo) {
|
|
1212
1221
|
try {
|
|
1213
1222
|
await exec(`cd ${project.path}/${project.name} && git init && git add -A && git commit -m "first commit" && git branch -M main${project.gitRepo ? ` && git remote add origin ${project.gitRepo}` : ''}`);
|
|
@@ -1271,6 +1280,73 @@ async function siteThemeList() {
|
|
|
1271
1280
|
}
|
|
1272
1281
|
return items;
|
|
1273
1282
|
}
|
|
1283
|
+
async function customSiteTheme(commandRun, project) {
|
|
1284
|
+
// pass theme name for twig templates
|
|
1285
|
+
project.customThemeName = commandRun.options.customThemeName ? commandRun.options.customThemeName : project.customThemeName;
|
|
1286
|
+
|
|
1287
|
+
// validate start and end tags for theme name
|
|
1288
|
+
if (/^custom/.test(project.customThemeName) && !/^custom-/.test(project.customThemeName)) {
|
|
1289
|
+
project.customThemeName = project.customThemeName.replace(/^custom/, "custom-");
|
|
1290
|
+
} else if (!/^custom-/.test(project.className)) {
|
|
1291
|
+
project.customThemeName = `custom-${project.customThemeName}`;
|
|
1292
|
+
}
|
|
1293
|
+
if (/theme$/.test(project.customThemeName) && !/-theme$/.test(project.customThemeName)) {
|
|
1294
|
+
project.customThemeName = project.customThemeName.replace(/theme$/, "-theme");
|
|
1295
|
+
} else if (!/-theme$/.test(project.customThemeName)) {
|
|
1296
|
+
project.customThemeName = `${project.customThemeName}-theme`;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
// set camel case class name
|
|
1300
|
+
project.className = (0, _utils.dashToCamel)(project.customThemeName);
|
|
1301
|
+
|
|
1302
|
+
// path to hax site
|
|
1303
|
+
var sitePath = `${project.path}/${commandRun.options.name ? commandRun.options.name : project.name}`;
|
|
1304
|
+
|
|
1305
|
+
// path to new theme file
|
|
1306
|
+
const filePath = `${sitePath}/custom/src/${project.customThemeName}.js`;
|
|
1307
|
+
|
|
1308
|
+
// theme template to use
|
|
1309
|
+
const themeTemplate = commandRun.options.customThemeTemplate ? commandRun.options.customThemeTemplate : project.customThemeTemplate;
|
|
1310
|
+
if (themeTemplate === "polaris-flex") {
|
|
1311
|
+
await fs.copyFileSync(`${process.mainModule.path}/templates/sitetheme/flex-theme.js`, `${sitePath}/custom/src/flex-theme.js`);
|
|
1312
|
+
await fs.renameSync(`${sitePath}/custom/src/flex-theme.js`, filePath);
|
|
1313
|
+
} else if (themeTemplate === "polaris-sidebar") {
|
|
1314
|
+
await fs.copyFileSync(`${process.mainModule.path}/templates/sitetheme/sidebar-theme.js`, `${sitePath}/custom/src/sidebar-theme.js`);
|
|
1315
|
+
await fs.renameSync(`${sitePath}/custom/src/sidebar-theme.js`, filePath);
|
|
1316
|
+
} else {
|
|
1317
|
+
// vanilla theme is default
|
|
1318
|
+
await fs.copyFileSync(`${process.mainModule.path}/templates/sitetheme/base-theme.js`, `${sitePath}/custom/src/base-theme.js`);
|
|
1319
|
+
await fs.renameSync(`${sitePath}/custom/src/base-theme.js`, filePath);
|
|
1320
|
+
}
|
|
1321
|
+
try {
|
|
1322
|
+
// ensure we don't try to pattern rewrite image files
|
|
1323
|
+
if (!filePath.endsWith('.jpg') && !filePath.endsWith('.png')) {
|
|
1324
|
+
const ejsString = ejs.fileLoader(filePath, 'utf8');
|
|
1325
|
+
let content = ejs.render(ejsString, project);
|
|
1326
|
+
// file written successfully
|
|
1327
|
+
fs.writeFileSync(filePath, content);
|
|
1328
|
+
}
|
|
1329
|
+
} catch (err) {
|
|
1330
|
+
console.error(filePath);
|
|
1331
|
+
console.error(err);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
// import theme to custom.js
|
|
1335
|
+
await fs.appendFileSync(`${sitePath}/custom/src/custom.js`, `\n import "./${project.customThemeName}.js"`);
|
|
1336
|
+
var activeHaxsite = await hax.systemStructureContext(sitePath);
|
|
1337
|
+
|
|
1338
|
+
// add theme to site.json
|
|
1339
|
+
let themeObj = {
|
|
1340
|
+
element: project.customThemeName,
|
|
1341
|
+
path: filePath,
|
|
1342
|
+
name: project.className
|
|
1343
|
+
};
|
|
1344
|
+
activeHaxsite.manifest.metadata.theme = themeObj;
|
|
1345
|
+
activeHaxsite.manifest.save(false);
|
|
1346
|
+
|
|
1347
|
+
// install and build theme dependencies
|
|
1348
|
+
await exec(`cd ${sitePath}/custom/ && ${commandRun.options.npmClient} install && ${commandRun.options.npmClient} run build && cd ${sitePath}`);
|
|
1349
|
+
}
|
|
1274
1350
|
|
|
1275
1351
|
// @fork of the hax core util for this so that we avoid api difference between real dom and parse nodejs dom
|
|
1276
1352
|
async function nodeToHaxElement(node, eventName = "insert-element") {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright <%= year %> <%= author %>
|
|
3
|
+
* @license Apache-2.0, see License.md for full text.
|
|
4
|
+
*/
|
|
5
|
+
import { html, css, HAXCMSLitElementTheme } from "@haxtheweb/haxcms-elements/lib/core/HAXCMSLitElementTheme.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `<%= className %>`
|
|
9
|
+
* `<%= className %> based on modern flex design system`
|
|
10
|
+
* `This theme is an example of extending an existing theme component`
|
|
11
|
+
*
|
|
12
|
+
* @microcopy - language worth noting:
|
|
13
|
+
* - HAXcms - A headless content management system
|
|
14
|
+
* - HAXCMSTheme - A super class that provides correct baseline wiring to build a new theme
|
|
15
|
+
*
|
|
16
|
+
* @demo demo/index.html
|
|
17
|
+
* @element <%= customThemeName %>
|
|
18
|
+
*/
|
|
19
|
+
class <%= className %> extends HAXCMSLitElementTheme {
|
|
20
|
+
//styles function
|
|
21
|
+
static get styles() {
|
|
22
|
+
return [
|
|
23
|
+
super.styles,
|
|
24
|
+
css`
|
|
25
|
+
:host {
|
|
26
|
+
display: block;
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Store the tag name to make it easier to obtain directly.
|
|
34
|
+
* @notice function name must be here for tooling to operate correctly
|
|
35
|
+
*/
|
|
36
|
+
static get tag() {
|
|
37
|
+
return "<%= customThemeName %>";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
customElements.define(<%= className %>.tag, <%= className %>);
|
|
45
|
+
export { <%= className %> };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright <%= year %> <%= author %>
|
|
3
|
+
* @license Apache-2.0, see License.md for full text.
|
|
4
|
+
*/
|
|
5
|
+
import { html, css, HAXCMSLitElementTheme } from "@haxtheweb/haxcms-elements/lib/core/HAXCMSLitElementTheme.js";
|
|
6
|
+
import { PolarisFlexTheme } from "@haxtheweb/polaris-theme/lib/polaris-flex-theme";
|
|
7
|
+
import "@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-children-block.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `<%= className %>`
|
|
11
|
+
* `<%= className %> based on modern flex design system`
|
|
12
|
+
* `This theme is an example of extending an existing theme component`
|
|
13
|
+
*
|
|
14
|
+
* @microcopy - language worth noting:
|
|
15
|
+
* - HAXcms - A headless content management system
|
|
16
|
+
* - HAXCMSTheme - A super class that provides correct baseline wiring to build a new theme
|
|
17
|
+
*
|
|
18
|
+
* @demo demo/index.html
|
|
19
|
+
* @element <%= customThemeName %>
|
|
20
|
+
*/
|
|
21
|
+
class <%= className %> extends PolarisFlexTheme {
|
|
22
|
+
//styles function
|
|
23
|
+
static get styles() {
|
|
24
|
+
return [
|
|
25
|
+
super.styles,
|
|
26
|
+
css`
|
|
27
|
+
:host {
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
`,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Overload methods for customization of slots from the base class
|
|
36
|
+
*/
|
|
37
|
+
renderHeaderSlot() {
|
|
38
|
+
return html``
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
renderFooterContactInformation() {
|
|
42
|
+
return html``
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
renderFooterSecondarySlot() {
|
|
46
|
+
return html``
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
renderFooterPrimarySlot() {
|
|
50
|
+
return html``
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Store the tag name to make it easier to obtain directly.
|
|
55
|
+
* @notice function name must be here for tooling to operate correctly
|
|
56
|
+
*/
|
|
57
|
+
static get tag() {
|
|
58
|
+
return "<%= customThemeName %>";
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
customElements.define(<%= className %>.tag, <%= className %>);
|
|
66
|
+
export { <%= className %> };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright <%= year %> <%= author %>
|
|
3
|
+
* @license Apache-2.0, see License.md for full text.
|
|
4
|
+
*/
|
|
5
|
+
import { html, css, HAXCMSLitElementTheme } from "@haxtheweb/haxcms-elements/lib/core/HAXCMSLitElementTheme.js";
|
|
6
|
+
import { PolarisFlexTheme } from "@haxtheweb/polaris-theme/lib/polaris-flex-theme";
|
|
7
|
+
import "@haxtheweb/haxcms-elements/lib/ui-components/blocks/site-children-block.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `<%= className %>`
|
|
11
|
+
* `<%= className %> based on modern flex design system`
|
|
12
|
+
* `This theme is an example of extending an existing theme component`
|
|
13
|
+
*
|
|
14
|
+
* @microcopy - language worth noting:
|
|
15
|
+
* - HAXcms - A headless content management system
|
|
16
|
+
* - HAXCMSTheme - A super class that provides correct baseline wiring to build a new theme
|
|
17
|
+
*
|
|
18
|
+
* @demo demo/index.html
|
|
19
|
+
* @element <%= customThemeName %>
|
|
20
|
+
*/
|
|
21
|
+
class <%= className %> extends PolarisFlexTheme {
|
|
22
|
+
//styles function
|
|
23
|
+
static get styles() {
|
|
24
|
+
return [
|
|
25
|
+
super.styles,
|
|
26
|
+
css`
|
|
27
|
+
:host {
|
|
28
|
+
display: block;
|
|
29
|
+
}
|
|
30
|
+
aside {
|
|
31
|
+
float: left;
|
|
32
|
+
width: 240px;
|
|
33
|
+
}
|
|
34
|
+
aside section h4 {
|
|
35
|
+
font-size: 16px;
|
|
36
|
+
margin: 0 0 24px 0;
|
|
37
|
+
text-transform: uppercase;
|
|
38
|
+
font-family: "Open Sans", sans-serif;
|
|
39
|
+
font-weight: 300;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
aside section {
|
|
43
|
+
background-color: #fff;
|
|
44
|
+
border-radius: 3px;
|
|
45
|
+
margin-bottom: 40px;
|
|
46
|
+
padding: 0px 40px 40px 0px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
site-children-block {
|
|
50
|
+
--site-children-block-border-bottom: lightblue 1px solid;
|
|
51
|
+
--site-children-block-li-padding: 8px 0;
|
|
52
|
+
--site-children-block-link-hover-color: rgb(0, 95, 169);
|
|
53
|
+
--site-children-block-active-border-left: rgb(0, 95, 169) 3px solid;
|
|
54
|
+
--site-children-block-link-active-color: rgb(0, 30, 68);
|
|
55
|
+
font-family: "Roboto Condensed", sans-serif;
|
|
56
|
+
font-size: 16px;
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Overload methods for customization of slots from the base class
|
|
64
|
+
*/
|
|
65
|
+
renderHeaderSlot() {
|
|
66
|
+
return html``
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
renderSideBar() {
|
|
70
|
+
return html`
|
|
71
|
+
<aside
|
|
72
|
+
role="complementary"
|
|
73
|
+
aria-label="Primary Sidebar"
|
|
74
|
+
itemtype="http://schema.org/WPSideBar"
|
|
75
|
+
part="page-primary-sidebar"
|
|
76
|
+
>
|
|
77
|
+
<section>
|
|
78
|
+
<site-children-block
|
|
79
|
+
part="page-children-block"
|
|
80
|
+
dynamic-methodology="ancestor"
|
|
81
|
+
></site-children-block>
|
|
82
|
+
</section>
|
|
83
|
+
</aside>
|
|
84
|
+
`
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
renderFooterContactInformation() {
|
|
88
|
+
return html``
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
renderFooterSecondarySlot() {
|
|
92
|
+
return html``
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
renderFooterPrimarySlot() {
|
|
96
|
+
return html``
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Store the tag name to make it easier to obtain directly.
|
|
101
|
+
* @notice function name must be here for tooling to operate correctly
|
|
102
|
+
*/
|
|
103
|
+
static get tag() {
|
|
104
|
+
return "<%= customThemeName %>";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
constructor() {
|
|
108
|
+
super();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
customElements.define(<%= className %>.tag, <%= className %>);
|
|
112
|
+
export { <%= className %> };
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"lit": "^3.2.1",
|
|
31
|
-
"@haxtheweb/d-d-d": "^
|
|
32
|
-
"@haxtheweb/i18n-manager": "^
|
|
31
|
+
"@haxtheweb/d-d-d": "^10.0.2",
|
|
32
|
+
"@haxtheweb/i18n-manager": "^10.0.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@babel/preset-env": "^7.16.4",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haxtheweb/create",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@clack/core": "0.3.4",
|
|
47
47
|
"@clack/prompts": "0.7.0",
|
|
48
|
-
"@haxtheweb/haxcms-nodejs": "^10.0.
|
|
48
|
+
"@haxtheweb/haxcms-nodejs": "^10.0.1",
|
|
49
49
|
"@haxtheweb/open-apis": "^10.0.1",
|
|
50
50
|
"commander": "12.1.0",
|
|
51
|
-
"node-html-parser": "6.1.13",
|
|
52
51
|
"ejs": "3.1.10",
|
|
53
52
|
"js-yaml": "4.1.0",
|
|
53
|
+
"node-html-parser": "6.1.13",
|
|
54
54
|
"picocolors": "1.0.1",
|
|
55
55
|
"winston": "3.17.0"
|
|
56
56
|
},
|