@paircode/ui-modals 0.1.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/assets/favicon.svg +23 -0
- package/assets/ui-modals.css +1 -0
- package/assets/ui-modals.js +2961 -0
- package/client.js +54 -0
- package/index.js +11 -0
- package/package.json +23 -0
package/client.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════════════════════════
|
|
2
|
+
// ui-modals — client 半:(ui) => void
|
|
3
|
+
//
|
|
4
|
+
// 按槽位细粒度拆分(2026-08-16):modals 区域独立插件包。
|
|
5
|
+
// 编译产物 assets/ui-modals.js(Vite lib IIFE,window.UiModals)——
|
|
6
|
+
// 提前编译,运行时仅加载执行;external 共享核心(Vue/状态/槽位注册表)
|
|
7
|
+
// 从 window.__PAIRCODE_CORE 取(壳 main.js 挂载)。
|
|
8
|
+
//
|
|
9
|
+
// render 返回 cleanup(app.unmount),槽位重渲染/插件卸载前宿主调用。
|
|
10
|
+
// ═══════════════════════════════════════════════════════════════
|
|
11
|
+
(ui) => {
|
|
12
|
+
const GLOBAL = 'UiModals'
|
|
13
|
+
const JS = 'plugins-assets/ui-modals/assets/ui-modals.js'
|
|
14
|
+
const CSS = 'plugins-assets/ui-modals/assets/ui-modals.css'
|
|
15
|
+
|
|
16
|
+
const register = () => {
|
|
17
|
+
ui.registerSlot({
|
|
18
|
+
slotId: 'modals',
|
|
19
|
+
title: '全局模态框(ui-modals)',
|
|
20
|
+
kind: 'single',
|
|
21
|
+
render(el) {
|
|
22
|
+
const mod = window[GLOBAL]
|
|
23
|
+
if (!mod || typeof mod.mount !== 'function') {
|
|
24
|
+
el.innerHTML = '<div style="padding:8px;font-size:12px;color:var(--text-muted)">modals bundle 未就绪</div>'
|
|
25
|
+
return
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return mod.mount(el)
|
|
29
|
+
} catch (e) {
|
|
30
|
+
console.warn('[ui-modals] mount 失败', e)
|
|
31
|
+
el.innerHTML = '<div style="padding:8px;font-size:12px;color:var(--text-muted)">挂载失败: ' + (e && e.message || e) + '</div>'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (window[GLOBAL]) {
|
|
38
|
+
register()
|
|
39
|
+
} else {
|
|
40
|
+
const link = document.createElement('link')
|
|
41
|
+
link.rel = 'stylesheet'
|
|
42
|
+
link.href = CSS
|
|
43
|
+
document.head.appendChild(link)
|
|
44
|
+
const s = document.createElement('script')
|
|
45
|
+
s.src = JS
|
|
46
|
+
s.onload = register
|
|
47
|
+
s.onerror = () => {
|
|
48
|
+
const msg = 'bundle 加载失败: ' + JS
|
|
49
|
+
console.warn('[ui-modals]', msg)
|
|
50
|
+
ui.reportFailure('render', msg)
|
|
51
|
+
}
|
|
52
|
+
document.head.appendChild(s)
|
|
53
|
+
}
|
|
54
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// ui-modals — host 半(纯 UI 插件,host 侧无逻辑)
|
|
2
|
+
// 装配链路:<InstallDir>/.pair/plugins/ 启动扫描 → define + load →
|
|
3
|
+
// /api/plugins 下发 → 前端 plugin-runtime.js syncClientHalves 装载 client 半
|
|
4
|
+
// → ui.registerSlot('modals') 占用 → 壳 ShellApp 渲染到 modals 槽位。
|
|
5
|
+
return {
|
|
6
|
+
name: 'ui-modals',
|
|
7
|
+
purpose: '6 个全局模态框 + GlobalDialogs + overlay 叠加挂载',
|
|
8
|
+
apply(ctx) {
|
|
9
|
+
// client 半负责渲染(见 client.js)
|
|
10
|
+
},
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paircode/ui-modals",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"scope": "global",
|
|
5
|
+
"type": "plugin",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"client": "client.js",
|
|
8
|
+
"description": "6 个全局模态框 + GlobalDialogs + overlay 叠加挂载",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"paircode"
|
|
11
|
+
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"index.js",
|
|
18
|
+
"client.js",
|
|
19
|
+
"assets",
|
|
20
|
+
"bin",
|
|
21
|
+
"package.json"
|
|
22
|
+
]
|
|
23
|
+
}
|