@nan0web/ui-cli 1.1.0 → 2.0.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 (115) hide show
  1. package/README.md +114 -207
  2. package/package.json +22 -12
  3. package/src/CLI.js +22 -29
  4. package/src/CLiMessage.js +2 -3
  5. package/src/Command.js +26 -24
  6. package/src/CommandError.js +3 -5
  7. package/src/CommandHelp.js +40 -36
  8. package/src/CommandMessage.js +56 -40
  9. package/src/CommandParser.js +27 -25
  10. package/src/InputAdapter.js +630 -90
  11. package/src/OutputAdapter.js +7 -8
  12. package/src/README.md.js +190 -316
  13. package/src/components/Alert.js +3 -6
  14. package/src/components/prompt/Autocomplete.js +12 -0
  15. package/src/components/prompt/Confirm.js +29 -0
  16. package/src/components/prompt/DateTime.js +26 -0
  17. package/src/components/prompt/Input.js +15 -0
  18. package/src/components/prompt/Mask.js +12 -0
  19. package/src/components/prompt/Multiselect.js +26 -0
  20. package/src/components/prompt/Next.js +8 -0
  21. package/src/components/prompt/Password.js +13 -0
  22. package/src/components/prompt/Pause.js +9 -0
  23. package/src/components/prompt/ProgressBar.js +16 -0
  24. package/src/components/prompt/Select.js +29 -0
  25. package/src/components/prompt/Slider.js +16 -0
  26. package/src/components/prompt/Spinner.js +29 -0
  27. package/src/components/prompt/Toggle.js +13 -0
  28. package/src/components/prompt/Tree.js +17 -0
  29. package/src/components/view/Alert.js +78 -0
  30. package/src/components/view/Badge.js +11 -0
  31. package/src/components/view/Nav.js +23 -0
  32. package/src/components/view/Table.js +12 -0
  33. package/src/components/view/Toast.js +9 -0
  34. package/src/core/Component.js +79 -0
  35. package/src/core/PropValidation.js +138 -0
  36. package/src/core/render.js +37 -0
  37. package/src/index.js +80 -41
  38. package/src/test/PlaygroundTest.js +37 -25
  39. package/src/test/index.js +2 -4
  40. package/src/ui/alert.js +58 -0
  41. package/src/ui/autocomplete.js +86 -0
  42. package/src/ui/badge.js +35 -0
  43. package/src/ui/confirm.js +49 -0
  44. package/src/ui/date-time.js +45 -0
  45. package/src/ui/form.js +120 -55
  46. package/src/ui/index.js +18 -4
  47. package/src/ui/input.js +79 -152
  48. package/src/ui/mask.js +132 -0
  49. package/src/ui/multiselect.js +59 -0
  50. package/src/ui/nav.js +74 -0
  51. package/src/ui/next.js +18 -13
  52. package/src/ui/progress.js +88 -0
  53. package/src/ui/select.js +49 -72
  54. package/src/ui/slider.js +154 -0
  55. package/src/ui/spinner.js +65 -0
  56. package/src/ui/table.js +163 -0
  57. package/src/ui/toast.js +34 -0
  58. package/src/ui/toggle.js +34 -0
  59. package/src/ui/tree.js +393 -0
  60. package/src/utils/parse.js +1 -1
  61. package/types/CLI.d.ts +5 -5
  62. package/types/CLiMessage.d.ts +1 -1
  63. package/types/Command.d.ts +2 -2
  64. package/types/CommandHelp.d.ts +3 -3
  65. package/types/CommandMessage.d.ts +8 -8
  66. package/types/CommandParser.d.ts +3 -3
  67. package/types/InputAdapter.d.ts +149 -15
  68. package/types/OutputAdapter.d.ts +1 -1
  69. package/types/README.md.d.ts +1 -1
  70. package/types/UiMessage.d.ts +31 -29
  71. package/types/components/prompt/Autocomplete.d.ts +6 -0
  72. package/types/components/prompt/Confirm.d.ts +6 -0
  73. package/types/components/prompt/DateTime.d.ts +6 -0
  74. package/types/components/prompt/Input.d.ts +6 -0
  75. package/types/components/prompt/Mask.d.ts +6 -0
  76. package/types/components/prompt/Multiselect.d.ts +6 -0
  77. package/types/components/prompt/Next.d.ts +6 -0
  78. package/types/components/prompt/Password.d.ts +6 -0
  79. package/types/components/prompt/Pause.d.ts +6 -0
  80. package/types/components/prompt/ProgressBar.d.ts +12 -0
  81. package/types/components/prompt/Select.d.ts +18 -0
  82. package/types/components/prompt/Slider.d.ts +6 -0
  83. package/types/components/prompt/Spinner.d.ts +21 -0
  84. package/types/components/prompt/Toggle.d.ts +6 -0
  85. package/types/components/prompt/Tree.d.ts +6 -0
  86. package/types/components/view/Alert.d.ts +21 -0
  87. package/types/components/view/Badge.d.ts +5 -0
  88. package/types/components/view/Nav.d.ts +15 -0
  89. package/types/components/view/Table.d.ts +10 -0
  90. package/types/components/view/Toast.d.ts +5 -0
  91. package/types/core/Component.d.ts +34 -0
  92. package/types/core/PropValidation.d.ts +48 -0
  93. package/types/core/render.d.ts +6 -0
  94. package/types/index.d.ts +47 -15
  95. package/types/test/PlaygroundTest.d.ts +12 -8
  96. package/types/test/index.d.ts +1 -1
  97. package/types/ui/alert.d.ts +14 -0
  98. package/types/ui/autocomplete.d.ts +20 -0
  99. package/types/ui/badge.d.ts +8 -0
  100. package/types/ui/confirm.d.ts +21 -0
  101. package/types/ui/date-time.d.ts +19 -0
  102. package/types/ui/form.d.ts +43 -12
  103. package/types/ui/index.d.ts +17 -2
  104. package/types/ui/input.d.ts +31 -74
  105. package/types/ui/mask.d.ts +29 -0
  106. package/types/ui/multiselect.d.ts +25 -0
  107. package/types/ui/nav.d.ts +27 -0
  108. package/types/ui/progress.d.ts +43 -0
  109. package/types/ui/select.d.ts +25 -64
  110. package/types/ui/slider.d.ts +23 -0
  111. package/types/ui/spinner.d.ts +28 -0
  112. package/types/ui/table.d.ts +28 -0
  113. package/types/ui/toast.d.ts +8 -0
  114. package/types/ui/toggle.d.ts +17 -0
  115. package/types/ui/tree.d.ts +48 -0
@@ -1,5 +1,11 @@
1
- /** @typedef {import("./ui/select.js").InputFn} InputFn */
2
- /** @typedef {import("./ui/select.js").ConsoleLike} ConsoleLike */
1
+ /**
2
+ * @typedef {Object} ConsoleLike
3
+ * @property {(...args: any[]) => void} debug
4
+ * @property {(...args: any[]) => void} log
5
+ * @property {(...args: any[]) => void} info
6
+ * @property {(...args: any[]) => void} warn
7
+ * @property {(...args: any[]) => void} error
8
+ */
3
9
  /**
4
10
  * Extends the generic {@link BaseInputAdapter} with CLI‑specific behaviour.
5
11
  *
@@ -9,16 +15,34 @@
9
15
  export default class CLiInputAdapter extends BaseInputAdapter {
10
16
  constructor(options?: {});
11
17
  /** @returns {ConsoleLike} */
12
- get console(): import("./ui/select.js").ConsoleLike;
18
+ get console(): ConsoleLike;
19
+ /** @param {Function} val */
20
+ set t(val: Function);
21
+ /** @returns {Function} */
22
+ get t(): Function;
13
23
  /** @returns {NodeJS.WriteStream} */
14
24
  get stdout(): NodeJS.WriteStream;
25
+ /** @returns {string[]} */
26
+ getRemainingAnswers(): string[];
15
27
  /**
16
28
  * Create a handler with stop words that supports predefined answers.
17
29
  *
18
30
  * @param {string[]} stops - Stop words for cancellation.
19
- * @returns {InputFn}
31
+ * @returns {Function}
32
+ */
33
+ createHandler(stops?: string[]): Function;
34
+ /**
35
+ * Create a select handler that supports predefined answers.
36
+ * @returns {Function}
20
37
  */
21
- createHandler(stops?: string[]): InputFn;
38
+ createSelectHandler(): Function;
39
+ /**
40
+ * Pause execution and wait for user input (Press any key).
41
+ *
42
+ * @param {string} [message] - Message to display.
43
+ * @returns {Promise<void>}
44
+ */
45
+ pause(message?: string): Promise<void>;
22
46
  /**
23
47
  * Prompt the user for a full form, handling navigation and validation.
24
48
  *
@@ -29,7 +53,7 @@ export default class CLiInputAdapter extends BaseInputAdapter {
29
53
  */
30
54
  requestForm(form: UiForm, options?: {
31
55
  silent?: boolean | undefined;
32
- } | undefined): Promise<any>;
56
+ }): Promise<any>;
33
57
  /**
34
58
  * Render a UI component in the CLI environment.
35
59
  *
@@ -52,16 +76,120 @@ export default class CLiInputAdapter extends BaseInputAdapter {
52
76
  * Prompt the user to select an option from a list.
53
77
  *
54
78
  * @param {Object} config - Configuration object.
55
- * @returns {Promise<string>} Selected value (or empty string on cancel).
79
+ * @returns {Promise<{value: string|undefined, cancelled: boolean}>} Selected value (or undefined on cancel).
56
80
  */
57
- requestSelect(config: any): Promise<string>;
81
+ requestSelect(config: any): Promise<{
82
+ value: string | undefined;
83
+ cancelled: boolean;
84
+ }>;
58
85
  /**
59
86
  * Prompt for a single string input.
60
87
  *
61
88
  * @param {Object} config - Prompt configuration.
62
- * @returns {Promise<string>} User response string.
89
+ * @returns {Promise<{value: string|undefined, cancelled: boolean}>} User response string or undefined on cancel.
90
+ */
91
+ requestInput(config: any): Promise<{
92
+ value: string | undefined;
93
+ cancelled: boolean;
94
+ }>;
95
+ /**
96
+ * Prompt the user for an autocomplete selection.
97
+ *
98
+ * @param {Object} config - Configuration object.
99
+ * @returns {Promise<{value: any, cancelled: boolean}>} Selected value.
100
+ */
101
+ requestAutocomplete(config: any): Promise<{
102
+ value: any;
103
+ cancelled: boolean;
104
+ }>;
105
+ /**
106
+ * Requests confirmation (yes/no).
107
+ *
108
+ * @param {Object} config - Confirmation configuration.
109
+ * @returns {Promise<{value: boolean|undefined, cancelled: boolean}>} User confirmation.
110
+ */
111
+ requestConfirm(config: any): Promise<{
112
+ value: boolean | undefined;
113
+ cancelled: boolean;
114
+ }>;
115
+ /**
116
+ * Display an interactive table.
117
+ *
118
+ * @param {Object} config - Table configuration.
119
+ * @returns {Promise<{value: any, cancelled: boolean}>}
120
+ */
121
+ requestTable(config: any): Promise<{
122
+ value: any;
123
+ cancelled: boolean;
124
+ }>;
125
+ /**
126
+ * Requests multiple selection.
127
+ *
128
+ * @param {Object} config - Multiselect configuration.
129
+ * @returns {Promise<{value: any[]|undefined, cancelled: boolean}>} Selected values.
130
+ */
131
+ requestMultiselect(config: any): Promise<{
132
+ value: any[] | undefined;
133
+ cancelled: boolean;
134
+ }>;
135
+ /**
136
+ * Requests masked input.
137
+ *
138
+ * @param {Object} config - Mask configuration.
139
+ * @returns {Promise<{value: string|undefined, cancelled: boolean}>} Masked value.
140
+ */
141
+ requestMask(config: any): Promise<{
142
+ value: string | undefined;
143
+ cancelled: boolean;
144
+ }>;
145
+ /**
146
+ * Request a toggle switch.
147
+ * @param {Object} config
148
+ * @returns {Promise<{value: boolean|undefined, cancelled: boolean}>}
149
+ */
150
+ requestToggle(config: any): Promise<{
151
+ value: boolean | undefined;
152
+ cancelled: boolean;
153
+ }>;
154
+ /**
155
+ * Request a numeric slider.
156
+ * @param {Object} config
157
+ * @returns {Promise<{value: number|undefined, cancelled: boolean}>}
63
158
  */
64
- requestInput(config: any): Promise<string>;
159
+ requestSlider(config: any): Promise<{
160
+ value: number | undefined;
161
+ cancelled: boolean;
162
+ }>;
163
+ /**
164
+ * Create a progress bar.
165
+ * @param {Object} options
166
+ * @returns {import('./ui/progress.js').ProgressBar}
167
+ */
168
+ requestProgress(options: any): import("./ui/progress.js").ProgressBar;
169
+ /**
170
+ * Create and start a spinner.
171
+ * @param {string} message
172
+ * @returns {import('./ui/spinner.js').Spinner}
173
+ */
174
+ requestSpinner(message: string): import("./ui/spinner.js").Spinner;
175
+ /**
176
+ * Request a selection from a tree view.
177
+ * @param {Object} config
178
+ * @returns {Promise<{value: any, cancelled: boolean}>} Selected node(s).
179
+ */
180
+ requestTree(config: any): Promise<{
181
+ value: any;
182
+ cancelled: boolean;
183
+ }>;
184
+ /**
185
+ * Request a date or time from the user.
186
+ * @param {Object} config
187
+ * @returns {Promise<{value: Date|undefined, cancelled: boolean}>}
188
+ */
189
+ requestDateTime(config: any): Promise<{
190
+ value: Date | undefined;
191
+ cancelled: boolean;
192
+ }>;
65
193
  /**
66
194
  * Asks user a question or form and returns the completed form
67
195
  * @param {string | UiForm} question
@@ -73,6 +201,7 @@ export default class CLiInputAdapter extends BaseInputAdapter {
73
201
  select(cfg: any): Promise<{
74
202
  index: number;
75
203
  value: any;
204
+ cancelled: boolean;
76
205
  }>;
77
206
  /**
78
207
  * **New API** – Require input for a {@link UiMessage} instance.
@@ -89,8 +218,13 @@ export default class CLiInputAdapter extends BaseInputAdapter {
89
218
  requireInput(msg: UiMessage): Promise<any>;
90
219
  #private;
91
220
  }
92
- export type InputFn = import("./ui/select.js").InputFn;
93
- export type ConsoleLike = import("./ui/select.js").ConsoleLike;
94
- import { InputAdapter as BaseInputAdapter } from "@nan0web/ui";
95
- import { UiForm } from "@nan0web/ui";
96
- import { UiMessage } from "@nan0web/ui";
221
+ export type ConsoleLike = {
222
+ debug: (...args: any[]) => void;
223
+ log: (...args: any[]) => void;
224
+ info: (...args: any[]) => void;
225
+ warn: (...args: any[]) => void;
226
+ error: (...args: any[]) => void;
227
+ };
228
+ import { InputAdapter as BaseInputAdapter } from '@nan0web/ui';
229
+ import { UiForm } from '@nan0web/ui';
230
+ import { UiMessage } from '@nan0web/ui';
@@ -12,7 +12,7 @@ export default class OutputAdapter {
12
12
  constructor(options?: {
13
13
  console?: any;
14
14
  components?: Map<string, () => Promise<Function>> | undefined;
15
- } | undefined);
15
+ });
16
16
  /** @returns {any} */
17
17
  get console(): any;
18
18
  /**
@@ -1 +1 @@
1
- export {};
1
+ export {}
@@ -8,33 +8,35 @@
8
8
  * @extends {Message}
9
9
  */
10
10
  export default class UiMessage<T extends Record<string, any>> extends Message {
11
- constructor(input?: import("../node_modules/@nan0web/co/types/Message.js").MessageInput | undefined);
12
- /**
13
- * Validates the message body against its schema.
14
- *
15
- * NOTE: The signature must exactly match `Message.validate` – it returns a
16
- * `Map<string,string>` regardless of the generic type, otherwise TypeScript
17
- * reports incompatibility with the base class.
18
- *
19
- * @param {any} [body=this.body] - Optional body to validate.
20
- * @returns {Map<string,string>} Map of validation errors (empty if valid).
21
- */
22
- validate(body?: any): Map<string, string>;
23
- /**
24
- * Requires input via UI adapter. Validates fields according to the static `Body` schema.
25
- *
26
- * @param {Object} ui - UI adapter with input/output capabilities.
27
- * @param {InputAdapter} ui.input - Input adapter for prompts.
28
- * @param {OutputAdapter} [ui.output] - Optional output adapter for rendering.
29
- * @returns {Promise<T>} Resolves with updated body or rejects if cancelled.
30
- * @throws {CancelError} When user cancels the input process.
31
- */
32
- requireInput(ui: {
33
- input: InputAdapter;
34
- output?: import("./OutputAdapter.js").default | undefined;
35
- }): Promise<T>;
11
+ constructor(
12
+ input?: import('../node_modules/@nan0web/co/types/Message.js').MessageInput | undefined,
13
+ )
14
+ /**
15
+ * Validates the message body against its schema.
16
+ *
17
+ * NOTE: The signature must exactly match `Message.validate` – it returns a
18
+ * `Map<string,string>` regardless of the generic type, otherwise TypeScript
19
+ * reports incompatibility with the base class.
20
+ *
21
+ * @param {any} [body=this.body] - Optional body to validate.
22
+ * @returns {Map<string,string>} Map of validation errors (empty if valid).
23
+ */
24
+ validate(body?: any): Map<string, string>
25
+ /**
26
+ * Requires input via UI adapter. Validates fields according to the static `Body` schema.
27
+ *
28
+ * @param {Object} ui - UI adapter with input/output capabilities.
29
+ * @param {InputAdapter} ui.input - Input adapter for prompts.
30
+ * @param {OutputAdapter} [ui.output] - Optional output adapter for rendering.
31
+ * @returns {Promise<T>} Resolves with updated body or rejects if cancelled.
32
+ * @throws {CancelError} When user cancels the input process.
33
+ */
34
+ requireInput(ui: {
35
+ input: InputAdapter
36
+ output?: import('./OutputAdapter.js').default | undefined
37
+ }): Promise<T>
36
38
  }
37
- export type MessageBodySchema = import("@nan0web/co").MessageBodySchema;
38
- export type InputAdapter = import("./InputAdapter.js").default;
39
- export type OutputAdapter = import("./OutputAdapter.js").default;
40
- import { Message } from "@nan0web/co";
39
+ export type MessageBodySchema = import('@nan0web/co').MessageBodySchema
40
+ export type InputAdapter = import('./InputAdapter.js').default
41
+ export type OutputAdapter = import('./OutputAdapter.js').default
42
+ import { Message } from '@nan0web/co'
@@ -0,0 +1,6 @@
1
+ export function Autocomplete(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Confirm(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function DateTime(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Input(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Mask(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Multiselect(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Next(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Password(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Pause(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * ProgressBar Component.
3
+ * usage:
4
+ * const bar = await render(ProgressBar({ total: 100 }));
5
+ * bar.update(50);
6
+ */
7
+ export function ProgressBar(props: any): {
8
+ $$typeof: symbol;
9
+ type: string;
10
+ props: any;
11
+ execute: () => any;
12
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Select Prompt Component.
3
+ *
4
+ * @param {Object} props
5
+ * @param {string} props.message - Question/Title.
6
+ * @param {Array} props.options - Options list.
7
+ * @param {number} [props.limit] - Max visible options.
8
+ */
9
+ export function Select(props: {
10
+ message: string;
11
+ options: any[];
12
+ limit?: number | undefined;
13
+ }): {
14
+ $$typeof: symbol;
15
+ type: string;
16
+ props: any;
17
+ execute: () => any;
18
+ };
@@ -0,0 +1,6 @@
1
+ export function Slider(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Spinner Component.
3
+ * Usage: await render(Spinner({ message: 'Loading...', action: promise }))
4
+ *
5
+ * @param {Object} props
6
+ * @param {string} props.message - Main message.
7
+ * @param {Promise<any>} [props.action] - Async action to wait for.
8
+ * @param {string} [props.successMessage] - Message on success.
9
+ * @param {string} [props.errorMessage] - Message on error.
10
+ */
11
+ export function Spinner(props: {
12
+ message: string;
13
+ action?: Promise<any> | undefined;
14
+ successMessage?: string | undefined;
15
+ errorMessage?: string | undefined;
16
+ }): {
17
+ $$typeof: symbol;
18
+ type: string;
19
+ props: any;
20
+ execute: () => any;
21
+ };
@@ -0,0 +1,6 @@
1
+ export function Toggle(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,6 @@
1
+ export function Tree(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ execute: () => any;
6
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Alert View Component.
3
+ *
4
+ * @param {Object} props
5
+ * @param {string} props.title - Title of the alert.
6
+ * @param {string} props.children - Message content.
7
+ * @param {'info'|'success'|'warning'|'error'} [props.variant='info'] - Style variant.
8
+ * @param {string} [props.message] - Alias for children (legacy support).
9
+ * @param {boolean} [props.sound] - Play sound (side-effect during toString is acceptable here as it invokes on print).
10
+ */
11
+ export function Alert(props: {
12
+ title: string;
13
+ children: string;
14
+ variant?: "error" | "info" | "success" | "warning" | undefined;
15
+ message?: string | undefined;
16
+ sound?: boolean | undefined;
17
+ }): {
18
+ $$typeof: symbol;
19
+ type: string;
20
+ props: any;
21
+ };
@@ -0,0 +1,5 @@
1
+ export function Badge(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ };
@@ -0,0 +1,15 @@
1
+ export function Breadcrumbs(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ };
6
+ export function Tabs(props: any): {
7
+ $$typeof: symbol;
8
+ type: string;
9
+ props: any;
10
+ };
11
+ export function Steps(props: any): {
12
+ $$typeof: symbol;
13
+ type: string;
14
+ props: any;
15
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Table Component.
3
+ * Can be static (display only) or interactive (filter/select).
4
+ */
5
+ export function Table(props: any): {
6
+ $$typeof: symbol;
7
+ type: string;
8
+ props: any;
9
+ execute: () => any;
10
+ };
@@ -0,0 +1,5 @@
1
+ export function Toast(props: any): {
2
+ $$typeof: symbol;
3
+ type: string;
4
+ props: any;
5
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Creates a Static View Component.
3
+ * These components are synchronous and can be stringified directly.
4
+ *
5
+ * @param {string} displayName - Name of the component (e.g. 'Alert').
6
+ * @param {any} props - Props passed to the component.
7
+ * @param {Function} formatFn - Pure function (props) => string.
8
+ */
9
+ export function createView(displayName: string, props: any, formatFn: Function): {
10
+ $$typeof: symbol;
11
+ type: string;
12
+ props: any;
13
+ };
14
+ /**
15
+ * Creates an Interactive Prompt Component.
16
+ * These components are asynchronous and require `render()` or `await` handling.
17
+ *
18
+ * @param {string} displayName - Name of the component.
19
+ * @param {any} props - Props.
20
+ * @param {Function} executorFn - Async function (props) => Promise<result>.
21
+ */
22
+ export function createPrompt(displayName: string, props: any, executorFn: Function): {
23
+ $$typeof: symbol;
24
+ type: string;
25
+ props: any;
26
+ execute: () => any;
27
+ };
28
+ /**
29
+ * Core Component logic.
30
+ *
31
+ * Defines the contract for View (static) and Prompt (interactive) components.
32
+ */
33
+ export const ComponentSymbol: unique symbol;
34
+ export const PromptSymbol: unique symbol;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Prop validation utilities for UI components.
3
+ * @module core/PropValidation
4
+ */
5
+ /**
6
+ * Validates that a value is a valid Date object or a parseable date string.
7
+ * @param {any} value
8
+ * @param {string} propName
9
+ * @param {string} componentName
10
+ * @throws {TypeError} if validation fails
11
+ */
12
+ export function validateDate(value: any, propName: string, componentName: string): void;
13
+ /**
14
+ * Validates that a value is a string.
15
+ * @param {any} value
16
+ * @param {string} propName
17
+ * @param {string} componentName
18
+ * @param {boolean} required
19
+ * @throws {TypeError} if validation fails
20
+ */
21
+ export function validateString(value: any, propName: string, componentName: string, required?: boolean): void;
22
+ /**
23
+ * Validates that a value is a function.
24
+ * @param {any} value
25
+ * @param {string} propName
26
+ * @param {string} componentName
27
+ * @param {boolean} required
28
+ * @throws {TypeError} if validation fails
29
+ */
30
+ export function validateFunction(value: any, propName: string, componentName: string, required?: boolean): void;
31
+ /**
32
+ * Validates that a value is a boolean.
33
+ * @param {any} value
34
+ * @param {string} propName
35
+ * @param {string} componentName
36
+ * @param {boolean} required
37
+ * @throws {TypeError} if validation fails
38
+ */
39
+ export function validateBoolean(value: any, propName: string, componentName: string, required?: boolean): void;
40
+ /**
41
+ * Validates that a value is a number.
42
+ * @param {any} value
43
+ * @param {string} propName
44
+ * @param {string} componentName
45
+ * @param {boolean} required
46
+ * @throws {TypeError} if validation fails
47
+ */
48
+ export function validateNumber(value: any, propName: string, componentName: string, required?: boolean): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Component Renderer.
3
+ *
4
+ * Handles both Static Views and Interactive Prompts.
5
+ */
6
+ export function render(component: any): Promise<any>;