publ-echo 0.0.4 → 0.0.5

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 (56) hide show
  1. package/package.json +5 -5
  2. package/bin/cli.js +0 -8
  3. package/bitbucket-pipelines.yml +0 -35
  4. package/public/favicon.ico +0 -0
  5. package/public/index.html +0 -43
  6. package/public/logo192.png +0 -0
  7. package/public/logo512.png +0 -0
  8. package/public/manifest.json +0 -25
  9. package/public/robots.txt +0 -3
  10. package/src/App.tsx +0 -28
  11. package/src/examples/ReactGridLayout/ReactGridLayoutShowcase01.tsx +0 -80
  12. package/src/examples/ReactGridLayout/index.ts +0 -1
  13. package/src/examples/ResponsiveGridLayout/ResponsiveGridLayoutShowcase01.tsx +0 -114
  14. package/src/examples/ResponsiveGridLayout/index.ts +0 -1
  15. package/src/examples/index.ts +0 -2
  16. package/src/examples/utils.ts +0 -15
  17. package/src/index.tsx +0 -21
  18. package/src/lib/Draggable/Draggable.tsx +0 -303
  19. package/src/lib/Draggable/DraggableCore.tsx +0 -352
  20. package/src/lib/Draggable/constants.ts +0 -12
  21. package/src/lib/Draggable/index.ts +0 -2
  22. package/src/lib/Draggable/types.ts +0 -74
  23. package/src/lib/Draggable/utils/domHelpers.ts +0 -284
  24. package/src/lib/Draggable/utils/getPrefix.ts +0 -42
  25. package/src/lib/Draggable/utils/positionHelpers.ts +0 -49
  26. package/src/lib/Draggable/utils/types.ts +0 -41
  27. package/src/lib/Draggable/utils/validationHelpers.ts +0 -23
  28. package/src/lib/GridItem/GridItem.tsx +0 -493
  29. package/src/lib/GridItem/index.ts +0 -1
  30. package/src/lib/GridItem/types.ts +0 -121
  31. package/src/lib/GridItem/utils/calculateUtils.ts +0 -173
  32. package/src/lib/GridLayoutEditor/ReactGridLayout.tsx +0 -662
  33. package/src/lib/GridLayoutEditor/ResponsiveGridLayout.tsx +0 -204
  34. package/src/lib/GridLayoutEditor/index.ts +0 -11
  35. package/src/lib/GridLayoutEditor/styles/styles.css +0 -133
  36. package/src/lib/GridLayoutEditor/types.ts +0 -199
  37. package/src/lib/GridLayoutEditor/utils/renderHelpers.ts +0 -737
  38. package/src/lib/GridLayoutEditor/utils/responsiveUtils.ts +0 -111
  39. package/src/lib/PreviewGLE/ReactGridLayoutPreview.tsx +0 -46
  40. package/src/lib/PreviewGLE/ResponsiveGridLayoutPreview.tsx +0 -54
  41. package/src/lib/PreviewGLE/index.ts +0 -2
  42. package/src/lib/Resizable/Resizable.tsx +0 -323
  43. package/src/lib/Resizable/ResizableBox.tsx +0 -109
  44. package/src/lib/Resizable/index.ts +0 -1
  45. package/src/lib/Resizable/styles/styles.css +0 -76
  46. package/src/lib/Resizable/types.ts +0 -96
  47. package/src/lib/Resizable/utils/cloneElement.ts +0 -15
  48. package/src/lib/components/WidthProvider.tsx +0 -71
  49. package/src/lib/components/index.ts +0 -1
  50. package/src/lib/components/types.ts +0 -19
  51. package/src/lib/index.ts +0 -5
  52. package/src/react-app-env.d.ts +0 -1
  53. package/src/reportWebVitals.ts +0 -15
  54. package/src/setupTests.ts +0 -5
  55. package/src/utils/types.ts +0 -3
  56. package/tsconfig.json +0 -22
@@ -1,173 +0,0 @@
1
- import { ResizeHandleAxis } from "../../Resizable/types";
2
- import { Position, PositionParams } from "../../GridLayoutEditor/types";
3
-
4
- export type RowHeight = number | ((width: number) => number);
5
-
6
- export function calcGridColWidth(positionParams: PositionParams): number {
7
- const { margin, containerPadding, containerWidth, cols } = positionParams;
8
-
9
- return (
10
- (containerWidth - margin[0] * (cols - 1) - containerPadding[0] * 2) / cols
11
- );
12
- }
13
-
14
- export function calcGridItemWHPx(
15
- gridUnits: number,
16
- colOrRowSize: number,
17
- marginPx: number
18
- ): number {
19
- if (!Number.isFinite(gridUnits)) return gridUnits;
20
-
21
- return Math.round(
22
- colOrRowSize * gridUnits + Math.max(0, gridUnits - 1) * marginPx
23
- );
24
- }
25
-
26
- export const resolveRowHeight = (rowHeight: RowHeight, width: number) =>
27
- typeof rowHeight === "number" ? rowHeight : rowHeight(width);
28
-
29
- export function calcGridItemPosition(
30
- positionParams: PositionParams,
31
- x: number,
32
- y: number,
33
- z: number,
34
- w: number,
35
- h: number,
36
- state?: {
37
- resizing?: { width: number; height: number; top: number; left: number };
38
- dragging?: { top: number; left: number };
39
- }
40
- ): Position {
41
- const { margin, containerPadding, rowHeight } = positionParams;
42
- const colWidth = calcGridColWidth(positionParams);
43
- const rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
44
-
45
- const result = {
46
- left: Math.round((colWidth + margin[0]) * x + containerPadding[0]),
47
- top: Math.round((rowHeightNumber + margin[1]) * y + containerPadding[1]),
48
- width: w === Infinity ? w : calcGridItemWHPx(w, colWidth, margin[0]),
49
- height:
50
- h === Infinity ? h : calcGridItemWHPx(h, rowHeightNumber, margin[1]),
51
- };
52
-
53
- if (state && state.resizing) {
54
- result.width = Math.round(state.resizing.width);
55
- result.height = Math.round(state.resizing.height);
56
- result.top = Math.round(state.resizing.top);
57
- result.left = Math.round(state.resizing.left);
58
- } else {
59
- result.width = calcGridItemWHPx(w, colWidth, margin[0]);
60
- result.height = calcGridItemWHPx(h, rowHeightNumber, margin[1]);
61
- }
62
-
63
- if (state && state.dragging) {
64
- result.top = Math.round(state.dragging.top);
65
- result.left = Math.round(state.dragging.left);
66
- } else {
67
- result.top = Math.round(
68
- (rowHeightNumber + margin[1]) * y + containerPadding[1]
69
- );
70
- result.left = Math.round((colWidth + margin[0]) * x + containerPadding[0]);
71
- }
72
-
73
- // result.z = z;
74
-
75
- return result;
76
- }
77
-
78
- export function calcXY(
79
- positionParams: PositionParams,
80
- top: number,
81
- left: number,
82
- w: number,
83
- h: number
84
- ): { x: number; y: number } {
85
- const { margin, cols, rowHeight, maxRows } = positionParams;
86
- const colWidth = calcGridColWidth(positionParams);
87
- const rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
88
-
89
- let x = Math.round((left - margin[0]) / (colWidth + margin[0]));
90
- let y = Math.round((top - margin[1]) / (rowHeightNumber + margin[1]));
91
-
92
- // Capping
93
- x = clamp(x, 0, cols - w);
94
- y = clamp(y, 0, maxRows - h);
95
-
96
- return { x, y };
97
- }
98
-
99
- export function calcWH(
100
- positionParams: PositionParams,
101
- { width, height }: { width: number; height: number },
102
- x: number,
103
- y: number,
104
- handleAxis?: ResizeHandleAxis,
105
- prevW?: number,
106
- prevH?: number
107
- ): { w: number; h: number } {
108
- const { margin, maxRows, cols, rowHeight } = positionParams;
109
- const colWidth = calcGridColWidth(positionParams);
110
- const rowHeightNumber = resolveRowHeight(rowHeight, colWidth);
111
-
112
- let w = Math.round((width + margin[0]) / (colWidth + margin[0]));
113
- let h = Math.round((height + margin[1]) / (rowHeightNumber + margin[1]));
114
-
115
- // // Capping
116
- // w = clamp(w, 0, cols - x);
117
- // h = clamp(h, 0, maxRows - y);
118
-
119
- if (handleAxis === "nw") {
120
- if (x <= 0 && y <= 0 && prevW && prevH) {
121
- w = Math.max(Math.min(w, prevW), 0);
122
- h = Math.max(Math.min(h, prevH), 0);
123
- }
124
-
125
- if (x <= 0 && prevW) {
126
- w = Math.max(Math.min(w, prevW), 0);
127
- h = Math.max(Math.min(h, maxRows - y), 0);
128
- }
129
-
130
- if (y <= 0 && prevH) {
131
- h = Math.max(Math.min(h, prevH), 0);
132
- }
133
- }
134
-
135
- if (handleAxis === "w" || handleAxis === "sw") {
136
- if (x <= 0 && prevW) {
137
- w = Math.max(Math.min(w, prevW), 0);
138
- h = Math.max(Math.min(h, maxRows - y), 0);
139
- }
140
- }
141
-
142
- if (handleAxis === "n") {
143
- if (y <= 0 && prevH) {
144
- w = Math.max(Math.min(w, cols - x), 0);
145
- h = Math.max(Math.min(h, prevH), 0);
146
- }
147
- }
148
-
149
- if (handleAxis === "ne") {
150
- if (y <= 0 && prevH) {
151
- w = Math.max(Math.min(w, cols - x), 0);
152
- h = Math.max(Math.min(h, prevH), 0);
153
- } else {
154
- w = Math.max(Math.min(w, cols - x), 0);
155
- h = Math.max(Math.min(h, maxRows - y), 0);
156
- }
157
- }
158
-
159
- if (handleAxis === "e" || handleAxis === "se") {
160
- w = Math.max(Math.min(w, cols - x), 0);
161
- h = Math.max(Math.min(h, maxRows - y), 0);
162
- }
163
-
164
- return { w, h };
165
- }
166
-
167
- export function clamp(
168
- num: number,
169
- lowerBound: number,
170
- upperBound: number
171
- ): number {
172
- return Math.max(Math.min(num, upperBound), lowerBound);
173
- }