Full API write-up: power-sdk.md.
Boot (Frontend/index.js)
(function () {
function boot() {
var FP = window.FeatherPanel;
if (!FP || !FP.events) return setTimeout(boot, 50);
FP.events.on('fp:route:change', function (p) { console.log('route', p); });
FP.actions.register('fp:server:power', {
id: 'myplugin.guard-kill',
priority: 100,
handler: async function (ctx, next) {
if (ctx.action === 'kill' && !confirm('Kill?')) {
ctx.cancel('aborted');
return;
}
await next();
},
});
FP.search.contribute({
id: 'myplugin',
search: function (q) {
return q ? [{ id: '1', title: 'My plugin', href: '/dashboard' }] : [];
},
});
FP.shortcuts.register({
id: 'myplugin-toast',
combo: 'ctrl+shift+m',
handler: function () { FP.toast.info('Hello from plugin'); },
});
}
boot();
})();
Namespaces
| API | Role |
|---|---|
events |
on / once / off / emit |
actions |
Cancellable middleware (register / run) |
theme |
getMode / getPackId / subscribe |
api · toast · navigate |
HTTP, notifications, client nav |
context |
pathname / user / UI pack |
ui.modal · search · shortcuts |
Registries |
Events
| ID | When |
|---|---|
fp:host:ready |
Host API installed |
fp:route:change |
Pathname changes |
fp:page:mount / unmount |
Route settle |
fp:theme:change / fp:uipack:change |
Appearance packs |
fp:session:change |
Login / user |
fp:server:context · power:result · console:ready |
Server UI |
fp:files:saved · fp:api:error |
Editor / API |
Cancelable actions
| ID | Call site |
|---|---|
fp:server:power |
Start / stop / restart / kill |
fp:files:save · upload |
File editor |
fp:nav:push |
FeatherPanel.navigate |
fp:form:submit · fp:data:action |
Opt-in forms & data-fp-action |
fp:ui:confirm |
Destructive confirms |
fp:api:request |
FeatherPanel.api.* |
fp:search:query · fp:shortcut:invoke |
Search / hotkeys |
Opt-in: <button data-fp-action="fp:data:action" data-fp-payload='{"x":1}'>
Iframe bus
Same-origin: { type: 'featherpanel-bus', op: 'emit'|'on'|'off'|'runAction', … }
Replies: featherpanel-bus-reply · events: featherpanel-bus-event
Also: featherpanel-ready, featherpanel-navigate,
featherpanel-toast
Slots
shell.*, toolbar.server-header, toolbar.server-console,
drawer.global, modal.global
Choose the right surface
| Need | Use |
|---|---|
| HTML card on a page | widgets.json |
| Nav + page | sidebar.json |
| Colors only | theme.json |
| Replace chrome | ui.json |
| Intercept power / files | This SDK (actions) |