@ea-lab/reactive-json-docs 0.1.2

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 (93) hide show
  1. package/README-npm.md +49 -0
  2. package/README.md +86 -0
  3. package/package.json +79 -0
  4. package/public/rjbuild/component-doc/chartjs/components.yaml +252 -0
  5. package/public/rjbuild/component-doc/chartjs/overview.yaml +51 -0
  6. package/public/rjbuild/component-doc/core/action/HashChangeListener.md +90 -0
  7. package/public/rjbuild/component-doc/core/action/HashChangeListener.yaml +124 -0
  8. package/public/rjbuild/component-doc/core/action/Hide.md +22 -0
  9. package/public/rjbuild/component-doc/core/action/Hide.yaml +60 -0
  10. package/public/rjbuild/component-doc/core/action/MessageListener.md +93 -0
  11. package/public/rjbuild/component-doc/core/action/MessageListener.yaml +153 -0
  12. package/public/rjbuild/component-doc/core/action/Popover.md +26 -0
  13. package/public/rjbuild/component-doc/core/action/Popover.yaml +100 -0
  14. package/public/rjbuild/component-doc/core/action/ReactOnEvent.md +81 -0
  15. package/public/rjbuild/component-doc/core/action/ReactOnEvent.yaml +133 -0
  16. package/public/rjbuild/component-doc/core/action/Redirect.md +20 -0
  17. package/public/rjbuild/component-doc/core/action/Redirect.yaml +68 -0
  18. package/public/rjbuild/component-doc/core/action/Tooltip.md +22 -0
  19. package/public/rjbuild/component-doc/core/action/Tooltip.yaml +90 -0
  20. package/public/rjbuild/component-doc/core/action/VisuallyHide.md +21 -0
  21. package/public/rjbuild/component-doc/core/action/VisuallyHide.yaml +62 -0
  22. package/public/rjbuild/component-doc/core/action/index.md +214 -0
  23. package/public/rjbuild/component-doc/core/action/index.yaml +278 -0
  24. package/public/rjbuild/component-doc/core/element/form/CheckBoxField.md +276 -0
  25. package/public/rjbuild/component-doc/core/element/form/CheckBoxField.yaml +338 -0
  26. package/public/rjbuild/component-doc/core/element/form/DateField.md +189 -0
  27. package/public/rjbuild/component-doc/core/element/form/DateField.yaml +264 -0
  28. package/public/rjbuild/component-doc/core/element/form/NumberField.md +136 -0
  29. package/public/rjbuild/component-doc/core/element/form/NumberField.yaml +103 -0
  30. package/public/rjbuild/component-doc/core/element/form/SelectField.md +304 -0
  31. package/public/rjbuild/component-doc/core/element/form/SelectField.yaml +360 -0
  32. package/public/rjbuild/component-doc/core/element/form/TextAreaField.md +134 -0
  33. package/public/rjbuild/component-doc/core/element/form/TextAreaField.yaml +146 -0
  34. package/public/rjbuild/component-doc/core/element/form/TextField.md +129 -0
  35. package/public/rjbuild/component-doc/core/element/form/TextField.yaml +147 -0
  36. package/public/rjbuild/component-doc/core/element/form/formElementsCommon.md +106 -0
  37. package/public/rjbuild/component-doc/core/element/form/index.md +50 -0
  38. package/public/rjbuild/component-doc/core/element/form/index.yaml +96 -0
  39. package/public/rjbuild/component-doc/core/element/html/AccordionItem.yaml +47 -0
  40. package/public/rjbuild/component-doc/core/element/html/FolderSortableTree.yaml +81 -0
  41. package/public/rjbuild/component-doc/core/element/html/FormatNumeral.yaml +58 -0
  42. package/public/rjbuild/component-doc/core/element/html/Html.yaml +67 -0
  43. package/public/rjbuild/component-doc/core/element/html/LabelFromValue.yaml +54 -0
  44. package/public/rjbuild/component-doc/core/element/html/Modal.yaml +93 -0
  45. package/public/rjbuild/component-doc/core/element/html/PreformattedMarkup.yaml +37 -0
  46. package/public/rjbuild/component-doc/core/element/html/SortableTreeItemCollapseButton.yaml +92 -0
  47. package/public/rjbuild/component-doc/core/element/html/Tabs.yaml +57 -0
  48. package/public/rjbuild/component-doc/core/element/special/BootstrapElement.md +17 -0
  49. package/public/rjbuild/component-doc/core/element/special/BootstrapElement.yaml +18 -0
  50. package/public/rjbuild/component-doc/core/element/special/Count.md +37 -0
  51. package/public/rjbuild/component-doc/core/element/special/Count.yaml +325 -0
  52. package/public/rjbuild/component-doc/core/element/special/DataFilter.md +149 -0
  53. package/public/rjbuild/component-doc/core/element/special/DataFilter.yaml +315 -0
  54. package/public/rjbuild/component-doc/core/element/special/DelayedActions.md +51 -0
  55. package/public/rjbuild/component-doc/core/element/special/DelayedActions.yaml +55 -0
  56. package/public/rjbuild/component-doc/core/element/special/PageControls.md +126 -0
  57. package/public/rjbuild/component-doc/core/element/special/PageControls.yaml +133 -0
  58. package/public/rjbuild/component-doc/core/element/special/Phantom.md +31 -0
  59. package/public/rjbuild/component-doc/core/element/special/Phantom.yaml +34 -0
  60. package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.md +27 -0
  61. package/public/rjbuild/component-doc/core/element/special/ReactiveJsonSubroot.yaml +51 -0
  62. package/public/rjbuild/component-doc/core/element/special/Switch.md +262 -0
  63. package/public/rjbuild/component-doc/core/element/special/Switch.yaml +348 -0
  64. package/public/rjbuild/component-doc/core/example/accordion.md +96 -0
  65. package/public/rjbuild/component-doc/core/example/accordion.yaml +64 -0
  66. package/public/rjbuild/component-doc/core/example/dynamic-content.md +197 -0
  67. package/public/rjbuild/component-doc/core/example/dynamic-content.yaml +237 -0
  68. package/public/rjbuild/component-doc/core/example/html.md +66 -0
  69. package/public/rjbuild/component-doc/core/example/html.yaml +83 -0
  70. package/public/rjbuild/component-doc/core/example/website.yaml +1663 -0
  71. package/public/rjbuild/component-doc/core/reaction/addData.md +96 -0
  72. package/public/rjbuild/component-doc/core/reaction/addData.yaml +133 -0
  73. package/public/rjbuild/component-doc/core/reaction/fetchData.md +60 -0
  74. package/public/rjbuild/component-doc/core/reaction/fetchData.yaml +156 -0
  75. package/public/rjbuild/component-doc/core/reaction/index.md +236 -0
  76. package/public/rjbuild/component-doc/core/reaction/index.yaml +254 -0
  77. package/public/rjbuild/component-doc/core/reaction/moveData.md +68 -0
  78. package/public/rjbuild/component-doc/core/reaction/moveData.yaml +71 -0
  79. package/public/rjbuild/component-doc/core/reaction/postMessage.md +63 -0
  80. package/public/rjbuild/component-doc/core/reaction/postMessage.yaml +68 -0
  81. package/public/rjbuild/component-doc/core/reaction/redirectNow.md +37 -0
  82. package/public/rjbuild/component-doc/core/reaction/redirectNow.yaml +37 -0
  83. package/public/rjbuild/component-doc/core/reaction/removeData.md +78 -0
  84. package/public/rjbuild/component-doc/core/reaction/removeData.yaml +56 -0
  85. package/public/rjbuild/component-doc/core/reaction/setClipboardData.md +44 -0
  86. package/public/rjbuild/component-doc/core/reaction/setClipboardData.yaml +41 -0
  87. package/public/rjbuild/component-doc/core/reaction/setData.md +93 -0
  88. package/public/rjbuild/component-doc/core/reaction/setData.yaml +85 -0
  89. package/public/rjbuild/component-doc/core/reaction/submitData.md +138 -0
  90. package/public/rjbuild/component-doc/core/reaction/submitData.yaml +141 -0
  91. package/public/rjbuild/component-doc/core/reaction/triggerEvent.md +59 -0
  92. package/public/rjbuild/component-doc/core/reaction/triggerEvent.yaml +59 -0
  93. package/public/rjbuild/component-doc/index.yaml +13 -0
@@ -0,0 +1,124 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # HashChangeListener
5
+
6
+ **Description**: Listens to hash changes (URL fragment) in the window and executes a reaction function in response. This is an internal action component that is automatically used when you specify `on: "hashchange"` in your actions.
7
+
8
+ ## Usage
9
+
10
+ HashChangeListener is **not** used directly as an element type. Instead, it is automatically triggered when you use `on: "hashchange"` in any action. The system automatically adds this component to listen for hash changes globally.
11
+
12
+ ## Properties
13
+
14
+ When using `on: "hashchange"` in actions, you can specify:
15
+
16
+ - `what` (required): name of the reaction function to execute (e.g., `setData`, `fetchData`, `submitData`, etc.)
17
+ - `whenHashIs` (optional): hash value that should trigger the reaction (includes the '#' character)
18
+ - `whenHashWas` (optional): previous hash value that should trigger the reaction (includes the '#' character)
19
+ - All other properties are passed as arguments to the reaction function
20
+
21
+ - type: RjBuildDescriber
22
+ title: "HashChangeListener Example"
23
+ description:
24
+ - type: Markdown
25
+ content: |
26
+ This example demonstrates hash change listening. Try changing the URL hash manually or use the buttons below.
27
+
28
+ **Note**: Hash changes are detected automatically when you use `on: "hashchange"` in actions.
29
+
30
+ toDescribe:
31
+ renderView:
32
+ - type: div
33
+ content:
34
+ - type: div
35
+ content: "Hash change detector is active. Try:"
36
+
37
+ - type: button
38
+ content: "Set hash to #section1"
39
+ actions:
40
+ - what: redirectNow
41
+ on: click
42
+ to: "#section1"
43
+
44
+ - " "
45
+
46
+ - type: button
47
+ content: "Set hash to #section2"
48
+ actions:
49
+ - what: redirectNow
50
+ on: click
51
+ to: "#section2"
52
+
53
+ - " "
54
+
55
+ - type: button
56
+ content: "Clear hash"
57
+ actions:
58
+ - what: redirectNow
59
+ on: click
60
+ to: "#"
61
+
62
+ - type: div
63
+ content: "Current section from hash:"
64
+ actions:
65
+ - what: setData
66
+ on: hashchange
67
+ whenHashIs: "#section1"
68
+ path: "currentSection"
69
+ value: "Section 1"
70
+ - what: setData
71
+ on: hashchange
72
+ whenHashIs: "#section2"
73
+ path: "currentSection"
74
+ value: "Section 2"
75
+ - what: setData
76
+ on: hashchange
77
+ whenHashIs: "#"
78
+ path: "currentSection"
79
+ value: "Home"
80
+
81
+ - type: div
82
+ content: ["→ ", ~.currentSection]
83
+
84
+ - type: div
85
+ content: "Hash change history:"
86
+ actions:
87
+ - what: setData
88
+ on: hashchange
89
+ path: "hashChangeCount"
90
+ value: 1
91
+ when: ~.hashChangeCount
92
+ isEmpty: true
93
+
94
+ - type: div
95
+ content: ["Changes detected: ", ~.hashChangeCount]
96
+
97
+ data:
98
+ currentSection: "Home"
99
+ hashChangeCount: 0
100
+
101
+ - type: Markdown
102
+ content: |
103
+ ## System Integration
104
+
105
+ - **EventDispatcherContext**: Uses the global event system to optimize performance
106
+ - **TemplateSystem**: The `whenHashIs` and `whenHashWas` values are evaluated through the template system
107
+ - **GlobalDataContext**: Provides context for reaction execution
108
+ - **Actions.jsx**: Automatically instantiated when `on: "hashchange"` is detected
109
+
110
+ ## Limitations
111
+
112
+ - Only works with `on: "hashchange"` in actions (not as a standalone element)
113
+ - Only works on hash changes (URL fragment)
114
+ - Depends on ReactiveJSON's global event system
115
+ - Hashes must include the '#' character (e.g., "#section1", not "section1")
116
+ - One reaction per action definition (use multiple actions for multiple reactions)
117
+
118
+ ## Technical Details
119
+
120
+ - Automatically instantiated by the Actions system when `on: "hashchange"` is used
121
+ - Uses `useEffect` to subscribe/unsubscribe to events
122
+ - Reaction functions are imported from `ReactOnEvent.jsx`
123
+ - Optimized to avoid too many real DOM listeners through the context system
124
+ - Automatically cleans up listeners when component unmounts
@@ -0,0 +1,22 @@
1
+ # Hide
2
+
3
+ **Description**: Completely hides the element and cancels any subsequent actions.
4
+
5
+ ## Properties
6
+ - None
7
+
8
+ ## Behavior
9
+ - The element and its children are not rendered in the DOM.
10
+ - Subsequent actions are not executed.
11
+
12
+ ## Example
13
+ ```yaml
14
+ renderView:
15
+ - type: div
16
+ content: "This text will be hidden."
17
+ actions:
18
+ - what: hide
19
+ ```
20
+
21
+ ## Limitation
22
+ - The element no longer exists in the DOM, so no events can be attached to it.
@@ -0,0 +1,60 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Hide
5
+
6
+ **Description**: Completely hides the element and cancels any subsequent actions.
7
+
8
+ ## Properties
9
+ - None
10
+
11
+ ## Behavior
12
+ - The element and its children are not rendered in the DOM.
13
+ - Subsequent actions are not executed.
14
+
15
+ - type: RjBuildDescriber
16
+ title: "Hide Action Example"
17
+ description:
18
+ - type: Markdown
19
+ content: |
20
+ This example shows how the `hide` action completely removes an element from the DOM based on a condition.
21
+
22
+ Try toggling the visibility to see how the `hide` action works differently from just making something invisible.
23
+
24
+ toDescribe:
25
+ renderView:
26
+ - type: div
27
+ content:
28
+ - type: button
29
+ content: "Toggle visibility"
30
+ actions:
31
+ - what: setData
32
+ on: click
33
+ path: "shouldHide"
34
+ value: ~.shouldHide
35
+ is: false
36
+ - what: setData
37
+ on: click
38
+ path: "shouldHide"
39
+ value: ~.shouldHide
40
+ is: true
41
+ when: ~.shouldHide
42
+ is: false
43
+
44
+ - type: div
45
+ content: "This text will be hidden when shouldHide is true."
46
+ actions:
47
+ - what: hide
48
+ when: ~.shouldHide
49
+ is: true
50
+
51
+ - type: div
52
+ content: ["Current state: shouldHide = ", ~.shouldHide]
53
+
54
+ data:
55
+ shouldHide: false
56
+
57
+ - type: Markdown
58
+ content: |
59
+ ## Limitation
60
+ - The element no longer exists in the DOM, so no events can be attached to it.
@@ -0,0 +1,93 @@
1
+ # MessageListener
2
+
3
+ **Description**: Executes a reaction when receiving a message via `window.postMessage`. This is an internal action component that is automatically used when you specify `on: "message"` in your actions.
4
+
5
+ ## Usage
6
+
7
+ MessageListener is **not** used directly as an element type. Instead, it is automatically triggered when you use `on: "message"` in any action. The system automatically adds this component to listen for messages globally on the window object.
8
+
9
+ ## Properties
10
+
11
+ When using `on: "message"` in actions, you can specify:
12
+
13
+ - `what` (required): name of the reaction function to execute (e.g., `setData`, `fetchData`, `submitData`, etc.)
14
+ - `whenMessageIs` (optional): message value to react to (deep comparison with the received message data)
15
+ - All other properties are passed as arguments to the reaction function
16
+
17
+ ## Behavior
18
+
19
+ When you use `on: "message"` in an action:
20
+
21
+ 1. The system automatically adds a MessageListener component
22
+ 2. It listens to messages via the global event system (`EventDispatcherContext`)
23
+ 3. When a message is received:
24
+ - Checks if the message origin matches the current window's origin (security measure)
25
+ - If `whenMessageIs` is defined, performs a deep comparison with the message data
26
+ - If conditions are met, executes the reaction function specified in `what`
27
+
28
+ ## Examples
29
+
30
+ ### React to specific message
31
+ ```yaml
32
+ renderView:
33
+ - type: button
34
+ content: "Click me"
35
+ actions:
36
+ - what: setData
37
+ on: message
38
+ whenMessageIs:
39
+ type: "userAction"
40
+ action: "update"
41
+ path: "lastMessage"
42
+ value: "Message received"
43
+ ```
44
+
45
+ ### React to any message
46
+ ```yaml
47
+ renderView:
48
+ - type: div
49
+ content: "Waiting for messages..."
50
+ actions:
51
+ - what: setData
52
+ on: message
53
+ path: "messageReceived"
54
+ value: true
55
+ ```
56
+
57
+ ### Store message data
58
+ ```yaml
59
+ renderView:
60
+ - type: div
61
+ content: "Message handler"
62
+ actions:
63
+ - what: setData
64
+ on: message
65
+ whenMessageIs:
66
+ actor: "parent"
67
+ path: "parentMessage"
68
+ value: ~.message
69
+ ```
70
+
71
+ ## System Integration
72
+
73
+ - **EventDispatcherContext**: Uses the global event system to optimize performance
74
+ - **TemplateSystem**: The `whenMessageIs` value is evaluated through the template system
75
+ - **GlobalDataContext**: Provides context for reaction execution
76
+ - **Actions.jsx**: Automatically instantiated when `on: "message"` is detected
77
+
78
+ ## Limitations
79
+
80
+ - Only works with `on: "message"` in actions (not as a standalone element)
81
+ - Only messages from the same `origin` are accepted (security measure)
82
+ - Depends on ReactiveJSON's global event system
83
+ - Uses deep comparison with lodash's `isEqual` for message matching
84
+ - One reaction per action definition (use multiple actions for multiple reactions)
85
+
86
+ ## Technical Details
87
+
88
+ - Automatically instantiated by the Actions system when `on: "message"` is used
89
+ - Uses `useEffect` to subscribe/unsubscribe to events
90
+ - Reaction functions are imported from `ReactOnEvent.jsx`
91
+ - Optimized to avoid too many real DOM listeners through the context system
92
+ - Automatically cleans up listeners when component unmounts
93
+ - Security: Only accepts messages from the same origin as the current window
@@ -0,0 +1,153 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # MessageListener
5
+
6
+ **Description**: Executes a reaction when receiving a message via `window.postMessage`. This is an internal action component that is automatically used when you specify `on: "message"` in your actions.
7
+
8
+ ## Usage
9
+
10
+ MessageListener is **not** used directly as an element type. Instead, it is automatically triggered when you use `on: "message"` in any action. The system automatically adds this component to listen for messages globally on the window object.
11
+
12
+ ## Properties
13
+
14
+ When using `on: "message"` in actions, you can specify:
15
+
16
+ - `what` (required): name of the reaction function to execute (e.g., `setData`, `fetchData`, `submitData`, etc.)
17
+ - `whenMessageIs` (optional): message value to react to (deep comparison with the received message data)
18
+ - All other properties are passed as arguments to the reaction function
19
+
20
+ - type: RjBuildDescriber
21
+ title: "MessageListener Example"
22
+ description:
23
+ - type: Markdown
24
+ content: |
25
+ This example demonstrates message listening. The buttons below will send messages to the same window to demonstrate the functionality.
26
+
27
+ **Note**: In real usage, messages would typically come from parent windows, iframes, or other origins.
28
+
29
+ toDescribe:
30
+ renderView:
31
+ - type: div
32
+ content:
33
+ - type: div
34
+ content: "Message listener is active. Send messages:"
35
+
36
+ - type: button
37
+ content: "Send 'hello' message"
38
+ actions:
39
+ - what: postMessage
40
+ on: click
41
+ message:
42
+ type: "greeting"
43
+ text: "hello"
44
+ messageTarget: self
45
+
46
+ - " "
47
+
48
+ - type: button
49
+ content: "Send 'update' message"
50
+ actions:
51
+ - what: postMessage
52
+ on: click
53
+ message:
54
+ type: "action"
55
+ command: "update"
56
+ messageTarget: self
57
+
58
+ - " "
59
+
60
+ - type: button
61
+ content: "Send custom message"
62
+ actions:
63
+ - what: postMessage
64
+ on: click
65
+ message:
66
+ type: "custom"
67
+ data: ~.customData
68
+ messageTarget: self
69
+
70
+ - type: div
71
+ content: "Message receiver:"
72
+ actions:
73
+ - what: setData
74
+ on: message
75
+ whenMessageIs:
76
+ type: "greeting"
77
+ text: "hello"
78
+ path: "receivedMessage"
79
+ value: "Received hello greeting!"
80
+ - what: setData
81
+ on: message
82
+ whenMessageIs:
83
+ type: "action"
84
+ command: "update"
85
+ path: "receivedMessage"
86
+ value: "Received update command!"
87
+ - what: setData
88
+ on: message
89
+ path: "lastMessage"
90
+ value: "Any message received"
91
+
92
+ - type: div
93
+ content: ["Last received: ", ~.receivedMessage]
94
+
95
+ - type: div
96
+ content: ["Message indicator: ", ~.lastMessage]
97
+
98
+ - type: div
99
+ content: "Custom data for next message:"
100
+
101
+ - type: input
102
+ attributes:
103
+ type: text
104
+ value: ~.customData
105
+ placeholder: "Enter custom data"
106
+ actions:
107
+ - what: setData
108
+ on: change
109
+ path: "customData"
110
+ value: ~.event.target.value
111
+
112
+ - type: button
113
+ content: "Clear messages"
114
+ actions:
115
+ - what: setData
116
+ on: click
117
+ path: "receivedMessage"
118
+ value: ""
119
+ - what: setData
120
+ on: click
121
+ path: "lastMessage"
122
+ value: ""
123
+
124
+ data:
125
+ receivedMessage: ""
126
+ lastMessage: ""
127
+ customData: "test data"
128
+
129
+ - type: Markdown
130
+ content: |
131
+ ## System Integration
132
+
133
+ - **EventDispatcherContext**: Uses the global event system to optimize performance
134
+ - **TemplateSystem**: The `whenMessageIs` value is evaluated through the template system
135
+ - **GlobalDataContext**: Provides context for reaction execution
136
+ - **Actions.jsx**: Automatically instantiated when `on: "message"` is detected
137
+
138
+ ## Limitations
139
+
140
+ - Only works with `on: "message"` in actions (not as a standalone element)
141
+ - Only messages from the same `origin` are accepted (security measure)
142
+ - Depends on ReactiveJSON's global event system
143
+ - Uses deep comparison with lodash's `isEqual` for message matching
144
+ - One reaction per action definition (use multiple actions for multiple reactions)
145
+
146
+ ## Technical Details
147
+
148
+ - Automatically instantiated by the Actions system when `on: "message"` is used
149
+ - Uses `useEffect` to subscribe/unsubscribe to events
150
+ - Reaction functions are imported from `ReactOnEvent.jsx`
151
+ - Optimized to avoid too many real DOM listeners through the context system
152
+ - Automatically cleans up listeners when component unmounts
153
+ - Security: Only accepts messages from the same origin as the current window
@@ -0,0 +1,26 @@
1
+ # Popover
2
+
3
+ **Description**: Displays a Bootstrap popover on click or hover of the element.
4
+
5
+ ## Properties
6
+ - `header` (optional): content of the popover header
7
+ - `body`: content of the popover body
8
+ - `placement` (optional): position (`top`, `bottom`, `left`, `right`)
9
+ - `trigger` (optional): trigger event (`click`, `hover`, etc.)
10
+
11
+ ## Example
12
+ ```yaml
13
+ renderView:
14
+ - type: button
15
+ content: "Click me"
16
+ actions:
17
+ - what: popover
18
+ header: "Popover Title"
19
+ body: "This is the popover content."
20
+ placement: right
21
+ trigger: click
22
+ ```
23
+
24
+ ## Limitation
25
+ - Requires Bootstrap CSS.
26
+ - The child component must be able to accept a React reference.
@@ -0,0 +1,100 @@
1
+ renderView:
2
+ - type: Markdown
3
+ content: |
4
+ # Popover
5
+
6
+ **Description**: Displays a Bootstrap popover on click or hover of the element.
7
+
8
+ ## Properties
9
+ - `header` (optional): content of the popover header
10
+ - `body`: content of the popover body
11
+ - `placement` (optional): position (`top`, `bottom`, `left`, `right`)
12
+ - `trigger` (optional): trigger event (`click`, `hover`, etc.)
13
+
14
+ - type: RjBuildDescriber
15
+ title: "Popover Action Example"
16
+ description:
17
+ - type: Markdown
18
+ content: |
19
+ This example shows different popover configurations with various triggers and placements.
20
+
21
+ **Note**: Popovers require Bootstrap CSS to display properly.
22
+
23
+ toDescribe:
24
+ renderView:
25
+ - type: div
26
+ content:
27
+ - type: button
28
+ content: "Click me (popover right)"
29
+ actions:
30
+ - what: popover
31
+ header: "Popover Title"
32
+ body: "This is the popover content on the right."
33
+ placement: right
34
+ trigger: click
35
+
36
+ - " "
37
+
38
+ - type: button
39
+ content: "Hover me (popover top)"
40
+ actions:
41
+ - what: popover
42
+ header: "Hover Popover"
43
+ body: "This popover appears on hover."
44
+ placement: top
45
+ trigger: hover
46
+
47
+ - type: br
48
+
49
+ - type: br
50
+
51
+ - type: button
52
+ content: "Click me (popover bottom)"
53
+ actions:
54
+ - what: popover
55
+ body: "This popover has no header and appears at the bottom."
56
+ placement: bottom
57
+ trigger: click
58
+
59
+ - " "
60
+
61
+ - type: button
62
+ content: "Dynamic popover content"
63
+ actions:
64
+ - what: popover
65
+ header: "Dynamic Content"
66
+ body: ["Counter value: ", ~.counter]
67
+ placement: left
68
+ trigger: click
69
+
70
+ - type: br
71
+
72
+ - type: br
73
+
74
+ - type: button
75
+ content: "Increment counter"
76
+ actions:
77
+ - what: setData
78
+ on: click
79
+ path: "counter"
80
+ value: 1
81
+ when: ~.counter
82
+ isEmpty: true
83
+ - what: setData
84
+ on: click
85
+ path: "counter"
86
+ value: ~.counter
87
+ isNot: ""
88
+ # Note: This would need arithmetic operation, simplified for demo
89
+
90
+ - type: div
91
+ content: ["Current counter: ", ~.counter]
92
+
93
+ data:
94
+ counter: 0
95
+
96
+ - type: Markdown
97
+ content: |
98
+ ## Limitation
99
+ - Requires Bootstrap CSS.
100
+ - The child component must be able to accept a React reference.
@@ -0,0 +1,81 @@
1
+ # ReactOnEvent
2
+
3
+ **Type**: Internal Action Component
4
+
5
+ **Description**: ReactOnEvent is an internal action component that is automatically instantiated by the Actions system when reactions with event handlers (`on: "eventName"`) are detected. It should **not** be used directly as an element type.
6
+
7
+ ## How it Works
8
+
9
+ When you define actions with event handlers (like `on: "click"`), the Actions system automatically:
10
+
11
+ 1. Collects all reactions with event handlers for the element
12
+ 2. Groups them by event type (click, change, mouseover, etc.)
13
+ 3. Creates a ReactOnEvent component that attaches the appropriate event listeners
14
+ 4. Wraps the target element with these event handlers
15
+
16
+ ## Usage Pattern
17
+
18
+ Instead of using ReactOnEvent directly, you define reactions in the `actions` array of any element:
19
+
20
+ ```yaml
21
+ renderView:
22
+ - type: button
23
+ content: "Click me"
24
+ actions:
25
+ - what: setData
26
+ on: click # This triggers ReactOnEvent internally
27
+ path: "buttonClicked"
28
+ value: true
29
+ ```
30
+
31
+ ## Supported Event Types
32
+
33
+ ReactOnEvent supports any DOM event by prefixing with `on` and capitalizing the first letter:
34
+
35
+ - `on: click` → `onClick`
36
+ - `on: change` → `onChange`
37
+ - `on: mouseover` → `onMouseOver`
38
+ - `on: keydown` → `onKeyDown`
39
+ - `on: submit` → `onSubmit`
40
+ - etc.
41
+
42
+ ## Special Event Handling
43
+
44
+ Some events have special handling and **do not** use ReactOnEvent:
45
+
46
+ - `on: "message"` → Uses MessageListener component (listens on window)
47
+ - `on: "hashchange"` → Uses HashChangeListener component (listens on window)
48
+
49
+ ## Event Propagation Control
50
+
51
+ By default, ReactOnEvent stops event propagation. You can control this behavior:
52
+
53
+ ```yaml
54
+ actions:
55
+ - what: setData
56
+ on: click
57
+ path: "clicked"
58
+ value: true
59
+ stopPropagation: false # Allow event to continue propagating
60
+ ```
61
+
62
+ ## Technical Implementation
63
+
64
+ - **Event attachment**: Uses React's event system via `cloneElement`
65
+ - **Multiple events**: Can handle multiple event types on the same element
66
+ - **Reaction execution**: Executes reactions in the order they appear
67
+ - **Context preservation**: Maintains access to global and template data contexts
68
+ - **Early termination**: Supports `stopPropagation: true` to halt reaction chain execution
69
+
70
+ ## Related Components
71
+
72
+ - **[MessageListener](MessageListener.md)**: Handles `on: "message"` events
73
+ - **[HashChangeListener](HashChangeListener.md)**: Handles `on: "hashchange"` events
74
+ - **[Reactions System](../reaction/index.md)**: The actual reaction functions that ReactOnEvent executes
75
+
76
+ ## Important Notes
77
+
78
+ - **Not for direct use**: Never use `type: ReactOnEvent` in your renderView
79
+ - **Automatic instantiation**: The Actions system creates this component automatically
80
+ - **Internal implementation**: This is part of the framework's internal architecture
81
+ - **Event binding**: Events are bound to the actual DOM elements, not wrapper components