@kurot/ui 3.2.0 → 3.3.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 CHANGED
@@ -4,6 +4,40 @@ All notable changes to `@kurot/ui` are documented here.
4
4
 
5
5
  ---
6
6
 
7
+ ## [3.3.0] — 2026-10-08
8
+
9
+ ### Added
10
+
11
+ - Export RichLabel as an independent Component wrapping one native TextField.
12
+ Its only content interface is textFlow; ordinary Label text, appearance fields,
13
+ fitting and style presets are not exposed. Per-run styling stays in the flow.
14
+ - Support continuous Unicode wrapping across runs, hard breaks, automatic bounds,
15
+ parent width constraints, maximum width, line spacing and alignment.
16
+ - Copy assigned/read runs and styles, notify textFlow bindings, clear with [],
17
+ cache unchanged measurements and invalidate metrics after late font readiness.
18
+
19
+ ### Fixed
20
+
21
+ - Apply BitmapLabel.maxWidth when measuring automatic bounds without an explicit
22
+ or parent-supplied width, keeping wrapped height consistent with rendering.
23
+ - Remeasure BitmapLabel and RichLabel automatic height after an authored width
24
+ changes, including after the component has already completed layout.
25
+
26
+ ### Dependencies and migration
27
+
28
+ - Require Core ^2.3.0 for independent rich-text measurement. UI development
29
+ dependencies and the lockfile resolve published Core 2.3.1 without local
30
+ overrides; the compatible patch does not raise the peer minimum.
31
+ - Native code and programmatic skins can use both text components. KUI catalogs,
32
+ CLI compilation, ui-runtime materialization and Editor authoring are separate
33
+ follow-up work; this release does not migrate projects or edit those packages.
34
+
35
+ ### Verification
36
+
37
+ - Cover content ownership, binding, measurement, layout, late font readiness and
38
+ per-run Canvas styling. Add minified Canvas 2D, WebGL 1 and WebGL 2 browser tests
39
+ for rich text and bitmap labels, including width changes and clearing content.
40
+
7
41
  ## [3.2.0] — 2026-10-08
8
42
 
9
43
  ### Added
package/README.md CHANGED
@@ -2,10 +2,35 @@
2
2
 
3
3
  UI component framework for [@kurot/core](https://github.com/kurot-engine/kurot/tree/main/packages/core). Migrated from Egret EUI, rewritten in modern TypeScript with clean class inheritance — no namespace hacks, no prototype manipulation.
4
4
 
5
- > **Package version: 3.2.0.** Requires `@kurot/core@^2.2.0`. Targets ES2022 + evergreen browsers, same as core.
5
+ > **Package version: 3.3.0.** Requires `@kurot/core@^2.3.0`. Targets ES2022 + evergreen browsers, same as core.
6
6
 
7
7
  For the full list of changes in this release, see [CHANGELOG.md](./CHANGELOG.md).
8
8
 
9
+ ## RichLabel in 3.3.0
10
+
11
+ ```ts
12
+ import { RichLabel } from '@kurot/ui';
13
+
14
+ const message = new RichLabel([
15
+ { text: 'Important: ', style: { size: 20, bold: true, textColor: 0xff9900 } },
16
+ { text: 'all runs wrap together.', style: { size: 20, italic: true } },
17
+ ]);
18
+ message.maxWidth = 240;
19
+ group.addChild(message);
20
+ ```
21
+
22
+ RichLabel extends Component independently. Its content interface is `textFlow`,
23
+ with no whole-component Label text, color, font, fitting or preset properties.
24
+ It supports multiline layout, automatic bounds, parent constraints and alignment.
25
+ Assigned/read runs and styles are copied; reassign an edited snapshot to update.
26
+ See [RichLabel](docs/rich-label.md) for defaults, measurement and font readiness.
27
+ BitmapLabel now also honors maxWidth during automatic measurement. Both text
28
+ components remeasure automatic height when an authored width changes.
29
+
30
+ UI 3.3.0 builds and tests against published Core 2.3.1 without local overrides.
31
+ These native APIs do
32
+ not add KUI tags or an Editor rich-text authoring interface by themselves.
33
+
9
34
  ## Label text fitting in 3.1.0
10
35
 
11
36
  Single-line Labels can shrink their drawing size to fit the available region:
@@ -42,13 +67,13 @@ only on Core.
42
67
  ## Installation
43
68
 
44
69
  ```bash
45
- pnpm add @kurot/ui@^3.2.0 @kurot/core@^2.2.0
70
+ pnpm add @kurot/ui@^3.3.0 @kurot/core@^2.3.0
46
71
  ```
47
72
 
48
73
  `@kurot/ui` declares `@kurot/core` as a peer dependency. Install both packages explicitly so the application controls the resolved core version.
49
74
 
50
- UI 3.2 requires Core 2.2.0 or later within Core 2.x for BitmapText rendering and
51
- font resources. Core installs its published bitmap-font dependency automatically.
75
+ UI 3.3 requires Core 2.3.0 or later within Core 2.x for independent rich-text
76
+ measurement as well as BitmapText rendering and font resources. Core installs its published bitmap-font dependency automatically.
52
77
  Refresh older Core/UI lockfiles and old sheet manifests with
53
78
  string-valued `subkeys` in Kurot Editor before launching the application.
54
79
  See the [resource migration guide](../ui-document/docs/resource-nine-slice.md).
@@ -151,7 +176,11 @@ class MyButtonSkin extends Skin {
151
176
  this.bg = new Rect(120, 36, 0x6c5ce7);
152
177
  this.skinParts = ['bg'];
153
178
  this.elementsContent = [this.bg];
154
- this.states = [new State('up'), new State('down', [new SetProperty('bg', 'fillColor', 0x5a4bd1)]), new State('disabled', [new SetProperty('bg', 'fillColor', 0x636e72)])];
179
+ this.states = [
180
+ new State('up'),
181
+ new State('down', [new SetProperty('bg', 'fillColor', 0x5a4bd1)]),
182
+ new State('disabled', [new SetProperty('bg', 'fillColor', 0x636e72)]),
183
+ ];
155
184
  }
156
185
  }
157
186
 
@@ -225,6 +254,7 @@ dynamic properties; use `this.skinParts.<name>` during the ready lifecycle.
225
254
  | Component | Description |
226
255
  | -------------- | ------------------------------------------------------------------------------- |
227
256
  | `Label` | Text display. Wraps `TextField` in the UI lifecycle. |
257
+ | `RichLabel` | Styled runs in one continuous TextField layout; independent textFlow content. |
228
258
  | `BitmapLabel` | Bitmap-font display. Wraps BitmapText with font resources, layout and bindings. |
229
259
  | `Button` | Tappable button with `up`/`down`/`disabled` states and `labelDisplay` part. |
230
260
  | `CheckBox` | Toggle button. Dispatches `Event.CHANGE` on selection change. |
@@ -373,7 +403,10 @@ class StatefulButtonSkin extends Skin {
373
403
  this.states = [
374
404
  new State('up'),
375
405
  new State('down', [new SetProperty('bg', 'fillColor', 0x5a4bd1)]),
376
- new State('disabled', [new SetProperty('bg', 'fillColor', 0x636e72), new SetProperty('labelDisplay', 'textColor', 0xb2bec3)]),
406
+ new State('disabled', [
407
+ new SetProperty('bg', 'fillColor', 0x636e72),
408
+ new SetProperty('labelDisplay', 'textColor', 0xb2bec3),
409
+ ]),
377
410
  ];
378
411
  }
379
412
  }
@@ -13,6 +13,8 @@ export declare class BitmapLabel extends Component implements IDisplayText {
13
13
  private _fontRequest;
14
14
  private _widthConstraint;
15
15
  constructor(text?: string);
16
+ get width(): number;
17
+ set width(value: number);
16
18
  get text(): string;
17
19
  set text(value: string);
18
20
  get font(): string | BitmapFont | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BitmapLabel.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/BitmapLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6C,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;;;GAIG;AACH,qBAAa,WAAY,SAAQ,SAAU,YAAW,YAAY;IAEjE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoB;IAChD,OAAO,CAAC,KAAK,CAAC,CAAsB;IACpC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,gBAAgB,CAAO;gBAGZ,IAAI,SAAK;IAO5B,IAAW,IAAI,IAAI,MAAM,CAExB;IACD,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,EAK5B;IACD,IAAW,IAAI,IAAI,MAAM,GAAG,UAAU,GAAG,SAAS,CAEjD;IACD,IAAW,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,EAQrD;IACD,IAAW,SAAS,IAAI,MAAM,GAAG,QAAQ,GAAG,OAAO,CAElD;IACD,IAAW,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,EAItD;IACD,IAAW,aAAa,IAAI,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAEtD;IACD,IAAW,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,EAI1D;IAC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O,CAAC,eAAe;IAIvB,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,YAAY;CA0BpB"}
@@ -20,6 +20,16 @@ export class BitmapLabel extends Component {
20
20
  this.text = text;
21
21
  }
22
22
  // ── Getters / Setters ─────────────────────────────────────────────────────
23
+ get width() {
24
+ return super.width;
25
+ }
26
+ set width(value) {
27
+ if (Object.is(this.$explicitWidth, value))
28
+ return;
29
+ super.width = value;
30
+ // Component width changes alone do not invalidate automatic text height.
31
+ this._invalidateText();
32
+ }
23
33
  get text() {
24
34
  return this._bitmapText.text;
25
35
  }
@@ -141,7 +151,13 @@ export class BitmapLabel extends Component {
141
151
  this.invalidateDisplayList();
142
152
  }
143
153
  _measureText() {
144
- const width = Number.isFinite(this._widthConstraint) ? this._widthConstraint : this.$explicitWidth;
154
+ const width = Number.isFinite(this._widthConstraint)
155
+ ? this._widthConstraint
156
+ : Number.isFinite(this.$explicitWidth)
157
+ ? this.$explicitWidth
158
+ : this.maxWidth !== 100000
159
+ ? this.maxWidth
160
+ : NaN;
145
161
  const layout = this._bitmapText.measureText(width);
146
162
  return { width: layout.width, height: layout.height };
147
163
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BitmapLabel.js","sourceRoot":"","sources":["../../../src/kurot/components/BitmapLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,OAAO,WAAY,SAAQ,SAAS;IACzC,4EAA4E;IAC3D,WAAW,GAAG,IAAI,UAAU,EAAE,CAAC;IACxC,KAAK,CAAuB;IAC5B,YAAY,GAAG,KAAK,CAAC;IACrB,YAAY,GAAG,CAAC,CAAC;IACjB,gBAAgB,GAAG,GAAG,CAAC;IA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K,GAAG,CAAC,IAAa,EAAQ,EAAE;YACrC,IAAI,OAAO,KAAK,IAAI,CAAC,YAAY;gBAAE,OAAO;YAC1C,IAAI,CAAC,CAAC,IAAI,YAAY,UAAU,CAAC;gBAAE,MAAM,IAAI,SAAS,CAAC,YAAY,IAAI,wBAAwB,CAAC,CAAC;YACjG,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC;QACF,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,CAAC,KAAc,EAAQ,EAAE;YACvC,IAAI,OAAO,KAAK,IAAI,CAAC,YAAY;gBAAE,OAAO;YAC1C,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/E,CAAC,CAAC;QACF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,IAAI,CAAC;gBACJ,KAAK,CAAC,MAAM,CAAC,CAAC;YACf,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,MAAM,CAAC,KAAK,CAAC,CAAC;YACf,CAAC;YACD,OAAO;QACR,CAAC;QACD,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;CACD"}
@@ -0,0 +1,51 @@
1
+ import type { ITextElement } from '@kurot/core';
2
+ import { Component } from './Component.js';
3
+ /**
4
+ * Displays styled text runs in one continuous layout. Content is assigned only
5
+ * through textFlow; ordinary Label text and appearance presets are not exposed.
6
+ * Unspecified run styles use the TextField defaults captured at construction.
7
+ */
8
+ export declare class RichLabel extends Component {
9
+ private readonly _textField;
10
+ private _widthConstraint;
11
+ private _measurement?;
12
+ private _measurementWidth;
13
+ constructor(textFlow?: readonly ITextElement[]);
14
+ get width(): number;
15
+ set width(value: number);
16
+ /**
17
+ * Assignment and reads copy the runs and their styles. Reassign an edited
18
+ * snapshot to update the component; [] clears all content.
19
+ */
20
+ get textFlow(): ITextElement[];
21
+ set textFlow(value: readonly ITextElement[]);
22
+ get multiline(): boolean;
23
+ set multiline(value: boolean);
24
+ /**
25
+ * True uses Unicode line-break opportunities; false wraps by graphemes.
26
+ * Explicit multiline=false displays only the first unwrapped hard line.
27
+ */
28
+ get wordWrap(): boolean;
29
+ set wordWrap(value: boolean);
30
+ get lineSpacing(): number;
31
+ set lineSpacing(value: number);
32
+ get textAlign(): 'left' | 'center' | 'right';
33
+ set textAlign(value: 'left' | 'center' | 'right');
34
+ get verticalAlign(): 'top' | 'middle' | 'bottom';
35
+ set verticalAlign(value: 'top' | 'middle' | 'bottom');
36
+ /**
37
+ * Complete content metrics under the current width constraint, before
38
+ * height clipping. Empty content has zero width and height.
39
+ */
40
+ get textWidth(): number;
41
+ get textHeight(): number;
42
+ invalidateSize(): void;
43
+ createChildren(): void;
44
+ measure(): void;
45
+ setLayoutBoundsSize(layoutWidth: number, layoutHeight: number): void;
46
+ updateDisplayList(unscaledWidth: number, unscaledHeight: number): void;
47
+ private _copyTextFlow;
48
+ private _invalidateText;
49
+ private _measureText;
50
+ }
51
+ //# sourceMappingURL=RichLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichLabel.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/RichLabel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,YAAY,EAAiB,MAAM,aAAa,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,SAAS;IAGvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA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OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,YAAY;CAgBpB"}
@@ -0,0 +1,172 @@
1
+ import { TextField } from '@kurot/core';
2
+ import { Component } from './Component.js';
3
+ import { PropertyEvent } from '../events/PropertyEvent.js';
4
+ /**
5
+ * Displays styled text runs in one continuous layout. Content is assigned only
6
+ * through textFlow; ordinary Label text and appearance presets are not exposed.
7
+ * Unspecified run styles use the TextField defaults captured at construction.
8
+ */
9
+ export class RichLabel extends Component {
10
+ // ── Instance fields ───────────────────────────────────────────────────────
11
+ _textField = new TextField();
12
+ _widthConstraint = NaN;
13
+ _measurement;
14
+ _measurementWidth = NaN;
15
+ // ── Constructor ───────────────────────────────────────────────────────────
16
+ constructor(textFlow = []) {
17
+ super();
18
+ this.touchChildren = false;
19
+ this._textField.wordWrap = true;
20
+ this.textFlow = textFlow;
21
+ }
22
+ // ── Getters / Setters ──────────────────────────────────────────────────────
23
+ get width() {
24
+ return super.width;
25
+ }
26
+ set width(value) {
27
+ if (Object.is(this.$explicitWidth, value))
28
+ return;
29
+ super.width = value;
30
+ // Component width changes alone do not invalidate automatic text height.
31
+ this._invalidateText();
32
+ }
33
+ /**
34
+ * Assignment and reads copy the runs and their styles. Reassign an edited
35
+ * snapshot to update the component; [] clears all content.
36
+ */
37
+ get textFlow() {
38
+ return this._copyTextFlow(this._textField.textFlow ?? []);
39
+ }
40
+ set textFlow(value) {
41
+ this._textField.textFlow = this._copyTextFlow(value);
42
+ this.invalidateSize();
43
+ this.invalidateDisplayList();
44
+ PropertyEvent.dispatchPropertyEvent(this, 'textFlow');
45
+ }
46
+ get multiline() {
47
+ return this._textField.multiline;
48
+ }
49
+ set multiline(value) {
50
+ if (this.multiline === value)
51
+ return;
52
+ this._textField.multiline = value;
53
+ this._invalidateText();
54
+ }
55
+ /**
56
+ * True uses Unicode line-break opportunities; false wraps by graphemes.
57
+ * Explicit multiline=false displays only the first unwrapped hard line.
58
+ */
59
+ get wordWrap() {
60
+ return this._textField.wordWrap;
61
+ }
62
+ set wordWrap(value) {
63
+ if (this.wordWrap === value)
64
+ return;
65
+ this._textField.wordWrap = value;
66
+ this._invalidateText();
67
+ }
68
+ get lineSpacing() {
69
+ return this._textField.lineSpacing;
70
+ }
71
+ set lineSpacing(value) {
72
+ if (!Number.isFinite(value) || value < 0) {
73
+ throw new RangeError('RichLabel.lineSpacing must be finite and nonnegative.');
74
+ }
75
+ if (this.lineSpacing === value)
76
+ return;
77
+ this._textField.lineSpacing = value;
78
+ this._invalidateText();
79
+ }
80
+ get textAlign() {
81
+ return this._textField.textAlign;
82
+ }
83
+ set textAlign(value) {
84
+ if (this.textAlign === value)
85
+ return;
86
+ if (!['left', 'center', 'right'].includes(value)) {
87
+ throw new RangeError('Invalid rich text alignment.');
88
+ }
89
+ this._textField.textAlign = value;
90
+ this.invalidateDisplayList();
91
+ }
92
+ get verticalAlign() {
93
+ return this._textField.verticalAlign;
94
+ }
95
+ set verticalAlign(value) {
96
+ if (this.verticalAlign === value)
97
+ return;
98
+ if (!['top', 'middle', 'bottom'].includes(value)) {
99
+ throw new RangeError('Invalid rich text vertical alignment.');
100
+ }
101
+ this._textField.verticalAlign = value;
102
+ this.invalidateDisplayList();
103
+ }
104
+ /**
105
+ * Complete content metrics under the current width constraint, before
106
+ * height clipping. Empty content has zero width and height.
107
+ */
108
+ get textWidth() {
109
+ return this._measureText().width;
110
+ }
111
+ get textHeight() {
112
+ return this._measureText().height;
113
+ }
114
+ // ── Override methods ──────────────────────────────────────────────────────
115
+ invalidateSize() {
116
+ // A late font load can change metrics without changing the authored runs.
117
+ this._measurement = undefined;
118
+ this._textField?.invalidateTextMetrics();
119
+ super.invalidateSize();
120
+ }
121
+ createChildren() {
122
+ super.createChildren();
123
+ this.addChild(this._textField);
124
+ }
125
+ measure() {
126
+ const measured = this._measureText();
127
+ this.setMeasuredSize(measured.width, measured.height);
128
+ }
129
+ setLayoutBoundsSize(layoutWidth, layoutHeight) {
130
+ super.setLayoutBoundsSize(layoutWidth, layoutHeight);
131
+ const width = Number.isFinite(layoutWidth) ? this.width : NaN;
132
+ if (Object.is(this._widthConstraint, width))
133
+ return;
134
+ this._widthConstraint = width;
135
+ this._invalidateText();
136
+ }
137
+ updateDisplayList(unscaledWidth, unscaledHeight) {
138
+ super.updateDisplayList(unscaledWidth, unscaledHeight);
139
+ this._textField.width = unscaledWidth;
140
+ this._textField.height = unscaledHeight;
141
+ }
142
+ // ── Private methods ───────────────────────────────────────────────────────
143
+ _copyTextFlow(value) {
144
+ return value.map(element => {
145
+ if (typeof element.text !== 'string') {
146
+ throw new TypeError('RichLabel text runs must contain string text.');
147
+ }
148
+ return element.style ? { text: element.text, style: { ...element.style } } : { text: element.text };
149
+ });
150
+ }
151
+ _invalidateText() {
152
+ this.invalidateSize();
153
+ this.invalidateDisplayList();
154
+ }
155
+ _measureText() {
156
+ if (!this._textField.text)
157
+ return { width: 0, height: 0 };
158
+ const width = Number.isFinite(this._widthConstraint)
159
+ ? this._widthConstraint
160
+ : Number.isFinite(this.$explicitWidth)
161
+ ? this.$explicitWidth
162
+ : this.maxWidth !== 100000
163
+ ? this.maxWidth
164
+ : NaN;
165
+ if (!this._measurement || !Object.is(this._measurementWidth, width)) {
166
+ this._measurement = this._textField.measureText(width);
167
+ this._measurementWidth = width;
168
+ }
169
+ return this._measurement;
170
+ }
171
+ }
172
+ //# sourceMappingURL=RichLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichLabel.js","sourceRoot":"","sources":["../../../src/kurot/components/RichLabel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACvC,6EAA6E;IAE5D,UAAU,GAAG,IAAI,SAAS,EAAE,CAAC;IACtC,gBAAgB,GAAG,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B;YACvB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC;gBACrC,CAAC,CAAC,IAAI,CAAC,cAAc;gBACrB,CAAC,CAAC,IAAI,CAAC,QAAQ,KAAK,MAAM;oBACzB,CAAC,CAAC,IAAI,CAAC,QAAQ;oBACf,CAAC,CAAC,GAAG,CAAC;QACT,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;YACrE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACvD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD"}
@@ -32,4 +32,5 @@ export { EditableText } from './EditableText.js';
32
32
  export { TextInput } from './TextInput.js';
33
33
  export { ComboBox } from './ComboBox.js';
34
34
  export { BitmapLabel } from './BitmapLabel.js';
35
+ export { RichLabel } from './RichLabel.js';
35
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MA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E,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -32,4 +32,5 @@ export { EditableText } from './EditableText.js';
32
32
  export { TextInput } from './TextInput.js';
33
33
  export { ComboBox } from './ComboBox.js';
34
34
  export { BitmapLabel } from './BitmapLabel.js';
35
+ export { RichLabel } from './RichLabel.js';
35
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/kurot/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA6D,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,KAAK,EAAo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AAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
@@ -6,11 +6,12 @@ each session. Treat the package source and its `src/index.ts` barrel as the
6
6
  authority for current behavior and exports; this file provides the compressed
7
7
  map, runtime contracts and task→file lookup.
8
8
 
9
- Package identity: `@kurot/ui@3.2.0`, EUI-compatible UI framework on top of
10
- `@kurot/core`. Peer-depends on `@kurot/core@^2.2.0`. Rewritten with standard class
9
+ Package identity: `@kurot/ui@3.3.0`, EUI-compatible UI framework on top of
10
+ `@kurot/core`. Peer-depends on `@kurot/core@^2.3.0`. Rewritten with standard class
11
11
  inheritance and delegation — no namespace mixins, no prototype copying.
12
- Version 3.2.0 is prepared for publication against published Core 2.2.0;
13
- source metadata alone does not confirm UI publication.
12
+ Version 3.3.0 adds RichLabel and tests against published Core 2.3.1 through its
13
+ development installation and lockfile, without overrides. Version 3.2.0 is published with BitmapLabel against published Core 2.2.0,
14
+ without local dependency overrides. Published UI 3.1.0 does not contain BitmapLabel.
14
15
 
15
16
  Source root: `src/kurot/`. Public API: `src/index.ts` is a flat re-export of
16
17
  7 barrels — `core`, `layouts`, `components`, `events`, `states`, `collections`,
@@ -26,7 +27,7 @@ src/kurot/
26
27
  │ Validator/validator (render-preparation validation scheduler),
27
28
  │ Theme/getTheme()/setTheme(), IViewport, IAssetAdapter/IThemeAdapter.
28
29
  ├── components/ Group, Component (delegation core — see §2), Skin, and
29
- │ concrete widgets: Button, Label, BitmapLabel, CheckBox, RadioButton,
30
+ │ concrete widgets: Button, Label, BitmapLabel, RichLabel, CheckBox, RadioButton,
30
31
  │ ToggleButton/ToggleSwitch, ProgressBar, HSlider/VSlider,
31
32
  │ Rect, Image, EditableText, TextInput, Panel, ViewStack,
32
33
  │ Scroller, UILayer, DataGroup, List, TabBar, ComboBox,
@@ -143,7 +144,7 @@ Flat re-export of 7 barrels, in this order: `core`, `layouts`, `components`,
143
144
 
144
145
  - **core**: `IUIComponent`, `IUIOwner`, `UIState`, `isUIComponent`, `Validator`/`validator`, `Theme`/`getTheme`/`setTheme`, `IViewport`, `IAssetAdapter`/`DefaultAssetAdapter`, `setAssetAdapter`/`getAssetAdapter`, `IThemeAdapter`/`DefaultThemeAdapter`, `Direction`, `ScrollPolicy`, `IDisplayText`, `IItemRenderer`.
145
146
  - **layouts**: `ILayoutTarget`, `LayoutBase`, `BasicLayout`, `LinearLayoutBase`, `VerticalLayout`, `HorizontalLayout`, `TileLayout`, `ColumnAlign`, `RowAlign`, `JustifyAlign`, `TileOrientation`.
146
- - **components**: `Group`/`GroupEvents`, `Component`/`ComponentEvents`, `Skin`/`SkinEvents`; `Button`, `Label`/`TextFitMode` (type), `BitmapLabel`, `CheckBox`, `RadioButton`/`RadioButtonGroup`, `ToggleButton`, `ToggleSwitch`, `ProgressBar`, `HSlider`/`VSlider`/`SliderBase`, `Rect`, `Image`, `EditableText`, `TextInput`, `Panel`, `ViewStack`, `Scroller`, `TouchScroll`, `UILayer`, `DataGroup`, `List`/`ListBase`, `TabBar`, `ComboBox`, `ItemRenderer`, `HScrollBar`/`VScrollBar`/`ScrollBarBase`, `Animation`, `Range`.
147
+ - **components**: `Group`/`GroupEvents`, `Component`/`ComponentEvents`, `Skin`/`SkinEvents`; `Button`, `Label`/`TextFitMode` (type), `BitmapLabel`, `RichLabel`, `CheckBox`, `RadioButton`/`RadioButtonGroup`, `ToggleButton`, `ToggleSwitch`, `ProgressBar`, `HSlider`/`VSlider`/`SliderBase`, `Rect`, `Image`, `EditableText`, `TextInput`, `Panel`, `ViewStack`, `Scroller`, `TouchScroll`, `UILayer`, `DataGroup`, `List`/`ListBase`, `TabBar`, `ComboBox`, `ItemRenderer`, `HScrollBar`/`VScrollBar`/`ScrollBarBase`, `Animation`, `Range`.
147
148
  - **events**: `UIEvent`, `ItemTapEvent`, `CollectionEvent`/`CollectionEventKind`, `PropertyEvent`, `ScrollerThrowEvent`.
148
149
  - **states**: `State`, `IOverride`, `SetProperty`, `SetStateProperty`, `AddItems`.
149
150
  - **collections**: `ICollection`, `ArrayCollection`.
@@ -206,7 +207,7 @@ automatic bounds are not fed back as fit constraints.
206
207
 
207
208
  `label.invalidateSize()` also invalidates Core line metrics. Call it after
208
209
  late font loading, even if the family name did not change. This requires
209
- Core >= 2.1.0 for that API; UI 3.2.0's package requirement is Core ^2.2.0.
210
+ Core >= 2.1.0 for that API; UI 3.3.0's package requirement is Core ^2.3.0.
210
211
  There is no global font-readiness listener.
211
212
 
212
213
  See [Label text layout](label-text-layout.md) for fit bounds, state restoration,
@@ -222,3 +223,18 @@ using one BitmapText child and the configured Core resource singleton for string
222
223
  font names. Stale async results are guarded by request generation. Core ^2.2.0
223
224
  is required; local Core overrides have been removed. Published UI 3.1.0 does
224
225
  not contain it. KUI catalog, installed compilers and Editor adoption are separate.
226
+
227
+ ## Rich labels in 3.3.0
228
+
229
+ [rich-label.md](rich-label.md) defines RichLabel, an independent Component using
230
+ one native TextField. Only textFlow supplies content; no Label text/appearance
231
+ properties, textFit or textStyle. Reads and assignments copy runs and styles;
232
+ [] clears content. Wrapping is continuous across styles. Measurement uses Core
233
+ 2.3.0's pure measureText with parent width, explicit width or maxWidth; cached
234
+ metrics clear on invalidateSize, including after fonts load. Geometry, multiline,
235
+ wordWrap, lineSpacing, textAlign and verticalAlign remain component-level.
236
+
237
+ Task → `components/RichLabel.ts`, `test/RichLabel.test.ts`,
238
+ `test/browser/text-labels.spec.ts`. Run `pnpm test:text-labels` after building
239
+ Core and UI. BitmapLabel automatic measurement now uses maxWidth too. The KUI
240
+ catalog, CLI and Editor must adopt these native components in a later phase.
@@ -1,12 +1,13 @@
1
1
  # @kurot/ui architecture
2
2
 
3
- > Package version: 3.2.0, with peerDependency `@kurot/core: ^2.2.0`.
4
- > This release is prepared against published Core 2.2.0; UI publication is not yet confirmed.
3
+ > Package version: 3.3.0, with peerDependency `@kurot/core: ^2.3.0`.
4
+ > Core 2.3.1 is published and installed from npm without local overrides.
5
5
  > See [CHANGELOG.md](../CHANGELOG.md) for release-by-release changes.
6
6
  > The [AI context map](./ai-context.md) provides directory, behavior, terminology
7
7
  > and task-to-file references. This document explains design decisions and internal
8
8
  > mechanisms for human readers; the two documents complement each other.
9
- > Version 3.2.0 exports BitmapLabel for native code and programmatic skins.
9
+ > Version 3.3.0 also exports independent [RichLabel](./rich-label.md).
10
+ > Version 3.2.0 introduced BitmapLabel for native code and programmatic skins.
10
11
  > See [bitmap-label.md](./bitmap-label.md) for its resource and ownership contract.
11
12
 
12
13
  ---
@@ -371,6 +372,7 @@ including intermediate base classes.
371
372
  | `Image` | Displays bitmap data resolved through IAssetAdapter |
372
373
  | `Label` | Text display wrapping one TextField |
373
374
  | `BitmapLabel` | Bitmap-font label wrapping one BitmapText; requires Core 2.2.0 or later |
375
+ | `RichLabel` | Independent Component with textFlow content and pure, cached TextField measurement |
374
376
  | `EditableText extends Label` | Editable text with prompt support |
375
377
  | `Button` | Clickable up/down/disabled states; toggle enables automatic selected changes |
376
378
  | `ToggleButton extends Button` | Defaults toggle to true and toggles selection on click |
@@ -449,7 +451,7 @@ file and case counts.
449
451
  | Skins and states | Skin, SkinAlignment (real CLI template skins), SkinMeasurement, AddItems |
450
452
  | Data binding | Binding, Watcher |
451
453
  | Collections and data-driven components | ArrayCollection, DataGroup, ListBase, ItemRenderer, ComboBox, TabBar, ViewStack |
452
- | Individual components | RadioButton, Range, Slider, ProgressBar, Scroller, Label, BitmapLabel, TextInput |
454
+ | Individual components | RadioButton, Range, Slider, ProgressBar, Scroller, Label, BitmapLabel, RichLabel, TextInput |
453
455
  | Text fitting | ButtonLabelTextFit, LabelTextFit, LabelTextFitBounds |
454
456
  | Cross-component behavior | Enabled (EUI-aligned enabled/touchEnabled/touchChildren behavior), EventMapOverride, GestureLifecycle, TransformLayout, ScrollAndVirtualLayout |
455
457
 
@@ -465,3 +467,10 @@ static UI, 240-node transform/alpha animation and a virtual list with 10,000 rec
465
467
  It records frame/render time, draw calls, validation-phase calls and ItemRenderer
466
468
  creation/reuse. It is a regression baseline for this UI implementation, rather
467
469
  than a ranking across UI frameworks.
470
+
471
+ ### Text component browser validation
472
+
473
+ Build Core and UI, then run `pnpm test:text-labels` from this package. The fixture
474
+ bundles built ESM with minification and keepNames=false, verifies actual pixels
475
+ through Canvas 2D, WebGL 1 and WebGL 2, and checks automatic bounds, edits and
476
+ empty content. Browser screenshots go to ignored test-results, not the package.
@@ -1,10 +1,16 @@
1
1
  # BitmapLabel
2
2
 
3
3
  Available in UI 3.2.0 with `@kurot/core ^2.2.0`. Core resolves its published
4
- @kurot/bitmap-font dependency from npm. UI 3.2.0 is prepared for publication;
4
+ @kurot/bitmap-font dependency from npm. UI 3.2.0 is published;
5
5
  published UI 3.1.0 does not contain this component. Core 2.1.1 does not contain
6
6
  its required BitmapText rendering.
7
7
 
8
+ UI 3.3.0 retains this API and raises the package's Core minimum to ^2.3.0 for
9
+ RichLabel. During automatic sizing it also uses maxWidth when neither a parent
10
+ width nor an explicit width is present, so wrapped height matches rendering.
11
+ Changing an authored width also invalidates automatic height after layout.
12
+ UI 3.3.0 builds and tests against published Core 2.3.1 without local overrides.
13
+
8
14
  ```ts
9
15
  import { BitmapLabel } from '@kurot/ui';
10
16
 
@@ -0,0 +1,77 @@
1
+ # RichLabel
2
+
3
+ Native API introduced in UI 3.3.0, requiring Core ^2.3.0. Core 2.3.1 is
4
+ published and installed from npm for this release's build and verification.
5
+
6
+ ```ts
7
+ import { RichLabel } from '@kurot/ui';
8
+
9
+ const label = new RichLabel([
10
+ { text: 'Warning: ', style: { size: 20, bold: true, textColor: 0xff9900 } },
11
+ { text: 'read this before continuing.', style: { size: 20, italic: true } },
12
+ ]);
13
+ label.maxWidth = 240;
14
+ group.addChild(label);
15
+ ```
16
+
17
+ ## Content and ownership
18
+
19
+ RichLabel extends Component independently, not Label. Its only content interface
20
+ is `textFlow: ITextElement[]`, using Core's text/style records. Whole-component
21
+ `text`, `fontFamily`, `size`, `bold`, `italic`, `textColor`, `textFit`, `minFontSize`
22
+ and `textStyle` are not exposed. Label presets do not apply to this component.
23
+
24
+ Runs can specify font family, size, bold, italic, text color, stroke color and
25
+ stroke width. Unspecified fields use the native TextField defaults captured at
26
+ construction. In particular, an unstyled run does not inherit the previous run.
27
+ All runs are laid out continuously; a style boundary does not introduce a word
28
+ boundary or a new line. No HTML or markdown parsing is performed.
29
+
30
+ The component copies runs and their styles on assignment and on reads. Mutating
31
+ an input array or a returned snapshot does not change the component. Reassign
32
+ an edited snapshot to apply it. Assigning [] clears content; assignment dispatches
33
+ PropertyEvent.PROPERTY_CHANGE for `textFlow` after the new content is installed.
34
+
35
+ ## Layout
36
+
37
+ Ordinary Component geometry, layout constraints, visibility and alpha remain
38
+ available, together with these text-layout properties:
39
+
40
+ | Property | Default | Contract |
41
+ | ---------------------- | --------- | ------------------------------------------------------------------------- |
42
+ | multiline | true | False shows the first hard-separated line without width wrapping. |
43
+ | wordWrap | true | Unicode line-break opportunities; false wraps between graphemes. |
44
+ | lineSpacing | 0 | Finite, nonnegative distance between lines. |
45
+ | textAlign | left | left, center or right. |
46
+ | verticalAlign | top | top, middle or bottom. |
47
+ | textWidth / textHeight | Read-only | Complete content metrics under the current width, before height clipping. |
48
+
49
+ Measurement uses parent-assigned width first, then explicit width, then a
50
+ configured maxWidth, otherwise unconstrained width. Automatic height includes
51
+ every wrapped line and inter-line spacing. Each line uses the largest font size
52
+ of its runs, rather than imposing the TextField base size. Hard line separators
53
+ and trailing blank lines follow the Core text contract. Core 2.3.1 corrects the
54
+ base size of unstyled blank runs between styled runs; the API minimum stays 2.3.0. Empty content measures
55
+ 0 × 0; Component minWidth/minHeight can still enlarge its layout bounds.
56
+
57
+ Fixed height clips drawing without discarding content. Alignment positions the
58
+ continuous text block within the assigned bounds. One native TextField renders
59
+ through Canvas 2D and WebGL; measurement never temporarily resizes that field.
60
+ Unchanged content metrics are cached until size/content invalidation or a width
61
+ change.
62
+
63
+ ## Font readiness and integration
64
+
65
+ Load project fonts before measuring where possible. If fonts become ready later,
66
+ call `label.invalidateSize()` to clear both component and native text metrics,
67
+ then allow normal layout validation. RichLabel does not load font files or
68
+ install global font-loading listeners.
69
+
70
+ This release supports native code and programmatic skins. The current
71
+ ui-document catalog, CLI KUI registry, ui-runtime materializer and Editor do not
72
+ yet provide RichLabel authoring or serialization. Their later integration must
73
+ keep textFlow ownership and the separation from ordinary Label presets.
74
+
75
+ See [Core text layout](../../core/docs/text-layout.md) for Unicode wrapping,
76
+ single-line behavior and independent measurement. Run `pnpm test:text-labels`
77
+ after building Core and UI for minified Canvas/WebGL browser verification.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kurot/ui",
3
- "version": "3.2.0",
4
- "description": "EUI-compatible UI component framework for the Kurot game engine \u2014 skin-based components, layouts, data binding, view states",
3
+ "version": "3.3.0",
4
+ "description": "EUI-compatible UI component framework for the Kurot game engine — skin-based components, layouts, data binding, view states",
5
5
  "author": "Kelvin <kyia.x52@gmail.com>",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -30,15 +30,17 @@
30
30
  "benchmark:compare": "playwright test --config examples/benchmark/playwright.config.ts",
31
31
  "benchmark:smoke": "UI_BENCHMARK_PROFILE=smoke playwright test --config examples/benchmark/playwright.config.ts",
32
32
  "build:benchmark": "vite --config vite.config.ts build",
33
- "prepublishOnly": "npm run clean && npm run build"
33
+ "prepublishOnly": "npm run clean && npm run build",
34
+ "test:text-labels": "playwright test test/browser --workers=1"
34
35
  },
35
36
  "peerDependencies": {
36
- "@kurot/core": "^2.2.0"
37
+ "@kurot/core": "^2.3.0"
37
38
  },
38
39
  "devDependencies": {
39
- "@kurot/core": "^2.2.0",
40
+ "@kurot/core": "^2.3.1",
40
41
  "@playwright/test": "1.62.1",
41
42
  "@types/node": "^22.0.0",
43
+ "esbuild": "^0.28.2",
42
44
  "happy-dom": "^20.8.9",
43
45
  "typescript": "^5.6.0",
44
46
  "vite": "^8.0.8",