delta-comic-core 0.0.5 → 0.0.6

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
@@ -1,6 +1,6 @@
1
1
  import { Fragment, Teleport, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, customRef, defineComponent, getCurrentInstance, getCurrentScope, guardReactiveProps, hasInjectionContext, inject, isRef, isVNode, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onBeforeUpdate, onDeactivated, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, readonly, ref, renderList, renderSlot, resolveDynamicComponent, shallowReactive, shallowReadonly, shallowRef, toDisplayString, toRef, toValue, unref, useCssVars, useModel, useTemplateRef, vShow, watch, watchEffect, withCtx, withDirectives, withModifiers } from "vue";
2
2
  import { onBeforeRouteLeave, useRoute, useRouter } from "vue-router";
3
- import { NButton, NEmpty, NIcon, NImage, NResult, NVirtualList, useThemeVars } from "naive-ui";
3
+ import { NButton, NEmpty, NIcon, NImage, NResult, NVirtualList } from "naive-ui";
4
4
  import { showImagePreview } from "vant";
5
5
  import { defineStore } from "pinia";
6
6
  import axios, { getAdapter, isAxiosError, isCancel } from "axios";
@@ -1080,13 +1080,13 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1080
1080
  }), K();
1081
1081
  };
1082
1082
  isHidden(a) ? nextTick().then(r) : r();
1083
- }, dl = () => J(s.active), fl, pl = (n) => {
1084
- !e.touchable || n.touches.length > 1 || (l.start(n), c = !1, fl = Date.now(), W(), k());
1085
- }, ml = (r) => {
1083
+ }, ll = () => J(s.active), ul, dl = (n) => {
1084
+ !e.touchable || n.touches.length > 1 || (l.start(n), c = !1, ul = Date.now(), W(), k());
1085
+ }, fl = (r) => {
1086
1086
  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))));
1087
- }, hl = () => {
1087
+ }, pl = () => {
1088
1088
  if (!e.touchable || !s.swiping) return;
1089
- let r = Date.now() - fl, i = h.value / r;
1089
+ let r = Date.now() - ul, i = h.value / r;
1090
1090
  if ((Math.abs(i) > .25 || Math.abs(h.value) > m.value / 2) && S.value) {
1091
1091
  let n = e.vertical ? l.offsetY.value : l.offsetX.value, r = 0;
1092
1092
  r = e.loop ? n > 0 ? h.value > 0 ? -1 : 1 : 0 : -Math[h.value > 0 ? "ceil" : "floor"](h.value / m.value), O({
@@ -1095,7 +1095,7 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1095
1095
  });
1096
1096
  } else h.value && O({ pace: 0 });
1097
1097
  c = !1, s.swiping = !1, n("dragEnd", { index: b.value }), K();
1098
- }, gl = (n, r = {}) => {
1098
+ }, ml = (n, r = {}) => {
1099
1099
  k(), l.reset(), doubleRaf(() => {
1100
1100
  let i;
1101
1101
  i = e.loop && n === p.value ? s.active === 0 ? 0 : n : n % p.value, r.immediate ? doubleRaf(() => {
@@ -1105,25 +1105,25 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1105
1105
  emitChange: !0
1106
1106
  });
1107
1107
  });
1108
- }, _l = (n, r) => {
1108
+ }, hl = (n, r) => {
1109
1109
  let i = r === b.value;
1110
1110
  return createVNode("i", {
1111
1111
  style: i ? { backgroundColor: e.indicatorColor } : void 0,
1112
1112
  class: bem$7("indicator", { active: i })
1113
1113
  }, null);
1114
- }, vl = () => {
1114
+ }, gl = () => {
1115
1115
  if (r.indicator) return r.indicator({
1116
1116
  active: b.value,
1117
1117
  total: p.value
1118
1118
  });
1119
- if (e.showIndicators && p.value > 1) return createVNode("div", { class: bem$7("indicators", { vertical: e.vertical }) }, [Array(p.value).fill("").map(_l)]);
1119
+ if (e.showIndicators && p.value > 1) return createVNode("div", { class: bem$7("indicators", { vertical: e.vertical }) }, [Array(p.value).fill("").map(hl)]);
1120
1120
  };
1121
1121
  return useExpose({
1122
1122
  prev: M,
1123
1123
  next: V,
1124
1124
  state: s,
1125
- resize: dl,
1126
- swipeTo: gl
1125
+ resize: ll,
1126
+ swipeTo: ml
1127
1127
  }), f({
1128
1128
  size: m,
1129
1129
  props: e,
@@ -1134,19 +1134,19 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1134
1134
  windowHeight,
1135
1135
  () => e.width,
1136
1136
  () => e.height
1137
- ], dl), watch(usePageVisibility(), (e) => {
1137
+ ], ll), watch(usePageVisibility(), (e) => {
1138
1138
  e === "visible" ? K() : W();
1139
- }), onMounted(J), onActivated(() => J(s.active)), onPopupReopen(() => J(s.active)), onDeactivated(W), onBeforeUnmount(W), useEventListener("touchmove", ml, { target: o }), () => createVNode("div", {
1139
+ }), onMounted(J), onActivated(() => J(s.active)), onPopupReopen(() => J(s.active)), onDeactivated(W), onBeforeUnmount(W), useEventListener("touchmove", fl, { target: o }), () => createVNode("div", {
1140
1140
  ref: a,
1141
1141
  class: bem$7()
1142
1142
  }, [createVNode("div", {
1143
1143
  ref: o,
1144
1144
  style: C.value,
1145
1145
  class: bem$7("track", { vertical: e.vertical }),
1146
- onTouchstartPassive: pl,
1147
- onTouchend: hl,
1148
- onTouchcancel: hl
1149
- }, [r.default?.call(r)]), vl()]);
1146
+ onTouchstartPassive: dl,
1147
+ onTouchend: pl,
1148
+ onTouchcancel: pl
1149
+ }, [r.default?.call(r)]), gl()]);
1150
1150
  }
1151
1151
  })), [name$6, bem$6] = createNamespace("tabs"), stdin_default$5 = defineComponent({
1152
1152
  name: name$6,
@@ -1283,26 +1283,26 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1283
1283
  event: a,
1284
1284
  disabled: s
1285
1285
  });
1286
- }, dl = (e) => {
1286
+ }, ll = (e) => {
1287
1287
  s = e.isFixed, n("scroll", e);
1288
- }, fl = (e) => {
1288
+ }, ul = (e) => {
1289
1289
  nextTick(() => {
1290
1290
  W(e), K(!0);
1291
1291
  });
1292
- }, pl = () => {
1292
+ }, dl = () => {
1293
1293
  for (let e = 0; e < b.length; e++) {
1294
1294
  let { top: n } = useRect(b[e].$el);
1295
1295
  if (n > M.value) return e === 0 ? 0 : e - 1;
1296
1296
  }
1297
1297
  return b.length - 1;
1298
- }, ml = () => {
1299
- e.scrollspy && !o && H(pl());
1300
- }, hl = () => {
1298
+ }, fl = () => {
1299
+ e.scrollspy && !o && H(dl());
1300
+ }, pl = () => {
1301
1301
  if (e.type === "line" && b.length) return createVNode("div", {
1302
1302
  class: bem$5("line"),
1303
1303
  style: C.lineStyle
1304
1304
  }, null);
1305
- }, gl = () => {
1305
+ }, ml = () => {
1306
1306
  let { type: n, border: i, sticky: a } = e, o = [createVNode("div", {
1307
1307
  ref: a ? void 0 : p,
1308
1308
  class: [bem$5("wrap"), { [BORDER_TOP_BOTTOM]: n === "line" && i }]
@@ -1318,11 +1318,11 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1318
1318
  }, [
1319
1319
  r["nav-left"]?.call(r),
1320
1320
  b.map((e) => e.renderTitle(J)),
1321
- hl(),
1321
+ pl(),
1322
1322
  r["nav-right"]?.call(r)
1323
1323
  ])]), r["nav-bottom"]?.call(r)];
1324
1324
  return a ? createVNode("div", { ref: p }, [o]) : o;
1325
- }, _l = () => {
1325
+ }, hl = () => {
1326
1326
  B(), nextTick(() => {
1327
1327
  var e;
1328
1328
  z(!0), (e = m.value?.swipeRef.value) == null || e.resize();
@@ -1333,20 +1333,20 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1333
1333
  e.duration,
1334
1334
  e.lineWidth,
1335
1335
  e.lineHeight
1336
- ], B), watch(windowWidth, _l), watch(() => e.active, (e) => {
1336
+ ], B), watch(windowWidth, hl), watch(() => e.active, (e) => {
1337
1337
  e !== k.value && W(e);
1338
1338
  }), watch(() => b.length, () => {
1339
1339
  C.inited && (W(e.active), B(), nextTick(() => {
1340
1340
  z(!0);
1341
1341
  }));
1342
1342
  }), useExpose({
1343
- resize: _l,
1344
- scrollTo: fl
1343
+ resize: hl,
1344
+ scrollTo: ul
1345
1345
  }), onActivated(B), onPopupReopen(B), onMountedOrActivated(() => {
1346
1346
  W(e.active, !0), nextTick(() => {
1347
1347
  C.inited = !0, p.value && (a = useRect(p.value).height), z(!0);
1348
1348
  });
1349
- }), useVisibilityChange(d, B), useEventListener("scroll", ml, {
1349
+ }), useVisibilityChange(d, B), useEventListener("scroll", fl, {
1350
1350
  target: g,
1351
1351
  passive: !0
1352
1352
  }), S({
@@ -1364,8 +1364,8 @@ var [name$8, bem$8] = createNamespace("sticky"), Sticky = withInstall(defineComp
1364
1364
  }, [e.showHeader ? e.sticky ? createVNode(Sticky, {
1365
1365
  container: d.value,
1366
1366
  offsetTop: j.value,
1367
- onScroll: dl
1368
- }, { default: () => [gl()] }) : gl() : null, createVNode(stdin_default$5, {
1367
+ onScroll: ll
1368
+ }, { default: () => [ml()] }) : ml() : null, createVNode(stdin_default$5, {
1369
1369
  ref: m,
1370
1370
  count: b.length,
1371
1371
  inited: C.inited,
@@ -3025,7 +3025,7 @@ var image_default = /* @__PURE__ */ defineComponent({
3025
3025
  }, A = (...e) => {
3026
3026
  p("load", ...e), v.loaded.add(f.value);
3027
3027
  }, j = useTemplateRef("img");
3028
- return console.log("[img]", j), r({
3028
+ return r({
3029
3029
  isLoaded: S,
3030
3030
  imageEl: computed(() => j.value?.imageRef),
3031
3031
  imageIns: j
@@ -3567,7 +3567,7 @@ var _hoisted_1$3 = {
3567
3567
  isEmpty: isEmpty(d.source),
3568
3568
  data: d.source,
3569
3569
  isNoResult: isEmpty(d.source)
3570
- }), p = useThemeVars(), m = {
3570
+ }), p = {
3571
3571
  isLoadingNoData: {
3572
3572
  opacity: 1,
3573
3573
  translateY: 0,
@@ -3578,7 +3578,7 @@ var _hoisted_1$3 = {
3578
3578
  left: "50%",
3579
3579
  top: "8px",
3580
3580
  translateX: "-50%",
3581
- backgroundColor: "#ffffff",
3581
+ backgroundColor: "var(--van-background-2)",
3582
3582
  borderRadius: "100%"
3583
3583
  },
3584
3584
  isErrorNoData: {
@@ -3591,7 +3591,7 @@ var _hoisted_1$3 = {
3591
3591
  left: "50%",
3592
3592
  top: "50%",
3593
3593
  translateX: "-50%",
3594
- backgroundColor: "#ffffff",
3594
+ backgroundColor: "var(--van-background-2)",
3595
3595
  borderRadius: "4px"
3596
3596
  },
3597
3597
  isLoadingData: {
@@ -3604,7 +3604,7 @@ var _hoisted_1$3 = {
3604
3604
  left: "4px",
3605
3605
  top: "calc(100% - 8px - 1rem)",
3606
3606
  translateX: "0%",
3607
- backgroundColor: p.value.primaryColor,
3607
+ backgroundColor: "var(--p-color)",
3608
3608
  borderRadius: "1.3rem"
3609
3609
  },
3610
3610
  isErrorData: {
@@ -3617,7 +3617,7 @@ var _hoisted_1$3 = {
3617
3617
  left: "4px",
3618
3618
  top: "calc(100% - 8px - 4rem)",
3619
3619
  translateX: "0%",
3620
- backgroundColor: p.value.primaryColor,
3620
+ backgroundColor: "var(--p-color)",
3621
3621
  borderRadius: "4px"
3622
3622
  },
3623
3623
  isEmpty: {
@@ -3630,7 +3630,7 @@ var _hoisted_1$3 = {
3630
3630
  left: "50%",
3631
3631
  top: "50%",
3632
3632
  translateX: "-50%",
3633
- backgroundColor: "#ffffff",
3633
+ backgroundColor: "var(--van-background-2)",
3634
3634
  borderRadius: "4px"
3635
3635
  },
3636
3636
  done: {
@@ -3643,16 +3643,16 @@ var _hoisted_1$3 = {
3643
3643
  left: "4px",
3644
3644
  top: "calc(100% - 8px - 1rem)",
3645
3645
  translateX: "0%",
3646
- backgroundColor: p.value.primaryColor,
3646
+ backgroundColor: "var(--p-color)",
3647
3647
  borderRadius: "4px"
3648
3648
  }
3649
- }, h = computed(() => !d.hideLoading && f.value.isLoading ? f.value.isEmpty ? "isLoadingNoData" : "isLoadingData" : !d.hideError && f.value.isError ? f.value.isEmpty ? "isErrorNoData" : "isErrorData" : !d.hideEmpty && f.value.isNoResult ? "isEmpty" : "done"), g = useTemplateRef("cont");
3650
- return n({ cont: g }), (n, i) => {
3651
- let p = Loading, v = NEmpty, y = NButton, b = NIcon, S = NResult, C = AnimatePresence;
3649
+ }, m = computed(() => !d.hideLoading && f.value.isLoading ? f.value.isEmpty ? "isLoadingNoData" : "isLoadingData" : !d.hideError && f.value.isError ? f.value.isEmpty ? "isErrorNoData" : "isErrorData" : !d.hideEmpty && f.value.isNoResult ? "isEmpty" : "done"), h = useTemplateRef("cont");
3650
+ return n({ cont: h }), (n, i) => {
3651
+ let g = Loading, v = NEmpty, y = NButton, b = NIcon, S = NResult, C = AnimatePresence;
3652
3652
  return openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", {
3653
3653
  class: normalizeClass(["relative size-full", [d.class]]),
3654
3654
  ref_key: "cont",
3655
- ref: g
3655
+ ref: h
3656
3656
  }, [f.value.isEmpty ? createCommentVNode("", !0) : renderSlot(n.$slots, "default", {
3657
3657
  key: 0,
3658
3658
  data: f.value.data
@@ -3664,27 +3664,27 @@ var _hoisted_1$3 = {
3664
3664
  left: "50%",
3665
3665
  translateX: "-50%"
3666
3666
  },
3667
- variants: m,
3668
- animate: h.value,
3667
+ variants: p,
3668
+ animate: m.value,
3669
3669
  class: "shadow flex justify-center items-center scale-100 absolute whitespace-nowrap"
3670
3670
  }, {
3671
3671
  default: withCtx(() => [createVNode(Transition, { name: "van-fade" }, {
3672
- default: withCtx(() => [h.value === "isLoadingNoData" ? (openBlock(), createBlock(p, {
3672
+ default: withCtx(() => [m.value === "isLoadingNoData" ? (openBlock(), createBlock(g, {
3673
3673
  key: 0,
3674
3674
  size: "25px",
3675
3675
  color: "var(--p-color)"
3676
- })) : h.value === "isLoadingData" ? (openBlock(), createBlock(loading_default, {
3676
+ })) : m.value === "isLoadingData" ? (openBlock(), createBlock(loading_default, {
3677
3677
  key: 1,
3678
3678
  size: "10px",
3679
3679
  color: "white"
3680
3680
  }, {
3681
3681
  default: withCtx(() => [...i[2] ||= [createTextVNode("加载中", -1)]]),
3682
3682
  _: 1
3683
- })) : h.value === "isEmpty" ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(v, {
3683
+ })) : m.value === "isEmpty" ? (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(v, {
3684
3684
  description: "无结果",
3685
3685
  class: normalizeClass(["w-full !justify-center", [e.classEmpty]]),
3686
3686
  style: normalizeStyle([e.style, e.styleEmpty])
3687
- }, null, 8, ["class", "style"])])) : h.value === "isErrorNoData" ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(S, {
3687
+ }, null, 8, ["class", "style"])])) : m.value === "isErrorNoData" ? (openBlock(), createElementBlock("div", _hoisted_3, [createVNode(S, {
3688
3688
  class: normalizeClass(["!items-center !justify-center flex flex-col !size-full *:w-full text-wrap", [e.classError]]),
3689
3689
  status: "error",
3690
3690
  title: "网络错误",
@@ -3711,7 +3711,7 @@ var _hoisted_1$3 = {
3711
3711
  "class",
3712
3712
  "style",
3713
3713
  "description"
3714
- ])])) : h.value === "isErrorData" ? (openBlock(), createElementBlock("div", _hoisted_4, [
3714
+ ])])) : m.value === "isErrorData" ? (openBlock(), createElementBlock("div", _hoisted_4, [
3715
3715
  createVNode(b, {
3716
3716
  size: "3rem",
3717
3717
  color: "white"
@@ -4998,11 +4998,12 @@ var Ce = ["data-index"], U = /* @__PURE__ */ defineComponent({
4998
4998
  $$plugin;
4999
4999
  $$meta;
5000
5000
  thisEp;
5001
+ customIsSafe;
5001
5002
  get $thisEp() {
5002
5003
  return new Ep(this.thisEp);
5003
5004
  }
5004
5005
  constructor(e) {
5005
- super(e), this.$$plugin = e.$$plugin, this.$$meta = e.$$meta, this.thisEp = e.thisEp, this.updateTime = e.updateTime, this.cover = e.cover, this.title = e.title, this.id = e.id, this.categories = e.categories, this.author = e.author, this.viewNumber = e.viewNumber, this.likeNumber = e.likeNumber, this.commentNumber = e.commentNumber, this.isLiked = e.isLiked, this.customIsAI = e.customIsAI, this.contentType = ContentPage.toContentType(e.contentType), this.length = e.length, this.epLength = e.epLength, this.description = e.description, this.commentSendable = e.commentSendable;
5006
+ super(e), this.$$plugin = e.$$plugin, this.$$meta = e.$$meta, this.thisEp = e.thisEp, this.updateTime = e.updateTime, this.cover = e.cover, this.title = e.title, this.id = e.id, this.categories = e.categories, this.author = e.author, this.viewNumber = e.viewNumber, this.likeNumber = e.likeNumber, this.commentNumber = e.commentNumber, this.isLiked = e.isLiked, this.customIsAI = e.customIsAI, this.contentType = ContentPage.toContentType(e.contentType), this.length = e.length, this.epLength = e.epLength, this.description = e.description, this.commentSendable = e.commentSendable, this.customIsSafe = e.customIsSafe;
5006
5007
  }
5007
5008
  commentSendable;
5008
5009
  customIsAI;
@@ -5145,7 +5146,7 @@ const createLoadingMessage = (e = "加载中", n = window.$message) => {
5145
5146
  };
5146
5147
  var ConfigPointer = class {
5147
5148
  constructor(e, n) {
5148
- this.pluginName = e, this.config = n, this.key = Symbol(e);
5149
+ this.pluginName = e, this.config = n, this.key = Symbol.for(`config:${e}`);
5149
5150
  }
5150
5151
  key;
5151
5152
  };
@@ -5190,26 +5191,29 @@ const appConfig = new ConfigPointer("core", {
5190
5191
  let r = n.get(e.key);
5191
5192
  if (!r) throw Error(`not found config by plugin "${e.pluginName}"`);
5192
5193
  return r.value;
5193
- }, "load"), a = usePreferredDark();
5194
+ }, "load"), a = usePreferredDark(), o = computed(() => {
5195
+ if (!s(appConfig)) return a.value;
5196
+ switch (r(appConfig).value.darkMode) {
5197
+ case "light": return !1;
5198
+ case "dark": return !0;
5199
+ case "system": return a.value;
5200
+ default: return !1;
5201
+ }
5202
+ }), s = e.action((e) => n.has(e.key), "isExistConfig");
5194
5203
  return {
5195
- isDark: computed(() => {
5196
- switch (r(appConfig).darkMode) {
5197
- case "light": return !1;
5198
- case "dark": return !0;
5199
- case "system": return a.value;
5200
- default: return !1;
5201
- }
5202
- }),
5204
+ isDark: o,
5203
5205
  form: n,
5204
- $load: r
5206
+ $load: r,
5207
+ $isExistConfig: s,
5208
+ $resignerConfig: e.action((e) => {
5209
+ let n = useConfig(), r = useLocalStorage(`config:${e.pluginName}`, fromPairs(Object.entries(e.config).map(([e, n]) => [e, n.defaultValue])));
5210
+ n.form.set(e.key, {
5211
+ form: e.config,
5212
+ value: r
5213
+ });
5214
+ }, "resignerConfig")
5205
5215
  };
5206
- }), resignerConfig = (e) => {
5207
- let n = useConfig(), r = useLocalStorage(`${e.pluginName}.config`, fromPairs(Object.entries(e.config).map(([e, n]) => [e, n.defaultValue])));
5208
- n.form.set(e.key, {
5209
- form: e.config,
5210
- value: r
5211
- });
5212
- }, definePlugin = (e) => {
5216
+ }), definePlugin = (e) => {
5213
5217
  if (isFunction(e)) var n = e(window.$$safe$$);
5214
5218
  else var n = e;
5215
5219
  console.log("[definePlugin] new plugin defining...", n);
@@ -5233,7 +5237,7 @@ const appConfig = new ConfigPointer("core", {
5233
5237
  for (let e of o.hotPage.topButton ?? []) ContentPage.setTopButton(r, e);
5234
5238
  }
5235
5239
  }
5236
- if (s && User.userEditorBase.set(r, s.edit), n.config) for (let e of n.config) resignerConfig(e);
5240
+ if (s && User.userEditorBase.set(r, s.edit), n.config) for (let e of n.config) useConfig().$resignerConfig(e);
5237
5241
  return SharedFunction.call("addPlugin", n);
5238
5242
  }, declareDependType = (e) => Symbol.for(`expose:${e}`), requireDepend = (e) => _pluginExposes.get(e), _pluginExposes = /* @__PURE__ */ new Map(), coreModule = declareDependType("core"), _ = void 0, Comp = {
5239
5243
  Await: await_default,