@nan0web/ui 1.11.0 → 1.12.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.11.0",
3
+ "version": "1.12.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",
@@ -24,6 +24,10 @@
24
24
  "import": "./src/core/index.js",
25
25
  "types": "./types/core/index.d.ts"
26
26
  },
27
+ "./src/core/Intent.js": {
28
+ "import": "./src/core/Intent.js",
29
+ "types": "./types/core/Intent.d.ts"
30
+ },
27
31
  "./domain": {
28
32
  "import": "./src/domain/index.js",
29
33
  "types": "./types/domain/index.d.ts"
@@ -72,21 +76,21 @@
72
76
  "vitest": "^3.2.4",
73
77
  "@nan0web/db-fs": "1.2.1",
74
78
  "@nan0web/event": "1.0.1",
79
+ "@nan0web/icons": "1.1.0",
75
80
  "@nan0web/i18n": "1.5.0",
81
+ "@nan0web/ui-cli": "2.13.0",
76
82
  "@nan0web/inspect": "1.0.0",
77
- "@nan0web/ui-cli": "2.12.3",
78
83
  "@nan0web/test": "1.1.4",
79
- "@nan0web/icons": "1.1.0",
80
- "@nan0web/release": "1.0.3",
81
84
  "@nan0web/nan0web.app": "0.1.0",
85
+ "@nan0web/release": "1.0.3",
82
86
  "@nan0web/ui-lit": "1.1.0"
83
87
  },
84
88
  "dependencies": {
85
89
  "string-width": "^7.2.0",
86
90
  "@nan0web/co": "2.0.1",
91
+ "@nan0web/core": "1.1.3",
87
92
  "@nan0web/log": "1.1.1",
88
- "@nan0web/types": "1.7.2",
89
- "@nan0web/core": "1.1.3"
93
+ "@nan0web/types": "1.7.2"
90
94
  },
91
95
  "scripts": {
92
96
  "prebuild": "rm -rf types/",
@@ -2,6 +2,18 @@ import Event from '@nan0web/event/oop'
2
2
  import CancelError from './Error/CancelError.js'
3
3
  import UiMessage from './Message/Message.js'
4
4
 
5
+ /**
6
+ * @typedef {Object} AskOptions
7
+ * @property {boolean} [silent] - Suppress logs or output.
8
+ * @property {string} [title] - Custom title for the prompt.
9
+ * @property {string} [hint] - Presentation hint (e.g., 'password', 'tree', 'markdown').
10
+ * @property {any} [default] - Default value if no input is provided.
11
+ * @property {Array<string|Object>} [options] - Array of options for select inputs.
12
+ * @property {Record<string, any>} [UI] - Localization dictionary/overrides.
13
+ * @property {string} [component] - Target specific component override.
14
+ */
15
+ /** @typedef {import('./index.js').AskResponse} AskResponse */
16
+
5
17
  /**
6
18
  * Abstract input adapter for UI implementations.
7
19
  *
@@ -41,19 +53,22 @@ export class InputAdapter extends Event {
41
53
  return true
42
54
  }
43
55
 
56
+
57
+
44
58
  /**
45
59
  * Helper to ask a question.
46
- * @param {string} question - Question to ask.
47
- * @returns {Promise<string>}
60
+ * @param {string|import('./Message/Message.js').default|any} question - Question to ask, Form instance, or AskIntent.
61
+ * @param {AskOptions} [options] - Additional options.
62
+ * @returns {Promise<AskResponse>}
48
63
  */
49
- async ask(question) {
64
+ async ask(question, options) {
50
65
  throw new Error('ask() method must be implemented in subclass')
51
66
  }
52
67
 
53
68
  /**
54
69
  * Generic selection prompt.
55
70
  * @param {Object} config - Selection configuration.
56
- * @returns {Promise<{ index: number, value: string | null }>}
71
+ * @returns {Promise<{ index?: number, value: string | null }>}
57
72
  */
58
73
  async select(config) {
59
74
  throw new Error('select() method must be implemented in subclass')
@@ -41,6 +41,7 @@ import { IntentErrorModel } from './IntentErrorModel.js'
41
41
  * @property {number} [total] - Absolute total (if value is absolute).
42
42
  * @property {string} [id] - Progress ID for tracking by Adapter to calculate speed/eta.
43
43
  * @property {string} message - Status message from Model (i18n static field value).
44
+ * @property {ProgressOptions} [options] - Additional options for progress intent.
44
45
  */
45
46
 
46
47
  /**
@@ -118,7 +119,11 @@ import { IntentErrorModel } from './IntentErrorModel.js'
118
119
  * The value MUST conform to the type described in the requested FieldSchema.
119
120
  * @typedef {Object} AskResponse
120
121
  * @property {*} value - The value matching schema.type (collected from user / LLM / test fixture).
121
- * @property {boolean} [cancelled] - Whether the user cancelled this interaction (e.g. pressed ESC).
122
+ * @property {boolean} cancelled - Whether the user cancelled this interaction (e.g. pressed ESC).
123
+ * @property {string} [action] - The action identifier (e.g., 'submit', 'exit', 'back').
124
+ * @property {any} [body] - Additional payload or form data.
125
+ * @property {any} [form] - The form model instance (if applicable).
126
+ * @property {number} [index] - The selected index for lists/tables.
122
127
  */
123
128
 
124
129
  /**
@@ -244,26 +249,50 @@ export function ask(field, schema) {
244
249
  return { type: 'ask', field, schema }
245
250
  }
246
251
 
252
+ /**
253
+ * @typedef {Object} ProgressOptions
254
+ * @property {number} [total] - Absolute total steps.
255
+ * @property {string} [id] - Progress tracking ID.
256
+ * @property {number} [width] - Width of the progress bar in terminal characters.
257
+ * @property {number} [fps] - Frames per second update rate limit.
258
+ * @property {string} [format] - Custom format string (e.g. '{time} {bar} {percent} {title}').
259
+ * @property {number} [columns] - Number of columns (terminal width).
260
+ * @property {boolean} [forceOneLine] - Prevent wrapping and truncate instead.
261
+ * @property {boolean|'success'|'error'} [stop] - Set to true to stop, or 'success'/'error' to stop with a status icon (for spinners).
262
+ */
263
+
247
264
  /**
248
265
  * Create a progress intent.
249
266
  * @param {string} message - Status message from Model (i18n static field value).
250
267
  * @param {number} [value=0] - Progress value (current step or percentage).
251
- * @param {number|string} [totalOrId] - Absolute total steps (number) OR progress tracking ID (string).
268
+ * @param {ProgressOptions|number|string} [optionsOrTotalOrId] - Options object, or absolute total steps (number), or progress tracking ID (string).
252
269
  * @param {string} [id='default'] - Progress ID (if total is provided).
253
270
  * @returns {ProgressIntent}
254
271
  */
255
- export function progress(message, value = 0, totalOrId, id) {
256
- let total = undefined
257
- let progressId = 'default'
258
-
259
- if (typeof totalOrId === 'number') {
260
- total = totalOrId
261
- if (typeof id === 'string') progressId = id
262
- } else if (typeof totalOrId === 'string') {
263
- progressId = totalOrId
272
+ export function progress(message, value = 0, optionsOrTotalOrId, id) {
273
+ /** @type {ProgressOptions} */
274
+ let options = {}
275
+
276
+ if (typeof optionsOrTotalOrId === 'object' && optionsOrTotalOrId !== null) {
277
+ options = optionsOrTotalOrId
278
+ } else {
279
+ // legacy support
280
+ if (typeof optionsOrTotalOrId === 'number') {
281
+ options.total = optionsOrTotalOrId
282
+ if (typeof id === 'string') options.id = id
283
+ } else if (typeof optionsOrTotalOrId === 'string') {
284
+ options.id = optionsOrTotalOrId
285
+ }
264
286
  }
265
287
 
266
- return { type: 'progress', message, value, total, id: progressId }
288
+ return {
289
+ type: 'progress',
290
+ message,
291
+ value,
292
+ total: options.total,
293
+ id: options.id || 'default',
294
+ options
295
+ }
267
296
  }
268
297
 
269
298
  export function log(level, message, data = {}) {
package/src/core/index.js CHANGED
@@ -42,6 +42,9 @@ export { default as Flow } from './Flow.js'
42
42
 
43
43
  // OLMUI Generator Engine — Intent-based Model→Adapter contract
44
44
  export { validateIntent, ask, progress, log, render, result, INTENT_TYPES, isModelSchema } from './Intent.js'
45
+ /** @typedef {import('./Intent.js').Intent} Intent */
46
+ /** @typedef {import('./Intent.js').AskResponse} AskResponse */
47
+ /** @typedef {import('./InputAdapter.js').AskOptions} AskOptions */
45
48
  export { IntentErrorModel } from './IntentErrorModel.js'
46
49
  export { runGenerator } from './GeneratorRunner.js'
47
50
 
@@ -37,7 +37,7 @@ import { Model } from '@nan0web/types'
37
37
  * @property {string|ContentData[]} [fieldset]
38
38
  * @property {string|ContentData[]} [figcaption]
39
39
  * @property {string|ContentData[]} [figure]
40
- * @property {string|ContentData[]} [footer]
40
+ * @property {any} [footer]
41
41
  * @property {string|ContentData[]} [form]
42
42
  * @property {string|ContentData[]} [h1]
43
43
  * @property {string|ContentData[]} [h2]
@@ -46,7 +46,7 @@ import { Model } from '@nan0web/types'
46
46
  * @property {string|ContentData[]} [h5]
47
47
  * @property {string|ContentData[]} [h6]
48
48
  * @property {string|ContentData[]} [head]
49
- * @property {string|ContentData[]} [header]
49
+ * @property {any} [header]
50
50
  * @property {string|ContentData[]} [hgroup]
51
51
  * @property {boolean|object} [hr]
52
52
  * @property {string|ContentData[]} [html]
@@ -139,6 +139,8 @@ import { Model } from '@nan0web/types'
139
139
  * @property {import('./components/FAQModel.js').FAQModel} [faq]
140
140
  * @property {import('./components/FeatureGridModel.js').FeatureGridModel} [featureGrid]
141
141
  * @property {import('./components/GalleryModel.js').GalleryModel} [gallery]
142
+ * @property {import('./HeaderModel.js').HeaderModel} [header]
143
+ * @property {import('./FooterModel.js').FooterModel} [footer]
142
144
  * @property {import('./components/InputModel.js').InputModel} [input]
143
145
  * @property {import('./components/MarkdownModel.js').MarkdownModel} [markdown]
144
146
  * @property {import('./components/PriceModel.js').PriceModel} [price]
@@ -1,9 +1,14 @@
1
1
  import { Model } from '@nan0web/types'
2
2
  import { Content } from './Content.js'
3
+ import Navigation from './Navigation.js'
4
+ import { Language } from '@nan0web/i18n'
3
5
 
4
6
  export class Document extends Model {
5
7
  static title = { type: 'string', help: 'Title' }
6
8
  static content = { type: 'array', model: Content, help: 'Content' }
9
+ static $content = { type: 'array', model: Content, help: 'Layout configuration' }
10
+ static nav = { type: 'any', model: Navigation, help: 'Navigation config or reference' }
11
+ static langs = { type: 'array', model: Language, help: 'Supported languages array' }
7
12
  /**
8
13
  *
9
14
  * @param {Partial<Document>} [data]
@@ -13,5 +18,8 @@ export class Document extends Model {
13
18
  super(data, options)
14
19
  /** @type {string} Title */ this.title
15
20
  /** @type {Array<Content>} Content */ this.content
21
+ /** @type {Array<Content>} Layout configuration */ this.$content
22
+ /** @type {Navigation|string|Array<Navigation>} Navigation config */ this.nav
23
+ /** @type {Array<Language>} Supported languages */ this.langs
16
24
  }
17
25
  }
@@ -64,16 +64,14 @@ export class SnapshotAuditor extends AuditorModel {
64
64
  /** @type {number} Minimum filename length */
65
65
  static MIN_FILENAME_LENGTH = 3
66
66
 
67
- /** @type {import('../../index.js').ModelAsAppOptions} */
68
- _
69
-
70
67
  /**
71
68
  * @param {Partial<SnapshotAuditor> | Record<string, any>} [data={}]
72
69
  * @param {Partial<import('@nan0web/types').ModelOptions>} [options={}]
73
70
  */
74
71
  constructor(data = {}, options = {}) {
75
72
  super(data, options)
76
- this._ = options
73
+ /** @type {import('@nan0web/types').ModelOptions} */
74
+ this.options = options
77
75
  /** @type {string} Target directory to audit */ this.dir
78
76
  /** @type {string} Directory to scan for dictionaries */ this.data
79
77
  }
@@ -160,7 +158,7 @@ export class SnapshotAuditor extends AuditorModel {
160
158
  * @returns {AsyncGenerator<import('@nan0web/ui').Intent, any, any>}
161
159
  */
162
160
  async *run() {
163
- const { t } = this._
161
+ const { t } = this.options
164
162
  const snapshotsDir = this.dir || '.'
165
163
 
166
164
  yield show(t(SnapshotAuditor.UI.starting, { dir: snapshotsDir }))
@@ -168,7 +166,7 @@ export class SnapshotAuditor extends AuditorModel {
168
166
  const files = []
169
167
 
170
168
  /** @type {import('@nan0web/db').DB} */
171
- let fsDb = this._.db
169
+ let fsDb = this.options.db
172
170
  if (fsDb && fsDb.mounts && fsDb.mounts.has('')) {
173
171
  fsDb = /** @type {import('@nan0web/db').DB} */ (fsDb.mounts.get(''))
174
172
  }
package/src/index.js CHANGED
@@ -33,6 +33,7 @@ export { default as UiAdapter } from './core/UiAdapter.js'
33
33
  /** @typedef {import('./core/Intent.js').IntentResponse} IntentResponse */
34
34
  /** @typedef {import('./core/Intent.js').AskIntent} AskIntent */
35
35
  /** @typedef {import('./core/Intent.js').ProgressIntent} ProgressIntent */
36
+ /** @typedef {import('./core/Intent.js').ProgressOptions} ProgressOptions */
36
37
  /** @typedef {import('./core/Intent.js').LogIntent} LogIntent */
37
38
  /** @typedef {import('./core/Intent.js').ShowIntent} ShowIntent */
38
39
  /** @typedef {import('./core/Intent.js').RenderIntent} RenderIntent */
@@ -41,6 +42,7 @@ export { default as UiAdapter } from './core/UiAdapter.js'
41
42
  /** @typedef {import('./core/Intent.js').AskResponse} AskResponse */
42
43
  /** @typedef {import('./core/Intent.js').AbortResponse} AbortResponse */
43
44
  /** @typedef {import('./core/Intent.js').ShowData} ShowData */
45
+ /** @typedef {import('./core/InputAdapter.js').AskOptions} AskOptions */
44
46
  export * from './core/Intent.js'
45
47
 
46
48
  export { IntentErrorModel } from './core/IntentErrorModel.js'
@@ -34,7 +34,7 @@ export default class ScenarioAdapter extends InputAdapter {
34
34
  return { value: match.value, cancelled: !!match.cancelled }
35
35
  }
36
36
  // If no specific match, try to use the first available answer or default
37
- return { value: null }
37
+ return { value: null, cancelled: false }
38
38
  }
39
39
 
40
40
  /** @param {import('../core/Intent.js').ProgressIntent} intent */
@@ -27,7 +27,7 @@ export class LogicInspector {
27
27
  const value = resolvedInputs[inputIdx++]
28
28
  const entry = { type: 'ask', field: i.field, schema: i.schema, input: value }
29
29
  intents.push(entry)
30
- return { value }
30
+ return { value, cancelled: false }
31
31
  },
32
32
  /** @param {import('../core/Intent.js').ShowIntent} i */
33
33
  show: async (i) => {
@@ -43,8 +43,7 @@ export class SpecAdapter {
43
43
  async ask(intent) {
44
44
  const step = this.#popExpected('ask')
45
45
  this.assert.equal(step.ask, intent.field, `Field mismatch on ask. Expected '${step.ask}', got '${intent.field}'`)
46
-
47
- return { value: step.$value }
46
+ return { value: step.$value, cancelled: false }
48
47
  }
49
48
 
50
49
  /**
@@ -1,3 +1,14 @@
1
+ /**
2
+ * @typedef {Object} AskOptions
3
+ * @property {boolean} [silent] - Suppress logs or output.
4
+ * @property {string} [title] - Custom title for the prompt.
5
+ * @property {string} [hint] - Presentation hint (e.g., 'password', 'tree', 'markdown').
6
+ * @property {any} [default] - Default value if no input is provided.
7
+ * @property {Array<string|Object>} [options] - Array of options for select inputs.
8
+ * @property {Record<string, any>} [UI] - Localization dictionary/overrides.
9
+ * @property {string} [component] - Target specific component override.
10
+ */
11
+ /** @typedef {import('./index.js').AskResponse} AskResponse */
1
12
  /**
2
13
  * Abstract input adapter for UI implementations.
3
14
  *
@@ -28,20 +39,52 @@ export class InputAdapter extends Event {
28
39
  isReady(): boolean;
29
40
  /**
30
41
  * Helper to ask a question.
31
- * @param {string} question - Question to ask.
32
- * @returns {Promise<string>}
42
+ * @param {string|import('./Message/Message.js').default|any} question - Question to ask, Form instance, or AskIntent.
43
+ * @param {AskOptions} [options] - Additional options.
44
+ * @returns {Promise<AskResponse>}
33
45
  */
34
- ask(question: string): Promise<string>;
46
+ ask(question: string | import("./Message/Message.js").default | any, options?: AskOptions): Promise<AskResponse>;
35
47
  /**
36
48
  * Generic selection prompt.
37
49
  * @param {Object} config - Selection configuration.
38
- * @returns {Promise<{ index: number, value: string | null }>}
50
+ * @returns {Promise<{ index?: number, value: string | null }>}
39
51
  */
40
52
  select(config: any): Promise<{
41
- index: number;
53
+ index?: number;
42
54
  value: string | null;
43
55
  }>;
44
56
  }
45
57
  export default InputAdapter;
58
+ export type AskOptions = {
59
+ /**
60
+ * - Suppress logs or output.
61
+ */
62
+ silent?: boolean | undefined;
63
+ /**
64
+ * - Custom title for the prompt.
65
+ */
66
+ title?: string | undefined;
67
+ /**
68
+ * - Presentation hint (e.g., 'password', 'tree', 'markdown').
69
+ */
70
+ hint?: string | undefined;
71
+ /**
72
+ * - Default value if no input is provided.
73
+ */
74
+ default?: any;
75
+ /**
76
+ * - Array of options for select inputs.
77
+ */
78
+ options?: any[] | undefined;
79
+ /**
80
+ * - Localization dictionary/overrides.
81
+ */
82
+ UI?: Record<string, any> | undefined;
83
+ /**
84
+ * - Target specific component override.
85
+ */
86
+ component?: string | undefined;
87
+ };
88
+ export type AskResponse = import("./index.js").AskResponse;
46
89
  import Event from '@nan0web/event/oop';
47
90
  import CancelError from './Error/CancelError.js';
@@ -24,15 +24,26 @@ export function validateIntent(intent: any): intent is Intent;
24
24
  * @returns {AskIntent}
25
25
  */
26
26
  export function ask(field: string, schema: object | Function): AskIntent;
27
+ /**
28
+ * @typedef {Object} ProgressOptions
29
+ * @property {number} [total] - Absolute total steps.
30
+ * @property {string} [id] - Progress tracking ID.
31
+ * @property {number} [width] - Width of the progress bar in terminal characters.
32
+ * @property {number} [fps] - Frames per second update rate limit.
33
+ * @property {string} [format] - Custom format string (e.g. '{time} {bar} {percent} {title}').
34
+ * @property {number} [columns] - Number of columns (terminal width).
35
+ * @property {boolean} [forceOneLine] - Prevent wrapping and truncate instead.
36
+ * @property {boolean|'success'|'error'} [stop] - Set to true to stop, or 'success'/'error' to stop with a status icon (for spinners).
37
+ */
27
38
  /**
28
39
  * Create a progress intent.
29
40
  * @param {string} message - Status message from Model (i18n static field value).
30
41
  * @param {number} [value=0] - Progress value (current step or percentage).
31
- * @param {number|string} [totalOrId] - Absolute total steps (number) OR progress tracking ID (string).
42
+ * @param {ProgressOptions|number|string} [optionsOrTotalOrId] - Options object, or absolute total steps (number), or progress tracking ID (string).
32
43
  * @param {string} [id='default'] - Progress ID (if total is provided).
33
44
  * @returns {ProgressIntent}
34
45
  */
35
- export function progress(message: string, value?: number, totalOrId?: number | string, id?: string): ProgressIntent;
46
+ export function progress(message: string, value?: number, optionsOrTotalOrId?: ProgressOptions | number | string, id?: string): ProgressIntent;
36
47
  export function log(level: any, message: any, data?: {}): {
37
48
  type: string;
38
49
  level: any;
@@ -98,6 +109,7 @@ export function agent(task: string, context?: AgentContext): AgentIntent;
98
109
  * @property {number} [total] - Absolute total (if value is absolute).
99
110
  * @property {string} [id] - Progress ID for tracking by Adapter to calculate speed/eta.
100
111
  * @property {string} message - Status message from Model (i18n static field value).
112
+ * @property {ProgressOptions} [options] - Additional options for progress intent.
101
113
  */
102
114
  /**
103
115
  * @typedef {'info' | 'warn' | 'error' | 'success'} ShowLevel
@@ -163,7 +175,11 @@ export function agent(task: string, context?: AgentContext): AgentIntent;
163
175
  * The value MUST conform to the type described in the requested FieldSchema.
164
176
  * @typedef {Object} AskResponse
165
177
  * @property {*} value - The value matching schema.type (collected from user / LLM / test fixture).
166
- * @property {boolean} [cancelled] - Whether the user cancelled this interaction (e.g. pressed ESC).
178
+ * @property {boolean} cancelled - Whether the user cancelled this interaction (e.g. pressed ESC).
179
+ * @property {string} [action] - The action identifier (e.g., 'submit', 'exit', 'back').
180
+ * @property {any} [body] - Additional payload or form data.
181
+ * @property {any} [form] - The form model instance (if applicable).
182
+ * @property {number} [index] - The selected index for lists/tables.
167
183
  */
168
184
  /**
169
185
  * Response to an AgentIntent.
@@ -201,6 +217,40 @@ export function agent(task: string, context?: AgentContext): AgentIntent;
201
217
  * @typedef {'ask' | 'show' | 'progress' | 'render' | 'agent'} IntentType
202
218
  */
203
219
  export const INTENT_TYPES: readonly ["ask", "progress", "show", "log", "render", "agent"];
220
+ export type ProgressOptions = {
221
+ /**
222
+ * - Absolute total steps.
223
+ */
224
+ total?: number | undefined;
225
+ /**
226
+ * - Progress tracking ID.
227
+ */
228
+ id?: string | undefined;
229
+ /**
230
+ * - Width of the progress bar in terminal characters.
231
+ */
232
+ width?: number | undefined;
233
+ /**
234
+ * - Frames per second update rate limit.
235
+ */
236
+ fps?: number | undefined;
237
+ /**
238
+ * - Custom format string (e.g. '{time} {bar} {percent} {title}').
239
+ */
240
+ format?: string | undefined;
241
+ /**
242
+ * - Number of columns (terminal width).
243
+ */
244
+ columns?: number | undefined;
245
+ /**
246
+ * - Prevent wrapping and truncate instead.
247
+ */
248
+ forceOneLine?: boolean | undefined;
249
+ /**
250
+ * - Set to true to stop, or 'success'/'error' to stop with a status icon (for spinners).
251
+ */
252
+ stop?: boolean | "error" | "success" | undefined;
253
+ };
204
254
  export type ShowData = {
205
255
  component?: any;
206
256
  model?: import("@nan0web/types").Model | undefined;
@@ -275,6 +325,10 @@ export type ProgressIntent = {
275
325
  * - Status message from Model (i18n static field value).
276
326
  */
277
327
  message: string;
328
+ /**
329
+ * - Additional options for progress intent.
330
+ */
331
+ options?: ProgressOptions | undefined;
278
332
  };
279
333
  export type ShowLevel = "info" | "warn" | "error" | "success";
280
334
  export type LogLevel = ShowLevel;
@@ -384,7 +438,23 @@ export type AskResponse = {
384
438
  /**
385
439
  * - Whether the user cancelled this interaction (e.g. pressed ESC).
386
440
  */
387
- cancelled?: boolean | undefined;
441
+ cancelled: boolean;
442
+ /**
443
+ * - The action identifier (e.g., 'submit', 'exit', 'back').
444
+ */
445
+ action?: string | undefined;
446
+ /**
447
+ * - Additional payload or form data.
448
+ */
449
+ body?: any;
450
+ /**
451
+ * - The form model instance (if applicable).
452
+ */
453
+ form?: any;
454
+ /**
455
+ * - The selected index for lists/tables.
456
+ */
457
+ index?: number | undefined;
388
458
  };
389
459
  /**
390
460
  * Response to an AgentIntent.
@@ -8,6 +8,9 @@ export { IntentErrorModel } from "./IntentErrorModel.js";
8
8
  export { runGenerator } from "./GeneratorRunner.js";
9
9
  export { MaskHandler } from "./MaskHandler.js";
10
10
  export { LayoutModel } from "../domain/LayoutModel.js";
11
+ export type Intent = import("./Intent.js").Intent;
12
+ export type AskResponse = import("./Intent.js").AskResponse;
13
+ export type AskOptions = import("./InputAdapter.js").AskOptions;
11
14
  import UIStream from './Stream.js';
12
15
  import StreamEntry from './StreamEntry.js';
13
16
  import UIForm from './Form/Form.js';
@@ -35,7 +35,7 @@
35
35
  * @property {string|ContentData[]} [fieldset]
36
36
  * @property {string|ContentData[]} [figcaption]
37
37
  * @property {string|ContentData[]} [figure]
38
- * @property {string|ContentData[]} [footer]
38
+ * @property {any} [footer]
39
39
  * @property {string|ContentData[]} [form]
40
40
  * @property {string|ContentData[]} [h1]
41
41
  * @property {string|ContentData[]} [h2]
@@ -44,7 +44,7 @@
44
44
  * @property {string|ContentData[]} [h5]
45
45
  * @property {string|ContentData[]} [h6]
46
46
  * @property {string|ContentData[]} [head]
47
- * @property {string|ContentData[]} [header]
47
+ * @property {any} [header]
48
48
  * @property {string|ContentData[]} [hgroup]
49
49
  * @property {boolean|object} [hr]
50
50
  * @property {string|ContentData[]} [html]
@@ -136,6 +136,8 @@
136
136
  * @property {import('./components/FAQModel.js').FAQModel} [faq]
137
137
  * @property {import('./components/FeatureGridModel.js').FeatureGridModel} [featureGrid]
138
138
  * @property {import('./components/GalleryModel.js').GalleryModel} [gallery]
139
+ * @property {import('./HeaderModel.js').HeaderModel} [header]
140
+ * @property {import('./FooterModel.js').FooterModel} [footer]
139
141
  * @property {import('./components/InputModel.js').InputModel} [input]
140
142
  * @property {import('./components/MarkdownModel.js').MarkdownModel} [markdown]
141
143
  * @property {import('./components/PriceModel.js').PriceModel} [price]
@@ -213,7 +215,7 @@ export type HTML5Elements = {
213
215
  fieldset?: string | ContentData[] | undefined;
214
216
  figcaption?: string | ContentData[] | undefined;
215
217
  figure?: string | ContentData[] | undefined;
216
- footer?: string | ContentData[] | undefined;
218
+ footer?: any;
217
219
  form?: string | ContentData[] | undefined;
218
220
  h1?: string | ContentData[] | undefined;
219
221
  h2?: string | ContentData[] | undefined;
@@ -222,7 +224,7 @@ export type HTML5Elements = {
222
224
  h5?: string | ContentData[] | undefined;
223
225
  h6?: string | ContentData[] | undefined;
224
226
  head?: string | ContentData[] | undefined;
225
- header?: string | ContentData[] | undefined;
227
+ header?: any;
226
228
  hgroup?: string | ContentData[] | undefined;
227
229
  hr?: boolean | object;
228
230
  html?: string | ContentData[] | undefined;
@@ -313,6 +315,8 @@ export type CoreUIElements = {
313
315
  faq?: import("./components/FAQModel.js").FAQModel | undefined;
314
316
  featureGrid?: import("./components/FeatureGridModel.js").FeatureGridModel | undefined;
315
317
  gallery?: import("./components/GalleryModel.js").GalleryModel | undefined;
318
+ header?: import("./HeaderModel.js").HeaderModel | undefined;
319
+ footer?: import("./FooterModel.js").FooterModel | undefined;
316
320
  input?: import("./components/InputModel.js").InputModel | undefined;
317
321
  markdown?: import("./components/MarkdownModel.js").MarkdownModel | undefined;
318
322
  price?: import("./components/PriceModel.js").PriceModel | undefined;
@@ -8,6 +8,21 @@ export class Document extends Model {
8
8
  model: typeof Content;
9
9
  help: string;
10
10
  };
11
+ static $content: {
12
+ type: string;
13
+ model: typeof Content;
14
+ help: string;
15
+ };
16
+ static nav: {
17
+ type: string;
18
+ model: typeof Navigation;
19
+ help: string;
20
+ };
21
+ static langs: {
22
+ type: string;
23
+ model: any;
24
+ help: string;
25
+ };
11
26
  /**
12
27
  *
13
28
  * @param {Partial<Document>} [data]
@@ -16,6 +31,10 @@ export class Document extends Model {
16
31
  constructor(data?: Partial<Document>, options?: import("@nan0web/types").ModelOptions);
17
32
  /** @type {string} Title */ title: string;
18
33
  /** @type {Array<Content>} Content */ content: Array<Content>;
34
+ /** @type {Array<Content>} Layout configuration */ $content: Array<Content>;
35
+ /** @type {Navigation|string|Array<Navigation>} Navigation config */ nav: Navigation | string | Array<Navigation>;
36
+ /** @type {Array<Language>} Supported languages */ langs: Array<Language>;
19
37
  }
20
38
  import { Model } from '@nan0web/types';
21
39
  import { Content } from './Content.js';
40
+ import Navigation from './Navigation.js';
@@ -86,8 +86,8 @@ export class SnapshotAuditor {
86
86
  * @param {Partial<import('@nan0web/types').ModelOptions>} [options={}]
87
87
  */
88
88
  constructor(data?: Partial<SnapshotAuditor> | Record<string, any>, options?: Partial<import("@nan0web/types").ModelOptions>);
89
- /** @type {import('../../index.js').ModelAsAppOptions} */
90
- _: import("../../index.js").ModelAsAppOptions;
89
+ /** @type {import('@nan0web/types').ModelOptions} */
90
+ options: import("@nan0web/types").ModelOptions;
91
91
  /** @type {string} Target directory to audit */ dir: string;
92
92
  /** @type {string} Directory to scan for dictionaries */ data: string;
93
93
  /**
package/types/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export type Intent = import("./core/Intent.js").Intent;
21
21
  export type IntentResponse = import("./core/Intent.js").IntentResponse;
22
22
  export type AskIntent = import("./core/Intent.js").AskIntent;
23
23
  export type ProgressIntent = import("./core/Intent.js").ProgressIntent;
24
+ export type ProgressOptions = import("./core/Intent.js").ProgressOptions;
24
25
  export type LogIntent = import("./core/Intent.js").LogIntent;
25
26
  export type ShowIntent = import("./core/Intent.js").ShowIntent;
26
27
  export type RenderIntent = import("./core/Intent.js").RenderIntent;
@@ -29,6 +30,7 @@ export type IntentType = import("./core/Intent.js").IntentType;
29
30
  export type AskResponse = import("./core/Intent.js").AskResponse;
30
31
  export type AbortResponse = import("./core/Intent.js").AbortResponse;
31
32
  export type ShowData = import("./core/Intent.js").ShowData;
33
+ export type AskOptions = import("./core/InputAdapter.js").AskOptions;
32
34
  export type ModelAsAppOptions = import("./domain/index.js").ModelAsAppOptions;
33
35
  import Frame from './Frame/Frame.js';
34
36
  import FrameProps from './Frame/Props.js';
@@ -17,6 +17,7 @@ export class SpecAdapter {
17
17
  */
18
18
  ask(intent: import("../core/Intent.js").AskIntent): Promise<{
19
19
  value: any;
20
+ cancelled: boolean;
20
21
  }>;
21
22
  /**
22
23
  * @param {import('../core/Intent.js').ShowIntent} intent