godown 3.10.1 → 3.11.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 +2 -63
- package/alert.d.ts.map +1 -1
- package/avatar.d.ts.map +1 -1
- package/badge.d.ts.map +1 -1
- package/breath.d.ts.map +1 -1
- package/build/godown+lit.iife.js +14 -14
- package/build/godown+lit.iife.js.map +1 -1
- package/build/godown+lit.js +14 -14
- package/build/godown+lit.js.map +1 -1
- package/build/godown+lit.umd.js +14 -14
- package/build/godown+lit.umd.js.map +1 -1
- package/build/godown.iife.js +9 -9
- package/build/godown.js +7 -7
- package/build/godown.js.map +1 -1
- package/build/godown.umd.js +10 -10
- package/build/godown.umd.js.map +1 -1
- package/button.d.ts.map +1 -1
- package/card.d.ts.map +1 -1
- package/carousel.d.ts.map +1 -1
- package/chip.d.ts +2 -0
- package/chip.d.ts.map +1 -0
- package/chip.js +2 -0
- package/chip.js.map +1 -0
- package/custom-elements.json +1 -1
- package/details.d.ts.map +1 -1
- package/dialog.d.ts.map +1 -1
- package/divider.d.ts.map +1 -1
- package/dragbox.d.ts.map +1 -1
- package/flex.d.ts.map +1 -1
- package/form.d.ts.map +1 -1
- package/grid.d.ts.map +1 -1
- package/heading.d.ts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/input.d.ts.map +1 -1
- package/internal/direction.d.ts.map +1 -1
- package/internal/direction.js.map +1 -1
- package/internal/global-style.d.ts +8 -9
- package/internal/global-style.d.ts.map +1 -1
- package/internal/global-style.js +1 -1
- package/internal/global-style.js.map +1 -1
- package/internal/icons/caret-down.d.ts +4 -0
- package/internal/icons/caret-down.d.ts.map +1 -0
- package/internal/icons/caret-down.js +2 -0
- package/internal/icons/caret-down.js.map +1 -0
- package/internal/icons/caret-left.d.ts +4 -0
- package/internal/icons/caret-left.d.ts.map +1 -0
- package/internal/icons/caret-left.js +2 -0
- package/internal/icons/caret-left.js.map +1 -0
- package/internal/icons/caret-right.d.ts +4 -0
- package/internal/icons/caret-right.d.ts.map +1 -0
- package/internal/icons/caret-right.js +2 -0
- package/internal/icons/caret-right.js.map +1 -0
- package/internal/icons/eye-slash.d.ts +4 -0
- package/internal/icons/eye-slash.d.ts.map +1 -0
- package/internal/icons/eye-slash.js +2 -0
- package/internal/icons/eye-slash.js.map +1 -0
- package/internal/ring.d.ts +19 -0
- package/internal/ring.d.ts.map +1 -0
- package/internal/ring.js +2 -0
- package/internal/ring.js.map +1 -0
- package/internal/super-input.d.ts +2 -2
- package/internal/super-input.d.ts.map +1 -1
- package/internal/super-input.js +1 -1
- package/internal/super-input.js.map +1 -1
- package/internal/super-openable.d.ts.map +1 -1
- package/internal/super-openable.js.map +1 -1
- package/layout.d.ts.map +1 -1
- package/link.d.ts.map +1 -1
- package/package.json +3 -5
- package/progress.d.ts.map +1 -1
- package/range.d.ts.map +1 -1
- package/rotate.d.ts.map +1 -1
- package/router.d.ts.map +1 -1
- package/select.d.ts.map +1 -1
- package/skeleton.d.ts.map +1 -1
- package/split.d.ts.map +1 -1
- package/src/chip.ts +1 -0
- package/src/index.ts +1 -0
- package/src/internal/global-style.ts +40 -37
- package/src/internal/icons/caret-down.ts +7 -0
- package/src/internal/icons/caret-left.ts +7 -0
- package/src/internal/icons/caret-right.ts +7 -0
- package/src/internal/icons/eye-slash.ts +7 -0
- package/src/internal/ring.ts +57 -0
- package/src/internal/super-input.ts +9 -70
- package/src/web-components/alert/component.ts +16 -195
- package/src/web-components/badge/component.ts +7 -96
- package/src/web-components/breath/component.ts +8 -8
- package/src/web-components/button/component.ts +9 -139
- package/src/web-components/card/component.ts +11 -6
- package/src/web-components/carousel/component.ts +6 -6
- package/src/web-components/chip/component.ts +115 -0
- package/src/web-components/chip/definition.ts +11 -0
- package/src/web-components/details/component.ts +1 -1
- package/src/web-components/divider/component.ts +2 -17
- package/src/web-components/heading/component.ts +12 -16
- package/src/web-components/input/component.ts +87 -39
- package/src/web-components/link/component.ts +53 -3
- package/src/web-components/progress/component.ts +2 -1
- package/src/web-components/range/component.ts +19 -25
- package/src/web-components/rotate/component.ts +2 -2
- package/src/web-components/select/component.ts +14 -18
- package/src/web-components/select/definition.ts +1 -1
- package/src/web-components/skeleton/component.ts +13 -57
- package/src/web-components/split/component.ts +16 -14
- package/src/web-components/switch/component.ts +4 -7
- package/src/web-components/tabs/component.ts +11 -8
- package/src/web-components/text/component.ts +2 -2
- package/switch.d.ts.map +1 -1
- package/tabs.d.ts.map +1 -1
- package/text.d.ts.map +1 -1
- package/time.d.ts.map +1 -1
- package/tooltip.d.ts.map +1 -1
- package/typewriter.d.ts.map +1 -1
- package/vscode.html-custom-data.json +1 -1
- package/web-components/alert/component.d.ts +5 -32
- package/web-components/alert/component.d.ts.map +1 -1
- package/web-components/alert/component.js +1 -1
- package/web-components/alert/component.js.map +1 -1
- package/web-components/alert/definition.d.ts.map +1 -1
- package/web-components/alert/definition.js.map +1 -1
- package/web-components/avatar/component.d.ts.map +1 -1
- package/web-components/avatar/component.js.map +1 -1
- package/web-components/avatar/definition.d.ts.map +1 -1
- package/web-components/avatar/definition.js.map +1 -1
- package/web-components/badge/component.d.ts +4 -21
- package/web-components/badge/component.d.ts.map +1 -1
- package/web-components/badge/component.js +1 -1
- package/web-components/badge/component.js.map +1 -1
- package/web-components/badge/definition.d.ts.map +1 -1
- package/web-components/badge/definition.js.map +1 -1
- package/web-components/breath/component.d.ts.map +1 -1
- package/web-components/breath/component.js +1 -1
- package/web-components/breath/component.js.map +1 -1
- package/web-components/breath/definition.d.ts.map +1 -1
- package/web-components/breath/definition.js.map +1 -1
- package/web-components/button/component.d.ts +0 -18
- package/web-components/button/component.d.ts.map +1 -1
- package/web-components/button/component.js +1 -1
- package/web-components/button/component.js.map +1 -1
- package/web-components/button/definition.d.ts.map +1 -1
- package/web-components/button/definition.js.map +1 -1
- package/web-components/card/component.d.ts +3 -0
- package/web-components/card/component.d.ts.map +1 -1
- package/web-components/card/component.js +1 -1
- package/web-components/card/component.js.map +1 -1
- package/web-components/card/definition.d.ts.map +1 -1
- package/web-components/card/definition.js.map +1 -1
- package/web-components/carousel/component.d.ts.map +1 -1
- package/web-components/carousel/component.js +1 -1
- package/web-components/carousel/component.js.map +1 -1
- package/web-components/carousel/definition.d.ts.map +1 -1
- package/web-components/carousel/definition.js.map +1 -1
- package/web-components/chip/component.d.ts +31 -0
- package/web-components/chip/component.d.ts.map +1 -0
- package/web-components/chip/component.js +2 -0
- package/web-components/chip/component.js.map +1 -0
- package/web-components/chip/definition.d.ts +8 -0
- package/web-components/chip/definition.d.ts.map +1 -0
- package/web-components/chip/definition.js +2 -0
- package/web-components/chip/definition.js.map +1 -0
- package/web-components/details/component.d.ts.map +1 -1
- package/web-components/details/component.js +1 -1
- package/web-components/details/component.js.map +1 -1
- package/web-components/details/definition.d.ts.map +1 -1
- package/web-components/details/definition.js.map +1 -1
- package/web-components/dialog/component.d.ts.map +1 -1
- package/web-components/dialog/component.js.map +1 -1
- package/web-components/dialog/definition.d.ts.map +1 -1
- package/web-components/dialog/definition.js.map +1 -1
- package/web-components/divider/component.d.ts.map +1 -1
- package/web-components/divider/component.js +1 -1
- package/web-components/divider/component.js.map +1 -1
- package/web-components/divider/definition.d.ts.map +1 -1
- package/web-components/divider/definition.js.map +1 -1
- package/web-components/dragbox/component.d.ts.map +1 -1
- package/web-components/dragbox/component.js.map +1 -1
- package/web-components/dragbox/definition.d.ts.map +1 -1
- package/web-components/dragbox/definition.js.map +1 -1
- package/web-components/flex/component.d.ts.map +1 -1
- package/web-components/flex/component.js.map +1 -1
- package/web-components/flex/definition.d.ts.map +1 -1
- package/web-components/flex/definition.js.map +1 -1
- package/web-components/form/component.d.ts.map +1 -1
- package/web-components/form/component.js.map +1 -1
- package/web-components/form/definition.d.ts.map +1 -1
- package/web-components/form/definition.js.map +1 -1
- package/web-components/grid/component.d.ts.map +1 -1
- package/web-components/grid/component.js.map +1 -1
- package/web-components/grid/definition.d.ts.map +1 -1
- package/web-components/grid/definition.js.map +1 -1
- package/web-components/heading/component.d.ts +2 -2
- package/web-components/heading/component.d.ts.map +1 -1
- package/web-components/heading/component.js +1 -1
- package/web-components/heading/component.js.map +1 -1
- package/web-components/heading/definition.d.ts.map +1 -1
- package/web-components/heading/definition.js.map +1 -1
- package/web-components/input/component.d.ts +3 -3
- package/web-components/input/component.d.ts.map +1 -1
- package/web-components/input/component.js +1 -1
- package/web-components/input/component.js.map +1 -1
- package/web-components/input/definition.d.ts.map +1 -1
- package/web-components/input/definition.js.map +1 -1
- package/web-components/layout/component.d.ts.map +1 -1
- package/web-components/layout/component.js.map +1 -1
- package/web-components/layout/definition.d.ts.map +1 -1
- package/web-components/layout/definition.js.map +1 -1
- package/web-components/link/component.d.ts +13 -2
- package/web-components/link/component.d.ts.map +1 -1
- package/web-components/link/component.js +1 -1
- package/web-components/link/component.js.map +1 -1
- package/web-components/link/definition.d.ts.map +1 -1
- package/web-components/link/definition.js.map +1 -1
- package/web-components/progress/component.d.ts.map +1 -1
- package/web-components/progress/component.js +1 -1
- package/web-components/progress/component.js.map +1 -1
- package/web-components/progress/definition.d.ts.map +1 -1
- package/web-components/progress/definition.js.map +1 -1
- package/web-components/range/component.d.ts.map +1 -1
- package/web-components/range/component.js +1 -1
- package/web-components/range/component.js.map +1 -1
- package/web-components/range/definition.d.ts.map +1 -1
- package/web-components/range/definition.js.map +1 -1
- package/web-components/rotate/component.d.ts.map +1 -1
- package/web-components/rotate/component.js +1 -1
- package/web-components/rotate/component.js.map +1 -1
- package/web-components/rotate/definition.d.ts.map +1 -1
- package/web-components/rotate/definition.js.map +1 -1
- package/web-components/router/component.d.ts.map +1 -1
- package/web-components/router/component.js.map +1 -1
- package/web-components/router/definition.d.ts.map +1 -1
- package/web-components/router/definition.js.map +1 -1
- package/web-components/select/component.d.ts +2 -1
- package/web-components/select/component.d.ts.map +1 -1
- package/web-components/select/component.js +1 -1
- package/web-components/select/component.js.map +1 -1
- package/web-components/select/definition.d.ts +1 -1
- package/web-components/select/definition.d.ts.map +1 -1
- package/web-components/select/definition.js.map +1 -1
- package/web-components/skeleton/component.d.ts +0 -9
- package/web-components/skeleton/component.d.ts.map +1 -1
- package/web-components/skeleton/component.js +1 -1
- package/web-components/skeleton/component.js.map +1 -1
- package/web-components/skeleton/definition.d.ts.map +1 -1
- package/web-components/skeleton/definition.js.map +1 -1
- package/web-components/split/component.d.ts +1 -1
- package/web-components/split/component.d.ts.map +1 -1
- package/web-components/split/component.js +1 -1
- package/web-components/split/component.js.map +1 -1
- package/web-components/split/definition.d.ts.map +1 -1
- package/web-components/split/definition.js.map +1 -1
- package/web-components/switch/component.d.ts.map +1 -1
- package/web-components/switch/component.js +1 -1
- package/web-components/switch/component.js.map +1 -1
- package/web-components/switch/definition.d.ts.map +1 -1
- package/web-components/switch/definition.js.map +1 -1
- package/web-components/tabs/component.d.ts +3 -3
- package/web-components/tabs/component.d.ts.map +1 -1
- package/web-components/tabs/component.js +1 -1
- package/web-components/tabs/component.js.map +1 -1
- package/web-components/tabs/definition.d.ts.map +1 -1
- package/web-components/tabs/definition.js.map +1 -1
- package/web-components/text/component.d.ts +1 -1
- package/web-components/text/component.d.ts.map +1 -1
- package/web-components/text/component.js +1 -1
- package/web-components/text/component.js.map +1 -1
- package/web-components/text/definition.d.ts.map +1 -1
- package/web-components/text/definition.js.map +1 -1
- package/web-components/time/component.d.ts.map +1 -1
- package/web-components/time/component.js.map +1 -1
- package/web-components/time/definition.d.ts.map +1 -1
- package/web-components/time/definition.js.map +1 -1
- package/web-components/tooltip/component.d.ts.map +1 -1
- package/web-components/tooltip/component.js.map +1 -1
- package/web-components/tooltip/definition.d.ts.map +1 -1
- package/web-components/tooltip/definition.js.map +1 -1
- package/web-components/typewriter/component.d.ts.map +1 -1
- package/web-components/typewriter/component.js.map +1 -1
- package/web-components/typewriter/definition.d.ts.map +1 -1
- package/web-components/typewriter/definition.js.map +1 -1
- package/web-types.json +1 -1
- package/internal/outline.d.ts +0 -19
- package/internal/outline.d.ts.map +0 -1
- package/internal/outline.js +0 -2
- package/internal/outline.js.map +0 -1
- package/internal/super-anchor.d.ts +0 -18
- package/internal/super-anchor.d.ts.map +0 -1
- package/internal/super-anchor.js +0 -2
- package/internal/super-anchor.js.map +0 -1
- package/src/internal/outline.ts +0 -58
- package/src/internal/super-anchor.ts +0 -60
@@ -1,4 +1,4 @@
|
|
1
|
-
import { attr, godown, htmlSlot,
|
1
|
+
import { attr, godown, htmlSlot, queryPart, styles } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
@@ -7,92 +7,11 @@ import { GlobalStyle, cssGlobalVars, scopePrefix } from "../../internal/global-s
|
|
7
7
|
const protoName = "button";
|
8
8
|
const cssScope = scopePrefix(protoName);
|
9
9
|
|
10
|
-
const whiteFont = cssGlobalVars.white;
|
11
|
-
const blackFont = cssGlobalVars.black;
|
12
|
-
|
13
|
-
type Colors =
|
14
|
-
| "none"
|
15
|
-
| "teal"
|
16
|
-
| "blue"
|
17
|
-
| "green"
|
18
|
-
| "red"
|
19
|
-
| "purple"
|
20
|
-
| "orange"
|
21
|
-
| "yellow"
|
22
|
-
| "pink"
|
23
|
-
| "gray"
|
24
|
-
| "white"
|
25
|
-
| "black";
|
26
|
-
|
27
|
-
const colorDetails = {
|
28
|
-
black: [
|
29
|
-
whiteFont, // color
|
30
|
-
cssGlobalVars._colors.darkgray[7], // background
|
31
|
-
cssGlobalVars._colors.darkgray[5], // gradients
|
32
|
-
],
|
33
|
-
gray: [
|
34
|
-
whiteFont, // color
|
35
|
-
cssGlobalVars._colors.darkgray[1], // background
|
36
|
-
cssGlobalVars._colors.lightgray[8], // gradients
|
37
|
-
],
|
38
|
-
white: [
|
39
|
-
blackFont, // color
|
40
|
-
cssGlobalVars._colors.lightgray[3], // background
|
41
|
-
cssGlobalVars._colors.lightgray[0], // gradients
|
42
|
-
],
|
43
|
-
blue: [
|
44
|
-
whiteFont, // color
|
45
|
-
cssGlobalVars._colors.blue[6], // background
|
46
|
-
cssGlobalVars._colors.blue[4], // gradients
|
47
|
-
],
|
48
|
-
green: [
|
49
|
-
whiteFont, // color
|
50
|
-
cssGlobalVars._colors.green[6], // background
|
51
|
-
cssGlobalVars._colors.green[4], // gradients
|
52
|
-
],
|
53
|
-
red: [
|
54
|
-
whiteFont, // color
|
55
|
-
cssGlobalVars._colors.red[6], // background
|
56
|
-
cssGlobalVars._colors.red[4], // gradients
|
57
|
-
],
|
58
|
-
orange: [
|
59
|
-
whiteFont, // color
|
60
|
-
cssGlobalVars._colors.orange[6], // background
|
61
|
-
cssGlobalVars._colors.orange[4], // gradients
|
62
|
-
],
|
63
|
-
pink: [
|
64
|
-
whiteFont, // color
|
65
|
-
cssGlobalVars._colors.pink[6], // background
|
66
|
-
cssGlobalVars._colors.pink[4], // gradients
|
67
|
-
],
|
68
|
-
purple: [
|
69
|
-
whiteFont, // color
|
70
|
-
cssGlobalVars._colors.purple[6], // background
|
71
|
-
cssGlobalVars._colors.purple[4], // gradients
|
72
|
-
],
|
73
|
-
yellow: [
|
74
|
-
blackFont, // color
|
75
|
-
cssGlobalVars._colors.yellow[6], // background
|
76
|
-
cssGlobalVars._colors.yellow[4], // gradients
|
77
|
-
],
|
78
|
-
teal: [
|
79
|
-
whiteFont, // color
|
80
|
-
cssGlobalVars._colors.teal[6], // background
|
81
|
-
cssGlobalVars._colors.teal[4], // gradients
|
82
|
-
],
|
83
|
-
};
|
84
|
-
|
85
10
|
/**
|
86
11
|
* {@linkcode Button} renders a button.
|
87
12
|
*
|
88
13
|
* Create modal animation upon clicking.
|
89
14
|
*
|
90
|
-
* Available colors (background): none, black, gray, white, blue, green, red, orange, pink, purple, yellow, teal.
|
91
|
-
*
|
92
|
-
* Default color is `black`.
|
93
|
-
*
|
94
|
-
* Set the color to `none` to prevent applying styles.
|
95
|
-
*
|
96
15
|
* @slot - The content of the button.
|
97
16
|
* @category input
|
98
17
|
*/
|
@@ -112,13 +31,6 @@ const colorDetails = {
|
|
112
31
|
filter: brightness(0.85);
|
113
32
|
}
|
114
33
|
|
115
|
-
:host([ghost]) {
|
116
|
-
${cssScope}--modal-background: var(${cssScope}--ghost-color);
|
117
|
-
box-shadow: inset 0px 0px 0px var(${cssScope}--ghost-width) var(${cssScope}--ghost-color);
|
118
|
-
color: var(${cssScope}--ghost-color);
|
119
|
-
background: transparent;
|
120
|
-
}
|
121
|
-
|
122
34
|
:host([plain]) {
|
123
35
|
${cssScope}--gradients: unset;
|
124
36
|
${cssScope}--focus-scale: unset;
|
@@ -126,21 +38,14 @@ const colorDetails = {
|
|
126
38
|
`,
|
127
39
|
css`
|
128
40
|
:host {
|
129
|
-
${cssScope}--
|
130
|
-
${cssScope}--padding-y: calc(var(${cssScope}--padding-x) / 4);
|
131
|
-
${cssScope}--padding: var(${cssScope}--padding-y) var(${cssScope}--padding-x);
|
132
|
-
${cssScope}--modal-animation-duration: 1s;
|
133
|
-
${cssScope}--ghost-width: .08em;
|
41
|
+
${cssScope}--modal-animation-duration: 1.5s;
|
134
42
|
${cssScope}--focus-scale: .97;
|
135
43
|
${cssScope}--deg: 45deg;
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
var(${cssScope}--gradients, var(${cssScope}--background))
|
142
|
-
);
|
143
|
-
padding: var(${cssScope}--padding);
|
44
|
+
color: var(${cssGlobalVars.primaryForeground});
|
45
|
+
background: var(${cssGlobalVars.primaryBackground});
|
46
|
+
padding: 0.25em 0.75em;
|
47
|
+
border-width: var(${cssGlobalVars.ringWidth});
|
48
|
+
border-style: none;
|
144
49
|
width: fit-content;
|
145
50
|
display: block;
|
146
51
|
overflow: hidden;
|
@@ -155,10 +60,7 @@ const colorDetails = {
|
|
155
60
|
|
156
61
|
[part="root"] {
|
157
62
|
position: relative;
|
158
|
-
transition: none;
|
159
63
|
user-select: none;
|
160
|
-
border-radius: inherit;
|
161
|
-
transition-duration: inherit;
|
162
64
|
}
|
163
65
|
|
164
66
|
i {
|
@@ -190,21 +92,6 @@ const colorDetails = {
|
|
190
92
|
`,
|
191
93
|
)
|
192
94
|
class Button extends GlobalStyle {
|
193
|
-
private __colorSC = new StyleController(this, () => {
|
194
|
-
const color = this.nextColor();
|
195
|
-
if (color in colorDetails) {
|
196
|
-
const [fg, bg, gd] = colorDetails[color];
|
197
|
-
return joinRules({
|
198
|
-
":host": [
|
199
|
-
[`${cssScope}--color`, `var(${fg})`],
|
200
|
-
[`${cssScope}--background`, `var(${bg})`],
|
201
|
-
[`${cssScope}--gradients`, `var(${gd})`],
|
202
|
-
],
|
203
|
-
});
|
204
|
-
}
|
205
|
-
return null;
|
206
|
-
});
|
207
|
-
|
208
95
|
/**
|
209
96
|
* If true, remove gradient, modal animation, focus scale.
|
210
97
|
*/
|
@@ -217,13 +104,6 @@ class Button extends GlobalStyle {
|
|
217
104
|
@property({ type: Boolean, reflect: true })
|
218
105
|
disabled = false;
|
219
106
|
|
220
|
-
/**
|
221
|
-
* Whether this element should be rendered as a "ghost" button.
|
222
|
-
* A ghost button is a button with a transparent background and a border.
|
223
|
-
*/
|
224
|
-
@property({ type: Boolean, reflect: true })
|
225
|
-
ghost = false;
|
226
|
-
|
227
107
|
/**
|
228
108
|
* Whether this element is active or not.
|
229
109
|
*/
|
@@ -236,21 +116,15 @@ class Button extends GlobalStyle {
|
|
236
116
|
@property({ type: Boolean, reflect: true })
|
237
117
|
round = false;
|
238
118
|
|
239
|
-
/**
|
240
|
-
* The primary color.
|
241
|
-
*/
|
242
|
-
@property({ reflect: true })
|
243
|
-
color: Colors = "black";
|
244
|
-
|
245
119
|
/**
|
246
120
|
* Content text.
|
247
121
|
*/
|
248
122
|
@property()
|
249
123
|
content: string;
|
250
124
|
|
251
|
-
@
|
125
|
+
@queryPart("modal-root")
|
252
126
|
protected _modalRoot: HTMLElement;
|
253
|
-
@
|
127
|
+
@queryPart("root")
|
254
128
|
protected _root: HTMLElement;
|
255
129
|
|
256
130
|
protected render(): TemplateResult<1> {
|
@@ -307,10 +181,6 @@ class Button extends GlobalStyle {
|
|
307
181
|
this._modalRoot.appendChild(modal);
|
308
182
|
modal.addEventListener("animationend", () => modal.remove(), { once: true });
|
309
183
|
}
|
310
|
-
|
311
|
-
nextColor(): Colors {
|
312
|
-
return this.color;
|
313
|
-
}
|
314
184
|
}
|
315
185
|
|
316
186
|
export default Button;
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
1
|
+
import { attr, godown, htmlSlot, StyleController, styles } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
5
|
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../../internal/global-style.js";
|
6
6
|
import type Layout from "../layout/component.js";
|
7
|
+
import { RingBuilder, type RingType } from "../../internal/ring.js";
|
7
8
|
|
8
9
|
const protoName = "card";
|
9
10
|
const cssScope = scopePrefix(protoName);
|
@@ -22,9 +23,8 @@ const cssScope = scopePrefix(protoName);
|
|
22
23
|
@godown(protoName)
|
23
24
|
@styles(css`
|
24
25
|
:host {
|
25
|
-
${cssScope}--border-width: .075em;
|
26
|
-
${cssScope}--border-color: var(${cssGlobalVars.passive});
|
27
26
|
${cssScope}--padding: .75em;
|
27
|
+
background: var(${cssGlobalVars.background});
|
28
28
|
display: block;
|
29
29
|
flex-shrink: 0;
|
30
30
|
}
|
@@ -35,9 +35,6 @@ const cssScope = scopePrefix(protoName);
|
|
35
35
|
}
|
36
36
|
|
37
37
|
[part="root"] {
|
38
|
-
border-color: var(${cssScope}--border-color);
|
39
|
-
border-style: solid;
|
40
|
-
border-width: var(${cssScope}--border-width);
|
41
38
|
border-radius: inherit;
|
42
39
|
}
|
43
40
|
|
@@ -50,6 +47,14 @@ const cssScope = scopePrefix(protoName);
|
|
50
47
|
}
|
51
48
|
`)
|
52
49
|
class Card extends GlobalStyle {
|
50
|
+
constructor() {
|
51
|
+
super();
|
52
|
+
new StyleController(this, () => new RingBuilder({ type: this.ringType }).css);
|
53
|
+
}
|
54
|
+
|
55
|
+
@property({ attribute: "ring-type" })
|
56
|
+
ringType: RingType = "border";
|
57
|
+
|
53
58
|
/**
|
54
59
|
* Whether to display the header.
|
55
60
|
*/
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { attr, godown, htmlSlot,
|
2
|
-
import
|
3
|
-
import
|
1
|
+
import { attr, godown, htmlSlot, queryPart, styles } from "@godown/element";
|
2
|
+
import iconCaretLeft from "../../internal/icons/caret-left.js";
|
3
|
+
import iconCaretRight from "../../internal/icons/caret-right.js";
|
4
4
|
import { type TemplateResult, css, html } from "lit";
|
5
5
|
import { property } from "lit/decorators.js";
|
6
6
|
|
@@ -80,7 +80,7 @@ class Carousel extends GlobalStyle {
|
|
80
80
|
@property({ type: Number })
|
81
81
|
autoChange = 0;
|
82
82
|
|
83
|
-
@
|
83
|
+
@queryPart("move-root")
|
84
84
|
protected _moveRoot: HTMLElement;
|
85
85
|
|
86
86
|
intervalID: number;
|
@@ -101,14 +101,14 @@ class Carousel extends GlobalStyle {
|
|
101
101
|
part="prev"
|
102
102
|
@click="${this.prev}"
|
103
103
|
>
|
104
|
-
${
|
104
|
+
${iconCaretLeft()}
|
105
105
|
</i>
|
106
106
|
<div part="move-root">${htmlSlot()}</div>
|
107
107
|
<i
|
108
108
|
part="next"
|
109
109
|
@click="${this.next}"
|
110
110
|
>
|
111
|
-
${
|
111
|
+
${iconCaretRight()}
|
112
112
|
</i>
|
113
113
|
</div>
|
114
114
|
`;
|
@@ -0,0 +1,115 @@
|
|
1
|
+
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
+
import { type TemplateResult, css, html } from "lit";
|
3
|
+
import { property } from "lit/decorators.js";
|
4
|
+
|
5
|
+
import { GlobalStyle, cssGlobalVars, scopePrefix } from "../../internal/global-style.js";
|
6
|
+
import type { DirectionCorner } from "../../internal/direction.js";
|
7
|
+
|
8
|
+
const protoName = "chip";
|
9
|
+
const cssScope = scopePrefix(protoName);
|
10
|
+
|
11
|
+
/**
|
12
|
+
* {@linkcode Chip} renders a chip.
|
13
|
+
*
|
14
|
+
* @slot - Chip content.
|
15
|
+
* @category display
|
16
|
+
*/
|
17
|
+
@godown(protoName)
|
18
|
+
@styles(css`
|
19
|
+
:host {
|
20
|
+
${cssScope}--offset: 0%;
|
21
|
+
${cssScope}--offset-x: var(${cssScope}--offset);
|
22
|
+
${cssScope}--offset-y: var(${cssScope}--offset);
|
23
|
+
}
|
24
|
+
|
25
|
+
:host,
|
26
|
+
:host([contents]) [part="root"] {
|
27
|
+
display: inline-block;
|
28
|
+
}
|
29
|
+
|
30
|
+
[part="root"] {
|
31
|
+
position: relative;
|
32
|
+
}
|
33
|
+
|
34
|
+
[part="chip"] {
|
35
|
+
position: absolute;
|
36
|
+
font-size: 75%;
|
37
|
+
padding: 0 0.5em;
|
38
|
+
user-select: none;
|
39
|
+
border-radius: calc(infinity * 1px);
|
40
|
+
transform: translate(-50%, -50%);
|
41
|
+
color: var(${cssGlobalVars.primaryForeground});
|
42
|
+
background: var(${cssGlobalVars.primaryBackground});
|
43
|
+
}
|
44
|
+
|
45
|
+
[part="chip"]:empty {
|
46
|
+
width: 0.5em;
|
47
|
+
height: 0.5em;
|
48
|
+
font-size: 100%;
|
49
|
+
padding: 0;
|
50
|
+
border-radius: 50%;
|
51
|
+
}
|
52
|
+
|
53
|
+
[position^="top"] [part="chip"] {
|
54
|
+
top: calc(0% + var(${cssScope}--offset-y));
|
55
|
+
}
|
56
|
+
|
57
|
+
[position$="right"] [part="chip"] {
|
58
|
+
left: calc(100% - var(${cssScope}--offset-x));
|
59
|
+
}
|
60
|
+
|
61
|
+
[position^="bottom"] [part="chip"] {
|
62
|
+
top: calc(100% - var(${cssScope}--offset-y));
|
63
|
+
}
|
64
|
+
|
65
|
+
[position$="left"] [part="chip"] {
|
66
|
+
left: calc(0% + var(${cssScope}--offset-x));
|
67
|
+
}
|
68
|
+
`)
|
69
|
+
class Chip extends GlobalStyle {
|
70
|
+
/**
|
71
|
+
* The position of the chip relative to its parent element.
|
72
|
+
* Possible values are `"top-left"`, `"top-right"`, `"bottom-left"`, and `"bottom-right"`.
|
73
|
+
*/
|
74
|
+
@property()
|
75
|
+
position: DirectionCorner = "top-right";
|
76
|
+
|
77
|
+
@property({ type: Number })
|
78
|
+
value = 0;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* If `true`, render a dot chip.
|
82
|
+
*/
|
83
|
+
@property({ type: Boolean })
|
84
|
+
dot = false;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* The maximum value that can be displayed in the chip
|
88
|
+
* Values greater than this will be displayed as `max+` by default.
|
89
|
+
*/
|
90
|
+
@property({ type: Number })
|
91
|
+
max = 99;
|
92
|
+
|
93
|
+
formatValue(value: number): string {
|
94
|
+
return value > this.max ? this.max + "+" : value + "";
|
95
|
+
}
|
96
|
+
|
97
|
+
render(): TemplateResult<1> {
|
98
|
+
return html`
|
99
|
+
<div
|
100
|
+
part="root"
|
101
|
+
${attr(this.observedRecord)}
|
102
|
+
>
|
103
|
+
${htmlSlot()}
|
104
|
+
${this.value || this.dot
|
105
|
+
? html`
|
106
|
+
<div part="chip">${this.dot ? "" : this.formatValue(this.value)}</div>
|
107
|
+
`
|
108
|
+
: ""}
|
109
|
+
</div>
|
110
|
+
`;
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
export default Chip;
|
115
|
+
export { Chip };
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { attr, godown, htmlSlot, styles } from "@godown/element";
|
2
|
-
import svgCaretDown from "
|
2
|
+
import svgCaretDown from "../../internal/icons/caret-down.js";
|
3
3
|
import { type TemplateResult, css, html } from "lit";
|
4
4
|
import { property } from "lit/decorators.js";
|
5
5
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { godown, styles } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
@@ -25,18 +25,6 @@ const protoName = "divider";
|
|
25
25
|
width: 0.05em;
|
26
26
|
height: 100%;
|
27
27
|
}
|
28
|
-
|
29
|
-
:host([contents]) [part="root"] {
|
30
|
-
width: 100%;
|
31
|
-
height: 0.05em;
|
32
|
-
margin: auto;
|
33
|
-
display: block;
|
34
|
-
background: currentColor;
|
35
|
-
}
|
36
|
-
|
37
|
-
[part="root"] {
|
38
|
-
display: contents;
|
39
|
-
}
|
40
28
|
`)
|
41
29
|
class Divider extends GlobalStyle {
|
42
30
|
/**
|
@@ -47,10 +35,7 @@ class Divider extends GlobalStyle {
|
|
47
35
|
|
48
36
|
protected render(): TemplateResult<1> {
|
49
37
|
return html`
|
50
|
-
<div
|
51
|
-
part="root"
|
52
|
-
${attr(this.observedRecord)}
|
53
|
-
></div>
|
38
|
+
<div part="root"></div>
|
54
39
|
`;
|
55
40
|
}
|
56
41
|
}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { godown, htmlSlot, styles, tokenList } from "@godown/element";
|
2
2
|
import { type TemplateResult, css, html, nothing } from "lit";
|
3
3
|
import { property } from "lit/decorators.js";
|
4
4
|
|
5
|
-
import
|
5
|
+
import Link from "../link/component.js";
|
6
6
|
|
7
7
|
const protoName = "heading";
|
8
8
|
|
@@ -21,22 +21,19 @@ const protoName = "heading";
|
|
21
21
|
text-align: start;
|
22
22
|
}
|
23
23
|
|
24
|
-
[part
|
24
|
+
[part~="anchor"] {
|
25
25
|
position: absolute;
|
26
26
|
text-align: center;
|
27
27
|
min-width: 1.25em;
|
28
28
|
right: 100%;
|
29
29
|
}
|
30
30
|
|
31
|
-
[
|
31
|
+
[part~="left"][part~="anchor"] {
|
32
32
|
right: 100%;
|
33
33
|
}
|
34
|
-
[side="right"] [part="anchor"] {
|
35
|
-
left: 100%;
|
36
|
-
}
|
37
34
|
|
38
|
-
|
39
|
-
|
35
|
+
[part~="right"][part~="anchor"] {
|
36
|
+
left: 100%;
|
40
37
|
}
|
41
38
|
|
42
39
|
h1,
|
@@ -45,13 +42,12 @@ const protoName = "heading";
|
|
45
42
|
h4,
|
46
43
|
h5,
|
47
44
|
h6 {
|
48
|
-
|
45
|
+
width: fit-content;
|
49
46
|
font-size: revert;
|
50
47
|
position: relative;
|
51
|
-
width: fit-content;
|
52
48
|
}
|
53
49
|
`)
|
54
|
-
class Heading extends
|
50
|
+
class Heading extends Link {
|
55
51
|
/**
|
56
52
|
* The heading level.
|
57
53
|
*/
|
@@ -73,17 +69,17 @@ class Heading extends GlobalStyle {
|
|
73
69
|
side: "left" | "right" = "left";
|
74
70
|
|
75
71
|
protected render(): TemplateResult<1> {
|
72
|
+
const hrefValue = this.href || (this.id ? "#" + this.id : undefined);
|
76
73
|
return html`
|
77
74
|
<a
|
78
75
|
part="root"
|
79
|
-
href="${
|
80
|
-
${attr(this.observedRecord)}
|
76
|
+
href="${hrefValue || nothing}"
|
81
77
|
>
|
82
78
|
${this.wrapHeading(
|
83
79
|
htmlSlot(),
|
84
|
-
|
80
|
+
hrefValue
|
85
81
|
? html`
|
86
|
-
<i part="anchor">${this.anchor}</i>
|
82
|
+
<i part="${tokenList("anchor", this.side)}">${this.anchor}</i>
|
87
83
|
`
|
88
84
|
: "",
|
89
85
|
)}
|