torch-glare 2.4.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.
- package/README.md +8 -0
- package/apps/lib/components/ActionButton.tsx +7 -12
- package/apps/lib/components/ActionsGroup.tsx +4 -15
- package/apps/lib/components/AlertDialog.tsx +173 -191
- package/apps/lib/components/Avatar.tsx +13 -16
- package/apps/lib/components/Badge.tsx +1 -3
- package/apps/lib/components/BadgeField.tsx +76 -71
- package/apps/lib/components/Breadcrumb.tsx +49 -85
- package/apps/lib/components/Button.tsx +20 -19
- package/apps/lib/components/ButtonGroup.tsx +31 -41
- package/apps/lib/components/Calendar.tsx +51 -29
- package/apps/lib/components/Card.tsx +2 -13
- package/apps/lib/components/ChartBlockTool.ts +17 -52
- package/apps/lib/components/Checkbox.tsx +9 -16
- package/apps/lib/components/ContextMenu.tsx +97 -96
- package/apps/lib/components/CountBadge.tsx +4 -6
- package/apps/lib/components/DataTable.tsx +196 -216
- package/apps/lib/components/DataViews/DataViewRadio.tsx +1 -6
- package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +13 -47
- package/apps/lib/components/DataViews/DataViewsHeader.tsx +1 -3
- package/apps/lib/components/DataViews/DataViewsLayout.tsx +5 -12
- package/apps/lib/components/DataViews/FilterPanel.tsx +155 -149
- package/apps/lib/components/DataViews/HeaderSearch.tsx +1 -5
- package/apps/lib/components/DataViews/InboxView.tsx +22 -68
- package/apps/lib/components/DataViews/InboxViewCard.tsx +68 -77
- package/apps/lib/components/DataViews/KanbanView.tsx +8 -25
- package/apps/lib/components/DataViews/PanelControls.tsx +3 -13
- package/apps/lib/components/DataViews/SettingsPanel.tsx +83 -89
- package/apps/lib/components/DataViews/TableView.tsx +8 -28
- package/apps/lib/components/DataViews/TreeView.tsx +12 -40
- package/apps/lib/components/DataViews/badgeAdapter.ts +32 -28
- package/apps/lib/components/DataViews/fieldRenderers.tsx +106 -141
- package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +30 -23
- package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +39 -32
- package/apps/lib/components/DataViews/filters/PresetChips.tsx +15 -15
- package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +69 -58
- package/apps/lib/components/DataViews/index.ts +26 -26
- package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +12 -16
- package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +28 -31
- package/apps/lib/components/DataViews/types.ts +104 -115
- package/apps/lib/components/DatePicker.tsx +198 -196
- package/apps/lib/components/Dialog.tsx +92 -105
- package/apps/lib/components/Divider.tsx +21 -24
- package/apps/lib/components/Drawer.tsx +79 -139
- package/apps/lib/components/DropdownMenu.tsx +131 -171
- package/apps/lib/components/FieldHint.tsx +4 -11
- package/apps/lib/components/Form.tsx +146 -155
- package/apps/lib/components/FormStepper.tsx +9 -39
- package/apps/lib/components/HeaderBar.tsx +1 -9
- package/apps/lib/components/ImageAttachment.tsx +111 -73
- package/apps/lib/components/InnerLabelField.tsx +20 -16
- package/apps/lib/components/Input.tsx +171 -172
- package/apps/lib/components/InputField.tsx +44 -45
- package/apps/lib/components/InputOTP.tsx +68 -69
- package/apps/lib/components/Label.tsx +31 -35
- package/apps/lib/components/LabelField.tsx +4 -5
- package/apps/lib/components/LabeledCheckBox.tsx +8 -12
- package/apps/lib/components/LabeledRadio.tsx +7 -5
- package/apps/lib/components/LinkButton.tsx +2 -9
- package/apps/lib/components/LoginButton.tsx +4 -9
- package/apps/lib/components/PasswordLevel.tsx +5 -5
- package/apps/lib/components/Popover.tsx +15 -33
- package/apps/lib/components/ProfileMenu.tsx +67 -72
- package/apps/lib/components/Radio.tsx +1 -5
- package/apps/lib/components/RadioCard.tsx +9 -28
- package/apps/lib/components/ScrollArea.tsx +45 -43
- package/apps/lib/components/SearchField.tsx +49 -39
- package/apps/lib/components/SearchableSelect.tsx +8 -14
- package/apps/lib/components/SearchableTable.tsx +108 -118
- package/apps/lib/components/SearchableTree.tsx +469 -0
- package/apps/lib/components/SearchableTreeDialog.tsx +493 -0
- package/apps/lib/components/SectionBlock.tsx +4 -16
- package/apps/lib/components/Select.tsx +53 -80
- package/apps/lib/components/SimpleSelect.tsx +196 -187
- package/apps/lib/components/Skeleton.tsx +9 -12
- package/apps/lib/components/SlideDatePicker.tsx +215 -166
- package/apps/lib/components/SpinLoading.tsx +33 -49
- package/apps/lib/components/Stepper.tsx +13 -56
- package/apps/lib/components/Switch.tsx +8 -10
- package/apps/lib/components/TabFormItem.tsx +3 -12
- package/apps/lib/components/TabSwitch.tsx +7 -34
- package/apps/lib/components/Table.tsx +60 -75
- package/apps/lib/components/TableDnDWrapper.ts +15 -48
- package/apps/lib/components/TextEditor.tsx +93 -104
- package/apps/lib/components/Textarea.tsx +8 -12
- package/apps/lib/components/Timeline.tsx +21 -41
- package/apps/lib/components/Toast.tsx +83 -83
- package/apps/lib/components/Toggle.tsx +112 -114
- package/apps/lib/components/ToggleButton.tsx +1 -1
- package/apps/lib/components/Tooltip.tsx +24 -19
- package/apps/lib/components/TransparentLabel.tsx +61 -62
- package/apps/lib/components/TreeDropDown.tsx +86 -52
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +15 -48
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +16 -21
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +9 -20
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +3 -3
- package/apps/lib/components/TreeFolder/icons.tsx +14 -17
- package/apps/lib/components/TreeFolder/index.ts +15 -8
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +47 -52
- package/apps/lib/components/TreeFolder/types.ts +32 -32
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +117 -123
- package/apps/lib/hooks/useActiveTreeItem.ts +52 -55
- package/apps/lib/hooks/useClickOutside.ts +21 -20
- package/apps/lib/hooks/useDataViewsState.ts +86 -80
- package/apps/lib/hooks/useIsMobile.ts +12 -12
- package/apps/lib/hooks/useResize.ts +54 -65
- package/apps/lib/hooks/useTagSelection.ts +201 -201
- package/apps/lib/layouts/CNLayout.tsx +181 -140
- package/apps/lib/layouts/DataViewCard.tsx +4 -18
- package/apps/lib/layouts/FieldSection.tsx +2 -6
- package/apps/lib/layouts/TreeSubLayout.tsx +24 -38
- package/apps/lib/providers/ThemeProvider.tsx +8 -23
- package/apps/lib/registry.json +1004 -0
- package/apps/lib/tsconfig.json +9 -0
- package/apps/lib/utils/cn.ts +1 -1
- package/apps/lib/utils/dataViews/columnUtils.ts +46 -44
- package/apps/lib/utils/dataViews/fieldUtils.ts +70 -71
- package/apps/lib/utils/dataViews/nestedDataUtils.tsx +129 -122
- package/apps/lib/utils/dataViews/pathUtils.ts +74 -67
- package/apps/lib/utils/dataViews/rangeUtils.ts +121 -112
- package/apps/lib/utils/dataViews/treeUtils.ts +204 -211
- package/apps/lib/utils/dateFormat.ts +64 -54
- package/apps/lib/utils/markdownParser.ts +2 -7
- package/apps/lib/utils/resize.ts +21 -25
- package/apps/lib/utils/types.ts +13 -13
- package/dist/bin/index.js +8 -2
- package/dist/bin/index.js.map +1 -1
- package/dist/src/shared/getAvailableFiles.d.ts.map +1 -1
- package/dist/src/shared/getAvailableFiles.js +6 -1
- package/dist/src/shared/getAvailableFiles.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +7 -0
- package/dist/src/shared/loadRegistry.d.ts.map +1 -0
- package/dist/src/shared/loadRegistry.js +31 -0
- package/dist/src/shared/loadRegistry.js.map +1 -0
- package/dist/src/shared/resolveInstallPlan.d.ts +12 -0
- package/dist/src/shared/resolveInstallPlan.d.ts.map +1 -0
- package/dist/src/shared/resolveInstallPlan.js +39 -0
- package/dist/src/shared/resolveInstallPlan.js.map +1 -0
- package/dist/src/types/main.d.ts +24 -0
- package/dist/src/types/main.d.ts.map +1 -1
- package/docs/README.md +10 -2
- package/docs/components/action-button.md +30 -24
- package/docs/components/actions-group.md +26 -20
- package/docs/components/alert-dialog.md +45 -45
- package/docs/components/avatar.md +6 -2
- package/docs/components/badge-field.md +6 -2
- package/docs/components/badge.md +7 -1
- package/docs/components/breadcrumb.md +15 -40
- package/docs/components/button-group.md +13 -10
- package/docs/components/button.md +58 -33
- package/docs/components/calendar.md +26 -19
- package/docs/components/card.md +19 -16
- package/docs/components/chart-block-tool.md +128 -0
- package/docs/components/checkbox.md +16 -8
- package/docs/components/cn-layout.md +7 -1
- package/docs/components/context-menu.md +18 -25
- package/docs/components/count-badge.md +7 -1
- package/docs/components/data-table.md +45 -33
- package/docs/components/data-views-config-panel.md +15 -11
- package/docs/components/data-views-layout.md +13 -16
- package/docs/components/date-picker.md +30 -23
- package/docs/components/dialog.md +43 -42
- package/docs/components/divider.md +10 -4
- package/docs/components/drawer.md +8 -33
- package/docs/components/dropdown-menu.md +25 -34
- package/docs/components/field-hint.md +37 -25
- package/docs/components/field-section.md +9 -3
- package/docs/components/form-stepper.md +6 -0
- package/docs/components/form.md +17 -20
- package/docs/components/header-bar.md +6 -0
- package/docs/components/image-attachment.md +33 -41
- package/docs/components/inbox-view.md +16 -5
- package/docs/components/inner-label-field.md +34 -24
- package/docs/components/input-field.md +18 -10
- package/docs/components/input-otp.md +14 -11
- package/docs/components/input.md +22 -16
- package/docs/components/kanban-view.md +15 -5
- package/docs/components/label-field.md +32 -22
- package/docs/components/label.md +43 -32
- package/docs/components/labeled-check-box.md +16 -8
- package/docs/components/labeled-radio.md +18 -11
- package/docs/components/link-button.md +7 -1
- package/docs/components/login-button.md +8 -2
- package/docs/components/password-level.md +37 -24
- package/docs/components/popover.md +26 -23
- package/docs/components/profile-menu.md +38 -27
- package/docs/components/radio-card.md +16 -9
- package/docs/components/radio.md +16 -8
- package/docs/components/scroll-area.md +6 -2
- package/docs/components/search-field.md +14 -6
- package/docs/components/searchable-select.md +19 -14
- package/docs/components/searchable-table.md +18 -13
- package/docs/components/searchable-tree-dialog.md +190 -0
- package/docs/components/searchable-tree.md +200 -0
- package/docs/components/section-block.md +12 -4
- package/docs/components/select.md +23 -18
- package/docs/components/simple-select.md +14 -10
- package/docs/components/skeleton.md +43 -33
- package/docs/components/slide-date-picker.md +37 -29
- package/docs/components/spin-loading.md +32 -23
- package/docs/components/stepper.md +6 -0
- package/docs/components/switch.md +14 -6
- package/docs/components/tab-form-item.md +7 -1
- package/docs/components/tab-switch.md +13 -6
- package/docs/components/table-dnd-wrapper.md +105 -0
- package/docs/components/table-view.md +15 -5
- package/docs/components/table.md +28 -28
- package/docs/components/text-editor.md +19 -13
- package/docs/components/textarea.md +15 -7
- package/docs/components/timeline.md +6 -0
- package/docs/components/toast.md +35 -26
- package/docs/components/toggle-button.md +24 -21
- package/docs/components/toggle.md +23 -15
- package/docs/components/tooltip.md +42 -30
- package/docs/components/transparent-label.md +29 -20
- package/docs/components/tree-drop-down.md +31 -23
- package/docs/components/tree-sub-layout.md +6 -2
- package/docs/components/tree-view.md +16 -5
- package/docs/explanation/architecture.md +54 -0
- package/docs/explanation/design-system.md +52 -0
- package/docs/how-to/data-views-from-backend-response.md +6 -4
- package/docs/how-to/guides.md +24 -18
- package/docs/migration/changelog.md +38 -0
- package/docs/reference/cli.md +87 -0
- package/docs/reference/components.md +11 -12
- package/docs/reference/hooks.md +8 -8
- package/docs/reference/providers.md +22 -22
- package/docs/reference/tailwind-plugins.md +2 -2
- package/docs/reference/theme.md +85 -0
- package/docs/reference/types.md +4 -4
- package/docs/reference/utilities.md +19 -26
- package/docs/tutorials/building-first-form.md +20 -13
- package/docs/tutorials/component-composition.md +34 -50
- package/docs/tutorials/getting-started.md +2 -2
- package/docs/tutorials/theming-basics.md +13 -10
- package/package.json +31 -3
- package/dist/src/commands/block.d.ts +0 -5
- package/dist/src/commands/block.d.ts.map +0 -1
- package/dist/src/commands/block.js +0 -255
- package/dist/src/commands/block.js.map +0 -1
- package/dist/src/shared/configureFonts.d.ts +0 -6
- package/dist/src/shared/configureFonts.d.ts.map +0 -1
- package/dist/src/shared/configureFonts.js +0 -106
- package/dist/src/shared/configureFonts.js.map +0 -1
- package/dist/src/shared/configureGlobalCss.d.ts +0 -6
- package/dist/src/shared/configureGlobalCss.d.ts.map +0 -1
- package/dist/src/shared/configureGlobalCss.js +0 -154
- package/dist/src/shared/configureGlobalCss.js.map +0 -1
- package/dist/src/shared/configureTailwind.d.ts +0 -7
- package/dist/src/shared/configureTailwind.d.ts.map +0 -1
- package/dist/src/shared/configureTailwind.js +0 -163
- package/dist/src/shared/configureTailwind.js.map +0 -1
- package/dist/src/shared/detectFramework.d.ts +0 -23
- package/dist/src/shared/detectFramework.d.ts.map +0 -1
- package/dist/src/shared/detectFramework.js +0 -119
- package/dist/src/shared/detectFramework.js.map +0 -1
- package/dist/src/shared/installBaseUtils.d.ts +0 -5
- package/dist/src/shared/installBaseUtils.d.ts.map +0 -1
- package/dist/src/shared/installBaseUtils.js +0 -79
- package/dist/src/shared/installBaseUtils.js.map +0 -1
- package/dist/src/shared/resolveAliases.d.ts +0 -24
- package/dist/src/shared/resolveAliases.d.ts.map +0 -1
- package/dist/src/shared/resolveAliases.js +0 -98
- 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
18
|
-
|
|
17
|
+
const newDate = new Date(date);
|
|
18
|
+
let hours = parseInt(String(TimePickerValue.hour));
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 =>
|
|
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 = (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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 = (
|
|
78
|
-
|
|
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
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
97
|
-
|
|
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 = [];
|
package/apps/lib/utils/resize.ts
CHANGED
|
@@ -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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
+
};
|
package/apps/lib/utils/types.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export type Themes = "dark" | "light" | "default";
|
|
2
2
|
|
|
3
3
|
export type ButtonVariant =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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(
|
|
21
|
+
.version(version);
|
|
16
22
|
program
|
|
17
23
|
.command("init")
|
|
18
|
-
.description("Initialize
|
|
24
|
+
.description("Initialize glare.json configuration file")
|
|
19
25
|
.action(() => initConfig());
|
|
20
26
|
program
|
|
21
27
|
.command("add [component]")
|
package/dist/bin/index.js.map
CHANGED
|
@@ -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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C,QAAQ,IAAI,GAAG,QAAQ,EAAE,CAAC,CAAC,CAAC;AAEhE,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,6BAA6B,CAAC;KAC1C,MAAM,CAAC,GAAG,EAAE,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAE7C,OAAO;KACJ,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,
|
|
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
|
|
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,
|
|
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 @@
|
|
|
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 @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AAG,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"}
|
package/dist/src/types/main.d.ts
CHANGED
|
@@ -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 `
|
|
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 `
|
|
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
|