alepha 0.10.5 → 0.10.7

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/ui.d.ts ADDED
@@ -0,0 +1,300 @@
1
+ import * as _alepha_core0 from "alepha";
2
+ import { TObject } from "alepha";
3
+ import * as _alepha_react0 from "alepha/react";
4
+ import { RouterGoOptions, UseActiveOptions } from "alepha/react";
5
+ import * as _mantine_notifications0 from "@mantine/notifications";
6
+ import { NotificationData, NotificationsProps } from "@mantine/notifications";
7
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
8
+ import { AutocompleteProps, ButtonProps, ColorInputProps, ColorSchemeScriptProps, FileInputProps, Flex, MantineProviderProps, MultiSelectProps, NumberInputProps, PasswordInputProps, SegmentedControlProps, SelectProps, SwitchProps, TagsInputProps, TextInputProps, TextareaProps } from "@mantine/core";
9
+ import { FormModel, InputField } from "alepha/react/form";
10
+ import { ComponentType, ReactNode } from "react";
11
+ import { ModalsProviderProps } from "@mantine/modals";
12
+ import { NavigationProgressProps } from "@mantine/nprogress";
13
+ import { SpotlightActionData } from "@mantine/spotlight";
14
+ import { DateInputProps, DateTimePickerProps, TimeInputProps } from "@mantine/dates";
15
+
16
+ //#region src/components/Control.d.ts
17
+ interface ControlProps extends GenericControlProps {
18
+ text?: TextInputProps;
19
+ area?: boolean | TextareaProps;
20
+ select?: boolean | SelectProps;
21
+ autocomplete?: boolean | AutocompleteProps;
22
+ password?: boolean | PasswordInputProps;
23
+ switch?: boolean | SwitchProps;
24
+ segmented?: boolean | Partial<SegmentedControlProps>;
25
+ number?: boolean | NumberInputProps;
26
+ file?: boolean | FileInputProps;
27
+ color?: boolean | ColorInputProps;
28
+ date?: boolean | DateInputProps;
29
+ datetime?: boolean | DateTimePickerProps;
30
+ time?: boolean | TimeInputProps;
31
+ custom?: ComponentType<CustomControlProps>;
32
+ }
33
+ /**
34
+ * Generic form control that renders the appropriate input based on the schema and props.
35
+ *
36
+ * Supports:
37
+ * - TextInput (with format detection: email, url, tel)
38
+ * - Textarea
39
+ * - NumberInput (for number/integer types)
40
+ * - FileInput
41
+ * - ColorInput (for color format)
42
+ * - Select (for enum types)
43
+ * - Autocomplete
44
+ * - PasswordInput
45
+ * - Switch (for boolean types)
46
+ * - SegmentedControl (for enum types)
47
+ * - DateInput (for date format)
48
+ * - DateTimePicker (for date-time format)
49
+ * - TimeInput (for time format)
50
+ * - Custom component
51
+ *
52
+ * Automatically handles labels, descriptions, error messages, required state, and default icons.
53
+ */
54
+ declare const Control: (props: ControlProps) => react_jsx_runtime0.JSX.Element | null;
55
+ interface GenericControlProps {
56
+ input: InputField;
57
+ title?: string;
58
+ description?: string;
59
+ icon?: ReactNode;
60
+ }
61
+ type CustomControlProps = {
62
+ defaultValue: any;
63
+ onChange: (value: any) => void;
64
+ };
65
+ //#endregion
66
+ //#region src/components/Action.d.ts
67
+ interface ActionCommonProps extends ButtonProps {
68
+ children?: ReactNode;
69
+ textVisibleFrom?: "xs" | "sm" | "md" | "lg" | "xl";
70
+ /**
71
+ * If set, a confirmation dialog will be shown before performing the action.
72
+ * If `true`, a default title and message will be used.
73
+ * If a string, it will be used as the message with a default title.
74
+ * If an object, it can contain `title` and `message` properties to customize the dialog.
75
+ */
76
+ confirm?: boolean | string | {
77
+ title?: string;
78
+ message: string;
79
+ };
80
+ }
81
+ type ActionProps = ActionCommonProps & (ActiveHrefProps | ActionClickProps | ActionSubmitProps | {});
82
+ declare const Action: (_props: ActionProps) => react_jsx_runtime0.JSX.Element;
83
+ interface ActionSubmitProps extends ButtonProps {
84
+ form: FormModel<any>;
85
+ }
86
+ interface ActionClickProps extends ButtonProps {
87
+ onClick: (e: any) => any;
88
+ }
89
+ interface ActiveHrefProps extends ButtonProps {
90
+ href: string;
91
+ active?: Partial<UseActiveOptions> | false;
92
+ routerGoOptions?: RouterGoOptions;
93
+ }
94
+ //#endregion
95
+ //#region src/components/Omnibar.d.ts
96
+ interface OmnibarProps {
97
+ actions?: SpotlightActionData[];
98
+ shortcut?: string | string[];
99
+ searchPlaceholder?: string;
100
+ nothingFound?: ReactNode;
101
+ }
102
+ declare const Omnibar: (props: OmnibarProps) => react_jsx_runtime0.JSX.Element;
103
+ //#endregion
104
+ //#region src/components/AlephaMantineProvider.d.ts
105
+ interface AlephaMantineProviderProps {
106
+ children?: ReactNode;
107
+ mantine?: MantineProviderProps;
108
+ colorSchemeScript?: ColorSchemeScriptProps;
109
+ navigationProgress?: NavigationProgressProps;
110
+ notifications?: NotificationsProps;
111
+ modals?: ModalsProviderProps;
112
+ omnibar?: OmnibarProps;
113
+ }
114
+ declare const AlephaMantineProvider: (props: AlephaMantineProviderProps) => react_jsx_runtime0.JSX.Element;
115
+ //#endregion
116
+ //#region src/components/ControlDate.d.ts
117
+ interface ControlDateProps extends GenericControlProps {
118
+ date?: boolean | DateInputProps;
119
+ datetime?: boolean | DateTimePickerProps;
120
+ time?: boolean | TimeInputProps;
121
+ }
122
+ /**
123
+ * ControlDate component for handling date, datetime, and time inputs.
124
+ *
125
+ * Features:
126
+ * - DateInput for date format
127
+ * - DateTimePicker for date-time format
128
+ * - TimeInput for time format
129
+ *
130
+ * Automatically detects date formats from schema and renders appropriate picker.
131
+ */
132
+ declare const ControlDate: (props: ControlDateProps) => react_jsx_runtime0.JSX.Element | null;
133
+ //#endregion
134
+ //#region src/components/ControlSelect.d.ts
135
+ interface ControlSelectProps extends GenericControlProps {
136
+ select?: boolean | SelectProps;
137
+ multi?: boolean | MultiSelectProps;
138
+ tags?: boolean | TagsInputProps;
139
+ }
140
+ /**
141
+ * ControlSelect component for handling Select, MultiSelect, and TagsInput.
142
+ *
143
+ * Features:
144
+ * - Basic Select with enum support
145
+ * - MultiSelect for array of enums
146
+ * - TagsInput for array of strings (no enum)
147
+ * - Future: Lazy loading
148
+ * - Future: Searchable/filterable options
149
+ * - Future: Custom option rendering
150
+ *
151
+ * Automatically detects enum values and array types from schema.
152
+ */
153
+ declare const ControlSelect: (props: ControlSelectProps) => react_jsx_runtime0.JSX.Element | null;
154
+ //#endregion
155
+ //#region src/components/DarkModeButton.d.ts
156
+ interface DarkModeButtonProps {
157
+ mode?: "minimal" | "segmented";
158
+ size?: string | number;
159
+ variant?: "filled" | "light" | "outline" | "default" | "subtle" | "transparent";
160
+ }
161
+ declare const DarkModeButton: (props: DarkModeButtonProps) => react_jsx_runtime0.JSX.Element;
162
+ //#endregion
163
+ //#region src/components/TypeForm.d.ts
164
+ interface TypeFormProps<T$1 extends TObject> {
165
+ form: FormModel<T$1>;
166
+ columns?: number | {
167
+ base?: number;
168
+ xs?: number;
169
+ sm?: number;
170
+ md?: number;
171
+ lg?: number;
172
+ xl?: number;
173
+ };
174
+ children?: (input: FormModel<T$1>["input"]) => ReactNode;
175
+ controlProps?: Partial<Omit<ControlProps, "input">>;
176
+ skipFormElement?: boolean;
177
+ skipSubmitButton?: boolean;
178
+ submitButtonProps?: Partial<Omit<ActionSubmitProps, "form">>;
179
+ }
180
+ /**
181
+ * TypeForm component that automatically renders all form inputs based on schema.
182
+ * Uses the Control component to render individual fields and Mantine Grid for responsive layout.
183
+ *
184
+ * @example
185
+ * ```tsx
186
+ * import { t } from "alepha";
187
+ * import { useForm } from "alepha/react/form";
188
+ * import { TypeForm } from "alepha/ui";
189
+ *
190
+ * const form = useForm({
191
+ * schema: t.object({
192
+ * username: t.text(),
193
+ * email: t.text(),
194
+ * age: t.integer(),
195
+ * subscribe: t.boolean(),
196
+ * }),
197
+ * handler: (values) => {
198
+ * console.log(values);
199
+ * },
200
+ * });
201
+ *
202
+ * return <TypeForm form={form} columns={2} />;
203
+ * ```
204
+ */
205
+ declare const TypeForm: <T extends TObject>(props: TypeFormProps<T>) => react_jsx_runtime0.JSX.Element | null;
206
+ //#endregion
207
+ //#region src/services/ToastService.d.ts
208
+ interface ToastServiceOptions {
209
+ default?: Partial<NotificationData>;
210
+ }
211
+ declare class ToastService {
212
+ protected readonly raw: {
213
+ readonly show: typeof _mantine_notifications0.showNotification;
214
+ readonly hide: typeof _mantine_notifications0.hideNotification;
215
+ readonly update: typeof _mantine_notifications0.updateNotification;
216
+ readonly clean: typeof _mantine_notifications0.cleanNotifications;
217
+ readonly cleanQueue: typeof _mantine_notifications0.cleanNotificationsQueue;
218
+ readonly updateState: typeof _mantine_notifications0.updateNotificationsState;
219
+ };
220
+ readonly options: ToastServiceOptions;
221
+ show(options: NotificationData): void;
222
+ info(options: Partial<NotificationData>): void;
223
+ success(options: Partial<NotificationData>): void;
224
+ warning(options: Partial<NotificationData>): void;
225
+ danger(options: Partial<NotificationData>): void;
226
+ }
227
+ //#endregion
228
+ //#region src/hooks/useToast.d.ts
229
+ /**
230
+ * Use this hook to access the Toast Service for showing notifications.
231
+ *
232
+ * @example
233
+ * const toast = useToast();
234
+ * toast.success({ message: "Operation completed successfully!" });
235
+ * toast.error({ title: "Error", message: "Something went wrong" });
236
+ */
237
+ declare const useToast: () => ToastService;
238
+ //#endregion
239
+ //#region src/RootRouter.d.ts
240
+ declare class RootRouter {
241
+ readonly root: _alepha_react0.PageDescriptor<_alepha_react0.PageConfigSchema, any, _alepha_react0.TPropsParentDefault>;
242
+ }
243
+ //#endregion
244
+ //#region src/utils/icons.d.ts
245
+ /**
246
+ * Icon size presets following Mantine's size conventions
247
+ */
248
+ declare const ICON_SIZES: {
249
+ readonly xs: 12;
250
+ readonly sm: 16;
251
+ readonly md: 20;
252
+ readonly lg: 24;
253
+ readonly xl: 28;
254
+ };
255
+ type IconSize = keyof typeof ICON_SIZES;
256
+ /**
257
+ * Get the default icon for an input based on its type, format, or name.
258
+ */
259
+ declare const getDefaultIcon: (params: {
260
+ type?: string;
261
+ format?: string;
262
+ name?: string;
263
+ isEnum?: boolean;
264
+ isArray?: boolean;
265
+ size?: IconSize;
266
+ }) => ReactNode;
267
+ //#endregion
268
+ //#region src/utils/string.d.ts
269
+ /**
270
+ * Capitalizes the first letter of a string.
271
+ *
272
+ * @example
273
+ * capitalize("hello") // "Hello"
274
+ */
275
+ declare const capitalize: (str: string) => string;
276
+ /**
277
+ * Converts a path or identifier string into a pretty display name.
278
+ * Removes slashes and capitalizes the first letter.
279
+ *
280
+ * @example
281
+ * prettyName("/userName") // "UserName"
282
+ * prettyName("email") // "Email"
283
+ */
284
+ declare const prettyName: (name: string) => string;
285
+ //#endregion
286
+ //#region src/index.d.ts
287
+ declare module "typebox" {
288
+ interface TSchemaOptions {
289
+ $control?: Omit<ControlProps, "input">;
290
+ }
291
+ }
292
+ /**
293
+ *
294
+ *
295
+ * @module alepha.ui
296
+ */
297
+ declare const AlephaUI: _alepha_core0.Service<_alepha_core0.Module<{}>>;
298
+ //#endregion
299
+ export { Action, AlephaMantineProvider, AlephaUI, Control, ControlDate, ControlSelect, DarkModeButton, Flex, ICON_SIZES, IconSize, Omnibar, RootRouter, ToastService, TypeForm, capitalize, getDefaultIcon, prettyName, useToast };
300
+ //# sourceMappingURL=index.d.ts.map
package/ui.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@alepha/ui'
package/vite.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Options } from "@vitejs/plugin-react";
1
2
  import { BrotliOptions, ZlibOptions } from "node:zlib";
2
3
  import { Alepha } from "alepha";
3
4
  import { Plugin, UserConfig } from "vite";
@@ -145,12 +146,11 @@ interface ViteAlephaDevOptions {
145
146
  */
146
147
  serverEntry?: string;
147
148
  /**
148
- * Enable or disable debug mode
149
+ * If true, enables debug logging.
149
150
  *
150
151
  * @default false
151
152
  */
152
153
  debug?: boolean;
153
- onReload?: () => void;
154
154
  }
155
155
  /**
156
156
  * Plug Alepha into Vite development server.
@@ -158,7 +158,9 @@ interface ViteAlephaDevOptions {
158
158
  declare function viteAlephaDev(options?: ViteAlephaDevOptions): Promise<Plugin>;
159
159
  //#endregion
160
160
  //#region src/viteAlepha.d.ts
161
- type ViteAlephaOptions = ViteAlephaDevOptions & ViteAlephaBuildOptions;
161
+ type ViteAlephaOptions = ViteAlephaDevOptions & ViteAlephaBuildOptions & {
162
+ react?: false | Options;
163
+ };
162
164
  declare function viteAlepha(options?: ViteAlephaOptions): (Plugin | Promise<Plugin>)[];
163
165
  //#endregion
164
166
  //#region src/index.d.ts