@e280/shiny 0.1.0-1 → 0.1.0-10
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 +110 -3
- package/package.json +3 -3
- package/s/{ui → components}/copy/component.ts +11 -6
- package/s/{ui → components}/copy/style.css.ts +6 -6
- package/s/components/drawer/component.ts +92 -0
- package/s/components/drawer/control.ts +31 -0
- package/s/components/drawer/style.css.ts +120 -0
- package/s/{ui → components}/example/component.ts +7 -5
- package/s/{ui → components}/example/style.css.ts +2 -2
- package/s/components/foundation.css.ts +15 -0
- package/s/components/framework.ts +10 -0
- package/s/components/raw-components.ts +13 -0
- package/s/components/tabs/component.ts +59 -0
- package/s/components/tabs/control.ts +31 -0
- package/s/components/tabs/style.css.ts +6 -0
- package/s/demo/aura-views.ts +6 -0
- package/s/demo/demo.bundle.ts +204 -14
- package/s/demo/demo.css +3 -1
- package/s/demo/utils/lipsum.ts +19 -0
- package/s/demo/views/demonstration/style.css.ts +10 -2
- package/s/demo/views/demonstration/view.ts +18 -14
- package/s/icons/tabler/menu-2.svg.ts +4 -0
- package/s/icons/tabler/x.svg.ts +4 -0
- package/s/index.html.ts +2 -2
- package/s/index.ts +16 -4
- package/s/install/aura.bundle.ts +9 -0
- package/s/install/plain.bundle.ts +9 -0
- package/s/shiny.ts +15 -0
- package/s/themes/aura.css.ts +48 -0
- package/s/themes/index.barrel.ts +2 -1
- package/s/themes/index.ts +1 -0
- package/s/themes/infra/css-vars.ts +33 -0
- package/s/themes/plain.css.ts +12 -0
- package/s/utils/states.ts +15 -0
- package/x/{ui → components}/copy/component.d.ts +8 -4
- package/x/{ui → components}/copy/component.js +10 -5
- package/x/components/copy/component.js.map +1 -0
- package/x/{ui → components}/copy/style.css.js +6 -6
- package/x/components/copy/style.css.js.map +1 -0
- package/x/components/drawer/component.d.ts +387 -0
- package/x/components/drawer/component.js +76 -0
- package/x/components/drawer/component.js.map +1 -0
- package/x/components/drawer/control.d.ts +9 -0
- package/x/components/drawer/control.js +24 -0
- package/x/components/drawer/control.js.map +1 -0
- package/x/components/drawer/style.css.js +119 -0
- package/x/components/drawer/style.css.js.map +1 -0
- package/x/{ui → components}/example/component.d.ts +3 -3
- package/x/{ui → components}/example/component.js +6 -4
- package/x/components/example/component.js.map +1 -0
- package/x/components/example/style.css.d.ts +2 -0
- package/x/components/example/style.css.js +10 -0
- package/x/components/example/style.css.js.map +1 -0
- package/x/components/foundation.css.d.ts +1 -0
- package/x/components/foundation.css.js +14 -0
- package/x/components/foundation.css.js.map +1 -0
- package/x/components/framework.d.ts +8 -0
- package/x/components/framework.js +5 -0
- package/x/components/framework.js.map +1 -0
- package/x/components/raw-components.d.ts +10 -0
- package/x/components/raw-components.js +11 -0
- package/x/components/raw-components.js.map +1 -0
- package/x/components/tabs/component.d.ts +374 -0
- package/x/components/tabs/component.js +49 -0
- package/x/components/tabs/component.js.map +1 -0
- package/x/components/tabs/control.d.ts +9 -0
- package/x/components/tabs/control.js +24 -0
- package/x/components/tabs/control.js.map +1 -0
- package/x/components/tabs/style.css.d.ts +2 -0
- package/x/components/tabs/style.css.js +5 -0
- package/x/components/tabs/style.css.js.map +1 -0
- package/x/demo/aura-views.d.ts +14 -0
- package/x/demo/aura-views.js +4 -0
- package/x/demo/aura-views.js.map +1 -0
- package/x/demo/demo.bundle.js +198 -14
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +383 -48
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/demo.css +3 -1
- package/x/demo/utils/lipsum.d.ts +2 -0
- package/x/demo/utils/lipsum.js +11 -0
- package/x/demo/utils/lipsum.js.map +1 -0
- package/x/demo/views/demonstration/style.css.js +10 -2
- package/x/demo/views/demonstration/style.css.js.map +1 -1
- package/x/demo/views/demonstration/view.d.ts +6 -4
- package/x/demo/views/demonstration/view.js +16 -10
- package/x/demo/views/demonstration/view.js.map +1 -1
- package/x/icons/tabler/menu-2.svg.d.ts +2 -0
- package/x/icons/tabler/menu-2.svg.js +3 -0
- package/x/icons/tabler/menu-2.svg.js.map +1 -0
- package/x/icons/tabler/x.svg.d.ts +2 -0
- package/x/icons/tabler/x.svg.js +3 -0
- package/x/icons/tabler/x.svg.js.map +1 -0
- package/x/index.d.ts +10 -4
- package/x/index.html +7 -5
- package/x/index.html.js +2 -2
- package/x/index.js +10 -4
- package/x/index.js.map +1 -1
- package/x/install/aura.bundle.d.ts +1 -0
- package/x/install/aura.bundle.js +5 -0
- package/x/install/aura.bundle.js.map +1 -0
- package/x/install/aura.bundle.min.js +321 -0
- package/x/install/aura.bundle.min.js.map +7 -0
- package/x/install/plain.bundle.d.ts +1 -0
- package/x/install/plain.bundle.js +5 -0
- package/x/install/plain.bundle.js.map +1 -0
- package/x/install/plain.bundle.min.js +287 -0
- package/x/install/plain.bundle.min.js.map +7 -0
- package/x/shiny.d.ts +42 -0
- package/x/shiny.js +8 -0
- package/x/shiny.js.map +1 -0
- package/x/themes/aura.css.d.ts +1 -0
- package/x/themes/aura.css.js +47 -0
- package/x/themes/aura.css.js.map +1 -0
- package/x/themes/index.barrel.d.ts +2 -1
- package/x/themes/index.barrel.js +2 -1
- package/x/themes/index.barrel.js.map +1 -1
- package/x/themes/index.d.ts +1 -0
- package/x/themes/infra/css-vars.d.ts +11 -0
- package/x/themes/infra/css-vars.js +18 -0
- package/x/themes/infra/css-vars.js.map +1 -0
- package/x/themes/plain.css.d.ts +1 -0
- package/x/themes/plain.css.js +11 -0
- package/x/themes/plain.css.js.map +1 -0
- package/x/utils/states.d.ts +5 -0
- package/x/utils/states.js +13 -0
- package/x/utils/states.js.map +1 -0
- package/s/themes/basic.css.ts +0 -18
- package/s/tools/untab.ts +0 -30
- package/s/ui/components.ts +0 -9
- package/s/ui/framework.ts +0 -8
- package/s/ui/themers.ts +0 -28
- package/x/themes/basic.css.d.ts +0 -1
- package/x/themes/basic.css.js +0 -17
- package/x/themes/basic.css.js.map +0 -1
- package/x/tools/untab.d.ts +0 -1
- package/x/tools/untab.js +0 -26
- package/x/tools/untab.js.map +0 -1
- package/x/ui/components.d.ts +0 -6
- package/x/ui/components.js +0 -7
- package/x/ui/components.js.map +0 -1
- package/x/ui/copy/component.js.map +0 -1
- package/x/ui/copy/style.css.js.map +0 -1
- package/x/ui/example/component.js.map +0 -1
- package/x/ui/example/style.css.js +0 -10
- package/x/ui/example/style.css.js.map +0 -1
- package/x/ui/framework.d.ts +0 -4
- package/x/ui/framework.js +0 -6
- package/x/ui/framework.js.map +0 -1
- package/x/ui/themers.d.ts +0 -8
- package/x/ui/themers.js +0 -12
- package/x/ui/themers.js.map +0 -1
- /package/x/{ui → components}/copy/style.css.d.ts +0 -0
- /package/x/{ui/example → components/drawer}/style.css.d.ts +0 -0
package/s/demo/demo.bundle.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
|
|
2
2
|
import {css, html} from "lit"
|
|
3
3
|
import {dom, view} from "@e280/sly"
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import {shiny} from "../shiny.js"
|
|
5
|
+
import {auraViews} from "./aura-views.js"
|
|
6
|
+
import {plain} from "../themes/plain.css.js"
|
|
7
|
+
import {makeLipsumDispenser} from "./utils/lipsum.js"
|
|
8
|
+
import {TabControl} from "../components/tabs/control.js"
|
|
6
9
|
import {Demonstration} from "./views/demonstration/view.js"
|
|
7
10
|
|
|
8
|
-
const
|
|
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()
|
|
9
24
|
|
|
10
25
|
dom.register({ShinyDemo: view.component(use => {
|
|
11
26
|
use.styles(css`
|
|
@@ -15,28 +30,203 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
15
30
|
gap: 1em;
|
|
16
31
|
}
|
|
17
32
|
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
.themes {
|
|
34
|
+
display: flex;
|
|
35
|
+
justify-content: end;
|
|
36
|
+
gap: 0.5em;
|
|
37
|
+
|
|
38
|
+
span {
|
|
39
|
+
font-size: 1.2em;
|
|
40
|
+
opacity: 0.5;
|
|
41
|
+
font-family: serif;
|
|
42
|
+
font-style: italic;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[view="shiny-tabs"] {
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
20
48
|
}
|
|
21
49
|
`)
|
|
22
50
|
|
|
23
|
-
|
|
51
|
+
const tabControl = use.once(() => new TabControl(0))
|
|
52
|
+
const $viewset = use.derived(() => viewsets.at(tabControl.$index())!)
|
|
53
|
+
const views = $viewset().views
|
|
54
|
+
dispenser.takeAll()
|
|
55
|
+
|
|
56
|
+
const demonstrations = [
|
|
24
57
|
Demonstration({
|
|
25
|
-
views,
|
|
26
58
|
name: "shiny-copy",
|
|
27
59
|
explain: html`
|
|
28
|
-
<p>
|
|
60
|
+
<p>click-to-copy text button.</p>
|
|
29
61
|
`,
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
}
|
|
32
84
|
`,
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
144
|
+
|
|
145
|
+
header {
|
|
146
|
+
> * + * { margin-top: 0.5em; }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
section {
|
|
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
|
+
}
|
|
35
212
|
`,
|
|
36
|
-
content: views.ShinyCopy("hello world"),
|
|
37
213
|
}),
|
|
38
214
|
]
|
|
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
|
+
`
|
|
39
229
|
})})
|
|
40
230
|
|
|
41
|
-
console.log("✨
|
|
231
|
+
console.log("✨shiny")
|
|
42
232
|
|
package/s/demo/demo.css
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
--tint: #070429aa;
|
|
72
72
|
background:
|
|
73
73
|
linear-gradient(0deg, var(--tint), var(--tint)),
|
|
74
|
-
#141519 url("/assets/bg.webp") center
|
|
74
|
+
#141519 url("/assets/bg.webp") center 80% / cover no-repeat;
|
|
75
75
|
|
|
76
76
|
background-attachment: fixed, fixed;
|
|
77
77
|
|
|
@@ -100,6 +100,8 @@
|
|
|
100
100
|
strong {
|
|
101
101
|
font-size: 1.5em;
|
|
102
102
|
color: var(--prime);
|
|
103
|
+
color: color-mix(in oklab, white, var(--prime) 20%);
|
|
104
|
+
text-shadow: 0 0 0.8em color-mix(in oklab, white, var(--prime) 50%);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
small {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import {Dispenser} from "@e280/stz"
|
|
3
|
+
|
|
4
|
+
export const makeLipsumDispenser = () => new Dispenser(() => [
|
|
5
|
+
`lorem kettlebell dolor sit amet, mountain squats consectetur trail-running. adipiscing deadlift elit, sed do 45lb turkish get-up eiusmod tempor incididunt ut hike magna aliqua. ut enim ad minim clean & press, quis nostrud exercitation lunges ullamco kettlebell snatch trailhead nisi ut aliquip ex dolore summit irure dolor.`,
|
|
6
|
+
|
|
7
|
+
`lorem protein dolor sit amet, creatine scoop elit shaker bottle tempor. grilled steak magna keto-fasting culpa, carb-loading perspiciatis cheat day. whey isolate dolor sit macros elit, intermittent fasting tempor electrolyte magna; barefoot shoes culpa, liver perspiciatis ancestral squat rack gospel. lorem bulking dolor sit cut elit, tdee tracker tempor calorie deficit magna; chicken breast culpa gatorade perspiciatis meal prep.`,
|
|
8
|
+
|
|
9
|
+
`lorem caffeine dolor sit amet, double espresso elit cold brew tempor jitter. adderall magna focus culpa, lion’s mane perspiciatis nootropic. nicotine gum dolor sit vape elit, dopamine hit tempor buzz magna; lsd microdosing culpa, productivity perspiciatis agile sprint. lorem latte dolor sit drip elit, french press tempor aeropress magna; insomnia culpa, circadian rhythm perspiciatis blue light filter.`,
|
|
10
|
+
|
|
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
|
+
|
|
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
|
+
|
|
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
|
+
|
|
17
|
+
`lorem sedentary dolor sit amet, infinite scroll elit chair-bound tempor. commit marathon magna carpal tunnel culpa, caffeine perspiciatis heartbeat irregular. lorem backlog dolor sit ticket elit, jira sprint tempor sedentary slump magna; gym membership culpa expired, standing desk perspiciatis unused. lorem procrastination dolor sit youtube elit, keyboard crumbs tempor pizza box magna; cardio avoidant culpa, hike someday perspiciatis maybe.`,
|
|
18
|
+
])
|
|
19
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {css} from "lit"
|
|
3
|
-
export default css
|
|
3
|
+
export default css`@layer view {
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
6
|
position: relative;
|
|
@@ -37,6 +37,12 @@ export default css`
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
p.lipsum {
|
|
41
|
+
opacity: 0.7;
|
|
42
|
+
font-family: serif;
|
|
43
|
+
font-style: italic;
|
|
44
|
+
}
|
|
45
|
+
|
|
40
46
|
.meta {
|
|
41
47
|
flex: 1 1 10em;
|
|
42
48
|
display: flex;
|
|
@@ -78,6 +84,7 @@ export default css`
|
|
|
78
84
|
white-space: pre;
|
|
79
85
|
text-wrap: wrap;
|
|
80
86
|
tab-size: 2;
|
|
87
|
+
word-break: break-word;
|
|
81
88
|
|
|
82
89
|
font-size: 0.8em;
|
|
83
90
|
font-family: monospace;
|
|
@@ -87,6 +94,7 @@ export default css`
|
|
|
87
94
|
|
|
88
95
|
[view="shiny-copy"] {
|
|
89
96
|
flex: 0 0 0;
|
|
97
|
+
font-size: 1.5em;
|
|
90
98
|
padding: 0.2em;
|
|
91
99
|
}
|
|
92
100
|
}
|
|
@@ -104,5 +112,5 @@ export default css`
|
|
|
104
112
|
border: 1px dashed #fff4;
|
|
105
113
|
}
|
|
106
114
|
|
|
107
|
-
`
|
|
115
|
+
}`
|
|
108
116
|
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import {untab} from "@e280/stz"
|
|
3
3
|
import {Content, view} from "@e280/sly"
|
|
4
|
+
import {CSSResultGroup, html} from "lit"
|
|
4
5
|
import styleCss from "./style.css.js"
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {basic} from "../../../themes/basic.css.js"
|
|
6
|
+
import {auraViews} from "../../aura-views.js"
|
|
7
|
+
import {foundationCss} from "../../../components/foundation.css.js"
|
|
8
8
|
|
|
9
9
|
export const Demonstration = view(use => (options: {
|
|
10
10
|
name: string
|
|
11
11
|
explain: Content
|
|
12
|
-
|
|
13
|
-
exampleView: string
|
|
14
|
-
exampleComponent: string
|
|
12
|
+
snippets: [label: {button: string, text: string}, code: string][]
|
|
15
13
|
content: Content
|
|
14
|
+
style: CSSResultGroup
|
|
16
15
|
}) => {
|
|
17
16
|
|
|
18
17
|
use.name(options.name)
|
|
19
|
-
use.styles(
|
|
18
|
+
use.styles(foundationCss, styleCss, options.style)
|
|
20
19
|
|
|
21
20
|
function codeblock(heading: string, code: string) {
|
|
22
21
|
const cleanCode = untab(code).trim()
|
|
23
22
|
return html`
|
|
24
|
-
<div class=codeblock>
|
|
23
|
+
<div class=codeblock slot=panel>
|
|
25
24
|
<div class=zone>
|
|
26
25
|
<h3>${heading}</h3>
|
|
27
26
|
<code>${cleanCode}</code>
|
|
28
27
|
</div>
|
|
29
|
-
${
|
|
28
|
+
${auraViews.ShinyCopy(cleanCode)}
|
|
30
29
|
</div>
|
|
31
30
|
`
|
|
32
31
|
}
|
|
@@ -35,10 +34,15 @@ export const Demonstration = view(use => (options: {
|
|
|
35
34
|
<div class=meta>
|
|
36
35
|
<h2>✨ ${options.name}</h2>
|
|
37
36
|
<div class=explain>${options.explain}</div>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
37
|
+
${auraViews.ShinyTabs
|
|
38
|
+
.props()
|
|
39
|
+
.children(html`
|
|
40
|
+
${options.snippets.map(([label]) => html`
|
|
41
|
+
<button>${label.button}</button>
|
|
42
|
+
`)}
|
|
43
|
+
${options.snippets.map(([label, code]) => codeblock(label.text, code))}
|
|
44
|
+
`)
|
|
45
|
+
.render()}
|
|
42
46
|
</div>
|
|
43
47
|
|
|
44
48
|
<div class=content part=content>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
import {svg} from "lit"
|
|
3
|
+
export default svg`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-menu-2"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M4 6l16 0" /><path d="M4 12l16 0" /><path d="M4 18l16 0" /></svg>`
|
|
4
|
+
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
|
|
2
|
+
import {svg} from "lit"
|
|
3
|
+
export default svg`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-x"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 6l-12 12" /><path d="M6 6l12 12" /></svg>`
|
|
4
|
+
|
package/s/index.html.ts
CHANGED
|
@@ -22,13 +22,13 @@ export default ssg.page(import.meta.url, async orb => ({
|
|
|
22
22
|
|
|
23
23
|
body: html`
|
|
24
24
|
<h1>
|
|
25
|
-
<strong>✨
|
|
25
|
+
<strong>✨shiny✨</strong>
|
|
26
26
|
<small>v${orb.packageVersion()}</small>
|
|
27
27
|
</h1>
|
|
28
28
|
|
|
29
29
|
<section>
|
|
30
30
|
<p>web ui components</p>
|
|
31
|
-
<p><a href="https://github.com/e280/shiny#readme">readme</a></p>
|
|
31
|
+
<p><a href="https://github.com/e280/shiny#readme">readme for installation</a></p>
|
|
32
32
|
</section>
|
|
33
33
|
|
|
34
34
|
<shiny-demo></shiny-demo>
|
package/s/index.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
export * from "./themes/index.js"
|
|
3
|
-
|
|
4
|
-
export * from "./
|
|
5
|
-
|
|
6
|
-
export * from "./
|
|
3
|
+
|
|
4
|
+
export * from "./components/copy/component.js"
|
|
5
|
+
|
|
6
|
+
export * from "./components/drawer/component.js"
|
|
7
|
+
export * from "./components/drawer/control.js"
|
|
8
|
+
|
|
9
|
+
export * from "./components/example/component.js"
|
|
10
|
+
|
|
11
|
+
export * from "./components/tabs/component.js"
|
|
12
|
+
export * from "./components/tabs/control.js"
|
|
13
|
+
|
|
14
|
+
export * from "./components/foundation.css.js"
|
|
15
|
+
export * from "./components/framework.js"
|
|
16
|
+
export * from "./components/raw-components.js"
|
|
17
|
+
|
|
18
|
+
export * from "./shiny.js"
|
|
7
19
|
|
package/s/shiny.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import {contextualizeComponents, getViews} from "@e280/sly"
|
|
3
|
+
import {ShinyContext} from "./components/framework.js"
|
|
4
|
+
import {rawComponents} from "./components/raw-components.js"
|
|
5
|
+
|
|
6
|
+
export function shiny(context: ShinyContext) {
|
|
7
|
+
const components = contextualizeComponents(context, rawComponents)
|
|
8
|
+
const views = getViews(components)
|
|
9
|
+
return {components, views}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type Shiny = ReturnType<typeof shiny>
|
|
13
|
+
export type ShinyViews = Shiny["views"]
|
|
14
|
+
export type ShinyComponents = Shiny["components"]
|
|
15
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
import {defaultCssVars, renderCssVars} from "./infra/css-vars.js"
|
|
4
|
+
export const aura = css`@layer overlay {
|
|
5
|
+
|
|
6
|
+
:host {
|
|
7
|
+
display: block;
|
|
8
|
+
|
|
9
|
+
${renderCssVars({
|
|
10
|
+
...defaultCssVars(),
|
|
11
|
+
})}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host([view="shiny-drawer"]) {
|
|
15
|
+
display: block;
|
|
16
|
+
|
|
17
|
+
&::part(tray) {
|
|
18
|
+
padding: 1em;
|
|
19
|
+
background: linear-gradient(
|
|
20
|
+
to top right,
|
|
21
|
+
#00a9dd69,
|
|
22
|
+
#70ffd77a
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([view="shiny-drawer"]:state(left)) {
|
|
28
|
+
&::part(tray) {
|
|
29
|
+
border-bottom-right-radius: 0.5em;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([view="shiny-drawer"]:state(right)) {
|
|
34
|
+
&::part(tray) {
|
|
35
|
+
border-bottom-left-radius: 0.5em;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:host([view="shiny-tabs"]) {
|
|
40
|
+
display: block;
|
|
41
|
+
|
|
42
|
+
&::part(tabs) {
|
|
43
|
+
display: flex;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}`
|
|
48
|
+
|
package/s/themes/index.barrel.ts
CHANGED
package/s/themes/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import {unsafeCSS} from "lit"
|
|
3
|
+
|
|
4
|
+
export type CssVars = {
|
|
5
|
+
"bg": string
|
|
6
|
+
"alpha": string
|
|
7
|
+
"happy": string
|
|
8
|
+
"sad": string
|
|
9
|
+
"angry": string
|
|
10
|
+
"lame": string
|
|
11
|
+
"inactive-opacity": string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function defaultCssVars(): CssVars {
|
|
15
|
+
return {
|
|
16
|
+
"bg": "#111",
|
|
17
|
+
"alpha": "#afa",
|
|
18
|
+
"happy": "#0fa",
|
|
19
|
+
"sad": "#74f",
|
|
20
|
+
"angry": "#f50",
|
|
21
|
+
"lame": "#8888",
|
|
22
|
+
"inactive-opacity": "0.5",
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function renderCssVars(vars: CssVars) {
|
|
27
|
+
return unsafeCSS(
|
|
28
|
+
Object.entries(vars)
|
|
29
|
+
.map(([key, value]) => `--${key}: var(--shiny-${key}, ${value});`)
|
|
30
|
+
.join("\n")
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
export class States {
|
|
3
|
+
#states: Set<string>
|
|
4
|
+
|
|
5
|
+
constructor(element: HTMLElement) {
|
|
6
|
+
this.#states = element.attachInternals().states as any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
assign(...states: string[]) {
|
|
10
|
+
this.#states.forEach(s => this.#states.delete(s))
|
|
11
|
+
for (const s of states) this.#states.add(s)
|
|
12
|
+
return this
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ShinyContext } from "../framework.js";
|
|
2
2
|
declare const ShinyCopy_base: import("@e280/sly").ComponentClass<{
|
|
3
3
|
new (): {
|
|
4
|
-
attrs: import("@e280/sly").AttrTypes<{
|
|
4
|
+
#attrs: import("@e280/sly").AttrTypes<{
|
|
5
5
|
text: StringConstructor;
|
|
6
6
|
ms: NumberConstructor;
|
|
7
7
|
}>;
|
|
8
|
-
|
|
8
|
+
get text(): string | undefined;
|
|
9
|
+
set text(v: string | undefined);
|
|
10
|
+
get ms(): number | undefined;
|
|
11
|
+
set ms(v: number | undefined);
|
|
12
|
+
context: ShinyContext;
|
|
9
13
|
#private: any;
|
|
10
14
|
readonly shadow: ShadowRoot;
|
|
11
15
|
createShadow(): ShadowRoot;
|
|
@@ -366,7 +370,7 @@ declare const ShinyCopy_base: import("@e280/sly").ComponentClass<{
|
|
|
366
370
|
focus(options?: FocusOptions): void;
|
|
367
371
|
};
|
|
368
372
|
styles: import("lit").CSSResultGroup | undefined;
|
|
369
|
-
}, [
|
|
373
|
+
}, [context: ShinyContext, text: string | undefined, ms?: any]>;
|
|
370
374
|
export declare class ShinyCopy extends ShinyCopy_base {
|
|
371
375
|
}
|
|
372
376
|
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
1
2
|
import { debounce } from "@e280/stz";
|
|
2
3
|
import { dom, view } from "@e280/sly";
|
|
3
|
-
import { html } from "lit";
|
|
4
4
|
import styleCss from "./style.css.js";
|
|
5
|
+
import { foundationCss } from "../foundation.css.js";
|
|
5
6
|
import { ShinyElement } from "../framework.js";
|
|
6
7
|
import clipboardSvg from "../../icons/tabler/clipboard.svg.js";
|
|
7
8
|
import clipboardXFilledSvg from "../../icons/tabler/clipboard-x-filled.svg.js";
|
|
8
9
|
import clipboardCheckFilledSvg from "../../icons/tabler/clipboard-check-filled.svg.js";
|
|
9
|
-
export class ShinyCopy extends (view(use => (
|
|
10
|
+
export class ShinyCopy extends (view(use => (context, text, ms = 1000) => {
|
|
10
11
|
use.name("shiny-copy");
|
|
11
|
-
use.styles(theme, styleCss);
|
|
12
|
+
use.styles(foundationCss, context.theme, styleCss);
|
|
12
13
|
const baseStatus = () => (text === undefined
|
|
13
14
|
? "invalid"
|
|
14
15
|
: "neutral");
|
|
@@ -46,11 +47,15 @@ export class ShinyCopy extends (view(use => (theme, text, ms = 1000) => {
|
|
|
46
47
|
`;
|
|
47
48
|
})
|
|
48
49
|
.component(class extends ShinyElement {
|
|
49
|
-
attrs = dom.attrs(this).spec({
|
|
50
|
+
#attrs = dom.attrs(this).spec({
|
|
50
51
|
text: String,
|
|
51
52
|
ms: Number,
|
|
52
53
|
});
|
|
54
|
+
get text() { return this.#attrs.text; }
|
|
55
|
+
set text(v) { this.#attrs.text = v; }
|
|
56
|
+
get ms() { return this.#attrs.ms; }
|
|
57
|
+
set ms(v) { this.#attrs.ms = v; }
|
|
53
58
|
})
|
|
54
|
-
.props(el => [el.
|
|
59
|
+
.props(el => [el.context, el.text, el.ms])) {
|
|
55
60
|
}
|
|
56
61
|
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../s/components/copy/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAClC,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AAEnC,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAe,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAC1D,OAAO,YAAY,MAAM,qCAAqC,CAAA;AAC9D,OAAO,mBAAmB,MAAM,8CAA8C,CAAA;AAC9E,OAAO,uBAAuB,MAAM,kDAAkD,CAAA;AAEtF,MAAM,OAAO,SAAU,SAAQ,CAC9B,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAqB,EAAE,IAAwB,EAAE,EAAE,GAAG,IAAI,EAAE,EAAE;IAC1E,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACtB,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAIlD,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,CACxB,IAAI,KAAK,SAAS;QACjB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,SAAS,CACZ,CAAA;IAED,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAS,UAAU,EAAE,CAAC,CAAA;IAChD,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAA;IACjF,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAC,MAAc,EAAE,EAAE;QAC1D,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QACzB,MAAM,WAAW,EAAE,CAAA;IACpB,CAAC,CAAC,CAAA;IAEF,KAAK,UAAU,KAAK;QACnB,IAAI,IAAI,KAAK,SAAS;YAAE,OAAM;QAC9B,IAAI,CAAC;YACJ,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YACzC,MAAM,WAAW,CAAC,MAAM,CAAC,CAAA;QAC1B,CAAC;QACD,OAAO,KAAK,EAAE,CAAC;YACd,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACpB,MAAM,WAAW,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC;IACF,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,GAAG,EAAE;QAAE,QAAQ,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;YAC5C,KAAK,SAAS,CAAC,CAAC,OAAO,YAAY,CAAA;YACnC,KAAK,SAAS,CAAC,CAAC,OAAO,YAAY,CAAA;YACnC,KAAK,MAAM,CAAC,CAAC,OAAO,uBAAuB,CAAA;YAC3C,KAAK,KAAK,CAAC,CAAC,OAAO,mBAAmB,CAAA;YACtC,OAAO,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAChD,CAAC;IAAA,CAAC,CAAC,EAAE,CAAA;IAEL,OAAO,IAAI,CAAA;0BACa,OAAO,CAAC,GAAG,EAAE,aAAa,KAAK;MACnD,IAAI;;GAEP,CAAA;AACF,CAAC,CAAC;KACD,SAAS,CAAC,KAAM,SAAQ,YAAY;IACpC,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;QAC7B,IAAI,EAAE,MAAM;QACZ,EAAE,EAAE,MAAM;KACV,CAAC,CAAA;IACF,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA,CAAC,CAAC;IACtC,IAAI,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC,CAAA,CAAC,CAAC;IACpC,IAAI,EAAE,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAA,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA,CAAC,CAAC;CAChC,CAAC;KACD,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAC1C;CAAG"}
|