rettangoli-ui 0.1.0-rc2 → 0.1.0-rc3

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 (51) hide show
  1. package/README.md +16 -27
  2. package/dist/rettangoli-iife-layout.min.js +98 -47
  3. package/dist/rettangoli-iife-ui.min.js +63 -64
  4. package/package.json +11 -4
  5. package/src/common/BaseElement.js +182 -0
  6. package/src/common.js +190 -0
  7. package/src/components/dialog/dialog.handlers.js +5 -0
  8. package/src/components/dialog/dialog.store.js +24 -0
  9. package/src/components/dialog/dialog.view.yaml +40 -0
  10. package/src/components/form/form.handlers.js +30 -0
  11. package/src/components/form/form.store.js +45 -0
  12. package/src/components/form/form.view.yaml +47 -0
  13. package/src/components/navbar/navbar.examples.yaml +86 -0
  14. package/src/components/navbar/navbar.handlers.js +10 -0
  15. package/src/components/navbar/navbar.store.js +46 -0
  16. package/src/components/navbar/navbar.view.yaml +74 -0
  17. package/src/components/pageOutline/pageOutline.handlers.js +69 -0
  18. package/src/components/pageOutline/pageOutline.store.js +40 -0
  19. package/src/components/pageOutline/pageOutline.view.yaml +34 -0
  20. package/src/components/popover/popover.handlers.js +17 -0
  21. package/src/components/popover/popover.store.js +37 -0
  22. package/src/components/popover/popover.view.yaml +50 -0
  23. package/src/components/select/select.handlers.js +15 -0
  24. package/src/components/select/select.store.js +25 -0
  25. package/src/components/select/select.view.yaml +38 -0
  26. package/src/components/sidebar/sidebar.handlers.js +36 -0
  27. package/src/components/sidebar/sidebar.store.js +125 -0
  28. package/src/components/sidebar/sidebar.view.yaml +186 -0
  29. package/src/entry-iife-layout.js +15 -0
  30. package/src/entry-iife-ui.js +18 -0
  31. package/src/index.js +17 -0
  32. package/src/lib/uhtml.js +9 -0
  33. package/src/primitives/button.js +263 -0
  34. package/src/primitives/image.js +234 -0
  35. package/src/primitives/input.js +208 -0
  36. package/src/primitives/svg.js +95 -0
  37. package/src/primitives/text.js +141 -0
  38. package/src/primitives/textarea.js +103 -0
  39. package/src/primitives/view.js +215 -0
  40. package/src/setup.js +16 -0
  41. package/src/styles/anchorStyles.js +13 -0
  42. package/src/styles/buttonMarginStyles.js +84 -0
  43. package/src/styles/cursorStyles.js +12 -0
  44. package/src/styles/flexChildStyles.js +43 -0
  45. package/src/styles/flexDirectionStyles.js +74 -0
  46. package/src/styles/marginStyles.js +13 -0
  47. package/src/styles/paddingSvgStyles.js +120 -0
  48. package/src/styles/scrollStyles.js +22 -0
  49. package/src/styles/textColorStyles.js +14 -0
  50. package/src/styles/textStyles.js +62 -0
  51. package/src/styles/viewStyles.js +119 -0
package/README.md CHANGED
@@ -9,6 +9,8 @@ The following:
9
9
  * rtgl-image
10
10
  * rtgl-svg
11
11
  * rtgl-button
12
+ * rtgl-input
13
+ * rtgl-textarea
12
14
 
13
15
  All UI components should be able to be built from the above primitives
14
16
 
@@ -17,44 +19,31 @@ All UI components should be able to be built from the above primitives
17
19
 
18
20
  ### Install dependencies
19
21
 
20
- ```
21
- bun install
22
- ```
23
-
24
- ### Generate test screens
25
22
 
26
- Generate all test screens
27
23
 
24
+ ```bash
25
+ bun install
28
26
  ```
29
- bun run esbuild
30
- bun run ./viz/cli.js generate
31
- bunx serve ./viz/_site
32
- ```
33
-
34
- Visit your browser at http://localhost:3000/view
35
27
 
36
- It should show you all the test cases for View compoenent, and can navigate to other components on the left sidebar
37
28
 
38
- ### Report
39
29
 
40
- Make sure the run `generate` first
41
- ```
42
- bun run ./viz/cli.js report
43
- ```
44
-
45
- Visit your browser at http://localhost:3000/report (make sure you're still serving the `./viz/_site` folder)
46
30
 
47
- This will compare any changes between current version and the `gold` version screenshots
31
+ ### Generate test screens
48
32
 
49
- ### Accept
33
+ Bundles the code to be used for `rettangoli-vt`
50
34
 
51
- ```
52
- bun run ./viz/cli.js accept
35
+ ```bash
36
+ bun run build:dev
53
37
  ```
54
38
 
55
- Updates the `gold` version screenshots with the current version.
56
-
57
- Run this after you have made sure that the report is what you expect
39
+ Uses `rettangoli-vt` to generates test screens
58
40
 
41
+ ```bash
42
+ bun run ../rettangoli-cli/cli.js vt generate --skip-screenshots
43
+ ```
59
44
 
45
+ You can then access the generates screens
60
46
 
47
+ ```bash
48
+ bunx serve ./viz/_site
49
+ ```
@@ -1,24 +1,24 @@
1
- var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(t[a]||"")}),i}var G=["xs","sm","md","lg","xl"],D={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap",gv:"row-gap",gh:"column-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",ta:"text-align",c:"color",cur:"cursor"},S=Object.keys(D),_=e=>e.concat(G.flatMap(t=>e.map(i=>`${t}-${i}`))),T={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},p=(e,t={})=>{let i="";for(let[r,a]of Object.entries(T)){r!=="default"&&(i+=`${a} {`);for(let[s,l]of Object.entries(e)){let h=t[s]?` ${t[s]} `:" ";for(let[c,d]of Object.entries(l)){let m=D[s],u=d.startsWith("--")?`var(${d})`:d,v=r==="default"?s:`${r}-${s}`,O=r==="default"?`h-${s}`:`${r}-h-${s}`;if(m){let W=m.split(" ").map(R=>`${R}: ${u};`).join(" ");i+=`
2
- :host([${v}="${c}"])${h}{
3
- ${W}
1
+ var rettangoli=(()=>{function l(e,...t){let s="";return e.forEach((r,d)=>{s+=r+(t[d]||"")}),s}var X=["xs","sm","md","lg","xl"],I={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap",gv:"row-gap",gh:"column-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",ta:"text-align",c:"color",cur:"cursor"},y=Object.keys(I),x=e=>e.concat(X.flatMap(t=>e.map(s=>`${t}-${s}`))),V={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},p=(e,t={})=>{let s="";for(let[r,d]of Object.entries(V)){r!=="default"&&(s+=`${d} {`);for(let[i,n]of Object.entries(e)){let a=t[i]?` ${t[i]} `:" ";for(let[c,h]of Object.entries(n)){let u=I[i],f=h.startsWith("--")?`var(${h})`:h,v=r==="default"?i:`${r}-${i}`,T=r==="default"?`h-${i}`:`${r}-h-${i}`;if(u){let D=u.split(" ").map(J=>`${J}: ${f};`).join(" ");s+=`
2
+ :host([${v}="${c}"])${a}{
3
+ ${D}
4
4
  }
5
- :host([${O}="${c}"]:hover)${h}{
6
- ${W}
5
+ :host([${T}="${c}"]:hover)${a}{
6
+ ${D}
7
7
  }
8
- `}else i+=`
9
- :host([${v}="${c}"])${h}{
10
- ${d}
8
+ `}else s+=`
9
+ :host([${v}="${c}"])${a}{
10
+ ${h}
11
11
  }
12
- :host([${O}="${c}"]:hover)${h}{
13
- ${d}
12
+ :host([${T}="${c}"]:hover)${a}{
13
+ ${h}
14
14
  }
15
- `}}r!=="default"&&(i+="}")}return i};function q(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var F=e=>/%$/.test(e),g=e=>{if(e!==void 0)return F(e)?e:q(e)?`${e}px`:Object.keys(o).includes(e)?`var(${o[e]})`:e},o={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function E(e,t=":host"){let i="";for(let[r,a]of Object.entries(T)){r!=="default"&&(i+=`${a} {
16
- `);let s="";for(let[l,h]of Object.entries(e[r]))h!=null&&(s+=`${l}: ${h};
17
- `);i+=`${t} {
18
- ${s.trim()}
15
+ `}}r!=="default"&&(s+="}")}return s};function Y(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var Z=e=>/%$/.test(e),g=e=>{if(e!==void 0)return Z(e)?e:Y(e)?`${e}px`:Object.keys(o).includes(e)?`var(${o[e]})`:e},o={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function w(e,t=":host"){let s="";for(let[r,d]of Object.entries(V)){r!=="default"&&(s+=`${d} {
16
+ `);let i="";for(let[n,a]of Object.entries(e[r]))a!=null&&(i+=`${n}: ${a};
17
+ `);s+=`${t} {
18
+ ${i.trim()}
19
19
  }
20
- `,r!=="default"&&(i+=`}
21
- `)}return i}var b=n`
20
+ `,r!=="default"&&(s+=`}
21
+ `)}return s}var S=l`
22
22
  :host([flex="0"]) {
23
23
  flex: 0;
24
24
  }
@@ -58,7 +58,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
58
58
  :host([flex="12"]) {
59
59
  flex: 12;
60
60
  }
61
- `;var J={mt:o,mr:o,mb:o,ml:o,m:o,mh:o,mv:o,s:{sm:`
61
+ `;var tt={mt:o,mr:o,mb:o,ml:o,m:o,mh:o,mv:o,s:{sm:`
62
62
  height: 28px;
63
63
  padding-left: 12px;
64
64
  padding-right: 12px;
@@ -104,7 +104,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
104
104
  `,lk:`
105
105
  background-color: transparent;
106
106
  color: var(--foreground);
107
- `}},X={mt:"button",mr:"button",mb:"button",ml:"button",m:"button",mh:"button",mv:"button",s:"button",v:"button"},B=p(J,X);var y=n`
107
+ `}},et={mt:"button",mr:"button",mb:"button",ml:"button",m:"button",mh:"button",mv:"button",s:"button",v:"button"},L=p(tt,et);var _=l`
108
108
  a, a:link, a:visited, a:hover, a:active {
109
109
  color: inherit;
110
110
  text-decoration: none;
@@ -114,7 +114,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
114
114
  margin: 0;
115
115
  font: inherit;
116
116
  }
117
- `;var A=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(n`
117
+ `;var $=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
118
118
  :host {
119
119
  display: contents;
120
120
  }
@@ -228,15 +228,15 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
228
228
  text-decoration: underline;
229
229
  }
230
230
 
231
- ${y}
231
+ ${_}
232
232
 
233
233
  a {
234
234
  display: contents;
235
235
  }
236
236
 
237
- ${B}
238
- ${b}
239
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._containerElement=null,this._buttonElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._iconElement=null,this._buttonElement.appendChild(this._slotElement)}static get observedAttributes(){return["key","href","target","w","t","icon","disabled","v","s"]}connectedCallback(){this._updateButton()}attributeChangedCallback(t,i,r){this._updateButton()}_updateButton(){this.shadow.innerHTML="",this._updateIcon(),this._updateWidth(),this.hasAttribute("disabled")?this._buttonElement.setAttribute("disabled",""):this._buttonElement.removeAttribute("disabled");let i=this.getAttribute("href");if(i){let r=document.createElement("a");r.setAttribute("href",i);let a=this.getAttribute("target");a&&r.setAttribute("target",a),r.appendChild(this._buttonElement),this.shadow.appendChild(r),this._containerElement=r}else this.shadow.appendChild(this._buttonElement),this._containerElement=this._buttonElement}_updateIcon(){this._iconElement&&(this._iconElement.remove(),this._iconElement=null);let t=this.getAttribute("icon");if(t){let i={pr:"pr-fg",se:"ac-fg",de:"pr-fg",ol:"ac-fg",gh:"ac-fg",lk:"ac-fg"},r={sm:14,md:18,lg:22},a=i[this.getAttribute("v")]||"pr-fg",s=r[this.getAttribute("t")]||18;this._iconElement=document.createElement("rtgl-svg"),this._iconElement.setAttribute("svg",t),this._iconElement.setAttribute("c",a),this._iconElement.setAttribute("wh",s.toString()),this._buttonElement.insertBefore(this._iconElement,this._slotElement)}}_updateWidth(){let t=g(this.getAttribute("w"));t==="f"?this._buttonElement.style.width="var(--width-stretch)":t!=null?(this._buttonElement.style.width=t,this._buttonElement.style.minWidth=t,this._buttonElement.style.maxWidth=t):(this._buttonElement.style.width="",this._buttonElement.style.minWidth="",this._buttonElement.style.maxWidth="")}},I=({render:e,html:t})=>A;var H=n`
237
+ ${L}
238
+ ${S}
239
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._containerElement=null,this._buttonElement=document.createElement("button"),this._slotElement=document.createElement("slot"),this._iconElement=null,this._buttonElement.appendChild(this._slotElement)}static get observedAttributes(){return["key","href","target","w","t","icon","disabled","v","s"]}connectedCallback(){this._updateButton()}attributeChangedCallback(t,s,r){this._updateButton()}_updateButton(){this.shadow.innerHTML="",this._updateIcon(),this._updateWidth(),this.hasAttribute("disabled")?this._buttonElement.setAttribute("disabled",""):this._buttonElement.removeAttribute("disabled");let s=this.getAttribute("href");if(s){let r=document.createElement("a");r.setAttribute("href",s);let d=this.getAttribute("target");d&&r.setAttribute("target",d),r.appendChild(this._buttonElement),this.shadow.appendChild(r),this._containerElement=r}else this.shadow.appendChild(this._buttonElement),this._containerElement=this._buttonElement}_updateIcon(){this._iconElement&&(this._iconElement.remove(),this._iconElement=null);let t=this.getAttribute("icon");if(t){let s={pr:"pr-fg",se:"ac-fg",de:"pr-fg",ol:"ac-fg",gh:"ac-fg",lk:"ac-fg"},r={sm:14,md:18,lg:22},d=s[this.getAttribute("v")]||"pr-fg",i=r[this.getAttribute("t")]||18;this._iconElement=document.createElement("rtgl-svg"),this._iconElement.setAttribute("svg",t),this._iconElement.setAttribute("c",d),this._iconElement.setAttribute("wh",i.toString()),this._buttonElement.insertBefore(this._iconElement,this._slotElement)}}_updateWidth(){let t=g(this.getAttribute("w"));t==="f"?this._buttonElement.style.width="var(--width-stretch)":t!=null?(this._buttonElement.style.width=t,this._buttonElement.style.minWidth=t,this._buttonElement.style.maxWidth=t):(this._buttonElement.style.width="",this._buttonElement.style.minWidth="",this._buttonElement.style.maxWidth="")}},B=({render:e,html:t})=>$;var H=l`
240
240
 
241
241
  :host([d="h"]) {
242
242
  flex-direction: row;
@@ -307,7 +307,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
307
307
  justify-content: center;
308
308
  }
309
309
  }
310
- `;var Y={cur:{p:"pointer",m:"move",grab:"grab",grabbing:"grabbing"}},f=p(Y);var L=n`
310
+ `;var it={cur:{p:"pointer",m:"move",grab:"grab",grabbing:"grabbing"}},m=p(it);var U=l`
311
311
  :host([sh]:not([sv])) {
312
312
  overflow-x: scroll;
313
313
  flex-wrap: nowrap;
@@ -325,7 +325,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
325
325
  flex-wrap: nowrap;
326
326
  }
327
327
 
328
- `;var w={xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},Z={bgc:{pr:`
328
+ `;var E={xs:"--border-width-xs",sm:"--border-width-sm",md:"--border-width-md",lg:"--border-width-lg",xl:"--border-width-xl"},st={bgc:{pr:`
329
329
  background-color: var(--primary);
330
330
  `,se:`
331
331
  background-color: var(--secondary);
@@ -365,7 +365,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
365
365
  left: 0;
366
366
  top: 0;
367
367
  height: 100%;
368
- `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:o,pr:o,pb:o,pl:o,p:o,ph:o,pv:o,g:o,gv:o,gh:o,bw:w,bwt:w,bwr:w,bwb:w,bwl:w,bc:{p:"--color-primary",pc:"--color-primary-container",s:"--color-secondary",sc:"--color-secondary-container",e:"--color-error",ec:"--color-error-container",su:"--color-surface",sucl:"--color-surface-container-low",suc:"--color-surface-container",such:"--color-surface-container-high",isu:"--color-inverse-surface",o:"--color-outline",ov:"--color-outline-variant"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},k=p(Z);var tt={mt:o,mr:o,mb:o,ml:o,m:o,mh:o,mv:o},x=p(tt);var C=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(n`
368
+ `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:o,pr:o,pb:o,pl:o,p:o,ph:o,pv:o,g:o,gv:o,gh:o,bw:E,bwt:E,bwr:E,bwb:E,bwl:E,bc:{p:"--color-primary",pc:"--color-primary-container",s:"--color-secondary",sc:"--color-secondary-container",e:"--color-error",ec:"--color-error-container",su:"--color-surface",sucl:"--color-surface-container-low",suc:"--color-surface-container",such:"--color-surface-container-high",isu:"--color-inverse-surface",o:"--color-outline",ov:"--color-outline-variant"},br:{xs:"--border-radius-xs",sm:"--border-radius-sm",md:"--border-radius-md",lg:"--border-radius-lg",xl:"--border-radius-xl",f:"--border-radius-f"}},k=p(st);var rt={mt:o,mr:o,mb:o,ml:o,m:o,mh:o,mv:o},b=p(rt);var C=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
369
369
  slot {
370
370
  display: contents;
371
371
  }
@@ -384,13 +384,13 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
384
384
  flex-wrap: wrap;
385
385
  }
386
386
 
387
- ${b}
388
- ${L}
387
+ ${S}
388
+ ${U}
389
389
  ${H}
390
- ${x}
391
- ${f}
390
+ ${b}
391
+ ${m}
392
392
  ${k}
393
- ${y}
393
+ ${_}
394
394
 
395
395
  :host([href]) {
396
396
  cursor: pointer;
@@ -405,7 +405,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
405
405
  bottom: 0;
406
406
  z-index: 1;
407
407
  }
408
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._slotElement=document.createElement("slot"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return["href","target",..._([...S,"wh","w","h","hidden","sh","sv"])]}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),i=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,i?this._linkElement.target=i:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}attributeChangedCallback(t,i,r){if(t==="href"||t==="target"){this._updateDOM();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(s=>{let l=v=>`${s==="default"?"":`${s}-`}${v}`,h=this.getAttribute(l("wh")),c=g(h===null?this.getAttribute(l("w")):h),d=g(h===null?this.getAttribute(l("h")):h),m=this.getAttribute(l("op")),u=this.getAttribute(l("z"));u!==null&&(this._styles[s]["z-index"]=u),m!==null&&(this._styles[s].opacity=m),c==="f"?this._styles[s].width="var(--width-stretch)":c!==void 0&&(this._styles[s].width=c,this._styles[s]["min-width"]=c,this._styles[s]["max-width"]=c),d==="f"?this._styles[s].height="100%":d!==void 0&&(this._styles[s].height=d,this._styles[s]["min-height"]=d,this._styles[s]["max-height"]=d),this.hasAttribute(l("hidden"))&&(this._styles[s].display="none !important"),this.hasAttribute(l("visible"))&&(this._styles[s].display="flex !important")});let a=E(this._styles);a!==this._lastStyleString&&(this._styleElement.textContent=a,this._lastStyleString=a)}},V=({render:e,html:t})=>C;var et={ta:{s:"start",c:"center",e:"end",j:"justify"},s:{h1:`
408
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._slotElement=document.createElement("slot"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return["href","target",...x([...y,"wh","w","h","hidden","sh","sv"])]}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),s=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,s?this._linkElement.target=s:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}attributeChangedCallback(t,s,r){if(t==="href"||t==="target"){this._updateDOM();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let n=v=>`${i==="default"?"":`${i}-`}${v}`,a=this.getAttribute(n("wh")),c=g(a===null?this.getAttribute(n("w")):a),h=g(a===null?this.getAttribute(n("h")):a),u=this.getAttribute(n("op")),f=this.getAttribute(n("z"));f!==null&&(this._styles[i]["z-index"]=f),u!==null&&(this._styles[i].opacity=u),c==="f"?this._styles[i].width="var(--width-stretch)":c!==void 0&&(this._styles[i].width=c,this._styles[i]["min-width"]=c,this._styles[i]["max-width"]=c),h==="f"?this._styles[i].height="100%":h!==void 0&&(this._styles[i].height=h,this._styles[i]["min-height"]=h,this._styles[i]["max-height"]=h),this.hasAttribute(n("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(n("visible"))&&(this._styles[i].display="flex !important")});let d=w(this._styles);d!==this._lastStyleString&&(this._styleElement.textContent=d,this._lastStyleString=d)}},N=({render:e,html:t})=>C;var ot={ta:{s:"start",c:"center",e:"end",j:"justify"},s:{h1:`
409
409
  font-size: var(--h1-font-size);
410
410
  font-weight: var(--h1-font-weight);
411
411
  line-height: var(--h1-line-height);
@@ -445,7 +445,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
445
445
  font-weight: var(--xs-font-weight);
446
446
  line-height: var(--xs-line-height);
447
447
  letter-spacing: var(--xs-letter-spacing);
448
- `}},N=p(et);var it={c:{fg:"--foreground",de:"--destructive","pr-fg":"--primary-foreground","se-fg":"--secondary-foreground","mu-fg":"--muted-foreground","ac-fg":"--accent-foreground"}},$=p(it);var z=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(n`
448
+ `}},P=p(ot);var nt={c:{fg:"--foreground",de:"--destructive","pr-fg":"--primary-foreground","se-fg":"--secondary-foreground","mu-fg":"--muted-foreground","ac-fg":"--accent-foreground"}},A=p(nt);var z=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
449
449
  :host {
450
450
  display: block;
451
451
  font-size: var(--md-font-size);
@@ -476,11 +476,11 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
476
476
  bottom: 0;
477
477
  z-index: 1;
478
478
  }
479
- ${N}
480
- ${$}
481
- ${x}
482
- ${f}
483
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","target"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,i,r){t==="href"||t==="target"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=g(this.getAttribute("w"));this.hasAttribute("ellipsis")?(this.style.overflow="hidden",this.style.textOverflow="ellipsis",this.style.whiteSpace="nowrap"):(this.style.overflow="",this.style.textOverflow="",this.style.whiteSpace=""),t==="f"?this.style.width="var(--width-stretch)":t!==void 0?this.style.width=t:this.style.width=""}_updateDOM(){let t=this.getAttribute("href"),i=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,i?this._linkElement.target=i:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}},U=({render:e,html:t})=>z;var M=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(n`
479
+ ${P}
480
+ ${A}
481
+ ${b}
482
+ ${m}
483
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._slotElement=document.createElement("slot"),this._linkElement=null,this._updateDOM()}static get observedAttributes(){return["key","w","ellipsis","href","target"]}connectedCallback(){this._updateStyling(),this._updateDOM()}attributeChangedCallback(t,s,r){t==="href"||t==="target"?this._updateDOM():this._updateStyling()}_updateStyling(){let t=g(this.getAttribute("w"));this.hasAttribute("ellipsis")?(this.style.overflow="hidden",this.style.textOverflow="ellipsis",this.style.whiteSpace="nowrap"):(this.style.overflow="",this.style.textOverflow="",this.style.whiteSpace=""),t==="f"?this.style.width="var(--width-stretch)":t!==void 0?this.style.width=t:this.style.width=""}_updateDOM(){let t=this.getAttribute("href"),s=this.getAttribute("target");this._slotElement.parentNode!==this.shadow&&this.shadow.appendChild(this._slotElement),t?(this._linkElement||(this._linkElement=document.createElement("a"),this.shadow.appendChild(this._linkElement)),this._linkElement.href=t,s?this._linkElement.target=s:this._linkElement.removeAttribute("target")):this._linkElement&&(this.shadow.removeChild(this._linkElement),this._linkElement=null)}},K=({render:e,html:t})=>z;var M=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
484
484
  :host {
485
485
  border-style: solid;
486
486
  box-sizing: border-box;
@@ -504,7 +504,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
504
504
  width: 100%;
505
505
  }
506
506
 
507
- ${y}
507
+ ${_}
508
508
 
509
509
  a {
510
510
  display: block;
@@ -517,9 +517,9 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
517
517
  }
518
518
 
519
519
  ${k}
520
- ${x}
521
- ${f}
522
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._imgElement=document.createElement("img"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return _([...S,"key","src","href","target","wh","w","h","hidden","height","width"])}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),i=this.getAttribute("target");t?(this._linkElement||(this._linkElement=document.createElement("a")),this._linkElement.href=t,i?this._linkElement.target=i:this._linkElement.removeAttribute("target"),this._linkElement.appendChild(this._imgElement),this._linkElement.parentNode!==this.shadow&&this.shadow.appendChild(this._linkElement)):this._linkElement?(this._imgElement.parentNode===this._linkElement&&this.shadow.appendChild(this._imgElement),this._linkElement.parentNode===this.shadow&&this.shadow.removeChild(this._linkElement),this._linkElement=null):this._imgElement.parentNode!==this.shadow&&this.shadow.appendChild(this._imgElement)}attributeChangedCallback(t,i,r){if(t==="href"||t==="target"){this._updateDOM();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(s=>{let l=v=>`${s==="default"?"":`${s}-`}${v}`,h=this.getAttribute(l("wh")),c=g(h===null?this.getAttribute(l("w")):h),d=g(h===null?this.getAttribute(l("h")):h),m=this.getAttribute(l("o")),u=this.getAttribute(l("z"));u!==null&&(this._styles[s]["z-index"]=u),m!==null&&(this._styles[s].opacity=m),c==="f"?this._styles[s].width="var(--width-stretch)":c!==void 0&&(this._styles[s].width=c,this._styles[s]["min-width"]=c,this._styles[s]["max-width"]=c),d==="f"?this._styles[s].height="100%":d!==void 0&&(this._styles[s].height=d,this._styles[s]["min-height"]=d,this._styles[s]["max-height"]=d),this.hasAttribute(l("hidden"))&&(this._styles[s].display="none !important"),this.hasAttribute(l("visible"))&&(this._styles[s].display="block !important")});let a=E(this._styles);a!==this._lastStyleString&&(this._styleElement.textContent=a,this._lastStyleString=a),this._updateImageAttributes()}_updateImageAttributes(){let t=this.getAttribute("src"),i=this.getAttribute("width"),r=this.getAttribute("height");t!==null&&this._imgElement.setAttribute("src",t),i!==null&&this._imgElement.setAttribute("width",i),r!==null&&this._imgElement.setAttribute("height",r)}connectedCallback(){this._updateImageAttributes()}},P=({render:e,html:t})=>M;var K=n`
520
+ ${b}
521
+ ${m}
522
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styleElement=document.createElement("style"),this._imgElement=document.createElement("img"),this._linkElement=null,this.shadow.appendChild(this._styleElement),this._updateDOM()}static get observedAttributes(){return x([...y,"key","src","href","target","wh","w","h","hidden","height","width"])}_styles={default:{},sm:{},md:{},lg:{},xl:{}};_lastStyleString="";_updateDOM(){let t=this.getAttribute("href"),s=this.getAttribute("target");t?(this._linkElement||(this._linkElement=document.createElement("a")),this._linkElement.href=t,s?this._linkElement.target=s:this._linkElement.removeAttribute("target"),this._linkElement.appendChild(this._imgElement),this._linkElement.parentNode!==this.shadow&&this.shadow.appendChild(this._linkElement)):this._linkElement?(this._imgElement.parentNode===this._linkElement&&this.shadow.appendChild(this._imgElement),this._linkElement.parentNode===this.shadow&&this.shadow.removeChild(this._linkElement),this._linkElement=null):this._imgElement.parentNode!==this.shadow&&this.shadow.appendChild(this._imgElement)}attributeChangedCallback(t,s,r){if(t==="href"||t==="target"){this._updateDOM();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let n=v=>`${i==="default"?"":`${i}-`}${v}`,a=this.getAttribute(n("wh")),c=g(a===null?this.getAttribute(n("w")):a),h=g(a===null?this.getAttribute(n("h")):a),u=this.getAttribute(n("o")),f=this.getAttribute(n("z"));f!==null&&(this._styles[i]["z-index"]=f),u!==null&&(this._styles[i].opacity=u),c==="f"?this._styles[i].width="var(--width-stretch)":c!==void 0&&(this._styles[i].width=c,this._styles[i]["min-width"]=c,this._styles[i]["max-width"]=c),h==="f"?this._styles[i].height="100%":h!==void 0&&(this._styles[i].height=h,this._styles[i]["min-height"]=h,this._styles[i]["max-height"]=h),this.hasAttribute(n("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(n("visible"))&&(this._styles[i].display="block !important")});let d=w(this._styles);d!==this._lastStyleString&&(this._styleElement.textContent=d,this._lastStyleString=d),this._updateImageAttributes()}_updateImageAttributes(){let t=this.getAttribute("src"),s=this.getAttribute("width"),r=this.getAttribute("height");t!==null&&this._imgElement.setAttribute("src",t),s!==null&&this._imgElement.setAttribute("width",s),r!==null&&this._imgElement.setAttribute("height",r)}connectedCallback(){this._updateImageAttributes()}},Q=({render:e,html:t})=>M;var R=l`
523
523
  :host([pt="xs"]) svg {
524
524
  padding-top: var(--spacing-xs);
525
525
  }
@@ -635,12 +635,63 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
635
635
  padding-top: var(--spacing-xl);
636
636
  padding-bottom: var(--spacing-xl);
637
637
  }
638
- `;var j=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(n`
638
+ `;var j=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
639
639
  :host {
640
640
  color: var(--foreground);
641
641
  }
642
- ${$}
643
- ${K}
642
+ ${A}
643
+ ${R}
644
+ ${S}
645
+ ${m}
646
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet]}static get observedAttributes(){return["key","svg","w","h","wh"]}static get icons(){return e._icons}static addIcon(t,s){e._icons[t]=s}connectedCallback(){this._updateSizing(),this._render()}attributeChangedCallback(t,s,r){this._updateSizing(),this._render()}_updateSizing(){let t=this.getAttribute("wh"),s=g(t===null?this.getAttribute("w"):t),r=g(t===null?this.getAttribute("h"):t);s&&(this.style.width=s),r&&(this.style.height=r)}_render(){try{let t=this.getAttribute("svg"),s=e._icons[t]||(window.rtglIcons||{})[t];if(s){this.shadow.innerHTML=s;return}}catch(t){console.log("error in rtgl-svg render",t)}this.shadow.innerHTML=""}},G=({render:e,html:t})=>j;var O=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
647
+ :host {
648
+ display: contents;
649
+ }
650
+ input {
651
+ background-color: var(--background);
652
+ font-size: var(--sm-font-size);
653
+ font-weight: var(--sm-font-weight);
654
+ line-height: var(--sm-line-height);
655
+ letter-spacing: var(--sm-letter-spacing);
656
+ border: 1px solid var(--ring);
657
+ border-radius: var(--border-radius-lg);
658
+ padding-left: var(--spacing-md);
659
+ padding-right: var(--spacing-md);
660
+ height: 32px;
661
+ color: var(--foreground);
662
+ outline: none;
663
+ }
664
+ input:focus {
665
+ border-color: var(--foreground);
666
+ }
667
+ input:disabled {
668
+ cursor: not-allowed;
669
+ }
670
+ ${b}
671
+ ${m}
672
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("keydown",this._onChange)}static get observedAttributes(){return["key","type","placeholder","disabled",...x([...y,"wh","w","h","hidden","visible","op","z"])]}get value(){return this._inputElement.value}_onChange=t=>{this.dispatchEvent(new CustomEvent("input-keydown",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,s,r){if(["type","placeholder","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let n=v=>`${i==="default"?"":`${i}-`}${v}`,a=this.getAttribute(n("wh")),c=g(a===null?this.getAttribute(n("w")):a),h=g(a===null?this.getAttribute(n("h")):a),u=this.getAttribute(n("op")),f=this.getAttribute(n("z"));f!==null&&(this._styles[i]["z-index"]=f),u!==null&&(this._styles[i].opacity=u),c==="f"?this._styles[i].width="var(--width-stretch)":c!==void 0&&(this._styles[i].width=c,this._styles[i]["min-width"]=c,this._styles[i]["max-width"]=c),h==="f"?this._styles[i].height="100%":h!==void 0&&(this._styles[i].height=h,this._styles[i]["min-height"]=h,this._styles[i]["max-height"]=h),this.hasAttribute(n("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(n("visible"))&&(this._styles[i].display="block !important")});let d=w(this._styles,"input");d!==this._lastStyleString&&(this._styleElement.textContent=d,this._lastStyleString=d)}_updateInputAttributes(){let t=this.getAttribute("type")||"text",s=this.getAttribute("placeholder"),r=this.hasAttribute("disabled");this._inputElement.setAttribute("type",t),s!==null?this._inputElement.setAttribute("placeholder",s):this._inputElement.removeAttribute("placeholder"),r?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},q=({render:e,html:t})=>O;var W=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(l`
673
+ :host {
674
+ display: contents;
675
+ }
676
+ textarea {
677
+ font-family: inherit;
678
+ background-color: var(--background);
679
+ font-size: var(--sm-font-size);
680
+ font-weight: var(--sm-font-weight);
681
+ line-height: var(--sm-line-height);
682
+ letter-spacing: var(--sm-letter-spacing);
683
+ border: 1px solid var(--ring);
684
+ border-radius: var(--border-radius-lg);
685
+ padding-top: var(--spacing-md);
686
+ padding-bottom: var(--spacing-md);
687
+ padding-left: var(--spacing-md);
688
+ padding-right: var(--spacing-md);
689
+ color: var(--foreground);
690
+ outline: none;
691
+ }
692
+ textarea:focus {
693
+ border-color: var(--foreground);
694
+ }
644
695
  ${b}
645
- ${f}
646
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet]}static get observedAttributes(){return["key","svg","w","h","wh"]}static get icons(){return e._icons}static addIcon(t,i){e._icons[t]=i}connectedCallback(){this._updateSizing(),this._render()}attributeChangedCallback(t,i,r){this._updateSizing(),this._render()}_updateSizing(){let t=this.getAttribute("wh"),i=g(t===null?this.getAttribute("w"):t),r=g(t===null?this.getAttribute("h"):t);i&&(this.style.width=i),r&&(this.style.height=r)}_render(){try{let t=this.getAttribute("svg"),i=e._icons[t]||(window.rtglIcons||{})[t];if(i){this.shadow.innerHTML=i;return}}catch(t){console.log("error in rtgl-svg render",t)}this.shadow.innerHTML=""}},Q=({render:e,html:t})=>j;customElements.define("rtgl-button",I({}));customElements.define("rtgl-view",V({}));customElements.define("rtgl-text",U({}));customElements.define("rtgl-image",P({}));customElements.define("rtgl-svg",Q({}));})();
696
+ ${m}
697
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._textareaElement=document.createElement("textarea"),this._textareaElement.setAttribute("type","text"),this.shadow.appendChild(this._textareaElement)}static get observedAttributes(){return["key","w","ellipsis","cols","rows","placeholder"]}get value(){return this._textareaElement.value}set value(t){this._textareaElement.value=t}connectedCallback(){this._updateTextareaAttributes()}attributeChangedCallback(t,s,r){this._updateTextareaAttributes()}_updateTextareaAttributes(){let t=this.getAttribute("cols"),s=this.getAttribute("rows"),r=this.getAttribute("placeholder");t!==null?this._textareaElement.setAttribute("cols",t):this._textareaElement.removeAttribute("cols"),s!==null?this._textareaElement.setAttribute("rows",s):this._textareaElement.removeAttribute("rows"),r!==null?this._textareaElement.setAttribute("placeholder",r):this._textareaElement.removeAttribute("placeholder")}},F=({render:e,html:t})=>W;customElements.define("rtgl-button",B({}));customElements.define("rtgl-view",N({}));customElements.define("rtgl-text",K({}));customElements.define("rtgl-image",Q({}));customElements.define("rtgl-svg",G({}));customElements.define("rtgl-input",q({}));customElements.define("rtgl-textarea",F({}));})();