@stacksjs/stx 0.2.301 → 0.2.302

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.
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{wv as Y}from"./chunk-ddqkj56r.js";import{mkdir as O,writeFile as q}from"fs/promises";import{join as X}from"path";var T="https://api.iconify.design";async function k(){let E=await fetch(`${T}/collections`);if(!E.ok)throw Error(`Failed to fetch collections: ${E.statusText}`);return await E.json()}async function P(E,z){try{let U=Y.resolve("@iconify/json"),S=`${`${U.substring(0,U.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${E}.json`,M=Bun.file(S);if(await M.exists()){let V=await M.json();if(z&&z.length>0){let Z={};for(let L of z)if(V.icons[L])Z[L]=V.icons[L];return{...V,icons:Z}}return V}}catch{}let K=z&&z.length>0?`${T}/${E}.json?icons=${z.join(",")}`:`${T}/${E}.json`,Q=await fetch(K);if(!Q.ok)throw Error(`Failed to fetch icons for ${E}: ${Q.statusText}`);return await Q.json()}function j(E,z=24,K=24){return{body:E.body,width:E.width||z,height:E.height||K,viewBox:`0 0 ${E.width||z} ${E.height||K}`}}function F(E,z){let K=B(E);return`import type { IconData } from '@stacksjs/iconify-core'
2
+ import{wv as O}from"./chunk-ddqkj56r.js";import{mkdir as b,writeFile as T}from"fs/promises";import{join as q}from"path";var E="https://api.iconify.design";async function k(){let G=await fetch(`${E}/collections`);if(!G.ok)throw Error(`Failed to fetch collections: ${G.statusText}`);return await G.json()}async function P(G,z){try{let Z=O.resolve("@iconify/json"),X=`${`${Z.substring(0,Z.lastIndexOf("/node_modules/@iconify/json/"))}/node_modules/@iconify/json`}/json/${G}.json`,Q=Bun.file(X);if(await Q.exists()){let $=await Q.json();if(z&&z.length>0){let B={};for(let S of z)if($.icons[S])B[S]=$.icons[S];return{...$,icons:B}}return $}}catch{}let M=z&&z.length>0?`${E}/${G}.json?icons=${z.join(",")}`:`${E}/${G}.json`,U=await fetch(M);if(!U.ok)throw Error(`Failed to fetch icons for ${G}: ${U.statusText}`);return await U.json()}function j(G,z=24,M=24){return{body:G.body,width:G.width||z,height:G.height||M,viewBox:`0 0 ${G.width||z} ${G.height||M}`}}function F(G,z){let M=V(G);return`import type { IconData } from '@stacksjs/iconify-core'
3
3
 
4
- export const ${K}: IconData = ${JSON.stringify(z,null,2)}
4
+ export const ${M}: IconData = ${JSON.stringify(z,null,2)}
5
5
 
6
- export default ${K}
7
- `}function h(E,z){return`<script>
6
+ export default ${M}
7
+ `}function h(G,z){return`<script>
8
8
  // Get props with defaults (handle undefined)
9
9
  const iconWidth = (typeof width !== 'undefined' ? width : null) || (typeof size !== 'undefined' ? size : null) || ${z.width||24}
10
10
  const iconHeight = (typeof height !== 'undefined' ? height : null) || (typeof size !== 'undefined' ? size : null) || ${z.height||24}
@@ -43,17 +43,17 @@ const svg = \`<svg xmlns="http://www.w3.org/2000/svg" width="\${iconWidth}" heig
43
43
  </script>
44
44
 
45
45
  {!! svg !!}
46
- `}function g(E){let z=new Set;return`// Icon data exports
47
- ${E.map((Q)=>{let G=B(Q);if(z.has(G)){let S=Q.replace(/[^a-zA-Z0-9]/g,"_");if(/^[0-9]/.test(S))S=`_${S}`;G=S;let M=2;while(z.has(G))G=`${S}_${M}`,M++}return z.add(G),`export { default as ${G} } from './${Q}.js'`}).join(`
46
+ `}function g(G){let z=new Set;return`// Icon data exports
47
+ ${G.map((U)=>{let K=V(U);if(z.has(K)){let X=U.replace(/[^a-zA-Z0-9]/g,"_");if(/^[0-9]/.test(X))X=`_${X}`;K=X;let Q=2;while(z.has(K))K=`${X}_${Q}`,Q++}return z.add(K),`export { default as ${K} } from './${U}.js'`}).join(`
48
48
  `)}
49
49
 
50
50
  export * from './types.js'
51
- `}function u(E){return`import type { IconData, IconProps } from '@stacksjs/iconify-core'
51
+ `}function u(G){return`import type { IconData, IconProps } from '@stacksjs/iconify-core'
52
52
 
53
53
  export type { IconData, IconProps }
54
54
 
55
- export type ${I(E)}Icon = IconData
56
- `}function N(E,z,K){let Q={name:`@stacksjs/iconify-${E}`,type:"module",version:"0.0.1",description:`${z.name} icons for stx from Iconify`,author:z.author?.name||"Iconify",license:z.license?.spdx||"MIT",repository:{type:"git",url:"https://github.com/stacksjs/stx.git",directory:`packages/iconify-${E}`},keywords:["iconify","icons","svg",E,z.name,"stx"],sideEffects:!1,exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./*":"./dist/*"},main:"./dist/index.js",module:"./dist/index.js",types:"./dist/index.d.ts",files:["dist"],scripts:{build:"bun build.ts",prepublishOnly:"bun build.ts"},dependencies:{"@stacksjs/iconify-core":"workspace:*"}};return JSON.stringify(Q,null,2)}function D(E){return`import { existsSync, readdirSync, statSync } from 'node:fs'
55
+ export type ${x(G)}Icon = IconData
56
+ `}function N(G,z,M){let U={name:`@stacksjs/iconify-${G}`,type:"module",version:"0.0.1",description:`${z.name} icons for stx from Iconify`,author:z.author?.name||"Iconify",license:z.license?.spdx||"MIT",repository:{type:"git",url:"https://github.com/stacksjs/stx.git",directory:`packages/iconify-${G}`},keywords:["iconify","icons","svg",G,z.name,"stx"],sideEffects:!1,exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js"},"./*":"./dist/*"},main:"./dist/index.js",module:"./dist/index.js",types:"./dist/index.d.ts",files:["dist"],scripts:{build:"bun build.ts",prepublishOnly:"bun build.ts"},dependencies:{"@stacksjs/iconify-core":"workspace:*"}};return JSON.stringify(U,null,2)}function D(G){return`import { existsSync, readdirSync, statSync } from 'node:fs'
57
57
  import { dirname, join } from 'node:path'
58
58
  import { fileURLToPath } from 'node:url'
59
59
  import dts from 'bun-plugin-dtsx'
@@ -88,7 +88,7 @@ function isDistFresh() {
88
88
  }
89
89
 
90
90
  if (isDistFresh()) {
91
- console.log('\u2713 @stacksjs/iconify-${E} dist is fresh, skipping rebuild')
91
+ console.log('\u2713 @stacksjs/iconify-${G} dist is fresh, skipping rebuild')
92
92
  } else {
93
93
  await Bun.build({
94
94
  entrypoints: [join(srcDir, 'index.ts')],
@@ -100,16 +100,16 @@ if (isDistFresh()) {
100
100
  sourcemap: 'external',
101
101
  splitting: true,
102
102
  })
103
- console.log('\u2713 Built @stacksjs/iconify-${E}')
103
+ console.log('\u2713 Built @stacksjs/iconify-${G}')
104
104
  }
105
- `}function d(E,z,K){return`# @stacksjs/iconify-${E}
105
+ `}function d(G,z,M){return`# @stacksjs/iconify-${G}
106
106
 
107
107
  ${z.name} icons for stx from Iconify.
108
108
 
109
109
  ## Installation
110
110
 
111
111
  \`\`\`bash
112
- bun add @stacksjs/iconify-${E}
112
+ bun add @stacksjs/iconify-${G}
113
113
  \`\`\`
114
114
 
115
115
  ## Usage
@@ -118,7 +118,7 @@ bun add @stacksjs/iconify-${E}
118
118
 
119
119
  \`\`\`html
120
120
  <script>
121
- import { home } from '@stacksjs/iconify-${E}'
121
+ import { home } from '@stacksjs/iconify-${G}'
122
122
  import { renderIcon } from '@stacksjs/iconify-core'
123
123
 
124
124
  export const homeIcon = renderIcon(home, { size: 24, color: 'currentColor' })
@@ -132,7 +132,7 @@ bun add @stacksjs/iconify-${E}
132
132
  ### In TypeScript/JavaScript
133
133
 
134
134
  \`\`\`typescript
135
- import { home, account, settings } from '@stacksjs/iconify-${E}'
135
+ import { home, account, settings } from '@stacksjs/iconify-${G}'
136
136
  import { renderIcon } from '@stacksjs/iconify-core'
137
137
 
138
138
  const svg = renderIcon(home, {
@@ -143,7 +143,7 @@ const svg = renderIcon(home, {
143
143
 
144
144
  ## Available Icons
145
145
 
146
- This package contains ${K} icons from ${z.name}.
146
+ This package contains ${M} icons from ${z.name}.
147
147
 
148
148
  ## License
149
149
 
@@ -155,17 +155,17 @@ ${z.license?.url?`License: ${z.license.url}`:""}
155
155
 
156
156
  - Icons: ${z.author?.name||"Iconify"}${z.author?.url?` (${z.author.url})`:""}
157
157
  - Iconify: https://iconify.design/
158
- `}function C(E,z,K){let Q=K.length,U=K.slice(0,5).map(B),G=U.map((M)=>`${M.charAt(0).toUpperCase()}${M.slice(1)}Icon`),S=K.map((M)=>{return`- \`${B(M)}\``}).join(`
158
+ `}function C(G,z,M){let U=M.length,Z=M.slice(0,5).map(V),K=Z.map((Q)=>`${Q.charAt(0).toUpperCase()}${Q.slice(1)}Icon`),X=M.map((Q)=>{return`- \`${V(Q)}\``}).join(`
159
159
  `);return`# ${z.name}
160
160
 
161
161
  > ${z.name} icons for stx from Iconify
162
162
 
163
163
  ## Overview
164
164
 
165
- This package provides access to ${Q} icons from the ${z.name} collection through the stx iconify integration.
165
+ This package provides access to ${U} icons from the ${z.name} collection through the stx iconify integration.
166
166
 
167
- **Collection ID:** \`${E}\`
168
- **Total Icons:** ${Q}
167
+ **Collection ID:** \`${G}\`
168
+ **Total Icons:** ${U}
169
169
  ${z.author?.name?`**Author:** ${z.author.name}${z.author.url?` ([Website](${z.author.url}))`:""}`:""}
170
170
  ${z.license?.title?`**License:** ${z.license.title}${z.license.url?` ([Details](${z.license.url}))`:""}`:""}
171
171
  ${z.category?`**Category:** ${z.category}`:""}
@@ -174,7 +174,7 @@ ${z.palette!==void 0?`**Palette:** ${z.palette?"Yes (color icons)":"No (monotone
174
174
  ## Installation
175
175
 
176
176
  \`\`\`bash
177
- bun add @stacksjs/iconify-${E}
177
+ bun add @stacksjs/iconify-${G}
178
178
  \`\`\`
179
179
 
180
180
  ## Quick Start
@@ -184,30 +184,30 @@ bun add @stacksjs/iconify-${E}
184
184
  Icons are available as .stx components that can be used directly in templates:
185
185
 
186
186
  \`\`\`html
187
- <${G[0]||"Icon"} height="1em" />
188
- <${G[0]||"Icon"} width="1em" height="1em" />
189
- <${G[0]||"Icon"} height="24" />
187
+ <${K[0]||"Icon"} height="1em" />
188
+ <${K[0]||"Icon"} width="1em" height="1em" />
189
+ <${K[0]||"Icon"} height="24" />
190
190
  \`\`\`
191
191
 
192
192
  ### With Properties
193
193
 
194
194
  \`\`\`html
195
195
  <!-- Using size property -->
196
- <${G[0]||"Icon"} size="24" />
197
- <${G[0]||"Icon"} size="1em" />
196
+ <${K[0]||"Icon"} size="24" />
197
+ <${K[0]||"Icon"} size="1em" />
198
198
 
199
199
  <!-- Using width and height -->
200
- <${G[0]||"Icon"} width="24" height="32" />
200
+ <${K[0]||"Icon"} width="24" height="32" />
201
201
 
202
202
  <!-- With color -->
203
- <${G[0]||"Icon"} size="24" color="red" />
204
- <${G[0]||"Icon"} size="24" color="#4a90e2" />
203
+ <${K[0]||"Icon"} size="24" color="red" />
204
+ <${K[0]||"Icon"} size="24" color="#4a90e2" />
205
205
 
206
206
  <!-- With CSS class -->
207
- <${G[0]||"Icon"} size="24" class="icon-primary" />
207
+ <${K[0]||"Icon"} size="24" class="icon-primary" />
208
208
 
209
209
  <!-- With all properties -->
210
- <${G[0]||"Icon"}
210
+ <${K[0]||"Icon"}
211
211
  size="32"
212
212
  color="#4a90e2"
213
213
  class="my-icon"
@@ -232,9 +232,9 @@ Icons are available as .stx components that can be used directly in templates:
232
232
  </head>
233
233
  <body>
234
234
  <div class="icon-grid">
235
- <${G[0]||"Icon"} size="24" />
236
- <${G[1]||"Icon"} size="24" color="#4a90e2" />
237
- <${G[2]||"Icon"} size="32" class="my-icon" />
235
+ <${K[0]||"Icon"} size="24" />
236
+ <${K[1]||"Icon"} size="24" color="#4a90e2" />
237
+ <${K[2]||"Icon"} size="32" class="my-icon" />
238
238
  </div>
239
239
  </body>
240
240
  </html>
@@ -245,10 +245,10 @@ Icons are available as .stx components that can be used directly in templates:
245
245
  You can also import icon data and use the \`renderIcon\` function directly:
246
246
 
247
247
  \`\`\`typescript
248
- import { ${U.slice(0,3).join(", ")} } from '@stacksjs/iconify-${E}'
248
+ import { ${Z.slice(0,3).join(", ")} } from '@stacksjs/iconify-${G}'
249
249
  import { renderIcon } from '@stacksjs/iconify-core'
250
250
 
251
- const svg = renderIcon(${U[0]||"icon"}, { size: 24 })
251
+ const svg = renderIcon(${Z[0]||"icon"}, { size: 24 })
252
252
  \`\`\`
253
253
 
254
254
  ## Icon Properties
@@ -275,14 +275,14 @@ This collection contains color icons. While you can still set a color property,
275
275
 
276
276
  \`\`\`html
277
277
  <!-- Via color property -->
278
- <${G[0]||"Icon"} size="24" color="red" />
279
- <${G[0]||"Icon"} size="24" color="#4a90e2" />
278
+ <${K[0]||"Icon"} size="24" color="red" />
279
+ <${K[0]||"Icon"} size="24" color="#4a90e2" />
280
280
 
281
281
  <!-- Via inline style -->
282
- <${G[0]||"Icon"} size="24" style="color: green;" />
282
+ <${K[0]||"Icon"} size="24" style="color: green;" />
283
283
 
284
284
  <!-- Via CSS class -->
285
- <${G[0]||"Icon"} size="24" class="text-primary" />
285
+ <${K[0]||"Icon"} size="24" class="text-primary" />
286
286
  \`\`\`
287
287
 
288
288
  ${!z.palette?`\`\`\`css
@@ -321,16 +321,16 @@ You do not need to set both properties. If you set one property, the other prope
321
321
  **Examples:**
322
322
 
323
323
  \`\`\`html
324
- <${G[0]||"DraftsIcon"} height="1em" />
325
- <${G[0]||"DraftsIcon"} width="1em" height="1em" />
326
- <${G[0]||"DraftsIcon"} height="24" />
324
+ <${K[0]||"DraftsIcon"} height="1em" />
325
+ <${K[0]||"DraftsIcon"} width="1em" height="1em" />
326
+ <${K[0]||"DraftsIcon"} height="24" />
327
327
  \`\`\`
328
328
 
329
329
  You can also use the \`size\` property as a shorthand for setting both width and height:
330
330
 
331
331
  \`\`\`html
332
- <${G[0]||"DraftsIcon"} size="24" />
333
- <${G[0]||"DraftsIcon"} size="1em" />
332
+ <${K[0]||"DraftsIcon"} size="24" />
333
+ <${K[0]||"DraftsIcon"} size="1em" />
334
334
  \`\`\`
335
335
 
336
336
  ### CSS Sizing
@@ -338,21 +338,21 @@ You can also use the \`size\` property as a shorthand for setting both width and
338
338
  You can also control icon size via CSS:
339
339
 
340
340
  \`\`\`css
341
- .${B(E)}-icon {
341
+ .${V(G)}-icon {
342
342
  width: 1em;
343
343
  height: 1em;
344
344
  }
345
345
  \`\`\`
346
346
 
347
347
  \`\`\`html
348
- <${G[0]||"DraftsIcon"} class="${B(E)}-icon" />
348
+ <${K[0]||"DraftsIcon"} class="${V(G)}-icon" />
349
349
  \`\`\`
350
350
 
351
351
  ## Available Icons
352
352
 
353
- This package contains **${Q}** icons:
353
+ This package contains **${U}** icons:
354
354
 
355
- ${S}
355
+ ${X}
356
356
 
357
357
  ## Usage Examples
358
358
 
@@ -360,10 +360,10 @@ ${S}
360
360
 
361
361
  \`\`\`html
362
362
  <nav>
363
- <a href="/"><${G[0]||"Icon"} size="20" class="nav-icon" /> Home</a>
364
- <a href="/about"><${G[1]||"Icon"} size="20" class="nav-icon" /> About</a>
365
- <a href="/contact"><${G[2]||"Icon"} size="20" class="nav-icon" /> Contact</a>
366
- <a href="/settings"><${G[3]||"Icon"} size="20" class="nav-icon" /> Settings</a>
363
+ <a href="/"><${K[0]||"Icon"} size="20" class="nav-icon" /> Home</a>
364
+ <a href="/about"><${K[1]||"Icon"} size="20" class="nav-icon" /> About</a>
365
+ <a href="/contact"><${K[2]||"Icon"} size="20" class="nav-icon" /> Contact</a>
366
+ <a href="/settings"><${K[3]||"Icon"} size="20" class="nav-icon" /> Settings</a>
367
367
  </nav>
368
368
 
369
369
  <style>
@@ -385,7 +385,7 @@ ${S}
385
385
  ### Custom Styling
386
386
 
387
387
  \`\`\`html
388
- <${G[0]||"Icon"}
388
+ <${K[0]||"Icon"}
389
389
  size="24"
390
390
  class="icon icon-primary"
391
391
  style="opacity: 0.8; transition: opacity 0.2s;"
@@ -406,15 +406,15 @@ ${S}
406
406
  \`\`\`html
407
407
  <div class="status-grid">
408
408
  <div class="status-item">
409
- <${G[0]||"Icon"} size="16" color="#22c55e" />
409
+ <${K[0]||"Icon"} size="16" color="#22c55e" />
410
410
  <span>Success</span>
411
411
  </div>
412
412
  <div class="status-item">
413
- <${G[1]||"Icon"} size="16" color="#f59e0b" />
413
+ <${K[1]||"Icon"} size="16" color="#f59e0b" />
414
414
  <span>Warning</span>
415
415
  </div>
416
416
  <div class="status-item">
417
- <${G[2]||"Icon"} size="16" color="#ef4444" />
417
+ <${K[2]||"Icon"} size="16" color="#ef4444" />
418
418
  <span>Error</span>
419
419
  </div>
420
420
  </div>
@@ -425,8 +425,8 @@ ${S}
425
425
  1. **Use Components Directly**: Import and use icon components in your templates
426
426
  \`\`\`html
427
427
  <!-- Recommended -->
428
- <${G[0]||"Icon"} size="24" />
429
- <${G[1]||"Icon"} size="24" color="#4a90e2" />
428
+ <${K[0]||"Icon"} size="24" />
429
+ <${K[1]||"Icon"} size="24" color="#4a90e2" />
430
430
  \`\`\`
431
431
 
432
432
  2. **Use CSS for Theming**: Apply consistent styling through CSS classes
@@ -443,24 +443,24 @@ ${S}
443
443
  \`\`\`
444
444
 
445
445
  \`\`\`html
446
- <${G[0]||"Icon"} size="24" class="icon" />
446
+ <${K[0]||"Icon"} size="24" class="icon" />
447
447
  \`\`\`
448
448
 
449
449
  3. **Set Appropriate Sizes**: Use \`1em\` for inline icons, fixed pixel sizes for standalone icons
450
450
  \`\`\`html
451
451
  <!-- Inline with text -->
452
- <p>Click the <${G[0]||"Icon"} height="1em" /> icon to continue</p>
452
+ <p>Click the <${K[0]||"Icon"} height="1em" /> icon to continue</p>
453
453
 
454
454
  <!-- Standalone -->
455
- <${G[0]||"Icon"} size="24" />
455
+ <${K[0]||"Icon"} size="24" />
456
456
  \`\`\`
457
457
 
458
458
  4. **Use Data Import for Advanced Use Cases**: When you need more control
459
459
  \`\`\`html
460
460
  @js
461
- import { ${U[0]||"icon"} } from '@stacksjs/iconify-${E}'
461
+ import { ${Z[0]||"icon"} } from '@stacksjs/iconify-${G}'
462
462
  import { renderIcon } from '@stacksjs/iconify-core'
463
- global.customIcon = renderIcon(${U[0]||"icon"}, { size: 24 })
463
+ global.customIcon = renderIcon(${Z[0]||"icon"}, { size: 24 })
464
464
  @endjs
465
465
 
466
466
  {!! customIcon !!}
@@ -472,10 +472,10 @@ This package includes full TypeScript support with type definitions for all icon
472
472
 
473
473
  \`\`\`typescript
474
474
  import type { IconData } from '@stacksjs/iconify-core'
475
- import { ${U[0]||"icon"} } from '@stacksjs/iconify-${E}'
475
+ import { ${Z[0]||"icon"} } from '@stacksjs/iconify-${G}'
476
476
 
477
477
  // Icons are typed as IconData
478
- const myIcon: IconData = ${U[0]||"icon"}
478
+ const myIcon: IconData = ${Z[0]||"icon"}
479
479
  \`\`\`
480
480
 
481
481
  ## Related Packages
@@ -494,12 +494,12 @@ ${z.license?.url?`See [license details](${z.license.url}) for more information.`
494
494
 
495
495
  - **Icons**: ${z.author?.name||"Iconify"}${z.author?.url?` ([Website](${z.author.url}))`:""}
496
496
  - **Iconify**: [https://iconify.design/](https://iconify.design/)
497
- - **Icon Set**: [View on Iconify](https://icon-sets.iconify.design/${E}/)
497
+ - **Icon Set**: [View on Iconify](https://icon-sets.iconify.design/${G}/)
498
498
 
499
499
  ## Resources
500
500
 
501
- - [Browse all icons in this collection](https://icon-sets.iconify.design/${E}/)
501
+ - [Browse all icons in this collection](https://icon-sets.iconify.design/${G}/)
502
502
  - [Iconify documentation](https://iconify.design/docs/)
503
503
  - [stx iconify integration guide](../../docs/iconify.md)
504
- `}async function s(E,z,K,Q){console.log(`
505
- \uD83D\uDCE6 Generating package for ${E}...`);let G=(await k())[E];if(!G)throw Error(`Collection ${E} not found`);console.log(` Collection: ${G.name}`),console.log(` Total icons: ${G.total}`);let S=await P(E,K),M=Object.keys(S.icons);console.log(` Generating ${M.length} icons...`);let V=X(z,`iconify-${E}`),Z=X(V,"src");await O(Z,{recursive:!0});let L=S.width||24,b=S.height||24;for(let $ of M){let R=S.icons[$],A=j(R,L,b),_=F($,A);await q(X(Z,`${$}.ts`),_);let w=h($,A);await q(X(Z,`${$}-icon.stx`),w)}let v=g(M);await q(X(Z,"index.ts"),v);let y=u(E);await q(X(Z,"types.ts"),y);let H=N(E,G,M.length);await q(X(V,"package.json"),H);let J=D(E);await q(X(V,"build.ts"),J);let W=d(E,G,M.length);if(await q(X(V,"README.md"),W),Q){let $=X(Q,`iconify-${E}.md`),R=C(E,G,M);await O(Q,{recursive:!0}),await q($,R),console.log(` \u2713 Generated documentation in ${$}`)}console.log(` \u2713 Generated ${M.length} icons in ${V}`)}function B(E){let z=E.replace(/-([a-z0-9])/g,(K)=>K[1].toUpperCase());if(z=z.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(z))z=`_${z}`;return z}function I(E){let z=B(E);return z.charAt(0).toUpperCase()+z.slice(1)}export{I as toPascalCase,B as toCamelCase,u as generateTypesFile,d as generateReadme,N as generatePackageJson,s as generatePackage,g as generateIndexFile,F as generateIconData,h as generateIconComponent,C as generateDocumentation,D as generateBuildFile,k as fetchCollections,P as fetchCollectionIcons,j as convertIconData};
504
+ `}async function m(G,z,M,U){console.log(`
505
+ \uD83D\uDCE6 Generating package for ${G}...`);let K=(await k())[G];if(!K)throw Error(`Collection ${G} not found`);console.log(` Collection: ${K.name}`),console.log(` Total icons: ${K.total}`);let X=await P(G,M),Q=Object.keys(X.icons);console.log(` Generating ${Q.length} icons...`);let $=q(z,`iconify-${G}`),B=q($,"src");await b(B,{recursive:!0});let S=X.width||24,R=X.height||24;for(let L of Q){let A=X.icons[L],Y=j(A,S,R),_=F(L,Y);await T(q(B,`${L}.ts`),_);let w=h(L,Y);await T(q(B,`${L}-icon.stx`),w)}let v=g(Q);await T(q(B,"index.ts"),v);let y=u(G);await T(q(B,"types.ts"),y);let H=N(G,K,Q.length);await T(q($,"package.json"),H);let J=D(G);await T(q($,"build.ts"),J);let W=d(G,K,Q.length);if(await T(q($,"README.md"),W),U){let L=q(U,`iconify-${G}.md`),A=C(G,K,Q);await b(U,{recursive:!0}),await T(L,A),console.log(` \u2713 Generated documentation in ${L}`)}console.log(` \u2713 Generated ${Q.length} icons in ${$}`)}var I=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","let","static","yield","implements","interface","package","private","protected","public","await","eval","arguments"]);function V(G){let z=G.replace(/-([a-z0-9])/g,(M)=>M[1].toUpperCase());if(z=z.replace(/[^a-zA-Z0-9_$]/g,"_"),/^[0-9]/.test(z))z=`_${z}`;if(I.has(z))z=`${z}_`;return z}function x(G){let z=V(G);return z.charAt(0).toUpperCase()+z.slice(1)}export{x as toPascalCase,V as toCamelCase,u as generateTypesFile,d as generateReadme,N as generatePackageJson,m as generatePackage,g as generateIndexFile,F as generateIconData,h as generateIconComponent,C as generateDocumentation,D as generateBuildFile,k as fetchCollections,P as fetchCollectionIcons,j as convertIconData};
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- import{Ha as a,Te as F,Va as r,Ve as v,We as P,nb as n,o as m,oa as l,ob as p,pe as s,qb as i,qe as t,vb as e}from"./chunk-52rkkkmt.js";import"./chunk-38t0fxh0.js";import"./chunk-ebr2344x.js";import"./chunk-ps20v1ah.js";import"./chunk-3p0zgfgz.js";import"./chunk-4r1qdp25.js";import"./chunk-mjpqz66q.js";import"./chunk-b2ghmxpj.js";import"./chunk-zwy5e35f.js";import"./chunk-me5kq4e6.js";import"./chunk-634gaa9d.js";import"./chunk-51g95yts.js";import"./chunk-n1j7gfe1.js";import"./chunk-svg37jzs.js";import"./chunk-7nfn7nj9.js";import"./chunk-c9vhtjtr.js";import"./chunk-6rzwef28.js";import"./chunk-683tfkz4.js";import"./chunk-jptkc64r.js";import"./chunk-3bc8bqw2.js";import"./chunk-7eg7ep8f.js";import"./chunk-y9nyqcha.js";import"./chunk-qg6pg6ze.js";import"./chunk-6w8fa3b8.js";import"./chunk-v8474ah4.js";import"./chunk-x4prtyjs.js";import"./chunk-6btbgxh1.js";import"./chunk-ctz53mbz.js";import"./chunk-weqpt9nt.js";import"./chunk-vh0qr8k9.js";import"./chunk-7k63nhap.js";import"./chunk-91007tan.js";import"./chunk-em8p71et.js";import"./chunk-d6wq91cw.js";import"./chunk-w8yac9xp.js";import"./chunk-454kar39.js";import"./chunk-cthpzv4p.js";import"./chunk-mdf3jbe6.js";import"./chunk-7eea1cse.js";import{el as u,fl as c}from"./chunk-gv42xz15.js";import"./chunk-pq6rabcy.js";import{Fs as f}from"./chunk-m6wz1hf5.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-2rp09y5j.js";import{et as A}from"./chunk-8d15pd4g.js";import"./chunk-q25mr70f.js";import"./chunk-jsfch50r.js";import"./chunk-6b4k8fay.js";import"./chunk-jb2r696a.js";import"./chunk-k5xtf38q.js";import"./chunk-0tbgvp70.js";import"./chunk-xdq52pwj.js";import{wv as B}from"./chunk-ddqkj56r.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.301";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
4
- Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-sy0rbpxv.js");if(x==="list"){console.log(`
3
+ import{Ha as a,Te as F,Va as r,Ve as v,We as P,nb as n,o as m,oa as l,ob as p,pe as s,qb as i,qe as t,vb as e}from"./chunk-52rkkkmt.js";import"./chunk-38t0fxh0.js";import"./chunk-ebr2344x.js";import"./chunk-ps20v1ah.js";import"./chunk-3p0zgfgz.js";import"./chunk-4r1qdp25.js";import"./chunk-mjpqz66q.js";import"./chunk-b2ghmxpj.js";import"./chunk-zwy5e35f.js";import"./chunk-me5kq4e6.js";import"./chunk-634gaa9d.js";import"./chunk-51g95yts.js";import"./chunk-n1j7gfe1.js";import"./chunk-svg37jzs.js";import"./chunk-7nfn7nj9.js";import"./chunk-c9vhtjtr.js";import"./chunk-6rzwef28.js";import"./chunk-683tfkz4.js";import"./chunk-jptkc64r.js";import"./chunk-3bc8bqw2.js";import"./chunk-7eg7ep8f.js";import"./chunk-y9nyqcha.js";import"./chunk-qg6pg6ze.js";import"./chunk-6w8fa3b8.js";import"./chunk-v8474ah4.js";import"./chunk-x4prtyjs.js";import"./chunk-6btbgxh1.js";import"./chunk-ctz53mbz.js";import"./chunk-weqpt9nt.js";import"./chunk-vh0qr8k9.js";import"./chunk-7k63nhap.js";import"./chunk-91007tan.js";import"./chunk-em8p71et.js";import"./chunk-d6wq91cw.js";import"./chunk-w8yac9xp.js";import"./chunk-454kar39.js";import"./chunk-cthpzv4p.js";import"./chunk-mdf3jbe6.js";import"./chunk-7eea1cse.js";import{el as u,fl as c}from"./chunk-gv42xz15.js";import"./chunk-pq6rabcy.js";import{Fs as f}from"./chunk-m6wz1hf5.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-2rp09y5j.js";import{et as A}from"./chunk-8d15pd4g.js";import"./chunk-q25mr70f.js";import"./chunk-jsfch50r.js";import"./chunk-6b4k8fay.js";import"./chunk-jb2r696a.js";import"./chunk-k5xtf38q.js";import"./chunk-0tbgvp70.js";import"./chunk-xdq52pwj.js";import{wv as B}from"./chunk-ddqkj56r.js";import{spawn as o}from"child_process";import L from"fs";import zb from"os";import $ from"path";import w from"process";import{CLI as wb}from"@stacksjs/clapp";var N="0.2.302";var __dirname="/home/runner/work/stx/stx/packages/stx/bin",E=new wb("stx");function h(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Port must be a valid number",suggestion:"Try using a number between 1024 and 65535"};if(Z<1024||Z>65535)return{isValid:!1,error:"Port must be between 1024 and 65535",suggestion:"Try using a port between 1024 and 65535"};return{isValid:!0}}function d(J){try{if(!L.existsSync(J)){let K=$.dirname(J),x=$.basename(J);if(L.existsSync(K)){let z=L.readdirSync(K).filter((j)=>j.toLowerCase().includes(x.toLowerCase().substring(0,3))||j.endsWith(".stx")||j.endsWith(".md")),k=z.length>0?`File not found. Similar files in ${K}: ${z.slice(0,3).join(", ")}`:`File not found. Directory ${K} exists but doesn't contain the specified file.`;return{isValid:!1,error:`File does not exist: ${J}`,suggestion:k}}return{isValid:!1,error:`File does not exist: ${J}`,suggestion:"Check the file path and try again"}}if(L.statSync(J).isDirectory())return{isValid:!1,error:`Expected file but got directory: ${J}`,suggestion:"Specify a .stx or .md file path"};return{isValid:!0}}catch(Z){return{isValid:!1,error:`Cannot access file: ${J}`,suggestion:"Check file permissions and path"}}}function y(J){let Z=typeof J==="string"?Number.parseInt(J,10):J;if(Number.isNaN(Z))return{isValid:!1,error:"Timeout must be a valid number",suggestion:"Specify timeout in milliseconds (e.g., 5000 for 5 seconds)"};if(Z<100)return{isValid:!1,error:"Timeout too short (minimum 100ms)",suggestion:"Use a timeout of at least 100ms"};if(Z>300000)return{isValid:!1,error:"Timeout too long (maximum 5 minutes)",suggestion:"Use a timeout of less than 300000ms (5 minutes)"};return{isValid:!0}}var V=(J)=>J.includes("*")||J.includes("?")||J.includes("{")||J.includes("["),jb=(J)=>J.endsWith(".stx")||J.endsWith(".md");function S(J,Z=1){if(console.error(`\u274C ${J.error}`),J.suggestion)console.error(`\uD83D\uDCA1 suggestion: ${J.suggestion}`);w.exit(Z)}function kb(J){if(!J)return;let Z;try{Z=JSON.parse(J)}catch(K){console.error(`\u274C --info-plist is not valid JSON: ${K.message}`),w.exit(1)}if(typeof Z!=="object"||Z===null||Array.isArray(Z))console.error(`\u274C --info-plist must be a JSON object, e.g. '{"NSFocusStatusUsageDescription":"\u2026"}'`),w.exit(1);for(let[K,x]of Object.entries(Z))if(typeof x!=="string"&&typeof x!=="number"&&typeof x!=="boolean")console.error(`\u274C --info-plist value for "${K}" must be a string, number or boolean`),w.exit(1);return Z}async function Hb(J,Z){try{let K=["test"],x=[];if(J&&J.length>0)for(let W of J)if(V(W))try{let H=await Array.fromAsync(new Bun.Glob(W).scan({onlyFiles:!0,absolute:!0}));if(H.length===0)console.warn(`Warning: No files found matching pattern: ${W}`);else if(x.push(...H),Z.verbose)console.log(`Found ${H.length} file(s) matching pattern: ${W}`)}catch(H){return console.error(`Error expanding glob pattern ${W}:`,H),!1}else x.push(W);if(x.length===0)return console.error("Error: No test files found matching the provided patterns."),!1;if(K.push(...x),Z.filter)K.push("--pattern",Z.filter);if(Z.timeout)K.push("--timeout",Z.timeout.toString());if(Z.reporter&&Z.reporter!=="default")if(Z.reporter==="junit"){let W=$.join(zb.tmpdir(),`stx-test-report-${Date.now()}.xml`);K.push("--reporter",Z.reporter),K.push("--reporter-outfile",W)}else console.warn(`Warning: Reporter '${Z.reporter}' is not supported. Using default reporter.`);if(Z.coverage)K.push("--coverage");if(Z.watch)K.push("--watch");K.push("--preload",$.join(__dirname,"../../../test-utils/happy-dom.ts"));let b={...w.env,STX_TEST_MODE:"true",STX_TEST_UI:Z.ui?"true":"false",STX_TEST_VERBOSE:Z.verbose?"true":"false"},z="bun";if(Z.verbose)console.log(`Running: ${z} ${K.join(" ")}`);let k=performance.now(),j=o(z,K,{stdio:"inherit",shell:!1,env:b});return new Promise((W)=>{j.on("close",(H)=>{let Y=((performance.now()-k)/1000).toFixed(2);if(H===0)W(!0);else W(!1)}),w.on("SIGINT",()=>{console.log(`
4
+ Test run interrupted`),j.kill("SIGINT"),w.exit(1)})})}catch(K){return console.error("Error running tests:",K instanceof Error?K.message:String(K)),!1}}var Qb=w.argv.length>=3&&(jb(w.argv[2])&&L.existsSync(w.argv[2])||V(w.argv[2]));if(Qb){let J=w.argv[2],Z={port:3000,watch:!0,cache:!0,markdown:{syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}}};for(let K=3;K<w.argv.length;K++){let x=w.argv[K];if(x==="--port"&&K+1<w.argv.length){let b=h(w.argv[++K]);if(!b.isValid)S(b);Z.port=Number.parseInt(w.argv[K],10)}else if(x==="--no-watch")Z.watch=!1;else if(x==="--highlight-theme"&&K+1<w.argv.length){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.defaultTheme=w.argv[++K]}else if(x==="--no-highlight"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.enabled=!1}else if(x==="--no-highlight-unknown"){if(!Z.markdown)Z.markdown={};if(!Z.markdown.syntaxHighlighting)Z.markdown.syntaxHighlighting={};Z.markdown.syntaxHighlighting.highlightUnknownLanguages=!1}else if(x==="--no-cache")Z.cache=!1;else if(x==="--native")Z.native=!0}if(V(J))try{let K=await Array.fromAsync(new Bun.Glob(J).scan({onlyFiles:!0,absolute:!0})),x=J.endsWith(".stx")?K.filter((j)=>j.endsWith(".stx")):J.endsWith(".md")?K.filter((j)=>j.endsWith(".md")):K.filter((j)=>j.endsWith(".stx")||j.endsWith(".md")),b=J.split("*")[0].replace(/\/$/,"")||".",z=$.resolve(b);try{let j=new Bun.Glob("**/*.stx"),H=(await Array.fromAsync(j.scan({cwd:z,onlyFiles:!0,absolute:!0}))).filter((U)=>/\[.+\]/.test($.basename(U)));for(let U of H)if(!x.includes(U))x.push(U)}catch{}if(x.length===0)console.error(`Error: No STX or Markdown files found matching pattern: ${J}`),w.exit(1);if(!await v(x,Z))w.exit(1)}catch(K){console.error("Failed to process files:",K),w.exit(1)}else F(J,Z).catch((K)=>{console.error("Failed to start dev server:",K),w.exit(1)})}else{let J=function(x,b){let z=[];for(let k=0;k<=b.length;k++)z[k]=[k];for(let k=0;k<=x.length;k++)z[0][k]=k;for(let k=1;k<=b.length;k++)for(let j=1;j<=x.length;j++)if(b.charAt(k-1)===x.charAt(j-1))z[k][j]=z[k-1][j-1];else z[k][j]=Math.min(z[k-1][j-1]+1,z[k][j-1]+1,z[k-1][j]+1);return z[b.length][x.length]};E.command("docs","Generate documentation for components, templates, and directives").option("--output <dir>","Output directory for documentation",{default:"docs"}).option("--format <format>","Documentation format (markdown, html, json)",{default:"markdown"}).option("--components-dir <dir>","Components directory",{default:"components"}).option("--templates-dir <dir>","Templates directory",{default:"."}).option("--no-components","Disable components documentation").option("--no-templates","Disable templates documentation").option("--no-directives","Disable directives documentation").option("--extra-content <content>","Extra content to include in documentation").example("stx docs --output docs --format html").action(async(x)=>{try{if(await r(x))console.log("Documentation generated successfully."),w.exit(0);else console.error("Documentation generation failed."),w.exit(1)}catch(b){console.error("Error generating documentation:",b),w.exit(1)}}),E.command("iconify <command>","Generate Iconify icon packages").option("--output <dir>","Output directory for generated packages",{default:"packages"}).option("--icons <icons>","Comma-separated list of specific icons to generate").example("stx iconify list").example("stx iconify generate mdi").example("stx iconify generate lucide --icons home,settings,user").action(async(x,b)=>{try{let{fetchCollections:z,generatePackage:k}=await import("./chunk-wj25qt72.js");if(x==="list"){console.log(`
5
5
  \uD83D\uDCDA Fetching available icon collections...
6
6
  `);let j=await z(),W=Object.entries(j).sort((H,U)=>U[1].total-H[1].total);console.log(`Available collections:
7
7
  `);for(let[H,U]of W){let Y=U;console.log(` ${H.padEnd(30)} ${Y.name} (${Y.total} icons)`)}console.log(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/stx",
3
3
  "type": "module",
4
- "version": "0.2.301",
4
+ "version": "0.2.302",
5
5
  "description": "A performant UI Framework. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -117,12 +117,12 @@
117
117
  "dependencies": {
118
118
  "@stacksjs/ts-css": "^0.3.2",
119
119
  "@stacksjs/clapp": "^0.2.14",
120
- "@stacksjs/desktop": "0.2.301",
121
- "@stacksjs/sanitizer": "0.2.301",
120
+ "@stacksjs/desktop": "0.2.302",
121
+ "@stacksjs/sanitizer": "0.2.302",
122
122
  "@stacksjs/ts-i18n": "^0.1.11",
123
- "bun-plugin-stx": "0.2.301",
123
+ "bun-plugin-stx": "0.2.302",
124
124
  "bunfig": "^0.15.17",
125
- "stx-router": "0.2.301",
125
+ "stx-router": "0.2.302",
126
126
  "ts-broadcasting": "^0.0.9",
127
127
  "ts-images": "^0.2.18",
128
128
  "ts-syntax-highlighter": "^0.2.1"