0.42.2 • Published 15 days ago

@spectrum-web-components/base v0.42.2

Weekly downloads
741
License
Apache-2.0
Repository
github
Last release
15 days ago

Description

The SpectrumElement base class as created by mixing SpectrumMixin onto LitElement adopts dir values from the document at connection time with a fallback to lrt. In a TypeScript context, it also enforces the presence of this.shadowRoot on extending components.

Usage

See it on NPM! How big is this package in your project?

yarn add @spectrum-web-components/base

When looking to leverage the SpectrumElement base class as a type and/or for extension purposes, do so via:

import { SpectrumElement } from '@spectrum-web-components/base';

export MyElement extends SpectrumElement {}

Similarly the SpectrumMixin class factory mixin is available via:

import { SpectrumMixin } from '@spectrum-web-components/base';

export MyElement extends SpectrumMixin(HTMLElement) {}

Features

dir management

With powerful CSS selectors like :host(:dir(rtl)) and :host-content([dir=rtl]) not yet enjoying cross-browser support, reliably delivering content in both "left to right" and "right to left" while relying on Shadow DOM means certain trade offs need to be made. While every custom element build from SpectrumMixin could have its dir attribute applied to manage this, doing so is not only a pain for apply, it's a pain to maintain over time. To support the flexibility to devlier content in both of these directions, elements built from SpectrumMixin will observe the dir attribute of either the document or a containing sp-theme. This will allow your sites and applications to manage content direction in a single place while also opening the possibility of having multiple content directions on the same page by scoping those content sections with sp-theme elements.

Placing a dir attribute on an element built from SpectrumMixin before attaching it to the DOM will prevent it from resolving the text direction value to a parent sp-theme or document element. Elements applied to the page in this way will also NOT participate in observing any such elements, so their dir values will remain as initialized regardless of changes in other parts of your documents. If you choose to leverage this, be aware that any child (in both light DOM and shadow DOM) of this element will need to have a dir attribute applied as well if you do not want it resolving to a parent sp-theme or document element itself. In this way, it is likely that you would benefit from leveraging an sp-theme element to create scope in your document for managing this custom content direction section of your page.

isLTR

While CSS offers many powerful solutions for styling content in various directions, sometimes JS functionality depends on the specific of that direction. Elements built from SpectrumMixin have the this.isLTR getter that will resolve to true when dir === 'ltr'.

public shadowRoot!: ShadowRoot;

Elements built from SpectrumMixin assume that you will be using shadow DOM in the resulting custom element. To simplify TypeScript usage the presence of this.shadowRoot is asserted as non-null so that you have direct access to it without extended type checking.

@infinitebrahmanuniverse/nolb-_spe@everything-registry/sub-chunk-857@spectrum-web-components/accordion@spectrum-web-components/action-bar@spectrum-web-components/action-button@spectrum-web-components/button-group@spectrum-web-components/card@spectrum-web-components/checkbox@spectrum-web-components/circle-loader@spectrum-web-components/clear-button@spectrum-web-components/close-button@spectrum-web-components/coachmark@spectrum-web-components/badge@spectrum-web-components/banner@spectrum-web-components/bar-loader@spectrum-web-components/bundle@spectrum-web-components/button@spectrum-web-components/action-group@spectrum-web-components/action-menu@spectrum-web-components/actionbar@spectrum-web-components/alert-dialog@spectrum-web-components/asset@spectrum-web-components/avatar@spectrum-web-components/progress-circle@spectrum-web-components/quick-actions@spectrum-web-components/radio@spectrum-web-components/rule@spectrum-web-components/search@spectrum-web-components/color-area@spectrum-web-components/color-field@spectrum-web-components/color-handle@spectrum-web-components/color-loupe@spectrum-web-components/color-slider@spectrum-web-components/color-wheel@spectrum-web-components/combobox@spectrum-web-components/icons-workflow@spectrum-web-components/iconset@spectrum-web-components/illustrated-message@spectrum-web-components/infield-button@spectrum-web-components/link@spectrum-web-components/menu@spectrum-web-components/picker@spectrum-web-components/picker-button@spectrum-web-components/popover@spectrum-web-components/progress-bar@spectrum-web-components/grid@spectrum-web-components/help-text@spectrum-web-components/icon@spectrum-web-components/icons@spectrum-web-components/icons-ui@spectrum-web-components/dialog@spectrum-web-components/divider@spectrum-web-components/dropdown@spectrum-web-components/dropzone@spectrum-web-components/field-group@spectrum-web-components/field-label@spectrum-web-components/meter@spectrum-web-components/modal@spectrum-web-components/number-field@spectrum-web-components/opacity-checkerboard@spectrum-web-components/overlay@spectrum-web-components/split-view@spectrum-web-components/status-light@spectrum-web-components/story-decorator@spectrum-web-components/styles@spectrum-web-components/swatch@spectrum-web-components/switch@spectrum-web-components/shared@spectrum-web-components/sidenav@spectrum-web-components/slider@spectrum-web-components/split-button@spectrum-web-components/table@spectrum-web-components/tabs@spectrum-web-components/tags@spectrum-web-components/textfield@spectrum-web-components/theme@spectrum-web-components/thumbnail@spectrum-web-components/toast@spectrum-web-components/tooltip@spectrum-web-components/top-nav@spectrum-web-components/tray@spectrum-web-components/tree-view@spectrum-web-components/truncated@spectrum-web-components/underlay@spectrum-web-components/vrt-compare
0.42.2

15 days ago

0.42.1

16 days ago

0.42.0

29 days ago

0.41.2

1 month ago

0.41.1

2 months ago

0.41.0

2 months ago

0.40.5

2 months ago

0.40.4

3 months ago

0.40.3

3 months ago

0.40.2

4 months ago

0.40.1

4 months ago

0.36.0

8 months ago

0.40.0

5 months ago

0.35.1-rc.15

9 months ago

0.37.0

8 months ago

0.34.1-rc.0

9 months ago

0.35.1-rc.25

9 months ago

0.35.1-rc.26

9 months ago

0.35.1-rc.24

9 months ago

0.35.1-rc.29

8 months ago

0.38.0

8 months ago

0.35.1-rc.34

8 months ago

0.34.0

9 months ago

0.35.1-rc.43

8 months ago

0.35.1-rc.41

8 months ago

0.39.1

6 months ago

0.39.0

7 months ago

0.35.0

9 months ago

0.39.4

6 months ago

0.39.3

6 months ago

0.39.2

6 months ago

0.33.3-overlay.66

10 months ago

0.33.3-overlay.65

10 months ago

0.33.3-overlay.60

10 months ago

0.33.3-overlay.61

10 months ago

0.31.1-react.21

11 months ago

0.32.0

11 months ago

0.31.1-react.3

11 months ago

0.31.1-react.1

11 months ago

0.31.1-react.2

11 months ago

0.30.1-overlay.30

12 months ago

0.33.1-overlay.39

10 months ago

0.30.1-overlay.31

11 months ago

0.33.2

10 months ago

0.33.0

10 months ago

0.30.1-overlay.38

11 months ago

0.30.1-overlay.37

11 months ago

0.30.1-overlay.41

11 months ago

0.30.1-overlay.42

11 months ago

0.30.1-overlay.40

11 months ago

0.30.0

12 months ago

0.33.1-overlay.41

10 months ago

0.32.1-overlay.33

11 months ago

0.32.1-overlay.41

11 months ago

0.31.0

11 months ago

0.31.1-overlay.29

11 months ago

0.7.6-overlay.54

12 months ago

0.7.6-overlay.56

12 months ago

0.7.6-overlay.55

12 months ago

0.7.6-overlay.58

12 months ago

0.7.6-overlay.57

12 months ago

0.7.6-overlay.59

12 months ago

0.7.6-overlay.61

12 months ago

0.7.6-overlay.62

12 months ago

0.7.5

1 year ago

0.7.5-react.75

1 year ago

0.7.5-react.50

1 year ago

0.7.5-react.48

1 year ago

0.7.5-react.49

1 year ago

0.7.4

1 year ago

0.7.3

1 year ago

0.7.5-react.32

1 year ago

0.7.3-react.54

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.0-devmode.0

2 years ago

0.5.9-devmode.24

2 years ago

0.5.9-devmode.31

2 years ago

0.6.1-devmode2.0

2 years ago

0.6.1-devmode.0

2 years ago

0.7.0

2 years ago

0.5.8

2 years ago

0.6.0

2 years ago

0.5.6

2 years ago

0.5.7

2 years ago

0.5.5

2 years ago

0.5.4

2 years ago

0.5.3

2 years ago

0.5.2-express.41

2 years ago

0.5.2

2 years ago

0.5.0

2 years ago

0.5.1

2 years ago

0.4.6

2 years ago

0.4.6-alpha.69

3 years ago

0.4.6-alpha.40

3 years ago

0.4.6-alpha.1

3 years ago

0.4.5

3 years ago

0.4.5-alpha.59

3 years ago

0.4.5-alpha.1

3 years ago

0.4.4

3 years ago

0.4.4-alpha.148

3 years ago

0.4.4-alpha.147

3 years ago

0.4.4-alpha.146

3 years ago

0.4.4-alpha.135

3 years ago

0.4.4-alpha.101

3 years ago

0.4.4-alpha.74

3 years ago

0.4.3-alpha.52

3 years ago

0.4.3

3 years ago

0.4.3-alpha.49

3 years ago

0.4.3-alpha.47

3 years ago

0.4.3-beta.38

3 years ago

0.4.3-beta.37

3 years ago

0.4.3-beta.39

3 years ago

0.4.3-alpha.37

3 years ago

0.4.3-beta.36

3 years ago

0.4.3-alpha.38

3 years ago

0.4.3-beta.41

3 years ago

0.4.3-alpha.43

3 years ago

0.4.3-beta.40

3 years ago

0.4.3-beta.43

3 years ago

0.4.3-beta.42

3 years ago

0.4.3-alpha.35

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.3-alpha.33

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.0-alpha.40

3 years ago

0.2.0

3 years ago

0.1.4-alpha.178

3 years ago

0.1.4-alpha.169

3 years ago

0.1.4-alpha.85

3 years ago

0.1.4-alpha.84

3 years ago

0.1.4-alpha.60

3 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.3-alpha.0

4 years ago

0.1.2-beta.17

4 years ago

0.1.2-alpha.17

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.2-alpha.1038

4 years ago