torch-glare 2.3.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/README.md +8 -0
  2. package/apps/lib/components/ActionButton.tsx +7 -12
  3. package/apps/lib/components/ActionsGroup.tsx +4 -15
  4. package/apps/lib/components/AlertDialog.tsx +173 -191
  5. package/apps/lib/components/Avatar.tsx +13 -16
  6. package/apps/lib/components/Badge.tsx +7 -3
  7. package/apps/lib/components/BadgeField.tsx +76 -71
  8. package/apps/lib/components/Breadcrumb.tsx +49 -85
  9. package/apps/lib/components/Button.tsx +20 -19
  10. package/apps/lib/components/ButtonGroup.tsx +31 -41
  11. package/apps/lib/components/Calendar.tsx +51 -29
  12. package/apps/lib/components/Card.tsx +2 -13
  13. package/apps/lib/components/ChartBlockTool.ts +17 -52
  14. package/apps/lib/components/Checkbox.tsx +9 -16
  15. package/apps/lib/components/ContextMenu.tsx +110 -106
  16. package/apps/lib/components/CountBadge.tsx +4 -6
  17. package/apps/lib/components/DataTable.tsx +196 -216
  18. package/apps/lib/components/DataViews/DataViewRadio.tsx +10 -8
  19. package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +21 -55
  20. package/apps/lib/components/DataViews/DataViewsHeader.tsx +1 -3
  21. package/apps/lib/components/DataViews/DataViewsLayout.tsx +5 -12
  22. package/apps/lib/components/DataViews/FilterPanel.tsx +173 -150
  23. package/apps/lib/components/DataViews/HeaderSearch.tsx +1 -5
  24. package/apps/lib/components/DataViews/InboxView.tsx +22 -68
  25. package/apps/lib/components/DataViews/InboxViewCard.tsx +68 -77
  26. package/apps/lib/components/DataViews/KanbanView.tsx +8 -25
  27. package/apps/lib/components/DataViews/PanelControls.tsx +3 -13
  28. package/apps/lib/components/DataViews/SettingsPanel.tsx +83 -89
  29. package/apps/lib/components/DataViews/TableView.tsx +8 -28
  30. package/apps/lib/components/DataViews/TreeView.tsx +12 -40
  31. package/apps/lib/components/DataViews/badgeAdapter.ts +32 -28
  32. package/apps/lib/components/DataViews/fieldRenderers.tsx +106 -141
  33. package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +87 -0
  34. package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +39 -32
  35. package/apps/lib/components/DataViews/filters/PresetChips.tsx +15 -15
  36. package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +69 -58
  37. package/apps/lib/components/DataViews/index.ts +26 -26
  38. package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +12 -16
  39. package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +28 -31
  40. package/apps/lib/components/DataViews/types.ts +111 -114
  41. package/apps/lib/components/DatePicker.tsx +198 -191
  42. package/apps/lib/components/Dialog.tsx +92 -105
  43. package/apps/lib/components/Divider.tsx +21 -24
  44. package/apps/lib/components/Drawer.tsx +79 -139
  45. package/apps/lib/components/DropdownMenu.tsx +144 -181
  46. package/apps/lib/components/FieldHint.tsx +4 -11
  47. package/apps/lib/components/Form.tsx +146 -155
  48. package/apps/lib/components/FormStepper.tsx +9 -39
  49. package/apps/lib/components/HeaderBar.tsx +119 -0
  50. package/apps/lib/components/ImageAttachment.tsx +111 -73
  51. package/apps/lib/components/InnerLabelField.tsx +20 -16
  52. package/apps/lib/components/Input.tsx +171 -172
  53. package/apps/lib/components/InputField.tsx +44 -45
  54. package/apps/lib/components/InputOTP.tsx +68 -69
  55. package/apps/lib/components/Label.tsx +31 -35
  56. package/apps/lib/components/LabelField.tsx +4 -5
  57. package/apps/lib/components/LabeledCheckBox.tsx +8 -12
  58. package/apps/lib/components/LabeledRadio.tsx +7 -5
  59. package/apps/lib/components/LinkButton.tsx +2 -9
  60. package/apps/lib/components/LoginButton.tsx +4 -9
  61. package/apps/lib/components/PasswordLevel.tsx +5 -5
  62. package/apps/lib/components/Popover.tsx +15 -33
  63. package/apps/lib/components/ProfileMenu.tsx +67 -72
  64. package/apps/lib/components/Radio.tsx +1 -5
  65. package/apps/lib/components/RadioCard.tsx +9 -28
  66. package/apps/lib/components/ScrollArea.tsx +45 -43
  67. package/apps/lib/components/SearchField.tsx +49 -39
  68. package/apps/lib/components/SearchableSelect.tsx +46 -52
  69. package/apps/lib/components/SearchableTable.tsx +199 -219
  70. package/apps/lib/components/SearchableTree.tsx +469 -0
  71. package/apps/lib/components/SearchableTreeDialog.tsx +493 -0
  72. package/apps/lib/components/SectionBlock.tsx +4 -16
  73. package/apps/lib/components/Select.tsx +53 -80
  74. package/apps/lib/components/SimpleSelect.tsx +196 -187
  75. package/apps/lib/components/Skeleton.tsx +9 -12
  76. package/apps/lib/components/SlideDatePicker.tsx +215 -166
  77. package/apps/lib/components/SpinLoading.tsx +33 -49
  78. package/apps/lib/components/Stepper.tsx +13 -56
  79. package/apps/lib/components/Switch.tsx +8 -10
  80. package/apps/lib/components/TabFormItem.tsx +3 -12
  81. package/apps/lib/components/TabSwitch.tsx +7 -34
  82. package/apps/lib/components/Table.tsx +60 -75
  83. package/apps/lib/components/TableDnDWrapper.ts +15 -48
  84. package/apps/lib/components/TextEditor.tsx +93 -104
  85. package/apps/lib/components/Textarea.tsx +8 -12
  86. package/apps/lib/components/Timeline.tsx +21 -41
  87. package/apps/lib/components/Toast.tsx +83 -83
  88. package/apps/lib/components/Toggle.tsx +112 -114
  89. package/apps/lib/components/ToggleButton.tsx +1 -1
  90. package/apps/lib/components/Tooltip.tsx +24 -19
  91. package/apps/lib/components/TransparentLabel.tsx +61 -62
  92. package/apps/lib/components/TreeDropDown.tsx +86 -52
  93. package/apps/lib/components/TreeFolder/TreeFolder.tsx +15 -48
  94. package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +16 -21
  95. package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +9 -20
  96. package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +3 -3
  97. package/apps/lib/components/TreeFolder/icons.tsx +14 -17
  98. package/apps/lib/components/TreeFolder/index.ts +15 -8
  99. package/apps/lib/components/TreeFolder/treeFolderUtils.ts +47 -52
  100. package/apps/lib/components/TreeFolder/types.ts +32 -32
  101. package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +117 -123
  102. package/apps/lib/hooks/useActiveTreeItem.ts +52 -55
  103. package/apps/lib/hooks/useClickOutside.ts +21 -20
  104. package/apps/lib/hooks/useDataViewsState.ts +86 -80
  105. package/apps/lib/hooks/useIsMobile.ts +12 -12
  106. package/apps/lib/hooks/useResize.ts +54 -65
  107. package/apps/lib/hooks/useTagSelection.ts +201 -201
  108. package/apps/lib/layouts/CNLayout.tsx +181 -140
  109. package/apps/lib/layouts/DataViewCard.tsx +4 -18
  110. package/apps/lib/layouts/FieldSection.tsx +2 -6
  111. package/apps/lib/layouts/TreeSubLayout.tsx +24 -38
  112. package/apps/lib/providers/ThemeProvider.tsx +8 -23
  113. package/apps/lib/registry.json +1004 -0
  114. package/apps/lib/tsconfig.json +9 -0
  115. package/apps/lib/utils/cn.ts +1 -1
  116. package/apps/lib/utils/dataViews/columnUtils.ts +46 -44
  117. package/apps/lib/utils/dataViews/fieldUtils.ts +70 -71
  118. package/apps/lib/utils/dataViews/nestedDataUtils.tsx +129 -122
  119. package/apps/lib/utils/dataViews/pathUtils.ts +74 -67
  120. package/apps/lib/utils/dataViews/rangeUtils.ts +121 -112
  121. package/apps/lib/utils/dataViews/treeUtils.ts +204 -211
  122. package/apps/lib/utils/dateFormat.ts +64 -54
  123. package/apps/lib/utils/markdownParser.ts +2 -7
  124. package/apps/lib/utils/resize.ts +21 -25
  125. package/apps/lib/utils/types.ts +13 -13
  126. package/dist/bin/index.js +8 -2
  127. package/dist/bin/index.js.map +1 -1
  128. package/dist/src/shared/getAvailableFiles.d.ts.map +1 -1
  129. package/dist/src/shared/getAvailableFiles.js +6 -1
  130. package/dist/src/shared/getAvailableFiles.js.map +1 -1
  131. package/dist/src/shared/loadRegistry.d.ts +7 -0
  132. package/dist/src/shared/loadRegistry.d.ts.map +1 -0
  133. package/dist/src/shared/loadRegistry.js +31 -0
  134. package/dist/src/shared/loadRegistry.js.map +1 -0
  135. package/dist/src/shared/resolveInstallPlan.d.ts +12 -0
  136. package/dist/src/shared/resolveInstallPlan.d.ts.map +1 -0
  137. package/dist/src/shared/resolveInstallPlan.js +39 -0
  138. package/dist/src/shared/resolveInstallPlan.js.map +1 -0
  139. package/dist/src/types/main.d.ts +24 -0
  140. package/dist/src/types/main.d.ts.map +1 -1
  141. package/docs/README.md +10 -2
  142. package/docs/components/action-button.md +30 -24
  143. package/docs/components/actions-group.md +26 -20
  144. package/docs/components/alert-dialog.md +45 -45
  145. package/docs/components/avatar.md +6 -2
  146. package/docs/components/badge-field.md +6 -2
  147. package/docs/components/badge.md +7 -1
  148. package/docs/components/breadcrumb.md +15 -40
  149. package/docs/components/button-group.md +13 -10
  150. package/docs/components/button.md +58 -33
  151. package/docs/components/calendar.md +26 -19
  152. package/docs/components/card.md +19 -16
  153. package/docs/components/chart-block-tool.md +128 -0
  154. package/docs/components/checkbox.md +16 -8
  155. package/docs/components/cn-layout.md +7 -1
  156. package/docs/components/context-menu.md +47 -24
  157. package/docs/components/count-badge.md +7 -1
  158. package/docs/components/data-table.md +45 -33
  159. package/docs/components/data-views-config-panel.md +18 -14
  160. package/docs/components/data-views-layout.md +20 -17
  161. package/docs/components/date-picker.md +30 -23
  162. package/docs/components/dialog.md +43 -42
  163. package/docs/components/divider.md +10 -4
  164. package/docs/components/drawer.md +8 -33
  165. package/docs/components/dropdown-menu.md +51 -32
  166. package/docs/components/field-hint.md +37 -25
  167. package/docs/components/field-section.md +9 -3
  168. package/docs/components/form-stepper.md +6 -0
  169. package/docs/components/form.md +17 -20
  170. package/docs/components/header-bar.md +187 -0
  171. package/docs/components/image-attachment.md +33 -41
  172. package/docs/components/inbox-view.md +16 -5
  173. package/docs/components/inner-label-field.md +34 -24
  174. package/docs/components/input-field.md +18 -10
  175. package/docs/components/input-otp.md +14 -11
  176. package/docs/components/input.md +22 -16
  177. package/docs/components/kanban-view.md +15 -5
  178. package/docs/components/label-field.md +32 -22
  179. package/docs/components/label.md +43 -32
  180. package/docs/components/labeled-check-box.md +16 -8
  181. package/docs/components/labeled-radio.md +18 -11
  182. package/docs/components/link-button.md +7 -1
  183. package/docs/components/login-button.md +8 -2
  184. package/docs/components/password-level.md +37 -24
  185. package/docs/components/popover.md +26 -23
  186. package/docs/components/profile-menu.md +38 -27
  187. package/docs/components/radio-card.md +16 -9
  188. package/docs/components/radio.md +16 -8
  189. package/docs/components/scroll-area.md +6 -2
  190. package/docs/components/search-field.md +14 -6
  191. package/docs/components/searchable-select.md +19 -14
  192. package/docs/components/searchable-table.md +60 -41
  193. package/docs/components/searchable-tree-dialog.md +190 -0
  194. package/docs/components/searchable-tree.md +200 -0
  195. package/docs/components/section-block.md +130 -4
  196. package/docs/components/select.md +23 -18
  197. package/docs/components/simple-select.md +14 -10
  198. package/docs/components/skeleton.md +43 -33
  199. package/docs/components/slide-date-picker.md +37 -29
  200. package/docs/components/spin-loading.md +32 -23
  201. package/docs/components/stepper.md +6 -0
  202. package/docs/components/switch.md +14 -6
  203. package/docs/components/tab-form-item.md +7 -1
  204. package/docs/components/tab-switch.md +13 -6
  205. package/docs/components/table-dnd-wrapper.md +105 -0
  206. package/docs/components/table-view.md +15 -5
  207. package/docs/components/table.md +28 -28
  208. package/docs/components/text-editor.md +19 -13
  209. package/docs/components/textarea.md +15 -7
  210. package/docs/components/timeline.md +6 -0
  211. package/docs/components/toast.md +35 -26
  212. package/docs/components/toggle-button.md +24 -21
  213. package/docs/components/toggle.md +23 -15
  214. package/docs/components/tooltip.md +42 -30
  215. package/docs/components/transparent-label.md +29 -20
  216. package/docs/components/tree-drop-down.md +31 -23
  217. package/docs/components/tree-sub-layout.md +6 -2
  218. package/docs/components/tree-view.md +16 -5
  219. package/docs/explanation/architecture.md +54 -0
  220. package/docs/explanation/design-system.md +52 -0
  221. package/docs/how-to/data-views-from-backend-response.md +7 -4
  222. package/docs/how-to/guides.md +24 -18
  223. package/docs/migration/changelog.md +38 -0
  224. package/docs/reference/cli.md +87 -0
  225. package/docs/reference/components.md +11 -12
  226. package/docs/reference/hooks.md +8 -8
  227. package/docs/reference/providers.md +22 -22
  228. package/docs/reference/tailwind-plugins.md +2 -2
  229. package/docs/reference/theme.md +85 -0
  230. package/docs/reference/types.md +4 -4
  231. package/docs/reference/utilities.md +19 -26
  232. package/docs/tutorials/building-first-form.md +20 -13
  233. package/docs/tutorials/component-composition.md +34 -50
  234. package/docs/tutorials/getting-started.md +2 -2
  235. package/docs/tutorials/theming-basics.md +13 -10
  236. package/package.json +31 -3
  237. package/dist/src/commands/block.d.ts +0 -5
  238. package/dist/src/commands/block.d.ts.map +0 -1
  239. package/dist/src/commands/block.js +0 -255
  240. package/dist/src/commands/block.js.map +0 -1
  241. package/dist/src/shared/configureFonts.d.ts +0 -6
  242. package/dist/src/shared/configureFonts.d.ts.map +0 -1
  243. package/dist/src/shared/configureFonts.js +0 -106
  244. package/dist/src/shared/configureFonts.js.map +0 -1
  245. package/dist/src/shared/configureGlobalCss.d.ts +0 -6
  246. package/dist/src/shared/configureGlobalCss.d.ts.map +0 -1
  247. package/dist/src/shared/configureGlobalCss.js +0 -154
  248. package/dist/src/shared/configureGlobalCss.js.map +0 -1
  249. package/dist/src/shared/configureTailwind.d.ts +0 -7
  250. package/dist/src/shared/configureTailwind.d.ts.map +0 -1
  251. package/dist/src/shared/configureTailwind.js +0 -163
  252. package/dist/src/shared/configureTailwind.js.map +0 -1
  253. package/dist/src/shared/detectFramework.d.ts +0 -23
  254. package/dist/src/shared/detectFramework.d.ts.map +0 -1
  255. package/dist/src/shared/detectFramework.js +0 -119
  256. package/dist/src/shared/detectFramework.js.map +0 -1
  257. package/dist/src/shared/installBaseUtils.d.ts +0 -5
  258. package/dist/src/shared/installBaseUtils.d.ts.map +0 -1
  259. package/dist/src/shared/installBaseUtils.js +0 -79
  260. package/dist/src/shared/installBaseUtils.js.map +0 -1
  261. package/dist/src/shared/resolveAliases.d.ts +0 -24
  262. package/dist/src/shared/resolveAliases.d.ts.map +0 -1
  263. package/dist/src/shared/resolveAliases.js +0 -98
  264. package/dist/src/shared/resolveAliases.js.map +0 -1
@@ -2,10 +2,10 @@ import { DateRange } from "react-day-picker";
2
2
  import { format } from "date-fns";
3
3
 
4
4
  export type TimePickerValue = {
5
- hour: string
6
- minute: string
7
- time: string
8
- }
5
+ hour: string;
6
+ minute: string;
7
+ time: string;
8
+ };
9
9
 
10
10
  /**
11
11
  * Applies time from a picker value to a given date object
@@ -14,19 +14,19 @@ export type TimePickerValue = {
14
14
  * @returns {Date} A new Date object with the applied time
15
15
  */
16
16
  export const applyTimeToDate = (date: Date, TimePickerValue: TimePickerValue): Date => {
17
- const newDate = new Date(date);
18
- let hours = parseInt(String(TimePickerValue.hour));
17
+ const newDate = new Date(date);
18
+ let hours = parseInt(String(TimePickerValue.hour));
19
19
 
20
- // Convert to 24-hour format
21
- if (TimePickerValue.time === "PM" && hours < 12) {
22
- hours += 12;
23
- } else if (TimePickerValue.time === "AM" && hours === 12) {
24
- hours = 0;
25
- }
20
+ // Convert to 24-hour format
21
+ if (TimePickerValue.time === "PM" && hours < 12) {
22
+ hours += 12;
23
+ } else if (TimePickerValue.time === "AM" && hours === 12) {
24
+ hours = 0;
25
+ }
26
26
 
27
- newDate.setHours(hours);
28
- newDate.setMinutes(parseInt(String(TimePickerValue.minute)));
29
- return newDate;
27
+ newDate.setHours(hours);
28
+ newDate.setMinutes(parseInt(String(TimePickerValue.minute)));
29
+ return newDate;
30
30
  };
31
31
 
32
32
  /**
@@ -34,7 +34,8 @@ export const applyTimeToDate = (date: Date, TimePickerValue: TimePickerValue): D
34
34
  * @param {Date} date - The date to validate
35
35
  * @returns {boolean} True if the value is a valid Date object, false otherwise
36
36
  */
37
- export const isValidDateObject = (date: Date): boolean => date instanceof Date && !isNaN(date.getTime());
37
+ export const isValidDateObject = (date: Date): boolean =>
38
+ date instanceof Date && !isNaN(date.getTime());
38
39
 
39
40
  /**
40
41
  * Applies time from a picker value to various date value types
@@ -42,29 +43,36 @@ export const isValidDateObject = (date: Date): boolean => date instanceof Date &
42
43
  * @param {TimePickerValue} TimePickerValue - Object containing hour, minute, and time period (AM/PM)
43
44
  * @returns {Date | Date[] | DateRange | undefined} The date value with applied time, or undefined if invalid
44
45
  */
45
- export const applyTimeToDateValue = (dateValue: Date | Date[] | DateRange | undefined, TimePickerValue: TimePickerValue): Date | Date[] | DateRange | undefined => {
46
- if (!dateValue) return undefined;
47
-
48
- // Handle array of dates
49
- if (Array.isArray(dateValue)) {
50
- return dateValue.filter(isValidDateObject).map(date => applyTimeToDate(date, TimePickerValue));
51
- }
46
+ export const applyTimeToDateValue = (
47
+ dateValue: Date | Date[] | DateRange | undefined,
48
+ TimePickerValue: TimePickerValue,
49
+ ): Date | Date[] | DateRange | undefined => {
50
+ if (!dateValue) return undefined;
52
51
 
53
- // Handle date range
54
- if (dateValue && 'from' in dateValue) {
55
- const from = dateValue.from && isValidDateObject(dateValue.from as Date)
56
- ? applyTimeToDate(dateValue.from as Date, TimePickerValue)
57
- : undefined;
58
- const to = dateValue.to && isValidDateObject(dateValue.to as Date)
59
- ? applyTimeToDate(dateValue.to as Date, TimePickerValue)
60
- : undefined;
61
- return { from, to };
62
- }
52
+ // Handle array of dates
53
+ if (Array.isArray(dateValue)) {
54
+ return dateValue
55
+ .filter(isValidDateObject)
56
+ .map((date) => applyTimeToDate(date, TimePickerValue));
57
+ }
63
58
 
64
- // Handle single date
65
- return isValidDateObject(dateValue as Date)
66
- ? applyTimeToDate(dateValue as Date, TimePickerValue)
59
+ // Handle date range
60
+ if (dateValue && "from" in dateValue) {
61
+ const from =
62
+ dateValue.from && isValidDateObject(dateValue.from as Date)
63
+ ? applyTimeToDate(dateValue.from as Date, TimePickerValue)
67
64
  : undefined;
65
+ const to =
66
+ dateValue.to && isValidDateObject(dateValue.to as Date)
67
+ ? applyTimeToDate(dateValue.to as Date, TimePickerValue)
68
+ : undefined;
69
+ return { from, to };
70
+ }
71
+
72
+ // Handle single date
73
+ return isValidDateObject(dateValue as Date)
74
+ ? applyTimeToDate(dateValue as Date, TimePickerValue)
75
+ : undefined;
68
76
  };
69
77
 
70
78
  /**
@@ -74,25 +82,27 @@ export const applyTimeToDateValue = (dateValue: Date | Date[] | DateRange | unde
74
82
  * @param {string} dateFormat - The format string to use for formatting (e.g., 'MM/dd/yyyy')
75
83
  * @returns {string} Formatted date string, or empty string if date is undefined
76
84
  */
77
- export const formatDateValueToString = (date: Date | Date[] | DateRange | undefined, TimePickerValue: TimePickerValue, dateFormat: string): string => {
78
- if (!date) return '';
85
+ export const formatDateValueToString = (
86
+ date: Date | Date[] | DateRange | undefined,
87
+ TimePickerValue: TimePickerValue,
88
+ dateFormat: string,
89
+ ): string => {
90
+ if (!date) return "";
79
91
 
80
- // Handle array of dates
81
- if (Array.isArray(date)) {
82
- return date.map(d => format(applyTimeToDate(d, TimePickerValue), dateFormat)).join(', ');
83
- }
92
+ // Handle array of dates
93
+ if (Array.isArray(date)) {
94
+ return date.map((d) => format(applyTimeToDate(d, TimePickerValue), dateFormat)).join(", ");
95
+ }
84
96
 
85
- // Handle date range
86
- if ('from' in date) {
87
- const from = date.from
88
- ? format(applyTimeToDate(date.from as Date, TimePickerValue), dateFormat)
89
- : '';
90
- const to = date.to
91
- ? format(applyTimeToDate(date.to as Date, TimePickerValue), dateFormat)
92
- : '';
93
- return from && to ? `${from} - ${to}` : from || to;
94
- }
97
+ // Handle date range
98
+ if ("from" in date) {
99
+ const from = date.from
100
+ ? format(applyTimeToDate(date.from as Date, TimePickerValue), dateFormat)
101
+ : "";
102
+ const to = date.to ? format(applyTimeToDate(date.to as Date, TimePickerValue), dateFormat) : "";
103
+ return from && to ? `${from} - ${to}` : from || to;
104
+ }
95
105
 
96
- // Handle single date
97
- return format(applyTimeToDate(date as Date, TimePickerValue), dateFormat);
106
+ // Handle single date
107
+ return format(applyTimeToDate(date as Date, TimePickerValue), dateFormat);
98
108
  };
@@ -81,10 +81,7 @@ export function convertInlineMarkdown(text: string): string {
81
81
  let result = text;
82
82
 
83
83
  // Images inline (rare in inline context but handle gracefully)
84
- result = result.replace(
85
- /!\[([^\]]*)\]\(([^)]+)\)/g,
86
- '<img src="$2" alt="$1">',
87
- );
84
+ result = result.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img src="$2" alt="$1">');
88
85
 
89
86
  // Links: [text](url)
90
87
  result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2">$1</a>');
@@ -173,9 +170,7 @@ export function parseMarkdownToBlocks(md: string): EditorBlock[] {
173
170
  type: "table",
174
171
  data: {
175
172
  withHeadings: tableRows.length > 1,
176
- content: tableRows.map((row) =>
177
- row.map((cell) => convertInlineMarkdown(cell.trim())),
178
- ),
173
+ content: tableRows.map((row) => row.map((cell) => convertInlineMarkdown(cell.trim()))),
179
174
  },
180
175
  });
181
176
  tableRows = [];
@@ -2,34 +2,30 @@ import { MutableRefObject, RefObject } from "react";
2
2
 
3
3
  // Extracted function to get the new width based on the mouse event
4
4
  export const calculateNewWidthFromMouse = (
5
- event: MouseEvent,
6
- resizableRef:
7
- | MutableRefObject<HTMLElement | null>
8
- | RefObject<HTMLElement | null>,
9
- isRtl: boolean
5
+ event: MouseEvent,
6
+ resizableRef: MutableRefObject<HTMLElement | null> | RefObject<HTMLElement | null>,
7
+ isRtl: boolean,
10
8
  ): number => {
11
- if (resizableRef.current) {
12
- const rect = resizableRef.current.getBoundingClientRect();
13
- return isRtl
14
- ? rect.right - event.clientX // Reverse calculation for RTL
15
- : event.clientX - rect.left;
16
- }
17
- return 0;
9
+ if (resizableRef.current) {
10
+ const rect = resizableRef.current.getBoundingClientRect();
11
+ return isRtl
12
+ ? rect.right - event.clientX // Reverse calculation for RTL
13
+ : event.clientX - rect.left;
14
+ }
15
+ return 0;
18
16
  };
19
17
 
20
18
  // Extracted function to get the new width based on the touch event
21
19
  export const calculateNewWidthFromTouch = (
22
- event: TouchEvent,
23
- resizableRef:
24
- | MutableRefObject<HTMLElement | null>
25
- | RefObject<HTMLElement | null>,
26
- isRtl: boolean
20
+ event: TouchEvent,
21
+ resizableRef: MutableRefObject<HTMLElement | null> | RefObject<HTMLElement | null>,
22
+ isRtl: boolean,
27
23
  ): number => {
28
- if (resizableRef.current) {
29
- const rect = resizableRef.current.getBoundingClientRect();
30
- return isRtl
31
- ? rect.right - event.touches[0].clientX // Reverse calculation for RTL
32
- : event.touches[0].clientX - rect.left;
33
- }
34
- return 0;
35
- };
24
+ if (resizableRef.current) {
25
+ const rect = resizableRef.current.getBoundingClientRect();
26
+ return isRtl
27
+ ? rect.right - event.touches[0].clientX // Reverse calculation for RTL
28
+ : event.touches[0].clientX - rect.left;
29
+ }
30
+ return 0;
31
+ };
@@ -1,16 +1,16 @@
1
1
  export type Themes = "dark" | "light" | "default";
2
2
 
3
3
  export type ButtonVariant =
4
- | "PrimeStyle"
5
- | "BluSecStyle"
6
- | "YelSecStyle"
7
- | "RedSecStyle"
8
- | "BorderStyle"
9
- | "PrimeContStyle"
10
- | "BluContStyle"
11
- | "RedContStyle"
12
- | "PrimeColStyle"
13
- | "BluColStyle"
14
- | "RedColStyle"
15
- | "GreenColStyle"
16
- | "YelColStyle";
4
+ | "PrimeStyle"
5
+ | "BluSecStyle"
6
+ | "YelSecStyle"
7
+ | "RedSecStyle"
8
+ | "BorderStyle"
9
+ | "PrimeContStyle"
10
+ | "BluContStyle"
11
+ | "RedContStyle"
12
+ | "PrimeColStyle"
13
+ | "BluColStyle"
14
+ | "RedColStyle"
15
+ | "GreenColStyle"
16
+ | "YelColStyle";
package/dist/bin/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "fs";
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
2
5
  import { Command } from "commander";
3
6
  import { add } from "../src/commands/add.js";
4
7
  import { initConfig } from "../src/commands/init.js";
@@ -8,14 +11,17 @@ import { addUtil } from "../src/commands/utils.js";
8
11
  import { addProvider } from "../src/commands/provider.js";
9
12
  import { updateInstalledComponents } from "../src/commands/update.js";
10
13
  import { setupMcp } from "../src/commands/mcp.js";
14
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
15
+ // Single source of truth: read the version from the published package.json.
16
+ const { version } = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../../package.json"), "utf-8"));
11
17
  const program = new Command();
12
18
  program
13
19
  .name("torch-glare")
14
20
  .description("Torch Glare for managing React components")
15
- .version("2.2.0");
21
+ .version(version);
16
22
  program
17
23
  .command("init")
18
- .description("Initialize torch.json configuration file")
24
+ .description("Initialize glare.json configuration file")
19
25
  .action(() => initConfig());
20
26
  program
21
27
  .command("add [component]")
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../cli/bin/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,aAAa,CAAC;KACnB,WAAW,CAAC,2CAA2C,CAAC;KACxD,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,C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OAAO,CAAC,KAAK,CAAC;KACd,WAAW,CAAC,kDAAkD,CAAC;KAC/D,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;AAE5B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getAvailableFiles.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/getAvailableFiles.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAEhE"}
1
+ {"version":3,"file":"getAvailableFiles.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/getAvailableFiles.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,EAAE,CAOhE"}
@@ -6,6 +6,11 @@ import path from "path";
6
6
  * @returns {string[]} - Array of component names.
7
7
  */
8
8
  export function getAvailableFiles(templatesDir) {
9
- return fs.readdirSync(templatesDir).map((file) => path.basename(file));
9
+ return fs
10
+ .readdirSync(templatesDir)
11
+ .map((file) => path.basename(file))
12
+ // "-dev" files are work-in-progress and excluded from the published package,
13
+ // so the CLI must never offer them.
14
+ .filter((file) => !/-dev\.(ts|tsx)$/.test(file));
10
15
  }
11
16
  //# sourceMappingURL=getAvailableFiles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAvailableFiles.js","sourceRoot":"","sources":["../../../cli/src/shared/getAvailableFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB;IAClD,OAAO,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"file":"getAvailableFiles.js","sourceRoot":"","sources":["../../../cli/src/shared/getAvailableFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,YAAoB;IAClD,OAAO,EAAE;SACJ,WAAW,CAAC,YAAY,CAAC;SACzB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,6EAA6E;QAC7E,oCAAoC;SACnC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Registry } from "../types/main.js";
2
+ /**
3
+ * Load and cache the generated component registry.
4
+ * @returns {Registry} The parsed registry manifest.
5
+ */
6
+ export declare function loadRegistry(): Registry;
7
+ //# sourceMappingURL=loadRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadRegistry.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/loadRegistry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAW5C;;;GAGG;AACH,wBAAgB,YAAY,IAAI,QAAQ,CAkBvC"}
@@ -0,0 +1,31 @@
1
+ import fs from "fs";
2
+ import path from "path";
3
+ import { fileURLToPath } from "url";
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = path.dirname(__filename);
6
+ // registry.json ships alongside the library source (apps/lib), the same location the
7
+ // command modules resolve their template dirs from.
8
+ const REGISTRY_PATH = path.resolve(__dirname, "../../../apps/lib/registry.json");
9
+ let cached = null;
10
+ /**
11
+ * Load and cache the generated component registry.
12
+ * @returns {Registry} The parsed registry manifest.
13
+ */
14
+ export function loadRegistry() {
15
+ if (cached)
16
+ return cached;
17
+ if (!fs.existsSync(REGISTRY_PATH)) {
18
+ console.error("❌ registry.json not found. It is generated from library source via " +
19
+ "`node scripts/bin/generateRegistry/index.js`.");
20
+ process.exit(1);
21
+ }
22
+ try {
23
+ cached = JSON.parse(fs.readFileSync(REGISTRY_PATH, "utf-8"));
24
+ return cached;
25
+ }
26
+ catch (error) {
27
+ console.error("❌ Error reading registry.json:", error.message);
28
+ process.exit(1);
29
+ }
30
+ }
31
+ //# sourceMappingURL=loadRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadRegistry.js","sourceRoot":"","sources":["../../../cli/src/shared/loadRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAGpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,qFAAqF;AACrF,oDAAoD;AACpD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,iCAAiC,CAAC,CAAC;AAEjF,IAAI,MAAM,GAAoB,IAAI,CAAC;AAEnC;;;GAGG;AACH,MAAM,UAAU,YAAY;IACxB,IAAI,MAAM;QAAE,OAAO,MAAM,CAAC;IAE1B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CACT,qEAAqE;YACjE,+CAA+C,CACtD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED,IAAI,CAAC;QACD,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAa,CAAC;QACzE,OAAO,MAAM,CAAC;IAClB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { InstallPlan, Registry } from "../types/main.js";
2
+ /**
3
+ * Resolve the full install plan for a single registry item: the transitive closure of
4
+ * its internal (registry) dependencies plus the union of all npm dependencies along the way.
5
+ *
6
+ * @param {Registry} registry - The loaded registry manifest.
7
+ * @param {string} type - The item type (folder name), e.g. "components".
8
+ * @param {string} name - The item name without extension, e.g. "Select".
9
+ * @returns {InstallPlan | null} The plan, or null if the entry item is not in the registry.
10
+ */
11
+ export declare function resolveInstallPlan(registry: Registry, type: string, name: string): InstallPlan | null;
12
+ //# sourceMappingURL=resolveInstallPlan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveInstallPlan.d.ts","sourceRoot":"","sources":["../../../cli/src/shared/resolveInstallPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAgB,MAAM,kBAAkB,CAAC;AAE5E;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACb,WAAW,GAAG,IAAI,CA4BpB"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Resolve the full install plan for a single registry item: the transitive closure of
3
+ * its internal (registry) dependencies plus the union of all npm dependencies along the way.
4
+ *
5
+ * @param {Registry} registry - The loaded registry manifest.
6
+ * @param {string} type - The item type (folder name), e.g. "components".
7
+ * @param {string} name - The item name without extension, e.g. "Select".
8
+ * @returns {InstallPlan | null} The plan, or null if the entry item is not in the registry.
9
+ */
10
+ export function resolveInstallPlan(registry, type, name) {
11
+ const byRef = new Map();
12
+ for (const item of registry.items)
13
+ byRef.set(`${item.type}/${item.name}`, item);
14
+ const entry = byRef.get(`${type}/${name}`);
15
+ if (!entry)
16
+ return null;
17
+ const items = [];
18
+ const npmDependencies = new Set();
19
+ const visited = new Set();
20
+ const stack = [`${type}/${name}`];
21
+ while (stack.length) {
22
+ const ref = stack.pop();
23
+ if (visited.has(ref))
24
+ continue;
25
+ visited.add(ref);
26
+ const item = byRef.get(ref);
27
+ if (!item)
28
+ continue; // dangling refs are validated at generation time; skip defensively
29
+ items.push(item);
30
+ for (const dep of item.npmDependencies)
31
+ npmDependencies.add(dep);
32
+ for (const dep of item.registryDependencies) {
33
+ if (!visited.has(dep))
34
+ stack.push(dep);
35
+ }
36
+ }
37
+ return { items, npmDependencies };
38
+ }
39
+ //# sourceMappingURL=resolveInstallPlan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveInstallPlan.js","sourceRoot":"","sources":["../../../cli/src/shared/resolveInstallPlan.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAC9B,QAAkB,EAClB,IAAY,EACZ,IAAY;IAEZ,MAAM,KAAK,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC9C,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK;QAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;IAEhF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAExB,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,MAAM,eAAe,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAY,CAAC;QAClC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC/B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEjB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI;YAAE,SAAS,CAAC,mEAAmE;QAExF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,eAAe;YAAE,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjE,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3C,CAAC;IACL,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC;AACtC,CAAC"}
@@ -5,4 +5,28 @@ export interface DependenciesInfo {
5
5
  depsNames: Set<string>;
6
6
  depsNamesAndVersions: Record<string, string>;
7
7
  }
8
+ /** A single entry in apps/lib/registry.json. */
9
+ export interface RegistryItem {
10
+ name: string;
11
+ /** Folder name, which doubles as the CLI install sub-folder. */
12
+ type: "components" | "hooks" | "utils" | "layouts" | "providers";
13
+ /** Source path relative to apps/lib, e.g. "components/Select.tsx". */
14
+ path: string;
15
+ /** External npm packages this item imports (normalized install names). */
16
+ npmDependencies: string[];
17
+ /** Other registry items it depends on, as "type/name" refs. */
18
+ registryDependencies: string[];
19
+ }
20
+ export interface Registry {
21
+ version: string;
22
+ generatedBy: string;
23
+ items: RegistryItem[];
24
+ }
25
+ /** Fully resolved set of work needed to install one item. */
26
+ export interface InstallPlan {
27
+ /** All items (entry + transitive internal deps) that must be copied. */
28
+ items: RegistryItem[];
29
+ /** Union of every item's npm dependencies. */
30
+ npmDependencies: Set<string>;
31
+ }
8
32
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../cli/src/types/main.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC;CAEhB;AAED,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../cli/src/types/main.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,IAAI,EAAE,MAAM,CAAC;CAEhB;AAED,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD;AAED,gDAAgD;AAChD,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;IACjE,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,+DAA+D;IAC/D,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,YAAY,EAAE,CAAC;CACzB;AAED,6DAA6D;AAC7D,MAAM,WAAW,WAAW;IACxB,wEAAwE;IACxE,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,8CAA8C;IAC9C,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAChC"}
package/docs/README.md CHANGED
@@ -24,7 +24,7 @@ npx torch-glare@latest init
24
24
 
25
25
  This command will:
26
26
  - Create or modify the `tailwind.config.js` file to support Tailwind CSS for Tailwind versions less then 4.
27
- - Generate a `torch.json` file where you can customize the installation path for components.
27
+ - Generate a `glare.json` file where you can customize the installation path for components.
28
28
 
29
29
  ### Tailwind CSS Requirement
30
30
  Ensure that Tailwind CSS is installed in your project before running the initialization command.
@@ -108,7 +108,7 @@ export default App;
108
108
  ```sh
109
109
  npx torch-glare@latest init
110
110
  ```
111
- - Creates a `torch.json` configuration file.
111
+ - Creates a `glare.json` configuration file.
112
112
  - Create or modify `tailwind.config.ts` file for tailwind support.
113
113
 
114
114
  ### Add Components
@@ -135,6 +135,14 @@ npx torch-glare@latest provider [provider]
135
135
  ```
136
136
  Adds a specific provider or runs an interactive prompt if no name is provided.
137
137
 
138
+ ### Add Layouts
139
+ ```sh
140
+ npx torch-glare@latest layout [layout]
141
+ ```
142
+ Adds a specific layout or runs an interactive prompt if no name is provided.
143
+
144
+ > Component names are case-sensitive and PascalCase (e.g. `add DatePicker`).
145
+
138
146
  ### Update Installed Resources
139
147
 
140
148
  ```sh