@getcortexlabs/create-mavis 0.1.0-rc.13 → 0.1.0-rc.15

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 (80) hide show
  1. package/README.md +44 -7
  2. package/package.json +4 -2
  3. package/src/adapters.mjs +56 -20
  4. package/src/add-desktop.mjs +308 -0
  5. package/src/add-macos.mjs +386 -0
  6. package/src/capabilities.mjs +352 -85
  7. package/src/cli.mjs +181 -9
  8. package/src/desktop.mjs +155 -0
  9. package/src/doctor.mjs +181 -18
  10. package/src/macos-capabilities.generated.mjs +4190 -0
  11. package/src/macos.mjs +147 -29
  12. package/src/migrate-directory.mjs +121 -0
  13. package/src/native-framework.mjs +144 -0
  14. package/src/portability.mjs +123 -5
  15. package/src/scaffold.mjs +59 -11
  16. package/src/ui.mjs +69 -12
  17. package/templates/desktop/common/LICENSE +21 -0
  18. package/templates/desktop/common/build.mjs +58 -0
  19. package/templates/desktop/common/src/components.ts +60 -0
  20. package/templates/desktop/common/src/contract.mjs +35 -0
  21. package/templates/desktop/common/src/renderer.ts +76 -0
  22. package/templates/desktop/common/src/storage.ts +29 -0
  23. package/templates/desktop/directory/main.ts +35 -0
  24. package/templates/desktop/macos/launch.mjs +6 -0
  25. package/templates/desktop/macos/package.mjs +114 -0
  26. package/templates/desktop/macos/src/host.mjs +468 -0
  27. package/templates/desktop/macos/src/motion.mjs +51 -0
  28. package/templates/desktop/welcome/Welcome.vue +56 -0
  29. package/templates/desktop/welcome/main.ts +24 -0
  30. package/templates/desktop/windows/NativeScript-LICENSE +19 -0
  31. package/templates/desktop/windows/launch.mjs +16 -0
  32. package/templates/desktop/windows/package.mjs +54 -0
  33. package/templates/desktop/windows/prepare-host.mjs +73 -0
  34. package/templates/desktop/windows/src/host.mjs +277 -0
  35. package/templates/directory/host/directory-storage.ts +78 -0
  36. package/templates/directory/macos/DirectoryStorage.swift +68 -0
  37. package/templates/directory/mobile/src/app.ts +11 -8
  38. package/templates/directory/nuxt/app/plugins/mavis.ts +11 -8
  39. package/templates/directory/shared/Edit.vue +8 -5
  40. package/templates/directory/shared/directory-store.ts +42 -46
  41. package/templates/directory/vite/src/main.ts +11 -8
  42. package/templates/macos/examples/tasks/shared/TaskDetail.lite.tsx +2 -2
  43. package/templates/macos/examples/tasks/shared/Tasks.lite.tsx +2 -2
  44. package/templates/macos/examples/tasks/shared/types.ts +1 -0
  45. package/templates/macos/mobile/src/App.vue +4 -2
  46. package/templates/macos/native/Package.swift +3 -1
  47. package/templates/macos/native/Sources/MavisDesktop/App.swift +26 -11
  48. package/templates/macos/native/Sources/MavisDesktop/Fonts/LICENSE +45 -0
  49. package/templates/macos/native/Sources/MavisDesktop/Fonts/lucide.ttf +0 -0
  50. package/templates/macos/scripts/generate.mjs +3 -26
  51. package/templates/macos/scripts/macos-manifest.mjs +33 -0
  52. package/templates/macos/scripts/macos.mjs +20 -18
  53. package/templates/macos/web/index.html +1 -1
  54. package/templates/macos/web/src/main.js +176 -3
  55. package/templates/macos/web/src/mavis.js +2 -0
  56. package/templates/macos/web/src/style.css +2 -1
  57. package/templates/macos/web/vite.config.mjs +12 -1
  58. package/templates/migrations/directory-rc13.json +36 -0
  59. package/templates/mobile/src/mavis.ts +2 -82
  60. package/templates/mobile/webpack.config.js +4 -0
  61. package/templates/native-framework/angular/screen.ts +84 -0
  62. package/templates/native-framework/common/nativescript.config.ts +6 -0
  63. package/templates/native-framework/common/src/app.ts +5 -0
  64. package/templates/native-framework/common/src/model.ts +40 -0
  65. package/templates/native-framework/common/src/references.d.ts +8 -0
  66. package/templates/native-framework/common/tsconfig.json +16 -0
  67. package/templates/native-framework/common/webpack.config.js +67 -0
  68. package/templates/native-framework/plain/screen.ts +102 -0
  69. package/templates/native-framework/react/screen.ts +83 -0
  70. package/templates/native-framework/solid/screen.ts +111 -0
  71. package/templates/native-framework/svelte/Welcome.svelte +26 -0
  72. package/templates/native-framework/svelte/screen.ts +14 -0
  73. package/templates/native-framework/svelte-tooling/svelte.config.js +20 -0
  74. package/templates/nuxt/app/mavis.ts +2 -84
  75. package/templates/vite/src/mavis.ts +2 -84
  76. package/templates/macos/scripts/portable/emit-swift.mjs +0 -1287
  77. package/templates/macos/scripts/portable/emit-vue.mjs +0 -615
  78. package/templates/macos/scripts/portable/index.mjs +0 -95
  79. package/templates/macos/scripts/portable/model.mjs +0 -1441
  80. package/templates/macos/scripts/portable/program.mjs +0 -163
@@ -1,4 +1,6 @@
1
+ import { desktopComponents } from '../templates/desktop/common/src/contract.mjs'
1
2
  import { adapters } from './adapters.mjs'
3
+ import { macosCapabilities } from './macos-capabilities.generated.mjs'
2
4
 
3
5
  /** Shape of `--capabilities --json`, for tools that read it. */
4
6
  export const catalogVersion = 1
@@ -7,8 +9,8 @@ export const schemaVersion = 2
7
9
 
8
10
  /** Baseline pins; coordinated releases update Mavis after validating source templates with matching tarballs. */
9
11
  export const versions = Object.freeze({
10
- mavis: '0.1.0-rc.13',
11
- jolt: '0.1.0-rc.13',
12
+ mavis: '0.1.0-rc.15',
13
+ jolt: '0.1.0-rc.17',
12
14
  vue: '3.5.44',
13
15
  nuxt: '4.6.3',
14
16
  vite: '6.4.5',
@@ -16,7 +18,7 @@ export const versions = Object.freeze({
16
18
  typescript: '6.0.3',
17
19
  nodeTypes: '26.6.6',
18
20
  vueTsc: '3.3.13',
19
- nativeCore: '9.1.3',
21
+ nativeCore: '9.1.4',
20
22
  nativeVue: '3.1.3',
21
23
  android: '9.1.1',
22
24
  ios: '9.1.0',
@@ -24,7 +26,10 @@ export const versions = Object.freeze({
24
26
  webpackCore: '5.112.2',
25
27
  webpackCli: '6.0.1',
26
28
  router: '4.6.4',
27
- nativeRouter: '0.1.0-rc.4',
29
+ nativeRouter: '0.1.0',
30
+ macosNodeApi: '0.5.0-beta.0',
31
+ windowsNapi: '1.0.0-beta.20',
32
+ esbuild: '0.25.12',
28
33
  })
29
34
 
30
35
  /** Tools a project needs. The creator and doctor check against these, not their own numbers. */
@@ -32,7 +37,9 @@ export const requirements = Object.freeze({
32
37
  node: '22.16',
33
38
  packageManagers: Object.freeze({ npm: null, pnpm: '10.26', yarn: null }),
34
39
  native: 'the NativeScript CLI, a JDK and the Android SDK; macOS and Xcode for iOS',
35
- macos: 'macOS 14+ and Xcode',
40
+ macos: 'macOS 13.3+ on Apple Silicon, Node 22.23.3+; Xcode command line tools for packaging',
41
+ swiftui: 'macOS 14+ and Xcode',
42
+ windows: 'Windows 10 build 18362+ (x64/arm64), Node 22.23.3+ and Windows SDK Manifest Tool',
36
43
  })
37
44
 
38
45
  const issueOf = (id) => adapters.planned.find((adapter) => adapter.id === id)?.issue
@@ -62,21 +69,69 @@ export const catalog = Object.freeze({
62
69
  },
63
70
  macos: {
64
71
  label: 'Mac',
65
- hint: 'A SwiftUI app · experimental shared TSX',
66
- toolkit: 'swiftui',
67
- adapter: null,
72
+ hint: 'NativeScript AppKit · SwiftUI also available (experimental)',
73
+ toolkit: 'nativescript-appkit',
74
+ adapter: 'vue-appkit',
75
+ runtimes: ['appkit', 'swiftui'],
68
76
  status: 'experimental',
69
77
  },
78
+ windows: {
79
+ label: 'Windows',
80
+ hint: 'NativeScript XAML Islands (experimental)',
81
+ toolkit: 'nativescript-xaml',
82
+ adapter: 'vue-windows',
83
+ status: 'experimental',
84
+ },
85
+ }),
86
+ macosRuntimes: Object.freeze({
87
+ appkit: { label: 'NativeScript AppKit', hint: 'Vue runs directly with native AppKit controls' },
88
+ swiftui: { label: 'SwiftUI', hint: 'Compile shared Vue or TSX to Swift · existing pipeline' },
70
89
  }),
71
90
  frameworks: Object.freeze({
72
91
  vue: { label: 'Vue', status: 'validated' },
73
- react: planned(issueOf('react-web'), 'React'),
74
- angular: planned(issueOf('angular-web'), 'Angular'),
75
- svelte: planned(issueOf('svelte-web'), 'Svelte'),
76
- solid: planned(issueOf('solid-web'), 'Solid'),
92
+ plain: {
93
+ label: 'JavaScript / TypeScript',
94
+ status: 'experimental',
95
+ targets: ['native'],
96
+ since: '0.1.0-rc.15',
97
+ },
98
+ react: {
99
+ label: 'React',
100
+ status: 'experimental',
101
+ targets: ['native'],
102
+ since: '0.1.0-rc.15',
103
+ webIssue: issueOf('react-web'),
104
+ },
105
+ angular: {
106
+ label: 'Angular',
107
+ status: 'experimental',
108
+ targets: ['native'],
109
+ since: '0.1.0-rc.15',
110
+ webIssue: issueOf('angular-web'),
111
+ },
112
+ svelte: {
113
+ label: 'Svelte',
114
+ status: 'experimental',
115
+ targets: ['native'],
116
+ since: '0.1.0-rc.15',
117
+ webIssue: issueOf('svelte-web'),
118
+ },
119
+ solid: {
120
+ label: 'Solid',
121
+ status: 'experimental',
122
+ targets: ['native'],
123
+ since: '0.1.0-rc.15',
124
+ webIssue: issueOf('solid-web'),
125
+ },
77
126
  }),
78
127
  // How screens are written, and what runs: the components directly, or code generated from them.
79
128
  authoring: Object.freeze({
129
+ native: {
130
+ label: 'Direct framework components',
131
+ mode: 'direct',
132
+ execution: 'components',
133
+ status: 'experimental',
134
+ },
80
135
  vue: { label: 'Vue templates', mode: 'direct', execution: 'components', status: 'validated' },
81
136
  mitosis: {
82
137
  label: 'Shared TSX',
@@ -103,6 +158,7 @@ export const catalog = Object.freeze({
103
158
  hint: 'Server rendering or a static website',
104
159
  rendering: ['ssr', 'ssg'],
105
160
  status: 'validated',
161
+ portableSince: '0.1.0-rc.14',
106
162
  },
107
163
  next: planned(issueOf('next'), 'Next.js'),
108
164
  }),
@@ -115,13 +171,15 @@ export const catalog = Object.freeze({
115
171
  welcome: {
116
172
  label: 'Basic project',
117
173
  hint: 'One shared screen to build on',
118
- authoring: ['vue', 'mitosis'],
174
+ authoring: ['vue', 'mitosis', 'native'],
119
175
  since: '0.1.0-alpha.6',
120
176
  },
121
177
  directory: {
122
178
  label: 'Search, details and editing',
123
179
  hint: 'Shared routes, forms and local persistence',
124
180
  authoring: ['vue'],
181
+ portableAuthoring: 'vue',
182
+ portableSince: '0.1.0-rc.14',
125
183
  since: '0.1.0-alpha.9',
126
184
  },
127
185
  tasks: {
@@ -141,7 +199,7 @@ export const catalog = Object.freeze({
141
199
  })
142
200
 
143
201
  /** The combinations of targets the creator scaffolds, and how each has been validated. */
144
- export const combinations = Object.freeze([
202
+ const swiftCombinations = [
145
203
  { targets: ['web'], authoring: 'vue', status: 'validated', since: '0.1.0-alpha.6' },
146
204
  { targets: ['native'], authoring: 'vue', status: 'validated', since: '0.1.0-alpha.6' },
147
205
  { targets: ['web', 'native'], authoring: 'vue', status: 'validated', since: '0.1.0-alpha.6' },
@@ -164,6 +222,30 @@ export const combinations = Object.freeze([
164
222
  status: 'experimental',
165
223
  since: '0.1.0-rc.13',
166
224
  },
225
+ ]
226
+
227
+ export const combinations = Object.freeze([
228
+ ...['plain', 'react', 'angular', 'svelte', 'solid'].map((framework) => ({
229
+ targets: ['native'],
230
+ framework,
231
+ authoring: 'native',
232
+ status: 'experimental',
233
+ since: '0.1.0-rc.15',
234
+ })),
235
+ ...swiftCombinations.map((entry) =>
236
+ entry.targets.includes('macos') ? { ...entry, macosRuntime: 'swiftui' } : entry,
237
+ ),
238
+ ...Array.from({ length: 15 }, (_, i) =>
239
+ ['web', 'native', 'macos', 'windows'].filter((_, bit) => (i + 1) & (1 << bit)),
240
+ )
241
+ .filter((targets) => targets.includes('macos') || targets.includes('windows'))
242
+ .map((targets) => ({
243
+ targets,
244
+ authoring: 'vue',
245
+ macosRuntime: targets.includes('macos') ? 'appkit' : undefined,
246
+ status: 'experimental',
247
+ since: '0.1.0-rc.15',
248
+ })),
167
249
  ])
168
250
 
169
251
  export const targetNames = Object.freeze(Object.keys(catalog.targets))
@@ -217,7 +299,7 @@ export function parseTargets(value) {
217
299
  reject({
218
300
  code: 'unknown',
219
301
  option: '--targets',
220
- message: `Targets are a comma-separated list of web, native and macos, for example --targets web,native,macos.`,
302
+ message: `Targets are a comma-separated list of web, native, macos and windows, for example --targets macos,windows.`,
221
303
  })
222
304
  return targetNames.filter((name) => list.includes(name))
223
305
  }
@@ -231,7 +313,9 @@ export function projectTargets(config) {
231
313
  }
232
314
 
233
315
  // The scaffold each combination uses. Combinations with Mac share TSX sources.
234
- export function layoutOf(targets) {
316
+ export function layoutOf(targets, macosRuntime = 'swiftui') {
317
+ if (targets.includes('windows') || (targets.includes('macos') && macosRuntime === 'appkit'))
318
+ return 'desktop'
235
319
  if (targets.includes('macos')) return 'macos'
236
320
  if (targets.length === 2) return 'both'
237
321
  return targets[0] === 'native' ? 'mobile' : 'web'
@@ -248,9 +332,27 @@ export function chosenTargets(options) {
248
332
  }
249
333
 
250
334
  /** Published and validated, published as an experiment, or only in the repository so far. */
251
- export function availabilityOf({ targets, example }) {
252
- const combination = combinations.find((entry) => entry.targets.join() === targets.join())
253
- if (combination.since === null || catalog.examples[example].since === null) return 'repository'
335
+ export function availabilityOf({
336
+ targets,
337
+ example,
338
+ web,
339
+ macosRuntime = 'swiftui',
340
+ framework = 'vue',
341
+ }) {
342
+ const combination = combinations.find(
343
+ (entry) =>
344
+ entry.targets.join() === targets.join() &&
345
+ (entry.framework ?? 'vue') === framework &&
346
+ (!entry.macosRuntime || entry.macosRuntime === macosRuntime),
347
+ )
348
+ if (!combination) return 'repository'
349
+ if (
350
+ combination.since === null ||
351
+ catalog.examples[example].since === null ||
352
+ (targets.includes('macos') && catalog.examples[example].portableSince === null) ||
353
+ (targets.includes('macos') && web && catalog.hosts[web]?.portableSince === null)
354
+ )
355
+ return 'repository'
254
356
  return combination.status === 'validated' ? 'published' : 'published-experimental'
255
357
  }
256
358
  const availabilityLabels = {
@@ -261,13 +363,22 @@ const availabilityLabels = {
261
363
  export const availabilityLabel = (availability) => availabilityLabels[availability]
262
364
 
263
365
  // One entry per target: what renders it and how. Vue runs the Web and Native apps today.
264
- function appsOf({ targets, framework, web, rendering }) {
366
+ function appsOf({ targets, framework, web, rendering, macosRuntime = 'swiftui' }) {
265
367
  return Object.fromEntries(
266
368
  targets.map((target) => {
267
369
  const { toolkit, platforms } = catalog.targets[target]
268
370
  if (target === 'web') return [target, { toolkit, framework, host: web, rendering }]
269
371
  if (target === 'native') return [target, { toolkit, framework, platforms: [...platforms] }]
270
- return [target, { toolkit, framework: null }]
372
+ return [
373
+ target,
374
+ target === 'macos' && macosRuntime === 'swiftui'
375
+ ? { toolkit: 'swiftui', framework: null }
376
+ : {
377
+ toolkit,
378
+ framework,
379
+ runtime: target === 'macos' ? versions.macosNodeApi : versions.windowsNapi,
380
+ },
381
+ ]
271
382
  }),
272
383
  )
273
384
  }
@@ -296,7 +407,30 @@ export function resolvePreset(options) {
296
407
  })
297
408
  targets = [...legacyTargets[options.target ?? 'web']]
298
409
  }
299
- const target = layoutOf(targets)
410
+ const macosRuntime =
411
+ options.macosRuntime ??
412
+ options['macos-runtime'] ??
413
+ (options.target === 'macos' ? 'swiftui' : 'appkit')
414
+ if (!catalog.macosRuntimes[macosRuntime])
415
+ reject({
416
+ code: 'unknown',
417
+ option: '--macos-runtime',
418
+ message: 'Mac runtime must be appkit or swiftui.',
419
+ })
420
+ if ((options.macosRuntime || options['macos-runtime']) && !targets.includes('macos'))
421
+ reject({
422
+ code: 'incompatible',
423
+ option: '--macos-runtime',
424
+ message: '--macos-runtime requires the macos target.',
425
+ })
426
+ if (targets.includes('windows') && targets.includes('macos') && macosRuntime === 'swiftui')
427
+ reject({
428
+ code: 'incompatible',
429
+ option: '--macos-runtime',
430
+ message:
431
+ 'Windows shares direct Vue screens with AppKit. Create the SwiftUI app separately or choose --macos-runtime appkit.',
432
+ })
433
+ const target = layoutOf(targets, macosRuntime)
300
434
  const mac = target === 'macos'
301
435
  const {
302
436
  name,
@@ -304,7 +438,11 @@ export function resolvePreset(options) {
304
438
  rendering = web === 'nuxt' ? 'ssr' : 'client',
305
439
  theme = 'mavis',
306
440
  framework = 'vue',
307
- authoring = mac ? 'mitosis' : 'vue',
441
+ authoring = framework !== 'vue'
442
+ ? 'native'
443
+ : mac && options.example !== 'directory'
444
+ ? 'mitosis'
445
+ : 'vue',
308
446
  example = 'welcome',
309
447
  packageManager = 'npm',
310
448
  familiar,
@@ -329,14 +467,18 @@ export function resolvePreset(options) {
329
467
  option: '--familiar',
330
468
  message: `--familiar is one of ${catalog.familiar.join(', ')}. It only shapes the recommendation.`,
331
469
  })
332
- if (framework !== 'vue')
470
+ if (!catalog.frameworks[framework])
471
+ reject({
472
+ code: 'unknown',
473
+ option: '--framework',
474
+ message: 'Framework must be vue, plain, react, angular, svelte or solid.',
475
+ })
476
+ if (framework !== 'vue' && (targets.length !== 1 || targets[0] !== 'native'))
333
477
  reject({
334
- code: catalog.frameworks[framework] ? 'planned' : 'unknown',
478
+ code: 'incompatible',
335
479
  option: '--framework',
336
- message:
337
- 'This creator currently supports Vue. Other framework adapters are tracked in Mavis #145 and #35–39.',
338
- issue: catalog.frameworks[framework]?.issue,
339
- alternatives: available(catalog.frameworks).map((name) => `--framework ${name}`),
480
+ message: `${framework} currently has an iOS/Android starter only. Web, AppKit and Windows hosts use Vue.`,
481
+ alternatives: [`--targets native --framework ${framework}`, '--framework vue'],
340
482
  })
341
483
  if (!catalog.themes[theme])
342
484
  reject({ code: 'unknown', option: '--theme', message: 'Theme must be mavis or midnight.' })
@@ -346,43 +488,122 @@ export function resolvePreset(options) {
346
488
  ...preset,
347
489
  availability: availabilityOf(preset),
348
490
  })
349
- if (mac) {
350
- if (authoring !== 'mitosis')
491
+ if (!catalog.hosts[web] || catalog.hosts[web].status === 'planned')
492
+ reject({
493
+ code: catalog.hosts[web] ? 'planned' : 'unknown',
494
+ option: '--web',
495
+ message: 'Web host must be vite or nuxt. React/Next are not available yet.',
496
+ issue: catalog.hosts[web]?.issue,
497
+ alternatives: available(catalog.hosts).map((host) => `--web ${host}`),
498
+ })
499
+ if (!hasWeb && (web !== 'vite' || rendering !== 'client'))
500
+ reject({
501
+ code: 'incompatible',
502
+ option: web !== 'vite' ? '--web' : '--rendering',
503
+ message: 'A project without Web has no Web rendering mode.',
504
+ alternatives: [`--targets web,${targets.join(',')}`],
505
+ })
506
+ if (!catalog.hosts[web].rendering.includes(rendering))
507
+ reject({
508
+ code: 'incompatible',
509
+ option: '--rendering',
510
+ message: 'Choose client rendering for Vite or ssr/ssg for Nuxt.',
511
+ alternatives: catalog.hosts[web].rendering.map((mode) => `--rendering ${mode}`),
512
+ })
513
+ if (framework !== 'vue') {
514
+ if (example !== 'welcome' || authoring !== 'native')
515
+ reject({
516
+ code: 'incompatible',
517
+ option: '--example',
518
+ message:
519
+ 'Direct native framework starters provide the welcome example with framework components.',
520
+ alternatives: ['--example welcome --authoring native'],
521
+ })
522
+ return describe({
523
+ schemaVersion,
524
+ name,
525
+ targets,
526
+ target: 'mobile',
527
+ apps: appsOf({ targets, framework }),
528
+ framework,
529
+ authoring,
530
+ mode: 'direct',
531
+ execution: 'components',
532
+ example,
533
+ web: null,
534
+ rendering: null,
535
+ theme,
536
+ packageManager,
537
+ ...(familiar ? { familiar } : {}),
538
+ experimental: 'direct-native-framework',
539
+ versions,
540
+ })
541
+ }
542
+ if (target === 'desktop') {
543
+ if (authoring !== 'vue' || example === 'tasks')
351
544
  reject({
352
545
  code: 'incompatible',
353
546
  option: '--authoring',
354
547
  message:
355
- 'With Mac, shared screens are TSX sources compiled for every target; Vue templates are for projects without Mac.',
548
+ 'NativeScript desktop currently supports shared Vue with welcome or directory. Tasks uses the separate SwiftUI compiler.',
356
549
  alternatives: [
357
- '--authoring mitosis',
358
- `--targets ${targets.filter((t) => t !== 'macos').join(',') || 'web'}`,
550
+ '--example welcome',
551
+ '--example directory',
552
+ '--targets macos --macos-runtime swiftui --example tasks',
359
553
  ],
360
554
  })
361
- if (hasWeb && (web !== 'vite' || rendering !== 'client'))
555
+ return describe({
556
+ schemaVersion,
557
+ name,
558
+ targets,
559
+ target,
560
+ ...(targets.includes('macos') ? { macosRuntime } : {}),
561
+ apps: appsOf({
562
+ targets,
563
+ framework,
564
+ web: hasWeb ? web : null,
565
+ rendering: hasWeb ? rendering : null,
566
+ macosRuntime,
567
+ }),
568
+ framework,
569
+ authoring,
570
+ mode: 'direct',
571
+ execution: 'components',
572
+ example,
573
+ web: hasWeb ? web : null,
574
+ rendering: hasWeb ? rendering : null,
575
+ theme,
576
+ packageManager,
577
+ ...(familiar ? { familiar } : {}),
578
+ experimental: 'nativescript-desktop',
579
+ versions,
580
+ })
581
+ }
582
+ if (mac) {
583
+ const portableAuthoring = catalog.examples[example].portableAuthoring ?? 'mitosis'
584
+ if (authoring !== portableAuthoring)
362
585
  reject({
363
586
  code: 'incompatible',
364
- option: web !== 'vite' ? '--web' : '--rendering',
365
- message:
366
- 'With Mac, the Web app uses Vue + Vite. The shared-source compiler does not support Nuxt rendering yet.',
367
- issue: 157,
587
+ option: '--authoring',
588
+ message: `With Mac, ${example} uses ${portableAuthoring === 'vue' ? 'shared Vue screens compiled to SwiftUI' : 'shared TSX sources compiled for every target'}. Choose --example directory for shared Vue.`,
368
589
  alternatives: [
369
- '--web vite',
370
- `--targets ${targets.filter((t) => t !== 'macos').join(',')} --web nuxt`,
590
+ `--authoring ${portableAuthoring}`,
591
+ `--targets ${targets.filter((t) => t !== 'macos').join(',') || 'web'}`,
371
592
  ],
372
593
  })
373
- if (!catalog.examples[example].authoring.includes('mitosis'))
594
+ if (!catalog.examples[example].authoring.includes(portableAuthoring))
374
595
  reject({
375
596
  code: 'incompatible',
376
597
  option: '--example',
377
- message:
378
- 'With Mac, the welcome and tasks examples are available. The directory example uses Vue routes that the compiler does not support.',
379
- alternatives: ['--example welcome', '--example tasks'],
598
+ message: `The ${example} example does not provide shared ${portableAuthoring} sources for Mac.`,
599
+ alternatives: ['--example welcome', '--example directory', '--example tasks'],
380
600
  })
381
601
  return describe({
382
602
  schemaVersion,
383
603
  name,
384
604
  targets,
385
605
  target,
606
+ macosRuntime: 'swiftui',
386
607
  apps: appsOf({
387
608
  targets,
388
609
  framework,
@@ -391,8 +612,8 @@ export function resolvePreset(options) {
391
612
  }),
392
613
  framework,
393
614
  authoring,
394
- mode: catalog.authoring[authoring].mode,
395
- execution: catalog.authoring[authoring].execution,
615
+ mode: 'portable',
616
+ execution: 'generated',
396
617
  example,
397
618
  web: hasWeb ? web : null,
398
619
  rendering: hasWeb ? rendering : null,
@@ -432,28 +653,6 @@ export function resolvePreset(options) {
432
653
  issue: catalog.authoring.jsx.issue,
433
654
  alternatives: ['--authoring vue'],
434
655
  })
435
- if (!catalog.hosts[web] || catalog.hosts[web].status === 'planned')
436
- reject({
437
- code: catalog.hosts[web] ? 'planned' : 'unknown',
438
- option: '--web',
439
- message: 'Web host must be vite or nuxt. React/Next are not available yet.',
440
- issue: catalog.hosts[web]?.issue,
441
- alternatives: available(catalog.hosts).map((host) => `--web ${host}`),
442
- })
443
- if (!hasWeb && (web !== 'vite' || rendering !== 'client'))
444
- reject({
445
- code: 'incompatible',
446
- option: web !== 'vite' ? '--web' : '--rendering',
447
- message: 'A project without Web has no Web rendering mode.',
448
- alternatives: [`--targets web,${targets.join(',')}`],
449
- })
450
- if (!catalog.hosts[web].rendering.includes(rendering))
451
- reject({
452
- code: 'incompatible',
453
- option: '--rendering',
454
- message: 'Choose client rendering for Vite or ssr/ssg for Nuxt.',
455
- alternatives: catalog.hosts[web].rendering.map((mode) => `--rendering ${mode}`),
456
- })
457
656
  return describe({
458
657
  schemaVersion,
459
658
  name,
@@ -492,12 +691,9 @@ export function checkProject(options) {
492
691
  /** What someone coming from another framework should pick. Advice only: nothing is preselected. */
493
692
  export function recommendation(familiar, targets) {
494
693
  if (!familiar || familiar === 'vue' || familiar === 'other') return undefined
495
- const mac = targets.includes('macos')
496
- if (familiar === 'react')
497
- return mac
498
- ? 'Coming from React: shared TSX screens read like function components with a store. They are compiled to Vue for the Web and Native; React itself is not running.'
499
- : `Coming from React: screens here are Vue templates and Vue runs them. A React adapter is tracked in #${catalog.frameworks.react.issue}; shared TSX, which reads closer to React, comes with the Mac target.`
500
- return `Coming from ${catalog.frameworks[familiar].label}: Vue runs the Web and Native apps today. A ${catalog.frameworks[familiar].label} adapter is tracked in #${catalog.frameworks[familiar].issue}.`
694
+ return targets.length === 1 && targets[0] === 'native'
695
+ ? `Coming from ${catalog.frameworks[familiar].label}: select --framework ${familiar} for its direct iOS/Android component subset, or Vue for the full native catalog.`
696
+ : `These Web and desktop hosts use Vue. Direct ${catalog.frameworks[familiar].label} starters are available separately with --targets native --framework ${familiar}.`
501
697
  }
502
698
 
503
699
  /** What mavis.config.json records: targets instead of the internal layout name. */
@@ -522,12 +718,16 @@ export function migrateConfig(config) {
522
718
  const authoring = config.authoring ?? (targets.includes('macos') ? 'mitosis' : 'vue')
523
719
  const web = hasWeb ? (config.web ?? 'vite') : null
524
720
  const rendering = hasWeb ? (config.rendering ?? (web === 'nuxt' ? 'ssr' : 'client')) : null
721
+ const macosRuntime =
722
+ config.macosRuntime ??
723
+ (config.apps?.macos?.toolkit === 'nativescript-appkit' ? 'appkit' : 'swiftui')
525
724
  const { target: _target, ...rest } = config
526
725
  return {
527
726
  ...rest,
528
727
  schemaVersion,
529
728
  targets,
530
- apps: config.apps ?? appsOf({ targets, framework, web, rendering }),
729
+ apps: config.apps ?? appsOf({ targets, framework, web, rendering, macosRuntime }),
730
+ ...(targets.includes('macos') ? { macosRuntime } : {}),
531
731
  framework,
532
732
  authoring,
533
733
  mode: config.mode ?? catalog.authoring[authoring]?.mode ?? 'direct',
@@ -541,7 +741,7 @@ export function migrateConfig(config) {
541
741
  export function normalizeConfig(config) {
542
742
  const migrated = migrateConfig(config)
543
743
  if (!migrated?.targets) return migrated
544
- return { ...migrated, target: layoutOf(migrated.targets) }
744
+ return { ...migrated, target: layoutOf(migrated.targets, migrated.macosRuntime) }
545
745
  }
546
746
 
547
747
  /** The catalog as data: what `--capabilities --json` prints and CI reads. */
@@ -550,20 +750,66 @@ export function describeCapabilities() {
550
750
  return {
551
751
  catalogVersion,
552
752
  schemaVersion,
753
+ macos: macosCapabilities,
754
+ desktop: {
755
+ contracts: desktopComponents,
756
+ status: 'experimental',
757
+ since: '0.1.0-rc.15',
758
+ components: [
759
+ 'MScreen',
760
+ 'MColumn',
761
+ 'MRow',
762
+ 'MGrid',
763
+ 'MText',
764
+ 'MInput',
765
+ 'MButton',
766
+ 'MLink',
767
+ 'MCard',
768
+ 'MAlert',
769
+ 'MEmptyState',
770
+ 'MReveal',
771
+ ],
772
+ limits: [
773
+ 'Explicit property subset; unsupported properties fail at runtime.',
774
+ 'MRow uses equal-width columns; MGrid adapts to minColumnWidth.',
775
+ 'AppKit reveal: finite opacity through Jolt samples and Core Animation. Windows reveal: immediate visibility; no Jolt Windows driver.',
776
+ 'NativeScript Core iOS/Android components are not desktop controls.',
777
+ ],
778
+ macosRuntime: versions.macosNodeApi,
779
+ windowsRuntime: versions.windowsNapi,
780
+ },
781
+ macosRuntimes: entries(catalog.macosRuntimes),
553
782
  creator: versions.mavis,
783
+ migrations: {
784
+ macos: {
785
+ flag: '--add-macos',
786
+ apply: '--write',
787
+ status: 'experimental',
788
+ since: '0.1.0-rc.15',
789
+ hosts: ['vite', 'nuxt', 'nativescript'],
790
+ preservesSources: true,
791
+ runtimes: ['appkit', 'swiftui'],
792
+ compiler: 'SwiftUI only: @getcortexlabs/mavis-compiler',
793
+ },
794
+ },
554
795
  combinations: combinations.map((combination) => ({
555
796
  ...combination,
556
797
  label: targetLabel(combination.targets),
557
- hosts: combination.targets.includes('web')
558
- ? combination.authoring === 'vue'
559
- ? available(catalog.hosts)
560
- : ['vite']
561
- : [],
798
+ hosts: combination.targets.includes('web') ? available(catalog.hosts) : [],
562
799
  examples: Object.entries(catalog.examples)
563
- .filter(([, example]) => example.authoring.includes(combination.authoring))
800
+ .filter(
801
+ ([, example]) =>
802
+ example.authoring.includes(combination.authoring) ||
803
+ (combination.macosRuntime === 'swiftui' && example.portableAuthoring),
804
+ )
564
805
  .map(([id]) => ({
565
806
  id,
566
- availability: availabilityOf({ targets: combination.targets, example: id }),
807
+ availability: availabilityOf({
808
+ targets: combination.targets,
809
+ example: id,
810
+ macosRuntime: combination.macosRuntime,
811
+ framework: combination.framework,
812
+ }),
567
813
  })),
568
814
  })),
569
815
  targets: entries(catalog.targets),
@@ -588,7 +834,7 @@ export function formatCapabilities() {
588
834
  const lines = ['What this creator can scaffold', '']
589
835
  for (const combination of data.combinations) {
590
836
  lines.push(
591
- ` --targets ${combination.targets.join(',').padEnd(18)} ${combination.label} · ${catalog.authoring[combination.authoring].label}`,
837
+ ` --targets ${combination.targets.join(',').padEnd(18)} ${combination.label} · ${catalog.authoring[combination.authoring].label}${combination.framework ? ` · --framework ${combination.framework}` : ''}${combination.macosRuntime ? ` · --macos-runtime ${combination.macosRuntime}` : ''}`,
592
838
  )
593
839
  if (combination.hosts.length)
594
840
  lines.push(
@@ -599,6 +845,27 @@ export function formatCapabilities() {
599
845
  ` --example ${example.id.padEnd(10)} ${availabilityLabel(example.availability)}`,
600
846
  )
601
847
  }
848
+ lines.push(
849
+ '',
850
+ 'NativeScript desktop · experimental subset',
851
+ ` ${data.desktop.components.join(', ')}`,
852
+ ...data.desktop.limits.map((limit) => ` ${limit}`),
853
+ )
854
+ lines.push(
855
+ '',
856
+ 'SwiftUI components · paused compiler inventory; not runtime validation or AppKit/Windows coverage',
857
+ )
858
+ for (const [name, component] of Object.entries(data.macos.components)) {
859
+ lines.push(
860
+ ` ${name}: ${component.status} · ${component.props.length} Vue props · #${component.issue}`,
861
+ )
862
+ for (const limit of component.limits) lines.push(` ${limit.en}`)
863
+ if (component.rejectedProps.length)
864
+ lines.push(` Rejected props: ${component.rejectedProps.join(', ')}`)
865
+ }
866
+ lines.push(
867
+ ' Exact props, events and slots: --capabilities --json. Validate your sources with --check-portability.',
868
+ )
602
869
  lines.push(
603
870
  '',
604
871
  `Themes: ${data.themes.join(', ')} · Package managers: ${data.packageManagers.join(', ')}`,