semantic update

This commit is contained in:
2026-02-20 10:41:15 +03:00
parent d7e4919d54
commit af74841765
18 changed files with 1856 additions and 1326 deletions

View File

@@ -1,10 +1,17 @@
<!-- [DEF:Counter:Component] -->
<!--
@TIER: TRIVIAL
@PURPOSE: Simple counter demo component
@LAYER: UI
-->
<script>
let count = $state(0)
let count = $state(0);
const increment = () => {
count += 1
}
count += 1;
};
</script>
<button onclick={increment}>
count is {count}
</button>
<!-- [/DEF:Counter:Component] -->

View File

@@ -21,13 +21,14 @@ describe('SidebarStore', () => {
describe('initial state', () => {
it('should have default values when no localStorage', () => {
const state = get(sidebarStore);
expect(state.isExpanded).toBe(true);
expect(state.activeCategory).toBe('dashboards');
expect(state.activeItem).toBe('/dashboards');
expect(state.isMobileOpen).toBe(false);
});
});
// [/DEF:test_sidebar_initial_state:Function]
// [DEF:test_toggleSidebar:Function]
// @TEST: toggleSidebar toggles isExpanded state
@@ -37,9 +38,9 @@ describe('SidebarStore', () => {
it('should toggle isExpanded from true to false', () => {
const initialState = get(sidebarStore);
expect(initialState.isExpanded).toBe(true);
toggleSidebar();
const newState = get(sidebarStore);
expect(newState.isExpanded).toBe(false);
});
@@ -47,11 +48,12 @@ describe('SidebarStore', () => {
it('should toggle isExpanded from false to true', () => {
toggleSidebar(); // Now false
toggleSidebar(); // Should be true again
const state = get(sidebarStore);
expect(state.isExpanded).toBe(true);
});
});
// [/DEF:test_toggleSidebar:Function]
// [DEF:test_setActiveItem:Function]
// @TEST: setActiveItem updates activeCategory and activeItem
@@ -60,7 +62,7 @@ describe('SidebarStore', () => {
describe('setActiveItem', () => {
it('should update activeCategory and activeItem', () => {
setActiveItem('datasets', '/datasets');
const state = get(sidebarStore);
expect(state.activeCategory).toBe('datasets');
expect(state.activeItem).toBe('/datasets');
@@ -68,12 +70,13 @@ describe('SidebarStore', () => {
it('should update to admin category', () => {
setActiveItem('admin', '/settings');
const state = get(sidebarStore);
expect(state.activeCategory).toBe('admin');
expect(state.activeItem).toBe('/settings');
});
});
// [/DEF:test_setActiveItem:Function]
// [DEF:test_mobile_functions:Function]
// @TEST: Mobile functions correctly update isMobileOpen
@@ -82,7 +85,7 @@ describe('SidebarStore', () => {
describe('mobile functions', () => {
it('should set isMobileOpen to true with setMobileOpen', () => {
setMobileOpen(true);
const state = get(sidebarStore);
expect(state.isMobileOpen).toBe(true);
});
@@ -90,7 +93,7 @@ describe('SidebarStore', () => {
it('should set isMobileOpen to false with closeMobile', () => {
setMobileOpen(true);
closeMobile();
const state = get(sidebarStore);
expect(state.isMobileOpen).toBe(false);
});
@@ -98,18 +101,19 @@ describe('SidebarStore', () => {
it('should toggle isMobileOpen with toggleMobileSidebar', () => {
const initialState = get(sidebarStore);
const initialMobileOpen = initialState.isMobileOpen;
toggleMobileSidebar();
const state1 = get(sidebarStore);
expect(state1.isMobileOpen).toBe(!initialMobileOpen);
toggleMobileSidebar();
const state2 = get(sidebarStore);
expect(state2.isMobileOpen).toBe(initialMobileOpen);
});
});
// [/DEF:test_mobile_functions:Function]
});
// [/DEF:frontend.src.lib.stores.__tests__.sidebar:Module]

View File

@@ -1,4 +1,9 @@
// [DEF:Utils:Module]
/**
* @TIER: TRIVIAL
* @PURPOSE: General utility functions (class merging)
* @LAYER: Infra
*
* Merges class names into a single string.
* @param {...(string | undefined | null | false)} inputs
* @returns {string}
@@ -6,3 +11,4 @@
export function cn(...inputs) {
return inputs.filter(Boolean).join(" ");
}
// [/DEF:Utils:Module]

View File

@@ -1,4 +1,9 @@
// [DEF:Debounce:Module]
/**
* @TIER: TRIVIAL
* @PURPOSE: Debounce utility for limiting function execution rate
* @LAYER: Infra
*
* Debounce utility function
* Delays the execution of a function until a specified time has passed since the last call
*
@@ -17,3 +22,4 @@ export function debounce(func, wait) {
timeout = setTimeout(later, wait);
};
}
// [/DEF:Debounce:Module]