@choiceform/interface-data-types
v0.1.1
Published
Type definitions and data structures for Interface project
Downloads
198
Readme
@choiceform/interface-data-types
Interface 项目的核心类型定义和数据结构包。
简介
这个包提供了 Interface 项目中使用的所有 TypeScript 类型定义和数据结构,包括页面、组件、节点、样式、交互等核心概念的类型定义。
安装
pnpm add @choiceform/interface-data-types主要模块
基础类型 (base)
IndexKey: 分数索引键类型StopLike: 渐变停止点类型AttrNumericValue: 数值属性类型
文件与页面 (file, page)
FileId: 文件标识符Page: 页面数据结构PageType: 页面类型(page | folder)BreakPointItem: 断点配置
组件 (component)
ComponentId: 组件标识符RawComponent: 组件数据结构
节点 (node)
NodeId: 节点标识符NodeType: 节点类型(FrameNode, RichTextNode, ComponentNode 等)LayoutType: 布局类型(stack | grid)- 节点属性:交互、链接、动效、页面效果、形状、样式、文本内容等
样式 (color, font, paint, style)
RGB,RGBA: 颜色类型- 字体相关类型
- 绘制相关类型
- 样式相关类型
交互与条件 (condition, variable)
- 条件判断类型
- 变量类型
预览 (preview)
PreviewData: 预览数据结构PreviewPageItem: 预览页面项PreviewNode: 预览节点
站点 (site)
SiteAttrs: 站点属性PageSiteAttrs: 页面站点属性SiteState: 站点状态SiteLanguage: 站点语言
工具类型 (util, math, code)
- 数学工具类型(BoxLike, PointLike 等)
- 代码相关类型
- 通用工具类型
使用示例
import type { Page, ComponentId, NodeType, PreviewData } from "@choiceform/interface-data-types"
// 使用页面类型
const page: Page = {
fileId: "file-123",
id: "page-123",
parentId: null,
index: "a0",
name: "/home",
type: "page",
siteAttrs: {
title: "Home",
description: "Home page",
language: "zh",
},
createdAt: Date.now(),
updatedAt: null,
}
// 使用节点类型
const nodeType: NodeType = "FrameNode"
// 使用预览数据类型
const previewData: PreviewData = {
pages: {},
mode: "page",
activePath: "/home",
}开发
构建
pnpm build开发模式(监听模式)
pnpm dev检查循环依赖
pnpm check:circular清理构建产物
pnpm clean发布
包会在发布前自动执行清理和构建:
pnpm prepublishOnlyLicense
MIT
