From 1167a8baaba021c1372e78fc5d0a50b2937935c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 02:19:11 +0800 Subject: [PATCH 01/14] refactor: enforce strict types and enhance attributes in CardPrimaryAction component --- src/Components/CardPrimaryAction.php | 7 ++++++- src/assets/src/main.ts | 21 --------------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/Components/CardPrimaryAction.php b/src/Components/CardPrimaryAction.php index 7bd6a6a..a0e7ff0 100644 --- a/src/Components/CardPrimaryAction.php +++ b/src/Components/CardPrimaryAction.php @@ -1,5 +1,7 @@ merge(['tabindex' => 0]); + $attributes = $attributes->merge([ + 'tabindex' => 0, + 'data-mdc-auto-init' => 'MDCRipple', + ]); return $attributes->class([ 'mdc-card__primary-action', diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 49c2183..ea12398 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -79,26 +79,6 @@ function initMenus() { }) } -// function initCards() { -// document -// .querySelectorAll('.mdc-card__action-buttons button') -// .forEach(el => { -// el.classList.add('mdc-card__action', 'mdc-card__action--button') -// }) - -// document -// .querySelectorAll( -// '.mdc-card__action-icons button, .mdc-card__action-icons a', -// ) -// .forEach(el => { -// el.classList.add('mdc-card__action', 'mdc-card__action--icon') -// }) - -// document.querySelectorAll('.mdc-card__primary-action').forEach(el => { -// mdc.ripple.MDCRipple.attachTo(el) -// }) -// } - // function initCheckBoxes() { // document.querySelectorAll('.mdc-checkbox').forEach(el => { // const checkbox = new mdc.checkbox.MDCCheckbox(el) @@ -194,7 +174,6 @@ function initMenus() { // document.addEventListener('DOMContentLoaded', () => { // initBanners() // initButtons() -// initCards() // initCheckBoxes() // initChipSets() // initCircularProgresses() From 38dd4156c40c149d16437aade613c56b9cb60924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 02:25:44 +0800 Subject: [PATCH 02/14] refactor: update Tooltip component to enforce strict types and improve attribute handling --- src/Components/Tooltip.php | 21 ++++++++++++++++----- src/assets/src/main.ts | 7 ------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Components/Tooltip.php b/src/Components/Tooltip.php index 8eb6d5e..a1f8cc1 100644 --- a/src/Components/Tooltip.php +++ b/src/Components/Tooltip.php @@ -1,17 +1,25 @@ 'MDCTooltip', + ]; + if ($this->isPersistent) { - $attributes = $attributes->merge([ - 'tabindex' => -1, - 'data-mdc-tooltip-persistent' => 'true', - ]); + $mergeAttributes['tabindex'] = -1; + $mergeAttributes['data-mdc-tooltip-persistent'] = 'true'; } return $attributes->class([ 'mdc-tooltip', ])->merge([ + ...$mergeAttributes, 'id' => $this->id, 'role' => $attributes->prepends($this->isPersistent ? 'dialog' : 'tooltip'), 'aria-hidden' => $attributes->prepends('true'), diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index ea12398..21b99d2 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -165,12 +165,6 @@ function initMenus() { // }) // } -// function initTooltips() { -// document.querySelectorAll('.mdc-tooltip').forEach(el => { -// el.MBC = new mdc.tooltip.MDCTooltip(el) -// }) -// } - // document.addEventListener('DOMContentLoaded', () => { // initBanners() // initButtons() @@ -184,5 +178,4 @@ function initMenus() { // initSnackbars() // initSwitches() // initTabBars() -// initTooltips() // }) From 24da734c9ce361fe23c41ef9361b8bf9b388aad0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 02:35:03 +0800 Subject: [PATCH 03/14] refactor: enhance Checkbox component with strict types and improved attribute handling --- src/Components/Checkbox.php | 16 ++++++++++++++++ src/assets/src/main.ts | 9 --------- src/views/components/checkbox.blade.php | 8 +++----- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/Components/Checkbox.php b/src/Components/Checkbox.php index b061cf0..8698d84 100644 --- a/src/Components/Checkbox.php +++ b/src/Components/Checkbox.php @@ -1,10 +1,18 @@ 'mdc-checkbox '.($attributes->has('disabled') ? 'mdc-checkbox--disabled' : ''), + 'data-mdc-auto-init' => 'MDCCheckbox', + ]; + } + public function attributesPreprocess(ComponentAttributeBag $attributes) { $attributes = $attributes->merge(['type' => 'checkbox']); diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 21b99d2..4507882 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -79,14 +79,6 @@ function initMenus() { }) } -// function initCheckBoxes() { -// document.querySelectorAll('.mdc-checkbox').forEach(el => { -// const checkbox = new mdc.checkbox.MDCCheckbox(el) -// const formField = new mdc.formField.MDCFormField(el.parentElement) -// formField.input = checkbox -// }) -// } - // function initChipSets() { // document.querySelectorAll('.mdc-chip-set').forEach(el => { // el.MDCChipSet = new mdc.chips.MDCChipSet(el) @@ -168,7 +160,6 @@ function initMenus() { // document.addEventListener('DOMContentLoaded', () => { // initBanners() // initButtons() -// initCheckBoxes() // initChipSets() // initCircularProgresses() // initDataTables() diff --git a/src/views/components/checkbox.blade.php b/src/views/components/checkbox.blade.php index db17a4e..3c0a61b 100644 --- a/src/views/components/checkbox.blade.php +++ b/src/views/components/checkbox.blade.php @@ -1,7 +1,5 @@ -
-
+
+
$value) {{ $key }}="{{ $value }}" @endforeach>
@@ -14,4 +12,4 @@
-
+
\ No newline at end of file From 9faf43c8d271b2f05c6ead9001a1a8845530ccf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 02:36:50 +0800 Subject: [PATCH 04/14] refactor: rename initBanners to autoOpenBanner for clarity and update documentation --- src/assets/src/main.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 4507882..09c477b 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -11,16 +11,16 @@ document.addEventListener('DOMContentLoaded', () => { autoInit() initIconButtons() - initBanners() + autoOpenBanner() initDialogs() initMenus() }) }) /** - * Initialize all banners + * Auto open all banners with the `mbc-banner--open` class */ -function initBanners() { +function autoOpenBanner() { document.querySelectorAll('.mdc-banner').forEach(bannerEl => { const typedBannerEl = bannerEl as HTMLDivElement & { MDCBanner: MDCBanner @@ -158,7 +158,6 @@ function initMenus() { // } // document.addEventListener('DOMContentLoaded', () => { -// initBanners() // initButtons() // initChipSets() // initCircularProgresses() From c9800073f7ebe1c8d1042f5381c523fbc061448c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 02:40:14 +0800 Subject: [PATCH 05/14] refactor: enhance TabBar component with strict types and improve attribute handling --- src/Components/TabBar.php | 17 +++++++++++++++-- src/assets/src/main.ts | 7 ------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Components/TabBar.php b/src/Components/TabBar.php index 31ed160..d54a82c 100644 --- a/src/Components/TabBar.php +++ b/src/Components/TabBar.php @@ -1,11 +1,19 @@ 'MDCTabBar', + 'role' => 'tablist', + ]; + if ($this->color !== 'initial') { - $attributes = $attributes->merge(['style' => $attributes->prepends('background-color: '.Helper::getColor($this->color))]); + $mergeAttributes['style'] = $attributes->prepends('background-color: '.Helper::getColor($this->color)); } - $attributes = $attributes->merge(['role' => 'tablist']); + $attributes = $attributes->merge($mergeAttributes); return $attributes->class([ 'mdc-tab-bar', diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 09c477b..2d64bf1 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -151,12 +151,6 @@ function initMenus() { // }) // } -// function initTabBars() { -// document.querySelectorAll('.mdc-tab-bar').forEach(el => { -// el.MDCTabBar = new mdc.tabBar.MDCTabBar(el) -// }) -// } - // document.addEventListener('DOMContentLoaded', () => { // initButtons() // initChipSets() @@ -167,5 +161,4 @@ function initMenus() { // initLinearProgresses() // initSnackbars() // initSwitches() -// initTabBars() // }) From c76ad9cd029e8acdf9473689fe363310f8654848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 02:45:30 +0800 Subject: [PATCH 06/14] refactor: enforce strict types and improve attribute handling in SwitchToggle component --- src/Components/SwitchToggle.php | 17 ++++++++++++++--- src/assets/src/main.ts | 7 ------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Components/SwitchToggle.php b/src/Components/SwitchToggle.php index 29adffc..2fd664a 100644 --- a/src/Components/SwitchToggle.php +++ b/src/Components/SwitchToggle.php @@ -1,11 +1,19 @@ merge([ + $mergeAttributes = [ + 'data-mdc-auto-init' => 'MDCSwitch', 'type' => 'button', 'role' => 'switch', 'aria-checked' => $this->isOn, - ]); + ]; if ($this->color !== 'primary') { - $attributes = $attributes->merge(['style' => $attributes->prepends('--mdc-theme-primary: '.Helper::getColor($this->color))]); + $mergeAttributes['style'] = $attributes->prepends('--mdc-theme-primary: '.Helper::getColor($this->color)); } + $attributes = $attributes->merge($mergeAttributes); + return $attributes->class([ 'mdc-switch', 'mdc-switch--'.($this->isOn ? 'selected' : 'unselected'), diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 2d64bf1..30401b6 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -145,12 +145,6 @@ function initMenus() { // }) // } -// function initSwitches() { -// document.querySelectorAll('.mdc-switch').forEach(el => { -// el.MDCSwitch = new mdc.switchControl.MDCSwitch(el) -// }) -// } - // document.addEventListener('DOMContentLoaded', () => { // initButtons() // initChipSets() @@ -160,5 +154,4 @@ function initMenus() { // initIconButtons() // initLinearProgresses() // initSnackbars() -// initSwitches() // }) From b78876abe9992ad5089f7afb30968b8e138cab14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 09:14:15 +0800 Subject: [PATCH 07/14] refactor: enforce strict types and improve Snackbar component handling --- src/Components/Snackbar.php | 14 +++++++++++++- src/assets/src/main.ts | 30 ++++++++++++++++++------------ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/Components/Snackbar.php b/src/Components/Snackbar.php index bbc48f8..b94e2c5 100644 --- a/src/Components/Snackbar.php +++ b/src/Components/Snackbar.php @@ -1,11 +1,19 @@ message && $slot->isEmpty()) { throw new \Exception('Please fill the "message" attribute or the component slot', 1); @@ -44,6 +52,10 @@ public function validateComponent(HtmlString $slot) public function attributesPreprocess(ComponentAttributeBag $attributes) { + $attributes = $attributes->merge([ + 'data-mdc-auto-init' => 'MDCSnackbar', + ]); + return $attributes->class([ 'mdc-snackbar', "mdc-snackbar--$this->variant" => $this->variant !== 'default', diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 30401b6..4e12a06 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -2,6 +2,7 @@ import './main.scss' import { MDCBanner } from '@material/banner' import { MDCDialog } from '@material/dialog' +import type { MDCSnackbar } from '@material/snackbar' import { MDCIconButtonToggle } from '@material/icon-button' import { MDCMenu } from '@material/menu' import { MDCRipple } from '@material/ripple' @@ -14,6 +15,7 @@ document.addEventListener('DOMContentLoaded', () => { autoOpenBanner() initDialogs() initMenus() + initSnackbars() }) }) @@ -131,19 +133,24 @@ function initMenus() { // }) // } -// function initSnackbars() { -// document.querySelectorAll('.mdc-snackbar').forEach(el => { -// el.MDCSnackbar = new mdc.snackbar.MDCSnackbar(el) +function initSnackbars() { + document.querySelectorAll('.mdc-snackbar').forEach(el => { + const typedEl = el as HTMLDivElement & { + MDCSnackbar: MDCSnackbar + } -// if (el.hasAttribute('timeout')) { -// el.MDCSnackbar.foundation.setTimeoutMs(el.getAttribute('timeout')) -// } + if (el.hasAttribute('timeout')) { + const timeoutValue = el.getAttribute('timeout') + if (timeoutValue !== null) { + typedEl.MDCSnackbar.timeoutMs = parseInt(timeoutValue, 10) + } + } -// if (el.hasAttribute('open')) { -// el.MDCSnackbar.open() -// } -// }) -// } + if (el.hasAttribute('open')) { + typedEl.MDCSnackbar.open() + } + }) +} // document.addEventListener('DOMContentLoaded', () => { // initButtons() @@ -153,5 +160,4 @@ function initMenus() { // initFabs() // initIconButtons() // initLinearProgresses() -// initSnackbars() // }) From 39d707c78addc6cc570ab685215a6c9c3b2c7e6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 09:46:11 +0800 Subject: [PATCH 08/14] feat(chips): implement initChipSets function with TODOs for add/remove functionality - Added initChipSets function to initialize MDC chip sets. - Included TODO comments for implementing chip removal and addition functionality. - Removed commented-out code for chip set initialization to clean up the codebase. --- src/Components/Chip.php | 15 ++++++++++++++- src/Components/ChipSet.php | 13 ++++++++++++- src/assets/dist/main.js | 2 +- src/assets/src/main.ts | 30 ++++++++---------------------- 4 files changed, 35 insertions(+), 25 deletions(-) diff --git a/src/Components/Chip.php b/src/Components/Chip.php index c0b5f1a..18c8dab 100644 --- a/src/Components/Chip.php +++ b/src/Components/Chip.php @@ -1,10 +1,20 @@ merge(['role' => 'row']); + $attributes = $attributes->merge([ + 'role' => 'row', + 'data-mdc-auto-init' => 'MDCChip', + ]); return $attributes->class([ 'mdc-chip', diff --git a/src/Components/ChipSet.php b/src/Components/ChipSet.php index bb5c27f..cf5dd7c 100644 --- a/src/Components/ChipSet.php +++ b/src/Components/ChipSet.php @@ -1,10 +1,18 @@ merge(['role' => 'grid']); + $attributes = $attributes->merge([ + 'data-mdc-auto-init' => 'MDCChipSet', + 'role' => 'grid', + ]); return $attributes->class([ 'mdc-chip-set', diff --git a/src/assets/dist/main.js b/src/assets/dist/main.js index d01f4a7..524bc31 100644 --- a/src/assets/dist/main.js +++ b/src/assets/dist/main.js @@ -1 +1 @@ -const U="modulepreload",x=function(i){return"/assets/material-blade/"+i},R={},I=function(n,t,e){let r=Promise.resolve();if(t&&t.length>0){let d=function(s){return Promise.all(s.map(c=>Promise.resolve(c).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),u=o?.nonce||o?.getAttribute("nonce");r=d(t.map(s=>{if(s=x(s),s in R)return;R[s]=!0;const c=s.endsWith(".css"),l=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${l}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":U,c||(f.as="script"),f.crossOrigin="",f.href=s,u&&f.setAttribute("nonce",u),document.head.appendChild(f),c)return new Promise((v,m)=>{f.addEventListener("load",v),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${s}`)))})}))}function a(o){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o}return r.then(o=>{for(const u of o||[])u.status==="rejected"&&a(u.reason);return n().catch(a)})};var S=function(i,n){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},S(i,n)};function w(i,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");S(i,n);function t(){this.constructor=i}i.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}var h=function(){return h=Object.assign||function(n){for(var t,e=1,r=arguments.length;e0&&a[a.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=i.length&&(i=void 0),{value:i&&i[e++],done:!i}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(i,n){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var e=t.call(i),r,a=[],o;try{for(;(n===void 0||n-- >0)&&!(r=e.next()).done;)a.push(r.value)}catch(u){o={error:u}}finally{try{r&&!r.done&&(t=e.return)&&t.call(e)}finally{if(o)throw o.error}}return a}function G(i,n,t){if(t||arguments.length===2)for(var e=0,r=n.length,a;e0&&b.some(function(d){return e.adapter.containsEventTarget(d)});if(u){this.resetActivationState();return}t!==void 0&&(b.push(t.target),this.registerDeactivationHandlers(t)),r.wasElementMadeActive=this.checkElementMadeActive(t),r.wasElementMadeActive&&this.animateActivation(),requestAnimationFrame(function(){b=[],!r.wasElementMadeActive&&t!==void 0&&(t.key===" "||t.keyCode===32)&&(r.wasElementMadeActive=e.checkElementMadeActive(t),r.wasElementMadeActive&&e.animateActivation()),r.wasElementMadeActive||(e.activationState=e.defaultActivationState())})}}}},n.prototype.checkElementMadeActive=function(t){return t!==void 0&&t.type==="keydown"?this.adapter.isSurfaceActive():!0},n.prototype.animateActivation=function(){var t=this,e=n.strings,r=e.VAR_FG_TRANSLATE_START,a=e.VAR_FG_TRANSLATE_END,o=n.cssClasses,u=o.FG_DEACTIVATION,d=o.FG_ACTIVATION,s=n.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal();var c="",l="";if(!this.adapter.isUnbounded()){var f=this.getFgTranslationCoordinates(),v=f.startPoint,m=f.endPoint;c=v.x+"px, "+v.y+"px",l=m.x+"px, "+m.y+"px"}this.adapter.updateCssVariable(r,c),this.adapter.updateCssVariable(a,l),clearTimeout(this.activationTimer),clearTimeout(this.fgDeactivationRemovalTimer),this.rmBoundedActivationClasses(),this.adapter.removeClass(u),this.adapter.computeBoundingRect(),this.adapter.addClass(d),this.activationTimer=setTimeout(function(){t.activationTimerCallback()},s)},n.prototype.getFgTranslationCoordinates=function(){var t=this.activationState,e=t.activationEvent,r=t.wasActivatedByPointer,a;r?a=q(e,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):a={x:this.frame.width/2,y:this.frame.height/2},a={x:a.x-this.initialSize/2,y:a.y-this.initialSize/2};var o={x:this.frame.width/2-this.initialSize/2,y:this.frame.height/2-this.initialSize/2};return{startPoint:a,endPoint:o}},n.prototype.runDeactivationUXLogicIfReady=function(){var t=this,e=n.cssClasses.FG_DEACTIVATION,r=this.activationState,a=r.hasDeactivationUXRun,o=r.isActivated,u=a||!o;u&&this.activationAnimationHasEnded&&(this.rmBoundedActivationClasses(),this.adapter.addClass(e),this.fgDeactivationRemovalTimer=setTimeout(function(){t.adapter.removeClass(e)},F.FG_DEACTIVATION_MS))},n.prototype.rmBoundedActivationClasses=function(){var t=n.cssClasses.FG_ACTIVATION;this.adapter.removeClass(t),this.activationAnimationHasEnded=!1,this.adapter.computeBoundingRect()},n.prototype.resetActivationState=function(){var t=this;this.previousActivationEvent=this.activationState.activationEvent,this.activationState=this.defaultActivationState(),setTimeout(function(){return t.previousActivationEvent=void 0},n.numbers.TAP_DELAY_MS)},n.prototype.deactivateImpl=function(){var t=this,e=this.activationState;if(e.isActivated){var r=h({},e);e.isProgrammatic?(requestAnimationFrame(function(){t.animateDeactivation(r)}),this.resetActivationState()):(this.deregisterDeactivationHandlers(),requestAnimationFrame(function(){t.activationState.hasDeactivationUXRun=!0,t.animateDeactivation(r),t.resetActivationState()}))}},n.prototype.animateDeactivation=function(t){var e=t.wasActivatedByPointer,r=t.wasElementMadeActive;(e||r)&&this.runDeactivationUXLogicIfReady()},n.prototype.layoutInternal=function(){var t=this;this.frame=this.adapter.computeBoundingRect();var e=Math.max(this.frame.height,this.frame.width),r=function(){var o=Math.sqrt(Math.pow(t.frame.width,2)+Math.pow(t.frame.height,2));return o+n.numbers.PADDING};this.maxRadius=this.adapter.isUnbounded()?e:r();var a=Math.floor(e*n.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&a%2!==0?this.initialSize=a-1:this.initialSize=a,this.fgScale=""+this.maxRadius/this.initialSize,this.updateLayoutCssVars()},n.prototype.updateLayoutCssVars=function(){var t=n.strings,e=t.VAR_FG_SIZE,r=t.VAR_LEFT,a=t.VAR_TOP,o=t.VAR_FG_SCALE;this.adapter.updateCssVariable(e,this.initialSize+"px"),this.adapter.updateCssVariable(o,this.fgScale),this.adapter.isUnbounded()&&(this.unboundedCoords={left:Math.round(this.frame.width/2-this.initialSize/2),top:Math.round(this.frame.height/2-this.initialSize/2)},this.adapter.updateCssVariable(r,this.unboundedCoords.left+"px"),this.adapter.updateCssVariable(a,this.unboundedCoords.top+"px"))},n})(D);var H=(function(i){w(n,i);function n(){var t=i!==null&&i.apply(this,arguments)||this;return t.disabled=!1,t}return n.attachTo=function(t,e){e===void 0&&(e={isUnbounded:void 0});var r=new n(t);return e.isUnbounded!==void 0&&(r.unbounded=e.isUnbounded),r},n.createAdapter=function(t){return{addClass:function(e){return t.root.classList.add(e)},browserSupportsCssVars:function(){return j(window)},computeBoundingRect:function(){return t.root.getBoundingClientRect()},containsEventTarget:function(e){return t.root.contains(e)},deregisterDocumentInteractionHandler:function(e,r){return document.documentElement.removeEventListener(e,r,g())},deregisterInteractionHandler:function(e,r){return t.root.removeEventListener(e,r,g())},deregisterResizeHandler:function(e){return window.removeEventListener("resize",e)},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}},isSurfaceActive:function(){return O(t.root,":active")},isSurfaceDisabled:function(){return!!t.disabled},isUnbounded:function(){return!!t.unbounded},registerDocumentInteractionHandler:function(e,r){return document.documentElement.addEventListener(e,r,g())},registerInteractionHandler:function(e,r){return t.root.addEventListener(e,r,g())},registerResizeHandler:function(e){return window.addEventListener("resize",e)},removeClass:function(e){return t.root.classList.remove(e)},updateCssVariable:function(e,r){return t.root.style.setProperty(e,r)}}},Object.defineProperty(n.prototype,"unbounded",{get:function(){return!!this.isUnbounded},set:function(t){this.isUnbounded=!!t,this.setUnbounded()},enumerable:!1,configurable:!0}),n.prototype.activate=function(){this.foundation.activate()},n.prototype.deactivate=function(){this.foundation.deactivate()},n.prototype.layout=function(){this.foundation.layout()},n.prototype.getDefaultFoundation=function(){return new T(n.createAdapter(this))},n.prototype.initialSyncWithDOM=function(){var t=this.root;this.isUnbounded="mdcRippleIsUnbounded"in t.dataset},n.prototype.setUnbounded=function(){this.foundation.setUnbounded(!!this.isUnbounded)},n})(M);var C={ICON_BUTTON_ON:"mdc-icon-button--on",ROOT:"mdc-icon-button"},p={ARIA_LABEL:"aria-label",ARIA_PRESSED:"aria-pressed",DATA_ARIA_LABEL_OFF:"data-aria-label-off",DATA_ARIA_LABEL_ON:"data-aria-label-on",CHANGE_EVENT:"MDCIconButtonToggle:change"};var B=(function(i){w(n,i);function n(t){var e=i.call(this,h(h({},n.defaultAdapter),t))||this;return e.hasToggledAriaLabel=!1,e}return Object.defineProperty(n,"cssClasses",{get:function(){return C},enumerable:!1,configurable:!0}),Object.defineProperty(n,"strings",{get:function(){return p},enumerable:!1,configurable:!0}),Object.defineProperty(n,"defaultAdapter",{get:function(){return{addClass:function(){},hasClass:function(){return!1},notifyChange:function(){},removeClass:function(){},getAttr:function(){return null},setAttr:function(){}}},enumerable:!1,configurable:!0}),n.prototype.init=function(){var t=this.adapter.getAttr(p.DATA_ARIA_LABEL_ON),e=this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);if(t&&e){if(this.adapter.getAttr(p.ARIA_PRESSED)!==null)throw new Error("MDCIconButtonToggleFoundation: Button should not set `aria-pressed` if it has a toggled aria label.");this.hasToggledAriaLabel=!0}else this.adapter.setAttr(p.ARIA_PRESSED,String(this.isOn()))},n.prototype.handleClick=function(){this.toggle(),this.adapter.notifyChange({isOn:this.isOn()})},n.prototype.isOn=function(){return this.adapter.hasClass(C.ICON_BUTTON_ON)},n.prototype.toggle=function(t){if(t===void 0&&(t=!this.isOn()),t?this.adapter.addClass(C.ICON_BUTTON_ON):this.adapter.removeClass(C.ICON_BUTTON_ON),this.hasToggledAriaLabel){var e=t?this.adapter.getAttr(p.DATA_ARIA_LABEL_ON):this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);this.adapter.setAttr(p.ARIA_LABEL,e||"")}else this.adapter.setAttr(p.ARIA_PRESSED,""+t)},n})(D);var W=B.strings,X=(function(i){w(n,i);function n(){var t=i!==null&&i.apply(this,arguments)||this;return t.rippleComponent=t.createRipple(),t}return n.attachTo=function(t){return new n(t)},n.prototype.initialSyncWithDOM=function(){var t=this;this.handleClick=function(){t.foundation.handleClick()},this.listen("click",this.handleClick)},n.prototype.destroy=function(){this.unlisten("click",this.handleClick),this.ripple.destroy(),i.prototype.destroy.call(this)},n.prototype.getDefaultFoundation=function(){var t=this,e={addClass:function(r){return t.root.classList.add(r)},hasClass:function(r){return t.root.classList.contains(r)},notifyChange:function(r){t.emit(W.CHANGE_EVENT,r)},removeClass:function(r){return t.root.classList.remove(r)},getAttr:function(r){return t.root.getAttribute(r)},setAttr:function(r,a){return t.root.setAttribute(r,a)}};return new B(e)},Object.defineProperty(n.prototype,"ripple",{get:function(){return this.rippleComponent},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"on",{get:function(){return this.foundation.isOn()},set:function(t){this.foundation.toggle(t)},enumerable:!1,configurable:!0}),n.prototype.createRipple=function(){var t=new H(this.root);return t.unbounded=!0,t},n})(M);document.addEventListener("DOMContentLoaded",()=>{I(async()=>{const{autoInit:i}=await import("./vendor.js");return{autoInit:i}},[]).then(({autoInit:i})=>{i(),$(),V(),Z(),N()})});function V(){document.querySelectorAll(".mdc-banner").forEach(i=>{const n=i;n.classList.contains("mbc-banner--open")&&n.MDCBanner.open()})}function $(){document.querySelectorAll(".mdc-icon-button").forEach(i=>{if(i.querySelector(".mdc-icon-button__icon--on")){new X(i);return}if(i.querySelector(".mdc-icon-button__ripple")){const n=new H(i);n.unbounded=!0}})}function Z(){document.querySelectorAll(".mdc-dialog").forEach(i=>{const n=i;n.classList.contains("mdc-dialog--open")&&n.MDCDialog.open()})}function N(){document.querySelectorAll(".mdc-menu").forEach(i=>{const n=i;n.classList.contains("mdc-menu--open")&&(n.MDCMenu.open=!0)})}export{D as M,y as _,w as a,h as b,Q as c,M as d,H as e,g as f,T as g,J as h,K as i,E as j,G as k,Y as l,O as m,X as n}; +const U="modulepreload",x=function(i){return"/assets/material-blade/"+i},R={},I=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let d=function(s){return Promise.all(s.map(c=>Promise.resolve(c).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),u=o?.nonce||o?.getAttribute("nonce");r=d(t.map(s=>{if(s=x(s),s in R)return;R[s]=!0;const c=s.endsWith(".css"),l=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${l}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":U,c||(f.as="script"),f.crossOrigin="",f.href=s,u&&f.setAttribute("nonce",u),document.head.appendChild(f),c)return new Promise((v,m)=>{f.addEventListener("load",v),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${s}`)))})}))}function a(o){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o}return r.then(o=>{for(const u of o||[])u.status==="rejected"&&a(u.reason);return e().catch(a)})};var S=function(i,e){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},S(i,e)};function w(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");S(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var h=function(){return h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var n=t.call(i),r,a=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)a.push(r.value)}catch(u){o={error:u}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a}function G(i,e,t){if(t||arguments.length===2)for(var n=0,r=e.length,a;n0&&b.some(function(d){return n.adapter.containsEventTarget(d)});if(u){this.resetActivationState();return}t!==void 0&&(b.push(t.target),this.registerDeactivationHandlers(t)),r.wasElementMadeActive=this.checkElementMadeActive(t),r.wasElementMadeActive&&this.animateActivation(),requestAnimationFrame(function(){b=[],!r.wasElementMadeActive&&t!==void 0&&(t.key===" "||t.keyCode===32)&&(r.wasElementMadeActive=n.checkElementMadeActive(t),r.wasElementMadeActive&&n.animateActivation()),r.wasElementMadeActive||(n.activationState=n.defaultActivationState())})}}}},e.prototype.checkElementMadeActive=function(t){return t!==void 0&&t.type==="keydown"?this.adapter.isSurfaceActive():!0},e.prototype.animateActivation=function(){var t=this,n=e.strings,r=n.VAR_FG_TRANSLATE_START,a=n.VAR_FG_TRANSLATE_END,o=e.cssClasses,u=o.FG_DEACTIVATION,d=o.FG_ACTIVATION,s=e.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal();var c="",l="";if(!this.adapter.isUnbounded()){var f=this.getFgTranslationCoordinates(),v=f.startPoint,m=f.endPoint;c=v.x+"px, "+v.y+"px",l=m.x+"px, "+m.y+"px"}this.adapter.updateCssVariable(r,c),this.adapter.updateCssVariable(a,l),clearTimeout(this.activationTimer),clearTimeout(this.fgDeactivationRemovalTimer),this.rmBoundedActivationClasses(),this.adapter.removeClass(u),this.adapter.computeBoundingRect(),this.adapter.addClass(d),this.activationTimer=setTimeout(function(){t.activationTimerCallback()},s)},e.prototype.getFgTranslationCoordinates=function(){var t=this.activationState,n=t.activationEvent,r=t.wasActivatedByPointer,a;r?a=q(n,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):a={x:this.frame.width/2,y:this.frame.height/2},a={x:a.x-this.initialSize/2,y:a.y-this.initialSize/2};var o={x:this.frame.width/2-this.initialSize/2,y:this.frame.height/2-this.initialSize/2};return{startPoint:a,endPoint:o}},e.prototype.runDeactivationUXLogicIfReady=function(){var t=this,n=e.cssClasses.FG_DEACTIVATION,r=this.activationState,a=r.hasDeactivationUXRun,o=r.isActivated,u=a||!o;u&&this.activationAnimationHasEnded&&(this.rmBoundedActivationClasses(),this.adapter.addClass(n),this.fgDeactivationRemovalTimer=setTimeout(function(){t.adapter.removeClass(n)},F.FG_DEACTIVATION_MS))},e.prototype.rmBoundedActivationClasses=function(){var t=e.cssClasses.FG_ACTIVATION;this.adapter.removeClass(t),this.activationAnimationHasEnded=!1,this.adapter.computeBoundingRect()},e.prototype.resetActivationState=function(){var t=this;this.previousActivationEvent=this.activationState.activationEvent,this.activationState=this.defaultActivationState(),setTimeout(function(){return t.previousActivationEvent=void 0},e.numbers.TAP_DELAY_MS)},e.prototype.deactivateImpl=function(){var t=this,n=this.activationState;if(n.isActivated){var r=h({},n);n.isProgrammatic?(requestAnimationFrame(function(){t.animateDeactivation(r)}),this.resetActivationState()):(this.deregisterDeactivationHandlers(),requestAnimationFrame(function(){t.activationState.hasDeactivationUXRun=!0,t.animateDeactivation(r),t.resetActivationState()}))}},e.prototype.animateDeactivation=function(t){var n=t.wasActivatedByPointer,r=t.wasElementMadeActive;(n||r)&&this.runDeactivationUXLogicIfReady()},e.prototype.layoutInternal=function(){var t=this;this.frame=this.adapter.computeBoundingRect();var n=Math.max(this.frame.height,this.frame.width),r=function(){var o=Math.sqrt(Math.pow(t.frame.width,2)+Math.pow(t.frame.height,2));return o+e.numbers.PADDING};this.maxRadius=this.adapter.isUnbounded()?n:r();var a=Math.floor(n*e.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&a%2!==0?this.initialSize=a-1:this.initialSize=a,this.fgScale=""+this.maxRadius/this.initialSize,this.updateLayoutCssVars()},e.prototype.updateLayoutCssVars=function(){var t=e.strings,n=t.VAR_FG_SIZE,r=t.VAR_LEFT,a=t.VAR_TOP,o=t.VAR_FG_SCALE;this.adapter.updateCssVariable(n,this.initialSize+"px"),this.adapter.updateCssVariable(o,this.fgScale),this.adapter.isUnbounded()&&(this.unboundedCoords={left:Math.round(this.frame.width/2-this.initialSize/2),top:Math.round(this.frame.height/2-this.initialSize/2)},this.adapter.updateCssVariable(r,this.unboundedCoords.left+"px"),this.adapter.updateCssVariable(a,this.unboundedCoords.top+"px"))},e})(D);var H=(function(i){w(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.disabled=!1,t}return e.attachTo=function(t,n){n===void 0&&(n={isUnbounded:void 0});var r=new e(t);return n.isUnbounded!==void 0&&(r.unbounded=n.isUnbounded),r},e.createAdapter=function(t){return{addClass:function(n){return t.root.classList.add(n)},browserSupportsCssVars:function(){return j(window)},computeBoundingRect:function(){return t.root.getBoundingClientRect()},containsEventTarget:function(n){return t.root.contains(n)},deregisterDocumentInteractionHandler:function(n,r){return document.documentElement.removeEventListener(n,r,g())},deregisterInteractionHandler:function(n,r){return t.root.removeEventListener(n,r,g())},deregisterResizeHandler:function(n){return window.removeEventListener("resize",n)},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}},isSurfaceActive:function(){return O(t.root,":active")},isSurfaceDisabled:function(){return!!t.disabled},isUnbounded:function(){return!!t.unbounded},registerDocumentInteractionHandler:function(n,r){return document.documentElement.addEventListener(n,r,g())},registerInteractionHandler:function(n,r){return t.root.addEventListener(n,r,g())},registerResizeHandler:function(n){return window.addEventListener("resize",n)},removeClass:function(n){return t.root.classList.remove(n)},updateCssVariable:function(n,r){return t.root.style.setProperty(n,r)}}},Object.defineProperty(e.prototype,"unbounded",{get:function(){return!!this.isUnbounded},set:function(t){this.isUnbounded=!!t,this.setUnbounded()},enumerable:!1,configurable:!0}),e.prototype.activate=function(){this.foundation.activate()},e.prototype.deactivate=function(){this.foundation.deactivate()},e.prototype.layout=function(){this.foundation.layout()},e.prototype.getDefaultFoundation=function(){return new T(e.createAdapter(this))},e.prototype.initialSyncWithDOM=function(){var t=this.root;this.isUnbounded="mdcRippleIsUnbounded"in t.dataset},e.prototype.setUnbounded=function(){this.foundation.setUnbounded(!!this.isUnbounded)},e})(_);var C={ICON_BUTTON_ON:"mdc-icon-button--on",ROOT:"mdc-icon-button"},p={ARIA_LABEL:"aria-label",ARIA_PRESSED:"aria-pressed",DATA_ARIA_LABEL_OFF:"data-aria-label-off",DATA_ARIA_LABEL_ON:"data-aria-label-on",CHANGE_EVENT:"MDCIconButtonToggle:change"};var B=(function(i){w(e,i);function e(t){var n=i.call(this,h(h({},e.defaultAdapter),t))||this;return n.hasToggledAriaLabel=!1,n}return Object.defineProperty(e,"cssClasses",{get:function(){return C},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return p},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},hasClass:function(){return!1},notifyChange:function(){},removeClass:function(){},getAttr:function(){return null},setAttr:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){var t=this.adapter.getAttr(p.DATA_ARIA_LABEL_ON),n=this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);if(t&&n){if(this.adapter.getAttr(p.ARIA_PRESSED)!==null)throw new Error("MDCIconButtonToggleFoundation: Button should not set `aria-pressed` if it has a toggled aria label.");this.hasToggledAriaLabel=!0}else this.adapter.setAttr(p.ARIA_PRESSED,String(this.isOn()))},e.prototype.handleClick=function(){this.toggle(),this.adapter.notifyChange({isOn:this.isOn()})},e.prototype.isOn=function(){return this.adapter.hasClass(C.ICON_BUTTON_ON)},e.prototype.toggle=function(t){if(t===void 0&&(t=!this.isOn()),t?this.adapter.addClass(C.ICON_BUTTON_ON):this.adapter.removeClass(C.ICON_BUTTON_ON),this.hasToggledAriaLabel){var n=t?this.adapter.getAttr(p.DATA_ARIA_LABEL_ON):this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);this.adapter.setAttr(p.ARIA_LABEL,n||"")}else this.adapter.setAttr(p.ARIA_PRESSED,""+t)},e})(D);var W=B.strings,X=(function(i){w(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.rippleComponent=t.createRipple(),t}return e.attachTo=function(t){return new e(t)},e.prototype.initialSyncWithDOM=function(){var t=this;this.handleClick=function(){t.foundation.handleClick()},this.listen("click",this.handleClick)},e.prototype.destroy=function(){this.unlisten("click",this.handleClick),this.ripple.destroy(),i.prototype.destroy.call(this)},e.prototype.getDefaultFoundation=function(){var t=this,n={addClass:function(r){return t.root.classList.add(r)},hasClass:function(r){return t.root.classList.contains(r)},notifyChange:function(r){t.emit(W.CHANGE_EVENT,r)},removeClass:function(r){return t.root.classList.remove(r)},getAttr:function(r){return t.root.getAttribute(r)},setAttr:function(r,a){return t.root.setAttribute(r,a)}};return new B(n)},Object.defineProperty(e.prototype,"ripple",{get:function(){return this.rippleComponent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"on",{get:function(){return this.foundation.isOn()},set:function(t){this.foundation.toggle(t)},enumerable:!1,configurable:!0}),e.prototype.createRipple=function(){var t=new H(this.root);return t.unbounded=!0,t},e})(_);document.addEventListener("DOMContentLoaded",()=>{I(async()=>{const{autoInit:i}=await import("./vendor.js");return{autoInit:i}},[]).then(({autoInit:i})=>{i(),$(),V(),Z(),N(),J()})});function V(){document.querySelectorAll(".mdc-banner").forEach(i=>{const e=i;e.classList.contains("mbc-banner--open")&&e.MDCBanner.open()})}function $(){document.querySelectorAll(".mdc-icon-button").forEach(i=>{if(i.querySelector(".mdc-icon-button__icon--on")){new X(i);return}if(i.querySelector(".mdc-icon-button__ripple")){const e=new H(i);e.unbounded=!0}})}function Z(){document.querySelectorAll(".mdc-dialog").forEach(i=>{const e=i;e.classList.contains("mdc-dialog--open")&&e.MDCDialog.open()})}function N(){document.querySelectorAll(".mdc-menu").forEach(i=>{const e=i;e.classList.contains("mdc-menu--open")&&(e.MDCMenu.open=!0)})}function J(){document.querySelectorAll(".mdc-snackbar").forEach(i=>{const e=i;if(i.hasAttribute("timeout")){const t=i.getAttribute("timeout");t!==null&&(e.MDCSnackbar.timeoutMs=parseInt(t,10))}i.hasAttribute("open")&&e.MDCSnackbar.open()})}export{D as M,y as _,w as a,h as b,Y as c,_ as d,H as e,g as f,T as g,K as h,Q as i,E as j,G as k,tt as l,O as m,X as n}; diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 4e12a06..592e44b 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -16,6 +16,7 @@ document.addEventListener('DOMContentLoaded', () => { initDialogs() initMenus() initSnackbars() + initChipSets() }) }) @@ -81,27 +82,13 @@ function initMenus() { }) } -// function initChipSets() { -// document.querySelectorAll('.mdc-chip-set').forEach(el => { -// el.MDCChipSet = new mdc.chips.MDCChipSet(el) - -// el.MDCChipSet.listen('MDCChip:removal', event => { -// console.log(event) -// el.removeChild(event.detail.root) -// }) -// }) - -// // TODO: Add event listener for adding chips -// // input.addEventListener('keydown', function(event) { -// // if (event.key === 'Enter' || event.keyCode === 13) { -// // const chipEl = document.createElement('div') +/** + * TODO: IMPLEMENT REMOVE FUNCTIONALITY. see https://github.com/material-components/material-components-web/blob/v14.0.0/packages/mdc-chips/deprecated/README.md#removing-chips-from-the-dom. + * TODO: IMPLEMENT ADD FUNCTIONALITY, https://github.com/material-components/material-components-web/blob/v14.0.0/packages/mdc-chips/deprecated/README.md#removing-chips-from-the-dom. + */ +function initChipSets() { -// // // ... perform operations to properly populate/decorate chip element ... -// // chipSetEl.appendChild(chipEl) -// // chipSet.addChip(chipEl) -// // } -// // }) -// } +} // function initCircularProgresses() { // document.querySelectorAll('.mdc-circular-progress').forEach(el => { @@ -133,6 +120,7 @@ function initMenus() { // }) // } + function initSnackbars() { document.querySelectorAll('.mdc-snackbar').forEach(el => { const typedEl = el as HTMLDivElement & { @@ -153,8 +141,6 @@ function initSnackbars() { } // document.addEventListener('DOMContentLoaded', () => { -// initButtons() -// initChipSets() // initCircularProgresses() // initDataTables() // initFabs() From aca7b23299226622c9ef3b8dc20d7e2a0efece55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 10:38:07 +0800 Subject: [PATCH 09/14] refactor(CircularProgress): enhance validation and improve attribute handling --- src/Components/CircularProgress.php | 19 ++++++++++++++++--- src/assets/src/main.ts | 26 +++++++++++++++++--------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/Components/CircularProgress.php b/src/Components/CircularProgress.php index a774226..6ed274c 100644 --- a/src/Components/CircularProgress.php +++ b/src/Components/CircularProgress.php @@ -1,11 +1,21 @@ has('aria-label')) { throw new \Exception('Progress bars is conform to the WAI-ARIA Progressbar Specification, the \'aria-label\' attribute is required'); } + + if ($this->value !== null && ($this->value < 0 || $this->value > 1)) { + throw new \Exception('The "value" attribute must be between 0 and 1'); + } } public function attributesPreprocess(ComponentAttributeBag $attributes) @@ -52,9 +66,8 @@ public function attributesPreprocess(ComponentAttributeBag $attributes) $attributes = $attributes->merge([ 'role' => 'progressbar', - 'aria-valuemin' => 0, - 'aria-valuemax' => 1, - 'aria-valuenow' => $this->value ?: 0, + 'data-mdc-auto-init' => 'MDCCircularProgress', + 'data-value' => $this->value ?: '0', ]); if ($this->color !== 'primary') { diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 592e44b..28165f9 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -3,6 +3,7 @@ import './main.scss' import { MDCBanner } from '@material/banner' import { MDCDialog } from '@material/dialog' import type { MDCSnackbar } from '@material/snackbar' +import type { MDCCircularProgress } from '@material/circular-progress' import { MDCIconButtonToggle } from '@material/icon-button' import { MDCMenu } from '@material/menu' import { MDCRipple } from '@material/ripple' @@ -17,6 +18,7 @@ document.addEventListener('DOMContentLoaded', () => { initMenus() initSnackbars() initChipSets() + setCircularProgressValues() }) }) @@ -90,15 +92,22 @@ function initChipSets() { } -// function initCircularProgresses() { -// document.querySelectorAll('.mdc-circular-progress').forEach(el => { -// el.circularProgress = new mdc.circularProgress.MDCCircularProgress(el) +/** + * Set the progress values for all circular progress indicators + */ +function setCircularProgressValues() { + document.querySelectorAll('.mdc-circular-progress').forEach((el) => { + const typedEl = el as HTMLDivElement & { + MDCCircularProgress: MDCCircularProgress + } -// if ((value = el.getAttribute('aria-valuenow'))) { -// el.circularProgress.progress = value -// } -// }) -// } + console.log(typedEl.ariaValueNow); + + if (typedEl.dataset.value) { + typedEl.MDCCircularProgress.progress = parseFloat(typedEl.dataset.value) + } + }) +} // function initDataTables() { // document.querySelectorAll('.mdc-data-table').forEach(el => { @@ -141,7 +150,6 @@ function initSnackbars() { } // document.addEventListener('DOMContentLoaded', () => { -// initCircularProgresses() // initDataTables() // initFabs() // initIconButtons() From b4b9cef9d4688b6fd499ac465dd0533cc587611a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 10:39:00 +0800 Subject: [PATCH 10/14] refactor(main.ts): update imports to use type-only imports for better clarity --- src/assets/src/main.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index 28165f9..e389948 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -1,12 +1,12 @@ import './main.scss' -import { MDCBanner } from '@material/banner' -import { MDCDialog } from '@material/dialog' +import type { MDCBanner } from '@material/banner' +import type { MDCDialog } from '@material/dialog' import type { MDCSnackbar } from '@material/snackbar' import type { MDCCircularProgress } from '@material/circular-progress' -import { MDCIconButtonToggle } from '@material/icon-button' -import { MDCMenu } from '@material/menu' +import type { MDCMenu } from '@material/menu' import { MDCRipple } from '@material/ripple' +import { MDCIconButtonToggle } from '@material/icon-button' document.addEventListener('DOMContentLoaded', () => { import('material-components-web').then(({ autoInit }) => { From ae8d412e7c367a0ba615767eec7684632e85f879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 10:49:55 +0800 Subject: [PATCH 11/14] refactor(LinearProgress): enhance validation and improve attribute handling; add linear progress initialization in main.ts --- src/Components/LinearProgress.php | 23 ++++++++++++++++--- src/assets/src/main.ts | 38 +++++++++++++++++-------------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/src/Components/LinearProgress.php b/src/Components/LinearProgress.php index 9338672..25957c2 100644 --- a/src/Components/LinearProgress.php +++ b/src/Components/LinearProgress.php @@ -1,11 +1,21 @@ has('aria-label')) { throw new \Exception('Progress bars is conform to the WAI-ARIA Progressbar Specification, the \'aria-label\' attribute is required'); } + + if ($this->value !== null && ($this->value < 0 || $this->value > 1)) { + throw new \Exception('The "value" attribute must be between 0 and 1'); + } + + if ($this->bufferValue !== null && ($this->bufferValue < 0 || $this->bufferValue > 1)) { + throw new \Exception('The "bufferValue" attribute must be between 0 and 1'); + } } public function attributesPreprocess(ComponentAttributeBag $attributes) @@ -52,9 +70,8 @@ public function attributesPreprocess(ComponentAttributeBag $attributes) $attributes = $attributes->merge([ 'role' => 'progressbar', - 'aria-valuemin' => 0, - 'aria-valuemax' => 1, - 'aria-valuenow' => $this->value ?: 0, + 'data-mdc-auto-init' => 'MDCLinearProgress', + 'data-value' => $this->value ?: 0, ]); if ($this->bufferValue !== null) { diff --git a/src/assets/src/main.ts b/src/assets/src/main.ts index e389948..a74a29d 100644 --- a/src/assets/src/main.ts +++ b/src/assets/src/main.ts @@ -1,12 +1,13 @@ import './main.scss' import type { MDCBanner } from '@material/banner' -import type { MDCDialog } from '@material/dialog' -import type { MDCSnackbar } from '@material/snackbar' import type { MDCCircularProgress } from '@material/circular-progress' +import type { MDCDialog } from '@material/dialog' +import type { MDCLinearProgress } from '@material/linear-progress' import type { MDCMenu } from '@material/menu' -import { MDCRipple } from '@material/ripple' +import type { MDCSnackbar } from '@material/snackbar' import { MDCIconButtonToggle } from '@material/icon-button' +import { MDCRipple } from '@material/ripple' document.addEventListener('DOMContentLoaded', () => { import('material-components-web').then(({ autoInit }) => { @@ -19,6 +20,7 @@ document.addEventListener('DOMContentLoaded', () => { initSnackbars() initChipSets() setCircularProgressValues() + setLinearProgressValues() }) }) @@ -115,20 +117,25 @@ function setCircularProgressValues() { // }) // } -// function initLinearProgresses() { -// document.querySelectorAll('.mdc-linear-progress').forEach(el => { -// el.linearProgress = new mdc.linearProgress.MDCLinearProgress(el) -// if ((value = el.getAttribute('aria-valuenow'))) { -// el.linearProgress.progress = value -// } +/** + * Set the progress values for all linear progress indicators + */ +function setLinearProgressValues() { + document.querySelectorAll('.mdc-linear-progress').forEach(el => { + const typedEl = el as HTMLDivElement & { + MDCLinearProgress: MDCLinearProgress + } -// if (el.dataset.bufferValue && el.dataset.bufferValue != 1) { -// el.linearProgress.buffer = el.dataset.bufferValue -// } -// }) -// } + if (typedEl.dataset.value) { + typedEl.MDCLinearProgress.progress = parseFloat(typedEl.dataset.value) + } + if (typedEl.dataset.bufferValue) { + typedEl.MDCLinearProgress.buffer = parseFloat(typedEl.dataset.bufferValue) + } + }) +} function initSnackbars() { document.querySelectorAll('.mdc-snackbar').forEach(el => { @@ -151,7 +158,4 @@ function initSnackbars() { // document.addEventListener('DOMContentLoaded', () => { // initDataTables() -// initFabs() -// initIconButtons() -// initLinearProgresses() // }) From a5959bd16ddaaaf96978cee94de5a30131f25cc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 10:50:20 +0800 Subject: [PATCH 12/14] refactor(DataTable): add strict types declaration and improve documentation comments --- src/Components/DataTable.php | 10 ++++++++++ src/assets/src/main.ts | 11 ----------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/Components/DataTable.php b/src/Components/DataTable.php index e27ac50..86ef9ad 100644 --- a/src/Components/DataTable.php +++ b/src/Components/DataTable.php @@ -1,9 +1,19 @@ { -// el.MDCDataTable = new mdc.dataTable.MDCDataTable(el) -// }) -// } - - /** * Set the progress values for all linear progress indicators */ @@ -155,7 +148,3 @@ function initSnackbars() { } }) } - -// document.addEventListener('DOMContentLoaded', () => { -// initDataTables() -// }) From 9b8284c59bf9d3591de04b9233b3ff7a614c6570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 10:58:42 +0800 Subject: [PATCH 13/14] feat(Radio): add wrapperAttributesPreprocess method for improved attribute handling in radio component --- src/Components/Radio.php | 13 +++++++++++++ src/views/components/radio.blade.php | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Components/Radio.php b/src/Components/Radio.php index 440c1b1..07e81b3 100644 --- a/src/Components/Radio.php +++ b/src/Components/Radio.php @@ -54,4 +54,17 @@ public function attributesPreprocess(ComponentAttributeBag $attributes) 'mdc-radio__native-control', ]); } + + /** + * Preprocess attributes for the radio wrapper + * + * @return ComponentAttributeBag + */ + public function wrapperAttributesPreprocess(ComponentAttributeBag $attributes) + { + return new ComponentAttributeBag([ + 'class' => 'mdc-radio '.($attributes->has('disabled') ? 'mdc-radio--disabled ' : '').($this->touch ? 'mdc-radio--touch' : ''), + 'data-mdc-auto-init' => 'MDCRadio', + ]); + } } diff --git a/src/views/components/radio.blade.php b/src/views/components/radio.blade.php index 94b721b..3e8dfa2 100644 --- a/src/views/components/radio.blade.php +++ b/src/views/components/radio.blade.php @@ -2,8 +2,8 @@
@endif -
-
+
+
$value) {{ $key }}="{{ $value }}" @endforeach>
From 3887e759db66fe899fec37e91edb3215338efef2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zain=F0=9F=8D=95?= Date: Tue, 11 Nov 2025 11:00:07 +0800 Subject: [PATCH 14/14] build new main.ts --- src/assets/dist/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/dist/main.js b/src/assets/dist/main.js index 524bc31..a92654f 100644 --- a/src/assets/dist/main.js +++ b/src/assets/dist/main.js @@ -1 +1 @@ -const U="modulepreload",x=function(i){return"/assets/material-blade/"+i},R={},I=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let d=function(s){return Promise.all(s.map(c=>Promise.resolve(c).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),u=o?.nonce||o?.getAttribute("nonce");r=d(t.map(s=>{if(s=x(s),s in R)return;R[s]=!0;const c=s.endsWith(".css"),l=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${l}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":U,c||(f.as="script"),f.crossOrigin="",f.href=s,u&&f.setAttribute("nonce",u),document.head.appendChild(f),c)return new Promise((v,m)=>{f.addEventListener("load",v),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${s}`)))})}))}function a(o){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o}return r.then(o=>{for(const u of o||[])u.status==="rejected"&&a(u.reason);return e().catch(a)})};var S=function(i,e){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},S(i,e)};function w(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");S(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var h=function(){return h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function E(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var n=t.call(i),r,a=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)a.push(r.value)}catch(u){o={error:u}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a}function G(i,e,t){if(t||arguments.length===2)for(var n=0,r=e.length,a;n0&&b.some(function(d){return n.adapter.containsEventTarget(d)});if(u){this.resetActivationState();return}t!==void 0&&(b.push(t.target),this.registerDeactivationHandlers(t)),r.wasElementMadeActive=this.checkElementMadeActive(t),r.wasElementMadeActive&&this.animateActivation(),requestAnimationFrame(function(){b=[],!r.wasElementMadeActive&&t!==void 0&&(t.key===" "||t.keyCode===32)&&(r.wasElementMadeActive=n.checkElementMadeActive(t),r.wasElementMadeActive&&n.animateActivation()),r.wasElementMadeActive||(n.activationState=n.defaultActivationState())})}}}},e.prototype.checkElementMadeActive=function(t){return t!==void 0&&t.type==="keydown"?this.adapter.isSurfaceActive():!0},e.prototype.animateActivation=function(){var t=this,n=e.strings,r=n.VAR_FG_TRANSLATE_START,a=n.VAR_FG_TRANSLATE_END,o=e.cssClasses,u=o.FG_DEACTIVATION,d=o.FG_ACTIVATION,s=e.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal();var c="",l="";if(!this.adapter.isUnbounded()){var f=this.getFgTranslationCoordinates(),v=f.startPoint,m=f.endPoint;c=v.x+"px, "+v.y+"px",l=m.x+"px, "+m.y+"px"}this.adapter.updateCssVariable(r,c),this.adapter.updateCssVariable(a,l),clearTimeout(this.activationTimer),clearTimeout(this.fgDeactivationRemovalTimer),this.rmBoundedActivationClasses(),this.adapter.removeClass(u),this.adapter.computeBoundingRect(),this.adapter.addClass(d),this.activationTimer=setTimeout(function(){t.activationTimerCallback()},s)},e.prototype.getFgTranslationCoordinates=function(){var t=this.activationState,n=t.activationEvent,r=t.wasActivatedByPointer,a;r?a=q(n,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):a={x:this.frame.width/2,y:this.frame.height/2},a={x:a.x-this.initialSize/2,y:a.y-this.initialSize/2};var o={x:this.frame.width/2-this.initialSize/2,y:this.frame.height/2-this.initialSize/2};return{startPoint:a,endPoint:o}},e.prototype.runDeactivationUXLogicIfReady=function(){var t=this,n=e.cssClasses.FG_DEACTIVATION,r=this.activationState,a=r.hasDeactivationUXRun,o=r.isActivated,u=a||!o;u&&this.activationAnimationHasEnded&&(this.rmBoundedActivationClasses(),this.adapter.addClass(n),this.fgDeactivationRemovalTimer=setTimeout(function(){t.adapter.removeClass(n)},F.FG_DEACTIVATION_MS))},e.prototype.rmBoundedActivationClasses=function(){var t=e.cssClasses.FG_ACTIVATION;this.adapter.removeClass(t),this.activationAnimationHasEnded=!1,this.adapter.computeBoundingRect()},e.prototype.resetActivationState=function(){var t=this;this.previousActivationEvent=this.activationState.activationEvent,this.activationState=this.defaultActivationState(),setTimeout(function(){return t.previousActivationEvent=void 0},e.numbers.TAP_DELAY_MS)},e.prototype.deactivateImpl=function(){var t=this,n=this.activationState;if(n.isActivated){var r=h({},n);n.isProgrammatic?(requestAnimationFrame(function(){t.animateDeactivation(r)}),this.resetActivationState()):(this.deregisterDeactivationHandlers(),requestAnimationFrame(function(){t.activationState.hasDeactivationUXRun=!0,t.animateDeactivation(r),t.resetActivationState()}))}},e.prototype.animateDeactivation=function(t){var n=t.wasActivatedByPointer,r=t.wasElementMadeActive;(n||r)&&this.runDeactivationUXLogicIfReady()},e.prototype.layoutInternal=function(){var t=this;this.frame=this.adapter.computeBoundingRect();var n=Math.max(this.frame.height,this.frame.width),r=function(){var o=Math.sqrt(Math.pow(t.frame.width,2)+Math.pow(t.frame.height,2));return o+e.numbers.PADDING};this.maxRadius=this.adapter.isUnbounded()?n:r();var a=Math.floor(n*e.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&a%2!==0?this.initialSize=a-1:this.initialSize=a,this.fgScale=""+this.maxRadius/this.initialSize,this.updateLayoutCssVars()},e.prototype.updateLayoutCssVars=function(){var t=e.strings,n=t.VAR_FG_SIZE,r=t.VAR_LEFT,a=t.VAR_TOP,o=t.VAR_FG_SCALE;this.adapter.updateCssVariable(n,this.initialSize+"px"),this.adapter.updateCssVariable(o,this.fgScale),this.adapter.isUnbounded()&&(this.unboundedCoords={left:Math.round(this.frame.width/2-this.initialSize/2),top:Math.round(this.frame.height/2-this.initialSize/2)},this.adapter.updateCssVariable(r,this.unboundedCoords.left+"px"),this.adapter.updateCssVariable(a,this.unboundedCoords.top+"px"))},e})(D);var H=(function(i){w(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.disabled=!1,t}return e.attachTo=function(t,n){n===void 0&&(n={isUnbounded:void 0});var r=new e(t);return n.isUnbounded!==void 0&&(r.unbounded=n.isUnbounded),r},e.createAdapter=function(t){return{addClass:function(n){return t.root.classList.add(n)},browserSupportsCssVars:function(){return j(window)},computeBoundingRect:function(){return t.root.getBoundingClientRect()},containsEventTarget:function(n){return t.root.contains(n)},deregisterDocumentInteractionHandler:function(n,r){return document.documentElement.removeEventListener(n,r,g())},deregisterInteractionHandler:function(n,r){return t.root.removeEventListener(n,r,g())},deregisterResizeHandler:function(n){return window.removeEventListener("resize",n)},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}},isSurfaceActive:function(){return O(t.root,":active")},isSurfaceDisabled:function(){return!!t.disabled},isUnbounded:function(){return!!t.unbounded},registerDocumentInteractionHandler:function(n,r){return document.documentElement.addEventListener(n,r,g())},registerInteractionHandler:function(n,r){return t.root.addEventListener(n,r,g())},registerResizeHandler:function(n){return window.addEventListener("resize",n)},removeClass:function(n){return t.root.classList.remove(n)},updateCssVariable:function(n,r){return t.root.style.setProperty(n,r)}}},Object.defineProperty(e.prototype,"unbounded",{get:function(){return!!this.isUnbounded},set:function(t){this.isUnbounded=!!t,this.setUnbounded()},enumerable:!1,configurable:!0}),e.prototype.activate=function(){this.foundation.activate()},e.prototype.deactivate=function(){this.foundation.deactivate()},e.prototype.layout=function(){this.foundation.layout()},e.prototype.getDefaultFoundation=function(){return new T(e.createAdapter(this))},e.prototype.initialSyncWithDOM=function(){var t=this.root;this.isUnbounded="mdcRippleIsUnbounded"in t.dataset},e.prototype.setUnbounded=function(){this.foundation.setUnbounded(!!this.isUnbounded)},e})(_);var C={ICON_BUTTON_ON:"mdc-icon-button--on",ROOT:"mdc-icon-button"},p={ARIA_LABEL:"aria-label",ARIA_PRESSED:"aria-pressed",DATA_ARIA_LABEL_OFF:"data-aria-label-off",DATA_ARIA_LABEL_ON:"data-aria-label-on",CHANGE_EVENT:"MDCIconButtonToggle:change"};var B=(function(i){w(e,i);function e(t){var n=i.call(this,h(h({},e.defaultAdapter),t))||this;return n.hasToggledAriaLabel=!1,n}return Object.defineProperty(e,"cssClasses",{get:function(){return C},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return p},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},hasClass:function(){return!1},notifyChange:function(){},removeClass:function(){},getAttr:function(){return null},setAttr:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){var t=this.adapter.getAttr(p.DATA_ARIA_LABEL_ON),n=this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);if(t&&n){if(this.adapter.getAttr(p.ARIA_PRESSED)!==null)throw new Error("MDCIconButtonToggleFoundation: Button should not set `aria-pressed` if it has a toggled aria label.");this.hasToggledAriaLabel=!0}else this.adapter.setAttr(p.ARIA_PRESSED,String(this.isOn()))},e.prototype.handleClick=function(){this.toggle(),this.adapter.notifyChange({isOn:this.isOn()})},e.prototype.isOn=function(){return this.adapter.hasClass(C.ICON_BUTTON_ON)},e.prototype.toggle=function(t){if(t===void 0&&(t=!this.isOn()),t?this.adapter.addClass(C.ICON_BUTTON_ON):this.adapter.removeClass(C.ICON_BUTTON_ON),this.hasToggledAriaLabel){var n=t?this.adapter.getAttr(p.DATA_ARIA_LABEL_ON):this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);this.adapter.setAttr(p.ARIA_LABEL,n||"")}else this.adapter.setAttr(p.ARIA_PRESSED,""+t)},e})(D);var W=B.strings,X=(function(i){w(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.rippleComponent=t.createRipple(),t}return e.attachTo=function(t){return new e(t)},e.prototype.initialSyncWithDOM=function(){var t=this;this.handleClick=function(){t.foundation.handleClick()},this.listen("click",this.handleClick)},e.prototype.destroy=function(){this.unlisten("click",this.handleClick),this.ripple.destroy(),i.prototype.destroy.call(this)},e.prototype.getDefaultFoundation=function(){var t=this,n={addClass:function(r){return t.root.classList.add(r)},hasClass:function(r){return t.root.classList.contains(r)},notifyChange:function(r){t.emit(W.CHANGE_EVENT,r)},removeClass:function(r){return t.root.classList.remove(r)},getAttr:function(r){return t.root.getAttribute(r)},setAttr:function(r,a){return t.root.setAttribute(r,a)}};return new B(n)},Object.defineProperty(e.prototype,"ripple",{get:function(){return this.rippleComponent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"on",{get:function(){return this.foundation.isOn()},set:function(t){this.foundation.toggle(t)},enumerable:!1,configurable:!0}),e.prototype.createRipple=function(){var t=new H(this.root);return t.unbounded=!0,t},e})(_);document.addEventListener("DOMContentLoaded",()=>{I(async()=>{const{autoInit:i}=await import("./vendor.js");return{autoInit:i}},[]).then(({autoInit:i})=>{i(),$(),V(),Z(),N(),J()})});function V(){document.querySelectorAll(".mdc-banner").forEach(i=>{const e=i;e.classList.contains("mbc-banner--open")&&e.MDCBanner.open()})}function $(){document.querySelectorAll(".mdc-icon-button").forEach(i=>{if(i.querySelector(".mdc-icon-button__icon--on")){new X(i);return}if(i.querySelector(".mdc-icon-button__ripple")){const e=new H(i);e.unbounded=!0}})}function Z(){document.querySelectorAll(".mdc-dialog").forEach(i=>{const e=i;e.classList.contains("mdc-dialog--open")&&e.MDCDialog.open()})}function N(){document.querySelectorAll(".mdc-menu").forEach(i=>{const e=i;e.classList.contains("mdc-menu--open")&&(e.MDCMenu.open=!0)})}function J(){document.querySelectorAll(".mdc-snackbar").forEach(i=>{const e=i;if(i.hasAttribute("timeout")){const t=i.getAttribute("timeout");t!==null&&(e.MDCSnackbar.timeoutMs=parseInt(t,10))}i.hasAttribute("open")&&e.MDCSnackbar.open()})}export{D as M,y as _,w as a,h as b,Y as c,_ as d,H as e,g as f,T as g,K as h,Q as i,E as j,G as k,tt as l,O as m,X as n}; +const U="modulepreload",x=function(i){return"/assets/material-blade/"+i},R={},E=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let d=function(s){return Promise.all(s.map(c=>Promise.resolve(c).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),u=o?.nonce||o?.getAttribute("nonce");r=d(t.map(s=>{if(s=x(s),s in R)return;R[s]=!0;const c=s.endsWith(".css"),l=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${l}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":U,c||(f.as="script"),f.crossOrigin="",f.href=s,u&&f.setAttribute("nonce",u),document.head.appendChild(f),c)return new Promise((v,m)=>{f.addEventListener("load",v),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${s}`)))})}))}function a(o){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o}return r.then(o=>{for(const u of o||[])u.status==="rejected"&&a(u.reason);return e().catch(a)})};var S=function(i,e){return S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])},S(i,e)};function w(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");S(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var h=function(){return h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1])&&(s[0]===6||s[0]===2)){t=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function I(i,e){var t=typeof Symbol=="function"&&i[Symbol.iterator];if(!t)return i;var n=t.call(i),r,a=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)a.push(r.value)}catch(u){o={error:u}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(o)throw o.error}}return a}function G(i,e,t){if(t||arguments.length===2)for(var n=0,r=e.length,a;n0&&b.some(function(d){return n.adapter.containsEventTarget(d)});if(u){this.resetActivationState();return}t!==void 0&&(b.push(t.target),this.registerDeactivationHandlers(t)),r.wasElementMadeActive=this.checkElementMadeActive(t),r.wasElementMadeActive&&this.animateActivation(),requestAnimationFrame(function(){b=[],!r.wasElementMadeActive&&t!==void 0&&(t.key===" "||t.keyCode===32)&&(r.wasElementMadeActive=n.checkElementMadeActive(t),r.wasElementMadeActive&&n.animateActivation()),r.wasElementMadeActive||(n.activationState=n.defaultActivationState())})}}}},e.prototype.checkElementMadeActive=function(t){return t!==void 0&&t.type==="keydown"?this.adapter.isSurfaceActive():!0},e.prototype.animateActivation=function(){var t=this,n=e.strings,r=n.VAR_FG_TRANSLATE_START,a=n.VAR_FG_TRANSLATE_END,o=e.cssClasses,u=o.FG_DEACTIVATION,d=o.FG_ACTIVATION,s=e.numbers.DEACTIVATION_TIMEOUT_MS;this.layoutInternal();var c="",l="";if(!this.adapter.isUnbounded()){var f=this.getFgTranslationCoordinates(),v=f.startPoint,m=f.endPoint;c=v.x+"px, "+v.y+"px",l=m.x+"px, "+m.y+"px"}this.adapter.updateCssVariable(r,c),this.adapter.updateCssVariable(a,l),clearTimeout(this.activationTimer),clearTimeout(this.fgDeactivationRemovalTimer),this.rmBoundedActivationClasses(),this.adapter.removeClass(u),this.adapter.computeBoundingRect(),this.adapter.addClass(d),this.activationTimer=setTimeout(function(){t.activationTimerCallback()},s)},e.prototype.getFgTranslationCoordinates=function(){var t=this.activationState,n=t.activationEvent,r=t.wasActivatedByPointer,a;r?a=q(n,this.adapter.getWindowPageOffset(),this.adapter.computeBoundingRect()):a={x:this.frame.width/2,y:this.frame.height/2},a={x:a.x-this.initialSize/2,y:a.y-this.initialSize/2};var o={x:this.frame.width/2-this.initialSize/2,y:this.frame.height/2-this.initialSize/2};return{startPoint:a,endPoint:o}},e.prototype.runDeactivationUXLogicIfReady=function(){var t=this,n=e.cssClasses.FG_DEACTIVATION,r=this.activationState,a=r.hasDeactivationUXRun,o=r.isActivated,u=a||!o;u&&this.activationAnimationHasEnded&&(this.rmBoundedActivationClasses(),this.adapter.addClass(n),this.fgDeactivationRemovalTimer=setTimeout(function(){t.adapter.removeClass(n)},F.FG_DEACTIVATION_MS))},e.prototype.rmBoundedActivationClasses=function(){var t=e.cssClasses.FG_ACTIVATION;this.adapter.removeClass(t),this.activationAnimationHasEnded=!1,this.adapter.computeBoundingRect()},e.prototype.resetActivationState=function(){var t=this;this.previousActivationEvent=this.activationState.activationEvent,this.activationState=this.defaultActivationState(),setTimeout(function(){return t.previousActivationEvent=void 0},e.numbers.TAP_DELAY_MS)},e.prototype.deactivateImpl=function(){var t=this,n=this.activationState;if(n.isActivated){var r=h({},n);n.isProgrammatic?(requestAnimationFrame(function(){t.animateDeactivation(r)}),this.resetActivationState()):(this.deregisterDeactivationHandlers(),requestAnimationFrame(function(){t.activationState.hasDeactivationUXRun=!0,t.animateDeactivation(r),t.resetActivationState()}))}},e.prototype.animateDeactivation=function(t){var n=t.wasActivatedByPointer,r=t.wasElementMadeActive;(n||r)&&this.runDeactivationUXLogicIfReady()},e.prototype.layoutInternal=function(){var t=this;this.frame=this.adapter.computeBoundingRect();var n=Math.max(this.frame.height,this.frame.width),r=function(){var o=Math.sqrt(Math.pow(t.frame.width,2)+Math.pow(t.frame.height,2));return o+e.numbers.PADDING};this.maxRadius=this.adapter.isUnbounded()?n:r();var a=Math.floor(n*e.numbers.INITIAL_ORIGIN_SCALE);this.adapter.isUnbounded()&&a%2!==0?this.initialSize=a-1:this.initialSize=a,this.fgScale=""+this.maxRadius/this.initialSize,this.updateLayoutCssVars()},e.prototype.updateLayoutCssVars=function(){var t=e.strings,n=t.VAR_FG_SIZE,r=t.VAR_LEFT,a=t.VAR_TOP,o=t.VAR_FG_SCALE;this.adapter.updateCssVariable(n,this.initialSize+"px"),this.adapter.updateCssVariable(o,this.fgScale),this.adapter.isUnbounded()&&(this.unboundedCoords={left:Math.round(this.frame.width/2-this.initialSize/2),top:Math.round(this.frame.height/2-this.initialSize/2)},this.adapter.updateCssVariable(r,this.unboundedCoords.left+"px"),this.adapter.updateCssVariable(a,this.unboundedCoords.top+"px"))},e})(D);var H=(function(i){w(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.disabled=!1,t}return e.attachTo=function(t,n){n===void 0&&(n={isUnbounded:void 0});var r=new e(t);return n.isUnbounded!==void 0&&(r.unbounded=n.isUnbounded),r},e.createAdapter=function(t){return{addClass:function(n){return t.root.classList.add(n)},browserSupportsCssVars:function(){return j(window)},computeBoundingRect:function(){return t.root.getBoundingClientRect()},containsEventTarget:function(n){return t.root.contains(n)},deregisterDocumentInteractionHandler:function(n,r){return document.documentElement.removeEventListener(n,r,g())},deregisterInteractionHandler:function(n,r){return t.root.removeEventListener(n,r,g())},deregisterResizeHandler:function(n){return window.removeEventListener("resize",n)},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}},isSurfaceActive:function(){return O(t.root,":active")},isSurfaceDisabled:function(){return!!t.disabled},isUnbounded:function(){return!!t.unbounded},registerDocumentInteractionHandler:function(n,r){return document.documentElement.addEventListener(n,r,g())},registerInteractionHandler:function(n,r){return t.root.addEventListener(n,r,g())},registerResizeHandler:function(n){return window.addEventListener("resize",n)},removeClass:function(n){return t.root.classList.remove(n)},updateCssVariable:function(n,r){return t.root.style.setProperty(n,r)}}},Object.defineProperty(e.prototype,"unbounded",{get:function(){return!!this.isUnbounded},set:function(t){this.isUnbounded=!!t,this.setUnbounded()},enumerable:!1,configurable:!0}),e.prototype.activate=function(){this.foundation.activate()},e.prototype.deactivate=function(){this.foundation.deactivate()},e.prototype.layout=function(){this.foundation.layout()},e.prototype.getDefaultFoundation=function(){return new T(e.createAdapter(this))},e.prototype.initialSyncWithDOM=function(){var t=this.root;this.isUnbounded="mdcRippleIsUnbounded"in t.dataset},e.prototype.setUnbounded=function(){this.foundation.setUnbounded(!!this.isUnbounded)},e})(_);var C={ICON_BUTTON_ON:"mdc-icon-button--on",ROOT:"mdc-icon-button"},p={ARIA_LABEL:"aria-label",ARIA_PRESSED:"aria-pressed",DATA_ARIA_LABEL_OFF:"data-aria-label-off",DATA_ARIA_LABEL_ON:"data-aria-label-on",CHANGE_EVENT:"MDCIconButtonToggle:change"};var B=(function(i){w(e,i);function e(t){var n=i.call(this,h(h({},e.defaultAdapter),t))||this;return n.hasToggledAriaLabel=!1,n}return Object.defineProperty(e,"cssClasses",{get:function(){return C},enumerable:!1,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return p},enumerable:!1,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{addClass:function(){},hasClass:function(){return!1},notifyChange:function(){},removeClass:function(){},getAttr:function(){return null},setAttr:function(){}}},enumerable:!1,configurable:!0}),e.prototype.init=function(){var t=this.adapter.getAttr(p.DATA_ARIA_LABEL_ON),n=this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);if(t&&n){if(this.adapter.getAttr(p.ARIA_PRESSED)!==null)throw new Error("MDCIconButtonToggleFoundation: Button should not set `aria-pressed` if it has a toggled aria label.");this.hasToggledAriaLabel=!0}else this.adapter.setAttr(p.ARIA_PRESSED,String(this.isOn()))},e.prototype.handleClick=function(){this.toggle(),this.adapter.notifyChange({isOn:this.isOn()})},e.prototype.isOn=function(){return this.adapter.hasClass(C.ICON_BUTTON_ON)},e.prototype.toggle=function(t){if(t===void 0&&(t=!this.isOn()),t?this.adapter.addClass(C.ICON_BUTTON_ON):this.adapter.removeClass(C.ICON_BUTTON_ON),this.hasToggledAriaLabel){var n=t?this.adapter.getAttr(p.DATA_ARIA_LABEL_ON):this.adapter.getAttr(p.DATA_ARIA_LABEL_OFF);this.adapter.setAttr(p.ARIA_LABEL,n||"")}else this.adapter.setAttr(p.ARIA_PRESSED,""+t)},e})(D);var V=B.strings,W=(function(i){w(e,i);function e(){var t=i!==null&&i.apply(this,arguments)||this;return t.rippleComponent=t.createRipple(),t}return e.attachTo=function(t){return new e(t)},e.prototype.initialSyncWithDOM=function(){var t=this;this.handleClick=function(){t.foundation.handleClick()},this.listen("click",this.handleClick)},e.prototype.destroy=function(){this.unlisten("click",this.handleClick),this.ripple.destroy(),i.prototype.destroy.call(this)},e.prototype.getDefaultFoundation=function(){var t=this,n={addClass:function(r){return t.root.classList.add(r)},hasClass:function(r){return t.root.classList.contains(r)},notifyChange:function(r){t.emit(V.CHANGE_EVENT,r)},removeClass:function(r){return t.root.classList.remove(r)},getAttr:function(r){return t.root.getAttribute(r)},setAttr:function(r,a){return t.root.setAttribute(r,a)}};return new B(n)},Object.defineProperty(e.prototype,"ripple",{get:function(){return this.rippleComponent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"on",{get:function(){return this.foundation.isOn()},set:function(t){this.foundation.toggle(t)},enumerable:!1,configurable:!0}),e.prototype.createRipple=function(){var t=new H(this.root);return t.unbounded=!0,t},e})(_);document.addEventListener("DOMContentLoaded",()=>{E(async()=>{const{autoInit:i}=await import("./vendor.js");return{autoInit:i}},[]).then(({autoInit:i})=>{i(),$(),X(),Z(),N(),Q(),J(),K()})});function X(){document.querySelectorAll(".mdc-banner").forEach(i=>{const e=i;e.classList.contains("mbc-banner--open")&&e.MDCBanner.open()})}function $(){document.querySelectorAll(".mdc-icon-button").forEach(i=>{if(i.querySelector(".mdc-icon-button__icon--on")){new W(i);return}if(i.querySelector(".mdc-icon-button__ripple")){const e=new H(i);e.unbounded=!0}})}function Z(){document.querySelectorAll(".mdc-dialog").forEach(i=>{const e=i;e.classList.contains("mdc-dialog--open")&&e.MDCDialog.open()})}function N(){document.querySelectorAll(".mdc-menu").forEach(i=>{const e=i;e.classList.contains("mdc-menu--open")&&(e.MDCMenu.open=!0)})}function J(){document.querySelectorAll(".mdc-circular-progress").forEach(i=>{const e=i;console.log(e.ariaValueNow),e.dataset.value&&(e.MDCCircularProgress.progress=parseFloat(e.dataset.value))})}function K(){document.querySelectorAll(".mdc-linear-progress").forEach(i=>{const e=i;e.dataset.value&&(e.MDCLinearProgress.progress=parseFloat(e.dataset.value)),e.dataset.bufferValue&&(e.MDCLinearProgress.buffer=parseFloat(e.dataset.bufferValue))})}function Q(){document.querySelectorAll(".mdc-snackbar").forEach(i=>{const e=i;if(i.hasAttribute("timeout")){const t=i.getAttribute("timeout");t!==null&&(e.MDCSnackbar.timeoutMs=parseInt(t,10))}i.hasAttribute("open")&&e.MDCSnackbar.open()})}export{D as M,y as _,w as a,h as b,et as c,_ as d,H as e,g as f,T as g,Y as h,tt as i,I as j,G as k,nt as l,O as m,W as n};