@rettangoli/ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +49 -0
  2. package/dist/rettangoli-iife-layout.min.js +728 -0
  3. package/dist/rettangoli-iife-ui.min.js +830 -0
  4. package/package.json +53 -0
  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 +25 -0
  9. package/src/components/dialog/dialog.view.yaml +44 -0
  10. package/src/components/dropdownMenu/dropdownMenu.handlers.js +18 -0
  11. package/src/components/dropdownMenu/dropdownMenu.store.js +25 -0
  12. package/src/components/dropdownMenu/dropdownMenu.view.yaml +54 -0
  13. package/src/components/form/form.handlers.js +63 -0
  14. package/src/components/form/form.store.js +45 -0
  15. package/src/components/form/form.view.yaml +174 -0
  16. package/src/components/navbar/navbar.examples.yaml +86 -0
  17. package/src/components/navbar/navbar.handlers.js +10 -0
  18. package/src/components/navbar/navbar.store.js +46 -0
  19. package/src/components/navbar/navbar.view.yaml +74 -0
  20. package/src/components/pageOutline/pageOutline.handlers.js +69 -0
  21. package/src/components/pageOutline/pageOutline.store.js +40 -0
  22. package/src/components/pageOutline/pageOutline.view.yaml +34 -0
  23. package/src/components/popover/popover.handlers.js +5 -0
  24. package/src/components/popover/popover.store.js +12 -0
  25. package/src/components/popover/popover.view.yaml +57 -0
  26. package/src/components/select/select.handlers.js +61 -0
  27. package/src/components/select/select.store.js +65 -0
  28. package/src/components/select/select.view.yaml +50 -0
  29. package/src/components/sidebar/sidebar.handlers.js +36 -0
  30. package/src/components/sidebar/sidebar.store.js +142 -0
  31. package/src/components/sidebar/sidebar.view.yaml +190 -0
  32. package/src/components/table/table.handlers.js +55 -0
  33. package/src/components/table/table.store.js +72 -0
  34. package/src/components/table/table.view.yaml +103 -0
  35. package/src/entry-iife-layout.js +15 -0
  36. package/src/entry-iife-ui.js +22 -0
  37. package/src/index.js +17 -0
  38. package/src/lib/uhtml.js +9 -0
  39. package/src/primitives/button.js +306 -0
  40. package/src/primitives/colorPicker.js +213 -0
  41. package/src/primitives/image.js +234 -0
  42. package/src/primitives/input.js +218 -0
  43. package/src/primitives/slider.js +269 -0
  44. package/src/primitives/svg.js +95 -0
  45. package/src/primitives/text.js +141 -0
  46. package/src/primitives/textarea.js +103 -0
  47. package/src/primitives/view.js +217 -0
  48. package/src/setup.js +16 -0
  49. package/src/styles/anchorStyles.js +13 -0
  50. package/src/styles/buttonMarginStyles.js +84 -0
  51. package/src/styles/cursorStyles.js +12 -0
  52. package/src/styles/flexChildStyles.js +43 -0
  53. package/src/styles/flexDirectionStyles.js +74 -0
  54. package/src/styles/marginStyles.js +13 -0
  55. package/src/styles/paddingSvgStyles.js +120 -0
  56. package/src/styles/scrollStyles.js +22 -0
  57. package/src/styles/textColorStyles.js +14 -0
  58. package/src/styles/textStyles.js +62 -0
  59. package/src/styles/viewStyles.js +114 -0
@@ -0,0 +1,728 @@
1
+ var rettangoli=(()=>{function h(e,...t){let s="";return e.forEach((r,g)=>{s+=r+(t[g]||"")}),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,g]of Object.entries(V)){r!=="default"&&(s+=`${g} {`);for(let[i,o]of Object.entries(e)){let l=t[i]?` ${t[i]} `:" ";for(let[a,d]of Object.entries(o)){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
+ }
5
+ :host([${T}="${a}"]:hover)${l}{
6
+ ${D}
7
+ }
8
+ `}else s+=`
9
+ :host([${v}="${a}"])${l}{
10
+ ${d}
11
+ }
12
+ :host([${T}="${a}"]:hover)${l}{
13
+ ${d}
14
+ }
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),c=e=>{if(e!==void 0)return Z(e)?e:Y(e)?`${e}px`:Object.keys(n).includes(e)?`var(${n[e]})`:e},n={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,g]of Object.entries(V)){r!=="default"&&(s+=`${g} {
16
+ `);let i="";for(let[o,l]of Object.entries(e[r]))l!=null&&(i+=`${o}: ${l};
17
+ `);s+=`${t} {
18
+ ${i.trim()}
19
+ }
20
+ `,r!=="default"&&(s+=`}
21
+ `)}return s}var S=h`
22
+ :host([flex="0"]) {
23
+ flex: 0;
24
+ }
25
+ :host([flex="1"]) {
26
+ flex: 1;
27
+ }
28
+ :host([flex="2"]) {
29
+ flex: 2;
30
+ }
31
+ :host([flex="3"]) {
32
+ flex: 3;
33
+ }
34
+ :host([flex="4"]) {
35
+ flex: 4;
36
+ }
37
+ :host([flex="5"]) {
38
+ flex: 5;
39
+ }
40
+ :host([flex="6"]) {
41
+ flex: 6;
42
+ }
43
+ :host([flex="7"]) {
44
+ flex: 7;
45
+ }
46
+ :host([flex="8"]) {
47
+ flex: 8;
48
+ }
49
+ :host([flex="9"]) {
50
+ flex: 9;
51
+ }
52
+ :host([flex="10"]) {
53
+ flex: 10;
54
+ }
55
+ :host([flex="11"]) {
56
+ flex: 11;
57
+ }
58
+ :host([flex="12"]) {
59
+ flex: 12;
60
+ }
61
+ `;var tt={mt:n,mr:n,mb:n,ml:n,m:n,mh:n,mv:n,s:{sm:`
62
+ height: 28px;
63
+ padding-left: 12px;
64
+ padding-right: 12px;
65
+ border-radius: 4px;
66
+ font-size: var(--xs-font-size);
67
+ font-weight: var(--xs-font-weight);
68
+ line-height: var(--xs-line-height);
69
+ letter-spacing: var(--xs-letter-spacing);
70
+ `,md:`
71
+ height: 32px;
72
+ padding-left: 16px;
73
+ padding-right: 16px;
74
+ border-radius: 4px;
75
+ font-size: var(--sm-font-size);
76
+ font-weight: var(--sm-font-weight);
77
+ line-height: var(--sm-line-height);
78
+ letter-spacing: var(--sm-letter-spacing);
79
+ `,lg:`
80
+ height: 40px;
81
+ padding-left: 20px;
82
+ padding-right: 20px;
83
+ border-radius: 4px;
84
+ font-size: var(--md-font-size);
85
+ font-weight: var(--md-font-weight);
86
+ line-height: var(--md-line-height);
87
+ letter-spacing: var(--md-letter-spacing);
88
+ `},v:{pr:`
89
+ background-color: var(--primary);
90
+ color: var(--primary-foreground);
91
+ `,se:`
92
+ background-color: var(--secondary);
93
+ color: var(--secondary-foreground);
94
+ `,de:`
95
+ background-color: var(--destructive);
96
+ color: var(--primary-foreground);
97
+ `,ol:`
98
+ background-color: transparent;
99
+ color: var(--foreground);
100
+ border-width: 1px;
101
+ `,gh:`
102
+ background-color: transparent;
103
+ color: var(--foreground);
104
+ `,lk:`
105
+ background-color: transparent;
106
+ color: var(--foreground);
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
+ a, a:link, a:visited, a:hover, a:active {
109
+ color: inherit;
110
+ text-decoration: none;
111
+ background: none;
112
+ border: none;
113
+ padding: 0;
114
+ margin: 0;
115
+ font: inherit;
116
+ }
117
+ `;var $=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(h`
118
+ :host {
119
+ display: contents;
120
+ }
121
+ slot {
122
+ display: contents;
123
+ }
124
+
125
+ button {
126
+ display: flex;
127
+ flex-direction: row;
128
+ align-items: center;
129
+ justify-content: center;
130
+ gap: var(--spacing-lg);
131
+ border-width: 0px;
132
+ border-style: solid;
133
+ border-color: var(--border);
134
+ padding: 0px;
135
+ height: 32px;
136
+ padding-left: 16px;
137
+ padding-right: 16px;
138
+ border-radius: 4px;
139
+
140
+ font-size: var(--sm-font-size);
141
+ font-weight: var(--sm-font-weight);
142
+ line-height: var(--sm-line-height);
143
+ letter-spacing: var(--sm-letter-spacing);
144
+
145
+ background-color: var(--primary);
146
+ color: var(--primary-foreground);
147
+ }
148
+
149
+ button:hover {
150
+ cursor: pointer;
151
+ background-color: color-mix(
152
+ in srgb,
153
+ var(--primary) 85%,
154
+ white 15%
155
+ );
156
+ }
157
+
158
+ button:disabled {
159
+ cursor: not-allowed;
160
+ }
161
+
162
+ button:active {
163
+ cursor: pointer;
164
+ background-color: color-mix(
165
+ in srgb,
166
+ var(--primary) 80%,
167
+ white 20%
168
+ );
169
+ }
170
+
171
+ :host([v="pr"]) button:hover {
172
+ background-color: color-mix(
173
+ in srgb,
174
+ var(--primary) 85%,
175
+ white 15%
176
+ );
177
+ }
178
+
179
+ :host([v="pr"]) button:active {
180
+ background-color: color-mix(
181
+ in srgb,
182
+ var(--primary) 80%,
183
+ white 20%
184
+ );
185
+ }
186
+
187
+ :host([v="se"]) button:hover {
188
+ background-color: color-mix(
189
+ in srgb,
190
+ var(--secondary) 85%,
191
+ white 15%
192
+ );
193
+ }
194
+
195
+ :host([v="se"]) button:active {
196
+ background-color: color-mix(
197
+ in srgb,
198
+ var(--secondary) 80%,
199
+ white 20%
200
+ );
201
+ }
202
+
203
+ :host([v="de"]) button:hover {
204
+ background-color: color-mix(
205
+ in srgb,
206
+ var(--destructive) 85%,
207
+ white 15%
208
+ );
209
+ }
210
+
211
+ :host([v="de"]) button:active {
212
+ background-color: color-mix(
213
+ in srgb,
214
+ var(--destructive) 80%,
215
+ white 20%
216
+ );
217
+ }
218
+
219
+ :host([v="ol"]) button:hover {
220
+ background-color: var(--accent);
221
+ }
222
+
223
+ :host([v="gh"]) button:hover {
224
+ background-color: var(--accent);
225
+ }
226
+
227
+ :host([v="lk"]) button:hover {
228
+ text-decoration: underline;
229
+ }
230
+
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
+ ${_}
254
+
255
+ a {
256
+ display: contents;
257
+ }
258
+
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 g=this.getAttribute("target");g&&r.setAttribute("target",g),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},g=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",g),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=c(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`
262
+
263
+ :host([d="h"]) {
264
+ flex-direction: row;
265
+ }
266
+ :host([d="v"]) {
267
+ flex-direction: column;
268
+ }
269
+ :host([d="h"]:not([ah])) {
270
+ justify-content: flex-start;
271
+ }
272
+ :host([d="h"][ah="c"]) {
273
+ justify-content: center;
274
+ }
275
+ :host([d="h"][ah="e"]) {
276
+ justify-content: flex-end;
277
+ }
278
+ :host([d="h"]:not([av])) {
279
+ align-items: flex-start;
280
+ }
281
+ :host([d="h"][av="c"]) {
282
+ align-items: center;
283
+ align-content: center;
284
+ }
285
+ :host([d="h"][av="e"]) {
286
+ align-items: flex-end;
287
+ align-content: flex-end;
288
+ }
289
+
290
+ /* Default/vertical direction - horizontal alignment */
291
+ :host(:not([d]):not([ah])),
292
+ :host([d="v"]:not([ah])) {
293
+ align-items: flex-start;
294
+ }
295
+ :host(:not([d])[ah="c"]),
296
+ :host([d="v"][ah="c"]) {
297
+ align-items: center;
298
+ }
299
+ :host(:not([d])[ah="e"]),
300
+ :host([d="v"][ah="e"]) {
301
+ align-items: flex-end;
302
+ }
303
+
304
+ :host(:not([d]):not([av])),
305
+ :host([d="v"]:not([av])) {
306
+ justify-content: flex-start;
307
+ }
308
+ :host(:not([d])[av="c"]),
309
+ :host([d="v"][av="c"]) {
310
+ justify-content: center;
311
+ }
312
+ :host(:not([d])[av="e"]),
313
+ :host([d="v"][av="e"]) {
314
+ justify-content: flex-end;
315
+ }
316
+
317
+ @media screen and (max-width: 640px) {
318
+ :host([s-d="v"]) {
319
+ flex-direction: column;
320
+ }
321
+ :host([s-d="h"]) {
322
+ flex-direction: row;
323
+ }
324
+ :host([s-d="h"][s-av="c"]) {
325
+ align-items: center;
326
+ align-content: center;
327
+ }
328
+ :host([s-d="v"][s-av="c"]) {
329
+ justify-content: center;
330
+ }
331
+ }
332
+ `;var it={cur:{p:"pointer",m:"move",grab:"grab",grabbing:"grabbing"}},m=p(it);var U=h`
333
+ :host([sh]:not([sv])) {
334
+ overflow-x: scroll;
335
+ flex-wrap: nowrap;
336
+ }
337
+ :host([sv]:not([sh])) {
338
+ overflow-y: scroll;
339
+ flex-wrap: nowrap;
340
+ }
341
+ :host([sh][sv]) {
342
+ overflow: scroll;
343
+ flex-wrap: nowrap;
344
+ }
345
+ :host([overflow="hidden"]) {
346
+ overflow: hidden;
347
+ flex-wrap: nowrap;
348
+ }
349
+
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:`
351
+ background-color: var(--primary);
352
+ `,se:`
353
+ background-color: var(--secondary);
354
+ `,de:`
355
+ background-color: var(--destructive);
356
+ `,fg:`
357
+ background-color: var(--foreground);
358
+ `,bg:`
359
+ background-color: var(--background);
360
+ `,mu:`
361
+ background-color: var(--muted);
362
+ `,ac:`
363
+ background-color: var(--accent);
364
+ `,bo:`
365
+ background-color: var(--border);
366
+ `},pos:{rel:"relative",abs:"absolute",fix:"fixed"},cor:{full:`
367
+ top: 0;
368
+ right: 0;
369
+ bottom: 0;
370
+ left: 0;
371
+ height: 100%;
372
+ `,top:`
373
+ top: 0;
374
+ right: 0;
375
+ left: 0;
376
+ `,right:`
377
+ top: 0;
378
+ right: 0;
379
+ bottom: 0;
380
+ height: 100%;
381
+ `,bottom:`
382
+ right: 0;
383
+ bottom: 0;
384
+ left: 0;
385
+ `,left:`
386
+ bottom: 0;
387
+ left: 0;
388
+ top: 0;
389
+ height: 100%;
390
+ `},shadow:{sm:"--shadow-sm",md:"--shadow-md",lg:"--shadow-lg"},pt:n,pr:n,pb:n,pl:n,p:n,ph:n,pv:n,g:n,gv:n,gh:n,bw:E,bwt:E,bwr:E,bwb:E,bwl:E,bc:{pr:"--primary",se:"--secondary",de:"--destructive",fg:"--foreground",bg:"--background",mu:"--muted",ac:"--accent",bo:"--border"},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:n,mr:n,mb:n,ml:n,m:n,mh:n,mv:n},b=p(rt);var C=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(h`
391
+ slot {
392
+ display: contents;
393
+ }
394
+ :host {
395
+ display: flex;
396
+ flex-direction: column;
397
+ align-self: auto;
398
+ align-content: flex-start;
399
+ border-style: solid;
400
+ border-width: 0;
401
+ box-sizing: border-box;
402
+ border-color: var(--border);
403
+ }
404
+
405
+ :host([fw="w"]) {
406
+ flex-wrap: wrap;
407
+ }
408
+
409
+ ${S}
410
+ ${U}
411
+ ${H}
412
+ ${b}
413
+ ${m}
414
+ ${k}
415
+ ${_}
416
+
417
+ :host([href]) {
418
+ cursor: pointer;
419
+ position: relative;
420
+ }
421
+
422
+ :host([href]) a {
423
+ position: absolute;
424
+ top: 0;
425
+ left: 0;
426
+ right: 0;
427
+ bottom: 0;
428
+ z-index: 1;
429
+ }
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 o=v=>`${i==="default"?"":`${i}-`}${v}`,l=this.getAttribute(o("wh")),a=c(l===null?this.getAttribute(o("w")):l),d=c(l===null?this.getAttribute(o("h")):l),u=this.getAttribute(o("op")),f=this.getAttribute(o("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(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="flex !important")});let g=w(this._styles);g!==this._lastStyleString&&(this._styleElement.textContent=g,this._lastStyleString=g)}},q=({render:e,html:t})=>C;var nt={ta:{s:"start",c:"center",e:"end",j:"justify"},s:{h1:`
431
+ font-size: var(--h1-font-size);
432
+ font-weight: var(--h1-font-weight);
433
+ line-height: var(--h1-line-height);
434
+ letter-spacing: var(--h1-letter-spacing);
435
+ `,h2:`
436
+ font-size: var(--h2-font-size);
437
+ font-weight: var(--h2-font-weight);
438
+ line-height: var(--h2-line-height);
439
+ letter-spacing: var(--h2-letter-spacing);
440
+ `,h3:`
441
+ font-size: var(--h3-font-size);
442
+ font-weight: var(--h3-font-weight);
443
+ line-height: var(--h3-line-height);
444
+ letter-spacing: var(--h3-letter-spacing);
445
+ `,h4:`
446
+ font-size: var(--h4-font-size);
447
+ font-weight: var(--h4-font-weight);
448
+ line-height: var(--h4-line-height);
449
+ letter-spacing: var(--h4-letter-spacing);
450
+ `,lg:`
451
+ font-size: var(--lg-font-size);
452
+ font-weight: var(--lg-font-weight);
453
+ line-height: var(--lg-line-height);
454
+ letter-spacing: var(--lg-letter-spacing);
455
+ `,md:`
456
+ font-size: var(--md-font-size);
457
+ font-weight: var(--md-font-weight);
458
+ line-height: var(--md-line-height);
459
+ letter-spacing: var(--md-letter-spacing);
460
+ `,sm:`
461
+ font-size: var(--sm-font-size);
462
+ font-weight: var(--sm-font-weight);
463
+ line-height: var(--sm-line-height);
464
+ letter-spacing: var(--sm-letter-spacing);
465
+ `,xs:`
466
+ font-size: var(--xs-font-size);
467
+ font-weight: var(--xs-font-weight);
468
+ line-height: var(--xs-line-height);
469
+ letter-spacing: var(--xs-letter-spacing);
470
+ `}},N=p(nt);var ot={c:{fg:"--foreground",de:"--destructive","pr-fg":"--primary-foreground","se-fg":"--secondary-foreground","mu-fg":"--muted-foreground","ac-fg":"--accent-foreground"}},A=p(ot);var z=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(h`
471
+ :host {
472
+ display: block;
473
+ font-size: var(--md-font-size);
474
+ font-weight: var(--md-font-weight);
475
+ line-height: var(--md-line-height);
476
+ letter-spacing: var(--md-letter-spacing);
477
+ }
478
+ slot {
479
+ display: contents;
480
+ }
481
+ :host ::slotted(a) {
482
+ text-decoration: var(--anchor-text-decoration);
483
+ color: var(--anchor-color);
484
+ }
485
+ :host ::slotted(a:hover) {
486
+ text-decoration: var(--anchor-text-decoration-hover);
487
+ color: var(--anchor-color-hover);
488
+ }
489
+ :host([href]) {
490
+ cursor: pointer;
491
+ position: relative;
492
+ }
493
+ :host([href]) a {
494
+ position: absolute;
495
+ top: 0;
496
+ left: 0;
497
+ right: 0;
498
+ bottom: 0;
499
+ z-index: 1;
500
+ }
501
+ ${N}
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=c(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`
506
+ :host {
507
+ border-style: solid;
508
+ box-sizing: border-box;
509
+ overflow: hidden;
510
+ border-width: 0;
511
+ }
512
+ slot {
513
+ display: contents;
514
+ }
515
+ :host([of="con"]) img {
516
+ object-fit: contain;
517
+ }
518
+ :host([of="cov"]) img {
519
+ object-fit: cover;
520
+ }
521
+ :host([of="none"]) img {
522
+ object-fit: none;
523
+ }
524
+ img {
525
+ height: 100%;
526
+ width: 100%;
527
+ }
528
+
529
+ ${_}
530
+
531
+ a {
532
+ display: block;
533
+ height: 100%;
534
+ width: 100%;
535
+ }
536
+
537
+ :host([href]) {
538
+ cursor: pointer;
539
+ }
540
+
541
+ ${k}
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 o=v=>`${i==="default"?"":`${i}-`}${v}`,l=this.getAttribute(o("wh")),a=c(l===null?this.getAttribute(o("w")):l),d=c(l===null?this.getAttribute(o("h")):l),u=this.getAttribute(o("o")),f=this.getAttribute(o("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(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="block !important")});let g=w(this._styles);g!==this._lastStyleString&&(this._styleElement.textContent=g,this._lastStyleString=g),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`
545
+ :host([pt="xs"]) svg {
546
+ padding-top: var(--spacing-xs);
547
+ }
548
+ :host([pt="sm"]) svg {
549
+ padding-top: var(--spacing-sm);
550
+ }
551
+ :host([pt="md"]) svg {
552
+ padding-top: var(--spacing-md);
553
+ }
554
+ :host([pt="lg"]) svg {
555
+ padding-top: var(--spacing-lg);
556
+ }
557
+ :host([pt="xl"]) svg {
558
+ padding-top: var(--spacing-xl);
559
+ }
560
+ :host([pr="xs"]) svg {
561
+ padding-right: var(--spacing-xs);
562
+ }
563
+ :host([pr="sm"]) svg {
564
+ padding-right: var(--spacing-sm);
565
+ }
566
+ :host([pr="md"]) svg {
567
+ padding-right: var(--spacing-md);
568
+ }
569
+ :host([pr="lg"]) svg {
570
+ padding-right: var(--spacing-lg);
571
+ }
572
+ :host([pr="xl"]) svg {
573
+ padding-right: var(--spacing-xl);
574
+ }
575
+ :host([pb="xs"]) svg {
576
+ padding-bottom: var(--spacing-xs);
577
+ }
578
+ :host([pb="sm"]) svg {
579
+ padding-bottom: var(--spacing-sm);
580
+ }
581
+ :host([pb="md"]) svg {
582
+ padding-bottom: var(--spacing-md);
583
+ }
584
+ :host([pb="lg"]) svg {
585
+ padding-bottom: var(--spacing-lg);
586
+ }
587
+ :host([pb="xl"]) svg {
588
+ padding-bottom: var(--spacing-xl);
589
+ }
590
+ :host([pl="xs"]) svg {
591
+ padding-left: var(--spacing-xs);
592
+ }
593
+ :host([pl="sm"]) svg {
594
+ padding-left: var(--spacing-sm);
595
+ }
596
+ :host([pl="md"]) svg {
597
+ padding-left: var(--spacing-md);
598
+ }
599
+ :host([pl="lg"]) svg {
600
+ padding-left: var(--spacing-lg);
601
+ }
602
+ :host([pl="xl"]) svg {
603
+ padding-left: var(--spacing-xl);
604
+ }
605
+ :host([p="xs"]) svg {
606
+ padding: var(--spacing-xs);
607
+ }
608
+ :host([p="sm"]) svg {
609
+ padding: var(--spacing-sm);
610
+ }
611
+ :host([p="md"]) svg {
612
+ padding: var(--spacing-md);
613
+ }
614
+ :host([p="lg"]) svg {
615
+ padding: var(--spacing-lg);
616
+ }
617
+ :host([p="xl"]) svg {
618
+ padding: var(--spacing-xl);
619
+ }
620
+ :host([ph="xs"]) svg {
621
+ padding-left: var(--spacing-xs);
622
+ padding-right: var(--spacing-xs);
623
+ }
624
+ :host([ph="sm"]) svg {
625
+ padding-left: var(--spacing-sm);
626
+ padding-right: var(--spacing-sm);
627
+ }
628
+ :host([ph="md"]) svg {
629
+ padding-left: var(--spacing-md);
630
+ padding-right: var(--spacing-md);
631
+ }
632
+ :host([ph="lg"]) svg {
633
+ padding-left: var(--spacing-lg);
634
+ padding-right: var(--spacing-lg);
635
+ }
636
+ :host([ph="xl"]) svg {
637
+ padding-left: var(--spacing-xl);
638
+ padding-right: var(--spacing-xl);
639
+ }
640
+ :host([pv="xs"]) svg {
641
+ padding-top: var(--spacing-xs);
642
+ padding-bottom: var(--spacing-xs);
643
+ }
644
+ :host([pv="sm"]) svg {
645
+ padding-top: var(--spacing-sm);
646
+ padding-bottom: var(--spacing-sm);
647
+ }
648
+ :host([pv="md"]) svg {
649
+ padding-top: var(--spacing-md);
650
+ padding-bottom: var(--spacing-md);
651
+ }
652
+ :host([pv="lg"]) svg {
653
+ padding-top: var(--spacing-lg);
654
+ padding-bottom: var(--spacing-lg);
655
+ }
656
+ :host([pv="xl"]) svg {
657
+ padding-top: var(--spacing-xl);
658
+ padding-bottom: var(--spacing-xl);
659
+ }
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=c(t===null?this.getAttribute("w"):t),r=c(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
+ :host([s="sm"]) input {
687
+ font-size: var(--xs-font-size);
688
+ font-weight: var(--xs-font-weight);
689
+ line-height: var(--xs-line-height);
690
+ letter-spacing: var(--xs-letter-spacing);
691
+ padding-left: var(--spacing-sm);
692
+ padding-right: var(--spacing-sm);
693
+ height: 24px;
694
+ }
695
+ input:focus {
696
+ border-color: var(--foreground);
697
+ }
698
+ input:disabled {
699
+ cursor: not-allowed;
700
+ }
701
+ ${b}
702
+ ${m}
703
+ `))}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","s",...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","s"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let o=v=>`${i==="default"?"":`${i}-`}${v}`,l=this.getAttribute(o("wh")),a=c(l===null?this.getAttribute(o("w")):l),d=c(l===null?this.getAttribute(o("h")):l),u=this.getAttribute(o("op")),f=this.getAttribute(o("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(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="block !important")});let g=w(this._styles,"input");g!==this._lastStyleString&&(this._styleElement.textContent=g,this._lastStyleString=g)}_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`
704
+ :host {
705
+ display: contents;
706
+ }
707
+ textarea {
708
+ font-family: inherit;
709
+ background-color: var(--background);
710
+ font-size: var(--sm-font-size);
711
+ font-weight: var(--sm-font-weight);
712
+ line-height: var(--sm-line-height);
713
+ letter-spacing: var(--sm-letter-spacing);
714
+ border: 1px solid var(--ring);
715
+ border-radius: var(--border-radius-lg);
716
+ padding-top: var(--spacing-md);
717
+ padding-bottom: var(--spacing-md);
718
+ padding-left: var(--spacing-md);
719
+ padding-right: var(--spacing-md);
720
+ color: var(--foreground);
721
+ outline: none;
722
+ }
723
+ textarea:focus {
724
+ border-color: var(--foreground);
725
+ }
726
+ ${b}
727
+ ${m}
728
+ `))}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({}));})();