@inpageedit/core 0.13.1 → 0.14.1

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.
Files changed (77) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +13 -4
  3. package/dist/{BasePlugin-Bf2UuIHF.js → BasePlugin-YOi2_vUo.js} +17 -26
  4. package/dist/BasePlugin-YOi2_vUo.js.map +1 -0
  5. package/dist/IconQuickEdit-CMCQncyj.js.map +1 -1
  6. package/dist/InputBox-nQKtiWtZ.js.map +1 -1
  7. package/dist/{PluginPrefSync-Dn1Xsiqz.js → PluginPrefSync-jTNlRQE-.js} +124 -128
  8. package/dist/PluginPrefSync-jTNlRQE-.js.map +1 -0
  9. package/dist/PluginStoreApp-CGNxKXAN.js +453 -0
  10. package/dist/PluginStoreApp-CGNxKXAN.js.map +1 -0
  11. package/dist/{endpoints-DgyuoRZd.js → Preferences-BF2fcXrn.js} +608 -576
  12. package/dist/Preferences-BF2fcXrn.js.map +1 -0
  13. package/dist/WatchlistAction-BbNAyryN.js.map +1 -1
  14. package/dist/components/index.js.map +1 -1
  15. package/dist/index-3NZkG2a3.js +116 -0
  16. package/dist/index-3NZkG2a3.js.map +1 -0
  17. package/dist/{index-BJ7_Q1mB.js → index-BBNseJXG.js} +17 -16
  18. package/dist/index-BBNseJXG.js.map +1 -0
  19. package/dist/{index-BQ-cHWkJ.js → index-Bb0FiU2c.js} +66 -48
  20. package/dist/index-Bb0FiU2c.js.map +1 -0
  21. package/dist/{index-DqA6EAM6.js → index-BgkZW91u.js} +1429 -928
  22. package/dist/index-BgkZW91u.js.map +1 -0
  23. package/dist/index-BrYKe18j.js +179 -0
  24. package/dist/index-BrYKe18j.js.map +1 -0
  25. package/dist/index-CG38LlAh.js.map +1 -1
  26. package/dist/index-CM_6yF2v.js.map +1 -1
  27. package/dist/index-D-fW3ESK.js +195 -0
  28. package/dist/index-D-fW3ESK.js.map +1 -0
  29. package/dist/index-D6zFqL2u.js +173 -0
  30. package/dist/index-D6zFqL2u.js.map +1 -0
  31. package/dist/{index-CCRMmnwk.js → index-D97lUU3h.js} +67 -66
  32. package/dist/index-D97lUU3h.js.map +1 -0
  33. package/dist/index-DD5CVCfD.js.map +1 -1
  34. package/dist/{index-B7c6jL9x.js → index-DELHsLHS.js} +146 -137
  35. package/dist/index-DELHsLHS.js.map +1 -0
  36. package/dist/{index-BwdWyHLe.js → index-DTHY5rAO.js} +93 -93
  37. package/dist/index-DTHY5rAO.js.map +1 -0
  38. package/dist/index-DmLoihN1.js +394 -0
  39. package/dist/index-DmLoihN1.js.map +1 -0
  40. package/dist/index.d.ts +362 -43
  41. package/dist/index.js +32 -26
  42. package/dist/index.js.map +1 -1
  43. package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
  44. package/dist/models/index.js +174 -154
  45. package/dist/models/index.js.map +1 -1
  46. package/dist/noop-ClDc6zv4.js.map +1 -1
  47. package/dist/plugins/index.js +10 -10
  48. package/dist/services/index.js +1 -1
  49. package/dist/style.css +1 -1
  50. package/dist/vueHooks-l04s8cIl.js.map +1 -1
  51. package/lib/index.umd.js +20 -12
  52. package/lib/index.umd.js.map +1 -1
  53. package/lib/style.css +1 -1
  54. package/package.json +4 -4
  55. package/dist/BasePlugin-Bf2UuIHF.js.map +0 -1
  56. package/dist/PluginPrefSync-Dn1Xsiqz.js.map +0 -1
  57. package/dist/PluginStoreApp-CpOLArL7.js +0 -452
  58. package/dist/PluginStoreApp-CpOLArL7.js.map +0 -1
  59. package/dist/Preferences-DS4-CFWe.js +0 -9
  60. package/dist/Preferences-DS4-CFWe.js.map +0 -1
  61. package/dist/endpoints-DgyuoRZd.js.map +0 -1
  62. package/dist/index-2RfILgXm.js +0 -180
  63. package/dist/index-2RfILgXm.js.map +0 -1
  64. package/dist/index-B7c6jL9x.js.map +0 -1
  65. package/dist/index-BJ7_Q1mB.js.map +0 -1
  66. package/dist/index-BNh95-x2.js +0 -115
  67. package/dist/index-BNh95-x2.js.map +0 -1
  68. package/dist/index-BQ-cHWkJ.js.map +0 -1
  69. package/dist/index-BwdWyHLe.js.map +0 -1
  70. package/dist/index-CCRMmnwk.js.map +0 -1
  71. package/dist/index-CnIpUF9x.js +0 -173
  72. package/dist/index-CnIpUF9x.js.map +0 -1
  73. package/dist/index-CyG7_IYz.js +0 -394
  74. package/dist/index-CyG7_IYz.js.map +0 -1
  75. package/dist/index-DqA6EAM6.js.map +0 -1
  76. package/dist/index-eSlbrNqF.js +0 -146
  77. package/dist/index-eSlbrNqF.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,26 +1,25 @@
1
- import { I as s } from "./index-DqA6EAM6.js";
2
- import { m as l, $ as g, S as m } from "./index-DqA6EAM6.js";
3
- import { E as r } from "./endpoints-DgyuoRZd.js";
4
- import { I as L, S as P, a as U } from "./endpoints-DgyuoRZd.js";
5
- import { B as S } from "./BasePlugin-Bf2UuIHF.js";
6
- import { R as M } from "./Preferences-DS4-CFWe.js";
1
+ import { I as s } from "./index-BgkZW91u.js";
2
+ import { m as l, $ as g, S as m } from "./index-BgkZW91u.js";
3
+ import { E as r } from "./Preferences-BF2fcXrn.js";
4
+ import { C as S, s as I, a as P, F as y, I as U, e as M, M as h, R, S as O, b as D, c as b } from "./Preferences-BF2fcXrn.js";
5
+ import { B as A } from "./BasePlugin-YOi2_vUo.js";
7
6
  window.RLQ ||= [];
8
7
  window.__IPE_MODULES__ ||= [];
9
8
  w("InPageEdit#autoload", () => {
10
9
  const _ = a();
11
- _ && c({
10
+ _ && d({
12
11
  baseURL: _,
13
12
  InPageEdit: s
14
13
  });
15
14
  });
16
- async function c(_ = { baseURL: a(), InPageEdit: s }) {
17
- const { baseURL: o, InPageEdit: i } = _;
15
+ async function d(_ = { baseURL: a(), InPageEdit: s }) {
16
+ const { baseURL: n, InPageEdit: i } = _;
18
17
  typeof window?.ipe?.stop == "function" && await window.ipe.stop();
19
- const d = window.InPageEdit || {}, e = new i({
18
+ const c = window.InPageEdit || {}, e = new i({
20
19
  apiConfigs: {
21
- baseURL: o
20
+ baseURL: n
22
21
  },
23
- legacyPreferences: d?.myPreferences || {}
22
+ legacyPreferences: c?.myPreferences || {}
24
23
  });
25
24
  if (window.ipe = e, await e.start(), window.RLQ.push(() => {
26
25
  mw.hook("InPageEdit.ready").fire(e);
@@ -28,13 +27,13 @@ async function c(_ = { baseURL: a(), InPageEdit: s }) {
28
27
  const t = [];
29
28
  for (; window.__IPE_MODULES__.length; )
30
29
  try {
31
- const n = window.__IPE_MODULES__.shift();
32
- typeof n == "function" && n?.(e), t.push(n);
30
+ const o = window.__IPE_MODULES__.shift();
31
+ typeof o == "function" && o?.(e), t.push(o);
33
32
  } catch {
34
33
  }
35
34
  window.__IPE_MODULES__ = {
36
- push: (n) => {
37
- typeof n == "function" && n(e), t.push(n);
35
+ push: (o) => {
36
+ typeof o == "function" && o(e), t.push(o);
38
37
  }
39
38
  }, e.on("dispose", () => {
40
39
  window.__IPE_MODULES__ = t;
@@ -48,29 +47,36 @@ async function c(_ = { baseURL: a(), InPageEdit: s }) {
48
47
  _/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_
49
48
  /___/_/ /_/_/ \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/
50
49
  /____/ v` + e.version + `
51
- - Wiki API Endpoint: ${o}
50
+ - Wiki API Endpoint: ${n}
52
51
  - Documentation: ${r.HOME_URL}
53
52
  - Bug Reports: ${r.GITHUB_URL}`
54
53
  );
55
54
  }
56
55
  function a() {
57
- const _ = document.querySelector('meta[name="generator"][content^="MediaWiki"]') !== null, o = document.querySelector('link[rel="EditURI"]')?.href?.split("?")[0];
58
- return _ && o ? o : void 0;
56
+ const _ = document.querySelector('meta[name="generator"][content^="MediaWiki"]') !== null, n = document.querySelector('link[rel="EditURI"]')?.href?.split("?")[0];
57
+ return _ && n ? n : void 0;
59
58
  }
60
- function w(_, o) {
59
+ function w(_, n) {
61
60
  const i = Symbol.for(_);
62
- return window[i] ? !1 : (window[i] = !0, o(), !0);
61
+ return window[i] ? !1 : (window[i] = !0, n(), !0);
63
62
  }
64
63
  export {
65
- S as BasePlugin,
64
+ A as BasePlugin,
65
+ S as CordisError,
66
+ I as CordisSymbols,
67
+ P as EffectScope,
66
68
  r as Endpoints,
69
+ y as ForkScope,
67
70
  s as InPageEdit,
68
- L as Inject,
71
+ U as Inject,
72
+ M as Lifecycle,
69
73
  l as Logger,
70
74
  g as LoggerLevel,
71
- M as RegisterPreferences,
72
- P as Schema,
73
- U as Service,
75
+ h as MainScope,
76
+ R as RegisterPreferences,
77
+ O as Schema,
78
+ D as ScopeStatus,
79
+ b as Service,
74
80
  m as createLogger
75
81
  };
76
82
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import './polyfills/index.js'\nimport { InPageEdit } from './InPageEdit.js'\nimport { Endpoints } from './constants/endpoints.js'\n\n// 模块重导出\nexport * from './InPageEdit.js'\nexport { default as BasePlugin } from './plugins/BasePlugin.js'\nexport { Endpoints }\nexport { RegisterPreferences } from './decorators/Preferences.js'\n\n// Safe guard\nwindow.RLQ ||= []\nwindow.__IPE_MODULES__ ||= []\n\n// Auto load if the site is MediaWiki\nrunOnce('InPageEdit#autoload', () => {\n const baseURL = detectMediaWikiApiEndpoint()\n if (baseURL) {\n autoload({\n baseURL,\n InPageEdit,\n })\n }\n})\nasync function autoload(\n _overload: {\n baseURL?: string\n InPageEdit: typeof InPageEdit\n } = { baseURL: detectMediaWikiApiEndpoint(), InPageEdit: InPageEdit }\n) {\n const { baseURL, InPageEdit: IPE } = _overload\n\n // 防止多次运行\n if (typeof window?.ipe?.stop === 'function') {\n console.warn('[InPageEdit] Already loaded, disposing...')\n await window.ipe.stop()\n }\n\n const oldGlobalVar: any = (window as any).InPageEdit || {}\n const ipe = new IPE({\n apiConfigs: {\n baseURL,\n },\n legacyPreferences: oldGlobalVar?.myPreferences || {},\n })\n\n // Merge into global variables\n window.ipe = ipe\n\n // Start the App\n await ipe.start()\n\n // Trigger the mw.hook\n window.RLQ.push(() => {\n mw.hook('InPageEdit.ready').fire(ipe)\n })\n\n // Initialize global modules\n if (Array.isArray(window.__IPE_MODULES__)) {\n const installedModules = [] as any[]\n while (window.__IPE_MODULES__.length) {\n try {\n const payload = window.__IPE_MODULES__.shift()\n typeof payload === 'function' && payload?.(ipe)\n installedModules.push(payload)\n } catch (error) {\n console.error('[InPageEdit] Failed to initialize module:', error)\n }\n }\n window.__IPE_MODULES__ = {\n push: (payload) => {\n typeof payload === 'function' && payload(ipe)\n installedModules.push(payload)\n },\n }\n ipe.on('dispose', () => {\n window.__IPE_MODULES__ = installedModules\n })\n }\n\n // 花里胡哨的加载提示\n ipe.logger('AUTOLOAD').info(\n '\\n' +\n ' ____ ____ ______ ___ __ \\n / _/___ / __ \\\\____ _____ ____ / ____/___/ (_) /_\\n / // __ \\\\/ /_/ / __ `/ __ `/ _ \\\\/ __/ / __ / / __/\\n _/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_ \\n/___/_/ /_/_/ \\\\__,_/\\\\__, /\\\\___/_____/\\\\__,_/_/\\\\__/ \\n /____/ v' +\n ipe.version +\n `\n- Wiki API Endpoint: ${baseURL}\n- Documentation: ${Endpoints.HOME_URL}\n- Bug Reports: ${Endpoints.GITHUB_URL}`\n )\n}\n\nfunction detectMediaWikiApiEndpoint(): string | undefined {\n const isMediaWiki =\n document.querySelector('meta[name=\"generator\"][content^=\"MediaWiki\"]') !== null\n const apiBase = document\n .querySelector<HTMLLinkElement>('link[rel=\"EditURI\"]')\n ?.href?.split('?')[0]\n return isMediaWiki && apiBase ? apiBase : undefined\n}\n\nfunction runOnce(key: string, fn: Function) {\n const sym = Symbol.for(key)\n if ((window as any)[sym]) {\n return false\n }\n ;(window as any)[sym] = true\n fn()\n return true\n}\n\n// HMR\nif (import.meta.hot) {\n const SEPARATOR = `\\n${'='.repeat(20)} [InPageEdit] HMR ${'='.repeat(20)}\\n`\n import.meta.hot.accept(async (modules) => {\n const apiBase = detectMediaWikiApiEndpoint()!\n const IPE = modules?.InPageEdit as unknown as typeof InPageEdit\n if (!apiBase || !IPE) {\n console.warn(SEPARATOR.trimStart(), 'missing modules', SEPARATOR.trimEnd())\n location.reload()\n return\n }\n\n console.info(SEPARATOR.trimStart(), \"I'm so hot!\", modules, SEPARATOR.trimEnd())\n await window?.ipe?.stop()\n window.ipe = undefined as any\n autoload({\n baseURL: apiBase,\n InPageEdit: IPE,\n })\n })\n}\n\n// 类型定义\n\n// Global types declaration\ndeclare global {\n const ipe: InPageEdit\n interface Window {\n ipe: InPageEdit\n __IPE_MODULES__: {\n push(payload: (ipe: InPageEdit) => void): void\n }\n }\n}\n\n// MediaWiki ResourceLoader Queue\ndeclare global {\n interface Window {\n RLQ: {\n push(callback: () => void): void\n push(depAndCallback: [string, () => void]): void\n push(depsAndCallback: [string[], () => void]): void\n }\n }\n}\n\n// declare mw.hook\ndeclare global {\n namespace mw {\n /**\n * @see https://doc.wikimedia.org/mediawiki-core/master/js/Hook.html\n * @see https://github.com/wikimedia-gadgets/types-mediawiki/blob/9b4e7c3b9034d64a44a0667229a6d9585fe09b30/mw/hook.d.ts\n */\n interface Hook<T extends any[] = any[]> {\n add(...handler: Array<(...data: T) => any>): this\n deprecate(msg: string): this\n fire(...data: T): this\n remove(...handler: Array<(...data: T) => any>): this\n }\n function hook(name: 'InPageEdit.ready'): Hook<[InPageEdit]>\n }\n}\n\n// 类型重导出\n\n// expose all types\nexport type * from './components/index.js'\nexport type * from './models/index.js'\nexport type * from './plugins/index.js'\nexport type * from './services/index.js'\nexport type * from './types/index.js'\n"],"names":["runOnce","baseURL","detectMediaWikiApiEndpoint","autoload","InPageEdit","_overload","IPE","oldGlobalVar","ipe","installedModules","payload","Endpoints","isMediaWiki","apiBase","key","fn","sym"],"mappings":";;;;;;AAWA,OAAO,QAAQ,CAAA;AACf,OAAO,oBAAoB,CAAA;AAG3BA,EAAQ,uBAAuB,MAAM;A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,QAAQ;AAAA,uBAClBA,EAAU,UAAU;AAAA,EAAA;AAE3C;AAEA,SAAST,IAAiD;AACxD,QAAMU,IACJ,SAAS,cAAc,8CAA8C,MAAM,MACvEC,IAAU,SACb,cAA+B,qBAAqB,GACnD,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,SAAOD,KAAeC,IAAUA,IAAU;AAC5C;AAEA,SAASb,EAAQc,GAAaC,GAAc;AAC1C,QAAMC,IAAM,OAAO,IAAIF,CAAG;AAC1B,SAAK,OAAeE,CAAG,IACd,MAEP,OAAeA,CAAG,IAAI,IACxBD,EAAA,GACO;AACT;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import './polyfills/index.js'\nimport { InPageEdit } from './InPageEdit.js'\nimport { Endpoints } from './constants/endpoints.js'\n\n// 模块重导出\nexport * from './InPageEdit.js'\nexport { default as BasePlugin } from './plugins/BasePlugin.js'\nexport { Endpoints }\nexport { RegisterPreferences } from './decorators/Preferences.js'\n\n// Safe guard\nwindow.RLQ ||= []\nwindow.__IPE_MODULES__ ||= []\n\n// Auto load if the site is MediaWiki\nrunOnce('InPageEdit#autoload', () => {\n const baseURL = detectMediaWikiApiEndpoint()\n if (baseURL) {\n autoload({\n baseURL,\n InPageEdit,\n })\n }\n})\nasync function autoload(\n _overload: {\n baseURL?: string\n InPageEdit: typeof InPageEdit\n } = { baseURL: detectMediaWikiApiEndpoint(), InPageEdit: InPageEdit }\n) {\n const { baseURL, InPageEdit: IPE } = _overload\n\n // 防止多次运行\n if (typeof window?.ipe?.stop === 'function') {\n console.warn('[InPageEdit] Already loaded, disposing...')\n await window.ipe.stop()\n }\n\n const oldGlobalVar: any = (window as any).InPageEdit || {}\n const ipe = new IPE({\n apiConfigs: {\n baseURL,\n },\n legacyPreferences: oldGlobalVar?.myPreferences || {},\n })\n\n // Merge into global variables\n window.ipe = ipe\n\n // Start the App\n await ipe.start()\n\n // Trigger the mw.hook\n window.RLQ.push(() => {\n mw.hook('InPageEdit.ready').fire(ipe)\n })\n\n // Initialize global modules\n if (Array.isArray(window.__IPE_MODULES__)) {\n const installedModules = [] as any[]\n while (window.__IPE_MODULES__.length) {\n try {\n const payload = window.__IPE_MODULES__.shift()\n typeof payload === 'function' && payload?.(ipe)\n installedModules.push(payload)\n } catch (error) {\n console.error('[InPageEdit] Failed to initialize module:', error)\n }\n }\n window.__IPE_MODULES__ = {\n push: (payload) => {\n typeof payload === 'function' && payload(ipe)\n installedModules.push(payload)\n },\n }\n ipe.on('dispose', () => {\n window.__IPE_MODULES__ = installedModules\n })\n }\n\n // 花里胡哨的加载提示\n ipe.logger('AUTOLOAD').info(\n '\\n' +\n ' ____ ____ ______ ___ __ \\n / _/___ / __ \\\\____ _____ ____ / ____/___/ (_) /_\\n / // __ \\\\/ /_/ / __ `/ __ `/ _ \\\\/ __/ / __ / / __/\\n _/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_ \\n/___/_/ /_/_/ \\\\__,_/\\\\__, /\\\\___/_____/\\\\__,_/_/\\\\__/ \\n /____/ v' +\n ipe.version +\n `\n- Wiki API Endpoint: ${baseURL}\n- Documentation: ${Endpoints.HOME_URL}\n- Bug Reports: ${Endpoints.GITHUB_URL}`\n )\n}\n\nfunction detectMediaWikiApiEndpoint(): string | undefined {\n const isMediaWiki =\n document.querySelector('meta[name=\"generator\"][content^=\"MediaWiki\"]') !== null\n const apiBase = document\n .querySelector<HTMLLinkElement>('link[rel=\"EditURI\"]')\n ?.href?.split('?')[0]\n return isMediaWiki && apiBase ? apiBase : undefined\n}\n\nfunction runOnce(key: string, fn: Function) {\n const sym = Symbol.for(key)\n if ((window as any)[sym]) {\n return false\n }\n ;(window as any)[sym] = true\n fn()\n return true\n}\n\n// HMR\nif (import.meta.hot) {\n const SEPARATOR = `\\n${'='.repeat(20)} [InPageEdit] HMR ${'='.repeat(20)}\\n`\n import.meta.hot.accept(async (modules) => {\n const apiBase = detectMediaWikiApiEndpoint()!\n const IPE = modules?.InPageEdit as unknown as typeof InPageEdit\n if (!apiBase || !IPE) {\n console.warn(SEPARATOR.trimStart(), 'missing modules', SEPARATOR.trimEnd())\n location.reload()\n return\n }\n\n console.info(SEPARATOR.trimStart(), \"I'm so hot!\", modules, SEPARATOR.trimEnd())\n await window?.ipe?.stop()\n window.ipe = undefined as any\n autoload({\n baseURL: apiBase,\n InPageEdit: IPE,\n })\n })\n}\n\n// 类型定义\n\n// Global types declaration\ndeclare global {\n const ipe: InPageEdit\n interface Window {\n ipe: InPageEdit\n __IPE_MODULES__: {\n push(payload: (ipe: InPageEdit) => void): void\n }\n }\n}\n\n// MediaWiki ResourceLoader Queue\ndeclare global {\n interface Window {\n RLQ: {\n push(callback: () => void): void\n push(depAndCallback: [string, () => void]): void\n push(depsAndCallback: [string[], () => void]): void\n }\n }\n}\n\n// declare mw.hook\ndeclare global {\n namespace mw {\n /**\n * @see https://doc.wikimedia.org/mediawiki-core/master/js/Hook.html\n * @see https://github.com/wikimedia-gadgets/types-mediawiki/blob/9b4e7c3b9034d64a44a0667229a6d9585fe09b30/mw/hook.d.ts\n */\n interface Hook<T extends any[] = any[]> {\n add(...handler: Array<(...data: T) => any>): this\n deprecate(msg: string): this\n fire(...data: T): this\n remove(...handler: Array<(...data: T) => any>): this\n }\n function hook(name: 'InPageEdit.ready'): Hook<[InPageEdit]>\n }\n}\n\n// 类型重导出\n\n// expose all types\nexport type * from './components/index.js'\nexport type * from './models/index.js'\nexport type * from './plugins/index.js'\nexport type * from './services/index.js'\nexport type * from './types/index.js'\n"],"names":["runOnce","baseURL","detectMediaWikiApiEndpoint","autoload","InPageEdit","_overload","IPE","oldGlobalVar","ipe","installedModules","payload","Endpoints","isMediaWiki","apiBase","key","fn","sym"],"mappings":";;;;;AAWA,OAAO,QAAQ,CAAA;AACf,OAAO,oBAAoB,CAAA;AAG3BA,EAAQ,uBAAuB,MAAM;AACnC,QAAMC,IAAUC,EAAA;AAChB,EAAID,KACFE,EAAS;AAAA,IACP,SAAAF;AAAA,I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ACxD,QAAMU,IACJ,SAAS,cAAc,8CAA8C,MAAM,MACvEC,IAAU,SACb,cAA+B,qBAAqB,GACnD,MAAM,MAAM,GAAG,EAAE,CAAC;AACtB,SAAOD,KAAeC,IAAUA,IAAU;AAC5C;AAEA,SAASb,EAAQc,GAAaC,GAAc;AAC1C,QAAMC,IAAM,OAAO,IAAIF,CAAG;AAC1B,SAAK,OAAeE,CAAG,IACd,MAEP,OAAeA,CAAG,IAAI,IACxBD,EAAA,GACO;AACT;"}
@@ -1 +1 @@
1
- {"version":3,"file":"makeCallable-LDU0xZMJ.js","sources":["../src/utils/makeCallable.ts"],"sourcesContent":["export const CALLABLE_APPLY_SYMBOL = Symbol('@@apply')\r\nexport const CALLABLE_CTOR_SYMBOL = Symbol('@@ctor')\r\nexport function makeCallable<C extends object, M extends keyof C>(\r\n instance: C,\r\n method: M\r\n): C &\r\n ((\r\n ...args: C[M] extends (...a: infer P) => any ? P : never\r\n ) => C[M] extends (...a: any[]) => infer R ? R : never) {\r\n if (typeof instance !== 'object' || instance === null || Array.isArray(instance)) {\r\n throw new TypeError('instance is not an object')\r\n }\r\n\r\n const apply: any = (...args: any[]) => {\r\n const fn = (instance as any)[method]\r\n if (typeof fn !== 'function') {\r\n throw new TypeError(`Property \"${String(method)}\" is not a function`)\r\n }\r\n return fn.apply(instance, args)\r\n }\r\n apply[CALLABLE_APPLY_SYMBOL] = apply\r\n apply[CALLABLE_CTOR_SYMBOL] = instance\r\n\r\n const ctorName = (instance as any)?.constructor?.name\r\n if (ctorName) (apply as any)[Symbol.toStringTag] = ctorName\r\n\r\n const proxy = new Proxy(apply, {\r\n get(_, p, receiver) {\r\n if (p === 'prototype') return Reflect.get(apply, p, receiver)\r\n return Reflect.get(instance as any, p, instance)\r\n },\r\n set(_, p, v) {\r\n return Reflect.set(instance as any, p, v)\r\n },\r\n has(_, p) {\r\n return Reflect.has(instance as any, p)\r\n },\r\n deleteProperty(_, p) {\r\n return Reflect.deleteProperty(instance as any, p)\r\n },\r\n ownKeys() {\r\n return Reflect.ownKeys(instance as any)\r\n },\r\n getOwnPropertyDescriptor(_, p) {\r\n return Object.getOwnPropertyDescriptor(instance as any, p)\r\n },\r\n defineProperty(_, p, desc) {\r\n return Object.defineProperty(instance as any, p, desc)\r\n },\r\n })\r\n\r\n return proxy as unknown as any\r\n}\r\n"],"names":["CALLABLE_APPLY_SYMBOL","CALLABLE_CTOR_SYMBOL","makeCallable","instance","method","apply","args","fn","ctorName","_","p","receiver","v","desc"],"mappings":"AAAO,MAAMA,IAAwB,OAAO,SAAS,GACxCC,IAAuB,OAAO,QAAQ;AAC5C,SAASC,EACdC,GACAC,GAIwD;AACxD,MAAI,OAAOD,KAAa,YAAYA,MAAa,QAAQ,MAAM,QAAQA,CAAQ;AAC7E,UAAM,IAAI,UAAU,2BAA2B;AAGjD,QAAME,IAAa,IAAIC,MAAgB;AACrC,UAAMC,IAAMJ,EAAiBC,CAAM;AACnC,QAAI,OAAOG,KAAO;AAChB,YAAM,IAAI,UAAU,aAAa,OAAOH,CAAM,CAAC,qBAAqB;AAEtE,WAAOG,EAAG,MAAMJ,GAAUG,CAAI;AAAA,EAChC;AACA,EAAAD,EAAML,CAAqB,IAAIK,GAC/BA,EAAMJ,CAAoB,IAAIE;AAE9B,QAAMK,IAAYL,GAAkB,aAAa;AACjD,SAAIK,MAAWH,EAAc,OAAO,WAAW,IAAIG,IAErC,IAAI,MAAMH,GAAO;AAAA,IAC7B,IAAII,GAAGC,GAAGC,GAAU;AAClB,aAAID,MAAM,cAAoB,QAAQ,IAAIL,GAAOK,GAAGC,CAAQ,IACrD,QAAQ,IAAIR,GAAiBO,GAAGP,CAAQ;AAAA,IACjD;AAAA,IACA,IAAIM,GAAGC,GAAGE,GAAG;AACX,aAAO,QAAQ,IAAIT,GAAiBO,GAAGE,CAAC;AAAA,IAC1C;AAAA,IACA,IAAIH,GAAGC,GAAG;AACR,aAAO,QAAQ,IAAIP,GAAiBO,CAAC;AAAA,IACvC;AAAA,IACA,eAAeD,GAAGC,GAAG;AACnB,aAAO,QAAQ,eAAeP,GAAiBO,CAAC;AAAA,IAClD;AAAA,IACA,UAAU;AACR,aAAO,QAAQ,QAAQP,CAAe;AAAA,IACxC;AAAA,IACA,yBAAyBM,GAAGC,GAAG;AAC7B,aAAO,OAAO,yBAAyBP,GAAiBO,CAAC;AAAA,IAC3D;AAAA,IACA,eAAeD,GAAGC,GAAGG,GAAM;AACzB,aAAO,OAAO,eAAeV,GAAiBO,GAAGG,CAAI;AAAA,IACvD;AAAA,EAAA,CACD;AAGH;"}
1
+ {"version":3,"file":"makeCallable-LDU0xZMJ.js","sources":["../src/utils/makeCallable.ts"],"sourcesContent":["export const CALLABLE_APPLY_SYMBOL = Symbol('@@apply')\nexport const CALLABLE_CTOR_SYMBOL = Symbol('@@ctor')\nexport function makeCallable<C extends object, M extends keyof C>(\n instance: C,\n method: M\n): C &\n ((\n ...args: C[M] extends (...a: infer P) => any ? P : never\n ) => C[M] extends (...a: any[]) => infer R ? R : never) {\n if (typeof instance !== 'object' || instance === null || Array.isArray(instance)) {\n throw new TypeError('instance is not an object')\n }\n\n const apply: any = (...args: any[]) => {\n const fn = (instance as any)[method]\n if (typeof fn !== 'function') {\n throw new TypeError(`Property \"${String(method)}\" is not a function`)\n }\n return fn.apply(instance, args)\n }\n apply[CALLABLE_APPLY_SYMBOL] = apply\n apply[CALLABLE_CTOR_SYMBOL] = instance\n\n const ctorName = (instance as any)?.constructor?.name\n if (ctorName) (apply as any)[Symbol.toStringTag] = ctorName\n\n const proxy = new Proxy(apply, {\n get(_, p, receiver) {\n if (p === 'prototype') return Reflect.get(apply, p, receiver)\n return Reflect.get(instance as any, p, instance)\n },\n set(_, p, v) {\n return Reflect.set(instance as any, p, v)\n },\n has(_, p) {\n return Reflect.has(instance as any, p)\n },\n deleteProperty(_, p) {\n return Reflect.deleteProperty(instance as any, p)\n },\n ownKeys() {\n return Reflect.ownKeys(instance as any)\n },\n getOwnPropertyDescriptor(_, p) {\n return Object.getOwnPropertyDescriptor(instance as any, p)\n },\n defineProperty(_, p, desc) {\n return Object.defineProperty(instance as any, p, desc)\n },\n })\n\n return proxy as unknown as any\n}\n"],"names":["CALLABLE_APPLY_SYMBOL","CALLABLE_CTOR_SYMBOL","makeCallable","instance","method","apply","args","fn","ctorName","_","p","receiver","v","desc"],"mappings":"AAAO,MAAMA,IAAwB,OAAO,SAAS,GACxCC,IAAuB,OAAO,QAAQ;AAC5C,SAASC,EACdC,GACAC,GAIwD;AACxD,MAAI,OAAOD,KAAa,YAAYA,MAAa,QAAQ,MAAM,QAAQA,CAAQ;AAC7E,UAAM,IAAI,UAAU,2BAA2B;AAGjD,QAAME,IAAa,IAAIC,MAAgB;AACrC,UAAMC,IAAMJ,EAAiBC,CAAM;AACnC,QAAI,OAAOG,KAAO;AAChB,YAAM,IAAI,UAAU,aAAa,OAAOH,CAAM,CAAC,qBAAqB;AAEtE,WAAOG,EAAG,MAAMJ,GAAUG,CAAI;AAAA,EAChC;AACA,EAAAD,EAAML,CAAqB,IAAIK,GAC/BA,EAAMJ,CAAoB,IAAIE;AAE9B,QAAMK,IAAYL,GAAkB,aAAa;AACjD,SAAIK,MAAWH,EAAc,OAAO,WAAW,IAAIG,IAErC,IAAI,MAAMH,GAAO;AAAA,IAC7B,IAAII,GAAGC,GAAGC,GAAU;AAClB,aAAID,MAAM,cAAoB,QAAQ,IAAIL,GAAOK,GAAGC,CAAQ,IACrD,QAAQ,IAAIR,GAAiBO,GAAGP,CAAQ;AAAA,IACjD;AAAA,IACA,IAAIM,GAAGC,GAAGE,GAAG;AACX,aAAO,QAAQ,IAAIT,GAAiBO,GAAGE,CAAC;AAAA,IAC1C;AAAA,IACA,IAAIH,GAAGC,GAAG;AACR,aAAO,QAAQ,IAAIP,GAAiBO,CAAC;AAAA,IACvC;AAAA,IACA,eAAeD,GAAGC,GAAG;AACnB,aAAO,QAAQ,eAAeP,GAAiBO,CAAC;AAAA,IAClD;AAAA,IACA,UAAU;AACR,aAAO,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