mirror of
				https://github.com/jaandrle/deka-dom-el
				synced 2025-11-03 22:59:16 +01:00 
			
		
		
		
	:tap: removed on.attributeChanged and static observedAttributes
This commit is contained in:
		
							
								
								
									
										1
									
								
								dist/esm-with-signals.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/esm-with-signals.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -214,7 +214,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										32
									
								
								dist/esm-with-signals.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								dist/esm-with-signals.js
									
									
									
									
										vendored
									
									
								
							@@ -32,8 +32,8 @@ function onAbort(signal2, listener) {
 | 
				
			|||||||
	};
 | 
						};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function observedAttributes(instance, observedAttribute2) {
 | 
					function observedAttributes(instance, observedAttribute2) {
 | 
				
			||||||
	const { observedAttributes: observedAttributes3 = [] } = instance.constructor;
 | 
						const { observedAttributes: observedAttributes2 = [] } = instance.constructor;
 | 
				
			||||||
	return observedAttributes3.reduce(function(out, name) {
 | 
						return observedAttributes2.reduce(function(out, name) {
 | 
				
			||||||
		out[kebabToCamel(name)] = observedAttribute2(instance, name);
 | 
							out[kebabToCamel(name)] = observedAttribute2(instance, name);
 | 
				
			||||||
		return out;
 | 
							return out;
 | 
				
			||||||
	}, {});
 | 
						}, {});
 | 
				
			||||||
@@ -545,7 +545,7 @@ function connectionsChangesObserverConstructor() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src/customElement.js
 | 
					// src/customElement.js
 | 
				
			||||||
function customElementRender(target, render, props = observedAttributes2) {
 | 
					function customElementRender(target, render, props = {}) {
 | 
				
			||||||
	const custom_element = target.host || target;
 | 
						const custom_element = target.host || target;
 | 
				
			||||||
	scope.push({
 | 
						scope.push({
 | 
				
			||||||
		scope: custom_element,
 | 
							scope: custom_element,
 | 
				
			||||||
@@ -586,9 +586,6 @@ function wrapMethod(obj, method, apply) {
 | 
				
			|||||||
	obj[method] = new Proxy(obj[method] || (() => {
 | 
						obj[method] = new Proxy(obj[method] || (() => {
 | 
				
			||||||
	}), { apply });
 | 
						}), { apply });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function observedAttributes2(instance) {
 | 
					 | 
				
			||||||
	return observedAttributes(instance, (i, n) => i.getAttribute(n));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src/events.js
 | 
					// src/events.js
 | 
				
			||||||
function dispatchEvent(name, options, host) {
 | 
					function dispatchEvent(name, options, host) {
 | 
				
			||||||
@@ -642,26 +639,6 @@ on.disconnectedAsAbort = function(host) {
 | 
				
			|||||||
	host(on.disconnected(() => a.abort()));
 | 
						host(on.disconnected(() => a.abort()));
 | 
				
			||||||
	return a.signal;
 | 
						return a.signal;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
var els_attribute_store = /* @__PURE__ */ new WeakSet();
 | 
					 | 
				
			||||||
on.attributeChanged = function(listener, options) {
 | 
					 | 
				
			||||||
	if (typeof options !== "object")
 | 
					 | 
				
			||||||
		options = {};
 | 
					 | 
				
			||||||
	return function registerElement(element) {
 | 
					 | 
				
			||||||
		element.addEventListener(eva, listener, options);
 | 
					 | 
				
			||||||
		if (element[keyLTE] || els_attribute_store.has(element))
 | 
					 | 
				
			||||||
			return element;
 | 
					 | 
				
			||||||
		if (!enviroment.M) return element;
 | 
					 | 
				
			||||||
		const observer = new enviroment.M(function(mutations) {
 | 
					 | 
				
			||||||
			for (const { attributeName, target } of mutations)
 | 
					 | 
				
			||||||
				target.dispatchEvent(
 | 
					 | 
				
			||||||
					new CustomEvent(eva, { detail: [attributeName, target.getAttribute(attributeName)] })
 | 
					 | 
				
			||||||
				);
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		const c = onAbort(options.signal, () => observer.disconnect());
 | 
					 | 
				
			||||||
		if (c) observer.observe(element, { attributes: true });
 | 
					 | 
				
			||||||
		return element;
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src/signals-lib/helpers.js
 | 
					// src/signals-lib/helpers.js
 | 
				
			||||||
var mark = "__dde_signal";
 | 
					var mark = "__dde_signal";
 | 
				
			||||||
@@ -846,7 +823,7 @@ var key_attributes = "__dde_attributes";
 | 
				
			|||||||
signal.observedAttributes = function(element) {
 | 
					signal.observedAttributes = function(element) {
 | 
				
			||||||
	const store = element[key_attributes] = {};
 | 
						const store = element[key_attributes] = {};
 | 
				
			||||||
	const attrs = observedAttributes(element, observedAttribute(store));
 | 
						const attrs = observedAttributes(element, observedAttribute(store));
 | 
				
			||||||
	on.attributeChanged(function attributeChangeToSignal({ detail }) {
 | 
						on(eva, function attributeChangeToSignal({ detail }) {
 | 
				
			||||||
		/*! This maps attributes to signals (`S.observedAttributes`).
 | 
							/*! This maps attributes to signals (`S.observedAttributes`).
 | 
				
			||||||
			Investigate `__dde_attributes` key of the element. */
 | 
								Investigate `__dde_attributes` key of the element. */
 | 
				
			||||||
		const [name, value] = detail;
 | 
							const [name, value] = detail;
 | 
				
			||||||
@@ -997,7 +974,6 @@ export {
 | 
				
			|||||||
	elementAttribute,
 | 
						elementAttribute,
 | 
				
			||||||
	isSignal,
 | 
						isSignal,
 | 
				
			||||||
	lifecyclesToEvents,
 | 
						lifecyclesToEvents,
 | 
				
			||||||
	observedAttributes2 as observedAttributes,
 | 
					 | 
				
			||||||
	on,
 | 
						on,
 | 
				
			||||||
	queue,
 | 
						queue,
 | 
				
			||||||
	registerReactivity,
 | 
						registerReactivity,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								dist/esm-with-signals.min.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/esm-with-signals.min.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -214,7 +214,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								dist/esm-with-signals.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/esm-with-signals.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								dist/esm.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/esm.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -213,7 +213,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								dist/esm.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								dist/esm.js
									
									
									
									
										vendored
									
									
								
							@@ -21,16 +21,6 @@ function onAbort(signal, listener) {
 | 
				
			|||||||
		signal.removeEventListener("abort", listener);
 | 
							signal.removeEventListener("abort", listener);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function observedAttributes(instance, observedAttribute) {
 | 
					 | 
				
			||||||
	const { observedAttributes: observedAttributes3 = [] } = instance.constructor;
 | 
					 | 
				
			||||||
	return observedAttributes3.reduce(function(out, name) {
 | 
					 | 
				
			||||||
		out[kebabToCamel(name)] = observedAttribute(instance, name);
 | 
					 | 
				
			||||||
		return out;
 | 
					 | 
				
			||||||
	}, {});
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
function kebabToCamel(name) {
 | 
					 | 
				
			||||||
	return name.replace(/-./g, (x) => x[1].toUpperCase());
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src/signals-lib/common.js
 | 
					// src/signals-lib/common.js
 | 
				
			||||||
var signals_global = {
 | 
					var signals_global = {
 | 
				
			||||||
@@ -522,7 +512,7 @@ function connectionsChangesObserverConstructor() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src/customElement.js
 | 
					// src/customElement.js
 | 
				
			||||||
function customElementRender(target, render, props = observedAttributes2) {
 | 
					function customElementRender(target, render, props = {}) {
 | 
				
			||||||
	const custom_element = target.host || target;
 | 
						const custom_element = target.host || target;
 | 
				
			||||||
	scope.push({
 | 
						scope.push({
 | 
				
			||||||
		scope: custom_element,
 | 
							scope: custom_element,
 | 
				
			||||||
@@ -563,9 +553,6 @@ function wrapMethod(obj, method, apply) {
 | 
				
			|||||||
	obj[method] = new Proxy(obj[method] || (() => {
 | 
						obj[method] = new Proxy(obj[method] || (() => {
 | 
				
			||||||
	}), { apply });
 | 
						}), { apply });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
function observedAttributes2(instance) {
 | 
					 | 
				
			||||||
	return observedAttributes(instance, (i, n) => i.getAttribute(n));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// src/events.js
 | 
					// src/events.js
 | 
				
			||||||
function dispatchEvent(name, options, host) {
 | 
					function dispatchEvent(name, options, host) {
 | 
				
			||||||
@@ -619,26 +606,6 @@ on.disconnectedAsAbort = function(host) {
 | 
				
			|||||||
	host(on.disconnected(() => a.abort()));
 | 
						host(on.disconnected(() => a.abort()));
 | 
				
			||||||
	return a.signal;
 | 
						return a.signal;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
var els_attribute_store = /* @__PURE__ */ new WeakSet();
 | 
					 | 
				
			||||||
on.attributeChanged = function(listener, options) {
 | 
					 | 
				
			||||||
	if (typeof options !== "object")
 | 
					 | 
				
			||||||
		options = {};
 | 
					 | 
				
			||||||
	return function registerElement(element) {
 | 
					 | 
				
			||||||
		element.addEventListener(eva, listener, options);
 | 
					 | 
				
			||||||
		if (element[keyLTE] || els_attribute_store.has(element))
 | 
					 | 
				
			||||||
			return element;
 | 
					 | 
				
			||||||
		if (!enviroment.M) return element;
 | 
					 | 
				
			||||||
		const observer = new enviroment.M(function(mutations) {
 | 
					 | 
				
			||||||
			for (const { attributeName, target } of mutations)
 | 
					 | 
				
			||||||
				target.dispatchEvent(
 | 
					 | 
				
			||||||
					new CustomEvent(eva, { detail: [attributeName, target.getAttribute(attributeName)] })
 | 
					 | 
				
			||||||
				);
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		const c = onAbort(options.signal, () => observer.disconnect());
 | 
					 | 
				
			||||||
		if (c) observer.observe(element, { attributes: true });
 | 
					 | 
				
			||||||
		return element;
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
export {
 | 
					export {
 | 
				
			||||||
	assign,
 | 
						assign,
 | 
				
			||||||
	assignAttribute,
 | 
						assignAttribute,
 | 
				
			||||||
@@ -653,7 +620,6 @@ export {
 | 
				
			|||||||
	createElementNS as elNS,
 | 
						createElementNS as elNS,
 | 
				
			||||||
	elementAttribute,
 | 
						elementAttribute,
 | 
				
			||||||
	lifecyclesToEvents,
 | 
						lifecyclesToEvents,
 | 
				
			||||||
	observedAttributes2 as observedAttributes,
 | 
					 | 
				
			||||||
	on,
 | 
						on,
 | 
				
			||||||
	queue,
 | 
						queue,
 | 
				
			||||||
	registerReactivity,
 | 
						registerReactivity,
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								dist/esm.min.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/esm.min.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -213,7 +213,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								dist/esm.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/esm.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								dist/iife-with-signals.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/iife-with-signals.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -214,7 +214,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										32
									
								
								dist/iife-with-signals.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										32
									
								
								dist/iife-with-signals.js
									
									
									
									
										vendored
									
									
								
							@@ -35,7 +35,6 @@ var DDE = (() => {
 | 
				
			|||||||
		elementAttribute: () => elementAttribute,
 | 
							elementAttribute: () => elementAttribute,
 | 
				
			||||||
		isSignal: () => isSignal,
 | 
							isSignal: () => isSignal,
 | 
				
			||||||
		lifecyclesToEvents: () => lifecyclesToEvents,
 | 
							lifecyclesToEvents: () => lifecyclesToEvents,
 | 
				
			||||||
		observedAttributes: () => observedAttributes2,
 | 
					 | 
				
			||||||
		on: () => on,
 | 
							on: () => on,
 | 
				
			||||||
		queue: () => queue,
 | 
							queue: () => queue,
 | 
				
			||||||
		registerReactivity: () => registerReactivity,
 | 
							registerReactivity: () => registerReactivity,
 | 
				
			||||||
@@ -78,8 +77,8 @@ var DDE = (() => {
 | 
				
			|||||||
		};
 | 
							};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	function observedAttributes(instance, observedAttribute2) {
 | 
						function observedAttributes(instance, observedAttribute2) {
 | 
				
			||||||
		const { observedAttributes: observedAttributes3 = [] } = instance.constructor;
 | 
							const { observedAttributes: observedAttributes2 = [] } = instance.constructor;
 | 
				
			||||||
		return observedAttributes3.reduce(function(out, name) {
 | 
							return observedAttributes2.reduce(function(out, name) {
 | 
				
			||||||
			out[kebabToCamel(name)] = observedAttribute2(instance, name);
 | 
								out[kebabToCamel(name)] = observedAttribute2(instance, name);
 | 
				
			||||||
			return out;
 | 
								return out;
 | 
				
			||||||
		}, {});
 | 
							}, {});
 | 
				
			||||||
@@ -591,7 +590,7 @@ var DDE = (() => {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// src/customElement.js
 | 
						// src/customElement.js
 | 
				
			||||||
	function customElementRender(target, render, props = observedAttributes2) {
 | 
						function customElementRender(target, render, props = {}) {
 | 
				
			||||||
		const custom_element = target.host || target;
 | 
							const custom_element = target.host || target;
 | 
				
			||||||
		scope.push({
 | 
							scope.push({
 | 
				
			||||||
			scope: custom_element,
 | 
								scope: custom_element,
 | 
				
			||||||
@@ -632,9 +631,6 @@ var DDE = (() => {
 | 
				
			|||||||
		obj[method] = new Proxy(obj[method] || (() => {
 | 
							obj[method] = new Proxy(obj[method] || (() => {
 | 
				
			||||||
		}), { apply });
 | 
							}), { apply });
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	function observedAttributes2(instance) {
 | 
					 | 
				
			||||||
		return observedAttributes(instance, (i, n) => i.getAttribute(n));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// src/events.js
 | 
						// src/events.js
 | 
				
			||||||
	function dispatchEvent(name, options, host) {
 | 
						function dispatchEvent(name, options, host) {
 | 
				
			||||||
@@ -688,26 +684,6 @@ var DDE = (() => {
 | 
				
			|||||||
		host(on.disconnected(() => a.abort()));
 | 
							host(on.disconnected(() => a.abort()));
 | 
				
			||||||
		return a.signal;
 | 
							return a.signal;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	var els_attribute_store = /* @__PURE__ */ new WeakSet();
 | 
					 | 
				
			||||||
	on.attributeChanged = function(listener, options) {
 | 
					 | 
				
			||||||
		if (typeof options !== "object")
 | 
					 | 
				
			||||||
			options = {};
 | 
					 | 
				
			||||||
		return function registerElement(element) {
 | 
					 | 
				
			||||||
			element.addEventListener(eva, listener, options);
 | 
					 | 
				
			||||||
			if (element[keyLTE] || els_attribute_store.has(element))
 | 
					 | 
				
			||||||
				return element;
 | 
					 | 
				
			||||||
			if (!enviroment.M) return element;
 | 
					 | 
				
			||||||
			const observer = new enviroment.M(function(mutations) {
 | 
					 | 
				
			||||||
				for (const { attributeName, target } of mutations)
 | 
					 | 
				
			||||||
					target.dispatchEvent(
 | 
					 | 
				
			||||||
						new CustomEvent(eva, { detail: [attributeName, target.getAttribute(attributeName)] })
 | 
					 | 
				
			||||||
					);
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
			const c = onAbort(options.signal, () => observer.disconnect());
 | 
					 | 
				
			||||||
			if (c) observer.observe(element, { attributes: true });
 | 
					 | 
				
			||||||
			return element;
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// src/signals-lib/helpers.js
 | 
						// src/signals-lib/helpers.js
 | 
				
			||||||
	var mark = "__dde_signal";
 | 
						var mark = "__dde_signal";
 | 
				
			||||||
@@ -892,7 +868,7 @@ var DDE = (() => {
 | 
				
			|||||||
	signal.observedAttributes = function(element) {
 | 
						signal.observedAttributes = function(element) {
 | 
				
			||||||
		const store = element[key_attributes] = {};
 | 
							const store = element[key_attributes] = {};
 | 
				
			||||||
		const attrs = observedAttributes(element, observedAttribute(store));
 | 
							const attrs = observedAttributes(element, observedAttribute(store));
 | 
				
			||||||
		on.attributeChanged(function attributeChangeToSignal({ detail }) {
 | 
							on(eva, function attributeChangeToSignal({ detail }) {
 | 
				
			||||||
			/*! This maps attributes to signals (`S.observedAttributes`).
 | 
								/*! This maps attributes to signals (`S.observedAttributes`).
 | 
				
			||||||
				Investigate `__dde_attributes` key of the element. */
 | 
									Investigate `__dde_attributes` key of the element. */
 | 
				
			||||||
			const [name, value] = detail;
 | 
								const [name, value] = detail;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								dist/iife-with-signals.min.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/iife-with-signals.min.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -214,7 +214,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								dist/iife-with-signals.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								dist/iife-with-signals.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								dist/iife.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/iife.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -213,7 +213,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								dist/iife.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								dist/iife.js
									
									
									
									
										vendored
									
									
								
							@@ -33,7 +33,6 @@ var DDE = (() => {
 | 
				
			|||||||
		elNS: () => createElementNS,
 | 
							elNS: () => createElementNS,
 | 
				
			||||||
		elementAttribute: () => elementAttribute,
 | 
							elementAttribute: () => elementAttribute,
 | 
				
			||||||
		lifecyclesToEvents: () => lifecyclesToEvents,
 | 
							lifecyclesToEvents: () => lifecyclesToEvents,
 | 
				
			||||||
		observedAttributes: () => observedAttributes2,
 | 
					 | 
				
			||||||
		on: () => on,
 | 
							on: () => on,
 | 
				
			||||||
		queue: () => queue,
 | 
							queue: () => queue,
 | 
				
			||||||
		registerReactivity: () => registerReactivity,
 | 
							registerReactivity: () => registerReactivity,
 | 
				
			||||||
@@ -64,16 +63,6 @@ var DDE = (() => {
 | 
				
			|||||||
			signal.removeEventListener("abort", listener);
 | 
								signal.removeEventListener("abort", listener);
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	function observedAttributes(instance, observedAttribute) {
 | 
					 | 
				
			||||||
		const { observedAttributes: observedAttributes3 = [] } = instance.constructor;
 | 
					 | 
				
			||||||
		return observedAttributes3.reduce(function(out, name) {
 | 
					 | 
				
			||||||
			out[kebabToCamel(name)] = observedAttribute(instance, name);
 | 
					 | 
				
			||||||
			return out;
 | 
					 | 
				
			||||||
		}, {});
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	function kebabToCamel(name) {
 | 
					 | 
				
			||||||
		return name.replace(/-./g, (x) => x[1].toUpperCase());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// src/signals-lib/common.js
 | 
						// src/signals-lib/common.js
 | 
				
			||||||
	var signals_global = {
 | 
						var signals_global = {
 | 
				
			||||||
@@ -565,7 +554,7 @@ var DDE = (() => {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// src/customElement.js
 | 
						// src/customElement.js
 | 
				
			||||||
	function customElementRender(target, render, props = observedAttributes2) {
 | 
						function customElementRender(target, render, props = {}) {
 | 
				
			||||||
		const custom_element = target.host || target;
 | 
							const custom_element = target.host || target;
 | 
				
			||||||
		scope.push({
 | 
							scope.push({
 | 
				
			||||||
			scope: custom_element,
 | 
								scope: custom_element,
 | 
				
			||||||
@@ -606,9 +595,6 @@ var DDE = (() => {
 | 
				
			|||||||
		obj[method] = new Proxy(obj[method] || (() => {
 | 
							obj[method] = new Proxy(obj[method] || (() => {
 | 
				
			||||||
		}), { apply });
 | 
							}), { apply });
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	function observedAttributes2(instance) {
 | 
					 | 
				
			||||||
		return observedAttributes(instance, (i, n) => i.getAttribute(n));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// src/events.js
 | 
						// src/events.js
 | 
				
			||||||
	function dispatchEvent(name, options, host) {
 | 
						function dispatchEvent(name, options, host) {
 | 
				
			||||||
@@ -662,25 +648,5 @@ var DDE = (() => {
 | 
				
			|||||||
		host(on.disconnected(() => a.abort()));
 | 
							host(on.disconnected(() => a.abort()));
 | 
				
			||||||
		return a.signal;
 | 
							return a.signal;
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
	var els_attribute_store = /* @__PURE__ */ new WeakSet();
 | 
					 | 
				
			||||||
	on.attributeChanged = function(listener, options) {
 | 
					 | 
				
			||||||
		if (typeof options !== "object")
 | 
					 | 
				
			||||||
			options = {};
 | 
					 | 
				
			||||||
		return function registerElement(element) {
 | 
					 | 
				
			||||||
			element.addEventListener(eva, listener, options);
 | 
					 | 
				
			||||||
			if (element[keyLTE] || els_attribute_store.has(element))
 | 
					 | 
				
			||||||
				return element;
 | 
					 | 
				
			||||||
			if (!enviroment.M) return element;
 | 
					 | 
				
			||||||
			const observer = new enviroment.M(function(mutations) {
 | 
					 | 
				
			||||||
				for (const { attributeName, target } of mutations)
 | 
					 | 
				
			||||||
					target.dispatchEvent(
 | 
					 | 
				
			||||||
						new CustomEvent(eva, { detail: [attributeName, target.getAttribute(attributeName)] })
 | 
					 | 
				
			||||||
					);
 | 
					 | 
				
			||||||
			});
 | 
					 | 
				
			||||||
			const c = onAbort(options.signal, () => observer.disconnect());
 | 
					 | 
				
			||||||
			if (c) observer.observe(element, { attributes: true });
 | 
					 | 
				
			||||||
			return element;
 | 
					 | 
				
			||||||
		};
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
	return __toCommonJS(index_exports);
 | 
						return __toCommonJS(index_exports);
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								dist/iife.min.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								dist/iife.min.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -213,7 +213,6 @@ export const scope: {
 | 
				
			|||||||
export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
					export function customElementRender<EL extends HTMLElement, P extends any = Record<string, string | Signal<string, {}>>>(target: ShadowRoot | EL, render: (props: P) => SupportedElement | DocumentFragment, props?: P | ((el: EL) => P)): EL;
 | 
				
			||||||
export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function customElementWithDDE<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
					export function lifecyclesToEvents<EL extends (new () => HTMLElement)>(custom_element: EL): EL;
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>;
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 * are finished before the page is sent to the client.
 | 
					 * are finished before the page is sent to the client.
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								dist/iife.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/iife.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -2,7 +2,6 @@
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
	customElementRender,
 | 
						customElementRender,
 | 
				
			||||||
	customElementWithDDE,
 | 
						customElementWithDDE,
 | 
				
			||||||
	observedAttributes,
 | 
					 | 
				
			||||||
} from "deka-dom-el";
 | 
					} from "deka-dom-el";
 | 
				
			||||||
/** @type {ddePublicElementTagNameMap} */
 | 
					/** @type {ddePublicElementTagNameMap} */
 | 
				
			||||||
import { S } from "deka-dom-el/signals";
 | 
					import { S } from "deka-dom-el/signals";
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
import {
 | 
					import {
 | 
				
			||||||
	customElementRender,
 | 
						customElementRender,
 | 
				
			||||||
	customElementWithDDE,
 | 
						customElementWithDDE,
 | 
				
			||||||
	observedAttributes,
 | 
					 | 
				
			||||||
	el, on, scope,
 | 
						el, on, scope,
 | 
				
			||||||
} from "deka-dom-el";
 | 
					} from "deka-dom-el";
 | 
				
			||||||
import { S } from "deka-dom-el/signals";
 | 
					import { S } from "deka-dom-el/signals";
 | 
				
			||||||
@@ -9,7 +8,6 @@ export class HTMLCustomElement extends HTMLElement{
 | 
				
			|||||||
	static tagName= "custom-element";
 | 
						static tagName= "custom-element";
 | 
				
			||||||
	static observedAttributes= [ "attr" ];
 | 
						static observedAttributes= [ "attr" ];
 | 
				
			||||||
	connectedCallback(){
 | 
						connectedCallback(){
 | 
				
			||||||
		console.log(observedAttributes(this));
 | 
					 | 
				
			||||||
		customElementRender(
 | 
							customElementRender(
 | 
				
			||||||
			this.attachShadow({ mode: "open" }),
 | 
								this.attachShadow({ mode: "open" }),
 | 
				
			||||||
			ddeComponent,
 | 
								ddeComponent,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,7 +3,6 @@ const paragraph= el("p", "See live-cycle events in console.",
 | 
				
			|||||||
	el=> log({ type: "dde:created", detail: el }),
 | 
						el=> log({ type: "dde:created", detail: el }),
 | 
				
			||||||
	on.connected(log),
 | 
						on.connected(log),
 | 
				
			||||||
	on.disconnected(log),
 | 
						on.disconnected(log),
 | 
				
			||||||
	on.attributeChanged(log));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
document.body.append(
 | 
					document.body.append(
 | 
				
			||||||
	paragraph,
 | 
						paragraph,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,10 +11,6 @@ export function mnemonic(){
 | 
				
			|||||||
			el("code", "customElementWithDDE(<custom-element>)"),
 | 
								el("code", "customElementWithDDE(<custom-element>)"),
 | 
				
			||||||
			" — register <custom-element> to DDE library, see also `lifecyclesToEvents`, can be also used as decorator",
 | 
								" — register <custom-element> to DDE library, see also `lifecyclesToEvents`, can be also used as decorator",
 | 
				
			||||||
		),
 | 
							),
 | 
				
			||||||
		el("li").append(
 | 
					 | 
				
			||||||
			el("code", "observedAttributes(<custom-element>)"),
 | 
					 | 
				
			||||||
			" — returns record of observed attributes (keys uses camelCase)",
 | 
					 | 
				
			||||||
		),
 | 
					 | 
				
			||||||
		el("li").append(
 | 
							el("li").append(
 | 
				
			||||||
			el("code", "S.observedAttributes(<custom-element>)"),
 | 
								el("code", "S.observedAttributes(<custom-element>)"),
 | 
				
			||||||
			" — returns record of observed attributes (keys uses camelCase and values are signals)",
 | 
								" — returns record of observed attributes (keys uses camelCase and values are signals)",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -165,9 +165,6 @@ export function page({ pkg, info }){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				el("dt", t`on.disconnected(callback)`),
 | 
									el("dt", t`on.disconnected(callback)`),
 | 
				
			||||||
				el("dd", t`Fires when the element is removed from the DOM`),
 | 
									el("dd", t`Fires when the element is removed from the DOM`),
 | 
				
			||||||
 | 
					 | 
				
			||||||
				el("dt", t`on.attributeChanged(callback, attributeName)`),
 | 
					 | 
				
			||||||
				el("dd", t`Fires when the specified attribute changes`)
 | 
					 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		),
 | 
							),
 | 
				
			||||||
		el(example, { src: fileURL("./components/examples/events/live-cycle.js"), page_id }),
 | 
							el(example, { src: fileURL("./components/examples/events/live-cycle.js"), page_id }),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -115,7 +115,7 @@ export function page({ pkg, info }){
 | 
				
			|||||||
				el("dt", t`Usage`),
 | 
									el("dt", t`Usage`),
 | 
				
			||||||
				el("dd", t`customElementWithDDE(YourElementClass)`),
 | 
									el("dd", t`customElementWithDDE(YourElementClass)`),
 | 
				
			||||||
				el("dt", t`Benefits`),
 | 
									el("dt", t`Benefits`),
 | 
				
			||||||
				el("dd", t`Allows using on.connected(), on.disconnected(), etc. with your element`)
 | 
									el("dd", t`Allows using on.connected(), on.disconnected() or S.observedAttributes().`)
 | 
				
			||||||
			)
 | 
								)
 | 
				
			||||||
		),
 | 
							),
 | 
				
			||||||
		el(example, { src: fileURL("./components/examples/customElement/customElementWithDDE.js"), page_id }),
 | 
							el(example, { src: fileURL("./components/examples/customElement/customElementWithDDE.js"), page_id }),
 | 
				
			||||||
@@ -142,7 +142,8 @@ export function page({ pkg, info }){
 | 
				
			|||||||
					el("ol").append(
 | 
										el("ol").append(
 | 
				
			||||||
						el("li", t`Target (usually this or this.shadowRoot)`),
 | 
											el("li", t`Target (usually this or this.shadowRoot)`),
 | 
				
			||||||
						el("li", t`Component function that returns a DOM tree`),
 | 
											el("li", t`Component function that returns a DOM tree`),
 | 
				
			||||||
						el("li", t`Optional: Attributes transformer function (default or S.observedAttributes)`)
 | 
											el("li", t`Optional: Attributes transformer function (empty by default or
 | 
				
			||||||
 | 
												S.observedAttributes)`)
 | 
				
			||||||
					)
 | 
										)
 | 
				
			||||||
				),
 | 
									),
 | 
				
			||||||
				el("dt", t`Returns`),
 | 
									el("dt", t`Returns`),
 | 
				
			||||||
@@ -169,7 +170,8 @@ export function page({ pkg, info }){
 | 
				
			|||||||
			`),
 | 
								`),
 | 
				
			||||||
			el("ol").append(
 | 
								el("ol").append(
 | 
				
			||||||
				el("li").append(...T`
 | 
									el("li").append(...T`
 | 
				
			||||||
					${el("code", "observedAttributes")} - Passes attributes as regular values (static)
 | 
										Using standard attribute access (${el("code", "this.getAttribute(<name>)")}) - Passes attributes as
 | 
				
			||||||
 | 
										regular values (static)
 | 
				
			||||||
				`),
 | 
									`),
 | 
				
			||||||
				el("li").append(...T`
 | 
									el("li").append(...T`
 | 
				
			||||||
					${el("code", "S.observedAttributes")} - Transforms attributes into signals (reactive)
 | 
										${el("code", "S.observedAttributes")} - Transforms attributes into signals (reactive)
 | 
				
			||||||
@@ -177,7 +179,7 @@ export function page({ pkg, info }){
 | 
				
			|||||||
			)
 | 
								)
 | 
				
			||||||
		),
 | 
							),
 | 
				
			||||||
		el("p").append(...T`
 | 
							el("p").append(...T`
 | 
				
			||||||
			Using ${el("code", "S.observedAttributes")} creates a reactive connection between your element's attributes
 | 
								Using the ${el("code", "S.observedAttributes")} creates a reactive connection between your element's attributes
 | 
				
			||||||
			and its internal rendering. When attributes change, your component automatically updates!
 | 
								and its internal rendering. When attributes change, your component automatically updates!
 | 
				
			||||||
		`),
 | 
							`),
 | 
				
			||||||
		el(example, { src: fileURL("./components/examples/customElement/observedAttributes.js"), page_id }),
 | 
							el(example, { src: fileURL("./components/examples/customElement/observedAttributes.js"), page_id }),
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								index.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								index.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -262,7 +262,6 @@ export function customElementRender<
 | 
				
			|||||||
): EL
 | 
					): EL
 | 
				
			||||||
export function customElementWithDDE<EL extends (new ()=> HTMLElement)>(custom_element: EL): EL
 | 
					export function customElementWithDDE<EL extends (new ()=> HTMLElement)>(custom_element: EL): EL
 | 
				
			||||||
export function lifecyclesToEvents<EL extends (new ()=> HTMLElement)>(custom_element: EL): EL
 | 
					export function lifecyclesToEvents<EL extends (new ()=> HTMLElement)>(custom_element: EL): EL
 | 
				
			||||||
export function observedAttributes(custom_element: HTMLElement): Record<string, string>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * This is used primarly for server side rendering. To be sure that all async operations
 | 
					 * This is used primarly for server side rendering. To be sure that all async operations
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,5 +100,6 @@
 | 
				
			|||||||
		"jshint": "~2.13",
 | 
							"jshint": "~2.13",
 | 
				
			||||||
		"nodejsscript": "^1.0.2",
 | 
							"nodejsscript": "^1.0.2",
 | 
				
			||||||
		"size-limit-node-esbuild": "~0.3"
 | 
							"size-limit-node-esbuild": "~0.3"
 | 
				
			||||||
	}
 | 
						},
 | 
				
			||||||
 | 
						"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,10 +7,10 @@ import { c_ch_o } from "./events-observer.js";
 | 
				
			|||||||
 *
 | 
					 *
 | 
				
			||||||
 * @param {Element|ShadowRoot} target - The custom element or shadow root to render into
 | 
					 * @param {Element|ShadowRoot} target - The custom element or shadow root to render into
 | 
				
			||||||
 * @param {Function} render - The render function that returns content
 | 
					 * @param {Function} render - The render function that returns content
 | 
				
			||||||
 * @param {Function|Object} [props=observedAttributes] - Props to pass to the render function
 | 
					 * @param {Function|Object} [props= {}] - Props to pass to the render function
 | 
				
			||||||
 * @returns {Node} The rendered content
 | 
					 * @returns {Node} The rendered content
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
export function customElementRender(target, render, props= observedAttributes){
 | 
					export function customElementRender(target, render, props= {}){
 | 
				
			||||||
	const custom_element= target.host || target;
 | 
						const custom_element= target.host || target;
 | 
				
			||||||
	scope.push({
 | 
						scope.push({
 | 
				
			||||||
		scope: custom_element,
 | 
							scope: custom_element,
 | 
				
			||||||
@@ -69,15 +69,3 @@ export { lifecyclesToEvents as customElementWithDDE };
 | 
				
			|||||||
function wrapMethod(obj, method, apply){
 | 
					function wrapMethod(obj, method, apply){
 | 
				
			||||||
	obj[method]= new Proxy(obj[method] || (()=> {}), { apply });
 | 
						obj[method]= new Proxy(obj[method] || (()=> {}), { apply });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
import { observedAttributes as oA } from "./helpers.js";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Gets observed attributes for a custom element
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param {Element} instance - Custom element instance
 | 
					 | 
				
			||||||
 * @returns {Object} Object mapping camelCase attribute names to their values
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
export function observedAttributes(instance){
 | 
					 | 
				
			||||||
	return oA(instance, (i, n)=> i.getAttribute(n));
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -106,35 +106,3 @@ on.disconnectedAsAbort= function(host){
 | 
				
			|||||||
	host(on.disconnected(()=> a.abort()));
 | 
						host(on.disconnected(()=> a.abort()));
 | 
				
			||||||
	return a.signal;
 | 
						return a.signal;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					 | 
				
			||||||
/** Store for elements with attribute observers */
 | 
					 | 
				
			||||||
const els_attribute_store= new WeakSet();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Creates a function to register attribute change event listeners
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param {Function} listener - Event handler
 | 
					 | 
				
			||||||
 * @param {Object} [options] - Event listener options
 | 
					 | 
				
			||||||
 * @returns {Function} Function that registers the attribute change listener
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
on.attributeChanged= function(listener, options){
 | 
					 | 
				
			||||||
	if(typeof options !== "object")
 | 
					 | 
				
			||||||
		options= {};
 | 
					 | 
				
			||||||
	return function registerElement(element){
 | 
					 | 
				
			||||||
		element.addEventListener(eva, listener, options);
 | 
					 | 
				
			||||||
		if(element[keyLTE] || els_attribute_store.has(element))
 | 
					 | 
				
			||||||
			return element;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		if(!env.M) return element;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		const observer= new env.M(function(mutations){
 | 
					 | 
				
			||||||
			for(const { attributeName, target } of mutations)
 | 
					 | 
				
			||||||
				target.dispatchEvent(
 | 
					 | 
				
			||||||
					new CustomEvent(eva, { detail: [ attributeName, target.getAttribute(attributeName) ] }));
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		const c= onAbort(options.signal, ()=> observer.disconnect());
 | 
					 | 
				
			||||||
		if(c) observer.observe(element, { attributes: true });
 | 
					 | 
				
			||||||
		//TODO: clean up when element disconnected
 | 
					 | 
				
			||||||
		return element;
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -159,7 +159,7 @@ signal.clear= function(...signals){
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
/** Property key for tracking reactive elements */
 | 
					/** Property key for tracking reactive elements */
 | 
				
			||||||
const key_reactive= "__dde_reactive";
 | 
					const key_reactive= "__dde_reactive";
 | 
				
			||||||
import { enviroment as env } from "../dom-common.js";
 | 
					import { enviroment as env, eva } from "../dom-common.js";
 | 
				
			||||||
import { el } from "../dom.js";
 | 
					import { el } from "../dom.js";
 | 
				
			||||||
import { scope } from "../dom.js";
 | 
					import { scope } from "../dom.js";
 | 
				
			||||||
import { on } from "../events.js";
 | 
					import { on } from "../events.js";
 | 
				
			||||||
@@ -265,7 +265,7 @@ const key_attributes= "__dde_attributes";
 | 
				
			|||||||
signal.observedAttributes= function(element){
 | 
					signal.observedAttributes= function(element){
 | 
				
			||||||
	const store= element[key_attributes]= {};
 | 
						const store= element[key_attributes]= {};
 | 
				
			||||||
	const attrs= observedAttributes(element, observedAttribute(store));
 | 
						const attrs= observedAttributes(element, observedAttribute(store));
 | 
				
			||||||
	on.attributeChanged(function attributeChangeToSignal({ detail }){
 | 
						on(eva, function attributeChangeToSignal({ detail }){
 | 
				
			||||||
		/*! This maps attributes to signals (`S.observedAttributes`).
 | 
							/*! This maps attributes to signals (`S.observedAttributes`).
 | 
				
			||||||
			Investigate `__dde_attributes` key of the element. */
 | 
								Investigate `__dde_attributes` key of the element. */
 | 
				
			||||||
		const [ name, value ]= detail;
 | 
							const [ name, value ]= detail;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user