@vosjs/studio-core 0.7.0 → 0.7.1

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.js CHANGED
@@ -1813,7 +1813,11 @@ var STUDIO_SETUP = `async (ctx) => {
1813
1813
  if (olv && olv.length && typeof FontFace !== 'undefined') {
1814
1814
  try {
1815
1815
  const faces = ctx.data.overlayFonts || ${JSON.stringify(OVERLAY_FONT_FACES)}
1816
+ // Mark what SETUP registers, so ON_FRAME's live path (a text overlay
1817
+ // arriving through SET_DATA) never adds the same face twice.
1818
+ const ofSet = window.__voilaFontSet || (window.__voilaFontSet = {})
1816
1819
  const loads = faces.map((f) => {
1820
+ ofSet[f.family + '|' + f.weight] = 1
1817
1821
  const ff = new FontFace(f.family, 'url(' + f.url + ')', { weight: String(f.weight) })
1818
1822
  document.fonts.add(ff)
1819
1823
  return ff.load()
@@ -2273,20 +2277,37 @@ var STUDIO_FRAME = `(ctx, content, dt) => {
2273
2277
  continue
2274
2278
  }
2275
2279
  var olPx = ol.fs * olMS * s
2276
- // Live style edits: SET_DATA never re-runs SETUP, so an override face
2277
- // arriving mid-session lazy-loads here (fail-open; frames repaint as it
2278
- // lands). Cold loads (export) awaited the full list in SETUP already.
2279
- if (ol.face && typeof FontFace !== 'undefined') {
2280
+ // Faces arriving LIVE: SET_DATA never re-runs SETUP, so the first text
2281
+ // overlay a session gains registers the house faces here (a title added
2282
+ // to a fresh document used to paint in the stack's system fallback until
2283
+ // the next cold load), and an override face lazy-loads the same way.
2284
+ // Keyed per window, so SETUP's cold-load faces and repeat frames never
2285
+ // re-register; fail-open, frames repaint as each face lands.
2286
+ if (typeof FontFace !== 'undefined') {
2280
2287
  var ofSet = window.__voilaFontSet || (window.__voilaFontSet = {})
2281
- var ofKey = ol.face.f + '|' + ol.face.w
2282
- if (!ofSet[ofKey]) {
2283
- ofSet[ofKey] = 1
2288
+ var ofBase = d.overlayFonts || ${JSON.stringify(OVERLAY_FONT_FACES)}
2289
+ for (var ofi = 0; ofi < ofBase.length; ofi++) {
2290
+ var ofB = ofBase[ofi]
2291
+ var ofBK = ofB.family + '|' + ofB.weight
2292
+ if (ofSet[ofBK]) continue
2293
+ ofSet[ofBK] = 1
2284
2294
  try {
2285
- var ofFace = new FontFace(ol.face.f, 'url(' + ol.face.u + ')', { weight: String(ol.face.w) })
2286
- document.fonts.add(ofFace)
2287
- ofFace.load().catch(function () {})
2295
+ var ofBF = new FontFace(ofB.family, 'url(' + ofB.url + ')', { weight: String(ofB.weight) })
2296
+ document.fonts.add(ofBF)
2297
+ ofBF.load().catch(function () {})
2288
2298
  } catch (e) {}
2289
2299
  }
2300
+ if (ol.face) {
2301
+ var ofKey = ol.face.f + '|' + ol.face.w
2302
+ if (!ofSet[ofKey]) {
2303
+ ofSet[ofKey] = 1
2304
+ try {
2305
+ var ofFace = new FontFace(ol.face.f, 'url(' + ol.face.u + ')', { weight: String(ol.face.w) })
2306
+ document.fonts.add(ofFace)
2307
+ ofFace.load().catch(function () {})
2308
+ } catch (e) {}
2309
+ }
2310
+ }
2290
2311
  }
2291
2312
  ovC.save()
2292
2313
  ovC.globalAlpha = olA