{"_rev":"8-3aefdf27afa138ee0bf46f05a060c8c3","time":{"created":"2026-01-13T03:48:10.798Z","modified":"2026-01-13T03:48:11.299Z","0.1.0":"2026-01-10T03:48:13.769Z","0.1.1":"2026-01-12T17:05:42.387Z","0.1.2":"2026-01-13T03:43:58.100Z","0.1.3":"2026-01-13T03:48:11.032Z"},"_id":"@assetiverse/editor-sdk","name":"@assetiverse/editor-sdk","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.3":{"name":"@assetiverse/editor-sdk","version":"0.1.3","author":{"name":"Assetiverse","email":"support@assetiverse.com"},"description":"TypeScript SDK for building Assetiverse editor assets","type":"module","keywords":["assetiverse","playcanvas","editor","asset","sdk"],"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"devDependencies":{"typescript":"^5.5.0"},"scripts":{"build":"tsc","dev":"tsc --watch","clean":"rm -rf dist"},"_id":"@assetiverse/editor-sdk@0.1.3","_integrity":"sha512-e0dbp3d9m0zy86S9fWNYRPumCxxGIPDd7cbikZiqHhFPfkUCVAOjdglmCvFTUPbGRzqgkNYhpxpV4eNwKHX91A==","_resolved":"/tmp/8372bbcfc87d273aa72f5ad375446100/assetiverse-editor-sdk-0.1.3.tgz","_from":"file:assetiverse-editor-sdk-0.1.3.tgz","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-e0dbp3d9m0zy86S9fWNYRPumCxxGIPDd7cbikZiqHhFPfkUCVAOjdglmCvFTUPbGRzqgkNYhpxpV4eNwKHX91A==","shasum":"3c52fc40de5ac974353591faf5e7c56bf1a1a66c","tarball":"https://registry.npmjs.org/@assetiverse/editor-sdk/-/editor-sdk-0.1.3.tgz","fileCount":15,"unpackedSize":21620,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC56x06O5n1DqaCcrSkQUV9WbotSz8Y39l0bI56QGJfWwIhALzR38KBIZcE3GweKocvhdd8W9Zg57snUrMEow+Abz2z"}]},"_npmUser":{"name":"p-delorme","email":"pdelorme@agence104.com"},"directories":{},"maintainers":[{"name":"agence104","email":"info@agence104.com"},{"name":"p-delorme","email":"pdelorme@agence104.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/editor-sdk_0.1.3_1768276090893_0.8964178379801697"},"_hasShrinkwrap":false}},"maintainers":[{"name":"agence104","email":"info@agence104.com"},{"name":"p-delorme","email":"pdelorme@agence104.com"}],"description":"TypeScript SDK for building Assetiverse editor assets","keywords":["assetiverse","playcanvas","editor","asset","sdk"],"author":{"name":"Assetiverse","email":"support@assetiverse.com"},"license":"MIT","readme":"# @assetiverse/editor-sdk\n\nTypeScript SDK for building Assetiverse editor assets for PlayCanvas.\n\n## Installation\n\n```bash\nnpm install @assetiverse/editor-sdk\n# or\npnpm add @assetiverse/editor-sdk\n# or\nyarn add @assetiverse/editor-sdk\n```\n\n## Overview\n\nThe Assetiverse Editor SDK provides TypeScript types and utilities for building editor assets that integrate with the PlayCanvas editor through the Assetiverse browser extension. It handles lifecycle management, asset registration, and provides convenient methods for working with asset files and stylesheets.\n\n## Quick Start\n\n```typescript\nimport { EditorAsset } from \"@assetiverse/editor-sdk\";\n\nclass MyAsset extends EditorAsset {\n  init() {\n    console.log(\"Asset initialized:\", this.assetId);\n  }\n\n  async enabled() {\n    // Load an image from the asset bundle\n    const logoUrl = await this.getFileUrl(\"images/logo.png\");\n\n    // Add custom styles\n    await this.addStylesheet({\n      id: \"my-styles\",\n      path: \"styles/custom.css\",\n    });\n  }\n\n  disabled() {\n    // Cleanup when disabled\n  }\n\n  update(dt: number) {\n    // Called every frame (use sparingly)\n  }\n\n  menuItems() {\n    return [\n      {\n        id: \"my-action\",\n        icon: \"E401\", // PCUI icon code or SVG string\n        tooltip: \"My Action\",\n        onClick: () => this.doSomething(),\n      },\n    ];\n  }\n}\n\n// Register the asset\nMyAsset.register();\n```\n\n## API Reference\n\n### EditorAsset\n\nBase class for creating editor assets. Extend this class and implement lifecycle methods.\n\n#### Lifecycle Methods\n\n- **`init()`** - Called once when the asset is first loaded. Use for one-time initialization.\n- **`enabled()`** - Called each time the asset is enabled. Use to add UI elements, start features.\n- **`disabled()`** - Called each time the asset is disabled. Use to remove UI elements, cleanup resources.\n- **`update(dt: number)`** - Called every editor frame tick. Use for continuous updates (use sparingly for performance).\n\n#### Methods\n\n- **`getFileUrl(filePath: string): Promise<string | null>`** - Get a blob URL for a file bundled with this asset.\n- **`addStylesheet(stylesheet: StylesheetDefinition): Promise<void>`** - Inject a CSS stylesheet from the asset bundle (automatically removed when disabled).\n- **`menuItems?(): MenuItemDefinition[]`** - Optional method to define menu items for the asset toolbar menu.\n\n#### Static Methods\n\n- **`MyAsset.register(): void`** - Register the asset class with the Assetiverse loader. Call on your subclass after defining it.\n\n### Types\n\n#### AssetiverseHooks\n\n```typescript\ninterface AssetiverseHooks {\n  init?: () => void;\n  enabled?: () => void;\n  disabled?: () => void;\n  update?: (dt: number) => void;\n}\n```\n\n#### MenuItemDefinition\n\n```typescript\ninterface MenuItemDefinition {\n  id: string;\n  icon: string; // PCUI icon code (e.g., 'E401') or SVG string\n  tooltip?: string;\n  onClick: () => void;\n}\n```\n\n#### StylesheetDefinition\n\n```typescript\ninterface StylesheetDefinition {\n  id: string;\n  path: string; // Relative path to CSS file within asset bundle\n}\n```\n\n### Global Types\n\nThe SDK augments the global `Window` interface with `window.Assetiverse` types. Import the package to get full TypeScript support:\n\n```typescript\nimport { EditorAsset } from \"@assetiverse/editor-sdk\";\n\n// window.Assetiverse is fully typed\nclass MyAsset extends EditorAsset { ... }\nMyAsset.register();\n```\n\n## Requirements\n\n- TypeScript 5.5+\n- Assetiverse browser extension installed and active\n- PlayCanvas editor\n\n## Related Packages\n\nFor PlayCanvas editor and UI types, install the official packages:\n\n- `@playcanvas/editor-api` - PlayCanvas Editor API types\n- `@playcanvas/pcui` - PlayCanvas UI component types\n\n## License\n\nMIT\n\n## Support\n\nFor support, visit [Assetiverse Support](mailto:support@assetiverse.com)\n","readmeFilename":"README.md"}