@tuqulore-inc/create-eleventy 5.0.1 → 5.1.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 +13 -13
- package/package.json +3 -3
- package/templates/default/README.md +44 -44
- package/templates/default/package.json +2 -1
- package/templates/default/src/__includes/partials/header/desktop.client.jsx +20 -15
- package/templates/default/src/__includes/partials/header/mobile.client.jsx +15 -12
- package/templates/default/src/clicker.client.jsx +3 -3
package/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
# @tuqulore-inc/create-eleventy
|
|
2
2
|
|
|
3
|
-
Eleventy + Preact +
|
|
3
|
+
CLI for creating an Eleventy + Preact + Tailwind CSS project.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
#
|
|
8
|
+
# Interactive mode
|
|
9
9
|
pnpm create @tuqulore-inc/eleventy my-project
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# With a template
|
|
12
12
|
pnpm create @tuqulore-inc/eleventy my-project --template default
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Options
|
|
16
16
|
|
|
17
|
-
|
|
|
18
|
-
| ----------------------- |
|
|
19
|
-
| `-t, --template <name>` |
|
|
20
|
-
| `-h, --help` |
|
|
17
|
+
| Option | Description |
|
|
18
|
+
| ----------------------- | --------------- |
|
|
19
|
+
| `-t, --template <name>` | Pick a template |
|
|
20
|
+
| `-h, --help` | Show help |
|
|
21
21
|
|
|
22
|
-
##
|
|
22
|
+
## Available templates
|
|
23
23
|
|
|
24
|
-
- `default`
|
|
24
|
+
- `default` — Preact + Tailwind CSS
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## After creation
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
cd my-project
|
|
@@ -31,6 +31,6 @@ pnpm install
|
|
|
31
31
|
pnpm dev
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## License
|
|
35
35
|
|
|
36
36
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuqulore-inc/create-eleventy",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Create a new Eleventy project with Preact and TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"test": "node --test"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tuqulore-inc/eslint-config": "5.0
|
|
31
|
+
"@tuqulore-inc/eslint-config": "5.1.0",
|
|
32
32
|
"eslint": "^10.0.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "0d43e2a32a951ca608a2c5095c084737b7f3c8bf"
|
|
41
41
|
}
|
|
@@ -1,78 +1,78 @@
|
|
|
1
1
|
# My Eleventy Site
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Requirements
|
|
4
4
|
|
|
5
5
|
- [Active LTS](https://github.com/nodejs/release#release-schedule)
|
|
6
6
|
- Docker
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Quick start
|
|
9
9
|
|
|
10
10
|
> [!NOTE]
|
|
11
11
|
>
|
|
12
|
-
>
|
|
12
|
+
> Install [pnpm](https://pnpm.io/installation) first.
|
|
13
13
|
|
|
14
14
|
```shell
|
|
15
|
-
pnpm install #
|
|
16
|
-
pnpm dev #
|
|
15
|
+
pnpm install # install dependencies
|
|
16
|
+
pnpm dev # start the dev server
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
## npm
|
|
19
|
+
## npm scripts
|
|
20
20
|
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
| build
|
|
24
|
-
| clean
|
|
25
|
-
| dev
|
|
26
|
-
| format
|
|
27
|
-
| lint
|
|
21
|
+
| Task | Description |
|
|
22
|
+
| :----- | :------------------------ |
|
|
23
|
+
| build | Generate the static site. |
|
|
24
|
+
| clean | Remove build artifacts. |
|
|
25
|
+
| dev | Start the dev server. |
|
|
26
|
+
| format | Format code. |
|
|
27
|
+
| lint | Run static checks. |
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Environment variables
|
|
30
30
|
|
|
31
|
-
|
|
|
32
|
-
| :------- |
|
|
33
|
-
| SITE_URL |
|
|
31
|
+
| Name | Description |
|
|
32
|
+
| :------- | :-------------------------------------------------------- |
|
|
33
|
+
| SITE_URL | The URL of the site built from this repository. Required. |
|
|
34
34
|
|
|
35
|
-
###
|
|
35
|
+
### Cascade (`pnpm dev`)
|
|
36
36
|
|
|
37
37
|
1. .env
|
|
38
38
|
2. .env.development
|
|
39
39
|
3. .env.local
|
|
40
40
|
4. .env.development.local
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
They are read in that order; later values win. Put values that should not be committed into `.env.local` or `.env.development.local`.
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Cascade (`pnpm build`)
|
|
45
45
|
|
|
46
46
|
1. .env
|
|
47
47
|
2. .env.production
|
|
48
48
|
3. .env.local
|
|
49
49
|
4. .env.production.local
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
They are read in that order; later values win. Put values that should not be committed into `.env.local` or `.env.production.local`.
|
|
52
52
|
|
|
53
|
-
##
|
|
53
|
+
## Libraries used
|
|
54
54
|
|
|
55
55
|
### [Eleventy](https://www.11ty.dev/)
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
A static site generator.
|
|
58
58
|
|
|
59
59
|
### [Preact](https://preactjs.com/)
|
|
60
60
|
|
|
61
|
-
JSX
|
|
61
|
+
Renders JSX templates into HTML with dynamic behavior.
|
|
62
62
|
|
|
63
63
|
### [Tailwind CSS](https://tailwindcss.com/)
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
A utility-first CSS framework for the look and feel.
|
|
66
66
|
|
|
67
67
|
### [Jumpu UI](https://github.com/tuqulore/jumpu-ui)
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
A utility-friendly design system for a consistent look and feel.
|
|
70
70
|
|
|
71
71
|
### [Iconify SVG Framework](https://docs.iconify.design/icon-components/svg-framework/)
|
|
72
72
|
|
|
73
|
-
SVG
|
|
73
|
+
Provides SVG icons.
|
|
74
74
|
|
|
75
|
-
##
|
|
75
|
+
## Directory layout
|
|
76
76
|
|
|
77
77
|
```
|
|
78
78
|
.
|
|
@@ -86,44 +86,44 @@ SVGアイコンを参照するためのライブラリです。
|
|
|
86
86
|
|
|
87
87
|
### dist
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
The build output directory.
|
|
90
90
|
|
|
91
91
|
### src
|
|
92
92
|
|
|
93
|
-
Eleventy
|
|
93
|
+
Eleventy's template input root.
|
|
94
94
|
|
|
95
95
|
### src/\_data
|
|
96
96
|
|
|
97
|
-
[
|
|
97
|
+
Where [global data](https://www.11ty.dev/docs/data-global/) lives.
|
|
98
98
|
|
|
99
99
|
### src/\_includes
|
|
100
100
|
|
|
101
|
-
[
|
|
101
|
+
Where [layout templates](https://www.11ty.dev/docs/layouts/) for [layout chaining](https://www.11ty.dev/docs/layout-chaining/) live.
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
Specifically, the values referenced from a [frontmatter](https://www.11ty.dev/docs/data-frontmatter/) or an exported `data` object's `layout` property.
|
|
104
104
|
|
|
105
105
|
### src/\_includes/partials
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
Where JSX and MDX partials called from templates live.
|
|
108
108
|
|
|
109
109
|
### src/public
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
Where static assets live. Copied to the root of `dist/`.
|
|
112
112
|
|
|
113
113
|
## Partial Hydration
|
|
114
114
|
|
|
115
|
-
`.client.{js,jsx,ts,tsx}`
|
|
115
|
+
Drop a file with the `.client.{js,jsx,ts,tsx}` sub-extension anywhere under `src/`, and Partial Hydration turns on with no extra configuration. That file is bundled with esbuild and emitted to `dist/**/*.client.js`, then loaded through the `<Island>` component as the client-side script of `<is-land>`.
|
|
116
116
|
|
|
117
|
-
`clientComponent()`
|
|
117
|
+
Pass a component marked with `clientComponent()` to `<Island>`, and the same props flow into both the SSR-side render and the client-side hydration.
|
|
118
118
|
|
|
119
119
|
```jsx
|
|
120
120
|
// src/counter.client.jsx
|
|
121
121
|
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
122
|
-
import {
|
|
122
|
+
import { useSignal } from "@preact/signals";
|
|
123
123
|
|
|
124
124
|
function Counter(props) {
|
|
125
|
-
const
|
|
126
|
-
return <button onClick={() =>
|
|
125
|
+
const n = useSignal(props.initial ?? 0);
|
|
126
|
+
return <button onClick={() => n.value++}>{n}</button>;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
export default clientComponent(Counter, import.meta.url);
|
|
@@ -137,7 +137,7 @@ import Counter from "./counter.client.jsx";
|
|
|
137
137
|
<Island component={Counter} on="interaction" initial={5} />
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
For the example above, `<Island>` emits an `<is-land>` element like this from SSR:
|
|
141
141
|
|
|
142
142
|
```html
|
|
143
143
|
<is-land
|
|
@@ -150,15 +150,15 @@ import Counter from "./counter.client.jsx";
|
|
|
150
150
|
</is-land>
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
`on` prop
|
|
153
|
+
The `on` prop maps to the `<is-land>` initialization trigger (`interaction` / `visible` / `idle`).
|
|
154
154
|
|
|
155
155
|
> [!NOTE]
|
|
156
156
|
>
|
|
157
|
-
> [
|
|
157
|
+
> The [`<is-land>`](https://github.com/11ty/is-land?tab=readme-ov-file#usage) initialization attribute normally uses the `on:*` form, but that conflicts with JSX syntax, so this preset uses `land-on:*` instead. For parameterized triggers such as `on:media("(min-width: ...)")`, drop `<Island>` and use the raw `<is-land>` element.
|
|
158
158
|
|
|
159
159
|
## Docker
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
To build and run a Docker image that serves the static site:
|
|
162
162
|
|
|
163
163
|
```
|
|
164
164
|
docker build -t my-eleventy-site .
|
|
@@ -19,9 +19,10 @@
|
|
|
19
19
|
"@iconify/json": "^2.2.90",
|
|
20
20
|
"@iconify/tailwind4": "^1.0.6",
|
|
21
21
|
"@jumpu-ui/tailwindcss": "3.0.1",
|
|
22
|
+
"@preact/signals": "^2.9.3",
|
|
22
23
|
"@tailwindcss/postcss": "^4.0.14",
|
|
23
24
|
"@tailwindcss/typography": "0.5.20",
|
|
24
|
-
"@tuqulore-inc/eleventy-preset": "^5.0
|
|
25
|
+
"@tuqulore-inc/eleventy-preset": "^5.1.0",
|
|
25
26
|
"dotenv-cli": "^11.0.0",
|
|
26
27
|
"eslint": "^10.0.0",
|
|
27
28
|
"eslint-config-prettier": "^10.1.8",
|
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
-
import {
|
|
2
|
+
import { useSignal, useSignalEffect } from "@preact/signals";
|
|
3
|
+
import { useRef } from "preact/hooks";
|
|
3
4
|
import slugify from "slugify";
|
|
4
5
|
import { twMerge } from "tailwind-merge";
|
|
5
6
|
|
|
6
7
|
function MenuList(props) {
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const handleTransitionStart = () =>
|
|
10
|
-
|
|
8
|
+
const open = useSignal(false);
|
|
9
|
+
const visible = useSignal(open.value);
|
|
10
|
+
const handleTransitionStart = () => {
|
|
11
|
+
if (open.value) visible.value = true;
|
|
12
|
+
};
|
|
13
|
+
const handleTransitionEnd = () => {
|
|
14
|
+
if (!open.value) visible.value = false;
|
|
15
|
+
};
|
|
11
16
|
const ref = useRef(null);
|
|
12
17
|
const buttonRef = useRef(null);
|
|
13
18
|
const slug = `${slugify(props.item.name)}-${props.index}`;
|
|
14
|
-
|
|
15
|
-
if (!open) return;
|
|
19
|
+
useSignalEffect(() => {
|
|
20
|
+
if (!open.value) return;
|
|
16
21
|
const clickHandler = (e) => {
|
|
17
22
|
if (ref.current?.contains(e.target)) return;
|
|
18
|
-
|
|
23
|
+
open.value = false;
|
|
19
24
|
};
|
|
20
25
|
const keyHandler = (e) => {
|
|
21
26
|
if (e.key !== "Escape") return;
|
|
22
27
|
if (!ref.current?.contains(e.target)) return;
|
|
23
|
-
|
|
28
|
+
open.value = false;
|
|
24
29
|
buttonRef.current?.focus();
|
|
25
30
|
};
|
|
26
31
|
document.addEventListener("click", clickHandler);
|
|
@@ -29,23 +34,23 @@ function MenuList(props) {
|
|
|
29
34
|
document.removeEventListener("click", clickHandler);
|
|
30
35
|
document.removeEventListener("keydown", keyHandler);
|
|
31
36
|
};
|
|
32
|
-
}
|
|
37
|
+
});
|
|
33
38
|
return (
|
|
34
39
|
<div
|
|
35
40
|
ref={ref}
|
|
36
41
|
onFocusOut={(e) => {
|
|
37
42
|
if (ref.current?.contains(e.relatedTarget)) return;
|
|
38
|
-
|
|
43
|
+
open.value = false;
|
|
39
44
|
}}
|
|
40
45
|
>
|
|
41
46
|
<button
|
|
42
47
|
id={`nav-button-${slug}`}
|
|
43
48
|
ref={buttonRef}
|
|
44
49
|
aria-controls={`nav-menu-${slug}`}
|
|
45
|
-
aria-expanded={open}
|
|
50
|
+
aria-expanded={open.value}
|
|
46
51
|
class="jumpu-text-button"
|
|
47
52
|
type="button"
|
|
48
|
-
onClick={() =>
|
|
53
|
+
onClick={() => (open.value = !open.value)}
|
|
49
54
|
>
|
|
50
55
|
{props.item.name}
|
|
51
56
|
</button>
|
|
@@ -55,8 +60,8 @@ function MenuList(props) {
|
|
|
55
60
|
class={twMerge(
|
|
56
61
|
"jumpu-card absolute top-full left-1/2 max-h-[50vh] -translate-x-1/2 overflow-y-auto p-2",
|
|
57
62
|
"translate-y-2 transition duration-75 ease-in-out",
|
|
58
|
-
!open && "translate-y-[2.5%] scale-95 opacity-0",
|
|
59
|
-
open || visible ? "visible" : "invisible",
|
|
63
|
+
!open.value && "translate-y-[2.5%] scale-95 opacity-0",
|
|
64
|
+
open.value || visible.value ? "visible" : "invisible",
|
|
60
65
|
)}
|
|
61
66
|
onTransitionStart={handleTransitionStart}
|
|
62
67
|
onTransitionEnd={handleTransitionEnd}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
-
import {
|
|
2
|
+
import { useSignal, useSignalEffect } from "@preact/signals";
|
|
3
|
+
import { useRef } from "preact/hooks";
|
|
3
4
|
import { twMerge } from "tailwind-merge";
|
|
4
5
|
|
|
5
6
|
function Mobile(props) {
|
|
6
|
-
const
|
|
7
|
+
const open = useSignal(false);
|
|
7
8
|
const openButtonRef = useRef(null);
|
|
8
9
|
const closeButtonRef = useRef(null);
|
|
9
|
-
|
|
10
|
-
if (!open) return;
|
|
10
|
+
useSignalEffect(() => {
|
|
11
|
+
if (!open.value) return;
|
|
11
12
|
closeButtonRef.current?.focus();
|
|
12
13
|
// NOTE: メニュー表示中は背景 (html) のスクロールを止め、モバイルで
|
|
13
14
|
// メニューをスクロールしたつもりが背後のページも動く事故を防ぐ。
|
|
14
15
|
document.documentElement.classList.add("overflow-hidden");
|
|
15
16
|
const handler = (e) => {
|
|
16
17
|
if (e.key !== "Escape") return;
|
|
17
|
-
|
|
18
|
+
open.value = false;
|
|
18
19
|
openButtonRef.current?.focus();
|
|
19
20
|
};
|
|
20
21
|
document.addEventListener("keydown", handler);
|
|
@@ -22,29 +23,31 @@ function Mobile(props) {
|
|
|
22
23
|
document.removeEventListener("keydown", handler);
|
|
23
24
|
document.documentElement.classList.remove("overflow-hidden");
|
|
24
25
|
};
|
|
25
|
-
}
|
|
26
|
+
});
|
|
26
27
|
return (
|
|
27
28
|
<div class={props.class}>
|
|
28
29
|
<button
|
|
29
30
|
id="nav-button-mobile"
|
|
30
31
|
ref={openButtonRef}
|
|
31
32
|
aria-controls="nav-menu-mobile"
|
|
32
|
-
aria-expanded={open}
|
|
33
|
-
aria-label={
|
|
33
|
+
aria-expanded={open.value}
|
|
34
|
+
aria-label={
|
|
35
|
+
open.value ? "Close navigation menu" : "Open navigation menu"
|
|
36
|
+
}
|
|
34
37
|
class="jumpu-icon-button h-12 w-12 text-2xl"
|
|
35
38
|
type="button"
|
|
36
|
-
onClick={() =>
|
|
39
|
+
onClick={() => (open.value = !open.value)}
|
|
37
40
|
>
|
|
38
41
|
<span class="icon-[material-symbols--menu]"></span>
|
|
39
42
|
</button>
|
|
40
43
|
<nav
|
|
41
44
|
id="nav-menu-mobile"
|
|
42
45
|
aria-label="Global navigation"
|
|
43
|
-
inert={!open}
|
|
46
|
+
inert={!open.value}
|
|
44
47
|
class={twMerge(
|
|
45
48
|
"fixed top-0 left-0 h-screen w-screen overflow-y-auto overscroll-contain bg-white",
|
|
46
49
|
"transition duration-150 ease-in-out",
|
|
47
|
-
open ? "translate-x-0" : "translate-x-full",
|
|
50
|
+
open.value ? "translate-x-0" : "translate-x-full",
|
|
48
51
|
)}
|
|
49
52
|
>
|
|
50
53
|
<button
|
|
@@ -53,7 +56,7 @@ function Mobile(props) {
|
|
|
53
56
|
aria-label="Close navigation menu"
|
|
54
57
|
type="button"
|
|
55
58
|
onClick={() => {
|
|
56
|
-
|
|
59
|
+
open.value = false;
|
|
57
60
|
openButtonRef.current?.focus();
|
|
58
61
|
}}
|
|
59
62
|
>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
-
import {
|
|
2
|
+
import { useSignal } from "@preact/signals";
|
|
3
3
|
|
|
4
4
|
function Clicker() {
|
|
5
|
-
const
|
|
5
|
+
const counter = useSignal(0);
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
8
|
<div class="flex items-center gap-4">
|
|
9
9
|
<button
|
|
10
10
|
type="button"
|
|
11
11
|
class="jumpu-button"
|
|
12
|
-
onClick={() =>
|
|
12
|
+
onClick={() => counter.value++}
|
|
13
13
|
>
|
|
14
14
|
Count
|
|
15
15
|
</button>
|