juxscript 1.1.96 → 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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "totalComponents": 63,
3
- "generatedAt": "2026-02-12T20:07:36.301Z",
3
+ "generatedAt": "2026-02-12T20:48:20.139Z",
4
4
  "components": [
5
5
  {
6
6
  "file": "alert.js",
@@ -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) juxImports.add(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 += `\nObject.assign(window, { ${[...juxImports].join(', ')} });\n`;
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`;
@@ -501,13 +529,13 @@ navigate(location.pathname);
501
529
  }
502
530
 
503
531
  // Copy all .jux and .js files from source to dist
504
- this._copySourceFilesRecursive(this.srcDir, distJuxDir, this.srcDir);
532
+ this._copySourceFilesRecursive(this.srcDir, this.srcDir, distJuxDir);
505
533
  }
506
534
 
507
535
  /**
508
536
  * Recursively copy .jux and .js files preserving folder structure
509
537
  */
510
- _copySourceFilesRecursive(src, dest, baseDir) {
538
+ _copySourceFilesRecursive(src, baseDir, distBase) {
511
539
  const entries = fs.readdirSync(src, { withFileTypes: true });
512
540
 
513
541
  entries.forEach(entry => {
@@ -515,18 +543,25 @@ navigate(location.pathname);
515
543
 
516
544
  const srcPath = path.join(src, entry.name);
517
545
  const relativePath = path.relative(baseDir, srcPath);
518
- const destPath = path.join(dest, relativePath);
546
+ const destPath = path.join(distBase, relativePath);
519
547
 
520
548
  if (entry.isDirectory()) {
521
- // Create directory and recurse
549
+ // Create directory if it doesn't exist
522
550
  if (!fs.existsSync(destPath)) {
523
551
  fs.mkdirSync(destPath, { recursive: true });
524
552
  }
525
- this._copySourceFilesRecursive(srcPath, dest, baseDir);
553
+ // Recurse into subdirectory
554
+ this._copySourceFilesRecursive(srcPath, baseDir, distBase);
526
555
  } else if (entry.name.endsWith('.jux') || entry.name.endsWith('.js')) {
527
- // Copy .jux and .js files
556
+ // Copy .jux and .js files (skip assets)
528
557
  if (!this.isAssetFile(entry.name)) {
558
+ // Ensure parent directory exists
559
+ const destDir = path.dirname(destPath);
560
+ if (!fs.existsSync(destDir)) {
561
+ fs.mkdirSync(destDir, { recursive: true });
562
+ }
529
563
  fs.copyFileSync(srcPath, destPath);
564
+ console.log(` 📋 Copied: ${relativePath}`);
530
565
  }
531
566
  }
532
567
  });
@@ -557,6 +592,7 @@ navigate(location.pathname);
557
592
  // ✅ Copy source files to dist/jux BEFORE generating entry point
558
593
  console.log('📋 Copying source files to dist...');
559
594
  this._copySourceToDist();
595
+ console.log('✅ Source files copied\n');
560
596
 
561
597
  // Generate entry point
562
598
  const entryCode = this.generateEntryPoint(views, dataModules, sharedModules);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.96",
3
+ "version": "1.1.98",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "index.js",