rotor-framework 0.3.2 → 0.3.3
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/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Rotor Framework
|
|
2
|
-
|
|
3
|
-
[](https://github.com/mobalazs/rotor-framework/actions/workflows/publish.yml)[](https://coveralls.io/github/mobalazs/rotor-framework?branch=main)
|
|
4
|
+
[](https://www.npmjs.com/package/rotor-framework)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
6
|
[](https://rokudevelopers.slack.com)
|
|
6
7
|
|
|
7
8
|
**Rotor** is a modular, ViewModel-first UI framework for Roku applications built with BrighterScript and SceneGraph. It is lightweight and designed to intuitively speed up development time while simplifying both the implementation and long-term maintenance process. It features a rich ViewBuilder system and a Roku-friendly implementation of the MVI (Model-View-Intent) design pattern. It helps developers structure large-scale apps with reusable components, state-driven logic, and optimized rendering.
|
|
@@ -16,8 +17,7 @@
|
|
|
16
17
|
- **Roku-friendly MVI design pattern**: Predictable state, clear separation of concerns, and cross-thread compatibility.
|
|
17
18
|
- **Component-based UI**: Isolated, reusable UI widgets and view models.
|
|
18
19
|
- **i18n support**: Locale-aware interface with flexible language resource injection.
|
|
19
|
-
- **Integrated** [Animate](https://github.com/haystacknews/animate) Library
|
|
20
|
-
|
|
20
|
+
- **Integrated** [Animate](https://github.com/haystacknews/animate) Library
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -33,19 +33,33 @@ npm install --save-dev brighterscript@next @rokucommunity/bslint@next
|
|
|
33
33
|
|
|
34
34
|
### Install Rotor Framework
|
|
35
35
|
|
|
36
|
+
**Manual installation:**
|
|
37
|
+
|
|
36
38
|
1. Download the latest `rotor-framework.zip` from [GitHub Releases](https://github.com/mobalazs/rotor-framework/releases)
|
|
37
39
|
2. Extract the ZIP into your project's `source/` directory (this will create a `rotor-framework/` folder)
|
|
38
40
|
3. Import Rotor in your main file:
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
**ROPM install:**
|
|
43
|
+
|
|
44
|
+
- **Note:** You must install without prefix by adding this to `package.json`
|
|
45
|
+
- Don't worry everything is in the `Rotor` namespace by default, so this is the only name reserved by the framework.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ropm install rotor-framework
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
"ropm": {
|
|
53
|
+
"noprefix": ["rotor-framework"]
|
|
54
|
+
}
|
|
42
55
|
```
|
|
43
56
|
|
|
44
57
|
---
|
|
45
58
|
|
|
46
|
-
## ⚡ Quick
|
|
59
|
+
## ⚡ Quick usage
|
|
47
60
|
|
|
48
61
|
```vb
|
|
62
|
+
import "pkg:/source/RotorFramework.bs"
|
|
49
63
|
|
|
50
64
|
frameworkInstance = new Rotor.Framework()
|
|
51
65
|
|
|
@@ -59,23 +73,23 @@ frameworkInstance.render([
|
|
|
59
73
|
}
|
|
60
74
|
}
|
|
61
75
|
])
|
|
62
|
-
|
|
63
76
|
```
|
|
64
77
|
|
|
65
78
|
---
|
|
66
79
|
|
|
67
80
|
<a id="token-efficient-documentation"></a>
|
|
81
|
+
|
|
68
82
|
## Token-efficient documentation for AI
|
|
69
83
|
|
|
70
84
|
You can find [🌱](./docs/ai/readme.opt.yaml) symbols in all documentation pages. These symbols link to AI-optimized summaries of the respective documentation.
|
|
71
85
|
|
|
72
86
|
**📖 [Read more about token savings](./docs/token-efficient-docs.md)**
|
|
73
87
|
|
|
74
|
-
|
|
75
88
|
---
|
|
76
89
|
|
|
77
90
|
## 📚 Learn More
|
|
78
|
-
|
|
91
|
+
|
|
92
|
+

|
|
79
93
|
|
|
80
94
|
### Framework Core
|
|
81
95
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rotor-framework",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "A Roku toolkit library providing a ViewBuilder, full UI lifecycle with focus handling and many core features, plus MVI-based state management.",
|
|
5
5
|
"author": "Balázs Molnár",
|
|
6
6
|
"license": "MIT",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
' ▐▛▀▚▖▐▌ ▐▌ █ ▐▌ ▐▌▐▛▀▚▖ ▐▛▀▀▘▐▛▀▚▖▐▛▀▜▌▐▌ ▐▌▐▛▀▀▘▐▌ ▐▌▐▌ ▐▌▐▛▀▚▖▐▛▚▖
|
|
5
5
|
' ▐▌ ▐▌▝▚▄▞▘ █ ▝▚▄▞▘▐▌ ▐▌ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▙▄▄▖▐▙█▟▌▝▚▄▞▘▐▌ ▐▌▐▌ ▐▌
|
|
6
6
|
' Rotor Framework™ © 2025 Balázs Molnár. All rights reserved.
|
|
7
|
-
' Version 0.3.
|
|
7
|
+
' Version 0.3.3
|
|
8
8
|
'''''''''
|
|
9
9
|
|
|
10
10
|
' constants
|
|
@@ -37,7 +37,6 @@ import "plugins/FieldsPlugin.bs"
|
|
|
37
37
|
import "plugins/FontStylePlugin.bs"
|
|
38
38
|
import "plugins/ObserverPlugin.bs"
|
|
39
39
|
import "plugins/FocusPlugin.bs"
|
|
40
|
-
|
|
41
40
|
namespace Rotor
|
|
42
41
|
|
|
43
42
|
'==========================================================================
|
|
@@ -85,7 +84,7 @@ namespace Rotor
|
|
|
85
84
|
class Framework
|
|
86
85
|
|
|
87
86
|
name = "Rotor Framework"
|
|
88
|
-
version = "0.3.
|
|
87
|
+
version = "0.3.3"
|
|
89
88
|
|
|
90
89
|
config = {
|
|
91
90
|
tasks: invalid, ' @array (optional)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
' ▐▛▀▚▖▐▌ ▐▌ █ ▐▌ ▐▌▐▛▀▚▖ ▐▛▀▀▘▐▛▀▚▖▐▛▀▜▌▐▌ ▐▌▐▛▀▀▘▐▌ ▐▌▐▌ ▐▌▐▛▀▚▖▐▛▚▖
|
|
5
5
|
' ▐▌ ▐▌▝▚▄▞▘ █ ▝▚▄▞▘▐▌ ▐▌ ▐▌ ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▙▄▄▖▐▙█▟▌▝▚▄▞▘▐▌ ▐▌▐▌ ▐▌
|
|
6
6
|
' Rotor Framework™ © 2025 Balázs Molnár. All rights reserved.
|
|
7
|
-
' Version 0.3.
|
|
7
|
+
' Version 0.3.3
|
|
8
8
|
'''''''''
|
|
9
9
|
|
|
10
10
|
' constants
|
|
@@ -69,7 +69,7 @@ namespace Rotor
|
|
|
69
69
|
class FrameworkTask
|
|
70
70
|
|
|
71
71
|
name = "Rotor Framework"
|
|
72
|
-
version = "0.3.
|
|
72
|
+
version = "0.3.3"
|
|
73
73
|
|
|
74
74
|
config = {
|
|
75
75
|
tasks: invalid, ' optional
|
|
@@ -134,33 +134,30 @@ namespace Rotor.ViewBuilder
|
|
|
134
134
|
public function getL10n(keyPath) as object
|
|
135
135
|
' Best for regular use cases
|
|
136
136
|
if keyPath = invalid then return m.l10n ' Return just reference to l10n
|
|
137
|
-
|
|
138
|
-
' Best for unit tests or story books or special use cases
|
|
139
|
-
firstKey = keyPath.Split(".")[0]
|
|
140
|
-
return m.getAssetByKeyPath(keyPath)[firstKey] ' Return cloned and merged sliced data from l10n
|
|
141
|
-
|
|
137
|
+
return m.getMultipleAssets(keyPath)
|
|
142
138
|
end function
|
|
143
139
|
|
|
144
140
|
' ---------------------------------------------------------------------
|
|
145
|
-
'
|
|
141
|
+
' getMultipleAsset - Gets and caches localization data by one or more key paths
|
|
146
142
|
'
|
|
147
143
|
' @param {dynamic} keyPath - Single key path string or array of key paths
|
|
148
144
|
' @returns {object} Merged localization data from all key paths
|
|
149
145
|
' @private
|
|
150
146
|
'
|
|
151
|
-
function
|
|
147
|
+
function getMultipleAssets(keyPath as dynamic) as object
|
|
152
148
|
keysPaths = Rotor.Utils.ensureArray(keyPath)
|
|
153
|
-
|
|
149
|
+
assets = {}
|
|
154
150
|
for each keyPath in keysPaths
|
|
155
151
|
if m.cache.DoesExist(keyPath)
|
|
156
|
-
|
|
152
|
+
newAsset = m.cache[keyPath]
|
|
157
153
|
else
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
newAsset = Rotor.Utils.getValueByKeyPath(m.l10n, keyPath, true)
|
|
155
|
+
newAssetCloned = Rotor.Utils.deepCopy(newAsset)
|
|
156
|
+
m.cache[keyPath] = newAssetCloned
|
|
160
157
|
end if
|
|
161
|
-
|
|
158
|
+
assets.append(newAsset)
|
|
162
159
|
end for
|
|
163
|
-
return
|
|
160
|
+
return assets
|
|
164
161
|
end function
|
|
165
162
|
|
|
166
163
|
end class
|