@eclipse-docks/core 0.7.113 → 0.7.118
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/services.d.ts +1 -1
- package/dist/api/services.d.ts.map +1 -1
- package/dist/{api-BWhUdgQ_.js → api-N5AbUtyH.js} +299 -190
- package/dist/api-N5AbUtyH.js.map +1 -0
- package/dist/components/attribution.d.ts +14 -0
- package/dist/components/attribution.d.ts.map +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/npm-packages.d.ts +11 -0
- package/dist/components/npm-packages.d.ts.map +1 -0
- package/dist/components/release-history.d.ts +19 -0
- package/dist/components/release-history.d.ts.map +1 -0
- package/dist/core/constants.d.ts +1 -15
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/contribution-names.d.ts +28 -0
- package/dist/core/contribution-names.d.ts.map +1 -0
- package/dist/core/contribution-targets.d.ts +20 -0
- package/dist/core/contribution-targets.d.ts.map +1 -0
- package/dist/core/contributionregistry.d.ts +5 -0
- package/dist/core/contributionregistry.d.ts.map +1 -1
- package/dist/core/ui-ids.d.ts +1 -23
- package/dist/core/ui-ids.d.ts.map +1 -1
- package/dist/dialogs/index.d.ts +1 -0
- package/dist/dialogs/index.d.ts.map +1 -1
- package/dist/dialogs/version-info-dialog.d.ts +14 -0
- package/dist/dialogs/version-info-dialog.d.ts.map +1 -0
- package/dist/index.js +4 -4
- package/dist/parts/index.js +1 -1
- package/dist/parts/tabs.d.ts.map +1 -1
- package/dist/{parts-D1n2XZVE.js → parts-BvITdiV3.js} +83 -18
- package/dist/parts-BvITdiV3.js.map +1 -0
- package/dist/{widget-DbolQH0C.js → widget-DFbJNLqB.js} +2 -1
- package/dist/widget-DFbJNLqB.js.map +1 -0
- package/dist/widgets/index.js +1 -1
- package/dist/{widgets-SScpQQr9.js → widgets-CuO5lmjL.js} +2 -2
- package/dist/{widgets-SScpQQr9.js.map → widgets-CuO5lmjL.js.map} +1 -1
- package/package.json +1 -1
- package/src/api/services.ts +1 -0
- package/src/commands/global.ts +2 -2
- package/src/commands/open-view-as-editor.ts +1 -1
- package/src/commands/version-info.ts +10 -219
- package/src/components/attribution.ts +93 -0
- package/src/components/index.ts +4 -1
- package/src/components/npm-packages.ts +53 -0
- package/src/components/part-name.ts +2 -2
- package/src/components/release-history.ts +177 -0
- package/src/components/tasks.ts +2 -2
- package/src/contributions/default-layout-contributions.ts +1 -1
- package/src/contributions/default-ui-contributions.ts +49 -2
- package/src/core/apploader.ts +1 -1
- package/src/core/constants.ts +2 -22
- package/src/core/contribution-names.ts +34 -0
- package/src/core/contribution-targets.ts +24 -0
- package/src/core/contributionregistry.ts +6 -0
- package/src/core/editorregistry.ts +1 -1
- package/src/core/ui-ids.ts +1 -29
- package/src/dialogs/index.ts +2 -1
- package/src/dialogs/version-info-dialog.ts +82 -0
- package/src/layouts/standard-layout.ts +1 -1
- package/src/parts/tabs.ts +2 -1
- package/dist/api-BWhUdgQ_.js.map +0 -1
- package/dist/parts-D1n2XZVE.js.map +0 -1
- package/dist/widget-DbolQH0C.js.map +0 -1
|
@@ -193,6 +193,7 @@ var ContributionRegistry = class {
|
|
|
193
193
|
const typedList = list;
|
|
194
194
|
for (const contribution of typedList) if (contributionTargetMappingRegistry.getEffectiveTargets(originalTarget, contribution).includes(target)) results.push(contribution);
|
|
195
195
|
}
|
|
196
|
+
results.sort((a, b) => (b.ranking ?? 0) - (a.ranking ?? 0));
|
|
196
197
|
if (results.length === 0) this.getOrCreateSlot(target);
|
|
197
198
|
return results;
|
|
198
199
|
}
|
|
@@ -452,4 +453,4 @@ var DocksWidget = class extends DocksWidgetBase {
|
|
|
452
453
|
//#endregion
|
|
453
454
|
export { toastError as C, overrideContributionTargets as S, toastWarning as T, getContributionDisabled as _, TOPIC_COMMAND_REGISTERED as a, contributionTargetMappingRegistry 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, toastInfo as w, listContributionNameRemaps as x, applyConfigNameRemaps as y };
|
|
454
455
|
|
|
455
|
-
//# sourceMappingURL=widget-
|
|
456
|
+
//# sourceMappingURL=widget-DFbJNLqB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-DFbJNLqB.js","names":[],"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 Toastify from 'toastify-js';\nimport 'toastify-js/src/toastify.css';\nimport { createLogger } from './logger';\n\nconst logger = createLogger('Toast');\n\nconst DURATION = 4000;\nconst BASE = { duration: DURATION, gravity: 'bottom' as const, position: 'right' as const, close: true };\n\nconst show = (msg: string, style: { background: string; color: string }) => {\n Toastify({ ...BASE, text: msg, style }).showToast();\n};\n\nexport const toastInfo = (msg: string) => {\n logger.info(msg);\n show(msg, { background: 'var(--wa-color-brand-50)', color: 'var(--wa-color-brand-on)' });\n};\n\nexport const toastError = (msg: string) => {\n logger.error(msg);\n show(msg, { background: 'var(--wa-color-danger-50)', color: 'var(--wa-color-danger-on)' });\n};\n\nexport const toastWarning = (msg: string) => {\n logger.warn(msg);\n show(msg, { background: 'var(--wa-color-warning-50)', color: 'var(--wa-color-warning-on)' });\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\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 const disabled = contribution.disabled as Signal.Computed<boolean> | undefined;\n if (!disabled) return false;\n return disabled.get() === true;\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\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, Contribution, 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?: Contribution\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":";;;;;;;AAIA,IAAM,SAAS,aAAa,QAAQ;AAGpC,IAAM,OAAO;CAAE,UADE;CACkB,SAAS;CAAmB,UAAU;CAAkB,OAAO;CAAM;AAExG,IAAM,QAAQ,KAAa,UAAiD;AAC1E,UAAS;EAAE,GAAG;EAAM,MAAM;EAAK;EAAO,CAAC,CAAC,WAAW;;AAGrD,IAAa,aAAa,QAAgB;AACxC,QAAO,KAAK,IAAI;AAChB,MAAK,KAAK;EAAE,YAAY;EAA4B,OAAO;EAA4B,CAAC;;AAG1F,IAAa,cAAc,QAAgB;AACzC,QAAO,MAAM,IAAI;AACjB,MAAK,KAAK;EAAE,YAAY;EAA6B,OAAO;EAA6B,CAAC;;AAG5F,IAAa,gBAAg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1
|
+
import { t as DocksWidget } from "./widget-DFbJNLqB.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-CuO5lmjL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widgets-
|
|
1
|
+
{"version":3,"file":"widgets-CuO5lmjL.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,IAAA,iBAAA,MAAM,uBAAuB,YAAY;;;iBAElB;cAGH;;CAEvB,SAAS;AACL,SAAO,IAAI;;;oCAGiB,KAAK,KAAK;;2CAEH,KAAK,QAAQ;;;;;gBAKpC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAjBlB,UAAU,CAAA,EAAA,eAAA,WAAA,WAAA,KAAA,EAAA;WAGV,UAAU,CAAA,EAAA,eAAA,WAAA,QAAA,KAAA,EAAA;4BALd,cAAc,mBAAmB,CAAA,EAAA,eAAA"}
|
package/package.json
CHANGED
package/src/api/services.ts
CHANGED
package/src/commands/global.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { registerAll } from "../core/commandregistry";
|
|
2
2
|
import { CommandContribution } from "../core/contributionregistry";
|
|
3
|
-
import { TOOLBAR_MAIN_RIGHT } from "../core/
|
|
4
|
-
import { TOOLBAR_FULLSCREEN, TOOLBAR_THEME_SWITCHER } from "../core/
|
|
3
|
+
import { TOOLBAR_MAIN_RIGHT } from "../core/contribution-targets";
|
|
4
|
+
import { TOOLBAR_FULLSCREEN, TOOLBAR_THEME_SWITCHER } from "../core/contribution-names";
|
|
5
5
|
import { EditorInput, editorRegistry } from "../core/editorregistry";
|
|
6
6
|
import { html } from "lit";
|
|
7
7
|
import { toastError, toastInfo } from "../core/toast";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { registerAll } from "../core/commandregistry";
|
|
2
|
-
import { SYSTEM_VIEWS } from "../core/
|
|
2
|
+
import { SYSTEM_VIEWS } from "../core/contribution-targets";
|
|
3
3
|
import type { TabContribution } from "../core/contributionregistry";
|
|
4
4
|
import { contributionRegistry } from "../core/contributionregistry";
|
|
5
5
|
import { editorRegistry } from "../core/editorregistry";
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import { registerAll } from "../core/commandregistry";
|
|
2
|
-
import { html, render, type TemplateResult } from "lit";
|
|
3
|
-
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
4
|
-
import { marked } from "marked";
|
|
5
2
|
import { toastError } from "../core/toast";
|
|
6
|
-
import { appLoaderService
|
|
7
|
-
|
|
8
|
-
/** Compare semver strings whether GitHub uses a leading "v" (e.g. v0.7.83) or package.json does not. */
|
|
9
|
-
function semverEqual(a: string, b: string): boolean {
|
|
10
|
-
return a.replace(/^v/i, '') === b.replace(/^v/i, '');
|
|
11
|
-
}
|
|
3
|
+
import { appLoaderService } from "../core/apploader";
|
|
4
|
+
import { versionInfoDialog } from "../dialogs/version-info-dialog";
|
|
12
5
|
|
|
13
6
|
registerAll({
|
|
14
7
|
command: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
id: "show_version_info",
|
|
9
|
+
name: "Show Version Info",
|
|
10
|
+
description: "Shows application version information",
|
|
11
|
+
parameters: [],
|
|
19
12
|
},
|
|
20
13
|
handler: {
|
|
21
14
|
execute: async _context => {
|
|
@@ -25,209 +18,7 @@ registerAll({
|
|
|
25
18
|
return;
|
|
26
19
|
}
|
|
27
20
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<wa-tree style="--indent-guide-width: 1px;">
|
|
33
|
-
<wa-tree-item expanded>
|
|
34
|
-
<span>${app.name ?? ''}</span>
|
|
35
|
-
${Object.entries(deps).map(([name, version]) => html`
|
|
36
|
-
<wa-tree-item>
|
|
37
|
-
<span>${name} <small>${version}</small></span>
|
|
38
|
-
</wa-tree-item>
|
|
39
|
-
`)}
|
|
40
|
-
</wa-tree-item>
|
|
41
|
-
</wa-tree>
|
|
42
|
-
`
|
|
43
|
-
: html``;
|
|
44
|
-
|
|
45
|
-
let dialogContainer: HTMLElement | null = null;
|
|
46
|
-
const getDialogContainer = (): HTMLElement => {
|
|
47
|
-
if (!dialogContainer) {
|
|
48
|
-
dialogContainer = document.getElementById('global-dialog-container') || document.createElement('div');
|
|
49
|
-
if (!dialogContainer.id) {
|
|
50
|
-
dialogContainer.id = 'global-dialog-container';
|
|
51
|
-
document.body.appendChild(dialogContainer);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return dialogContainer;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const cleanup = () => {
|
|
58
|
-
if (dialogContainer) {
|
|
59
|
-
render(html``, dialogContainer);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const renderReleaseContent = (releaseContent: string) => {
|
|
64
|
-
const htmlContent = marked.parse(releaseContent, { async: false }) as string;
|
|
65
|
-
return html`${unsafeHTML(htmlContent)}`;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
let releases: ReleaseEntry[] = [];
|
|
69
|
-
if (app.releaseHistory) {
|
|
70
|
-
if (typeof app.releaseHistory === 'function') {
|
|
71
|
-
try {
|
|
72
|
-
releases = await app.releaseHistory();
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.error('Failed to load release history from app:', error);
|
|
75
|
-
releases = [];
|
|
76
|
-
}
|
|
77
|
-
} else {
|
|
78
|
-
releases = app.releaseHistory;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const appVersion = app.version ?? '0.0.0';
|
|
83
|
-
const isDev = appVersion === '0.0.0';
|
|
84
|
-
const currentIndex = releases.length > 0 ? releases.findIndex(r => semverEqual(r.tag_name, appVersion)) : -1;
|
|
85
|
-
const startIndex = currentIndex >= 0 ? currentIndex : 0;
|
|
86
|
-
let currentReleaseIndex = startIndex;
|
|
87
|
-
|
|
88
|
-
const buildReleaseContent = (index: number) => {
|
|
89
|
-
if (releases.length === 0) {
|
|
90
|
-
return "";
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const release = releases[index];
|
|
94
|
-
const isCurrentVersion = semverEqual(release.tag_name, appVersion);
|
|
95
|
-
|
|
96
|
-
let message = `**Version:** ${release.tag_name}`;
|
|
97
|
-
if (isCurrentVersion) {
|
|
98
|
-
message += ` (Current)`;
|
|
99
|
-
}
|
|
100
|
-
message += `\n\n`;
|
|
101
|
-
|
|
102
|
-
const publishDate = new Date(release.published_at).toLocaleDateString();
|
|
103
|
-
message += `**Released:** ${publishDate}\n\n`;
|
|
104
|
-
|
|
105
|
-
if (!isCurrentVersion) {
|
|
106
|
-
const cleanCurrent = appVersion.replace(/^v/, '');
|
|
107
|
-
const cleanRelease = release.tag_name.replace(/^v/, '');
|
|
108
|
-
const currentParts = cleanCurrent.split('.').map(Number);
|
|
109
|
-
const releaseParts = cleanRelease.split('.').map(Number);
|
|
110
|
-
let isNewer = false;
|
|
111
|
-
for (let i = 0; i < Math.max(currentParts.length, releaseParts.length); i++) {
|
|
112
|
-
const current = currentParts[i] || 0;
|
|
113
|
-
const releasePart = releaseParts[i] || 0;
|
|
114
|
-
if (releasePart > current) {
|
|
115
|
-
isNewer = true;
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
if (releasePart < current) {
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (isNewer) {
|
|
123
|
-
message += `⚠️ **Update available - reload page to update**\n\n`;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (release.body) {
|
|
128
|
-
message += `---\n\n${release.body}`;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return message;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const handleClose = () => {
|
|
135
|
-
cleanup();
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const handleAfterHide = () => {
|
|
139
|
-
cleanup();
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const updateDialog = (index: number) => {
|
|
143
|
-
const releaseContent = buildReleaseContent(index);
|
|
144
|
-
const hasNavigation = releases.length > 0;
|
|
145
|
-
|
|
146
|
-
const template = html`
|
|
147
|
-
<wa-dialog
|
|
148
|
-
label="About ${app.name ?? ''} - ${appVersion}"
|
|
149
|
-
open
|
|
150
|
-
light-dismiss
|
|
151
|
-
style="--width: 600px;"
|
|
152
|
-
@wa-request-close=${handleClose}
|
|
153
|
-
@wa-after-hide=${handleAfterHide}
|
|
154
|
-
>
|
|
155
|
-
<style>
|
|
156
|
-
.dialog-content {
|
|
157
|
-
height: 600px;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
wa-tree-item > span small {
|
|
161
|
-
color: var(--wa-color-neutral-60);
|
|
162
|
-
font-size: 0.875em;
|
|
163
|
-
margin-left: 0.5rem;
|
|
164
|
-
}
|
|
165
|
-
</style>
|
|
166
|
-
<small>${app.description ?? ''}</small>
|
|
167
|
-
<div class="dialog-content">
|
|
168
|
-
<wa-tab-group>
|
|
169
|
-
${releases.length > 0 ? html`
|
|
170
|
-
<wa-tab slot="nav" panel="release">Release History</wa-tab>
|
|
171
|
-
<wa-tab-panel name="release">
|
|
172
|
-
${renderReleaseContent(releaseContent)}
|
|
173
|
-
</wa-tab-panel>
|
|
174
|
-
` : ''}
|
|
175
|
-
|
|
176
|
-
${hasPackages ? html`
|
|
177
|
-
<wa-tab slot="nav" panel="packages">NPM Packages</wa-tab>
|
|
178
|
-
<wa-tab-panel name="packages">
|
|
179
|
-
${packagesTree}
|
|
180
|
-
</wa-tab-panel>
|
|
181
|
-
` : ''}
|
|
182
|
-
</wa-tab-group>
|
|
183
|
-
</div>
|
|
184
|
-
<div slot="footer">
|
|
185
|
-
${hasNavigation ? html`
|
|
186
|
-
<wa-button
|
|
187
|
-
variant="default"
|
|
188
|
-
?disabled=${index === releases.length - 1}
|
|
189
|
-
@click=${() => {
|
|
190
|
-
if (index < releases.length - 1) {
|
|
191
|
-
currentReleaseIndex = index + 1;
|
|
192
|
-
updateDialog(currentReleaseIndex);
|
|
193
|
-
}
|
|
194
|
-
}}
|
|
195
|
-
>
|
|
196
|
-
← Previous
|
|
197
|
-
</wa-button>
|
|
198
|
-
<wa-button
|
|
199
|
-
variant="default"
|
|
200
|
-
?disabled=${index === 0}
|
|
201
|
-
@click=${() => {
|
|
202
|
-
if (index > 0) {
|
|
203
|
-
currentReleaseIndex = index - 1;
|
|
204
|
-
updateDialog(currentReleaseIndex);
|
|
205
|
-
}
|
|
206
|
-
}}
|
|
207
|
-
>
|
|
208
|
-
Next →
|
|
209
|
-
</wa-button>
|
|
210
|
-
` : ''}
|
|
211
|
-
<wa-button variant="primary" data-dialog="close">Close</wa-button>
|
|
212
|
-
</div>
|
|
213
|
-
</wa-dialog>
|
|
214
|
-
`;
|
|
215
|
-
render(template, getDialogContainer());
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
updateDialog(startIndex);
|
|
219
|
-
|
|
220
|
-
return new Promise<void>((resolve) => {
|
|
221
|
-
const checkClosed = () => {
|
|
222
|
-
if (!dialogContainer?.querySelector('wa-dialog[open]')) {
|
|
223
|
-
resolve();
|
|
224
|
-
} else {
|
|
225
|
-
setTimeout(checkClosed, 100);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
checkClosed();
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
})
|
|
233
|
-
|
|
21
|
+
await versionInfoDialog();
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { html, css, nothing } from "lit";
|
|
2
|
+
import { customElement, state } from "lit/decorators.js";
|
|
3
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
4
|
+
import { DocksPart } from "../parts/part";
|
|
5
|
+
import {
|
|
6
|
+
contributionRegistry,
|
|
7
|
+
getContributionVisible,
|
|
8
|
+
TOPIC_CONTRIBUTEIONS_CHANGED,
|
|
9
|
+
type ContributionChangeEvent,
|
|
10
|
+
type HTMLContribution,
|
|
11
|
+
} from "../core/contributionregistry";
|
|
12
|
+
import { SYSTEM_ATTRIBUTIONS } from "../core/contribution-targets";
|
|
13
|
+
|
|
14
|
+
function renderHtmlContribution(contribution: HTMLContribution) {
|
|
15
|
+
const contents = contribution.component;
|
|
16
|
+
if (contents instanceof Function) {
|
|
17
|
+
return contents();
|
|
18
|
+
}
|
|
19
|
+
return unsafeHTML(contents);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@customElement("docks-attribution")
|
|
23
|
+
export class DocksAttributionPart extends DocksPart {
|
|
24
|
+
@state()
|
|
25
|
+
private attributions: HTMLContribution[] = [];
|
|
26
|
+
|
|
27
|
+
static styles = [
|
|
28
|
+
css`
|
|
29
|
+
.attributions {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
gap: 1.25rem;
|
|
33
|
+
padding: 0.75rem;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.attribution h3 {
|
|
38
|
+
margin: 0 0 0.5rem;
|
|
39
|
+
font-size: var(--wa-font-size-m);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.attribution p {
|
|
43
|
+
margin: 0 0 0.5rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.attribution p:last-child {
|
|
47
|
+
margin-bottom: 0;
|
|
48
|
+
}
|
|
49
|
+
`,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
protected doBeforeUI() {
|
|
53
|
+
this.loadAttributions();
|
|
54
|
+
this.subscribe(TOPIC_CONTRIBUTEIONS_CHANGED, (event: ContributionChangeEvent) => {
|
|
55
|
+
if (event.target === SYSTEM_ATTRIBUTIONS) {
|
|
56
|
+
this.loadAttributions();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private loadAttributions() {
|
|
62
|
+
this.attributions = contributionRegistry
|
|
63
|
+
.getContributions<HTMLContribution>(SYSTEM_ATTRIBUTIONS)
|
|
64
|
+
.filter((contribution) => "component" in contribution && getContributionVisible(contribution));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
protected renderContent() {
|
|
68
|
+
if (this.attributions.length === 0) {
|
|
69
|
+
return html`<div class="attributions">No attributions to display.</div>`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return html`
|
|
73
|
+
<div class="attributions">
|
|
74
|
+
${this.attributions.map(
|
|
75
|
+
(contribution) => html`
|
|
76
|
+
<section class="attribution">
|
|
77
|
+
${contribution.label
|
|
78
|
+
? html`<h3>${contribution.label}</h3>`
|
|
79
|
+
: nothing}
|
|
80
|
+
${renderHtmlContribution(contribution)}
|
|
81
|
+
</section>
|
|
82
|
+
`,
|
|
83
|
+
)}
|
|
84
|
+
</div>
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
declare global {
|
|
90
|
+
interface HTMLElementTagNameMap {
|
|
91
|
+
"docks-attribution": DocksAttributionPart;
|
|
92
|
+
}
|
|
93
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { html, css } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
import { DocksPart } from "../parts/part";
|
|
4
|
+
import { appLoaderService } from "../core/apploader";
|
|
5
|
+
|
|
6
|
+
@customElement("docks-npm-packages")
|
|
7
|
+
export class DocksNpmPackages extends DocksPart {
|
|
8
|
+
static styles = [
|
|
9
|
+
css`
|
|
10
|
+
.packages-panel {
|
|
11
|
+
padding: 0.75rem;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
wa-tree-item > span small {
|
|
16
|
+
color: var(--wa-color-neutral-60);
|
|
17
|
+
font-size: 0.875em;
|
|
18
|
+
margin-left: 0.5rem;
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
protected renderContent() {
|
|
24
|
+
const app = appLoaderService.getCurrentApp();
|
|
25
|
+
const entries = Object.entries(app?.dependencies ?? {});
|
|
26
|
+
if (entries.length === 0) {
|
|
27
|
+
return html`<div class="packages-panel">No package information available.</div>`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return html`
|
|
31
|
+
<div class="packages-panel">
|
|
32
|
+
<wa-tree style="--indent-guide-width: 1px;">
|
|
33
|
+
<wa-tree-item expanded>
|
|
34
|
+
<span>${app?.name ?? ""}</span>
|
|
35
|
+
${entries.map(
|
|
36
|
+
([name, version]) => html`
|
|
37
|
+
<wa-tree-item>
|
|
38
|
+
<span>${name} <small>${version}</small></span>
|
|
39
|
+
</wa-tree-item>
|
|
40
|
+
`,
|
|
41
|
+
)}
|
|
42
|
+
</wa-tree-item>
|
|
43
|
+
</wa-tree>
|
|
44
|
+
</div>
|
|
45
|
+
`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare global {
|
|
50
|
+
interface HTMLElementTagNameMap {
|
|
51
|
+
"docks-npm-packages": DocksNpmPackages;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -4,8 +4,8 @@ import {html} from "lit";
|
|
|
4
4
|
import {activePartSignal} from "../core/appstate";
|
|
5
5
|
import {getActivePartDisplayName} from "./document-title";
|
|
6
6
|
import {contributionRegistry} from "../core/contributionregistry";
|
|
7
|
-
import {TOOLBAR_BOTTOM_CENTER} from "../core/
|
|
8
|
-
import {TOOLBAR_ACTIVE_PART_NAME} from "../core/
|
|
7
|
+
import {TOOLBAR_BOTTOM_CENTER} from "../core/contribution-targets";
|
|
8
|
+
import {TOOLBAR_ACTIVE_PART_NAME} from "../core/contribution-names";
|
|
9
9
|
import { icon } from '../core/icon-utils';
|
|
10
10
|
import { i18n } from '../core/i18n';
|
|
11
11
|
|