@bluepic/embed 0.6.22 → 0.6.23

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/main.mjs CHANGED
@@ -61025,112 +61025,121 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61025
61025
  ],
61026
61026
  setup(e, { expose: t, emit: n }) {
61027
61027
  let r = e, i = n, o = l(() => r.fieldHitboxes ?? []), s = l(() => {
61028
- if (_.value && D.value) return D.value.y * g.value.x + D.value.x + 1;
61028
+ if (y.value && O.value) return O.value.y * _.value.x + O.value.x + 1;
61029
61029
  }), c = B({
61030
61030
  translateX: 0,
61031
61031
  translateY: 0,
61032
61032
  scale: 1,
61033
61033
  rotate: 0
61034
- }), u = T("data"), h = B(), g = l(() => r.serial?.frames ?? {
61034
+ });
61035
+ function u(e) {
61036
+ [
61037
+ e.translateX,
61038
+ e.translateY,
61039
+ e.scale,
61040
+ e.rotate
61041
+ ].every(Number.isFinite) && (c.value = e);
61042
+ }
61043
+ let h = T("data"), g = B(), _ = l(() => r.serial?.frames ?? {
61035
61044
  x: 1,
61036
61045
  y: 1
61037
- }), _ = l(() => Object.values(g.value).reduce((e, t) => t * e, 1) > 1), y = B(), b = B(), { width: x, height: S } = io(b), { focusFrame: C, frameFocusScaleDiff: w, currentlyFocusedFrame: D, getFrameTransform: O, tiles: k } = qR(c, l(() => r.serial?.frames ?? {
61046
+ }), y = l(() => Object.values(_.value).reduce((e, t) => t * e, 1) > 1), b = B(), x = B(), { width: S, height: C } = io(x), { focusFrame: w, frameFocusScaleDiff: D, currentlyFocusedFrame: O, getFrameTransform: k, tiles: j } = qR(c, l(() => r.serial?.frames ?? {
61038
61047
  x: 1,
61039
61048
  y: 1
61040
- }), l(() => y.value?.canvasWidth ?? 0), l(() => y.value?.canvasHeight ?? 0), x, S), j = l(() => {
61049
+ }), l(() => b.value?.canvasWidth ?? 0), l(() => b.value?.canvasHeight ?? 0), S, C), M = l(() => {
61041
61050
  if (r.serial) return r.serial.width / r.serial.height;
61042
- }), M = l(() => {
61043
- if (y.value?.zoompinchEngine) return y.value.zoompinchEngine.wrapperBounds.width / y.value.zoompinchEngine.wrapperBounds.height;
61044
61051
  }), N = l(() => {
61045
- if (j.value && M.value) return j.value > M.value ? "width" : "height";
61052
+ if (b.value?.zoompinchEngine) return b.value.zoompinchEngine.wrapperBounds.width / b.value.zoompinchEngine.wrapperBounds.height;
61053
+ }), P = l(() => {
61054
+ if (M.value && N.value) return M.value > N.value ? "width" : "height";
61046
61055
  });
61047
61056
  l(() => {
61048
- if (y.value?.zoompinchEngine && j.value) return N.value === "height" ? 1 : y.value.zoompinchEngine.wrapperBounds.height / y.value.zoompinchEngine.wrapperBounds.width;
61057
+ if (b.value?.zoompinchEngine && M.value) return P.value === "height" ? 1 : b.value.zoompinchEngine.wrapperBounds.height / b.value.zoompinchEngine.wrapperBounds.width;
61049
61058
  }), l(() => {
61050
- if (y.value?.zoompinchEngine && j.value) return N.value === "width" ? 1 : y.value.zoompinchEngine.wrapperBounds.width / y.value.zoompinchEngine.wrapperBounds.height;
61059
+ if (b.value?.zoompinchEngine && M.value) return P.value === "width" ? 1 : b.value.zoompinchEngine.wrapperBounds.width / b.value.zoompinchEngine.wrapperBounds.height;
61051
61060
  });
61052
- let P = l(() => {
61053
- if (!y.value?.zoompinchEngine) return;
61054
- let [e, t] = y.value.zoompinchEngine.calcProjectionTranslate(1, [.5, .5], [.5, .5]);
61061
+ let F = l(() => {
61062
+ if (!b.value?.zoompinchEngine) return;
61063
+ let [e, t] = b.value.zoompinchEngine.calcProjectionTranslate(1, [.5, .5], [.5, .5]);
61055
61064
  return c.value.scale !== 1 || c.value.translateX !== e || c.value.translateY !== t || c.value.rotate !== 0;
61056
- }), F = () => {
61057
- y.value?.applyTransform(1, [.5, .5], [.5, .5]);
61058
- }, I;
61059
- function te() {
61060
- F(), requestAnimationFrame(F), clearTimeout(I), I = setTimeout(F, 160);
61065
+ }), I = () => {
61066
+ b.value?.applyTransform(1, [.5, .5], [.5, .5]);
61067
+ }, te;
61068
+ function R() {
61069
+ I(), requestAnimationFrame(I), clearTimeout(te), te = setTimeout(I, 160);
61061
61070
  }
61062
- ee(() => clearTimeout(I)), W(() => r.zoomAndPan, (e) => {
61063
- !e && P.value && F();
61071
+ ee(() => clearTimeout(te)), W(() => r.zoomAndPan, (e) => {
61072
+ !e && F.value && I();
61064
61073
  });
61065
- function R(e, t) {
61066
- let n = D.value?.y ?? 0;
61067
- C(e, n), t.stopPropagation();
61068
- }
61069
61074
  function ne(e, t) {
61070
- let n = D.value?.x ?? 0;
61071
- C(n, e), t.stopPropagation();
61075
+ let n = O.value?.y ?? 0;
61076
+ w(e, n), t.stopPropagation();
61077
+ }
61078
+ function V(e, t) {
61079
+ let n = O.value?.x ?? 0;
61080
+ w(n, e), t.stopPropagation();
61072
61081
  }
61073
- function V({ clientX: e, clientY: t }) {
61082
+ function ie({ clientX: e, clientY: t }) {
61074
61083
  if (r.editingElementId) return;
61075
- let n = y.value?.normalizeClientCoords(e, t);
61084
+ let n = b.value?.normalizeClientCoords(e, t);
61076
61085
  if (!n) return console.error("no matrix coords. This should not happen");
61077
- let i = k.value.findIndex((e) => e.x <= n[0] && e.x + e.width >= n[0] && e.y <= n[1] && e.y + e.height >= n[1]), a = i % g.value.x, o = Math.floor(i / g.value.x);
61078
- if (D.value) {
61079
- let e = O(a, o), t = ja(e?.scale ?? 0, 6) === ja(c.value.scale, 6), n = ja(e?.x ?? 0, 6) === ja(c.value.translateX, 6), r = ja(e?.y ?? 0, 6) === ja(c.value.translateY, 6);
61080
- t && n && r ? F() : (console.log(Math.min(Math.max(0, a), g.value.x - 1), Math.min(Math.max(0, o), g.value.y - 1)), C(Math.min(Math.max(0, a), g.value.x - 1), Math.min(Math.max(0, o), g.value.y - 1)));
61081
- } else C(Math.min(Math.max(1, a), g.value.x), Math.min(Math.max(1, o), g.value.y));
61082
- }
61083
- let ie = B(), ae = B(0), oe = (e) => {
61084
- ae.value = Math.max(ae.value, e.touches.length);
61085
- }, se = (e) => {
61086
+ let i = j.value.findIndex((e) => e.x <= n[0] && e.x + e.width >= n[0] && e.y <= n[1] && e.y + e.height >= n[1]), a = i % _.value.x, o = Math.floor(i / _.value.x);
61087
+ if (O.value) {
61088
+ let e = k(a, o), t = ja(e?.scale ?? 0, 6) === ja(c.value.scale, 6), n = ja(e?.x ?? 0, 6) === ja(c.value.translateX, 6), r = ja(e?.y ?? 0, 6) === ja(c.value.translateY, 6);
61089
+ t && n && r ? I() : (console.log(Math.min(Math.max(0, a), _.value.x - 1), Math.min(Math.max(0, o), _.value.y - 1)), w(Math.min(Math.max(0, a), _.value.x - 1), Math.min(Math.max(0, o), _.value.y - 1)));
61090
+ } else w(Math.min(Math.max(1, a), _.value.x), Math.min(Math.max(1, o), _.value.y));
61091
+ }
61092
+ let ae = B(), oe = B(0), se = (e) => {
61093
+ oe.value = Math.max(oe.value, e.touches.length);
61094
+ }, H = (e) => {
61086
61095
  if (e.touches.length > 0) return;
61087
- let t = ae.value > 1;
61088
- if (ae.value = 0, t) {
61089
- ie.value = void 0;
61096
+ let t = oe.value > 1;
61097
+ if (oe.value = 0, t) {
61098
+ ae.value = void 0;
61090
61099
  return;
61091
61100
  }
61092
61101
  let n = Date.now();
61093
- if (ie.value && n - ie.value < 300) {
61094
- V({
61102
+ if (ae.value && n - ae.value < 300) {
61103
+ ie({
61095
61104
  clientX: e.changedTouches[0].clientX,
61096
61105
  clientY: e.changedTouches[0].clientY
61097
- }), ie.value = void 0;
61106
+ }), ae.value = void 0;
61098
61107
  return;
61099
61108
  }
61100
- ie.value = n;
61101
- }, H, ce;
61102
- function le() {
61103
- H = D.value?.x ?? 1, ce = D.value?.y ?? 1;
61109
+ ae.value = n;
61110
+ }, ce, le;
61111
+ function ue() {
61112
+ ce = O.value?.x ?? 1, le = O.value?.y ?? 1;
61104
61113
  }
61105
- function ue(e) {
61106
- if (_.value) {
61107
- let e = D.value?.x, t = D.value?.y;
61108
- C(e ?? H, t ?? ce);
61114
+ function de(e) {
61115
+ if (y.value) {
61116
+ let e = O.value?.x, t = O.value?.y;
61117
+ w(e ?? ce, t ?? le);
61109
61118
  }
61110
61119
  }
61111
- let de = () => {
61112
- console.log("INIT", y.value?.zoompinchEngine?.canvasBounds), y.value?.applyTransform(1, [.5, .5], [.5, .5]);
61120
+ let fe = () => {
61121
+ console.log("INIT", b.value?.zoompinchEngine?.canvasBounds), b.value?.applyTransform(1, [.5, .5], [.5, .5]);
61113
61122
  };
61114
- W([x, S], ([e, t], [n, r]) => {
61115
- e && t && n && r && te();
61123
+ W([S, C], ([e, t], [n, r]) => {
61124
+ e && t && n && r && R();
61116
61125
  });
61117
- let fe = l(() => h.value?.ready ?? !1);
61118
- W(fe, () => {
61119
- fe.value && setTimeout(() => {
61120
- y.value?.applyTransform(1, [.5, .5], [.5, .5]);
61126
+ let pe = l(() => g.value?.ready ?? !1);
61127
+ W(pe, () => {
61128
+ pe.value && setTimeout(() => {
61129
+ b.value?.applyTransform(1, [.5, .5], [.5, .5]);
61121
61130
  }, 50);
61122
61131
  });
61123
- function pe(e) {
61124
- let t = y.value?.normalizeClientCoords(e.clientX, e.clientY);
61132
+ function me(e) {
61133
+ let t = b.value?.normalizeClientCoords(e.clientX, e.clientY);
61125
61134
  t && r.serial && (t[0] * r.serial.width, t[1] * r.serial.height);
61126
61135
  }
61127
- let me = B({}), he = l(() => ({
61128
- ...u?.value ?? {},
61129
- ...me.value
61130
- })), ge = l(() => {
61136
+ let he = B({}), ge = l(() => ({
61137
+ ...h?.value ?? {},
61138
+ ...he.value
61139
+ })), _e = l(() => {
61131
61140
  let e = r.accessibilityDescription;
61132
61141
  if (!e) return;
61133
- let t = he.value;
61142
+ let t = ge.value;
61134
61143
  return e.replace(/\{\{([^}]+)\}\}/g, (e, n) => {
61135
61144
  let r = String(n).trim();
61136
61145
  if (Object.prototype.hasOwnProperty.call(t, r)) {
@@ -61146,33 +61155,33 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61146
61155
  }).replace(/\s+/g, " ").trim() || void 0;
61147
61156
  });
61148
61157
  return t({
61149
- currentlyFocusedFrame: D,
61150
- focusFrame: C,
61151
- globalScope: me,
61152
- bxLiveTemplateRef: h,
61153
- ready: fe,
61154
- templateViewRootWidth: x,
61155
- templateViewRootHeight: S,
61156
- fit: F,
61157
- needsToFit: P,
61158
+ currentlyFocusedFrame: O,
61159
+ focusFrame: w,
61160
+ globalScope: he,
61161
+ bxLiveTemplateRef: g,
61162
+ ready: pe,
61163
+ templateViewRootWidth: S,
61164
+ templateViewRootHeight: C,
61165
+ fit: I,
61166
+ needsToFit: F,
61158
61167
  transform: c,
61159
- zoompinchRef: y,
61160
- isMultiFrame: _
61168
+ zoompinchRef: b,
61169
+ isMultiFrame: y
61161
61170
  }), (t, n) => (L(), p("div", {
61162
61171
  ref_key: "templateViewRootRef",
61163
- ref: b,
61172
+ ref: x,
61164
61173
  class: "template-view",
61165
- role: ge.value ? "img" : void 0,
61166
- "aria-label": ge.value || void 0,
61167
- onClick: pe,
61168
- onDblclick: V,
61169
- onTouchstart: oe,
61170
- onTouchend: se
61174
+ role: _e.value ? "img" : void 0,
61175
+ "aria-label": _e.value || void 0,
61176
+ onClick: me,
61177
+ onDblclick: ie,
61178
+ onTouchstart: se,
61179
+ onTouchend: H
61171
61180
  }, [v(U(hA), {
61172
61181
  ref_key: "zoompinchRef",
61173
- ref: y,
61182
+ ref: b,
61174
61183
  transform: c.value,
61175
- "onUpdate:transform": n[14] ||= (e) => c.value = e,
61184
+ "onUpdate:transform": u,
61176
61185
  offset: e.offset,
61177
61186
  "min-scale": .1,
61178
61187
  "max-scale": 10,
@@ -61182,9 +61191,9 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61182
61191
  touch: e.zoomAndPan,
61183
61192
  wheel: e.zoomAndPan,
61184
61193
  gesture: "",
61185
- onDragGestureStart: le,
61186
- onDragGestureEnd: ue,
61187
- onInit: de
61194
+ onDragGestureStart: ue,
61195
+ onDragGestureEnd: de,
61196
+ onInit: fe
61188
61197
  }, {
61189
61198
  matrix: G(({ composePoint: t, canvasWidth: r, canvasHeight: l, normalizeClientCoords: u }) => [
61190
61199
  e.imageOverlays?.length ? (L(), d(KR, {
@@ -61236,25 +61245,25 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61236
61245
  "normalize-client-coords"
61237
61246
  ])) : f("", !0),
61238
61247
  m("div", YR, [
61239
- g.value.x > 1 ? (L(), p("div", XR, [m("div", ZR, [(L(!0), p(a, null, re(g.value.x, (e) => (L(), p("div", {
61248
+ _.value.x > 1 ? (L(), p("div", XR, [m("div", ZR, [(L(!0), p(a, null, re(_.value.x, (e) => (L(), p("div", {
61240
61249
  class: A(["frame-dot", {
61241
- active: U(D)?.x === e - 1,
61242
- disabled: !U(D)
61250
+ active: U(O)?.x === e - 1,
61251
+ disabled: !U(O)
61243
61252
  }]),
61244
- onClick: (t) => R(e - 1, t)
61253
+ onClick: (t) => ne(e - 1, t)
61245
61254
  }, null, 10, QR))), 256))])])) : f("", !0),
61246
- g.value.y > 1 ? (L(), p("div", $R, [m("div", ez, [(L(!0), p(a, null, re(g.value.y, (e) => (L(), p("div", {
61255
+ _.value.y > 1 ? (L(), p("div", $R, [m("div", ez, [(L(!0), p(a, null, re(_.value.y, (e) => (L(), p("div", {
61247
61256
  class: A(["frame-dot", {
61248
- active: U(D)?.y === e - 1,
61249
- disabled: !U(D)
61257
+ active: U(O)?.y === e - 1,
61258
+ disabled: !U(O)
61250
61259
  }]),
61251
- onClick: (t) => ne(e - 1, t)
61260
+ onClick: (t) => V(e - 1, t)
61252
61261
  }, null, 10, tz))), 256))])])) : f("", !0),
61253
61262
  e.watermark ? (L(), p("svg", nz, [v(bR, {
61254
- width: U(x),
61255
- height: U(S)
61263
+ width: U(S),
61264
+ height: U(C)
61256
61265
  }, null, 8, ["width", "height"])])) : f("", !0),
61257
- P.value ? (L(), p("div", {
61266
+ F.value ? (L(), p("div", {
61258
61267
  key: 3,
61259
61268
  class: "fit-btn-wrapper",
61260
61269
  onTouchstart: n[10] ||= ye(() => {}, ["stop"]),
@@ -61264,7 +61273,7 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61264
61273
  }, [v(jx, {
61265
61274
  circle: "",
61266
61275
  tertiary: "",
61267
- onClick: F
61276
+ onClick: I
61268
61277
  }, {
61269
61278
  icon: G(() => [v(MC, null, {
61270
61279
  default: G(() => [v(U(kS))]),
@@ -61276,7 +61285,7 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61276
61285
  ]),
61277
61286
  default: G(() => [v(wR, {
61278
61287
  ref_key: "bxLiveTemplateRef",
61279
- ref: h,
61288
+ ref: g,
61280
61289
  "bx-core-version": e.bxCoreVersion,
61281
61290
  "cloudflare-pages-hostname": e.cloudflarePagesHostname,
61282
61291
  "asset-proxy": e.assetProxy,
@@ -61285,10 +61294,10 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61285
61294
  "serial-height": e.serialHeight,
61286
61295
  preview: e.preview,
61287
61296
  "personalized-preview-src": e.personalizedPreviewSrc,
61288
- globalScope: me.value,
61289
- "onUpdate:globalScope": n[0] ||= (e) => me.value = e,
61290
- data: U(u),
61291
- "onUpdate:data": n[1] ||= (e) => E(u) ? u.value = e : null
61297
+ globalScope: he.value,
61298
+ "onUpdate:globalScope": n[0] ||= (e) => he.value = e,
61299
+ data: U(h),
61300
+ "onUpdate:data": n[1] ||= (e) => E(h) ? h.value = e : null
61292
61301
  }, null, 8, [
61293
61302
  "bx-core-version",
61294
61303
  "cloudflare-pages-hostname",
@@ -61310,7 +61319,7 @@ var JR = ["role", "aria-label"], YR = { class: "controls-layer" }, XR = {
61310
61319
  "wheel"
61311
61320
  ])], 40, JR));
61312
61321
  }
61313
- }), [["__scopeId", "data-v-0f2b8ab2"]]), iz = /*#__PURE__*/ q(/* @__PURE__ */ y({
61322
+ }), [["__scopeId", "data-v-897dcf0e"]]), iz = /*#__PURE__*/ q(/* @__PURE__ */ y({
61314
61323
  __name: "SlidesNavigation",
61315
61324
  props: /*@__PURE__*/ D({ length: {} }, {
61316
61325
  index: { required: !0 },