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,80 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**
* CSS escaper.
*/
class CSSEscaper {
/**
* Escapes CSS.
*
* Based on:
* https://github.com/mathiasbynens/CSS.escape
*
* @param cssText CSS.
* @returns Escaped CSS.
*/
static escape(cssText) {
if (arguments.length == 0) {
throw new TypeError('`CSS.escape` requires an argument.');
}
const returnValue = String(cssText);
const length = returnValue.length;
let index = -1;
let codeUnit;
let result = '';
const firstCodeUnit = returnValue.charCodeAt(0);
if (
// If the character is the first character and is a `-` (U+002D), and
// There is no second character, […]
length == 1 &&
firstCodeUnit == 0x002d) {
return '\\' + returnValue;
}
while (++index < length) {
codeUnit = returnValue.charCodeAt(index);
// Note: theres no need to special-case astral symbols, surrogate
// Pairs, or lone surrogates.
// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
// (U+FFFD).
if (codeUnit == 0x0000) {
result += '\uFFFD';
continue;
}
if (
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
// U+007F, […]
(codeUnit >= 0x0001 && codeUnit <= 0x001f) ||
codeUnit == 0x007f ||
// If the character is the first character and is in the range [0-9]
// (U+0030 to U+0039), […]
(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
// If the character is the second character and is in the range [0-9]
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
(index == 1 && codeUnit >= 0x0030 && codeUnit <= 0x0039 && firstCodeUnit == 0x002d)) {
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
result += '\\' + codeUnit.toString(16) + ' ';
continue;
}
// If the character is not handled by one of the above rules and is
// Greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
// Is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
// U+005A), or [a-z] (U+0061 to U+007A), […]
if (codeUnit >= 0x0080 ||
codeUnit == 0x002d ||
codeUnit == 0x005f ||
(codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
(codeUnit >= 0x0041 && codeUnit <= 0x005a) ||
(codeUnit >= 0x0061 && codeUnit <= 0x007a)) {
// The character itself
result += returnValue.charAt(index);
continue;
}
// Otherwise, the escaped character.
// https://drafts.csswg.org/cssom/#escape-a-character
result += '\\' + returnValue.charAt(index);
}
return result;
}
}
exports.default = CSSEscaper;
//# sourceMappingURL=CSSEscaper.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CSSEscaper.cjs","sourceRoot":"","sources":["../../../src/css/utilities/CSSEscaper.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAqB,UAAU;IAC9B;;;;;;;;OAQG;IACI,MAAM,CAAC,MAAM,CAAC,OAAe;QACnC,IAAI,SAAS,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAC3B,MAAM,IAAI,SAAS,CAAC,oCAAoC,CAAC,CAAC;QAC3D,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC;QAClC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;QACf,IAAI,QAAQ,CAAC;QACb,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,MAAM,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAEhD;QACC,qEAAqE;QACrE,oCAAoC;QACpC,MAAM,IAAI,CAAC;YACX,aAAa,IAA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AI,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,SAAS;YACV,CAAC;YAED,oCAAoC;YACpC,qDAAqD;YACrD,MAAM,IAAI,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;CACD;AAnFD,6BAmFC"}

View File

@@ -0,0 +1,16 @@
/**
* CSS escaper.
*/
export default class CSSEscaper {
/**
* Escapes CSS.
*
* Based on:
* https://github.com/mathiasbynens/CSS.escape
*
* @param cssText CSS.
* @returns Escaped CSS.
*/
static escape(cssText: string): string;
}
//# sourceMappingURL=CSSEscaper.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CSSEscaper.d.ts","sourceRoot":"","sources":["../../../src/css/utilities/CSSEscaper.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC9B;;;;;;;;OAQG;WACW,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAyE7C"}

View File

@@ -0,0 +1,248 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const CSSRule_js_1 = __importDefault(require("../CSSRule.cjs"));
const PropertySymbol = __importStar(require("../../PropertySymbol.cjs"));
const CSSStyleRule_js_1 = __importDefault(require("../rules/CSSStyleRule.cjs"));
const CSSKeyframeRule_js_1 = __importDefault(require("../rules/CSSKeyframeRule.cjs"));
const CSSKeyframesRule_js_1 = __importDefault(require("../rules/CSSKeyframesRule.cjs"));
const CSSMediaRule_js_1 = __importDefault(require("../rules/CSSMediaRule.cjs"));
const CSSContainerRule_js_1 = __importDefault(require("../rules/CSSContainerRule.cjs"));
const CSSSupportsRule_js_1 = __importDefault(require("../rules/CSSSupportsRule.cjs"));
const CSSFontFaceRule_js_1 = __importDefault(require("../rules/CSSFontFaceRule.cjs"));
const SelectorParser_js_1 = __importDefault(require("../../query-selector/SelectorParser.cjs"));
const CSSRuleTypeEnum_js_1 = __importDefault(require("../CSSRuleTypeEnum.cjs"));
const COMMENT_REGEXP = /\/\*[\s\S]*?\*\//gm;
/**
* CSS parser.
*/
class CSSParser {
/**
* Parses HTML and returns a root element.
*
* @param parentStyleSheet Parent style sheet.
* @param cssText CSS code.
* @returns Root element.
*/
static parseFromString(parentStyleSheet, cssText) {
const window = parentStyleSheet[PropertySymbol.window];
const css = cssText.replace(COMMENT_REGEXP, '');
const cssRules = [];
const regExp = /{|}/gm;
const stack = [];
let parentRule = null;
let lastIndex = 0;
let match;
while ((match = regExp.exec(css))) {
if (match[0] === '{') {
const selectorText = css.substring(lastIndex, match.index).trim();
if (selectorText[0] === '@') {
const ruleParts = selectorText.split(' ');
const ruleType = ruleParts[0];
const ruleParameters = ruleParts.slice(1).join(' ').trim();
switch (ruleType) {
case '@keyframes':
case '@-webkit-keyframes':
const keyframesRule = new CSSKeyframesRule_js_1.default(PropertySymbol.illegalConstructor, window);
keyframesRule.name = ruleParameters;
keyframesRule.parentStyleSheet = parentStyleSheet;
if (parentRule) {
if (parentRule.type === CSSRuleTypeEnum_js_1.default.mediaRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.containerRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.supportsRule) {
parentRule.cssRules.push(keyframesRule);
}
}
else {
cssRules.push(keyframesRule);
}
parentRule = keyframesRule;
break;
case '@media':
const mediums = ruleParameters.split(',');
const mediaRule = new CSSMediaRule_js_1.default(PropertySymbol.illegalConstructor, window);
for (const medium of mediums) {
mediaRule.media.appendMedium(medium.trim());
}
mediaRule.parentStyleSheet = parentStyleSheet;
if (parentRule) {
if (parentRule.type === CSSRuleTypeEnum_js_1.default.mediaRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.containerRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.supportsRule) {
parentRule.cssRules.push(mediaRule);
}
}
else {
cssRules.push(mediaRule);
}
parentRule = mediaRule;
break;
case '@container':
case '@-webkit-container':
const containerRule = new CSSContainerRule_js_1.default(PropertySymbol.illegalConstructor, window);
containerRule.conditionText = ruleParameters;
containerRule.parentStyleSheet = parentStyleSheet;
if (parentRule) {
if (parentRule.type === CSSRuleTypeEnum_js_1.default.mediaRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.containerRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.supportsRule) {
parentRule.cssRules.push(containerRule);
}
}
else {
cssRules.push(containerRule);
}
parentRule = containerRule;
break;
case '@supports':
case '@-webkit-supports':
const supportsRule = new CSSSupportsRule_js_1.default(PropertySymbol.illegalConstructor, window);
supportsRule.conditionText = ruleParameters;
supportsRule.parentStyleSheet = parentStyleSheet;
if (parentRule) {
if (parentRule.type === CSSRuleTypeEnum_js_1.default.mediaRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.containerRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.supportsRule) {
parentRule.cssRules.push(supportsRule);
}
}
else {
cssRules.push(supportsRule);
}
parentRule = supportsRule;
break;
case '@font-face':
const fontFaceRule = new CSSFontFaceRule_js_1.default(PropertySymbol.illegalConstructor, window);
fontFaceRule[PropertySymbol.cssText] = ruleParameters;
fontFaceRule.parentStyleSheet = parentStyleSheet;
if (parentRule) {
if (parentRule.type === CSSRuleTypeEnum_js_1.default.mediaRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.containerRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.supportsRule) {
parentRule.cssRules.push(fontFaceRule);
}
}
else {
cssRules.push(fontFaceRule);
}
parentRule = fontFaceRule;
break;
default:
// Unknown rule.
// We will create a new rule to let it grab its content, but we will not add it to the cssRules array.
const newRule = new CSSRule_js_1.default(PropertySymbol.illegalConstructor, window);
newRule.parentStyleSheet = parentStyleSheet;
parentRule = newRule;
break;
}
}
else if (parentRule && parentRule.type === CSSRuleTypeEnum_js_1.default.keyframesRule) {
const newRule = new CSSKeyframeRule_js_1.default(PropertySymbol.illegalConstructor, window);
newRule.keyText = selectorText.trim();
newRule.parentStyleSheet = parentStyleSheet;
newRule.parentRule = parentRule;
parentRule.cssRules.push(newRule);
parentRule = newRule;
}
else if (parentRule &&
(parentRule.type === CSSRuleTypeEnum_js_1.default.mediaRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.containerRule ||
parentRule.type === CSSRuleTypeEnum_js_1.default.supportsRule)) {
if (this.validateSelectorText(selectorText)) {
const newRule = new CSSStyleRule_js_1.default(PropertySymbol.illegalConstructor, window);
newRule.selectorText = selectorText;
newRule.parentStyleSheet = parentStyleSheet;
newRule.parentRule = parentRule;
parentRule.cssRules.push(newRule);
parentRule = newRule;
}
}
else {
if (this.validateSelectorText(selectorText)) {
const newRule = new CSSStyleRule_js_1.default(PropertySymbol.illegalConstructor, window);
newRule.selectorText = selectorText;
newRule.parentStyleSheet = parentStyleSheet;
newRule.parentRule = parentRule;
if (!parentRule) {
cssRules.push(newRule);
}
parentRule = newRule;
}
}
stack.push(parentRule);
}
else {
if (parentRule) {
const cssText = css
.substring(lastIndex, match.index)
.trim()
.replace(/([^;])$/, '$1;'); // Ensure last semicolon
switch (parentRule.type) {
case CSSRuleTypeEnum_js_1.default.fontFaceRule:
case CSSRuleTypeEnum_js_1.default.keyframeRule:
case CSSRuleTypeEnum_js_1.default.styleRule:
parentRule[PropertySymbol.cssText] = cssText;
break;
}
}
stack.pop();
parentRule = stack[stack.length - 1] || null;
}
lastIndex = match.index + 1;
}
return cssRules;
}
/**
* Validates a selector text.
*
* @see https://www.w3.org/TR/CSS21/syndata.html#rule-sets
* @param selectorText Selector text.
* @returns True if valid, false otherwise.
*/
static validateSelectorText(selectorText) {
try {
SelectorParser_js_1.default.getSelectorGroups(selectorText);
}
catch (e) {
return false;
}
return true;
}
}
exports.default = CSSParser;
//# sourceMappingURL=CSSParser.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
import CSSRule from '../CSSRule.cjs';
import CSSStyleSheet from '../CSSStyleSheet.cjs';
/**
* CSS parser.
*/
export default class CSSParser {
/**
* Parses HTML and returns a root element.
*
* @param parentStyleSheet Parent style sheet.
* @param cssText CSS code.
* @returns Root element.
*/
static parseFromString(parentStyleSheet: CSSStyleSheet, cssText: string): CSSRule[];
/**
* Validates a selector text.
*
* @see https://www.w3.org/TR/CSS21/syndata.html#rule-sets
* @param selectorText Selector text.
* @returns True if valid, false otherwise.
*/
private static validateSelectorText;
}
//# sourceMappingURL=CSSParser.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CSSParser.d.ts","sourceRoot":"","sources":["../../../src/css/utilities/CSSParser.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAC;AAEpC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAahD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IAC7B;;;;;;OAMG;WACW,eAAe,CAAC,gBAAgB,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE;IA8L1F;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;CAQnC"}