@e280/shiny 0.1.0-2 → 0.1.0-4
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 +19 -0
- package/package.json +2 -2
- package/s/{ui → components}/copy/style.css.ts +1 -1
- package/s/components/drawer/component.ts +74 -0
- package/s/components/drawer/drawer.ts +31 -0
- package/s/components/drawer/style.css.ts +107 -0
- package/s/{ui → components}/example/component.ts +2 -1
- package/s/{ui → components}/raw-components.ts +2 -0
- package/s/demo/demo.bundle.ts +110 -9
- package/s/demo/utils/lipsum.ts +19 -0
- package/s/demo/views/demonstration/style.css.ts +1 -0
- package/s/demo/views/demonstration/view.ts +5 -6
- package/s/icons/tabler/menu-2.svg.ts +4 -0
- package/s/icons/tabler/x.svg.ts +4 -0
- package/s/index.ts +3 -3
- package/s/shiny.ts +2 -2
- package/s/themes/basic.css.ts +3 -0
- package/x/{ui → components}/copy/component.js +1 -1
- package/x/components/copy/component.js.map +1 -0
- package/x/{ui → components}/copy/style.css.js +1 -1
- package/x/components/copy/style.css.js.map +1 -0
- package/x/components/drawer/component.d.ts +381 -0
- package/x/components/drawer/component.js +66 -0
- package/x/components/drawer/component.js.map +1 -0
- package/x/components/drawer/drawer.d.ts +9 -0
- package/x/components/drawer/drawer.js +24 -0
- package/x/components/drawer/drawer.js.map +1 -0
- package/x/components/drawer/style.css.js +106 -0
- package/x/components/drawer/style.css.js.map +1 -0
- package/x/{ui → components}/example/component.js +2 -1
- 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.map +1 -0
- package/x/components/framework.js.map +1 -0
- package/x/{ui → components}/raw-components.d.ts +2 -0
- package/x/{ui → components}/raw-components.js +2 -0
- package/x/components/raw-components.js.map +1 -0
- package/x/demo/demo.bundle.js +108 -9
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +233 -30
- package/x/demo/demo.bundle.min.js.map +4 -4
- 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 +1 -0
- package/x/demo/views/demonstration/style.css.js.map +1 -1
- package/x/demo/views/demonstration/view.d.ts +3 -2
- package/x/demo/views/demonstration/view.js +2 -3
- 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 +3 -3
- package/x/index.html +2 -2
- package/x/index.js +3 -3
- package/x/index.js.map +1 -1
- package/x/install.bundle.min.js +146 -14
- package/x/install.bundle.min.js.map +4 -4
- package/x/shiny.d.ts +20 -3
- package/x/shiny.js +1 -1
- package/x/shiny.js.map +1 -1
- package/x/themes/basic.css.js +3 -0
- package/x/themes/basic.css.js.map +1 -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.map +0 -1
- package/x/ui/framework.js.map +0 -1
- package/x/ui/raw-components.js.map +0 -1
- package/s/{ui → components}/copy/component.ts +1 -1
- /package/s/{ui → components}/example/style.css.ts +0 -0
- /package/s/{ui → components}/framework.ts +0 -0
- /package/x/{ui → components}/copy/component.d.ts +0 -0
- /package/x/{ui → components}/copy/style.css.d.ts +0 -0
- /package/x/{ui/example → components/drawer}/style.css.d.ts +0 -0
- /package/x/{ui → components}/example/component.d.ts +0 -0
- /package/x/{ui → components}/example/style.css.js +0 -0
- /package/x/{ui → components}/framework.d.ts +0 -0
- /package/x/{ui → components}/framework.js +0 -0
package/README.md
CHANGED
|
@@ -80,6 +80,25 @@
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
|
|
83
|
+
<br/><br/>
|
|
84
|
+
|
|
85
|
+
## ✨ page-wide css customization
|
|
86
|
+
- put this in your `<head>` and you can customize colors and stuff
|
|
87
|
+
```html
|
|
88
|
+
<style>
|
|
89
|
+
:root {
|
|
90
|
+
--shiny-bg: #111;
|
|
91
|
+
--shiny-alpha: #afa;
|
|
92
|
+
--shiny-good: #0f4;
|
|
93
|
+
--shiny-bad: #f40;
|
|
94
|
+
--shiny-invalid: #8888;
|
|
95
|
+
--shiny-inactive-opacity: 0.5;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
83
102
|
<br/><br/>
|
|
84
103
|
|
|
85
104
|
## ✨shiny is by e280
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e280/shiny",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-4",
|
|
4
4
|
"description": "✨ web ui components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"s"
|
|
15
15
|
],
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@e280/sly": "^0.2.0-
|
|
17
|
+
"@e280/sly": "^0.2.0-24",
|
|
18
18
|
"lit": "^3.3.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {dom, view} from "@e280/sly"
|
|
4
|
+
|
|
5
|
+
import {Drawer} from "./drawer.js"
|
|
6
|
+
import styleCss from "./style.css.js"
|
|
7
|
+
import xSvg from "../../icons/tabler/x.svg.js"
|
|
8
|
+
import menu2Svg from "../../icons/tabler/menu-2.svg.js"
|
|
9
|
+
import {ShinyContext, ShinyElement} from "../framework.js"
|
|
10
|
+
|
|
11
|
+
export class ShinyDrawer extends (
|
|
12
|
+
view(use => (context: ShinyContext, options: {button?: boolean, drawer?: Drawer} = {}) => {
|
|
13
|
+
use.name("shiny-drawer")
|
|
14
|
+
use.styles(context.theme, styleCss)
|
|
15
|
+
|
|
16
|
+
const button = options.button ?? true
|
|
17
|
+
const drawer = use.once(() => (options.drawer ?? new Drawer()))
|
|
18
|
+
|
|
19
|
+
use.mount(() => dom.events(window, {keydown: (event: KeyboardEvent) => {
|
|
20
|
+
if (event.code === "Escape")
|
|
21
|
+
drawer.close()
|
|
22
|
+
}}))
|
|
23
|
+
|
|
24
|
+
dom.attrs(use.element).booleans.open = drawer.isOpen
|
|
25
|
+
|
|
26
|
+
return html`
|
|
27
|
+
<div class=shell ?data-open="${drawer.isOpen}">
|
|
28
|
+
<slot name=plate ?inert="${drawer.isOpen}"></slot>
|
|
29
|
+
|
|
30
|
+
<div class=clipper>
|
|
31
|
+
<div part=blanket @click="${drawer.close}" ?inert="${!drawer.isOpen}"></div>
|
|
32
|
+
|
|
33
|
+
<div part=tray>
|
|
34
|
+
<slot ?inert="${!drawer.isOpen}"></slot>
|
|
35
|
+
|
|
36
|
+
${button
|
|
37
|
+
? html`
|
|
38
|
+
<button @click="${drawer.toggle}">
|
|
39
|
+
${drawer.isOpen
|
|
40
|
+
? html`
|
|
41
|
+
<slot name=button-x>
|
|
42
|
+
${xSvg}
|
|
43
|
+
</slot>
|
|
44
|
+
`
|
|
45
|
+
: html`
|
|
46
|
+
<slot name=button>
|
|
47
|
+
${menu2Svg}
|
|
48
|
+
</slot>
|
|
49
|
+
`}
|
|
50
|
+
</button>
|
|
51
|
+
`
|
|
52
|
+
: null}
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
`
|
|
57
|
+
})
|
|
58
|
+
.component(class extends ShinyElement {
|
|
59
|
+
attrs = dom.attrs(this).spec({
|
|
60
|
+
open: Boolean,
|
|
61
|
+
button: Boolean,
|
|
62
|
+
})
|
|
63
|
+
drawer = new Drawer(this.attrs.open)
|
|
64
|
+
get isOpen() { return this.drawer.isOpen }
|
|
65
|
+
get toggle() { return this.drawer.toggle }
|
|
66
|
+
get open() { return this.drawer.open }
|
|
67
|
+
get close() { return this.drawer.close }
|
|
68
|
+
})
|
|
69
|
+
.props(el => [el.context, {
|
|
70
|
+
drawer: el.drawer,
|
|
71
|
+
button: el.attrs.button,
|
|
72
|
+
}] as const)
|
|
73
|
+
) {}
|
|
74
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import {signal} from "@e280/strata"
|
|
3
|
+
|
|
4
|
+
export class Drawer {
|
|
5
|
+
$open = signal(false)
|
|
6
|
+
|
|
7
|
+
constructor(startOpen = false) {
|
|
8
|
+
if (startOpen) this.$open.set(true)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get isOpen() {
|
|
12
|
+
return this.$open.get()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async setOpen(value: boolean) {
|
|
16
|
+
return this.$open.set(value)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
open = async() => {
|
|
20
|
+
await this.setOpen(true)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
close = async() => {
|
|
24
|
+
await this.setOpen(false)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
toggle = async() => {
|
|
28
|
+
return this.setOpen(!this.isOpen)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
export default css`
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
--button-size: 2em;
|
|
10
|
+
--drawer-height: auto;
|
|
11
|
+
--anim-duration: 200ms;
|
|
12
|
+
--blanket-bg: #1118;
|
|
13
|
+
--blanket-backdrop-filter: blur(0.5em);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.shell {
|
|
17
|
+
position: relative;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
|
|
21
|
+
[part="blanket"] {
|
|
22
|
+
opacity: 0;
|
|
23
|
+
|
|
24
|
+
content: "";
|
|
25
|
+
display: block;
|
|
26
|
+
position: absolute;
|
|
27
|
+
inset: 0;
|
|
28
|
+
|
|
29
|
+
background: var(--blanket-bg);
|
|
30
|
+
backdrop-filter: var(--blanket-backdrop-filter);
|
|
31
|
+
|
|
32
|
+
will-change: opacity;
|
|
33
|
+
transition: all var(--anim-duration) ease;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.clipper {
|
|
37
|
+
pointer-events: none;
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset: 0;
|
|
40
|
+
width: 100%;
|
|
41
|
+
height: 100%;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
> * { pointer-events: all; }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[part="tray"] {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: 0;
|
|
49
|
+
width: calc(100% - var(--button-size));
|
|
50
|
+
height: 100%;
|
|
51
|
+
|
|
52
|
+
opacity: 1;
|
|
53
|
+
transform: translateX(-100%);
|
|
54
|
+
will-change: opacity, transform;
|
|
55
|
+
transition: all var(--anim-duration) ease;
|
|
56
|
+
|
|
57
|
+
> slot {
|
|
58
|
+
display: block;
|
|
59
|
+
height: var(--drawer-height);
|
|
60
|
+
max-height: 100%;
|
|
61
|
+
overflow-y: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
> button {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: 0;
|
|
67
|
+
left: 100%;
|
|
68
|
+
|
|
69
|
+
opacity: var(--inactive-opacity);
|
|
70
|
+
background: transparent;
|
|
71
|
+
border: none;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
|
|
74
|
+
&:is(:hover, :focus-visible) {
|
|
75
|
+
opacity: 1;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
> slot {
|
|
79
|
+
display: contents;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
svg {
|
|
83
|
+
width: var(--button-size);
|
|
84
|
+
height: var(--button-size);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
slot[name="plate"] {
|
|
90
|
+
display: block;
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&[data-open] {
|
|
96
|
+
[part="blanket"] {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
}
|
|
99
|
+
[part="tray"] {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
transform: translateX(0%);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
`
|
|
107
|
+
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
import {dom, view} from "@e280/sly"
|
|
3
2
|
import {html} from "lit"
|
|
3
|
+
import {dom, view} from "@e280/sly"
|
|
4
4
|
import styleCss from "./style.css.js"
|
|
5
5
|
import {ShinyContext, ShinyElement} from "../framework.js"
|
|
6
6
|
|
|
7
7
|
export class ShinyExample extends (
|
|
8
8
|
view(use => (context: ShinyContext, start: number) => {
|
|
9
|
+
use.name("shiny-example")
|
|
9
10
|
use.styles(context.theme, styleCss)
|
|
10
11
|
|
|
11
12
|
const $count = use.signal(start)
|
package/s/demo/demo.bundle.ts
CHANGED
|
@@ -4,9 +4,21 @@ import {dom, view} from "@e280/sly"
|
|
|
4
4
|
import {shiny} from "../shiny.js"
|
|
5
5
|
import {basic} from "../themes/basic.css.js"
|
|
6
6
|
import {Demonstration} from "./views/demonstration/view.js"
|
|
7
|
+
import { makeLipsumDispenser } from "./utils/lipsum.js"
|
|
7
8
|
|
|
8
9
|
const {views} = shiny({theme: basic})
|
|
9
10
|
|
|
11
|
+
const labels = {
|
|
12
|
+
html: "html web component",
|
|
13
|
+
view: "sly view",
|
|
14
|
+
css: "custom css",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const lipsum = (() => {
|
|
18
|
+
const dispenser = makeLipsumDispenser()
|
|
19
|
+
return () => dispenser.takeRandom()
|
|
20
|
+
})()
|
|
21
|
+
|
|
10
22
|
dom.register({ShinyDemo: view.component(use => {
|
|
11
23
|
use.styles(css`
|
|
12
24
|
:host {
|
|
@@ -14,10 +26,6 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
14
26
|
flex-direction: column;
|
|
15
27
|
gap: 1em;
|
|
16
28
|
}
|
|
17
|
-
|
|
18
|
-
[view="shiny-copy"]::part(content) {
|
|
19
|
-
font-size: 4em;
|
|
20
|
-
}
|
|
21
29
|
`)
|
|
22
30
|
|
|
23
31
|
return [
|
|
@@ -27,13 +35,106 @@ dom.register({ShinyDemo: view.component(use => {
|
|
|
27
35
|
explain: html`
|
|
28
36
|
<p>button for click-to-copy text</p>
|
|
29
37
|
`,
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
snippets: [
|
|
39
|
+
[labels.html, `
|
|
40
|
+
<shiny-copy text="hello world"></shiny-copy>
|
|
41
|
+
`],
|
|
42
|
+
[labels.view, `
|
|
43
|
+
ShinyCopy("hello world")
|
|
44
|
+
`],
|
|
45
|
+
[labels.css, `
|
|
46
|
+
shiny-copy {
|
|
47
|
+
font-size: 1em;
|
|
48
|
+
--good: #0f4;
|
|
49
|
+
--bad: #f40;
|
|
50
|
+
--invalid: #8888;
|
|
51
|
+
--inactive-opacity: 0.5;
|
|
52
|
+
}
|
|
53
|
+
`],
|
|
54
|
+
],
|
|
55
|
+
content: views.ShinyCopy("hello world"),
|
|
56
|
+
style: css`
|
|
57
|
+
.content sly-view {
|
|
58
|
+
font-size: 4em;
|
|
59
|
+
}
|
|
60
|
+
`,
|
|
61
|
+
}),
|
|
62
|
+
Demonstration({
|
|
63
|
+
views,
|
|
64
|
+
name: "shiny-drawer",
|
|
65
|
+
explain: html`
|
|
66
|
+
<p>slide-out panel with optional burger button</p>
|
|
32
67
|
`,
|
|
33
|
-
|
|
34
|
-
|
|
68
|
+
snippets: [
|
|
69
|
+
[labels.html, `
|
|
70
|
+
<shiny-drawer button>
|
|
71
|
+
<header>example</header>
|
|
72
|
+
<section slot=plate>lorem kettlebell..</section>
|
|
73
|
+
</shiny-drawer>
|
|
74
|
+
`],
|
|
75
|
+
[labels.view, `
|
|
76
|
+
ShinyDrawer.props().children(html\`
|
|
77
|
+
<header>example</header>
|
|
78
|
+
<section slot=plate>lorem kettlebell..</section>
|
|
79
|
+
\`).render()
|
|
80
|
+
`],
|
|
81
|
+
[labels.css, `
|
|
82
|
+
shiny-drawer {
|
|
83
|
+
--button-size: 2em;
|
|
84
|
+
--drawer-height: auto;
|
|
85
|
+
--anim-duration: 200ms;
|
|
86
|
+
--blanket-bg: #1118;
|
|
87
|
+
--blanket-backdrop-filter: blur(0.5em);
|
|
88
|
+
--inactive-opacity: 0.5;
|
|
89
|
+
}
|
|
90
|
+
`],
|
|
91
|
+
],
|
|
92
|
+
content: views.ShinyDrawer.props()
|
|
93
|
+
.children(html`
|
|
94
|
+
<header>
|
|
95
|
+
<h2>example drawer</h2>
|
|
96
|
+
<p>you can put any content in here.</p>
|
|
97
|
+
<p class=lipsum>${lipsum()}</p>
|
|
98
|
+
</header>
|
|
99
|
+
<section slot=plate>
|
|
100
|
+
<p class=lipsum>${lipsum()}</p>
|
|
101
|
+
</section>
|
|
102
|
+
`)
|
|
103
|
+
.render(),
|
|
104
|
+
style: css`
|
|
105
|
+
.content sly-view {
|
|
106
|
+
border-radius: 0.5em;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
--button-size: 3em;
|
|
109
|
+
|
|
110
|
+
p.lipsum {
|
|
111
|
+
opacity: 0.7;
|
|
112
|
+
font-family: serif;
|
|
113
|
+
font-style: italic;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
header {
|
|
117
|
+
padding: 0.5em;
|
|
118
|
+
border-bottom-right-radius: 0.5em;
|
|
119
|
+
background: linear-gradient(
|
|
120
|
+
to top right,
|
|
121
|
+
#00a9dd69,
|
|
122
|
+
#70ffd77a
|
|
123
|
+
);
|
|
124
|
+
> * + * { margin-top: 0.5em; }
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
section {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
min-height: 100%;
|
|
132
|
+
padding: 1em;
|
|
133
|
+
padding-top: 3em;
|
|
134
|
+
> * + * { margin-top: 0.5em; }
|
|
135
|
+
}
|
|
136
|
+
}
|
|
35
137
|
`,
|
|
36
|
-
content: views.ShinyCopy("hello world"),
|
|
37
138
|
}),
|
|
38
139
|
]
|
|
39
140
|
})})
|
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {html} from "lit"
|
|
2
|
+
import {CSSResultGroup, html} from "lit"
|
|
3
3
|
import {untab} from "@e280/stz"
|
|
4
4
|
import {Content, view} from "@e280/sly"
|
|
5
5
|
import styleCss from "./style.css.js"
|
|
@@ -10,13 +10,13 @@ export const Demonstration = view(use => (options: {
|
|
|
10
10
|
name: string
|
|
11
11
|
explain: Content
|
|
12
12
|
views: ShinyViews
|
|
13
|
-
|
|
14
|
-
exampleView: string
|
|
13
|
+
snippets: [label: string, code: string][]
|
|
15
14
|
content: Content
|
|
15
|
+
style: CSSResultGroup
|
|
16
16
|
}) => {
|
|
17
17
|
|
|
18
18
|
use.name(options.name)
|
|
19
|
-
use.styles(basic, styleCss)
|
|
19
|
+
use.styles(basic, styleCss, options.style)
|
|
20
20
|
|
|
21
21
|
function codeblock(heading: string, code: string) {
|
|
22
22
|
const cleanCode = untab(code).trim()
|
|
@@ -36,8 +36,7 @@ export const Demonstration = view(use => (options: {
|
|
|
36
36
|
<h2>✨ ${options.name}</h2>
|
|
37
37
|
<div class=explain>${options.explain}</div>
|
|
38
38
|
<div class=codes>
|
|
39
|
-
${
|
|
40
|
-
${codeblock("sly view", options.exampleView)}
|
|
39
|
+
${options.snippets.map(([label, code]) => codeblock(label, code))}
|
|
41
40
|
</div>
|
|
42
41
|
</div>
|
|
43
42
|
|
|
@@ -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.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
export * from "./themes/index.js"
|
|
3
3
|
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
4
|
+
export * from "./components/example/component.js"
|
|
5
|
+
export * from "./components/copy/component.js"
|
|
6
|
+
export * from "./components/framework.js"
|
|
7
7
|
|
|
8
8
|
export * from "./shiny.js"
|
|
9
9
|
|
package/s/shiny.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import {contextualizeComponents, getViews} from "@e280/sly"
|
|
3
|
-
import {ShinyContext} from "./
|
|
4
|
-
import {rawComponents} from "./
|
|
3
|
+
import {ShinyContext} from "./components/framework.js"
|
|
4
|
+
import {rawComponents} from "./components/raw-components.js"
|
|
5
5
|
|
|
6
6
|
export function shiny(context: ShinyContext) {
|
|
7
7
|
const components = contextualizeComponents(context, rawComponents)
|
package/s/themes/basic.css.ts
CHANGED
|
@@ -7,11 +7,14 @@ ${cssReset}
|
|
|
7
7
|
|
|
8
8
|
:host {
|
|
9
9
|
display: block;
|
|
10
|
+
|
|
10
11
|
--bg: var(--shiny-bg, #111);
|
|
11
12
|
--alpha: var(--shiny-alpha, #afa);
|
|
12
13
|
--good: var(--shiny-good, #0f4);
|
|
13
14
|
--bad: var(--shiny-bad, #f40);
|
|
14
15
|
--invalid: var(--shiny-invalid, #8888);
|
|
16
|
+
|
|
17
|
+
--inactive-opacity: var(--shiny-inactive-opacity, 0.5);
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
`
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
import { ShinyElement } from "../framework.js";
|
|
6
6
|
import clipboardSvg from "../../icons/tabler/clipboard.svg.js";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