this.gui 1.3.41 → 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.
- package/package.json +3 -2
- package/src/GUI.tsx +46 -0
- package/src/QRouter/QRegistry.tsx +53 -0
- package/src/QRouter/QRouter.stories.tsx +31 -0
- package/src/QRouter/QRouter.tsx +57 -0
- package/src/gui/Theme/GuiProvider.tsx +111 -0
- package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
- package/src/gui/Theme/Icon/Icon.tsx +43 -0
- package/src/gui/Theme/Layout/Content/Content.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Content/Content.stories.tsx +88 -0
- package/src/gui/Theme/Layout/Content/Content.tsx +53 -0
- package/src/gui/Theme/Layout/Content/Content.types.tsx +40 -0
- package/src/gui/Theme/Layout/Footer/Footer.resolver.tsx +45 -0
- package/src/gui/Theme/Layout/Footer/Footer.stories.tsx +205 -0
- package/src/gui/Theme/Layout/Footer/Footer.tsx +337 -0
- package/src/gui/Theme/Layout/Footer/Footer.types.ts +40 -0
- package/src/gui/Theme/Layout/Layout/Layout.resolver.tsx +37 -0
- package/src/gui/Theme/Layout/Layout/Layout.stories.tsx +289 -0
- package/src/gui/Theme/Layout/Layout/Layout.tsx +117 -0
- package/src/gui/Theme/Layout/Layout/Layout.types.ts +57 -0
- package/src/gui/Theme/Layout/Layout/useLayoutBreakpoints.ts +9 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.stories.tsx +105 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.tsx +26 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +134 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +15 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.stories.tsx +239 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.tsx +489 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.resolver.tsx +86 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.stories.tsx +350 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.tsx +292 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.types.ts +39 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
- package/src/gui/Theme/catalog/CherryByte/CherryByte.png +0 -0
- package/src/gui/Theme/catalog/CherryByte/dark.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/manifest.ts +24 -0
- package/src/gui/Theme/catalog/GhostShell/dark.tokens.ts +43 -0
- package/src/gui/Theme/catalog/GhostShell/ghost.png +0 -0
- package/src/gui/Theme/catalog/GhostShell/light.tokens.ts +39 -0
- package/src/gui/Theme/catalog/GhostShell/manifest.ts +24 -0
- package/src/gui/Theme/catalog/LunaHex/LunaHex.png +0 -0
- package/src/gui/Theme/catalog/LunaHex/dark.tokens.ts +34 -0
- package/src/gui/Theme/catalog/LunaHex/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/LunaHex/manifest.ts +24 -0
- package/src/gui/Theme/catalog/MUI/MUI.png +0 -0
- package/src/gui/Theme/catalog/MUI/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/MUI/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/MUI/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/dark.tokens.ts +48 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/prince.png +0 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/princeOfDarkness.png +0 -0
- package/src/gui/Theme/catalog/Seafoam/dark.tokens.ts +49 -0
- package/src/gui/Theme/catalog/Seafoam/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/Seafoam/manifest.ts +24 -0
- package/src/gui/Theme/catalog/Seafoam/seaFoam.png +0 -0
- package/src/gui/Theme/catalog/neurons/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/neurons/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/neurons/manifest.ts +24 -0
- package/src/gui/Theme/catalog/neurons/neurons.me.png +0 -0
- package/src/gui/Theme/fromTokens.ts +272 -0
- package/src/gui/Theme/gui.css +31 -0
- package/src/gui/Theme/index.ts +17 -0
- package/src/gui/Theme/styles/buildShadows.ts +83 -0
- package/src/gui/Theme/styles/theme.tokens.ts +108 -0
- package/src/gui/Theme/utils/catalog.ts +61 -0
- package/src/gui/Theme/utils/persistence.ts +66 -0
- package/src/gui/Theme/utils/themeUtils.ts +34 -0
- package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +46 -0
- package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +251 -0
- package/src/gui/components/atoms/AppBar/AppBar.tsx +107 -0
- package/src/gui/components/atoms/AppBar/AppBar.types.ts +28 -0
- package/src/gui/components/atoms/Avatar/Avatar.resolver.tsx +61 -0
- package/src/gui/components/atoms/Avatar/Avatar.stories.tsx +36 -0
- package/src/gui/components/atoms/Avatar/Avatar.tsx +14 -0
- package/src/gui/components/atoms/Box/Box.resolver.tsx +171 -0
- package/src/gui/components/atoms/Box/Box.stories.tsx +263 -0
- package/src/gui/components/atoms/Box/Box.tsx +15 -0
- package/src/gui/components/atoms/Button/Button.resolver.tsx +103 -0
- package/src/gui/components/atoms/Button/Button.stories.tsx +219 -0
- package/src/gui/components/atoms/Button/Button.tsx +40 -0
- package/src/gui/components/atoms/Card/Card.resolver.tsx +63 -0
- package/src/gui/components/atoms/Card/Card.stories.tsx +54 -0
- package/src/gui/components/atoms/Card/Card.tsx +13 -0
- package/src/gui/components/atoms/CardActions/CardActions.resolver.tsx +59 -0
- package/src/gui/components/atoms/CardActions/CardActions.stories.tsx +32 -0
- package/src/gui/components/atoms/CardActions/CardActions.tsx +14 -0
- package/src/gui/components/atoms/CardContent/CardContent.resolver.tsx +60 -0
- package/src/gui/components/atoms/CardContent/CardContent.stories.tsx +34 -0
- package/src/gui/components/atoms/CardContent/CardContent.tsx +13 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.resolver.tsx +68 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.stories.tsx +40 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.tsx +12 -0
- package/src/gui/components/atoms/Collapse/Collapse.resolver.tsx +85 -0
- package/src/gui/components/atoms/Collapse/Collapse.stories.tsx +130 -0
- package/src/gui/components/atoms/Collapse/Collapse.tsx +17 -0
- package/src/gui/components/atoms/Divider/Divider.resolver.tsx +95 -0
- package/src/gui/components/atoms/Divider/Divider.stories.tsx +108 -0
- package/src/gui/components/atoms/Divider/Divider.tsx +14 -0
- package/src/gui/components/atoms/Drawer/Drawer.resolver.tsx +116 -0
- package/src/gui/components/atoms/Drawer/Drawer.stories.tsx +223 -0
- package/src/gui/components/atoms/Drawer/Drawer.tsx +25 -0
- package/src/gui/components/atoms/Grid/Grid.resolver.tsx +33 -0
- package/src/gui/components/atoms/Grid/Grid.stories.tsx +136 -0
- package/src/gui/components/atoms/Grid/Grid.tsx +15 -0
- package/src/gui/components/atoms/Grid/Grid.types.ts +9 -0
- package/src/gui/components/atoms/IconButton/IconButton.resolver.tsx +137 -0
- package/src/gui/components/atoms/IconButton/IconButton.stories.tsx +134 -0
- package/src/gui/components/atoms/IconButton/IconButton.tsx +22 -0
- package/src/gui/components/atoms/Link/Link.resolver.tsx +74 -0
- package/src/gui/components/atoms/Link/Link.stories.tsx +157 -0
- package/src/gui/components/atoms/Link/Link.tsx +36 -0
- package/src/gui/components/atoms/List/List.resolver.tsx +94 -0
- package/src/gui/components/atoms/List/List.stories.tsx +137 -0
- package/src/gui/components/atoms/List/List.tsx +20 -0
- package/src/gui/components/atoms/ListItem/ListItem.resolver.tsx +88 -0
- package/src/gui/components/atoms/ListItem/ListItem.stories.tsx +151 -0
- package/src/gui/components/atoms/ListItem/ListItem.tsx +19 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.resolver.tsx +214 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.stories.tsx +155 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.tsx +15 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.stories.tsx +132 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.stories.tsx +156 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.tsx +15 -0
- package/src/gui/components/atoms/Menu/Menu.resolver.tsx +112 -0
- package/src/gui/components/atoms/Menu/Menu.stories.tsx +162 -0
- package/src/gui/components/atoms/Menu/Menu.tsx +17 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.stories.tsx +134 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.tsx +14 -0
- package/src/gui/components/atoms/Paper/Paper.resolver.tsx +98 -0
- package/src/gui/components/atoms/Paper/Paper.stories.tsx +184 -0
- package/src/gui/components/atoms/Paper/Paper.tsx +15 -0
- package/src/gui/components/atoms/Section/Section.resolver.tsx +10 -0
- package/src/gui/components/atoms/Section/Section.stories.tsx +189 -0
- package/src/gui/components/atoms/Section/Section.tsx +76 -0
- package/src/gui/components/atoms/Section/Section.types.tsx +24 -0
- package/src/gui/components/atoms/Stack/Stack.resolver.tsx +94 -0
- package/src/gui/components/atoms/Stack/Stack.stories.tsx +160 -0
- package/src/gui/components/atoms/Stack/Stack.tsx +15 -0
- package/src/gui/components/atoms/Surface/Surface.resolver.tsx +37 -0
- package/src/gui/components/atoms/Surface/Surface.tsx +49 -0
- package/src/gui/components/atoms/Surface/Surface.types.ts +20 -0
- package/src/gui/components/atoms/Switch/Switch.resolver.tsx +53 -0
- package/src/gui/components/atoms/Switch/Switch.stories.tsx +236 -0
- package/src/gui/components/atoms/Switch/Switch.tsx +22 -0
- package/src/gui/components/atoms/Table/Body/TableBody.tsx +7 -0
- package/src/gui/components/atoms/Table/Cell/TableCell.tsx +18 -0
- package/src/gui/components/atoms/Table/Head/TableHead.tsx +9 -0
- package/src/gui/components/atoms/Table/Row/TableRow.tsx +20 -0
- package/src/gui/components/atoms/Table/Table.resolver.tsx +77 -0
- package/src/gui/components/atoms/Table/Table.stories.tsx +173 -0
- package/src/gui/components/atoms/Table/Table.tsx +20 -0
- package/src/gui/components/atoms/TextField/TextField.stories.tsx +25 -0
- package/src/gui/components/atoms/TextField/TextField.tsx +15 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.stories.tsx +155 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.tsx +16 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.stories.tsx +117 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.tsx +70 -0
- package/src/gui/components/atoms/Typography/Typography.resolver.tsx +158 -0
- package/src/gui/components/atoms/Typography/Typography.stories.tsx +222 -0
- package/src/gui/components/atoms/Typography/Typography.tsx +27 -0
- package/src/gui/components/atoms/Window/Nodes/node.ts +0 -0
- package/src/gui/components/atoms/Window/code/block/node.tsx +0 -0
- package/src/gui/components/atoms/Window/code/hugging.face.api.ts +11 -0
- package/src/gui/components/atoms/Window/connectors/index.ts +19 -0
- package/src/gui/components/atoms/Window/window.stories.tsx +20 -0
- package/src/gui/components/atoms/Window/window.tsx +636 -0
- package/src/gui/components/atoms/atoms.tsx +151 -0
- package/src/gui/components/atoms/index.ts +2 -0
- package/src/gui/components/generics/Cards/Gridme.jsx +52 -0
- package/src/gui/components/generics/Cards/LilBox.jsx +65 -0
- package/src/gui/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/gui/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/gui/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.stories.tsx +153 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.tsx +23 -0
- package/src/gui/components/generics/Feedback/Callout.jsx +92 -0
- package/src/gui/components/generics/Layout/GridX.jsx +29 -0
- package/src/gui/components/generics/Layout/Hero2.jsx +132 -0
- package/src/gui/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/gui/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/gui/components/generics/Layout/Section.jsx +43 -0
- package/src/gui/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/gui/components/generics/Media/Img.jsx +58 -0
- package/src/gui/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/gui/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/gui/components/generics/Organization/Tabs.jsx +45 -0
- package/src/gui/components/generics/Text/TextList.jsx +41 -0
- package/src/gui/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/gui/components/generics/Text/TextQuote.jsx +23 -0
- package/src/gui/components/generics/Text/TextTitle.jsx +44 -0
- package/src/gui/components/molecules/Dialog/Dialog.stories.tsx +18 -0
- package/src/gui/components/molecules/Dialog/Dialog.tsx +5 -0
- package/src/gui/components/molecules/Hero/Hero.stories.tsx +140 -0
- package/src/gui/components/molecules/Hero/Hero.tsx +152 -0
- package/src/gui/components/molecules/Hero/Hero.types.tsx +18 -0
- package/src/gui/components/molecules/Modal/Modal.resolver.tsx +38 -0
- package/src/gui/components/molecules/Modal/Modal.stories.tsx +82 -0
- package/src/gui/components/molecules/Modal/Modal.tsx +110 -0
- package/src/gui/components/molecules/Modal/Modal.types.ts +29 -0
- package/src/gui/components/molecules/Page/Page.stories.tsx +135 -0
- package/src/gui/components/molecules/Page/Page.tsx +94 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.resolver.tsx +58 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.stories.tsx +133 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.tsx +101 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.types.ts +29 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.resolver.tsx +15 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.stories.tsx +88 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.tsx +167 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.types.ts +34 -0
- package/src/gui/components/molecules/molecules.ts +49 -0
- package/src/gui/components/organisms/Blockchain/Blocks/BlocksTable.tsx +119 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Identities.stories.tsx +20 -0
- package/src/gui/components/organisms/Blockchain/Usernames/QR.tsx +566 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Usernames.tsx +448 -0
- package/src/gui/components/organisms/Blockchain/Usernames/identities.tsx +710 -0
- package/src/gui/components/organisms/Blockchain/blockchain.stories.tsx +17 -0
- package/src/gui/components/organisms/Blockchain/blockchain.tsx +368 -0
- package/src/gui/components/organisms/Blockchain/scripts/connection.ts +82 -0
- package/src/gui/components/organisms/Blockchain/scripts/match_face.ts +143 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.stories.tsx +168 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.tsx +420 -0
- package/src/gui/components/organisms/HighLighter/HighLightsDrawer.tsx +197 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.stories.tsx +312 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.tsx +765 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceCameraPermission.ts +70 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceLandmarker.ts +106 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceOverlay.ts +489 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplate.ts +32 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplateBurst.ts +178 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/verifyTemplate.ts +136 -0
- package/src/gui/components/organisms/IdentityNoise/IdentityNoise.tsx +403 -0
- package/src/gui/components/organisms/IdentityNoise/IndentityNoise.stories.tsx +15 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.stories.tsx +206 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.tsx +394 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/QR.tsx +566 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Tiad.stories.tsx +6 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Triad.tsx +917 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/handleCleak.ts +0 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/identity.ts +31 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/fundamentals/vectors/vectors.tsx +252 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.stories.tsx +314 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.tsx +0 -0
- package/src/gui/components/organisms/organisms.ts +15 -0
- package/src/gui/contexts/InsetsContext.tsx +40 -0
- package/src/gui/contexts/LeftSidebarContext.tsx +20 -0
- package/src/gui/contexts/RightSidebarContext.tsx +25 -0
- package/src/gui/contexts/ThemeContext.ts +34 -0
- package/src/gui/contexts/index.ts +4 -0
- package/src/gui/hooks/index.ts +11 -0
- package/src/gui/hooks/resolveColorToken.ts +39 -0
- package/src/gui/hooks/useCodeGen.ts +12 -0
- package/src/gui/hooks/useGuiMediaQuery.ts +18 -0
- package/src/gui/hooks/useGuiTheme.ts +18 -0
- package/src/gui/hooks/useInsets.ts +26 -0
- package/src/gui/hooks/useIsMobile.ts +13 -0
- package/src/gui/hooks/useIsTouchDevice.ts +25 -0
- package/src/gui/hooks/useLeftSidebar.ts +10 -0
- package/src/gui/hooks/useRightSidebar.ts +12 -0
- package/src/gui/hooks/useViewportKey.ts +19 -0
- package/src/gui/hooks/useViewportProp.ts +17 -0
- package/src/gui/registry/GuiRegistry.ts +19 -0
- package/src/gui/registry/factory.ts +12 -0
- package/src/gui/registry/index.ts +3 -0
- package/src/gui/registry/types.ts +6 -0
- package/src/gui/utils/nodeID.ts +11 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/stories/01.Home.mdx +22 -0
- package/src/stories/02.Understanding.This.GUI.mdx +149 -0
- package/src/stories/Theme/Palette.stories.tsx +86 -0
- package/src/stories/Theme/ThemeViewer.stories.tsx +91 -0
- package/src/stories/Theme/Typography.stories.jsx +211 -0
- package/src/stories/assets/this.GUI.png +0 -0
- package/src/types/gui.d.ts +67 -0
- package/src/types/theme.d.ts +191 -0
- package/src/types/viewport.ts +132 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — primitives
|
|
3
|
+
* Thin wrappers around MUI components to present a stable, library-owned API.
|
|
4
|
+
* Internally we use MUI, but components in the design system should import from
|
|
5
|
+
* "@/gui/primitives" instead of "@mui/material". This lets us swap engines later.
|
|
6
|
+
*
|
|
7
|
+
* La regla estándar en tu wrapper
|
|
8
|
+
* • Si MUI lo declaró polimórfico → usa OverridableComponent en tu wrapper.
|
|
9
|
+
* • Si no lo es → usa forwardRef normal.
|
|
10
|
+
*
|
|
11
|
+
* Así garantizas dos cosas:
|
|
12
|
+
* ✅ Tu wrapper no pierde nada de lo que MUI ofrece.
|
|
13
|
+
* ✅ No te complicas agregando polimorfismo donde MUI no lo soporta.
|
|
14
|
+
*/
|
|
15
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
16
|
+
// AppBar is not polymorphic so we wrap it with forwardRef
|
|
17
|
+
import AppBar from './AppBar/AppBar';
|
|
18
|
+
export { default as AppBar } from './AppBar/AppBar';
|
|
19
|
+
// Box is polymorphic so we re-export it directly
|
|
20
|
+
import Box, { type BoxProps } from './Box/Box';
|
|
21
|
+
export { default as Box } from './Box/Box';
|
|
22
|
+
export type { BoxProps } from './Box/Box';
|
|
23
|
+
// Avatar is not polymorphic so we wrap it with forwardRef
|
|
24
|
+
import Avatar, { type AvatarProps } from './Avatar/Avatar';
|
|
25
|
+
export { default as Avatar } from './Avatar/Avatar';
|
|
26
|
+
export type { AvatarProps } from './Avatar/Avatar';
|
|
27
|
+
//Button is polymorphic so we re-export it directly
|
|
28
|
+
import Button from './Button/Button';
|
|
29
|
+
export { default as Button } from './Button/Button';
|
|
30
|
+
export type { GuiButtonProps as ButtonProps } from './Button/Button';
|
|
31
|
+
//Collapse is not polymorphic so we wrap it with forwardRef
|
|
32
|
+
import Collapse, { type CollapseProps } from './Collapse/Collapse';
|
|
33
|
+
export { default as Collapse } from './Collapse/Collapse';
|
|
34
|
+
export type { CollapseProps } from './Collapse/Collapse';
|
|
35
|
+
//IconButton is polymorphic so we re-export it directly
|
|
36
|
+
import IconButton, { type IconButtonProps } from './IconButton/IconButton';
|
|
37
|
+
export { default as IconButton } from './IconButton/IconButton';
|
|
38
|
+
export type { IconButtonProps } from './IconButton/IconButton';
|
|
39
|
+
//Divider is not polymorphic so we wrap it with forwardRef
|
|
40
|
+
import Divider, { type DividerProps } from './Divider/Divider';
|
|
41
|
+
export { default as Divider } from './Divider/Divider';
|
|
42
|
+
export type { DividerProps } from './Divider/Divider';
|
|
43
|
+
//Drawer is not polymorphic so we wrap it with forwardRef
|
|
44
|
+
import Drawer, { type DrawerProps } from './Drawer/Drawer';
|
|
45
|
+
export { default as Drawer } from './Drawer/Drawer';
|
|
46
|
+
export type { DrawerProps } from './Drawer/Drawer';
|
|
47
|
+
//Link is polymorphic so we re-export it directly
|
|
48
|
+
import Link from './Link/Link';
|
|
49
|
+
export { default as Link } from './Link/Link';
|
|
50
|
+
export type { LinkProps } from './Link/Link';
|
|
51
|
+
// List and re lated are not polymorphic so we wrap them with forwardRef
|
|
52
|
+
import List, { type ListProps } from './List/List';
|
|
53
|
+
export { default as List } from './List/List';
|
|
54
|
+
export type { ListProps } from './List/List';
|
|
55
|
+
import ListItem, { type ListItemProps } from './ListItem/ListItem';
|
|
56
|
+
export { default as ListItem } from './ListItem/ListItem';
|
|
57
|
+
export type { ListItemProps } from './ListItem/ListItem';
|
|
58
|
+
import ListItemButton, { type ListItemButtonProps } from './ListItemButton/ListItemButton';
|
|
59
|
+
export { default as ListItemButton } from './ListItemButton/ListItemButton';
|
|
60
|
+
export type { ListItemButtonProps } from './ListItemButton/ListItemButton';
|
|
61
|
+
import ListItemIcon, { type ListItemIconProps } from './ListItemIcon/ListItemIcon';
|
|
62
|
+
export { default as ListItemIcon } from './ListItemIcon/ListItemIcon';
|
|
63
|
+
export type { ListItemIconProps } from './ListItemIcon/ListItemIcon';
|
|
64
|
+
import ListItemText, { type ListItemTextProps } from './ListItemText/ListItemText';
|
|
65
|
+
export { default as ListItemText } from './ListItemText/ListItemText';
|
|
66
|
+
export type { ListItemTextProps } from './ListItemText/ListItemText';
|
|
67
|
+
//Menu and related are polymorphic so we re-export them directly
|
|
68
|
+
import Menu, { type MenuProps } from './Menu/Menu';
|
|
69
|
+
export { default as Menu } from './Menu/Menu';
|
|
70
|
+
export type { MenuProps } from './Menu/Menu';
|
|
71
|
+
import MenuItem, { type MenuItemProps } from './MenuItem/MenuItem';
|
|
72
|
+
export { default as MenuItem } from './MenuItem/MenuItem';
|
|
73
|
+
export type { MenuItemProps } from './MenuItem/MenuItem';
|
|
74
|
+
//Paper is not polymorphic so we wrap it with forwardRef
|
|
75
|
+
import Paper, { type PaperProps } from './Paper/Paper';
|
|
76
|
+
export { default as Paper } from './Paper/Paper';
|
|
77
|
+
export type { PaperProps } from './Paper/Paper';
|
|
78
|
+
//Stack is not polymorphic so we wrap it with forwardRef
|
|
79
|
+
import Stack, { type StackProps } from './Stack/Stack';
|
|
80
|
+
export { default as Stack } from './Stack/Stack';
|
|
81
|
+
export type { StackProps } from './Stack/Stack';
|
|
82
|
+
//Switch is not polymorphic so we wrap it with forwardRef
|
|
83
|
+
import Switch, { type SwitchProps } from './Switch/Switch';
|
|
84
|
+
export { default as Switch } from './Switch/Switch';
|
|
85
|
+
export type { SwitchProps } from './Switch/Switch';
|
|
86
|
+
//Tables
|
|
87
|
+
import Table from './Table/Table';
|
|
88
|
+
export { default as Table } from './Table/Table';
|
|
89
|
+
export type { TableProps } from './Table/Table';
|
|
90
|
+
import TableBody from './Table/Body/TableBody';
|
|
91
|
+
export { default as TableBody } from './Table/Body/TableBody';
|
|
92
|
+
export type { TableBodyProps } from './Table/Body/TableBody';
|
|
93
|
+
import TableCell from './Table/Cell/TableCell';
|
|
94
|
+
export { default as TableCell } from './Table/Cell/TableCell';
|
|
95
|
+
export type { TableCellProps } from './Table/Cell/TableCell';
|
|
96
|
+
import TableHead from './Table/Head/TableHead';
|
|
97
|
+
export { default as TableHead } from './Table/Head/TableHead';
|
|
98
|
+
export type { TableHeadProps } from './Table/Head/TableHead';
|
|
99
|
+
import TableRow from './Table/Row/TableRow';
|
|
100
|
+
export { default as TableRow } from './Table/Row/TableRow';
|
|
101
|
+
export type { TableRowProps } from './Table/Row/TableRow';
|
|
102
|
+
|
|
103
|
+
//Toolbar is not polymorphic so we wrap it with forwardRef
|
|
104
|
+
import Toolbar from './Toolbar/Toolbar';
|
|
105
|
+
export { default as Toolbar } from './Toolbar/Toolbar';
|
|
106
|
+
export type { ToolbarProps } from './Toolbar/Toolbar';
|
|
107
|
+
//Tooltip is not polymorphic so we wrap it with forwardRef
|
|
108
|
+
import Tooltip from './Tooltip/Tooltip';
|
|
109
|
+
export { default as Tooltip } from './Tooltip/Tooltip';
|
|
110
|
+
export type { TooltipProps } from './Tooltip/Tooltip';
|
|
111
|
+
//Typography is polymorphic so we re-export it directly
|
|
112
|
+
import Typography, { type TypographyProps } from './Typography/Typography';
|
|
113
|
+
export { default as Typography } from './Typography/Typography';
|
|
114
|
+
export type { TypographyProps } from './Typography/Typography';
|
|
115
|
+
import Section from './Section/Section';
|
|
116
|
+
export { default as Section } from './Section/Section';
|
|
117
|
+
export type { SectionProps } from './Section/Section.types';
|
|
118
|
+
/* -------------------------------------------------------------------------------------------------
|
|
119
|
+
* GuiSx — re-export of MUI’s SxProps<Theme>
|
|
120
|
+
* -------------------------------------------------------------------------------------------------*/
|
|
121
|
+
/** Public sx type (kept for now to ease migration). */
|
|
122
|
+
export type GuiSx = SxProps<Theme>;
|
|
123
|
+
/* -------------------------------------------------------------------------------------------------
|
|
124
|
+
* Named bundle export (optional ergonomic import)
|
|
125
|
+
* -------------------------------------------------------------------------------------------------*/
|
|
126
|
+
export const Atoms = {
|
|
127
|
+
Box,
|
|
128
|
+
Typography,
|
|
129
|
+
Link,
|
|
130
|
+
Stack,
|
|
131
|
+
Divider,
|
|
132
|
+
AppBar,
|
|
133
|
+
Toolbar,
|
|
134
|
+
IconButton,
|
|
135
|
+
Menu,
|
|
136
|
+
MenuItem,
|
|
137
|
+
Drawer,
|
|
138
|
+
List,
|
|
139
|
+
ListItem,
|
|
140
|
+
ListItemButton,
|
|
141
|
+
ListItemIcon,
|
|
142
|
+
ListItemText,
|
|
143
|
+
Collapse,
|
|
144
|
+
Button,
|
|
145
|
+
Tooltip,
|
|
146
|
+
Switch,
|
|
147
|
+
Paper,
|
|
148
|
+
Avatar,
|
|
149
|
+
Section,
|
|
150
|
+
} as const;
|
|
151
|
+
export default Atoms;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
|
|
3
|
+
// Gridme is a generic grid layout component based on MUI's Box.
|
|
4
|
+
// It allows you to quickly define a grid layout with customizable number of columns and spacing.
|
|
5
|
+
// You can also control the maximum width of each grid item via the `itemMaxWidth` prop.
|
|
6
|
+
// This wrapper is part of this.GUI's declarative approach to layout construction.
|
|
7
|
+
const Gridme = ({
|
|
8
|
+
children,
|
|
9
|
+
columns = 3,
|
|
10
|
+
columnGap = '0.5rem',
|
|
11
|
+
rowGap = '1rem',
|
|
12
|
+
marginTop = '0px',
|
|
13
|
+
marginBottom = '0px',
|
|
14
|
+
sx = {},
|
|
15
|
+
}) => {
|
|
16
|
+
return (
|
|
17
|
+
<Box
|
|
18
|
+
sx={{
|
|
19
|
+
display: 'grid',
|
|
20
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
21
|
+
columnGap: columnGap,
|
|
22
|
+
rowGap: rowGap,
|
|
23
|
+
width: '100%',
|
|
24
|
+
alignItems: 'stretch',
|
|
25
|
+
justifyItems: 'stretch',
|
|
26
|
+
mt: marginTop,
|
|
27
|
+
mb: marginBottom,
|
|
28
|
+
'& > *': {
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: '100%',
|
|
31
|
+
},
|
|
32
|
+
...sx,
|
|
33
|
+
}}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</Box>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default Gridme;
|
|
41
|
+
|
|
42
|
+
// Example usage:
|
|
43
|
+
//
|
|
44
|
+
// import Gridme from './Gridme';
|
|
45
|
+
//
|
|
46
|
+
// const Example = () => (
|
|
47
|
+
// <Gridme columns={3} gap="1rem">
|
|
48
|
+
// <Box sx={{ backgroundColor: 'red', height: 100 }} />
|
|
49
|
+
// <Box sx={{ backgroundColor: 'blue', height: 100 }} />
|
|
50
|
+
// <Box sx={{ backgroundColor: 'green', height: 100 }} />
|
|
51
|
+
// </Gridme>
|
|
52
|
+
// );
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material';
|
|
2
|
+
import * as Icons from 'react-feather';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Link } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
const LilBox = ({
|
|
7
|
+
icon,
|
|
8
|
+
featherIcon,
|
|
9
|
+
label,
|
|
10
|
+
href,
|
|
11
|
+
aspectRatio = '5 / 4',
|
|
12
|
+
}) => {
|
|
13
|
+
const FeatherIcon = featherIcon && Icons[featherIcon] ? Icons[featherIcon] : null;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Box
|
|
17
|
+
component={href ? Link : 'div'}
|
|
18
|
+
to={href}
|
|
19
|
+
sx={{
|
|
20
|
+
width: '100%',
|
|
21
|
+
aspectRatio,
|
|
22
|
+
backgroundColor: (theme) =>
|
|
23
|
+
theme.palette.mode === 'dark'
|
|
24
|
+
? 'rgba(255, 255, 255, 0.05)'
|
|
25
|
+
: 'rgba(0, 0, 0, 0.03)',
|
|
26
|
+
border: '1px solid',
|
|
27
|
+
borderColor: (theme) =>
|
|
28
|
+
theme.palette.mode === 'dark'
|
|
29
|
+
? 'rgba(255, 255, 255, 0.1)'
|
|
30
|
+
: 'rgba(0, 0, 0, 0.1)',
|
|
31
|
+
borderRadius: '8px',
|
|
32
|
+
display: 'flex',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
color: (theme) => theme.palette.text.primary,
|
|
37
|
+
fontSize: '1rem',
|
|
38
|
+
fontWeight: 300,
|
|
39
|
+
transition: 'transform 0.2s ease',
|
|
40
|
+
textDecoration: 'none',
|
|
41
|
+
cursor: 'pointer',
|
|
42
|
+
'&:hover': {
|
|
43
|
+
transform: 'scale(1.05)',
|
|
44
|
+
},
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<Box sx={{ fontSize: '1.5rem', mb: 0.5 }}>
|
|
48
|
+
{icon ? icon : FeatherIcon ? <FeatherIcon size={24} /> : null}
|
|
49
|
+
</Box>
|
|
50
|
+
<Typography variant="body2" align="center">
|
|
51
|
+
{label}
|
|
52
|
+
</Typography>
|
|
53
|
+
</Box>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
LilBox.propTypes = {
|
|
58
|
+
icon: PropTypes.node,
|
|
59
|
+
featherIcon: PropTypes.string,
|
|
60
|
+
label: PropTypes.string.isRequired,
|
|
61
|
+
href: PropTypes.string,
|
|
62
|
+
aspectRatio: PropTypes.string,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default LilBox;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Link as RouterLink } from "react-router-dom";
|
|
2
|
+
import { Box, Typography, Card, CardActionArea, CardContent } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ModuleCard
|
|
6
|
+
* Clickable card for modules/features.
|
|
7
|
+
*
|
|
8
|
+
* Props:
|
|
9
|
+
* - title: string (required)
|
|
10
|
+
* - description: string
|
|
11
|
+
* - image: string (url to image)
|
|
12
|
+
* - href?: string -> preferred navigation prop (internal route or external URL)
|
|
13
|
+
* - link?: string -> alias of href for backward compatibility
|
|
14
|
+
* - target?: string -> optional target for external links (e.g., "_blank")
|
|
15
|
+
*
|
|
16
|
+
* Behavior:
|
|
17
|
+
* - If `href` (or `link`) starts with http/https, renders an <a>.
|
|
18
|
+
* - Otherwise, renders a React Router <Link> for client-side routing.
|
|
19
|
+
* - Avoids nested anchors: do NOT wrap ModuleCard with another <Link>.
|
|
20
|
+
*/
|
|
21
|
+
const ModuleCard = ({ title, description, image, href, link, target }) => {
|
|
22
|
+
const to = href ?? link ?? null;
|
|
23
|
+
const isExternal = typeof to === "string" && /^https?:\/\//i.test(to);
|
|
24
|
+
|
|
25
|
+
// Decide which props to pass to CardActionArea to avoid <a> inside <a>.
|
|
26
|
+
const navProps = to
|
|
27
|
+
? isExternal
|
|
28
|
+
? { component: "a", href: to, target: target ?? "_self", rel: "noopener noreferrer" }
|
|
29
|
+
: { component: RouterLink, to }
|
|
30
|
+
: {}; // No navigation if no href/link provided
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Card
|
|
34
|
+
sx={{
|
|
35
|
+
height: "100%",
|
|
36
|
+
backgroundColor: "background.paper",
|
|
37
|
+
boxShadow: 2,
|
|
38
|
+
borderRadius: 2,
|
|
39
|
+
"&:hover": {
|
|
40
|
+
boxShadow: 4,
|
|
41
|
+
transform: "translateY(-2px)",
|
|
42
|
+
transition: "0.3s ease-in-out",
|
|
43
|
+
},
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<CardActionArea
|
|
47
|
+
{...navProps}
|
|
48
|
+
sx={{ height: "100%", display: "flex", flexDirection: "column" }}
|
|
49
|
+
>
|
|
50
|
+
<CardContent
|
|
51
|
+
sx={{
|
|
52
|
+
display: "flex",
|
|
53
|
+
flexDirection: "column",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
textAlign: "center",
|
|
57
|
+
padding: 2,
|
|
58
|
+
height: "100%",
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
{/* Image */}
|
|
62
|
+
{image && (
|
|
63
|
+
<Box
|
|
64
|
+
component="img"
|
|
65
|
+
src={image}
|
|
66
|
+
alt={title}
|
|
67
|
+
sx={{
|
|
68
|
+
width: "80px",
|
|
69
|
+
height: "80px",
|
|
70
|
+
marginBottom: 1,
|
|
71
|
+
objectFit: "contain",
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
|
|
76
|
+
{/* Title */}
|
|
77
|
+
<Typography
|
|
78
|
+
variant="body1"
|
|
79
|
+
sx={{
|
|
80
|
+
fontWeight: 600,
|
|
81
|
+
color: "text.primary",
|
|
82
|
+
marginBottom: 1,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{title}
|
|
86
|
+
</Typography>
|
|
87
|
+
|
|
88
|
+
{/* Description */}
|
|
89
|
+
{description && (
|
|
90
|
+
<Typography
|
|
91
|
+
variant="body2"
|
|
92
|
+
sx={{
|
|
93
|
+
fontSize: "0.85rem",
|
|
94
|
+
color: "text.secondary",
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
{description}
|
|
98
|
+
</Typography>
|
|
99
|
+
)}
|
|
100
|
+
</CardContent>
|
|
101
|
+
</CardActionArea>
|
|
102
|
+
</Card>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default ModuleCard;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Box, Typography, Paper, TextField, IconButton, Avatar, Divider } from '@mui/material';
|
|
3
|
+
import { useTheme, alpha } from '@mui/material/styles';
|
|
4
|
+
import SendIcon from '@mui/icons-material/Send';
|
|
5
|
+
import SmartToyIcon from '@mui/icons-material/SmartToy';
|
|
6
|
+
import PersonIcon from '@mui/icons-material/Person';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* FullChatBot (this.GUI)
|
|
10
|
+
* A full-page, theme-aware chat surface.
|
|
11
|
+
*
|
|
12
|
+
* Props (all optional):
|
|
13
|
+
* - title: string (header title)
|
|
14
|
+
* - initialMessages: Array<{ id?: string, role: 'user'|'bot', text: string }>
|
|
15
|
+
* - onSend: async (text, history) => Promise<string | { text: string } | Array<{ text: string }>> (required to produce replies).
|
|
16
|
+
* - onError: function (error) => void
|
|
17
|
+
* - placeholder: string
|
|
18
|
+
* - headerIcon: ReactNode (defaults to SmartToy)
|
|
19
|
+
* - heightOffset: number|string // extra space to subtract besides navbar height
|
|
20
|
+
* - maxWidth: number|string // container max width
|
|
21
|
+
* - bleedTop: number|string // optionally pull the chat upward (compensate parent padding)
|
|
22
|
+
*/
|
|
23
|
+
export default function FullChatBot({
|
|
24
|
+
title = 'SupportBot Example',
|
|
25
|
+
initialMessages = [ { id: 'b1', role: 'bot', text: "Hi! I'm your Support Bot. How can I help today?" } ],
|
|
26
|
+
onSend,
|
|
27
|
+
onError,
|
|
28
|
+
placeholder = 'Type your message…',
|
|
29
|
+
headerIcon,
|
|
30
|
+
heightOffset = 0,
|
|
31
|
+
maxWidth = 1400,
|
|
32
|
+
bleedTop = 0,
|
|
33
|
+
}) {
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
|
|
36
|
+
// Colors and surfaces from theme
|
|
37
|
+
const mode = theme?.palette?.mode || 'dark';
|
|
38
|
+
const linkMain = theme?.palette?.link?.main || 'rgb(0,170,150)';
|
|
39
|
+
const borderColor = theme?.custom?.border || (mode === 'dark' ? 'rgba(255,255,255,0.14)' : 'rgba(0,0,0,0.12)');
|
|
40
|
+
const surface = theme?.palette?.background?.paper || (mode === 'dark' ? 'rgb(24,26,28)' : '#ffffff');
|
|
41
|
+
const textPrimary = theme?.palette?.text?.primary || (mode === 'dark' ? '#fff' : '#111');
|
|
42
|
+
const bubbleUserBg = alpha(linkMain, 0.14);
|
|
43
|
+
const bubbleUserBorder = alpha(linkMain, 0.35);
|
|
44
|
+
const bubbleBotBg = mode === 'dark' ? alpha('#ffffff', 0.06) : alpha('#000000', 0.04);
|
|
45
|
+
const bubbleBotBorder = mode === 'dark' ? alpha('#ffffff', 0.12) : alpha('#000000', 0.08);
|
|
46
|
+
|
|
47
|
+
const [messages, setMessages] = useState(() => initialMessages);
|
|
48
|
+
const [input, setInput] = useState('');
|
|
49
|
+
const [isTyping, setIsTyping] = useState(false);
|
|
50
|
+
const listRef = useRef(null);
|
|
51
|
+
|
|
52
|
+
// Auto-scroll to bottom when messages update
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
const el = listRef.current;
|
|
55
|
+
if (el) el.scrollTop = el.scrollHeight;
|
|
56
|
+
}, [messages, isTyping]);
|
|
57
|
+
|
|
58
|
+
const handleSend = async () => {
|
|
59
|
+
const trimmed = input.trim();
|
|
60
|
+
if (!trimmed) return;
|
|
61
|
+
const userMsg = { id: `u-${Date.now()}`, role: 'user', text: trimmed };
|
|
62
|
+
setMessages((m) => [...m, userMsg]);
|
|
63
|
+
setInput('');
|
|
64
|
+
|
|
65
|
+
setIsTyping(true);
|
|
66
|
+
try {
|
|
67
|
+
if (typeof onSend !== 'function') {
|
|
68
|
+
console.warn('[FullChatBot] onSend prop is required to generate replies.');
|
|
69
|
+
setIsTyping(false);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let next = await onSend(trimmed, [...messages, userMsg]);
|
|
73
|
+
const toArray = Array.isArray(next) ? next : [next];
|
|
74
|
+
const prepared = toArray
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.map((n, idx) => ({ id: `b-${Date.now()}-${idx}`, role: 'bot', text: typeof n === 'string' ? n : (n?.text || '') }));
|
|
77
|
+
// small UX delay
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
setMessages((m) => [...m, ...prepared]);
|
|
80
|
+
setIsTyping(false);
|
|
81
|
+
}, 200);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
if (typeof onError === 'function') try { onError(e); } catch (_) {}
|
|
84
|
+
setMessages((m) => [...m, { id: `b-${Date.now()}`, role: 'bot', text: 'Sorry, something went wrong. Please try again.' }]);
|
|
85
|
+
setIsTyping(false);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const onKeyDown = (e) => {
|
|
90
|
+
if (e.key === 'Enter' && !e.shiftKey) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
handleSend();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const bubbleStyles = (role) => {
|
|
97
|
+
const isUser = role === 'user';
|
|
98
|
+
return {
|
|
99
|
+
alignSelf: isUser ? 'flex-end' : 'flex-start',
|
|
100
|
+
maxWidth: '78%',
|
|
101
|
+
padding: '10px 12px',
|
|
102
|
+
borderRadius: 12,
|
|
103
|
+
background: isUser ? bubbleUserBg : bubbleBotBg,
|
|
104
|
+
border: `1px solid ${isUser ? bubbleUserBorder : bubbleBotBorder}`,
|
|
105
|
+
color: 'inherit',
|
|
106
|
+
wordBreak: 'break-word'
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const HeaderIcon = headerIcon || <SmartToyIcon sx={{ color: linkMain }} />;
|
|
111
|
+
|
|
112
|
+
// Full height relative to viewport minus navbar and optional offset
|
|
113
|
+
const topCalc = `calc(97vh - var(--nav-height, 56px) - ${typeof heightOffset === 'number' ? `${heightOffset}px` : String(heightOffset)})`;
|
|
114
|
+
const mtBleed = bleedTop ? (typeof bleedTop === 'number' ? `${-bleedTop}px` : `calc(0px - ${String(bleedTop)})`) : 0;
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<Box sx={{ width: '100%', maxWidth, mx: 'auto', height: topCalc, mt: mtBleed, display: 'flex', flexDirection: 'column', color: textPrimary, colorScheme: mode }}>
|
|
118
|
+
{/* Header */}
|
|
119
|
+
<Box
|
|
120
|
+
sx={{
|
|
121
|
+
display: 'flex',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
gap: 1,
|
|
124
|
+
px: 2,
|
|
125
|
+
py: 1,
|
|
126
|
+
border: '1px solid',
|
|
127
|
+
borderColor: borderColor,
|
|
128
|
+
borderBottom: 'none',
|
|
129
|
+
borderTopLeftRadius: 8,
|
|
130
|
+
borderTopRightRadius: 8,
|
|
131
|
+
background: surface,
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
{HeaderIcon}
|
|
135
|
+
<Typography variant="h6" sx={{ fontWeight: 700 }}>{title}</Typography>
|
|
136
|
+
</Box>
|
|
137
|
+
|
|
138
|
+
{/* Chat container fills remaining space */}
|
|
139
|
+
<Paper elevation={0} sx={{
|
|
140
|
+
flex: 1,
|
|
141
|
+
display: 'flex',
|
|
142
|
+
flexDirection: 'column',
|
|
143
|
+
border: '1px solid',
|
|
144
|
+
borderColor: borderColor,
|
|
145
|
+
borderRadius: 2,
|
|
146
|
+
background: surface,
|
|
147
|
+
minHeight: 360
|
|
148
|
+
}}>
|
|
149
|
+
{/* Conversation */}
|
|
150
|
+
<Box ref={listRef} sx={{
|
|
151
|
+
flex: 1,
|
|
152
|
+
overflowY: 'auto',
|
|
153
|
+
p: 2,
|
|
154
|
+
display: 'flex',
|
|
155
|
+
flexDirection: 'column',
|
|
156
|
+
gap: 1.2
|
|
157
|
+
}}>
|
|
158
|
+
{messages.map((m) => (
|
|
159
|
+
<Box key={m.id} sx={{ display: 'flex', gap: 1, alignItems: 'flex-start', flexDirection: m.role === 'user' ? 'row-reverse' : 'row' }}>
|
|
160
|
+
<Avatar sx={{ width: 28, height: 28, bgcolor: m.role === 'user' ? 'rgba(0,170,150,0.18)' : 'rgba(255,255,255,0.08)', border: '1px solid', borderColor: m.role === 'user' ? 'rgba(0,170,150,0.4)' : 'rgba(255,255,255,0.18)' }}>
|
|
161
|
+
{m.role === 'user' ? <PersonIcon fontSize="small" /> : <SmartToyIcon fontSize="small" />}
|
|
162
|
+
</Avatar>
|
|
163
|
+
<Box sx={bubbleStyles(m.role)}>
|
|
164
|
+
<Typography variant="body2">{m.text}</Typography>
|
|
165
|
+
</Box>
|
|
166
|
+
</Box>
|
|
167
|
+
))}
|
|
168
|
+
{isTyping && (
|
|
169
|
+
<Box sx={{ display: 'flex', gap: 1, alignItems: 'center' }}>
|
|
170
|
+
<Avatar sx={{ width: 28, height: 28, bgcolor: 'rgba(255,255,255,0.08)', border: '1px solid rgba(255,255,255,0.18)' }}>
|
|
171
|
+
<SmartToyIcon fontSize="small" />
|
|
172
|
+
</Avatar>
|
|
173
|
+
<Box sx={{ ...bubbleStyles('bot'), display: 'inline-flex', gap: 1 }}>
|
|
174
|
+
<Dot /> <Dot delay={120} /> <Dot delay={240} />
|
|
175
|
+
</Box>
|
|
176
|
+
</Box>
|
|
177
|
+
)}
|
|
178
|
+
</Box>
|
|
179
|
+
<Divider />
|
|
180
|
+
{/* Composer */}
|
|
181
|
+
<Box sx={{ display: 'flex', alignItems: 'center', p: 1 }}>
|
|
182
|
+
<TextField
|
|
183
|
+
value={input}
|
|
184
|
+
onChange={(e) => setInput(e.target.value)}
|
|
185
|
+
onKeyDown={onKeyDown}
|
|
186
|
+
placeholder={placeholder}
|
|
187
|
+
variant="standard"
|
|
188
|
+
fullWidth
|
|
189
|
+
InputProps={{ disableUnderline: true }}
|
|
190
|
+
sx={{
|
|
191
|
+
mx: 1,
|
|
192
|
+
px: 1.5,
|
|
193
|
+
py: 1,
|
|
194
|
+
borderRadius: 1,
|
|
195
|
+
border: '1px solid',
|
|
196
|
+
borderColor: borderColor,
|
|
197
|
+
background: mode === 'dark' ? alpha('#ffffff', 0.04) : alpha('#000000', 0.03)
|
|
198
|
+
}}
|
|
199
|
+
/>
|
|
200
|
+
<IconButton color="primary" onClick={handleSend} aria-label="send">
|
|
201
|
+
<SendIcon />
|
|
202
|
+
</IconButton>
|
|
203
|
+
</Box>
|
|
204
|
+
</Paper>
|
|
205
|
+
</Box>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
function Dot({ delay = 0 }) {
|
|
210
|
+
const [on, setOn] = useState(false);
|
|
211
|
+
useEffect(() => {
|
|
212
|
+
const id = setInterval(() => setOn((v) => !v), 350);
|
|
213
|
+
return () => clearInterval(id);
|
|
214
|
+
}, []);
|
|
215
|
+
return (
|
|
216
|
+
<Box component="span" sx={{
|
|
217
|
+
width: 6, height: 6, borderRadius: 1,
|
|
218
|
+
display: 'inline-block',
|
|
219
|
+
background: on ? 'rgba(255,255,255,0.8)' : 'rgba(255,255,255,0.35)',
|
|
220
|
+
transition: 'opacity 200ms ease',
|
|
221
|
+
}} />
|
|
222
|
+
);
|
|
223
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/components/Pages/CodeBlock.jsx
|
|
2
|
+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
3
|
+
import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
4
|
+
import { oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
5
|
+
import { useTheme } from '@mui/material/styles';
|
|
6
|
+
|
|
7
|
+
export default function CodeBlock({ children, language = "javascript" }) {
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
const isDark = theme.palette.mode === "dark";
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<SyntaxHighlighter
|
|
13
|
+
language={language}
|
|
14
|
+
style={isDark ? oneDark : oneLight}
|
|
15
|
+
customStyle={{
|
|
16
|
+
borderRadius: "6px",
|
|
17
|
+
fontSize: "0.85rem",
|
|
18
|
+
padding: "1rem",
|
|
19
|
+
backgroundColor: isDark ? "#1e1e1e" : "#f5f5f5",
|
|
20
|
+
border: isDark ? "1px solid rgba(255,255,255,0.1)" : "1px solid #ddd",
|
|
21
|
+
color: isDark ? "#f8f8f2" : "#2d2d2d",
|
|
22
|
+
textShadow: "none",
|
|
23
|
+
}}
|
|
24
|
+
codeTagProps={{
|
|
25
|
+
style: {
|
|
26
|
+
textShadow: "none", // Fuerza remover cualquier sombra
|
|
27
|
+
}
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
{children.trim()}
|
|
31
|
+
</SyntaxHighlighter>
|
|
32
|
+
);
|
|
33
|
+
}
|