ecmact 1.0.2

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.
@@ -0,0 +1,8 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=({props:s,shadowRoot:t})=>{Object.entries(s).forEach(([e,n])=>{if(e.startsWith("on")&&typeof n=="function"){const o=e.slice(2).toLowerCase();t.querySelector(s.tag||"div")?.addEventListener(o,n)}})},p=({style:s,tag:t})=>{if(Object.keys(s).length===0)return"";const e=Object.entries(s).map(([n,o])=>`${n.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`).join(" ");return`<style>${t} { ${e} }</style>`},l=({props:s})=>Object.entries(s).filter(([t])=>!["content","tag","style","children"].includes(t)&&!t.startsWith("on")).map(([t,e])=>`${t}="${e}"`).join(" "),h=({props:s,shadowRoot:t,generateStyle:e})=>{const{content:n="",tag:o="div",children:r=[]}=s;t.innerHTML=`
2
+ ${e()}
3
+ <${o} ${l({props:s})}>
4
+ ${n.length>0?n:""}
5
+ ${r.length>0?"<slot></slot>":""}
6
+ </${o}>
7
+ `;const c=t.querySelector("slot");r.forEach(i=>c.appendChild(i))},d=(s,...t)=>{const e=document.querySelector(s);e&&e.append(...t)};class u extends HTMLElement{_props;constructor(t={}){super(),this.attachShadow({mode:"open"}),this._props=t}#t(){return a({props:this.props,shadowRoot:this.shadowRoot})}#s(){const{style:t={},tag:e="div"}=this.props;return p({style:t,tag:e})}#e(){return h({props:this._props,shadowRoot:this.shadowRoot,generateStyle:()=>this.#s()})}connectedCallback(){this.#e(),this.#t()}setState(t){this.props={...this._props,...t}}get props(){return this._props}set props(t){this._props=t,this.#e(),this.#t()}}const m=new Proxy({},{get(s,t){const e=`em-${t.toLowerCase()}`;return customElements.get(e)||customElements.define(e,class extends u{constructor(n){super(n)}}),n=>{const o=document.createElement(e);return o.props=n,o}}});exports.em=m;exports.mount=d;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/setEventListeners.ts","../../src/utils/generateStyle.ts","../../src/utils/generateAttributes.ts","../../src/utils/render.ts","../../src/utils/mount.ts","../../src/component.ts","../../src/em.ts"],"sourcesContent":["export const setEventListeners = ({ props, shadowRoot }) => {\n Object.entries(props).forEach(([key, value]) => {\n if (key.startsWith('on') && typeof value === 'function') {\n const event = key.slice(2).toLowerCase();\n shadowRoot.querySelector(props.tag || 'div')?.addEventListener(event, value);\n }\n });\n};\n","export const generateStyle = ({ style, tag }) => {\n if (Object.keys(style).length === 0) return '';\n\n const css = Object.entries(style)\n .map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`)\n .join(' ');\n\n return `<style>${tag} { ${css} }</style>`;\n};\n","export const generateAttributes = ({ props }) =>\n Object.entries(props)\n .filter(\n ([key]) => !['content', 'tag', 'style', 'children'].includes(key) && !key.startsWith('on'),\n )\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(' ');\n","import { generateAttributes } from './generateAttributes';\n\nexport const render = ({ props, shadowRoot, generateStyle }) => {\n const { content = '', tag = 'div', children = [] } = props;\n\n shadowRoot!.innerHTML = `\n ${generateStyle()}\n <${tag} ${generateAttributes({ props })}>\n ${content.length > 0 ? content : ''}\n ${children.length > 0 ? `<slot></slot>` : ''}\n </${tag}>\n `;\n\n const slot = shadowRoot!.querySelector('slot') as HTMLSlotElement;\n children.forEach((child: any) => slot.appendChild(child));\n};\n","export const mount = (elementId: string, ...nodes: Node[]) => {\n const container = document.querySelector(elementId);\n if (container) container.append(...nodes);\n};\n","import type { ComponentProps } from '@types';\nimport { setEventListeners, generateStyle, render } from '@utils';\n\nexport class component extends HTMLElement {\n private _props: ComponentProps;\n\n constructor(props: ComponentProps = {}) {\n super();\n this.attachShadow({ mode: 'open' });\n this._props = props;\n }\n\n #setEventListeners() {\n return setEventListeners({\n props: this.props,\n shadowRoot: this.shadowRoot,\n });\n }\n\n #generateStyle() {\n const { style = {}, tag = 'div' } = this.props;\n return generateStyle({ style, tag });\n }\n\n #render() {\n return render({\n props: this._props,\n shadowRoot: this.shadowRoot,\n generateStyle: () => this.#generateStyle(),\n });\n }\n\n connectedCallback() {\n this.#render();\n this.#setEventListeners();\n }\n\n setState(newProps: Partial<ComponentProps>) {\n this.props = {\n ...this._props,\n ...newProps,\n };\n }\n\n get props() {\n return this._props;\n }\n\n set props(newProps: ComponentProps) {\n this._props = newProps;\n this.#render();\n this.#setEventListeners();\n }\n}\n","import { component } from './component';\nimport type { ComponentProps } from '@types';\n\ninterface ComponentRegistry {\n [key: string]: (props: ComponentProps) => component;\n}\n\nconst em: ComponentRegistry = new Proxy({} as ComponentRegistry, {\n get(_, prop: string) {\n const tagName = `em-${prop.toLowerCase()}`;\n\n if (!customElements.get(tagName)) {\n customElements.define(\n tagName,\n class extends component {\n constructor(props: ComponentProps) {\n super(props);\n }\n },\n );\n }\n\n return (props: ComponentProps): component => {\n const element = document.createElement(tagName) as component;\n element.props = props;\n return element;\n };\n },\n});\n\nexport { em };\n"],"names":["setEventListeners","props","shadowRoot","key","value","event","generateStyle","style","tag","css","generateAttributes","render","content","children","slot","child","mount","elementId","nodes","container","component","#setEventListeners","#generateStyle","#render","newProps","em","_","prop","tagName","element"],"mappings":"gFAAO,MAAMA,EAAoB,CAAC,CAAE,MAAAC,EAAO,WAAAC,KAAiB,CACnD,OAAA,QAAQD,CAAK,EAAE,QAAQ,CAAC,CAACE,EAAKC,CAAK,IAAM,CAC9C,GAAID,EAAI,WAAW,IAAI,GAAK,OAAOC,GAAU,WAAY,CACvD,MAAMC,EAAQF,EAAI,MAAM,CAAC,EAAE,YAAY,EACvCD,EAAW,cAAcD,EAAM,KAAO,KAAK,GAAG,iBAAiBI,EAAOD,CAAK,CAAA,CAC7E,CACD,CACH,ECPaE,EAAgB,CAAC,CAAE,MAAAC,EAAO,IAAAC,KAAU,CAC/C,GAAI,OAAO,KAAKD,CAAK,EAAE,SAAW,EAAU,MAAA,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IAAqB,CACnB,OAAOrB,EAAkB,CACvB,MAAO,KAAK,MACZ,WAAY,KAAK,UAAA,CAClB,CAAA,CAGHsB,IAAiB,CACf,KAAM,CAAE,MAAAf,EAAQ,GAAI,IAAAC,EAAM,KAAA,EAAU,KAAK,MACzC,OAAOF,EAAc,CAAE,MAAAC,EAAO,IAAAC,EAAK,CAAA,CAGrCe,IAAU,CACR,OAAOZ,EAAO,CACZ,MAAO,KAAK,OACZ,WAAY,KAAK,WACjB,cAAe,IAAM,KAAKW,GAAe,CAAA,CAC1C,CAAA,CAGH,mBAAoB,CAClB,KAAKC,GAAQ,EACb,KAAKF,GAAmB,CAAA,CAG1B,SAASG,EAAmC,CAC1C,KAAK,MAAQ,CACX,GAAG,KAAK,OACR,GAAGA,CACL,CAAA,CAGF,IAAI,OAAQ,CACV,OAAO,KAAK,MAAA,CAGd,IAAI,MAAMA,EAA0B,CAClC,KAAK,OAASA,EACd,KAAKD,GAAQ,EACb,KAAKF,GAAmB,CAAA,CAE5B,CC9CA,MAAMI,EAAwB,IAAI,MAAM,GAAyB,CAC/D,IAAIC,EAAGC,EAAc,CACnB,MAAMC,EAAU,MAAMD,EAAK,YAAa,CAAA,GAExC,OAAK,eAAe,IAAIC,CAAO,GACd,eAAA,OACbA,EACA,cAAcR,CAAU,CACtB,YAAYnB,EAAuB,CACjC,MAAMA,CAAK,CAAA,CACb,CAEJ,EAGMA,GAAqC,CACrC,MAAA4B,EAAU,SAAS,cAAcD,CAAO,EAC9C,OAAAC,EAAQ,MAAQ5B,EACT4B,CACT,CAAA,CAEJ,CAAC"}
@@ -0,0 +1,87 @@
1
+ const p = ({ props: s, shadowRoot: t }) => {
2
+ Object.entries(s).forEach(([e, n]) => {
3
+ if (e.startsWith("on") && typeof n == "function") {
4
+ const o = e.slice(2).toLowerCase();
5
+ t.querySelector(s.tag || "div")?.addEventListener(o, n);
6
+ }
7
+ });
8
+ }, a = ({ style: s, tag: t }) => {
9
+ if (Object.keys(s).length === 0) return "";
10
+ const e = Object.entries(s).map(([n, o]) => `${n.replace(/([A-Z])/g, "-$1").toLowerCase()}: ${o};`).join(" ");
11
+ return `<style>${t} { ${e} }</style>`;
12
+ }, h = ({ props: s }) => Object.entries(s).filter(
13
+ ([t]) => !["content", "tag", "style", "children"].includes(t) && !t.startsWith("on")
14
+ ).map(([t, e]) => `${t}="${e}"`).join(" "), l = ({ props: s, shadowRoot: t, generateStyle: e }) => {
15
+ const { content: n = "", tag: o = "div", children: r = [] } = s;
16
+ t.innerHTML = `
17
+ ${e()}
18
+ <${o} ${h({ props: s })}>
19
+ ${n.length > 0 ? n : ""}
20
+ ${r.length > 0 ? "<slot></slot>" : ""}
21
+ </${o}>
22
+ `;
23
+ const c = t.querySelector("slot");
24
+ r.forEach((i) => c.appendChild(i));
25
+ }, u = (s, ...t) => {
26
+ const e = document.querySelector(s);
27
+ e && e.append(...t);
28
+ };
29
+ class d extends HTMLElement {
30
+ _props;
31
+ constructor(t = {}) {
32
+ super(), this.attachShadow({ mode: "open" }), this._props = t;
33
+ }
34
+ #t() {
35
+ return p({
36
+ props: this.props,
37
+ shadowRoot: this.shadowRoot
38
+ });
39
+ }
40
+ #s() {
41
+ const { style: t = {}, tag: e = "div" } = this.props;
42
+ return a({ style: t, tag: e });
43
+ }
44
+ #e() {
45
+ return l({
46
+ props: this._props,
47
+ shadowRoot: this.shadowRoot,
48
+ generateStyle: () => this.#s()
49
+ });
50
+ }
51
+ connectedCallback() {
52
+ this.#e(), this.#t();
53
+ }
54
+ setState(t) {
55
+ this.props = {
56
+ ...this._props,
57
+ ...t
58
+ };
59
+ }
60
+ get props() {
61
+ return this._props;
62
+ }
63
+ set props(t) {
64
+ this._props = t, this.#e(), this.#t();
65
+ }
66
+ }
67
+ const m = new Proxy({}, {
68
+ get(s, t) {
69
+ const e = `em-${t.toLowerCase()}`;
70
+ return customElements.get(e) || customElements.define(
71
+ e,
72
+ class extends d {
73
+ constructor(n) {
74
+ super(n);
75
+ }
76
+ }
77
+ ), (n) => {
78
+ const o = document.createElement(e);
79
+ return o.props = n, o;
80
+ };
81
+ }
82
+ });
83
+ export {
84
+ m as em,
85
+ u as mount
86
+ };
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/setEventListeners.ts","../../src/utils/generateStyle.ts","../../src/utils/generateAttributes.ts","../../src/utils/render.ts","../../src/utils/mount.ts","../../src/component.ts","../../src/em.ts"],"sourcesContent":["export const setEventListeners = ({ props, shadowRoot }) => {\n Object.entries(props).forEach(([key, value]) => {\n if (key.startsWith('on') && typeof value === 'function') {\n const event = key.slice(2).toLowerCase();\n shadowRoot.querySelector(props.tag || 'div')?.addEventListener(event, value);\n }\n });\n};\n","export const generateStyle = ({ style, tag }) => {\n if (Object.keys(style).length === 0) return '';\n\n const css = Object.entries(style)\n .map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value};`)\n .join(' ');\n\n return `<style>${tag} { ${css} }</style>`;\n};\n","export const generateAttributes = ({ props }) =>\n Object.entries(props)\n .filter(\n ([key]) => !['content', 'tag', 'style', 'children'].includes(key) && !key.startsWith('on'),\n )\n .map(([key, value]) => `${key}=\"${value}\"`)\n .join(' ');\n","import { generateAttributes } from './generateAttributes';\n\nexport const render = ({ props, shadowRoot, generateStyle }) => {\n const { content = '', tag = 'div', children = [] } = props;\n\n shadowRoot!.innerHTML = `\n ${generateStyle()}\n <${tag} ${generateAttributes({ props })}>\n ${content.length > 0 ? content : ''}\n ${children.length > 0 ? `<slot></slot>` : ''}\n </${tag}>\n `;\n\n const slot = shadowRoot!.querySelector('slot') as HTMLSlotElement;\n children.forEach((child: any) => slot.appendChild(child));\n};\n","export const mount = (elementId: string, ...nodes: Node[]) => {\n const container = document.querySelector(elementId);\n if (container) container.append(...nodes);\n};\n","import type { ComponentProps } from '@types';\nimport { setEventListeners, generateStyle, render } from '@utils';\n\nexport class component extends HTMLElement {\n private _props: ComponentProps;\n\n constructor(props: ComponentProps = {}) {\n super();\n this.attachShadow({ mode: 'open' });\n this._props = props;\n }\n\n #setEventListeners() {\n return setEventListeners({\n props: this.props,\n shadowRoot: this.shadowRoot,\n });\n }\n\n #generateStyle() {\n const { style = {}, tag = 'div' } = this.props;\n return generateStyle({ style, tag });\n }\n\n #render() {\n return render({\n props: this._props,\n shadowRoot: this.shadowRoot,\n generateStyle: () => this.#generateStyle(),\n });\n }\n\n connectedCallback() {\n this.#render();\n this.#setEventListeners();\n }\n\n setState(newProps: Partial<ComponentProps>) {\n this.props = {\n ...this._props,\n ...newProps,\n };\n }\n\n get props() {\n return this._props;\n }\n\n set props(newProps: ComponentProps) {\n this._props = newProps;\n this.#render();\n this.#setEventListeners();\n }\n}\n","import { component } from './component';\nimport type { ComponentProps } from '@types';\n\ninterface ComponentRegistry {\n [key: string]: (props: ComponentProps) => component;\n}\n\nconst em: ComponentRegistry = new Proxy({} as ComponentRegistry, {\n get(_, prop: string) {\n const tagName = `em-${prop.toLowerCase()}`;\n\n if (!customElements.get(tagName)) {\n customElements.define(\n tagName,\n class extends component {\n constructor(props: ComponentProps) {\n super(props);\n }\n },\n );\n }\n\n return (props: ComponentProps): component => {\n const element = document.createElement(tagName) as component;\n element.props = props;\n return element;\n };\n },\n});\n\nexport { em };\n"],"names":["setEventListeners","props","shadowRoot","key","value","event","generateStyle","style","tag","css","generateAttributes","render","content","children","slot","child","mount","elementId","nodes","container","component","#setEventListeners","#generateStyle","#render","newProps","em","_","prop","tagName","element"],"mappings":"AAAO,MAAMA,IAAoB,CAAC,EAAE,OAAAC,GAAO,YAAAC,QAAiB;AACnD,SAAA,QAAQD,CAAK,EAAE,QAAQ,CAAC,CAACE,GAAKC,CAAK,MAAM;AAC9C,QAAID,EAAI,WAAW,IAAI,KAAK,OAAOC,KAAU,YAAY;AACvD,YAAMC,IAAQF,EAAI,MAAM,CAAC,EAAE,YAAY;AACvC,MAAAD,EAAW,cAAcD,EAAM,OAAO,KAAK,GAAG,iBAAiBI,GAAO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,MACb;AAAA,IAEJ,GAGK,CAACA,MAAqC;AACrC,YAAA4B,IAAU,SAAS,cAAcD,CAAO;AAC9C,aAAAC,EAAQ,QAAQ5B,GACT4B;AAAA,IACT;AAAA,EAAA;AAEJ,CAAC;"}
@@ -0,0 +1,10 @@
1
+ import { ComponentProps } from './types';
2
+ export declare class component extends HTMLElement {
3
+ #private;
4
+ private _props;
5
+ constructor(props?: ComponentProps);
6
+ connectedCallback(): void;
7
+ setState(newProps: Partial<ComponentProps>): void;
8
+ get props(): ComponentProps;
9
+ set props(newProps: ComponentProps);
10
+ }
@@ -0,0 +1,7 @@
1
+ import { component } from './component';
2
+ import { ComponentProps } from './types';
3
+ interface ComponentRegistry {
4
+ [key: string]: (props: ComponentProps) => component;
5
+ }
6
+ declare const em: ComponentRegistry;
7
+ export { em };
@@ -0,0 +1,2 @@
1
+ export { em } from './em';
2
+ export { mount } from './utils';
@@ -0,0 +1,10 @@
1
+ export interface ComponentProps {
2
+ content?: string;
3
+ tag?: string;
4
+ style?: Partial<CSSStyleDeclaration>;
5
+ children?: HTMLElement[];
6
+ slots?: Record<string, string>;
7
+ ref?: (element: HTMLElement) => void;
8
+ customEvents?: Record<string, (event: Event) => void>;
9
+ [key: string]: any;
10
+ }
@@ -0,0 +1 @@
1
+ export type { ComponentProps } from './BaseComponent';
@@ -0,0 +1,3 @@
1
+ export declare const generateAttributes: ({ props }: {
2
+ props: any;
3
+ }) => string;
@@ -0,0 +1,4 @@
1
+ export declare const generateStyle: ({ style, tag }: {
2
+ style: any;
3
+ tag: any;
4
+ }) => string;
@@ -0,0 +1,5 @@
1
+ export { setEventListeners } from './setEventListeners';
2
+ export { generateStyle } from './generateStyle';
3
+ export { generateAttributes } from './generateAttributes';
4
+ export { render } from './render';
5
+ export { mount } from './mount';
@@ -0,0 +1 @@
1
+ export declare const mount: (elementId: string, ...nodes: Node[]) => void;
@@ -0,0 +1,5 @@
1
+ export declare const render: ({ props, shadowRoot, generateStyle }: {
2
+ props: any;
3
+ shadowRoot: any;
4
+ generateStyle: any;
5
+ }) => void;
@@ -0,0 +1,4 @@
1
+ export declare const setEventListeners: ({ props, shadowRoot }: {
2
+ props: any;
3
+ shadowRoot: any;
4
+ }) => void;
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "ecmact",
3
+ "version": "1.0.2",
4
+ "description": "Dynamic components library using Vite Vanilla and Web Components",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.es.js",
7
+ "types": "dist/types/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.es.js",
12
+ "require": "./dist/index.cjs.js",
13
+ "types": "./dist/types/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "engines": {
20
+ "node": ">=22.0.0"
21
+ },
22
+ "scripts": {
23
+ "build": "vite build",
24
+ "test": "vitest",
25
+ "lint": "eslint . --ext .ts --fix",
26
+ "format": "prettier --write \"src/**/*.{ts,js,json,css,md}\"",
27
+ "release": "npm publish --access public"
28
+ },
29
+ "keywords": [
30
+ "vite",
31
+ "web-components",
32
+ "dynamic-components",
33
+ "vanilla-js",
34
+ "shadow-dom"
35
+ ],
36
+ "author": "Alexandr Priadchenko",
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "eslint-plugin-prettier": "^5.2.5",
40
+ "jiti": "^2.4.2",
41
+ "prettier": "^3.5.3",
42
+ "typescript-eslint": "^8.28.0",
43
+ "vite": "^6.2.4",
44
+ "vite-plugin-dts": "^4.5.3"
45
+ },
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/eternalvision/ecmact.git"
49
+ }
50
+ }