Files
TREK/plugin-sdk/package.json
T
Maurice c4a2a91578 fix(plugins): pause and suspend plugin frames when they leave the screen
A tester reported that their own plugin, fine on the web, slowed the app down
badly on a phone. A sandboxed plugin iframe keeps running its timers, polling and
animation even off screen, and on a phone it shares the WebView's main thread with
the whole app, so a heavy one janks everything.

The frame now watches whether it is on screen and the app in the foreground
(IntersectionObserver + page visibility) and forwards it as trek:visibility, so a
plugin can pause its work while hidden; the design kit exposes trek.onVisibility /
trek.isVisible and pauses its own CSS animations via data-hidden. On a phone a
dashboard-widget plugin scrolled well out of view is suspended outright: its iframe
is unmounted and a placeholder holds the widget's height, so an offscreen widget
costs nothing and remounts when it scrolls back.
2026-11-15 20:33:27 +01:00

91 lines
2.2 KiB
JSON

{
"name": "trek-plugin-sdk",
"version": "1.9.1",
"description": "SDK for building TREK plugins: types, definePlugin, a mock host, manifest validation, and the create-trek-plugin / trek-plugin CLIs.",
"type": "module",
"license": "MIT",
"author": "mauriceboe",
"maintainers": [
{
"name": "mauriceboe",
"url": "https://github.com/mauriceboe"
},
{
"name": "jubnl",
"url": "https://github.com/jubnl"
}
],
"homepage": "https://github.com/liketrek/TREK/wiki/Plugin-Development",
"repository": {
"type": "git",
"url": "git+https://github.com/liketrek/TREK.git",
"directory": "plugin-sdk"
},
"bugs": {
"url": "https://github.com/liketrek/TREK/issues"
},
"engines": {
"node": ">=18"
},
"publishConfig": {
"access": "public"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"require": {
"types": "./dist/cjs/index.d.ts",
"default": "./dist/cjs/index.js"
}
},
"./testing": {
"import": {
"types": "./dist/mock-host.d.ts",
"default": "./dist/mock-host.js"
},
"require": {
"types": "./dist/cjs/mock-host.d.ts",
"default": "./dist/cjs/mock-host.js"
}
}
},
"bin": {
"trek-plugin-sdk": "./dist/cli/trek-plugin.js",
"trek-plugin": "./dist/cli/trek-plugin.js",
"create-trek-plugin": "./dist/cli/create.js"
},
"files": [
"dist"
],
"dependencies": {
"@clack/prompts": "^1.8.1",
"semver": "^7.8.5",
"update-notifier": "^7.3.1"
},
"scripts": {
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/finish-cjs.mjs",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"prepublishOnly": "npm run build && npm test"
},
"devDependencies": {
"@types/node": "^22.20.4",
"@types/semver": "^7.8.0",
"@types/update-notifier": "^6.0.8",
"@vitest/coverage-v8": "^5.1.0",
"typescript": "^5.9.3",
"vitest": "^5.1.0"
},
"keywords": [
"trek",
"plugin",
"sdk"
]
}