@7ots/cli 0.1.36 → 0.1.37
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/cli/pet/electron/main.cjs +8 -3
- package/cli/pet/pet.html +4 -3
- package/dist/7ots.esm.js +18 -17
- package/dist/7ots.esm.js.map +4 -4
- package/dist/7ots.iife.js +52 -51
- package/dist/7ots.iife.js.map +4 -4
- package/package.json +1 -1
- package/src/character3d/stage.js +7 -2
- package/src/index.js +1 -0
|
@@ -259,7 +259,10 @@ function makeOt(opt = {}) {
|
|
|
259
259
|
session.defaultSession.setPermissionRequestHandler((wc, perm, cb, d) => cb(perm === 'media' && ours(d?.requestingUrl || wc.getURL())));
|
|
260
260
|
session.defaultSession.setPermissionCheckHandler((wc, perm, origin) => perm === 'media' && ours(origin));
|
|
261
261
|
const alive = () => !win.isDestroyed();
|
|
262
|
-
|
|
262
|
+
// While the page loads (a reload after the settings, 2D ↔ 3D) executeJavaScript waits for it on a
|
|
263
|
+
// did-stop-loading listener of its own: the 60 ms timers piled them up (MaxListenersExceededWarning)
|
|
264
|
+
const ready = () => alive() && !win.webContents.isLoadingMainFrame();
|
|
265
|
+
const page = (js) => ready() && win.webContents.executeJavaScript(js).catch(() => {});
|
|
263
266
|
|
|
264
267
|
let still = false;
|
|
265
268
|
let lastBounds = null;
|
|
@@ -528,13 +531,15 @@ function makeOt(opt = {}) {
|
|
|
528
531
|
window.__goal = null;
|
|
529
532
|
return { rects: out, goal, need: window.__need?.(), busy: document.body.classList.contains('talking') || document.body.classList.contains('listening') || !!document.querySelector('.bubble.on'), asleep: document.body.classList.contains('asleep') };
|
|
530
533
|
})()`;
|
|
534
|
+
let hitting = false; // one at a time: a busy renderer doesn't get a queue of them
|
|
531
535
|
const hitTimer = setInterval(() => {
|
|
532
|
-
if (!
|
|
536
|
+
if (!ready() || hitting) return;
|
|
537
|
+
hitting = true;
|
|
533
538
|
win.webContents.executeJavaScript(HIT).then((r) => {
|
|
534
539
|
({ rects, busy, asleep } = r);
|
|
535
540
|
need = r.need || null;
|
|
536
541
|
if (r.goal) goTo(r.goal);
|
|
537
|
-
}).catch(() => {});
|
|
542
|
+
}).catch(() => {}).finally(() => (hitting = false));
|
|
538
543
|
}, 120);
|
|
539
544
|
|
|
540
545
|
// Click-through: only the ot, its buttons and the talk box take the mouse; the transparent rest lets
|
package/cli/pet/pet.html
CHANGED
|
@@ -301,14 +301,14 @@
|
|
|
301
301
|
$('#brain').innerHTML = '';
|
|
302
302
|
$('#brain').append(t('brain', { b: '' }), Object.assign(document.createElement('b'), { textContent: BOOT.brain === 'lines' ? t('lines') : BOOT.brain }));
|
|
303
303
|
|
|
304
|
-
const { createCharacter, loadCharacter3D, playBeat, DANCES = [], DANCE_STYLE = {}, AURA_MOVES = [], AURA_STYLE = {} } = await import('/dist/7ots.esm.js');
|
|
304
|
+
const { createCharacter, loadCharacter3D, playBeat, stripMarkdown = (x) => x, DANCES = [], DANCE_STYLE = {}, AURA_MOVES = [], AURA_STYLE = {} } = await import('/dist/7ots.esm.js');
|
|
305
305
|
const spec = id.look?.character || {};
|
|
306
306
|
let ch = null;
|
|
307
307
|
if (new URLSearchParams(location.search).has('3d')) {
|
|
308
308
|
// three comes from the CDN; without WebGL or network the 2D ot takes over
|
|
309
309
|
try {
|
|
310
310
|
const m = await loadCharacter3D();
|
|
311
|
-
ch = m.createCharacter3D($('#face'), spec, { material: id.look?.material || 'plush', backdrop: !desktop && BOOT.backdrop !== false, orbit: !desktop, bleed: desktop ? 'window' : 0, stage: { key: 'pet', zIndex: 3, maxDpr: 2, minDpr: 1.25, supersample: desktop } });
|
|
311
|
+
ch = m.createCharacter3D($('#face'), spec, { material: id.look?.material || 'plush', backdrop: !desktop && BOOT.backdrop !== false, orbit: !desktop, bleed: desktop ? 'window' : 0, stage: { key: 'pet', zIndex: 3, maxDpr: 2, minDpr: 1.25, supersample: desktop, fps: desktop ? 30 : 0 } });
|
|
312
312
|
if (ch.fallback) console.warn('[7ots pet] no WebGL: 2D ot');
|
|
313
313
|
} catch (err) {
|
|
314
314
|
console.warn('[7ots pet] 3D ot unavailable, using 2D:', err?.message || err);
|
|
@@ -684,7 +684,8 @@
|
|
|
684
684
|
ch.gesture(Math.random() < 0.5 ? 'nod' : 'wiggle');
|
|
685
685
|
}
|
|
686
686
|
// speech tags ([laugh], <whisper>…: settings → Voice → expressions) go to the voice, never to the bubble (as src/voice/tags.js)
|
|
687
|
-
|
|
687
|
+
// what is said: no markdown ("## Hoteles", "**4.5**", "---") nor voice tags
|
|
688
|
+
const clean = (t) => stripMarkdown(String(t ?? '')).replace(/<\/?(loud|soft|whisper|fast|slow|singing)>/gi, '').replace(/\s*\[(pause|long-pause|laugh|cry|mouth-click|breath|sigh)\]\s*/gi, ' ').replace(/\s{2,}/g, ' ').trim();
|
|
688
689
|
function say(raw, withFace = false, ambient = false, photo = null) {
|
|
689
690
|
if (ambient && speak.cur && speak.reply) return void alog('skip ambient (an answer is playing)'); // small talk waits for the answer to finish
|
|
690
691
|
const text = clean(raw);
|