@doki-land/live2d-core 0.0.16 → 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/dist/index.d.ts +6 -0
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/{detect-format.ts → format/detect-format.ts} +1 -1
- package/src/index.ts +11 -5
- package/src/{model-asset.ts → model/model-asset.ts} +1 -1
- package/src/session.ts +1 -1
- package/src/{stage.ts → stage/stage.ts} +4 -4
- /package/src/{model.ts → model/model.ts} +0 -0
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
|
@@ -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 "
|
|
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;
|
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 "
|
|
2
|
-
import type { InternalModel, MotionDefinition } from "
|
|
3
|
-
import type { ModelAsset } from "
|
|
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("
|
|
148
|
+
readonly assets: import("../model/model-asset.js").Live2dStageAssets;
|
|
149
149
|
|
|
150
150
|
mount(canvas: HTMLCanvasElement): Promise<void>;
|
|
151
151
|
|
|
File without changes
|