feat: Reinitialize frontend with SvelteKit and TypeScript

- 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
This commit is contained in:
2026-02-17 16:19:59 -05:00
parent 54df6018f5
commit de2d83092e
28274 changed files with 3816354 additions and 90 deletions

View File

@@ -0,0 +1,82 @@
import HTMLCollection from '../element/HTMLCollection.js';
import Element from '../element/Element.js';
import Node from '../node/Node.js';
import NodeList from '../node/NodeList.js';
import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
export default interface IParentNode extends Node {
readonly childElementCount: number;
readonly firstElementChild: Element;
readonly lastElementChild: Element;
readonly children: HTMLCollection<Element>;
/**
* Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
*
* @param nodes List of Node or DOMString.
*/
append(...nodes: (Node | string)[]): void;
/**
* Inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
*
* @param nodes List of Node or DOMString.
*/
prepend(...nodes: (Node | string)[]): void;
/**
* Query CSS Selector to find matching node.
*
* @param selector CSS selector.
* @returns Matching element.
*/
querySelector<K extends keyof IHTMLElementTagNameMap>(selector: K): IHTMLElementTagNameMap[K] | null;
querySelector<K extends keyof ISVGElementTagNameMap>(selector: K): ISVGElementTagNameMap[K] | null;
querySelector(selector: string): Element | null;
/**
* Query CSS selector to find matching nodes.
*
* @param selector CSS selector.
* @returns Matching elements.
*/
querySelectorAll<K extends keyof IHTMLElementTagNameMap>(selector: K): NodeList<IHTMLElementTagNameMap[K]>;
querySelectorAll<K extends keyof ISVGElementTagNameMap>(selector: K): NodeList<ISVGElementTagNameMap[K]>;
querySelectorAll(selector: string): NodeList<Element>;
/**
* Query CSS selector to find matching nodes.
*
* @param selector CSS selector.
* @returns Matching elements.
*/
querySelectorAll(selector: string): NodeList<Element>;
/**
* Returns an elements by class name.
*
* @param className Tag name.
* @returns Matching element.
*/
getElementsByClassName(className: string): HTMLCollection<Element>;
/**
* Returns an elements by tag name.
*
* @param tagName Tag name.
* @returns Matching element.
*/
getElementsByTagName<K extends keyof IHTMLElementTagNameMap>(tagName: K): HTMLCollection<IHTMLElementTagNameMap[K]>;
getElementsByTagName<K extends keyof ISVGElementTagNameMap>(tagName: K): HTMLCollection<ISVGElementTagNameMap[K]>;
getElementsByTagName(tagName: string): HTMLCollection<Element>;
/**
* Returns an elements by tag name and namespace.
*
* @param namespaceURI Namespace URI.
* @param tagName Tag name.
* @returns Matching element.
*/
getElementsByTagNameNS<K extends keyof IHTMLElementTagNameMap>(namespaceURI: 'http://www.w3.org/1999/xhtml', tagName: K): HTMLCollection<IHTMLElementTagNameMap[K]>;
getElementsByTagNameNS<K extends keyof ISVGElementTagNameMap>(namespaceURI: 'http://www.w3.org/2000/svg', tagName: K): HTMLCollection<ISVGElementTagNameMap[K]>;
getElementsByTagNameNS(namespaceURI: string, tagName: string): HTMLCollection<Element>;
/**
* Replaces the existing children of a node with a specified new set of children.
*
* @param nodes List of Node or DOMString.
*/
replaceChildren(...nodes: (Node | string)[]): void;
}
//# sourceMappingURL=IParentNode.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IParentNode.d.ts","sourceRoot":"","sources":["../../../src/nodes/parent-node/IParentNode.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAC1D,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,sBAAsB,MAAM,wCAAwC,CAAC;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M,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEtD;;;;;OAKG;IACH,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAEnE;;;;;OAKG;IACH,oBAAoB,CAAC,CAAC,SAAS,MAAM,sBAAsB,EAC1D,OAAO,EAAE,CAAC,GACR,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,oBAAoB,CAAC,CAAC,SAAS,MAAM,qBAAqB,EACzD,OAAO,EAAE,CAAC,GACR,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/D;;;;;;OAMG;IACH,sBAAsB,CAAC,CAAC,SAAS,MAAM,sBAAsB,EAC5D,YAAY,EAAE,8BAA8B,EAC5C,OAAO,EAAE,CAAC,GACR,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,sBAAsB,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC3D,YAAY,EAAE,4BAA4B,EAC1C,OAAO,EAAE,CAAC,GACR,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAEvF;;;;OAIG;IACH,eAAe,CAAC,GAAG,KAAK,EAAE,CAAC,IAAI,GAAG,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC;CACnD"}

View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=IParentNode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IParentNode.js","sourceRoot":"","sources":["../../../src/nodes/parent-node/IParentNode.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,74 @@
import DocumentFragment from '../document-fragment/DocumentFragment.js';
import Document from '../document/Document.js';
import Element from '../element/Element.js';
import Node from '../node/Node.js';
import HTMLCollection from '../element/HTMLCollection.js';
/**
* Parent node utility.
*/
export default class ParentNodeUtility {
/**
* Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
*
* @param parentNode Parent node.
* @param nodes List of Node or DOMString.
*/
static append(parentNode: Element | Document | DocumentFragment, ...nodes: any[]): void;
/**
* Inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
*
* @param parentNode Parent node.
* @param nodes List of Node or DOMString.
*/
static prepend(parentNode: Element | Document | DocumentFragment, ...nodes: (string | Node)[]): void;
/**
* Replaces the existing children of a ParentNode with a specified new set of children.
*
* @param parentNode Parent node.
* @param nodes List of Node or DOMString.
*/
static replaceChildren(parentNode: Element | Document | DocumentFragment, ...nodes: (string | Node)[]): void;
/**
* Returns an elements by class name.
*
* @param parentNode Parent node.
* @param className Tag name.
* @returns Matching element.
*/
static getElementsByClassName(parentNode: Element | DocumentFragment | Document, className: string): HTMLCollection<Element>;
/**
* Returns an elements by tag name.
*
* @param parentNode Parent node.
* @param tagName Tag name.
* @returns Matching element.
*/
static getElementsByTagName<T extends Element = Element>(parentNode: Element | DocumentFragment | Document, tagName: string): HTMLCollection<T>;
/**
* Returns an elements by tag name and namespace.
*
* @param parentNode Parent node.
* @param namespaceURI Namespace URI.
* @param tagName Tag name.
* @returns Matching element.
*/
static getElementsByTagNameNS(parentNode: Element | DocumentFragment | Document, namespaceURI: string, tagName: string): HTMLCollection<Element>;
/**
* Returns the first element matching a tag name.
* This is not part of the browser standard and is only used internally (used in Document).
*
* @param parentNode Parent node.
* @param tagName Tag name.
* @returns Matching element.
*/
static getElementByTagName(parentNode: Element | DocumentFragment | Document, tagName: string): Element;
/**
* Returns an element by ID.
*
* @param parentNode Parent node.
* @param id ID.
* @returns Matching element.
*/
static getElementById(parentNode: Element | DocumentFragment | Document, id: string): Element | null;
}
//# sourceMappingURL=ParentNodeUtility.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ParentNodeUtility.d.ts","sourceRoot":"","sources":["../../../src/nodes/parent-node/ParentNodeUtility.ts"],"names":[],"mappings":"AACA,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,IAAI,MAAM,iBAAiB,CAAC;AAEnC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAI1D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACrC;;;;;OAKG;WACW,MAAM,CAAC,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,gBAAgB,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI;IAY9F;;;;;OAKG;WACW,OAAO,CACpB,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,gBAAgB,EACjD,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GACzB,IAAI;IAcP;;;;;OAKG;WACW,eAAe,CAC5B,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,gBAAgB,EACjD,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GACzB,IAAI;IAUP;;;;;;OAMG;WACW,sBAAsB,CACnC,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,QAAQ,EACjD,SAAS,EAAE,MAAM,GACf,cAAc,CAAC,OAAO,CAAC;IAU1B;;;;;;OAMG;WACW,oBAAoB,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO,EAC7D,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,QAAQ,EACjD,OAAO,EAAE,MAAM,GACb,cAAc,CAAC,CAAC,CAAC;IAgDpB;;;;;;;OAOG;WACW,sBAAsB,CACnC,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,QAAQ,EACjD,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACb,cAAc,CAAC,OAAO,CAAC;IAwD1B;;;;;;;OAOG;WACW,mBAAmB,CAChC,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,QAAQ,EACjD,OAAO,EAAE,MAAM,GACb,OAAO;IA0CV;;;;;;OAMG;WACW,cAAc,CAC3B,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,QAAQ,EACjD,EAAE,EAAE,MAAM,GACR,OAAO,GAAG,IAAI;CAkDjB"}

View File

@@ -0,0 +1,234 @@
import * as PropertySymbol from '../../PropertySymbol.js';
import Document from '../document/Document.js';
import Node from '../node/Node.js';
import NamespaceURI from '../../config/NamespaceURI.js';
import HTMLCollection from '../element/HTMLCollection.js';
import QuerySelector from '../../query-selector/QuerySelector.js';
/**
* Parent node utility.
*/
export default class ParentNodeUtility {
/**
* Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
*
* @param parentNode Parent node.
* @param nodes List of Node or DOMString.
*/
static append(parentNode, ...nodes) {
for (const node of nodes) {
if (node instanceof Node) {
parentNode.appendChild(node);
}
else {
parentNode.appendChild(parentNode[PropertySymbol.ownerDocument].createTextNode(String(node)));
}
}
}
/**
* Inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
*
* @param parentNode Parent node.
* @param nodes List of Node or DOMString.
*/
static prepend(parentNode, ...nodes) {
const firstChild = parentNode.firstChild;
for (const node of nodes) {
if (node instanceof Node) {
parentNode.insertBefore(node, firstChild);
}
else {
parentNode.insertBefore(parentNode[PropertySymbol.ownerDocument].createTextNode(String(node)), firstChild);
}
}
}
/**
* Replaces the existing children of a ParentNode with a specified new set of children.
*
* @param parentNode Parent node.
* @param nodes List of Node or DOMString.
*/
static replaceChildren(parentNode, ...nodes) {
const childNodes = parentNode[PropertySymbol.nodeArray];
while (childNodes.length) {
parentNode.removeChild(childNodes[0]);
}
this.append(parentNode, ...nodes);
}
/**
* Returns an elements by class name.
*
* @param parentNode Parent node.
* @param className Tag name.
* @returns Matching element.
*/
static getElementsByClassName(parentNode, className) {
return new HTMLCollection(PropertySymbol.illegalConstructor, () => QuerySelector.querySelectorAll(parentNode, `.${className.replace(/\s+/gm, '.')}`)[PropertySymbol.items]);
}
/**
* Returns an elements by tag name.
*
* @param parentNode Parent node.
* @param tagName Tag name.
* @returns Matching element.
*/
static getElementsByTagName(parentNode, tagName) {
const upperTagName = tagName.toUpperCase();
const includeAll = tagName === '*';
const find = (parent, cachedResult) => {
const elements = [];
for (const element of parent[PropertySymbol.elementArray]) {
if (includeAll || element[PropertySymbol.tagName].toUpperCase() === upperTagName) {
elements.push(element);
}
element[PropertySymbol.affectsCache].push(cachedResult);
for (const foundElement of find(element, cachedResult)) {
elements.push(foundElement);
}
}
return elements;
};
const query = () => {
const cache = parentNode[PropertySymbol.cache].elementsByTagName;
const cachedItems = cache.get(tagName);
if (cachedItems?.result) {
const items = cachedItems.result.deref();
if (items) {
return items;
}
}
const cachedResult = { result: null };
const items = find(parentNode, cachedResult);
cachedResult.result = new WeakRef(items);
cache.set(tagName, cachedResult);
return items;
};
return new HTMLCollection(PropertySymbol.illegalConstructor, query);
}
/**
* Returns an elements by tag name and namespace.
*
* @param parentNode Parent node.
* @param namespaceURI Namespace URI.
* @param tagName Tag name.
* @returns Matching element.
*/
static getElementsByTagNameNS(parentNode, namespaceURI, tagName) {
// When the namespace is HTML, the tag name is case-insensitive.
const formattedTagName = namespaceURI === NamespaceURI.html &&
parentNode[PropertySymbol.ownerDocument][PropertySymbol.contentType] === 'text/html'
? tagName.toUpperCase()
: tagName;
const includeAll = tagName === '*';
const find = (parent, cachedResult) => {
const elements = [];
for (const element of parent[PropertySymbol.elementArray]) {
if ((includeAll || element[PropertySymbol.tagName] === formattedTagName) &&
element[PropertySymbol.namespaceURI] === namespaceURI) {
elements.push(element);
}
element[PropertySymbol.affectsCache].push(cachedResult);
for (const foundElement of find(element, cachedResult)) {
elements.push(foundElement);
}
}
return elements;
};
const query = () => {
const cache = parentNode[PropertySymbol.cache].elementsByTagNameNS;
const cachedItems = cache.get(tagName);
if (cachedItems?.result) {
const items = cachedItems.result.deref();
if (items) {
return items;
}
}
const cachedResult = { result: null };
const items = find(parentNode, cachedResult);
cachedResult.result = new WeakRef(items);
cache.set(tagName, cachedResult);
return items;
};
return new HTMLCollection(PropertySymbol.illegalConstructor, query);
}
/**
* Returns the first element matching a tag name.
* This is not part of the browser standard and is only used internally (used in Document).
*
* @param parentNode Parent node.
* @param tagName Tag name.
* @returns Matching element.
*/
static getElementByTagName(parentNode, tagName) {
const upperTagName = tagName.toUpperCase();
const find = (parent, cachedResult) => {
for (const element of parent[PropertySymbol.elementArray]) {
element[PropertySymbol.affectsCache].push(cachedResult);
if (element[PropertySymbol.tagName] === upperTagName) {
return element;
}
const foundElement = find(element, cachedResult);
if (foundElement) {
return foundElement;
}
}
return null;
};
const cache = parentNode[PropertySymbol.cache].elementByTagName;
const cachedItem = cache.get(tagName);
if (cachedItem?.result) {
const item = cachedItem.result.deref();
if (item) {
return item;
}
}
const cachedResult = { result: null };
const item = find(parentNode, cachedResult);
cachedResult.result = item ? new WeakRef(item) : { deref: () => null };
cache.set(tagName, cachedResult);
return item;
}
/**
* Returns an element by ID.
*
* @param parentNode Parent node.
* @param id ID.
* @returns Matching element.
*/
static getElementById(parentNode, id) {
id = String(id);
if (parentNode instanceof Document) {
const entry = parentNode[PropertySymbol.elementIdMap].get(id);
if (entry?.elements.length > 0) {
return entry.elements[0];
}
return null;
}
const find = (parent, cachedResult) => {
for (const element of parent[PropertySymbol.elementArray]) {
element[PropertySymbol.affectsCache].push(cachedResult);
if (element.getAttribute('id') === id) {
return element;
}
const foundElement = find(element, cachedResult);
if (foundElement) {
return foundElement;
}
}
return null;
};
const cache = parentNode[PropertySymbol.cache].elementById;
const cachedItem = cache.get(id);
if (cachedItem?.result) {
const item = cachedItem.result.deref();
if (item) {
return item;
}
}
const cachedResult = { result: null };
const item = find(parentNode, cachedResult);
cachedResult.result = item ? new WeakRef(item) : { deref: () => null };
cache.set(id, cachedResult);
return item;
}
}
//# sourceMappingURL=ParentNodeUtility.js.map

File diff suppressed because one or more lines are too long