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,162 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import Menu from './Menu';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Menu> = {
|
|
8
|
+
title: 'Atoms/Navigation/Menu',
|
|
9
|
+
component: Menu,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (
|
|
13
|
+
<div style={{ padding: 16, minHeight: 260 }}>
|
|
14
|
+
<Story />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: `
|
|
22
|
+
The **Menu** atom is a thin wrapper around MUI's \`MuiMenu\`. It supports **granular styling** via:
|
|
23
|
+
- \`sx\` — root popover/menu container
|
|
24
|
+
- \`paperSx\` — Paper slot
|
|
25
|
+
- \`listSx\` — MenuList slot
|
|
26
|
+
|
|
27
|
+
You can also pass \`PaperProps\` and \`MenuListProps\`; their \`sx\` are **merged** with \`paperSx\`/\`listSx\`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
## Basic usage
|
|
31
|
+
~~~jsx
|
|
32
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
33
|
+
const open = Boolean(anchorEl);
|
|
34
|
+
|
|
35
|
+
<Button onClick={(e) => setAnchorEl(e.currentTarget)}>Open menu</Button>
|
|
36
|
+
<Menu open={open} anchorEl={anchorEl} onClose={() => setAnchorEl(null)}>
|
|
37
|
+
<MenuItem onClick={() => setAnchorEl(null)}>Profile</MenuItem>
|
|
38
|
+
<MenuItem onClick={() => setAnchorEl(null)}>Settings</MenuItem>
|
|
39
|
+
</Menu>
|
|
40
|
+
~~~
|
|
41
|
+
|
|
42
|
+
## Granular styling
|
|
43
|
+
~~~jsx
|
|
44
|
+
<Menu
|
|
45
|
+
open={open}
|
|
46
|
+
anchorEl={anchorEl}
|
|
47
|
+
onClose={handleClose}
|
|
48
|
+
sx={{ mt: 1 }}
|
|
49
|
+
paperSx={{ borderRadius: 10 }}
|
|
50
|
+
listSx={{ py: 0.5 }}
|
|
51
|
+
PaperProps={{ elevation: 3 }}
|
|
52
|
+
/>
|
|
53
|
+
~~~
|
|
54
|
+
|
|
55
|
+
## Declarative JSON / Resolver
|
|
56
|
+
~~~json
|
|
57
|
+
{
|
|
58
|
+
"type": "Menu",
|
|
59
|
+
"props": {
|
|
60
|
+
"open": true,
|
|
61
|
+
"sx": { "mt": 1 },
|
|
62
|
+
"paperSx": { "borderRadius": 10 },
|
|
63
|
+
"listSx": { "py": 0.5 },
|
|
64
|
+
"PaperProps": { "elevation": 3 },
|
|
65
|
+
"children": [
|
|
66
|
+
{ "type": "MenuItem", "props": { "children": "Profile" } },
|
|
67
|
+
{ "type": "MenuItem", "props": { "children": "Settings" } }
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
~~~
|
|
72
|
+
|
|
73
|
+
*Note:* \`anchorEl\` is a runtime element reference and is typically provided by the renderer/context in declarative mode.
|
|
74
|
+
`,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
controls: {
|
|
78
|
+
exclude: ['anchorEl', 'PaperProps', 'MenuListProps'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
argTypes: {
|
|
82
|
+
open: { control: 'boolean' },
|
|
83
|
+
keepMounted: { control: 'boolean' },
|
|
84
|
+
variant: { control: { type: 'radio' }, options: ['menu', 'selectedMenu'] },
|
|
85
|
+
elevation: { control: { type: 'number', min: 0, max: 24, step: 1 } },
|
|
86
|
+
sx: { control: 'object' },
|
|
87
|
+
},
|
|
88
|
+
args: {
|
|
89
|
+
open: false, // controlled within each story with local state
|
|
90
|
+
keepMounted: false,
|
|
91
|
+
variant: 'menu',
|
|
92
|
+
elevation: 1,
|
|
93
|
+
sx: {},
|
|
94
|
+
children: undefined,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default meta;
|
|
99
|
+
type Story = StoryObj<typeof Menu>;
|
|
100
|
+
|
|
101
|
+
// Reusable demo component that owns anchor state but forwards args
|
|
102
|
+
const DemoMenu: React.FC<React.ComponentProps<typeof Menu>> = (props) => {
|
|
103
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
104
|
+
const open = Boolean(anchorEl);
|
|
105
|
+
const handleOpen = (e: React.MouseEvent<HTMLButtonElement>) => setAnchorEl(e.currentTarget);
|
|
106
|
+
const handleClose = () => setAnchorEl(null);
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<Button variant="outlined" onClick={handleOpen} data-testid="open-menu">
|
|
110
|
+
Open Menu
|
|
111
|
+
</Button>
|
|
112
|
+
<Menu
|
|
113
|
+
{...props}
|
|
114
|
+
open={open}
|
|
115
|
+
anchorEl={anchorEl}
|
|
116
|
+
onClose={handleClose}
|
|
117
|
+
onClick={handleClose}
|
|
118
|
+
>
|
|
119
|
+
{props.children ?? (
|
|
120
|
+
<>
|
|
121
|
+
<MenuItem onClick={handleClose}>Profile</MenuItem>
|
|
122
|
+
<MenuItem onClick={handleClose}>My account</MenuItem>
|
|
123
|
+
<MenuItem onClick={handleClose}>Logout</MenuItem>
|
|
124
|
+
</>
|
|
125
|
+
)}
|
|
126
|
+
</Menu>
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// ======================= Stories =======================
|
|
132
|
+
export const Playground: Story = {
|
|
133
|
+
render: (args) => <DemoMenu {...args} />,
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const WithPaperAndListSx: Story = {
|
|
137
|
+
args: {
|
|
138
|
+
sx: { mt: 1 },
|
|
139
|
+
},
|
|
140
|
+
render: (args) => (
|
|
141
|
+
<DemoMenu
|
|
142
|
+
{...args}
|
|
143
|
+
PaperProps={{ elevation: 2, sx: { borderRadius: 2 } }}
|
|
144
|
+
MenuListProps={{ sx: { py: 0.5 } }}
|
|
145
|
+
/>
|
|
146
|
+
),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export const KeepMounted: Story = {
|
|
150
|
+
args: { keepMounted: true },
|
|
151
|
+
render: (args) => <DemoMenu {...args} />,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const CustomOrigins: Story = {
|
|
155
|
+
args: {
|
|
156
|
+
sx: { mt: 1 },
|
|
157
|
+
// Showcase custom anchor/transform origins
|
|
158
|
+
anchorOrigin: { vertical: 'bottom', horizontal: 'left' },
|
|
159
|
+
transformOrigin: { vertical: 'top', horizontal: 'left' },
|
|
160
|
+
},
|
|
161
|
+
render: (args) => <DemoMenu {...args} />,
|
|
162
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — Menu
|
|
3
|
+
* Thin wrapper that preserves MUI's own typing and API.
|
|
4
|
+
* Examples:
|
|
5
|
+
* <Menu open={open} onClose={handleClose} anchorEl={anchorEl}>
|
|
6
|
+
* {children}
|
|
7
|
+
* </Menu>
|
|
8
|
+
*/
|
|
9
|
+
import MuiMenu from '@mui/material/Menu';
|
|
10
|
+
import * as React from 'react';
|
|
11
|
+
|
|
12
|
+
// Re-export using MUI's own component type to keep full typing
|
|
13
|
+
const Menu = MuiMenu;
|
|
14
|
+
export type MenuProps = React.ComponentProps<typeof Menu>;
|
|
15
|
+
|
|
16
|
+
(Menu as any).displayName = 'Gui.Menu';
|
|
17
|
+
export default Menu;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
// src/gui/atoms/MenuItem/MenuItem.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import MenuItem from './MenuItem';
|
|
4
|
+
import Link from '@/gui/atoms/Link/Link';
|
|
5
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
6
|
+
import ListItemIcon from '@mui/material/ListItemIcon';
|
|
7
|
+
import ListItemText from '@mui/material/ListItemText';
|
|
8
|
+
import type { RegistryEntry, ResolveCtx } from '@/gui/registry/types';
|
|
9
|
+
import type { SxProps, Theme } from '@mui/material/styles';
|
|
10
|
+
import type { ListItemIconProps as MuiListItemIconProps } from '@mui/material/ListItemIcon';
|
|
11
|
+
import type { ListItemTextProps as MuiListItemTextProps } from '@mui/material/ListItemText';
|
|
12
|
+
import { ensureNodeId } from '@/gui/utils/nodeID';
|
|
13
|
+
|
|
14
|
+
// Merge sx parts into a single SxProps (filters out undefined)
|
|
15
|
+
const sxJoin = (...parts: Array<SxProps<Theme> | undefined>): SxProps<Theme> =>
|
|
16
|
+
(parts.filter(Boolean) as unknown) as SxProps<Theme>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Declarative spec for MenuItem
|
|
20
|
+
*
|
|
21
|
+
* Notes
|
|
22
|
+
* - Wraps MUI's MenuItem (supports `component` polymorphism).
|
|
23
|
+
* - Declarative sugar:
|
|
24
|
+
* - `label` / `secondary` map to `<ListItemText primary/secondary />`
|
|
25
|
+
* - `startIcon` accepts a token (e.g., "mui:Settings", "lucide:mail") or a React node
|
|
26
|
+
* - Granular styling:
|
|
27
|
+
* - `sx` (root MenuItem)
|
|
28
|
+
* - `iconSx` (ListItemIcon)
|
|
29
|
+
* - `textSx` (ListItemText)
|
|
30
|
+
* - Slot props passthrough:
|
|
31
|
+
* - `ListItemIconProps`, `ListItemTextProps` (their `sx` are merged with iconSx/textSx)
|
|
32
|
+
*/
|
|
33
|
+
export type MenuItemSpec = {
|
|
34
|
+
type: 'MenuItem';
|
|
35
|
+
props?: {
|
|
36
|
+
children?: React.ReactNode;
|
|
37
|
+
|
|
38
|
+
// Polymorphism / routing
|
|
39
|
+
component?: any; // 'li' | 'a' | Link | custom
|
|
40
|
+
as?: any; // alias for component
|
|
41
|
+
to?: string; // router target (when component={Link})
|
|
42
|
+
href?: string; // anchor target (when component='a')
|
|
43
|
+
external?: boolean; // force external anchor
|
|
44
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
45
|
+
rel?: string;
|
|
46
|
+
|
|
47
|
+
// Sugar
|
|
48
|
+
label?: React.ReactNode | string;
|
|
49
|
+
secondary?: React.ReactNode | string;
|
|
50
|
+
startIcon?: React.ReactNode | string;
|
|
51
|
+
iconColor?: string;
|
|
52
|
+
|
|
53
|
+
// Core MenuItem props (subset; others passthrough)
|
|
54
|
+
dense?: boolean;
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
divider?: boolean;
|
|
57
|
+
selected?: boolean;
|
|
58
|
+
autoFocus?: boolean;
|
|
59
|
+
|
|
60
|
+
// Granular styling
|
|
61
|
+
sx?: SxProps<Theme>; // root
|
|
62
|
+
iconSx?: SxProps<Theme>; // ListItemIcon
|
|
63
|
+
textSx?: SxProps<Theme>; // ListItemText
|
|
64
|
+
|
|
65
|
+
// Slot props passthrough
|
|
66
|
+
ListItemIconProps?: MuiListItemIconProps;
|
|
67
|
+
ListItemTextProps?: MuiListItemTextProps;
|
|
68
|
+
|
|
69
|
+
// Misc
|
|
70
|
+
id?: string;
|
|
71
|
+
className?: string;
|
|
72
|
+
'data-testid'?: string;
|
|
73
|
+
'data-gui-id'?: string;
|
|
74
|
+
|
|
75
|
+
// Allow arbitrary passthrough
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
function renderDeclarativeIcon(node: React.ReactNode | string | undefined, iconColor?: string) {
|
|
81
|
+
if (!node) return null;
|
|
82
|
+
if (typeof node === 'string') return <Icon name={node} iconColor={iconColor} fontSize={20} />;
|
|
83
|
+
return node;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function coerceComponent(comp: any) {
|
|
87
|
+
// allow declarative string token "Link" to map to our Link component
|
|
88
|
+
if (comp === 'Link') return Link;
|
|
89
|
+
return comp;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const MenuItemResolver: RegistryEntry = {
|
|
93
|
+
type: 'MenuItem',
|
|
94
|
+
resolve(spec: MenuItemSpec, _ctx?: ResolveCtx) {
|
|
95
|
+
const p = spec.props ?? {};
|
|
96
|
+
|
|
97
|
+
const providedDataGuiId = p['data-gui-id'];
|
|
98
|
+
|
|
99
|
+
// Decide polymorphic target
|
|
100
|
+
const component = coerceComponent(p.component ?? p.as ?? (p.to ? Link : p.external ? 'a' : undefined));
|
|
101
|
+
|
|
102
|
+
// Routing/anchor props
|
|
103
|
+
const routingProps =
|
|
104
|
+
component === 'a' || p.external
|
|
105
|
+
? {
|
|
106
|
+
href: p.href,
|
|
107
|
+
target: p.target ?? (p.external ? '_blank' : undefined),
|
|
108
|
+
rel: p.rel ?? (p.external ? 'noopener noreferrer' : undefined),
|
|
109
|
+
}
|
|
110
|
+
: component === Link || (p.to && !p.component)
|
|
111
|
+
? { to: p.to }
|
|
112
|
+
: {};
|
|
113
|
+
|
|
114
|
+
const {
|
|
115
|
+
children,
|
|
116
|
+
label,
|
|
117
|
+
secondary,
|
|
118
|
+
startIcon,
|
|
119
|
+
iconColor,
|
|
120
|
+
ListItemIconProps,
|
|
121
|
+
ListItemTextProps,
|
|
122
|
+
// strip resolver-only keys
|
|
123
|
+
as: _as,
|
|
124
|
+
external: _external,
|
|
125
|
+
to: _to,
|
|
126
|
+
href: _href,
|
|
127
|
+
target: _target,
|
|
128
|
+
rel: _rel,
|
|
129
|
+
'data-gui-id': _dataGuiId,
|
|
130
|
+
...rest
|
|
131
|
+
} = p;
|
|
132
|
+
|
|
133
|
+
const iconNode = renderDeclarativeIcon(startIcon, iconColor);
|
|
134
|
+
const hasTextBlock = label != null || secondary != null;
|
|
135
|
+
|
|
136
|
+
// Merge sx for ListItemIcon/Text if provided both via shorthand and slot props
|
|
137
|
+
const mergedIconSx = (p.iconSx || ListItemIconProps?.sx)
|
|
138
|
+
? sxJoin(p.iconSx, ListItemIconProps?.sx as SxProps<Theme>)
|
|
139
|
+
: undefined;
|
|
140
|
+
|
|
141
|
+
const mergedTextSx = (p.textSx || ListItemTextProps?.sx)
|
|
142
|
+
? sxJoin(p.textSx, ListItemTextProps?.sx as SxProps<Theme>)
|
|
143
|
+
: undefined;
|
|
144
|
+
|
|
145
|
+
const finalIconProps: MuiListItemIconProps | undefined = iconNode
|
|
146
|
+
? {
|
|
147
|
+
...(ListItemIconProps || {}),
|
|
148
|
+
...(mergedIconSx ? { sx: mergedIconSx } : {}),
|
|
149
|
+
}
|
|
150
|
+
: undefined;
|
|
151
|
+
|
|
152
|
+
const finalTextProps: MuiListItemTextProps | undefined = hasTextBlock
|
|
153
|
+
? {
|
|
154
|
+
...(ListItemTextProps || {}),
|
|
155
|
+
...(mergedTextSx ? { sx: mergedTextSx } : {}),
|
|
156
|
+
}
|
|
157
|
+
: undefined;
|
|
158
|
+
|
|
159
|
+
const dataGuiId = ensureNodeId('menu-item', providedDataGuiId);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<MenuItem
|
|
163
|
+
component={component}
|
|
164
|
+
sx={p.sx}
|
|
165
|
+
id={p.id}
|
|
166
|
+
className={p.className}
|
|
167
|
+
data-testid={p['data-testid']}
|
|
168
|
+
data-gui-id={dataGuiId}
|
|
169
|
+
{...routingProps}
|
|
170
|
+
{...rest}
|
|
171
|
+
>
|
|
172
|
+
{iconNode ? <ListItemIcon {...finalIconProps}>{iconNode}</ListItemIcon> : null}
|
|
173
|
+
{hasTextBlock ? (
|
|
174
|
+
<ListItemText primary={label} secondary={secondary} {...finalTextProps} />
|
|
175
|
+
) : (
|
|
176
|
+
children
|
|
177
|
+
)}
|
|
178
|
+
</MenuItem>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export default MenuItemResolver;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import MenuItem from './MenuItem';
|
|
4
|
+
import Menu from '@/gui/atoms/Menu/Menu';
|
|
5
|
+
import Button from '@mui/material/Button';
|
|
6
|
+
import Icon from '@/gui/Theme/Icon/Icon';
|
|
7
|
+
const meta: Meta<typeof MenuItem> = {
|
|
8
|
+
title: 'Atoms/Navigation/MenuItem',
|
|
9
|
+
component: MenuItem,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (
|
|
13
|
+
<div style={{ padding: 16, minHeight: 260 }}>
|
|
14
|
+
<Story />
|
|
15
|
+
</div>
|
|
16
|
+
),
|
|
17
|
+
],
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: `
|
|
22
|
+
The **MenuItem** atom is a thin wrapper around MUI's \`MuiMenuItem\`.
|
|
23
|
+
|
|
24
|
+
In **declarative** mode (registry), the resolver supports:
|
|
25
|
+
- \`label\` / \`secondary\` → maps to \`<ListItemText primary/secondary />\`
|
|
26
|
+
- \`startIcon\` → token (e.g., \`"mui:Settings"\`, \`"lucide:mail"\`) or React node → renders inside \`<ListItemIcon />\`
|
|
27
|
+
- Granular styling via:
|
|
28
|
+
- \`sx\` (root)
|
|
29
|
+
- \`iconSx\` (ListItemIcon)
|
|
30
|
+
- \`textSx\` (ListItemText)
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
## Declarative JSON / Resolver
|
|
34
|
+
~~~json
|
|
35
|
+
{
|
|
36
|
+
"type": "MenuItem",
|
|
37
|
+
"props": {
|
|
38
|
+
"startIcon": "mui:Settings",
|
|
39
|
+
"label": "Settings",
|
|
40
|
+
"secondary": "Manage your preferences",
|
|
41
|
+
"sx": { "py": 1 },
|
|
42
|
+
"iconSx": { "minWidth": 36 },
|
|
43
|
+
"textSx": { "my": 0 }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
~~~
|
|
47
|
+
`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
controls: {
|
|
51
|
+
exclude: ['component'],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
argTypes: {
|
|
55
|
+
dense: { control: 'boolean' },
|
|
56
|
+
divider: { control: 'boolean' },
|
|
57
|
+
disabled: { control: 'boolean' },
|
|
58
|
+
selected: { control: 'boolean' },
|
|
59
|
+
sx: { control: 'object' },
|
|
60
|
+
},
|
|
61
|
+
args: {
|
|
62
|
+
dense: false,
|
|
63
|
+
divider: false,
|
|
64
|
+
disabled: false,
|
|
65
|
+
selected: false,
|
|
66
|
+
sx: {},
|
|
67
|
+
children: 'Menu item',
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default meta;
|
|
72
|
+
type Story = StoryObj<typeof MenuItem>;
|
|
73
|
+
|
|
74
|
+
// Reusable demo wrapper that controls open/close
|
|
75
|
+
const DemoMenu: React.FC<{ children?: React.ReactNode }> = ({ children }) => {
|
|
76
|
+
const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);
|
|
77
|
+
const open = Boolean(anchorEl);
|
|
78
|
+
const handleOpen = (e: React.MouseEvent<HTMLButtonElement>) => setAnchorEl(e.currentTarget);
|
|
79
|
+
const handleClose = () => setAnchorEl(null);
|
|
80
|
+
return (
|
|
81
|
+
<>
|
|
82
|
+
<Button variant="outlined" onClick={handleOpen} data-testid="open-menu">
|
|
83
|
+
Open Menu
|
|
84
|
+
</Button>
|
|
85
|
+
<Menu open={open} anchorEl={anchorEl} onClose={handleClose} onClick={handleClose}>
|
|
86
|
+
{children ?? (
|
|
87
|
+
<>
|
|
88
|
+
<MenuItem onClick={handleClose}>Profile</MenuItem>
|
|
89
|
+
<MenuItem onClick={handleClose} selected dense>
|
|
90
|
+
<Icon name="settings" weight={400} fill={0} style={{ marginRight: 8 }} />
|
|
91
|
+
Settings
|
|
92
|
+
</MenuItem>
|
|
93
|
+
<MenuItem onClick={handleClose} disabled>
|
|
94
|
+
Disabled
|
|
95
|
+
</MenuItem>
|
|
96
|
+
</>
|
|
97
|
+
)}
|
|
98
|
+
</Menu>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// ======================= Stories =======================
|
|
104
|
+
export const Playground: Story = {
|
|
105
|
+
render: (args) => (
|
|
106
|
+
<DemoMenu>
|
|
107
|
+
<MenuItem {...args} />
|
|
108
|
+
</DemoMenu>
|
|
109
|
+
),
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const States: Story = {
|
|
113
|
+
render: () => (
|
|
114
|
+
<DemoMenu>
|
|
115
|
+
<MenuItem>Default</MenuItem>
|
|
116
|
+
<MenuItem selected>Selected</MenuItem>
|
|
117
|
+
<MenuItem disabled>Disabled</MenuItem>
|
|
118
|
+
<MenuItem dense>Dense</MenuItem>
|
|
119
|
+
</DemoMenu>
|
|
120
|
+
),
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const WithCustomChildren: Story = {
|
|
124
|
+
render: () => (
|
|
125
|
+
<DemoMenu>
|
|
126
|
+
<MenuItem>
|
|
127
|
+
<strong>Custom node as children</strong>
|
|
128
|
+
</MenuItem>
|
|
129
|
+
<MenuItem>
|
|
130
|
+
<span style={{ opacity: 0.75 }}>With inline styling</span>
|
|
131
|
+
</MenuItem>
|
|
132
|
+
</DemoMenu>
|
|
133
|
+
),
|
|
134
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This.GUI — MenuItem
|
|
3
|
+
* Thin wrapper that preserves MUI's own typing and API.
|
|
4
|
+
* Examples:
|
|
5
|
+
* <MenuItem onClick={...}>Profile</MenuItem>
|
|
6
|
+
* <MenuItem selected dense>Settings</MenuItem>
|
|
7
|
+
*/
|
|
8
|
+
import MuiMenuItem from '@mui/material/MenuItem';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
// Re-export using MUI's own component type to keep full typing
|
|
11
|
+
const MenuItem = MuiMenuItem;
|
|
12
|
+
export type MenuItemProps = React.ComponentProps<typeof MenuItem>;
|
|
13
|
+
(MenuItem as any).displayName = 'Gui.MenuItem';
|
|
14
|
+
export default MenuItem;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/gui/atoms/Paper/Paper.resolver.tsx
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Paper from './Paper';
|
|
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
|
+
/**
|
|
9
|
+
* Declarative spec for Paper (polymorphic container)
|
|
10
|
+
*
|
|
11
|
+
* Notes
|
|
12
|
+
* - You can choose the rendered element via `component` (e.g. 'div', 'section', 'a')
|
|
13
|
+
* - If `to` is provided (and no explicit component), the resolver will default to This.GUI `Link`.
|
|
14
|
+
* - If `external` is true (and no explicit component), it will default to an anchor (`'a'`) and apply
|
|
15
|
+
* safe `target`/`rel` defaults.
|
|
16
|
+
* - Supports `sx` and arbitrary system props passthrough.
|
|
17
|
+
*/
|
|
18
|
+
export type PaperSpec = {
|
|
19
|
+
type: 'Paper';
|
|
20
|
+
props?: {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
|
|
23
|
+
// Polymorphism / routing
|
|
24
|
+
component?: any; // 'div' | 'section' | 'article' | 'a' | Link | custom
|
|
25
|
+
as?: any; // alias for component
|
|
26
|
+
to?: string; // router target (when component={Link})
|
|
27
|
+
href?: string; // anchor target (when component='a')
|
|
28
|
+
external?: boolean; // force external anchor
|
|
29
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
30
|
+
rel?: string;
|
|
31
|
+
|
|
32
|
+
// MUI Paper core props (subset; rest is passthrough)
|
|
33
|
+
elevation?: number;
|
|
34
|
+
square?: boolean;
|
|
35
|
+
variant?: 'elevation' | 'outlined';
|
|
36
|
+
|
|
37
|
+
// Styling & misc
|
|
38
|
+
sx?: any;
|
|
39
|
+
className?: string;
|
|
40
|
+
id?: string;
|
|
41
|
+
'data-testid'?: string;
|
|
42
|
+
|
|
43
|
+
// Allow system props / arbitrary passthrough (p, m, display, etc.)
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const PaperResolver: RegistryEntry = {
|
|
49
|
+
type: 'Paper',
|
|
50
|
+
resolve(spec: PaperSpec, _ctx?: ResolveCtx) {
|
|
51
|
+
const p = spec.props ?? {};
|
|
52
|
+
const nodeId = ensureNodeId('Paper', p.id);
|
|
53
|
+
|
|
54
|
+
// Decide polymorphic target
|
|
55
|
+
const component = p.component ?? p.as ?? (p.to ? Link : p.external ? 'a' : undefined);
|
|
56
|
+
|
|
57
|
+
// Routing/anchor props
|
|
58
|
+
const routingProps =
|
|
59
|
+
component === 'a' || p.external
|
|
60
|
+
? {
|
|
61
|
+
href: p.href,
|
|
62
|
+
target: p.target ?? (p.external ? '_blank' : undefined),
|
|
63
|
+
rel: p.rel ?? (p.external ? 'noopener noreferrer' : undefined),
|
|
64
|
+
}
|
|
65
|
+
: component === Link || (p.to && !p.component)
|
|
66
|
+
? { to: p.to }
|
|
67
|
+
: {};
|
|
68
|
+
|
|
69
|
+
// Collect common props and avoid leaking resolver-only keys
|
|
70
|
+
const {
|
|
71
|
+
children,
|
|
72
|
+
// remove resolver-only keys so they don't end up as DOM attributes
|
|
73
|
+
as: _as,
|
|
74
|
+
external: _external,
|
|
75
|
+
to: _to,
|
|
76
|
+
href: _href,
|
|
77
|
+
target: _target,
|
|
78
|
+
rel: _rel,
|
|
79
|
+
...rest
|
|
80
|
+
} = p;
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Paper
|
|
84
|
+
component={component}
|
|
85
|
+
sx={p.sx}
|
|
86
|
+
id={nodeId}
|
|
87
|
+
className={p.className}
|
|
88
|
+
data-testid={p['data-testid']}
|
|
89
|
+
{...routingProps}
|
|
90
|
+
{...rest}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</Paper>
|
|
94
|
+
);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export default PaperResolver;
|