keyframekit 1.1.8 → 1.1.9
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/dist/KeyframeKit.min.js
CHANGED
|
@@ -3,4 +3,3 @@
|
|
|
3
3
|
* MIT License
|
|
4
4
|
*/
|
|
5
5
|
const e="%",t="-",s="--",r="-webkit-";var o=new class{Error={KeyframesRuleNameTypeError:class extends TypeError{message="Keyframes rule name must be a string."},SourceTypeError:class extends TypeError{message="Source must be either a CSSStyleSheet or a StyleSheetList."},StyleSheetImportError:class extends Error{message="The stylesheet could not be imported."}};async getDocumentStyleSheetsOnLoad({document:e=window.document}={}){return await async function({document:e}){if("complete"===e.readyState)return;const{promise:t,resolve:s}=Promise.withResolvers();function r(){"complete"===e.readyState&&s(null)}const o=["readystatechange",r];e.addEventListener(...o),await t,e.removeEventListener(...o)}({document:e}),e.styleSheets}async importStyleSheet(e){const t=await fetch(e);if(!t.ok)throw new this.Error.StyleSheetImportError;const s=await t.text(),r=e.split("/").slice(0,-1).join("/"),o=new CSSStyleSheet({baseURL:r});return await o.replace(s),o}getStyleSheetKeyframes({of:e,in:t}){if("string"!=typeof e)throw new this.Error.KeyframesRuleNameTypeError;if(t instanceof StyleSheetList)return this.#e({of:e,styleSheetList:t});if(t instanceof CSSStyleSheet)return this.#t({of:e,styleSheet:t});throw new this.Error.SourceTypeError}#e({of:e,styleSheetList:t}){for(const s of t){const t=this.#t({of:e,styleSheet:s});if(void 0!==t)return t}}#t({of:e,styleSheet:t}){for(const s of t.cssRules)if(s instanceof CSSKeyframesRule&&s.name===e){return this.parseKeyframesRule({rule:s})}}getAllStyleSheetKeyframesRules({in:e}){if(e instanceof StyleSheetList)return this.#s({styleSheetList:e});if(e instanceof CSSStyleSheet)return this.#r({styleSheet:e});throw new this.Error.SourceTypeError}#s({styleSheetList:e}){let t={};for(const s of e){const e=this.#r({styleSheet:s});t={...t,...e}}return t}#r({styleSheet:e}){let t={};for(const s of e.cssRules){if(!(s instanceof CSSKeyframesRule))continue;const e=this.parseKeyframesRule({rule:s});t[s.name]=e}return t}parseKeyframesRule({rule:t}){let s=[];for(const r of t){const t=l({of:r.keyText,suffix:e}),o=Number(t)/100;let n={};for(const e of r.style){const t=r.style.getPropertyValue(e);n[this.#o(e)]=t}const i={...n,offset:o};s.push(i)}return new i(s)}#o(e){if(this.#n(e))return e;if("float"===e)return"cssFloat";if("offset"===e)return"cssOffset";const t=this.#i(e);return this.#l(e,t)}#l(e,s=!1){let r="",o=!1;s&&(e=e.slice(1));for(const s of e)s===t?o=!0:o?(o=!1,r+=s.toUpperCase()):r+=s;return r}#n(e){return e.startsWith(s)&&e!==s}#i(e){return e.startsWith(r)}};class n{keyframes;options;constructor({keyframes:e,options:t={}}){this.keyframes=e,this.options=this.#a(t)}toAnimation({target:e,options:t={},timeline:s=document.timeline}){t=this.#a(t);const r={...this.options,...t},o=new KeyframeEffect(e,this.keyframes,r);return new Animation(o,s)}#a(e){return"number"==typeof e?{duration:e}:e}}class i{keyframes;constructor(e){this.keyframes=e}toKeyframeEffect(e){let t;return t=new n(null!==e?{keyframes:this.keyframes,options:e}:{keyframes:this.keyframes}),t}}function l({of:e,suffix:t}){return e.slice(0,-t.length)}export{n as KeyframeEffectParameters,i as ParsedKeyframes,o as default};
|
|
6
|
-
//# sourceMappingURL=KeyframeKit.min.js.map
|
package/package.json
CHANGED
package/rollup.config.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KeyframeKit.min.js","sources":["../src/KeyframeKit.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAQA"}
|