@nan0web/ui 1.12.2 → 3.1.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 +18 -355
- package/package.json +36 -22
- package/src/Component/index.js +1 -5
- package/src/Model/Element.js +183 -0
- package/src/Model/index.js +2 -2
- package/src/Theme/AppTheme.js +19 -0
- package/src/Theme/CustomTheme.js +32 -0
- package/src/Theme/DarkLightTheme.js +34 -0
- package/src/Theme/Theme.js +25 -0
- package/src/Theme/atoms/Avatar.js +20 -0
- package/src/Theme/atoms/Badge.js +28 -0
- package/src/Theme/atoms/Button.js +88 -0
- package/src/Theme/atoms/Checkbox.js +26 -0
- package/src/Theme/atoms/Input.js +28 -0
- package/src/Theme/atoms/Radio.js +26 -0
- package/src/Theme/atoms/Select.js +16 -0
- package/src/Theme/atoms/TextArea.js +17 -0
- package/src/Theme/atoms/Typography.js +26 -0
- package/src/Theme/atoms/index.js +11 -0
- package/src/Theme/createTheme.js +22 -0
- package/src/Theme/index.js +20 -0
- package/src/Theme/molecules/Card.js +24 -0
- package/src/Theme/molecules/index.js +3 -0
- package/src/Theme/organisms/Modal.js +24 -0
- package/src/Theme/organisms/index.js +3 -0
- package/src/Theme/presets/HighContrastTheme.js +65 -0
- package/src/Theme/presets/NightTheme.js +66 -0
- package/src/Theme/presets/index.js +4 -0
- package/src/Theme/tokens.js +115 -0
- package/src/core/InputAdapter.js +1 -2
- package/src/core/Intent.js +22 -8
- package/src/core/Message/Message.js +3 -0
- package/src/core/OutputAdapter.js +9 -13
- package/src/core/index.js +7 -4
- package/src/core/resolvePositionalArgs.js +51 -0
- package/src/domain/Content.js +5 -5
- package/src/domain/Document.js +1 -1
- package/src/domain/HeroModel.js +1 -1
- package/src/domain/ModelAsApp.js +310 -20
- package/src/domain/ModelAsApp.story.js +117 -0
- package/src/domain/app/GalleryCommand.js +9 -8
- package/src/domain/app/{GalleryRenderIntent.js → GalleryRenderCommand.js} +20 -20
- package/src/domain/app/IntentAuditor.js +53 -0
- package/src/domain/app/JsIntentAuditor.js +145 -0
- package/src/domain/app/PyIntentAuditor.js +144 -0
- package/src/domain/app/SnapshotAuditor.js +82 -86
- package/src/domain/app/SnapshotRunner.js +1 -1
- package/src/domain/app/UIApp.js +12 -21
- package/src/domain/components/ShellModel.js +2 -2
- package/src/index.js +38 -10
- package/src/inspect.js +4 -0
- package/src/testing/SnapshotRunner.js +2 -1
- package/src/utils/format.js +21 -0
- package/src/utils/processI18n.js +27 -0
- package/src/utils/resolveContext.js +79 -0
- package/types/Component/index.d.ts +1 -5
- package/types/Model/Element.d.ts +87 -0
- package/types/Model/index.d.ts +2 -2
- package/types/Theme/AppTheme.d.ts +14 -0
- package/types/Theme/CustomTheme.d.ts +21 -0
- package/types/Theme/DarkLightTheme.d.ts +16 -0
- package/types/Theme/Theme.d.ts +18 -0
- package/types/Theme/atoms/Avatar.d.ts +14 -0
- package/types/Theme/atoms/Badge.d.ts +22 -0
- package/types/Theme/atoms/Button.d.ts +144 -0
- package/types/Theme/atoms/Checkbox.d.ts +20 -0
- package/types/Theme/atoms/Input.d.ts +22 -0
- package/types/Theme/atoms/Radio.d.ts +20 -0
- package/types/Theme/atoms/Select.d.ts +15 -0
- package/types/Theme/atoms/TextArea.d.ts +17 -0
- package/types/Theme/atoms/Typography.d.ts +47 -0
- package/types/Theme/atoms/index.d.ts +10 -0
- package/types/Theme/createTheme.d.ts +7 -0
- package/types/Theme/index.d.ts +10 -0
- package/types/Theme/molecules/Card.d.ts +18 -0
- package/types/Theme/molecules/index.d.ts +2 -0
- package/types/Theme/organisms/Modal.d.ts +18 -0
- package/types/Theme/organisms/index.d.ts +2 -0
- package/types/Theme/presets/HighContrastTheme.d.ts +2 -0
- package/types/Theme/presets/NightTheme.d.ts +2 -0
- package/types/Theme/presets/index.d.ts +3 -0
- package/types/Theme/tokens.d.ts +119 -0
- package/types/core/Intent.d.ts +10 -7
- package/types/core/Message/Message.d.ts +3 -0
- package/types/core/OutputAdapter.d.ts +2 -4
- package/types/core/index.d.ts +5 -2
- package/types/core/resolvePositionalArgs.d.ts +24 -0
- package/types/docs/README.md.d.ts +1 -0
- package/types/domain/Content.d.ts +2 -2
- package/types/domain/Document.d.ts +4 -3
- package/types/domain/FooterModel.d.ts +2 -1
- package/types/domain/HeroModel.d.ts +2 -2
- package/types/domain/ModelAsApp.d.ts +49 -5
- package/types/domain/ModelAsApp.story.d.ts +1 -0
- package/types/domain/app/GalleryCommand.d.ts +6 -37
- package/types/domain/app/GalleryRenderCommand.d.ts +27 -0
- package/types/domain/app/IntentAuditor.d.ts +23 -0
- package/types/domain/app/JsIntentAuditor.d.ts +22 -0
- package/types/domain/app/PyIntentAuditor.d.ts +22 -0
- package/types/domain/app/SnapshotAuditor.d.ts +34 -25
- package/types/domain/app/SnapshotRunner.d.ts +2 -2
- package/types/domain/app/UIApp.d.ts +14 -11
- package/types/domain/components/ShellModel.d.ts +1 -5
- package/types/index.d.ts +10 -10
- package/types/inspect.d.ts +4 -0
- package/types/testing/verifySnapshot.d.ts +1 -1
- package/types/utils/format.d.ts +5 -0
- package/types/utils/processI18n.d.ts +8 -0
- package/types/utils/resolveContext.d.ts +21 -0
- package/src/App/Command/DepsCommand.js +0 -24
- package/src/App/Core/CoreApp.js +0 -125
- package/src/App/Core/UI.js +0 -63
- package/src/App/Core/Widget.js +0 -61
- package/src/App/Core/index.js +0 -11
- package/src/App/Scenario.js +0 -45
- package/src/App/User/Command/Message.js +0 -3
- package/src/App/User/Command/index.js +0 -5
- package/src/App/User/UserApp.js +0 -85
- package/src/App/User/UserUI.js +0 -20
- package/src/App/User/index.js +0 -9
- package/src/App/index.js +0 -14
- package/src/Component/Process/Input.js +0 -63
- package/src/Component/Process/Process.js +0 -24
- package/src/Component/Process/index.js +0 -5
- package/src/Component/Welcome/Input.js +0 -48
- package/src/Component/Welcome/Welcome.js +0 -22
- package/src/Component/Welcome/index.js +0 -5
- package/src/Frame/Frame.js +0 -608
- package/src/Frame/Props.js +0 -96
- package/src/StdIn.js +0 -100
- package/src/StdOut.js +0 -95
- package/src/View/RenderOptions.js +0 -48
- package/src/View/View.js +0 -306
- package/src/core/Message/index.js +0 -6
- package/types/App/Command/DepsCommand.d.ts +0 -14
- package/types/App/Core/CoreApp.d.ts +0 -70
- package/types/App/Core/UI.d.ts +0 -38
- package/types/App/Core/Widget.d.ts +0 -39
- package/types/App/Core/index.d.ts +0 -10
- package/types/App/Scenario.d.ts +0 -26
- package/types/App/User/Command/Message.d.ts +0 -2
- package/types/App/User/Command/index.d.ts +0 -3
- package/types/App/User/UserApp.d.ts +0 -41
- package/types/App/User/UserUI.d.ts +0 -9
- package/types/App/User/index.d.ts +0 -8
- package/types/App/index.d.ts +0 -12
- package/types/Component/Process/Input.d.ts +0 -48
- package/types/Component/Process/Process.d.ts +0 -13
- package/types/Component/Process/index.d.ts +0 -4
- package/types/Component/Welcome/Input.d.ts +0 -34
- package/types/Component/Welcome/Welcome.d.ts +0 -13
- package/types/Component/Welcome/index.d.ts +0 -4
- package/types/Frame/Frame.d.ts +0 -186
- package/types/Frame/Props.d.ts +0 -77
- package/types/StdIn.d.ts +0 -62
- package/types/StdOut.d.ts +0 -52
- package/types/View/RenderOptions.d.ts +0 -29
- package/types/View/View.d.ts +0 -124
- package/types/core/Message/index.d.ts +0 -4
- package/types/domain/app/GalleryRenderIntent.d.ts +0 -31
package/src/index.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import Frame from './Frame/Frame.js'
|
|
2
1
|
import Locale from './Locale.js'
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import View from './View/View.js'
|
|
6
|
-
import RenderOptions from './View/RenderOptions.js'
|
|
7
|
-
import FrameProps from './Frame/Props.js'
|
|
8
|
-
import Model from './Model/index.js'
|
|
2
|
+
import { Model } from '@nan0web/types'
|
|
3
|
+
import Models from './Model/index.js'
|
|
9
4
|
import Component from './Component/index.js'
|
|
10
|
-
import App from './App/index.js'
|
|
11
5
|
|
|
12
|
-
export {
|
|
6
|
+
export { Locale, Model, Models, Component }
|
|
7
|
+
export { default as Element } from './Model/Element.js'
|
|
8
|
+
export {
|
|
9
|
+
default as Theme,
|
|
10
|
+
getUserTheme,
|
|
11
|
+
CustomTheme,
|
|
12
|
+
DarkLightTheme,
|
|
13
|
+
NightTheme,
|
|
14
|
+
createTheme,
|
|
15
|
+
} from './Theme/index.js'
|
|
16
|
+
export { resolveContext } from './utils/resolveContext.js'
|
|
17
|
+
export { processI18n } from './utils/processI18n.js'
|
|
13
18
|
export { format } from './format.js'
|
|
14
19
|
export { default as Navigation } from './domain/Navigation.js'
|
|
15
20
|
|
|
@@ -21,9 +26,10 @@ export { default as OutputAdapter } from './core/OutputAdapter.js'
|
|
|
21
26
|
export { default as OutputMessage } from './core/Message/OutputMessage.js'
|
|
22
27
|
export { default as UiForm } from './core/Form/Form.js'
|
|
23
28
|
export { default as UiMessage } from './core/Message/Message.js'
|
|
24
|
-
export { default as UiStream } from './core/Stream.js'
|
|
25
29
|
export { default as Error, CancelError } from './core/Error/index.js'
|
|
26
30
|
export { default as UiAdapter } from './core/UiAdapter.js'
|
|
31
|
+
export { resolvePositionalArgs } from './core/resolvePositionalArgs.js'
|
|
32
|
+
export { tokens } from './Theme/tokens.js'
|
|
27
33
|
|
|
28
34
|
// OLMUI Generator Engine
|
|
29
35
|
/** @typedef {import('./core/Intent.js').LogLevel} LogLevel */
|
|
@@ -49,5 +55,27 @@ export { IntentErrorModel } from './core/IntentErrorModel.js'
|
|
|
49
55
|
export { runGenerator } from './core/GeneratorRunner.js'
|
|
50
56
|
export { buildNan0SpecFromTrace } from './testing/CrashReporter.js'
|
|
51
57
|
|
|
58
|
+
// Flow components
|
|
59
|
+
export {
|
|
60
|
+
runFlow,
|
|
61
|
+
flow,
|
|
62
|
+
Prompt,
|
|
63
|
+
Stream,
|
|
64
|
+
Alert,
|
|
65
|
+
Toast,
|
|
66
|
+
Badge,
|
|
67
|
+
Text,
|
|
68
|
+
Table,
|
|
69
|
+
Input,
|
|
70
|
+
Select,
|
|
71
|
+
Confirm,
|
|
72
|
+
Multiselect,
|
|
73
|
+
Mask,
|
|
74
|
+
Password,
|
|
75
|
+
Spinner,
|
|
76
|
+
Progress,
|
|
77
|
+
} from './core/Flow.js'
|
|
78
|
+
export { default as Flow } from './core/Flow.js'
|
|
79
|
+
|
|
52
80
|
/** @typedef {import('./domain/index.js').ModelAsAppOptions} ModelAsAppOptions */
|
|
53
81
|
export * from './domain/index.js'
|
package/src/inspect.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export * from './testing/SnapshotRunner.js'
|
|
2
2
|
export * from './testing/verifySnapshot.js'
|
|
3
|
+
export { SnapshotAuditor } from './domain/app/SnapshotAuditor.js'
|
|
4
|
+
export { IntentAuditor } from './domain/app/IntentAuditor.js'
|
|
5
|
+
export { JsIntentAuditor } from './domain/app/JsIntentAuditor.js'
|
|
6
|
+
export { PyIntentAuditor } from './domain/app/PyIntentAuditor.js'
|
|
@@ -7,11 +7,12 @@ import DBFS from '@nan0web/db-fs'
|
|
|
7
7
|
*/
|
|
8
8
|
export class SnapshotRunner {
|
|
9
9
|
static async generateAndAudit(options) {
|
|
10
|
+
/** @type {import('@nan0web/db').DB} */
|
|
10
11
|
const db = options.db || new DBFS({ root: options.dataDir })
|
|
11
12
|
const runner = new Runner(options, { db })
|
|
12
13
|
if (options.getCategory) runner.getCategory = options.getCategory
|
|
13
14
|
if (options.createModelStream) runner.createModelStream = options.createModelStream
|
|
14
|
-
|
|
15
|
+
|
|
15
16
|
const gen = runner.run()
|
|
16
17
|
let res = await gen.next()
|
|
17
18
|
while (!res.done) {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const format = {
|
|
2
|
+
currency: (value, currency = 'UAH', locale = 'uk-UA') => {
|
|
3
|
+
return new Intl.NumberFormat(locale, {
|
|
4
|
+
style: 'currency',
|
|
5
|
+
currency,
|
|
6
|
+
maximumFractionDigits: 0
|
|
7
|
+
}).format(value).replace(/,/g, ' ')
|
|
8
|
+
},
|
|
9
|
+
rate: (value, locale = 'uk-UA') => {
|
|
10
|
+
const rate = value < 1 ? value * 100 : value
|
|
11
|
+
return new Intl.NumberFormat(locale, {
|
|
12
|
+
style: 'percent',
|
|
13
|
+
maximumFractionDigits: 2
|
|
14
|
+
}).format(rate / 100)
|
|
15
|
+
},
|
|
16
|
+
number: (value, locale = 'uk-UA') => {
|
|
17
|
+
return new Intl.NumberFormat(locale, {
|
|
18
|
+
maximumFractionDigits: 2
|
|
19
|
+
}).format(value).replace(/,/g, ' ')
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Обробляє i18n та замінює змінні в тексті.
|
|
3
|
+
* @param {any} input - Вміст для обробки.
|
|
4
|
+
* @param {Function} [t] - Функція перекладу.
|
|
5
|
+
* @param {Object} [data] - Дані для підстановки.
|
|
6
|
+
* @returns {any}
|
|
7
|
+
*/
|
|
8
|
+
export function processI18n(input, t, data = {}) {
|
|
9
|
+
// If input is an object with $t property
|
|
10
|
+
if (input && typeof input === 'object' && input.$t) {
|
|
11
|
+
if (t) input = t(input.$t)
|
|
12
|
+
else input = input.$t
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Process string content
|
|
16
|
+
if (typeof input === 'string') {
|
|
17
|
+
return input.replace(/\{\{(\w+)\}\}/g, (_, key) => data[key] || '—')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Process arrays recursively
|
|
21
|
+
if (Array.isArray(input)) {
|
|
22
|
+
return input.map((item) => processI18n(item, t, data))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Return input as is for other types
|
|
26
|
+
return input
|
|
27
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Data as BaseData } from '@nan0web/db'
|
|
2
|
+
|
|
3
|
+
class Data extends BaseData {
|
|
4
|
+
static OBJECT_DIVIDER = '.'
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolves context-aware values in strings and objects.
|
|
8
|
+
* Supports:
|
|
9
|
+
* - References: `data:currencies`, `action:save`, `fn:calculate,100,USD,UAH`
|
|
10
|
+
* - Templates: `{{user.name}}`, `{{currencies[0]}}`
|
|
11
|
+
* - Scalars: numbers, booleans, etc. (passthrough)
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} context - Application context (data, actions, functions)
|
|
14
|
+
* @param {*} value - Raw value to resolve
|
|
15
|
+
* @returns {*} Resolved value
|
|
16
|
+
*/
|
|
17
|
+
export function resolveContext(context, value) {
|
|
18
|
+
if (typeof value !== 'string') return value
|
|
19
|
+
|
|
20
|
+
// Handle data:* reference
|
|
21
|
+
if (value.startsWith('data:')) {
|
|
22
|
+
const path = value.slice(5)
|
|
23
|
+
return Data.find(path, context.data) ?? []
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Handle action:* reference
|
|
27
|
+
if (value.startsWith('action:')) {
|
|
28
|
+
const name = value.slice(7)
|
|
29
|
+
return context.actions?.[name]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Handle fn:* reference with arguments
|
|
33
|
+
if (value.startsWith('fn:')) {
|
|
34
|
+
const [fnName, ...rawArgs] = value.slice(3).split(',')
|
|
35
|
+
const fn = context.functions?.[fnName]
|
|
36
|
+
if (typeof fn !== 'function') return undefined
|
|
37
|
+
|
|
38
|
+
// Parse arguments (numbers, booleans, strings)
|
|
39
|
+
const args = rawArgs.map((arg) => {
|
|
40
|
+
try {
|
|
41
|
+
return JSON.parse(arg)
|
|
42
|
+
} catch {
|
|
43
|
+
return arg // Return as-is if parsing fails
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return () => fn(...args)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Handle template interpolation {{key}} using Data.find
|
|
51
|
+
return value.replace(/{{(.*?)}}/g, (_, path) => {
|
|
52
|
+
const result = Data.find(path, context.data)
|
|
53
|
+
return result !== undefined ? result : `{{${path}}}`
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Resolves a context value or returns undefined if resolution fails.
|
|
59
|
+
* Used internally by renderers to safely resolve props.
|
|
60
|
+
*
|
|
61
|
+
* @param {Object} ctx - Context with data, actions and functions
|
|
62
|
+
* @param {string} value - String value to resolve
|
|
63
|
+
* @returns {*} Resolved value or undefined
|
|
64
|
+
*/
|
|
65
|
+
export function resolveContextValue(ctx, value) {
|
|
66
|
+
if (typeof value !== 'string') return undefined
|
|
67
|
+
if (value.startsWith('data:')) {
|
|
68
|
+
return Data.find(value.slice(5), ctx.data) ?? []
|
|
69
|
+
}
|
|
70
|
+
if (value.startsWith('action:')) {
|
|
71
|
+
return ctx.actions?.[value.slice(7)]
|
|
72
|
+
}
|
|
73
|
+
if (value.startsWith('fn:')) {
|
|
74
|
+
const [fnName, ...args] = value.slice(3).split(',')
|
|
75
|
+
const fn = ctx.functions?.[fnName]
|
|
76
|
+
return typeof fn === 'function' ? fn : undefined
|
|
77
|
+
}
|
|
78
|
+
return undefined
|
|
79
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
+
export { SortableList };
|
|
1
2
|
declare namespace _default {
|
|
2
|
-
export { Welcome };
|
|
3
|
-
export { Process };
|
|
4
3
|
export { SortableList };
|
|
5
4
|
}
|
|
6
5
|
export default _default;
|
|
7
|
-
import Welcome from './Welcome/index.js';
|
|
8
|
-
import Process from './Process/index.js';
|
|
9
6
|
import SortableList from './SortableList/index.js';
|
|
10
|
-
export { Welcome, Process, SortableList };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Element — the model of a declarative UI block.
|
|
3
|
+
* Format: { Button: [...], $variant: 'info', $onClick: fn }
|
|
4
|
+
* Framework-agnostic.
|
|
5
|
+
*/
|
|
6
|
+
export default class Element {
|
|
7
|
+
/** @type {Record<string, string | ((val: any, key: string) => Record<string, any>)>} */
|
|
8
|
+
static PROP_ALIASES: Record<string, string | ((val: any, key: string) => Record<string, any>)>;
|
|
9
|
+
/**
|
|
10
|
+
* Factory method to create or return an existing `Element`.
|
|
11
|
+
* @param {Object} input
|
|
12
|
+
* @returns {Element}
|
|
13
|
+
*/
|
|
14
|
+
static from(input: any): Element;
|
|
15
|
+
/**
|
|
16
|
+
* Parses $-props.
|
|
17
|
+
* Converts for example:
|
|
18
|
+
* - $style="color:red;font-size:14px" → { style: { color: 'red', 'font-size': '14px' } }
|
|
19
|
+
* - $onClick=fn → { onClick: fn }
|
|
20
|
+
* - $ariaHidden=true → { 'aria-hidden': true }
|
|
21
|
+
*
|
|
22
|
+
* @param {string} key - The name of the prop
|
|
23
|
+
* @param {any} value - The value of the prop
|
|
24
|
+
* @returns {Object} - An object { propName: newVal }
|
|
25
|
+
*/
|
|
26
|
+
static parseProp(key: string, value: any): any;
|
|
27
|
+
/**
|
|
28
|
+
* Parses an inline CSS style string.
|
|
29
|
+
* @param {string} styleStr
|
|
30
|
+
* @returns {Object}
|
|
31
|
+
*/
|
|
32
|
+
static parseInlineStyle(styleStr: string): any;
|
|
33
|
+
/**
|
|
34
|
+
* Extracts $-props from the block.
|
|
35
|
+
* @param {Object} block
|
|
36
|
+
* @param {boolean} keep$ - Whether to keep the prefix `$`.
|
|
37
|
+
* @param {Function} [flatMap] - Function that transforms a key-value pair into a new key-value pair.
|
|
38
|
+
* @returns {Object}
|
|
39
|
+
*/
|
|
40
|
+
static extractProps(block: any, keep$?: boolean, flatMap?: Function): any;
|
|
41
|
+
/**
|
|
42
|
+
* Extracts tags (non-prefixed keys) from the block.
|
|
43
|
+
* @param {Object} block
|
|
44
|
+
* @returns {Array<[string, any]>}
|
|
45
|
+
*/
|
|
46
|
+
static extractTags(block: any): Array<[string, any]>;
|
|
47
|
+
/**
|
|
48
|
+
* Creates an `Element` from a declarative block.
|
|
49
|
+
* @param {Object} input - For example, { Button: ["Click"], $variant: "primary" }
|
|
50
|
+
*/
|
|
51
|
+
constructor(input?: any);
|
|
52
|
+
/**
|
|
53
|
+
* The component type or HTML tag (e.g., "Button", "div")
|
|
54
|
+
* @type {string}
|
|
55
|
+
*/
|
|
56
|
+
type: string;
|
|
57
|
+
/**
|
|
58
|
+
* The content of the element.
|
|
59
|
+
* Can be:
|
|
60
|
+
* - string → text
|
|
61
|
+
* - true → empty
|
|
62
|
+
* - array → nested blocks { Icon } or text nodes
|
|
63
|
+
* @type {string | true | any[]}
|
|
64
|
+
*/
|
|
65
|
+
content: string | true | any[];
|
|
66
|
+
/**
|
|
67
|
+
* Props extracted from $-keys.
|
|
68
|
+
* For example, { $onClick: fn, $variant: 'info' } → { onClick: fn, variant: 'info' }
|
|
69
|
+
* @type {Object}
|
|
70
|
+
*/
|
|
71
|
+
props: any;
|
|
72
|
+
/**
|
|
73
|
+
* Checks if the element contains nested elements (not only text).
|
|
74
|
+
* @returns {boolean}
|
|
75
|
+
*/
|
|
76
|
+
hasChildren(): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Checks if the content contains text fragments.
|
|
79
|
+
* @returns {boolean}
|
|
80
|
+
*/
|
|
81
|
+
hasText(): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Returns an array of child elements (Element instances).
|
|
84
|
+
* @returns {Element[]}
|
|
85
|
+
*/
|
|
86
|
+
getChildElements(): Element[];
|
|
87
|
+
}
|
package/types/Model/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default
|
|
1
|
+
export default Models;
|
|
2
2
|
import User from './User/User.js';
|
|
3
3
|
import { HeaderModel } from '../domain/HeaderModel.js';
|
|
4
4
|
import { FooterModel } from '../domain/FooterModel.js';
|
|
@@ -26,7 +26,7 @@ import { TimelineModel } from '../domain/components/index.js';
|
|
|
26
26
|
import { EmptyStateModel } from '../domain/components/index.js';
|
|
27
27
|
import { BannerModel } from '../domain/components/index.js';
|
|
28
28
|
import { ProfileDropdownModel } from '../domain/components/index.js';
|
|
29
|
-
declare namespace
|
|
29
|
+
declare namespace Models {
|
|
30
30
|
export { User };
|
|
31
31
|
export { HeaderModel };
|
|
32
32
|
export { FooterModel };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
fontFamily: string;
|
|
3
|
+
atoms: Partial<typeof import("./atoms/index.js")>;
|
|
4
|
+
molecules: typeof import("./molecules/index.js");
|
|
5
|
+
organisms: typeof import("./organisms/index.js");
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
/**
|
|
9
|
+
* Base application theme.
|
|
10
|
+
* Should be extended by app-specific themes.
|
|
11
|
+
*/
|
|
12
|
+
export type AppThemeConfig = import("./Theme.js").ThemeConfig & {
|
|
13
|
+
fontFamily?: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{ atoms?: object, molecules?: object, organisms?: object }} UserThemeConfig
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Returns selected or custom user theme.
|
|
6
|
+
* @param {string | UserThemeConfig} themeNameOrConfig
|
|
7
|
+
* @returns {import('./Theme.js').ThemeConfig}
|
|
8
|
+
*/
|
|
9
|
+
export function getUserTheme(themeNameOrConfig: string | UserThemeConfig): import("./Theme.js").ThemeConfig;
|
|
10
|
+
/**
|
|
11
|
+
* Custom user theme.
|
|
12
|
+
* Extends the base Theme to allow passing configuration during instantiation.
|
|
13
|
+
* @param {UserThemeConfig} config
|
|
14
|
+
* @returns {import('./Theme.js').ThemeConfig}
|
|
15
|
+
*/
|
|
16
|
+
export default function CustomTheme(config: UserThemeConfig): import("./Theme.js").ThemeConfig;
|
|
17
|
+
export type UserThemeConfig = {
|
|
18
|
+
atoms?: object;
|
|
19
|
+
molecules?: object;
|
|
20
|
+
organisms?: object;
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme that automatically switches between light/dark modes.
|
|
3
|
+
*/
|
|
4
|
+
export default class DarkLightTheme {
|
|
5
|
+
/** @type {Object} */
|
|
6
|
+
static light: any;
|
|
7
|
+
/** @type {Object} */
|
|
8
|
+
static dark: any;
|
|
9
|
+
/** @type {string} */
|
|
10
|
+
static current: string;
|
|
11
|
+
/**
|
|
12
|
+
* Gets active theme (light, dark, or system preference).
|
|
13
|
+
* @returns {Object}
|
|
14
|
+
*/
|
|
15
|
+
static getActiveTheme(): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
atoms: typeof atoms;
|
|
3
|
+
molecules: typeof molecules;
|
|
4
|
+
organisms: typeof organisms;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
/**
|
|
8
|
+
* Universal UI theme foundation.
|
|
9
|
+
* Holds atoms, molecules, and organisms styling configs.
|
|
10
|
+
*/
|
|
11
|
+
export type ThemeConfig = {
|
|
12
|
+
atoms: Partial<typeof atoms>;
|
|
13
|
+
molecules: typeof molecules;
|
|
14
|
+
organisms: typeof organisms;
|
|
15
|
+
};
|
|
16
|
+
import * as atoms from './atoms/index.js';
|
|
17
|
+
import * as molecules from './molecules/index.js';
|
|
18
|
+
import * as organisms from './organisms/index.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
size: string;
|
|
3
|
+
borderRadius: string;
|
|
4
|
+
border: string;
|
|
5
|
+
};
|
|
6
|
+
export default _default;
|
|
7
|
+
/**
|
|
8
|
+
* Theme definition for Avatar atom.
|
|
9
|
+
*/
|
|
10
|
+
export type AvatarTheme = {
|
|
11
|
+
size: string;
|
|
12
|
+
borderRadius: string;
|
|
13
|
+
border: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
borderRadius: string;
|
|
3
|
+
fontSize: string;
|
|
4
|
+
paddingX: string;
|
|
5
|
+
paddingY: string;
|
|
6
|
+
fontWeight: string;
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
color: string;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
/**
|
|
12
|
+
* Theme definition for Badge atom.
|
|
13
|
+
*/
|
|
14
|
+
export type BadgeTheme = {
|
|
15
|
+
borderRadius: string;
|
|
16
|
+
fontSize: string;
|
|
17
|
+
paddingX: string;
|
|
18
|
+
paddingY: string;
|
|
19
|
+
fontWeight: string;
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
color: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
color: string;
|
|
3
|
+
background: string;
|
|
4
|
+
shadow: string;
|
|
5
|
+
hoverBackground: string;
|
|
6
|
+
solid: {
|
|
7
|
+
primary: {
|
|
8
|
+
background: string;
|
|
9
|
+
color: string;
|
|
10
|
+
border: string;
|
|
11
|
+
};
|
|
12
|
+
secondary: {
|
|
13
|
+
background: string;
|
|
14
|
+
color: string;
|
|
15
|
+
border: string;
|
|
16
|
+
};
|
|
17
|
+
success: {
|
|
18
|
+
background: string;
|
|
19
|
+
color: string;
|
|
20
|
+
border: string;
|
|
21
|
+
};
|
|
22
|
+
warning: {
|
|
23
|
+
background: string;
|
|
24
|
+
color: string;
|
|
25
|
+
border: string;
|
|
26
|
+
};
|
|
27
|
+
danger: {
|
|
28
|
+
background: string;
|
|
29
|
+
color: string;
|
|
30
|
+
border: string;
|
|
31
|
+
};
|
|
32
|
+
info: {
|
|
33
|
+
background: string;
|
|
34
|
+
color: string;
|
|
35
|
+
border: string;
|
|
36
|
+
};
|
|
37
|
+
light: {
|
|
38
|
+
background: string;
|
|
39
|
+
color: string;
|
|
40
|
+
border: string;
|
|
41
|
+
};
|
|
42
|
+
dark: {
|
|
43
|
+
background: string;
|
|
44
|
+
color: string;
|
|
45
|
+
border: string;
|
|
46
|
+
};
|
|
47
|
+
link: {
|
|
48
|
+
background: string;
|
|
49
|
+
color: string;
|
|
50
|
+
border: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
outline: {
|
|
54
|
+
primary: {
|
|
55
|
+
background: string;
|
|
56
|
+
color: string;
|
|
57
|
+
border: string;
|
|
58
|
+
};
|
|
59
|
+
secondary: {
|
|
60
|
+
background: string;
|
|
61
|
+
color: string;
|
|
62
|
+
border: string;
|
|
63
|
+
};
|
|
64
|
+
success: {
|
|
65
|
+
background: string;
|
|
66
|
+
color: string;
|
|
67
|
+
border: string;
|
|
68
|
+
};
|
|
69
|
+
warning: {
|
|
70
|
+
background: string;
|
|
71
|
+
color: string;
|
|
72
|
+
border: string;
|
|
73
|
+
};
|
|
74
|
+
danger: {
|
|
75
|
+
background: string;
|
|
76
|
+
color: string;
|
|
77
|
+
border: string;
|
|
78
|
+
};
|
|
79
|
+
info: {
|
|
80
|
+
background: string;
|
|
81
|
+
color: string;
|
|
82
|
+
border: string;
|
|
83
|
+
};
|
|
84
|
+
light: {
|
|
85
|
+
background: string;
|
|
86
|
+
color: string;
|
|
87
|
+
border: string;
|
|
88
|
+
};
|
|
89
|
+
dark: {
|
|
90
|
+
background: string;
|
|
91
|
+
color: string;
|
|
92
|
+
border: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
size: {
|
|
96
|
+
sm: {
|
|
97
|
+
fontSize: string;
|
|
98
|
+
paddingX: string;
|
|
99
|
+
paddingY: string;
|
|
100
|
+
};
|
|
101
|
+
md: {
|
|
102
|
+
fontSize: string;
|
|
103
|
+
paddingX: string;
|
|
104
|
+
paddingY: string;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
animation: {
|
|
108
|
+
transition: string;
|
|
109
|
+
hoverAdjust: number;
|
|
110
|
+
activeAdjust: number;
|
|
111
|
+
focusScale: number;
|
|
112
|
+
activeScale: number;
|
|
113
|
+
disabledOpacity: number;
|
|
114
|
+
};
|
|
115
|
+
borderColor: string;
|
|
116
|
+
borderRadius: string;
|
|
117
|
+
borderWidth: string;
|
|
118
|
+
fontSize: string;
|
|
119
|
+
paddingX: string;
|
|
120
|
+
paddingY: string;
|
|
121
|
+
fontFamily: string;
|
|
122
|
+
};
|
|
123
|
+
export default _default;
|
|
124
|
+
/**
|
|
125
|
+
* Theme definition for Button atom.
|
|
126
|
+
* Inherits common properties from Input and defines colour and shadow.
|
|
127
|
+
*/
|
|
128
|
+
export type ButtonTheme = {
|
|
129
|
+
color: string;
|
|
130
|
+
background: string;
|
|
131
|
+
shadow: string;
|
|
132
|
+
hoverBackground: string;
|
|
133
|
+
solid: any;
|
|
134
|
+
outline: any;
|
|
135
|
+
size: any;
|
|
136
|
+
animation: any;
|
|
137
|
+
borderColor: string;
|
|
138
|
+
borderRadius: string;
|
|
139
|
+
borderWidth: string;
|
|
140
|
+
fontSize: string;
|
|
141
|
+
paddingX: string;
|
|
142
|
+
paddingY: string;
|
|
143
|
+
fontFamily: string;
|
|
144
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
size: string;
|
|
3
|
+
borderColor: string;
|
|
4
|
+
borderRadius: string;
|
|
5
|
+
borderWidth: string;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
checkedColor: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
/**
|
|
11
|
+
* Theme definition for Checkbox atom.
|
|
12
|
+
*/
|
|
13
|
+
export type CheckboxTheme = {
|
|
14
|
+
size: string;
|
|
15
|
+
borderColor: string;
|
|
16
|
+
borderRadius: string;
|
|
17
|
+
borderWidth: string;
|
|
18
|
+
backgroundColor: string;
|
|
19
|
+
checkedColor: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
borderRadius: string;
|
|
3
|
+
borderWidth: string;
|
|
4
|
+
borderColor: string;
|
|
5
|
+
fontSize: string;
|
|
6
|
+
paddingX: string;
|
|
7
|
+
paddingY: string;
|
|
8
|
+
fontFamily: string;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
/**
|
|
12
|
+
* Theme definition for Input atom.
|
|
13
|
+
*/
|
|
14
|
+
export type InputTheme = {
|
|
15
|
+
borderRadius: string;
|
|
16
|
+
borderWidth: string;
|
|
17
|
+
borderColor: string;
|
|
18
|
+
fontSize: string;
|
|
19
|
+
paddingX: string;
|
|
20
|
+
paddingY: string;
|
|
21
|
+
fontFamily: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
size: string;
|
|
3
|
+
borderColor: string;
|
|
4
|
+
borderRadius: string;
|
|
5
|
+
borderWidth: string;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
checkedColor: string;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
10
|
+
/**
|
|
11
|
+
* Theme definition for Radio atom.
|
|
12
|
+
*/
|
|
13
|
+
export type RadioTheme = {
|
|
14
|
+
size: string;
|
|
15
|
+
borderColor: string;
|
|
16
|
+
borderRadius: string;
|
|
17
|
+
borderWidth: string;
|
|
18
|
+
backgroundColor: string;
|
|
19
|
+
checkedColor: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
borderRadius: string;
|
|
3
|
+
borderWidth: string;
|
|
4
|
+
borderColor: string;
|
|
5
|
+
fontSize: string;
|
|
6
|
+
paddingX: string;
|
|
7
|
+
paddingY: string;
|
|
8
|
+
fontFamily: string;
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
11
|
+
/**
|
|
12
|
+
* Theme definition for Select atom.
|
|
13
|
+
* Inherits all properties from InputTheme.
|
|
14
|
+
*/
|
|
15
|
+
export type SelectTheme = import("./Input.js").InputTheme;
|