@cropper/element
Advanced tools
@@ -320,4 +320,3 @@ const IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; | ||
| name = toKebabCase(name); | ||
| const { customElements } = WINDOW; | ||
| if (IS_BROWSER && customElements && !customElements.get(name)) { | ||
| if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) { | ||
| customElements.define(name, this, options); | ||
@@ -327,4 +326,4 @@ } | ||
| } | ||
| CropperElement.$version = '2.0.0-beta'; | ||
| CropperElement.$version = '2.0.0-beta.1'; | ||
| export { CropperElement as default }; |
@@ -1,1 +0,1 @@ | ||
| const t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{};t&&e.document.documentElement;const s=Number.isNaN||e.isNaN;const o=/([a-z\d])([A-Z])/g;function n(t){return String(t).replace(o,"$1-$2").toLowerCase()}const i=/-[A-z\d]/g;function a(t){return t.replace(i,(t=>t.slice(1).toUpperCase()))}const r={bubbles:!0,cancelable:!0,composed:!0};const c=Promise.resolve();const h=/left|top|width|height/i,l=new WeakMap,d=new WeakMap,u=new Map,b=e.document&&Array.isArray(e.document.adoptedStyleSheets)&&"replaceSync"in e.CSSStyleSheet.prototype;class p extends HTMLElement{constructor(){var t,e;super(),this.shadowRootMode="open",this.slottable=!0;const s=null===(e=null===(t=Object.getPrototypeOf(this))||void 0===t?void 0:t.constructor)||void 0===e?void 0:e.$name;s&&u.set(s,this.tagName.toLowerCase())}get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,e,s){if(Object.is(s,e))return;const o=a(t);let n=s;switch(typeof this[o]){case"boolean":n=null!==s&&"false"!==s;break;case"number":n=Number(s)}switch(this[o]=n,t){case"theme-color":{const t=d.get(this),e=this.$sharedStyle;t&&e&&(b?t.replaceSync(e):t.textContent=e);break}}}$propertyChangedCallback(t,e,o){if(!Object.is(o,e))switch(t=n(t),typeof o){case"boolean":!0===o?this.hasAttribute(t)||this.setAttribute(t,""):this.removeAttribute(t);break;case"number":o=s(o)?"":String(o);default:o?this.getAttribute(t)!==o&&this.setAttribute(t,o):this.removeAttribute(t)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach((t=>{const e=a(t);let s=this[e];(function(t){return void 0===t})(s)||this.$propertyChangedCallback(e,void 0,s),Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>s,set(t){const o=s;s=t,this.$propertyChangedCallback(e,o,t)}})}));const t=this.attachShadow({mode:this.shadowRootMode||"open"});if(this.shadowRoot||l.set(this,t),d.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const e=document.createElement("template");e.innerHTML=this.$template,t.appendChild(e.content)}if(this.slottable){const e=document.createElement("slot");t.appendChild(e)}}disconnectedCallback(){d.has(this)&&d.delete(this),l.has(this)&&l.delete(this)}$getTagNameOf(t){var e;return null!==(e=u.get(t))&&void 0!==e?e:t}$setStyles(t){return Object.keys(t).forEach((e=>{let o=t[e];(function(t){return"number"==typeof t&&!s(t)})(o)&&(o=0!==o&&h.test(e)?`${o}px`:String(o)),this.style[e]=o})),this}$getShadowRoot(){return this.shadowRoot||l.get(this)}$addStyles(t){let e;const s=this.$getShadowRoot();return b?(e=new CSSStyleSheet,e.replaceSync(t),s.adoptedStyleSheets=s.adoptedStyleSheets.concat(e)):(e=document.createElement("style"),e.textContent=t,s.appendChild(e)),e}$emit(t,e,s){return function(t,e,s,o){return t.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign(Object.assign({},r),{detail:s}),o)))}(this,t,e,s)}$nextTick(t){return function(t,e){return e?c.then(t?e.bind(t):e):c}(this,t)}static $define(s,o){var i;"object"==typeof(i=s)&&null!==i&&(o=s,s=""),s||(s=this.$name||this.name),s=n(s);const{customElements:a}=e;t&&a&&!a.get(s)&&a.define(s,this,o)}}p.$version="2.0.0-beta";export{p as default}; | ||
| const t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{};t&&e.document.documentElement;const s=Number.isNaN||e.isNaN;const o=/([a-z\d])([A-Z])/g;function n(t){return String(t).replace(o,"$1-$2").toLowerCase()}const i=/-[A-z\d]/g;function a(t){return t.replace(i,(t=>t.slice(1).toUpperCase()))}const r={bubbles:!0,cancelable:!0,composed:!0};const c=Promise.resolve();const h=/left|top|width|height/i,l=new WeakMap,d=new WeakMap,u=new Map,b=e.document&&Array.isArray(e.document.adoptedStyleSheets)&&"replaceSync"in e.CSSStyleSheet.prototype;class p extends HTMLElement{constructor(){var t,e;super(),this.shadowRootMode="open",this.slottable=!0;const s=null===(e=null===(t=Object.getPrototypeOf(this))||void 0===t?void 0:t.constructor)||void 0===e?void 0:e.$name;s&&u.set(s,this.tagName.toLowerCase())}get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,e,s){if(Object.is(s,e))return;const o=a(t);let n=s;switch(typeof this[o]){case"boolean":n=null!==s&&"false"!==s;break;case"number":n=Number(s)}switch(this[o]=n,t){case"theme-color":{const t=d.get(this),e=this.$sharedStyle;t&&e&&(b?t.replaceSync(e):t.textContent=e);break}}}$propertyChangedCallback(t,e,o){if(!Object.is(o,e))switch(t=n(t),typeof o){case"boolean":!0===o?this.hasAttribute(t)||this.setAttribute(t,""):this.removeAttribute(t);break;case"number":o=s(o)?"":String(o);default:o?this.getAttribute(t)!==o&&this.setAttribute(t,o):this.removeAttribute(t)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach((t=>{const e=a(t);let s=this[e];(function(t){return void 0===t})(s)||this.$propertyChangedCallback(e,void 0,s),Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>s,set(t){const o=s;s=t,this.$propertyChangedCallback(e,o,t)}})}));const t=this.attachShadow({mode:this.shadowRootMode||"open"});if(this.shadowRoot||l.set(this,t),d.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const e=document.createElement("template");e.innerHTML=this.$template,t.appendChild(e.content)}if(this.slottable){const e=document.createElement("slot");t.appendChild(e)}}disconnectedCallback(){d.has(this)&&d.delete(this),l.has(this)&&l.delete(this)}$getTagNameOf(t){var e;return null!==(e=u.get(t))&&void 0!==e?e:t}$setStyles(t){return Object.keys(t).forEach((e=>{let o=t[e];(function(t){return"number"==typeof t&&!s(t)})(o)&&(o=0!==o&&h.test(e)?`${o}px`:String(o)),this.style[e]=o})),this}$getShadowRoot(){return this.shadowRoot||l.get(this)}$addStyles(t){let e;const s=this.$getShadowRoot();return b?(e=new CSSStyleSheet,e.replaceSync(t),s.adoptedStyleSheets=s.adoptedStyleSheets.concat(e)):(e=document.createElement("style"),e.textContent=t,s.appendChild(e)),e}$emit(t,e,s){return function(t,e,s,o){return t.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign(Object.assign({},r),{detail:s}),o)))}(this,t,e,s)}$nextTick(t){return function(t,e){return e?c.then(t?e.bind(t):e):c}(this,t)}static $define(s,o){var i;"object"==typeof(i=s)&&null!==i&&(o=s,s=""),s||(s=this.$name||this.name),s=n(s),t&&e.customElements&&!e.customElements.get(s)&&customElements.define(s,this,o)}}p.$version="2.0.0-beta.1";export{p as default}; |
@@ -236,4 +236,3 @@ import { WINDOW, toCamelCase, toKebabCase, isNaN, isUndefined, isNumber, emit, nextTick, isObject, IS_BROWSER } from '@cropper/utils'; | ||
| name = toKebabCase(name); | ||
| const { customElements } = WINDOW; | ||
| if (IS_BROWSER && customElements && !customElements.get(name)) { | ||
| if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) { | ||
| customElements.define(name, this, options); | ||
@@ -243,4 +242,4 @@ } | ||
| } | ||
| CropperElement.$version = '2.0.0-beta'; | ||
| CropperElement.$version = '2.0.0-beta.1'; | ||
| export { CropperElement as default }; |
+2
-3
@@ -326,4 +326,3 @@ (function (global, factory) { | ||
| name = toKebabCase(name); | ||
| const { customElements } = WINDOW; | ||
| if (IS_BROWSER && customElements && !customElements.get(name)) { | ||
| if (IS_BROWSER && WINDOW.customElements && !WINDOW.customElements.get(name)) { | ||
| customElements.define(name, this, options); | ||
@@ -333,3 +332,3 @@ } | ||
| } | ||
| CropperElement.$version = '2.0.0-beta'; | ||
| CropperElement.$version = '2.0.0-beta.1'; | ||
@@ -336,0 +335,0 @@ return CropperElement; |
@@ -1,1 +0,1 @@ | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).CropperElement=e()}(this,(function(){"use strict";const t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{};t&&e.document.documentElement;const s=Number.isNaN||e.isNaN;const o=/([a-z\d])([A-Z])/g;function n(t){return String(t).replace(o,"$1-$2").toLowerCase()}const i=/-[A-z\d]/g;function r(t){return t.replace(i,(t=>t.slice(1).toUpperCase()))}const a={bubbles:!0,cancelable:!0,composed:!0};const c=Promise.resolve();const h=/left|top|width|height/i,l="open",d=new WeakMap,u=new WeakMap,p=new Map,b=e.document&&Array.isArray(e.document.adoptedStyleSheets)&&"replaceSync"in e.CSSStyleSheet.prototype;class m extends HTMLElement{constructor(){var t,e;super(),this.shadowRootMode=l,this.slottable=!0;const s=null===(e=null===(t=Object.getPrototypeOf(this))||void 0===t?void 0:t.constructor)||void 0===e?void 0:e.$name;s&&p.set(s,this.tagName.toLowerCase())}get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,e,s){if(Object.is(s,e))return;const o=r(t);let n=s;switch(typeof this[o]){case"boolean":n=null!==s&&"false"!==s;break;case"number":n=Number(s)}switch(this[o]=n,t){case"theme-color":{const t=u.get(this),e=this.$sharedStyle;t&&e&&(b?t.replaceSync(e):t.textContent=e);break}}}$propertyChangedCallback(t,e,o){if(!Object.is(o,e))switch(t=n(t),typeof o){case"boolean":!0===o?this.hasAttribute(t)||this.setAttribute(t,""):this.removeAttribute(t);break;case"number":o=s(o)?"":String(o);default:o?this.getAttribute(t)!==o&&this.setAttribute(t,o):this.removeAttribute(t)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach((t=>{const e=r(t);let s=this[e];(function(t){return void 0===t})(s)||this.$propertyChangedCallback(e,void 0,s),Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>s,set(t){const o=s;s=t,this.$propertyChangedCallback(e,o,t)}})}));const t=this.attachShadow({mode:this.shadowRootMode||l});if(this.shadowRoot||d.set(this,t),u.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const e=document.createElement("template");e.innerHTML=this.$template,t.appendChild(e.content)}if(this.slottable){const e=document.createElement("slot");t.appendChild(e)}}disconnectedCallback(){u.has(this)&&u.delete(this),d.has(this)&&d.delete(this)}$getTagNameOf(t){var e;return null!==(e=p.get(t))&&void 0!==e?e:t}$setStyles(t){return Object.keys(t).forEach((e=>{let o=t[e];(function(t){return"number"==typeof t&&!s(t)})(o)&&(o=0!==o&&h.test(e)?`${o}px`:String(o)),this.style[e]=o})),this}$getShadowRoot(){return this.shadowRoot||d.get(this)}$addStyles(t){let e;const s=this.$getShadowRoot();return b?(e=new CSSStyleSheet,e.replaceSync(t),s.adoptedStyleSheets=s.adoptedStyleSheets.concat(e)):(e=document.createElement("style"),e.textContent=t,s.appendChild(e)),e}$emit(t,e,s){return function(t,e,s,o){return t.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign(Object.assign({},a),{detail:s}),o)))}(this,t,e,s)}$nextTick(t){return function(t,e){return e?c.then(t?e.bind(t):e):c}(this,t)}static $define(s,o){var i;"object"==typeof(i=s)&&null!==i&&(o=s,s=""),s||(s=this.$name||this.name),s=n(s);const{customElements:r}=e;t&&r&&!r.get(s)&&r.define(s,this,o)}}return m.$version="2.0.0-beta",m})); | ||
| !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).CropperElement=e()}(this,(function(){"use strict";const t="undefined"!=typeof window&&void 0!==window.document,e=t?window:{};t&&e.document.documentElement;const s=Number.isNaN||e.isNaN;const o=/([a-z\d])([A-Z])/g;function n(t){return String(t).replace(o,"$1-$2").toLowerCase()}const i=/-[A-z\d]/g;function r(t){return t.replace(i,(t=>t.slice(1).toUpperCase()))}const a={bubbles:!0,cancelable:!0,composed:!0};const c=Promise.resolve();const l=/left|top|width|height/i,h="open",d=new WeakMap,u=new WeakMap,p=new Map,b=e.document&&Array.isArray(e.document.adoptedStyleSheets)&&"replaceSync"in e.CSSStyleSheet.prototype;class m extends HTMLElement{constructor(){var t,e;super(),this.shadowRootMode=h,this.slottable=!0;const s=null===(e=null===(t=Object.getPrototypeOf(this))||void 0===t?void 0:t.constructor)||void 0===e?void 0:e.$name;s&&p.set(s,this.tagName.toLowerCase())}get $sharedStyle(){return(this.themeColor?`:host{--theme-color: ${this.themeColor};}`:"")+":host([hidden]){display:none!important}"}static get observedAttributes(){return["shadow-root-mode","slottable","theme-color"]}attributeChangedCallback(t,e,s){if(Object.is(s,e))return;const o=r(t);let n=s;switch(typeof this[o]){case"boolean":n=null!==s&&"false"!==s;break;case"number":n=Number(s)}switch(this[o]=n,t){case"theme-color":{const t=u.get(this),e=this.$sharedStyle;t&&e&&(b?t.replaceSync(e):t.textContent=e);break}}}$propertyChangedCallback(t,e,o){if(!Object.is(o,e))switch(t=n(t),typeof o){case"boolean":!0===o?this.hasAttribute(t)||this.setAttribute(t,""):this.removeAttribute(t);break;case"number":o=s(o)?"":String(o);default:o?this.getAttribute(t)!==o&&this.setAttribute(t,o):this.removeAttribute(t)}}connectedCallback(){Object.getPrototypeOf(this).constructor.observedAttributes.forEach((t=>{const e=r(t);let s=this[e];(function(t){return void 0===t})(s)||this.$propertyChangedCallback(e,void 0,s),Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>s,set(t){const o=s;s=t,this.$propertyChangedCallback(e,o,t)}})}));const t=this.attachShadow({mode:this.shadowRootMode||h});if(this.shadowRoot||d.set(this,t),u.set(this,this.$addStyles(this.$sharedStyle)),this.$style&&this.$addStyles(this.$style),this.$template){const e=document.createElement("template");e.innerHTML=this.$template,t.appendChild(e.content)}if(this.slottable){const e=document.createElement("slot");t.appendChild(e)}}disconnectedCallback(){u.has(this)&&u.delete(this),d.has(this)&&d.delete(this)}$getTagNameOf(t){var e;return null!==(e=p.get(t))&&void 0!==e?e:t}$setStyles(t){return Object.keys(t).forEach((e=>{let o=t[e];(function(t){return"number"==typeof t&&!s(t)})(o)&&(o=0!==o&&l.test(e)?`${o}px`:String(o)),this.style[e]=o})),this}$getShadowRoot(){return this.shadowRoot||d.get(this)}$addStyles(t){let e;const s=this.$getShadowRoot();return b?(e=new CSSStyleSheet,e.replaceSync(t),s.adoptedStyleSheets=s.adoptedStyleSheets.concat(e)):(e=document.createElement("style"),e.textContent=t,s.appendChild(e)),e}$emit(t,e,s){return function(t,e,s,o){return t.dispatchEvent(new CustomEvent(e,Object.assign(Object.assign(Object.assign({},a),{detail:s}),o)))}(this,t,e,s)}$nextTick(t){return function(t,e){return e?c.then(t?e.bind(t):e):c}(this,t)}static $define(s,o){var i;"object"==typeof(i=s)&&null!==i&&(o=s,s=""),s||(s=this.$name||this.name),s=n(s),t&&e.customElements&&!e.customElements.get(s)&&customElements.define(s,this,o)}}return m.$version="2.0.0-beta.1",m})); |
@@ -240,4 +240,3 @@ (function (global, factory) { | ||
| name = utils.toKebabCase(name); | ||
| const { customElements } = utils.WINDOW; | ||
| if (utils.IS_BROWSER && customElements && !customElements.get(name)) { | ||
| if (utils.IS_BROWSER && utils.WINDOW.customElements && !utils.WINDOW.customElements.get(name)) { | ||
| customElements.define(name, this, options); | ||
@@ -247,3 +246,3 @@ } | ||
| } | ||
| CropperElement.$version = '2.0.0-beta'; | ||
| CropperElement.$version = '2.0.0-beta.1'; | ||
@@ -250,0 +249,0 @@ return CropperElement; |
+5
-3
| { | ||
| "name": "@cropper/element", | ||
| "version": "2.0.0-beta", | ||
| "version": "2.0.0-beta.1", | ||
| "description": "An abstract class for constructing Cropper elements.", | ||
@@ -8,2 +8,4 @@ "main": "dist/element.raw.js", | ||
| "types": "dist/element.d.ts", | ||
| "unpkg": "dist/element.js", | ||
| "jsdelivr": "dist/element.js", | ||
| "files": [ | ||
@@ -38,3 +40,3 @@ "dist" | ||
| "dependencies": { | ||
| "@cropper/utils": "^2.0.0-beta" | ||
| "@cropper/utils": "^2.0.0-beta.1" | ||
| }, | ||
@@ -45,3 +47,3 @@ "publishConfig": { | ||
| }, | ||
| "gitHead": "f13e2bdac88e0846a66e406c6122c8d70de43c15" | ||
| "gitHead": "f9b7e9fef403d95f5364d28481f185d95c6f6100" | ||
| } |
54868
-0.01%1223
-0.33%Updated