@nan0web/ui 1.6.2 → 1.7.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.
- package/package.json +89 -85
- package/src/core/GeneratorRunner.js +213 -0
- package/src/core/Intent.js +168 -0
- package/src/core/IntentErrorModel.js +94 -0
- package/src/core/MaskHandler.js +125 -0
- package/src/core/index.js +7 -0
- package/src/domain/SandboxModel.js +193 -0
- package/src/domain/ShowcaseAppModel.js +88 -0
- package/src/domain/components/AutocompleteModel.js +58 -0
- package/src/domain/components/BreadcrumbModel.js +265 -0
- package/src/domain/components/ButtonModel.js +92 -0
- package/src/domain/components/ConfirmModel.js +64 -0
- package/src/domain/components/InputModel.js +142 -0
- package/src/domain/components/SelectModel.js +59 -0
- package/src/domain/components/SpinnerModel.js +58 -0
- package/src/domain/components/TableModel.js +60 -0
- package/src/domain/components/ToastModel.js +77 -0
- package/src/domain/components/TreeModel.js +53 -0
- package/src/domain/components/index.js +11 -0
- package/src/domain/index.js +16 -0
- package/src/format.js +21 -0
- package/src/index.js +6 -0
- package/types/core/GeneratorRunner.d.ts +51 -0
- package/types/core/Intent.d.ts +227 -85
- package/types/core/IntentErrorModel.d.ts +55 -0
- package/types/core/MaskHandler.d.ts +33 -0
- package/types/core/index.d.ts +4 -0
- package/types/domain/SandboxModel.d.ts +59 -0
- package/types/domain/ShowcaseAppModel.d.ts +62 -0
- package/types/domain/components/AutocompleteModel.d.ts +47 -0
- package/types/domain/components/BreadcrumbModel.d.ts +164 -0
- package/types/domain/components/ButtonModel.d.ts +81 -0
- package/types/domain/components/ConfirmModel.d.ts +54 -0
- package/types/domain/components/InputModel.d.ts +121 -0
- package/types/domain/components/SelectModel.d.ts +48 -0
- package/types/domain/components/SpinnerModel.d.ts +45 -0
- package/types/domain/components/TableModel.d.ts +44 -0
- package/types/domain/components/ToastModel.d.ts +62 -0
- package/types/domain/components/TreeModel.d.ts +49 -0
- package/types/domain/components/index.d.ts +10 -0
- package/types/domain/index.d.ts +3 -0
- package/types/format.d.ts +5 -0
- package/types/index.d.ts +4 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} SelectData
|
|
3
|
+
* @property {string} [content]
|
|
4
|
+
* @property {string[]} [options]
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Model-as-Schema for Select component.
|
|
8
|
+
* Represents a dropdown choice selection.
|
|
9
|
+
*/
|
|
10
|
+
export class SelectModel extends Model {
|
|
11
|
+
static content: {
|
|
12
|
+
help: string;
|
|
13
|
+
default: string;
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
static options: {
|
|
17
|
+
help: string;
|
|
18
|
+
default: string[];
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @param {SelectData | any} [data]
|
|
23
|
+
*/
|
|
24
|
+
constructor(data?: SelectData | any);
|
|
25
|
+
/** @type {string|undefined} */ content: string | undefined;
|
|
26
|
+
/** @type {string[]|undefined} */ options: string[] | undefined;
|
|
27
|
+
run(): AsyncGenerator<{
|
|
28
|
+
type: string;
|
|
29
|
+
field: string;
|
|
30
|
+
schema: {
|
|
31
|
+
help: string;
|
|
32
|
+
options: string[] | undefined;
|
|
33
|
+
validate: (val: any) => true | "Invalid option selected";
|
|
34
|
+
};
|
|
35
|
+
component: string;
|
|
36
|
+
model: any;
|
|
37
|
+
}, {
|
|
38
|
+
type: string;
|
|
39
|
+
data: {
|
|
40
|
+
selected: string | undefined;
|
|
41
|
+
};
|
|
42
|
+
}, unknown>;
|
|
43
|
+
}
|
|
44
|
+
export type SelectData = {
|
|
45
|
+
content?: string | undefined;
|
|
46
|
+
options?: string[] | undefined;
|
|
47
|
+
};
|
|
48
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {'sm'|'md'|'lg'} SpinnerSize
|
|
3
|
+
* @typedef {Object} SpinnerData
|
|
4
|
+
* @property {SpinnerSize} [size]
|
|
5
|
+
* @property {string} [color]
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Model-as-Schema for Spinner component.
|
|
9
|
+
* Represents a loading or progress state without user interaction.
|
|
10
|
+
*/
|
|
11
|
+
export class SpinnerModel extends Model {
|
|
12
|
+
static size: {
|
|
13
|
+
help: string;
|
|
14
|
+
default: string;
|
|
15
|
+
options: string[];
|
|
16
|
+
};
|
|
17
|
+
static color: {
|
|
18
|
+
help: string;
|
|
19
|
+
type: string;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @param {SpinnerData | any} [data]
|
|
24
|
+
*/
|
|
25
|
+
constructor(data?: SpinnerData | any);
|
|
26
|
+
/** @type {SpinnerSize|undefined} */ size: SpinnerSize | undefined;
|
|
27
|
+
/** @type {string|undefined} */ color: string | undefined;
|
|
28
|
+
run(): AsyncGenerator<{
|
|
29
|
+
type: string;
|
|
30
|
+
message: string;
|
|
31
|
+
component: string;
|
|
32
|
+
model: any;
|
|
33
|
+
}, {
|
|
34
|
+
type: string;
|
|
35
|
+
data: {
|
|
36
|
+
completed: boolean;
|
|
37
|
+
};
|
|
38
|
+
}, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export type SpinnerSize = "sm" | "md" | "lg";
|
|
41
|
+
export type SpinnerData = {
|
|
42
|
+
size?: SpinnerSize | undefined;
|
|
43
|
+
color?: string | undefined;
|
|
44
|
+
};
|
|
45
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} TableData
|
|
3
|
+
* @property {string[]} [columns]
|
|
4
|
+
* @property {string[][]} [rows]
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Model-as-Schema for Table Data component.
|
|
8
|
+
* Displays tabular string data in rows and columns.
|
|
9
|
+
*/
|
|
10
|
+
export class TableModel extends Model {
|
|
11
|
+
static columns: {
|
|
12
|
+
help: string;
|
|
13
|
+
type: string;
|
|
14
|
+
default: string[];
|
|
15
|
+
};
|
|
16
|
+
static rows: {
|
|
17
|
+
help: string;
|
|
18
|
+
type: string;
|
|
19
|
+
default: string[][];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @param {TableData | any} [data]
|
|
23
|
+
*/
|
|
24
|
+
constructor(data?: TableData | any);
|
|
25
|
+
/** @type {string[]|undefined} */ columns: string[] | undefined;
|
|
26
|
+
/** @type {string[][]|undefined} */ rows: string[][] | undefined;
|
|
27
|
+
run(): AsyncGenerator<{
|
|
28
|
+
type: string;
|
|
29
|
+
level: string;
|
|
30
|
+
message: string;
|
|
31
|
+
component: string;
|
|
32
|
+
model: any;
|
|
33
|
+
}, {
|
|
34
|
+
type: string;
|
|
35
|
+
data: {
|
|
36
|
+
rowsCount: number;
|
|
37
|
+
};
|
|
38
|
+
}, unknown>;
|
|
39
|
+
}
|
|
40
|
+
export type TableData = {
|
|
41
|
+
columns?: string[] | undefined;
|
|
42
|
+
rows?: string[][] | undefined;
|
|
43
|
+
};
|
|
44
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {'success'|'error'|'info'|'warning'} ToastVariant
|
|
3
|
+
* @typedef {Object} ToastData
|
|
4
|
+
* @property {string} [message]
|
|
5
|
+
* @property {ToastVariant} [variant]
|
|
6
|
+
* @property {number} [duration]
|
|
7
|
+
* @property {boolean} [open]
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Model-as-Schema for Toast notification component.
|
|
11
|
+
* Represents a transient message displayed to the user.
|
|
12
|
+
*/
|
|
13
|
+
export class ToastModel extends Model {
|
|
14
|
+
static message: {
|
|
15
|
+
help: string;
|
|
16
|
+
default: string;
|
|
17
|
+
type: string;
|
|
18
|
+
};
|
|
19
|
+
static variant: {
|
|
20
|
+
help: string;
|
|
21
|
+
default: string;
|
|
22
|
+
options: string[];
|
|
23
|
+
};
|
|
24
|
+
static duration: {
|
|
25
|
+
help: string;
|
|
26
|
+
default: number;
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
static open: {
|
|
30
|
+
help: string;
|
|
31
|
+
default: boolean;
|
|
32
|
+
type: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* @param {ToastData | any} [data]
|
|
36
|
+
*/
|
|
37
|
+
constructor(data?: ToastData | any);
|
|
38
|
+
/** @type {string|undefined} */ message: string | undefined;
|
|
39
|
+
/** @type {ToastVariant|undefined} */ variant: ToastVariant | undefined;
|
|
40
|
+
/** @type {number|undefined} */ duration: number | undefined;
|
|
41
|
+
/** @type {boolean|undefined} */ open: boolean | undefined;
|
|
42
|
+
run(): AsyncGenerator<{
|
|
43
|
+
type: string;
|
|
44
|
+
level: string;
|
|
45
|
+
message: string | undefined;
|
|
46
|
+
component: string;
|
|
47
|
+
model: any;
|
|
48
|
+
}, {
|
|
49
|
+
type: string;
|
|
50
|
+
data: {
|
|
51
|
+
closed: boolean;
|
|
52
|
+
};
|
|
53
|
+
}, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export type ToastVariant = "success" | "error" | "info" | "warning";
|
|
56
|
+
export type ToastData = {
|
|
57
|
+
message?: string | undefined;
|
|
58
|
+
variant?: ToastVariant | undefined;
|
|
59
|
+
duration?: number | undefined;
|
|
60
|
+
open?: boolean | undefined;
|
|
61
|
+
};
|
|
62
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} TreeNode
|
|
3
|
+
* @property {string} label
|
|
4
|
+
* @property {boolean} [expanded]
|
|
5
|
+
* @property {TreeNode[]} [children]
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} TreeData
|
|
9
|
+
* @property {TreeNode[]} [data]
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Model-as-Schema for Tree component.
|
|
13
|
+
* Represents a hierarchical selection or navigation structure.
|
|
14
|
+
*/
|
|
15
|
+
export class TreeModel extends Model {
|
|
16
|
+
static data: {
|
|
17
|
+
help: string;
|
|
18
|
+
type: string;
|
|
19
|
+
default: never[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @param {TreeData | any} [data]
|
|
23
|
+
*/
|
|
24
|
+
constructor(data?: TreeData | any);
|
|
25
|
+
/** @type {TreeNode[]|undefined} */ data: TreeNode[] | undefined;
|
|
26
|
+
run(): AsyncGenerator<{
|
|
27
|
+
type: string;
|
|
28
|
+
field: string;
|
|
29
|
+
schema: {
|
|
30
|
+
help: string;
|
|
31
|
+
};
|
|
32
|
+
component: string;
|
|
33
|
+
model: any;
|
|
34
|
+
}, {
|
|
35
|
+
type: string;
|
|
36
|
+
data: {
|
|
37
|
+
selected: any;
|
|
38
|
+
};
|
|
39
|
+
}, unknown>;
|
|
40
|
+
}
|
|
41
|
+
export type TreeNode = {
|
|
42
|
+
label: string;
|
|
43
|
+
expanded?: boolean | undefined;
|
|
44
|
+
children?: TreeNode[] | undefined;
|
|
45
|
+
};
|
|
46
|
+
export type TreeData = {
|
|
47
|
+
data?: TreeNode[] | undefined;
|
|
48
|
+
};
|
|
49
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { BreadcrumbModel } from "./BreadcrumbModel.js";
|
|
2
|
+
export { ButtonModel } from "./ButtonModel.js";
|
|
3
|
+
export { ConfirmModel } from "./ConfirmModel.js";
|
|
4
|
+
export { InputModel } from "./InputModel.js";
|
|
5
|
+
export { SpinnerModel } from "./SpinnerModel.js";
|
|
6
|
+
export { TableModel } from "./TableModel.js";
|
|
7
|
+
export { ToastModel } from "./ToastModel.js";
|
|
8
|
+
export { SelectModel } from "./SelectModel.js";
|
|
9
|
+
export { AutocompleteModel } from "./AutocompleteModel.js";
|
|
10
|
+
export { TreeModel } from "./TreeModel.js";
|
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { format } from "./format.js";
|
|
1
2
|
export { default as FormMessage } from "./core/Form/Message.js";
|
|
2
3
|
export { default as FormInput } from "./core/Form/Input.js";
|
|
3
4
|
export { default as InputAdapter } from "./core/InputAdapter.js";
|
|
@@ -7,6 +8,8 @@ export { default as UiForm } from "./core/Form/Form.js";
|
|
|
7
8
|
export { default as UiMessage } from "./core/Message/Message.js";
|
|
8
9
|
export { default as UiStream } from "./core/Stream.js";
|
|
9
10
|
export { default as UiAdapter } from "./core/UiAdapter.js";
|
|
11
|
+
export { IntentErrorModel } from "./core/IntentErrorModel.js";
|
|
12
|
+
export { runGenerator } from "./core/GeneratorRunner.js";
|
|
10
13
|
import Frame from './Frame/Frame.js';
|
|
11
14
|
import FrameProps from './Frame/Props.js';
|
|
12
15
|
import Locale from './Locale.js';
|
|
@@ -19,3 +22,4 @@ import Component from './Component/index.js';
|
|
|
19
22
|
import App from './App/index.js';
|
|
20
23
|
export { Frame, FrameProps, Locale, StdIn, StdOut, View, RenderOptions, Model, Component, App };
|
|
21
24
|
export { default as Error, CancelError } from "./core/Error/index.js";
|
|
25
|
+
export { validateIntent, ask, progress, log, result, INTENT_TYPES, isModelSchema } from "./core/Intent.js";
|