@doki-land/live2d-core 0.0.15 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,7 +24,8 @@ It does not fetch network resources, decode MOC binaries, create a canvas, or is
24
24
  pnpm add @doki-land/live2d-core
25
25
  ```
26
26
 
27
- Install this package directly only when implementing a compatible loader, renderer, diagnostic tool, or host integration.
27
+ Install this package directly only when implementing a compatible loader, renderer, diagnostic tool, or host
28
+ integration.
28
29
 
29
30
  ## 🧱 Design Principles
30
31
 
@@ -48,7 +49,8 @@ import type {
48
49
  } from "@doki-land/live2d-core";
49
50
  ```
50
51
 
51
- An asset resolver provides model-related resources without prescribing HTTP, file-system, CDN, or package-registry behavior:
52
+ An asset resolver provides model-related resources without prescribing HTTP, file-system, CDN, or package-registry
53
+ behavior:
52
54
 
53
55
  ```ts
54
56
  const resolver: AssetResolver = {
@@ -63,7 +65,8 @@ const resolver: AssetResolver = {
63
65
  };
64
66
  ```
65
67
 
66
- Use the exact exported interface as the source of truth; the example illustrates the ownership boundary rather than guaranteeing every method name across versions.
68
+ Use the exact exported interface as the source of truth; the example illustrates the ownership boundary rather than
69
+ guaranteeing every method name across versions.
67
70
 
68
71
  ## 🔄 Session Lifecycle
69
72
 
@@ -74,7 +77,8 @@ idle -> mounting -> ready -> loading -> live
74
77
  \-> error
75
78
  ```
76
79
 
77
- Consumers should listen to phase and error events instead of inferring readiness from a non-null canvas or model reference.
80
+ Consumers should listen to phase and error events instead of inferring readiness from a non-null canvas or model
81
+ reference.
78
82
 
79
83
  ## 📸 Frame Data
80
84
 
@@ -95,11 +99,13 @@ pnpm --filter @doki-land/live2d-core typecheck
95
99
  pnpm --filter @doki-land/live2d-core test
96
100
  ```
97
101
 
98
- Contract changes should include compatibility notes in the change itself and update all workspace consumers in the same change set.
102
+ Contract changes should include compatibility notes in the change itself and update all workspace consumers in the same
103
+ change set.
99
104
 
100
105
  ## 🤝 Contributing
101
106
 
102
- Avoid adding convenience APIs that belong to the facade. A core abstraction should be shared by at least two implementation layers and remain meaningful without a browser UI framework.
107
+ Avoid adding convenience APIs that belong to the facade. A core abstraction should be shared by at least two
108
+ implementation layers and remain meaningful without a browser UI framework.
103
109
 
104
110
  ## 📄 License
105
111
 
package/dist/index.d.ts CHANGED
@@ -392,6 +392,12 @@ interface Live2dStage {
392
392
 
393
393
  /**
394
394
  * `@doki-land/live2d-core` — types, events, session contracts.
395
+ *
396
+ * Layout:
397
+ * - `format/` — settings JSON format detection
398
+ * - `model/` — settings / asset / actor instance types
399
+ * - `stage/` — stage + actor contracts
400
+ * - root — contracts, events, frame, program, session
395
401
  */
396
402
 
397
403
  declare const LIVE2D_CORE_VERSION: "0.0.0";
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ function modelSourceUrl(source) {
9
9
  return source.baseUrl;
10
10
  }
11
11
 
12
- // src/detect-format.ts
12
+ // src/format/detect-format.ts
13
13
  function detectModelSettingsFormat(json) {
14
14
  if (!json || typeof json !== "object") return null;
15
15
  const o = json;
@@ -109,7 +109,7 @@ function createSessionStub() {
109
109
  };
110
110
  }
111
111
 
112
- // src/stage.ts
112
+ // src/stage/stage.ts
113
113
  var DEFAULT_ACTOR_TRANSFORM = {
114
114
  x: 0.5,
115
115
  y: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doki-land/live2d-core",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "Shared TypeScript contracts for live2d.ts — ModelSource, Live2dStage/Actor, ModelAsset, events (no DOM/GPU).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -3,7 +3,7 @@
3
3
  * Shared by loader normalize and renderer backends — keep binary peek in renderer.
4
4
  */
5
5
 
6
- import type { ModelFormat } from "./model.js";
6
+ import type { ModelFormat } from "../model/model.js";
7
7
 
8
8
  /** Detect moc2 vs moc3 from model settings JSON shape. Returns null if unknown. */
9
9
  export function detectModelSettingsFormat(json: unknown): ModelFormat | null {
package/src/index.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * `@doki-land/live2d-core` — types, events, session contracts.
3
+ *
4
+ * Layout:
5
+ * - `format/` — settings JSON format detection
6
+ * - `model/` — settings / asset / actor instance types
7
+ * - `stage/` — stage + actor contracts
8
+ * - root — contracts, events, frame, program, session
3
9
  */
4
10
 
5
11
  export type {
@@ -10,7 +16,7 @@ export type {
10
16
  SessionState,
11
17
  } from "./contracts.js";
12
18
  export { modelSourceUrl } from "./contracts.js";
13
- export { detectModelSettingsFormat } from "./detect-format.js";
19
+ export { detectModelSettingsFormat } from "./format/detect-format.js";
14
20
  export {
15
21
  EventEmitter,
16
22
  type FrameProfile,
@@ -32,12 +38,12 @@ export type {
32
38
  ModelFormat,
33
39
  ModelSettings,
34
40
  MotionDefinition,
35
- } from "./model.js";
41
+ } from "./model/model.js";
36
42
  export type {
37
43
  ActorInstance,
38
44
  Live2dStageAssets,
39
45
  ModelAsset,
40
- } from "./model-asset.js";
46
+ } from "./model/model-asset.js";
41
47
  export type {
42
48
  DrawableProgram,
43
49
  ModelInstance,
@@ -60,7 +66,7 @@ export type {
60
66
  PointerTrackingPolicy,
61
67
  StagePointerEvent,
62
68
  StageUpdateMode,
63
- } from "./stage.js";
64
- export { DEFAULT_ACTOR_TRANSFORM } from "./stage.js";
69
+ } from "./stage/stage.js";
70
+ export { DEFAULT_ACTOR_TRANSFORM } from "./stage/stage.js";
65
71
 
66
72
  export const LIVE2D_CORE_VERSION = "0.0.0" as const;
@@ -1,4 +1,4 @@
1
- import type { AssetResolver, ModelSource } from "./contracts.js";
1
+ import type { AssetResolver, ModelSource } from "../contracts.js";
2
2
  import type { InternalModel, ModelSettings } from "./model.js";
3
3
 
4
4
  /**
package/src/session.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { AssetResolver, ModelSource, SessionState } from "./contracts.js";
2
2
  import { EventEmitter } from "./events.js";
3
3
  import type { FrameSnapshot } from "./frame.js";
4
- import type { InternalModel } from "./model.js";
4
+ import type { InternalModel } from "./model/model.js";
5
5
 
6
6
  /** High-level runtime session for one mounted surface. */
7
7
  export interface Live2DSession {
@@ -1,6 +1,6 @@
1
- import type { AssetResolver, ModelSource } from "./contracts.js";
2
- import type { InternalModel, MotionDefinition } from "./model.js";
3
- import type { ModelAsset } from "./model-asset.js";
1
+ import type { AssetResolver, ModelSource } from "../contracts.js";
2
+ import type { InternalModel, MotionDefinition } from "../model/model.js";
3
+ import type { ModelAsset } from "../model/model-asset.js";
4
4
 
5
5
  /** Normalized stage placement for one actor (0,0) top-left → (1,1) bottom-right. */
6
6
  export interface ActorTransform {
@@ -145,7 +145,7 @@ export interface Live2dStage {
145
145
  readonly actors: readonly Live2dActor[];
146
146
 
147
147
  /** Shared model resource cache for multi-actor reuse. */
148
- readonly assets: import("./model-asset.js").Live2dStageAssets;
148
+ readonly assets: import("../model/model-asset.js").Live2dStageAssets;
149
149
 
150
150
  mount(canvas: HTMLCanvasElement): Promise<void>;
151
151
 
File without changes