@vandeurenglenn/lite-elements 0.3.49 → 0.3.51

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.
Files changed (142) hide show
  1. package/exports/banner.js +37 -37
  2. package/exports/bar/top-app-bar.d.ts +1 -1
  3. package/exports/bundle/banner.js +2 -2
  4. package/exports/bundle/button.js +6 -1
  5. package/exports/bundle/card.js +1 -1
  6. package/exports/bundle/code.js +1 -1
  7. package/exports/bundle/{column-B0bUzxkF.js → column-dsIMZ5XT.js} +1 -1
  8. package/exports/bundle/demo-elements.js +1 -1
  9. package/exports/bundle/demo-icons.js +1 -1
  10. package/exports/bundle/demo-shell.js +1 -1
  11. package/exports/bundle/demo.js +1 -1
  12. package/exports/bundle/dialog.js +1 -1
  13. package/exports/bundle/divider.js +1 -1
  14. package/exports/bundle/drawer-button.js +1 -1
  15. package/exports/bundle/drawer-item.js +1 -1
  16. package/exports/bundle/drawer-layout.js +1 -1
  17. package/exports/bundle/drawer.js +2 -2
  18. package/exports/bundle/dropdown-menu.js +1 -1
  19. package/exports/bundle/dropdown.js +1 -1
  20. package/exports/bundle/elements.js +1 -1
  21. package/exports/bundle/elevation.js +1 -1
  22. package/exports/bundle/fab.js +2 -2
  23. package/exports/bundle/icon-button.js +1 -1
  24. package/exports/bundle/icon-set.js +1 -1
  25. package/exports/bundle/icon.js +1 -1
  26. package/exports/bundle/index.html +590 -590
  27. package/exports/bundle/input.js +2 -2
  28. package/exports/bundle/list-item.js +1 -1
  29. package/exports/bundle/menu.js +1 -1
  30. package/exports/bundle/minute-field.js +1 -1
  31. package/exports/bundle/notification.js +1 -1
  32. package/exports/bundle/notifications.js +1 -1
  33. package/exports/bundle/pages.js +1 -1
  34. package/exports/bundle/pane.js +3 -3
  35. package/exports/bundle/property-C1gA9hig.js +23 -0
  36. package/exports/bundle/property-DL093_VN.js +11 -0
  37. package/exports/bundle/rail.js +1 -1
  38. package/exports/bundle/root.js +2 -2
  39. package/exports/bundle/row-CW5FbTZ_.js +28 -0
  40. package/exports/bundle/section.js +1 -1
  41. package/exports/bundle/section2.js +1 -1
  42. package/exports/bundle/select-mixin.js +1 -1
  43. package/exports/bundle/selector-mixin.js +1 -1
  44. package/exports/bundle/selector.js +1 -1
  45. package/exports/bundle/summary-mirror.js +1 -1
  46. package/exports/bundle/summary.js +2 -2
  47. package/exports/bundle/supporting-pane.js +1 -1
  48. package/exports/bundle/tab.js +2 -2
  49. package/exports/bundle/tabs.js +1 -1
  50. package/exports/bundle/text-field.js +1 -1
  51. package/exports/bundle/theme.js +1 -1
  52. package/exports/bundle/themes/default/colors.module.css +180 -180
  53. package/exports/bundle/themes/default/missing/motion.css +3 -3
  54. package/exports/bundle/themes/default/missing/shape.css +12 -12
  55. package/exports/bundle/themes/default/missing/theme.dark.css +4 -4
  56. package/exports/bundle/themes/default/missing/theme.light.css +4 -4
  57. package/exports/bundle/themes/default/missing/tokens.css +8 -8
  58. package/exports/bundle/themes/default/theme.css +10 -10
  59. package/exports/bundle/themes/default/theme.dark.css +33 -33
  60. package/exports/bundle/themes/default/theme.light.css +33 -33
  61. package/exports/bundle/themes/default/tokens.css +256 -256
  62. package/exports/bundle/themes/default/typography.module.css +150 -150
  63. package/exports/bundle/time-picker.js +1 -1
  64. package/exports/bundle/toggle-button.js +1 -1
  65. package/exports/bundle/toggle.js +1 -1
  66. package/exports/bundle/top-app-bar.js +63 -2
  67. package/exports/bundle/typography.js +1 -1
  68. package/exports/bundle/upload-file.js +1 -1
  69. package/exports/bundle/upload-image.js +62 -55
  70. package/exports/button.js +149 -144
  71. package/exports/card.js +140 -140
  72. package/exports/code.js +35 -35
  73. package/exports/demo-elements.js +1 -1
  74. package/exports/demo-icons.js +16 -16
  75. package/exports/demo-shell.js +540 -540
  76. package/exports/demo.js +457 -457
  77. package/exports/dialog.js +149 -149
  78. package/exports/divider.js +22 -22
  79. package/exports/drawer-button.js +14 -14
  80. package/exports/drawer-item.js +39 -39
  81. package/exports/drawer-layout.js +96 -96
  82. package/exports/drawer.js +8 -8
  83. package/exports/dropdown-menu.js +59 -59
  84. package/exports/dropdown.js +26 -26
  85. package/exports/elements.js +1 -1
  86. package/exports/elevation.js +51 -51
  87. package/exports/fab.js +146 -146
  88. package/exports/icon-button.js +13 -13
  89. package/exports/icon-set.js +5 -5
  90. package/exports/icon.js +16 -16
  91. package/exports/input.js +6 -6
  92. package/exports/list-item.js +43 -43
  93. package/exports/menu.js +13 -13
  94. package/exports/minute-field.js +5 -5
  95. package/exports/mixins/scroll-mixin.d.ts +1 -1
  96. package/exports/notification.js +35 -35
  97. package/exports/notifications.js +66 -66
  98. package/exports/pages.js +42 -42
  99. package/exports/pane.js +19 -19
  100. package/exports/rail.js +58 -58
  101. package/exports/root.js +8 -8
  102. package/exports/section/section.d.ts +2 -2
  103. package/exports/section.js +11 -11
  104. package/exports/section2.js +25 -25
  105. package/exports/selector.js +31 -31
  106. package/exports/summary-mirror.js +20 -20
  107. package/exports/summary.js +25 -25
  108. package/exports/supporting-pane.js +47 -47
  109. package/exports/tab.js +22 -22
  110. package/exports/tabs.js +51 -51
  111. package/exports/text-field.js +10 -10
  112. package/exports/theme.js +9 -9
  113. package/exports/themes/default/colors.module.css +180 -180
  114. package/exports/themes/default/missing/motion.css +3 -3
  115. package/exports/themes/default/missing/shape.css +12 -12
  116. package/exports/themes/default/missing/theme.dark.css +4 -4
  117. package/exports/themes/default/missing/theme.light.css +4 -4
  118. package/exports/themes/default/missing/tokens.css +8 -8
  119. package/exports/themes/default/theme.css +10 -10
  120. package/exports/themes/default/theme.dark.css +33 -33
  121. package/exports/themes/default/theme.light.css +33 -33
  122. package/exports/themes/default/tokens.css +256 -256
  123. package/exports/themes/default/typography.module.css +150 -150
  124. package/exports/time-picker.js +21 -21
  125. package/exports/toggle-button.js +4 -4
  126. package/exports/toggle.js +5 -5
  127. package/exports/top-app-bar.js +21 -21
  128. package/exports/{tslib.es6-CFl_-KPR.js → tslib.es6-Cg9lAhfj.js} +1 -1
  129. package/exports/typography.js +156 -156
  130. package/exports/upload-file.js +9 -9
  131. package/exports/upload-image.js +201 -201
  132. package/package.json +20 -36
  133. package/exports/bundle/property-BYA8Sw2t.js +0 -11
  134. package/exports/bundle/property-C4lhirVQ.js +0 -23
  135. package/exports/bundle/row-DYDgQVDj.js +0 -28
  136. package/exports/bundle/simple-hash-router.js +0 -1
  137. package/exports/bundle/types2.js +0 -1
  138. package/exports/mixins/file-reader-mixin.d.ts +0 -341
  139. package/exports/router/types.d.ts +0 -45
  140. package/exports/simple-hash-router.js +0 -111
  141. package/exports/types2.js +0 -1
  142. package/exports/upload/upload-image.d.ts +0 -381
@@ -1,28 +0,0 @@
1
- import{x as t,j as e,L as i}from"./property-BYA8Sw2t.js";Symbol.metadata??=Symbol("metadata");class s extends HTMLElement{static get observedAttributes(){return this[Symbol.metadata]?.observedAttributes?.values()??[]}attributeChangedCallback(t,e,i){this[t]===i&&e===i||(this[t]=i)}constructor(){super(),this.renderedOnce=!1,this.rendered=new Promise((t=>{this.renderResolve=t})),this.attachShadow({mode:"open"});const t=customElements.get(this.localName);this.shadowRoot.adoptedStyleSheets=t.styles?t.styles.map((t=>t.styleSheet??t)):[],this.requestRender()}render(){return t`<slot></slot>`}requestRender(){e(this.render(),this.shadowRoot),this.renderedOnce||(this.renderResolve(!0),this.renderedOnce=!0,this.firstRender&&this.firstRender())}}const r=(t,e)=>{let i=t;return e===Boolean?i=Boolean("true"===t):e===Number?i=Number(t):e===Uint8Array?i=new Uint8Array(t.split(",")):e!==Array&&e!==Object&&e!==WeakMap&&e!==Map&&e!==Uint8Array||(i=JSON.parse(t),e===Map&&(i=new Map(t)),e===WeakMap&&(i=new WeakMap(t))),i};globalThis.pubsub=globalThis.pubsub||new i;const a={type:String,reflect:!1,renders:!0,batchDelay:50,temporaryRender:10},n=t=>{t={...a,...t};let e=0;return function(i,{kind:a,name:n,addInitializer:o,access:c,metadata:h}){const{type:l,reflect:d,renders:u,batches:g,batchDelay:p,consumer:b,provider:m,temporaryRender:_}=t,y=t.attribute??d,f=String(n),v=y&&"string"==typeof y?y:f,x=l===Boolean,w=b||"boolean"==typeof t.consumes?v:t.consumes,S=m||"boolean"==typeof t.provides?v:t.provides;if(t.provider&&console.warn(`${f}: 'options.provider' is deprecated, use options.provides instead`),t.consumer&&console.warn(`${f}: 'options.consumer' is deprecated, use options.consumes instead`),o((function(){"accessor"!==a&&console.warn(`${this.localName}: @property(${t}) ${f} ${a} is not supported`),y&&(h||(h={}),h.observedAttributes||(h.observedAttributes=new Map),h.observedAttributes.set(f,v)),w&&globalThis.pubsub.subscribe(w,(async t=>{this[n]=t}))})),"accessor"===a)return{get(){return $.call(this)},set(t){return C.call(this,t)},init(t){return this.hasAttribute(v)&&(t=x?this.hasAttribute(v):r(this.getAttribute(v),l)),w&&globalThis.pubsub.subscribers?.[w]?.value&&(t=globalThis.pubsub.subscribers[w].value),void 0!==t&&C.call(this,t),this[n]}};function $(){const t=y?x?this.hasAttribute(v):r(this.getAttribute(v),l):this[`__lite_${f}`]?this[`__lite_${f}`]:this[`_lite_${f}`];return w&&!this[`__lite_${f}`]&&globalThis.pubsub.subscribers?.[w]?.value?(t!==globalThis.pubsub.subscribers[w].value&&C.call(this,globalThis.pubsub.subscribers[w].value),globalThis.pubsub.subscribers[w].value):t}async function C(t){if(S&&globalThis.pubsub.publish(S,t),this[`_lite_${f}`]!==t){this.willChange&&(this[`__lite_${f}`]=await this.willChange(n,t)),y?x?t||this[`__lite_${f}`]?this.setAttribute(v,""):this.removeAttribute(v):t||this[`__lite_${f}`]?this.setAttribute(v,((t,e)=>{let i=e;if(t===Boolean||t===Number||t===Uint8Array)return e.toString();if(t===Array||t===Object||t===WeakMap||t===Map||t===Uint8Array){let r;t!==Map&&t!==WeakMap||(r=Object(e).entries()),i=JSON.stringify(r)}return i})(l,this[`__lite_${f}`]??t)):this.removeAttribute(v):this[`_lite_${f}`]=t;const i=()=>{e=0,this.requestRender&&u&&this.requestRender(),this.onChange&&this.onChange(n,this[`__lite_${f}`]??t)};g?e===_?i():(this[`_${f}_timeout`]&&clearTimeout(this[`_${f}_timeout`]),this[`_${f}_timeout`]=setTimeout(i,p)):i()}}}};var o=function(t,e,i,r,a,n){function o(t){if(void 0!==t&&"function"!=typeof t)throw new TypeError("Function expected");return t}for(var c,h=r.kind,l="getter"===h?"get":"setter"===h?"set":"value",d=!e&&t?r.static?t:t.prototype:null,u=e||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),g=!1,p=i.length-1;p>=0;p--){var b={};for(var m in r)b[m]="access"===m?{}:r[m];for(var m in r.access)b.access[m]=r.access[m];b.addInitializer=function(t){if(g)throw new TypeError("Cannot add initializers after decoration has completed");n.push(o(t||null))};var _=(0,i[p])("accessor"===h?{get:u.get,set:u.set}:u[l],b);if("accessor"===h){if(void 0===_)continue;if(null===_||"object"!=typeof _)throw new TypeError("Object expected");(c=o(_.get))&&(u.get=c),(c=o(_.set))&&(u.set=c),(c=o(_.init))&&a.unshift(c)}else(c=o(_))&&("field"===h?a.unshift(c):u[l]=c)}d&&Object.defineProperty(d,r.name,u),g=!0},c=function(t,e,i){for(var r=arguments.length>2,a=0;a<e.length;a++)i=r?e[a].call(t,i):e[a].call(t);return r?i:void 0};let h=(()=>{let e,i,r,a,h,l,d,u,g,p,b=s,m=[],_=[],y=[],f=[],v=[],x=[],w=[],S=[],$=[],C=[],W=[],j=[],A=[],k=[],T=[],z=[],O=[],R=[],I=[],M=[];return class FlexDisplay extends b{static{const t="function"==typeof Symbol&&Symbol.metadata?Object.create(b[Symbol.metadata]??null):void 0;e=[n({type:String})],i=[n({type:String})],r=[n({type:String})],a=[n({type:String})],h=[n({type:String,reflect:!0})],l=[n({type:Boolean,reflect:!0})],d=[n({type:Boolean,reflect:!0,attribute:"center-center"})],u=[n({type:String})],g=[n({type:String})],p=[n({type:String})],o(this,null,e,{kind:"accessor",name:"padding",static:!1,private:!1,access:{has:t=>"padding"in t,get:t=>t.padding,set:(t,e)=>{t.padding=e}},metadata:t},m,_),o(this,null,i,{kind:"accessor",name:"minWidth",static:!1,private:!1,access:{has:t=>"minWidth"in t,get:t=>t.minWidth,set:(t,e)=>{t.minWidth=e}},metadata:t},y,f),o(this,null,r,{kind:"accessor",name:"maxWidth",static:!1,private:!1,access:{has:t=>"maxWidth"in t,get:t=>t.maxWidth,set:(t,e)=>{t.maxWidth=e}},metadata:t},v,x),o(this,null,a,{kind:"accessor",name:"width",static:!1,private:!1,access:{has:t=>"width"in t,get:t=>t.width,set:(t,e)=>{t.width=e}},metadata:t},w,S),o(this,null,h,{kind:"accessor",name:"direction",static:!1,private:!1,access:{has:t=>"direction"in t,get:t=>t.direction,set:(t,e)=>{t.direction=e}},metadata:t},$,C),o(this,null,l,{kind:"accessor",name:"center",static:!1,private:!1,access:{has:t=>"center"in t,get:t=>t.center,set:(t,e)=>{t.center=e}},metadata:t},W,j),o(this,null,d,{kind:"accessor",name:"centerCenter",static:!1,private:!1,access:{has:t=>"centerCenter"in t,get:t=>t.centerCenter,set:(t,e)=>{t.centerCenter=e}},metadata:t},A,k),o(this,null,u,{kind:"accessor",name:"justifyContent",static:!1,private:!1,access:{has:t=>"justifyContent"in t,get:t=>t.justifyContent,set:(t,e)=>{t.justifyContent=e}},metadata:t},T,z),o(this,null,g,{kind:"accessor",name:"alignItems",static:!1,private:!1,access:{has:t=>"alignItems"in t,get:t=>t.alignItems,set:(t,e)=>{t.alignItems=e}},metadata:t},O,R),o(this,null,p,{kind:"accessor",name:"boxSizing",static:!1,private:!1,access:{has:t=>"boxSizing"in t,get:t=>t.boxSizing,set:(t,e)=>{t.boxSizing=e}},metadata:t},I,M),t&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:t})}#t=c(this,m,"0");get padding(){return this.#t}set padding(t){this.#t=t}#e=(c(this,_),c(this,y,"auto"));get minWidth(){return this.#e}set minWidth(t){this.#e=t}#s=(c(this,f),c(this,v,"auto"));get maxWidth(){return this.#s}set maxWidth(t){this.#s=t}#i=(c(this,x),c(this,w,"100%"));get width(){return this.#i}set width(t){this.#i=t}#r=(c(this,S),c(this,$,"row"));get direction(){return this.#r}set direction(t){this.#r=t}#a=(c(this,C),c(this,W,void 0));get center(){return this.#a}set center(t){this.#a=t}#n=(c(this,j),c(this,A,void 0));get centerCenter(){return this.#n}set centerCenter(t){this.#n=t}#o=(c(this,k),c(this,T,"flex-start"));get justifyContent(){return this.#o}set justifyContent(t){this.#o=t}#c=(c(this,z),c(this,O,"flex-start"));get alignItems(){return this.#c}set alignItems(t){this.#c=t}#h=(c(this,R),c(this,I,"border-box"));get boxSizing(){return this.#h}set boxSizing(t){this.#h=t}render(){return t`
2
- <style>
3
- :host {
4
- display: flex;
5
- box-sizing: var(--flex-display-box-sizing, ${this.boxSizing});
6
- max-width: var(--flex-display-max-width, ${this.maxWidth});
7
- min-width: var(--flex-display-min-width, ${this.minWidth});
8
- width: var(--flex-display-width, ${this.width});
9
- flex-direction: var(--flex-display-direction, ${this.direction});
10
- justify-content: var(
11
- --flex-display-justify-content,
12
- ${this.justifyContent}
13
- );
14
- align-items: var(--flex-display-align-items, ${this.alignItems});
15
- padding: var(--flex-display-padding, ${this.padding});
16
- }
17
-
18
- :host([center]) {
19
- align-items: center;
20
- }
21
-
22
- :host([center-center]) {
23
- align-items: center;
24
- justify-content: center;
25
- }
26
- </style>
27
- <slot></slot>
28
- `}constructor(){super(...arguments),c(this,M)}}})();customElements.define("flex-row",class FlexRow extends h{constructor(){super(),this.direction="row",this.width="auto"}});export{h as F};
@@ -1 +0,0 @@
1
- class SimpleHashRouter{routes;constructor({host:t,fallback:s,routes:e}){this.host=t,this.routes=e,globalThis.onhashchange=this.#t,!location.hash&&s?.route?location.hash=HashRouter.bang(s.params?`${s.route}?${HashRouter.queryIt(s.params)}`:s.route):this.#t()}static queryIt(t){return Object.entries(t).map((([t,s])=>`${t}=${s}`)).join("&")}static dequeryIt(t){const s={};if(!t)return s;for(const e of t.split("&")){const[t,o]=e.split("=");s[t]=o}}static bang(t){return`#!/${t}`}static debang(t){return t.split("#!/")[1]}static parseHash(t){const s=HashRouter.debang(t).split("?"),e=s[0].split("/"),o=e[0],a=e.slice(1,-1);return{route:o,routes:e,subRoutes:a,params:HashRouter.dequeryIt(s[1]),url:s[0]}}#s=async(t,s)=>{const{params:e,subRoutes:o}=t;let a=this.host.pages.querySelector(".custom-selected");if(t.subRoutes?.length>0)for(const r of t.subRoutes){const u=s.subRoutes[r];u?customElements.get(`./${u.tagName}`)||await import(`./${u.import}.js`):(customElements.get(`./${r}`)||await import(`./${r}.js`),console.warn(`handling undefined subroute for ${t.route} falling back to default behavior.`)),a.select({route:r,params:e,subRoutes:o}),a=a.pages.querySelector(".custom-selected")}if(e)for(const[t,s]of Object.entries(e))a[t]=s};#t=async()=>{const t=HashRouter.parseHash(location.hash),s=this.routes[t.url];s?customElements.get(`./${s.tagName}`)||await import(`./${s.import}.js`):customElements.get(`./${t.route}`)||await import(`./${t.route}.js`),this.host.select(t),this.host.pages&&this.#s(t,s),document.dispatchEvent(new CustomEvent("route-change",{detail:{routing:t,routeInfo:s}}))};go(t,s){}}export{SimpleHashRouter as default};
@@ -1 +0,0 @@
1
-
@@ -1,341 +0,0 @@
1
- import { LiteElement } from '@vandeurenglenn/lite';
2
- export declare const FileReaderMixin: (Base: typeof LiteElement) => {
3
- new (): {
4
- readAsDataURL(file: any): Promise<unknown>;
5
- renderResolve: any;
6
- renderedOnce: boolean;
7
- rendered: Promise<unknown>;
8
- attributeChangedCallback(name: string, old: string, value: string): void;
9
- render(): import("lit-html").TemplateResult<1>;
10
- requestRender(): void;
11
- willChange?(propertyKey: string, value: any): Promise<any>;
12
- onChange?(propertyKey: string, value: any): void;
13
- firstRender?(): void;
14
- accessKey: string;
15
- readonly accessKeyLabel: string;
16
- autocapitalize: string;
17
- dir: string;
18
- draggable: boolean;
19
- hidden: boolean;
20
- inert: boolean;
21
- innerText: string;
22
- lang: string;
23
- readonly offsetHeight: number;
24
- readonly offsetLeft: number;
25
- readonly offsetParent: Element;
26
- readonly offsetTop: number;
27
- readonly offsetWidth: number;
28
- outerText: string;
29
- popover: string;
30
- spellcheck: boolean;
31
- title: string;
32
- translate: boolean;
33
- attachInternals(): ElementInternals;
34
- click(): void;
35
- hidePopover(): void;
36
- showPopover(): void;
37
- togglePopover(force?: boolean): boolean;
38
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
39
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
40
- removeEventListener<K_1 extends keyof HTMLElementEventMap>(type: K_1, listener: (this: HTMLElement, ev: HTMLElementEventMap[K_1]) => any, options?: boolean | EventListenerOptions): void;
41
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
42
- readonly attributes: NamedNodeMap;
43
- readonly classList: DOMTokenList;
44
- className: string;
45
- readonly clientHeight: number;
46
- readonly clientLeft: number;
47
- readonly clientTop: number;
48
- readonly clientWidth: number;
49
- id: string;
50
- readonly localName: string;
51
- readonly namespaceURI: string;
52
- onfullscreenchange: (this: Element, ev: Event) => any;
53
- onfullscreenerror: (this: Element, ev: Event) => any;
54
- outerHTML: string;
55
- readonly ownerDocument: Document;
56
- readonly part: DOMTokenList;
57
- readonly prefix: string;
58
- readonly scrollHeight: number;
59
- scrollLeft: number;
60
- scrollTop: number;
61
- readonly scrollWidth: number;
62
- readonly shadowRoot: ShadowRoot;
63
- slot: string;
64
- readonly tagName: string;
65
- attachShadow(init: ShadowRootInit): ShadowRoot;
66
- checkVisibility(options?: CheckVisibilityOptions): boolean;
67
- closest<K_2 extends keyof HTMLElementTagNameMap>(selector: K_2): HTMLElementTagNameMap[K_2];
68
- closest<K_3 extends keyof SVGElementTagNameMap>(selector: K_3): SVGElementTagNameMap[K_3];
69
- closest<K_4 extends keyof MathMLElementTagNameMap>(selector: K_4): MathMLElementTagNameMap[K_4];
70
- closest<E extends Element = Element>(selectors: string): E;
71
- computedStyleMap(): StylePropertyMapReadOnly;
72
- getAttribute(qualifiedName: string): string;
73
- getAttributeNS(namespace: string, localName: string): string;
74
- getAttributeNames(): string[];
75
- getAttributeNode(qualifiedName: string): Attr;
76
- getAttributeNodeNS(namespace: string, localName: string): Attr;
77
- getBoundingClientRect(): DOMRect;
78
- getClientRects(): DOMRectList;
79
- getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;
80
- getElementsByTagName<K_5 extends keyof HTMLElementTagNameMap>(qualifiedName: K_5): HTMLCollectionOf<HTMLElementTagNameMap[K_5]>;
81
- getElementsByTagName<K_6 extends keyof SVGElementTagNameMap>(qualifiedName: K_6): HTMLCollectionOf<SVGElementTagNameMap[K_6]>;
82
- getElementsByTagName<K_7 extends keyof MathMLElementTagNameMap>(qualifiedName: K_7): HTMLCollectionOf<MathMLElementTagNameMap[K_7]>;
83
- getElementsByTagName<K_8 extends keyof HTMLElementDeprecatedTagNameMap>(qualifiedName: K_8): HTMLCollectionOf<HTMLElementDeprecatedTagNameMap[K_8]>;
84
- getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
85
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
86
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
87
- getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf<MathMLElement>;
88
- getElementsByTagNameNS(namespace: string, localName: string): HTMLCollectionOf<Element>;
89
- hasAttribute(qualifiedName: string): boolean;
90
- hasAttributeNS(namespace: string, localName: string): boolean;
91
- hasAttributes(): boolean;
92
- hasPointerCapture(pointerId: number): boolean;
93
- insertAdjacentElement(where: InsertPosition, element: Element): Element;
94
- insertAdjacentHTML(position: InsertPosition, text: string): void;
95
- insertAdjacentText(where: InsertPosition, data: string): void;
96
- matches(selectors: string): boolean;
97
- releasePointerCapture(pointerId: number): void;
98
- removeAttribute(qualifiedName: string): void;
99
- removeAttributeNS(namespace: string, localName: string): void;
100
- removeAttributeNode(attr: Attr): Attr;
101
- requestFullscreen(options?: FullscreenOptions): Promise<void>;
102
- requestPointerLock(): void;
103
- scroll(options?: ScrollToOptions): void;
104
- scroll(x: number, y: number): void;
105
- scrollBy(options?: ScrollToOptions): void;
106
- scrollBy(x: number, y: number): void;
107
- scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void;
108
- scrollTo(options?: ScrollToOptions): void;
109
- scrollTo(x: number, y: number): void;
110
- setAttribute(qualifiedName: string, value: string): void;
111
- setAttributeNS(namespace: string, qualifiedName: string, value: string): void;
112
- setAttributeNode(attr: Attr): Attr;
113
- setAttributeNodeNS(attr: Attr): Attr;
114
- setPointerCapture(pointerId: number): void;
115
- toggleAttribute(qualifiedName: string, force?: boolean): boolean;
116
- webkitMatchesSelector(selectors: string): boolean;
117
- readonly baseURI: string;
118
- readonly childNodes: NodeListOf<ChildNode>;
119
- readonly firstChild: ChildNode;
120
- readonly isConnected: boolean;
121
- readonly lastChild: ChildNode;
122
- readonly nextSibling: ChildNode;
123
- readonly nodeName: string;
124
- readonly nodeType: number;
125
- nodeValue: string;
126
- readonly parentElement: HTMLElement;
127
- readonly parentNode: ParentNode;
128
- readonly previousSibling: ChildNode;
129
- textContent: string;
130
- appendChild<T extends Node>(node: T): T;
131
- cloneNode(deep?: boolean): Node;
132
- compareDocumentPosition(other: Node): number;
133
- contains(other: Node): boolean;
134
- getRootNode(options?: GetRootNodeOptions): Node;
135
- hasChildNodes(): boolean;
136
- insertBefore<T_1 extends Node>(node: T_1, child: Node): T_1;
137
- isDefaultNamespace(namespace: string): boolean;
138
- isEqualNode(otherNode: Node): boolean;
139
- isSameNode(otherNode: Node): boolean;
140
- lookupNamespaceURI(prefix: string): string;
141
- lookupPrefix(namespace: string): string;
142
- normalize(): void;
143
- removeChild<T_2 extends Node>(child: T_2): T_2;
144
- replaceChild<T_3 extends Node>(node: Node, child: T_3): T_3;
145
- readonly ELEMENT_NODE: 1;
146
- readonly ATTRIBUTE_NODE: 2;
147
- readonly TEXT_NODE: 3;
148
- readonly CDATA_SECTION_NODE: 4;
149
- readonly ENTITY_REFERENCE_NODE: 5;
150
- readonly ENTITY_NODE: 6;
151
- readonly PROCESSING_INSTRUCTION_NODE: 7;
152
- readonly COMMENT_NODE: 8;
153
- readonly DOCUMENT_NODE: 9;
154
- readonly DOCUMENT_TYPE_NODE: 10;
155
- readonly DOCUMENT_FRAGMENT_NODE: 11;
156
- readonly NOTATION_NODE: 12;
157
- readonly DOCUMENT_POSITION_DISCONNECTED: 1;
158
- readonly DOCUMENT_POSITION_PRECEDING: 2;
159
- readonly DOCUMENT_POSITION_FOLLOWING: 4;
160
- readonly DOCUMENT_POSITION_CONTAINS: 8;
161
- readonly DOCUMENT_POSITION_CONTAINED_BY: 16;
162
- readonly DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: 32;
163
- dispatchEvent(event: Event): boolean;
164
- ariaAtomic: string;
165
- ariaAutoComplete: string;
166
- ariaBusy: string;
167
- ariaChecked: string;
168
- ariaColCount: string;
169
- ariaColIndex: string;
170
- ariaColSpan: string;
171
- ariaCurrent: string;
172
- ariaDescription: string;
173
- ariaDisabled: string;
174
- ariaExpanded: string;
175
- ariaHasPopup: string;
176
- ariaHidden: string;
177
- ariaInvalid: string;
178
- ariaKeyShortcuts: string;
179
- ariaLabel: string;
180
- ariaLevel: string;
181
- ariaLive: string;
182
- ariaModal: string;
183
- ariaMultiLine: string;
184
- ariaMultiSelectable: string;
185
- ariaOrientation: string;
186
- ariaPlaceholder: string;
187
- ariaPosInSet: string;
188
- ariaPressed: string;
189
- ariaReadOnly: string;
190
- ariaRequired: string;
191
- ariaRoleDescription: string;
192
- ariaRowCount: string;
193
- ariaRowIndex: string;
194
- ariaRowSpan: string;
195
- ariaSelected: string;
196
- ariaSetSize: string;
197
- ariaSort: string;
198
- ariaValueMax: string;
199
- ariaValueMin: string;
200
- ariaValueNow: string;
201
- ariaValueText: string;
202
- role: string;
203
- animate(keyframes: Keyframe[] | PropertyIndexedKeyframes, options?: number | KeyframeAnimationOptions): Animation;
204
- getAnimations(options?: GetAnimationsOptions): Animation[];
205
- after(...nodes: (string | Node)[]): void;
206
- before(...nodes: (string | Node)[]): void;
207
- remove(): void;
208
- replaceWith(...nodes: (string | Node)[]): void;
209
- innerHTML: string;
210
- readonly nextElementSibling: Element;
211
- readonly previousElementSibling: Element;
212
- readonly childElementCount: number;
213
- readonly children: HTMLCollection;
214
- readonly firstElementChild: Element;
215
- readonly lastElementChild: Element;
216
- append(...nodes: (string | Node)[]): void;
217
- prepend(...nodes: (string | Node)[]): void;
218
- querySelector<K_9 extends keyof HTMLElementTagNameMap>(selectors: K_9): HTMLElementTagNameMap[K_9];
219
- querySelector<K_10 extends keyof SVGElementTagNameMap>(selectors: K_10): SVGElementTagNameMap[K_10];
220
- querySelector<K_11 extends keyof MathMLElementTagNameMap>(selectors: K_11): MathMLElementTagNameMap[K_11];
221
- querySelector<K_12 extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K_12): HTMLElementDeprecatedTagNameMap[K_12];
222
- querySelector<E_1 extends Element = Element>(selectors: string): E_1;
223
- querySelectorAll<K_13 extends keyof HTMLElementTagNameMap>(selectors: K_13): NodeListOf<HTMLElementTagNameMap[K_13]>;
224
- querySelectorAll<K_14 extends keyof SVGElementTagNameMap>(selectors: K_14): NodeListOf<SVGElementTagNameMap[K_14]>;
225
- querySelectorAll<K_15 extends keyof MathMLElementTagNameMap>(selectors: K_15): NodeListOf<MathMLElementTagNameMap[K_15]>;
226
- querySelectorAll<K_16 extends keyof HTMLElementDeprecatedTagNameMap>(selectors: K_16): NodeListOf<HTMLElementDeprecatedTagNameMap[K_16]>;
227
- querySelectorAll<E_2 extends Element = Element>(selectors: string): NodeListOf<E_2>;
228
- replaceChildren(...nodes: (string | Node)[]): void;
229
- readonly assignedSlot: HTMLSlotElement;
230
- readonly attributeStyleMap: StylePropertyMap;
231
- readonly style: CSSStyleDeclaration;
232
- contentEditable: string;
233
- enterKeyHint: string;
234
- inputMode: string;
235
- readonly isContentEditable: boolean;
236
- onabort: (this: GlobalEventHandlers, ev: UIEvent) => any;
237
- onanimationcancel: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
238
- onanimationend: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
239
- onanimationiteration: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
240
- onanimationstart: (this: GlobalEventHandlers, ev: AnimationEvent) => any;
241
- onauxclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
242
- onbeforeinput: (this: GlobalEventHandlers, ev: InputEvent) => any;
243
- onbeforetoggle: (this: GlobalEventHandlers, ev: Event) => any;
244
- onblur: (this: GlobalEventHandlers, ev: FocusEvent) => any;
245
- oncancel: (this: GlobalEventHandlers, ev: Event) => any;
246
- oncanplay: (this: GlobalEventHandlers, ev: Event) => any;
247
- oncanplaythrough: (this: GlobalEventHandlers, ev: Event) => any;
248
- onchange: (this: GlobalEventHandlers, ev: Event) => any;
249
- onclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
250
- onclose: (this: GlobalEventHandlers, ev: Event) => any;
251
- oncontextmenu: (this: GlobalEventHandlers, ev: MouseEvent) => any;
252
- oncopy: (this: GlobalEventHandlers, ev: ClipboardEvent) => any;
253
- oncuechange: (this: GlobalEventHandlers, ev: Event) => any;
254
- oncut: (this: GlobalEventHandlers, ev: ClipboardEvent) => any;
255
- ondblclick: (this: GlobalEventHandlers, ev: MouseEvent) => any;
256
- ondrag: (this: GlobalEventHandlers, ev: DragEvent) => any;
257
- ondragend: (this: GlobalEventHandlers, ev: DragEvent) => any;
258
- ondragenter: (this: GlobalEventHandlers, ev: DragEvent) => any;
259
- ondragleave: (this: GlobalEventHandlers, ev: DragEvent) => any;
260
- ondragover: (this: GlobalEventHandlers, ev: DragEvent) => any;
261
- ondragstart: (this: GlobalEventHandlers, ev: DragEvent) => any;
262
- ondrop: (this: GlobalEventHandlers, ev: DragEvent) => any;
263
- ondurationchange: (this: GlobalEventHandlers, ev: Event) => any;
264
- onemptied: (this: GlobalEventHandlers, ev: Event) => any;
265
- onended: (this: GlobalEventHandlers, ev: Event) => any;
266
- onerror: OnErrorEventHandlerNonNull;
267
- onfocus: (this: GlobalEventHandlers, ev: FocusEvent) => any;
268
- onformdata: (this: GlobalEventHandlers, ev: FormDataEvent) => any;
269
- ongotpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any;
270
- oninput: (this: GlobalEventHandlers, ev: Event) => any;
271
- oninvalid: (this: GlobalEventHandlers, ev: Event) => any;
272
- onkeydown: (this: GlobalEventHandlers, ev: KeyboardEvent) => any;
273
- onkeypress: (this: GlobalEventHandlers, ev: KeyboardEvent) => any;
274
- onkeyup: (this: GlobalEventHandlers, ev: KeyboardEvent) => any;
275
- onload: (this: GlobalEventHandlers, ev: Event) => any;
276
- onloadeddata: (this: GlobalEventHandlers, ev: Event) => any;
277
- onloadedmetadata: (this: GlobalEventHandlers, ev: Event) => any;
278
- onloadstart: (this: GlobalEventHandlers, ev: Event) => any;
279
- onlostpointercapture: (this: GlobalEventHandlers, ev: PointerEvent) => any;
280
- onmousedown: (this: GlobalEventHandlers, ev: MouseEvent) => any;
281
- onmouseenter: (this: GlobalEventHandlers, ev: MouseEvent) => any;
282
- onmouseleave: (this: GlobalEventHandlers, ev: MouseEvent) => any;
283
- onmousemove: (this: GlobalEventHandlers, ev: MouseEvent) => any;
284
- onmouseout: (this: GlobalEventHandlers, ev: MouseEvent) => any;
285
- onmouseover: (this: GlobalEventHandlers, ev: MouseEvent) => any;
286
- onmouseup: (this: GlobalEventHandlers, ev: MouseEvent) => any;
287
- onpaste: (this: GlobalEventHandlers, ev: ClipboardEvent) => any;
288
- onpause: (this: GlobalEventHandlers, ev: Event) => any;
289
- onplay: (this: GlobalEventHandlers, ev: Event) => any;
290
- onplaying: (this: GlobalEventHandlers, ev: Event) => any;
291
- onpointercancel: (this: GlobalEventHandlers, ev: PointerEvent) => any;
292
- onpointerdown: (this: GlobalEventHandlers, ev: PointerEvent) => any;
293
- onpointerenter: (this: GlobalEventHandlers, ev: PointerEvent) => any;
294
- onpointerleave: (this: GlobalEventHandlers, ev: PointerEvent) => any;
295
- onpointermove: (this: GlobalEventHandlers, ev: PointerEvent) => any;
296
- onpointerout: (this: GlobalEventHandlers, ev: PointerEvent) => any;
297
- onpointerover: (this: GlobalEventHandlers, ev: PointerEvent) => any;
298
- onpointerup: (this: GlobalEventHandlers, ev: PointerEvent) => any;
299
- onprogress: (this: GlobalEventHandlers, ev: ProgressEvent<EventTarget>) => any;
300
- onratechange: (this: GlobalEventHandlers, ev: Event) => any;
301
- onreset: (this: GlobalEventHandlers, ev: Event) => any;
302
- onresize: (this: GlobalEventHandlers, ev: UIEvent) => any;
303
- onscroll: (this: GlobalEventHandlers, ev: Event) => any;
304
- onscrollend: (this: GlobalEventHandlers, ev: Event) => any;
305
- onsecuritypolicyviolation: (this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any;
306
- onseeked: (this: GlobalEventHandlers, ev: Event) => any;
307
- onseeking: (this: GlobalEventHandlers, ev: Event) => any;
308
- onselect: (this: GlobalEventHandlers, ev: Event) => any;
309
- onselectionchange: (this: GlobalEventHandlers, ev: Event) => any;
310
- onselectstart: (this: GlobalEventHandlers, ev: Event) => any;
311
- onslotchange: (this: GlobalEventHandlers, ev: Event) => any;
312
- onstalled: (this: GlobalEventHandlers, ev: Event) => any;
313
- onsubmit: (this: GlobalEventHandlers, ev: SubmitEvent) => any;
314
- onsuspend: (this: GlobalEventHandlers, ev: Event) => any;
315
- ontimeupdate: (this: GlobalEventHandlers, ev: Event) => any;
316
- ontoggle: (this: GlobalEventHandlers, ev: Event) => any;
317
- ontouchcancel?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
318
- ontouchend?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
319
- ontouchmove?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
320
- ontouchstart?: (this: GlobalEventHandlers, ev: TouchEvent) => any;
321
- ontransitioncancel: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
322
- ontransitionend: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
323
- ontransitionrun: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
324
- ontransitionstart: (this: GlobalEventHandlers, ev: TransitionEvent) => any;
325
- onvolumechange: (this: GlobalEventHandlers, ev: Event) => any;
326
- onwaiting: (this: GlobalEventHandlers, ev: Event) => any;
327
- onwebkitanimationend: (this: GlobalEventHandlers, ev: Event) => any;
328
- onwebkitanimationiteration: (this: GlobalEventHandlers, ev: Event) => any;
329
- onwebkitanimationstart: (this: GlobalEventHandlers, ev: Event) => any;
330
- onwebkittransitionend: (this: GlobalEventHandlers, ev: Event) => any;
331
- onwheel: (this: GlobalEventHandlers, ev: WheelEvent) => any;
332
- autofocus: boolean;
333
- readonly dataset: DOMStringMap;
334
- nonce?: string;
335
- tabIndex: number;
336
- blur(): void;
337
- focus(options?: FocusOptions): void;
338
- };
339
- readonly observedAttributes: any;
340
- styles?: import("lit").CSSResultGroup;
341
- };
@@ -1,45 +0,0 @@
1
- import { CustomPages } from '../elements.js';
2
- /**
3
- * @example
4
- * {
5
- * tagName: 'home-view',
6
- * import: './views/home',
7
- * subRoutes: [
8
- * 'home/one' : {
9
- * tagName: 'home-view-one',
10
- * import: '...'
11
- * },
12
- * 'home/one/two' : {
13
- * tagName: 'home-two',
14
- * import: '...'
15
- * }]
16
- * }
17
- *
18
- */
19
- export type RouteInfo = {
20
- tagName: string;
21
- import: string;
22
- subRoutes?: {
23
- [route: string]: Omit<RouteInfo, 'subRoutes'>;
24
- };
25
- };
26
- export type RoutesOption = {
27
- [route: string]: RouteInfo;
28
- };
29
- export type HashRouterConstructorOptions = {
30
- host: RouteAble;
31
- fallback?: {
32
- route: string;
33
- params?: object;
34
- };
35
- routes?: RoutesOption;
36
- };
37
- export type RouteSelectInput = {
38
- route: string;
39
- subRoutes?: string[];
40
- params?: object;
41
- };
42
- export interface RouteAble extends HTMLElement {
43
- select: ({ route, subRoutes, params }: RouteSelectInput) => void;
44
- pages?: CustomPages;
45
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * @description
3
- * A hash based router meant to work together with custom-pages, custom-select etc
4
- *
5
- * @example
6
- * new HashRouter({
7
- * host: document.querySelector('app-shell'),
8
- * fallback: {route: 'home' params: {...}},
9
- * routes: [{
10
- * 'home': {
11
- * import: 'views/home.js'
12
- * }
13
- * }]
14
- * })
15
- *
16
- */
17
- class SimpleHashRouter {
18
- routes;
19
- constructor({ host, fallback, routes }) {
20
- this.host = host;
21
- this.routes = routes;
22
- globalThis.onhashchange = this.#onhashchange;
23
- if (!location.hash && fallback?.route) {
24
- location.hash = HashRouter.bang(fallback.params ? `${fallback.route}?${HashRouter.queryIt(fallback.params)}` : fallback.route);
25
- }
26
- else
27
- this.#onhashchange();
28
- }
29
- static queryIt(params) {
30
- return Object.entries(params)
31
- .map(([key, value]) => `${key}=${value}`)
32
- .join('&');
33
- }
34
- static dequeryIt(query) {
35
- const params = {};
36
- if (!query)
37
- return params;
38
- for (const item of query.split('&')) {
39
- const [key, value] = item.split('=');
40
- params[key] = value;
41
- }
42
- return;
43
- }
44
- static bang(route) {
45
- return `#!/${route}`;
46
- }
47
- static debang(route) {
48
- return route.split('#!/')[1];
49
- }
50
- static parseHash(hash) {
51
- const afterBang = HashRouter.debang(hash);
52
- const splitted = afterBang.split('?');
53
- const routes = splitted[0].split('/');
54
- const route = routes[0];
55
- const subRoutes = routes.slice(1, -1);
56
- const params = HashRouter.dequeryIt(splitted[1]);
57
- return { route, routes, subRoutes, params, url: splitted[0] };
58
- }
59
- #handleSubRoutes = async (routing, routeInfo) => {
60
- const { params, subRoutes } = routing;
61
- let selected = this.host.pages.querySelector('.custom-selected');
62
- if (routing.subRoutes?.length > 0) {
63
- for (const route of routing.subRoutes) {
64
- const subRouteInfo = routeInfo.subRoutes[route];
65
- if (subRouteInfo) {
66
- if (!customElements.get(`./${subRouteInfo.tagName}`))
67
- await import(`./${subRouteInfo.import}.js`);
68
- }
69
- else {
70
- if (!customElements.get(`./${route}`))
71
- await import(`./${route}.js`);
72
- console.warn(`handling undefined subroute for ${routing.route} falling back to default behavior.`);
73
- }
74
- selected.select({ route, params, subRoutes });
75
- selected = selected.pages.querySelector('.custom-selected');
76
- }
77
- }
78
- if (params) {
79
- for (const [key, value] of Object.entries(params)) {
80
- selected[key] = value;
81
- }
82
- }
83
- };
84
- #onhashchange = async () => {
85
- const routing = HashRouter.parseHash(location.hash);
86
- const routeInfo = this.routes[routing.url];
87
- // todo allow to set loading
88
- if (routeInfo) {
89
- if (!customElements.get(`./${routeInfo.tagName}`))
90
- await import(`./${routeInfo.import}.js`);
91
- }
92
- else {
93
- if (!customElements.get(`./${routing.route}`))
94
- await import(`./${routing.route}.js`);
95
- }
96
- this.host.select(routing);
97
- // when a custom-pages element (or sortlike) is defined loop trough subroutes and make devlife easier
98
- if (this.host.pages) {
99
- this.#handleSubRoutes(routing, routeInfo);
100
- }
101
- document.dispatchEvent(new CustomEvent('route-change', {
102
- detail: {
103
- routing,
104
- routeInfo
105
- }
106
- }));
107
- };
108
- go(route, params) { }
109
- }
110
-
111
- export { SimpleHashRouter as default };
package/exports/types2.js DELETED
@@ -1 +0,0 @@
1
-