@mframework/ui 0.0.1

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 (139) hide show
  1. package/package.json +43 -0
  2. package/src/types/ui/api/global-search.js +1 -0
  3. package/src/types/ui/api/global-search.ts +8 -0
  4. package/src/types/ui/blocks/block-button-group.js +1 -0
  5. package/src/types/ui/blocks/block-button-group.ts +7 -0
  6. package/src/types/ui/blocks/block-button.js +1 -0
  7. package/src/types/ui/blocks/block-button.ts +14 -0
  8. package/src/types/ui/blocks/block-column.js +1 -0
  9. package/src/types/ui/blocks/block-column.ts +20 -0
  10. package/src/types/ui/blocks/block-cta.js +1 -0
  11. package/src/types/ui/blocks/block-cta.ts +10 -0
  12. package/src/types/ui/blocks/block-divider.js +1 -0
  13. package/src/types/ui/blocks/block-divider.ts +4 -0
  14. package/src/types/ui/blocks/block-faq.js +1 -0
  15. package/src/types/ui/blocks/block-faq.ts +12 -0
  16. package/src/types/ui/blocks/block-form.js +1 -0
  17. package/src/types/ui/blocks/block-form.ts +8 -0
  18. package/src/types/ui/blocks/block-gallery.js +1 -0
  19. package/src/types/ui/blocks/block-gallery.ts +14 -0
  20. package/src/types/ui/blocks/block-hero.js +1 -0
  21. package/src/types/ui/blocks/block-hero.ts +12 -0
  22. package/src/types/ui/blocks/block-html.js +1 -0
  23. package/src/types/ui/blocks/block-html.ts +4 -0
  24. package/src/types/ui/blocks/block-logocloud.js +1 -0
  25. package/src/types/ui/blocks/block-logocloud.ts +14 -0
  26. package/src/types/ui/blocks/block-quote.js +1 -0
  27. package/src/types/ui/blocks/block-quote.ts +11 -0
  28. package/src/types/ui/blocks/block-richtext.js +1 -0
  29. package/src/types/ui/blocks/block-richtext.ts +7 -0
  30. package/src/types/ui/blocks/block-steps.js +1 -0
  31. package/src/types/ui/blocks/block-steps.ts +22 -0
  32. package/src/types/ui/blocks/block-team.js +1 -0
  33. package/src/types/ui/blocks/block-team.ts +6 -0
  34. package/src/types/ui/blocks/block-testimonial.js +1 -0
  35. package/src/types/ui/blocks/block-testimonial.ts +14 -0
  36. package/src/types/ui/blocks/block-video.js +1 -0
  37. package/src/types/ui/blocks/block-video.ts +10 -0
  38. package/src/types/ui/blocks/block.js +1 -0
  39. package/src/types/ui/blocks/block.ts +49 -0
  40. package/src/types/ui/blocks/index.js +1 -0
  41. package/src/types/ui/blocks/index.ts +18 -0
  42. package/src/types/ui/component.js +1 -0
  43. package/src/types/ui/component.ts +7 -0
  44. package/src/types/ui/content/category.js +1 -0
  45. package/src/types/ui/content/category.ts +11 -0
  46. package/src/types/ui/content/form.js +1 -0
  47. package/src/types/ui/content/form.ts +20 -0
  48. package/src/types/ui/content/index.js +1 -0
  49. package/src/types/ui/content/index.ts +6 -0
  50. package/src/types/ui/content/page.js +1 -0
  51. package/src/types/ui/content/page.ts +76 -0
  52. package/src/types/ui/content/post.js +1 -0
  53. package/src/types/ui/content/post.ts +39 -0
  54. package/src/types/ui/content/team.js +1 -0
  55. package/src/types/ui/content/team.ts +16 -0
  56. package/src/types/ui/content/testimonial.js +1 -0
  57. package/src/types/ui/content/testimonial.ts +19 -0
  58. package/src/types/ui/env.d.ts +8 -0
  59. package/src/types/ui/form.js +1 -0
  60. package/src/types/ui/form.ts +17 -0
  61. package/src/types/ui/help/index.js +1 -0
  62. package/src/types/ui/help/index.ts +53 -0
  63. package/src/types/ui/meta/analytics.js +1 -0
  64. package/src/types/ui/meta/analytics.ts +18 -0
  65. package/src/types/ui/meta/config.js +1 -0
  66. package/src/types/ui/meta/config.ts +21 -0
  67. package/src/types/ui/meta/globals.js +1 -0
  68. package/src/types/ui/meta/globals.ts +30 -0
  69. package/src/types/ui/meta/index.js +1 -0
  70. package/src/types/ui/meta/index.ts +6 -0
  71. package/src/types/ui/meta/navigation.js +1 -0
  72. package/src/types/ui/meta/navigation.ts +32 -0
  73. package/src/types/ui/meta/redirect.js +1 -0
  74. package/src/types/ui/meta/redirect.ts +13 -0
  75. package/src/types/ui/meta/seo.js +1 -0
  76. package/src/types/ui/meta/seo.ts +19 -0
  77. package/src/types/ui/os/contact.js +1 -0
  78. package/src/types/ui/os/contact.ts +23 -0
  79. package/src/types/ui/os/conversation.js +1 -0
  80. package/src/types/ui/os/conversation.ts +25 -0
  81. package/src/types/ui/os/index.js +1 -0
  82. package/src/types/ui/os/index.ts +16 -0
  83. package/src/types/ui/os/organization.js +1 -0
  84. package/src/types/ui/os/organization.ts +54 -0
  85. package/src/types/ui/os/os-activity.js +1 -0
  86. package/src/types/ui/os/os-activity.ts +28 -0
  87. package/src/types/ui/os/os-deal.js +1 -0
  88. package/src/types/ui/os/os-deal.ts +45 -0
  89. package/src/types/ui/os/os-expense.js +1 -0
  90. package/src/types/ui/os/os-expense.ts +22 -0
  91. package/src/types/ui/os/os-invoice.js +1 -0
  92. package/src/types/ui/os/os-invoice.ts +48 -0
  93. package/src/types/ui/os/os-item.js +1 -0
  94. package/src/types/ui/os/os-item.ts +18 -0
  95. package/src/types/ui/os/os-payment.js +1 -0
  96. package/src/types/ui/os/os-payment.ts +29 -0
  97. package/src/types/ui/os/os-project.js +1 -0
  98. package/src/types/ui/os/os-project.ts +47 -0
  99. package/src/types/ui/os/os-proposal.js +1 -0
  100. package/src/types/ui/os/os-proposal.ts +84 -0
  101. package/src/types/ui/os/os-settings.js +1 -0
  102. package/src/types/ui/os/os-settings.ts +19 -0
  103. package/src/types/ui/os/os-subscription.js +1 -0
  104. package/src/types/ui/os/os-subscription.ts +12 -0
  105. package/src/types/ui/os/os-task.js +1 -0
  106. package/src/types/ui/os/os-task.ts +34 -0
  107. package/src/types/ui/os/os-tax-rate.js +1 -0
  108. package/src/types/ui/os/os-tax-rate.ts +13 -0
  109. package/src/types/ui/pageComponentMap.js +7 -0
  110. package/src/types/ui/pageComponentMap.ts +8 -0
  111. package/src/types/ui/pagination.js +1 -0
  112. package/src/types/ui/pagination.ts +6 -0
  113. package/src/types/ui/schema.d.ts +39 -0
  114. package/src/types/ui/schema.js +1 -0
  115. package/src/types/ui/schema.ts +151 -0
  116. package/src/types/ui/state.js +1 -0
  117. package/src/types/ui/state.ts +5 -0
  118. package/src/types/ui/system/file.js +1 -0
  119. package/src/types/ui/system/file.ts +46 -0
  120. package/src/types/ui/system/folder.js +1 -0
  121. package/src/types/ui/system/folder.ts +8 -0
  122. package/src/types/ui/system/index.js +1 -0
  123. package/src/types/ui/system/index.ts +4 -0
  124. package/src/types/ui/system/role.js +1 -0
  125. package/src/types/ui/system/role.ts +21 -0
  126. package/src/types/ui/system/user.js +1 -0
  127. package/src/types/ui/system/user.ts +56 -0
  128. package/src/types/ui.js +1 -0
  129. package/src/types/ui.ts +23 -0
  130. package/src/utils/color.js +11 -0
  131. package/src/utils/color.ts +14 -0
  132. package/src/utils/fonts.js +18 -0
  133. package/src/utils/fonts.ts +24 -0
  134. package/src/utils/formkit.js +59 -0
  135. package/src/utils/formkit.ts +75 -0
  136. package/src/utils/icons.js +36 -0
  137. package/src/utils/icons.ts +62 -0
  138. package/tailwind.conifg.js +1 -0
  139. package/tsconfig.json +13 -0
@@ -0,0 +1,59 @@
1
+ import { unref } from 'vue';
2
+ function convertBoolean(value) {
3
+ if (value === 'true' || value === 'false') {
4
+ return value === 'true';
5
+ }
6
+ else {
7
+ return value;
8
+ }
9
+ }
10
+ function mapCondition(condition, target) {
11
+ switch (condition) {
12
+ case 'is_empty':
13
+ return `!$get(${target}).value)`;
14
+ case 'is_filled':
15
+ return `$get(${target}).value)`;
16
+ default:
17
+ return undefined;
18
+ }
19
+ }
20
+ export function mapConditions(conditions) {
21
+ // Both $el and $cmp schema nodes can leverage an if property that roughly equates to a v-if in Vue. If the expression assigned to the if property is truthy, the node is rendered, otherwise it is not:
22
+ }
23
+ export function transformSchema(schema) {
24
+ // Loop through the form schema from Directus
25
+ // This is required for FormKit to work
26
+ const items = unref(schema);
27
+ return items.map((item) => {
28
+ const { conditions, field, name, children, ...props } = item;
29
+ // console.log('conditions', conditions);
30
+ // console.log('mapCondition', mapCondition(conditions[0].condition, field));
31
+ const cmpSchema = {
32
+ $cmp: item.$el ? item.$el : 'FormKit',
33
+ children: children,
34
+ // if: conditions ? mapCondition(conditions[0].condition, field) : undefined,
35
+ props: {
36
+ id: name,
37
+ ...props,
38
+ },
39
+ };
40
+ // Switch statement to handle item widths
41
+ switch (item.width) {
42
+ case '33':
43
+ cmpSchema.props.outerClass = 'md:col-span-2';
44
+ break;
45
+ case '50':
46
+ cmpSchema.props.outerClass = 'md:col-span-3';
47
+ break;
48
+ case '67':
49
+ cmpSchema.props.outerClass = 'md:col-span-4';
50
+ break;
51
+ case '100':
52
+ cmpSchema.props.outerClass = 'md:col-span-6';
53
+ break;
54
+ default:
55
+ cmpSchema.props.outerClass = 'md:col-span-6';
56
+ }
57
+ return cmpSchema;
58
+ });
59
+ }
@@ -0,0 +1,75 @@
1
+ import { unref } from 'vue';
2
+
3
+ export interface Condition {
4
+ field: string;
5
+ action: 'show' | 'hide';
6
+ condition: 'is_empty' | 'is_filled' | 'contains' | 'not_contains' | 'equals' | 'not_equal';
7
+ value: string;
8
+ }
9
+
10
+ function convertBoolean(value: string) {
11
+ if (value === 'true' || value === 'false') {
12
+ return value === 'true';
13
+ } else {
14
+ return value;
15
+ }
16
+ }
17
+
18
+ function mapCondition(condition: Condition['condition'], target: string) {
19
+ switch (condition) {
20
+ case 'is_empty':
21
+ return `!$get(${target}).value)`;
22
+ case 'is_filled':
23
+ return `$get(${target}).value)`;
24
+ default:
25
+ return undefined;
26
+ }
27
+ }
28
+
29
+ export function mapConditions(conditions: Condition[]) {
30
+ // Both $el and $cmp schema nodes can leverage an if property that roughly equates to a v-if in Vue. If the expression assigned to the if property is truthy, the node is rendered, otherwise it is not:
31
+ }
32
+
33
+ export function transformSchema(schema: Array<object>) {
34
+ // Loop through the form schema from Directus
35
+ // This is required for FormKit to work
36
+ const items = unref(schema);
37
+ return items.map((item: any) => {
38
+ const { conditions, field, name, children, ...props } = item;
39
+
40
+ // console.log('conditions', conditions);
41
+ // console.log('mapCondition', mapCondition(conditions[0].condition, field));
42
+
43
+ const cmpSchema = {
44
+ $cmp: item.$el ? item.$el : 'FormKit',
45
+
46
+ children: children,
47
+ // if: conditions ? mapCondition(conditions[0].condition, field) : undefined,
48
+
49
+ props: {
50
+ id: name,
51
+ ...props,
52
+ },
53
+ };
54
+
55
+ // Switch statement to handle item widths
56
+ switch (item.width) {
57
+ case '33':
58
+ cmpSchema.props.outerClass = 'md:col-span-2';
59
+ break;
60
+ case '50':
61
+ cmpSchema.props.outerClass = 'md:col-span-3';
62
+ break;
63
+ case '67':
64
+ cmpSchema.props.outerClass = 'md:col-span-4';
65
+ break;
66
+ case '100':
67
+ cmpSchema.props.outerClass = 'md:col-span-6';
68
+ break;
69
+ default:
70
+ cmpSchema.props.outerClass = 'md:col-span-6';
71
+ }
72
+
73
+ return cmpSchema;
74
+ });
75
+ }
@@ -0,0 +1,36 @@
1
+ export const fileIconMap = {
2
+ folder: 'material-symbols:folder',
3
+ // Images
4
+ 'image/jpeg': 'material-symbols:image',
5
+ 'image/png': 'material-symbols:image',
6
+ 'image/gif': 'material-symbols:image',
7
+ 'image/svg+xml': 'material-symbols:image',
8
+ 'image/webp': 'material-symbols:image',
9
+ // Videos
10
+ 'video/mp4': 'material-symbols:smart-display',
11
+ 'video/quicktime': 'material-symbols:smart-display',
12
+ // Audio
13
+ 'audio/mp3': 'material-symbols:audio-file',
14
+ 'audio/aac': 'material-symbols:audio-file',
15
+ 'audio/wav': 'material-symbols:audio-file',
16
+ 'audio/ogg': 'material-symbols:audio-file',
17
+ // Text
18
+ 'text/csv': 'material-symbols:csv',
19
+ 'text/plain': 'material-symbols:text-snippet',
20
+ // Files
21
+ 'application/pdf': 'material-symbols:picture-as-pdf-sharp',
22
+ 'application/vnd.ms-excel': 'material-symbols:sheets',
23
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'material-symbols:sheets',
24
+ 'application/msword': 'material-symbols:docs',
25
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'material-symbols:docs',
26
+ 'application/vnd.ms-powerpoint': 'material-symbols:slides',
27
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'material-symbols:slides',
28
+ };
29
+ export function getFileIcon(filetype) {
30
+ if (!filetype)
31
+ return 'material-symbols:attachment';
32
+ if (typeof filetype === 'string' && !(filetype in fileIconMap)) {
33
+ return 'material-symbols:attachment';
34
+ }
35
+ return fileIconMap[filetype];
36
+ }
@@ -0,0 +1,62 @@
1
+ type FileType =
2
+ | 'folder'
3
+ | 'image/jpeg'
4
+ | 'image/png'
5
+ | 'image/gif'
6
+ | 'image/svg+xml'
7
+ | 'image/webp'
8
+ | 'video/mp4'
9
+ | 'video/quicktime'
10
+ | 'audio/mp3'
11
+ | 'audio/aac'
12
+ | 'audio/wav'
13
+ | 'audio/ogg'
14
+ | 'text/csv'
15
+ | 'text/plain'
16
+ | 'application/pdf'
17
+ | 'application/vnd.ms-excel'
18
+ | 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
19
+ | 'application/msword'
20
+ | 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
21
+ | 'application/vnd.ms-powerpoint'
22
+ | 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
23
+
24
+ export const fileIconMap: Record<FileType, string> = {
25
+ folder: 'material-symbols:folder',
26
+ // Images
27
+ 'image/jpeg': 'material-symbols:image',
28
+ 'image/png': 'material-symbols:image',
29
+ 'image/gif': 'material-symbols:image',
30
+ 'image/svg+xml': 'material-symbols:image',
31
+ 'image/webp': 'material-symbols:image',
32
+ // Videos
33
+ 'video/mp4': 'material-symbols:smart-display',
34
+ 'video/quicktime': 'material-symbols:smart-display',
35
+ // Audio
36
+ 'audio/mp3': 'material-symbols:audio-file',
37
+ 'audio/aac': 'material-symbols:audio-file',
38
+ 'audio/wav': 'material-symbols:audio-file',
39
+ 'audio/ogg': 'material-symbols:audio-file',
40
+ // Text
41
+ 'text/csv': 'material-symbols:csv',
42
+ 'text/plain': 'material-symbols:text-snippet',
43
+
44
+ // Files
45
+ 'application/pdf': 'material-symbols:picture-as-pdf-sharp',
46
+ 'application/vnd.ms-excel': 'material-symbols:sheets',
47
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'material-symbols:sheets',
48
+ 'application/msword': 'material-symbols:docs',
49
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'material-symbols:docs',
50
+ 'application/vnd.ms-powerpoint': 'material-symbols:slides',
51
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'material-symbols:slides',
52
+ };
53
+
54
+ export function getFileIcon(filetype: FileType | string | null | undefined) {
55
+ if (!filetype) return 'material-symbols:attachment';
56
+
57
+ if (typeof filetype === 'string' && !(filetype in fileIconMap)) {
58
+ return 'material-symbols:attachment';
59
+ }
60
+
61
+ return fileIconMap[filetype as FileType];
62
+ }
@@ -0,0 +1 @@
1
+ export const content = ['components/**/*.{vue,js}', 'pages/**/*.vue'];
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Node",
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "strict": false,
9
+ "lib": ["ES2020", "DOM"],
10
+ "resolveJsonModule": true
11
+ },
12
+ "include": ["**/*.ts", "**/*.d.ts"]
13
+ }