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,168 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import * as React from 'react';
3
+ import Box from '@mui/material/Box';
4
+ import Typography from '@mui/material/Typography';
5
+
6
+ import HighLighter, {
7
+ type HighLighterProps,
8
+ DEFAULT_COLORS,
9
+ } from '@/gui/components/organisms/HighLighter/HighLighter';
10
+
11
+ const meta: Meta<typeof HighLighter> = {
12
+ title: 'Organisms/HighLighter',
13
+ component: HighLighter,
14
+ parameters: {
15
+ layout: 'centered',
16
+ },
17
+ argTypes: {
18
+ onChange: { action: 'change' },
19
+ colors: { control: 'object' },
20
+ value: { control: 'color' },
21
+ defaultValue: { control: 'color' },
22
+ tooltipSize: {
23
+ control: { type: 'inline-radio' },
24
+ options: ['sm', 'md', 'lg', 'xl'],
25
+ },
26
+ placement: {
27
+ control: { type: 'select' },
28
+ options: [
29
+ 'bottom',
30
+ 'bottom-end',
31
+ 'bottom-start',
32
+ 'left',
33
+ 'left-end',
34
+ 'left-start',
35
+ 'right',
36
+ 'right-end',
37
+ 'right-start',
38
+ 'top',
39
+ 'top-end',
40
+ 'top-start',
41
+ ],
42
+ },
43
+ iconName: { control: 'text' },
44
+ iconSize: { control: 'text' },
45
+ title: { control: 'text' },
46
+ disabled: { control: 'boolean' },
47
+ className: { table: { disable: true } },
48
+ style: { table: { disable: true } },
49
+ },
50
+ args: {
51
+ title: 'Highlighter',
52
+ tooltipSize: 'md',
53
+ placement: 'right',
54
+ iconName: 'ink_marker',
55
+ iconSize: 22,
56
+ colors: DEFAULT_COLORS,
57
+ defaultValue: DEFAULT_COLORS[0],
58
+ disabled: false,
59
+ },
60
+ };
61
+
62
+ export default meta;
63
+ type Story = StoryObj<typeof HighLighter>;
64
+
65
+ export const Playground: Story = {
66
+ render: (args) => (
67
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
68
+ <HighLighter {...(args as HighLighterProps)} />
69
+ <Typography variant="body2" sx={{ opacity: 0.7 }}>
70
+ Click highlighter → pick a color
71
+ </Typography>
72
+ </Box>
73
+ ),
74
+ };
75
+
76
+ export const Sizes: Story = {
77
+ render: (args) => (
78
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
79
+ <HighLighter {...(args as HighLighterProps)} tooltipSize="sm" title="sm" />
80
+ <HighLighter {...(args as HighLighterProps)} tooltipSize="md" title="md" />
81
+ <HighLighter {...(args as HighLighterProps)} tooltipSize="lg" title="lg" />
82
+ <HighLighter {...(args as HighLighterProps)} tooltipSize="xl" title="xl" />
83
+ </Box>
84
+ ),
85
+ parameters: { controls: { exclude: ['tooltipSize', 'title'] } },
86
+ };
87
+
88
+ export const CustomPalette: Story = {
89
+ args: {
90
+ title: 'Pick a neon',
91
+ colors: ['#00F5D4', '#F15BB5', '#FEE440', '#00BBF9', '#9B5DE5'],
92
+ defaultValue: '#FEE440',
93
+ },
94
+ render: (args) => (
95
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
96
+ <HighLighter {...(args as HighLighterProps)} />
97
+ <Typography variant="body2" sx={{ opacity: 0.7 }}>
98
+ Custom 5-color palette
99
+ </Typography>
100
+ </Box>
101
+ ),
102
+ };
103
+
104
+ export const Controlled: Story = {
105
+ render: (args) => {
106
+ const [color, setColor] = React.useState<string>(DEFAULT_COLORS[2]);
107
+
108
+ React.useEffect(() => {
109
+ const onHighLighter = (e: any) => {
110
+ if (e?.detail?.color) setColor(e.detail.color);
111
+ };
112
+ window.addEventListener('gui:highlighter', onHighLighter as any);
113
+ return () => window.removeEventListener('gui:highlighter', onHighLighter as any);
114
+ }, []);
115
+
116
+ return (
117
+ <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5, minWidth: 320 }}>
118
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
119
+ <HighLighter
120
+ {...(args as HighLighterProps)}
121
+ value={color}
122
+ onChange={(c) => {
123
+ setColor(c);
124
+ (args as any)?.onChange?.(c);
125
+ }}
126
+ />
127
+ <Typography variant="body2" sx={{ opacity: 0.7 }}>
128
+ Controlled color
129
+ </Typography>
130
+ </Box>
131
+
132
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
133
+ <Typography variant="caption" sx={{ opacity: 0.7 }}>
134
+ Selected:
135
+ </Typography>
136
+ <Box
137
+ sx={{
138
+ width: 14,
139
+ height: 14,
140
+ borderRadius: 999,
141
+ bgcolor: color,
142
+ border: '1px solid',
143
+ borderColor: 'divider',
144
+ }}
145
+ />
146
+ <Typography variant="caption" sx={{ fontFamily: 'monospace' }}>
147
+ {color}
148
+ </Typography>
149
+ </Box>
150
+ </Box>
151
+ );
152
+ },
153
+ parameters: {
154
+ controls: { exclude: ['value', 'defaultValue'] },
155
+ },
156
+ };
157
+
158
+ export const Disabled: Story = {
159
+ args: { disabled: true },
160
+ render: (args) => (
161
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 2 }}>
162
+ <HighLighter {...(args as HighLighterProps)} />
163
+ <Typography variant="body2" sx={{ opacity: 0.7 }}>
164
+ Disabled
165
+ </Typography>
166
+ </Box>
167
+ ),
168
+ };
@@ -0,0 +1,420 @@
1
+ import * as React from 'react';
2
+ import clsx from 'clsx';
3
+ import Box from '@/gui/atoms/Box/Box';
4
+ import IconButton from '@/gui/atoms/IconButton/IconButton';
5
+ import ClickAwayListener from '@mui/material/ClickAwayListener';
6
+
7
+ import Icon from '@/gui/Theme/Icon/Icon';
8
+ import Tooltip from '@/gui/atoms/Tooltip/Tooltip';
9
+ import Drawer from '@/gui/atoms/Drawer/Drawer';
10
+ import HighLightsDrawer from '@/gui/components/organisms/HighLighter/HighLightsDrawer';
11
+
12
+ export type HighLighterColor = string;
13
+
14
+ export type HighLighterProps = {
15
+ /** Optional custom palette shown in the tooltip */
16
+ colors?: HighLighterColor[];
17
+ /** Currently selected color (controlled) */
18
+ value?: HighLighterColor;
19
+ /** Default selected color (uncontrolled) */
20
+ defaultValue?: HighLighterColor;
21
+ /** Fired whenever a color is selected */
22
+ onChange?: (color: HighLighterColor) => void;
23
+
24
+ /** Tooltip label shown above the palette */
25
+ title?: React.ReactNode;
26
+ /** Tooltip size preset */
27
+ tooltipSize?: 'sm' | 'md' | 'lg' | 'xl';
28
+ /** MUI placement for tooltip */
29
+ placement?:
30
+ | 'bottom'
31
+ | 'bottom-end'
32
+ | 'bottom-start'
33
+ | 'left'
34
+ | 'left-end'
35
+ | 'left-start'
36
+ | 'right'
37
+ | 'right-end'
38
+ | 'right-start'
39
+ | 'top'
40
+ | 'top-end'
41
+ | 'top-start';
42
+
43
+ /** Icon configuration */
44
+ iconName?: string;
45
+ iconSize?: number | string;
46
+ className?: string;
47
+ style?: React.CSSProperties;
48
+
49
+ /** Disabled state */
50
+ disabled?: boolean;
51
+ };
52
+
53
+ const DEFAULT_COLORS: HighLighterColor[] = [
54
+ '#FDE047', // yellow
55
+ '#86EFAC', // green
56
+ '#93C5FD', // blue
57
+ '#FCA5A5', // red
58
+ '#D8B4FE', // purple
59
+ ];
60
+
61
+ function clampPalette(colors: HighLighterColor[]): HighLighterColor[] {
62
+ // Keep it simple: ensure exactly 5 items when possible.
63
+ const next = (colors?.length ? colors : DEFAULT_COLORS).slice(0, 5);
64
+ while (next.length < 5) next.push(DEFAULT_COLORS[next.length]);
65
+ return next;
66
+ }
67
+
68
+ function hexToRgba(hex: string, alpha: number) {
69
+ const h = hex.replace('#', '').trim();
70
+ const full = h.length === 3 ? h.split('').map((c) => c + c).join('') : h;
71
+ const r = parseInt(full.slice(0, 2), 16);
72
+ const g = parseInt(full.slice(2, 4), 16);
73
+ const b = parseInt(full.slice(4, 6), 16);
74
+ if ([r, g, b].some((n) => Number.isNaN(n))) return `rgba(255,255,0,${alpha})`;
75
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
76
+ }
77
+
78
+ function useControlledColor({
79
+ value,
80
+ defaultValue,
81
+ }: {
82
+ value?: HighLighterColor;
83
+ defaultValue?: HighLighterColor;
84
+ }) {
85
+ const [uncontrolled, setUncontrolled] = React.useState<HighLighterColor>(
86
+ defaultValue ?? DEFAULT_COLORS[0],
87
+ );
88
+ const isControlled = value != null;
89
+ const color = (isControlled ? value : uncontrolled) as HighLighterColor;
90
+ const setColor = React.useCallback(
91
+ (next: HighLighterColor) => {
92
+ if (!isControlled) setUncontrolled(next);
93
+ },
94
+ [isControlled],
95
+ );
96
+ return { color, setColor, isControlled };
97
+ }
98
+
99
+ /**
100
+ * This.GUI — HighLighter (organism)
101
+ *
102
+ * A marker/highlighter toggle button that opens a click-to-open tooltip palette
103
+ * (5 circular swatches). Picking a swatch activates "marker mode":
104
+ * - The cursor becomes a marker/highlighter (SVG cursor) and selection highlight color is applied via global CSS
105
+ * - The selected color is exposed via `data-high-lighter-color` and CSS var
106
+ * `--gui-highlighter-color` on <html>
107
+ * - A CustomEvent `gui:highlighter` is dispatched on window.
108
+ *
109
+ * You can implement actual text-highlighting in your editor by listening for:
110
+ * window.addEventListener('gui:highlighter', (e) => ...)
111
+ * and/or by reading `document.documentElement.dataset.highLighterActive`.
112
+ */
113
+ export default function HighLighter(props: HighLighterProps) {
114
+ const {
115
+ colors: colorsProp,
116
+ value,
117
+ defaultValue,
118
+ onChange,
119
+ title = 'Highlighter',
120
+ tooltipSize = 'md',
121
+ placement = 'right',
122
+ iconName = 'ink_marker',
123
+ iconSize = 22,
124
+ className,
125
+ style,
126
+ disabled,
127
+ } = props;
128
+
129
+ const colors = React.useMemo(() => clampPalette(colorsProp ?? DEFAULT_COLORS), [colorsProp]);
130
+ const { color, setColor } = useControlledColor({ value, defaultValue });
131
+
132
+ const [open, setOpen] = React.useState(false);
133
+ const [active, setActive] = React.useState(false);
134
+
135
+ const applyGlobalState = React.useCallback(
136
+ (nextActive: boolean, nextColor: HighLighterColor) => {
137
+ const root = document.documentElement;
138
+
139
+ // dataset signals for external consumers
140
+ root.dataset.highLighterActive = String(nextActive);
141
+ root.dataset.highLighterColor = nextColor;
142
+
143
+ // css vars for styling cursors/overlays/etc
144
+ root.style.setProperty('--gui-highlighter-color', nextColor);
145
+ root.style.setProperty('--gui-highlighter-rgba', hexToRgba(nextColor, 0.45));
146
+
147
+ // cursor + selection
148
+ // We set an SVG cursor. It can't be dynamically recolored in all browsers,
149
+ // so we ship a "marker" silhouette and still expose the chosen color via CSS vars.
150
+ const cursorSvg = encodeURIComponent(`
151
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
152
+ <path d="M21.7 3.3c-1.2-1.2-3.1-1.2-4.2 0L7.2 13.6c-.3.3-.5.7-.6 1.1L5 21.9c-.2.8.6 1.6 1.4 1.4l7.2-1.6c.4-.1.8-.3 1.1-.6L24.9 7.5c1.2-1.2 1.2-3.1 0-4.2l-3.2-3.2z" fill="#111"/>
153
+ <path d="M6.5 22.5l8-1.8-6.2-6.2-1.8 8z" fill="#555"/>
154
+ </svg>
155
+ `);
156
+
157
+ if (nextActive) {
158
+ root.style.cursor = `url("data:image/svg+xml,${cursorSvg}") 2 26, text`;
159
+ root.style.setProperty('--gui-highlighter-active', '1');
160
+ } else {
161
+ root.style.cursor = '';
162
+ root.style.removeProperty('--gui-highlighter-active');
163
+ }
164
+ },
165
+ [],
166
+ );
167
+
168
+ // Keep globals in sync when active/color changes.
169
+ React.useEffect(() => {
170
+ // Avoid touching DOM in SSR
171
+ if (typeof document === 'undefined') return;
172
+ applyGlobalState(active, color);
173
+ return () => {
174
+ // If component unmounts while active, clean up.
175
+ if (active) {
176
+ const root = document.documentElement;
177
+ delete root.dataset.highLighterActive;
178
+ delete root.dataset.highLighterColor;
179
+ root.style.removeProperty('--gui-highlighter-color');
180
+ root.style.removeProperty('--gui-highlighter-rgba');
181
+ root.style.cursor = '';
182
+ }
183
+ };
184
+ // eslint-disable-next-line react-hooks/exhaustive-deps
185
+ }, [active, color]);
186
+
187
+ const handleToggleOpen = React.useCallback(() => {
188
+ if (disabled) return;
189
+ // If already active and the palette isn't open, a click toggles OFF (natural pen behavior).
190
+ if (active && !open) {
191
+ setActive(false);
192
+ return;
193
+ }
194
+ setOpen((v) => !v);
195
+ }, [disabled, active, open]);
196
+
197
+ const handleClose = React.useCallback(() => {
198
+ setOpen(false);
199
+ setDrawerOpen(false);
200
+ }, []);
201
+
202
+ const handlePick = React.useCallback(
203
+ (next: HighLighterColor) => {
204
+ setColor(next);
205
+ onChange?.(next);
206
+ setActive(true);
207
+ setOpen(false);
208
+ setDrawerOpen(false);
209
+ },
210
+ [onChange, setColor],
211
+ );
212
+
213
+ // Drawer open/close handlers for "Show Highlights"
214
+ const [drawerOpen, setDrawerOpen] = React.useState(false);
215
+ const handleDrawerClose = React.useCallback(() => setDrawerOpen(false), []);
216
+ const handleDrawerOpen = React.useCallback(() => {
217
+ setDrawerOpen(true);
218
+ setOpen(false);
219
+ }, []);
220
+
221
+ const [filterMode, setFilterMode] = React.useState<'all' | 'byColor'>('all');
222
+ const [filterColor, setFilterColor] = React.useState<string>(color);
223
+
224
+ React.useEffect(() => {
225
+ setFilterColor(color);
226
+ }, [color]);
227
+
228
+ // Inject global selection styles once (scoped by data-high-lighter-active)
229
+ React.useEffect(() => {
230
+ if (typeof document === 'undefined') return;
231
+ const id = 'gui-highlighter-selection-style';
232
+ if (document.getElementById(id)) return;
233
+
234
+ const el = document.createElement('style');
235
+ el.id = id;
236
+ el.textContent = `
237
+ html[data-high-lighter-active="true"] ::selection {
238
+ background: var(--gui-highlighter-rgba, rgba(253, 224, 71, 0.45));
239
+ }
240
+ html[data-high-lighter-active="true"] ::-moz-selection {
241
+ background: var(--gui-highlighter-rgba, rgba(253, 224, 71, 0.45));
242
+ }
243
+ `;
244
+ document.head.appendChild(el);
245
+ }, []);
246
+
247
+ const tooltipContent = (
248
+ <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
249
+ {title ? (
250
+ <Box sx={{ fontWeight: 600, lineHeight: 1.1, pr: 0.5 }}>{title}</Box>
251
+ ) : null}
252
+
253
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
254
+ {colors.map((c) => {
255
+ const selected = c.toLowerCase() === String(color).toLowerCase();
256
+ return (
257
+ <Box
258
+ key={c}
259
+ role="button"
260
+ aria-label={`Select marker color ${c}`}
261
+ tabIndex={0}
262
+ onClick={() => handlePick(c)}
263
+ onKeyDown={(e) => {
264
+ if (e.key === 'Enter' || e.key === ' ') {
265
+ e.preventDefault();
266
+ handlePick(c);
267
+ }
268
+ }}
269
+ sx={{
270
+ width: 18,
271
+ height: 18,
272
+ borderRadius: '999px',
273
+ bgcolor: c,
274
+ cursor: 'pointer',
275
+ border: selected ? '2px solid' : '1px solid',
276
+ borderColor: selected ? 'text.primary' : 'divider',
277
+ boxShadow: selected ? 1 : 0,
278
+ transform: selected ? 'scale(1.05)' : 'none',
279
+ transition: 'transform 120ms ease',
280
+ }}
281
+ />
282
+ );
283
+ })}
284
+ </Box>
285
+
286
+ <Box
287
+ role="button"
288
+ tabIndex={0}
289
+ onClick={handleDrawerOpen}
290
+ onKeyDown={(e) => {
291
+ if (e.key === 'Enter' || e.key === ' ') {
292
+ e.preventDefault();
293
+ handleDrawerOpen();
294
+ }
295
+ }}
296
+ sx={{
297
+ mt: 0.5,
298
+ px: 1,
299
+ py: 0.75,
300
+ borderRadius: 1,
301
+ cursor: 'pointer',
302
+ userSelect: 'none',
303
+ fontSize: 13,
304
+ fontWeight: 600,
305
+ display: 'flex',
306
+ alignItems: 'center',
307
+ justifyContent: 'space-between',
308
+ gap: 1,
309
+ bgcolor: 'action.hover',
310
+ '&:hover': { bgcolor: 'action.selected' },
311
+ '&:focus-visible': { outline: '2px solid', outlineColor: 'primary.main' },
312
+ }}
313
+ >
314
+ <span>Show Highlights</span>
315
+ <span style={{ opacity: 0.7 }}>→</span>
316
+ </Box>
317
+ </Box>
318
+ );
319
+
320
+ const highlightSelection = React.useCallback(() => {
321
+ if (typeof window === 'undefined') return;
322
+ const sel = window.getSelection?.();
323
+ if (!sel || sel.rangeCount === 0) return;
324
+ const range = sel.getRangeAt(0);
325
+ if (range.collapsed) return;
326
+ // Wrap selection in a span with a background using the selected highlighter color.
327
+ const span = document.createElement('span');
328
+ span.setAttribute('data-gui-highlighter', 'true');
329
+ // Marker-like look: softer corners, a touch of vertical padding, and a subtle inner shading.
330
+ span.style.background = hexToRgba(color, 0.42);
331
+ span.style.borderRadius = '999px';
332
+ span.style.padding = '0.06em 0.18em';
333
+ span.style.boxDecorationBreak = 'clone';
334
+ (span.style as any)['-webkit-box-decoration-break'] = 'clone';
335
+ span.style.boxShadow = `inset 0 -0.18em 0 0 rgba(0,0,0,0.06)`;
336
+ span.style.display = 'inline';
337
+ try {
338
+ range.surroundContents(span);
339
+ sel.removeAllRanges();
340
+ } catch {
341
+ // surroundContents fails for partially-selected nodes; fallback to extract/insert.
342
+ const frag = range.extractContents();
343
+ span.appendChild(frag);
344
+ range.insertNode(span);
345
+ sel.removeAllRanges();
346
+ }
347
+
348
+ window.dispatchEvent(
349
+ new CustomEvent('gui:highlighter:highlight', {
350
+ detail: { color },
351
+ }),
352
+ );
353
+ }, [color]);
354
+ React.useEffect(() => {
355
+ if (typeof window === 'undefined') return;
356
+ (window as any).guiHighLighter = {
357
+ highlightSelection,
358
+ get active() {
359
+ return document.documentElement.dataset.highLighterActive === 'true';
360
+ },
361
+ get color() {
362
+ return document.documentElement.dataset.highLighterColor;
363
+ },
364
+ };
365
+ return () => {
366
+ // eslint-disable-next-line @typescript-eslint/no-dynamic-delete
367
+ delete (window as any).guiHighLighter;
368
+ };
369
+ }, [highlightSelection]);
370
+ return (
371
+ <ClickAwayListener onClickAway={handleClose}>
372
+ <Box sx={{ display: 'inline-flex' }} className={className} style={style}>
373
+ <Tooltip
374
+ title={tooltipContent}
375
+ open={open}
376
+ onClose={handleClose}
377
+ disableHoverListener
378
+ disableFocusListener
379
+ disableTouchListener
380
+ placement={placement}
381
+ arrow
382
+ size={tooltipSize}
383
+ >
384
+ <IconButton
385
+ size="small"
386
+ disabled={disabled}
387
+ aria-label="HighLighter"
388
+ onClick={handleToggleOpen}
389
+ sx={{
390
+ borderRadius: 2,
391
+ border: active ? '1px solid' : '1px solid',
392
+ borderColor: active ? 'text.primary' : 'divider',
393
+ bgcolor: active ? 'action.selected' : 'transparent',
394
+ }}
395
+ >
396
+ <Icon
397
+ name={iconName}
398
+ fontSize={iconSize}
399
+ iconColor={active ? color : undefined}
400
+ className={clsx(active && 'Gui-HighLighter-active')}
401
+ />
402
+ </IconButton>
403
+ </Tooltip>
404
+ <Drawer anchor="right" open={drawerOpen} onClose={handleDrawerClose}>
405
+ <HighLightsDrawer
406
+ title="Highlights"
407
+ colors={colors}
408
+ mode={filterMode}
409
+ onModeChange={setFilterMode}
410
+ selectedColor={filterColor}
411
+ onSelectedColorChange={setFilterColor}
412
+ />
413
+ </Drawer>
414
+ </Box>
415
+ </ClickAwayListener>
416
+ );
417
+ }
418
+
419
+ (HighLighter as any).displayName = 'Gui.HighLighter';
420
+ export { DEFAULT_COLORS };