@inpageedit/core 0.8.1 → 0.9.2
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/LICENSE +20 -20
- package/README.md +55 -55
- package/dist/ActionButton-BgbTKTg7.js.map +1 -1
- package/dist/CheckBox-D3rHnX7I.js.map +1 -1
- package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -1
- package/dist/InPageEdit.d.ts +1 -1
- package/dist/InputBox-BV4m05Xs.js.map +1 -1
- package/dist/Preferences-DS4-CFWe.js +9 -0
- package/dist/Preferences-DS4-CFWe.js.map +1 -0
- package/dist/RadioBox-nJqWsxW2.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/decorators/Preferences.d.ts +2 -3
- package/dist/index-Bh70Udzi.js.map +1 -1
- package/dist/{index-Tn22YSmW.js → index-C-A3jSMx.js} +2 -2
- package/dist/index-C-A3jSMx.js.map +1 -0
- package/dist/index-CInRo1qR.js +357 -0
- package/dist/index-CInRo1qR.js.map +1 -0
- package/dist/{index-OBerV4GU.js → index-CWbHdYKu.js} +3 -3
- package/dist/index-CWbHdYKu.js.map +1 -0
- package/dist/{index-CeXR4lOu.js → index-CaI9BFuB.js} +32 -34
- package/dist/{index-CeXR4lOu.js.map → index-CaI9BFuB.js.map} +1 -1
- package/dist/index-CvhkVj_L.js.map +1 -1
- package/dist/{index-mntCdHRr.js → index-D6055L55.js} +1568 -1505
- package/dist/{index-mntCdHRr.js.map → index-D6055L55.js.map} +1 -1
- package/dist/{index-kRdAN8h3.js → index-DxGjTpIn.js} +3 -3
- package/dist/index-DxGjTpIn.js.map +1 -0
- package/dist/index-Ek5d60jn.js +5583 -0
- package/dist/index-Ek5d60jn.js.map +1 -0
- package/dist/{index-Ba7Wkale.js → index-RFAZzS9C.js} +3 -3
- package/dist/{index-Ba7Wkale.js.map → index-RFAZzS9C.js.map} +1 -1
- package/dist/{index-9M1QcjCN.js → index-UjgKGkN2.js} +124 -123
- package/dist/index-UjgKGkN2.js.map +1 -0
- package/dist/{index-DBV8FBjA.js → index-btJ_NMuF.js} +3 -3
- package/dist/index-btJ_NMuF.js.map +1 -0
- package/dist/index-lZkYoUca.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/models/WikiPage/index.d.ts +1 -2
- package/dist/noop-ClDc6zv4.js.map +1 -1
- package/dist/plugins/BasePlugin.d.ts +0 -2
- package/dist/plugins/{preferences/ui → preferences-ui}/index.d.ts +4 -3
- package/dist/plugins/quick-delete/index.d.ts +2 -2
- package/dist/plugins/quick-diff/components/DiffTable.d.ts +2 -2
- package/dist/plugins/quick-diff/index.d.ts +60 -1
- package/dist/plugins/quick-edit/index.d.ts +2 -2
- package/dist/plugins/quick-move/index.d.ts +2 -2
- package/dist/plugins/quick-redirect/index.d.ts +2 -2
- package/dist/services/ApiService.d.ts +1 -1
- package/dist/services/CurrentPageService.d.ts +3 -2
- package/dist/{plugins/preferences/index.d.ts → services/PreferencesService.d.ts} +9 -9
- package/dist/services/WikiMetadataService.d.ts +2 -2
- package/dist/services/WikiPageService.d.ts +2 -2
- package/dist/services/WikiTitleService.d.ts +7 -3
- package/dist/services/storage/IDBStorage.d.ts +52 -0
- package/dist/services/storage/index.d.ts +53 -0
- package/dist/style.css +1 -1
- package/dist/utils/vueHooks.d.ts +2 -1
- package/lib/index.umd.js +36 -45
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +8 -14
- package/dist/Preferences-Bg3J5Ur9.js +0 -9
- package/dist/Preferences-Bg3J5Ur9.js.map +0 -1
- package/dist/index-9M1QcjCN.js.map +0 -1
- package/dist/index-C8dOYIIz.js +0 -1249
- package/dist/index-C8dOYIIz.js.map +0 -1
- package/dist/index-COlXHFRg.js +0 -6326
- package/dist/index-COlXHFRg.js.map +0 -1
- package/dist/index-DBV8FBjA.js.map +0 -1
- package/dist/index-DwyuBkCK.js +0 -171
- package/dist/index-DwyuBkCK.js.map +0 -1
- package/dist/index-OBerV4GU.js.map +0 -1
- package/dist/index-Tn22YSmW.js.map +0 -1
- package/dist/index-kRdAN8h3.js.map +0 -1
- package/dist/plugins/quick-diff/JsDiffService.d.ts +0 -23
- package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +0 -72
- package/dist/services/StorageService.d.ts +0 -56
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 dragon-fish
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 dragon-fish
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
[<img src="/docs/.vitepress/public/images/logo/ipe-next-uwu.png" width="280" alt="InPageEdit Logo">](https://www.ipe.wiki)
|
|
4
|
-
|
|
5
|
-
# InPageEdit NEXT
|
|
6
|
-
|
|
7
|
-
🚀 MediaWiki 的模块化、可扩展超级增强插件
|
|
8
|
-
|
|
9
|
-
**InPageEdit NEXT**是由机智的小鱼君开发的一款 MediaWiki 多功能插件。主要功能旨在使许多 MediaWiki 的功能在不打开新标签页的情况下完成(包括但不限于编辑),极大加快维护 wiki 的速度。模块化设计、类型定义清晰完整,插件可自由热插拔。
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## 快速上手 / Quick Start
|
|
14
|
-
|
|
15
|
-
[](https://www.jsdelivr.com/package/npm/@inpageedit/core)
|
|
16
|
-
|
|
17
|
-
在*个人 JS 页*添加以下代码:
|
|
18
|
-
|
|
19
|
-
<!-- prettier-ignore -->
|
|
20
|
-
```javascript
|
|
21
|
-
// InPageEdit NEXT
|
|
22
|
-
$('<script src="https://unpkg.com/@inpageedit/core" type="module"></script>').appendTo('body')
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 特色功能 / Features
|
|
26
|
-
|
|
27
|
-
**编辑者视角 / For wiki editors**
|
|
28
|
-
|
|
29
|
-
- 快速编辑 / Quick Edit
|
|
30
|
-
- 快速移动 / Quick Move
|
|
31
|
-
- 快速重定向 / Quick Redirect
|
|
32
|
-
- 快速差异 / Quick Diff
|
|
33
|
-
- 快速预览 / Quick Preview
|
|
34
|
-
|
|
35
|
-
**开发者视角 / For developers**
|
|
36
|
-
|
|
37
|
-
- 可热插拔的模块化设计
|
|
38
|
-
- 完全使用 TypeScript 编写
|
|
39
|
-
- 超简单的扩展能力,示例插件:[hello-world](./docs/.templates/examples/plugins/hello-world.js)
|
|
40
|
-
|
|
41
|
-
## Supported languages
|
|
42
|
-
|
|
43
|
-
> [!NOTE]
|
|
44
|
-
>
|
|
45
|
-
> Currently only English is supported. We're working on i18n support.
|
|
46
|
-
|
|
47
|
-
---
|
|
48
|
-
|
|
49
|
-
🚀 Modular, Extensible Supercharged Plugin for MediaWiki.
|
|
50
|
-
|
|
51
|
-
> [MIT License](https://opensource.org/licenses/MIT)
|
|
52
|
-
>
|
|
53
|
-
> InPageEdit-NEXT Copyright © 2025-present dragon-fish
|
|
54
|
-
|
|
55
|
-
See more: [GitHub](https://github.com/inpageedit/inpageedit-next) | [Change Logs](https://www.ipe.wiki/changelogs/) | [File Issues](https://github.com/inpageedit/inpageedit-next/issues)
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[<img src="/docs/.vitepress/public/images/logo/ipe-next-uwu.png" width="280" alt="InPageEdit Logo">](https://www.ipe.wiki)
|
|
4
|
+
|
|
5
|
+
# InPageEdit NEXT
|
|
6
|
+
|
|
7
|
+
🚀 MediaWiki 的模块化、可扩展超级增强插件
|
|
8
|
+
|
|
9
|
+
**InPageEdit NEXT**是由机智的小鱼君开发的一款 MediaWiki 多功能插件。主要功能旨在使许多 MediaWiki 的功能在不打开新标签页的情况下完成(包括但不限于编辑),极大加快维护 wiki 的速度。模块化设计、类型定义清晰完整,插件可自由热插拔。
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## 快速上手 / Quick Start
|
|
14
|
+
|
|
15
|
+
[](https://www.jsdelivr.com/package/npm/@inpageedit/core)
|
|
16
|
+
|
|
17
|
+
在*个人 JS 页*添加以下代码:
|
|
18
|
+
|
|
19
|
+
<!-- prettier-ignore -->
|
|
20
|
+
```javascript
|
|
21
|
+
// InPageEdit NEXT
|
|
22
|
+
$('<script src="https://unpkg.com/@inpageedit/core" type="module"></script>').appendTo('body')
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 特色功能 / Features
|
|
26
|
+
|
|
27
|
+
**编辑者视角 / For wiki editors**
|
|
28
|
+
|
|
29
|
+
- 快速编辑 / Quick Edit
|
|
30
|
+
- 快速移动 / Quick Move
|
|
31
|
+
- 快速重定向 / Quick Redirect
|
|
32
|
+
- 快速差异 / Quick Diff
|
|
33
|
+
- 快速预览 / Quick Preview
|
|
34
|
+
|
|
35
|
+
**开发者视角 / For developers**
|
|
36
|
+
|
|
37
|
+
- 可热插拔的模块化设计
|
|
38
|
+
- 完全使用 TypeScript 编写
|
|
39
|
+
- 超简单的扩展能力,示例插件:[hello-world](./docs/.templates/examples/plugins/hello-world.js)
|
|
40
|
+
|
|
41
|
+
## Supported languages
|
|
42
|
+
|
|
43
|
+
> [!NOTE]
|
|
44
|
+
>
|
|
45
|
+
> Currently only English is supported. We're working on i18n support.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
🚀 Modular, Extensible Supercharged Plugin for MediaWiki.
|
|
50
|
+
|
|
51
|
+
> [MIT License](https://opensource.org/licenses/MIT)
|
|
52
|
+
>
|
|
53
|
+
> InPageEdit-NEXT Copyright © 2025-present dragon-fish
|
|
54
|
+
|
|
55
|
+
See more: [GitHub](https://github.com/inpageedit/inpageedit-next) | [Change Logs](https://www.ipe.wiki/changelogs/) | [File Issues](https://github.com/inpageedit/inpageedit-next/issues)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton-BgbTKTg7.js","sources":["../src/components/ActionButton.tsx"],"sourcesContent":["import { h, JSX, ReactNode } from 'jsx-dom'\n\nexport interface ActionButtonProps {\n type?: 'primary' | 'secondary' | 'danger' | 'default'\n tag?: 'a' | 'button' | 'div'\n}\n\nconst origin = window?.location?.origin\n\nexport const ActionButton = ({\n type,\n tag,\n href,\n target,\n children,\n ...rest\n}: ActionButtonProps &\n Omit<JSX.IntrinsicElements['button'], 'type'> &\n JSX.IntrinsicElements['a']) => {\n tag = tag || (href ? 'a' : 'button')\n if (\n typeof target === 'undefined' &&\n href &&\n href.startsWith('http') &&\n !href.startsWith(origin)\n ) {\n target = '_blank'\n }\n return h(\n tag,\n {\n className: `theme-ipe ipe-action-button ipe-modal-btn is-${type || 'default'}`,\n // @ts-ignore\n href: tag === 'a' ? href : undefined,\n target: tag === 'a' ? target : undefined,\n 'data-href': tag !== 'a' ? href : undefined,\n ...rest,\n },\n children\n )\n}\n"],"names":["origin","ActionButton","type","tag","href","target","children","rest","h"],"mappings":";AAOA,MAAMA,IAAS,QAAQ,UAAU,QAEpBC,IAAe,CAAC;AAAA,EAC3B,MAAAC;AAAA,EACA,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,OAGEJ,IAAMA,MAAQC,IAAO,MAAM,WAEzB,OAAOC,IAAW,OAClBD,KACAA,EAAK,WAAW,MAAM,KACtB,CAACA,EAAK,WAAWJ,CAAM,MAEvBK,IAAS,WAEJG;AAAAA,EACLL;AAAA,EACA;AAAA,IACE,WAAW,gDAAgDD,KAAQ,SAAS;AAAA;AAAA,IAE5E,MAAMC,MAAQ,MAAMC,IAAO;AAAA,IAC3B,QAAQD,MAAQ,MAAME,IAAS;AAAA,IAC/B,aAAaF,MAAQ,MAAMC,IAAO;AAAA,IAClC,GAAGG;AAAA,EAAA;AAAA,EAELD;AAAA;"}
|
|
1
|
+
{"version":3,"file":"ActionButton-BgbTKTg7.js","sources":["../src/components/ActionButton.tsx"],"sourcesContent":["import { h, JSX, ReactNode } from 'jsx-dom'\r\n\r\nexport interface ActionButtonProps {\r\n type?: 'primary' | 'secondary' | 'danger' | 'default'\r\n tag?: 'a' | 'button' | 'div'\r\n}\r\n\r\nconst origin = window?.location?.origin\r\n\r\nexport const ActionButton = ({\r\n type,\r\n tag,\r\n href,\r\n target,\r\n children,\r\n ...rest\r\n}: ActionButtonProps &\r\n Omit<JSX.IntrinsicElements['button'], 'type'> &\r\n JSX.IntrinsicElements['a']) => {\r\n tag = tag || (href ? 'a' : 'button')\r\n if (\r\n typeof target === 'undefined' &&\r\n href &&\r\n href.startsWith('http') &&\r\n !href.startsWith(origin)\r\n ) {\r\n target = '_blank'\r\n }\r\n return h(\r\n tag,\r\n {\r\n className: `theme-ipe ipe-action-button ipe-modal-btn is-${type || 'default'}`,\r\n // @ts-ignore\r\n href: tag === 'a' ? href : undefined,\r\n target: tag === 'a' ? target : undefined,\r\n 'data-href': tag !== 'a' ? href : undefined,\r\n ...rest,\r\n },\r\n children\r\n )\r\n}\r\n"],"names":["origin","ActionButton","type","tag","href","target","children","rest","h"],"mappings":";AAOA,MAAMA,IAAS,QAAQ,UAAU,QAEpBC,IAAe,CAAC;AAAA,EAC3B,MAAAC;AAAA,EACA,KAAAC;AAAA,EACA,MAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,OAGEJ,IAAMA,MAAQC,IAAO,MAAM,WAEzB,OAAOC,IAAW,OAClBD,KACAA,EAAK,WAAW,MAAM,KACtB,CAACA,EAAK,WAAWJ,CAAM,MAEvBK,IAAS,WAEJG;AAAAA,EACLL;AAAA,EACA;AAAA,IACE,WAAW,gDAAgDD,KAAQ,SAAS;AAAA;AAAA,IAE5E,MAAMC,MAAQ,MAAMC,IAAO;AAAA,IAC3B,QAAQD,MAAQ,MAAME,IAAS;AAAA,IAC/B,aAAaF,MAAQ,MAAMC,IAAO;AAAA,IAClC,GAAGG;AAAA,EAAA;AAAA,EAELD;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBox-D3rHnX7I.js","sources":["../src/components/CheckBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\n\nexport type CheckBoxProps = {\n id?: string\n name: string\n label?: string | HTMLElement\n checked?: boolean\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const CheckBox = (props: CheckBoxProps) => {\n const { id, name, label, checked, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-checkbox\" {...rest}>\n <input type=\"checkbox\" id={id} name={name} checked={checked} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n"],"names":["CheckBox","props","id","name","label","checked","inputProps","labelProps","children","rest","jsxs","jsx"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAChF,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,0BAA0B,GAAGD,GAC5C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,YAAW,IAAAT,GAAQ,MAAAC,GAAY,SAAAE,GAAmB,GAAGC,GAAY;AAAA,IAC7E,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"CheckBox-D3rHnX7I.js","sources":["../src/components/CheckBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\r\n\r\nexport type CheckBoxProps = {\r\n id?: string\r\n name: string\r\n label?: string | HTMLElement\r\n checked?: boolean\r\n inputProps?: JSX.IntrinsicElements['input']\r\n labelProps?: JSX.IntrinsicElements['span']\r\n} & JSX.IntrinsicElements['label']\r\n\r\nexport const CheckBox = (props: CheckBoxProps) => {\r\n const { id, name, label, checked, inputProps, labelProps, children, ...rest } = props\r\n return (\r\n <label className=\"theme-ipe ipe-checkbox\" {...rest}>\r\n <input type=\"checkbox\" id={id} name={name} checked={checked} {...inputProps} />\r\n <span className=\"ipe-checkbox-box\"></span>\r\n <span {...labelProps}>{label || children}</span>\r\n </label>\r\n )\r\n}\r\n"],"names":["CheckBox","props","id","name","label","checked","inputProps","labelProps","children","rest","jsxs","jsx"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAChF,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,0BAA0B,GAAGD,GAC5C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,YAAW,IAAAT,GAAQ,MAAAC,GAAY,SAAAE,GAAmB,GAAGC,GAAY;AAAA,IAC7E,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconQuickEdit-CAL1HXIb.js","sources":["../src/components/Icon/IconQuickEdit.tsx"],"sourcesContent":["import { SVGProps } from 'jsx-dom'\n\nexport const IconQuickEdit = (props: SVGProps<SVGSVGElement>) => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n {...props}\n class={`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${props.className || ''}`}\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4\" />\n <path d=\"M13.5 6.5l4 4\" />\n <path d=\"M19 16l-2 3h4l-2 3\" />\n </svg>\n)\n"],"names":["IconQuickEdit","props","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAgB,CAACC,MAC5BC,gBAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,gBAAa;AAAA,IACb,kBAAe;AAAA,IACf,mBAAgB;AAAA,IACf,GAAGD;AAAA,IACJ,OAAO,iEAAiEA,EAAM,aAAa,EAAE;AAAA,IAE7F,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,gBAAAA,EAAC,QAAA,EAAK,GAAE,0DAAA,CAA0D;AAAA,MAClE,gBAAAA,EAAC,QAAA,EAAK,GAAE,gBAAA,CAAgB;AAAA,MACxB,gBAAAA,EAAC,QAAA,EAAK,GAAE,qBAAA,CAAqB;AAAA,IAAA;AAAA,EAAA;AAC/B;"}
|
|
1
|
+
{"version":3,"file":"IconQuickEdit-CAL1HXIb.js","sources":["../src/components/Icon/IconQuickEdit.tsx"],"sourcesContent":["import { SVGProps } from 'jsx-dom'\r\n\r\nexport const IconQuickEdit = (props: SVGProps<SVGSVGElement>) => (\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n {...props}\r\n class={`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${props.className || ''}`}\r\n >\r\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path d=\"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4\" />\r\n <path d=\"M13.5 6.5l4 4\" />\r\n <path d=\"M19 16l-2 3h4l-2 3\" />\r\n </svg>\r\n)\r\n"],"names":["IconQuickEdit","props","jsxs","jsx"],"mappings":";AAEO,MAAMA,IAAgB,CAACC,MAC5BC,gBAAAA;AAAAA,EAAC;AAAA,EAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,gBAAa;AAAA,IACb,kBAAe;AAAA,IACf,mBAAgB;AAAA,IACf,GAAGD;AAAA,IACJ,OAAO,iEAAiEA,EAAM,aAAa,EAAE;AAAA,IAE7F,UAAA;AAAA,MAAA,gBAAAE,EAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,gBAAAA,EAAC,QAAA,EAAK,GAAE,0DAAA,CAA0D;AAAA,MAClE,gBAAAA,EAAC,QAAA,EAAK,GAAE,gBAAA,CAAgB;AAAA,MACxB,gBAAAA,EAAC,QAAA,EAAK,GAAE,qBAAA,CAAqB;AAAA,IAAA;AAAA,EAAA;AAC/B;"}
|
package/dist/InPageEdit.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context, Inject, Events as CordisEvents } from '@cordisjs/core';
|
|
2
2
|
import { Logger } from '@inpageedit/logger';
|
|
3
|
-
import { FexiosConfigs } from '
|
|
3
|
+
import { FexiosConfigs } from 'wiki-saikou';
|
|
4
4
|
export interface InPageEditCoreConfig {
|
|
5
5
|
apiConfigs: Partial<FexiosConfigs>;
|
|
6
6
|
legacyPreferences: Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputBox-BV4m05Xs.js","sources":["../src/components/InputBox.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom'\n\nexport type InputBoxProps = {\n label: string\n id?: string\n name: string\n value?: string\n disabled?: boolean\n labelProps?: JSX.IntrinsicElements['label']\n inputProps?: JSX.IntrinsicElements['input']\n} & JSX.IntrinsicElements['div']\n\nexport const InputBox = (props: InputBoxProps) => {\n const { label, id, name, value, disabled, labelProps, inputProps, ...rest } = props\n return (\n <div className=\"theme-ipe ipe-input-box\" {...rest}>\n <label htmlFor={id} style={{ display: 'block' }} {...labelProps}>\n {label}\n </label>\n <input\n id={id}\n name={name}\n value={value}\n disabled={disabled}\n style={{ width: '100%' }}\n {...inputProps}\n />\n </div>\n )\n}\n"],"names":["InputBox","props","label","id","name","value","disabled","labelProps","inputProps","rest","jsxs","jsx"],"mappings":";AAYO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,UAAAC,GAAU,YAAAC,GAAY,YAAAC,GAAY,GAAGC,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,OAAA,EAAI,WAAU,2BAA2B,GAAGD,GAC3C,UAAA;AAAA,IAAA,gBAAAE,EAAC,SAAA,EAAM,SAASR,GAAI,OAAO,EAAE,SAAS,QAAA,GAAY,GAAGI,GAClD,UAAAL,EAAA,CACH;AAAA,IACA,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAAR;AAAA,QACA,MAAAC;AAAA,QACA,OAAAC;AAAA,QACA,UAAAC;AAAA,QACA,OAAO,EAAE,OAAO,OAAA;AAAA,QACf,GAAGE;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"InputBox-BV4m05Xs.js","sources":["../src/components/InputBox.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom'\r\n\r\nexport type InputBoxProps = {\r\n label: string\r\n id?: string\r\n name: string\r\n value?: string\r\n disabled?: boolean\r\n labelProps?: JSX.IntrinsicElements['label']\r\n inputProps?: JSX.IntrinsicElements['input']\r\n} & JSX.IntrinsicElements['div']\r\n\r\nexport const InputBox = (props: InputBoxProps) => {\r\n const { label, id, name, value, disabled, labelProps, inputProps, ...rest } = props\r\n return (\r\n <div className=\"theme-ipe ipe-input-box\" {...rest}>\r\n <label htmlFor={id} style={{ display: 'block' }} {...labelProps}>\r\n {label}\r\n </label>\r\n <input\r\n id={id}\r\n name={name}\r\n value={value}\r\n disabled={disabled}\r\n style={{ width: '100%' }}\r\n {...inputProps}\r\n />\r\n </div>\r\n )\r\n}\r\n"],"names":["InputBox","props","label","id","name","value","disabled","labelProps","inputProps","rest","jsxs","jsx"],"mappings":";AAYO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,UAAAC,GAAU,YAAAC,GAAY,YAAAC,GAAY,GAAGC,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,OAAA,EAAI,WAAU,2BAA2B,GAAGD,GAC3C,UAAA;AAAA,IAAA,gBAAAE,EAAC,SAAA,EAAM,SAASR,GAAI,OAAO,EAAE,SAAS,QAAA,GAAY,GAAGI,GAClD,UAAAL,EAAA,CACH;AAAA,IACA,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAAR;AAAA,QACA,MAAAC;AAAA,QACA,OAAAC;AAAA,QACA,UAAAC;AAAA,QACA,OAAO,EAAE,OAAO,OAAA;AAAA,QACf,GAAGE;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Preferences-DS4-CFWe.js","sources":["../src/decorators/Preferences.ts"],"sourcesContent":["import type Schema from 'schemastery'\r\n\r\ntype AnyConstructor<T = any> = new (...args: any[]) => T\r\n\r\nexport type PreferenceAugmented<D, C extends AnyConstructor> = C & {\r\n PreferencesSchema: Schema<D>\r\n}\r\n\r\n/**\r\n * Decorator for registering preferences\r\n *\r\n * ```ts\r\n * @RegisterPreferences(\r\n * Schema.object({\r\n * foo: Schema.string().description('Foo description'),\r\n * }),\r\n * {\r\n * foo: 'default foo value',\r\n * }\r\n * )\r\n * class Foo {}\r\n * ```\r\n *\r\n * same as:\r\n *\r\n * ```ts\r\n * class Foo {\r\n * static ConfigSchema = Schema.object({\r\n * foo: Schema.string().description('Foo description')\r\n * })\r\n * static ConfigDefaults = {\r\n * foo: 'default foo value'\r\n * }\r\n * }\r\n * ```\r\n */\r\nexport function RegisterPreferences<D extends Record<string, any>>(schema: Schema<D>) {\r\n return function <T extends AnyConstructor>(target: T): PreferenceAugmented<D, T> {\r\n ;(target as any).PreferencesSchema = schema\r\n return target as PreferenceAugmented<D, T>\r\n }\r\n}\r\n"],"names":["RegisterPreferences","schema","target"],"mappings":"AAoCO,SAASA,EAAmDC,GAAmB;AACpF,SAAO,SAAoCC,GAAsC;AAC7E,WAAAA,EAAe,oBAAoBD,GAC9BC;AAAA,EACT;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioBox-nJqWsxW2.js","sources":["../src/components/RadioBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\n\nexport type RadioBoxProps = {\n id?: string\n name: string\n value: string\n label?: string | HTMLElement\n inputProps?: JSX.IntrinsicElements['input']\n labelProps?: JSX.IntrinsicElements['span']\n} & JSX.IntrinsicElements['label']\n\nexport const RadioBox = (props: RadioBoxProps) => {\n const { id, name, value, label, inputProps, labelProps, children, ...rest } = props\n return (\n <label className=\"theme-ipe ipe-radio-box\" {...rest}>\n <input type=\"radio\" id={id} name={name} value={value} {...inputProps} />\n <span className=\"ipe-checkbox-box\"></span>\n <span {...labelProps}>{label || children}</span>\n </label>\n )\n}\n"],"names":["RadioBox","props","id","name","value","label","inputProps","labelProps","children","rest","jsxs","jsx"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,2BAA2B,GAAGD,GAC7C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,SAAQ,IAAAT,GAAQ,MAAAC,GAAY,OAAAC,GAAe,GAAGE,GAAY;AAAA,IACtE,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"RadioBox-nJqWsxW2.js","sources":["../src/components/RadioBox.tsx"],"sourcesContent":["import { JSX, ReactNode } from 'jsx-dom'\r\n\r\nexport type RadioBoxProps = {\r\n id?: string\r\n name: string\r\n value: string\r\n label?: string | HTMLElement\r\n inputProps?: JSX.IntrinsicElements['input']\r\n labelProps?: JSX.IntrinsicElements['span']\r\n} & JSX.IntrinsicElements['label']\r\n\r\nexport const RadioBox = (props: RadioBoxProps) => {\r\n const { id, name, value, label, inputProps, labelProps, children, ...rest } = props\r\n return (\r\n <label className=\"theme-ipe ipe-radio-box\" {...rest}>\r\n <input type=\"radio\" id={id} name={name} value={value} {...inputProps} />\r\n <span className=\"ipe-checkbox-box\"></span>\r\n <span {...labelProps}>{label || children}</span>\r\n </label>\r\n )\r\n}\r\n"],"names":["RadioBox","props","id","name","value","label","inputProps","labelProps","children","rest","jsxs","jsx"],"mappings":";AAWO,MAAMA,IAAW,CAACC,MAAyB;AAChD,QAAM,EAAE,IAAAC,GAAI,MAAAC,GAAM,OAAAC,GAAO,OAAAC,GAAO,YAAAC,GAAY,YAAAC,GAAY,UAAAC,GAAU,GAAGC,EAAA,IAASR;AAC9E,SACES,gBAAAA,EAAC,SAAA,EAAM,WAAU,2BAA2B,GAAGD,GAC7C,UAAA;AAAA,IAAA,gBAAAE,EAAC,WAAM,MAAK,SAAQ,IAAAT,GAAQ,MAAAC,GAAY,OAAAC,GAAe,GAAGE,GAAY;AAAA,IACtE,gBAAAK,EAAC,QAAA,EAAK,WAAU,mBAAA,CAAmB;AAAA,IACnC,gBAAAA,EAAC,QAAA,EAAM,GAAGJ,GAAa,eAASC,EAAA,CAAS;AAAA,EAAA,GAC3C;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/components/TabView/index.tsx"],"sourcesContent":["import { ReactNode } from 'jsx-dom'\nimport styles from './styles.module.sass'\n\nexport interface TabViewLabelOptions {\n name: string\n children: ReactNode\n}\n\nconsole.log(styles)\n\nexport function TabView({\n tabs = [],\n defaultActiveIndex = 0,\n}: {\n tabs: (TabViewLabelOptions & { content: ReactNode })[]\n defaultActiveIndex?: number\n}) {\n const el = (\n <div className={`ipe-tabView ${styles.tabview}`}>\n <ul className={`ipe-tabView__labels-container ${styles.labels_container}`}>\n {tabs.map((tab) => (\n <TabLabel key={tab.name} name={tab.name}>\n {tab.children}\n </TabLabel>\n ))}\n </ul>\n <div className={`ipe-tabView__contents ${styles.contents_container}`}>\n {tabs.map((tab) => (\n <TabContent key={tab.name} name={tab.name}>\n {tab.content}\n </TabContent>\n ))}\n </div>\n </div>\n )\n\n const defaultActiveLabel = el.querySelector<HTMLAnchorElement>(\n `.ipe-tabView__labels-container > .ipe-tabView__label:nth-child(${defaultActiveIndex + 1})`\n )\n if (defaultActiveLabel) {\n defaultActiveLabel.click()\n }\n\n return el\n}\n\nexport function TabLabel({ name, children }: { name: string; children: ReactNode }) {\n return (\n <li\n data-tab-name={name}\n className={`ipe-tabView__label ${styles.label}`}\n onClick={function (e) {\n e.preventDefault()\n const container = this.closest('.ipe-tabView')\n if (!container) return\n const labels = Array.from(container.children).find((el) =>\n el.classList.contains('ipe-tabView__labels')\n )?.children\n if (labels) {\n Array.from(labels).forEach((label) => {\n label.classList.remove(styles.active)\n })\n }\n this.classList.add(styles.active)\n const contents = Array.from(container.children).find((el) =>\n el.classList.contains('ipe-tabView__contents')\n )?.children\n if (contents) {\n Array.from(contents).forEach((content) => {\n if (content instanceof HTMLElement) {\n if (content.dataset.tabName === name) {\n content.style.display = ''\n content.classList.add(styles.active)\n } else {\n content.style.display = 'none'\n content.classList.remove(styles.active)\n }\n }\n })\n }\n }}\n >\n <a>{children || name}</a>\n </li>\n )\n}\n\nexport function TabContent({ name, children }: { name: string; children: ReactNode }) {\n return (\n <div\n data-tab-name={name}\n className=\"ipe-tabView__content-body\"\n style={{\n display: 'none',\n }}\n >\n {children}\n </div>\n )\n}\n"],"names":["TabView","tabs","defaultActiveIndex","el","jsxs","styles","jsx","tab","TabLabel","TabContent","defaultActiveLabel","name","children","e","container","labels","label","contents","content"],"mappings":";;;;;;;;;;;;;;;AAUO,SAASA,EAAQ;AAAA,EACtB,MAAAC,IAAO,CAAA;AAAA,EACP,oBAAAC,IAAqB;AACvB,GAGG;AACD,QAAMC,IACJC,gBAAAA,EAAC,OAAA,EAAI,WAAW,eAAeC,EAAO,OAAO,IAC3C,UAAA;AAAA,IAAA,gBAAAC,EAAC,MAAA,EAAG,WAAW,iCAAiCD,E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AQ,YAAYP,KAC9BO,EAAQ,MAAM,UAAU,IACxBA,EAAQ,UAAU,IAAIb,EAAO,MAAM,MAEnCa,EAAQ,MAAM,UAAU,QACxBA,EAAQ,UAAU,OAAOb,EAAO,MAAM;AAAA,QAG5C,CAAC;AAAA,MAEL;AAAA,MAEA,UAAA,gBAAAC,EAAC,KAAA,EAAG,UAAAM,KAAYD,EAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AAG3B;AAEO,SAASF,EAAW,EAAE,MAAAE,GAAM,UAAAC,KAAmD;AACpF,SACE,gBAAAN;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,iBAAeK;AAAA,MACf,WAAU;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,MAGV,UAAAC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/components/TabView/index.tsx"],"sourcesContent":["import { ReactNode } from 'jsx-dom'\r\nimport styles from './styles.module.sass'\r\n\r\nexport interface TabViewLabelOptions {\r\n name: string\r\n children: ReactNode\r\n}\r\n\r\nconsole.log(styles)\r\n\r\nexport function TabView({\r\n tabs = [],\r\n defaultActiveIndex = 0,\r\n}: {\r\n tabs: (TabViewLabelOptions & { content: ReactNode })[]\r\n defaultActiveIndex?: number\r\n}) {\r\n const el = (\r\n <div className={`ipe-tabView ${styles.tabview}`}>\r\n <ul className={`ipe-tabView__labels-container ${styles.labels_container}`}>\r\n {tabs.map((tab) => (\r\n <TabLabel key={tab.name} name={tab.name}>\r\n {tab.children}\r\n </TabLabel>\r\n ))}\r\n </ul>\r\n <div className={`ipe-tabView__contents ${styles.contents_container}`}>\r\n {tabs.map((tab) => (\r\n <TabContent key={tab.name} name={tab.name}>\r\n {tab.content}\r\n </TabContent>\r\n ))}\r\n </div>\r\n </div>\r\n )\r\n\r\n const defaultActiveLabel = el.querySelector<HTMLAnchorElement>(\r\n `.ipe-tabView__labels-container > .ipe-tabView__label:nth-child(${defaultActiveIndex + 1})`\r\n )\r\n if (defaultActiveLabel) {\r\n defaultActiveLabel.click()\r\n }\r\n\r\n return el\r\n}\r\n\r\nexport function TabLabel({ name, children }: { name: string; children: ReactNode }) {\r\n return (\r\n <li\r\n data-tab-name={name}\r\n className={`ipe-tabView__label ${styles.label}`}\r\n onClick={function (e) {\r\n e.preventDefault()\r\n const container = this.closest('.ipe-tabView')\r\n if (!container) return\r\n const labels = Array.from(container.children).find((el) =>\r\n el.classList.contains('ipe-tabView__labels')\r\n )?.children\r\n if (labels) {\r\n Array.from(labels).forEach((label) => {\r\n label.classList.remove(styles.active)\r\n })\r\n }\r\n this.classList.add(styles.active)\r\n const contents = Array.from(container.children).find((el) =>\r\n el.classList.contains('ipe-tabView__contents')\r\n )?.children\r\n if (contents) {\r\n Array.from(contents).forEach((content) => {\r\n if (content instanceof HTMLElement) {\r\n if (content.dataset.tabName === name) {\r\n content.style.display = ''\r\n content.classList.add(styles.active)\r\n } else {\r\n content.style.display = 'none'\r\n content.classList.remove(styles.active)\r\n }\r\n }\r\n })\r\n }\r\n }}\r\n >\r\n <a>{children || name}</a>\r\n </li>\r\n )\r\n}\r\n\r\nexport function TabContent({ name, children }: { name: string; children: ReactNode }) {\r\n return (\r\n <div\r\n data-tab-name={name}\r\n className=\"ipe-tabView__content-body\"\r\n style={{\r\n display: 'none',\r\n }}\r\n >\r\n {children}\r\n </div>\r\n )\r\n}\r\n"],"names":["TabView","tabs","defaultActiveIndex","el","jsxs","styles","jsx","tab","TabLabel","TabContent","defaultActiveLabel","name","children","e","container","labels","label","contents","content"],"mappings":";;;;;;;;;;;;;;;AAUO,SAASA,EAAQ;AAAA,EACtB,MAAAC,IAAO,CAAA;AAAA,EACP,oBAAAC,IAAqB;AACvB,GAGG;AACD,QAAMC,IACJC,gBAAAA,EAAC,OAAA,EAAI,WAAW,eAAeC,EAAO,OAAO,IAC3C,UAAA;AAAA,IAAA,gBAAAC,EAAC,MAAA,EAAG,WAAW,iCAAiCD,EAAO,g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AAYP,KAC9BO,EAAQ,MAAM,UAAU,IACxBA,EAAQ,UAAU,IAAIb,EAAO,MAAM,MAEnCa,EAAQ,MAAM,UAAU,QACxBA,EAAQ,UAAU,OAAOb,EAAO,MAAM;AAAA,QAG5C,CAAC;AAAA,MAEL;AAAA,MAEA,UAAA,gBAAAC,EAAC,KAAA,EAAG,UAAAM,KAAYD,EAAA,CAAK;AAAA,IAAA;AAAA,EAAA;AAG3B;AAEO,SAASF,EAAW,EAAE,MAAAE,GAAM,UAAAC,KAAmD;AACpF,SACE,gBAAAN;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,iBAAeK;AAAA,MACf,WAAU;AAAA,MACV,OAAO;AAAA,QACL,SAAS;AAAA,MAAA;AAAA,MAGV,UAAAC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { default as Schema } from 'schemastery';
|
|
2
2
|
type AnyConstructor<T = any> = new (...args: any[]) => T;
|
|
3
|
-
export type PreferenceAugmented<C extends AnyConstructor
|
|
3
|
+
export type PreferenceAugmented<D, C extends AnyConstructor> = C & {
|
|
4
4
|
PreferencesSchema: Schema<D>;
|
|
5
|
-
PreferencesDefaults: D;
|
|
6
5
|
};
|
|
7
6
|
/**
|
|
8
7
|
* Decorator for registering preferences
|
|
@@ -32,5 +31,5 @@ export type PreferenceAugmented<C extends AnyConstructor, D extends Record<strin
|
|
|
32
31
|
* }
|
|
33
32
|
* ```
|
|
34
33
|
*/
|
|
35
|
-
export declare function RegisterPreferences<D extends Record<string, any>>(schema: Schema<D
|
|
34
|
+
export declare function RegisterPreferences<D extends Record<string, any>>(schema: Schema<D>): <T extends AnyConstructor>(target: T) => PreferenceAugmented<D, T>;
|
|
36
35
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-Bh70Udzi.js","sources":["../src/components/TwinSwapInput/index.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom/jsx-runtime'\nimport styles from './styles.module.sass'\n\nexport type TwinSwapInputProps = {\n inputs: [TwinSwapInputInput, TwinSwapInputInput]\n enableSwap?: boolean\n} & JSX.IntrinsicElements['div']\n\nexport interface TwinSwapInputInput {\n label?: string\n id?: string\n name: string\n value?: string\n disabled?: boolean\n required?: boolean\n inputProps?: Omit<JSX.IntrinsicElements['input'], 'name' | 'value'>\n}\n\nexport type TwinSwapElement = HTMLDivElement & {\n swap: () => void\n toggleEnableSwap: (enable?: boolean) => void\n}\n\nexport const TwinSwapInput = (props: TwinSwapInputProps) => {\n const { inputs, enableSwap = true, ...rest } = props\n\n const normalizedInputs =\n inputs?.length === 2\n ? inputs\n : ([inputs?.[0] ?? {}, inputs?.[1] ?? {}] as [TwinSwapInputInput, TwinSwapInputInput])\n\n // 内部稳定引用\n const inputRefs: [HTMLInputElement | null, HTMLInputElement | null] = [null, null]\n\n let swapCount = 0\n let swapBtnRef: HTMLButtonElement | null = null\n let svgRef: SVGElement | null = null\n\n const checkIfInputDisabled = () => inputRefs.some((el) => el && el.disabled)\n\n const swap = () => {\n if (!inputRefs[0] || !inputRefs[1]) return\n if (checkIfInputDisabled()) return\n\n const a = inputRefs[0]\n const b = inputRefs[1]\n const va = a.value\n const vb = b.value\n a.value = vb\n b.value = va\n\n // 与原实现一致:派发 change(不冒泡)\n a.dispatchEvent(new Event('change'))\n b.dispatchEvent(new Event('change'))\n\n swapCount++\n if (svgRef) {\n svgRef.style.transform = `rotateY(${swapCount * -180}deg)`\n svgRef.style.transition = 'transform 200ms ease'\n }\n }\n\n const toggleEnableSwap = (enable?: boolean) => {\n if (!swapBtnRef) return\n const next = enable ?? !swapBtnRef.disabled\n swapBtnRef.disabled = !next\n if (next) {\n // 与原实现一致:开启时把 inputs 解禁\n inputRefs.forEach((el) => {\n if (el) el.disabled = false\n })\n }\n }\n\n const swapButton = (\n <button\n type=\"button\"\n aria-label=\"Swap values\"\n onClick={swap}\n disabled={checkIfInputDisabled() || !enableSwap}\n ref={(el) => (swapBtnRef = el as HTMLButtonElement)}\n >\n <svg\n ref={(el) => (svgRef = el as unknown as SVGElement)}\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"icon-tabler icons-tabler-outline icon-tabler-transfer\"\n >\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M20 10h-16l5.5 -6\" />\n <path d=\"M4 14h16l-5.5 6\" />\n </svg>\n </button>\n ) as HTMLButtonElement\n\n const container = (\n <div className={`twin-swap-input ${styles.twinSwapInput}`} {...rest}>\n {normalizedInputs.map((input, index) => {\n const { label, id, name, value, disabled, required, inputProps } = input\n const isLeft = index === 0\n const inputId = id || name\n\n return (\n <div\n className={`${styles.inputWrapper} ${isLeft ? styles.inputLeft : styles.inputRight}`}\n >\n {label && <label htmlFor={inputId}>{label}</label>}\n <input\n ref={(el) => (inputRefs[index] = el as HTMLInputElement)}\n type=\"text\"\n id={inputId}\n name={name}\n value={value}\n disabled={disabled}\n required={required}\n {...inputProps}\n />\n </div>\n )\n })}\n\n <div className={styles.swapButton}>{swapButton}</div>\n </div>\n ) as TwinSwapElement\n\n container.swap = swap\n container.toggleEnableSwap = toggleEnableSwap\n\n return container\n}\n"],"names":["TwinSwapInput","props","inputs","enableSwap","rest","normalizedInputs","inputRefs","swapCount","swapBtnRef","svgRef","checkIfInputDisabled","el","swap","a","b","va","vb","toggleEnableSwap","enable","next","swapButton","jsx","jsxs","container","styles","input","index","label","id","name","value","disabled","required","inputProps","isLeft","inputId"],"mappings":";;;;;;;GAuBaA,IAAgB,CAACC,MAA8B;AAC1D,QAAM,EAAE,QAAAC,GAAQ,YAAAC,IAAa,IAAM,GAAGC,MAASH,GAEzCI,IACJH,GAAQ,WAAW,IACfA,IACC,CAACA,IAAS,CAAC,KAAK,CAAA,GAAIA,IAAS,CAA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U,mBAAmBN,GAEtBM;AACT;"}
|
|
1
|
+
{"version":3,"file":"index-Bh70Udzi.js","sources":["../src/components/TwinSwapInput/index.tsx"],"sourcesContent":["import { JSX } from 'jsx-dom/jsx-runtime'\r\nimport styles from './styles.module.sass'\r\n\r\nexport type TwinSwapInputProps = {\r\n inputs: [TwinSwapInputInput, TwinSwapInputInput]\r\n enableSwap?: boolean\r\n} & JSX.IntrinsicElements['div']\r\n\r\nexport interface TwinSwapInputInput {\r\n label?: string\r\n id?: string\r\n name: string\r\n value?: string\r\n disabled?: boolean\r\n required?: boolean\r\n inputProps?: Omit<JSX.IntrinsicElements['input'], 'name' | 'value'>\r\n}\r\n\r\nexport type TwinSwapElement = HTMLDivElement & {\r\n swap: () => void\r\n toggleEnableSwap: (enable?: boolean) => void\r\n}\r\n\r\nexport const TwinSwapInput = (props: TwinSwapInputProps) => {\r\n const { inputs, enableSwap = true, ...rest } = props\r\n\r\n const normalizedInputs =\r\n inputs?.length === 2\r\n ? inputs\r\n : ([inputs?.[0] ?? {}, inputs?.[1] ?? {}] as [TwinSwapInputInput, TwinSwapInputInput])\r\n\r\n // 内部稳定引用\r\n const inputRefs: [HTMLInputElement | null, HTMLInputElement | null] = [null, null]\r\n\r\n let swapCount = 0\r\n let swapBtnRef: HTMLButtonElement | null = null\r\n let svgRef: SVGElement | null = null\r\n\r\n const checkIfInputDisabled = () => inputRefs.some((el) => el && el.disabled)\r\n\r\n const swap = () => {\r\n if (!inputRefs[0] || !inputRefs[1]) return\r\n if (checkIfInputDisabled()) return\r\n\r\n const a = inputRefs[0]\r\n const b = inputRefs[1]\r\n const va = a.value\r\n const vb = b.value\r\n a.value = vb\r\n b.value = va\r\n\r\n // 与原实现一致:派发 change(不冒泡)\r\n a.dispatchEvent(new Event('change'))\r\n b.dispatchEvent(new Event('change'))\r\n\r\n swapCount++\r\n if (svgRef) {\r\n svgRef.style.transform = `rotateY(${swapCount * -180}deg)`\r\n svgRef.style.transition = 'transform 200ms ease'\r\n }\r\n }\r\n\r\n const toggleEnableSwap = (enable?: boolean) => {\r\n if (!swapBtnRef) return\r\n const next = enable ?? !swapBtnRef.disabled\r\n swapBtnRef.disabled = !next\r\n if (next) {\r\n // 与原实现一致:开启时把 inputs 解禁\r\n inputRefs.forEach((el) => {\r\n if (el) el.disabled = false\r\n })\r\n }\r\n }\r\n\r\n const swapButton = (\r\n <button\r\n type=\"button\"\r\n aria-label=\"Swap values\"\r\n onClick={swap}\r\n disabled={checkIfInputDisabled() || !enableSwap}\r\n ref={(el) => (swapBtnRef = el as HTMLButtonElement)}\r\n >\r\n <svg\r\n ref={(el) => (svgRef = el as unknown as SVGElement)}\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"icon-tabler icons-tabler-outline icon-tabler-transfer\"\r\n >\r\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path d=\"M20 10h-16l5.5 -6\" />\r\n <path d=\"M4 14h16l-5.5 6\" />\r\n </svg>\r\n </button>\r\n ) as HTMLButtonElement\r\n\r\n const container = (\r\n <div className={`twin-swap-input ${styles.twinSwapInput}`} {...rest}>\r\n {normalizedInputs.map((input, index) => {\r\n const { label, id, name, value, disabled, required, inputProps } = input\r\n const isLeft = index === 0\r\n const inputId = id || name\r\n\r\n return (\r\n <div\r\n className={`${styles.inputWrapper} ${isLeft ? styles.inputLeft : styles.inputRight}`}\r\n >\r\n {label && <label htmlFor={inputId}>{label}</label>}\r\n <input\r\n ref={(el) => (inputRefs[index] = el as HTMLInputElement)}\r\n type=\"text\"\r\n id={inputId}\r\n name={name}\r\n value={value}\r\n disabled={disabled}\r\n required={required}\r\n {...inputProps}\r\n />\r\n </div>\r\n )\r\n })}\r\n\r\n <div className={styles.swapButton}>{swapButton}</div>\r\n </div>\r\n ) as TwinSwapElement\r\n\r\n container.swap = swap\r\n container.toggleEnableSwap = toggleEnableSwap\r\n\r\n return container\r\n}\r\n"],"names":["TwinSwapInput","props","inputs","enableSwap","rest","normalizedInputs","inputRefs","swapCount","swapBtnRef","svgRef","checkIfInputDisabled","el","swap","a","b","va","vb","toggleEnableSwap","enable","next","swapButton","jsx","jsxs","container","styles","input","index","label","id","name","value","disabled","required","inputProps","isLeft","inputId"],"mappings":";;;;;;;GAuBaA,IAAgB,CAACC,MAA8B;AAC1D,QAAM,EAAE,QAAAC,GAAQ,YAAAC,IAAa,IAAM,GAAGC,MAASH,GAEzCI,IACJH,GAAQ,WAAW,IACfA,IACC,CAACA,IAAS,CAAC,KAAK,CAAA,GAAIA,IAAS,CAAC,KAAK,CAAA,CAAE,GAGtCI,IAAgE,CAAC,MAAM,IAAI;AAEjF,MAAIC,IAAY,GACZC,IAAuC,MACvCC,IAA4B;AAEhC,QAAMC,IAAuB,MAAMJ,EAAU,KAAK,CAACK,MAAOA,KAAMA,EAAG,QAAQ,GAErEC,IAAO,MAAM;AAEjB,QADI,CAACN,EAAU,CAAC,KAAK,CAACA,EAAU,CAAC,KAC7BI,IAAwB;AAE5B,UAAMG,IAAIP,EAAU,CAAC,GACfQ,IAAIR,EAAU,CAAC,GACfS,IAAKF,EAAE,OACPG,IAAKF,EAAE;AACb,IAAAD,EAAE,QAAQG,GACVF,EAAE,QAAQC,GAGVF,EAAE,cAAc,IAAI,MAAM,QAAQ,CAAC,GACnCC,EAAE,cAAc,IAAI,MAAM,QAAQ,CAAC,GAEnCP,KACIE,MACFA,EAAO,MAAM,YAAY,WAAWF,IAAY,IAAI,QACpDE,EAAO,MAAM,aAAa;AAAA,EAE9B,GAEMQ,IAAmB,CAACC,MAAqB;AAC7C,QAAI,CAACV,EAAY;AACjB,UAAMW,IAAOD,KAAU,CAACV,EAAW;AACnC,IAAAA,EAAW,WAAW,CAACW,GACnBA,KAEFb,EAAU,QAAQ,CAACK,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,EAAM,SAASc,GAAU,UAAAR,GAAM;AAAA,YAC1C,gBAAAN;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,KAAK,CAACV,MAAQL,EAAUoB,CAAK,IAAIf;AAAA,gBACjC,MAAK;AAAA,gBACL,IAAIwB;AAAA,gBACJ,MAAAN;AAAA,gBACA,OAAAC;AAAA,gBACA,UAAAC;AAAA,gBACA,UAAAC;AAAA,gBACC,GAAGC;AAAA,cAAA;AAAA,YAAA;AAAA,UACN;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,CAAC;AAAA,IAED,gBAAAZ,EAAC,OAAA,EAAI,WAAWG,EAAO,YAAa,UAAAJ,EAAA,CAAW;AAAA,EAAA,GACjD;AAGF,SAAAG,EAAU,OAAOX,GACjBW,EAAU,mBAAmBN,GAEtBM;AACT;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { j as i, P as y } from "./index-CvhkVj_L.js";
|
|
2
|
-
import { B as S, I as q } from "./index-
|
|
2
|
+
import { B as S, I as q } from "./index-Ek5d60jn.js";
|
|
3
3
|
import { T as F } from "./index-Bh70Udzi.js";
|
|
4
4
|
import { C as u } from "./CheckBox-D3rHnX7I.js";
|
|
5
5
|
import { I as j } from "./InputBox-BV4m05Xs.js";
|
|
@@ -164,4 +164,4 @@ N(p, 1, v);
|
|
|
164
164
|
export {
|
|
165
165
|
v as PluginQuickMove
|
|
166
166
|
};
|
|
167
|
-
//# sourceMappingURL=index-
|
|
167
|
+
//# sourceMappingURL=index-C-A3jSMx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-C-A3jSMx.js","sources":["../src/plugins/quick-move/index.tsx"],"sourcesContent":["import { Inject, InPageEdit } from '@/InPageEdit'\r\n\r\ndeclare module '@/InPageEdit' {\r\n interface InPageEdit {\r\n quickMove: PluginQuickMove['quickMove']\r\n movePage: PluginQuickMove['movePage']\r\n }\r\n}\r\n\r\nexport interface MovePageOptions {\r\n from: string\r\n to: string\r\n reason?: string\r\n movetalk?: boolean\r\n movesubpages?: boolean\r\n noredirect?: boolean\r\n}\r\nexport interface QuickMoveOptions extends Partial<MovePageOptions> {\r\n lockFromField?: boolean\r\n lockToField?: boolean\r\n}\r\n\r\n@Inject(['modal', 'wiki'])\r\nexport class PluginQuickMove extends BasePlugin {\r\n constructor(public ctx: InPageEdit) {\r\n super(ctx, {}, 'quick-move')\r\n ctx.set('quickMove', this.quickMove.bind(this))\r\n ctx.set('movePage', this.movePage.bind(this))\r\n }\r\n\r\n protected start(): Promise<void> | void {\r\n this.ctx.inject(['toolbox'], (ctx) => {\r\n this.injectToolbox(ctx)\r\n })\r\n }\r\n\r\n private injectToolbox(ctx: InPageEdit) {\r\n const curPageName = window.mw?.config.get('wgPageName') || ''\r\n const canEdit = window.mw?.config.get('wgIsProbablyEditable')\r\n ctx.toolbox.addButton({\r\n id: 'quick-move',\r\n icon: (\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"24\"\r\n height=\"24\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"icon icon-tabler icons-tabler-outline icon-tabler-forms\"\r\n >\r\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\r\n <path d=\"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3\" />\r\n <path d=\"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3\" />\r\n <path d=\"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7\" />\r\n <path d=\"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1\" />\r\n <path d=\"M17 12h.01\" />\r\n <path d=\"M13 12h.01\" />\r\n </svg>\r\n ),\r\n tooltip: 'Quick Move',\r\n group: 'group1',\r\n index: 1,\r\n onClick: () => {\r\n this.quickMove(\r\n canEdit\r\n ? {\r\n lockFromField: true,\r\n from: curPageName,\r\n }\r\n : {}\r\n )\r\n },\r\n })\r\n }\r\n\r\n quickMove(options?: Partial<QuickMoveOptions>) {\r\n const modal = this.ctx.modal\r\n .createObject({\r\n title: 'Quick Move',\r\n content: (<ProgressBar />) as HTMLElement,\r\n className: 'quick-move compact-buttons',\r\n sizeClass: 'smallToMedium',\r\n center: true,\r\n })\r\n .init()\r\n\r\n let formRef: HTMLFormElement | null = null\r\n modal.setContent(\r\n (\r\n <form\r\n ref={(el) => (formRef = el)}\r\n style={{\r\n display: 'flex',\r\n flexDirection: 'column',\r\n gap: '1rem',\r\n }}\r\n onSubmit={(e) => {\r\n e.preventDefault()\r\n formRef?.checkValidity()\r\n if (!formRef?.reportValidity()) {\r\n return\r\n }\r\n const formData = new FormData(formRef!)\r\n const options = {\r\n from: formData.get('from')?.toString().trim()!,\r\n to: formData.get('to')?.toString().trim()!,\r\n reason: (formData.get('reason') as string) || '',\r\n movetalk: formData.get('movetalk') === 'on',\r\n movesubpages: formData.get('movesubpages') === 'on',\r\n noredirect: formData.get('noredirect') === 'on',\r\n }\r\n if (!options.from || !options.to) {\r\n this.ctx.modal.notify('error', {\r\n title: 'Failed to move',\r\n content: 'From and to are required.',\r\n })\r\n return\r\n }\r\n modal.setLoadingState(true)\r\n this.movePage(options)\r\n .then(() => {\r\n location.reload()\r\n })\r\n .catch((error) => {\r\n modal.setLoadingState(false)\r\n this.ctx.modal.notify('error', {\r\n title: 'Failed to move',\r\n content: error instanceof Error ? error.message : String(error),\r\n })\r\n })\r\n }}\r\n >\r\n <TwinSwapInput\r\n inputs={[\r\n {\r\n label: 'Move from',\r\n name: 'from',\r\n value: options?.from,\r\n required: true,\r\n },\r\n {\r\n label: 'Move to',\r\n name: 'to',\r\n value: options?.to,\r\n required: true,\r\n },\r\n ]}\r\n />\r\n <div>\r\n <CheckBox name=\"movetalk\" id=\"movetalk\" checked={options?.movetalk}>\r\n Move talk page\r\n </CheckBox>\r\n </div>\r\n <div>\r\n <CheckBox name=\"movesubpages\" id=\"movesubpages\" checked={options?.movesubpages}>\r\n Move subpage(s) (up to 100)\r\n </CheckBox>\r\n </div>\r\n {this.ctx.wiki.hasRight('suppressredirect') && (\r\n <div>\r\n <CheckBox name=\"noredirect\" id=\"noredirect\" checked={options?.noredirect}>\r\n Move without leaving a redirect\r\n </CheckBox>\r\n </div>\r\n )}\r\n <InputBox label=\"Reason\" id=\"reason\" name=\"reason\" value={options?.reason} />\r\n </form>\r\n ) as HTMLElement\r\n )\r\n\r\n modal.setButtons([\r\n {\r\n label: 'Move',\r\n className: 'is-primary is-ghost',\r\n method: () => {\r\n formRef?.dispatchEvent(new Event('submit'))\r\n },\r\n },\r\n ])\r\n\r\n return modal.show()\r\n }\r\n\r\n async movePage(options: MovePageOptions) {\r\n const { from, to, reason = '', ...rest } = options\r\n\r\n if (!from || !to) {\r\n throw new Error('From and to titles are required.')\r\n }\r\n if (from === to) {\r\n throw new Error('From and to titles cannot be the same.')\r\n }\r\n\r\n const wikiPage = await this.ctx.wikiPage.newFromTitle(from)\r\n return wikiPage.moveTo(to, reason, rest)\r\n }\r\n}\r\n"],"names":["_PluginQuickMove_decorators","_init","_a","Inject","PluginQuickMove","BasePlugin","ctx","curPageName","canEdit","jsxs","jsx","options","modal","ProgressBar","formRef","el","e","formData","error","TwinSwapInput","CheckBox","InputBox","from","to","reason","rest","__decoratorStart","__decorateElement","__runInitializers"],"mappings":";;;;;;;;;;;;;;;;GAAAA,GAAAC,GAAAC;AAsBAF,IAAA,CAACG,EAAO,CAAC,SAAS,MAAM,CAAC,CAAA;AAClB,MAAMC,WAAwBF,IAAAG,GAAW;AAAA,EAC9C,YAAmBC,GAAiB;AAClC,UAAMA,GAAK,CAAA,GAAI,YAAY,GADV,KAAA,MAAAA,GAEjBA,EAAI,IAAI,aAAa,KAAK,UAAU,KAAK,IAAI,CAAC,GAC9CA,EAAI,IAAI,YAAY,KAAK,SAAS,KAAK,IAAI,CAAC;AAAA,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