@nan0web/ui 1.6.2 → 1.8.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 +90 -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/Navigation.js +59 -0
- package/src/domain/SandboxModel.js +193 -0
- package/src/domain/ShowcaseAppModel.js +90 -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 +17 -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/Navigation.d.ts +50 -0
- package/types/domain/SandboxModel.d.ts +59 -0
- package/types/domain/ShowcaseAppModel.d.ts +64 -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 +4 -0
- package/types/format.d.ts +5 -0
- package/types/index.d.ts +4 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export class IntentErrorModel {
|
|
2
|
+
static intent_not_object: {
|
|
3
|
+
help: string;
|
|
4
|
+
error: string;
|
|
5
|
+
};
|
|
6
|
+
static intent_unknown_type: {
|
|
7
|
+
help: string;
|
|
8
|
+
error: string;
|
|
9
|
+
};
|
|
10
|
+
static ask_missing_field: {
|
|
11
|
+
help: string;
|
|
12
|
+
error: string;
|
|
13
|
+
};
|
|
14
|
+
static ask_missing_schema_help: {
|
|
15
|
+
help: string;
|
|
16
|
+
error: string;
|
|
17
|
+
};
|
|
18
|
+
static intent_missing_message: {
|
|
19
|
+
help: string;
|
|
20
|
+
error: string;
|
|
21
|
+
};
|
|
22
|
+
static adapter_missing_ask: {
|
|
23
|
+
help: string;
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
static ask_wrong_response: {
|
|
27
|
+
help: string;
|
|
28
|
+
error: string;
|
|
29
|
+
};
|
|
30
|
+
static validation_failed: {
|
|
31
|
+
help: string;
|
|
32
|
+
error: string;
|
|
33
|
+
};
|
|
34
|
+
static unhandled_intent: {
|
|
35
|
+
help: string;
|
|
36
|
+
error: string;
|
|
37
|
+
};
|
|
38
|
+
static timeout: {
|
|
39
|
+
help: string;
|
|
40
|
+
error: string;
|
|
41
|
+
};
|
|
42
|
+
static aborted: {
|
|
43
|
+
help: string;
|
|
44
|
+
error: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Build a ModelError for a specific error field.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} field - Static field name on IntentErrorModel.
|
|
50
|
+
* @param {Record<string, *>} [params] - Template parameters to substitute {key} placeholders.
|
|
51
|
+
* @returns {ModelError}
|
|
52
|
+
*/
|
|
53
|
+
static error(field: string, params?: Record<string, any>): ModelError;
|
|
54
|
+
}
|
|
55
|
+
import { ModelError } from '@nan0web/types';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export class MaskHandler {
|
|
2
|
+
constructor(mask: any);
|
|
3
|
+
mask: any;
|
|
4
|
+
raw: string;
|
|
5
|
+
/** How many placeholder positions the mask has */
|
|
6
|
+
get _slotCount(): number;
|
|
7
|
+
/** Static prefix of the mask (literal characters before first placeholder) */
|
|
8
|
+
get _prefix(): string;
|
|
9
|
+
get isComplete(): boolean;
|
|
10
|
+
get formatted(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Append a digit/letter character.
|
|
13
|
+
* Only accepts characters that fit into placeholders.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} char
|
|
16
|
+
* @returns {boolean} true if accepted
|
|
17
|
+
*/
|
|
18
|
+
input(char: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Remove last character
|
|
21
|
+
*/
|
|
22
|
+
backspace(): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Set a full value, intelligently stripping the mask's static prefix
|
|
25
|
+
* if the user pasted or injected the full formatted number.
|
|
26
|
+
*
|
|
27
|
+
* e.g. setValue('+380660848404') with mask '+38 (099) 999 9999'
|
|
28
|
+
* strips "+38" → raw = '0660848404'
|
|
29
|
+
*
|
|
30
|
+
* @param {string} val
|
|
31
|
+
*/
|
|
32
|
+
setValue(val: string): void;
|
|
33
|
+
}
|
package/types/core/index.d.ts
CHANGED
|
@@ -4,9 +4,13 @@ export { default as UiMessage } from "./Message/Message.js";
|
|
|
4
4
|
export { default as FormMessage } from "./Form/Message.js";
|
|
5
5
|
export { default as FormInput } from "./Form/Input.js";
|
|
6
6
|
export { default as UiAdapter } from "./UiAdapter.js";
|
|
7
|
+
export { IntentErrorModel } from "./IntentErrorModel.js";
|
|
8
|
+
export { runGenerator } from "./GeneratorRunner.js";
|
|
9
|
+
export { MaskHandler } from "./MaskHandler.js";
|
|
7
10
|
import UIStream from './Stream.js';
|
|
8
11
|
import StreamEntry from './StreamEntry.js';
|
|
9
12
|
import UIForm from './Form/Form.js';
|
|
10
13
|
export { UIStream, UIStream as UiStream, StreamEntry, StreamEntry as UiStreamEntry, UIForm, UIForm as UiForm };
|
|
11
14
|
export { default as Error, CancelError } from "./Error/index.js";
|
|
12
15
|
export { runFlow, flow, View, Prompt, Stream, Alert, Toast, Badge, Text, Table, Input, Select, Confirm, Multiselect, Mask, Password, Spinner, Progress, default as Flow } from "./Flow.js";
|
|
16
|
+
export { validateIntent, ask, progress, log, result, INTENT_TYPES, isModelSchema } from "./Intent.js";
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigation Model — OLMUI Model-as-Schema
|
|
3
|
+
* Generic recursive navigation structure for all UI platforms (CLI, Web, Mobile).
|
|
4
|
+
*/
|
|
5
|
+
export default class Navigation extends Model {
|
|
6
|
+
static $id: string;
|
|
7
|
+
static title: {
|
|
8
|
+
help: string;
|
|
9
|
+
placeholder: string;
|
|
10
|
+
default: string;
|
|
11
|
+
required: boolean;
|
|
12
|
+
};
|
|
13
|
+
static href: {
|
|
14
|
+
help: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
static icon: {
|
|
19
|
+
help: string;
|
|
20
|
+
placeholder: string;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
static image: {
|
|
24
|
+
help: string;
|
|
25
|
+
placeholder: string;
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
static children: {
|
|
29
|
+
help: string;
|
|
30
|
+
type: string;
|
|
31
|
+
hint: typeof Navigation;
|
|
32
|
+
default: never[];
|
|
33
|
+
};
|
|
34
|
+
static hidden: {
|
|
35
|
+
help: string;
|
|
36
|
+
type: string;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @param {Partial<Navigation>} data
|
|
41
|
+
*/
|
|
42
|
+
constructor(data?: Partial<Navigation>);
|
|
43
|
+
/** @type {string|undefined} */ title: string | undefined;
|
|
44
|
+
/** @type {string|undefined} */ href: string | undefined;
|
|
45
|
+
/** @type {string|undefined} */ icon: string | undefined;
|
|
46
|
+
/** @type {string|undefined} */ image: string | undefined;
|
|
47
|
+
/** @type {Navigation[]|undefined} */ children: Navigation[] | undefined;
|
|
48
|
+
/** @type {boolean|undefined} */ hidden: boolean | undefined;
|
|
49
|
+
}
|
|
50
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} SandboxData
|
|
3
|
+
* @property {string[]} [components]
|
|
4
|
+
* @property {string} [selectedComponent]
|
|
5
|
+
* @property {string} [themeFormat]
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Model-as-Schema for the UI Sandbox environment.
|
|
9
|
+
* Represents a tool wrapping standard OLMUI components, allowing
|
|
10
|
+
* users to inspect their models, tweak variables interactively,
|
|
11
|
+
* and export the configuration as themes for the Marketplace.
|
|
12
|
+
*
|
|
13
|
+
* Navigation uses BreadcrumbModel:
|
|
14
|
+
* ESC = pop one level (if stack has no parent → exit app)
|
|
15
|
+
* Ctrl+C = always exit (handled by prompts.js wrapper)
|
|
16
|
+
*
|
|
17
|
+
* URL mapping:
|
|
18
|
+
* /sandbox → Select Component
|
|
19
|
+
* /sandbox/button → Edit Button properties
|
|
20
|
+
* /sandbox/button/export → Choose export format
|
|
21
|
+
*/
|
|
22
|
+
export class SandboxModel extends Model {
|
|
23
|
+
static components: {
|
|
24
|
+
help: string;
|
|
25
|
+
type: string;
|
|
26
|
+
default: never[];
|
|
27
|
+
};
|
|
28
|
+
static selectedComponent: {
|
|
29
|
+
help: string;
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
static themeFormat: {
|
|
33
|
+
help: string;
|
|
34
|
+
options: string[];
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* @param {SandboxData | any} [data]
|
|
39
|
+
*/
|
|
40
|
+
constructor(data?: SandboxData | any);
|
|
41
|
+
/** @type {string[]|undefined} */ components: string[] | undefined;
|
|
42
|
+
/** @type {string|undefined} */ selectedComponent: string | undefined;
|
|
43
|
+
/** @type {string|undefined} */ themeFormat: string | undefined;
|
|
44
|
+
run(): AsyncGenerator<any, {
|
|
45
|
+
type: string;
|
|
46
|
+
data: {
|
|
47
|
+
targetComponent: string | undefined;
|
|
48
|
+
themeConfig: any;
|
|
49
|
+
exportFormat: string | undefined;
|
|
50
|
+
breadcrumb: string;
|
|
51
|
+
};
|
|
52
|
+
}, any>;
|
|
53
|
+
}
|
|
54
|
+
export type SandboxData = {
|
|
55
|
+
components?: string[] | undefined;
|
|
56
|
+
selectedComponent?: string | undefined;
|
|
57
|
+
themeFormat?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model-as-Schema for the entire UI Sandbox Showcase.
|
|
3
|
+
* Represents a complete User Journey demonstrating all components.
|
|
4
|
+
* Showcases OLMUI Scenario Testing capabilities.
|
|
5
|
+
*/
|
|
6
|
+
export class ShowcaseAppModel extends Model {
|
|
7
|
+
static appName: {
|
|
8
|
+
help: string;
|
|
9
|
+
default: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
constructor(data?: {});
|
|
13
|
+
/** @type {string|undefined} */ appName: string | undefined;
|
|
14
|
+
run(): AsyncGenerator<{
|
|
15
|
+
type: string;
|
|
16
|
+
field: string;
|
|
17
|
+
schema: {
|
|
18
|
+
help: string;
|
|
19
|
+
};
|
|
20
|
+
component: string;
|
|
21
|
+
model: any;
|
|
22
|
+
} | {
|
|
23
|
+
type: string;
|
|
24
|
+
field: string;
|
|
25
|
+
schema: {
|
|
26
|
+
help: string | undefined;
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
component: string;
|
|
30
|
+
model: any;
|
|
31
|
+
} | {
|
|
32
|
+
type: string;
|
|
33
|
+
level: string;
|
|
34
|
+
message: string | undefined;
|
|
35
|
+
component: string;
|
|
36
|
+
model: any;
|
|
37
|
+
} | {
|
|
38
|
+
type: string;
|
|
39
|
+
message: string;
|
|
40
|
+
component: string;
|
|
41
|
+
model: any;
|
|
42
|
+
}, {
|
|
43
|
+
type: string;
|
|
44
|
+
data: {
|
|
45
|
+
success: boolean;
|
|
46
|
+
reason: string;
|
|
47
|
+
profile?: undefined;
|
|
48
|
+
rowsDisplayed?: undefined;
|
|
49
|
+
};
|
|
50
|
+
} | {
|
|
51
|
+
type: string;
|
|
52
|
+
data: {
|
|
53
|
+
success: boolean;
|
|
54
|
+
profile: {
|
|
55
|
+
userName: string;
|
|
56
|
+
role: string;
|
|
57
|
+
tool: string;
|
|
58
|
+
};
|
|
59
|
+
rowsDisplayed: number;
|
|
60
|
+
reason?: undefined;
|
|
61
|
+
};
|
|
62
|
+
}, unknown>;
|
|
63
|
+
}
|
|
64
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} AutocompleteData
|
|
3
|
+
* @property {string} [content]
|
|
4
|
+
* @property {string[]} [options]
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Model-as-Schema for Autocomplete component.
|
|
8
|
+
* Represents a text input with search suggestions.
|
|
9
|
+
*/
|
|
10
|
+
export class AutocompleteModel extends Model {
|
|
11
|
+
static content: {
|
|
12
|
+
help: string;
|
|
13
|
+
default: string;
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
static options: {
|
|
17
|
+
help: string;
|
|
18
|
+
default: never[];
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @param {AutocompleteData | any} [data]
|
|
23
|
+
*/
|
|
24
|
+
constructor(data?: AutocompleteData | 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
|
+
};
|
|
34
|
+
component: string;
|
|
35
|
+
model: any;
|
|
36
|
+
}, {
|
|
37
|
+
type: string;
|
|
38
|
+
data: {
|
|
39
|
+
selected: string | undefined;
|
|
40
|
+
};
|
|
41
|
+
}, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export type AutocompleteData = {
|
|
44
|
+
content?: string | undefined;
|
|
45
|
+
options?: string[] | undefined;
|
|
46
|
+
};
|
|
47
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} BreadcrumbItem
|
|
3
|
+
* @property {string} label - Human-readable display name (e.g. "Sandbox", "Кнопка")
|
|
4
|
+
* @property {string} path - URL-safe segment (e.g. "sandbox", "button")
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} BreadcrumbData
|
|
8
|
+
* @property {BreadcrumbItem[]} [items]
|
|
9
|
+
* @property {string} [separator]
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Model-as-Schema for Breadcrumb navigation.
|
|
13
|
+
*
|
|
14
|
+
* Each breadcrumb item has a `label` (display) and a `path` (URL segment).
|
|
15
|
+
* The full path is the join of all segments, mirroring both:
|
|
16
|
+
* - Web URL: /sandbox/button/export
|
|
17
|
+
* - DBFS URI: sandbox/button/export/index (relative to db.root)
|
|
18
|
+
* - Data path: {db.root}/sandbox/button/export/index.yaml
|
|
19
|
+
* - CLI nav: 🏖 Sandbox › Button › Export
|
|
20
|
+
*
|
|
21
|
+
* This is the universal "where am I?" model for any OLMUI application.
|
|
22
|
+
*
|
|
23
|
+
* ESC/Back = pop() one item. Empty stack = app exit.
|
|
24
|
+
* Ctrl+C = always exit (adapter responsibility).
|
|
25
|
+
*/
|
|
26
|
+
export class BreadcrumbModel extends Model {
|
|
27
|
+
static items: {
|
|
28
|
+
help: string;
|
|
29
|
+
type: string;
|
|
30
|
+
default: never[];
|
|
31
|
+
};
|
|
32
|
+
static separator: {
|
|
33
|
+
help: string;
|
|
34
|
+
default: string;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Reconstruct a BreadcrumbModel from a URL path string.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} urlPath - e.g. "/sandbox/button" or "sandbox/button"
|
|
41
|
+
* @param {Record<string,string>} [labelMap={}] - Optional map of path→label for display names.
|
|
42
|
+
* @returns {BreadcrumbModel}
|
|
43
|
+
*/
|
|
44
|
+
static fromPath(urlPath: string, labelMap?: Record<string, string>): BreadcrumbModel;
|
|
45
|
+
/**
|
|
46
|
+
* Create a URL-safe slug from any label.
|
|
47
|
+
* Handles Unicode (Cyrillic, etc.) by lowercasing and replacing spaces/special chars.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} label
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
static slugify(label: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* @param {BreadcrumbData | any} [data]
|
|
55
|
+
*/
|
|
56
|
+
constructor(data?: BreadcrumbData | any);
|
|
57
|
+
/** @type {BreadcrumbItem[]} */ items: BreadcrumbItem[];
|
|
58
|
+
/** @type {string} */ separator: string;
|
|
59
|
+
/**
|
|
60
|
+
* Push a new level onto the navigation stack.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} label - Display label (e.g. "Button", "Кнопка")
|
|
63
|
+
* @param {string} [path] - URL segment. Auto-slugified from label if omitted.
|
|
64
|
+
* @returns {this}
|
|
65
|
+
*/
|
|
66
|
+
push(label: string, path?: string): this;
|
|
67
|
+
/**
|
|
68
|
+
* Pop the last level from the navigation stack.
|
|
69
|
+
*
|
|
70
|
+
* @returns {BreadcrumbItem|undefined} The removed item, or undefined if stack was empty.
|
|
71
|
+
*/
|
|
72
|
+
pop(): BreadcrumbItem | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the user can navigate back (stack has > 0 items after pop).
|
|
75
|
+
*
|
|
76
|
+
* @returns {boolean}
|
|
77
|
+
*/
|
|
78
|
+
canGoBack(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Navigate to a specific depth by truncating the stack.
|
|
81
|
+
*
|
|
82
|
+
* @param {number} depth - Target depth (0 = root only).
|
|
83
|
+
* @returns {this}
|
|
84
|
+
*/
|
|
85
|
+
navigateTo(depth: number): this;
|
|
86
|
+
/**
|
|
87
|
+
* Full URL-style path: `/sandbox/button/export`
|
|
88
|
+
* @returns {string}
|
|
89
|
+
*/
|
|
90
|
+
get path(): string;
|
|
91
|
+
/**
|
|
92
|
+
* Just the path segments array: `['sandbox', 'button', 'export']`
|
|
93
|
+
* @returns {string[]}
|
|
94
|
+
*/
|
|
95
|
+
get segments(): string[];
|
|
96
|
+
/**
|
|
97
|
+
* Just the display labels: `['Sandbox', 'Button', 'Export']`
|
|
98
|
+
* @returns {string[]}
|
|
99
|
+
*/
|
|
100
|
+
get labels(): string[];
|
|
101
|
+
/**
|
|
102
|
+
* Current (last) breadcrumb item.
|
|
103
|
+
* @returns {BreadcrumbItem|undefined}
|
|
104
|
+
*/
|
|
105
|
+
get current(): BreadcrumbItem | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Current navigation depth (0 = no items).
|
|
108
|
+
* @returns {number}
|
|
109
|
+
*/
|
|
110
|
+
get depth(): number;
|
|
111
|
+
/**
|
|
112
|
+
* Serialize to URL query param value: `sandbox/button/export`
|
|
113
|
+
* @returns {string}
|
|
114
|
+
*/
|
|
115
|
+
toURL(): string;
|
|
116
|
+
/**
|
|
117
|
+
* DBFS document URI — the key you pass to `db.fetch()` or `db.get()`.
|
|
118
|
+
* Relative to `db.root`, without extension (DBFS resolves `.yaml`/`.json` automatically).
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* nav.push('sandbox').push('button')
|
|
122
|
+
* nav.toURI() // → 'sandbox/button/index'
|
|
123
|
+
* db.fetch(nav.toURI()) // ← DBFS resolves to {root}/sandbox/button/index.yaml
|
|
124
|
+
*
|
|
125
|
+
* @param {string} [leaf='index'] - Document name without extension.
|
|
126
|
+
* @returns {string}
|
|
127
|
+
*/
|
|
128
|
+
toURI(leaf?: string): string;
|
|
129
|
+
/**
|
|
130
|
+
* Full filesystem path relative to db.root: `sandbox/button/export/index.yaml`
|
|
131
|
+
* This is what DBFS resolves to on disk: `{cwd}/{root}/{toDataPath()}`.
|
|
132
|
+
*
|
|
133
|
+
* @param {string} [filename='index.yaml'] - Leaf filename with extension.
|
|
134
|
+
* @returns {string}
|
|
135
|
+
*/
|
|
136
|
+
toDataPath(filename?: string): string;
|
|
137
|
+
/**
|
|
138
|
+
* Yields a log intent with the current breadcrumb path.
|
|
139
|
+
* This is a "display-only" run — it shows the navigation state.
|
|
140
|
+
*/
|
|
141
|
+
run(): AsyncGenerator<any, {
|
|
142
|
+
type: string;
|
|
143
|
+
data: {
|
|
144
|
+
path: string;
|
|
145
|
+
items: BreadcrumbItem[];
|
|
146
|
+
depth: number;
|
|
147
|
+
};
|
|
148
|
+
}, unknown>;
|
|
149
|
+
}
|
|
150
|
+
export type BreadcrumbItem = {
|
|
151
|
+
/**
|
|
152
|
+
* - Human-readable display name (e.g. "Sandbox", "Кнопка")
|
|
153
|
+
*/
|
|
154
|
+
label: string;
|
|
155
|
+
/**
|
|
156
|
+
* - URL-safe segment (e.g. "sandbox", "button")
|
|
157
|
+
*/
|
|
158
|
+
path: string;
|
|
159
|
+
};
|
|
160
|
+
export type BreadcrumbData = {
|
|
161
|
+
items?: BreadcrumbItem[] | undefined;
|
|
162
|
+
separator?: string | undefined;
|
|
163
|
+
};
|
|
164
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {'primary'|'secondary'|'info'|'ok'|'warn'|'err'|'ghost'} ButtonVariant
|
|
3
|
+
* @typedef {'sm'|'md'|'lg'} ButtonSize
|
|
4
|
+
* @typedef {Object} ButtonData
|
|
5
|
+
* @property {string} [content]
|
|
6
|
+
* @property {ButtonVariant} [variant]
|
|
7
|
+
* @property {ButtonSize} [size]
|
|
8
|
+
* @property {boolean} [outline]
|
|
9
|
+
* @property {boolean} [disabled]
|
|
10
|
+
* @property {boolean} [loading]
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Model-as-Schema for Button component.
|
|
14
|
+
* Represents the intention and state of a Button interaction.
|
|
15
|
+
* Used exclusively for schema definition and editor validation.
|
|
16
|
+
*/
|
|
17
|
+
export class ButtonModel extends Model {
|
|
18
|
+
static content: {
|
|
19
|
+
help: string;
|
|
20
|
+
default: string;
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
static variant: {
|
|
24
|
+
help: string;
|
|
25
|
+
default: string;
|
|
26
|
+
options: string[];
|
|
27
|
+
};
|
|
28
|
+
static size: {
|
|
29
|
+
help: string;
|
|
30
|
+
default: string;
|
|
31
|
+
options: string[];
|
|
32
|
+
};
|
|
33
|
+
static outline: {
|
|
34
|
+
help: string;
|
|
35
|
+
default: boolean;
|
|
36
|
+
type: string;
|
|
37
|
+
};
|
|
38
|
+
static disabled: {
|
|
39
|
+
help: string;
|
|
40
|
+
default: boolean;
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
static loading: {
|
|
44
|
+
help: string;
|
|
45
|
+
default: boolean;
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @param {ButtonData | any} [data]
|
|
50
|
+
*/
|
|
51
|
+
constructor(data?: ButtonData | any);
|
|
52
|
+
/** @type {string|undefined} */ content: string | undefined;
|
|
53
|
+
/** @type {ButtonVariant|undefined} */ variant: ButtonVariant | undefined;
|
|
54
|
+
/** @type {ButtonSize|undefined} */ size: ButtonSize | undefined;
|
|
55
|
+
/** @type {boolean|undefined} */ outline: boolean | undefined;
|
|
56
|
+
/** @type {boolean|undefined} */ disabled: boolean | undefined;
|
|
57
|
+
/** @type {boolean|undefined} */ loading: boolean | undefined;
|
|
58
|
+
run(): AsyncGenerator<{
|
|
59
|
+
type: string;
|
|
60
|
+
field: string;
|
|
61
|
+
schema: {
|
|
62
|
+
help: string;
|
|
63
|
+
};
|
|
64
|
+
component: string;
|
|
65
|
+
model: any;
|
|
66
|
+
}, {
|
|
67
|
+
type: string;
|
|
68
|
+
data: any;
|
|
69
|
+
}, unknown>;
|
|
70
|
+
}
|
|
71
|
+
export type ButtonVariant = "primary" | "secondary" | "info" | "ok" | "warn" | "err" | "ghost";
|
|
72
|
+
export type ButtonSize = "sm" | "md" | "lg";
|
|
73
|
+
export type ButtonData = {
|
|
74
|
+
content?: string | undefined;
|
|
75
|
+
variant?: ButtonVariant | undefined;
|
|
76
|
+
size?: ButtonSize | undefined;
|
|
77
|
+
outline?: boolean | undefined;
|
|
78
|
+
disabled?: boolean | undefined;
|
|
79
|
+
loading?: boolean | undefined;
|
|
80
|
+
};
|
|
81
|
+
import { Model } from '@nan0web/core';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} ConfirmData
|
|
3
|
+
* @property {string} [message]
|
|
4
|
+
* @property {string} [confirmText]
|
|
5
|
+
* @property {string} [cancelText]
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Model-as-Schema for Confirm component.
|
|
9
|
+
*/
|
|
10
|
+
export class ConfirmModel extends Model {
|
|
11
|
+
static message: {
|
|
12
|
+
help: string;
|
|
13
|
+
default: string;
|
|
14
|
+
type: string;
|
|
15
|
+
};
|
|
16
|
+
static confirmText: {
|
|
17
|
+
help: string;
|
|
18
|
+
default: string;
|
|
19
|
+
type: string;
|
|
20
|
+
};
|
|
21
|
+
static cancelText: {
|
|
22
|
+
help: string;
|
|
23
|
+
default: string;
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @param {ConfirmData | any} [data]
|
|
28
|
+
*/
|
|
29
|
+
constructor(data?: ConfirmData | any);
|
|
30
|
+
/** @type {string|undefined} */ message: string | undefined;
|
|
31
|
+
/** @type {string|undefined} */ confirmText: string | undefined;
|
|
32
|
+
/** @type {string|undefined} */ cancelText: string | undefined;
|
|
33
|
+
run(): AsyncGenerator<{
|
|
34
|
+
type: string;
|
|
35
|
+
field: string;
|
|
36
|
+
schema: {
|
|
37
|
+
help: string | undefined;
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
component: string;
|
|
41
|
+
model: any;
|
|
42
|
+
}, {
|
|
43
|
+
type: string;
|
|
44
|
+
data: {
|
|
45
|
+
confirmed: boolean;
|
|
46
|
+
};
|
|
47
|
+
}, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export type ConfirmData = {
|
|
50
|
+
message?: string | undefined;
|
|
51
|
+
confirmText?: string | undefined;
|
|
52
|
+
cancelText?: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
import { Model } from '@nan0web/core';
|