### Installation via npm Source: https://github.com/kshutkin/slimlib/blob/main/store/README.md Instructions for installing the Slimlib Store package as a development dependency using npm. ```bash npm install --save-dev @slimlib/store ``` -------------------------------- ### Preact Store Setup and Actions Source: https://context7.com/kshutkin/slimlib/llms.txt Demonstrates the creation of a reactive store using @slimlib/store/preact and defines actions to modify the application state. This includes managing notifications, user profiles, and themes. It relies on Preact and its hooks for component integration. ```typescript import { h } from 'preact'; import { useState } from 'preact/hooks'; import { createStore, useStore } from '@slimlib/store/preact'; // Create store const [appState, appStore] = createStore({ notifications: [], user: { name: '', avatar: '' }, theme: 'light' }); // Actions export function addNotification(message, type = 'info') { appState.notifications.push({ id: Date.now(), message, type, timestamp: new Date().toISOString(), read: false }); } export function markAsRead(id) { const notification = appState.notifications.find(n => n.id === id); if (notification) { notification.read = true; } } export function clearNotifications() { appState.notifications = []; } export function setUser(name, avatar) { appState.user.name = name; appState.user.avatar = avatar; } export function toggleTheme() { appState.theme = appState.theme === 'light' ? 'dark' : 'light'; } ``` -------------------------------- ### Svelte Component Usage Source: https://github.com/kshutkin/slimlib/blob/main/store/README.md Provides an example of how to consume a Svelte store created with Slimlib. It demonstrates importing the store and accessing its state reactively using the `$` prefix. ```svelte // use it in reactive way for reading data $storeName ``` -------------------------------- ### Install Slimlib List with npm Source: https://github.com/kshutkin/slimlib/blob/main/list/README.md Installs the Slimlib List package as a development dependency using npm. This command is typically run in the project's root directory. ```bash npm install --save-dev @slimlib/list ``` -------------------------------- ### Add Notification Button Examples (React) Source: https://context7.com/kshutkin/slimlib/llms.txt These examples demonstrate how to use buttons to trigger the 'addNotification' function with different message types (success, error, info) in a React application. The 'addNotification' function is assumed to be defined elsewhere, likely within the application's state management or notification system. ```javascript import React from 'react'; function App() { // Assume addNotification is defined elsewhere, e.g., from a context or hook const addNotification = (message, type) => { console.log(`Notification - Type: ${type}, Message: ${message}`); // Actual notification logic would go here }; return (