diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:10:59 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-05-18 23:41:44 +0800 |
| commit | fc87c009806dcc98867f6b58efe29b042aa01dee (patch) | |
| tree | 8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/swup/src/modules/Classes.ts | |
| parent | 3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff) | |
node: updatemain
Diffstat (limited to 'node_modules/swup/src/modules/Classes.ts')
| -rw-r--r-- | node_modules/swup/src/modules/Classes.ts | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/node_modules/swup/src/modules/Classes.ts b/node_modules/swup/src/modules/Classes.ts deleted file mode 100644 index 7e034511..00000000 --- a/node_modules/swup/src/modules/Classes.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type Swup from '../Swup.js'; -import { queryAll } from '../utils.js'; - -export class Classes { - protected swup: Swup; - protected swupClasses = [ - 'to-', - 'is-changing', - 'is-rendering', - 'is-popstate', - 'is-animating', - 'is-leaving' - ]; - - constructor(swup: Swup) { - this.swup = swup; - } - - protected get selectors(): string[] { - const { scope } = this.swup.visit.animation; - if (scope === 'containers') return this.swup.visit.containers; - if (scope === 'html') return ['html']; - if (Array.isArray(scope)) return scope; - return []; - } - - protected get selector(): string { - return this.selectors.join(','); - } - - protected get targets(): HTMLElement[] { - if (!this.selector.trim()) return []; - return queryAll(this.selector); - } - - add(...classes: string[]): void { - this.targets.forEach((target) => target.classList.add(...classes)); - } - - remove(...classes: string[]): void { - this.targets.forEach((target) => target.classList.remove(...classes)); - } - - clear(): void { - this.targets.forEach((target) => { - const remove = target.className.split(' ').filter((c) => this.isSwupClass(c)); - target.classList.remove(...remove); - }); - } - - protected isSwupClass(className: string): boolean { - return this.swupClasses.some((c) => className.startsWith(c)); - } -} |
