NativeScript Mac and Windows
The creator builds standalone apps for AppKit on macOS and XAML Islands on Windows, using NativeScript's published Node-API runtimes. Vue runs the shared screens and state; @getcortexlabs/mavis-desktop renders native controls. There is no WebView or development server in the packaged application.
Availability
These experimental presets are available in @getcortexlabs/create-mavis@0.1.0-rc.21, where the generated hosts use the @getcortexlabs/mavis-desktop package described here. Hosts from RC.18 or earlier carry their own copy of twelve components. --capabilities --json reports each preset and its component coverage.
Create and run
npx @getcortexlabs/create-mavis@0.1.0-rc.21 studio --targets macos,windows --example directory --no-install
cd studio
npm run install:apps
npm run macos # on macOS
npm run windows # on WindowsAdd web and/or native to share the same Vue sources with Vite/Nuxt and iOS/Android. --web nuxt --rendering ssr or ssg selects the Web host. Choose npm, pnpm or Yarn with --package-manager; all generated scripts and instructions use that manager.
install:apps installs each desktop runtime only on its matching OS. The projects have separate dependency trees under apps/macos, apps/windows and, when selected, apps/mobile. Keep desktop and mobile packages outside the Web workspace.
| Target | Runtime | Build/run requirements | Packaging |
|---|---|---|---|
| macOS | @nativescript/macos-node-api@0.5.0-beta.0 | Apple Silicon, macOS 13.3+, Node 22.23.3+ | Xcode command-line tools; ad hoc signed .app |
| Windows | @nativescript/windows-napi@1.0.0-beta.20 | Windows 10 build 18362+, x64/arm64, Node 22.23.3+, Windows SDK | Unsigned portable folder with bundled Node |
The minimum versions come from the runtime requirements, not tests on every OS/architecture. Hosted acceptance covers macOS arm64 and Windows x64 on Server 2025; Server 2022 hosted runners failed to present even the minimal XAML control probe. Run create-mavis --doctor on each target machine.
Windows XAML needs a compatibility manifest on its hosting executable. The generated launcher uses the SDK's mt.exe to prepare a project-local copy of Node; it does not modify the system Node installation. MAVIS_MT can select a Manifest Tool installed outside the standard SDK directory.
Shared source and component scope
shared/Welcome.vue demonstrates controlled input, a counter and an asynchronous host service. shared/Directory.vue shares search, details, editing, a route table and persistence with the other selected hosts. Desktop stores data under the user's application-data directory, scoped to the generated project name.
The desktop components come from @getcortexlabs/mavis-desktop, with the properties of their published contracts. Desktop components names the components the package has, lists every property per host, what a shared file can keep, and how layout, themes and motion behave.
- Rows size their children from content, columns stretch them, and grids take
columns,minColumnWidthor both, with the same rules as the other renderers. - The app follows the system's light or dark appearance by default, through the same themes the other hosts use.
- AppKit provides native application and editing menus;
addDesktopCommands(host, menu, commands)insrc/main.ts, oruseDesktopCommandsin a component, adds your own commands; on the Mac they join the menu bar and on Windows they answer to their shortcuts.shortcuton a button works on both systems, withmodas Command or Control. - Motion runs through the public Jolt drivers, using Core Animation on macOS and XAML storyboards on Windows, and settles at once when the system reduces motion. MReveal fades and settles in and fades out with the theme's tokens, buttons and interactive cards scale while pressed and spring back, and scale and rotation pivot on the centre of the element. The keyed children of a column, row or grid with a
motionRegionglide to their new places, enter and leave, and arrive in turn as they come into the window; see Regions. - An attribute a component does not have, or an HTML element, stops the screen with an error that names it.
classanddata-*are ignored.
The generated host is small: src/main.ts creates the window, installs Mavis and your providers, and mounts the shared entry. The components, the layout engine and the native code stay in the package, so they update with it.
NativeScript's desktop runtime support does not make its existing Core iOS/Android widget classes desktop controls. Mavis supplies a separate Vue host for these native desktop APIs. Nuxt server modules and DOM code remain Web-specific.
Package the app
npm run build:macos
npm run package:macos
# On Windows:
npm run build:windows
npm run package:windowsOutput lives under apps/<target>/artifacts. Both formats include Node, the native runtime and licenses, and can run outside the source checkout. The Mac app has an ad hoc signature and is not notarized. The Windows output is an unsigned folder with a launcher, not an installer. Public distribution requires your signing/notarization/installer setup.
Add a desktop host
Inside an existing Mavis Vue app:
create-mavis --add-macos --shared-root src/shared --entry src/shared/Directory.vue
create-mavis --add-macos --shared-root src/shared --entry src/shared/Directory.vue --write
create-mavis --add-windows --shared-root src/shared --entry src/shared/Directory.vue --writeThe preview checks the entry and the files it imports against the desktop contract: components, properties, slots and what is imported from #mavis. Other files in the shared folder are not read, so a Web-only screen beside the entry does not block the host. Classes and <style> blocks do not block it either: the preview notes that the desktop ignores them and which properties replace the declarations. HTML elements and inline styles are refused, each with the component or property to write instead. Shared files stay in place; the command adds an isolated host plus root scripts. Existing destinations, conflicting scripts, symlinks and changes since the preview are rejected.
When the shared root or the entry is missing, the answer names the path that was looked for and lists the Vue files in the shared folder. When the sources are outside the contract, the findings come grouped by file and by kind, each with a count and its lines; a property the desktop refuses comes with the reason. An import the check cannot read (one that does not resolve, leaves the project, or points at JSON, CSS or an asset) is listed with its file and line, and the host is written anyway; the build is where such an import has to work. --json returns the same findings as data, with file, line, kind, component, property and message, and a summary by file and by kind, and the imports it did not follow under warnings. Every refusal, including a configuration from a newer creator and a symlink in a path, prints on standard output, also under --json, and exits with status 1.
To start from a screen that already fits, add --starter:
create-mavis --add-macos --shared-root src/shared --entry src/shared/desktop/Welcome.vue --starter --writeIt writes the starter screen a new desktop project gets, at --entry or at a free default path in the shared root (Welcome.vue, then desktop/Welcome.vue), together with the services.ts it imports. When a services.ts higher in the shared root already exports projectServiceKey and useProjectService, the starter imports that one instead of getting its own. It never overwrites a file. In a terminal, a refused preview offers the same starter.
The host installs vue, vue-router and Jolt at the versions the project already uses, and from this creator only when the project has none; the preview says which. It also gets a tsconfig.json that maps #mavis, #desktop-host and #shared-ui/*, so an editor resolves them in apps/<target>/src/main.ts, and a typecheck script that runs vue-tsc on the entry and the shared files it imports.
--write ends with the install and run commands for the project's package manager. In mavis.config.json it adds the desktop target, its entry under apps, desktop and the version of the desktop runtime. Every other key and version already recorded keeps its value, order and formatting. With pnpm, apps/<target>/pnpm-workspace.yaml lists the pinned Mavis core, Mavis desktop and Jolt versions under minimumReleaseAgeExclude, so a release age rule does not hold back the versions this creator was published with.
Directory's recorded example gets its route/storage wiring; for a custom entry, review apps/<target>/src/main.ts and install the app's own providers/router there. This is not automatic conversion of arbitrary Vue applications.
The SwiftUI compiler, templates and target-specific tests are preserved on archive/swiftui. To create a macOS AppKit or Windows XAML app, see the NativeScript desktop guide.