slicejs-web-framework 2.4.1 → 2.4.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.
|
@@ -83,9 +83,9 @@ export default class Controller {
|
|
|
83
83
|
const bundleModule = await import(bundlePath);
|
|
84
84
|
|
|
85
85
|
// Manually register components from the imported bundle
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
if (bundleModule.SLICE_BUNDLE) {
|
|
87
|
+
await this.registerBundle(bundleModule.SLICE_BUNDLE);
|
|
88
|
+
}
|
|
89
89
|
|
|
90
90
|
this.loadedBundles.add(bundleName);
|
|
91
91
|
} catch (error) {
|
|
@@ -288,11 +288,11 @@ export default class Controller {
|
|
|
288
288
|
/**
|
|
289
289
|
* 📦 New bundle registration method (simplified and robust)
|
|
290
290
|
*/
|
|
291
|
-
|
|
291
|
+
registerBundle(bundle) {
|
|
292
292
|
const validation = this.validateBundle(bundle);
|
|
293
293
|
if (!validation.isValid) {
|
|
294
294
|
console.warn(`❌ Bundle validation failed: ${validation.error}`);
|
|
295
|
-
return;
|
|
295
|
+
return Promise.resolve(false);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
const { components, metadata } = bundle;
|
|
@@ -303,8 +303,9 @@ export default class Controller {
|
|
|
303
303
|
const chunkSize = 50;
|
|
304
304
|
let index = 0;
|
|
305
305
|
|
|
306
|
-
|
|
307
|
-
const
|
|
306
|
+
return new Promise((resolve) => {
|
|
307
|
+
const processChunk = () => {
|
|
308
|
+
const sliceEntries = entries.slice(index, index + chunkSize);
|
|
308
309
|
|
|
309
310
|
for (const [componentName, componentData] of sliceEntries) {
|
|
310
311
|
try {
|
|
@@ -321,31 +322,41 @@ export default class Controller {
|
|
|
321
322
|
}
|
|
322
323
|
}
|
|
323
324
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
325
|
+
if (componentData.class && !this.classes.has(componentName)) {
|
|
326
|
+
const registeredName = componentData.isFramework
|
|
327
|
+
? `Framework/Structural/${componentName}`
|
|
328
|
+
: componentName;
|
|
329
|
+
this.classes.set(registeredName, componentData.class);
|
|
330
|
+
if (componentName === 'InputSearchDocs' || componentName === 'MainMenu') {
|
|
331
|
+
console.log(`🔎 Bundle class registered: ${componentName}`, {
|
|
332
|
+
registeredName,
|
|
333
|
+
type: typeof componentData.class,
|
|
334
|
+
isFunction: typeof componentData.class === 'function'
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
330
338
|
} catch (error) {
|
|
331
339
|
console.warn(`❌ Failed to register component ${componentName}:`, error);
|
|
332
340
|
}
|
|
333
341
|
}
|
|
334
342
|
|
|
335
343
|
index += chunkSize;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
if (index < entries.length) {
|
|
345
|
+
if (typeof requestIdleCallback === 'function') {
|
|
346
|
+
requestIdleCallback(processChunk);
|
|
347
|
+
} else {
|
|
348
|
+
setTimeout(processChunk, 0);
|
|
349
|
+
}
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
344
352
|
|
|
345
|
-
|
|
353
|
+
console.log(`✅ Bundle registration completed: ${metadata.componentCount} components processed`);
|
|
354
|
+
resolve(true);
|
|
355
|
+
};
|
|
346
356
|
|
|
347
|
-
|
|
348
|
-
|
|
357
|
+
processChunk();
|
|
358
|
+
});
|
|
359
|
+
}
|
|
349
360
|
|
|
350
361
|
/**
|
|
351
362
|
* Validates bundle structure before registering.
|
package/Slice/Slice.js
CHANGED
|
@@ -156,8 +156,15 @@ export default class Slice {
|
|
|
156
156
|
delete props.id;
|
|
157
157
|
delete props.sliceId;
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
const ComponentClass = this.controller.classes.get(componentName);
|
|
160
|
+
if (componentName === 'InputSearchDocs' || componentName === 'MainMenu') {
|
|
161
|
+
console.log(`🔎 Build component: ${componentName}`, {
|
|
162
|
+
classType: typeof ComponentClass,
|
|
163
|
+
isFunction: typeof ComponentClass === 'function',
|
|
164
|
+
classValue: ComponentClass
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const componentInstance = new ComponentClass(props);
|
|
161
168
|
|
|
162
169
|
if (componentIds.id && isVisual) componentInstance.id = componentIds.id;
|
|
163
170
|
if (componentIds.sliceId) componentInstance.sliceId = componentIds.sliceId;
|