@e280/shiny 0.1.0-1 → 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 +113 -3
- package/package.json +3 -3
- package/s/components/button/component.ts +30 -0
- package/s/components/button/style.css.ts +64 -0
- 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 +15 -0
- package/s/components/tabs/component.ts +70 -0
- package/s/components/tabs/control.ts +31 -0
- package/s/components/tabs/style.css.ts +43 -0
- package/s/demo/aura-views.ts +6 -0
- package/s/demo/demo.bundle.ts +287 -14
- package/s/demo/demo.css +3 -1
- package/s/demo/utils/lipsum.ts +19 -0
- package/s/demo/views/demonstration/style.css.ts +18 -2
- package/s/demo/views/demonstration/view.ts +24 -16
- 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 +86 -0
- package/s/themes/index.barrel.ts +2 -1
- package/s/themes/index.ts +1 -0
- package/s/themes/infra/css-vars.ts +41 -0
- package/s/themes/plain.css.ts +11 -0
- package/s/utils/states.ts +15 -0
- 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.js +63 -0
- package/x/components/button/style.css.js.map +1 -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.d.ts +2 -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 +12 -0
- package/x/components/raw-components.js +13 -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 +60 -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 +42 -0
- package/x/components/tabs/style.css.js.map +1 -0
- package/x/demo/aura-views.d.ts +15 -0
- package/x/demo/aura-views.js +4 -0
- package/x/demo/aura-views.js.map +1 -0
- package/x/demo/demo.bundle.js +280 -14
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +561 -45
- 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 +18 -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 +20 -12
- 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 +463 -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 +390 -0
- package/x/install/plain.bundle.min.js.map +7 -0
- package/x/shiny.d.ts +47 -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 +85 -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 +14 -0
- package/x/themes/infra/css-vars.js +21 -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 +10 -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/copy → components/button}/style.css.d.ts +0 -0
- /package/x/{ui/example → components/copy}/style.css.d.ts +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {dom, view} from "@e280/sly"
|
|
4
|
+
import styleCss from "./style.css.js"
|
|
5
|
+
import {TabControl} from "./control.js"
|
|
6
|
+
import {foundationCss} from "../foundation.css.js"
|
|
7
|
+
import {ShinyContext, ShinyElement} from "../framework.js"
|
|
8
|
+
|
|
9
|
+
export class ShinyTabs extends (
|
|
10
|
+
view(use => (context: ShinyContext, controlOption?: TabControl) => {
|
|
11
|
+
use.name("shiny-tabs")
|
|
12
|
+
use.styles(foundationCss, context.theme, styleCss)
|
|
13
|
+
|
|
14
|
+
const attrs = use.attrs.spec({index: Number})
|
|
15
|
+
const control = use.once(() => controlOption ?? new TabControl(attrs.index ?? 0))
|
|
16
|
+
const $tabs = use.signal<HTMLElement[]>([])
|
|
17
|
+
const $panels = use.signal<HTMLElement[]>([])
|
|
18
|
+
|
|
19
|
+
async function tabchange(event: Event) {
|
|
20
|
+
const slot = event.currentTarget! as HTMLSlotElement
|
|
21
|
+
await $tabs.set(slot.assignedElements() as HTMLElement[])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async function panelchange(event: Event) {
|
|
25
|
+
const slot = event.currentTarget! as HTMLSlotElement
|
|
26
|
+
await $panels.set(slot.assignedElements() as HTMLElement[])
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
attrs.index = control.$index()
|
|
30
|
+
control.length = $tabs().length
|
|
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
|
+
|
|
38
|
+
for (const [index, tab] of $tabs().entries()) {
|
|
39
|
+
const active = (index === control.index)
|
|
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)
|
|
47
|
+
tab.onclick = () => control.setIndex(index)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (const [index, tab] of $panels().entries()) {
|
|
51
|
+
const active = (index === control.index)
|
|
52
|
+
dom.attrs(tab).booleans.active = active
|
|
53
|
+
dom.attrs(tab).booleans.hidden = !active
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return html`
|
|
57
|
+
<slot part=tabs @slotchange="${tabchange}"></slot>
|
|
58
|
+
<slot part=panels name=panel @slotchange="${panelchange}"></slot>
|
|
59
|
+
`
|
|
60
|
+
})
|
|
61
|
+
.component(class extends ShinyElement {
|
|
62
|
+
control = new TabControl()
|
|
63
|
+
get index() { return this.control.index }
|
|
64
|
+
get length() { return this.control.length }
|
|
65
|
+
setIndex = this.control.setIndex.bind(this.control)
|
|
66
|
+
shimmy = this.control.shimmy.bind(this.control)
|
|
67
|
+
})
|
|
68
|
+
.props(el => [el.context, el.control] as const)
|
|
69
|
+
) {}
|
|
70
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import {signal} from "@e280/strata"
|
|
3
|
+
|
|
4
|
+
export class TabControl {
|
|
5
|
+
length = 1
|
|
6
|
+
$index = signal(0)
|
|
7
|
+
|
|
8
|
+
constructor(start = 0) {
|
|
9
|
+
this.$index.value = start
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
clamp(index: number) {
|
|
13
|
+
index = Math.min(index, this.length - 1)
|
|
14
|
+
index = Math.max(index, 0)
|
|
15
|
+
return index
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get index() {
|
|
19
|
+
return this.clamp(this.$index.get())
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async setIndex(index: number) {
|
|
23
|
+
return this.$index.set(index)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async shimmy(delta: number) {
|
|
27
|
+
const index = this.clamp(this.index + delta)
|
|
28
|
+
return this.setIndex(index)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
export default css`@layer view {
|
|
4
|
+
|
|
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
|
+
} `
|
|
43
|
+
|
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,286 @@ 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="demo-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 = [
|
|
57
|
+
Demonstration({
|
|
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
|
+
|
|
24
134
|
Demonstration({
|
|
25
|
-
|
|
26
|
-
name: "shiny-copy",
|
|
135
|
+
name: "tabs",
|
|
27
136
|
explain: html`
|
|
28
|
-
<p>button
|
|
137
|
+
<p>button bar. panels optional.</p>
|
|
29
138
|
`,
|
|
30
|
-
|
|
31
|
-
|
|
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
|
+
}
|
|
32
190
|
`,
|
|
33
|
-
|
|
34
|
-
|
|
191
|
+
}),
|
|
192
|
+
|
|
193
|
+
Demonstration({
|
|
194
|
+
name: "copy",
|
|
195
|
+
explain: html`
|
|
196
|
+
<p>click-to-copy text button.</p>
|
|
35
197
|
`,
|
|
198
|
+
snippets: [
|
|
199
|
+
[labels.html, `
|
|
200
|
+
<shiny-copy text="hello world"></shiny-copy>
|
|
201
|
+
`],
|
|
202
|
+
[labels.view, `
|
|
203
|
+
ShinyCopy("hello world")
|
|
204
|
+
`],
|
|
205
|
+
[labels.css, `
|
|
206
|
+
shiny-copy {
|
|
207
|
+
font-size: 1em;
|
|
208
|
+
--happy: #0fa;
|
|
209
|
+
--angry: #f50;
|
|
210
|
+
--lame: #8888;
|
|
211
|
+
--inactive-opacity: 0.5;
|
|
212
|
+
}
|
|
213
|
+
`],
|
|
214
|
+
],
|
|
36
215
|
content: views.ShinyCopy("hello world"),
|
|
216
|
+
style: css`
|
|
217
|
+
.content sly-view {
|
|
218
|
+
font-size: 4em;
|
|
219
|
+
}
|
|
220
|
+
`,
|
|
221
|
+
}),
|
|
222
|
+
|
|
223
|
+
Demonstration({
|
|
224
|
+
name: "drawer",
|
|
225
|
+
explain: html`
|
|
226
|
+
<p>slide-out panel. button optional.</p>
|
|
227
|
+
`,
|
|
228
|
+
snippets: [
|
|
229
|
+
[labels.html, `
|
|
230
|
+
<shiny-drawer button side=left>
|
|
231
|
+
<header>example</header>
|
|
232
|
+
<section slot=plate>
|
|
233
|
+
lorem kettlebell..
|
|
234
|
+
</section>
|
|
235
|
+
</shiny-drawer>
|
|
236
|
+
`],
|
|
237
|
+
[labels.view, `
|
|
238
|
+
ShinyDrawer
|
|
239
|
+
.props({button: true, side: "left"})
|
|
240
|
+
.children(html\`
|
|
241
|
+
<header>example</header>
|
|
242
|
+
<section slot=plate>
|
|
243
|
+
lorem kettlebell..
|
|
244
|
+
</section>
|
|
245
|
+
\`)
|
|
246
|
+
.render()
|
|
247
|
+
`],
|
|
248
|
+
[labels.css, `
|
|
249
|
+
shiny-drawer {
|
|
250
|
+
--button-size: 2em;
|
|
251
|
+
--anim-duration: 200ms;
|
|
252
|
+
--blanket-backdrop-filter: blur(0.5em);
|
|
253
|
+
--blanket-bg: color-mix(
|
|
254
|
+
in oklab,
|
|
255
|
+
transparent,
|
|
256
|
+
var(--bg)
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
`],
|
|
260
|
+
],
|
|
261
|
+
content: views.ShinyDrawer
|
|
262
|
+
.props({button: true})
|
|
263
|
+
.children(html`
|
|
264
|
+
<header>
|
|
265
|
+
<h2>example drawer</h2>
|
|
266
|
+
<p>you can put any content in here.</p>
|
|
267
|
+
<p class=lipsum>${lipsum()}</p>
|
|
268
|
+
</header>
|
|
269
|
+
<section slot=plate>
|
|
270
|
+
<p class=lipsum>${lipsum()}</p>
|
|
271
|
+
<p class=lipsum>${lipsum()}</p>
|
|
272
|
+
</section>
|
|
273
|
+
`)
|
|
274
|
+
.render(),
|
|
275
|
+
style: css`
|
|
276
|
+
.content sly-view {
|
|
277
|
+
border-radius: 0.5em;
|
|
278
|
+
overflow: hidden;
|
|
279
|
+
--button-size: 3em;
|
|
280
|
+
|
|
281
|
+
header {
|
|
282
|
+
> * + * { margin-top: 0.5em; }
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
section {
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: column;
|
|
288
|
+
justify-content: center;
|
|
289
|
+
min-height: 100%;
|
|
290
|
+
padding: 1em;
|
|
291
|
+
padding-top: 3em;
|
|
292
|
+
> * + * { margin-top: 0.5em; }
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
`,
|
|
37
296
|
}),
|
|
38
297
|
]
|
|
298
|
+
|
|
299
|
+
return html`
|
|
300
|
+
<div class=themes>
|
|
301
|
+
<span>theme</span>
|
|
302
|
+
${auraViews.ShinyTabs
|
|
303
|
+
.props(tabControl)
|
|
304
|
+
.children(viewsets.map(viewset => html`
|
|
305
|
+
${auraViews.ShinyButton.props().children(viewset.label).render()}
|
|
306
|
+
`))
|
|
307
|
+
.render()}
|
|
308
|
+
</div>
|
|
309
|
+
|
|
310
|
+
${demonstrations}
|
|
311
|
+
`
|
|
39
312
|
})})
|
|
40
313
|
|
|
41
|
-
console.log("✨
|
|
314
|
+
console.log("✨shiny")
|
|
42
315
|
|
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;
|
|
@@ -47,6 +53,14 @@ export default css`
|
|
|
47
53
|
color: var(--prime);
|
|
48
54
|
}
|
|
49
55
|
|
|
56
|
+
[view="shiny-tabs"] {
|
|
57
|
+
gap: 0.5em;
|
|
58
|
+
&::part(tabs) {
|
|
59
|
+
font-size: 0.8em;
|
|
60
|
+
opacity: 0.8;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
.codes {
|
|
51
65
|
display: flex;
|
|
52
66
|
flex-direction: column;
|
|
@@ -78,6 +92,7 @@ export default css`
|
|
|
78
92
|
white-space: pre;
|
|
79
93
|
text-wrap: wrap;
|
|
80
94
|
tab-size: 2;
|
|
95
|
+
word-break: break-word;
|
|
81
96
|
|
|
82
97
|
font-size: 0.8em;
|
|
83
98
|
font-family: monospace;
|
|
@@ -87,6 +102,7 @@ export default css`
|
|
|
87
102
|
|
|
88
103
|
[view="shiny-copy"] {
|
|
89
104
|
flex: 0 0 0;
|
|
105
|
+
font-size: 1.5em;
|
|
90
106
|
padding: 0.2em;
|
|
91
107
|
}
|
|
92
108
|
}
|
|
@@ -104,5 +120,5 @@ export default css`
|
|
|
104
120
|
border: 1px dashed #fff4;
|
|
105
121
|
}
|
|
106
122
|
|
|
107
|
-
`
|
|
123
|
+
}`
|
|
108
124
|
|
|
@@ -1,44 +1,52 @@
|
|
|
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
|
-
use.name(options.name)
|
|
19
|
-
use.styles(
|
|
17
|
+
use.name(`demo-${options.name}`)
|
|
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
|
}
|
|
33
32
|
|
|
34
33
|
return html`
|
|
35
34
|
<div class=meta>
|
|
36
|
-
<h2>✨
|
|
35
|
+
<h2>✨ shiny-${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]) => (
|
|
41
|
+
auraViews.ShinyButton
|
|
42
|
+
.props()
|
|
43
|
+
.attr("plain", true)
|
|
44
|
+
.children(label.button)
|
|
45
|
+
.render()
|
|
46
|
+
))}
|
|
47
|
+
${options.snippets.map(([label, code]) => codeblock(label.text, code))}
|
|
48
|
+
`)
|
|
49
|
+
.render()}
|
|
42
50
|
</div>
|
|
43
51
|
|
|
44
52
|
<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>
|