@developer_tribe/react-builder 1.0.5 → 1.0.7

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 (48) hide show
  1. package/dist/build-components/index.d.ts +1 -2
  2. package/dist/build-components/patterns.generated.d.ts +0 -383
  3. package/dist/components/BottomBar.d.ts +12 -0
  4. package/dist/components/LoadingComponent.d.ts +1 -0
  5. package/dist/index.cjs.js +3 -3
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.esm.js +3 -3
  9. package/dist/index.esm.js.map +1 -1
  10. package/dist/index.native.cjs.js +1 -1
  11. package/dist/index.native.cjs.js.map +1 -1
  12. package/dist/index.native.esm.js +4 -4
  13. package/dist/index.native.esm.js.map +1 -1
  14. package/dist/modals/ScreenColorsModal.d.ts +8 -0
  15. package/dist/modals/index.d.ts +1 -0
  16. package/dist/pages/ProjectPage.d.ts +3 -2
  17. package/dist/styles.css +1 -1
  18. package/dist/utils/nodeTree.d.ts +5 -0
  19. package/package.json +5 -2
  20. package/src/build-components/RenderNode.generated.tsx +0 -7
  21. package/src/build-components/index.ts +0 -5
  22. package/src/build-components/patterns.generated.ts +0 -399
  23. package/src/components/BottomBar.tsx +242 -0
  24. package/src/components/LoadingComponent.tsx +10 -0
  25. package/src/index.ts +2 -1
  26. package/src/modals/ScreenColorsModal.tsx +121 -0
  27. package/src/modals/index.ts +1 -0
  28. package/src/pages/ProjectPage.tsx +72 -163
  29. package/src/styles/base/_global.scss +25 -20
  30. package/src/styles/components/_attributes-editor.scss +26 -24
  31. package/src/styles/components/_bottom-bar.scss +101 -0
  32. package/src/styles/components/_editor-shell.scss +19 -18
  33. package/src/styles/components/_mockos-router.scss +16 -14
  34. package/src/styles/components/_ui-components.scss +14 -15
  35. package/src/styles/foundation/_colors.scss +28 -8
  36. package/src/styles/foundation/_mixins.scss +1 -1
  37. package/src/styles/foundation/_sizes.scss +4 -2
  38. package/src/styles/index.scss +1 -0
  39. package/src/styles/layout/_builder.scss +1 -1
  40. package/src/styles/modals/_add-component.scss +2 -2
  41. package/src/styles/modals/_color-modal.scss +2 -2
  42. package/src/styles/modals/_modal-shell.scss +1 -1
  43. package/src/utils/nodeTree.ts +99 -0
  44. package/dist/build-components/PaywallSubscriButton/PaywallSubscriButton.d.ts +0 -5
  45. package/dist/build-components/PaywallSubscriButton/PaywallSubscriButtonProps.generated.d.ts +0 -50
  46. package/src/build-components/PaywallSubscriButton/PaywallSubscriButton.tsx +0 -10
  47. package/src/build-components/PaywallSubscriButton/PaywallSubscriButtonProps.generated.ts +0 -77
  48. package/src/build-components/PaywallSubscriButton/pattern.json +0 -27
@@ -0,0 +1,99 @@
1
+ import type { Node, NodeData } from '../types/Node';
2
+
3
+ export function deleteNodeFromTree(root: Node, target: Node): Node {
4
+ if (root === null || root === undefined) return root;
5
+ if (typeof root === 'string') return root;
6
+
7
+ if (Array.isArray(root)) {
8
+ let changed = false;
9
+ const nextChildren: Node[] = [];
10
+ for (const child of root) {
11
+ if (child === target) {
12
+ changed = true;
13
+ continue;
14
+ }
15
+ const nextChild = deleteNodeFromTree(child, target);
16
+ if (nextChild !== child) changed = true;
17
+ nextChildren.push(nextChild);
18
+ }
19
+ return changed ? nextChildren : root;
20
+ }
21
+
22
+ const data = root as any;
23
+ if ('children' in data) {
24
+ const prev = data.children as Node;
25
+ if (!prev) return root;
26
+
27
+ if (Array.isArray(prev)) {
28
+ let changed = false;
29
+ const nextChildren: Node[] = [];
30
+ for (const child of prev) {
31
+ if (child === target) {
32
+ changed = true;
33
+ continue;
34
+ }
35
+ const nextChild = deleteNodeFromTree(child, target);
36
+ if (nextChild !== child) changed = true;
37
+ nextChildren.push(nextChild);
38
+ }
39
+ if (changed) {
40
+ return { ...data, children: nextChildren } as Node;
41
+ }
42
+ return root;
43
+ }
44
+
45
+ if (prev === target) {
46
+ return { ...data, children: '' } as Node;
47
+ }
48
+
49
+ const nextChild = deleteNodeFromTree(prev, target);
50
+ if (nextChild !== prev) {
51
+ return { ...data, children: nextChild } as Node;
52
+ }
53
+ }
54
+
55
+ return root;
56
+ }
57
+
58
+ export function isNodeRecord(node: Node): node is NodeData {
59
+ return (
60
+ node !== null &&
61
+ node !== undefined &&
62
+ typeof node === 'object' &&
63
+ !Array.isArray(node)
64
+ );
65
+ }
66
+
67
+ export function nodeHasChild(parent: NodeData, potentialChild: Node): boolean {
68
+ const { children } = parent;
69
+ if (!children) return false;
70
+ if (Array.isArray(children)) {
71
+ return children.some((child) => child === potentialChild);
72
+ }
73
+ return children === potentialChild;
74
+ }
75
+
76
+ export function findNodeByKey(root: Node, key?: string): Node | null {
77
+ if (!key) return null;
78
+ if (root === null || root === undefined) return null;
79
+ if (typeof root === 'string') return null;
80
+
81
+ if (Array.isArray(root)) {
82
+ for (const child of root) {
83
+ const found = findNodeByKey(child, key);
84
+ if (found) return found;
85
+ }
86
+ return null;
87
+ }
88
+
89
+ const nodeData = root as NodeData;
90
+ if (nodeData.key === key) {
91
+ return nodeData;
92
+ }
93
+
94
+ if (nodeData.children) {
95
+ return findNodeByKey(nodeData.children as Node, key);
96
+ }
97
+
98
+ return null;
99
+ }
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { PaywallSubscriButtonComponentProps } from './PaywallSubscriButtonProps.generated';
3
- declare function PaywallSubscriButton({ node }: PaywallSubscriButtonComponentProps): null;
4
- declare const _default: React.MemoExoticComponent<typeof PaywallSubscriButton>;
5
- export default _default;
@@ -1,50 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type FontWeightOptionType = 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
3
- export type FlexDirectionOptionType = 'row' | 'column';
4
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
5
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
6
- export type PositionOptionType = 'relative' | 'absolute';
7
- export interface PaywallSubscriButtonPropsGenerated {
8
- child: string;
9
- attributes: {
10
- color?: string;
11
- fontSize?: string;
12
- fontWeight?: FontWeightOptionType;
13
- scrollable?: boolean;
14
- flexDirection?: FlexDirectionOptionType;
15
- alignItems?: AlignItemsOptionType;
16
- justifyContent?: JustifyContentOptionType;
17
- gap?: string;
18
- padding?: string;
19
- paddingHorizontal?: string;
20
- paddingVertical?: string;
21
- paddingTop?: string;
22
- paddingBottom?: string;
23
- paddingLeft?: string;
24
- paddingRight?: string;
25
- margin?: string;
26
- marginVertical?: string;
27
- marginTop?: string;
28
- marginBottom?: string;
29
- marginLeft?: string;
30
- marginRight?: string;
31
- backgroundColor?: string;
32
- borderRadius?: string;
33
- width?: string;
34
- minWidth?: string;
35
- maxWidth?: string;
36
- height?: string;
37
- minHeight?: string;
38
- maxHeight?: string;
39
- flex?: number;
40
- position?: PositionOptionType;
41
- top?: string;
42
- bottom?: string;
43
- left?: string;
44
- right?: string;
45
- zIndex?: number;
46
- };
47
- }
48
- export interface PaywallSubscriButtonComponentProps {
49
- node: NodeData<PaywallSubscriButtonPropsGenerated['attributes']>;
50
- }
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { PaywallSubscriButtonComponentProps } from './PaywallSubscriButtonProps.generated';
3
- import useNode from '../useNode';
4
-
5
- function PaywallSubscriButton({ node }: PaywallSubscriButtonComponentProps) {
6
- node = useNode(node);
7
- return null;
8
- }
9
-
10
- export default React.memo(PaywallSubscriButton);
@@ -1,77 +0,0 @@
1
- /* AUTO-GENERATED FILE - DO NOT EDIT */
2
-
3
- import type { NodeData } from '../../types/Node';
4
-
5
- export type FontWeightOptionType =
6
- | 'normal'
7
- | 'bold'
8
- | '100'
9
- | '200'
10
- | '300'
11
- | '400'
12
- | '500'
13
- | '600'
14
- | '700'
15
- | '800'
16
- | '900';
17
- export type FlexDirectionOptionType = 'row' | 'column';
18
- export type AlignItemsOptionType =
19
- | 'flex-start'
20
- | 'center'
21
- | 'flex-end'
22
- | 'stretch'
23
- | 'baseline';
24
- export type JustifyContentOptionType =
25
- | 'flex-start'
26
- | 'center'
27
- | 'flex-end'
28
- | 'space-between'
29
- | 'space-around'
30
- | 'space-evenly';
31
- export type PositionOptionType = 'relative' | 'absolute';
32
-
33
- export interface PaywallSubscriButtonPropsGenerated {
34
- child: string;
35
- attributes: {
36
- color?: string;
37
- fontSize?: string;
38
- fontWeight?: FontWeightOptionType;
39
- scrollable?: boolean;
40
- flexDirection?: FlexDirectionOptionType;
41
- alignItems?: AlignItemsOptionType;
42
- justifyContent?: JustifyContentOptionType;
43
- gap?: string;
44
- padding?: string;
45
- paddingHorizontal?: string;
46
- paddingVertical?: string;
47
- paddingTop?: string;
48
- paddingBottom?: string;
49
- paddingLeft?: string;
50
- paddingRight?: string;
51
- margin?: string;
52
- marginVertical?: string;
53
- marginTop?: string;
54
- marginBottom?: string;
55
- marginLeft?: string;
56
- marginRight?: string;
57
- backgroundColor?: string;
58
- borderRadius?: string;
59
- width?: string;
60
- minWidth?: string;
61
- maxWidth?: string;
62
- height?: string;
63
- minHeight?: string;
64
- maxHeight?: string;
65
- flex?: number;
66
- position?: PositionOptionType;
67
- top?: string;
68
- bottom?: string;
69
- left?: string;
70
- right?: string;
71
- zIndex?: number;
72
- };
73
- }
74
-
75
- export interface PaywallSubscriButtonComponentProps {
76
- node: NodeData<PaywallSubscriButtonPropsGenerated['attributes']>;
77
- }
@@ -1,27 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
4
- "pattern": {
5
- "type": "PaywallSubscriButton",
6
- "children": "string",
7
- "extends": "Button",
8
- "attributes": {}
9
- },
10
- "defaults": {
11
- "paddingHorizontal": "20@s",
12
- "paddingVertical": "12@vs",
13
- "borderRadius": "12@s",
14
- "backgroundColor": "#1C1C1E",
15
- "color": "cornflowerblue",
16
- "fontSize": "16@fs",
17
- "fontWeight": "700",
18
- "justifyContent": "center",
19
- "alignItems": "center"
20
- },
21
- "meta": {
22
- "desiredParent": [">PaywallProvider"],
23
- "label": "Paywall Subscribe Button",
24
- "description": "Paywall subscribe call-to-action button. Extends Button.",
25
- "attributes": {}
26
- }
27
- }