@haxtheweb/create 9.0.5 → 9.0.8

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.
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.communityStatement = communityStatement;
7
+ exports.haxIntro = haxIntro;
8
+ exports.merlinSays = merlinSays;
9
+ var _art = require("./art.js");
10
+ var p = _interopRequireWildcard(require("@clack/prompts"));
11
+ var _picocolors = _interopRequireDefault(require("picocolors"));
12
+ var _promises = require("node:timers/promises");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
+ 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); }
15
+ 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; }
16
+ async function haxIntro() {
17
+ console.clear();
18
+ await (0, _promises.setTimeout)(10);
19
+ console.clear();
20
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.underline(_picocolors.default.gray(`Never`)))}`);
21
+ await (0, _promises.setTimeout)(100);
22
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.red(` stop `))}`);
23
+ await (0, _promises.setTimeout)(300);
24
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.white(` never`))}`);
25
+ await (0, _promises.setTimeout)(300);
26
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default.cyan(` stopping `))}`);
27
+ await (0, _promises.setTimeout)(500);
28
+ let colors = ['blue', 'yellow', 'red', 'magenta'];
29
+ for (let i in _art.characters) {
30
+ if (i < _art.characters.length - 1) {
31
+ console.clear();
32
+ p.intro(`${_picocolors.default.bgBlack(_picocolors.default[colors[i]](`Better future loading..`))}`);
33
+ p.intro(_picocolors.default.bgBlack(_picocolors.default[colors[i]](_art.characters[i])));
34
+ let rockets = '';
35
+ for (let step = 0; step < i; step++) {
36
+ rockets += "🚀🚀🚀";
37
+ }
38
+ p.intro(rockets);
39
+ await (0, _promises.setTimeout)(Math.random() * 400 + 150);
40
+ }
41
+ }
42
+ console.clear();
43
+ p.intro(_picocolors.default.bgBlack(_picocolors.default.green(_art.characters.pop())));
44
+ p.intro(`${_picocolors.default.bgGreen(_picocolors.default.black(` The Web : CLI `))}
45
+
46
+
47
+ ${merlinSays('Welcome wary web wanderer')}`);
48
+ }
49
+
50
+ // standard community statement so we can leverage on cancel executions
51
+ function communityStatement() {
52
+ p.outro(`
53
+ 🧙 HAX @ Penn State: ${_picocolors.default.underline(_picocolors.default.cyan('https://hax.psu.edu'))}
54
+
55
+ 🔮 Ideas to HAX Harder, Better, Faster, Stronger: ${_picocolors.default.underline(_picocolors.default.white('https://github.com/haxtheweb/issues/issues'))}
56
+
57
+ 👔 Share on LinkedIn: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-the-linkedin'))}
58
+
59
+ 🧵 Tweet on X: ${_picocolors.default.underline(_picocolors.default.white('https://bit.ly/hax-the-x'))}
60
+
61
+ 💬 Join Community: ${_picocolors.default.underline(_picocolors.default.cyan('https://bit.ly/hax-discord'))}
62
+
63
+ 💡 ${_picocolors.default.bold(_picocolors.default.white(`Never. Stop. Innovating.`))}
64
+ `);
65
+ }
66
+
67
+ // standardize merlin statements visually
68
+ function merlinSays(text) {
69
+ return `${_picocolors.default.yellow(_picocolors.default.bgBlack(` 🧙 Merlin: `))} ${_picocolors.default.bgBlack(_picocolors.default.green(` ${text} `))}`;
70
+ }
@@ -12,7 +12,6 @@ var path = _interopRequireWildcard(require("node:path"));
12
12
  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); }
13
13
  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; }
14
14
  const SITE_FILE_NAME = exports.SITE_FILE_NAME = "site.json";
15
-
16
15
  /**
17
16
  * Helper to convert dash to camel; important when reading attributes.
18
17
  */
@@ -0,0 +1 @@
1
+ !node_modules/
@@ -0,0 +1,17 @@
1
+ language: node_js
2
+ dist: trusty
3
+ sudo: required
4
+ addons:
5
+ firefox: "latest"
6
+ apt:
7
+ sources:
8
+ - google-chrome
9
+ packages:
10
+ - google-chrome-stable
11
+ node_js: stable
12
+ before_install:
13
+ - npm install -g web-component-tester
14
+ install:
15
+ - npm install
16
+ script:
17
+ - xvfb-run npm run test
@@ -15,12 +15,13 @@ DDD + Lit web component based on OpenWC toolchain. This is intended to provide t
15
15
  - `npm run release` - this will build your code, update the version, and publish it to npm for others to use
16
16
 
17
17
  ## Working with your web component
18
- - edit `/src/<%= name %>.js`
18
+ - edit `./<%= name %>.js`
19
19
  - edit your 'demo' by modifying `./index.html`
20
20
  - add dependencies using `npm install --save @whatever/repo` or editing `./package.json` directly
21
21
  - if you must reference additional non-JS files, ensure you use the `new URL('./my-file.jpg', import.meta.url).href` syntax so that it builds correctly
22
- - if you add additional `.js` files / web components then place them under `/src/`
22
+ - if you add additional `.js` files / web components then place them under `/lib/`
23
23
  - to improve HAX wiring edit file in `/lib/<%= name %>.haxProperties.json`
24
+ - for i18n / internationalization efforts, see associated language `.json` files in `/locales/` as well as `/lib/` for haxProperties related translation examples.
24
25
 
25
26
  ## Recommended setup
26
27
  - Load VS code in 1 window to project root
@@ -11,7 +11,6 @@
11
11
  :root, html, body {
12
12
  margin: 0;
13
13
  padding: 0;
14
- background-color: var(--ddd-accent-1);
15
14
  }
16
15
  #demo {
17
16
  margin: var(--ddd-spacing-2);
@@ -44,16 +43,18 @@
44
43
  <h2>Property usage</h2>
45
44
  <<%= name %> id="example" title="Sample property title"></<%= name %>>
46
45
  </div>
47
- <script type="module" src="./src/<%= name %>.js"></script>
46
+ <script type="module" src="./<%= name %>.js"></script>
48
47
 
49
48
  <!-- Take HAX, the Web and you further down the rabbit hole -->
50
49
  <style>
51
50
  #follow-the-white-rabbit {
52
51
  margin: var(--ddd-spacing-4) auto 64px 16px;
53
52
  background-color: var(--ddd-accent-4);
53
+ color: black;
54
54
  }
55
55
  #follow-the-white-rabbit[open] summary {
56
56
  background-color: var(--ddd-accent-4) !important;
57
+ color: black;
57
58
  }
58
59
  #follow-the-white-rabbit[open] .content {
59
60
  padding: 0 var(--ddd-spacing-4);
@@ -98,7 +99,7 @@
98
99
  Below are links to help on your journey. Good luck, we need you!
99
100
  </p>
100
101
  <ul>
101
- <li><a href="https://oer.hax.psu.edu/bto108/sites/haxcellence/documentation/ddd" target="_blank">🧑‍🎨 Learn DDD HAX Design system</a></li>
102
+ <li><a href="https://haxtheweb.org/documentation/ddd" target="_blank">🧑‍🎨 Learn DDD HAX Design system</a></li>
102
103
  <li><a href="https://lit.dev/playground/" target="_blank" rel="nofollow">🔥 Learn Lit</a></li>
103
104
  <li><a href="https://hax.psu.edu" target="_blank">🧙 HAX The Web @ Penn State</a></li>
104
105
  </ul>
@@ -0,0 +1,16 @@
1
+ {
2
+ "settings": {
3
+ "configure": [
4
+ {
5
+ "title": "عنوان"
6
+ }
7
+ ]
8
+ },
9
+ "demoSchema": [
10
+ {
11
+ "properties": {
12
+ "title": "قيمة مخصصة"
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "عنوان"
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "settings": {
3
+ "configure": [
4
+ {
5
+ "title": "Título"
6
+ }
7
+ ]
8
+ },
9
+ "demoSchema": [
10
+ {
11
+ "properties": {
12
+ "title": "Valor personalizado"
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "título"
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "settings": {
3
+ "configure": [
4
+ {
5
+ "title": "शीर्षक"
6
+ }
7
+ ]
8
+ },
9
+ "demoSchema": [
10
+ {
11
+ "properties": {
12
+ "title": "कस्टम मूल्य"
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "शीर्षक"
3
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "settings": {
3
+ "configure": [
4
+ {
5
+ "title": "标题"
6
+ }
7
+ ]
8
+ },
9
+ "demoSchema": [
10
+ {
11
+ "properties": {
12
+ "title": "定制值"
13
+ }
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "title": "标题"
3
+ }
@@ -1,26 +1,35 @@
1
1
  {
2
- "name": "<%= name %>",
2
+ "name": "<%= org %><%= name %>",
3
+ "version": "0.0.0",
3
4
  "description": "Webcomponent <%= name %> following hax / open-wc recommendations",
4
5
  "license": "Apache-2.0",
5
- "author": "<%= author %>",
6
- "version": "0.0.0",
6
+ "author": {
7
+ "name": "<%= author %>"
8
+ },
9
+ "keywords": [
10
+ "webcomponents",
11
+ "lit",
12
+ "haxtheweb"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "<%= githubLink %>"
17
+ },
7
18
  "type": "module",
19
+ "main": "<%= name %>.js",
20
+ "module": "<%= name %>.js",
8
21
  "scripts": {
9
22
  "start": "web-dev-server",
10
23
  "build": "rimraf public && rollup -c rollup.config.js && npm run analyze",
11
24
  "analyze": "cem analyze --litelement --exclude public",
12
- "release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish"
25
+ "release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish",
26
+ "test": "web-test-runner test/**/*.test.js --coverage --node-resolve",
27
+ "test:watch": "web-test-runner test/**/*.test.js --node-resolve --watch"
13
28
  },
14
- "keywords": [
15
- "haxtheweb",
16
- "webcomponents",
17
- "lit",
18
- "generator",
19
- "starter-app"
20
- ],
21
29
  "dependencies": {
22
- "lit": "^3.1.4",
23
- "@haxtheweb/d-d-d": "^<%= version %>"
30
+ "lit": "^3.2.0",
31
+ "@haxtheweb/d-d-d": "^9.0.13",
32
+ "@haxtheweb/i18n-manager": "^9.0.13"
24
33
  },
25
34
  "devDependencies": {
26
35
  "@babel/preset-env": "^7.16.4",
@@ -29,7 +38,9 @@
29
38
  "@rollup/plugin-babel": "^6.0.4",
30
39
  "@rollup/plugin-node-resolve": "^15.2.3",
31
40
  "@rollup/plugin-terser": "^0.4.4",
32
- "@web/dev-server": "^0.4.5",
41
+ "@open-wc/testing": "^4.0.0",
42
+ "@web/dev-server": "^0.4.6",
43
+ "@web/test-runner": "^0.19.0",
33
44
  "@web/rollup-plugin-html": "^2.3.0",
34
45
  "@web/rollup-plugin-import-meta-assets": "^2.2.1",
35
46
  "babel-plugin-template-html-minifier": "^4.1.0",
@@ -38,5 +49,12 @@
38
49
  "rimraf": "^5.0.7",
39
50
  "commit-and-tag-version": "^12.4.1"
40
51
  },
52
+ "private": false,
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "hax": {
57
+ "cli": true
58
+ },
41
59
  "customElements": "custom-elements.json"
42
60
  }
@@ -0,0 +1,21 @@
1
+ import { html, fixture, expect } from '@open-wc/testing';
2
+ import "../<%= name %>.js";
3
+
4
+ describe("<%= className %> test", () => {
5
+ let element;
6
+ beforeEach(async () => {
7
+ element = await fixture(html`
8
+ <<%= name %>
9
+ title="title"
10
+ ></<%= name %>>
11
+ `);
12
+ });
13
+
14
+ it("basic will it blend", async () => {
15
+ expect(element).to.exist;
16
+ });
17
+
18
+ it("passes the a11y audit", async () => {
19
+ await expect(element).shadowDom.to.be.accessible();
20
+ });
21
+ });
@@ -6,6 +6,8 @@ const hmr = process.argv.includes('--hmr');
6
6
  export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
7
  open: '/',
8
8
  watch: !hmr,
9
+ https: true,
10
+ dedupe: true,
9
11
  /** Resolve bare module imports */
10
12
  nodeResolve: {
11
13
  exportConditions: ['browser', 'development'],
@@ -1,7 +1,18 @@
1
+ /**
2
+ * Copyright <%= year %> <%= author %>
3
+ * @license Apache-2.0, see LICENSE for full text.
4
+ */
1
5
  import { LitElement, html, css } from "lit";
2
6
  import { DDDSuper } from "@haxtheweb/d-d-d/d-d-d.js";
7
+ import { I18NMixin } from "@haxtheweb/i18n-manager/lib/I18NMixin.js";
3
8
 
4
- export class <%= className %> extends DDDSuper(LitElement) {
9
+ /**
10
+ * `<%= name %>`
11
+ *
12
+ * @demo index.html
13
+ * @element <%= name %>
14
+ */
15
+ export class <%= className %> extends DDDSuper(I18NMixin(LitElement)) {
5
16
 
6
17
  static get tag() {
7
18
  return "<%= name %>";
@@ -10,14 +21,29 @@ export class <%= className %> extends DDDSuper(LitElement) {
10
21
  constructor() {
11
22
  super();
12
23
  this.title = "";
24
+ this.t = this.t || {};
25
+ this.t = {
26
+ ...this.t,
27
+ title: "Title",
28
+ };
29
+ this.registerLocalization({
30
+ context: this,
31
+ localesPath:
32
+ new URL("./locales/<%= name %>.ar.json", import.meta.url).href +
33
+ "/../",
34
+ locales: ["ar", "es", "hi", "zh"],
35
+ });
13
36
  }
14
37
 
38
+ // Lit reactive properties
15
39
  static get properties() {
16
40
  return {
41
+ ...super.properties,
17
42
  title: { type: String },
18
43
  };
19
44
  }
20
45
 
46
+ // Lit scoped styles
21
47
  static get styles() {
22
48
  return [super.styles,
23
49
  css`
@@ -26,23 +52,22 @@ export class <%= className %> extends DDDSuper(LitElement) {
26
52
  color: var(--ddd-theme-primary);
27
53
  background-color: var(--ddd-theme-accent);
28
54
  font-family: var(--ddd-font-navigation);
29
- font-size: var(--<%= name %>-font-size, var(--ddd-font-size-s));
30
55
  }
31
56
  .wrapper {
32
57
  margin: var(--ddd-spacing-2);
33
58
  padding: var(--ddd-spacing-4);
34
59
  }
35
- div {
36
- padding: 0;
37
- margin: 0;
60
+ h3 span {
61
+ font-size: var(--<%= name %>-label-font-size, var(--ddd-font-size-s));
38
62
  }
39
63
  `];
40
64
  }
41
65
 
66
+ // Lit render the HTML
42
67
  render() {
43
68
  return html`
44
69
  <div class="wrapper">
45
- <div>${this.title}</div>
70
+ <h3><span>${this.t.title}:</span> ${this.title}</h3>
46
71
  <slot></slot>
47
72
  </div>`;
48
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haxtheweb/create",
3
- "version": "9.0.5",
3
+ "version": "9.0.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,8 @@
21
21
  "scripts": {
22
22
  "build": "rm -rf dist && babel src --out-dir dist --copy-files --include-dotfiles && chmod 774 dist/create.js",
23
23
  "start": "npm run build && node ./dist/create.js && chmod 774 dist/create.js",
24
- "release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish"
24
+ "release": "npm run build && commit-and-tag-version && git push --follow-tags origin main && npm publish",
25
+ "haxcms-nodejs-cli": "haxcms-nodejs-cli"
25
26
  },
26
27
  "bin": {
27
28
  "create-haxtheweb": "./dist/create.js",
@@ -31,22 +32,18 @@
31
32
  "dist"
32
33
  ],
33
34
  "keywords": [
34
- "haxtheweb",
35
- "haxcms",
36
- "haxsite",
37
- "htw",
38
35
  "webcomponents",
36
+ "html",
39
37
  "lit",
40
- "cms",
41
- "generator",
42
- "starter-app"
38
+ "haxtheweb"
43
39
  ],
44
40
  "dependencies": {
45
41
  "@clack/core": "0.3.4",
46
42
  "@clack/prompts": "0.7.0",
47
- "@haxtheweb/haxcms-nodejs": "^9.0.5",
43
+ "@haxtheweb/haxcms-nodejs": "^9.0.11",
48
44
  "ejs": "3.1.10",
49
- "picocolors": "1.0.1"
45
+ "picocolors": "1.0.1",
46
+ "commander": "12.1.0"
50
47
  },
51
48
  "devDependencies": {
52
49
  "@babel/cli": "^7.24.6",
File without changes