@funnycaptcha/embed 0.3.0 → 0.6.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/embed.js CHANGED
@@ -36,6 +36,10 @@ import "@funnycaptcha/anti-bot";
36
36
  import "@funnycaptcha/click-text";
37
37
  import "@funnycaptcha/color-pick";
38
38
  import "@funnycaptcha/puzzle";
39
+ import "@funnycaptcha/advanced-math";
40
+ import "@funnycaptcha/olympiad";
41
+ import "@funnycaptcha/equation-balance";
42
+ import "@funnycaptcha/random-hunt";
39
43
  var instances = /* @__PURE__ */ new Map();
40
44
  function render(root = document) {
41
45
  for (const t of scan(root)) {
package/dist/embed.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/scanner.ts","../src/iframe-host.ts","../src/index.ts"],"sourcesContent":["import type { Locale } from '@funnycaptcha/core';\n\nexport interface EmbedTarget {\n el: HTMLElement;\n type: string;\n locale: Locale;\n theme: 'light' | 'dark';\n}\n\nexport function scan(root: ParentNode = document): EmbedTarget[] {\n const els = Array.from(root.querySelectorAll<HTMLElement>('[data-funny-captcha]'));\n return els.map(el => ({\n el,\n type: el.dataset.type ?? 'math',\n locale: (el.dataset.locale as Locale) ?? 'zh',\n theme: (el.dataset.theme as 'light' | 'dark') ?? 'light',\n }));\n}\n","import type { CaptchaConfig, CaptchaInstance } from '@funnycaptcha/core';\nimport { getCaptcha } from '@funnycaptcha/core';\n\nexport function mountInto(\n container: HTMLElement,\n type: string,\n config: CaptchaConfig,\n): CaptchaInstance | null {\n const plugin = getCaptcha(type);\n if (!plugin) {\n container.innerHTML = `<div style=\"color:red\">Unknown captcha: ${type}</div>`;\n return null;\n }\n const inst = plugin.create(container, config);\n inst.mount();\n return inst;\n}\n","import { scan } from './scanner.js';\nimport { mountInto } from './iframe-host.js';\nimport '@funnycaptcha/math';\nimport '@funnycaptcha/text-distort';\nimport '@funnycaptcha/slider';\nimport '@funnycaptcha/click-order';\nimport '@funnycaptcha/rotate';\nimport '@funnycaptcha/spot-diff';\nimport '@funnycaptcha/emoji-match';\nimport '@funnycaptcha/meme-quiz';\nimport '@funnycaptcha/mini-game';\nimport '@funnycaptcha/anti-bot';\nimport '@funnycaptcha/click-text';\nimport '@funnycaptcha/color-pick';\nimport '@funnycaptcha/puzzle';\nimport type { CaptchaInstance } from '@funnycaptcha/core';\n\nconst instances = new Map<HTMLElement, CaptchaInstance>();\n\nexport function render(root: ParentNode = document) {\n for (const t of scan(root)) {\n if (instances.has(t.el)) continue;\n const inst = mountInto(t.el, t.type, {\n locale: t.locale,\n theme: t.theme,\n });\n if (inst) instances.set(t.el, inst);\n }\n}\n\n// 自动扫描 + MutationObserver\nexport function autoStart() {\n render();\n const obs = new MutationObserver(muts => {\n for (const m of muts) {\n m.addedNodes.forEach(n => {\n if (n instanceof HTMLElement) render(n);\n });\n }\n });\n obs.observe(document.body, { childList: true, subtree: true });\n}\n\nexport { scan, mountInto };\n\nif (typeof window !== 'undefined') {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', autoStart);\n } else {\n autoStart();\n }\n}\n"],"mappings":";AASO,SAAS,KAAK,OAAmB,UAAyB;AAC/D,QAAM,MAAM,MAAM,KAAK,KAAK,iBAA8B,sBAAsB,CAAC;AACjF,SAAO,IAAI,IAAI,SAAO;AAAA,IACpB;AAAA,IACA,MAAM,GAAG,QAAQ,QAAQ;AAAA,IACzB,QAAS,GAAG,QAAQ,UAAqB;AAAA,IACzC,OAAQ,GAAG,QAAQ,SAA8B;AAAA,EACnD,EAAE;AACJ;;;AChBA,SAAS,kBAAkB;AAEpB,SAAS,UACd,WACA,MACA,QACwB;AACxB,QAAM,SAAS,WAAW,IAAI;AAC9B,MAAI,CAAC,QAAQ;AACX,cAAU,YAAY,2CAA2C,IAAI;AACrE,WAAO;AAAA,EACT;AACA,QAAM,OAAO,OAAO,OAAO,WAAW,MAAM;AAC5C,OAAK,MAAM;AACX,SAAO;AACT;;;ACdA,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AACP,OAAO;AAGP,IAAM,YAAY,oBAAI,IAAkC;AAEjD,SAAS,OAAO,OAAmB,UAAU;AAClD,aAAW,KAAK,KAAK,IAAI,GAAG;AAC1B,QAAI,UAAU,IAAI,EAAE,EAAE,EAAG;AACzB,UAAM,OAAO,UAAU,EAAE,IAAI,EAAE,MAAM;AAAA,MACnC,QAAQ,EAAE;AAAA,MACV,OAAO,EAAE;AAAA,IACX,CAAC;AACD,QAAI,KAAM,WAAU,IAAI,EAAE,IAAI,IAAI;AAAA,EACpC;AACF;AAGO,SAAS,YAAY;AAC1B,SAAO;AACP,QAAM,MAAM,IAAI,iBAAiB,UAAQ;AACvC,eAAW,KAAK,MAAM;AACpB,QAAE,WAAW,QAAQ,OAAK;AACxB,YAAI,aAAa,YAAa,QAAO,CAAC;AAAA,MACxC,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACD,MAAI,QAAQ,SAAS,MAAM,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAC/D;AAIA,IAAI,OAAO,WAAW,aAAa;AACjC,MAAI,SAAS,eAAe,WAAW;AACrC,aAAS,iBAAiB,oBAAoB,SAAS;AAAA,EACzD,OAAO;AACL,cAAU;AAAA,EACZ;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/scanner.ts","../src/iframe-host.ts","../src/index.ts"],"sourcesContent":["import type { Locale } from '@funnycaptcha/core';\n\nexport interface EmbedTarget {\n el: HTMLElement;\n type: string;\n locale: Locale;\n theme: 'light' | 'dark';\n}\n\nexport function scan(root: ParentNode = document): EmbedTarget[] {\n const els = Array.from(root.querySelectorAll<HTMLElement>('[data-funny-captcha]'));\n return els.map(el => ({\n el,\n type: el.dataset.type ?? 'math',\n locale: (el.dataset.locale as Locale) ?? 'zh',\n theme: (el.dataset.theme as 'light' | 'dark') ?? 'light',\n }));\n}\n","import type { CaptchaConfig, CaptchaInstance } from '@funnycaptcha/core';\nimport { getCaptcha } from '@funnycaptcha/core';\n\nexport function mountInto(\n container: HTMLElement,\n type: string,\n config: CaptchaConfig,\n): CaptchaInstance | null {\n const plugin = getCaptcha(type);\n if (!plugin) {\n container.innerHTML = `<div style=\"color:red\">Unknown captcha: ${type}</div>`;\n return null;\n }\n const inst = plugin.create(container, config);\n inst.mount();\n return inst;\n}\n","import { scan } from './scanner.js';\nimport { mountInto } from './iframe-host.js';\nimport '@funnycaptcha/math';\nimport '@funnycaptcha/text-distort';\nimport '@funnycaptcha/slider';\nimport '@funnycaptcha/click-order';\nimport '@funnycaptcha/rotate';\nimport '@funnycaptcha/spot-diff';\nimport '@funnycaptcha/emoji-match';\nimport '@funnycaptcha/meme-quiz';\nimport '@funnycaptcha/mini-game';\nimport '@funnycaptcha/anti-bot';\nimport '@funnycaptcha/click-text';\nimport '@funnycaptcha/color-pick';\nimport '@funnycaptcha/puzzle';\nimport '@funnycaptcha/advanced-math';\nimport '@funnycaptcha/olympiad';\nimport '@funnycaptcha/equation-balance';\nimport '@funnycaptcha/random-hunt';\nimport type { CaptchaInstance } from '@funnycaptcha/core';\n\nconst instances = new Map<HTMLElement, CaptchaInstance>();\n\nexport function render(root: ParentNode = document) {\n for (const t of scan(root)) {\n if (instances.has(t.el)) continue;\n const inst = mountInto(t.el, t.type, {\n locale: t.locale,\n theme: t.theme,\n });\n if (inst) instances.set(t.el, inst);\n }\n}\n\n// 自动扫描 + MutationObserver\nexport function autoStart() {\n render();\n const obs = new MutationObserver(muts => {\n for (const m of muts) {\n m.addedNodes.forEach(n => {\n if (n instanceof HTMLElement) render(n);\n });\n }\n });\n obs.observe(document.body, { childList: true, subtree: true });\n}\n\nexport { scan, mountInto };\n\nif (typeof window !== 'undefined') {\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', autoStart);\n } else {\n autoStart();\n }\n}\n"],"mappings":";AASO,SAAS,KAAK,O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SAAS,MAAM,EAAE,WAAW,MAAM,SAAS,KAAK,CAAC;AAC/D;AAIA,IAAI,OAAO,WAAW,aAAa;AACjC,MAAI,SAAS,eAAe,WAAW;AACrC,aAAS,iBAAiB,oBAAoB,SAAS;AAAA,EACzD,OAAO;AACL,cAAU;AAAA,EACZ;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnycaptcha/embed",
3
- "version": "0.3.0",
3
+ "version": "0.6.0",
4
4
  "description": "Script-tag embeddable FunnyChapter bundle",
5
5
  "type": "module",
6
6
  "main": "./dist/embed.js",
@@ -18,20 +18,24 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@funnycaptcha/core": "0.3.0",
22
- "@funnycaptcha/math": "0.3.0",
23
- "@funnycaptcha/text-distort": "0.3.0",
24
- "@funnycaptcha/click-order": "0.3.0",
25
- "@funnycaptcha/rotate": "0.3.0",
26
- "@funnycaptcha/meme-quiz": "0.3.0",
27
- "@funnycaptcha/spot-diff": "0.3.0",
28
- "@funnycaptcha/emoji-match": "0.3.0",
29
- "@funnycaptcha/slider": "0.3.0",
30
- "@funnycaptcha/mini-game": "0.3.0",
31
- "@funnycaptcha/anti-bot": "0.3.0",
32
- "@funnycaptcha/color-pick": "0.3.0",
33
- "@funnycaptcha/click-text": "0.3.0",
34
- "@funnycaptcha/puzzle": "0.3.0"
21
+ "@funnycaptcha/core": "0.6.0",
22
+ "@funnycaptcha/math": "0.6.0",
23
+ "@funnycaptcha/slider": "0.6.0",
24
+ "@funnycaptcha/text-distort": "0.6.0",
25
+ "@funnycaptcha/click-order": "0.6.0",
26
+ "@funnycaptcha/rotate": "0.6.0",
27
+ "@funnycaptcha/spot-diff": "0.6.0",
28
+ "@funnycaptcha/meme-quiz": "0.6.0",
29
+ "@funnycaptcha/emoji-match": "0.6.0",
30
+ "@funnycaptcha/mini-game": "0.6.0",
31
+ "@funnycaptcha/anti-bot": "0.6.0",
32
+ "@funnycaptcha/click-text": "0.6.0",
33
+ "@funnycaptcha/color-pick": "0.6.0",
34
+ "@funnycaptcha/puzzle": "0.6.0",
35
+ "@funnycaptcha/advanced-math": "0.6.0",
36
+ "@funnycaptcha/olympiad": "0.6.0",
37
+ "@funnycaptcha/random-hunt": "0.6.0",
38
+ "@funnycaptcha/equation-balance": "0.6.0"
35
39
  },
36
40
  "publishConfig": {
37
41
  "access": "public",