@benev/web 0.1.4 → 0.2.0
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 +5 -2
- package/package.json +5 -5
- package/s/css/parts/common.csstext.ts +6 -3
- package/s/css/parts/vars.csstext.ts +2 -0
- package/s/dom/duplexes/account/view.ts +18 -0
- package/s/dom/duplexes/footer/view.ts +13 -0
- package/s/dom/duplexes/header/view.ts +25 -0
- package/s/dom/{loader → duplexes/loader}/loader.ts +1 -1
- package/s/dom/{loader → duplexes/loader}/view.ts +5 -4
- package/s/dom/{menu → duplexes/menu}/style.css.ts +7 -3
- package/s/dom/{menu → duplexes/menu}/utils/on-keypress.ts +9 -5
- package/s/dom/{menu → duplexes/menu}/view.ts +7 -6
- package/s/dom/views/dashboard/style.css.ts +49 -0
- package/s/dom/views/dashboard/view.ts +55 -0
- package/s/index.html.ts +1 -3
- package/s/index.ts +9 -4
- package/s/main.bundle.ts +26 -4
- package/s/vitals/setup.ts +17 -17
- package/s/vitals/shell.ts +3 -1
- package/x/css/parts/common.csstext.js +6 -3
- package/x/css/parts/common.csstext.js.map +1 -1
- package/x/css/parts/vars.csstext.js +2 -0
- package/x/css/parts/vars.csstext.js.map +1 -1
- package/x/dom/duplexes/account/account.js.map +1 -0
- package/x/dom/duplexes/account/style.css.js.map +1 -0
- package/x/dom/duplexes/account/view.d.ts +2 -0
- package/x/dom/duplexes/account/view.js +13 -0
- package/x/dom/duplexes/account/view.js.map +1 -0
- package/x/dom/duplexes/footer/style.css.js.map +1 -0
- package/x/dom/duplexes/footer/view.d.ts +1 -0
- package/x/dom/duplexes/footer/view.js +10 -0
- package/x/dom/duplexes/footer/view.js.map +1 -0
- package/x/dom/duplexes/header/style.css.js.map +1 -0
- package/x/dom/duplexes/header/view.d.ts +2 -0
- package/x/dom/duplexes/header/view.js +19 -0
- package/x/dom/duplexes/header/view.js.map +1 -0
- package/x/dom/{loader → duplexes/loader}/loader.js +1 -1
- package/x/dom/duplexes/loader/loader.js.map +1 -0
- package/x/dom/duplexes/loader/style.css.js.map +1 -0
- package/x/dom/duplexes/loader/view.d.ts +1 -0
- package/x/dom/duplexes/loader/view.js +20 -0
- package/x/dom/duplexes/loader/view.js.map +1 -0
- package/x/dom/{menu → duplexes/menu}/style.css.js +7 -3
- package/x/dom/duplexes/menu/style.css.js.map +1 -0
- package/x/dom/duplexes/menu/utils/click-backdrop.js.map +1 -0
- package/x/dom/{menu → duplexes/menu}/utils/on-keypress.js +4 -4
- package/x/dom/duplexes/menu/utils/on-keypress.js.map +1 -0
- package/x/dom/duplexes/menu/utils/use-after-first-render.js.map +1 -0
- package/x/dom/duplexes/menu/view.d.ts +2 -0
- package/x/dom/{menu → duplexes/menu}/view.js +6 -5
- package/x/dom/duplexes/menu/view.js.map +1 -0
- package/x/dom/views/dashboard/style.css.d.ts +2 -0
- package/x/dom/views/dashboard/style.css.js +48 -0
- package/x/dom/views/dashboard/style.css.js.map +1 -0
- package/x/dom/views/dashboard/view.d.ts +10 -0
- package/x/dom/views/dashboard/view.js +39 -0
- package/x/dom/views/dashboard/view.js.map +1 -0
- package/x/index.d.ts +8 -4
- package/x/index.html +10 -7
- package/x/index.html.js +1 -3
- package/x/index.html.js.map +1 -1
- package/x/index.js +8 -4
- package/x/index.js.map +1 -1
- package/x/main.bundle.js +23 -4
- package/x/main.bundle.js.map +1 -1
- package/x/main.bundle.min.js +264 -186
- package/x/main.bundle.min.js.map +4 -4
- package/x/vitals/setup.d.ts +3 -3
- package/x/vitals/setup.js +15 -17
- package/x/vitals/setup.js.map +1 -1
- package/x/vitals/shell.d.ts +1 -0
- package/x/vitals/shell.js +3 -1
- package/x/vitals/shell.js.map +1 -1
- package/s/dom/account/view.ts +0 -16
- package/s/dom/footer/view.ts +0 -13
- package/s/dom/header/view.ts +0 -25
- package/s/dom/tools/shadow-duplex.ts +0 -17
- package/x/dom/account/account.js.map +0 -1
- package/x/dom/account/style.css.js.map +0 -1
- package/x/dom/account/view.d.ts +0 -2
- package/x/dom/account/view.js +0 -11
- package/x/dom/account/view.js.map +0 -1
- package/x/dom/footer/style.css.js.map +0 -1
- package/x/dom/footer/view.d.ts +0 -1
- package/x/dom/footer/view.js +0 -10
- package/x/dom/footer/view.js.map +0 -1
- package/x/dom/header/style.css.js.map +0 -1
- package/x/dom/header/view.d.ts +0 -2
- package/x/dom/header/view.js +0 -19
- package/x/dom/header/view.js.map +0 -1
- package/x/dom/loader/loader.js.map +0 -1
- package/x/dom/loader/style.css.js.map +0 -1
- package/x/dom/loader/view.d.ts +0 -1
- package/x/dom/loader/view.js +0 -19
- package/x/dom/loader/view.js.map +0 -1
- package/x/dom/menu/style.css.js.map +0 -1
- package/x/dom/menu/utils/click-backdrop.js.map +0 -1
- package/x/dom/menu/utils/on-keypress.js.map +0 -1
- package/x/dom/menu/utils/use-after-first-render.js.map +0 -1
- package/x/dom/menu/view.d.ts +0 -2
- package/x/dom/menu/view.js.map +0 -1
- package/x/dom/tools/shadow-duplex.d.ts +0 -2
- package/x/dom/tools/shadow-duplex.js +0 -10
- package/x/dom/tools/shadow-duplex.js.map +0 -1
- /package/s/dom/{account → duplexes/account}/account.ts +0 -0
- /package/s/dom/{account → duplexes/account}/style.css.ts +0 -0
- /package/s/dom/{footer → duplexes/footer}/style.css.ts +0 -0
- /package/s/dom/{header → duplexes/header}/style.css.ts +0 -0
- /package/s/dom/{loader → duplexes/loader}/style.css.ts +0 -0
- /package/s/dom/{menu → duplexes/menu}/utils/click-backdrop.ts +0 -0
- /package/s/dom/{menu → duplexes/menu}/utils/use-after-first-render.ts +0 -0
- /package/x/dom/{account → duplexes/account}/account.d.ts +0 -0
- /package/x/dom/{account → duplexes/account}/account.js +0 -0
- /package/x/dom/{account → duplexes/account}/style.css.d.ts +0 -0
- /package/x/dom/{account → duplexes/account}/style.css.js +0 -0
- /package/x/dom/{footer → duplexes/footer}/style.css.d.ts +0 -0
- /package/x/dom/{footer → duplexes/footer}/style.css.js +0 -0
- /package/x/dom/{header → duplexes/header}/style.css.d.ts +0 -0
- /package/x/dom/{header → duplexes/header}/style.css.js +0 -0
- /package/x/dom/{loader → duplexes/loader}/loader.d.ts +0 -0
- /package/x/dom/{loader → duplexes/loader}/style.css.d.ts +0 -0
- /package/x/dom/{loader → duplexes/loader}/style.css.js +0 -0
- /package/x/dom/{menu → duplexes/menu}/style.css.d.ts +0 -0
- /package/x/dom/{menu → duplexes/menu}/utils/click-backdrop.d.ts +0 -0
- /package/x/dom/{menu → duplexes/menu}/utils/click-backdrop.js +0 -0
- /package/x/dom/{menu → duplexes/menu}/utils/on-keypress.d.ts +0 -0
- /package/x/dom/{menu → duplexes/menu}/utils/use-after-first-render.d.ts +0 -0
- /package/x/dom/{menu → duplexes/menu}/utils/use-after-first-render.js +0 -0
package/README.md
CHANGED
|
@@ -40,23 +40,25 @@ sdk toolkit for making an official benev website.
|
|
|
40
40
|
```
|
|
41
41
|
1. **typescript: install custom elements**
|
|
42
42
|
```ts
|
|
43
|
-
import {
|
|
43
|
+
import {register} from "@e280/sly"
|
|
44
44
|
import {setupBenev} from "@benev/web"
|
|
45
45
|
|
|
46
46
|
const benev = await setupBenev()
|
|
47
|
-
|
|
47
|
+
register(benev.elements)
|
|
48
48
|
```
|
|
49
49
|
- menu (the benev overlay menu)
|
|
50
50
|
```html
|
|
51
51
|
<benev-menu></benev-menu>
|
|
52
52
|
```
|
|
53
53
|
- you can control the menu via `benev.shell`, eg, `benev.shell.toggle()`
|
|
54
|
+
- sly view also available as `BenevMenu`.
|
|
54
55
|
- header (standard header with `b` button that opens menu)
|
|
55
56
|
```html
|
|
56
57
|
<benev-header>
|
|
57
58
|
<a href="https://benev.gg/">benev.gg</a>
|
|
58
59
|
</benev-header>
|
|
59
60
|
```
|
|
61
|
+
- sly view also available as `BenevHeader`.
|
|
60
62
|
- loader (loading screens)
|
|
61
63
|
```html
|
|
62
64
|
<benev-loader>
|
|
@@ -64,4 +66,5 @@ sdk toolkit for making an official benev website.
|
|
|
64
66
|
</benev-loader>
|
|
65
67
|
```
|
|
66
68
|
- you control it by creating a `new Loader(dom("benev-loader"))`
|
|
69
|
+
- sly view also available as `BenevLoader`.
|
|
67
70
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@benev/web",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "✨ benev web sdk",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"esbuild@0.28.2": true
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@e280/sly": "^0.4.
|
|
27
|
-
"@e280/strata": "^0.5.
|
|
26
|
+
"@e280/sly": "^0.4.14",
|
|
27
|
+
"@e280/strata": "^0.5.7",
|
|
28
28
|
"lit": "^3.3.3"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@e280/authlocal": "^0.3.10",
|
|
32
|
-
"@e280/kv": "^0.2.
|
|
32
|
+
"@e280/kv": "^0.2.6",
|
|
33
33
|
"@e280/renraku": "0.6.0-12",
|
|
34
|
-
"@e280/stz": "^0.4.
|
|
34
|
+
"@e280/stz": "^0.4.16"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@e280/hottie": "^0.1.7",
|
|
@@ -24,7 +24,10 @@ button, [benev-button] {
|
|
|
24
24
|
opacity: 0.3;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
&:
|
|
27
|
+
&:is(
|
|
28
|
+
:not([disabled], [benev-button~="naked"]),
|
|
29
|
+
[benev-button~="animated"]
|
|
30
|
+
) {
|
|
28
31
|
cursor: pointer;
|
|
29
32
|
transform: scale(100%);
|
|
30
33
|
transition: all var(--benev-anim) ease;
|
|
@@ -32,7 +35,7 @@ button, [benev-button] {
|
|
|
32
35
|
&:active { transform: scale(100%); filter: brightness(100%); }
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
&[benev-button
|
|
38
|
+
&[benev-button~="naked"] {
|
|
36
39
|
color: inherit;
|
|
37
40
|
background: transparent;
|
|
38
41
|
backdrop-filter: none;
|
|
@@ -45,7 +48,7 @@ button, [benev-button] {
|
|
|
45
48
|
text-transform: inherit;
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
&[benev-button
|
|
51
|
+
&[benev-button~="juicy"] {
|
|
49
52
|
opacity: 1;
|
|
50
53
|
color: black;
|
|
51
54
|
border: var(--benev-thick) solid var(--benev-prime);
|
|
@@ -17,6 +17,7 @@ export default css`
|
|
|
17
17
|
--benev-link: aqua;
|
|
18
18
|
--benev-b-size: 1.5em;
|
|
19
19
|
--benev-code: #0f0;
|
|
20
|
+
--benev-menu-height: 42em;
|
|
20
21
|
|
|
21
22
|
--benev-angry: #f40;
|
|
22
23
|
--benev-select-bg: #f60;
|
|
@@ -27,6 +28,7 @@ export default css`
|
|
|
27
28
|
--benev-thick: 3px;
|
|
28
29
|
--benev-border: var(--benev-thin) solid color-mix(in oklch, transparent, var(--benev-line) 50%);
|
|
29
30
|
|
|
31
|
+
--benev-nib: 0.2em;
|
|
30
32
|
--benev-pad: 0.5em;
|
|
31
33
|
--benev-space: 1em;
|
|
32
34
|
--benev-anim: ${bconfig.anim}ms;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {Widget} from "@e280/authlocal"
|
|
4
|
+
import {shadowDuplex, useCss} from "@e280/sly"
|
|
5
|
+
|
|
6
|
+
import {Account} from "./account.js"
|
|
7
|
+
import styleCss from "./style.css.js"
|
|
8
|
+
import {themeCss} from "../../../css/theme.css.js"
|
|
9
|
+
|
|
10
|
+
export const [BenevAccount, makeBenevAccountElement] = shadowDuplex((account: Account) => {
|
|
11
|
+
useCss(themeCss, styleCss)
|
|
12
|
+
|
|
13
|
+
return Widget.with({
|
|
14
|
+
props: [account.auth],
|
|
15
|
+
children: html`sign in`,
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {shadowDuplex, useCss, useName} from "@e280/sly"
|
|
4
|
+
|
|
5
|
+
import styleCss from "./style.css.js"
|
|
6
|
+
import {themeCss} from "../../../css/theme.css.js"
|
|
7
|
+
|
|
8
|
+
export const [BenevFooter, makeBenevFooterElement] = shadowDuplex(() => {
|
|
9
|
+
useName("benev-footer")
|
|
10
|
+
useCss(themeCss, styleCss)
|
|
11
|
+
return html`<slot></slot>`
|
|
12
|
+
})
|
|
13
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {shadowDuplex, useCss, useName} from "@e280/sly"
|
|
4
|
+
|
|
5
|
+
import styleCss from "./style.css.js"
|
|
6
|
+
import {Shell} from "../../../vitals/shell.js"
|
|
7
|
+
import {bDataPng} from "../../../assets/b.png.js"
|
|
8
|
+
import {themeCss} from "../../../css/theme.css.js"
|
|
9
|
+
|
|
10
|
+
export const [BenevHeader, makeBenevHeaderElement] = shadowDuplex((shell: Shell) => {
|
|
11
|
+
useName("benev-header")
|
|
12
|
+
useCss(themeCss, styleCss)
|
|
13
|
+
|
|
14
|
+
const click = () => shell.toggle()
|
|
15
|
+
|
|
16
|
+
return html`
|
|
17
|
+
<nav part=nav ?data-opened=${shell.open} ?data-closed=${!shell.open}>
|
|
18
|
+
<button benev-button="naked animated" title="b menu" @click=${click}>
|
|
19
|
+
<img part=img src="${bDataPng}" alt=""/>
|
|
20
|
+
</button>
|
|
21
|
+
<slot></slot>
|
|
22
|
+
</nav>
|
|
23
|
+
`
|
|
24
|
+
})
|
|
25
|
+
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import {html} from "lit"
|
|
3
|
-
import {
|
|
3
|
+
import {shadowDuplex, useCss, useName} from "@e280/sly"
|
|
4
4
|
|
|
5
5
|
import styleCss from "./style.css.js"
|
|
6
|
-
import {themeCss} from "
|
|
7
|
-
import {bDataPng} from "
|
|
6
|
+
import {themeCss} from "../../../css/theme.css.js"
|
|
7
|
+
import {bDataPng} from "../../../assets/b.png.js"
|
|
8
8
|
|
|
9
|
-
export const BenevLoader =
|
|
9
|
+
export const [BenevLoader, makeBenevLoaderElement] = shadowDuplex(() => {
|
|
10
|
+
useName("benev-loader")
|
|
10
11
|
useCss(themeCss, styleCss)
|
|
11
12
|
|
|
12
13
|
return html`
|
|
@@ -27,13 +27,17 @@ dialog > section:focus {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
dialog > section {
|
|
30
|
-
|
|
30
|
+
overflow: clip;
|
|
31
|
+
|
|
31
32
|
width: 100%;
|
|
32
|
-
height:
|
|
33
|
+
height: min(
|
|
34
|
+
var(--benev-menu-height),
|
|
35
|
+
calc(100dvh - var(--benev-headroom))
|
|
36
|
+
);
|
|
33
37
|
|
|
34
38
|
display: flex;
|
|
35
39
|
flex-direction: column;
|
|
36
|
-
justify-content:
|
|
40
|
+
justify-content: start;
|
|
37
41
|
align-items: center;
|
|
38
42
|
|
|
39
43
|
background: linear-gradient(
|
|
@@ -4,14 +4,18 @@ import {ev} from "@e280/stz"
|
|
|
4
4
|
export function onKeypress(keys: string[], fn: () => void) {
|
|
5
5
|
return () => ev(window, {
|
|
6
6
|
keydown: (event: KeyboardEvent) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const typing = event.composedPath().some(node =>
|
|
8
|
+
node instanceof HTMLElement && (
|
|
9
|
+
node instanceof HTMLInputElement ||
|
|
10
|
+
node instanceof HTMLTextAreaElement ||
|
|
11
|
+
node instanceof HTMLSelectElement ||
|
|
12
|
+
node.isContentEditable
|
|
13
|
+
)
|
|
12
14
|
)
|
|
15
|
+
|
|
13
16
|
if (typing)
|
|
14
17
|
return
|
|
18
|
+
|
|
15
19
|
if (keys.includes(event.code)) {
|
|
16
20
|
event.preventDefault()
|
|
17
21
|
fn()
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import {html} from "lit"
|
|
3
|
-
import {dom,
|
|
3
|
+
import {dom, shadowDuplex, useCss, useMount, useName} from "@e280/sly"
|
|
4
4
|
import styleCss from "./style.css.js"
|
|
5
|
-
import {Shell} from "
|
|
6
|
-
import {
|
|
7
|
-
import {themeCss} from "
|
|
5
|
+
import {Shell} from "../../../vitals/shell.js"
|
|
6
|
+
import {BenevHeader} from "../header/view.js"
|
|
7
|
+
import {themeCss} from "../../../css/theme.css.js"
|
|
8
8
|
import {onKeypress} from "./utils/on-keypress.js"
|
|
9
9
|
import {clickBackdrop} from "./utils/click-backdrop.js"
|
|
10
10
|
import {useAfterFirstRender} from "./utils/use-after-first-render.js"
|
|
11
11
|
|
|
12
|
-
export const
|
|
12
|
+
export const [BenevMenu, makeBenevMenuElement] = shadowDuplex((shell: Shell) => {
|
|
13
|
+
useName("benev-menu")
|
|
13
14
|
useCss(themeCss, styleCss)
|
|
14
15
|
useAfterFirstRender(shadow => shell.attach(dom("dialog", shadow)))
|
|
15
16
|
useMount(onKeypress(["KeyB", "Escape"], () => shell.toggle()))
|
|
@@ -25,7 +26,7 @@ export const makeBenevMenu = (shell: Shell) => shadowElement(() => {
|
|
|
25
26
|
: null}
|
|
26
27
|
</section>
|
|
27
28
|
|
|
28
|
-
${
|
|
29
|
+
${BenevHeader(shell)}
|
|
29
30
|
</dialog>
|
|
30
31
|
`
|
|
31
32
|
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
import {css} from "lit"
|
|
3
|
+
export default css`@layer benev.view {
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
min-height: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host > header {
|
|
14
|
+
display: flex;
|
|
15
|
+
|
|
16
|
+
> nav {
|
|
17
|
+
user-select: none;
|
|
18
|
+
flex: 1 1 auto;
|
|
19
|
+
display: flex;
|
|
20
|
+
border-bottom: var(--benev-border);
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
|
|
23
|
+
button {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
padding: var(--benev-nib) var(--benev-space);
|
|
26
|
+
border-bottom: var(--benev-thick) solid transparent;
|
|
27
|
+
|
|
28
|
+
&:is(:hover, :focus-visible) {
|
|
29
|
+
background: color-mix(in oklch, transparent, var(--benev-prime) 10%);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&[data-active] {
|
|
33
|
+
color: var(--benev-prime);
|
|
34
|
+
background: color-mix(in oklch, transparent, var(--benev-prime) 20%);
|
|
35
|
+
border-bottom-color: var(--benev-prime);
|
|
36
|
+
text-shadow: 0 0 0.5em var(--benev-prime);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host > section {
|
|
43
|
+
flex: 1 1 auto;
|
|
44
|
+
overflow: auto;
|
|
45
|
+
scrollbar-gutter: stable;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}`
|
|
49
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {got} from "@e280/stz"
|
|
4
|
+
import {Content, shadowView, useCss, useName, useSignal} from "@e280/sly"
|
|
5
|
+
import styleCss from "./style.css.js"
|
|
6
|
+
import {themeCss} from "../../../css/theme.css.js"
|
|
7
|
+
import {Account} from "../../duplexes/account/account.js"
|
|
8
|
+
import {BenevAccount} from "../../duplexes/account/view.js"
|
|
9
|
+
|
|
10
|
+
export type Dashpanels = Record<string, {
|
|
11
|
+
label: () => Content
|
|
12
|
+
render: () => Content
|
|
13
|
+
}>
|
|
14
|
+
|
|
15
|
+
export const BenevDashboard = shadowView(({account, panels}: {
|
|
16
|
+
account: Account
|
|
17
|
+
panels: Dashpanels
|
|
18
|
+
}) => {
|
|
19
|
+
|
|
20
|
+
useName("benev-dashboard")
|
|
21
|
+
useCss(themeCss, styleCss)
|
|
22
|
+
|
|
23
|
+
const $activeKey = useSignal<keyof typeof panels>(got(Object.keys(panels).at(0)))
|
|
24
|
+
|
|
25
|
+
const activeKey = Object.hasOwn(panels, $activeKey())
|
|
26
|
+
? $activeKey()
|
|
27
|
+
: got(Object.keys(panels).at(0))
|
|
28
|
+
|
|
29
|
+
const activePanel = panels[activeKey]
|
|
30
|
+
|
|
31
|
+
return html`
|
|
32
|
+
<header part=header>
|
|
33
|
+
<nav part=nav role=tablist>
|
|
34
|
+
${Object.entries(panels).map(([key, panel]) => html`
|
|
35
|
+
<button
|
|
36
|
+
part=button
|
|
37
|
+
role=tab
|
|
38
|
+
benev-button=naked
|
|
39
|
+
?data-active="${key === activeKey}"
|
|
40
|
+
aria-selected="${key === activeKey}"
|
|
41
|
+
@click="${() => $activeKey(key)}">
|
|
42
|
+
${panel.label()}
|
|
43
|
+
</button>
|
|
44
|
+
`)}
|
|
45
|
+
</nav>
|
|
46
|
+
|
|
47
|
+
${BenevAccount(account)}
|
|
48
|
+
</header>
|
|
49
|
+
|
|
50
|
+
<section part=panel class=panel role=tabpanel>
|
|
51
|
+
${activePanel?.render()}
|
|
52
|
+
</section>
|
|
53
|
+
`
|
|
54
|
+
})
|
|
55
|
+
|
package/s/index.html.ts
CHANGED
package/s/index.ts
CHANGED
|
@@ -5,10 +5,15 @@ export * from "./vitals/setup.js"
|
|
|
5
5
|
export * from "./css/benev.csstext.js"
|
|
6
6
|
export * from "./css/theme.css.js"
|
|
7
7
|
|
|
8
|
-
export * from "./dom/
|
|
9
|
-
export * from "./dom/
|
|
10
|
-
export * from "./dom/
|
|
11
|
-
export * from "./dom/
|
|
8
|
+
export * from "./dom/duplexes/account/account.js"
|
|
9
|
+
export * from "./dom/duplexes/account/view.js"
|
|
10
|
+
export * from "./dom/duplexes/footer/view.js"
|
|
11
|
+
export * from "./dom/duplexes/header/view.js"
|
|
12
|
+
export * from "./dom/duplexes/loader/view.js"
|
|
13
|
+
export * from "./dom/duplexes/loader/loader.js"
|
|
14
|
+
export * from "./dom/duplexes/menu/view.js"
|
|
15
|
+
|
|
16
|
+
export * from "./dom/views/dashboard/view.js"
|
|
12
17
|
|
|
13
18
|
export * from "./bconfig.js"
|
|
14
19
|
export * from "./types.js"
|
package/s/main.bundle.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import {html} from "lit"
|
|
3
|
-
import {dom} from "@e280/sly"
|
|
4
3
|
import {nap} from "@e280/stz"
|
|
4
|
+
import {dom, register, renderIn} from "@e280/sly"
|
|
5
|
+
|
|
5
6
|
import {setupBenev} from "./vitals/setup.js"
|
|
6
|
-
import {Loader} from "./dom/loader/loader.js"
|
|
7
|
+
import {Loader} from "./dom/duplexes/loader/loader.js"
|
|
8
|
+
import {BenevDashboard} from "./dom/views/dashboard/view.js"
|
|
9
|
+
|
|
10
|
+
const benev = await setupBenev()
|
|
11
|
+
register(benev.elements)
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
dom.register(elements)
|
|
13
|
+
// benev.shell.onAttach.next().then(() => benev.shell.toggle(true))
|
|
10
14
|
|
|
11
15
|
const loader = new Loader(dom("benev-loader"))
|
|
12
16
|
|
|
@@ -17,3 +21,21 @@ dom(".testloader").onclick = async() => {
|
|
|
17
21
|
)
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
renderIn(dom("benev-menu"), BenevDashboard({
|
|
25
|
+
account: benev.account,
|
|
26
|
+
panels: {
|
|
27
|
+
alpha: {
|
|
28
|
+
label: () => "alpha",
|
|
29
|
+
render: () => html`
|
|
30
|
+
<p style="padding: 1em;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ante orci, sagittis et nisi vel, rhoncus ultricies neque. Maecenas quis magna condimentum, molestie nulla vel, malesuada ante. Donec dui tortor, porta id sollicitudin vitae, sollicitudin non purus. Quisque dignissim purus eget odio placerat lacinia. Vivamus feugiat metus et est venenatis, at ornare magna bibendum. Curabitur elementum pretium magna, non venenatis ligula pharetra sed. Morbi ante lacus, rhoncus sit amet justo sed, facilisis blandit dolor. In sed arcu nec ligula condimentum porttitor eu eleifend risus. Mauris pharetra elit nec felis venenatis aliquet. Nullam vitae efficitur tortor. Curabitur euismod urna sodales, blandit eros vel, cursus urna. Vivamus lacus diam, imperdiet mollis placerat vitae, volutpat in nibh.</p>
|
|
31
|
+
`,
|
|
32
|
+
},
|
|
33
|
+
bravo: {
|
|
34
|
+
label: () => "bravo",
|
|
35
|
+
render: () => html`
|
|
36
|
+
<p style="padding: 1em;">Nulla at augue dignissim, fermentum leo eu, varius tortor. Suspendisse ullamcorper, orci ornare dictum tincidunt, dui velit tincidunt lectus, quis malesuada ante nunc sed metus. Integer accumsan auctor commodo. Maecenas suscipit pharetra felis, at rutrum dolor pretium non. Curabitur nisl felis, euismod eget porttitor dapibus, accumsan eu neque. Quisque convallis mi quis ex dignissim porttitor. Quisque interdum odio tellus, sed sagittis massa commodo at. Donec eget orci finibus mauris dapibus fermentum eget eget diam. Quisque eget tristique justo. Proin vitae dapibus nunc. Maecenas at augue diam. Duis ut aliquet tellus, id aliquet risus. Suspendisse condimentum, mi vel efficitur consequat, erat nisi elementum massa, id hendrerit arcu est quis eros. Nullam non eros magna. Aenean at suscipit sem.</p>
|
|
37
|
+
`,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}))
|
|
41
|
+
|
package/s/vitals/setup.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
|
|
2
|
-
import {Auth
|
|
2
|
+
import {Auth} from "@e280/authlocal"
|
|
3
3
|
import {Shell} from "./shell.js"
|
|
4
|
-
import {Account} from "../dom/account/account.js"
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import {Account} from "../dom/duplexes/account/account.js"
|
|
5
|
+
import {makeBenevMenuElement} from "../dom/duplexes/menu/view.js"
|
|
6
|
+
import {makeBenevLoaderElement} from "../dom/duplexes/loader/view.js"
|
|
7
|
+
import {makeBenevFooterElement} from "../dom/duplexes/footer/view.js"
|
|
8
|
+
import {makeBenevHeaderElement} from "../dom/duplexes/header/view.js"
|
|
9
|
+
import {makeBenevAccountElement} from "../dom/duplexes/account/view.js"
|
|
10
|
+
|
|
11
|
+
export type Benev = Awaited<ReturnType<typeof setupBenev>>
|
|
10
12
|
|
|
11
13
|
export async function setupBenev() {
|
|
12
14
|
const shell = new Shell()
|
|
13
|
-
const
|
|
14
|
-
const account = new Account(auth)
|
|
15
|
+
const account = new Account(new Auth())
|
|
15
16
|
|
|
16
17
|
const elements = {
|
|
17
|
-
BenevLoader,
|
|
18
|
-
BenevFooter:
|
|
19
|
-
BenevMenu:
|
|
20
|
-
BenevHeader:
|
|
21
|
-
BenevAccount:
|
|
22
|
-
BenevAuth: makeAuthWidget(account.auth),
|
|
18
|
+
BenevLoader: makeBenevLoaderElement(),
|
|
19
|
+
BenevFooter: makeBenevFooterElement(),
|
|
20
|
+
BenevMenu: makeBenevMenuElement(shell),
|
|
21
|
+
BenevHeader: makeBenevHeaderElement(shell),
|
|
22
|
+
BenevAccount: makeBenevAccountElement(account),
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
await auth.remember()
|
|
25
|
+
await account.auth.remember()
|
|
26
26
|
|
|
27
|
-
return {
|
|
27
|
+
return {shell, account, elements}
|
|
28
28
|
}
|
|
29
29
|
|
package/s/vitals/shell.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import {got, nap} from "@e280/stz"
|
|
2
|
+
import {got, nap, subby} from "@e280/stz"
|
|
3
3
|
import {tracker} from "@e280/strata"
|
|
4
4
|
import {bconfig} from "../bconfig.js"
|
|
5
5
|
|
|
6
6
|
export class Shell {
|
|
7
|
+
onAttach = subby()
|
|
7
8
|
#dialog?: HTMLDialogElement
|
|
8
9
|
#closeToken = 0
|
|
9
10
|
|
|
@@ -24,6 +25,7 @@ export class Shell {
|
|
|
24
25
|
event.preventDefault()
|
|
25
26
|
this.toggle(false)
|
|
26
27
|
}
|
|
28
|
+
this.onAttach.publish()
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
toggle = (please = !this.open) => {
|
|
@@ -23,7 +23,10 @@ button, [benev-button] {
|
|
|
23
23
|
opacity: 0.3;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
&:
|
|
26
|
+
&:is(
|
|
27
|
+
:not([disabled], [benev-button~="naked"]),
|
|
28
|
+
[benev-button~="animated"]
|
|
29
|
+
) {
|
|
27
30
|
cursor: pointer;
|
|
28
31
|
transform: scale(100%);
|
|
29
32
|
transition: all var(--benev-anim) ease;
|
|
@@ -31,7 +34,7 @@ button, [benev-button] {
|
|
|
31
34
|
&:active { transform: scale(100%); filter: brightness(100%); }
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
&[benev-button
|
|
37
|
+
&[benev-button~="naked"] {
|
|
35
38
|
color: inherit;
|
|
36
39
|
background: transparent;
|
|
37
40
|
backdrop-filter: none;
|
|
@@ -44,7 +47,7 @@ button, [benev-button] {
|
|
|
44
47
|
text-transform: inherit;
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
&[benev-button
|
|
50
|
+
&[benev-button~="juicy"] {
|
|
48
51
|
opacity: 1;
|
|
49
52
|
color: black;
|
|
50
53
|
border: var(--benev-thick) solid var(--benev-prime);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.csstext.js","sourceRoot":"","sources":["../../../s/css/parts/common.csstext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,IAAI,GAAG,EAAC,MAAM,WAAW,CAAA;AAC/C,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"common.csstext.js","sourceRoot":"","sources":["../../../s/css/parts/common.csstext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,IAAI,GAAG,EAAC,MAAM,WAAW,CAAA;AAC/C,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6NjB,CAAA"}
|
|
@@ -16,6 +16,7 @@ export default css `
|
|
|
16
16
|
--benev-link: aqua;
|
|
17
17
|
--benev-b-size: 1.5em;
|
|
18
18
|
--benev-code: #0f0;
|
|
19
|
+
--benev-menu-height: 42em;
|
|
19
20
|
|
|
20
21
|
--benev-angry: #f40;
|
|
21
22
|
--benev-select-bg: #f60;
|
|
@@ -26,6 +27,7 @@ export default css `
|
|
|
26
27
|
--benev-thick: 3px;
|
|
27
28
|
--benev-border: var(--benev-thin) solid color-mix(in oklch, transparent, var(--benev-line) 50%);
|
|
28
29
|
|
|
30
|
+
--benev-nib: 0.2em;
|
|
29
31
|
--benev-pad: 0.5em;
|
|
30
32
|
--benev-space: 1em;
|
|
31
33
|
--benev-anim: ${bconfig.anim}ms;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vars.csstext.js","sourceRoot":"","sources":["../../../s/css/parts/vars.csstext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,IAAI,GAAG,EAAC,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAA;AACxC,eAAe,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"vars.csstext.js","sourceRoot":"","sources":["../../../s/css/parts/vars.csstext.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,IAAI,GAAG,EAAC,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAA;AACxC,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA8BF,OAAO,CAAC,IAAI;;;;;;;;CAQ3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../s/dom/duplexes/account/account.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,OAAO;IACA,IAAI;IAAvB,YAAmB,IAAU;oBAAV,IAAI;IAAS,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../../../s/dom/duplexes/account/style.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,eAAe,GAAG,CAAA;;EAEhB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { Widget } from "@e280/authlocal";
|
|
3
|
+
import { shadowDuplex, useCss } from "@e280/sly";
|
|
4
|
+
import styleCss from "./style.css.js";
|
|
5
|
+
import { themeCss } from "../../../css/theme.css.js";
|
|
6
|
+
export const [BenevAccount, makeBenevAccountElement] = shadowDuplex((account) => {
|
|
7
|
+
useCss(themeCss, styleCss);
|
|
8
|
+
return Widget.with({
|
|
9
|
+
props: [account.auth],
|
|
10
|
+
children: html `sign in`,
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../s/dom/duplexes/account/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAA;AACtC,OAAO,EAAC,YAAY,EAAE,MAAM,EAAC,MAAM,WAAW,CAAA;AAG9C,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,GAAG,YAAY,CAAC,CAAC,OAAgB,EAAE,EAAE;IACxF,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAE1B,OAAO,MAAM,CAAC,IAAI,CAAC;QAClB,KAAK,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;QACrB,QAAQ,EAAE,IAAI,CAAA,SAAS;KACvB,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../../../s/dom/duplexes/footer/style.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,eAAe,GAAG,CAAA;;EAEhB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BenevFooter: import("@e280/sly").ShadowView<[]>, makeBenevFooterElement: () => new () => HTMLElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { shadowDuplex, useCss, useName } from "@e280/sly";
|
|
3
|
+
import styleCss from "./style.css.js";
|
|
4
|
+
import { themeCss } from "../../../css/theme.css.js";
|
|
5
|
+
export const [BenevFooter, makeBenevFooterElement] = shadowDuplex(() => {
|
|
6
|
+
useName("benev-footer");
|
|
7
|
+
useCss(themeCss, styleCss);
|
|
8
|
+
return html `<slot></slot>`;
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../../../s/dom/duplexes/footer/view.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAC,MAAM,WAAW,CAAA;AAEvD,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE;IACtE,OAAO,CAAC,cAAc,CAAC,CAAA;IACvB,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAC1B,OAAO,IAAI,CAAA,eAAe,CAAA;AAC3B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../../../s/dom/duplexes/header/style.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoChB,CAAA"}
|