@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
@@ -0,0 +1,111 @@
1
+ import { Application } from '@nativescript/core'
2
+ import { createSignal, createComponent, Show, onCleanup } from 'solid-js'
3
+ import { createElement, render } from '@nativescript-community/solid-js'
4
+ import {
5
+ MColumn,
6
+ MRow,
7
+ MBox,
8
+ MText,
9
+ MButton,
10
+ MInput,
11
+ MThemeProvider,
12
+ } from '@getcortexlabs/mavis-solid-nativescript'
13
+ import { bridge, initial, theme, isolatedTheme, surface } from './model'
14
+
15
+ export function start() {
16
+ Application.run({
17
+ create: () => {
18
+ const page = createElement('page', { actionBarHidden: true })
19
+ const dispose = render(() => {
20
+ const [state, setState] = createSignal(initial)
21
+ const [background, setBackground] = createSignal(theme.theme.colors.background)
22
+ onCleanup(theme.subscribe(() => setBackground(theme.theme.colors.background)))
23
+ bridge.read = state
24
+ bridge.update = (patch) => setState((value) => ({ ...value, ...patch }))
25
+ return createComponent(MThemeProvider, {
26
+ theme,
27
+ get children() {
28
+ return createComponent(MColumn, {
29
+ id: 'catalog',
30
+ gap: 'md',
31
+ padding: 'lg',
32
+ height: '100%',
33
+ get backgroundColor() {
34
+ return background()
35
+ },
36
+ get children() {
37
+ return [
38
+ createComponent(MText, {
39
+ id: 'heading',
40
+ text: '__MAVIS_NAME__',
41
+ variant: 'title',
42
+ }),
43
+ createComponent(MRow, {
44
+ id: 'row',
45
+ gap: 'sm',
46
+ get children() {
47
+ return createComponent(MButton, {
48
+ id: 'action',
49
+ get text() {
50
+ return `Count ${state().count}`
51
+ },
52
+ get disabled() {
53
+ return state().disabled
54
+ },
55
+ get loading() {
56
+ return state().loading
57
+ },
58
+ onClick: () => bridge.update?.({ count: state().count + 1 }),
59
+ })
60
+ },
61
+ }),
62
+ createComponent(MInput, {
63
+ id: 'editor',
64
+ label: 'Name',
65
+ get modelValue() {
66
+ return state().value
67
+ },
68
+ get disabled() {
69
+ return state().disabled
70
+ },
71
+ onValueChange: (value) => bridge.update?.({ value }),
72
+ ref: (view) => {
73
+ bridge.focus = () => view.focusInput()
74
+ },
75
+ }),
76
+ createComponent(Show, {
77
+ get when() {
78
+ return state().visible
79
+ },
80
+ children: () =>
81
+ createComponent(MBox, {
82
+ id: 'motion',
83
+ width: 100,
84
+ height: 30,
85
+ backgroundColor: '#4f46e5',
86
+ motionSurface: surface,
87
+ }),
88
+ }),
89
+ createComponent(MBox, {
90
+ padding: 'md',
91
+ radius: 'md',
92
+ backgroundColor: isolatedTheme.theme.colors.background,
93
+ get children() {
94
+ return createComponent(MText, {
95
+ id: 'isolated',
96
+ text: 'Independent theme',
97
+ theme: isolatedTheme,
98
+ })
99
+ },
100
+ }),
101
+ ]
102
+ },
103
+ })
104
+ },
105
+ })
106
+ }, page)
107
+ bridge.dispose = dispose
108
+ return page
109
+ },
110
+ })
111
+ }
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ import { onDestroy } from 'svelte'
3
+ import { MColumn, MRow, MBox, MText, MButton, MInput, MThemeProvider } from '@getcortexlabs/mavis-svelte-nativescript'
4
+ import { bridge, initial, theme, isolatedTheme, surface } from './model'
5
+ let state = { ...initial }
6
+ let background = theme.theme.colors.background
7
+ onDestroy(theme.subscribe(() => background = theme.theme.colors.background))
8
+ let input: MInput
9
+ bridge.read = () => state
10
+ bridge.update = patch => { state = { ...state, ...patch } }
11
+ bridge.focus = () => input?.focusInput()
12
+ </script>
13
+
14
+ <page actionBarHidden={true}>
15
+ <MThemeProvider {theme}>
16
+ <MColumn id="catalog" gap="md" padding="lg" height="100%" backgroundColor={background}>
17
+ <MText id="heading" variant="title">__MAVIS_NAME__</MText>
18
+ <MRow id="row" gap="sm">
19
+ <MButton id="action" disabled={state.disabled} loading={state.loading} on:click={() => bridge.update?.({ count: state.count + 1 })}>Count {state.count}</MButton>
20
+ </MRow>
21
+ <MInput id="editor" label="Name" modelValue={state.value} disabled={state.disabled} on:valueChange={event => bridge.update?.({ value: event.detail })} bind:this={input} />
22
+ {#if state.visible}<MBox id="motion" width={100} height={30} backgroundColor="#4f46e5" motionSurface={surface} />{/if}
23
+ <MBox padding="md" radius="md" backgroundColor={isolatedTheme.theme.colors.background}><MText id="isolated" theme={isolatedTheme} text="Independent theme" /></MBox>
24
+ </MColumn>
25
+ </MThemeProvider>
26
+ </page>
@@ -0,0 +1,14 @@
1
+ import { svelteNative } from '@nativescript-community/svelte-native'
2
+ import Catalog from './Welcome.svelte'
3
+ import { bridge } from './model'
4
+ class OwnedCatalog extends Catalog {
5
+ constructor(options: ConstructorParameters<typeof Catalog>[0]) {
6
+ super(options)
7
+ // Core 9 can emit launch before Svelte Native resolves its page instance.
8
+ // Take disposal ownership from the actual public component constructor.
9
+ bridge.dispose = () => this.$destroy()
10
+ }
11
+ }
12
+ export function start() {
13
+ void svelteNative(OwnedCatalog, {})
14
+ }
@@ -0,0 +1,20 @@
1
+ // Use the project's pinned TypeScript for both svelte-check and webpack.
2
+ // svelte-check's default preprocessor can resolve a different TypeScript peer.
3
+ const ts = require('typescript')
4
+ module.exports = {
5
+ preprocess: {
6
+ script: ({ content, attributes, filename }) => {
7
+ if (attributes.lang !== 'ts') return undefined
8
+ const result = ts.transpileModule(content, {
9
+ fileName: filename,
10
+ compilerOptions: {
11
+ target: ts.ScriptTarget.ES2022,
12
+ module: ts.ModuleKind.ESNext,
13
+ verbatimModuleSyntax: true,
14
+ sourceMap: true,
15
+ },
16
+ })
17
+ return { code: result.outputText, map: result.sourceMapText }
18
+ },
19
+ },
20
+ }
@@ -1,84 +1,2 @@
1
- // Resolved by this host. Shared screens import from #mavis.
2
- export {
3
- MThemeProvider,
4
- MPlatform,
5
- MPopover,
6
- MMenu,
7
- MAppBar,
8
- MTabBar,
9
- MTimePicker,
10
- MVirtualList,
11
- MDataTable,
12
- MCarousel,
13
- MRangeSlider,
14
- MCalendar,
15
- MRating,
16
- MTreeView,
17
- MCommandPalette,
18
- MNavigationRail,
19
- MBreadcrumb,
20
- MTooltip,
21
- MTimeline,
22
- MChart,
23
- MImageViewer,
24
- MSortableList,
25
- MSwipeActions,
26
- MNumberFlow,
27
- MResizablePanels,
28
- MImageCompare,
29
- MSpan,
30
- MScreen,
31
- MBox,
32
- MRow,
33
- MColumn,
34
- MStack,
35
- MGrid,
36
- MLink,
37
- MCard,
38
- MText,
39
- MButton,
40
- MSlider,
41
- MSwitch,
42
- MCheckbox,
43
- MRadioGroup,
44
- MSelect,
45
- MToast,
46
- MDialog,
47
- MTabs,
48
- MSkeleton,
49
- MChip,
50
- MEmptyState,
51
- MProgress,
52
- MAccordion,
53
- MSegmentedControl,
54
- MAlert,
55
- MListItem,
56
- MSeparator,
57
- MAvatar,
58
- MBadge,
59
- MInput,
60
- MIcon,
61
- MReveal,
62
- MSheet,
63
- MDatePicker,
64
- MDateRangePicker,
65
- MNumberInput,
66
- MMultiSelect,
67
- MImage,
68
- MCombobox,
69
- MFilePicker,
70
- MFormGroup,
71
- MFormErrors,
72
- MSteps,
73
- MPagination,
74
- useMavisPlatform,
75
- useMavisListMotion,
76
- useMavisTheme,
77
- useToast,
78
- useFormController,
79
- useFormField,
80
- useFileSelection,
81
- useMavisNavigation,
82
- } from '@getcortexlabs/mavis-web'
83
- export * from '@getcortexlabs/mavis-core'
84
- export { formatDateTime, dateTimeToCivilDate } from '@getcortexlabs/mavis-web/date-format'
1
+ // Resolved by this host. Shared screens import the renderer's public API from #mavis.
2
+ export * from '@getcortexlabs/mavis-web'
@@ -1,84 +1,2 @@
1
- // Resolved by this host. Shared screens import from #mavis.
2
- export {
3
- MThemeProvider,
4
- MPlatform,
5
- MPopover,
6
- MMenu,
7
- MAppBar,
8
- MTabBar,
9
- MTimePicker,
10
- MVirtualList,
11
- MDataTable,
12
- MCarousel,
13
- MRangeSlider,
14
- MCalendar,
15
- MRating,
16
- MTreeView,
17
- MCommandPalette,
18
- MNavigationRail,
19
- MBreadcrumb,
20
- MTooltip,
21
- MTimeline,
22
- MChart,
23
- MImageViewer,
24
- MSortableList,
25
- MSwipeActions,
26
- MNumberFlow,
27
- MResizablePanels,
28
- MImageCompare,
29
- MSpan,
30
- MScreen,
31
- MBox,
32
- MRow,
33
- MColumn,
34
- MStack,
35
- MGrid,
36
- MLink,
37
- MCard,
38
- MText,
39
- MButton,
40
- MSlider,
41
- MSwitch,
42
- MCheckbox,
43
- MRadioGroup,
44
- MSelect,
45
- MToast,
46
- MDialog,
47
- MTabs,
48
- MSkeleton,
49
- MChip,
50
- MEmptyState,
51
- MProgress,
52
- MAccordion,
53
- MSegmentedControl,
54
- MAlert,
55
- MListItem,
56
- MSeparator,
57
- MAvatar,
58
- MBadge,
59
- MInput,
60
- MIcon,
61
- MReveal,
62
- MSheet,
63
- MDatePicker,
64
- MDateRangePicker,
65
- MNumberInput,
66
- MMultiSelect,
67
- MImage,
68
- MCombobox,
69
- MFilePicker,
70
- MFormGroup,
71
- MFormErrors,
72
- MSteps,
73
- MPagination,
74
- useMavisPlatform,
75
- useMavisListMotion,
76
- useMavisTheme,
77
- useToast,
78
- useFormController,
79
- useFormField,
80
- useFileSelection,
81
- useMavisNavigation,
82
- } from '@getcortexlabs/mavis-web'
83
- export * from '@getcortexlabs/mavis-core'
84
- export { formatDateTime, dateTimeToCivilDate } from '@getcortexlabs/mavis-web/date-format'
1
+ // Resolved by this host. Shared screens import the renderer's public API from #mavis.
2
+ export * from '@getcortexlabs/mavis-web'