Files
headroom/frontend/node_modules/fast-check/lib/arbitrary/_internals/StringUnitArbitrary.js
Santhosh Janardhanan de2d83092e 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
2026-02-17 16:19:59 -05:00

46 lines
2.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.stringUnit = stringUnit;
const globals_1 = require("../../utils/globals");
const mapToConstant_1 = require("../mapToConstant");
const GraphemeRanges_1 = require("./data/GraphemeRanges");
const GraphemeRangesHelpers_1 = require("./helpers/GraphemeRangesHelpers");
const registeredStringUnitInstancesMap = Object.create(null);
function getAlphabetRanges(alphabet) {
switch (alphabet) {
case 'full':
return GraphemeRanges_1.fullAlphabetRanges;
case 'ascii':
return GraphemeRanges_1.asciiAlphabetRanges;
}
}
function getOrCreateStringUnitInstance(type, alphabet) {
const key = `${type}:${alphabet}`;
const registered = registeredStringUnitInstancesMap[key];
if (registered !== undefined) {
return registered;
}
const alphabetRanges = getAlphabetRanges(alphabet);
const ranges = type === 'binary' ? alphabetRanges : (0, GraphemeRangesHelpers_1.intersectGraphemeRanges)(alphabetRanges, GraphemeRanges_1.autonomousGraphemeRanges);
const entries = [];
for (const range of ranges) {
(0, globals_1.safePush)(entries, (0, GraphemeRangesHelpers_1.convertGraphemeRangeToMapToConstantEntry)(range));
}
if (type === 'grapheme') {
const decomposedRanges = (0, GraphemeRangesHelpers_1.intersectGraphemeRanges)(alphabetRanges, GraphemeRanges_1.autonomousDecomposableGraphemeRanges);
for (const range of decomposedRanges) {
const rawEntry = (0, GraphemeRangesHelpers_1.convertGraphemeRangeToMapToConstantEntry)(range);
(0, globals_1.safePush)(entries, {
num: rawEntry.num,
build: (idInGroup) => (0, globals_1.safeNormalize)(rawEntry.build(idInGroup), 'NFD'),
});
}
}
const stringUnitInstance = (0, mapToConstant_1.mapToConstant)(...entries);
registeredStringUnitInstancesMap[key] = stringUnitInstance;
return stringUnitInstance;
}
function stringUnit(type, alphabet) {
return getOrCreateStringUnitInstance(type, alphabet);
}