@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.
Files changed (38) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/core/api/virtocommerce.platform.ts +10457 -0
  3. package/core/plugins/extension-points/ExtensionSlot.vue +23 -0
  4. package/core/plugins/extension-points/README.md +406 -0
  5. package/core/plugins/extension-points/index.ts +8 -0
  6. package/core/plugins/extension-points/migration-examples.md +613 -0
  7. package/core/plugins/extension-points/simple-extensions.ts +148 -0
  8. package/core/plugins/index.ts +1 -0
  9. package/core/plugins/modularity/loader.ts +2 -2
  10. package/dist/core/api/virtocommerce.platform.d.ts +2442 -0
  11. package/dist/core/api/virtocommerce.platform.d.ts.map +1 -0
  12. package/dist/core/plugins/extension-points/ExtensionSlot.vue.d.ts +6 -0
  13. package/dist/core/plugins/extension-points/ExtensionSlot.vue.d.ts.map +1 -0
  14. package/dist/core/plugins/extension-points/index.d.ts +3 -0
  15. package/dist/core/plugins/extension-points/index.d.ts.map +1 -0
  16. package/dist/core/plugins/extension-points/simple-extensions.d.ts +29 -0
  17. package/dist/core/plugins/extension-points/simple-extensions.d.ts.map +1 -0
  18. package/dist/core/plugins/index.d.ts +1 -0
  19. package/dist/core/plugins/index.d.ts.map +1 -1
  20. package/dist/framework.js +5104 -5031
  21. package/dist/locales/de.json +1 -0
  22. package/dist/locales/en.json +1 -0
  23. package/dist/shared/components/notification-template/notification-template.vue.d.ts +8 -1
  24. package/dist/shared/components/notification-template/notification-template.vue.d.ts.map +1 -1
  25. package/dist/shared/composables/useModificationTracker/index.d.ts +5 -0
  26. package/dist/shared/composables/useModificationTracker/index.d.ts.map +1 -1
  27. package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts +5 -1
  30. package/dist/ui/components/molecules/vc-form/vc-form.vue.d.ts.map +1 -1
  31. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts +10 -5
  32. package/dist/ui/components/molecules/vc-select/vc-select.vue.d.ts.map +1 -1
  33. package/package.json +4 -4
  34. package/shared/components/notification-template/notification-template.vue +5 -1
  35. package/shared/composables/useModificationTracker/index.ts +6 -0
  36. package/shared/pages/LoginPage/components/login/Login.vue +30 -34
  37. package/ui/components/molecules/vc-form/vc-form.vue +11 -3
  38. 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
+ }
@@ -4,3 +4,4 @@ export * from "./validation";
4
4
  export * from "./modularity";
5
5
  export * from "./signalR";
6
6
  export * from "./permissions";
7
+ export * from "./extension-points";
@@ -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
  );