@nan0web/ui 1.8.0 → 1.10.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 (107) hide show
  1. package/README.md +29 -10
  2. package/package.json +18 -22
  3. package/src/Model/index.js +32 -3
  4. package/src/core/Form/Form.js +8 -7
  5. package/src/core/Form/Message.js +1 -1
  6. package/src/core/GeneratorRunner.js +10 -0
  7. package/src/core/Intent.js +21 -5
  8. package/src/core/IntentErrorModel.js +6 -1
  9. package/src/core/Stream.js +16 -5
  10. package/src/core/index.js +1 -1
  11. package/src/domain/FooterModel.js +57 -0
  12. package/src/domain/HeaderModel.js +50 -0
  13. package/src/domain/HeroModel.js +48 -0
  14. package/src/domain/Navigation.js +11 -10
  15. package/src/domain/SandboxModel.js +66 -115
  16. package/src/domain/ShowcaseAppModel.js +133 -50
  17. package/src/domain/components/AccordionModel.js +38 -0
  18. package/src/domain/components/AutocompleteModel.js +11 -21
  19. package/src/domain/components/BannerModel.js +37 -0
  20. package/src/domain/components/BreadcrumbModel.js +11 -9
  21. package/src/domain/components/ButtonModel.js +31 -58
  22. package/src/domain/components/CommentModel.js +44 -0
  23. package/src/domain/components/ConfirmModel.js +26 -33
  24. package/src/domain/components/EmptyStateModel.js +45 -0
  25. package/src/domain/components/FAQModel.js +32 -0
  26. package/src/domain/components/FooterConfigModel.js +26 -0
  27. package/src/domain/components/FooterVisibilityModel.js +48 -0
  28. package/src/domain/components/GalleryModel.js +36 -0
  29. package/src/domain/components/HeaderConfigModel.js +26 -0
  30. package/src/domain/components/HeaderVisibilityModel.js +54 -0
  31. package/src/domain/components/InputModel.js +21 -41
  32. package/src/domain/components/PriceModel.js +30 -0
  33. package/src/domain/components/PricingModel.js +39 -0
  34. package/src/domain/components/PricingSectionModel.js +32 -0
  35. package/src/domain/components/ProfileDropdownModel.js +45 -0
  36. package/src/domain/components/SelectModel.js +11 -21
  37. package/src/domain/components/SpinnerModel.js +11 -26
  38. package/src/domain/components/StatsItemModel.js +38 -0
  39. package/src/domain/components/StatsModel.js +32 -0
  40. package/src/domain/components/TableModel.js +11 -24
  41. package/src/domain/components/TabsModel.js +30 -0
  42. package/src/domain/components/TestimonialModel.js +24 -0
  43. package/src/domain/components/TimelineItemModel.js +38 -0
  44. package/src/domain/components/TimelineModel.js +32 -0
  45. package/src/domain/components/ToastModel.js +24 -51
  46. package/src/domain/components/TreeModel.js +10 -26
  47. package/src/domain/components/index.js +34 -0
  48. package/src/domain/index.js +24 -0
  49. package/src/index.js +2 -0
  50. package/src/testing/GalleryGenerator.js +85 -0
  51. package/src/testing/LogicInspector.js +55 -0
  52. package/src/testing/SnapshotInspector.js +84 -0
  53. package/src/testing/VisualAdapter.js +41 -0
  54. package/src/testing/index.js +3 -0
  55. package/types/Model/index.d.ts +62 -4
  56. package/types/core/Form/Form.d.ts +2 -2
  57. package/types/core/GeneratorRunner.d.ts +4 -0
  58. package/types/core/Intent.d.ts +31 -3
  59. package/types/core/IntentErrorModel.d.ts +4 -0
  60. package/types/core/index.d.ts +1 -1
  61. package/types/domain/FooterModel.d.ts +52 -0
  62. package/types/domain/HeaderModel.d.ts +45 -0
  63. package/types/domain/HeroModel.d.ts +43 -0
  64. package/types/domain/Navigation.d.ts +10 -9
  65. package/types/domain/SandboxModel.d.ts +16 -40
  66. package/types/domain/ShowcaseAppModel.d.ts +26 -54
  67. package/types/domain/components/AccordionModel.d.ts +33 -0
  68. package/types/domain/components/AutocompleteModel.d.ts +10 -29
  69. package/types/domain/components/BannerModel.d.ts +32 -0
  70. package/types/domain/components/BreadcrumbModel.d.ts +13 -6
  71. package/types/domain/components/ButtonModel.d.ts +18 -54
  72. package/types/domain/components/CommentModel.d.ts +39 -0
  73. package/types/domain/components/ConfirmModel.d.ts +20 -35
  74. package/types/domain/components/EmptyStateModel.d.ts +40 -0
  75. package/types/domain/components/FAQModel.d.ts +27 -0
  76. package/types/domain/components/FooterConfigModel.d.ts +21 -0
  77. package/types/domain/components/FooterVisibilityModel.d.ts +43 -0
  78. package/types/domain/components/GalleryModel.d.ts +35 -0
  79. package/types/domain/components/HeaderConfigModel.d.ts +21 -0
  80. package/types/domain/components/HeaderVisibilityModel.d.ts +49 -0
  81. package/types/domain/components/HeroModel.d.ts +24 -0
  82. package/types/domain/components/InputModel.d.ts +19 -59
  83. package/types/domain/components/PriceModel.d.ts +25 -0
  84. package/types/domain/components/PricingModel.d.ts +34 -0
  85. package/types/domain/components/PricingSectionModel.d.ts +27 -0
  86. package/types/domain/components/ProfileDropdownModel.d.ts +40 -0
  87. package/types/domain/components/SelectModel.d.ts +13 -28
  88. package/types/domain/components/ShowcaseAppModel.d.ts +32 -0
  89. package/types/domain/components/SpinnerModel.d.ts +10 -27
  90. package/types/domain/components/StatsItemModel.d.ts +33 -0
  91. package/types/domain/components/StatsModel.d.ts +27 -0
  92. package/types/domain/components/TableModel.d.ts +10 -26
  93. package/types/domain/components/TabsModel.d.ts +28 -0
  94. package/types/domain/components/TestimonialModel.d.ts +18 -0
  95. package/types/domain/components/TimelineItemModel.d.ts +33 -0
  96. package/types/domain/components/TimelineModel.d.ts +27 -0
  97. package/types/domain/components/ToastModel.d.ts +16 -45
  98. package/types/domain/components/TreeModel.d.ts +13 -36
  99. package/types/domain/components/index.d.ts +20 -0
  100. package/types/domain/index.d.ts +4 -1
  101. package/types/index.d.ts +1 -0
  102. package/types/testing/GalleryGenerator.d.ts +1 -0
  103. package/types/testing/LogicInspector.d.ts +22 -0
  104. package/types/testing/SnapshotInspector.d.ts +17 -0
  105. package/types/testing/VisualAdapter.d.ts +15 -0
  106. package/types/testing/index.d.ts +3 -0
  107. package/src/README.md.js +0 -436
@@ -0,0 +1,28 @@
1
+ /**
2
+ * TabsModel — OLMUI Model-as-Schema
3
+ * Tab container with selectable panels.
4
+ */
5
+ export class TabsModel extends Model {
6
+ static $id: string;
7
+ static active: {
8
+ help: string;
9
+ default: number;
10
+ type: string;
11
+ };
12
+ static tabs: {
13
+ help: string;
14
+ type: string;
15
+ default: never[];
16
+ };
17
+ /**
18
+ * @param {Partial<TabsModel> | Record<string, any>} data Model input data.
19
+ * @param {object} [options] Extended options (db, etc.)
20
+ */
21
+ constructor(data?: Partial<TabsModel> | Record<string, any>, options?: object);
22
+ /** @type {number} Index of the currently active tab */ active: number;
23
+ /** @type {Array<{label: string, content: string}>} Tab definitions */ tabs: Array<{
24
+ label: string;
25
+ content: string;
26
+ }>;
27
+ }
28
+ import { Model } from '@nan0web/types';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * TestimonialModel — OLMUI Model-as-Schema
3
+ * Extends CommentModel with a rating field for testimonials/reviews.
4
+ */
5
+ export class TestimonialModel extends CommentModel {
6
+ static rating: {
7
+ help: string;
8
+ default: number;
9
+ type: string;
10
+ };
11
+ /**
12
+ * @param {Partial<TestimonialModel> | Record<string, any>} data Model input data.
13
+ * @param {object} [options] Extended options (db, etc.)
14
+ */
15
+ constructor(data?: Partial<TestimonialModel> | Record<string, any>, options?: object);
16
+ /** @type {number} Rating from 1 to 5 stars */ rating: number;
17
+ }
18
+ import { CommentModel } from './CommentModel.js';
@@ -0,0 +1,33 @@
1
+ /**
2
+ * TimelineItemModel — OLMUI Model-as-Schema
3
+ * A single entry on a timeline (event, milestone, changelog).
4
+ */
5
+ export class TimelineItemModel extends Model {
6
+ static $id: string;
7
+ static date: {
8
+ help: string;
9
+ placeholder: string;
10
+ default: string;
11
+ required: boolean;
12
+ };
13
+ static title: {
14
+ help: string;
15
+ placeholder: string;
16
+ default: string;
17
+ required: boolean;
18
+ };
19
+ static description: {
20
+ help: string;
21
+ placeholder: string;
22
+ default: string;
23
+ };
24
+ /**
25
+ * @param {Partial<TimelineItemModel> | Record<string, any>} data Model input data.
26
+ * @param {object} [options] Extended options (db, etc.)
27
+ */
28
+ constructor(data?: Partial<TimelineItemModel> | Record<string, any>, options?: object);
29
+ /** @type {string} Date of the event */ date: string;
30
+ /** @type {string} Event or milestone title */ title: string;
31
+ /** @type {string} Detailed description of the event */ description: string;
32
+ }
33
+ import { Model } from '@nan0web/types';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * TimelineModel — OLMUI Model-as-Schema
3
+ * A collection of timeline events (changelog, roadmap, history).
4
+ */
5
+ export class TimelineModel extends Model {
6
+ static $id: string;
7
+ static title: {
8
+ help: string;
9
+ placeholder: string;
10
+ default: string;
11
+ };
12
+ static items: {
13
+ help: string;
14
+ type: string;
15
+ hint: typeof TimelineItemModel;
16
+ default: never[];
17
+ };
18
+ /**
19
+ * @param {Partial<TimelineModel> | Record<string, any>} data Model input data.
20
+ * @param {object} [options] Extended options (db, etc.)
21
+ */
22
+ constructor(data?: Partial<TimelineModel> | Record<string, any>, options?: object);
23
+ /** @type {string} Timeline section title */ title: string;
24
+ /** @type {TimelineItemModel[]} Array of timeline events */ items: TimelineItemModel[];
25
+ }
26
+ import { Model } from '@nan0web/types';
27
+ import { TimelineItemModel } from './TimelineItemModel.js';
@@ -1,62 +1,33 @@
1
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.
2
+ * Model-as-Schema for Toast notification.
12
3
  */
13
4
  export class ToastModel extends Model {
14
- static message: {
15
- help: string;
16
- default: string;
17
- type: string;
18
- };
19
5
  static variant: {
20
6
  help: string;
21
7
  default: string;
22
8
  options: string[];
23
9
  };
24
- static duration: {
10
+ static message: {
25
11
  help: string;
26
- default: number;
12
+ default: string;
27
13
  type: string;
28
14
  };
29
- static open: {
15
+ static duration: {
30
16
  help: string;
31
- default: boolean;
17
+ default: number;
32
18
  type: string;
33
19
  };
34
20
  /**
35
- * @param {ToastData | any} [data]
21
+ * @param {Partial<ToastModel> | Record<string, any>} data Model input data.
22
+ * @param {object} [options] Extended options (db, etc.)
36
23
  */
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>;
24
+ constructor(data?: Partial<ToastModel> | Record<string, any>, options?: object);
25
+ /** @type {'info'|'success'|'warn'|'error'} Notification color scheme */ variant: "info" | "success" | "warn" | "error";
26
+ /** @type {string} Text displayed in the toast */ message: string;
27
+ /** @type {number} Auto-dismiss timeout in ms */ duration: number;
28
+ /**
29
+ * @returns {AsyncGenerator<any, any, any>}
30
+ */
31
+ run(): AsyncGenerator<any, any, any>;
54
32
  }
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';
33
+ import { Model } from '@nan0web/types';
@@ -1,13 +1,3 @@
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
1
  /**
12
2
  * Model-as-Schema for Tree component.
13
3
  * Represents a hierarchical selection or navigation structure.
@@ -19,31 +9,18 @@ export class TreeModel extends Model {
19
9
  default: never[];
20
10
  };
21
11
  /**
22
- * @param {TreeData | any} [data]
12
+ * @param {Partial<TreeModel> | Record<string, any>} data Model input data.
13
+ * @param {object} [options] Extended options (db, etc.)
23
14
  */
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>;
15
+ constructor(data?: Partial<TreeModel> | Record<string, any>, options?: object);
16
+ /** @type {Array<{label: string, expanded?: boolean, children?: any[]}>} Tree nodes */ data: Array<{
17
+ label: string;
18
+ expanded?: boolean;
19
+ children?: any[];
20
+ }>;
21
+ /**
22
+ * @returns {AsyncGenerator<any, any, any>}
23
+ */
24
+ run(): AsyncGenerator<any, any, any>;
40
25
  }
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';
26
+ import { Model } from '@nan0web/types';
@@ -8,3 +8,23 @@ export { ToastModel } from "./ToastModel.js";
8
8
  export { SelectModel } from "./SelectModel.js";
9
9
  export { AutocompleteModel } from "./AutocompleteModel.js";
10
10
  export { TreeModel } from "./TreeModel.js";
11
+ export { TabsModel } from "./TabsModel.js";
12
+ export { AccordionModel } from "./AccordionModel.js";
13
+ export { FAQModel } from "./FAQModel.js";
14
+ export { GalleryModel } from "./GalleryModel.js";
15
+ export { PriceModel } from "./PriceModel.js";
16
+ export { PricingModel } from "./PricingModel.js";
17
+ export { PricingSectionModel } from "./PricingSectionModel.js";
18
+ export { CommentModel } from "./CommentModel.js";
19
+ export { TestimonialModel } from "./TestimonialModel.js";
20
+ export { StatsItemModel } from "./StatsItemModel.js";
21
+ export { StatsModel } from "./StatsModel.js";
22
+ export { TimelineItemModel } from "./TimelineItemModel.js";
23
+ export { TimelineModel } from "./TimelineModel.js";
24
+ export { HeaderVisibilityModel } from "./HeaderVisibilityModel.js";
25
+ export { HeaderConfigModel } from "./HeaderConfigModel.js";
26
+ export { FooterVisibilityModel } from "./FooterVisibilityModel.js";
27
+ export { FooterConfigModel } from "./FooterConfigModel.js";
28
+ export { EmptyStateModel } from "./EmptyStateModel.js";
29
+ export { BannerModel } from "./BannerModel.js";
30
+ export { ProfileDropdownModel } from "./ProfileDropdownModel.js";
@@ -1,4 +1,7 @@
1
1
  export { SandboxModel } from "./SandboxModel.js";
2
2
  export { ShowcaseAppModel } from "./ShowcaseAppModel.js";
3
3
  export { default as Navigation } from "./Navigation.js";
4
- export { ButtonModel, ConfirmModel, InputModel, SpinnerModel, TableModel, ToastModel, SelectModel, AutocompleteModel, TreeModel } from "./components/index.js";
4
+ export { default as HeaderModel } from "./HeaderModel.js";
5
+ export { default as FooterModel } from "./FooterModel.js";
6
+ export { default as HeroModel } from "./HeroModel.js";
7
+ export { ButtonModel, ConfirmModel, InputModel, SpinnerModel, TableModel, ToastModel, SelectModel, AutocompleteModel, TreeModel, TabsModel, AccordionModel, GalleryModel, PriceModel, PricingModel, CommentModel, TestimonialModel, StatsItemModel, StatsModel, TimelineItemModel, TimelineModel, HeaderVisibilityModel, HeaderConfigModel, FooterVisibilityModel, FooterConfigModel, EmptyStateModel, BannerModel, ProfileDropdownModel } from "./components/index.js";
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { format } from "./format.js";
2
+ export { default as Navigation } from "./domain/Navigation.js";
2
3
  export { default as FormMessage } from "./core/Form/Message.js";
3
4
  export { default as FormInput } from "./core/Form/Input.js";
4
5
  export { default as InputAdapter } from "./core/InputAdapter.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ /**
2
+ * LogicInspector
3
+ *
4
+ * Базовий клас для захоплення "Логічних зліпків" (Intent Stream) будь-яких моделей OLMUI.
5
+ * Дозволяє виконувати чисто-логічне тестування без прив'язки до рендерингу.
6
+ */
7
+ export class LogicInspector {
8
+ /**
9
+ * Виконує генератор моделі та записує послідовність усіх інтенцій.
10
+ * @param {AsyncGenerator<import('../core/Intent.js').Intent, import('../core/Intent.js').ResultIntent, import('../core/Intent.js').IntentResponse>} modelStream - результат виклику model.run()
11
+ * @param {object} options
12
+ * @param {Array<any> | ((locale: string) => Array<any>)} [options.inputs] - черга вхідних значень для askIntent
13
+ * @param {string} [options.locale] - локаль для тестів
14
+ * @param {function} [options.t] - функція перекладу
15
+ * @returns {Promise<Array<any>>} Intent Stream Log
16
+ */
17
+ static capture(modelStream: AsyncGenerator<import("../core/Intent.js").Intent, import("../core/Intent.js").ResultIntent, import("../core/Intent.js").IntentResponse>, { inputs, locale, t }?: {
18
+ inputs?: any[] | ((locale: string) => Array<any>) | undefined;
19
+ locale?: string | undefined;
20
+ t?: Function | undefined;
21
+ }): Promise<Array<any>>;
22
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * SnapshotInspector
3
+ *
4
+ * Рев'ювер для автоматичної перевірки Snapshot-зліпків на наявність артефактів,
5
+ * неперекладених ключів та структурних помилок.
6
+ * Реалізує правила "Zero-Hallucination Snapshot Validation".
7
+ */
8
+ export class SnapshotInspector {
9
+ /**
10
+ * Перевіряє вміст одного снепшоту.
11
+ * @param {string} content - Текстовий вміст .txt файлу галереї
12
+ * @param {string} locale - Локаль (uk, en)
13
+ * @param {string} [filename] - Ім'я файлу для перевірки на "глюки" (підкреслення)
14
+ * @returns {object} { score, errors }
15
+ */
16
+ static inspect(content: string, locale?: string, filename?: string): object;
17
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * VisualAdapter (Base)
3
+ *
4
+ * Базовий клас для візуальної трансформації інтенцій OLMUI.
5
+ * Використовувана у @nan0web/ui як фундамент для спеціалізованих рендерерів.
6
+ */
7
+ export class VisualAdapter {
8
+ /**
9
+ * Конвертує одну інтенцію у просте текстове представлення.
10
+ * @param {object} intent - Intent entry from LogicInspector
11
+ * @param {function} [t] - i18n translate function
12
+ * @returns {string} Raw description
13
+ */
14
+ static render(intent: object, t?: Function): string;
15
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./LogicInspector.js";
2
+ export * from "./VisualAdapter.js";
3
+ export * from "./SnapshotInspector.js";