@fusion.dev/helix-templates 0.137.0 → 0.139.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/README.md +18 -6
- package/dist/index.js +24 -0
- package/package.json +1 -1
- package/templates/angular/angular.json +57 -0
- package/templates/angular/package.json +28 -0
- package/templates/angular/src/app/app.config.ts +8 -0
- package/templates/angular/src/app/app.html +19 -0
- package/templates/angular/src/app/app.ts +29 -0
- package/templates/angular/src/app/data.ts +81 -0
- package/templates/angular/src/app/docs.ts +29 -0
- package/templates/angular/src/app/landing.html +112 -0
- package/templates/angular/src/app/landing.ts +31 -0
- package/templates/angular/src/app/overview.html +49 -0
- package/templates/angular/src/app/overview.ts +25 -0
- package/templates/angular/src/app/pathname.ts +24 -0
- package/templates/angular/src/app/signup-form.html +91 -0
- package/templates/angular/src/app/signup-form.ts +65 -0
- package/templates/angular/src/app/site-footer.html +10 -0
- package/templates/angular/src/app/site-footer.ts +22 -0
- package/templates/angular/src/app/site-header.html +30 -0
- package/templates/angular/src/app/site-header.ts +58 -0
- package/templates/angular/src/app.css +363 -0
- package/templates/angular/src/diagnostics.ts +24 -0
- package/templates/angular/src/index.html +12 -0
- package/templates/angular/src/main.ts +21 -0
- package/templates/angular/tsconfig.app.json +9 -0
- package/templates/angular/tsconfig.json +34 -0
- package/templates/react-nextjs/app/diagnostics.ts +19 -0
- package/templates/react-nextjs/app/landing.tsx +2 -2
- package/templates/react-nextjs/app/overview.tsx +1 -1
- package/templates/react-nextjs/instrumentation-client.ts +6 -0
- package/templates/react-nextjs/package.json +1 -0
- package/templates/react-nextjs/tsconfig.json +1 -0
- package/templates/react-vite/package.json +1 -0
- package/templates/react-vite/src/diagnostics.ts +24 -0
- package/templates/react-vite/src/main.tsx +6 -0
- package/templates/react-vite/tsconfig.json +1 -0
- package/templates/solid-vite/helix-solid.d.ts +14 -0
- package/templates/solid-vite/index.html +12 -0
- package/templates/solid-vite/package.json +22 -0
- package/templates/solid-vite/src/App.tsx +35 -0
- package/templates/solid-vite/src/app.css +363 -0
- package/templates/solid-vite/src/data.ts +81 -0
- package/templates/solid-vite/src/diagnostics.ts +24 -0
- package/templates/solid-vite/src/docs.ts +29 -0
- package/templates/solid-vite/src/landing.tsx +177 -0
- package/templates/solid-vite/src/main.tsx +23 -0
- package/templates/solid-vite/src/overview.tsx +78 -0
- package/templates/solid-vite/src/routes.ts +22 -0
- package/templates/solid-vite/src/signup-form.tsx +151 -0
- package/templates/solid-vite/src/site-footer.tsx +34 -0
- package/templates/solid-vite/src/site-header.tsx +77 -0
- package/templates/solid-vite/tsconfig.json +27 -0
- package/templates/solid-vite/vite.config.ts +7 -0
- package/templates/svelte-vite/helix-svelte.d.ts +9 -0
- package/templates/svelte-vite/index.html +12 -0
- package/templates/svelte-vite/package.json +23 -0
- package/templates/svelte-vite/src/App.svelte +35 -0
- package/templates/svelte-vite/src/Landing.svelte +137 -0
- package/templates/svelte-vite/src/Overview.svelte +67 -0
- package/templates/svelte-vite/src/SignupForm.svelte +148 -0
- package/templates/svelte-vite/src/SiteFooter.svelte +26 -0
- package/templates/svelte-vite/src/SiteHeader.svelte +72 -0
- package/templates/svelte-vite/src/app.css +363 -0
- package/templates/svelte-vite/src/data.ts +81 -0
- package/templates/svelte-vite/src/diagnostics.ts +24 -0
- package/templates/svelte-vite/src/docs.ts +29 -0
- package/templates/svelte-vite/src/main.ts +23 -0
- package/templates/svelte-vite/src/routes.svelte.ts +19 -0
- package/templates/svelte-vite/tsconfig.json +28 -0
- package/templates/svelte-vite/vite.config.ts +7 -0
- package/templates/vue-vite/helix-vue.d.ts +8 -0
- package/templates/vue-vite/index.html +12 -0
- package/templates/vue-vite/package.json +23 -0
- package/templates/vue-vite/src/App.vue +39 -0
- package/templates/vue-vite/src/LandingPage.vue +139 -0
- package/templates/vue-vite/src/OverviewPage.vue +69 -0
- package/templates/vue-vite/src/SignupForm.vue +149 -0
- package/templates/vue-vite/src/SiteFooter.vue +28 -0
- package/templates/vue-vite/src/SiteHeader.vue +72 -0
- package/templates/vue-vite/src/app.css +363 -0
- package/templates/vue-vite/src/data.ts +81 -0
- package/templates/vue-vite/src/diagnostics.ts +24 -0
- package/templates/vue-vite/src/docs.ts +29 -0
- package/templates/vue-vite/src/main.ts +23 -0
- package/templates/vue-vite/src/routes.ts +26 -0
- package/templates/vue-vite/tsconfig.json +26 -0
- package/templates/vue-vite/vite.config.ts +13 -0
- package/templates.json +41 -0
package/README.md
CHANGED
|
@@ -16,13 +16,25 @@ written against.
|
|
|
16
16
|
|---|---|
|
|
17
17
|
| `react-vite` | React and TypeScript on Vite. The shortest path to a running app. |
|
|
18
18
|
| `react-nextjs` | React and TypeScript on the Next.js App Router, the three pages as real routes. |
|
|
19
|
+
| `vue-vite` | Vue and TypeScript on Vite. |
|
|
20
|
+
| `angular` | Angular and TypeScript on the Angular CLI. |
|
|
21
|
+
| `svelte-vite` | Svelte and TypeScript on Vite. |
|
|
22
|
+
| `solid-vite` | Solid and TypeScript on Vite. |
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Every template lays down the same three pages, in the same order and with the
|
|
25
|
+
same copy:
|
|
26
|
+
|
|
27
|
+
- a landing page saying what is installed and where it is documented;
|
|
28
|
+
- an overview holding a sorted, paged, selectable data table;
|
|
29
|
+
- a form whose controls a `<form>` reads with `FormData`, because they are real
|
|
30
|
+
form participants.
|
|
31
|
+
|
|
32
|
+
What differs between them is what each framework requires. `bun run
|
|
33
|
+
smoke:scaffold` builds every template and holds what each renders to React on
|
|
34
|
+
Vite's, in markup and in pictures, so a template that drifts fails CI.
|
|
35
|
+
|
|
36
|
+
Each one starts Helix diagnostics in development, checked against the lint data
|
|
37
|
+
of the Helix it installed, and a production build leaves it out.
|
|
26
38
|
|
|
27
39
|
**There is no build-free HTML template**, and that is a fact about the packages
|
|
28
40
|
rather than an omission. `@fusion.dev/helix`'s published entry re-exports bare
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,30 @@ export const templates = [
|
|
|
11
11
|
named: ['app/layout.tsx', 'app/site-header.tsx', 'package.json'],
|
|
12
12
|
title: 'React (Next.js)',
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
description: 'Vue and TypeScript on Vite.',
|
|
16
|
+
id: 'vue-vite',
|
|
17
|
+
named: ['index.html', 'package.json', 'src/SiteHeader.vue'],
|
|
18
|
+
title: 'Vue (Vite)',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
description: 'Angular and TypeScript on the Angular CLI.',
|
|
22
|
+
id: 'angular',
|
|
23
|
+
named: ['angular.json', 'package.json', 'src/app/site-header.html', 'src/index.html'],
|
|
24
|
+
title: 'Angular',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
description: 'Svelte and TypeScript on Vite.',
|
|
28
|
+
id: 'svelte-vite',
|
|
29
|
+
named: ['index.html', 'package.json', 'src/SiteHeader.svelte'],
|
|
30
|
+
title: 'Svelte (Vite)',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
description: 'Solid and TypeScript on Vite.',
|
|
34
|
+
id: 'solid-vite',
|
|
35
|
+
named: ['index.html', 'package.json', 'src/site-header.tsx'],
|
|
36
|
+
title: 'Solid (Vite)',
|
|
37
|
+
},
|
|
14
38
|
];
|
|
15
39
|
export const PROJECT_NAME = '__PROJECT_NAME__';
|
|
16
40
|
export const HELIX_VERSION = '__HELIX_VERSION__';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-templates",
|
|
3
3
|
"description": "Starter templates for Helix, as data. Read by `helix new` and by `npm create @fusion.dev/helix-app`.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.139.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"__PROJECT_NAME__": {
|
|
7
|
+
"projectType": "application",
|
|
8
|
+
"root": "",
|
|
9
|
+
"sourceRoot": "src",
|
|
10
|
+
"prefix": "app",
|
|
11
|
+
"architect": {
|
|
12
|
+
"build": {
|
|
13
|
+
"builder": "@angular/build:application",
|
|
14
|
+
"options": {
|
|
15
|
+
"browser": "src/main.ts",
|
|
16
|
+
"outputPath": "dist",
|
|
17
|
+
"styles": [
|
|
18
|
+
"@fusion.dev/helix-styles/helix.css",
|
|
19
|
+
"src/app.css"
|
|
20
|
+
],
|
|
21
|
+
"tsConfig": "tsconfig.app.json"
|
|
22
|
+
},
|
|
23
|
+
"configurations": {
|
|
24
|
+
"production": {
|
|
25
|
+
"budgets": [
|
|
26
|
+
{
|
|
27
|
+
"maximumError": "5MB",
|
|
28
|
+
"maximumWarning": "2MB",
|
|
29
|
+
"type": "initial"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"outputHashing": "all"
|
|
33
|
+
},
|
|
34
|
+
"development": {
|
|
35
|
+
"extractLicenses": false,
|
|
36
|
+
"optimization": false,
|
|
37
|
+
"sourceMap": true
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"defaultConfiguration": "production"
|
|
41
|
+
},
|
|
42
|
+
"serve": {
|
|
43
|
+
"builder": "@angular/build:dev-server",
|
|
44
|
+
"configurations": {
|
|
45
|
+
"production": {
|
|
46
|
+
"buildTarget": "__PROJECT_NAME__:build:production"
|
|
47
|
+
},
|
|
48
|
+
"development": {
|
|
49
|
+
"buildTarget": "__PROJECT_NAME__:build:development"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"defaultConfiguration": "development"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "ng build",
|
|
7
|
+
"dev": "ng serve",
|
|
8
|
+
"ng": "ng",
|
|
9
|
+
"start": "ng serve"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@angular/common": "^22.2.1",
|
|
13
|
+
"@angular/compiler": "^22.2.1",
|
|
14
|
+
"@angular/core": "^22.2.1",
|
|
15
|
+
"@angular/platform-browser": "^22.2.1",
|
|
16
|
+
"@fusion.dev/helix": "^__HELIX_VERSION__",
|
|
17
|
+
"@fusion.dev/helix-styles": "^__HELIX_VERSION__",
|
|
18
|
+
"rxjs": "~7.8.0",
|
|
19
|
+
"tslib": "^2.3.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@angular/build": "^22.2.1",
|
|
23
|
+
"@angular/cli": "^22.2.1",
|
|
24
|
+
"@angular/compiler-cli": "^22.2.1",
|
|
25
|
+
"@fusion.dev/helix-diagnostics": "^__HELIX_VERSION__",
|
|
26
|
+
"typescript": "~6.0.3"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core'
|
|
2
|
+
|
|
3
|
+
/* No zone.js, which Angular no longer needs: a signal that changes is what
|
|
4
|
+
updates a view, so the Helix elements' own events and timers start no
|
|
5
|
+
change detection of their own. */
|
|
6
|
+
export const appConfig: ApplicationConfig = {
|
|
7
|
+
providers: [provideBrowserGlobalErrorListeners()],
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!-- The bar, the route, and the footer, in a column the height of the window.
|
|
2
|
+
`app.css` says why the footer is worth having and why the column is flex. -->
|
|
3
|
+
<div class="shell">
|
|
4
|
+
<app-site-header></app-site-header>
|
|
5
|
+
<main class="page">
|
|
6
|
+
@switch (path()) {
|
|
7
|
+
@case ('/overview') {
|
|
8
|
+
<div app-overview></div>
|
|
9
|
+
}
|
|
10
|
+
@case ('/join') {
|
|
11
|
+
<div app-signup-form></div>
|
|
12
|
+
}
|
|
13
|
+
@default {
|
|
14
|
+
<div app-landing></div>
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
</main>
|
|
18
|
+
<footer app-site-footer></footer>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Component, inject } from '@angular/core'
|
|
2
|
+
import { Landing } from './landing'
|
|
3
|
+
import { Overview } from './overview'
|
|
4
|
+
import { Pathname } from './pathname'
|
|
5
|
+
import { SignupForm } from './signup-form'
|
|
6
|
+
import { SiteFooter } from './site-footer'
|
|
7
|
+
import { SiteHeader } from './site-header'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The shell, and the switch between the three pages.
|
|
11
|
+
*
|
|
12
|
+
* Helix components are custom elements, so you write the tags directly. There
|
|
13
|
+
* is no wrapper package and nothing to import per component: `src/main.ts`
|
|
14
|
+
* registers them once, and every tag in the app is real from then on.
|
|
15
|
+
*
|
|
16
|
+
* **A page and the footer are each a component on the element it draws**,
|
|
17
|
+
* selected by an attribute: `footer[app-site-footer]`, and a `div` for each
|
|
18
|
+
* page. A tag of their own would put an element between the shell and what
|
|
19
|
+
* they draw, which the shell's column and `app.css` would then have to know
|
|
20
|
+
* about. The header is the exception, and `site-header.ts` says why.
|
|
21
|
+
*/
|
|
22
|
+
@Component({
|
|
23
|
+
imports: [Landing, Overview, SignupForm, SiteFooter, SiteHeader],
|
|
24
|
+
selector: 'app-root',
|
|
25
|
+
templateUrl: './app.html',
|
|
26
|
+
})
|
|
27
|
+
export class App {
|
|
28
|
+
protected readonly path = inject(Pathname).current
|
|
29
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows the overview draws.
|
|
3
|
+
*
|
|
4
|
+
* A local module and no network, so the starter runs with nothing behind it.
|
|
5
|
+
* Point `rows` at whatever you fetch and the table does not change: it takes the
|
|
6
|
+
* whole result and does the sorting, the filtering and the paging itself. Past
|
|
7
|
+
* the size a browser can hold, `mode="server"` inverts that and the table asks
|
|
8
|
+
* you for a page instead.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* One person on the roster.
|
|
13
|
+
*
|
|
14
|
+
* **A type alias and not an interface**, which TypeScript makes load-bearing
|
|
15
|
+
* here: `rows` takes `Readonly<Record<string, unknown>>`, an interface has no
|
|
16
|
+
* implicit index signature, and so an interface of exactly these fields is not
|
|
17
|
+
* assignable to it. The error names the index signature and not the shape, so
|
|
18
|
+
* it reads as though the data were wrong.
|
|
19
|
+
*/
|
|
20
|
+
export type Member = {
|
|
21
|
+
/**
|
|
22
|
+
* A stable identity, which is what `row-key` names.
|
|
23
|
+
*
|
|
24
|
+
* Sorting moves a row's element rather than rewriting every cell in it, so
|
|
25
|
+
* without one a sort throws away focus and anything attached to a row.
|
|
26
|
+
*/
|
|
27
|
+
readonly id: string
|
|
28
|
+
/**
|
|
29
|
+
* What the reader is here to find.
|
|
30
|
+
*/
|
|
31
|
+
readonly name: string
|
|
32
|
+
/**
|
|
33
|
+
* A number rather than a formatted string, so the column sorts by size.
|
|
34
|
+
*
|
|
35
|
+
* A cell showing `2.4k` sorts as text unless the column's `compare` says what
|
|
36
|
+
* the value underneath is, which is the one thing here that is cheap to get
|
|
37
|
+
* right now and expensive to add later.
|
|
38
|
+
*/
|
|
39
|
+
readonly reviews: number
|
|
40
|
+
/**
|
|
41
|
+
* What they do.
|
|
42
|
+
*/
|
|
43
|
+
readonly role: string
|
|
44
|
+
/**
|
|
45
|
+
* Who they do it with.
|
|
46
|
+
*/
|
|
47
|
+
readonly team: string
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const members: readonly Member[] = [
|
|
51
|
+
{ id: 'm-01', name: 'Ada Okonkwo', reviews: 184, role: 'Staff', team: 'Platform' },
|
|
52
|
+
{ id: 'm-02', name: 'Bruno Salas', reviews: 96, role: 'Senior', team: 'Payments' },
|
|
53
|
+
{ id: 'm-03', name: 'Cai Wen', reviews: 231, role: 'Principal', team: 'Platform' },
|
|
54
|
+
{ id: 'm-04', name: 'Dilara Yilmaz', reviews: 64, role: 'Senior', team: 'Growth' },
|
|
55
|
+
{ id: 'm-05', name: 'Esi Mensah', reviews: 148, role: 'Staff', team: 'Payments' },
|
|
56
|
+
{ id: 'm-06', name: 'Felix Braun', reviews: 39, role: 'Engineer', team: 'Growth' },
|
|
57
|
+
{ id: 'm-07', name: 'Gita Raman', reviews: 112, role: 'Senior', team: 'Platform' },
|
|
58
|
+
{ id: 'm-08', name: 'Hana Sato', reviews: 57, role: 'Engineer', team: 'Design' },
|
|
59
|
+
{ id: 'm-09', name: 'Ivan Petrov', reviews: 88, role: 'Senior', team: 'Payments' },
|
|
60
|
+
{ id: 'm-10', name: 'Jo Lindqvist', reviews: 21, role: 'Engineer', team: 'Design' },
|
|
61
|
+
{ id: 'm-11', name: 'Kwame Asante', reviews: 73, role: 'Staff', team: 'Growth' },
|
|
62
|
+
{ id: 'm-12', name: 'Lena Fischer', reviews: 12, role: 'Engineer', team: 'Design' },
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
/** The teams the form offers, read from the roster so the two cannot disagree. */
|
|
66
|
+
export const teams: readonly string[] = [...new Set(members.map((one) => one.team))].toSorted()
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The same roster as three figures, for the panel on the first screen.
|
|
70
|
+
*
|
|
71
|
+
* Derived rather than written out, so the panel cannot claim a number the table
|
|
72
|
+
* does not show.
|
|
73
|
+
*/
|
|
74
|
+
export const roster = {
|
|
75
|
+
/** How many rows the data view has. */
|
|
76
|
+
people: members.length,
|
|
77
|
+
/** Every review on the roster, added up. */
|
|
78
|
+
reviews: members.reduce((total, one) => total + one.reviews, 0),
|
|
79
|
+
/** How many teams they are spread across. */
|
|
80
|
+
teams: teams.length,
|
|
81
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The documentation this starter links to.
|
|
3
|
+
*
|
|
4
|
+
* **One module, because a link is the thing in a starter most likely to rot.**
|
|
5
|
+
* A page that composes its own URLs ships a plausible-looking 404 to every
|
|
6
|
+
* project scaffolded from it, and nobody finds out until a reader clicks one.
|
|
7
|
+
* Here they are in a list somebody can open and check, and pointing the starter
|
|
8
|
+
* at a mirror or an internal copy is one edit.
|
|
9
|
+
*
|
|
10
|
+
* Checked 16 Sep 2026: every entry answers 200.
|
|
11
|
+
*/
|
|
12
|
+
export const DOCS = {
|
|
13
|
+
/** Angular specifically: the schema, property bindings, and events. */
|
|
14
|
+
angular: 'https://fusion.dev/helix/docs/angular',
|
|
15
|
+
/** How the elements are registered and written, which is the first page to read. */
|
|
16
|
+
elements: 'https://fusion.dev/helix/docs/using-the-elements',
|
|
17
|
+
/** What a `<form>` does with these controls, and what it cannot do. */
|
|
18
|
+
forms: 'https://fusion.dev/helix/docs/forms',
|
|
19
|
+
/** Every component, with its API, its parts and its examples. */
|
|
20
|
+
gallery: 'https://fusion.dev/helix/components',
|
|
21
|
+
/** The light and dark pair, and the attribute that chooses between them. */
|
|
22
|
+
modes: 'https://fusion.dev/helix/docs/color-modes',
|
|
23
|
+
/** Reaching a component's parts from a page, which `app.css` does once. */
|
|
24
|
+
parts: 'https://fusion.dev/helix/docs/overriding-a-component',
|
|
25
|
+
/** The data view's own page, where the rest of its API is. */
|
|
26
|
+
table: 'https://fusion.dev/helix/components/data-table',
|
|
27
|
+
/** Every token, and what each one is for. */
|
|
28
|
+
tokens: 'https://fusion.dev/helix/docs/tokens',
|
|
29
|
+
} as const
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<header class="first-screen">
|
|
2
|
+
<div class="hero">
|
|
3
|
+
<helix-text emphasis="muted" variant="label">Helix starter</helix-text>
|
|
4
|
+
<helix-text as="h1">Every tag on this page is Helix</helix-text>
|
|
5
|
+
<helix-text as="p" class="lede" emphasis="muted" variant="body">
|
|
6
|
+
Nothing here is a wrapper: the tags are the library's own elements, and every color,
|
|
7
|
+
size and space inside them comes from one set of tokens. Three routes are laid down, and
|
|
8
|
+
all of them are yours.
|
|
9
|
+
</helix-text>
|
|
10
|
+
<div class="actions">
|
|
11
|
+
<a data-button="solid" data-button-tone="primary" href="#/overview">See the data view</a>
|
|
12
|
+
<a data-button href="#/join">Open the form</a>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<!-- The figures are the roster the data view draws, read from the same
|
|
17
|
+
module, so the panel is the app at work. `helix-stat` sets the number
|
|
18
|
+
on the display face at a size the type scale does not reach. -->
|
|
19
|
+
<helix-card class="specimen" separation="outlined">
|
|
20
|
+
<helix-text as="h2" slot="header" variant="title">The roster, in three figures</helix-text>
|
|
21
|
+
<helix-stat-group divided>
|
|
22
|
+
<helix-stat>
|
|
23
|
+
{{ roster.people }}
|
|
24
|
+
<span slot="label">People</span>
|
|
25
|
+
</helix-stat>
|
|
26
|
+
<helix-stat>
|
|
27
|
+
{{ roster.teams }}
|
|
28
|
+
<span slot="label">Teams</span>
|
|
29
|
+
</helix-stat>
|
|
30
|
+
<helix-stat>
|
|
31
|
+
{{ figure.format(roster.reviews) }}
|
|
32
|
+
<span slot="label">Reviews</span>
|
|
33
|
+
</helix-stat>
|
|
34
|
+
</helix-stat-group>
|
|
35
|
+
<a data-link href="#/overview" slot="footer">Open the data view</a>
|
|
36
|
+
</helix-card>
|
|
37
|
+
</header>
|
|
38
|
+
|
|
39
|
+
<section class="section">
|
|
40
|
+
<helix-text as="h2" variant="subheading">What you have</helix-text>
|
|
41
|
+
<!-- Three paragraphs about one installed thing, so they take a rule each
|
|
42
|
+
and no box. `app.css` says why at more length. -->
|
|
43
|
+
<div class="facts">
|
|
44
|
+
<article class="fact">
|
|
45
|
+
<helix-text as="h3" variant="title">Elements, not wrappers</helix-text>
|
|
46
|
+
<helix-text as="p" emphasis="muted" variant="body">
|
|
47
|
+
They are custom elements, so you write the tags and there is no per-component import
|
|
48
|
+
to keep in step. One line in <helix-code>src/main.ts</helix-code> registers all of
|
|
49
|
+
them, and a subpath like <helix-code>@fusion.dev/helix/tabs</helix-code> registers
|
|
50
|
+
one.
|
|
51
|
+
</helix-text>
|
|
52
|
+
<a data-link [href]="docs.elements">Using the elements</a>
|
|
53
|
+
</article>
|
|
54
|
+
|
|
55
|
+
<article class="fact">
|
|
56
|
+
<helix-text as="h3" variant="title">One set of tokens</helix-text>
|
|
57
|
+
<helix-text as="p" emphasis="muted" variant="body">
|
|
58
|
+
Every color is written once as a light and dark pair, so the control in the bar moves
|
|
59
|
+
the whole page by setting a single attribute on the root. Type, spacing, radii and
|
|
60
|
+
control sizes come from the same place.
|
|
61
|
+
</helix-text>
|
|
62
|
+
<a data-link [href]="docs.tokens">Tokens</a>
|
|
63
|
+
</article>
|
|
64
|
+
|
|
65
|
+
<article class="fact">
|
|
66
|
+
<helix-text as="h3" variant="title">A short stylesheet</helix-text>
|
|
67
|
+
<helix-text as="p" emphasis="muted" variant="body">
|
|
68
|
+
<helix-code>src/app.css</helix-code> holds this page's measure, the rhythm between its
|
|
69
|
+
blocks, and nothing a component already draws. Where a component leaves a decision
|
|
70
|
+
open it names a part: the data view reaches one to paint the row you tick.
|
|
71
|
+
</helix-text>
|
|
72
|
+
<a data-link [href]="docs.parts">Overriding a component</a>
|
|
73
|
+
</article>
|
|
74
|
+
</div>
|
|
75
|
+
</section>
|
|
76
|
+
|
|
77
|
+
<section class="section">
|
|
78
|
+
<helix-text as="h2" variant="subheading">Where to go next</helix-text>
|
|
79
|
+
<!-- **The whole card is the link, which is what `data-card` is for.** The
|
|
80
|
+
base layer draws the ring, moves the card's border to the brand on
|
|
81
|
+
hover, and leaves focus alone. Nothing inside may be interactive,
|
|
82
|
+
since a link inside a link is neither valid nor reachable. -->
|
|
83
|
+
<helix-grid [columns]="2" gap="md">
|
|
84
|
+
<a data-card href="#/overview">
|
|
85
|
+
<helix-card separation="outlined">
|
|
86
|
+
<helix-flex align-items="baseline" gap="sm" justify-content="between" slot="header">
|
|
87
|
+
<helix-text as="h3" variant="title">The data view</helix-text>
|
|
88
|
+
<helix-text emphasis="subtle" variant="code">/overview</helix-text>
|
|
89
|
+
</helix-flex>
|
|
90
|
+
<helix-text as="p" emphasis="muted" variant="body">
|
|
91
|
+
Twelve people from a local module, sorted, paged and selected with nothing wired up.
|
|
92
|
+
The columns are markup you can read and the rows are one property, which is what
|
|
93
|
+
keeps the same component working at ten thousand.
|
|
94
|
+
</helix-text>
|
|
95
|
+
</helix-card>
|
|
96
|
+
</a>
|
|
97
|
+
|
|
98
|
+
<a data-card href="#/join">
|
|
99
|
+
<helix-card separation="outlined">
|
|
100
|
+
<helix-flex align-items="baseline" gap="sm" justify-content="between" slot="header">
|
|
101
|
+
<helix-text as="h3" variant="title">The form</helix-text>
|
|
102
|
+
<helix-text emphasis="subtle" variant="code">/join</helix-text>
|
|
103
|
+
</helix-flex>
|
|
104
|
+
<helix-text as="p" emphasis="muted" variant="body">
|
|
105
|
+
Five controls a <helix-code><form></helix-code> reads with
|
|
106
|
+
<helix-code>FormData</helix-code>, because every one of them is a real form
|
|
107
|
+
participant. The email field's complaint is the browser's own.
|
|
108
|
+
</helix-text>
|
|
109
|
+
</helix-card>
|
|
110
|
+
</a>
|
|
111
|
+
</helix-grid>
|
|
112
|
+
</section>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
|
|
2
|
+
import { roster } from './data'
|
|
3
|
+
import { DOCS } from './docs'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The first screen, and the only page here about the starter itself.
|
|
7
|
+
*
|
|
8
|
+
* Delete it once you know your way around: nothing else imports it, and the
|
|
9
|
+
* route it answers becomes yours.
|
|
10
|
+
*
|
|
11
|
+
* **The heading says what this is, and the project's name stays in the bar.**
|
|
12
|
+
*
|
|
13
|
+
* **The calls to action are anchors.** A button that navigates is a link
|
|
14
|
+
* dressed as a button, and the two are different things to a keyboard and to
|
|
15
|
+
* a screen reader. The base stylesheet styles an anchor that asks with
|
|
16
|
+
* `data-button`, so a link can look like one and stay a link.
|
|
17
|
+
*/
|
|
18
|
+
@Component({
|
|
19
|
+
host: { class: 'stack' },
|
|
20
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
21
|
+
selector: 'div[app-landing]',
|
|
22
|
+
templateUrl: './landing.html',
|
|
23
|
+
})
|
|
24
|
+
export class Landing {
|
|
25
|
+
protected readonly docs = DOCS
|
|
26
|
+
protected readonly roster = roster
|
|
27
|
+
/* **A locale named, so the number reads the same everywhere.**
|
|
28
|
+
`toLocaleString()` with no argument reads the machine's locale, so the same
|
|
29
|
+
number is grouped two ways on two machines. */
|
|
30
|
+
protected readonly figure = new Intl.NumberFormat('en-US')
|
|
31
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<header class="hero">
|
|
2
|
+
<helix-text emphasis="muted" variant="label">Data view</helix-text>
|
|
3
|
+
<helix-text as="h1" variant="heading">Roster</helix-text>
|
|
4
|
+
<helix-text as="p" class="lede" emphasis="muted" variant="body">
|
|
5
|
+
Twelve people from a local module. Sort a column, turn a page, or tick a row and watch the
|
|
6
|
+
rule in <helix-code>src/app.css</helix-code> paint it.
|
|
7
|
+
</helix-text>
|
|
8
|
+
</header>
|
|
9
|
+
|
|
10
|
+
<section class="section">
|
|
11
|
+
<helix-data-table
|
|
12
|
+
default-sort="name:asc"
|
|
13
|
+
label="Roster"
|
|
14
|
+
page-size="6"
|
|
15
|
+
row-key="id"
|
|
16
|
+
[rows]="members"
|
|
17
|
+
selectable
|
|
18
|
+
>
|
|
19
|
+
<!-- **Every column declares what it may give up.** A floor and a share:
|
|
20
|
+
the floor is what the words need, and the share is how the slack is
|
|
21
|
+
divided. At 390 the four columns and the checkboxes fit the box, and
|
|
22
|
+
below 376 the table scrolls its own box. -->
|
|
23
|
+
<helix-table-column field="name" sortable width="minmax(5.5rem, 1.6fr)">
|
|
24
|
+
Name
|
|
25
|
+
</helix-table-column>
|
|
26
|
+
<helix-table-column field="team" sortable width="minmax(4.5rem, 1fr)">
|
|
27
|
+
Team
|
|
28
|
+
</helix-table-column>
|
|
29
|
+
<helix-table-column field="role" width="minmax(4.5rem, 1fr)">Role</helix-table-column>
|
|
30
|
+
<!-- `end` lines the digits up under each other. `max-content`, since a
|
|
31
|
+
column of numerals has one right width. -->
|
|
32
|
+
<helix-table-column field="reviews" sortable text-align="end" width="max-content">
|
|
33
|
+
Reviews
|
|
34
|
+
</helix-table-column>
|
|
35
|
+
|
|
36
|
+
<!-- The footer is a row across the table: anything you slot goes at the
|
|
37
|
+
start, and the table's own pagination sits at the end. -->
|
|
38
|
+
<helix-text emphasis="subtle" slot="footer" variant="caption">
|
|
39
|
+
{{ members.length }} people
|
|
40
|
+
</helix-text>
|
|
41
|
+
</helix-data-table>
|
|
42
|
+
|
|
43
|
+
<!-- A footnote to the table, so it takes the section's gap. -->
|
|
44
|
+
<helix-text as="p" emphasis="muted" variant="caption">
|
|
45
|
+
Filtering, column reordering, resizing, virtualized rows and a server mode that asks you
|
|
46
|
+
for a page are all on
|
|
47
|
+
<a data-link [href]="docs.table">the component's own page</a>.
|
|
48
|
+
</helix-text>
|
|
49
|
+
</section>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
|
|
2
|
+
import { members } from './data'
|
|
3
|
+
import { DOCS } from './docs'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The data view.
|
|
7
|
+
*
|
|
8
|
+
* **The schema is markup and the data is a property.** The columns are
|
|
9
|
+
* elements you can read in the HTML, and `[rows]` hands over the whole result
|
|
10
|
+
* at once, since a table of ten thousand rows cannot be written out as
|
|
11
|
+
* elements. The table sorts, pages, and selects out of that array on its own.
|
|
12
|
+
*
|
|
13
|
+
* **Selection is keyed on `row-key`, so it survives a sort and a page.**
|
|
14
|
+
* `app.css` paints the chosen row through the parts the table names for it.
|
|
15
|
+
*/
|
|
16
|
+
@Component({
|
|
17
|
+
host: { class: 'stack' },
|
|
18
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
19
|
+
selector: 'div[app-overview]',
|
|
20
|
+
templateUrl: './overview.html',
|
|
21
|
+
})
|
|
22
|
+
export class Overview {
|
|
23
|
+
protected readonly docs = DOCS
|
|
24
|
+
protected readonly members = members
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Injectable, signal } from '@angular/core'
|
|
2
|
+
|
|
3
|
+
/* **The whole router, which is a hash and a listener.**
|
|
4
|
+
|
|
5
|
+
Three pages need `location.hash` and one event. Swap this file for the
|
|
6
|
+
Angular router when you want lazy routes or guards: `withHashLocation()`
|
|
7
|
+
keeps these addresses.
|
|
8
|
+
|
|
9
|
+
A hash, because the History API wants a server that answers every path with
|
|
10
|
+
the same document, and wherever you deploy has to be told to. A hash asks
|
|
11
|
+
nothing of it. Each link in the app is a plain anchor to `#/` and a path. */
|
|
12
|
+
|
|
13
|
+
/** Where the reader is, as a path, so the first page is `/`. */
|
|
14
|
+
const read = (): string => window.location.hash.slice(1) || '/'
|
|
15
|
+
|
|
16
|
+
/** The current path, kept current as the hash changes. */
|
|
17
|
+
@Injectable({ providedIn: 'root' })
|
|
18
|
+
export class Pathname {
|
|
19
|
+
readonly current = signal(read())
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
window.addEventListener('hashchange', () => this.current.set(read()))
|
|
23
|
+
}
|
|
24
|
+
}
|