@flamingo-stack/openframe-frontend-core

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

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

中文使用文档
文档目录16 节
  1. 安装
  2. 使用
  3. 组件
  4. 钩子
  5. 公用事业公司
  6. 风格
  7. 顺风配置
  8. 包出口
  9. 设计系统(ODS)
  10. 顺风归并配置
  11. 平台支持
  12. 开发
  13. 体系结构
  14. 教程
  15. 关键依赖关系
  16. 许可证

@flamingo-stack / openframe-frontend-core

火烈鸟平台(OpenMSP, OpenFrame, Admin Hub, Flamingo Website, TMCG)的共享设计系统和组件库。

安装

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

使用

组件

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'

钩子

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

公用事业公司

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

风格

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

顺风配置

在项目中扩展共享的Tailwind配置:

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)从路由文件中遍历导入图,摇树 就像你的捆绑者一样。主机可以将惰性加载的聊天从页面的样式表中删除 firstPaint: true,并给予 EmbeddableChat 一个 loadStyles 这将加载构建的完整样式表 没有它(参见文件的头文件)。

然后将样式表发送到每个页面的HTML中,这样页面就不会等待第二次绘制请求, 把它的规模控制在你支票的预算之内。scripts/next-styles.cjs 说明原因和成本):

// 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

包出口

导出路径描述
.主入口(所有组件、钩子、utils)
./components/ui基本UI组件(按钮、卡片、输入、模态、标签等)
./components/features复杂组件(YouTubeEmbed, FigmaPrototypeViewer, AuthProvidersList)
./components/icons-v2生成的图标集
./components/navigation导航组件(Header, StickySectionNav)
./components/toast祝酒通知系统
./hooksReact钩子(useDebounce, useMediaQuery, useToast等)
./utils实用程序(cn, formatDate, formatPrice, getPlatformUrl, platform-config)
./typesTypeScript类型定义
./stylesCSS样式和ODS设计标记
./style-sources顺风 content 对于一个应用程序:它的路由导入文件(appStyleSources)
./next-styles每个页面的HTML (withInlineStyles)及其大小门(measureStylesheet, budget 命令)
./natsNATS WebSocket实用程序
./fonts字体配置

设计系统(ODS)

该软件包包括开放框架设计系统(ODS),具有:

  • CSS变量 -将令牌设计为自定义属性
  • 响应排版 - - - - - - text-h1 通过 text-h6 公用事业通过顺风插件
  • 平台主题 —基于自动色彩适应 NEXT_PUBLIC_APP_TYPE
  • 断点 - - - - - - md: 800px, lg: 1280px, xl: 1440px (尝试)

顺风归并配置

这个 cn() 实用程序扩展 tailwind-merge 识别ODS排版类(text-h1–text-h6)作为一个独立的群体,所以他们不冲突 text-color 类:

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"

平台支持

平台应用程序类型口音的颜色
OpenMSPopenmsp黄色(# FFC008)
OpenFrameopenframe青色(# 5 efaf0)
火烈鸟flamingo粉色(# FF6B6B)
管理中心admin-hub粉色(# F357BB)
火烈鸟急转弯flamingo-teaser粉红色的
TMCGtmcg紫色(# 8 b5cf6)

平台检测是自动通过 NEXT_PUBLIC_APP_TYPE 环境变量。

开发

# 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

体系结构

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

教程

端到端导览 docs/:

  • MIGRATING_COMPONENTS.md -如何将组件从hub移动到这个lib(3层模型,桶规则,运行时上下文注入)。
  • EMBEDDING.md -运行时提供程序(EndpointsRuntimeContext, ChatRuntimeContext)用于非hub React应用。
  • EMBEDDING_DOCS_HUB.md ——嵌入 <DocsHubPage> (侧边栏树+内容+ RAG搜索栏)在第三方应用程序。hub使用相同的组件在 /knowledge-base 和 /data-room.
  • CHAT_EMBEDDING_TUTORIAL.md -嵌入完整 <EmbeddableChat> 面板(向导+明戈模式)。
  • EMBEDDING_HUBSPOT_MEETINGS.md ——嵌入 <HubSpotMeetingScheduler> (本土品牌HubSpot预订流)背后的主机代理;包括链接命名约定和代理端点契约。

关键依赖关系

  • 18 + / 19反应 -同伴依赖
  • 基数UI -可访问的组件原语
  • 顺风CSS 3 -样式与自定义设计令牌
  • 类别变更授权 -组件变体管理
  • 筹划者运动 ——动画
  • Lucide反应 ——图标

许可证

用于Flamingo CX项目的私有包。

版本与发布记录

@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 和提交记录判断。