zard-cli 1.1.0-alpha.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/README.md +122 -60
  2. package/commands/add/component-installer.d.ts +2 -1
  3. package/commands/add/component-installer.d.ts.map +1 -1
  4. package/commands/add/component-installer.js +25 -7
  5. package/commands/add/component-installer.js.map +1 -1
  6. package/commands/add/component-selector.d.ts +3 -3
  7. package/commands/add/component-selector.js +4 -4
  8. package/commands/add/dark-mode-setup.d.ts +2 -0
  9. package/commands/add/dark-mode-setup.d.ts.map +1 -1
  10. package/commands/add/dark-mode-setup.js +15 -1
  11. package/commands/add/dark-mode-setup.js.map +1 -1
  12. package/commands/add/dependency-resolver.d.ts +8 -1
  13. package/commands/add/dependency-resolver.d.ts.map +1 -1
  14. package/commands/add/dependency-resolver.js +87 -16
  15. package/commands/add/dependency-resolver.js.map +1 -1
  16. package/commands/add/index.d.ts.map +1 -1
  17. package/commands/add/index.js +55 -29
  18. package/commands/add/index.js.map +1 -1
  19. package/commands/add/stylesheet-setup.d.ts +3 -0
  20. package/commands/add/stylesheet-setup.d.ts.map +1 -0
  21. package/commands/add/stylesheet-setup.js +92 -0
  22. package/commands/add/stylesheet-setup.js.map +1 -0
  23. package/commands/add/wizard.d.ts +12 -8
  24. package/commands/add/wizard.d.ts.map +1 -1
  25. package/commands/add/wizard.js +12 -2
  26. package/commands/add/wizard.js.map +1 -1
  27. package/commands/init/config-prompter.d.ts +36 -16
  28. package/commands/init/config-prompter.d.ts.map +1 -1
  29. package/commands/init/config-prompter.js +37 -17
  30. package/commands/init/config-prompter.js.map +1 -1
  31. package/commands/init/dependencies.d.ts.map +1 -1
  32. package/commands/init/dependencies.js +35 -23
  33. package/commands/init/dependencies.js.map +1 -1
  34. package/commands/init/index.d.ts.map +1 -1
  35. package/commands/init/index.js +74 -23
  36. package/commands/init/index.js.map +1 -1
  37. package/commands/init/library-peers.d.ts +28 -0
  38. package/commands/init/library-peers.d.ts.map +1 -0
  39. package/commands/init/library-peers.js +61 -0
  40. package/commands/init/library-peers.js.map +1 -0
  41. package/commands/init/project-kind.d.ts +39 -39
  42. package/commands/init/project-kind.d.ts.map +1 -1
  43. package/commands/init/project-kind.js +45 -45
  44. package/commands/init/project-kind.js.map +1 -1
  45. package/commands/init/rtl-setup.d.ts +12 -0
  46. package/commands/init/rtl-setup.d.ts.map +1 -0
  47. package/commands/init/rtl-setup.js +42 -0
  48. package/commands/init/rtl-setup.js.map +1 -0
  49. package/commands/init/steps.d.ts +3 -4
  50. package/commands/init/steps.d.ts.map +1 -1
  51. package/commands/init/steps.js +100 -39
  52. package/commands/init/steps.js.map +1 -1
  53. package/commands/init/tailwind-setup.d.ts +5 -5
  54. package/commands/init/tailwind-setup.d.ts.map +1 -1
  55. package/commands/init/tailwind-setup.js +29 -15
  56. package/commands/init/tailwind-setup.js.map +1 -1
  57. package/commands/init/tsconfig-updater.d.ts +4 -4
  58. package/commands/init/tsconfig-updater.js +12 -12
  59. package/commands/init/tsconfig-updater.js.map +1 -1
  60. package/commands/init/update-angular-config.js +4 -4
  61. package/commands/init/vite-setup.d.ts +5 -4
  62. package/commands/init/vite-setup.d.ts.map +1 -1
  63. package/commands/init/vite-setup.js +11 -10
  64. package/commands/init/vite-setup.js.map +1 -1
  65. package/commands/init/wizard.d.ts +10 -7
  66. package/commands/init/wizard.d.ts.map +1 -1
  67. package/commands/init/wizard.js +73 -46
  68. package/commands/init/wizard.js.map +1 -1
  69. package/constants/app.constants.d.ts +17 -0
  70. package/constants/app.constants.d.ts.map +1 -1
  71. package/constants/app.constants.js +39 -16
  72. package/constants/app.constants.js.map +1 -1
  73. package/core/icons/families.d.ts +38 -0
  74. package/core/icons/families.d.ts.map +1 -0
  75. package/core/icons/families.js +26 -0
  76. package/core/icons/families.js.map +1 -0
  77. package/core/icons/icon-map.d.ts +24 -0
  78. package/core/icons/icon-map.d.ts.map +1 -0
  79. package/core/icons/icon-map.js +150 -0
  80. package/core/icons/icon-map.js.map +1 -0
  81. package/core/icons/index.d.ts +107 -0
  82. package/core/icons/index.d.ts.map +1 -0
  83. package/core/icons/index.js +183 -0
  84. package/core/icons/index.js.map +1 -0
  85. package/core/registry/registry-data.d.ts.map +1 -1
  86. package/core/registry/registry-data.js +545 -63
  87. package/core/registry/registry-data.js.map +1 -1
  88. package/core/themes/index.d.ts +1 -1
  89. package/core/themes/index.js +1 -1
  90. package/core/themes/theme-definitions.d.ts.map +1 -1
  91. package/core/themes/theme-definitions.js +61 -72
  92. package/core/themes/theme-definitions.js.map +1 -1
  93. package/index.js +3 -2
  94. package/index.js.map +1 -1
  95. package/package.json +56 -58
  96. package/ui/blocks.d.ts +29 -28
  97. package/ui/blocks.d.ts.map +1 -1
  98. package/ui/blocks.js +27 -27
  99. package/ui/blocks.js.map +1 -1
  100. package/ui/brand.d.ts +5 -5
  101. package/ui/brand.d.ts.map +1 -1
  102. package/ui/brand.js +6 -6
  103. package/ui/brand.js.map +1 -1
  104. package/ui/engine/animation/index.d.ts +2 -3
  105. package/ui/engine/animation/index.d.ts.map +1 -1
  106. package/ui/engine/animation/index.js +2 -3
  107. package/ui/engine/animation/index.js.map +1 -1
  108. package/ui/engine/ansi/index.d.ts +10 -11
  109. package/ui/engine/ansi/index.d.ts.map +1 -1
  110. package/ui/engine/ansi/index.js +6 -7
  111. package/ui/engine/ansi/index.js.map +1 -1
  112. package/ui/engine/components/index.d.ts +3 -3
  113. package/ui/engine/components/index.js +4 -4
  114. package/ui/engine/cursor/index.d.ts +3 -4
  115. package/ui/engine/cursor/index.d.ts.map +1 -1
  116. package/ui/engine/cursor/index.js +2 -3
  117. package/ui/engine/cursor/index.js.map +1 -1
  118. package/ui/engine/diff/index.d.ts +2 -3
  119. package/ui/engine/diff/index.d.ts.map +1 -1
  120. package/ui/engine/diff/index.js +5 -6
  121. package/ui/engine/diff/index.js.map +1 -1
  122. package/ui/engine/events/index.d.ts +2 -2
  123. package/ui/engine/events/index.js +3 -3
  124. package/ui/engine/events/index.js.map +1 -1
  125. package/ui/engine/focus/index.d.ts +2 -2
  126. package/ui/engine/focus/index.js +2 -2
  127. package/ui/engine/frame/index.d.ts +4 -4
  128. package/ui/engine/frame/index.js +0 -0
  129. package/ui/engine/index.d.ts +7 -7
  130. package/ui/engine/index.js +7 -7
  131. package/ui/engine/input/index.d.ts +2 -2
  132. package/ui/engine/input/index.js +11 -11
  133. package/ui/engine/input/index.js.map +1 -1
  134. package/ui/engine/layout/index.d.ts +3 -3
  135. package/ui/engine/layout/index.js +7 -7
  136. package/ui/engine/layout/index.js.map +1 -1
  137. package/ui/engine/renderer/index.d.ts +4 -4
  138. package/ui/engine/renderer/index.d.ts.map +1 -1
  139. package/ui/engine/renderer/index.js +3 -3
  140. package/ui/engine/scheduler/index.d.ts +3 -3
  141. package/ui/engine/scheduler/index.js +5 -5
  142. package/ui/engine/scheduler/index.js.map +1 -1
  143. package/ui/engine/screen/index.d.ts +5 -5
  144. package/ui/engine/screen/index.d.ts.map +1 -1
  145. package/ui/engine/screen/index.js +7 -7
  146. package/ui/engine/screen/index.js.map +1 -1
  147. package/ui/engine/terminal/index.d.ts +49 -3
  148. package/ui/engine/terminal/index.d.ts.map +1 -1
  149. package/ui/engine/terminal/index.js +149 -18
  150. package/ui/engine/terminal/index.js.map +1 -1
  151. package/ui/engine/testing/index.d.ts +4 -4
  152. package/ui/engine/testing/index.d.ts.map +1 -1
  153. package/ui/engine/testing/index.js +2 -2
  154. package/ui/engine/theme/index.d.ts +2 -3
  155. package/ui/engine/theme/index.d.ts.map +1 -1
  156. package/ui/engine/theme/index.js +3 -4
  157. package/ui/engine/theme/index.js.map +1 -1
  158. package/ui/engine/utils/index.d.ts +2 -2
  159. package/ui/engine/utils/index.js +4 -4
  160. package/ui/engine/utils/index.js.map +1 -1
  161. package/ui/gate.d.ts +7 -7
  162. package/ui/gate.d.ts.map +1 -1
  163. package/ui/gate.js +5 -5
  164. package/ui/index.d.ts +3 -3
  165. package/ui/index.js +3 -3
  166. package/ui/log-sink.d.ts +9 -9
  167. package/ui/log-sink.d.ts.map +1 -1
  168. package/ui/log-sink.js +9 -9
  169. package/ui/log-sink.js.map +1 -1
  170. package/ui/output.d.ts +6 -6
  171. package/ui/output.d.ts.map +1 -1
  172. package/ui/output.js +6 -6
  173. package/ui/output.js.map +1 -1
  174. package/ui/report.d.ts +8 -8
  175. package/ui/report.d.ts.map +1 -1
  176. package/ui/report.js +7 -7
  177. package/ui/report.js.map +1 -1
  178. package/ui/runner.d.ts +31 -22
  179. package/ui/runner.d.ts.map +1 -1
  180. package/ui/runner.js +41 -25
  181. package/ui/runner.js.map +1 -1
  182. package/ui/style.d.ts +7 -7
  183. package/ui/style.d.ts.map +1 -1
  184. package/ui/style.js +8 -8
  185. package/ui/style.js.map +1 -1
  186. package/ui/testing/fake-tty.d.ts +4 -4
  187. package/ui/testing/fake-tty.js +4 -4
  188. package/ui/text-input.d.ts +15 -14
  189. package/ui/text-input.d.ts.map +1 -1
  190. package/ui/text-input.js +15 -13
  191. package/ui/text-input.js.map +1 -1
  192. package/ui/theme.d.ts +4 -4
  193. package/ui/theme.js +4 -4
  194. package/utils/angular-compat.d.ts +21 -0
  195. package/utils/angular-compat.d.ts.map +1 -0
  196. package/utils/angular-compat.js +52 -0
  197. package/utils/angular-compat.js.map +1 -0
  198. package/utils/config.d.ts +16 -9
  199. package/utils/config.d.ts.map +1 -1
  200. package/utils/config.js +35 -13
  201. package/utils/config.js.map +1 -1
  202. package/utils/errors.d.ts +11 -0
  203. package/utils/errors.d.ts.map +1 -1
  204. package/utils/errors.js +14 -0
  205. package/utils/errors.js.map +1 -1
  206. package/utils/get-project-info.d.ts +6 -6
  207. package/utils/get-project-info.d.ts.map +1 -1
  208. package/utils/get-project-info.js +106 -36
  209. package/utils/get-project-info.js.map +1 -1
  210. package/utils/http-client.d.ts.map +1 -1
  211. package/utils/http-client.js +20 -5
  212. package/utils/http-client.js.map +1 -1
  213. package/utils/icon-catalog.d.ts +34 -0
  214. package/utils/icon-catalog.d.ts.map +1 -0
  215. package/utils/icon-catalog.js +63 -0
  216. package/utils/icon-catalog.js.map +1 -0
  217. package/utils/logger.d.ts +3 -3
  218. package/utils/logger.js +9 -9
  219. package/utils/logger.js.map +1 -1
  220. package/utils/package-manager.d.ts +25 -25
  221. package/utils/package-manager.js +50 -50
  222. package/utils/package-manager.js.map +1 -1
  223. package/utils/registry.d.ts +100 -6
  224. package/utils/registry.d.ts.map +1 -1
  225. package/utils/registry.js +141 -22
  226. package/utils/registry.js.map +1 -1
  227. package/utils/schema-version.d.ts +21 -0
  228. package/utils/schema-version.d.ts.map +1 -0
  229. package/utils/schema-version.js +28 -0
  230. package/utils/schema-version.js.map +1 -0
  231. package/utils/source-file.d.ts +21 -21
  232. package/utils/source-file.d.ts.map +1 -1
  233. package/utils/source-file.js +24 -24
  234. package/utils/source-file.js.map +1 -1
@@ -0,0 +1,150 @@
1
+ /**
2
+ * The translation table between icon sets.
3
+ *
4
+ * Each row is an icon by what it MEANS — `check`, `chevron-down` — and the
5
+ * value is the symbol each set exports for it. Only the `lucide` column exists
6
+ * today, the one set the library supports; supporting another one means filling
7
+ * in its column, and nothing else along the install path changes.
8
+ *
9
+ * This is the copy bundled with the CLI. It is published at
10
+ * `<registry>/icons.json`, and that is where the CLI reads it from at run time
11
+ * — the file here is what holds when the registry does not answer, and the
12
+ * floor the published table is generated from.
13
+ *
14
+ * The list covers every icon the components and demos use today. A new icon in
15
+ * the code with no row here is an error: `icons.spec.ts` compares this table
16
+ * against what `libs/zard` actually imports.
17
+ *
18
+ * The tokens come from the lucide name in kebab-case because that already is
19
+ * the icon's semantic name (`lucideChevronDown` → `chevron-down`) — the key
20
+ * belongs to the table, not to the set, and stays valid once lucide is no
21
+ * longer the only column.
22
+ */
23
+ export const ICON_MAP = {
24
+ 'alert-triangle': { lucide: 'lucideAlertTriangle' },
25
+ 'app-window': { lucide: 'lucideAppWindow' },
26
+ archive: { lucide: 'lucideArchive' },
27
+ 'arrow-left': { lucide: 'lucideArrowLeft' },
28
+ 'arrow-right': { lucide: 'lucideArrowRight' },
29
+ 'arrow-up': { lucide: 'lucideArrowUp' },
30
+ 'arrow-up-right': { lucide: 'lucideArrowUpRight' },
31
+ 'audio-lines': { lucide: 'lucideAudioLines' },
32
+ 'badge-check': { lucide: 'lucideBadgeCheck' },
33
+ bell: { lucide: 'lucideBell' },
34
+ bluetooth: { lucide: 'lucideBluetooth' },
35
+ bold: { lucide: 'lucideBold' },
36
+ 'book-open': { lucide: 'lucideBookOpen' },
37
+ 'book-open-check': { lucide: 'lucideBookOpenCheck' },
38
+ bookmark: { lucide: 'lucideBookmark' },
39
+ bot: { lucide: 'lucideBot' },
40
+ 'building-2': { lucide: 'lucideBuilding2' },
41
+ calculator: { lucide: 'lucideCalculator' },
42
+ calendar: { lucide: 'lucideCalendar' },
43
+ 'calendar-plus': { lucide: 'lucideCalendarPlus' },
44
+ check: { lucide: 'lucideCheck' },
45
+ 'chevron-down': { lucide: 'lucideChevronDown' },
46
+ 'chevron-left': { lucide: 'lucideChevronLeft' },
47
+ 'chevron-right': { lucide: 'lucideChevronRight' },
48
+ 'chevron-up': { lucide: 'lucideChevronUp' },
49
+ 'chevrons-left': { lucide: 'lucideChevronsLeft' },
50
+ 'chevrons-right': { lucide: 'lucideChevronsRight' },
51
+ 'chevrons-up-down': { lucide: 'lucideChevronsUpDown' },
52
+ 'circle-alert': { lucide: 'lucideCircleAlert' },
53
+ 'circle-check': { lucide: 'lucideCircleCheck' },
54
+ 'circle-dashed': { lucide: 'lucideCircleDashed' },
55
+ 'circle-fading-arrow-up': { lucide: 'lucideCircleFadingArrowUp' },
56
+ 'circle-fading-plus': { lucide: 'lucideCircleFadingPlus' },
57
+ 'circle-help': { lucide: 'lucideCircleHelp' },
58
+ 'circle-small': { lucide: 'lucideCircleSmall' },
59
+ 'clipboard-paste': { lucide: 'lucideClipboardPaste' },
60
+ clock: { lucide: 'lucideClock' },
61
+ 'clock-2': { lucide: 'lucideClock2' },
62
+ cloud: { lucide: 'lucideCloud' },
63
+ code: { lucide: 'lucideCode' },
64
+ copy: { lucide: 'lucideCopy' },
65
+ 'corner-down-left': { lucide: 'lucideCornerDownLeft' },
66
+ 'credit-card': { lucide: 'lucideCreditCard' },
67
+ dot: { lucide: 'lucideDot' },
68
+ download: { lucide: 'lucideDownload' },
69
+ ellipsis: { lucide: 'lucideEllipsis' },
70
+ 'external-link': { lucide: 'lucideExternalLink' },
71
+ 'eye-off': { lucide: 'lucideEyeOff' },
72
+ file: { lucide: 'lucideFile' },
73
+ 'file-code': { lucide: 'lucideFileCode' },
74
+ 'file-code-2': { lucide: 'lucideFileCode2' },
75
+ 'file-text': { lucide: 'lucideFileText' },
76
+ folder: { lucide: 'lucideFolder' },
77
+ 'folder-code': { lucide: 'lucideFolderCode' },
78
+ 'folder-plus': { lucide: 'lucideFolderPlus' },
79
+ footprints: { lucide: 'lucideFootprints' },
80
+ forward: { lucide: 'lucideForward' },
81
+ frame: { lucide: 'lucideFrame' },
82
+ 'gallery-vertical-end': { lucide: 'lucideGalleryVerticalEnd' },
83
+ 'git-branch': { lucide: 'lucideGitBranch' },
84
+ globe: { lucide: 'lucideGlobe' },
85
+ house: { lucide: 'lucideHouse' },
86
+ image: { lucide: 'lucideImage' },
87
+ inbox: { lucide: 'lucideInbox' },
88
+ info: { lucide: 'lucideInfo' },
89
+ italic: { lucide: 'lucideItalic' },
90
+ keyboard: { lucide: 'lucideKeyboard' },
91
+ 'layout-grid': { lucide: 'lucideLayoutGrid' },
92
+ lightbulb: { lucide: 'lucideLightbulb' },
93
+ 'lightbulb-off': { lucide: 'lucideLightbulbOff' },
94
+ list: { lucide: 'lucideList' },
95
+ 'list-filter': { lucide: 'lucideListFilter' },
96
+ 'list-filter-plus': { lucide: 'lucideListFilterPlus' },
97
+ loader: { lucide: 'lucideLoader' },
98
+ 'loader-2': { lucide: 'lucideLoader2' },
99
+ 'loader-circle': { lucide: 'lucideLoaderCircle' },
100
+ 'log-out': { lucide: 'lucideLogOut' },
101
+ mail: { lucide: 'lucideMail' },
102
+ 'mail-check': { lucide: 'lucideMailCheck' },
103
+ map: { lucide: 'lucideMap' },
104
+ maximize: { lucide: 'lucideMaximize' },
105
+ 'message-square': { lucide: 'lucideMessageSquare' },
106
+ minimize: { lucide: 'lucideMinimize' },
107
+ minus: { lucide: 'lucideMinus' },
108
+ monitor: { lucide: 'lucideMonitor' },
109
+ 'more-horizontal': { lucide: 'lucideMoreHorizontal' },
110
+ 'octagon-x': { lucide: 'lucideOctagonX' },
111
+ 'panel-left': { lucide: 'lucidePanelLeft' },
112
+ pencil: { lucide: 'lucidePencil' },
113
+ 'pie-chart': { lucide: 'lucidePieChart' },
114
+ plus: { lucide: 'lucidePlus' },
115
+ 'refresh-ccw': { lucide: 'lucideRefreshCcw' },
116
+ 'refresh-cw': { lucide: 'lucideRefreshCw' },
117
+ 'rotate-ccw': { lucide: 'lucideRotateCcw' },
118
+ 'rotate-cw': { lucide: 'lucideRotateCw' },
119
+ save: { lucide: 'lucideSave' },
120
+ scissors: { lucide: 'lucideScissors' },
121
+ search: { lucide: 'lucideSearch' },
122
+ settings: { lucide: 'lucideSettings' },
123
+ 'settings-2': { lucide: 'lucideSettings2' },
124
+ share: { lucide: 'lucideShare' },
125
+ 'shield-alert': { lucide: 'lucideShieldAlert' },
126
+ smartphone: { lucide: 'lucideSmartphone' },
127
+ smile: { lucide: 'lucideSmile' },
128
+ sparkles: { lucide: 'lucideSparkles' },
129
+ 'square-terminal': { lucide: 'lucideSquareTerminal' },
130
+ star: { lucide: 'lucideStar' },
131
+ sun: { lucide: 'lucideSun' },
132
+ tag: { lucide: 'lucideTag' },
133
+ terminal: { lucide: 'lucideTerminal' },
134
+ 'thumbs-down': { lucide: 'lucideThumbsDown' },
135
+ 'thumbs-up': { lucide: 'lucideThumbsUp' },
136
+ trash: { lucide: 'lucideTrash' },
137
+ 'trash-2': { lucide: 'lucideTrash2' },
138
+ 'trending-up': { lucide: 'lucideTrendingUp' },
139
+ 'triangle-alert': { lucide: 'lucideTriangleAlert' },
140
+ underline: { lucide: 'lucideUnderline' },
141
+ user: { lucide: 'lucideUser' },
142
+ 'user-round-x': { lucide: 'lucideUserRoundX' },
143
+ 'volume-off': { lucide: 'lucideVolumeOff' },
144
+ wallet: { lucide: 'lucideWallet' },
145
+ waves: { lucide: 'lucideWaves' },
146
+ x: { lucide: 'lucideX' },
147
+ 'zoom-in': { lucide: 'lucideZoomIn' },
148
+ 'zoom-out': { lucide: 'lucideZoomOut' },
149
+ };
150
+ //# sourceMappingURL=icon-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-map.js","sourceRoot":"","sources":["../../../src/core/icons/icon-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAA2C;IAC9D,gBAAgB,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE;IACnD,YAAY,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;IAC3C,OAAO,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;IACpC,YAAY,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;IAC3C,aAAa,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC7C,UAAU,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;IACvC,gBAAgB,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE;IAClD,aAAa,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC7C,aAAa,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC7C,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;IAC9B,SAAS,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;IACxC,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;IAC9B,WAAW,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACzC,iBAAiB,EAAE,EAAE,MAAM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C7C,WAAW,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE;IACzC,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;IAChC,SAAS,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;IACrC,aAAa,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC7C,gBAAgB,EAAE,EAAE,MAAM,EAAE,qBAAqB,EAAE;IACnD,SAAS,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;IACxC,IAAI,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE;IAC9B,cAAc,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;IAC9C,YAAY,EAAE,EAAE,MAAM,EAAE,iBAAiB,EAAE;IAC3C,MAAM,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;IAClC,KAAK,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE;IAChC,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;IACxB,SAAS,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE;IACrC,UAAU,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE;CACxC,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Icons — what the components draw, and how that changes with the family.
3
+ *
4
+ * Everything here works off a catalog: the pair (declared families, translation
5
+ * table). The local catalog is the bundled copy; the one that counts at runtime
6
+ * comes from `<registry>/icons.json`. That indirection is what makes "support
7
+ * material" a matter of publishing one more column in the registry, with no CLI
8
+ * release and no hunting for `lucide` through the code.
9
+ *
10
+ * `extractIcons` reads which icons a source uses (the registry publishes this)
11
+ * `retargetIcons` rewrites a source from one family to another (install uses it)
12
+ * `iconPackagesFor` says which packages the project needs (init uses it)
13
+ */
14
+ import { type IconFamily, type IconFamilyInfo } from './families.js';
15
+ export { ICON_CORE_PACKAGE, ICON_FAMILIES, SOURCE_ICON_FAMILY, type IconFamily, type IconFamilyInfo, } from './families.js';
16
+ export { ICON_MAP } from './icon-map.js';
17
+ /** An icon by what it means: `check`, `chevron-down`. */
18
+ export type IconToken = string;
19
+ /**
20
+ * The declared families and the table that translates between them.
21
+ *
22
+ * `icons` is keyed by token and then by family — the same shape as
23
+ * `icon-map.ts`, which is the local copy of this same data.
24
+ */
25
+ export interface IconCatalog {
26
+ readonly families: Readonly<Record<string, IconFamilyInfo>>;
27
+ readonly icons: Readonly<Record<string, Readonly<Record<string, string>>>>;
28
+ }
29
+ /** The catalog bundled with the CLI — used when the registry does not answer. */
30
+ export declare const LOCAL_ICON_CATALOG: IconCatalog;
31
+ /** A list of icons in both forms: as the code writes them, and as the table names them. */
32
+ export interface IconList {
33
+ /** The symbols as they appear in the code (`lucideCheck`). */
34
+ readonly symbols: string[];
35
+ /** The same icons under the table's neutral key (`check`). */
36
+ readonly tokens: IconToken[];
37
+ }
38
+ /**
39
+ * A component's icons, in the shape the registry publishes them.
40
+ *
41
+ * The two lists are separate because they serve different things: `symbols` and
42
+ * `tokens` are what `add` writes into the project — the ng-icons dependency
43
+ * comes from them — while `demos` are the icons that only appear in the
44
+ * documentation examples. A component can draw no icon at all and still have
45
+ * demos full of them, and switching family has to reach both.
46
+ */
47
+ export interface ComponentIcons extends IconList {
48
+ /** The family the published files are written in. */
49
+ readonly family: IconFamily;
50
+ readonly demos: IconList;
51
+ }
52
+ export declare function iconFamilies(catalog?: IconCatalog): string[];
53
+ export declare function isIconFamily(value: string, catalog?: IconCatalog): boolean;
54
+ export declare function iconFamily(family: IconFamily, catalog?: IconCatalog): IconFamilyInfo | undefined;
55
+ /** The npm packages a project configured with this family needs. */
56
+ export declare function iconPackagesFor(family: IconFamily, catalog?: IconCatalog): string[];
57
+ export declare function tokenFor(symbol: string, family?: IconFamily, catalog?: IconCatalog): IconToken | undefined;
58
+ export declare function symbolFor(token: IconToken, family: IconFamily, catalog?: IconCatalog): string | undefined;
59
+ /** Tokens that have no symbol declared in this family yet. */
60
+ export declare function missingTokensFor(family: IconFamily, catalog?: IconCatalog): IconToken[];
61
+ /**
62
+ * The icon symbols a source imports.
63
+ *
64
+ * Only the import counts. A stray `name="lucideCheck"` in a template draws
65
+ * nothing without the matching `provideIcons`, so the import is at once the
66
+ * complete list and the list without false positives — `@ng-icons/core`
67
+ * (NgIcon, provideIcons, IconName) is left out because it is not a family.
68
+ */
69
+ export declare function extractIcons(source: string, family?: IconFamily, catalog?: IconCatalog): string[];
70
+ /** The icons of a set of files, in both forms. */
71
+ export declare function listIcons(sources: readonly string[], family?: IconFamily, catalog?: IconCatalog): IconList;
72
+ /**
73
+ * A component's icon mapping, ready for the registry.
74
+ *
75
+ * It comes back filled in even when there is no icon at all: the field always
76
+ * being present is what tells "this component draws no icons" apart from "this
77
+ * registry was published before the mapping existed", so a reader never has to
78
+ * guess which of the two it is.
79
+ */
80
+ export declare function collectIcons(files: readonly string[], demos?: readonly string[], family?: IconFamily, catalog?: IconCatalog): ComponentIcons;
81
+ export interface RetargetResult {
82
+ readonly content: string;
83
+ /** Symbols the target family does not declare — left untouched. */
84
+ readonly missing: string[];
85
+ }
86
+ /**
87
+ * Rewrites a source from one icon family to another.
88
+ *
89
+ * Two swaps: the package the symbols come from, and each symbol itself. A symbol
90
+ * is replaced wherever it appears — the import, the `provideIcons({ lucideCheck })`
91
+ * and the template's `name="lucideCheck"` are the same word, and the object
92
+ * shorthand stays valid after the swap.
93
+ *
94
+ * A symbol with no equivalent in the target family is not invented: it stays as
95
+ * it is and comes back in `missing`, so the caller can warn instead of writing
96
+ * an import that does not resolve.
97
+ */
98
+ export declare function retargetIcons(source: string, from: IconFamily, to: IconFamily, catalog?: IconCatalog): RetargetResult;
99
+ /**
100
+ * The mechanical half of the swap, separated from whatever decides what to swap.
101
+ *
102
+ * It is exported because this is where rewriting bugs live — whole-word
103
+ * replacement and the order of the alternation — and because testing it does
104
+ * not require more than one declared family.
105
+ */
106
+ export declare function rewriteIcons(source: string, fromPackage: string, toPackage: string, replacements: ReadonlyMap<string, string>): string;
107
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1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EAAE,MAAM,EACd,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,UAAU,EACd,OAAO,GAAE,WAAgC,GACxC,cAAc,CAoBhB;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACxC,MAAM,CAcR"}
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Icons — what the components draw, and how that changes with the family.
3
+ *
4
+ * Everything here works off a catalog: the pair (declared families, translation
5
+ * table). The local catalog is the bundled copy; the one that counts at runtime
6
+ * comes from `<registry>/icons.json`. That indirection is what makes "support
7
+ * material" a matter of publishing one more column in the registry, with no CLI
8
+ * release and no hunting for `lucide` through the code.
9
+ *
10
+ * `extractIcons` reads which icons a source uses (the registry publishes this)
11
+ * `retargetIcons` rewrites a source from one family to another (install uses it)
12
+ * `iconPackagesFor` says which packages the project needs (init uses it)
13
+ */
14
+ import { ICON_CORE_PACKAGE, ICON_FAMILIES, SOURCE_ICON_FAMILY, } from './families.js';
15
+ import { ICON_MAP } from './icon-map.js';
16
+ export { ICON_CORE_PACKAGE, ICON_FAMILIES, SOURCE_ICON_FAMILY, } from './families.js';
17
+ export { ICON_MAP } from './icon-map.js';
18
+ /** The catalog bundled with the CLI — used when the registry does not answer. */
19
+ export const LOCAL_ICON_CATALOG = { families: ICON_FAMILIES, icons: ICON_MAP };
20
+ /**
21
+ * Reverse symbol → token index, built per catalog and memoized.
22
+ *
23
+ * The remote catalog is a single object, fetched once per run, so a weak key is
24
+ * enough and the index is not rebuilt for every installed file.
25
+ */
26
+ const reverseIndexes = new WeakMap();
27
+ function reverseIndex(catalog, family) {
28
+ let byFamily = reverseIndexes.get(catalog);
29
+ if (!byFamily) {
30
+ byFamily = new Map();
31
+ for (const [token, symbols] of Object.entries(catalog.icons)) {
32
+ for (const [name, symbol] of Object.entries(symbols)) {
33
+ const index = byFamily.get(name) ?? new Map();
34
+ index.set(symbol, token);
35
+ byFamily.set(name, index);
36
+ }
37
+ }
38
+ reverseIndexes.set(catalog, byFamily);
39
+ }
40
+ return byFamily.get(family) ?? new Map();
41
+ }
42
+ export function iconFamilies(catalog = LOCAL_ICON_CATALOG) {
43
+ return Object.keys(catalog.families).sort();
44
+ }
45
+ export function isIconFamily(value, catalog = LOCAL_ICON_CATALOG) {
46
+ return Object.prototype.hasOwnProperty.call(catalog.families, value);
47
+ }
48
+ export function iconFamily(family, catalog = LOCAL_ICON_CATALOG) {
49
+ return catalog.families[family];
50
+ }
51
+ /** The npm packages a project configured with this family needs. */
52
+ export function iconPackagesFor(family, catalog = LOCAL_ICON_CATALOG) {
53
+ const info = iconFamily(family, catalog);
54
+ return info ? [ICON_CORE_PACKAGE, info.package] : [ICON_CORE_PACKAGE];
55
+ }
56
+ export function tokenFor(symbol, family = SOURCE_ICON_FAMILY, catalog = LOCAL_ICON_CATALOG) {
57
+ return reverseIndex(catalog, family).get(symbol);
58
+ }
59
+ export function symbolFor(token, family, catalog = LOCAL_ICON_CATALOG) {
60
+ return catalog.icons[token]?.[family];
61
+ }
62
+ /** Tokens that have no symbol declared in this family yet. */
63
+ export function missingTokensFor(family, catalog = LOCAL_ICON_CATALOG) {
64
+ return Object.keys(catalog.icons).filter(token => symbolFor(token, family, catalog) === undefined);
65
+ }
66
+ /**
67
+ * `import { lucideCheck, lucideX } from '@ng-icons/lucide'` — on one line or
68
+ * several, with a leading `type` or aliased. What matters is the package (which
69
+ * gives the family) and the names imported from it.
70
+ */
71
+ const ICON_IMPORT = /import\s*(?:type\s+)?\{([^}]*)\}\s*from\s*['"]@ng-icons\/([a-z0-9-]+)['"]/g;
72
+ function familyByPackageSuffix(suffix, catalog) {
73
+ return Object.keys(catalog.families).find(name => catalog.families[name]?.package === `@ng-icons/${suffix}`);
74
+ }
75
+ /**
76
+ * The icon symbols a source imports.
77
+ *
78
+ * Only the import counts. A stray `name="lucideCheck"` in a template draws
79
+ * nothing without the matching `provideIcons`, so the import is at once the
80
+ * complete list and the list without false positives — `@ng-icons/core`
81
+ * (NgIcon, provideIcons, IconName) is left out because it is not a family.
82
+ */
83
+ export function extractIcons(source, family = SOURCE_ICON_FAMILY, catalog = LOCAL_ICON_CATALOG) {
84
+ const found = new Set();
85
+ for (const match of source.matchAll(ICON_IMPORT)) {
86
+ if (familyByPackageSuffix(match[2] ?? '', catalog) !== family)
87
+ continue;
88
+ for (const specifier of (match[1] ?? '').split(',')) {
89
+ // `type Foo`, `Foo as Bar` — the package's symbol is always the first name.
90
+ const name = specifier
91
+ .trim()
92
+ .replace(/^type\s+/, '')
93
+ .split(/\s+as\s+/)[0]
94
+ ?.trim();
95
+ if (name)
96
+ found.add(name);
97
+ }
98
+ }
99
+ return [...found].sort();
100
+ }
101
+ /** The icons of a set of files, in both forms. */
102
+ export function listIcons(sources, family = SOURCE_ICON_FAMILY, catalog = LOCAL_ICON_CATALOG) {
103
+ const symbols = new Set();
104
+ for (const source of sources) {
105
+ for (const symbol of extractIcons(source, family, catalog))
106
+ symbols.add(symbol);
107
+ }
108
+ const sorted = [...symbols].sort();
109
+ return {
110
+ symbols: sorted,
111
+ tokens: sorted
112
+ .map(symbol => tokenFor(symbol, family, catalog))
113
+ .filter((token) => token !== undefined),
114
+ };
115
+ }
116
+ /**
117
+ * A component's icon mapping, ready for the registry.
118
+ *
119
+ * It comes back filled in even when there is no icon at all: the field always
120
+ * being present is what tells "this component draws no icons" apart from "this
121
+ * registry was published before the mapping existed", so a reader never has to
122
+ * guess which of the two it is.
123
+ */
124
+ export function collectIcons(files, demos = [], family = SOURCE_ICON_FAMILY, catalog = LOCAL_ICON_CATALOG) {
125
+ return {
126
+ family,
127
+ ...listIcons(files, family, catalog),
128
+ demos: listIcons(demos, family, catalog),
129
+ };
130
+ }
131
+ /**
132
+ * Rewrites a source from one icon family to another.
133
+ *
134
+ * Two swaps: the package the symbols come from, and each symbol itself. A symbol
135
+ * is replaced wherever it appears — the import, the `provideIcons({ lucideCheck })`
136
+ * and the template's `name="lucideCheck"` are the same word, and the object
137
+ * shorthand stays valid after the swap.
138
+ *
139
+ * A symbol with no equivalent in the target family is not invented: it stays as
140
+ * it is and comes back in `missing`, so the caller can warn instead of writing
141
+ * an import that does not resolve.
142
+ */
143
+ export function retargetIcons(source, from, to, catalog = LOCAL_ICON_CATALOG) {
144
+ const origin = iconFamily(from, catalog);
145
+ const target = iconFamily(to, catalog);
146
+ if (from === to || !origin || !target)
147
+ return { content: source, missing: [] };
148
+ const missing = [];
149
+ const replacements = new Map();
150
+ for (const symbol of extractIcons(source, from, catalog)) {
151
+ const token = tokenFor(symbol, from, catalog);
152
+ const replacement = token !== undefined ? symbolFor(token, to, catalog) : undefined;
153
+ if (replacement === undefined)
154
+ missing.push(symbol);
155
+ else
156
+ replacements.set(symbol, replacement);
157
+ }
158
+ if (replacements.size === 0)
159
+ return { content: source, missing };
160
+ return { content: rewriteIcons(source, origin.package, target.package, replacements), missing };
161
+ }
162
+ /**
163
+ * The mechanical half of the swap, separated from whatever decides what to swap.
164
+ *
165
+ * It is exported because this is where rewriting bugs live — whole-word
166
+ * replacement and the order of the alternation — and because testing it does
167
+ * not require more than one declared family.
168
+ */
169
+ export function rewriteIcons(source, fromPackage, toPackage, replacements) {
170
+ if (replacements.size === 0)
171
+ return source;
172
+ // The alternation is tried in written order, so the long names come first:
173
+ // with `lucideClock` in front, `lucideClock2` would be matched from its prefix
174
+ // and only the trailing `\b` would save it — cheaper not to rely on that.
175
+ const pattern = new RegExp(`\\b(${[...replacements.keys()].sort((a, b) => b.length - a.length).join('|')})\\b`, 'g');
176
+ return source
177
+ .replace(new RegExp(`(['"])${escapeRegExp(fromPackage)}\\1`, 'g'), (_match, quote) => `${quote}${toPackage}${quote}`)
178
+ .replace(pattern, symbol => replacements.get(symbol) ?? symbol);
179
+ }
180
+ function escapeRegExp(value) {
181
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
182
+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1E,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAErH,OAAO,MAAM;SACV,OAAO,CACN,IAAI,MAAM,CAAC,SAAS,YAAY,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,CAAC,EACxD,CAAC,MAAM,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,EAAE,CAC1D;SACA,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"registry-data.d.ts","sourceRoot":"","sources":["../../../src/core/registry/registry-data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,iBAAiB,EA8nCvC,CAAC"}
1
+ {"version":3,"file":"registry-data.d.ts","sourceRoot":"","sources":["../../../src/core/registry/registry-data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,iBAAiB,EAgmDvC,CAAC"}