layplux 1.0.1 → 2.0.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.
- package/dist/cjs/components/center-view/index.cjs +18 -28
- package/dist/cjs/components/corner-glow/index.cjs +11 -28
- package/dist/cjs/components/dropdown/index.cjs +136 -130
- package/dist/cjs/components/icon/index.cjs +29 -51
- package/dist/cjs/components/index.cjs +24 -25
- package/dist/cjs/components/panel-view/index.cjs +111 -114
- package/dist/cjs/components/popup/index.cjs +166 -151
- package/dist/cjs/components/title/index.cjs +34 -47
- package/dist/cjs/components/tooltip/index.cjs +70 -61
- package/dist/cjs/components/widget/index.cjs +52 -72
- package/dist/cjs/index.cjs +13 -40
- package/dist/cjs/layout/glass-overlay.cjs +15 -28
- package/dist/cjs/layout/layered-manager.cjs +20 -29
- package/dist/cjs/layout/layplux.cjs +19 -32
- package/dist/cjs/layout/root-pane.cjs +20 -38
- package/dist/cjs/layout/skeleton/bottom-area.cjs +26 -43
- package/dist/cjs/layout/skeleton/bottom-left-area.cjs +12 -29
- package/dist/cjs/layout/skeleton/bottom-right-area.cjs +11 -28
- package/dist/cjs/layout/skeleton/center-area.cjs +278 -371
- package/dist/cjs/layout/skeleton/index.cjs +7 -24
- package/dist/cjs/layout/skeleton/left-bottom-area.cjs +12 -29
- package/dist/cjs/layout/skeleton/left-top-area.cjs +12 -29
- package/dist/cjs/layout/skeleton/right-bottom-area.cjs +11 -28
- package/dist/cjs/layout/skeleton/right-top-area.cjs +11 -28
- package/dist/cjs/layout/skeleton/skeleton.cjs +55 -60
- package/dist/cjs/layout/skeleton/top-area.cjs +26 -43
- package/dist/cjs/locales/en-US.cjs +11 -30
- package/dist/cjs/locales/index.cjs +12 -30
- package/dist/cjs/locales/zh-CN.cjs +11 -30
- package/dist/cjs/managers/area.cjs +12 -25
- package/dist/cjs/managers/index.cjs +12 -20
- package/dist/cjs/managers/pane.cjs +12 -26
- package/dist/cjs/managers/skeleton.cjs +112 -124
- package/dist/cjs/managers/theme.cjs +8 -29
- package/dist/cjs/managers/widget-container.cjs +31 -31
- package/dist/cjs/managers/widget.cjs +63 -50
- package/dist/cjs/types/config.cjs +2 -16
- package/dist/cjs/types/index.cjs +2 -18
- package/dist/cjs/types/locale.cjs +2 -16
- package/dist/cjs/utils/event-bus.cjs +53 -49
- package/dist/cjs/utils/focus-tracker.cjs +66 -42
- package/dist/cjs/utils/index.cjs +23 -31
- package/dist/cjs/utils/unique-id.cjs +5 -24
- package/dist/cjs/utils/vue.cjs +20 -30
- package/dist/esm/components/center-view/index.mjs +15 -7
- package/dist/esm/components/corner-glow/index.mjs +8 -7
- package/dist/esm/components/dropdown/index.mjs +117 -101
- package/dist/esm/components/icon/index.mjs +24 -30
- package/dist/esm/components/index.mjs +7 -8
- package/dist/esm/components/panel-view/index.mjs +107 -98
- package/dist/esm/components/popup/index.mjs +155 -130
- package/dist/esm/components/title/index.mjs +29 -24
- package/dist/esm/components/tooltip/index.mjs +67 -40
- package/dist/esm/components/widget/index.mjs +45 -48
- package/dist/esm/index.mjs +4 -10
- package/dist/esm/layout/glass-overlay.mjs +12 -7
- package/dist/esm/layout/layered-manager.mjs +17 -8
- package/dist/esm/layout/layplux.mjs +14 -11
- package/dist/esm/layout/root-pane.mjs +16 -16
- package/dist/esm/layout/skeleton/bottom-area.mjs +23 -22
- package/dist/esm/layout/skeleton/bottom-left-area.mjs +9 -8
- package/dist/esm/layout/skeleton/bottom-right-area.mjs +8 -7
- package/dist/esm/layout/skeleton/center-area.mjs +251 -333
- package/dist/esm/layout/skeleton/index.mjs +1 -4
- package/dist/esm/layout/skeleton/left-bottom-area.mjs +9 -8
- package/dist/esm/layout/skeleton/left-top-area.mjs +9 -8
- package/dist/esm/layout/skeleton/right-bottom-area.mjs +8 -7
- package/dist/esm/layout/skeleton/right-top-area.mjs +8 -7
- package/dist/esm/layout/skeleton/skeleton.mjs +52 -39
- package/dist/esm/layout/skeleton/top-area.mjs +23 -22
- package/dist/esm/locales/en-US.mjs +9 -10
- package/dist/esm/locales/index.mjs +7 -9
- package/dist/esm/locales/zh-CN.mjs +9 -10
- package/dist/esm/managers/area.mjs +10 -5
- package/dist/esm/managers/index.mjs +3 -3
- package/dist/esm/managers/pane.mjs +9 -5
- package/dist/esm/managers/skeleton.mjs +97 -95
- package/dist/esm/managers/theme.mjs +6 -9
- package/dist/esm/managers/widget-container.mjs +28 -10
- package/dist/esm/managers/widget.mjs +55 -25
- package/dist/esm/types/config.mjs +1 -0
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/locale.mjs +1 -0
- package/dist/esm/utils/event-bus.mjs +46 -17
- package/dist/esm/utils/focus-tracker.mjs +63 -23
- package/dist/esm/utils/index.mjs +7 -10
- package/dist/esm/utils/unique-id.mjs +3 -4
- package/dist/esm/utils/vue.mjs +13 -5
- package/dist/types/managers/skeleton.d.ts.map +1 -1
- package/dist/umd/index.js +2 -30
- package/package.json +18 -14
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
var managers_exports = {};
|
|
17
|
-
module.exports = __toCommonJS(managers_exports);
|
|
18
|
-
__reExport(managers_exports, require("./skeleton"), module.exports);
|
|
19
|
-
__reExport(managers_exports, require("./area"), module.exports);
|
|
20
|
-
__reExport(managers_exports, require("./widget"), module.exports);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var skeleton = require('./skeleton.cjs');
|
|
4
|
+
var area = require('./area.cjs');
|
|
5
|
+
var widget = require('./widget.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.useSkeleton = skeleton.useSkeleton;
|
|
10
|
+
exports.useArea = area.useArea;
|
|
11
|
+
exports.isWidget = widget.isWidget;
|
|
12
|
+
exports.useWidget = widget.useWidget;
|
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var pane_exports = {};
|
|
20
|
-
__export(pane_exports, {
|
|
21
|
-
usePane: () => usePane
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(pane_exports);
|
|
24
|
-
var import_vue = require("vue");
|
|
25
|
-
function usePane(defaultViewMode = "DockPinned") {
|
|
26
|
-
const viewMode = (0, import_vue.ref)(defaultViewMode);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 没个widget都会对应自己的pane的状态
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function usePane(defaultViewMode = 'DockPinned') {
|
|
10
|
+
const viewMode = vue.ref(defaultViewMode);
|
|
27
11
|
function setViewMode(mode) {
|
|
28
12
|
viewMode.value = mode;
|
|
29
13
|
}
|
|
@@ -32,3 +16,5 @@ function usePane(defaultViewMode = "DockPinned") {
|
|
|
32
16
|
setViewMode
|
|
33
17
|
};
|
|
34
18
|
}
|
|
19
|
+
|
|
20
|
+
exports.usePane = usePane;
|
|
@@ -1,135 +1,109 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var skeleton_exports = {};
|
|
20
|
-
__export(skeleton_exports, {
|
|
21
|
-
useSkeleton: () => useSkeleton
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(skeleton_exports);
|
|
24
|
-
var import_vue = require("vue");
|
|
25
|
-
var import_area = require("./area");
|
|
26
|
-
var import_widget = require("./widget");
|
|
27
|
-
var import_widget_container = require("./widget-container");
|
|
28
|
-
var import_utils = require("../utils");
|
|
29
|
-
var import_theme = require("./theme");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
var area = require('./area.cjs');
|
|
5
|
+
var widget = require('./widget.cjs');
|
|
6
|
+
var widgetContainer = require('./widget-container.cjs');
|
|
7
|
+
var theme = require('./theme.cjs');
|
|
8
|
+
var eventBus = require('../utils/event-bus.cjs');
|
|
9
|
+
var index = require('../locales/index.cjs');
|
|
10
|
+
var focusTracker = require('../utils/focus-tracker.cjs');
|
|
11
|
+
|
|
30
12
|
function useSkeleton() {
|
|
31
13
|
const widgets = [];
|
|
32
14
|
const self = {};
|
|
33
|
-
const containers =
|
|
34
|
-
const focusTracker = new
|
|
35
|
-
const event =
|
|
36
|
-
const locale =
|
|
15
|
+
const containers = new Map();
|
|
16
|
+
const focusTracker$1 = new focusTracker.FocusTracker();
|
|
17
|
+
const event = eventBus.createPluginEventBus('skeleton');
|
|
18
|
+
const locale = vue.ref(index.getBuiltInLocale('zh-CN'));
|
|
37
19
|
function setLocale(name) {
|
|
38
|
-
locale.value =
|
|
20
|
+
locale.value = index.getBuiltInLocale(name);
|
|
39
21
|
}
|
|
40
|
-
const theme =
|
|
41
|
-
const systemDark = (
|
|
42
|
-
typeof window !== "undefined" ? window.matchMedia("(prefers-color-scheme: dark)").matches : false
|
|
43
|
-
);
|
|
22
|
+
const theme$1 = vue.ref('system');
|
|
23
|
+
const systemDark = vue.ref(typeof window !== 'undefined' ? window.matchMedia('(prefers-color-scheme: dark)').matches : false);
|
|
44
24
|
function resolveTheme() {
|
|
45
|
-
if (theme.value ===
|
|
46
|
-
return systemDark.value ?
|
|
25
|
+
if (theme$1.value === 'system') {
|
|
26
|
+
return systemDark.value ? 'dark' : 'light';
|
|
47
27
|
}
|
|
48
|
-
return theme.value;
|
|
28
|
+
return theme$1.value;
|
|
49
29
|
}
|
|
50
30
|
function isDark() {
|
|
51
|
-
return resolveTheme() ===
|
|
31
|
+
return resolveTheme() === 'dark';
|
|
52
32
|
}
|
|
53
33
|
function setTheme(t) {
|
|
54
|
-
theme.value = t;
|
|
34
|
+
theme$1.value = t;
|
|
55
35
|
}
|
|
56
|
-
const themeName =
|
|
36
|
+
const themeName = vue.ref('default');
|
|
57
37
|
function setThemeName(name) {
|
|
58
38
|
themeName.value = name;
|
|
59
39
|
}
|
|
60
40
|
function registerTheme(name, vars) {
|
|
61
|
-
|
|
41
|
+
theme.injectThemeCSS(name, vars);
|
|
62
42
|
}
|
|
63
|
-
|
|
64
|
-
|
|
43
|
+
|
|
44
|
+
// 监听系统主题变化
|
|
45
|
+
if (typeof window !== 'undefined') {
|
|
46
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
|
|
65
47
|
systemDark.value = e.matches;
|
|
66
48
|
});
|
|
67
49
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const bottomArea =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
createContainer
|
|
114
|
-
},
|
|
115
|
-
"bottomLeftArea",
|
|
116
|
-
(config, container) => createWidget(config, container)
|
|
117
|
-
);
|
|
118
|
-
const centerArea = (0, import_area.useArea)(
|
|
119
|
-
{ createContainer },
|
|
120
|
-
"centerArea",
|
|
121
|
-
(config, container) => createWidget(config, container)
|
|
122
|
-
);
|
|
50
|
+
|
|
51
|
+
// 顶部工具栏
|
|
52
|
+
const topArea = area.useArea({
|
|
53
|
+
createContainer
|
|
54
|
+
}, 'topArea', (config, container) => createWidget(config, container));
|
|
55
|
+
|
|
56
|
+
// 底部状态栏
|
|
57
|
+
const bottomArea = area.useArea({
|
|
58
|
+
createContainer
|
|
59
|
+
}, 'bottomArea', (config, container) => createWidget(config, container));
|
|
60
|
+
|
|
61
|
+
// 左侧顶部主区域
|
|
62
|
+
const leftTopArea = area.useArea({
|
|
63
|
+
createContainer
|
|
64
|
+
}, 'leftTopArea', (config, container) => createWidget(config, container));
|
|
65
|
+
|
|
66
|
+
// 左侧底部快捷区域
|
|
67
|
+
const leftBottomArea = area.useArea({
|
|
68
|
+
createContainer
|
|
69
|
+
}, 'leftBottomArea', (config, container) => createWidget(config, container));
|
|
70
|
+
|
|
71
|
+
// 右侧顶部主区域
|
|
72
|
+
const rightTopArea = area.useArea({
|
|
73
|
+
createContainer
|
|
74
|
+
}, 'rightTopArea', (config, container) => createWidget(config, container));
|
|
75
|
+
|
|
76
|
+
// 右侧底部区域
|
|
77
|
+
const rightBottomArea = area.useArea({
|
|
78
|
+
createContainer
|
|
79
|
+
}, 'rightBottomArea', (config, container) => createWidget(config, container));
|
|
80
|
+
|
|
81
|
+
// 右侧最底部快捷操作
|
|
82
|
+
const bottomRightArea = area.useArea({
|
|
83
|
+
createContainer
|
|
84
|
+
}, 'bottomRightArea', (config, container) => createWidget(config, container));
|
|
85
|
+
|
|
86
|
+
// 左侧最底部快捷操作(交互型)
|
|
87
|
+
const bottomLeftArea = area.useArea({
|
|
88
|
+
createContainer
|
|
89
|
+
}, 'bottomLeftArea', (config, container) => createWidget(config, container));
|
|
90
|
+
|
|
91
|
+
// 中心区域
|
|
92
|
+
const centerArea = area.useArea({
|
|
93
|
+
createContainer
|
|
94
|
+
}, 'centerArea', (config, container) => createWidget(config, container));
|
|
123
95
|
function createWidget(config, container) {
|
|
124
|
-
if (
|
|
96
|
+
if (widget.isWidget(config)) {
|
|
125
97
|
return config;
|
|
126
98
|
}
|
|
127
|
-
const widget =
|
|
128
|
-
widgets.push(widget);
|
|
129
|
-
event.emitGlobal(
|
|
130
|
-
|
|
99
|
+
const widget$1 = widget.useWidget(config, container, self);
|
|
100
|
+
widgets.push(widget$1);
|
|
101
|
+
event.emitGlobal('skeleton:widget-added', {
|
|
102
|
+
widget: widget$1
|
|
103
|
+
});
|
|
104
|
+
return widget$1;
|
|
131
105
|
}
|
|
132
|
-
const focusedId =
|
|
106
|
+
const focusedId = vue.ref(null);
|
|
133
107
|
function toggleFocus(id) {
|
|
134
108
|
if (focusedId.value === id) {
|
|
135
109
|
blur();
|
|
@@ -139,42 +113,54 @@ function useSkeleton() {
|
|
|
139
113
|
}
|
|
140
114
|
function focus(id) {
|
|
141
115
|
focusedId.value = id;
|
|
142
|
-
event.emitGlobal(
|
|
116
|
+
event.emitGlobal('skeleton:focus-changed', {
|
|
117
|
+
focusedId: id
|
|
118
|
+
});
|
|
143
119
|
}
|
|
144
120
|
function blur() {
|
|
145
121
|
focusedId.value = null;
|
|
146
|
-
event.emitGlobal(
|
|
122
|
+
event.emitGlobal('skeleton:focus-changed', {
|
|
123
|
+
focusedId: null
|
|
124
|
+
});
|
|
147
125
|
}
|
|
148
126
|
function add(config, extraConfig) {
|
|
127
|
+
// TODO: 处理extraConfig
|
|
149
128
|
if (extraConfig) {
|
|
150
|
-
config = {
|
|
129
|
+
config = {
|
|
130
|
+
...config,
|
|
131
|
+
...extraConfig
|
|
132
|
+
};
|
|
151
133
|
}
|
|
152
|
-
const {
|
|
153
|
-
|
|
134
|
+
const {
|
|
135
|
+
area
|
|
136
|
+
} = config;
|
|
137
|
+
if (area === 'topArea') {
|
|
154
138
|
topArea.add(config);
|
|
155
|
-
} else if (area ===
|
|
139
|
+
} else if (area === 'bottomArea') {
|
|
156
140
|
bottomArea.add(config);
|
|
157
|
-
} else if (area ===
|
|
141
|
+
} else if (area === 'leftTopArea') {
|
|
158
142
|
leftTopArea.add(config);
|
|
159
|
-
} else if (area ===
|
|
143
|
+
} else if (area === 'leftBottomArea') {
|
|
160
144
|
leftBottomArea.add(config);
|
|
161
|
-
} else if (area ===
|
|
145
|
+
} else if (area === 'bottomLeftArea') {
|
|
162
146
|
bottomLeftArea.add(config);
|
|
163
|
-
} else if (area ===
|
|
147
|
+
} else if (area === 'rightTopArea') {
|
|
164
148
|
rightTopArea.add(config);
|
|
165
|
-
} else if (area ===
|
|
149
|
+
} else if (area === 'rightBottomArea') {
|
|
166
150
|
rightBottomArea.add(config);
|
|
167
|
-
} else if (area ===
|
|
151
|
+
} else if (area === 'bottomRightArea') {
|
|
168
152
|
bottomRightArea.add(config);
|
|
169
|
-
} else if (area ===
|
|
153
|
+
} else if (area === 'centerArea') {
|
|
170
154
|
centerArea.add(config);
|
|
171
155
|
}
|
|
172
156
|
}
|
|
173
157
|
function createContainer(name, handle) {
|
|
174
|
-
const container =
|
|
158
|
+
const container = widgetContainer.useWidgetContainer(handle, self);
|
|
175
159
|
containers.set(name, container);
|
|
176
160
|
return container;
|
|
177
161
|
}
|
|
162
|
+
|
|
163
|
+
// 4. 填充 self 的真正属性
|
|
178
164
|
Object.assign(self, {
|
|
179
165
|
widgets,
|
|
180
166
|
topArea,
|
|
@@ -187,11 +173,11 @@ function useSkeleton() {
|
|
|
187
173
|
bottomLeftArea,
|
|
188
174
|
centerArea,
|
|
189
175
|
focusedId,
|
|
190
|
-
focusTracker,
|
|
176
|
+
focusTracker: focusTracker$1,
|
|
191
177
|
event,
|
|
192
178
|
locale,
|
|
193
179
|
setLocale,
|
|
194
|
-
theme,
|
|
180
|
+
theme: theme$1,
|
|
195
181
|
resolveTheme,
|
|
196
182
|
isDark,
|
|
197
183
|
setTheme,
|
|
@@ -206,3 +192,5 @@ function useSkeleton() {
|
|
|
206
192
|
});
|
|
207
193
|
return self;
|
|
208
194
|
}
|
|
195
|
+
|
|
196
|
+
exports.useSkeleton = useSkeleton;
|
|
@@ -1,37 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var theme_exports = {};
|
|
20
|
-
__export(theme_exports, {
|
|
21
|
-
injectThemeCSS: () => injectThemeCSS
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(theme_exports);
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/** 为指定 theme 注入 CSS 变量样式,重复注册会替换 */
|
|
24
4
|
function injectThemeCSS(name, vars) {
|
|
25
5
|
const styleId = `layplux-theme-${name}`;
|
|
26
6
|
let styleEl = document.getElementById(styleId);
|
|
27
7
|
if (!styleEl) {
|
|
28
|
-
styleEl = document.createElement(
|
|
8
|
+
styleEl = document.createElement('style');
|
|
29
9
|
styleEl.id = styleId;
|
|
30
10
|
document.head.appendChild(styleEl);
|
|
31
11
|
}
|
|
32
|
-
const varLines = Object.entries(vars).map(([key, value]) => ` ${key}: ${value};`).join(
|
|
33
|
-
styleEl.textContent = `.layplux-root[data-theme='${name}'] {
|
|
34
|
-
${varLines}
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
12
|
+
const varLines = Object.entries(vars).map(([key, value]) => ` ${key}: ${value};`).join('\n');
|
|
13
|
+
styleEl.textContent = `.layplux-root[data-theme='${name}'] {\n${varLines}\n}\n`;
|
|
37
14
|
}
|
|
15
|
+
|
|
16
|
+
exports.injectThemeCSS = injectThemeCSS;
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var widget_container_exports = {};
|
|
20
|
-
__export(widget_container_exports, {
|
|
21
|
-
useWidgetContainer: () => useWidgetContainer
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(widget_container_exports);
|
|
24
|
-
var import_vue = require("vue");
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var vue = require('vue');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* handle 函数签名:把原始 item(config 或 widget)转换成 widget 实例。
|
|
7
|
+
* 第二个参数是所属 container 的引用,方便在创建 widget 时回引。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* widget container 用于管理 widget 的添加、删除、获取等操作
|
|
12
|
+
* T 为 widget 的类型
|
|
13
|
+
* G 为 widgetconfig 的配置类型
|
|
14
|
+
*/
|
|
25
15
|
function useWidgetContainer(handle, skeleton) {
|
|
26
16
|
const maps = {};
|
|
27
|
-
const items =
|
|
28
|
-
const activeId =
|
|
17
|
+
const items = vue.ref([]);
|
|
18
|
+
const activeId = vue.ref(null); // ✅ 单一数据源
|
|
19
|
+
|
|
29
20
|
const self = {
|
|
30
21
|
items,
|
|
31
22
|
activeId,
|
|
@@ -39,6 +30,7 @@ function useWidgetContainer(handle, skeleton) {
|
|
|
39
30
|
toggleActive
|
|
40
31
|
};
|
|
41
32
|
function add(item) {
|
|
33
|
+
// 将config转换为widget,将创建widget的能力交给外部,并把 container 自身传出去
|
|
42
34
|
const nItem = handle(item, self);
|
|
43
35
|
const origin = get(nItem.name);
|
|
44
36
|
if (origin === nItem) return origin;
|
|
@@ -66,23 +58,29 @@ function useWidgetContainer(handle, skeleton) {
|
|
|
66
58
|
const i = items.value.indexOf(item);
|
|
67
59
|
if (i > -1) items.value.splice(i, 1);
|
|
68
60
|
delete maps[name];
|
|
69
|
-
skeleton.event.emitGlobal(
|
|
61
|
+
skeleton.event.emitGlobal('skeleton:widget-removed', {
|
|
62
|
+
name
|
|
63
|
+
});
|
|
70
64
|
return item;
|
|
71
65
|
}
|
|
72
66
|
function activate(id) {
|
|
73
67
|
if (!maps[id]) return;
|
|
74
68
|
activeId.value = id;
|
|
75
69
|
skeleton.focus(id);
|
|
76
|
-
maps[id].focusable.active();
|
|
77
|
-
skeleton.event.emitGlobal(`widget:${id}:activated`, {
|
|
70
|
+
maps[id].focusable.active(); // 面板激活 → 同步焦点栈
|
|
71
|
+
skeleton.event.emitGlobal(`widget:${id}:activated`, {
|
|
72
|
+
widget: maps[id]
|
|
73
|
+
});
|
|
78
74
|
}
|
|
79
75
|
function deactivate() {
|
|
80
76
|
const current = activeId.value;
|
|
81
77
|
activeId.value = null;
|
|
82
78
|
skeleton.blur();
|
|
83
79
|
if (current && maps[current]) {
|
|
84
|
-
maps[current].focusable.suspense();
|
|
85
|
-
skeleton.event.emitGlobal(`widget:${current}:deactivated`, {
|
|
80
|
+
maps[current].focusable.suspense(); // 面板收起 → 从焦点栈移除
|
|
81
|
+
skeleton.event.emitGlobal(`widget:${current}:deactivated`, {
|
|
82
|
+
widget: maps[current]
|
|
83
|
+
});
|
|
86
84
|
}
|
|
87
85
|
}
|
|
88
86
|
function toggleActive(id) {
|
|
@@ -94,3 +92,5 @@ function useWidgetContainer(handle, skeleton) {
|
|
|
94
92
|
}
|
|
95
93
|
return self;
|
|
96
94
|
}
|
|
95
|
+
|
|
96
|
+
exports.useWidgetContainer = useWidgetContainer;
|