@eclipse-lyra/extension-catalog 0.0.0

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/api.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { getCatalogBaseUrl, registerCatalog, } from './register-catalog';
2
+ export type { CatalogContribution } from './register-catalog';
3
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EACjB,eAAe,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/api.js ADDED
@@ -0,0 +1,44 @@
1
+ import { contributionRegistry } from "@eclipse-lyra/core/api";
2
+ function getCatalogBaseUrl() {
3
+ if (typeof globalThis === "undefined") return "";
4
+ const loc = globalThis.location;
5
+ const base = "/";
6
+ if (!loc?.origin) return "";
7
+ return (loc.origin + base).replace(/\/?$/, "/");
8
+ }
9
+ function registerCatalog(catalog, baseUrl) {
10
+ const base = baseUrl ?? getCatalogBaseUrl();
11
+ contributionRegistry.registerContribution("catalog.root", {
12
+ label: catalog.label,
13
+ icon: catalog.icon,
14
+ contributionId: catalog.contributionId
15
+ });
16
+ const contributionId = catalog.contributionId ?? catalog.label;
17
+ catalog.items?.forEach((item) => {
18
+ contributionRegistry.registerContribution(contributionId, {
19
+ label: item.label,
20
+ icon: item.icon,
21
+ contributionId: item.contributionId
22
+ });
23
+ item.items?.forEach((child) => {
24
+ const contribution = {
25
+ label: child.label,
26
+ icon: child.icon,
27
+ state: { ...child.state }
28
+ };
29
+ const url = contribution.state?.url;
30
+ if (url && typeof url === "string" && url.includes("${baseURL}/")) {
31
+ contribution.state = { ...contribution.state, url: url.replace("${baseURL}/", base) };
32
+ }
33
+ contributionRegistry.registerContribution(
34
+ item.contributionId,
35
+ contribution
36
+ );
37
+ });
38
+ });
39
+ }
40
+ export {
41
+ getCatalogBaseUrl,
42
+ registerCatalog
43
+ };
44
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sources":["../src/register-catalog.ts"],"sourcesContent":["import {\n contributionRegistry,\n type TreeContribution,\n} from \"@eclipse-lyra/core/api\";\n\nexport interface CatalogContribution extends TreeContribution {\n items?: CatalogContribution[];\n}\n\nexport function getCatalogBaseUrl(): string {\n if (typeof globalThis === 'undefined') return '';\n const loc = (globalThis as unknown as { location?: { origin: string } }).location;\n const base = (import.meta as unknown as { env?: { BASE_URL?: string } }).env?.BASE_URL ?? '';\n if (!loc?.origin) return '';\n return (loc.origin + base).replace(/\\/?$/, '/');\n}\n\nexport function registerCatalog(catalog: CatalogContribution, baseUrl?: string): void {\n const base = baseUrl ?? getCatalogBaseUrl();\n contributionRegistry.registerContribution(\"catalog.root\", {\n label: catalog.label,\n icon: catalog.icon,\n contributionId: catalog.contributionId,\n } as TreeContribution);\n\n const contributionId = catalog.contributionId ?? catalog.label;\n catalog.items?.forEach((item: CatalogContribution) => {\n contributionRegistry.registerContribution(contributionId, {\n label: item.label,\n icon: item.icon,\n contributionId: item.contributionId,\n } as TreeContribution);\n\n item.items?.forEach((child: any) => {\n const contribution = {\n label: child.label,\n icon: child.icon,\n state: { ...child.state },\n } as TreeContribution;\n const url = contribution.state?.url as string | undefined;\n if (url && typeof url === \"string\" && url.includes(\"${baseURL}/\")) {\n contribution.state = { ...contribution.state, url: url.replace(\"${baseURL}/\", base) };\n }\n contributionRegistry.registerContribution(\n item.contributionId!,\n contribution\n );\n });\n });\n}\n"],"names":[],"mappings":";AASO,SAAS,oBAA4B;AACxC,MAAI,OAAO,eAAe,YAAa,QAAO;AAC9C,QAAM,MAAO,WAA4D;AACzE,QAAM,OAAQ;AACd,MAAI,CAAC,KAAK,OAAQ,QAAO;AACzB,UAAQ,IAAI,SAAS,MAAM,QAAQ,QAAQ,GAAG;AAClD;AAEO,SAAS,gBAAgB,SAA8B,SAAwB;AAClF,QAAM,OAAO,WAAW,kBAAA;AACxB,uBAAqB,qBAAqB,gBAAgB;AAAA,IACtD,OAAO,QAAQ;AAAA,IACf,MAAM,QAAQ;AAAA,IACd,gBAAgB,QAAQ;AAAA,EAAA,CACP;AAErB,QAAM,iBAAiB,QAAQ,kBAAkB,QAAQ;AACzD,UAAQ,OAAO,QAAQ,CAAC,SAA8B;AAClD,yBAAqB,qBAAqB,gBAAgB;AAAA,MACtD,OAAO,KAAK;AAAA,MACZ,MAAM,KAAK;AAAA,MACX,gBAAgB,KAAK;AAAA,IAAA,CACJ;AAErB,SAAK,OAAO,QAAQ,CAAC,UAAe;AAChC,YAAM,eAAe;AAAA,QACjB,OAAO,MAAM;AAAA,QACb,MAAM,MAAM;AAAA,QACZ,OAAO,EAAE,GAAG,MAAM,MAAA;AAAA,MAAM;AAE5B,YAAM,MAAM,aAAa,OAAO;AAChC,UAAI,OAAO,OAAO,QAAQ,YAAY,IAAI,SAAS,aAAa,GAAG;AAC/D,qBAAa,QAAQ,EAAE,GAAG,aAAa,OAAO,KAAK,IAAI,QAAQ,eAAe,IAAI,EAAA;AAAA,MACtF;AACA,2BAAqB;AAAA,QACjB,KAAK;AAAA,QACL;AAAA,MAAA;AAAA,IAER,CAAC;AAAA,EACL,CAAC;AACL;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ import { extensionRegistry } from "@eclipse-lyra/core/api";
2
+ extensionRegistry.registerExtension({
3
+ id: "@eclipse-lyra/extension-catalog",
4
+ name: "Catalog",
5
+ description: "Browse and checkout resources from a catalog",
6
+ loader: () => import("./loader.js"),
7
+ icon: "book"
8
+ });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { extensionRegistry } from \"@eclipse-lyra/core/api\";\n\nextensionRegistry.registerExtension({\n id: \"@eclipse-lyra/extension-catalog\",\n name: \"Catalog\",\n description: \"Browse and checkout resources from a catalog\",\n loader: () => import(\"./loader\"),\n icon: \"book\",\n});\n"],"names":[],"mappings":";AAEA,kBAAkB,kBAAkB;AAAA,EAChC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,aAAa;AAAA,EACb,QAAQ,MAAM,OAAO,aAAU;AAAA,EAC/B,MAAM;AACV,CAAC;"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":""}
package/dist/loader.js ADDED
@@ -0,0 +1,238 @@
1
+ import { css, state, customElement, createRef, html, ref } from "@eclipse-lyra/core/externals/lit";
2
+ import { LyraPart, contributionRegistry, activePartSignal, activeSelectionSignal, registerAll, workspaceService, toastError, FileContentType, toastInfo, SIDEBAR_MAIN } from "@eclipse-lyra/core/api";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __decorateClass = (decorators, target, key, kind) => {
6
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
7
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8
+ if (decorator = decorators[i])
9
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
10
+ if (kind && result) __defProp(target, key, result);
11
+ return result;
12
+ };
13
+ const CID_CATALOG_ROOT = "catalog.root";
14
+ let LyraCatalog = class extends LyraPart {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.treeRef = createRef();
18
+ }
19
+ doBeforeUI() {
20
+ const contributions = contributionRegistry.getContributions(
21
+ CID_CATALOG_ROOT
22
+ );
23
+ this.rootNodes = this.toTreeNodes(contributions);
24
+ }
25
+ renderToolbar() {
26
+ const isActiveAndHasSelection = activePartSignal.get() instanceof LyraCatalog && activeSelectionSignal.get() !== void 0;
27
+ return html`
28
+ <lyra-command
29
+ cmd="checkout"
30
+ icon="file-arrow-down"
31
+ ?disabled=${!isActiveAndHasSelection}
32
+ title="Checkout"
33
+ ></lyra-command>
34
+ <lyra-command
35
+ cmd="refresh_catalog"
36
+ icon="arrows-rotate"
37
+ title="Refresh Catalog"
38
+ ></lyra-command>
39
+ <lyra-command
40
+ cmd="catalog_expand_all"
41
+ icon="angles-down"
42
+ slot="end"
43
+ title="Expand All"
44
+ ></lyra-command>
45
+ <lyra-command
46
+ cmd="catalog_collapse_all"
47
+ icon="angles-up"
48
+ slot="end"
49
+ title="Collapse All"
50
+ ></lyra-command>
51
+ `;
52
+ }
53
+ toTreeNodes(contributions) {
54
+ return contributions.map((c) => {
55
+ const node = {
56
+ data: c.state,
57
+ icon: c.icon,
58
+ label: c.label,
59
+ leaf: false
60
+ };
61
+ if (c.contributionId) {
62
+ const children = contributionRegistry.getContributions(
63
+ c.contributionId
64
+ );
65
+ node.leaf = children.length === 0;
66
+ node.children = this.toTreeNodes(children);
67
+ }
68
+ return node;
69
+ });
70
+ }
71
+ onItemDblClicked(event) {
72
+ const url = event.currentTarget.model.data.url;
73
+ this.executeCommand("checkout", { url });
74
+ }
75
+ onSelectionChanged(event) {
76
+ const node = event.detail.selection[0].model;
77
+ activeSelectionSignal.set(node.data);
78
+ }
79
+ setAllExpanded(expanded) {
80
+ const tree = this.treeRef.value;
81
+ if (tree) {
82
+ tree.querySelectorAll("wa-tree-item").forEach((item) => {
83
+ item.expanded = expanded;
84
+ });
85
+ }
86
+ }
87
+ refresh() {
88
+ this.requestUpdate();
89
+ }
90
+ createTreeItems(node, expanded = false) {
91
+ if (!node) {
92
+ return html``;
93
+ }
94
+ return html`
95
+ <wa-tree-item
96
+ @dblclick=${this.nobubble(this.onItemDblClicked)}
97
+ .model=${node}
98
+ ?expanded=${expanded}
99
+ >
100
+ <span><lyra-icon name="${node.icon}"></lyra-icon> ${node.label}</span>
101
+ ${node.children?.map((child) => this.createTreeItems(child))}
102
+ </wa-tree-item>
103
+ `;
104
+ }
105
+ render() {
106
+ return html`
107
+ <wa-tree
108
+ ${ref(this.treeRef)}
109
+ @wa-selection-change=${this.nobubble(this.onSelectionChanged)}
110
+ style="--indent-guide-width: 1px;"
111
+ >
112
+ ${this.rootNodes?.map(
113
+ (node) => this.createTreeItems(node, true)
114
+ )}
115
+ </wa-tree>
116
+ `;
117
+ }
118
+ };
119
+ LyraCatalog.styles = css`
120
+ :host {
121
+ display: flex;
122
+ flex-direction: column;
123
+ }
124
+ `;
125
+ __decorateClass([
126
+ state()
127
+ ], LyraCatalog.prototype, "rootNodes", 2);
128
+ LyraCatalog = __decorateClass([
129
+ customElement("lyra-catalog")
130
+ ], LyraCatalog);
131
+ async function ensureWorkspacePath(workspace, path) {
132
+ if (!workspace || path.includes("/")) return path;
133
+ const children = await workspace.listChildren(false);
134
+ const first = children[0];
135
+ if (!first) return path;
136
+ return `${first.getName()}/${path}`;
137
+ }
138
+ registerAll({
139
+ command: {
140
+ id: "checkout",
141
+ name: "Checkout",
142
+ description: "Checkout a catalog item into the workspace",
143
+ parameters: [
144
+ {
145
+ name: "url",
146
+ description: "the url of the resource to checkout, if not provided, the current selection in the catalog will be used",
147
+ required: false
148
+ }
149
+ ]
150
+ },
151
+ handler: {
152
+ execute: async (context) => {
153
+ let url = context.params && context.params["url"];
154
+ if (!url) {
155
+ const catalogItem = activeSelectionSignal.get();
156
+ if (!catalogItem || !("url" in catalogItem)) {
157
+ return;
158
+ }
159
+ url = catalogItem.url;
160
+ }
161
+ const workspaceDir = await workspaceService.getWorkspace();
162
+ if (!workspaceDir) {
163
+ toastError("No workspace selected.");
164
+ return;
165
+ }
166
+ fetch(url, { method: "GET" }).then((resp) => resp.blob()).then(async (blob) => {
167
+ const segs = new URL(url).pathname.split("/");
168
+ const fileName = segs[segs.length - 1];
169
+ const savePath = await ensureWorkspacePath(workspaceDir, fileName);
170
+ return workspaceDir.getResource(savePath, { create: true }).then((resource) => {
171
+ const file = resource;
172
+ return file.saveContents(blob, {
173
+ contentType: FileContentType.BINARY
174
+ }).then(() => {
175
+ toastInfo("File checked out: " + fileName);
176
+ });
177
+ });
178
+ }).catch((err) => {
179
+ toastError(String(err));
180
+ });
181
+ }
182
+ }
183
+ });
184
+ registerAll({
185
+ command: {
186
+ id: "refresh_catalog",
187
+ name: "Refresh Catalog",
188
+ description: "Refreshes the catalog view",
189
+ parameters: []
190
+ },
191
+ handler: {
192
+ execute: async () => {
193
+ const part = activePartSignal.get();
194
+ if (part instanceof LyraCatalog) {
195
+ part.refresh();
196
+ }
197
+ }
198
+ }
199
+ });
200
+ registerAll({
201
+ command: {
202
+ id: "catalog_expand_all",
203
+ name: "Expand All Catalog Items",
204
+ description: "Expands all items in the catalog tree",
205
+ parameters: []
206
+ },
207
+ handler: {
208
+ execute: async () => {
209
+ const part = activePartSignal.get();
210
+ if (part instanceof LyraCatalog) {
211
+ part.setAllExpanded(true);
212
+ }
213
+ }
214
+ }
215
+ });
216
+ registerAll({
217
+ command: {
218
+ id: "catalog_collapse_all",
219
+ name: "Collapse All Catalog Items",
220
+ description: "Collapses all items in the catalog tree",
221
+ parameters: []
222
+ },
223
+ handler: {
224
+ execute: async () => {
225
+ const part = activePartSignal.get();
226
+ if (part instanceof LyraCatalog) {
227
+ part.setAllExpanded(false);
228
+ }
229
+ }
230
+ }
231
+ });
232
+ contributionRegistry.registerContribution(SIDEBAR_MAIN, {
233
+ name: "catalog",
234
+ label: "Catalog",
235
+ icon: "book",
236
+ component: (id) => html`<lyra-catalog id="${id}"></lyra-catalog>`
237
+ });
238
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sources":["../src/lyra-catalog.ts","../src/loader.ts"],"sourcesContent":["import {\n css,\n html,\n TemplateResult,\n customElement,\n state,\n createRef,\n ref,\n} from \"@eclipse-lyra/core/externals/lit\";\nimport {\n LyraPart,\n TreeContribution,\n TreeNode,\n contributionRegistry,\n activePartSignal,\n activeSelectionSignal,\n} from \"@eclipse-lyra/core/api\";\n\nexport const CID_CATALOG_ROOT = \"catalog.root\";\n\n@customElement(\"lyra-catalog\")\nexport class LyraCatalog extends LyraPart {\n @state()\n private rootNodes?: TreeNode[];\n\n private treeRef = createRef<HTMLElement>();\n\n protected doBeforeUI() {\n const contributions = contributionRegistry.getContributions(\n CID_CATALOG_ROOT\n ) as TreeContribution[];\n this.rootNodes = this.toTreeNodes(contributions);\n }\n\n protected renderToolbar() {\n const isActiveAndHasSelection =\n activePartSignal.get() instanceof LyraCatalog &&\n activeSelectionSignal.get() !== undefined;\n\n return html`\n <lyra-command\n cmd=\"checkout\"\n icon=\"file-arrow-down\"\n ?disabled=${!isActiveAndHasSelection}\n title=\"Checkout\"\n ></lyra-command>\n <lyra-command\n cmd=\"refresh_catalog\"\n icon=\"arrows-rotate\"\n title=\"Refresh Catalog\"\n ></lyra-command>\n <lyra-command\n cmd=\"catalog_expand_all\"\n icon=\"angles-down\"\n slot=\"end\"\n title=\"Expand All\"\n ></lyra-command>\n <lyra-command\n cmd=\"catalog_collapse_all\"\n icon=\"angles-up\"\n slot=\"end\"\n title=\"Collapse All\"\n ></lyra-command>\n `;\n }\n\n private toTreeNodes(contributions: TreeContribution[]) {\n return contributions.map((c) => {\n const node = {\n data: c.state,\n icon: c.icon,\n label: c.label,\n leaf: false,\n } as TreeNode;\n if (c.contributionId) {\n const children = contributionRegistry.getContributions(\n c.contributionId\n ) as TreeContribution[];\n node.leaf = children.length === 0;\n node.children = this.toTreeNodes(children);\n }\n return node;\n });\n }\n\n onItemDblClicked(event: Event) {\n const url = (event.currentTarget as any).model.data.url;\n this.executeCommand(\"checkout\", { url });\n }\n\n onSelectionChanged(event: Event) {\n const node: TreeNode = (event as CustomEvent).detail.selection[0]\n .model;\n activeSelectionSignal.set(node.data);\n }\n\n public setAllExpanded(expanded: boolean) {\n const tree = this.treeRef.value;\n if (tree) {\n tree.querySelectorAll(\"wa-tree-item\").forEach((item: any) => {\n item.expanded = expanded;\n });\n }\n }\n\n public refresh() {\n this.requestUpdate();\n }\n\n createTreeItems(node: TreeNode, expanded = false): TemplateResult {\n if (!node) {\n return html``;\n }\n return html`\n <wa-tree-item\n @dblclick=${this.nobubble(this.onItemDblClicked)}\n .model=${node}\n ?expanded=${expanded}\n >\n <span><lyra-icon name=\"${node.icon}\"></lyra-icon> ${node.label}</span>\n ${node.children?.map((child) => this.createTreeItems(child))}\n </wa-tree-item>\n `;\n }\n\n render() {\n return html`\n <wa-tree\n ${ref(this.treeRef)}\n @wa-selection-change=${this.nobubble(this.onSelectionChanged)}\n style=\"--indent-guide-width: 1px;\"\n >\n ${this.rootNodes?.map((node) =>\n this.createTreeItems(node, true)\n )}\n </wa-tree>\n `;\n }\n\n static styles = css`\n :host {\n display: flex;\n flex-direction: column;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"lyra-catalog\": LyraCatalog;\n }\n}\n","import { html } from \"@eclipse-lyra/core/externals/lit\";\nimport { LyraCatalog } from \"./lyra-catalog\";\nimport {\n registerAll,\n File,\n FileContentType,\n workspaceService,\n activePartSignal,\n activeSelectionSignal,\n toastError,\n toastInfo,\n contributionRegistry,\n type Directory,\n SIDEBAR_MAIN,\n} from \"@eclipse-lyra/core/api\";\n\nasync function ensureWorkspacePath(workspace: Directory | undefined, path: string): Promise<string> {\n if (!workspace || path.includes(\"/\")) return path;\n const children = await workspace.listChildren(false);\n const first = children[0];\n if (!first) return path;\n return `${first.getName()}/${path}`;\n}\n\nregisterAll({\n command: {\n id: \"checkout\",\n name: \"Checkout\",\n description:\n \"Checkout a catalog item into the workspace\",\n parameters: [\n {\n name: \"url\",\n description:\n \"the url of the resource to checkout, if not provided, the current selection in the catalog will be used\",\n required: false,\n },\n ],\n },\n handler: {\n execute: async (context) => {\n let url: string = context.params && context.params[\"url\"];\n if (!url) {\n const catalogItem = activeSelectionSignal.get();\n if (!catalogItem || !(\"url\" in catalogItem)) {\n return;\n }\n url = catalogItem.url as string;\n }\n\n const workspaceDir = await workspaceService.getWorkspace();\n if (!workspaceDir) {\n toastError(\"No workspace selected.\");\n return;\n }\n fetch(url, { method: \"GET\" })\n .then((resp) => resp.blob())\n .then(async (blob) => {\n const segs = new URL(url).pathname.split(\"/\");\n const fileName = segs[segs.length - 1];\n const savePath = await ensureWorkspacePath(workspaceDir, fileName);\n return workspaceDir\n .getResource(savePath, { create: true })\n .then((resource) => {\n const file = resource as File;\n return file\n .saveContents(blob, {\n contentType: FileContentType.BINARY,\n })\n .then(() => {\n toastInfo(\"File checked out: \" + fileName);\n });\n });\n })\n .catch((err) => {\n toastError(String(err));\n });\n },\n },\n});\n\nregisterAll({\n command: {\n id: \"refresh_catalog\",\n name: \"Refresh Catalog\",\n description: \"Refreshes the catalog view\",\n parameters: [],\n },\n handler: {\n execute: async () => {\n const part = activePartSignal.get();\n if (part instanceof LyraCatalog) {\n part.refresh();\n }\n },\n },\n});\n\nregisterAll({\n command: {\n id: \"catalog_expand_all\",\n name: \"Expand All Catalog Items\",\n description: \"Expands all items in the catalog tree\",\n parameters: [],\n },\n handler: {\n execute: async () => {\n const part = activePartSignal.get();\n if (part instanceof LyraCatalog) {\n part.setAllExpanded(true);\n }\n },\n },\n});\n\nregisterAll({\n command: {\n id: \"catalog_collapse_all\",\n name: \"Collapse All Catalog Items\",\n description: \"Collapses all items in the catalog tree\",\n parameters: [],\n },\n handler: {\n execute: async () => {\n const part = activePartSignal.get();\n if (part instanceof LyraCatalog) {\n part.setAllExpanded(false);\n }\n },\n },\n});\n\ncontributionRegistry.registerContribution(SIDEBAR_MAIN, {\n name: \"catalog\",\n label: \"Catalog\",\n icon: \"book\",\n component: (id: string) => html`<lyra-catalog id=\"${id}\"></lyra-catalog>`,\n} as any);\n"],"names":[],"mappings":";;;;;;;;;;;;AAkBO,MAAM,mBAAmB;AAGzB,IAAM,cAAN,cAA0B,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B,YAAM,OAAO,iBAAiB,IAAA;AAC9B,UAAI,gBAAgB,aAAa;AAC7B,aAAK,QAAA;AAAA,MACT;AAAA,IACJ;AAAA,EAAA;AAER,CAAC;AAED,YAAY;AAAA,EACR,SAAS;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY,CAAA;AAAA,EAAC;AAAA,EAEjB,SAAS;AAAA,IACL,SAAS,YAAY;AACjB,YAAM,OAAO,iBAAiB,IAAA;AAC9B,UAAI,gBAAgB,aAAa;AAC7B,aAAK,eAAe,IAAI;AAAA,MAC5B;AAAA,IACJ;AAAA,EAAA;AAER,CAAC;AAED,YAAY;AAAA,EACR,SAAS;AAAA,IACL,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,YAAY,CAAA;AAAA,EAAC;AAAA,EAEjB,SAAS;AAAA,IACL,SAAS,YAAY;AACjB,YAAM,OAAO,iBAAiB,IAAA;AAC9B,UAAI,gBAAgB,aAAa;AAC7B,aAAK,eAAe,KAAK;AAAA,MAC7B;AAAA,IACJ;AAAA,EAAA;AAER,CAAC;AAED,qBAAqB,qBAAqB,cAAc;AAAA,EACpD,MAAM;AAAA,EACN,OAAO;AAAA,EACP,MAAM;AAAA,EACN,WAAW,CAAC,OAAe,yBAAyB,EAAE;AAC1D,CAAQ;"}
@@ -0,0 +1,23 @@
1
+ import { TemplateResult } from '@eclipse-lyra/core/externals/lit';
2
+ import { LyraPart, TreeNode } from '@eclipse-lyra/core/api';
3
+ export declare const CID_CATALOG_ROOT = "catalog.root";
4
+ export declare class LyraCatalog extends LyraPart {
5
+ private rootNodes?;
6
+ private treeRef;
7
+ protected doBeforeUI(): void;
8
+ protected renderToolbar(): TemplateResult<1>;
9
+ private toTreeNodes;
10
+ onItemDblClicked(event: Event): void;
11
+ onSelectionChanged(event: Event): void;
12
+ setAllExpanded(expanded: boolean): void;
13
+ refresh(): void;
14
+ createTreeItems(node: TreeNode, expanded?: boolean): TemplateResult;
15
+ render(): TemplateResult<1>;
16
+ static styles: import('lit').CSSResult;
17
+ }
18
+ declare global {
19
+ interface HTMLElementTagNameMap {
20
+ "lyra-catalog": LyraCatalog;
21
+ }
22
+ }
23
+ //# sourceMappingURL=lyra-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lyra-catalog.d.ts","sourceRoot":"","sources":["../src/lyra-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,cAAc,EAKjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACH,QAAQ,EAER,QAAQ,EAIX,MAAM,wBAAwB,CAAC;AAEhC,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,qBACa,WAAY,SAAQ,QAAQ;IAErC,OAAO,CAAC,SAAS,CAAC,CAAa;IAE/B,OAAO,CAAC,OAAO,CAA4B;IAE3C,SAAS,CAAC,UAAU;IAOpB,SAAS,CAAC,aAAa;IAgCvB,OAAO,CAAC,WAAW;IAmBnB,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAK7B,kBAAkB,CAAC,KAAK,EAAE,KAAK;IAMxB,cAAc,CAAC,QAAQ,EAAE,OAAO;IAShC,OAAO;IAId,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,UAAQ,GAAG,cAAc;IAgBjE,MAAM;IAcN,MAAM,CAAC,MAAM,0BAKX;CACL;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,cAAc,EAAE,WAAW,CAAC;KAC/B;CACJ"}
@@ -0,0 +1,7 @@
1
+ import { TreeContribution } from '@eclipse-lyra/core/api';
2
+ export interface CatalogContribution extends TreeContribution {
3
+ items?: CatalogContribution[];
4
+ }
5
+ export declare function getCatalogBaseUrl(): string;
6
+ export declare function registerCatalog(catalog: CatalogContribution, baseUrl?: string): void;
7
+ //# sourceMappingURL=register-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-catalog.d.ts","sourceRoot":"","sources":["../src/register-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,gBAAgB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IACzD,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAM1C;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAgCpF"}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@eclipse-lyra/extension-catalog",
3
+ "version": "0.0.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./api": {
14
+ "types": "./dist/api.d.ts",
15
+ "import": "./dist/api.js"
16
+ },
17
+ "./loader": {
18
+ "types": "./dist/loader.d.ts",
19
+ "import": "./dist/loader.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "build": "vite build"
27
+ },
28
+ "dependencies": {
29
+ "@eclipse-lyra/core": "*"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "^5.9.3",
33
+ "vite": "^7.1.12",
34
+ "vite-plugin-dts": "^4.5.4"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/eclipse-lyra/core"
39
+ }
40
+ }