@nan0web/ui 1.1.0 → 1.3.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/README.md +19 -14
- package/package.json +6 -4
- package/src/App/Command/DepsCommand.js +5 -9
- package/src/App/Core/CoreApp.js +18 -17
- package/src/App/Core/UI.js +11 -15
- package/src/App/Core/Widget.js +6 -10
- package/src/App/Core/index.js +3 -3
- package/src/App/Scenario.js +4 -4
- package/src/App/User/Command/Message.js +1 -1
- package/src/App/User/Command/index.js +1 -1
- package/src/App/User/UserApp.js +28 -21
- package/src/App/User/UserUI.js +2 -2
- package/src/App/User/index.js +2 -2
- package/src/App/index.js +5 -10
- package/src/Component/Process/Input.js +10 -17
- package/src/Component/Process/Process.js +3 -5
- package/src/Component/Process/index.js +2 -2
- package/src/Component/SortableList/SortableList.js +100 -0
- package/src/Component/SortableList/index.js +3 -0
- package/src/Component/Welcome/Input.js +2 -4
- package/src/Component/Welcome/Welcome.js +5 -9
- package/src/Component/Welcome/index.js +2 -2
- package/src/Component/index.js +5 -3
- package/src/Frame/Frame.js +163 -146
- package/src/Frame/Props.js +20 -20
- package/src/Locale.js +17 -18
- package/src/Model/User/User.js +3 -6
- package/src/Model/index.js +1 -1
- package/src/README.md.js +84 -94
- package/src/StdIn.js +8 -12
- package/src/StdOut.js +23 -27
- package/src/View/RenderOptions.js +1 -1
- package/src/View/View.js +40 -36
- package/src/core/Error/CancelError.js +2 -2
- package/src/core/Error/index.js +3 -5
- package/src/core/Flow.js +347 -0
- package/src/core/Form/Form.js +35 -33
- package/src/core/Form/Input.js +21 -6
- package/src/core/Form/Message.js +3 -6
- package/src/core/Form/index.js +4 -8
- package/src/core/InputAdapter.js +4 -6
- package/src/core/Message/Message.js +9 -12
- package/src/core/Message/OutputMessage.js +19 -17
- package/src/core/Message/index.js +2 -2
- package/src/core/OutputAdapter.js +12 -10
- package/src/core/Stream.js +1 -1
- package/src/core/StreamEntry.js +2 -2
- package/src/core/UiAdapter.js +31 -30
- package/src/core/index.js +33 -10
- package/src/functions.js +8 -15
- package/src/index.js +21 -32
- package/types/App/Command/DepsCommand.d.ts +1 -1
- package/types/App/Command/Options.d.ts +37 -40
- package/types/App/Command/index.d.ts +6 -6
- package/types/App/Core/CoreApp.d.ts +2 -2
- package/types/App/Core/UI.d.ts +4 -4
- package/types/App/Core/Widget.d.ts +4 -4
- package/types/App/Core/index.d.ts +3 -3
- package/types/App/Scenario.d.ts +1 -1
- package/types/App/User/Command/Message.d.ts +1 -1
- package/types/App/User/Command/Options.d.ts +29 -29
- package/types/App/User/Command/index.d.ts +1 -1
- package/types/App/User/UserApp.d.ts +5 -5
- package/types/App/User/index.d.ts +2 -2
- package/types/App/index.d.ts +4 -4
- package/types/Component/Process/Process.d.ts +2 -2
- package/types/Component/Process/index.d.ts +2 -2
- package/types/Component/SortableList/SortableList.d.ts +58 -0
- package/types/Component/SortableList/index.d.ts +2 -0
- package/types/Component/Welcome/Input.d.ts +1 -1
- package/types/Component/Welcome/Welcome.d.ts +1 -1
- package/types/Component/Welcome/index.d.ts +2 -2
- package/types/Component/index.d.ts +5 -3
- package/types/Frame/Frame.d.ts +1 -1
- package/types/Frame/Props.d.ts +1 -1
- package/types/Model/index.d.ts +1 -1
- package/types/StdIn.d.ts +2 -2
- package/types/StdOut.d.ts +1 -1
- package/types/View/View.d.ts +7 -7
- package/types/core/Error/index.d.ts +1 -1
- package/types/core/Flow.d.ts +320 -0
- package/types/core/Form/Form.d.ts +2 -2
- package/types/core/Form/Input.d.ts +11 -0
- package/types/core/Form/Message.d.ts +1 -1
- package/types/core/Form/index.d.ts +3 -3
- package/types/core/InputAdapter.d.ts +2 -2
- package/types/core/Intent.d.ts +65 -68
- package/types/core/Message/InputMessage.d.ts +65 -65
- package/types/core/Message/Message.d.ts +1 -1
- package/types/core/Message/OutputMessage.d.ts +1 -1
- package/types/core/Message/index.d.ts +2 -2
- package/types/core/Stream.d.ts +1 -1
- package/types/core/UiAdapter.d.ts +5 -5
- package/types/core/index.d.ts +4 -3
- package/types/index.d.ts +10 -10
|
@@ -1,46 +1,43 @@
|
|
|
1
|
-
export default CommandOptions
|
|
1
|
+
export default CommandOptions
|
|
2
2
|
/**
|
|
3
3
|
* Represents command options with default values.
|
|
4
4
|
* Provides utilities for handling command line options.
|
|
5
5
|
*/
|
|
6
6
|
declare class CommandOptions {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* @returns {string} String representation of the options or "<no options>" if none set
|
|
44
|
-
*/
|
|
45
|
-
toString(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Default option values.
|
|
9
|
+
* @type {object}
|
|
10
|
+
* @property {boolean} help - Whether help is requested
|
|
11
|
+
* @property {string} cwd - Current working directory
|
|
12
|
+
*/
|
|
13
|
+
static DEFAULTS: object
|
|
14
|
+
/**
|
|
15
|
+
* Creates a CommandOptions instance from the given props.
|
|
16
|
+
* @param {CommandOptions|object} props - The properties to create from
|
|
17
|
+
* @returns {CommandOptions} A CommandOptions instance
|
|
18
|
+
*/
|
|
19
|
+
static from(props: CommandOptions | object): CommandOptions
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new CommandOptions instance.
|
|
22
|
+
* @param {object} props - The properties for command options
|
|
23
|
+
* @param {boolean} [props.help=false] - Whether help is requested
|
|
24
|
+
* @param {string} [props.cwd=""] - Current working directory
|
|
25
|
+
*/
|
|
26
|
+
constructor(props?: { help?: boolean | undefined; cwd?: string | undefined })
|
|
27
|
+
/** @type {boolean} Whether help is requested */
|
|
28
|
+
help: boolean
|
|
29
|
+
/** @type {string} Current working directory */
|
|
30
|
+
cwd: string
|
|
31
|
+
/** @type {Record<string, any>} */
|
|
32
|
+
get DEFAULTS(): Record<string, any>
|
|
33
|
+
/**
|
|
34
|
+
* Checks if all options have their default values.
|
|
35
|
+
* @returns {boolean} True if all options are at their default values, false otherwise
|
|
36
|
+
*/
|
|
37
|
+
get empty(): boolean
|
|
38
|
+
/**
|
|
39
|
+
* Converts the options to a string representation.
|
|
40
|
+
* @returns {string} String representation of the options or "<no options>" if none set
|
|
41
|
+
*/
|
|
42
|
+
toString(): string
|
|
46
43
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export { CommandMessage as Message }
|
|
3
|
+
export { CommandOptions as Options }
|
|
4
4
|
}
|
|
5
|
-
export default _default
|
|
6
|
-
import { CommandMessage } from
|
|
7
|
-
import CommandOptions from
|
|
8
|
-
export { CommandMessage, CommandOptions }
|
|
5
|
+
export default _default
|
|
6
|
+
import { CommandMessage } from '@nan0web/co'
|
|
7
|
+
import CommandOptions from './Options.js'
|
|
8
|
+
export { CommandMessage, CommandOptions }
|
package/types/App/Core/UI.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export default class UI extends Widget {
|
|
|
32
32
|
output(results: any[]): void;
|
|
33
33
|
}
|
|
34
34
|
export type ComponentFn = import("../../View/View.js").ComponentFn;
|
|
35
|
-
import Widget from
|
|
36
|
-
import CoreApp from
|
|
37
|
-
import { Message } from
|
|
38
|
-
import View from
|
|
35
|
+
import Widget from './Widget.js';
|
|
36
|
+
import CoreApp from './CoreApp.js';
|
|
37
|
+
import { Message } from '@nan0web/co';
|
|
38
|
+
import View from '../../View/View.js';
|
|
@@ -33,7 +33,7 @@ export default class Widget extends EventProcessor {
|
|
|
33
33
|
render(viewFnOrName: Function | string, outputData: object): any;
|
|
34
34
|
}
|
|
35
35
|
export type ComponentFn = import("./UI.js").ComponentFn;
|
|
36
|
-
import EventProcessor from
|
|
37
|
-
import View from
|
|
38
|
-
import { UiMessage } from
|
|
39
|
-
import { StreamEntry } from
|
|
36
|
+
import EventProcessor from '@nan0web/event/oop';
|
|
37
|
+
import View from '../../View/View.js';
|
|
38
|
+
import { UiMessage } from '../../core/index.js';
|
|
39
|
+
import { StreamEntry } from '@nan0web/db';
|
|
@@ -4,7 +4,7 @@ declare namespace _default {
|
|
|
4
4
|
export { Widget };
|
|
5
5
|
}
|
|
6
6
|
export default _default;
|
|
7
|
-
import CoreApp from
|
|
8
|
-
import UI from
|
|
9
|
-
import Widget from
|
|
7
|
+
import CoreApp from './CoreApp.js';
|
|
8
|
+
import UI from './UI.js';
|
|
9
|
+
import Widget from './Widget.js';
|
|
10
10
|
export { CoreApp, UI };
|
package/types/App/Scenario.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default UiMessage;
|
|
2
|
-
import UiMessage from
|
|
2
|
+
import UiMessage from '../../../core/Message/Message.js';
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
export default UserAppCommandOptions
|
|
1
|
+
export default UserAppCommandOptions
|
|
2
2
|
/**
|
|
3
3
|
* Extends CommandOptions to include user-specific options.
|
|
4
4
|
*/
|
|
5
5
|
declare class UserAppCommandOptions {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Default option values including inherited ones.
|
|
8
|
+
* @type {object}
|
|
9
|
+
* @property {boolean} help - Whether help is requested
|
|
10
|
+
* @property {string} cwd - Current working directory
|
|
11
|
+
* @property {string} user - User name
|
|
12
|
+
*/
|
|
13
|
+
static DEFAULTS: object
|
|
14
|
+
/**
|
|
15
|
+
* Creates a UserAppCommandOptions instance from the given props.
|
|
16
|
+
* @param {UserAppCommandOptions|object} props - The properties to create from
|
|
17
|
+
* @returns {UserAppCommandOptions} A UserAppCommandOptions instance
|
|
18
|
+
*/
|
|
19
|
+
static from(props: UserAppCommandOptions | object): UserAppCommandOptions
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new UserAppCommandOptions instance.
|
|
22
|
+
* @param {object} props - Options properties
|
|
23
|
+
* @param {boolean} [props.help=false] - Whether help is requested
|
|
24
|
+
* @param {string} [props.cwd=""] - Current working directory
|
|
25
|
+
* @param {string} [props.user=""] - User name
|
|
26
|
+
*/
|
|
27
|
+
constructor(props?: {
|
|
28
|
+
help?: boolean | undefined
|
|
29
|
+
cwd?: string | undefined
|
|
30
|
+
user?: string | undefined
|
|
31
|
+
})
|
|
32
|
+
/** @type {string} User name */
|
|
33
|
+
user: string
|
|
34
34
|
}
|
|
@@ -34,8 +34,8 @@ export default class UserApp extends CoreApp {
|
|
|
34
34
|
welcome(cmd: UserAppCommandMessage, ui: UserUI): Promise<string[][]>;
|
|
35
35
|
user: User | undefined;
|
|
36
36
|
}
|
|
37
|
-
import CoreApp from
|
|
38
|
-
import DepsCommand from
|
|
39
|
-
import UserUI from
|
|
40
|
-
import UserAppCommandMessage from
|
|
41
|
-
import User from
|
|
37
|
+
import CoreApp from '../Core/CoreApp.js';
|
|
38
|
+
import DepsCommand from './Command/Message.js';
|
|
39
|
+
import UserUI from './UserUI.js';
|
|
40
|
+
import UserAppCommandMessage from './Command/Message.js';
|
|
41
|
+
import User from '../../Model/User/User.js';
|
package/types/App/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ declare namespace _default {
|
|
|
5
5
|
export { UI };
|
|
6
6
|
}
|
|
7
7
|
export default _default;
|
|
8
|
-
import Core from
|
|
9
|
-
import User from
|
|
10
|
-
import Scenario from
|
|
11
|
-
import UI from
|
|
8
|
+
import Core from './Core/index.js';
|
|
9
|
+
import User from './User/index.js';
|
|
10
|
+
import Scenario from './Scenario.js';
|
|
11
|
+
import UI from './Core/UI.js';
|
|
12
12
|
export { Core, User, Scenario, UI };
|
|
@@ -9,5 +9,5 @@ declare function Process(this: View, props?: ProcessInput | object): string[][];
|
|
|
9
9
|
declare namespace Process {
|
|
10
10
|
export { ProcessInput as Input };
|
|
11
11
|
}
|
|
12
|
-
import ProcessInput from
|
|
13
|
-
import View from
|
|
12
|
+
import ProcessInput from './Input.js';
|
|
13
|
+
import View from '../../View/View.js';
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default SortableList;
|
|
2
|
+
/**
|
|
3
|
+
* Headless Sortable List — pure data model with callbacks.
|
|
4
|
+
* Platform-agnostic: works in Node.js, browser, CLI, anywhere.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const list = SortableList.create({
|
|
8
|
+
* items: ['a', 'b', 'c'],
|
|
9
|
+
* onChange: (items) => console.log(items),
|
|
10
|
+
* })
|
|
11
|
+
* list.moveUp(1) // ['b', 'a', 'c']
|
|
12
|
+
*/
|
|
13
|
+
declare class SortableList {
|
|
14
|
+
/**
|
|
15
|
+
* Factory method.
|
|
16
|
+
* @param {object} opts
|
|
17
|
+
* @returns {SortableList}
|
|
18
|
+
*/
|
|
19
|
+
static create(opts: object): SortableList;
|
|
20
|
+
/**
|
|
21
|
+
* @param {object} [opts]
|
|
22
|
+
* @param {any[]} [opts.items]
|
|
23
|
+
* @param {function} [opts.onChange]
|
|
24
|
+
*/
|
|
25
|
+
constructor({ items, onChange }?: {
|
|
26
|
+
items?: any[] | undefined;
|
|
27
|
+
onChange?: Function | undefined;
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Move item at index up (swap with previous).
|
|
31
|
+
* No-op if already at top.
|
|
32
|
+
* @param {number} index
|
|
33
|
+
*/
|
|
34
|
+
moveUp(index: number): void;
|
|
35
|
+
/**
|
|
36
|
+
* Move item at index down (swap with next).
|
|
37
|
+
* No-op if already at bottom.
|
|
38
|
+
* @param {number} index
|
|
39
|
+
*/
|
|
40
|
+
moveDown(index: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* Returns a copy of the current item order.
|
|
43
|
+
* @returns {any[]}
|
|
44
|
+
*/
|
|
45
|
+
getItems(): any[];
|
|
46
|
+
/**
|
|
47
|
+
* Move item from one position to another (drag-n-drop).
|
|
48
|
+
* No-op if indices are equal or out of bounds.
|
|
49
|
+
* @param {number} from - source index
|
|
50
|
+
* @param {number} to - target index
|
|
51
|
+
*/
|
|
52
|
+
moveTo(from: number, to: number): void;
|
|
53
|
+
/**
|
|
54
|
+
* Restores the initial order.
|
|
55
|
+
*/
|
|
56
|
+
reset(): void;
|
|
57
|
+
#private;
|
|
58
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
export { Welcome };
|
|
3
3
|
export { Process };
|
|
4
|
+
export { SortableList };
|
|
4
5
|
}
|
|
5
6
|
export default _default;
|
|
6
|
-
import Welcome from
|
|
7
|
-
import Process from
|
|
8
|
-
|
|
7
|
+
import Welcome from './Welcome/index.js';
|
|
8
|
+
import Process from './Process/index.js';
|
|
9
|
+
import SortableList from './SortableList/index.js';
|
|
10
|
+
export { Welcome, Process, SortableList };
|
package/types/Frame/Frame.d.ts
CHANGED
package/types/Frame/Props.d.ts
CHANGED
package/types/Model/index.d.ts
CHANGED
package/types/StdIn.d.ts
CHANGED
|
@@ -55,8 +55,8 @@ export default class StdIn extends EventProcessor {
|
|
|
55
55
|
*/
|
|
56
56
|
decode(message: UiMessage | string[] | any): UiMessage;
|
|
57
57
|
}
|
|
58
|
-
import EventProcessor from
|
|
59
|
-
import { UiMessage } from
|
|
58
|
+
import EventProcessor from '@nan0web/event/oop';
|
|
59
|
+
import { UiMessage } from './core/index.js';
|
|
60
60
|
declare class Processor extends EventProcessor {
|
|
61
61
|
}
|
|
62
62
|
export {};
|
package/types/StdOut.d.ts
CHANGED
package/types/View/View.d.ts
CHANGED
|
@@ -106,10 +106,10 @@ export type ComponentFn = {
|
|
|
106
106
|
ask: (input: UiMessage) => Promise<any>;
|
|
107
107
|
bind: Function;
|
|
108
108
|
};
|
|
109
|
-
import StdIn from
|
|
110
|
-
import StdOut from
|
|
111
|
-
import Frame from
|
|
112
|
-
import Locale from
|
|
113
|
-
import { FrameRenderMethod } from
|
|
114
|
-
import RenderOptions from
|
|
115
|
-
import UiMessage from
|
|
109
|
+
import StdIn from '../StdIn.js';
|
|
110
|
+
import StdOut from '../StdOut.js';
|
|
111
|
+
import Frame from '../Frame/Frame.js';
|
|
112
|
+
import Locale from '../Locale.js';
|
|
113
|
+
import { FrameRenderMethod } from '../Frame/Frame.js';
|
|
114
|
+
import RenderOptions from './RenderOptions.js';
|
|
115
|
+
import UiMessage from '../core/Message/Message.js';
|