@hanzo/ui 4.5.0 → 4.5.2

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 (311) hide show
  1. package/MCP-INSTRUCTIONS.md +73 -0
  2. package/README-MCP.md +175 -0
  3. package/bin/cli.js +100 -0
  4. package/bin/create-registry.js +108 -0
  5. package/bin/mcp.js +403 -0
  6. package/bin/npx-registry-mcp.js +15 -0
  7. package/bin/registry-mcp-wrapper.sh +19 -0
  8. package/bin/registry-mcp.js +100 -0
  9. package/bin/start-mcp-server.sh +22 -0
  10. package/bin/test-mcp.sh +52 -0
  11. package/bin/update-registry.js +196 -0
  12. package/blocks/components/screenful-block/index.tsx +2 -0
  13. package/dist/blocks/components/accordian-block.d.ts +4 -0
  14. package/dist/blocks/components/accordian-block.jsx +25 -0
  15. package/dist/blocks/components/block-component-props.d.ts +7 -0
  16. package/dist/blocks/components/block-component-props.js +1 -0
  17. package/dist/blocks/components/bullet-cards-block.d.ts +4 -0
  18. package/dist/blocks/components/bullet-cards-block.jsx +25 -0
  19. package/dist/blocks/components/card-block/index.d.ts +6 -0
  20. package/dist/blocks/components/card-block/index.jsx +87 -0
  21. package/dist/blocks/components/card-block/link-out-button.d.ts +6 -0
  22. package/dist/blocks/components/card-block/link-out-button.jsx +4 -0
  23. package/dist/blocks/components/card-block/util.d.ts +4 -0
  24. package/dist/blocks/components/card-block/util.js +6 -0
  25. package/dist/blocks/components/carte-blanche-block/index.d.ts +4 -0
  26. package/dist/blocks/components/carte-blanche-block/index.jsx +82 -0
  27. package/dist/blocks/components/carte-blanche-block/variant-content-left.d.ts +10 -0
  28. package/dist/blocks/components/carte-blanche-block/variant-content-left.jsx +23 -0
  29. package/dist/blocks/components/content.d.ts +10 -0
  30. package/dist/blocks/components/content.jsx +47 -0
  31. package/dist/blocks/components/cta-block.d.ts +12 -0
  32. package/dist/blocks/components/cta-block.jsx +69 -0
  33. package/dist/blocks/components/enh-heading-block.d.ts +7 -0
  34. package/dist/blocks/components/enh-heading-block.jsx +142 -0
  35. package/dist/blocks/components/grid-block/grid-block-mutator.d.ts +5 -0
  36. package/dist/blocks/components/grid-block/grid-block-mutator.js +1 -0
  37. package/dist/blocks/components/grid-block/index.d.ts +9 -0
  38. package/dist/blocks/components/grid-block/index.jsx +56 -0
  39. package/dist/blocks/components/grid-block/mutator-registry.d.ts +3 -0
  40. package/dist/blocks/components/grid-block/mutator-registry.js +5 -0
  41. package/dist/blocks/components/grid-block/table-borders.mutator.d.ts +3 -0
  42. package/dist/blocks/components/grid-block/table-borders.mutator.js +36 -0
  43. package/dist/blocks/components/group-block.d.ts +7 -0
  44. package/dist/blocks/components/group-block.jsx +61 -0
  45. package/dist/blocks/components/heading-block.d.ts +4 -0
  46. package/dist/blocks/components/heading-block.jsx +99 -0
  47. package/dist/blocks/components/image-block.d.ts +7 -0
  48. package/dist/blocks/components/image-block.jsx +69 -0
  49. package/dist/blocks/components/index.d.ts +14 -0
  50. package/dist/blocks/components/index.js +13 -0
  51. package/dist/blocks/components/screenful-block/content.d.ts +8 -0
  52. package/dist/blocks/components/screenful-block/content.jsx +71 -0
  53. package/dist/blocks/components/screenful-block/index.d.ts +12 -0
  54. package/dist/blocks/components/screenful-block/index.jsx +57 -0
  55. package/dist/blocks/components/screenful-block/poster-background.d.ts +7 -0
  56. package/dist/blocks/components/screenful-block/poster-background.jsx +14 -0
  57. package/dist/blocks/components/screenful-block/video-background.d.ts +8 -0
  58. package/dist/blocks/components/screenful-block/video-background.jsx +20 -0
  59. package/dist/blocks/components/space-block.d.ts +4 -0
  60. package/dist/blocks/components/space-block.jsx +42 -0
  61. package/dist/blocks/components/video-block.d.ts +9 -0
  62. package/dist/blocks/components/video-block.jsx +83 -0
  63. package/dist/blocks/def/accordian-block.d.ts +10 -0
  64. package/dist/blocks/def/accordian-block.js +2 -0
  65. package/dist/blocks/def/block.d.ts +4 -0
  66. package/dist/blocks/def/block.js +1 -0
  67. package/dist/blocks/def/bullet-cards-block.d.ts +17 -0
  68. package/dist/blocks/def/bullet-cards-block.js +1 -0
  69. package/dist/blocks/def/card-block.d.ts +17 -0
  70. package/dist/blocks/def/card-block.js +2 -0
  71. package/dist/blocks/def/carte-blanche-block.d.ts +12 -0
  72. package/dist/blocks/def/carte-blanche-block.js +1 -0
  73. package/dist/blocks/def/cta-block.d.ts +8 -0
  74. package/dist/blocks/def/cta-block.js +1 -0
  75. package/dist/blocks/def/element-block.d.ts +7 -0
  76. package/dist/blocks/def/element-block.js +2 -0
  77. package/dist/blocks/def/enh-heading-block.d.ts +22 -0
  78. package/dist/blocks/def/enh-heading-block.js +1 -0
  79. package/dist/blocks/def/grid-block.d.ts +12 -0
  80. package/dist/blocks/def/grid-block.js +1 -0
  81. package/dist/blocks/def/group-block.d.ts +7 -0
  82. package/dist/blocks/def/group-block.js +1 -0
  83. package/dist/blocks/def/heading-block.d.ts +11 -0
  84. package/dist/blocks/def/heading-block.js +1 -0
  85. package/dist/blocks/def/image-block.d.ts +26 -0
  86. package/dist/blocks/def/image-block.js +1 -0
  87. package/dist/blocks/def/index.d.ts +17 -0
  88. package/dist/blocks/def/index.js +2 -0
  89. package/dist/blocks/def/screenful-block.d.ts +41 -0
  90. package/dist/blocks/def/screenful-block.js +1 -0
  91. package/dist/blocks/def/space-block.d.ts +47 -0
  92. package/dist/blocks/def/space-block.js +8 -0
  93. package/dist/blocks/def/video-block.d.ts +5 -0
  94. package/dist/blocks/def/video-block.js +1 -0
  95. package/dist/blocks/index.d.ts +2 -0
  96. package/dist/blocks/index.js +2 -0
  97. package/dist/mcp/enhanced-server.d.ts +29 -0
  98. package/dist/mcp/enhanced-server.js +1128 -0
  99. package/dist/mcp/index.d.ts +28 -0
  100. package/dist/mcp/index.js +436 -0
  101. package/dist/primitives/accordion.d.ts +10 -0
  102. package/dist/primitives/accordion.jsx +21 -0
  103. package/dist/primitives/action-button.d.ts +9 -0
  104. package/dist/primitives/action-button.jsx +16 -0
  105. package/dist/primitives/apply-typography.d.ts +7 -0
  106. package/dist/primitives/apply-typography.jsx +38 -0
  107. package/dist/primitives/aspect-ratio.d.ts +3 -0
  108. package/dist/primitives/aspect-ratio.jsx +4 -0
  109. package/dist/primitives/avatar.d.ts +6 -0
  110. package/dist/primitives/avatar.jsx +11 -0
  111. package/dist/primitives/badge.d.ts +9 -0
  112. package/dist/primitives/badge.jsx +18 -0
  113. package/dist/primitives/breadcrumb.d.ts +19 -0
  114. package/dist/primitives/breadcrumb.jsx +27 -0
  115. package/dist/primitives/breakpoint-indicator.d.ts +3 -0
  116. package/dist/primitives/breakpoint-indicator.jsx +14 -0
  117. package/dist/primitives/button.d.ts +12 -0
  118. package/dist/primitives/button.jsx +55 -0
  119. package/dist/primitives/calendar.d.ts +8 -0
  120. package/dist/primitives/calendar.jsx +40 -0
  121. package/dist/primitives/card.d.ts +8 -0
  122. package/dist/primitives/card.jsx +18 -0
  123. package/dist/primitives/carousel.d.ts +18 -0
  124. package/dist/primitives/carousel.jsx +106 -0
  125. package/dist/primitives/checkbox.d.ts +4 -0
  126. package/dist/primitives/checkbox.jsx +15 -0
  127. package/dist/primitives/combobox.d.ts +41 -0
  128. package/dist/primitives/combobox.jsx +77 -0
  129. package/dist/primitives/command.d.ts +17 -0
  130. package/dist/primitives/command.jsx +38 -0
  131. package/dist/primitives/context-menu.d.ts +27 -0
  132. package/dist/primitives/context-menu.jsx +57 -0
  133. package/dist/primitives/dialog-video-controller.d.ts +3 -0
  134. package/dist/primitives/dialog-video-controller.jsx +24 -0
  135. package/dist/primitives/dialog.d.ts +28 -0
  136. package/dist/primitives/dialog.jsx +37 -0
  137. package/dist/primitives/drawer.d.ts +29 -0
  138. package/dist/primitives/drawer.jsx +34 -0
  139. package/dist/primitives/form.d.ts +12 -0
  140. package/dist/primitives/form.jsx +69 -0
  141. package/dist/primitives/icons/github.d.ts +4 -0
  142. package/dist/primitives/icons/github.jsx +6 -0
  143. package/dist/primitives/icons/index.d.ts +4 -0
  144. package/dist/primitives/icons/index.js +4 -0
  145. package/dist/primitives/icons/youtube-logo.d.ts +4 -0
  146. package/dist/primitives/icons/youtube-logo.jsx +39 -0
  147. package/dist/primitives/index-common.d.ts +47 -0
  148. package/dist/primitives/index-common.js +46 -0
  149. package/dist/primitives/index-next.d.ts +2 -0
  150. package/dist/primitives/index-next.js +2 -0
  151. package/dist/primitives/input-otp.d.ts +7 -0
  152. package/dist/primitives/input-otp.jsx +24 -0
  153. package/dist/primitives/input.d.ts +5 -0
  154. package/dist/primitives/input.jsx +11 -0
  155. package/dist/primitives/label.d.ts +5 -0
  156. package/dist/primitives/label.jsx +11 -0
  157. package/dist/primitives/list-adaptor.d.ts +9 -0
  158. package/dist/primitives/list-adaptor.js +1 -0
  159. package/dist/primitives/list-box.d.ts +10 -0
  160. package/dist/primitives/list-box.jsx +14 -0
  161. package/dist/primitives/loading-spinner.d.ts +5 -0
  162. package/dist/primitives/loading-spinner.jsx +8 -0
  163. package/dist/primitives/navigation-menu.d.ts +12 -0
  164. package/dist/primitives/navigation-menu.jsx +38 -0
  165. package/dist/primitives/next/image.d.ts +11 -0
  166. package/dist/primitives/next/image.jsx +42 -0
  167. package/dist/primitives/next/index.d.ts +7 -0
  168. package/dist/primitives/next/index.js +7 -0
  169. package/dist/primitives/next/inline-icon.d.ts +13 -0
  170. package/dist/primitives/next/inline-icon.jsx +15 -0
  171. package/dist/primitives/next/link-element.d.ts +23 -0
  172. package/dist/primitives/next/link-element.jsx +56 -0
  173. package/dist/primitives/next/mdx-link.d.ts +3 -0
  174. package/dist/primitives/next/mdx-link.jsx +12 -0
  175. package/dist/primitives/next/media-stack.d.ts +8 -0
  176. package/dist/primitives/next/media-stack.jsx +28 -0
  177. package/dist/primitives/next/nav-items.d.ts +10 -0
  178. package/dist/primitives/next/nav-items.jsx +24 -0
  179. package/dist/primitives/next/youtube-embed.d.ts +11 -0
  180. package/dist/primitives/next/youtube-embed.jsx +23 -0
  181. package/dist/primitives/popover.d.ts +9 -0
  182. package/dist/primitives/popover.jsx +18 -0
  183. package/dist/primitives/progress.d.ts +4 -0
  184. package/dist/primitives/progress.jsx +9 -0
  185. package/dist/primitives/radio-group.d.ts +7 -0
  186. package/dist/primitives/radio-group.jsx +18 -0
  187. package/dist/primitives/scroll-area.d.ts +5 -0
  188. package/dist/primitives/scroll-area.jsx +19 -0
  189. package/dist/primitives/select.d.ts +13 -0
  190. package/dist/primitives/select.jsx +62 -0
  191. package/dist/primitives/separator.d.ts +4 -0
  192. package/dist/primitives/separator.jsx +7 -0
  193. package/dist/primitives/sheet.d.ts +30 -0
  194. package/dist/primitives/sheet.jsx +56 -0
  195. package/dist/primitives/skeleton.d.ts +4 -0
  196. package/dist/primitives/skeleton.jsx +3 -0
  197. package/dist/primitives/slider.d.ts +9 -0
  198. package/dist/primitives/slider.jsx +30 -0
  199. package/dist/primitives/sonner.d.ts +5 -0
  200. package/dist/primitives/sonner.jsx +16 -0
  201. package/dist/primitives/step-indicator.d.ts +9 -0
  202. package/dist/primitives/step-indicator.jsx +23 -0
  203. package/dist/primitives/switch.d.ts +6 -0
  204. package/dist/primitives/switch.jsx +14 -0
  205. package/dist/primitives/table.d.ts +10 -0
  206. package/dist/primitives/table.jsx +21 -0
  207. package/dist/primitives/tabs.d.ts +7 -0
  208. package/dist/primitives/tabs.jsx +18 -0
  209. package/dist/primitives/text-area.d.ts +5 -0
  210. package/dist/primitives/text-area.jsx +9 -0
  211. package/dist/primitives/toggle-group.d.ts +14 -0
  212. package/dist/primitives/toggle-group.jsx +28 -0
  213. package/dist/primitives/toggle.d.ts +14 -0
  214. package/dist/primitives/toggle.jsx +52 -0
  215. package/dist/primitives/tooltip.d.ts +11 -0
  216. package/dist/primitives/tooltip.jsx +18 -0
  217. package/dist/primitives/video-player.d.ts +6 -0
  218. package/dist/primitives/video-player.jsx +8 -0
  219. package/dist/registry/api.d.ts +37 -0
  220. package/dist/registry/api.js +130 -0
  221. package/dist/registry/index.d.ts +9 -0
  222. package/dist/registry/index.js +45 -0
  223. package/dist/style/theme-provider.d.ts +4 -0
  224. package/dist/style/theme-provider.jsx +11 -0
  225. package/dist/tailwind/fontFamily.tailwind.d.ts +8 -0
  226. package/dist/tailwind/fontFamily.tailwind.js +7 -0
  227. package/dist/tailwind/fontSize.tailwind.d.ts +36 -0
  228. package/dist/tailwind/fontSize.tailwind.js +13 -0
  229. package/dist/tailwind/index.d.ts +3 -0
  230. package/dist/tailwind/index.js +2 -0
  231. package/dist/tailwind/screens.tailwind.d.ts +9 -0
  232. package/dist/tailwind/screens.tailwind.js +8 -0
  233. package/dist/tailwind/tw-font-desc.d.ts +6 -0
  234. package/dist/tailwind/tw-font-desc.js +6 -0
  235. package/dist/types/animation-def.d.ts +2 -0
  236. package/dist/types/animation-def.js +1 -0
  237. package/dist/types/breakpoints.d.ts +4 -0
  238. package/dist/types/breakpoints.js +4 -0
  239. package/dist/types/bullet-item.d.ts +6 -0
  240. package/dist/types/bullet-item.js +2 -0
  241. package/dist/types/button-def.d.ts +29 -0
  242. package/dist/types/button-def.js +2 -0
  243. package/dist/types/dimensions.d.ts +5 -0
  244. package/dist/types/dimensions.js +1 -0
  245. package/dist/types/grid-def.d.ts +36 -0
  246. package/dist/types/grid-def.js +33 -0
  247. package/dist/types/image-def.d.ts +27 -0
  248. package/dist/types/image-def.js +1 -0
  249. package/dist/types/index.d.ts +13 -0
  250. package/dist/types/index.js +2 -0
  251. package/dist/types/link-def.d.ts +44 -0
  252. package/dist/types/link-def.js +1 -0
  253. package/dist/types/media-stack-def.d.ts +25 -0
  254. package/dist/types/media-stack-def.js +1 -0
  255. package/dist/types/t-shirt-size.d.ts +2 -0
  256. package/dist/types/t-shirt-size.js +1 -0
  257. package/dist/types/tshirt-dimensions.d.ts +12 -0
  258. package/dist/types/tshirt-dimensions.js +1 -0
  259. package/dist/types/video-def.d.ts +9 -0
  260. package/dist/types/video-def.js +1 -0
  261. package/dist/util/format-and-abbreviate-as-currency.d.ts +11 -0
  262. package/dist/util/format-and-abbreviate-as-currency.js +91 -0
  263. package/dist/util/format-to-max-char.d.ts +5 -0
  264. package/dist/util/format-to-max-char.js +57 -0
  265. package/dist/util/index-client.d.ts +2 -0
  266. package/dist/util/index-client.js +3 -0
  267. package/dist/util/index.d.ts +17 -0
  268. package/dist/util/index.js +41 -0
  269. package/dist/util/number-abbreviate.d.ts +9 -0
  270. package/dist/util/number-abbreviate.js +30 -0
  271. package/dist/util/specifier.d.ts +7 -0
  272. package/dist/util/specifier.js +31 -0
  273. package/dist/util/spread-to-transform.d.ts +7 -0
  274. package/dist/util/spread-to-transform.js +18 -0
  275. package/dist/util/step-animation.d.ts +5 -0
  276. package/dist/util/step-animation.js +60 -0
  277. package/dist/util/two-way-map.d.ts +8 -0
  278. package/dist/util/two-way-map.js +16 -0
  279. package/mcp/README.md +141 -0
  280. package/mcp/enhanced-server.ts +1208 -0
  281. package/mcp/index.ts +518 -0
  282. package/mcp/package.json +10 -0
  283. package/package.json +34 -14
  284. package/primitives/accordion.tsx +5 -5
  285. package/primitives/button.tsx +6 -3
  286. package/primitives/dialog.tsx +12 -7
  287. package/primitives/tabs.tsx +1 -1
  288. package/primitives/tooltip.tsx +1 -1
  289. package/public/r/accordion.json +11 -0
  290. package/public/r/alert.json +11 -0
  291. package/public/r/avatar.json +11 -0
  292. package/public/r/badge.json +11 -0
  293. package/public/r/button.json +11 -0
  294. package/public/r/card.json +11 -0
  295. package/public/r/checkbox.json +11 -0
  296. package/public/r/default.json +6 -0
  297. package/public/r/dialog.json +11 -0
  298. package/public/r/input.json +11 -0
  299. package/public/r/label.json +11 -0
  300. package/public/r/new-york.json +6 -0
  301. package/public/r/popover.json +11 -0
  302. package/public/r/select.json +11 -0
  303. package/public/r/table.json +11 -0
  304. package/public/r/tabs.json +11 -0
  305. package/public/r/toast.json +11 -0
  306. package/registry/api.ts +164 -0
  307. package/registry/index.ts +60 -0
  308. package/registry/package.json +10 -0
  309. package/registry.json +184 -0
  310. package/test/test-registry.js +73 -0
  311. package/tsconfig.json +8 -1
@@ -0,0 +1,71 @@
1
+ import React, {} from 'react';
2
+ import { containsToken, cn } from '../../../util';
3
+ import ContentComponent from '../content';
4
+ const ContentColumn = ({ blocks, specifiers, agent, className = '', }) => {
5
+ const specified = (s) => (containsToken(specifiers, s));
6
+ let modifiers = '';
7
+ if (agent !== 'phone') {
8
+ if (specified('right')) {
9
+ modifiers += 'items-end ';
10
+ }
11
+ else if (specified('center')) {
12
+ modifiers += 'items-center ';
13
+ }
14
+ // default to left
15
+ else {
16
+ modifiers += 'items-start ';
17
+ }
18
+ }
19
+ // default to left
20
+ else {
21
+ modifiers += 'items-start ';
22
+ }
23
+ if (agent !== 'phone') {
24
+ if (specified('bottom')) {
25
+ modifiers += 'justify-end ';
26
+ }
27
+ else if (specified('vert-center')) {
28
+ modifiers += 'justify-center ';
29
+ }
30
+ // default to top
31
+ else {
32
+ modifiers += 'justify-start ';
33
+ }
34
+ // right aligned text looks shitty on mobile
35
+ if (specified('text-align-right')) {
36
+ modifiers += 'text-right ';
37
+ }
38
+ else {
39
+ modifiers += 'text-left ';
40
+ }
41
+ }
42
+ else {
43
+ if (specified('mobile-vert-center')) {
44
+ modifiers += 'justify-center ';
45
+ }
46
+ else {
47
+ modifiers += 'justify-start ';
48
+ }
49
+ }
50
+ if (agent === 'phone' && specified('mobile-center-headings')) {
51
+ modifiers += 'typography-headings:text-center ';
52
+ }
53
+ /* ContentComponent's parent div needs h-full class in order for vertical alignment with flexbox to work.
54
+ * This affects specifiers: bottom, vert-center, mobile-vert-center
55
+ */
56
+ return (<div className={cn('flex flex-col justify-center h-full', modifiers, className)}>
57
+ <ContentComponent blocks={blocks} agent={agent}/>
58
+ </div>);
59
+ };
60
+ const Content = ({ block: b, agent, className = '', }) => {
61
+ // We need to set h-full when we have more than 1 column too, so the grid takes full height - Firefox and Safari fix.
62
+ const layoutClx = 'flex flex-col gap-2 sm:gap-4 h-full ' + ((agent !== 'phone') ? ('md:grid md:gap-8 ' + `md:grid-cols-${b.contentColumns.length} `) : '');
63
+ const orderclx = (columnIndex) => {
64
+ const orderIndex = b.mobileOrder?.indexOf(columnIndex);
65
+ return (orderIndex && orderIndex >= 0) ? `order-${orderIndex} md:order-none` : ''; // one-based in flexbox slec
66
+ };
67
+ return b.contentColumns.length == 1 ? (<ContentColumn blocks={b.contentColumns[0]} specifiers={b.columnSpecifiers?.[0]} agent={agent} className={cn(className)}/>) : (<div className={cn(layoutClx, className)}>
68
+ {b.contentColumns.map((column, index) => (<ContentColumn blocks={column} specifiers={b.columnSpecifiers?.[index]} agent={agent} className={orderclx(index)} key={index}/>))}
69
+ </div>);
70
+ };
71
+ export default Content;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { Block } from '../../def';
3
+ declare const ScreenfulComponent: React.FC<{
4
+ block: Block;
5
+ agent?: string;
6
+ initialInView?: boolean;
7
+ snapTile?: boolean;
8
+ clx?: string;
9
+ contentClx?: string;
10
+ bottom?: React.ReactNode;
11
+ }>;
12
+ export default ScreenfulComponent;
@@ -0,0 +1,57 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import dynamic from 'next/dynamic';
4
+ import { containsToken, cn } from '../../../util';
5
+ import { ApplyTypography } from '../../../primitives/index-common';
6
+ import Poster from './poster-background';
7
+ import Content from './content';
8
+ const Video = dynamic(() => (import('./video-background')), { ssr: false, loading: () => (<></>) });
9
+ const ScreenfulComponent = ({ block, agent, initialInView = false, snapTile = false, clx = '', contentClx = '', bottom }) => {
10
+ if (block.blockType !== 'screenful') {
11
+ return <>screenful block required</>;
12
+ }
13
+ const b = block;
14
+ const hasBannerVideo = () => (!!b.banner && (typeof b.banner === 'object'));
15
+ const tileHeight = (agent === 'desktop') ? 'h-full ' : 'h-[100svh] ';
16
+ const specified = (s) => (containsToken(b.specifiers, s));
17
+ const narrowGutters = specified('narrow-gutters'); // eg, for a table object that is large
18
+ const noGutters = specified('no-gutters');
19
+ const fullScreenWidth = specified('full-screen-width');
20
+ const vertCenter = specified('vert-center'); // at the main level, it seems only useful w one column
21
+ const oneColumn = b.contentColumns.length === 1;
22
+ // content wrapper clx:
23
+ // [
24
+ // positioning,
25
+ // p&m,
26
+ // p&m-modifiers
27
+ // ]
28
+ const cwclx = [
29
+ 'xl:mx-auto overflow-y-hidden h-full',
30
+ fullScreenWidth ? '' : 'max-w-screen-xl',
31
+ // desktop header: 80px / pt-20
32
+ // mobile header: 44px / pt-11
33
+ narrowGutters ?
34
+ 'px-6 lg:px-8 2xl:px-2 pb-4 lg:pb-6 xl:pb-8 ' + (snapTile ? 'pt-15 md:pt-26 lg:pt-28 ' : '') // otherwise assume there is a Main
35
+ :
36
+ noGutters ?
37
+ 'px-0 pb-0 ' + (snapTile ? 'pt-11 lg:pt-20 ' : '') // otherwise assume there is a Main
38
+ :
39
+ 'px-[8vw] xl:px-[1vw] pb-[8vh] pt-[calc(44px+4vh)] md:pt-[calc(80px+6vh)] ',
40
+ (agent && agent !== 'desktop') ? 'pt-15 sm:pt-17 pb-0 px-3 sm:px-8' : ''
41
+ ];
42
+ return (<section {...((b.anchorId) ? { id: b.anchorId } : {})} className={cn(snapTile ? 'snap-start snap-always h-[100vh]' : 'min-h-screen', bottom ? 'flex flex-col' : '', clx)}>
43
+ <ApplyTypography className={cn('w-full flex flex-row justify-center self-stretch', snapTile ? tileHeight : '', bottom ? 'grow' : '')}>
44
+ <Poster banner={b.banner}>
45
+ {hasBannerVideo() && (<Video block={b.banner} className='absolute top-0 left-0 bottom-0 right-0' initialInView={initialInView}/>)}
46
+ <div className={cn(...cwclx, snapTile ? 'absolute left-0 right-0 top-0 bottom-0 ' : 'flex min-h-screen w-full', contentClx,
47
+ // TODO :aa py-0 breaks padding for header! Investigate why I would have done this!
48
+ vertCenter ? 'self-center ' + (oneColumn ? '!py-0' : '') : '')}>
49
+ <Content block={b} agent={agent} className='w-full'/>
50
+ {b.footer}
51
+ </div>
52
+ </Poster>
53
+ </ApplyTypography>
54
+ {bottom}
55
+ </section>);
56
+ };
57
+ export default ScreenfulComponent;
@@ -0,0 +1,7 @@
1
+ import React, { type PropsWithChildren } from 'react';
2
+ import type { VideoBlock } from '../../def';
3
+ declare const Poster: React.FC<{
4
+ banner: VideoBlock | string | undefined;
5
+ className?: string;
6
+ } & PropsWithChildren>;
7
+ export default Poster;
@@ -0,0 +1,14 @@
1
+ import React, {} from 'react';
2
+ import { cn } from '../../../util';
3
+ const Poster = ({ children, banner, className = '' }) => (banner ? (<div className={cn('relative', className)} style={{
4
+ height: '100%',
5
+ width: '100%',
6
+ backgroundImage: `url(${(typeof banner === 'string') ? banner : banner.poster})`,
7
+ backgroundSize: 'cover',
8
+ backgroundRepeat: 'no-repeat',
9
+ }}>
10
+ {children}
11
+ </div>) : (<div className={cn('bg-transparent h-full w-full relative', className)}>
12
+ {children}
13
+ </div>));
14
+ export default Poster;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import type { VideoBlock } from '../../def';
3
+ declare const VideoBG: React.FC<{
4
+ block: VideoBlock;
5
+ className?: string;
6
+ initialInView: boolean;
7
+ }>;
8
+ export default VideoBG;
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import React from 'react';
3
+ import { useInView } from 'react-intersection-observer';
4
+ const VideoBG = ({ block, className = '', initialInView }) => {
5
+ const { ref, inView } = useInView({
6
+ threshold: 0.75,
7
+ initialInView,
8
+ });
9
+ return block ? (<div ref={ref} className={className}>
10
+ {inView && (<video autoPlay loop muted style={{
11
+ margin: 0,
12
+ height: '100%',
13
+ width: '100%',
14
+ objectFit: 'cover',
15
+ }}>
16
+ {block.sources?.map((src, index) => (<source key={index} src={src}/>))}
17
+ </video>)}
18
+ </div>) : null;
19
+ };
20
+ export default VideoBG;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type BlockComponentProps from './block-component-props';
3
+ declare const SpaceBlockComponent: React.FC<BlockComponentProps>;
4
+ export default SpaceBlockComponent;
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { ldMerge, cn } from '../../util';
3
+ import { SPACE_DEFAULTS } from '../def/space-block';
4
+ import { ApplyTypography } from '../../primitives/index-common';
5
+ const TAGS = [
6
+ 'div',
7
+ 'h1',
8
+ 'h2',
9
+ 'h3',
10
+ 'h4',
11
+ 'h5',
12
+ 'h6',
13
+ ];
14
+ const SpaceBlockComponent = ({ block, className = '' }) => {
15
+ if (block && block.blockType !== 'space') {
16
+ return <>space block required</>;
17
+ }
18
+ const b = block;
19
+ // This code path should handle a undefined or empty sizes field.
20
+ if (!b.level) {
21
+ if (typeof b.sizes == 'number') {
22
+ return <div className={cn(`invisible w-[1px] h-${b.sizes}`, className)}/>;
23
+ }
24
+ const _sizes = {};
25
+ ldMerge(_sizes, SPACE_DEFAULTS, b.sizes);
26
+ let clx = '';
27
+ for (const [key, value] of Object.entries(_sizes)) {
28
+ // ts brain fart!
29
+ clx += `${key}:h-${value} `;
30
+ }
31
+ if (b.test) {
32
+ console.log(clx);
33
+ }
34
+ return <div className={cn('invisible w-[1px] ' + clx, className)}/>;
35
+ }
36
+ const Tag = TAGS[b.level];
37
+ const heightClx = (b.level === 0) ? 'h-4' : '';
38
+ return (<ApplyTypography className={className}>
39
+ <Tag className={'invisible m-0 ' + heightClx}>&nbsp;</Tag>
40
+ </ApplyTypography>);
41
+ };
42
+ export default SpaceBlockComponent;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { Dimensions, TShirtSize } from '../../types';
3
+ import type BlockComponentProps from './block-component-props';
4
+ declare const VideoBlockComponent: React.FC<BlockComponentProps & {
5
+ usePoster?: boolean;
6
+ size?: TShirtSize;
7
+ constrainTo?: Dimensions;
8
+ }>;
9
+ export default VideoBlockComponent;
@@ -0,0 +1,83 @@
1
+ 'use client';
2
+ import React, { useEffect, useLayoutEffect, useState } from 'react';
3
+ import Image from 'next/image';
4
+ import { constrain, asNum, cn } from '../../util';
5
+ import { VideoPlayer } from '../../primitives/index-common';
6
+ const VideoBlockComponent = ({ block, className = '', agent, usePoster = false, size = 'md', constrainTo }) => {
7
+ const [_dim, setDim] = useState(undefined);
8
+ const onResize = () => {
9
+ setDim({
10
+ w: window.innerWidth,
11
+ h: window.innerHeight
12
+ });
13
+ };
14
+ const windowDefined = typeof window !== 'undefined';
15
+ useEffect(() => {
16
+ if (window && agent === 'desktop') {
17
+ window.addEventListener('resize', onResize);
18
+ return () => window.removeEventListener('resize', onResize);
19
+ }
20
+ }, [windowDefined]);
21
+ useLayoutEffect(() => {
22
+ onResize();
23
+ }, []);
24
+ if (block.blockType !== 'video') {
25
+ return <>video block required</>;
26
+ }
27
+ const b = block;
28
+ const ar = b.dim.md.w / b.dim.md.h;
29
+ if (agent === 'phone') {
30
+ if (b.sizing?.mobile?.vw) {
31
+ // serverside, or at least while the video is loading,
32
+ // generate the css for the correctly sized poster image
33
+ if (!_dim) {
34
+ const width = `${b.sizing.mobile.vw}vw`;
35
+ return <div className='dummy-div' style={{
36
+ maxWidth: '100%',
37
+ maxHeight: '100%',
38
+ width,
39
+ height: `calc(${width}/${ar})`,
40
+ backgroundImage: `url(${b.poster})`,
41
+ backgroundSize: 'contain',
42
+ backgroundRepeat: 'no-repeat',
43
+ }}/>;
44
+ }
45
+ else {
46
+ const width = ((b.sizing.mobile.vw / 100) * _dim.w);
47
+ const dim = {
48
+ h: width / ar,
49
+ w: width
50
+ };
51
+ return ((<VideoPlayer className={cn('mx-auto', className)} sources={b.sources} width={dim.w} height={dim.h} {...b.videoProps}/>));
52
+ }
53
+ }
54
+ }
55
+ else if (b.sizing?.vh) {
56
+ // serverside, generate the css for the correctly sized poster image
57
+ if (!_dim) {
58
+ const height = `${b.sizing.vh}vh`;
59
+ return <div className='dummy-div' style={{
60
+ maxWidth: '100%',
61
+ maxHeight: '100%',
62
+ height: height,
63
+ width: `calc(${height}*${ar})`,
64
+ backgroundImage: `url(${b.poster})`,
65
+ backgroundSize: 'contain',
66
+ backgroundRepeat: 'no-repeat',
67
+ }}/>;
68
+ }
69
+ else {
70
+ const height = ((b.sizing.vh / 100) * _dim.h);
71
+ const dim = {
72
+ h: height,
73
+ w: height * ar
74
+ };
75
+ return ((<VideoPlayer className={cn('mx-auto', className)} sources={b.sources} width={dim.w} height={dim.h} {...b.videoProps}/>));
76
+ }
77
+ }
78
+ const videoDims = b.dim;
79
+ const dim = ((size && size in videoDims) ? videoDims[size] : videoDims.md);
80
+ const conDim = (constrainTo ? constrain(dim, constrainTo) : dim);
81
+ return usePoster ? (<Image src={b.poster} alt='image' width={conDim.w} height={conDim.h} className={className}/>) : (<VideoPlayer className={cn('mx-auto', className)} sources={b.sources} width={conDim.w} height={conDim.h} {...b.videoProps}/>);
82
+ };
83
+ export default VideoBlockComponent;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type Block from './block';
3
+ interface AccordianBlock extends Block {
4
+ blockType: 'accordian';
5
+ items: {
6
+ trigger: string;
7
+ content: React.ReactNode;
8
+ }[];
9
+ }
10
+ export { type AccordianBlock as default };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export {};
@@ -0,0 +1,4 @@
1
+ interface Block {
2
+ blockType: string;
3
+ }
4
+ export { type Block as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type Block from './block';
2
+ import type { BulletItem, GridDef } from '../../types';
3
+ interface BulletCardsBlock extends Block {
4
+ blockType: 'bullet-cards';
5
+ /**
6
+ * no-card-border
7
+ * mobile-small-text
8
+ * borders-muted-1 / borders-muted-3
9
+ * default: 2
10
+ */
11
+ specifiers?: string;
12
+ grid: GridDef;
13
+ cards: BulletItem[];
14
+ /** in px */
15
+ iconSize?: number;
16
+ }
17
+ export { type BulletCardsBlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import type CTABlock from './cta-block';
3
+ import type Block from './block';
4
+ import type ImageBlock from './image-block';
5
+ import type VideoBlock from './video-block';
6
+ interface CardBlock extends Block {
7
+ blockType: 'card';
8
+ specifiers?: string;
9
+ title?: string;
10
+ byline?: string;
11
+ icon?: React.ReactNode;
12
+ iconAfter?: boolean;
13
+ media?: ImageBlock | VideoBlock;
14
+ content?: React.ReactNode;
15
+ cta?: CTABlock;
16
+ }
17
+ export { type CardBlock as default };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export {};
@@ -0,0 +1,12 @@
1
+ import type Block from './block';
2
+ import type CTABlock from './cta-block';
3
+ import type EnhHeadingBlock from './enh-heading-block';
4
+ interface CarteBlancheBlock extends Block {
5
+ blockType: 'carte-blanche';
6
+ specifiers?: string;
7
+ topContent?: Block[];
8
+ heading?: EnhHeadingBlock;
9
+ content?: Block[];
10
+ cta?: CTABlock;
11
+ }
12
+ export { type CarteBlancheBlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { LinkDef, ButtonDef } from '../../types';
2
+ import type Block from './block';
3
+ interface CTABlock extends Block {
4
+ blockType: 'cta';
5
+ specifiers?: string;
6
+ elements: (LinkDef | ButtonDef)[];
7
+ }
8
+ export { type CTABlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type Block from './block';
3
+ interface ElementBlock extends Block {
4
+ blockType: 'element';
5
+ element: React.ReactNode | JSX.Element;
6
+ }
7
+ export { type ElementBlock as default };
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export {};
@@ -0,0 +1,22 @@
1
+ import type Block from './block';
2
+ interface EnhHeadingBlock extends Block {
3
+ blockType: 'enh-heading';
4
+ specifiers?: string;
5
+ icon?: React.ReactNode;
6
+ iconSize?: number;
7
+ preheading?: {
8
+ text: string;
9
+ level?: number;
10
+ mb?: number;
11
+ };
12
+ heading: {
13
+ text: string;
14
+ level?: number;
15
+ mb?: number;
16
+ };
17
+ byline?: {
18
+ text: string;
19
+ level?: number;
20
+ };
21
+ }
22
+ export { type EnhHeadingBlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type Block from "./block";
2
+ import type GridDef from "../../types/grid-def";
3
+ interface GridBlock {
4
+ blockType: 'grid';
5
+ specifiers?: string;
6
+ grid: GridDef;
7
+ /**
8
+ * Ignored if children are supplied to the GridBlockComp
9
+ */
10
+ cells?: Block[];
11
+ }
12
+ export { type GridBlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type Block from './block';
2
+ interface GroupBlock extends Block {
3
+ blockType: 'group';
4
+ specifiers?: string;
5
+ elements: Block[];
6
+ }
7
+ export { type GroupBlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type Block from './block';
2
+ interface HeadingBlock extends Block {
3
+ blockType: 'heading';
4
+ heading: string;
5
+ byline?: string;
6
+ level?: number;
7
+ bylineLevel?: number;
8
+ spaceBetween?: number;
9
+ spaceAfter?: number;
10
+ }
11
+ export { type HeadingBlock as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { ImageDef } from '../../types';
2
+ import type Block from './block';
3
+ /**
4
+ * See {@link ImageDef}
5
+ * see https://nextjs.org/docs/app/api-reference/components/image
6
+ * as well as React.ImgHTMLAttributes.
7
+ */
8
+ interface ImageBlock extends Block, ImageDef {
9
+ blockType: 'image';
10
+ /**
11
+ * Alignement: 'left' (default) / 'right' / 'center' (must be in flex-col parent)
12
+ * 'mobile-no-scale': By default, scales to 3/4 height (mobile and w < 'md')
13
+ * 'mobile-full-width': Overrides dim, etc. and renders full width (maintaining aspect ratio)
14
+ */
15
+ specifiers?: string;
16
+ /** @deprecated Please use 'mobile-full-width' in specifiers */
17
+ fullWidthOnMobile?: boolean;
18
+ /** Next props */
19
+ props?: {
20
+ sizes?: string;
21
+ /** if true, any alignement specifiers are ignored */
22
+ fill?: boolean;
23
+ style?: any;
24
+ };
25
+ }
26
+ export { type ImageBlock as default, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import type AccordianBlock from './accordian-block';
2
+ import type Block from './block';
3
+ import type BulletCardsBlock from './bullet-cards-block';
4
+ import type CardBlock from './card-block';
5
+ import type CarteBlancheBlock from './carte-blanche-block';
6
+ import type CTABlock from './cta-block';
7
+ import type ElementBlock from './element-block';
8
+ import type GridBlock from './grid-block';
9
+ import type GroupBlock from './group-block';
10
+ import type EnhHeadingBlock from './enh-heading-block';
11
+ import type HeadingBlock from './heading-block';
12
+ import type ImageBlock from './image-block';
13
+ import type VideoBlock from './video-block';
14
+ import type SpaceBlock from './space-block';
15
+ import { SPACE_DEFAULTS } from './space-block';
16
+ import type ScreenfulBlock from './screenful-block';
17
+ export { type AccordianBlock, type Block, type BulletCardsBlock, type CardBlock, type CarteBlancheBlock, type CTABlock, type ElementBlock, type GridBlock, type GroupBlock, type HeadingBlock, type EnhHeadingBlock, type ImageBlock, type VideoBlock, type SpaceBlock, type ScreenfulBlock, SPACE_DEFAULTS };
@@ -0,0 +1,2 @@
1
+ import { SPACE_DEFAULTS } from './space-block';
2
+ export { SPACE_DEFAULTS };
@@ -0,0 +1,41 @@
1
+ import type { ReactNode } from 'react';
2
+ import type Block from './block';
3
+ import type VideoBlock from './video-block';
4
+ /**
5
+ * A common screenful of content
6
+ * An optional banner image or video
7
+ * Content can be in columns
8
+ */
9
+ interface ScreenfulBlock extends Block {
10
+ blockType: 'screenful';
11
+ /**
12
+ * Either an image URL, or a Video Block
13
+ *
14
+ * If VideoBlock, then it's poster will be rendered server-side
15
+ * and the <video> component will be lazy-loaded client-side.
16
+ *
17
+ * If in a scrolling situation, the video will autoplay when 75% in view
18
+ */
19
+ banner?: string | VideoBlock;
20
+ /** Specifies rendering and layout hints and variants for block as a whole */
21
+ specifiers?: string;
22
+ /** Specifies rendering and layout hints and variants for corresponding column */
23
+ columnSpecifiers?: string[];
24
+ /**
25
+ * Mobile: The order in the single column mobile layout in which the columns appear.
26
+ * Overrides column order.
27
+ * eg, if you want the second tile of three at the top: [1, 0, 2]
28
+ */
29
+ mobileOrder?: number[];
30
+ /**
31
+ * Content Blocks for 1-3 columns.
32
+ * (More than that is allowed, but impractical at many resolutions!)
33
+ * If > 1, it will be enclosed in a 'grid grid-cols-<x>' div.
34
+ */
35
+ contentColumns: Block[][];
36
+ /** optional footer element below the grid */
37
+ footer?: ReactNode;
38
+ /** optional id for linking to this slide / screenful */
39
+ anchorId?: string;
40
+ }
41
+ export { type ScreenfulBlock as default };
@@ -0,0 +1 @@
1
+ export {};