@fusion.dev/helix-templates 0.0.9
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
- package/templates/react-nextjs/app/helix-elements.tsx +10 -0
- package/templates/react-nextjs/app/layout.tsx +33 -0
- package/templates/react-nextjs/app/page.tsx +18 -0
- package/templates/react-nextjs/helix-jsx.d.ts +14 -0
- package/templates/react-nextjs/next.config.ts +5 -0
- package/templates/react-nextjs/package.json +20 -0
- package/templates/react-nextjs/tsconfig.json +34 -0
- package/templates/react-vite/helix-jsx.d.ts +14 -0
- package/templates/react-vite/index.html +12 -0
- package/templates/react-vite/package.json +21 -0
- package/templates/react-vite/src/App.tsx +24 -0
- package/templates/react-vite/src/main.tsx +20 -0
- package/templates/react-vite/tsconfig.json +21 -0
- package/templates/react-vite/vite.config.ts +4 -0
- package/templates.json +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fusion Development Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @fusion.dev/helix-templates
|
|
2
|
+
|
|
3
|
+
The Helix starter templates, as data. Read by `helix new` and by
|
|
4
|
+
`npm create helix-app`, which are one capability behind two doors.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm create helix-app@latest my-app
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
You are unlikely to install this package yourself. It exists so that the thing
|
|
11
|
+
that would drift between those two doors — the templates — is one artifact rather
|
|
12
|
+
than two copies, and so that a template is versioned with the components it was
|
|
13
|
+
written against.
|
|
14
|
+
|
|
15
|
+
| Template | What it is |
|
|
16
|
+
|---|---|
|
|
17
|
+
| `react-vite` | React and TypeScript on Vite. The shortest path to a running component. |
|
|
18
|
+
| `react-nextjs` | React and TypeScript on the Next.js App Router, elements registered once. |
|
|
19
|
+
|
|
20
|
+
**There is no build-free HTML template**, and that is a fact about the packages
|
|
21
|
+
rather than an omission. `@fusion.dev/helix`'s published entry re-exports bare
|
|
22
|
+
specifiers — `@fusion.dev/helix-core`, ninety-odd `@fusion.dev/helix-headless/*`
|
|
23
|
+
subpaths, `lit` and its own graph — none of which a browser resolves without an
|
|
24
|
+
import map covering all of it, and an import map that large is a build artifact
|
|
25
|
+
wearing a template's clothes. The honest build-free story is a CDN that rewrites
|
|
26
|
+
the graph, which wants the packages public first.
|
|
27
|
+
|
|
28
|
+
## Reading it yourself
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { findTemplate, PROJECT_NAME, templates } from '@fusion.dev/helix-templates'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`templates` is the register, in the order a chooser should offer them. Each entry
|
|
35
|
+
names the files whose contents carry `PROJECT_NAME`, which a scaffolder replaces
|
|
36
|
+
with the project's own. The payloads sit under `templates/<id>/` in this package.
|
|
37
|
+
|
|
38
|
+
**The named files are named rather than discovered.** Scanning every file for the
|
|
39
|
+
placeholder would rewrite a template that merely mentions it in prose, and a
|
|
40
|
+
rename that missed a file would ship rather than fail. The register is held to the
|
|
41
|
+
directories by this package's own spec, in both directions.
|
|
42
|
+
|
|
43
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The starter templates, as data.
|
|
3
|
+
*
|
|
4
|
+
* **Templates are a package rather than a directory inside a scaffolder**, which
|
|
5
|
+
* is the whole reason this exists. `helix new` and `npm create helix-app` are one
|
|
6
|
+
* capability behind two doors, and the thing that would drift between them is the
|
|
7
|
+
* templates rather than the twenty lines of copy-and-substitute around them. Both
|
|
8
|
+
* doors read this.
|
|
9
|
+
*
|
|
10
|
+
* **Versioned with Helix**, so a template scaffolds against the components it was
|
|
11
|
+
* written for. A template pinned to nothing is a template that stops compiling on
|
|
12
|
+
* somebody else's release.
|
|
13
|
+
*
|
|
14
|
+
* The payloads sit in `templates/<id>/` and travel in the published package. This
|
|
15
|
+
* module is the register: what exists, what each one is for, and which file a
|
|
16
|
+
* consumer's project name has to be written into.
|
|
17
|
+
*/
|
|
18
|
+
/** One template, and everything a scaffolder needs to lay it down. */
|
|
19
|
+
export interface Template {
|
|
20
|
+
/** What a reader chooses it for, in one line. */
|
|
21
|
+
readonly description: string;
|
|
22
|
+
/**
|
|
23
|
+
* Files whose contents carry `__PROJECT_NAME__`.
|
|
24
|
+
*
|
|
25
|
+
* Named rather than discovered by scanning every file, so a template that
|
|
26
|
+
* mentions the placeholder in prose does not get it silently rewritten, and so
|
|
27
|
+
* a rename that misses a file fails a test rather than shipping.
|
|
28
|
+
*/
|
|
29
|
+
readonly named: readonly string[];
|
|
30
|
+
/** The directory under `templates/`, and the id a caller passes. */
|
|
31
|
+
readonly id: string;
|
|
32
|
+
/** What it is called in a chooser. */
|
|
33
|
+
readonly title: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* **In the order a chooser should offer them**, which is not alphabetical.
|
|
37
|
+
*
|
|
38
|
+
* `react-vite` is first because it is the shortest path from nothing to a
|
|
39
|
+
* component on screen, and a first release is judged on that.
|
|
40
|
+
*
|
|
41
|
+
* **There is no build-free HTML template, and that is a fact about the packages
|
|
42
|
+
* rather than an omission.** `@fusion.dev/helix`'s published entry re-exports
|
|
43
|
+
* bare specifiers — `@fusion.dev/helix-core`, ninety-odd
|
|
44
|
+
* `@fusion.dev/helix-headless/*` subpaths, `lit` and its own graph — which a
|
|
45
|
+
* browser cannot resolve without an import map covering all of it. An import map
|
|
46
|
+
* that large is a build artifact wearing a template's clothes. The honest
|
|
47
|
+
* build-free story is a CDN that rewrites the graph, which wants the packages
|
|
48
|
+
* public first.
|
|
49
|
+
*/
|
|
50
|
+
export declare const templates: readonly Template[];
|
|
51
|
+
/** The placeholder a scaffolder replaces with the project's name. */
|
|
52
|
+
export declare const PROJECT_NAME = "__PROJECT_NAME__";
|
|
53
|
+
/** The one template with this id, or `undefined` where there is none. */
|
|
54
|
+
export declare const findTemplate: (id: string) => Template | undefined;
|
|
55
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sEAAsE;AACtE,MAAM,WAAW,QAAQ;IACvB,iDAAiD;IACjD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,QAAQ,EAcxC,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,YAAY,qBAAqB,CAAA;AAE9C,yEAAyE;AACzE,eAAO,MAAM,YAAY,OAAQ,MAAM,KAAG,QAAQ,GAAG,SACb,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const templates = [
|
|
2
|
+
{
|
|
3
|
+
description: 'React and TypeScript on Vite. The shortest path to a running component.',
|
|
4
|
+
id: 'react-vite',
|
|
5
|
+
named: ['index.html', 'package.json', 'src/App.tsx'],
|
|
6
|
+
title: 'React (Vite)',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
description: 'React and TypeScript on the Next.js App Router, with the elements registered once.',
|
|
10
|
+
id: 'react-nextjs',
|
|
11
|
+
named: ['app/layout.tsx', 'app/page.tsx', 'package.json'],
|
|
12
|
+
title: 'React (Next.js)',
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
export const PROJECT_NAME = '__PROJECT_NAME__';
|
|
16
|
+
export const findTemplate = (id) => templates.find((one) => one.id === id);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmDA,MAAM,CAAC,MAAM,SAAS,GAAwB;IAC5C;QACE,WAAW,EAAE,yEAAyE;QACtF,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,CAAC,YAAY,EAAE,cAAc,EAAE,aAAa,CAAC;QACpD,KAAK,EAAE,cAAc;KACtB;IACD;QACE,WAAW,EACT,oFAAoF;QACtF,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,CAAC,gBAAgB,EAAE,cAAc,EAAE,cAAc,CAAC;QACzD,KAAK,EAAE,iBAAiB;KACzB;CACF,CAAA;AAGD,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAA;AAG9C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAU,EAAwB,EAAE,CAC/D,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fusion.dev/helix-templates",
|
|
3
|
+
"description": "Starter templates for Helix, as data. Read by `helix new` and by `npm create helix-app`.",
|
|
4
|
+
"version": "0.0.9",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"directory": "helix/templates",
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/project-fusion/fusion.git"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./templates.json": "./templates.json"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"templates",
|
|
25
|
+
"templates.json"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "bun run register && tsc -p tsconfig.json && tsc -p tsconfig.types.json",
|
|
30
|
+
"register": "bun scripts/build-register.mjs",
|
|
31
|
+
"typecheck": "bun run register && tsc -p tsconfig.json --noEmit"
|
|
32
|
+
},
|
|
33
|
+
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
34
|
+
"homepage": "https://fusion.dev",
|
|
35
|
+
"keywords": [
|
|
36
|
+
"helix",
|
|
37
|
+
"templates",
|
|
38
|
+
"scaffold",
|
|
39
|
+
"design-system"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "restricted"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
/* Import the whole library while you are finding your feet. When you would rather
|
|
4
|
+
pay for only what you use, `@fusion.dev/helix/button` and its siblings are
|
|
5
|
+
subpath exports and this file becomes the list of what the app actually uses. */
|
|
6
|
+
import '@fusion.dev/helix'
|
|
7
|
+
|
|
8
|
+
export function HelixElements(): null {
|
|
9
|
+
return null
|
|
10
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Metadata, Viewport } from 'next'
|
|
2
|
+
import type { ReactNode } from 'react'
|
|
3
|
+
|
|
4
|
+
/* Every layer in one import: the tokens, the reset, the utility layer, and the
|
|
5
|
+
`:not(:defined)` rules that keep a tag from arriving unstyled. */
|
|
6
|
+
import '@fusion.dev/helix/helix.css'
|
|
7
|
+
|
|
8
|
+
import { HelixElements } from './helix-elements.js'
|
|
9
|
+
|
|
10
|
+
export const metadata: Metadata = { title: '__PROJECT_NAME__' }
|
|
11
|
+
export const viewport: Viewport = { initialScale: 1, width: 'device-width' }
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `HelixElements` is rendered once, here, and returns `null`.
|
|
15
|
+
*
|
|
16
|
+
* A custom element registers as a side effect of importing its module, and that
|
|
17
|
+
* import has to be in the *client* graph to ever run: a server component's
|
|
18
|
+
* imports do not ship to the browser. One client component holds them all.
|
|
19
|
+
*
|
|
20
|
+
* Pages stay server components. An unregistered tag is only an unknown element in
|
|
21
|
+
* the HTML, which upgrades the moment the definition lands, so nothing here asks
|
|
22
|
+
* you to mark a page `'use client'` to use a button.
|
|
23
|
+
*/
|
|
24
|
+
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
25
|
+
return (
|
|
26
|
+
<html lang="en">
|
|
27
|
+
<body>
|
|
28
|
+
<HelixElements />
|
|
29
|
+
{children}
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A server component, rendering custom elements directly.
|
|
3
|
+
*
|
|
4
|
+
* Helix events are props: `onhelix-before-change` reaches `helix-before-change`.
|
|
5
|
+
* Anything needing a handler is a client component, the same as any other React
|
|
6
|
+
* app — this page needs none.
|
|
7
|
+
*/
|
|
8
|
+
export default function Page() {
|
|
9
|
+
return (
|
|
10
|
+
<helix-flex align="center" direction="column" gap="lg">
|
|
11
|
+
<helix-text as="h1">__PROJECT_NAME__</helix-text>
|
|
12
|
+
<helix-text>Edit `app/page.tsx` and save.</helix-text>
|
|
13
|
+
<helix-button emphasis="solid" tone="primary">
|
|
14
|
+
Get started
|
|
15
|
+
</helix-button>
|
|
16
|
+
</helix-flex>
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Helix custom elements written directly in JSX.
|
|
3
|
+
*
|
|
4
|
+
* Emitted by `@wc-toolkit/jsx-types` from the same manifest the API pages read,
|
|
5
|
+
* so a wrong attribute or a wrong event detail is a compile error rather than a
|
|
6
|
+
* silent no-op.
|
|
7
|
+
*
|
|
8
|
+
* **A side-effect import in a `.d.ts`, rather than an entry in `types`.** The
|
|
9
|
+
* typings are the subpath export `@fusion.dev/helix/jsx`, and entries in the
|
|
10
|
+
* `types` compiler array resolve as ambient type packages rather than through a
|
|
11
|
+
* package's exports map, so naming the subpath there resolves to nothing and
|
|
12
|
+
* every Helix tag comes out untyped.
|
|
13
|
+
*/
|
|
14
|
+
import '@fusion.dev/helix/jsx'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "next build",
|
|
8
|
+
"dev": "next dev",
|
|
9
|
+
"start": "next start"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@fusion.dev/helix": "^0.0.9",
|
|
13
|
+
"next": "^16.0.0",
|
|
14
|
+
"react": "^19.2.0",
|
|
15
|
+
"react-dom": "^19.2.0"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.9.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "preserve",
|
|
4
|
+
"lib": [
|
|
5
|
+
"DOM",
|
|
6
|
+
"DOM.Iterable",
|
|
7
|
+
"ES2023"
|
|
8
|
+
],
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"target": "ES2023",
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"incremental": true,
|
|
17
|
+
"plugins": [
|
|
18
|
+
{
|
|
19
|
+
"name": "next"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"app",
|
|
25
|
+
"next-env.d.ts",
|
|
26
|
+
"**/*.ts",
|
|
27
|
+
"**/*.tsx",
|
|
28
|
+
".next/types/**/*.ts",
|
|
29
|
+
"helix-jsx.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"exclude": [
|
|
32
|
+
"node_modules"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the Helix custom elements written directly in JSX.
|
|
3
|
+
*
|
|
4
|
+
* Emitted by `@wc-toolkit/jsx-types` from the same manifest the API pages read,
|
|
5
|
+
* so a wrong attribute or a wrong event detail is a compile error rather than a
|
|
6
|
+
* silent no-op.
|
|
7
|
+
*
|
|
8
|
+
* **A side-effect import in a `.d.ts`, rather than an entry in `types`.** The
|
|
9
|
+
* typings are the subpath export `@fusion.dev/helix/jsx`, and entries in the
|
|
10
|
+
* `types` compiler array resolve as ambient type packages rather than through a
|
|
11
|
+
* package's exports map, so naming the subpath there resolves to nothing and
|
|
12
|
+
* every Helix tag comes out untyped.
|
|
13
|
+
*/
|
|
14
|
+
import '@fusion.dev/helix/jsx'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>__PROJECT_NAME__</title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<div id="root"></div>
|
|
10
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PROJECT_NAME__",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc && vite build",
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@fusion.dev/helix": "^0.0.9",
|
|
13
|
+
"react": "^19.2.0",
|
|
14
|
+
"react-dom": "^19.2.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
18
|
+
"typescript": "^5.9.0",
|
|
19
|
+
"vite": "^7.0.0"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helix components are custom elements, so you write the tags directly. There is
|
|
3
|
+
* no wrapper package and nothing to import per component.
|
|
4
|
+
*
|
|
5
|
+
* Events are props: `onhelix-before-change` reaches `helix-before-change`. React's
|
|
6
|
+
* own bubbling events work as they always do, so `onClick` is fine here.
|
|
7
|
+
*/
|
|
8
|
+
export function App() {
|
|
9
|
+
return (
|
|
10
|
+
<helix-flex align="center" direction="column" gap="lg">
|
|
11
|
+
<helix-text as="h1">__PROJECT_NAME__</helix-text>
|
|
12
|
+
<helix-text>Edit `src/App.tsx` and save.</helix-text>
|
|
13
|
+
<helix-button
|
|
14
|
+
emphasis="solid"
|
|
15
|
+
onClick={() => {
|
|
16
|
+
console.log('clicked')
|
|
17
|
+
}}
|
|
18
|
+
tone="primary"
|
|
19
|
+
>
|
|
20
|
+
Get started
|
|
21
|
+
</helix-button>
|
|
22
|
+
</helix-flex>
|
|
23
|
+
)
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StrictMode } from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
|
|
4
|
+
/* Every layer in one import: the tokens, the reset, the utility layer, and the
|
|
5
|
+
`:not(:defined)` rules that keep a tag from arriving unstyled. It reaches its
|
|
6
|
+
pieces by bare specifier, so a bundler resolves it and a `<link>` cannot. */
|
|
7
|
+
import '@fusion.dev/helix/helix.css'
|
|
8
|
+
/* A custom element registers as a side effect of being imported, so this line is
|
|
9
|
+
what makes every Helix tag in the app real. Import the whole library while you
|
|
10
|
+
are finding your feet; `@fusion.dev/helix/button` and its siblings are subpath
|
|
11
|
+
exports when you would rather pay for only what you use. */
|
|
12
|
+
import '@fusion.dev/helix'
|
|
13
|
+
|
|
14
|
+
import { App } from './App.js'
|
|
15
|
+
|
|
16
|
+
createRoot(document.querySelector('#root') as HTMLElement).render(
|
|
17
|
+
<StrictMode>
|
|
18
|
+
<App />
|
|
19
|
+
</StrictMode>,
|
|
20
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"lib": [
|
|
5
|
+
"DOM",
|
|
6
|
+
"DOM.Iterable",
|
|
7
|
+
"ES2023"
|
|
8
|
+
],
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"target": "ES2023",
|
|
14
|
+
"verbatimModuleSyntax": true,
|
|
15
|
+
"noEmit": true
|
|
16
|
+
},
|
|
17
|
+
"include": [
|
|
18
|
+
"src",
|
|
19
|
+
"helix-jsx.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
package/templates.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"placeholder": "__PROJECT_NAME__",
|
|
3
|
+
"templates": [
|
|
4
|
+
{
|
|
5
|
+
"description": "React and TypeScript on Vite. The shortest path to a running component.",
|
|
6
|
+
"id": "react-vite",
|
|
7
|
+
"named": [
|
|
8
|
+
"index.html",
|
|
9
|
+
"package.json",
|
|
10
|
+
"src/App.tsx"
|
|
11
|
+
],
|
|
12
|
+
"title": "React (Vite)"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"description": "React and TypeScript on the Next.js App Router, with the elements registered once.",
|
|
16
|
+
"id": "react-nextjs",
|
|
17
|
+
"named": [
|
|
18
|
+
"app/layout.tsx",
|
|
19
|
+
"app/page.tsx",
|
|
20
|
+
"package.json"
|
|
21
|
+
],
|
|
22
|
+
"title": "React (Next.js)"
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|