@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.
- package/README.md +44 -7
- package/package.json +4 -2
- package/src/adapters.mjs +56 -20
- package/src/add-desktop.mjs +308 -0
- package/src/add-macos.mjs +386 -0
- package/src/capabilities.mjs +352 -85
- package/src/cli.mjs +181 -9
- package/src/desktop.mjs +155 -0
- package/src/doctor.mjs +181 -18
- package/src/macos-capabilities.generated.mjs +4190 -0
- package/src/macos.mjs +147 -29
- package/src/migrate-directory.mjs +121 -0
- package/src/native-framework.mjs +144 -0
- package/src/portability.mjs +123 -5
- package/src/scaffold.mjs +59 -11
- package/src/ui.mjs +69 -12
- package/templates/desktop/common/LICENSE +21 -0
- package/templates/desktop/common/build.mjs +58 -0
- package/templates/desktop/common/src/components.ts +60 -0
- package/templates/desktop/common/src/contract.mjs +35 -0
- package/templates/desktop/common/src/renderer.ts +76 -0
- package/templates/desktop/common/src/storage.ts +29 -0
- package/templates/desktop/directory/main.ts +35 -0
- package/templates/desktop/macos/launch.mjs +6 -0
- package/templates/desktop/macos/package.mjs +114 -0
- package/templates/desktop/macos/src/host.mjs +468 -0
- package/templates/desktop/macos/src/motion.mjs +51 -0
- package/templates/desktop/welcome/Welcome.vue +56 -0
- package/templates/desktop/welcome/main.ts +24 -0
- package/templates/desktop/windows/NativeScript-LICENSE +19 -0
- package/templates/desktop/windows/launch.mjs +16 -0
- package/templates/desktop/windows/package.mjs +54 -0
- package/templates/desktop/windows/prepare-host.mjs +73 -0
- package/templates/desktop/windows/src/host.mjs +277 -0
- package/templates/directory/host/directory-storage.ts +78 -0
- package/templates/directory/macos/DirectoryStorage.swift +68 -0
- package/templates/directory/mobile/src/app.ts +11 -8
- package/templates/directory/nuxt/app/plugins/mavis.ts +11 -8
- package/templates/directory/shared/Edit.vue +8 -5
- package/templates/directory/shared/directory-store.ts +42 -46
- package/templates/directory/vite/src/main.ts +11 -8
- package/templates/macos/examples/tasks/shared/TaskDetail.lite.tsx +2 -2
- package/templates/macos/examples/tasks/shared/Tasks.lite.tsx +2 -2
- package/templates/macos/examples/tasks/shared/types.ts +1 -0
- package/templates/macos/mobile/src/App.vue +4 -2
- package/templates/macos/native/Package.swift +3 -1
- package/templates/macos/native/Sources/MavisDesktop/App.swift +26 -11
- package/templates/macos/native/Sources/MavisDesktop/Fonts/LICENSE +45 -0
- package/templates/macos/native/Sources/MavisDesktop/Fonts/lucide.ttf +0 -0
- package/templates/macos/scripts/generate.mjs +3 -26
- package/templates/macos/scripts/macos-manifest.mjs +33 -0
- package/templates/macos/scripts/macos.mjs +20 -18
- package/templates/macos/web/index.html +1 -1
- package/templates/macos/web/src/main.js +176 -3
- package/templates/macos/web/src/mavis.js +2 -0
- package/templates/macos/web/src/style.css +2 -1
- package/templates/macos/web/vite.config.mjs +12 -1
- package/templates/migrations/directory-rc13.json +36 -0
- package/templates/mobile/src/mavis.ts +2 -82
- package/templates/mobile/webpack.config.js +4 -0
- package/templates/native-framework/angular/screen.ts +84 -0
- package/templates/native-framework/common/nativescript.config.ts +6 -0
- package/templates/native-framework/common/src/app.ts +5 -0
- package/templates/native-framework/common/src/model.ts +40 -0
- package/templates/native-framework/common/src/references.d.ts +8 -0
- package/templates/native-framework/common/tsconfig.json +16 -0
- package/templates/native-framework/common/webpack.config.js +67 -0
- package/templates/native-framework/plain/screen.ts +102 -0
- package/templates/native-framework/react/screen.ts +83 -0
- package/templates/native-framework/solid/screen.ts +111 -0
- package/templates/native-framework/svelte/Welcome.svelte +26 -0
- package/templates/native-framework/svelte/screen.ts +14 -0
- package/templates/native-framework/svelte-tooling/svelte.config.js +20 -0
- package/templates/nuxt/app/mavis.ts +2 -84
- package/templates/vite/src/mavis.ts +2 -84
- package/templates/macos/scripts/portable/emit-swift.mjs +0 -1287
- package/templates/macos/scripts/portable/emit-vue.mjs +0 -615
- package/templates/macos/scripts/portable/index.mjs +0 -95
- package/templates/macos/scripts/portable/model.mjs +0 -1441
- package/templates/macos/scripts/portable/program.mjs +0 -163
package/src/capabilities.mjs
CHANGED
|
@@ -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.
|
|
11
|
-
jolt: '0.1.0-rc.
|
|
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.
|
|
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
|
|
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
|
|
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: '
|
|
66
|
-
toolkit: '
|
|
67
|
-
adapter:
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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
|
-
|
|
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
|
|
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({
|
|
252
|
-
|
|
253
|
-
|
|
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 [
|
|
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
|
|
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 =
|
|
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
|
|
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:
|
|
478
|
+
code: 'incompatible',
|
|
335
479
|
option: '--framework',
|
|
336
|
-
message:
|
|
337
|
-
|
|
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 (
|
|
350
|
-
|
|
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
|
-
'
|
|
548
|
+
'NativeScript desktop currently supports shared Vue with welcome or directory. Tasks uses the separate SwiftUI compiler.',
|
|
356
549
|
alternatives: [
|
|
357
|
-
'--
|
|
358
|
-
|
|
550
|
+
'--example welcome',
|
|
551
|
+
'--example directory',
|
|
552
|
+
'--targets macos --macos-runtime swiftui --example tasks',
|
|
359
553
|
],
|
|
360
554
|
})
|
|
361
|
-
|
|
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:
|
|
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
|
-
|
|
370
|
-
`--targets ${targets.filter((t) => t !== 'macos').join(',')
|
|
590
|
+
`--authoring ${portableAuthoring}`,
|
|
591
|
+
`--targets ${targets.filter((t) => t !== 'macos').join(',') || 'web'}`,
|
|
371
592
|
],
|
|
372
593
|
})
|
|
373
|
-
if (!catalog.examples[example].authoring.includes(
|
|
594
|
+
if (!catalog.examples[example].authoring.includes(portableAuthoring))
|
|
374
595
|
reject({
|
|
375
596
|
code: 'incompatible',
|
|
376
597
|
option: '--example',
|
|
377
|
-
message:
|
|
378
|
-
|
|
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:
|
|
395
|
-
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
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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(
|
|
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({
|
|
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(', ')}`,
|