@eclipse-docks/extension-canvas 0.8.8 → 0.8.9

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.
Files changed (81) hide show
  1. package/dist/active-canvas.js +2 -2
  2. package/dist/active-canvas.js.map +1 -1
  3. package/dist/bridges/canvas.d.ts +2 -0
  4. package/dist/bridges/canvas.d.ts.map +1 -0
  5. package/dist/bridges/canvas.js +13 -0
  6. package/dist/bridges/canvas.js.map +1 -0
  7. package/dist/bridges/core.d.ts +1 -1
  8. package/dist/bridges/core.d.ts.map +1 -1
  9. package/dist/bridges/core.js +1 -3
  10. package/dist/bridges/core.js.map +1 -1
  11. package/dist/bridges/register.d.ts +3 -6
  12. package/dist/bridges/register.d.ts.map +1 -1
  13. package/dist/bridges/register.js +8 -7
  14. package/dist/bridges/register.js.map +1 -1
  15. package/dist/canvas-catalog.d.ts +2 -0
  16. package/dist/canvas-catalog.d.ts.map +1 -0
  17. package/dist/canvas-catalog.js +39 -0
  18. package/dist/canvas-catalog.js.map +1 -0
  19. package/dist/canvas-editor.d.ts +4 -6
  20. package/dist/canvas-editor.d.ts.map +1 -1
  21. package/dist/canvas-editor.js +15 -14
  22. package/dist/canvas-editor.js.map +1 -1
  23. package/dist/canvas-extension.d.ts.map +1 -1
  24. package/dist/canvas-extension.js +10 -0
  25. package/dist/canvas-extension.js.map +1 -1
  26. package/dist/canvas-module.d.ts +20 -0
  27. package/dist/canvas-module.d.ts.map +1 -0
  28. package/dist/canvas-module.js +52 -0
  29. package/dist/canvas-module.js.map +1 -0
  30. package/dist/canvas-part.d.ts.map +1 -1
  31. package/dist/canvas-part.js +3 -3
  32. package/dist/canvas-part.js.map +1 -1
  33. package/dist/{canvas-readonly.d.ts → canvas-viewer.d.ts} +3 -3
  34. package/dist/canvas-viewer.d.ts.map +1 -0
  35. package/dist/{canvas-readonly.js → canvas-viewer.js} +5 -5
  36. package/dist/canvas-viewer.js.map +1 -0
  37. package/dist/canvases/player.canvas.js +6 -0
  38. package/dist/canvases/player.canvas.js.map +1 -0
  39. package/dist/canvases/tasks.canvas.js +1 -1
  40. package/dist/commands.d.ts.map +1 -1
  41. package/dist/commands.js +4 -4
  42. package/dist/commands.js.map +1 -1
  43. package/dist/compile.d.ts +2 -10
  44. package/dist/compile.d.ts.map +1 -1
  45. package/dist/compile.js +16 -20
  46. package/dist/compile.js.map +1 -1
  47. package/dist/skills/eclipse-docks-canvas/SKILL.js +1 -1
  48. package/dist/skills/eclipse-docks-core/SKILL.js +1 -1
  49. package/dist/skills/eclipse-docks-lit/SKILL.js +1 -1
  50. package/dist/skills/eclipse-docks-webawesome/SKILL.js +1 -1
  51. package/package.json +2 -1
  52. package/dist/bridges/events.d.ts +0 -2
  53. package/dist/bridges/events.d.ts.map +0 -1
  54. package/dist/bridges/events.js +0 -9
  55. package/dist/bridges/events.js.map +0 -1
  56. package/dist/bridges/lit.d.ts +0 -2
  57. package/dist/bridges/lit.d.ts.map +0 -1
  58. package/dist/bridges/lit.js +0 -9
  59. package/dist/bridges/lit.js.map +0 -1
  60. package/dist/bridges/parts.d.ts +0 -2
  61. package/dist/bridges/parts.d.ts.map +0 -1
  62. package/dist/bridges/parts.js +0 -9
  63. package/dist/bridges/parts.js.map +0 -1
  64. package/dist/bridges/third-party.d.ts +0 -2
  65. package/dist/bridges/third-party.d.ts.map +0 -1
  66. package/dist/bridges/third-party.js +0 -9
  67. package/dist/bridges/third-party.js.map +0 -1
  68. package/dist/bridges/urls.d.ts +0 -3
  69. package/dist/bridges/urls.d.ts.map +0 -1
  70. package/dist/bridges/urls.js +0 -27
  71. package/dist/bridges/urls.js.map +0 -1
  72. package/dist/bridges/webawesome.d.ts +0 -2
  73. package/dist/bridges/webawesome.d.ts.map +0 -1
  74. package/dist/bridges/webawesome.js +0 -9
  75. package/dist/bridges/webawesome.js.map +0 -1
  76. package/dist/bridges/widgets.d.ts +0 -2
  77. package/dist/bridges/widgets.d.ts.map +0 -1
  78. package/dist/bridges/widgets.js +0 -9
  79. package/dist/bridges/widgets.js.map +0 -1
  80. package/dist/canvas-readonly.d.ts.map +0 -1
  81. package/dist/canvas-readonly.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"compile.js","names":[],"sources":["../src/compile.ts"],"sourcesContent":["export interface CanvasFileBytes {\n text?: string;\n bytes?: Uint8Array;\n}\n\nexport type CanvasFileReader = (path: string) => Promise<CanvasFileBytes | null>;\n\nexport interface CanvasBridges {\n lit: string;\n webawesome: string;\n core: string;\n /** Package export subpath (`./parts`) to a module URL. */\n coreSubpaths: Record<string, string>;\n}\n\nexport interface CompileCanvasInput {\n entryPath: string;\n entrySource: string;\n read: CanvasFileReader;\n bridges: CanvasBridges;\n}\n\nexport type CompileCanvasResult = { ok: true; code: string } | { ok: false; error: string };\n\ninterface GraphModule {\n path: string;\n kind: \"js\" | \"json\" | \"text\" | \"binary\";\n text?: string;\n bytes?: Uint8Array;\n mime?: string;\n}\n\ninterface SpecRef {\n spec: string;\n start: number;\n end: number;\n raw: string;\n form: \"import\" | \"export-from\" | \"dynamic\" | \"asset-url\";\n}\n\nconst TEXT_EXT = new Set([\"js\", \"mjs\", \"css\", \"json\", \"svg\", \"txt\", \"md\", \"html\", \"csv\"]);\nconst MIME: Record<string, string> = {\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n ico: \"image/x-icon\",\n woff: \"font/woff\",\n woff2: \"font/woff2\",\n pdf: \"application/pdf\",\n wasm: \"application/wasm\",\n svg: \"image/svg+xml\",\n};\n\nexport function resolveWorkspacePath(fromFile: string, spec: string): string {\n const base = fromFile.split(\"/\").filter(Boolean);\n base.pop();\n for (const part of spec.split(\"/\")) {\n if (part === \"\" || part === \".\") continue;\n if (part === \"..\") base.pop();\n else base.push(part);\n }\n return base.join(\"/\");\n}\n\nexport function isRelativeSpecifier(spec: string): boolean {\n return spec.startsWith(\"./\") || spec.startsWith(\"../\");\n}\n\nexport function bridgeRuntime(spec: string, bridges: CanvasBridges): string | null {\n if (spec === \"docks/lit\" || spec === \"@eclipse-docks/core/externals/lit\") return \"__docksCanvas.lit\";\n if (spec === \"docks/webawesome\" || spec === \"@eclipse-docks/core/externals/webawesome\") return \"__docksCanvas.webawesome\";\n if (spec === \"docks/core\" || spec === \"@eclipse-docks/core\") return \"__docksCanvas.core\";\n const sub = coreSubpath(spec);\n if (!sub || !bridges.coreSubpaths[sub]) return null;\n return `__docksCanvas.subpaths[${JSON.stringify(sub)}]`;\n}\n\nexport function rewriteBridgeSpecifier(spec: string, bridges: CanvasBridges): string {\n if (spec === \"docks/lit\" || spec === \"@eclipse-docks/core/externals/lit\") return bridges.lit;\n if (spec === \"docks/webawesome\" || spec === \"@eclipse-docks/core/externals/webawesome\") return bridges.webawesome;\n if (spec === \"docks/core\" || spec === \"@eclipse-docks/core\") return bridges.core;\n const sub = coreSubpath(spec);\n if (!sub) return spec;\n return bridges.coreSubpaths[sub] ?? spec;\n}\n\nfunction coreSubpath(spec: string): string | null {\n if (spec.startsWith(\"@eclipse-docks/core/\")) return `./${spec.slice(\"@eclipse-docks/core/\".length)}`;\n if (spec.startsWith(\"docks/core/\")) return `./${spec.slice(\"docks/core/\".length)}`;\n return null;\n}\n\nfunction extensionOf(path: string): string {\n const base = path.split(\"/\").pop() ?? path;\n const dot = base.lastIndexOf(\".\");\n return dot >= 0 ? base.slice(dot + 1).toLowerCase() : \"\";\n}\n\nfunction isJavaScript(path: string): boolean {\n const ext = extensionOf(path);\n return ext === \"js\" || ext === \"mjs\" || path.endsWith(\".canvas.js\");\n}\n\nfunction toBase64(bytes: Uint8Array): string {\n const bufferCtor = (globalThis as { Buffer?: { from(data: Uint8Array): { toString(encoding: string): string } } }).Buffer;\n if (bufferCtor) return bufferCtor.from(bytes).toString(\"base64\");\n let binary = \"\";\n for (const byte of bytes) binary += String.fromCharCode(byte);\n return btoa(binary);\n}\n\nfunction findRefs(code: string): SpecRef[] {\n const patterns: Array<{ form: SpecRef[\"form\"]; re: RegExp }> = [\n { form: \"asset-url\", re: /new\\s+URL\\(\\s*(['\"])([^'\"]+)\\1\\s*,\\s*import\\.meta\\.url\\s*\\)/g },\n { form: \"dynamic\", re: /\\bimport\\(\\s*(['\"])([^'\"]+)\\1\\s*\\)/g },\n { form: \"export-from\", re: /\\bexport\\s+(?:type\\s+)?(?:\\*\\s+as\\s+\\w+|\\*|\\{[^}]*\\})\\s+from\\s*(['\"])([^'\"]+)\\1/g },\n { form: \"import\", re: /\\bimport\\s+(?:type\\s+)?(?:[^'\";]*?\\s+from\\s+)?(['\"])([^'\"]+)\\1/g },\n ];\n const refs: SpecRef[] = [];\n for (const { form, re } of patterns) {\n for (const match of code.matchAll(re)) {\n const spec = match[2];\n if (!spec || match.index === undefined) continue;\n refs.push({\n spec,\n start: match.index,\n end: match.index + match[0].length,\n raw: match[0],\n form,\n });\n }\n }\n refs.sort((a, b) => a.start - b.start || b.end - a.end);\n const kept: SpecRef[] = [];\n let cursor = -1;\n for (const ref of refs) {\n if (ref.start < cursor) continue;\n kept.push(ref);\n cursor = ref.end;\n }\n return kept;\n}\n\nfunction rewriteLocalExports(code: string): string {\n let out = code.replace(/export\\s+default\\s+/g, \"__exports.default = \");\n out = out.replace(/export\\s+(async\\s+)?function\\s+(\\w+)/g, (_all, asyncKw: string | undefined, name: string) => {\n return `__exports.${name} = ${asyncKw ?? \"\"}function ${name}`;\n });\n out = out.replace(/export\\s+class\\s+(\\w+)/g, \"__exports.$1 = class $1\");\n out = out.replace(/export\\s+(const|let|var)\\s+(\\w+)\\s*=/g, \"$1 $2 = __exports.$2 =\");\n out = out.replace(/export\\s*\\{([^}]+)\\}\\s*;?/g, (_all, inner: string) => {\n return inner.split(\",\").map(part => {\n const [from, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n if (!from) return \"\";\n return `__exports.${alias || from} = ${from};`;\n }).join(\"\\n\");\n });\n return out;\n}\n\ninterface ExternalImport {\n line: string;\n local: string;\n imported: string;\n}\n\nfunction externalBinding(specUrl: string, imported: string, externals: ExternalImport[], seq: { n: number }): string {\n const existing = externals.find(item => item.line.includes(JSON.stringify(specUrl)) && item.imported === imported);\n if (existing) return existing.local;\n const local = `__ext_${seq.n++}`;\n if (imported === \"*\") {\n externals.push({ local, imported, line: `import * as ${local} from ${JSON.stringify(specUrl)};` });\n } else if (imported === \"side\") {\n externals.push({ local, imported, line: `import ${JSON.stringify(specUrl)};` });\n } else {\n externals.push({\n local,\n imported,\n line: `import { ${imported} as ${local} } from ${JSON.stringify(specUrl)};`,\n });\n }\n return local;\n}\n\nfunction importPrelude(raw: string, load: string): string {\n const clause = raw.replace(/\\s+/g, \" \").trim();\n if (/^import\\s+['\"]/.test(clause)) return `await ${load};`;\n const named = clause.match(/\\{([^}]*)\\}/);\n const namespace = clause.match(/\\*\\s+as\\s+(\\w+)/);\n const defaultName = clause.match(/^import\\s+(?!type\\b)(\\w+)\\s*(?:,|from)/);\n const lines: string[] = [];\n if (defaultName) lines.push(`const ${defaultName[1]} = (await ${load}).default;`);\n if (namespace) lines.push(`const ${namespace[1]} = await ${load};`);\n if (named) {\n const pairs = named[1].split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return alias ? `${imported}: ${alias}` : imported;\n });\n if (pairs.length) lines.push(`const { ${pairs.join(\", \")} } = await ${load};`);\n }\n return lines.join(\"\\n\");\n}\n\nfunction exportFromPrelude(raw: string, load: string): string {\n if (/\\*\\s+as\\s+(\\w+)/.test(raw)) {\n const name = raw.match(/\\*\\s+as\\s+(\\w+)/)?.[1] ?? \"ns\";\n return `const ${name} = await ${load};\\nObject.assign(__exports, { ${name} });`;\n }\n if (raw.includes(\"*\")) {\n return `Object.assign(__exports, await ${load});\\ndelete __exports.default;`;\n }\n const inner = raw.match(/\\{([^}]*)\\}/)?.[1] ?? \"\";\n const lines = inner.split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return `__exports.${alias || imported} = (await ${load}).${imported};`;\n });\n return lines.join(\"\\n\");\n}\n\nexport async function compileCanvas(input: CompileCanvasInput): Promise<CompileCanvasResult> {\n const modules: GraphModule[] = [];\n const indexByPath = new Map<string, number>();\n const stack: string[] = [];\n\n const addModule = async (path: string, source?: string): Promise<number | string> => {\n const known = indexByPath.get(path);\n if (known !== undefined) return known;\n if (stack.includes(path)) return `Circular workspace import: ${[...stack, path].join(\" -> \")}`;\n stack.push(path);\n const ext = extensionOf(path);\n let mod: GraphModule;\n if (source !== undefined) {\n mod = { path, kind: \"js\", text: source };\n } else if (isJavaScript(path)) {\n const file = await input.read(path);\n if (!file?.text && file?.text !== \"\") return missing(path);\n mod = { path, kind: \"js\", text: file?.text ?? \"\" };\n } else if (ext === \"json\" || TEXT_EXT.has(ext)) {\n const file = await input.read(path);\n if (file?.text === undefined) return missing(path);\n mod = { path, kind: ext === \"json\" ? \"json\" : \"text\", text: file.text };\n } else {\n const file = await input.read(path);\n const bytes = file?.bytes ?? (file?.text !== undefined ? new TextEncoder().encode(file.text) : undefined);\n if (!bytes) return missing(path);\n mod = { path, kind: \"binary\", bytes, mime: MIME[ext] ?? \"application/octet-stream\" };\n }\n const id = modules.length;\n modules.push(mod);\n indexByPath.set(path, id);\n if (mod.kind === \"js\" && mod.text !== undefined) {\n for (const ref of findRefs(mod.text)) {\n if (!isRelativeSpecifier(ref.spec)) continue;\n const resolved = resolveWorkspacePath(path, ref.spec);\n const child = await addModule(resolved);\n if (typeof child === \"string\") return child;\n }\n }\n stack.pop();\n return id;\n };\n\n const missing = (path: string) => `Cannot find workspace file \"${path}\"`;\n\n const entryId = await addModule(input.entryPath, input.entrySource);\n if (typeof entryId === \"string\") return { ok: false, error: entryId };\n\n const externals: ExternalImport[] = [];\n const seq = { n: 0 };\n const factories: string[] = [];\n\n for (const mod of modules) {\n if (mod.kind === \"json\") {\n try {\n const value = JSON.parse(mod.text ?? \"\");\n factories.push(`async () => ({ default: ${JSON.stringify(value)} })`);\n } catch (err) {\n return { ok: false, error: `Invalid JSON in ${mod.path}: ${err instanceof Error ? err.message : String(err)}` };\n }\n continue;\n }\n if (mod.kind === \"text\") {\n const cssInject = extensionOf(mod.path) === \"css\"\n ? `const __css = ${JSON.stringify(mod.text ?? \"\")};\nconst __cssId = ${JSON.stringify(`docks-canvas-css-${mod.path}`)};\nif (typeof document !== \"undefined\" && !document.getElementById(__cssId)) {\n const __style = document.createElement(\"style\");\n __style.id = __cssId;\n __style.textContent = __css;\n document.head.append(__style);\n}\nreturn { default: __css };`\n : `return { default: ${JSON.stringify(mod.text ?? \"\")} };`;\n factories.push(`async () => { ${cssInject} }`);\n continue;\n }\n if (mod.kind === \"binary\") {\n const href = `data:${mod.mime};base64,${toBase64(mod.bytes ?? new Uint8Array())}`;\n factories.push(`async () => ({ default: ${JSON.stringify(href)} })`);\n continue;\n }\n\n const refs = findRefs(mod.text ?? \"\").sort((a, b) => b.start - a.start);\n let body = mod.text ?? \"\";\n const preludes: string[] = [];\n for (const ref of refs) {\n const resolvedUrl = rewriteBridgeSpecifier(ref.spec, input.bridges);\n let replacement = \"\";\n if (ref.form === \"asset-url\") {\n if (!isRelativeSpecifier(ref.spec)) {\n replacement = ref.raw;\n } else {\n const assetPath = resolveWorkspacePath(mod.path, ref.spec);\n const assetId = indexByPath.get(assetPath);\n if (assetId === undefined) return { ok: false, error: missing(assetPath) };\n replacement = `(await __req(${assetId})).default`;\n }\n } else if (isRelativeSpecifier(ref.spec)) {\n const depPath = resolveWorkspacePath(mod.path, ref.spec);\n const depId = indexByPath.get(depPath);\n if (depId === undefined) return { ok: false, error: missing(depPath) };\n const load = `__req(${depId})`;\n if (ref.form === \"dynamic\") replacement = load;\n else if (ref.form === \"export-from\") preludes.push(exportFromPrelude(ref.raw, load));\n else preludes.push(importPrelude(ref.raw, load));\n } else if (ref.form === \"dynamic\") {\n const runtime = bridgeRuntime(ref.spec, input.bridges);\n replacement = runtime ? `Promise.resolve(${runtime})` : `import(${JSON.stringify(resolvedUrl)})`;\n if (runtime) externalBinding(resolvedUrl, \"side\", externals, seq);\n } else {\n const runtime = bridgeRuntime(ref.spec, input.bridges);\n if (runtime) {\n externalBinding(resolvedUrl, \"side\", externals, seq);\n if (ref.form === \"import\" && !/^import\\s+['\"]/.test(ref.raw.trim())) {\n preludes.push(runtimeImportPrelude(ref.raw, runtime));\n } else if (ref.form === \"export-from\") {\n preludes.push(runtimeExportFromPrelude(ref.raw, runtime));\n } else if (ref.form === \"import\") {\n preludes.push(`void ${runtime};`);\n }\n } else {\n const localFor = (imported: string) => externalBinding(resolvedUrl, imported, externals, seq);\n if (ref.form === \"import\" && /^import\\s+['\"]/.test(ref.raw.trim())) {\n externalBinding(resolvedUrl, \"side\", externals, seq);\n } else if (ref.form === \"import\") {\n preludes.push(externalImportPrelude(ref.raw, localFor));\n } else if (ref.form === \"export-from\") {\n preludes.push(externalExportFromPrelude(ref.raw, localFor));\n }\n }\n }\n if (ref.form === \"import\" || ref.form === \"export-from\") replacement = \"\";\n body = body.slice(0, ref.start) + replacement + body.slice(ref.end);\n }\n body = rewriteLocalExports(body);\n factories.push(`async () => {\n const __exports = {};\n ${preludes.join(\"\\n\")}\n ${body}\n return __exports;\n}`);\n }\n\n const uniqueLines = [...new Set(externals.map(item => item.line))];\n const code = `${uniqueLines.join(\"\\n\")}\nconst __factories = [\n${factories.join(\",\\n\")}\n];\nconst __cache = new Map();\nasync function __req(id) {\n if (__cache.has(id)) return __cache.get(id);\n const pending = __factories[id]();\n __cache.set(id, pending);\n return pending;\n}\nconst __entry = await __req(${entryId});\nexport default __entry.default;\n`;\n return { ok: true, code };\n}\n\nfunction runtimeImportPrelude(raw: string, runtime: string): string {\n const clause = raw.replace(/\\s+/g, \" \").trim();\n const lines: string[] = [];\n const defaultName = clause.match(/^import\\s+(?!type\\b)(\\w+)\\s*(?:,|from)/);\n const namespace = clause.match(/\\*\\s+as\\s+(\\w+)/);\n const named = clause.match(/\\{([^}]*)\\}/);\n if (defaultName) lines.push(`const ${defaultName[1]} = ${runtime}.default;`);\n if (namespace) lines.push(`const ${namespace[1]} = ${runtime};`);\n if (named) {\n for (const part of named[1].split(\",\").map(piece => piece.trim()).filter(Boolean)) {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n lines.push(`const ${alias || imported} = ${runtime}.${imported};`);\n }\n }\n return lines.join(\"\\n\");\n}\n\nfunction runtimeExportFromPrelude(raw: string, runtime: string): string {\n if (raw.includes(\"*\") && !raw.includes(\"{\")) {\n return `Object.assign(__exports, ${runtime});\\ndelete __exports.default;`;\n }\n const inner = raw.match(/\\{([^}]*)\\}/)?.[1] ?? \"\";\n return inner.split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return `__exports.${alias || imported} = ${runtime}.${imported};`;\n }).join(\"\\n\");\n}\n\nfunction externalImportPrelude(raw: string, localFor: (imported: string) => string): string {\n const clause = raw.replace(/\\s+/g, \" \").trim();\n const lines: string[] = [];\n const defaultName = clause.match(/^import\\s+(?!type\\b)(\\w+)\\s*(?:,|from)/);\n const namespace = clause.match(/\\*\\s+as\\s+(\\w+)/);\n const named = clause.match(/\\{([^}]*)\\}/);\n if (defaultName) lines.push(`const ${defaultName[1]} = ${localFor(\"default\")};`);\n if (namespace) lines.push(`const ${namespace[1]} = ${localFor(\"*\")};`);\n if (named) {\n for (const part of named[1].split(\",\").map(piece => piece.trim()).filter(Boolean)) {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n lines.push(`const ${alias || imported} = ${localFor(imported)};`);\n }\n }\n return lines.join(\"\\n\");\n}\n\nfunction externalExportFromPrelude(raw: string, localFor: (imported: string) => string): string {\n if (raw.includes(\"*\") && !raw.includes(\"{\")) {\n return `Object.assign(__exports, ${localFor(\"*\")});\\ndelete __exports.default;`;\n }\n const inner = raw.match(/\\{([^}]*)\\}/)?.[1] ?? \"\";\n return inner.split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return `__exports.${alias || imported} = ${localFor(imported)};`;\n }).join(\"\\n\");\n}\n"],"mappings":";AAwCA,IAAM,2BAAW,IAAI,IAAI;CAAC;CAAM;CAAO;CAAO;CAAQ;CAAO;CAAO;CAAM;CAAQ;AAAK,CAAC;AACxF,IAAM,OAA+B;CACjC,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,OAAO;CACP,KAAK;CACL,MAAM;CACN,KAAK;AACT;AAEA,SAAgB,qBAAqB,UAAkB,MAAsB;CACzE,MAAM,OAAO,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC/C,KAAK,IAAI;CACT,KAAK,MAAM,QAAQ,KAAK,MAAM,GAAG,GAAG;EAChC,IAAI,SAAS,MAAM,SAAS,KAAK;EACjC,IAAI,SAAS,MAAM,KAAK,IAAI;OACvB,KAAK,KAAK,IAAI;CACvB;CACA,OAAO,KAAK,KAAK,GAAG;AACxB;AAEA,SAAgB,oBAAoB,MAAuB;CACvD,OAAO,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;AACzD;AAEA,SAAgB,cAAc,MAAc,SAAuC;CAC/E,IAAI,SAAS,eAAe,SAAS,qCAAqC,OAAO;CACjF,IAAI,SAAS,sBAAsB,SAAS,4CAA4C,OAAO;CAC/F,IAAI,SAAS,gBAAgB,SAAS,uBAAuB,OAAO;CACpE,MAAM,MAAM,YAAY,IAAI;CAC5B,IAAI,CAAC,OAAO,CAAC,QAAQ,aAAa,MAAM,OAAO;CAC/C,OAAO,0BAA0B,KAAK,UAAU,GAAG,EAAE;AACzD;AAEA,SAAgB,uBAAuB,MAAc,SAAgC;CACjF,IAAI,SAAS,eAAe,SAAS,qCAAqC,OAAO,QAAQ;CACzF,IAAI,SAAS,sBAAsB,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EAAE;CACpE;CAEJ,OAAO,MAAM,KAAK,IAAI;AAC1B;AAEA,SAAS,0BAA0B,KAAa,UAAgD;CAC5F,IAAI,IAAI,SAAS,GAAG,KAAK,CAAC,IAAI,SAAS,GAAG,GACtC,OAAO,4BAA4B,SAAS,GAAG,EAAE;CAGrD,QADc,IAAI,MAAM,aAAa,CAAC,GAAG,MAAM,GAAA,CAClC,MAAM,GAAG,CAAC,CAAC,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAI,SAAQ;EACzE,MAAM,CAAC,UAAU,SAAS,KAAK,MAAM,UAAU,CAAC,CAAC,KAAI,UAAS,MAAM,KAAK,CAAC;EAC1E,OAAO,aAAa,SAAS,SAAS,KAAK,SAAS,QAAQ,EAAE;CAClE,CAAC,CAAC,CAAC,KAAK,IAAI;AAChB"}
1
+ {"version":3,"file":"compile.js","names":[],"sources":["../src/compile.ts"],"sourcesContent":["import { bridgeHref } from './bridges/register';\n\nexport interface CanvasFileBytes {\n text?: string;\n bytes?: Uint8Array;\n}\n\nexport type CanvasFileReader = (path: string) => Promise<CanvasFileBytes | null>;\n\nexport interface CompileCanvasInput {\n entryPath: string;\n entrySource: string;\n read: CanvasFileReader;\n}\n\nexport type CompileCanvasResult = { ok: true; code: string } | { ok: false; error: string };\n\ninterface GraphModule {\n path: string;\n kind: \"js\" | \"json\" | \"text\" | \"binary\";\n text?: string;\n bytes?: Uint8Array;\n mime?: string;\n}\n\ninterface SpecRef {\n spec: string;\n start: number;\n end: number;\n raw: string;\n form: \"import\" | \"export-from\" | \"dynamic\" | \"asset-url\";\n}\n\nconst TEXT_EXT = new Set([\"js\", \"mjs\", \"css\", \"json\", \"svg\", \"txt\", \"md\", \"html\", \"csv\"]);\nconst MIME: Record<string, string> = {\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n ico: \"image/x-icon\",\n woff: \"font/woff\",\n woff2: \"font/woff2\",\n pdf: \"application/pdf\",\n wasm: \"application/wasm\",\n svg: \"image/svg+xml\",\n};\n\nexport function resolveWorkspacePath(fromFile: string, spec: string): string {\n const base = fromFile.split(\"/\").filter(Boolean);\n base.pop();\n for (const part of spec.split(\"/\")) {\n if (part === \"\" || part === \".\") continue;\n if (part === \"..\") base.pop();\n else base.push(part);\n }\n return base.join(\"/\");\n}\n\nexport function isRelativeSpecifier(spec: string): boolean {\n return spec.startsWith(\"./\") || spec.startsWith(\"../\");\n}\n\nfunction usesCanvasNamespace(spec: string): boolean {\n return spec === \"docks/canvas\"\n || spec === \"docks/lit\"\n || spec === \"docks/webawesome\"\n || spec === \"@eclipse-docks/core/externals/lit\"\n || spec === \"@eclipse-docks/core/externals/webawesome\"\n || spec === \"docks/core/externals/lit\"\n || spec === \"docks/core/externals/webawesome\";\n}\n\nfunction usesCoreNamespace(spec: string): boolean {\n return spec === \"docks/core\"\n || spec === \"@eclipse-docks/core\"\n || spec === \"docks/core/core/events\"\n || spec === \"@eclipse-docks/core/core/events\";\n}\n\nexport function bridgeRuntime(spec: string): string | null {\n if (usesCanvasNamespace(spec)) return \"__docksCanvas.canvas\";\n if (usesCoreNamespace(spec)) return \"__docksCanvas.core\";\n return null;\n}\n\nexport function rewriteBridgeSpecifier(spec: string): string {\n if (usesCanvasNamespace(spec)) return bridgeHref(\"canvas\") ?? \"\";\n if (usesCoreNamespace(spec)) return bridgeHref(\"core\") ?? \"\";\n return spec;\n}\n\nfunction extensionOf(path: string): string {\n const base = path.split(\"/\").pop() ?? path;\n const dot = base.lastIndexOf(\".\");\n return dot >= 0 ? base.slice(dot + 1).toLowerCase() : \"\";\n}\n\nfunction isJavaScript(path: string): boolean {\n const ext = extensionOf(path);\n return ext === \"js\" || ext === \"mjs\" || path.endsWith(\".canvas.js\");\n}\n\nfunction toBase64(bytes: Uint8Array): string {\n const bufferCtor = (globalThis as { Buffer?: { from(data: Uint8Array): { toString(encoding: string): string } } }).Buffer;\n if (bufferCtor) return bufferCtor.from(bytes).toString(\"base64\");\n let binary = \"\";\n for (const byte of bytes) binary += String.fromCharCode(byte);\n return btoa(binary);\n}\n\nfunction findRefs(code: string): SpecRef[] {\n const patterns: Array<{ form: SpecRef[\"form\"]; re: RegExp }> = [\n { form: \"asset-url\", re: /new\\s+URL\\(\\s*(['\"])([^'\"]+)\\1\\s*,\\s*import\\.meta\\.url\\s*\\)/g },\n { form: \"dynamic\", re: /\\bimport\\(\\s*(['\"])([^'\"]+)\\1\\s*\\)/g },\n { form: \"export-from\", re: /\\bexport\\s+(?:type\\s+)?(?:\\*\\s+as\\s+\\w+|\\*|\\{[^}]*\\})\\s+from\\s*(['\"])([^'\"]+)\\1/g },\n { form: \"import\", re: /\\bimport\\s+(?:type\\s+)?(?:[^'\";]*?\\s+from\\s+)?(['\"])([^'\"]+)\\1/g },\n ];\n const refs: SpecRef[] = [];\n for (const { form, re } of patterns) {\n for (const match of code.matchAll(re)) {\n const spec = match[2];\n if (!spec || match.index === undefined) continue;\n refs.push({\n spec,\n start: match.index,\n end: match.index + match[0].length,\n raw: match[0],\n form,\n });\n }\n }\n refs.sort((a, b) => a.start - b.start || b.end - a.end);\n const kept: SpecRef[] = [];\n let cursor = -1;\n for (const ref of refs) {\n if (ref.start < cursor) continue;\n kept.push(ref);\n cursor = ref.end;\n }\n return kept;\n}\n\nfunction rewriteLocalExports(code: string): string {\n let out = code.replace(/export\\s+default\\s+/g, \"__exports.default = \");\n out = out.replace(/export\\s+(async\\s+)?function\\s+(\\w+)/g, (_all, asyncKw: string | undefined, name: string) => {\n return `__exports.${name} = ${asyncKw ?? \"\"}function ${name}`;\n });\n out = out.replace(/export\\s+class\\s+(\\w+)/g, \"__exports.$1 = class $1\");\n out = out.replace(/export\\s+(const|let|var)\\s+(\\w+)\\s*=/g, \"$1 $2 = __exports.$2 =\");\n out = out.replace(/export\\s*\\{([^}]+)\\}\\s*;?/g, (_all, inner: string) => {\n return inner.split(\",\").map(part => {\n const [from, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n if (!from) return \"\";\n return `__exports.${alias || from} = ${from};`;\n }).join(\"\\n\");\n });\n return out;\n}\n\ninterface ExternalImport {\n line: string;\n local: string;\n imported: string;\n}\n\nfunction externalBinding(specUrl: string, imported: string, externals: ExternalImport[], seq: { n: number }): string {\n const existing = externals.find(item => item.line.includes(JSON.stringify(specUrl)) && item.imported === imported);\n if (existing) return existing.local;\n const local = `__ext_${seq.n++}`;\n if (imported === \"*\") {\n externals.push({ local, imported, line: `import * as ${local} from ${JSON.stringify(specUrl)};` });\n } else if (imported === \"side\") {\n externals.push({ local, imported, line: `import ${JSON.stringify(specUrl)};` });\n } else {\n externals.push({\n local,\n imported,\n line: `import { ${imported} as ${local} } from ${JSON.stringify(specUrl)};`,\n });\n }\n return local;\n}\n\nfunction importPrelude(raw: string, load: string): string {\n const clause = raw.replace(/\\s+/g, \" \").trim();\n if (/^import\\s+['\"]/.test(clause)) return `await ${load};`;\n const named = clause.match(/\\{([^}]*)\\}/);\n const namespace = clause.match(/\\*\\s+as\\s+(\\w+)/);\n const defaultName = clause.match(/^import\\s+(?!type\\b)(\\w+)\\s*(?:,|from)/);\n const lines: string[] = [];\n if (defaultName) lines.push(`const ${defaultName[1]} = (await ${load}).default;`);\n if (namespace) lines.push(`const ${namespace[1]} = await ${load};`);\n if (named) {\n const pairs = named[1].split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return alias ? `${imported}: ${alias}` : imported;\n });\n if (pairs.length) lines.push(`const { ${pairs.join(\", \")} } = await ${load};`);\n }\n return lines.join(\"\\n\");\n}\n\nfunction exportFromPrelude(raw: string, load: string): string {\n if (/\\*\\s+as\\s+(\\w+)/.test(raw)) {\n const name = raw.match(/\\*\\s+as\\s+(\\w+)/)?.[1] ?? \"ns\";\n return `const ${name} = await ${load};\\nObject.assign(__exports, { ${name} });`;\n }\n if (raw.includes(\"*\")) {\n return `Object.assign(__exports, await ${load});\\ndelete __exports.default;`;\n }\n const inner = raw.match(/\\{([^}]*)\\}/)?.[1] ?? \"\";\n const lines = inner.split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return `__exports.${alias || imported} = (await ${load}).${imported};`;\n });\n return lines.join(\"\\n\");\n}\n\nexport async function compileCanvas(input: CompileCanvasInput): Promise<CompileCanvasResult> {\n const modules: GraphModule[] = [];\n const indexByPath = new Map<string, number>();\n const stack: string[] = [];\n\n const addModule = async (path: string, source?: string): Promise<number | string> => {\n const known = indexByPath.get(path);\n if (known !== undefined) return known;\n if (stack.includes(path)) return `Circular workspace import: ${[...stack, path].join(\" -> \")}`;\n stack.push(path);\n const ext = extensionOf(path);\n let mod: GraphModule;\n if (source !== undefined) {\n mod = { path, kind: \"js\", text: source };\n } else if (isJavaScript(path)) {\n const file = await input.read(path);\n if (!file?.text && file?.text !== \"\") return missing(path);\n mod = { path, kind: \"js\", text: file?.text ?? \"\" };\n } else if (ext === \"json\" || TEXT_EXT.has(ext)) {\n const file = await input.read(path);\n if (file?.text === undefined) return missing(path);\n mod = { path, kind: ext === \"json\" ? \"json\" : \"text\", text: file.text };\n } else {\n const file = await input.read(path);\n const bytes = file?.bytes ?? (file?.text !== undefined ? new TextEncoder().encode(file.text) : undefined);\n if (!bytes) return missing(path);\n mod = { path, kind: \"binary\", bytes, mime: MIME[ext] ?? \"application/octet-stream\" };\n }\n const id = modules.length;\n modules.push(mod);\n indexByPath.set(path, id);\n if (mod.kind === \"js\" && mod.text !== undefined) {\n for (const ref of findRefs(mod.text)) {\n if (!isRelativeSpecifier(ref.spec)) continue;\n const resolved = resolveWorkspacePath(path, ref.spec);\n const child = await addModule(resolved);\n if (typeof child === \"string\") return child;\n }\n }\n stack.pop();\n return id;\n };\n\n const missing = (path: string) => `Cannot find workspace file \"${path}\"`;\n\n const entryId = await addModule(input.entryPath, input.entrySource);\n if (typeof entryId === \"string\") return { ok: false, error: entryId };\n\n const externals: ExternalImport[] = [];\n const seq = { n: 0 };\n const factories: string[] = [];\n\n for (const mod of modules) {\n if (mod.kind === \"json\") {\n try {\n const value = JSON.parse(mod.text ?? \"\");\n factories.push(`async () => ({ default: ${JSON.stringify(value)} })`);\n } catch (err) {\n return { ok: false, error: `Invalid JSON in ${mod.path}: ${err instanceof Error ? err.message : String(err)}` };\n }\n continue;\n }\n if (mod.kind === \"text\") {\n const cssInject = extensionOf(mod.path) === \"css\"\n ? `const __css = ${JSON.stringify(mod.text ?? \"\")};\nconst __cssId = ${JSON.stringify(`docks-canvas-css-${mod.path}`)};\nif (typeof document !== \"undefined\" && !document.getElementById(__cssId)) {\n const __style = document.createElement(\"style\");\n __style.id = __cssId;\n __style.textContent = __css;\n document.head.append(__style);\n}\nreturn { default: __css };`\n : `return { default: ${JSON.stringify(mod.text ?? \"\")} };`;\n factories.push(`async () => { ${cssInject} }`);\n continue;\n }\n if (mod.kind === \"binary\") {\n const href = `data:${mod.mime};base64,${toBase64(mod.bytes ?? new Uint8Array())}`;\n factories.push(`async () => ({ default: ${JSON.stringify(href)} })`);\n continue;\n }\n\n const refs = findRefs(mod.text ?? \"\").sort((a, b) => b.start - a.start);\n let body = mod.text ?? \"\";\n const preludes: string[] = [];\n for (const ref of refs) {\n const resolvedUrl = rewriteBridgeSpecifier(ref.spec);\n let replacement = \"\";\n if (ref.form === \"asset-url\") {\n if (!isRelativeSpecifier(ref.spec)) {\n replacement = ref.raw;\n } else {\n const assetPath = resolveWorkspacePath(mod.path, ref.spec);\n const assetId = indexByPath.get(assetPath);\n if (assetId === undefined) return { ok: false, error: missing(assetPath) };\n replacement = `(await __req(${assetId})).default`;\n }\n } else if (isRelativeSpecifier(ref.spec)) {\n const depPath = resolveWorkspacePath(mod.path, ref.spec);\n const depId = indexByPath.get(depPath);\n if (depId === undefined) return { ok: false, error: missing(depPath) };\n const load = `__req(${depId})`;\n if (ref.form === \"dynamic\") replacement = load;\n else if (ref.form === \"export-from\") preludes.push(exportFromPrelude(ref.raw, load));\n else preludes.push(importPrelude(ref.raw, load));\n } else if (ref.form === \"dynamic\") {\n const runtime = bridgeRuntime(ref.spec);\n replacement = runtime ? `Promise.resolve(${runtime})` : `import(${JSON.stringify(resolvedUrl)})`;\n if (runtime) externalBinding(resolvedUrl, \"side\", externals, seq);\n } else {\n const runtime = bridgeRuntime(ref.spec);\n if (runtime) {\n externalBinding(resolvedUrl, \"side\", externals, seq);\n if (ref.form === \"import\" && !/^import\\s+['\"]/.test(ref.raw.trim())) {\n preludes.push(runtimeImportPrelude(ref.raw, runtime));\n } else if (ref.form === \"export-from\") {\n preludes.push(runtimeExportFromPrelude(ref.raw, runtime));\n } else if (ref.form === \"import\") {\n preludes.push(`void ${runtime};`);\n }\n } else {\n const localFor = (imported: string) => externalBinding(resolvedUrl, imported, externals, seq);\n if (ref.form === \"import\" && /^import\\s+['\"]/.test(ref.raw.trim())) {\n externalBinding(resolvedUrl, \"side\", externals, seq);\n } else if (ref.form === \"import\") {\n preludes.push(externalImportPrelude(ref.raw, localFor));\n } else if (ref.form === \"export-from\") {\n preludes.push(externalExportFromPrelude(ref.raw, localFor));\n }\n }\n }\n if (ref.form === \"import\" || ref.form === \"export-from\") replacement = \"\";\n body = body.slice(0, ref.start) + replacement + body.slice(ref.end);\n }\n body = rewriteLocalExports(body);\n factories.push(`async () => {\n const __exports = {};\n ${preludes.join(\"\\n\")}\n ${body}\n return __exports;\n}`);\n }\n\n const uniqueLines = [...new Set(externals.map(item => item.line))];\n const code = `${uniqueLines.join(\"\\n\")}\nconst __factories = [\n${factories.join(\",\\n\")}\n];\nconst __cache = new Map();\nasync function __req(id) {\n if (__cache.has(id)) return __cache.get(id);\n const pending = __factories[id]();\n __cache.set(id, pending);\n return pending;\n}\nconst __entry = await __req(${entryId});\nexport default __entry.default;\n`;\n return { ok: true, code };\n}\n\nfunction runtimeImportPrelude(raw: string, runtime: string): string {\n const clause = raw.replace(/\\s+/g, \" \").trim();\n const lines: string[] = [];\n const defaultName = clause.match(/^import\\s+(?!type\\b)(\\w+)\\s*(?:,|from)/);\n const namespace = clause.match(/\\*\\s+as\\s+(\\w+)/);\n const named = clause.match(/\\{([^}]*)\\}/);\n if (defaultName) lines.push(`const ${defaultName[1]} = ${runtime}.default;`);\n if (namespace) lines.push(`const ${namespace[1]} = ${runtime};`);\n if (named) {\n for (const part of named[1].split(\",\").map(piece => piece.trim()).filter(Boolean)) {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n lines.push(`const ${alias || imported} = ${runtime}.${imported};`);\n }\n }\n return lines.join(\"\\n\");\n}\n\nfunction runtimeExportFromPrelude(raw: string, runtime: string): string {\n if (raw.includes(\"*\") && !raw.includes(\"{\")) {\n return `Object.assign(__exports, ${runtime});\\ndelete __exports.default;`;\n }\n const inner = raw.match(/\\{([^}]*)\\}/)?.[1] ?? \"\";\n return inner.split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return `__exports.${alias || imported} = ${runtime}.${imported};`;\n }).join(\"\\n\");\n}\n\nfunction externalImportPrelude(raw: string, localFor: (imported: string) => string): string {\n const clause = raw.replace(/\\s+/g, \" \").trim();\n const lines: string[] = [];\n const defaultName = clause.match(/^import\\s+(?!type\\b)(\\w+)\\s*(?:,|from)/);\n const namespace = clause.match(/\\*\\s+as\\s+(\\w+)/);\n const named = clause.match(/\\{([^}]*)\\}/);\n if (defaultName) lines.push(`const ${defaultName[1]} = ${localFor(\"default\")};`);\n if (namespace) lines.push(`const ${namespace[1]} = ${localFor(\"*\")};`);\n if (named) {\n for (const part of named[1].split(\",\").map(piece => piece.trim()).filter(Boolean)) {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n lines.push(`const ${alias || imported} = ${localFor(imported)};`);\n }\n }\n return lines.join(\"\\n\");\n}\n\nfunction externalExportFromPrelude(raw: string, localFor: (imported: string) => string): string {\n if (raw.includes(\"*\") && !raw.includes(\"{\")) {\n return `Object.assign(__exports, ${localFor(\"*\")});\\ndelete __exports.default;`;\n }\n const inner = raw.match(/\\{([^}]*)\\}/)?.[1] ?? \"\";\n return inner.split(\",\").map(part => part.trim()).filter(Boolean).map(part => {\n const [imported, alias] = part.split(/\\s+as\\s+/).map(piece => piece.trim());\n return `__exports.${alias || imported} = ${localFor(imported)};`;\n }).join(\"\\n\");\n}\n"],"mappings":";;AAiCA,IAAM,2BAAW,IAAI,IAAI;CAAC;CAAM;CAAO;CAAO;CAAQ;CAAO;CAAO;CAAM;CAAQ;AAAK,CAAC;AACxF,IAAM,OAA+B;CACjC,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,OAAO;CACP,KAAK;CACL,MAAM;CACN,KAAK;AACT;AAEA,SAAgB,qBAAqB,UAAkB,MAAsB;CACzE,MAAM,OAAO,SAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;CAC/C,KAAK,IAAI;CACT,KAAK,MAAM,QAAQ,KAAK,MAAM,GAAG,GAAG;EAChC,IAAI,SAAS,MAAM,SAAS,KAAK;EACjC,IAAI,SAAS,MAAM,KAAK,IAAI;OACvB,KAAK,KAAK,IAAI;CACvB;CACA,OAAO,KAAK,KAAK,GAAG;AACxB;AAEA,SAAgB,oBAAoB,MAAuB;CACvD,OAAO,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;AACzD;AAEA,SAAS,oBAAoB,MAAuB;CAChD,OAAO,SAAS,kBACT,SAAS,eACT,SAAS,sBACT,SAAS,uCACT,SAAS,8CACT,SAAS,8BACT,SAAS;AACpB;AAEA,SAAS,kBAAkB,MAAuB;CAC9C,OAAO,SAAS,gBACT,SAAS,yBACT,SAAS,4BACT,SAAS;AACpB;AAEA,SAAgB,cAAc,MAA6B;CACvD,IAAI,oBAAoB,IAAI,GAAG,OAAO;CACtC,IAAI,kBAAkB,IAAI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aAAa,CAAC,GAAG,MAAM,GAAA,CAClC,MAAM,GAAG,CAAC,CAAC,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAI,SAAQ;EACzE,MAAM,CAAC,UAAU,SAAS,KAAK,MAAM,UAAU,CAAC,CAAC,KAAI,UAAS,MAAM,KAAK,CAAC;EAC1E,OAAO,aAAa,SAAS,SAAS,KAAK,SAAS,QAAQ,EAAE;CAClE,CAAC,CAAC,CAAC,KAAK,IAAI;AAChB"}
@@ -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): LitElement UIs,\n dashboards, todo apps, widgets, maps, and previewable tools. Use when the user\n wants an interactive view, canvas, widget, or .canvas.js file — even if they do\n not say \"canvas\".\n---\n\n# Eclipse Docks canvas\n\nWrite a workspace file ending in `.canvas.js`. Default-export a `LitElement` subclass from `docks/lit`. Do **not** extend `HTMLElement`. Do **not** call `customElements.define` — the host registers the tag.\n\n## Hard rules\n\n1. **`canvasHost` is unavailable in `constructor`.** The host sets `this.canvasHost` after construction. Read/write persisted state in `connectedCallback` (after `super`) or later. Always guard: `this.canvasHost?.getState` / `setState`.\n2. Pure JavaScript only — no TypeScript, no decorators. Declare reactive fields with `static properties = { … }`. Initialize plain defaults in `constructor`; hydrate from `canvasHost` only after connect.\n3. Build controls and chrome with Web Awesome (`wa-button`, `wa-input`, `wa-checkbox`, `wa-card`, `wa-callout`, `wa-spinner`). `import \"docks/webawesome\"` only registers the elements; 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.\n4. Emit complete, valid JavaScript — no truncated objects or unfinished strings.\n5. 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. Keep `docks/lit`, `docks/webawesome`, and `canvasHost` on the LitElement.\n\n## Minimal pattern\n\n```js\nimport { LitElement, html, css } from \"docks/lit\";\nimport \"docks/webawesome\";\n\nexport default class extends LitElement {\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 connectedCallback() {\n super.connectedCallback();\n const saved = this.canvasHost?.getState(\"items\", null);\n if (Array.isArray(saved)) this.items = saved;\n }\n\n persist() {\n this.canvasHost?.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\nAPIs: `this.canvasHost.getState(key, fallback)`, `this.canvasHost.setState(key, value)`, `this.canvasHost.openFile(path)`.\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/lit`, `docks/webawesome`, `docks/core` → running app\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` a durable `<root>/….canvas.js` (qualify with a root from `workspace_list`).\n2. `canvas.open` with that path — returns `ready` or the compile/runtime error.\n3. Change a canvas with `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.\n4. 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";
2
+ var SKILL_default = "---\nname: eclipse-docks-canvas\ndescription: >-\n Create or edit interactive Eclipse Docks canvases (.canvas.js): CanvasView UIs,\n dashboards, todo apps, widgets, maps, and previewable tools. Use when the user\n wants an interactive view, canvas, widget, or .canvas.js file — even if they do\n not say \"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. |\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\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.\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` a durable `<root>/….canvas.js` (qualify with a root from `workspace_list`).\n2. `canvas.open` with that path — returns `ready` or the compile/runtime error.\n3. Change a canvas with `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.\n4. 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`. Subpaths map to the same bridges, e.g. `docks/core/parts`, `docks/core/widgets`, `docks/core/externals/lit`.\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- Canvases can also open a path via `this.canvasHost.openFile(path)` without importing core.\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 its `canvasHost` state. `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- Host persistence for a workspace `.canvas.js` is `canvasHost.getState` / `setState`, not `appSettings`, unless you intentionally share app-wide settings.\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- Keep UI building blocks on `docks/lit` + `docks/webawesome`; use `docks/core` for shell integration.\n\n## Anti-patterns\n\n- Bare filenames at the composite workspace root when a durable root prefix is required\n- Assuming `canvasHost` APIs exist on arbitrary LitElements outside a canvas mount\n- Re-implementing toast/dialog with `alert` when core helpers are available\n";
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 subclasses `CanvasView` from `docks/canvas`. Persist with `this.getState` / `this.setState` inside `onConnect` and later. Use `appSettings` only to share app-wide settings.\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 LitElement patterns for Eclipse Docks canvases and UI code via docks/lit.\n Use when writing or fixing .canvas.js, Lit templates, reactive properties,\n directives, or styles — pure JavaScript only (no TypeScript decorators).\n---\n\n# Eclipse Docks Lit (`docks/lit`)\n\nImport from `docks/lit` (same module as `@eclipse-docks/core/externals/lit`). In `.canvas.js` files use **pure JavaScript only** — no TypeScript, no decorators (`@property`, `@state`, `@customElement` are unavailable).\n\n## Essentials\n\n```js\nimport { LitElement, html, css, nothing } from \"docks/lit\";\n```\n\n- Default-export a `LitElement` subclass for canvases. Do **not** call `customElements.define` in a canvas — the host registers the tag.\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\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/lit` (also available as in Lit docs):\n\n```js\nimport { repeat, when, classMap, styleMap, ifDefined, live, ref, keyed } from \"docks/lit\";\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/lit` also re-exports `@lit-labs/signals` helpers: `signal`, `computed`, `watch`, `SignalWatcher`, `withWatch`. Prefer `static properties` for simple canvas state unless you already use signals.\n\n## Anti-patterns\n\n- Decorators or `.ts` syntax in `.canvas.js`\n- Mutating arrays/objects in place without reassignment\n- Relying on `this` inside a non-arrow inline handler incorrectly\n- Calling `customElements.define` from a workspace canvas module\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 (`docks/webawesome`)\n\n```js\nimport \"docks/webawesome\";\n```\n\nThat import registers the components, the theme, and the `docks` icon library. Canvas files use this import. Custom elements take a closing tag: `<wa-input></wa-input>`.\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";
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.8",
3
+ "version": "0.8.9",
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
  },
@@ -1,2 +0,0 @@
1
- export declare const canvasBridgeHref: string;
2
- //# sourceMappingURL=events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/bridges/events.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
@@ -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"}
@@ -1,2 +0,0 @@
1
- export declare const canvasBridgeHref: string;
2
- //# sourceMappingURL=lit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lit.d.ts","sourceRoot":"","sources":["../../src/bridges/lit.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAkB,CAAC"}
@@ -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
@@ -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"}
@@ -1,2 +0,0 @@
1
- export declare const canvasBridgeHref: string;
2
- //# sourceMappingURL=parts.d.ts.map
@@ -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"}
@@ -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,2 +0,0 @@
1
- export declare const canvasBridgeHref: string;
2
- //# sourceMappingURL=third-party.d.ts.map
@@ -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"}
@@ -1,3 +0,0 @@
1
- import { CanvasBridges } from '../compile';
2
- export declare function canvasBridges(): CanvasBridges;
3
- //# sourceMappingURL=urls.d.ts.map
@@ -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"}
@@ -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
@@ -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,2 +0,0 @@
1
- export declare const canvasBridgeHref: string;
2
- //# sourceMappingURL=webawesome.d.ts.map
@@ -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,2 +0,0 @@
1
- export declare const canvasBridgeHref: string;
2
- //# sourceMappingURL=widgets.d.ts.map
@@ -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"}
@@ -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"}