juxscript 1.1.97 → 1.1.98
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/dom-structure-map.json +1 -1
- package/machinery/compiler3.js +30 -2
- package/package.json +1 -1
package/dom-structure-map.json
CHANGED
package/machinery/compiler3.js
CHANGED
|
@@ -250,18 +250,36 @@ export class JuxCompiler {
|
|
|
250
250
|
const sourceSnapshot = {};
|
|
251
251
|
|
|
252
252
|
const juxImports = new Set();
|
|
253
|
+
const layoutImports = new Set(); // ✅ Track layout imports separately
|
|
254
|
+
|
|
255
|
+
// Scan for imports
|
|
253
256
|
[...views, ...dataModules, ...sharedModules].forEach(m => {
|
|
257
|
+
// Regular juxscript imports
|
|
254
258
|
for (const match of m.content.matchAll(/import\s*\{\s*([^}]+)\s*\}\s*from\s*['"]juxscript['"]/g)) {
|
|
255
259
|
match[1].split(',').map(s => s.trim()).forEach(imp => {
|
|
256
|
-
if (imp)
|
|
260
|
+
if (imp) {
|
|
261
|
+
// ✅ Separate layout imports
|
|
262
|
+
if (imp === 'VStack' || imp === 'HStack' || imp === 'ZStack') {
|
|
263
|
+
layoutImports.add(imp);
|
|
264
|
+
} else {
|
|
265
|
+
juxImports.add(imp);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
257
268
|
});
|
|
258
269
|
}
|
|
259
270
|
});
|
|
260
271
|
|
|
272
|
+
// ✅ Import layouts separately
|
|
273
|
+
if (layoutImports.size > 0) {
|
|
274
|
+
entry += `import { ${[...layoutImports].sort().join(', ')} } from 'juxscript';\n`;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ✅ Import regular components
|
|
261
278
|
if (juxImports.size > 0) {
|
|
262
279
|
entry += `import { ${[...juxImports].sort().join(', ')} } from 'juxscript';\n\n`;
|
|
263
280
|
}
|
|
264
281
|
|
|
282
|
+
// Data and shared modules
|
|
265
283
|
dataModules.forEach(m => {
|
|
266
284
|
entry += `import * as ${this.sanitizeName(m.name)}Data from './jux/${m.file}';\n`;
|
|
267
285
|
});
|
|
@@ -273,8 +291,18 @@ export class JuxCompiler {
|
|
|
273
291
|
dataModules.forEach(m => entry += `Object.assign(window, ${this.sanitizeName(m.name)}Data);\n`);
|
|
274
292
|
sharedModules.forEach(m => entry += `Object.assign(window, ${this.sanitizeName(m.name)}Shared);\n`);
|
|
275
293
|
|
|
294
|
+
// ✅ Expose layouts to window
|
|
295
|
+
if (layoutImports.size > 0) {
|
|
296
|
+
entry += `\n// Expose layout components\n`;
|
|
297
|
+
layoutImports.forEach(layout => {
|
|
298
|
+
entry += `window.${layout} = ${layout};\n`;
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ✅ Expose regular components
|
|
276
303
|
if (juxImports.size > 0) {
|
|
277
|
-
entry += `\
|
|
304
|
+
entry += `\n// Expose components\n`;
|
|
305
|
+
entry += `Object.assign(window, { ${[...juxImports].join(', ')} });\n`;
|
|
278
306
|
}
|
|
279
307
|
|
|
280
308
|
entry += `\n// --- VIEW FUNCTIONS ---\n`;
|