@vc-shell/framework 1.1.82 → 1.1.83
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/CHANGELOG.md +27 -0
- package/core/api/virtocommerce.platform.ts +10457 -0
- package/core/plugins/extension-points/ExtensionSlot.vue +23 -0
- package/core/plugins/extension-points/README.md +406 -0
- package/core/plugins/extension-points/index.ts +8 -0
- package/core/plugins/extension-points/migration-examples.md +613 -0
- package/core/plugins/extension-points/simple-extensions.ts +148 -0
- package/core/plugins/index.ts +1 -0
- package/core/plugins/modularity/loader.ts +2 -2
- package/dist/core/api/virtocommerce.platform.d.ts +2442 -0
- package/dist/core/api/virtocommerce.platform.d.ts.map +1 -0
- package/dist/core/plugins/extension-points/ExtensionSlot.vue.d.ts +6 -0
- package/dist/core/plugins/extension-points/ExtensionSlot.vue.d.ts.map +1 -0
- package/dist/core/plugins/extension-points/index.d.ts +3 -0
- package/dist/core/plugins/extension-points/index.d.ts.map +1 -0
- package/dist/core/plugins/extension-points/simple-extensions.d.ts +29 -0
- package/dist/core/plugins/extension-points/simple-extensions.d.ts.map +1 -0
- package/dist/core/plugins/index.d.ts +1 -0
- package/dist/core/plugins/index.d.ts.map +1 -1
- package/dist/framework.js +5104 -5031
- package/dist/locales/de.json +1 -0
- package/dist/locales/en.json +1 -0
- package/dist/shared/components/notification-template/notification-template.vue.d.ts +8 -1
- package/dist/shared/components/notification-template/notification-template.vue.d.ts.map +1 -1
- package/dist/shared/composables/useModificationTracker/index.d.ts +5 -0
- package/dist/shared/composables/useModificationTracker/index.d.ts.map +1 -1
- package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts +5 -1
- package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +10 -5
- package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/components/notification-template/notification-template.vue +5 -1
- package/shared/composables/useModificationTracker/index.ts +6 -0
- package/shared/pages/LoginPage/components/login/Login.vue +30 -34
- package/ui/components/molecules/vc-form/vc-form.vue +11 -3
- package/ui/components/molecules/vc-select/vc-select.vue +1 -2
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ref, reactive, computed, type Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
// Base types for the extension system
|
|
4
|
+
export interface ExtensionComponent {
|
|
5
|
+
id: string;
|
|
6
|
+
component: Component;
|
|
7
|
+
props?: Record<string, unknown>;
|
|
8
|
+
priority?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Global state for all extensions
|
|
12
|
+
const extensionSlots = reactive<Record<string, ExtensionComponent[]>>({});
|
|
13
|
+
const extensionData = reactive<Record<string, any>>({});
|
|
14
|
+
|
|
15
|
+
// Composable for working with extension slots
|
|
16
|
+
export function useExtensionSlot(slotName: string) {
|
|
17
|
+
// Initialize slot if it doesn't exist
|
|
18
|
+
if (!extensionSlots[slotName]) {
|
|
19
|
+
extensionSlots[slotName] = [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Reactive list of components in slot, sorted by priority
|
|
23
|
+
const components = computed(() => {
|
|
24
|
+
return extensionSlots[slotName]?.slice().sort((a, b) => (a.priority || 0) - (b.priority || 0)) || [];
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Add component to slot
|
|
28
|
+
const addComponent = (component: ExtensionComponent) => {
|
|
29
|
+
const existingIndex = extensionSlots[slotName].findIndex(c => c.id === component.id);
|
|
30
|
+
|
|
31
|
+
if (existingIndex !== -1) {
|
|
32
|
+
// Replace existing component
|
|
33
|
+
extensionSlots[slotName][existingIndex] = component;
|
|
34
|
+
} else {
|
|
35
|
+
// Add new component
|
|
36
|
+
extensionSlots[slotName].push(component);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// Remove component from slot
|
|
41
|
+
const removeComponent = (componentId: string) => {
|
|
42
|
+
const index = extensionSlots[slotName].findIndex(c => c.id === componentId);
|
|
43
|
+
if (index !== -1) {
|
|
44
|
+
extensionSlots[slotName].splice(index, 1);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Check if slot has components
|
|
49
|
+
const hasComponents = computed(() => components.value.length > 0);
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
components,
|
|
53
|
+
addComponent,
|
|
54
|
+
removeComponent,
|
|
55
|
+
hasComponents,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Composable for data exchange between modules
|
|
60
|
+
export function useExtensionData(namespace: string) {
|
|
61
|
+
// Initialize namespace if it doesn't exist
|
|
62
|
+
if (!extensionData[namespace]) {
|
|
63
|
+
extensionData[namespace] = {};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Reactive data
|
|
67
|
+
const data = computed(() => extensionData[namespace] || {});
|
|
68
|
+
|
|
69
|
+
// Update data (merge)
|
|
70
|
+
const updateData = (newData: Record<string, any>) => {
|
|
71
|
+
extensionData[namespace] = {
|
|
72
|
+
...extensionData[namespace],
|
|
73
|
+
...newData,
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Set data (replace)
|
|
78
|
+
const setData = (newData: Record<string, any>) => {
|
|
79
|
+
extensionData[namespace] = newData;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Get specific value
|
|
83
|
+
const getValue = (key: string, defaultValue?: any) => {
|
|
84
|
+
return extensionData[namespace]?.[key] ?? defaultValue;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Set specific value
|
|
88
|
+
const setValue = (key: string, value: any) => {
|
|
89
|
+
if (!extensionData[namespace]) {
|
|
90
|
+
extensionData[namespace] = {};
|
|
91
|
+
}
|
|
92
|
+
extensionData[namespace][key] = value;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
data,
|
|
97
|
+
updateData,
|
|
98
|
+
setData,
|
|
99
|
+
getValue,
|
|
100
|
+
setValue,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Composable for global extension management
|
|
105
|
+
export function useExtensions() {
|
|
106
|
+
// Get all slots
|
|
107
|
+
const getAllSlots = () => {
|
|
108
|
+
return Object.keys(extensionSlots);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Get components from specific slot
|
|
112
|
+
const getSlotComponents = (slotName: string) => {
|
|
113
|
+
return extensionSlots[slotName] || [];
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Get all data
|
|
117
|
+
const getAllData = () => {
|
|
118
|
+
return extensionData;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// Get data from specific namespace
|
|
122
|
+
const getNamespaceData = (namespace: string) => {
|
|
123
|
+
return extensionData[namespace] || {};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// Clear slot
|
|
127
|
+
const clearSlot = (slotName: string) => {
|
|
128
|
+
if (extensionSlots[slotName]) {
|
|
129
|
+
extensionSlots[slotName].length = 0;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// Clear data namespace
|
|
134
|
+
const clearData = (namespace: string) => {
|
|
135
|
+
if (extensionData[namespace]) {
|
|
136
|
+
delete extensionData[namespace];
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
getAllSlots,
|
|
142
|
+
getSlotComponents,
|
|
143
|
+
getAllData,
|
|
144
|
+
getNamespaceData,
|
|
145
|
+
clearSlot,
|
|
146
|
+
clearData,
|
|
147
|
+
};
|
|
148
|
+
}
|
package/core/plugins/index.ts
CHANGED
|
@@ -148,7 +148,7 @@ function checkVersionCompatibility(
|
|
|
148
148
|
|
|
149
149
|
if (
|
|
150
150
|
moduleVersion.compatibleWith.framework &&
|
|
151
|
-
!semver.satisfies(frameworkVersion, moduleVersion.compatibleWith.framework)
|
|
151
|
+
!semver.satisfies(frameworkVersion, moduleVersion.compatibleWith.framework, { includePrerelease: true })
|
|
152
152
|
) {
|
|
153
153
|
console.error(
|
|
154
154
|
`Module ${moduleId} requires framework version ${moduleVersion.compatibleWith.framework}, but current framework version is ${frameworkVersion}.`,
|
|
@@ -172,7 +172,7 @@ function checkVersionCompatibility(
|
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
if (!semver.satisfies(loadedDepVersion, versionRange)) {
|
|
175
|
+
if (!semver.satisfies(loadedDepVersion, versionRange, { includePrerelease: true })) {
|
|
176
176
|
console.error(
|
|
177
177
|
`Module ${moduleId} requires ${depModuleId} version ${versionRange}, but loaded version is ${loadedDepVersion}.`,
|
|
178
178
|
);
|