@inupedia/spotlight-vue 0.9.0 → 0.9.2

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 (32) hide show
  1. package/dist/assets/spotlight-vue.css +1 -1
  2. package/dist/avatar/speech/spotlightSpeech.d.ts.map +1 -1
  3. package/dist/avatar/speech/spotlightSpeech.js +20 -31
  4. package/dist/avatar/voice/micAccess.d.ts +4 -0
  5. package/dist/avatar/voice/micAccess.d.ts.map +1 -0
  6. package/dist/avatar/voice/micAccess.js +26 -0
  7. package/dist/avatar/voice/phonePairing.d.ts +14 -0
  8. package/dist/avatar/voice/phonePairing.d.ts.map +1 -0
  9. package/dist/avatar/voice/phonePairing.js +30 -0
  10. package/dist/avatar/voice/usePhoneVoicePairing.d.ts +17 -0
  11. package/dist/avatar/voice/usePhoneVoicePairing.d.ts.map +1 -0
  12. package/dist/avatar/voice/usePhoneVoicePairing.js +88 -0
  13. package/dist/components/Live2dPanel.vue.d.ts +20 -0
  14. package/dist/components/Live2dPanel.vue.d.ts.map +1 -1
  15. package/dist/components/Live2dPanel.vue.js +1 -1
  16. package/dist/components/Live2dPanel2.vue.js +167 -62
  17. package/dist/components/SpotlightCommandPanel.vue.d.ts.map +1 -1
  18. package/dist/components/SpotlightCommandPanel.vue.js +1 -1
  19. package/dist/components/SpotlightCommandPanel2.vue.js +337 -191
  20. package/dist/components/SpotlightShell.vue.d.ts.map +1 -1
  21. package/dist/components/SpotlightShell.vue.js +2 -2
  22. package/dist/components/SpotlightShell2.vue.js +268 -255
  23. package/dist/node_modules/.pnpm/uqr@0.1.3/node_modules/uqr/dist/index.js +504 -0
  24. package/dist/remote/runPipeline.d.ts.map +1 -1
  25. package/dist/remote/runPipeline.js +103 -97
  26. package/dist/store/index.d.ts +1 -0
  27. package/dist/store/index.d.ts.map +1 -1
  28. package/dist/store/index.js +15 -13
  29. package/dist/store/modelStore.d.ts +16 -0
  30. package/dist/store/modelStore.d.ts.map +1 -0
  31. package/dist/store/modelStore.js +63 -0
  32. package/package.json +5 -3
@@ -1,57 +1,87 @@
1
- import { defineComponent as x, ref as V, computed as k, watch as E, onMounted as A, onUnmounted as B, openBlock as p, createElementBlock as m, createElementVNode as e, unref as o, normalizeClass as y, toDisplayString as c, createCommentVNode as L, createVNode as I, Transition as N, withCtx as z } from "vue";
2
- import { storeToRefs as M } from "pinia";
3
- import { startLive2dApp as P, stopLive2dApp as R } from "../avatar/spine/live2dApp.js";
4
- import { configureSpineAvatar as U } from "../avatar/spine/spineAvatar.js";
5
- import { useSpotlightAvatarConfig as $ } from "../avatar/config.js";
6
- import { useLive2dSpeechStore as j } from "../store/live2dSpeechStore.js";
7
- import { useLive2dVoiceChannelStore as q } from "../store/live2dVoiceChannelStore.js";
8
- const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls" }, H = ["disabled", "aria-label"], J = { class: "live2d-voice-label" }, K = {
9
- key: 0,
10
- class: "live2d-voice-error",
11
- role: "alert"
12
- }, O = { class: "live2d-speech-head" }, Q = { class: "live2d-speech-text" }, ne = /* @__PURE__ */ x({
1
+ import { defineComponent as Q, ref as U, computed as g, watch as z, onMounted as H, onUnmounted as O, openBlock as a, createElementBlock as r, createElementVNode as e, unref as p, normalizeClass as k, toDisplayString as d, createCommentVNode as u, createBlock as x, Teleport as B, withModifiers as D, createVNode as q, Transition as R, withCtx as j } from "vue";
2
+ import { storeToRefs as F } from "pinia";
3
+ import { startLive2dApp as G, stopLive2dApp as J } from "../avatar/spine/live2dApp.js";
4
+ import { configureSpineAvatar as K } from "../avatar/spine/spineAvatar.js";
5
+ import { useSpotlightAvatarConfig as W } from "../avatar/config.js";
6
+ import { useLive2dSpeechStore as X } from "../store/live2dSpeechStore.js";
7
+ import { useLive2dVoiceChannelStore as Y } from "../store/live2dVoiceChannelStore.js";
8
+ const Z = { class: "live2d-panel-shell" }, _ = { class: "live2d-voice-controls" }, ee = ["disabled", "aria-label"], ie = { class: "live2d-voice-label" }, te = {
9
+ class: "live2d-phone-panel",
10
+ role: "dialog",
11
+ "aria-modal": "true",
12
+ "aria-label": "手机语音遥控器"
13
+ }, oe = { class: "live2d-phone-header" }, le = { class: "live2d-phone-actions" }, ne = ["disabled"], ae = ["disabled"], se = ["innerHTML"], re = { class: "live2d-phone-status" }, de = {
14
+ class: "live2d-notice",
15
+ role: "alertdialog",
16
+ "aria-modal": "true",
17
+ "aria-labelledby": "live2d-notice-title"
18
+ }, ce = { class: "live2d-notice-body" }, ve = { class: "live2d-speech-head" }, pe = { class: "live2d-speech-text" }, ke = /* @__PURE__ */ Q({
13
19
  __name: "Live2dPanel",
14
20
  props: {
15
21
  voiceDisabled: { type: Boolean, default: !1 },
16
- voiceError: { default: "" }
22
+ voiceError: { default: "" },
23
+ phonePairAvailable: { type: Boolean, default: !1 },
24
+ phonePairOpen: { type: Boolean, default: !1 },
25
+ phonePairQr: { default: "" },
26
+ phonePairUrl: { default: "" },
27
+ phonePairError: { default: "" },
28
+ phoneConnected: { type: Boolean, default: !1 }
17
29
  },
18
- emits: ["voiceStart", "voiceStop", "close"],
19
- setup(r, { emit: w }) {
20
- const b = r, d = w, f = j(), t = q(), g = $(), { message: h, speaking: C, revealInstant: D } = M(f), n = V("");
21
- let s = null;
22
- const T = k(() => C.value || h.value.trim().length > 0), S = k(() => t.recording ? "点击发送" : t.transcribing ? "正在识别…" : b.voiceDisabled ? "Spotlight 忙碌中" : "点击说话");
23
- function _(a) {
24
- b.voiceDisabled || t.transcribing || (a.preventDefault(), t.recording ? d("voiceStop") : d("voiceStart"));
30
+ emits: ["voiceStart", "voiceStop", "close", "phonePair", "phonePairClose", "dismissError", "dismissPairError"],
31
+ setup(t, { emit: A }) {
32
+ const o = t, l = A, P = X(), s = Y(), C = W(), { message: w, speaking: T, revealInstant: V } = F(P), c = U(""), m = U(!1);
33
+ let h = null, v = null;
34
+ const S = g(
35
+ () => o.voiceError.trim() || o.phonePairError.trim()
36
+ ), M = g(() => T.value || w.value.trim().length > 0), E = g(() => s.recording ? "点击发送" : s.transcribing ? "正在识别…" : o.voiceDisabled ? "Spotlight 忙碌中" : "点击说话");
37
+ function N(b) {
38
+ o.voiceDisabled || s.transcribing || (b.preventDefault(), s.recording ? l("voiceStop") : l("voiceStart"));
25
39
  }
26
- function v() {
27
- s != null && (window.clearInterval(s), s = null);
40
+ function L() {
41
+ o.voiceError.trim() ? l("dismissError") : l("dismissPairError");
28
42
  }
29
- return E(
30
- () => [h.value, D.value],
31
- ([a, i]) => {
32
- v();
33
- const l = a.trim();
34
- if (!l) {
35
- n.value = "";
43
+ function $() {
44
+ o.phonePairUrl && window.open(o.phonePairUrl, "spotlight-voice-remote");
45
+ }
46
+ async function I() {
47
+ if (o.phonePairUrl)
48
+ try {
49
+ await navigator.clipboard.writeText(o.phonePairUrl), m.value = !0, v != null && window.clearTimeout(v), v = window.setTimeout(() => {
50
+ m.value = !1;
51
+ }, 1600);
52
+ } catch {
53
+ window.prompt("复制遥控器链接", o.phonePairUrl);
54
+ }
55
+ }
56
+ function f() {
57
+ h != null && (window.clearInterval(h), h = null);
58
+ }
59
+ return z(
60
+ () => [w.value, V.value],
61
+ ([b, i]) => {
62
+ f();
63
+ const n = b.trim();
64
+ if (!n) {
65
+ c.value = "";
36
66
  return;
37
67
  }
38
68
  if (i) {
39
- n.value = l;
69
+ c.value = n;
40
70
  return;
41
71
  }
42
- n.value = "";
43
- let u = 0;
44
- s = window.setInterval(() => {
45
- u += 1, n.value = l.slice(0, u), u >= l.length && v();
72
+ c.value = "";
73
+ let y = 0;
74
+ h = window.setInterval(() => {
75
+ y += 1, c.value = n.slice(0, y), y >= n.length && f();
46
76
  }, 24);
47
77
  },
48
78
  { immediate: !0 }
49
- ), A(async () => {
50
- U(g), await P();
51
- }), B(() => {
52
- v(), f.reset(), R();
53
- }), (a, i) => (p(), m("div", F, [
54
- i[3] || (i[3] = e("div", {
79
+ ), H(async () => {
80
+ K(C), await G();
81
+ }), O(() => {
82
+ f(), v != null && window.clearTimeout(v), P.reset(), J();
83
+ }), (b, i) => (a(), r("div", Z, [
84
+ i[9] || (i[9] = e("div", {
55
85
  id: "live2d-container",
56
86
  class: "live2d-panel",
57
87
  "aria-label": "Live2D"
@@ -61,19 +91,19 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
61
91
  class: "live2d-close",
62
92
  "aria-label": "关闭数字人",
63
93
  title: "关闭数字人(Ctrl/Command + L 可再次打开)",
64
- onClick: i[0] || (i[0] = (l) => d("close"))
94
+ onClick: i[0] || (i[0] = (n) => l("close"))
65
95
  }, " × "),
66
- e("div", G, [
96
+ e("div", _, [
67
97
  e("button", {
68
98
  type: "button",
69
- class: y(["live2d-voice-button", {
70
- "is-recording": o(t).recording,
71
- "is-transcribing": o(t).transcribing
99
+ class: k(["live2d-voice-button", {
100
+ "is-recording": p(s).recording,
101
+ "is-transcribing": p(s).transcribing
72
102
  }]),
73
- disabled: r.voiceDisabled || o(t).transcribing,
74
- "aria-label": S.value,
75
- onClick: _
76
- }, [...i[1] || (i[1] = [
103
+ disabled: t.voiceDisabled || p(s).transcribing,
104
+ "aria-label": E.value,
105
+ onClick: N
106
+ }, [...i[4] || (i[4] = [
77
107
  e("span", {
78
108
  class: "live2d-voice-ring",
79
109
  "aria-hidden": "true"
@@ -82,22 +112,97 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
82
112
  class: "live2d-mic-icon",
83
113
  "aria-hidden": "true"
84
114
  }, null, -1)
85
- ])], 10, H),
86
- e("span", J, c(S.value), 1),
87
- r.voiceError ? (p(), m("span", K, c(r.voiceError), 1)) : L("", !0)
115
+ ])], 10, ee),
116
+ e("span", ie, d(E.value), 1),
117
+ t.phonePairAvailable ? (a(), r("button", {
118
+ key: 0,
119
+ type: "button",
120
+ class: k(["live2d-phone-button", { "is-connected": t.phoneConnected }]),
121
+ "aria-label": "用手机说话",
122
+ onClick: i[1] || (i[1] = (n) => l("phonePair"))
123
+ }, " 用手机说话 ", 2)) : u("", !0)
88
124
  ]),
89
- I(N, { name: "speech-bubble" }, {
90
- default: z(() => [
91
- T.value ? (p(), m("div", {
125
+ (a(), x(B, { to: "body" }, [
126
+ t.phonePairOpen ? (a(), r("div", {
127
+ key: 0,
128
+ class: "live2d-phone-overlay",
129
+ onClick: i[3] || (i[3] = D((n) => l("phonePairClose"), ["self"]))
130
+ }, [
131
+ e("div", te, [
132
+ e("header", oe, [
133
+ i[5] || (i[5] = e("div", { class: "live2d-phone-title-stack" }, [
134
+ e("span", { class: "live2d-phone-kicker" }, "Spotlight"),
135
+ e("span", { class: "live2d-phone-title" }, "手机遥控器")
136
+ ], -1)),
137
+ e("button", {
138
+ type: "button",
139
+ class: "live2d-phone-close",
140
+ "aria-label": "关闭手机二维码",
141
+ onClick: i[2] || (i[2] = (n) => l("phonePairClose"))
142
+ }, " × ")
143
+ ]),
144
+ i[6] || (i[6] = e("p", { class: "live2d-phone-hint" }, " 用手机扫码打开遥控器,即可对着手机说话控制大屏。微信扫完后请选「用浏览器打开」。 ", -1)),
145
+ e("div", le, [
146
+ e("button", {
147
+ type: "button",
148
+ class: "live2d-phone-primary",
149
+ disabled: !t.phonePairUrl,
150
+ onClick: $
151
+ }, " 本机打开遥控器 ", 8, ne),
152
+ e("button", {
153
+ type: "button",
154
+ class: "live2d-phone-secondary",
155
+ disabled: !t.phonePairUrl,
156
+ onClick: I
157
+ }, d(m.value ? "已复制" : "复制链接"), 9, ae)
158
+ ]),
159
+ t.phonePairQr ? (a(), r("div", {
160
+ key: 0,
161
+ class: "live2d-phone-qr",
162
+ innerHTML: t.phonePairQr
163
+ }, null, 8, se)) : u("", !0),
164
+ e("p", re, d(t.phoneConnected ? "手机已连接,对着遥控器说话即可" : "等待遥控器连接"), 1)
165
+ ])
166
+ ])) : u("", !0)
167
+ ])),
168
+ (a(), x(B, { to: "body" }, [
169
+ S.value ? (a(), r("div", {
170
+ key: 0,
171
+ class: "live2d-notice-overlay",
172
+ onClick: D(L, ["self"])
173
+ }, [
174
+ e("div", de, [
175
+ i[7] || (i[7] = e("header", { class: "live2d-notice-header" }, [
176
+ e("div", { class: "live2d-phone-title-stack" }, [
177
+ e("span", { class: "live2d-phone-kicker" }, "Spotlight"),
178
+ e("span", {
179
+ id: "live2d-notice-title",
180
+ class: "live2d-phone-title"
181
+ }, "提示")
182
+ ])
183
+ ], -1)),
184
+ e("p", ce, d(S.value), 1),
185
+ e("button", {
186
+ type: "button",
187
+ class: "live2d-notice-ok",
188
+ autofocus: "",
189
+ onClick: L
190
+ }, " 知道了 ")
191
+ ])
192
+ ])) : u("", !0)
193
+ ])),
194
+ q(R, { name: "speech-bubble" }, {
195
+ default: j(() => [
196
+ M.value ? (a(), r("div", {
92
197
  key: 0,
93
- class: y(["live2d-speech-bubble", { "is-speaking": o(C) }])
198
+ class: k(["live2d-speech-bubble", { "is-speaking": p(T) }])
94
199
  }, [
95
- e("div", O, [
96
- i[2] || (i[2] = e("span", { class: "live2d-speech-dot" }, null, -1)),
97
- e("span", null, c(o(g).bubbleTitle ?? "数字人"), 1)
200
+ e("div", ve, [
201
+ i[8] || (i[8] = e("span", { class: "live2d-speech-dot" }, null, -1)),
202
+ e("span", null, d(p(C).bubbleTitle ?? "数字人"), 1)
98
203
  ]),
99
- e("p", Q, c(n.value), 1)
100
- ], 2)) : L("", !0)
204
+ e("p", pe, d(c.value), 1)
205
+ ], 2)) : u("", !0)
101
206
  ]),
102
207
  _: 1
103
208
  })
@@ -105,5 +210,5 @@ const F = { class: "live2d-panel-shell" }, G = { class: "live2d-voice-controls"
105
210
  }
106
211
  });
107
212
  export {
108
- ne as default
213
+ ke as default
109
214
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SpotlightCommandPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/SpotlightCommandPanel.vue"],"names":[],"mappings":"AA4QA,KAAK,WAAW,GAAG;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAgCJ,iBAAS,UAAU,SAElB;AA6YD,QAAA,MAAM,YAAY;;;gBAnbD,MAAM;qBACD,OAAO;mBACT,OAAO;mBACP,MAAM;6EAobxB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"SpotlightCommandPanel.vue.d.ts","sourceRoot":"","sources":["../../src/components/SpotlightCommandPanel.vue"],"names":[],"mappings":"AAqbA,KAAK,WAAW,GAAG;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAsEJ,iBAAS,UAAU,SAElB;AA8mBD,QAAA,MAAM,YAAY;;;gBA1rBD,MAAM;qBACD,OAAO;mBACT,OAAO;mBACP,MAAM;6EA2rBxB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./SpotlightCommandPanel2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b381bab1"]]);
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ec5c37ab"]]);
5
5
  export {
6
6
  r as default
7
7
  };