@kurot/ui 2.1.4 → 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 +62 -6
- package/README.md +69 -40
- package/dist/kurot/components/Label.d.ts +40 -0
- package/dist/kurot/components/Label.d.ts.map +1 -1
- package/dist/kurot/components/Label.js +182 -32
- package/dist/kurot/components/Label.js.map +1 -1
- package/dist/kurot/components/index.d.ts +1 -1
- package/dist/kurot/components/index.d.ts.map +1 -1
- package/dist/kurot/components/index.js.map +1 -1
- package/dist/kurot/text/fit-label-text.d.ts +23 -0
- package/dist/kurot/text/fit-label-text.d.ts.map +1 -0
- package/dist/kurot/text/fit-label-text.js +36 -0
- package/dist/kurot/text/fit-label-text.js.map +1 -0
- package/docs/ai-context.md +211 -0
- package/docs/architecture.md +478 -0
- package/docs/label-text-layout.md +94 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,63 @@ All notable changes to `@kurot/ui` are documented here.
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [3.1.0] — 2026-10-05
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Single-line Label `textFit="shrink"` and `minFontSize`, with derived
|
|
12
|
+
`renderedSize` and `textFitOverflow` observations after validation.
|
|
13
|
+
- Export the `TextFitMode` type (`none` or `shrink`) from the public barrel.
|
|
14
|
+
- Fit within actual label constraints, reserve outline allowance, restore the
|
|
15
|
+
authored size for shorter text, and refresh metrics after font readiness.
|
|
16
|
+
- Include public documentation in the npm package, including the Label text
|
|
17
|
+
contract, architecture and package context.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Label defaults to multiline; explicit false means one unwrapped first line.
|
|
22
|
+
EditableText keeps its single-line default and rejects shrinking.
|
|
23
|
+
- Preserve authored size through native state apply/remove and avoid feeding
|
|
24
|
+
automatic measured dimensions back into fitting.
|
|
25
|
+
|
|
26
|
+
### Migration
|
|
27
|
+
|
|
28
|
+
- Explicit `multiline="false"` now means one unwrapped first line. Remove the
|
|
29
|
+
flag or set it to true for text intended to wrap; files are not migrated.
|
|
30
|
+
- Set fitting policy on a Button's `labelDisplay` skin part. Multiline Labels
|
|
31
|
+
retain their authored size, and EditableText rejects `textFit="shrink"`.
|
|
32
|
+
- Load fonts before measurement where possible. After a font becomes ready
|
|
33
|
+
late, call `label.invalidateSize()` to refresh fitting and Core line metrics.
|
|
34
|
+
|
|
35
|
+
### Dependencies
|
|
36
|
+
|
|
37
|
+
- Require `@kurot/core@^2.1.0` in peer and development dependencies for
|
|
38
|
+
`TextField.invalidateTextMetrics()`. Core 2.0.x is no longer sufficient.
|
|
39
|
+
- KUI authoring uses ui-document 0.9.x and matching CLI/ui-runtime releases;
|
|
40
|
+
native UI still depends only on Core.
|
|
41
|
+
|
|
42
|
+
### Tests
|
|
43
|
+
|
|
44
|
+
- Verify native Button label fitting uses the label region, preserves authored
|
|
45
|
+
sizes through disabled-state transitions, and follows active skin replacement.
|
|
46
|
+
- Cover minimum overflow, fractional sizes, outlines, hard separators, password
|
|
47
|
+
display, late font readiness, automatic dimensions and parent layout changes.
|
|
48
|
+
- Verify real regular/bold fonts and Chinese fallback with 16 browser checks
|
|
49
|
+
each on WebGL and Canvas, including Unicode wrapping and state restoration.
|
|
50
|
+
|
|
51
|
+
## [3.0.0] — 2026-10-03
|
|
52
|
+
|
|
53
|
+
### Breaking
|
|
54
|
+
|
|
55
|
+
- Require `@kurot/core@^2.0.0` in peer and development dependencies.
|
|
56
|
+
Applications must upgrade Core and convert string-valued sheet `subkeys`
|
|
57
|
+
to metadata maps by refreshing legacy sheets in Kurot Editor.
|
|
58
|
+
Component APIs and the skin lifecycle retain their existing contracts.
|
|
59
|
+
|
|
60
|
+
### Tests
|
|
61
|
+
|
|
62
|
+
- Built and ran the UI suite against the local Core 2.0.0 source.
|
|
63
|
+
|
|
7
64
|
## [2.1.4] — 2026-10-02
|
|
8
65
|
|
|
9
66
|
### Fixed
|
|
@@ -324,7 +381,6 @@ protected override onSkinRemoved(): void {
|
|
|
324
381
|
- **Button: remove dead `_autoRepeat` property** — getter/setter existed but no code consumed the value. Simplified `partAdded` to compare `partName` instead of `instance === this.labelDisplay` (eliminates non-null assertions).
|
|
325
382
|
- **ListBase: clean up `adjustSelection` and `dataProviderRefreshed`** — removed identical if/else branches and premature `PropertyEvent` dispatch (silent adjustment per egret semantics, events deferred to `commitProperties`).
|
|
326
383
|
|
|
327
|
-
|
|
328
384
|
## [1.0.6] — 2026-08-05
|
|
329
385
|
|
|
330
386
|
### Fixed
|
|
@@ -341,10 +397,10 @@ protected override onSkinRemoved(): void {
|
|
|
341
397
|
### Fixed
|
|
342
398
|
|
|
343
399
|
- **Component (`enabled` / `touchEnabled` cycle completely broken)**: Three interdependent issues in the `enabled` setter and `touchEnabled` accessor:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
400
|
+
1. **`touchEnabled` getter always returned `undefined`**. Overriding only the setter on `Component.prototype` creates a JS accessor with `get: undefined`, which shadows the inherited `DisplayObject` getter. Every read of `.touchEnabled` on any Component subclass (Button, Label, TextInput, …) silently returned `undefined` instead of the real boolean.
|
|
401
|
+
2. **`enabled = false` never disabled hit-testing**. The setter delegated to `this.touchEnabled = false`, but `Component`'s own `touchEnabled` setter contains a guard (`if (this._enabled) super.touchEnabled = value`) that skips the display-level write when the component is already disabled. The result: a disabled button still captured touches and blocked elements behind it — unlike egret, where disabled components are excluded from hit-testing.
|
|
402
|
+
3. **disable → enable permanently broke touch**. The disable path clobbered `_explicitTouchEnabled` to `false`, and the re-enable path restored `$touchEnabled` from that corrupted value — leaving every Component subclass permanently non-touchable after a single disable/enable cycle.
|
|
403
|
+
The fix matches egret's `$setEnabled`: the `enabled` setter now writes `touchEnabled` / `touchChildren` directly at the display-object level via `super.touchEnabled` / `super.touchChildren`, bypassing the guarded setters. Additionally, `touchEnabled` and `touchChildren` getters are now explicitly overridden to delegate to `super`, un-shadowing the parent accessor.
|
|
348
404
|
- **Skin factory: ES class constructors crash via `.call(this)`**: 1.0.4 fixed the EXML binding `this` context by switching from `new factory()` to `factory.call(this)`, but `call()` throws `TypeError` on genuine ES class constructors (the documented `skinName: (new () => Skin)` path). Now detects class constructors via `Function.prototype.toString()` and falls back to `new`.
|
|
349
405
|
- **Button: `selected` PropertyEvent never dispatched**: `selected` setter did not dispatch `PropertyEvent('selected')`, breaking data bindings (`{selected}`) on Buttons and ToggleButtons. Now dispatched after `_selected` is updated.
|
|
350
406
|
- **Button: redundant `touchEnabled` override after `enabled` setter fix**: The now-fixed `Component.enabled` setter handles `touchEnabled`/`touchChildren` at the display-object level. Button's own `this.touchEnabled = value` line was overwriting that with the user's new value regardless of pre-disable intent, so it has been removed.
|
|
@@ -367,7 +423,7 @@ protected override onSkinRemoved(): void {
|
|
|
367
423
|
- **Scroller (viewport orphaned on skin re-apply)**: Egret overrides `setSkin` to re-`addChildAt(viewport, 0)` after the skin (scroll bars) is applied so the viewport is never orphaned and sits beneath the bars. Kurot was missing this override; now added.
|
|
368
424
|
- **Scroller (static-object field)**: `private static readonly _vpBounds = new Rectangle()` was converted to a module-level constant, applying the same remedy as the HSlider/VSlider class-name-corruption fix from 1.0.3.
|
|
369
425
|
- **ItemRenderer (labelDisplay auto-sync)**: Added `partAdded`/`partRemoved`/`dataChanged` to auto-sync `labelDisplay.text = String(data)`, matching Egret's binding fallback. Previously the default ItemRenderer had no mechanism to push `data` into the label.
|
|
370
|
-
- **Label (_widthConstraint)**: Added `_widthConstraint` mechanism (`setLayoutBoundsSize` override + `measure` update) so that when a parent layout constrains the Label's width, the measured height correctly accounts for text wrapping. Matches Egret's Label L695-710.
|
|
426
|
+
- **Label (\_widthConstraint)**: Added `_widthConstraint` mechanism (`setLayoutBoundsSize` override + `measure` update) so that when a parent layout constrains the Label's width, the measured height correctly accounts for text wrapping. Matches Egret's Label L695-710.
|
|
371
427
|
- **Label (text PropertyEvent)**: `text` setter now dispatches `PropertyEvent('text')` for data binding.
|
|
372
428
|
- **Panel (elementsContent)**: Added missing `elementsContent` setter so that EXML-declared children of `<eui:Panel>` are added to the display list. Previously they were silently discarded because Panel (via Component) had no such setter.
|
|
373
429
|
- **Panel (drag includeInLayout)**: Dragging the moveArea now sets `includeInLayout = false` to prevent the parent layout from snapping the panel back.
|
package/README.md
CHANGED
|
@@ -2,18 +2,53 @@
|
|
|
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
|
-
> **Current release:
|
|
5
|
+
> **Current release: 3.1.0.** Requires `@kurot/core@^2.1.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
|
+
## Label text fitting in 3.1.0
|
|
10
|
+
|
|
11
|
+
Single-line Labels can shrink their drawing size to fit the available region:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { Label } from '@kurot/ui';
|
|
15
|
+
|
|
16
|
+
const amount = new Label('KZT 10 000,00');
|
|
17
|
+
amount.width = 140;
|
|
18
|
+
amount.size = 24;
|
|
19
|
+
amount.multiline = false;
|
|
20
|
+
amount.textFit = 'shrink';
|
|
21
|
+
amount.minFontSize = 16;
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`size` stays authored; `renderedSize` and `textFitOverflow` are read-only results
|
|
25
|
+
after layout validation. Shorter text or larger bounds restore the base size.
|
|
26
|
+
Put a Button's fitting policy on its `labelDisplay` skin part, so icon spacing
|
|
27
|
+
and state overrides are respected. EditableText rejects shrinking; multiline
|
|
28
|
+
Labels retain their base size.
|
|
29
|
+
|
|
30
|
+
Label defaults to multiline, while explicit `multiline = false` displays one
|
|
31
|
+
unwrapped first line. Remove an old false flag or set it to true for text
|
|
32
|
+
intended to wrap. Files are not migrated automatically. Load fonts before
|
|
33
|
+
measurement; after late loading, call `label.invalidateSize()` to refresh
|
|
34
|
+
metrics even if the family name is unchanged.
|
|
35
|
+
|
|
36
|
+
See the [text layout and fitting contract](docs/label-text-layout.md). KUI
|
|
37
|
+
authoring requires ui-document 0.9.x and matching CLI/ui-runtime releases;
|
|
38
|
+
programmatic UI depends only on Core.
|
|
39
|
+
|
|
9
40
|
## Installation
|
|
10
41
|
|
|
11
42
|
```bash
|
|
12
|
-
pnpm add @kurot/ui @kurot/core
|
|
43
|
+
pnpm add @kurot/ui@^3.1.0 @kurot/core@^2.1.0
|
|
13
44
|
```
|
|
14
45
|
|
|
15
46
|
`@kurot/ui` declares `@kurot/core` as a peer dependency. Install both packages explicitly so the application controls the resolved core version.
|
|
16
47
|
|
|
48
|
+
UI 3.1 requires Core 2.1.0 or later within Core 2.x. Refresh old sheet manifests with
|
|
49
|
+
string-valued `subkeys` in Kurot Editor before launching the application.
|
|
50
|
+
See the [resource migration guide](../ui-document/docs/resource-nine-slice.md).
|
|
51
|
+
|
|
17
52
|
## Quick Start
|
|
18
53
|
|
|
19
54
|
```ts
|
|
@@ -130,18 +165,12 @@ export class ConfirmPanel extends Component {
|
|
|
130
165
|
|
|
131
166
|
protected override onSkinReady(): void {
|
|
132
167
|
super.onSkinReady();
|
|
133
|
-
this.skinParts.btnConfirm.addEventListener(
|
|
134
|
-
TouchEvent.TOUCH_TAP,
|
|
135
|
-
this.onConfirm,
|
|
136
|
-
);
|
|
168
|
+
this.skinParts.btnConfirm.addEventListener(TouchEvent.TOUCH_TAP, this.onConfirm);
|
|
137
169
|
this.skinParts.lblMessage.text = 'Continue?';
|
|
138
170
|
}
|
|
139
171
|
|
|
140
172
|
protected override onSkinRemoved(): void {
|
|
141
|
-
this.skinParts.btnConfirm.removeEventListener(
|
|
142
|
-
TouchEvent.TOUCH_TAP,
|
|
143
|
-
this.onConfirm,
|
|
144
|
-
);
|
|
173
|
+
this.skinParts.btnConfirm.removeEventListener(TouchEvent.TOUCH_TAP, this.onConfirm);
|
|
145
174
|
super.onSkinRemoved();
|
|
146
175
|
}
|
|
147
176
|
|
|
@@ -175,19 +204,19 @@ dynamic properties; use `this.skinParts.<name>` during the ready lifecycle.
|
|
|
175
204
|
|
|
176
205
|
### Basic Controls
|
|
177
206
|
|
|
178
|
-
| Component | Description
|
|
179
|
-
| -------------- |
|
|
180
|
-
| `Label` | Text display. Wraps `TextField` in the UI lifecycle.
|
|
181
|
-
| `Button` | Tappable button with `up`/`down`/`disabled` states and `labelDisplay` part.
|
|
182
|
-
| `CheckBox` | Toggle button. Dispatches `Event.CHANGE` on selection change.
|
|
183
|
-
| `RadioButton` | Mutually exclusive toggle. Use `groupName` to link buttons.
|
|
184
|
-
| `ToggleButton` | Base for toggle-style buttons.
|
|
185
|
-
| `ToggleSwitch` | Binary on/off switch (visual variant of `ToggleButton`).
|
|
186
|
-
| `ProgressBar` | Value indicator. Inject `thumb` (a `Component`) as the fill part.
|
|
207
|
+
| Component | Description |
|
|
208
|
+
| -------------- | ------------------------------------------------------------------------------ |
|
|
209
|
+
| `Label` | Text display. Wraps `TextField` in the UI lifecycle. |
|
|
210
|
+
| `Button` | Tappable button with `up`/`down`/`disabled` states and `labelDisplay` part. |
|
|
211
|
+
| `CheckBox` | Toggle button. Dispatches `Event.CHANGE` on selection change. |
|
|
212
|
+
| `RadioButton` | Mutually exclusive toggle. Use `groupName` to link buttons. |
|
|
213
|
+
| `ToggleButton` | Base for toggle-style buttons. |
|
|
214
|
+
| `ToggleSwitch` | Binary on/off switch (visual variant of `ToggleButton`). |
|
|
215
|
+
| `ProgressBar` | Value indicator. Inject `thumb` (a `Component`) as the fill part. |
|
|
187
216
|
| `HSlider` | Horizontal slider. Inject `thumb` and `track` skin parts; default range 0–100. |
|
|
188
217
|
| `VSlider` | Vertical slider. Inject `thumb` and `track` skin parts; default range 0–100. |
|
|
189
|
-
| `Rect` | Filled/stroked rectangle. Supports `fillColor`, `strokeColor`, `fillAlpha`.
|
|
190
|
-
| `Image` | Bitmap display. Supports URL string or `Texture`, `scale9Grid`, `fillMode`.
|
|
218
|
+
| `Rect` | Filled/stroked rectangle. Supports `fillColor`, `strokeColor`, `fillAlpha`. |
|
|
219
|
+
| `Image` | Bitmap display. Supports URL string or `Texture`, `scale9Grid`, `fillMode`. |
|
|
191
220
|
|
|
192
221
|
Both sliders inherit Range's default `minimum = 0` and `maximum = 100`.
|
|
193
222
|
Set either bound explicitly when a control needs a different range.
|
|
@@ -217,13 +246,13 @@ gesture. Set `visible="true" autoVisibility="false"` to keep a bar visible.
|
|
|
217
246
|
|
|
218
247
|
### Data-Driven
|
|
219
248
|
|
|
220
|
-
| Component | Description
|
|
221
|
-
| -------------- |
|
|
222
|
-
| `DataGroup` | Renders a data collection using item renderers. Supports virtual layout for large datasets.
|
|
223
|
-
| `List` | `DataGroup` with tap-to-select. Dispatches `ItemTapEvent.ITEM_TAP`.
|
|
224
|
-
| `TabBar` | Horizontal tab strip driven by `dataProvider`. Dispatches `ItemTapEvent.ITEM_TAP`.
|
|
249
|
+
| Component | Description |
|
|
250
|
+
| -------------- | ----------------------------------------------------------------------------------------------- |
|
|
251
|
+
| `DataGroup` | Renders a data collection using item renderers. Supports virtual layout for large datasets. |
|
|
252
|
+
| `List` | `DataGroup` with tap-to-select. Dispatches `ItemTapEvent.ITEM_TAP`. |
|
|
253
|
+
| `TabBar` | Horizontal tab strip driven by `dataProvider`. Dispatches `ItemTapEvent.ITEM_TAP`. |
|
|
225
254
|
| `ComboBox` | Drop-down selector. Tapping toggles a `list` skin part; dispatches `Event.CHANGE` on selection. |
|
|
226
|
-
| `ItemRenderer` | Base class for custom item renderers. Override `dataChanged()` to update visuals.
|
|
255
|
+
| `ItemRenderer` | Base class for custom item renderers. Override `dataChanged()` to update visuals. |
|
|
227
256
|
|
|
228
257
|
### Scroll Bars
|
|
229
258
|
|
|
@@ -322,13 +351,13 @@ class MyButtonSkin extends Skin {
|
|
|
322
351
|
|
|
323
352
|
## Events
|
|
324
353
|
|
|
325
|
-
| Event | Dispatched by
|
|
326
|
-
| ----------------------------------- |
|
|
354
|
+
| Event | Dispatched by | Description |
|
|
355
|
+
| ----------------------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
327
356
|
| `Event.CHANGE` | `List`, `TabBar`, `ComboBox`, `CheckBox`, `RadioButton`, `Range` | Selection or value changed (user interaction only for List/TabBar) |
|
|
328
|
-
| `ItemTapEvent.ITEM_TAP` | `List`, `TabBar`
|
|
329
|
-
| `CollectionEvent.COLLECTION_CHANGE` | `ArrayCollection`
|
|
330
|
-
| `UIEvent.CLOSING` | `Panel`
|
|
331
|
-
| `UIEvent.CREATION_COMPLETE` | Any `Component`
|
|
357
|
+
| `ItemTapEvent.ITEM_TAP` | `List`, `TabBar` | Item tapped. Has `item`, `itemIndex`, `itemRenderer` |
|
|
358
|
+
| `CollectionEvent.COLLECTION_CHANGE` | `ArrayCollection` | Data added, removed, replaced, reset |
|
|
359
|
+
| `UIEvent.CLOSING` | `Panel` | Close button tapped (cancelable) |
|
|
360
|
+
| `UIEvent.CREATION_COMPLETE` | Any `Component` | First `createChildren` completed |
|
|
332
361
|
|
|
333
362
|
## UI Benchmark
|
|
334
363
|
|
|
@@ -343,11 +372,11 @@ report can distinguish a stable pool from per-frame renderer churn.
|
|
|
343
372
|
|
|
344
373
|
The first complete Chromium run used 60 warmup frames and 300 measured frames:
|
|
345
374
|
|
|
346
|
-
| Workload
|
|
347
|
-
|
|
|
348
|
-
| 400-node static image UI
|
|
349
|
-
| 240-node transform/alpha animation | 3.90 ms |
|
|
350
|
-
| 10,000-record virtual list
|
|
375
|
+
| Workload | Setup | Frame P95 | Render P95 | Draw calls | UI lifecycle result |
|
|
376
|
+
| ---------------------------------- | ------: | --------: | ---------: | ---------: | ------------------------------------------ |
|
|
377
|
+
| 400-node static image UI | 8.50 ms | 10.20 ms | 0.20 ms | 1 | No repeated validation after stabilization |
|
|
378
|
+
| 240-node transform/alpha animation | 3.90 ms | 10.00 ms | 0.30 ms | 1 | No measure or display-list validation |
|
|
379
|
+
| 10,000-record virtual list | 6.90 ms | 9.90 ms | 0.50 ms | 5 | 19 renderers created and at most 19 live |
|
|
351
380
|
|
|
352
381
|
The transform workload recorded 72,000 `commitProperties` calls: 240 moving UI
|
|
353
382
|
nodes × 300 measured frames. Multiple property changes on the same component
|
|
@@ -376,12 +405,12 @@ cross-framework ranking.
|
|
|
376
405
|
|
|
377
406
|
## Differences from Egret EUI
|
|
378
407
|
|
|
379
|
-
| | Egret EUI | @kurot/ui
|
|
408
|
+
| | Egret EUI | @kurot/ui |
|
|
380
409
|
| -------------- | --------------------------- | ------------------------------------ |
|
|
381
410
|
| Namespace | `eui.*` global | ES Module named exports |
|
|
382
411
|
| Component base | `namespace` + `mixin` | Standard class inheritance |
|
|
383
412
|
| Layout state | Prototype-injected | `UIState` delegation |
|
|
384
|
-
| Authored skins | EXML runtime parser
|
|
413
|
+
| Authored skins | EXML runtime parser | KUI XML compiled by `@kurot/cli` |
|
|
385
414
|
| Skin parts | Incremental dynamic fields | Atomic typed `skinParts` |
|
|
386
415
|
| Skin lifecycle | `partAdded` / `partRemoved` | `onSkinReady` / `onSkinRemoved` |
|
|
387
416
|
| `thisObject` | Required in event listeners | Not needed — use arrow functions |
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { Component } from './Component.js';
|
|
2
2
|
import { TextField } from '@kurot/core';
|
|
3
3
|
import type { IDisplayText } from '../core/IDisplayText.js';
|
|
4
|
+
/**
|
|
5
|
+
* Optional single-line font fitting policy.
|
|
6
|
+
*/
|
|
7
|
+
export type TextFitMode = 'none' | 'shrink';
|
|
4
8
|
/**
|
|
5
9
|
* Label component for displaying text.
|
|
6
10
|
* Wraps a TextField and integrates it with the UI component lifecycle.
|
|
@@ -10,6 +14,12 @@ import type { IDisplayText } from '../core/IDisplayText.js';
|
|
|
10
14
|
export declare class Label extends Component implements IDisplayText {
|
|
11
15
|
protected _textField: TextField;
|
|
12
16
|
private _widthConstraint;
|
|
17
|
+
private _layoutHeight;
|
|
18
|
+
private _baseSize;
|
|
19
|
+
private _textFit;
|
|
20
|
+
private _minFontSize;
|
|
21
|
+
private _textFitOverflow;
|
|
22
|
+
private _fitKey?;
|
|
13
23
|
constructor(text?: string);
|
|
14
24
|
get text(): string;
|
|
15
25
|
set text(value: string);
|
|
@@ -17,6 +27,27 @@ export declare class Label extends Component implements IDisplayText {
|
|
|
17
27
|
set fontFamily(value: string);
|
|
18
28
|
get size(): number;
|
|
19
29
|
set size(value: number);
|
|
30
|
+
/**
|
|
31
|
+
* Shrink applies only to noneditable, single-line text with finite bounds.
|
|
32
|
+
* Multiline text retains the authored size; editable text rejects shrink.
|
|
33
|
+
*/
|
|
34
|
+
get textFit(): TextFitMode;
|
|
35
|
+
set textFit(value: TextFitMode);
|
|
36
|
+
/**
|
|
37
|
+
* Readable lower limit in logical pixels; must be finite and at least one.
|
|
38
|
+
* A limit above size does not enlarge the text.
|
|
39
|
+
*/
|
|
40
|
+
get minFontSize(): number;
|
|
41
|
+
set minFontSize(value: number);
|
|
42
|
+
/**
|
|
43
|
+
* Derived drawing size after layout validation; size remains the authored value.
|
|
44
|
+
*/
|
|
45
|
+
get renderedSize(): number;
|
|
46
|
+
/**
|
|
47
|
+
* True after validation when enabled fitting cannot fit even at minFontSize.
|
|
48
|
+
* Text is then clipped normally; the project decides how to handle overflow.
|
|
49
|
+
*/
|
|
50
|
+
get textFitOverflow(): boolean;
|
|
20
51
|
get bold(): boolean;
|
|
21
52
|
set bold(value: boolean);
|
|
22
53
|
get italic(): boolean;
|
|
@@ -31,8 +62,15 @@ export declare class Label extends Component implements IDisplayText {
|
|
|
31
62
|
set textAlign(value: string);
|
|
32
63
|
get verticalAlign(): string;
|
|
33
64
|
set verticalAlign(value: string);
|
|
65
|
+
/**
|
|
66
|
+
* Defaults to true. False renders only the first hard-separated line,
|
|
67
|
+
* without automatic wrapping, regardless of the label height.
|
|
68
|
+
*/
|
|
34
69
|
get multiline(): boolean;
|
|
35
70
|
set multiline(value: boolean);
|
|
71
|
+
/**
|
|
72
|
+
* In multiline mode, true uses Unicode word boundaries; false wraps by character.
|
|
73
|
+
*/
|
|
36
74
|
get wordWrap(): boolean;
|
|
37
75
|
set wordWrap(value: boolean);
|
|
38
76
|
get lineSpacing(): number;
|
|
@@ -41,9 +79,11 @@ export declare class Label extends Component implements IDisplayText {
|
|
|
41
79
|
set maxChars(value: number);
|
|
42
80
|
get displayAsPassword(): boolean;
|
|
43
81
|
set displayAsPassword(value: boolean);
|
|
82
|
+
invalidateSize(): void;
|
|
44
83
|
createChildren(): void;
|
|
45
84
|
measure(): void;
|
|
46
85
|
setLayoutBoundsSize(layoutWidth: number, layoutHeight: number): void;
|
|
47
86
|
updateDisplayList(unscaledWidth: number, unscaledHeight: number): void;
|
|
87
|
+
private _applyTextFit;
|
|
48
88
|
}
|
|
49
89
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/Label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/kurot/components/Label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE5C;;;;;GAKG;AACH,qBAAa,KAAM,SAAQ,SAAU,YAAW,YAAY;IAG3D,SAAS,CAAC,UAAU,EAAE,SAAS,CAAC;IAEhC,OAAO,C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