From bb89f999b1615c2dc9e1a081220b75b5b9ba154f Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 1 Oct 2026 09:27:20 -0400 Subject: [PATCH 01/15] test --- test.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.md diff --git a/test.md b/test.md new file mode 100644 index 0000000..30d74d2 --- /dev/null +++ b/test.md @@ -0,0 +1 @@ +test \ No newline at end of file From 6f685fb42d1b04c7b582a3b96eb5a4b4c0e13865 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Sun, 25 Oct 2026 19:17:53 -0400 Subject: [PATCH 02/15] feat: starter code for the mini algo --- mini-algo/index.ts | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 mini-algo/index.ts diff --git a/mini-algo/index.ts b/mini-algo/index.ts new file mode 100644 index 0000000..2986590 --- /dev/null +++ b/mini-algo/index.ts @@ -0,0 +1,82 @@ +'use strict'; + +import assert from 'node:assert/strict'; +import { pathToFileURL } from 'node:url'; + +const SQUARE_INCHES = 45; + +interface Sticker { + name: string; + sizeArea: number; + description: string; + tags: string[]; + id: string; + categorySection: string; + hpglFilePath: string; + svgLocation: string; +} + +interface StagingArea { + accountId: string; + stickers: Sticker[]; +} + +const sticker: Sticker = { + name: '', + sizeArea: 3, + description: '', + tags: [], + id: '', + categorySection: '', + hpglFilePath: '', + svgLocation: '', +}; + +const staging_area: StagingArea = { + accountId: '', + stickers: [{ ...sticker, sizeArea: 42 }], +}; + +function fitTest( + stagingArea: Pick, + stickerToAdd: Sticker | null | undefined, +): boolean { + if (!stickerToAdd) { + return false; + } + + const existingArea = stagingArea.stickers.reduce((totalArea, currentSticker) => { + return totalArea + currentSticker.sizeArea; + }, 0); + + const stickerArea = stickerToAdd.sizeArea; + if (existingArea + stickerArea > SQUARE_INCHES) { + return false; + } + + stagingArea.stickers.push(stickerToAdd); + return true; +} + +function testFitTest(): void { + const fittingArea = { stickers: [{ ...sticker, sizeArea: 42 }] }; + assert.equal(fitTest(fittingArea, { ...sticker, sizeArea: 3 }), true); + assert.equal(fittingArea.stickers.length, 2); + + const fullArea = { stickers: [{ ...sticker, sizeArea: 42 }] }; + assert.equal(fitTest(fullArea, { ...sticker, sizeArea: 4 }), false); + assert.equal(fullArea.stickers.length, 1); + assert.equal(fitTest(fullArea, null), false); +} + +function main(): void { + testFitTest(); + + console.log('fitTest checks passed.'); +} + +if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { + main(); +} + +export { fitTest, sticker }; From 305cff79f8e3345143def8bfcd837ae36dd41e0c Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Tue, 27 Oct 2026 17:48:44 -0400 Subject: [PATCH 03/15] feat: moving things to appropriate folders --- mini-algo/index.ts => frontend/src/mini-algo.tsx | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mini-algo/index.ts => frontend/src/mini-algo.tsx (100%) diff --git a/mini-algo/index.ts b/frontend/src/mini-algo.tsx similarity index 100% rename from mini-algo/index.ts rename to frontend/src/mini-algo.tsx From 38a2d5c7d8268f009d3a667a900d245d12e9669c Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 29 Oct 2026 16:32:35 -0400 Subject: [PATCH 04/15] feat: adding X stickers to remove functionality --- frontend/src/mini-algo.tsx | 241 ++++++++++++++++++++++++++++++++++--- 1 file changed, 225 insertions(+), 16 deletions(-) diff --git a/frontend/src/mini-algo.tsx b/frontend/src/mini-algo.tsx index 2986590..a17cde2 100644 --- a/frontend/src/mini-algo.tsx +++ b/frontend/src/mini-algo.tsx @@ -16,11 +16,25 @@ interface Sticker { svgLocation: string; } +interface StickerSelection { + id: string; + sticker: Sticker; + quantity: number; +} + interface StagingArea { accountId: string; - stickers: Sticker[]; + stickers: StickerSelection[]; +} + +interface FitTestResult { + fits: boolean; + stickersToRemove: StickerSelection[][]; } +const MAX_REMOVAL_OPTIONS = 5; +const MAX_STICKERS_PER_REMOVAL_OPTION = 3; + const sticker: Sticker = { name: '', sizeArea: 3, @@ -32,41 +46,236 @@ const sticker: Sticker = { svgLocation: '', }; +const sticker_selection: StickerSelection = { + id: '', + sticker, + quantity: 1, +}; + const staging_area: StagingArea = { accountId: '', - stickers: [{ ...sticker, sizeArea: 42 }], + stickers: [{ ...sticker_selection, sticker: { ...sticker, sizeArea: 42 } }], }; function fitTest( stagingArea: Pick, - stickerToAdd: Sticker | null | undefined, -): boolean { + stickerToAdd: StickerSelection | null | undefined, +): FitTestResult { if (!stickerToAdd) { - return false; + return { fits: false, stickersToRemove: [] }; } const existingArea = stagingArea.stickers.reduce((totalArea, currentSticker) => { - return totalArea + currentSticker.sizeArea; + return totalArea + currentSticker.sticker.sizeArea * currentSticker.quantity; }, 0); - const stickerArea = stickerToAdd.sizeArea; - if (existingArea + stickerArea > SQUARE_INCHES) { - return false; + const stickerArea = stickerToAdd.sticker.sizeArea * stickerToAdd.quantity; + if (stickerArea > SQUARE_INCHES) { + return { fits: false, stickersToRemove: [] }; + } + + const excessArea = existingArea + stickerArea - SQUARE_INCHES; + if (excessArea > 0) { + const candidates = stagingArea.stickers + .map((selection, index) => ({ + selection, + index, + area: selection.sticker.sizeArea * selection.quantity, + })) + .sort((left, right) => right.area - left.area); + for ( + let selectionCount = 1; + selectionCount <= Math.min(candidates.length, MAX_STICKERS_PER_REMOVAL_OPTION); + selectionCount++ + ) { + const options: StickerSelection[][] = []; + const selected: typeof candidates = []; + + function collectOptions(startIndex: number, freedArea: number): void { + if (options.length >= MAX_REMOVAL_OPTIONS) { + return; + } + + if (selected.length === selectionCount) { + if (freedArea >= excessArea) { + options.push( + [...selected] + .sort((left, right) => left.index - right.index) + .map(({ selection }) => selection), + ); + } + return; + } + + const remainingCount = selectionCount - selected.length; + if (candidates.length - startIndex < remainingCount) { + return; + } + + let maximumRemainingArea = 0; + for (let index = startIndex; index < startIndex + remainingCount; index++) { + maximumRemainingArea += candidates[index].area; + } + if (freedArea + maximumRemainingArea < excessArea) { + return; + } + + for ( + let index = startIndex; + index <= candidates.length - remainingCount && + options.length < MAX_REMOVAL_OPTIONS; + index++ + ) { + selected.push(candidates[index]); + collectOptions(index + 1, freedArea + candidates[index].area); + selected.pop(); + } + } + + collectOptions(0, 0); + if (options.length > 0) { + return { fits: false, stickersToRemove: options }; + } + } + + return { fits: false, stickersToRemove: [] }; } stagingArea.stickers.push(stickerToAdd); - return true; + return { fits: true, stickersToRemove: [] }; } + + + + +//test function testFitTest(): void { - const fittingArea = { stickers: [{ ...sticker, sizeArea: 42 }] }; - assert.equal(fitTest(fittingArea, { ...sticker, sizeArea: 3 }), true); + const fittingArea = { + stickers: [...staging_area.stickers], + }; + assert.deepEqual( + fitTest(fittingArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 3 }, + }), + { fits: true, stickersToRemove: [] }, + ); assert.equal(fittingArea.stickers.length, 2); - const fullArea = { stickers: [{ ...sticker, sizeArea: 42 }] }; - assert.equal(fitTest(fullArea, { ...sticker, sizeArea: 4 }), false); + const fullArea = { + stickers: [{ ...sticker_selection, sticker: { ...sticker, sizeArea: 42 } }], + }; + const stickerToAdd = { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 4 }, + }; + assert.deepEqual(fitTest(fullArea, stickerToAdd), { + fits: false, + stickersToRemove: [[...fullArea.stickers]], + }); assert.equal(fullArea.stickers.length, 1); - assert.equal(fitTest(fullArea, null), false); + assert.deepEqual(fitTest(fullArea, null), { fits: false, stickersToRemove: [] }); + + const quantityArea = { stickers: [] }; + assert.deepEqual( + fitTest(quantityArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 23 }, + quantity: 2, + }), + { fits: false, stickersToRemove: [] }, + ); + + const multipleSelectionsArea = { + stickers: [ + { ...sticker_selection, sticker: { ...sticker, sizeArea: 10 } }, + { ...sticker_selection, id: 'second', sticker: { ...sticker, sizeArea: 20 } }, + ], + }; + const suggestions = fitTest(multipleSelectionsArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 36 }, + }); + assert.deepEqual(suggestions, { + fits: false, + stickersToRemove: [[...multipleSelectionsArea.stickers]], + }); + assert.equal(multipleSelectionsArea.stickers.length, 2); + + const singleOptionArea = { + stickers: [ + { ...sticker_selection, id: 'small', sticker: { ...sticker, sizeArea: 2 } }, + { ...sticker_selection, id: 'large', sticker: { ...sticker, sizeArea: 20 } }, + ], + }; + assert.deepEqual( + fitTest(singleOptionArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 30 }, + }), + { + fits: false, + stickersToRemove: [[singleOptionArea.stickers[1]]], + }, + ); + + const alternateOptionsArea = { + stickers: [ + { ...sticker_selection, id: 'first', sticker: { ...sticker, sizeArea: 20 } }, + { ...sticker_selection, id: 'second', sticker: { ...sticker, sizeArea: 20 } }, + { ...sticker_selection, id: 'third', sticker: { ...sticker, sizeArea: 10 } }, + ], + }; + const alternateOptions = fitTest(alternateOptionsArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 20 }, + }); + assert.deepEqual(alternateOptions.stickersToRemove, [ + [alternateOptionsArea.stickers[0], alternateOptionsArea.stickers[1]], + [alternateOptionsArea.stickers[0], alternateOptionsArea.stickers[2]], + [alternateOptionsArea.stickers[1], alternateOptionsArea.stickers[2]], + ]); + + const cappedOptionsArea = { + stickers: Array.from({ length: 12 }, (_, index) => ({ + ...sticker_selection, + id: `sticker-${index}`, + sticker: { ...sticker, sizeArea: 5 }, + })), + }; + const cappedOptions = fitTest(cappedOptionsArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 3 }, + }); + assert.deepEqual(cappedOptions.stickersToRemove, []); + + const cappedOptionCountArea = { + stickers: Array.from({ length: 5 }, (_, index) => ({ + ...sticker_selection, + id: `option-${index}`, + sticker: { ...sticker, sizeArea: 20 }, + })), + }; + const cappedOptionCount = fitTest(cappedOptionCountArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 5 }, + }); + assert.equal(cappedOptionCount.stickersToRemove.length, MAX_REMOVAL_OPTIONS); + assert(cappedOptionCount.stickersToRemove.every( + (option) => option.length <= MAX_STICKERS_PER_REMOVAL_OPTION, + )); + + const impossibleArea = { + stickers: [{ ...sticker_selection, sticker: { ...sticker, sizeArea: 3 } }], + }; + assert.deepEqual( + fitTest(impossibleArea, { + ...sticker_selection, + sticker: { ...sticker, sizeArea: 46 }, + }), + { fits: false, stickersToRemove: [] }, + ); } function main(): void { @@ -79,4 +288,4 @@ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) main(); } -export { fitTest, sticker }; +export { fitTest, sticker, sticker_selection }; From dd9e25f12cd64214abd5749a947cb871763bc5ac Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 29 Oct 2026 17:04:20 -0400 Subject: [PATCH 05/15] feat: adding comments and fixing file type --- frontend/src/{mini-algo.tsx => mini-algo.ts} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename frontend/src/{mini-algo.tsx => mini-algo.ts} (98%) diff --git a/frontend/src/mini-algo.tsx b/frontend/src/mini-algo.ts similarity index 98% rename from frontend/src/mini-algo.tsx rename to frontend/src/mini-algo.ts index a17cde2..df05c46 100644 --- a/frontend/src/mini-algo.tsx +++ b/frontend/src/mini-algo.ts @@ -74,6 +74,7 @@ function fitTest( return { fits: false, stickersToRemove: [] }; } + //Stuff for seeing what stickers could be removed const excessArea = existingArea + stickerArea - SQUARE_INCHES; if (excessArea > 0) { const candidates = stagingArea.stickers @@ -91,6 +92,8 @@ function fitTest( const options: StickerSelection[][] = []; const selected: typeof candidates = []; + + //cool recursive thing you can do inside of functions function collectOptions(startIndex: number, freedArea: number): void { if (options.length >= MAX_REMOVAL_OPTIONS) { return; @@ -99,7 +102,7 @@ function fitTest( if (selected.length === selectionCount) { if (freedArea >= excessArea) { options.push( - [...selected] + [...selected] // shalow copy .sort((left, right) => left.index - right.index) .map(({ selection }) => selection), ); @@ -132,6 +135,8 @@ function fitTest( } } + + collectOptions(0, 0); if (options.length > 0) { return { fits: false, stickersToRemove: options }; From 91e512938ac566fa450fbbfa8b188339dcaba969 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 29 Oct 2026 17:13:04 -0400 Subject: [PATCH 06/15] bug: removing test file --- test.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.md diff --git a/test.md b/test.md deleted file mode 100644 index 30d74d2..0000000 --- a/test.md +++ /dev/null @@ -1 +0,0 @@ -test \ No newline at end of file From 31b9053b32f9cb1795ca65173c958188ce31abec Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 29 Oct 2026 17:33:11 -0400 Subject: [PATCH 07/15] feat: moving stuff --- frontend/package.json | 1 + frontend/src/mini-algo.test.ts | 138 ++++++++++++++++++++++++ frontend/src/mini-algo.ts | 189 +++------------------------------ 3 files changed, 153 insertions(+), 175 deletions(-) create mode 100644 frontend/src/mini-algo.test.ts diff --git a/frontend/package.json b/frontend/package.json index 612f818..292bc5c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,6 +7,7 @@ "dev": "vite", "build": "tsc -b && vite build", "lint": "oxlint", + "test": "node --test src/mini-algo.test.ts", "preview": "vite preview" }, "dependencies": { diff --git a/frontend/src/mini-algo.test.ts b/frontend/src/mini-algo.test.ts new file mode 100644 index 0000000..79e487a --- /dev/null +++ b/frontend/src/mini-algo.test.ts @@ -0,0 +1,138 @@ +/// + +import assert from 'node:assert/strict'; +import test from 'node:test'; +import { + fitTest, + STAGING_AREA_CAPACITY, + type Sticker, + type StickerSelection, +} from './mini-algo.ts'; + +const baseSticker: Sticker = { + name: '', + sizeArea: 3, + description: '', + tags: [], + id: '', + categorySection: '', + hpglFilePath: '', + svgLocation: '', +}; + +function selection(id: string, sizeArea: number, quantity = 1): StickerSelection { + return { + id, + sticker: { ...baseSticker, id, sizeArea }, + quantity, + }; +} + + +// tests moved into their own file using github copilot (and turned into actual tests) +test('accepts a sticker that fits without mutating the staging area', () => { + const existing = selection('existing', 42); + const stagingArea = { stickers: [existing] }; + + assert.deepEqual(fitTest(stagingArea, selection('new', 3)), { + fits: true, + stickersToRemove: [], + }); + assert.deepEqual(stagingArea.stickers, [existing]); +}); + +test('suggests removing existing stickers when the area is full', () => { + const existing = selection('existing', 42); + const stagingArea = { stickers: [existing] }; + + assert.deepEqual(fitTest(stagingArea, selection('new', 4)), { + fits: false, + stickersToRemove: [[existing]], + }); + assert.deepEqual(stagingArea.stickers, [existing]); +}); + +test('rejects a missing sticker', () => { + assert.deepEqual(fitTest({ stickers: [] }, null), { + fits: false, + stickersToRemove: [], + }); + assert.deepEqual(fitTest({ stickers: [] }, undefined), { + fits: false, + stickersToRemove: [], + }); +}); + +test('rejects a sticker quantity that exceeds capacity', () => { + assert.deepEqual(fitTest({ stickers: [] }, selection('too-large', 23, 2)), { + fits: false, + stickersToRemove: [], + }); +}); + +test('suggests combinations of existing stickers when needed', () => { + const first = selection('first', 10); + const second = selection('second', 20); + const stagingArea = { stickers: [first, second] }; + + assert.deepEqual(fitTest(stagingArea, selection('new', 36)), { + fits: false, + stickersToRemove: [[first, second]], + }); +}); + +test('prefers the smallest removal option and preserves staging order', () => { + const small = selection('small', 2); + const large = selection('large', 20); + + assert.deepEqual(fitTest({ stickers: [small, large] }, selection('new', 30)), { + fits: false, + stickersToRemove: [[large]], + }); +}); + +test('returns alternate removal combinations in staging order', () => { + const first = selection('first', 20); + const second = selection('second', 20); + const third = selection('third', 10); + + assert.deepEqual( + fitTest({ stickers: [first, second, third] }, selection('new', 20)), + { + fits: false, + stickersToRemove: [ + [first, second], + [first, third], + [second, third], + ], + }, + ); +}); + +test('only suggests removing up to three stickers', () => { + const stickers = Array.from({ length: 12 }, (_, index) => + selection(`sticker-${index}`, 5), + ); + + assert.deepEqual(fitTest({ stickers }, selection('new', 3)), { + fits: false, + stickersToRemove: [], + }); +}); + +test('caps removal suggestions at five options', () => { + const stickers = Array.from({ length: 5 }, (_, index) => + selection(`option-${index}`, 20), + ); + const result = fitTest({ stickers }, selection('new', 5)); + + assert.equal(result.stickersToRemove.length, 5); + assert(result.stickersToRemove.every((option) => option.length <= 3)); +}); + +test('rejects a sticker larger than the staging area capacity', () => { + assert.deepEqual( + fitTest({ stickers: [selection('existing', 3)] }, selection('too-large', STAGING_AREA_CAPACITY + 1)), + { fits: false, stickersToRemove: [] }, + ); +}); diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index df05c46..58adb7f 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -1,11 +1,8 @@ -'use strict'; - -import assert from 'node:assert/strict'; -import { pathToFileURL } from 'node:url'; - -const SQUARE_INCHES = 45; +export const STAGING_AREA_CAPACITY = 45; +const MAX_REMOVAL_OPTIONS = 5; +const MAX_STICKERS_PER_REMOVAL_OPTION = 3; -interface Sticker { +export interface Sticker { name: string; sizeArea: number; description: string; @@ -16,26 +13,23 @@ interface Sticker { svgLocation: string; } -interface StickerSelection { +export interface StickerSelection { id: string; sticker: Sticker; quantity: number; } -interface StagingArea { +export interface StagingArea { accountId: string; stickers: StickerSelection[]; } -interface FitTestResult { +export interface FitTestResult { fits: boolean; stickersToRemove: StickerSelection[][]; } -const MAX_REMOVAL_OPTIONS = 5; -const MAX_STICKERS_PER_REMOVAL_OPTION = 3; - -const sticker: Sticker = { +export const sticker: Sticker = { name: '', sizeArea: 3, description: '', @@ -46,18 +40,13 @@ const sticker: Sticker = { svgLocation: '', }; -const sticker_selection: StickerSelection = { +export const sticker_selection: StickerSelection = { id: '', sticker, quantity: 1, }; -const staging_area: StagingArea = { - accountId: '', - stickers: [{ ...sticker_selection, sticker: { ...sticker, sizeArea: 42 } }], -}; - -function fitTest( +export function fitTest( stagingArea: Pick, stickerToAdd: StickerSelection | null | undefined, ): FitTestResult { @@ -70,12 +59,11 @@ function fitTest( }, 0); const stickerArea = stickerToAdd.sticker.sizeArea * stickerToAdd.quantity; - if (stickerArea > SQUARE_INCHES) { + if (stickerArea > STAGING_AREA_CAPACITY) { return { fits: false, stickersToRemove: [] }; } - //Stuff for seeing what stickers could be removed - const excessArea = existingArea + stickerArea - SQUARE_INCHES; + const excessArea = existingArea + stickerArea - STAGING_AREA_CAPACITY; if (excessArea > 0) { const candidates = stagingArea.stickers .map((selection, index) => ({ @@ -84,6 +72,7 @@ function fitTest( area: selection.sticker.sizeArea * selection.quantity, })) .sort((left, right) => right.area - left.area); + for ( let selectionCount = 1; selectionCount <= Math.min(candidates.length, MAX_STICKERS_PER_REMOVAL_OPTION); @@ -92,8 +81,6 @@ function fitTest( const options: StickerSelection[][] = []; const selected: typeof candidates = []; - - //cool recursive thing you can do inside of functions function collectOptions(startIndex: number, freedArea: number): void { if (options.length >= MAX_REMOVAL_OPTIONS) { return; @@ -102,7 +89,7 @@ function fitTest( if (selected.length === selectionCount) { if (freedArea >= excessArea) { options.push( - [...selected] // shalow copy + [...selected] .sort((left, right) => left.index - right.index) .map(({ selection }) => selection), ); @@ -135,8 +122,6 @@ function fitTest( } } - - collectOptions(0, 0); if (options.length > 0) { return { fits: false, stickersToRemove: options }; @@ -146,151 +131,5 @@ function fitTest( return { fits: false, stickersToRemove: [] }; } - stagingArea.stickers.push(stickerToAdd); return { fits: true, stickersToRemove: [] }; } - - - - - -//test -function testFitTest(): void { - const fittingArea = { - stickers: [...staging_area.stickers], - }; - assert.deepEqual( - fitTest(fittingArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 3 }, - }), - { fits: true, stickersToRemove: [] }, - ); - assert.equal(fittingArea.stickers.length, 2); - - const fullArea = { - stickers: [{ ...sticker_selection, sticker: { ...sticker, sizeArea: 42 } }], - }; - const stickerToAdd = { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 4 }, - }; - assert.deepEqual(fitTest(fullArea, stickerToAdd), { - fits: false, - stickersToRemove: [[...fullArea.stickers]], - }); - assert.equal(fullArea.stickers.length, 1); - assert.deepEqual(fitTest(fullArea, null), { fits: false, stickersToRemove: [] }); - - const quantityArea = { stickers: [] }; - assert.deepEqual( - fitTest(quantityArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 23 }, - quantity: 2, - }), - { fits: false, stickersToRemove: [] }, - ); - - const multipleSelectionsArea = { - stickers: [ - { ...sticker_selection, sticker: { ...sticker, sizeArea: 10 } }, - { ...sticker_selection, id: 'second', sticker: { ...sticker, sizeArea: 20 } }, - ], - }; - const suggestions = fitTest(multipleSelectionsArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 36 }, - }); - assert.deepEqual(suggestions, { - fits: false, - stickersToRemove: [[...multipleSelectionsArea.stickers]], - }); - assert.equal(multipleSelectionsArea.stickers.length, 2); - - const singleOptionArea = { - stickers: [ - { ...sticker_selection, id: 'small', sticker: { ...sticker, sizeArea: 2 } }, - { ...sticker_selection, id: 'large', sticker: { ...sticker, sizeArea: 20 } }, - ], - }; - assert.deepEqual( - fitTest(singleOptionArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 30 }, - }), - { - fits: false, - stickersToRemove: [[singleOptionArea.stickers[1]]], - }, - ); - - const alternateOptionsArea = { - stickers: [ - { ...sticker_selection, id: 'first', sticker: { ...sticker, sizeArea: 20 } }, - { ...sticker_selection, id: 'second', sticker: { ...sticker, sizeArea: 20 } }, - { ...sticker_selection, id: 'third', sticker: { ...sticker, sizeArea: 10 } }, - ], - }; - const alternateOptions = fitTest(alternateOptionsArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 20 }, - }); - assert.deepEqual(alternateOptions.stickersToRemove, [ - [alternateOptionsArea.stickers[0], alternateOptionsArea.stickers[1]], - [alternateOptionsArea.stickers[0], alternateOptionsArea.stickers[2]], - [alternateOptionsArea.stickers[1], alternateOptionsArea.stickers[2]], - ]); - - const cappedOptionsArea = { - stickers: Array.from({ length: 12 }, (_, index) => ({ - ...sticker_selection, - id: `sticker-${index}`, - sticker: { ...sticker, sizeArea: 5 }, - })), - }; - const cappedOptions = fitTest(cappedOptionsArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 3 }, - }); - assert.deepEqual(cappedOptions.stickersToRemove, []); - - const cappedOptionCountArea = { - stickers: Array.from({ length: 5 }, (_, index) => ({ - ...sticker_selection, - id: `option-${index}`, - sticker: { ...sticker, sizeArea: 20 }, - })), - }; - const cappedOptionCount = fitTest(cappedOptionCountArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 5 }, - }); - assert.equal(cappedOptionCount.stickersToRemove.length, MAX_REMOVAL_OPTIONS); - assert(cappedOptionCount.stickersToRemove.every( - (option) => option.length <= MAX_STICKERS_PER_REMOVAL_OPTION, - )); - - const impossibleArea = { - stickers: [{ ...sticker_selection, sticker: { ...sticker, sizeArea: 3 } }], - }; - assert.deepEqual( - fitTest(impossibleArea, { - ...sticker_selection, - sticker: { ...sticker, sizeArea: 46 }, - }), - { fits: false, stickersToRemove: [] }, - ); -} - -function main(): void { - testFitTest(); - - console.log('fitTest checks passed.'); -} - -if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) { - main(); -} - -export { fitTest, sticker, sticker_selection }; From e0246dada0a9516c016e29b58f93bc534efd9fc9 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 29 Oct 2026 21:24:35 -0400 Subject: [PATCH 08/15] feat: adding docs --- frontend/src/mini-algo.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index 58adb7f..9df0429 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -46,6 +46,18 @@ export const sticker_selection: StickerSelection = { quantity: 1, }; +/** + * Checks whether a sticker selection can be added to the staging area. + * + * Calculates the total area used by the stickers in the staging area. + * Determines if adding the new sticker selection would exceed the staging area's capacity. + * If the new selection would exceed the capacity, it identifies combinations of existing selections that could be removed to make room. + * Returns a `FitTestResult` object containing whether the new selection fits and the suggested combinations to remove if it doesn't. + * STAGING_AREA_CAPACITY, MAX_REMOVAL_OPTIONS, MAX_STICKERS_PER_REMOVAL_OPTION define limits for the function's behavior. + * + * A result with `fits: false` and non-empty `stickersToRemove` means the new + * selection could fit if one of the suggested combinations were removed. + */ export function fitTest( stagingArea: Pick, stickerToAdd: StickerSelection | null | undefined, @@ -63,6 +75,7 @@ export function fitTest( return { fits: false, stickersToRemove: [] }; } + //The hard part const excessArea = existingArea + stickerArea - STAGING_AREA_CAPACITY; if (excessArea > 0) { const candidates = stagingArea.stickers From ca6311fb2ea34343e3cc2f8f0a05e080f0aae28f Mon Sep 17 00:00:00 2001 From: Oscar Rojas-Perez Date: Mon, 2 Nov 2026 22:04:35 -0500 Subject: [PATCH 09/15] docs(mini-algo): add comments explaining the fitTest algorithm --- frontend/src/mini-algo.ts | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index 9df0429..e22597e 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -63,21 +63,33 @@ export function fitTest( stickerToAdd: StickerSelection | null | undefined, ): FitTestResult { if (!stickerToAdd) { + // no sticker to add, return return { fits: false, stickersToRemove: [] }; } + // calculate the area of stickers in the staging area const existingArea = stagingArea.stickers.reduce((totalArea, currentSticker) => { return totalArea + currentSticker.sticker.sizeArea * currentSticker.quantity; }, 0); + // calculate area of sticker(s) to add const stickerArea = stickerToAdd.sticker.sizeArea * stickerToAdd.quantity; if (stickerArea > STAGING_AREA_CAPACITY) { + // sticker cannot fit in area capacity return { fits: false, stickersToRemove: [] }; } //The hard part + // excessArea captures how much space is over capacity in the staging area + // if all stickers were to be added. + // We need to figure out what stickers can be removed to accommodate the excessArea. const excessArea = existingArea + stickerArea - STAGING_AREA_CAPACITY; if (excessArea > 0) { + // Create a list of stickers from the staging area with their sizes + // sorted from greatest area to least area. This sort is important for the + // recursive function below. + // We also save the staging area index of the stickers so that they can be + // resorted by index below. const candidates = stagingArea.stickers .map((selection, index) => ({ selection, @@ -86,19 +98,34 @@ export function fitTest( })) .sort((left, right) => right.area - left.area); + // We try removing 1 selection, then 2, up to MAX_STICKERS_PER_REMOVAL_OPTION, + // to make room for excessArea. The loop will stop at the first selectionCount + // that finds a combination of stickers that when removed accommodates excessArea. for ( let selectionCount = 1; selectionCount <= Math.min(candidates.length, MAX_STICKERS_PER_REMOVAL_OPTION); selectionCount++ ) { + // Valid combinations of stickers to remove from the staging area. + // By removing this combination of stickers, the excessArea can be accommodated. const options: StickerSelection[][] = []; + // the current combination of stickers to remove const selected: typeof candidates = []; + // Recursive function to find a list of options to remove from the sticker + // staging area to accommodate the excessArea. + // startIndex is the current index from which we can pick from. + // freedArea is the area freed by removing the stickers currently in selected. function collectOptions(startIndex: number, freedArea: number): void { + // Stop the recursion once we have gathered enough removal options. if (options.length >= MAX_REMOVAL_OPTIONS) { return; } + // If the current selected combination of stickers is equal to selectionCount, + // we examine if removing those stickers frees enough space + // to accommodate the excessArea. If so, we push that combination on to + // the list of options, sorted by their original staging area index. if (selected.length === selectionCount) { if (freedArea >= excessArea) { options.push( @@ -110,11 +137,19 @@ export function fitTest( return; } + // Are there enough candidates left to finish this combination? const remainingCount = selectionCount - selected.length; if (candidates.length - startIndex < remainingCount) { return; } + // Can we possibly free enough space for excessArea by removing the stickers + // immediately following the startIndex? + // remainingCount captures how many more stickers we can remove, + // so we calculate the area of those stickers to determine if their removal + // would free up enough space for the excessArea. If not we can return. + // Above we sorted the candidates by greatest size, so the next stickers + // to examine would be the next largest stickers in the staging area. let maximumRemainingArea = 0; for (let index = startIndex; index < startIndex + remainingCount; index++) { maximumRemainingArea += candidates[index].area; @@ -123,6 +158,7 @@ export function fitTest( return; } + // Recursively call this function with a new starting index. for ( let index = startIndex; index <= candidates.length - remainingCount && @@ -135,14 +171,18 @@ export function fitTest( } } + // Start the recursive function to find options of stickers to remove. collectOptions(0, 0); + // If we found valid options of stickers to remove, we return them. if (options.length > 0) { return { fits: false, stickersToRemove: options }; } } + // No combination of stickers to remove was found to accommodate excessArea. return { fits: false, stickersToRemove: [] }; } + // The sticker fits! return { fits: true, stickersToRemove: [] }; } From 6055a734941021dba07e3b38f9b9180d927583d6 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Tue, 3 Nov 2026 14:46:00 -0500 Subject: [PATCH 10/15] feat: fixing sticker properties and updating tests --- frontend/src/mini-algo.test.ts | 50 ++++++++++++++++++---------------- frontend/src/mini-algo.ts | 12 ++++---- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/frontend/src/mini-algo.test.ts b/frontend/src/mini-algo.test.ts index 79e487a..91d52a5 100644 --- a/frontend/src/mini-algo.test.ts +++ b/frontend/src/mini-algo.test.ts @@ -11,7 +11,8 @@ import { const baseSticker: Sticker = { name: '', - sizeArea: 3, + height: 1, + width: 1, description: '', tags: [], id: '', @@ -20,10 +21,10 @@ const baseSticker: Sticker = { svgLocation: '', }; -function selection(id: string, sizeArea: number, quantity = 1): StickerSelection { +function selection(id: string, height: number, width = 1, quantity = 1): StickerSelection { return { id, - sticker: { ...baseSticker, id, sizeArea }, + sticker: { ...baseSticker, id, height, width }, quantity, }; } @@ -31,10 +32,10 @@ function selection(id: string, sizeArea: number, quantity = 1): StickerSelection // tests moved into their own file using github copilot (and turned into actual tests) test('accepts a sticker that fits without mutating the staging area', () => { - const existing = selection('existing', 42); + const existing = selection('existing', 6, 7); const stagingArea = { stickers: [existing] }; - assert.deepEqual(fitTest(stagingArea, selection('new', 3)), { + assert.deepEqual(fitTest(stagingArea, selection('new', 1, 3)), { fits: true, stickersToRemove: [], }); @@ -42,10 +43,10 @@ test('accepts a sticker that fits without mutating the staging area', () => { }); test('suggests removing existing stickers when the area is full', () => { - const existing = selection('existing', 42); + const existing = selection('existing', 6, 7); const stagingArea = { stickers: [existing] }; - assert.deepEqual(fitTest(stagingArea, selection('new', 4)), { + assert.deepEqual(fitTest(stagingArea, selection('new', 2, 2)), { fits: false, stickersToRemove: [[existing]], }); @@ -64,40 +65,40 @@ test('rejects a missing sticker', () => { }); test('rejects a sticker quantity that exceeds capacity', () => { - assert.deepEqual(fitTest({ stickers: [] }, selection('too-large', 23, 2)), { + assert.deepEqual(fitTest({ stickers: [] }, selection('too-large', 5, 5, 2)), { fits: false, stickersToRemove: [], }); }); test('suggests combinations of existing stickers when needed', () => { - const first = selection('first', 10); - const second = selection('second', 20); + const first = selection('first', 2, 5); + const second = selection('second', 4, 5); const stagingArea = { stickers: [first, second] }; - assert.deepEqual(fitTest(stagingArea, selection('new', 36)), { + assert.deepEqual(fitTest(stagingArea, selection('new', 6, 6)), { fits: false, stickersToRemove: [[first, second]], }); }); test('prefers the smallest removal option and preserves staging order', () => { - const small = selection('small', 2); - const large = selection('large', 20); + const small = selection('small', 1, 2); + const large = selection('large', 4, 5); - assert.deepEqual(fitTest({ stickers: [small, large] }, selection('new', 30)), { + assert.deepEqual(fitTest({ stickers: [small, large] }, selection('new', 5, 6)), { fits: false, stickersToRemove: [[large]], }); }); test('returns alternate removal combinations in staging order', () => { - const first = selection('first', 20); - const second = selection('second', 20); - const third = selection('third', 10); + const first = selection('first', 4, 5); + const second = selection('second', 5, 4); + const third = selection('third', 2, 5); assert.deepEqual( - fitTest({ stickers: [first, second, third] }, selection('new', 20)), + fitTest({ stickers: [first, second, third] }, selection('new', 4, 5)), { fits: false, stickersToRemove: [ @@ -111,10 +112,10 @@ test('returns alternate removal combinations in staging order', () => { test('only suggests removing up to three stickers', () => { const stickers = Array.from({ length: 12 }, (_, index) => - selection(`sticker-${index}`, 5), + selection(`sticker-${index}`, 1, 5), ); - assert.deepEqual(fitTest({ stickers }, selection('new', 3)), { + assert.deepEqual(fitTest({ stickers }, selection('new', 1, 3)), { fits: false, stickersToRemove: [], }); @@ -122,9 +123,9 @@ test('only suggests removing up to three stickers', () => { test('caps removal suggestions at five options', () => { const stickers = Array.from({ length: 5 }, (_, index) => - selection(`option-${index}`, 20), + selection(`option-${index}`, 4, 5), ); - const result = fitTest({ stickers }, selection('new', 5)); + const result = fitTest({ stickers }, selection('new', 1, 5)); assert.equal(result.stickersToRemove.length, 5); assert(result.stickersToRemove.every((option) => option.length <= 3)); @@ -132,7 +133,10 @@ test('caps removal suggestions at five options', () => { test('rejects a sticker larger than the staging area capacity', () => { assert.deepEqual( - fitTest({ stickers: [selection('existing', 3)] }, selection('too-large', STAGING_AREA_CAPACITY + 1)), + fitTest( + { stickers: [selection('existing', 1, 3)] }, + selection('too-large', STAGING_AREA_CAPACITY + 1, 1), + ), { fits: false, stickersToRemove: [] }, ); }); diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index e22597e..cd6505b 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -4,7 +4,8 @@ const MAX_STICKERS_PER_REMOVAL_OPTION = 3; export interface Sticker { name: string; - sizeArea: number; + height: number; + width: number; description: string; tags: string[]; id: string; @@ -31,7 +32,8 @@ export interface FitTestResult { export const sticker: Sticker = { name: '', - sizeArea: 3, + height: 3, + width: 3, description: '', tags: [], id: '', @@ -69,11 +71,11 @@ export function fitTest( // calculate the area of stickers in the staging area const existingArea = stagingArea.stickers.reduce((totalArea, currentSticker) => { - return totalArea + currentSticker.sticker.sizeArea * currentSticker.quantity; + return totalArea + currentSticker.sticker.height * currentSticker.sticker.width * currentSticker.quantity; }, 0); // calculate area of sticker(s) to add - const stickerArea = stickerToAdd.sticker.sizeArea * stickerToAdd.quantity; + const stickerArea = stickerToAdd.sticker.height * stickerToAdd.sticker.width * stickerToAdd.quantity; if (stickerArea > STAGING_AREA_CAPACITY) { // sticker cannot fit in area capacity return { fits: false, stickersToRemove: [] }; @@ -94,7 +96,7 @@ export function fitTest( .map((selection, index) => ({ selection, index, - area: selection.sticker.sizeArea * selection.quantity, + area: selection.sticker.height * selection.sticker.width * selection.quantity, })) .sort((left, right) => right.area - left.area); From 8e251bb5d6a8553ec82e412a07738d92c07bd31a Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Tue, 3 Nov 2026 15:03:08 -0500 Subject: [PATCH 11/15] docs: updating inline comments --- frontend/src/mini-algo.ts | 44 +++++++++++---------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index cd6505b..3cacb2f 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -65,7 +65,6 @@ export function fitTest( stickerToAdd: StickerSelection | null | undefined, ): FitTestResult { if (!stickerToAdd) { - // no sticker to add, return return { fits: false, stickersToRemove: [] }; } @@ -76,22 +75,17 @@ export function fitTest( // calculate area of sticker(s) to add const stickerArea = stickerToAdd.sticker.height * stickerToAdd.sticker.width * stickerToAdd.quantity; + + // sticker cannot fit in area capacity? if (stickerArea > STAGING_AREA_CAPACITY) { - // sticker cannot fit in area capacity return { fits: false, stickersToRemove: [] }; } - //The hard part - // excessArea captures how much space is over capacity in the staging area - // if all stickers were to be added. - // We need to figure out what stickers can be removed to accommodate the excessArea. const excessArea = existingArea + stickerArea - STAGING_AREA_CAPACITY; + if (excessArea > 0) { - // Create a list of stickers from the staging area with their sizes - // sorted from greatest area to least area. This sort is important for the - // recursive function below. - // We also save the staging area index of the stickers so that they can be - // resorted by index below. + // Create a list of stickers, their indexes, and areas in the staging area with their sizes + // sorted from greatest area to least area. const candidates = stagingArea.stickers .map((selection, index) => ({ selection, @@ -100,24 +94,17 @@ export function fitTest( })) .sort((left, right) => right.area - left.area); - // We try removing 1 selection, then 2, up to MAX_STICKERS_PER_REMOVAL_OPTION, - // to make room for excessArea. The loop will stop at the first selectionCount - // that finds a combination of stickers that when removed accommodates excessArea. + // For each selectioncount up to either the number of canidates or the max stickers per removal option for ( let selectionCount = 1; selectionCount <= Math.min(candidates.length, MAX_STICKERS_PER_REMOVAL_OPTION); selectionCount++ ) { - // Valid combinations of stickers to remove from the staging area. - // By removing this combination of stickers, the excessArea can be accommodated. + // Array for selected stickers to remove and the list of options to remove from the staging area const options: StickerSelection[][] = []; - // the current combination of stickers to remove const selected: typeof candidates = []; - // Recursive function to find a list of options to remove from the sticker - // staging area to accommodate the excessArea. - // startIndex is the current index from which we can pick from. - // freedArea is the area freed by removing the stickers currently in selected. + // Recursive function to find a list of options to remove from the stickers in the staging area. function collectOptions(startIndex: number, freedArea: number): void { // Stop the recursion once we have gathered enough removal options. if (options.length >= MAX_REMOVAL_OPTIONS) { @@ -145,17 +132,12 @@ export function fitTest( return; } - // Can we possibly free enough space for excessArea by removing the stickers - // immediately following the startIndex? - // remainingCount captures how many more stickers we can remove, - // so we calculate the area of those stickers to determine if their removal - // would free up enough space for the excessArea. If not we can return. - // Above we sorted the candidates by greatest size, so the next stickers - // to examine would be the next largest stickers in the staging area. + let maximumRemainingArea = 0; for (let index = startIndex; index < startIndex + remainingCount; index++) { maximumRemainingArea += candidates[index].area; } + if (freedArea + maximumRemainingArea < excessArea) { return; } @@ -173,18 +155,16 @@ export function fitTest( } } - // Start the recursive function to find options of stickers to remove. + // Start the recursive function to find options of stickers to remove and return results. collectOptions(0, 0); - // If we found valid options of stickers to remove, we return them. if (options.length > 0) { return { fits: false, stickersToRemove: options }; } } - // No combination of stickers to remove was found to accommodate excessArea. + // No combination of stickers found. return { fits: false, stickersToRemove: [] }; } - // The sticker fits! return { fits: true, stickersToRemove: [] }; } From a5e3dc8d79a9ba4003435ba13493382051779c88 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Tue, 3 Nov 2026 15:05:13 -0500 Subject: [PATCH 12/15] docs: updating inline comments --- frontend/src/mini-algo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index 3cacb2f..a6cb15f 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -133,12 +133,12 @@ export function fitTest( } + // Make sure that the amount of area that could be freed by the remaining stickers is enough to accommodate the excessArea let maximumRemainingArea = 0; for (let index = startIndex; index < startIndex + remainingCount; index++) { maximumRemainingArea += candidates[index].area; } - - if (freedArea + maximumRemainingArea < excessArea) { + if (freedArea + maximumRemainingArea < excessArea) { // if not end return; } From 0abe80e09c7570f75653d043adf89405a2e63be1 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Tue, 3 Nov 2026 16:33:35 -0500 Subject: [PATCH 13/15] bug: fixing test that was missing implementation --- frontend/src/mini-algo.test.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/src/mini-algo.test.ts b/frontend/src/mini-algo.test.ts index 91d52a5..607d1c0 100644 --- a/frontend/src/mini-algo.test.ts +++ b/frontend/src/mini-algo.test.ts @@ -110,15 +110,17 @@ test('returns alternate removal combinations in staging order', () => { ); }); -test('only suggests removing up to three stickers', () => { - const stickers = Array.from({ length: 12 }, (_, index) => - selection(`sticker-${index}`, 1, 5), +test('only suggests removing up to MAX_STICKERS_PER_REMOVAL (3) stickers', () => { + const stickers = Array.from({ length: 5 }, (_, index) => + selection(`sticker-${index}`, 4, 5), ); - assert.deepEqual(fitTest({ stickers }, selection('new', 1, 3)), { - fits: false, - stickersToRemove: [], - }); + const result = fitTest({ stickers }, selection('new', 1, 5)); + + assert.equal(result.fits, false); + assert(result.stickersToRemove.length > 0); + assert(result.stickersToRemove.some((option) => option.length === 3)); + assert(result.stickersToRemove.every((option) => option.length <= 3)); }); test('caps removal suggestions at five options', () => { From 3f8df68e74ae817d5c1867c5da5d266e937ae8bb Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 12 Nov 2026 10:10:04 -0500 Subject: [PATCH 14/15] Feat/28 mini algo (#56) * build(deps-dev): bump vite from 8.3.2 to 8.3.5 in /frontend (#44) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.3.2 to 8.3.5. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v8.3.5/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 8.3.5 dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(4up): week 11 (#49) * feat: ci/cd gh actions (#53) * feat: ci/cd gh actions * docs(README): Moving CI section for better flow * ci: run frontend and backend workflows on pushes to main --------- Co-authored-by: Wesley-Fos Co-authored-by: Oscar Rojas-Perez --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oscar Rojas <94993190+or8655@users.noreply.github.com> Co-authored-by: Wesley-Fos Co-authored-by: Oscar Rojas-Perez --- .github/workflows/backend.yml | 54 ++ .github/workflows/frontend.yml | 47 ++ 4up.md | 5 + README.md | 7 + frontend/package-lock.json | 1168 +++++++++++++++++++++++++++++--- frontend/package.json | 7 +- frontend/src/App.test.tsx | 5 + frontend/vite.config.ts | 6 +- 8 files changed, 1213 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/backend.yml create mode 100644 .github/workflows/frontend.yml create mode 100644 frontend/src/App.test.tsx diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml new file mode 100644 index 0000000..6f62cde --- /dev/null +++ b/.github/workflows/backend.yml @@ -0,0 +1,54 @@ +name: Backend CI + +on: + push: + branches: + - main + paths: + - 'sticker-business/**' + - '.github/workflows/backend.yml' + pull_request: + paths: + - 'sticker-business/**' + - '.github/workflows/backend.yml' + +permissions: + contents: read + +jobs: + backend: + name: Backend build and tests + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 25 + cache: maven + + - name: Build and test + run: ./mvnw -B clean verify + working-directory: sticker-business + + database: + name: Database + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8.4 + env: + MYSQL_ROOT_PASSWORD: ci-root-password + MYSQL_DATABASE: sticker_business + options: >- + --health-cmd="mysqladmin ping --host=127.0.0.1 --user=root --password=ci-root-password" + --health-interval=10s + --health-timeout=5s + --health-retries=10 + --health-start-period=30s + steps: + - name: Confirm MySQL is healthy + run: echo "MySQL 8.4 is ready." diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml new file mode 100644 index 0000000..5b5c119 --- /dev/null +++ b/.github/workflows/frontend.yml @@ -0,0 +1,47 @@ +name: Frontend CI + +on: + push: + branches: + - main + paths: + - 'frontend/**' + - '.github/workflows/frontend.yml' + pull_request: + paths: + - 'frontend/**' + - '.github/workflows/frontend.yml' + +permissions: + contents: read + +jobs: + frontend: + name: Frontend build and checks + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: npm ci + working-directory: frontend + + - name: Test + run: npm test + working-directory: frontend + + - name: Lint + run: npm run lint + working-directory: frontend + + - name: Build and type-check + run: npm run build + working-directory: frontend diff --git a/4up.md b/4up.md index acfd5c0..d827583 100644 --- a/4up.md +++ b/4up.md @@ -15,6 +15,11 @@ Each week a new 4-Up will be appeneded to the top of the section below. --- +| **10/26/2026-11/1/2026** | | +| --- | --- | +| **Progress**
  • More frontend implementation; the frontend is now navigable.
  • Opened a PR for the UML class diagram.
  • Reviewed the login flows and sequence diagrams as a team.
  • Completed the initial API design.
  • Opened a PR for a mini algorithm to precompute if a sticker fits on a sheet before 2D packing algorithm is run.
  • More work on the 2D packing algorithm; it now outputs an HPGL file.
| **Risks**
  • The frontend is still not connected to the backend, and it's week 11.
| +| **Plans**
  • This is our last sprint of the semester. It is 3 weeks long so that we finish before Thanksgiving break.
  • We will seek to complete the design and implementation of our MVP; connecting the frontend to the backend.
| **Needs**
  • Hardware from the project sponsor to begin hardware investigation.
| + | **10/19/2026-10/25/2026** | | | --- | --- | | **Progress**
  • Merged in our first feature ticket!!!
  • Continued frontend implementation.
  • Continued work on the 2D shape packing algorithm.
  • Began API design.
  • Began design on login user flows.
| **Risks**
  • Still no demonstratable product.
| diff --git a/README.md b/README.md index f19b9a0..446f09f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ An open source framework that helps anyone start their own sticker-printing micr - [What you need to install](#what-you-need-to-install) - [Running the application](#running-the-application) - [Everyday development](#everyday-development) + - [Continuous integration](#continuous-integration) - [Troubleshooting](#troubleshooting) - [Team standards](#team-standards) - [Acknowledgments](#acknowledgments) @@ -108,6 +109,12 @@ docker compose up --build **Line endings:** the repo's root `.gitattributes` file converts checked out files to your operating system's native ending when you check out. +### Continuous integration +GitHub Actions runs checks on pull requests and merges to main: +- **Frontend** ([frontend.yml](.github/workflows/frontend.yml)): `npm ci`, `npm test`, `npm run lint`, and `npm run build` (which includes the TypeScript checks). +- **Backend** ([backend.yml](.github/workflows/backend.yml)): `./mvnw -B clean verify`, which builds the application, runs its tests, and checks Java formatting; a separate job starts MySQL 8.4 and waits for its health check to pass. + + ## Troubleshooting | Problem | Cause and fix | |---|---| diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f40fcb8..6778761 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -12,19 +12,291 @@ "react-dom": "^19.2.8" }, "devDependencies": { + "@testing-library/react": "^16.3.3", "@types/node": "^24.13.3", "@types/react": "^19.2.18", "@types/react-dom": "^19.2.7", "@vitejs/plugin-react": "^6.1.1", + "jsdom": "^30.1.3", "oxlint": "^1.81.0", "typescript": "~6.0.2", - "vite": "^8.3.0" + "vite": "^8.3.5", + "vitest": "^5.1.0" + } + }, + "node_modules/@asamuzakjp/css-color": { + "version": "7.1.9", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.1.9.tgz", + "integrity": "sha512-vZ6JQVq8Ivgz6b/IBlAf90wZviXdluY13cQOPO+nJHbmXwGrPl2GcpqUY7a55/8ZVdfONXpCFMpRijOBCHNlcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^3.4.3", + "@csstools/css-color-parser": "^4.2.6", + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "10.0.5", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-10.0.5.tgz", + "integrity": "sha512-EgmJ7oEaGQECTn3H3wmnQpEy4hKY66VvM7VQndwPIQob3p877BgbyOUE3EX0LgXQCciF2H8KMdR+RznqjMNOLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "bidi-js": "^1.1.0", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.29.13", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.29.13.tgz", + "integrity": "sha512-v+oN26xP4YIlQsbQ/CbTH1WG5m/l/DjKKZNy/Kp3f/AFvbgt7Em/D0FeMM3O2hX0YzeN2M16W8lOpyhIkfCBcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bramus/specificity": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.3.tgz", + "integrity": "sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.2.1" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.7", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.7.tgz", + "integrity": "sha512-zgm9yjQz5iJB4VL8RyVwd71TWB8Q89FSxt/NzXoWqPSkEBOVtn9L6vAPtSc9hpKfB0Awo/AL2VKFHjYetBLFHQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.16", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.16.tgz", + "integrity": "sha512-LsDbJPP/B8cPasUJyTA5S99F7C4G93ngW8hUluXz8CFeOaaRnBPtBiIlvgcPYU0HmHNz8CXg+1vwFrIB4F6Dgw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, "node_modules/@oxc-project/types": { - "version": "0.152.0", - "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.152.0.tgz", - "integrity": "sha512-oM/5rLBm2tPkg0iBgkH/FOeR3PCDpY19GTgAZjMFM8h9WI9VW7cLgzp6nwtarYKmovavIQZ+Fe/RKX/8C8O/Rw==", + "version": "0.155.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.155.0.tgz", + "integrity": "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==", "dev": true, "license": "MIT", "funding": { @@ -355,9 +627,9 @@ } }, "node_modules/@rolldown/binding-android-arm-eabi": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.12.tgz", - "integrity": "sha512-dB/a1214qKfHMXCpgqR4OZT+jS4kTyEXbQGJPqzobt5EwH5rX080pxE37alt3RzvR1bf1Yz/yGqRfrYAxuPw0A==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz", + "integrity": "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==", "cpu": [ "arm" ], @@ -372,9 +644,9 @@ } }, "node_modules/@rolldown/binding-android-arm64": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.12.tgz", - "integrity": "sha512-7KHFgQ5VJxIHcLlrwrc3Xbds7oTNQT7Pgi9gQCJKrd2VGab/UksIOYp6VD8MzCstGxOKMgNamPwUCfxPdP1OHg==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.15.tgz", + "integrity": "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==", "cpu": [ "arm64" ], @@ -389,9 +661,9 @@ } }, "node_modules/@rolldown/binding-darwin-arm64": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.12.tgz", - "integrity": "sha512-3YIhqHD96nA5SaYNRBR16HnGv4oavZvXfD/ayHM+oYZ0WD/8lBAtf6zQua4kEyAvpqrluKXl0lnOBoiNby7x9w==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.15.tgz", + "integrity": "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==", "cpu": [ "arm64" ], @@ -406,9 +678,9 @@ } }, "node_modules/@rolldown/binding-darwin-x64": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.12.tgz", - "integrity": "sha512-UuuJ35MFw4gmFOrE9pEqIV+K3syIKveph+Qc1/ljHZVdoDW4pz/JHR/eMVom+TZGl/5OOvGJOWaOCVt3ZfqhxA==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.15.tgz", + "integrity": "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==", "cpu": [ "x64" ], @@ -423,9 +695,9 @@ } }, "node_modules/@rolldown/binding-freebsd-x64": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.12.tgz", - "integrity": "sha512-uMvssit0a4W+/7D8CbHUvG719mH3R2jwXAlh/XcPvuHTE0g++LymF88DCGNX0HM2rBOn0xrzgXktIB6fLSJBTQ==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.15.tgz", + "integrity": "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==", "cpu": [ "x64" ], @@ -440,9 +712,9 @@ } }, "node_modules/@rolldown/binding-linux-arm-gnueabihf": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.12.tgz", - "integrity": "sha512-XcFu0R0xWnwzSf4IQgFH1rJIckPN1pLy2R+4r9IDB7Yfu/ys9cVqfa4pBrMHj7a3gl8mIR4nRNPg0e5IvEVs6g==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.15.tgz", + "integrity": "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==", "cpu": [ "arm" ], @@ -457,13 +729,16 @@ } }, "node_modules/@rolldown/binding-linux-arm64-gnu": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.12.tgz", - "integrity": "sha512-260UrKgn8tz39ak+SMDOirKzr7V04M9dWPw5llW00SwBivCZoWcRBKV1d8cXnRkUmSZA3BdiUmBHWk7734Ulpw==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.15.tgz", + "integrity": "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -474,13 +749,16 @@ } }, "node_modules/@rolldown/binding-linux-arm64-musl": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.12.tgz", - "integrity": "sha512-5YK1I9SqDkbPgc1IA8BgDl34suqUS2q0KWnBrirm0E51YjOs6eo6dV6jbQfNE/argHRSvd0QUGgtpIoYx+WWpw==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.15.tgz", + "integrity": "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==", "cpu": [ "arm64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -491,13 +769,16 @@ } }, "node_modules/@rolldown/binding-linux-ppc64-gnu": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.12.tgz", - "integrity": "sha512-Rkcrmp7eFRg74yL5fXEU91JEWbdEPLevWwGtXpmhbjlD1StScbWTmO94Bhly+Mo+ketKYkdmM1vNUKeWSlx8cQ==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.15.tgz", + "integrity": "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==", "cpu": [ "ppc64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -508,13 +789,16 @@ } }, "node_modules/@rolldown/binding-linux-s390x-gnu": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.12.tgz", - "integrity": "sha512-qvK4DuAsQc2BSjlx+Xr+IzOIvvxbGZqxFwdWfG6F518Erj0GGISyQbJ6pIappnOxlNPzNHvo/L0BwB30GZ+zVw==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.15.tgz", + "integrity": "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==", "cpu": [ "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -525,13 +809,16 @@ } }, "node_modules/@rolldown/binding-linux-x64-gnu": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.12.tgz", - "integrity": "sha512-Q9uLBO53Xd4QIq1WOycVQyPP1O4HhraEV2qqb3uTrnVw6QZih9duY4vNXOivL1xoUS1/z+W8eF4NMfl2a8Sdjw==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.15.tgz", + "integrity": "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -542,13 +829,16 @@ } }, "node_modules/@rolldown/binding-linux-x64-musl": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.12.tgz", - "integrity": "sha512-3IBxWFMjbOZskDPKv8Lf9BCnahlKuHthWkYnyIxOH/QcJrFcS4EmcenthApkwr/5+nEqZlLzeYbxeMaX7A5u4g==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.15.tgz", + "integrity": "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==", "cpu": [ "x64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -559,9 +849,9 @@ } }, "node_modules/@rolldown/binding-openharmony-arm64": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.12.tgz", - "integrity": "sha512-xtX61xg4LKPkPWilZU1ynKClz5Gj4bf74LML4r3eVLWumKnGjoEr1OSHQhMdbBDoYTi+yjrujvpZe2pUnqCrrA==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.15.tgz", + "integrity": "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==", "cpu": [ "arm64" ], @@ -576,9 +866,9 @@ } }, "node_modules/@rolldown/binding-win32-arm64-msvc": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.12.tgz", - "integrity": "sha512-At7fPB6PCaIjzgIhEZFxuT+BBFqiQibJDT4d3PhiR3f4E7bbMZF4aKblbFfEM3sETRDd1YiQx/+U/g/B/ou5Ew==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.15.tgz", + "integrity": "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==", "cpu": [ "arm64" ], @@ -593,9 +883,9 @@ } }, "node_modules/@rolldown/binding-win32-x64-msvc": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.12.tgz", - "integrity": "sha512-WIw2haVKwjuYdXkHaoC0mF8Le71TuCBxjrdKqLbJGctbBABj+ClfmNvtbOnzpq3RokNo5+V1qhtSzJyXorsklQ==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.15.tgz", + "integrity": "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==", "cpu": [ "x64" ], @@ -616,6 +906,88 @@ "dev": true, "license": "MIT" }, + "node_modules/@testing-library/dom": { + "version": "10.4.2", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.2.tgz", + "integrity": "sha512-yzr2S9HyAIdhz2/6qHgbs665Q7PKVcDF05vsOlHPxG1mo36gKVesdYVeDLnXgfjJ03CrKRk08knc6+E/9m8v2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.10.4", + "@babel/runtime": "^7.12.5", + "@types/aria-query": "^5.0.1", + "aria-query": "5.3.0", + "dom-accessibility-api": "^0.5.9", + "lz-string": "^1.5.0", + "picocolors": "1.1.1", + "pretty-format": "^27.0.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@testing-library/react": { + "version": "16.3.3", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.3.tgz", + "integrity": "sha512-Uo193NgQbPMz6lrrhtRQQFcMC6Re/ELLFbbuVL30WDlZxlpZf9/lMHTAVxPRLw1q1iu9OJmR1c2BLiENRstdBg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.12.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@testing-library/dom": "^10.0.0", + "@types/react": "^18.0.0 || ^19.0.0", + "@types/react-dom": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@types/aria-query": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "24.19.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.0.tgz", @@ -676,6 +1048,124 @@ } } }, + "node_modules/@vitest/mocker": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz", + "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.1.0", + "estree-walker": "^3.0.3", + "magic-string": "^1.4.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9 || ^3.0.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/spy": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz", + "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, "node_modules/csstype": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", @@ -683,6 +1173,38 @@ "dev": true, "license": "MIT" }, + "node_modules/data-urls": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", + "integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.1.2" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=6" + } + }, "node_modules/detect-libc": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", @@ -693,6 +1215,54 @@ "node": ">=8" } }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/entities": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", + "integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/fdir": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", @@ -726,6 +1296,74 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/html-encoding-sniffer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", + "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1" + }, + "engines": { + "node": "^22.13.0 || >=24.0.0" + } + }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/jsdom": { + "version": "30.1.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.3.tgz", + "integrity": "sha512-hQMUPvRgN7KxsfIytDQji7bimuJeRQa6Qo5+iuiZQk5CafeRxLIA10/cG5YCBFNpD9RO3oqIiN4CO1Y44kxqXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^7.1.3", + "@asamuzakjp/dom-selector": "^10.0.3", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.15", + "@exodus/bytes": "^1.16.0", + "css-tree": "^3.2.1", + "data-urls": "^8.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^7.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "tough-cookie": "^6.0.2", + "undici": "^8.12.1", + "w3c-xmlserializer": "^6.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.2.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "peerDependencies": { + "canvas": "^3.2.3" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, "node_modules/lightningcss": { "version": "1.33.0", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", @@ -987,10 +1625,48 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" + } + }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, "node_modules/nanoid": { - "version": "3.3.19", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz", - "integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", "dev": true, "funding": [ { @@ -1006,6 +1682,20 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/obug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", + "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/oxlint": { "version": "1.86.0", "resolved": "https://registry.npmjs.org/oxlint/-/oxlint-1.86.0.tgz", @@ -1055,6 +1745,19 @@ } } }, + "node_modules/parse5": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.0.tgz", + "integrity": "sha512-sq3qBFpee5jeocbFbO48VHlGr8sT7mbXS0vxlKN6sottBtJzrOG3998sr0llSZcQAGgfpdmEYAIZE0P9z0dE8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^9.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -1076,9 +1779,9 @@ } }, "node_modules/postcss": { - "version": "8.5.28", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz", - "integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", + "version": "8.5.31", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.31.tgz", + "integrity": "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==", "dev": true, "funding": [ { @@ -1096,14 +1799,40 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.18", + "nanoid": "^3.3.20", "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" + "source-map-js": "^1.2.2" }, "engines": { "node": "^10 || ^12 || >=14" } }, + "node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/react": { "version": "19.3.0", "resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz", @@ -1125,14 +1854,32 @@ "react": "^19.3.0" } }, + "node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, + "license": "MIT", + "peer": true + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/rolldown": { - "version": "1.2.12", - "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.12.tgz", - "integrity": "sha512-8wafseiaG80xmXSfqidUNqZcylTlhmPZZt+za2m+js2sFZ8dTNlhIOV2WcbIPx2hgwPBJpEUGFAMZ9bgBBLTSQ==", + "version": "1.2.15", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.15.tgz", + "integrity": "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==", "dev": true, "license": "MIT", "dependencies": { - "@oxc-project/types": "=0.152.0", + "@oxc-project/types": "=0.155.0", "@rolldown/pluginutils": "^1.0.0" }, "bin": { @@ -1142,21 +1889,34 @@ "node": "^20.19.0 || >=22.12.0" }, "optionalDependencies": { - "@rolldown/binding-android-arm-eabi": "1.2.12", - "@rolldown/binding-android-arm64": "1.2.12", - "@rolldown/binding-darwin-arm64": "1.2.12", - "@rolldown/binding-darwin-x64": "1.2.12", - "@rolldown/binding-freebsd-x64": "1.2.12", - "@rolldown/binding-linux-arm-gnueabihf": "1.2.12", - "@rolldown/binding-linux-arm64-gnu": "1.2.12", - "@rolldown/binding-linux-arm64-musl": "1.2.12", - "@rolldown/binding-linux-ppc64-gnu": "1.2.12", - "@rolldown/binding-linux-s390x-gnu": "1.2.12", - "@rolldown/binding-linux-x64-gnu": "1.2.12", - "@rolldown/binding-linux-x64-musl": "1.2.12", - "@rolldown/binding-openharmony-arm64": "1.2.12", - "@rolldown/binding-win32-arm64-msvc": "1.2.12", - "@rolldown/binding-win32-x64-msvc": "1.2.12" + "@rolldown/binding-android-arm-eabi": "1.2.15", + "@rolldown/binding-android-arm64": "1.2.15", + "@rolldown/binding-darwin-arm64": "1.2.15", + "@rolldown/binding-darwin-x64": "1.2.15", + "@rolldown/binding-freebsd-x64": "1.2.15", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.15", + "@rolldown/binding-linux-arm64-gnu": "1.2.15", + "@rolldown/binding-linux-arm64-musl": "1.2.15", + "@rolldown/binding-linux-ppc64-gnu": "1.2.15", + "@rolldown/binding-linux-s390x-gnu": "1.2.15", + "@rolldown/binding-linux-x64-gnu": "1.2.15", + "@rolldown/binding-linux-x64-musl": "1.2.15", + "@rolldown/binding-openharmony-arm64": "1.2.15", + "@rolldown/binding-win32-arm64-msvc": "1.2.15", + "@rolldown/binding-win32-x64-msvc": "1.2.15" + } + }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" } }, "node_modules/scheduler": { @@ -1175,6 +1935,33 @@ "node": ">=0.10.0" } }, + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinybench": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz", + "integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tinyglobby": { "version": "0.2.17", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", @@ -1192,6 +1979,52 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, + "node_modules/tldts": { + "version": "7.4.19", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.19.tgz", + "integrity": "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.19" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.20", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.20.tgz", + "integrity": "sha512-C630TWXZCZmLq0F2bW4QqwnaaxCQ/svpAqvJwnC4JvgEM5ohhBnGsEzTLSOXcN+xjz+kEaHS5uoWIw2klnqd0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", + "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, "node_modules/typescript": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", @@ -1206,6 +2039,16 @@ "node": ">=14.17" } }, + "node_modules/undici": { + "version": "8.12.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz", + "integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, "node_modules/undici-types": { "version": "7.24.6", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", @@ -1214,16 +2057,16 @@ "license": "MIT" }, "node_modules/vite": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.2.tgz", - "integrity": "sha512-SQr1x6W5vVSbROg7vsyXIaxK9b0G7zsT68acdWWRmnBUsgDieLCRG+Rep9WdZgcposvv/GSnr4GUUBqB3vXq6w==", + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz", + "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==", "dev": true, "license": "MIT", "dependencies": { "lightningcss": "^1.33.0", "picomatch": "^4.0.7", - "postcss": "^8.5.28", - "rolldown": "~1.2.11", + "postcss": "^8.5.30", + "rolldown": "~1.2.14", "tinyglobby": "^0.2.17" }, "bin": { @@ -1240,7 +2083,7 @@ }, "peerDependencies": { "@types/node": "^20.19.0 || >=22.12.0", - "@vitejs/devtools": "^0.7.1", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", "esbuild": "^0.27.0 || ^0.28.0", "jiti": ">=1.21.0", "less": "^4.0.0", @@ -1290,6 +2133,167 @@ "optional": true } } + }, + "node_modules/vitest": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz", + "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/mocker": "5.1.0", + "chai": "^6.3.0", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.4.3", + "obug": "^3.0.0", + "picomatch": "^4.0.7", + "std-env": "^4.3.0", + "tinybench": "^6.2.2", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.1.0", + "@vitest/browser-preview": "5.1.0", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.1.0", + "@vitest/coverage-v8": "5.1.0", + "@vitest/ui": "5.1.0", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } + } + }, + "node_modules/w3c-xmlserializer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", + "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/whatwg-url": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz", + "integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "tr46": "^7.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/why-is-node-running": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", + "dev": true, + "license": "MIT", + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=20.11" + } + }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" } } } diff --git a/frontend/package.json b/frontend/package.json index 292bc5c..45aca19 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -7,7 +7,7 @@ "dev": "vite", "build": "tsc -b && vite build", "lint": "oxlint", - "test": "node --test src/mini-algo.test.ts", + "test": "node --test src/mini-algo.test.ts && vitest run src/App.test.tsx", "preview": "vite preview" }, "dependencies": { @@ -15,12 +15,15 @@ "react-dom": "^19.2.8" }, "devDependencies": { + "@testing-library/react": "^16.3.3", "@types/node": "^24.13.3", "@types/react": "^19.2.18", "@types/react-dom": "^19.2.7", "@vitejs/plugin-react": "^6.1.1", + "jsdom": "^30.1.3", "oxlint": "^1.81.0", "typescript": "~6.0.2", - "vite": "^8.3.0" + "vite": "^8.3.5", + "vitest": "^5.1.0" } } diff --git a/frontend/src/App.test.tsx b/frontend/src/App.test.tsx new file mode 100644 index 0000000..0617acc --- /dev/null +++ b/frontend/src/App.test.tsx @@ -0,0 +1,5 @@ +import { expect, it } from 'vitest' + +it('passes', () => { + expect(true).toBe(true) +}) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 9982072..b8cc6b6 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,7 +1,9 @@ import react from '@vitejs/plugin-react' -import { defineConfig } from 'vite' +import { defineConfig } from 'vitest/config' -// https://vite.dev/config/ export default defineConfig({ plugins: [react()], + test: { + environment: 'jsdom', + }, }) From 65edbd429a005b01473c49e6a8c927c423f3c1d9 Mon Sep 17 00:00:00 2001 From: Wesley-Fos Date: Thu, 12 Nov 2026 10:18:23 -0500 Subject: [PATCH 15/15] Feat/28 mini algo (#57) * build(deps-dev): bump vite from 8.3.2 to 8.3.5 in /frontend (#44) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.3.2 to 8.3.5. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v8.3.5/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 8.3.5 dependency-type: direct:development ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(4up): week 11 (#49) * feat: ci/cd gh actions (#53) * feat: ci/cd gh actions * docs(README): Moving CI section for better flow * ci: run frontend and backend workflows on pushes to main --------- Co-authored-by: Wesley-Fos Co-authored-by: Oscar Rojas-Perez * feat: moving things and fixing merge conflicts --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Oscar Rojas <94993190+or8655@users.noreply.github.com> Co-authored-by: Wesley-Fos Co-authored-by: Oscar Rojas-Perez --- frontend/src/mini-algo.ts | 141 +++++++++++++++++++++----------------- 1 file changed, 78 insertions(+), 63 deletions(-) diff --git a/frontend/src/mini-algo.ts b/frontend/src/mini-algo.ts index a6cb15f..fb83bd3 100644 --- a/frontend/src/mini-algo.ts +++ b/frontend/src/mini-algo.ts @@ -48,6 +48,77 @@ export const sticker_selection: StickerSelection = { quantity: 1, }; +type RemovalCandidate = { + selection: StickerSelection; + index: number; + area: number; +}; + + +function collectOptions( + removalCandidates: RemovalCandidate[], + stickersToRemove: number, + overflowAmount: number, +): StickerSelection[][] { + // Array for selected stickers to remove and the list of options to remove from the staging area + const options: StickerSelection[][] = []; + const selected: RemovalCandidate[] = []; + + // Recursive function to find a list of options to remove from the stickers in the staging area. + function search(startIndex: number, freedArea: number): void { + // Stop the recursion once we have gathered enough removal options. + if (options.length >= MAX_REMOVAL_OPTIONS) { + return; + } + + // If the current selected combination of stickers is equal to stickersToRemove, + // we examine if removing those stickers frees enough space + // to accommodate the overflowAmount. If so, we push that combination on to + // the list of options, sorted by their original staging area index. + if (selected.length === stickersToRemove) { + if (freedArea >= overflowAmount) { + options.push( + [...selected] + .sort((left, right) => left.index - right.index) + .map(({ selection }) => selection), + ); + } + return; + } + + // Are there enough candidates left to finish this combination? + const remainingCount = stickersToRemove - selected.length; + if (removalCandidates.length - startIndex < remainingCount) { + return; + } + + // Make sure that the amount of area that could be freed by the remaining stickers is enough to accommodate the overflowAmount + let maximumRemainingArea = 0; + for (let index = startIndex; index < startIndex + remainingCount; index++) { + maximumRemainingArea += removalCandidates[index].area; + } + if (freedArea + maximumRemainingArea < overflowAmount) { // if not end + return; + } + + // Recursively call this function with a new starting index. + for ( + let index = startIndex; + index <= removalCandidates.length - remainingCount && + options.length < MAX_REMOVAL_OPTIONS; + index++ + ) { + selected.push(removalCandidates[index]); + search(index + 1, freedArea + removalCandidates[index].area); + selected.pop(); + } + } + + // Start the recursive function to find options of stickers to remove and return results. + search(0, 0); + return options; +} + /** * Checks whether a sticker selection can be added to the staging area. * @@ -81,9 +152,9 @@ export function fitTest( return { fits: false, stickersToRemove: [] }; } - const excessArea = existingArea + stickerArea - STAGING_AREA_CAPACITY; + const overflowAmount = existingArea + stickerArea - STAGING_AREA_CAPACITY; - if (excessArea > 0) { + if (overflowAmount > 0) { // Create a list of stickers, their indexes, and areas in the staging area with their sizes // sorted from greatest area to least area. const candidates = stagingArea.stickers @@ -94,69 +165,13 @@ export function fitTest( })) .sort((left, right) => right.area - left.area); - // For each selectioncount up to either the number of canidates or the max stickers per removal option + // For each stickersToRemove up to either the number of canidates or the max stickers per removal option for ( - let selectionCount = 1; - selectionCount <= Math.min(candidates.length, MAX_STICKERS_PER_REMOVAL_OPTION); - selectionCount++ + let stickersToRemove = 1; + stickersToRemove <= Math.min(candidates.length, MAX_STICKERS_PER_REMOVAL_OPTION); + stickersToRemove++ ) { - // Array for selected stickers to remove and the list of options to remove from the staging area - const options: StickerSelection[][] = []; - const selected: typeof candidates = []; - - // Recursive function to find a list of options to remove from the stickers in the staging area. - function collectOptions(startIndex: number, freedArea: number): void { - // Stop the recursion once we have gathered enough removal options. - if (options.length >= MAX_REMOVAL_OPTIONS) { - return; - } - - // If the current selected combination of stickers is equal to selectionCount, - // we examine if removing those stickers frees enough space - // to accommodate the excessArea. If so, we push that combination on to - // the list of options, sorted by their original staging area index. - if (selected.length === selectionCount) { - if (freedArea >= excessArea) { - options.push( - [...selected] - .sort((left, right) => left.index - right.index) - .map(({ selection }) => selection), - ); - } - return; - } - - // Are there enough candidates left to finish this combination? - const remainingCount = selectionCount - selected.length; - if (candidates.length - startIndex < remainingCount) { - return; - } - - - // Make sure that the amount of area that could be freed by the remaining stickers is enough to accommodate the excessArea - let maximumRemainingArea = 0; - for (let index = startIndex; index < startIndex + remainingCount; index++) { - maximumRemainingArea += candidates[index].area; - } - if (freedArea + maximumRemainingArea < excessArea) { // if not end - return; - } - - // Recursively call this function with a new starting index. - for ( - let index = startIndex; - index <= candidates.length - remainingCount && - options.length < MAX_REMOVAL_OPTIONS; - index++ - ) { - selected.push(candidates[index]); - collectOptions(index + 1, freedArea + candidates[index].area); - selected.pop(); - } - } - - // Start the recursive function to find options of stickers to remove and return results. - collectOptions(0, 0); + const options = collectOptions(candidates, stickersToRemove, overflowAmount); if (options.length > 0) { return { fits: false, stickersToRemove: options }; }