delta-comic-core 0.0.5 → 0.0.8

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";
@@ -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
@@ -3265,7 +3265,7 @@ let utilInterceptors;
3265
3265
  })(utilInterceptors ||= {});
3266
3266
  const createAxios = (e, n = {}, r) => {
3267
3267
  let i = axios.create(n);
3268
- return r?.(i), i.interceptors.request.use(async (n) => (n.baseURL ??= await e(), n)), i.interceptors.response.use(void 0, utilInterceptors.isClientError), i.interceptors.response.use(void 0, utilInterceptors.createAutoRetry(i, 10)), {
3268
+ return r?.(i), i.interceptors.request.use(async (n) => (n.baseURL ??= await e(), n)), n.noPassClientError || i.interceptors.response.use(void 0, utilInterceptors.isClientError), i.interceptors.response.use(void 0, utilInterceptors.createAutoRetry(i, 10)), {
3269
3269
  get: async (e, n = {}) => utilInterceptors.useUnreadableRetry(() => i.get(e, n)),
3270
3270
  post: async (e, n, r = {}) => utilInterceptors.useUnreadableRetry(() => i.post(e, n, r)),
3271
3271
  postForm: async (e, n, r = {}) => utilInterceptors.useUnreadableRetry(() => i.postForm(e, n, r)),
@@ -3291,7 +3291,7 @@ var data_exports = /* @__PURE__ */ __export({
3291
3291
  }, PromiseContent = class e {
3292
3292
  [Symbol.toStringTag] = "PromiseContent";
3293
3293
  static _this;
3294
- static #_ = this._this = useGlobalVar(this, "data/PromiseContent");
3294
+ static #e = this._this = useGlobalVar(this, "data/PromiseContent");
3295
3295
  static isPromiseContent(e) {
3296
3296
  return e instanceof this._this;
3297
3297
  }
@@ -3365,7 +3365,7 @@ var data_exports = /* @__PURE__ */ __export({
3365
3365
  this.generator = e(this.abortController.signal, this), generatorMap.set(this, e);
3366
3366
  }
3367
3367
  static _this;
3368
- static #_ = this._this = useGlobalVar(this, "data/Stream");
3368
+ static #e = this._this = useGlobalVar(this, "data/Stream");
3369
3369
  static isStream(e) {
3370
3370
  return e instanceof this._this;
3371
3371
  }
@@ -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"
@@ -4875,7 +4875,11 @@ var Ce = ["data-index"], U = /* @__PURE__ */ defineComponent({
4875
4875
  return O(1e3 * e);
4876
4876
  }, O.en = C[S], O.Ls = C, O.p = {}, O;
4877
4877
  }));
4878
- })), import_dayjs_min$2 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), content_exports = /* @__PURE__ */ __export({ ContentPage: () => ContentPage }), ContentPage = class {
4878
+ })), import_dayjs_min$2 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), content_exports = /* @__PURE__ */ __export({
4879
+ ContentImagePage: () => ContentImagePage,
4880
+ ContentPage: () => ContentPage,
4881
+ ContentVideoPage: () => ContentVideoPage
4882
+ }), ContentPage = class {
4879
4883
  static viewLayout = useGlobalVar(shallowReactive(/* @__PURE__ */ new Map()), "uni/contentPage/viewLayout");
4880
4884
  static setViewLayout(e, n) {
4881
4885
  let r = this.toContentTypeString(e);
@@ -4963,6 +4967,10 @@ var Ce = ["data-index"], U = /* @__PURE__ */ defineComponent({
4963
4967
  union = computed(() => this.detail.content.data.value ?? this.preload.value);
4964
4968
  recommends = PromiseContent.withResolvers();
4965
4969
  eps = PromiseContent.withResolvers();
4970
+ }, ContentImagePage = class extends ContentPage {
4971
+ images = PromiseContent.withResolvers();
4972
+ }, ContentVideoPage = class extends ContentPage {
4973
+ videos = PromiseContent.withResolvers();
4966
4974
  }, ep_exports = /* @__PURE__ */ __export({ Ep: () => Ep }), Ep = class extends Struct {
4967
4975
  name;
4968
4976
  index;
@@ -4998,17 +5006,18 @@ var Ce = ["data-index"], U = /* @__PURE__ */ defineComponent({
4998
5006
  $$plugin;
4999
5007
  $$meta;
5000
5008
  thisEp;
5009
+ customIsSafe;
5001
5010
  get $thisEp() {
5002
5011
  return new Ep(this.thisEp);
5003
5012
  }
5004
5013
  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;
5014
+ 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
5015
  }
5007
5016
  commentSendable;
5008
5017
  customIsAI;
5009
5018
  get $isAi() {
5010
5019
  let e = (e) => /(^|[\((\[\s【])ai[】\))\]\s]?/gi.test(e);
5011
- return this.customIsAI || e(this.title) || this.author.some((n) => e(n));
5020
+ return this.customIsAI || e(this.title) || this.author.some((n) => e(`${n.label}\u1145${n.description}`));
5012
5021
  }
5013
5022
  }, comment_exports = /* @__PURE__ */ __export({ Comment: () => Comment }), import_dayjs_min$1 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), Comment = class extends Struct {
5014
5023
  static commentRow = shallowReactive(/* @__PURE__ */ new Map());
@@ -5039,6 +5048,20 @@ var Ce = ["data-index"], U = /* @__PURE__ */ defineComponent({
5039
5048
  }, user_exports = /* @__PURE__ */ __export({ User: () => User }), User = class {
5040
5049
  static userBase = shallowReactive(/* @__PURE__ */ new Map());
5041
5050
  static userEditorBase = shallowReactive(/* @__PURE__ */ new Map());
5051
+ static subscribes = shallowReactive(/* @__PURE__ */ new Map());
5052
+ static setSubscribes(e, n, r) {
5053
+ this.subscribes.set(`${e}:${n}`, r);
5054
+ }
5055
+ static getSubscribes(e, n) {
5056
+ return this.subscribes.get(`${e}:${n}`);
5057
+ }
5058
+ static authorActions = shallowReactive(/* @__PURE__ */ new Map());
5059
+ static setAuthorActions(e, n, r) {
5060
+ this.authorActions.set(`${e}:${n}`, r);
5061
+ }
5062
+ static getAuthorActions(e, n) {
5063
+ return this.authorActions.get(`${e}:${n}`);
5064
+ }
5042
5065
  constructor(e) {
5043
5066
  e.avatar && (this.avatar = Image$1.create(e.avatar)), this.name = e.name, this.id = e.id, this.$$plugin = e.$$plugin;
5044
5067
  }
@@ -5145,7 +5168,7 @@ const createLoadingMessage = (e = "加载中", n = window.$message) => {
5145
5168
  };
5146
5169
  var ConfigPointer = class {
5147
5170
  constructor(e, n) {
5148
- this.pluginName = e, this.config = n, this.key = Symbol(e);
5171
+ this.pluginName = e, this.config = n, this.key = Symbol.for(`config:${e}`);
5149
5172
  }
5150
5173
  key;
5151
5174
  };
@@ -5190,30 +5213,33 @@ const appConfig = new ConfigPointer("core", {
5190
5213
  let r = n.get(e.key);
5191
5214
  if (!r) throw Error(`not found config by plugin "${e.pluginName}"`);
5192
5215
  return r.value;
5193
- }, "load"), a = usePreferredDark();
5216
+ }, "load"), a = usePreferredDark(), o = computed(() => {
5217
+ if (!s(appConfig)) return a.value;
5218
+ switch (r(appConfig).value.darkMode) {
5219
+ case "light": return !1;
5220
+ case "dark": return !0;
5221
+ case "system": return a.value;
5222
+ default: return !1;
5223
+ }
5224
+ }), s = e.action((e) => n.has(e.key), "isExistConfig");
5194
5225
  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
- }),
5226
+ isDark: o,
5203
5227
  form: n,
5204
- $load: r
5228
+ $load: r,
5229
+ $isExistConfig: s,
5230
+ $resignerConfig: e.action((e) => {
5231
+ let n = useConfig(), r = useLocalStorage(`config:${e.pluginName}`, fromPairs(Object.entries(e.config).map(([e, n]) => [e, n.defaultValue])));
5232
+ n.form.set(e.key, {
5233
+ form: e.config,
5234
+ value: r
5235
+ });
5236
+ }, "resignerConfig")
5205
5237
  };
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) => {
5238
+ }), definePlugin = (e) => {
5213
5239
  if (isFunction(e)) var n = e(window.$$safe$$);
5214
5240
  else var n = e;
5215
5241
  console.log("[definePlugin] new plugin defining...", n);
5216
- let { name: r, content: i, image: a, search: o, user: s } = n;
5242
+ let { name: r, content: i, image: a, search: o, user: s, subscribe: c } = n;
5217
5243
  if (i) {
5218
5244
  for (let [e, n] of Object.entries(i.layout ?? {})) ContentPage.setViewLayout(e, n);
5219
5245
  for (let [e, n] of Object.entries(i.itemCard ?? {})) ContentPage.setItemCard(e, n);
@@ -5233,7 +5259,9 @@ const appConfig = new ConfigPointer("core", {
5233
5259
  for (let e of o.hotPage.topButton ?? []) ContentPage.setTopButton(r, e);
5234
5260
  }
5235
5261
  }
5236
- if (s && User.userEditorBase.set(r, s.edit), n.config) for (let e of n.config) resignerConfig(e);
5262
+ if (s && (s.edit && User.userEditorBase.set(r, s.edit), s.authorActions)) for (let [e, n] of Object.entries(s.authorActions)) User.setAuthorActions(r, e, n);
5263
+ if (c) for (let [e, n] of Object.entries(c)) User.setSubscribes(r, e, n);
5264
+ if (n.config) for (let e of n.config) useConfig().$resignerConfig(e);
5237
5265
  return SharedFunction.call("addPlugin", n);
5238
5266
  }, declareDependType = (e) => Symbol.for(`expose:${e}`), requireDepend = (e) => _pluginExposes.get(e), _pluginExposes = /* @__PURE__ */ new Map(), coreModule = declareDependType("core"), _ = void 0, Comp = {
5239
5267
  Await: await_default,