- Delete old Vite+Svelte frontend - Initialize new SvelteKit project with TypeScript - Configure Tailwind CSS v4 + DaisyUI - Implement JWT authentication with auto-refresh - Create login page with form validation (Zod) - Add protected route guards - Update Docker configuration for single-stage build - Add E2E tests with Playwright (6/11 passing) - Fix Svelte 5 reactivity with $state() runes Known issues: - 5 E2E tests failing (timing/async issues) - Token refresh implementation needs debugging - Validation error display timing
94 lines
3.3 KiB
JavaScript
94 lines
3.3 KiB
JavaScript
import * as PropertySymbol from '../PropertySymbol.js';
|
|
/**
|
|
* SVG Animated Enumaration.
|
|
*
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/SVGAnimatedEnumeration
|
|
*/
|
|
export default class SVGAnimatedEnumeration {
|
|
// Internal properties
|
|
[PropertySymbol.window];
|
|
[PropertySymbol.getAttribute];
|
|
[PropertySymbol.setAttribute];
|
|
[PropertySymbol.values];
|
|
[PropertySymbol.defaultValue];
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param illegalConstructorSymbol Illegal constructor symbol.
|
|
* @param window Window.
|
|
* @param options Options.
|
|
* @param options.getAttribute Get attribute.
|
|
* @param options.setAttribute Set attribute.
|
|
* @param options.values Values.
|
|
* @param options.defaultValue Default value.
|
|
*/
|
|
constructor(illegalConstructorSymbol, window, options) {
|
|
if (illegalConstructorSymbol !== PropertySymbol.illegalConstructor) {
|
|
throw new TypeError('Illegal constructor');
|
|
}
|
|
this[PropertySymbol.window] = window;
|
|
this[PropertySymbol.getAttribute] = options.getAttribute;
|
|
this[PropertySymbol.setAttribute] = options.setAttribute;
|
|
this[PropertySymbol.values] = options.values;
|
|
this[PropertySymbol.defaultValue] = options.defaultValue;
|
|
}
|
|
/**
|
|
* Returns animated value.
|
|
*
|
|
* @returns Animated value.
|
|
*/
|
|
get animVal() {
|
|
return this.baseVal;
|
|
}
|
|
/**
|
|
* Returns animated value.
|
|
*
|
|
* @param _value Animated value.
|
|
*/
|
|
set animVal(_value) {
|
|
// Do nothing
|
|
}
|
|
/**
|
|
* Returns base value.
|
|
*
|
|
* @returns Base value.
|
|
*/
|
|
get baseVal() {
|
|
const value = this[PropertySymbol.getAttribute]();
|
|
if (!value) {
|
|
return this[PropertySymbol.values].indexOf(this[PropertySymbol.defaultValue]) + 1;
|
|
}
|
|
const index = this[PropertySymbol.values].indexOf(value);
|
|
if (index === -1) {
|
|
const anyValueIndex = this[PropertySymbol.values].indexOf(null);
|
|
return anyValueIndex !== -1 ? anyValueIndex + 1 : 0;
|
|
}
|
|
return index + 1;
|
|
}
|
|
/**
|
|
* Sets base value.
|
|
*
|
|
* @param value Base value.
|
|
*/
|
|
set baseVal(value) {
|
|
let parsedValue = Number(value);
|
|
if (isNaN(parsedValue)) {
|
|
parsedValue = 0;
|
|
}
|
|
if (parsedValue < 1) {
|
|
throw new TypeError(`Failed to set the 'baseVal' property on 'SVGAnimatedEnumeration': The enumeration value provided is ${parsedValue}, which is not settable.`);
|
|
}
|
|
if (parsedValue > this[PropertySymbol.values].length) {
|
|
throw new TypeError(`Failed to set the 'baseVal' property on 'SVGAnimatedEnumeration': The enumeration value provided (${parsedValue}) is larger than the largest allowed value (${this[PropertySymbol.values].length}).`);
|
|
}
|
|
const currentValue = this[PropertySymbol.getAttribute]();
|
|
const isAnyValue = this[PropertySymbol.values][parsedValue - 1] === null;
|
|
const newValue = isAnyValue ? '0' : this[PropertySymbol.values][parsedValue - 1];
|
|
if (!currentValue ||
|
|
(isAnyValue && this[PropertySymbol.values].includes(currentValue)) ||
|
|
(!isAnyValue && currentValue !== newValue)) {
|
|
this[PropertySymbol.setAttribute](newValue);
|
|
}
|
|
}
|
|
}
|
|
//# sourceMappingURL=SVGAnimatedEnumeration.js.map
|