@dbp-toolkit/common
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -1,2 +0,2 @@ | ||
import { d as defineCustomElement, M as MiniSpinner, b as Spinner, I as Icon, B as Button, L as LoadingButton, c as InlineNotification, T as Translated } from './shared/translated.731f5b1b.es.js'; | ||
import { d as defineCustomElement, M as MiniSpinner, b as Spinner, I as Icon, B as Button, L as LoadingButton, c as InlineNotification, T as Translated } from './shared/translated.6edc1a72.es.js'; | ||
@@ -3,0 +3,0 @@ defineCustomElement('dbp-mini-spinner', MiniSpinner); |
{ | ||
"name": "@dbp-toolkit/common", | ||
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/common", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"module": "index.js", | ||
@@ -14,8 +14,8 @@ "license": "LGPL-2.1-or-later", | ||
"@esm-bundle/chai": "^4.2.0", | ||
"@rollup/plugin-commonjs": "^21.0.0", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"eslint": "^8.0.0", | ||
"eslint-plugin-jsdoc": "^38.0.0", | ||
"i18next-scanner": "^3.0.0", | ||
"eslint-plugin-jsdoc": "^39.0.0", | ||
"i18next-parser": "^6.3.0", | ||
"karma": "^6.0.0", | ||
@@ -34,3 +34,3 @@ "karma-chrome-launcher": "^3.0.0", | ||
"scripts": { | ||
"i18next": "i18next-scanner", | ||
"i18next": "i18next", | ||
"format": "yarn run format:eslint && yarn run format:prettier", | ||
@@ -47,7 +47,7 @@ "format:eslint": "eslint \"**/*.{js,ts}\" --fix", | ||
"dependencies": { | ||
"@open-wc/scoped-elements": "^2.0.0", | ||
"@open-wc/scoped-elements": "^2.1.0", | ||
"i18next": "^21.4.2", | ||
"lit": "^2.0.0" | ||
}, | ||
"gitHead": "3448c09391a1b4eeea4c2f6e1f31db3627616e87" | ||
"gitHead": "212ad03edd177dd07272d12bdc97e24db44b42f5" | ||
} |
@@ -23,2 +23,13 @@ import {html, LitElement, css} from 'lit'; | ||
this.disabled = false; | ||
// https://bugs.chromium.org/p/chromium/issues/detail?id=1061240#c12 | ||
this.addEventListener('click', (e) => { | ||
if (this.disabled) { | ||
e.stopImmediatePropagation(); | ||
} | ||
if (!this.noSpinnerOnClick) { | ||
this.start(); | ||
} | ||
}); | ||
} | ||
@@ -46,8 +57,2 @@ | ||
clickHandler() { | ||
if (!this.noSpinnerOnClick) { | ||
this.start(); | ||
} | ||
} | ||
start() { | ||
@@ -82,3 +87,2 @@ this.spinner = true; | ||
<button | ||
@click="${this.clickHandler}" | ||
class="button ${this.type}" | ||
@@ -85,0 +89,0 @@ ?disabled="${this.disabled}"> |
{ | ||
"error": { | ||
"summary": "Ein Fehler ist aufgetreten", | ||
"connection-to-server-refused": "Verbindungs zum Server verweigert!" | ||
"connection-to-server-refused": "Verbindungs zum Server verweigert!", | ||
"summary": "Ein Fehler ist aufgetreten" | ||
}, | ||
"jsonld": { | ||
"api-documentation-server": "Verbindung zum apiDocumentation API Server {{apiDocUrl}} fehlgeschlagen!", | ||
"error-api-server": "Verbindung zum API Server {{apiUrl}} fehlgeschlagen!", | ||
"error-hydra-documentation-url-not-set": "Hydra apiDocumentation URL wurden für server {{apiUrl}} nicht gesetzt!", | ||
"api-documentation-server": "Verbindung zum apiDocumentation API Server {{apiDocUrl}} fehlgeschlagen!" | ||
"error-hydra-documentation-url-not-set": "Hydra apiDocumentation URL wurden für server {{apiUrl}} nicht gesetzt!" | ||
} | ||
} |
{ | ||
"error": { | ||
"summary": "An error occurred", | ||
"connection-to-server-refused": "Connection to server refused!" | ||
"connection-to-server-refused": "Connection to server refused!", | ||
"summary": "An error occurred" | ||
}, | ||
"jsonld": { | ||
"api-documentation-server": "Connection to apiDocumentation server {{apiDocUrl}} failed!", | ||
"error-api-server": "Connection to api server {{apiUrl}} failed!", | ||
"error-hydra-documentation-url-not-set": "Hydra apiDocumentation url was not set for server {{apiUrl}}!", | ||
"api-documentation-server": "Connection to apiDocumentation server {{apiDocUrl}} failed!" | ||
"error-hydra-documentation-url-not-set": "Hydra apiDocumentation url was not set for server {{apiUrl}}!" | ||
} | ||
} |
@@ -17,22 +17,2 @@ /** | ||
return new URL(addedURL.replace(/^\/+/, ''), baseURL).href; | ||
}; | ||
/** | ||
* Returns a Document like thing that can be used to create elements. | ||
* | ||
* It provides createElement()/createElementNS()/importNode(). | ||
* The Document type annotation, while not correct, is used here for simplicity. | ||
* | ||
* https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Scoped-Custom-Element-Registries.md#scoped-element-creation-apis | ||
* | ||
* @param {HTMLElement} element | ||
* @returns {Document|null} | ||
*/ | ||
export function getShadowRootDocument(element) { | ||
// In case the polyfill is loaded return the shadowRoot | ||
// otherwise fall back to the global document | ||
if (ShadowRoot.prototype.createElement !== undefined) { | ||
return element.shadowRoot; | ||
} | ||
return document; | ||
} | ||
}; |
import {expect, assert} from '@esm-bundle/chai'; | ||
import * as utils from '../utils'; | ||
import * as styles from '../styles'; | ||
import {combineURLs, getShadowRootDocument} from '../'; | ||
import {combineURLs} from '../'; | ||
import '../jsonld.js'; | ||
@@ -37,12 +37,2 @@ | ||
test('getShadowRootDocument', () => { | ||
class SomeElement3 extends HTMLElement {} | ||
let res = utils.defineCustomElement('test-some-element-3', SomeElement3); | ||
assert.isTrue(res); | ||
let elm = new SomeElement3(); | ||
elm.attachShadow({mode: 'open'}); | ||
let doc = getShadowRootDocument(elm); | ||
assert.isFunction(doc.createElement); | ||
}); | ||
test('getAssetURL', () => { | ||
@@ -49,0 +39,0 @@ // Backwards compat |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1961139
9115