@e280/shiny 0.1.0-17 → 0.1.0-19

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 CHANGED
@@ -65,7 +65,7 @@
65
65
  --shiny-quirky: #f49;
66
66
 
67
67
  --shiny-inactive-opacity: 0.5;
68
- --shiny-anim-duration: 300ms;
68
+ --shiny-anim-duration: 150ms;
69
69
  }
70
70
  </style>
71
71
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e280/shiny",
3
- "version": "0.1.0-17",
3
+ "version": "0.1.0-19",
4
4
  "description": "✨ web ui library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  "prismjs": "^1.30.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@e280/hottie": "^0.1.0-3",
32
+ "@e280/hottie": "^0.1.0-4",
33
33
  "@e280/octo": "^0.1.0-12",
34
34
  "@e280/science": "^0.1.8",
35
35
  "@e280/scute": "^0.3.0-1",
@@ -13,6 +13,7 @@ export default css`@layer view {
13
13
  flex-direction: column;
14
14
  background: #0003;
15
15
  border-radius: var(--rounded);
16
+ backdrop-filter: blur(0.5em);
16
17
  }
17
18
 
18
19
  header {
@@ -35,8 +36,9 @@ header {
35
36
  code {
36
37
  padding: calc(var(--padding) / 4) var(--padding);
37
38
  color: var(--code);
38
- white-space: pre-wrap;
39
+ white-space: pre;
39
40
  tab-size: 2;
41
+ overflow-x: auto;
40
42
  }
41
43
 
42
44
  }`
@@ -4,19 +4,15 @@ export default css`@layer view {
4
4
 
5
5
  section.showcase {
6
6
  position: relative;
7
-
8
7
  display: flex;
9
8
  flex-direction: column;
10
-
11
9
  padding: 1em;
12
- border-radius: var(--rounded);
13
10
  gap: var(--padding);
14
11
 
15
12
  background: linear-gradient(to right top, #252dd985, #aa6affbd);
16
- backdrop-filter: blur(0.5em);
17
-
18
13
  box-shadow: 0 0 5em #5d1fadaa;
19
14
  border-top: 2px solid #fff4;
15
+ border-radius: var(--rounded);
20
16
 
21
17
  &::before {
22
18
  z-index: 0;
@@ -56,8 +52,8 @@ header {
56
52
 
57
53
  > * {
58
54
  flex: 1 1 0;
55
+ min-width: 0;
59
56
  }
60
-
61
57
  }
62
58
 
63
59
  .codezone {
@@ -25,7 +25,7 @@ export const varsString = css`@layer vars {
25
25
  "quirky": "#f49",
26
26
 
27
27
  "inactive-opacity": "0.5",
28
- "anim-duration": "300ms",
28
+ "anim-duration": "150ms",
29
29
  })}
30
30
  }
31
31
 
@@ -7,6 +7,7 @@ import {themeCss} from "../../theme/theme.css.js"
7
7
 
8
8
  export const ShinyButton = shadow((content?: Content, options: {
9
9
  vibe?: "calm" | "lame" | "happy" | "sad" | "angry" | "zesty" | "quirky"
10
+ onClick?: (event: PointerEvent) => void
10
11
  } = {}) => {
11
12
 
12
13
  useName("shiny-button")
@@ -22,7 +23,8 @@ export const ShinyButton = shadow((content?: Content, options: {
22
23
  part=button
23
24
  data-vibe="${options.vibe ?? "calm"}"
24
25
  ?disabled="${attrs.disabled}"
25
- ?hidden="${attrs.hidden}">
26
+ ?hidden="${attrs.hidden}"
27
+ @click="${options.onClick}">
26
28
  <slot>${content}</slot>
27
29
  </button>
28
30
  `
@@ -10,15 +10,20 @@ button {
10
10
 
11
11
  button {
12
12
  opacity: var(--inactive-opacity);
13
- cursor: pointer;
14
- cursor: copy;
13
+ display: flex;
14
+ align-items: center;
15
15
 
16
+ cursor: copy;
16
17
  color: inherit;
17
- transition: all 300ms linear;
18
+ transition: all var(--anim-duration) linear;
18
19
 
19
20
  &:is(:hover, :focus-visible) {
20
21
  opacity: 1;
21
22
  }
23
+
24
+ > span {
25
+ display: flex;
26
+ }
22
27
  }
23
28
 
24
29
  [data-status="invalid"] {
@@ -34,23 +34,25 @@ export const ShinyCopy = shadow((
34
34
  }
35
35
 
36
36
  return html`
37
- <button data-status="${copier.status}" @click="${click}">
38
- ${(() => {switch (copier.status) {
39
- case "neutral":
40
- return clipboardSvg
37
+ <button data-status="${copier.status}" @click="${click}" part=button>
38
+ <span part=icon>
39
+ ${(() => {switch (copier.status) {
40
+ case "neutral":
41
+ return clipboardSvg
41
42
 
42
- case "invalid":
43
- return clipboardSvg
43
+ case "invalid":
44
+ return clipboardSvg
44
45
 
45
- case "good":
46
- return clipboardCheckFilledSvg
46
+ case "good":
47
+ return clipboardCheckFilledSvg
47
48
 
48
- case "bad":
49
- return clipboardXFilledSvg
49
+ case "bad":
50
+ return clipboardXFilledSvg
50
51
 
51
- default:
52
- throw new Error(`unknown copy status`)
53
- }})()}
52
+ default:
53
+ throw new Error(`unknown copy status`)
54
+ }})()}
55
+ </span>
54
56
  <slot></slot>
55
57
  </button>
56
58
  `
@@ -22,7 +22,7 @@ export const tabsShowcase = () => Showcase("ShinyTabs", [
22
22
  `,
23
23
  }),
24
24
  styleboxCss: css`
25
- [view="shiny-button"] { font-size: 1.5em; }
25
+ [view="shiny-button"] { font-size: 1.2em; }
26
26
  p { margin-top: var(--padding); }
27
27
  `,
28
28
  js: `
@@ -37,15 +37,20 @@ button {
37
37
 
38
38
  button {
39
39
  opacity: var(--inactive-opacity);
40
- cursor: pointer;
41
- cursor: copy;
40
+ display: flex;
41
+ align-items: center;
42
42
 
43
+ cursor: copy;
43
44
  color: inherit;
44
- transition: all 300ms linear;
45
+ transition: all var(--anim-duration) linear;
45
46
 
46
47
  &:is(:hover, :focus-visible) {
47
48
  opacity: 1;
48
49
  }
50
+
51
+ > span {
52
+ display: flex;
53
+ }
49
54
  }
50
55
 
51
56
  [data-status="invalid"] {
@@ -102,7 +107,7 @@ a {
102
107
  }`;var rs=lt`@layer vars {
103
108
 
104
109
  :is(:root, :host) {
105
- ${ho({bg:"#111",alpha:"#def",rounded:"0.5em",padding:"0.5em",prime:"#d068ff",code:"#3f1",link:"cyan",selection:"white","selection-bg":"#f70",lame:"#8888",angry:"#f50",zesty:"#cf0",happy:"#0fa",calm:"#0af",sad:"#74f",quirky:"#f49","inactive-opacity":"0.5","anim-duration":"300ms"})}
110
+ ${ho({bg:"#111",alpha:"#def",rounded:"0.5em",padding:"0.5em",prime:"#d068ff",code:"#3f1",link:"cyan",selection:"white","selection-bg":"#f70",lame:"#8888",angry:"#f50",zesty:"#cf0",happy:"#0fa",calm:"#0af",sad:"#74f",quirky:"#f49","inactive-opacity":"0.5","anim-duration":"150ms"})}
106
111
  }
107
112
 
108
113
  }`;function po([r,t]){return`--${r}: var(--shiny-${r}, ${t});`}function ho(r){return Object.entries(r).map(po).join(`
@@ -131,27 +136,25 @@ ${ss}
131
136
  ${es}
132
137
 
133
138
  `;var N=new CSSStyleSheet;N.replaceSync(os);var te=j((r,t={})=>{D("shiny-copy"),I(N,Kr);let e=ts(r,t.ms??1e3);async function s(){if(r!==void 0)try{if(t.fail)throw new Error("copy failed on purpose for testing purposes");await navigator.clipboard.writeText(r),await e.flash("good")}catch(o){console.error(o),await e.flash("bad")}}return C`
134
- <button data-status="${e.status}" @click="${s}">
135
- ${(()=>{switch(e.status){case"neutral":return pr;case"invalid":return pr;case"good":return Qr;case"bad":return Yr;default:throw new Error("unknown copy status")}})()}
139
+ <button data-status="${e.status}" @click="${s}" part=button>
140
+ <span part=icon>
141
+ ${(()=>{switch(e.status){case"neutral":return pr;case"invalid":return pr;case"good":return Qr;case"bad":return Yr;default:throw new Error("unknown copy status")}})()}
142
+ </span>
136
143
  <slot></slot>
137
144
  </button>
138
145
  `});var G=r=>r;var ns=S`@layer view {
139
146
 
140
147
  section.showcase {
141
148
  position: relative;
142
-
143
149
  display: flex;
144
150
  flex-direction: column;
145
-
146
151
  padding: 1em;
147
- border-radius: var(--rounded);
148
152
  gap: var(--padding);
149
153
 
150
154
  background: linear-gradient(to right top, #252dd985, #aa6affbd);
151
- backdrop-filter: blur(0.5em);
152
-
153
155
  box-shadow: 0 0 5em #5d1fadaa;
154
156
  border-top: 2px solid #fff4;
157
+ border-radius: var(--rounded);
155
158
 
156
159
  &::before {
157
160
  z-index: 0;
@@ -191,8 +194,8 @@ header {
191
194
 
192
195
  > * {
193
196
  flex: 1 1 0;
197
+ min-width: 0;
194
198
  }
195
-
196
199
  }
197
200
 
198
201
  .codezone {
@@ -228,6 +231,7 @@ header {
228
231
  flex-direction: column;
229
232
  background: #0003;
230
233
  border-radius: var(--rounded);
234
+ backdrop-filter: blur(0.5em);
231
235
  }
232
236
 
233
237
  header {
@@ -250,8 +254,9 @@ header {
250
254
  code {
251
255
  padding: calc(var(--padding) / 4) var(--padding);
252
256
  color: var(--code);
253
- white-space: pre-wrap;
257
+ white-space: pre;
254
258
  tab-size: 2;
259
+ overflow-x: auto;
255
260
  }
256
261
 
257
262
  }`;function ls(){return F(()=>{let r=document.head.querySelector("[data-prism]");if(!r)throw new Error("failed to find [data-prism] stylesheet");let t=new CSSStyleSheet;return t.replaceSync(r.textContent),t})}var ee=class extends zt{constructor(t){if(super(t),this.it=R,t.type!==Le.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===R||t==null)return this._t=void 0,this.it=t;if(t===rt)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ee.directiveName="unsafeHTML",ee.resultType=1;var cs=Pt(ee);var dr=j((r,t,e)=>{let s=ls();I(N,s,as),e=qr(e).trim();let o=Ue.default.highlight(e,t==="js"?Ue.default.languages.javascript:Ue.default.languages.css,t);return C`
@@ -423,7 +428,8 @@ button {
423
428
  part=button
424
429
  data-vibe="${t.vibe??"calm"}"
425
430
  ?disabled="${e.disabled}"
426
- ?hidden="${e.hidden}">
431
+ ?hidden="${e.hidden}"
432
+ @click="${t.onClick}">
427
433
  <slot>${r}</slot>
428
434
  </button>
429
435
  `});var ht=j((r,t)=>{D("showcase"),I(N,ns);let e=F(()=>new Dt),s=t.at(e.index);return C`
@@ -486,7 +492,7 @@ button {
486
492
  <p slot=panel>${V.takeFirst()}</p>
487
493
  <p slot=panel>${V.takeFirst()}</p>
488
494
  `}),styleboxCss:S`
489
- [view="shiny-button"] { font-size: 1.5em; }
495
+ [view="shiny-button"] { font-size: 1.2em; }
490
496
  p { margin-top: var(--padding); }
491
497
  `,js:`
492
498
  ShinyTabs.with({