@devprotocol/hashi
Advanced tools
Comparing version 2.1.1 to 2.2.0
@@ -1,28 +0,32 @@ | ||
/* | ||
* Copyright (c) 2022 Dev Protocol | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/// | ||
// Copyright (c) 2023 Dev Protocol | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
/// | ||
export class HSComponentBase { | ||
protected HS_TARGET_COMPONENT: Element | HTMLElement | null; | ||
protected HS_TARGET_COMPONENT: any; | ||
constructor(targetComponent: Element | HTMLElement | null) { | ||
constructor(targetComponent: any) { | ||
if (!targetComponent) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
this.HS_TARGET_COMPONENT = targetComponent; | ||
@@ -32,18 +36,38 @@ } | ||
protected addClass(className: string): void { | ||
this.HS_TARGET_COMPONENT?.classList.add(className); | ||
if (!this.HS_TARGET_COMPONENT) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
this.HS_TARGET_COMPONENT.classList.add(className); | ||
} | ||
protected removeClass(className: string): void { | ||
this.HS_TARGET_COMPONENT?.classList.remove(className); | ||
if (!this.HS_TARGET_COMPONENT) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
this.HS_TARGET_COMPONENT.classList.remove(className); | ||
} | ||
protected hasClass(className: string): boolean { | ||
return this.HS_TARGET_COMPONENT?.classList.contains(className) ?? false; | ||
protected hasClass(className: string): boolean|undefined { | ||
if (!this.HS_TARGET_COMPONENT) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
return this.HS_TARGET_COMPONENT.classList.contains(className); | ||
} | ||
protected getClasses(): DOMTokenList|undefined { | ||
return this.HS_TARGET_COMPONENT?.classList; | ||
if (!this.HS_TARGET_COMPONENT) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
return this.HS_TARGET_COMPONENT.classList; | ||
} | ||
protected getComponent(): Element|HTMLElement|null { | ||
protected getComponent(): Element|HTMLElement|undefined { | ||
if (!this.HS_TARGET_COMPONENT) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
return this.HS_TARGET_COMPONENT; | ||
@@ -53,5 +77,9 @@ } | ||
protected getId(): string|undefined { | ||
return this.HS_TARGET_COMPONENT?.id; | ||
if (!this.HS_TARGET_COMPONENT) { | ||
console.error(`HSComponentBase: the target component is not found.`); | ||
return; | ||
} | ||
return this.HS_TARGET_COMPONENT.id; | ||
} | ||
} |
@@ -1,22 +0,22 @@ | ||
/* | ||
* Copyright (c) 2022 Dev Protocol | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/// | ||
// Copyright (c) 2023 Dev Protocol | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
/// | ||
@@ -32,4 +32,4 @@ import { HSComponentBase } from '../hs-core/component'; | ||
constructor(targetDialog: string) { | ||
super(document.querySelector(targetDialog)); | ||
constructor(targetDialog: HTMLDialogElement) { | ||
super(targetDialog); | ||
} | ||
@@ -45,2 +45,12 @@ | ||
// nativeOpen(): void { | ||
// if (!this.getComponent()) { | ||
// console.error(`HSDialog: the component is not found.`); | ||
// return; | ||
// } | ||
// this.getComponent().show(); | ||
// this.isOpen = true; | ||
// this.isClosed = false; | ||
// } | ||
close(): void { | ||
@@ -54,2 +64,12 @@ if (this.isOpen) { | ||
// nativeClose(): void { | ||
// if (!this.getComponent()) { | ||
// console.error(`HSDialog: the component is not found.`); | ||
// return; | ||
// } | ||
// this.getComponent().removeAttribute('open'); | ||
// this.isOpen = false; | ||
// this.isClosed = true; | ||
// } | ||
} |
{ | ||
"name": "@devprotocol/hashi", | ||
"version": "2.1.1", | ||
"version": "2.2.0", | ||
"description": "Dev Protocol's design system implementation for the web.", | ||
@@ -5,0 +5,0 @@ "main": "./_index.scss", |
/* | ||
* | ||
* Copyright (c) 2023 Dev Protocol | ||
@@ -22,3 +21,2 @@ * | ||
* SOFTWARE. | ||
* | ||
*/ | ||
@@ -25,0 +23,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
2513051
102
10627