mi-element 0.6.6 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/context.js +6 -0
- package/dist/element.js +92 -109
- package/dist/escape.js +12 -5
- package/dist/index.js +5 -5
- package/dist/refs.js +1 -9
- package/dist/styling.js +12 -5
- package/docs/context.md +43 -27
- package/docs/controller.md +4 -0
- package/docs/element.md +47 -60
- package/docs/reactivity.md +2 -2
- package/docs/signal.md +13 -6
- package/docs/store.md +1 -0
- package/docs/styling.md +17 -5
- package/package.json +16 -20
- package/src/context.js +8 -0
- package/src/element.js +203 -197
- package/src/escape.js +17 -13
- package/src/index.js +4 -14
- package/src/refs.js +0 -24
- package/src/styling.js +19 -9
- package/types/context.d.ts +2 -0
- package/types/element.d.ts +53 -34
- package/types/escape.d.ts +1 -1
- package/types/index.d.ts +4 -8
- package/types/refs.d.ts +0 -11
- package/types/styling.d.ts +1 -3
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
- package/src/min.js +0 -17
- package/types/min.d.ts +0 -1
package/types/element.d.ts
CHANGED
|
@@ -12,12 +12,14 @@
|
|
|
12
12
|
* @example
|
|
13
13
|
* ```js
|
|
14
14
|
* class Example extends MiElement {
|
|
15
|
-
* // define all observed attributes
|
|
16
|
-
* //
|
|
17
|
-
* //
|
|
18
|
-
* //
|
|
15
|
+
* // define all observed attributes and define its type,
|
|
16
|
+
* // either use String/'', Number/0, Boolean/true, Array/[], Object/{}.
|
|
17
|
+
* // Objects and Arrays are deserialized from JSON.
|
|
18
|
+
* // Attributes are accessible via `this[prop]` as camelCased properties.
|
|
19
|
+
* // camelCased attributes are converted to kebab-case automatically.
|
|
20
|
+
* // Avoid using attributes which are HTMLElement properties e.g. className
|
|
19
21
|
* static get attributes () {
|
|
20
|
-
* return { text: '
|
|
22
|
+
* return { text: '', num: Number }
|
|
21
23
|
* }
|
|
22
24
|
* render() {
|
|
23
25
|
* this.renderRoot.innerHTML = `<div></div>`
|
|
@@ -46,7 +48,7 @@ export class MiElement extends HTMLElement {
|
|
|
46
48
|
* If override is `null`, no shadow-root will be attached.
|
|
47
49
|
* @type {{mode: string}|null}
|
|
48
50
|
*/
|
|
49
|
-
static
|
|
51
|
+
static get shadowRootInit(): {
|
|
50
52
|
mode: string;
|
|
51
53
|
} | null;
|
|
52
54
|
/**
|
|
@@ -55,15 +57,35 @@ export class MiElement extends HTMLElement {
|
|
|
55
57
|
*/
|
|
56
58
|
static template: string | HTMLTemplateElement;
|
|
57
59
|
/**
|
|
58
|
-
*
|
|
59
|
-
* @returns {Record<
|
|
60
|
+
* used to define observedAttributes and booleanAttributes during registration
|
|
61
|
+
* @returns {Record<string, {attribute?: boolean, type?:String|Number|Boolean|Array|Object, initial?: any}>} attribute name to isBoolean map
|
|
60
62
|
*/
|
|
61
|
-
static get
|
|
63
|
+
static get properties(): Record<string, {
|
|
64
|
+
attribute?: boolean;
|
|
65
|
+
type?: string | number | boolean | any[] | any;
|
|
66
|
+
initial?: any;
|
|
67
|
+
}>;
|
|
62
68
|
/**
|
|
63
|
-
*
|
|
64
|
-
* @returns {Record<PropertyKey, unknown>|{}}
|
|
69
|
+
* @returns {string[]}
|
|
65
70
|
*/
|
|
66
|
-
static
|
|
71
|
+
static observedAttributes: any[];
|
|
72
|
+
/**
|
|
73
|
+
* @returns {string} css styles
|
|
74
|
+
*/
|
|
75
|
+
static styles: string;
|
|
76
|
+
/**
|
|
77
|
+
* Whether to use global styles instead of scoped styles.
|
|
78
|
+
* @returns {boolean}
|
|
79
|
+
*/
|
|
80
|
+
static get useGlobalStyles(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Define createSignal function for properties.
|
|
83
|
+
* Signal values are set with the .value property
|
|
84
|
+
* @returns {import('mi-signal').createSignal|null} createSignal function
|
|
85
|
+
*/
|
|
86
|
+
static createSignal: typeof createSignal;
|
|
87
|
+
/** all properties are signals! */
|
|
88
|
+
_props: {};
|
|
67
89
|
/**
|
|
68
90
|
* creates the element's renderRoot, sets up styling
|
|
69
91
|
* @category lifecycle
|
|
@@ -76,27 +98,14 @@ export class MiElement extends HTMLElement {
|
|
|
76
98
|
disconnectedCallback(): void;
|
|
77
99
|
/**
|
|
78
100
|
* @param {string} name change attribute
|
|
79
|
-
* @param {any}
|
|
101
|
+
* @param {any} _oldValue
|
|
80
102
|
* @param {any} newValue new value
|
|
81
103
|
*/
|
|
82
|
-
attributeChangedCallback(name: string,
|
|
104
|
+
attributeChangedCallback(name: string, _oldValue: any, newValue: any): void;
|
|
83
105
|
/**
|
|
84
|
-
*
|
|
85
|
-
* properties to avoid type conversion to and from string
|
|
86
|
-
* @param {string} name
|
|
87
|
-
* @param {any} newValue
|
|
106
|
+
* @param {Record<string, any>} [changedProps]
|
|
88
107
|
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* controls if component shall be updated
|
|
92
|
-
* @param {Record<string,any>} [_changedAttributes] previous values of changed attributes
|
|
93
|
-
* @returns {boolean}
|
|
94
|
-
*/
|
|
95
|
-
shouldUpdate(_changedAttributes?: Record<string, any>): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* request rendering
|
|
98
|
-
*/
|
|
99
|
-
requestUpdate(): void;
|
|
108
|
+
requestUpdate(changedProps?: Record<string, any>): void;
|
|
100
109
|
/**
|
|
101
110
|
* adds a template to renderRoot
|
|
102
111
|
* @param {HTMLTemplateElement} template
|
|
@@ -108,10 +117,10 @@ export class MiElement extends HTMLElement {
|
|
|
108
117
|
render(): void;
|
|
109
118
|
/**
|
|
110
119
|
* called every time the components needs a render update
|
|
111
|
-
* @param {Record<string,any>} [
|
|
112
|
-
* attributes
|
|
120
|
+
* @param {Record<string, any>} [_changedProps] previous values of changed
|
|
121
|
+
* properties (attributes)
|
|
113
122
|
*/
|
|
114
|
-
update(
|
|
123
|
+
update(_changedProps?: Record<string, any>): void;
|
|
115
124
|
/**
|
|
116
125
|
* Adds listener function for eventName. listener is removed before component
|
|
117
126
|
* disconnects
|
|
@@ -143,10 +152,19 @@ export class MiElement extends HTMLElement {
|
|
|
143
152
|
* @param {HostController} controller
|
|
144
153
|
*/
|
|
145
154
|
removeController(controller: HostController): void;
|
|
155
|
+
/**
|
|
156
|
+
* properties or attributes
|
|
157
|
+
*/
|
|
158
|
+
[index: PropertyKey]: any;
|
|
159
|
+
refsBySelector(selectors: any): {} | Record<string, Node>;
|
|
146
160
|
#private;
|
|
147
161
|
}
|
|
148
|
-
export function define(
|
|
149
|
-
|
|
162
|
+
export function define(tagName: string, elementClass: typeof MiElement, options?: {
|
|
163
|
+
usedCssPrefix?: string;
|
|
164
|
+
cssPrefix?: string;
|
|
165
|
+
styles?: string;
|
|
166
|
+
}): void;
|
|
167
|
+
export function convertType(value: string, type: typeof Boolean | typeof Number | typeof String | typeof Array | typeof Object): any;
|
|
150
168
|
/**
|
|
151
169
|
* controller
|
|
152
170
|
*/
|
|
@@ -162,3 +180,4 @@ export type HostController = {
|
|
|
162
180
|
*/
|
|
163
181
|
hostDisconnected: () => void;
|
|
164
182
|
};
|
|
183
|
+
import { createSignal } from 'mi-signal';
|
package/types/escape.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
+
export { refsBySelector } from "./refs.js";
|
|
1
2
|
export { Store } from "./store.js";
|
|
3
|
+
export { default as Signal } from "mi-signal";
|
|
2
4
|
export type Context = import("./context.js").Context;
|
|
3
5
|
export type HostController = import("./element.js").HostController;
|
|
4
|
-
/**
|
|
5
|
-
* <T>
|
|
6
|
-
*/
|
|
7
|
-
export type SignalOptions<T> = import("mi-signal").SignalOptions<T>;
|
|
8
6
|
export type Action = import("./store.js").Action;
|
|
9
7
|
export { ContextConsumer, ContextProvider, ContextRequestEvent } from "./context.js";
|
|
10
8
|
export { MiElement, convertType, define } from "./element.js";
|
|
11
|
-
export { unsafeHtml,
|
|
12
|
-
export {
|
|
13
|
-
export { default as Signal, State, createSignal, effect, Computed } from "mi-signal";
|
|
14
|
-
export { classMap, styleMap, addGlobalStyles } from "./styling.js";
|
|
9
|
+
export { unsafeHtml, html, escHtml } from "./escape.js";
|
|
10
|
+
export { classNames, styleMap, addGlobalStyles, css } from "./styling.js";
|
package/types/refs.d.ts
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper function to find `id` attributes in `container`s node tree.
|
|
3
|
-
* id names are camelCased, e.g. 'list-container' becomes 'listContainer'
|
|
4
|
-
* @param {Element} container root element
|
|
5
|
-
* @returns {Record<string, Node>|{}} record of found references
|
|
6
|
-
* @example
|
|
7
|
-
* el.innerHTML = `<p id>unnamed <span id="named">and named</span> reference</p>`
|
|
8
|
-
* references = refs(el)
|
|
9
|
-
* //> references = { p: <p>, named: <span> }
|
|
10
|
-
*/
|
|
11
|
-
export function refsById(container: Element): Record<string, Node> | {};
|
|
12
1
|
/**
|
|
13
2
|
* Helper function to gather references by a map of selectors
|
|
14
3
|
* @param {Element} container root element
|
package/types/styling.d.ts
CHANGED
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
* }
|
|
10
10
|
*/
|
|
11
11
|
export function addGlobalStyles(renderRoot: ShadowRoot): void;
|
|
12
|
-
export function
|
|
13
|
-
[name: string]: string | boolean | number;
|
|
14
|
-
}): string;
|
|
12
|
+
export function classNames(...args: any[]): string;
|
|
15
13
|
export function styleMap(map: {
|
|
16
14
|
[name: string]: string | number | undefined | null;
|
|
17
15
|
}, options?: {
|
package/dist/index.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export{Hole,attach,attr,detach,html,htmlFor,render,svg,svgFor}from"mi-html";const t=[];class e extends EventTarget{#t;#e;constructor(t,e){super();const{equals:s}=e||{};this.#t=t,this.#e=s??((t,e)=>t===e)}get value(){return this.get()}set value(t){this.set(t)}get(){const e=t[t.length-1];return e&&e.add(this),this.#t}set(t){this.#e(this.#t,t)||(this.#t=t,this.dispatchEvent(new CustomEvent("signal")))}}const s=(t,s)=>t instanceof e?t:new e(t,s);function r(e){const s=new Set;t.push(s);try{e()}finally{t.pop()}for(const t of s)t.addEventListener("signal",e);return()=>{for(const t of s)t.removeEventListener("signal",e)}}class n{#s;#r;constructor(t){this.#s=new e,this.#r=r(()=>this.#s.set(t()))}get(){return this.#s.get()}unsubscribe(){this.#r()}}var o={State:e,Computed:n,createSignal:s,effect:r};const i="context-request";class a{constructor(t,e,r){this.host=t,this.context=e,this.state=s(r),this.host.addController?.(this)}hostConnected(){this.host.addEventListener(i,this.onContextRequest)}hostDisconnected(){this.host.removeEventListener(i,this.onContextRequest)}set(t){this.state.set(t)}get(){return this.state.get()}onContextRequest=t=>{if(t.context!==this.context)return;let e;t.stopPropagation(),t.subscribe&&(e=r(()=>{const s=this.get();e&&t.callback(s,e)})),t.callback(this.get(),e)}}class c extends Event{constructor(t,e,s){super(i,{bubbles:!0,composed:!0}),this.context=t,this.callback=e,this.subscribe=s}}class h{#t;constructor(t,e,s){const{subscribe:r=!1,validate:n=()=>!0}=s||{};this.host=t,this.context=e,this.subscribe=!!r,this.validate=n,this.unsubscribe=void 0,this.host.addController?.(this)}get(){return this.#t}get value(){return this.#t}hostConnected(){this.dispatchRequest()}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0)}dispatchRequest(){this.host.dispatchEvent(new c(this.context,this._callback.bind(this),this.subscribe))}_callback(t,e){e&&(this.subscribe?this.unsubscribe&&(this.unsubscribe!==e&&this.unsubscribe(),this.unsubscribe=e):e()),this.validate(t)&&(this.#t=t,this.host.requestUpdate())}}const u=(t="")=>t.replace(/([A-Z])/g,(t,e)=>`-${e.toLowerCase()}`),l=(t="")=>t.toLowerCase().replace(/[-_]\w/g,t=>t[1].toUpperCase());class d extends HTMLElement{#n={};#o=new Map;#i=new Map;#a=new Set;#c=new Set;#h={};#u=!1;static shadowRootOptions={mode:"open"};static template;static get attributes(){return{}}static get properties(){return{}}constructor(){super(),this.#l(this.constructor.attributes),this.#d(this.constructor.properties)}#p(t,e){this.#n[t]=s(e),Object.defineProperty(this,t,{enumerable:!0,get(){return this.#n[t].get()},set(e){const s=this.#n[t].get();s!==e&&(this.#n[t].set(e),this.#h[t]=s,this.requestUpdate())}})}#l(t={}){for(const[e,s]of Object.entries(t)){const t=m(s);this.#i.set(e,t.type),this.#o.set(e.toLowerCase(),e),this.#o.set(u(e),e),this.#p(e,t.value)}}#d(t={}){for(const[e,s]of Object.entries(t))this.#o.has(e)||e in this.#n||this.#p(e,s)}#b(t){return this.#o.get(t)||t}#m(t){return this.#i.get(t)}connectedCallback(){this.#c.forEach(t=>t.hostConnected?.());const{shadowRootOptions:t,template:e}=this.constructor;this.renderRoot=t?this.shadowRoot??this.attachShadow(t):this,this.addTemplate(e),this.render(),this.requestUpdate()}disconnectedCallback(){this.#a.forEach(t=>t()),this.#c.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){const r=this.#b(t),n=this.#m(r);this.#h[r]=this[r],this[r]=v(s,n),"Boolean"===n&&"false"===s&&this.removeAttribute(t),this.requestUpdate()}setAttribute(t,e){const s=this.#b(t);if(!(s in this.#n))return;const r=this.#m(s);"Boolean"===r?!0===e||""===e?super.setAttribute(t,""):super.removeAttribute(t):["String","Number"].includes(r??"")||!0===e?super.setAttribute(t,e):(this.#h[s]=this[s],this[s]=e,this.requestUpdate())}shouldUpdate(t){return!0}requestUpdate(){!this.#u&&this.isConnected&&(this.#u=!0,requestAnimationFrame(()=>{this.#u=!1;const t=this.#h;this.#h={},this.shouldUpdate(t)&&this.update(t)}))}addTemplate(t){if(t){if(!(t instanceof HTMLTemplateElement))throw new Error("template is not a HTMLTemplateElement");this.renderRoot.append(t.content.cloneNode(!0))}}render(){}update(t){}on(t,e,s=this){s.addEventListener(t,e),this.#a.add(()=>s.removeEventListener(t,e))}once(t,e,s=this){s.addEventListener(t,e,{once:!0})}dispose(...t){for(const e of t){if("function"!=typeof e)throw new TypeError("listener must be a function");this.#a.add(e)}}addController(t){this.#c.add(t),this.isConnected&&t.hostConnected?.()}removeController(t){this.#c.delete(t)}}const p=(t,e,s)=>{e.observedAttributes=(e.observedAttributes||Object.keys(e.attributes||[])).map(t=>t.toLowerCase()),b(e),window.customElements.define(t,e,s)},b=t=>{if(t.template instanceof HTMLTemplateElement)return;const e=document.createElement("template");e.innerHTML=t.template,t.template=e},m=t=>{switch(t){case Boolean:return{value:void 0,type:"Boolean"};case Number:return{value:void 0,type:"Number"};case String:return{value:void 0,type:"String"};default:return{value:t,type:toString.call(t).slice(8,-1)}}},v=(t,e)=>{switch(e){case"Number":return(t=>{const e=Number(t);return isNaN(e)?t:e})(t);case"Boolean":return"false"!==t&&(""===t||!!t)}return t};class g extends String{}const f=t=>new g(t),w={"&":"&","<":"<",">":">","'":"'",'"':"""},y=t=>t instanceof g?t:f((""+t).replace(/&/g,"&").replace(/[&<>'"]/g,t=>w[t])),C=(t,...e)=>f(String.raw({raw:t},...e.map(t=>Array.isArray(t)?t.map(y).join(""):y(t))));function A(t){const e=t.querySelectorAll?.("[id]")||[],s={};for(const t of e)s[l(t.getAttribute("id")||t.nodeName.toLowerCase())]=t;return s}function E(t,e){const s={};for(const[r,n]of Object.entries(e))s[r]=t.querySelector?.(n);return s}class S extends e{constructor(t,e,s){super(e,s);for(const[e,s]of Object.entries(t))this[e]=t=>this.set(s(t)(this.get()))}}const L=t=>{const e=[];for(const[s,r]of Object.entries(t??{}))r&&e.push(s);return e.join(" ")},q=(t,e)=>{const{unit:s="px"}=e||{},r=[];for(const[e,n]of Object.entries(t??{})){if(null==n)continue;const t=Number.isFinite(n)?s:"";r.push(`${u(e)}:${n}${t}`)}return r.join(";")};let x=null;function T(t){t.adoptedStyleSheets.push(...(null===x&&(x=Array.from(document.styleSheets).map(({cssRules:t})=>{const e=new CSSStyleSheet,s=Array.from(t).map(t=>t.cssText).join(" ");return e.replaceSync(s),e})),x))}export{n as Computed,h as ContextConsumer,a as ContextProvider,c as ContextRequestEvent,d as MiElement,o as Signal,e as State,S as Store,T as addGlobalStyles,L as classMap,v as convertType,s as createSignal,p as define,r as effect,C as esc,y as escHtml,A as refsById,E as refsBySelector,q as styleMap,f as unsafeHtml};
|
|
2
|
-
//# sourceMappingURL=index.min.js.map
|
package/dist/index.min.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.min.js","sources":["../../mi-signal/dist/index.js","../src/context.js","../src/case.js","../src/element.js","../src/escape.js","../src/refs.js","../src/store.js","../src/styling.js"],"sourcesContent":["const context = [];\n\nclass State extends EventTarget {\n #value;\n #equals;\n constructor(value, options) {\n super();\n const {equals: equals} = options || {};\n this.#value = value, this.#equals = equals ?? ((value, nextValue) => value === nextValue);\n }\n get value() {\n return this.get();\n }\n set value(nextValue) {\n this.set(nextValue);\n }\n get() {\n const running = context[context.length - 1];\n return running && running.add(this), this.#value;\n }\n set(nextValue) {\n this.#equals(this.#value, nextValue) || (this.#value = nextValue, this.dispatchEvent(new CustomEvent('signal')));\n }\n}\n\nconst createSignal = (initialValue, options) => initialValue instanceof State ? initialValue : new State(initialValue, options);\n\nfunction effect(cb) {\n const running = new Set;\n context.push(running);\n try {\n cb();\n } finally {\n context.pop();\n }\n for (const dep of running) dep.addEventListener('signal', cb);\n return () => {\n for (const dep of running) dep.removeEventListener('signal', cb);\n };\n}\n\nclass Computed {\n #state;\n #unsubscribe;\n constructor(cb) {\n this.#state = new State, this.#unsubscribe = effect(() => this.#state.set(cb()));\n }\n get() {\n return this.#state.get();\n }\n unsubscribe() {\n this.#unsubscribe();\n }\n}\n\nvar index = {\n State: State,\n Computed: Computed,\n createSignal: createSignal,\n effect: effect\n};\n\nexport { Computed, State, createSignal, index as default, effect };\n","/**\n * @see https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md\n */\n\nimport { createSignal, effect } from 'mi-signal'\n\n/**\n * @typedef {import('./element.js').HostController} HostController\n */\n/**\n * @typedef {string|Symbol} Context\n */\n\nconst CONTEXT_REQUEST = 'context-request'\n\n/**\n * @template T\n * @implements {HostController}\n */\nexport class ContextProvider {\n /**\n * @param {HTMLElement} host\n * @param {Context} context\n * @param {T|null} [initialValue]\n */\n constructor(host, context, initialValue) {\n this.host = host\n this.context = context\n this.state = createSignal(initialValue)\n // @ts-expect-error\n this.host.addController?.(this)\n }\n\n hostConnected() {\n // @ts-expect-error\n this.host.addEventListener(CONTEXT_REQUEST, this.onContextRequest)\n }\n\n hostDisconnected() {\n // @ts-expect-error\n this.host.removeEventListener(CONTEXT_REQUEST, this.onContextRequest)\n }\n\n /**\n * @param {T|null|undefined} newValue\n */\n set(newValue) {\n this.state.set(newValue)\n }\n\n /**\n * @returns {T|null|undefined}\n */\n get() {\n return this.state.get()\n }\n\n /**\n * @private\n * @param {ContextRequestEvent} ev\n */\n onContextRequest = (ev) => {\n if (ev.context !== this.context) {\n // event has wrong context\n return\n }\n ev.stopPropagation()\n let unsubscribe\n if (ev.subscribe) {\n unsubscribe = effect(() => {\n // needed to subscribe to signal\n const value = this.get()\n // don't call callback the first time where unsubscribe is not defined\n if (unsubscribe) ev.callback(value, unsubscribe)\n })\n }\n ev.callback(this.get(), unsubscribe)\n }\n}\n\n/**\n * @template T\n */\nexport class ContextRequestEvent extends Event {\n /**\n * @param {Context} context\n * @param {(value: T|null|undefined, unsubscribe?: () => void) => void} callback\n * @param {boolean} [subscribe=false] subscribe to value changes\n */\n constructor(context, callback, subscribe) {\n super(CONTEXT_REQUEST, { bubbles: true, composed: true })\n this.context = context\n this.callback = callback\n this.subscribe = subscribe\n }\n}\n\n/**\n * @template T\n * @implements {HostController}\n */\nexport class ContextConsumer {\n /**\n * @type {T|null|undefined}\n */\n #value\n\n /**\n * @param {HTMLElement} host\n * @param {Context} context\n * @param {object} [options]\n * @param {boolean} [options.subscribe=false] subscribe to value changes\n * @param {(any) => boolean} [options.validate] validation function\n */\n constructor(host, context, options) {\n const { subscribe = false, validate = () => true } = options || {}\n this.host = host\n this.context = context\n this.subscribe = !!subscribe\n this.validate = validate\n // unsubscribe function\n this.unsubscribe = undefined\n // add the controller in case of a MiElement otherwise call hostConnected()\n // and hostDisconnected() from the host element\n // @ts-expect-error\n this.host.addController?.(this)\n }\n\n /**\n * @returns {T|null|undefined}\n */\n get() {\n return this.#value\n }\n\n /**\n * @returns {T|null|undefined}\n */\n get value() {\n return this.#value\n }\n\n hostConnected() {\n this.dispatchRequest()\n }\n\n hostDisconnected() {\n if (this.unsubscribe) {\n this.unsubscribe()\n this.unsubscribe = undefined\n }\n }\n\n dispatchRequest() {\n this.host.dispatchEvent(\n new ContextRequestEvent(\n this.context,\n this._callback.bind(this),\n this.subscribe\n )\n )\n }\n\n _callback(value, unsubscribe) {\n if (unsubscribe) {\n if (!this.subscribe) {\n // unsubscribe as we didn't ask for subscription\n unsubscribe()\n } else if (this.unsubscribe) {\n if (this.unsubscribe !== unsubscribe) {\n // looks there was a previous provider\n this.unsubscribe()\n }\n this.unsubscribe = unsubscribe\n }\n }\n if (!this.validate(value)) {\n return\n }\n this.#value = value\n // @ts-expect-error\n this.host.requestUpdate()\n }\n}\n","/**\n * convert lowerCamelCase to kebab-case\n * @param {string} str\n * @returns {string}\n */\nexport const camelToKebabCase = (str = '') =>\n str.replace(/([A-Z])/g, (_, m) => `-${m.toLowerCase()}`)\n\n/**\n * convert kebab-case to lowerCamelCase\n * @param {string} str\n * @returns {string}\n */\nexport const kebabToCamelCase = (str = '') =>\n str.toLowerCase().replace(/[-_]\\w/g, (m) => m[1].toUpperCase())\n","import { camelToKebabCase } from './case.js'\nimport { createSignal } from 'mi-signal'\n\n/**\n * @typedef {object} HostController controller\n * @property {() => void} hostConnected is called when host element is added to\n * the DOM, usually with connectedCallback()\n * @property {() => void} hostDisconnected is called when host element is\n * removed from the DOM, usually with disconnectedCallback()\n */\n\n/**\n * class extending HTMLElement to enable deferred rendering on attribute changes\n * either via `setAttribute(name, value)` or `this[name] = value`.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement\n * @example\n * ```js\n * class Example extends MiElement {\n * // define all observed attributes with its default initial value.\n * // for yet to defined numbers, boolean or strings use `Number`, `Boolean`, `String`\n * // attributes are accessible via `this[prop]`\n * // avoid using attributes which are HTMLElement properties e.g. className\n * static get attributes () {\n * return { text: 'Hi', num: Number }\n * }\n * render() {\n * this.renderRoot.innerHTML = `<div></div>`\n * this.refs = {\n * div: this.renderRoot.querySelector('div')\n * }\n * }\n * // render method called every time an attribute changes\n * update() {\n * this.refs.div.textContent = this.text\n * }\n * }\n * // create a custom element with the `define` function (see below)\n * define('x-example', Example)\n * // create a DOM node and re-render via attribute or property changes\n * const elem = document.createElement('x-example')\n * elem.setAttribute('text', 'set attribute')\n * // or if change is triggered by property\n * elem.text = 'set property'\n * ```\n */\nexport class MiElement extends HTMLElement {\n /** all attributes are signals! */\n #attr = {}\n /**\n * lower-cased or kebab-case attribute names;\n * Map<lower-cased and kebab-cased attr name, camelCased attr name as string>\n * @type {Map<string, string>}\n */\n #attrLc = new Map()\n /**\n * initial types (from `static get attributes() { return {} }`)\n * Map<camelCased attribute name, type as string>\n * @type {Map<string,string>}\n */\n #types = new Map()\n #disposers = new Set()\n #controllers = new Set()\n #changedAttr = {}\n #dedupe = false\n\n /**\n * Default options used when calling `attachShadow`. Used in\n * `connectedCallback()`.\n * If override is `null`, no shadow-root will be attached.\n * @type {{mode: string}|null}\n */\n static shadowRootOptions = { mode: 'open' }\n\n /**\n * defines template for render().\n * @type {String|HTMLTemplateElement}\n */\n static template\n\n /**\n * observable attributes\n * @returns {Record<PropertyKey, unknown>|{}}\n */\n static get attributes() {\n return {}\n }\n /**\n * observable properties\n * @returns {Record<PropertyKey, unknown>|{}}\n */\n static get properties() {\n return {}\n }\n\n constructor() {\n super()\n // @ts-expect-error\n this.#observedAttributes(this.constructor.attributes)\n // @ts-expect-error\n this.#observedProperties(this.constructor.properties)\n }\n\n #observe(name, initialValue) {\n this.#attr[name] = createSignal(initialValue)\n Object.defineProperty(this, name, {\n enumerable: true,\n get() {\n return this.#attr[name].get()\n },\n set(newValue) {\n const oldValue = this.#attr[name].get()\n if (oldValue === newValue) return\n this.#attr[name].set(newValue)\n this.#changedAttr[name] = oldValue\n this.requestUpdate()\n }\n })\n }\n\n /**\n * requests update on component when property changes\n * @param {Record<string, any>} [attributes]\n */\n #observedAttributes(attributes = {}) {\n for (const [name, value] of Object.entries(attributes)) {\n const initial = initialValueType(value)\n this.#types.set(name, initial.type)\n this.#attrLc.set(name.toLowerCase(), name)\n this.#attrLc.set(camelToKebabCase(name), name)\n this.#observe(name, initial.value)\n }\n }\n\n /**\n * define (direct) properties\n * @param {Record<string, any>} [properties]\n */\n #observedProperties(properties = {}) {\n for (const [name, value] of Object.entries(properties)) {\n if (this.#attrLc.has(name) || name in this.#attr) {\n continue\n }\n this.#observe(name, value)\n }\n }\n\n /**\n * return camelCased value instead of possible lowercased\n * @param {string} name\n * @returns\n */\n #getName(name) {\n return this.#attrLc.get(name) || name\n }\n\n #getType(name) {\n return this.#types.get(name)\n }\n\n /**\n * creates the element's renderRoot, sets up styling\n * @category lifecycle\n */\n connectedCallback() {\n this.#controllers.forEach((controller) => controller.hostConnected?.())\n // create render root\n // @ts-expect-error\n const { shadowRootOptions, template } = this.constructor\n this.renderRoot = shadowRootOptions\n ? (this.shadowRoot ?? this.attachShadow(shadowRootOptions))\n : this\n this.addTemplate(template)\n // trigger initial rendering such that children can be added via JS\n this.render()\n // and update\n this.requestUpdate()\n }\n\n /**\n * unsubscribe from all events and disconnect controllers\n */\n disconnectedCallback() {\n // unsubscribe from all subscriptions\n this.#disposers.forEach((remover) => remover())\n // disconnect all controllers\n this.#controllers.forEach((controller) => controller.hostDisconnected?.())\n }\n\n /**\n * @param {string} name change attribute\n * @param {any} oldValue\n * @param {any} newValue new value\n */\n attributeChangedCallback(name, oldValue, newValue) {\n const attr = this.#getName(name)\n const type = this.#getType(attr)\n this.#changedAttr[attr] = this[attr]\n this[attr] = convertType(newValue, type)\n // correct initial setting of `trueish=\"false\"` otherwise there's no chance\n // to overwrite a trueish value. The case `falsish=\"true\"` is covered.\n if (type === 'Boolean' && newValue === 'false') {\n this.removeAttribute(name)\n }\n this.requestUpdate()\n }\n\n /**\n * Set string and number attributes on element only. Set all other values as\n * properties to avoid type conversion to and from string\n * @param {string} name\n * @param {any} newValue\n */\n setAttribute(name, newValue) {\n const attr = this.#getName(name)\n // only allow to change observedAttributes\n if (!(attr in this.#attr)) {\n return\n }\n const type = this.#getType(attr)\n\n // only set string values in these cases\n if (type === 'Boolean') {\n if (newValue === true || newValue === '') {\n super.setAttribute(name, '')\n } else {\n super.removeAttribute(name)\n }\n } else if (['String', 'Number'].includes(type ?? '') || newValue === true) {\n super.setAttribute(name, newValue)\n } else {\n this.#changedAttr[attr] = this[attr]\n this[attr] = newValue\n this.requestUpdate()\n }\n }\n\n /**\n * controls if component shall be updated\n * @param {Record<string,any>} [_changedAttributes] previous values of changed attributes\n * @returns {boolean}\n */\n shouldUpdate(_changedAttributes) {\n return true\n }\n\n /**\n * request rendering\n */\n requestUpdate() {\n if (this.#dedupe || !this.isConnected) return\n this.#dedupe = true\n requestAnimationFrame(() => {\n this.#dedupe = false\n // reset changed attributes\n const _changedAttributes = this.#changedAttr\n this.#changedAttr = {}\n if (this.shouldUpdate(_changedAttributes)) {\n this.update(_changedAttributes)\n }\n })\n }\n\n /**\n * adds a template to renderRoot\n * @param {HTMLTemplateElement} template\n */\n addTemplate(template) {\n if (!template) return\n if (!(template instanceof HTMLTemplateElement)) {\n throw new Error('template is not a HTMLTemplateElement')\n }\n this.renderRoot.append(template.content.cloneNode(true))\n }\n\n /**\n * initial rendering\n */\n render() {}\n\n /**\n * called every time the components needs a render update\n * @param {Record<string,any>} [_changedAttributes] previous values of changed\n * attributes\n */\n update(_changedAttributes) {}\n\n /**\n * Adds listener function for eventName. listener is removed before component\n * disconnects\n * @param {string} eventName\n * @param {EventListenerOrEventListenerObject} listener\n * @param {Node|Document|Window} [node=this]\n */\n on(eventName, listener, node = this) {\n node.addEventListener(eventName, listener)\n this.#disposers.add(() => node.removeEventListener(eventName, listener))\n }\n\n /**\n * Adds one-time listener function for eventName. The next time eventName is\n * triggered, this listener is removed and then invoked.\n * @param {string} eventName\n * @param {EventListenerOrEventListenerObject} listener\n * @param {Node|Document|Window} node\n */\n once(eventName, listener, node = this) {\n node.addEventListener(eventName, listener, { once: true })\n }\n\n /**\n * Unsubscribe a listener function for disposal on disconnectedCallback()\n * @param {...function} listeners\n */\n dispose(...listeners) {\n for (const listener of listeners) {\n if (typeof listener !== 'function') {\n throw new TypeError('listener must be a function')\n }\n this.#disposers.add(listener)\n }\n }\n\n /**\n * adds a connected controller\n * @param {HostController} controller\n */\n addController(controller) {\n this.#controllers.add(controller)\n if (this.isConnected) {\n // if already connected call hostConnected() immediately\n /* istanbul ignore next */\n controller.hostConnected?.()\n }\n }\n\n /**\n * removes a connected controller\n * @param {HostController} controller\n */\n /* istanbul ignore next 3 */\n removeController(controller) {\n this.#controllers.delete(controller)\n }\n}\n\n/**\n * defines a custom element adding observedAttributes from default static\n * attributes\n * NOTE: camelCased attributes get lowercased!\n * ```html\n * <custom-element myAttr=\"1\">\n * <!-- is equal to -->\n * <custom-element myattr=\"1\">\n * ```\n * @param {string} name custom element tag\n * @param {typeof MiElement} element\n * @param {object} [options]\n */\nexport const define = (name, element, options) => {\n // @ts-expect-error\n element.observedAttributes = // @ts-expect-error\n (element.observedAttributes || Object.keys(element.attributes || [])).map(\n (attr) => attr.toLowerCase()\n )\n renderTemplate(element)\n window.customElements.define(name, element, options)\n}\n\n// --- utils\n\n/**\n * convert (and cache) the static template to HTMLTemplateElement\n * @param {typeof MiElement} element\n */\nconst renderTemplate = (element) => {\n if (element.template instanceof HTMLTemplateElement) {\n return\n }\n const el = document.createElement('template')\n el.innerHTML = element.template\n element.template = el\n}\n\nconst initialValueType = (value) => {\n switch (value) {\n case Boolean:\n return { value: undefined, type: 'Boolean' }\n case Number:\n return { value: undefined, type: 'Number' }\n case String:\n return { value: undefined, type: 'String' }\n default:\n return { value, type: toString.call(value).slice(8, -1) }\n }\n}\n\nconst toNumber = (any) => {\n const n = Number(any)\n return isNaN(n) ? any : n\n}\n\nexport const convertType = (any, type) => {\n // setAttribute prevents passing Object or Array type. no further conversion required\n switch (type) {\n case 'Number':\n return toNumber(any)\n case 'Boolean':\n // boolean values are set via setAttribute as empty string\n if (any === 'false') {\n return false\n }\n return any === '' || !!any\n }\n return any\n}\n","class UnsafeHtml extends String {}\n\n/**\n * tag a string as html for not to be escaped\n * @param {string} str\n * @returns {string}\n */\n// @ts-expect-error\nexport const unsafeHtml = (str) => new UnsafeHtml(str)\n\nconst escMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n \"'\": ''',\n '\"': '"'\n}\n\n/**\n * escape HTML and prevent double escaping of '&'\n * @param {string} string - which requires escaping\n * @returns {string} escaped string\n * @example\n * escapeHTML('<h1>\"One\" & 'Two' & Works</h1>')\n * //> <h1>"One" & 'Two' & Works</h1>\n */\nexport const escHtml = (string) =>\n // @ts-expect-error\n string instanceof UnsafeHtml\n ? string\n : unsafeHtml(\n ('' + string)\n .replace(/&/g, '&')\n .replace(/[&<>'\"]/g, (tag) => escMap[tag])\n )\n\n/**\n * template literal to HTML escape all values preventing XSS;\n * arrays will be escaped and joined\n * @param {TemplateStringsArray} strings\n * @param {...any} values\n * @returns {string}\n * @example\n * const data = ['<foo', 'bar>']\n * const list = esc`<ul>${data.map(item => esc`<li>${item}</li>`)}</ul>`\n * // '<ul><li><foo</li><li>bar></li></ul>'\n */\nexport const esc = (strings, ...values) =>\n unsafeHtml(\n String.raw(\n { raw: strings },\n ...values.map((val) =>\n Array.isArray(val) ? val.map(escHtml).join('') : escHtml(val)\n )\n )\n )\n","import { kebabToCamelCase } from './case.js'\n\n/**\n * Helper function to find `id` attributes in `container`s node tree.\n * id names are camelCased, e.g. 'list-container' becomes 'listContainer'\n * @param {Element} container root element\n * @returns {Record<string, Node>|{}} record of found references\n * @example\n * el.innerHTML = `<p id>unnamed <span id=\"named\">and named</span> reference</p>`\n * references = refs(el)\n * //> references = { p: <p>, named: <span> }\n */\nexport function refsById(container) {\n const nodes = container.querySelectorAll?.('[id]') || []\n const found = {}\n for (const node of nodes) {\n const name = kebabToCamelCase(\n node.getAttribute('id') || node.nodeName.toLowerCase()\n )\n found[name] = node\n }\n return found\n}\n\n/**\n * Helper function to gather references by a map of selectors\n * @param {Element} container root element\n * @param {Record<string, string>} selectors\n * @returns {Record<string, Node>|{}}\n * @example\n * el.innerHTML = `<p>some <span>and other</span> reference</p>`\n * references = refs(el, { p: 'p', named: 'p > span' })\n * //> references = { p: <p>, named: <span> }\n */\nexport function refsBySelector(container, selectors) {\n const found = {}\n for (const [name, selector] of Object.entries(selectors)) {\n found[name] = container.querySelector?.(selector)\n }\n return found\n}\n","import { State } from 'mi-signal'\n\n/**\n * @typedef {import('./element.js').MiElement} MiElement\n */\n/**\n * @typedef {(state: any, data?: any) => any} Action\n */\n/**\n * @template T\n * @typedef {import('mi-signal').SignalOptions<T>} SignalOptions<T>\n */\n\n/**\n * Store implementing [Flux](https://www.npmjs.com/package/flux) pattern based\n * on Signals\n * @template T\n */\nexport class Store extends State {\n /**\n * @param {Record<string, Action>} actions\n * @param {T|null} [initialValue]\n * @param {SignalOptions<T>} [options]\n * @example\n * ```js\n * import { Signal, Store } from 'mi-element'\n * const actions = { increment: (by = 1) => (current) => current + by }\n * const initialValue = 1\n * const store = new Store(actions, initialValue)\n * // subscribe with a callback function\n * const unsubscribe = Signal.effect(() => console.log(`count is ${store.get()}`))\n * // change the store\n * store.increment(2) // increment by 2\n * //> count is 3\n * unsubscribe()\n * ```\n *\n * if `initialValue` is an object, the object's reference must be changed\n * using the spread operator, in order to notify on state changes, e.g.\n * ```js\n * const initialValue = { count: 0, other: 'foo' }\n * const actions = {\n * increment: (by = 1) => (state) => ({...state, count: state.count + by})\n * }\n * ```\n * or you change the signals options equality function\n * ```js\n * const actions = {\n * increment: (by = 1) => (state) => {\n * state.count += by\n * return state\n * }\n * }\n * const initialValue = { count: 0, other: 'foo' }\n * const options = { equals: (value, nextValue) => true }\n * const store = new Store(actions, initialValue, options)\n * ```\n */\n constructor(actions, initialValue, options) {\n super(initialValue, options)\n for (const [action, dispatcher] of Object.entries(actions)) {\n if (process.env.NODE_ENV !== 'production') {\n if (this[action]) {\n throw new Error(`action \"${action}\" is already defined`)\n }\n if (\n typeof dispatcher !== 'function' ||\n typeof dispatcher(undefined) !== 'function'\n ) {\n throw new Error(\n `action \"${action}\" must be a function of type \\`() => (state) => state\\``\n )\n }\n }\n this[action] = (data) => this.set(dispatcher(data)(this.get()))\n }\n }\n}\n","import { camelToKebabCase } from './case.js'\n\n/**\n * Construct className based on true-ish values of map\n * @param {{[name: string]: string | boolean | number}} map\n * @returns {string}\n */\nexport const classMap = (map) => {\n /** @type {string[]} */\n const acc = []\n for (const [name, value] of Object.entries(map ?? {})) {\n if (value) acc.push(name)\n }\n return acc.join(' ')\n}\n\n/**\n * Construct style from camelCased map.\n * @param {{[name: string]: string | number | undefined | null}} map\n * @param {object} [options]\n * @param {string} [options.unit] cssUnit for number values; default='px'\n * @returns {string}\n */\nexport const styleMap = (map, options) => {\n const { unit = 'px' } = options || {}\n const acc = []\n for (const [name, value] of Object.entries(map ?? {})) {\n if (value === null || value === undefined) continue\n const _unit = Number.isFinite(value) ? unit : ''\n acc.push(`${camelToKebabCase(name)}:${value}${_unit}`)\n }\n return acc.join(';')\n}\n\n// ----\n\nlet globalSheets = null\n/**\n * obtain and cache global stylesheets\n * @returns {CSSStyleSheet[]}\n */\nfunction getGlobalStyleSheets() {\n if (globalSheets === null) {\n globalSheets = Array.from(document.styleSheets).map(({ cssRules }) => {\n const sheet = new CSSStyleSheet()\n const css = Array.from(cssRules)\n .map((rule) => rule.cssText)\n .join(' ')\n sheet.replaceSync(css)\n return sheet\n })\n }\n return globalSheets\n}\n\n/**\n * apply global style sheets to shadowRoot\n * @param {ShadowRoot} renderRoot\n * @example\n * class MyComponent extends MiElement {\n * render() {\n * addGlobalStyles(this.renderRoot)\n * }\n * }\n */\nexport function addGlobalStyles(renderRoot) {\n renderRoot.adoptedStyleSheets.push(...getGlobalStyleSheets())\n}\n\n/**\n * Helper literal to show css styles in JS e.g. with\n * https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html\n */\nexport const css = (strings, ...values) =>\n String.raw({ raw: strings }, ...values)\n"],"names":["context","State","EventTarget","value","equals","constructor","options","super","this","nextValue","get","set","running","length","add","dispatchEvent","CustomEvent","createSignal","initialValue","effect","cb","Set","push","pop","dep","addEventListener","removeEventListener","Computed","state","unsubscribe","index","CONTEXT_REQUEST","ContextProvider","host","addController","hostConnected","onContextRequest","hostDisconnected","newValue","ev","stopPropagation","subscribe","callback","ContextRequestEvent","Event","bubbles","composed","ContextConsumer","validate","undefined","dispatchRequest","_callback","bind","requestUpdate","camelToKebabCase","str","replace","_","m","toLowerCase","kebabToCamelCase","toUpperCase","MiElement","HTMLElement","attr","attrLc","Map","types","disposers","controllers","changedAttr","dedupe","static","mode","attributes","properties","observedAttributes","observedProperties","observe","name","Object","defineProperty","enumerable","oldValue","entries","initial","initialValueType","type","has","getName","getType","connectedCallback","forEach","controller","shadowRootOptions","template","renderRoot","shadowRoot","attachShadow","addTemplate","render","disconnectedCallback","remover","attributeChangedCallback","convertType","removeAttribute","setAttribute","includes","shouldUpdate","_changedAttributes","isConnected","requestAnimationFrame","update","HTMLTemplateElement","Error","append","content","cloneNode","on","eventName","listener","node","once","dispose","listeners","TypeError","removeController","delete","define","element","keys","map","renderTemplate","window","customElements","el","document","createElement","innerHTML","Boolean","Number","String","toString","call","slice","any","n","isNaN","toNumber","UnsafeHtml","unsafeHtml","escMap","escHtml","string","tag","esc","strings","values","raw","val","Array","isArray","join","refsById","container","nodes","querySelectorAll","found","getAttribute","nodeName","refsBySelector","selectors","selector","querySelector","Store","actions","action","dispatcher","data","classMap","acc","styleMap","unit","_unit","isFinite","globalSheets","addGlobalStyles","adoptedStyleSheets","from","styleSheets","cssRules","sheet","CSSStyleSheet","css","rule","cssText","replaceSync"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AOrG,EAAM5E,KAAU6E,OAAOI,QAAQ+C,GAAO,CAAA,GAAK,CACrD,GAAIhI,QAAuC,SAC3C,MAAMoL,EAAQ3C,OAAO4C,SAASrL,GAASmL,EAAO,GAC9CF,EAAI9J,KAAK,GAAGgC,EAAiByB,MAAS5E,IAAQoL,IAChD,CACA,OAAOH,EAAIlB,KAAK,MAKlB,IAAIuB,EAAe,KA6BZ,SAASC,EAAgB1F,GAC9BA,EAAW2F,mBAAmBrK,SAxBT,OAAjBmK,IACFA,EAAezB,MAAM4B,KAAKpD,SAASqD,aAAa1D,IAAI,EAAG2D,eACrD,MAAMC,EAAQ,IAAIC,cACZC,EAAMjC,MAAM4B,KAAKE,GACpB3D,IAAK+D,GAASA,EAAKC,SACnBjC,KAAK,KAER,OADA6B,EAAMK,YAAYH,GACXF,KAGJN,GAeT"}
|
package/src/min.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Used for index.min.js;
|
|
3
|
-
Bundle file includes mi-signal, mi-html and mi-element;
|
|
4
|
-
~5.7kB minified and gzipped in size.
|
|
5
|
-
*/
|
|
6
|
-
export * from './index.js'
|
|
7
|
-
export {
|
|
8
|
-
render,
|
|
9
|
-
html,
|
|
10
|
-
svg,
|
|
11
|
-
Hole,
|
|
12
|
-
attach,
|
|
13
|
-
detach,
|
|
14
|
-
htmlFor,
|
|
15
|
-
svgFor,
|
|
16
|
-
attr
|
|
17
|
-
} from 'mi-html'
|
package/types/min.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./index.js";
|