@flamingo-stack/openframe-frontend-core

中文文档
0.0.831发布于 2026/11/01TypeScriptESM + CJS

Shared design system and components for all Flamingo platforms

原始使用文档
文档目录16 节
  1. Installation
  2. Usage
  3. Components
  4. Hooks
  5. Utilities
  6. Styles
  7. Tailwind Config
  8. Package Exports
  9. Design System (ODS)
  10. Tailwind Merge Configuration
  11. Platform Support
  12. Development
  13. Architecture
  14. Tutorials
  15. Key Dependencies
  16. License

@flamingo-stack/openframe-frontend-core

Shared design system and component library for Flamingo platforms (OpenMSP, OpenFrame, Admin Hub, Flamingo Website, TMCG).

Installation

npm install https://pkg.pr.new/flamingo-stack/openframe-oss-lib/@flamingo-stack/openframe-frontend-core@<x.y.z>

Usage

Components

import { Button, Card, Input, Modal, Tag } from '@flamingo-stack/openframe-frontend-core/components/ui'
import { YouTubeEmbed, FigmaPrototypeViewer } from '@flamingo-stack/openframe-frontend-core/components/features'
import { GithubIcon, OpenframeLogoIcon } from '@flamingo-stack/openframe-frontend-core/components/icons-v2'

Hooks

import { useDebounce, useMediaQuery, useToast } from '@flamingo-stack/openframe-frontend-core/hooks'

Utilities

import { cn, formatDate, formatPrice, getPlatformUrl } from '@flamingo-stack/openframe-frontend-core/utils'

Styles

// Import in your layout or _app.tsx
import '@flamingo-stack/openframe-frontend-core/styles'

Tailwind Config

Extend the shared Tailwind config in your project:

import designSystemConfig from '@flamingo-stack/openframe-frontend-core/tailwind.config.ts'
import { appStyleSources } from '@flamingo-stack/openframe-frontend-core/style-sources'

export default {
  presets: [designSystemConfig],
  // The files your App Router routes import, yours and this library's: never this library's whole
  // `dist` or `src`, which puts every component's classes in the stylesheet every page blocks on.
  content: appStyleSources({ root: __dirname, appDir: 'src/app' }),
}

appStyleSources (scripts/style-sources.cjs) walks the import graph from the route files, tree-shaken as your bundler does. A host can leave the lazily loaded chat out of the page's stylesheet with firstPaint: true, and give EmbeddableChat a loadStyles that loads a full stylesheet built without it (see the file's header).

Then send the stylesheet inside each page's HTML, so a page never waits on a second request to paint, and hold its size to a budget in your checks (scripts/next-styles.cjs says why and what it costs):

// next.config.mjs
import { withInlineStyles } from '@flamingo-stack/openframe-frontend-core/next-styles'
export default withInlineStyles(nextConfig)
node node_modules/@flamingo-stack/openframe-frontend-core/dist/build/next-styles.cjs budget \
  --input src/app/globals.css --config tailwind.config.ts --budget 31500

Package Exports

Export PathDescription
.Main entry (all components, hooks, utils)
./components/uiBase UI components (Button, Card, Input, Modal, Tag, etc.)
./components/featuresComplex components (YouTubeEmbed, FigmaPrototypeViewer, AuthProvidersList)
./components/icons-v2Generated icon set
./components/navigationNavigation components (Header, StickySectionNav)
./components/toastToast notification system
./hooksReact hooks (useDebounce, useMediaQuery, useToast, etc.)
./utilsUtilities (cn, formatDate, formatPrice, getPlatformUrl, platform-config)
./typesTypeScript type definitions
./stylesCSS styles and ODS design tokens
./style-sourcesTailwind content for an app: the files its routes import (appStyleSources)
./next-stylesThe stylesheet inside each page's HTML (withInlineStyles) and its size gate (measureStylesheet, budget command)
./natsNATS WebSocket utilities
./fontsFont configuration

Design System (ODS)

The package includes the OpenFrame Design System (ODS) with:

  • CSS Variables — Design tokens as custom properties
  • Responsive Typography — text-h1 through text-h6 utilities via Tailwind plugin
  • Platform Theming — Automatic color adaptation based on NEXT_PUBLIC_APP_TYPE
  • Breakpoints — md: 800px, lg: 1280px, xl: 1440px (mobile-first)

Tailwind Merge Configuration

The cn() utility extends tailwind-merge to recognize ODS typography classes (text-h1–text-h6) as a separate group, so they don't conflict with text-color classes:

import { cn } from '@flamingo-stack/openframe-frontend-core/utils'

// text-h5 and text-red-500 coexist correctly
cn('text-h5', 'text-red-500') // => "text-h5 text-red-500"

Platform Support

PlatformApp TypeAccent Color
OpenMSPopenmspYellow (#FFC008)
OpenFrameopenframeCyan (#5EFAF0)
FlamingoflamingoPink (#FF6B6B)
Admin Hubadmin-hubPink (#F357BB)
Flamingo Teaserflamingo-teaserPink
TMCGtmcgPurple (#8B5CF6)

Platform detection is automatic via NEXT_PUBLIC_APP_TYPE environment variable.

Development

# Build the package
npm run build

# Build without type declarations (faster)
npm run build:fast

# Watch mode
npm run dev

# Type checking
npm run type-check

# Run tests
npm run test

# Storybook
npm run storybook

# Publish via yalc (local development)
npm run yalc:push
npm run yalc:watch

Architecture

src/
  components/
    ui/           # Base components (Button, Card, Input, Modal, Tag, etc.)
    features/     # Complex components (YouTubeEmbed, FigmaPrototypeViewer)
    icons/        # Centralized icon components
    icons-v2-generated/  # Auto-generated icon set
    navigation/   # Header, StickySectionNav
    toast/        # Toast notification system
  hooks/
    ui/           # UI hooks (useDebounce, useMediaQuery)
    api/          # Data fetching hooks
    platform/     # Platform configuration hooks
  styles/
    index.css     # Main stylesheet
    ods-*.css     # Design token modules
  utils/
    cn.ts         # clsx + tailwind-merge
    platform-config.tsx  # Unified platform configuration
  types/          # TypeScript type definitions
  nats/           # NATS WebSocket integration

Tutorials

End-to-end guides under docs/:

  • MIGRATING_COMPONENTS.md — how to move a component from the hub into this lib (3-layer model, barrel rules, runtime-context injection).
  • EMBEDDING.md — runtime providers (EndpointsRuntimeContext, ChatRuntimeContext) for non-hub React apps.
  • EMBEDDING_DOCS_HUB.md — embed <DocsHubPage> (sidebar tree + content + RAG search bar) in a third-party app. The hub uses this same component at /knowledge-base and /data-room.
  • CHAT_EMBEDDING_TUTORIAL.md — embed the full <EmbeddableChat> panel (Guide + Mingo modes).
  • EMBEDDING_HUBSPOT_MEETINGS.md — embed <HubSpotMeetingScheduler> (natively-branded HubSpot booking flow) behind a host proxy; includes the link naming convention and the proxy endpoint contract.

Key Dependencies

  • React 18+/19 — Peer dependency
  • Radix UI — Accessible component primitives
  • Tailwind CSS 3 — Styling with custom design tokens
  • Class Variance Authority — Component variant management
  • Framer Motion — Animations
  • Lucide React — Icons

License

Private package for Flamingo CX projects.

版本与发布记录

@flamingo-stack/openframe-frontend-core 共发布 2,167 个版本,首次发布于 2026/02/12;过去 12 个月发布了 2167 个版本。

版本发布日期距今
0.0.831latest2026/11/012 天前
0.0.8302026/11/012 天前
0.0.8292026/11/012 天前
0.0.8282026/10/313 天前
0.0.8272026/10/313 天前
0.0.8262026/10/313 天前

其他发布通道:pr-1640 → 0.0.512-1640.4221.1,pr-1642 → 0.0.513-1642.4228.1,pr-1647 → 0.0.514-1647.4247.1,pr-1598 → 0.0.515-1598.4250.1,pr-1648 → 0.0.515-1648.4254.1,pr-1651 → 0.0.517-1651.4265.1。

关于 @flamingo-stack/openframe-frontend-core 的常见问题

@flamingo-stack/openframe-frontend-core 是什么?

所有Flamingo平台的共享设计系统和组件

如何安装 @flamingo-stack/openframe-frontend-core?

在项目目录运行 npm install @flamingo-stack/openframe-frontend-core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:next(^15.0.0 || ^16.0.0)、react(^18.0.0 || ^19.0.0)、react-dom(^18.0.0 || ^19.0.0)、@tanstack/react-query(^5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 next-styles,可以用 npx next-styles 直接运行。

@flamingo-stack/openframe-frontend-core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flamingo-stack/openframe-frontend-core 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@flamingo-stack/openframe-frontend-core 可以商用吗?

@flamingo-stack/openframe-frontend-core 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@flamingo-stack/openframe-frontend-core 还在维护吗?

最新版本 0.0.831 发布于 2026/11/01(2 天前);至今共发布 2167 个版本,其中过去 12 个月发布了 2167 个;首次发布于 2026/02/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。