@nan0web/ui 1.7.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nan0web/ui",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "NaN•Web UI. One application logic (algorithm) and many UI.",
5
5
  "main": "src/index.js",
6
6
  "types": "types/index.d.ts",
@@ -58,7 +58,8 @@
58
58
  "@nan0web/event": "^1.0.1",
59
59
  "@nan0web/log": "^1.1.1",
60
60
  "@nan0web/types": "^1.4.0",
61
- "string-width": "^7.2.0"
61
+ "string-width": "^7.2.0",
62
+ "@nan0web/core": "1.1.1"
62
63
  },
63
64
  "scripts": {
64
65
  "build": "tsc",
@@ -0,0 +1,59 @@
1
+ import { Model } from '@nan0web/core'
2
+
3
+ /**
4
+ * Navigation Model — OLMUI Model-as-Schema
5
+ * Generic recursive navigation structure for all UI platforms (CLI, Web, Mobile).
6
+ */
7
+ export default class Navigation extends Model {
8
+ static $id = '@nan0web/ui/Navigation'
9
+
10
+ static title = {
11
+ help: 'Label for the menu item',
12
+ placeholder: 'Home',
13
+ default: '',
14
+ required: true,
15
+ }
16
+ static href = {
17
+ help: 'URL or internal app route',
18
+ placeholder: '/',
19
+ default: '#',
20
+ }
21
+ static icon = {
22
+ help: 'Icon name/ID',
23
+ placeholder: 'home',
24
+ default: '',
25
+ }
26
+ static image = {
27
+ help: 'Display image or thumbnail',
28
+ placeholder: 'https://...',
29
+ default: '',
30
+ }
31
+ static children = {
32
+ help: 'Nested sub-menu navigation',
33
+ type: 'Navigation[]',
34
+ hint: Navigation,
35
+ default: [],
36
+ }
37
+ static hidden = {
38
+ help: 'Hide from lists/menus',
39
+ type: 'boolean',
40
+ default: false,
41
+ }
42
+
43
+ /**
44
+ * @param {Partial<Navigation>} data
45
+ */
46
+ constructor(data = {}) {
47
+ super(data)
48
+ /** @type {string|undefined} */ this.title
49
+ /** @type {string|undefined} */ this.href
50
+ /** @type {string|undefined} */ this.icon
51
+ /** @type {string|undefined} */ this.image
52
+ /** @type {Navigation[]|undefined} */ this.children
53
+ /** @type {boolean|undefined} */ this.hidden
54
+
55
+ if (this.children) {
56
+ this.children = this.children.map((item) => new Navigation(item))
57
+ }
58
+ }
59
+ }
@@ -1,11 +1,12 @@
1
1
  import { InputModel, ConfirmModel, SpinnerModel, ToastModel, TableModel, ButtonModel, AutocompleteModel, SelectModel } from './components/index.js'
2
+ import { Model } from '@nan0web/core'
2
3
 
3
4
  /**
4
5
  * Model-as-Schema for the entire UI Sandbox Showcase.
5
6
  * Represents a complete User Journey demonstrating all components.
6
7
  * Showcases OLMUI Scenario Testing capabilities.
7
8
  */
8
- export class ShowcaseAppModel {
9
+ export class ShowcaseAppModel extends Model {
9
10
  // ==========================================
10
11
  // 1. MODEL AS SCHEMA (Static Definition)
11
12
  // ==========================================
@@ -16,8 +17,9 @@ export class ShowcaseAppModel {
16
17
  type: 'string',
17
18
  }
18
19
 
19
- constructor() {
20
- this.appName = ShowcaseAppModel.appName.default
20
+ constructor(data = {}) {
21
+ super(data)
22
+ /** @type {string|undefined} */ this.appName
21
23
  }
22
24
 
23
25
  // ==========================================
@@ -1,6 +1,7 @@
1
1
  // Domain Models — OLMUI Model-as-Schema
2
2
  export { SandboxModel } from './SandboxModel.js'
3
3
  export { ShowcaseAppModel } from './ShowcaseAppModel.js'
4
+ export { default as Navigation } from './Navigation.js'
4
5
 
5
6
  // Component Models
6
7
  export {
@@ -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';
@@ -3,13 +3,14 @@
3
3
  * Represents a complete User Journey demonstrating all components.
4
4
  * Showcases OLMUI Scenario Testing capabilities.
5
5
  */
6
- export class ShowcaseAppModel {
6
+ export class ShowcaseAppModel extends Model {
7
7
  static appName: {
8
8
  help: string;
9
9
  default: string;
10
10
  type: string;
11
11
  };
12
- appName: string;
12
+ constructor(data?: {});
13
+ /** @type {string|undefined} */ appName: string | undefined;
13
14
  run(): AsyncGenerator<{
14
15
  type: string;
15
16
  field: string;
@@ -60,3 +61,4 @@ export class ShowcaseAppModel {
60
61
  };
61
62
  }, unknown>;
62
63
  }
64
+ import { Model } from '@nan0web/core';
@@ -1,3 +1,4 @@
1
1
  export { SandboxModel } from "./SandboxModel.js";
2
2
  export { ShowcaseAppModel } from "./ShowcaseAppModel.js";
3
+ export { default as Navigation } from "./Navigation.js";
3
4
  export { ButtonModel, ConfirmModel, InputModel, SpinnerModel, TableModel, ToastModel, SelectModel, AutocompleteModel, TreeModel } from "./components/index.js";