@e280/shiny 0.1.0-10 → 0.1.0-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -8
- package/package.json +3 -3
- package/s/components/button/component.ts +30 -0
- package/s/components/button/showcase.ts +119 -0
- package/s/components/button/style.css.ts +63 -0
- package/s/components/copy/component.ts +3 -1
- package/s/components/copy/showcase.ts +51 -0
- package/s/components/drawer/component.ts +30 -32
- package/s/components/drawer/showcase.ts +93 -0
- package/s/components/drawer/style.css.ts +9 -4
- package/s/components/raw-components.ts +2 -0
- package/s/components/tabs/component.ts +13 -2
- package/s/components/tabs/control.ts +3 -3
- package/s/components/tabs/showcase.ts +73 -0
- package/s/components/tabs/style.css.ts +38 -1
- package/s/demo/demo.bundle.ts +14 -199
- package/s/demo/demo.css +1 -0
- package/s/demo/lipsum.ts +6 -0
- package/s/demo/utils/lipsum.ts +1 -1
- package/s/demo/views/demonstration/style.css.ts +8 -0
- package/s/demo/views/demonstration/view.ts +10 -6
- package/s/demo/views/exhibit/style.css.ts +82 -0
- package/s/demo/views/exhibit/view.ts +59 -0
- package/s/demo/views/showcase/style.css.ts +50 -0
- package/s/demo/views/showcase/view.ts +54 -0
- package/s/demo/viewsets.ts +12 -0
- package/s/index.html.ts +4 -7
- package/s/themes/aura.css.ts +52 -14
- package/s/themes/infra/css-vars.ts +19 -6
- package/s/themes/plain.css.ts +0 -1
- package/x/components/button/component.d.ts +6 -0
- package/x/components/button/component.js +25 -0
- package/x/components/button/component.js.map +1 -0
- package/x/components/button/showcase.d.ts +1 -0
- package/x/components/button/showcase.js +116 -0
- package/x/components/button/showcase.js.map +1 -0
- package/x/components/button/style.css.d.ts +2 -0
- package/x/components/button/style.css.js +62 -0
- package/x/components/button/style.css.js.map +1 -0
- package/x/components/copy/component.d.ts +2 -2
- package/x/components/copy/component.js +3 -1
- package/x/components/copy/component.js.map +1 -1
- package/x/components/copy/showcase.d.ts +1 -0
- package/x/components/copy/showcase.js +48 -0
- package/x/components/copy/showcase.js.map +1 -0
- package/x/components/drawer/component.d.ts +3 -3
- package/x/components/drawer/component.js +28 -31
- package/x/components/drawer/component.js.map +1 -1
- package/x/components/drawer/showcase.d.ts +1 -0
- package/x/components/drawer/showcase.js +87 -0
- package/x/components/drawer/showcase.js.map +1 -0
- package/x/components/drawer/style.css.js +9 -4
- package/x/components/drawer/style.css.js.map +1 -1
- package/x/components/example/component.d.ts +1 -1
- package/x/components/raw-components.d.ts +2 -0
- package/x/components/raw-components.js +2 -0
- package/x/components/raw-components.js.map +1 -1
- package/x/components/tabs/component.d.ts +1 -1
- package/x/components/tabs/component.js +13 -2
- package/x/components/tabs/component.js.map +1 -1
- package/x/components/tabs/control.d.ts +1 -1
- package/x/components/tabs/control.js +3 -3
- package/x/components/tabs/control.js.map +1 -1
- package/x/components/tabs/showcase.d.ts +1 -0
- package/x/components/tabs/showcase.js +69 -0
- package/x/components/tabs/showcase.js.map +1 -0
- package/x/components/tabs/style.css.js +38 -1
- package/x/components/tabs/style.css.js.map +1 -1
- package/x/demo/demo.bundle.js +14 -193
- package/x/demo/demo.bundle.js.map +1 -1
- package/x/demo/demo.bundle.min.js +497 -311
- package/x/demo/demo.bundle.min.js.map +4 -4
- package/x/demo/demo.css +1 -0
- package/x/demo/lipsum.d.ts +2 -0
- package/x/demo/lipsum.js +4 -0
- package/x/demo/lipsum.js.map +1 -0
- package/x/demo/utils/lipsum.js +1 -1
- package/x/demo/views/demonstration/style.css.js +8 -0
- package/x/demo/views/demonstration/style.css.js.map +1 -1
- package/x/demo/views/demonstration/view.js +8 -6
- package/x/demo/views/demonstration/view.js.map +1 -1
- package/x/demo/views/exhibit/style.css.d.ts +2 -0
- package/x/demo/views/exhibit/style.css.js +81 -0
- package/x/demo/views/exhibit/style.css.js.map +1 -0
- package/x/demo/views/exhibit/view.d.ts +29 -0
- package/x/demo/views/exhibit/view.js +38 -0
- package/x/demo/views/exhibit/view.js.map +1 -0
- package/x/demo/views/showcase/style.css.d.ts +2 -0
- package/x/demo/views/showcase/style.css.js +49 -0
- package/x/demo/views/showcase/style.css.js.map +1 -0
- package/x/demo/views/showcase/view.d.ts +7 -0
- package/x/demo/views/showcase/view.js +40 -0
- package/x/demo/views/showcase/view.js.map +1 -0
- package/x/demo/{aura-views.d.ts → viewsets.d.ts} +5 -2
- package/x/demo/viewsets.js +9 -0
- package/x/demo/viewsets.js.map +1 -0
- package/x/index.html +5 -4
- package/x/index.html.js +4 -7
- package/x/index.html.js.map +1 -1
- package/x/install/aura.bundle.min.js +210 -65
- package/x/install/aura.bundle.min.js.map +4 -4
- package/x/install/plain.bundle.min.js +159 -53
- package/x/install/plain.bundle.min.js.map +4 -4
- package/x/shiny.d.ts +8 -3
- package/x/themes/aura.css.js +52 -14
- package/x/themes/aura.css.js.map +1 -1
- package/x/themes/infra/css-vars.d.ts +6 -2
- package/x/themes/infra/css-vars.js +7 -3
- package/x/themes/infra/css-vars.js.map +1 -1
- package/x/themes/plain.css.js +0 -1
- package/x/themes/plain.css.js.map +1 -1
- package/s/demo/aura-views.ts +0 -6
- package/x/demo/aura-views.js +0 -4
- package/x/demo/aura-views.js.map +0 -1
package/s/index.html.ts
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
|
|
2
2
|
import {ssg, html} from "@e280/scute"
|
|
3
3
|
|
|
4
|
-
const title = "shiny"
|
|
5
|
-
const description = "✨ web ui components"
|
|
6
|
-
const domain = "shiny.e280.org"
|
|
7
4
|
const favicon = "/assets/favicon.png"
|
|
8
5
|
|
|
9
6
|
export default ssg.page(import.meta.url, async orb => ({
|
|
10
|
-
title,
|
|
7
|
+
title: "shiny",
|
|
11
8
|
js: "demo/demo.bundle.min.js",
|
|
12
9
|
css: "demo/demo.css",
|
|
13
10
|
favicon,
|
|
14
11
|
dark: true,
|
|
15
12
|
socialCard: {
|
|
16
13
|
themeColor: "#d068ff",
|
|
17
|
-
title,
|
|
18
|
-
description,
|
|
19
14
|
siteName: "@e280/shiny",
|
|
20
|
-
|
|
15
|
+
title: "✨shiny✨",
|
|
16
|
+
description: "web ui components",
|
|
17
|
+
image: "https://shiny.e280.org" + favicon,
|
|
21
18
|
},
|
|
22
19
|
|
|
23
20
|
body: html`
|
package/s/themes/aura.css.ts
CHANGED
|
@@ -4,17 +4,63 @@ import {defaultCssVars, renderCssVars} from "./infra/css-vars.js"
|
|
|
4
4
|
export const aura = css`@layer overlay {
|
|
5
5
|
|
|
6
6
|
:host {
|
|
7
|
-
display: block;
|
|
8
|
-
|
|
9
7
|
${renderCssVars({
|
|
10
8
|
...defaultCssVars(),
|
|
11
9
|
})}
|
|
12
10
|
}
|
|
13
11
|
|
|
14
|
-
:host([view="shiny-
|
|
12
|
+
:host([view="shiny-button"]:not([plain])) {
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
--buttoncolor: var(--calm);
|
|
16
|
+
--padding: 0.3em 0.7em;
|
|
17
|
+
|
|
18
|
+
color: white;
|
|
19
|
+
border-radius: 2em;
|
|
20
|
+
background: var(--buttoncolor);
|
|
21
|
+
border: none;
|
|
22
|
+
|
|
23
|
+
font-weight: medium;
|
|
24
|
+
text-shadow: 0.1em 0.1em 0.1em #0004;
|
|
25
|
+
box-shadow: 0.1em 0.2em 0.3em #0002;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([view="shiny-button"][lame]) { --buttoncolor: var(--lame); }
|
|
29
|
+
:host([view="shiny-button"][angry]) { --buttoncolor: var(--angry); }
|
|
30
|
+
:host([view="shiny-button"][zesty]) { --buttoncolor: var(--zesty); }
|
|
31
|
+
:host([view="shiny-button"][happy]) { --buttoncolor: var(--happy); }
|
|
32
|
+
:host([view="shiny-button"][calm]) { --buttoncolor: var(--calm); }
|
|
33
|
+
:host([view="shiny-button"][sad]) { --buttoncolor: var(--sad); }
|
|
34
|
+
:host([view="shiny-button"][quirky]) { --buttoncolor: var(--quirky); }
|
|
35
|
+
|
|
36
|
+
:host([view="shiny-button"][gradient]:not([plain])) {
|
|
37
|
+
border: none;
|
|
38
|
+
background: linear-gradient(
|
|
39
|
+
to bottom right,
|
|
40
|
+
color-mix(in oklab, var(--buttoncolor), white 40%),
|
|
41
|
+
color-mix(in oklab, var(--buttoncolor), black 20%)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
&::before {
|
|
45
|
+
content: "";
|
|
46
|
+
display: block;
|
|
47
|
+
position: absolute;
|
|
48
|
+
z-index: 0;
|
|
49
|
+
inset: 0.15em;
|
|
50
|
+
border-radius: inherit;
|
|
51
|
+
background: color-mix(in oklab, var(--buttoncolor), #0004 50%);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
> * {
|
|
55
|
+
position: relative;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([view="shiny-drawer"]:not([plain])) {
|
|
15
61
|
display: block;
|
|
16
62
|
|
|
17
|
-
&::part(
|
|
63
|
+
&::part(slate) {
|
|
18
64
|
padding: 1em;
|
|
19
65
|
background: linear-gradient(
|
|
20
66
|
to top right,
|
|
@@ -25,24 +71,16 @@ export const aura = css`@layer overlay {
|
|
|
25
71
|
}
|
|
26
72
|
|
|
27
73
|
:host([view="shiny-drawer"]:state(left)) {
|
|
28
|
-
&::part(
|
|
74
|
+
&::part(slate) {
|
|
29
75
|
border-bottom-right-radius: 0.5em;
|
|
30
76
|
}
|
|
31
77
|
}
|
|
32
78
|
|
|
33
79
|
:host([view="shiny-drawer"]:state(right)) {
|
|
34
|
-
&::part(
|
|
80
|
+
&::part(slate) {
|
|
35
81
|
border-bottom-left-radius: 0.5em;
|
|
36
82
|
}
|
|
37
83
|
}
|
|
38
84
|
|
|
39
|
-
:host([view="shiny-tabs"]) {
|
|
40
|
-
display: block;
|
|
41
|
-
|
|
42
|
-
&::part(tabs) {
|
|
43
|
-
display: flex;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
85
|
}`
|
|
48
86
|
|
|
@@ -4,22 +4,35 @@ import {unsafeCSS} from "lit"
|
|
|
4
4
|
export type CssVars = {
|
|
5
5
|
"bg": string
|
|
6
6
|
"alpha": string
|
|
7
|
-
"happy": string
|
|
8
|
-
"sad": string
|
|
9
|
-
"angry": string
|
|
10
7
|
"lame": string
|
|
8
|
+
|
|
9
|
+
// normative color vibes
|
|
10
|
+
"angry": string // red
|
|
11
|
+
"zesty": string // yellow
|
|
12
|
+
"happy": string // green
|
|
13
|
+
"calm": string // cyan
|
|
14
|
+
"sad": string // blue
|
|
15
|
+
"quirky": string // magenta
|
|
16
|
+
|
|
11
17
|
"inactive-opacity": string
|
|
18
|
+
"anim-duration": string
|
|
12
19
|
}
|
|
13
20
|
|
|
14
21
|
export function defaultCssVars(): CssVars {
|
|
15
22
|
return {
|
|
16
23
|
"bg": "#111",
|
|
17
|
-
"alpha": "#
|
|
24
|
+
"alpha": "#def",
|
|
25
|
+
|
|
26
|
+
"lame": "#8888",
|
|
27
|
+
"angry": "#f50",
|
|
28
|
+
"zesty": "#cf0",
|
|
18
29
|
"happy": "#0fa",
|
|
30
|
+
"calm": "#0af",
|
|
19
31
|
"sad": "#74f",
|
|
20
|
-
"
|
|
21
|
-
|
|
32
|
+
"quirky": "#f49",
|
|
33
|
+
|
|
22
34
|
"inactive-opacity": "0.5",
|
|
35
|
+
"anim-duration": "300ms",
|
|
23
36
|
}
|
|
24
37
|
}
|
|
25
38
|
|
package/s/themes/plain.css.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Content } from "@e280/sly";
|
|
2
|
+
import { ShinyContext, ShinyElement } from "../framework.js";
|
|
3
|
+
declare const ShinyButton_base: import("@e280/sly").ComponentClass<typeof ShinyElement, [context: ShinyContext, content?: Content]>;
|
|
4
|
+
export declare class ShinyButton extends ShinyButton_base {
|
|
5
|
+
}
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import { view } from "@e280/sly";
|
|
3
|
+
import styleCss from "./style.css.js";
|
|
4
|
+
import { foundationCss } from "../foundation.css.js";
|
|
5
|
+
import { ShinyElement } from "../framework.js";
|
|
6
|
+
export class ShinyButton extends (view(use => (context, content) => {
|
|
7
|
+
use.name("shiny-button");
|
|
8
|
+
use.styles(foundationCss, context.theme, styleCss);
|
|
9
|
+
const attrs = use.attrs.spec({
|
|
10
|
+
disabled: Boolean,
|
|
11
|
+
hidden: Boolean,
|
|
12
|
+
});
|
|
13
|
+
return html `
|
|
14
|
+
<button
|
|
15
|
+
part=button
|
|
16
|
+
?disabled="${attrs.disabled}"
|
|
17
|
+
?hidden="${attrs.hidden}">
|
|
18
|
+
<slot>${content}</slot>
|
|
19
|
+
</button>
|
|
20
|
+
`;
|
|
21
|
+
})
|
|
22
|
+
.component(ShinyElement)
|
|
23
|
+
.props(el => [el.context])) {
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../s/components/button/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAU,IAAI,EAAC,MAAM,WAAW,CAAA;AACvC,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAe,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAE1D,MAAM,OAAO,WAAY,SAAQ,CAChC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAqB,EAAE,OAAiB,EAAE,EAAE;IACxD,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;IACxB,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;IAElD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;QAC5B,QAAQ,EAAE,OAAO;QACjB,MAAM,EAAE,OAAO;KACf,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;;;iBAGI,KAAK,CAAC,QAAQ;eAChB,KAAK,CAAC,MAAM;aACd,OAAO;;GAEjB,CAAA;AACF,CAAC,CAAC;KACD,SAAS,CAAC,YAAY,CAAC;KACvB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAU,CAAC,CACnC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buttonShowcase: () => import("lit-html/directive.js").DirectiveResult<import("lit-html/directive.js").DirectiveClass>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { css, html } from "lit";
|
|
2
|
+
import { Showcase } from "../../demo/views/showcase/view.js";
|
|
3
|
+
const cssSnippet = `
|
|
4
|
+
shiny-button {
|
|
5
|
+
--padding: 0.3em;
|
|
6
|
+
font-size: 1em;
|
|
7
|
+
color: currentColor;
|
|
8
|
+
background: transparent;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export const buttonShowcase = () => Showcase({
|
|
12
|
+
name: "button",
|
|
13
|
+
style: css `
|
|
14
|
+
.box {
|
|
15
|
+
> * { font-size: 1.5em; }
|
|
16
|
+
}
|
|
17
|
+
`,
|
|
18
|
+
exhibits: [
|
|
19
|
+
{
|
|
20
|
+
label: "basic",
|
|
21
|
+
explain: html `<p>clicky-clacky pressy button.</p>`,
|
|
22
|
+
snippets: [
|
|
23
|
+
{ label: "html", code: `<shiny-button>button</shiny-button>` },
|
|
24
|
+
{ label: "view", code: `ShinyButton("button")` },
|
|
25
|
+
{ label: "css", code: cssSnippet },
|
|
26
|
+
],
|
|
27
|
+
style: css ``,
|
|
28
|
+
presentation: views => html `
|
|
29
|
+
${views.ShinyButton.props().children("button").render()}
|
|
30
|
+
`,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "gradient",
|
|
34
|
+
explain: html `<p>added <code>gradient</code> attribute.</p>`,
|
|
35
|
+
snippets: [
|
|
36
|
+
{ label: "html", code: `<shiny-button gradient>button</shiny-button>` },
|
|
37
|
+
{ label: "view", code: `
|
|
38
|
+
ShinyButton
|
|
39
|
+
.props("button")
|
|
40
|
+
.attr("gradient")
|
|
41
|
+
.render()
|
|
42
|
+
` },
|
|
43
|
+
{ label: "css", code: cssSnippet },
|
|
44
|
+
],
|
|
45
|
+
style: css ``,
|
|
46
|
+
presentation: views => html `
|
|
47
|
+
${views.ShinyButton.props().attr("gradient").children("button").render()}
|
|
48
|
+
`,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "catalog",
|
|
52
|
+
explain: html `<p>clicky-clacky pressy buttons.</p>`,
|
|
53
|
+
snippets: [
|
|
54
|
+
{ label: "html", code: `
|
|
55
|
+
<shiny-button calm gradient>calm</shiny-button>
|
|
56
|
+
<shiny-button angry gradient>angry</shiny-button>
|
|
57
|
+
<shiny-button happy gradient>happy</shiny-button>
|
|
58
|
+
<shiny-button zesty gradient>zesty</shiny-button>
|
|
59
|
+
<shiny-button sad gradient>sad</shiny-button>
|
|
60
|
+
<shiny-button quirky gradient>quirky</shiny-button>
|
|
61
|
+
<shiny-button plain gradient>plain</shiny-button>
|
|
62
|
+
` },
|
|
63
|
+
{ label: "view", code: `
|
|
64
|
+
[
|
|
65
|
+
ShinyButton.props().attr("calm").attr("gradient").children("calm").render(),
|
|
66
|
+
ShinyButton.props().attr("angry").attr("gradient").children("angry").render(),
|
|
67
|
+
ShinyButton.props().attr("happy").attr("gradient").children("happy").render(),
|
|
68
|
+
ShinyButton.props().attr("zesty").attr("gradient").children("zesty").render(),
|
|
69
|
+
ShinyButton.props().attr("sad").attr("gradient").children("sad").render(),
|
|
70
|
+
ShinyButton.props().attr("quirky").attr("gradient").children("quirky").render(),
|
|
71
|
+
ShinyButton.props().attr("plain").children("plain").render(),
|
|
72
|
+
]
|
|
73
|
+
` },
|
|
74
|
+
{ label: "css", code: cssSnippet },
|
|
75
|
+
],
|
|
76
|
+
style: css ``,
|
|
77
|
+
presentation: views => [
|
|
78
|
+
views.ShinyButton.props()
|
|
79
|
+
.attr("calm")
|
|
80
|
+
.attr("gradient")
|
|
81
|
+
.children("calm")
|
|
82
|
+
.render(),
|
|
83
|
+
views.ShinyButton.props()
|
|
84
|
+
.attr("angry")
|
|
85
|
+
.attr("gradient")
|
|
86
|
+
.children("angry")
|
|
87
|
+
.render(),
|
|
88
|
+
views.ShinyButton.props()
|
|
89
|
+
.attr("happy")
|
|
90
|
+
.attr("gradient")
|
|
91
|
+
.children("happy")
|
|
92
|
+
.render(),
|
|
93
|
+
views.ShinyButton.props()
|
|
94
|
+
.attr("zesty")
|
|
95
|
+
.attr("gradient")
|
|
96
|
+
.children("zesty")
|
|
97
|
+
.render(),
|
|
98
|
+
views.ShinyButton.props()
|
|
99
|
+
.attr("sad")
|
|
100
|
+
.attr("gradient")
|
|
101
|
+
.children("sad")
|
|
102
|
+
.render(),
|
|
103
|
+
views.ShinyButton.props()
|
|
104
|
+
.attr("quirky")
|
|
105
|
+
.attr("gradient")
|
|
106
|
+
.children("quirky")
|
|
107
|
+
.render(),
|
|
108
|
+
views.ShinyButton.props()
|
|
109
|
+
.attr("plain")
|
|
110
|
+
.children("plain")
|
|
111
|
+
.render(),
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=showcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showcase.js","sourceRoot":"","sources":["../../../s/components/button/showcase.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAE1D,MAAM,UAAU,GAAG;;;;;;;CAOlB,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC;IA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AAC;qBACjB,MAAM,EAAE;aACV;SACD;KACD;CACD,CAAC,CAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export default css `@layer view {
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
opacity: 0.8;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
width: max-content;
|
|
8
|
+
height: max-content;
|
|
9
|
+
|
|
10
|
+
--padding: 0.3em;
|
|
11
|
+
border-radius: 0.2em;
|
|
12
|
+
border: 0.1em solid currentColor;
|
|
13
|
+
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
background: transparent;
|
|
16
|
+
user-select: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host(:not([disabled]):is(:hover, :focus-visible)) { opacity: 1; }
|
|
20
|
+
:host(:not([disabled]):active) { opacity: 0.6; }
|
|
21
|
+
|
|
22
|
+
:host([disabled]) {
|
|
23
|
+
cursor: default;
|
|
24
|
+
color: var(--lame);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([hidden]) {
|
|
28
|
+
display: none !important;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:host([lame]) { color: var(--lame); }
|
|
32
|
+
:host([angry]) { color: var(--angry); }
|
|
33
|
+
:host([zesty]) { color: var(--zesty); }
|
|
34
|
+
:host([happy]) { color: var(--happy); }
|
|
35
|
+
:host([calm]) { color: var(--calm); }
|
|
36
|
+
:host([sad]) { color: var(--sad); }
|
|
37
|
+
:host([quirky]) { color: var(--quirky); }
|
|
38
|
+
|
|
39
|
+
button {
|
|
40
|
+
background: transparent;
|
|
41
|
+
border: none;
|
|
42
|
+
|
|
43
|
+
font: inherit;
|
|
44
|
+
color: inherit;
|
|
45
|
+
cursor: inherit;
|
|
46
|
+
text-shadow: inherit;
|
|
47
|
+
|
|
48
|
+
display: inline-flex;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
align-items: center;
|
|
51
|
+
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
padding: var(--padding);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
slot {
|
|
58
|
+
display: contents;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}`;
|
|
62
|
+
//# sourceMappingURL=style.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.css.js","sourceRoot":"","sources":["../../../s/components/button/style.css.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAA;AACvB,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DhB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
+
"__#private@#attrs": import("@e280/sly").AttrTypes<{
|
|
5
5
|
text: StringConstructor;
|
|
6
6
|
ms: NumberConstructor;
|
|
7
7
|
}>;
|
|
@@ -10,7 +10,7 @@ declare const ShinyCopy_base: import("@e280/sly").ComponentClass<{
|
|
|
10
10
|
get ms(): number | undefined;
|
|
11
11
|
set ms(v: number | undefined);
|
|
12
12
|
context: ShinyContext;
|
|
13
|
-
#private: any;
|
|
13
|
+
"__#private@#private": any;
|
|
14
14
|
readonly shadow: ShadowRoot;
|
|
15
15
|
createShadow(): ShadowRoot;
|
|
16
16
|
render(_use: import("@e280/sly").Use): import("@e280/sly").Content;
|
|
@@ -23,6 +23,8 @@ export class ShinyCopy extends (view(use => (context, text, ms = 1000) => {
|
|
|
23
23
|
if (text === undefined)
|
|
24
24
|
return;
|
|
25
25
|
try {
|
|
26
|
+
if (use.attrs.booleans.fail)
|
|
27
|
+
throw new Error("copy failed on purpose for testing purposes");
|
|
26
28
|
await navigator.clipboard.writeText(text);
|
|
27
29
|
await statusFlash("good");
|
|
28
30
|
}
|
|
@@ -37,7 +39,7 @@ export class ShinyCopy extends (view(use => (context, text, ms = 1000) => {
|
|
|
37
39
|
case "invalid": return clipboardSvg;
|
|
38
40
|
case "good": return clipboardCheckFilledSvg;
|
|
39
41
|
case "bad": return clipboardXFilledSvg;
|
|
40
|
-
default: throw new Error(`
|
|
42
|
+
default: throw new Error(`unknown copy status`);
|
|
41
43
|
}
|
|
42
44
|
})();
|
|
43
45
|
return html `
|
|
@@ -1 +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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AE,EAAE,CAAC,EAAE,CAAC,CAAC,CAC1C;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const copyShowcase: () => import("lit-html/directive.js").DirectiveResult<import("lit-html/directive.js").DirectiveClass>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css, html } from "lit";
|
|
2
|
+
import { Showcase } from "../../demo/views/showcase/view.js";
|
|
3
|
+
const cssSnippet = `
|
|
4
|
+
shiny-copy {
|
|
5
|
+
font-size: 1em;
|
|
6
|
+
--happy: #0fa;
|
|
7
|
+
--angry: #f50;
|
|
8
|
+
--lame: #8888;
|
|
9
|
+
--inactive-opacity: 0.5;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
export const copyShowcase = () => Showcase({
|
|
13
|
+
name: "copy",
|
|
14
|
+
style: css `
|
|
15
|
+
.box {
|
|
16
|
+
> * { font-size: 4em; }
|
|
17
|
+
}
|
|
18
|
+
`,
|
|
19
|
+
exhibits: [
|
|
20
|
+
{
|
|
21
|
+
label: "succeed",
|
|
22
|
+
explain: html `<p>click-to-copy text button.</p>`,
|
|
23
|
+
snippets: [
|
|
24
|
+
{ label: "html", code: `<shiny-copy text="hello world"></shiny-button>` },
|
|
25
|
+
{ label: "view", code: `ShinyCopy("hello world")` },
|
|
26
|
+
{ label: "css", code: cssSnippet },
|
|
27
|
+
],
|
|
28
|
+
style: css ``,
|
|
29
|
+
presentation: views => html `
|
|
30
|
+
${views.ShinyCopy("hello world")}
|
|
31
|
+
`,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: "fail",
|
|
35
|
+
explain: html `<p>copy text button, deliberately fails so you can see.</p>`,
|
|
36
|
+
snippets: [
|
|
37
|
+
{ label: "html", code: `<shiny-copy fail></shiny-button>` },
|
|
38
|
+
{ label: "view", code: `ShinyCopy.props("").attr("fail").render()` },
|
|
39
|
+
{ label: "css", code: cssSnippet },
|
|
40
|
+
],
|
|
41
|
+
style: css ``,
|
|
42
|
+
presentation: views => html `
|
|
43
|
+
${views.ShinyCopy.props("").attr("fail").render()}
|
|
44
|
+
`,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=showcase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showcase.js","sourceRoot":"","sources":["../../../s/components/copy/showcase.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,KAAK,CAAA;AAC7B,OAAO,EAAC,QAAQ,EAAC,MAAM,mCAAmC,CAAA;AAE1D,MAAM,UAAU,GAAG;;;;;;;;CAQlB,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC;IAC1C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,GAAG,CAAA;;;;EAIT;IACD,QAAQ,EAAE;QACT;YACC,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,IAAI,CAAA,mCAAmC;YAChD,QAAQ,EAAE;gBACT,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,gDAAgD,EAAC;gBACvE,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,0BAA0B,EAAC;gBACjD,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAC;aAChC;YACD,KAAK,EAAE,GAAG,CAAA,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAA;MACxB,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAChC;SACD;QACD;YACC,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,IAAI,CAAA,6DAA6D;YAC1E,QAAQ,EAAE;gBACT,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,EAAC;gBACzD,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,2CAA2C,EAAC;gBAClE,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAC;aAChC;YACD,KAAK,EAAE,GAAG,CAAA,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAA;MACxB,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE;IACjD;SACD;KACD;CACD,CAAC,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { DrawerControl } from "./control.js";
|
|
|
2
2
|
import { ShinyContext } from "../framework.js";
|
|
3
3
|
declare const ShinyDrawer_base: import("@e280/sly").ComponentClass<{
|
|
4
4
|
new (): {
|
|
5
|
-
#attrs: import("@e280/sly").AttrTypes<{
|
|
5
|
+
"__#private@#attrs": import("@e280/sly").AttrTypes<{
|
|
6
6
|
open: BooleanConstructor;
|
|
7
7
|
button: BooleanConstructor;
|
|
8
8
|
side: StringConstructor;
|
|
@@ -17,7 +17,7 @@ declare const ShinyDrawer_base: import("@e280/sly").ComponentClass<{
|
|
|
17
17
|
get open(): () => Promise<void>;
|
|
18
18
|
get close(): () => Promise<void>;
|
|
19
19
|
context: ShinyContext;
|
|
20
|
-
#private: any;
|
|
20
|
+
"__#private@#private": any;
|
|
21
21
|
readonly shadow: ShadowRoot;
|
|
22
22
|
createShadow(): ShadowRoot;
|
|
23
23
|
render(_use: import("@e280/sly").Use): import("@e280/sly").Content;
|
|
@@ -378,7 +378,7 @@ declare const ShinyDrawer_base: import("@e280/sly").ComponentClass<{
|
|
|
378
378
|
};
|
|
379
379
|
styles: import("lit").CSSResultGroup | undefined;
|
|
380
380
|
}, [context: ShinyContext, options: {
|
|
381
|
-
button
|
|
381
|
+
button?: boolean;
|
|
382
382
|
side?: "left" | "right";
|
|
383
383
|
control?: DrawerControl;
|
|
384
384
|
}]>;
|
|
@@ -11,41 +11,42 @@ export class ShinyDrawer extends (view(use => (context, options) => {
|
|
|
11
11
|
use.name("shiny-drawer");
|
|
12
12
|
use.styles(foundationCss, context.theme, styleCss);
|
|
13
13
|
const states = use.once(() => new States(use.element));
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const button = options.button ?? use.attrs.booleans.button;
|
|
15
|
+
const side = options.side ?? (use.attrs.strings.side === "right" ? "right" : "left");
|
|
16
|
+
const control = use.once(() => (options.control ?? new DrawerControl()));
|
|
16
17
|
states.assign(side);
|
|
17
18
|
use.mount(() => dom.events(window, { keydown: (event) => {
|
|
18
19
|
if (event.code === "Escape")
|
|
19
|
-
|
|
20
|
+
control.close();
|
|
20
21
|
} }));
|
|
21
|
-
dom.attrs(use.element).booleans.open =
|
|
22
|
+
dom.attrs(use.element).booleans.open = control.isOpen;
|
|
23
|
+
function renderButton() {
|
|
24
|
+
return html `
|
|
25
|
+
<button @click="${control.toggle}">
|
|
26
|
+
${control.isOpen
|
|
27
|
+
? html `
|
|
28
|
+
<slot name=button-x>
|
|
29
|
+
${xSvg}
|
|
30
|
+
</slot>
|
|
31
|
+
`
|
|
32
|
+
: html `
|
|
33
|
+
<slot name=button>
|
|
34
|
+
${menu2Svg}
|
|
35
|
+
</slot>
|
|
36
|
+
`}
|
|
37
|
+
</button>
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
22
40
|
return html `
|
|
23
|
-
<div class=shell ?data-open="${
|
|
24
|
-
<slot name=plate ?inert="${
|
|
41
|
+
<div class=shell ?data-open="${control.isOpen}" data-side="${side}">
|
|
42
|
+
<slot name=plate ?inert="${control.isOpen}"></slot>
|
|
25
43
|
|
|
26
44
|
<div class=clipper>
|
|
27
|
-
<div part=blanket @click="${
|
|
45
|
+
<div part=blanket @click="${control.close}" ?inert="${!control.isOpen}"></div>
|
|
28
46
|
|
|
29
47
|
<div part=tray>
|
|
30
|
-
<slot ?inert="${!
|
|
31
|
-
|
|
32
|
-
${options.button
|
|
33
|
-
? html `
|
|
34
|
-
<button @click="${drawer.toggle}">
|
|
35
|
-
${drawer.isOpen
|
|
36
|
-
? html `
|
|
37
|
-
<slot name=button-x>
|
|
38
|
-
${xSvg}
|
|
39
|
-
</slot>
|
|
40
|
-
`
|
|
41
|
-
: html `
|
|
42
|
-
<slot name=button>
|
|
43
|
-
${menu2Svg}
|
|
44
|
-
</slot>
|
|
45
|
-
`}
|
|
46
|
-
</button>
|
|
47
|
-
`
|
|
48
|
-
: null}
|
|
48
|
+
<slot part=slate ?inert="${!control.isOpen}"></slot>
|
|
49
|
+
${button ? renderButton() : null}
|
|
49
50
|
</div>
|
|
50
51
|
</div>
|
|
51
52
|
</div>
|
|
@@ -67,10 +68,6 @@ export class ShinyDrawer extends (view(use => (context, options) => {
|
|
|
67
68
|
get open() { return this.control.open; }
|
|
68
69
|
get close() { return this.control.close; }
|
|
69
70
|
})
|
|
70
|
-
.props(el => [el.context, {
|
|
71
|
-
control: el.control,
|
|
72
|
-
button: el.button,
|
|
73
|
-
side: el.side,
|
|
74
|
-
}])) {
|
|
71
|
+
.props(el => [el.context, { control: el.control }])) {
|
|
75
72
|
}
|
|
76
73
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../s/components/drawer/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAC,GAAG,EAAE,IAAI,EAAC,MAAM,WAAW,CAAA;AAEnC,OAAO,QAAQ,MAAM,gBAAgB,CAAA;AACrC,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,uBAAuB,CAAA;AAC5C,OAAO,IAAI,MAAM,6BAA6B,CAAA;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAA;AAClD,OAAO,QAAQ,MAAM,kCAAkC,CAAA;AACvD,OAAO,EAAe,YAAY,EAAC,MAAM,iBAAiB,CAAA;AAE1D,MAAM,OAAO,WAAY,SAAQ,CAChC,IAAI,CAAC,GAAG,CAAC,EAAE,CA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