- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
113 lines
3.4 KiB
JavaScript
113 lines
3.4 KiB
JavaScript
import CSSKeywordValue from './CSSKeywordValue.js';
|
|
import CSSStyleValue from './CSSStyleValue.js';
|
|
import * as PropertySymbol from '../../PropertySymbol.js';
|
|
/**
|
|
* StylePropertyMapReadOnly interface.
|
|
*
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/StylePropertyMapReadOnly
|
|
*/
|
|
export default class StylePropertyMapReadOnly {
|
|
[PropertySymbol.style];
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param illegalConstructorSymbol Illegal constructor symbol.
|
|
* @param style Style.
|
|
*/
|
|
constructor(illegalConstructorSymbol, style) {
|
|
if (illegalConstructorSymbol !== PropertySymbol.illegalConstructor) {
|
|
throw new TypeError('Illegal constructor');
|
|
}
|
|
this[PropertySymbol.style] = style;
|
|
}
|
|
/**
|
|
* Returns size.
|
|
*
|
|
* @returns Size.
|
|
*/
|
|
get size() {
|
|
return this[PropertySymbol.style].length;
|
|
}
|
|
/**
|
|
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
|
|
*
|
|
* @returns Iterator.
|
|
*/
|
|
[Symbol.iterator]() {
|
|
return this.entries();
|
|
}
|
|
/**
|
|
* Returns an iterator, allowing you to go through all key/value pairs contained in this object.
|
|
*
|
|
* @returns Entries.
|
|
*/
|
|
entries() {
|
|
const length = this[PropertySymbol.style].length;
|
|
const array = new Array(length);
|
|
for (let i = 0; i < length; i++) {
|
|
const property = this[PropertySymbol.style][i];
|
|
array[i] = [
|
|
property,
|
|
[new CSSKeywordValue(this[PropertySymbol.style].getPropertyValue(property))]
|
|
];
|
|
}
|
|
return array.values();
|
|
}
|
|
/**
|
|
* Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
|
|
*
|
|
* @returns Values.
|
|
*/
|
|
values() {
|
|
const length = this[PropertySymbol.style].length;
|
|
const array = new Array(length);
|
|
for (let i = 0; i < length; i++) {
|
|
const property = this[PropertySymbol.style][i];
|
|
array[i] = [new CSSKeywordValue(this[PropertySymbol.style].getPropertyValue(property))];
|
|
}
|
|
return array.values();
|
|
}
|
|
/**
|
|
* Returns an iterator, allowing you to go through all keys of the key/value pairs contained in this object.
|
|
*
|
|
* @returns Keys.
|
|
*/
|
|
keys() {
|
|
const length = this[PropertySymbol.style].length;
|
|
const array = new Array(length);
|
|
for (let i = 0; i < length; i++) {
|
|
array[i] = this[PropertySymbol.style][i];
|
|
}
|
|
return array.values();
|
|
}
|
|
/**
|
|
* Returns a property value.
|
|
*
|
|
* @param property Property.
|
|
* @returns Value.
|
|
*/
|
|
get(property) {
|
|
return new CSSStyleValue(PropertySymbol.illegalConstructor, this[PropertySymbol.style], property);
|
|
}
|
|
/**
|
|
* Returns array of property values.
|
|
*
|
|
* @param property Property.
|
|
* @returns Values.
|
|
*/
|
|
getAll(property) {
|
|
return [
|
|
new CSSStyleValue(PropertySymbol.illegalConstructor, this[PropertySymbol.style], property)
|
|
];
|
|
}
|
|
/**
|
|
* Checks if a property is present.
|
|
*
|
|
* @param property Property.
|
|
* @returns True if the property is present.
|
|
*/
|
|
has(property) {
|
|
return !!this[PropertySymbol.style].getPropertyValue(property);
|
|
}
|
|
}
|
|
//# sourceMappingURL=StylePropertyMapReadOnly.js.map
|