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,403 @@
|
|
|
1
|
+
// IdentityNoise.tsx — Floating .me badge wrapper
|
|
2
|
+
// Renders the draggable animated .me orb and toggles the Triad badge ("Identity Noise")
|
|
3
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { Box } from "@mui/material";
|
|
5
|
+
import { GlobalStyles } from "@mui/system";
|
|
6
|
+
import type { Theme } from "@mui/material/styles";
|
|
7
|
+
import { useTheme } from "@mui/material";
|
|
8
|
+
import Triad from "./Triad/Triad";
|
|
9
|
+
export default function IdentityNoise() {
|
|
10
|
+
const [open, setOpen] = useState(false);
|
|
11
|
+
const status = { active: true, error: false };
|
|
12
|
+
const theme = useTheme() as any;
|
|
13
|
+
const { top = 0, bottom = 0, left = 0, right = 0 } = theme.layout?.insets || {};
|
|
14
|
+
// Drag state
|
|
15
|
+
const dockPos = useRef({
|
|
16
|
+
x: (window.innerWidth - left - right) / 2,
|
|
17
|
+
y: (window.innerHeight - top - bottom) / 2,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const [pos, setPos] = useState(dockPos.current);
|
|
21
|
+
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
|
22
|
+
const [dragging, setDragging] = useState(false);
|
|
23
|
+
const clickTimeout = useRef<number | null>(null);
|
|
24
|
+
const dragMoved = useRef(false);
|
|
25
|
+
|
|
26
|
+
/** ✅ Drag */
|
|
27
|
+
const handleMouseDown = (e: React.MouseEvent) => {
|
|
28
|
+
setDragging(true);
|
|
29
|
+
setOffset({ x: e.clientX - pos.x, y: e.clientY - pos.y });
|
|
30
|
+
dragMoved.current = false;
|
|
31
|
+
clickTimeout.current = Date.now();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleMouseMove = (e: MouseEvent) => {
|
|
35
|
+
if (!dragging) return;
|
|
36
|
+
if (Math.abs(e.clientX - pos.x) > 3 || Math.abs(e.clientY - pos.y) > 3) {
|
|
37
|
+
dragMoved.current = true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const rawX = e.clientX - offset.x;
|
|
41
|
+
const rawY = e.clientY - offset.y;
|
|
42
|
+
|
|
43
|
+
const clampedX = Math.min(window.innerWidth - right - 120, Math.max(left, rawX));
|
|
44
|
+
const clampedY = Math.min(window.innerHeight - bottom - 120, Math.max(top, rawY));
|
|
45
|
+
|
|
46
|
+
setPos({ x: clampedX, y: clampedY });
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const handleMouseUp = () => {
|
|
50
|
+
setDragging(false);
|
|
51
|
+
dragMoved.current = false;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
56
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
57
|
+
return () => {
|
|
58
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
59
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
60
|
+
};
|
|
61
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const handleResize = () => {
|
|
66
|
+
if (!dragging) {
|
|
67
|
+
dockPos.current = { x: window.innerWidth - 80, y: window.innerHeight - 80 };
|
|
68
|
+
setPos(dockPos.current);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
window.addEventListener("resize", handleResize);
|
|
72
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
73
|
+
}, [dragging]);
|
|
74
|
+
|
|
75
|
+
// Badge placement relative to orb
|
|
76
|
+
const badgeSide = pos.x > window.innerWidth / 2 ? "left" : "right";
|
|
77
|
+
const badgeStyle =
|
|
78
|
+
badgeSide === "left"
|
|
79
|
+
? ({ right: 120 + 10 } as const)
|
|
80
|
+
: ({ left: 120 + 10 } as const);
|
|
81
|
+
|
|
82
|
+
// Gentle "string" connector between orb and badge (bezier-ish + subtle wobble)
|
|
83
|
+
const connectorKey = `${badgeSide}:${open ? "open" : "closed"}`;
|
|
84
|
+
const connector = useMemo(() => {
|
|
85
|
+
const radius = 30; // roughly the orb radius (60/2)
|
|
86
|
+
|
|
87
|
+
// Anchor points are in the 80x80 relative box space.
|
|
88
|
+
// orb center at (40,40). string attaches to left/right edge depending on badgeSide.
|
|
89
|
+
const start = {
|
|
90
|
+
// Exit slightly above center so it feels like it comes from the orb edge
|
|
91
|
+
x: badgeSide === "left" ? 40 - radius + 1 : 40 + radius - 1,
|
|
92
|
+
y: 40 - 11,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Badge is positioned at: top: -10; left/right: 130; width: 332
|
|
96
|
+
// So the edge nearest the orb is at x = 130 for right-side, or x = -? for left-side.
|
|
97
|
+
// We draw the SVG in the same 80x80 box but with overflow visible.
|
|
98
|
+
// We'll set end point near the badge edge, slightly inset.
|
|
99
|
+
const end = {
|
|
100
|
+
// Attach closer to the badge border, a bit higher than center
|
|
101
|
+
x: badgeSide === "left" ? -82 : 162,
|
|
102
|
+
y: 18,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const dx = end.x - start.x;
|
|
106
|
+
const dy = end.y - start.y;
|
|
107
|
+
|
|
108
|
+
// Control points: create a gentle sag + curve. Direction changes with side.
|
|
109
|
+
const c1 = {
|
|
110
|
+
x: start.x + dx * 0.35,
|
|
111
|
+
y: start.y + dy * 0.15 + 10,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const c2 = {
|
|
115
|
+
x: start.x + dx * 0.7,
|
|
116
|
+
y: start.y + dy * 0.75 + 6,
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const d = `M ${start.x} ${start.y} C ${c1.x} ${c1.y}, ${c2.x} ${c2.y}, ${end.x} ${end.y}`;
|
|
120
|
+
|
|
121
|
+
return { d, start, end };
|
|
122
|
+
}, [badgeSide]);
|
|
123
|
+
|
|
124
|
+
return (
|
|
125
|
+
<>
|
|
126
|
+
<GlobalStyles
|
|
127
|
+
styles={{
|
|
128
|
+
"@keyframes float": {
|
|
129
|
+
"0%,100%": { transform: "translateY(0) scale(1)", borderRadius: "50%" },
|
|
130
|
+
"25%": {
|
|
131
|
+
transform: "translateY(-6px) scale(1.05)",
|
|
132
|
+
borderRadius: "55% 45% 60% 40% / 60% 55% 45% 40%",
|
|
133
|
+
},
|
|
134
|
+
"50%": {
|
|
135
|
+
transform: "translateY(-8px) scale(1.1)",
|
|
136
|
+
borderRadius: "50% 60% 40% 55% / 55% 40% 60% 45%",
|
|
137
|
+
},
|
|
138
|
+
"75%": {
|
|
139
|
+
transform: "translateY(-6px) scale(1.05)",
|
|
140
|
+
borderRadius: "45% 55% 40% 60% / 40% 60% 55% 50%",
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
"@keyframes glow": {
|
|
144
|
+
"0%,100%": {
|
|
145
|
+
opacity: 0.3,
|
|
146
|
+
boxShadow:
|
|
147
|
+
"0 0 4px rgba(255,255,255,0.2), 0 0 8px rgba(173,216,230,0.1)",
|
|
148
|
+
},
|
|
149
|
+
"50%": {
|
|
150
|
+
opacity: 0.5,
|
|
151
|
+
boxShadow:
|
|
152
|
+
"0 0 6px rgba(255,255,255,0.3), 0 0 10px rgba(173,216,230,0.15)",
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
"@keyframes blobMove": {
|
|
156
|
+
"0%,100%": {
|
|
157
|
+
top: "15%",
|
|
158
|
+
left: "20%",
|
|
159
|
+
width: "65%",
|
|
160
|
+
height: "65%",
|
|
161
|
+
borderRadius: "60% 40% 55% 45% / 50% 60% 40% 50%",
|
|
162
|
+
filter: "blur(14px)",
|
|
163
|
+
},
|
|
164
|
+
"33%": {
|
|
165
|
+
top: "10%",
|
|
166
|
+
left: "25%",
|
|
167
|
+
width: "70%",
|
|
168
|
+
height: "70%",
|
|
169
|
+
borderRadius: "55% 60% 40% 45% / 45% 50% 60% 55%",
|
|
170
|
+
filter: "blur(18px)",
|
|
171
|
+
},
|
|
172
|
+
"66%": {
|
|
173
|
+
top: "18%",
|
|
174
|
+
left: "15%",
|
|
175
|
+
width: "60%",
|
|
176
|
+
height: "60%",
|
|
177
|
+
borderRadius: "50% 55% 45% 60% / 60% 50% 55% 40%",
|
|
178
|
+
filter: "blur(12px)",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
"@keyframes stringWobble": {
|
|
182
|
+
"0%,100%": { transform: "translateY(0px)" },
|
|
183
|
+
"50%": { transform: "translateY(0.6px)" },
|
|
184
|
+
},
|
|
185
|
+
}}
|
|
186
|
+
/>
|
|
187
|
+
|
|
188
|
+
<Box
|
|
189
|
+
sx={{
|
|
190
|
+
position: "fixed",
|
|
191
|
+
left: pos.x - 20,
|
|
192
|
+
top: pos.y - 20,
|
|
193
|
+
width: 120,
|
|
194
|
+
height: 120,
|
|
195
|
+
borderRadius: "12px",
|
|
196
|
+
border: open ? "2px solid rgba(255,255,255,0.25)" : "2px solid transparent",
|
|
197
|
+
background: open ? "rgba(0,0,0,0.1)" : "transparent",
|
|
198
|
+
backdropFilter: open ? "blur(12px)" : "none",
|
|
199
|
+
boxShadow: open ? "0 0 18px rgba(0,0,0,0.25)" : "none",
|
|
200
|
+
display: "flex",
|
|
201
|
+
alignItems: "center",
|
|
202
|
+
justifyContent: "center",
|
|
203
|
+
pointerEvents: "none",
|
|
204
|
+
zIndex: 1400,
|
|
205
|
+
}}
|
|
206
|
+
>
|
|
207
|
+
<Box
|
|
208
|
+
sx={{
|
|
209
|
+
position: "relative",
|
|
210
|
+
width: 80,
|
|
211
|
+
height: 80,
|
|
212
|
+
pointerEvents: "none",
|
|
213
|
+
overflow: "visible",
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
{/* Gentle connector string (only when open) */}
|
|
217
|
+
{open ? (
|
|
218
|
+
<Box
|
|
219
|
+
key={connectorKey}
|
|
220
|
+
sx={{
|
|
221
|
+
position: "absolute",
|
|
222
|
+
inset: 0,
|
|
223
|
+
overflow: "visible",
|
|
224
|
+
pointerEvents: "none",
|
|
225
|
+
opacity: 0.55,
|
|
226
|
+
animation: "stringWobble 4.2s ease-in-out infinite",
|
|
227
|
+
filter: "drop-shadow(0 2px 6px rgba(0,0,0,0.18))",
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
<svg
|
|
231
|
+
width="80"
|
|
232
|
+
height="80"
|
|
233
|
+
viewBox="0 0 80 80"
|
|
234
|
+
style={{ overflow: "visible" }}
|
|
235
|
+
aria-hidden="true"
|
|
236
|
+
>
|
|
237
|
+
<defs>
|
|
238
|
+
<linearGradient id="meStringAbs" x1="0" y1="0" x2="1" y2="0">
|
|
239
|
+
<stop offset="0%" stopColor={theme.palette.primary.main} stopOpacity="0.0" />
|
|
240
|
+
<stop offset="45%" stopColor={theme.palette.primary.main} stopOpacity="0.18" />
|
|
241
|
+
<stop offset="100%" stopColor={theme.palette.primary.main} stopOpacity="0.0" />
|
|
242
|
+
</linearGradient>
|
|
243
|
+
</defs>
|
|
244
|
+
|
|
245
|
+
{/* thin abstract stroke */}
|
|
246
|
+
<path
|
|
247
|
+
d={connector.d}
|
|
248
|
+
fill="none"
|
|
249
|
+
stroke="url(#meStringAbs)"
|
|
250
|
+
strokeWidth="1.15"
|
|
251
|
+
strokeLinecap="round"
|
|
252
|
+
strokeLinejoin="round"
|
|
253
|
+
opacity="0.85"
|
|
254
|
+
/>
|
|
255
|
+
|
|
256
|
+
{/* little endpoint dot near badge edge */}
|
|
257
|
+
<circle
|
|
258
|
+
cx={connector.end.x}
|
|
259
|
+
cy={connector.end.y}
|
|
260
|
+
r="1.1"
|
|
261
|
+
fill={theme.palette.primary.main}
|
|
262
|
+
opacity="0.45"
|
|
263
|
+
/>
|
|
264
|
+
</svg>
|
|
265
|
+
</Box>
|
|
266
|
+
) : null}
|
|
267
|
+
|
|
268
|
+
{/* Badge popover */}
|
|
269
|
+
{open ? (
|
|
270
|
+
<Box
|
|
271
|
+
sx={{
|
|
272
|
+
position: "absolute",
|
|
273
|
+
top: -10,
|
|
274
|
+
...badgeStyle,
|
|
275
|
+
width: 332,
|
|
276
|
+
borderRadius: "16px",
|
|
277
|
+
border: "1px solid rgba(255,255,255,0.18)",
|
|
278
|
+
background:
|
|
279
|
+
theme.palette?.mode === "light"
|
|
280
|
+
? "rgba(255,255,255,0.55)"
|
|
281
|
+
: "rgba(10,14,18,0.55)",
|
|
282
|
+
backdropFilter: "blur(14px) saturate(160%)",
|
|
283
|
+
boxShadow: "0 20px 60px rgba(0,0,0,0.35)",
|
|
284
|
+
overflow: "hidden",
|
|
285
|
+
pointerEvents: "auto",
|
|
286
|
+
}}
|
|
287
|
+
>
|
|
288
|
+
<Box
|
|
289
|
+
sx={{
|
|
290
|
+
px: 1.25,
|
|
291
|
+
py: 0.9,
|
|
292
|
+
display: "flex",
|
|
293
|
+
alignItems: "center",
|
|
294
|
+
justifyContent: "space-between",
|
|
295
|
+
gap: 1,
|
|
296
|
+
borderBottom: "1px solid rgba(255,255,255,0.12)",
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
<Box
|
|
300
|
+
sx={{
|
|
301
|
+
fontSize: 12,
|
|
302
|
+
fontWeight: 800,
|
|
303
|
+
letterSpacing: 0.6,
|
|
304
|
+
textTransform: "uppercase",
|
|
305
|
+
color: theme.palette?.mode === "light" ? "#005a7a" : "#baf3ff",
|
|
306
|
+
userSelect: "none",
|
|
307
|
+
}}
|
|
308
|
+
>
|
|
309
|
+
Identity Noise
|
|
310
|
+
</Box>
|
|
311
|
+
|
|
312
|
+
<Box
|
|
313
|
+
onClick={() => setOpen(false)}
|
|
314
|
+
sx={{
|
|
315
|
+
width: 26,
|
|
316
|
+
height: 26,
|
|
317
|
+
borderRadius: "10px",
|
|
318
|
+
display: "flex",
|
|
319
|
+
alignItems: "center",
|
|
320
|
+
justifyContent: "center",
|
|
321
|
+
cursor: "pointer",
|
|
322
|
+
color: theme.palette?.mode === "light" ? "#005a7a" : "#baf3ff",
|
|
323
|
+
background: "rgba(255,255,255,0.08)",
|
|
324
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
325
|
+
userSelect: "none",
|
|
326
|
+
"&:hover": {
|
|
327
|
+
background: "rgba(255,255,255,0.14)",
|
|
328
|
+
},
|
|
329
|
+
}}
|
|
330
|
+
aria-label="Close"
|
|
331
|
+
>
|
|
332
|
+
×
|
|
333
|
+
</Box>
|
|
334
|
+
</Box>
|
|
335
|
+
|
|
336
|
+
<Box sx={{ p: 1.0 }}>
|
|
337
|
+
<Triad />
|
|
338
|
+
</Box>
|
|
339
|
+
</Box>
|
|
340
|
+
) : null}
|
|
341
|
+
|
|
342
|
+
<Box
|
|
343
|
+
onClick={() => {
|
|
344
|
+
if (clickTimeout.current !== null) {
|
|
345
|
+
const elapsed = Date.now() - clickTimeout.current;
|
|
346
|
+
if (!dragging && !dragMoved.current && elapsed < 300) {
|
|
347
|
+
setOpen((prev) => !prev);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}}
|
|
351
|
+
onMouseDown={handleMouseDown}
|
|
352
|
+
sx={(t: Theme) => ({
|
|
353
|
+
position: "absolute",
|
|
354
|
+
top: 10,
|
|
355
|
+
left: 10,
|
|
356
|
+
width: 60,
|
|
357
|
+
height: 60,
|
|
358
|
+
borderRadius: "50%",
|
|
359
|
+
background: t.palette.mode === "light" ? "rgba(255,255,255,0.35)" : "rgba(255,255,255,0.1)",
|
|
360
|
+
boxShadow:
|
|
361
|
+
!status.active || status.error
|
|
362
|
+
? "0 0 0 3px #ff4d4d, 0 0 20px 6px rgba(255,0,0,0.6)"
|
|
363
|
+
: "0 0 0 3px #29bfff, 0 0 22px 6px rgba(0,200,255,0.6)",
|
|
364
|
+
border: !status.active || status.error ? "2.5px solid #ff1a1a" : "2.5px solid #9ff6ff",
|
|
365
|
+
display: "flex",
|
|
366
|
+
alignItems: "center",
|
|
367
|
+
justifyContent: "center",
|
|
368
|
+
fontSize: 26,
|
|
369
|
+
color: t.palette.mode === "light" ? "#006699" : "#baf3ff",
|
|
370
|
+
cursor: "pointer",
|
|
371
|
+
userSelect: "none",
|
|
372
|
+
animation: "float 6s ease-in-out infinite, glow 4.5s ease-in-out infinite",
|
|
373
|
+
backdropFilter: "blur(10px) saturate(160%)",
|
|
374
|
+
pointerEvents: "auto",
|
|
375
|
+
"&::before": {
|
|
376
|
+
content: '""',
|
|
377
|
+
position: "absolute",
|
|
378
|
+
top: "15%",
|
|
379
|
+
left: "20%",
|
|
380
|
+
width: "65%",
|
|
381
|
+
height: "65%",
|
|
382
|
+
background:
|
|
383
|
+
t.palette.mode === "light"
|
|
384
|
+
? "radial-gradient(circle at 50% 50%, rgba(0,102,153,0.4) 0%, rgba(0,68,102,0) 70%)"
|
|
385
|
+
: "radial-gradient(circle at 50% 50%, rgba(120,240,255,0.3) 0%, rgba(173,216,230,0) 70%)",
|
|
386
|
+
filter: "blur(7px)",
|
|
387
|
+
borderRadius: "60% 40% 55% 45% / 50% 60% 40% 50%",
|
|
388
|
+
animation: "blobMove 8s ease-in-out infinite",
|
|
389
|
+
pointerEvents: "none",
|
|
390
|
+
mixBlendMode: "screen",
|
|
391
|
+
},
|
|
392
|
+
"&:hover": {
|
|
393
|
+
transform: "scale(1.08)",
|
|
394
|
+
},
|
|
395
|
+
})}
|
|
396
|
+
>
|
|
397
|
+
⊙
|
|
398
|
+
</Box>
|
|
399
|
+
</Box>
|
|
400
|
+
</Box>
|
|
401
|
+
</>
|
|
402
|
+
);
|
|
403
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import IndentityNoise from "./IdentityNoise";
|
|
3
|
+
const meta: Meta<typeof IndentityNoise> = {
|
|
4
|
+
title: "Identity Noise",
|
|
5
|
+
component: IndentityNoise,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "fullscreen",
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof IndentityNoise>;
|
|
13
|
+
export const Default: Story = {
|
|
14
|
+
render: () => <IndentityNoise />,
|
|
15
|
+
};
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import Noise from './Noise';
|
|
4
|
+
import { Box, Button, Typography } from '@/gui/components/atoms';
|
|
5
|
+
// A tiny in-memory ME mock so stories can run without app kernel wiring.
|
|
6
|
+
// It supports the two calling forms we need:
|
|
7
|
+
// me(pathString) -> get
|
|
8
|
+
// me.some.path[op](value) -> set (via Proxy)
|
|
9
|
+
function createMeMock() {
|
|
10
|
+
const store = new Map<string, any>();
|
|
11
|
+
|
|
12
|
+
const normalize = (p: string) =>
|
|
13
|
+
String(p ?? '')
|
|
14
|
+
.trim()
|
|
15
|
+
.replace(/^\./, '')
|
|
16
|
+
.replace(/\.+/g, '.')
|
|
17
|
+
.replace(/\.$/, '');
|
|
18
|
+
|
|
19
|
+
const rootFn: any = (path?: any) => {
|
|
20
|
+
if (typeof path === 'string') return store.get(normalize(path));
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const makeProxy = (basePath: string) =>
|
|
25
|
+
new Proxy(() => undefined, {
|
|
26
|
+
get(_t, prop: string | symbol) {
|
|
27
|
+
if (typeof prop === 'symbol') return undefined;
|
|
28
|
+
// allow console debugging convenience
|
|
29
|
+
if (prop === '__store') return store;
|
|
30
|
+
|
|
31
|
+
const key = String(prop);
|
|
32
|
+
// operator call: basePath["@"], basePath["="], etc
|
|
33
|
+
if (key.startsWith('[') && key.endsWith(']')) {
|
|
34
|
+
const op = key.slice(1, -1);
|
|
35
|
+
return (value: any) => {
|
|
36
|
+
store.set(basePath, { op, value });
|
|
37
|
+
return me;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const next = basePath ? `${basePath}.${key}` : key;
|
|
42
|
+
return makeProxy(next);
|
|
43
|
+
},
|
|
44
|
+
apply(_t, _thisArg, args: any[]) {
|
|
45
|
+
// Treat calling a proxy as a write at that path with implicit '='
|
|
46
|
+
const value = args.length <= 1 ? args[0] : args;
|
|
47
|
+
store.set(basePath, { op: '=', value });
|
|
48
|
+
return me;
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const me: any = new Proxy(rootFn, {
|
|
53
|
+
get(_t, prop: string | symbol) {
|
|
54
|
+
if (typeof prop === 'symbol') return undefined;
|
|
55
|
+
return makeProxy(String(prop));
|
|
56
|
+
},
|
|
57
|
+
apply(_t, _thisArg, args: any[]) {
|
|
58
|
+
// me("a.b") -> read
|
|
59
|
+
if (args.length === 1 && typeof args[0] === 'string') {
|
|
60
|
+
return store.get(normalize(args[0]));
|
|
61
|
+
}
|
|
62
|
+
return me;
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return me;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const meta: Meta<typeof Noise> = {
|
|
70
|
+
title: 'Components/Noise',
|
|
71
|
+
component: Noise,
|
|
72
|
+
tags: ['autodocs'],
|
|
73
|
+
decorators: [
|
|
74
|
+
(Story) => (
|
|
75
|
+
<div style={{ padding: 16, minHeight: 320, maxWidth: 920 }}>
|
|
76
|
+
<Story />
|
|
77
|
+
</div>
|
|
78
|
+
),
|
|
79
|
+
],
|
|
80
|
+
parameters: {
|
|
81
|
+
docs: {
|
|
82
|
+
description: {
|
|
83
|
+
component: `
|
|
84
|
+
A **Noise** input is a small declarative bridge between UI and a semantic ME tree.
|
|
85
|
+
|
|
86
|
+
- It can write values through an operator (e.g. \`@\`, \`=\`, \`_\`, \`~\`).
|
|
87
|
+
- It supports compact layout (e.g. 25% width) and a **check** commit button.
|
|
88
|
+
- Optional info icon opens your **Modal** molecule (if enabled in the component).
|
|
89
|
+
|
|
90
|
+
Stories use a tiny in-memory ME mock so they can render standalone.
|
|
91
|
+
`.trim(),
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export default meta;
|
|
98
|
+
|
|
99
|
+
type Story = StoryObj<typeof Noise>;
|
|
100
|
+
|
|
101
|
+
export const UsernameIdentity: Story = {
|
|
102
|
+
name: 'Identity (@) with check',
|
|
103
|
+
render: () => {
|
|
104
|
+
const me = React.useMemo(() => createMeMock(), []);
|
|
105
|
+
return (
|
|
106
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
|
107
|
+
<Noise
|
|
108
|
+
me={me}
|
|
109
|
+
path="profile"
|
|
110
|
+
operator="@"
|
|
111
|
+
placeholder="username"
|
|
112
|
+
width="25%"
|
|
113
|
+
showCheck
|
|
114
|
+
/>
|
|
115
|
+
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
|
|
116
|
+
Tip: type a username and click the check icon to commit the identity ref.
|
|
117
|
+
</Typography>
|
|
118
|
+
</Box>
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const InlineValueReadout: Story = {
|
|
124
|
+
name: 'Readout (shows last committed)',
|
|
125
|
+
render: () => {
|
|
126
|
+
const me = React.useMemo(() => createMeMock(), []);
|
|
127
|
+
const [tick, setTick] = React.useState(0);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
|
131
|
+
<Noise
|
|
132
|
+
me={me}
|
|
133
|
+
path="profile.name"
|
|
134
|
+
operator="="
|
|
135
|
+
label="Name"
|
|
136
|
+
placeholder="profile.name"
|
|
137
|
+
width={{ xs: '100%', sm: '50%', md: '25%' } as any}
|
|
138
|
+
showCheck
|
|
139
|
+
/>
|
|
140
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
141
|
+
<Typography variant="caption" sx={{ color: 'text.secondary' }}>
|
|
142
|
+
Last committed at <code>profile.name</code>:
|
|
143
|
+
</Typography>
|
|
144
|
+
<Typography variant="caption" sx={{ fontFamily: 'monospace' }}>
|
|
145
|
+
{JSON.stringify((me as any)('profile.name') ?? null)}
|
|
146
|
+
</Typography>
|
|
147
|
+
<Button size="small" variant="outlined" onClick={() => setTick((t) => t + 1)}>
|
|
148
|
+
refresh
|
|
149
|
+
</Button>
|
|
150
|
+
</Box>
|
|
151
|
+
</Box>
|
|
152
|
+
);
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const CompactRow: Story = {
|
|
157
|
+
name: 'Compact row (25% width)',
|
|
158
|
+
render: () => {
|
|
159
|
+
const me = React.useMemo(() => createMeMock(), []);
|
|
160
|
+
return (
|
|
161
|
+
<Box sx={{ display: 'flex', gap: 2, alignItems: 'center', flexWrap: 'wrap' }}>
|
|
162
|
+
<Noise
|
|
163
|
+
me={me}
|
|
164
|
+
path="blockchain.url"
|
|
165
|
+
operator="="
|
|
166
|
+
label="Blockchain URL"
|
|
167
|
+
placeholder="http://localhost:8161"
|
|
168
|
+
width="25%"
|
|
169
|
+
showCheck
|
|
170
|
+
/>
|
|
171
|
+
<Noise
|
|
172
|
+
me={me}
|
|
173
|
+
path="blockchain.port"
|
|
174
|
+
operator="="
|
|
175
|
+
label="Port"
|
|
176
|
+
placeholder="8161"
|
|
177
|
+
width={140 as any}
|
|
178
|
+
showCheck
|
|
179
|
+
/>
|
|
180
|
+
</Box>
|
|
181
|
+
);
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export const ResponsiveWidth: Story = {
|
|
186
|
+
name: 'Responsive width',
|
|
187
|
+
render: () => {
|
|
188
|
+
const me = React.useMemo(() => createMeMock(), []);
|
|
189
|
+
return (
|
|
190
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
|
|
191
|
+
<Noise
|
|
192
|
+
me={me}
|
|
193
|
+
path="blockchain.url"
|
|
194
|
+
operator="="
|
|
195
|
+
label="Blockchain"
|
|
196
|
+
placeholder="blockchain"
|
|
197
|
+
width={{ xs: '100%', sm: '60%', md: '40%', lg: '25%' } as any}
|
|
198
|
+
showCheck
|
|
199
|
+
/>
|
|
200
|
+
<Typography variant="caption" sx={{ color: 'text.secondary' }}>
|
|
201
|
+
Resize the preview to see width adapt across breakpoints.
|
|
202
|
+
</Typography>
|
|
203
|
+
</Box>
|
|
204
|
+
);
|
|
205
|
+
},
|
|
206
|
+
};
|