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.
- package/dist/init/index.html +27 -0
- package/dist/init/package-lock.json +5779 -0
- package/dist/init/package.json +24 -0
- package/dist/init/src/App.tsx +40 -0
- package/dist/init/src/index.css +16 -0
- package/dist/init/src/main.tsx +13 -0
- package/dist/init/src/router/DerivableRouter.tsx +36 -0
- package/dist/init/tsconfig.json +17 -0
- package/dist/init/vite.config.ts +11 -0
- package/package.json +5 -3
- 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,28 @@
|
|
|
1
|
+
import type { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* AppBarProps
|
|
5
|
+
* -----------
|
|
6
|
+
* Extends MUI's AppBarProps to add This.GUI-specific fields (id, data-testid).
|
|
7
|
+
*/
|
|
8
|
+
export interface AppBarProps extends MuiAppBarProps {
|
|
9
|
+
/** Optional id for targeting/testing */
|
|
10
|
+
id?: string;
|
|
11
|
+
/** Optional data-testid for testing */
|
|
12
|
+
['data-testid']?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* AppBarResolverSpec
|
|
17
|
+
* ------------------
|
|
18
|
+
* JSON-friendly spec for declarative usage.
|
|
19
|
+
*/
|
|
20
|
+
export type AppBarResolverSpec = {
|
|
21
|
+
type?: 'AppBar';
|
|
22
|
+
props?: Partial<AppBarProps> & {
|
|
23
|
+
/** Optional polymorphic component (Link, 'a', etc.) */
|
|
24
|
+
component?: React.ElementType;
|
|
25
|
+
/** Children to render inside the AppBar */
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
4
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
5
|
+
import Avatar from './Avatar';
|
|
6
|
+
export type AvatarSpec = {
|
|
7
|
+
type: 'Avatar';
|
|
8
|
+
props?: {
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
alt?: string;
|
|
11
|
+
src?: string;
|
|
12
|
+
variant?: 'circular' | 'rounded' | 'square';
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
className?: string;
|
|
15
|
+
id?: string;
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
component?: React.ElementType;
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const AvatarResolver: RegistryEntry = {
|
|
24
|
+
type: 'Avatar',
|
|
25
|
+
resolve(spec: AvatarSpec, _ctx?: ResolveCtx) {
|
|
26
|
+
const p = spec.props ?? {};
|
|
27
|
+
const {
|
|
28
|
+
children,
|
|
29
|
+
alt,
|
|
30
|
+
src,
|
|
31
|
+
variant,
|
|
32
|
+
sx,
|
|
33
|
+
className,
|
|
34
|
+
id,
|
|
35
|
+
component,
|
|
36
|
+
as,
|
|
37
|
+
...rest
|
|
38
|
+
} = p;
|
|
39
|
+
|
|
40
|
+
const resolvedComponent = component ?? as;
|
|
41
|
+
const avatarId = ensureNodeId('avatar', id);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Avatar
|
|
45
|
+
src={src}
|
|
46
|
+
alt={alt}
|
|
47
|
+
variant={variant}
|
|
48
|
+
sx={sx}
|
|
49
|
+
className={className}
|
|
50
|
+
id={avatarId}
|
|
51
|
+
data-testid={p['data-testid']}
|
|
52
|
+
{...(resolvedComponent ? { component: resolvedComponent } : {})}
|
|
53
|
+
{...rest}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</Avatar>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export default AvatarResolver;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Avatar from './Avatar';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Avatar> = {
|
|
5
|
+
title: 'Atoms/Elements/Avatar',
|
|
6
|
+
component: Avatar,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<typeof Avatar>;
|
|
12
|
+
|
|
13
|
+
export const InitialsAvatar: Story = {
|
|
14
|
+
render: () => (
|
|
15
|
+
<Avatar>
|
|
16
|
+
AB
|
|
17
|
+
</Avatar>
|
|
18
|
+
),
|
|
19
|
+
name: 'With Initials',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ImageAvatar: Story = {
|
|
23
|
+
render: () => (
|
|
24
|
+
<Avatar alt="Abella" src="https://i.pravatar.cc/150?img=32" />
|
|
25
|
+
),
|
|
26
|
+
name: 'With Image',
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const SquareAvatar: Story = {
|
|
30
|
+
render: () => (
|
|
31
|
+
<Avatar variant="square">
|
|
32
|
+
SQ
|
|
33
|
+
</Avatar>
|
|
34
|
+
),
|
|
35
|
+
name: 'Square Variant',
|
|
36
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import MuiAvatar from '@mui/material/Avatar';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This.GUI — Avatar (atom)
|
|
6
|
+
* Thin wrapper around MUI’s Avatar component.
|
|
7
|
+
*
|
|
8
|
+
* Supports standard avatar props like `src`, `alt`, `variant`, and `sx`.
|
|
9
|
+
* Enables consistent use of avatar styling across the system.
|
|
10
|
+
*/
|
|
11
|
+
const Avatar = MuiAvatar;
|
|
12
|
+
export type AvatarProps = React.ComponentProps<typeof Avatar>;
|
|
13
|
+
(Avatar as any).displayName = 'Gui.Avatar';
|
|
14
|
+
export default Avatar;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Box from './Box';
|
|
3
|
+
import Link from '../Link/Link';
|
|
4
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
6
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Declarative spec for Box (polymorphic container)
|
|
10
|
+
*
|
|
11
|
+
* JSON-friendly rules:
|
|
12
|
+
* - Prefer `to` / `href` / `external` over passing a string `"Link"`.
|
|
13
|
+
* - We accept intrinsic element strings (e.g. 'div', 'section', 'span', 'a', 'img').
|
|
14
|
+
* - If `to` is present and no explicit React component was provided, we render with This.GUI `Link`.
|
|
15
|
+
* - If `href`/`external` are present and no explicit component was provided, we render an anchor (`'a'`).
|
|
16
|
+
* - When `component="img"`, image attributes (`src`, `alt`, `width`, `height`, etc.) are passed through.
|
|
17
|
+
*/
|
|
18
|
+
export type BoxSpec = {
|
|
19
|
+
type: 'Box';
|
|
20
|
+
props?: {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
|
|
23
|
+
// Polymorphism / routing
|
|
24
|
+
component?: React.ElementType | string;
|
|
25
|
+
as?: React.ElementType | string; // alias for component
|
|
26
|
+
to?: string; // router target (when component={Link} or inferred)
|
|
27
|
+
href?: string; // anchor target (when component='a' or inferred)
|
|
28
|
+
external?: boolean | 'true' | 1; // if truthy, anchor gets safe target/rel
|
|
29
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
30
|
+
rel?: string;
|
|
31
|
+
|
|
32
|
+
// IMG-specific (when component='img')
|
|
33
|
+
src?: string;
|
|
34
|
+
alt?: string;
|
|
35
|
+
width?: number | string;
|
|
36
|
+
height?: number | string;
|
|
37
|
+
loading?: 'eager' | 'lazy';
|
|
38
|
+
decoding?: 'auto' | 'sync' | 'async';
|
|
39
|
+
referrerPolicy?: React.HTMLAttributeReferrerPolicy;
|
|
40
|
+
sizes?: string;
|
|
41
|
+
srcSet?: string;
|
|
42
|
+
|
|
43
|
+
// Styling & misc
|
|
44
|
+
sx?: SxProps<Theme>;
|
|
45
|
+
className?: string;
|
|
46
|
+
id?: string;
|
|
47
|
+
'data-testid'?: string;
|
|
48
|
+
|
|
49
|
+
// Allow system props / arbitrary passthrough (gap, p, m, display, etc.)
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const BoxResolver: RegistryEntry = {
|
|
55
|
+
type: 'Box',
|
|
56
|
+
resolve(spec: BoxSpec, _ctx?: ResolveCtx) {
|
|
57
|
+
const p = spec.props ?? {};
|
|
58
|
+
|
|
59
|
+
// Decide polymorphic target (safe for JSON):
|
|
60
|
+
// - Accept real React components (functions/classes).
|
|
61
|
+
// - Accept intrinsic strings ('div','section','span','a','img', etc.) EXCEPT the string "Link".
|
|
62
|
+
// - Infer Link/'a' from `to`/`href` when no explicit component is provided.
|
|
63
|
+
const rawComp = p.component ?? p.as;
|
|
64
|
+
|
|
65
|
+
const isReactComp = typeof rawComp === 'function';
|
|
66
|
+
const isString = typeof rawComp === 'string';
|
|
67
|
+
|
|
68
|
+
// Normalize strings (e.g. 'Img' -> 'img'); disallow the literal "Link"
|
|
69
|
+
const normalizedString = isString ? String(rawComp).trim() : undefined;
|
|
70
|
+
const lowered = normalizedString ? normalizedString.toLowerCase() : undefined;
|
|
71
|
+
const isIntrinsicString = !!normalizedString && lowered !== 'link';
|
|
72
|
+
|
|
73
|
+
let component: any | undefined =
|
|
74
|
+
isReactComp ? (rawComp as React.ElementType) :
|
|
75
|
+
isIntrinsicString ? normalizedString :
|
|
76
|
+
undefined;
|
|
77
|
+
|
|
78
|
+
if (!component) {
|
|
79
|
+
if (p.to) {
|
|
80
|
+
component = Link;
|
|
81
|
+
} else if (p.href || p.external) {
|
|
82
|
+
component = 'a';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Build routing/anchor props only if they match the chosen component
|
|
87
|
+
const routingProps: Record<string, any> = {};
|
|
88
|
+
if (component === Link && p.to) {
|
|
89
|
+
routingProps.to = p.to;
|
|
90
|
+
}
|
|
91
|
+
if (component === 'a') {
|
|
92
|
+
routingProps.href = p.href;
|
|
93
|
+
const isExternal = p.external === true || p.external === 'true' || p.external === 1;
|
|
94
|
+
if (isExternal) {
|
|
95
|
+
routingProps.target = p.target ?? '_blank';
|
|
96
|
+
routingProps.rel = p.rel ?? 'noopener noreferrer';
|
|
97
|
+
} else {
|
|
98
|
+
if (p.target) routingProps.target = p.target;
|
|
99
|
+
if (p.rel) routingProps.rel = p.rel;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// IMG specific passthrough (only when explicitly rendering an <img>)
|
|
104
|
+
const imgProps =
|
|
105
|
+
component === 'img'
|
|
106
|
+
? {
|
|
107
|
+
src: p.src,
|
|
108
|
+
alt: p.alt,
|
|
109
|
+
width: p.width,
|
|
110
|
+
height: p.height,
|
|
111
|
+
loading: p.loading,
|
|
112
|
+
decoding: p.decoding,
|
|
113
|
+
referrerPolicy: p.referrerPolicy,
|
|
114
|
+
sizes: p.sizes,
|
|
115
|
+
srcSet: p.srcSet,
|
|
116
|
+
}
|
|
117
|
+
: {};
|
|
118
|
+
|
|
119
|
+
// Dev-time nudge if someone picked 'img' without a src
|
|
120
|
+
if (process.env.NODE_ENV !== 'production' && component === 'img' && !p.src) {
|
|
121
|
+
// eslint-disable-next-line no-console
|
|
122
|
+
console.warn('[Box.resolver] component="img" used without a `src` prop.');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Collect common props and avoid leaking resolver-only keys
|
|
126
|
+
const {
|
|
127
|
+
children,
|
|
128
|
+
// resolver-only / routing keys to strip
|
|
129
|
+
as: _as,
|
|
130
|
+
to: _to,
|
|
131
|
+
href: _href,
|
|
132
|
+
external: _external,
|
|
133
|
+
target: _target,
|
|
134
|
+
rel: _rel,
|
|
135
|
+
// img-only keys already handled
|
|
136
|
+
src: _src,
|
|
137
|
+
alt: _alt,
|
|
138
|
+
width: _width,
|
|
139
|
+
height: _height,
|
|
140
|
+
loading: _loading,
|
|
141
|
+
decoding: _decoding,
|
|
142
|
+
referrerPolicy: _referrerPolicy,
|
|
143
|
+
sizes: _sizes,
|
|
144
|
+
srcSet: _srcSet,
|
|
145
|
+
// passthrough everything else (system props, data-*, aria-*, etc.)
|
|
146
|
+
...rest
|
|
147
|
+
} = p;
|
|
148
|
+
|
|
149
|
+
// Build root props, conditionally attach `component`
|
|
150
|
+
const rootProps: Record<string, any> = {
|
|
151
|
+
sx: p.sx,
|
|
152
|
+
id: ensureNodeId('box', p.id),
|
|
153
|
+
className: p.className,
|
|
154
|
+
'data-testid': p['data-testid'],
|
|
155
|
+
...routingProps,
|
|
156
|
+
...imgProps,
|
|
157
|
+
...rest,
|
|
158
|
+
};
|
|
159
|
+
if (component) {
|
|
160
|
+
rootProps.component = component;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<Box {...rootProps}>
|
|
165
|
+
{children}
|
|
166
|
+
</Box>
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export default BoxResolver;
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// src/gui/atoms/Box/Box.stories.tsx
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { Box, Link, Typography, Button } from '@/gui/components/atoms';
|
|
4
|
+
// ======================= Meta =======================
|
|
5
|
+
const meta: Meta<typeof Box> = {
|
|
6
|
+
title: 'Atoms/Containers/Box',
|
|
7
|
+
component: Box,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div style={{ padding: 16, minHeight: 240 }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: `
|
|
20
|
+
**Box** is a thin wrapper around MUI's \`Box\` that preserves **polymorphism** and integrates with **This.GUI** theming.
|
|
21
|
+
Use it as your default layout primitive: spacing, flex/grid, backgrounds, borders, etc.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
## Features
|
|
25
|
+
- **Polymorphic**: \`component\` (or \`as\`) can be an element tag (e.g. \`'section'\`, \`'img'\`, \`'a'\`) or a component (e.g. This.GUI \`Link\`).
|
|
26
|
+
- **Routing-friendly**: when using \`component={Link}\` you can pass \`to\`; anchors use \`href\`.
|
|
27
|
+
- **System props** & **sx**: use MUI system (p, m, display, gap, flex, grid, etc.) and the \`sx\` prop for deep styling.
|
|
28
|
+
- **Image mode**: if \`component="img"\`, you can pass \`src\`, \`alt\`, \`width\`, \`height\`, \`loading\`, \`decoding\`, \`referrerPolicy\`, \`sizes\`, \`srcSet\`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
## Key Props
|
|
32
|
+
- \`component?: ElementType | string\` / \`as?: ElementType | string\`
|
|
33
|
+
- \`to?: string\` (when \`component={Link}\`)
|
|
34
|
+
- \`href?: string\` (when \`component="a"\`)
|
|
35
|
+
- \`sx?: SxProps\` + all MUI system props (e.g. \`p\`, \`m\`, \`display\`, \`gap\`)
|
|
36
|
+
- **Image-only extras** (when \`component="img"\`): \`src\`, \`alt\`, \`width\`, \`height\`, \`loading\`, \`decoding\`, \`referrerPolicy\`, \`sizes\`, \`srcSet\`.
|
|
37
|
+
|
|
38
|
+
> We don't expose \`component\`, \`to\`, \`href\` as Storybook controls—see the dedicated stories below.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
## Basic usage
|
|
42
|
+
~~~jsx
|
|
43
|
+
import { Box } from '@/gui/atoms';
|
|
44
|
+
|
|
45
|
+
<Box p={2} sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1 }}>
|
|
46
|
+
Content
|
|
47
|
+
</Box>
|
|
48
|
+
~~~
|
|
49
|
+
|
|
50
|
+
## Polymorphic (as a section)
|
|
51
|
+
~~~jsx
|
|
52
|
+
<Box component="section" p={2}>Section content</Box>
|
|
53
|
+
~~~
|
|
54
|
+
|
|
55
|
+
## Router link target
|
|
56
|
+
~~~jsx
|
|
57
|
+
import { Box, Link } from '@/gui/atoms';
|
|
58
|
+
|
|
59
|
+
<Box component={Link} to="/docs" p={1} sx={{ display: 'inline-block' }}>
|
|
60
|
+
Go to docs
|
|
61
|
+
</Box>
|
|
62
|
+
~~~
|
|
63
|
+
|
|
64
|
+
## Image mode
|
|
65
|
+
~~~jsx
|
|
66
|
+
<Box component="img" src="/logo.png" alt="Logo" sx={{ width: 120, height: 'auto' }} />
|
|
67
|
+
~~~
|
|
68
|
+
|
|
69
|
+
## Declarative JSON / Config usage
|
|
70
|
+
~~~json
|
|
71
|
+
{
|
|
72
|
+
"type": "Box",
|
|
73
|
+
"props": {
|
|
74
|
+
"component": "section",
|
|
75
|
+
"p": 2,
|
|
76
|
+
"sx": { "border": "1px solid", "borderColor": "divider", "borderRadius": 8 },
|
|
77
|
+
"children": "Section content"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
~~~
|
|
81
|
+
`,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
controls: {
|
|
85
|
+
exclude: ['component', 'as', 'to', 'href', 'sx'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
argTypes: {
|
|
89
|
+
// System props examples (you can add more if useful)
|
|
90
|
+
p: { control: { type: 'number' }, description: 'Padding (system prop)' },
|
|
91
|
+
m: { control: { type: 'number' }, description: 'Margin (system prop)' },
|
|
92
|
+
display: {
|
|
93
|
+
control: { type: 'select' },
|
|
94
|
+
options: ['block', 'inline-block', 'flex', 'grid', 'inline-flex', 'inline', 'none'],
|
|
95
|
+
},
|
|
96
|
+
gap: { control: { type: 'number' } },
|
|
97
|
+
},
|
|
98
|
+
args: {
|
|
99
|
+
p: 2,
|
|
100
|
+
display: 'block',
|
|
101
|
+
children: 'Box content',
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
export default meta;
|
|
105
|
+
|
|
106
|
+
type Story = StoryObj<typeof Box>;
|
|
107
|
+
|
|
108
|
+
// ======================= Stories =======================
|
|
109
|
+
export const Playground: Story = {};
|
|
110
|
+
|
|
111
|
+
export const LayoutBasics: Story = {
|
|
112
|
+
name: 'Layout basics (spacing, border, radius)',
|
|
113
|
+
render: (args) => (
|
|
114
|
+
<Box
|
|
115
|
+
{...args}
|
|
116
|
+
sx={{
|
|
117
|
+
border: '1px solid',
|
|
118
|
+
borderColor: 'divider',
|
|
119
|
+
borderRadius: 2,
|
|
120
|
+
bgcolor: 'background.paper',
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const FlexRow: Story = {
|
|
127
|
+
args: {},
|
|
128
|
+
render: () => (
|
|
129
|
+
<Box display="flex" gap={2}>
|
|
130
|
+
<Box p={1} sx={{ border: '1px dashed', borderColor: 'divider' }}>A</Box>
|
|
131
|
+
<Box p={1} sx={{ border: '1px dashed', borderColor: 'divider' }}>B</Box>
|
|
132
|
+
<Box p={1} sx={{ border: '1px dashed', borderColor: 'divider' }}>C</Box>
|
|
133
|
+
</Box>
|
|
134
|
+
),
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export const GridLayout: Story = {
|
|
138
|
+
render: () => (
|
|
139
|
+
<Box display="grid" sx={{ gridTemplateColumns: 'repeat(3, 1fr)', gap: 2 }}>
|
|
140
|
+
{Array.from({ length: 6 }).map((_, i) => (
|
|
141
|
+
<Box key={i} p={2} sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1 }}>
|
|
142
|
+
Cell {i + 1}
|
|
143
|
+
</Box>
|
|
144
|
+
))}
|
|
145
|
+
</Box>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const AsSection: Story = {
|
|
150
|
+
name: 'Polymorphic: section',
|
|
151
|
+
render: () => (
|
|
152
|
+
<Box component="section" p={2} sx={{ borderLeft: '4px solid', borderColor: 'primary.main' }}>
|
|
153
|
+
<Typography variant="h6">Section title</Typography>
|
|
154
|
+
<Typography variant="body2" sx={{ opacity: 0.8 }}>
|
|
155
|
+
Section content goes here.
|
|
156
|
+
</Typography>
|
|
157
|
+
</Box>
|
|
158
|
+
),
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const AsAnchor: Story = {
|
|
162
|
+
name: 'Polymorphic: anchor (href)',
|
|
163
|
+
render: () => (
|
|
164
|
+
<Box
|
|
165
|
+
component="a"
|
|
166
|
+
href="https://neurons.me"
|
|
167
|
+
target="_blank"
|
|
168
|
+
rel="noreferrer"
|
|
169
|
+
p={1}
|
|
170
|
+
sx={{
|
|
171
|
+
display: 'inline-block',
|
|
172
|
+
border: '1px solid',
|
|
173
|
+
borderColor: 'divider',
|
|
174
|
+
borderRadius: 1,
|
|
175
|
+
'&:hover': { textDecoration: 'none', bgcolor: 'action.hover' },
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
Visit neurons.me
|
|
179
|
+
</Box>
|
|
180
|
+
),
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export const AsRouterLink: Story = {
|
|
184
|
+
name: 'Polymorphic: Link (to)',
|
|
185
|
+
render: () => (
|
|
186
|
+
<Box
|
|
187
|
+
component={Link}
|
|
188
|
+
to="/docs"
|
|
189
|
+
p={1}
|
|
190
|
+
sx={{
|
|
191
|
+
display: 'inline-block',
|
|
192
|
+
border: '1px solid',
|
|
193
|
+
borderColor: 'divider',
|
|
194
|
+
borderRadius: 1,
|
|
195
|
+
'&:hover': { textDecoration: 'none', bgcolor: 'action.hover' },
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
Go to docs
|
|
199
|
+
</Box>
|
|
200
|
+
),
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export const ImageMode: Story = {
|
|
204
|
+
name: 'Image mode (component="img")',
|
|
205
|
+
render: () => (
|
|
206
|
+
<Box
|
|
207
|
+
component="img"
|
|
208
|
+
src="https://placekitten.com/320/160"
|
|
209
|
+
alt="Kitten"
|
|
210
|
+
sx={{ width: 320, height: 'auto', borderRadius: 1, border: '1px solid', borderColor: 'divider' }}
|
|
211
|
+
loading="lazy"
|
|
212
|
+
decoding="async"
|
|
213
|
+
/>
|
|
214
|
+
),
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export const NestedComposition: Story = {
|
|
218
|
+
render: () => (
|
|
219
|
+
<Box p={2} sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1 }}>
|
|
220
|
+
<Typography variant="subtitle1" sx={{ mb: 1 }}>Nested composition</Typography>
|
|
221
|
+
<Box display="flex" gap={1}>
|
|
222
|
+
<Button variant="contained" color="primary">Action</Button>
|
|
223
|
+
<Box component={Link} to="/docs" sx={{ alignSelf: 'center' }}>
|
|
224
|
+
Learn more
|
|
225
|
+
</Box>
|
|
226
|
+
</Box>
|
|
227
|
+
</Box>
|
|
228
|
+
),
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
export const SXDeepStyling: Story = {
|
|
232
|
+
name: 'Deep styling with sx',
|
|
233
|
+
render: () => (
|
|
234
|
+
<Box
|
|
235
|
+
p={2}
|
|
236
|
+
sx={{
|
|
237
|
+
borderRadius: 2,
|
|
238
|
+
bgcolor: 'background.paper',
|
|
239
|
+
border: '1px solid',
|
|
240
|
+
borderColor: 'divider',
|
|
241
|
+
'& .demo-title': {
|
|
242
|
+
fontWeight: 700,
|
|
243
|
+
color: 'text.primary',
|
|
244
|
+
mb: 1,
|
|
245
|
+
},
|
|
246
|
+
'& .demo-card': {
|
|
247
|
+
p: 1.5,
|
|
248
|
+
border: '1px solid',
|
|
249
|
+
borderColor: 'divider',
|
|
250
|
+
borderRadius: 1,
|
|
251
|
+
'&:hover': { bgcolor: 'action.hover' },
|
|
252
|
+
},
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
<Typography className="demo-title">Cards</Typography>
|
|
256
|
+
<Box display="grid" sx={{ gridTemplateColumns: 'repeat(3, 1fr)', gap: 1.5 }}>
|
|
257
|
+
<Box className="demo-card">One</Box>
|
|
258
|
+
<Box className="demo-card">Two</Box>
|
|
259
|
+
<Box className="demo-card">Three</Box>
|
|
260
|
+
</Box>
|
|
261
|
+
</Box>
|
|
262
|
+
),
|
|
263
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/gui/atoms/Box/Box.tsx
|
|
2
|
+
/*
|
|
3
|
+
* This.GUI — Box (polymorphic)
|
|
4
|
+
* Wrapper that keeps MUI's own typing, including the `component` prop.
|
|
5
|
+
* Ejemplos válidos:
|
|
6
|
+
* <Box component="img" src="..." alt="..." />
|
|
7
|
+
* <Box component="a" href="..." />
|
|
8
|
+
*/
|
|
9
|
+
import MuiBox from '@mui/material/Box';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
// Re-export using MUI's own component type
|
|
12
|
+
const Box = MuiBox;
|
|
13
|
+
export type BoxProps = React.ComponentProps<typeof Box>;
|
|
14
|
+
(Box as any).displayName = 'Gui.Box';
|
|
15
|
+
export default Box;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// src/gui/primitives/Button/Button.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Button from './Button';
|
|
4
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
5
|
+
import Link from '../Link/Link';
|
|
6
|
+
import type { RegistryEntry } from '@/gui/registry/types';
|
|
7
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
8
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
9
|
+
/**
|
|
10
|
+
* Declarative spec for Button.
|
|
11
|
+
* This is the JSON-friendly shape your renderer/LLM can emit.
|
|
12
|
+
*/
|
|
13
|
+
type ButtonSpec = {
|
|
14
|
+
type: 'Button';
|
|
15
|
+
props?: {
|
|
16
|
+
// Content
|
|
17
|
+
label?: string; // convenience for children text
|
|
18
|
+
children?: React.ReactNode; // optional explicit children
|
|
19
|
+
// Visual
|
|
20
|
+
variant?: 'text' | 'outlined' | 'contained';
|
|
21
|
+
color?: 'inherit' | 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error';
|
|
22
|
+
size?: 'small' | 'medium' | 'large';
|
|
23
|
+
startIcon?: React.ReactNode | string;
|
|
24
|
+
endIcon?: React.ReactNode | string;
|
|
25
|
+
sx?: SxProps<Theme>;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
fullWidth?: boolean;
|
|
28
|
+
// Routing / polymorphism
|
|
29
|
+
external?: boolean | 'true' | 1; // if true → anchor + target/rel
|
|
30
|
+
href?: string; // for anchors
|
|
31
|
+
to?: string; // for routers
|
|
32
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
33
|
+
rel?: string;
|
|
34
|
+
component?: React.ElementType | string; // override polymorphic target (e.g., your Link)
|
|
35
|
+
as?: React.ElementType | string;
|
|
36
|
+
type?: 'button' | 'submit' | 'reset';
|
|
37
|
+
// You can extend with data-* attributes, id, className, etc.
|
|
38
|
+
id?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
'data-testid'?: string;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* ButtonResolver
|
|
47
|
+
* - Maps JSON-friendly spec → real <Button /> props.
|
|
48
|
+
* - Keeps MUI polymorphism intact. If `to` is provided and no `component`,
|
|
49
|
+
* it defaults to your primitives Link; if `external` is true, it uses an anchor safely.
|
|
50
|
+
*/
|
|
51
|
+
const ButtonResolver: RegistryEntry = {
|
|
52
|
+
type: 'Button',
|
|
53
|
+
resolve(spec: ButtonSpec) {
|
|
54
|
+
const p = spec.props ?? {};
|
|
55
|
+
// Decide component priority
|
|
56
|
+
const isExternal = p.external === true || p.external === 'true' || p.external === 1;
|
|
57
|
+
let component: React.ElementType | string | undefined =
|
|
58
|
+
p.component ?? p.as ?? (p.to ? Link : (p.href || isExternal) ? 'a' : undefined);
|
|
59
|
+
|
|
60
|
+
const routingProps: Record<string, any> = {};
|
|
61
|
+
if (component === Link && p.to) {
|
|
62
|
+
routingProps.to = p.to;
|
|
63
|
+
} else if (component === 'a') {
|
|
64
|
+
routingProps.href = p.href;
|
|
65
|
+
if (isExternal) {
|
|
66
|
+
routingProps.target = p.target ?? '_blank';
|
|
67
|
+
routingProps.rel = p.rel ?? 'noopener noreferrer';
|
|
68
|
+
} else {
|
|
69
|
+
if (p.target) routingProps.target = p.target;
|
|
70
|
+
if (p.rel) routingProps.rel = p.rel;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Children precedence: explicit children > label > fallback
|
|
75
|
+
const children = p.children ?? p.label ?? 'Button';
|
|
76
|
+
return (
|
|
77
|
+
<Button
|
|
78
|
+
{...(component ? { component } : {})}
|
|
79
|
+
variant={p.variant ?? 'text'}
|
|
80
|
+
color={p.color ?? 'inherit'}
|
|
81
|
+
size={p.size ?? 'medium'}
|
|
82
|
+
startIcon={
|
|
83
|
+
typeof p.startIcon === 'string' ? <Icon name={p.startIcon} /> : p.startIcon
|
|
84
|
+
}
|
|
85
|
+
endIcon={
|
|
86
|
+
typeof p.endIcon === 'string' ? <Icon name={p.endIcon} /> : p.endIcon
|
|
87
|
+
}
|
|
88
|
+
disabled={p.disabled}
|
|
89
|
+
fullWidth={p.fullWidth}
|
|
90
|
+
type={p.type}
|
|
91
|
+
sx={p.sx}
|
|
92
|
+
id={ensureNodeId('button', p.id)}
|
|
93
|
+
className={p.className}
|
|
94
|
+
data-testid={p['data-testid']}
|
|
95
|
+
{...routingProps}
|
|
96
|
+
>
|
|
97
|
+
{children}
|
|
98
|
+
</Button>
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default ButtonResolver;
|