@d-zero/scaffold 5.0.0-beta.8 → 5.0.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.
Files changed (39) hide show
  1. package/.gitignore +4 -0
  2. package/.vscode/settings.json +9 -1
  3. package/CHANGELOG.md +67 -0
  4. package/README.md +7 -8
  5. package/__assets/_libs/.markuplintrc +6 -0
  6. package/__assets/_libs/component/c-nav-breadcrumb.pug +1 -1
  7. package/__assets/_libs/mixin/meta-basercms.pug +14 -0
  8. package/__assets/_libs/mixin/meta.pug +4 -1
  9. package/cspell.json +2 -1
  10. package/htdocs/__tmpl/000_home.html +279 -0
  11. package/htdocs/__tmpl/100_sub.html +1695 -0
  12. package/htdocs/__tmpl/200_blog_index.html +412 -0
  13. package/htdocs/__tmpl/210_blog_index.html +412 -0
  14. package/htdocs/__tmpl/300_form_input.html +800 -0
  15. package/htdocs/__tmpl/301_form_confirm.html +528 -0
  16. package/htdocs/__tmpl/302_form_complete.html +309 -0
  17. package/htdocs/__tmpl/__burger_editor/img/bg-sample.png +0 -0
  18. package/htdocs/__tmpl/__burger_editor/js/bge_modules/bge_functions.min.js +11 -0
  19. package/htdocs/__tmpl/index.html +82 -0
  20. package/htdocs/css/bge_style.css +13 -0
  21. package/htdocs/css/style.css +13 -0
  22. package/htdocs/files/images/sample.png +0 -0
  23. package/htdocs/index.html +13 -0
  24. package/htdocs/js/script.js +5 -0
  25. package/htdocs/sample/index.html +244 -0
  26. package/htdocs/sub-folder.test/css/style.css +7 -0
  27. package/htdocs/sub-folder.test/index.html +32 -0
  28. package/htdocs/sub-folder.test/js/script.js +5 -0
  29. package/kamado.config.ts +48 -0
  30. package/package.json +32 -21
  31. package/.clineignore +0 -6
  32. package/.clinerules +0 -17
  33. package/__assets/_libs/data/blocks.html +0 -71
  34. package/__assets/_libs/data/breadcrumbs.js +0 -77
  35. package/__assets/_libs/data/titlelist.js +0 -16
  36. package/ai-tasks/create-component.md +0 -127
  37. package/ai-tasks/create-page.md +0 -110
  38. package/ai-tasks/page-to-burger.md +0 -68
  39. package/eleventy.config.mjs +0 -71
@@ -1,77 +0,0 @@
1
- import path from 'node:path';
2
-
3
- import { JSDOM } from 'jsdom';
4
-
5
- /**
6
- *
7
- */
8
- export default function () {
9
- return (page, collections) => {
10
- const breadcrumbs = collections.all
11
- .filter((item) => isAncestor(page, item.filePathStem))
12
- .map((item) => ({
13
- title: getTitle(item),
14
- href: item.page.url,
15
- depth: item.page.url.split('/').filter(Boolean).length,
16
- }))
17
- .sort((a, b) => a.depth - b.depth);
18
- return breadcrumbs;
19
- };
20
- }
21
-
22
- /**
23
- *
24
- * @param page
25
- * @param filePathStem
26
- */
27
- function isAncestor(page, filePathStem) {
28
- const dirname = path.dirname(filePathStem);
29
- const name = path.basename(filePathStem);
30
- const included = page.filePathStem.startsWith(dirname);
31
- const isIndex = name === 'index';
32
- const isSelf = page.filePathStem === filePathStem;
33
- return (included && isIndex) || isSelf;
34
- }
35
-
36
- const titleCache = new Map();
37
-
38
- /**
39
- *
40
- * @param item
41
- */
42
- function getTitle(item) {
43
- const filePathStem = item.filePathStem;
44
- if (titleCache.has(filePathStem)) {
45
- return titleCache.get(filePathStem);
46
- }
47
- const title =
48
- item.data.title?.trim() ||
49
- getTitleFromDOM(getContent(item)) ||
50
- item.page.fileSlug?.trim();
51
- titleCache.set(filePathStem, title);
52
- return title;
53
- }
54
-
55
- /**
56
- *
57
- * @param item
58
- */
59
- function getTitleFromDOM(item) {
60
- const content = getContent(item);
61
- const dom = new JSDOM(content);
62
- const title = dom.window.document.title.trim();
63
- return title;
64
- }
65
-
66
- /**
67
- *
68
- * @param item
69
- */
70
- function getContent(item) {
71
- try {
72
- // UsingCircularTemplateContentReferenceError may potentially occur
73
- return item.templateContent;
74
- } catch {
75
- return null;
76
- }
77
- }
@@ -1,16 +0,0 @@
1
- import breadcrumbs from './breadcrumbs.js';
2
-
3
- /**
4
- *
5
- */
6
- export default async function () {
7
- return (page, collections, pkg, separator = ' | ') => {
8
- const breadcrumbLinkList = breadcrumbs()(page, collections);
9
- const titleList = breadcrumbLinkList
10
- .filter((item) => item.href !== '/')
11
- .toReversed()
12
- .map((item) => item.title);
13
- titleList.push(pkg.production?.siteName || '__サイト名__');
14
- return titleList.join(separator);
15
- };
16
- }
@@ -1,127 +0,0 @@
1
- # 1
2
-
3
- `use_mcp_tool:burger_editor`関連の実行を禁止する。
4
- FigmaデータのURLをユーザーに要求せよ。
5
- ユーザーから受け取ったURLで`use_mcp_tool:frontend_env:get_figma_data`せよ。
6
- 得られたファイルパスを`execute_command:mv`で`.cache/figma-data.yaml`に保存し、ステップ2を実行せよ。
7
- ユーザーがURLを入力しなかったら、ステップ4を実行せよ。
8
-
9
- # 2
10
-
11
- ステップ1で得られたFigmaデータを`read_file`で読み込め。
12
- ここでどんなコンポーネントを作るのか記憶せよ。
13
- Figmaデータのトップレイヤーのフレーム名をコンポーネント名にせよ。
14
- カスタム要素が含まれていてもそれはコンポーネントの一部であり、別々で生成する必要はない。
15
- コンポーネントが不明瞭な場合、Figmaのレイヤー名を変更するようにユーザーに警告、ステップは継続せず全タスクを終了せよ。
16
- コンポーネントが名が判明したらステップ3を実行せよ。
17
-
18
- # 3
19
-
20
- FigmaのFileデータから全体のnodeIdで`use_mcp_tool:frontend_env:get_figma_image`から全体の画像を取得せよ。
21
- MCPサーバから返却されたURLを`execute_command:curl`して、`.cache/コンポーネント名.png`として保存。
22
- URLをブラウザで開いてはいけない。
23
- これらのタスクが完了したら、ステップ4を実行せよ。
24
-
25
- # 4
26
-
27
- `.cache/コンポーネント名.png`を解析し全体デザインを確認し、構造やスタイルを分析せよ。
28
- Figmaデータに`boundVariables`ノードをもつ場合、ユーザーにVariablesの詳細情報を要求せよ。
29
- `__assets/_libs/style/base/root.scss`を`read_file`し、既にCSSカスタムプロパティが存在してたらスキップしてステップ6へ。
30
- ユーザーからVariablesの詳細情報を得られたら、ステップ5を実行せよ。拒否されたら、ステップ6を実行せよ。
31
-
32
- # 5
33
-
34
- `__assets/_libs/style/base/root.scss`を`read_file`せよ。
35
- たとえば`--primary-color[VariableCollectionId:5:13/VariableID:5:14]={"r":0.9529411792755127,"g":0.572549045085907,"b":0,"a":1}`を受け取っていれば`--primary-color: rgb(243 156 18 / 100%);`のように変換せよ。
36
- Variables変換したCSSカスタムプロパティとして`:root`に上書きせずに追記せよ。
37
- `--primary-color: rgb(243 156 18 / 100%); /* VariableID:5:14 */`のようにコメントもつけろ。
38
- 「カラーシンタックスがフォーマットと異なる」類のstylelintエラーはこのステップでは無視してよい。
39
- これらのタスクが完了したら、ステップ6を実行せよ。
40
-
41
- # 6
42
-
43
- Figmaのデータにカスタム要素が存在するか確認せよ。
44
- `use_mcp_tool:frontend_env:get_coding_guidelines(web-components)`を確認し、**プレフィックスは`c`としてカスタム要素名を記憶せよ**。
45
- **注意**: カスタム要素が含まれたとしてもコンポーネントの一部であり別々で生成する必要はない。
46
- これらのタスクが完了したら、ステップ7を実行せよ。
47
-
48
- # 7
49
-
50
- ステップ1で`.cache/コンポーネント名.yaml`に保存していた場合データを読み込め。
51
- ステップ2で`.cache/コンポーネント名.png`に保存していた場合画像を画像解析せよ。
52
- 画像化する必要があるFigmaノードを特定せよ。
53
- カスタム要素に相当するノード内は無視すること。
54
- `use_mcp_tool:frontend_env:get_figma_image`で画像のURLを取得し、`execute_command:curl`で`htdocs/img/`に保存せよ。
55
- `use_mcp_tool:frontend_env:get_coding_guidelines(media)`の規定に従うこと。
56
- サブディレクトリは作らないこと。
57
- SVGもsvgファイル画像として保存すること。
58
- これらのタスクが完了したら、ステップ8を実行せよ。
59
-
60
- # 8
61
-
62
- HTMLを作成する。
63
- 作成するのはFigmaのトップレイヤーのコンポーネントのみである。
64
- `use_mcp_tool:frontend_env:get_coding_guidelines(html)`の規定に従い設計せよ。
65
- 作成するコンポーネントの名前でpugファイルを作成(場所は`__assets/_libs/component/コンポーネント名.pug`)せよ。
66
- 既にファイルが存在する場合は、そのファイルを上書きせよ。
67
- 要素の順番はスクリーンリーダーやフォーカスの順番に依存し重要であるため、Figmaレイヤーの順番にはこだわらず、情報設計的な在り方を最優先に視覚的な配置を加味して順番を決定すること。
68
- **カスタム要素の要素名のプレフィックスは`c-`をつけること。**
69
- インラインSVGは作ってはならない。必要なのであればステップ7に戻って再作成すること。
70
- これらのタスクが完了したら、ステップ9を実行せよ。
71
-
72
- # 9
73
-
74
- 作成したコンポーネントファイルで代替テキストが必要か確認せよ。
75
- 必要な場合は、コーディングガイドラインで代替テキストの情報を確認せよ。
76
- 確認ができたら、ファイルを修正せよ。
77
- これらのタスクが完了したら、ステップ10を実行せよ。
78
-
79
- # 10
80
-
81
- CSSを作成する。
82
- 一般的なCSSの実装方法を一切忘れてのぞめ。
83
- `use_mcp_tool:frontend_env:get_coding_guidelines(css)`に従い設計せよ。
84
- ステップ1で`.cache/コンポーネント名.yaml`に保存していた場合データを読み込め。
85
- ステップ2で`.cache/コンポーネント名.png`に保存していた場合画像を画像解析せよ。
86
- ステップ8で作成したpugファイルを読み込め。
87
- 確認ができたら、作成するコンポーネントの名前でscssファイルを作成(場所は`__assets/_libs/component/コンポーネント名.scss`)せよ。
88
- これらJSONと画像とHTMLを解析して、コンポーネントのスタイルを生成せよ。
89
- **レスポンシブが想定されていてもメディアクエリを使用して非表示の要素を作らないこと。**
90
- **レスポンシブが想定されていてもメディアクエリを使用して非表示の要素を作らないこと!**
91
- **レスポンシブが想定されていてもメディアクエリを使用して非表示の要素を作らないこと!!!**
92
- **Figmaデータからあるがままスタイルに変換すること。**
93
- **カスタム要素のカスタムプロパティは反映すること。**
94
- **カスタム要素が固定のサイズを持つ場合は、`inline-size`などで指定すること。**
95
- HTMLと同様にカスタム要素のプレフィックスは`c-`である。
96
- stylelintのエラーが発生した場合は、直接編集せず、`npx stylelint --fix <fileName>`を実行せよ。
97
- stylelintのselector-type-no-unknownエラーが発生している場合、カスタム要素の命名が間違っているので、ステップ7に戻って必要な部分だけ修正せよ。
98
- これらのタスクが完了したら、ステップ11を実行せよ。
99
-
100
- # 11
101
-
102
- カスタム要素を使用していた場合は、JSに`@d-zero/custom-components`を読み込め。
103
-
104
- ```ts
105
- import { defineXXXXX } from '@d-zero/custom-components/XXXXX';
106
- defineXXXXX('c'); // プレフィックスは"c-"
107
- ```
108
-
109
- としろ。
110
- `__assets/htdocs/js/script.ts`に上書きせずに追記せよ。
111
- **他の実装は不要。**
112
- **他の実装は不要!**
113
- **他の実装は不要!!!**
114
- これらのタスクが完了したら、ステップ12を実行せよ。
115
-
116
- # 12
117
-
118
- コンポーネントがどのページに影響するかを報告せよ。
119
- どのページかどうかは`__assets/htdocs/`ディレクトリ内から`@include`もしくはクラス名を検索して特定せよ。
120
- CLIを使って検索しても構わない。
121
- これらのタスクが完了したら、ステップ13を実行せよ。
122
-
123
- # 13
124
-
125
- `git status`を実行して、変更があったファイルとその内容を確認せよ。
126
- 差分は`git --no-pager diff <fileName>`で実行せよ。
127
- 内容に問題があれば、各ステップに戻り修正せよ。
@@ -1,110 +0,0 @@
1
- # 1
2
-
3
- `use_mcp_tool:burger_editor`関連の実行を禁止する。
4
- 指示があるまで一切の`list_files`、`search_files`、`read_file`および`write_to_file`を禁止する。
5
- その他余計な推論やファイル読み込み操作はせずに次のステップに進め。
6
-
7
- # 2
8
-
9
- 対象のページと利用するコンポーネントをユーザーに要求せよ。
10
-
11
- 得られた情報を次のYAMLのように整理し、スレッドに出力しユーザーの承認を待て。
12
- この情報整理をこなすのには`use_mcp_tool:frontend_env:get_coding_guidelines(html)`の知識が必要である。
13
-
14
- 例1:
15
-
16
- ```yaml
17
- pagePath: 000_home.pug
18
- pageType: c-page-home
19
- components:
20
- - c-header
21
- - c-hero
22
- - c-section01
23
- - c-section02
24
- - c-banners
25
- - c-footer
26
- ```
27
-
28
- 例2:
29
-
30
- ```yaml
31
- pageName: 100_sub.pug
32
- pageType: c-page-sub
33
- components:
34
- - c-header
35
- - c-page-title
36
- - c-content-main
37
- - c-banners
38
- - c-footer
39
- ```
40
-
41
- 承認を得たら次のステップに進め。
42
-
43
- # 3
44
-
45
- `list_files`で`__assets/htdocs/_libs/component/`にファイルが存在するか確認せよ。
46
- コンポーネントがない場合はタスクの一切を強制中止せよ。
47
- コンポーネントがすべて揃っていれば次のステップに進め。
48
-
49
- # 4
50
-
51
- 前ステップで得た情報を元に、以下のようなpugファイルを`write_to_file`せよ。
52
-
53
- ```pug
54
- html(lang="ja")
55
- head
56
- include /mixin/meta.pug
57
- +meta("__サイトタイトル__")
58
- body.c-page-home
59
- .c-page-home__base
60
- .c-page-home__header
61
- include /component/c-header.pug
62
- .c-page-home__hero
63
- include /component/c-hero.pug
64
- .c-page-home__section01
65
- include /component/c-section01.pug
66
- .c-page-home__section02
67
- include /component/c-section02.pug
68
- .c-page-home__banners
69
- include /component/c-banners.pug
70
- .c-page-home__footer
71
- include /component/c-footer.pug
72
- ```
73
-
74
- ```pug
75
- html(lang="ja")
76
- head
77
- include /mixin/meta.pug
78
- +meta("__サイトタイトル__")
79
- body.c-page-sub
80
- .c-page-sub__base
81
- .c-page-sub__header
82
- include /component/c-header.pug
83
- .c-page-sub__page-title
84
- include /component/c-page-title.pug
85
- .c-page-sub__content-main
86
- include /component/c-content-main.pug
87
- .c-page-sub__banners
88
- include /component/c-banners.pug
89
- .c-page-sub__footer
90
- include /component/c-footer.pug
91
- ```
92
-
93
- 既に同名のファイルが存在する場合は、**既存のコードは一切参考にせずすべて削除し**指示された構造をそのまま反映せよ。
94
- 作成したら、`__assets/htdocs/__tmpl/`に保存せよ。`__assets/htdocs/__tmpl/`の外に作ってはならない。
95
- パスはViteの機能に従い`/component/`で始めことができる。
96
- ファイルのナンバリングは重要である。
97
- 保存したら次のステップに進め。
98
-
99
- # 5
100
-
101
- `__assets/htdocs/_libs/component/`のコンポーネントと対になっているSASSファイルが同フォルダに存在するので、それを`__assets/htdocs/css/style.scss`に追記せよ。
102
- 保存したら次のステップに進め。
103
-
104
- # 6
105
-
106
- タスクは完了である。以下は不要。
107
-
108
- - ビルド
109
- - ブラウザチェック
110
- - テスト
@@ -1,68 +0,0 @@
1
- # 1
2
-
3
- URLをユーザーに尋ねて`execute_command:curl`を実行し構造を把握せよ。
4
- 文字コードがUTF-8でない場合は変換コマンドをパイプして構造を把握せよ。
5
- ページサイズが5MBを超えないのであれば`head`コマンド使わずに一度に取得せよ。
6
- 把握できたらステップ2に進め。
7
-
8
- # 2
9
-
10
- `browser_action`を実行しメインコンテンツのレイアウトと内容を視覚的に解析せよ。
11
- 画面固定されているバナーがあれば閉じよ。
12
- 予期せぬページ移動や画面遷移があれば直ちに停止しユーザーに指示を仰げ。
13
- 把握できたらステップ3に進め。
14
-
15
- # 3
16
-
17
- 取得したメインコンテンツの各ブロック(セクションではない)をレイアウトタイプと内容をMarkdown+frontmatter形式の単一のファイルに書き出せ。
18
- 保存先は`.cache`ディレクトリで、ブロックごとにファイルを分けること。
19
- ファイル名はURLとブロック名を組み合わせて、ブロックの順番に連番にせよ。
20
- 内容のフォーマットは次の通り。
21
-
22
- ```markdown
23
- ---
24
- url: https://example.com/path/to/page
25
- blockType: '{{block_type}}'
26
- ---
27
-
28
- {{section_content_body}}
29
- ```
30
-
31
- Frontmatterの情報は`url`と`blockType`の2つのみ。他の指定は禁止。
32
-
33
- ## block_type
34
-
35
- `use_mcp_tool:burger_editor:get_block_type`
36
-
37
- ## section_content_body
38
-
39
- - Markdown形式
40
- - 画像はURLをそのまま記載
41
- - 画像のalt属性は抽出する
42
- - 画像のキャプションはalt属性と明確に区別し抽出
43
- - layout_typeに基づくカラムの区切りは`<!-- column-separator -->\n---\n<!-- column-separator -->`で記載
44
- - Markdownで表現できない特性があれば`<!-- -->`の形式でコメントとして記載
45
- - 例:
46
- - `<!-- 見出しレベルは見た目と矛盾している -->`
47
- - `<!-- 画像はアニメーションGIF -->`
48
- - `<!-- iframeのURL -->`
49
- - `<!-- YouTubeのURL -->`
50
- - `<!-- Google MapsのURLもしくは緯度経度 -->`
51
- - カルーセルは画像をリストとして記載
52
-
53
- # 4
54
-
55
- 生成した各ファイルに対して次を実行せよ。
56
- `use_mcp_tool:burger_editor:get_block_data_params_v3`を実行し、`blockType`を`blockName`に渡して必要パラメータを取得せよ。
57
- 取得したパラメータを元に`use_mcp_tool:burger_editor:create_block_v3`を実行し、`blockName`を`data`に渡して、HTMLを取得せよ。
58
- 取得したHTMLを同名で拡張子を`.html`にして保存せよ。
59
-
60
- # 5
61
-
62
- 生成したHTMLを`execute_command:cat`で1つのファイルにまとめよ。
63
- 取得したURLと同様のパスとファイル名で`./htdocs`に保存せよ。
64
- URLが`https://example.com/path/to/page`であれば、保存先は`./htdocs/path/to/page.html`となる。
65
-
66
- # 6
67
-
68
- 完了
@@ -1,71 +0,0 @@
1
- import path from 'node:path';
2
-
3
- import eleventy from '@d-zero/builder/11ty';
4
-
5
- /**
6
- *
7
- * @param eleventyConfig
8
- */
9
- export default function (eleventyConfig) {
10
- return eleventy(eleventyConfig, {
11
- /**
12
- * Alias for the path to the directory containing the components.
13
- */
14
- alias: {
15
- '@': path.resolve(import.meta.dirname, '__assets', '_libs'),
16
- },
17
-
18
- /**
19
- * The directory where the source files are located.
20
- */
21
- // outDir: 'htdocs',
22
-
23
- /**
24
- * Prettier options.
25
- *
26
- * If `true`, use the prettier config in the project root.
27
- *
28
- * If `false`, disable prettier.
29
- *
30
- * If `object`, use the options. Merge with the prettier config in the project root.
31
- * @see https://prettier.io/docs/en/options
32
- */
33
- prettier: true,
34
-
35
- /**
36
- * Minifier options.
37
- * @see https://github.com/terser/html-minifier-terser?tab=readme-ov-file#options-quick-reference
38
- */
39
- // minifier: { minifyJS: false },
40
-
41
- /**
42
- * Line break.
43
- */
44
- // lineBreak: '\r\n',
45
-
46
- /**
47
- * Character encoding.
48
- */
49
- // charset: 'shift_jis',
50
-
51
- /**
52
- * Convert character entities
53
- */
54
- // characterEntities: true
55
-
56
- /**
57
- * Path format
58
- */
59
- // pathFormat: 'directory',
60
-
61
- /**
62
- * Automatically decode the content on the dev server.
63
- */
64
- // autoDecode: true,
65
-
66
- /**
67
- * Server Side Include options on the dev server.
68
- */
69
- // ssi: { '**/*': { encoding: 'shift_jis' } },
70
- });
71
- }