@ea-lab/reactive-json-docs 1.0.0-alpha.0 → 1.1.0

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.
Files changed (55) hide show
  1. package/package.json +2 -2
  2. package/public/rjbuild/docs/advanced-concepts/attribute-transformers.md +168 -0
  3. package/public/rjbuild/docs/advanced-concepts/attribute-transformers.yaml +151 -0
  4. package/public/rjbuild/docs/advanced-concepts/data-mapping.md +6 -6
  5. package/public/rjbuild/docs/advanced-concepts/data-mapping.yaml +7 -7
  6. package/public/rjbuild/docs/advanced-concepts/data-processors.md +7 -7
  7. package/public/rjbuild/docs/advanced-concepts/data-processors.yaml +7 -7
  8. package/public/rjbuild/docs/advanced-concepts/forward-update.md +82 -9
  9. package/public/rjbuild/docs/advanced-concepts/forward-update.yaml +83 -13
  10. package/public/rjbuild/docs/advanced-concepts/index.md +1 -0
  11. package/public/rjbuild/docs/advanced-concepts/index.yaml +1 -0
  12. package/public/rjbuild/docs/advanced-concepts/plugins/component-development.md +1 -1
  13. package/public/rjbuild/docs/advanced-concepts/plugins/component-development.yaml +1 -1
  14. package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.md +1 -1
  15. package/public/rjbuild/docs/advanced-concepts/plugins/plugin-system.yaml +1 -1
  16. package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.md +2 -0
  17. package/public/rjbuild/docs/core/action/Attribute/SetAttributeValue.yaml +2 -0
  18. package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.md +2 -0
  19. package/public/rjbuild/docs/core/action/Attribute/ToggleAttributeValue.yaml +2 -0
  20. package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.md +2 -0
  21. package/public/rjbuild/docs/core/action/Attribute/UnsetAttribute.yaml +2 -0
  22. package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.md +2 -0
  23. package/public/rjbuild/docs/core/action/Attribute/UnsetAttributeValue.yaml +2 -0
  24. package/public/rjbuild/docs/core/action/Attribute/index.md +121 -0
  25. package/public/rjbuild/docs/core/action/Attribute/index.yaml +77 -0
  26. package/public/rjbuild/docs/core/action/CustomEventListener.md +150 -0
  27. package/public/rjbuild/docs/core/action/CustomEventListener.yaml +158 -0
  28. package/public/rjbuild/docs/core/action/HashChangeListener.md +1 -1
  29. package/public/rjbuild/docs/core/action/HashChangeListener.yaml +1 -1
  30. package/public/rjbuild/docs/core/action/MessageListener.md +1 -1
  31. package/public/rjbuild/docs/core/action/MessageListener.yaml +1 -1
  32. package/public/rjbuild/docs/core/action/ReactOnEvent.md +3 -3
  33. package/public/rjbuild/docs/core/action/ReactOnEvent.yaml +3 -3
  34. package/public/rjbuild/docs/core/action/index.md +2 -1
  35. package/public/rjbuild/docs/core/action/index.yaml +2 -1
  36. package/public/rjbuild/docs/core/attributeTransformer/index.md +17 -0
  37. package/public/rjbuild/docs/core/attributeTransformer/index.yaml +24 -0
  38. package/public/rjbuild/docs/core/attributeTransformer/setAttributeValue.md +101 -0
  39. package/public/rjbuild/docs/core/attributeTransformer/setAttributeValue.yaml +144 -0
  40. package/public/rjbuild/docs/core/attributeTransformer/toggleAttributeValue.md +269 -0
  41. package/public/rjbuild/docs/core/attributeTransformer/toggleAttributeValue.yaml +247 -0
  42. package/public/rjbuild/docs/core/attributeTransformer/unsetAttribute.md +114 -0
  43. package/public/rjbuild/docs/core/attributeTransformer/unsetAttribute.yaml +138 -0
  44. package/public/rjbuild/docs/core/attributeTransformer/unsetAttributeValue.md +140 -0
  45. package/public/rjbuild/docs/core/attributeTransformer/unsetAttributeValue.yaml +187 -0
  46. package/public/rjbuild/docs/core/hook/index.md +38 -0
  47. package/public/rjbuild/docs/core/hook/index.yaml +44 -0
  48. package/public/rjbuild/docs/core/hook/usePagination.md +286 -0
  49. package/public/rjbuild/docs/core/hook/usePagination.yaml +319 -0
  50. package/public/rjbuild/docs/core/hook/useTransformedAttributes.md +130 -0
  51. package/public/rjbuild/docs/core/hook/useTransformedAttributes.yaml +164 -0
  52. package/public/rjbuild/docs/core/reaction/fetchData.md +25 -0
  53. package/public/rjbuild/docs/core/reaction/fetchData.yaml +30 -2
  54. package/public/rjbuild/docs/core/reaction/submitData.md +28 -0
  55. package/public/rjbuild/docs/core/reaction/submitData.yaml +32 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ea-lab/reactive-json-docs",
3
- "version": "1.0.0-alpha.0",
3
+ "version": "1.1.0",
4
4
  "description": "Complete documentation for Reactive-JSON - Components, examples and LLM-parsable guides",
5
5
  "main": "public/rjbuild/docs/index.yaml",
6
6
  "files": [
@@ -26,7 +26,7 @@
26
26
  "private": false,
27
27
  "devDependencies": {
28
28
  "@craco/craco": "^7.1.0",
29
- "@ea-lab/reactive-json": "^1.0.0-alpha.6",
29
+ "@ea-lab/reactive-json": "^1.1.0",
30
30
  "@ea-lab/reactive-json-chartjs": "^1.0.0",
31
31
  "@npmcli/fs": "^4.0.0",
32
32
  "@reduxjs/toolkit": "^2.6.1",
@@ -0,0 +1,168 @@
1
+ # Attribute Transformers
2
+
3
+ > **Note**: Reactive-JSON provides two systems for attribute modification:
4
+ >
5
+ > - **Attribute Transformers** (this section): Execute **before rendering**, modify attributes for child components
6
+ > - **[Attribute Actions](../core/action/Attribute/index.md)**: Execute **after rendering**, modify DOM attributes directly
7
+ >
8
+ > Choose transformers for pre-render attribute conditioning and actions for post-render DOM manipulation.
9
+
10
+ Attribute Transformers in Reactive-JSON allow you to modify element attributes before rendering based on dynamic conditions. They are evaluated during the attribute evaluation phase and provide pre-render attribute manipulation capabilities.
11
+
12
+ ## Key Differences from Actions
13
+
14
+ - **Timing**: Attribute transformers execute **before rendering**, while actions execute **after rendering**
15
+ - **Impact**: Transformers affect attributes passed to child components, actions modify the DOM directly
16
+ - **Use case**: Transformers are ideal for conditional attribute values that need to be available to child components
17
+
18
+ ## Available Transformers
19
+
20
+ For a complete list of built-in attribute transformers, see **[Attribute Transformers Reference](../core/attributeTransformer/index.md)**.
21
+
22
+ ## Extensibility
23
+
24
+ The Attribute Transformer system is fully extensible through the plugin system. You can create custom transformers to handle specific attribute manipulation needs in your application.
25
+
26
+ ### Creating Custom Attribute Transformers
27
+
28
+ Attribute transformers are JavaScript functions that receive attributes and transformation properties, then return the modified attributes:
29
+
30
+ ```javascript
31
+ // customTransformer.js
32
+ export const myCustomTransformer = ({ attributes, globalDataContext, singleTransformProps, templateContext }) => {
33
+ const { name, customProperty } = singleTransformProps;
34
+
35
+ // Your custom logic here
36
+ // Modify the attributes object
37
+
38
+ return attributes;
39
+ };
40
+ ```
41
+
42
+ ### Plugin Registration
43
+
44
+ Include your custom transformers in a plugin and register them with ReactiveJsonRoot:
45
+
46
+ ```javascript
47
+ // myPlugin.js
48
+ import { myCustomTransformer } from "./transformers/customTransformer.js";
49
+
50
+ export const myPlugin = {
51
+ attributeTransformer: {
52
+ myCustomTransformer,
53
+ }
54
+ };
55
+ ```
56
+
57
+ ```javascript
58
+ // App.js
59
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
60
+ import { myPlugin } from "./plugins/myPlugin.js";
61
+
62
+ const App = () => {
63
+ return (
64
+ <ReactiveJsonRoot
65
+ plugins={mergeComponentCollections([myPlugin])}
66
+ />
67
+ );
68
+ };
69
+ ```
70
+
71
+ ### Usage in RjBuild
72
+
73
+ Once registered, your custom transformer can be used in any element:
74
+
75
+ ```yaml
76
+ renderView:
77
+ - type: div
78
+ attributes:
79
+ class: "base-class"
80
+ attributeTransforms:
81
+ - what: myCustomTransformer
82
+ name: "data-custom"
83
+ customProperty: "value"
84
+ when: ~~.someCondition
85
+ is: true
86
+ ```
87
+
88
+ For detailed component development guidance, see **[Plugin Development](./plugins/index.md)**.
89
+
90
+ ## Basic Usage
91
+
92
+ Attribute transformers are defined in the `attributeTransforms` array on any element:
93
+
94
+ ```yaml
95
+ renderView:
96
+ - type: div
97
+ attributes:
98
+ class: "base-class"
99
+ data-status: "default"
100
+ attributeTransforms:
101
+ # Add class conditionally
102
+ - what: setAttributeValue
103
+ name: "class"
104
+ value: "active"
105
+ when: ~~.isActive
106
+ is: true
107
+
108
+ # Remove attribute entirely
109
+ - what: unsetAttribute
110
+ name: "data-status"
111
+ when: ~~.hideStatus
112
+ is: true
113
+
114
+ # Toggle between states
115
+ - what: toggleAttributeValue
116
+ name: "class"
117
+ value: ["theme-light", "theme-dark"]
118
+ when: ~~.toggleTheme
119
+ isNotEmpty:
120
+ ```
121
+
122
+ ## Execution Order
123
+
124
+ Attribute transformers are applied in the order they appear in the `attributeTransforms` array:
125
+
126
+ 1. Base attributes are evaluated (template resolution)
127
+ 2. Each transformer is applied sequentially
128
+ 3. The final attributes are passed to the component/element
129
+
130
+ ## Conditional Execution
131
+
132
+ All attribute transformers support the same conditional system as actions:
133
+
134
+ - **`when`**: Specifies the data value to evaluate
135
+ - **`is`**: Exact value comparison
136
+ - **`isEmpty`/`isNotEmpty`**: Empty/non-empty checks
137
+ - **Template evaluation**: Full support for `~.`, `~~.`, `~>`, `~~>` patterns
138
+
139
+ ## Common Patterns
140
+
141
+ ### Conditional Styling
142
+ ```yaml
143
+ attributeTransforms:
144
+ - what: setAttributeValue
145
+ name: "class"
146
+ value: "error"
147
+ when: ~~.validation.hasErrors
148
+ is: true
149
+ ```
150
+
151
+ ### State-based Attributes
152
+ ```yaml
153
+ attributeTransforms:
154
+ - what: toggleAttributeValue
155
+ name: "aria-expanded"
156
+ value: "true"
157
+ when: ~~.menu.isOpen
158
+ is: true
159
+ ```
160
+
161
+ ### Dynamic Data Attributes
162
+ ```yaml
163
+ attributeTransforms:
164
+ - what: setAttributeValue
165
+ name: "data-user-role"
166
+ value: ~~.currentUser.role
167
+ mode: "replace"
168
+ ```
@@ -0,0 +1,151 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Attribute Transformers
5
+
6
+ > **Note**: Reactive-JSON provides two systems for attribute modification:
7
+ >
8
+ > - **Attribute Transformers** (this section): Execute **before rendering**, modify attributes for child components
9
+ > - **[Attribute Actions](../core/action/Attribute/index)**: Execute **after rendering**, modify DOM attributes directly
10
+ >
11
+ > Choose transformers for pre-render attribute conditioning and actions for post-render DOM manipulation.
12
+
13
+ Attribute Transformers in Reactive-JSON allow you to modify element attributes before rendering based on dynamic conditions. They are evaluated during the attribute evaluation phase and provide pre-render attribute manipulation capabilities.
14
+
15
+ - type: TabbedSerializer
16
+ yamlSerializedContent: |
17
+ renderView:
18
+ - type: div
19
+ attributes:
20
+ class: "base-class"
21
+ data-status: "default"
22
+ attributeTransforms:
23
+ # Add class conditionally
24
+ - what: setAttributeValue
25
+ name: "class"
26
+ value: "active"
27
+ when: ~~.isActive
28
+ is: true
29
+
30
+ # Remove attribute entirely
31
+ - what: unsetAttribute
32
+ name: "data-status"
33
+ when: ~~.hideStatus
34
+ is: true
35
+
36
+ # Toggle between states
37
+ - what: toggleAttributeValue
38
+ name: "class"
39
+ value: ["theme-light", "theme-dark"]
40
+ when: ~~.toggleTheme
41
+ isNotEmpty:
42
+
43
+ - type: Markdown
44
+ content: |
45
+ ## Key Differences from Actions
46
+
47
+ - **Timing**: Attribute transformers execute **before rendering**, while actions execute **after rendering**
48
+ - **Impact**: Transformers affect attributes passed to child components, actions modify the DOM directly
49
+ - **Use case**: Transformers are ideal for conditional attribute values that need to be available to child components
50
+
51
+ ## Available Transformers
52
+
53
+ For a complete list of built-in attribute transformers, see **[Attribute Transformers Reference](../core/attributeTransformer/index)**.
54
+
55
+ ## Extensibility
56
+
57
+ The Attribute Transformer system is fully extensible through the plugin system. You can create custom transformers to handle specific attribute manipulation needs in your application.
58
+
59
+ ### Creating Custom Attribute Transformers
60
+
61
+ Attribute transformers are JavaScript functions that receive attributes and transformation properties, then return the modified attributes:
62
+
63
+ - type: SyntaxHighlighter
64
+ language: javascript
65
+ content: |
66
+ // customTransformer.js
67
+ export const myCustomTransformer = ({ attributes, globalDataContext, singleTransformProps, templateContext }) => {
68
+ const { name, customProperty } = singleTransformProps;
69
+
70
+ // Your custom logic here
71
+ // Modify the attributes object
72
+
73
+ return attributes;
74
+ };
75
+
76
+ - type: Markdown
77
+ content: |
78
+ ### Plugin Registration
79
+
80
+ Include your custom transformers in a plugin and register them with ReactiveJsonRoot:
81
+
82
+ - type: SyntaxHighlighter
83
+ language: javascript
84
+ content: |
85
+ // myPlugin.js
86
+ import { myCustomTransformer } from "./transformers/customTransformer.js";
87
+
88
+ export const myPlugin = {
89
+ attributeTransformer: {
90
+ myCustomTransformer,
91
+ }
92
+ };
93
+
94
+ - type: SyntaxHighlighter
95
+ language: javascript
96
+ content: |
97
+ // App.js
98
+ import { ReactiveJsonRoot, mergeComponentCollections } from "@ea-lab/reactive-json";
99
+ import { myPlugin } from "./plugins/myPlugin.js";
100
+
101
+ const App = () => {
102
+ return (
103
+ <ReactiveJsonRoot
104
+ plugins={mergeComponentCollections([myPlugin])}
105
+ />
106
+ );
107
+ };
108
+
109
+ - type: Markdown
110
+ content: |
111
+ ### Usage in RjBuild
112
+
113
+ Once registered, your custom transformer can be used in any element:
114
+
115
+ - type: TabbedSerializer
116
+ yamlSerializedContent: |
117
+ renderView:
118
+ - type: div
119
+ attributes:
120
+ class: "base-class"
121
+ attributeTransforms:
122
+ - what: myCustomTransformer
123
+ name: "data-custom"
124
+ customProperty: "value"
125
+ when: ~~.someCondition
126
+ is: true
127
+
128
+ - type: Markdown
129
+ content: |
130
+ For detailed component development guidance, see **[Plugin Development](./plugins/index)**.
131
+
132
+ ## Execution Order
133
+
134
+ Attribute transformers are applied in the order they appear in the `attributeTransforms` array:
135
+
136
+ 1. Base attributes are evaluated (template resolution)
137
+ 2. Each transformer is applied sequentially
138
+ 3. The final attributes are passed to the component/element
139
+
140
+ ## Conditional Execution
141
+
142
+ All attribute transformers support the same conditional system as actions:
143
+
144
+ - **`when`**: Specifies the data value to evaluate
145
+ - **`is`**: Exact value comparison
146
+ - **`isEmpty`/`isNotEmpty`**: Empty/non-empty checks
147
+ - **Template evaluation**: Full support for `~.`, `~~.`, `~>`, `~~>` patterns
148
+
149
+ data:
150
+ page_title: "Attribute Transformers - Reactive-JSON Documentation"
151
+
@@ -1,14 +1,14 @@
1
- # Data Mapping System
1
+ # Data mapping
2
2
 
3
- Data Mapping is a powerful, extensible system in Reactive-JSON that allows you to selectively dispatch and transform response data from HTTP requests to specific locations in your application state.
3
+ Data mapping is a powerful, extensible system in Reactive-JSON that allows you to selectively dispatch and transform response data from HTTP requests to specific locations in your application state.
4
4
 
5
5
  ## System Architecture
6
6
 
7
- The Data Mapping system operates **after** Data Processors have processed the response, providing a clean separation of concerns:
7
+ The Data mapping system operates **after** Data Processors have processed the response, providing a clean separation of concerns:
8
8
 
9
9
  1. **HTTP Request** → Server responds with raw data
10
10
  2. **Data Processors** → Transform/validate the raw response
11
- 3. **Data Mapping** → Selectively dispatch transformed data to application state
11
+ 3. **Data mapping** → Selectively dispatch transformed data to application state
12
12
  4. **Application State** → Updated with mapped data
13
13
 
14
14
  ## Core Components
@@ -26,7 +26,7 @@ Reactive-JSON includes **simpleMapping** as a core data mapper, providing string
26
26
 
27
27
  ## Custom Data Mappers
28
28
 
29
- The Data Mapping system is extensible through custom mapper plugins. You can create specialized mappers for complex transformation logic, integration with external libraries, or domain-specific processing needs.
29
+ The Data mapping system is extensible through custom mapper plugins. You can create specialized mappers for complex transformation logic, integration with external libraries, or domain-specific processing needs.
30
30
 
31
31
  ### Creating Custom Mappers
32
32
 
@@ -53,7 +53,7 @@ Custom mappers are automatically merged with core mappers, allowing you to exten
53
53
 
54
54
  ## Usage Context
55
55
 
56
- Data Mapping can be used with all HTTP-based data operations in Reactive-JSON:
56
+ Data mapping can be used with all HTTP-based data operations in Reactive-JSON:
57
57
 
58
58
  - **fetchData & submitData reactions**: Process API responses selectively
59
59
  - **additionalDataSources**: Map initial data loading responses
@@ -1,18 +1,18 @@
1
1
  renderView:
2
2
  - type: Markdown
3
3
  content: |
4
- # Data Mapping System
4
+ # Data mapping
5
5
 
6
- Data Mapping is a powerful, extensible system in Reactive-JSON that allows you to selectively dispatch and transform response data from HTTP requests to specific locations in your application state. This system provides fine-grained control over how incoming data is processed and stored after HTTP operations.
6
+ Data mapping is a powerful, extensible system in Reactive-JSON that allows you to selectively dispatch and transform response data from HTTP requests to specific locations in your application state. This system provides fine-grained control over how incoming data is processed and stored after HTTP operations.
7
7
 
8
8
  Data mapping occurs after the [Data Processors](data-processors) have processed the response.
9
9
 
10
10
  ## System Architecture
11
11
 
12
- The Data Mapping system processes HTTP response data to selectively dispatch it to application state:
12
+ The Data mapping system processes HTTP response data to selectively dispatch it to application state:
13
13
 
14
14
  1. **HTTP Request** → Server responds with data
15
- 2. **Data Mapping** → Selectively dispatch response data to application state
15
+ 2. **Data mapping** → Selectively dispatch response data to application state
16
16
  3. **Application State** → Updated with mapped data
17
17
 
18
18
  ## Core Components
@@ -30,7 +30,7 @@ renderView:
30
30
 
31
31
  ## Custom Data Mappers
32
32
 
33
- The Data Mapping system is extensible through custom mapper plugins. You can create specialized mappers for complex transformation logic, integration with external libraries, or domain-specific processing needs.
33
+ The Data mapping system is extensible through custom mapper plugins. You can create specialized mappers for complex transformation logic, integration with external libraries, or domain-specific processing needs.
34
34
 
35
35
  ### Creating Custom Mappers
36
36
 
@@ -68,7 +68,7 @@ renderView:
68
68
 
69
69
  ## Usage Context
70
70
 
71
- Data Mapping can be used with all HTTP-based data operations in Reactive-JSON:
71
+ Data mapping can be used with all HTTP-based data operations in Reactive-JSON:
72
72
 
73
73
  - type: Markdown
74
74
  content: |
@@ -100,7 +100,7 @@ renderView:
100
100
 
101
101
  ## Plugin System Integration
102
102
 
103
- The Data Mapping system integrates with Reactive-JSON's plugin architecture:
103
+ The Data mapping system integrates with Reactive-JSON's plugin architecture:
104
104
 
105
105
  ```javascript
106
106
  import { mergeComponentCollections, ReactiveJsonRoot } from "@ea-lab/reactive-json";
@@ -1,10 +1,10 @@
1
- # Data Processors
1
+ # Data processors
2
2
 
3
- Data Processors are a powerful feature in Reactive-JSON that allow you to intercept and modify data received via `fetchData`, `submitData`, and `additionalDataSources`. This enables you to implement data transformation, validation, security filtering, and other data processing logic in a centralized and reusable way.
3
+ Data processors are a powerful feature in Reactive-JSON that allow you to intercept and modify data received via `fetchData`, `submitData`, and `additionalDataSources`. This enables you to implement data transformation, validation, security filtering, and other data processing logic in a centralized and reusable way.
4
4
 
5
- ## How Data Processors Work
5
+ ## How Data processors Work
6
6
 
7
- When Reactive-JSON receives data from HTTP requests, it automatically passes the data through all registered Data Processors in order. Each processor:
7
+ When Reactive-JSON receives data from HTTP requests, it automatically passes the data through all registered Data processors in order. Each processor:
8
8
 
9
9
  1. **Examines the request and response context** (URL, method, headers, status, etc.)
10
10
  2. **Receives the current data** being processed
@@ -54,14 +54,14 @@ Information about the HTTP response:
54
54
  - `data`: Raw response data
55
55
 
56
56
  ### dataToProcess
57
- The data currently being processed. This may have been modified by previous Data Processors in the chain.
57
+ The data currently being processed. This may have been modified by previous Data processors in the chain.
58
58
 
59
59
  ### originalDataToProcess
60
60
  The original data before any processing, useful for comparison or logging.
61
61
 
62
62
  ## Plugin Registration
63
63
 
64
- Data Processors are registered through the plugin system:
64
+ Data processors are registered through the plugin system:
65
65
 
66
66
  ```javascript
67
67
  import { mergeComponentCollections } from "@ea-lab/reactive-json";
@@ -222,7 +222,7 @@ additionalDataSource:
222
222
  ## Best Practices
223
223
 
224
224
  ### Always Return Data
225
- Data Processors **must always return data**. To skip processing, return the original data:
225
+ Data processors **must always return data**. To skip processing, return the original data:
226
226
 
227
227
  ```javascript
228
228
  const myProcessor = ({ requestContext, responseContext, dataToProcess, originalDataToProcess }) => {
@@ -1,13 +1,13 @@
1
1
  renderView:
2
2
  - type: Markdown
3
3
  content: |
4
- # Data Processors
4
+ # Data processors
5
5
 
6
- Data Processors are a powerful feature in Reactive-JSON that allow you to intercept and modify data received via `fetchData`, `submitData`, and `additionalDataSources`. This enables you to implement data transformation, validation, security filtering, and other data processing logic in a centralized and reusable way.
6
+ Data processors are a powerful feature in Reactive-JSON that allow you to intercept and modify data received via `fetchData`, `submitData`, and `additionalDataSources`. This enables you to implement data transformation, validation, security filtering, and other data processing logic in a centralized and reusable way.
7
7
 
8
- ## How Data Processors Work
8
+ ## How Data processors Work
9
9
 
10
- When Reactive-JSON receives data from HTTP requests, it automatically passes the data through all registered Data Processors in order. Each processor:
10
+ When Reactive-JSON receives data from HTTP requests, it automatically passes the data through all registered Data processors in order. Each processor:
11
11
 
12
12
  1. **Examines the request and response context** (URL, method, headers, status, etc.)
13
13
  2. **Receives the current data** being processed
@@ -73,7 +73,7 @@ renderView:
73
73
  details:
74
74
  type: Markdown
75
75
  content: |
76
- The data currently being processed. This may have been modified by previous Data Processors in the chain.
76
+ The data currently being processed. This may have been modified by previous Data processors in the chain.
77
77
 
78
78
  - term: originalDataToProcess
79
79
  details:
@@ -85,7 +85,7 @@ renderView:
85
85
  content: |
86
86
  ## Plugin Registration
87
87
 
88
- Data Processors are registered through the plugin system:
88
+ Data processors are registered through the plugin system:
89
89
 
90
90
  - type: SyntaxHighlighter
91
91
  language: javascript
@@ -213,7 +213,7 @@ renderView:
213
213
  ## Best Practices
214
214
 
215
215
  ### Always Return Data
216
- Data Processors **must always return data**. To skip processing, return the original data:
216
+ Data processors **must always return data**. To skip processing, return the original data:
217
217
 
218
218
  - type: SyntaxHighlighter
219
219
  language: javascript
@@ -1,10 +1,8 @@
1
- # Forward Update Pattern (Event Placeholders)
2
-
3
- Added in **reactive-json@0.0.43**.
1
+ # Forward update
4
2
 
5
3
  > Use the special placeholder `<reactive-json:event>` to reference values coming directly from the DOM or the custom event that triggered a reaction.
6
4
 
7
- The **Forward Update** pattern lets you use the special placeholder `<reactive-json:event>` inside any reaction arguments. It is primarily useful with `setData`, but can be applied to any reaction. Instead of reading a value *after* the global data has been updated, you can forward the fresh value carried by the event itself.
5
+ The **Forward update** pattern lets you use the special placeholder `<reactive-json:event>` inside any reaction arguments. It is primarily useful with `setData`, but can be applied to any reaction. Instead of reading a value *after* the global data has been updated, you can forward the fresh value carried by the event itself.
8
6
 
9
7
  ## Syntax
10
8
 
@@ -19,10 +17,29 @@ value: "<reactive-json:event>.target.checked" # For checkboxes
19
17
 
20
18
  ### The `<reactive-json:event-new-value>` shortcut
21
19
 
22
- `<reactive-json:event-new-value>` returns, in order of priority:
23
- 1. `event.target.checked` (checkboxes / toggle inputs)
24
- 2. `event.target.value` (text inputs, selects, etc.)
25
- 3. `undefined` if none of the above exists.
20
+ `<reactive-json:event-new-value>` automatically detects and returns the most relevant value from different types of events. The extraction logic varies based on the event type and the target element.
21
+
22
+ #### Extraction Rules Reference
23
+
24
+ | Event Type | Target Element | Logic | Return Value | Example |
25
+ |------------|----------------|-------|--------------|---------|
26
+ | **CustomEvent** | Any | Returns `event.detail.value` | Any value from custom event payload | `<reactive-json:event-new-value>.preferences.theme` |
27
+ | **DOM Event** | `input[type="checkbox"]` | Returns `event.target.checked` | `true` or `false` | `<reactive-json:event-new-value>` → `true` |
28
+ | **DOM Event** | `input[type="radio"]` | Returns `event.target.value` if checked, otherwise `undefined` | String value or `undefined` | `<reactive-json:event-new-value>` → `"option1"` |
29
+ | **DOM Event** | `input[type="text"]`, `textarea`, `select` | Returns `event.target.value` | String value | `<reactive-json:event-new-value>` → `"user input"` |
30
+ | **DOM Event** | Element with `value` property | Returns `event.target.value` | Any value | `<reactive-json:event-new-value>` → `"42"` |
31
+ | **DOM Event** | Element with `checked` property (fallback) | Returns `event.target.checked` | `true` or `false` | `<reactive-json:event-new-value>` → `false` |
32
+ | **Any Event** | No applicable property | Returns `undefined` | `undefined` | `<reactive-json:event-new-value>` → `undefined` |
33
+
34
+ #### Processing Priority
35
+ For DOM events, the extraction follows this priority order:
36
+ 1. **Checkbox**: `event.target.checked` (boolean)
37
+ 2. **Radio button**: `event.target.value` only if checked, otherwise `undefined`
38
+ 3. **General case**: `event.target.value` (if property exists)
39
+ 4. **Fallback**: `event.target.checked` (if property exists)
40
+ 5. **Default**: `undefined`
41
+
42
+ For CustomEvent objects (like `response` events from `fetchData`), it directly accesses `event.detail.value` and allows further property access with dot notation.
26
43
 
27
44
  ## Good Practice
28
45
 
@@ -36,11 +53,31 @@ If no property path is provided (`<reactive-json:event>` alone), nothing is forw
36
53
 
37
54
  You can access any nested property (`detail`, `key`, etc.).
38
55
 
56
+ ## Event Types
57
+
58
+ ### Standard DOM Events
59
+ The forward update system works with standard DOM events (`change`, `input`, `click`, etc.) from form elements and other HTML components.
60
+
61
+ ### Response Event
62
+ You can also use the special `response` event with reactions like `fetchData`. This event is triggered when an HTTP request completes successfully, allowing you to access the response data directly.
63
+
64
+ ```yaml
65
+ actions:
66
+ - what: fetchData
67
+ url: "/api/user-profile.json"
68
+ on: click
69
+ - what: setData
70
+ on: response # Triggered when fetchData completes
71
+ path: ~~.userTheme
72
+ value: <reactive-json:event-new-value>.preferences.theme
73
+ ```
74
+
39
75
  ## Typical Use-cases
40
76
 
41
77
  - Real-time mirroring of form fields
42
- - Select all checkboxes
78
+ - "Select all" checkboxes
43
79
  - Forward arbitrary values coming from events
80
+ - Process HTTP response data immediately after fetch operations
44
81
 
45
82
  ## Examples
46
83
 
@@ -90,4 +127,40 @@ renderView:
90
127
  data:
91
128
  primary_text: ""
92
129
  secondary_text: ""
130
+ ```
131
+
132
+ ### Response Event Processing
133
+
134
+ ```yaml
135
+ renderView:
136
+ - type: button
137
+ content: "Load User Profile"
138
+ actions:
139
+ - what: fetchData
140
+ on: click
141
+ url: "/api/user-profile.json"
142
+ updateOnlyData: true
143
+ updateDataAtLocation: ~~.userProfile
144
+ - what: setData
145
+ on: response # Triggered when fetchData completes
146
+ path: ~~.userTheme
147
+ value: <reactive-json:event-new-value>.preferences.theme
148
+ - what: setData
149
+ on: response
150
+ path: ~~.userName
151
+ value: <reactive-json:event-new-value>.name
152
+ - type: div
153
+ content:
154
+ - "User theme: "
155
+ - type: code
156
+ content: ~~.userTheme
157
+ - type: div
158
+ content:
159
+ - "User name: "
160
+ - type: strong
161
+ content: ~~.userName
162
+
163
+ data:
164
+ userTheme: "not-loaded"
165
+ userName: "not-loaded"
93
166
  ```