@aurodesignsystem/auro-skeleton 3.0.1 → 3.1.1
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/CHANGELOG.md +24 -0
- package/README.md +12 -12
- package/demo/api.js +1 -0
- package/demo/api.md +16 -16
- package/demo/api.min.js +168 -0
- package/demo/index.js +4 -0
- package/demo/index.md +19 -20
- package/demo/index.min.js +169 -0
- package/dist/auro-skeleton.d.ts +9 -0
- package/dist/auro-skeleton.d.ts.map +1 -1
- package/dist/auro-skeleton__bundled.js +22 -16
- package/dist/color-css.js +2 -0
- package/dist/tokens-css.js +2 -0
- package/index.js +1 -2
- package/package.json +15 -15
- package/src/auro-skeleton.js +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Semantic Release Automated Changelog
|
|
2
2
|
|
|
3
|
+
## [3.1.1](https://github.com/AlaskaAirlines/auro-skeleton/compare/v3.1.0...v3.1.1) (2024-11-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* update markdown partial pathing to consume new auro lib [#41](https://github.com/AlaskaAirlines/auro-skeleton/issues/41) ([b2c51a7](https://github.com/AlaskaAirlines/auro-skeleton/commit/b2c51a7a0c5e089eb1eab7db5a839b37a2236e15))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Performance Improvements
|
|
12
|
+
|
|
13
|
+
* update library to 3.0.2 ([a80a750](https://github.com/AlaskaAirlines/auro-skeleton/commit/a80a75081b4d14ca73c3e500ee6f1059c87f1eb2))
|
|
14
|
+
|
|
15
|
+
# [3.1.0](https://github.com/AlaskaAirlines/auro-skeleton/compare/v3.0.1...v3.1.0) (2024-10-24)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **api:** add register static method [#39](https://github.com/AlaskaAirlines/auro-skeleton/issues/39) ([0a5deb7](https://github.com/AlaskaAirlines/auro-skeleton/commit/0a5deb789cb640410c32427a23753cbf1e2222ef))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Performance Improvements
|
|
24
|
+
|
|
25
|
+
* update dependency versions ([2d4af8a](https://github.com/AlaskaAirlines/auro-skeleton/commit/2d4af8a69b421a31f2d3e8c6346a8a3e64572d97))
|
|
26
|
+
|
|
3
27
|
## [3.0.1](https://github.com/AlaskaAirlines/auro-skeleton/compare/v3.0.0...v3.0.1) (2024-10-09)
|
|
4
28
|
|
|
5
29
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ The README.md file is a compiled document. No edits should be made directly to t
|
|
|
4
4
|
README.md is created by running `npm run build:docs`.
|
|
5
5
|
|
|
6
6
|
This file is generated based on a template fetched from
|
|
7
|
-
`https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/
|
|
7
|
+
`https://raw.githubusercontent.com/AlaskaAirlines/WC-Generator/master/componentDocs/README_updated_paths.md`
|
|
8
8
|
and copied to `./componentDocs/README.md` each time the the docs are compiled.
|
|
9
9
|
|
|
10
10
|
The following sections are editable by making changes to the following files:
|
|
@@ -19,16 +19,16 @@ The following sections are editable by making changes to the following files:
|
|
|
19
19
|
|
|
20
20
|
# Skeleton
|
|
21
21
|
|
|
22
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
23
|
-
<!-- The below content is automatically added from
|
|
22
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/description.md) -->
|
|
23
|
+
<!-- The below content is automatically added from ./docs/partials/description.md -->
|
|
24
24
|
The `<auro-skeleton>` custom element is for use when display content takes an extended amount of time to process and render on-screen. This indicator communicates to the user that data is being loaded and that the page is not frozen.
|
|
25
25
|
|
|
26
26
|
[Research](https://www.nngroup.com/articles/progress-indicators/) conducted by the Nielsen Norman Group states that using skeleton states and [loading indicators](https://auro.alaskaair.com/components/auro/loader) improve user satisfaction.
|
|
27
27
|
|
|
28
28
|
The `<auro-skeleton>` element uses animation to convey that the page is still loading in order to reduce user uncertainty.
|
|
29
29
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
30
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
31
|
-
<!-- The below content is automatically added from
|
|
30
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/readmeAddlInfo.md) -->
|
|
31
|
+
<!-- The below content is automatically added from ./docs/partials/readmeAddlInfo.md -->
|
|
32
32
|
<!-- AURO-GENERATED-CONTENT This file is to be used for any additional content that should be included in the README.md which is specific to this component. -->
|
|
33
33
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
34
34
|
|
|
@@ -76,8 +76,8 @@ import "@aurodesignsystem/auro-skeleton";
|
|
|
76
76
|
|
|
77
77
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
78
78
|
**Reference component in HTML**
|
|
79
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
80
|
-
<!-- The below code snippet is automatically added from
|
|
79
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
|
|
80
|
+
<!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
|
|
81
81
|
|
|
82
82
|
```html
|
|
83
83
|
<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton>
|
|
@@ -102,15 +102,15 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
102
102
|
```html
|
|
103
103
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@4.9.2/dist/tokens/CSSCustomProperties.css" />
|
|
104
104
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@5.1.2/dist/bundled/essentials.css" />
|
|
105
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-skeleton@3.
|
|
105
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-skeleton@3.1.1/dist/auro-skeleton__bundled.js" type="module"></script>
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
109
109
|
|
|
110
110
|
## auro-skeleton use cases
|
|
111
111
|
|
|
112
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
113
|
-
<!-- The below content is automatically added from
|
|
112
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./docs/partials/useCases.md) -->
|
|
113
|
+
<!-- The below content is automatically added from ./docs/partials/useCases.md -->
|
|
114
114
|
The `<auro-skeleton>` element can be used on container-based components like `<auro-card>` and other structured lists.
|
|
115
115
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
116
116
|
|
|
@@ -118,8 +118,8 @@ The `<auro-skeleton>` element can be used on container-based components like `<a
|
|
|
118
118
|
|
|
119
119
|
### Default auro-skeleton
|
|
120
120
|
|
|
121
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
122
|
-
<!-- The below code snippet is automatically added from
|
|
121
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./apiExamples/basic.html) -->
|
|
122
|
+
<!-- The below code snippet is automatically added from ./apiExamples/basic.html -->
|
|
123
123
|
|
|
124
124
|
```html
|
|
125
125
|
<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton>
|
package/demo/api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../index.js';
|
package/demo/api.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
2
|
-
<!-- The below content is automatically added from
|
|
1
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../docs/api.md) -->
|
|
2
|
+
<!-- The below content is automatically added from ../docs/api.md -->
|
|
3
3
|
|
|
4
4
|
# auro-skeleton
|
|
5
5
|
|
|
@@ -20,8 +20,8 @@ The auro-skeleton element provides users a way to indicate the loading of asynch
|
|
|
20
20
|
The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute. Options are [`circle`, `oval`, `rectangle`]
|
|
21
21
|
|
|
22
22
|
<div class="exampleWrapper">
|
|
23
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
24
|
-
<!-- The below content is automatically added from
|
|
23
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/api_shape_circle.html) -->
|
|
24
|
+
<!-- The below content is automatically added from ../apiExamples/api_shape_circle.html -->
|
|
25
25
|
<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton>
|
|
26
26
|
<auro-skeleton shape="circle" style="width: 100px; height: 100px"></auro-skeleton>
|
|
27
27
|
<auro-skeleton shape="circle" style="width: 300px; height: 300px"></auro-skeleton>
|
|
@@ -29,8 +29,8 @@ The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute
|
|
|
29
29
|
</div>
|
|
30
30
|
<auro-accordion alignRight>
|
|
31
31
|
<span slot="trigger">See code</span>
|
|
32
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
33
|
-
<!-- The below code snippet is automatically added from
|
|
32
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/api_shape_circle.html) -->
|
|
33
|
+
<!-- The below code snippet is automatically added from ../apiExamples/api_shape_circle.html -->
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
36
|
<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton>
|
|
@@ -40,8 +40,8 @@ The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute
|
|
|
40
40
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
41
41
|
</auro-accordion>
|
|
42
42
|
<div class="exampleWrapper">
|
|
43
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
44
|
-
<!-- The below content is automatically added from
|
|
43
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/api_shape_oval.html) -->
|
|
44
|
+
<!-- The below content is automatically added from ../apiExamples/api_shape_oval.html -->
|
|
45
45
|
<auro-skeleton shape="oval" style="width: 80px; height: 40px"></auro-skeleton>
|
|
46
46
|
<auro-skeleton shape="oval" style="width: 200px; height: 100px;"></auro-skeleton>
|
|
47
47
|
<auro-skeleton shape="oval" style="width: 600px; height: 300px"></auro-skeleton>
|
|
@@ -49,8 +49,8 @@ The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute
|
|
|
49
49
|
</div>
|
|
50
50
|
<auro-accordion alignRight>
|
|
51
51
|
<span slot="trigger">See code</span>
|
|
52
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
53
|
-
<!-- The below code snippet is automatically added from
|
|
52
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/api_shape_oval.html) -->
|
|
53
|
+
<!-- The below code snippet is automatically added from ../apiExamples/api_shape_oval.html -->
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
56
|
<auro-skeleton shape="oval" style="width: 80px; height: 40px"></auro-skeleton>
|
|
@@ -60,8 +60,8 @@ The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute
|
|
|
60
60
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
61
61
|
</auro-accordion>
|
|
62
62
|
<div class="exampleWrapper">
|
|
63
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
64
|
-
<!-- The below content is automatically added from
|
|
63
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/api_shape_rectangle.html) -->
|
|
64
|
+
<!-- The below content is automatically added from ../apiExamples/api_shape_rectangle.html -->
|
|
65
65
|
<auro-skeleton shape="rectangle" style="width: 100px; height: 50px"></auro-skeleton>
|
|
66
66
|
<auro-skeleton shape="rectangle" style="width: 400px; height: 150px"></auro-skeleton>
|
|
67
67
|
<auro-skeleton shape="rectangle" style="width: 800px; height: 300px"></auro-skeleton>
|
|
@@ -69,8 +69,8 @@ The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute
|
|
|
69
69
|
</div>
|
|
70
70
|
<auro-accordion alignRight>
|
|
71
71
|
<span slot="trigger">See code</span>
|
|
72
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
73
|
-
<!-- The below code snippet is automatically added from
|
|
72
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/api_shape_rectangle.html) -->
|
|
73
|
+
<!-- The below code snippet is automatically added from ../apiExamples/api_shape_rectangle.html -->
|
|
74
74
|
|
|
75
75
|
```html
|
|
76
76
|
<auro-skeleton shape="rectangle" style="width: 100px; height: 50px"></auro-skeleton>
|
|
@@ -84,8 +84,8 @@ The `<auro-skeleton>` element makes use of a single `shape` enumerated attribute
|
|
|
84
84
|
|
|
85
85
|
The component may be restyled using the following code sample and changing the values of the following token(s).
|
|
86
86
|
|
|
87
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
88
|
-
<!-- The below code snippet is automatically added from
|
|
87
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../src/tokens.scss) -->
|
|
88
|
+
<!-- The below code snippet is automatically added from ../src/tokens.scss -->
|
|
89
89
|
|
|
90
90
|
```scss
|
|
91
91
|
@import './../node_modules/@aurodesignsystem/design-tokens/dist/tokens/SCSSVariables';
|
package/demo/api.min.js
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$3=t=>new n$2("string"==typeof t?t:t+"",void 0,s$1),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$2(o,t,s$1)},S$1=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$3(e)})(t):t;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2017 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:r$2,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$1(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d$1("elementProperties")]=new Map,b[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright 2017 Google LLC
|
|
17
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
+
*/
|
|
19
|
+
const t=globalThis,i$1=t.trustedTypes,s=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+h,n=`<${o}>`,r$1=document,l=()=>r$1.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$1.createTreeWalker(r$1,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$1.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$1).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$1,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$1.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t.litHtmlPolyfillSupport;j?.(N,R),(t.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}}r._$litElement$=!0,r["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r});const i=globalThis.litElementPolyfillSupport;i?.({LitElement:r});(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
26
|
+
|
|
27
|
+
var styleCss = i$3`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;animation-duration:2s;animation-fill-mode:backwards;animation-iteration-count:infinite;animation-name:place-holder-shimmer;animation-timing-function:linear;background-repeat:no-repeat;background-size:1000px 100%}:host([shape=circle]){width:auto;border-radius:50%}:host([shape=oval]){border-radius:9999px}:host([shape=rectangle]){border-radius:var(--ds-border-radius, 0.375rem)}@keyframes place-holder-shimmer{from{background-position:-1000px 0}to{background-position:1000px 0}}`;
|
|
28
|
+
|
|
29
|
+
var colorCss = i$3`:host{background-color:var(--ds-auro-skeleton-container-color);background-image:linear-gradient(to right, var(--ds-auro-skeleton-container-gradient-color-one) 10%, var(--ds-auro-skeleton-container-gradient-color-two) 40%, var(--ds-auro-skeleton-container-gradient-color-one) 60%)}`;
|
|
30
|
+
|
|
31
|
+
var tokensCss = i$3`:host{--ds-auro-skeleton-container-color: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-one: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-two: var(--ds-color-container-tertiary-default, rgba(0, 0, 0, 0.03))}`;
|
|
32
|
+
|
|
33
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
34
|
+
// See LICENSE in the project root for license information.
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
39
|
+
|
|
40
|
+
class AuroLibraryRuntimeUtils {
|
|
41
|
+
|
|
42
|
+
/* eslint-disable jsdoc/require-param */
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This will register a new custom element with the browser.
|
|
46
|
+
* @param {String} name - The name of the custom element.
|
|
47
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
registerComponent(name, componentClass) {
|
|
51
|
+
if (!customElements.get(name)) {
|
|
52
|
+
customElements.define(name, class extends componentClass {});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
closestElement(
|
|
61
|
+
selector, // selector like in .closest()
|
|
62
|
+
base = this, // extra functionality to skip a parent
|
|
63
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
64
|
+
!el || el === document || el === window
|
|
65
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
66
|
+
: found
|
|
67
|
+
? found // found a selector INside this element
|
|
68
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
69
|
+
) {
|
|
70
|
+
return __Closest(base);
|
|
71
|
+
}
|
|
72
|
+
/* eslint-enable jsdoc/require-param */
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
76
|
+
* @param {Object} elem - The element to check.
|
|
77
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
handleComponentTagRename(elem, tagName) {
|
|
81
|
+
const tag = tagName.toLowerCase();
|
|
82
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
83
|
+
|
|
84
|
+
if (elemTag !== tag) {
|
|
85
|
+
elem.setAttribute(tag, true);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Validates if an element is a specific Auro component.
|
|
91
|
+
* @param {Object} elem - The element to validate.
|
|
92
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
93
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
94
|
+
*/
|
|
95
|
+
elementMatch(elem, tagName) {
|
|
96
|
+
const tag = tagName.toLowerCase();
|
|
97
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
98
|
+
|
|
99
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
104
|
+
// See LICENSE in the project root for license information.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
108
|
+
/**
|
|
109
|
+
* The auro-skeleton element provides users a way to indicate the loading of asynchronous content on a page.
|
|
110
|
+
*
|
|
111
|
+
* @attr {String} shape - Renders a circle, oval, or rectangle loader.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
// build the component class
|
|
115
|
+
class AuroSkeleton extends r {
|
|
116
|
+
constructor() {
|
|
117
|
+
super();
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// function to define props used within the scope of this component
|
|
126
|
+
static get properties() {
|
|
127
|
+
return {
|
|
128
|
+
// ...super.properties,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static get styles() {
|
|
133
|
+
return [
|
|
134
|
+
styleCss,
|
|
135
|
+
colorCss,
|
|
136
|
+
tokensCss
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* This will register this element with the browser.
|
|
142
|
+
* @param {string} [name="auro-skeleton"] - The name of element that you want to register to.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* AuroSkeleton.register("custom-skeleton") // this will register this element to <custom-skeleton/>
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
static register(name = "auro-skeleton") {
|
|
149
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroSkeleton);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
firstUpdated() {
|
|
153
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
154
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-skeleton');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
158
|
+
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
159
|
+
|
|
160
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
161
|
+
render() {
|
|
162
|
+
return x`
|
|
163
|
+
<span class="util_displayHiddenVisually">Loading...</span>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
AuroSkeleton.register();
|
package/demo/index.js
ADDED
package/demo/index.md
CHANGED
|
@@ -6,8 +6,8 @@ This file is generated based on a template fetched from `./docs/partials/index.m
|
|
|
6
6
|
|
|
7
7
|
# Skeleton
|
|
8
8
|
|
|
9
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
10
|
-
<!-- The below content is automatically added from
|
|
9
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../docs/partials/description.md) -->
|
|
10
|
+
<!-- The below content is automatically added from ../docs/partials/description.md -->
|
|
11
11
|
The `<auro-skeleton>` custom element is for use when display content takes an extended amount of time to process and render on-screen. This indicator communicates to the user that data is being loaded and that the page is not frozen.
|
|
12
12
|
|
|
13
13
|
[Research](https://www.nngroup.com/articles/progress-indicators/) conducted by the Nielsen Norman Group states that using skeleton states and [loading indicators](https://auro.alaskaair.com/components/auro/loader) improve user satisfaction.
|
|
@@ -17,8 +17,8 @@ The `<auro-skeleton>` element uses animation to convey that the page is still lo
|
|
|
17
17
|
|
|
18
18
|
## auro-skeleton use cases
|
|
19
19
|
|
|
20
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
21
|
-
<!-- The below content is automatically added from
|
|
20
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../docs/partials/useCases.md) -->
|
|
21
|
+
<!-- The below content is automatically added from ../docs/partials/useCases.md -->
|
|
22
22
|
The `<auro-skeleton>` element can be used on container-based components like `<auro-card>` and other structured lists.
|
|
23
23
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
24
24
|
|
|
@@ -33,8 +33,8 @@ Do not represent a loading state with `<auro-skeleton>` for an entire component
|
|
|
33
33
|
The `<auro-skelelton>` API consists of a standardized enumerated `shape` attribute and the use of customzied CSS. The following examples illusrtate use cases to include `circle`, `oval` and `rectangle`. With the use of CSS the user has infinate options for how the animated skeleton can be used in their loading UI.
|
|
34
34
|
|
|
35
35
|
<div class="exampleWrapper">
|
|
36
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
37
|
-
<!-- The below content is automatically added from
|
|
36
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/basic.html) -->
|
|
37
|
+
<!-- The below content is automatically added from ../apiExamples/basic.html -->
|
|
38
38
|
<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton>
|
|
39
39
|
<auro-skeleton shape="oval" style="width: 200px; height: 100px;"></auro-skeleton>
|
|
40
40
|
<auro-skeleton shape="rectangle" style="width: 400px; height: 300px"></auro-skeleton>
|
|
@@ -42,8 +42,8 @@ The `<auro-skelelton>` API consists of a standardized enumerated `shape` attribu
|
|
|
42
42
|
</div>
|
|
43
43
|
<auro-accordion alignRight>
|
|
44
44
|
<span slot="trigger">See code</span>
|
|
45
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
46
|
-
<!-- The below code snippet is automatically added from
|
|
45
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/basic.html) -->
|
|
46
|
+
<!-- The below code snippet is automatically added from ../apiExamples/basic.html -->
|
|
47
47
|
|
|
48
48
|
```html
|
|
49
49
|
<auro-skeleton shape="circle" style="width: 40px; height: 40px"></auro-skeleton>
|
|
@@ -58,8 +58,8 @@ The `<auro-skelelton>` API consists of a standardized enumerated `shape` attribu
|
|
|
58
58
|
Use your imagination. Wherever data can be placed, an `<auro-skelelton>` element can be used. In the following exmaple see how `<auro-skelelton>` is used in place where data will be filled once the process is completed.
|
|
59
59
|
|
|
60
60
|
<div class="exampleWrapper">
|
|
61
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
62
|
-
<!-- The below content is automatically added from
|
|
61
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/table_example.html) -->
|
|
62
|
+
<!-- The below content is automatically added from ../apiExamples/table_example.html -->
|
|
63
63
|
<table class="auro_table">
|
|
64
64
|
<thead>
|
|
65
65
|
<tr>
|
|
@@ -89,8 +89,8 @@ Use your imagination. Wherever data can be placed, an `<auro-skelelton>` element
|
|
|
89
89
|
</div>
|
|
90
90
|
<auro-accordion alignRight>
|
|
91
91
|
<span slot="trigger">See code</span>
|
|
92
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
93
|
-
<!-- The below code snippet is automatically added from
|
|
92
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/table_example.html) -->
|
|
93
|
+
<!-- The below code snippet is automatically added from ../apiExamples/table_example.html -->
|
|
94
94
|
|
|
95
95
|
```html
|
|
96
96
|
<table class="auro_table">
|
|
@@ -124,22 +124,21 @@ Use your imagination. Wherever data can be placed, an `<auro-skelelton>` element
|
|
|
124
124
|
|
|
125
125
|
## Recommended Use and Version Control
|
|
126
126
|
|
|
127
|
-
There are two important parts of every Auro component. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom
|
|
127
|
+
There are two important parts of every Auro component. The <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">class</a> and the custom element. The class is exported and then used as part of defining the Web Component. When importing this component as described in the <a href="#install">install</a> section, the class is imported and the `auro-skeleton` custom element is defined automatically.
|
|
128
128
|
|
|
129
|
-
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `
|
|
129
|
+
To protect from versioning conflicts with other instances of the component being loaded, it is recommended to use our `AuroSkeleton.register(name)` method and pass in a unique name.
|
|
130
130
|
|
|
131
131
|
```js
|
|
132
132
|
import { AuroSkeleton } from './src/auro-skeleton.js';
|
|
133
|
-
import * as RuntimeUtils from '@aurodesignsystem/auro-library/scripts/utils/runtimeUtils.mjs';
|
|
134
133
|
|
|
135
|
-
|
|
134
|
+
AuroSkeleton.register('custom-skeleton');
|
|
136
135
|
```
|
|
137
136
|
|
|
138
137
|
This will create a new custom element that you can use in your HTML that will function identically to the `<auro-skeleton>` element.
|
|
139
138
|
|
|
140
139
|
<div class="exampleWrapper exampleWrapper--flex">
|
|
141
|
-
<!-- AURO-GENERATED-CONTENT:START (FILE:src
|
|
142
|
-
<!-- The below content is automatically added from
|
|
140
|
+
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/custom.html) -->
|
|
141
|
+
<!-- The below content is automatically added from ../apiExamples/custom.html -->
|
|
143
142
|
<custom-skeleton shape="circle" style="width: 40px; height: 40px"></custom-skeleton>
|
|
144
143
|
<custom-skeleton shape="oval" style="width: 200px; height: 100px;"></custom-skeleton>
|
|
145
144
|
<custom-skeleton shape="rectangle" style="width: 400px; height: 300px"></custom-skeleton>
|
|
@@ -147,8 +146,8 @@ This will create a new custom element that you can use in your HTML that will fu
|
|
|
147
146
|
</div>
|
|
148
147
|
<auro-accordion alignRight>
|
|
149
148
|
<span slot="trigger">See code</span>
|
|
150
|
-
<!-- AURO-GENERATED-CONTENT:START (CODE:src
|
|
151
|
-
<!-- The below code snippet is automatically added from
|
|
149
|
+
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/custom.html) -->
|
|
150
|
+
<!-- The below code snippet is automatically added from ../apiExamples/custom.html -->
|
|
152
151
|
|
|
153
152
|
```html
|
|
154
153
|
<custom-skeleton shape="circle" style="width: 40px; height: 40px"></custom-skeleton>
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/
|
|
6
|
+
const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$3=t=>new n$2("string"==typeof t?t:t+"",void 0,s$1),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$2(o,t,s$1)},S$1=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$3(e)})(t):t;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2017 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:r$2,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$1(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d$1("elementProperties")]=new Map,b[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @license
|
|
16
|
+
* Copyright 2017 Google LLC
|
|
17
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
|
+
*/
|
|
19
|
+
const t=globalThis,i$1=t.trustedTypes,s=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+h,n=`<${o}>`,r$1=document,l=()=>r$1.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$1.createTreeWalker(r$1,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$1.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$1).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$1,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$1.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t.litHtmlPolyfillSupport;j?.(N,R),(t.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}}r._$litElement$=!0,r["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r});const i=globalThis.litElementPolyfillSupport;i?.({LitElement:r});(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
26
|
+
|
|
27
|
+
var styleCss = i$3`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;animation-duration:2s;animation-fill-mode:backwards;animation-iteration-count:infinite;animation-name:place-holder-shimmer;animation-timing-function:linear;background-repeat:no-repeat;background-size:1000px 100%}:host([shape=circle]){width:auto;border-radius:50%}:host([shape=oval]){border-radius:9999px}:host([shape=rectangle]){border-radius:var(--ds-border-radius, 0.375rem)}@keyframes place-holder-shimmer{from{background-position:-1000px 0}to{background-position:1000px 0}}`;
|
|
28
|
+
|
|
29
|
+
var colorCss = i$3`:host{background-color:var(--ds-auro-skeleton-container-color);background-image:linear-gradient(to right, var(--ds-auro-skeleton-container-gradient-color-one) 10%, var(--ds-auro-skeleton-container-gradient-color-two) 40%, var(--ds-auro-skeleton-container-gradient-color-one) 60%)}`;
|
|
30
|
+
|
|
31
|
+
var tokensCss = i$3`:host{--ds-auro-skeleton-container-color: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-one: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-two: var(--ds-color-container-tertiary-default, rgba(0, 0, 0, 0.03))}`;
|
|
32
|
+
|
|
33
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
34
|
+
// See LICENSE in the project root for license information.
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
39
|
+
|
|
40
|
+
class AuroLibraryRuntimeUtils {
|
|
41
|
+
|
|
42
|
+
/* eslint-disable jsdoc/require-param */
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This will register a new custom element with the browser.
|
|
46
|
+
* @param {String} name - The name of the custom element.
|
|
47
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
48
|
+
* @returns {void}
|
|
49
|
+
*/
|
|
50
|
+
registerComponent(name, componentClass) {
|
|
51
|
+
if (!customElements.get(name)) {
|
|
52
|
+
customElements.define(name, class extends componentClass {});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
closestElement(
|
|
61
|
+
selector, // selector like in .closest()
|
|
62
|
+
base = this, // extra functionality to skip a parent
|
|
63
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
64
|
+
!el || el === document || el === window
|
|
65
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
66
|
+
: found
|
|
67
|
+
? found // found a selector INside this element
|
|
68
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
69
|
+
) {
|
|
70
|
+
return __Closest(base);
|
|
71
|
+
}
|
|
72
|
+
/* eslint-enable jsdoc/require-param */
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
76
|
+
* @param {Object} elem - The element to check.
|
|
77
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
handleComponentTagRename(elem, tagName) {
|
|
81
|
+
const tag = tagName.toLowerCase();
|
|
82
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
83
|
+
|
|
84
|
+
if (elemTag !== tag) {
|
|
85
|
+
elem.setAttribute(tag, true);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Validates if an element is a specific Auro component.
|
|
91
|
+
* @param {Object} elem - The element to validate.
|
|
92
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
93
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
94
|
+
*/
|
|
95
|
+
elementMatch(elem, tagName) {
|
|
96
|
+
const tag = tagName.toLowerCase();
|
|
97
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
98
|
+
|
|
99
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
104
|
+
// See LICENSE in the project root for license information.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
108
|
+
/**
|
|
109
|
+
* The auro-skeleton element provides users a way to indicate the loading of asynchronous content on a page.
|
|
110
|
+
*
|
|
111
|
+
* @attr {String} shape - Renders a circle, oval, or rectangle loader.
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
// build the component class
|
|
115
|
+
class AuroSkeleton extends r {
|
|
116
|
+
constructor() {
|
|
117
|
+
super();
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// function to define props used within the scope of this component
|
|
126
|
+
static get properties() {
|
|
127
|
+
return {
|
|
128
|
+
// ...super.properties,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
static get styles() {
|
|
133
|
+
return [
|
|
134
|
+
styleCss,
|
|
135
|
+
colorCss,
|
|
136
|
+
tokensCss
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* This will register this element with the browser.
|
|
142
|
+
* @param {string} [name="auro-skeleton"] - The name of element that you want to register to.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* AuroSkeleton.register("custom-skeleton") // this will register this element to <custom-skeleton/>
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
static register(name = "auro-skeleton") {
|
|
149
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroSkeleton);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
firstUpdated() {
|
|
153
|
+
// Add the tag name as an attribute if it is different than the component name
|
|
154
|
+
this.runtimeUtils.handleComponentTagRename(this, 'auro-skeleton');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
158
|
+
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
159
|
+
|
|
160
|
+
// function that renders the HTML and CSS into the scope of the component
|
|
161
|
+
render() {
|
|
162
|
+
return x`
|
|
163
|
+
<span class="util_displayHiddenVisually">Loading...</span>
|
|
164
|
+
`;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
AuroSkeleton.register(); // registering to `auro-skeleton`
|
|
169
|
+
AuroSkeleton.register('custom-skeleton');
|
package/dist/auro-skeleton.d.ts
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
export class AuroSkeleton extends LitElement {
|
|
7
7
|
static get properties(): {};
|
|
8
8
|
static get styles(): import("lit").CSSResult[];
|
|
9
|
+
/**
|
|
10
|
+
* This will register this element with the browser.
|
|
11
|
+
* @param {string} [name="auro-skeleton"] - The name of element that you want to register to.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* AuroSkeleton.register("custom-skeleton") // this will register this element to <custom-skeleton/>
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
static register(name?: string): void;
|
|
9
18
|
/**
|
|
10
19
|
* @private
|
|
11
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auro-skeleton.d.ts","sourceRoot":"","sources":["../src/auro-skeleton.js"],"names":[],"mappings":"AAeA;;;;GAIG;AAGH;IAWE,4BAIC;IAED,+CAMC;
|
|
1
|
+
{"version":3,"file":"auro-skeleton.d.ts","sourceRoot":"","sources":["../src/auro-skeleton.js"],"names":[],"mappings":"AAeA;;;;GAIG;AAGH;IAWE,4BAIC;IAED,+CAMC;IAED;;;;;;;OAOG;IACH,uBANW,MAAM,QAQhB;IA/BC;;OAEG;IACH,qBAAiD;IA8BnD,qBAGC;IAMD,+CAIC;CACF;2BAnEgC,KAAK"}
|
|
@@ -3,32 +3,32 @@
|
|
|
3
3
|
* Copyright 2019 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
5
|
*/
|
|
6
|
-
const t=globalThis,e$
|
|
6
|
+
const t$1=globalThis,e$2=t$1.ShadowRoot&&(void 0===t$1.ShadyCSS||t$1.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s$1=Symbol(),o$2=new WeakMap;let n$2 = class n{constructor(t,e,o){if(this._$cssResult$=!0,o!==s$1)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o;const s=this.t;if(e$2&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=o$2.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&o$2.set(s,t));}return t}toString(){return this.cssText}};const r$3=t=>new n$2("string"==typeof t?t:t+"",void 0,s$1),i$3=(t,...e)=>{const o=1===t.length?t[0]:e.reduce(((e,s,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[o+1]),t[0]);return new n$2(o,t,s$1)},S$1=(s,o)=>{if(e$2)s.adoptedStyleSheets=o.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of o){const o=document.createElement("style"),n=t$1.litNonce;void 0!==n&&o.setAttribute("nonce",n),o.textContent=e.cssText,s.appendChild(o);}},c$2=e$2?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return r$3(e)})(t):t;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/const{is:i,defineProperty:e,getOwnPropertyDescriptor:r,getOwnPropertyNames:h$
|
|
12
|
+
*/const{is:i$2,defineProperty:e$1,getOwnPropertyDescriptor:r$2,getOwnPropertyNames:h$1,getOwnPropertySymbols:o$1,getPrototypeOf:n$1}=Object,a$1=globalThis,c$1=a$1.trustedTypes,l$1=c$1?c$1.emptyScript:"",p$1=a$1.reactiveElementPolyfillSupport,d$1=(t,s)=>t,u$1={toAttribute(t,s){switch(s){case Boolean:t=t?l$1:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t);}return t},fromAttribute(t,s){let i=t;switch(s){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t);}catch(t){i=null;}}return i}},f$1=(t,s)=>!i$2(t,s),y$1={attribute:!0,type:String,converter:u$1,reflect:!1,hasChanged:f$1};Symbol.metadata??=Symbol("metadata"),a$1.litPropertyMetadata??=new WeakMap;class b extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,s=y$1){if(s.state&&(s.attribute=!1),this._$Ei(),this.elementProperties.set(t,s),!s.noAccessor){const i=Symbol(),r=this.getPropertyDescriptor(t,i,s);void 0!==r&&e$1(this.prototype,t,r);}}static getPropertyDescriptor(t,s,i){const{get:e,set:h}=r$2(this.prototype,t)??{get(){return this[s]},set(t){this[s]=t;}};return {get(){return e?.call(this)},set(s){const r=e?.call(this);h.call(this,s),this.requestUpdate(t,r,i);},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??y$1}static _$Ei(){if(this.hasOwnProperty(d$1("elementProperties")))return;const t=n$1(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty(d$1("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(d$1("properties"))){const t=this.properties,s=[...h$1(t),...o$1(t)];for(const i of s)this.createProperty(i,t[i]);}const t=this[Symbol.metadata];if(null!==t){const s=litPropertyMetadata.get(t);if(void 0!==s)for(const[t,i]of s)this.elementProperties.set(t,i);}this._$Eh=new Map;for(const[t,s]of this.elementProperties){const i=this._$Eu(t,s);void 0!==i&&this._$Eh.set(i,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(s){const i=[];if(Array.isArray(s)){const e=new Set(s.flat(1/0).reverse());for(const s of e)i.unshift(c$2(s));}else void 0!==s&&i.push(c$2(s));return i}static _$Eu(t,s){const i=s.attribute;return !1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)));}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.();}removeController(t){this._$EO?.delete(t);}_$E_(){const t=new Map,s=this.constructor.elementProperties;for(const i of s.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t);}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S$1(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()));}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()));}attributeChangedCallback(t,s,i){this._$AK(t,i);}_$EC(t,s){const i=this.constructor.elementProperties.get(t),e=this.constructor._$Eu(t,i);if(void 0!==e&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:u$1).toAttribute(s,i.type);this._$Em=t,null==r?this.removeAttribute(e):this.setAttribute(e,r),this._$Em=null;}}_$AK(t,s){const i=this.constructor,e=i._$Eh.get(t);if(void 0!==e&&this._$Em!==e){const t=i.getPropertyOptions(e),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:u$1;this._$Em=e,this[e]=r.fromAttribute(s,t.type),this._$Em=null;}}requestUpdate(t,s,i){if(void 0!==t){if(i??=this.constructor.getPropertyOptions(t),!(i.hasChanged??f$1)(this[t],s))return;this.P(t,s,i);}!1===this.isUpdatePending&&(this._$ES=this._$ET());}P(t,s,i){this._$AL.has(t)||this._$AL.set(t,s),!0===i.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t);}async _$ET(){this.isUpdatePending=!0;try{await this._$ES;}catch(t){Promise.reject(t);}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,s]of this._$Ep)this[t]=s;this._$Ep=void 0;}const t=this.constructor.elementProperties;if(t.size>0)for(const[s,i]of t)!0!==i.wrapped||this._$AL.has(s)||void 0===this[s]||this.P(s,this[s],i);}let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(s)):this._$EU();}catch(s){throw t=!1,this._$EU(),s}t&&this._$AE(s);}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t);}_$EU(){this._$AL=new Map,this.isUpdatePending=!1;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return !0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU();}updated(t){}firstUpdated(t){}}b.elementStyles=[],b.shadowRootOptions={mode:"open"},b[d$1("elementProperties")]=new Map,b[d$1("finalized")]=new Map,p$1?.({ReactiveElement:b}),(a$1.reactiveElementVersions??=[]).push("2.0.4");
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @license
|
|
16
16
|
* Copyright 2017 Google LLC
|
|
17
17
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
18
18
|
*/
|
|
19
|
-
const
|
|
19
|
+
const t=globalThis,i$1=t.trustedTypes,s=i$1?i$1.createPolicy("lit-html",{createHTML:t=>t}):void 0,e="$lit$",h=`lit$${Math.random().toFixed(9).slice(2)}$`,o="?"+h,n=`<${o}>`,r$1=document,l=()=>r$1.createComment(""),c=t=>null===t||"object"!=typeof t&&"function"!=typeof t,a=Array.isArray,u=t=>a(t)||"function"==typeof t?.[Symbol.iterator],d="[ \t\n\f\r]",f=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,_=/>/g,m=RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),p=/'/g,g=/"/g,$=/^(?:script|style|textarea|title)$/i,y=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),x=y(1),T=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),A=new WeakMap,C=r$1.createTreeWalker(r$1,129);function P(t,i){if(!a(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(i):i}const V=(t,i)=>{const s=t.length-1,o=[];let r,l=2===i?"<svg>":3===i?"<math>":"",c=f;for(let i=0;i<s;i++){const s=t[i];let a,u,d=-1,y=0;for(;y<s.length&&(c.lastIndex=y,u=c.exec(s),null!==u);)y=c.lastIndex,c===f?"!--"===u[1]?c=v:void 0!==u[1]?c=_:void 0!==u[2]?($.test(u[2])&&(r=RegExp("</"+u[2],"g")),c=m):void 0!==u[3]&&(c=m):c===m?">"===u[0]?(c=r??f,d=-1):void 0===u[1]?d=-2:(d=c.lastIndex-u[2].length,a=u[1],c=void 0===u[3]?m:'"'===u[3]?g:p):c===g||c===p?c=m:c===v||c===_?c=f:(c=m,r=void 0);const x=c===m&&t[i+1].startsWith("/>")?" ":"";l+=c===f?s+n:d>=0?(o.push(a),s.slice(0,d)+e+s.slice(d)+h+x):s+h+(-2===d?i:x);}return [P(t,l+(t[s]||"<?>")+(2===i?"</svg>":3===i?"</math>":"")),o]};class N{constructor({strings:t,_$litType$:s},n){let r;this.parts=[];let c=0,a=0;const u=t.length-1,d=this.parts,[f,v]=V(t,s);if(this.el=N.createElement(f,n),C.currentNode=this.el.content,2===s||3===s){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes);}for(;null!==(r=C.nextNode())&&d.length<u;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(e)){const i=v[a++],s=r.getAttribute(t).split(h),e=/([.?@])?(.*)/.exec(i);d.push({type:1,index:c,name:e[2],strings:s,ctor:"."===e[1]?H:"?"===e[1]?I:"@"===e[1]?L:k}),r.removeAttribute(t);}else t.startsWith(h)&&(d.push({type:6,index:c}),r.removeAttribute(t));if($.test(r.tagName)){const t=r.textContent.split(h),s=t.length-1;if(s>0){r.textContent=i$1?i$1.emptyScript:"";for(let i=0;i<s;i++)r.append(t[i],l()),C.nextNode(),d.push({type:2,index:++c});r.append(t[s],l());}}}else if(8===r.nodeType)if(r.data===o)d.push({type:2,index:c});else {let t=-1;for(;-1!==(t=r.data.indexOf(h,t+1));)d.push({type:7,index:c}),t+=h.length-1;}c++;}}static createElement(t,i){const s=r$1.createElement("template");return s.innerHTML=t,s}}function S(t,i,s=t,e){if(i===T)return i;let h=void 0!==e?s._$Co?.[e]:s._$Cl;const o=c(i)?void 0:i._$litDirective$;return h?.constructor!==o&&(h?._$AO?.(!1),void 0===o?h=void 0:(h=new o(t),h._$AT(t,s,e)),void 0!==e?(s._$Co??=[])[e]=h:s._$Cl=h),void 0!==h&&(i=S(t,h._$AS(t,i.values),h,e)),i}class M{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:i},parts:s}=this._$AD,e=(t?.creationScope??r$1).importNode(i,!0);C.currentNode=e;let h=C.nextNode(),o=0,n=0,l=s[0];for(;void 0!==l;){if(o===l.index){let i;2===l.type?i=new R(h,h.nextSibling,this,t):1===l.type?i=new l.ctor(h,l.name,l.strings,this,t):6===l.type&&(i=new z(h,this,t)),this._$AV.push(i),l=s[++n];}o!==l?.index&&(h=C.nextNode(),o++);}return C.currentNode=r$1,e}p(t){let i=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++;}}class R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,i,s,e){this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cv=e?.isConnected??!0;}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t?.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=S(this,t,i),c(t)?t===E||null==t||""===t?(this._$AH!==E&&this._$AR(),this._$AH=E):t!==this._$AH&&t!==T&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):u(t)?this.k(t):this._(t);}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t));}_(t){this._$AH!==E&&c(this._$AH)?this._$AA.nextSibling.data=t:this.T(r$1.createTextNode(t)),this._$AH=t;}$(t){const{values:i,_$litType$:s}=t,e="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===e)this._$AH.p(i);else {const t=new M(e,this),s=t.u(this.options);t.p(i),this.T(s),this._$AH=t;}}_$AC(t){let i=A.get(t.strings);return void 0===i&&A.set(t.strings,i=new N(t)),i}k(t){a(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const h of t)e===i.length?i.push(s=new R(this.O(l()),this.O(l()),this,this.options)):s=i[e],s._$AI(h),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e);}_$AR(t=this._$AA.nextSibling,i){for(this._$AP?.(!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i;}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t));}}class k{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,i,s,e,h){this.type=1,this._$AH=E,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=h,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=E;}_$AI(t,i=this,s,e){const h=this.strings;let o=!1;if(void 0===h)t=S(this,t,i,0),o=!c(t)||t!==this._$AH&&t!==T,o&&(this._$AH=t);else {const e=t;let n,r;for(t=h[0],n=0;n<h.length-1;n++)r=S(this,e[s+n],i,n),r===T&&(r=this._$AH[n]),o||=!c(r)||r!==this._$AH[n],r===E?t=E:t!==E&&(t+=(r??"")+h[n+1]),this._$AH[n]=r;}o&&!e&&this.j(t);}j(t){t===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}}class H extends k{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===E?void 0:t;}}class I extends k{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==E);}}class L extends k{constructor(t,i,s,e,h){super(t,i,s,e,h),this.type=5;}_$AI(t,i=this){if((t=S(this,t,i,0)??E)===T)return;const s=this._$AH,e=t===E&&s!==E||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,h=t!==E&&(s===E||e);e&&this.element.removeEventListener(this.name,this,s),h&&this.element.addEventListener(this.name,this,t),this._$AH=t;}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t);}}class z{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s;}get _$AU(){return this._$AM._$AU}_$AI(t){S(this,t);}}const j=t.litHtmlPolyfillSupport;j?.(N,R),(t.litHtmlVersions??=[]).push("3.2.1");const B=(t,i,s)=>{const e=s?.renderBefore??i;let h=e._$litPart$;if(void 0===h){const t=s?.renderBefore??null;e._$litPart$=h=new R(i.insertBefore(l(),t),t,void 0,s??{});}return h._$AI(t),h};
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @license
|
|
23
23
|
* Copyright 2017 Google LLC
|
|
24
24
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/class
|
|
25
|
+
*/class r extends b{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(s,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1);}render(){return T}}r._$litElement$=!0,r["finalized"]=!0,globalThis.litElementHydrateSupport?.({LitElement:r});const i=globalThis.litElementPolyfillSupport;i?.({LitElement:r});(globalThis.litElementVersions??=[]).push("4.1.1");
|
|
26
26
|
|
|
27
|
-
var styleCss = i$
|
|
27
|
+
var styleCss = i$3`*,*:before,*:after{box-sizing:border-box}@media(prefers-reduced-motion: reduce){*,*:before,*:after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important}}*:focus-visible{outline:0}*:focus-visible{outline:0}:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;animation-duration:2s;animation-fill-mode:backwards;animation-iteration-count:infinite;animation-name:place-holder-shimmer;animation-timing-function:linear;background-repeat:no-repeat;background-size:1000px 100%}:host([shape=circle]){width:auto;border-radius:50%}:host([shape=oval]){border-radius:9999px}:host([shape=rectangle]){border-radius:var(--ds-border-radius, 0.375rem)}@keyframes place-holder-shimmer{from{background-position:-1000px 0}to{background-position:1000px 0}}`;
|
|
28
28
|
|
|
29
|
-
var colorCss = i$
|
|
29
|
+
var colorCss = i$3`:host{background-color:var(--ds-auro-skeleton-container-color);background-image:linear-gradient(to right, var(--ds-auro-skeleton-container-gradient-color-one) 10%, var(--ds-auro-skeleton-container-gradient-color-two) 40%, var(--ds-auro-skeleton-container-gradient-color-one) 60%)}`;
|
|
30
30
|
|
|
31
|
-
var tokensCss = i$
|
|
31
|
+
var tokensCss = i$3`:host{--ds-auro-skeleton-container-color: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-one: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-two: var(--ds-color-container-tertiary-default, rgba(0, 0, 0, 0.03))}`;
|
|
32
32
|
|
|
33
33
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
34
34
|
// See LICENSE in the project root for license information.
|
|
@@ -112,7 +112,7 @@ class AuroLibraryRuntimeUtils {
|
|
|
112
112
|
*/
|
|
113
113
|
|
|
114
114
|
// build the component class
|
|
115
|
-
class AuroSkeleton extends
|
|
115
|
+
class AuroSkeleton extends r {
|
|
116
116
|
constructor() {
|
|
117
117
|
super();
|
|
118
118
|
|
|
@@ -137,6 +137,18 @@ class AuroSkeleton extends h {
|
|
|
137
137
|
];
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* This will register this element with the browser.
|
|
142
|
+
* @param {string} [name="auro-skeleton"] - The name of element that you want to register to.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* AuroSkeleton.register("custom-skeleton") // this will register this element to <custom-skeleton/>
|
|
146
|
+
*
|
|
147
|
+
*/
|
|
148
|
+
static register(name = "auro-skeleton") {
|
|
149
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroSkeleton);
|
|
150
|
+
}
|
|
151
|
+
|
|
140
152
|
firstUpdated() {
|
|
141
153
|
// Add the tag name as an attribute if it is different than the component name
|
|
142
154
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-skeleton');
|
|
@@ -147,16 +159,10 @@ class AuroSkeleton extends h {
|
|
|
147
159
|
|
|
148
160
|
// function that renders the HTML and CSS into the scope of the component
|
|
149
161
|
render() {
|
|
150
|
-
return
|
|
162
|
+
return x`
|
|
151
163
|
<span class="util_displayHiddenVisually">Loading...</span>
|
|
152
164
|
`;
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
167
|
|
|
156
|
-
|
|
157
|
-
// define the name of the custom component
|
|
158
|
-
if (!customElements.get("auro-skeleton")) {
|
|
159
|
-
customElements.define("auro-skeleton", AuroSkeleton);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent('custom-skeleton', AuroSkeleton);
|
|
168
|
+
AuroSkeleton.register();
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export default css`:host{background-color:var(--ds-auro-skeleton-container-color);background-image:linear-gradient(to right, var(--ds-auro-skeleton-container-gradient-color-one) 10%, var(--ds-auro-skeleton-container-gradient-color-two) 40%, var(--ds-auro-skeleton-container-gradient-color-one) 60%)}`;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export default css`:host{--ds-auro-skeleton-container-color: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-one: var(--ds-color-container-subtle-default, #f7f8fa);--ds-auro-skeleton-container-gradient-color-two: var(--ds-color-container-tertiary-default, rgba(0, 0, 0, 0.03))}`;
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"================================================================================"
|
|
8
8
|
],
|
|
9
9
|
"name": "@aurodesignsystem/auro-skeleton",
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.1.1",
|
|
11
11
|
"description": "auro-skeleton HTML custom element",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"node": "^18.x || ^20.x "
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@aurodesignsystem/auro-library": "^
|
|
23
|
+
"@aurodesignsystem/auro-library": "^3.0.2",
|
|
24
24
|
"chalk": "^5.3.0",
|
|
25
|
-
"lit": "^3.2.
|
|
25
|
+
"lit": "^3.2.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@aurodesignsystem/design-tokens": "^4.9.2",
|
|
29
29
|
"@aurodesignsystem/webcorestylesheets": "^5.1.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@aurodesignsystem/design-tokens": "^4.
|
|
32
|
+
"@aurodesignsystem/design-tokens": "^4.10.0",
|
|
33
33
|
"@aurodesignsystem/eslint-config": "^1.3.2",
|
|
34
34
|
"@aurodesignsystem/webcorestylesheets": "^5.1.2",
|
|
35
35
|
"@commitlint/cli": "^19.5.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@semantic-release/changelog": "^6.0.3",
|
|
40
40
|
"@semantic-release/git": "^10.0.1",
|
|
41
41
|
"@semantic-release/npm": "^12.0.1",
|
|
42
|
-
"@web/dev-server": "^0.4.
|
|
42
|
+
"@web/dev-server": "^0.4.6",
|
|
43
43
|
"@web/test-runner": "^0.19.0",
|
|
44
44
|
"autoprefixer": "^10.4.20",
|
|
45
45
|
"compression": "^1.7.4",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"concurrently": "^9.0.1",
|
|
48
48
|
"copyfiles": "^2.4.1",
|
|
49
49
|
"core-js": "^3.38.1",
|
|
50
|
-
"eslint": "^9.
|
|
51
|
-
"eslint-plugin-jsdoc": "^50.3
|
|
50
|
+
"eslint": "^9.13.0",
|
|
51
|
+
"eslint-plugin-jsdoc": "^50.4.3",
|
|
52
52
|
"husky": "^9.1.6",
|
|
53
53
|
"lodash": "^4.17.21",
|
|
54
54
|
"markdown-magic": "^2.6.1",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"postcss": "^8.4.47",
|
|
58
58
|
"postcss-discard-comments": "^7.0.3",
|
|
59
59
|
"postcss-selector-replace": "^1.0.2",
|
|
60
|
-
"rollup": "^4.
|
|
60
|
+
"rollup": "^4.24.0",
|
|
61
61
|
"rollup-plugin-serve": "^1.1.1",
|
|
62
|
-
"sass": "^1.
|
|
63
|
-
"semantic-release": "^24.1.
|
|
64
|
-
"stylelint": "^16.
|
|
62
|
+
"sass": "^1.80.3",
|
|
63
|
+
"semantic-release": "^24.1.3",
|
|
64
|
+
"stylelint": "^16.10.0",
|
|
65
65
|
"stylelint-config-idiomatic-order": "^10.0.0",
|
|
66
|
-
"stylelint-config-standard": "^36.0.
|
|
66
|
+
"stylelint-config-standard": "^36.0.1",
|
|
67
67
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
68
68
|
"stylelint-order": "^6.0.4",
|
|
69
|
-
"stylelint-scss": "^6.
|
|
70
|
-
"typescript": "^5.6.
|
|
69
|
+
"stylelint-scss": "^6.8.1",
|
|
70
|
+
"typescript": "^5.6.3",
|
|
71
71
|
"wc-sass-render": "^1.4.0",
|
|
72
72
|
"web-component-analyzer": "^2.0.0",
|
|
73
73
|
"whatwg-fetch": "^3.6.20",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"web components"
|
|
139
139
|
],
|
|
140
140
|
"scripts": {
|
|
141
|
-
"build": "npm-run-all build:sass sass:render types",
|
|
141
|
+
"build": "npm-run-all build:sass sass:render scssLint dist:js bundler postinstall build:api build:docs types",
|
|
142
142
|
"build:test": "npm-run-all test linters",
|
|
143
143
|
"build:release": "npm-run-all build build:test build:api build:docs bundler postinstall",
|
|
144
144
|
"build:ci": "npm-run-all sweep build:release",
|
package/src/auro-skeleton.js
CHANGED
|
@@ -45,6 +45,18 @@ export class AuroSkeleton extends LitElement {
|
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/**
|
|
49
|
+
* This will register this element with the browser.
|
|
50
|
+
* @param {string} [name="auro-skeleton"] - The name of element that you want to register to.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* AuroSkeleton.register("custom-skeleton") // this will register this element to <custom-skeleton/>
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
static register(name = "auro-skeleton") {
|
|
57
|
+
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroSkeleton);
|
|
58
|
+
}
|
|
59
|
+
|
|
48
60
|
firstUpdated() {
|
|
49
61
|
// Add the tag name as an attribute if it is different than the component name
|
|
50
62
|
this.runtimeUtils.handleComponentTagRename(this, 'auro-skeleton');
|
|
@@ -60,9 +72,3 @@ export class AuroSkeleton extends LitElement {
|
|
|
60
72
|
`;
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
|
-
|
|
64
|
-
/* istanbul ignore else */
|
|
65
|
-
// define the name of the custom component
|
|
66
|
-
if (!customElements.get("auro-skeleton")) {
|
|
67
|
-
customElements.define("auro-skeleton", AuroSkeleton);
|
|
68
|
-
}
|