@doki-land/live2d-widget 0.0.24 → 0.0.25
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 +4 -6
- package/dist/index.js +3 -5
- package/package.json +2 -2
- package/src/index.ts +0 -2
- package/src/shell/widget.ts +6 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Live2dStage, Live2dActor, RendererKind,
|
|
1
|
+
import { Live2dStage, Live2dActor, RendererKind, Live2dRuntime } from '@doki-land/live2d';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Optional page chrome for `@doki-land/live2d-widget`:
|
|
@@ -88,12 +88,10 @@ declare class Live2dWidget {
|
|
|
88
88
|
destroy(): void;
|
|
89
89
|
get stage(): Live2dStage | null;
|
|
90
90
|
get actor(): Live2dActor | null;
|
|
91
|
-
/** Legacy accessor when mounted via `
|
|
92
|
-
getRuntime():
|
|
91
|
+
/** Legacy accessor when mounted via `createLive2d`. */
|
|
92
|
+
getRuntime(): Live2dRuntime | null;
|
|
93
93
|
showMessage(text: string | string[], timeoutMs?: number, priority?: number): void;
|
|
94
94
|
}
|
|
95
|
-
/** @deprecated Use `Live2dWidget` — alias kept for hexo / legacy imports. */
|
|
96
|
-
declare const Live2DWidget: typeof Live2dWidget;
|
|
97
95
|
declare function createLive2dWidget(options: ComposedWidgetOptions): Promise<Live2dWidget>;
|
|
98
96
|
declare function mountWidget(options: WidgetOptions): Promise<Live2dWidget>;
|
|
99
97
|
/** Convenience bootstrap: Stage + default Actor + widget chrome. */
|
|
@@ -109,4 +107,4 @@ declare function mountWidgetWithStage(options: LegacyWidgetOptions): Promise<{
|
|
|
109
107
|
|
|
110
108
|
declare const LIVE2D_WIDGET_VERSION: "0.0.0";
|
|
111
109
|
|
|
112
|
-
export { type ComposedWidgetOptions, DEFAULT_WELCOME, LIVE2D_WIDGET_VERSION, type LegacyWidgetOptions,
|
|
110
|
+
export { type ComposedWidgetOptions, DEFAULT_WELCOME, LIVE2D_WIDGET_VERSION, type LegacyWidgetOptions, Live2dWidget, type WidgetChromeOptions, type WidgetOptions, type WidgetToolId, createLive2dWidget, createTipMessage, ensureChromeStyles, mountChrome, mountWidget, mountWidgetWithStage };
|
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ function mountChrome(options) {
|
|
|
223
223
|
// src/shell/widget.ts
|
|
224
224
|
import {
|
|
225
225
|
allocateActorId,
|
|
226
|
-
|
|
226
|
+
createLive2d,
|
|
227
227
|
createLive2dStage,
|
|
228
228
|
createRenderer,
|
|
229
229
|
focusParameterUpdates
|
|
@@ -261,7 +261,7 @@ var Live2dWidget = class {
|
|
|
261
261
|
let actor;
|
|
262
262
|
if (isLegacyOptions(options)) {
|
|
263
263
|
const prefer = normalizePrefer(options.prefer);
|
|
264
|
-
const runtime =
|
|
264
|
+
const runtime = createLive2d({
|
|
265
265
|
prefer,
|
|
266
266
|
updateMode: "auto"
|
|
267
267
|
});
|
|
@@ -341,7 +341,7 @@ var Live2dWidget = class {
|
|
|
341
341
|
get actor() {
|
|
342
342
|
return this.#actor;
|
|
343
343
|
}
|
|
344
|
-
/** Legacy accessor when mounted via `
|
|
344
|
+
/** Legacy accessor when mounted via `createLive2d`. */
|
|
345
345
|
getRuntime() {
|
|
346
346
|
return this.#runtime;
|
|
347
347
|
}
|
|
@@ -383,7 +383,6 @@ var Live2dWidget = class {
|
|
|
383
383
|
this.#chrome?.tips?.show("\u78B0\u5230\u6211\u5566\uFF5E", 2500, 4);
|
|
384
384
|
};
|
|
385
385
|
};
|
|
386
|
-
var Live2DWidget = Live2dWidget;
|
|
387
386
|
function normalizePrefer(prefer) {
|
|
388
387
|
if (!prefer?.length) return void 0;
|
|
389
388
|
const allowed = /* @__PURE__ */ new Set(["webgpu", "webgl2", "canvas2d"]);
|
|
@@ -420,7 +419,6 @@ var LIVE2D_WIDGET_VERSION = "0.0.0";
|
|
|
420
419
|
export {
|
|
421
420
|
DEFAULT_WELCOME,
|
|
422
421
|
LIVE2D_WIDGET_VERSION,
|
|
423
|
-
Live2DWidget,
|
|
424
422
|
Live2dWidget,
|
|
425
423
|
createLive2dWidget,
|
|
426
424
|
createTipMessage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@doki-land/live2d-widget",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "Live2D page widget — product chrome over Stage + Actor (no private RAF); built on @doki-land/live2d.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"test": "vitest run"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@doki-land/live2d": "0.0.
|
|
45
|
+
"@doki-land/live2d": "0.0.25"
|
|
46
46
|
},
|
|
47
47
|
"sideEffects": false
|
|
48
48
|
}
|
package/src/index.ts
CHANGED
package/src/shell/widget.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
allocateActorId,
|
|
3
|
-
|
|
3
|
+
createLive2d,
|
|
4
4
|
createLive2dStage,
|
|
5
5
|
createRenderer,
|
|
6
6
|
focusParameterUpdates,
|
|
7
|
-
type Live2DRuntime,
|
|
8
7
|
type Live2dActor,
|
|
8
|
+
type Live2dRuntime,
|
|
9
9
|
type Live2dStage,
|
|
10
10
|
type RendererKind,
|
|
11
11
|
} from "@doki-land/live2d";
|
|
@@ -64,7 +64,7 @@ export class Live2dWidget {
|
|
|
64
64
|
#canvas: HTMLCanvasElement | null = null;
|
|
65
65
|
#stage: Live2dStage | null = null;
|
|
66
66
|
#actor: Live2dActor | null = null;
|
|
67
|
-
#runtime:
|
|
67
|
+
#runtime: Live2dRuntime | null = null;
|
|
68
68
|
#chrome: ChromeSession | null = null;
|
|
69
69
|
#unsubFrame: (() => void) | null = null;
|
|
70
70
|
#autoSway = true;
|
|
@@ -98,7 +98,7 @@ export class Live2dWidget {
|
|
|
98
98
|
let actor: Live2dActor;
|
|
99
99
|
if (isLegacyOptions(options)) {
|
|
100
100
|
const prefer = normalizePrefer(options.prefer);
|
|
101
|
-
const runtime =
|
|
101
|
+
const runtime = createLive2d({
|
|
102
102
|
prefer,
|
|
103
103
|
updateMode: "auto",
|
|
104
104
|
});
|
|
@@ -190,8 +190,8 @@ export class Live2dWidget {
|
|
|
190
190
|
return this.#actor;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
/** Legacy accessor when mounted via `
|
|
194
|
-
getRuntime():
|
|
193
|
+
/** Legacy accessor when mounted via `createLive2d`. */
|
|
194
|
+
getRuntime(): Live2dRuntime | null {
|
|
195
195
|
return this.#runtime;
|
|
196
196
|
}
|
|
197
197
|
|
|
@@ -241,9 +241,6 @@ export class Live2dWidget {
|
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
/** @deprecated Use `Live2dWidget` — alias kept for hexo / legacy imports. */
|
|
245
|
-
export const Live2DWidget = Live2dWidget;
|
|
246
|
-
|
|
247
244
|
function normalizePrefer(
|
|
248
245
|
prefer: RendererKind[] | undefined,
|
|
249
246
|
): RendererKind[] | undefined {
|