@getcortexlabs/create-mavis 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +27 -6
- package/package.json +6 -1
- package/src/cli.mjs +119 -107
- package/src/doctor.mjs +9 -0
- package/src/package-manager.mjs +105 -0
- package/src/portability.mjs +445 -0
- package/src/presets.mjs +23 -7
- package/src/reference.mjs +45 -0
- package/src/scaffold.mjs +122 -32
- package/src/shared-api.mjs +57 -0
- package/src/ui.mjs +276 -0
- package/templates/directory/mobile/src/App.vue +4 -0
- package/templates/directory/mobile/src/app.ts +32 -0
- package/templates/directory/nuxt/app/app.vue +1 -0
- package/templates/directory/nuxt/app/pages/entries/[id]/edit.vue +5 -0
- package/templates/directory/nuxt/app/pages/entries/[id]/index.vue +5 -0
- package/templates/directory/nuxt/app/pages/index.vue +4 -0
- package/templates/directory/nuxt/app/plugins/mavis.ts +34 -0
- package/templates/directory/shared/Details.vue +26 -0
- package/templates/directory/shared/Directory.vue +51 -0
- package/templates/directory/shared/Edit.vue +99 -0
- package/templates/directory/shared/directory-store.ts +82 -0
- package/templates/directory/shared/routes.ts +9 -0
- package/templates/directory/vite/src/App.vue +4 -0
- package/templates/directory/vite/src/main.ts +34 -0
- package/templates/mobile/src/App.vue +1 -3
- package/templates/mobile/src/mavis.ts +57 -0
- package/templates/mobile/tsconfig.json +9 -2
- package/templates/mobile/webpack.config.js +2 -0
- package/templates/nuxt/app/mavis.ts +57 -0
- package/templates/nuxt/nuxt.config.ts +5 -0
- package/templates/shared/Welcome.vue +13 -1
- package/templates/vite/src/mavis.ts +57 -0
- package/templates/vite/tsconfig.json +5 -1
- package/templates/vite/vite.config.ts +8 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createMavisServices } from '@getcortexlabs/mavis-web/services'
|
|
2
|
+
import { createRouterNavigation, mavis, midnight } from '@getcortexlabs/mavis-core'
|
|
3
|
+
import { useMavisTheme } from '@getcortexlabs/mavis-core/vue'
|
|
4
|
+
import { createDirectory, directoryKey } from '__MAVIS_SHARED__/directory-store'
|
|
5
|
+
|
|
6
|
+
export default defineNuxtPlugin(({ vueApp, $router }) => {
|
|
7
|
+
const saved = useCookie<string>('appearance')
|
|
8
|
+
const initial = useState<'light' | 'dark'>('mavis:appearance', () =>
|
|
9
|
+
saved.value === 'dark' ? 'dark' : saved.value === 'light' ? 'light' : '__MAVIS_APPEARANCE__',
|
|
10
|
+
)
|
|
11
|
+
vueApp.use(
|
|
12
|
+
createMavisServices({
|
|
13
|
+
theme: mavis,
|
|
14
|
+
darkTheme: midnight,
|
|
15
|
+
appearance: initial.value,
|
|
16
|
+
navigation: createRouterNavigation($router),
|
|
17
|
+
}),
|
|
18
|
+
)
|
|
19
|
+
const theme = vueApp.runWithContext(useMavisTheme)
|
|
20
|
+
// Each server request has its own store. Storage is accessed only after hydration.
|
|
21
|
+
const directory = createDirectory({
|
|
22
|
+
async read() {
|
|
23
|
+
return localStorage.getItem('mavis:directory')
|
|
24
|
+
},
|
|
25
|
+
async write(value) {
|
|
26
|
+
localStorage.setItem('mavis:directory', value)
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
vueApp.provide(directoryKey, directory)
|
|
30
|
+
onNuxtReady(() => {
|
|
31
|
+
theme.setAppearance(saved.value === 'dark' || saved.value === 'light' ? saved.value : 'system')
|
|
32
|
+
void directory.restore()
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { MScreen, MColumn, MText, MButton, MLink, MEmptyState } from '#mavis'
|
|
4
|
+
import { useDirectory } from './directory-store'
|
|
5
|
+
const props = defineProps<{ id: string }>()
|
|
6
|
+
const directory = useDirectory()
|
|
7
|
+
const entry = computed(() => directory.entries.value.find((item) => item.id === props.id))
|
|
8
|
+
</script>
|
|
9
|
+
<template>
|
|
10
|
+
<MScreen scroll>
|
|
11
|
+
<MColumn padding="lg" gap="lg">
|
|
12
|
+
<MLink id="places-home" href="/" text="All places" />
|
|
13
|
+
<template v-if="entry">
|
|
14
|
+
<MText as="h1" variant="title">{{ entry.name }}</MText>
|
|
15
|
+
<MText tone="muted">{{ entry.city }}</MText>
|
|
16
|
+
<MText>Keep the directory useful by updating the place’s name.</MText>
|
|
17
|
+
<MButton id="edit-place" :href="`/entries/${entry.id}/edit`" text="Edit place" />
|
|
18
|
+
</template>
|
|
19
|
+
<MEmptyState
|
|
20
|
+
v-else
|
|
21
|
+
title="Place not found"
|
|
22
|
+
description="Return to the directory to choose another place."
|
|
23
|
+
/>
|
|
24
|
+
</MColumn>
|
|
25
|
+
</MScreen>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import { MScreen, MColumn, MText, MInput, MGrid, MCard, MAlert, MEmptyState } from '#mavis'
|
|
4
|
+
import { useDirectory } from './directory-store'
|
|
5
|
+
const { entries, query, storageError } = useDirectory()
|
|
6
|
+
const results = computed(() => {
|
|
7
|
+
const filter = query.value.trim().toLocaleLowerCase('en')
|
|
8
|
+
return entries.value.filter((entry) =>
|
|
9
|
+
`${entry.name} ${entry.city}`.toLocaleLowerCase('en').includes(filter),
|
|
10
|
+
)
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
13
|
+
<template>
|
|
14
|
+
<MScreen scroll>
|
|
15
|
+
<MColumn padding="lg" gap="lg">
|
|
16
|
+
<MText as="h1" variant="title">Community directory</MText>
|
|
17
|
+
<MText tone="muted">Find a place to learn, create or meet your neighbours.</MText>
|
|
18
|
+
<MInput
|
|
19
|
+
id="directory-search"
|
|
20
|
+
v-model="query"
|
|
21
|
+
label="Search places"
|
|
22
|
+
placeholder="Name or city"
|
|
23
|
+
/>
|
|
24
|
+
<MAlert
|
|
25
|
+
v-if="storageError"
|
|
26
|
+
tone="warning"
|
|
27
|
+
title="Storage unavailable"
|
|
28
|
+
:description="storageError"
|
|
29
|
+
/>
|
|
30
|
+
<MText variant="caption">{{ results.length }} places found</MText>
|
|
31
|
+
<MEmptyState
|
|
32
|
+
v-if="!results.length"
|
|
33
|
+
title="No places found"
|
|
34
|
+
description="Try another name or city."
|
|
35
|
+
/>
|
|
36
|
+
<MGrid :minColumnWidth="240" gap="md">
|
|
37
|
+
<MCard
|
|
38
|
+
v-for="entry in results"
|
|
39
|
+
:key="entry.id"
|
|
40
|
+
:id="`entry-${entry.id}`"
|
|
41
|
+
:href="`/entries/${entry.id}`"
|
|
42
|
+
:accessibilityLabel="`Open ${entry.name}`"
|
|
43
|
+
gap="sm"
|
|
44
|
+
>
|
|
45
|
+
<MText variant="heading">{{ entry.name }}</MText>
|
|
46
|
+
<MText tone="muted">{{ entry.city }}</MText>
|
|
47
|
+
</MCard>
|
|
48
|
+
</MGrid>
|
|
49
|
+
</MColumn>
|
|
50
|
+
</MScreen>
|
|
51
|
+
</template>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
MScreen,
|
|
5
|
+
MColumn,
|
|
6
|
+
MText,
|
|
7
|
+
MInput,
|
|
8
|
+
MButton,
|
|
9
|
+
MLink,
|
|
10
|
+
MAlert,
|
|
11
|
+
MReveal,
|
|
12
|
+
MEmptyState,
|
|
13
|
+
} from '#mavis'
|
|
14
|
+
import { useDirectory } from './directory-store'
|
|
15
|
+
const props = defineProps<{ id: string }>()
|
|
16
|
+
const directory = useDirectory()
|
|
17
|
+
const entry = computed(() => directory.entries.value.find((item) => item.id === props.id))
|
|
18
|
+
const name = ref(entry.value?.name ?? '')
|
|
19
|
+
const dirty = ref(false),
|
|
20
|
+
saving = ref(false),
|
|
21
|
+
saved = ref(false),
|
|
22
|
+
error = ref('')
|
|
23
|
+
watch(entry, (value) => {
|
|
24
|
+
if (!dirty.value) name.value = value?.name ?? ''
|
|
25
|
+
})
|
|
26
|
+
watch(
|
|
27
|
+
() => props.id,
|
|
28
|
+
() => {
|
|
29
|
+
name.value = entry.value?.name ?? ''
|
|
30
|
+
dirty.value = false
|
|
31
|
+
saved.value = false
|
|
32
|
+
error.value = ''
|
|
33
|
+
},
|
|
34
|
+
)
|
|
35
|
+
function edit() {
|
|
36
|
+
dirty.value = true
|
|
37
|
+
saved.value = false
|
|
38
|
+
}
|
|
39
|
+
async function save() {
|
|
40
|
+
if (saving.value || !name.value.trim()) return
|
|
41
|
+
const id = props.id,
|
|
42
|
+
draft = name.value
|
|
43
|
+
saving.value = true
|
|
44
|
+
saved.value = false
|
|
45
|
+
error.value = ''
|
|
46
|
+
try {
|
|
47
|
+
await directory.save(id, draft)
|
|
48
|
+
if (props.id === id) {
|
|
49
|
+
saved.value = name.value === draft
|
|
50
|
+
dirty.value = name.value !== draft
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
if (props.id === id) error.value = 'Could not save. Your draft is still here; try again.'
|
|
54
|
+
} finally {
|
|
55
|
+
saving.value = false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|
|
59
|
+
<template>
|
|
60
|
+
<MScreen scroll>
|
|
61
|
+
<MColumn padding="lg" gap="lg">
|
|
62
|
+
<MLink :href="`/entries/${id}`" text="Place details" />
|
|
63
|
+
<template v-if="entry">
|
|
64
|
+
<MText as="h1" variant="title">Edit place</MText>
|
|
65
|
+
<MInput
|
|
66
|
+
id="place-name"
|
|
67
|
+
v-model="name"
|
|
68
|
+
label="Place name"
|
|
69
|
+
:readonly="saving"
|
|
70
|
+
@update:modelValue="edit"
|
|
71
|
+
@submit="save"
|
|
72
|
+
/>
|
|
73
|
+
<MAlert
|
|
74
|
+
id="save-error"
|
|
75
|
+
v-if="error"
|
|
76
|
+
tone="error"
|
|
77
|
+
title="Save failed"
|
|
78
|
+
:description="error"
|
|
79
|
+
/>
|
|
80
|
+
<MButton
|
|
81
|
+
id="save-place"
|
|
82
|
+
text="Save changes"
|
|
83
|
+
:loading="saving"
|
|
84
|
+
loadingText="Saving…"
|
|
85
|
+
:disabled="!name.trim()"
|
|
86
|
+
@click="save"
|
|
87
|
+
/>
|
|
88
|
+
<MReveal :show="saved">
|
|
89
|
+
<MText tone="success">Changes saved.</MText>
|
|
90
|
+
</MReveal>
|
|
91
|
+
</template>
|
|
92
|
+
<MEmptyState
|
|
93
|
+
v-else
|
|
94
|
+
title="Place not found"
|
|
95
|
+
description="Choose a place from the directory."
|
|
96
|
+
/>
|
|
97
|
+
</MColumn>
|
|
98
|
+
</MScreen>
|
|
99
|
+
</template>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { inject, ref, readonly, type InjectionKey } from 'vue'
|
|
2
|
+
|
|
3
|
+
export interface DirectoryEntry {
|
|
4
|
+
id: string
|
|
5
|
+
name: string
|
|
6
|
+
city: string
|
|
7
|
+
}
|
|
8
|
+
export interface DirectoryStorage {
|
|
9
|
+
read(): Promise<string | null>
|
|
10
|
+
write(value: string): Promise<void>
|
|
11
|
+
}
|
|
12
|
+
const seed: DirectoryEntry[] = [
|
|
13
|
+
{ id: 'garden', name: 'Community garden', city: 'Porto' },
|
|
14
|
+
{ id: 'library', name: 'Open library', city: 'Recife' },
|
|
15
|
+
{ id: 'studio', name: 'Neighbourhood studio', city: 'Porto' },
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
/** Create once per app/request. Storage is a host service, never a module singleton. */
|
|
19
|
+
export function createDirectory(storage: DirectoryStorage) {
|
|
20
|
+
const entries = ref(seed.map((entry) => ({ ...entry })))
|
|
21
|
+
const query = ref('')
|
|
22
|
+
const storageError = ref('')
|
|
23
|
+
let restoring: Promise<void> | undefined
|
|
24
|
+
let writing = Promise.resolve()
|
|
25
|
+
const restore = () =>
|
|
26
|
+
(restoring ??= (async () => {
|
|
27
|
+
try {
|
|
28
|
+
const value = await storage.read()
|
|
29
|
+
if (value === null) return
|
|
30
|
+
const parsed: unknown = JSON.parse(value)
|
|
31
|
+
if (
|
|
32
|
+
!Array.isArray(parsed) ||
|
|
33
|
+
parsed.length !== seed.length ||
|
|
34
|
+
!seed.every(
|
|
35
|
+
(original) =>
|
|
36
|
+
parsed.filter(
|
|
37
|
+
(entry) =>
|
|
38
|
+
entry?.id === original.id &&
|
|
39
|
+
typeof entry.name === 'string' &&
|
|
40
|
+
entry.name.trim() &&
|
|
41
|
+
typeof entry.city === 'string',
|
|
42
|
+
).length === 1,
|
|
43
|
+
)
|
|
44
|
+
)
|
|
45
|
+
throw new Error('Invalid saved directory')
|
|
46
|
+
entries.value = parsed.map(({ id, name, city }) => ({ id, name, city }))
|
|
47
|
+
} catch {
|
|
48
|
+
storageError.value =
|
|
49
|
+
'Saved entries could not be loaded. The sample entries are still available.'
|
|
50
|
+
}
|
|
51
|
+
})())
|
|
52
|
+
return {
|
|
53
|
+
entries: readonly(entries),
|
|
54
|
+
query,
|
|
55
|
+
storageError: readonly(storageError),
|
|
56
|
+
restore,
|
|
57
|
+
async save(id: string, name: string) {
|
|
58
|
+
if (!name.trim() || !entries.value.some((entry) => entry.id === id))
|
|
59
|
+
throw new Error('Invalid entry')
|
|
60
|
+
const pending = writing
|
|
61
|
+
.catch(() => {})
|
|
62
|
+
.then(async () => {
|
|
63
|
+
await restore()
|
|
64
|
+
const next = entries.value.map((entry) =>
|
|
65
|
+
entry.id === id ? { ...entry, name: name.trim() } : { ...entry },
|
|
66
|
+
)
|
|
67
|
+
// Commit state only after the host confirms persistence. A rejected write preserves the draft.
|
|
68
|
+
await storage.write(JSON.stringify(next))
|
|
69
|
+
entries.value = next
|
|
70
|
+
})
|
|
71
|
+
writing = pending
|
|
72
|
+
await pending
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export type Directory = ReturnType<typeof createDirectory>
|
|
77
|
+
export const directoryKey: InjectionKey<Directory> = Symbol('directory')
|
|
78
|
+
export function useDirectory() {
|
|
79
|
+
const directory = inject(directoryKey)
|
|
80
|
+
if (!directory) throw new Error('Install the directory service at the application entry.')
|
|
81
|
+
return directory
|
|
82
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Directory from './Directory.vue'
|
|
2
|
+
import Details from './Details.vue'
|
|
3
|
+
import Edit from './Edit.vue'
|
|
4
|
+
|
|
5
|
+
export const routes = [
|
|
6
|
+
{ path: '/', component: Directory },
|
|
7
|
+
{ path: '/entries/:id', component: Details, props: true },
|
|
8
|
+
{ path: '/entries/:id/edit', component: Edit, props: true },
|
|
9
|
+
]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
3
|
+
import { createMavisServices } from '@getcortexlabs/mavis-web/services'
|
|
4
|
+
import { createRouterNavigation, mavis, midnight } from '@getcortexlabs/mavis-core'
|
|
5
|
+
import { createDirectory, directoryKey } from '__MAVIS_SHARED__/directory-store'
|
|
6
|
+
import { routes } from '__MAVIS_SHARED__/routes'
|
|
7
|
+
import App from './App.vue'
|
|
8
|
+
import '@getcortexlabs/mavis-web/style.css'
|
|
9
|
+
import './style.css'
|
|
10
|
+
|
|
11
|
+
const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), routes })
|
|
12
|
+
const directory = createDirectory({
|
|
13
|
+
async read() {
|
|
14
|
+
return localStorage.getItem('mavis:directory')
|
|
15
|
+
},
|
|
16
|
+
async write(value) {
|
|
17
|
+
localStorage.setItem('mavis:directory', value)
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
const app = createApp(App)
|
|
21
|
+
.use(router)
|
|
22
|
+
.use(
|
|
23
|
+
createMavisServices({
|
|
24
|
+
theme: mavis,
|
|
25
|
+
darkTheme: midnight,
|
|
26
|
+
appearance: '__MAVIS_APPEARANCE__',
|
|
27
|
+
navigation: createRouterNavigation(router),
|
|
28
|
+
}),
|
|
29
|
+
)
|
|
30
|
+
.provide(directoryKey, directory)
|
|
31
|
+
void router.isReady().then(() => {
|
|
32
|
+
app.mount('#app')
|
|
33
|
+
void directory.restore()
|
|
34
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Resolved by this host. Shared screens import from #mavis.
|
|
2
|
+
export {
|
|
3
|
+
MThemeProvider,
|
|
4
|
+
MSpan,
|
|
5
|
+
MScreen,
|
|
6
|
+
MBox,
|
|
7
|
+
MRow,
|
|
8
|
+
MColumn,
|
|
9
|
+
MStack,
|
|
10
|
+
MGrid,
|
|
11
|
+
MLink,
|
|
12
|
+
MCard,
|
|
13
|
+
MText,
|
|
14
|
+
MButton,
|
|
15
|
+
MSlider,
|
|
16
|
+
MSwitch,
|
|
17
|
+
MCheckbox,
|
|
18
|
+
MRadioGroup,
|
|
19
|
+
MSelect,
|
|
20
|
+
MToast,
|
|
21
|
+
MDialog,
|
|
22
|
+
MTabs,
|
|
23
|
+
MSkeleton,
|
|
24
|
+
MChip,
|
|
25
|
+
MEmptyState,
|
|
26
|
+
MProgress,
|
|
27
|
+
MAccordion,
|
|
28
|
+
MSegmentedControl,
|
|
29
|
+
MAlert,
|
|
30
|
+
MListItem,
|
|
31
|
+
MSeparator,
|
|
32
|
+
MAvatar,
|
|
33
|
+
MBadge,
|
|
34
|
+
MInput,
|
|
35
|
+
MIcon,
|
|
36
|
+
MReveal,
|
|
37
|
+
MSheet,
|
|
38
|
+
MDatePicker,
|
|
39
|
+
MDateRangePicker,
|
|
40
|
+
MNumberInput,
|
|
41
|
+
MMultiSelect,
|
|
42
|
+
MImage,
|
|
43
|
+
MCombobox,
|
|
44
|
+
MFilePicker,
|
|
45
|
+
MFormGroup,
|
|
46
|
+
MFormErrors,
|
|
47
|
+
MSteps,
|
|
48
|
+
MPagination,
|
|
49
|
+
useMavisTheme,
|
|
50
|
+
useToast,
|
|
51
|
+
useFormController,
|
|
52
|
+
useFormField,
|
|
53
|
+
useFileSelection,
|
|
54
|
+
useMavisNavigation,
|
|
55
|
+
} from '@getcortexlabs/mavis/vue'
|
|
56
|
+
export * from '@getcortexlabs/mavis-core'
|
|
57
|
+
export { formatDateTime, dateTimeToCivilDate } from '@getcortexlabs/mavis/date-format'
|
|
@@ -7,8 +7,15 @@
|
|
|
7
7
|
"lib": ["ES2023", "DOM"],
|
|
8
8
|
"skipLibCheck": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
10
|
-
"paths": {
|
|
10
|
+
"paths": {
|
|
11
|
+
"vue": ["./node_modules/nativescript-vue"],
|
|
12
|
+
"#mavis": ["./src/mavis.ts"],
|
|
13
|
+
"#shared-ui/*": ["__MAVIS_SHARED_ROOT__/*"]
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"vueCompilerOptions": {
|
|
17
|
+
"target": 3,
|
|
18
|
+
"lib": "nativescript-vue"
|
|
11
19
|
},
|
|
12
|
-
"vueCompilerOptions": { "target": 3, "lib": "nativescript-vue" },
|
|
13
20
|
"include": ["src", "../../shared"]
|
|
14
21
|
}
|
|
@@ -8,6 +8,8 @@ module.exports = (env) => {
|
|
|
8
8
|
context: resolve(__dirname, 'node_modules/@getcortexlabs/mavis/fonts'),
|
|
9
9
|
})
|
|
10
10
|
webpack.chainWebpack((config) => {
|
|
11
|
+
config.resolve.alias.set('#shared-ui', resolve(__dirname, '__MAVIS_SHARED_ROOT__'))
|
|
12
|
+
config.resolve.alias.set('#mavis$', resolve(__dirname, 'src/mavis.ts'))
|
|
11
13
|
config.resolve.alias.set('vue$', resolve(__dirname, 'node_modules/nativescript-vue'))
|
|
12
14
|
for (const name of [
|
|
13
15
|
'nativescript-vue',
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Resolved by this host. Shared screens import from #mavis.
|
|
2
|
+
export {
|
|
3
|
+
MThemeProvider,
|
|
4
|
+
MSpan,
|
|
5
|
+
MScreen,
|
|
6
|
+
MBox,
|
|
7
|
+
MRow,
|
|
8
|
+
MColumn,
|
|
9
|
+
MStack,
|
|
10
|
+
MGrid,
|
|
11
|
+
MLink,
|
|
12
|
+
MCard,
|
|
13
|
+
MText,
|
|
14
|
+
MButton,
|
|
15
|
+
MSlider,
|
|
16
|
+
MSwitch,
|
|
17
|
+
MCheckbox,
|
|
18
|
+
MRadioGroup,
|
|
19
|
+
MSelect,
|
|
20
|
+
MToast,
|
|
21
|
+
MDialog,
|
|
22
|
+
MTabs,
|
|
23
|
+
MSkeleton,
|
|
24
|
+
MChip,
|
|
25
|
+
MEmptyState,
|
|
26
|
+
MProgress,
|
|
27
|
+
MAccordion,
|
|
28
|
+
MSegmentedControl,
|
|
29
|
+
MAlert,
|
|
30
|
+
MListItem,
|
|
31
|
+
MSeparator,
|
|
32
|
+
MAvatar,
|
|
33
|
+
MBadge,
|
|
34
|
+
MInput,
|
|
35
|
+
MIcon,
|
|
36
|
+
MReveal,
|
|
37
|
+
MSheet,
|
|
38
|
+
MDatePicker,
|
|
39
|
+
MDateRangePicker,
|
|
40
|
+
MNumberInput,
|
|
41
|
+
MMultiSelect,
|
|
42
|
+
MImage,
|
|
43
|
+
MCombobox,
|
|
44
|
+
MFilePicker,
|
|
45
|
+
MFormGroup,
|
|
46
|
+
MFormErrors,
|
|
47
|
+
MSteps,
|
|
48
|
+
MPagination,
|
|
49
|
+
useMavisTheme,
|
|
50
|
+
useToast,
|
|
51
|
+
useFormController,
|
|
52
|
+
useFormField,
|
|
53
|
+
useFileSelection,
|
|
54
|
+
useMavisNavigation,
|
|
55
|
+
} from '@getcortexlabs/mavis-web'
|
|
56
|
+
export * from '@getcortexlabs/mavis-core'
|
|
57
|
+
export { formatDateTime, dateTimeToCivilDate } from '@getcortexlabs/mavis-web/date-format'
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
1
2
|
export default defineNuxtConfig({
|
|
2
3
|
compatibilityDate: '2026-11-02',
|
|
4
|
+
alias: {
|
|
5
|
+
'#shared-ui': fileURLToPath(new URL('__MAVIS_SHARED_ROOT__', import.meta.url)),
|
|
6
|
+
'#mavis': fileURLToPath(new URL('./app/mavis.ts', import.meta.url)),
|
|
7
|
+
},
|
|
3
8
|
devtools: { enabled: false },
|
|
4
9
|
css: ['@getcortexlabs/mavis-web/style.css', '~/assets/main.css'],
|
|
5
10
|
app: { head: { title: '__MAVIS_NAME__', htmlAttrs: { lang: 'en' } } },
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { computed, ref } from 'vue'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
MAlert,
|
|
5
|
+
MButton,
|
|
6
|
+
MCard,
|
|
7
|
+
MColumn,
|
|
8
|
+
MIcon,
|
|
9
|
+
MInput,
|
|
10
|
+
MReveal,
|
|
11
|
+
MRow,
|
|
12
|
+
MScreen,
|
|
13
|
+
MText,
|
|
14
|
+
useMavisTheme,
|
|
15
|
+
} from '#mavis'
|
|
4
16
|
import { useProjectService } from './services'
|
|
5
17
|
|
|
6
18
|
const { theme, setAppearance } = useMavisTheme()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Resolved by this host. Shared screens import from #mavis.
|
|
2
|
+
export {
|
|
3
|
+
MThemeProvider,
|
|
4
|
+
MSpan,
|
|
5
|
+
MScreen,
|
|
6
|
+
MBox,
|
|
7
|
+
MRow,
|
|
8
|
+
MColumn,
|
|
9
|
+
MStack,
|
|
10
|
+
MGrid,
|
|
11
|
+
MLink,
|
|
12
|
+
MCard,
|
|
13
|
+
MText,
|
|
14
|
+
MButton,
|
|
15
|
+
MSlider,
|
|
16
|
+
MSwitch,
|
|
17
|
+
MCheckbox,
|
|
18
|
+
MRadioGroup,
|
|
19
|
+
MSelect,
|
|
20
|
+
MToast,
|
|
21
|
+
MDialog,
|
|
22
|
+
MTabs,
|
|
23
|
+
MSkeleton,
|
|
24
|
+
MChip,
|
|
25
|
+
MEmptyState,
|
|
26
|
+
MProgress,
|
|
27
|
+
MAccordion,
|
|
28
|
+
MSegmentedControl,
|
|
29
|
+
MAlert,
|
|
30
|
+
MListItem,
|
|
31
|
+
MSeparator,
|
|
32
|
+
MAvatar,
|
|
33
|
+
MBadge,
|
|
34
|
+
MInput,
|
|
35
|
+
MIcon,
|
|
36
|
+
MReveal,
|
|
37
|
+
MSheet,
|
|
38
|
+
MDatePicker,
|
|
39
|
+
MDateRangePicker,
|
|
40
|
+
MNumberInput,
|
|
41
|
+
MMultiSelect,
|
|
42
|
+
MImage,
|
|
43
|
+
MCombobox,
|
|
44
|
+
MFilePicker,
|
|
45
|
+
MFormGroup,
|
|
46
|
+
MFormErrors,
|
|
47
|
+
MSteps,
|
|
48
|
+
MPagination,
|
|
49
|
+
useMavisTheme,
|
|
50
|
+
useToast,
|
|
51
|
+
useFormController,
|
|
52
|
+
useFormField,
|
|
53
|
+
useFileSelection,
|
|
54
|
+
useMavisNavigation,
|
|
55
|
+
} from '@getcortexlabs/mavis-web'
|
|
56
|
+
export * from '@getcortexlabs/mavis-core'
|
|
57
|
+
export { formatDateTime, dateTimeToCivilDate } from '@getcortexlabs/mavis-web/date-format'
|
|
@@ -6,7 +6,11 @@
|
|
|
6
6
|
"strict": true,
|
|
7
7
|
"skipLibCheck": true,
|
|
8
8
|
"lib": ["ES2023", "DOM"],
|
|
9
|
-
"types": ["vite/client"]
|
|
9
|
+
"types": ["vite/client", "node"],
|
|
10
|
+
"paths": {
|
|
11
|
+
"#mavis": ["./src/mavis.ts"],
|
|
12
|
+
"#shared-ui/*": ["__MAVIS_SHARED_ROOT__/*"]
|
|
13
|
+
}
|
|
10
14
|
},
|
|
11
15
|
"include": ["src", "../../shared", "vite.config.ts"]
|
|
12
16
|
}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { defineConfig } from 'vite'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
2
3
|
import vue from '@vitejs/plugin-vue'
|
|
3
4
|
export default defineConfig({
|
|
4
5
|
plugins: [vue()],
|
|
5
|
-
resolve: {
|
|
6
|
+
resolve: {
|
|
7
|
+
alias: {
|
|
8
|
+
'#shared-ui': fileURLToPath(new URL('__MAVIS_SHARED_ROOT__', import.meta.url)),
|
|
9
|
+
'#mavis': fileURLToPath(new URL('./src/mavis.ts', import.meta.url)),
|
|
10
|
+
},
|
|
11
|
+
dedupe: ['vue', '@vue/runtime-core', '@vue/reactivity', '@vue/shared'],
|
|
12
|
+
},
|
|
6
13
|
})
|