@meeovi/layer-shared 1.0.0

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 (327) hide show
  1. package/README.md +0 -0
  2. package/app/components/Gallery/Gallery.vue +187 -0
  3. package/app/components/Gallery/__tests__/Gallery.spec.ts +14 -0
  4. package/app/components/Heading/Heading.vue +14 -0
  5. package/app/components/Heading/__tests__/Heading.spec.ts +14 -0
  6. package/app/components/Heading/types.ts +5 -0
  7. package/app/components/media/audioGallery.vue +70 -0
  8. package/app/components/media/dragDropUpload.vue +67 -0
  9. package/app/components/media/fullscreenMediaModal.vue +66 -0
  10. package/app/components/media/imageCard.vue +65 -0
  11. package/app/components/media/imageGallery.vue +40 -0
  12. package/app/components/media/mediaCard.vue +89 -0
  13. package/app/components/media/mediaCarousel.vue +65 -0
  14. package/app/components/media/mediaFolderSidebar.vue +72 -0
  15. package/app/components/media/mediaPlayer.vue +40 -0
  16. package/app/components/media/mediaSearchBar.vue +16 -0
  17. package/app/components/media/videoGallery.vue +77 -0
  18. package/app/components/ui/AccordionItem/AccordionItem.vue +24 -0
  19. package/app/components/ui/AccordionItem/__tests__/AccordionItem.spec.ts +14 -0
  20. package/app/components/ui/AccordionItem/types.ts +5 -0
  21. package/app/components/ui/Alert/Alert.vue +34 -0
  22. package/app/components/ui/Alert/types.ts +5 -0
  23. package/app/components/ui/Breadcrumbs/Breadcrumbs.vue +76 -0
  24. package/app/components/ui/Breadcrumbs/__tests__/Breadcrumbs.spec.ts +14 -0
  25. package/app/components/ui/Breadcrumbs/types.ts +8 -0
  26. package/app/components/ui/CartProductCard/CartProductCard.vue +66 -0
  27. package/app/components/ui/CartProductCard/types.ts +18 -0
  28. package/app/components/ui/CategoryCard/CategoryCard.vue +41 -0
  29. package/app/components/ui/CategoryCard/types.ts +9 -0
  30. package/app/components/ui/Display/Display.vue +55 -0
  31. package/app/components/ui/Display/types.ts +12 -0
  32. package/app/components/ui/Divider/Divider.vue +3 -0
  33. package/app/components/ui/Divider/__tests__/Divider.spec.tsx +10 -0
  34. package/app/components/ui/Footer.vue +92 -0
  35. package/app/components/ui/Form/FormHelperText.vue +5 -0
  36. package/app/components/ui/Form/FormLabel.vue +5 -0
  37. package/app/components/ui/Form/FormPasswordInput.vue +15 -0
  38. package/app/components/ui/Form/__tests__/FormHelperText.spec.ts +10 -0
  39. package/app/components/ui/Form/__tests__/FormLabel.spec.ts +10 -0
  40. package/app/components/ui/Hero/Hero.vue +44 -0
  41. package/app/components/ui/Hero/types.ts +10 -0
  42. package/app/components/ui/Modal/Modal.vue +19 -0
  43. package/app/components/ui/Modal/types.ts +8 -0
  44. package/app/components/ui/Motionable.vue +45 -0
  45. package/app/components/ui/NavbarBottom.vue +63 -0
  46. package/app/components/ui/NavbarTop.vue +25 -0
  47. package/app/components/ui/Overlay/Overlay.vue +14 -0
  48. package/app/components/ui/Overlay/__tests__/Overlay.spec.ts +14 -0
  49. package/app/components/ui/Overlay/types.ts +3 -0
  50. package/app/components/ui/PageBuilder.vue +39 -0
  51. package/app/components/ui/PageContainer.vue +5 -0
  52. package/app/components/ui/Pagination/Pagination.vue +151 -0
  53. package/app/components/ui/Pagination/__tests__/Pagination.spec.ts +17 -0
  54. package/app/components/ui/Pagination/types.ts +6 -0
  55. package/app/components/ui/ProductCard/ProductCard.vue +55 -0
  56. package/app/components/ui/ProductCard/__tests__/ProductCard.spec.ts +16 -0
  57. package/app/components/ui/ProductCard/types.ts +12 -0
  58. package/app/components/ui/ProductCardHorizontal/ProductCardHorizontal.vue +34 -0
  59. package/app/components/ui/ProductCardHorizontal/__tests__/ProductCardHorizontal.spec.ts +36 -0
  60. package/app/components/ui/ProductCardHorizontal/types.ts +8 -0
  61. package/app/components/ui/PurchaseCard/PurchaseCard.vue +109 -0
  62. package/app/components/ui/PurchaseCard/__tests__/PurchaseCard.spec.ts +15 -0
  63. package/app/components/ui/PurchaseCard/types.ts +5 -0
  64. package/app/components/ui/QuantitySelector/QuantitySelector.vue +69 -0
  65. package/app/components/ui/QuantitySelector/__tests__/QuantitySelector.spec.ts +15 -0
  66. package/app/components/ui/QuantitySelector/types.ts +5 -0
  67. package/app/components/ui/RadialProgress.vue +44 -0
  68. package/app/components/ui/Review/Review.vue +57 -0
  69. package/app/components/ui/Review/__tests__/Review.spec.ts +15 -0
  70. package/app/components/ui/Review/types.ts +5 -0
  71. package/app/components/ui/ScrollTop.vue +82 -0
  72. package/app/components/ui/Search.vue +54 -0
  73. package/app/components/ui/Tag/Tag.vue +38 -0
  74. package/app/components/ui/Tag/__tests__/Tag.spec.ts +10 -0
  75. package/app/components/ui/Tag/types.ts +16 -0
  76. package/app/components/ui/VsfLogo.vue +7 -0
  77. package/app/components/ui/forms/BooleanInput.vue +34 -0
  78. package/app/components/ui/forms/DateTime.vue +44 -0
  79. package/app/components/ui/forms/DirectusFormElement.vue +60 -0
  80. package/app/components/ui/forms/DynamicTableElement.vue +57 -0
  81. package/app/components/ui/forms/FileInput.vue +85 -0
  82. package/app/components/ui/forms/FormField.vue +34 -0
  83. package/app/components/ui/forms/RelationSelect.vue +63 -0
  84. package/app/components/ui/forms/RepeaterInput.vue +121 -0
  85. package/app/components/ui/forms/SelectInput.vue +65 -0
  86. package/app/components/ui/forms/TextArea.vue +59 -0
  87. package/app/components/ui/forms/TextInput.vue +42 -0
  88. package/app/components/ui/forms/TiptapEditor.vue +136 -0
  89. package/app/components/ui/forms/[collection].vue +22 -0
  90. package/app/components/ui/studio/builder.vue +57 -0
  91. package/app/components/ui/studio/document.vue +69 -0
  92. package/app/components/ui/studio/email.vue +57 -0
  93. package/app/composables/globals/uploadFiles.js +41 -0
  94. package/app/composables/globals/useAdminTable.ts +12 -0
  95. package/app/composables/globals/useCustomFetch.ts +13 -0
  96. package/app/composables/globals/useDirectusField.ts +144 -0
  97. package/app/composables/globals/useDirectusForm.ts +70 -0
  98. package/app/composables/globals/useDirectusSchema.js +9 -0
  99. package/app/composables/globals/useFileManager.ts +76 -0
  100. package/app/composables/globals/useLivePreview.ts +17 -0
  101. package/app/composables/globals/useLoading.ts +23 -0
  102. package/app/composables/globals/useNavigation.js +19 -0
  103. package/app/composables/globals/useNotifications.ts +153 -0
  104. package/app/composables/globals/usePages.js +36 -0
  105. package/app/composables/globals/useRichText.ts +33 -0
  106. package/app/composables/globals/useServerRootMixin.ts +19 -0
  107. package/app/composables/globals/useVisualEditing.ts +38 -0
  108. package/app/composables/media/useFile.ts +6 -0
  109. package/app/composables/media/useMediaCenter.ts +353 -0
  110. package/app/composables/media/useVideojs.ts +45 -0
  111. package/app/composables/registry.ts +13 -0
  112. package/app/composables/types.ts +12 -0
  113. package/app/composables/useContent.ts +13 -0
  114. package/app/composables/useDirectusRequest.ts +32 -0
  115. package/app/stores/index.ts +0 -0
  116. package/app/types/api/global-search.ts +8 -0
  117. package/app/types/blocks/block-button-group.ts +7 -0
  118. package/app/types/blocks/block-button.ts +14 -0
  119. package/app/types/blocks/block-column.ts +20 -0
  120. package/app/types/blocks/block-cta.ts +10 -0
  121. package/app/types/blocks/block-divider.ts +4 -0
  122. package/app/types/blocks/block-faq.ts +12 -0
  123. package/app/types/blocks/block-form.ts +8 -0
  124. package/app/types/blocks/block-gallery.ts +14 -0
  125. package/app/types/blocks/block-hero.ts +12 -0
  126. package/app/types/blocks/block-html.ts +4 -0
  127. package/app/types/blocks/block-logocloud.ts +14 -0
  128. package/app/types/blocks/block-quote.ts +11 -0
  129. package/app/types/blocks/block-richtext.ts +7 -0
  130. package/app/types/blocks/block-steps.ts +22 -0
  131. package/app/types/blocks/block-team.ts +6 -0
  132. package/app/types/blocks/block-testimonial.ts +14 -0
  133. package/app/types/blocks/block-video.ts +10 -0
  134. package/app/types/blocks/block.ts +49 -0
  135. package/app/types/blocks/index.ts +18 -0
  136. package/app/types/componentMap.ts +15 -0
  137. package/app/types/content/category.ts +11 -0
  138. package/app/types/content/form.ts +20 -0
  139. package/app/types/content/index.ts +6 -0
  140. package/app/types/content/page.ts +76 -0
  141. package/app/types/content/post.ts +39 -0
  142. package/app/types/content/team.ts +16 -0
  143. package/app/types/content/testimonial.ts +19 -0
  144. package/app/types/directus.d.ts +47 -0
  145. package/app/types/env.d.ts +8 -0
  146. package/app/types/help/index.ts +53 -0
  147. package/app/types/index.d.ts +9 -0
  148. package/app/types/index.ts +7 -0
  149. package/app/types/meta/analytics.ts +18 -0
  150. package/app/types/meta/config.ts +21 -0
  151. package/app/types/meta/globals.ts +30 -0
  152. package/app/types/meta/index.ts +6 -0
  153. package/app/types/meta/navigation.ts +32 -0
  154. package/app/types/meta/redirect.ts +13 -0
  155. package/app/types/meta/seo.ts +19 -0
  156. package/app/types/os/contact.ts +23 -0
  157. package/app/types/os/conversation.ts +25 -0
  158. package/app/types/os/index.ts +16 -0
  159. package/app/types/os/organization.ts +54 -0
  160. package/app/types/os/os-activity.ts +28 -0
  161. package/app/types/os/os-deal.ts +45 -0
  162. package/app/types/os/os-expense.ts +22 -0
  163. package/app/types/os/os-invoice.ts +48 -0
  164. package/app/types/os/os-item.ts +18 -0
  165. package/app/types/os/os-payment.ts +29 -0
  166. package/app/types/os/os-project.ts +47 -0
  167. package/app/types/os/os-proposal.ts +84 -0
  168. package/app/types/os/os-settings.ts +19 -0
  169. package/app/types/os/os-subscription.ts +12 -0
  170. package/app/types/os/os-task.ts +34 -0
  171. package/app/types/os/os-tax-rate.ts +13 -0
  172. package/app/types/pageComponentMap.ts +8 -0
  173. package/app/types/schema.d.ts +39 -0
  174. package/app/types/schema.ts +151 -0
  175. package/app/types/system/file.ts +46 -0
  176. package/app/types/system/folder.ts +8 -0
  177. package/app/types/system/index.ts +4 -0
  178. package/app/types/system/role.ts +21 -0
  179. package/app/types/system/user.ts +56 -0
  180. package/app/utils/Timer.js +44 -0
  181. package/app/utils/billing-address.ts +24 -0
  182. package/app/utils/color.ts +14 -0
  183. package/app/utils/currency.ts +29 -0
  184. package/app/utils/embed.ts +57 -0
  185. package/app/utils/errors.ts +9 -0
  186. package/app/utils/fieldRegistry.js +89 -0
  187. package/app/utils/fonts.ts +24 -0
  188. package/app/utils/formkit.ts +75 -0
  189. package/app/utils/icons.ts +62 -0
  190. package/app/utils/index.js +0 -0
  191. package/app/utils/links.ts +28 -0
  192. package/app/utils/lodash.ts +33 -0
  193. package/app/utils/markdown.ts +9 -0
  194. package/app/utils/math.ts +25 -0
  195. package/app/utils/navigation.ts +11 -0
  196. package/app/utils/objects.ts +11 -0
  197. package/app/utils/paths.ts +21 -0
  198. package/app/utils/relations.ts +33 -0
  199. package/app/utils/strings.ts +113 -0
  200. package/app/utils/time.ts +148 -0
  201. package/app/utils/url.ts +22 -0
  202. package/app/utils/user-name.ts +21 -0
  203. package/app/utils/video/README.md +51 -0
  204. package/app/utils/video/playlist.js +0 -0
  205. package/dist/api/global-search.d.ts +8 -0
  206. package/dist/api/global-search.js +1 -0
  207. package/dist/blocks/block-button-group.d.ts +6 -0
  208. package/dist/blocks/block-button-group.js +1 -0
  209. package/dist/blocks/block-button.d.ts +13 -0
  210. package/dist/blocks/block-button.js +1 -0
  211. package/dist/blocks/block-column.d.ts +18 -0
  212. package/dist/blocks/block-column.js +1 -0
  213. package/dist/blocks/block-cta.d.ts +11 -0
  214. package/dist/blocks/block-cta.js +1 -0
  215. package/dist/blocks/block-divider.d.ts +4 -0
  216. package/dist/blocks/block-divider.js +1 -0
  217. package/dist/blocks/block-faq.d.ts +11 -0
  218. package/dist/blocks/block-faq.js +1 -0
  219. package/dist/blocks/block-form.d.ts +7 -0
  220. package/dist/blocks/block-form.js +1 -0
  221. package/dist/blocks/block-gallery.d.ts +13 -0
  222. package/dist/blocks/block-gallery.js +1 -0
  223. package/dist/blocks/block-hero.d.ts +11 -0
  224. package/dist/blocks/block-hero.js +1 -0
  225. package/dist/blocks/block-html.d.ts +4 -0
  226. package/dist/blocks/block-html.js +1 -0
  227. package/dist/blocks/block-logocloud.d.ts +13 -0
  228. package/dist/blocks/block-logocloud.js +1 -0
  229. package/dist/blocks/block-quote.d.ts +10 -0
  230. package/dist/blocks/block-quote.js +1 -0
  231. package/dist/blocks/block-richtext.d.ts +7 -0
  232. package/dist/blocks/block-richtext.js +1 -0
  233. package/dist/blocks/block-steps.d.ts +21 -0
  234. package/dist/blocks/block-steps.js +1 -0
  235. package/dist/blocks/block-team.d.ts +6 -0
  236. package/dist/blocks/block-team.js +1 -0
  237. package/dist/blocks/block-testimonial.d.ts +13 -0
  238. package/dist/blocks/block-testimonial.js +1 -0
  239. package/dist/blocks/block-video.d.ts +9 -0
  240. package/dist/blocks/block-video.js +1 -0
  241. package/dist/blocks/block.d.ts +17 -0
  242. package/dist/blocks/block.js +1 -0
  243. package/dist/blocks/index.d.ts +18 -0
  244. package/dist/blocks/index.js +1 -0
  245. package/dist/componentMap.d.ts +6 -0
  246. package/dist/componentMap.js +8 -0
  247. package/dist/content/category.d.ts +10 -0
  248. package/dist/content/category.js +1 -0
  249. package/dist/content/form.d.ts +21 -0
  250. package/dist/content/form.js +1 -0
  251. package/dist/content/index.d.ts +6 -0
  252. package/dist/content/index.js +1 -0
  253. package/dist/content/page.d.ts +38 -0
  254. package/dist/content/page.js +1 -0
  255. package/dist/content/post.d.ts +38 -0
  256. package/dist/content/post.js +1 -0
  257. package/dist/content/team.d.ts +17 -0
  258. package/dist/content/team.js +1 -0
  259. package/dist/content/testimonial.d.ts +18 -0
  260. package/dist/content/testimonial.js +1 -0
  261. package/dist/help/index.d.ts +51 -0
  262. package/dist/help/index.js +1 -0
  263. package/dist/index.d.ts +7 -0
  264. package/dist/index.js +1 -0
  265. package/dist/meta/analytics.d.ts +21 -0
  266. package/dist/meta/analytics.js +1 -0
  267. package/dist/meta/config.d.ts +22 -0
  268. package/dist/meta/config.js +1 -0
  269. package/dist/meta/globals.d.ts +33 -0
  270. package/dist/meta/globals.js +1 -0
  271. package/dist/meta/index.d.ts +6 -0
  272. package/dist/meta/index.js +1 -0
  273. package/dist/meta/navigation.d.ts +31 -0
  274. package/dist/meta/navigation.js +1 -0
  275. package/dist/meta/redirect.d.ts +12 -0
  276. package/dist/meta/redirect.js +1 -0
  277. package/dist/meta/seo.d.ts +19 -0
  278. package/dist/meta/seo.js +1 -0
  279. package/dist/os/contact.d.ts +22 -0
  280. package/dist/os/contact.js +1 -0
  281. package/dist/os/conversation.d.ts +23 -0
  282. package/dist/os/conversation.js +1 -0
  283. package/dist/os/index.d.ts +16 -0
  284. package/dist/os/index.js +1 -0
  285. package/dist/os/organization.d.ts +51 -0
  286. package/dist/os/organization.js +1 -0
  287. package/dist/os/os-activity.d.ts +26 -0
  288. package/dist/os/os-activity.js +1 -0
  289. package/dist/os/os-deal.d.ts +42 -0
  290. package/dist/os/os-deal.js +1 -0
  291. package/dist/os/os-expense.d.ts +21 -0
  292. package/dist/os/os-expense.js +1 -0
  293. package/dist/os/os-invoice.d.ts +46 -0
  294. package/dist/os/os-invoice.js +1 -0
  295. package/dist/os/os-item.d.ts +17 -0
  296. package/dist/os/os-item.js +1 -0
  297. package/dist/os/os-payment.d.ts +27 -0
  298. package/dist/os/os-payment.js +1 -0
  299. package/dist/os/os-project.d.ts +45 -0
  300. package/dist/os/os-project.js +1 -0
  301. package/dist/os/os-proposal.d.ts +61 -0
  302. package/dist/os/os-proposal.js +1 -0
  303. package/dist/os/os-settings.d.ts +17 -0
  304. package/dist/os/os-settings.js +1 -0
  305. package/dist/os/os-subscription.d.ts +12 -0
  306. package/dist/os/os-subscription.js +1 -0
  307. package/dist/os/os-task.d.ts +32 -0
  308. package/dist/os/os-task.js +1 -0
  309. package/dist/os/os-tax-rate.d.ts +12 -0
  310. package/dist/os/os-tax-rate.js +1 -0
  311. package/dist/pageComponentMap.d.ts +2 -0
  312. package/dist/pageComponentMap.js +7 -0
  313. package/dist/schema.d.ts +78 -0
  314. package/dist/schema.js +1 -0
  315. package/dist/system/file.d.ts +47 -0
  316. package/dist/system/file.js +1 -0
  317. package/dist/system/folder.d.ts +8 -0
  318. package/dist/system/folder.js +1 -0
  319. package/dist/system/index.d.ts +4 -0
  320. package/dist/system/index.js +1 -0
  321. package/dist/system/role.d.ts +20 -0
  322. package/dist/system/role.js +1 -0
  323. package/dist/system/user.d.ts +57 -0
  324. package/dist/system/user.js +1 -0
  325. package/nuxt.config.ts +5 -0
  326. package/package.json +42 -0
  327. package/tsconfig.json +15 -0
@@ -0,0 +1,11 @@
1
+ import type { NavigationItem, Page } from '../types';
2
+
3
+ export function getNavItemUrl(item: NavigationItem): string | null {
4
+ if (item.type === 'page' && (item.page as Page)) {
5
+ return (item.page as Page)?.permalink;
6
+ } else if (item.type === 'url' && item.url) {
7
+ return item.url as string;
8
+ }
9
+
10
+ return null;
11
+ }
@@ -0,0 +1,11 @@
1
+ // Clone an onbject deeply
2
+ export function cloneObject(obj: any): any {
3
+ return JSON.parse(JSON.stringify(obj));
4
+ }
5
+ // Clone an array deeply
6
+ export function cloneArray(arr: any[]): any[] {
7
+ return JSON.parse(JSON.stringify(arr));
8
+ }
9
+ export function isObject(objValue: any) {
10
+ return objValue && typeof objValue === 'object' && objValue.constructor === Object;
11
+ }
@@ -0,0 +1,21 @@
1
+ export const paths = {
2
+ home: '/',
3
+ category: '/category',
4
+ product: '/product/',
5
+ cart: '/cart',
6
+ checkout: '/checkout',
7
+ search: '/search',
8
+ account: '/my-account',
9
+ orderSuccess: '/order/success',
10
+ orderFailed: '/order/failed',
11
+ accountPersonalData: '/my-account/personal-data',
12
+ accountBillingDetails: '/my-account/billing-details',
13
+ accountShippingDetails: '/my-account/shipping-details',
14
+ accountMyOrders: '/my-account/my-orders',
15
+ accountReturns: '/my-account/returns',
16
+ authResetPassword: '/reset-password',
17
+ authResetPasswordSuccess: '/reset-password-success',
18
+ authSetNewPassword: '/set-new-password',
19
+ authLogin: '/login',
20
+ authSignup: '/signup',
21
+ };
@@ -0,0 +1,33 @@
1
+ export function safeRelation(
2
+ idOrObject: string | { [key: string]: any } | null | undefined,
3
+ ): { id: string; [key: string]: any } | null | undefined {
4
+ if (!idOrObject) return undefined;
5
+
6
+ if (typeof idOrObject === 'string') {
7
+ return {
8
+ id: idOrObject,
9
+ };
10
+ }
11
+
12
+ if (idOrObject.id) {
13
+ return idOrObject.id;
14
+ }
15
+
16
+ return null;
17
+ }
18
+
19
+ export function safeRelationId(
20
+ idOrObject: string | { [key: string]: any } | null | undefined,
21
+ ): string | null | undefined {
22
+ if (!idOrObject) return null;
23
+
24
+ if (typeof idOrObject === 'string') {
25
+ return idOrObject;
26
+ }
27
+
28
+ if (idOrObject.id) {
29
+ return idOrObject.id;
30
+ }
31
+
32
+ return null;
33
+ }
@@ -0,0 +1,113 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+
3
+ function generateId(): string {
4
+ return uuidv4();
5
+ }
6
+
7
+ function stripHTML(original: string | undefined): string | undefined {
8
+ if (!original) return;
9
+ else return original.replace(/(<([^>]+)>)/gi, '');
10
+ }
11
+
12
+ function truncateString(str: string | undefined, num: number): string | undefined {
13
+ if (!str) return;
14
+
15
+ if (str.length <= num) {
16
+ return str;
17
+ }
18
+
19
+ return str.slice(0, num) + '...';
20
+ }
21
+
22
+ function truncateHTML(html: string | undefined, num: number): string | undefined {
23
+ if (!html) return;
24
+ return truncateString(stripHTML(html), num);
25
+ }
26
+
27
+ // Slugify a string for hyphens and underscores
28
+ function slugify(str: string | undefined): string | undefined {
29
+ if (!str) return;
30
+ return str
31
+ .toString()
32
+ .trim()
33
+ .toLowerCase()
34
+ .replace(/[^\w ]+/g, '')
35
+ .replace(/ +/g, '-');
36
+ }
37
+
38
+ // Deslugify a string for hyphens and underscores and capitalize each word
39
+ function deslugify(str: string | undefined): string | undefined {
40
+ if (!str) return;
41
+ return str
42
+ .trim()
43
+ .toLowerCase()
44
+ .replace(/[-_]+/g, ' ')
45
+ .replace(/ +/g, ' ')
46
+ .replace(/(^| )(\w)/g, (s) => s.toUpperCase());
47
+ }
48
+
49
+ function getDomainNameFromEmail(email: string): string {
50
+ const temp = email.replace(/.*@/, '').split('.');
51
+ return temp[temp.length - 2] ?? temp[0] ?? '';
52
+ }
53
+
54
+ function toTitleCase(str: string | undefined): string | undefined {
55
+ if (!str) return;
56
+ return str.replace(/\w\S*/g, function (txt) {
57
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
58
+ });
59
+ }
60
+
61
+ function snakeToCamel(s: string): string {
62
+ return s.replace(/_(\w)/g, function (_m, p1) {
63
+ return p1 ? p1.toUpperCase() : '';
64
+ });
65
+ }
66
+
67
+ function convertIconName(name: string): string | null | undefined {
68
+ if (!name) return;
69
+ // Convert the icon coming from the API to the name of the icon component
70
+ // Directus uses Google Material Icons and the icon values are snake_case (e.g. "account_circle")
71
+ const prefix = 'material-symbols:';
72
+ // Change snake case to kebab case
73
+ const kebabCase = name.replace(/_/g, '-');
74
+ const iconName = prefix + kebabCase;
75
+ return iconName;
76
+ }
77
+
78
+ function snakeToKebab(s: string): string {
79
+ return s.replace(/_(\w)/g, function (_m, p1) {
80
+ return p1 ? '-' + p1.toLowerCase() : '';
81
+ });
82
+ }
83
+
84
+ function maybePluralize(count: number, noun: string, suffix = 's'): string {
85
+ return `${noun}${count !== 1 ? suffix : ''}`;
86
+ }
87
+
88
+ // Calculate read time for a string
89
+ function calculateReadTime(str: string | undefined, wordsPerMinute = 200): string | undefined {
90
+ if (!str) return;
91
+ // Strip HTML tags
92
+ str = str.replace(/(<([^>]+)>)/gi, '');
93
+ const noOfWords = str.split(/\s/g).length;
94
+ const minutes = noOfWords / wordsPerMinute;
95
+ const readTime = Math.ceil(minutes);
96
+ return readTime + ' min read';
97
+ }
98
+
99
+ export {
100
+ generateId,
101
+ stripHTML,
102
+ truncateHTML,
103
+ truncateString,
104
+ maybePluralize,
105
+ toTitleCase,
106
+ snakeToCamel,
107
+ snakeToKebab,
108
+ convertIconName,
109
+ slugify,
110
+ deslugify,
111
+ getDomainNameFromEmail,
112
+ calculateReadTime,
113
+ };
@@ -0,0 +1,148 @@
1
+ const months: string[] = [
2
+ 'January',
3
+ 'February',
4
+ 'March',
5
+ 'April',
6
+ 'May',
7
+ 'June',
8
+ 'July',
9
+ 'August',
10
+ 'September',
11
+ 'October',
12
+ 'November',
13
+ 'December',
14
+ ];
15
+
16
+ const days: string[] = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
17
+
18
+ const monthsAbbr: string[] = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
19
+
20
+ const daysAbbr: string[] = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
21
+
22
+ const units: Record<string, number> = {
23
+ year: 24 * 60 * 60 * 1000 * 365,
24
+ month: (24 * 60 * 60 * 1000 * 365) / 12,
25
+ week: 24 * 60 * 60 * 1000 * 7,
26
+ day: 24 * 60 * 60 * 1000,
27
+ hour: 60 * 60 * 1000,
28
+ minute: 60 * 1000,
29
+ second: 1000,
30
+ };
31
+
32
+ const rtf = new Intl.RelativeTimeFormat('en', { numeric: 'auto' });
33
+
34
+ function getRelativeTime(d1: Date | string, d2: Date = new Date()): string {
35
+ if (!(d1 instanceof Date)) d1 = new Date(d1);
36
+
37
+ const elapsed = d1.getTime() - d2.getTime();
38
+
39
+ for (const u in units) {
40
+ if (Math.abs(elapsed) > units[u] || u === 'second') {
41
+ return rtf.format(Math.round(elapsed / units[u]), u as Intl.RelativeTimeFormatUnit);
42
+ }
43
+ }
44
+
45
+ return '';
46
+ }
47
+
48
+ function getFriendlyDate(dateString: string, { monthAbbr = {} } = {}): string {
49
+ const d = new Date(dateString);
50
+ const year = d.getFullYear();
51
+ const date = d.getDate();
52
+
53
+ const dateSuffix = (date: number): string => {
54
+ if (date > 3 && date < 21) return 'th';
55
+
56
+ switch (date % 10) {
57
+ case 1:
58
+ return 'st';
59
+ case 2:
60
+ return 'nd';
61
+ case 3:
62
+ return 'rd';
63
+ default:
64
+ return 'th';
65
+ }
66
+ };
67
+
68
+ const monthIndex = d.getMonth();
69
+
70
+ const monthName = monthAbbr ? monthsAbbr[monthIndex] : months[monthIndex];
71
+
72
+ const dayName = daysAbbr[d.getDay()];
73
+ const formatted = `${dayName}, ${monthName} ${date}${dateSuffix(date)}, ${year}`;
74
+ return formatted;
75
+ }
76
+
77
+ function destructureDate(date: string): Record<string, number | string> {
78
+ const d = new Date(date);
79
+ const year = d.getFullYear();
80
+ const month = d.getMonth();
81
+ const day = d.getDate();
82
+ const dayName = days[d.getDay()];
83
+ const monthName = monthsAbbr[month];
84
+ const hour = d.getHours();
85
+ const minute = d.getMinutes();
86
+ const second = d.getSeconds();
87
+ return { year, month, day, hour, minute, second, dayName, monthName };
88
+ }
89
+
90
+ function greetUser(): string {
91
+ const hour = new Date().getHours();
92
+ if (hour < 12) return 'Good Morning';
93
+ if (hour < 18) return 'Good Afternoon';
94
+ return 'Good Evening';
95
+ }
96
+
97
+ function subtractDates(date1: string | number | Date, date2: string | number | Date, unit?: string): number {
98
+ if (isNaN(date1 as number) || isNaN(date2 as number)) {
99
+ date1 = new Date(date1);
100
+ date2 = new Date(date2);
101
+ }
102
+
103
+ const diff = (date1 as Date).getTime() - (date2 as Date).getTime();
104
+ if (unit === 'years') return diff / units.year;
105
+ if (unit === 'months') return diff / units.month;
106
+ if (unit === 'weeks') return diff / units.week;
107
+ if (unit === 'days') return diff / units.day;
108
+ if (unit === 'hours') return diff / units.hour;
109
+ if (unit === 'minutes') return diff / units.minute;
110
+ if (unit === 'seconds') return diff / units.second;
111
+ return diff;
112
+ }
113
+
114
+ function toDateTime(secs: number): Date {
115
+ const t = new Date('1970-01-01T00:30:00Z');
116
+ t.setSeconds(secs);
117
+ return t;
118
+ }
119
+
120
+ function getMonth(dateString: string): string {
121
+ const d = new Date(dateString);
122
+ const monthIndex = d.getMonth();
123
+ return monthsAbbr[monthIndex];
124
+ }
125
+
126
+ function getDate(dateString: string): number {
127
+ const d = new Date(dateString);
128
+ return d.getDate();
129
+ }
130
+
131
+ function getDay(dateString: string): string {
132
+ const d = new Date(dateString);
133
+ const dayIndex = d.getDay();
134
+ return days[dayIndex];
135
+ }
136
+
137
+ export {
138
+ getRelativeTime,
139
+ getFriendlyDate,
140
+ greetUser,
141
+ toDateTime,
142
+ subtractDates as subtractDates,
143
+ monthsAbbr,
144
+ destructureDate,
145
+ getMonth,
146
+ getDate,
147
+ getDay,
148
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Encode filename for URL usage
3
+ */
4
+ export function encodeImageSlug (pathname: string): string {
5
+ return encodeURIComponent(pathname.split('.')[0] as string)
6
+ }
7
+
8
+ /**
9
+ * Decode URL slug back to filename
10
+ */
11
+ export function decodeImageSlug (slug: string): string {
12
+ return decodeURIComponent(slug)
13
+ }
14
+
15
+ /**
16
+ * Check if two image paths match (handling encoding)
17
+ */
18
+ export function isImageMatch (pathname: string, slug: string): boolean {
19
+ const imageName = pathname.split('.')[0]
20
+ const decodedSlug = decodeImageSlug(slug)
21
+ return imageName === decodedSlug
22
+ }
@@ -0,0 +1,21 @@
1
+ import type { User } from '../types';
2
+
3
+ export function userName(user: Partial<User>): string {
4
+ if (!user) {
5
+ return 'Unknown User' as string;
6
+ }
7
+
8
+ if (user.first_name && user.last_name) {
9
+ return `${user.first_name} ${user.last_name}`;
10
+ }
11
+
12
+ if (user.first_name) {
13
+ return user.first_name;
14
+ }
15
+
16
+ if (user.email) {
17
+ return user.email;
18
+ }
19
+
20
+ return 'Unknown User' as string;
21
+ }
@@ -0,0 +1,51 @@
1
+ Video plugin folder
2
+ ====================
3
+
4
+ Any JS files placed under this folder will be auto-registered as Video.js plugins on client-side app boot.
5
+
6
+ Auto-registration rules
7
+ ----------------------
8
+
9
+ - Files are discovered via a build-time glob and registered automatically when the app runs in the browser.
10
+ - The plugin name is derived from the file base name (e.g. `hls.js` -> `hls`).
11
+ - If a module exports a `name` property, that value will be used instead of the filename.
12
+ - Modules should default-export the plugin function (or export an object with a `default` property).
13
+
14
+ Example plugin file (`hls.js`)
15
+ ------------------------------
16
+
17
+ ```js
18
+ export default function hls(player, options = {}) {
19
+ // plugin code
20
+ }
21
+ ```
22
+
23
+ Manual registration
24
+ -------------------
25
+
26
+ If you need to register plugins manually (for example dynamically or from another module), you can use the registration helpers exposed by the shared Nuxt plugin.
27
+
28
+ From a component or composable:
29
+
30
+ ```js
31
+ const nuxtApp = useNuxtApp()
32
+ // register single
33
+ nuxtApp.$registerVideojsPlugin('hls', hls)
34
+
35
+ // register multiple
36
+ nuxtApp.$registerVideojsPlugins({ hls: hls, other: otherPlugin })
37
+ ```
38
+
39
+ Or via the `useVideojs` composable:
40
+
41
+ ```js
42
+ import useVideojs from '~/layers/shared-app/app/composables/media/useVideojs'
43
+ const { registerVideojsPlugin } = useVideojs()
44
+ registerVideojsPlugin('hls', hls)
45
+ ```
46
+
47
+ Notes
48
+ -----
49
+
50
+ - Auto-registration runs only on the client (browser) to avoid server-side Video.js init.
51
+ - Keep plugin modules small — this folder is intended for thin helpers that call into the Video.js player API.
File without changes
@@ -0,0 +1,8 @@
1
+ export interface GlobalSearchResult {
2
+ id?: string;
3
+ title?: string;
4
+ type?: string;
5
+ description?: string;
6
+ image?: string;
7
+ url?: string;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { BlockButton } from './block-button';
2
+ export interface BlockButtonGroup {
3
+ id: string;
4
+ buttons: (string | BlockButton)[] | null;
5
+ alignment: 'left' | 'center' | null;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { Post, Page } from '../content';
2
+ export interface BlockButton {
3
+ id: string;
4
+ sort: number | null;
5
+ type: ('pages' | 'posts' | 'external') | null;
6
+ label: string | null;
7
+ color: 'primary' | 'white' | 'gray' | 'white' | 'black';
8
+ variant: 'solid' | 'outline' | 'ghost' | 'link' | 'soft';
9
+ page: string | Page | null;
10
+ post: string | Post | null;
11
+ external_url: string | null;
12
+ icon: string | null;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,18 @@
1
+ import type { File } from '../system';
2
+ import type { BlockButtonGroup } from '.';
3
+ export interface BlockColumn {
4
+ headline?: string | null;
5
+ id?: string;
6
+ title?: string | null;
7
+ rows?: (number | BlockColumnRow)[];
8
+ }
9
+ export interface BlockColumnRow {
10
+ block_columns?: (string | BlockColumn) | null;
11
+ content?: string | null;
12
+ headline?: string | null;
13
+ id?: string;
14
+ image?: (string | File) | null;
15
+ image_position?: string | null;
16
+ title?: string | null;
17
+ button_group?: (string | BlockButtonGroup) | null;
18
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { BlockButtonGroup } from '.';
2
+ export interface BlockCta {
3
+ buttons?: {
4
+ [key: string]: any;
5
+ } | null;
6
+ content?: string | null;
7
+ headline?: string | null;
8
+ id?: string;
9
+ title?: string | null;
10
+ button_group?: (string | BlockButtonGroup) | null;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface BlockDivider {
2
+ id?: string;
3
+ title?: string | null;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export interface BlockFaq {
2
+ faqs?: BlockFaqQuestion[] | null;
3
+ headline?: string | null;
4
+ id?: string;
5
+ title?: string | null;
6
+ alignment?: 'left' | 'center' | null;
7
+ }
8
+ export interface BlockFaqQuestion {
9
+ title: string | null;
10
+ answer: string | null;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { Form } from '../content';
2
+ export interface BlockForm {
3
+ form?: (string | Form) | null;
4
+ headline?: string | null;
5
+ id?: string;
6
+ title?: string | null;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { File } from '../system';
2
+ export interface BlockGallery {
3
+ headline?: string | null;
4
+ id?: string;
5
+ title?: string | null;
6
+ gallery_items?: BlockGalleryFile[] | null;
7
+ }
8
+ export interface BlockGalleryFile {
9
+ block_gallery?: (string | BlockGallery) | null;
10
+ directus_files_id?: (string | File) | null;
11
+ id?: number;
12
+ sort?: number | null;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { File } from '../system';
2
+ import type { BlockButtonGroup } from '.';
3
+ export interface BlockHero {
4
+ id?: string;
5
+ title?: string | null;
6
+ headline?: string | null;
7
+ content?: string | null;
8
+ image?: (string | File) | null;
9
+ image_position?: 'left' | 'right' | null;
10
+ button_group?: (string | BlockButtonGroup) | null;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export interface BlockHtml {
2
+ id?: string;
3
+ raw_html?: string | null;
4
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { File } from '../system';
2
+ export interface BlockLogocloud {
3
+ headline?: string | null;
4
+ id?: string;
5
+ title?: string | null;
6
+ logos?: (string | BlockLogocloudFile)[];
7
+ }
8
+ export interface BlockLogocloudFile {
9
+ id?: string;
10
+ sort?: number | null;
11
+ block_logocloud_id?: (string | BlockLogocloud) | null;
12
+ directus_files_id?: (string | File) | null;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { File } from '../system';
2
+ export interface BlockQuote {
3
+ background_color?: string | null;
4
+ content?: string | null;
5
+ headline?: string | null;
6
+ id?: string;
7
+ image?: (string | File) | null;
8
+ subtitle?: string | null;
9
+ title?: string | null;
10
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface BlockRichtext {
2
+ content?: string | null;
3
+ headline?: string | null;
4
+ id?: string;
5
+ title?: string | null;
6
+ alignment?: 'left' | 'center' | null;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import type { File } from '../system';
2
+ import type { BlockButtonGroup } from '.';
3
+ export interface BlockStep {
4
+ id?: string;
5
+ title?: string | null;
6
+ headline?: string | null;
7
+ /** If enabled, image position is alternated between left and right. */
8
+ alternate_image_position?: boolean;
9
+ /** Show the step numbers on the website. For example: (Step 1, Step 2, etc) */
10
+ show_step_numbers?: boolean | null;
11
+ steps?: (number | BlockStepItem)[];
12
+ }
13
+ export interface BlockStepItem {
14
+ id?: string;
15
+ title?: string | null;
16
+ content?: string | null;
17
+ image?: (string | File) | null;
18
+ sort?: number | null;
19
+ block_steps?: (string | BlockStep) | null;
20
+ button_group?: (string | BlockButtonGroup) | null;
21
+ }
@@ -0,0 +1 @@
1
+ export {};