@ossy/connected-components 0.9.0 → 0.10.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.
- package/build/index.js +29 -12
- package/package.json +4 -6
package/build/index.js
CHANGED
|
@@ -3,7 +3,17 @@ import { SDK } from '@ossy/sdk';
|
|
|
3
3
|
import { useResource, WorkspaceProvider, AsyncStatus, useQuery, useResources } from '@ossy/sdk-react';
|
|
4
4
|
import { Overlay, View, Button, Text, useTheme, Theme, useDocumentTitle, Switch } from '@ossy/design-system';
|
|
5
5
|
import { Router } from '@ossy/router-react';
|
|
6
|
-
import { Resume as Resume$1 } from '@ossy/
|
|
6
|
+
import { Resume as Resume$1 } from '@ossy/pages';
|
|
7
|
+
|
|
8
|
+
function _extends() {
|
|
9
|
+
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
10
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
11
|
+
var t = arguments[e];
|
|
12
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
13
|
+
}
|
|
14
|
+
return n;
|
|
15
|
+
}, _extends.apply(null, arguments);
|
|
16
|
+
}
|
|
7
17
|
|
|
8
18
|
function defaultAppSettings() {
|
|
9
19
|
return {
|
|
@@ -13,6 +23,7 @@ function defaultAppSettings() {
|
|
|
13
23
|
theme: undefined,
|
|
14
24
|
themes: undefined,
|
|
15
25
|
routes: [],
|
|
26
|
+
pages: [],
|
|
16
27
|
initialEntries: [],
|
|
17
28
|
initialIndex: 0,
|
|
18
29
|
router: 'browser',
|
|
@@ -154,11 +165,25 @@ const ThemeEditor = () => {
|
|
|
154
165
|
}));
|
|
155
166
|
};
|
|
156
167
|
|
|
168
|
+
function routesToPages(routes) {
|
|
169
|
+
if (!routes?.length) return [];
|
|
170
|
+
return routes.map((route, i) => {
|
|
171
|
+
const path = typeof route.path === 'string' ? route.path : route.path?.en ?? '/';
|
|
172
|
+
const id = route.id ?? (path === '/' ? 'home' : path.replace(/^\//, '').replace(/\/$/, '').replace(/\//g, '-') || `page-${i}`);
|
|
173
|
+
return {
|
|
174
|
+
id,
|
|
175
|
+
path: route.path,
|
|
176
|
+
element: route.element,
|
|
177
|
+
render: route.render ?? (() => route.element)
|
|
178
|
+
};
|
|
179
|
+
});
|
|
180
|
+
}
|
|
157
181
|
const App = _appSettings => {
|
|
158
182
|
const appSettings = {
|
|
159
183
|
...defaultAppSettings(),
|
|
160
184
|
..._appSettings
|
|
161
185
|
};
|
|
186
|
+
const pages = appSettings.pages?.length ? appSettings.pages : routesToPages(appSettings.routes);
|
|
162
187
|
const sdk = SDK.of({
|
|
163
188
|
apiUrl: appSettings.apiUrl,
|
|
164
189
|
workspaceId: appSettings.workspaceId
|
|
@@ -170,19 +195,11 @@ const App = _appSettings => {
|
|
|
170
195
|
themes: appSettings.themes
|
|
171
196
|
}, /*#__PURE__*/React$1.createElement(WorkspaceProvider, {
|
|
172
197
|
sdk: sdk
|
|
173
|
-
}, /*#__PURE__*/React$1.createElement(Router,
|
|
198
|
+
}, /*#__PURE__*/React$1.createElement(Router, _extends({}, appSettings, {
|
|
199
|
+
pages: pages
|
|
200
|
+
})), appSettings.devMode && /*#__PURE__*/React$1.createElement(ThemeEditor, null))));
|
|
174
201
|
};
|
|
175
202
|
|
|
176
|
-
function _extends() {
|
|
177
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
178
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
179
|
-
var t = arguments[e];
|
|
180
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
181
|
-
}
|
|
182
|
-
return n;
|
|
183
|
-
}, _extends.apply(null, arguments);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
203
|
const Layout = ({
|
|
187
204
|
layoutId,
|
|
188
205
|
...props
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/connected-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/ossy-se/packages.git"
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
"author": "Ossy <yourfriends@ossy.se> (https://ossy.se)",
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "rollup -c rollup.config.js",
|
|
15
|
-
"test": ""
|
|
16
|
-
"storybook": "storybook dev -p 6006",
|
|
17
|
-
"build-storybook": "storybook build"
|
|
15
|
+
"test": ""
|
|
18
16
|
},
|
|
19
17
|
"browserslist": {
|
|
20
18
|
"production": [
|
|
@@ -42,7 +40,7 @@
|
|
|
42
40
|
},
|
|
43
41
|
"peerDependencies": {
|
|
44
42
|
"@ossy/design-system": ">=0.5.0 <1.0.0",
|
|
45
|
-
"@ossy/
|
|
43
|
+
"@ossy/pages": ">=0.5.0 <1.0.0",
|
|
46
44
|
"@ossy/router": ">=0.5.0 <1.0.0",
|
|
47
45
|
"@ossy/router-react": ">=0.5.0 <1.0.0",
|
|
48
46
|
"@ossy/sdk": ">=0.5.0 <1.0.0",
|
|
@@ -58,5 +56,5 @@
|
|
|
58
56
|
"/build",
|
|
59
57
|
"README.md"
|
|
60
58
|
],
|
|
61
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "3019a8da590435ba6f10d7d861addeba011baf5d"
|
|
62
60
|
}
|