Comparing version 0.0.226 to 0.0.227
@@ -59,3 +59,3 @@ import { Synthesizer } from 'mount-observer/Synthesizer.js'; | ||
//this.dispatchEvent(new RegistryEventImpl(mergeWithDefaults)); | ||
const { base, block, branches, enhancedElementInstanceOf, enhancedElementMatches, hostInstanceOf, hostMatches, leaves, preBaseDelimiter, preBranchDelimiter, importEnh, preLeafDelimiter, hasRootIn, map, osotas, mapLocalNameTo, ws, mapWSTo } = mergeWithDefaults; | ||
const { base, block, branches, enhancedElementInstanceOf, enhancedElementMatches, hostInstanceOf, hostMatches, leaves, preBaseDelimiter, preBranchDelimiter, importEnh, preLeafDelimiter, hasRootIn, map, osotas, mapLocalNameTo, ws } = mergeWithDefaults; | ||
const mi = { | ||
@@ -80,2 +80,4 @@ on: enhancedElementMatches, | ||
mo.addEventListener('mount', async (e) => { | ||
//TODO: doing this logic asynchronously after pulling in the existing prop | ||
//could result in loss of information | ||
const observedAttrs = await mo.observedAttrs(); | ||
@@ -134,6 +136,3 @@ const { mountedElement } = e; | ||
if (ws !== undefined) { | ||
filteredWs = (await import('./e.js')).e(mountedElement, ws, initialPropValues); | ||
if (mapWSTo !== undefined) { | ||
initialPropValues[mapWSTo] = filteredWs; | ||
} | ||
(await import('./e.js')).e(mergeWithDefaults, mountedElement, ws, initialPropValues); | ||
} | ||
@@ -140,0 +139,0 @@ //initialPropValues.scopedCustomHandlers = scopedHandlers.get(synConfig.top)?.get(enhPropKey); |
@@ -83,3 +83,3 @@ import {Synthesizer} from 'mount-observer/Synthesizer.js'; | ||
preLeafDelimiter, hasRootIn, map, osotas, | ||
mapLocalNameTo, ws, mapWSTo | ||
mapLocalNameTo, ws | ||
@@ -107,2 +107,4 @@ } = mergeWithDefaults; | ||
(mo as any as AddMountEventListener).addEventListener('mount', async e => { | ||
//TODO: doing this logic asynchronously after pulling in the existing prop | ||
//could result in loss of information | ||
const observedAttrs = await mo.observedAttrs(); | ||
@@ -156,6 +158,3 @@ const {mountedElement} = (e as MountEvent); | ||
if(ws !== undefined){ | ||
filteredWs = (await import('./e.js')).e(mountedElement, ws, initialPropValues); | ||
if(mapWSTo !== undefined){ | ||
initialPropValues[mapWSTo] = filteredWs | ||
} | ||
(await import('./e.js')).e(mergeWithDefaults, mountedElement, ws, initialPropValues); | ||
} | ||
@@ -162,0 +161,0 @@ //initialPropValues.scopedCustomHandlers = scopedHandlers.get(synConfig.top)?.get(enhPropKey); |
13
e.js
@@ -1,3 +0,4 @@ | ||
export function e(matchingElement, ws, initialPropVals, ac) { | ||
export function e(emc, matchingElement, ws, initialPropVals, ac) { | ||
const matchingWs = []; | ||
const { mapWSTo, primaryProp } = emc; | ||
for (const w of ws) { | ||
@@ -7,3 +8,3 @@ if (!matchingElement.matches(w.q)) | ||
matchingWs.push(w); | ||
const { listeners, props } = w; | ||
const { listeners, props, primaryVal } = w; | ||
for (const key in listeners) { | ||
@@ -17,4 +18,10 @@ let listener = listeners[key]; | ||
Object.assign(initialPropVals, props); | ||
if (primaryProp !== undefined && primaryVal !== undefined) { | ||
//TODO: check if object and use object.assign? | ||
initialPropVals[primaryProp] = primaryVal; | ||
} | ||
} | ||
return matchingWs; | ||
if (mapWSTo !== undefined) { | ||
initialPropVals[mapWSTo] = matchingWs; | ||
} | ||
} |
16
e.ts
@@ -1,10 +0,11 @@ | ||
import { EventListenerClass, EventListenerOrFn, IW } from "./ts-refs/trans-render/be/types"; | ||
import { EMC, EventListenerClass, EventListenerOrFn, IW } from "./ts-refs/trans-render/be/types"; | ||
export function e(matchingElement: Element, ws: Array<IW>, initialPropVals: any, ac?: AbortController){ | ||
export function e(emc: EMC, matchingElement: Element, ws: Array<IW>, initialPropVals: any, ac?: AbortController){ | ||
const matchingWs = []; | ||
const {mapWSTo, primaryProp} = emc; | ||
for(const w of ws){ | ||
if(!matchingElement.matches(w.q)) continue; | ||
matchingWs.push(w); | ||
const {listeners, props} = w; | ||
const {listeners, props, primaryVal} = w; | ||
for(const key in listeners){ | ||
@@ -18,4 +19,11 @@ let listener = listeners[key] as any; | ||
Object.assign(initialPropVals, props); | ||
if(primaryProp !== undefined && primaryVal !== undefined){ | ||
//TODO: check if object and use object.assign? | ||
initialPropVals[primaryProp] = primaryVal; | ||
} | ||
} | ||
return matchingWs; | ||
if(mapWSTo !== undefined){ | ||
initialPropVals[mapWSTo] = matchingWs; | ||
} | ||
} |
{ | ||
"name": "be-hive", | ||
"version": "0.0.226", | ||
"version": "0.0.227", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "web-components", |
31
w.js
@@ -1,3 +0,3 @@ | ||
export function w(q, ws) { | ||
const returnObj = new W(q); | ||
export function w(q, ws, callback) { | ||
const returnObj = new W(q, callback); | ||
ws.push(returnObj); | ||
@@ -8,4 +8,6 @@ return returnObj; | ||
q; | ||
constructor(q) { | ||
w; | ||
constructor(q, w) { | ||
this.q = q; | ||
this.w = w; | ||
} | ||
@@ -16,10 +18,2 @@ #listeners = {}; | ||
} | ||
#props = {}; | ||
get props() { | ||
return this.#props; | ||
} | ||
#refs = {}; | ||
get refs() { | ||
return this.#refs; | ||
} | ||
/** | ||
@@ -34,2 +28,13 @@ * add events | ||
} | ||
#primaryVal; | ||
get primaryVal() { | ||
return this.#primaryVal; | ||
} | ||
p(val) { | ||
this.#primaryVal = val; | ||
} | ||
#props = {}; | ||
get props() { | ||
return this.#props; | ||
} | ||
/** | ||
@@ -44,2 +49,6 @@ * set props | ||
} | ||
#refs = {}; | ||
get refs() { | ||
return this.#refs; | ||
} | ||
/** | ||
@@ -46,0 +55,0 @@ * register refs |
33
w.ts
import { EventListenerOrFn, OnOptions, IW, MappedListeners } from './ts-refs/trans-render/be/types'; | ||
import { CSSQuery } from './ts-refs/trans-render/types'; | ||
export function w(q: CSSQuery, ws: Array<IW>){ | ||
const returnObj = new W(q); | ||
export function w(q: CSSQuery, ws: Array<IW>, callback: (q: CSSQuery) => W){ | ||
const returnObj = new W(q, callback); | ||
ws.push(returnObj); | ||
@@ -10,3 +10,6 @@ return returnObj; | ||
export class W<T = EventTarget> implements IW<T>{ | ||
constructor(public q: CSSQuery){} | ||
constructor(public q: CSSQuery, public w: (q: CSSQuery) => W){} | ||
#listeners: MappedListeners = {}; | ||
@@ -16,10 +19,2 @@ get listeners(){ | ||
} | ||
#props: Partial<T> = {}; | ||
get props(){ | ||
return this.#props; | ||
} | ||
#refs: {[key: string]: any} = {}; | ||
get refs(){ | ||
return this.#refs; | ||
} | ||
/** | ||
@@ -34,2 +29,13 @@ * add events | ||
} | ||
#primaryVal: any | ||
get primaryVal(){ | ||
return this.#primaryVal | ||
} | ||
p(val: any){ | ||
this.#primaryVal = val; | ||
} | ||
#props: Partial<T> = {}; | ||
get props(){ | ||
return this.#props; | ||
} | ||
/** | ||
@@ -44,3 +50,6 @@ * set props | ||
} | ||
#refs: {[key: string]: any} = {}; | ||
get refs(){ | ||
return this.#refs; | ||
} | ||
/** | ||
@@ -47,0 +56,0 @@ * register refs |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36090
705