@eclipse-docks/core 0.7.139 → 0.7.141
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/index.js +4 -4
- package/dist/{api-3h__hDci.js → api-BK6tUxt7.js} +131 -56
- package/dist/api-BK6tUxt7.js.map +1 -0
- package/dist/components/filebrowser.d.ts +12 -1
- package/dist/components/filebrowser.d.ts.map +1 -1
- package/dist/components/tasks.d.ts.map +1 -1
- package/dist/core/contributionregistry.d.ts +1 -0
- package/dist/core/contributionregistry.d.ts.map +1 -1
- package/dist/core/filesys/common.d.ts +1 -0
- package/dist/core/filesys/common.d.ts.map +1 -1
- package/dist/{filebrowser.de-LWsrI9xj.js → filebrowser.de-BfFcNr19.js} +13 -3
- package/dist/{filebrowser.de-LWsrI9xj.js.map → filebrowser.de-BfFcNr19.js.map} +1 -1
- package/dist/{filebrowser.en-C02vpzAs.js → filebrowser.en-CLd5Mccb.js} +13 -3
- package/dist/{filebrowser.en-C02vpzAs.js.map → filebrowser.en-CLd5Mccb.js.map} +1 -1
- package/dist/fs-access-B1bmJ5U0.js +2 -0
- package/dist/{fs-access-Cjcg0_Me.js → fs-access-CrktZo-_.js} +2 -1
- package/dist/fs-access-CrktZo-_.js.map +1 -0
- package/dist/index.js +4 -4
- package/dist/parts/index.js +1 -1
- package/dist/parts/part.d.ts.map +1 -1
- package/dist/parts/toolbar.d.ts.map +1 -1
- package/dist/{parts-DMjNqL4o.js → parts-DS9RDVu9.js} +28 -5
- package/dist/parts-DS9RDVu9.js.map +1 -0
- package/dist/{widget-DUR6wxME.js → widget-CIg2W15o.js} +12 -1
- package/dist/widget-CIg2W15o.js.map +1 -0
- package/dist/widgets/index.js +1 -1
- package/dist/{widgets-A9XMOA_j.js → widgets-DHZq5ps_.js} +2 -2
- package/dist/{widgets-A9XMOA_j.js.map → widgets-DHZq5ps_.js.map} +1 -1
- package/package.json +2 -2
- package/src/commands/files.ts +14 -8
- package/src/components/filebrowser.de.json +6 -1
- package/src/components/filebrowser.en.json +6 -1
- package/src/components/filebrowser.ts +120 -28
- package/src/components/tasks.ts +16 -15
- package/src/core/contributionregistry.ts +9 -0
- package/src/core/filesys/common.ts +2 -1
- package/src/parts/part.ts +3 -0
- package/src/parts/toolbar.ts +20 -0
- package/dist/api-3h__hDci.js.map +0 -1
- package/dist/fs-access-Cjcg0_Me.js.map +0 -1
- package/dist/fs-access-Dp9Fwsxk.js +0 -2
- package/dist/parts-DMjNqL4o.js.map +0 -1
- package/dist/widget-DUR6wxME.js.map +0 -1
|
@@ -202,6 +202,17 @@ var ContributionRegistry = class {
|
|
|
202
202
|
if (!this.contributions.has(target)) this.contributions.set(target, []);
|
|
203
203
|
return this.contributions.get(target);
|
|
204
204
|
}
|
|
205
|
+
unregisterContribution(target, name) {
|
|
206
|
+
const slot = this.contributions.get(target);
|
|
207
|
+
if (!slot) return;
|
|
208
|
+
const next = slot.filter((contribution) => contribution.name !== name);
|
|
209
|
+
if (next.length === slot.length) return;
|
|
210
|
+
this.contributions.set(target, next);
|
|
211
|
+
publish(TOPIC_CONTRIBUTEIONS_CHANGED, {
|
|
212
|
+
target,
|
|
213
|
+
contributions: this.getContributions(target)
|
|
214
|
+
});
|
|
215
|
+
}
|
|
205
216
|
};
|
|
206
217
|
var contributionRegistry = new ContributionRegistry();
|
|
207
218
|
rootContext.put("contributionRegistry", contributionRegistry);
|
|
@@ -454,4 +465,4 @@ var DocksWidget = class extends DocksWidgetBase {
|
|
|
454
465
|
//#endregion
|
|
455
466
|
export { overrideContributionTargets as C, toastWarning as E, listContributionNameRemaps as S, toastInfo as T, getContributionDisabled as _, TOPIC_COMMAND_REGISTERED as a, applyConfigNameRemaps as b, EMPTY_SIGNALPORT as c, activeSelectionSignal as d, activeTasksSignal as f, contributionRegistry as g, TOPIC_CONTRIBUTEIONS_CHANGED as h, CommandStack as i, activeEditorSignal as l, perspectiveSwitchedSignal as m, watchSignal as n, commandRegistry as o, partDirtySignal as p, CommandRegistry as r, registerAll as s, DocksWidget as t, activePartSignal as u, getContributionVisible as v, toastError as w, contributionTargetMappingRegistry as x, readReactiveBoolean as y };
|
|
456
467
|
|
|
457
|
-
//# sourceMappingURL=widget-
|
|
468
|
+
//# sourceMappingURL=widget-CIg2W15o.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-CIg2W15o.js","names":["event_unsubscribe","event_subscribe"],"sources":["../src/core/toast.ts","../src/core/contribution-mapping.ts","../src/core/contributionregistry.ts","../src/core/appstate.ts","../src/core/commandregistry.ts","../src/externals/wa-tree-shadow-parts.ts","../src/core/signals.ts","../src/widgets/widget.ts"],"sourcesContent":["import '@awesome.me/webawesome/dist/components/toast/toast.js';\nimport { createLogger } from './logger';\n\nconst logger = createLogger('Toast');\n\nconst DURATION = 4000;\n\ntype ToastVariant = 'brand' | 'danger' | 'warning';\n\ntype WaToastElement = HTMLElement & {\n placement: string;\n create(\n message: string,\n options?: {\n variant?: ToastVariant | 'neutral' | 'success';\n duration?: number;\n },\n ): Promise<HTMLElement>;\n};\n\nlet toastStack: WaToastElement | null = null;\n\nfunction getToastStack(): WaToastElement {\n if (!toastStack) {\n toastStack = document.createElement('wa-toast') as WaToastElement;\n toastStack.placement = 'bottom-end';\n document.body.append(toastStack);\n }\n return toastStack;\n}\n\nconst show = (msg: string, variant: ToastVariant) => {\n if (typeof document === 'undefined' || !document.body) return;\n void getToastStack().create(msg, { variant, duration: DURATION });\n};\n\nexport const toastInfo = (msg: string) => {\n logger.info(msg);\n show(msg, 'brand');\n};\n\nexport const toastError = (msg: string) => {\n logger.error(msg);\n show(msg, 'danger');\n};\n\nexport const toastWarning = (msg: string) => {\n logger.warn(msg);\n show(msg, 'warning');\n};\n","import { rootContext } from \"./di\";\nimport type { Contribution } from \"./contributionregistry\";\n\nexport interface ContributionNameRemap {\n /**\n * Globally unique, namespaced contribution name\n * (e.g. \"view.filebrowser\", \"toolbar.filebrowser.rename\").\n */\n name: string;\n /**\n * Effective target slots for this contribution.\n * If empty, the original target is used.\n */\n targets: string[];\n}\n\ninterface NameRemapState {\n appTargets: string[] | undefined;\n globalTargets: string[] | undefined;\n}\n\n/**\n * Registry responsible for resolving effective contribution targets.\n *\n * It supports:\n * - Global (framework-level) remaps.\n * - App-level remaps coming from AppDefinition.\n * - Multiple targets per contribution.\n *\n * Resolution precedence:\n * app-level remap > global remap > original target\n */\nclass ContributionTargetMappingRegistry {\n private globalNameRemaps = new Map<string, string[]>();\n private appNameRemaps = new Map<string, string[]>();\n\n setGlobalNameRemap(name: string, targets: string[]): void {\n this.globalNameRemaps.set(name, this.normalizeTargets(targets));\n }\n\n /** Clears all remaps. For testing only. */\n resetForTesting(): void {\n this.globalNameRemaps.clear();\n this.appNameRemaps.clear();\n }\n\n applyAppNameRemaps(remaps: ContributionNameRemap[] | undefined | null): void {\n this.appNameRemaps.clear();\n if (!remaps) return;\n for (const remap of remaps) {\n this.appNameRemaps.set(remap.name, this.normalizeTargets(remap.targets));\n }\n }\n\n /**\n * Returns the effective target slots for a contribution given its original target.\n *\n * Semantics:\n * - When a remap exists with a non-empty targets array, those targets are used.\n * - When a remap exists with an empty targets array, the contribution is disabled (no targets).\n * - When no remap exists, the original target is used.\n */\n getEffectiveTargets(originalTarget: string, contribution: Contribution): string[] {\n const name = (contribution as any).name as string | undefined;\n if (!name) {\n return [originalTarget];\n }\n\n const appTargets = this.appNameRemaps.get(name);\n if (appTargets) {\n return appTargets.length > 0 ? appTargets : [];\n }\n\n const globalTargets = this.globalNameRemaps.get(name);\n if (globalTargets) {\n return globalTargets.length > 0 ? globalTargets : [];\n }\n\n return [originalTarget];\n }\n\n /**\n * Returns current mapping state for debugging and tooling.\n */\n listNameRemaps(): Record<string, NameRemapState> {\n const result: Record<string, NameRemapState> = {};\n const allNames = new Set<string>([\n ...this.globalNameRemaps.keys(),\n ...this.appNameRemaps.keys()\n ]);\n for (const name of allNames) {\n result[name] = {\n appTargets: this.appNameRemaps.get(name),\n globalTargets: this.globalNameRemaps.get(name)\n };\n }\n return result;\n }\n\n private normalizeTargets(targets: string[]): string[] {\n const seen = new Set<string>();\n const result: string[] = [];\n for (const t of targets) {\n if (!t || seen.has(t)) continue;\n seen.add(t);\n result.push(t);\n }\n return result;\n }\n}\n\nexport const contributionTargetMappingRegistry = new ContributionTargetMappingRegistry();\nrootContext.put(\"contributionTargetMappingRegistry\", contributionTargetMappingRegistry);\n\n/**\n * Public helper to override contribution targets programmatically.\n * This sets a global remap that applies across all apps.\n */\nexport function overrideContributionTargets(name: string, targets: string | string[]): void {\n const normalized = Array.isArray(targets) ? targets : [targets];\n contributionTargetMappingRegistry.setGlobalNameRemap(name, normalized);\n}\n\n/**\n * Apply config-driven name remaps from a simple object.\n * Intended for hosts that want to load JSON/YAML mapping files.\n */\nexport function applyConfigNameRemaps(config: Record<string, string | string[]>): void {\n for (const [name, targets] of Object.entries(config)) {\n const normalized = Array.isArray(targets) ? targets : [targets];\n contributionTargetMappingRegistry.setGlobalNameRemap(name, normalized);\n }\n}\n\n/**\n * Convenience helper for debugging: returns current remap state\n * for all known contribution names.\n */\nexport function listContributionNameRemaps(): Record<string, NameRemapState> {\n return contributionTargetMappingRegistry.listNameRemaps();\n}\n\n","import { Signal } from \"@lit-labs/signals\";\nimport { TemplateResult } from \"lit\";\nimport { publish } from \"./events\";\nimport { rootContext } from \"./di\";\nimport { contributionTargetMappingRegistry } from \"./contribution-mapping\";\n\nexport const TOPIC_CONTRIBUTEIONS_CHANGED = \"events/contributionregistry/contributionsChanged\"\n\nexport interface ContributionChangeEvent {\n target: string;\n contributions: Contribution[];\n}\n\nexport interface Contribution {\n /** Optional globally unique, namespaced contribution name (e.g. \"view.filebrowser\"). */\n name?: string;\n target?: string;\n label: string;\n /** When true, UI may show `label` alongside the icon (e.g. toolbar). Honored where supported in UI. */\n showLabel?: boolean;\n icon?: string;\n slot?: string;\n /**\n * Higher ranking appears first in `getContributions`. Defaults to 0.\n * Equal ranks keep registration order.\n */\n ranking?: number;\n disabled?: (() => boolean) | Signal.Computed<boolean>;\n /** When false, the contribution is not rendered (default: shown). Honored where supported in UI. */\n visible?: (() => boolean) | Signal.Computed<boolean>;\n}\n\nexport interface CommandContribution extends Contribution {\n command: string;\n params?: Record<string, any>;\n}\n\nexport function isCommandContribution(contribution: Contribution): contribution is CommandContribution {\n return \"command\" in contribution;\n}\n\nexport type ReactiveBoolean = boolean | (() => boolean) | Signal.Computed<boolean>;\n\n/** Reads a static or reactive boolean; plain functions and {@link Signal.Computed} are evaluated at call time. */\nexport function readReactiveBoolean(\n value: ReactiveBoolean | undefined,\n defaultValue: boolean\n): boolean {\n if (value === undefined) return defaultValue;\n if (typeof value === 'boolean') return value;\n if (typeof value === 'object' && value !== null && 'get' in value) {\n return (value as Signal.Computed<boolean>).get() === true;\n }\n if (typeof value === 'function') {\n return (value as () => boolean)() === true;\n }\n return defaultValue;\n}\n\n/** Default true when `visible` is omitted. */\nexport function getContributionVisible(contribution: Contribution): boolean {\n const visible = contribution.visible as Signal.Computed<boolean> | undefined;\n if (!visible) return true;\n return visible.get() !== false;\n}\n\n/** Default false when `disabled` is omitted. */\nexport function getContributionDisabled(contribution: Contribution): boolean {\n return readReactiveBoolean(contribution.disabled as ReactiveBoolean | undefined, false);\n}\n\nfunction wrapContributionReactiveFlags(contribution: Contribution): void {\n if (contribution.disabled instanceof Function) {\n contribution.disabled = new Signal.Computed<boolean>(contribution.disabled);\n }\n if (contribution.visible instanceof Function) {\n contribution.visible = new Signal.Computed<boolean>(contribution.visible);\n }\n}\n\nexport interface HTMLContribution extends Contribution {\n component: string | (() => TemplateResult)\n}\n\nexport interface TabContribution extends Contribution {\n name: string;\n /**\n * Stable editor-type identifier used for contribution targets (for example `toolbar:${editorId}`).\n * Needed because `name` is often tab-instance specific (such as file/path based) and would\n * fragment toolbar contributions across many dynamic targets.\n */\n editorId?: string;\n closable?: boolean;\n /** When true or omitted, a docks-toolbar is rendered for this tab; when false, no toolbar is shown. */\n toolbar?: boolean;\n /** When true or omitted, a contextmenu is rendered for this tab; when false, no context menu is shown. */\n contextMenu?: boolean;\n /**\n * Main-area editor type ids (`TabContribution.editorId` of the editor tab) that should reveal this tab\n * when any of them becomes the active editor in the main editor area. Omitted or empty = no auto-reveal.\n */\n coupledEditors?: string[];\n /** Return false to cancel tab close (after dirty-tab prompt, if any). */\n beforeClose?: () => boolean | Promise<boolean>;\n component?: (id: string) => TemplateResult;\n}\n\nexport interface IconContribution extends Contribution {\n mappings: Record<string, string>;\n priority?: number;\n}\n\nexport interface LayoutContribution extends Contribution {\n id: string;\n name: string;\n /** Optional icon name (e.g. Font Awesome) for the layout switcher. */\n icon?: string;\n component: string | { tag: string; attributes?: Record<string, string> } | (() => TemplateResult);\n onShow?: () => void | Promise<void>;\n}\n\nclass ContributionRegistry {\n private contributions: Map<string, Contribution[]> = new Map();\n\n registerContribution<T extends Contribution>(target: string, contribution: T) {\n const targetSlot = this.getOrCreateSlot(target);\n wrapContributionReactiveFlags(contribution);\n targetSlot.push(contribution);\n publish(TOPIC_CONTRIBUTEIONS_CHANGED, { target, contributions: targetSlot } as ContributionChangeEvent);\n\n const effectiveTargets = contributionTargetMappingRegistry.getEffectiveTargets(target, contribution);\n for (const effectiveTarget of effectiveTargets) {\n if (effectiveTarget === target) continue;\n const contributionsForSlot = this.getContributions(effectiveTarget);\n publish(TOPIC_CONTRIBUTEIONS_CHANGED, { target: effectiveTarget, contributions: contributionsForSlot } as ContributionChangeEvent);\n }\n }\n\n /**\n * Returns all contributions whose *effective* targets include the given slot.\n *\n * Note: This currently scans all registered contributions and resolves\n * remaps on each call (O(N) in number of contributions). This is acceptable\n * for typical Docks apps (dozens/hundreds of contributions and few slots),\n * but if contribution counts grow significantly we may want to introduce a\n * cached index of effective targets per slot to keep lookups O(1).\n */\n getContributions<T extends Contribution>(target: string): T[] {\n const results: T[] = [];\n for (const [originalTarget, list] of this.contributions.entries()) {\n const typedList = list as T[];\n for (const contribution of typedList) {\n const effectiveTargets = contributionTargetMappingRegistry.getEffectiveTargets(originalTarget, contribution);\n if (effectiveTargets.includes(target)) {\n results.push(contribution);\n }\n }\n }\n results.sort((a, b) => (b.ranking ?? 0) - (a.ranking ?? 0));\n if (results.length === 0) {\n this.getOrCreateSlot(target);\n }\n return results;\n }\n\n private getOrCreateSlot(target: string): Contribution[] {\n if (!this.contributions.has(target)) {\n this.contributions.set(target, []);\n }\n return this.contributions.get(target)!;\n }\n\n unregisterContribution(target: string, name: string): void {\n const slot = this.contributions.get(target);\n if (!slot) return;\n const next = slot.filter(contribution => contribution.name !== name);\n if (next.length === slot.length) return;\n this.contributions.set(target, next);\n publish(TOPIC_CONTRIBUTEIONS_CHANGED, { target, contributions: this.getContributions(target) } as ContributionChangeEvent);\n }\n}\n\nexport const contributionRegistry = new ContributionRegistry()\nrootContext.put(\"contributionRegistry\", contributionRegistry)","import { signal } from '@lit-labs/signals';\nimport { DocksPart } from \"../parts/part\";\n\nexport const EMPTY_SIGNALPORT = {} as any\n\nexport const activePartSignal = signal<DocksPart>(null as unknown as DocksPart)\nexport const activeEditorSignal = signal<DocksPart>(null as unknown as DocksPart)\n\nexport const partDirtySignal = signal<DocksPart>(null as unknown as DocksPart)\n\nexport const activeTasksSignal = signal<number>(0)\n\nexport const activeSelectionSignal = signal<any>(undefined)\n\nexport const perspectiveSwitchedSignal = signal<{name: string, timestamp: number}>({name: '', timestamp: 0})","import logger from \"./logger\";\nimport { publish } from \"./events\";\nimport { CommandContribution, contributionRegistry } from \"./contributionregistry\";\nimport { rootContext } from \"./di\";\nimport { activePartSignal, activeEditorSignal } from \"./appstate\";\n\nexport const TOPIC_COMMAND_REGISTERED = \"events/commandregistry/commandRegistered\";\n\nexport interface Parameter {\n name: string;\n description: string;\n type?: string;\n required: boolean;\n allowedValues?: string[];\n}\n\nexport interface Variable {\n name: string;\n description: string;\n type?: string;\n}\n\nexport interface LLMOptions {\n prompt?: string;\n model?: string;\n}\n\nexport class Command {\n id: string;\n name: string;\n description: string;\n icon?: string;\n keyBinding?: string;\n parameters?: Parameter[];\n output?: Variable[];\n llm?: LLMOptions;\n\n constructor(id: string, name: string, description: string, parameters?: Parameter[], output?: Variable[]) {\n this.id = id;\n this.name = name;\n this.description = description;\n this.parameters = parameters || [];\n this.output = output || [];\n }\n}\n\nexport interface ExecutionContext {\n [key: string]: any;\n\n params?: ExecuteParams;\n activePart?: any;\n activeEditor?: any;\n}\n\nexport interface ExecuteParams {\n [key: string]: any;\n}\n\nexport interface Handler {\n canExecute?: (context: ExecutionContext) => boolean;\n execute: (context: ExecutionContext) => any | Promise<any>;\n ranking?: number; // Higher ranking = higher priority (default: 0)\n}\n\nexport interface Commands {\n [commandId: string]: Command\n}\n\nfunction formatCommandResultForLog(value: unknown): string {\n if (value === undefined) {\n return \"undefined\";\n }\n if (value === null) {\n return \"null\";\n }\n if (typeof value === \"string\") {\n return value.length > 300 ? `${value.slice(0, 300)}…` : value;\n }\n if (typeof value === \"number\" || typeof value === \"boolean\") {\n return String(value);\n }\n try {\n const s = JSON.stringify(value);\n return s.length > 300 ? `${s.slice(0, 300)}…` : s;\n } catch {\n return String(value);\n }\n}\n\nexport class CommandStack {\n //private stack: any[] = []\n\n public async execute(commandId: any, context: ExecutionContext) {\n return commandRegistry.execute(commandId, context);\n }\n\n public async undo() {\n // TODO undo last command on stack\n }\n\n public async redo() {\n // TODO redo last command on stack\n }\n}\n\nexport class CommandRegistry {\n private commands: Commands = {};\n private handlers: Map<string, Handler[]> = new Map();\n\n registerHandler(commandId: string, handler: Handler) {\n if (!this.handlers.has(commandId)) {\n this.handlers.set(commandId, []);\n }\n const handlerList = this.handlers.get(commandId) as Handler[];\n handlerList.push(handler);\n // Sort by ranking (higher ranking first), default ranking is 0\n handlerList.sort((a, b) => (b.ranking ?? 0) - (a.ranking ?? 0));\n }\n\n getHandler(commandId: string): Handler[] | undefined {\n return this.handlers.get(commandId)\n }\n\n /**\n * Creates an ExecutionContext with the current application state\n * \n * @param params Optional command parameters\n * @returns ExecutionContext with captured application state\n */\n createExecutionContext(params?: ExecuteParams): ExecutionContext {\n const context: ExecutionContext = {\n params: params || {},\n activePart: activePartSignal.get(),\n activeEditor: activeEditorSignal.get()\n };\n\n return context;\n }\n\n async execute(commandId: string, context: ExecutionContext = {}) {\n const handlers = this.getHandler(commandId);\n\n if (!handlers) {\n logger.debug(`[CommandRegistry] No handlers registered for command: ${commandId}`);\n throw new Error(`No handlers registered for command: ${commandId}`);\n }\n\n const command = this.getCommand(commandId);\n const paramsStr = context.params ? ` params: ${JSON.stringify(context.params)}` : '';\n logger.debug(`[CommandRegistry] Executing command: ${commandId}${command ? ` (${command.name})` : ''}${paramsStr}`);\n\n // Handlers are already sorted by ranking, so iterate in order\n for (const handler of handlers) {\n if (handler.canExecute === undefined || handler.canExecute(context)) {\n try {\n const raw = handler.execute(context);\n const result = await Promise.resolve(raw);\n logger.debug(\n `[CommandRegistry] Command executed successfully: ${commandId} (result: ${formatCommandResultForLog(result)})`,\n );\n return result;\n } catch (error) {\n const errorMsg = error instanceof Error ? error.message : String(error);\n logger.error(`[CommandRegistry] Command execution failed: ${commandId} - ${errorMsg}`);\n throw error;\n }\n }\n }\n logger.error(`[CommandRegistry] No handler found to execute command: ${commandId}`);\n }\n\n createAndRegisterCommand(id: string, name: string, description: string, parameters: Parameter[], handler?: Handler) {\n const command = new Command(id, name, description, parameters);\n this.registerCommand(command)\n if (handler) {\n this.registerHandler(id, handler)\n }\n }\n\n registerCommand(command: Command): void {\n this.commands[command.id] = command;\n publish(TOPIC_COMMAND_REGISTERED, command);\n }\n\n hasCommand(commandId: string): boolean {\n return commandId in this.commands\n }\n\n listCommands(context?: ExecutionContext): Commands {\n if (context) {\n // filter by commands which have at least one executable handler\n return Object.values(this.commands).filter(command => {\n const handlers = commandRegistry.getHandler(command.id) || []\n return handlers.some(handler => handler.canExecute === undefined || handler.canExecute(context))\n }).reduce((acc: any, command) => {\n acc[command.id] = command\n return acc\n }, {})\n }\n return this.commands\n }\n\n getCommand(commandId: string): Command {\n return <Command>this.commands[commandId]\n }\n\n registerAll(options: RegisterOptions) {\n const commandId = options.command.id\n this.registerCommand(options.command)\n if (options.handler) {\n this.registerHandler(commandId, options.handler)\n }\n if (options.contribution && options.contribution.target) {\n contributionRegistry.registerContribution(options.contribution.target, {\n command: commandId,\n ...options.contribution\n } as CommandContribution)\n }\n }\n}\n\nexport const commandRegistry = new CommandRegistry();\nrootContext.put(\"commandRegistry\", commandRegistry);\n\nexport interface RegisterOptions {\n command: Command,\n handler?: Handler,\n contribution?: Omit<CommandContribution, 'command'>,\n}\n\nexport const registerAll = (options: RegisterOptions) => {\n commandRegistry.registerAll(options);\n}","import { css } from 'lit';\n\n/**\n * Stretch the Web Awesome label slot across the rest of the tree row.\n *\n * By default the slot is only as wide as its content, so clicks (and the context menu’s\n * synthetic click) in the empty area beside a short name often miss the slotted nodes.\n * `wa-tree` only updates selection when mousedown and click targets line up, so those\n * misses leave the wrong row selected. `flex: 1` makes the label column fill the row\n * so hits stay on the item’s content.\n *\n * Applied via `DocksWidget.finalizeStyles`: document-level CSS cannot target `::part()`\n * on `wa-tree-item` that lives only inside nested Lit shadow roots.\n */\nexport const waTreeLabelSlotStretch = css`\n wa-tree-item::part(label) {\n flex: 1;\n min-width: 0;\n }\n`;\n","import {Signal} from \"@lit-labs/signals\";\n\nexport const watchSignal = (signal: Signal.State<any> | Signal.Computed<any>, callback: (value: any) => void): (() => void) => {\n const watcher = new Signal.subtle.Watcher(async () => {\n try {\n await 0;\n callback(signal.get());\n } finally {\n watcher.watch(signal);\n }\n });\n watcher.watch(signal);\n signal.get();\n \n return () => {\n watcher.unwatch(signal);\n };\n}\n","import {LitElement, PropertyValues, type CSSResultGroup} from \"lit\";\nimport {waTreeLabelSlotStretch} from \"../externals/wa-tree-shadow-parts\";\nimport {subscribe as event_subscribe, unsubscribe as event_unsubscribe, type SubscriptionToken} from \"../core/events\";\nimport {toastError, toastInfo} from \"../core/toast\";\nimport {commandRegistry, ExecuteParams} from \"../core/commandregistry\";\nimport {Signal, SignalWatcher} from \"@lit-labs/signals\";\nimport {watchSignal} from \"../core/signals\";\n\nObject.defineProperty(LitElement.prototype, \"model\", {\n enumerable: true,\n configurable: true,\n writable: true\n});\n\nconst DocksWidgetBase = SignalWatcher(LitElement) as unknown as typeof LitElement;\n\nexport abstract class DocksWidget extends DocksWidgetBase {\n static finalizeStyles(styles?: CSSResultGroup) {\n return [waTreeLabelSlotStretch, ...super.finalizeStyles(styles)];\n }\n\n private signalCleanups = new Set<() => void>();\n private eventSubscriptions = new Set<SubscriptionToken>();\n\n connectedCallback() {\n super.connectedCallback();\n this.doBeforeUI()\n }\n\n disconnectedCallback() {\n this.doClose();\n super.disconnectedCallback();\n this.eventSubscriptions.forEach(token => event_unsubscribe(token));\n this.eventSubscriptions.clear();\n this.signalCleanups.forEach(cleanup => cleanup());\n this.signalCleanups.clear();\n }\n\n protected subscribe(topic: string, callback: Function): void {\n const token = event_subscribe(topic, callback.bind(this));\n this.eventSubscriptions.add(token);\n }\n\n protected showInfo(msg: string) {\n toastInfo(msg)\n }\n\n protected showError(msg: string) {\n toastError(msg)\n }\n\n protected nobubble(wrap: (event: Event) => void) {\n return (event: Event) => {\n event.stopPropagation();\n wrap.bind(this)(event);\n };\n }\n\n protected command(command: string, state: {} = {}) {\n return () => {\n void this.executeCommand(command, state);\n };\n }\n\n protected async executeCommand(command: string, params: ExecuteParams) {\n const execContext = commandRegistry.createExecutionContext(params);\n await commandRegistry.execute(command, execContext);\n }\n\n protected watch(signal: Signal.State<any> | Signal.Computed<any>, callback: (value: any) => void): void {\n const cleanup = watchSignal(signal as Signal.State<any>, callback.bind(this));\n this.signalCleanups.add(cleanup);\n }\n\n protected firstUpdated(_changedProperties: PropertyValues) {\n super.firstUpdated(_changedProperties);\n this.doInitUI()\n }\n\n protected updateIdle() {\n requestIdleCallback(() => this.requestUpdate())\n }\n\n public updateLater() {\n requestAnimationFrame(() => this.requestUpdate())\n }\n\n protected doBeforeUI() {\n }\n\n protected doInitUI() {\n }\n\n /**\n * Override to release resources when the element is disconnected (called from {@link disconnectedCallback}).\n */\n protected doClose() {\n }\n\n withRefresh(callback: () => void) {\n callback()\n this.updateLater()\n }\n}\n"],"mappings":";;;;;;AAGA,IAAM,SAAS,aAAa,OAAO;AAEnC,IAAM,WAAW;AAejB,IAAI,aAAoC;AAExC,SAAS,gBAAgC;CACvC,IAAI,CAAC,YAAY;EACf,aAAa,SAAS,cAAc,UAAU;EAC9C,WAAW,YAAY;EACvB,SAAS,KAAK,OAAO,UAAU;CACjC;CACA,OAAO;AACT;AAEA,IAAM,QAAQ,KAAa,YAA0B;CACnD,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,MAAM;CACvD,cAAmB,CAAC,CAAC,OAAO,KAAK;EAAE;EAAS,UAAU;CAAS,CAAC;AAClE;AAEA,IAAa,aAAa,QAAgB;CACxC,OAAO,KAAK,GAAG;CACf,KAAK,KAAK,OAAO;AACnB;AAEA,IAAa,cAAc,QAAgB;CACzC,OAAO,MAAM,GAAG;CAChB,KAAK,KAAK,QAAQ;AACpB;AAEA,IAAa,gBAAgB,QAAgB;CAC3C,OAAO,KAAK,GAAG;CACf,KAAK,KAAK,SAAS;AACrB;;;;;;;;;;;;;;ACjBA,IAAM,oCAAN,MAAwC;;EACT,KAAA,mCAAA,IAAI,IAAsB;EAC7B,KAAA,gCAAA,IAAI,IAAsB;;CAElD,mBAAmB,MAAc,SAAyB;EACtD,KAAK,iBAAiB,IAAI,MAAM,KAAK,iBAAiB,OAAO,CAAC;CAClE;;CAGA,kBAAwB;EACpB,KAAK,iBAAiB,MAAM;EAC5B,KAAK,cAAc,MAAM;CAC7B;CAEA,mBAAmB,QAA0D;EACzE,KAAK,cAAc,MAAM;EACzB,IAAI,CAAC,QAAQ;EACb,KAAK,MAAM,SAAS,QAChB,KAAK,cAAc,IAAI,MAAM,MAAM,KAAK,iBAAiB,MAAM,OAAO,CAAC;CAE/E;;;;;;;;;CAUA,oBAAoB,gBAAwB,cAAsC;EAC9E,MAAM,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CAEA,cAAqB;EACjB,4BAA4B,KAAK,cAAc,CAAC;CACpD;CAEA,aAAuB,CACvB;CAEA,WAAqB,CACrB;;;;CAKA,UAAoB,CACpB;CAEA,YAAY,UAAsB;EAC9B,SAAS;EACT,KAAK,YAAY;CACrB;AACJ"}
|
package/dist/widgets/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "../widgets-
|
|
1
|
+
import "../widgets-DHZq5ps_.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DocksWidget } from "./widget-
|
|
1
|
+
import { t as DocksWidget } from "./widget-CIg2W15o.js";
|
|
2
2
|
import { css, html } from "lit";
|
|
3
3
|
import { customElement, property } from "lit/decorators.js";
|
|
4
4
|
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
@@ -69,4 +69,4 @@ _decorate([property()], DocksNoContent.prototype, "icon", void 0);
|
|
|
69
69
|
DocksNoContent = _decorate([customElement("docks-no-content")], DocksNoContent);
|
|
70
70
|
//#endregion
|
|
71
71
|
|
|
72
|
-
//# sourceMappingURL=widgets-
|
|
72
|
+
//# sourceMappingURL=widgets-DHZq5ps_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets-
|
|
1
|
+
{"version":3,"file":"widgets-DHZq5ps_.js","names":[],"sources":["../src/widgets/nocontent.ts"],"sourcesContent":["import { css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\n\nimport { DocksWidget } from \"./widget\";\n\n@customElement(\"docks-no-content\")\nexport class DocksNoContent extends DocksWidget {\n @property()\n private message: string = \"No content.\";\n\n @property()\n private icon: string = \"info-circle\";\n\n render() {\n return html`\n <div class=\"empty\" role=\"status\">\n <div class=\"empty-icon-wrap\" aria-hidden=\"true\">\n <wa-icon name=${this.icon} label=\"\"></wa-icon>\n </div>\n <p class=\"empty-message\">${this.message}</p>\n </div>\n `;\n }\n\n static styles = css`\n :host {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n padding: var(--wa-space-xl) var(--wa-space-l);\n }\n\n .empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: var(--wa-space-m);\n max-width: min(28rem, 100%);\n text-align: center;\n }\n\n .empty-icon-wrap {\n display: flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n color: var(--wa-color-neutral-40);\n }\n\n .empty-icon-wrap wa-icon {\n font-size: 2rem;\n opacity: 0.9;\n }\n\n .empty-message {\n margin: 0;\n font-size: var(--wa-font-size-s);\n font-weight: 400;\n line-height: 1.5;\n color: var(--wa-color-neutral-60);\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"docks-no-content\": DocksNoContent;\n }\n}\n"],"mappings":";;;;;AAMO,IAAM,iBAAN,MAAM,uBAAuB,YAAY;;;EAElB,KAAA,UAAA;EAGH,KAAA,OAAA;;CAEvB,SAAS;EACL,OAAO,IAAI;;;oCAGiB,KAAK,KAAK;;2CAEH,KAAK,QAAQ;;;CAGpD;;EAEgB,KAAA,SAAA,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CvB;AA3DK,UAAA,CAAA,SAAS,CAAA,GAAA,eAAA,WAAA,WAAA,KAAA,CAAA;AAGT,UAAA,CAAA,SAAS,CAAA,GAAA,eAAA,WAAA,QAAA,KAAA,CAAA;AALb,iBAAA,UAAA,CAAA,cAAc,kBAAkB,CAAA,GAAA,cAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eclipse-docks/core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.141",
|
|
4
4
|
"description": "Eclipse Docks platform core: registries, services, parts, widgets, and API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "EPL-2.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"test:coverage": "vitest run --coverage"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"dompurify": "^3.
|
|
80
|
+
"dompurify": "^3.4.16",
|
|
81
81
|
"@awesome.me/webawesome": "^3.12.0",
|
|
82
82
|
"@fortawesome/fontawesome-free": "^7.2.0",
|
|
83
83
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
package/src/commands/files.ts
CHANGED
|
@@ -159,14 +159,20 @@ registerAll({
|
|
|
159
159
|
},
|
|
160
160
|
handler: {
|
|
161
161
|
execute: async _context => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
162
|
+
try {
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
const dirHandle = await window.showDirectoryPicker({
|
|
165
|
+
mode: "readwrite"
|
|
166
|
+
}) as FileSystemDirectoryHandle;
|
|
167
|
+
await workspaceService.connectWorkspace(dirHandle);
|
|
168
|
+
} catch (err: any) {
|
|
169
|
+
const cancelled =
|
|
170
|
+
err?.name === 'AbortError' ||
|
|
171
|
+
/abort|cancel/i.test(String(err?.message ?? err));
|
|
172
|
+
if (!cancelled) toastError(err?.message ?? String(err));
|
|
173
|
+
// Re-throw so tool callers see a failed/cancelled result instead of success.
|
|
174
|
+
throw err instanceof Error ? err : new Error(String(err));
|
|
175
|
+
}
|
|
170
176
|
}
|
|
171
177
|
},
|
|
172
178
|
contribution: {
|
|
@@ -10,5 +10,10 @@
|
|
|
10
10
|
"DROP_FILES_HERE": "📁 Dateien hier ablegen",
|
|
11
11
|
"OPEN_WITH": "Öffnen mit...",
|
|
12
12
|
"FOLDER_LOAD_FAILED": "Ordner konnte nicht geladen werden: {detail}",
|
|
13
|
-
"FOLDER_UNAVAILABLE": "Dieser Arbeitsbereichsordner ist nicht verfügbar: {detail}"
|
|
13
|
+
"FOLDER_UNAVAILABLE": "Dieser Arbeitsbereichsordner ist nicht verfügbar: {detail}",
|
|
14
|
+
"UNKNOWN_BACKEND": "unbekannt",
|
|
15
|
+
"DND_CROSS_CONNECTION_CONFIRM": "{count} Element(e) von \"{srcBackend}\" nach \"{destBackend}\" kopieren?",
|
|
16
|
+
"DROP_UPLOAD_TASK": "Abgelegte Dateien werden hochgeladen",
|
|
17
|
+
"DROP_SCANNING": "Wird durchsucht... {count} Datei(en) gefunden",
|
|
18
|
+
"DROP_COPY_TASK": "Abgelegte Elemente werden kopiert"
|
|
14
19
|
}
|
|
@@ -10,5 +10,10 @@
|
|
|
10
10
|
"DROP_FILES_HERE": "📁 Drop files here",
|
|
11
11
|
"OPEN_WITH": "Open with...",
|
|
12
12
|
"FOLDER_LOAD_FAILED": "Failed to load folder: {detail}",
|
|
13
|
-
"FOLDER_UNAVAILABLE": "This workspace folder is unavailable: {detail}"
|
|
13
|
+
"FOLDER_UNAVAILABLE": "This workspace folder is unavailable: {detail}",
|
|
14
|
+
"UNKNOWN_BACKEND": "unknown",
|
|
15
|
+
"DND_CROSS_CONNECTION_CONFIRM": "Copy {count} item(s) from \"{srcBackend}\" to \"{destBackend}\"?",
|
|
16
|
+
"DROP_UPLOAD_TASK": "Uploading dropped files",
|
|
17
|
+
"DROP_SCANNING": "Scanning... {count} file(s) found",
|
|
18
|
+
"DROP_COPY_TASK": "Copying dropped items"
|
|
14
19
|
}
|
|
@@ -25,6 +25,7 @@ import { icon } from '../core/icon-utils';
|
|
|
25
25
|
import { renderDropdownItem, renderDropdownSubmenu } from '../core/dropdown-item';
|
|
26
26
|
import { i18n } from '../core/i18n';
|
|
27
27
|
import { createLogger } from '../core/logger';
|
|
28
|
+
import { taskService, type ProgressMonitor } from '../core/taskservice';
|
|
28
29
|
|
|
29
30
|
const logger = createLogger('DocksFileBrowser');
|
|
30
31
|
const t = await i18n(import.meta.glob('./filebrowser*.json'));
|
|
@@ -34,6 +35,94 @@ const WORKSPACE_CHANGED_DEBOUNCE_MS = 250;
|
|
|
34
35
|
/** `wa-tree-item` exposes `.model` for the bound {@link TreeNode} (not in generated element types). */
|
|
35
36
|
type WaTreeItemElement = HTMLElement & { model?: TreeNode };
|
|
36
37
|
|
|
38
|
+
type DroppedUpload = {
|
|
39
|
+
relativePath: string;
|
|
40
|
+
file: globalThis.File;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
function readFileEntry(entry: FileSystemFileEntry): Promise<globalThis.File> {
|
|
44
|
+
return new Promise((resolve, reject) => entry.file(resolve, reject));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** `readEntries` returns at most 100 entries and must be called until an empty batch. */
|
|
48
|
+
function readAllDirectoryEntries(reader: FileSystemDirectoryReader): Promise<FileSystemEntry[]> {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const all: FileSystemEntry[] = [];
|
|
51
|
+
const readBatch = () => {
|
|
52
|
+
reader.readEntries(batch => {
|
|
53
|
+
if (batch.length === 0) {
|
|
54
|
+
resolve(all);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
all.push(...batch);
|
|
58
|
+
readBatch();
|
|
59
|
+
}, reject);
|
|
60
|
+
};
|
|
61
|
+
readBatch();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
type DroppedFileFound = (count: number) => void;
|
|
66
|
+
|
|
67
|
+
async function appendDroppedEntry(
|
|
68
|
+
entry: FileSystemEntry,
|
|
69
|
+
uploads: DroppedUpload[],
|
|
70
|
+
onFileFound?: DroppedFileFound,
|
|
71
|
+
parentPath = ''
|
|
72
|
+
): Promise<void> {
|
|
73
|
+
const relativePath = parentPath ? `${parentPath}/${entry.name}` : entry.name;
|
|
74
|
+
|
|
75
|
+
if (entry.isFile) {
|
|
76
|
+
try {
|
|
77
|
+
uploads.push({ relativePath, file: await readFileEntry(entry as FileSystemFileEntry) });
|
|
78
|
+
onFileFound?.(uploads.length);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
logger.error(`Failed to read dropped file "${relativePath}":`, error);
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (!entry.isDirectory) return;
|
|
86
|
+
|
|
87
|
+
let children: FileSystemEntry[];
|
|
88
|
+
try {
|
|
89
|
+
children = await readAllDirectoryEntries((entry as FileSystemDirectoryEntry).createReader());
|
|
90
|
+
} catch (error) {
|
|
91
|
+
logger.error(`Failed to read dropped folder "${relativePath}":`, error);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
for (const child of children) {
|
|
96
|
+
await appendDroppedEntry(child, uploads, onFileFound, relativePath);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Folder structure is only exposed through `webkitGetAsEntry()`; `dataTransfer.files` lists a dropped
|
|
102
|
+
* folder as a single unreadable file. Entries must be captured before the first `await`, because the
|
|
103
|
+
* drag data store becomes inaccessible once the drop handler yields.
|
|
104
|
+
*/
|
|
105
|
+
export async function collectDroppedUploads(
|
|
106
|
+
dataTransfer: DataTransfer,
|
|
107
|
+
onFileFound?: DroppedFileFound
|
|
108
|
+
): Promise<DroppedUpload[]> {
|
|
109
|
+
const entries = Array.from(dataTransfer.items ?? [])
|
|
110
|
+
.filter(item => item.kind === 'file')
|
|
111
|
+
.map(item => item.webkitGetAsEntry?.() ?? null)
|
|
112
|
+
.filter((entry): entry is FileSystemEntry => entry !== null);
|
|
113
|
+
const files = Array.from(dataTransfer.files ?? []);
|
|
114
|
+
|
|
115
|
+
if (entries.length === 0) {
|
|
116
|
+
return files.map(file => ({ relativePath: file.webkitRelativePath || file.name, file }));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const uploads: DroppedUpload[] = [];
|
|
120
|
+
for (const entry of entries) {
|
|
121
|
+
await appendDroppedEntry(entry, uploads, onFileFound);
|
|
122
|
+
}
|
|
123
|
+
return uploads;
|
|
124
|
+
}
|
|
125
|
+
|
|
37
126
|
@customElement('docks-filebrowser')
|
|
38
127
|
export class DocksFileBrowser extends DocksPart {
|
|
39
128
|
|
|
@@ -648,15 +737,19 @@ export class DocksFileBrowser extends DocksPart {
|
|
|
648
737
|
const types = e.dataTransfer.types;
|
|
649
738
|
|
|
650
739
|
if (types.includes('Files')) {
|
|
651
|
-
const
|
|
652
|
-
|
|
653
|
-
|
|
740
|
+
const dataTransfer = e.dataTransfer;
|
|
741
|
+
await taskService.runAsync(t.DROP_UPLOAD_TASK, async progress => {
|
|
742
|
+
const uploads = await collectDroppedUploads(dataTransfer, count => {
|
|
743
|
+
progress.message = t.DROP_SCANNING({ count: String(count) });
|
|
744
|
+
});
|
|
745
|
+
if (uploads.length === 0) return;
|
|
746
|
+
await this.handleFilesDrop(uploads, targetDir, progress);
|
|
747
|
+
});
|
|
654
748
|
return;
|
|
655
749
|
}
|
|
656
750
|
|
|
657
751
|
if (types.includes('application/x-workspace-file')) {
|
|
658
752
|
await this.handleWorkspaceDrop(e, targetDir);
|
|
659
|
-
return;
|
|
660
753
|
}
|
|
661
754
|
};
|
|
662
755
|
|
|
@@ -767,16 +860,19 @@ export class DocksFileBrowser extends DocksPart {
|
|
|
767
860
|
}
|
|
768
861
|
}
|
|
769
862
|
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
863
|
+
await taskService.runAsync(t.DROP_COPY_TASK, async progress => {
|
|
864
|
+
const onFile = (targetPath: string) => { progress.message = targetPath; };
|
|
865
|
+
for (const { path, resource } of sources) {
|
|
866
|
+
try {
|
|
867
|
+
const move = await moveWithinSameBackend(resource);
|
|
868
|
+
await workspaceService.copyResource(resource, targetDir, { move, onFile });
|
|
869
|
+
processed++;
|
|
870
|
+
} catch (error) {
|
|
871
|
+
logger.error(`Failed to handle workspace drop for "${path}":`, error);
|
|
872
|
+
failed++;
|
|
873
|
+
}
|
|
778
874
|
}
|
|
779
|
-
}
|
|
875
|
+
});
|
|
780
876
|
|
|
781
877
|
logger.info(
|
|
782
878
|
`Workspace drop completed: ${processed}/${sources.length} items ${failed > 0 ? `, ${failed} failed` : ''}`
|
|
@@ -785,27 +881,28 @@ export class DocksFileBrowser extends DocksPart {
|
|
|
785
881
|
await this.loadWorkspace(this.workspaceDir, true);
|
|
786
882
|
}
|
|
787
883
|
|
|
788
|
-
private async handleFilesDrop(
|
|
789
|
-
const total =
|
|
884
|
+
private async handleFilesDrop(uploads: DroppedUpload[], targetDir: Directory, progress: ProgressMonitor) {
|
|
885
|
+
const total = uploads.length;
|
|
790
886
|
let processed = 0;
|
|
791
887
|
let failed = 0;
|
|
792
888
|
let skipped = 0;
|
|
793
889
|
|
|
794
|
-
|
|
890
|
+
progress.totalSteps = total;
|
|
891
|
+
for (const [index, { relativePath, file }] of uploads.entries()) {
|
|
892
|
+
progress.currentStep = index + 1;
|
|
893
|
+
progress.message = relativePath;
|
|
795
894
|
try {
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
const existingFile = await this.workspaceDir!.getResource(targetPath);
|
|
895
|
+
const existingFile = await targetDir.getResource(relativePath);
|
|
799
896
|
if (existingFile) {
|
|
800
|
-
const overwrite = await confirmDialog(t.FILE_EXISTS_OVERWRITE({ fileName:
|
|
897
|
+
const overwrite = await confirmDialog(t.FILE_EXISTS_OVERWRITE({ fileName: relativePath }));
|
|
801
898
|
if (!overwrite) {
|
|
802
899
|
skipped++;
|
|
803
900
|
continue;
|
|
804
901
|
}
|
|
805
902
|
}
|
|
806
903
|
|
|
807
|
-
const workspaceFile = await
|
|
808
|
-
|
|
904
|
+
const workspaceFile = await targetDir.getResource(
|
|
905
|
+
relativePath,
|
|
809
906
|
{ create: true }
|
|
810
907
|
) as File;
|
|
811
908
|
|
|
@@ -813,7 +910,7 @@ export class DocksFileBrowser extends DocksPart {
|
|
|
813
910
|
|
|
814
911
|
processed++;
|
|
815
912
|
} catch (error) {
|
|
816
|
-
logger.error(`Failed to upload ${
|
|
913
|
+
logger.error(`Failed to upload ${relativePath}:`, error);
|
|
817
914
|
failed++;
|
|
818
915
|
}
|
|
819
916
|
}
|
|
@@ -823,11 +920,6 @@ export class DocksFileBrowser extends DocksPart {
|
|
|
823
920
|
await this.loadWorkspace(this.workspaceDir);
|
|
824
921
|
}
|
|
825
922
|
|
|
826
|
-
private buildTargetPath(targetDir: Directory, fileName: string): string {
|
|
827
|
-
const dirPath = targetDir.getWorkspacePath();
|
|
828
|
-
return dirPath ? `${dirPath}/${fileName}` : fileName;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
923
|
protected renderContent() {
|
|
832
924
|
return html`
|
|
833
925
|
<div class="tree" ${ref(this.treeRef)} style="--drop-files-text: '${t.DROP_FILES_HERE}'">
|
package/src/components/tasks.ts
CHANGED
|
@@ -19,6 +19,19 @@ contributionRegistry.registerContribution(TOOLBAR_BOTTOM_CENTER, {
|
|
|
19
19
|
// Singleton dialog container for progress dialog
|
|
20
20
|
let progressDialogContainer: HTMLElement | null = null;
|
|
21
21
|
|
|
22
|
+
/** Percentage (0-100) of a task, or `undefined` when its progress is indefinite. */
|
|
23
|
+
function taskPercent(task: ProgressMonitor): number | undefined {
|
|
24
|
+
if (task.progress >= 0) return task.progress;
|
|
25
|
+
if (task.totalSteps > 0) return Math.round((task.currentStep / task.totalSteps) * 100);
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function renderProgressBar(task: ProgressMonitor | undefined, label = '') {
|
|
30
|
+
const percent = task && taskPercent(task);
|
|
31
|
+
if (percent === undefined) return html`<wa-progress-bar indeterminate></wa-progress-bar>`;
|
|
32
|
+
return html`<wa-progress-bar value="${percent}">${label}</wa-progress-bar>`;
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
function getProgressDialogContainer(): HTMLElement {
|
|
23
36
|
if (!progressDialogContainer) {
|
|
24
37
|
progressDialogContainer = document.createElement('div');
|
|
@@ -153,14 +166,8 @@ function updateProgressDialog(forceOpen = false) {
|
|
|
153
166
|
|
|
154
167
|
<div class="progress-dialog-content">
|
|
155
168
|
${tasks.map((taskProgress: ProgressMonitor) => {
|
|
156
|
-
const hasProgress = taskProgress.progress >= 0 || taskProgress.totalSteps > 0
|
|
157
|
-
const progress = taskProgress.progress >= 0
|
|
158
|
-
? taskProgress.progress
|
|
159
|
-
: (taskProgress.totalSteps > 0
|
|
160
|
-
? Math.round((taskProgress.currentStep / taskProgress.totalSteps) * 100)
|
|
161
|
-
: 0)
|
|
162
|
-
|
|
163
169
|
const showSteps = taskProgress.progress < 0 && taskProgress.totalSteps > 0
|
|
170
|
+
const steps = showSteps ? `${taskProgress.currentStep}/${taskProgress.totalSteps} - ` : ''
|
|
164
171
|
|
|
165
172
|
return html`
|
|
166
173
|
<div class="tasitem">
|
|
@@ -174,13 +181,7 @@ function updateProgressDialog(forceOpen = false) {
|
|
|
174
181
|
</div>
|
|
175
182
|
</div>
|
|
176
183
|
<div class="tasprogress">
|
|
177
|
-
${
|
|
178
|
-
<wa-progress-bar value="${progress}">
|
|
179
|
-
${showSteps ? `${taskProgress.currentStep}/${taskProgress.totalSteps} - ` : ''}${progress}%
|
|
180
|
-
</wa-progress-bar>
|
|
181
|
-
` : html`
|
|
182
|
-
<wa-progress-bar indeterminate></wa-progress-bar>
|
|
183
|
-
`}
|
|
184
|
+
${renderProgressBar(taskProgress, `${steps}${taskPercent(taskProgress)}%`)}
|
|
184
185
|
</div>
|
|
185
186
|
</div>
|
|
186
187
|
`
|
|
@@ -264,7 +265,7 @@ export class DocksTasks extends DocksElement {
|
|
|
264
265
|
label="${t.ACTIVE_TASKS}"
|
|
265
266
|
></wa-spinner>
|
|
266
267
|
<wa-badge appearance="outlined" variant="neutral" pill>${taskCount}</wa-badge>
|
|
267
|
-
<div class="tasbar-wrap"
|
|
268
|
+
<div class="tasbar-wrap">${renderProgressBar(taskCount === 1 ? tasks[0] : undefined)}</div>
|
|
268
269
|
</div>
|
|
269
270
|
`;
|
|
270
271
|
}
|
|
@@ -169,6 +169,15 @@ class ContributionRegistry {
|
|
|
169
169
|
}
|
|
170
170
|
return this.contributions.get(target)!;
|
|
171
171
|
}
|
|
172
|
+
|
|
173
|
+
unregisterContribution(target: string, name: string): void {
|
|
174
|
+
const slot = this.contributions.get(target);
|
|
175
|
+
if (!slot) return;
|
|
176
|
+
const next = slot.filter(contribution => contribution.name !== name);
|
|
177
|
+
if (next.length === slot.length) return;
|
|
178
|
+
this.contributions.set(target, next);
|
|
179
|
+
publish(TOPIC_CONTRIBUTEIONS_CHANGED, { target, contributions: this.getContributions(target) } as ContributionChangeEvent);
|
|
180
|
+
}
|
|
172
181
|
}
|
|
173
182
|
|
|
174
183
|
export const contributionRegistry = new ContributionRegistry()
|
|
@@ -784,7 +784,7 @@ export class WorkspaceService {
|
|
|
784
784
|
public async copyResource(
|
|
785
785
|
src: Resource,
|
|
786
786
|
destDir: Directory,
|
|
787
|
-
options?: { move?: boolean; newName?: string }
|
|
787
|
+
options?: { move?: boolean; newName?: string; onFile?: (targetPath: string) => void }
|
|
788
788
|
): Promise<void> {
|
|
789
789
|
await this.initPromise;
|
|
790
790
|
const workspace = this._currentWorkspace;
|
|
@@ -797,6 +797,7 @@ export class WorkspaceService {
|
|
|
797
797
|
const targetBasePath = destDirPath ? `${destDirPath}/${targetName}` : targetName;
|
|
798
798
|
|
|
799
799
|
const copyFileToPath = async (file: File, targetPath: string): Promise<void> => {
|
|
800
|
+
options?.onFile?.(targetPath);
|
|
800
801
|
const contents = await file.getContents({ blob: true });
|
|
801
802
|
const targetFile = await workspace.getResource(targetPath, { create: true }) as File | null;
|
|
802
803
|
if (!targetFile) {
|
package/src/parts/part.ts
CHANGED
package/src/parts/toolbar.ts
CHANGED
|
@@ -257,18 +257,38 @@ export class DocksToolbar extends DocksElement {
|
|
|
257
257
|
:host {
|
|
258
258
|
display: flex;
|
|
259
259
|
flex-direction: row;
|
|
260
|
+
min-width: 0;
|
|
261
|
+
max-width: 100%;
|
|
262
|
+
overflow: hidden;
|
|
260
263
|
--wa-form-control-padding-inline: var(--wa-space-2xs);
|
|
261
264
|
}
|
|
262
265
|
|
|
263
266
|
:host([orientation="vertical"]) {
|
|
264
267
|
flex-direction: column;
|
|
268
|
+
min-height: 0;
|
|
269
|
+
max-height: 100%;
|
|
265
270
|
}
|
|
266
271
|
|
|
267
272
|
.toolbar-items {
|
|
268
273
|
display: flex;
|
|
269
274
|
flex: 1;
|
|
275
|
+
min-width: 0;
|
|
276
|
+
max-width: 100%;
|
|
277
|
+
overflow: hidden;
|
|
270
278
|
gap: var(--wa-space-2xs);
|
|
271
279
|
}
|
|
280
|
+
|
|
281
|
+
/* Part-provided labels that should yield space to action buttons. */
|
|
282
|
+
.toolbar-title {
|
|
283
|
+
flex: 1 1 0;
|
|
284
|
+
min-width: 0;
|
|
285
|
+
overflow: hidden;
|
|
286
|
+
text-overflow: ellipsis;
|
|
287
|
+
white-space: nowrap;
|
|
288
|
+
font-size: 0.875rem;
|
|
289
|
+
font-weight: 500;
|
|
290
|
+
padding: 0 0.25rem;
|
|
291
|
+
}
|
|
272
292
|
`
|
|
273
293
|
}
|
|
274
294
|
|