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,108 @@
|
|
|
1
|
+
//themes/styles/theme.tokens.ts
|
|
2
|
+
export const themeTokens = {
|
|
3
|
+
description: "Unified base design tokens for This.GUI — used as foundation for all themes and modes.",
|
|
4
|
+
radius: {
|
|
5
|
+
md: {
|
|
6
|
+
type: "radius",
|
|
7
|
+
value: "10px"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
spacing: {
|
|
11
|
+
base: {
|
|
12
|
+
type: "spacing",
|
|
13
|
+
value: "8"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
border: {
|
|
17
|
+
default: {
|
|
18
|
+
type: "color",
|
|
19
|
+
value: "rgba(0, 0, 0, 0.08)"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
font: {
|
|
23
|
+
family: {
|
|
24
|
+
type: "fontFamily",
|
|
25
|
+
value: "Roboto, sans-serif"
|
|
26
|
+
},
|
|
27
|
+
weightBold: {
|
|
28
|
+
type: "fontWeight",
|
|
29
|
+
value: "700"
|
|
30
|
+
},
|
|
31
|
+
weightSemibold: {
|
|
32
|
+
type: "fontWeight",
|
|
33
|
+
value: "600"
|
|
34
|
+
},
|
|
35
|
+
sizeBase: {
|
|
36
|
+
type: "fontSize",
|
|
37
|
+
value: "16"
|
|
38
|
+
},
|
|
39
|
+
letterTight: {
|
|
40
|
+
type: "letterSpacing",
|
|
41
|
+
value: "-0.01em"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
color: {
|
|
45
|
+
description: "Extended semantic colors, gradients, overlays",
|
|
46
|
+
success: { type: "color", value: "#4caf50" },
|
|
47
|
+
warning: { type: "color", value: "#ff9800" },
|
|
48
|
+
error: { type: "color", value: "#f44336" },
|
|
49
|
+
info: { type: "color", value: "#2196f3" },
|
|
50
|
+
gradientPrimary: { type: "gradient", value: "linear-gradient(135deg, #00aa96 0%, #008c7d 100%)" }
|
|
51
|
+
},
|
|
52
|
+
insets: {
|
|
53
|
+
description: "Offsets reserved for permanent drawers",
|
|
54
|
+
type: "object",
|
|
55
|
+
left: {
|
|
56
|
+
type: "size",
|
|
57
|
+
value: "0px"
|
|
58
|
+
},
|
|
59
|
+
right: {
|
|
60
|
+
type: "size",
|
|
61
|
+
value: "0px"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
shadows: {
|
|
65
|
+
description: "Consistent elevation levels, AR/3D ready",
|
|
66
|
+
sm: { type: "shadow", value: "0px 1px 2px rgba(0, 0, 0, 0.05)" },
|
|
67
|
+
md: { type: "shadow", value: "0px 3px 6px rgba(0, 0, 0, 0.1)" },
|
|
68
|
+
lg: { type: "shadow", value: "0px 8px 16px rgba(0, 0, 0, 0.15)" }
|
|
69
|
+
},
|
|
70
|
+
zIndex: {
|
|
71
|
+
description: "Advanced layering control",
|
|
72
|
+
nav: { type: "number", value: 1100 },
|
|
73
|
+
modal: { type: "number", value: 1300 },
|
|
74
|
+
tooltip: { type: "number", value: 1500 }
|
|
75
|
+
},
|
|
76
|
+
breakpoints: {
|
|
77
|
+
description: "Declarative responsive interfaces",
|
|
78
|
+
xs: { type: "breakpoint", value: "0px" },
|
|
79
|
+
sm: { type: "breakpoint", value: "600px" },
|
|
80
|
+
md: { type: "breakpoint", value: "900px" },
|
|
81
|
+
lg: { type: "breakpoint", value: "1200px" },
|
|
82
|
+
xl: { type: "breakpoint", value: "1536px" }
|
|
83
|
+
},
|
|
84
|
+
motion: {
|
|
85
|
+
description: "Animation and transition tokens",
|
|
86
|
+
durationFast: { type: "duration", value: "150ms" },
|
|
87
|
+
durationBase: { type: "duration", value: "300ms" },
|
|
88
|
+
easingStandard: { type: "easing", value: "cubic-bezier(0.4, 0, 0.2, 1)" }
|
|
89
|
+
},
|
|
90
|
+
opacity: {
|
|
91
|
+
description: "Universal interaction effects",
|
|
92
|
+
disabled: { type: "opacity", value: "0.38" },
|
|
93
|
+
hover: { type: "opacity", value: "0.08" },
|
|
94
|
+
focus: { type: "opacity", value: "0.12" }
|
|
95
|
+
},
|
|
96
|
+
icon: {
|
|
97
|
+
description: "Scalable icon sizes for generated GUIs",
|
|
98
|
+
sm: { type: "size", value: "16px" },
|
|
99
|
+
md: { type: "size", value: "24px" },
|
|
100
|
+
lg: { type: "size", value: "32px" }
|
|
101
|
+
},
|
|
102
|
+
lineHeight: {
|
|
103
|
+
description: "Better typographic control",
|
|
104
|
+
tight: { type: "lineHeight", value: "1.1" },
|
|
105
|
+
base: { type: "lineHeight", value: "1.5" },
|
|
106
|
+
relaxed: { type: "lineHeight", value: "1.75" }
|
|
107
|
+
}
|
|
108
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/themes/catalog/catalog.ts
|
|
2
|
+
// A collection of theme manifests
|
|
3
|
+
// and their associated modes (light/dark) with token paths.
|
|
4
|
+
// It also provides utility functions to access and manipulate the theme catalog.
|
|
5
|
+
import neuronsManifest from '../catalog/neurons/manifest';
|
|
6
|
+
import ghostShellManifest from '../catalog/GhostShell/manifest';
|
|
7
|
+
import PrinceOfDarknessManifest from '../catalog/PrinceOfDarkness/manifest';
|
|
8
|
+
import muiManifest from '../catalog/MUI/manifest';
|
|
9
|
+
import lunaManifest from '../catalog/LunaHex/manifest';
|
|
10
|
+
import cherryByteManifest from '../catalog/CherryByte/manifest';
|
|
11
|
+
import SeafoamManifest from '../catalog/Seafoam/manifest';
|
|
12
|
+
import { FlatGuiTheme } from '@/types/theme'; //definiciones de tipos
|
|
13
|
+
export const GuiThemes = [neuronsManifest, ghostShellManifest, PrinceOfDarknessManifest, muiManifest, lunaManifest, cherryByteManifest, SeafoamManifest];
|
|
14
|
+
/*
|
|
15
|
+
FlatGuiThemes (plano)
|
|
16
|
+
• Es un array plano de modos individuales.
|
|
17
|
+
• Cada GuiTheme en esta lista representa una única combinación de:
|
|
18
|
+
• themeId
|
|
19
|
+
• themeName
|
|
20
|
+
• mode (light o dark)
|
|
21
|
+
• tokens
|
|
22
|
+
• manifest
|
|
23
|
+
• Esto es útil para renderizar selects, listas visuales, previews, etc.
|
|
24
|
+
*/
|
|
25
|
+
export const FlatGuiThemes = GuiThemes.flatMap((manifest) => {
|
|
26
|
+
return (['light', 'dark'] as const).flatMap((mode) => {
|
|
27
|
+
return [{
|
|
28
|
+
themeId: manifest.themeId ?? '',
|
|
29
|
+
themeName: manifest.themeName ?? '',
|
|
30
|
+
description: manifest.description,
|
|
31
|
+
author: manifest.author,
|
|
32
|
+
version: manifest.version,
|
|
33
|
+
license: manifest.license,
|
|
34
|
+
homepage: manifest.homepage,
|
|
35
|
+
tags: manifest.tags,
|
|
36
|
+
createdAt: manifest.createdAt,
|
|
37
|
+
updatedAt: manifest.updatedAt,
|
|
38
|
+
badgeUrl: manifest.badgeUrl,
|
|
39
|
+
mode,
|
|
40
|
+
// Si los tokens ya están cargados/resueltos en este punto:
|
|
41
|
+
tokens: manifest.mode?.[mode] ?? {},
|
|
42
|
+
}];
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
/*
|
|
46
|
+
• Representa la colección de temas, donde cada tema tiene dos modos (light y dark).
|
|
47
|
+
• Es decir, el theme completo, tal como viene en el manifest.*/
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export function getGuiThemes() {
|
|
51
|
+
return GuiThemes;
|
|
52
|
+
}
|
|
53
|
+
export function getGuiTheme(themeId: string) {
|
|
54
|
+
return GuiThemes.find(theme => theme.themeId === themeId);
|
|
55
|
+
}
|
|
56
|
+
export function getFlatGuiThemes(): FlatGuiTheme[] {
|
|
57
|
+
return FlatGuiThemes;
|
|
58
|
+
}
|
|
59
|
+
export function getFlatGuiTheme(themeId: string, mode: 'light' | 'dark') {
|
|
60
|
+
return FlatGuiThemes.find(theme => theme.themeId === themeId && theme.mode === mode);
|
|
61
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//src/themes/utils/persistence.ts
|
|
2
|
+
// Utility to persist user's themeId using localStorage.
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves the initial themeId from localStorage.
|
|
6
|
+
* Falls back to the provided default if not found or on error.
|
|
7
|
+
*
|
|
8
|
+
* @param fallback - The fallback themeId to use if none is stored.
|
|
9
|
+
* @returns The stored themeId or the fallback value.
|
|
10
|
+
*/
|
|
11
|
+
export function getInitialThemeId(fallback: string): string {
|
|
12
|
+
try {
|
|
13
|
+
return localStorage.getItem('this.gui:themeId') || fallback;
|
|
14
|
+
} catch {
|
|
15
|
+
return fallback;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* React hook to persist and manage the themeId using localStorage.
|
|
20
|
+
* Returns a [themeId, setThemeId] tuple just like useState.
|
|
21
|
+
*
|
|
22
|
+
* @param fallback - The fallback themeId if no previous value is stored.
|
|
23
|
+
* @returns A tuple [themeId, setThemeId] that syncs with localStorage.
|
|
24
|
+
*/
|
|
25
|
+
export function usePersistentThemeId(
|
|
26
|
+
fallback: string
|
|
27
|
+
): [string, React.Dispatch<React.SetStateAction<string>>] {
|
|
28
|
+
const [themeId, setThemeId] = useState<string>(() => getInitialThemeId(fallback));
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
try {
|
|
31
|
+
localStorage.setItem('this.gui:themeId', themeId);
|
|
32
|
+
} catch {
|
|
33
|
+
// fail silently
|
|
34
|
+
}
|
|
35
|
+
}, [themeId]);
|
|
36
|
+
return [themeId, setThemeId];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* React hook to persist and manage the theme mode (light/dark) using localStorage.
|
|
41
|
+
* Returns a [mode, setMode] tuple just like useState.
|
|
42
|
+
*
|
|
43
|
+
* @param fallback - The fallback mode if no previous value is stored.
|
|
44
|
+
* @returns A tuple [mode, setMode] that syncs with localStorage.
|
|
45
|
+
*/
|
|
46
|
+
export function usePersistentThemeMode(
|
|
47
|
+
fallback: 'light' | 'dark'
|
|
48
|
+
): ['light' | 'dark', React.Dispatch<React.SetStateAction<'light' | 'dark'>>] {
|
|
49
|
+
const [mode, setMode] = useState<'light' | 'dark'>(() => {
|
|
50
|
+
try {
|
|
51
|
+
const stored = localStorage.getItem('this.gui:themeMode');
|
|
52
|
+
if (stored === 'dark' || stored === 'light') return stored;
|
|
53
|
+
return fallback;
|
|
54
|
+
} catch {
|
|
55
|
+
return fallback;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
try {
|
|
60
|
+
localStorage.setItem('this.gui:themeMode', mode);
|
|
61
|
+
} catch {
|
|
62
|
+
// fail silently
|
|
63
|
+
}
|
|
64
|
+
}, [mode]);
|
|
65
|
+
return [mode, setMode];
|
|
66
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//src/themes/utils/themeUtils.ts
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
export type Insets = { left: number; right: number; top: number; bottom: number };
|
|
4
|
+
// Helper to get CSS variable from theme
|
|
5
|
+
export const getCssVar = (theme: Theme, name: string) => {
|
|
6
|
+
return getComputedStyle(document.documentElement).getPropertyValue(`--${name}`) || theme.palette?.[name as keyof typeof theme.palette];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// Generates a string of CSS custom properties based on theme.palette
|
|
10
|
+
export const generatePaletteCssVars = (theme: Theme, prefix = '--palette') => {
|
|
11
|
+
const cssVars: Record<string, string> = {};
|
|
12
|
+
Object.entries(theme.palette).forEach(([key, value]) => {
|
|
13
|
+
if (!value || typeof value === 'function') return;
|
|
14
|
+
if (typeof value === 'object') {
|
|
15
|
+
Object.entries(value).forEach(([subKey, subVal]) => {
|
|
16
|
+
const varName = `${prefix}-${key}-${subKey}`;
|
|
17
|
+
cssVars[varName] = String(subVal);
|
|
18
|
+
});
|
|
19
|
+
} else {
|
|
20
|
+
const varName = `${prefix}-${key}`;
|
|
21
|
+
cssVars[varName] = String(value);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return cssVars;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// Appends generated CSS variables to the document root
|
|
28
|
+
export const applyThemeCssVars = (theme: Theme) => {
|
|
29
|
+
const cssVars = generatePaletteCssVars(theme);
|
|
30
|
+
const root = document.documentElement;
|
|
31
|
+
Object.entries(cssVars).forEach(([key, val]) => {
|
|
32
|
+
root.style.setProperty(key, val);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
// (types not needed in resolver)
|
|
3
|
+
import AppBar from './AppBar';
|
|
4
|
+
import type { RegistryEntry } from '@/gui/registry/types';
|
|
5
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
6
|
+
import type { AppBarResolverSpec as AppBarSpec } from './AppBar.types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* AppBarResolver
|
|
10
|
+
* - Maps a JSON-friendly spec to <AppBar /> props.
|
|
11
|
+
* - Keeps MUI polymorphism intact (`component` passthrough).
|
|
12
|
+
* - Allows `sx`, ids and className for styling & targeting.
|
|
13
|
+
*/
|
|
14
|
+
const AppBarResolver: RegistryEntry = {
|
|
15
|
+
type: 'AppBar',
|
|
16
|
+
resolve(spec: AppBarSpec) {
|
|
17
|
+
const p = spec.props ?? {};
|
|
18
|
+
const variant = typeof (p as any).variant === 'string' ? (p as any).variant : 'mui';
|
|
19
|
+
const rootProps: any = {
|
|
20
|
+
// semantic preset
|
|
21
|
+
variant,
|
|
22
|
+
|
|
23
|
+
// defaults depend on variant
|
|
24
|
+
position: p.position ?? (variant === 'glass' ? 'fixed' : 'fixed'),
|
|
25
|
+
color: p.color ?? (variant === 'glass' ? 'transparent' : 'default'),
|
|
26
|
+
elevation: p.elevation ?? (variant === 'glass' ? 0 : undefined),
|
|
27
|
+
enableColorOnDark: p.enableColorOnDark,
|
|
28
|
+
sx: p.sx,
|
|
29
|
+
id: ensureNodeId('appbar', p.id),
|
|
30
|
+
className: p.className,
|
|
31
|
+
'data-testid': p['data-testid'],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
if (p.component) {
|
|
35
|
+
rootProps.component = p.component;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<AppBar {...rootProps}>
|
|
40
|
+
{p.children}
|
|
41
|
+
</AppBar>
|
|
42
|
+
);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default AppBarResolver;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AppBar, Toolbar, Typography, Box, Button } from '@/gui/components/atoms';
|
|
3
|
+
|
|
4
|
+
// ======================= Meta =======================
|
|
5
|
+
const meta: Meta<typeof AppBar> = {
|
|
6
|
+
title: 'Atoms/Containers/AppBar',
|
|
7
|
+
component: AppBar,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [
|
|
10
|
+
(Story) => (
|
|
11
|
+
<div style={{ padding: 0, minHeight: 240 }}>
|
|
12
|
+
<Story />
|
|
13
|
+
</div>
|
|
14
|
+
),
|
|
15
|
+
],
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: `
|
|
20
|
+
The **AppBar** atom is a thin wrapper around MUI's \`AppBar\` that keeps the original API while letting you style it with \`sx\` and use it declaratively through the **resolver**.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
## Features
|
|
24
|
+
- Positions: \`fixed\`, \`absolute\`, \`sticky\`, \`static\`, \`relative\`.
|
|
25
|
+
- Colors: \`default\`, \`inherit\`, \`primary\`, \`secondary\`, \`transparent\`. AppBar **only supports** these colors for the \`color\` prop.
|
|
26
|
+
- Note: \`success\`, \`info\`, \`warning\`, and \`error\` are **not supported** by the \`color\` prop. Use \`sx={{ bgcolor: '...' }}\` for these colors.
|
|
27
|
+
- Additional theme colors can be applied via \`sx={{ bgcolor: 'success.main' }}\` etc.
|
|
28
|
+
- Elevation & dark-mode override with \`enableColorOnDark\`.
|
|
29
|
+
- Accepts any children (e.g., \`<Toolbar/>\`, actions, brand, etc.).
|
|
30
|
+
- Fully themeable via **This.GUI** tokens and \`sx\`.
|
|
31
|
+
- Variant semantic presets: \`mui\` (default) behaves like MUI AppBar, \`glass\` for floating blurred panel style.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
## Key Props
|
|
35
|
+
- \`variant?: 'mui' | 'glass'\` — semantic preset.
|
|
36
|
+
- \`position?: 'fixed' | 'absolute' | 'sticky' | 'static' | 'relative'\`.
|
|
37
|
+
- \`color?: 'default' | 'inherit' | 'primary' | 'secondary' | 'transparent'\` — AppBar **only supports** these values.
|
|
38
|
+
- \`success\`, \`info\`, \`warning\`, and \`error\` are **not supported** by \`color\`; use \`sx={{ bgcolor: '...' }}\` instead.
|
|
39
|
+
- \`elevation?: number\`.
|
|
40
|
+
- \`enableColorOnDark?: boolean\`.
|
|
41
|
+
- \`sx?: object\` — granular styling via the system.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
## Basic usage (React)
|
|
45
|
+
~~~tsx
|
|
46
|
+
import { AppBar, Toolbar, Typography, Button, Box } from '@/gui/atoms';
|
|
47
|
+
|
|
48
|
+
<AppBar position="fixed" color="default" sx={{ borderBottom: '1px solid', borderColor: 'divider' }}>
|
|
49
|
+
<Toolbar variant="dense">
|
|
50
|
+
<Typography variant="h6" sx={{ flexGrow: 1 }}>My App</Typography>
|
|
51
|
+
<Button variant="text">Login</Button>
|
|
52
|
+
</Toolbar>
|
|
53
|
+
</AppBar>
|
|
54
|
+
~~~
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
## Declarative JSON / Config usage
|
|
58
|
+
This GUI's **resolver** lets you describe an app bar via a config object. Example payload for the \`AppBarResolver\`:
|
|
59
|
+
|
|
60
|
+
~~~json
|
|
61
|
+
{
|
|
62
|
+
"type": "AppBar",
|
|
63
|
+
"props": {
|
|
64
|
+
"position": "fixed",
|
|
65
|
+
"color": "default",
|
|
66
|
+
"sx": { "borderBottom": "1px solid", "borderColor": "divider" },
|
|
67
|
+
"children": {
|
|
68
|
+
"type": "Toolbar",
|
|
69
|
+
"props": {
|
|
70
|
+
"variant": "dense",
|
|
71
|
+
"children": [
|
|
72
|
+
{ "type": "Typography", "props": { "variant": "h6", "sx": { "flexGrow": 1 }, "children": "My App" } },
|
|
73
|
+
{ "type": "Button", "props": { "variant": "text", "children": "Login" } }
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
~~~
|
|
80
|
+
|
|
81
|
+
> The resolver maps this spec to real React elements, preserving polymorphism and \`sx\` styling.
|
|
82
|
+
`,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
argTypes: {
|
|
87
|
+
variant: {
|
|
88
|
+
control: { type: 'select' },
|
|
89
|
+
options: ['mui', 'glass'],
|
|
90
|
+
description: 'Semantic preset. mui (default): behaves like MUI AppBar. glass: floating blurred panel style.',
|
|
91
|
+
},
|
|
92
|
+
position: {
|
|
93
|
+
control: { type: 'select' },
|
|
94
|
+
options: ['fixed', 'absolute', 'sticky', 'static', 'relative'],
|
|
95
|
+
},
|
|
96
|
+
color: {
|
|
97
|
+
control: { type: 'select' },
|
|
98
|
+
options: ['default', 'inherit', 'primary', 'secondary', 'transparent'],
|
|
99
|
+
},
|
|
100
|
+
elevation: { control: { type: 'number' } },
|
|
101
|
+
enableColorOnDark: { control: { type: 'boolean' } },
|
|
102
|
+
// component polymorphism is supported but not exposed as a control in SB
|
|
103
|
+
component: { table: { disable: true } },
|
|
104
|
+
},
|
|
105
|
+
args: {
|
|
106
|
+
variant: undefined,
|
|
107
|
+
position: 'fixed',
|
|
108
|
+
elevation: 0,
|
|
109
|
+
enableColorOnDark: false,
|
|
110
|
+
sx: { borderBottom: '1px solid', borderColor: 'divider' },
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
export default meta;
|
|
114
|
+
|
|
115
|
+
type Story = StoryObj<typeof AppBar>;
|
|
116
|
+
|
|
117
|
+
// ======================= Stories =======================
|
|
118
|
+
export const Playground: Story = {
|
|
119
|
+
render: (args) => (
|
|
120
|
+
<AppBar {...args}>
|
|
121
|
+
<Toolbar variant="dense">
|
|
122
|
+
<Typography variant="h6" sx={{ flexGrow: 1 }}>Playground</Typography>
|
|
123
|
+
<Button variant="text">Action</Button>
|
|
124
|
+
</Toolbar>
|
|
125
|
+
</AppBar>
|
|
126
|
+
),
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export const Positions: Story = {
|
|
130
|
+
render: (args) => (
|
|
131
|
+
<div style={{ display: 'grid', gap: 16 }}>
|
|
132
|
+
{(['fixed', 'absolute', 'sticky', 'static', 'relative'] as const).map((pos) => (
|
|
133
|
+
<AppBar key={pos} {...args} position={pos}>
|
|
134
|
+
<Toolbar variant="dense">
|
|
135
|
+
<Typography variant="subtitle1" sx={{ flexGrow: 1 }}>
|
|
136
|
+
position = {pos}
|
|
137
|
+
</Typography>
|
|
138
|
+
<Button variant="text">Action</Button>
|
|
139
|
+
</Toolbar>
|
|
140
|
+
</AppBar>
|
|
141
|
+
))}
|
|
142
|
+
</div>
|
|
143
|
+
),
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const Colors: Story = {
|
|
147
|
+
parameters: {
|
|
148
|
+
docs: {
|
|
149
|
+
description: {
|
|
150
|
+
story: `
|
|
151
|
+
The AppBar component only supports the following values for the \`color\` prop: \`default\`, \`inherit\`, \`primary\`, \`secondary\`, and \`transparent\`.
|
|
152
|
+
For colors like \`success\`, \`info\`, \`warning\`, and \`error\`, use the \`sx\` prop with \`bgcolor\` instead, e.g. \`sx={{ bgcolor: 'success.main' }}\`.
|
|
153
|
+
`,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
args: { position: 'static' },
|
|
158
|
+
render: (args) => (
|
|
159
|
+
<div style={{ display: 'grid', gap: 12 }}>
|
|
160
|
+
{(['default', 'inherit', 'primary', 'secondary', 'transparent'] as const).map((c) => (
|
|
161
|
+
<AppBar key={c} {...args} color={c}>
|
|
162
|
+
<Toolbar variant="dense">
|
|
163
|
+
<Typography variant="subtitle2" sx={{ flexGrow: 1 }}>color = {c}</Typography>
|
|
164
|
+
<Button variant="text">Action</Button>
|
|
165
|
+
</Toolbar>
|
|
166
|
+
</AppBar>
|
|
167
|
+
))}
|
|
168
|
+
</div>
|
|
169
|
+
),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The AppBar component does not support 'success', 'info', 'warning', or 'error' as values for the color prop.
|
|
174
|
+
* To use these colors, apply them via the sx prop with bgcolor instead.
|
|
175
|
+
*/
|
|
176
|
+
export const CustomColorsWithSx: Story = {
|
|
177
|
+
args: { position: 'static' },
|
|
178
|
+
render: (args) => (
|
|
179
|
+
<div style={{ display: 'grid', gap: 12 }}>
|
|
180
|
+
{(['success.main', 'info.main', 'warning.main', 'error.main'] as const).map((bgcolor) => (
|
|
181
|
+
<AppBar key={bgcolor} {...args} sx={{ bgcolor }}>
|
|
182
|
+
<Toolbar variant="dense">
|
|
183
|
+
<Typography variant="subtitle2" sx={{ flexGrow: 1 }}>{`sx.bgcolor = ${bgcolor}`}</Typography>
|
|
184
|
+
<Button variant="text">Action</Button>
|
|
185
|
+
</Toolbar>
|
|
186
|
+
</AppBar>
|
|
187
|
+
))}
|
|
188
|
+
</div>
|
|
189
|
+
),
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const WithToolbar: Story = {
|
|
193
|
+
args: { position: 'static', color: 'default' },
|
|
194
|
+
render: (args) => (
|
|
195
|
+
<AppBar {...args} sx={{ px: 2, borderBottom: '1px solid', borderColor: 'divider' }}>
|
|
196
|
+
<Toolbar variant="dense">
|
|
197
|
+
<Typography variant="h6" sx={{ flexGrow: 1 }}>With Toolbar</Typography>
|
|
198
|
+
<Box sx={{ display: 'flex', gap: 1 }}>
|
|
199
|
+
<Button variant="text">Login</Button>
|
|
200
|
+
<Button variant="contained" color="primary">Sign up</Button>
|
|
201
|
+
</Box>
|
|
202
|
+
</Toolbar>
|
|
203
|
+
</AppBar>
|
|
204
|
+
),
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export const Elevation: Story = {
|
|
208
|
+
args: { position: 'static', color: 'default' },
|
|
209
|
+
render: (args) => (
|
|
210
|
+
<div style={{ display: 'grid', gap: 12 }}>
|
|
211
|
+
{[0, 1, 2, 4, 8].map((elev) => (
|
|
212
|
+
<AppBar key={elev} {...args} elevation={elev}>
|
|
213
|
+
<Toolbar variant="dense">
|
|
214
|
+
<Typography variant="subtitle2" sx={{ flexGrow: 1 }}>elevation = {elev}</Typography>
|
|
215
|
+
<Button variant="text">Action</Button>
|
|
216
|
+
</Toolbar>
|
|
217
|
+
</AppBar>
|
|
218
|
+
))}
|
|
219
|
+
</div>
|
|
220
|
+
),
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
export const EnableColorOnDark: Story = {
|
|
224
|
+
args: { position: 'static', color: 'primary', enableColorOnDark: true },
|
|
225
|
+
render: (args) => (
|
|
226
|
+
<AppBar {...args}>
|
|
227
|
+
<Toolbar variant="dense">
|
|
228
|
+
<Typography variant="subtitle2" sx={{ flexGrow: 1 }}>enableColorOnDark = true</Typography>
|
|
229
|
+
<Button variant="text">Action</Button>
|
|
230
|
+
</Toolbar>
|
|
231
|
+
</AppBar>
|
|
232
|
+
),
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export const Variants: Story = {
|
|
236
|
+
args: { position: 'static', color: 'default', variant: undefined },
|
|
237
|
+
render: (args) => (
|
|
238
|
+
<div style={{ display: 'grid', gap: 12 }}>
|
|
239
|
+
{(['mui', 'glass'] as const).map((v) => (
|
|
240
|
+
<AppBar key={v} {...args} variant={v as any}>
|
|
241
|
+
<Toolbar variant="dense">
|
|
242
|
+
<Typography variant="subtitle2" sx={{ flexGrow: 1 }}>
|
|
243
|
+
variant = {v}
|
|
244
|
+
</Typography>
|
|
245
|
+
<Button variant="text">Action</Button>
|
|
246
|
+
</Toolbar>
|
|
247
|
+
</AppBar>
|
|
248
|
+
))}
|
|
249
|
+
</div>
|
|
250
|
+
),
|
|
251
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import MuiAppBar from '@mui/material/AppBar';
|
|
3
|
+
import type { AppBarProps as MuiAppBarProps } from '@mui/material/AppBar';
|
|
4
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
5
|
+
|
|
6
|
+
// Keep your local AppBarProps, but allow us to extend it safely at runtime.
|
|
7
|
+
// If ./AppBar.types.js already defines AppBarProps, we can widen it here.
|
|
8
|
+
import type { AppBarProps as LocalAppBarProps } from './AppBar.types.js';
|
|
9
|
+
|
|
10
|
+
export type AppBarVariant = 'mui' | 'glass';
|
|
11
|
+
|
|
12
|
+
export type AppBarProps = LocalAppBarProps & {
|
|
13
|
+
/**
|
|
14
|
+
* Semantic preset.
|
|
15
|
+
* - `mui` (default): behaves exactly like MUI AppBar.
|
|
16
|
+
* - `glass`: a floating “welcome” topbar style (blurred panel), suitable for quick links.
|
|
17
|
+
*/
|
|
18
|
+
variant?: AppBarVariant;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Where to dock the AppBar when using the `glass` variant.
|
|
22
|
+
*/
|
|
23
|
+
dock?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Pixel offsets for the `glass` variant.
|
|
27
|
+
*/
|
|
28
|
+
offset?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const glassDockSx = (dock: NonNullable<AppBarProps['dock']>, offset: number): SxProps<Theme> => {
|
|
32
|
+
const o = `${offset}px`;
|
|
33
|
+
switch (dock) {
|
|
34
|
+
case 'top-left':
|
|
35
|
+
return { top: o, left: o };
|
|
36
|
+
case 'top-right':
|
|
37
|
+
return { top: o, right: o };
|
|
38
|
+
case 'bottom-left':
|
|
39
|
+
return { bottom: o, left: o };
|
|
40
|
+
case 'bottom-right':
|
|
41
|
+
return { bottom: o, right: o };
|
|
42
|
+
default:
|
|
43
|
+
return { top: o, right: o };
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const AppBar = React.forwardRef<HTMLDivElement, AppBarProps>((props, ref) => {
|
|
48
|
+
const {
|
|
49
|
+
variant = 'mui',
|
|
50
|
+
dock = 'top-right',
|
|
51
|
+
offset = 16,
|
|
52
|
+
sx,
|
|
53
|
+
position,
|
|
54
|
+
elevation,
|
|
55
|
+
...rest
|
|
56
|
+
} = props;
|
|
57
|
+
|
|
58
|
+
if (variant === 'mui') {
|
|
59
|
+
// Default behavior: pass-through to MUI.
|
|
60
|
+
return (
|
|
61
|
+
<MuiAppBar
|
|
62
|
+
ref={ref}
|
|
63
|
+
sx={sx as any}
|
|
64
|
+
position={position}
|
|
65
|
+
elevation={elevation}
|
|
66
|
+
{...(rest as any)}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Glass/floating preset
|
|
72
|
+
return (
|
|
73
|
+
<MuiAppBar
|
|
74
|
+
ref={ref}
|
|
75
|
+
// Force floating positioning
|
|
76
|
+
position="fixed"
|
|
77
|
+
elevation={0}
|
|
78
|
+
sx={(
|
|
79
|
+
[
|
|
80
|
+
{
|
|
81
|
+
zIndex: (theme: Theme) => (theme as any)?.zIndex?.modal ?? 1300,
|
|
82
|
+
width: 'auto',
|
|
83
|
+
borderRadius: 999,
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
background: 'rgba(10, 10, 10, 0.55)',
|
|
86
|
+
color: '#fff',
|
|
87
|
+
border: '1px solid rgba(255,255,255,0.12)',
|
|
88
|
+
backdropFilter: 'blur(12px)',
|
|
89
|
+
WebkitBackdropFilter: 'blur(12px)',
|
|
90
|
+
boxShadow: '0 6px 30px rgba(0,0,0,0.25)',
|
|
91
|
+
padding: '10px 14px',
|
|
92
|
+
display: 'inline-flex',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
gap: 12,
|
|
95
|
+
...glassDockSx(dock, offset),
|
|
96
|
+
},
|
|
97
|
+
// allow user overrides last
|
|
98
|
+
sx as any,
|
|
99
|
+
]
|
|
100
|
+
) as any}
|
|
101
|
+
{...(rest as any)}
|
|
102
|
+
/>
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
AppBar.displayName = 'AppBar';
|
|
107
|
+
export default AppBar;
|