FC Extension Pack Specification

第一阶段:FC 扩展包 = 审核通过的声明式 manifest + 卡片配置 schema + 受限布局与交互(fc.cardType / fc.template / fc.panel / fc.action / fc.connectionType)。平台负责安全渲染、数据保存、权限检查与降级展示。

⚠ 以下手册中出现的 plugin.register、任意脚本、钩子、存储、通知等能力均为规划中,尚未上线,不代表已经可运行;请勿据此开发执行型插件。

🎯 Core principle: change the presentation, never the core

✅ 能自定义 / 增加(展示层):一切你在网页上「看得到」的默认展示方式——所有动画、所有卡片的外观、所有菜单、主题配色、字体、背景、按钮、弹窗、布局、图标……

❌ 不能改(核心层):登录注册、数据存储、发布 / 审核逻辑、业务规则、账号安全等平台的「核心功能与结构」。

① 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 moduleWhat it isWhat plugins can do
🌐 Site shellLeft menu, top bar, theme (colors/fonts/corner radius)Add menu items, change skins, change backgrounds
✏️ FluidCanvas editorCard canvas editor (card types/edges/fonts/layers/merging)Register new card types, edges, tools and fonts
📄 PagesHome/community/messages/activity/articles/subscription and moreAdd panels and entry points
👥 SocialPosts/comments/likes/reposts/follows/bookmarksSubscribe to these events and trigger automatically
📚 ArticlesWriting, publishing and reading encyclopedia articlesHook into publishing
🖼 GalleryImage upload, tags and searchRead image data (read-only)
👑 SubscriptionFour tiers: free/basic/premium/ultraSet a minTier requirement
🏆 Levels/achievementsUser XP, badges and decorationsRead level data (read-only)
🔔 NotificationsIn-site notifications and announcementsSend 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 IDNameDefault size
flagFlag card8 wide × 5 long
shieldCoat of arms card5 × 5
contentContent card8 × 4 text block
textText cardAuto
statsStats cardAuto
sneSNE index cardAuto
sheetTable card10 wide × 7 long
timelineTimeline cardAuto
mapTerritory map cardAuto

✂️ Edge themes (edgeTheme) — existing edges; plugins can register new ones

Edge IDName
paperPaper
treasureTreasure map
techTech (bevel)
paintPaint
custom:*Custom edge (AI-generated, e.g. custom:ce-mask1)

注:内置边缘共 14 个主题,上表列出最常用的;插件注册新边缘用 edgeTheme 扩展点。

👑 Subscription tiers (tier) — the values used for plugin requirements

Tier IDNameOrder
freeFree0
basicBasic1
premiumPremium2
ultraUltra3

📄 Key pages (hosts of page-level extension points)

dashboard
Home dashboard
overview
MicroNationary
community-hub
Community
messages
Messages
activity
Activity
fluidcanvas
FluidCanvas editor
article
Article reader
premium
Subscription page

🔤 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"
}
FieldRequiredDescription
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
iconOptionalIcon (emoji)
previewOptionalPreview image (CSS gradient or image URL)
categoryOptionalCategory: card / theme / tool / general
capabilities✅List of required permissions
minTierOptionalInitial subscription requirement; defaults to premium
tagsOptionalTag array to make store search easier
licenseOptionalLicense

⑥ capabilities explained (capability → exact platform location)

Each capability maps to one or more specific locations on the platform:

CapabilityWhere on the platformWhat it can do
ui.menuLeft sidebar navigation (12 menu items)Add / edit / delete menu items
ui.themeSite-wide CSS design tokens (--color-* variables)Override colors, fonts, corner radius and spacing
ui.backgroundPage background and canvas backgroundChange background images and gradients
ui.animationPage opening / page transition animations (transitions.js)Add custom opening animations and entrance effects
cardTypeFluidCanvas editor asset panelRegister new card types
edgeThemeEditor edge selectorRegister new edge themes
toolEditor toolbar, context menu and shortcutsAdd buttons, menu items and shortcuts
hookPlatform event systemSubscribe to events and run automatically
storagePlugin-specific key-value storageRead and write settings
notificationIn-site notification systemSend 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°' });
APISignatureDescriptionCapability needed
plugin.registerregister(obj)Register the plugin bodyMatching capability
plugin.storage.setset(key, value)Store a key-value pair (isolated by plugin id)storage
plugin.storage.getget(key)Read a key-value pairstorage
plugin.storage.removeremove(key)Delete a keystorage
plugin.onon(event, handler)Subscribe to an eventhook
plugin.notifynotify({title, body})Send an in-site notificationnotification

⑧ Complete event hook reference

Subscribe to these events to run your code automatically when the corresponding action happens:

EventWhen it firesCallback parameter
card.createA new card is created on the canvascard (card object)
card.mergeTwo cards are merged into a groupgroup (group object)
card.deleteA card is deletedcard
draft.saveA draft is saveddraft
article.publishAn article is publishedarticle
comment.createA comment is postedcomment
like.createA like is givenlike
follow.createA user is followedfollow

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

1
用任意代码编辑器(VS Code 等)新建 manifest.json 和 plugin.js
2
Write the manifest — declare id / capabilities / tier requirement
3
Write plugin.js — connect extension points through the declared capabilities
4
浏览器控制台(F12 → Console)看报错与 console.log
5
Run the "pre-submission checklist" before submitting (section ⑫)

⑪ Version management (semantic versioning)

Change typeWhich number to bumpExample
Bug fixPatch version +11.0.0 → 1.0.1
New feature (backward compatible)Minor version +11.0.0 → 1.1.0
Major change (breaking)Major version +11.0.0 → 2.0.0

每次更新写 changelog(更新说明)。用户能在插件详情页「版本」标签看到全部历代版本。

⑫ Submission and review

1
Click "Submit plugin" in the plugin store
2
Upload the manifest + code
3
Automatic AI checks (malicious code / privilege abuse / privacy leaks)
4
Official manual review
5
Once approved, it is listed and available to "Premium" by default

提交前自检清单:✅ 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 天。