Compare commits

...

16 Commits

Author SHA1 Message Date
c3444aac01 v3.28.1
Some checks failed
Default (tags) / security (push) Failing after 15s
Default (tags) / test (push) Failing after 16s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-03 01:58:19 +00:00
8e5168d299 fix(appui): adjust layout and spacing in app UI components: fix activity log overflow, contain main content overscroll, and refine secondary menu padding/transition 2026-01-03 01:58:19 +00:00
57b323b53c feat: add interfaces for secondary menu items with various types and functionalities 2026-01-03 01:24:36 +00:00
c41268cd4e v3.28.0
Some checks failed
Default (tags) / security (push) Failing after 17s
Default (tags) / test (push) Failing after 12s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-02 21:40:49 +00:00
30ebc47eda feat(dees-appui): Rename DeesAppuiBase to DeesAppui and migrate related API, exports, demos and docs 2026-01-02 21:40:49 +00:00
3b137c43a8 v3.27.1
Some checks failed
Default (tags) / security (push) Failing after 16s
Default (tags) / test (push) Failing after 12s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-01 21:33:30 +00:00
87fb3d91c3 fix(dees-actionbar): always render actionbar wrapper and delay adding visible class to ensure grid/opacity animations run reliably 2026-01-01 21:33:30 +00:00
8d6bd20321 v3.27.0
Some checks failed
Default (tags) / security (push) Failing after 14s
Default (tags) / test (push) Failing after 15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-01 20:25:05 +00:00
d7f3594dd4 feat(services): introduce DeesServiceLibLoader to lazy-load heavy client libraries from CDN and update components to use it 2026-01-01 20:25:05 +00:00
2a6457e192 v3.26.1
Some checks failed
Default (tags) / security (push) Failing after 15s
Default (tags) / test (push) Failing after 15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-01 19:59:53 +00:00
979e1f7991 fix(dees-actionbar): animate actionbar hide using grid-template-rows and wait for animation before clearing state 2026-01-01 19:59:53 +00:00
bbb57f1b9f update 2026-01-01 18:33:05 +00:00
a218b6a0a1 v3.26.0
Some checks failed
Default (tags) / security (push) Failing after 14s
Default (tags) / test (push) Failing after 15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-01 11:32:01 +00:00
a20d9ff138 feat(workspace): add external file change detection, conflict resolution UI, and diff editor 2026-01-01 11:32:01 +00:00
3a7c2fe781 v3.25.0
Some checks failed
Default (tags) / security (push) Failing after 14s
Default (tags) / test (push) Failing after 15s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-01-01 10:20:22 +00:00
22156d71dc feat(dees-actionbar): add action bar component and improve workspace package update handling 2026-01-01 10:20:22 +00:00
66 changed files with 2951 additions and 363 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

View File

@@ -1,5 +1,66 @@
# Changelog # Changelog
## 2026-01-03 - 3.28.1 - fix(appui)
adjust layout and spacing in app UI components: fix activity log overflow, contain main content overscroll, and refine secondary menu padding/transition
- ts_web/elements/00group-appui/dees-appui-activitylog: removed host max-width, added overflow:hidden and set .maincontainer width to 280px to prevent horizontal overflow
- ts_web/elements/00group-appui/dees-appui-maincontent: added overscroll-behavior: contain to .content-area to prevent scroll chaining/overscroll
- ts_web/elements/00group-appui/dees-appui-secondarymenu: updated .groupHeader padding and hover border behavior, increased group icon size from 14px to 16px, and added margin + transition tweaks to .groupItems for smoother collapse/expand
## 2026-01-02 - 3.28.0 - feat(dees-appui)
Rename DeesAppuiBase to DeesAppui and migrate related API, exports, demos and docs
- Renamed public component/tag and TypeScript types: DeesAppuiBase -> DeesAppui and TDeesAppuiBase -> TDeesAppui; updated IViewActivationContext.appui type accordingly
- Moved/rewired view registry implementation from dees-appui-base to dees-appui and updated module exports
- Updated README and demo files to reference DeesAppui and new readme paths (removed dees-appui-base docs/demo)
- Replaced dependency/imports of '@webcontainer/api' with '@tempfix/webcontainer__api' (package.json and source imports)
- Changed tsconfig.json: skipLibCheck set from true to false
## 2026-01-01 - 3.27.1 - fix(dees-actionbar)
always render actionbar wrapper and delay adding visible class to ensure grid/opacity animations run reliably
- Always render the actionbar wrapper (.actionbar-item and .actionbar-content) instead of returning early so grid-template-rows and opacity transitions can animate.
- Use optional chaining for current bar access (bar?.type, bar?.timeout) to avoid runtime errors when no bar is present.
- Adjust styles and structure: set :host display:block; move background/border to .actionbar-item; add .actionbar-content with min-height/opacity and transitions.
- Make processQueue asynchronous and await updateComplete, then add the 'visible' class inside requestAnimationFrame so the CSS transition is triggered after render.
## 2026-01-01 - 3.27.0 - feat(services)
introduce DeesServiceLibLoader to lazy-load heavy client libraries from CDN and update components to use it
- Add DeesServiceLibLoader singleton (ts_web/services/DeesServiceLibLoader.ts) to lazily load and cache libraries via jsDelivr ESM: xterm, xterm-addon-fit, highlight.js, ApexCharts, and Tiptap.
- Inject xterm CSS dynamically to avoid shipping xterm styles in the initial bundle.
- Expose helper methods preloadAll() and isLoaded(), and typed bundle interfaces (IXtermBundle, IXtermFitAddonBundle, ITiptapBundle).
- Update components to use runtime-loaded modules: dees-chart-area, dees-dataview-codebox, dees-input-richtext, wysiwyg code block, dees-workspace-terminal, terminal-tab-manager, dees-workspace-terminal-preview.
- TerminalTabManager now requires setXtermModules(...) before creating tabs and will throw if not initialized; workspace terminal now initializes and passes the loaded modules.
- Replace direct runtime imports of heavy libs with typed imports and runtime-loaded bundles to reduce initial bundle size and improve load performance.
## 2026-01-01 - 3.26.1 - fix(dees-actionbar)
animate actionbar hide using grid-template-rows and wait for animation before clearing state
- Switch host layout from block/max-height to grid using grid-template-rows for open/close transitions
- Add min-height: 0 to .actionbar-item to prevent flex children overflow and collapsing
- Introduce async hideCurrentBar() that removes 'visible', sets isVisible=false, waits 220ms then clears currentBar and currentResolve
- processQueue() now calls hideCurrentBar() asynchronously instead of clearing state immediately
## 2026-01-01 - 3.26.0 - feat(workspace)
add external file change detection, conflict resolution UI, and diff editor
- Watch open files for external changes with debounced file watchers (startWatchingFile/stopWatchingFile/stopAllFileWatchers).
- Prompt the user when disk changes conflict with unsaved local edits via dees-actionbar (actions: Load from Disk, Save Local, Compare).
- Introduce dees-workspace-diff-editor component and export it; support comparing and resolving diffs (diff-resolved / diff-closed events).
- Add setContentExternal in dees-workspace-monaco to update editor content from external sources while optionally preserving cursor, selections and scroll position.
- Start/stop file watchers when files are opened/closed and integrate diff view and actionbar into the workspace UI for seamless conflict handling.
## 2026-01-01 - 3.25.0 - feat(dees-actionbar)
add action bar component and improve workspace package update handling
- Introduce dees-actionbar component (dees-actionbar.ts) with interfaces, queueing, timed auto-trigger and demo usage
- Add actionbar.interfaces.ts and index export; export dees-actionbar from elements index
- Enhance workspace bottombar: add pendingPackageUpdate flag, process-complete handler, and connected/disconnected listeners to auto-refresh package status after updates
- Make pnpm outdated checking robust by streaming output via a reader and adding a 10s timeout to avoid hanging; handle timeout and stream cancellation
- Update package update commands to include '--latest' for updatePackage and updateAllPackages, and show 'Checking...' label during checks
- Add '@types/node' (^22.0.0) to devDependencies in the workspace package config
## 2026-01-01 - 3.24.0 - feat(workspace) ## 2026-01-01 - 3.24.0 - feat(workspace)
add workspace bottom bar, terminal tab manager, and run-process integration add workspace bottom bar, terminal tab manager, and run-process integration

View File

@@ -1,6 +1,6 @@
{ {
"name": "@design.estate/dees-catalog", "name": "@design.estate/dees-catalog",
"version": "3.24.0", "version": "3.28.1",
"private": false, "private": false,
"description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.", "description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
"main": "dist_ts_web/index.js", "main": "dist_ts_web/index.js",
@@ -32,7 +32,7 @@
"@tiptap/extension-underline": "^2.23.0", "@tiptap/extension-underline": "^2.23.0",
"@tiptap/starter-kit": "^2.23.0", "@tiptap/starter-kit": "^2.23.0",
"@tsclass/tsclass": "^9.3.0", "@tsclass/tsclass": "^9.3.0",
"@webcontainer/api": "1.6.1", "@tempfix/webcontainer__api": "1.6.1",
"apexcharts": "^5.3.6", "apexcharts": "^5.3.6",
"highlight.js": "11.11.1", "highlight.js": "11.11.1",
"ibantools": "^4.5.1", "ibantools": "^4.5.1",

16
pnpm-lock.yaml generated
View File

@@ -35,6 +35,9 @@ importers:
'@push.rocks/smartstring': '@push.rocks/smartstring':
specifier: ^4.1.0 specifier: ^4.1.0
version: 4.1.0 version: 4.1.0
'@tempfix/webcontainer__api':
specifier: 1.6.1
version: 1.6.1
'@tiptap/core': '@tiptap/core':
specifier: ^2.23.0 specifier: ^2.23.0
version: 2.27.1(@tiptap/pm@2.27.1) version: 2.27.1(@tiptap/pm@2.27.1)
@@ -56,9 +59,6 @@ importers:
'@tsclass/tsclass': '@tsclass/tsclass':
specifier: ^9.3.0 specifier: ^9.3.0
version: 9.3.0 version: 9.3.0
'@webcontainer/api':
specifier: 1.6.1
version: 1.6.1
apexcharts: apexcharts:
specifier: ^5.3.6 specifier: ^5.3.6
version: 5.3.6 version: 5.3.6
@@ -1450,6 +1450,9 @@ packages:
'@tempfix/idb@8.0.3': '@tempfix/idb@8.0.3':
resolution: {integrity: sha512-hPJQKO7+oAIY+pDNImrZ9QAINbz9KmwT+yO4iRVwdPanok2YKpaUxdJzIvCUwY0YgAawlvYdffbLvRLV5hbs2g==} resolution: {integrity: sha512-hPJQKO7+oAIY+pDNImrZ9QAINbz9KmwT+yO4iRVwdPanok2YKpaUxdJzIvCUwY0YgAawlvYdffbLvRLV5hbs2g==}
'@tempfix/webcontainer__api@1.6.1':
resolution: {integrity: sha512-Hgn3cwy0vPzjrVBqeVnY0jNZLaOCW7d+dxBe7Jv9YGHAjJ8udUMS+KbTywSv5paAfld3A/RN/iolmMzOwZxLTA==}
'@tiptap/core@2.27.1': '@tiptap/core@2.27.1':
resolution: {integrity: sha512-nkerkl8syHj44ZzAB7oA2GPmmZINKBKCa79FuNvmGJrJ4qyZwlkDzszud23YteFZEytbc87kVd/fP76ROS6sLg==} resolution: {integrity: sha512-nkerkl8syHj44ZzAB7oA2GPmmZINKBKCa79FuNvmGJrJ4qyZwlkDzszud23YteFZEytbc87kVd/fP76ROS6sLg==}
peerDependencies: peerDependencies:
@@ -1760,9 +1763,6 @@ packages:
'@webcontainer/api@1.2.0': '@webcontainer/api@1.2.0':
resolution: {integrity: sha512-tzoKBd4lLdhHy5GHFpUkl+ndoSba8JqmB7x0ZQFnWfjbcbQOvKQfxA8MEMUYhgqjWHnbrWdAfnBEHz5f5lYG5A==} resolution: {integrity: sha512-tzoKBd4lLdhHy5GHFpUkl+ndoSba8JqmB7x0ZQFnWfjbcbQOvKQfxA8MEMUYhgqjWHnbrWdAfnBEHz5f5lYG5A==}
'@webcontainer/api@1.6.1':
resolution: {integrity: sha512-2RS2KiIw32BY1Icf6M1DvqSmcon9XICZCDgS29QJb2NmF12ZY2V5Ia+949hMKB3Wno+P/Y8W+sPP59PZeXSELg==}
'@yr/monotone-cubic-spline@1.0.3': '@yr/monotone-cubic-spline@1.0.3':
resolution: {integrity: sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA==} resolution: {integrity: sha512-FQXkOta0XBSUPHndIKON2Y9JeQz5ZeMqLYZVVK93FliNBFm7LNMIZmY6FrMEB9XPcDbE2bekMbZD6kzDkxwYjA==}
@@ -6466,6 +6466,8 @@ snapshots:
'@tempfix/idb@8.0.3': {} '@tempfix/idb@8.0.3': {}
'@tempfix/webcontainer__api@1.6.1': {}
'@tiptap/core@2.27.1(@tiptap/pm@2.27.1)': '@tiptap/core@2.27.1(@tiptap/pm@2.27.1)':
dependencies: dependencies:
'@tiptap/pm': 2.27.1 '@tiptap/pm': 2.27.1
@@ -6814,8 +6816,6 @@ snapshots:
'@webcontainer/api@1.2.0': {} '@webcontainer/api@1.2.0': {}
'@webcontainer/api@1.6.1': {}
'@yr/monotone-cubic-spline@1.0.3': {} '@yr/monotone-cubic-spline@1.0.3': {}
accepts@1.3.8: accepts@1.3.8:

View File

@@ -684,7 +684,7 @@ According to Lit's documentation (https://lit.dev/docs/components/decorators/#de
## Enhanced AppUI API (2025-12-08) ## Enhanced AppUI API (2025-12-08)
The `dees-appui-base` component has been enhanced with a unified configuration API for building real-world applications. The `dees-appui` component has been enhanced with a unified configuration API for building real-world applications.
### New Modules: ### New Modules:
@@ -734,7 +734,7 @@ interface IRoutingConfig {
} }
``` ```
### New Public Methods on DeesAppuiBase: ### New Public Methods on DeesAppui:
```typescript ```typescript
// Configure with unified config // Configure with unified config
@@ -774,7 +774,7 @@ const config: IAppConfig = {
statePersistence: { enabled: true, storage: 'localStorage' }, statePersistence: { enabled: true, storage: 'localStorage' },
}; };
html`<dees-appui-base .config=${config}></dees-appui-base>`; html`<dees-appui .config=${config}></dees-appui>`;
``` ```
### Backward Compatibility: ### Backward Compatibility:
@@ -783,13 +783,13 @@ The existing property-based API still works:
```typescript ```typescript
html` html`
<dees-appui-base <dees-appui
.mainmenuGroups=${groups} .mainmenuGroups=${groups}
.secondarymenuGroups=${secondaryGroups} .secondarymenuGroups=${secondaryGroups}
@mainmenu-tab-select=${handler} @mainmenu-tab-select=${handler}
> >
<div slot="maincontent">...</div> <div slot="maincontent">...</div>
</dees-appui-base> </dees-appui>
`; `;
``` ```

View File

@@ -54,7 +54,7 @@ For developers working on this library, please refer to the [UI Components Playb
|----------|------------| |----------|------------|
| **Core UI** | [`DeesButton`](#deesbutton), [`DeesButtonExit`](#deesbuttonexit), [`DeesButtonGroup`](#deesbuttongroup), [`DeesBadge`](#deesbadge), [`DeesChips`](#deeschips), [`DeesHeading`](#deesheading), [`DeesHint`](#deeshint), [`DeesIcon`](#deesicon), [`DeesLabel`](#deeslabel), [`DeesPanel`](#deespanel), [`DeesSearchbar`](#deessearchbar), [`DeesSpinner`](#deesspinner), [`DeesToast`](#deestoast), [`DeesWindowcontrols`](#deeswindowcontrols) | | **Core UI** | [`DeesButton`](#deesbutton), [`DeesButtonExit`](#deesbuttonexit), [`DeesButtonGroup`](#deesbuttongroup), [`DeesBadge`](#deesbadge), [`DeesChips`](#deeschips), [`DeesHeading`](#deesheading), [`DeesHint`](#deeshint), [`DeesIcon`](#deesicon), [`DeesLabel`](#deeslabel), [`DeesPanel`](#deespanel), [`DeesSearchbar`](#deessearchbar), [`DeesSpinner`](#deesspinner), [`DeesToast`](#deestoast), [`DeesWindowcontrols`](#deeswindowcontrols) |
| **Forms** | [`DeesForm`](#deesform), [`DeesInputText`](#deesinputtext), [`DeesInputCheckbox`](#deesinputcheckbox), [`DeesInputDropdown`](#deesinputdropdown), [`DeesInputRadiogroup`](#deesinputradiogroup), [`DeesInputFileupload`](#deesinputfileupload), [`DeesInputIban`](#deesinputiban), [`DeesInputPhone`](#deesinputphone), [`DeesInputQuantitySelector`](#deesinputquantityselector), [`DeesInputMultitoggle`](#deesinputmultitoggle), [`DeesInputTags`](#deesinputtags), [`DeesInputTypelist`](#deesinputtypelist), [`DeesInputRichtext`](#deesinputrichtext), [`DeesInputWysiwyg`](#deesinputwysiwyg), [`DeesInputDatepicker`](#deesinputdatepicker), [`DeesInputSearchselect`](#deesinputsearchselect), [`DeesFormSubmit`](#deesformsubmit) | | **Forms** | [`DeesForm`](#deesform), [`DeesInputText`](#deesinputtext), [`DeesInputCheckbox`](#deesinputcheckbox), [`DeesInputDropdown`](#deesinputdropdown), [`DeesInputRadiogroup`](#deesinputradiogroup), [`DeesInputFileupload`](#deesinputfileupload), [`DeesInputIban`](#deesinputiban), [`DeesInputPhone`](#deesinputphone), [`DeesInputQuantitySelector`](#deesinputquantityselector), [`DeesInputMultitoggle`](#deesinputmultitoggle), [`DeesInputTags`](#deesinputtags), [`DeesInputTypelist`](#deesinputtypelist), [`DeesInputRichtext`](#deesinputrichtext), [`DeesInputWysiwyg`](#deesinputwysiwyg), [`DeesInputDatepicker`](#deesinputdatepicker), [`DeesInputSearchselect`](#deesinputsearchselect), [`DeesFormSubmit`](#deesformsubmit) |
| **Layout** | [`DeesAppuiBase`](#deesappuibase), [`DeesAppuiMainmenu`](#deesappuimainmenu), [`DeesAppuiSecondarymenu`](#deesappuisecondarymenu), [`DeesAppuiMaincontent`](#deesappuimaincontent), [`DeesAppuiAppbar`](#deesappuiappbar), [`DeesAppuiActivitylog`](#deesappuiactivitylog), [`DeesAppuiProfiledropdown`](#deesappuiprofiledropdown), [`DeesAppuiTabs`](#deesappuitabs), [`DeesMobileNavigation`](#deesmobilenavigation), [`DeesDashboardGrid`](#deesdashboardgrid) | | **Layout** | [`DeesAppui`](#deesappui), [`DeesAppuiMainmenu`](#deesappuimainmenu), [`DeesAppuiSecondarymenu`](#deesappuisecondarymenu), [`DeesAppuiMaincontent`](#deesappuimaincontent), [`DeesAppuiAppbar`](#deesappuiappbar), [`DeesAppuiActivitylog`](#deesappuiactivitylog), [`DeesAppuiProfiledropdown`](#deesappuiprofiledropdown), [`DeesAppuiTabs`](#deesappuitabs), [`DeesMobileNavigation`](#deesmobilenavigation), [`DeesDashboardGrid`](#deesdashboardgrid) |
| **Data Display** | [`DeesTable`](#deestable), [`DeesDataviewCodebox`](#deesdataviewcodebox), [`DeesDataviewStatusobject`](#deesdataviewstatusobject), [`DeesPdf`](#deespdf), [`DeesStatsGrid`](#deesstatsgrid), [`DeesPagination`](#deespagination) | | **Data Display** | [`DeesTable`](#deestable), [`DeesDataviewCodebox`](#deesdataviewcodebox), [`DeesDataviewStatusobject`](#deesdataviewstatusobject), [`DeesPdf`](#deespdf), [`DeesStatsGrid`](#deesstatsgrid), [`DeesPagination`](#deespagination) |
| **Visualization** | [`DeesChartArea`](#deeschartarea), [`DeesChartLog`](#deeschartlog) | | **Visualization** | [`DeesChartArea`](#deeschartarea), [`DeesChartLog`](#deeschartlog) |
| **Dialogs & Overlays** | [`DeesModal`](#deesmodal), [`DeesContextmenu`](#deescontextmenu), [`DeesSpeechbubble`](#deesspeechbubble), [`DeesWindowlayer`](#deeswindowlayer) | | **Dialogs & Overlays** | [`DeesModal`](#deesmodal), [`DeesContextmenu`](#deescontextmenu), [`DeesSpeechbubble`](#deesspeechbubble), [`DeesWindowlayer`](#deeswindowlayer) |
@@ -615,23 +615,23 @@ Submit button component specifically designed for `DeesForm`.
### Layout Components ### Layout Components
#### `DeesAppuiBase` #### `DeesAppui`
A comprehensive application shell component providing a complete UI framework with navigation, menus, activity logging, and view management. A comprehensive application shell component providing a complete UI framework with navigation, menus, activity logging, and view management.
> **Full API Documentation**: See [ts_web/elements/00group-appui/dees-appui-base/readme.md](./ts_web/elements/00group-appui/dees-appui-base/readme.md) for complete documentation including all programmatic APIs, view lifecycle hooks, and TypeScript interfaces. > **Full API Documentation**: See [ts_web/elements/00group-appui/dees-appui/readme.md](./ts_web/elements/00group-appui/dees-appui/readme.md) for complete documentation including all programmatic APIs, view lifecycle hooks, and TypeScript interfaces.
**Quick Start:** **Quick Start:**
```typescript ```typescript
import { html, DeesElement, customElement } from '@design.estate/dees-element'; import { html, DeesElement, customElement } from '@design.estate/dees-element';
import { DeesAppuiBase } from '@design.estate/dees-catalog'; import { DeesAppui } from '@design.estate/dees-catalog';
@customElement('my-app') @customElement('my-app')
class MyApp extends DeesElement { class MyApp extends DeesElement {
private appui: DeesAppuiBase; private appui: DeesAppui;
async firstUpdated() { async firstUpdated() {
this.appui = this.shadowRoot.querySelector('dees-appui-base'); this.appui = this.shadowRoot.querySelector('dees-appui');
// Configure with views and menu // Configure with views and menu
this.appui.configure({ this.appui.configure({
@@ -648,7 +648,7 @@ class MyApp extends DeesElement {
} }
render() { render() {
return html`<dees-appui-base></dees-appui-base>`; return html`<dees-appui></dees-appui>`;
} }
} }
``` ```

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@design.estate/dees-catalog', name: '@design.estate/dees-catalog',
version: '3.24.0', version: '3.28.1',
description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.' description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
} }

View File

@@ -39,60 +39,91 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
themeDefaultStyles, themeDefaultStyles,
cssManager.defaultStyles, cssManager.defaultStyles,
css` css`
/* TODO: Migrate hardcoded values to --dees-* CSS variables */
:host { :host {
color: ${cssManager.bdTheme('#09090b', '#fafafa')}; /* CSS Variables aligned with secondary menu */
--activitylog-bg: ${cssManager.bdTheme('#fafafa', '#0a0a0a')};
--activitylog-fg: ${cssManager.bdTheme('#525252', '#a3a3a3')};
--activitylog-fg-muted: ${cssManager.bdTheme('#737373', '#737373')};
--activitylog-fg-active: ${cssManager.bdTheme('#0a0a0a', '#fafafa')};
--activitylog-border: ${cssManager.bdTheme('#e5e5e5', '#1a1a1a')};
--activitylog-hover: ${cssManager.bdTheme('rgba(0, 0, 0, 0.04)', 'rgba(255, 255, 255, 0.06)')};
--activitylog-accent: ${cssManager.bdTheme('#78716c', '#b5a99a')};
color: var(--activitylog-fg);
position: relative; position: relative;
display: block; display: block;
width: 100%; width: 100%;
max-width: 320px;
height: 100%; height: 100%;
background: ${cssManager.bdTheme('#fafafa', '#0a0a0a')}; background: var(--activitylog-bg);
font-family: 'Geist Mono', monospace; font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, sans-serif;
border-left: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')}; border-left: 1px solid var(--activitylog-border);
cursor: default; cursor: default;
box-shadow: ${cssManager.bdTheme( overflow: hidden;
'-4px 0 12px rgba(0, 0, 0, 0.02)',
'-4px 0 12px rgba(0, 0, 0, 0.2)'
)};
} }
.maincontainer { .maincontainer {
position: absolute; position: absolute;
top: 0px; top: 0px;
left: 0px; left: 0px;
height: 100%; height: 100%;
width: 100%; width: 280px;
} }
/* Header with streaming indicator */
.topbar { .topbar {
position: absolute; position: absolute;
top: 0px; top: 0px;
height: 48px; height: 48px;
width: 100%; width: 100%;
padding: 0px 16px; padding: 0px 12px;
background: ${cssManager.bdTheme('#ffffff', '#09090b')}; background: var(--activitylog-bg);
border-bottom: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')}; border-bottom: 1px solid var(--activitylog-border);
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
box-sizing: border-box; box-sizing: border-box;
} }
.topbar .heading { .topbar .heading {
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 14px;
font-family: 'Geist Sans', sans-serif; color: var(--activitylog-fg-active);
color: ${cssManager.bdTheme('#09090b', '#fafafa')};
} }
.live-indicator {
display: flex;
align-items: center;
gap: 6px;
font-size: 10px;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--activitylog-fg-muted);
}
.live-indicator .dot {
width: 6px;
height: 6px;
background: ${cssManager.bdTheme('#22c55e', '#22c55e')};
border-radius: 50%;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 0.5; transform: scale(0.9); }
50% { opacity: 1; transform: scale(1.1); }
}
/* Activity container */
.activityContainer { .activityContainer {
position: absolute; position: absolute;
top: 48px; top: 48px;
bottom: 48px; bottom: 48px;
width: 100%; width: 100%;
padding: 12px 0px; padding: 8px 0;
overflow-y: auto; overflow-y: auto;
scrollbar-width: thin; scrollbar-width: thin;
scrollbar-color: ${cssManager.bdTheme('#e5e7eb', '#27272a')} transparent; scrollbar-color: ${cssManager.bdTheme('#d4d4d4', '#333333')} transparent;
} }
.activityContainer::-webkit-scrollbar { .activityContainer::-webkit-scrollbar {
@@ -104,82 +135,53 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
} }
.activityContainer::-webkit-scrollbar-thumb { .activityContainer::-webkit-scrollbar-thumb {
background: ${cssManager.bdTheme('#e5e7eb', '#27272a')}; background: ${cssManager.bdTheme('#d4d4d4', '#333333')};
border-radius: 3px; border-radius: 3px;
} }
.activityContainer::-webkit-scrollbar-thumb:hover { .activityContainer::-webkit-scrollbar-thumb:hover {
background: ${cssManager.bdTheme('#d4d4d8', '#3f3f46')}; background: ${cssManager.bdTheme('#a3a3a3', '#525252')};
} }
.empty-state { .empty-state {
font-size: 13px; font-size: 13px;
text-align: center; text-align: center;
padding: 32px 16px; padding: 40px 16px;
color: ${cssManager.bdTheme('#71717a', '#71717a')}; color: var(--activitylog-fg-muted);
font-family: 'Geist Sans', sans-serif;
}
.streamingIndicator {
font-size: 11px;
text-align: center;
padding: 16px;
color: ${cssManager.bdTheme('#71717a', '#71717a')};
font-family: 'Geist Sans', sans-serif;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 500;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.streamingIndicator::before {
content: '';
width: 6px;
height: 6px;
background: ${cssManager.bdTheme('#3b82f6', '#3b82f6')};
border-radius: 50%;
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 0.4; transform: scale(0.8); }
50% { opacity: 1; transform: scale(1.2); }
} }
/* Date separator - warm taupe styling */
.date-separator { .date-separator {
padding: 12px 16px 8px; padding: 12px 12px 6px;
font-size: 11px; font-size: 10px;
font-weight: 600; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.05em; letter-spacing: 0.5px;
color: ${cssManager.bdTheme('#71717a', '#71717a')}; color: var(--activitylog-accent);
background: ${cssManager.bdTheme('#f9fafb', '#09090b')};
border-bottom: 1px solid ${cssManager.bdTheme('#f4f4f5', '#18181b')};
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 1; z-index: 1;
background: var(--activitylog-bg);
} }
/* Activity entry - modern stacked layout */
.activityentry { .activityentry {
min-height: 36px; font-size: 12px;
font-size: 13px; padding: 8px 12px;
padding: 10px 16px; margin: 2px 4px;
border-bottom: 1px solid ${cssManager.bdTheme('#f4f4f5', '#18181b')}; border-radius: 6px;
transition: all 0.15s ease; transition: background 0.15s ease;
display: flex; display: flex;
align-items: center; align-items: flex-start;
gap: 8px; gap: 10px;
line-height: 1.4; line-height: 1.4;
animation: fadeIn 0.3s ease-out; animation: fadeIn 0.2s ease-out;
} }
@keyframes fadeIn { @keyframes fadeIn {
from { from {
opacity: 0; opacity: 0;
transform: translateY(-4px); transform: translateY(-2px);
} }
to { to {
opacity: 1; opacity: 1;
@@ -187,88 +189,109 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
} }
} }
.activityentry:last-of-type {
border-bottom: none;
}
.activityentry:hover { .activityentry:hover {
background: ${cssManager.bdTheme('#f4f4f5', '#18181b')}; background: var(--activitylog-hover);
}
.timestamp {
color: ${cssManager.bdTheme('#71717a', '#71717a')};
font-weight: 500;
font-size: 12px;
font-variant-numeric: tabular-nums;
flex-shrink: 0;
min-width: 45px;
} }
.activity-icon { .activity-icon {
width: 28px; width: 28px;
height: 28px; height: 28px;
border-radius: 6px; border-radius: 6px;
background: ${cssManager.bdTheme('#f4f4f5', '#18181b')}; background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.04)', 'rgba(255, 255, 255, 0.06)')};
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
flex-shrink: 0; flex-shrink: 0;
font-size: 14px; font-size: 13px;
color: var(--activitylog-fg-muted);
margin-top: 1px;
} }
.activity-icon.login { .activity-icon.login {
background: ${cssManager.bdTheme('rgba(34, 197, 94, 0.1)', 'rgba(34, 197, 94, 0.1)')}; background: ${cssManager.bdTheme('rgba(34, 197, 94, 0.08)', 'rgba(34, 197, 94, 0.12)')};
color: ${cssManager.bdTheme('#16a34a', '#22c55e')}; color: ${cssManager.bdTheme('#16a34a', '#4ade80')};
} }
.activity-icon.logout { .activity-icon.logout {
background: ${cssManager.bdTheme('rgba(239, 68, 68, 0.1)', 'rgba(239, 68, 68, 0.1)')}; background: ${cssManager.bdTheme('rgba(239, 68, 68, 0.08)', 'rgba(239, 68, 68, 0.12)')};
color: ${cssManager.bdTheme('#dc2626', '#ef4444')}; color: ${cssManager.bdTheme('#dc2626', '#f87171')};
} }
.activity-icon.view { .activity-icon.view {
background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.1)', 'rgba(59, 130, 246, 0.1)')}; background: ${cssManager.bdTheme('rgba(59, 130, 246, 0.08)', 'rgba(59, 130, 246, 0.12)')};
color: ${cssManager.bdTheme('#2563eb', '#3b82f6')}; color: ${cssManager.bdTheme('#2563eb', '#60a5fa')};
} }
.activity-icon.create { .activity-icon.create {
background: ${cssManager.bdTheme('rgba(168, 85, 247, 0.1)', 'rgba(168, 85, 247, 0.1)')}; background: ${cssManager.bdTheme('rgba(168, 85, 247, 0.08)', 'rgba(168, 85, 247, 0.12)')};
color: ${cssManager.bdTheme('#9333ea', '#a855f7')}; color: ${cssManager.bdTheme('#9333ea', '#c084fc')};
} }
.activity-icon.update { .activity-icon.update {
background: ${cssManager.bdTheme('rgba(251, 146, 60, 0.1)', 'rgba(251, 146, 60, 0.1)')}; background: ${cssManager.bdTheme('rgba(251, 146, 60, 0.08)', 'rgba(251, 146, 60, 0.12)')};
color: ${cssManager.bdTheme('#ea580c', '#fb923c')}; color: ${cssManager.bdTheme('#ea580c', '#fb923c')};
} }
.activity-icon.delete { .activity-icon.delete {
background: ${cssManager.bdTheme('rgba(239, 68, 68, 0.1)', 'rgba(239, 68, 68, 0.1)')}; background: ${cssManager.bdTheme('rgba(239, 68, 68, 0.08)', 'rgba(239, 68, 68, 0.12)')};
color: ${cssManager.bdTheme('#dc2626', '#ef4444')}; color: ${cssManager.bdTheme('#dc2626', '#f87171')};
} }
.activity-icon.custom { .activity-icon.custom {
background: ${cssManager.bdTheme('rgba(100, 116, 139, 0.1)', 'rgba(100, 116, 139, 0.1)')}; background: ${cssManager.bdTheme('rgba(100, 116, 139, 0.08)', 'rgba(100, 116, 139, 0.12)')};
color: ${cssManager.bdTheme('#475569', '#94a3b8')}; color: ${cssManager.bdTheme('#475569', '#94a3b8')};
} }
.activity-text { .activity-content {
flex: 1; flex: 1;
color: ${cssManager.bdTheme('#18181b', '#e4e4e7')}; min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.activity-header {
display: flex;
align-items: center;
gap: 6px;
} }
.activity-user { .activity-user {
font-weight: 600; font-weight: 600;
color: ${cssManager.bdTheme('#09090b', '#fafafa')}; font-size: 12px;
color: var(--activitylog-fg-active);
} }
.activity-separator {
color: var(--activitylog-fg-muted);
font-size: 10px;
}
.timestamp {
color: var(--activitylog-fg-muted);
font-weight: 400;
font-size: 11px;
font-variant-numeric: tabular-nums;
font-family: 'Geist Mono', monospace;
}
.activity-message {
color: var(--activitylog-fg);
font-size: 12px;
line-height: 1.5;
word-break: break-word;
}
/* Search box - refined styling */
.searchbox { .searchbox {
position: absolute; position: absolute;
bottom: 0px; bottom: 0px;
width: 100%; width: 100%;
height: 48px; height: 48px;
background: ${cssManager.bdTheme('#ffffff', '#09090b')}; background: var(--activitylog-bg);
border-top: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')}; border-top: 1px solid var(--activitylog-border);
padding: 8px; padding: 8px 12px;
box-sizing: border-box;
} }
.search-wrapper { .search-wrapper {
@@ -282,64 +305,37 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
left: 10px; left: 10px;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
color: ${cssManager.bdTheme('#71717a', '#71717a')}; color: var(--activitylog-fg-muted);
font-size: 14px; font-size: 13px;
pointer-events: none; pointer-events: none;
transition: color 0.15s ease; transition: color 0.15s ease;
} }
.searchbox input { .searchbox input {
color: ${cssManager.bdTheme('#09090b', '#fafafa')}; color: var(--activitylog-fg-active);
background: ${cssManager.bdTheme('#f4f4f5', '#18181b')}; background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.03)', 'rgba(255, 255, 255, 0.04)')};
width: 100%; width: 100%;
height: 100%; height: 100%;
border: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')}; border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.08)', 'rgba(255, 255, 255, 0.08)')};
border-radius: 6px; border-radius: 6px;
padding: 0 12px 0 36px; padding: 0 12px 0 34px;
font-family: 'Geist Sans', sans-serif; font-family: 'Geist Sans', sans-serif;
font-size: 13px; font-size: 12px;
transition: all 0.15s ease; transition: all 0.15s ease;
} }
.searchbox input::placeholder { .searchbox input::placeholder {
color: ${cssManager.bdTheme('#71717a', '#71717a')}; color: var(--activitylog-fg-muted);
} }
.searchbox input:focus { .searchbox input:focus {
outline: none; outline: none;
border-color: ${cssManager.bdTheme('#3b82f6', '#3b82f6')}; border-color: ${cssManager.bdTheme('rgba(0, 0, 0, 0.15)', 'rgba(255, 255, 255, 0.15)')};
box-shadow: 0 0 0 3px ${cssManager.bdTheme('rgba(59, 130, 246, 0.1)', 'rgba(59, 130, 246, 0.1)')}; background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.02)', 'rgba(255, 255, 255, 0.06)')};
} }
.searchbox input:focus ~ .search-icon,
.search-wrapper:has(input:focus) .search-icon { .search-wrapper:has(input:focus) .search-icon {
color: ${cssManager.bdTheme('#3b82f6', '#3b82f6')}; color: var(--activitylog-fg);
}
.bottomShadow {
position: absolute;
width: 100%;
height: 24px;
bottom: 48px;
background: ${cssManager.bdTheme(
'linear-gradient(180deg, transparent 0%, #fafafa 100%)',
'linear-gradient(180deg, transparent 0%, #0a0a0a 100%)'
)};
pointer-events: none;
opacity: 0.8;
}
.topShadow {
position: absolute;
width: 100%;
height: 24px;
top: 48px;
background: ${cssManager.bdTheme(
'linear-gradient(0deg, transparent 0%, #fafafa 100%)',
'linear-gradient(0deg, transparent 0%, #0a0a0a 100%)'
)};
pointer-events: none;
opacity: 0.8;
} }
`, `,
]; ];
@@ -355,12 +351,11 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
<div class="maincontainer"> <div class="maincontainer">
<div class="topbar"> <div class="topbar">
<div class="heading">Activity Log</div> <div class="heading">Activity Log</div>
${filteredEntries.length > 0
? html`<div class="live-indicator"><span class="dot"></span>Live</div>`
: ''}
</div> </div>
<div class="activityContainer"> <div class="activityContainer">
${filteredEntries.length > 0
? html`<div class="streamingIndicator">Live Updates</div>`
: ''}
${filteredEntries.length === 0 ${filteredEntries.length === 0
? html`<div class="empty-state">No activity entries</div>` ? html`<div class="empty-state">No activity entries</div>`
: groupedEntries.map( : groupedEntries.map(
@@ -381,8 +376,6 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
/> />
</div> </div>
</div> </div>
<div class="topShadow"></div>
<div class="bottomShadow"></div>
</div> </div>
`; `;
} }
@@ -397,12 +390,16 @@ export class DeesAppuiActivitylog extends DeesElement implements IActivityLogAPI
class="activityentry" class="activityentry"
@contextmenu=${(e: MouseEvent) => this.handleContextMenu(e, entry)} @contextmenu=${(e: MouseEvent) => this.handleContextMenu(e, entry)}
> >
<span class="timestamp">${timeStr}</span>
<div class="activity-icon ${entry.type}"> <div class="activity-icon ${entry.type}">
<dees-icon .icon=${iconName}></dees-icon> <dees-icon .icon=${iconName}></dees-icon>
</div> </div>
<div class="activity-text"> <div class="activity-content">
<span class="activity-user">${entry.user}</span> ${entry.message} <div class="activity-header">
<span class="activity-user">${entry.user}</span>
<span class="activity-separator">·</span>
<span class="timestamp">${timeStr}</span>
</div>
<div class="activity-message">${entry.message}</div>
</div> </div>
</div> </div>
`; `;

View File

@@ -57,6 +57,16 @@ export class DeesAppuiBar extends DeesElement {
@property({ type: Boolean }) @property({ type: Boolean })
accessor showSearch: boolean = false; accessor showSearch: boolean = false;
// Activity log toggle
@property({ type: Boolean })
accessor showActivityLogToggle: boolean = false;
@property({ type: Number })
accessor activityLogCount: number = 0;
@property({ type: Boolean })
accessor activityLogActive: boolean = false;
// STATE // STATE
@state() @state()
accessor activeMenu: string | null = null; accessor activeMenu: string | null = null;
@@ -177,8 +187,8 @@ export class DeesAppuiBar extends DeesElement {
public renderAccountSection(): TemplateResult { public renderAccountSection(): TemplateResult {
return html` return html`
${this.showSearch ? html` ${this.showSearch ? html`
<dees-icon <dees-icon
class="search-icon" class="search-icon"
.icon=${'lucide:search'} .icon=${'lucide:search'}
@click=${this.handleSearchClick} @click=${this.handleSearchClick}
></dees-icon> ></dees-icon>
@@ -206,6 +216,18 @@ export class DeesAppuiBar extends DeesElement {
></dees-appui-profiledropdown> ></dees-appui-profiledropdown>
</div> </div>
` : ''} ` : ''}
${this.showActivityLogToggle ? html`
<div
class="activity-toggle ${this.activityLogActive ? 'active' : ''}"
@click=${this.handleActivityToggle}
title="Activity Log"
>
<dees-icon .icon=${'lucide:activity'}></dees-icon>
${this.activityLogCount > 0 ? html`
<span class="activity-badge">${this.activityLogCount > 99 ? '99+' : this.activityLogCount}</span>
` : ''}
</div>
` : ''}
`; `;
} }
@@ -304,9 +326,16 @@ export class DeesAppuiBar extends DeesElement {
} }
private handleSearchClick() { private handleSearchClick() {
this.dispatchEvent(new CustomEvent('search-click', { this.dispatchEvent(new CustomEvent('search-click', {
bubbles: true, bubbles: true,
composed: true composed: true
}));
}
private handleActivityToggle() {
this.dispatchEvent(new CustomEvent('activity-toggle', {
bubbles: true,
composed: true
})); }));
} }

View File

@@ -17,7 +17,7 @@ export const appuiAppbarStyles = [
color: ${cssManager.bdTheme('#00000080', '#ffffff80')}; color: ${cssManager.bdTheme('#00000080', '#ffffff80')};
font-size: var(--appbar-font-size); font-size: var(--appbar-font-size);
display: grid; display: grid;
grid-template-columns: ${cssManager.cssGridColumns(3, 20)}; grid-template-columns: auto 1fr auto;
-webkit-app-region: drag; -webkit-app-region: drag;
user-select: none; user-select: none;
} }
@@ -233,6 +233,54 @@ export const appuiAppbarStyles = [
.user-status.away { .user-status.away {
background: #ff9800; background: #ff9800;
} }
/* Activity log toggle button */
.activity-toggle {
display: flex;
align-items: center;
gap: 2px;
height: 28px;
padding: 0 8px;
border-radius: 6px;
cursor: default;
-webkit-app-region: no-drag;
color: ${cssManager.bdTheme('#00000060', '#ffffff60')};
border: 1px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.1)')};
transition: all 0.15s ease;
}
.activity-toggle:hover {
background: ${cssManager.bdTheme('#00000010', '#ffffff15')};
color: ${cssManager.bdTheme('#000000', '#ffffff')};
border-color: transparent;
}
.activity-toggle.active {
background: ${cssManager.bdTheme('#00000015', '#ffffff20')};
color: ${cssManager.bdTheme('#000000', '#ffffff')};
border-color: transparent;
}
.activity-toggle dees-icon {
font-size: 14px;
}
.activity-badge {
position: relative;
margin-left: 4px;
min-width: 16px;
height: 16px;
padding: 0 4px;
background: ${cssManager.bdTheme('#525252', '#525252')};
color: #fafafa;
font-size: 10px;
font-weight: 600;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
line-height: 1;
}
`, `,
]; ];

View File

@@ -1,2 +0,0 @@
export * from './dees-appui-base.js';
export * from './view.registry.js';

View File

@@ -85,6 +85,7 @@ export class DeesAppuiMaincontent extends DeesElement {
.content-area { .content-area {
overflow: auto; overflow: auto;
min-height: 0; min-height: 0;
overscroll-behavior: contain;
} }
:host([notabs]) .topbar { :host([notabs]) .topbar {

View File

@@ -12,41 +12,102 @@ export const demoFunc = () => html`
.demo-secondarymenu-container .spacer { .demo-secondarymenu-container .spacer {
flex: 1; flex: 1;
background: #0f0f0f; background: #0f0f0f;
padding: 20px;
color: #a3a3a3;
font-family: 'Geist Sans', sans-serif;
}
.demo-secondarymenu-container .spacer h3 {
color: #fafafa;
margin-top: 0;
}
.demo-secondarymenu-container .spacer code {
background: #27272a;
padding: 2px 6px;
border-radius: 4px;
font-size: 12px;
}
.demo-secondarymenu-container .spacer ul {
line-height: 1.8;
} }
</style> </style>
<div class="demo-secondarymenu-container"> <div class="demo-secondarymenu-container">
<dees-appui-secondarymenu <dees-appui-secondarymenu
.heading=${'Projects'} .heading=${'Projects'}
.groups=${[ .groups=${[
// Group 1: Tab items (default behavior)
{ {
name: 'Active', name: 'Navigation',
iconName: 'lucide:folder', iconName: 'lucide:compass',
items: [ items: [
{ key: 'Frontend App', iconName: 'code', action: () => console.log('Frontend'), badge: 3, badgeVariant: 'warning' }, { key: 'Dashboard', iconName: 'lucide:layoutDashboard', action: () => console.log('Dashboard clicked'), badge: 3, badgeVariant: 'warning' },
{ key: 'API Server', iconName: 'server', action: () => console.log('API'), badge: 'new', badgeVariant: 'success' }, { key: 'Projects', iconName: 'lucide:folder', action: () => console.log('Projects clicked'), badge: 'new', badgeVariant: 'success' },
{ key: 'Database', iconName: 'database', action: () => console.log('Database') }, { key: 'Analytics', iconName: 'lucide:barChart2', action: () => console.log('Analytics clicked') },
] ] as interfaces.ISecondaryMenuItemTab[]
}, },
// Group 2: Actions
{ {
name: 'Archived', name: 'Actions',
iconName: 'lucide:archive', iconName: 'lucide:zap',
items: [
{ type: 'action', key: 'Create New', iconName: 'lucide:plus', action: () => alert('Create New clicked!') },
{ type: 'action', key: 'Import Data', iconName: 'lucide:upload', action: () => alert('Import Data clicked!') },
{ type: 'divider' },
{ type: 'action', key: 'Delete All', iconName: 'lucide:trash2', variant: 'danger', confirmMessage: 'Are you sure you want to delete all items?', action: () => alert('Deleted!') },
] as interfaces.ISecondaryMenuItem[]
},
// Group 3: Filters
{
name: 'Filters',
iconName: 'lucide:filter',
items: [
{ type: 'header', label: 'Status' },
{ type: 'filter', key: 'Show Active', iconName: 'lucide:checkCircle', active: true, onToggle: (active) => console.log('Show Active:', active) },
{ type: 'filter', key: 'Show Archived', iconName: 'lucide:archive', active: false, onToggle: (active) => console.log('Show Archived:', active) },
{ type: 'divider' },
{ type: 'multiFilter', key: 'Categories', iconName: 'lucide:tag', collapsed: false, options: [
{ key: 'frontend', label: 'Frontend', checked: true, iconName: 'lucide:monitor' },
{ key: 'backend', label: 'Backend', checked: true, iconName: 'lucide:server' },
{ key: 'devops', label: 'DevOps', checked: false, iconName: 'lucide:cloud' },
{ key: 'design', label: 'Design', checked: false, iconName: 'lucide:palette' },
], onChange: (keys) => console.log('Selected categories:', keys) },
] as interfaces.ISecondaryMenuItem[]
},
// Group 4: Links and misc
{
name: 'Resources',
iconName: 'lucide:bookOpen',
collapsed: true, collapsed: true,
items: [ items: [
{ key: 'Legacy System', iconName: 'box', action: () => console.log('Legacy') }, { type: 'header', label: 'Documentation' },
{ key: 'Old API', iconName: 'server', action: () => console.log('Old API') }, { type: 'link', key: 'API Reference', iconName: 'lucide:fileText', href: 'https://api.example.com/docs' },
] { type: 'link', key: 'User Guide', iconName: 'lucide:book', href: 'https://docs.example.com/guide' },
}, { type: 'divider' },
{ { type: 'header', label: 'Support' },
name: 'Settings', { type: 'link', key: 'Help Center', iconName: 'lucide:helpCircle', href: '/help', external: false },
iconName: 'lucide:settings', { type: 'link', key: 'GitHub Issues', iconName: 'lucide:github', href: 'https://github.com/example/issues' },
items: [ ] as interfaces.ISecondaryMenuItem[]
{ key: 'Configuration', iconName: 'sliders', action: () => console.log('Config') },
{ key: 'Integrations', iconName: 'plug', action: () => console.log('Integrations'), badge: 5, badgeVariant: 'error' },
]
} }
] as interfaces.IMenuGroup[]} ] as interfaces.ISecondaryMenuGroup[]}
@item-select=${(e: CustomEvent) => console.log('Selected:', e.detail)} @item-select=${(e: CustomEvent) => console.log('Tab selected:', e.detail)}
@action-click=${(e: CustomEvent) => console.log('Action clicked:', e.detail)}
@filter-toggle=${(e: CustomEvent) => console.log('Filter toggled:', e.detail)}
@multifilter-change=${(e: CustomEvent) => console.log('Multi-filter changed:', e.detail)}
@link-click=${(e: CustomEvent) => console.log('Link clicked:', e.detail)}
></dees-appui-secondarymenu> ></dees-appui-secondarymenu>
<div class="spacer"></div> <div class="spacer">
<h3>Secondary Menu Demo</h3>
<p>This demo showcases all 8 item types:</p>
<ul>
<li><code>tab</code> - Selectable items (Navigation group)</li>
<li><code>action</code> - Blue actions (Actions group)</li>
<li><code>action</code> with <code>variant: 'danger'</code> - Red danger action</li>
<li><code>filter</code> - Checkbox toggles (Filters group)</li>
<li><code>multiFilter</code> - Collapsible multi-select (Categories)</li>
<li><code>divider</code> - Visual separators</li>
<li><code>header</code> - Section labels</li>
<li><code>link</code> - External/internal links (Resources group)</li>
</ul>
<p>Try the collapse toggle on the left edge!</p>
</div>
</div> </div>
`; `;

View File

@@ -19,7 +19,16 @@ import { themeDefaultStyles } from '../../00theme.js';
/** /**
* Secondary navigation menu for sub-navigation within MainMenu views * Secondary navigation menu for sub-navigation within MainMenu views
* Supports collapsible groups, badges, and dynamic headings *
* Supports 8 item types:
* 1. Tab - selectable, stays highlighted (default)
* 2. Action - executes without selection (blue)
* 3. Danger Action - red styling with optional confirmation
* 4. Filter - checkbox toggle
* 5. Multi-Filter - collapsible box with multiple checkboxes
* 6. Divider - visual separator
* 7. Header - non-interactive label
* 8. Link - opens URL
*/ */
@customElement('dees-appui-secondarymenu') @customElement('dees-appui-secondarymenu')
export class DeesAppuiSecondarymenu extends DeesElement { export class DeesAppuiSecondarymenu extends DeesElement {
@@ -31,22 +40,30 @@ export class DeesAppuiSecondarymenu extends DeesElement {
@property({ type: String }) @property({ type: String })
accessor heading: string = 'Menu'; accessor heading: string = 'Menu';
/** Grouped items with collapse support */ /** Grouped items with collapse support - supports new ISecondaryMenuGroup */
@property({ type: Array }) @property({ type: Array })
accessor groups: interfaces.IMenuGroup[] = []; accessor groups: interfaces.ISecondaryMenuGroup[] = [];
/** Legacy flat list support for backward compatibility */ /** Legacy flat list support for backward compatibility */
@property({ type: Array }) @property({ type: Array })
accessor selectionOptions: (interfaces.IMenuItem | { divider: true })[] = []; accessor selectionOptions: (interfaces.IMenuItem | { divider: true })[] = [];
/** Currently selected item */ /** Currently selected tab item */
@property({ type: Object }) @property({ type: Object })
accessor selectedItem: interfaces.IMenuItem | null = null; accessor selectedItem: interfaces.ISecondaryMenuItemTab | null = null;
/** Internal state for collapsed groups */ /** Internal state for collapsed groups */
@state() @state()
accessor collapsedGroups: Set<string> = new Set(); accessor collapsedGroups: Set<string> = new Set();
/** Internal state for collapsed multi-filters */
@state()
accessor collapsedMultiFilters: Set<string> = new Set();
/** Render counter to force re-renders when items are mutated */
@state()
private accessor renderCounter: number = 0;
/** Horizontal collapse state */ /** Horizontal collapse state */
@property({ type: Boolean, reflect: true }) @property({ type: Boolean, reflect: true })
accessor collapsed: boolean = false; accessor collapsed: boolean = false;
@@ -80,6 +97,12 @@ export class DeesAppuiSecondarymenu extends DeesElement {
--badge-error-bg: ${cssManager.bdTheme('#fee2e2', '#450a0a')}; --badge-error-bg: ${cssManager.bdTheme('#fee2e2', '#450a0a')};
--badge-error-fg: ${cssManager.bdTheme('#991b1b', '#f87171')}; --badge-error-fg: ${cssManager.bdTheme('#991b1b', '#f87171')};
/* Action colors */
--action-primary: ${cssManager.bdTheme('#2563eb', '#3b82f6')};
--action-primary-hover: ${cssManager.bdTheme('#1d4ed8', '#60a5fa')};
--action-danger: ${cssManager.bdTheme('#dc2626', '#ef4444')};
--action-danger-hover: ${cssManager.bdTheme('#b91c1c', '#f87171')};
position: relative; position: relative;
display: block; display: block;
height: 100%; height: 100%;
@@ -212,7 +235,7 @@ export class DeesAppuiSecondarymenu extends DeesElement {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 8px 8px; padding: 8px 12px;
cursor: pointer; cursor: pointer;
border-radius: 6px; border-radius: 6px;
transition: background 0.15s ease, opacity 0.2s ease, max-height 0.25s ease; transition: background 0.15s ease, opacity 0.2s ease, max-height 0.25s ease;
@@ -220,7 +243,14 @@ export class DeesAppuiSecondarymenu extends DeesElement {
} }
.groupHeader:hover { .groupHeader:hover {
background: var(--sidebar-hover); border: 1px solid ${cssManager.bdTheme('rgba(140, 120, 100, 0.06)', 'rgba(180, 160, 140, 0.08)')};
padding: 7px 11px;
}
.groupHeader:not(.collapsed) {
background: ${cssManager.bdTheme('rgba(140, 120, 100, 0.06)', 'rgba(180, 160, 140, 0.08)')};
border: none;
padding: 8px 12px;
} }
.groupHeader .groupTitle { .groupHeader .groupTitle {
@@ -229,7 +259,7 @@ export class DeesAppuiSecondarymenu extends DeesElement {
gap: 8px; gap: 8px;
font-size: 11px; font-size: 11px;
font-weight: 600; font-weight: 600;
color: var(--sidebar-fg-muted); color: ${cssManager.bdTheme('#78716c', '#b5a99a')};
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.5px; letter-spacing: 0.5px;
white-space: nowrap; white-space: nowrap;
@@ -237,14 +267,14 @@ export class DeesAppuiSecondarymenu extends DeesElement {
} }
.groupHeader .groupTitle dees-icon { .groupHeader .groupTitle dees-icon {
font-size: 14px; font-size: 16px;
opacity: 0.7; color: ${cssManager.bdTheme('#78716c', '#b5a99a')};
} }
.groupHeader .chevron { .groupHeader .chevron {
font-size: 12px; font-size: 12px;
transition: transform 0.2s ease; transition: transform 0.2s ease;
color: var(--sidebar-fg-muted); color: ${cssManager.bdTheme('#78716c', '#b5a99a')};
} }
.groupHeader.collapsed .chevron { .groupHeader.collapsed .chevron {
@@ -263,14 +293,16 @@ export class DeesAppuiSecondarymenu extends DeesElement {
/* Group Items Container */ /* Group Items Container */
.groupItems { .groupItems {
overflow: hidden; overflow: hidden;
transition: max-height 0.25s ease, opacity 0.2s ease; transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
max-height: 500px; max-height: 1000px;
opacity: 1; opacity: 1;
margin-bottom: 12px;
} }
.groupItems.collapsed { .groupItems.collapsed {
max-height: 0; max-height: 0;
opacity: 0; opacity: 0;
margin-bottom: 0;
} }
/* Always show items when horizontally collapsed (regardless of group collapse state) */ /* Always show items when horizontally collapsed (regardless of group collapse state) */
@@ -279,7 +311,7 @@ export class DeesAppuiSecondarymenu extends DeesElement {
opacity: 1; opacity: 1;
} }
/* Menu Item */ /* Menu Item Base */
.menuItem { .menuItem {
position: relative; position: relative;
display: flex; display: flex;
@@ -304,6 +336,12 @@ export class DeesAppuiSecondarymenu extends DeesElement {
background: var(--sidebar-active); background: var(--sidebar-active);
} }
.menuItem.disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
.menuItem.selected { .menuItem.selected {
background: var(--sidebar-active); background: var(--sidebar-active);
color: var(--sidebar-fg-active); color: var(--sidebar-fg-active);
@@ -340,6 +378,208 @@ export class DeesAppuiSecondarymenu extends DeesElement {
transition: opacity 0.2s ease, width 0.25s ease; transition: opacity 0.2s ease, width 0.25s ease;
} }
/* Action Item Styles */
.menuItem.action-primary {
color: var(--action-primary);
}
.menuItem.action-primary:hover {
color: var(--action-primary-hover);
background: ${cssManager.bdTheme('rgba(37, 99, 235, 0.08)', 'rgba(59, 130, 246, 0.12)')};
}
.menuItem.action-primary dees-icon {
opacity: 1;
}
.menuItem.action-danger {
color: var(--action-danger);
}
.menuItem.action-danger:hover {
color: var(--action-danger-hover);
background: ${cssManager.bdTheme('rgba(220, 38, 38, 0.08)', 'rgba(239, 68, 68, 0.12)')};
}
.menuItem.action-danger dees-icon {
opacity: 1;
}
/* Filter Item Styles */
.menuItem.filter {
justify-content: space-between;
}
.menuItem.filter .filter-checkbox {
width: 16px;
height: 16px;
border: 2px solid ${cssManager.bdTheme('#d4d4d4', '#525252')};
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s ease;
flex-shrink: 0;
}
.menuItem.filter .filter-checkbox.checked {
background: var(--sidebar-accent);
border-color: var(--sidebar-accent);
}
.menuItem.filter .filter-checkbox dees-icon {
font-size: 12px;
color: ${cssManager.bdTheme('#fafafa', '#0a0a0a')};
opacity: 1;
}
.menuItem.filter.active {
color: var(--sidebar-fg-active);
}
/* Multi-Filter Container */
.multiFilter {
margin: 4px 0;
border: 1px solid var(--sidebar-border);
border-radius: 8px;
overflow: hidden;
background: ${cssManager.bdTheme('rgba(0, 0, 0, 0.02)', 'rgba(255, 255, 255, 0.02)')};
}
.multiFilter-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
cursor: pointer;
transition: background 0.15s ease;
}
.multiFilter-header:hover {
background: var(--sidebar-hover);
}
.multiFilter-header .multiFilter-title {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
font-weight: 500;
color: var(--sidebar-fg-active);
}
.multiFilter-header .multiFilter-title dees-icon {
font-size: 16px;
opacity: 0.7;
}
.multiFilter-header .multiFilter-count {
font-size: 11px;
color: var(--sidebar-fg-muted);
background: var(--badge-default-bg);
padding: 2px 6px;
border-radius: 4px;
}
.multiFilter-header .chevron {
font-size: 12px;
transition: transform 0.2s ease;
color: var(--sidebar-fg-muted);
}
.multiFilter-header.collapsed .chevron {
transform: rotate(-90deg);
}
.multiFilter-options {
border-top: 1px solid var(--sidebar-border);
overflow: hidden;
transition: max-height 0.25s ease, opacity 0.2s ease;
max-height: 500px;
opacity: 1;
}
.multiFilter-options.collapsed {
max-height: 0;
opacity: 0;
border-top: none;
}
.multiFilter-option {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
cursor: pointer;
transition: background 0.15s ease;
font-size: 13px;
color: var(--sidebar-fg);
}
.multiFilter-option:hover {
background: var(--sidebar-hover);
color: var(--sidebar-fg-active);
}
.multiFilter-option .option-checkbox {
width: 16px;
height: 16px;
border: 2px solid ${cssManager.bdTheme('#d4d4d4', '#525252')};
border-radius: 4px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.15s ease;
flex-shrink: 0;
}
.multiFilter-option .option-checkbox.checked {
background: var(--sidebar-accent);
border-color: var(--sidebar-accent);
}
.multiFilter-option .option-checkbox dees-icon {
font-size: 12px;
color: ${cssManager.bdTheme('#fafafa', '#0a0a0a')};
}
.multiFilter-option dees-icon.option-icon {
font-size: 14px;
opacity: 0.7;
}
/* Divider */
.menuDivider {
height: 1px;
background: var(--sidebar-border);
margin: 8px 12px;
}
:host([collapsed]) .menuDivider {
margin: 8px 4px;
}
/* Header/Label */
.menuHeader {
padding: 12px 12px 4px 12px;
font-size: 10px;
font-weight: 600;
color: var(--sidebar-fg-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
}
:host([collapsed]) .menuHeader {
display: none;
}
/* Link Item */
.menuItem.link .external-icon {
font-size: 12px;
opacity: 0.5;
margin-left: auto;
}
/* Collapsed menu item styles */ /* Collapsed menu item styles */
:host([collapsed]) .menuItem { :host([collapsed]) .menuItem {
justify-content: center; justify-content: center;
@@ -357,6 +597,15 @@ export class DeesAppuiSecondarymenu extends DeesElement {
left: -4px; left: -4px;
} }
:host([collapsed]) .menuItem .filter-checkbox,
:host([collapsed]) .menuItem .external-icon {
display: none;
}
:host([collapsed]) .multiFilter {
display: none;
}
/* Tooltip for collapsed state */ /* Tooltip for collapsed state */
.item-tooltip { .item-tooltip {
position: absolute; position: absolute;
@@ -431,17 +680,17 @@ export class DeesAppuiSecondarymenu extends DeesElement {
display: none; display: none;
} }
/* Divider */ /* Legacy options container */
.legacyOptions {
padding: 0 8px;
}
/* Divider (legacy) */
.divider { .divider {
height: 1px; height: 1px;
background: var(--sidebar-border); background: var(--sidebar-border);
margin: 8px 12px; margin: 8px 12px;
} }
/* Legacy options container */
.legacyOptions {
padding: 0 8px;
}
`, `,
]; ];
@@ -472,28 +721,58 @@ export class DeesAppuiSecondarymenu extends DeesElement {
@click="${() => this.toggleGroup(group.name)}" @click="${() => this.toggleGroup(group.name)}"
> >
<span class="groupTitle"> <span class="groupTitle">
${group.iconName ? html`<dees-icon .icon="${group.iconName.startsWith('lucide:') ? group.iconName : `lucide:${group.iconName}`}"></dees-icon>` : ''} ${group.iconName ? html`<dees-icon .icon="${this.normalizeIcon(group.iconName)}"></dees-icon>` : ''}
${group.name} ${group.name}
</span> </span>
<dees-icon class="chevron" .icon="${'lucide:chevronDown'}"></dees-icon> <dees-icon class="chevron" .icon="${'lucide:chevronDown'}"></dees-icon>
</div> </div>
<div class="groupItems ${this.collapsedGroups.has(group.name) ? 'collapsed' : ''}"> <div class="groupItems ${this.collapsedGroups.has(group.name) ? 'collapsed' : ''}">
${group.items.map((item) => this.renderMenuItem(item, group))} ${group.items.map((item) => this.renderItem(item, group))}
</div> </div>
</div> </div>
`)} `)}
`; `;
} }
private renderMenuItem(item: interfaces.IMenuItem, group?: interfaces.IMenuGroup): TemplateResult { private renderItem(item: interfaces.ISecondaryMenuItem, group?: interfaces.ISecondaryMenuGroup): TemplateResult {
// Check for hidden items
if ('hidden' in item && item.hidden) {
return html``;
}
// Determine item type
const itemType = 'type' in item ? item.type : 'tab';
switch (itemType) {
case 'action':
return this.renderActionItem(item as interfaces.ISecondaryMenuItemAction);
case 'filter':
return this.renderFilterItem(item as interfaces.ISecondaryMenuItemFilter);
case 'multiFilter':
return this.renderMultiFilterItem(item as interfaces.ISecondaryMenuItemMultiFilter);
case 'divider':
return this.renderDivider();
case 'header':
return this.renderHeader(item as interfaces.ISecondaryMenuItemHeader);
case 'link':
return this.renderLinkItem(item as interfaces.ISecondaryMenuItemLink);
case 'tab':
default:
return this.renderTabItem(item as interfaces.ISecondaryMenuItemTab, group);
}
}
private renderTabItem(item: interfaces.ISecondaryMenuItemTab, group?: interfaces.ISecondaryMenuGroup): TemplateResult {
const isSelected = this.selectedItem?.key === item.key; const isSelected = this.selectedItem?.key === item.key;
const isDisabled = item.disabled === true;
return html` return html`
<div <div
class="menuItem ${isSelected ? 'selected' : ''}" class="menuItem ${isSelected ? 'selected' : ''} ${isDisabled ? 'disabled' : ''}"
@click="${() => this.selectItem(item, group)}" @click="${() => !isDisabled && this.selectTabItem(item, group)}"
@contextmenu="${(e: MouseEvent) => this.handleContextMenu(e, item)}" @contextmenu="${(e: MouseEvent) => this.handleContextMenu(e, item)}"
> >
${item.iconName ? html`<dees-icon .icon="${item.iconName.startsWith('lucide:') ? item.iconName : `lucide:${item.iconName}`}"></dees-icon>` : ''} ${item.iconName ? html`<dees-icon .icon="${this.normalizeIcon(item.iconName)}"></dees-icon>` : ''}
<span class="itemLabel">${item.key}</span> <span class="itemLabel">${item.key}</span>
${item.badge !== undefined ? html` ${item.badge !== undefined ? html`
<span class="badge ${item.badgeVariant || 'default'}">${item.badge}</span> <span class="badge ${item.badgeVariant || 'default'}">${item.badge}</span>
@@ -503,6 +782,100 @@ export class DeesAppuiSecondarymenu extends DeesElement {
`; `;
} }
private renderActionItem(item: interfaces.ISecondaryMenuItemAction): TemplateResult {
const variant = item.variant || 'primary';
const isDisabled = item.disabled === true;
return html`
<div
class="menuItem action-${variant} ${isDisabled ? 'disabled' : ''}"
@click="${() => !isDisabled && this.handleActionClick(item)}"
>
${item.iconName ? html`<dees-icon .icon="${this.normalizeIcon(item.iconName)}"></dees-icon>` : ''}
<span class="itemLabel">${item.key}</span>
<span class="item-tooltip">${item.key}</span>
</div>
`;
}
private renderFilterItem(item: interfaces.ISecondaryMenuItemFilter): TemplateResult {
const isDisabled = item.disabled === true;
return html`
<div
class="menuItem filter ${item.active ? 'active' : ''} ${isDisabled ? 'disabled' : ''}"
@click="${() => !isDisabled && this.handleFilterToggle(item)}"
>
${item.iconName ? html`<dees-icon .icon="${this.normalizeIcon(item.iconName)}"></dees-icon>` : ''}
<span class="itemLabel">${item.key}</span>
<div class="filter-checkbox ${item.active ? 'checked' : ''}">
${item.active ? html`<dees-icon .icon="${'lucide:check'}"></dees-icon>` : ''}
</div>
<span class="item-tooltip">${item.key}</span>
</div>
`;
}
private renderMultiFilterItem(item: interfaces.ISecondaryMenuItemMultiFilter): TemplateResult {
const isCollapsed = this.collapsedMultiFilters.has(item.key);
const checkedCount = item.options.filter(opt => opt.checked).length;
return html`
<div class="multiFilter">
<div
class="multiFilter-header ${isCollapsed ? 'collapsed' : ''}"
@click="${() => this.toggleMultiFilter(item.key)}"
>
<span class="multiFilter-title">
${item.iconName ? html`<dees-icon .icon="${this.normalizeIcon(item.iconName)}"></dees-icon>` : ''}
${item.key}
</span>
${checkedCount > 0 ? html`<span class="multiFilter-count">${checkedCount}</span>` : ''}
<dees-icon class="chevron" .icon="${'lucide:chevronDown'}"></dees-icon>
</div>
<div class="multiFilter-options ${isCollapsed ? 'collapsed' : ''}">
${item.options.map(option => html`
<div
class="multiFilter-option"
@click="${() => this.handleMultiFilterOptionToggle(item, option.key)}"
>
<div class="option-checkbox ${option.checked ? 'checked' : ''}">
${option.checked ? html`<dees-icon .icon="${'lucide:check'}"></dees-icon>` : ''}
</div>
${option.iconName ? html`<dees-icon class="option-icon" .icon="${this.normalizeIcon(option.iconName)}"></dees-icon>` : ''}
<span>${option.label}</span>
</div>
`)}
</div>
</div>
`;
}
private renderDivider(): TemplateResult {
return html`<div class="menuDivider"></div>`;
}
private renderHeader(item: interfaces.ISecondaryMenuItemHeader): TemplateResult {
return html`<div class="menuHeader">${item.label}</div>`;
}
private renderLinkItem(item: interfaces.ISecondaryMenuItemLink): TemplateResult {
const isExternal = item.external ?? item.href.startsWith('http');
const isDisabled = item.disabled === true;
return html`
<div
class="menuItem link ${isDisabled ? 'disabled' : ''}"
@click="${() => !isDisabled && this.handleLinkClick(item)}"
>
${item.iconName ? html`<dees-icon .icon="${this.normalizeIcon(item.iconName)}"></dees-icon>` : ''}
<span class="itemLabel">${item.key}</span>
${isExternal ? html`<dees-icon class="external-icon" .icon="${'lucide:externalLink'}"></dees-icon>` : ''}
<span class="item-tooltip">${item.key}</span>
</div>
`;
}
private renderLegacyOptions(): TemplateResult { private renderLegacyOptions(): TemplateResult {
return html` return html`
<div class="legacyOptions"> <div class="legacyOptions">
@@ -511,16 +884,25 @@ export class DeesAppuiSecondarymenu extends DeesElement {
return html`<div class="divider"></div>`; return html`<div class="divider"></div>`;
} }
const item = option as interfaces.IMenuItem; const item = option as interfaces.IMenuItem;
return this.renderMenuItem({ // Convert legacy IMenuItem to ISecondaryMenuItemTab
const tabItem: interfaces.ISecondaryMenuItemTab = {
key: item.key, key: item.key,
iconName: item.iconName, iconName: item.iconName,
action: item.action, action: item.action,
}); badge: item.badge,
badgeVariant: item.badgeVariant,
};
return this.renderTabItem(tabItem);
})} })}
</div> </div>
`; `;
} }
// Helper to normalize icon names
private normalizeIcon(iconName: string): string {
return iconName.startsWith('lucide:') ? iconName : `lucide:${iconName}`;
}
private toggleGroup(groupName: string): void { private toggleGroup(groupName: string): void {
const newCollapsed = new Set(this.collapsedGroups); const newCollapsed = new Set(this.collapsedGroups);
if (newCollapsed.has(groupName)) { if (newCollapsed.has(groupName)) {
@@ -531,6 +913,16 @@ export class DeesAppuiSecondarymenu extends DeesElement {
this.collapsedGroups = newCollapsed; this.collapsedGroups = newCollapsed;
} }
private toggleMultiFilter(filterKey: string): void {
const newCollapsed = new Set(this.collapsedMultiFilters);
if (newCollapsed.has(filterKey)) {
newCollapsed.delete(filterKey);
} else {
newCollapsed.add(filterKey);
}
this.collapsedMultiFilters = newCollapsed;
}
public toggleCollapse(): void { public toggleCollapse(): void {
this.collapsed = !this.collapsed; this.collapsed = !this.collapsed;
this.dispatchEvent(new CustomEvent('collapse-change', { this.dispatchEvent(new CustomEvent('collapse-change', {
@@ -540,7 +932,7 @@ export class DeesAppuiSecondarymenu extends DeesElement {
})); }));
} }
private selectItem(item: interfaces.IMenuItem, group?: interfaces.IMenuGroup): void { private selectTabItem(item: interfaces.ISecondaryMenuItemTab, group?: interfaces.ISecondaryMenuGroup): void {
this.selectedItem = item; this.selectedItem = item;
item.action(); item.action();
@@ -551,7 +943,81 @@ export class DeesAppuiSecondarymenu extends DeesElement {
})); }));
} }
private handleContextMenu(event: MouseEvent, item: interfaces.IMenuItem): void { private async handleActionClick(item: interfaces.ISecondaryMenuItemAction): Promise<void> {
// Handle confirmation if required
if (item.confirmMessage) {
const confirmed = window.confirm(item.confirmMessage);
if (!confirmed) {
return;
}
}
await item.action();
this.dispatchEvent(new CustomEvent('action-click', {
detail: { item },
bubbles: true,
composed: true
}));
}
private handleFilterToggle(item: interfaces.ISecondaryMenuItemFilter): void {
const newActive = !item.active;
// Update the item's active state
item.active = newActive;
item.onToggle(newActive);
// Force re-render by incrementing the render counter
this.renderCounter++;
this.dispatchEvent(new CustomEvent('filter-toggle', {
detail: { item, active: newActive },
bubbles: true,
composed: true
}));
}
private handleMultiFilterOptionToggle(item: interfaces.ISecondaryMenuItemMultiFilter, optionKey: string): void {
// Update the option's checked state
const option = item.options.find(opt => opt.key === optionKey);
if (option) {
option.checked = !option.checked;
}
// Calculate the new selected keys
const selectedKeys = item.options
.filter(opt => opt.checked)
.map(opt => opt.key);
item.onChange(selectedKeys);
// Force re-render by incrementing the render counter
this.renderCounter++;
this.dispatchEvent(new CustomEvent('multifilter-change', {
detail: { item, selectedKeys },
bubbles: true,
composed: true
}));
}
private handleLinkClick(item: interfaces.ISecondaryMenuItemLink): void {
const isExternal = item.external ?? item.href.startsWith('http');
if (isExternal) {
window.open(item.href, '_blank', 'noopener,noreferrer');
} else {
window.location.href = item.href;
}
this.dispatchEvent(new CustomEvent('link-click', {
detail: { item },
bubbles: true,
composed: true
}));
}
private handleContextMenu(event: MouseEvent, item: interfaces.ISecondaryMenuItemTab): void {
DeesContextmenu.openContextMenuWithOptions(event, [ DeesContextmenu.openContextMenuWithOptions(event, [
{ {
name: 'View details', name: 'View details',
@@ -572,26 +1038,52 @@ export class DeesAppuiSecondarymenu extends DeesElement {
// Initialize collapsed state from group defaults // Initialize collapsed state from group defaults
if (this.groups.length > 0) { if (this.groups.length > 0) {
const initialCollapsed = new Set<string>(); const initialCollapsed = new Set<string>();
const initialMultiFilterCollapsed = new Set<string>();
this.groups.forEach(group => { this.groups.forEach(group => {
if (group.collapsed) { if (group.collapsed) {
initialCollapsed.add(group.name); initialCollapsed.add(group.name);
} }
});
this.collapsedGroups = initialCollapsed;
// Auto-select first item if none selected // Check for collapsed multi-filters
if (!this.selectedItem && this.groups[0]?.items.length > 0) { group.items.forEach(item => {
this.selectItem(this.groups[0].items[0], this.groups[0]); if ('type' in item && item.type === 'multiFilter') {
const multiFilter = item as interfaces.ISecondaryMenuItemMultiFilter;
if (multiFilter.collapsed) {
initialMultiFilterCollapsed.add(multiFilter.key);
}
}
});
});
this.collapsedGroups = initialCollapsed;
this.collapsedMultiFilters = initialMultiFilterCollapsed;
// Auto-select first tab item if none selected
if (!this.selectedItem) {
for (const group of this.groups) {
for (const item of group.items) {
const itemType = 'type' in item ? item.type : 'tab';
if (itemType === 'tab' || itemType === undefined) {
const tabItem = item as interfaces.ISecondaryMenuItemTab;
if (!tabItem.disabled) {
this.selectTabItem(tabItem, group);
return;
}
}
}
}
} }
} else if (this.selectionOptions.length > 0) { } else if (this.selectionOptions.length > 0) {
// Legacy mode: select first non-divider option // Legacy mode: select first non-divider option
const firstOption = this.selectionOptions.find(opt => !('divider' in opt)) as interfaces.IMenuItem; const firstOption = this.selectionOptions.find(opt => !('divider' in opt)) as interfaces.IMenuItem;
if (firstOption && !this.selectedItem) { if (firstOption && !this.selectedItem) {
this.selectItem({ const tabItem: interfaces.ISecondaryMenuItemTab = {
key: firstOption.key, key: firstOption.key,
iconName: firstOption.iconName, iconName: firstOption.iconName,
action: firstOption.action, action: firstOption.action,
}); };
this.selectTabItem(tabItem);
} }
} }
} }

View File

@@ -1,6 +1,7 @@
import { html, css, DeesElement, customElement, state } from '@design.estate/dees-element'; import { html, css, DeesElement, customElement, state } from '@design.estate/dees-element';
import type { DeesAppuiBase } from './dees-appui-base.js'; import type { DeesAppui } from './dees-appui.js';
import type { IAppConfig, IViewActivationContext } from '../../interfaces/appconfig.js'; import type { IAppConfig, IViewActivationContext } from '../../interfaces/appconfig.js';
import type * as interfaces from '../../interfaces/index.js';
import '@design.estate/dees-wcctools/demotools'; import '@design.estate/dees-wcctools/demotools';
// Demo view component with lifecycle hooks // Demo view component with lifecycle hooks
@@ -16,7 +17,7 @@ class DemoDashboardView extends DeesElement {
this.activated = true; this.activated = true;
console.log('Dashboard activated with context:', context); console.log('Dashboard activated with context:', context);
// Set view-specific secondary menu // Set view-specific secondary menu with new item types
context.appui.setSecondaryMenu({ context.appui.setSecondaryMenu({
heading: 'Dashboard', heading: 'Dashboard',
groups: [ groups: [
@@ -24,17 +25,36 @@ class DemoDashboardView extends DeesElement {
name: 'Quick Access', name: 'Quick Access',
iconName: 'lucide:zap', iconName: 'lucide:zap',
items: [ items: [
{ key: 'overview', iconName: 'layoutDashboard', action: () => console.log('Overview') }, { key: 'Overview', iconName: 'layoutDashboard', action: () => console.log('Overview') },
{ key: 'recent', iconName: 'clock', badge: 5, action: () => console.log('Recent') }, { key: 'Recent', iconName: 'clock', badge: 5, action: () => console.log('Recent') },
] { type: 'divider' },
{ type: 'action', key: 'Refresh Data', iconName: 'lucide:refreshCw', action: () => alert('Refreshing dashboard data...') },
] as interfaces.ISecondaryMenuItem[]
},
{
name: 'Filters',
iconName: 'lucide:filter',
items: [
{ type: 'header', label: 'Time Range' },
{ type: 'filter', key: 'Live Updates', iconName: 'lucide:radio', active: true, onToggle: (active) => console.log('Live updates:', active) },
{ type: 'filter', key: 'Show Archived', iconName: 'lucide:archive', active: false, onToggle: (active) => console.log('Show archived:', active) },
{ type: 'divider' },
{ type: 'multiFilter', key: 'Data Sources', iconName: 'lucide:database', options: [
{ key: 'api', label: 'API Server', checked: true, iconName: 'lucide:server' },
{ key: 'web', label: 'Web Traffic', checked: true, iconName: 'lucide:globe' },
{ key: 'mobile', label: 'Mobile App', checked: false, iconName: 'lucide:smartphone' },
], onChange: (keys) => console.log('Data sources:', keys) },
] as interfaces.ISecondaryMenuItem[]
}, },
{ {
name: 'Analytics', name: 'Analytics',
iconName: 'lucide:barChart3', iconName: 'lucide:barChart3',
items: [ items: [
{ key: 'metrics', iconName: 'activity', action: () => console.log('Metrics') }, { key: 'Metrics', iconName: 'activity', action: () => console.log('Metrics') },
{ key: 'reports', iconName: 'fileText', badge: 'new', badgeVariant: 'success', action: () => console.log('Reports') }, { key: 'Reports', iconName: 'fileText', badge: 'new', badgeVariant: 'success', action: () => console.log('Reports') },
] { type: 'divider' },
{ type: 'link', key: 'Analytics Docs', iconName: 'lucide:externalLink', href: 'https://docs.example.com/analytics' },
] as interfaces.ISecondaryMenuItem[]
} }
] ]
}); });
@@ -197,7 +217,7 @@ class DemoSettingsView extends DeesElement {
@state() @state()
accessor hasChanges: boolean = false; accessor hasChanges: boolean = false;
private appui: DeesAppuiBase; private appui: DeesAppui;
onActivate(context: IViewActivationContext) { onActivate(context: IViewActivationContext) {
this.appui = context.appui as any; this.appui = context.appui as any;
@@ -322,11 +342,22 @@ class DemoProjectsView extends DeesElement {
groups: [ groups: [
{ {
name: 'My Projects', name: 'My Projects',
iconName: 'lucide:folder',
items: [ items: [
{ key: 'active', iconName: 'folder', badge: 3, action: () => console.log('Active') }, { key: 'Active', iconName: 'folder', badge: 3, action: () => console.log('Active') },
{ key: 'archived', iconName: 'archive', action: () => console.log('Archived') }, { key: 'Archived', iconName: 'archive', action: () => console.log('Archived') },
{ key: 'shared', iconName: 'users', badge: 2, badgeVariant: 'warning', action: () => console.log('Shared') }, { key: 'Shared', iconName: 'users', badge: 2, badgeVariant: 'warning', action: () => console.log('Shared') },
] ] as interfaces.ISecondaryMenuItem[]
},
{
name: 'Quick Actions',
iconName: 'lucide:zap',
items: [
{ type: 'action', key: 'New Project', iconName: 'lucide:folderPlus', action: () => alert('Create new project') },
{ type: 'action', key: 'Import', iconName: 'lucide:download', action: () => alert('Import project') },
{ type: 'divider' },
{ type: 'link', key: 'Templates', iconName: 'lucide:layoutTemplate', href: 'https://templates.example.com' },
] as interfaces.ISecondaryMenuItem[]
} }
] ]
}); });
@@ -407,13 +438,40 @@ class DemoTasksView extends DeesElement {
heading: 'Tasks', heading: 'Tasks',
groups: [ groups: [
{ {
name: 'Filters', name: 'Views',
iconName: 'lucide:eye',
items: [ items: [
{ key: 'all', iconName: 'list', badge: 12, action: () => console.log('All') }, { key: 'All Tasks', iconName: 'list', badge: 12, action: () => console.log('All') },
{ key: 'today', iconName: 'calendar', badge: 3, action: () => console.log('Today') }, { key: 'Today', iconName: 'calendar', badge: 3, action: () => console.log('Today') },
{ key: 'upcoming', iconName: 'clock', action: () => console.log('Upcoming') }, { key: 'Upcoming', iconName: 'clock', action: () => console.log('Upcoming') },
{ key: 'completed', iconName: 'checkCircle', action: () => console.log('Completed') }, { key: 'Completed', iconName: 'checkCircle', action: () => console.log('Completed') },
] ] as interfaces.ISecondaryMenuItem[]
},
{
name: 'Filters',
iconName: 'lucide:filter',
items: [
{ type: 'header', label: 'Priority' },
{ type: 'multiFilter', key: 'Priority', iconName: 'lucide:flag', options: [
{ key: 'high', label: 'High', checked: true, iconName: 'lucide:alertCircle' },
{ key: 'medium', label: 'Medium', checked: true, iconName: 'lucide:minusCircle' },
{ key: 'low', label: 'Low', checked: false, iconName: 'lucide:circle' },
], onChange: (keys) => console.log('Priority filter:', keys) },
{ type: 'divider' },
{ type: 'header', label: 'Options' },
{ type: 'filter', key: 'Show Subtasks', iconName: 'lucide:listTree', active: true, onToggle: (active) => console.log('Show subtasks:', active) },
{ type: 'filter', key: 'Show Completed', iconName: 'lucide:checkSquare', active: false, onToggle: (active) => console.log('Show completed:', active) },
] as interfaces.ISecondaryMenuItem[]
},
{
name: 'Actions',
iconName: 'lucide:zap',
items: [
{ type: 'action', key: 'Add Task', iconName: 'lucide:plus', action: () => alert('Add new task') },
{ type: 'action', key: 'Import Tasks', iconName: 'lucide:upload', action: () => alert('Import tasks') },
{ type: 'divider' },
{ type: 'action', key: 'Clear Completed', iconName: 'lucide:trash2', variant: 'danger', confirmMessage: 'Delete all completed tasks?', action: () => alert('Cleared completed tasks') },
] as interfaces.ISecondaryMenuItem[]
} }
] ]
}); });
@@ -619,7 +677,7 @@ export const demoFunc = () => {
containerElement.className = 'demo-container'; containerElement.className = 'demo-container';
containerElement.style.cssText = 'position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden;'; containerElement.style.cssText = 'position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden;';
const appuiElement = document.createElement('dees-appui-base') as DeesAppuiBase; const appuiElement = document.createElement('dees-appui') as DeesAppui;
containerElement.appendChild(appuiElement); containerElement.appendChild(appuiElement);
// Initialize after element is connected // Initialize after element is connected

View File

@@ -15,7 +15,7 @@ import type { DeesAppuiMainmenu } from '../dees-appui-mainmenu/dees-appui-mainme
import type { DeesAppuiSecondarymenu } from '../dees-appui-secondarymenu/dees-appui-secondarymenu.js'; import type { DeesAppuiSecondarymenu } from '../dees-appui-secondarymenu/dees-appui-secondarymenu.js';
import type { DeesAppuiMaincontent } from '../dees-appui-maincontent/dees-appui-maincontent.js'; import type { DeesAppuiMaincontent } from '../dees-appui-maincontent/dees-appui-maincontent.js';
import type { DeesAppuiActivitylog } from '../dees-appui-activitylog/dees-appui-activitylog.js'; import type { DeesAppuiActivitylog } from '../dees-appui-activitylog/dees-appui-activitylog.js';
import { demoFunc } from './dees-appui-base.demo.js'; import { demoFunc } from './dees-appui.demo.js';
import { themeDefaultStyles } from '../../00theme.js'; import { themeDefaultStyles } from '../../00theme.js';
// View registry for managing views // View registry for managing views
@@ -30,12 +30,12 @@ import '../dees-appui-activitylog/dees-appui-activitylog.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
'dees-appui-base': DeesAppuiBase; 'dees-appui': DeesAppui;
} }
} }
@customElement('dees-appui-base') @customElement('dees-appui')
export class DeesAppuiBase extends DeesElement { export class DeesAppui extends DeesElement {
public static demo = demoFunc; public static demo = demoFunc;
// ========================================== // ==========================================
@@ -98,10 +98,10 @@ export class DeesAppuiBase extends DeesElement {
accessor secondarymenuHeading: string = ''; accessor secondarymenuHeading: string = '';
@property({ type: Array }) @property({ type: Array })
accessor secondarymenuGroups: interfaces.IMenuGroup[] = []; accessor secondarymenuGroups: interfaces.ISecondaryMenuGroup[] = [];
@property({ type: Object }) @property({ type: Object })
accessor secondarymenuSelectedItem: interfaces.IMenuItem | undefined = undefined; accessor secondarymenuSelectedItem: interfaces.ISecondaryMenuItemTab | undefined = undefined;
// Collapse states // Collapse states
@property({ type: Boolean }) @property({ type: Boolean })
@@ -126,6 +126,13 @@ export class DeesAppuiBase extends DeesElement {
@property({ type: Number }) @property({ type: Number })
accessor contentTabsAutoHideThreshold: number = 0; accessor contentTabsAutoHideThreshold: number = 0;
// Activity log visibility and count
@state()
accessor activityLogVisible: boolean = false;
@state()
accessor activityLogCount: number = 0;
// Properties for maincontent // Properties for maincontent
@property({ type: Array }) @property({ type: Array })
accessor maincontentTabs: interfaces.IMenuItem[] = []; accessor maincontentTabs: interfaces.IMenuItem[] = [];
@@ -175,8 +182,9 @@ export class DeesAppuiBase extends DeesElement {
height: calc(100% - 40px); height: calc(100% - 40px);
width: 100%; width: 100%;
display: grid; display: grid;
grid-template-columns: auto auto 1fr 240px; /* grid-template-columns set dynamically in template */
grid-template-rows: 1fr; grid-template-rows: 1fr;
transition: grid-template-columns 0.3s ease;
} }
/* Z-index layering for proper stacking */ /* Z-index layering for proper stacking */
@@ -198,6 +206,19 @@ export class DeesAppuiBase extends DeesElement {
.maingrid > dees-appui-activitylog { .maingrid > dees-appui-activitylog {
position: relative; position: relative;
z-index: 1; z-index: 1;
overflow: hidden;
transition: opacity 0.3s ease, transform 0.3s ease;
}
.maingrid > dees-appui-activitylog.hidden {
opacity: 0;
transform: translateX(20px);
pointer-events: none;
}
.maingrid > dees-appui-activitylog.visible {
opacity: 1;
transform: translateX(0);
} }
/* View container for dynamically loaded views */ /* View container for dynamically loaded views */
@@ -221,14 +242,18 @@ export class DeesAppuiBase extends DeesElement {
.user=${this.appbarUser} .user=${this.appbarUser}
.profileMenuItems=${this.appbarProfileMenuItems} .profileMenuItems=${this.appbarProfileMenuItems}
.showSearch=${this.appbarShowSearch} .showSearch=${this.appbarShowSearch}
.showActivityLogToggle=${true}
.activityLogCount=${this.activityLogCount}
.activityLogActive=${this.activityLogVisible}
@menu-select=${(e: CustomEvent) => this.handleAppbarMenuSelect(e)} @menu-select=${(e: CustomEvent) => this.handleAppbarMenuSelect(e)}
@breadcrumb-navigate=${(e: CustomEvent) => this.handleAppbarBreadcrumbNavigate(e)} @breadcrumb-navigate=${(e: CustomEvent) => this.handleAppbarBreadcrumbNavigate(e)}
@search-click=${() => this.handleAppbarSearchClick()} @search-click=${() => this.handleAppbarSearchClick()}
@search-query=${(e: CustomEvent) => this.handleAppbarSearchQuery(e)} @search-query=${(e: CustomEvent) => this.handleAppbarSearchQuery(e)}
@user-menu-open=${() => this.handleAppbarUserMenuOpen()} @user-menu-open=${() => this.handleAppbarUserMenuOpen()}
@profile-menu-select=${(e: CustomEvent) => this.handleAppbarProfileMenuSelect(e)} @profile-menu-select=${(e: CustomEvent) => this.handleAppbarProfileMenuSelect(e)}
@activity-toggle=${() => this.toggleActivityLog()}
></dees-appui-appbar> ></dees-appui-appbar>
<div class="maingrid"> <div class="maingrid" style="grid-template-columns: auto auto 1fr ${this.activityLogVisible ? '280px' : '0px'};">
${this.mainmenuVisible ? html` ${this.mainmenuVisible ? html`
<dees-appui-mainmenu <dees-appui-mainmenu
.logoIcon=${this.mainmenuLogoIcon} .logoIcon=${this.mainmenuLogoIcon}
@@ -264,7 +289,9 @@ export class DeesAppuiBase extends DeesElement {
<div class="view-container"></div> <div class="view-container"></div>
<slot name="maincontent"></slot> <slot name="maincontent"></slot>
</dees-appui-maincontent> </dees-appui-maincontent>
<dees-appui-activitylog></dees-appui-activitylog> <dees-appui-activitylog
class="${this.activityLogVisible ? 'visible' : 'hidden'}"
></dees-appui-activitylog>
</div> </div>
`; `;
} }
@@ -277,8 +304,15 @@ export class DeesAppuiBase extends DeesElement {
this.maincontent = this.shadowRoot!.querySelector('dees-appui-maincontent') as DeesAppuiMaincontent; this.maincontent = this.shadowRoot!.querySelector('dees-appui-maincontent') as DeesAppuiMaincontent;
this.activitylogElement = this.shadowRoot!.querySelector('dees-appui-activitylog') as DeesAppuiActivitylog; this.activitylogElement = this.shadowRoot!.querySelector('dees-appui-activitylog') as DeesAppuiActivitylog;
// Subscribe to activity log entry changes for badge count
if (this.activitylogElement) {
this.activitylogElement.entries$.subscribe((entries) => {
this.activityLogCount = entries.length;
});
}
// Set appui reference in view registry for lifecycle context // Set appui reference in view registry for lifecycle context
this.viewRegistry.setAppuiRef(this as unknown as interfaces.TDeesAppuiBase); this.viewRegistry.setAppuiRef(this as unknown as interfaces.TDeesAppui);
} }
async disconnectedCallback() { async disconnectedCallback() {
@@ -534,7 +568,7 @@ export class DeesAppuiBase extends DeesElement {
/** /**
* Set the secondary menu configuration * Set the secondary menu configuration
*/ */
public setSecondaryMenu(config: { heading?: string; groups: interfaces.IMenuGroup[] }): void { public setSecondaryMenu(config: { heading?: string; groups: interfaces.ISecondaryMenuGroup[] }): void {
if (config.heading !== undefined) { if (config.heading !== undefined) {
this.secondarymenuHeading = config.heading; this.secondarymenuHeading = config.heading;
} }
@@ -544,7 +578,7 @@ export class DeesAppuiBase extends DeesElement {
/** /**
* Update a specific secondary menu group * Update a specific secondary menu group
*/ */
public updateSecondaryMenuGroup(groupName: string, update: Partial<interfaces.IMenuGroup>): void { public updateSecondaryMenuGroup(groupName: string, update: Partial<interfaces.ISecondaryMenuGroup>): void {
this.secondarymenuGroups = this.secondarymenuGroups.map(group => this.secondarymenuGroups = this.secondarymenuGroups.map(group =>
group.name === groupName ? { ...group, ...update } : group group.name === groupName ? { ...group, ...update } : group
); );
@@ -555,7 +589,7 @@ export class DeesAppuiBase extends DeesElement {
*/ */
public addSecondaryMenuItem( public addSecondaryMenuItem(
groupName: string, groupName: string,
item: interfaces.IMenuGroup['items'][0] item: interfaces.ISecondaryMenuItem
): void { ): void {
this.secondarymenuGroups = this.secondarymenuGroups.map(group => { this.secondarymenuGroups = this.secondarymenuGroups.map(group => {
if (group.name === groupName) { if (group.name === groupName) {
@@ -569,13 +603,13 @@ export class DeesAppuiBase extends DeesElement {
} }
/** /**
* Set the selected secondary menu item by key * Set the selected secondary menu item by key (for tab items only)
*/ */
public setSecondaryMenuSelection(itemKey: string): void { public setSecondaryMenuSelection(itemKey: string): void {
for (const group of this.secondarymenuGroups) { for (const group of this.secondarymenuGroups) {
const item = group.items.find(i => i.key === itemKey); const item = group.items.find(i => 'key' in i && i.key === itemKey);
if (item) { if (item && (!('type' in item) || item.type === 'tab' || item.type === undefined)) {
this.secondarymenuSelectedItem = item; this.secondarymenuSelectedItem = item as interfaces.ISecondaryMenuItemTab;
return; return;
} }
} }
@@ -673,6 +707,27 @@ export class DeesAppuiBase extends DeesElement {
}; };
} }
/**
* Set activity log visibility
*/
public setActivityLogVisible(visible: boolean): void {
this.activityLogVisible = visible;
}
/**
* Toggle activity log visibility
*/
public toggleActivityLog(): void {
this.activityLogVisible = !this.activityLogVisible;
}
/**
* Get activity log visibility state
*/
public getActivityLogVisible(): boolean {
return this.activityLogVisible;
}
// ========================================== // ==========================================
// PROGRAMMATIC API: NAVIGATION // PROGRAMMATIC API: NAVIGATION
// ========================================== // ==========================================

View File

@@ -0,0 +1,2 @@
export * from './dees-appui.js';
export * from './view.registry.js';

View File

@@ -1,4 +1,4 @@
# DeesAppuiBase # DeesAppui
A comprehensive application shell component providing a complete UI framework with navigation, menus, activity logging, and view management. A comprehensive application shell component providing a complete UI framework with navigation, menus, activity logging, and view management.
@@ -6,14 +6,14 @@ A comprehensive application shell component providing a complete UI framework wi
```typescript ```typescript
import { html, DeesElement, customElement } from '@design.estate/dees-element'; import { html, DeesElement, customElement } from '@design.estate/dees-element';
import { DeesAppuiBase } from '@design.estate/dees-catalog'; import { DeesAppui } from '@design.estate/dees-catalog';
@customElement('my-app') @customElement('my-app')
class MyApp extends DeesElement { class MyApp extends DeesElement {
private appui: DeesAppuiBase; private appui: DeesAppui;
async firstUpdated() { async firstUpdated() {
this.appui = this.shadowRoot.querySelector('dees-appui-base'); this.appui = this.shadowRoot.querySelector('dees-appui');
// Configure with views and menu // Configure with views and menu
this.appui.configure({ this.appui.configure({
@@ -30,7 +30,7 @@ class MyApp extends DeesElement {
} }
render() { render() {
return html`<dees-appui-base></dees-appui-base>`; return html`<dees-appui></dees-appui>`;
} }
} }
``` ```
@@ -329,7 +329,7 @@ class MySettingsView extends DeesElement implements IViewLifecycle {
```typescript ```typescript
interface IViewActivationContext { interface IViewActivationContext {
appui: DeesAppuiBase; // Reference to the app shell appui: DeesAppui; // Reference to the app shell
viewId: string; // The view ID being activated viewId: string; // The view ID being activated
params?: Record<string, string>; // Route parameters params?: Record<string, string>; // Route parameters
} }
@@ -421,14 +421,14 @@ appui.viewChanged$.subscribe((event) => {
```typescript ```typescript
import { html, DeesElement, customElement } from '@design.estate/dees-element'; import { html, DeesElement, customElement } from '@design.estate/dees-element';
import { DeesAppuiBase, IViewActivationContext } from '@design.estate/dees-catalog'; import { DeesAppui, IViewActivationContext } from '@design.estate/dees-catalog';
@customElement('my-app') @customElement('my-app')
class MyApp extends DeesElement { class MyApp extends DeesElement {
private appui: DeesAppuiBase; private appui: DeesAppui;
async firstUpdated() { async firstUpdated() {
this.appui = this.shadowRoot.querySelector('dees-appui-base'); this.appui = this.shadowRoot.querySelector('dees-appui');
this.appui.configure({ this.appui.configure({
branding: { branding: {
@@ -494,14 +494,14 @@ class MyApp extends DeesElement {
} }
render() { render() {
return html`<dees-appui-base></dees-appui-base>`; return html`<dees-appui></dees-appui>`;
} }
} }
// View with lifecycle hooks // View with lifecycle hooks
@customElement('crm-settings') @customElement('crm-settings')
class CrmSettings extends DeesElement { class CrmSettings extends DeesElement {
private appui: DeesAppuiBase; private appui: DeesAppui;
onActivate(context: IViewActivationContext) { onActivate(context: IViewActivationContext) {
this.appui = context.appui; this.appui = context.appui;

View File

@@ -3,7 +3,7 @@ import type {
IViewDefinition, IViewDefinition,
IViewActivationContext, IViewActivationContext,
IViewLifecycle, IViewLifecycle,
TDeesAppuiBase TDeesAppui
} from '../../interfaces/appconfig.js'; } from '../../interfaces/appconfig.js';
/** /**
@@ -18,12 +18,12 @@ export class ViewRegistry {
private views: Map<string, IViewDefinition> = new Map(); private views: Map<string, IViewDefinition> = new Map();
private instances: Map<string, HTMLElement> = new Map(); private instances: Map<string, HTMLElement> = new Map();
private currentViewId: string | null = null; private currentViewId: string | null = null;
private appui: TDeesAppuiBase | null = null; private appui: TDeesAppui | null = null;
/** /**
* Set the appui reference for view activation context * Set the appui reference for view activation context
*/ */
public setAppuiRef(appui: TDeesAppuiBase): void { public setAppuiRef(appui: TDeesAppui): void {
this.appui = appui; this.appui = appui;
} }

View File

@@ -1,7 +1,7 @@
// App UI Components // App UI Components
export * from './dees-appui-activitylog/index.js'; export * from './dees-appui-activitylog/index.js';
export * from './dees-appui-appbar/index.js'; export * from './dees-appui-appbar/index.js';
export * from './dees-appui-base/index.js'; export * from './dees-appui/index.js';
export * from './dees-appui-maincontent/index.js'; export * from './dees-appui-maincontent/index.js';
export * from './dees-appui-mainmenu/index.js'; export * from './dees-appui-mainmenu/index.js';
export * from './dees-appui-secondarymenu/index.js'; export * from './dees-appui-secondarymenu/index.js';

View File

@@ -11,7 +11,8 @@ import { demoFunc } from './demo.js';
import { chartAreaStyles } from './styles.js'; import { chartAreaStyles } from './styles.js';
import { renderChartArea } from './template.js'; import { renderChartArea } from './template.js';
import ApexCharts from 'apexcharts'; import type ApexCharts from 'apexcharts';
import { DeesServiceLibLoader } from '../../../services/index.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -150,7 +151,10 @@ export class DeesChartArea extends DeesElement {
public async firstUpdated() { public async firstUpdated() {
await this.domtoolsPromise; await this.domtoolsPromise;
// Load ApexCharts from CDN
const ApexChartsLib = await DeesServiceLibLoader.getInstance().loadApexCharts();
// Wait for next animation frame to ensure layout is complete // Wait for next animation frame to ensure layout is complete
await new Promise(resolve => requestAnimationFrame(resolve)); await new Promise(resolve => requestAnimationFrame(resolve));
@@ -353,7 +357,7 @@ export class DeesChartArea extends DeesElement {
}; };
try { try {
this.chart = new ApexCharts(this.shadowRoot.querySelector('.chartContainer'), options); this.chart = new ApexChartsLib(this.shadowRoot.querySelector('.chartContainer'), options);
await this.chart.render(); await this.chart.render();
// Give the chart a moment to fully initialize before resizing // Give the chart a moment to fully initialize before resizing

View File

@@ -10,12 +10,13 @@ import {
} from '@design.estate/dees-element'; } from '@design.estate/dees-element';
import { cssGeistFontFamily, cssMonoFontFamily } from '../../00fonts.js'; import { cssGeistFontFamily, cssMonoFontFamily } from '../../00fonts.js';
import hlight from 'highlight.js'; import type { HLJSApi } from 'highlight.js';
import * as smartstring from '@push.rocks/smartstring'; import * as smartstring from '@push.rocks/smartstring';
import * as domtools from '@design.estate/dees-domtools'; import * as domtools from '@design.estate/dees-domtools';
import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js'; import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js';
import { DeesServiceLibLoader } from '../../../services/index.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -229,6 +230,7 @@ export class DeesDataviewCodebox extends DeesElement {
} }
private codeToDisplayStore = ''; private codeToDisplayStore = '';
private highlightJs: HLJSApi | null = null;
public async updated(_changedProperties) { public async updated(_changedProperties) {
super.updated(_changedProperties); super.updated(_changedProperties);
@@ -250,11 +252,17 @@ export class DeesDataviewCodebox extends DeesElement {
this.codeToDisplay = this.codeToDisplayStore; this.codeToDisplay = this.codeToDisplayStore;
} }
await domtools.plugins.smartdelay.delayFor(0); await domtools.plugins.smartdelay.delayFor(0);
// Load highlight.js from CDN if not already loaded
if (!this.highlightJs) {
this.highlightJs = await DeesServiceLibLoader.getInstance().loadHighlightJs();
}
const localCodeNode = this.shadowRoot.querySelector('code'); const localCodeNode = this.shadowRoot.querySelector('code');
const html = hlight.highlight(this.codeToDisplayStore, { const highlightedHtml = this.highlightJs.highlight(this.codeToDisplayStore, {
language: this.progLang, language: this.progLang,
ignoreIllegals: true, ignoreIllegals: true,
}); });
localCodeNode.innerHTML = html.value; localCodeNode.innerHTML = highlightedHtml.value;
} }
} }

View File

@@ -14,12 +14,8 @@ import {
query, query,
} from '@design.estate/dees-element'; } from '@design.estate/dees-element';
import { Editor } from '@tiptap/core'; import type { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit'; import { DeesServiceLibLoader, type ITiptapBundle } from '../../../services/index.js';
import Underline from '@tiptap/extension-underline';
import TextAlign from '@tiptap/extension-text-align';
import Link from '@tiptap/extension-link';
import Typography from '@tiptap/extension-typography';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -63,6 +59,7 @@ export class DeesInputRichtext extends DeesInputBase<string> {
private editorElement: HTMLElement; private editorElement: HTMLElement;
private linkInputElement: HTMLInputElement; private linkInputElement: HTMLInputElement;
private tiptapBundle: ITiptapBundle | null = null;
public editor: Editor; public editor: Editor;
@@ -233,13 +230,19 @@ export class DeesInputRichtext extends DeesInputBase<string> {
public async firstUpdated() { public async firstUpdated() {
await this.updateComplete; await this.updateComplete;
// Load Tiptap from CDN
this.tiptapBundle = await DeesServiceLibLoader.getInstance().loadTiptap();
this.editorElement = this.shadowRoot.querySelector('.editor-content'); this.editorElement = this.shadowRoot.querySelector('.editor-content');
this.linkInputElement = this.shadowRoot.querySelector('.link-input input'); this.linkInputElement = this.shadowRoot.querySelector('.link-input input');
this.initializeEditor(); this.initializeEditor();
} }
private initializeEditor(): void { private initializeEditor(): void {
if (this.disabled) return; if (this.disabled || !this.tiptapBundle) return;
const { Editor, StarterKit, Underline, TextAlign, Link, Typography } = this.tiptapBundle;
this.editor = new Editor({ this.editor = new Editor({
element: this.editorElement, element: this.editorElement,
@@ -249,7 +252,7 @@ export class DeesInputRichtext extends DeesInputBase<string> {
levels: [1, 2, 3], levels: [1, 2, 3],
}, },
}), }),
Underline, Underline.configure({}),
TextAlign.configure({ TextAlign.configure({
types: ['heading', 'paragraph'], types: ['heading', 'paragraph'],
}), }),
@@ -259,7 +262,7 @@ export class DeesInputRichtext extends DeesInputBase<string> {
class: 'editor-link', class: 'editor-link',
}, },
}), }),
Typography, Typography.configure({}),
], ],
content: this.value || (this.placeholder ? `<p>${this.placeholder}</p>` : ''), content: this.value || (this.placeholder ? `<p>${this.placeholder}</p>` : ''),
onUpdate: ({ editor }) => { onUpdate: ({ editor }) => {

View File

@@ -2,9 +2,10 @@ import { BaseBlockHandler, type IBlockEventHandlers } from '../block.base.js';
import type { IBlock } from '../../wysiwyg.types.js'; import type { IBlock } from '../../wysiwyg.types.js';
import { cssManager } from '@design.estate/dees-element'; import { cssManager } from '@design.estate/dees-element';
import { WysiwygSelection } from '../../wysiwyg.selection.js'; import { WysiwygSelection } from '../../wysiwyg.selection.js';
import hlight from 'highlight.js'; import type { HLJSApi } from 'highlight.js';
import { cssGeistFontFamily, cssMonoFontFamily } from '../../../../00fonts.js'; import { cssGeistFontFamily, cssMonoFontFamily } from '../../../../00fonts.js';
import { PROGRAMMING_LANGUAGES } from '../../wysiwyg.constants.js'; import { PROGRAMMING_LANGUAGES } from '../../wysiwyg.constants.js';
import { DeesServiceLibLoader } from '../../../../../services/index.js';
/** /**
* CodeBlockHandler with improved architecture * CodeBlockHandler with improved architecture
@@ -18,8 +19,9 @@ import { PROGRAMMING_LANGUAGES } from '../../wysiwyg.constants.js';
*/ */
export class CodeBlockHandler extends BaseBlockHandler { export class CodeBlockHandler extends BaseBlockHandler {
type = 'code'; type = 'code';
private highlightTimer: any = null; private highlightTimer: any = null;
private highlightJs: HLJSApi | null = null;
render(block: IBlock, isSelected: boolean): string { render(block: IBlock, isSelected: boolean): string {
const language = block.metadata?.language || 'typescript'; const language = block.metadata?.language || 'typescript';
@@ -306,28 +308,33 @@ export class CodeBlockHandler extends BaseBlockHandler {
return linesBeforeCursor.length - 1; // 0-indexed return linesBeforeCursor.length - 1; // 0-indexed
} }
private applyHighlighting(element: HTMLElement, block: IBlock): void { private async applyHighlighting(element: HTMLElement, block: IBlock): Promise<void> {
const editor = element.querySelector('.code-editor') as HTMLElement; const editor = element.querySelector('.code-editor') as HTMLElement;
if (!editor) return; if (!editor) return;
// Load highlight.js from CDN if not already loaded
if (!this.highlightJs) {
this.highlightJs = await DeesServiceLibLoader.getInstance().loadHighlightJs();
}
// Store cursor position // Store cursor position
const cursorPos = this.getCursorPosition(element); const cursorPos = this.getCursorPosition(element);
// Get plain text content // Get plain text content
const content = editor.textContent || ''; const content = editor.textContent || '';
const language = block.metadata?.language || 'typescript'; const language = block.metadata?.language || 'typescript';
// Apply highlighting // Apply highlighting
try { try {
const result = hlight.highlight(content, { const result = this.highlightJs.highlight(content, {
language: language, language: language,
ignoreIllegals: true ignoreIllegals: true,
}); });
// Only update if we have valid highlighted content // Only update if we have valid highlighted content
if (result.value) { if (result.value) {
editor.innerHTML = result.value; editor.innerHTML = result.value;
// Restore cursor position if editor is focused // Restore cursor position if editor is focused
if (document.activeElement === editor && cursorPos !== null) { if (document.activeElement === editor && cursorPos !== null) {
requestAnimationFrame(() => { requestAnimationFrame(() => {

View File

@@ -1,4 +1,4 @@
import * as webcontainer from '@webcontainer/api'; import * as webcontainer from '@tempfix/webcontainer__api';
import type { IExecutionEnvironment, IFileEntry, IFileWatcher, IProcessHandle } from '../interfaces/IExecutionEnvironment.js'; import type { IExecutionEnvironment, IFileEntry, IFileWatcher, IProcessHandle } from '../interfaces/IExecutionEnvironment.js';
/** /**

View File

@@ -12,7 +12,7 @@ import { themeDefaultStyles } from '../../00theme.js';
import type { IExecutionEnvironment } from '../../00group-runtime/index.js'; import type { IExecutionEnvironment } from '../../00group-runtime/index.js';
import '../../dees-icon/dees-icon.js'; import '../../dees-icon/dees-icon.js';
import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js'; import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js';
import type { IRunProcessEventDetail } from '../dees-workspace-terminal/interfaces.js'; import type { IRunProcessEventDetail, ITerminalProcessCompleteEventDetail } from '../dees-workspace-terminal/interfaces.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -48,6 +48,19 @@ export class DeesWorkspaceBottombar extends DeesElement {
@state() @state()
accessor isCheckingPackages: boolean = false; accessor isCheckingPackages: boolean = false;
// Track if we have a pending package update that should trigger refresh
private pendingPackageUpdate: boolean = false;
// Bound handler for process-complete events
private handleProcessComplete = (e: CustomEvent<ITerminalProcessCompleteEventDetail>) => {
// If we have a pending package update and a process completed, refresh
if (this.pendingPackageUpdate) {
this.pendingPackageUpdate = false;
// Small delay to let pnpm-lock.yaml update
setTimeout(() => this.checkPackages(), 500);
}
};
public static styles = [ public static styles = [
themeDefaultStyles, themeDefaultStyles,
cssManager.defaultStyles, cssManager.defaultStyles,
@@ -167,6 +180,17 @@ export class DeesWorkspaceBottombar extends DeesElement {
`; `;
} }
public async connectedCallback() {
await super.connectedCallback();
// Listen for process-complete events to refresh after package updates
window.addEventListener('process-complete', this.handleProcessComplete as EventListener);
}
public async disconnectedCallback() {
await super.disconnectedCallback();
window.removeEventListener('process-complete', this.handleProcessComplete as EventListener);
}
async firstUpdated() { async firstUpdated() {
await this.loadScripts(); await this.loadScripts();
await this.checkPackages(); await this.checkPackages();
@@ -256,19 +280,46 @@ export class DeesWorkspaceBottombar extends DeesElement {
this.packageStatus = 'checking'; this.packageStatus = 'checking';
this.isCheckingPackages = true; this.isCheckingPackages = true;
// Run pnpm outdated --json // Run pnpm outdated --json with timeout
const process = await this.executionEnvironment.spawn('pnpm', ['outdated', '--json']); const process = await this.executionEnvironment.spawn('pnpm', ['outdated', '--json']);
let output = ''; let output = '';
await process.output.pipeTo(
new WritableStream({
write: (chunk) => {
output += chunk;
},
})
);
const exitCode = await process.exit; // Collect output asynchronously - don't await, stream may not close if no output
const outputReader = process.output.getReader();
const readOutput = async () => {
try {
while (true) {
const { done, value } = await outputReader.read();
if (done) break;
output += value;
}
} catch {
// Ignore stream errors
}
};
// Start reading but don't await - we'll use whatever we have when process exits
readOutput();
// Wait for process exit with timeout (10 seconds)
const exitCode = await Promise.race([
process.exit,
new Promise<number>((resolve) => setTimeout(() => resolve(-1), 10000)),
]);
// Cancel reader when done
try {
await outputReader.cancel();
} catch {
// Ignore cancel errors
}
// Handle timeout
if (exitCode === -1) {
console.warn('Package check timed out');
this.packageStatus = 'error';
return;
}
// pnpm outdated returns exit code 1 if there are outdated packages // pnpm outdated returns exit code 1 if there are outdated packages
if (exitCode === 0) { if (exitCode === 0) {
@@ -318,15 +369,15 @@ export class DeesWorkspaceBottombar extends DeesElement {
private async handlePackageClick(e: MouseEvent): Promise<void> { private async handlePackageClick(e: MouseEvent): Promise<void> {
e.stopPropagation(); e.stopPropagation();
if (this.isCheckingPackages) return;
const menuItems: Parameters<typeof DeesContextmenu.openContextMenuWithOptions>[1] = []; const menuItems: Parameters<typeof DeesContextmenu.openContextMenuWithOptions>[1] = [];
// Refresh option - show output in terminal // Refresh option - show output in terminal
menuItems.push({ menuItems.push({
name: 'Check for updates', name: this.isCheckingPackages ? 'Checking...' : 'Check for updates',
iconName: 'lucide:refreshCw', iconName: 'lucide:refreshCw',
action: async () => { action: async () => {
if (this.isCheckingPackages) return;
// Create terminal tab to show pnpm outdated output // Create terminal tab to show pnpm outdated output
const detail: IRunProcessEventDetail = { const detail: IRunProcessEventDetail = {
type: 'package-update', type: 'package-update',
@@ -387,12 +438,15 @@ export class DeesWorkspaceBottombar extends DeesElement {
private async updatePackage(packageName: string): Promise<void> { private async updatePackage(packageName: string): Promise<void> {
if (!this.executionEnvironment) return; if (!this.executionEnvironment) return;
// Mark that we have a pending update - will trigger refresh when complete
this.pendingPackageUpdate = true;
// Emit run-process event for the workspace to create a terminal tab // Emit run-process event for the workspace to create a terminal tab
const detail: IRunProcessEventDetail = { const detail: IRunProcessEventDetail = {
type: 'package-update', type: 'package-update',
label: `update ${packageName}`, label: `update ${packageName}`,
command: 'pnpm', command: 'pnpm',
args: ['update', packageName], args: ['update', '--latest', packageName],
metadata: { packageName }, metadata: { packageName },
}; };
@@ -406,12 +460,15 @@ export class DeesWorkspaceBottombar extends DeesElement {
private async updateAllPackages(): Promise<void> { private async updateAllPackages(): Promise<void> {
if (!this.executionEnvironment) return; if (!this.executionEnvironment) return;
// Mark that we have a pending update - will trigger refresh when complete
this.pendingPackageUpdate = true;
// Emit run-process event for the workspace to create a terminal tab // Emit run-process event for the workspace to create a terminal tab
const detail: IRunProcessEventDetail = { const detail: IRunProcessEventDetail = {
type: 'package-update', type: 'package-update',
label: 'update all', label: 'update all',
command: 'pnpm', command: 'pnpm',
args: ['update'], args: ['update', '--latest'],
}; };
this.dispatchEvent(new CustomEvent('run-process', { this.dispatchEvent(new CustomEvent('run-process', {

View File

@@ -0,0 +1,359 @@
import {
DeesElement,
property,
html,
customElement,
type TemplateResult,
css,
cssManager,
} from '@design.estate/dees-element';
import * as domtools from '@design.estate/dees-domtools';
import { MONACO_VERSION } from '../dees-workspace-monaco/version.js';
import { themeDefaultStyles } from '../../00theme.js';
import '../../00group-button/dees-button/dees-button.js';
import type * as monaco from 'monaco-editor';
declare global {
interface HTMLElementTagNameMap {
'dees-workspace-diff-editor': DeesWorkspaceDiffEditor;
}
}
@customElement('dees-workspace-diff-editor')
export class DeesWorkspaceDiffEditor extends DeesElement {
// DEMO
public static demo = () => html`
<dees-workspace-diff-editor
.originalContent=${'function hello() {\n console.log("Hello");\n}'}
.modifiedContent=${'function hello() {\n console.log("Hello World!");\n return true;\n}'}
.language=${'typescript'}
.filePath=${'/demo/example.ts'}
></dees-workspace-diff-editor>
`;
// INSTANCE
public diffEditorDeferred = domtools.plugins.smartpromise.defer<monaco.editor.IStandaloneDiffEditor>();
@property({ type: String })
accessor originalContent: string = '';
@property({ type: String })
accessor modifiedContent: string = '';
@property({ type: String })
accessor originalLabel: string = 'Disk Version';
@property({ type: String })
accessor modifiedLabel: string = 'Local Version';
@property({ type: String })
accessor language: string = 'typescript';
@property({ type: String })
accessor filePath: string = '';
private diffEditor: monaco.editor.IStandaloneDiffEditor | null = null;
private monacoThemeSubscription: domtools.plugins.smartrx.rxjs.Subscription | null = null;
private originalModel: monaco.editor.ITextModel | null = null;
private modifiedModel: monaco.editor.ITextModel | null = null;
constructor() {
super();
domtools.DomTools.setupDomTools();
}
public static styles = [
themeDefaultStyles,
cssManager.defaultStyles,
css`
:host {
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
* {
box-sizing: border-box;
}
.diff-wrapper {
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
}
.diff-toolbar {
height: 48px;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
background: ${cssManager.bdTheme('hsl(0 0% 96%)', 'hsl(0 0% 12%)')};
border-bottom: 1px solid ${cssManager.bdTheme('hsl(0 0% 85%)', 'hsl(0 0% 20%)')};
flex-shrink: 0;
}
.diff-info {
display: flex;
align-items: center;
gap: 12px;
font-size: 14px;
color: ${cssManager.bdTheme('hsl(0 0% 30%)', 'hsl(0 0% 80%)')};
}
.diff-filename {
font-weight: 600;
color: ${cssManager.bdTheme('hsl(0 0% 20%)', 'hsl(0 0% 90%)')};
}
.diff-labels {
font-size: 12px;
color: ${cssManager.bdTheme('hsl(0 0% 50%)', 'hsl(0 0% 60%)')};
}
.diff-actions {
display: flex;
align-items: center;
gap: 8px;
}
.diff-container {
flex: 1;
min-height: 0;
width: 100%;
}
.nav-buttons {
display: flex;
gap: 4px;
}
.action-buttons {
display: flex;
gap: 8px;
margin-left: 16px;
}
`,
];
public render(): TemplateResult {
const fileName = this.filePath.split('/').pop() || 'file';
return html`
<div class="diff-wrapper">
<div class="diff-toolbar">
<div class="diff-info">
<span class="diff-filename">${fileName}</span>
<span class="diff-labels">${this.originalLabel}${this.modifiedLabel}</span>
</div>
<div class="diff-actions">
<div class="nav-buttons">
<dees-button
type="outline"
@click=${this.goToPreviousDiff}
>Previous</dees-button>
<dees-button
type="outline"
@click=${this.goToNextDiff}
>Next</dees-button>
</div>
<div class="action-buttons">
<dees-button
type="highlighted"
@click=${this.acceptLocal}
>Use Local</dees-button>
<dees-button
type="outline"
@click=${this.acceptDisk}
>Use Disk</dees-button>
<dees-button
type="outline"
@click=${this.close}
>Close</dees-button>
</div>
</div>
</div>
<div class="diff-container"></div>
</div>
`;
}
public async firstUpdated(): Promise<void> {
await super.firstUpdated(new Map());
await this.initDiffEditor();
}
private async initDiffEditor(): Promise<void> {
const container = this.shadowRoot?.querySelector('.diff-container') as HTMLElement;
if (!container) return;
const monacoCdnBase = `https://cdn.jsdelivr.net/npm/monaco-editor@${MONACO_VERSION}`;
// Wait for Monaco to be loaded (should already be loaded by dees-workspace-monaco)
let monacoInstance = (window as any).monaco as typeof monaco;
if (!monacoInstance) {
// Monaco not loaded yet, wait for it
await new Promise<void>((resolve) => {
const checkMonaco = setInterval(() => {
if ((window as any).monaco) {
clearInterval(checkMonaco);
resolve();
}
}, 100);
});
monacoInstance = (window as any).monaco as typeof monaco;
}
// Get current theme from domtools
const domtoolsInstance = await this.domtoolsPromise;
const isBright = domtoolsInstance.themeManager.goBrightBoolean;
const initialTheme = isBright ? 'vs' : 'vs-dark';
// Create unique URIs for models
const timestamp = Date.now();
const originalUri = monacoInstance.Uri.parse(`diff://original/${timestamp}${this.filePath}`);
const modifiedUri = monacoInstance.Uri.parse(`diff://modified/${timestamp}${this.filePath}`);
// Create models
this.originalModel = monacoInstance.editor.createModel(
this.originalContent,
this.language,
originalUri
);
this.modifiedModel = monacoInstance.editor.createModel(
this.modifiedContent,
this.language,
modifiedUri
);
// Create diff editor
this.diffEditor = monacoInstance.editor.createDiffEditor(container, {
automaticLayout: true,
readOnly: false, // Allow editing the modified (local) side
originalEditable: false, // Disk version is read-only
renderSideBySide: true,
ignoreTrimWhitespace: false,
fontSize: 14,
minimap: {
enabled: false,
},
});
// Set the theme
monacoInstance.editor.setTheme(initialTheme);
this.diffEditor.setModel({
original: this.originalModel,
modified: this.modifiedModel,
});
// Subscribe to theme changes
this.monacoThemeSubscription = domtoolsInstance.themeManager.themeObservable.subscribe(
(goBright: boolean) => {
const newTheme = goBright ? 'vs' : 'vs-dark';
monacoInstance.editor.setTheme(newTheme);
}
);
// Inject Monaco CSS if not already present
const cssId = 'monaco-diff-editor-css';
if (!this.shadowRoot?.getElementById(cssId)) {
const cssResponse = await fetch(`${monacoCdnBase}/min/vs/editor/editor.main.css`);
const cssText = await cssResponse.text();
const styleElement = document.createElement('style');
styleElement.id = cssId;
styleElement.textContent = cssText;
this.shadowRoot?.append(styleElement);
}
// Navigate to first diff after a short delay
setTimeout(() => {
try {
this.diffEditor?.revealFirstDiff();
} catch {
// Ignore if no diffs
}
}, 100);
this.diffEditorDeferred.resolve(this.diffEditor);
}
public goToNextDiff(): void {
try {
this.diffEditor?.goToDiff('next');
} catch {
// Ignore if no more diffs
}
}
public goToPreviousDiff(): void {
try {
this.diffEditor?.goToDiff('previous');
} catch {
// Ignore if no more diffs
}
}
public acceptLocal(): void {
// User wants to keep local version (potentially with edits made in diff view)
const modifiedContent = this.diffEditor?.getModifiedEditor().getValue() || this.modifiedContent;
this.dispatchEvent(
new CustomEvent('diff-resolved', {
detail: { action: 'use-local', content: modifiedContent },
bubbles: true,
composed: true,
})
);
}
public acceptDisk(): void {
// User wants disk version
this.dispatchEvent(
new CustomEvent('diff-resolved', {
detail: { action: 'use-disk', content: this.originalContent },
bubbles: true,
composed: true,
})
);
}
public close(): void {
this.dispatchEvent(
new CustomEvent('diff-closed', {
bubbles: true,
composed: true,
})
);
}
public async disconnectedCallback(): Promise<void> {
await super.disconnectedCallback();
if (this.monacoThemeSubscription) {
this.monacoThemeSubscription.unsubscribe();
this.monacoThemeSubscription = null;
}
// Dispose models
if (this.originalModel) {
this.originalModel.dispose();
this.originalModel = null;
}
if (this.modifiedModel) {
this.modifiedModel.dispose();
this.modifiedModel = null;
}
// Dispose editor
if (this.diffEditor) {
this.diffEditor.dispose();
this.diffEditor = null;
}
}
}

View File

@@ -0,0 +1 @@
export * from './dees-workspace-diff-editor.js';

View File

@@ -242,4 +242,53 @@ export class DeesWorkspaceMonaco extends DeesElement {
this.monacoThemeSubscription = null; this.monacoThemeSubscription = null;
} }
} }
/**
* Update content from external source with optional cursor preservation.
* Use this when the file content changes externally (e.g., file changed on disk).
* @param newContent The new content to set
* @param preserveCursor Whether to preserve cursor/scroll position (default: true)
*/
public async setContentExternal(
newContent: string,
preserveCursor: boolean = true
): Promise<void> {
const editor = await this.editorDeferred.promise;
const currentValue = editor.getValue();
if (currentValue === newContent) return;
// Save cursor state if preserving
const position = preserveCursor ? editor.getPosition() : null;
const selections = preserveCursor ? editor.getSelections() : null;
const scrollTop = preserveCursor ? editor.getScrollTop() : 0;
const scrollLeft = preserveCursor ? editor.getScrollLeft() : 0;
// Update content
this.isUpdatingFromExternal = true;
editor.setValue(newContent);
this.isUpdatingFromExternal = false;
// Restore cursor state if preserving
if (preserveCursor) {
if (position) {
// Clamp position to valid range
const model = editor.getModel();
const lineCount = model?.getLineCount() || 1;
const clampedLine = Math.min(position.lineNumber, lineCount);
const lineLength = model?.getLineMaxColumn(clampedLine) || 1;
const clampedColumn = Math.min(position.column, lineLength);
editor.setPosition({ lineNumber: clampedLine, column: clampedColumn });
}
if (selections && selections.length > 0) {
// Selections may be invalid after content change, wrap in try-catch
try {
editor.setSelections(selections);
} catch {
// Ignore invalid selections
}
}
editor.setScrollPosition({ scrollTop, scrollLeft });
}
}
} }

View File

@@ -7,9 +7,10 @@ import {
css, css,
cssManager, cssManager,
} from '@design.estate/dees-element'; } from '@design.estate/dees-element';
import { Terminal } from 'xterm'; import type { Terminal } from 'xterm';
import { FitAddon } from 'xterm-addon-fit'; import type { FitAddon } from 'xterm-addon-fit';
import { themeDefaultStyles } from '../../00theme.js'; import { themeDefaultStyles } from '../../00theme.js';
import { DeesServiceLibLoader } from '../../../services/index.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -305,8 +306,15 @@ export class DeesWorkspaceTerminalPreview extends DeesElement {
const domtoolsInstance = await this.domtoolsPromise; const domtoolsInstance = await this.domtoolsPromise;
const isBright = domtoolsInstance.themeManager.goBrightBoolean; const isBright = domtoolsInstance.themeManager.goBrightBoolean;
// Create xterm terminal in read-only mode // Load xterm from CDN
this.terminal = new Terminal({ const libLoader = DeesServiceLibLoader.getInstance();
const [xtermBundle, fitAddonBundle] = await Promise.all([
libLoader.loadXterm(),
libLoader.loadXtermFitAddon(),
]);
// Create xterm terminal in read-only mode using CDN-loaded module
this.terminal = new xtermBundle.Terminal({
convertEol: true, convertEol: true,
cursorBlink: false, cursorBlink: false,
disableStdin: true, disableStdin: true,
@@ -323,7 +331,7 @@ export class DeesWorkspaceTerminalPreview extends DeesElement {
} }
}); });
this.fitAddon = new FitAddon(); this.fitAddon = new fitAddonBundle.FitAddon();
this.terminal.loadAddon(this.fitAddon); this.terminal.loadAddon(this.fitAddon);
this.terminal.open(container); this.terminal.open(container);
this.fitAddon.fit(); this.fitAddon.fit();

View File

@@ -10,18 +10,20 @@ import {
} from '@design.estate/dees-element'; } from '@design.estate/dees-element';
import * as domtools from '@design.estate/dees-domtools'; import * as domtools from '@design.estate/dees-domtools';
import { Terminal } from 'xterm'; import type { Terminal } from 'xterm';
import { FitAddon } from 'xterm-addon-fit';
import { themeDefaultStyles } from '../../00theme.js'; import { themeDefaultStyles } from '../../00theme.js';
import type { IExecutionEnvironment } from '../../00group-runtime/index.js'; import type { IExecutionEnvironment } from '../../00group-runtime/index.js';
import { WebContainerEnvironment } from '../../00group-runtime/index.js'; import { WebContainerEnvironment } from '../../00group-runtime/index.js';
import '../../dees-icon/dees-icon.js'; import '../../dees-icon/dees-icon.js';
import '../../dees-actionbar/dees-actionbar.js';
import type { DeesActionbar } from '../../dees-actionbar/dees-actionbar.js';
import { TerminalTabManager } from './terminal-tab-manager.js'; import { TerminalTabManager } from './terminal-tab-manager.js';
import type { import type {
ITerminalTab, ITerminalTab,
ICreateTerminalTabOptions, ICreateTerminalTabOptions,
TTerminalTabType, TTerminalTabType,
} from './interfaces.js'; } from './interfaces.js';
import { DeesServiceLibLoader } from '../../../services/index.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -79,6 +81,9 @@ export class DeesWorkspaceTerminal extends DeesElement {
private terminalThemeSubscription: any = null; private terminalThemeSubscription: any = null;
private isBright: boolean = false; private isBright: boolean = false;
// Actionbar reference for terminal-context notifications
private terminalActionbar: DeesActionbar | null = null;
/** /**
* Promise that resolves when the environment is ready. * Promise that resolves when the environment is ready.
* @deprecated Use executionEnvironment directly * @deprecated Use executionEnvironment directly
@@ -120,17 +125,21 @@ export class DeesWorkspaceTerminal extends DeesElement {
.terminal-content { .terminal-content {
flex: 1; flex: 1;
position: relative; display: flex;
flex-direction: column;
overflow: hidden; overflow: hidden;
background: ${cssManager.bdTheme('#ffffff', '#000000')}; background: ${cssManager.bdTheme('#ffffff', '#000000')};
} }
#active-terminal-container { #active-terminal-container {
position: absolute; flex: 1;
top: 20px; position: relative;
left: 20px; min-height: 0;
right: 20px; margin: 20px;
bottom: 20px; }
.terminal-content dees-actionbar {
flex-shrink: 0;
} }
/* Tab bar on the right side */ /* Tab bar on the right side */
@@ -426,6 +435,7 @@ export class DeesWorkspaceTerminal extends DeesElement {
<span>No terminal open</span> <span>No terminal open</span>
</div> </div>
`} `}
<dees-actionbar></dees-actionbar>
</div> </div>
<!-- Vertical tab bar on the right --> <!-- Vertical tab bar on the right -->
@@ -485,17 +495,31 @@ export class DeesWorkspaceTerminal extends DeesElement {
} }
); );
// Load xterm from CDN
const libLoader = DeesServiceLibLoader.getInstance();
const [xtermBundle, fitAddonBundle] = await Promise.all([
libLoader.loadXterm(),
libLoader.loadXtermFitAddon(),
]);
// Initialize tab manager with loaded modules
this.tabManager.setXtermModules(xtermBundle, fitAddonBundle);
// Create default shell tab // Create default shell tab
await this.createShellTab(); await this.createShellTab();
} }
async connectedCallback(): Promise<void> { async connectedCallback(): Promise<void> {
await super.connectedCallback(); await super.connectedCallback();
this.resizeObserver.observe(this); // ResizeObserver is set up in attachTerminalToContainer when the container exists
} }
async disconnectedCallback(): Promise<void> { async disconnectedCallback(): Promise<void> {
this.resizeObserver.unobserve(this); // Unobserve the terminal container
const container = this.shadowRoot?.getElementById('active-terminal-container');
if (container) {
this.resizeObserver.unobserve(container);
}
if (this.terminalThemeSubscription) { if (this.terminalThemeSubscription) {
this.terminalThemeSubscription.unsubscribe(); this.terminalThemeSubscription.unsubscribe();
this.terminalThemeSubscription = null; this.terminalThemeSubscription = null;
@@ -558,6 +582,10 @@ export class DeesWorkspaceTerminal extends DeesElement {
const container = this.shadowRoot?.getElementById('active-terminal-container'); const container = this.shadowRoot?.getElementById('active-terminal-container');
if (!container) return; if (!container) return;
// Observe container for resize (handles actionbar appearing/disappearing)
// ResizeObserver.observe() is idempotent - safe to call multiple times
this.resizeObserver.observe(container);
// Clear container // Clear container
container.innerHTML = ''; container.innerHTML = '';
@@ -656,6 +684,36 @@ export class DeesWorkspaceTerminal extends DeesElement {
detail: { tabId, exitCode }, detail: { tabId, exitCode },
}) })
); );
// Show actionbar to offer closing the tab (only if tab is closeable)
if (tab.closeable) {
this.showExitedTabActionbar(tabId, tab.label, exitCode);
}
}
/**
* Show actionbar offering to close an exited tab
*/
private async showExitedTabActionbar(tabId: string, tabLabel: string, exitCode: number): Promise<void> {
const isSuccess = exitCode === 0;
const result = await this.showActionbar({
message: isSuccess
? `"${tabLabel}" completed. Close tab?`
: `"${tabLabel}" exited (code ${exitCode}). Close tab?`,
type: isSuccess ? 'info' : 'warning',
icon: isSuccess ? 'lucide:checkCircle' : 'lucide:alertTriangle',
actions: [
{ id: 'close', label: 'Close Tab', primary: true },
{ id: 'keep', label: 'Keep Open' },
],
timeout: { duration: 10000, defaultActionId: 'close' },
dismissible: true,
});
// Close tab if user clicked "Close Tab" or timeout triggered auto-close
if (result.actionId === 'close') {
this.closeTab(tabId);
}
} }
// ========== Public API ========== // ========== Public API ==========
@@ -816,6 +874,19 @@ export class DeesWorkspaceTerminal extends DeesElement {
return true; return true;
} }
/**
* Show an actionbar notification in the terminal panel context.
* Use this for terminal-related decisions (e.g., retry failed process, kill process, etc.)
*/
public async showActionbar(
options: Parameters<DeesActionbar['show']>[0]
): Promise<ReturnType<DeesActionbar['show']>> {
if (!this.terminalActionbar) {
this.terminalActionbar = this.shadowRoot?.querySelector('dees-actionbar') as DeesActionbar;
}
return this.terminalActionbar?.show(options);
}
// ========== Utility Methods ========== // ========== Utility Methods ==========
public async waitForPrompt(term: Terminal, prompt: string): Promise<void> { public async waitForPrompt(term: Terminal, prompt: string): Promise<void> {

View File

@@ -1,6 +1,7 @@
import { Terminal } from 'xterm'; import type { Terminal, ITerminalOptions } from 'xterm';
import { FitAddon } from 'xterm-addon-fit'; import type { FitAddon } from 'xterm-addon-fit';
import type { ITerminalTab, ICreateTerminalTabOptions, TTerminalTabType } from './interfaces.js'; import type { ITerminalTab, ICreateTerminalTabOptions, TTerminalTabType } from './interfaces.js';
import type { IXtermBundle, IXtermFitAddonBundle } from '../../../services/index.js';
/** /**
* Manages terminal tabs lifecycle and state * Manages terminal tabs lifecycle and state
@@ -8,6 +9,17 @@ import type { ITerminalTab, ICreateTerminalTabOptions, TTerminalTabType } from '
export class TerminalTabManager { export class TerminalTabManager {
private tabs: Map<string, ITerminalTab> = new Map(); private tabs: Map<string, ITerminalTab> = new Map();
private tabCounter: number = 0; private tabCounter: number = 0;
private xtermBundle: IXtermBundle | null = null;
private xtermFitAddonBundle: IXtermFitAddonBundle | null = null;
/**
* Initialize the manager with loaded xterm modules.
* Must be called before creating tabs.
*/
public setXtermModules(xtermBundle: IXtermBundle, fitAddonBundle: IXtermFitAddonBundle): void {
this.xtermBundle = xtermBundle;
this.xtermFitAddonBundle = fitAddonBundle;
}
/** /**
* Generate unique tab ID * Generate unique tab ID
@@ -96,11 +108,15 @@ export class TerminalTabManager {
* Create a new tab instance * Create a new tab instance
*/ */
createTab(options: ICreateTerminalTabOptions, isBright: boolean): ITerminalTab { createTab(options: ICreateTerminalTabOptions, isBright: boolean): ITerminalTab {
if (!this.xtermBundle || !this.xtermFitAddonBundle) {
throw new Error('TerminalTabManager: xterm modules not initialized. Call setXtermModules() first.');
}
const id = this.generateTabId(); const id = this.generateTabId();
const type = options.type; const type = options.type;
// Create xterm.js Terminal instance // Create xterm.js Terminal instance using CDN-loaded module
const terminal = new Terminal({ const terminal = new this.xtermBundle.Terminal({
convertEol: true, convertEol: true,
cursorBlink: true, cursorBlink: true,
theme: this.getTerminalTheme(isBright), theme: this.getTerminalTheme(isBright),
@@ -109,8 +125,8 @@ export class TerminalTabManager {
lineHeight: 1.2, lineHeight: 1.2,
}); });
// Create FitAddon // Create FitAddon using CDN-loaded module
const fitAddon = new FitAddon(); const fitAddon = new this.xtermFitAddonBundle.FitAddon();
terminal.loadAddon(fitAddon); terminal.loadAddon(fitAddon);
const tab: ITerminalTab = { const tab: ITerminalTab = {

View File

@@ -12,7 +12,7 @@ import * as domtools from '@design.estate/dees-domtools';
import { themeDefaultStyles } from '../../00theme.js'; import { themeDefaultStyles } from '../../00theme.js';
import type { IExecutionEnvironment, IFileWatcher } from '../../00group-runtime/index.js'; import type { IExecutionEnvironment, IFileWatcher } from '../../00group-runtime/index.js';
import { WebContainerEnvironment } from '../../00group-runtime/index.js'; import { WebContainerEnvironment } from '../../00group-runtime/index.js';
import type { FileSystemTree } from '@webcontainer/api'; import type { FileSystemTree } from '@tempfix/webcontainer__api';
import '../dees-workspace-monaco/dees-workspace-monaco.js'; import '../dees-workspace-monaco/dees-workspace-monaco.js';
import '../dees-workspace-filetree/dees-workspace-filetree.js'; import '../dees-workspace-filetree/dees-workspace-filetree.js';
import { DeesWorkspaceFiletree } from '../dees-workspace-filetree/dees-workspace-filetree.js'; import { DeesWorkspaceFiletree } from '../dees-workspace-filetree/dees-workspace-filetree.js';
@@ -26,6 +26,9 @@ import { DeesWorkspaceMonaco } from '../dees-workspace-monaco/dees-workspace-mon
import { TypeScriptIntelliSenseManager } from './typescript-intellisense.js'; import { TypeScriptIntelliSenseManager } from './typescript-intellisense.js';
import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js'; import { DeesContextmenu } from '../../dees-contextmenu/dees-contextmenu.js';
import '@design.estate/dees-wcctools/demotools'; import '@design.estate/dees-wcctools/demotools';
import '../../dees-actionbar/dees-actionbar.js';
import type { DeesActionbar } from '../../dees-actionbar/dees-actionbar.js';
import '../dees-workspace-diff-editor/dees-workspace-diff-editor.js';
declare global { declare global {
interface HTMLElementTagNameMap { interface HTMLElementTagNameMap {
@@ -65,6 +68,7 @@ export class DeesWorkspace extends DeesElement {
'@push.rocks/smartpromise': '^4.2.3', '@push.rocks/smartpromise': '^4.2.3',
}, },
devDependencies: { devDependencies: {
'@types/node': '^22.0.0',
typescript: '^5.0.0', typescript: '^5.0.0',
}, },
}, },
@@ -178,7 +182,7 @@ testSmartPromise();
await env.mount(fileTree); await env.mount(fileTree);
})(); })();
// Create container element for proper 100% height like dees-appui-base // Create container element for proper 100% height like dees-appui
const containerElement = document.createElement('div'); const containerElement = document.createElement('div');
containerElement.style.cssText = 'position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden;'; containerElement.style.cssText = 'position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden;';
@@ -253,6 +257,11 @@ testSmartPromise();
private nodeModulesDebounceTimeout: ReturnType<typeof setTimeout> | null = null; private nodeModulesDebounceTimeout: ReturnType<typeof setTimeout> | null = null;
private intelliSenseDebounceTimeout: ReturnType<typeof setTimeout> | null = null; private intelliSenseDebounceTimeout: ReturnType<typeof setTimeout> | null = null;
// Open file watchers for external change detection
private openFileWatchers: Map<string, IFileWatcher> = new Map();
private fileChangeDebounce: Map<string, ReturnType<typeof setTimeout>> = new Map();
private actionbarElement: DeesActionbar | null = null;
// Auto-save functionality // Auto-save functionality
@state() @state()
accessor autoSave: boolean = false; accessor autoSave: boolean = false;
@@ -278,6 +287,18 @@ testSmartPromise();
@state() @state()
accessor isDraggingTerminal: boolean = false; accessor isDraggingTerminal: boolean = false;
// Diff view state
@state()
accessor showDiffView: boolean = false;
@state()
accessor diffViewConfig: {
filePath: string;
originalContent: string;
modifiedContent: string;
language: string;
} | null = null;
// Keyboard shortcut handler (bound for proper cleanup) // Keyboard shortcut handler (bound for proper cleanup)
private keydownHandler = (e: KeyboardEvent) => { private keydownHandler = (e: KeyboardEvent) => {
// Cmd+S (Mac) or Ctrl+S (Windows/Linux) - Save // Cmd+S (Mac) or Ctrl+S (Windows/Linux) - Save
@@ -913,7 +934,16 @@ testSmartPromise();
</div> </div>
</div> </div>
<div class="editor-content"> <div class="editor-content">
${this.openFiles.length === 0 ? html` ${this.showDiffView && this.diffViewConfig ? html`
<dees-workspace-diff-editor
.filePath=${this.diffViewConfig.filePath}
.originalContent=${this.diffViewConfig.originalContent}
.modifiedContent=${this.diffViewConfig.modifiedContent}
.language=${this.diffViewConfig.language}
@diff-resolved=${this.handleDiffResolved}
@diff-closed=${() => { this.showDiffView = false; this.diffViewConfig = null; }}
></dees-workspace-diff-editor>
` : this.openFiles.length === 0 ? html`
<div class="empty-state"> <div class="empty-state">
<dees-icon .icon=${'lucide:fileCode'} iconSize="48"></dees-icon> <dees-icon .icon=${'lucide:fileCode'} iconSize="48"></dees-icon>
<span>Select a file to edit</span> <span>Select a file to edit</span>
@@ -927,6 +957,7 @@ testSmartPromise();
></dees-workspace-monaco> ></dees-workspace-monaco>
`} `}
</div> </div>
<dees-actionbar></dees-actionbar>
</div> </div>
<!-- Horizontal resize handle for terminal --> <!-- Horizontal resize handle for terminal -->
@@ -1015,6 +1046,7 @@ testSmartPromise();
this.autoSaveInterval = null; this.autoSaveInterval = null;
} }
this.stopNodeModulesWatcher(); this.stopNodeModulesWatcher();
this.stopAllFileWatchers();
} }
public async firstUpdated() { public async firstUpdated() {
@@ -1031,6 +1063,11 @@ testSmartPromise();
if (changedProperties.has('executionEnvironment') && this.executionEnvironment) { if (changedProperties.has('executionEnvironment') && this.executionEnvironment) {
await this.initializeWorkspace(); await this.initializeWorkspace();
} }
// Capture actionbar reference when it becomes available (after initialization completes)
if (!this.actionbarElement) {
this.actionbarElement = this.shadowRoot?.querySelector('.editor-panel dees-actionbar') as DeesActionbar;
}
} }
private async initializeWorkspace() { private async initializeWorkspace() {
@@ -1185,6 +1222,191 @@ testSmartPromise();
} }
} }
// ========== Open File Watching for External Changes ==========
/**
* Start watching an open file for external changes
*/
private startWatchingFile(path: string): void {
if (!this.executionEnvironment || this.openFileWatchers.has(path)) return;
try {
const watcher = this.executionEnvironment.watch(
path,
(_event, _filename) => {
// Debounce to avoid multiple rapid triggers
const existingTimeout = this.fileChangeDebounce.get(path);
if (existingTimeout) {
clearTimeout(existingTimeout);
}
const timeout = setTimeout(() => {
this.handleExternalFileChange(path);
this.fileChangeDebounce.delete(path);
}, 300);
this.fileChangeDebounce.set(path, timeout);
}
);
this.openFileWatchers.set(path, watcher);
} catch (error) {
console.warn(`Could not watch file ${path}:`, error);
}
}
/**
* Stop watching a file when it's closed
*/
private stopWatchingFile(path: string): void {
const watcher = this.openFileWatchers.get(path);
if (watcher) {
watcher.stop();
this.openFileWatchers.delete(path);
}
const timeout = this.fileChangeDebounce.get(path);
if (timeout) {
clearTimeout(timeout);
this.fileChangeDebounce.delete(path);
}
}
/**
* Stop all file watchers
*/
private stopAllFileWatchers(): void {
for (const watcher of this.openFileWatchers.values()) {
watcher.stop();
}
this.openFileWatchers.clear();
for (const timeout of this.fileChangeDebounce.values()) {
clearTimeout(timeout);
}
this.fileChangeDebounce.clear();
}
/**
* Handle external file change - show actionbar if file has local changes,
* otherwise silently update with cursor preservation
*/
private async handleExternalFileChange(path: string): Promise<void> {
const file = this.openFiles.find(f => f.path === path);
if (!file || !this.executionEnvironment) return;
try {
// Read the new content from disk
const newContent = await this.executionEnvironment.readFile(path);
// If content is same as what we have, no action needed
if (newContent === file.content) return;
if (file.modified) {
// File has unsaved local changes AND disk changed - conflict!
const result = await this.actionbarElement?.show({
message: `"${file.name}" changed on disk. What do you want to do?`,
type: 'question',
icon: 'lucide:gitMerge',
actions: [
{ id: 'load-disk', label: 'Load from Disk', primary: true },
{ id: 'save-local', label: 'Save Local to Disk' },
{ id: 'compare', label: 'Compare' },
],
timeout: { duration: 15000, defaultActionId: 'load-disk' },
dismissible: true,
});
if (result?.actionId === 'load-disk') {
// Discard local changes, load disk version
await this.updateFileContent(path, newContent, false);
} else if (result?.actionId === 'save-local') {
// Keep local changes and save to disk (overwrite external)
await this.executionEnvironment.writeFile(path, file.content);
// Mark as saved
this.openFiles = this.openFiles.map(f =>
f.path === path ? { ...f, modified: false } : f
);
} else if (result?.actionId === 'compare') {
// Open diff view
this.openDiffView(path, file.content, newContent);
}
// If dismissed, do nothing - user can manually resolve later
} else {
// No local changes - silently update with cursor preservation
await this.updateFileContent(path, newContent, true);
}
} catch (error) {
console.warn(`Failed to handle external change for ${path}:`, error);
}
}
/**
* Update file content in state and optionally in the editor
*/
private async updateFileContent(
path: string,
newContent: string,
preserveCursor: boolean
): Promise<void> {
// Update internal state
this.openFiles = this.openFiles.map(f =>
f.path === path ? { ...f, content: newContent, modified: false } : f
);
// If this is the active file, update Monaco editor
if (path === this.activeFilePath) {
const editor = this.shadowRoot?.querySelector('dees-workspace-monaco') as DeesWorkspaceMonaco;
if (editor) {
await editor.setContentExternal(newContent, preserveCursor);
}
}
}
/**
* Open the diff view to compare local and disk versions
*/
private openDiffView(path: string, localContent: string, diskContent: string): void {
this.diffViewConfig = {
filePath: path,
originalContent: diskContent,
modifiedContent: localContent,
language: this.getLanguageFromPath(path),
};
this.showDiffView = true;
}
/**
* Handle diff view resolution
*/
private async handleDiffResolved(e: CustomEvent): Promise<void> {
const { action, content } = e.detail;
const path = this.diffViewConfig?.filePath;
if (!path || !this.executionEnvironment) {
this.showDiffView = false;
this.diffViewConfig = null;
return;
}
if (action === 'use-local') {
// Save local content to disk
await this.executionEnvironment.writeFile(path, content);
this.openFiles = this.openFiles.map(f =>
f.path === path ? { ...f, content, modified: false } : f
);
// Update editor if active
if (path === this.activeFilePath) {
const editor = this.shadowRoot?.querySelector('dees-workspace-monaco') as DeesWorkspaceMonaco;
if (editor) {
await editor.setContentExternal(content, false);
}
}
} else if (action === 'use-disk') {
// Update editor with disk content
await this.updateFileContent(path, content, false);
}
this.showDiffView = false;
this.diffViewConfig = null;
}
private async handleFileSelect(e: CustomEvent<{ path: string; name: string }>) { private async handleFileSelect(e: CustomEvent<{ path: string; name: string }>) {
const { path, name } = e.detail; const { path, name } = e.detail;
await this.openFile(path, name); await this.openFile(path, name);
@@ -1209,6 +1431,9 @@ testSmartPromise();
]; ];
this.activeFilePath = path; this.activeFilePath = path;
// Start watching for external changes
this.startWatchingFile(path);
// Initialize IntelliSense lazily after first file opens (Monaco loads on demand) // Initialize IntelliSense lazily after first file opens (Monaco loads on demand)
if (!this.intelliSenseInitialized) { if (!this.intelliSenseInitialized) {
// Wait for Monaco editor to mount and load Monaco from CDN // Wait for Monaco editor to mount and load Monaco from CDN
@@ -1245,6 +1470,9 @@ testSmartPromise();
if (!confirmed) return; if (!confirmed) return;
} }
// Stop watching this file
this.stopWatchingFile(path);
this.openFiles = this.openFiles.filter(f => f.path !== path); this.openFiles = this.openFiles.filter(f => f.path !== path);
// If closing the active file, activate another one // If closing the active file, activate another one

View File

@@ -7,3 +7,4 @@ export * from './dees-workspace-terminal-preview/index.js';
export * from './dees-workspace-markdown/index.js'; export * from './dees-workspace-markdown/index.js';
export * from './dees-workspace-markdownoutlet/index.js'; export * from './dees-workspace-markdownoutlet/index.js';
export * from './dees-workspace-bottombar/index.js'; export * from './dees-workspace-bottombar/index.js';
export * from './dees-workspace-diff-editor/index.js';

View File

@@ -0,0 +1,54 @@
/**
* Action button configuration for the action bar
*/
export interface IActionBarAction {
/** Unique identifier for the action */
id: string;
/** Button label text */
label: string;
/** Primary action gets highlighted styling and receives timeout trigger */
primary?: boolean;
/** Lucide icon name (optional) */
icon?: string;
}
/**
* Configuration options for showing an action bar
*/
export interface IActionBarOptions {
/** Message text to display */
message: string;
/** Lucide icon name for the message (optional) */
icon?: string;
/** Visual type affects coloring */
type?: 'info' | 'warning' | 'error' | 'question';
/** Action buttons to display */
actions: IActionBarAction[];
/** Timeout configuration (optional) */
timeout?: {
/** Duration in milliseconds before auto-triggering default action */
duration: number;
/** ID of the action to auto-trigger when timeout expires */
defaultActionId: string;
};
/** Whether to show a dismiss (X) button */
dismissible?: boolean;
}
/**
* Result returned when an action bar is resolved
*/
export interface IActionBarResult {
/** ID of the action that was triggered */
actionId: string;
/** Whether the action was triggered by timeout (true) or user click (false) */
timedOut: boolean;
}
/**
* Internal queue item for pending action bars
*/
export interface IActionBarQueueItem {
options: IActionBarOptions;
resolve: (result: IActionBarResult) => void;
}

View File

@@ -0,0 +1,514 @@
import {
customElement,
DeesElement,
type TemplateResult,
html,
css,
state,
cssManager,
} from '@design.estate/dees-element';
import { themeDefaultStyles } from '../00theme.js';
import '../dees-icon/dees-icon.js';
import type {
IActionBarOptions,
IActionBarResult,
IActionBarQueueItem,
IActionBarAction,
} from './actionbar.interfaces.js';
declare global {
interface HTMLElementTagNameMap {
'dees-actionbar': DeesActionbar;
}
}
@customElement('dees-actionbar')
export class DeesActionbar extends DeesElement {
// STATIC
public static demo = () => {
const getActionbar = (e: Event) => {
const button = e.currentTarget as HTMLElement;
const container = button.closest('.demo-container');
return container?.querySelector('dees-actionbar') as DeesActionbar | null;
};
const showActionBar = async (e: Event) => {
const actionbar = getActionbar(e);
if (!actionbar) return;
const result = await actionbar.show({
message: 'File changed externally. Reload?',
type: 'warning',
icon: 'lucide:alertTriangle',
actions: [
{ id: 'reload', label: 'Reload', primary: true },
{ id: 'ignore', label: 'Ignore' },
],
timeout: { duration: 5000, defaultActionId: 'reload' },
dismissible: true,
});
console.log('Action bar result:', result);
};
const showErrorBar = async (e: Event) => {
const actionbar = getActionbar(e);
if (!actionbar) return;
const result = await actionbar.show({
message: 'Process failed with exit code 1',
type: 'error',
icon: 'lucide:xCircle',
actions: [
{ id: 'retry', label: 'Retry', primary: true },
{ id: 'dismiss', label: 'Dismiss' },
],
timeout: { duration: 10000, defaultActionId: 'dismiss' },
});
console.log('Error bar result:', result);
};
const showQuestionBar = async (e: Event) => {
const actionbar = getActionbar(e);
if (!actionbar) return;
const result = await actionbar.show({
message: 'Save changes before closing?',
type: 'question',
icon: 'lucide:helpCircle',
actions: [
{ id: 'save', label: 'Save', primary: true },
{ id: 'discard', label: 'Discard' },
{ id: 'cancel', label: 'Cancel' },
],
});
console.log('Question bar result:', result);
};
return html`
<style>
.demo-container {
display: flex;
flex-direction: column;
height: 300px;
border: 1px solid #333;
border-radius: 8px;
overflow: hidden;
}
.demo-content {
flex: 1;
padding: 16px;
display: flex;
gap: 8px;
align-items: flex-start;
}
</style>
<div class="demo-container">
<div class="demo-content">
<dees-button @click=${showActionBar}>Warning</dees-button>
<dees-button @click=${showErrorBar}>Error</dees-button>
<dees-button @click=${showQuestionBar}>Question</dees-button>
</div>
<dees-actionbar></dees-actionbar>
</div>
`;
};
// Queue of pending action bars
private queue: IActionBarQueueItem[] = [];
// Current active bar state
@state() accessor currentBar: IActionBarOptions | null = null;
@state() accessor timeRemaining: number = 0;
@state() accessor progressPercent: number = 100;
@state() accessor isVisible: boolean = false;
// Timeout handling
private timeoutInterval: ReturnType<typeof setInterval> | null = null;
private currentResolve: ((result: IActionBarResult) => void) | null = null;
public static styles = [
themeDefaultStyles,
cssManager.defaultStyles,
css`
:host {
display: block;
}
.actionbar-item {
display: grid;
grid-template-rows: 0fr;
transition: grid-template-rows 0.2s ease-out;
background: ${cssManager.bdTheme('hsl(0 0% 96%)', 'hsl(0 0% 12%)')};
border-top: 1px solid ${cssManager.bdTheme('hsl(0 0% 88%)', 'hsl(0 0% 20%)')};
}
:host(.visible) .actionbar-item {
grid-template-rows: 1fr;
}
.actionbar-content {
overflow: hidden;
min-height: 0;
opacity: 0;
transition: opacity 0.2s ease-out;
}
:host(.visible) .actionbar-content {
opacity: 1;
}
.progress-bar {
height: 3px;
background: ${cssManager.bdTheme('hsl(0 0% 90%)', 'hsl(0 0% 18%)')};
overflow: hidden;
}
.progress-bar-fill {
height: 100%;
background: ${cssManager.bdTheme('hsl(210 100% 50%)', 'hsl(210 100% 60%)')};
transition: width 0.1s linear;
}
.progress-bar-fill.warning {
background: ${cssManager.bdTheme('hsl(38 92% 50%)', 'hsl(38 92% 55%)')};
}
.progress-bar-fill.error {
background: ${cssManager.bdTheme('hsl(0 70% 50%)', 'hsl(0 70% 55%)')};
}
.progress-bar-fill.question {
background: ${cssManager.bdTheme('hsl(270 70% 50%)', 'hsl(270 70% 60%)')};
}
.content {
display: flex;
align-items: center;
padding: 8px 12px;
gap: 12px;
min-height: 32px;
}
.message-section {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
min-width: 0;
}
.message-icon {
flex-shrink: 0;
color: ${cssManager.bdTheme('hsl(0 0% 40%)', 'hsl(0 0% 60%)')};
}
.message-icon.info {
color: ${cssManager.bdTheme('hsl(210 100% 45%)', 'hsl(210 100% 60%)')};
}
.message-icon.warning {
color: ${cssManager.bdTheme('hsl(38 92% 45%)', 'hsl(38 92% 55%)')};
}
.message-icon.error {
color: ${cssManager.bdTheme('hsl(0 70% 50%)', 'hsl(0 70% 55%)')};
}
.message-icon.question {
color: ${cssManager.bdTheme('hsl(270 70% 50%)', 'hsl(270 70% 60%)')};
}
.message-text {
font-size: 13px;
color: ${cssManager.bdTheme('hsl(0 0% 20%)', 'hsl(0 0% 85%)')};
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.actions-section {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
}
.action-button {
display: flex;
align-items: center;
gap: 4px;
padding: 4px 10px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
cursor: pointer;
border: 1px solid transparent;
transition: all 0.15s ease;
white-space: nowrap;
}
.action-button.secondary {
background: transparent;
color: ${cssManager.bdTheme('hsl(0 0% 30%)', 'hsl(0 0% 70%)')};
border-color: ${cssManager.bdTheme('hsl(0 0% 80%)', 'hsl(0 0% 30%)')};
}
.action-button.secondary:hover {
background: ${cssManager.bdTheme('hsl(0 0% 92%)', 'hsl(0 0% 18%)')};
}
.action-button.primary {
background: ${cssManager.bdTheme('hsl(210 100% 50%)', 'hsl(210 100% 55%)')};
color: white;
}
.action-button.primary:hover {
background: ${cssManager.bdTheme('hsl(210 100% 45%)', 'hsl(210 100% 50%)')};
}
.action-button.primary.warning {
background: ${cssManager.bdTheme('hsl(38 92% 45%)', 'hsl(38 92% 50%)')};
}
.action-button.primary.warning:hover {
background: ${cssManager.bdTheme('hsl(38 92% 40%)', 'hsl(38 92% 45%)')};
}
.action-button.primary.error {
background: ${cssManager.bdTheme('hsl(0 70% 50%)', 'hsl(0 70% 55%)')};
}
.action-button.primary.error:hover {
background: ${cssManager.bdTheme('hsl(0 70% 45%)', 'hsl(0 70% 50%)')};
}
.action-button.primary.question {
background: ${cssManager.bdTheme('hsl(270 70% 50%)', 'hsl(270 70% 55%)')};
}
.action-button.primary.question:hover {
background: ${cssManager.bdTheme('hsl(270 70% 45%)', 'hsl(270 70% 50%)')};
}
.countdown {
font-size: 11px;
opacity: 0.8;
margin-left: 2px;
}
.dismiss-button {
display: flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 4px;
cursor: pointer;
color: ${cssManager.bdTheme('hsl(0 0% 50%)', 'hsl(0 0% 50%)')};
transition: all 0.15s ease;
}
.dismiss-button:hover {
background: ${cssManager.bdTheme('hsl(0 0% 88%)', 'hsl(0 0% 22%)')};
color: ${cssManager.bdTheme('hsl(0 0% 30%)', 'hsl(0 0% 70%)')};
}
`,
];
public render(): TemplateResult {
const bar = this.currentBar;
const type = bar?.type || 'info';
const hasTimeout = bar?.timeout && this.timeRemaining > 0;
// ALWAYS render wrapper - required for grid animation to work
return html`
<div class="actionbar-item">
<div class="actionbar-content">
${bar ? html`
${hasTimeout ? html`
<div class="progress-bar">
<div
class="progress-bar-fill ${type}"
style="width: ${this.progressPercent}%"
></div>
</div>
` : ''}
<div class="content">
<div class="message-section">
${bar.icon ? html`
<dees-icon
class="message-icon ${type}"
.icon=${bar.icon}
iconSize="16"
></dees-icon>
` : ''}
<span class="message-text">${bar.message}</span>
</div>
<div class="actions-section">
${bar.actions.map(action => this.renderActionButton(action, bar, hasTimeout))}
${bar.dismissible ? html`
<div
class="dismiss-button"
@click=${() => this.handleDismiss()}
title="Dismiss"
>
<dees-icon .icon=${'lucide:x'} iconSize="14"></dees-icon>
</div>
` : ''}
</div>
</div>
` : ''}
</div>
</div>
`;
}
private renderActionButton(
action: IActionBarAction,
bar: IActionBarOptions,
hasTimeout: boolean | undefined
): TemplateResult {
const isPrimary = action.primary;
const type = bar.type || 'info';
const isDefaultAction = bar.timeout?.defaultActionId === action.id;
const showCountdown = hasTimeout && isDefaultAction;
const seconds = Math.ceil(this.timeRemaining / 1000);
return html`
<button
class="action-button ${isPrimary ? `primary ${type}` : 'secondary'}"
@click=${() => this.handleAction(action.id, false)}
>
${action.icon ? html`
<dees-icon .icon=${action.icon} iconSize="12"></dees-icon>
` : ''}
<span>${action.label}</span>
${showCountdown ? html`
<span class="countdown">(${seconds}s)</span>
` : ''}
</button>
`;
}
// ========== Public API ==========
/**
* Show an action bar with the given options.
* Returns a promise that resolves when an action is taken.
*/
public async show(options: IActionBarOptions): Promise<IActionBarResult> {
return new Promise((resolve) => {
// Add to queue
this.queue.push({ options, resolve });
// If no current bar, process queue
if (!this.currentBar) {
this.processQueue();
}
});
}
/**
* Dismiss the current action bar without triggering any action.
*/
public dismiss(): void {
this.handleDismiss();
}
/**
* Clear all pending action bars in the queue.
*/
public clearQueue(): void {
// Resolve all queued items with dismiss
for (const item of this.queue) {
item.resolve({ actionId: 'dismissed', timedOut: false });
}
this.queue = [];
}
// ========== Private Methods ==========
/**
* Hide the current actionbar with animation.
* Removes visible class first to trigger CSS transition, then clears content after animation.
*/
private async hideCurrentBar(): Promise<void> {
// Remove visible class to start close animation
this.classList.remove('visible');
this.isVisible = false;
// Wait for animation to complete (200ms transition + buffer)
await new Promise(resolve => setTimeout(resolve, 220));
// Now safe to clear content
this.currentBar = null;
this.currentResolve = null;
}
private async processQueue(): Promise<void> {
if (this.queue.length === 0) {
// Hide with animation - don't await, let it run async
this.hideCurrentBar();
return;
}
const item = this.queue.shift()!;
this.currentBar = item.options;
this.currentResolve = item.resolve;
this.isVisible = true;
// Wait for Lit render, then add class on next frame to trigger animation
await this.updateComplete;
requestAnimationFrame(() => {
this.classList.add('visible');
});
// Setup timeout if configured
if (item.options.timeout) {
this.startTimeout(item.options.timeout.duration, item.options.timeout.defaultActionId);
}
}
private startTimeout(duration: number, defaultActionId: string): void {
this.timeRemaining = duration;
this.progressPercent = 100;
const startTime = Date.now();
const updateInterval = 50; // Update every 50ms for smooth animation
this.timeoutInterval = setInterval(() => {
const elapsed = Date.now() - startTime;
this.timeRemaining = Math.max(0, duration - elapsed);
this.progressPercent = (this.timeRemaining / duration) * 100;
if (this.timeRemaining <= 0) {
this.clearTimeoutInterval();
this.handleAction(defaultActionId, true);
}
}, updateInterval);
}
private clearTimeoutInterval(): void {
if (this.timeoutInterval) {
clearInterval(this.timeoutInterval);
this.timeoutInterval = null;
}
}
private handleAction(actionId: string, timedOut: boolean): void {
this.clearTimeoutInterval();
if (this.currentResolve) {
this.currentResolve({ actionId, timedOut });
}
// Process next item in queue
this.processQueue();
}
private handleDismiss(): void {
this.handleAction('dismissed', false);
}
public async disconnectedCallback(): Promise<void> {
await super.disconnectedCallback();
this.clearTimeoutInterval();
}
}

View File

@@ -0,0 +1,2 @@
export * from './dees-actionbar.js';
export * from './actionbar.interfaces.js';

View File

@@ -14,6 +14,7 @@ export * from './00group-runtime/index.js';
export * from './00group-simple/index.js'; export * from './00group-simple/index.js';
// Standalone Components // Standalone Components
export * from './dees-actionbar/index.js';
export * from './dees-badge/index.js'; export * from './dees-badge/index.js';
export * from './dees-chips/index.js'; export * from './dees-chips/index.js';
export * from './dees-contextmenu/index.js'; export * from './dees-contextmenu/index.js';

View File

@@ -2,9 +2,10 @@ import type { TemplateResult } from '@design.estate/dees-element';
import type { IAppBarMenuItem } from './appbarmenuitem.js'; import type { IAppBarMenuItem } from './appbarmenuitem.js';
import type { IMenuItem } from './tab.js'; import type { IMenuItem } from './tab.js';
import type { IMenuGroup } from './menugroup.js'; import type { IMenuGroup } from './menugroup.js';
import type { ISecondaryMenuGroup, ISecondaryMenuItem } from './secondarymenu.js';
// Forward declaration for circular reference // Forward declaration for circular reference
export type TDeesAppuiBase = HTMLElement & { export type TDeesAppui = HTMLElement & {
setAppBarMenus: (menus: IAppBarMenuItem[]) => void; setAppBarMenus: (menus: IAppBarMenuItem[]) => void;
updateAppBarMenu: (name: string, update: Partial<IAppBarMenuItem>) => void; updateAppBarMenu: (name: string, update: Partial<IAppBarMenuItem>) => void;
setBreadcrumbs: (breadcrumbs: string | string[]) => void; setBreadcrumbs: (breadcrumbs: string | string[]) => void;
@@ -25,9 +26,9 @@ export type TDeesAppuiBase = HTMLElement & {
setContentTabsAutoHide: (enabled: boolean, threshold?: number) => void; setContentTabsAutoHide: (enabled: boolean, threshold?: number) => void;
setMainMenuBadge: (tabKey: string, badge: string | number) => void; setMainMenuBadge: (tabKey: string, badge: string | number) => void;
clearMainMenuBadge: (tabKey: string) => void; clearMainMenuBadge: (tabKey: string) => void;
setSecondaryMenu: (config: { heading?: string; groups: IMenuGroup[] }) => void; setSecondaryMenu: (config: { heading?: string; groups: ISecondaryMenuGroup[] }) => void;
updateSecondaryMenuGroup: (groupName: string, update: Partial<IMenuGroup>) => void; updateSecondaryMenuGroup: (groupName: string, update: Partial<ISecondaryMenuGroup>) => void;
addSecondaryMenuItem: (groupName: string, item: IMenuGroup['items'][0]) => void; addSecondaryMenuItem: (groupName: string, item: ISecondaryMenuItem) => void;
setSecondaryMenuSelection: (itemKey: string) => void; setSecondaryMenuSelection: (itemKey: string) => void;
clearSecondaryMenu: () => void; clearSecondaryMenu: () => void;
setContentTabs: (tabs: IMenuItem[]) => void; setContentTabs: (tabs: IMenuItem[]) => void;
@@ -36,6 +37,9 @@ export type TDeesAppuiBase = HTMLElement & {
selectContentTab: (tabKey: string) => void; selectContentTab: (tabKey: string) => void;
getSelectedContentTab: () => IMenuItem | undefined; getSelectedContentTab: () => IMenuItem | undefined;
activityLog: IActivityLogAPI; activityLog: IActivityLogAPI;
setActivityLogVisible: (visible: boolean) => void;
toggleActivityLog: () => void;
getActivityLogVisible: () => boolean;
navigateToView: (viewId: string, params?: Record<string, string>) => Promise<boolean>; navigateToView: (viewId: string, params?: Record<string, string>) => Promise<boolean>;
getCurrentView: () => IViewDefinition | undefined; getCurrentView: () => IViewDefinition | undefined;
}; };
@@ -92,8 +96,8 @@ export interface IActivityLogAPI {
* View activation context passed to onActivate lifecycle hook * View activation context passed to onActivate lifecycle hook
*/ */
export interface IViewActivationContext { export interface IViewActivationContext {
/** Reference to the DeesAppuiBase instance */ /** Reference to the DeesAppui instance */
appui: TDeesAppuiBase; appui: TDeesAppui;
/** The view ID being activated */ /** The view ID being activated */
viewId: string; viewId: string;
/** Route parameters if any */ /** Route parameters if any */
@@ -136,7 +140,7 @@ export interface IViewDefinition {
| (() => TemplateResult) | (() => TemplateResult)
| (() => Promise<string | (new () => HTMLElement) | (() => TemplateResult)>); | (() => Promise<string | (new () => HTMLElement) | (() => TemplateResult)>);
/** Secondary menu items specific to this view */ /** Secondary menu items specific to this view */
secondaryMenu?: IMenuGroup[]; secondaryMenu?: ISecondaryMenuGroup[];
/** Content tabs specific to this view */ /** Content tabs specific to this view */
contentTabs?: IMenuItem[]; contentTabs?: IMenuItem[];
/** Optional route path (defaults to id). Supports params like 'settings/:section' */ /** Optional route path (defaults to id). Supports params like 'settings/:section' */
@@ -208,7 +212,7 @@ export interface IActivityLogConfig {
} }
/** /**
* Main unified configuration interface for dees-appui-base * Main unified configuration interface for dees-appui
*/ */
export interface IAppConfig { export interface IAppConfig {
/** Application branding */ /** Application branding */

View File

@@ -2,3 +2,4 @@ export * from './tab.js';
export * from './appbarmenuitem.js'; export * from './appbarmenuitem.js';
export * from './menugroup.js'; export * from './menugroup.js';
export * from './appconfig.js'; export * from './appconfig.js';
export * from './secondarymenu.js';

View File

@@ -0,0 +1,93 @@
/**
* Secondary Menu Item Types
*
* Supports 8 item types:
* 1. Tab - selectable, stays highlighted (existing behavior)
* 2. Action - executes without selection (primary = blue)
* 3. Danger Action - red styling with optional confirmation
* 4. Filter - checkbox toggle, emits immediately
* 5. Multi-Filter - collapsible box with multiple checkboxes
* 6. Divider - visual separator
* 7. Header - non-interactive label
* 8. Link - opens URL
*/
// Base properties shared by interactive items
export interface ISecondaryMenuItemBase {
key: string;
iconName?: string;
disabled?: boolean;
hidden?: boolean;
}
// 1. Tab - existing behavior (selectable, stays highlighted)
export interface ISecondaryMenuItemTab extends ISecondaryMenuItemBase {
type?: 'tab'; // default if omitted for backward compatibility
action: () => void;
badge?: string | number;
badgeVariant?: 'default' | 'success' | 'warning' | 'error';
}
// 2 & 3. Action - executes without selection
export interface ISecondaryMenuItemAction extends ISecondaryMenuItemBase {
type: 'action';
action: () => void | Promise<void>;
variant?: 'primary' | 'danger'; // primary = blue (default), danger = red
confirmMessage?: string; // Shows confirmation dialog before executing
}
// 4. Single filter toggle
export interface ISecondaryMenuItemFilter extends ISecondaryMenuItemBase {
type: 'filter';
active: boolean;
onToggle: (active: boolean) => void;
}
// 5. Multi-select filter group (collapsible)
export interface ISecondaryMenuItemMultiFilter extends ISecondaryMenuItemBase {
type: 'multiFilter';
collapsed?: boolean; // Accordion state
options: Array<{
key: string;
label: string;
checked: boolean;
iconName?: string;
}>;
onChange: (selectedKeys: string[]) => void;
}
// 6. Divider
export interface ISecondaryMenuItemDivider {
type: 'divider';
}
// 7. Header/Label
export interface ISecondaryMenuItemHeader {
type: 'header';
label: string;
}
// 8. External link
export interface ISecondaryMenuItemLink extends ISecondaryMenuItemBase {
type: 'link';
href: string;
external?: boolean; // Opens in new tab (default: true if href starts with http)
}
// Union type for all secondary menu items
export type ISecondaryMenuItem =
| ISecondaryMenuItemTab
| ISecondaryMenuItemAction
| ISecondaryMenuItemFilter
| ISecondaryMenuItemMultiFilter
| ISecondaryMenuItemDivider
| ISecondaryMenuItemHeader
| ISecondaryMenuItemLink;
// Group interface for secondary menu
export interface ISecondaryMenuGroup {
name: string;
iconName?: string;
collapsed?: boolean;
items: ISecondaryMenuItem[];
}

View File

@@ -0,0 +1,285 @@
import { CDN_BASE, CDN_VERSIONS } from './versions.js';
// Type imports (no runtime overhead)
import type { Terminal, ITerminalOptions } from 'xterm';
import type { FitAddon } from 'xterm-addon-fit';
import type { HLJSApi } from 'highlight.js';
import type ApexChartsType from 'apexcharts';
import type { Editor, EditorOptions } from '@tiptap/core';
import type { StarterKitOptions } from '@tiptap/starter-kit';
import type { UnderlineOptions } from '@tiptap/extension-underline';
import type { TextAlignOptions } from '@tiptap/extension-text-align';
import type { LinkOptions } from '@tiptap/extension-link';
/**
* Bundle type for xterm and its addons
*/
export interface IXtermBundle {
Terminal: typeof Terminal;
}
/**
* Bundle type for xterm-addon-fit
*/
export interface IXtermFitAddonBundle {
FitAddon: typeof FitAddon;
}
/**
* Bundle type for Tiptap editor and extensions
*/
export interface ITiptapBundle {
Editor: typeof Editor;
StarterKit: { configure: (options?: Partial<StarterKitOptions>) => any };
Underline: { configure: (options?: Partial<UnderlineOptions>) => any };
TextAlign: { configure: (options?: Partial<TextAlignOptions>) => any };
Link: { configure: (options?: Partial<LinkOptions>) => any };
Typography: { configure: (options?: any) => any };
}
/**
* Singleton service for lazy-loading heavy libraries from CDN.
*
* This reduces initial bundle size by loading libraries only when needed.
* Libraries are cached after first load to avoid duplicate fetches.
*
* @example
* ```typescript
* const libLoader = DeesServiceLibLoader.getInstance();
* const xterm = await libLoader.loadXterm();
* const terminal = new xterm.Terminal({ ... });
* ```
*/
export class DeesServiceLibLoader {
private static instance: DeesServiceLibLoader;
// Cached library references
private xtermLib: IXtermBundle | null = null;
private xtermFitAddonLib: IXtermFitAddonBundle | null = null;
private highlightJsLib: HLJSApi | null = null;
private apexChartsLib: typeof ApexChartsType | null = null;
private tiptapLib: ITiptapBundle | null = null;
// Loading promises to prevent duplicate concurrent loads
private xtermLoadingPromise: Promise<IXtermBundle> | null = null;
private xtermFitAddonLoadingPromise: Promise<IXtermFitAddonBundle> | null = null;
private highlightJsLoadingPromise: Promise<HLJSApi> | null = null;
private apexChartsLoadingPromise: Promise<typeof ApexChartsType> | null = null;
private tiptapLoadingPromise: Promise<ITiptapBundle> | null = null;
private constructor() {}
/**
* Get the singleton instance of DeesServiceLibLoader
*/
public static getInstance(): DeesServiceLibLoader {
if (!DeesServiceLibLoader.instance) {
DeesServiceLibLoader.instance = new DeesServiceLibLoader();
}
return DeesServiceLibLoader.instance;
}
/**
* Load xterm terminal emulator from CDN
* @returns Promise resolving to xterm module with Terminal class
*/
public async loadXterm(): Promise<IXtermBundle> {
if (this.xtermLib) {
return this.xtermLib;
}
if (this.xtermLoadingPromise) {
return this.xtermLoadingPromise;
}
this.xtermLoadingPromise = (async () => {
const url = `${CDN_BASE}/xterm@${CDN_VERSIONS.xterm}/+esm`;
const module = await import(/* @vite-ignore */ url);
// Also load and inject xterm CSS
await this.injectXtermStyles();
this.xtermLib = {
Terminal: module.Terminal,
};
return this.xtermLib;
})();
return this.xtermLoadingPromise;
}
/**
* Load xterm-addon-fit from CDN
* @returns Promise resolving to FitAddon class
*/
public async loadXtermFitAddon(): Promise<IXtermFitAddonBundle> {
if (this.xtermFitAddonLib) {
return this.xtermFitAddonLib;
}
if (this.xtermFitAddonLoadingPromise) {
return this.xtermFitAddonLoadingPromise;
}
this.xtermFitAddonLoadingPromise = (async () => {
const url = `${CDN_BASE}/xterm-addon-fit@${CDN_VERSIONS.xtermAddonFit}/+esm`;
const module = await import(/* @vite-ignore */ url);
this.xtermFitAddonLib = {
FitAddon: module.FitAddon,
};
return this.xtermFitAddonLib;
})();
return this.xtermFitAddonLoadingPromise;
}
/**
* Inject xterm CSS styles into the document head
*/
private async injectXtermStyles(): Promise<void> {
const styleId = 'xterm-cdn-styles';
if (document.getElementById(styleId)) {
return; // Already injected
}
const cssUrl = `${CDN_BASE}/xterm@${CDN_VERSIONS.xterm}/css/xterm.css`;
const response = await fetch(cssUrl);
const cssText = await response.text();
const style = document.createElement('style');
style.id = styleId;
style.textContent = cssText;
document.head.appendChild(style);
}
/**
* Load highlight.js syntax highlighter from CDN
* @returns Promise resolving to highlight.js API
*/
public async loadHighlightJs(): Promise<HLJSApi> {
if (this.highlightJsLib) {
return this.highlightJsLib;
}
if (this.highlightJsLoadingPromise) {
return this.highlightJsLoadingPromise;
}
this.highlightJsLoadingPromise = (async () => {
const url = `${CDN_BASE}/highlight.js@${CDN_VERSIONS.highlightJs}/+esm`;
const module = await import(/* @vite-ignore */ url);
this.highlightJsLib = module.default;
return this.highlightJsLib;
})();
return this.highlightJsLoadingPromise;
}
/**
* Load ApexCharts charting library from CDN
* @returns Promise resolving to ApexCharts constructor
*/
public async loadApexCharts(): Promise<typeof ApexChartsType> {
if (this.apexChartsLib) {
return this.apexChartsLib;
}
if (this.apexChartsLoadingPromise) {
return this.apexChartsLoadingPromise;
}
this.apexChartsLoadingPromise = (async () => {
const url = `${CDN_BASE}/apexcharts@${CDN_VERSIONS.apexcharts}/+esm`;
const module = await import(/* @vite-ignore */ url);
this.apexChartsLib = module.default;
return this.apexChartsLib;
})();
return this.apexChartsLoadingPromise;
}
/**
* Load Tiptap rich text editor and extensions from CDN
* @returns Promise resolving to Tiptap bundle with Editor and extensions
*/
public async loadTiptap(): Promise<ITiptapBundle> {
if (this.tiptapLib) {
return this.tiptapLib;
}
if (this.tiptapLoadingPromise) {
return this.tiptapLoadingPromise;
}
this.tiptapLoadingPromise = (async () => {
const version = CDN_VERSIONS.tiptap;
// Load all Tiptap modules in parallel
const [
coreModule,
starterKitModule,
underlineModule,
textAlignModule,
linkModule,
typographyModule,
] = await Promise.all([
import(/* @vite-ignore */ `${CDN_BASE}/@tiptap/core@${version}/+esm`),
import(/* @vite-ignore */ `${CDN_BASE}/@tiptap/starter-kit@${version}/+esm`),
import(/* @vite-ignore */ `${CDN_BASE}/@tiptap/extension-underline@${version}/+esm`),
import(/* @vite-ignore */ `${CDN_BASE}/@tiptap/extension-text-align@${version}/+esm`),
import(/* @vite-ignore */ `${CDN_BASE}/@tiptap/extension-link@${version}/+esm`),
import(/* @vite-ignore */ `${CDN_BASE}/@tiptap/extension-typography@${version}/+esm`),
]);
this.tiptapLib = {
Editor: coreModule.Editor,
StarterKit: starterKitModule.default || starterKitModule.StarterKit,
Underline: underlineModule.default || underlineModule.Underline,
TextAlign: textAlignModule.default || textAlignModule.TextAlign,
Link: linkModule.default || linkModule.Link,
Typography: typographyModule.default || typographyModule.Typography,
};
return this.tiptapLib;
})();
return this.tiptapLoadingPromise;
}
/**
* Preload multiple libraries in parallel
* Useful for warming the cache before components are rendered
*/
public async preloadAll(): Promise<void> {
await Promise.all([
this.loadXterm(),
this.loadXtermFitAddon(),
this.loadHighlightJs(),
this.loadApexCharts(),
this.loadTiptap(),
]);
}
/**
* Check if a specific library is already loaded
*/
public isLoaded(library: 'xterm' | 'xtermFitAddon' | 'highlightJs' | 'apexCharts' | 'tiptap'): boolean {
switch (library) {
case 'xterm':
return this.xtermLib !== null;
case 'xtermFitAddon':
return this.xtermFitAddonLib !== null;
case 'highlightJs':
return this.highlightJsLib !== null;
case 'apexCharts':
return this.apexChartsLib !== null;
case 'tiptap':
return this.tiptapLib !== null;
default:
return false;
}
}
}

3
ts_web/services/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export { DeesServiceLibLoader } from './DeesServiceLibLoader.js';
export type { IXtermBundle, IXtermFitAddonBundle, ITiptapBundle } from './DeesServiceLibLoader.js';
export { CDN_BASE, CDN_VERSIONS } from './versions.js';

View File

@@ -0,0 +1,17 @@
/**
* CDN versions for lazy-loaded libraries.
* Keep these in sync with package.json for type compatibility.
*/
export const CDN_VERSIONS = {
xterm: '5.3.0',
xtermAddonFit: '0.8.0',
highlightJs: '11.11.1',
apexcharts: '5.3.6',
tiptap: '2.23.0',
fontawesome: '7.1.0',
} as const;
/**
* Base CDN URL for jsdelivr ESM imports
*/
export const CDN_BASE = 'https://cdn.jsdelivr.net/npm';

View File

@@ -5,7 +5,7 @@
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"esModuleInterop": true, "esModuleInterop": true,
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
"skipLibCheck": true "skipLibCheck": false
}, },
"exclude": [ "exclude": [
"dist_*/**/*.d.ts" "dist_*/**/*.d.ts"