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
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "this.gui",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.42",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/this.gui.cjs",
|
|
7
7
|
"module": "./dist/this.gui.es.js",
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"src"
|
|
26
27
|
],
|
|
27
28
|
"bin": {
|
|
28
29
|
"gui": "./dist/bin/cli.js"
|
package/src/GUI.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/GUI.tsx
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import ReactDOM from 'react-dom/client';
|
|
4
|
+
import { GuiProvider } from '../index';
|
|
5
|
+
import { QRouter } from '@/QRouter/QRouter';
|
|
6
|
+
|
|
7
|
+
export const GUI = ({ title = 'this.GUI', children }: { title?: string; children?: React.ReactNode }) => {
|
|
8
|
+
return (
|
|
9
|
+
<GuiProvider>
|
|
10
|
+
<QRouter>
|
|
11
|
+
<main style={{ padding: '2rem' }}>
|
|
12
|
+
<h1>{title}</h1>
|
|
13
|
+
{children ?? <p>Ready to render declarative GUI components.</p>}
|
|
14
|
+
</main>
|
|
15
|
+
</QRouter>
|
|
16
|
+
</GuiProvider>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// ✅ Register as a Web Component for HTML usage
|
|
21
|
+
if (typeof window !== 'undefined' && !customElements.get('gui-app')) {
|
|
22
|
+
customElements.define(
|
|
23
|
+
'gui-app',
|
|
24
|
+
class extends HTMLElement {
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
const mount = document.createElement('div');
|
|
27
|
+
this.appendChild(mount);
|
|
28
|
+
ReactDOM.createRoot(mount).render(<GUI />);
|
|
29
|
+
console.log('[GUI] <gui-app> mounted');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ✅ Auto-bootstrap if loaded directly (e.g., via <script src="this.gui.umd.js">)
|
|
36
|
+
if (typeof window !== 'undefined') {
|
|
37
|
+
window.addEventListener('DOMContentLoaded', () => {
|
|
38
|
+
const rootTag = document.querySelector('gui-app');
|
|
39
|
+
if (rootTag) return; // already handled by custom element
|
|
40
|
+
const auto = document.getElementById('root');
|
|
41
|
+
if (auto) {
|
|
42
|
+
ReactDOM.createRoot(auto).render(<GUI />);
|
|
43
|
+
console.log('[GUI] Auto-booted inside #root');
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React, { createContext, useContext, useState, ReactNode } from "react";
|
|
2
|
+
export type QuantumNode = {
|
|
3
|
+
path: string;
|
|
4
|
+
derivedAt: number;
|
|
5
|
+
active?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type QuantumRegistryContextType = {
|
|
9
|
+
nodes: QuantumNode[];
|
|
10
|
+
registerNode: (path: string) => void;
|
|
11
|
+
unregisterNode: (path: string) => void;
|
|
12
|
+
setActiveNode: (path: string) => void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const QuantumRegistryContext = createContext<QuantumRegistryContextType | undefined>(undefined);
|
|
16
|
+
export const QRegistryProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
|
|
17
|
+
const [nodes, setNodes] = useState<QuantumNode[]>([]);
|
|
18
|
+
const registerNode = (path: string) => {
|
|
19
|
+
setNodes((prev) => {
|
|
20
|
+
if (prev.find((n) => n.path === path)) return prev;
|
|
21
|
+
return [...prev, { path, derivedAt: Date.now(), active: false }];
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const unregisterNode = (path: string) => {
|
|
26
|
+
setNodes((prev) => prev.filter((n) => n.path !== path));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const setActiveNode = (path: string) => {
|
|
30
|
+
setNodes((prev) =>
|
|
31
|
+
prev.map((n) => ({
|
|
32
|
+
...n,
|
|
33
|
+
active: n.path === path,
|
|
34
|
+
}))
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<QuantumRegistryContext.Provider value={{ nodes, registerNode, unregisterNode, setActiveNode }}>
|
|
40
|
+
{children}
|
|
41
|
+
</QuantumRegistryContext.Provider>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const useQuantumRegistry = () => {
|
|
46
|
+
const context = useContext(QuantumRegistryContext);
|
|
47
|
+
if (!context) {
|
|
48
|
+
throw new Error("useQuantumRegistry must be used within a QRegistryProvider");
|
|
49
|
+
}
|
|
50
|
+
return context;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default QRegistryProvider;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { QRouter } from "./QRouter";
|
|
4
|
+
import { Link, Routes, Route } from "react-router-dom";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof QRouter> = {
|
|
7
|
+
title: "Routing/QRouter",
|
|
8
|
+
component: QRouter,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof QRouter>;
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
render: () => (
|
|
16
|
+
<QRouter>
|
|
17
|
+
<div style={{ padding: "2rem" }}>
|
|
18
|
+
<h2>🌀 QRouter Demo</h2>
|
|
19
|
+
<p>This story demonstrates dynamic quantum routing.</p>
|
|
20
|
+
<p>
|
|
21
|
+
Try navigating to <Link to="/hello">/hello</Link> or{" "}
|
|
22
|
+
<Link to="/world">/world</Link>.
|
|
23
|
+
</p>
|
|
24
|
+
<Routes>
|
|
25
|
+
<Route path="/hello" element={<div>Hello Quantum 🌐</div>} />
|
|
26
|
+
<Route path="/world" element={<div>World Quantum ⚛️</div>} />
|
|
27
|
+
</Routes>
|
|
28
|
+
</div>
|
|
29
|
+
</QRouter>
|
|
30
|
+
),
|
|
31
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { createContext, useContext, useMemo, useState, ReactNode } from "react";
|
|
2
|
+
import { BrowserRouter, useInRouterContext } from "react-router-dom";
|
|
3
|
+
type QuantumNode = { id: string; path: string; element: ReactNode; derived?: boolean };
|
|
4
|
+
type LinkObject = { href: string; rel?: string; label?: string };
|
|
5
|
+
type QRouterContextValue = {
|
|
6
|
+
nodes: QuantumNode[];
|
|
7
|
+
addNode: (node: QuantumNode) => void;
|
|
8
|
+
deriveRoute: (path: string) => void;
|
|
9
|
+
registerLinks: (links: LinkObject[]) => void;
|
|
10
|
+
};
|
|
11
|
+
const QRouterContext = createContext<QRouterContextValue | null>(null);
|
|
12
|
+
export const useQRouter = () => {
|
|
13
|
+
const ctx = useContext(QRouterContext);
|
|
14
|
+
if (!ctx) throw new Error("useQRouter must be used within QRouter");
|
|
15
|
+
return ctx;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const QRouter: React.FC<{ children?: ReactNode }> = ({ children }) => {
|
|
19
|
+
const [nodes, setNodes] = useState<QuantumNode[]>(() => [
|
|
20
|
+
{ id: "__default_root__", path: "/", element: <div style={{ padding: 16 }}>🏠 Home</div> },
|
|
21
|
+
]);
|
|
22
|
+
const [links, setLinks] = useState<LinkObject[]>([]);
|
|
23
|
+
const inRouter = useInRouterContext(); // detecta si ya existe un router activo
|
|
24
|
+
|
|
25
|
+
const addNode = (node: QuantumNode) =>
|
|
26
|
+
setNodes((prev) => {
|
|
27
|
+
const idx = prev.findIndex((n) => n.path === node.path);
|
|
28
|
+
if (idx === -1) return [...prev, node];
|
|
29
|
+
const next = prev.slice();
|
|
30
|
+
// Override by path (the app should be able to replace the default root route)
|
|
31
|
+
next[idx] = { ...prev[idx], ...node };
|
|
32
|
+
return next;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const deriveRoute = (path: string) => {
|
|
36
|
+
if (path === "/") return; // never overwrite root
|
|
37
|
+
const id = path.replace(/\//g, "_") || "root";
|
|
38
|
+
addNode({ id, path, element: <div style={{ padding: 16 }}>✨ Quantum derived: {path}</div>, derived: true });
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const registerLinks = (newLinks: LinkObject[]) => {
|
|
42
|
+
setLinks((prev) => {
|
|
43
|
+
const existing = new Set(prev.map((l) => l.href));
|
|
44
|
+
const filtered = newLinks.filter((l) => !existing.has(l.href));
|
|
45
|
+
return [...prev, ...filtered];
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const value = useMemo(() => ({ nodes, addNode, deriveRoute, registerLinks }), [nodes]);
|
|
50
|
+
|
|
51
|
+
const Inner = <QRouterContext.Provider value={value}>{children}</QRouterContext.Provider>;
|
|
52
|
+
|
|
53
|
+
// 🧩 Si ya hay router, úsalo. Si no, crea uno.
|
|
54
|
+
return inRouter ? Inner : <BrowserRouter>{Inner}</BrowserRouter>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default QRouter;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/themes/GuiProvider.tsx
|
|
2
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { generatePaletteCssVars } from './utils/themeUtils';
|
|
4
|
+
import { ThemeContext } from '@/gui/contexts/ThemeContext';
|
|
5
|
+
import { ThemeProvider, CssBaseline } from '@mui/material';
|
|
6
|
+
import type { Theme } from '@mui/material/styles';
|
|
7
|
+
import { themeTokens } from '@/gui/Theme/styles/theme.tokens';
|
|
8
|
+
import { usePersistentThemeId, usePersistentThemeMode } from './utils/persistence';
|
|
9
|
+
import { makeMuiTheme } from '@/gui/Theme/fromTokens';
|
|
10
|
+
import { GuiThemes, getGuiTheme } from './utils/catalog';
|
|
11
|
+
import { InsetsProvider, useInsetsContext } from '@/gui/contexts/InsetsContext';
|
|
12
|
+
// -------------------------------- Types --------------------------------
|
|
13
|
+
import type {
|
|
14
|
+
GuiContextValue,
|
|
15
|
+
} from '@/types/theme';
|
|
16
|
+
export type GuiProviderProps = {
|
|
17
|
+
initialThemeId?: string;
|
|
18
|
+
initialMode?: 'light' | 'dark'; // <-- añadido
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function GuiProvider({
|
|
23
|
+
initialThemeId = 'neurons.me',
|
|
24
|
+
initialMode = 'light', // default
|
|
25
|
+
children,
|
|
26
|
+
}: GuiProviderProps) {
|
|
27
|
+
// Persist last chosen `themeId`
|
|
28
|
+
const [themeId, setThemeId] = usePersistentThemeId(initialThemeId);
|
|
29
|
+
// Persist last chosen `mode`
|
|
30
|
+
const [mode, setModeState] = usePersistentThemeMode(initialMode);
|
|
31
|
+
// Resolve manifest for current themeId (the GuiTheme which contains both modes)
|
|
32
|
+
const manifest = useMemo(() => {
|
|
33
|
+
return getGuiTheme(themeId) ?? GuiThemes[0];
|
|
34
|
+
}, [themeId]);
|
|
35
|
+
// Expose an `active` object for convenience (manifest + current selected mode)
|
|
36
|
+
const active = useMemo(() => {
|
|
37
|
+
return {
|
|
38
|
+
...(manifest ?? {}),
|
|
39
|
+
mode,
|
|
40
|
+
} as (typeof manifest & { mode: 'light' | 'dark' });
|
|
41
|
+
}, [manifest, mode]);
|
|
42
|
+
// Build MUI themes for both dark and light using the manifest's mode tokens.
|
|
43
|
+
// IMPORTANT: makeMuiTheme signature assumed: makeMuiTheme(baseTokens, modeTokens, mode)
|
|
44
|
+
const { mode: manifestModes } = manifest || ({} as any);
|
|
45
|
+
const lightMuiTheme = useMemo<Theme>(() => {
|
|
46
|
+
const lightTokens = manifestModes?.light ?? {};
|
|
47
|
+
return makeMuiTheme(themeTokens, lightTokens, 'light');
|
|
48
|
+
}, [manifestModes]);
|
|
49
|
+
const darkMuiTheme = useMemo<Theme>(() => {
|
|
50
|
+
const darkTokens = manifestModes?.dark ?? {};
|
|
51
|
+
return makeMuiTheme(themeTokens, darkTokens, 'dark');
|
|
52
|
+
}, [manifestModes]);
|
|
53
|
+
const theme = mode === 'dark' ? darkMuiTheme : lightMuiTheme;
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
generatePaletteCssVars(theme);
|
|
56
|
+
}, [theme]);
|
|
57
|
+
// Ensure saved key is valid with the current catalog
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (GuiThemes.length === 0) return;
|
|
60
|
+
const ok = GuiThemes.some((e) => e.themeId === themeId);
|
|
61
|
+
if (!ok) setThemeId(GuiThemes[0].themeId ?? '');
|
|
62
|
+
}, [themeId, setThemeId]);
|
|
63
|
+
// API for changing mode without touching themeId
|
|
64
|
+
const setMode = (nextMode: 'light' | 'dark') => {
|
|
65
|
+
setModeState(nextMode);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const toggleMode = () => setModeState((m) => (m === 'dark' ? 'light' : 'dark'));
|
|
69
|
+
const ctxValue: GuiContextValue = useMemo(
|
|
70
|
+
() => ({
|
|
71
|
+
themeId: manifest?.themeId ?? '',
|
|
72
|
+
setThemeId,
|
|
73
|
+
themeName: manifest?.themeName ?? '',
|
|
74
|
+
mode,
|
|
75
|
+
setMode,
|
|
76
|
+
toggleMode,
|
|
77
|
+
}),
|
|
78
|
+
[manifest?.themeId, manifest?.themeName, mode, setThemeId]
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<InsetsProvider>
|
|
83
|
+
<GuiThemeBridge theme={theme} ctxValue={ctxValue}>
|
|
84
|
+
{children}
|
|
85
|
+
</GuiThemeBridge>
|
|
86
|
+
</InsetsProvider>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const GuiThemeBridge: React.FC<{ theme: Theme; ctxValue: GuiContextValue; children?: React.ReactNode }> = ({ theme, ctxValue, children }) => {
|
|
91
|
+
const { insets, updateInsets } = useInsetsContext();
|
|
92
|
+
const themeWithInsets = useMemo(() => {
|
|
93
|
+
return {
|
|
94
|
+
...theme,
|
|
95
|
+
layout: {
|
|
96
|
+
...(theme as any).layout,
|
|
97
|
+
insets,
|
|
98
|
+
},
|
|
99
|
+
updateInsets,
|
|
100
|
+
} as Theme & { layout: any; updateInsets: typeof updateInsets };
|
|
101
|
+
}, [insets, theme, updateInsets]);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<ThemeProvider theme={themeWithInsets}>
|
|
105
|
+
<CssBaseline />
|
|
106
|
+
<ThemeContext.Provider value={ctxValue}>{children}</ThemeContext.Provider>
|
|
107
|
+
</ThemeProvider>
|
|
108
|
+
);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default GuiProvider;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
3
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
4
|
+
|
|
5
|
+
export type IconSpec = {
|
|
6
|
+
type: 'Icon';
|
|
7
|
+
props: {
|
|
8
|
+
name: string;
|
|
9
|
+
fill?: number;
|
|
10
|
+
weight?: number;
|
|
11
|
+
grade?: number;
|
|
12
|
+
opticalSize?: number;
|
|
13
|
+
fontSize?: number | string;
|
|
14
|
+
iconColor?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
[key: string]: any; // permite pasar props adicionales
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const IconResolver: RegistryEntry = {
|
|
22
|
+
type: 'Icon',
|
|
23
|
+
resolve(spec: IconSpec, _ctx?: ResolveCtx) {
|
|
24
|
+
const p = spec.props ?? {};
|
|
25
|
+
return <Icon {...p} />;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default IconResolver;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import 'material-symbols';
|
|
4
|
+
|
|
5
|
+
export type IconProps = {
|
|
6
|
+
name: string; // e.g., 'material:home'
|
|
7
|
+
iconColor?: string; // CSS color value
|
|
8
|
+
fontSize?: number | string; // optional font size
|
|
9
|
+
weight?: number; // font variation setting
|
|
10
|
+
fill?: number; // font variation setting (0 = outlined, 1 = filled)
|
|
11
|
+
grade?: number;
|
|
12
|
+
opticalSize?: number;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default function Icon({
|
|
18
|
+
name,
|
|
19
|
+
iconColor,
|
|
20
|
+
fontSize,
|
|
21
|
+
weight = 400,
|
|
22
|
+
fill = 0,
|
|
23
|
+
grade = 0,
|
|
24
|
+
opticalSize = 24,
|
|
25
|
+
className,
|
|
26
|
+
style,
|
|
27
|
+
}: IconProps) {
|
|
28
|
+
const iconName = name;
|
|
29
|
+
const variationSettings = `"FILL" ${fill}, "wght" ${weight}, "GRAD" ${grade}, "opsz" ${opticalSize}`;
|
|
30
|
+
return (
|
|
31
|
+
<span
|
|
32
|
+
className={clsx('material-symbols-rounded', className)}
|
|
33
|
+
style={{
|
|
34
|
+
fontVariationSettings: variationSettings,
|
|
35
|
+
color: iconColor,
|
|
36
|
+
fontSize,
|
|
37
|
+
...style,
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{iconName}
|
|
41
|
+
</span>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import Layout from '@/gui/Theme/Layout/Layout/Layout';
|
|
4
|
+
import Box from '@/gui/atoms/Box/Box';
|
|
5
|
+
import Typography from '@/gui/atoms/Typography/Typography';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Layout> = {
|
|
8
|
+
title: 'Layout/Content/Content',
|
|
9
|
+
component: Layout,
|
|
10
|
+
parameters: { layout: 'fullscreen' },
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
interface DemoContentProps {
|
|
15
|
+
text: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const DemoContent: React.FC<DemoContentProps> = ({ text }) => (
|
|
19
|
+
<Box
|
|
20
|
+
sx={{
|
|
21
|
+
minHeight: '100vh',
|
|
22
|
+
display: 'flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
bgcolor: 'background.default',
|
|
26
|
+
color: 'text.primary',
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<Typography variant="h4">{text}</Typography>
|
|
30
|
+
</Box>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const Template = (args: React.ComponentProps<typeof Layout>): React.JSX.Element => (
|
|
34
|
+
<Layout {...args}>
|
|
35
|
+
<DemoContent text="This is the Content area" />
|
|
36
|
+
</Layout>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
type Story = StoryObj<typeof Layout>;
|
|
40
|
+
|
|
41
|
+
export const OnlyContent: Story = {
|
|
42
|
+
render: Template,
|
|
43
|
+
args: {
|
|
44
|
+
topBarConfig: false,
|
|
45
|
+
leftSidebarConfig: false,
|
|
46
|
+
rightSidebarConfig: false,
|
|
47
|
+
footerConfig: false,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const WithTopBar: Story = {
|
|
52
|
+
render: Template,
|
|
53
|
+
args: {
|
|
54
|
+
topBarConfig: { title: 'Top Bar Example' },
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const WithSidebars: Story = {
|
|
59
|
+
render: Template,
|
|
60
|
+
args: {
|
|
61
|
+
leftSidebarConfig: { initialView: 'expanded' },
|
|
62
|
+
rightSidebarConfig: { initialView: 'expanded' },
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const WithTopBarAndSidebars: Story = {
|
|
67
|
+
render: Template,
|
|
68
|
+
args: {
|
|
69
|
+
topBarConfig: { title: 'Top Bar Example' },
|
|
70
|
+
leftSidebarConfig: { initialView: 'rail' },
|
|
71
|
+
rightSidebarConfig: { initialView: 'expanded' },
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const FullLayout: Story = {
|
|
76
|
+
render: Template,
|
|
77
|
+
args: {
|
|
78
|
+
topBarConfig: { title: 'Full Layout' },
|
|
79
|
+
leftSidebarConfig: { initialView: 'rail' },
|
|
80
|
+
rightSidebarConfig: { initialView: 'rail' },
|
|
81
|
+
footerConfig: {
|
|
82
|
+
brandLabel: 'neurons.me',
|
|
83
|
+
position: 'static',
|
|
84
|
+
leftElements: [{ type: 'link', props: { label: 'Docs', href: '/docs' } }],
|
|
85
|
+
rightElements: [{ type: 'link', props: { label: 'GitHub', href: 'https://github.com/neurons-me' } }],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@/gui/components/atoms';
|
|
3
|
+
import { useInsets } from '@/gui/hooks';
|
|
4
|
+
import type { ContentProps } from './Content.types';
|
|
5
|
+
|
|
6
|
+
const Content: React.FC<ContentProps> = ({ children }) => {
|
|
7
|
+
const insets = useInsets();
|
|
8
|
+
const safeTop = Math.max(0, Number(insets?.top ?? 0));
|
|
9
|
+
const navHeight = Math.max(0, Number(insets?.nav ?? 0));
|
|
10
|
+
const topInset = safeTop + navHeight;
|
|
11
|
+
const bottomInset = Math.max(0, Number(insets?.bottom ?? 0));
|
|
12
|
+
const leftInset = Math.max(0, Number(insets?.left ?? 0));
|
|
13
|
+
const rightInset = Math.max(0, Number(insets?.right ?? 0));
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Box
|
|
17
|
+
id="content"
|
|
18
|
+
component="main"
|
|
19
|
+
sx={{
|
|
20
|
+
position: 'relative',
|
|
21
|
+
flex: 1,
|
|
22
|
+
display: 'flex',
|
|
23
|
+
flexDirection: 'column',
|
|
24
|
+
minHeight: 0,
|
|
25
|
+
width: '100%',
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
paddingTop: `${topInset}px`,
|
|
28
|
+
paddingBottom: `${bottomInset}px`,
|
|
29
|
+
paddingLeft: `${leftInset}px`,
|
|
30
|
+
paddingRight: `${rightInset}px`,
|
|
31
|
+
boxSizing: 'border-box',
|
|
32
|
+
backgroundColor: 'background.default',
|
|
33
|
+
transition: 'padding 0.3s ease',
|
|
34
|
+
}}
|
|
35
|
+
>
|
|
36
|
+
<Box
|
|
37
|
+
sx={{
|
|
38
|
+
flex: 1,
|
|
39
|
+
minHeight: 0,
|
|
40
|
+
width: '100%',
|
|
41
|
+
display: 'flex',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
overflowY: 'auto',
|
|
44
|
+
overflowX: 'hidden',
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</Box>
|
|
49
|
+
</Box>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default Content;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
3
|
+
|
|
4
|
+
export type ContentSection = {
|
|
5
|
+
type: string;
|
|
6
|
+
props?: Record<string, any>;
|
|
7
|
+
children?: ContentSection[];
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface ContentProps {
|
|
11
|
+
/**
|
|
12
|
+
* Array of layout sections or components to render within the Content area.
|
|
13
|
+
*/
|
|
14
|
+
sections?: ContentSection[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Optional unique identifier.
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Custom CSS class name for additional styling.
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Optional style overrides for the main container.
|
|
28
|
+
*/
|
|
29
|
+
sx?: SxProps<Theme>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Optional data-testid for testing purposes.
|
|
33
|
+
*/
|
|
34
|
+
'data-testid'?: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Optional React children that can be rendered directly.
|
|
38
|
+
*/
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { RegistryEntry } from '@/gui/registry/types';
|
|
3
|
+
import Footer from './Footer';
|
|
4
|
+
import type { FooterElement } from './Footer.types';
|
|
5
|
+
|
|
6
|
+
type FooterSpec = {
|
|
7
|
+
type: 'Footer';
|
|
8
|
+
props?: {
|
|
9
|
+
brandLabel?: string;
|
|
10
|
+
brandLogo?: string;
|
|
11
|
+
brandHref?: string;
|
|
12
|
+
leftElements?: FooterElement[];
|
|
13
|
+
centerElements?: FooterElement[];
|
|
14
|
+
rightElements?: FooterElement[];
|
|
15
|
+
position?: 'static' | 'fixed' | 'sticky';
|
|
16
|
+
elevation?: number;
|
|
17
|
+
className?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const FooterResolver: RegistryEntry = {
|
|
24
|
+
type: 'Footer',
|
|
25
|
+
resolve(spec: FooterSpec) {
|
|
26
|
+
const props = spec.props ?? {};
|
|
27
|
+
return (
|
|
28
|
+
<Footer
|
|
29
|
+
brandLabel={props.brandLabel}
|
|
30
|
+
brandLogo={props.brandLogo}
|
|
31
|
+
brandHref={props.brandHref}
|
|
32
|
+
leftElements={props.leftElements}
|
|
33
|
+
centerElements={props.centerElements}
|
|
34
|
+
rightElements={props.rightElements}
|
|
35
|
+
position={props.position}
|
|
36
|
+
elevation={props.elevation}
|
|
37
|
+
className={props.className}
|
|
38
|
+
id={props.id}
|
|
39
|
+
data-testid={props['data-testid']}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default FooterResolver;
|