@kurot/core 2.1.1 → 2.2.1

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/README.md +50 -2
  3. package/dist/kurot/display/DisplayObject.d.ts +2 -1
  4. package/dist/kurot/display/DisplayObject.d.ts.map +1 -1
  5. package/dist/kurot/display/DisplayObject.js.map +1 -1
  6. package/dist/kurot/player/canvas/CanvasRenderer.d.ts +2 -0
  7. package/dist/kurot/player/canvas/CanvasRenderer.d.ts.map +1 -1
  8. package/dist/kurot/player/canvas/CanvasRenderer.js +37 -1
  9. package/dist/kurot/player/canvas/CanvasRenderer.js.map +1 -1
  10. package/dist/kurot/player/pipes/BitmapTextPipe.d.ts +20 -0
  11. package/dist/kurot/player/pipes/BitmapTextPipe.d.ts.map +1 -0
  12. package/dist/kurot/player/pipes/BitmapTextPipe.js +27 -0
  13. package/dist/kurot/player/pipes/BitmapTextPipe.js.map +1 -0
  14. package/dist/kurot/player/pipes/index.d.ts +2 -0
  15. package/dist/kurot/player/pipes/index.d.ts.map +1 -1
  16. package/dist/kurot/player/pipes/index.js +1 -0
  17. package/dist/kurot/player/pipes/index.js.map +1 -1
  18. package/dist/kurot/player/webgl/WebGLRenderer.d.ts +1 -0
  19. package/dist/kurot/player/webgl/WebGLRenderer.d.ts.map +1 -1
  20. package/dist/kurot/player/webgl/WebGLRenderer.js +8 -0
  21. package/dist/kurot/player/webgl/WebGLRenderer.js.map +1 -1
  22. package/dist/kurot/resource/Resource.d.ts.map +1 -1
  23. package/dist/kurot/resource/Resource.js +4 -0
  24. package/dist/kurot/resource/Resource.js.map +1 -1
  25. package/dist/kurot/resource/ResourceItem.d.ts +1 -0
  26. package/dist/kurot/resource/ResourceItem.d.ts.map +1 -1
  27. package/dist/kurot/resource/ResourceItem.js +1 -0
  28. package/dist/kurot/resource/ResourceItem.js.map +1 -1
  29. package/dist/kurot/resource/analyzers/FontAnalyzer.d.ts +16 -0
  30. package/dist/kurot/resource/analyzers/FontAnalyzer.d.ts.map +1 -0
  31. package/dist/kurot/resource/analyzers/FontAnalyzer.js +75 -0
  32. package/dist/kurot/resource/analyzers/FontAnalyzer.js.map +1 -0
  33. package/dist/kurot/resource/analyzers/index.d.ts +1 -0
  34. package/dist/kurot/resource/analyzers/index.d.ts.map +1 -1
  35. package/dist/kurot/resource/analyzers/index.js +1 -0
  36. package/dist/kurot/resource/analyzers/index.js.map +1 -1
  37. package/dist/kurot/resource/index.d.ts +1 -0
  38. package/dist/kurot/resource/index.d.ts.map +1 -1
  39. package/dist/kurot/resource/index.js +1 -0
  40. package/dist/kurot/resource/index.js.map +1 -1
  41. package/dist/kurot/text/BitmapFont.d.ts +15 -21
  42. package/dist/kurot/text/BitmapFont.d.ts.map +1 -1
  43. package/dist/kurot/text/BitmapFont.js +59 -66
  44. package/dist/kurot/text/BitmapFont.js.map +1 -1
  45. package/dist/kurot/text/BitmapText.d.ts +29 -19
  46. package/dist/kurot/text/BitmapText.d.ts.map +1 -1
  47. package/dist/kurot/text/BitmapText.js +93 -141
  48. package/dist/kurot/text/BitmapText.js.map +1 -1
  49. package/dist/kurot/text/LineBreaks.d.ts +2 -1
  50. package/dist/kurot/text/LineBreaks.d.ts.map +1 -1
  51. package/dist/kurot/text/LineBreaks.js +13 -9
  52. package/dist/kurot/text/LineBreaks.js.map +1 -1
  53. package/dist/kurot/text/TextLineLayout.d.ts.map +1 -1
  54. package/dist/kurot/text/TextLineLayout.js +5 -12
  55. package/dist/kurot/text/TextLineLayout.js.map +1 -1
  56. package/dist/kurot/text/TextSegmentation.d.ts +7 -0
  57. package/dist/kurot/text/TextSegmentation.d.ts.map +1 -0
  58. package/dist/kurot/text/TextSegmentation.js +17 -0
  59. package/dist/kurot/text/TextSegmentation.js.map +1 -0
  60. package/dist/kurot/text/WordWrap.d.ts.map +1 -1
  61. package/dist/kurot/text/WordWrap.js +3 -11
  62. package/dist/kurot/text/WordWrap.js.map +1 -1
  63. package/dist/kurot/text/index.d.ts +1 -0
  64. package/dist/kurot/text/index.d.ts.map +1 -1
  65. package/dist/kurot/text/index.js.map +1 -1
  66. package/docs/ai-context.md +33 -9
  67. package/docs/architecture.md +332 -279
  68. package/docs/bitmap-fonts.md +85 -0
  69. package/docs/resource.md +185 -156
  70. package/docs/text-layout.md +71 -8
  71. package/package.json +4 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/kurot/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/kurot/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -5,7 +5,8 @@ agent unfamiliar with Kurot does not need to re-derive the architecture from
5
5
  scratch on every session. Treat the package source and its `src/index.ts`
6
6
  barrel as the authority for current behavior and exports.
7
7
 
8
- Package identity: `@kurot/core@2.1.1`. It provides Kurot's scene graph,
8
+ Package identity: `@kurot/core@2.2.1`. This patch is prepared for publication;
9
+ Core 2.2.0 is published. It provides Kurot's scene graph,
9
10
  events, rendering, text, resource, network and media runtime. Rendering uses a
10
11
  flat `InstructionSet + RenderPipe` pipeline. ES2022 / evergreen browsers only
11
12
  with `strict: true`. Two
@@ -28,7 +29,7 @@ src/kurot/
28
29
  ├── player/ Game loop + both render backends. Player, createPlayer(), SystemTicker/
29
30
  │ ticker singleton, ScreenAdapter, TouchHandler. Backend-neutral abstractions
30
31
  │ live here: RenderPipe / RenderContext / RenderBuffer interfaces (the latter
31
- │ two are internal), InstructionSet, and pipes/ (Bitmap/Graphics/Mesh/Text/
32
+ │ two are internal), InstructionSet, and pipes/ (Bitmap/BitmapText/Graphics/Mesh/Text/
32
33
  │ Filter/Mask/Particle). The WebGL instruction renderer consumes the pipes.
33
34
  │ ├── webgl/ WebGLRenderer, WebGLRenderContext, WebGLRenderBuffer/Target,
34
35
  │ │ WebGLVertexArrayObject, WebGLDrawCmdManager, MultiTextureBatcher,
@@ -42,9 +43,10 @@ src/kurot/
42
43
  │ CustomFilter, MultiPassFilter, BloomFilter. GPU execution in player/webgl/;
43
44
  │ push/pop scene integration in player/pipes/.
44
45
  ├── text/ TextField, BitmapText/BitmapFont, StageText (DOM overlay, INPUT mode only),
45
- │ HtmlTextParser, InputController, TextMeasurer, LineBreaks, TextLineLayout, WordWrap.
46
+ │ HtmlTextParser, InputController, TextMeasurer, TextSegmentation,
47
+ │ LineBreaks, TextLineLayout, WordWrap.
46
48
  ├── resource/ Resource class + `resource` singleton, ResourceLoader, analyzers/
47
- │ (Image/Json/Text/Sound/Sheet). Async, resource.json-driven (RES-compatible).
49
+ │ (Image/Json/Text/Sound/Sheet/Font). Async, resource.json-driven (RES-compatible).
48
50
  ├── net/ HttpRequest, ImageLoader. Low-level; resource/analyzers build on these.
49
51
  ├── media/ Sound (+SoundChannel), Video. Web Audio + HTMLAudioElement fallback.
50
52
  ├── system/ Capabilities (static). Must be _init()'d — createPlayer() does this for you.
@@ -116,8 +118,11 @@ colocated under `examples/benchmark/`; none are exported from `index.ts`.
116
118
  - `BlurFilter.quality` controls pass pairs (1–16); large radii downsample to
117
119
  stay within the existing 32-physical-pixel shader tier. Glow/DropShadow keep
118
120
  their existing fixed-sample shader and do not use their quality metadata.
119
- - GPU filters are skipped by Canvas 2D, including the Canvas capture used by
120
- cacheAsTexture and RenderTexture. Do not cache GPU effects through those APIs.
121
+ - Canvas 2D skips CustomFilter, MultiPassFilter and BloomFilter, including the
122
+ Canvas capture used by cacheAsTexture and RenderTexture. Built-in Blur, Glow
123
+ and DropShadow use CSS approximations; ColorMatrix uses CPU pixels. These
124
+ fallbacks are not pixel-equivalent to WebGL. Do not cache GPU shader effects
125
+ through those capture APIs. See docs/filters.md.
121
126
  - Filter setters invalidate weakly attached users. Direct uniform/binding edits
122
127
  need `filter.invalidate()`. Auxiliary canvas/video edits additionally need
123
128
  `BitmapData.invalidate(source)` for upload refresh.
@@ -162,11 +167,11 @@ Re-export order: `events`, `geom`, `utils`, `display`, `net`, `filters`,
162
167
  - **Media**: `Sound`/`SoundType`/`SoundEvents`, `SoundChannel`, `Video`.
163
168
  - **Player**: `Player`, `createPlayer`/`KurotApp`/`KurotOptions`; ticker: `SystemTicker`, `ticker`, `getTimer`, `setupLifecycle`, `START_TIME`, `invalidateRenderFlag`/`setInvalidateRenderFlag`, `requestRenderingFlag`/`setRequestRenderingFlag`, `Renderable`; rendering: `InstructionSet`/`Instruction`, `RenderPipe` (type), `CanvasBuffer`, `hitTestBuffer`, `CanvasRenderer`, `DisplayList`; input/layout: `TouchHandler`, `ScreenAdapter`/`StageDisplaySize`; WebGL: `WebGLRenderer`, `WebGLRenderContext`, `WebGLRenderBuffer`, `WebGLRenderTarget`, `WebGLVertexArrayObject`, `WebGLDrawCmdManager`, `WebGLProgram`, `ShaderLib`, `checkWebGLSupport`, `MultiTextureBatcher`.
164
169
  - `RenderContext` / `RenderBuffer` (`player/RenderContext.ts`, `player/RenderBuffer.ts`) are internal backend-neutral contracts and are not re-exported.
165
- - **Text**: `HorizontalAlign`, `VerticalAlign`, `TextFieldType`, `TextFieldInputType`; types `ITextStyle`, `ITextElement`, `IWTextElement`, `ILineElement`, `IHitTextElement`; `HtmlTextParser`, `BitmapFont`, `BitmapText`, `measureText`/`getFontString`, `TextField`, `StageText`, `InputController`, `tokenize`/`splitGraphemes`.
170
+ - **Text**: `HorizontalAlign`, `VerticalAlign`, `TextFieldType`, `TextFieldInputType`; types `ITextStyle`, `ITextElement`, `IWTextElement`, `ILineElement`, `IHitTextElement`, `BitmapFontOptions`; `HtmlTextParser`, `BitmapFont`, `BitmapText`, `measureText`/`getFontString`, `TextField`, `StageText`, `InputController`, `tokenize`/`splitGraphemes`.
166
171
  - **System**: `Capabilities`.
167
172
  - **localStorage**: namespace object — `import { localStorage } from '@kurot/core'`, then `localStorage.getItem(...)`.
168
173
  - **External**: `ExternalInterface` (named, not namespaced).
169
- - **Resource**: `Resource`/`resource` (shared instance), `ProgressCallback`, `ResourceEventListener`, `ResourceItem`, `ResourceType`, `ResourceConfig`/`ResourceConfigData`/`ResourceConfigEntry`, `ResourceLoader`, `ResourceEventType`/`ResourceEvent`, `AnalyzerBase`, `ImageAnalyzer`, `JsonAnalyzer`, `TextAnalyzer`, `SoundAnalyzer`, `SheetAnalyzer`.
174
+ - **Resource**: `Resource`/`resource` (shared instance), `ProgressCallback`, `ResourceEventListener`, `ResourceItem`, `ResourceType`, `ResourceConfig`/`ResourceConfigData`/`ResourceConfigEntry`, `ResourceLoader`, `ResourceEventType`/`ResourceEvent`, `AnalyzerBase`, `ImageAnalyzer`, `JsonAnalyzer`, `TextAnalyzer`, `SoundAnalyzer`, `SheetAnalyzer`, `FontAnalyzer`.
170
175
 
171
176
  `examples/benchmark/` is dev-only tooling and is **not** exported from `index.ts`.
172
177
 
@@ -200,7 +205,7 @@ Re-export order: `events`, `geom`, `utils`, `display`, `net`, `filters`,
200
205
  | Change how instructions are built/executed | `player/webgl/WebGLRenderer.ts`, `player/InstructionSet.ts` |
201
206
  | Add a new resource type/parser | `resource/analyzers/`, register in `Resource.ts` |
202
207
  | Debug a texture-batching issue | `player/webgl/MultiTextureBatcher.ts`, `player/webgl/WebGLDrawCmdManager.ts` |
203
- | Change text layout/wrapping | `text/LineBreaks.ts`, `text/TextLineLayout.ts`, `text/TextMeasurer.ts`; `docs/text-layout.md` |
208
+ | Change text layout/wrapping | `text/LineBreaks.ts`, `text/TextLineLayout.ts`, `text/TextSegmentation.ts`, `text/TextMeasurer.ts`; `docs/text-layout.md` |
204
209
  | Understand dirty-flag propagation | `display/DisplayObject.ts` (`$markDirty`, `$cacheDirtyUp`, `$renderDirtyUp`) |
205
210
  | Run perf tests | `examples/benchmark/`, `pnpm benchmark`; automated Kurot/PixiJS/Egret comparison via `pnpm benchmark:compare` |
206
211
 
@@ -217,6 +222,13 @@ with local index remapping (player/webgl/split-mesh.ts).
217
222
 
218
223
  Word-wrapped text uses Unicode 17.0 UAX #14, dictionary tailoring for SA scripts
219
224
  and alphabetic overflow tailoring. Style runs never introduce break positions.
225
+ Core 2.2.1 tailors rules by imported function identity and filters optional
226
+ breaks through grapheme boundaries. Character wrapping also uses complete
227
+ graphemes. Never introduce a break inside a cluster; an oversized cluster
228
+ overflows intact. The untailored default profile stays unchanged for Unicode
229
+ conformance. `TextSegmentation.ts` shares cached word/grapheme segmenters;
230
+ ordinary and emergency layout reuse a paragraph's UTF-16 grapheme end offsets.
231
+ No text or segmentation results are retained globally. See [text layout](text-layout.md).
220
232
  Automatic-wrap spaces count in source offsets but not painted width. Core's
221
233
  Canvas renderer advances input indices by line.charNum, including hidden spaces
222
234
  and CRLF; do not derive the next line's source offset from painted text lengths.
@@ -240,3 +252,15 @@ separate UI capability requiring Core 2.1.0 or later.
240
252
  See [text layout](text-layout.md) for the Core contract and
241
253
  [Label text layout](../../ui/docs/label-text-layout.md) for fit bounds, state
242
254
  restoration and shared-schema boundaries.
255
+
256
+ ## Bitmap fonts in 2.2.0
257
+
258
+ [bitmap-fonts.md](bitmap-fonts.md) documents the headless bitmap-font dependency,
259
+ FontAnalyzer and BitmapTextPipe. ResourceType.Font is built in; BitmapText
260
+ now draws via WebGL/Canvas. BitmapFontOptions controls page ownership. Native
261
+ font data comes from @kurot/bitmap-font; do not reimplement parsing/layout here.
262
+ The dependency is published @kurot/bitmap-font ^0.1.0, with no local override.
263
+ BitmapText.measureText() leaves rendered constraints and layout caches unchanged;
264
+ text borrows the font and the resource/caller retains ownership. Font pages are
265
+ full, unrotated textures at scale factor 1. Core 2.1.1 does not include these
266
+ changes. Core 2.2.0 is published with its registry bitmap-font dependency.