@tuqulore-inc/create-eleventy 4.1.0 → 5.0.1
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/package.json +7 -6
- package/templates/default/Dockerfile +7 -8
- package/templates/default/README.md +32 -20
- package/templates/default/{eslint.config.mjs → eslint.config.js} +11 -4
- package/templates/default/package.json +4 -4
- package/templates/default/src/__data/nav.json +6 -9
- package/templates/default/src/__data/site.js +12 -0
- package/templates/default/src/__includes/base.mdx +11 -4
- package/templates/default/src/__includes/partials/header/{desktop.hydrate.jsx → desktop.client.jsx} +37 -15
- package/templates/default/src/__includes/partials/header/mobile.client.jsx +94 -0
- package/templates/default/src/__includes/partials/header.mdx +15 -21
- package/templates/default/src/__includes/partials/ogp.mdx +8 -3
- package/templates/default/src/clicker.client.jsx +21 -0
- package/templates/default/src/index.mdx +14 -10
- package/templates/default/src/main.css +11 -0
- package/templates/default/src/__data/site.mjs +0 -6
- package/templates/default/src/__includes/partials/header/mobile.hydrate.jsx +0 -76
- package/templates/default/src/clicker.hydrate.jsx +0 -14
- /package/{index.mjs → index.js} +0 -0
- /package/templates/default/{eleventy.config.mjs → eleventy.config.js} +0 -0
- /package/templates/default/{postcss.config.mjs → postcss.config.js} +0 -0
- /package/templates/default/{prettier.config.mjs → prettier.config.js} +0 -0
- /package/templates/default/{serve.mjs → serve.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuqulore-inc/create-eleventy",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Create a new Eleventy project with Preact and TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create",
|
|
@@ -17,17 +17,18 @@
|
|
|
17
17
|
"author": "tuqulore inc.",
|
|
18
18
|
"type": "module",
|
|
19
19
|
"bin": {
|
|
20
|
-
"create-eleventy": "./index.
|
|
20
|
+
"create-eleventy": "./index.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
|
-
"index.
|
|
23
|
+
"index.js",
|
|
24
24
|
"templates"
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
27
|
-
"lint": "eslint --fix ."
|
|
27
|
+
"lint": "eslint --fix .",
|
|
28
|
+
"test": "node --test"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@tuqulore-inc/eslint-config": "
|
|
31
|
+
"@tuqulore-inc/eslint-config": "5.0.1",
|
|
31
32
|
"eslint": "^10.0.0"
|
|
32
33
|
},
|
|
33
34
|
"engines": {
|
|
@@ -36,5 +37,5 @@
|
|
|
36
37
|
"publishConfig": {
|
|
37
38
|
"access": "public"
|
|
38
39
|
},
|
|
39
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "5966820d0ada95a8b172a8c0890150d8b1a3a543"
|
|
40
41
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
FROM node:24-slim@sha256:
|
|
1
|
+
FROM node:24-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 as build
|
|
2
2
|
WORKDIR /app
|
|
3
3
|
COPY package.json pnpm-lock.yaml ./
|
|
4
4
|
RUN corepack enable
|
|
5
5
|
RUN pnpm install --frozen-lockfile
|
|
6
|
-
COPY postcss.config.
|
|
6
|
+
COPY postcss.config.js eleventy.config.js .env* ./
|
|
7
7
|
COPY src/ ./src
|
|
8
|
-
COPY lib/ ./lib
|
|
9
8
|
RUN pnpm build
|
|
10
9
|
|
|
11
|
-
FROM node:24-slim@sha256:
|
|
10
|
+
FROM node:24-slim@sha256:cb4e8f7c443347358b7875e717c29e27bf9befc8f5a26cf18af3c3dec80e58c5 as install
|
|
12
11
|
WORKDIR /app
|
|
13
12
|
COPY package.json pnpm-lock.yaml ./
|
|
14
13
|
RUN corepack enable
|
|
15
|
-
RUN pnpm install --frozen-lockfile
|
|
14
|
+
RUN pnpm install --frozen-lockfile --prod
|
|
16
15
|
|
|
17
|
-
FROM gcr.io/distroless/
|
|
16
|
+
FROM gcr.io/distroless/nodejs24-debian13@sha256:ac0daf5d207757b275f3df0de9b296675500e773cc447c65afd66a948d5bf013
|
|
18
17
|
WORKDIR /app
|
|
19
18
|
ENV NODE_ENV=production
|
|
20
|
-
COPY serve.
|
|
19
|
+
COPY serve.js ./
|
|
21
20
|
COPY --from=build /app/dist ./dist
|
|
22
21
|
COPY --from=install /app/node_modules ./node_modules
|
|
23
22
|
|
|
24
|
-
CMD ["serve.
|
|
23
|
+
CMD ["serve.js"]
|
|
@@ -112,37 +112,49 @@ Eleventyテンプレートの参照先です。
|
|
|
112
112
|
|
|
113
113
|
## Partial Hydration
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
`.client.{js,jsx,ts,tsx}` という拡張子のファイルを `src` 配下に置くだけで、設定不要でパーシャルハイドレーションが有効になります。そのファイルは esbuild でバンドルされて `dist/**/*.client.js` に出力され、`<Island>` コンポーネントを通じて \<is-land> のクライアント側スクリプトとして読み込まれます。
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
`clientComponent()` でマークしたコンポーネントを `<Island>` に渡すと、SSR 側の描画と、クライアント側のハイドレーションの両方に同じ props が流れます。
|
|
118
118
|
|
|
119
|
-
```
|
|
120
|
-
|
|
119
|
+
```jsx
|
|
120
|
+
// src/counter.client.jsx
|
|
121
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
122
|
+
import { useState } from "preact/hooks";
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
+
function Counter(props) {
|
|
125
|
+
const [n, setN] = useState(props.initial ?? 0);
|
|
126
|
+
return <button onClick={() => setN(n + 1)}>{n}</button>;
|
|
127
|
+
}
|
|
124
128
|
|
|
125
|
-
|
|
126
|
-
</is-land>
|
|
129
|
+
export default clientComponent(Counter, import.meta.url);
|
|
127
130
|
```
|
|
128
131
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
\<is-land>Webコンポーネントは`land-on:*`属性のほか、次の属性を受け付けます。
|
|
134
|
-
|
|
135
|
-
### `type`属性
|
|
132
|
+
```mdx
|
|
133
|
+
// src/index.mdx
|
|
134
|
+
import { Island } from "@tuqulore-inc/eleventy-preset/island";
|
|
135
|
+
import Counter from "./counter.client.jsx";
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
<Island component={Counter} on="interaction" initial={5} />
|
|
138
|
+
```
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
上の例では、`<Island>` が次のような \<is-land> 要素を SSR 出力します。
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
```html
|
|
143
|
+
<is-land
|
|
144
|
+
land-on:interaction
|
|
145
|
+
type="preact"
|
|
146
|
+
import="/counter.client.js"
|
|
147
|
+
props='{"initial":5}'
|
|
148
|
+
>
|
|
149
|
+
<button>5</button>
|
|
150
|
+
</is-land>
|
|
151
|
+
```
|
|
142
152
|
|
|
143
|
-
|
|
153
|
+
`on` prop は \<is-land> の初期化トリガー (`interaction` / `visible` / `idle`) に対応します。
|
|
144
154
|
|
|
145
|
-
|
|
155
|
+
> [!NOTE]
|
|
156
|
+
>
|
|
157
|
+
> [\<is-land>](https://github.com/11ty/is-land?tab=readme-ov-file#usage)の初期化条件を指定する属性は、デフォルトでは `on:*` の書式で指定する必要がありますが、JSX の書式と競合するので `land-on:*` に変更しています。パラメータ付きトリガー (例: `on:media("(min-width: ...)")`) を使う場合は `<Island>` ではなく素の \<is-land> を直接書いてください。
|
|
146
158
|
|
|
147
159
|
## Docker
|
|
148
160
|
|
|
@@ -7,7 +7,7 @@ import globals from "globals";
|
|
|
7
7
|
|
|
8
8
|
export default defineConfig([
|
|
9
9
|
{
|
|
10
|
-
files: ["**/*.{cjs,
|
|
10
|
+
files: ["**/*.{cjs,js,jsx}"],
|
|
11
11
|
plugins: { js },
|
|
12
12
|
extends: ["js/recommended"],
|
|
13
13
|
},
|
|
@@ -16,14 +16,14 @@ export default defineConfig([
|
|
|
16
16
|
languageOptions: { sourceType: "commonjs" },
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
files: ["**/*.{
|
|
19
|
+
files: ["**/*.{js,jsx}"],
|
|
20
20
|
languageOptions: { sourceType: "module" },
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
files: ["**/*.cjs", "*.
|
|
23
|
+
files: ["**/*.cjs", "*.js", "src/_data/**/*.js"],
|
|
24
24
|
languageOptions: { globals: globals.node },
|
|
25
25
|
},
|
|
26
|
-
react.configs.flat.recommended,
|
|
26
|
+
{ ...react.configs.flat.recommended, files: ["**/*.{jsx,mdx}"] },
|
|
27
27
|
{
|
|
28
28
|
files: ["**/*.{jsx,mdx}"],
|
|
29
29
|
plugins: { react },
|
|
@@ -36,6 +36,13 @@ export default defineConfig([
|
|
|
36
36
|
...globals.browser,
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
|
+
settings: {
|
|
40
|
+
// NOTE: 本テンプレートは Preact 処理系だが、eslint-plugin-react の
|
|
41
|
+
// JSX 構文ルール (jsx-key など) を流用したい。version 未指定だと
|
|
42
|
+
// "React version not specified" 警告が出るので、Preact 10 の JSX
|
|
43
|
+
// runtime が API 互換な React 18 系をスタブとして与えて抑制する。
|
|
44
|
+
react: { version: "18.3.0" },
|
|
45
|
+
},
|
|
39
46
|
rules: {
|
|
40
47
|
"react/jsx-uses-react": "off",
|
|
41
48
|
"react/react-in-jsx-scope": "off",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"@eslint/js": "^10.0.0",
|
|
19
19
|
"@iconify/json": "^2.2.90",
|
|
20
20
|
"@iconify/tailwind4": "^1.0.6",
|
|
21
|
-
"@jumpu-ui/tailwindcss": "
|
|
21
|
+
"@jumpu-ui/tailwindcss": "3.0.1",
|
|
22
22
|
"@tailwindcss/postcss": "^4.0.14",
|
|
23
|
-
"@tailwindcss/typography": "0.5.
|
|
24
|
-
"@tuqulore-inc/eleventy-preset": "^
|
|
23
|
+
"@tailwindcss/typography": "0.5.20",
|
|
24
|
+
"@tuqulore-inc/eleventy-preset": "^5.0.1",
|
|
25
25
|
"dotenv-cli": "^11.0.0",
|
|
26
26
|
"eslint": "^10.0.0",
|
|
27
27
|
"eslint-config-prettier": "^10.1.8",
|
|
28
28
|
"eslint-plugin-mdx": "^3.2.0",
|
|
29
29
|
"eslint-plugin-react": "^7.37.4",
|
|
30
30
|
"globals": "^17.0.0",
|
|
31
|
-
"npm-run-all2": "^
|
|
31
|
+
"npm-run-all2": "^9.0.0",
|
|
32
32
|
"postcss": "^8.5.6",
|
|
33
33
|
"preact": "^10.26.4",
|
|
34
34
|
"prettier": "^3.8.1",
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"name": "Group
|
|
3
|
+
"name": "Group A",
|
|
4
4
|
"children": [
|
|
5
|
-
{ "name": "
|
|
6
|
-
{ "name": "
|
|
7
|
-
{ "name": "
|
|
8
|
-
{ "name": "Menu", "path": "/" },
|
|
9
|
-
{ "name": "Menu", "path": "/" },
|
|
10
|
-
{ "name": "Menu", "path": "/" }
|
|
5
|
+
{ "name": "Item A-1", "path": "/" },
|
|
6
|
+
{ "name": "Item A-2", "path": "/" },
|
|
7
|
+
{ "name": "Item A-3", "path": "/" }
|
|
11
8
|
]
|
|
12
9
|
},
|
|
13
|
-
{ "name": "
|
|
14
|
-
{ "name": "
|
|
10
|
+
{ "name": "Item B", "path": "/" },
|
|
11
|
+
{ "name": "Item C", "path": "/" }
|
|
15
12
|
]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
if (!process.env.SITE_URL) {
|
|
2
|
+
throw new Error(
|
|
3
|
+
"SITE_URL is not set. Define it in .env (or the appropriate .env.{development,production}[.local]) so canonical/OGP URLs can be built.",
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
description: "Site Description",
|
|
9
|
+
name: "Site Name",
|
|
10
|
+
url: process.env.SITE_URL,
|
|
11
|
+
author: "Site Author",
|
|
12
|
+
};
|
|
@@ -7,19 +7,26 @@ import Footer from "./partials/footer.mdx";
|
|
|
7
7
|
<head>
|
|
8
8
|
<meta charset="utf-8" />
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
10
|
-
<Ogp />
|
|
11
|
-
<link rel="stylesheet" href="/main.css" />
|
|
12
10
|
<title>
|
|
13
11
|
{eleventy.title && `${eleventy.title} | `}
|
|
14
12
|
{eleventy.site.name}
|
|
15
13
|
</title>
|
|
14
|
+
<Ogp />
|
|
15
|
+
<link rel="stylesheet" href="/main.css" />
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
|
+
<a
|
|
19
|
+
href="#main"
|
|
20
|
+
class="jumpu-button sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50"
|
|
21
|
+
>
|
|
22
|
+
本文へスキップ
|
|
23
|
+
</a>
|
|
18
24
|
<Header />
|
|
19
|
-
<
|
|
25
|
+
<main
|
|
26
|
+
id="main"
|
|
20
27
|
class="mx-auto mb-4 min-h-[60vh] max-w-6xl px-4"
|
|
21
28
|
dangerouslySetInnerHTML={{ __html: eleventy.content }}
|
|
22
|
-
></
|
|
29
|
+
></main>
|
|
23
30
|
<Footer />
|
|
24
31
|
</body>
|
|
25
32
|
</html>
|
package/templates/default/src/__includes/partials/header/{desktop.hydrate.jsx → desktop.client.jsx}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
1
2
|
import { useState, useRef, useEffect } from "preact/hooks";
|
|
2
3
|
import slugify from "slugify";
|
|
3
4
|
import { twMerge } from "tailwind-merge";
|
|
@@ -8,20 +9,40 @@ function MenuList(props) {
|
|
|
8
9
|
const handleTransitionStart = () => open && setVisible(true);
|
|
9
10
|
const handleTransitionEnd = () => !open && setVisible(false);
|
|
10
11
|
const ref = useRef(null);
|
|
12
|
+
const buttonRef = useRef(null);
|
|
13
|
+
const slug = `${slugify(props.item.name)}-${props.index}`;
|
|
11
14
|
useEffect(() => {
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
if (!open) return;
|
|
16
|
+
const clickHandler = (e) => {
|
|
17
|
+
if (ref.current?.contains(e.target)) return;
|
|
14
18
|
setOpen(false);
|
|
15
19
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const keyHandler = (e) => {
|
|
21
|
+
if (e.key !== "Escape") return;
|
|
22
|
+
if (!ref.current?.contains(e.target)) return;
|
|
23
|
+
setOpen(false);
|
|
24
|
+
buttonRef.current?.focus();
|
|
25
|
+
};
|
|
26
|
+
document.addEventListener("click", clickHandler);
|
|
27
|
+
document.addEventListener("keydown", keyHandler);
|
|
28
|
+
return () => {
|
|
29
|
+
document.removeEventListener("click", clickHandler);
|
|
30
|
+
document.removeEventListener("keydown", keyHandler);
|
|
31
|
+
};
|
|
32
|
+
}, [open]);
|
|
19
33
|
return (
|
|
20
|
-
<div
|
|
34
|
+
<div
|
|
35
|
+
ref={ref}
|
|
36
|
+
onFocusOut={(e) => {
|
|
37
|
+
if (ref.current?.contains(e.relatedTarget)) return;
|
|
38
|
+
setOpen(false);
|
|
39
|
+
}}
|
|
40
|
+
>
|
|
21
41
|
<button
|
|
22
|
-
id={`nav-button-${
|
|
23
|
-
|
|
24
|
-
aria-controls={`nav-menu-${
|
|
42
|
+
id={`nav-button-${slug}`}
|
|
43
|
+
ref={buttonRef}
|
|
44
|
+
aria-controls={`nav-menu-${slug}`}
|
|
45
|
+
aria-expanded={open}
|
|
25
46
|
class="jumpu-text-button"
|
|
26
47
|
type="button"
|
|
27
48
|
onClick={() => setOpen(!open)}
|
|
@@ -29,9 +50,8 @@ function MenuList(props) {
|
|
|
29
50
|
{props.item.name}
|
|
30
51
|
</button>
|
|
31
52
|
<ul
|
|
32
|
-
id={`nav-menu-${
|
|
33
|
-
|
|
34
|
-
aria-labelledby={`nav-button-${slugify(props.item.name)}`}
|
|
53
|
+
id={`nav-menu-${slug}`}
|
|
54
|
+
aria-labelledby={`nav-button-${slug}`}
|
|
35
55
|
class={twMerge(
|
|
36
56
|
"jumpu-card absolute top-full left-1/2 max-h-[50vh] -translate-x-1/2 overflow-y-auto p-2",
|
|
37
57
|
"translate-y-2 transition duration-75 ease-in-out",
|
|
@@ -47,16 +67,16 @@ function MenuList(props) {
|
|
|
47
67
|
);
|
|
48
68
|
}
|
|
49
69
|
|
|
50
|
-
|
|
70
|
+
function Desktop(props) {
|
|
51
71
|
return (
|
|
52
72
|
<nav class={props.class}>
|
|
53
73
|
<ul class="flex items-center">
|
|
54
74
|
{props.nav.map((item, itemIndex) =>
|
|
55
75
|
"children" in item ? (
|
|
56
76
|
<li key={`${item.name}-${itemIndex}`} class="relative">
|
|
57
|
-
<MenuList item={item}>
|
|
77
|
+
<MenuList item={item} index={itemIndex}>
|
|
58
78
|
{item.children.map((child, childIndex) => (
|
|
59
|
-
<li key={`${child.name}-${childIndex}`}
|
|
79
|
+
<li key={`${child.name}-${childIndex}`}>
|
|
60
80
|
<a
|
|
61
81
|
class="jumpu-text-button w-full whitespace-nowrap"
|
|
62
82
|
href={child.path}
|
|
@@ -79,3 +99,5 @@ export default function Desktop(props) {
|
|
|
79
99
|
</nav>
|
|
80
100
|
);
|
|
81
101
|
}
|
|
102
|
+
|
|
103
|
+
export default clientComponent(Desktop, import.meta.url);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
+
import { useEffect, useRef, useState } from "preact/hooks";
|
|
3
|
+
import { twMerge } from "tailwind-merge";
|
|
4
|
+
|
|
5
|
+
function Mobile(props) {
|
|
6
|
+
const [open, setOpen] = useState(false);
|
|
7
|
+
const openButtonRef = useRef(null);
|
|
8
|
+
const closeButtonRef = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!open) return;
|
|
11
|
+
closeButtonRef.current?.focus();
|
|
12
|
+
// NOTE: メニュー表示中は背景 (html) のスクロールを止め、モバイルで
|
|
13
|
+
// メニューをスクロールしたつもりが背後のページも動く事故を防ぐ。
|
|
14
|
+
document.documentElement.classList.add("overflow-hidden");
|
|
15
|
+
const handler = (e) => {
|
|
16
|
+
if (e.key !== "Escape") return;
|
|
17
|
+
setOpen(false);
|
|
18
|
+
openButtonRef.current?.focus();
|
|
19
|
+
};
|
|
20
|
+
document.addEventListener("keydown", handler);
|
|
21
|
+
return () => {
|
|
22
|
+
document.removeEventListener("keydown", handler);
|
|
23
|
+
document.documentElement.classList.remove("overflow-hidden");
|
|
24
|
+
};
|
|
25
|
+
}, [open]);
|
|
26
|
+
return (
|
|
27
|
+
<div class={props.class}>
|
|
28
|
+
<button
|
|
29
|
+
id="nav-button-mobile"
|
|
30
|
+
ref={openButtonRef}
|
|
31
|
+
aria-controls="nav-menu-mobile"
|
|
32
|
+
aria-expanded={open}
|
|
33
|
+
aria-label={open ? "Close navigation menu" : "Open navigation menu"}
|
|
34
|
+
class="jumpu-icon-button h-12 w-12 text-2xl"
|
|
35
|
+
type="button"
|
|
36
|
+
onClick={() => setOpen((v) => !v)}
|
|
37
|
+
>
|
|
38
|
+
<span class="icon-[material-symbols--menu]"></span>
|
|
39
|
+
</button>
|
|
40
|
+
<nav
|
|
41
|
+
id="nav-menu-mobile"
|
|
42
|
+
aria-label="Global navigation"
|
|
43
|
+
inert={!open}
|
|
44
|
+
class={twMerge(
|
|
45
|
+
"fixed top-0 left-0 h-screen w-screen overflow-y-auto overscroll-contain bg-white",
|
|
46
|
+
"transition duration-150 ease-in-out",
|
|
47
|
+
open ? "translate-x-0" : "translate-x-full",
|
|
48
|
+
)}
|
|
49
|
+
>
|
|
50
|
+
<button
|
|
51
|
+
ref={closeButtonRef}
|
|
52
|
+
class="jumpu-icon-button fixed top-2 right-4 h-12 w-12 text-2xl"
|
|
53
|
+
aria-label="Close navigation menu"
|
|
54
|
+
type="button"
|
|
55
|
+
onClick={() => {
|
|
56
|
+
setOpen(false);
|
|
57
|
+
openButtonRef.current?.focus();
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
<span class="icon-[material-symbols--close]"></span>
|
|
61
|
+
</button>
|
|
62
|
+
<ul class="flex flex-col px-4 py-16">
|
|
63
|
+
{props.nav.map((item, itemIndex) => (
|
|
64
|
+
<li key={`${item.name}-${itemIndex}`}>
|
|
65
|
+
{item.children && (
|
|
66
|
+
<div class="mb-6" role="group" aria-label={item.name}>
|
|
67
|
+
<p class="mb-2 ml-4 text-lg" aria-hidden="true">
|
|
68
|
+
{item.name}
|
|
69
|
+
</p>
|
|
70
|
+
<ul>
|
|
71
|
+
{item.children.map((child, childIndex) => (
|
|
72
|
+
<li key={`${child.name}-${childIndex}`}>
|
|
73
|
+
<a class="jumpu-text-button block" href={child.path}>
|
|
74
|
+
{child.name}
|
|
75
|
+
</a>
|
|
76
|
+
</li>
|
|
77
|
+
))}
|
|
78
|
+
</ul>
|
|
79
|
+
</div>
|
|
80
|
+
)}
|
|
81
|
+
{item.path && (
|
|
82
|
+
<a class="jumpu-text-button block" href={item.path}>
|
|
83
|
+
{item.name}
|
|
84
|
+
</a>
|
|
85
|
+
)}
|
|
86
|
+
</li>
|
|
87
|
+
))}
|
|
88
|
+
</ul>
|
|
89
|
+
</nav>
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export default clientComponent(Mobile, import.meta.url);
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
+
import { Island } from "@tuqulore-inc/eleventy-preset/island";
|
|
1
2
|
import { eleventy } from "@tuqulore-inc/eleventy-preset/eleventy";
|
|
2
|
-
import Desktop from "./header/desktop.
|
|
3
|
-
import Mobile from "./header/mobile.
|
|
3
|
+
import Desktop from "./header/desktop.client.jsx";
|
|
4
|
+
import Mobile from "./header/mobile.client.jsx";
|
|
4
5
|
|
|
5
6
|
<header class="sticky top-0 mb-8 bg-white shadow">
|
|
6
7
|
<div class="mx-auto flex h-16 max-w-6xl items-center justify-between gap-4 px-4 md:justify-start">
|
|
7
8
|
<a class="flex-shrink-0" href="/">
|
|
8
9
|
{eleventy.site.name}
|
|
9
10
|
</a>
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
props={JSON.stringify({
|
|
23
|
-
class: "ml-auto flex items-center md:hidden",
|
|
24
|
-
nav: eleventy.nav,
|
|
25
|
-
})}
|
|
26
|
-
>
|
|
27
|
-
<Mobile class="ml-auto flex items-center md:hidden" nav={eleventy.nav} />
|
|
28
|
-
</is-land>
|
|
11
|
+
<Island
|
|
12
|
+
component={Desktop}
|
|
13
|
+
on="interaction"
|
|
14
|
+
class="hidden md:block"
|
|
15
|
+
nav={eleventy.nav}
|
|
16
|
+
/>
|
|
17
|
+
<Island
|
|
18
|
+
component={Mobile}
|
|
19
|
+
on="interaction"
|
|
20
|
+
class="ml-auto flex items-center md:hidden"
|
|
21
|
+
nav={eleventy.nav}
|
|
22
|
+
/>
|
|
29
23
|
</div>
|
|
30
24
|
</header>
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { eleventy } from "@tuqulore-inc/eleventy-preset/eleventy";
|
|
2
2
|
|
|
3
|
+
<meta
|
|
4
|
+
name="description"
|
|
5
|
+
content={eleventy.description ?? eleventy.site.description}
|
|
6
|
+
/>
|
|
3
7
|
<meta
|
|
4
8
|
property="og:description"
|
|
5
9
|
content={eleventy.description ?? eleventy.site.description}
|
|
@@ -9,10 +13,11 @@ import { eleventy } from "@tuqulore-inc/eleventy-preset/eleventy";
|
|
|
9
13
|
<meta property="og:type" content="website" />
|
|
10
14
|
<meta
|
|
11
15
|
property="og:url"
|
|
12
|
-
content={new URL(eleventy.
|
|
16
|
+
content={new URL(eleventy.page.url, eleventy.site.url).href}
|
|
13
17
|
/>
|
|
14
18
|
<meta
|
|
15
19
|
property="og:image"
|
|
16
|
-
content={new URL(eleventy.
|
|
20
|
+
content={new URL(eleventy.ogp ?? "/ogp.png", eleventy.site.url).href}
|
|
17
21
|
/>
|
|
18
|
-
<meta property="
|
|
22
|
+
<meta property="og:image:alt" content={eleventy.title ?? eleventy.site.name} />
|
|
23
|
+
<meta name="twitter:card" content="summary" />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { clientComponent } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
+
import { useState } from "preact/hooks";
|
|
3
|
+
|
|
4
|
+
function Clicker() {
|
|
5
|
+
const [counter, setCounter] = useState(0);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<div class="flex items-center gap-4">
|
|
9
|
+
<button
|
|
10
|
+
type="button"
|
|
11
|
+
class="jumpu-button"
|
|
12
|
+
onClick={() => setCounter(counter + 1)}
|
|
13
|
+
>
|
|
14
|
+
Count
|
|
15
|
+
</button>
|
|
16
|
+
<output class="text-xl tabular-nums">{counter}</output>
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default clientComponent(Clicker, import.meta.url);
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Island } from "@tuqulore-inc/eleventy-preset/island";
|
|
2
|
+
import Clicker from "./clicker.client.jsx";
|
|
2
3
|
|
|
3
4
|
export const data = {
|
|
4
5
|
layout: "post",
|
|
5
|
-
title: "
|
|
6
|
+
title: "ようこそ",
|
|
6
7
|
};
|
|
7
8
|
|
|
8
|
-
#
|
|
9
|
+
# ようこそ
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
これは default テンプレートのスターターページです。`src/index.mdx` を編集して、実際のコンテンツに置き換えてください。
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## 含まれているもの
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
- Eleventy + Preact + Tailwind CSS
|
|
16
|
+
- MDX で書けるレイアウト・ページ
|
|
17
|
+
- `.client.jsx` 命名によるパーシャルハイドレーション
|
|
18
|
+
- Tailwind Typography による Markdown スタイル
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
## Partial Hydration サンプル
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
以下のカウンターは Preact コンポーネントで、初回操作時にクライアント側でハイドレーションされます。
|
|
23
|
+
|
|
24
|
+
<Island component={Clicker} on="interaction" />
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { useState } from "preact/hooks";
|
|
2
|
-
import { twMerge } from "tailwind-merge";
|
|
3
|
-
|
|
4
|
-
export default function Mobile(props) {
|
|
5
|
-
const [open, setOpen] = useState(false);
|
|
6
|
-
return (
|
|
7
|
-
<div class={props.class}>
|
|
8
|
-
<button
|
|
9
|
-
id="nav-button-mobile"
|
|
10
|
-
aria-controls="nav-menu-mobile"
|
|
11
|
-
aria-describedby="nav-tooltip-mobile"
|
|
12
|
-
class="jumpu-icon-button group h-12 w-12 text-2xl"
|
|
13
|
-
type="button"
|
|
14
|
-
onClick={() => setOpen(true)}
|
|
15
|
-
>
|
|
16
|
-
<span class="icon-[material-symbols--menu]"></span>
|
|
17
|
-
<span
|
|
18
|
-
id="nav-tooltip-mobile"
|
|
19
|
-
role="tooltip"
|
|
20
|
-
class="![transform:translate(-50%,_225%)_scale(0)] group-hover:![transform:translate(-50%,_225%)_scale(1)]"
|
|
21
|
-
>
|
|
22
|
-
Menu
|
|
23
|
-
</span>
|
|
24
|
-
</button>
|
|
25
|
-
<nav
|
|
26
|
-
id="nav-menu-mobile"
|
|
27
|
-
class={twMerge(
|
|
28
|
-
"fixed top-0 left-0 h-screen w-screen overflow-y-auto bg-white",
|
|
29
|
-
"transition duration-150 ease-in-out",
|
|
30
|
-
open ? "translate-x-0" : "translate-x-full",
|
|
31
|
-
)}
|
|
32
|
-
>
|
|
33
|
-
<button
|
|
34
|
-
class="jumpu-icon-button group fixed top-2 right-4 h-12 w-12 text-2xl"
|
|
35
|
-
aria-describedby="nav-tooltip-close"
|
|
36
|
-
type="button"
|
|
37
|
-
onClick={() => setOpen(false)}
|
|
38
|
-
>
|
|
39
|
-
<span class="icon-[material-symbols--close]"></span>
|
|
40
|
-
<span
|
|
41
|
-
id="nav-tooltip-close"
|
|
42
|
-
role="tooltip"
|
|
43
|
-
class="![transform:translate(-50%,_225%)_scale(0)] group-hover:![transform:translate(-50%,_225%)_scale(1)]"
|
|
44
|
-
>
|
|
45
|
-
Close
|
|
46
|
-
</span>
|
|
47
|
-
</button>
|
|
48
|
-
<ul class="flex flex-col px-4 py-16">
|
|
49
|
-
{props.nav.map((item, itemIndex) => (
|
|
50
|
-
<li key={`${item.name}-${itemIndex}`}>
|
|
51
|
-
{item.children && (
|
|
52
|
-
<section class="mb-6">
|
|
53
|
-
<h2 class="mb-2 ml-4 text-lg">{item.name}</h2>
|
|
54
|
-
<ul>
|
|
55
|
-
{item.children.map((child, childIndex) => (
|
|
56
|
-
<li key={`${child.name}-${childIndex}`}>
|
|
57
|
-
<a class="jumpu-text-button block" href={child.path}>
|
|
58
|
-
{child.name}
|
|
59
|
-
</a>
|
|
60
|
-
</li>
|
|
61
|
-
))}
|
|
62
|
-
</ul>
|
|
63
|
-
</section>
|
|
64
|
-
)}
|
|
65
|
-
{item.path && (
|
|
66
|
-
<a class="jumpu-text-button block" href={item.path}>
|
|
67
|
-
{item.name}
|
|
68
|
-
</a>
|
|
69
|
-
)}
|
|
70
|
-
</li>
|
|
71
|
-
))}
|
|
72
|
-
</ul>
|
|
73
|
-
</nav>
|
|
74
|
-
</div>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useState } from "preact/hooks";
|
|
2
|
-
|
|
3
|
-
export default function Clicker() {
|
|
4
|
-
const [counter, setCounter] = useState(0);
|
|
5
|
-
|
|
6
|
-
return (
|
|
7
|
-
<div>
|
|
8
|
-
<button class="jumpu-button" onClick={() => setCounter(counter + 1)}>
|
|
9
|
-
Count
|
|
10
|
-
</button>
|
|
11
|
-
<p>{counter}</p>
|
|
12
|
-
</div>
|
|
13
|
-
);
|
|
14
|
-
}
|
/package/{index.mjs → index.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|