feat: add async demo support and enhance template resolution
- Introduced async demo functionality in the README, allowing for asynchronous data preparation before rendering components. - Updated WccDashboard, WccProperties, and WccSidebar to support Promise-based template factories. - Implemented resolveTemplateFactory to handle both synchronous and asynchronous template results. - Added tests for resolveTemplateFactory to ensure correct behavior for both sync and async templates. - Updated pnpm workspace configuration.
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import * as plugins from '../wcctools.plugins.js';
|
||||
import { DeesElement, property, html, customElement, type TemplateResult } from '@design.estate/dees-element';
|
||||
import { WccDashboard } from './wcc-dashboard.js';
|
||||
import type { TTemplateFactory } from './wcctools.helpers.js';
|
||||
|
||||
export type TElementType = 'element' | 'page';
|
||||
|
||||
@customElement('wcc-sidebar')
|
||||
export class WccSidebar extends DeesElement {
|
||||
@property({ attribute: false })
|
||||
public selectedItem: DeesElement | (() => TemplateResult);
|
||||
public selectedItem: DeesElement | TTemplateFactory;
|
||||
|
||||
@property({ attribute: false })
|
||||
public selectedType: TElementType;
|
||||
@@ -202,7 +203,7 @@ export class WccSidebar extends DeesElement {
|
||||
`;
|
||||
}
|
||||
|
||||
public selectItem(typeArg: TElementType, itemNameArg: string, itemArg: (() => TemplateResult) | DeesElement) {
|
||||
public selectItem(typeArg: TElementType, itemNameArg: string, itemArg: TTemplateFactory | DeesElement) {
|
||||
console.log('selected item');
|
||||
console.log(itemNameArg);
|
||||
console.log(itemArg);
|
||||
|
Reference in New Issue
Block a user