@uistate/core 4.0.1 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Imsirovic Ajdin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,37 +1,11 @@
1
- # @uistate/core v3.1.2
1
+ # UIstate
2
2
 
3
- **author**: Ajdin Imsirovic <ajdika@live.com> (GitHub)
4
- **maintainer**: uistate <ajdika.i@gmail.com> (npm)
3
+ A revolutionary approach to UI state management using CSS custom properties and DOM attributes, featuring Attribute-Driven State Inheritance (ADSI).
5
4
 
6
- High-performance UI state management using CSS custom properties and ADSI (Attribute-Driven State Inheritance). Focused heavily on DX and performance with a fully declarative approach.
5
+ **Current Version**: 4.1.1
7
6
 
8
- ## What's New in v3.1.1
9
-
10
- - 🛠️ Added `setStates()` method for batch state updates
11
- - 🧩 Added `registerSpecialHandler()` and `registerEventBinding()` for extensibility
12
- - 🏷️ New `setupObservers()` for automatic state-to-DOM binding
13
- - ⚡ Improved `setupStateActions()` with customizable event handling
14
- - 💾 Default event handlers for clicks and inputs with declarative binding
15
- - 🗡️ Enhanced attribute serialization with specialized handlers
16
-
17
- ## What's New in v3.0.0
18
-
19
- - 🔄 Fully declarative state management approach
20
- - 🧩 Enhanced template system with CSS-based templates
21
- - 🚀 Improved performance through optimized state propagation
22
- - 📦 New state serialization and inspection capabilities
23
- - 🔍 Telemetry plugin for better debugging
24
-
25
- ## Features
26
-
27
- - 🚀 O(1) state updates using CSS custom properties
28
- - 📉 Significant memory savings compared to virtual DOM approaches
29
- - 🎯 Zero configuration
30
- - 🔄 Automatic reactivity through CSS cascade
31
- - 🎨 Framework agnostic
32
- - 📦 Tiny bundle size (~2KB)
33
- - 🧩 Modular architecture with dedicated modules for CSS state and templates
34
- - 📝 Declarative HTML-in-CSS templates
7
+ **Author**: Ajdin Imsirovic <ajdika@live.com> (GitHub)
8
+ **Maintainer**: uistate <ajdika.i@gmail.com> (npm)
35
9
 
36
10
  ## Installation
37
11
 
@@ -39,85 +13,73 @@ High-performance UI state management using CSS custom properties and ADSI (Attri
39
13
  npm install @uistate/core
40
14
  ```
41
15
 
42
- ## Why @uistate/core?
43
-
44
- ### Performance
16
+ ## Quick Start
45
17
 
46
- - **CSS-Driven Updates**: Leverages browser's CSS engine for optimal performance with O(1) complexity
47
- - **DOM as Source of Truth**: Efficient state storage using CSS custom properties and data attributes
48
- - **Minimal Overhead**: No virtual DOM diffing or shadow DOM needed
18
+ UIstate v4.1.1 provides four core modules that can be imported individually:
49
19
 
50
- ### Developer Experience
20
+ ```javascript
21
+ import { createCssState, createEventState, stateSerializer, createTemplateManager } from '@uistate/core';
51
22
 
52
- - **Declarative API**: Define UI structure in CSS templates
53
- - **Framework Agnostic**: Works with any framework or vanilla JavaScript
54
- - **Zero Config**: No store setup, no reducers, no actions
55
- - **CSS-Native**: Leverages the power of CSS selectors and the cascade
23
+ // Create CSS-based state management
24
+ const cssState = createCssState();
56
25
 
57
- ### Core Concepts
26
+ // Create event-based state management
27
+ const eventState = createEventState();
58
28
 
59
- - **Attribute-Driven State Inheritance (ADSI)**: State represented both as CSS variables and data attributes
60
- - **Declarative Templates**: Define UI components directly in CSS
61
- - **Automatic State Propagation**: State changes automatically update the UI
29
+ // Use state serialization utilities
30
+ const serialized = stateSerializer.serialize(myState);
62
31
 
63
- ## Project Structure
64
-
65
- ```
66
- @uistate/core/
67
- ├── src/ # Core library
68
- │ ├── index.js # Main entry
69
- │ ├── cssState.js # CSS variables management
70
- │ ├── templateManager.js # Declarative template management
71
- │ ├── stateInspector.js # State inspection tools
72
- │ └── stateSerializer.js # State serialization
73
- └── examples/ # Example applications
74
- └── 001-.../ # Progressive examples from simpler to more complex
32
+ // Create template manager for declarative UI
33
+ const templateManager = createTemplateManager();
75
34
  ```
76
35
 
77
- ## Browser Support
36
+ ## Core Modules
78
37
 
79
- - Chrome 60+
80
- - Firefox 54+
81
- - Safari 10.1+
82
- - Edge 79+
83
-
84
- # Core Ideas Behind UIstate
38
+ ### `createCssState`
39
+ Manages state using CSS custom properties for optimal performance and automatic reactivity.
85
40
 
86
- UIstate is a JavaScript-based UI state management system that leverages CSS custom properties and HTML-in-CSS templates for a fully declarative approach to building UIs.
41
+ ### `createEventState`
42
+ Provides event-driven state management with pub/sub patterns.
87
43
 
88
- ## Key Components
44
+ ### `stateSerializer`
45
+ Utilities for serializing and deserializing state data.
89
46
 
90
- ### UIstate Core
47
+ ### `createTemplateManager`
48
+ Declarative template management system for building UIs with CSS-based templates.
91
49
 
92
- The main UIstate object provides methods to manage state and templates:
50
+ ## Key Features
93
51
 
94
- - **init()**: Initialize the UIstate system
95
- - **setState()**: Set state values
96
- - **getState()**: Get state values
97
- - **subscribe()**: Subscribe to state changes
98
- - **observe()**: Observe state paths for changes
52
+ - Potentially O(1) state updates
53
+ - Significant memory savings compared to virtual DOM approaches
54
+ - DOM as the single source of truth
55
+ - CSS-driven state derivation
56
+ - Framework agnostic
57
+ - Tiny bundle size (~30KB uncompressed, ~8-10KB gzipped)
58
+ - Zero dependencies
59
+ - Modular architecture - import only what you need
99
60
 
100
- ### Template Manager
61
+ ## Browser Support
101
62
 
102
- The template manager provides tools for declarative UI rendering:
63
+ - Chrome 60+
64
+ - Firefox 54+
65
+ - Safari 10.1+
66
+ - Edge 79+
103
67
 
104
- - **renderTemplateFromCss()**: Render UI components from CSS-defined templates
105
- - **registerActions()**: Register event handlers for UI components
106
- - **attachDelegation()**: Set up event delegation for efficient event handling
68
+ ## Philosophy
107
69
 
108
- ## Key Features
70
+ UIstate challenges traditional assumptions in web development by using the DOM as the source of truth for state, leveraging CSS variables and data attributes for state storage, and using the CSS cascade for state inheritance and derivation.
109
71
 
110
- 1. Uses CSS custom properties as a storage mechanism, making state changes automatically trigger UI updates
111
- 2. Provides a clear separation between state storage (CSS) and behavior (JavaScript)
112
- 3. Implements a pub/sub pattern for reactive updates
113
- 4. Leverages CSS templates for declarative UI definition
72
+ The v4.1.0 release focuses on simplicity and modularity - providing clean, individual modules that can be composed together as needed, without the complexity of a unified framework.
114
73
 
115
- This implementation is particularly useful for building UI components with clean separation of concerns, optimal performance, and a fully declarative approach.
74
+ ## Examples
116
75
 
117
- ## Contributing
76
+ Explore our documentation and examples to see UIstate in action:
118
77
 
119
- We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
78
+ - Range sliders with different state derivation approaches
79
+ - Button toggles with CSS state projection
80
+ - Font adjusters with domain-based state management
81
+ - And more!
120
82
 
121
83
  ## License
122
84
 
123
- MIT © Ajdin Imsirovic
85
+ MIT Ajdin Imsirovic
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "name": "@uistate/core",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
+ "description": "Revolutionary DOM-based state management using CSS custom properties - zero dependencies, potential O(1) updates",
4
5
  "type": "module",
5
- "description": "High-performance UI state management using CSS custom properties and ADSI (Attribute-Driven State Inheritance)",
6
- "main": "src/index.js",
7
- "module": "src/index.js",
6
+ "main": "index.js",
7
+ "exports": {
8
+ ".": "./index.js",
9
+ "./cssState": "./cssState.js",
10
+ "./eventState": "./eventState.js",
11
+ "./stateSerializer": "./stateSerializer.js",
12
+ "./templateManager": "./templateManager.js"
13
+ },
8
14
  "files": [
9
- "src"
15
+ "index.js",
16
+ "cssState.js",
17
+ "eventState.js",
18
+ "stateSerializer.js",
19
+ "templateManager.js"
10
20
  ],
11
- "scripts": {},
12
21
  "keywords": [
13
22
  "state-management",
14
- "ui",
15
- "css",
16
- "performance",
17
- "framework-agnostic",
18
- "vanilla-js"
19
- ],
20
- "author": "Ajdin Imsirovic <ajdika@live.com> (GitHub)",
21
- "contributors": [
22
- "uistate <ajdika.i@gmail.com> (npm)"
23
+ "css-variables",
24
+ "dom-events",
25
+ "zero-dependency",
26
+ "modular"
23
27
  ],
28
+ "author": "Ajdin Imsirovic",
24
29
  "license": "MIT",
25
30
  "repository": {
26
31
  "type": "git",
27
- "url": "git+https://github.com/ImsirovicAjdin/uistate.git"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/ImsirovicAjdin/uistate/issues"
31
- },
32
- "homepage": "https://github.com/ImsirovicAjdin/uistate#readme",
33
- "sideEffects": false
32
+ "url": "https://github.com/ImsirovicAjdin/uistate"
33
+ }
34
34
  }
File without changes
File without changes
File without changes
File without changes
File without changes