{"_id":"@batterai/strapi-plugin-canvas","_rev":"2-d04139b57c109cd80063399dacb6c1c7","name":"@batterai/strapi-plugin-canvas","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@batterai/strapi-plugin-canvas","version":"0.1.0","license":"BUSL-1.1","_id":"@batterai/strapi-plugin-canvas@0.1.0","maintainers":[{"name":"hanseilers-batterai","email":"hans@batterai.eu"}],"dist":{"shasum":"1427ad93975f76c1a0324a5c7982f89244b5cda0","tarball":"https://registry.npmjs.org/@batterai/strapi-plugin-canvas/-/strapi-plugin-canvas-0.1.0.tgz","fileCount":152,"integrity":"sha512-AKaDPjgJoQjE8ni+LpIXUKe0VPwIKfp7mW2hesnccXK0sFJVWV9PFF1eAsrRjm06pQm0w/X+RqC359jMmp9GFg==","signatures":[{"sig":"MEYCIQC5xZYhB5JZXOlBZga5B3XaHguII63hmoaWISB9gBchqAIhAJjPWMzqwHSjFLBtLLMOR7Qr2EKI78My1UUGI4p958Y9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1024062},"main":"./dist/index.js","type":"module","_from":"file:/tmp/batterai-npm-release-20260713/batterai-strapi-plugin-canvas-0.1.0.tgz","types":"./dist/index.d.ts","strapi":{"kind":"plugin","name":"canvas","description":"Same-origin Canvas authoring for Strapi admin.","displayName":"Canvas"},"engines":{"node":">=20.11"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json","./strapi-admin":{"import":"./dist/admin/index.js","source":"./src/admin/index.tsx","default":"./dist/admin/index.js"},"./strapi-server":{"import":"./dist/server/index.js","source":"./src/server/index.ts","default":"./dist/server/index.js","require":"./dist/server-cjs/index.js"}},"scripts":{"build":"node ../../scripts/build-package.mjs","check":"tsc --noEmit","prepack":"bun run build","build:artifacts":"bun run build:server-cjs","build:server-cjs":"bun build src/server/index.ts --format=cjs --target=node --outfile=dist/server-cjs/index.js && node -e \"require('fs').writeFileSync('dist/server-cjs/package.json', JSON.stringify({ type: 'commonjs' }, null, 2) + '\\n')\""},"_npmUser":{"name":"hanseilers-batterai","email":"hans@batterai.eu"},"_resolved":"/tmp/batterai-npm-release-20260713/batterai-strapi-plugin-canvas-0.1.0.tgz","_integrity":"sha512-AKaDPjgJoQjE8ni+LpIXUKe0VPwIKfp7mW2hesnccXK0sFJVWV9PFF1eAsrRjm06pQm0w/X+RqC359jMmp9GFg==","_npmVersion":"10.9.0","description":"Installable Strapi 5 plugin for same-origin Canvas authoring.","directories":{},"_nodeVersion":"22.12.0","dependencies":{"@batterai/host":"^0.1.0","@batterai/trust":"^0.1.0","@batterai/contract":"^0.1.0","@batterai/bind-core":"^0.1.0","@batterai/editor-shell":"^0.1.0","@batterai/canvas-blocks":"^0.1.0","@batterai/collab-server":"^0.1.0","@batterai/collab-protocol":"^0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"react":"19.2.7","react-dom":"19.2.7","@types/node":"^22.13.0","@types/react":"^19.0.0","@types/react-dom":"^19.0.0","@batterai/block-sdk":"^0.1.0"},"peerDependencies":{"react":">=18.2 <20","react-dom":">=18.2 <20","@strapi/admin":">=5 <6","@strapi/strapi":">=5 <6","styled-components":">=6 <7"},"_npmOperationalInternal":{"tmp":"tmp/strapi-plugin-canvas_0.1.0_1783945059739_0.4265121794930413","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-07-13T12:17:39.593Z","modified":"2026-07-13T12:32:30.534Z","0.1.0":"2026-07-13T12:17:39.949Z"},"license":"BUSL-1.1","description":"Installable Strapi 5 plugin for same-origin Canvas authoring.","maintainers":[{"name":"hanseilers-batterai","email":"hans@batterai.eu"}],"readme":"# @batterai/strapi-plugin-canvas\n\nInstallable Strapi 5 plugin for same-origin Canvas authoring.\n\nThe admin bundle mounts `@batterai/editor-shell` directly inside the Strapi\nadmin SPA. Browser calls go through Strapi admin routes and `useFetchClient`;\nthe package does not import the public render adapter or iframe a dev server.\n\n## Minimal Config\n\n```ts\nexport default () => ({\n  canvas: {\n    enabled: true,\n    config: {\n      licenseKey: process.env.BATTERAI_CANVAS_LICENSE_KEY,\n    },\n  },\n});\n```\n\nUnlicensed production authoring remains usable with a watermark. Localhost\nauthoring is exempt.\n\n## Editor appearance and CMS themes\n\nCanvas inherits its editor chrome colors from Strapi's active Design System\ntheme. This means a project's `config.theme.light` and `config.theme.dark`\ncustomizations also follow Strapi's user-selected light/dark mode inside Canvas.\n\nFor Canvas-specific colors, register an appearance from the Strapi admin\ncustomization entrypoint. Use a resolver when light and dark need different\nvalues; it receives the currently active Strapi theme and is reevaluated when\nthe CMS theme changes.\n\n```tsx\n// src/admin/app.tsx\nimport { registerCanvasAppearance } from \"@batterai/strapi-plugin-canvas/strapi-admin\";\n\nexport default {\n  register() {\n    registerCanvasAppearance((theme) => ({\n      accent: theme.colors?.primary600 as string,\n      accentStrong: theme.colors?.primary700 as string,\n      selection: theme.colors?.primary600 as string,\n    }));\n  },\n};\n```\n\nSupported keys are `accent`, `accentStrong`, `accentSoft`, `background`,\n`border`, `borderSubtle`, `ink`, `muted`, `mutedDisabled`, `panel`,\n`panelStrong`, and `selection`. Values must be six-digit hex colors. Canvas\napplies them as namespaced `--be-editor-*` custom properties; `selection`\ndefaults to the blue `accent`. These tokens style authoring chrome only and are\nseparate from persisted website content.\n\n## Register Your Web Component Packages\n\nCanvas includes its built-in block packages. Register additional approved\n`BlockPackage` modules from the host app's admin customization file, inside\n`register()`:\n\n```tsx\n// src/admin/app.tsx\nimport { registerCanvasBlockPackages } from \"@batterai/strapi-plugin-canvas/strapi-admin\";\nimport { acmeBlockPackages } from \"./canvas/blocks\";\n\nexport default {\n  register() {\n    registerCanvasBlockPackages(acmeBlockPackages);\n  },\n};\n```\n\nEvery package supplies one versioned custom element, its server render path,\nand block-owned stylesheet URLs. Register packages before the Canvas page\nmounts (Strapi's `register()` phase); duplicate block types fail immediately.\nEach source block belongs in its own folder with `block.ts` or `block.tsx` and\n`block.css`.\n\n## Seed Library\n\n`seedLibrary` provides the block palette (`categories`/`blocks`/`presets`)\nwritten into the plugin's `canvas-site` document when that document is FIRST\ncreated. It is first-creation-only seed data, not a live source: an existing\nsite document's library is never overwritten by config changes — after the\nfirst boot the palette lives in Strapi and evolves through the editor (for\nexample saved presets).\n\n```js\n// config/plugins.js\nmodule.exports = ({ env }) => ({\n  canvas: {\n    enabled: true,\n    config: {\n      licenseKey: env(\"BATTERAI_CANVAS_LICENSE_KEY\"),\n      seedLibrary: require(\"./canvas-library.json\"),\n    },\n  },\n});\n```\n\nThe value is an object with optional `categories`, `blocks`, and `presets`\narrays (any missing key seeds as empty). Block entries need at least `type`\nand `label`; every seeded `type` must have an installed `BlockPackage`.\n\n## Public Delivery\n\nThe plugin exposes a read-only content API route for the visitor website:\n\n```text\nGET /api/canvas/delivery\n```\n\nUse it as the SSR host delivery source:\n\n```bash\nPUBLIC_SITE_DELIVERY_URL=https://cms.example.com/api/canvas/delivery bun run public-site\n```\n\nThe delivery route returns published Canvas pages plus published bound\ncollections. Draft/editor data remains behind Strapi admin routes.\n\n## Proof\n\n```bash\nbun run test:strapi-plugin-canvas\nbun run strapi-plugin:fresh-install\nbun run strapi-plugin:fresh-install:live\n```\n","readmeFilename":"README.md"}