@e280/shiny 0.1.0-10 → 0.1.0-12
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 +13 -8
- package/package.json +3 -3
- package/s/components/button/component.ts +30 -0
- package/s/components/button/showcase.ts +119 -0
- package/s/components/button/style.css.ts +63 -0
- package/s/components/copy/component.ts +3 -1
- package/s/components/copy/showcase.ts +51 -0
- package/s/components/drawer/component.ts +30 -32
- package/s/components/drawer/showcase.ts +93 -0
- package/s/components/drawer/style.css.ts +9 -4
- 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/showcase.ts +73 -0
- package/s/components/tabs/style.css.ts +38 -1
- package/s/demo/demo.bundle.ts +14 -199
- package/s/demo/demo.css +1 -0
- package/s/demo/lipsum.ts +6 -0
- package/s/demo/utils/lipsum.ts +1 -1
- package/s/demo/views/demonstration/style.css.ts +8 -0
- package/s/demo/views/demonstration/view.ts +10 -6
- package/s/demo/views/exhibit/style.css.ts +82 -0
- package/s/demo/views/exhibit/view.ts +59 -0
- package/s/demo/views/showcase/style.css.ts +50 -0
- package/s/demo/views/showcase/view.ts +54 -0
- package/s/demo/viewsets.ts +12 -0
- package/s/index.html.ts +4 -7
- package/s/themes/aura.css.ts +52 -14
- package/s/themes/infra/css-vars.ts +19 -6
- package/s/themes/plain.css.ts +0 -1
- package/x/components/button/component.d.ts +6 -0
- package/x/components/button/component.js +25 -0
- package/x/components/button/component.js.map +1 -0
- package/x/components/button/showcase.d.ts +1 -0
- package/x/components/button/showcase.js +116 -0
- package/x/components/button/showcase.js.map +1 -0
- package/x/components/button/style.css.d.ts +2 -0
- package/x/components/button/style.css.js +62 -0
- package/x/components/button/style.css.js.map +1 -0
- package/x/components/copy/component.d.ts +2 -2
- package/x/components/copy/component.js +3 -1
- package/x/components/copy/component.js.map +1 -1
- package/x/components/copy/showcase.d.ts +1 -0
- package/x/components/copy/showcase.js +48 -0
- package/x/components/copy/showcase.js.map +1 -0
- package/x/components/drawer/component.d.ts +3 -3
- package/x/components/drawer/component.js +28 -31
- package/x/components/drawer/component.js.map +1 -1
- package/x/components/drawer/showcase.d.ts +1 -0
- package/x/components/drawer/showcase.js +87 -0
- package/x/components/drawer/showcase.js.map +1 -0
- package/x/components/drawer/style.css.js +9 -4
- package/x/components/drawer/style.css.js.map +1 -1
- package/x/components/example/component.d.ts +1 -1
- 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.d.ts +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/showcase.d.ts +1 -0
- package/x/components/tabs/showcase.js +69 -0
- package/x/components/tabs/showcase.js.map +1 -0
- package/x/components/tabs/style.css.js +38 -1
- package/x/components/tabs/style.css.js.map +1 -1
- package/x/demo/demo.bundle.js +14 -193
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +497 -311
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/demo.css +1 -0
- package/x/demo/lipsum.d.ts +2 -0
- package/x/demo/lipsum.js +4 -0
- package/x/demo/lipsum.js.map +1 -0
- package/x/demo/utils/lipsum.js +1 -1
- 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 +8 -6
- package/x/demo/views/demonstration/view.js.map +1 -1
- package/x/demo/views/exhibit/style.css.d.ts +2 -0
- package/x/demo/views/exhibit/style.css.js +81 -0
- package/x/demo/views/exhibit/style.css.js.map +1 -0
- package/x/demo/views/exhibit/view.d.ts +29 -0
- package/x/demo/views/exhibit/view.js +38 -0
- package/x/demo/views/exhibit/view.js.map +1 -0
- package/x/demo/views/showcase/style.css.d.ts +2 -0
- package/x/demo/views/showcase/style.css.js +49 -0
- package/x/demo/views/showcase/style.css.js.map +1 -0
- package/x/demo/views/showcase/view.d.ts +7 -0
- package/x/demo/views/showcase/view.js +40 -0
- package/x/demo/views/showcase/view.js.map +1 -0
- package/x/demo/{aura-views.d.ts → viewsets.d.ts} +5 -2
- package/x/demo/viewsets.js +9 -0
- package/x/demo/viewsets.js.map +1 -0
- package/x/index.html +5 -4
- package/x/index.html.js +4 -7
- package/x/index.html.js.map +1 -1
- package/x/install/aura.bundle.min.js +210 -65
- package/x/install/aura.bundle.min.js.map +4 -4
- package/x/install/plain.bundle.min.js +159 -53
- package/x/install/plain.bundle.min.js.map +4 -4
- package/x/shiny.d.ts +8 -3
- package/x/themes/aura.css.js +52 -14
- package/x/themes/aura.css.js.map +1 -1
- package/x/themes/infra/css-vars.d.ts +6 -2
- package/x/themes/infra/css-vars.js +7 -3
- 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/s/demo/aura-views.ts +0 -6
- package/x/demo/aura-views.js +0 -4
- package/x/demo/aura-views.js.map +0 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
import {css, html} from "lit"
|
|
3
|
+
import {lipsum} from "../../demo/lipsum.js"
|
|
4
|
+
import {Showcase} from "../../demo/views/showcase/view.js"
|
|
5
|
+
|
|
6
|
+
const lip1 = lipsum()
|
|
7
|
+
const lip2 = lipsum()
|
|
8
|
+
const lip3 = lipsum()
|
|
9
|
+
|
|
10
|
+
const cssSnippet = `
|
|
11
|
+
shiny-tabs {
|
|
12
|
+
&::part(tabs) {}
|
|
13
|
+
&::part(panels) {}
|
|
14
|
+
> shiny-button {}
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
|
|
18
|
+
export const tabsShowcase = () => Showcase({
|
|
19
|
+
name: "tabs",
|
|
20
|
+
style: css`
|
|
21
|
+
.box {
|
|
22
|
+
place-content: start start;
|
|
23
|
+
p { margin-top: 0.5em; }
|
|
24
|
+
}
|
|
25
|
+
`,
|
|
26
|
+
exhibits: [
|
|
27
|
+
{
|
|
28
|
+
label: "tabs",
|
|
29
|
+
explain: html`<p>button bar. panels optional.</p>`,
|
|
30
|
+
snippets: [
|
|
31
|
+
{label: "html", code: `
|
|
32
|
+
<shiny-tabs>
|
|
33
|
+
<shiny-button>tab1</shiny-button>
|
|
34
|
+
<shiny-button>tab2</shiny-button>
|
|
35
|
+
<shiny-button>tab3</shiny-button>
|
|
36
|
+
<div slot=panel>panel1</div>
|
|
37
|
+
<div slot=panel>panel2</div>
|
|
38
|
+
<div slot=panel>panel3</div>
|
|
39
|
+
</shiny-tabs>
|
|
40
|
+
`},
|
|
41
|
+
{label: "view", code: `
|
|
42
|
+
ShinyTabs
|
|
43
|
+
.props()
|
|
44
|
+
.children(html\`
|
|
45
|
+
\${ShinyButton.props().children("tab1").render()}
|
|
46
|
+
\${ShinyButton.props().children("tab2").render()}
|
|
47
|
+
\${ShinyButton.props().children("tab3").render()}
|
|
48
|
+
<div slot=panel>panel1</div>
|
|
49
|
+
<div slot=panel>panel2</div>
|
|
50
|
+
<div slot=panel>panel3</div>
|
|
51
|
+
\`)
|
|
52
|
+
.render()
|
|
53
|
+
`},
|
|
54
|
+
{label: "css", code: cssSnippet},
|
|
55
|
+
],
|
|
56
|
+
style: css``,
|
|
57
|
+
presentation: views => html`
|
|
58
|
+
${views.ShinyTabs
|
|
59
|
+
.props()
|
|
60
|
+
.children(html`
|
|
61
|
+
${views.ShinyButton.props().children("tab1").render()}
|
|
62
|
+
${views.ShinyButton.props().children("tab2").render()}
|
|
63
|
+
${views.ShinyButton.props().children("tab3").render()}
|
|
64
|
+
<p slot=panel class=lipsum>${lip1}</p>
|
|
65
|
+
<p slot=panel class=lipsum>${lip2}</p>
|
|
66
|
+
<p slot=panel class=lipsum>${lip3}</p>
|
|
67
|
+
`)
|
|
68
|
+
.render()}
|
|
69
|
+
`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
})
|
|
73
|
+
|
|
@@ -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
|
@@ -1,26 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
import {css
|
|
2
|
+
import {css} from "lit"
|
|
3
3
|
import {dom, view} from "@e280/sly"
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {Demonstration} from "./views/demonstration/view.js"
|
|
10
|
-
|
|
11
|
-
const viewsets = [
|
|
12
|
-
{label: "aura", views: auraViews},
|
|
13
|
-
{label: "plain", views: shiny({theme: plain}).views},
|
|
14
|
-
]
|
|
15
|
-
|
|
16
|
-
const labels = {
|
|
17
|
-
html: {button: "html", text: "html web component"},
|
|
18
|
-
view: {button: "view", text: "sly view"},
|
|
19
|
-
css: {button: "css", text: "custom css"},
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const dispenser = makeLipsumDispenser()
|
|
23
|
-
const lipsum = () => dispenser.takeFirst()
|
|
4
|
+
import {lipsumDispenser} from "./lipsum.js"
|
|
5
|
+
import {copyShowcase} from "../components/copy/showcase.js"
|
|
6
|
+
import {tabsShowcase} from "../components/tabs/showcase.js"
|
|
7
|
+
import {buttonShowcase} from "../components/button/showcase.js"
|
|
8
|
+
import {drawerShowcase} from "../components/drawer/showcase.js"
|
|
24
9
|
|
|
25
10
|
dom.register({ShinyDemo: view.component(use => {
|
|
26
11
|
use.styles(css`
|
|
@@ -42,191 +27,21 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
42
27
|
font-style: italic;
|
|
43
28
|
}
|
|
44
29
|
|
|
45
|
-
[view="
|
|
30
|
+
[view="demo-tabs"] {
|
|
46
31
|
display: flex;
|
|
47
32
|
}
|
|
48
33
|
}
|
|
49
34
|
`)
|
|
50
35
|
|
|
51
|
-
|
|
52
|
-
const $viewset = use.derived(() => viewsets.at(tabControl.$index())!)
|
|
53
|
-
const views = $viewset().views
|
|
54
|
-
dispenser.takeAll()
|
|
55
|
-
|
|
56
|
-
const demonstrations = [
|
|
57
|
-
Demonstration({
|
|
58
|
-
name: "shiny-copy",
|
|
59
|
-
explain: html`
|
|
60
|
-
<p>click-to-copy text button.</p>
|
|
61
|
-
`,
|
|
62
|
-
snippets: [
|
|
63
|
-
[labels.html, `
|
|
64
|
-
<shiny-copy text="hello world"></shiny-copy>
|
|
65
|
-
`],
|
|
66
|
-
[labels.view, `
|
|
67
|
-
ShinyCopy("hello world")
|
|
68
|
-
`],
|
|
69
|
-
[labels.css, `
|
|
70
|
-
shiny-copy {
|
|
71
|
-
font-size: 1em;
|
|
72
|
-
--happy: #0fa;
|
|
73
|
-
--angry: #f50;
|
|
74
|
-
--lame: #8888;
|
|
75
|
-
--inactive-opacity: 0.5;
|
|
76
|
-
}
|
|
77
|
-
`],
|
|
78
|
-
],
|
|
79
|
-
content: views.ShinyCopy("hello world"),
|
|
80
|
-
style: css`
|
|
81
|
-
.content sly-view {
|
|
82
|
-
font-size: 4em;
|
|
83
|
-
}
|
|
84
|
-
`,
|
|
85
|
-
}),
|
|
86
|
-
|
|
87
|
-
Demonstration({
|
|
88
|
-
name: "shiny-drawer",
|
|
89
|
-
explain: html`
|
|
90
|
-
<p>slide-out panel. button optional.</p>
|
|
91
|
-
`,
|
|
92
|
-
snippets: [
|
|
93
|
-
[labels.html, `
|
|
94
|
-
<shiny-drawer button side=left>
|
|
95
|
-
<header>example</header>
|
|
96
|
-
<section slot=plate>
|
|
97
|
-
lorem kettlebell..
|
|
98
|
-
</section>
|
|
99
|
-
</shiny-drawer>
|
|
100
|
-
`],
|
|
101
|
-
[labels.view, `
|
|
102
|
-
ShinyDrawer
|
|
103
|
-
.props({button: true, side: "left"})
|
|
104
|
-
.children(html\`
|
|
105
|
-
<header>example</header>
|
|
106
|
-
<section slot=plate>
|
|
107
|
-
lorem kettlebell..
|
|
108
|
-
</section>
|
|
109
|
-
\`)
|
|
110
|
-
.render()
|
|
111
|
-
`],
|
|
112
|
-
[labels.css, `
|
|
113
|
-
shiny-drawer {
|
|
114
|
-
--button-size: 2em;
|
|
115
|
-
--anim-duration: 200ms;
|
|
116
|
-
--blanket-backdrop-filter: blur(0.5em);
|
|
117
|
-
--blanket-bg: color-mix(
|
|
118
|
-
in oklab,
|
|
119
|
-
transparent,
|
|
120
|
-
var(--bg)
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
`],
|
|
124
|
-
],
|
|
125
|
-
content: views.ShinyDrawer
|
|
126
|
-
.props({button: true})
|
|
127
|
-
.children(html`
|
|
128
|
-
<header>
|
|
129
|
-
<h2>example drawer</h2>
|
|
130
|
-
<p>you can put any content in here.</p>
|
|
131
|
-
<p class=lipsum>${lipsum()}</p>
|
|
132
|
-
</header>
|
|
133
|
-
<section slot=plate>
|
|
134
|
-
<p class=lipsum>${lipsum()}</p>
|
|
135
|
-
<p class=lipsum>${lipsum()}</p>
|
|
136
|
-
</section>
|
|
137
|
-
`)
|
|
138
|
-
.render(),
|
|
139
|
-
style: css`
|
|
140
|
-
.content sly-view {
|
|
141
|
-
border-radius: 0.5em;
|
|
142
|
-
overflow: hidden;
|
|
143
|
-
--button-size: 3em;
|
|
36
|
+
lipsumDispenser.takeAll()
|
|
144
37
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
display: flex;
|
|
151
|
-
flex-direction: column;
|
|
152
|
-
justify-content: center;
|
|
153
|
-
min-height: 100%;
|
|
154
|
-
padding: 1em;
|
|
155
|
-
padding-top: 3em;
|
|
156
|
-
> * + * { margin-top: 0.5em; }
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
`,
|
|
160
|
-
}),
|
|
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
|
-
}),
|
|
38
|
+
return [
|
|
39
|
+
buttonShowcase(),
|
|
40
|
+
copyShowcase(),
|
|
41
|
+
drawerShowcase(),
|
|
42
|
+
tabsShowcase(),
|
|
214
43
|
]
|
|
215
|
-
|
|
216
|
-
return html`
|
|
217
|
-
<div class=themes>
|
|
218
|
-
<span>theme</span>
|
|
219
|
-
${auraViews.ShinyTabs
|
|
220
|
-
.props(tabControl)
|
|
221
|
-
.children(viewsets.map(viewset => html`
|
|
222
|
-
<button>${viewset.label}</button>
|
|
223
|
-
`))
|
|
224
|
-
.render()}
|
|
225
|
-
</div>
|
|
226
|
-
|
|
227
|
-
${demonstrations}
|
|
228
|
-
`
|
|
229
44
|
})})
|
|
230
45
|
|
|
231
|
-
console.log("✨shiny")
|
|
46
|
+
console.log("✨shiny✨")
|
|
232
47
|
|
package/s/demo/demo.css
CHANGED
package/s/demo/lipsum.ts
ADDED
package/s/demo/utils/lipsum.ts
CHANGED
|
@@ -10,7 +10,7 @@ export const makeLipsumDispenser = () => new Dispenser(() => [
|
|
|
10
10
|
|
|
11
11
|
`lorem arch dolor sit amet, pacman -Syu elit rolling release tempor breakage. i3-gaps commodo tiling, bspwm magna culpa xinitrc. alias neovim configs in .dotfiles forest, r/unixporn veniam rice showcase perspiciatis.`,
|
|
12
12
|
|
|
13
|
-
`lorem authlocal dolor sit amet, user-sovereign identity elit, cryptographic tempor signatures. ed25519 magna keypair culpa, elliptic perspiciatis handshake ut zero-knowledge proof. decentralized login elit mnemonic seed tempor recovery phrase.
|
|
13
|
+
`lorem authlocal dolor sit amet, user-sovereign identity elit, cryptographic tempor signatures. ed25519 magna keypair culpa, elliptic perspiciatis handshake ut zero-knowledge proof. decentralized login elit mnemonic seed tempor recovery phrase. did magna alias culpa federation, lorem oauth2 perspiciatis antiquated.`,
|
|
14
14
|
|
|
15
15
|
`lorem webgpu dolor sit amet, fragment shader elit vertex buffer tempor pipeline; bindgroup magna sampler culpa, wgsl perspiciatis alignment bug. compute pass workgroup barrier magna, mipmap cascade culpa drawcall instancing overflow. spir-v dolor sit wasm elit, canvas context lost magna; fallback webgl2 perspiciatis, polyfill slowpath dolore, glsl antique culpa extension hell 144hz tearing. command encoder perspiciatis out-of-memory, chromium nightly.`,
|
|
16
16
|
|
|
@@ -3,7 +3,7 @@ import {untab} from "@e280/stz"
|
|
|
3
3
|
import {Content, view} from "@e280/sly"
|
|
4
4
|
import {CSSResultGroup, html} from "lit"
|
|
5
5
|
import styleCss from "./style.css.js"
|
|
6
|
-
import {auraViews} from "../../
|
|
6
|
+
import {auraViews} from "../../viewsets.js"
|
|
7
7
|
import {foundationCss} from "../../../components/foundation.css.js"
|
|
8
8
|
|
|
9
9
|
export const Demonstration = view(use => (options: {
|
|
@@ -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")
|
|
44
|
+
.children(label.button)
|
|
45
|
+
.render()
|
|
46
|
+
))}
|
|
43
47
|
${options.snippets.map(([label, code]) => codeblock(label.text, code))}
|
|
44
48
|
`)
|
|
45
49
|
.render()}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
export default css`@layer view {
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-wrap: wrap;
|
|
8
|
+
gap: 0.5em;
|
|
9
|
+
|
|
10
|
+
> * {
|
|
11
|
+
flex: 1 1 0;
|
|
12
|
+
min-width: 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.meta {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 1em;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.snippet {
|
|
23
|
+
flex: 1 0 auto;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 0.5em;
|
|
27
|
+
padding: 0.5em;
|
|
28
|
+
|
|
29
|
+
background: #0002;
|
|
30
|
+
box-shadow: inset 0.2em 0.3em 2em #0004;
|
|
31
|
+
border-radius: 0.5em;
|
|
32
|
+
|
|
33
|
+
> header {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: wrap;
|
|
36
|
+
align-items: center;
|
|
37
|
+
|
|
38
|
+
[view="shiny-copy"] { font-size: 1.5em; }
|
|
39
|
+
[view="shiny-tabs"] {
|
|
40
|
+
flex: 1 1 auto;
|
|
41
|
+
font-size: 0.8em;
|
|
42
|
+
color: color-mix(in oklab, transparent, currentColor 50%);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
> code {
|
|
47
|
+
display: block;
|
|
48
|
+
|
|
49
|
+
white-space: pre;
|
|
50
|
+
text-wrap: wrap;
|
|
51
|
+
tab-size: 2;
|
|
52
|
+
word-break: keep-all;
|
|
53
|
+
overflow: auto;
|
|
54
|
+
|
|
55
|
+
color: var(--code);
|
|
56
|
+
font-size: 0.8em;
|
|
57
|
+
font-family: monospace;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.box {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-wrap: wrap;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
align-items: center;
|
|
66
|
+
align-content: center;
|
|
67
|
+
|
|
68
|
+
gap: 0.5em;
|
|
69
|
+
padding: 1em;
|
|
70
|
+
|
|
71
|
+
border-radius: 0.5rem;
|
|
72
|
+
border: 1px dashed color-mix(in oklab, transparent, currentColor 30%);
|
|
73
|
+
|
|
74
|
+
p.lipsum {
|
|
75
|
+
opacity: 0.7;
|
|
76
|
+
font-family: serif;
|
|
77
|
+
font-style: italic;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
}`
|
|
82
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
import {untab} from "@e280/stz"
|
|
3
|
+
import {Content, view} from "@e280/sly"
|
|
4
|
+
import {CSSResultGroup, html} from "lit"
|
|
5
|
+
|
|
6
|
+
import styleCss from "./style.css.js"
|
|
7
|
+
import {auraViews} from "../../viewsets.js"
|
|
8
|
+
import {ShinyViews} from "../../../shiny.js"
|
|
9
|
+
import {TabControl} from "../../../components/tabs/control.js"
|
|
10
|
+
import {foundationCss} from "../../../components/foundation.css.js"
|
|
11
|
+
|
|
12
|
+
export type ExhibitParams = {
|
|
13
|
+
label: string
|
|
14
|
+
explain: Content
|
|
15
|
+
snippets: {label: string, code: string}[]
|
|
16
|
+
style: CSSResultGroup
|
|
17
|
+
presentation: (views: ShinyViews) => Content
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const Exhibit = view(use => (
|
|
21
|
+
exhibit: ExhibitParams,
|
|
22
|
+
views: ShinyViews,
|
|
23
|
+
showcaseStyle: CSSResultGroup,
|
|
24
|
+
) => {
|
|
25
|
+
|
|
26
|
+
use.name(`exhibit-${exhibit.label}`)
|
|
27
|
+
use.styles(foundationCss, styleCss, showcaseStyle, exhibit.style)
|
|
28
|
+
|
|
29
|
+
const snippetControl = use.once(() => new TabControl())
|
|
30
|
+
const snippet = exhibit.snippets.at(snippetControl.index)
|
|
31
|
+
const code = snippet ? untab(snippet.code).trim() : ""
|
|
32
|
+
|
|
33
|
+
return html`
|
|
34
|
+
<div class=meta>
|
|
35
|
+
${exhibit.explain}
|
|
36
|
+
|
|
37
|
+
<div class=snippet>
|
|
38
|
+
<header>
|
|
39
|
+
${auraViews.ShinyTabs.props(snippetControl)
|
|
40
|
+
.children(exhibit.snippets.map(s =>
|
|
41
|
+
auraViews.ShinyButton
|
|
42
|
+
.props()
|
|
43
|
+
.attr("plain")
|
|
44
|
+
.children(s.label)
|
|
45
|
+
.render()
|
|
46
|
+
))
|
|
47
|
+
.render()}
|
|
48
|
+
${auraViews.ShinyCopy(code)}
|
|
49
|
+
</header>
|
|
50
|
+
<code>${code}</code>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class=box>
|
|
55
|
+
${exhibit.presentation(views)}
|
|
56
|
+
</div>
|
|
57
|
+
`
|
|
58
|
+
})
|
|
59
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
export default css`@layer view {
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
|
|
11
|
+
padding: 1em;
|
|
12
|
+
border-radius: 0.5em;
|
|
13
|
+
gap: 1em;
|
|
14
|
+
|
|
15
|
+
background: linear-gradient(to right top, #252dd985, #aa6affbd);
|
|
16
|
+
backdrop-filter: blur(0.5em);
|
|
17
|
+
|
|
18
|
+
box-shadow: 0 0 5em #5d1fadaa;
|
|
19
|
+
border-top: 2px solid #fff4;
|
|
20
|
+
|
|
21
|
+
&::before {
|
|
22
|
+
content: "";
|
|
23
|
+
display: block;
|
|
24
|
+
position: absolute;
|
|
25
|
+
inset: 0;
|
|
26
|
+
border-radius: 0.5em;
|
|
27
|
+
background: #0007;
|
|
28
|
+
width: calc(100% - 0.3em);
|
|
29
|
+
height: calc(100% - 0.3em);
|
|
30
|
+
margin: auto;
|
|
31
|
+
z-index: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
> * {
|
|
35
|
+
position: relative;
|
|
36
|
+
z-index: 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
header {
|
|
41
|
+
display: flex;
|
|
42
|
+
|
|
43
|
+
h2 {
|
|
44
|
+
flex: 1 1 auto;
|
|
45
|
+
color: var(--prime);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}`
|
|
50
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
|
|
2
|
+
import {view} from "@e280/sly"
|
|
3
|
+
import {CSSResultGroup, html} from "lit"
|
|
4
|
+
import styleCss from "./style.css.js"
|
|
5
|
+
import {auraViews, viewsets} from "../../viewsets.js"
|
|
6
|
+
import {Exhibit, ExhibitParams} from "../exhibit/view.js"
|
|
7
|
+
import {TabControl} from "../../../components/tabs/control.js"
|
|
8
|
+
import {foundationCss} from "../../../components/foundation.css.js"
|
|
9
|
+
|
|
10
|
+
export const Showcase = view(use => (options: {
|
|
11
|
+
name: string
|
|
12
|
+
style: CSSResultGroup
|
|
13
|
+
exhibits: ExhibitParams[]
|
|
14
|
+
}) => {
|
|
15
|
+
|
|
16
|
+
use.name(`showcase-${options.name}`)
|
|
17
|
+
use.styles(foundationCss, styleCss)
|
|
18
|
+
|
|
19
|
+
const exhibitTabControl = use.once(() => new TabControl())
|
|
20
|
+
const themeTabControl = use.once(() => new TabControl())
|
|
21
|
+
|
|
22
|
+
const exhibitViews = viewsets.at(themeTabControl.index)![1]
|
|
23
|
+
const exhibit = options.exhibits.at(exhibitTabControl.index)!
|
|
24
|
+
|
|
25
|
+
return html`
|
|
26
|
+
<header>
|
|
27
|
+
<h2>✨shiny-${options.name}✨</h2>
|
|
28
|
+
<nav>
|
|
29
|
+
${auraViews.ShinyTabs
|
|
30
|
+
.props(exhibitTabControl)
|
|
31
|
+
.children(options.exhibits.map(p =>
|
|
32
|
+
auraViews.ShinyButton
|
|
33
|
+
.props()
|
|
34
|
+
.attr("sad")
|
|
35
|
+
.children(p.label)
|
|
36
|
+
.render()
|
|
37
|
+
))
|
|
38
|
+
.render()}
|
|
39
|
+
${auraViews.ShinyTabs
|
|
40
|
+
.props(themeTabControl)
|
|
41
|
+
.children(viewsets.map(([theme]) =>
|
|
42
|
+
auraViews.ShinyButton
|
|
43
|
+
.props()
|
|
44
|
+
.children(theme)
|
|
45
|
+
.render()
|
|
46
|
+
))
|
|
47
|
+
.render()}
|
|
48
|
+
</nav>
|
|
49
|
+
</header>
|
|
50
|
+
|
|
51
|
+
${Exhibit(exhibit, exhibitViews, options.style)}
|
|
52
|
+
`
|
|
53
|
+
})
|
|
54
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import {aura} from "../themes/aura.css.js"
|
|
3
|
+
import {plain} from "../themes/plain.css.js"
|
|
4
|
+
import {shiny, ShinyViews} from "../shiny.js"
|
|
5
|
+
|
|
6
|
+
export const auraViews = shiny({theme: aura}).views
|
|
7
|
+
|
|
8
|
+
export const viewsets: [label: string, ShinyViews][] = [
|
|
9
|
+
["aura", auraViews],
|
|
10
|
+
["plain", shiny({theme: plain}).views],
|
|
11
|
+
]
|
|
12
|
+
|