import { AttrChangeInfo, MountInit, RootCnfg, ObservedSourceOfTruthAttribute} from 'mount-observer/types.d.ts'; import { RegExpExt } from './prs'; import {IObject$tring, CSSQuery} from './types'; export type stringArray = string | Array; export type stringArrayOrTree = Array | [string, Array]; // export interface AttrParts { // root: string, // base: string, // branch: string, // leaf: string, // } type prefixDelimiter = '-' | ':' | '--'; /** * Abbrev. for EnhancementMountConfig */ export type EMC = EnhancementMountConfig export interface AttrCacheConfig { enable: 'always' | 'instantiating', clone?: boolean } export interface EnhancementMountConfig{ id?: string; enhancedElementInstanceOf?: Array<{new(): Element}>, enhancedElementMatches?: string, enhPropKey: string, hasRootIn?: Array, preBaseDelimiter?: prefixDelimiter, base?: string, preBranchDelimiter?: prefixDelimiter, branches?: Array, //TODO watchedBranches?: Array, //TODO preLeafDelimiter?: prefixDelimiter, //TODO leaves?: Partial<{[key in keyof TBranches & string]: stringArray}>, //TODO hostMatches?: CSSQuery, //TODO hostInstanceOf?: Array<{new(): HTMLElement}>, block?: boolean, //TODO unblock?: boolean, importEnh?: () => Promise<{new(): IEnhancement}> map?: {[key: AttrCoordinates]: AttrMapPoint}, /** * Observed Source of Truth Attributes [TODO, need better name] */ osotas? : Array>, cacheConfig?: AttrCacheConfig, } export type AttrMapPoint = keyof TProps & string | AttrMapConfig export interface AttrMapConfig { instanceOf?: 'Object' | 'String' | 'Object$tring' | 'Object$entences' | 'DSSArray' | 'Boolean' | 'Number', mapsTo?: '.' | keyof TProps, valIfFalsy?: any, strValMapsTo?: keyof TProps, objValMapsTo?: '.' | keyof TProps, arrValMapsTo?: keyof TProps, strArrMapsTo?: keyof TProps, regExpExts?: Partial<{[key in keyof TProps]: RegExpExt[]}>; parsedRegExps?: boolean; } export type Branchitude = number; export type Leafitude = number; export type AttrCoordinates = `${Branchitude}.${Leafitude}`; export type MountBeHive = Partial>; export interface EnhancementInfo { initialPropValues?: any, initialAttrInfo?: Array, mountCnfg?: EMC, } export interface BEAllProps { resolved: boolean; rejected: boolean; enhancedElement: TElement; } export interface IEnhancement extends BEAllProps{ attach(el: TElement, enhancement: EnhancementInfo): Promise; detach(el: TElement): Promise; resolved: boolean; rejected: boolean; readonly enhancedElement: TElement; whenResolved(): Promise; de(src: EventTarget, name: string) : Event, attrChgCB(attrChangeInfos: Array) : void, //parsedFrom: string; //autoImport?: boolean | string; }