@spectrum-web-components/theme 1.10.0 → 1.11.0-preview-b6b1becb.20251121200357
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 +96 -249
- package/package.json +4 -4
- package/custom-elements.json +0 -469
package/README.md
CHANGED
|
@@ -1,63 +1,16 @@
|
|
|
1
|
-
##
|
|
1
|
+
## Overview
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`<sp-theme>` provides Spectrum design tokens (CSS custom properties) to everything in its DOM scope. Components inside a theme use these tokens to render correctly. The element itself does not visually “apply” styles to your app; it exposes the tokens so your components (and any of your CSS) can consume them.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[](https://www.npmjs.com/package/@spectrum-web-components/theme)
|
|
8
|
-
[](https://bundlephobia.com/result?p=@spectrum-web-components/theme)
|
|
9
|
-
|
|
10
|
-
```
|
|
11
|
-
yarn add @spectrum-web-components/theme
|
|
12
|
-
```
|
|
5
|
+
Spectrum offers multiple variants:
|
|
13
6
|
|
|
14
|
-
|
|
7
|
+
- **System**: `spectrum`, `express`, `spectrum-two`
|
|
8
|
+
- **Color**: `light`, `dark` (legacy: `lightest`, `darkest` – deprecated)
|
|
9
|
+
- **Scale**: `medium`, `large`
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
import '@spectrum-web-components/theme/sp-theme.js';
|
|
18
|
-
import '@spectrum-web-components/theme/src/themes.js';
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The above import statements do two things: the first will get you started using the `<sp-theme>` wrapper element, and the second includes all four (4) color options (`lightest`, `light`, `dark`, and `darkest`) and both (2) scale options (`medium` and `large`) for the Spectrum Classic theme. Having all of these options available together is the easiest way to get a handle on the theming possibilities offered by the package and empowers you to prototype and test various deliveries of your application. However, reserving the download and parse time for all of the variants may not be required for all applications. See the "Advanced usage" section below for instructions on tuning the performance of an application that leverages this package.
|
|
22
|
-
|
|
23
|
-
Below are more ways to import the different scale and color options individually, in case you didn't want to import all of them as we did above. You'll use these statements in combination with the side effectful registration import statement `import '@spectrum-web-components/theme/sp-theme.js'`.
|
|
24
|
-
|
|
25
|
-
The various Classic themes can be imported en masse, as in the example above:
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
import '@spectrum-web-components/theme/src/themes.js';
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The various Spectrum Express themes can also be imported en masse:
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
import '@spectrum-web-components/theme/src/express/themes.js';
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Or you can import the themes and scales individually:
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
import '@spectrum-web-components/theme/theme-darkest.js';
|
|
41
|
-
import '@spectrum-web-components/theme/theme-dark.js';
|
|
42
|
-
import '@spectrum-web-components/theme/theme-light.js';
|
|
43
|
-
import '@spectrum-web-components/theme/theme-lightest.js';
|
|
44
|
-
import '@spectrum-web-components/theme/scale-medium.js';
|
|
45
|
-
import '@spectrum-web-components/theme/scale-large.js';
|
|
46
|
-
import '@spectrum-web-components/theme/express/theme-darkest.js';
|
|
47
|
-
import '@spectrum-web-components/theme/express/theme-dark.js';
|
|
48
|
-
import '@spectrum-web-components/theme/express/theme-light.js';
|
|
49
|
-
import '@spectrum-web-components/theme/express/theme-lightest.js';
|
|
50
|
-
import '@spectrum-web-components/theme/express/scale-medium.js';
|
|
51
|
-
import '@spectrum-web-components/theme/express/scale-large.js';
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
When looking to leverage the `Theme` base class as a type and/or for extension purposes, do so via:
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
import { Theme } from '@spectrum-web-components/theme';
|
|
58
|
-
```
|
|
11
|
+
By default, `<sp-theme>` uses the `spectrum` system, `light` color, and `medium` scale.
|
|
59
12
|
|
|
60
|
-
|
|
13
|
+
### How sp-theme works
|
|
61
14
|
|
|
62
15
|
Visually, all Spectrum Web Components are an expression of the design tokens specified by Spectrum, Adobe's design system. On the web, these tokens are made available as CSS Custom Properties. Using `sp-theme` as a parent element for your components ensures that those CSS Custom Properties can be leveraged by the elements within your application. This ensures consistent delivery of not only the color and scale you've specified in your particular instance, but for _all_ the other color, scale, and content direction specifications across Spectrum.
|
|
63
16
|
|
|
@@ -96,176 +49,95 @@ To make the above concepts a little more concrete, take a look at the table belo
|
|
|
96
49
|
observer.observe(varsViewer);
|
|
97
50
|
</script>
|
|
98
51
|
|
|
99
|
-
When you're ready to look into more advanced usage of the components and themes in your application, there are vanilla CSS implementations of these tokens available in the `@spectrum-web-components/styles` package.
|
|
52
|
+
When you're ready to look into more advanced usage of the components and themes in your application, there are vanilla CSS implementations of these tokens available in the [`@spectrum-web-components/styles`](https://opensource.adobe.com/spectrum-web-components/tools/styles/) package.
|
|
100
53
|
|
|
101
|
-
|
|
54
|
+
### Usage
|
|
102
55
|
|
|
103
|
-
|
|
56
|
+
[](https://www.npmjs.com/package/@spectrum-web-components/theme)
|
|
57
|
+
[](https://bundlephobia.com/result?p=@spectrum-web-components/theme)
|
|
104
58
|
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
system="spectrum"
|
|
108
|
-
color="light"
|
|
109
|
-
scale="medium"
|
|
110
|
-
style="background-color: var(--spectrum-gray-100)"
|
|
111
|
-
>
|
|
112
|
-
<sp-button onclick="spAlert(this, 'Themed <sp-button> clicked!')">
|
|
113
|
-
Click me!
|
|
114
|
-
</sp-button>
|
|
115
|
-
</sp-theme>
|
|
59
|
+
```bash
|
|
60
|
+
yarn add @spectrum-web-components/theme
|
|
116
61
|
```
|
|
117
62
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Once you've moved beyond the prototype phase of an application, it is likely that you will only use one combination of `color` and `scale` in your application, and even if not, you'll likely benefit from lazily loading the variants you don't leverage by default. For single combination applications, or to power a _default_ theme, the following imports can be used to ensure only the code your application requires is loaded:
|
|
121
|
-
|
|
122
|
-
### Classic
|
|
63
|
+
Register the element and load the theme fragments you intend to use:
|
|
123
64
|
|
|
124
65
|
```js
|
|
125
|
-
|
|
126
|
-
* Power a site using
|
|
127
|
-
*
|
|
128
|
-
* <sp-theme
|
|
129
|
-
* system="spectrum"
|
|
130
|
-
* color="darkest"
|
|
131
|
-
* scale="large"
|
|
132
|
-
* >
|
|
133
|
-
**/
|
|
134
|
-
import '@spectrum-web-components/theme/theme-darkest.js';
|
|
135
|
-
import '@spectrum-web-components/theme/scale-large.js';
|
|
136
|
-
|
|
66
|
+
// Registers the <sp-theme> custom element
|
|
137
67
|
import '@spectrum-web-components/theme/sp-theme.js';
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Express
|
|
141
|
-
|
|
142
|
-
```js
|
|
143
|
-
/**
|
|
144
|
-
* Power a site using
|
|
145
|
-
*
|
|
146
|
-
* <sp-theme
|
|
147
|
-
* system="express"
|
|
148
|
-
* color="light"
|
|
149
|
-
* scale="medium"
|
|
150
|
-
* >
|
|
151
|
-
**/
|
|
152
|
-
import '@spectrum-web-components/theme/express/theme-light.js';
|
|
153
|
-
import '@spectrum-web-components/theme/express/scale-medium.js';
|
|
154
68
|
|
|
155
|
-
|
|
69
|
+
// Load the specific variants you will use (recommended)
|
|
70
|
+
import '@spectrum-web-components/theme/theme-light.js';
|
|
71
|
+
import '@spectrum-web-components/theme/scale-medium.js';
|
|
72
|
+
// Optionally choose a different system
|
|
73
|
+
// import '@spectrum-web-components/theme/express/theme-light.js';
|
|
74
|
+
// import '@spectrum-web-components/theme/express/scale-medium.js';
|
|
156
75
|
```
|
|
157
76
|
|
|
158
|
-
|
|
77
|
+
If you’re prototyping and want everything available:
|
|
159
78
|
|
|
160
79
|
```js
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
import(`@spectrum-web-components/theme/theme-${color}.js`),
|
|
166
|
-
import(`@spectrum-web-components/theme/scale-${scale}.js`),
|
|
167
|
-
]).then(() => {
|
|
168
|
-
themeElement.color = color;
|
|
169
|
-
themeElement.scale = scale;
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
updateTheme('light', 'medium');
|
|
80
|
+
import '@spectrum-web-components/theme/sp-theme.js';
|
|
81
|
+
import '@spectrum-web-components/theme/src/themes.js'; // spectrum
|
|
82
|
+
import '@spectrum-web-components/theme/src/express/themes.js'; // express
|
|
83
|
+
import '@spectrum-web-components/theme/src/spectrum-two/themes.js'; // spectrum-two
|
|
174
84
|
```
|
|
175
85
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
## Light theme
|
|
179
|
-
|
|
180
|
-
```html demo
|
|
181
|
-
<style type="text/css">
|
|
182
|
-
#example {
|
|
183
|
-
max-width: 500px;
|
|
184
|
-
padding: 3em;
|
|
185
|
-
background-color: var(--spectrum-gray-100);
|
|
186
|
-
color: var(--spectrum-gray-800);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
#buttons {
|
|
190
|
-
margin-top: 2em;
|
|
191
|
-
}
|
|
192
|
-
</style>
|
|
193
|
-
<sp-theme system="express" color="light" scale="medium">
|
|
194
|
-
<hzn-app-stuff></hzn-app-stuff>
|
|
195
|
-
</sp-theme>
|
|
196
|
-
|
|
197
|
-
<express-app>
|
|
198
|
-
<hzn-app-stuff></hzn-app-stuff>
|
|
199
|
-
</express-app>
|
|
200
|
-
```
|
|
86
|
+
### Examples
|
|
201
87
|
|
|
202
|
-
|
|
88
|
+
#### Light color, medium scale
|
|
203
89
|
|
|
204
|
-
```html
|
|
90
|
+
```html
|
|
205
91
|
<style type="text/css">
|
|
206
|
-
#
|
|
92
|
+
#outer {
|
|
207
93
|
max-width: 500px;
|
|
208
|
-
padding:
|
|
94
|
+
padding: 1em;
|
|
209
95
|
background-color: var(--spectrum-gray-100);
|
|
210
96
|
color: var(--spectrum-gray-800);
|
|
211
97
|
}
|
|
212
|
-
|
|
213
|
-
#buttons {
|
|
214
|
-
margin-top: 2em;
|
|
215
|
-
}
|
|
216
98
|
</style>
|
|
217
|
-
<sp-theme system="
|
|
218
|
-
<
|
|
99
|
+
<sp-theme system="spectrum" color="light" scale="medium">
|
|
100
|
+
<div id="outer">
|
|
101
|
+
<sp-field-label for="email">Email</sp-field-label>
|
|
102
|
+
<sp-textfield
|
|
103
|
+
id="email"
|
|
104
|
+
type="email"
|
|
105
|
+
placeholder="you@example.com"
|
|
106
|
+
></sp-textfield>
|
|
107
|
+
<sp-help-text>We’ll only use this to send a receipt.</sp-help-text>
|
|
108
|
+
<sp-button-group style="margin-top: var(--spectrum-spacing-400)">
|
|
109
|
+
<sp-button variant="primary">Submit</sp-button>
|
|
110
|
+
<sp-button variant="secondary">Cancel</sp-button>
|
|
111
|
+
</sp-button-group>
|
|
112
|
+
</div>
|
|
219
113
|
</sp-theme>
|
|
220
|
-
|
|
221
|
-
<express-app>
|
|
222
|
-
<hzn-app-stuff></hzn-app-stuff>
|
|
223
|
-
</express-app>
|
|
224
114
|
```
|
|
225
115
|
|
|
226
|
-
|
|
116
|
+
#### Dark color, large scale
|
|
227
117
|
|
|
228
|
-
The large scale of `<sp-theme>` will switch to using Spectrum's larger mobile
|
|
118
|
+
The large scale of `<sp-theme>` will switch to using Spectrum's larger mobile Platform Scale.
|
|
229
119
|
|
|
230
|
-
```html
|
|
120
|
+
```html
|
|
231
121
|
<style type="text/css">
|
|
232
|
-
#
|
|
122
|
+
#outer {
|
|
233
123
|
max-width: 500px;
|
|
234
124
|
padding: 1em;
|
|
235
125
|
background-color: var(--spectrum-gray-100);
|
|
236
126
|
color: var(--spectrum-gray-800);
|
|
237
127
|
}
|
|
238
|
-
|
|
239
|
-
#buttons {
|
|
240
|
-
margin-top: 2em;
|
|
241
|
-
}
|
|
242
128
|
</style>
|
|
243
|
-
<sp-theme color="
|
|
244
|
-
<div id="
|
|
245
|
-
<
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
step="1"
|
|
249
|
-
min="1"
|
|
250
|
-
max="11"
|
|
251
|
-
label="Volume"
|
|
252
|
-
id="volume-slider"
|
|
253
|
-
></sp-slider>
|
|
254
|
-
</div>
|
|
255
|
-
<div><sp-switch>Overdrive</sp-switch></div>
|
|
256
|
-
<sp-button-group id="buttons">
|
|
257
|
-
<sp-button variant="primary">Cancel</sp-button>
|
|
258
|
-
<sp-button variant="accent">Continue</sp-button>
|
|
259
|
-
</sp-button-group>
|
|
129
|
+
<sp-theme system="spectrum" color="dark" scale="large">
|
|
130
|
+
<div id="outer">
|
|
131
|
+
<sp-field-label for="volume">Volume</sp-field-label>
|
|
132
|
+
<sp-slider id="volume" value="50"></sp-slider>
|
|
133
|
+
<sp-switch>Overdrive</sp-switch>
|
|
260
134
|
</div>
|
|
261
135
|
</sp-theme>
|
|
262
136
|
```
|
|
263
137
|
|
|
264
|
-
|
|
138
|
+
#### Embedded color systems and directional content
|
|
265
139
|
|
|
266
|
-
There are a few cases where it is necessary to embed one theme within another.
|
|
267
|
-
For example, if you have an application that is using a dark theme with a left to right text direction that is
|
|
268
|
-
previewing or editing content that will be displayed in a light theme with a right to left text direction.
|
|
140
|
+
There are a few cases where it is necessary to embed one theme within another. For example, if you have an application that is using a dark color system with a left to right text direction that is previewing or editing content that will be displayed in a light color system with a right to left text direction.
|
|
269
141
|
|
|
270
142
|
```html
|
|
271
143
|
<style type="text/css">
|
|
@@ -327,78 +199,53 @@ previewing or editing content that will be displayed in a light theme with a rig
|
|
|
327
199
|
</sp-theme>
|
|
328
200
|
```
|
|
329
201
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
The `<sp-theme>` element provides a language context for its descendents in the DOM. Descendents can resolve this context by dispatching an `sp-language-context` DOM event and supplying a `callback(lang: string) => void` method in the `detail` entry of the Custom Event. These callbacks will be reactively envoked when the `lang` attribute on the `<sp-theme>` element is updated. This way, you can control the resolved language in [`<sp-number-field>`](../components/number-field), [`<sp-slider>`](./components/slider), and other elements in one centralized place.
|
|
333
|
-
|
|
334
|
-
## System Context (private Beta API - subject to changes)
|
|
335
|
-
|
|
336
|
-
The <sp-theme> element provides a "system" context to its descendants in the DOM. This context indicates the Spectrum design system variant currently in use (e.g., 'spectrum', 'express', or 'spectrum-two').
|
|
337
|
-
|
|
338
|
-
#### Consuming the System Context in Components
|
|
339
|
-
|
|
340
|
-
Components can consume the system context by using the `SystemResolutionController`. This controller encapsulates the logic for resolving the system context, allowing it to be integrated into any component in few steps.
|
|
341
|
-
|
|
342
|
-
#### Steps to Consume the System Context:
|
|
343
|
-
|
|
344
|
-
1. Import the `SystemResolutionController` and the necessary types:
|
|
345
|
-
|
|
346
|
-
```ts
|
|
347
|
-
import {
|
|
348
|
-
SystemResolutionController,
|
|
349
|
-
systemResolverUpdatedSymbol,
|
|
350
|
-
} from './SystemResolutionController.js';
|
|
351
|
-
import type { SystemVariant } from '@spectrum-web-components/theme';
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
2. Instantiate the `SystemResolutionController`:
|
|
202
|
+
### Advanced usage
|
|
355
203
|
|
|
356
|
-
|
|
204
|
+
#### Lazy loading themes
|
|
357
205
|
|
|
358
|
-
|
|
359
|
-
export class MyComponent extends LitElement {
|
|
360
|
-
private systemResolver = new SystemResolutionController(this);
|
|
206
|
+
Load only what you need by importing the specific fragments, then lazy-load others as your user changes theme settings.
|
|
361
207
|
|
|
362
|
-
|
|
208
|
+
```js
|
|
209
|
+
const themeEl = document.querySelector('sp-theme');
|
|
210
|
+
|
|
211
|
+
async function updateTheme(system, color, scale) {
|
|
212
|
+
const systemBase = system === 'spectrum' ? '' : `${system}/`;
|
|
213
|
+
await Promise.all([
|
|
214
|
+
import(`@spectrum-web-components/theme/${systemBase}theme-${color}.js`),
|
|
215
|
+
import(`@spectrum-web-components/theme/${systemBase}scale-${scale}.js`),
|
|
216
|
+
]);
|
|
217
|
+
themeEl.system = system;
|
|
218
|
+
themeEl.color = color;
|
|
219
|
+
themeEl.scale = scale;
|
|
363
220
|
}
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
3. Respond to system context changes:
|
|
367
|
-
|
|
368
|
-
Override the `update` lifecycle method to detect changes in the system context using the `systemResolverUpdatedSymbol`.
|
|
369
221
|
|
|
370
|
-
|
|
371
|
-
protected update(changes: Map<PropertyKey, unknown>): void {
|
|
372
|
-
super.update(changes);
|
|
373
|
-
if (changes.has(systemResolverUpdatedSymbol)) {
|
|
374
|
-
this.handleSystemChange();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
222
|
+
updateTheme('spectrum', 'light', 'medium');
|
|
377
223
|
```
|
|
378
224
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
Create a method that will be called whenever the system context changes. Use `this.systemResolver.system` to access the current system variant.
|
|
382
|
-
|
|
383
|
-
```ts
|
|
384
|
-
private handleSystemChange(): void {
|
|
385
|
-
const currentSystem: SystemVariant = this.systemResolver.system;
|
|
386
|
-
// Implement logic based on the current system variant.
|
|
387
|
-
// For example, update styles, states or re-render parts of the component.
|
|
388
|
-
}
|
|
389
|
-
```
|
|
225
|
+
When bundling your application, be sure to consult the documentation of your bundler for the correct way to ensure proper packaging of the programatic dependency graph that this will create.
|
|
390
226
|
|
|
391
|
-
|
|
227
|
+
#### Language context
|
|
392
228
|
|
|
393
|
-
|
|
229
|
+
Descendants can request the current language by dispatching `sp-language-context` with a callback. The callback is re-invoked when the theme’s `lang` changes. This way, you can control the resolved language in `<sp-number-field>`, `<sp-slider>`, and other elements in one centralized place.
|
|
394
230
|
|
|
395
231
|
```ts
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
232
|
+
// in a descendant component
|
|
233
|
+
this.dispatchEvent(
|
|
234
|
+
new CustomEvent('sp-language-context', {
|
|
235
|
+
bubbles: true,
|
|
236
|
+
composed: true,
|
|
237
|
+
detail: {
|
|
238
|
+
callback: (lang, unsubscribe) => {
|
|
239
|
+
this.lang = lang; // use the language value
|
|
240
|
+
// call unsubscribe() when you no longer need updates
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
})
|
|
244
|
+
);
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Accessibility
|
|
248
|
+
|
|
249
|
+
- **Color and contrast**: Ensure sufficient contrast for any backgrounds you apply when consuming tokens (WCAG 2.1 AA). Components themselves meet Spectrum guidance when themed correctly.
|
|
250
|
+
- **Language**: Set `lang` on `<sp-theme>` to inform number/date formatting and other locale-aware components.
|
|
251
|
+
- **Directionality**: Use `dir` to deliver correct LTR/RTL behavior; embedded themes allow mixing contexts.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/theme",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0-preview-b6b1becb.20251121200357",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -289,9 +289,9 @@
|
|
|
289
289
|
"css"
|
|
290
290
|
],
|
|
291
291
|
"dependencies": {
|
|
292
|
-
"@spectrum-web-components/base": "1.
|
|
293
|
-
"@spectrum-web-components/core": "0.0.
|
|
294
|
-
"@spectrum-web-components/styles": "1.
|
|
292
|
+
"@spectrum-web-components/base": "1.11.0-preview-b6b1becb.20251121200357",
|
|
293
|
+
"@spectrum-web-components/core": "0.0.2-preview-b6b1becb.20251121200357",
|
|
294
|
+
"@spectrum-web-components/styles": "1.11.0-preview-b6b1becb.20251121200357"
|
|
295
295
|
},
|
|
296
296
|
"types": "./src/index.d.ts",
|
|
297
297
|
"customElements": "custom-elements.json",
|
package/custom-elements.json
DELETED
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": "1.0.0",
|
|
3
|
-
"readme": "",
|
|
4
|
-
"modules": [
|
|
5
|
-
{
|
|
6
|
-
"kind": "javascript-module",
|
|
7
|
-
"path": "sp-theme.js",
|
|
8
|
-
"declarations": [],
|
|
9
|
-
"exports": [
|
|
10
|
-
{
|
|
11
|
-
"kind": "custom-element-definition",
|
|
12
|
-
"name": "sp-theme",
|
|
13
|
-
"declaration": {
|
|
14
|
-
"name": "Theme",
|
|
15
|
-
"module": "/src/Theme.js"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"kind": "javascript-module",
|
|
22
|
-
"path": "src/Theme.js",
|
|
23
|
-
"declarations": [
|
|
24
|
-
{
|
|
25
|
-
"kind": "class",
|
|
26
|
-
"description": "",
|
|
27
|
-
"name": "Theme",
|
|
28
|
-
"slots": [
|
|
29
|
-
{
|
|
30
|
-
"description": "Content on which to apply the CSS Custom Properties defined by the current theme configuration",
|
|
31
|
-
"name": ""
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"members": [
|
|
35
|
-
{
|
|
36
|
-
"kind": "field",
|
|
37
|
-
"name": "themeFragmentsByKind",
|
|
38
|
-
"type": {
|
|
39
|
-
"text": "ThemeFragmentMap"
|
|
40
|
-
},
|
|
41
|
-
"privacy": "private",
|
|
42
|
-
"static": true,
|
|
43
|
-
"default": "new Map()"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"kind": "field",
|
|
47
|
-
"name": "defaultFragments",
|
|
48
|
-
"type": {
|
|
49
|
-
"text": "Set<FragmentName>"
|
|
50
|
-
},
|
|
51
|
-
"privacy": "private",
|
|
52
|
-
"static": true,
|
|
53
|
-
"default": "new Set(['spectrum'])"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"kind": "field",
|
|
57
|
-
"name": "templateElement",
|
|
58
|
-
"type": {
|
|
59
|
-
"text": "HTMLTemplateElement | undefined"
|
|
60
|
-
},
|
|
61
|
-
"privacy": "private",
|
|
62
|
-
"static": true
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"kind": "field",
|
|
66
|
-
"name": "instances",
|
|
67
|
-
"type": {
|
|
68
|
-
"text": "Set<Theme>"
|
|
69
|
-
},
|
|
70
|
-
"privacy": "private",
|
|
71
|
-
"static": true,
|
|
72
|
-
"default": "new Set()"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"kind": "field",
|
|
76
|
-
"name": "VERSION",
|
|
77
|
-
"static": true,
|
|
78
|
-
"default": "version"
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
"kind": "field",
|
|
82
|
-
"name": "_dir",
|
|
83
|
-
"type": {
|
|
84
|
-
"text": "'ltr' | 'rtl' | ''"
|
|
85
|
-
},
|
|
86
|
-
"default": "''"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"kind": "field",
|
|
90
|
-
"name": "dir",
|
|
91
|
-
"type": {
|
|
92
|
-
"text": "\"ltr\" | \"rtl\" | \"\""
|
|
93
|
-
},
|
|
94
|
-
"description": "Reading direction of the content scoped to this `sp-theme` element.",
|
|
95
|
-
"attribute": "dir"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"kind": "field",
|
|
99
|
-
"name": "shadowRoot",
|
|
100
|
-
"type": {
|
|
101
|
-
"text": "ShadowRootWithAdoptedStyleSheets"
|
|
102
|
-
},
|
|
103
|
-
"privacy": "public"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
"kind": "field",
|
|
107
|
-
"name": "_system",
|
|
108
|
-
"type": {
|
|
109
|
-
"text": "SystemVariant | ''"
|
|
110
|
-
},
|
|
111
|
-
"privacy": "private",
|
|
112
|
-
"default": "'spectrum'"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
"kind": "field",
|
|
116
|
-
"name": "system",
|
|
117
|
-
"type": {
|
|
118
|
-
"text": "\"spectrum\" | \"express\""
|
|
119
|
-
},
|
|
120
|
-
"description": "The Spectrum system that is applied to the content scoped to this `sp-theme` element.\n\nA value is required.",
|
|
121
|
-
"attribute": "system"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
"kind": "field",
|
|
125
|
-
"name": "_color",
|
|
126
|
-
"type": {
|
|
127
|
-
"text": "Color | ''"
|
|
128
|
-
},
|
|
129
|
-
"privacy": "private",
|
|
130
|
-
"default": "''"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
"kind": "field",
|
|
134
|
-
"name": "color",
|
|
135
|
-
"type": {
|
|
136
|
-
"text": "\"lightest\" | \"light\" | \"dark\" | \"darkest\" | \"\""
|
|
137
|
-
},
|
|
138
|
-
"description": "The Spectrum color stops to apply to content scoped by this `sp-theme` element.\n\nA value is required.",
|
|
139
|
-
"attribute": "color"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"kind": "field",
|
|
143
|
-
"name": "_scale",
|
|
144
|
-
"type": {
|
|
145
|
-
"text": "Scale | ''"
|
|
146
|
-
},
|
|
147
|
-
"privacy": "private",
|
|
148
|
-
"default": "''"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"kind": "field",
|
|
152
|
-
"name": "scale",
|
|
153
|
-
"type": {
|
|
154
|
-
"text": "\"medium\" | \"large\" | \"\""
|
|
155
|
-
},
|
|
156
|
-
"description": "The Spectrum platform scale to apply to content scoped by this `sp-theme` element.\n\nA value is required.",
|
|
157
|
-
"attribute": "scale"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"kind": "field",
|
|
161
|
-
"name": "template",
|
|
162
|
-
"type": {
|
|
163
|
-
"text": "HTMLTemplateElement"
|
|
164
|
-
},
|
|
165
|
-
"privacy": "private",
|
|
166
|
-
"static": true,
|
|
167
|
-
"readonly": true
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"kind": "field",
|
|
171
|
-
"name": "_systemContextConsumers",
|
|
172
|
-
"privacy": "private",
|
|
173
|
-
"default": "new Map< HTMLElement, [SystemContextCallback, () => void] >()"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"kind": "method",
|
|
177
|
-
"name": "_handleSystemContext",
|
|
178
|
-
"privacy": "private",
|
|
179
|
-
"return": {
|
|
180
|
-
"type": {
|
|
181
|
-
"text": "void"
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
"parameters": [
|
|
185
|
-
{
|
|
186
|
-
"name": "event",
|
|
187
|
-
"type": {
|
|
188
|
-
"text": "CustomEvent<{ callback: SystemContextCallback }>"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
]
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
"kind": "field",
|
|
195
|
-
"name": "updateComplete",
|
|
196
|
-
"type": {
|
|
197
|
-
"text": "Promise<boolean>"
|
|
198
|
-
},
|
|
199
|
-
"privacy": "public"
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
"kind": "field",
|
|
203
|
-
"name": "__resolve",
|
|
204
|
-
"type": {
|
|
205
|
-
"text": "(completed: boolean) => void"
|
|
206
|
-
},
|
|
207
|
-
"privacy": "private"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
"kind": "method",
|
|
211
|
-
"name": "__createDeferredPromise",
|
|
212
|
-
"privacy": "private",
|
|
213
|
-
"return": {
|
|
214
|
-
"type": {
|
|
215
|
-
"text": "Promise<boolean>"
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"kind": "method",
|
|
221
|
-
"name": "startManagingContentDirection",
|
|
222
|
-
"privacy": "public",
|
|
223
|
-
"return": {
|
|
224
|
-
"type": {
|
|
225
|
-
"text": "void"
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
"parameters": [
|
|
229
|
-
{
|
|
230
|
-
"name": "el",
|
|
231
|
-
"type": {
|
|
232
|
-
"text": "HTMLElement"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
]
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
"kind": "method",
|
|
239
|
-
"name": "stopManagingContentDirection",
|
|
240
|
-
"privacy": "public",
|
|
241
|
-
"return": {
|
|
242
|
-
"type": {
|
|
243
|
-
"text": "void"
|
|
244
|
-
}
|
|
245
|
-
},
|
|
246
|
-
"parameters": [
|
|
247
|
-
{
|
|
248
|
-
"name": "el",
|
|
249
|
-
"type": {
|
|
250
|
-
"text": "HTMLElement"
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
]
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
"kind": "field",
|
|
257
|
-
"name": "trackedChildren",
|
|
258
|
-
"type": {
|
|
259
|
-
"text": "Set<HTMLElement>"
|
|
260
|
-
},
|
|
261
|
-
"privacy": "private",
|
|
262
|
-
"default": "new Set()"
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
"kind": "field",
|
|
266
|
-
"name": "_updateRequested",
|
|
267
|
-
"type": {
|
|
268
|
-
"text": "boolean"
|
|
269
|
-
},
|
|
270
|
-
"privacy": "private",
|
|
271
|
-
"default": "false"
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
"kind": "method",
|
|
275
|
-
"name": "shouldAdoptStyles",
|
|
276
|
-
"privacy": "private",
|
|
277
|
-
"return": {
|
|
278
|
-
"type": {
|
|
279
|
-
"text": "Promise<void>"
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
"kind": "method",
|
|
285
|
-
"name": "adoptStyles",
|
|
286
|
-
"privacy": "protected",
|
|
287
|
-
"return": {
|
|
288
|
-
"type": {
|
|
289
|
-
"text": "void"
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"kind": "method",
|
|
295
|
-
"name": "registerThemeFragment",
|
|
296
|
-
"static": true,
|
|
297
|
-
"return": {
|
|
298
|
-
"type": {
|
|
299
|
-
"text": "void"
|
|
300
|
-
}
|
|
301
|
-
},
|
|
302
|
-
"parameters": [
|
|
303
|
-
{
|
|
304
|
-
"name": "name",
|
|
305
|
-
"type": {
|
|
306
|
-
"text": "FragmentName"
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
"name": "kind",
|
|
311
|
-
"type": {
|
|
312
|
-
"text": "FragmentType"
|
|
313
|
-
}
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"name": "styles",
|
|
317
|
-
"type": {
|
|
318
|
-
"text": "CSSResultGroup"
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
]
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
"kind": "field",
|
|
325
|
-
"name": "_contextConsumers",
|
|
326
|
-
"privacy": "private",
|
|
327
|
-
"default": "new Map< HTMLElement, [ProvideLang['callback'], () => void] >()"
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
"kind": "method",
|
|
331
|
-
"name": "_provideContext",
|
|
332
|
-
"privacy": "private",
|
|
333
|
-
"return": {
|
|
334
|
-
"type": {
|
|
335
|
-
"text": "void"
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
"kind": "method",
|
|
341
|
-
"name": "_provideSystemContext",
|
|
342
|
-
"privacy": "private",
|
|
343
|
-
"return": {
|
|
344
|
-
"type": {
|
|
345
|
-
"text": "void"
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
"kind": "method",
|
|
351
|
-
"name": "_handleContextPresence",
|
|
352
|
-
"privacy": "private",
|
|
353
|
-
"return": {
|
|
354
|
-
"type": {
|
|
355
|
-
"text": "void"
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
"parameters": [
|
|
359
|
-
{
|
|
360
|
-
"name": "event",
|
|
361
|
-
"type": {
|
|
362
|
-
"text": "CustomEvent<ProvideLang>"
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
]
|
|
366
|
-
}
|
|
367
|
-
],
|
|
368
|
-
"attributes": [
|
|
369
|
-
{
|
|
370
|
-
"name": "color",
|
|
371
|
-
"type": {
|
|
372
|
-
"text": "\"lightest\" | \"light\" | \"dark\" | \"darkest\" | \"\""
|
|
373
|
-
},
|
|
374
|
-
"description": "The Spectrum color stops to apply to content scoped by this `sp-theme` element.\n\nA value is required.",
|
|
375
|
-
"fieldName": "color"
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
"name": "scale",
|
|
379
|
-
"type": {
|
|
380
|
-
"text": "\"medium\" | \"large\" | \"\""
|
|
381
|
-
},
|
|
382
|
-
"description": "The Spectrum platform scale to apply to content scoped by this `sp-theme` element.\n\nA value is required.",
|
|
383
|
-
"fieldName": "scale"
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
"name": "lang",
|
|
387
|
-
"type": {
|
|
388
|
-
"text": "string"
|
|
389
|
-
},
|
|
390
|
-
"description": "The language of the content scoped to this `sp-theme` element, see: <a href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang\" target=\"_blank\">MDN reference</a>.",
|
|
391
|
-
"default": "\"\""
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"name": "dir",
|
|
395
|
-
"type": {
|
|
396
|
-
"text": "\"ltr\" | \"rtl\" | \"\""
|
|
397
|
-
},
|
|
398
|
-
"description": "Reading direction of the content scoped to this `sp-theme` element.",
|
|
399
|
-
"fieldName": "dir"
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
"name": "system",
|
|
403
|
-
"type": {
|
|
404
|
-
"text": "\"spectrum\" | \"express\""
|
|
405
|
-
},
|
|
406
|
-
"description": "The Spectrum system that is applied to the content scoped to this `sp-theme` element.\n\nA value is required.",
|
|
407
|
-
"fieldName": "system"
|
|
408
|
-
}
|
|
409
|
-
],
|
|
410
|
-
"superclass": {
|
|
411
|
-
"name": "HTMLElement"
|
|
412
|
-
},
|
|
413
|
-
"tagName": "sp-theme",
|
|
414
|
-
"customElement": true
|
|
415
|
-
}
|
|
416
|
-
],
|
|
417
|
-
"exports": [
|
|
418
|
-
{
|
|
419
|
-
"kind": "js",
|
|
420
|
-
"name": "ProvideLang",
|
|
421
|
-
"declaration": {
|
|
422
|
-
"name": "ProvideLang",
|
|
423
|
-
"module": "src/Theme.js"
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
"kind": "js",
|
|
428
|
-
"name": "ThemeFragmentMap",
|
|
429
|
-
"declaration": {
|
|
430
|
-
"name": "ThemeFragmentMap",
|
|
431
|
-
"module": "src/Theme.js"
|
|
432
|
-
}
|
|
433
|
-
},
|
|
434
|
-
{
|
|
435
|
-
"kind": "js",
|
|
436
|
-
"name": "Color",
|
|
437
|
-
"declaration": {
|
|
438
|
-
"name": "Color",
|
|
439
|
-
"module": "src/Theme.js"
|
|
440
|
-
}
|
|
441
|
-
},
|
|
442
|
-
{
|
|
443
|
-
"kind": "js",
|
|
444
|
-
"name": "Scale",
|
|
445
|
-
"declaration": {
|
|
446
|
-
"name": "Scale",
|
|
447
|
-
"module": "src/Theme.js"
|
|
448
|
-
}
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
"kind": "js",
|
|
452
|
-
"name": "SystemVariant",
|
|
453
|
-
"declaration": {
|
|
454
|
-
"name": "SystemVariant",
|
|
455
|
-
"module": "src/Theme.js"
|
|
456
|
-
}
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
"kind": "js",
|
|
460
|
-
"name": "Theme",
|
|
461
|
-
"declaration": {
|
|
462
|
-
"name": "Theme",
|
|
463
|
-
"module": "src/Theme.js"
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
]
|
|
467
|
-
}
|
|
468
|
-
]
|
|
469
|
-
}
|