Storybook Design Token 项目教程
2024-09-27 16:50:00作者:彭桢灵Jeremy
1. 项目的目录结构及介绍
storybook-design-token/
├── addon/
│ ├── index.js
│ └── ...
├── docs/
│ ├── index.md
│ └── ...
├── .gitignore
├── .prettierignore
├── .prettierrc
├── LICENSE
├── README.md
└── ...
目录结构介绍
- addon/: 包含项目的核心功能代码,如插件的实现逻辑。
- docs/: 包含项目的文档文件,如README.md等。
- .gitignore: 指定Git版本控制系统忽略的文件和目录。
- .prettierignore: 指定Prettier代码格式化工具忽略的文件和目录。
- .prettierrc: Prettier代码格式化工具的配置文件。
- LICENSE: 项目的开源许可证文件。
- README.md: 项目的介绍和使用说明文档。
2. 项目的启动文件介绍
项目的启动文件主要是addon/index.js,该文件是插件的入口文件,负责初始化和配置插件的主要功能。
// addon/index.js
import { addons } from '@storybook/addons';
import { STORY_RENDERED } from '@storybook/core-events';
import { DesignTokenPanel } from './DesignTokenPanel';
addons.register('storybook-design-token', api => {
const channel = addons.getChannel();
channel.on(STORY_RENDERED, id => {
// 初始化逻辑
});
addons.addPanel('storybook-design-token/panel', {
title: 'Design Tokens',
render: ({ active, key }) => <DesignTokenPanel api={api} active={active} key={key} />,
});
});
启动文件介绍
- addons.register: 注册插件,初始化插件的主要功能。
- channel.on: 监听Storybook的事件,如
STORY_RENDERED,在故事渲染时执行相关逻辑。 - addons.addPanel: 添加插件的面板,用于在Storybook中显示设计令牌。
3. 项目的配置文件介绍
.prettierrc
{
"singleQuote": true,
"trailingComma": "all",
"printWidth": 80
}
.gitignore
node_modules/
dist/
*.log
LICENSE
MIT License
Copyright (c) 2023 UX-and-I
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
配置文件介绍
- .prettierrc: 配置Prettier代码格式化工具的规则,如单引号、尾随逗号和每行最大字符数。
- .gitignore: 指定Git忽略的文件和目录,如
node_modules/和dist/。 - LICENSE: 项目的开源许可证,采用MIT许可证。
通过以上内容,您可以了解Storybook Design Token项目的目录结构、启动文件和配置文件的基本情况。
登录后查看全文
热门项目推荐
PaddleOCR-VLPaddleOCR-VL 是一款顶尖且资源高效的文档解析专用模型。其核心组件为 PaddleOCR-VL-0.9B,这是一款精简却功能强大的视觉语言模型(VLM)。该模型融合了 NaViT 风格的动态分辨率视觉编码器与 ERNIE-4.5-0.3B 语言模型,可实现精准的元素识别。Python00- DDeepSeek-OCR暂无简介Python00
openPangu-Ultra-MoE-718B-V1.1昇腾原生的开源盘古 Ultra-MoE-718B-V1.1 语言模型Python00
HunyuanWorld-Mirror混元3D世界重建模型,支持多模态先验注入和多任务统一输出Python00
AI内容魔方AI内容专区,汇集全球AI开源项目,集结模块、可组合的内容,致力于分享、交流。03
Spark-Scilit-X1-13BFLYTEK Spark Scilit-X1-13B is based on the latest generation of iFLYTEK Foundation Model, and has been trained on multiple core tasks derived from scientific literature. As a large language model tailored for academic research scenarios, it has shown excellent performance in Paper Assisted Reading, Academic Translation, English Polishing, and Review Generation, aiming to provide efficient and accurate intelligent assistance for researchers, faculty members, and students.Python00
GOT-OCR-2.0-hf阶跃星辰StepFun推出的GOT-OCR-2.0-hf是一款强大的多语言OCR开源模型,支持从普通文档到复杂场景的文字识别。它能精准处理表格、图表、数学公式、几何图形甚至乐谱等特殊内容,输出结果可通过第三方工具渲染成多种格式。模型支持1024×1024高分辨率输入,具备多页批量处理、动态分块识别和交互式区域选择等创新功能,用户可通过坐标或颜色指定识别区域。基于Apache 2.0协议开源,提供Hugging Face演示和完整代码,适用于学术研究到工业应用的广泛场景,为OCR领域带来突破性解决方案。00- HHowToCook程序员在家做饭方法指南。Programmer's guide about how to cook at home (Chinese only).Dockerfile013
Spark-Chemistry-X1-13B科大讯飞星火化学-X1-13B (iFLYTEK Spark Chemistry-X1-13B) 是一款专为化学领域优化的大语言模型。它由星火-X1 (Spark-X1) 基础模型微调而来,在化学知识问答、分子性质预测、化学名称转换和科学推理方面展现出强大的能力,同时保持了强大的通用语言理解与生成能力。Python00- PpathwayPathway is an open framework for high-throughput and low-latency real-time data processing.Python00
项目优选
收起
OpenHarmony documentation | OpenHarmony开发者文档
Dockerfile
240
2.37 K
deepin linux kernel
C
24
6
React Native鸿蒙化仓库
JavaScript
216
291
暂无简介
Dart
539
118
仓颉编译器源码及 cjdb 调试工具。
C++
115
86
仓颉编程语言运行时与标准库。
Cangjie
122
97
🎉 (RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue3 & Vite、Element Plus 的前后端分离权限管理系统
Vue
999
589
本项目是CANN提供的数学类基础计算算子库,实现网络在NPU上加速计算。
C++
589
118
Ascend Extension for PyTorch
Python
78
111
仓颉编程语言提供了 stdx 模块,该模块提供了网络、安全等领域的通用能力。
Cangjie
80
56