@getcortexlabs/mavis-core 0.1.0-alpha.10 → 0.1.0-alpha.11

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 (100) hide show
  1. package/dist/capabilities.d.ts +7 -7
  2. package/dist/capabilities.d.ts.map +1 -1
  3. package/dist/capabilities.js +16 -4
  4. package/dist/capabilities.js.map +1 -1
  5. package/dist/chart.d.ts +40 -0
  6. package/dist/chart.d.ts.map +1 -0
  7. package/dist/chart.js +73 -0
  8. package/dist/chart.js.map +1 -0
  9. package/dist/discovery.d.ts +49 -0
  10. package/dist/discovery.d.ts.map +1 -0
  11. package/dist/discovery.js +80 -0
  12. package/dist/discovery.js.map +1 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +3 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/vue/carousel.d.ts +11 -0
  18. package/dist/vue/carousel.d.ts.map +1 -0
  19. package/dist/vue/carousel.js +115 -0
  20. package/dist/vue/carousel.js.map +1 -0
  21. package/dist/vue/chart.d.ts +194 -0
  22. package/dist/vue/chart.d.ts.map +1 -0
  23. package/dist/vue/chart.js +246 -0
  24. package/dist/vue/chart.js.map +1 -0
  25. package/dist/vue/command-palette.d.ts +129 -0
  26. package/dist/vue/command-palette.d.ts.map +1 -0
  27. package/dist/vue/command-palette.js +187 -0
  28. package/dist/vue/command-palette.js.map +1 -0
  29. package/dist/vue/component-props.d.ts +475 -18
  30. package/dist/vue/component-props.d.ts.map +1 -1
  31. package/dist/vue/component-props.js +14 -0
  32. package/dist/vue/component-props.js.map +1 -1
  33. package/dist/vue/configurator.d.ts +2 -2
  34. package/dist/vue/data-table.d.ts +17 -0
  35. package/dist/vue/data-table.d.ts.map +1 -0
  36. package/dist/vue/data-table.js +133 -0
  37. package/dist/vue/data-table.js.map +1 -0
  38. package/dist/vue/date-picker.d.ts +8 -8
  39. package/dist/vue/date-props.d.ts +6 -0
  40. package/dist/vue/date-props.d.ts.map +1 -1
  41. package/dist/vue/date-props.js +3 -0
  42. package/dist/vue/date-props.js.map +1 -1
  43. package/dist/vue/discovery-components.d.ts +50 -0
  44. package/dist/vue/discovery-components.d.ts.map +1 -0
  45. package/dist/vue/discovery-components.js +2 -0
  46. package/dist/vue/discovery-components.js.map +1 -0
  47. package/dist/vue/discovery-controls.d.ts +197 -0
  48. package/dist/vue/discovery-controls.d.ts.map +1 -0
  49. package/dist/vue/discovery-controls.js +166 -0
  50. package/dist/vue/discovery-controls.js.map +1 -0
  51. package/dist/vue/discovery-props.d.ts +249 -0
  52. package/dist/vue/discovery-props.d.ts.map +1 -0
  53. package/dist/vue/discovery-props.js +87 -0
  54. package/dist/vue/discovery-props.js.map +1 -0
  55. package/dist/vue/global-components.d.ts +61 -0
  56. package/dist/vue/global-components.d.ts.map +1 -1
  57. package/dist/vue/index.d.ts +10 -0
  58. package/dist/vue/index.d.ts.map +1 -1
  59. package/dist/vue/index.js +9 -0
  60. package/dist/vue/index.js.map +1 -1
  61. package/dist/vue/menu.d.ts +1 -1
  62. package/dist/vue/props.d.ts +36 -36
  63. package/dist/vue/time-picker.d.ts +2 -2
  64. package/dist/vue/tree-view.d.ts +111 -0
  65. package/dist/vue/tree-view.d.ts.map +1 -0
  66. package/dist/vue/tree-view.js +180 -0
  67. package/dist/vue/tree-view.js.map +1 -0
  68. package/dist/vue/wayfinding-controls.d.ts +198 -0
  69. package/dist/vue/wayfinding-controls.d.ts.map +1 -0
  70. package/dist/vue/wayfinding-controls.js +310 -0
  71. package/dist/vue/wayfinding-controls.js.map +1 -0
  72. package/dist/vue/wayfinding-props.d.ts +221 -0
  73. package/dist/vue/wayfinding-props.d.ts.map +1 -0
  74. package/dist/vue/wayfinding-props.js +86 -0
  75. package/dist/vue/wayfinding-props.js.map +1 -0
  76. package/dist/vue/workflows.d.ts +2 -2
  77. package/dist/wayfinding.d.ts +50 -0
  78. package/dist/wayfinding.d.ts.map +1 -0
  79. package/dist/wayfinding.js +54 -0
  80. package/dist/wayfinding.js.map +1 -0
  81. package/package.json +1 -1
  82. package/src/capabilities.ts +16 -4
  83. package/src/chart.ts +112 -0
  84. package/src/discovery.ts +139 -0
  85. package/src/index.ts +5 -0
  86. package/src/vue/carousel.ts +173 -0
  87. package/src/vue/chart.ts +338 -0
  88. package/src/vue/command-palette.ts +232 -0
  89. package/src/vue/component-props.ts +28 -0
  90. package/src/vue/data-table.ts +190 -0
  91. package/src/vue/date-props.ts +3 -0
  92. package/src/vue/discovery-components.ts +60 -0
  93. package/src/vue/discovery-controls.ts +218 -0
  94. package/src/vue/discovery-props.ts +92 -0
  95. package/src/vue/global-components.ts +66 -0
  96. package/src/vue/index.ts +13 -0
  97. package/src/vue/tree-view.ts +220 -0
  98. package/src/vue/wayfinding-controls.ts +412 -0
  99. package/src/vue/wayfinding-props.ts +97 -0
  100. package/src/wayfinding.ts +85 -0
@@ -0,0 +1,97 @@
1
+ import type { PropType } from '@vue/runtime-core'
2
+ import type { ChoiceValue } from '../choice.js'
3
+ import type {
4
+ BreadcrumbItem,
5
+ CommandItem,
6
+ NavigationGroup,
7
+ TimelineItem,
8
+ TimelineStatus,
9
+ } from '../wayfinding.js'
10
+ import type { ChartCategory, ChartSelection, ChartSeries } from '../chart.js'
11
+ import { buttonProps, sheetProps } from './props.js'
12
+ import type { PopoverPlacement } from '../popover.js'
13
+
14
+ const label = { type: String, required: true as const }
15
+ export const commandPaletteProps = {
16
+ id: String,
17
+ label,
18
+ open: Boolean,
19
+ items: { type: Array as PropType<readonly CommandItem[]>, required: true as const },
20
+ query: { type: String, default: undefined },
21
+ disabled: Boolean,
22
+ loading: Boolean,
23
+ /** Opt-in Cmd/Ctrl+K on Web, ignored in editable elements and other modal dialogs. */
24
+ shortcut: Boolean,
25
+ searchLabel: { type: String, default: 'Search commands' },
26
+ placeholder: { type: String, default: 'What would you like to do?' },
27
+ emptyLabel: { type: String, default: 'No matching commands' },
28
+ loadingLabel: { type: String, default: 'Loading commands' },
29
+ closeLabel: { type: String, default: 'Close commands' },
30
+ returnFocus: sheetProps.returnFocus,
31
+ }
32
+ export const navigationRailProps = {
33
+ id: String,
34
+ label,
35
+ groups: { type: Array as PropType<readonly NavigationGroup[]>, required: true as const },
36
+ modelValue: { type: [String, Number] as PropType<ChoiceValue | null>, default: null },
37
+ collapsed: Boolean,
38
+ disabled: Boolean,
39
+ collapsible: { type: Boolean, default: true },
40
+ collapseLabel: { type: String, default: 'Collapse navigation' },
41
+ expandLabel: { type: String, default: 'Expand navigation' },
42
+ currentLabel: { type: String, default: 'Current page' },
43
+ }
44
+ export const breadcrumbProps = {
45
+ id: String,
46
+ label: { type: String, default: 'Breadcrumb' },
47
+ items: { type: Array as PropType<readonly BreadcrumbItem[]>, required: true as const },
48
+ maxItems: { type: Number, default: 4 },
49
+ expandLabel: { type: String, default: 'Show full path' },
50
+ }
51
+ export const tooltipProps = {
52
+ id: String,
53
+ text: label,
54
+ triggerLabel: label,
55
+ icon: { ...buttonProps.icon, default: 'info' },
56
+ variant: { ...buttonProps.variant, default: 'ghost' },
57
+ disabled: Boolean,
58
+ delay: { type: Number, default: 350 },
59
+ placement: { type: String as PropType<PopoverPlacement>, default: 'top-start' },
60
+ }
61
+ export const timelineProps = {
62
+ id: String,
63
+ label,
64
+ items: { type: Array as PropType<readonly TimelineItem[]>, required: true as const },
65
+ emptyLabel: { type: String, default: 'No activity yet' },
66
+ statusLabels: {
67
+ type: Object as PropType<Record<TimelineStatus, string>>,
68
+ default: () => ({
69
+ complete: 'Complete',
70
+ current: 'In progress',
71
+ upcoming: 'Upcoming',
72
+ error: 'Needs attention',
73
+ }),
74
+ },
75
+ }
76
+ export const chartProps = {
77
+ id: String,
78
+ label,
79
+ description: String,
80
+ categories: { type: Array as PropType<readonly ChartCategory[]>, required: true as const },
81
+ series: { type: Array as PropType<readonly ChartSeries[]>, required: true as const },
82
+ type: { type: String as PropType<'line' | 'bar'>, default: 'line' },
83
+ domain: Array as unknown as PropType<readonly [number, number]>,
84
+ height: { type: Number, default: 240 },
85
+ modelValue: { type: Object as PropType<ChartSelection | null>, default: null },
86
+ disabled: Boolean,
87
+ hiddenSeries: { type: Array as PropType<readonly ChoiceValue[]>, default: () => [] },
88
+ formatValue: Function as PropType<(value: number) => string>,
89
+ showData: { type: Boolean, default: false },
90
+ showDataLabel: { type: String, default: 'Show data' },
91
+ hideDataLabel: { type: String, default: 'Hide data' },
92
+ emptyLabel: { type: String, default: 'No chart data' },
93
+ missingLabel: { type: String, default: 'No value' },
94
+ clearLabel: { type: String, default: 'Clear selection' },
95
+ categoryLabel: { type: String, default: 'Category' },
96
+ seriesLabel: { type: String, default: 'Series' },
97
+ }
@@ -0,0 +1,85 @@
1
+ import { collectionKeys } from './discovery.js'
2
+ import type { ChoiceValue } from './choice.js'
3
+ import type { IconName } from './icon.js'
4
+ import { linkDestination, type LinkNavigate } from './link.js'
5
+ import { validateNavigation, type NavigationItem } from './collections.js'
6
+
7
+ export interface CommandItem {
8
+ value: ChoiceValue
9
+ label: string
10
+ description?: string
11
+ keywords?: readonly string[]
12
+ group?: string
13
+ icon?: IconName
14
+ /** Display hint only. Applications own action-specific keyboard shortcuts. */
15
+ shortcut?: string
16
+ disabled?: boolean
17
+ }
18
+ const searchable = (value: string) =>
19
+ value
20
+ .normalize('NFD')
21
+ .replace(/[\u0300-\u036f]/g, '')
22
+ .toLowerCase()
23
+ export function filterCommands(items: readonly CommandItem[], query: string) {
24
+ collectionKeys(items, 'value')
25
+ for (const item of items) if (!item.label.trim()) throw new TypeError('Commands require labels.')
26
+ const terms = searchable(query.trim()).split(/\s+/).filter(Boolean)
27
+ return items.filter((item) => {
28
+ const haystack = searchable(
29
+ [item.label, item.description, item.group, ...(item.keywords ?? [])]
30
+ .filter(Boolean)
31
+ .join(' '),
32
+ )
33
+ return terms.every((term) => haystack.includes(term))
34
+ })
35
+ }
36
+ export interface NavigationGroup {
37
+ key: string
38
+ label: string
39
+ items: readonly NavigationItem[]
40
+ }
41
+ export function validateRail(groups: readonly NavigationGroup[]) {
42
+ collectionKeys(groups, 'key')
43
+ for (const group of groups)
44
+ if (!group.label.trim()) throw new TypeError('Navigation groups require labels.')
45
+ validateNavigation(groups.flatMap((group) => group.items))
46
+ }
47
+ export interface BreadcrumbItem {
48
+ key: ChoiceValue
49
+ label: string
50
+ /** All ancestors require a destination. The last entry is the current page. */
51
+ href?: string
52
+ navigate?: LinkNavigate
53
+ }
54
+ export function breadcrumbParts(items: readonly BreadcrumbItem[], maxItems: number) {
55
+ collectionKeys(items, 'key')
56
+ if (!Number.isInteger(maxItems) || maxItems < 2)
57
+ throw new RangeError('Breadcrumb maxItems must be an integer of at least 2.')
58
+ items.forEach((item, index) => {
59
+ if (!item.label.trim()) throw new TypeError('Breadcrumb entries require labels.')
60
+ if (index < items.length - 1 && !item.href)
61
+ throw new TypeError('Breadcrumb ancestors require destinations.')
62
+ if (item.href !== undefined) linkDestination(item.href)
63
+ })
64
+ if (items.length <= maxItems) return { before: items, hidden: [], after: [] }
65
+ const split = items.length - maxItems + 1
66
+ return { before: items.slice(0, 1), hidden: items.slice(1, split), after: items.slice(split) }
67
+ }
68
+ export type TimelineStatus = 'complete' | 'current' | 'upcoming' | 'error'
69
+ export interface TimelineItem {
70
+ key: ChoiceValue
71
+ title: string
72
+ description?: string
73
+ /** Application-formatted text: no implicit timezone or date parsing. */
74
+ time?: string
75
+ status?: TimelineStatus
76
+ icon?: IconName
77
+ }
78
+ export function validateTimeline(items: readonly TimelineItem[]) {
79
+ collectionKeys(items, 'key')
80
+ for (const item of items) {
81
+ if (!item.title.trim()) throw new TypeError('Timeline entries require titles.')
82
+ if (item.status && !['complete', 'current', 'upcoming', 'error'].includes(item.status))
83
+ throw new TypeError('Unknown timeline status.')
84
+ }
85
+ }