@kurot/ui-runtime 0.2.1 → 0.2.2
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 +8 -6
- package/dist/kurot/runtime/builtins/applyControlProperties.d.ts.map +1 -1
- package/dist/kurot/runtime/builtins/applyControlProperties.js +43 -3
- package/dist/kurot/runtime/builtins/applyControlProperties.js.map +1 -1
- package/dist/kurot/runtime/builtins/componentFactories.d.ts.map +1 -1
- package/dist/kurot/runtime/builtins/componentFactories.js +3 -1
- package/dist/kurot/runtime/builtins/componentFactories.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -11,12 +11,14 @@ const result = createKurotUI(document, { assets });
|
|
|
11
11
|
stage.addChild(result.root);
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
The runtime supports `kui.Group`, `kui.Label`, `kui.Image`, `kui.Rect`,
|
|
15
|
-
`kui.Button`, including their audited
|
|
16
|
-
descriptors, and nine-slice rectangles.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
The runtime supports `kui.Group`, `kui.Label`, `kui.Image`, `kui.Rect`,
|
|
15
|
+
`kui.Button`, `kui.ToggleButton`, and `kui.ProgressBar`, including their audited
|
|
16
|
+
inherited properties, children, layout descriptors, and nine-slice rectangles.
|
|
17
|
+
ProgressBar appearances bind live thumb and label parts, so authored values
|
|
18
|
+
drive the real runtime clipping and label behavior. Reusable component assets
|
|
19
|
+
are expanded with parameter bindings, variants, part overrides, and projected
|
|
20
|
+
Slot content. Appearance assets become native Kurot skins and states, including
|
|
21
|
+
the selected appearance variant.
|
|
20
22
|
|
|
21
23
|
Version 0.2 performs full-tree creation. It does not yet provide incremental
|
|
22
24
|
reconciliation, bindings, actions, or transitions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyControlProperties.d.ts","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/applyControlProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,MAAM,GACV,OAAO,
|
|
1
|
+
{"version":3,"file":"applyControlProperties.d.ts","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/applyControlProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D;;GAEG;AACH,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,eAAe,EACtB,IAAI,EAAE,MAAM,GACV,OAAO,CAWT"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { Button } from '@kurot/ui';
|
|
1
|
+
import { Button, ProgressBar } from '@kurot/ui';
|
|
2
2
|
import { KurotUIRuntimeError } from '../KurotUIRuntimeError.js';
|
|
3
3
|
/**
|
|
4
4
|
* Applies one property owned by a built-in interactive control.
|
|
5
5
|
*/
|
|
6
6
|
export function applyControlProperty(target, name, value, path) {
|
|
7
|
-
if (
|
|
8
|
-
return
|
|
7
|
+
if (target instanceof Button && applyButtonProperty(target, name, value, path)) {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
if (target instanceof ProgressBar &&
|
|
11
|
+
applyProgressBarProperty(target, name, value, path)) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
function applyButtonProperty(target, name, value, path) {
|
|
9
17
|
switch (name) {
|
|
10
18
|
case 'icon':
|
|
11
19
|
target.icon = requireString(value, path);
|
|
@@ -23,6 +31,27 @@ export function applyControlProperty(target, name, value, path) {
|
|
|
23
31
|
return false;
|
|
24
32
|
}
|
|
25
33
|
}
|
|
34
|
+
function applyProgressBarProperty(target, name, value, path) {
|
|
35
|
+
switch (name) {
|
|
36
|
+
case 'direction':
|
|
37
|
+
target.direction = requireDirection(value, path);
|
|
38
|
+
return true;
|
|
39
|
+
case 'maximum':
|
|
40
|
+
target.maximum = requireNumber(value, path);
|
|
41
|
+
return true;
|
|
42
|
+
case 'minimum':
|
|
43
|
+
target.minimum = requireNumber(value, path);
|
|
44
|
+
return true;
|
|
45
|
+
case 'slideDuration':
|
|
46
|
+
target.slideDuration = requireNumber(value, path);
|
|
47
|
+
return true;
|
|
48
|
+
case 'value':
|
|
49
|
+
target.value = requireNumber(value, path);
|
|
50
|
+
return true;
|
|
51
|
+
default:
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
26
55
|
function requireBoolean(value, path) {
|
|
27
56
|
if (typeof value === 'boolean')
|
|
28
57
|
return value;
|
|
@@ -33,6 +62,17 @@ function requireString(value, path) {
|
|
|
33
62
|
return value;
|
|
34
63
|
throw invalidValue('string', path);
|
|
35
64
|
}
|
|
65
|
+
function requireDirection(value, path) {
|
|
66
|
+
if (value === 'btt' || value === 'ltr' || value === 'rtl' || value === 'ttb') {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
throw invalidValue('btt, ltr, rtl, or ttb', path);
|
|
70
|
+
}
|
|
71
|
+
function requireNumber(value, path) {
|
|
72
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
73
|
+
return value;
|
|
74
|
+
throw invalidValue('number', path);
|
|
75
|
+
}
|
|
36
76
|
function invalidValue(type, path) {
|
|
37
77
|
return new KurotUIRuntimeError('invalid-property', `Runtime property must be ${type}.`, path);
|
|
38
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyControlProperties.js","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/applyControlProperties.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"applyControlProperties.js","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/applyControlProperties.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEhD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE;;GAEG;AACH,MAAM,UAAU,oBAAoB,CACnC,MAAqB,EACrB,IAAY,EACZ,KAAsB,EACtB,IAAY;IAEZ,IAAI,MAAM,YAAY,MAAM,IAAI,mBAAmB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC;QAChF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IACC,MAAM,YAAY,WAAW;QAC7B,wBAAwB,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAClD,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,mBAAmB,CAC3B,MAAc,EACd,IAAY,EACZ,KAAsB,EACtB,IAAY;IAEZ,QAAQ,IAAI,EAAE,CAAC;QACd,KAAK,MAAM;YACV,MAAM,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO,IAAI,CAAC;QACb,KAAK,OAAO;YACX,MAAM,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC1C,OAAO,IAAI,CAAC;QACb,KAAK,UAAU;YACd,MAAM,CAAC,QAAQ,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC;QACb,KAAK,QAAQ;YACZ,MAAM,CAAC,MAAM,GAAG,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAC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,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;QAC9E,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,YAAY,CAAC,uBAAuB,EAAE,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,SAAS,aAAa,CAAC,KAAsB,EAAE,IAAY;IAC1D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtE,MAAM,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,YAAY,CAAC,IAAY,EAAE,IAAY;IAC/C,OAAO,IAAI,mBAAmB,CAC7B,kBAAkB,EAClB,4BAA4B,IAAI,GAAG,EACnC,IAAI,CACJ,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentFactories.d.ts","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/componentFactories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"componentFactories.d.ts","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/componentFactories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAqBjD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,aAAa,CAAC,GAAG,SAAS,CAEjF"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Button, Group, Image, Label, Rect } from '@kurot/ui';
|
|
1
|
+
import { Button, Group, Image, Label, ProgressBar, Rect, ToggleButton, } from '@kurot/ui';
|
|
2
2
|
const BUILT_IN_FACTORIES = {
|
|
3
3
|
'kui.Button': () => new Button(),
|
|
4
4
|
'kui.Group': () => new Group(),
|
|
5
5
|
'kui.Image': () => new Image(),
|
|
6
6
|
'kui.Label': () => new Label(),
|
|
7
|
+
'kui.ProgressBar': () => new ProgressBar(),
|
|
7
8
|
'kui.Rect': () => new Rect(),
|
|
9
|
+
'kui.ToggleButton': () => new ToggleButton(),
|
|
8
10
|
};
|
|
9
11
|
/**
|
|
10
12
|
* Returns the built-in factory for one canonical Kurot UI component type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentFactories.js","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/componentFactories.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"componentFactories.js","sourceRoot":"","sources":["../../../../src/kurot/runtime/builtins/componentFactories.ts"],"names":[],"mappings":"AACA,OAAO,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,IAAI,EACJ,YAAY,GACZ,MAAM,WAAW,CAAC;AAEnB,MAAM,kBAAkB,GAAkD;IACzE,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,MAAM,EAAE;IAChC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,KAAK,EAAE;IAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,KAAK,EAAE;IAC9B,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,KAAK,EAAE;IAC9B,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,WAAW,EAAE;IAC1C,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;IAC5B,kBAAkB,EAAE,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC7C,OAAO,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurot/ui-runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Runtime materialization layer for validated Kurot UI documents",
|
|
5
5
|
"author": "Kelvin <kyia.x52@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@kurot/core": "^1.0.15",
|
|
33
33
|
"@kurot/ui": "^1.1.7",
|
|
34
|
-
"@kurot/ui-document": "^0.3.
|
|
34
|
+
"@kurot/ui-document": "^0.3.3"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@kurot/core": "^1.0.15",
|
|
38
38
|
"@kurot/ui": "^1.1.7",
|
|
39
|
-
"@kurot/ui-document": "^0.3.
|
|
39
|
+
"@kurot/ui-document": "^0.3.3",
|
|
40
40
|
"@types/node": "^22.0.0",
|
|
41
41
|
"happy-dom": "^20.8.9",
|
|
42
42
|
"typescript": "^5.6.0",
|