this.gui 1.3.41 → 1.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/GUI.tsx +46 -0
- package/src/QRouter/QRegistry.tsx +53 -0
- package/src/QRouter/QRouter.stories.tsx +31 -0
- package/src/QRouter/QRouter.tsx +57 -0
- package/src/gui/Theme/GuiProvider.tsx +111 -0
- package/src/gui/Theme/Icon/Icon.resolver.tsx +29 -0
- package/src/gui/Theme/Icon/Icon.tsx +43 -0
- package/src/gui/Theme/Layout/Content/Content.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Content/Content.stories.tsx +88 -0
- package/src/gui/Theme/Layout/Content/Content.tsx +53 -0
- package/src/gui/Theme/Layout/Content/Content.types.tsx +40 -0
- package/src/gui/Theme/Layout/Footer/Footer.resolver.tsx +45 -0
- package/src/gui/Theme/Layout/Footer/Footer.stories.tsx +205 -0
- package/src/gui/Theme/Layout/Footer/Footer.tsx +337 -0
- package/src/gui/Theme/Layout/Footer/Footer.types.ts +40 -0
- package/src/gui/Theme/Layout/Layout/Layout.resolver.tsx +37 -0
- package/src/gui/Theme/Layout/Layout/Layout.stories.tsx +289 -0
- package/src/gui/Theme/Layout/Layout/Layout.tsx +117 -0
- package/src/gui/Theme/Layout/Layout/Layout.types.ts +57 -0
- package/src/gui/Theme/Layout/Layout/useLayoutBreakpoints.ts +9 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.stories.tsx +105 -0
- package/src/gui/Theme/Layout/Namespace/Namespace.tsx +26 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.resolver.tsx +87 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.stories.tsx +199 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.tsx +311 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/LeftSidebar.types.ts +41 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/SidebarToggleButton.tsx +53 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.resolver.tsx +19 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarAction/LeftSidebarAction.tsx +107 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.resolver.tsx +0 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.tsx +134 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarLink/LeftSidebarLink.types.ts +15 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarMenu/LeftSidebarMenu.tsx +142 -0
- package/src/gui/Theme/Layout/Sidebars/LeftSidebar/components/LeftSidebarToggleButton/LeftSidebarToggleButton.tsx +23 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.resolver.tsx +35 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.stories.tsx +239 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.tsx +319 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/RightSidebar.types.ts +17 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarAction/RightSidebarAction.tsx +102 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarLink/RightSidebarLink.tsx +132 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarMenu/RightSidebarMenu.tsx +140 -0
- package/src/gui/Theme/Layout/Sidebars/RightSidebar/components/RightSidebarToggleButton/RightSidebarToggleButton.tsx +22 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.stories.tsx +469 -0
- package/src/gui/Theme/Layout/StickyOptions/StickyOptionsTop.tsx +489 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.resolver.tsx +86 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.stories.tsx +350 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.tsx +292 -0
- package/src/gui/Theme/Layout/TopBar/TopBar.types.ts +39 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.stories.tsx +83 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.tsx +18 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarAction/TopBarAction.types.ts +4 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.stories.tsx +189 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.tsx +30 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarLink/TopBarLink.types.ts +9 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.resolver.tsx +14 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.stories.tsx +56 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.tsx +123 -0
- package/src/gui/Theme/Layout/TopBar/components/TopBarMenu/TopBarMenu.types.ts +44 -0
- package/src/gui/Theme/catalog/CherryByte/CherryByte.png +0 -0
- package/src/gui/Theme/catalog/CherryByte/dark.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/CherryByte/manifest.ts +24 -0
- package/src/gui/Theme/catalog/GhostShell/dark.tokens.ts +43 -0
- package/src/gui/Theme/catalog/GhostShell/ghost.png +0 -0
- package/src/gui/Theme/catalog/GhostShell/light.tokens.ts +39 -0
- package/src/gui/Theme/catalog/GhostShell/manifest.ts +24 -0
- package/src/gui/Theme/catalog/LunaHex/LunaHex.png +0 -0
- package/src/gui/Theme/catalog/LunaHex/dark.tokens.ts +34 -0
- package/src/gui/Theme/catalog/LunaHex/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/LunaHex/manifest.ts +24 -0
- package/src/gui/Theme/catalog/MUI/MUI.png +0 -0
- package/src/gui/Theme/catalog/MUI/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/MUI/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/MUI/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/dark.tokens.ts +48 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/manifest.ts +24 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/prince.png +0 -0
- package/src/gui/Theme/catalog/PrinceOfDarkness/princeOfDarkness.png +0 -0
- package/src/gui/Theme/catalog/Seafoam/dark.tokens.ts +49 -0
- package/src/gui/Theme/catalog/Seafoam/light.tokens.ts +47 -0
- package/src/gui/Theme/catalog/Seafoam/manifest.ts +24 -0
- package/src/gui/Theme/catalog/Seafoam/seaFoam.png +0 -0
- package/src/gui/Theme/catalog/neurons/dark.tokens.ts +58 -0
- package/src/gui/Theme/catalog/neurons/light.tokens.ts +74 -0
- package/src/gui/Theme/catalog/neurons/manifest.ts +24 -0
- package/src/gui/Theme/catalog/neurons/neurons.me.png +0 -0
- package/src/gui/Theme/fromTokens.ts +272 -0
- package/src/gui/Theme/gui.css +31 -0
- package/src/gui/Theme/index.ts +17 -0
- package/src/gui/Theme/styles/buildShadows.ts +83 -0
- package/src/gui/Theme/styles/theme.tokens.ts +108 -0
- package/src/gui/Theme/utils/catalog.ts +61 -0
- package/src/gui/Theme/utils/persistence.ts +66 -0
- package/src/gui/Theme/utils/themeUtils.ts +34 -0
- package/src/gui/components/atoms/AppBar/AppBar.resolver.tsx +46 -0
- package/src/gui/components/atoms/AppBar/AppBar.stories.tsx +251 -0
- package/src/gui/components/atoms/AppBar/AppBar.tsx +107 -0
- package/src/gui/components/atoms/AppBar/AppBar.types.ts +28 -0
- package/src/gui/components/atoms/Avatar/Avatar.resolver.tsx +61 -0
- package/src/gui/components/atoms/Avatar/Avatar.stories.tsx +36 -0
- package/src/gui/components/atoms/Avatar/Avatar.tsx +14 -0
- package/src/gui/components/atoms/Box/Box.resolver.tsx +171 -0
- package/src/gui/components/atoms/Box/Box.stories.tsx +263 -0
- package/src/gui/components/atoms/Box/Box.tsx +15 -0
- package/src/gui/components/atoms/Button/Button.resolver.tsx +103 -0
- package/src/gui/components/atoms/Button/Button.stories.tsx +219 -0
- package/src/gui/components/atoms/Button/Button.tsx +40 -0
- package/src/gui/components/atoms/Card/Card.resolver.tsx +63 -0
- package/src/gui/components/atoms/Card/Card.stories.tsx +54 -0
- package/src/gui/components/atoms/Card/Card.tsx +13 -0
- package/src/gui/components/atoms/CardActions/CardActions.resolver.tsx +59 -0
- package/src/gui/components/atoms/CardActions/CardActions.stories.tsx +32 -0
- package/src/gui/components/atoms/CardActions/CardActions.tsx +14 -0
- package/src/gui/components/atoms/CardContent/CardContent.resolver.tsx +60 -0
- package/src/gui/components/atoms/CardContent/CardContent.stories.tsx +34 -0
- package/src/gui/components/atoms/CardContent/CardContent.tsx +13 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.resolver.tsx +68 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.stories.tsx +40 -0
- package/src/gui/components/atoms/CardHeader/CardHeader.tsx +12 -0
- package/src/gui/components/atoms/Collapse/Collapse.resolver.tsx +85 -0
- package/src/gui/components/atoms/Collapse/Collapse.stories.tsx +130 -0
- package/src/gui/components/atoms/Collapse/Collapse.tsx +17 -0
- package/src/gui/components/atoms/Divider/Divider.resolver.tsx +95 -0
- package/src/gui/components/atoms/Divider/Divider.stories.tsx +108 -0
- package/src/gui/components/atoms/Divider/Divider.tsx +14 -0
- package/src/gui/components/atoms/Drawer/Drawer.resolver.tsx +116 -0
- package/src/gui/components/atoms/Drawer/Drawer.stories.tsx +223 -0
- package/src/gui/components/atoms/Drawer/Drawer.tsx +25 -0
- package/src/gui/components/atoms/Grid/Grid.resolver.tsx +33 -0
- package/src/gui/components/atoms/Grid/Grid.stories.tsx +136 -0
- package/src/gui/components/atoms/Grid/Grid.tsx +15 -0
- package/src/gui/components/atoms/Grid/Grid.types.ts +9 -0
- package/src/gui/components/atoms/IconButton/IconButton.resolver.tsx +137 -0
- package/src/gui/components/atoms/IconButton/IconButton.stories.tsx +134 -0
- package/src/gui/components/atoms/IconButton/IconButton.tsx +22 -0
- package/src/gui/components/atoms/Link/Link.resolver.tsx +74 -0
- package/src/gui/components/atoms/Link/Link.stories.tsx +157 -0
- package/src/gui/components/atoms/Link/Link.tsx +36 -0
- package/src/gui/components/atoms/List/List.resolver.tsx +94 -0
- package/src/gui/components/atoms/List/List.stories.tsx +137 -0
- package/src/gui/components/atoms/List/List.tsx +20 -0
- package/src/gui/components/atoms/ListItem/ListItem.resolver.tsx +88 -0
- package/src/gui/components/atoms/ListItem/ListItem.stories.tsx +151 -0
- package/src/gui/components/atoms/ListItem/ListItem.tsx +19 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.resolver.tsx +214 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.stories.tsx +155 -0
- package/src/gui/components/atoms/ListItemButton/ListItemButton.tsx +15 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.resolver.tsx +102 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.stories.tsx +132 -0
- package/src/gui/components/atoms/ListItemIcon/ListItemIcon.tsx +11 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.resolver.tsx +112 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.stories.tsx +156 -0
- package/src/gui/components/atoms/ListItemText/ListItemText.tsx +15 -0
- package/src/gui/components/atoms/Menu/Menu.resolver.tsx +112 -0
- package/src/gui/components/atoms/Menu/Menu.stories.tsx +162 -0
- package/src/gui/components/atoms/Menu/Menu.tsx +17 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.resolver.tsx +183 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.stories.tsx +134 -0
- package/src/gui/components/atoms/MenuItem/MenuItem.tsx +14 -0
- package/src/gui/components/atoms/Paper/Paper.resolver.tsx +98 -0
- package/src/gui/components/atoms/Paper/Paper.stories.tsx +184 -0
- package/src/gui/components/atoms/Paper/Paper.tsx +15 -0
- package/src/gui/components/atoms/Section/Section.resolver.tsx +10 -0
- package/src/gui/components/atoms/Section/Section.stories.tsx +189 -0
- package/src/gui/components/atoms/Section/Section.tsx +76 -0
- package/src/gui/components/atoms/Section/Section.types.tsx +24 -0
- package/src/gui/components/atoms/Stack/Stack.resolver.tsx +94 -0
- package/src/gui/components/atoms/Stack/Stack.stories.tsx +160 -0
- package/src/gui/components/atoms/Stack/Stack.tsx +15 -0
- package/src/gui/components/atoms/Surface/Surface.resolver.tsx +37 -0
- package/src/gui/components/atoms/Surface/Surface.tsx +49 -0
- package/src/gui/components/atoms/Surface/Surface.types.ts +20 -0
- package/src/gui/components/atoms/Switch/Switch.resolver.tsx +53 -0
- package/src/gui/components/atoms/Switch/Switch.stories.tsx +236 -0
- package/src/gui/components/atoms/Switch/Switch.tsx +22 -0
- package/src/gui/components/atoms/Table/Body/TableBody.tsx +7 -0
- package/src/gui/components/atoms/Table/Cell/TableCell.tsx +18 -0
- package/src/gui/components/atoms/Table/Head/TableHead.tsx +9 -0
- package/src/gui/components/atoms/Table/Row/TableRow.tsx +20 -0
- package/src/gui/components/atoms/Table/Table.resolver.tsx +77 -0
- package/src/gui/components/atoms/Table/Table.stories.tsx +173 -0
- package/src/gui/components/atoms/Table/Table.tsx +20 -0
- package/src/gui/components/atoms/TextField/TextField.stories.tsx +25 -0
- package/src/gui/components/atoms/TextField/TextField.tsx +15 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.resolver.tsx +60 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.stories.tsx +155 -0
- package/src/gui/components/atoms/Toolbar/Toolbar.tsx +16 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.resolver.tsx +142 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.stories.tsx +117 -0
- package/src/gui/components/atoms/Tooltip/Tooltip.tsx +70 -0
- package/src/gui/components/atoms/Typography/Typography.resolver.tsx +158 -0
- package/src/gui/components/atoms/Typography/Typography.stories.tsx +222 -0
- package/src/gui/components/atoms/Typography/Typography.tsx +27 -0
- package/src/gui/components/atoms/Window/Nodes/node.ts +0 -0
- package/src/gui/components/atoms/Window/code/block/node.tsx +0 -0
- package/src/gui/components/atoms/Window/code/hugging.face.api.ts +11 -0
- package/src/gui/components/atoms/Window/connectors/index.ts +19 -0
- package/src/gui/components/atoms/Window/window.stories.tsx +20 -0
- package/src/gui/components/atoms/Window/window.tsx +636 -0
- package/src/gui/components/atoms/atoms.tsx +151 -0
- package/src/gui/components/atoms/index.ts +2 -0
- package/src/gui/components/generics/Cards/Gridme.jsx +52 -0
- package/src/gui/components/generics/Cards/LilBox.jsx +65 -0
- package/src/gui/components/generics/Cards/ModuleCard.jsx +106 -0
- package/src/gui/components/generics/Chats/FullChatBot.jsx +223 -0
- package/src/gui/components/generics/Code/CodeBlock.jsx +33 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.stories.tsx +153 -0
- package/src/gui/components/generics/EmojiCursor/EmojiCursor.tsx +23 -0
- package/src/gui/components/generics/Feedback/Callout.jsx +92 -0
- package/src/gui/components/generics/Layout/GridX.jsx +29 -0
- package/src/gui/components/generics/Layout/Hero2.jsx +132 -0
- package/src/gui/components/generics/Layout/PageContainer.jsx +29 -0
- package/src/gui/components/generics/Layout/PageDivider.jsx +20 -0
- package/src/gui/components/generics/Layout/Section.jsx +43 -0
- package/src/gui/components/generics/Layout/SectionHeader.jsx +21 -0
- package/src/gui/components/generics/Media/Img.jsx +58 -0
- package/src/gui/components/generics/Media/VideoEmbed.jsx +51 -0
- package/src/gui/components/generics/Organization/TableOfContents.jsx +51 -0
- package/src/gui/components/generics/Organization/Tabs.jsx +45 -0
- package/src/gui/components/generics/Text/TextList.jsx +41 -0
- package/src/gui/components/generics/Text/TextParagraph.jsx +28 -0
- package/src/gui/components/generics/Text/TextQuote.jsx +23 -0
- package/src/gui/components/generics/Text/TextTitle.jsx +44 -0
- package/src/gui/components/molecules/Dialog/Dialog.stories.tsx +18 -0
- package/src/gui/components/molecules/Dialog/Dialog.tsx +5 -0
- package/src/gui/components/molecules/Hero/Hero.stories.tsx +140 -0
- package/src/gui/components/molecules/Hero/Hero.tsx +152 -0
- package/src/gui/components/molecules/Hero/Hero.types.tsx +18 -0
- package/src/gui/components/molecules/Modal/Modal.resolver.tsx +38 -0
- package/src/gui/components/molecules/Modal/Modal.stories.tsx +82 -0
- package/src/gui/components/molecules/Modal/Modal.tsx +110 -0
- package/src/gui/components/molecules/Modal/Modal.types.ts +29 -0
- package/src/gui/components/molecules/Page/Page.stories.tsx +135 -0
- package/src/gui/components/molecules/Page/Page.tsx +94 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.resolver.tsx +58 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.stories.tsx +133 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.tsx +101 -0
- package/src/gui/components/molecules/Theme/ThemeModeToggle/ThemeModeToggle.types.ts +29 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.resolver.tsx +15 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.stories.tsx +88 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.tsx +167 -0
- package/src/gui/components/molecules/Theme/ThemesCatalog/ThemesCatalog.types.ts +34 -0
- package/src/gui/components/molecules/molecules.ts +49 -0
- package/src/gui/components/organisms/Blockchain/Blocks/BlocksTable.tsx +119 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Identities.stories.tsx +20 -0
- package/src/gui/components/organisms/Blockchain/Usernames/QR.tsx +566 -0
- package/src/gui/components/organisms/Blockchain/Usernames/Usernames.tsx +448 -0
- package/src/gui/components/organisms/Blockchain/Usernames/identities.tsx +710 -0
- package/src/gui/components/organisms/Blockchain/blockchain.stories.tsx +17 -0
- package/src/gui/components/organisms/Blockchain/blockchain.tsx +368 -0
- package/src/gui/components/organisms/Blockchain/scripts/connection.ts +82 -0
- package/src/gui/components/organisms/Blockchain/scripts/match_face.ts +143 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.stories.tsx +168 -0
- package/src/gui/components/organisms/HighLighter/HighLighter.tsx +420 -0
- package/src/gui/components/organisms/HighLighter/HighLightsDrawer.tsx +197 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.stories.tsx +312 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/FaceRecognition.tsx +765 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceCameraPermission.ts +70 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceLandmarker.ts +106 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceOverlay.ts +489 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplate.ts +32 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/useFaceTemplateBurst.ts +178 -0
- package/src/gui/components/organisms/IdentityNoise/FaceRecognition/modules/verifyTemplate.ts +136 -0
- package/src/gui/components/organisms/IdentityNoise/IdentityNoise.tsx +403 -0
- package/src/gui/components/organisms/IdentityNoise/IndentityNoise.stories.tsx +15 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.stories.tsx +206 -0
- package/src/gui/components/organisms/IdentityNoise/Noise/Noise.tsx +394 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/QR.tsx +566 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Tiad.stories.tsx +6 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/Triad.tsx +917 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/handleCleak.ts +0 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/identity.ts +31 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/fundamentals/vectors/vectors.tsx +252 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.stories.tsx +314 -0
- package/src/gui/components/organisms/IdentityNoise/Triad/me/me.tsx +0 -0
- package/src/gui/components/organisms/organisms.ts +15 -0
- package/src/gui/contexts/InsetsContext.tsx +40 -0
- package/src/gui/contexts/LeftSidebarContext.tsx +20 -0
- package/src/gui/contexts/RightSidebarContext.tsx +25 -0
- package/src/gui/contexts/ThemeContext.ts +34 -0
- package/src/gui/contexts/index.ts +4 -0
- package/src/gui/hooks/index.ts +11 -0
- package/src/gui/hooks/resolveColorToken.ts +39 -0
- package/src/gui/hooks/useCodeGen.ts +12 -0
- package/src/gui/hooks/useGuiMediaQuery.ts +18 -0
- package/src/gui/hooks/useGuiTheme.ts +18 -0
- package/src/gui/hooks/useInsets.ts +26 -0
- package/src/gui/hooks/useIsMobile.ts +13 -0
- package/src/gui/hooks/useIsTouchDevice.ts +25 -0
- package/src/gui/hooks/useLeftSidebar.ts +10 -0
- package/src/gui/hooks/useRightSidebar.ts +12 -0
- package/src/gui/hooks/useViewportKey.ts +19 -0
- package/src/gui/hooks/useViewportProp.ts +17 -0
- package/src/gui/registry/GuiRegistry.ts +19 -0
- package/src/gui/registry/factory.ts +12 -0
- package/src/gui/registry/index.ts +3 -0
- package/src/gui/registry/types.ts +6 -0
- package/src/gui/utils/nodeID.ts +11 -0
- package/src/registry/GuiRegistry.ts +19 -0
- package/src/stories/01.Home.mdx +22 -0
- package/src/stories/02.Understanding.This.GUI.mdx +149 -0
- package/src/stories/Theme/Palette.stories.tsx +86 -0
- package/src/stories/Theme/ThemeViewer.stories.tsx +91 -0
- package/src/stories/Theme/Typography.stories.jsx +211 -0
- package/src/stories/assets/this.GUI.png +0 -0
- package/src/types/gui.d.ts +67 -0
- package/src/types/theme.d.ts +191 -0
- package/src/types/viewport.ts +132 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import Paper from './Paper';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Paper> = {
|
|
5
|
+
title: 'Atoms/Containers/Paper',
|
|
6
|
+
component: Paper,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<div style={{ padding: 16, minHeight: 240, background: 'var(--mui-palette-background-default)' }}>
|
|
11
|
+
<Story />
|
|
12
|
+
</div>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component: `
|
|
19
|
+
The **Paper** atom is a thin wrapper around MUI's \`MuiPaper\` that preserves **polymorphism** via the \`component\` prop and passes through all MUI props.
|
|
20
|
+
It integrates with **This.GUI** theming and supports **declarative specs** through the Paper resolver.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
## Features
|
|
24
|
+
- Variants: \`elevation\`, \`outlined\`
|
|
25
|
+
- Elevation: \`0..24\`
|
|
26
|
+
- \`square\` boolean
|
|
27
|
+
- **Polymorphic** via \`component\` (e.g., \`'div'\`, \`'section'\`, \`'a'\`)
|
|
28
|
+
- **Routing default** in declarative mode: if \`to\` is provided (and no explicit \`component\`), resolver renders This.GUI \`Link\`
|
|
29
|
+
- Full **system props** passthrough via \`sx\` (and regular MUI system props)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
## Basic usage
|
|
33
|
+
~~~jsx
|
|
34
|
+
import Paper from '@/gui/atoms/Paper/Paper';
|
|
35
|
+
|
|
36
|
+
<Paper elevation={2} sx={{ p: 2, borderRadius: 2 }}>
|
|
37
|
+
Content
|
|
38
|
+
</Paper>
|
|
39
|
+
~~~
|
|
40
|
+
|
|
41
|
+
## Polymorphic
|
|
42
|
+
~~~jsx
|
|
43
|
+
<Paper component="section" variant="outlined" sx={{ p: 2 }}>
|
|
44
|
+
I'm a <section>
|
|
45
|
+
</Paper>
|
|
46
|
+
|
|
47
|
+
<Paper component="a" href="/docs" sx={{ p: 2, textDecoration: 'none' }}>
|
|
48
|
+
Go to docs
|
|
49
|
+
</Paper>
|
|
50
|
+
~~~
|
|
51
|
+
|
|
52
|
+
*Note:* The \`component\` prop is demonstrated via dedicated stories (not Controls) because Storybook's args typing for MUI OverridableComponent can incorrectly narrow props and flag \`component\` as invalid in the Controls panel.
|
|
53
|
+
|
|
54
|
+
## Declarative JSON / Resolver
|
|
55
|
+
When using the registry-driven renderer, a Paper spec like this:
|
|
56
|
+
|
|
57
|
+
~~~json
|
|
58
|
+
{
|
|
59
|
+
"type": "Paper",
|
|
60
|
+
"props": {
|
|
61
|
+
"variant": "outlined",
|
|
62
|
+
"elevation": 0,
|
|
63
|
+
"component": "section",
|
|
64
|
+
"sx": { "p": 2, "borderRadius": 2 },
|
|
65
|
+
"children": "Content"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
~~~
|
|
69
|
+
|
|
70
|
+
**Routing (declarative default)** — If you provide \`to\` (and **omit** \`component\`), the resolver will render using This.GUI \`Link\`:
|
|
71
|
+
|
|
72
|
+
~~~json
|
|
73
|
+
{
|
|
74
|
+
"type": "Paper",
|
|
75
|
+
"props": {
|
|
76
|
+
"to": "/docs",
|
|
77
|
+
"sx": { "p": 2 },
|
|
78
|
+
"children": "Go to docs"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
~~~
|
|
82
|
+
|
|
83
|
+
The resolver:
|
|
84
|
+
- Chooses \`component\` by priority: explicit \`component\` → \`as\` → (\`to\` ⇒ This.GUI \`Link\`) → (\`external\` ⇒ \`'a'\`)
|
|
85
|
+
- For \`external: true\`, applies safe defaults: \`target="_blank"\`, \`rel="noopener noreferrer"\`
|
|
86
|
+
- Cleans resolver-only keys so they don't leak into the DOM
|
|
87
|
+
`,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
controls: {
|
|
91
|
+
exclude: ['component'],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
argTypes: {
|
|
95
|
+
variant: {
|
|
96
|
+
control: { type: 'radio' },
|
|
97
|
+
options: ['elevation', 'outlined'],
|
|
98
|
+
},
|
|
99
|
+
elevation: {
|
|
100
|
+
control: { type: 'range', min: 0, max: 24, step: 1 },
|
|
101
|
+
},
|
|
102
|
+
square: {
|
|
103
|
+
control: 'boolean',
|
|
104
|
+
},
|
|
105
|
+
sx: {
|
|
106
|
+
control: 'object',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
args: {
|
|
110
|
+
variant: 'elevation',
|
|
111
|
+
elevation: 1,
|
|
112
|
+
square: false,
|
|
113
|
+
children: 'Paper content',
|
|
114
|
+
sx: { p: 2 },
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default meta;
|
|
119
|
+
type Story = StoryObj<typeof Paper>;
|
|
120
|
+
|
|
121
|
+
// ======================= Stories =======================
|
|
122
|
+
export const Playground: Story = {};
|
|
123
|
+
|
|
124
|
+
export const Variants: Story = {
|
|
125
|
+
render: (args) => (
|
|
126
|
+
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
|
|
127
|
+
<Paper {...args} variant="elevation">Elevation (default)</Paper>
|
|
128
|
+
<Paper {...args} variant="outlined">Outlined</Paper>
|
|
129
|
+
</div>
|
|
130
|
+
),
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export const Elevations: Story = {
|
|
134
|
+
args: { variant: 'elevation' },
|
|
135
|
+
render: (args) => {
|
|
136
|
+
const levels = [0, 1, 2, 3, 4, 6, 8, 12, 16, 24];
|
|
137
|
+
return (
|
|
138
|
+
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(140px, 1fr))', gap: 12 }}>
|
|
139
|
+
{levels.map((e) => (
|
|
140
|
+
<Paper key={e} {...args} elevation={e} sx={{ p: 2 }}>
|
|
141
|
+
elevation={e}
|
|
142
|
+
</Paper>
|
|
143
|
+
))}
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const PolymorphicSection: Story = {
|
|
150
|
+
args: { variant: 'outlined', children: 'I render as <section>' },
|
|
151
|
+
render: (args) => (
|
|
152
|
+
<Paper {...args} component="section">
|
|
153
|
+
{args.children}
|
|
154
|
+
</Paper>
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export const PolymorphicAnchor: Story = {
|
|
159
|
+
args: { children: 'I render as <a href="/docs">', sx: { p: 2, textDecoration: 'none' } },
|
|
160
|
+
render: (args) => (
|
|
161
|
+
<Paper component="a" href="/docs" sx={args.sx}>
|
|
162
|
+
{args.children}
|
|
163
|
+
</Paper>
|
|
164
|
+
),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const WithSystemProps: Story = {
|
|
168
|
+
name: 'With system props',
|
|
169
|
+
args: { variant: 'outlined' },
|
|
170
|
+
render: (args) => (
|
|
171
|
+
<Paper {...args} sx={{ p: 2, m: 1, display: 'inline-block', borderRadius: 2 }}>
|
|
172
|
+
Padding, margin, display via system props.
|
|
173
|
+
</Paper>
|
|
174
|
+
),
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const WithSx: Story = {
|
|
178
|
+
args: { variant: 'outlined' },
|
|
179
|
+
render: (args) => (
|
|
180
|
+
<Paper {...args} sx={{ p: 2, borderRadius: 2, borderStyle: 'dashed' }}>
|
|
181
|
+
Custom \`sx\` styling (dashed outline).
|
|
182
|
+
</Paper>
|
|
183
|
+
),
|
|
184
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — Paper (polymorphic)
|
|
3
|
+
* Thin wrapper that preserves MUI's own typing and `component` API.
|
|
4
|
+
* Examples:
|
|
5
|
+
* <Paper elevation={3} />
|
|
6
|
+
* <Paper component="section" square variant="outlined" />
|
|
7
|
+
* <Paper component="a" href="/docs" />
|
|
8
|
+
*/
|
|
9
|
+
import MuiPaper from '@mui/material/Paper';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
// Re-export using MUI's own component type to keep polymorphism and full typing
|
|
12
|
+
const Paper = MuiPaper;
|
|
13
|
+
export type PaperProps = React.ComponentProps<typeof Paper>;
|
|
14
|
+
(Paper as any).displayName = 'Gui.Paper';
|
|
15
|
+
export default Paper;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Section from './Section';
|
|
2
|
+
import type { SectionProps } from './Section.types';
|
|
3
|
+
|
|
4
|
+
export const SectionResolver = {
|
|
5
|
+
type: 'Section',
|
|
6
|
+
component: Section,
|
|
7
|
+
resolve: (props: SectionProps) => <Section {...props} />,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default SectionResolver;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Section, Typography, Box, Button } from '@/gui/components/atoms';
|
|
3
|
+
|
|
4
|
+
// ======================= Meta =======================
|
|
5
|
+
const meta: Meta<typeof Section> = {
|
|
6
|
+
title: 'Atoms/Containers/Section',
|
|
7
|
+
component: Section,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div style={{ padding: 0, minHeight: 400 }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: `
|
|
20
|
+
The **Section** atom is a responsive container designed to create consistent layout sections that respect This.GUI’s **layout insets** and **theme palette**.
|
|
21
|
+
|
|
22
|
+
It supports theming via the \`section\` palette keys (\`default\`, \`subtle\`, \`strong\`) and allows custom background colors for flexibility.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
## Features
|
|
26
|
+
- Reacts to global layout insets for responsive spacing.
|
|
27
|
+
- Provides unified paddings with theme scaling.
|
|
28
|
+
- Accepts **custom backgroundColor**, or one from \`theme.palette.section\`.
|
|
29
|
+
- Supports responsive padding, height, and alignment.
|
|
30
|
+
- Can wrap any children content.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
## Margin Props
|
|
34
|
+
Section supports **margin props** for controlling the outer spacing around the section:
|
|
35
|
+
|
|
36
|
+
- \`marginTop\`
|
|
37
|
+
- \`marginBottom\`
|
|
38
|
+
- \`marginLeft\`
|
|
39
|
+
- \`marginRight\`
|
|
40
|
+
|
|
41
|
+
Each of these can be a \`number\`, \`string\`, or a **breakpoint object** (e.g. \`{ xs: 2, sm: 4, md: 6 }\`) for responsive margins.
|
|
42
|
+
|
|
43
|
+
If not provided, Section will use the layout insets as fallback margins to ensure consistent spacing with the overall layout.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
## Key Props
|
|
47
|
+
- \`colorVariant?: 'default' | 'subtle' | 'strong'\` — Selects section background color from theme.
|
|
48
|
+
- \`bgcolor?: string\` — Overrides the background with a custom color.
|
|
49
|
+
- \`padding?: number | string | object\` — Adjusts inner spacing responsively.
|
|
50
|
+
- \`height?: number | string\` — Sets the vertical height.
|
|
51
|
+
- \`sx?: object\` — MUI system style overrides.
|
|
52
|
+
- \`marginTop?: number | string | object\`
|
|
53
|
+
- \`marginBottom?: number | string | object\`
|
|
54
|
+
- \`marginLeft?: number | string | object\`
|
|
55
|
+
- \`marginRight?: number | string | object\`
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
## Basic usage (React)
|
|
59
|
+
~~~tsx
|
|
60
|
+
import { Section, Typography } from '@/gui/atoms';
|
|
61
|
+
|
|
62
|
+
<Section colorVariant="default" padding={4}>
|
|
63
|
+
<Typography variant="h4">Welcome</Typography>
|
|
64
|
+
<Typography>Section content goes here.</Typography>
|
|
65
|
+
</Section>
|
|
66
|
+
|
|
67
|
+
// Example with margin props
|
|
68
|
+
<Section colorVariant="subtle" padding={4} marginTop={2} marginBottom={3}>
|
|
69
|
+
<Typography variant="h5">Section with Margins</Typography>
|
|
70
|
+
<Typography>Section content with custom top and bottom margins.</Typography>
|
|
71
|
+
</Section>
|
|
72
|
+
~~~
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
## Declarative JSON / Config usage
|
|
76
|
+
~~~json
|
|
77
|
+
{
|
|
78
|
+
"type": "Section",
|
|
79
|
+
"props": {
|
|
80
|
+
"colorVariant": "subtle",
|
|
81
|
+
"padding": 4,
|
|
82
|
+
"marginTop": 2,
|
|
83
|
+
"marginBottom": 3,
|
|
84
|
+
"children": [
|
|
85
|
+
{ "type": "Typography", "props": { "variant": "h5", "children": "Hello world" } },
|
|
86
|
+
{ "type": "Typography", "props": { "children": "This is a declarative section example." } }
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
~~~
|
|
91
|
+
`,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
argTypes: {
|
|
96
|
+
colorVariant: {
|
|
97
|
+
control: { type: 'select' },
|
|
98
|
+
options: ['default', 'subtle', 'strong'],
|
|
99
|
+
description: 'Predefined section variant based on theme.palette.section',
|
|
100
|
+
},
|
|
101
|
+
bgcolor: { control: 'color', description: 'Custom background color override' },
|
|
102
|
+
padding: { control: { type: 'number' }, description: 'Internal padding' },
|
|
103
|
+
height: { control: { type: 'text' }, description: 'Height (px, %, vh, etc.)' },
|
|
104
|
+
},
|
|
105
|
+
args: {
|
|
106
|
+
colorVariant: 'default',
|
|
107
|
+
padding: 4,
|
|
108
|
+
height: 'auto',
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
export default meta;
|
|
112
|
+
|
|
113
|
+
type Story = StoryObj<typeof Section>;
|
|
114
|
+
|
|
115
|
+
// ======================= Stories =======================
|
|
116
|
+
|
|
117
|
+
export const Playground: Story = {
|
|
118
|
+
render: (args) => (
|
|
119
|
+
<Section {...args}>
|
|
120
|
+
<Typography variant="h5" sx={{ mb: 1 }}>Playground Section</Typography>
|
|
121
|
+
<Typography variant="body2">Easily tweak padding, background, and height.</Typography>
|
|
122
|
+
</Section>
|
|
123
|
+
),
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const Variants: Story = {
|
|
127
|
+
render: (args) => (
|
|
128
|
+
<Box sx={{ display: 'grid', gap: 2 }}>
|
|
129
|
+
{(['default', 'subtle', 'strong'] as const).map((variant) => (
|
|
130
|
+
<Section key={variant} {...args} colorVariant={variant} padding={3}>
|
|
131
|
+
<Typography variant="subtitle1">colorVariant = {variant}</Typography>
|
|
132
|
+
<Typography variant="body2">
|
|
133
|
+
This uses <code>theme.palette.section.{variant}</code>
|
|
134
|
+
</Typography>
|
|
135
|
+
</Section>
|
|
136
|
+
))}
|
|
137
|
+
</Box>
|
|
138
|
+
),
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
export const CustomBackground: Story = {
|
|
142
|
+
args: { padding: 4, bgcolor: '#2fb0a3ff' },
|
|
143
|
+
render: (args) => (
|
|
144
|
+
<Section {...args}>
|
|
145
|
+
<Typography variant="h6" sx={{ color: 'text.primary' }}>
|
|
146
|
+
Custom background color
|
|
147
|
+
</Typography>
|
|
148
|
+
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
|
|
149
|
+
You can set <code>bgcolor</code> manually for any theme or design, and it will maintain good contrast for both light and dark text.
|
|
150
|
+
</Typography>
|
|
151
|
+
</Section>
|
|
152
|
+
),
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const WithContentComposition: Story = {
|
|
156
|
+
render: () => (
|
|
157
|
+
<Section colorVariant="default" padding={4}>
|
|
158
|
+
<Typography variant="h5" sx={{ mb: 1 }}>Section with Composition</Typography>
|
|
159
|
+
<Box display="flex" gap={2}>
|
|
160
|
+
<Button variant="contained" color="primary">Accept</Button>
|
|
161
|
+
<Button variant="outlined" color="secondary">Cancel</Button>
|
|
162
|
+
</Box>
|
|
163
|
+
</Section>
|
|
164
|
+
),
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const ResponsivePadding: Story = {
|
|
168
|
+
args: { padding: { xs: 2, sm: 4, md: 6 } },
|
|
169
|
+
render: (args) => (
|
|
170
|
+
<Section {...args}>
|
|
171
|
+
<Typography variant="h5">Responsive Padding</Typography>
|
|
172
|
+
<Typography variant="body2">
|
|
173
|
+
Resize the viewport to see the padding adjust responsively.
|
|
174
|
+
</Typography>
|
|
175
|
+
</Section>
|
|
176
|
+
),
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
export const ResponsiveMargins: Story = {
|
|
180
|
+
args: { marginTop: { xs: 1, sm: 2, md: 4 }, marginBottom: { xs: 1, sm: 3, md: 5 } },
|
|
181
|
+
render: (args) => (
|
|
182
|
+
<Section {...args} padding={3}>
|
|
183
|
+
<Typography variant="h5">Responsive Margins</Typography>
|
|
184
|
+
<Typography variant="body2">
|
|
185
|
+
Adjusts top and bottom margins responsively across breakpoints.
|
|
186
|
+
</Typography>
|
|
187
|
+
</Section>
|
|
188
|
+
),
|
|
189
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@/gui/components/atoms';
|
|
3
|
+
import { useInsets, useGuiTheme } from '@/gui/hooks';
|
|
4
|
+
import type { SectionProps } from './Section.types';
|
|
5
|
+
|
|
6
|
+
const Section: React.FC<SectionProps> = ({
|
|
7
|
+
children,
|
|
8
|
+
sx,
|
|
9
|
+
maxWidth = '100%',
|
|
10
|
+
component = 'section',
|
|
11
|
+
bgcolor,
|
|
12
|
+
colorVariant,
|
|
13
|
+
padding,
|
|
14
|
+
height,
|
|
15
|
+
marginTop,
|
|
16
|
+
marginBottom,
|
|
17
|
+
marginLeft,
|
|
18
|
+
marginRight,
|
|
19
|
+
}) => {
|
|
20
|
+
const insets = useInsets();
|
|
21
|
+
const theme = useGuiTheme();
|
|
22
|
+
// Determine if bgcolor is a theme token or raw color
|
|
23
|
+
// We check if bgcolor matches a key path in theme.palette or if it is a raw color string
|
|
24
|
+
const isThemeToken = (color: string) => {
|
|
25
|
+
if (!color) return false;
|
|
26
|
+
// Simple heuristic: theme tokens contain dot notation or match keys in palette
|
|
27
|
+
if (color.includes('.')) {
|
|
28
|
+
const parts = color.split('.');
|
|
29
|
+
let obj: any = theme.palette;
|
|
30
|
+
for (const part of parts) {
|
|
31
|
+
if (obj && part in obj) {
|
|
32
|
+
obj = obj[part];
|
|
33
|
+
} else {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return color in theme.palette;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
let finalBgcolor: string | undefined;
|
|
43
|
+
if (bgcolor) {
|
|
44
|
+
finalBgcolor = isThemeToken(bgcolor) ? bgcolor : bgcolor;
|
|
45
|
+
} else if (colorVariant && theme.palette.section && colorVariant in theme.palette.section) {
|
|
46
|
+
finalBgcolor = theme.palette.section[colorVariant];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Box
|
|
51
|
+
component={component}
|
|
52
|
+
sx={{
|
|
53
|
+
// Responsive width/height: fill viewport, but margin aligns with insets
|
|
54
|
+
width: `calc(100vw - ${insets.left + insets.right}px)`,
|
|
55
|
+
height: height ? height : `calc(100vh - ${insets.top + insets.bottom}px)`,
|
|
56
|
+
marginTop: marginTop !== undefined ? marginTop : insets.top,
|
|
57
|
+
marginBottom: marginBottom !== undefined ? marginBottom : insets.bottom,
|
|
58
|
+
marginLeft: marginLeft !== undefined ? marginLeft : insets.left,
|
|
59
|
+
marginRight: marginRight !== undefined ? marginRight : insets.right,
|
|
60
|
+
maxWidth,
|
|
61
|
+
// Responsive internal padding
|
|
62
|
+
padding: padding !== undefined ? padding : {
|
|
63
|
+
xs: 2,
|
|
64
|
+
sm: 3,
|
|
65
|
+
md: 4,
|
|
66
|
+
},
|
|
67
|
+
...(finalBgcolor ? { bgcolor: finalBgcolor } : {}),
|
|
68
|
+
...sx,
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
{children}
|
|
72
|
+
</Box>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default Section;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
import { SxProps } from '@mui/system';
|
|
4
|
+
|
|
5
|
+
export interface SectionProps {
|
|
6
|
+
id?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
colorVariant?: keyof Theme['palette']['section'];
|
|
10
|
+
bgcolor?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
component?: React.ElementType;
|
|
13
|
+
elevation?: number;
|
|
14
|
+
padded?: boolean;
|
|
15
|
+
centered?: boolean;
|
|
16
|
+
'data-testid'?: string;
|
|
17
|
+
maxWidth?: number | string;
|
|
18
|
+
padding?: number | string | Record<string, any>;
|
|
19
|
+
height?: number | string;
|
|
20
|
+
marginTop?: number | string | Record<string, any>;
|
|
21
|
+
marginBottom?: number | string | Record<string, any>;
|
|
22
|
+
marginLeft?: number | string | Record<string, any>;
|
|
23
|
+
marginRight?: number | string | Record<string, any>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/gui/atoms/Stack/Stack.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Stack from './Stack';
|
|
4
|
+
import Link from '@/gui/atoms/Link/Link';
|
|
5
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
6
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
7
|
+
/**
|
|
8
|
+
* Declarative spec for Stack (layout primitive)
|
|
9
|
+
*
|
|
10
|
+
* Notes
|
|
11
|
+
* - Choose the rendered element via `component` (e.g. 'div', 'section', 'a', custom).
|
|
12
|
+
* - If `to` is provided (and no explicit component), the resolver will default to This.GUI `Link`.
|
|
13
|
+
* - If `external` is true (and no explicit component), it will default to an anchor (`'a'`) and apply
|
|
14
|
+
* safe `target`/`rel` defaults.
|
|
15
|
+
* - Common Stack props (direction, spacing, divider, alignItems, justifyContent, useFlexGap, flexWrap, etc.) are passed through.
|
|
16
|
+
*/
|
|
17
|
+
export type StackSpec = {
|
|
18
|
+
type: 'Stack';
|
|
19
|
+
props?: {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
// Polymorphism / routing
|
|
22
|
+
component?: any; // 'div' | 'section' | 'a' | Link | custom
|
|
23
|
+
as?: any; // alias for component
|
|
24
|
+
to?: string; // router target (when component={Link})
|
|
25
|
+
href?: string; // anchor target (when component='a')
|
|
26
|
+
external?: boolean; // force external anchor
|
|
27
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
28
|
+
rel?: string;
|
|
29
|
+
// Core Stack props (subset; rest is passthrough)
|
|
30
|
+
direction?: 'row' | 'row-reverse' | 'column' | 'column-reverse';
|
|
31
|
+
spacing?: number | string;
|
|
32
|
+
divider?: React.ReactNode;
|
|
33
|
+
useFlexGap?: boolean;
|
|
34
|
+
alignItems?: React.CSSProperties['alignItems'];
|
|
35
|
+
justifyContent?: React.CSSProperties['justifyContent'];
|
|
36
|
+
flexWrap?: React.CSSProperties['flexWrap'];
|
|
37
|
+
// Styling & misc
|
|
38
|
+
sx?: any;
|
|
39
|
+
className?: string;
|
|
40
|
+
id?: string;
|
|
41
|
+
'data-testid'?: string;
|
|
42
|
+
// Allow system props / arbitrary passthrough
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const StackResolver: RegistryEntry = {
|
|
48
|
+
type: 'Stack',
|
|
49
|
+
resolve(spec: StackSpec, _ctx?: ResolveCtx) {
|
|
50
|
+
const p = spec.props ?? {};
|
|
51
|
+
const nodeId = ensureNodeId('Stack', p.id);
|
|
52
|
+
// Decide polymorphic target
|
|
53
|
+
const component = p.component ?? p.as ?? (p.to ? Link : p.external ? 'a' : undefined);
|
|
54
|
+
// Routing/anchor props
|
|
55
|
+
const routingProps =
|
|
56
|
+
component === 'a' || p.external
|
|
57
|
+
? {
|
|
58
|
+
href: p.href,
|
|
59
|
+
target: p.target ?? (p.external ? '_blank' : undefined),
|
|
60
|
+
rel: p.rel ?? (p.external ? 'noopener noreferrer' : undefined),
|
|
61
|
+
}
|
|
62
|
+
: component === Link || (p.to && !p.component)
|
|
63
|
+
? { to: p.to }
|
|
64
|
+
: {};
|
|
65
|
+
// Collect common props and avoid leaking resolver-only keys
|
|
66
|
+
const {
|
|
67
|
+
children,
|
|
68
|
+
as: _as,
|
|
69
|
+
external: _external,
|
|
70
|
+
to: _to,
|
|
71
|
+
href: _href,
|
|
72
|
+
target: _target,
|
|
73
|
+
rel: _rel,
|
|
74
|
+
id: _id,
|
|
75
|
+
'data-testid': _dataTestId,
|
|
76
|
+
...rest
|
|
77
|
+
} = p;
|
|
78
|
+
return (
|
|
79
|
+
<Stack
|
|
80
|
+
component={component}
|
|
81
|
+
sx={p.sx}
|
|
82
|
+
id={nodeId}
|
|
83
|
+
className={p.className}
|
|
84
|
+
data-testid={p['data-testid']}
|
|
85
|
+
{...routingProps}
|
|
86
|
+
{...rest}
|
|
87
|
+
>
|
|
88
|
+
{children}
|
|
89
|
+
</Stack>
|
|
90
|
+
);
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export default StackResolver;
|