From ed719624be3a0635d8c3d5b83fe80cd124a1e20e Mon Sep 17 00:00:00 2001 From: Keith Cirkel Date: Fri, 16 Jun 2023 10:25:15 +0100 Subject: [PATCH] add customelements manifest --- custom-elements.json | 476 +++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 477 insertions(+), 1 deletion(-) create mode 100644 custom-elements.json diff --git a/custom-elements.json b/custom-elements.json new file mode 100644 index 0000000..a6143cf --- /dev/null +++ b/custom-elements.json @@ -0,0 +1,476 @@ +{ + "schemaVersion": "1.0.0", + "readme": "", + "modules": [ + { + "kind": "javascript-module", + "path": "dist/bundle.js", + "declarations": [ + { + "kind": "variable", + "name": "IncludeFragmentElement", + "default": "class extends HTMLElement {\n constructor() {\n super(...arguments);\n _IncludeFragmentElement_instances.add(this);\n _IncludeFragmentElement_busy.set(this, false);\n _IncludeFragmentElement_observer.set(this, new IntersectionObserver((entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n const { target } = entry;\n __classPrivateFieldGet(this, _IncludeFragmentElement_observer, \"f\").unobserve(target);\n if (!(target instanceof IncludeFragmentElement))\n return;\n if (target.loading === \"lazy\") {\n __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_handleData).call(this);\n }\n }\n }\n }, {\n rootMargin: \"0px 0px 256px 0px\",\n threshold: 0.01\n }));\n }\n static define(tag = \"include-fragment\", registry = customElements) {\n registry.define(tag, this);\n return this;\n }\n static setCSPTrustedTypesPolicy(policy) {\n cspTrustedTypesPolicyPromise = policy === null ? policy : Promise.resolve(policy);\n }\n static get observedAttributes() {\n return [\"src\", \"loading\"];\n }\n get src() {\n const src = this.getAttribute(\"src\");\n if (src) {\n const link = this.ownerDocument.createElement(\"a\");\n link.href = src;\n return link.href;\n } else {\n return \"\";\n }\n }\n set src(val) {\n this.setAttribute(\"src\", val);\n }\n get loading() {\n if (this.getAttribute(\"loading\") === \"lazy\")\n return \"lazy\";\n return \"eager\";\n }\n set loading(value) {\n this.setAttribute(\"loading\", value);\n }\n get accept() {\n return this.getAttribute(\"accept\") || \"\";\n }\n set accept(val) {\n this.setAttribute(\"accept\", val);\n }\n get data() {\n return __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_getStringOrErrorData).call(this);\n }\n attributeChangedCallback(attribute, oldVal) {\n if (attribute === \"src\") {\n if (this.isConnected && this.loading === \"eager\") {\n __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_handleData).call(this);\n }\n } else if (attribute === \"loading\") {\n if (this.isConnected && oldVal !== \"eager\" && this.loading === \"eager\") {\n __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_handleData).call(this);\n }\n }\n }\n connectedCallback() {\n if (!this.shadowRoot) {\n this.attachShadow({ mode: \"open\" });\n const style = document.createElement(\"style\");\n style.textContent = `:host {display: block;}`;\n this.shadowRoot.append(style, document.createElement(\"slot\"));\n }\n if (this.src && this.loading === \"eager\") {\n __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_handleData).call(this);\n }\n if (this.loading === \"lazy\") {\n __classPrivateFieldGet(this, _IncludeFragmentElement_observer, \"f\").observe(this);\n }\n }\n request() {\n const src = this.src;\n if (!src) {\n throw new Error(\"missing src\");\n }\n return new Request(src, {\n method: \"GET\",\n credentials: \"same-origin\",\n headers: {\n Accept: this.accept || \"text/html\"\n }\n });\n }\n load() {\n return __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_getStringOrErrorData).call(this);\n }\n fetch(request) {\n return fetch(request);\n }\n refetch() {\n privateData.delete(this);\n __classPrivateFieldGet(this, _IncludeFragmentElement_instances, \"m\", _IncludeFragmentElement_handleData).call(this);\n }\n}" + }, + { + "kind": "variable", + "name": "dist_default", + "default": "IncludeFragmentElement" + } + ], + "exports": [ + { + "kind": "js", + "name": "IncludeFragmentElement", + "declaration": { + "name": "IncludeFragmentElement", + "module": "dist/bundle.js" + } + }, + { + "kind": "js", + "name": "default", + "declaration": { + "name": "dist_default", + "module": "dist/bundle.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "dist/include-fragment-element-define.js", + "declarations": [], + "exports": [ + { + "kind": "js", + "name": "default", + "declaration": { + "name": "IncludeFragmentElement", + "module": "dist/include-fragment-element-define.js" + } + }, + { + "kind": "js", + "name": "*", + "declaration": { + "name": "*", + "package": "./include-fragment-element.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "dist/include-fragment-element.js", + "declarations": [ + { + "kind": "class", + "description": "", + "name": "IncludeFragmentElement", + "members": [ + { + "kind": "method", + "name": "define", + "static": true, + "parameters": [ + { + "name": "tag", + "default": "'include-fragment'" + }, + { + "name": "registry", + "default": "customElements" + } + ] + }, + { + "kind": "method", + "name": "setCSPTrustedTypesPolicy", + "static": true, + "parameters": [ + { + "name": "policy" + } + ] + }, + { + "kind": "field", + "name": "src" + }, + { + "kind": "field", + "name": "loading" + }, + { + "kind": "field", + "name": "accept" + }, + { + "kind": "field", + "name": "data", + "readonly": true + }, + { + "kind": "method", + "name": "request" + }, + { + "kind": "method", + "name": "load" + }, + { + "kind": "method", + "name": "fetch", + "parameters": [ + { + "name": "request" + } + ] + }, + { + "kind": "method", + "name": "refetch" + } + ], + "attributes": [ + { + "name": "src" + }, + { + "name": "loading" + } + ], + "superclass": { + "name": "HTMLElement" + }, + "customElement": true + } + ], + "exports": [ + { + "kind": "js", + "name": "IncludeFragmentElement", + "declaration": { + "name": "IncludeFragmentElement", + "module": "dist/include-fragment-element.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "dist/index.js", + "declarations": [], + "exports": [ + { + "kind": "js", + "name": "IncludeFragmentElement", + "declaration": { + "name": "IncludeFragmentElement", + "module": "dist/index.js" + } + }, + { + "kind": "js", + "name": "default", + "declaration": { + "name": "IncludeFragmentElement", + "module": "dist/index.js" + } + }, + { + "kind": "js", + "name": "*", + "declaration": { + "name": "*", + "package": "./include-fragment-element-define.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "test/test.js", + "declarations": [], + "exports": [] + }, + { + "kind": "javascript-module", + "path": "src/include-fragment-element-define.ts", + "declarations": [], + "exports": [ + { + "kind": "js", + "name": "default", + "declaration": { + "name": "IncludeFragmentElement", + "module": "src/include-fragment-element-define.ts" + } + }, + { + "kind": "js", + "name": "*", + "declaration": { + "name": "*", + "package": "./include-fragment-element.js" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "src/include-fragment-element.ts", + "declarations": [ + { + "kind": "class", + "description": "", + "name": "IncludeFragmentElement", + "members": [ + { + "kind": "method", + "name": "define", + "static": true, + "parameters": [ + { + "name": "tag", + "default": "'include-fragment'" + }, + { + "name": "registry", + "default": "customElements" + } + ] + }, + { + "kind": "method", + "name": "setCSPTrustedTypesPolicy", + "static": true, + "return": { + "type": { + "text": "void" + } + }, + "parameters": [ + { + "name": "policy", + "type": { + "text": "CSPTrustedTypesPolicy | Promise | null" + } + } + ] + }, + { + "kind": "field", + "name": "src", + "type": { + "text": "string" + } + }, + { + "kind": "field", + "name": "loading", + "type": { + "text": "'eager' | 'lazy'" + } + }, + { + "kind": "field", + "name": "accept", + "type": { + "text": "string" + } + }, + { + "kind": "field", + "name": "data", + "type": { + "text": "Promise" + }, + "readonly": true + }, + { + "kind": "field", + "name": "#busy", + "privacy": "private", + "type": { + "text": "boolean" + }, + "default": "false" + }, + { + "kind": "method", + "name": "request", + "return": { + "type": { + "text": "Request" + } + } + }, + { + "kind": "method", + "name": "load", + "return": { + "type": { + "text": "Promise" + } + } + }, + { + "kind": "method", + "name": "fetch", + "return": { + "type": { + "text": "Promise" + } + }, + "parameters": [ + { + "name": "request", + "type": { + "text": "RequestInfo" + } + } + ] + }, + { + "kind": "method", + "name": "refetch" + }, + { + "kind": "field", + "name": "#observer", + "privacy": "private", + "default": "new IntersectionObserver(\n entries => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n const {target} = entry\n this.#observer.unobserve(target)\n if (!(target instanceof IncludeFragmentElement)) return\n if (target.loading === 'lazy') {\n this.#handleData()\n }\n }\n }\n },\n {\n // Currently the threshold is set to 256px from the bottom of the viewport\n // with a threshold of 0.1. This means the element will not load until about\n // 2 keyboard-down-arrow presses away from being visible in the viewport,\n // giving us some time to fetch it before the contents are made visible\n rootMargin: '0px 0px 256px 0px',\n threshold: 0.01,\n },\n )" + }, + { + "kind": "method", + "name": "#handleData", + "return": { + "type": { + "text": "Promise" + } + } + }, + { + "kind": "method", + "name": "#getData", + "return": { + "type": { + "text": "Promise" + } + } + }, + { + "kind": "method", + "name": "#getStringOrErrorData", + "return": { + "type": { + "text": "Promise" + } + } + }, + { + "kind": "method", + "name": "#task", + "return": { + "type": { + "text": "Promise" + } + }, + "parameters": [ + { + "name": "eventsToDispatch", + "type": { + "text": "string[]" + } + } + ] + }, + { + "kind": "method", + "name": "#fetchDataWithEvents", + "return": { + "type": { + "text": "Promise" + } + } + } + ], + "events": [ + { + "name": "include-fragment-replace", + "type": { + "text": "CustomEvent" + } + }, + { + "name": "include-fragment-replaced", + "type": { + "text": "CustomEvent" + } + }, + { + "name": "eventType", + "type": { + "text": "Event" + } + } + ], + "attributes": [ + { + "name": "src" + }, + { + "name": "loading" + } + ], + "superclass": { + "name": "HTMLElement" + }, + "customElement": true + } + ], + "exports": [ + { + "kind": "js", + "name": "IncludeFragmentElement", + "declaration": { + "name": "IncludeFragmentElement", + "module": "src/include-fragment-element.ts" + } + } + ] + }, + { + "kind": "javascript-module", + "path": "src/index.ts", + "declarations": [], + "exports": [ + { + "kind": "js", + "name": "IncludeFragmentElement", + "declaration": { + "name": "IncludeFragmentElement", + "module": "src/index.ts" + } + }, + { + "kind": "js", + "name": "default", + "declaration": { + "name": "IncludeFragmentElement", + "module": "src/index.ts" + } + }, + { + "kind": "js", + "name": "*", + "declaration": { + "name": "*", + "package": "./include-fragment-element-define.js" + } + } + ] + } + ] +} diff --git a/package.json b/package.json index 8108a23..99d1798 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "pretest": "npm run build", "test": "web-test-runner", "postpublish": "npm publish --ignore-scripts --@github:registry='https://npm.pkg.github.com'", - "manifest": "custom-elements-manifest analize" + "manifest": "custom-elements-manifest analyze" }, "prettier": "@github/prettier-config", "devDependencies": {