@e280/shiny 0.1.0-10 → 0.1.0-11
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 +10 -7
- package/package.json +1 -1
- package/s/components/button/component.ts +30 -0
- package/s/components/button/style.css.ts +64 -0
- package/s/components/raw-components.ts +2 -0
- package/s/components/tabs/component.ts +13 -2
- package/s/components/tabs/control.ts +3 -3
- package/s/components/tabs/style.css.ts +38 -1
- package/s/demo/demo.bundle.ts +140 -57
- package/s/demo/views/demonstration/style.css.ts +8 -0
- package/s/demo/views/demonstration/view.ts +9 -5
- package/s/themes/aura.css.ts +48 -10
- package/s/themes/infra/css-vars.ts +15 -7
- package/s/themes/plain.css.ts +0 -1
- package/x/components/button/component.d.ts +5 -0
- package/x/components/button/component.js +25 -0
- package/x/components/button/component.js.map +1 -0
- package/x/components/button/style.css.d.ts +2 -0
- package/x/components/button/style.css.js +63 -0
- package/x/components/button/style.css.js.map +1 -0
- package/x/components/raw-components.d.ts +2 -0
- package/x/components/raw-components.js +2 -0
- package/x/components/raw-components.js.map +1 -1
- package/x/components/tabs/component.js +13 -2
- package/x/components/tabs/component.js.map +1 -1
- package/x/components/tabs/control.d.ts +1 -1
- package/x/components/tabs/control.js +3 -3
- package/x/components/tabs/control.js.map +1 -1
- package/x/components/tabs/style.css.js +38 -1
- package/x/components/tabs/style.css.js.map +1 -1
- package/x/demo/aura-views.d.ts +1 -0
- package/x/demo/demo.bundle.js +138 -56
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +292 -111
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/views/demonstration/style.css.js +8 -0
- package/x/demo/views/demonstration/style.css.js.map +1 -1
- package/x/demo/views/demonstration/view.js +7 -5
- package/x/demo/views/demonstration/view.js.map +1 -1
- package/x/index.html +2 -2
- package/x/install/aura.bundle.min.js +184 -42
- package/x/install/aura.bundle.min.js.map +4 -4
- package/x/install/plain.bundle.min.js +137 -34
- package/x/install/plain.bundle.min.js.map +4 -4
- package/x/shiny.d.ts +5 -0
- package/x/themes/aura.css.js +48 -10
- package/x/themes/aura.css.js.map +1 -1
- package/x/themes/infra/css-vars.d.ts +6 -3
- package/x/themes/infra/css-vars.js +7 -4
- package/x/themes/infra/css-vars.js.map +1 -1
- package/x/themes/plain.css.js +0 -1
- package/x/themes/plain.css.js.map +1 -1
package/README.md
CHANGED
|
@@ -92,13 +92,16 @@
|
|
|
92
92
|
```html
|
|
93
93
|
<style>
|
|
94
94
|
html {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
--shiny-bg: #111;
|
|
96
|
+
--shiny-alpha: #def;
|
|
97
|
+
--shiny-lame: #8888;
|
|
98
|
+
--shiny-inactive-opacity: 0.5;
|
|
99
|
+
--shiny-angry: #f50;
|
|
100
|
+
--shiny-zesty: #cf0;
|
|
101
|
+
--shiny-happy: #0fa;
|
|
102
|
+
--shiny-calm: #0af;
|
|
103
|
+
--shiny-sad: #74f;
|
|
104
|
+
--shiny-quirky: #f49;
|
|
102
105
|
}
|
|
103
106
|
</style>
|
|
104
107
|
```
|
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {view} from "@e280/sly"
|
|
4
|
+
import styleCss from "./style.css.js"
|
|
5
|
+
import {foundationCss} from "../foundation.css.js"
|
|
6
|
+
import {ShinyContext, ShinyElement} from "../framework.js"
|
|
7
|
+
|
|
8
|
+
export class ShinyButton extends (
|
|
9
|
+
view(use => (context: ShinyContext) => {
|
|
10
|
+
use.name("shiny-button")
|
|
11
|
+
use.styles(foundationCss, context.theme, styleCss)
|
|
12
|
+
|
|
13
|
+
const attrs = use.attrs.spec({
|
|
14
|
+
disabled: Boolean,
|
|
15
|
+
hidden: Boolean,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
return html`
|
|
19
|
+
<button
|
|
20
|
+
part=button
|
|
21
|
+
?disabled="${attrs.disabled}"
|
|
22
|
+
?hidden="${attrs.hidden}">
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</button>
|
|
25
|
+
`
|
|
26
|
+
})
|
|
27
|
+
.component(ShinyElement)
|
|
28
|
+
.props(el => [el.context] as const)
|
|
29
|
+
) {}
|
|
30
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
export default css`@layer view {
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
opacity: 0.8;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
width: max-content;
|
|
9
|
+
height: max-content;
|
|
10
|
+
|
|
11
|
+
--padding: 0.3em;
|
|
12
|
+
border-radius: 0.2em;
|
|
13
|
+
border: 0.1em solid currentColor;
|
|
14
|
+
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
background: transparent;
|
|
17
|
+
user-select: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host(:not([disabled]):is(:hover, :focus-visible)) { opacity: 1; }
|
|
21
|
+
:host(:not([disabled]):active) { opacity: 0.6; }
|
|
22
|
+
|
|
23
|
+
:host([disabled]) {
|
|
24
|
+
cursor: default;
|
|
25
|
+
color: var(--lame);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([hidden]) {
|
|
29
|
+
display: none !important;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([lame]) { color: var(--lame); }
|
|
33
|
+
:host([angry]) { color: var(--angry); }
|
|
34
|
+
:host([zesty]) { color: var(--zesty); }
|
|
35
|
+
:host([happy]) { color: var(--happy); }
|
|
36
|
+
:host([calm]) { color: var(--calm); }
|
|
37
|
+
:host([sad]) { color: var(--sad); }
|
|
38
|
+
:host([quirky]) { color: var(--quirky); }
|
|
39
|
+
|
|
40
|
+
button {
|
|
41
|
+
background: transparent;
|
|
42
|
+
border: none;
|
|
43
|
+
|
|
44
|
+
font: inherit;
|
|
45
|
+
color: inherit;
|
|
46
|
+
cursor: inherit;
|
|
47
|
+
outline: inherit;
|
|
48
|
+
text-shadow: inherit;
|
|
49
|
+
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
padding: var(--padding);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
slot {
|
|
60
|
+
display: contents;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}`
|
|
64
|
+
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
import {ShinyButton} from "./button/component.js"
|
|
2
3
|
import {ShinyCopy} from "./copy/component.js"
|
|
3
4
|
import {ShinyDrawer} from "./drawer/component.js"
|
|
4
5
|
import {ShinyExample} from "./example/component.js"
|
|
5
6
|
import {ShinyTabs} from "./tabs/component.js"
|
|
6
7
|
|
|
7
8
|
export const rawComponents = {
|
|
9
|
+
ShinyButton,
|
|
8
10
|
ShinyCopy,
|
|
9
11
|
ShinyDrawer,
|
|
10
12
|
ShinyExample,
|
|
@@ -29,10 +29,21 @@ export class ShinyTabs extends (
|
|
|
29
29
|
attrs.index = control.$index()
|
|
30
30
|
control.length = $tabs().length
|
|
31
31
|
|
|
32
|
+
function isNeighborActive(index: number, delta: number) {
|
|
33
|
+
const nextIndex = control.clamp(index + delta)
|
|
34
|
+
if (nextIndex === index) return false
|
|
35
|
+
return (nextIndex === control.index)
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
for (const [index, tab] of $tabs().entries()) {
|
|
33
39
|
const active = (index === control.index)
|
|
34
|
-
dom.attrs(tab)
|
|
35
|
-
|
|
40
|
+
const tabAttrs = dom.attrs(tab)
|
|
41
|
+
tabAttrs.booleans.disabled = active
|
|
42
|
+
tabAttrs.booleans["data-active"] = active
|
|
43
|
+
tabAttrs.booleans["data-first"] = (index === 0)
|
|
44
|
+
tabAttrs.booleans["data-last"] = (index === (control.length - 1))
|
|
45
|
+
tabAttrs.booleans["data-next-is-active"] = isNeighborActive(index, 1)
|
|
46
|
+
tabAttrs.booleans["data-previous-is-active"] = isNeighborActive(index, -1)
|
|
36
47
|
tab.onclick = () => control.setIndex(index)
|
|
37
48
|
}
|
|
38
49
|
|
|
@@ -9,14 +9,14 @@ export class TabControl {
|
|
|
9
9
|
this.$index.value = start
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
clamp(index: number) {
|
|
13
13
|
index = Math.min(index, this.length - 1)
|
|
14
14
|
index = Math.max(index, 0)
|
|
15
15
|
return index
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
get index() {
|
|
19
|
-
return this
|
|
19
|
+
return this.clamp(this.$index.get())
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async setIndex(index: number) {
|
|
@@ -24,7 +24,7 @@ export class TabControl {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async shimmy(delta: number) {
|
|
27
|
-
const index = this
|
|
27
|
+
const index = this.clamp(this.index + delta)
|
|
28
28
|
return this.setIndex(index)
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -2,5 +2,42 @@
|
|
|
2
2
|
import {css} from "lit"
|
|
3
3
|
export default css`@layer view {
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
:host {
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
slot[part="tabs"] {
|
|
11
|
+
display: flex;
|
|
12
|
+
|
|
13
|
+
&::slotted(*) {
|
|
14
|
+
border-radius: 0.3em;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&::slotted([data-active]) {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
color: currentColor;
|
|
20
|
+
text-decoration: underline;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&::slotted(:not([data-last], [data-next-is-active])) {
|
|
24
|
+
border-right: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&::slotted([data-active]:not([data-first])) {
|
|
28
|
+
border-left: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&::slotted(:not([data-last])) {
|
|
32
|
+
border-top-right-radius: 0;
|
|
33
|
+
border-bottom-right-radius: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&::slotted(:not([data-first])) {
|
|
37
|
+
border-top-left-radius: 0;
|
|
38
|
+
border-bottom-left-radius: 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
} `
|
|
6
43
|
|
package/s/demo/demo.bundle.ts
CHANGED
|
@@ -42,7 +42,7 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
42
42
|
font-style: italic;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
[view="
|
|
45
|
+
[view="demo-tabs"] {
|
|
46
46
|
display: flex;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -55,7 +55,143 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
55
55
|
|
|
56
56
|
const demonstrations = [
|
|
57
57
|
Demonstration({
|
|
58
|
-
name: "
|
|
58
|
+
name: "button",
|
|
59
|
+
explain: html`
|
|
60
|
+
<p>clicky-clacky pressy button.</p>
|
|
61
|
+
`,
|
|
62
|
+
snippets: [
|
|
63
|
+
[labels.html, `
|
|
64
|
+
<shiny-button>hello</shiny-button>
|
|
65
|
+
`],
|
|
66
|
+
[labels.view, `
|
|
67
|
+
ShinyButton
|
|
68
|
+
.props()
|
|
69
|
+
.children("hello")
|
|
70
|
+
.render()
|
|
71
|
+
`],
|
|
72
|
+
[labels.css, `
|
|
73
|
+
shiny-button {
|
|
74
|
+
font-size: 1em;
|
|
75
|
+
--happy: #0fa;
|
|
76
|
+
--angry: #f50;
|
|
77
|
+
--lame: #8888;
|
|
78
|
+
--inactive-opacity: 0.5;
|
|
79
|
+
}
|
|
80
|
+
`],
|
|
81
|
+
],
|
|
82
|
+
content: [
|
|
83
|
+
views.ShinyButton.props()
|
|
84
|
+
.children("button")
|
|
85
|
+
.render(),
|
|
86
|
+
views.ShinyButton.props()
|
|
87
|
+
.attr("gradient", true)
|
|
88
|
+
.children("gradient")
|
|
89
|
+
.render(),
|
|
90
|
+
views.ShinyButton.props()
|
|
91
|
+
.attr("angry", true)
|
|
92
|
+
.attr("gradient", true)
|
|
93
|
+
.children("angry")
|
|
94
|
+
.render(),
|
|
95
|
+
views.ShinyButton.props()
|
|
96
|
+
.attr("happy", true)
|
|
97
|
+
.attr("gradient", true)
|
|
98
|
+
.children("happy")
|
|
99
|
+
.render(),
|
|
100
|
+
views.ShinyButton.props()
|
|
101
|
+
.attr("zesty", true)
|
|
102
|
+
.attr("gradient", true)
|
|
103
|
+
.children("zesty")
|
|
104
|
+
.render(),
|
|
105
|
+
views.ShinyButton.props()
|
|
106
|
+
.attr("sad", true)
|
|
107
|
+
.attr("gradient", true)
|
|
108
|
+
.children("sad")
|
|
109
|
+
.render(),
|
|
110
|
+
views.ShinyButton.props()
|
|
111
|
+
.attr("quirky", true)
|
|
112
|
+
.attr("gradient", true)
|
|
113
|
+
.children("quirky")
|
|
114
|
+
.render(),
|
|
115
|
+
views.ShinyButton.props()
|
|
116
|
+
.attr("plain", true)
|
|
117
|
+
.children("plain")
|
|
118
|
+
.render(),
|
|
119
|
+
],
|
|
120
|
+
style: css`
|
|
121
|
+
.content {
|
|
122
|
+
flex-direction: row;
|
|
123
|
+
flex-wrap: wrap;
|
|
124
|
+
align-content: center;
|
|
125
|
+
gap: 0.5em;
|
|
126
|
+
|
|
127
|
+
sly-view {
|
|
128
|
+
font-size: 1.2em;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`,
|
|
132
|
+
}),
|
|
133
|
+
|
|
134
|
+
Demonstration({
|
|
135
|
+
name: "tabs",
|
|
136
|
+
explain: html`
|
|
137
|
+
<p>button bar. panels optional.</p>
|
|
138
|
+
`,
|
|
139
|
+
snippets: [
|
|
140
|
+
[labels.html, `
|
|
141
|
+
<shiny-tabs>
|
|
142
|
+
<shiny-button>tab1</shiny-button>
|
|
143
|
+
<shiny-button>tab2</shiny-button>
|
|
144
|
+
<shiny-button>tab3</shiny-button>
|
|
145
|
+
<div slot=panel>panel1</div>
|
|
146
|
+
<div slot=panel>panel2</div>
|
|
147
|
+
<div slot=panel>panel3</div>
|
|
148
|
+
</shiny-tabs>
|
|
149
|
+
`],
|
|
150
|
+
[labels.view, `
|
|
151
|
+
ShinyTabs
|
|
152
|
+
.props()
|
|
153
|
+
.children(html\`
|
|
154
|
+
\${ShinyButton.props()
|
|
155
|
+
.children("tab1").render()}
|
|
156
|
+
\${ShinyButton.props()
|
|
157
|
+
.children("tab2").render()}
|
|
158
|
+
\${ShinyButton.props()
|
|
159
|
+
.children("tab3").render()}
|
|
160
|
+
<div slot=panel>panel1</div>
|
|
161
|
+
<div slot=panel>panel2</div>
|
|
162
|
+
<div slot=panel>panel3</div>
|
|
163
|
+
\`)
|
|
164
|
+
.render()
|
|
165
|
+
`],
|
|
166
|
+
[labels.css, `
|
|
167
|
+
shiny-tabs {
|
|
168
|
+
&::part(tabs) {}
|
|
169
|
+
&::part(panels) {}
|
|
170
|
+
> shiny-button {}
|
|
171
|
+
}
|
|
172
|
+
`],
|
|
173
|
+
],
|
|
174
|
+
content: views.ShinyTabs
|
|
175
|
+
.props()
|
|
176
|
+
.children(html`
|
|
177
|
+
${views.ShinyButton.props().children("tab1").render()}
|
|
178
|
+
${views.ShinyButton.props().children("tab2").render()}
|
|
179
|
+
${views.ShinyButton.props().children("tab3").render()}
|
|
180
|
+
<p slot=panel class=lipsum>${lipsum()}</p>
|
|
181
|
+
<p slot=panel class=lipsum>${lipsum()}</p>
|
|
182
|
+
<p slot=panel class=lipsum>${lipsum()}</p>
|
|
183
|
+
`)
|
|
184
|
+
.render(),
|
|
185
|
+
style: css`
|
|
186
|
+
.content {
|
|
187
|
+
justify-content: start;
|
|
188
|
+
p { margin-top: 0.5em; }
|
|
189
|
+
}
|
|
190
|
+
`,
|
|
191
|
+
}),
|
|
192
|
+
|
|
193
|
+
Demonstration({
|
|
194
|
+
name: "copy",
|
|
59
195
|
explain: html`
|
|
60
196
|
<p>click-to-copy text button.</p>
|
|
61
197
|
`,
|
|
@@ -85,7 +221,7 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
85
221
|
}),
|
|
86
222
|
|
|
87
223
|
Demonstration({
|
|
88
|
-
name: "
|
|
224
|
+
name: "drawer",
|
|
89
225
|
explain: html`
|
|
90
226
|
<p>slide-out panel. button optional.</p>
|
|
91
227
|
`,
|
|
@@ -158,59 +294,6 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
158
294
|
}
|
|
159
295
|
`,
|
|
160
296
|
}),
|
|
161
|
-
|
|
162
|
-
Demonstration({
|
|
163
|
-
name: "shiny-tabs",
|
|
164
|
-
explain: html`
|
|
165
|
-
<p>button bar. panels optional.</p>
|
|
166
|
-
`,
|
|
167
|
-
snippets: [
|
|
168
|
-
[labels.html, `
|
|
169
|
-
<shiny-tabs>
|
|
170
|
-
<button>tab1</button>
|
|
171
|
-
<button>tab2</button>
|
|
172
|
-
<button>tab3</button>
|
|
173
|
-
<div slot=panel>panel1</div>
|
|
174
|
-
<div slot=panel>panel2</div>
|
|
175
|
-
<div slot=panel>panel3</div>
|
|
176
|
-
</shiny-tabs>
|
|
177
|
-
`],
|
|
178
|
-
[labels.view, `
|
|
179
|
-
ShinyTabs
|
|
180
|
-
.props()
|
|
181
|
-
.children(html\`
|
|
182
|
-
<button>tab1</button>
|
|
183
|
-
<button>tab2</button>
|
|
184
|
-
<button>tab3</button>
|
|
185
|
-
<div slot=panel>panel1</div>
|
|
186
|
-
<div slot=panel>panel2</div>
|
|
187
|
-
<div slot=panel>panel3</div>
|
|
188
|
-
\`)
|
|
189
|
-
.render()
|
|
190
|
-
`],
|
|
191
|
-
[labels.css, `
|
|
192
|
-
shiny-tabs::part(tabs) {}
|
|
193
|
-
shiny-tabs::part(panels) {}
|
|
194
|
-
`],
|
|
195
|
-
],
|
|
196
|
-
content: views.ShinyTabs
|
|
197
|
-
.props()
|
|
198
|
-
.children(html`
|
|
199
|
-
<button>tab1</button>
|
|
200
|
-
<button>tab2</button>
|
|
201
|
-
<button>tab3</button>
|
|
202
|
-
<p slot=panel class=lipsum>${lipsum()}</p>
|
|
203
|
-
<p slot=panel class=lipsum>${lipsum()}</p>
|
|
204
|
-
<p slot=panel class=lipsum>${lipsum()}</p>
|
|
205
|
-
`)
|
|
206
|
-
.render(),
|
|
207
|
-
style: css`
|
|
208
|
-
.content {
|
|
209
|
-
justify-content: start;
|
|
210
|
-
p { margin-top: 0.5em; }
|
|
211
|
-
}
|
|
212
|
-
`,
|
|
213
|
-
}),
|
|
214
297
|
]
|
|
215
298
|
|
|
216
299
|
return html`
|
|
@@ -219,7 +302,7 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
219
302
|
${auraViews.ShinyTabs
|
|
220
303
|
.props(tabControl)
|
|
221
304
|
.children(viewsets.map(viewset => html`
|
|
222
|
-
|
|
305
|
+
${auraViews.ShinyButton.props().children(viewset.label).render()}
|
|
223
306
|
`))
|
|
224
307
|
.render()}
|
|
225
308
|
</div>
|
|
@@ -14,7 +14,7 @@ export const Demonstration = view(use => (options: {
|
|
|
14
14
|
style: CSSResultGroup
|
|
15
15
|
}) => {
|
|
16
16
|
|
|
17
|
-
use.name(options.name)
|
|
17
|
+
use.name(`demo-${options.name}`)
|
|
18
18
|
use.styles(foundationCss, styleCss, options.style)
|
|
19
19
|
|
|
20
20
|
function codeblock(heading: string, code: string) {
|
|
@@ -32,14 +32,18 @@ export const Demonstration = view(use => (options: {
|
|
|
32
32
|
|
|
33
33
|
return html`
|
|
34
34
|
<div class=meta>
|
|
35
|
-
<h2>✨
|
|
35
|
+
<h2>✨ shiny-${options.name}</h2>
|
|
36
36
|
<div class=explain>${options.explain}</div>
|
|
37
37
|
${auraViews.ShinyTabs
|
|
38
38
|
.props()
|
|
39
39
|
.children(html`
|
|
40
|
-
${options.snippets.map(([label]) =>
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
${options.snippets.map(([label]) => (
|
|
41
|
+
auraViews.ShinyButton
|
|
42
|
+
.props()
|
|
43
|
+
.attr("plain", true)
|
|
44
|
+
.children(label.button)
|
|
45
|
+
.render()
|
|
46
|
+
))}
|
|
43
47
|
${options.snippets.map(([label, code]) => codeblock(label.text, code))}
|
|
44
48
|
`)
|
|
45
49
|
.render()}
|
package/s/themes/aura.css.ts
CHANGED
|
@@ -4,13 +4,59 @@ import {defaultCssVars, renderCssVars} from "./infra/css-vars.js"
|
|
|
4
4
|
export const aura = css`@layer overlay {
|
|
5
5
|
|
|
6
6
|
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
|
|
9
7
|
${renderCssVars({
|
|
10
8
|
...defaultCssVars(),
|
|
11
9
|
})}
|
|
12
10
|
}
|
|
13
11
|
|
|
12
|
+
:host([view="shiny-button"]:not([plain])) {
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
--buttoncolor: var(--calm);
|
|
16
|
+
--padding: 0.3em 0.7em;
|
|
17
|
+
|
|
18
|
+
color: white;
|
|
19
|
+
border-radius: 2em;
|
|
20
|
+
background: var(--buttoncolor);
|
|
21
|
+
border: none;
|
|
22
|
+
|
|
23
|
+
font-weight: medium;
|
|
24
|
+
text-shadow: 0.1em 0.1em 0.1em #0004;
|
|
25
|
+
box-shadow: 0.1em 0.2em 0.3em #0002;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([view="shiny-button"][lame]) { --buttoncolor: var(--lame); }
|
|
29
|
+
:host([view="shiny-button"][angry]) { --buttoncolor: var(--angry); }
|
|
30
|
+
:host([view="shiny-button"][zesty]) { --buttoncolor: var(--zesty); }
|
|
31
|
+
:host([view="shiny-button"][happy]) { --buttoncolor: var(--happy); }
|
|
32
|
+
:host([view="shiny-button"][calm]) { --buttoncolor: var(--calm); }
|
|
33
|
+
:host([view="shiny-button"][sad]) { --buttoncolor: var(--sad); }
|
|
34
|
+
:host([view="shiny-button"][quirky]) { --buttoncolor: var(--quirky); }
|
|
35
|
+
|
|
36
|
+
:host([view="shiny-button"][gradient]:not([plain])) {
|
|
37
|
+
border: none;
|
|
38
|
+
background: linear-gradient(
|
|
39
|
+
to bottom right,
|
|
40
|
+
color-mix(in oklab, var(--buttoncolor), white 40%),
|
|
41
|
+
color-mix(in oklab, var(--buttoncolor), black 20%)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
&::before {
|
|
45
|
+
content: "";
|
|
46
|
+
display: block;
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 0;
|
|
49
|
+
inset: 0.15em;
|
|
50
|
+
border-radius: inherit;
|
|
51
|
+
background: color-mix(in oklab, var(--buttoncolor), #0004 50%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
> * {
|
|
55
|
+
position: relative;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
14
60
|
:host([view="shiny-drawer"]) {
|
|
15
61
|
display: block;
|
|
16
62
|
|
|
@@ -36,13 +82,5 @@ export const aura = css`@layer overlay {
|
|
|
36
82
|
}
|
|
37
83
|
}
|
|
38
84
|
|
|
39
|
-
:host([view="shiny-tabs"]) {
|
|
40
|
-
display: block;
|
|
41
|
-
|
|
42
|
-
&::part(tabs) {
|
|
43
|
-
display: flex;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
85
|
}`
|
|
48
86
|
|
|
@@ -4,22 +4,30 @@ import {unsafeCSS} from "lit"
|
|
|
4
4
|
export type CssVars = {
|
|
5
5
|
"bg": string
|
|
6
6
|
"alpha": string
|
|
7
|
-
"happy": string
|
|
8
|
-
"sad": string
|
|
9
|
-
"angry": string
|
|
10
7
|
"lame": string
|
|
11
8
|
"inactive-opacity": string
|
|
9
|
+
|
|
10
|
+
// normative color vibes
|
|
11
|
+
"angry": string // red
|
|
12
|
+
"zesty": string // yellow
|
|
13
|
+
"happy": string // green
|
|
14
|
+
"calm": string // cyan
|
|
15
|
+
"sad": string // blue
|
|
16
|
+
"quirky": string // magenta
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export function defaultCssVars(): CssVars {
|
|
15
20
|
return {
|
|
16
21
|
"bg": "#111",
|
|
17
|
-
"alpha": "#
|
|
22
|
+
"alpha": "#def",
|
|
23
|
+
"inactive-opacity": "0.5",
|
|
24
|
+
"lame": "#8888",
|
|
25
|
+
"angry": "#f50",
|
|
26
|
+
"zesty": "#cf0",
|
|
18
27
|
"happy": "#0fa",
|
|
28
|
+
"calm": "#0af",
|
|
19
29
|
"sad": "#74f",
|
|
20
|
-
"
|
|
21
|
-
"lame": "#8888",
|
|
22
|
-
"inactive-opacity": "0.5",
|
|
30
|
+
"quirky": "#f49",
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
33
|
|
package/s/themes/plain.css.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { view } from "@e280/sly";
|
|
3
|
+
import styleCss from "./style.css.js";
|
|
4
|
+
import { foundationCss } from "../foundation.css.js";
|
|
5
|
+
import { ShinyElement } from "../framework.js";
|
|
6
|
+
export class ShinyButton extends (view(use => (context) => {
|
|
7
|
+
use.name("shiny-button");
|
|
8
|
+
use.styles(foundationCss, context.theme, styleCss);
|
|
9
|
+
const attrs = use.attrs.spec({
|
|
10
|
+
disabled: Boolean,
|
|
11
|
+
hidden: Boolean,
|
|
12
|
+
});
|
|
13
|
+
return html `
|
|
14
|
+
<button
|
|
15
|
+
part=button
|
|
16
|
+
?disabled="${attrs.disabled}"
|
|
17
|
+
?hidden="${attrs.hidden}">
|
|
18
|
+
<slot></slot>
|
|
19
|
+
</button>
|
|
20
|
+
`;
|
|
21
|
+
})
|
|
22
|
+
.component(ShinyElement)
|
|
23
|
+
.props(el => [el.context])) {
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../s/components/button/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAe,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAE1D,MAAM,OAAO,WAAY,SAAQ,CAChC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAqB,EAAE,EAAE;IACrC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACxB,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAElD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5B,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,OAAO;KACf,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;;;iBAGI,KAAK,CAAC,QAAQ;eAChB,KAAK,CAAC,MAAM;;;GAGxB,CAAA;AACF,CAAC,CAAC;KACD,SAAS,CAAC,YAAY,CAAC;KACvB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAU,CAAC,CACnC;CAAG"}
|