rettangoli-ui 0.1.0-rc2 → 0.1.0-rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -27
- package/dist/rettangoli-iife-layout.min.js +118 -45
- package/dist/rettangoli-iife-ui.min.js +86 -65
- package/package.json +11 -4
- package/src/common/BaseElement.js +182 -0
- package/src/common.js +190 -0
- package/src/components/dialog/dialog.handlers.js +5 -0
- package/src/components/dialog/dialog.store.js +24 -0
- package/src/components/dialog/dialog.view.yaml +41 -0
- package/src/components/dropdownMenu/dropdownMenu.handlers.js +5 -0
- package/src/components/dropdownMenu/dropdownMenu.store.js +25 -0
- package/src/components/dropdownMenu/dropdownMenu.view.yaml +52 -0
- package/src/components/form/form.handlers.js +30 -0
- package/src/components/form/form.store.js +45 -0
- package/src/components/form/form.view.yaml +47 -0
- package/src/components/navbar/navbar.examples.yaml +86 -0
- package/src/components/navbar/navbar.handlers.js +10 -0
- package/src/components/navbar/navbar.store.js +46 -0
- package/src/components/navbar/navbar.view.yaml +74 -0
- package/src/components/pageOutline/pageOutline.handlers.js +69 -0
- package/src/components/pageOutline/pageOutline.store.js +40 -0
- package/src/components/pageOutline/pageOutline.view.yaml +34 -0
- package/src/components/popover/popover.handlers.js +5 -0
- package/src/components/popover/popover.store.js +12 -0
- package/src/components/popover/popover.view.yaml +57 -0
- package/src/components/select/select.handlers.js +46 -0
- package/src/components/select/select.store.js +65 -0
- package/src/components/select/select.view.yaml +50 -0
- package/src/components/sidebar/sidebar.handlers.js +36 -0
- package/src/components/sidebar/sidebar.store.js +139 -0
- package/src/components/sidebar/sidebar.view.yaml +190 -0
- package/src/entry-iife-layout.js +15 -0
- package/src/entry-iife-ui.js +18 -0
- package/src/index.js +17 -0
- package/src/lib/uhtml.js +9 -0
- package/src/primitives/button.js +306 -0
- package/src/primitives/image.js +234 -0
- package/src/primitives/input.js +208 -0
- package/src/primitives/svg.js +95 -0
- package/src/primitives/text.js +141 -0
- package/src/primitives/textarea.js +103 -0
- package/src/primitives/view.js +217 -0
- package/src/setup.js +16 -0
- package/src/styles/anchorStyles.js +13 -0
- package/src/styles/buttonMarginStyles.js +84 -0
- package/src/styles/cursorStyles.js +12 -0
- package/src/styles/flexChildStyles.js +43 -0
- package/src/styles/flexDirectionStyles.js +74 -0
- package/src/styles/marginStyles.js +13 -0
- package/src/styles/paddingSvgStyles.js +120 -0
- package/src/styles/scrollStyles.js +22 -0
- package/src/styles/textColorStyles.js +14 -0
- package/src/styles/textStyles.js +62 -0
- 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
|
-
|
31
|
+
### Generate test screens
|
48
32
|
|
49
|
-
|
33
|
+
Bundles the code to be used for `rettangoli-vt`
|
50
34
|
|
51
|
-
```
|
52
|
-
bun run
|
35
|
+
```bash
|
36
|
+
bun run build:dev
|
53
37
|
```
|
54
38
|
|
55
|
-
|
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
|
2
|
-
:host([${v}="${
|
3
|
-
${
|
1
|
+
var rettangoli=(()=>{function h(e,...t){let s="";return e.forEach((r,c)=>{s+=r+(t[c]||"")}),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,c]of Object.entries(V)){r!=="default"&&(s+=`${c} {`);for(let[i,n]of Object.entries(e)){let l=t[i]?` ${t[i]} `:" ";for(let[a,d]of Object.entries(n)){let u=I[i],f=d.startsWith("--")?`var(${d})`:d,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}="${a}"])${l}{
|
3
|
+
${D}
|
4
4
|
}
|
5
|
-
:host([${
|
6
|
-
${
|
5
|
+
:host([${T}="${a}"]:hover)${l}{
|
6
|
+
${D}
|
7
7
|
}
|
8
|
-
`}else
|
9
|
-
:host([${v}="${
|
8
|
+
`}else s+=`
|
9
|
+
:host([${v}="${a}"])${l}{
|
10
10
|
${d}
|
11
11
|
}
|
12
|
-
:host([${
|
12
|
+
:host([${T}="${a}"]:hover)${l}{
|
13
13
|
${d}
|
14
14
|
}
|
15
|
-
`}}r!=="default"&&(
|
16
|
-
`);let
|
17
|
-
`);
|
18
|
-
${
|
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,c]of Object.entries(V)){r!=="default"&&(s+=`${c} {
|
16
|
+
`);let i="";for(let[n,l]of Object.entries(e[r]))l!=null&&(i+=`${n}: ${l};
|
17
|
+
`);s+=`${t} {
|
18
|
+
${i.trim()}
|
19
19
|
}
|
20
|
-
`,r!=="default"&&(
|
21
|
-
`)}return
|
20
|
+
`,r!=="default"&&(s+=`}
|
21
|
+
`)}return s}var S=h`
|
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
|
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
|
-
`}},
|
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 _=h`
|
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
|
117
|
+
`;var $=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(h`
|
118
118
|
:host {
|
119
119
|
display: contents;
|
120
120
|
}
|
@@ -127,7 +127,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
127
127
|
flex-direction: row;
|
128
128
|
align-items: center;
|
129
129
|
justify-content: center;
|
130
|
-
gap: var(--spacing-
|
130
|
+
gap: var(--spacing-lg);
|
131
131
|
border-width: 0px;
|
132
132
|
border-style: solid;
|
133
133
|
border-color: var(--border);
|
@@ -228,15 +228,37 @@ 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
|
-
|
231
|
+
/* Square button styles */
|
232
|
+
:host([sq]) button {
|
233
|
+
width: 32px;
|
234
|
+
height: 32px;
|
235
|
+
padding: 0;
|
236
|
+
gap: 0;
|
237
|
+
}
|
238
|
+
|
239
|
+
:host([sq][s="sm"]) button {
|
240
|
+
width: 24px;
|
241
|
+
height: 24px;
|
242
|
+
padding: 0;
|
243
|
+
gap: 0;
|
244
|
+
}
|
245
|
+
|
246
|
+
:host([sq][s="lg"]) button {
|
247
|
+
width: 40px;
|
248
|
+
height: 40px;
|
249
|
+
padding: 0;
|
250
|
+
gap: 0;
|
251
|
+
}
|
252
|
+
|
253
|
+
${_}
|
232
254
|
|
233
255
|
a {
|
234
256
|
display: contents;
|
235
257
|
}
|
236
258
|
|
237
|
-
${
|
238
|
-
${
|
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,
|
259
|
+
${L}
|
260
|
+
${S}
|
261
|
+
`))}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","sq","ip"]}connectedCallback(){this._updateButton()}attributeChangedCallback(t,s,r){this._updateButton()}_updateButton(){this.shadow.innerHTML="",this._updateIcon(),this.hasAttribute("sq")||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 c=this.getAttribute("target");c&&r.setAttribute("target",c),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},c=s[this.getAttribute("v")]||"pr-fg",i=18;if(this.hasAttribute("sq")){let l={sm:14,lg:22},a=this.getAttribute("s");i=l[a]||18}else i=r[this.getAttribute("t")]||18;this._iconElement=document.createElement("rtgl-svg"),this._iconElement.setAttribute("svg",t),this._iconElement.setAttribute("c",c),this._iconElement.setAttribute("wh",i.toString()),this.getAttribute("ip")==="s"?this._buttonElement.insertBefore(this._iconElement,this._slotElement):this._buttonElement.appendChild(this._iconElement)}}_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=h`
|
240
262
|
|
241
263
|
:host([d="h"]) {
|
242
264
|
flex-direction: row;
|
@@ -307,7 +329,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
307
329
|
justify-content: center;
|
308
330
|
}
|
309
331
|
}
|
310
|
-
`;var
|
332
|
+
`;var it={cur:{p:"pointer",m:"move",grab:"grab",grabbing:"grabbing"}},m=p(it);var U=h`
|
311
333
|
:host([sh]:not([sv])) {
|
312
334
|
overflow-x: scroll;
|
313
335
|
flex-wrap: nowrap;
|
@@ -325,7 +347,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
325
347
|
flex-wrap: nowrap;
|
326
348
|
}
|
327
349
|
|
328
|
-
`;var
|
350
|
+
`;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
351
|
background-color: var(--primary);
|
330
352
|
`,se:`
|
331
353
|
background-color: var(--secondary);
|
@@ -365,7 +387,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
365
387
|
left: 0;
|
366
388
|
top: 0;
|
367
389
|
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:
|
390
|
+
`},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(h`
|
369
391
|
slot {
|
370
392
|
display: contents;
|
371
393
|
}
|
@@ -384,13 +406,13 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
384
406
|
flex-wrap: wrap;
|
385
407
|
}
|
386
408
|
|
387
|
-
${
|
388
|
-
${
|
409
|
+
${S}
|
410
|
+
${U}
|
389
411
|
${H}
|
390
|
-
${
|
391
|
-
${
|
412
|
+
${b}
|
413
|
+
${m}
|
392
414
|
${k}
|
393
|
-
${
|
415
|
+
${_}
|
394
416
|
|
395
417
|
:host([href]) {
|
396
418
|
cursor: pointer;
|
@@ -405,7 +427,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
405
427
|
bottom: 0;
|
406
428
|
z-index: 1;
|
407
429
|
}
|
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",...
|
430
|
+
`))}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","op",...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}`,l=this.getAttribute(n("wh")),a=g(l===null?this.getAttribute(n("w")):l),d=g(l===null?this.getAttribute(n("h")):l),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),a==="f"?this._styles[i].width="var(--width-stretch)":a!==void 0&&(this._styles[i].width=a,this._styles[i]["min-width"]=a,this._styles[i]["max-width"]=a),d==="f"?this._styles[i].height="100%":d!==void 0&&(this._styles[i].height=d,this._styles[i]["min-height"]=d,this._styles[i]["max-height"]=d),this.hasAttribute(n("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(n("visible"))&&(this._styles[i].display="flex !important")});let c=w(this._styles);c!==this._lastStyleString&&(this._styleElement.textContent=c,this._lastStyleString=c)}},q=({render:e,html:t})=>C;var ot={ta:{s:"start",c:"center",e:"end",j:"justify"},s:{h1:`
|
409
431
|
font-size: var(--h1-font-size);
|
410
432
|
font-weight: var(--h1-font-weight);
|
411
433
|
line-height: var(--h1-line-height);
|
@@ -445,7 +467,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
445
467
|
font-weight: var(--xs-font-weight);
|
446
468
|
line-height: var(--xs-line-height);
|
447
469
|
letter-spacing: var(--xs-letter-spacing);
|
448
|
-
`}},N=p(
|
470
|
+
`}},N=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(h`
|
449
471
|
:host {
|
450
472
|
display: block;
|
451
473
|
font-size: var(--md-font-size);
|
@@ -477,10 +499,10 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
477
499
|
z-index: 1;
|
478
500
|
}
|
479
501
|
${N}
|
480
|
-
${
|
481
|
-
${
|
482
|
-
${
|
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,
|
502
|
+
${A}
|
503
|
+
${b}
|
504
|
+
${m}
|
505
|
+
`))}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)}},P=({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(h`
|
484
506
|
:host {
|
485
507
|
border-style: solid;
|
486
508
|
box-sizing: border-box;
|
@@ -504,7 +526,7 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
504
526
|
width: 100%;
|
505
527
|
}
|
506
528
|
|
507
|
-
${
|
529
|
+
${_}
|
508
530
|
|
509
531
|
a {
|
510
532
|
display: block;
|
@@ -517,9 +539,9 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
517
539
|
}
|
518
540
|
|
519
541
|
${k}
|
520
|
-
${
|
521
|
-
${
|
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
|
542
|
+
${b}
|
543
|
+
${m}
|
544
|
+
`))}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}`,l=this.getAttribute(n("wh")),a=g(l===null?this.getAttribute(n("w")):l),d=g(l===null?this.getAttribute(n("h")):l),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),a==="f"?this._styles[i].width="var(--width-stretch)":a!==void 0&&(this._styles[i].width=a,this._styles[i]["min-width"]=a,this._styles[i]["max-width"]=a),d==="f"?this._styles[i].height="100%":d!==void 0&&(this._styles[i].height=d,this._styles[i]["min-height"]=d,this._styles[i]["max-height"]=d),this.hasAttribute(n("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(n("visible"))&&(this._styles[i].display="block !important")});let c=w(this._styles);c!==this._lastStyleString&&(this._styleElement.textContent=c,this._lastStyleString=c),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()}},K=({render:e,html:t})=>M;var Q=h`
|
523
545
|
:host([pt="xs"]) svg {
|
524
546
|
padding-top: var(--spacing-xs);
|
525
547
|
}
|
@@ -635,12 +657,63 @@ var rettangoli=(()=>{function n(e,...t){let i="";return e.forEach((r,a)=>{i+=r+(
|
|
635
657
|
padding-top: var(--spacing-xl);
|
636
658
|
padding-bottom: var(--spacing-xl);
|
637
659
|
}
|
638
|
-
`;var j=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(
|
660
|
+
`;var j=class e extends HTMLElement{static styleSheet=null;static _icons={};static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(h`
|
661
|
+
:host {
|
662
|
+
color: var(--foreground);
|
663
|
+
}
|
664
|
+
${A}
|
665
|
+
${Q}
|
666
|
+
${S}
|
667
|
+
${m}
|
668
|
+
`))}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=""}},R=({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(h`
|
669
|
+
:host {
|
670
|
+
display: contents;
|
671
|
+
}
|
672
|
+
input {
|
673
|
+
background-color: var(--background);
|
674
|
+
font-size: var(--sm-font-size);
|
675
|
+
font-weight: var(--sm-font-weight);
|
676
|
+
line-height: var(--sm-line-height);
|
677
|
+
letter-spacing: var(--sm-letter-spacing);
|
678
|
+
border: 1px solid var(--ring);
|
679
|
+
border-radius: var(--border-radius-lg);
|
680
|
+
padding-left: var(--spacing-md);
|
681
|
+
padding-right: var(--spacing-md);
|
682
|
+
height: 32px;
|
683
|
+
color: var(--foreground);
|
684
|
+
outline: none;
|
685
|
+
}
|
686
|
+
input:focus {
|
687
|
+
border-color: var(--foreground);
|
688
|
+
}
|
689
|
+
input:disabled {
|
690
|
+
cursor: not-allowed;
|
691
|
+
}
|
692
|
+
${b}
|
693
|
+
${m}
|
694
|
+
`))}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}`,l=this.getAttribute(n("wh")),a=g(l===null?this.getAttribute(n("w")):l),d=g(l===null?this.getAttribute(n("h")):l),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),a==="f"?this._styles[i].width="var(--width-stretch)":a!==void 0&&(this._styles[i].width=a,this._styles[i]["min-width"]=a,this._styles[i]["max-width"]=a),d==="f"?this._styles[i].height="100%":d!==void 0&&(this._styles[i].height=d,this._styles[i]["min-height"]=d,this._styles[i]["max-height"]=d),this.hasAttribute(n("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(n("visible"))&&(this._styles[i].display="block !important")});let c=w(this._styles,"input");c!==this._lastStyleString&&(this._styleElement.textContent=c,this._lastStyleString=c)}_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()}},G=({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(h`
|
639
695
|
:host {
|
696
|
+
display: contents;
|
697
|
+
}
|
698
|
+
textarea {
|
699
|
+
font-family: inherit;
|
700
|
+
background-color: var(--background);
|
701
|
+
font-size: var(--sm-font-size);
|
702
|
+
font-weight: var(--sm-font-weight);
|
703
|
+
line-height: var(--sm-line-height);
|
704
|
+
letter-spacing: var(--sm-letter-spacing);
|
705
|
+
border: 1px solid var(--ring);
|
706
|
+
border-radius: var(--border-radius-lg);
|
707
|
+
padding-top: var(--spacing-md);
|
708
|
+
padding-bottom: var(--spacing-md);
|
709
|
+
padding-left: var(--spacing-md);
|
710
|
+
padding-right: var(--spacing-md);
|
640
711
|
color: var(--foreground);
|
712
|
+
outline: none;
|
713
|
+
}
|
714
|
+
textarea:focus {
|
715
|
+
border-color: var(--foreground);
|
641
716
|
}
|
642
|
-
${$}
|
643
|
-
${K}
|
644
717
|
${b}
|
645
|
-
${
|
646
|
-
`))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet]}static get observedAttributes(){return["key","
|
718
|
+
${m}
|
719
|
+
`))}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",q({}));customElements.define("rtgl-text",P({}));customElements.define("rtgl-image",K({}));customElements.define("rtgl-svg",R({}));customElements.define("rtgl-input",G({}));customElements.define("rtgl-textarea",F({}));})();
|