this.gui 1.3.40 → 1.3.42

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 (319) hide show
  1. package/dist/init/index.html +27 -0
  2. package/dist/init/package-lock.json +5779 -0
  3. package/dist/init/package.json +24 -0
  4. package/dist/init/src/App.tsx +40 -0
  5. package/dist/init/src/index.css +16 -0
  6. package/dist/init/src/main.tsx +13 -0
  7. package/dist/init/src/router/DerivableRouter.tsx +36 -0
  8. package/dist/init/tsconfig.json +17 -0
  9. package/dist/init/vite.config.ts +11 -0
  10. package/package.json +5 -3
  11. package/src/GUI.tsx +46 -0
  12. package/src/QRouter/QRegistry.tsx +53 -0
  13. package/src/QRouter/QRouter.stories.tsx +31 -0
  14. package/src/QRouter/QRouter.tsx +57 -0
  15. package/src/gui/Theme/GuiProvider.tsx +111 -0
  16. package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
  17. package/src/gui/Theme/Icon/Icon.tsx +43 -0
  18. package/src/gui/Theme/Layout/Content/Content.resolver.tsx +0 -0
  19. package/src/gui/Theme/Layout/Content/Content.stories.tsx +88 -0
  20. package/src/gui/Theme/Layout/Content/Content.tsx +53 -0
  21. package/src/gui/Theme/Layout/Content/Content.types.tsx +40 -0
  22. package/src/gui/Theme/Layout/Footer/Footer.resolver.tsx +45 -0
  23. package/src/gui/Theme/Layout/Footer/Footer.stories.tsx +205 -0
  24. package/src/gui/Theme/Layout/Footer/Footer.tsx +337 -0
  25. package/src/gui/Theme/Layout/Footer/Footer.types.ts +40 -0
  26. package/src/gui/Theme/Layout/Layout/Layout.resolver.tsx +37 -0
  27. package/src/gui/Theme/Layout/Layout/Layout.stories.tsx +289 -0
  28. package/src/gui/Theme/Layout/Layout/Layout.tsx +117 -0
  29. package/src/gui/Theme/Layout/Layout/Layout.types.ts +57 -0
  30. package/src/gui/Theme/Layout/Layout/useLayoutBreakpoints.ts +9 -0
  31. package/src/gui/Theme/Layout/Namespace/Namespace.stories.tsx +105 -0
  32. package/src/gui/Theme/Layout/Namespace/Namespace.tsx +26 -0
  33. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
  34. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
  35. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
  36. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
  37. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
  38. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
  39. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
  40. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
  41. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +134 -0
  42. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +15 -0
  43. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
  44. package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
  45. package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
  46. package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.stories.tsx +239 -0
  47. package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
  48. package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
  49. package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
  50. package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
  51. package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
  52. package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
  53. package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
  54. package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.tsx +489 -0
  55. package/src/gui/Theme/Layout/TopBar/TopBar.resolver.tsx +86 -0
  56. package/src/gui/Theme/Layout/TopBar/TopBar.stories.tsx +350 -0
  57. package/src/gui/Theme/Layout/TopBar/TopBar.tsx +292 -0
  58. package/src/gui/Theme/Layout/TopBar/TopBar.types.ts +39 -0
  59. package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
  60. package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
  61. package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
  62. package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
  63. package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
  64. package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
  65. package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
  66. package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
  67. package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
  68. package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
  69. package/src/gui/Theme/catalog/CherryByte/CherryByte.png +0 -0
  70. package/src/gui/Theme/catalog/CherryByte/dark.tokens.ts +47 -0
  71. package/src/gui/Theme/catalog/CherryByte/light.tokens.ts +47 -0
  72. package/src/gui/Theme/catalog/CherryByte/manifest.ts +24 -0
  73. package/src/gui/Theme/catalog/GhostShell/dark.tokens.ts +43 -0
  74. package/src/gui/Theme/catalog/GhostShell/ghost.png +0 -0
  75. package/src/gui/Theme/catalog/GhostShell/light.tokens.ts +39 -0
  76. package/src/gui/Theme/catalog/GhostShell/manifest.ts +24 -0
  77. package/src/gui/Theme/catalog/LunaHex/LunaHex.png +0 -0
  78. package/src/gui/Theme/catalog/LunaHex/dark.tokens.ts +34 -0
  79. package/src/gui/Theme/catalog/LunaHex/light.tokens.ts +74 -0
  80. package/src/gui/Theme/catalog/LunaHex/manifest.ts +24 -0
  81. package/src/gui/Theme/catalog/MUI/MUI.png +0 -0
  82. package/src/gui/Theme/catalog/MUI/dark.tokens.ts +58 -0
  83. package/src/gui/Theme/catalog/MUI/light.tokens.ts +74 -0
  84. package/src/gui/Theme/catalog/MUI/manifest.ts +24 -0
  85. package/src/gui/Theme/catalog/PrinceOfDarkness/dark.tokens.ts +48 -0
  86. package/src/gui/Theme/catalog/PrinceOfDarkness/light.tokens.ts +47 -0
  87. package/src/gui/Theme/catalog/PrinceOfDarkness/manifest.ts +24 -0
  88. package/src/gui/Theme/catalog/PrinceOfDarkness/prince.png +0 -0
  89. package/src/gui/Theme/catalog/PrinceOfDarkness/princeOfDarkness.png +0 -0
  90. package/src/gui/Theme/catalog/Seafoam/dark.tokens.ts +49 -0
  91. package/src/gui/Theme/catalog/Seafoam/light.tokens.ts +47 -0
  92. package/src/gui/Theme/catalog/Seafoam/manifest.ts +24 -0
  93. package/src/gui/Theme/catalog/Seafoam/seaFoam.png +0 -0
  94. package/src/gui/Theme/catalog/neurons/dark.tokens.ts +58 -0
  95. package/src/gui/Theme/catalog/neurons/light.tokens.ts +74 -0
  96. package/src/gui/Theme/catalog/neurons/manifest.ts +24 -0
  97. package/src/gui/Theme/catalog/neurons/neurons.me.png +0 -0
  98. package/src/gui/Theme/fromTokens.ts +272 -0
  99. package/src/gui/Theme/gui.css +31 -0
  100. package/src/gui/Theme/index.ts +17 -0
  101. package/src/gui/Theme/styles/buildShadows.ts +83 -0
  102. package/src/gui/Theme/styles/theme.tokens.ts +108 -0
  103. package/src/gui/Theme/utils/catalog.ts +61 -0
  104. package/src/gui/Theme/utils/persistence.ts +66 -0
  105. package/src/gui/Theme/utils/themeUtils.ts +34 -0
  106. package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +46 -0
  107. package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +251 -0
  108. package/src/gui/components/atoms/AppBar/AppBar.tsx +107 -0
  109. package/src/gui/components/atoms/AppBar/AppBar.types.ts +28 -0
  110. package/src/gui/components/atoms/Avatar/Avatar.resolver.tsx +61 -0
  111. package/src/gui/components/atoms/Avatar/Avatar.stories.tsx +36 -0
  112. package/src/gui/components/atoms/Avatar/Avatar.tsx +14 -0
  113. package/src/gui/components/atoms/Box/Box.resolver.tsx +171 -0
  114. package/src/gui/components/atoms/Box/Box.stories.tsx +263 -0
  115. package/src/gui/components/atoms/Box/Box.tsx +15 -0
  116. package/src/gui/components/atoms/Button/Button.resolver.tsx +103 -0
  117. package/src/gui/components/atoms/Button/Button.stories.tsx +219 -0
  118. package/src/gui/components/atoms/Button/Button.tsx +40 -0
  119. package/src/gui/components/atoms/Card/Card.resolver.tsx +63 -0
  120. package/src/gui/components/atoms/Card/Card.stories.tsx +54 -0
  121. package/src/gui/components/atoms/Card/Card.tsx +13 -0
  122. package/src/gui/components/atoms/CardActions/CardActions.resolver.tsx +59 -0
  123. package/src/gui/components/atoms/CardActions/CardActions.stories.tsx +32 -0
  124. package/src/gui/components/atoms/CardActions/CardActions.tsx +14 -0
  125. package/src/gui/components/atoms/CardContent/CardContent.resolver.tsx +60 -0
  126. package/src/gui/components/atoms/CardContent/CardContent.stories.tsx +34 -0
  127. package/src/gui/components/atoms/CardContent/CardContent.tsx +13 -0
  128. package/src/gui/components/atoms/CardHeader/CardHeader.resolver.tsx +68 -0
  129. package/src/gui/components/atoms/CardHeader/CardHeader.stories.tsx +40 -0
  130. package/src/gui/components/atoms/CardHeader/CardHeader.tsx +12 -0
  131. package/src/gui/components/atoms/Collapse/Collapse.resolver.tsx +85 -0
  132. package/src/gui/components/atoms/Collapse/Collapse.stories.tsx +130 -0
  133. package/src/gui/components/atoms/Collapse/Collapse.tsx +17 -0
  134. package/src/gui/components/atoms/Divider/Divider.resolver.tsx +95 -0
  135. package/src/gui/components/atoms/Divider/Divider.stories.tsx +108 -0
  136. package/src/gui/components/atoms/Divider/Divider.tsx +14 -0
  137. package/src/gui/components/atoms/Drawer/Drawer.resolver.tsx +116 -0
  138. package/src/gui/components/atoms/Drawer/Drawer.stories.tsx +223 -0
  139. package/src/gui/components/atoms/Drawer/Drawer.tsx +25 -0
  140. package/src/gui/components/atoms/Grid/Grid.resolver.tsx +33 -0
  141. package/src/gui/components/atoms/Grid/Grid.stories.tsx +136 -0
  142. package/src/gui/components/atoms/Grid/Grid.tsx +15 -0
  143. package/src/gui/components/atoms/Grid/Grid.types.ts +9 -0
  144. package/src/gui/components/atoms/IconButton/IconButton.resolver.tsx +137 -0
  145. package/src/gui/components/atoms/IconButton/IconButton.stories.tsx +134 -0
  146. package/src/gui/components/atoms/IconButton/IconButton.tsx +22 -0
  147. package/src/gui/components/atoms/Link/Link.resolver.tsx +74 -0
  148. package/src/gui/components/atoms/Link/Link.stories.tsx +157 -0
  149. package/src/gui/components/atoms/Link/Link.tsx +36 -0
  150. package/src/gui/components/atoms/List/List.resolver.tsx +94 -0
  151. package/src/gui/components/atoms/List/List.stories.tsx +137 -0
  152. package/src/gui/components/atoms/List/List.tsx +20 -0
  153. package/src/gui/components/atoms/ListItem/ListItem.resolver.tsx +88 -0
  154. package/src/gui/components/atoms/ListItem/ListItem.stories.tsx +151 -0
  155. package/src/gui/components/atoms/ListItem/ListItem.tsx +19 -0
  156. package/src/gui/components/atoms/ListItemButton/ListItemButton.resolver.tsx +214 -0
  157. package/src/gui/components/atoms/ListItemButton/ListItemButton.stories.tsx +155 -0
  158. package/src/gui/components/atoms/ListItemButton/ListItemButton.tsx +15 -0
  159. package/src/gui/components/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
  160. package/src/gui/components/atoms/ListItemIcon/ListItemIcon.stories.tsx +132 -0
  161. package/src/gui/components/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
  162. package/src/gui/components/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
  163. package/src/gui/components/atoms/ListItemText/ListItemText.stories.tsx +156 -0
  164. package/src/gui/components/atoms/ListItemText/ListItemText.tsx +15 -0
  165. package/src/gui/components/atoms/Menu/Menu.resolver.tsx +112 -0
  166. package/src/gui/components/atoms/Menu/Menu.stories.tsx +162 -0
  167. package/src/gui/components/atoms/Menu/Menu.tsx +17 -0
  168. package/src/gui/components/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
  169. package/src/gui/components/atoms/MenuItem/MenuItem.stories.tsx +134 -0
  170. package/src/gui/components/atoms/MenuItem/MenuItem.tsx +14 -0
  171. package/src/gui/components/atoms/Paper/Paper.resolver.tsx +98 -0
  172. package/src/gui/components/atoms/Paper/Paper.stories.tsx +184 -0
  173. package/src/gui/components/atoms/Paper/Paper.tsx +15 -0
  174. package/src/gui/components/atoms/Section/Section.resolver.tsx +10 -0
  175. package/src/gui/components/atoms/Section/Section.stories.tsx +189 -0
  176. package/src/gui/components/atoms/Section/Section.tsx +76 -0
  177. package/src/gui/components/atoms/Section/Section.types.tsx +24 -0
  178. package/src/gui/components/atoms/Stack/Stack.resolver.tsx +94 -0
  179. package/src/gui/components/atoms/Stack/Stack.stories.tsx +160 -0
  180. package/src/gui/components/atoms/Stack/Stack.tsx +15 -0
  181. package/src/gui/components/atoms/Surface/Surface.resolver.tsx +37 -0
  182. package/src/gui/components/atoms/Surface/Surface.tsx +49 -0
  183. package/src/gui/components/atoms/Surface/Surface.types.ts +20 -0
  184. package/src/gui/components/atoms/Switch/Switch.resolver.tsx +53 -0
  185. package/src/gui/components/atoms/Switch/Switch.stories.tsx +236 -0
  186. package/src/gui/components/atoms/Switch/Switch.tsx +22 -0
  187. package/src/gui/components/atoms/Table/Body/TableBody.tsx +7 -0
  188. package/src/gui/components/atoms/Table/Cell/TableCell.tsx +18 -0
  189. package/src/gui/components/atoms/Table/Head/TableHead.tsx +9 -0
  190. package/src/gui/components/atoms/Table/Row/TableRow.tsx +20 -0
  191. package/src/gui/components/atoms/Table/Table.resolver.tsx +77 -0
  192. package/src/gui/components/atoms/Table/Table.stories.tsx +173 -0
  193. package/src/gui/components/atoms/Table/Table.tsx +20 -0
  194. package/src/gui/components/atoms/TextField/TextField.stories.tsx +25 -0
  195. package/src/gui/components/atoms/TextField/TextField.tsx +15 -0
  196. package/src/gui/components/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
  197. package/src/gui/components/atoms/Toolbar/Toolbar.stories.tsx +155 -0
  198. package/src/gui/components/atoms/Toolbar/Toolbar.tsx +16 -0
  199. package/src/gui/components/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
  200. package/src/gui/components/atoms/Tooltip/Tooltip.stories.tsx +117 -0
  201. package/src/gui/components/atoms/Tooltip/Tooltip.tsx +70 -0
  202. package/src/gui/components/atoms/Typography/Typography.resolver.tsx +158 -0
  203. package/src/gui/components/atoms/Typography/Typography.stories.tsx +222 -0
  204. package/src/gui/components/atoms/Typography/Typography.tsx +27 -0
  205. package/src/gui/components/atoms/Window/Nodes/node.ts +0 -0
  206. package/src/gui/components/atoms/Window/code/block/node.tsx +0 -0
  207. package/src/gui/components/atoms/Window/code/hugging.face.api.ts +11 -0
  208. package/src/gui/components/atoms/Window/connectors/index.ts +19 -0
  209. package/src/gui/components/atoms/Window/window.stories.tsx +20 -0
  210. package/src/gui/components/atoms/Window/window.tsx +636 -0
  211. package/src/gui/components/atoms/atoms.tsx +151 -0
  212. package/src/gui/components/atoms/index.ts +2 -0
  213. package/src/gui/components/generics/Cards/Gridme.jsx +52 -0
  214. package/src/gui/components/generics/Cards/LilBox.jsx +65 -0
  215. package/src/gui/components/generics/Cards/ModuleCard.jsx +106 -0
  216. package/src/gui/components/generics/Chats/FullChatBot.jsx +223 -0
  217. package/src/gui/components/generics/Code/CodeBlock.jsx +33 -0
  218. package/src/gui/components/generics/EmojiCursor/EmojiCursor.stories.tsx +153 -0
  219. package/src/gui/components/generics/EmojiCursor/EmojiCursor.tsx +23 -0
  220. package/src/gui/components/generics/Feedback/Callout.jsx +92 -0
  221. package/src/gui/components/generics/Layout/GridX.jsx +29 -0
  222. package/src/gui/components/generics/Layout/Hero2.jsx +132 -0
  223. package/src/gui/components/generics/Layout/PageContainer.jsx +29 -0
  224. package/src/gui/components/generics/Layout/PageDivider.jsx +20 -0
  225. package/src/gui/components/generics/Layout/Section.jsx +43 -0
  226. package/src/gui/components/generics/Layout/SectionHeader.jsx +21 -0
  227. package/src/gui/components/generics/Media/Img.jsx +58 -0
  228. package/src/gui/components/generics/Media/VideoEmbed.jsx +51 -0
  229. package/src/gui/components/generics/Organization/TableOfContents.jsx +51 -0
  230. package/src/gui/components/generics/Organization/Tabs.jsx +45 -0
  231. package/src/gui/components/generics/Text/TextList.jsx +41 -0
  232. package/src/gui/components/generics/Text/TextParagraph.jsx +28 -0
  233. package/src/gui/components/generics/Text/TextQuote.jsx +23 -0
  234. package/src/gui/components/generics/Text/TextTitle.jsx +44 -0
  235. package/src/gui/components/molecules/Dialog/Dialog.stories.tsx +18 -0
  236. package/src/gui/components/molecules/Dialog/Dialog.tsx +5 -0
  237. package/src/gui/components/molecules/Hero/Hero.stories.tsx +140 -0
  238. package/src/gui/components/molecules/Hero/Hero.tsx +152 -0
  239. package/src/gui/components/molecules/Hero/Hero.types.tsx +18 -0
  240. package/src/gui/components/molecules/Modal/Modal.resolver.tsx +38 -0
  241. package/src/gui/components/molecules/Modal/Modal.stories.tsx +82 -0
  242. package/src/gui/components/molecules/Modal/Modal.tsx +110 -0
  243. package/src/gui/components/molecules/Modal/Modal.types.ts +29 -0
  244. package/src/gui/components/molecules/Page/Page.stories.tsx +135 -0
  245. package/src/gui/components/molecules/Page/Page.tsx +94 -0
  246. package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.resolver.tsx +58 -0
  247. package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.stories.tsx +133 -0
  248. package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.tsx +101 -0
  249. package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.types.ts +29 -0
  250. package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.resolver.tsx +15 -0
  251. package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.stories.tsx +88 -0
  252. package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.tsx +167 -0
  253. package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.types.ts +34 -0
  254. package/src/gui/components/molecules/molecules.ts +49 -0
  255. package/src/gui/components/organisms/Blockchain/Blocks/BlocksTable.tsx +119 -0
  256. package/src/gui/components/organisms/Blockchain/Usernames/Identities.stories.tsx +20 -0
  257. package/src/gui/components/organisms/Blockchain/Usernames/QR.tsx +566 -0
  258. package/src/gui/components/organisms/Blockchain/Usernames/Usernames.tsx +448 -0
  259. package/src/gui/components/organisms/Blockchain/Usernames/identities.tsx +710 -0
  260. package/src/gui/components/organisms/Blockchain/blockchain.stories.tsx +17 -0
  261. package/src/gui/components/organisms/Blockchain/blockchain.tsx +368 -0
  262. package/src/gui/components/organisms/Blockchain/scripts/connection.ts +82 -0
  263. package/src/gui/components/organisms/Blockchain/scripts/match_face.ts +143 -0
  264. package/src/gui/components/organisms/HighLighter/HighLighter.stories.tsx +168 -0
  265. package/src/gui/components/organisms/HighLighter/HighLighter.tsx +420 -0
  266. package/src/gui/components/organisms/HighLighter/HighLightsDrawer.tsx +197 -0
  267. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.stories.tsx +312 -0
  268. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.tsx +765 -0
  269. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceCameraPermission.ts +70 -0
  270. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceLandmarker.ts +106 -0
  271. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceOverlay.ts +489 -0
  272. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplate.ts +32 -0
  273. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplateBurst.ts +178 -0
  274. package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/verifyTemplate.ts +136 -0
  275. package/src/gui/components/organisms/IdentityNoise/IdentityNoise.tsx +403 -0
  276. package/src/gui/components/organisms/IdentityNoise/IndentityNoise.stories.tsx +15 -0
  277. package/src/gui/components/organisms/IdentityNoise/Noise/Noise.stories.tsx +206 -0
  278. package/src/gui/components/organisms/IdentityNoise/Noise/Noise.tsx +394 -0
  279. package/src/gui/components/organisms/IdentityNoise/Triad/QR.tsx +566 -0
  280. package/src/gui/components/organisms/IdentityNoise/Triad/Tiad.stories.tsx +6 -0
  281. package/src/gui/components/organisms/IdentityNoise/Triad/Triad.tsx +917 -0
  282. package/src/gui/components/organisms/IdentityNoise/Triad/handleCleak.ts +0 -0
  283. package/src/gui/components/organisms/IdentityNoise/Triad/identity.ts +31 -0
  284. package/src/gui/components/organisms/IdentityNoise/Triad/me/fundamentals/vectors/vectors.tsx +252 -0
  285. package/src/gui/components/organisms/IdentityNoise/Triad/me/me.stories.tsx +314 -0
  286. package/src/gui/components/organisms/IdentityNoise/Triad/me/me.tsx +0 -0
  287. package/src/gui/components/organisms/organisms.ts +15 -0
  288. package/src/gui/contexts/InsetsContext.tsx +40 -0
  289. package/src/gui/contexts/LeftSidebarContext.tsx +20 -0
  290. package/src/gui/contexts/RightSidebarContext.tsx +25 -0
  291. package/src/gui/contexts/ThemeContext.ts +34 -0
  292. package/src/gui/contexts/index.ts +4 -0
  293. package/src/gui/hooks/index.ts +11 -0
  294. package/src/gui/hooks/resolveColorToken.ts +39 -0
  295. package/src/gui/hooks/useCodeGen.ts +12 -0
  296. package/src/gui/hooks/useGuiMediaQuery.ts +18 -0
  297. package/src/gui/hooks/useGuiTheme.ts +18 -0
  298. package/src/gui/hooks/useInsets.ts +26 -0
  299. package/src/gui/hooks/useIsMobile.ts +13 -0
  300. package/src/gui/hooks/useIsTouchDevice.ts +25 -0
  301. package/src/gui/hooks/useLeftSidebar.ts +10 -0
  302. package/src/gui/hooks/useRightSidebar.ts +12 -0
  303. package/src/gui/hooks/useViewportKey.ts +19 -0
  304. package/src/gui/hooks/useViewportProp.ts +17 -0
  305. package/src/gui/registry/GuiRegistry.ts +19 -0
  306. package/src/gui/registry/factory.ts +12 -0
  307. package/src/gui/registry/index.ts +3 -0
  308. package/src/gui/registry/types.ts +6 -0
  309. package/src/gui/utils/nodeID.ts +11 -0
  310. package/src/registry/GuiRegistry.ts +19 -0
  311. package/src/stories/01.Home.mdx +22 -0
  312. package/src/stories/02.Understanding.This.GUI.mdx +149 -0
  313. package/src/stories/Theme/Palette.stories.tsx +86 -0
  314. package/src/stories/Theme/ThemeViewer.stories.tsx +91 -0
  315. package/src/stories/Theme/Typography.stories.jsx +211 -0
  316. package/src/stories/assets/this.GUI.png +0 -0
  317. package/src/types/gui.d.ts +67 -0
  318. package/src/types/theme.d.ts +191 -0
  319. package/src/types/viewport.ts +132 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * ## Theme Viewer Story
3
+ *
4
+ * This story provides a live JSON visualization of your theme context and MUI theme.
5
+ *
6
+ * ### What you will see:
7
+ * - `mode`: Comes from your `ThemeContext`, shows if your theme is in `light` or `dark` mode.
8
+ * - `palette`: Full palette details from MUI's `createTheme`, including all primary/secondary colors, actions, background, etc.
9
+ * - `insets`: Comes from `InsetsContext`, gives layout-safe-area insets for notch-aware designs (top, right, bottom, left).
10
+ *
11
+ * ### Why use this?
12
+ * It’s useful for debugging:
13
+ * - If your theme is being applied correctly
14
+ * - How your layout adjusts with different inset values
15
+ * - How palettes resolve across modes
16
+ *
17
+ * Great for verifying dynamic theme changes or testing new color tokens.
18
+ */
19
+ import type { Meta } from '@storybook/react';
20
+ import { useTheme } from '@mui/material/styles';
21
+ import { useThemeContext } from '@/gui/contexts/ThemeContext';
22
+ import { useInsets } from '@/gui/hooks';
23
+
24
+ /**
25
+ * Story: CurrentThemeState
26
+ *
27
+ * This Storybook story displays the current theme state injected via MUI's ThemeProvider
28
+ * along with custom context values such as `mode` (from ThemeContext) and `insets` (from InsetsContext).
29
+ *
30
+ * The output includes:
31
+ * - `mode`: Light/dark mode from the app's ThemeContext
32
+ * - `palette`: Full palette object from MUI's `createTheme`, including color tokens and UI actions
33
+ * - `insets`: Safe area insets (top/right/bottom/left) for layout padding/margin
34
+ *
35
+ * Useful for debugging how the current theme looks, understanding the applied color system,
36
+ * and ensuring injected context values are correctly picked up across the app.
37
+ */
38
+ export const CurrentThemeState = () => {
39
+ const theme = useTheme();
40
+ const { mode, themeId } = useThemeContext();
41
+ const { insets } = useInsets();
42
+ return (
43
+ <pre style={{ padding: 16 }}>
44
+ <code>
45
+ {JSON.stringify(
46
+ {
47
+ mode,
48
+ themeId,
49
+ palette: theme.palette,
50
+ fontFamily: theme.typography?.fontFamily,
51
+ typography: theme.typography,
52
+ insets,
53
+ },
54
+ null,
55
+ 2
56
+ )}
57
+ </code>
58
+ </pre>
59
+ );
60
+ };
61
+
62
+ export default {
63
+ title: 'Theme/Viewer',
64
+ component: CurrentThemeState,
65
+ tags: ['autodocs'],
66
+ parameters: {
67
+ docs: {
68
+ description: {
69
+ component: `
70
+ This story renders the **active theme state** used throughout your app.
71
+
72
+ ### What you will see:
73
+ - \`mode\`: Current light/dark mode from ThemeContext
74
+ - \`palette\`: Full MUI palette object generated from createTheme(), including:
75
+ - primary, secondary, error, warning, success, info colors
76
+ - background and text colors
77
+ - action states (hover, focus, selected, etc.)
78
+ - \`insets\`: Safe area layout padding (top/right/bottom/left) from InsetsContext (useful for notch-aware design)
79
+
80
+ ### Why this is useful:
81
+ - Debug whether the correct theme is being used
82
+ - Inspect how palette tokens resolve dynamically
83
+ - Verify how inset values change (iOS, Android, desktop)
84
+ - Helps debug dynamic theme toggles and token propagation
85
+
86
+ Ideal for inspecting changes in real-time while modifying theme-related code or tokens.
87
+ `,
88
+ },
89
+ },
90
+ },
91
+ } satisfies Meta<typeof CurrentThemeState>;
@@ -0,0 +1,211 @@
1
+ // src/stories/Theme/Typography.stories.jsx
2
+ import { Box, Typography, Paper, Divider, Stack, Chip } from '@mui/material';
3
+ import { useTheme } from '@mui/material/styles';
4
+
5
+ /**
6
+ * Small helper to render a sample block for a variant
7
+ */
8
+ const TypeRow = ({ variant, sample = 'The quick brown fox jumps over the lazy dog 1234', extra }) => {
9
+ const theme = useTheme();
10
+ const v = theme.typography?.[variant] || {};
11
+ const lineHeight = typeof v.lineHeight === 'number' ? v.lineHeight : String(v.lineHeight || '');
12
+ const fontSize = v.fontSize || '';
13
+ const weight = v.fontWeight || '';
14
+
15
+ return (
16
+ <Paper
17
+ variant="outlined"
18
+ sx={{
19
+ p: 1.25,
20
+ borderColor: theme.custom?.border || theme.palette.divider,
21
+ bgcolor: 'background.paper',
22
+ minWidth: 280,
23
+ flex: '1 1 320px',
24
+ }}
25
+ >
26
+ <Typography variant="caption" sx={{ color: 'text.secondary', fontWeight: 700 }}>
27
+ {variant}
28
+ </Typography>
29
+ <Typography variant={variant} sx={{ mt: 0.5 }}>
30
+ {sample}
31
+ </Typography>
32
+ <Divider sx={{ my: 1 }} />
33
+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>
34
+ <strong>font-size:</strong> {fontSize}{' '}
35
+ <strong>line-height:</strong> {lineHeight}{' '}
36
+ <strong>font-weight:</strong> {weight || '—'}
37
+ {extra ? <> · {extra}</> : null}
38
+ </Typography>
39
+ </Paper>
40
+ );
41
+ };
42
+
43
+ const Section = ({ title, hint, children }) => (
44
+ <Box sx={{ my: 3 }}>
45
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
46
+ <Typography variant="h5" sx={{ fontWeight: 700 }}>
47
+ {title}
48
+ </Typography>
49
+ {hint ? <Chip size="small" label={hint} /> : null}
50
+ </Box>
51
+ <Divider sx={{ my: 1.5 }} />
52
+ {children}
53
+ </Box>
54
+ );
55
+
56
+ /**
57
+ * Preview of the main typography scale coming from the active theme.
58
+ * Uses whatever your token engine compiled into theme.typography.
59
+ */
60
+ function TypographyScale() {
61
+ const theme = useTheme();
62
+
63
+ const variants = [
64
+ 'h1',
65
+ 'h2',
66
+ 'h3',
67
+ 'h4',
68
+ 'h5',
69
+ 'subtitle1',
70
+ 'body1',
71
+ 'body2',
72
+ 'button',
73
+ ];
74
+
75
+ return (
76
+ <Box sx={{ p: 2, bgcolor: 'background.default', color: 'text.primary' }}>
77
+ <Section title="Font Family">
78
+ <Typography variant="body2">
79
+ <strong>theme.typography.fontFamily:</strong>{' '}
80
+ <code>{theme.typography?.fontFamily}</code>
81
+ </Typography>
82
+ </Section>
83
+
84
+ <Section title="Variants">
85
+ <Stack direction="row" spacing={1.25} useFlexGap flexWrap="wrap">
86
+ {variants.map((v) => (
87
+ <TypeRow key={v} variant={v} />
88
+ ))}
89
+ </Stack>
90
+ </Section>
91
+ </Box>
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Extra details from tokens exposed in the runtime:
97
+ * - lineHeights scale (if defined in theme.typography.lineHeights)
98
+ * - weights (if your tokens encode them)
99
+ */
100
+ function TypographyDetails() {
101
+ const theme = useTheme();
102
+ const lh = theme.typography?.lineHeights || {};
103
+ const weights = {
104
+ bold: theme.typography?.fontWeightBold,
105
+ medium: theme.typography?.fontWeightMedium,
106
+ regular: theme.typography?.fontWeightRegular,
107
+ };
108
+
109
+ return (
110
+ <Box sx={{ p: 2, bgcolor: 'background.default', color: 'text.primary' }}>
111
+ <Section title="Line Heights Scale" hint="From tokens → theme.typography.lineHeights">
112
+ {Object.keys(lh).length ? (
113
+ <Stack direction="row" spacing={1.25} useFlexGap flexWrap="wrap">
114
+ {Object.entries(lh).map(([k, v]) => (
115
+ <Paper
116
+ key={k}
117
+ variant="outlined"
118
+ sx={{
119
+ p: 1.25,
120
+ minWidth: 160,
121
+ borderColor: theme.custom?.border || theme.palette.divider,
122
+ }}
123
+ >
124
+ <Typography variant="body2" sx={{ fontWeight: 700 }}>
125
+ {k}
126
+ </Typography>
127
+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>
128
+ {String(v)}
129
+ </Typography>
130
+ <Divider sx={{ my: 1 }} />
131
+ <Typography sx={{ lineHeight: Number(v) || v }}>
132
+ The quick brown fox jumps over the lazy dog.
133
+ </Typography>
134
+ </Paper>
135
+ ))}
136
+ </Stack>
137
+ ) : (
138
+ <Typography variant="body2" sx={{ color: 'text.secondary' }}>
139
+ No custom line height scale found in theme.typography.lineHeights.
140
+ </Typography>
141
+ )}
142
+ </Section>
143
+
144
+ <Section title="Font Weights (if provided)">
145
+ <Stack direction="row" spacing={1.25} useFlexGap flexWrap="wrap">
146
+ {Object.entries(weights).map(([k, v]) => (
147
+ <Paper
148
+ key={k}
149
+ variant="outlined"
150
+ sx={{
151
+ p: 1.25,
152
+ minWidth: 160,
153
+ borderColor: theme.custom?.border || theme.palette.divider,
154
+ }}
155
+ >
156
+ <Typography variant="body2" sx={{ fontWeight: 700 }}>
157
+ {k}
158
+ </Typography>
159
+ <Typography variant="caption" sx={{ color: 'text.secondary' }}>
160
+ {v ?? '—'}
161
+ </Typography>
162
+ <Divider sx={{ my: 1 }} />
163
+ <Typography sx={{ fontWeight: v ?? 600 }}>
164
+ The quick brown fox jumps over the lazy dog.
165
+ </Typography>
166
+ </Paper>
167
+ ))}
168
+ </Stack>
169
+ </Section>
170
+ </Box>
171
+ );
172
+ }
173
+
174
+ export default {
175
+ title: 'Theme/Typography',
176
+ tags: ['autodocs'],
177
+ parameters: {
178
+ docs: {
179
+ description: {
180
+ component:
181
+ 'Typography scale compiled from tokens. Shows font family, variant sizes/weights/line-height, and optional line-height scale & weights if your tokens expose them.',
182
+ },
183
+ },
184
+ },
185
+ };
186
+
187
+ export const Scale = {
188
+ name: 'Scale',
189
+ render: () => <TypographyScale />,
190
+ parameters: {
191
+ docs: {
192
+ description: {
193
+ story:
194
+ 'Core typography variants from the active theme (h1–h5, subtitle1, body1, body2, button).',
195
+ },
196
+ },
197
+ },
198
+ };
199
+
200
+ export const Details = {
201
+ name: 'Details (Line Heights & Weights)',
202
+ render: () => <TypographyDetails />,
203
+ parameters: {
204
+ docs: {
205
+ description: {
206
+ story:
207
+ 'Optional token-driven extras: line-height scale and font weights if present in the compiled theme.',
208
+ },
209
+ },
210
+ },
211
+ };
Binary file
@@ -0,0 +1,67 @@
1
+ import type {
2
+ GuiProvider,
3
+ useThemeContext,
4
+ TopBar,
5
+ useCodeGen,
6
+ LeftSidebar,
7
+ RightSidebar,
8
+ Layout,
9
+ StickyOptionsTop,
10
+ RootDomain,
11
+ TextTitle,
12
+ TextParagraph,
13
+ TextList,
14
+ TextQuote,
15
+ Surface,
16
+ TextField,
17
+ Img,
18
+ VideoEmbed,
19
+ TableOfContents,
20
+ Tabs,
21
+ PageContainer,
22
+ Gridx,
23
+ Section,
24
+ SectionHeader,
25
+ PageDivider,
26
+ Hero2,
27
+ CodeBlock,
28
+ Footer,
29
+ Callout,
30
+ ModuleCard,
31
+ LilBox,
32
+ Gridme,
33
+ } from "../../index";
34
+
35
+ export type GUIType = {
36
+ GuiProvider: typeof GuiProvider;
37
+ useThemeContext: typeof useThemeContext;
38
+ TopBar: typeof TopBar;
39
+ useCodeGen: typeof useCodeGen;
40
+ LeftSidebar: typeof LeftSidebar;
41
+ RightSidebar: typeof RightSidebar;
42
+ Layout: typeof Layout;
43
+ StickyOptionsTop: typeof StickyOptionsTop;
44
+ RootDomain: typeof RootDomain;
45
+ TextTitle: typeof TextTitle;
46
+ TextParagraph: typeof TextParagraph;
47
+ TextList: typeof TextList;
48
+ TextQuote: typeof TextQuote;
49
+ Surface: typeof Surface;
50
+ TextField: typeof TextField;
51
+ Img: typeof Img;
52
+ VideoEmbed: typeof VideoEmbed;
53
+ TableOfContents: typeof TableOfContents;
54
+ Tabs: typeof Tabs;
55
+ PageContainer: typeof PageContainer;
56
+ Gridx: typeof Gridx;
57
+ Section: typeof Section;
58
+ SectionHeader: typeof SectionHeader;
59
+ PageDivider: typeof PageDivider;
60
+ Hero2: typeof Hero2;
61
+ CodeBlock: typeof CodeBlock;
62
+ Footer: typeof Footer;
63
+ Callout: typeof Callout;
64
+ ModuleCard: typeof ModuleCard;
65
+ LilBox: typeof LilBox;
66
+ Gridme: typeof Gridme;
67
+ };
@@ -0,0 +1,191 @@
1
+ // src/types/theme.d.ts
2
+ import '@mui/material/styles';
3
+ // Module augmentation so TS knows about our theme extensions injected by GuiProvider
4
+ declare module '@mui/material/styles' {
5
+ /** Insets reported at runtime by NavBar/Drawers and read by layout components */
6
+ interface Insets {
7
+ left: number;
8
+ right: number;
9
+ top: number;
10
+ bottom: number;
11
+ }
12
+
13
+ /** Runtime theme (what useTheme() returns) */
14
+ interface Theme {
15
+ layout: { insets: Insets };
16
+ /** Callback to update insets; injected by GuiProvider */
17
+ updateInsets?: (next: Partial<Insets>) => void;
18
+ /** Optional legacy field for back-compat (some code reads theme.insets) */
19
+ insets?: Partial<Insets>;
20
+ /** Parking spot for all design tokens not mapped natively to MUI */
21
+ custom: Record<string, any>;
22
+ }
23
+
24
+ /** Accepted options when creating the theme */
25
+ interface ThemeOptions {
26
+ layout?: { insets?: Partial<Insets> };
27
+ updateInsets?: (next: Partial<Insets>) => void;
28
+ /** Optional legacy field for back-compat */
29
+ insets?: Partial<Insets>;
30
+ /** Parking spot for all design tokens not mapped natively to MUI */
31
+ custom?: Record<string, any>;
32
+ }
33
+ }
34
+
35
+ export type ThemeManifest = {
36
+ themeId?: string;
37
+ themeName?: string;
38
+ description?: string;
39
+ author?: string;
40
+ version?: string;
41
+ license?: string;
42
+ homepage?: string;
43
+ tags?: string[];
44
+ createdAt?: string;
45
+ updatedAt?: string;
46
+ badgeUrl: string;
47
+ mode: {
48
+ light?: Record<string, any> | string;
49
+ dark?: Record<string, any> | string;
50
+ };
51
+ defaultMode?: 'light' | 'dark';
52
+ };
53
+
54
+ export type GuiTheme = {
55
+ themeId: string; // unique identifier (e.g. UUID)
56
+ themeName: string; // human-readable name
57
+ // top-level manifest metadata (copied from ThemeManifest)
58
+ description?: string;
59
+ author?: string;
60
+ version?: string;
61
+ license?: string;
62
+ homepage?: string;
63
+ tags?: string[];
64
+ createdAt?: string;
65
+ updatedAt?: string;
66
+ badgeUrl?: string;
67
+ // group of modes for this theme
68
+ mode: {
69
+ light?: Record<string, any>;
70
+ dark?: Record<string, any>;
71
+ };
72
+ };
73
+
74
+ export interface FlatGuiTheme {
75
+ themeId: string;
76
+ themeName: string;
77
+ description?: string;
78
+ author?: string;
79
+ version?: string;
80
+ license?: string;
81
+ homepage?: string;
82
+ tags?: string[];
83
+ createdAt?: string;
84
+ updatedAt?: string;
85
+ badgeUrl?: string;
86
+ mode: 'light' | 'dark';
87
+ tokens: string | Record<string, any>;
88
+ }
89
+
90
+ // GuiContextValue types (from GuiProvider)
91
+ export type GuiContextValue = {
92
+ themeId: string;
93
+ setThemeId: (id: string) => void;
94
+ themeName: string;
95
+ mode: 'light' | 'dark';
96
+ toggleMode: () => void;
97
+ setMode: (mode: 'light' | 'dark') => void;
98
+ };
99
+
100
+ // Augment MUI Theme to include custom tokens and insets
101
+ import '@mui/material/styles';
102
+ declare module '@mui/material/styles' {
103
+ // -----------------------------
104
+ // Palette extensions
105
+ // -----------------------------
106
+ interface TypeBackground {
107
+ /** Custom background color for navigation surfaces (e.g., AppBar). */
108
+ nav?: string;
109
+ }
110
+
111
+ interface Palette {
112
+ /** Default/iconic color separate from text/action semantics. */
113
+ icon: Palette['primary'];
114
+ /** Link colors (normal + optional visited). */
115
+ link: { main: string; visited?: string };
116
+ }
117
+ interface PaletteOptions {
118
+ icon?: PaletteOptions['primary'];
119
+ link?: { main: string; visited?: string };
120
+ }
121
+
122
+ // -----------------------------
123
+ // Typography extensions
124
+ // -----------------------------
125
+ interface TypographyVariants {
126
+ /** Optional helper scale for line-heights used by generators/utilities. */
127
+ lineHeights?: {
128
+ tight?: number;
129
+ normal?: number;
130
+ relaxed?: number;
131
+ [key: string]: number | undefined;
132
+ };
133
+ }
134
+ interface TypographyVariantsOptions {
135
+ lineHeights?: {
136
+ tight?: number;
137
+ normal?: number;
138
+ relaxed?: number;
139
+ [key: string]: number | undefined;
140
+ };
141
+ }
142
+
143
+ // -----------------------------
144
+ // Theme extensions
145
+ // -----------------------------
146
+ interface Theme {
147
+ /** Runtime layout insets coordinated by NavBar/Drawers (pixels). */
148
+ layout: {
149
+ insets: { left: number; right: number; top: number; bottom: number };
150
+ };
151
+ /** Callback exposed by GuiProvider to update insets at runtime. */
152
+ updateInsets?: (v: Partial<{ left: number; right: number; top: number; bottom: number }>) => void;
153
+ /** Bag for tokens that don't map 1:1 to MUI. */
154
+ custom?: {
155
+ border?: string;
156
+ gradients?: unknown;
157
+ overlays?: unknown;
158
+ iconSizes?: Record<string, unknown>;
159
+ lineHeights?: Record<string, unknown>;
160
+ [key: string]: unknown;
161
+ };
162
+ /** (Optional) legacy insets for backwards compatibility. */
163
+ insets?: { left?: number; right?: number; top?: number; bottom?: number };
164
+ GUI: {
165
+ // This was changed from `thisGui` to `GUI` as per instructions
166
+ [key: string]: unknown;
167
+ };
168
+ }
169
+
170
+ interface ThemeOptions {
171
+ layout?: {
172
+ insets?: Partial<{ left: number; right: number; top: number; bottom: number }>;
173
+ };
174
+ updateInsets?: (v: Partial<{ left: number; right: number; top: number; bottom: number }>) => void;
175
+ custom?: {
176
+ border?: string;
177
+ gradients?: unknown;
178
+ overlays?: unknown;
179
+ iconSizes?: Record<string, unknown>;
180
+ lineHeights?: Record<string, unknown>;
181
+ [key: string]: unknown;
182
+ };
183
+ insets?: Partial<{ left: number; right: number; top: number; bottom: number }>;
184
+ GUI?: {
185
+ // This was changed from `thisGui` to `GUI` as per instructions
186
+ [key: string]: unknown;
187
+ };
188
+ }
189
+ }
190
+
191
+ export {};
@@ -0,0 +1,132 @@
1
+ // src/types/viewport.ts
2
+ // Shared viewport types + helpers for responsive, declarative variants.
3
+ // These utilities do not depend on React. They accept an optional MUI Theme
4
+ // but also work without it (fallbacks to MUI default breakpoint values).
5
+
6
+ // ---- Types -----------------------------------------------------------------
7
+
8
+ /** MUI-aligned viewport keys. Keep in sync with your theme breakpoints. */
9
+ export type ViewportKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
10
+
11
+ /** Map viewport → variant/value. You may also include a global `default`. */
12
+ export type ViewportMap<TVariant extends string | number | boolean | object> = Partial<
13
+ Record<ViewportKey, TVariant>
14
+ > & { default?: TVariant };
15
+
16
+ /**
17
+ * Prop that can be a single value (applies to all sizes) or a map by viewport.
18
+ * Examples:
19
+ * - "pill"
20
+ * - { xs: "icons", sm: "pill", md: "pill", lg: "pill" }
21
+ */
22
+ export type ViewportProp<TVariant extends string | number | boolean | object> =
23
+ | TVariant
24
+ | ViewportMap<TVariant>;
25
+
26
+ /** Options for resolution helpers. */
27
+ export type ViewportResolveOptions = {
28
+ /** Force a specific width (useful in unit tests or storybook containers). */
29
+ widthOverride?: number;
30
+ /** Fallback key when no direct match is found. Defaults to last matching by min-width. */
31
+ fallbackKey?: ViewportKey;
32
+ };
33
+
34
+ // ---- Internals --------------------------------------------------------------
35
+
36
+ /** Default MUI breakpoint mins used when no theme is provided. */
37
+ const DEFAULT_MINS: Record<ViewportKey, number> = {
38
+ xs: 0,
39
+ sm: 600,
40
+ md: 900,
41
+ lg: 1200,
42
+ xl: 1536,
43
+ };
44
+
45
+ /** Default key order (small → large). */
46
+ const DEFAULT_ORDER: ViewportKey[] = ['xs', 'sm', 'md', 'lg', 'xl'];
47
+
48
+ /** Narrow theme shape we care about; avoids hard dependency on @mui types. */
49
+ type MaybeMuiTheme = {
50
+ breakpoints?: {
51
+ values?: Partial<Record<ViewportKey, number>>;
52
+ };
53
+ };
54
+
55
+ /** Safely read breakpoint mins from a MUI theme; otherwise use defaults. */
56
+ export function getBreakpointMins(theme?: MaybeMuiTheme): Record<ViewportKey, number> {
57
+ const v = (theme?.breakpoints?.values ?? {}) as Partial<Record<ViewportKey, number>>;
58
+ return {
59
+ xs: Number.isFinite(v.xs!) ? (v.xs as number) : DEFAULT_MINS.xs,
60
+ sm: Number.isFinite(v.sm!) ? (v.sm as number) : DEFAULT_MINS.sm,
61
+ md: Number.isFinite(v.md!) ? (v.md as number) : DEFAULT_MINS.md,
62
+ lg: Number.isFinite(v.lg!) ? (v.lg as number) : DEFAULT_MINS.lg,
63
+ xl: Number.isFinite(v.xl!) ? (v.xl as number) : DEFAULT_MINS.xl,
64
+ };
65
+ }
66
+
67
+ /** Return the active viewport key for a given width using min-width semantics. */
68
+ export function keyForWidth(width: number, theme?: MaybeMuiTheme): ViewportKey {
69
+ const mins = getBreakpointMins(theme);
70
+ // Pick the largest key whose min ≤ width
71
+ let current: ViewportKey = 'xs';
72
+ for (const k of DEFAULT_ORDER) {
73
+ if (width >= mins[k]) current = k;
74
+ }
75
+ return current;
76
+ }
77
+
78
+ /**
79
+ * Resolve a ViewportProp to a concrete value for the current width.
80
+ * - If `prop` is a single value, returns it directly.
81
+ * - If it's a map, returns `map[activeKey]`, falling back to:
82
+ * `map.default` → first defined in xs→xl order → undefined.
83
+ */
84
+ export function resolveViewportProp<TVariant extends string | number | boolean | object>(
85
+ prop: ViewportProp<TVariant>,
86
+ theme?: MaybeMuiTheme,
87
+ opts: ViewportResolveOptions = {}
88
+ ): TVariant | undefined {
89
+ // Simple (scalar) value → universal
90
+ if (prop == null || typeof prop !== 'object' || Array.isArray(prop)) {
91
+ return prop as TVariant;
92
+ }
93
+
94
+ // Map case
95
+ const map = prop as ViewportMap<TVariant>;
96
+ const width =
97
+ typeof opts.widthOverride === 'number'
98
+ ? opts.widthOverride
99
+ : (typeof window !== 'undefined' ? window.innerWidth : DEFAULT_MINS.xs);
100
+
101
+ const activeKey = keyForWidth(width, theme);
102
+ const pick =
103
+ (map as any)[activeKey] ??
104
+ map.default ??
105
+ (DEFAULT_ORDER.find((k) => (map as any)[k] != null)
106
+ ? (map as any)[DEFAULT_ORDER.find((k) => (map as any)[k] != null)!]
107
+ : undefined);
108
+
109
+ return pick as TVariant | undefined;
110
+ }
111
+
112
+ /**
113
+ * Shallow-merge a base object with the resolved override from a viewport map.
114
+ * Useful for config objects where each viewport only overrides a few keys.
115
+ *
116
+ * Example:
117
+ * const base = { gap: 8, size: 'pill' }
118
+ * const map = { xs: { size: 'icons' } }
119
+ * → resolveResponsiveConfig(base, map) === { gap: 8, size: 'icons' }
120
+ */
121
+ export function resolveResponsiveConfig<T extends Record<string, any>>(
122
+ base: T | undefined,
123
+ map: ViewportMap<Partial<T>> | undefined,
124
+ theme?: MaybeMuiTheme,
125
+ opts: ViewportResolveOptions = {}
126
+ ): T | undefined {
127
+ if (base == null && map == null) return undefined;
128
+ if (!map || typeof map !== 'object') return base as T | undefined;
129
+
130
+ const override = resolveViewportProp<Partial<T>>(map as any, theme, opts) || {};
131
+ return { ...(base as T), ...override };
132
+ }