@m3e/heading 1.0.0-rc.1 → 1.0.0-rc.2
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 +1 -2
- package/dist/custom-elements.json +2549 -9
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +102 -102
- package/dist/index.min.js.map +1 -1
- package/package.json +3 -3
- package/cem.config.mjs +0 -16
- package/demo/index.html +0 -54
- package/dist/src/HeadingElement.d.ts +0 -82
- package/dist/src/HeadingElement.d.ts.map +0 -1
- package/dist/src/HeadingLevel.d.ts +0 -3
- package/dist/src/HeadingLevel.d.ts.map +0 -1
- package/dist/src/HeadingSize.d.ts +0 -3
- package/dist/src/HeadingSize.d.ts.map +0 -1
- package/dist/src/HeadingVariant.d.ts +0 -3
- package/dist/src/HeadingVariant.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -5
- package/dist/src/index.d.ts.map +0 -1
- package/eslint.config.mjs +0 -13
- package/rollup.config.js +0 -32
- package/src/HeadingElement.ts +0 -249
- package/src/HeadingLevel.ts +0 -2
- package/src/HeadingSize.ts +0 -2
- package/src/HeadingVariant.ts +0 -2
- package/src/index.ts +0 -4
- package/tsconfig.json +0 -9
package/src/HeadingElement.ts
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
|
|
2
|
-
import { customElement, property } from "lit/decorators.js";
|
|
3
|
-
|
|
4
|
-
import { DesignToken, Role } from "@m3e/core";
|
|
5
|
-
|
|
6
|
-
import { HeadingLevel } from "./HeadingLevel";
|
|
7
|
-
import { HeadingSize } from "./HeadingSize";
|
|
8
|
-
import { HeadingVariant } from "./HeadingVariant";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @summary
|
|
12
|
-
* A heading to a page or section.
|
|
13
|
-
*
|
|
14
|
-
* @description
|
|
15
|
-
* The `m3e-heading` component provides expressive, accessible headings for pages and sections, supporting display,
|
|
16
|
-
* headline, title, and label variants in multiple sizes. It applies Material 3 typographic tokens for font size,
|
|
17
|
-
* weight, line height, and letter spacing, ensuring visual hierarchy and clarity.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* The following example illustrates use of the `m3e-heading` to present each variant and size.
|
|
21
|
-
* ```html
|
|
22
|
-
* <m3e-heading variant="display" size="large">Display Large</m3e-heading>
|
|
23
|
-
* <m3e-heading variant="display" size="medium">Display Medium</m3e-heading>
|
|
24
|
-
* <m3e-heading variant="display" size="small">Display Small</m3e-heading>
|
|
25
|
-
* <m3e-heading variant="headline" size="large">Headline Large</m3e-heading>
|
|
26
|
-
* <m3e-heading variant="headline" size="medium">Headline Medium</m3e-heading>
|
|
27
|
-
* <m3e-heading variant="headline" size="small">Headline Small</m3e-heading>
|
|
28
|
-
* <m3e-heading variant="title" size="large">Title Large</m3e-heading>
|
|
29
|
-
* <m3e-heading variant="title" size="medium">Title Medium</m3e-heading>
|
|
30
|
-
* <m3e-heading variant="title" size="small">Title Small</m3e-heading>
|
|
31
|
-
* <m3e-heading variant="label" size="large">Label Large</m3e-heading>
|
|
32
|
-
* <m3e-heading variant="label" size="medium">Label Medium</m3e-heading>
|
|
33
|
-
* <m3e-heading variant="label" size="small">Label Small</m3e-heading>
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* The next example illustrates use of the `level` attribute to designate the accessibility level of a heading.
|
|
38
|
-
* When specified, ARIA `role="heading"` is applied and the `level` is propagated to `aria-level`.
|
|
39
|
-
* ```html
|
|
40
|
-
* <m3e-heading variant="headline" size="large" level="1">Page title</m3e-heading>
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @tag m3e-heading
|
|
44
|
-
*
|
|
45
|
-
* @slot - Renders the content of the heading.
|
|
46
|
-
*
|
|
47
|
-
* @attr emphasized - Whether the heading uses an emphasized typescale.
|
|
48
|
-
* @attr level - The accessibility level of the heading.
|
|
49
|
-
* @attr size - The size of the heading.
|
|
50
|
-
* @attr variant - The appearance variant of the heading.
|
|
51
|
-
*/
|
|
52
|
-
@customElement("m3e-heading")
|
|
53
|
-
export class M3eHeadingElement extends Role(LitElement, "none") {
|
|
54
|
-
/** The styles of the element. */
|
|
55
|
-
static override styles: CSSResultGroup = css`
|
|
56
|
-
:host {
|
|
57
|
-
display: block;
|
|
58
|
-
}
|
|
59
|
-
:host([variant="display"][size="large"]:not([emphasized])) {
|
|
60
|
-
font-size: ${DesignToken.typescale.standard.display.large.fontSize};
|
|
61
|
-
font-weight: ${DesignToken.typescale.standard.display.large.fontWeight};
|
|
62
|
-
line-height: ${DesignToken.typescale.standard.display.large.lineHeight};
|
|
63
|
-
letter-spacing: ${DesignToken.typescale.standard.display.large.tracking};
|
|
64
|
-
}
|
|
65
|
-
:host([variant="display"][size="medium"]:not([emphasized])) {
|
|
66
|
-
font-size: ${DesignToken.typescale.standard.display.medium.fontSize};
|
|
67
|
-
font-weight: ${DesignToken.typescale.standard.display.medium.fontWeight};
|
|
68
|
-
line-height: ${DesignToken.typescale.standard.display.medium.lineHeight};
|
|
69
|
-
letter-spacing: ${DesignToken.typescale.standard.display.medium.tracking};
|
|
70
|
-
}
|
|
71
|
-
:host([variant="display"][size="small"]:not([emphasized])) {
|
|
72
|
-
font-size: ${DesignToken.typescale.standard.display.small.fontSize};
|
|
73
|
-
font-weight: ${DesignToken.typescale.standard.display.small.fontWeight};
|
|
74
|
-
line-height: ${DesignToken.typescale.standard.display.small.lineHeight};
|
|
75
|
-
letter-spacing: ${DesignToken.typescale.standard.display.small.tracking};
|
|
76
|
-
}
|
|
77
|
-
:host([variant="headline"][size="large"]:not([emphasized])) {
|
|
78
|
-
font-size: ${DesignToken.typescale.standard.headline.large.fontSize};
|
|
79
|
-
font-weight: ${DesignToken.typescale.standard.headline.large.fontWeight};
|
|
80
|
-
line-height: ${DesignToken.typescale.standard.headline.large.lineHeight};
|
|
81
|
-
letter-spacing: ${DesignToken.typescale.standard.headline.large.tracking};
|
|
82
|
-
}
|
|
83
|
-
:host([variant="headline"][size="medium"]:not([emphasized])) {
|
|
84
|
-
font-size: ${DesignToken.typescale.standard.headline.medium.fontSize};
|
|
85
|
-
font-weight: ${DesignToken.typescale.standard.headline.medium.fontWeight};
|
|
86
|
-
line-height: ${DesignToken.typescale.standard.headline.medium.lineHeight};
|
|
87
|
-
letter-spacing: ${DesignToken.typescale.standard.headline.medium.tracking};
|
|
88
|
-
}
|
|
89
|
-
:host([variant="headline"][size="small"]:not([emphasized])) {
|
|
90
|
-
font-size: ${DesignToken.typescale.standard.headline.small.fontSize};
|
|
91
|
-
font-weight: ${DesignToken.typescale.standard.headline.small.fontWeight};
|
|
92
|
-
line-height: ${DesignToken.typescale.standard.headline.small.lineHeight};
|
|
93
|
-
letter-spacing: ${DesignToken.typescale.standard.headline.small.tracking};
|
|
94
|
-
}
|
|
95
|
-
:host([variant="title"][size="large"]:not([emphasized])) {
|
|
96
|
-
font-size: ${DesignToken.typescale.standard.title.large.fontSize};
|
|
97
|
-
font-weight: ${DesignToken.typescale.standard.title.large.fontWeight};
|
|
98
|
-
line-height: ${DesignToken.typescale.standard.title.large.lineHeight};
|
|
99
|
-
letter-spacing: ${DesignToken.typescale.standard.title.large.tracking};
|
|
100
|
-
}
|
|
101
|
-
:host([variant="title"][size="medium"]:not([emphasized])) {
|
|
102
|
-
font-size: ${DesignToken.typescale.standard.title.medium.fontSize};
|
|
103
|
-
font-weight: ${DesignToken.typescale.standard.title.medium.fontWeight};
|
|
104
|
-
line-height: ${DesignToken.typescale.standard.title.medium.lineHeight};
|
|
105
|
-
letter-spacing: ${DesignToken.typescale.standard.title.medium.tracking};
|
|
106
|
-
}
|
|
107
|
-
:host([variant="title"][size="small"]:not([emphasized])) {
|
|
108
|
-
font-size: ${DesignToken.typescale.standard.title.small.fontSize};
|
|
109
|
-
font-weight: ${DesignToken.typescale.standard.title.small.fontWeight};
|
|
110
|
-
line-height: ${DesignToken.typescale.standard.title.small.lineHeight};
|
|
111
|
-
letter-spacing: ${DesignToken.typescale.standard.title.small.tracking};
|
|
112
|
-
}
|
|
113
|
-
:host([variant="label"][size="large"]:not([emphasized])) {
|
|
114
|
-
font-size: ${DesignToken.typescale.standard.label.large.fontSize};
|
|
115
|
-
font-weight: ${DesignToken.typescale.standard.label.large.fontWeight};
|
|
116
|
-
line-height: ${DesignToken.typescale.standard.label.large.lineHeight};
|
|
117
|
-
letter-spacing: ${DesignToken.typescale.standard.label.large.tracking};
|
|
118
|
-
}
|
|
119
|
-
:host([variant="label"][size="medium"]:not([emphasized])) {
|
|
120
|
-
font-size: ${DesignToken.typescale.standard.label.medium.fontSize};
|
|
121
|
-
font-weight: ${DesignToken.typescale.standard.label.medium.fontWeight};
|
|
122
|
-
line-height: ${DesignToken.typescale.standard.label.medium.lineHeight};
|
|
123
|
-
letter-spacing: ${DesignToken.typescale.standard.label.medium.tracking};
|
|
124
|
-
}
|
|
125
|
-
:host([variant="label"][size="small"]:not([emphasized])) {
|
|
126
|
-
font-size: ${DesignToken.typescale.standard.label.small.fontSize};
|
|
127
|
-
font-weight: ${DesignToken.typescale.standard.label.small.fontWeight};
|
|
128
|
-
line-height: ${DesignToken.typescale.standard.label.small.lineHeight};
|
|
129
|
-
letter-spacing: ${DesignToken.typescale.standard.label.small.tracking};
|
|
130
|
-
}
|
|
131
|
-
:host([variant="display"][size="large"][emphasized]) {
|
|
132
|
-
font-size: ${DesignToken.typescale.emphasized.display.large.fontSize};
|
|
133
|
-
font-weight: ${DesignToken.typescale.emphasized.display.large.fontWeight};
|
|
134
|
-
line-height: ${DesignToken.typescale.emphasized.display.large.lineHeight};
|
|
135
|
-
letter-spacing: ${DesignToken.typescale.emphasized.display.large.tracking};
|
|
136
|
-
}
|
|
137
|
-
:host([variant="display"][size="medium"][emphasized]) {
|
|
138
|
-
font-size: ${DesignToken.typescale.emphasized.display.medium.fontSize};
|
|
139
|
-
font-weight: ${DesignToken.typescale.emphasized.display.medium.fontWeight};
|
|
140
|
-
line-height: ${DesignToken.typescale.emphasized.display.medium.lineHeight};
|
|
141
|
-
letter-spacing: ${DesignToken.typescale.emphasized.display.medium.tracking};
|
|
142
|
-
}
|
|
143
|
-
:host([variant="display"][size="small"][emphasized]) {
|
|
144
|
-
font-size: ${DesignToken.typescale.emphasized.display.small.fontSize};
|
|
145
|
-
font-weight: ${DesignToken.typescale.emphasized.display.small.fontWeight};
|
|
146
|
-
line-height: ${DesignToken.typescale.emphasized.display.small.lineHeight};
|
|
147
|
-
letter-spacing: ${DesignToken.typescale.emphasized.display.small.tracking};
|
|
148
|
-
}
|
|
149
|
-
:host([variant="headline"][size="large"][emphasized]) {
|
|
150
|
-
font-size: ${DesignToken.typescale.emphasized.headline.large.fontSize};
|
|
151
|
-
font-weight: ${DesignToken.typescale.emphasized.headline.large.fontWeight};
|
|
152
|
-
line-height: ${DesignToken.typescale.emphasized.headline.large.lineHeight};
|
|
153
|
-
letter-spacing: ${DesignToken.typescale.emphasized.headline.large.tracking};
|
|
154
|
-
}
|
|
155
|
-
:host([variant="headline"][size="medium"][emphasized]) {
|
|
156
|
-
font-size: ${DesignToken.typescale.emphasized.headline.medium.fontSize};
|
|
157
|
-
font-weight: ${DesignToken.typescale.emphasized.headline.medium.fontWeight};
|
|
158
|
-
line-height: ${DesignToken.typescale.emphasized.headline.medium.lineHeight};
|
|
159
|
-
letter-spacing: ${DesignToken.typescale.emphasized.headline.medium.tracking};
|
|
160
|
-
}
|
|
161
|
-
:host([variant="headline"][size="small"][emphasized]) {
|
|
162
|
-
font-size: ${DesignToken.typescale.emphasized.headline.small.fontSize};
|
|
163
|
-
font-weight: ${DesignToken.typescale.emphasized.headline.small.fontWeight};
|
|
164
|
-
line-height: ${DesignToken.typescale.emphasized.headline.small.lineHeight};
|
|
165
|
-
letter-spacing: ${DesignToken.typescale.emphasized.headline.small.tracking};
|
|
166
|
-
}
|
|
167
|
-
:host([variant="title"][size="large"][emphasized]) {
|
|
168
|
-
font-size: ${DesignToken.typescale.emphasized.title.large.fontSize};
|
|
169
|
-
font-weight: ${DesignToken.typescale.emphasized.title.large.fontWeight};
|
|
170
|
-
line-height: ${DesignToken.typescale.emphasized.title.large.lineHeight};
|
|
171
|
-
letter-spacing: ${DesignToken.typescale.emphasized.title.large.tracking};
|
|
172
|
-
}
|
|
173
|
-
:host([variant="title"][size="medium"][emphasized]) {
|
|
174
|
-
font-size: ${DesignToken.typescale.emphasized.title.medium.fontSize};
|
|
175
|
-
font-weight: ${DesignToken.typescale.emphasized.title.medium.fontWeight};
|
|
176
|
-
line-height: ${DesignToken.typescale.emphasized.title.medium.lineHeight};
|
|
177
|
-
letter-spacing: ${DesignToken.typescale.emphasized.title.medium.tracking};
|
|
178
|
-
}
|
|
179
|
-
:host([variant="title"][size="small"][emphasized]) {
|
|
180
|
-
font-size: ${DesignToken.typescale.emphasized.title.small.fontSize};
|
|
181
|
-
font-weight: ${DesignToken.typescale.emphasized.title.small.fontWeight};
|
|
182
|
-
line-height: ${DesignToken.typescale.emphasized.title.small.lineHeight};
|
|
183
|
-
letter-spacing: ${DesignToken.typescale.emphasized.title.small.tracking};
|
|
184
|
-
}
|
|
185
|
-
:host([variant="label"][size="large"][emphasized]) {
|
|
186
|
-
font-size: ${DesignToken.typescale.emphasized.label.large.fontSize};
|
|
187
|
-
font-weight: ${DesignToken.typescale.emphasized.label.large.fontWeight};
|
|
188
|
-
line-height: ${DesignToken.typescale.emphasized.label.large.lineHeight};
|
|
189
|
-
letter-spacing: ${DesignToken.typescale.emphasized.label.large.tracking};
|
|
190
|
-
}
|
|
191
|
-
:host([variant="label"][size="medium"][emphasized]) {
|
|
192
|
-
font-size: ${DesignToken.typescale.emphasized.label.medium.fontSize};
|
|
193
|
-
font-weight: ${DesignToken.typescale.emphasized.label.medium.fontWeight};
|
|
194
|
-
line-height: ${DesignToken.typescale.emphasized.label.medium.lineHeight};
|
|
195
|
-
letter-spacing: ${DesignToken.typescale.emphasized.label.medium.tracking};
|
|
196
|
-
}
|
|
197
|
-
:host([variant="label"][size="small"][emphasized]) {
|
|
198
|
-
font-size: ${DesignToken.typescale.emphasized.label.small.fontSize};
|
|
199
|
-
font-weight: ${DesignToken.typescale.emphasized.label.small.fontWeight};
|
|
200
|
-
line-height: ${DesignToken.typescale.emphasized.label.small.lineHeight};
|
|
201
|
-
letter-spacing: ${DesignToken.typescale.emphasized.label.small.tracking};
|
|
202
|
-
}
|
|
203
|
-
`;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Whether the heading uses an emphasized typescale.
|
|
207
|
-
* @default false
|
|
208
|
-
*/
|
|
209
|
-
@property({ type: Boolean, reflect: true }) emphasized = false;
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* The appearance variant of the heading.
|
|
213
|
-
* @default "display"
|
|
214
|
-
*/
|
|
215
|
-
@property({ reflect: true }) variant: HeadingVariant = "display";
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* The size of the heading.
|
|
219
|
-
* @default "medium"
|
|
220
|
-
*/
|
|
221
|
-
@property({ reflect: true }) size: HeadingSize = "medium";
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* The accessibility level of the heading.
|
|
225
|
-
* @default undefined
|
|
226
|
-
*/
|
|
227
|
-
@property({ type: Number }) level?: HeadingLevel;
|
|
228
|
-
|
|
229
|
-
/** @inheritdoc */
|
|
230
|
-
protected override update(changedProperties: PropertyValues<this>): void {
|
|
231
|
-
super.update(changedProperties);
|
|
232
|
-
|
|
233
|
-
if (changedProperties.has("level")) {
|
|
234
|
-
this.ariaLevel = this.level !== undefined ? `${this.level}` : null;
|
|
235
|
-
this.role = this.ariaLevel ? "heading" : "none";
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/** @inheritdoc */
|
|
240
|
-
protected override render(): unknown {
|
|
241
|
-
return html`<slot></slot>`;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
declare global {
|
|
246
|
-
interface HTMLElementTagNameMap {
|
|
247
|
-
"m3e-heading": M3eHeadingElement;
|
|
248
|
-
}
|
|
249
|
-
}
|
package/src/HeadingLevel.ts
DELETED
package/src/HeadingSize.ts
DELETED
package/src/HeadingVariant.ts
DELETED
package/src/index.ts
DELETED