astro-dev-mcp 0.3.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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +425 -0
  3. package/dist/editors/commonEditor.d.ts +47 -0
  4. package/dist/editors/commonEditor.d.ts.map +1 -0
  5. package/dist/editors/commonEditor.js +108 -0
  6. package/dist/editors/commonEditor.js.map +1 -0
  7. package/dist/editors/scssVariablesEditor.d.ts +64 -0
  8. package/dist/editors/scssVariablesEditor.d.ts.map +1 -0
  9. package/dist/editors/scssVariablesEditor.js +105 -0
  10. package/dist/editors/scssVariablesEditor.js.map +1 -0
  11. package/dist/generators/astroGenerator.d.ts +15 -0
  12. package/dist/generators/astroGenerator.d.ts.map +1 -0
  13. package/dist/generators/astroGenerator.js +192 -0
  14. package/dist/generators/astroGenerator.js.map +1 -0
  15. package/dist/generators/scssGenerator.d.ts +15 -0
  16. package/dist/generators/scssGenerator.d.ts.map +1 -0
  17. package/dist/generators/scssGenerator.js +70 -0
  18. package/dist/generators/scssGenerator.js.map +1 -0
  19. package/dist/generators/typeGenerator.d.ts +5 -0
  20. package/dist/generators/typeGenerator.d.ts.map +1 -0
  21. package/dist/generators/typeGenerator.js +45 -0
  22. package/dist/generators/typeGenerator.js.map +1 -0
  23. package/dist/index.d.ts +3 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +285 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/parsers/excelParser.d.ts +5 -0
  28. package/dist/parsers/excelParser.d.ts.map +1 -0
  29. package/dist/parsers/excelParser.js +55 -0
  30. package/dist/parsers/excelParser.js.map +1 -0
  31. package/dist/parsers/markdownParser.d.ts +5 -0
  32. package/dist/parsers/markdownParser.d.ts.map +1 -0
  33. package/dist/parsers/markdownParser.js +69 -0
  34. package/dist/parsers/markdownParser.js.map +1 -0
  35. package/dist/templates/pageTemplates.d.ts +24 -0
  36. package/dist/templates/pageTemplates.d.ts.map +1 -0
  37. package/dist/templates/pageTemplates.js +69 -0
  38. package/dist/templates/pageTemplates.js.map +1 -0
  39. package/dist/templates/sectionTemplates.d.ts +14 -0
  40. package/dist/templates/sectionTemplates.d.ts.map +1 -0
  41. package/dist/templates/sectionTemplates.js +199 -0
  42. package/dist/templates/sectionTemplates.js.map +1 -0
  43. package/dist/templates/uiPatterns.d.ts +23 -0
  44. package/dist/templates/uiPatterns.d.ts.map +1 -0
  45. package/dist/templates/uiPatterns.js +330 -0
  46. package/dist/templates/uiPatterns.js.map +1 -0
  47. package/dist/tools/generateComponent.d.ts +10 -0
  48. package/dist/tools/generateComponent.d.ts.map +1 -0
  49. package/dist/tools/generateComponent.js +40 -0
  50. package/dist/tools/generateComponent.js.map +1 -0
  51. package/dist/tools/generatePage.d.ts +10 -0
  52. package/dist/tools/generatePage.d.ts.map +1 -0
  53. package/dist/tools/generatePage.js +95 -0
  54. package/dist/tools/generatePage.js.map +1 -0
  55. package/dist/tools/generateSchema.d.ts +10 -0
  56. package/dist/tools/generateSchema.d.ts.map +1 -0
  57. package/dist/tools/generateSchema.js +70 -0
  58. package/dist/tools/generateSchema.js.map +1 -0
  59. package/dist/tools/generateSection.d.ts +10 -0
  60. package/dist/tools/generateSection.d.ts.map +1 -0
  61. package/dist/tools/generateSection.js +50 -0
  62. package/dist/tools/generateSection.js.map +1 -0
  63. package/dist/utils/formatter.d.ts +6 -0
  64. package/dist/utils/formatter.d.ts.map +1 -0
  65. package/dist/utils/formatter.js +11 -0
  66. package/dist/utils/formatter.js.map +1 -0
  67. package/dist/utils/promptParser.d.ts +58 -0
  68. package/dist/utils/promptParser.d.ts.map +1 -0
  69. package/dist/utils/promptParser.js +200 -0
  70. package/dist/utils/promptParser.js.map +1 -0
  71. package/package.json +54 -0
@@ -0,0 +1,199 @@
1
+ import { generateUIPattern } from './uiPatterns.js';
2
+ /**
3
+ * セクションテンプレート生成
4
+ */
5
+ export function generateSectionTemplate(config) {
6
+ const { type, uiPattern, content, components } = config;
7
+ // UIパターンが指定されている場合は汎用ジェネレーターを使用
8
+ if (uiPattern) {
9
+ return generateUIPattern({
10
+ pattern: uiPattern,
11
+ data: content,
12
+ components,
13
+ options: extractUIOptions(content),
14
+ });
15
+ }
16
+ // 後方互換性: 従来の固定パターン
17
+ switch (type) {
18
+ case 'hero':
19
+ return generateHeroSection(content, components);
20
+ case 'articles':
21
+ return generateUIPattern({
22
+ pattern: 'grid',
23
+ data: content,
24
+ components,
25
+ options: extractUIOptions(content),
26
+ });
27
+ case 'categories':
28
+ return generateUIPattern({
29
+ pattern: 'tab',
30
+ data: content,
31
+ components,
32
+ options: extractUIOptions(content),
33
+ });
34
+ case 'qa':
35
+ return generateUIPattern({
36
+ pattern: 'accordion',
37
+ data: content,
38
+ components,
39
+ options: extractUIOptions(content),
40
+ });
41
+ case 'modal':
42
+ case 'gallery':
43
+ case 'videos':
44
+ return generateUIPattern({
45
+ pattern: 'modal',
46
+ data: content,
47
+ components,
48
+ options: extractUIOptions(content),
49
+ });
50
+ case 'features':
51
+ return generateFeaturesSection(content, components);
52
+ case 'tech':
53
+ return generateTechSection(content, components);
54
+ case 'concept':
55
+ return generateConceptSection(content, components);
56
+ default:
57
+ return generateCustomSection(type, content, components);
58
+ }
59
+ }
60
+ /**
61
+ * コンテンツからUIオプションを抽出
62
+ */
63
+ function extractUIOptions(content) {
64
+ return {
65
+ columns: content.columns || 3,
66
+ gap: content.gap || '2.4rem',
67
+ autoplay: content.autoplay || false,
68
+ openFirst: content.openFirst !== false,
69
+ hasImage: content.hasImage !== false,
70
+ };
71
+ }
72
+ function generateHeroSection(content, components) {
73
+ return `---
74
+ /**
75
+ * ヒーローセクションコンポーネント
76
+ */
77
+ interface Props {
78
+ hero: {
79
+ ttl: string;
80
+ subtitle?: string;
81
+ desc?: string;
82
+ };
83
+ }
84
+
85
+ const { hero } = Astro.props;
86
+ ---
87
+
88
+ <section class="hero_section">
89
+ <div class="hero_content">
90
+ <h1 class="hero_ttl" set:html={hero.ttl} />
91
+ {hero.subtitle && <p class="hero_subtitle" set:html={hero.subtitle} />}
92
+ {hero.desc && <p class="hero_desc" set:html={hero.desc} />}
93
+ </div>
94
+ </section>
95
+ `;
96
+ }
97
+ function generateFeaturesSection(content, components) {
98
+ return `---
99
+ /**
100
+ * 特徴セクションコンポーネント
101
+ */
102
+ interface Props {
103
+ features: {
104
+ ttl: string;
105
+ items: string[];
106
+ };
107
+ }
108
+
109
+ const { features } = Astro.props;
110
+ ---
111
+
112
+ <section class="features_section">
113
+ <h2 class="section_ttl" set:html={features.ttl} />
114
+ <ul class="feature_list">
115
+ {features.items.map((item) => (
116
+ <li class="feature_item" set:html={item} />
117
+ ))}
118
+ </ul>
119
+ </section>
120
+ `;
121
+ }
122
+ function generateTechSection(content, components) {
123
+ return `---
124
+ /**
125
+ * 技術スタックセクションコンポーネント
126
+ */
127
+ interface Props {
128
+ tech: {
129
+ ttl: string;
130
+ desc?: string;
131
+ items: {
132
+ name: string;
133
+ desc: string;
134
+ }[];
135
+ };
136
+ }
137
+
138
+ const { tech } = Astro.props;
139
+ ---
140
+
141
+ <section class="tech_section">
142
+ <h2 class="section_ttl" set:html={tech.ttl} />
143
+ {tech.desc && <p class="section_desc" set:html={tech.desc} />}
144
+ <ul class="tech_list">
145
+ {
146
+ tech.items.map((item) => (
147
+ <li class="tech_item">
148
+ <h3 class="tech_name">{item.name}</h3>
149
+ <p class="tech_desc" set:html={item.desc} />
150
+ </li>
151
+ ))
152
+ }
153
+ </ul>
154
+ </section>
155
+ `;
156
+ }
157
+ function generateConceptSection(content, components) {
158
+ return `---
159
+ /**
160
+ * コンセプトセクションコンポーネント
161
+ */
162
+ interface Props {
163
+ concept: {
164
+ ttl: string;
165
+ desc: string;
166
+ };
167
+ }
168
+
169
+ const { concept } = Astro.props;
170
+ ---
171
+
172
+ <section class="concept_section">
173
+ <h2 class="section_ttl" set:html={concept.ttl} />
174
+ <p class="section_desc" set:html={concept.desc} />
175
+ </section>
176
+ `;
177
+ }
178
+ function generateCustomSection(type, content, components) {
179
+ return `---
180
+ /**
181
+ * ${type} セクションコンポーネント
182
+ */
183
+ interface Props {
184
+ ${type}: {
185
+ ttl: string;
186
+ items?: any[];
187
+ };
188
+ }
189
+
190
+ const { ${type} } = Astro.props;
191
+ ---
192
+
193
+ <section class="${type}_section">
194
+ <h2 class="section_ttl" set:html={${type}.ttl} />
195
+ {/* カスタムコンテンツをここに追加 */}
196
+ </section>
197
+ `;
198
+ }
199
+ //# sourceMappingURL=sectionTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sectionTemplates.js","sourceRoot":"","sources":["../../src/templates/sectionTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,iBAAiB,CAAC;AAUpE;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAqB;IAC5D,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAExD,gCAAgC;IAChC,IAAI,SAAS,EAAE,CAAC;QACf,OAAO,iBAAiB,CAAC;YACxB,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,OAAO;YACb,UAAU;YACV,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;SAClC,CAAC,CAAC;IACJ,CAAC;IAED,mBAAmB;IACnB,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,MAAM;YACV,OAAO,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACjD,KAAK,UAAU;YACd,OAAO,iBAAiB,CAAC;gBACxB,OAAO,EAAE,MAAM;gBACf,IAAI,EAAE,OAAO;gBACb,UAAU;gBACV,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC;aAClC,CAAC,CAAC;QACJ,KAAK,YAAY;YAChB,OAAO,iBAAiB,CAAC;gBACxB,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,OAAO;gBACb,UAAU;gBACV,OAAO,EAAE,gBAAgB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OAAO;;;;;;;;;;;;;;;;;;;;;;CAsBP,CAAC;AACF,CAAC;AAED,SAAS,mBAAmB,CAC3B,OAA4B,EAC5B,UAAoB;IAEpB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCP,CAAC;AACF,CAAC;AAED,SAAS,sBAAsB,CAC9B,OAA4B,EAC5B,UAAoB;IAEpB,OAAO;;;;;;;;;;;;;;;;;;CAkBP,CAAC;AACF,CAAC;AAED,SAAS,qBAAqB,CAC7B,IAAY,EACZ,OAA4B,EAC5B,UAAoB;IAEpB,OAAO;;KAEH,IAAI;;;GAGN,IAAI;;;;;;UAMG,IAAI;;;kBAGI,IAAI;qCACe,IAAI;;;CAGxC,CAAC;AACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * UIパターン汎用ジェネレーター
3
+ * コンテンツデータとUIパターンを受け取り、適切なマークアップを生成
4
+ */
5
+ export type UIPattern = 'tab' | 'accordion' | 'grid' | 'carousel' | 'list' | 'modal';
6
+ export interface UIPatternConfig {
7
+ pattern: UIPattern;
8
+ data: Record<string, any>;
9
+ components?: string[];
10
+ options?: {
11
+ columns?: number;
12
+ gap?: string;
13
+ autoplay?: boolean;
14
+ openFirst?: boolean;
15
+ hasImage?: boolean;
16
+ hasPicture?: boolean;
17
+ };
18
+ }
19
+ /**
20
+ * UIパターンに基づいてマークアップを生成
21
+ */
22
+ export declare function generateUIPattern(config: UIPatternConfig): string;
23
+ //# sourceMappingURL=uiPatterns.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uiPatterns.d.ts","sourceRoot":"","sources":["../../src/templates/uiPatterns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,SAAS,GAClB,KAAK,GACL,WAAW,GACX,MAAM,GACN,UAAU,GACV,MAAM,GACN,OAAO,CAAC;AAEX,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,SAAS,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,UAAU,CAAC,EAAE,OAAO,CAAC;KACrB,CAAC;CACF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAiBjE"}
@@ -0,0 +1,330 @@
1
+ /**
2
+ * UIパターン汎用ジェネレーター
3
+ * コンテンツデータとUIパターンを受け取り、適切なマークアップを生成
4
+ */
5
+ /**
6
+ * UIパターンに基づいてマークアップを生成
7
+ */
8
+ export function generateUIPattern(config) {
9
+ switch (config.pattern) {
10
+ case 'tab':
11
+ return generateTabUI(config);
12
+ case 'accordion':
13
+ return generateAccordionUI(config);
14
+ case 'grid':
15
+ return generateGridUI(config);
16
+ case 'carousel':
17
+ return generateCarouselUI(config);
18
+ case 'list':
19
+ return generateListUI(config);
20
+ case 'modal':
21
+ return generateModalUI(config);
22
+ default:
23
+ throw new Error(`Unknown UI pattern: ${config.pattern}`);
24
+ }
25
+ }
26
+ /**
27
+ * タブUI生成(開発環境のTab.ts連携)
28
+ */
29
+ function generateTabUI(config) {
30
+ const { data } = config;
31
+ return `---
32
+ interface Props {
33
+ data: {
34
+ ttl: string;
35
+ items: {
36
+ name: string;
37
+ content: any;
38
+ }[];
39
+ };
40
+ }
41
+
42
+ const { data } = Astro.props;
43
+ ---
44
+
45
+ <section class="c_tab">
46
+ <h2 class="section_ttl">{data.ttl}</h2>
47
+ <ul class="c_tab_list">
48
+ {
49
+ data.items.map((item, i) => (
50
+ <li>
51
+ <button
52
+ type="button"
53
+ class={i === 0 ? "-open" : ""}
54
+ aria-pressed={i === 0 ? "true" : "false"}
55
+ tabindex={i === 0 ? "-1" : "0"}
56
+ >
57
+ {item.name}
58
+ </button>
59
+ </li>
60
+ ))
61
+ }
62
+ </ul>
63
+ {
64
+ data.items.map((item, i) => (
65
+ <div
66
+ class="c_tab_content"
67
+ hidden={i !== 0}
68
+ tabindex="-1"
69
+ >
70
+ <!-- コンテンツはプロジェクト固有で実装 -->
71
+ {item.content}
72
+ </div>
73
+ ))
74
+ }
75
+ </section>
76
+ `;
77
+ }
78
+ /**
79
+ * アコーディオンUI生成(開発環境のAccordion.ts連携)
80
+ */
81
+ function generateAccordionUI(config) {
82
+ const { data, options = {} } = config;
83
+ const { openFirst = true } = options;
84
+ return `---
85
+ interface Props {
86
+ data: {
87
+ ttl: string;
88
+ items: {
89
+ ttl: string;
90
+ content: string;
91
+ }[];
92
+ };
93
+ }
94
+
95
+ const { data } = Astro.props;
96
+ ---
97
+
98
+ <section class="accordion_section">
99
+ <h2 class="section_ttl">{data.ttl}</h2>
100
+ <div class="accordion_list">
101
+ {
102
+ data.items.map((item, i) => (
103
+ <details
104
+ class={"c_pull accordion_item" + (${openFirst} && i === 0 ? " -open" : "")}
105
+ open={${openFirst} && i === 0}
106
+ >
107
+ <summary class="c_pull_ttl accordion_item_ttl">
108
+ <span class="accordion_item_ttl_text">{item.ttl}</span>
109
+ </summary>
110
+ <div class="c_pull_content accordion_item_content">
111
+ <div class="accordion_item_content_text" set:html={item.content} />
112
+ </div>
113
+ </details>
114
+ ))
115
+ }
116
+ </div>
117
+ </section>
118
+ `;
119
+ }
120
+ /**
121
+ * グリッドUI生成
122
+ */
123
+ function generateGridUI(config) {
124
+ const { data, options = {}, components = [] } = config;
125
+ const { columns = 3, gap = '2.4rem', hasImage = true } = options;
126
+ const hasPicture = components.includes('Picture');
127
+ return `---
128
+ ${hasPicture ? 'import Picture from "@/components/Picture.astro";' : ''}
129
+
130
+ interface Props {
131
+ data: {
132
+ ttl: string;
133
+ items: {
134
+ ttl: string;
135
+ desc?: string;
136
+ ${hasImage ? 'img?: string;' : ''}
137
+ link?: string;
138
+ }[];
139
+ };
140
+ imgPath?: string;
141
+ }
142
+
143
+ const { data, imgPath = '' } = Astro.props;
144
+ ---
145
+
146
+ <section class="grid_section">
147
+ <h2 class="section_ttl">{data.ttl}</h2>
148
+ <ul class="grid_list" style="display: grid; grid-template-columns: repeat(${columns}, 1fr); gap: ${gap};">
149
+ {
150
+ data.items.map((item) => (
151
+ <li class="grid_item">
152
+ ${hasImage
153
+ ? `
154
+ {item.img && (
155
+ <div class="grid_item_img">
156
+ ${hasPicture ? '<Picture src={imgPath + item.img} alt={item.ttl} sizes={[400, 300]} />' : '<img src={imgPath + item.img} alt={item.ttl} loading="lazy" />'}
157
+ </div>
158
+ )}
159
+ `
160
+ : ''}
161
+ <div class="grid_item_body">
162
+ <h3 class="grid_item_ttl">{item.ttl}</h3>
163
+ {item.desc && <p class="grid_item_desc">{item.desc}</p>}
164
+ </div>
165
+ </li>
166
+ ))
167
+ }
168
+ </ul>
169
+ </section>
170
+ `;
171
+ }
172
+ /**
173
+ * カルーセルUI生成
174
+ */
175
+ function generateCarouselUI(config) {
176
+ const { data, options = {}, components = [] } = config;
177
+ const { autoplay = false } = options;
178
+ const hasPicture = components.includes('Picture');
179
+ return `---
180
+ ${hasPicture ? 'import Picture from "@/components/Picture.astro";' : ''}
181
+
182
+ /**
183
+ * カルーセルセクション
184
+ * Swiper.js等のライブラリと組み合わせて使用
185
+ */
186
+ interface Props {
187
+ data: {
188
+ ttl: string;
189
+ items: {
190
+ ttl: string;
191
+ desc?: string;
192
+ img?: string;
193
+ }[];
194
+ };
195
+ imgPath?: string;
196
+ }
197
+
198
+ const { data, imgPath = '' } = Astro.props;
199
+ ---
200
+
201
+ <section class="carousel_section">
202
+ <h2 class="section_ttl">{data.ttl}</h2>
203
+ <div class="swiper carousel_swiper" data-autoplay="${autoplay}">
204
+ <div class="swiper-wrapper">
205
+ {
206
+ data.items.map((item) => (
207
+ <div class="swiper-slide carousel_item">
208
+ {item.img && (
209
+ <div class="carousel_item_img">
210
+ ${hasPicture ? '<Picture src={imgPath + item.img} alt={item.ttl} sizes={[800, 600]} />' : '<img src={imgPath + item.img} alt={item.ttl} loading="lazy" />'}
211
+ </div>
212
+ )}
213
+ <div class="carousel_item_body">
214
+ <h3 class="carousel_item_ttl">{item.ttl}</h3>
215
+ {item.desc && <p class="carousel_item_desc">{item.desc}</p>}
216
+ </div>
217
+ </div>
218
+ ))
219
+ }
220
+ </div>
221
+ <div class="swiper-pagination"></div>
222
+ <div class="swiper-button-prev"></div>
223
+ <div class="swiper-button-next"></div>
224
+ </div>
225
+ </section>
226
+ `;
227
+ }
228
+ /**
229
+ * リストUI生成
230
+ */
231
+ function generateListUI(config) {
232
+ const { data } = config;
233
+ return `---
234
+ interface Props {
235
+ data: {
236
+ ttl: string;
237
+ items: {
238
+ ttl: string;
239
+ desc?: string;
240
+ }[];
241
+ };
242
+ }
243
+
244
+ const { data } = Astro.props;
245
+ ---
246
+
247
+ <section class="list_section">
248
+ <h2 class="section_ttl">{data.ttl}</h2>
249
+ <ul class="list">
250
+ {
251
+ data.items.map((item) => (
252
+ <li class="list_item">
253
+ <h3 class="list_item_ttl">{item.ttl}</h3>
254
+ {item.desc && <p class="list_item_desc">{item.desc}</p>}
255
+ </li>
256
+ ))
257
+ }
258
+ </ul>
259
+ </section>
260
+ `;
261
+ }
262
+ /**
263
+ * モーダルUI生成(開発環境のModal.ts連携)
264
+ */
265
+ function generateModalUI(config) {
266
+ const { data, components = [] } = config;
267
+ const hasPicture = components.includes('Picture');
268
+ return `---
269
+ ${hasPicture ? 'import Picture from "@/components/Picture.astro";' : ''}
270
+
271
+ /**
272
+ * モーダルギャラリーセクション
273
+ * Modal.ts と連携(動画/画像/カスタムdialog対応)
274
+ */
275
+ interface Props {
276
+ data: {
277
+ ttl: string;
278
+ items: {
279
+ ttl: string;
280
+ desc?: string;
281
+ thumbnail?: string;
282
+ src: string;
283
+ alt?: string;
284
+ type?: 'video' | 'image' | 'dialog';
285
+ }[];
286
+ };
287
+ imgPath?: string;
288
+ }
289
+
290
+ const { data, imgPath = '' } = Astro.props;
291
+ ---
292
+
293
+ <section class="modal_section">
294
+ <h2 class="section_ttl">{data.ttl}</h2>
295
+ <ul class="modal_list">
296
+ {
297
+ data.items.map((item) => (
298
+ <li class="modal_item">
299
+ <button
300
+ type="button"
301
+ class="c_modal_btn modal_card"
302
+ data-src={item.src}
303
+ data-alt={item.alt}
304
+ >
305
+ {item.thumbnail && (
306
+ <span class="modal_thumbnail">
307
+ ${hasPicture ? '<Picture src={imgPath + item.thumbnail} alt={item.alt || item.ttl} sizes={[800, 450]} />' : '<img src={imgPath + item.thumbnail} alt={item.alt || item.ttl} loading="lazy" />'}
308
+ {item.type === 'video' && (
309
+ <span class="modal_play_icon">
310
+ <svg width="60" height="60" viewBox="0 0 60 60" fill="none" xmlns="http://www.w3.org/2000/svg">
311
+ <circle cx="30" cy="30" r="30" fill="white" opacity="0.9" />
312
+ <path d="M24 18L42 30L24 42V18Z" fill="#667eea" />
313
+ </svg>
314
+ </span>
315
+ )}
316
+ </span>
317
+ )}
318
+ <span class="modal_body">
319
+ <h3 class="modal_ttl">{item.ttl}</h3>
320
+ {item.desc && <p class="modal_desc">{item.desc}</p>}
321
+ </span>
322
+ </button>
323
+ </li>
324
+ ))
325
+ }
326
+ </ul>
327
+ </section>
328
+ `;
329
+ }
330
+ //# sourceMappingURL=uiPatterns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uiPatterns.js","sourceRoot":"","sources":["../../src/templates/uiPatterns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAuB;IACxD,QAAQ,MAAM,CAAC,OAAO,EAAE,CAAC;QACxB,KAAK,KAAK;YACT,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;QAC9B,KAAK,WAAW;YACf,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;QACpC,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0FAA0F,CAAC,CAAC,CAAC,kFAAkF;;;;;;;;;;;;;;;;;;;;;CAqBrM,CAAC;AACF,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Astroコンポーネント生成ツール
3
+ */
4
+ export declare function generateComponent(args: any): Promise<{
5
+ content: {
6
+ type: string;
7
+ text: string;
8
+ }[];
9
+ }>;
10
+ //# sourceMappingURL=generateComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateComponent.d.ts","sourceRoot":"","sources":["../../src/tools/generateComponent.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,GAAG;;;;;GAqChD"}
@@ -0,0 +1,40 @@
1
+ import { generateAstroComponent } from "../generators/astroGenerator.js";
2
+ import { generateScss } from "../generators/scssGenerator.js";
3
+ import { formatCode } from "../utils/formatter.js";
4
+ /**
5
+ * Astroコンポーネント生成ツール
6
+ */
7
+ export async function generateComponent(args) {
8
+ const { componentName, props, design = {}, accessibility = true, } = args;
9
+ try {
10
+ // 1. Astroコンポーネント生成
11
+ const astroCode = await generateAstroComponent({
12
+ name: componentName,
13
+ props,
14
+ accessibility,
15
+ });
16
+ // 2. SCSS生成
17
+ const scssCode = await generateScss({
18
+ name: componentName,
19
+ design,
20
+ });
21
+ // 3. コード整形
22
+ const formattedAstro = await formatCode(astroCode, "astro");
23
+ const formattedScss = await formatCode(scssCode, "scss");
24
+ return {
25
+ content: [
26
+ {
27
+ type: "text",
28
+ text: `✅ コンポーネント「${componentName}」を生成しました\n\n## Astroコンポーネント\n\`\`\`astro\n${formattedAstro}\n\`\`\`\n\n## SCSS\n\`\`\`scss\n${formattedScss}\n\`\`\`\n\n### 配置先\n- \`src/components/${componentName}.astro\`\n- \`src/scss/components/_c_${toSnakeCase(componentName)}.scss\``,
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ catch (error) {
34
+ throw new Error(`コンポーネント生成エラー: ${error}`);
35
+ }
36
+ }
37
+ function toSnakeCase(str) {
38
+ return str.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
39
+ }
40
+ //# sourceMappingURL=generateComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generateComponent.js","sourceRoot":"","sources":["../../src/tools/generateComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAanD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAS;IAC/C,MAAM,EACJ,aAAa,EACb,KAAK,EACL,MAAM,GAAG,EAAE,EACX,aAAa,GAAG,IAAI,GACrB,GAAG,IAAqB,CAAC;IAE1B,IAAI,CAAC;QACH,oBAAoB;QACpB,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC;YAC7C,IAAI,EAAE,aAAa;YACnB,KAAK;YACL,aAAa;SACd,CAAC,CAAC;QAEH,YAAY;QACZ,MAAM,QAAQ,GAAG,MAAM,YAAY,CAAC;YAClC,IAAI,EAAE,aAAa;YACnB,MAAM;SACP,CAAC,CAAC;QAEH,WAAW;QACX,MAAM,cAAc,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,aAAa,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAEzD,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,aAAa,aAAa,6CAA6C,cAAc,oCAAoC,aAAa,2CAA2C,aAAa,wCAAwC,WAAW,CAAC,aAAa,CAAC,SAAS;iBAChR;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,EAAE,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * ページ生成ツール(サイト設定更新統合版)
3
+ */
4
+ export declare function generatePage(args: any): Promise<{
5
+ content: {
6
+ type: string;
7
+ text: string;
8
+ }[];
9
+ }>;
10
+ //# sourceMappingURL=generatePage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generatePage.d.ts","sourceRoot":"","sources":["../../src/tools/generatePage.ts"],"names":[],"mappings":"AAuCA;;GAEG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,GAAG;;;;;GAiH3C"}