FC Extension Pack Specification
第一阶段:FC 扩展包 = 审核通过的声明式 manifest + 卡片配置 schema + 受限布局与交互(fc.cardType / fc.template / fc.panel / fc.action / fc.connectionType)。平台负责安全渲染、数据保存、权限检查与降级展示。
⚠ 以下手册中出现的 plugin.register、任意脚本、钩子、存储、通知等能力均为规划中,尚未上线,不代表已经可运行;请勿据此开发执行型插件。
✅ 能自定义 / 增加(展示层):一切你在网页上「看得到」的默认展示方式——所有动画、所有卡片的外观、所有菜单、主题配色、字体、背景、按钮、弹窗、布局、图标……
❌ 不能改(核心层):登录注册、数据存储、发布 / 审核逻辑、业务规则、账号安全等平台的「核心功能与结构」。
① What is a plugin?
A plugin is a piece of code that adds features to the platform without changing its core. Install one and your micronation gains new cards, themes, backgrounds or tools — like installing an app on your phone.
Plugins connect to the platform's reserved "sockets" (extension points), which keeps things safe and flexible. Writing a plugin = writing a manifest (who you are and what permissions you need) plus code (plugin.js, the logic that does the work).
FluidCanvas 扩展包 SDK
声明式扩展沿用卡片、模板和编辑器插槽。需要自定义渲染或逻辑时,可提交带入口文件的沙盒扩展。开发者可以使用 HTML、CSS、SVG、Canvas 或 WebGL 制作卡片、编辑器面板或工作区。
上传时填写 manifest,并提供包含源码文件的 JSON。每个版本单独审核。安装后,在 FluidCanvas 的 Workspace 设置中可以启用工具栏和卡片菜单的变更、选择布局及授予数据权限,也可以随时恢复官方界面。
扩展加载后可通过 FC.ready 读取当前卡片,使用 FC.render 绘制界面,通过 FC.on 监听事件。文章作者保存的预览默认可读,公开交互由读者主动开启。
本节描述 FC 扩展包的接入方式。下方通用平台插件示例中的接口需以对应产品的实际发布为准。
② Platform overview (which modules plugins can touch)
A plugin is not an isolated gadget: it can plug into these platform modules — each one maps to one or more extension points:
| Platform module | What it is | What plugins can do |
|---|---|---|
| 🌐 Site shell | Left menu, top bar, theme (colors/fonts/corner radius) | Add menu items, change skins, change backgrounds |
| ✏️ FluidCanvas editor | Card canvas editor (card types/edges/fonts/layers/merging) | Register new card types, edges, tools and fonts |
| 📄 Pages | Home/community/messages/activity/articles/subscription and more | Add panels and entry points |
| 👥 Social | Posts/comments/likes/reposts/follows/bookmarks | Subscribe to these events and trigger automatically |
| 📚 Articles | Writing, publishing and reading encyclopedia articles | Hook into publishing |
| 🖼 Gallery | Image upload, tags and search | Read image data (read-only) |
| 👑 Subscription | Four tiers: free/basic/premium/ultra | Set a minTier requirement |
| 🏆 Levels/achievements | User XP, badges and decorations | Read level data (read-only) |
| 🔔 Notifications | In-site notifications and announcements | Send notifications |
简言之:一切「看得到」的默认展示方式(动画、卡片外观、菜单、按钮、弹窗、布局、图标……)都能自定义或增加;「看不到」的核心功能与结构(登录、数据、业务规则……)不能改。
③ Platform entity reference (what maps to what here)
This is the key section — every ID and value used in a plugin maps to a real entity on the platform:
🃏 Card types (cardType) — existing cards; plugins can register new ones for the asset panel
| Card type ID | Name | Default size |
|---|---|---|
flag | Flag card | 8 wide × 5 long |
shield | Coat of arms card | 5 × 5 |
content | Content card | 8 × 4 text block |
text | Text card | Auto |
stats | Stats card | Auto |
sne | SNE index card | Auto |
sheet | Table card | 10 wide × 7 long |
timeline | Timeline card | Auto |
map | Territory map card | Auto |
✂️ Edge themes (edgeTheme) — existing edges; plugins can register new ones
| Edge ID | Name |
|---|---|
paper | Paper |
treasure | Treasure map |
tech | Tech (bevel) |
paint | Paint |
custom:* | Custom edge (AI-generated, e.g. custom:ce-mask1) |
注:内置边缘共 14 个主题,上表列出最常用的;插件注册新边缘用 edgeTheme 扩展点。
👑 Subscription tiers (tier) — the values used for plugin requirements
| Tier ID | Name | Order |
|---|---|---|
free | Free | 0 |
basic | Basic | 1 |
premium | Premium | 2 |
ultra | Ultra | 3 |
📄 Key pages (hosts of page-level extension points)
dashboardoverviewcommunity-hubmessagesactivityfluidcanvasarticlepremium🔤 Fonts (font) — plugins can attach fonts
平台内置 451 款字体,分 10 个语言组(拉丁 / 中文 / 日文 / 韩文 / 阿拉伯文 / 西里尔文等)。插件通过 ui.theme 能力覆盖字体变量,或注册新字体包。
✨ Animations (animation) — plugins can add opening animations
平台自带页面打开 / 切换动画(transitions.js)。插件通过 ui.animation 能力,为网页添加或替换自定义的开启动画、入场特效。
④ A plugin = two parts
1. manifest(清单):插件的「身份证」,告诉平台它叫什么、能干什么、需要什么权限。
2. 代码(plugin.js):真正干活的逻辑,按 manifest 里声明的能力去接扩展点。
⑤ Complete manifest reference
A manifest is a JSON object. Complete example:
{
"id": "my-weather-card",
"name": "天气卡",
"version": "1.0.0",
"author": "USR-000101",
"description": "在画布里添加实时天气卡片,支持多城市切换",
"icon": "⛅",
"preview": "linear-gradient(135deg,#4648d4,#7b7ff0)",
"category": "card",
"capabilities": ["cardType", "ui.menu", "storage"],
"minTier": "premium",
"tags": ["天气", "卡片"],
"license": "MIT"
}
| Field | Required | Description |
|---|---|---|
id | ✅ | Globally unique identifier: lowercase letters plus hyphens; "author-name" is recommended |
name | ✅ | Plugin display name |
version | ✅ | Version number, semantic |
author | ✅ | Author user ID (USR-xxxx) |
description | ✅ | One-sentence summary |
icon | Optional | Icon (emoji) |
preview | Optional | Preview image (CSS gradient or image URL) |
category | Optional | Category: card / theme / tool / general |
capabilities | ✅ | List of required permissions |
minTier | Optional | Initial subscription requirement; defaults to premium |
tags | Optional | Tag array to make store search easier |
license | Optional | License |
⑥ capabilities explained (capability → exact platform location)
Each capability maps to one or more specific locations on the platform:
| Capability | Where on the platform | What it can do |
|---|---|---|
ui.menu | Left sidebar navigation (12 menu items) | Add / edit / delete menu items |
ui.theme | Site-wide CSS design tokens (--color-* variables) | Override colors, fonts, corner radius and spacing |
ui.background | Page background and canvas background | Change background images and gradients |
ui.animation | Page opening / page transition animations (transitions.js) | Add custom opening animations and entrance effects |
cardType | FluidCanvas editor asset panel | Register new card types |
edgeTheme | Editor edge selector | Register new edge themes |
tool | Editor toolbar, context menu and shortcuts | Add buttons, menu items and shortcuts |
hook | Platform event system | Subscribe to events and run automatically |
storage | Plugin-specific key-value storage | Read and write settings |
notification | In-site notification system | Send notifications |
⚠️ 能力沙箱:插件只能调用自己声明过的能力,声明之外的调用会被平台直接拦下。
⑦ Complete API reference
插件代码里通过全局 plugin 对象调用平台 API。以下是完整 API(规划,随执行引擎逐步开放):
// 注册插件主体(一个插件只调一次)
plugin.register({
id: 'my-weather-card', // 与 manifest.id 一致
cardType: { /* 见下方 */ },
menuItem: { /* 见下方 */ },
edgeTheme: { /* 见下方 */ },
tool: { /* 见下方 */ },
on: { /* 事件处理,见第 ⑧ 节 */ }
});
// 读写插件专属存储(需 storage 能力)
plugin.storage.set('defaultCity', 'Singapore'); // 存(键值均可为字符串/JSON)
var city = plugin.storage.get('defaultCity'); // 取
plugin.storage.remove('defaultCity'); // 删
// 订阅事件(需 hook 能力)
plugin.on('card.create', function (card) { /* ... */ });
// 发站内通知(需 notification 能力)
plugin.notify({ title: '天气已更新', body: '新加坡已更新为 32°' });
| API | Signature | Description | Capability needed |
|---|---|---|---|
plugin.register | register(obj) | Register the plugin body | Matching capability |
plugin.storage.set | set(key, value) | Store a key-value pair (isolated by plugin id) | storage |
plugin.storage.get | get(key) | Read a key-value pair | storage |
plugin.storage.remove | remove(key) | Delete a key | storage |
plugin.on | on(event, handler) | Subscribe to an event | hook |
plugin.notify | notify({title, body}) | Send an in-site notification | notification |
⑧ Complete event hook reference
Subscribe to these events to run your code automatically when the corresponding action happens:
| Event | When it fires | Callback parameter |
|---|---|---|
card.create | A new card is created on the canvas | card (card object) |
card.merge | Two cards are merged into a group | group (group object) |
card.delete | A card is deleted | card |
draft.save | A draft is saved | draft |
article.publish | An article is published | article |
comment.create | A comment is posted | comment |
like.create | A like is given | like |
follow.create | A user is followed | follow |
Example: tag cards automatically when they are created —
plugin.on('card.create', function (card) {
card.tags = (card.tags || []).concat(['待整理']);
});
⑨ Complete example
Example A: weather card (new card type + menu)
{
"id": "my-weather-card",
"name": "天气卡",
"version": "1.0.0",
"author": "USR-000101",
"description": "在画布里添加实时天气卡片",
"icon": "⛅",
"capabilities": ["cardType", "ui.menu"],
"minTier": "premium"
}
plugin.register({
id: 'my-weather-card',
cardType: {
id: 'weather',
label: '天气卡',
render(data) {
return '<span class="weather-card">' + data.city + ' ' + data.temp + '°</span>';
}
},
menuItem: { title: '天气', icon: '⛅', after: '地图' }
});
Example B: minimal theme (skin + background)
{
"id": "my-minimal-theme",
"name": "极简主题",
"version": "1.0.0",
"author": "USR-000101",
"description": "一套更清爽的 UI 配色与画布背景",
"icon": "🎨",
"capabilities": ["ui.theme", "ui.background"],
"minTier": "free"
}
plugin.register({
id: 'my-minimal-theme',
theme: {
'--color-primary': '#7b7ff0',
'--color-background': '#0f2027'
},
background: { canvas: 'linear-gradient(135deg,#0f2027,#2c5364)' }
});
Example C: event hook (auto-archive new cards)
plugin.register({
id: 'my-auto-archive',
on: {
'card.create': function (card) {
card.tags = (card.tags || []).concat(['待整理']);
}
}
});
⑩ Development and testing
manifest.json 和 plugin.jsconsole.log⑪ Version management (semantic versioning)
| Change type | Which number to bump | Example |
|---|---|---|
| Bug fix | Patch version +1 | 1.0.0 → 1.0.1 |
| New feature (backward compatible) | Minor version +1 | 1.0.0 → 1.1.0 |
| Major change (breaking) | Major version +1 | 1.0.0 → 2.0.0 |
每次更新写 changelog(更新说明)。用户能在插件详情页「版本」标签看到全部历代版本。
⑫ Submission and review
提交前自检清单:✅ id 唯一 · ✅ 最小权限 · ✅ 代码能跑 · ✅ 不碰隐私 · ✅ 写了 changelog
什么会被拒:恶意代码、越权调用、偷传用户数据、抄袭、与平台功能重复。
⑬ Subscription tiers and "downgrading"
premium → 新插件默认门槛,只有高级订阅用户能装。
basic → 使用量上来了,官方「下放」到基础订阅。
free(平台内置) → 特别优秀的插件被官方「收编」成平台自带,无需手动安装;官方通知作者并打赏资金感谢贡献。
⑭ Sandbox and security boundaries
🚫 Read other users' private data (passwords, emails, private messages)
🚫 Access interfaces the platform has not opened
🚫 Covertly send data to external servers
🚫 Access the local file system (the web sandbox isolates it by design)
🚫 Execute undeclared capabilities
Sandbox + AI checks + official review: three layers of protection.
⑮ Naming and icon guidelines
✅ id:小写英文 + 连字符,建议「作者-名字」(alex-weather-card)
✅ name:简短好记,别和平台自带功能重名
✅ icon:emoji 一个就够(⛅ 🎨 🧩 🔧 📈)
✅ preview:CSS 渐变或清晰图片
⑯ Best practices
✅ Use the "author-name" format for ids so they stay globally unique
✅ Least privilege — declare only the capabilities you actually use
✅ Keep the code clean and commented — reviews go faster
✅ Write a clear changelog
✅ Degrade gracefully when the API is unavailable — don't crash
⑰ Frequently asked questions
Q:写插件要会编程吗?
A:要会一点 JavaScript。不会可先从「主题插件」这种只填 manifest 的简单类型开始。
Q:id 撞了怎么办?
A:id 必须全局唯一,撞了提交失败。用「作者-名字」基本不撞。
Q:能改平台现有功能吗?
A:不能。插件只能「加」或「在扩展点上接」,不能改平台核心。
Q:怎么让插件免费?
A:设 minTier 为 free 即可(默认 premium)。也可先 premium,等使用量上来让官方「下放」。
Q:审核多久?
A:AI 检查即时,官方人工审核通常 1-3 天。