@bigbinary/neeto-themes-frontend 2.1.1 → 2.1.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 +74 -36
- package/app/javascript/src/translations/en.json +6 -2
- package/dist/NeetoThemesBuilder.js +1899 -0
- package/dist/NeetoThemesBuilder.js.map +1 -0
- package/dist/{index.cjs.js → cjs/NeetoThemesBuilder.js} +412 -507
- package/dist/cjs/NeetoThemesBuilder.js.map +1 -0
- package/dist/cjs/hooks.js +22 -0
- package/dist/cjs/hooks.js.map +1 -0
- package/dist/cjs/index.js +56 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/utils.js +17 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/hooks.js +14 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index-09d44807.js +174 -0
- package/dist/index-09d44807.js.map +1 -0
- package/dist/index-383fae09.js +159 -0
- package/dist/index-383fae09.js.map +1 -0
- package/dist/index.js +45 -1990
- package/dist/index.js.map +1 -1
- package/dist/useThemeUtils-148b9f27.js +111 -0
- package/dist/useThemeUtils-148b9f27.js.map +1 -0
- package/dist/useThemeUtils-3875c1d1.js +102 -0
- package/dist/useThemeUtils-3875c1d1.js.map +1 -0
- package/dist/utils.js +6 -0
- package/dist/utils.js.map +1 -0
- package/package.json +27 -14
- package/dist/index.cjs.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# neeto-themes-nano
|
|
2
2
|
|
|
3
|
-
The `neeto-themes-nano` allows us to build and use themes within neeto
|
|
3
|
+
The `neeto-themes-nano` allows us to build and use themes within neeto
|
|
4
|
+
applications. This nano exports `@bigbinary/neeto-themes-frontend` NPM package
|
|
5
|
+
and `neeto-themes-engine` Rails engine.
|
|
4
6
|
|
|
5
7
|
## Contents
|
|
6
8
|
|
|
@@ -52,25 +54,29 @@ The `neeto-themes-nano` allows us to build and use themes within neeto applicati
|
|
|
52
54
|
|
|
53
55
|
5. Add the following line to `models/organization.rb` file.
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
```ruby
|
|
58
|
+
has_many :themes, class_name: "NeetoThemesEngine::Theme", as: :owner
|
|
59
|
+
```
|
|
60
|
+
|
|
58
61
|
6. Configure model to add below association to attach theme.
|
|
59
62
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
```ruby
|
|
64
|
+
has_one :theme_entity, as: :themeable, class_name: "NeetoThemesEngine::ThemeEntity", dependent: :destroy
|
|
65
|
+
has_one :theme, through: :theme_entity, class_name: "NeetoThemesEngine::Theme"
|
|
66
|
+
```
|
|
64
67
|
|
|
65
68
|
### Usage
|
|
66
69
|
|
|
67
70
|
1. **Create an engine initializer**
|
|
68
71
|
|
|
69
|
-
Create a file named `neeto_themes_engine.rb` in the `config/initializers`
|
|
72
|
+
Create a file named `neeto_themes_engine.rb` in the `config/initializers`
|
|
73
|
+
folder.
|
|
70
74
|
|
|
71
75
|
2. **Customize theme schema**
|
|
72
76
|
|
|
73
|
-
The engine supports customizing theme schemas based on the needs of the host
|
|
77
|
+
The engine supports customizing theme schemas based on the needs of the host
|
|
78
|
+
application. This schema will be used in the frontend to render the theme
|
|
79
|
+
properties. Eg:
|
|
74
80
|
|
|
75
81
|
```ruby
|
|
76
82
|
NeetoThemesEngine.theme_properties_schema = [
|
|
@@ -79,42 +85,54 @@ The `neeto-themes-nano` allows us to build and use themes within neeto applicati
|
|
|
79
85
|
]
|
|
80
86
|
```
|
|
81
87
|
|
|
82
|
-
|
|
83
|
-
- `key`: The unique identifier for the theme property.
|
|
88
|
+
Each object in the array should have the following keys:
|
|
84
89
|
|
|
85
|
-
|
|
90
|
+
- `key`: The unique identifier for the theme property.
|
|
86
91
|
|
|
87
|
-
|
|
92
|
+
- `kind`: The kind of the theme property.
|
|
88
93
|
|
|
89
|
-
|
|
94
|
+
Optional keys that can be included:
|
|
90
95
|
|
|
91
|
-
|
|
96
|
+
- `default_value`: Sets a default value when creating a new theme.
|
|
92
97
|
|
|
93
|
-
|
|
98
|
+
- `hidden`: This boolean prop helps to hide the property from the UI but
|
|
99
|
+
allows to use it as CSS variable.
|
|
100
|
+
|
|
101
|
+
- `depends_on`: Provides a dependency on other properties. If a key is
|
|
102
|
+
provided, it will check for its value and only appear in the UI if the
|
|
103
|
+
dependent property is present.
|
|
104
|
+
|
|
105
|
+
- `parent_class`: This key needs to be added for custom css feature to work
|
|
106
|
+
properly. See more on [custom css](#custom-css) feature.
|
|
94
107
|
|
|
95
108
|
3. **Provide a css variable prefix**
|
|
96
109
|
|
|
97
|
-
|
|
110
|
+
This value will be used to prefix all CSS variables. Eg:
|
|
111
|
+
|
|
112
|
+
```ruby
|
|
113
|
+
NeetoThemesEngine.css_variable_prefix = "neeto-cal"
|
|
114
|
+
```
|
|
98
115
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
variable generated for the theme property `primary_color` will be `--neeto-cal-primary-color`.
|
|
116
|
+
variable generated for the theme property `primary_color` will be
|
|
117
|
+
`--neeto-cal-primary-color`.
|
|
103
118
|
|
|
104
119
|
4. **Provide the entities to which the theme property is attached**
|
|
105
120
|
|
|
106
|
-
|
|
121
|
+
This value will be used to determine the entity to which the theme property
|
|
122
|
+
is attached. We can provide multiple entities. Eg:
|
|
123
|
+
|
|
124
|
+
```ruby
|
|
125
|
+
NeetoThemesEngine.valid_themeable_types = ["Meeting", "Booking"]
|
|
126
|
+
```
|
|
107
127
|
|
|
108
|
-
```ruby
|
|
109
|
-
NeetoThemesEngine.valid_themeable_types = ["Meeting", "Booking"]
|
|
110
|
-
```
|
|
111
128
|
5. **Provide a default theme name** (Optional)
|
|
112
129
|
|
|
113
|
-
|
|
130
|
+
This provided value will be used to identify the default theme. If not
|
|
131
|
+
provided, the default theme will be named "Plain blue".
|
|
114
132
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
133
|
+
```ruby
|
|
134
|
+
NeetoThemesEngine.default_theme_name = "My theme"
|
|
135
|
+
```
|
|
118
136
|
|
|
119
137
|
### Frontend package
|
|
120
138
|
|
|
@@ -127,13 +145,17 @@ The `neeto-themes-nano` allows us to build and use themes within neeto applicati
|
|
|
127
145
|
```
|
|
128
146
|
|
|
129
147
|
### Instructions for development
|
|
130
|
-
|
|
148
|
+
|
|
149
|
+
Check the
|
|
150
|
+
[Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0)
|
|
151
|
+
for step-by-step instructions to develop the frontend package.
|
|
131
152
|
|
|
132
153
|
### Usage
|
|
133
154
|
|
|
134
155
|
#### Components
|
|
135
156
|
|
|
136
|
-
1. Import the `NeetoThemesBuilder` component from
|
|
157
|
+
1. Import the `NeetoThemesBuilder` component from
|
|
158
|
+
`@bigbinary/neeto-themes-frontend`:
|
|
137
159
|
|
|
138
160
|
```javascript
|
|
139
161
|
import React from "react";
|
|
@@ -150,6 +172,7 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
|
|
|
150
172
|
);
|
|
151
173
|
|
|
152
174
|
export default App;
|
|
175
|
+
```
|
|
153
176
|
|
|
154
177
|
#### hooks
|
|
155
178
|
|
|
@@ -158,15 +181,30 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
|
|
|
158
181
|
```javascript
|
|
159
182
|
import { useThemeUtils } from "@bigbinary/neeto-themes-frontend";
|
|
160
183
|
|
|
161
|
-
const { setTheme,previewingTheme, currentTheme } = useThemeUtils();
|
|
184
|
+
const { setTheme, previewingTheme, currentTheme } = useThemeUtils();
|
|
162
185
|
```
|
|
163
186
|
|
|
164
|
-
|
|
187
|
+
- `setTheme`: This method is used to set the theme for the entity.
|
|
188
|
+
|
|
189
|
+
- `previewingTheme`: This object contains the currently previewing theme.
|
|
165
190
|
|
|
166
|
-
|
|
191
|
+
- `currentTheme`: This object contains the current theme which is applied to the
|
|
192
|
+
entity.
|
|
167
193
|
|
|
168
|
-
|
|
194
|
+
### Custom CSS
|
|
169
195
|
|
|
196
|
+
`neeto-themes-nano` will inject custom css into your application as part of a
|
|
197
|
+
theme. It requires the initializer to be set with the additional property
|
|
198
|
+
`{ kind: "custom_css", key: "custom_css", default_value: "", parent_class: "neeto-form-eui" }`.
|
|
199
|
+
The `parent_class` key will be used as a parent to inject styles and for CSS
|
|
200
|
+
nesting. This ensures that styles are not injected on pages where you do not
|
|
201
|
+
want it and also ensures that style rules targeting elements outside this class
|
|
202
|
+
will not be applied. Please ensure that the value provided to `parent_class` is
|
|
203
|
+
present in your application as a wrapper CSS class. For example:
|
|
204
|
+
`neeto-form-eui` in neetoForm is present in all external pages where theme needs
|
|
205
|
+
to be applied. It also provides a code editor with syntax highlighting which
|
|
206
|
+
depends on [Monaco editor](https://github.com/suren-atoyan/monaco-react) as a
|
|
207
|
+
peer dependency. Please install it in the host application for proper working.
|
|
170
208
|
|
|
171
209
|
## Instructions for Publishing
|
|
172
210
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"recording_other": "Recordings"
|
|
12
12
|
},
|
|
13
13
|
"common": {
|
|
14
|
-
"
|
|
14
|
+
"theme": "Theme",
|
|
15
15
|
"preview": "Preview",
|
|
16
16
|
"save": "Save",
|
|
17
17
|
"done": "Done",
|
|
@@ -33,9 +33,12 @@
|
|
|
33
33
|
"saveChanges": "Save changes",
|
|
34
34
|
"addNewTheme": "Add new theme",
|
|
35
35
|
"backToThemes": "Back to themes",
|
|
36
|
+
"backToEdit": "Back to edit",
|
|
36
37
|
"save": "Save",
|
|
37
38
|
"reset": "Reset",
|
|
38
|
-
"applyThisTheme": "Apply this theme"
|
|
39
|
+
"applyThisTheme": "Apply this theme",
|
|
40
|
+
"expandEditor": "Expand editor",
|
|
41
|
+
"minimizeEditor": "Minimize editor"
|
|
39
42
|
},
|
|
40
43
|
"alerts": {
|
|
41
44
|
"title": {
|
|
@@ -72,6 +75,7 @@
|
|
|
72
75
|
"title": "New theme",
|
|
73
76
|
"newThemeName": "My theme"
|
|
74
77
|
},
|
|
78
|
+
"customCSS": "Custom CSS",
|
|
75
79
|
"themeCloned": "Theme has been cloned successfully.",
|
|
76
80
|
"themeCloneFailed": "Failed to clone theme, please try after some time."
|
|
77
81
|
}
|