molybdenum update

This commit is contained in:
nugroho 2025-06-20 09:45:55 +07:00
parent f00906c12d
commit 30e4477d2f
2 changed files with 55 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/*!
* molybdenum v1.1.0 Companion CSS
* molybdenum v1.0.250619.1428 Companion CSS
* Copyright 2025 PT Nusa Angkasa Siber
* Released under the MIT License
*/
@ -195,7 +195,11 @@ background-screen, load-screen, dialog-screen
-webkit-user-select: none;
-webkit-user-drag: none;
}
load-screen:not(body>load-screen)
dialog-box load-screen
{
top: 2.5em;
}
load-screen:not(body>load-screen):not(dialog-box load-screen)
{
position: absolute;
}
@ -211,6 +215,8 @@ dialog-box
position: relative;
max-width: 90vw;
max-height: 90vh;
min-width: 25ch;
min-height: 10em;
width: max-content;
height: max-content;
background-color: var(--primary-background);
@ -219,7 +225,12 @@ dialog-box
padding: .5em;
transition: scale .25s;
scale: 0;
overflow: hidden;
}
/* dialog-box div:has(load-screen)
{
overflow-y: clip !important;
} */
dialog-title
{
display: grid;

View File

@ -1,14 +1,26 @@
/*!
* molybdenum v1.1.0
* molybdenum v1.0.250619.1428
* Copyright 2025 PT Nusa Angkasa Siber
* Released under the MIT License
*/
class molybdenum{
version = '1.1.0';
version = '1.0.250619.1428';
_alerts = [];
_confirms = [];
_loads = [];
_dialogs = [];
lastDialog()
{
return this._dialogs.at(-1);
}
lastLoadScreenId()
{
if(this._loads.length > 0)
{
return this._loads.at(-1).id;
}
return null;
}
newElement(name = "div", options = {}){
const ele = document.createElement(name);
options.style ? ele.style = options.style : null;
@ -596,7 +608,7 @@ class molybdenum{
}
Group = class extends HTMLElement
{
static observedAttributes = ["label", "type", "collapsed"];
static observedAttributes = ["label", "type", "collapsed", "disabled"];
constructor()
{
super();
@ -619,7 +631,7 @@ class molybdenum{
{
padding: .35em;
}
:host([type="box"][collapsed])
:host([type="box"][collapsed]), :host([type="box"][disabled])
{
padding: .32em;
}
@ -633,7 +645,7 @@ class molybdenum{
padding-left: .25ch;
padding-right: .25ch;
}
:host([collapsed]) group-content
:host([collapsed]) group-content, :host([disabled]) group-content
{
display: none;
}
@ -667,6 +679,7 @@ class molybdenum{
<group-label><a-button><span></span> <m-inline></m-inline></a-button></group-label>
<group-content><slot></slot></group-content>
`;
this._labelButton = $(this.shadowRoot).children("group-label").children("a-button");
this._labelText = $(this.shadowRoot).children("group-label").children("a-button").children("span");
this._labelIcon = $(this.shadowRoot).children("group-label").children("a-button").children("m-inline");
}
@ -688,7 +701,7 @@ class molybdenum{
{
$(this.shadowRoot).children("group-label").children("a-button").children("m-inline").text("expand_less");
}
$(this.shadowRoot).children("group-label").children("a-button").click(()=>
this._labelButton.click(()=>
{
this.collapsed = !this.collapsed;
});
@ -721,6 +734,19 @@ class molybdenum{
this._labelIcon.text("expand_less");
}
}
else if (name === "disabled")
{
if (this.disabled)
{
this._labelIcon.text("expand_more");
this._labelButton.prop("disabled",true);
}
else
{
this._labelIcon.text("expand_less");
this._labelButton.prop("disabled",false);
}
}
}
get collapsed() {
return this.hasAttribute("collapsed");
@ -732,6 +758,16 @@ class molybdenum{
this.removeAttribute("collapsed");
}
}
get disabled() {
return this.hasAttribute("disabled");
}
set disabled(value) {
if (value) {
this.setAttribute("disabled", "");
} else {
this.removeAttribute("disabled");
}
}
get label() {
return this.getAttribute("label");
}