@kurot/cli 3.0.0 → 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/CHANGELOG.md +53 -8
- package/README.md +55 -25
- package/docs/ai-context.md +160 -0
- package/docs/architecture.md +92 -0
- package/docs/label-text-layout.md +59 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,52 @@
|
|
|
3
3
|
All notable changes to `@kurot/cli` are documented in this file.
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
-
and
|
|
6
|
+
and CLI command/configuration APIs follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
The early KUI XML contract follows the pre-1.0 `ui-document` kernel; authored
|
|
8
|
+
format changes are documented explicitly in each release.
|
|
9
|
+
|
|
10
|
+
## 3.1.0 — 2026-10-05
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Compile shared-catalog Label textFit/minFontSize properties and state sizes
|
|
15
|
+
unchanged. Drawing size remains a UI runtime derivation, never generated data.
|
|
16
|
+
- Include public documentation in the npm package, including the compilation
|
|
17
|
+
contract, architecture and package context.
|
|
18
|
+
|
|
19
|
+
### Dependencies
|
|
20
|
+
|
|
21
|
+
- Require `@kurot/ui-document@^0.9.0` for the Label authoring catalog. KUI
|
|
22
|
+
rendering with shrinking requires UI 3.1.x and Core 2.1.x or later within
|
|
23
|
+
their respective majors; native engine packages remain project dependencies.
|
|
24
|
+
- Keep semantic format version 2, literal string handling and resource defaults.
|
|
25
|
+
Existing EXML projects stay on CLI 1.3.x; no files are migrated automatically.
|
|
26
|
+
|
|
27
|
+
### Tests
|
|
28
|
+
|
|
29
|
+
- Verify fitting policy, minimum font size, authored size and state-size
|
|
30
|
+
assignments through KUI parsing and code generation.
|
|
31
|
+
|
|
32
|
+
## 3.0.1 — 2026-10-04
|
|
33
|
+
|
|
34
|
+
### XML Authoring Change
|
|
35
|
+
|
|
36
|
+
- Require `@kurot/ui-document@^0.8.0`. Schema-defined string attributes,
|
|
37
|
+
including `text`, `label` and state text, now compile as literal strings.
|
|
38
|
+
`text="100.80"` preserves its decimal formatting; `text="false"` stays text.
|
|
39
|
+
Old synthetic backslash type escapes are now literal characters and must be
|
|
40
|
+
removed explicitly. No automatic source migration is performed.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- Align the compiler dependency and lockfile with the published document kernel.
|
|
45
|
+
Numeric/boolean properties, references, XML entities and schema-free collection
|
|
46
|
+
scalar inference retain their existing rules. Generated Skin APIs are unchanged.
|
|
47
|
+
|
|
48
|
+
### Tests
|
|
49
|
+
|
|
50
|
+
- Verify literal text, state text, real backslashes and typed properties through
|
|
51
|
+
parsing, code generation and the emitted theme bundle.
|
|
7
52
|
|
|
8
53
|
## 3.0.0 — 2026-10-03
|
|
9
54
|
|
|
@@ -204,13 +249,13 @@ change their project configuration.
|
|
|
204
249
|
- `kurot dev --diagnostics jsonl`, which reserves stdout for independent
|
|
205
250
|
`build-start`, `diagnostic`, `build-complete` and `server-ready` events.
|
|
206
251
|
- Stable diagnostics for the following cases:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
252
|
+
- `KUROT_EXML_UNKNOWN_TAG`
|
|
253
|
+
- `KUROT_EXML_COMPILE_FAILED`
|
|
254
|
+
- `KUROT_EXML_DECLARED_FILE_NOT_FOUND`
|
|
255
|
+
- `KUROT_THEME_FILE_NOT_FOUND`
|
|
256
|
+
- `KUROT_THEME_INVALID_JSON`
|
|
257
|
+
- `KUROT_THEME_SKIN_NOT_FOUND`
|
|
258
|
+
- `KUROT_WATCH_RELEASE_IGNORED`
|
|
214
259
|
|
|
215
260
|
### Changed
|
|
216
261
|
|
package/README.md
CHANGED
|
@@ -3,15 +3,35 @@
|
|
|
3
3
|
Build tooling for the Kurot UI Editor workflow. It uses esbuild, emits ES2022
|
|
4
4
|
ESM, and compiles canonical KUI XML skins into runtime theme modules.
|
|
5
5
|
|
|
6
|
-
> **
|
|
6
|
+
> **Current release: 3.1.0.** Node.js 20 or later is required.
|
|
7
7
|
|
|
8
8
|
> **Release scope:** The 3.x line is dedicated to Kurot Editor integration.
|
|
9
|
-
> Existing game projects that use EXML
|
|
9
|
+
> Existing game projects that use EXML should remain on
|
|
10
10
|
> `@kurot/cli@1.3.x`. The KUI toolchain is not an in-place project upgrade and does
|
|
11
11
|
> not require those projects to change their configuration or UI assets.
|
|
12
12
|
|
|
13
13
|
See [CHANGELOG.md](CHANGELOG.md) for release history.
|
|
14
14
|
|
|
15
|
+
## Label text fitting in 3.1.0
|
|
16
|
+
|
|
17
|
+
The shared ui-document 0.9.x catalog supports Label `textFit` and `minFontSize`
|
|
18
|
+
in KUI XML:
|
|
19
|
+
|
|
20
|
+
```xml
|
|
21
|
+
<Skin xmlns="https://kurot.dev/ui/1" class="skins.AmountSkin" states="down">
|
|
22
|
+
<Label id="labelDisplay" text="KZT 10 000,00" width="140" size="24"
|
|
23
|
+
multiline="false" textFit="shrink" minFontSize="16" size.down="20" />
|
|
24
|
+
</Skin>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The compiler emits the policy, base size and state overrides unchanged. UI
|
|
28
|
+
derives the drawing size after layout validation. Rendering this capability
|
|
29
|
+
requires `@kurot/ui@^3.1.0` and `@kurot/core@^2.1.0` in the application.
|
|
30
|
+
Explicit `multiline="false"` means one unwrapped first line; remove it or set
|
|
31
|
+
it to true for text intended to wrap. Files are not migrated automatically.
|
|
32
|
+
See the [compilation contract](docs/label-text-layout.md) and
|
|
33
|
+
[native Label contract](../ui/docs/label-text-layout.md).
|
|
34
|
+
|
|
15
35
|
## Usage
|
|
16
36
|
|
|
17
37
|
The CLI does not require a global install.
|
|
@@ -25,7 +45,7 @@ pnpm dev
|
|
|
25
45
|
|
|
26
46
|
Scaffolded projects expose `build`, `dev`, and `clean` scripts. For an
|
|
27
47
|
Editor-managed KUI XML project, install the package with
|
|
28
|
-
`pnpm add -D @kurot/cli
|
|
48
|
+
`pnpm add -D @kurot/cli@^3.1.0`. Existing EXML projects should keep their current
|
|
29
49
|
1.3.x dependency.
|
|
30
50
|
|
|
31
51
|
## Commands
|
|
@@ -76,25 +96,25 @@ Create `kurot.config.ts` in the project root:
|
|
|
76
96
|
|
|
77
97
|
```ts
|
|
78
98
|
export default {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
99
|
+
target: 'html5',
|
|
100
|
+
entry: 'src/Main.ts',
|
|
101
|
+
output: { dir: 'bin-debug' },
|
|
102
|
+
html: { template: 'template/web/index.html' },
|
|
103
|
+
stage: {
|
|
104
|
+
width: 640,
|
|
105
|
+
height: 1136,
|
|
106
|
+
scaleMode: 'showAll',
|
|
107
|
+
orientation: 'auto',
|
|
108
|
+
frameRate: 60,
|
|
109
|
+
},
|
|
110
|
+
ui: {
|
|
111
|
+
sourceDir: 'resource/ui',
|
|
112
|
+
components: {
|
|
113
|
+
namespace: 'game',
|
|
114
|
+
sourceDir: 'src/components',
|
|
115
|
+
skinDir: 'resource/ui/components',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
98
118
|
};
|
|
99
119
|
```
|
|
100
120
|
|
|
@@ -133,6 +153,15 @@ use `property.state` on the affected node, so internal graphics remain unnamed.
|
|
|
133
153
|
Image sources use their resource key directly, for example
|
|
134
154
|
`source="button_up_png"`.
|
|
135
155
|
|
|
156
|
+
Version 3.1.0 uses `@kurot/ui-document@^0.9.0` and its literal-string XML rules.
|
|
157
|
+
For example, `<Label text="100.80" text.down="false" size="48" />` compiles
|
|
158
|
+
the exact strings `100.80` and `false`, while the font size stays numeric.
|
|
159
|
+
String properties no longer add or remove backslash type escapes. Remove old
|
|
160
|
+
synthetic prefixes such as the one in `text="\100.80"` explicitly; real
|
|
161
|
+
backslashes remain text. XML entities and typed collection data retain their
|
|
162
|
+
existing rules. Source files are not migrated automatically. Editor and CLI
|
|
163
|
+
must adopt the same [XML value contract](../ui-document/docs/kui-xml.md#values).
|
|
164
|
+
|
|
136
165
|
The pipeline is:
|
|
137
166
|
|
|
138
167
|
```text
|
|
@@ -159,8 +188,9 @@ src/components/<path>/<Name>.ts
|
|
|
159
188
|
resource/ui/components/<path>/<Name>Skin.kui.xml
|
|
160
189
|
```
|
|
161
190
|
|
|
162
|
-
The TypeScript module must export `<Name>`. The paired skin
|
|
163
|
-
|
|
191
|
+
The TypeScript module must export `<Name>`. The paired skin declares its generated
|
|
192
|
+
class with `class`, for example `class="skins.ActionCardSkin"`; the source/skin
|
|
193
|
+
pair supplies the host association. The CLI exposes the component as `<namespace>:<Name>` in
|
|
164
194
|
KUI XML, refreshes the namespace bundle, and emits development catalog data at
|
|
165
195
|
`.kurot/component-catalog.json`.
|
|
166
196
|
|
|
@@ -193,7 +223,7 @@ KUI builds validate `resource/default.res.json` and inherit image or sheet-frame
|
|
|
193
223
|
`scale9grid` values into compiled `Image.scale9Grid` when XML does not set one.
|
|
194
224
|
Local grids and `scale9Grid="false"` take priority. Development mode rebuilds
|
|
195
225
|
skins after manifest edits; a malformed manifest leaves the last good Skin
|
|
196
|
-
bundle in place.
|
|
226
|
+
bundle in place. The current CLI requires `@kurot/ui-document@^0.9.0`.
|
|
197
227
|
|
|
198
228
|
Sheet `subkeys` must be an object-valued frame map. Refresh old sheets in the
|
|
199
229
|
Editor before upgrading a KUI project; string-valued subkeys now fail the build.
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# @kurot/cli — AI context map
|
|
2
|
+
|
|
3
|
+
Read this before exploring `src/`. [`architecture.md`](./architecture.md)
|
|
4
|
+
explains the plugin pipeline. The package is `@kurot/cli@3.1.0`, runs on
|
|
5
|
+
Node.js 20+, and is installed as a project dev dependency.
|
|
6
|
+
|
|
7
|
+
## Directory map
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
src/
|
|
11
|
+
├── index.ts Commander entry
|
|
12
|
+
├── define.ts public configuration type exports
|
|
13
|
+
├── commands/ build, dev, create, clean
|
|
14
|
+
├── core/
|
|
15
|
+
│ ├── config.ts configuration loading and validation
|
|
16
|
+
│ ├── project.ts resolved paths, dependencies, namespaces
|
|
17
|
+
│ ├── pipeline.ts BuildContext and ordered plugin runner
|
|
18
|
+
│ ├── dev-server.ts static server and watchers
|
|
19
|
+
│ ├── diagnostics/ stable codes and JSON/JSONL output
|
|
20
|
+
│ ├── components/ reusable component discovery
|
|
21
|
+
│ ├── kui/ UIDocument → SkinIR → ESM compiler
|
|
22
|
+
│ └── plugins/ build stages
|
|
23
|
+
└── utils/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Project templates are under `templates/game` and `templates/empty`.
|
|
27
|
+
|
|
28
|
+
## KUI compilation
|
|
29
|
+
|
|
30
|
+
`.kui.xml` is the only authored UI format. `compile-kui.ts` recursively scans
|
|
31
|
+
`ui.sourceDir` and parses every document with `@kurot/ui-document`. Appearance
|
|
32
|
+
assets are adapted by `kui/kui-parser.ts` to the compiler-private `SkinIR`,
|
|
33
|
+
then `skin-module-builder.ts` bundles generated factories.
|
|
34
|
+
|
|
35
|
+
A Skin document root declares `class`, the generated skin registration name,
|
|
36
|
+
and may declare `states`. The Skin is the visual root container: its properties
|
|
37
|
+
and layout apply to the runtime Skin, and its direct visual children become
|
|
38
|
+
`skin.elementsContent` without an extra Group. Overrides use local
|
|
39
|
+
`property.state` attributes. Storage IDs and runtime mapping metadata are not
|
|
40
|
+
authored XML fields.
|
|
41
|
+
|
|
42
|
+
CLI 3.1.0 requires `@kurot/ui-document@^0.9.0`. Schema-defined strings, including
|
|
43
|
+
numeric/boolean-looking text and state text, are literal attributes without
|
|
44
|
+
backslash type escaping. Old synthetic prefixes become literal characters;
|
|
45
|
+
do not migrate them silently. Numeric/boolean properties and schema-free
|
|
46
|
+
collection fields retain their existing rules.
|
|
47
|
+
|
|
48
|
+
The theme JSON at `resource/default.thm.json` is fixed generated output. It is
|
|
49
|
+
derived from built-in naming conventions and configured project component
|
|
50
|
+
pairs, and contains `skins` plus `skinsJs`; it is never read as an authored
|
|
51
|
+
input. Duplicate conventional mappings are errors.
|
|
52
|
+
|
|
53
|
+
`SkinIR` is intentionally smaller than `UIDocument`. It contains resolved
|
|
54
|
+
runtime classes, assignments, visual children, layout descriptor children,
|
|
55
|
+
and state `SetProperty` overrides. Reuse, data contracts, actions, and editor
|
|
56
|
+
transactions stay in `@kurot/ui-document` and `@kurot/ui-runtime`.
|
|
57
|
+
|
|
58
|
+
Successful compilation writes `.kurot/skin-parts.d.ts` from the same IR. Every
|
|
59
|
+
explicitly identified node inside the Skin is a skin part, with its `id`
|
|
60
|
+
as the part name. Internal nodes can omit `id`; the declaration augments
|
|
61
|
+
`SkinPartsMap` and narrows matching exported
|
|
62
|
+
component classes. The file is development metadata and is excluded from
|
|
63
|
+
runtime output.
|
|
64
|
+
|
|
65
|
+
## Reusable components
|
|
66
|
+
|
|
67
|
+
With `ui.components`, `<Name>.ts` under `sourceDir` pairs with
|
|
68
|
+
`<Name>Skin.kui.xml` at the same relative path under `skinDir`. The source must
|
|
69
|
+
export `<Name>`; the paired Skin supplies its own `class`. Discovery creates the
|
|
70
|
+
namespace entry, skin association, and development component catalog. Component
|
|
71
|
+
names must be unique inside the configured namespace.
|
|
72
|
+
|
|
73
|
+
Manual `ui.namespaces` entries remain available for project barrel files. A
|
|
74
|
+
manual prefix cannot conflict with `ui.components.namespace`.
|
|
75
|
+
|
|
76
|
+
## Non-obvious behavior
|
|
77
|
+
|
|
78
|
+
- `--watch` uses development mode even when `--release` is also supplied.
|
|
79
|
+
- Real KUI parse or code-generation failures abort the current build. Dev watch
|
|
80
|
+
keeps the last successful bundle and retries on the next edit.
|
|
81
|
+
- Unknown KUI tags are warnings in normal development, and errors under
|
|
82
|
+
`--strict` or release policy.
|
|
83
|
+
- Machine diagnostic modes own stdout: build emits one JSON result; dev emits
|
|
84
|
+
JSONL lifecycle events.
|
|
85
|
+
- `compileCustomNamespaces` must precede `compileSource`. Application-relative
|
|
86
|
+
imports and generated `#ns/<prefix>` imports must resolve to one bundled class
|
|
87
|
+
identity.
|
|
88
|
+
- Engine and custom namespace chunks share `ctx.outputs.engine` because the
|
|
89
|
+
import-map writer treats both as external specifier mappings.
|
|
90
|
+
- Release bundles preserve class names. UI theme fallback uses constructor
|
|
91
|
+
names, so normal identifier minification would break skin lookup.
|
|
92
|
+
- The Skin module builder stages output in a temporary directory and installs a
|
|
93
|
+
bundle only after every Skin succeeds.
|
|
94
|
+
- `cleanOutput` wipes the active output directory at the start of each build.
|
|
95
|
+
The standalone `clean` command removes both development and release output.
|
|
96
|
+
- `create` queries the npm registry for current Kurot package versions and falls
|
|
97
|
+
back to `latest` if the request fails.
|
|
98
|
+
- Release output is timestamped and `manifest.json` exists only in release.
|
|
99
|
+
|
|
100
|
+
## Plugin order
|
|
101
|
+
|
|
102
|
+
`defaultPlugins()` currently runs:
|
|
103
|
+
|
|
104
|
+
1. clean output;
|
|
105
|
+
2. compile KUI;
|
|
106
|
+
3. compile engine packages;
|
|
107
|
+
4. compile project namespaces;
|
|
108
|
+
5. write the development component catalog;
|
|
109
|
+
6. compile application source;
|
|
110
|
+
7. generate HTML;
|
|
111
|
+
8. write the release manifest;
|
|
112
|
+
9. copy runtime assets.
|
|
113
|
+
|
|
114
|
+
Do not reorder namespace or source compilation without reviewing externalization
|
|
115
|
+
in `namespace-external-plugin.ts`.
|
|
116
|
+
|
|
117
|
+
## Configuration lookup
|
|
118
|
+
|
|
119
|
+
| Task | File |
|
|
120
|
+
| -------------------------------- | -------------------------------------------- |
|
|
121
|
+
| Add or validate a config field | `src/core/config.ts` |
|
|
122
|
+
| Resolve an absolute project path | `src/core/project.ts` |
|
|
123
|
+
| Change KUI scanning/theme output | `src/core/plugins/compile-kui.ts` |
|
|
124
|
+
| Change KUI node code generation | `src/core/kui/kui-parser.ts`, `codegen.ts` |
|
|
125
|
+
| Add a built-in component tag | `src/core/kui/registry.ts` |
|
|
126
|
+
| Change generated part types | `src/core/kui/skin-parts-declaration.ts` |
|
|
127
|
+
| Change component pairing | `src/core/components/discover-components.ts` |
|
|
128
|
+
| Change watch behavior | `src/core/dev-server.ts` |
|
|
129
|
+
| Change output HTML/import maps | `src/core/plugins/generate-html.ts` |
|
|
130
|
+
| Change scaffolding | `src/core/template.ts`, `templates/` |
|
|
131
|
+
| Add a diagnostic code | `src/core/diagnostics/codes.ts` |
|
|
132
|
+
|
|
133
|
+
## Verification
|
|
134
|
+
|
|
135
|
+
Run commands from this package directory:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pnpm build
|
|
139
|
+
pnpm test
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
CLI end-to-end tests bind localhost and may require permission in a restricted
|
|
143
|
+
execution environment.
|
|
144
|
+
|
|
145
|
+
## Resource configuration change in 3.0.0
|
|
146
|
+
|
|
147
|
+
KUI builds validate object subkeys, resolve resource nine-slice defaults, and
|
|
148
|
+
watch the manifest during development. See
|
|
149
|
+
[the resource-default contract](../../ui-document/docs/resource-nine-slice.md)
|
|
150
|
+
for conversion and compilation boundaries.
|
|
151
|
+
|
|
152
|
+
## Label text compilation in 3.1.0
|
|
153
|
+
|
|
154
|
+
The compiler consumes the ui-document 0.9.x catalog and emits Label `textFit`,
|
|
155
|
+
`minFontSize`, authored `size` and state-size overrides unchanged. Runtime
|
|
156
|
+
observations are not authoring inputs, and fitting never becomes a build-time
|
|
157
|
+
measurement. Rendering uses the application's UI >= 3.1.0 and Core >= 2.1.0
|
|
158
|
+
within their respective majors. Neither engine is a CLI runtime dependency.
|
|
159
|
+
See [text compilation](label-text-layout.md) and
|
|
160
|
+
[native Label text layout](../../ui/docs/label-text-layout.md) for the boundary.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# CLI architecture
|
|
2
|
+
|
|
3
|
+
`@kurot/cli` is a project-local Node.js tool. Commander owns the command layer,
|
|
4
|
+
esbuild owns TypeScript and bundle output, and ordered `BuildPlugin` instances
|
|
5
|
+
share a `BuildContext` through `core/pipeline.ts`.
|
|
6
|
+
|
|
7
|
+
## Build pipeline
|
|
8
|
+
|
|
9
|
+
`defaultPlugins()` runs these stages:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
clean output
|
|
13
|
+
→ compile KUI
|
|
14
|
+
→ compile engine packages
|
|
15
|
+
→ compile custom namespaces
|
|
16
|
+
→ write development component catalog
|
|
17
|
+
→ compile application source
|
|
18
|
+
→ generate HTML
|
|
19
|
+
→ write release manifest
|
|
20
|
+
→ copy runtime assets
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
KUI compilation runs first because skin factories can import project namespace
|
|
24
|
+
components. Namespace and engine chunks are externalized consistently so the
|
|
25
|
+
application, UI runtime, and generated skins share one class identity.
|
|
26
|
+
|
|
27
|
+
## KUI boundary
|
|
28
|
+
|
|
29
|
+
The CLI does not define a second UI document format. It parses `.kui.xml`
|
|
30
|
+
through `@kurot/ui-document`, then adapts appearance documents to the private
|
|
31
|
+
`SkinIR` used by the ESM code generator:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
KUI XML → UIDocument → SkinIR → skin factory → theme bundle
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`SkinIR` contains runtime code-generation details only: resolved imports,
|
|
38
|
+
factory variables, property assignments, semantic layout children, and state
|
|
39
|
+
property overrides. Document contracts, reusable instances, data bindings, and
|
|
40
|
+
actions remain `UIDocument` concepts.
|
|
41
|
+
|
|
42
|
+
CLI 3.1.0 consumes ui-document 0.9.x for Label text-fitting metadata. The
|
|
43
|
+
compiler emits `textFit`, `minFontSize`, base font sizes and state overrides;
|
|
44
|
+
native UI owns measurement and derives drawing sizes after layout validation.
|
|
45
|
+
See [Label compilation](label-text-layout.md). The application supplies UI
|
|
46
|
+
3.1.x and Core 2.1.x or later within their respective majors.
|
|
47
|
+
|
|
48
|
+
The authored `Skin` root supplies its generated `class` and optional state
|
|
49
|
+
names. State values live on their target nodes as `property.state`. The compiler
|
|
50
|
+
derives the theme map from built-in naming conventions and configured project
|
|
51
|
+
component pairs, and rejects duplicate conventional mappings. The generated
|
|
52
|
+
theme JSON is an output artifact, never an authored source.
|
|
53
|
+
|
|
54
|
+
## Output ownership
|
|
55
|
+
|
|
56
|
+
`BuildContext.outputs` carries generated filenames between plugins. Important
|
|
57
|
+
entries include the application entry, theme script, namespace chunks, engine
|
|
58
|
+
chunks, and `.kurot/skin-parts.d.ts`.
|
|
59
|
+
|
|
60
|
+
Development builds preserve application source module structure under
|
|
61
|
+
`bin-debug/`. Release builds create a timestamped directory under
|
|
62
|
+
`bin-release/web/`, minify bundles, add content hashes, and write
|
|
63
|
+
`manifest.json`. Static resources retain stable paths because application code
|
|
64
|
+
addresses them by key or URL.
|
|
65
|
+
|
|
66
|
+
## Development watchers
|
|
67
|
+
|
|
68
|
+
The dev server has separate rebuild paths for application source, KUI XML, and
|
|
69
|
+
convention-based reusable components. A component change can affect its source
|
|
70
|
+
namespace, paired skin, generated type declaration, and editor catalog, so that
|
|
71
|
+
path refreshes all four outputs as one operation. The server preserves the last
|
|
72
|
+
successful output after an invalid edit.
|
|
73
|
+
|
|
74
|
+
## Diagnostics
|
|
75
|
+
|
|
76
|
+
Plugins report stable diagnostics to the collector rather than throwing on the
|
|
77
|
+
first recoverable problem. Strict policy promotes supported warnings. Build
|
|
78
|
+
JSON emits one final result; dev JSONL emits lifecycle events suitable for a
|
|
79
|
+
long-running editor or agent process.
|
|
80
|
+
|
|
81
|
+
## Main source areas
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
src/core/config.ts project configuration
|
|
85
|
+
src/core/project.ts resolved project paths and namespaces
|
|
86
|
+
src/core/pipeline.ts build context and plugin runner
|
|
87
|
+
src/core/kui/ UIDocument-to-SkinIR compiler
|
|
88
|
+
src/core/components/ reusable component discovery
|
|
89
|
+
src/core/plugins/compile-kui.ts KUI scan, theme derivation, bundle output
|
|
90
|
+
src/core/plugins/ remaining ordered build stages
|
|
91
|
+
src/core/dev-server.ts file watching and static server
|
|
92
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Label text compilation
|
|
2
|
+
|
|
3
|
+
CLI 3.1.0 consumes ui-document 0.9.x and compiles KUI text-fitting properties
|
|
4
|
+
through the existing UIDocument → SkinIR → ESM factory pipeline. The semantic
|
|
5
|
+
document format remains version 2.
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
```xml
|
|
10
|
+
<Skin xmlns="https://kurot.dev/ui/1" class="skins.AmountSkin" states="down">
|
|
11
|
+
<Label id="amount" text="100.80" width="60" size="24"
|
|
12
|
+
multiline="false" textFit="shrink" minFontSize="16" size.down="20" />
|
|
13
|
+
</Skin>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The generated factory assigns the authored values:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
amount.multiline = false;
|
|
20
|
+
amount.textFit = 'shrink';
|
|
21
|
+
amount.minFontSize = 16;
|
|
22
|
+
amount.size = 24;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The down-state size becomes a native `SetProperty('amount', 'size', 20)` override.
|
|
26
|
+
The compiler does not measure fonts or change `size` based on text length,
|
|
27
|
+
currency, locale or display bounds. Source XML remains authored data; neither
|
|
28
|
+
derived sizes nor fitting diagnostics are persisted by compilation.
|
|
29
|
+
|
|
30
|
+
## Runtime boundary
|
|
31
|
+
|
|
32
|
+
- The application must install UI `^3.1.0` and Core `^2.1.0` for shrinking.
|
|
33
|
+
They remain application dependencies; CLI depends on the headless document
|
|
34
|
+
package rather than importing the engine into the build process.
|
|
35
|
+
- `textFit` is `none` by default or `shrink` for ordinary single-line Labels.
|
|
36
|
+
Put a Button's policy on its `labelDisplay` skin part.
|
|
37
|
+
- `minFontSize` defaults to 12 logical pixels and must be finite and >= 1.
|
|
38
|
+
A minimum greater than the authored size does not enlarge the text.
|
|
39
|
+
- UI keeps `size` authored and derives `renderedSize` after layout validation.
|
|
40
|
+
State removal restores the authored base size before fitting again.
|
|
41
|
+
- `renderedSize` and `textFitOverflow` are runtime observations; do not author
|
|
42
|
+
them in KUI XML.
|
|
43
|
+
- Multiline Labels keep their base size; EditableText rejects shrinking.
|
|
44
|
+
- Load fonts before measuring text. For late loading, native UI callers use
|
|
45
|
+
`label.invalidateSize()` after the font becomes ready.
|
|
46
|
+
|
|
47
|
+
UI 3.1's public Label contract owns the full fitting, overflow, layout and
|
|
48
|
+
font-readiness rules. ui-document 0.9's catalog describes the authoring fields.
|
|
49
|
+
The build does not rewrite existing skins or apply project translation rules.
|
|
50
|
+
|
|
51
|
+
## Migration
|
|
52
|
+
|
|
53
|
+
In Core 2.1.0, explicit `multiline="false"` means one unwrapped first line.
|
|
54
|
+
Remove that flag or set it to true where wrapping is intended. The literal-string
|
|
55
|
+
XML contract is retained: a backslash followed by `n` stays literal text rather
|
|
56
|
+
than becoming a hard separator.
|
|
57
|
+
|
|
58
|
+
Existing EXML projects remain on CLI 1.3.x. The KUI release does not introduce
|
|
59
|
+
an EXML migration or resource-format change.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kurot/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Kurot CLI - build tool for Kurot Editor KUI XML workflows",
|
|
5
5
|
"author": "Kelvin <kyia.x52@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
+
"docs/**/*",
|
|
15
16
|
"templates",
|
|
16
17
|
"README.md",
|
|
17
18
|
"CHANGELOG.md",
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"kurot": "tsx src/index.ts"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@kurot/ui-document": "^0.
|
|
31
|
+
"@kurot/ui-document": "^0.9.0",
|
|
31
32
|
"commander": "^13.0.0",
|
|
32
33
|
"esbuild": "^0.25.0"
|
|
33
34
|
},
|