delta-comic-core 0.3.1 → 0.3.3

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/bundle.js CHANGED
@@ -1081,13 +1081,13 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1081
1081
  }), W();
1082
1082
  };
1083
1083
  isHidden(i) ? nextTick().then(r) : r();
1084
- }, J = () => K(s.active), kl, Al = (n) => {
1085
- !e.touchable || n.touches.length > 1 || (l.start(n), c = !1, kl = Date.now(), H(), k());
1086
- }, jl = (r) => {
1084
+ }, J = () => K(s.active), Tl, El = (n) => {
1085
+ !e.touchable || n.touches.length > 1 || (l.start(n), c = !1, Tl = Date.now(), H(), k());
1086
+ }, Dl = (r) => {
1087
1087
  e.touchable && s.swiping && (l.move(r), S.value && (!e.loop && (s.active === 0 && h.value > 0 || s.active === p.value - 1 && h.value < 0) || (preventDefault(r, e.stopPropagation), O({ offset: h.value }), c ||= (n("dragStart", { index: b.value }), !0))));
1088
- }, Ml = () => {
1088
+ }, Ol = () => {
1089
1089
  if (!e.touchable || !s.swiping) return;
1090
- let r = Date.now() - kl, i = h.value / r;
1090
+ let r = Date.now() - Tl, i = h.value / r;
1091
1091
  if ((Math.abs(i) > .25 || Math.abs(h.value) > m.value / 2) && S.value) {
1092
1092
  let n = e.vertical ? l.offsetY.value : l.offsetX.value, r = 0;
1093
1093
  r = e.loop ? n > 0 ? h.value > 0 ? -1 : 1 : 0 : -Math[h.value > 0 ? "ceil" : "floor"](h.value / m.value), O({
@@ -1096,7 +1096,7 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1096
1096
  });
1097
1097
  } else h.value && O({ pace: 0 });
1098
1098
  c = !1, s.swiping = !1, n("dragEnd", { index: b.value }), W();
1099
- }, Nl = (n, r = {}) => {
1099
+ }, kl = (n, r = {}) => {
1100
1100
  k(), l.reset(), doubleRaf(() => {
1101
1101
  let i;
1102
1102
  i = e.loop && n === p.value ? s.active === 0 ? 0 : n : n % p.value, r.immediate ? doubleRaf(() => {
@@ -1106,25 +1106,25 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1106
1106
  emitChange: !0
1107
1107
  });
1108
1108
  });
1109
- }, Pl = (n, r) => {
1109
+ }, Al = (n, r) => {
1110
1110
  let i = r === b.value;
1111
1111
  return createVNode("i", {
1112
1112
  style: i ? { backgroundColor: e.indicatorColor } : void 0,
1113
1113
  class: bem$7("indicator", { active: i })
1114
1114
  }, null);
1115
- }, Fl = () => {
1115
+ }, jl = () => {
1116
1116
  if (r.indicator) return r.indicator({
1117
1117
  active: b.value,
1118
1118
  total: p.value
1119
1119
  });
1120
- if (e.showIndicators && p.value > 1) return createVNode("div", { class: bem$7("indicators", { vertical: e.vertical }) }, [Array(p.value).fill("").map(Pl)]);
1120
+ if (e.showIndicators && p.value > 1) return createVNode("div", { class: bem$7("indicators", { vertical: e.vertical }) }, [Array(p.value).fill("").map(Al)]);
1121
1121
  };
1122
1122
  return useExpose({
1123
1123
  prev: A,
1124
1124
  next: z,
1125
1125
  state: s,
1126
1126
  resize: J,
1127
- swipeTo: Nl
1127
+ swipeTo: kl
1128
1128
  }), f({
1129
1129
  size: m,
1130
1130
  props: e,
@@ -1137,17 +1137,17 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1137
1137
  () => e.height
1138
1138
  ], J), watch(usePageVisibility(), (e) => {
1139
1139
  e === "visible" ? W() : H();
1140
- }), onMounted(K), onActivated(() => K(s.active)), onPopupReopen(() => K(s.active)), onDeactivated(H), onBeforeUnmount(H), useEventListener("touchmove", jl, { target: o }), () => createVNode("div", {
1140
+ }), onMounted(K), onActivated(() => K(s.active)), onPopupReopen(() => K(s.active)), onDeactivated(H), onBeforeUnmount(H), useEventListener("touchmove", Dl, { target: o }), () => createVNode("div", {
1141
1141
  ref: i,
1142
1142
  class: bem$7()
1143
1143
  }, [createVNode("div", {
1144
1144
  ref: o,
1145
1145
  style: C.value,
1146
1146
  class: bem$7("track", { vertical: e.vertical }),
1147
- onTouchstartPassive: Al,
1148
- onTouchend: Ml,
1149
- onTouchcancel: Ml
1150
- }, [r.default?.call(r)]), Fl()]);
1147
+ onTouchstartPassive: El,
1148
+ onTouchend: Ol,
1149
+ onTouchcancel: Ol
1150
+ }, [r.default?.call(r)]), jl()]);
1151
1151
  }
1152
1152
  })), [name$7, bem$6] = createNamespace("tabs"), stdin_default$5 = defineComponent({
1153
1153
  name: name$7,
@@ -1247,14 +1247,14 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1247
1247
  }
1248
1248
  C.lineStyle = c;
1249
1249
  });
1250
- }, Ol = (e) => {
1250
+ }, wl = (e) => {
1251
1251
  let n = e < C.currentIndex ? -1 : 1;
1252
1252
  for (; e >= 0 && e < b.length;) {
1253
1253
  if (!b[e].disabled) return e;
1254
1254
  e += n;
1255
1255
  }
1256
1256
  }, V = (r, i) => {
1257
- let a = Ol(r);
1257
+ let a = wl(r);
1258
1258
  if (!isDef$1(a)) return;
1259
1259
  let o = b[a], c = O(o, a), l = C.currentIndex !== null;
1260
1260
  C.currentIndex !== a && (C.currentIndex = a, i || z(), B()), c !== e.active && (n("update:active", c), l && n("change", c, o.title)), s && !e.scrollspy && setRootScrollTop(Math.ceil(getElementTop(u.value) - A.value));
@@ -1286,24 +1286,24 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1286
1286
  });
1287
1287
  }, J = (e) => {
1288
1288
  s = e.isFixed, n("scroll", e);
1289
- }, kl = (e) => {
1289
+ }, Tl = (e) => {
1290
1290
  nextTick(() => {
1291
1291
  H(e), W(!0);
1292
1292
  });
1293
- }, Al = () => {
1293
+ }, El = () => {
1294
1294
  for (let e = 0; e < b.length; e++) {
1295
1295
  let { top: n } = useRect(b[e].$el);
1296
1296
  if (n > M.value) return e === 0 ? 0 : e - 1;
1297
1297
  }
1298
1298
  return b.length - 1;
1299
- }, jl = () => {
1300
- e.scrollspy && !o && V(Al());
1301
- }, Ml = () => {
1299
+ }, Dl = () => {
1300
+ e.scrollspy && !o && V(El());
1301
+ }, Ol = () => {
1302
1302
  if (e.type === "line" && b.length) return createVNode("div", {
1303
1303
  class: bem$5("line"),
1304
1304
  style: C.lineStyle
1305
1305
  }, null);
1306
- }, Nl = () => {
1306
+ }, kl = () => {
1307
1307
  let { type: n, border: i, sticky: a } = e, o = [createVNode("div", {
1308
1308
  ref: a ? void 0 : p,
1309
1309
  class: [bem$5("wrap"), { [BORDER_TOP_BOTTOM]: n === "line" && i }]
@@ -1319,11 +1319,11 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1319
1319
  }, [
1320
1320
  r["nav-left"]?.call(r),
1321
1321
  b.map((e) => e.renderTitle(K)),
1322
- Ml(),
1322
+ Ol(),
1323
1323
  r["nav-right"]?.call(r)
1324
1324
  ])]), r["nav-bottom"]?.call(r)];
1325
1325
  return a ? createVNode("div", { ref: p }, [o]) : o;
1326
- }, Pl = () => {
1326
+ }, Al = () => {
1327
1327
  B(), nextTick(() => {
1328
1328
  var e;
1329
1329
  z(!0), (e = m.value?.swipeRef.value) == null || e.resize();
@@ -1334,20 +1334,20 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1334
1334
  e.duration,
1335
1335
  e.lineWidth,
1336
1336
  e.lineHeight
1337
- ], B), watch(windowWidth, Pl), watch(() => e.active, (e) => {
1337
+ ], B), watch(windowWidth, Al), watch(() => e.active, (e) => {
1338
1338
  e !== k.value && H(e);
1339
1339
  }), watch(() => b.length, () => {
1340
1340
  C.inited && (H(e.active), B(), nextTick(() => {
1341
1341
  z(!0);
1342
1342
  }));
1343
1343
  }), useExpose({
1344
- resize: Pl,
1345
- scrollTo: kl
1344
+ resize: Al,
1345
+ scrollTo: Tl
1346
1346
  }), onActivated(B), onPopupReopen(B), onMountedOrActivated(() => {
1347
1347
  H(e.active, !0), nextTick(() => {
1348
1348
  C.inited = !0, p.value && (i = useRect(p.value).height), z(!0);
1349
1349
  });
1350
- }), useVisibilityChange(u, B), useEventListener("scroll", jl, {
1350
+ }), useVisibilityChange(u, B), useEventListener("scroll", Dl, {
1351
1351
  target: g,
1352
1352
  passive: !0
1353
1353
  }), S({
@@ -1366,7 +1366,7 @@ var [name$9, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1366
1366
  container: u.value,
1367
1367
  offsetTop: A.value,
1368
1368
  onScroll: J
1369
- }, { default: () => [Nl()] }) : Nl() : null, createVNode(stdin_default$5, {
1369
+ }, { default: () => [kl()] }) : kl() : null, createVNode(stdin_default$5, {
1370
1370
  ref: m,
1371
1371
  count: b.length,
1372
1372
  inited: C.inited,
@@ -2035,12 +2035,6 @@ function iteratee(e) {
2035
2035
  case "number": return property(e);
2036
2036
  }
2037
2037
  }
2038
- function isObjectLike(e) {
2039
- return typeof e == "object" && !!e;
2040
- }
2041
- function isArrayLikeObject(e) {
2042
- return isObjectLike(e) && isArrayLike(e);
2043
- }
2044
2038
  function last$1(e) {
2045
2039
  return e[e.length - 1];
2046
2040
  }
@@ -2087,17 +2081,6 @@ function clamp$1(e, n, r) {
2087
2081
  function isNumber(e) {
2088
2082
  return typeof e == "number" || e instanceof Number;
2089
2083
  }
2090
- function uniqBy$1(e, n) {
2091
- let r = /* @__PURE__ */ new Map();
2092
- for (let i = 0; i < e.length; i++) {
2093
- let a = e[i], o = n(a);
2094
- r.has(o) || r.set(o, a);
2095
- }
2096
- return Array.from(r.values());
2097
- }
2098
- function uniqBy(e, n = identity$1) {
2099
- return isArrayLikeObject(e) ? uniqBy$1(Array.from(e), iteratee(n)) : [];
2100
- }
2101
2084
  function debounce$1(e, n, { signal: r, edges: i } = {}) {
2102
2085
  let a, o = null, s = i != null && i.includes("leading"), c = i == null || i.includes("trailing"), l = () => {
2103
2086
  o !== null && (e.apply(a, o), a = void 0, o = null);
@@ -3150,32 +3133,45 @@ const eventBus = useGlobalVar(mitt_default(), "utils/eventBus");
3150
3133
  var SharedFunction = class {
3151
3134
  static sharedFunctions = useGlobalVar(/* @__PURE__ */ new Map(), "utils/SharedFunction/sharedFunctions");
3152
3135
  static define(e, n, r) {
3153
- return console.log("[SharedFunction.define] defined new function", n, ":", r, "->", e), this.sharedFunctions.set(r, uniqBy([...this.sharedFunctions.get(r) ?? [], {
3136
+ return console.log("[SharedFunction.define] defined new function", n, ":", r, "->", e), this.sharedFunctions.set(r, [...this.sharedFunctions.get(r) ?? [], {
3154
3137
  fn: e,
3155
3138
  plugin: n
3156
- }], (e) => e.plugin)), e;
3139
+ }]), e;
3157
3140
  }
3158
3141
  static call(e, ...n) {
3159
- return this.sharedFunctions.get(e)?.map((e) => ({
3142
+ let r = this.sharedFunctions.get(e)?.map((e) => ({
3160
3143
  result: e.fn(...n),
3161
3144
  ...e
3162
- }));
3145
+ })) ?? [], i = Promise.all(r.map(async (e) => ({
3146
+ ...e,
3147
+ result: await e.result
3148
+ })));
3149
+ return Object.assign(r, i);
3163
3150
  }
3164
3151
  static callRandom(e, ...n) {
3165
3152
  let r = this.sharedFunctions.get(e) ?? [], i = random(0, r.length - 1), a = r[i];
3166
3153
  if (!a) throw Error(`[SharedFunction.callRandom] call ${e}, but not resigner any function.`);
3167
- return console.log(`[SharedFunction.callRandom] call index: ${i} in ${r.length}`, a), {
3168
- result: a.fn(...n),
3154
+ console.log(`[SharedFunction.callRandom] call index: ${i} in ${r.length}`, a);
3155
+ let o = a.fn(...n), s = {
3156
+ result: o,
3169
3157
  ...a
3170
- };
3158
+ }, c = (async () => ({
3159
+ ...a,
3160
+ result: await o
3161
+ }))();
3162
+ return Object.assign(s, c);
3171
3163
  }
3172
3164
  static callWitch(e, n, ...r) {
3173
- let i = (this.sharedFunctions.get(e) ?? []).find((e) => e.plugin === n);
3174
- if (!i) throw Error(`[SharedFunction.callWitch] not found plugin function (plugin: ${n}, name: ${e})`);
3175
- return {
3176
- result: i.fn(...r),
3177
- ...i
3178
- };
3165
+ let i = (this.sharedFunctions.get(e) ?? []).filter((e) => e.plugin === n);
3166
+ if (!i.length) throw Error(`[SharedFunction.callWitch] not found plugin function (plugin: ${n}, name: ${e})`);
3167
+ let a = i.map((e) => ({
3168
+ result: e.fn(...r),
3169
+ ...e
3170
+ })), o = Promise.all(a.map(async (e) => ({
3171
+ ...e,
3172
+ result: await e.result
3173
+ })));
3174
+ return Object.assign(a, o);
3179
3175
  }
3180
3176
  }, request_exports = /* @__PURE__ */ __export({
3181
3177
  SmartAbortController: () => SmartAbortController,
@@ -5420,7 +5416,7 @@ const appConfig = new ConfigPointer("core", {
5420
5416
  }), declareDependType = (e) => Symbol.for(`expose:${e}`), requireDepend = (e) => _pluginExposes.get(e), _pluginExposes = /* @__PURE__ */ new Map(), coreModule = declareDependType("core"), _ = void 0;
5421
5417
  var package_default = {
5422
5418
  name: "delta-comic-core",
5423
- version: "0.3.0",
5419
+ version: "0.3.3",
5424
5420
  description: "我曾亲眼见证神的熟视无睹.",
5425
5421
  homepage: "https://github.com/wenxig/delta-comic-core",
5426
5422
  repository: {