@delta-comic/plugin 0.1.0 → 0.2.0

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
@@ -1,10 +1,10 @@
1
1
  import { DBUtils, PluginArchiveDB, SubscribeDB, db, useNativeStore } from "@delta-comic/db";
2
2
  import { useGlobalVar } from "@delta-comic/utils";
3
- import { Fragment, computed, createBlock, createElementBlock, createVNode, defineComponent, getCurrentInstance, getCurrentScope, h, hasInjectionContext, inject, isRef, markRaw, mergeProps, onMounted, openBlock, reactive, ref, renderList, resolveDynamicComponent, shallowReactive, shallowRef, toValue, unref, watch, watchEffect } from "vue";
3
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, getCurrentInstance, getCurrentScope, h, hasInjectionContext, inject, isRef, markRaw, mergeProps, onMounted, openBlock, reactive, ref, renderList, resolveDynamicComponent, shallowReactive, shallowRef, toValue, unref, watch, watchEffect, withCtx } from "vue";
4
4
  import { defineStore } from "pinia";
5
5
  import { PromiseContent, SourcedKeyMap, uni } from "@delta-comic/model";
6
6
  import { SharedFunction } from "@delta-comic/core";
7
- import { DcPopup, createDialog, createDownloadMessage, createForm } from "@delta-comic/ui";
7
+ import { DcAwait, DcPopup, createDialog, createDownloadMessage, createForm } from "@delta-comic/ui";
8
8
  import axios from "axios";
9
9
  var __commonJSMin = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), __require = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
10
10
  if (typeof require < "u") return require.apply(this, arguments);
@@ -6364,13 +6364,29 @@ var Inject_default = /* @__PURE__ */ defineComponent({
6364
6364
  },
6365
6365
  setup(e) {
6366
6366
  let t = e, n = computed(() => Array.from(Global.envExtends.values()).filter((e) => e.key == t.key));
6367
- return (t, r) => (openBlock(!0), createElementBlock(Fragment, null, renderList(n.value, (t) => (openBlock(), createBlock(resolveDynamicComponent(t.component), mergeProps({ ref_for: !0 }, e.args), null, 16))), 256));
6367
+ return (t, r) => (openBlock(!0), createElementBlock(Fragment, null, renderList(n.value, (t) => (openBlock(), createBlock(unref(DcAwait), {
6368
+ promise: async () => {
6369
+ try {
6370
+ return await t.condition(e.args);
6371
+ } catch (e) {
6372
+ return console.warn(e), !1;
6373
+ }
6374
+ },
6375
+ "auto-load": ""
6376
+ }, {
6377
+ default: withCtx(({ result: n }) => [n ? (openBlock(), createBlock(resolveDynamicComponent(t.component), mergeProps({
6378
+ key: 0,
6379
+ ref_for: !0
6380
+ }, e.args), null, 16)) : createCommentVNode("", !0)]),
6381
+ _: 2
6382
+ }, 1032, ["promise"]))), 256));
6368
6383
  }
6369
6384
  });
6370
- const addInjection = (e, t) => {
6385
+ const addInjection = (e, t, n) => {
6371
6386
  Global.envExtends.add({
6372
6387
  key: e,
6373
- component: markRaw(t)
6388
+ component: t,
6389
+ condition: n ?? (() => !0)
6374
6390
  });
6375
6391
  };
6376
6392
  export { ConfigPointer, Global, Inject_default as Inject, addInjection, appConfig, bootPlugin, declareDepType, decodePluginMeta, definePlugin, installDepends, installFilePlugin, installPlugin, loadAllPlugins, loadPlugin, pluginEmitter, pluginExposes, installers as pluginInstallers, loaders as pluginLoaders, require$1 as require, updatePlugin, useConfig, usePluginConfig, usePluginStore };