diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 4bb5031..c56a2d7 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -4,6 +4,8 @@ on: push jobs: build: runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.56.1-noble steps: - uses: actions/checkout@v2 - name: Use Node.js 18.x diff --git a/custom-elements.json b/custom-elements.json index b72b006..9a61c69 100644 --- a/custom-elements.json +++ b/custom-elements.json @@ -9,11 +9,11 @@ { "kind": "variable", "name": "ImageCropElement", - "default": "class extends HTMLElement {\n static define(tag = \"image-crop\", registry = customElements) {\n registry.define(tag, this);\n return this;\n }\n connectedCallback() {\n if (constructedElements.has(this))\n return;\n const shadowRoot = this.attachShadow({ mode: \"open\" });\n shadowRoot.innerHTML = `\n\n\n
\n \"\"\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n`;\n const box = shadowRoot.querySelector(\"[data-crop-box]\");\n if (!(box instanceof HTMLElement))\n return;\n const image = shadowRoot.querySelector(\"img\");\n if (!(image instanceof HTMLImageElement))\n return;\n constructedElements.set(this, { box, image });\n image.addEventListener(\"load\", () => {\n this.loaded = true;\n setInitialPosition(this);\n });\n this.addEventListener(\"mouseleave\", stopUpdate);\n this.addEventListener(\"touchend\", stopUpdate);\n this.addEventListener(\"mouseup\", stopUpdate);\n box.addEventListener(\"mousedown\", startUpdate);\n box.addEventListener(\"touchstart\", startUpdate, { passive: true });\n this.addEventListener(\"keydown\", moveCropArea);\n this.addEventListener(\"keydown\", updateCropArea);\n if (this.src)\n image.src = this.src;\n }\n static get observedAttributes() {\n return [\"src\"];\n }\n get src() {\n return this.getAttribute(\"src\");\n }\n set src(val) {\n if (val) {\n this.setAttribute(\"src\", val);\n } else {\n this.removeAttribute(\"src\");\n }\n }\n get loaded() {\n return this.hasAttribute(\"loaded\");\n }\n set loaded(val) {\n if (val) {\n this.setAttribute(\"loaded\", \"\");\n } else {\n this.removeAttribute(\"loaded\");\n }\n }\n attributeChangedCallback(attribute, oldValue, newValue) {\n const { image } = constructedElements.get(this) || {};\n if (attribute === \"src\") {\n this.loaded = false;\n if (image)\n image.src = newValue;\n }\n }\n}" + "default": "class extends HTMLElement {\n static" }, { "kind": "variable", - "name": "dist_default", + "name": "index_default", "default": "ImageCropElement" } ], @@ -30,7 +30,7 @@ "kind": "js", "name": "default", "declaration": { - "name": "dist_default", + "name": "index_default", "module": "dist/bundle.js" } }