@eclipse-docks/extension-canvas 0.8.8 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/active-canvas.js +2 -2
- package/dist/active-canvas.js.map +1 -1
- package/dist/bridges/canvas.d.ts +2 -0
- package/dist/bridges/canvas.d.ts.map +1 -0
- package/dist/bridges/canvas.js +13 -0
- package/dist/bridges/canvas.js.map +1 -0
- package/dist/bridges/core.d.ts +1 -1
- package/dist/bridges/core.d.ts.map +1 -1
- package/dist/bridges/core.js +1 -3
- package/dist/bridges/core.js.map +1 -1
- package/dist/bridges/register.d.ts +3 -6
- package/dist/bridges/register.d.ts.map +1 -1
- package/dist/bridges/register.js +8 -7
- package/dist/bridges/register.js.map +1 -1
- package/dist/canvas-catalog.d.ts +2 -0
- package/dist/canvas-catalog.d.ts.map +1 -0
- package/dist/canvas-catalog.js +39 -0
- package/dist/canvas-catalog.js.map +1 -0
- package/dist/canvas-editor.d.ts +4 -6
- package/dist/canvas-editor.d.ts.map +1 -1
- package/dist/canvas-editor.js +15 -14
- package/dist/canvas-editor.js.map +1 -1
- package/dist/canvas-extension.d.ts.map +1 -1
- package/dist/canvas-extension.js +10 -0
- package/dist/canvas-extension.js.map +1 -1
- package/dist/canvas-module.d.ts +20 -0
- package/dist/canvas-module.d.ts.map +1 -0
- package/dist/canvas-module.js +52 -0
- package/dist/canvas-module.js.map +1 -0
- package/dist/canvas-part.d.ts.map +1 -1
- package/dist/canvas-part.js +3 -3
- package/dist/canvas-part.js.map +1 -1
- package/dist/{canvas-readonly.d.ts → canvas-viewer.d.ts} +3 -3
- package/dist/canvas-viewer.d.ts.map +1 -0
- package/dist/{canvas-readonly.js → canvas-viewer.js} +5 -5
- package/dist/canvas-viewer.js.map +1 -0
- package/dist/canvases/lounging-cat.canvas.js +6 -0
- package/dist/canvases/lounging-cat.canvas.js.map +1 -0
- package/dist/canvases/tasks.canvas.js +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +4 -4
- package/dist/commands.js.map +1 -1
- package/dist/compile.d.ts +2 -10
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +16 -20
- package/dist/compile.js.map +1 -1
- package/dist/host.js +1 -1
- package/dist/host.js.map +1 -1
- package/dist/skills/eclipse-docks-canvas/SKILL.js +1 -1
- package/dist/skills/eclipse-docks-core/SKILL.js +1 -1
- package/dist/skills/eclipse-docks-lit/SKILL.js +1 -1
- package/dist/skills/eclipse-docks-webawesome/SKILL.js +1 -1
- package/package.json +2 -1
- package/dist/bridges/events.d.ts +0 -2
- package/dist/bridges/events.d.ts.map +0 -1
- package/dist/bridges/events.js +0 -9
- package/dist/bridges/events.js.map +0 -1
- package/dist/bridges/lit.d.ts +0 -2
- package/dist/bridges/lit.d.ts.map +0 -1
- package/dist/bridges/lit.js +0 -9
- package/dist/bridges/lit.js.map +0 -1
- package/dist/bridges/parts.d.ts +0 -2
- package/dist/bridges/parts.d.ts.map +0 -1
- package/dist/bridges/parts.js +0 -9
- package/dist/bridges/parts.js.map +0 -1
- package/dist/bridges/third-party.d.ts +0 -2
- package/dist/bridges/third-party.d.ts.map +0 -1
- package/dist/bridges/third-party.js +0 -9
- package/dist/bridges/third-party.js.map +0 -1
- package/dist/bridges/urls.d.ts +0 -3
- package/dist/bridges/urls.d.ts.map +0 -1
- package/dist/bridges/urls.js +0 -27
- package/dist/bridges/urls.js.map +0 -1
- package/dist/bridges/webawesome.d.ts +0 -2
- package/dist/bridges/webawesome.d.ts.map +0 -1
- package/dist/bridges/webawesome.js +0 -9
- package/dist/bridges/webawesome.js.map +0 -1
- package/dist/bridges/widgets.d.ts +0 -2
- package/dist/bridges/widgets.d.ts.map +0 -1
- package/dist/bridges/widgets.js +0 -9
- package/dist/bridges/widgets.js.map +0 -1
- package/dist/canvas-readonly.d.ts.map +0 -1
- package/dist/canvas-readonly.js.map +0 -1
package/dist/host.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["import { appSettings, editorRegistry, File, workspaceService } from '@eclipse-docks/core';\nimport type { CanvasContribution } from './contribution';\n\nexport interface CanvasHost {\n getState(key: string, fallback?: unknown): unknown;\n setState(key: string, value: unknown): void;\n openFile(path: string): void;\n}\n\nexport function createMemoryHost(initial: Record<string, unknown>, persist: (state: Record<string, unknown>) => void): CanvasHost {\n const state = { ...initial };\n return {\n getState(key, fallback) {\n return state[key] === undefined ? fallback : state[key];\n },\n setState(key, value) {\n state[key] = value;\n persist(state);\n },\n openFile(path) {\n void openWorkspaceFile(path);\n },\n };\n}\n\nexport async function createFileHost(file: File): Promise<CanvasHost> {\n const initial = await readSidecar(file);\n return createMemoryHost(initial, state => {\n void writeSidecar(file, state);\n });\n}\n\nexport async function createContributionHost(contribution: CanvasContribution): Promise<CanvasHost> {\n const key = contribution.settingsKey;\n const stored = await appSettings.get(key);\n const initial = stored && typeof stored === 'object' ? stored as Record<string, unknown> : {};\n return createMemoryHost(initial, state => {\n void appSettings.set(key, state);\n });\n}\n\nfunction sidecarName(fileName: string): string {\n return fileName.replace(/\\.canvas\\.js$/i, '.canvas.
|
|
1
|
+
{"version":3,"file":"host.js","names":[],"sources":["../src/host.ts"],"sourcesContent":["import { appSettings, editorRegistry, File, workspaceService } from '@eclipse-docks/core';\nimport type { CanvasContribution } from './contribution';\n\nexport interface CanvasHost {\n getState(key: string, fallback?: unknown): unknown;\n setState(key: string, value: unknown): void;\n openFile(path: string): void;\n}\n\nexport function createMemoryHost(initial: Record<string, unknown>, persist: (state: Record<string, unknown>) => void): CanvasHost {\n const state = { ...initial };\n return {\n getState(key, fallback) {\n return state[key] === undefined ? fallback : state[key];\n },\n setState(key, value) {\n state[key] = value;\n persist(state);\n },\n openFile(path) {\n void openWorkspaceFile(path);\n },\n };\n}\n\nexport async function createFileHost(file: File): Promise<CanvasHost> {\n const initial = await readSidecar(file);\n return createMemoryHost(initial, state => {\n void writeSidecar(file, state);\n });\n}\n\nexport async function createContributionHost(contribution: CanvasContribution): Promise<CanvasHost> {\n const key = contribution.settingsKey;\n const stored = await appSettings.get(key);\n const initial = stored && typeof stored === 'object' ? stored as Record<string, unknown> : {};\n return createMemoryHost(initial, state => {\n void appSettings.set(key, state);\n });\n}\n\nfunction sidecarName(fileName: string): string {\n return fileName.replace(/\\.canvas\\.js$/i, '.canvas.json');\n}\n\nasync function readSidecar(file: File): Promise<Record<string, unknown>> {\n const parent = file.getParent();\n if (!parent) return {};\n const resource = await parent.getResource(sidecarName(file.getName()));\n if (!(resource instanceof File)) return {};\n try {\n const parsed = JSON.parse(await resource.getContents());\n return parsed && typeof parsed === 'object' ? parsed as Record<string, unknown> : {};\n } catch {\n return {};\n }\n}\n\nasync function writeSidecar(file: File, state: Record<string, unknown>): Promise<void> {\n const parent = file.getParent();\n if (!parent) return;\n const name = sidecarName(file.getName());\n let resource = await parent.getResource(name);\n if (!(resource instanceof File)) {\n resource = await parent.getResource(name, { create: true }) as File | null;\n }\n if (!(resource instanceof File)) return;\n await resource.saveContents(JSON.stringify(state));\n}\n\nasync function openWorkspaceFile(path: string): Promise<void> {\n const workspace = workspaceService.getWorkspaceSync() ?? await workspaceService.getWorkspace();\n if (!workspace) return;\n const resource = await workspace.getResource(path.replace(/^\\/+/, ''));\n if (resource instanceof File) await editorRegistry.loadEditor(resource);\n}\n"],"mappings":";;AASA,SAAgB,iBAAiB,SAAkC,SAA+D;CAC9H,MAAM,QAAQ,EAAE,GAAG,QAAQ;CAC3B,OAAO;EACH,SAAS,KAAK,UAAU;GACpB,OAAO,MAAM,SAAS,KAAA,IAAY,WAAW,MAAM;EACvD;EACA,SAAS,KAAK,OAAO;GACjB,MAAM,OAAO;GACb,QAAQ,KAAK;EACjB;EACA,SAAS,MAAM;GACX,kBAAuB,IAAI;EAC/B;CACJ;AACJ;AAEA,eAAsB,eAAe,MAAiC;CAElE,OAAO,iBAAiB,MADF,YAAY,IAAI,IACL,UAAS;EACtC,aAAkB,MAAM,KAAK;CACjC,CAAC;AACL;AAEA,eAAsB,uBAAuB,cAAuD;CAChG,MAAM,MAAM,aAAa;CACzB,MAAM,SAAS,MAAM,YAAY,IAAI,GAAG;CAExC,OAAO,iBADS,UAAU,OAAO,WAAW,WAAW,SAAoC,CAAC,IAC3D,UAAS;EACtC,YAAiB,IAAI,KAAK,KAAK;CACnC,CAAC;AACL;AAEA,SAAS,YAAY,UAA0B;CAC3C,OAAO,SAAS,QAAQ,kBAAkB,cAAc;AAC5D;AAEA,eAAe,YAAY,MAA8C;CACrE,MAAM,SAAS,KAAK,UAAU;CAC9B,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,MAAM,WAAW,MAAM,OAAO,YAAY,YAAY,KAAK,QAAQ,CAAC,CAAC;CACrE,IAAI,EAAE,oBAAoB,OAAO,OAAO,CAAC;CACzC,IAAI;EACA,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,YAAY,CAAC;EACtD,OAAO,UAAU,OAAO,WAAW,WAAW,SAAoC,CAAC;CACvF,QAAQ;EACJ,OAAO,CAAC;CACZ;AACJ;AAEA,eAAe,aAAa,MAAY,OAA+C;CACnF,MAAM,SAAS,KAAK,UAAU;CAC9B,IAAI,CAAC,QAAQ;CACb,MAAM,OAAO,YAAY,KAAK,QAAQ,CAAC;CACvC,IAAI,WAAW,MAAM,OAAO,YAAY,IAAI;CAC5C,IAAI,EAAE,oBAAoB,OACtB,WAAW,MAAM,OAAO,YAAY,MAAM,EAAE,QAAQ,KAAK,CAAC;CAE9D,IAAI,EAAE,oBAAoB,OAAO;CACjC,MAAM,SAAS,aAAa,KAAK,UAAU,KAAK,CAAC;AACrD;AAEA,eAAe,kBAAkB,MAA6B;CAC1D,MAAM,YAAY,iBAAiB,iBAAiB,KAAK,MAAM,iBAAiB,aAAa;CAC7F,IAAI,CAAC,WAAW;CAChB,MAAM,WAAW,MAAM,UAAU,YAAY,KAAK,QAAQ,QAAQ,EAAE,CAAC;CACrE,IAAI,oBAAoB,MAAM,MAAM,eAAe,WAAW,QAAQ;AAC1E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/skills/eclipse-docks-canvas/SKILL.md?raw
|
|
2
|
-
var SKILL_default = "---\nname: eclipse-docks-canvas\ndescription: >-\n Create or edit interactive Eclipse Docks canvases (.canvas.js):
|
|
2
|
+
var SKILL_default = "---\nname: eclipse-docks-canvas\ndescription: >-\n Create or edit interactive Eclipse Docks canvases (.canvas.js and the matching\n .canvas.md spec): CanvasView UIs, dashboards, todo apps, widgets, maps, and\n previewable tools. Use when the user wants an interactive view, canvas, widget,\n or .canvas.js file, or when a .canvas.md spec is open — even if they do not say\n \"canvas\".\n---\n\n# Eclipse Docks canvas\n\nWrite a workspace file ending in `.canvas.js`. Default-export a `CanvasView` subclass from `docks/canvas`. The host registers the tag.\n\n```js\nimport { CanvasView, html, css, nothing } from \"docks/canvas\";\n```\n\n`docks/canvas` exports `CanvasView`, the Lit module (`html`, `css`, `nothing`, `repeat`, and the rest), and the Web Awesome module (`registerIconLibrary`). `CanvasView` registers the Web Awesome elements. A canvas does not import `docks/lit` or `docks/webawesome`, and it does not extend `LitElement` or `HTMLElement`.\n\n## CanvasView\n\n| Call | Role |\n| --- | --- |\n| `this.getState(key, fallback)` | Read persisted state. Returns `fallback` when the key is missing. |\n| `this.setState(key, value)` | Write persisted state. Creates a sidecar `canvas.json` for this canvas. |\n| `this.openFile(path)` | Open a workspace path in the editor. |\n| `this.subscribe(topic, callback)` | Listen on the app event bus. The subscription ends when this canvas disconnects. |\n| `this.unsubscribe(token)` | End one subscription early. |\n| `this.publish(topic, data)` | Publish on the app event bus. |\n| `onConnect()` | The element is connected and the host is attached. Hydrate state here. |\n| `onDisconnect()` | The element is leaving the document. Release timers, streams, and object URLs. |\n\nThe host attaches after construction and before `onConnect`. From `constructor`, `getState` returns the fallback, and `setState` and `openFile` do nothing. Leave `connectedCallback` and `disconnectedCallback` on `CanvasView`. The subclass still owns `render`, `static properties`, and `static styles`.\n\nA canvas app consists of three files with the same stem: `….canvas.js`, `….canvas.json`, and `….canvas.md`. The `….canvas.md` file is the input that drives generation of the `….canvas.js` app. `setState` creates the `….canvas.json`. The canvas does not import either sidecar.\n\n```md\n# Requirements\n\nWhat the user asked for, in their words.\n\n# Spec\n\nBehavior, the data stored in canvas.json, and the UI.\n```\n\n## Hard rules\n\n1. Pure JavaScript only — no TypeScript, no decorators. Declare reactive fields with `static properties = { … }`. Initialize plain defaults in `constructor`; hydrate with `getState` in `onConnect`.\n2. Build controls and chrome with Web Awesome (`wa-button`, `wa-input`, `wa-checkbox`, `wa-card`, `wa-callout`, `wa-spinner`). A raw `<button>` or `<input>` is not a substitute. Load `eclipse-docks-webawesome` before a non-trivial UI, and use `--wa-color-*` tokens instead of hardcoded colors.\n3. Emit complete, valid JavaScript — no truncated objects or unfinished strings.\n4. The page uses `Cross-Origin-Embedder-Policy: require-corp`. A cross-origin response loads only when the request is CORS and the server sends `Access-Control-Allow-Origin`, or when the server sends `Cross-Origin-Resource-Policy: cross-origin`. An `<iframe srcdoc>` inherits this policy; `sandbox=\"allow-same-origin\"` does not exempt it.\n5. The `….canvas.md` file is the input that drives the `….canvas.js` app. When the request changes, update the markdown, then regenerate the module.\n\n## Code\n\nFollow clean code, DRY, SOLID, KISS, YAGNI, AHA, separation of concerns, fail fast, least astonishment, and the usual design patterns. Make the UI accessible and responsive. Format the file for a person to read: 2-space indentation, semicolons, double quotes, and templates and CSS broken across lines.\n\n## Minimal pattern\n\n```js\nimport { CanvasView, html, css } from \"docks/canvas\";\n\nexport default class extends CanvasView {\n static properties = {\n items: { state: true },\n draft: { state: true },\n };\n\n static styles = css`\n :host { display: block; padding: 1rem; box-sizing: border-box; }\n `;\n\n constructor() {\n super();\n this.items = [];\n this.draft = \"\";\n }\n\n onConnect() {\n const saved = this.getState(\"items\", null);\n if (Array.isArray(saved)) this.items = saved;\n }\n\n persist() {\n this.setState(\"items\", this.items);\n }\n\n addItem() {\n const input = this.renderRoot.querySelector(\"wa-input\");\n const text = String(input?.value ?? \"\").trim();\n if (!text) return;\n this.items = [...this.items, { id: crypto.randomUUID(), text, done: false }];\n this.draft = \"\";\n this.persist();\n }\n\n render() {\n return html`\n <wa-input\n placeholder=\"New item\"\n .value=${this.draft}\n @keydown=${(e) => { if (e.key === \"Enter\") this.addItem(); }}\n ></wa-input>\n <wa-button @click=${() => this.addItem()}>Add</wa-button>\n <ul>\n ${this.items.map((item) => html`<li>${item.text}</li>`)}\n </ul>\n `;\n }\n}\n```\n\n## Cross-origin resources\n\n`<img>`, `<link>`, and `<script>` tags without `crossorigin` are no-cors. A no-cors response that omits `Cross-Origin-Resource-Policy` fails with `not-set cross-origin-resource-policy`, even when it sends `Access-Control-Allow-Origin: *`. Moving that URL into an `<iframe srcdoc>` does not change the check. Subresources inside the frame follow the same rule.\n\nWhen the server only sends `Access-Control-Allow-Origin`, request the resource as CORS. `fetch()` already does. For an element, set `crossorigin=\"anonymous\"`. When a library creates the element, set its equivalent option (often `crossOrigin: \"anonymous\"`). A missing `Access-Control-Allow-Origin` header on that request is a CORS error, not the CORP error.\n\n```html\n<img crossorigin=\"anonymous\" src=\"https://cdn.example/asset.png\" />\n<script crossorigin=\"anonymous\" src=\"https://cdn.example/lib.js\"><\/script>\n```\n\nA host that sends neither header cannot be embedded in this page. Pass the string `\"anonymous\"` to a library option (`crossOrigin: \"anonymous\"`). A boolean `true` is not that option.\n\n## Styles inside the shadow root\n\nThe canvas renders in a shadow root. A `<link>` or `<style>` added to `document.head` does not apply to nodes inside that root. A widget that positions its own DOM with classes will load its images and still draw them in the wrong place until its stylesheet is on the shadow root.\n\nFetch the stylesheet as CORS and adopt it before constructing the widget:\n\n```js\nconst cssText = await (await fetch(stylesheetUrl, { mode: \"cors\" })).text();\nconst sheet = new CSSStyleSheet();\nsheet.replaceSync(cssText);\nthis.shadowRoot.adoptedStyleSheets = [...this.shadowRoot.adoptedStyleSheets, sheet];\n```\n\n`static styles` is for the host. Do not rely on a document-level stylesheet for DOM the library creates inside the shadow root.\n\n## Imports\n\n- `docks/canvas` — `CanvasView`, the Lit exports (`html`, `css`, `nothing`, `repeat`, `when`, `classMap`, and the rest), and the Web Awesome exports (`registerIconLibrary`). The elements are already registered.\n- `docks/core` — workspace files, dialogs, toasts, and commands. `openFile` does not need this import.\n- Relative imports → workspace files (compiler inlines them: JSON → value, text/CSS → string, binaries → data URL)\n\nBefore non-trivial UI or shell integration, load companion skills as needed:\n\n- `skills.load` `eclipse-docks-lit` — reactive properties, templates, directives (pure JS)\n- `skills.load` `eclipse-docks-webawesome` — `wa-*` components and layout utilities\n- `skills.load` `eclipse-docks-core` — workspace, editors, commands, dialogs, events\n\n## Workflow\n\n1. `workspace_write` the `<root>/….canvas.md` input (qualify with a root from `workspace_list`).\n2. `workspace_write` the `<root>/….canvas.js` app that this markdown drives, with the same stem in the same folder.\n3. `canvas.open` with that path — returns `ready` or the compile/runtime error.\n4. Before changing a canvas, `workspace_read` its `….canvas.md`. If the request changed, `workspace_write` that file, then `canvas.apply_source`. If that canvas is open in an editor, the editor marks itself dirty and recompiles the preview and does not save. If it is not open in an editor, the tool writes the file. Do not `workspace_write` a canvas that is already open.\n5. Optional: `canvas.capture_preview` to attach a screenshot (iframe contents may be blank).\n\nExtension-registered canvases live on `system.canvases` and open by name via `canvas.open`. That opens a read-only viewer. Do not edit it: `canvas.apply_source`, `canvas.get_source`, `canvas.set_state`, and any tools declared by that canvas are not available while it is active.\n";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { SKILL_default as default };
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/skills/eclipse-docks-core/SKILL.md?raw
|
|
2
|
-
var SKILL_default = "---\nname: eclipse-docks-core\ndescription: >-\n Eclipse Docks core runtime from docks/core: workspace files, editors, commands,\n contributions, dialogs, toasts, settings, and events. Use when a canvas or\n extension needs to open files, register UI, run commands, or talk to the shell.\n---\n\n# Eclipse Docks core (`docks/core`)\n\n```js\nimport {\n workspaceService,\n File,\n editorRegistry,\n commandRegistry,\n registerAll,\n contributionRegistry,\n publish,\n subscribe,\n unsubscribe,\n appSettings,\n toastInfo,\n toastError,\n confirmDialog,\n promptDialog,\n filebrowserDialog,\n} from \"docks/core\";\n```\n\nAlias: `@eclipse-docks/core`.
|
|
2
|
+
var SKILL_default = "---\nname: eclipse-docks-core\ndescription: >-\n Eclipse Docks core runtime from docks/core: workspace files, editors, commands,\n contributions, dialogs, toasts, settings, and events. Use when a canvas or\n extension needs to open files, register UI, run commands, or talk to the shell.\n---\n\n# Eclipse Docks core (`docks/core`)\n\n```js\nimport {\n workspaceService,\n File,\n editorRegistry,\n commandRegistry,\n registerAll,\n contributionRegistry,\n publish,\n subscribe,\n unsubscribe,\n appSettings,\n toastInfo,\n toastError,\n confirmDialog,\n promptDialog,\n filebrowserDialog,\n} from \"docks/core\";\n```\n\nAlias: `@eclipse-docks/core`. `publish`, `subscribe`, and `unsubscribe` come from this module.\n\n## Workspace\n\n```js\nconst workspace = workspaceService.getWorkspaceSync() ?? await workspaceService.getWorkspace();\nconst resource = await workspace.getResource(\"folder/note.md\");\nif (resource instanceof File) {\n const text = await resource.getContents();\n await resource.saveContents(text);\n}\n```\n\n- Paths are workspace-relative (root-prefixed in the composite workspace).\n- Create with `getResource(path, { create: true })` when the API allows.\n- A canvas opens a path in the editor with `this.openFile(path)` and does not import core for that call. Reading or writing file bytes still uses `workspaceService` and `File`.\n\n## Editors\n\n```js\nawait editorRegistry.loadEditor(file); // default handler\nawait editorRegistry.loadEditor(file, \"system.canvas-editor\");\n```\n\n`EditorInput` objects carry `title`, `key`, `data`, `component`, optional `state`. Prefer opening a `File` when one exists.\n\n## Commands\n\n```js\nregisterAll({\n command: {\n id: \"demo.ping\",\n name: \"Ping\",\n description: \"Demo command\",\n parameters: [],\n },\n handler: {\n execute: async () => \"pong\",\n },\n});\n\nawait commandRegistry.execute(\"demo.ping\", {});\n```\n\nCommands registered this way can surface as AI tools when the cognitive runtime refreshes command tools.\n\n## Contributions\n\n```js\nimport { SIDEBAR_MAIN, TOOLBAR_MAIN_RIGHT } from \"docks/core\";\n\ncontributionRegistry.registerContribution(SIDEBAR_MAIN, {\n name: \"demo.view\",\n label: \"Demo\",\n icon: \"star\",\n component: (id) => /* Lit html template for the view */ null,\n});\n```\n\nCommon slots: sidebars, panel bottom, toolbars, settings. Canvas modules contributed by extensions use `system.canvases` (`SYSTEM_CANVASES` from `@eclipse-docks/extension-canvas/contribution`). Each contribution sets a unique `settingsKey` for the state behind `getState` / `setState`. `load()` returns `{ default: CustomElementConstructor }`, or `source` is the canvas module text and the preview compiles it. A contributed canvas is not editable and opens without a toolbar.\n\n## Dialogs & toasts\n\n```js\nconst ok = await confirmDialog(\"Replace file?\");\nconst name = await promptDialog(\"Name?\");\ntoastInfo(\"Saved\");\ntoastError(\"Failed\");\n```\n\n`filebrowserDialog` for folder/file picks; `formDialog` for multi-field forms. Prefer these over ad-hoc `window.prompt` in shell-integrated code.\n\n## Settings & events\n\n```js\nawait appSettings.set(\"demo.flag\", true);\nconst flag = await appSettings.get(\"demo.flag\");\n\nconst id = subscribe(\"topic.name\", (event) => { /* … */ });\npublish(\"topic.name\", { detail: 1 });\nunsubscribe(id);\n```\n\n## Logging\n\n```js\nimport { createLogger } from \"docks/core\";\nconst log = createLogger(\"demo\");\nlog.info(\"ready\");\n```\n\n## Canvas notes\n\n- A canvas app consists of three files with the same stem: `….canvas.js`, `….canvas.json`, and `….canvas.md`. The `….canvas.md` file is the input that drives generation of the `….canvas.js` app. Persist with `this.getState` / `this.setState` inside `onConnect` and later. `setState` creates the `….canvas.json`. Use `appSettings` only to share app-wide settings. A contributed canvas stores that state under its `settingsKey` and has no `….canvas.md`.\n- `this.openFile(path)` opens a workspace path. Dialogs, toasts, and file contents stay on `docks/core`.\n- A canvas listens and publishes with `this.subscribe`, `this.unsubscribe`, and `this.publish`. It does not import those functions.\n- Cross-origin loads follow the canvas skill: CORS plus `Access-Control-Allow-Origin`, or `Cross-Origin-Resource-Policy: cross-origin`. An iframe `srcdoc` does not opt out.\n\n## Anti-patterns\n\n- Bare filenames at the composite workspace root when a durable root prefix is required\n- Calling `getState`, `setState`, or `openFile` before `onConnect`\n- Re-implementing toast/dialog with `alert` when core helpers are available\n";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { SKILL_default as default };
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/skills/eclipse-docks-lit/SKILL.md?raw
|
|
2
|
-
var SKILL_default = "---\nname: eclipse-docks-lit\ndescription: >-\n
|
|
2
|
+
var SKILL_default = "---\nname: eclipse-docks-lit\ndescription: >-\n Lit templates, reactive properties, and directives for Eclipse Docks canvases.\n Use when writing or fixing .canvas.js render methods, static properties,\n directives, or styles — pure JavaScript only (no TypeScript decorators).\n---\n\n# Eclipse Docks Lit\n\nA `.canvas.js` file imports `CanvasView` and every Lit export from `docks/canvas`. Use **pure JavaScript only** — no TypeScript, no decorators (`@property`, `@state`, `@customElement` are unavailable).\n\n## Essentials\n\n```js\nimport { CanvasView, html, css, nothing } from \"docks/canvas\";\n\nexport default class extends CanvasView {\n static properties = { count: { state: true }, label: { type: String } };\n static styles = css`:host { display: block; }`;\n\n render() {\n return this.count ? html`<span>${this.label}</span>` : nothing;\n }\n}\n```\n\n- The host registers the tag. Use `onConnect` and `onDisconnect` for setup and teardown.\n- Reactive fields: `static properties = { count: { state: true }, label: { type: String } }`.\n- Initialize defaults in `constructor` after `super()`.\n- Styles: `static styles = css\\`:host { display: block; }\\`;` (or an array of `css` results).\n- Templates: `render() { return html\\`...\\`; }` — use `nothing` for empty branches.\n- Shell UI that is not a canvas imports Lit from `docks/lit`. A canvas does not.\n\n## Property options (common)\n\n| Option | Meaning |\n| --- | --- |\n| `state: true` | Internal reactive state (not an attribute) |\n| `type: String` / `Number` / `Boolean` / `Object` / `Array` | Attribute reflection helpers |\n| `attribute: false` | Do not mirror to an attribute |\n| `reflect: true` | Reflect property → attribute |\n\nAssign **new** values for objects/arrays (`this.items = [...this.items, next]`), do not mutate in place if you need an update.\n\n## Directives\n\nNamed exports from `docks/canvas` (the same module as `@eclipse-docks/core/externals/lit`):\n\n```js\nimport { repeat, when, classMap, styleMap, ifDefined, live, ref, keyed } from \"docks/canvas\";\n```\n\n- `repeat(items, (i) => i.id, (i) => html\\`...\\`)` for keyed lists\n- `when(cond, () => html\\`...\\`)` / `nothing` for conditionals\n- `classMap({ active: isOn })`, `styleMap({ width: \"1rem\" })`\n- `live(value)` when binding to form controls that can diverge from the property\n- Prefer `.value=${x}` (property) over `value=${x}` (attribute) for form controls\n\n## Events in templates\n\n```js\nhtml`<wa-button @click=${this.onSave}>Save</wa-button>`\n```\n\nUse arrow functions or bound methods so `this` stays the element. For `wa-*` props and events, follow `eclipse-docks-webawesome`.\n\n## Signals (optional)\n\n`docks/canvas` also exports the signal helpers `signal`, `computed`, `watch`, `SignalWatcher`, and `withWatch`. Prefer `static properties` for simple canvas state unless you already use signals.\n\n## Anti-patterns\n\n- Extending `LitElement` or calling `customElements.define` in a `.canvas.js` file\n- Decorators or `.ts` syntax in `.canvas.js`\n- Implementing `connectedCallback` or `disconnectedCallback` on a canvas\n- Mutating arrays/objects in place without reassignment\n- Relying on `this` inside a non-arrow inline handler incorrectly\n";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { SKILL_default as default };
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/skills/eclipse-docks-webawesome/SKILL.md?raw
|
|
2
|
-
var SKILL_default = "---\nname: eclipse-docks-webawesome\ndescription: >-\n Web Awesome UI in Eclipse Docks via docks/webawesome. Use when building\n buttons, inputs, selects, checkboxes, dialogs, forms, icons, or layout\n utilities in canvases or Docks UI. Fetch the official component page before\n writing wa-* markup.\n---\n\n# Eclipse Docks Web Awesome
|
|
2
|
+
var SKILL_default = "---\nname: eclipse-docks-webawesome\ndescription: >-\n Web Awesome UI in Eclipse Docks via docks/webawesome. Use when building\n buttons, inputs, selects, checkboxes, dialogs, forms, icons, or layout\n utilities in canvases or Docks UI. Fetch the official component page before\n writing wa-* markup.\n---\n\n# Eclipse Docks Web Awesome\n\nA canvas extends `CanvasView`. That registers the components, the theme, and the `docks` icon library, and it exports the Web Awesome module. Import `registerIconLibrary` from `docks/canvas`. Do not import `docks/webawesome` from a `.canvas.js` file. Custom elements take a closing tag: `<wa-input></wa-input>`.\n\nShell UI outside a canvas uses `docks/webawesome`:\n\n```js\nimport \"docks/webawesome\";\nimport { registerIconLibrary } from \"docks/webawesome\";\n```\n\n## Look up the component, then write it\n\nFetch the official page for each tag before using its props, slots, or events. Use that page's events table. Ignore the overview line that says to listen for `wa-input` or `wa-change`.\n\n- Index: https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist/skills/webawesome/SKILL.md\n- One component: `https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist/skills/webawesome/references/components/<name>.md` (`button`, `input`, `checkbox`, `select`, …)\n- Which component: https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist/skills/webawesome/references/choosing-components.md\n- Layout, tokens, theming: https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist/skills/webawesome-design/SKILL.md\n\nBind properties (`.value`, `.checked`). Listen for the events that page lists.\n\n## `wa-input` and `wa-number-input`\n\nTheir pages list an `input` event. This build copies keystrokes onto `.value` and does not re-dispatch `input`, so a host `@input` listener never runs. `change` fires on blur, after a click handler.\n\nRead `.value` in the click or Enter handler. For live text, use `@keyup` and assign `e.target.value`. `wa-textarea` does re-dispatch `input`.\n\n## Docks\n\n- Shell icons: `<wa-icon library=\"docks\" name=\"…\"></wa-icon>`. Other icons use the names on the icon page.\n- Color comes from `--wa-color-*` tokens so the loaded theme covers light and dark.\n- Shell toasts: `toastInfo` / `toastError` from `docks/core` when that module is already loaded.\n";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { SKILL_default as default };
|
|
5
5
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-docks/extension-canvas",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@eclipse-docks/core": "*",
|
|
27
27
|
"@eclipse-docks/extension-ai-system": "*",
|
|
28
|
+
"@eclipse-docks/extension-catalog": "*",
|
|
28
29
|
"@eclipse-docks/extension-monaco-editor": "*",
|
|
29
30
|
"modern-screenshot": "^4.7.0"
|
|
30
31
|
},
|
package/dist/bridges/events.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/bridges/events.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
|
package/dist/bridges/events.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { registerCanvasSubpath } from "./register.js";
|
|
2
|
-
import * as events from "@eclipse-docks/core/core/events";
|
|
3
|
-
//#region src/bridges/events.ts
|
|
4
|
-
registerCanvasSubpath("./core/events", events);
|
|
5
|
-
var canvasBridgeHref = import.meta.url;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { canvasBridgeHref };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=events.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../../src/bridges/events.ts"],"sourcesContent":["import * as events from '@eclipse-docks/core/core/events';\nimport { registerCanvasSubpath } from './register';\n\nregisterCanvasSubpath('./core/events', events);\nexport const canvasBridgeHref = import.meta.url;\n"],"mappings":";;;AAGA,sBAAsB,iBAAiB,MAAM;AAC7C,IAAa,mBAAmB,YAAY"}
|
package/dist/bridges/lit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lit.d.ts","sourceRoot":"","sources":["../../src/bridges/lit.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
|
package/dist/bridges/lit.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { registerCanvasBridge } from "./register.js";
|
|
2
|
-
import * as lit from "@eclipse-docks/core/externals/lit";
|
|
3
|
-
//#region src/bridges/lit.ts
|
|
4
|
-
registerCanvasBridge("lit", lit, "./externals/lit");
|
|
5
|
-
var canvasBridgeHref = import.meta.url;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { canvasBridgeHref };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=lit.js.map
|
package/dist/bridges/lit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lit.js","names":[],"sources":["../../src/bridges/lit.ts"],"sourcesContent":["import * as lit from '@eclipse-docks/core/externals/lit';\nimport { registerCanvasBridge } from './register';\n\nregisterCanvasBridge('lit', lit, './externals/lit');\nexport const canvasBridgeHref = import.meta.url;\n"],"mappings":";;;AAGA,qBAAqB,OAAO,KAAK,iBAAiB;AAClD,IAAa,mBAAmB,YAAY"}
|
package/dist/bridges/parts.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../src/bridges/parts.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AAInC,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
|
package/dist/bridges/parts.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { registerCanvasSubpath } from "./register.js";
|
|
2
|
-
import "@eclipse-docks/core/parts";
|
|
3
|
-
//#region src/bridges/parts.ts
|
|
4
|
-
registerCanvasSubpath("./parts", {});
|
|
5
|
-
var canvasBridgeHref = import.meta.url;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { canvasBridgeHref };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=parts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parts.js","names":[],"sources":["../../src/bridges/parts.ts"],"sourcesContent":["import '@eclipse-docks/core/parts';\nimport { registerCanvasSubpath } from './register';\n\nregisterCanvasSubpath('./parts', {});\nexport const canvasBridgeHref = import.meta.url;\n"],"mappings":";;;AAGA,sBAAsB,WAAW,CAAC,CAAC;AACnC,IAAa,mBAAmB,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"third-party.d.ts","sourceRoot":"","sources":["../../src/bridges/third-party.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { registerCanvasSubpath } from "./register.js";
|
|
2
|
-
import * as thirdParty from "@eclipse-docks/core/externals/third-party";
|
|
3
|
-
//#region src/bridges/third-party.ts
|
|
4
|
-
registerCanvasSubpath("./externals/third-party", thirdParty);
|
|
5
|
-
var canvasBridgeHref = import.meta.url;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { canvasBridgeHref };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=third-party.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"third-party.js","names":[],"sources":["../../src/bridges/third-party.ts"],"sourcesContent":["import * as thirdParty from '@eclipse-docks/core/externals/third-party';\nimport { registerCanvasSubpath } from './register';\n\nregisterCanvasSubpath('./externals/third-party', thirdParty);\nexport const canvasBridgeHref = import.meta.url;\n"],"mappings":";;;AAGA,sBAAsB,2BAA2B,UAAU;AAC3D,IAAa,mBAAmB,YAAY"}
|
package/dist/bridges/urls.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urls.d.ts","sourceRoot":"","sources":["../../src/bridges/urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAShD,wBAAgB,aAAa,IAAI,aAAa,CAc7C"}
|
package/dist/bridges/urls.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { canvasBridgeHref } from "./core.js";
|
|
2
|
-
import { canvasBridgeHref as canvasBridgeHref$1 } from "./events.js";
|
|
3
|
-
import { canvasBridgeHref as canvasBridgeHref$2 } from "./lit.js";
|
|
4
|
-
import { canvasBridgeHref as canvasBridgeHref$3 } from "./parts.js";
|
|
5
|
-
import { canvasBridgeHref as canvasBridgeHref$4 } from "./third-party.js";
|
|
6
|
-
import { canvasBridgeHref as canvasBridgeHref$5 } from "./webawesome.js";
|
|
7
|
-
import { canvasBridgeHref as canvasBridgeHref$6 } from "./widgets.js";
|
|
8
|
-
//#region src/bridges/urls.ts
|
|
9
|
-
function canvasBridges() {
|
|
10
|
-
return {
|
|
11
|
-
lit: canvasBridgeHref$2,
|
|
12
|
-
webawesome: canvasBridgeHref$5,
|
|
13
|
-
core: canvasBridgeHref,
|
|
14
|
-
coreSubpaths: {
|
|
15
|
-
"./externals/lit": canvasBridgeHref$2,
|
|
16
|
-
"./externals/webawesome": canvasBridgeHref$5,
|
|
17
|
-
"./externals/third-party": canvasBridgeHref$4,
|
|
18
|
-
"./parts": canvasBridgeHref$3,
|
|
19
|
-
"./widgets": canvasBridgeHref$6,
|
|
20
|
-
"./core/events": canvasBridgeHref$1
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
//#endregion
|
|
25
|
-
export { canvasBridges };
|
|
26
|
-
|
|
27
|
-
//# sourceMappingURL=urls.js.map
|
package/dist/bridges/urls.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urls.js","names":["lit","webawesome","thirdParty","parts","widgets","events"],"sources":["../../src/bridges/urls.ts"],"sourcesContent":["import type { CanvasBridges } from '../compile';\nimport { canvasBridgeHref as core } from './core';\nimport { canvasBridgeHref as events } from './events';\nimport { canvasBridgeHref as lit } from './lit';\nimport { canvasBridgeHref as parts } from './parts';\nimport { canvasBridgeHref as thirdParty } from './third-party';\nimport { canvasBridgeHref as webawesome } from './webawesome';\nimport { canvasBridgeHref as widgets } from './widgets';\n\nexport function canvasBridges(): CanvasBridges {\n return {\n lit,\n webawesome,\n core,\n coreSubpaths: {\n './externals/lit': lit,\n './externals/webawesome': webawesome,\n './externals/third-party': thirdParty,\n './parts': parts,\n './widgets': widgets,\n './core/events': events,\n },\n };\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,gBAA+B;CAC3C,OAAO;EACH,KAAA;EACA,YAAA;EACA,MAAA;EACA,cAAc;GACV,mBAAmBA;GACnB,0BAA0BC;GAC1B,2BAA2BC;GAC3B,WAAWC;GACX,aAAaC;GACb,iBAAiBC;EACrB;CACJ;AACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webawesome.d.ts","sourceRoot":"","sources":["../../src/bridges/webawesome.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { registerCanvasBridge } from "./register.js";
|
|
2
|
-
import * as webawesome from "@eclipse-docks/core/externals/webawesome";
|
|
3
|
-
//#region src/bridges/webawesome.ts
|
|
4
|
-
registerCanvasBridge("webawesome", webawesome, "./externals/webawesome");
|
|
5
|
-
var canvasBridgeHref = import.meta.url;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { canvasBridgeHref };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=webawesome.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webawesome.js","names":[],"sources":["../../src/bridges/webawesome.ts"],"sourcesContent":["import * as webawesome from '@eclipse-docks/core/externals/webawesome';\nimport { registerCanvasBridge } from './register';\n\nregisterCanvasBridge('webawesome', webawesome, './externals/webawesome');\nexport const canvasBridgeHref = import.meta.url;\n"],"mappings":";;;AAGA,qBAAqB,cAAc,YAAY,wBAAwB;AACvE,IAAa,mBAAmB,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.d.ts","sourceRoot":"","sources":["../../src/bridges/widgets.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC;AAIrC,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
|
package/dist/bridges/widgets.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { registerCanvasSubpath } from "./register.js";
|
|
2
|
-
import "@eclipse-docks/core/widgets";
|
|
3
|
-
//#region src/bridges/widgets.ts
|
|
4
|
-
registerCanvasSubpath("./widgets", {});
|
|
5
|
-
var canvasBridgeHref = import.meta.url;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { canvasBridgeHref };
|
|
8
|
-
|
|
9
|
-
//# sourceMappingURL=widgets.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widgets.js","names":[],"sources":["../../src/bridges/widgets.ts"],"sourcesContent":["import '@eclipse-docks/core/widgets';\nimport { registerCanvasSubpath } from './register';\n\nregisterCanvasSubpath('./widgets', {});\nexport const canvasBridgeHref = import.meta.url;\n"],"mappings":";;;AAGA,sBAAsB,aAAa,CAAC,CAAC;AACrC,IAAa,mBAAmB,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-readonly.d.ts","sourceRoot":"","sources":["../src/canvas-readonly.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,wEAAwE;AACxE,qBACa,mBAAoB,SAAQ,eAAe;IACpD,QAAQ,CAAC,IAAI,EAAG,YAAY,CAAU;IAEtC,OAAO,CAAC,YAAY,CAAC,CAAqB;IAE1C;;;OAGG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;cAEpB,QAAQ;YAeV,KAAK;YAWL,iBAAiB;CAKlC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,uBAAuB,EAAE,mBAAmB,CAAC;KAChD;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-readonly.js","names":[],"sources":["../src/canvas-readonly.ts"],"sourcesContent":["import { customElement } from '@eclipse-docks/core/externals/lit';\nimport type { CanvasContribution } from './contribution';\nimport { DocksCanvasPart } from './canvas-part';\nimport { createContributionHost } from './host';\n\n/** Read-only preview for a canvas opened from the canvases dropdown. */\n@customElement('docks-canvas-readonly')\nexport class DocksCanvasReadonly extends DocksCanvasPart {\n readonly kind = 'registered' as const;\n\n private contribution?: CanvasContribution;\n\n /**\n * A part is the active editor only when `save` is overridden.\n * This one writes nothing.\n */\n override async save(): Promise<void> {}\n\n protected async doInitUI() {\n const data = this.input?.data as { contribution?: CanvasContribution } | undefined;\n const contribution = data?.contribution;\n if (!contribution) {\n this.previewError = 'No canvas contribution';\n this.ready = true;\n return;\n }\n this.contribution = contribution;\n this.canvasName = contribution.name;\n this.host = await createContributionHost(contribution);\n this.ready = true;\n await this.mount();\n }\n\n private async mount() {\n const contribution = this.contribution;\n if (!contribution) return;\n if (contribution.load) {\n await this.mountLoadedConstructor(contribution.load, this.source);\n return;\n }\n const source = await this.contributedSource(contribution);\n await this.mountCompiledSource(source, `${contribution.name}.canvas.js`);\n }\n\n private async contributedSource(contribution: CanvasContribution): Promise<string> {\n if (this.source) return this.source;\n if (typeof contribution.source === 'function') return contribution.source();\n return contribution.source ?? '';\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'docks-canvas-readonly': DocksCanvasReadonly;\n }\n}\n"],"mappings":";;;;;AAOO,IAAM,sBAAN,MAAM,4BAA4B,gBAAgB;;;EACrC,KAAA,OAAA;;;;;;CAQhB,MAAe,OAAsB,CAAC;CAEtC,MAAgB,WAAW;EAEvB,MAAM,gBADO,KAAK,OAAO,KAAA,EACE;EAC3B,IAAI,CAAC,cAAc;GACf,KAAK,eAAe;GACpB,KAAK,QAAQ;GACb;EACJ;EACA,KAAK,eAAe;EACpB,KAAK,aAAa,aAAa;EAC/B,KAAK,OAAO,MAAM,uBAAuB,YAAY;EACrD,KAAK,QAAQ;EACb,MAAM,KAAK,MAAM;CACrB;CAEA,MAAc,QAAQ;EAClB,MAAM,eAAe,KAAK;EAC1B,IAAI,CAAC,cAAc;EACnB,IAAI,aAAa,MAAM;GACnB,MAAM,KAAK,uBAAuB,aAAa,MAAM,KAAK,MAAM;GAChE;EACJ;EACA,MAAM,SAAS,MAAM,KAAK,kBAAkB,YAAY;EACxD,MAAM,KAAK,oBAAoB,QAAQ,GAAG,aAAa,KAAK,WAAW;CAC3E;CAEA,MAAc,kBAAkB,cAAmD;EAC/E,IAAI,KAAK,QAAQ,OAAO,KAAK;EAC7B,IAAI,OAAO,aAAa,WAAW,YAAY,OAAO,aAAa,OAAO;EAC1E,OAAO,aAAa,UAAU;CAClC;AACJ;AA3CC,sBAAA,UAAA,CAAA,cAAc,uBAAuB,CAAA,GAAA,mBAAA"}
|