@lowdefy/server 4.0.0-alpha.1 → 4.0.0-alpha.12

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 (39) hide show
  1. package/.eslintrc.yaml +1 -0
  2. package/README.md +17 -1
  3. package/lib/Page.js +62 -0
  4. package/lowdefy/build.mjs +51 -0
  5. package/lowdefy/createCustomPluginTypesMap.mjs +71 -0
  6. package/next.config.js +36 -0
  7. package/package.json +30 -20
  8. package/{src/utils/request.js → pages/404.js} +19 -17
  9. package/{src/pages → pages}/[pageId].js +10 -5
  10. package/{src/components/Head.js → pages/_app.js} +17 -8
  11. package/pages/_document.js +38 -0
  12. package/{src/pages → pages}/api/auth/[...nextauth].js +8 -11
  13. package/{src/pages → pages}/api/request/[pageId]/[requestId].js +13 -8
  14. package/{src/pages → pages}/index.js +15 -13
  15. package/{src/public → public}/apple-touch-icon.png +0 -0
  16. package/public/favicon.ico +0 -0
  17. package/{src/public → public}/icon-512.png +0 -0
  18. package/{src/public → public}/icon.svg +0 -0
  19. package/{src/public → public}/logo-dark-theme.png +0 -0
  20. package/{src/public → public}/logo-light-theme.png +0 -0
  21. package/{src/public → public}/logo-square-dark-theme.png +0 -0
  22. package/{src/public → public}/logo-square-light-theme.png +0 -0
  23. package/{src/public → public}/manifest.webmanifest +0 -0
  24. package/src/components/Context.js +0 -61
  25. package/src/components/LowdefyContext.js +0 -47
  26. package/src/components/Page.js +0 -60
  27. package/src/components/block/Block.js +0 -57
  28. package/src/components/block/CategorySwitch.js +0 -120
  29. package/src/components/block/Container.js +0 -87
  30. package/src/components/block/List.js +0 -94
  31. package/src/components/block/LoadingBlock.js +0 -22
  32. package/src/components/block/MountEvents.js +0 -46
  33. package/src/components/components.js +0 -25
  34. package/src/pages/_app.js +0 -37
  35. package/src/plugins/icons.js +0 -35
  36. package/src/plugins/style.less +0 -3
  37. package/src/public/icon-32.png +0 -0
  38. package/src/utils/callRequest.js +0 -27
  39. package/src/utils/setupLink.js +0 -44
@@ -1,61 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React, { useEffect, useState } from 'react';
18
- import getContext from '@lowdefy/engine';
19
-
20
- import MountEvents from './block/MountEvents.js';
21
-
22
- const Context = ({ children, lowdefy, config }) => {
23
- const [context, setContext] = useState({});
24
-
25
- useEffect(() => {
26
- let mounted = true;
27
- const mount = async () => {
28
- const ctx = await getContext({
29
- config,
30
- lowdefy,
31
- });
32
- if (mounted) {
33
- setContext(ctx);
34
- }
35
- };
36
- mount();
37
- return () => {
38
- mounted = false;
39
- };
40
- }, [config, lowdefy]);
41
- const loadingPage = context.id !== config.id;
42
-
43
- if (loadingPage) {
44
- return children(context, loadingPage, 'pager');
45
- }
46
-
47
- return (
48
- <MountEvents
49
- asyncEventName="onEnterAsync"
50
- context={context}
51
- eventName="onEnter"
52
- triggerEvent={({ name, context }) =>
53
- context._internal.RootBlocks.areas.root.blocks[0].triggerEvent({ name })
54
- }
55
- >
56
- {(loading) => children(context, loading, 'mounter')}
57
- </MountEvents>
58
- );
59
- };
60
-
61
- export default Context;
@@ -1,47 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React from 'react';
18
-
19
- import callRequest from '../utils/callRequest.js';
20
- import blockComponents from '../../.lowdefy/build/plugins/blocks.js';
21
- import components from './components.js';
22
-
23
- const LowdefyContext = ({ children }) => {
24
- const lowdefy = {
25
- _internal: {
26
- blockComponents,
27
- callRequest,
28
- components,
29
- document,
30
- updaters: {},
31
- window,
32
- displayMessage: ({ content }) => {
33
- alert(content);
34
- return () => undefined;
35
- },
36
- link: () => undefined,
37
- },
38
- contexts: {},
39
- inputs: {},
40
- lowdefyGlobal: {},
41
- };
42
- lowdefy._internal.updateBlock = (blockId) =>
43
- lowdefy._internal.updaters[blockId] && lowdefy._internal.updaters[blockId]();
44
- return <>{children(lowdefy)}</>;
45
- };
46
-
47
- export default LowdefyContext;
@@ -1,60 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React from 'react';
18
-
19
- import { useRouter } from 'next/router';
20
-
21
- import Context from './Context.js';
22
- import Head from './Head.js';
23
- import Block from './block/Block.js';
24
- import setupLink from '../utils/setupLink.js';
25
-
26
- const LoadingBlock = () => <div>Loading...</div>;
27
-
28
- const Page = ({ lowdefy, pageConfig, rootConfig }) => {
29
- const router = useRouter();
30
- lowdefy._internal.basePath = router.basePath;
31
- lowdefy._internal.pathname = router.pathname;
32
- lowdefy._internal.query = router.query;
33
- lowdefy._internal.router = router;
34
- lowdefy._internal.link = setupLink({ lowdefy });
35
- lowdefy.home = rootConfig.home;
36
- lowdefy.lowdefyGlobal = rootConfig.lowdefyGlobal;
37
- lowdefy.menus = rootConfig.menus;
38
- return (
39
- <Context config={pageConfig} lowdefy={lowdefy}>
40
- {(context, loading) => {
41
- if (loading) {
42
- return <LoadingBlock />;
43
- }
44
- return (
45
- <>
46
- <Head properties={context._internal.RootBlocks.map[pageConfig.id].eval.properties} />
47
- <Block
48
- block={context._internal.RootBlocks.map[pageConfig.id]}
49
- Blocks={context._internal.RootBlocks}
50
- context={context}
51
- lowdefy={lowdefy}
52
- />
53
- </>
54
- );
55
- }}
56
- </Context>
57
- );
58
- };
59
-
60
- export default Page;
@@ -1,57 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React, { Suspense, useState } from 'react';
18
-
19
- import { ErrorBoundary } from '@lowdefy/block-utils';
20
-
21
- import CategorySwitch from './CategorySwitch.js';
22
- import LoadingBlock from './LoadingBlock.js';
23
- import MountEvents from './MountEvents.js';
24
-
25
- const Block = ({ block, Blocks, context, isRoot, lowdefy }) => {
26
- const [updates, setUpdate] = useState(0);
27
- lowdefy._internal.updaters[block.id] = () => setUpdate(updates + 1);
28
- return (
29
- <ErrorBoundary>
30
- <Suspense fallback={<LoadingBlock block={block} lowdefy={lowdefy} />}>
31
- <MountEvents
32
- asyncEventName="onMountAsync"
33
- context={context}
34
- eventName="onMount"
35
- triggerEvent={block.triggerEvent}
36
- >
37
- {(loading) =>
38
- loading ? (
39
- <LoadingBlock block={block} lowdefy={lowdefy} />
40
- ) : (
41
- <CategorySwitch
42
- block={block}
43
- Blocks={Blocks}
44
- context={context}
45
- isRoot={isRoot}
46
- lowdefy={lowdefy}
47
- updates={updates}
48
- />
49
- )
50
- }
51
- </MountEvents>
52
- </Suspense>
53
- </ErrorBoundary>
54
- );
55
- };
56
-
57
- export default Block;
@@ -1,120 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React from 'react';
18
- import { BlockLayout } from '@lowdefy/layout';
19
- import { makeCssClass } from '@lowdefy/block-utils';
20
-
21
- import Container from './Container.js';
22
- import List from './List.js';
23
-
24
- const CategorySwitch = ({ block, Blocks, context, lowdefy }) => {
25
- if (!block.eval) return null; // Renderer updates before eval is executed for the first time on lists. See #520
26
- if (block.eval.visible === false)
27
- return <div id={`vs-${block.blockId}`} style={{ display: 'none' }} />;
28
- const Component = lowdefy._internal.blockComponents[block.type];
29
- switch (Component.meta.category) {
30
- case 'list':
31
- return (
32
- <List
33
- block={block}
34
- Blocks={Blocks}
35
- Component={Component}
36
- context={context}
37
- lowdefy={lowdefy}
38
- />
39
- );
40
- case 'container':
41
- return (
42
- <Container
43
- block={block}
44
- Blocks={Blocks}
45
- Component={Component}
46
- context={context}
47
- lowdefy={lowdefy}
48
- />
49
- );
50
- case 'input':
51
- return (
52
- <BlockLayout
53
- id={`bl-${block.blockId}`}
54
- blockStyle={block.eval.style}
55
- highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
56
- layout={block.eval.layout || {}}
57
- makeCssClass={makeCssClass}
58
- >
59
- <Component
60
- methods={Object.assign(block.methods, {
61
- makeCssClass,
62
- registerEvent: block.registerEvent,
63
- registerMethod: block.registerMethod,
64
- setValue: block.setValue,
65
- triggerEvent: block.triggerEvent,
66
- })}
67
- // TODO: React throws a basePath warning
68
- basePath={lowdefy._internal.basePath}
69
- blockId={block.blockId}
70
- components={lowdefy._internal.components}
71
- events={block.eval.events}
72
- homePageId={lowdefy.homePageId}
73
- key={block.blockId}
74
- loading={block.loading}
75
- menus={lowdefy.menus}
76
- pageId={lowdefy.pageId}
77
- properties={block.eval.properties}
78
- required={block.eval.required}
79
- user={lowdefy.user}
80
- validation={block.eval.validation}
81
- value={block.value}
82
- />
83
- </BlockLayout>
84
- );
85
- default:
86
- return (
87
- <BlockLayout
88
- id={`bl-${block.blockId}`}
89
- blockStyle={block.eval.style}
90
- highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
91
- layout={block.eval.layout || {}}
92
- makeCssClass={makeCssClass}
93
- >
94
- <Component
95
- methods={Object.assign(block.methods, {
96
- makeCssClass,
97
- registerEvent: block.registerEvent,
98
- registerMethod: block.registerMethod,
99
- triggerEvent: block.triggerEvent,
100
- })}
101
- basePath={lowdefy._internal.basePath}
102
- blockId={block.blockId}
103
- components={lowdefy._internal.components}
104
- events={block.eval.events}
105
- homePageId={lowdefy.homePageId}
106
- key={block.blockId}
107
- loading={block.loading}
108
- menus={lowdefy.menus}
109
- pageId={lowdefy.pageId}
110
- properties={block.eval.properties}
111
- required={block.eval.required}
112
- user={lowdefy.user}
113
- validation={block.eval.validation}
114
- />
115
- </BlockLayout>
116
- );
117
- }
118
- };
119
-
120
- export default CategorySwitch;
@@ -1,87 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React from 'react';
18
- import { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
19
- import { makeCssClass } from '@lowdefy/block-utils';
20
-
21
- import Block from './Block.js';
22
-
23
- const Container = ({ block, Blocks, Component, context, lowdefy }) => {
24
- const content = {};
25
- // eslint-disable-next-line prefer-destructuring
26
- const areas = Blocks.subBlocks[block.id][0].areas;
27
- Object.keys(areas).forEach((areaKey) => {
28
- content[areaKey] = (areaStyle) => (
29
- <Area
30
- id={`ar-${block.blockId}-${areaKey}`}
31
- key={`ar-${block.blockId}-${areaKey}`}
32
- area={layoutParamsToArea({
33
- area: block.eval.areas[areaKey] || {},
34
- areaKey,
35
- layout: block.eval.layout || {},
36
- })}
37
- areaStyle={[areaStyle, block.eval.areas[areaKey] && block.eval.areas[areaKey].style]}
38
- highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
39
- makeCssClass={makeCssClass}
40
- >
41
- {areas[areaKey].blocks.map((bl) => (
42
- <Block
43
- key={`co-${bl.blockId}`}
44
- Blocks={Blocks.subBlocks[block.id][0]}
45
- block={bl}
46
- context={context}
47
- lowdefy={lowdefy}
48
- />
49
- ))}
50
- </Area>
51
- );
52
- });
53
- return (
54
- <BlockLayout
55
- id={`bl-${block.blockId}`}
56
- blockStyle={block.eval.style}
57
- highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
58
- layout={block.eval.layout || {}}
59
- makeCssClass={makeCssClass}
60
- >
61
- <Component
62
- methods={Object.assign(block.methods, {
63
- makeCssClass,
64
- registerEvent: block.registerEvent,
65
- registerMethod: block.registerMethod,
66
- triggerEvent: block.triggerEvent,
67
- })}
68
- basePath={lowdefy._internal.basePath}
69
- blockId={block.blockId}
70
- components={lowdefy._internal.components}
71
- content={content}
72
- events={block.eval.events}
73
- homePageId={lowdefy.homePageId}
74
- key={block.blockId}
75
- loading={block.loading}
76
- menus={lowdefy.menus}
77
- pageId={lowdefy.pageId}
78
- properties={block.eval.properties}
79
- required={block.eval.required}
80
- user={lowdefy.user}
81
- validation={block.eval.validation}
82
- />
83
- </BlockLayout>
84
- );
85
- };
86
-
87
- export default Container;
@@ -1,94 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React from 'react';
18
- import { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
19
- import { makeCssClass } from '@lowdefy/block-utils';
20
-
21
- import Block from './Block.js';
22
-
23
- const List = ({ block, Blocks, Component, context, lowdefy }) => {
24
- const content = {};
25
- const contentList = [];
26
- Blocks.subBlocks[block.id].forEach((SBlock) => {
27
- Object.keys(SBlock.areas).forEach((areaKey) => {
28
- content[areaKey] = (areaStyle) => (
29
- <Area
30
- id={`ar-${block.blockId}-${SBlock.id}-${areaKey}`}
31
- key={`ar-${block.blockId}-${SBlock.id}-${areaKey}`}
32
- area={layoutParamsToArea({
33
- area: block.eval.areas[areaKey] || {},
34
- areaKey,
35
- layout: block.eval.layout || {},
36
- })}
37
- areaStyle={[areaStyle, block.eval.areas[areaKey] && block.eval.areas[areaKey].style]}
38
- highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
39
- makeCssClass={makeCssClass}
40
- >
41
- {SBlock.areas[areaKey].blocks.map((bl) => (
42
- <Block
43
- key={`ls-${bl.blockId}`}
44
- Blocks={SBlock}
45
- block={bl}
46
- context={context}
47
- lowdefy={lowdefy}
48
- />
49
- ))}
50
- </Area>
51
- );
52
- });
53
- contentList.push({ ...content });
54
- });
55
- return (
56
- <BlockLayout
57
- id={`bl-${block.blockId}`}
58
- blockStyle={block.eval.style}
59
- highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
60
- layout={block.eval.layout || {}}
61
- makeCssClass={makeCssClass}
62
- >
63
- <Component
64
- methods={Object.assign(block.methods, {
65
- makeCssClass,
66
- moveItemDown: block.moveItemDown,
67
- moveItemUp: block.moveItemUp,
68
- pushItem: block.pushItem,
69
- registerEvent: block.registerEvent,
70
- registerMethod: block.registerMethod,
71
- removeItem: block.removeItem,
72
- triggerEvent: block.triggerEvent,
73
- unshiftItem: block.unshiftItem,
74
- })}
75
- basePath={lowdefy._internal.basePath}
76
- blockId={block.blockId}
77
- components={lowdefy._internal.components}
78
- events={block.eval.events}
79
- homePageId={lowdefy.homePageId}
80
- key={block.blockId}
81
- list={contentList}
82
- loading={block.loading}
83
- menus={lowdefy.menus}
84
- pageId={lowdefy.pageId}
85
- properties={block.eval.properties}
86
- required={block.eval.required}
87
- user={lowdefy.user}
88
- validation={block.eval.validation}
89
- />
90
- </BlockLayout>
91
- );
92
- };
93
-
94
- export default List;
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- // import { Loading, makeCssClass } from '@lowdefy/block-utils';
3
- // import { get } from '@lowdefy/helpers';
4
- // import { BlockLayout } from '@lowdefy/layout';
5
-
6
- const LoadingBlock = ({ block, lowdefy }) => (
7
- <div>LoadingBlock</div>
8
- // <BlockLayout
9
- // id={`bl-loading-${block.blockId}`}
10
- // blockStyle={get(block, 'eval.style') || get(block, 'meta.loading.style', { default: {} })}
11
- // highlightBorders={lowdefy.lowdefyGlobal.highlightBorders}
12
- // layout={get(block, 'eval.layout') || get(block, 'meta.loading.layout', { default: {} })}
13
- // makeCssClass={makeCssClass}
14
- // >
15
- // <Loading
16
- // properties={get(block, 'meta.loading.properties')}
17
- // type={get(block, 'meta.loading.type')}
18
- // />
19
- // </BlockLayout>
20
- );
21
-
22
- export default LoadingBlock;
@@ -1,46 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React, { useEffect, useState } from 'react';
18
-
19
- const MountEvents = ({ asyncEventName, context, eventName, triggerEvent, children }) => {
20
- const [loading, setLoading] = useState(true);
21
- const [error, setError] = useState(null);
22
- useEffect(() => {
23
- let mounted = true;
24
- const mount = async () => {
25
- try {
26
- await triggerEvent({ name: eventName, context });
27
- if (mounted) {
28
- triggerEvent({ name: asyncEventName, context });
29
- setLoading(false);
30
- }
31
- } catch (err) {
32
- setError(err);
33
- }
34
- };
35
- mount();
36
- return () => {
37
- mounted = false;
38
- };
39
- }, [context]);
40
-
41
- if (error) throw error;
42
-
43
- return <>{children(loading)}</>;
44
- };
45
-
46
- export default MountEvents;
@@ -1,25 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import Link from 'next/link';
18
- import { createIcon } from '@lowdefy/block-utils';
19
-
20
- import icons from '../plugins/icons.js';
21
-
22
- export default {
23
- Link,
24
- Icon: createIcon(icons),
25
- };
package/src/pages/_app.js DELETED
@@ -1,37 +0,0 @@
1
- /*
2
- Copyright 2020-2021 Lowdefy, Inc
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- import React, { Suspense } from 'react';
18
-
19
- import { ErrorBoundary } from '@lowdefy/block-utils';
20
-
21
- import LowdefyContext from '../components/LowdefyContext.js';
22
-
23
- import '../plugins/style.less';
24
-
25
- function App({ Component, pageProps }) {
26
- return (
27
- <ErrorBoundary>
28
- <Suspense>
29
- <LowdefyContext>
30
- {(lowdefy) => <Component lowdefy={lowdefy} {...pageProps} />}
31
- </LowdefyContext>
32
- </Suspense>
33
- </ErrorBoundary>
34
- );
35
- }
36
-
37
- export default App;