Skip to content

Commit 85b1714

Browse files
committed
Updated change history
1 parent 953110c commit 85b1714

File tree

5 files changed

+46
-35
lines changed

5 files changed

+46
-35
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
"start": "rollup -c -w",
8888
"build": "npm run build:prod",
8989
"build:prod": "rollup -c",
90-
"publish:alpha": "npm publish --tag alpha",
90+
"publish:beta": "npm publish --tag beta",
9191
"storybook": "start-storybook -p 6006",
9292
"build-storybook": "build-storybook",
9393
"test": "jest"

src/components/Space.tsx

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ export const Space: React.FC<ISpaceProps> = (props) => {
2929
onTouchEnd,
3030
children,
3131
} = props;
32+
33+
const events = {
34+
onClick: onClick,
35+
onDoubleClick: onDoubleClick,
36+
onMouseDown: onMouseDown,
37+
onMouseEnter: onMouseEnter,
38+
onMouseLeave: onMouseLeave,
39+
onMouseMove: onMouseMove,
40+
onTouchStart: onTouchStart,
41+
onTouchMove: onTouchMove,
42+
onTouchEnd: onTouchEnd,
43+
};
44+
3245
const { space, domRect, elementRef, resizeHandles } = useSpace(props);
3346

3447
React.useEffect(() => {
@@ -37,15 +50,9 @@ export const Space: React.FC<ISpaceProps> = (props) => {
3750

3851
const userClasses = className ? className.split(" ").map((c) => c.trim()) : [];
3952

40-
const outerClasses = [
41-
...[
42-
"spaces-space",
43-
//props.scrollable ? (isResizable(props) ? "scrollable" : "scrollable-a") : undefined,
44-
space.children.find((s) => s.resizing) ? " spaces-resizing" : undefined,
45-
],
46-
//...(isResizable(props) && props.scrollable ? userClasses.map((c) => `${c}-container`) : userClasses),
47-
...userClasses,
48-
].filter((c) => c);
53+
const outerClasses = [...["spaces-space", space.children.find((s) => s.resizing) ? "spaces-resizing" : undefined], ...userClasses].filter(
54+
(c) => c,
55+
);
4956

5057
const centeredContent = applyCentering(children, props.centerContent);
5158

@@ -54,30 +61,24 @@ export const Space: React.FC<ISpaceProps> = (props) => {
5461
{React.createElement(
5562
props.as || "div",
5663
{
57-
id: space.id,
58-
ref: elementRef,
59-
style: style,
60-
className: outerClasses.join(" "),
61-
onClick: onClick,
62-
onDoubleClick: onDoubleClick,
63-
onMouseDown: onMouseDown,
64-
onMouseEnter: onMouseEnter,
65-
onMouseLeave: onMouseLeave,
66-
onMouseMove: onMouseMove,
67-
onTouchStart: onTouchStart,
68-
onTouchMove: onTouchMove,
69-
onTouchEnd: onTouchEnd,
64+
...{
65+
id: space.id,
66+
ref: elementRef,
67+
className: outerClasses.join(" "),
68+
style: style,
69+
},
70+
...events,
7071
},
71-
<ParentContext.Provider value={space.id}>
72-
<LayerContext.Provider value={undefined}>
73-
<DOMRectContext.Provider value={domRect}>
74-
{resizeHandles.map((r) => (
75-
<div {...r} />
76-
))}
77-
{centeredContent}
78-
</DOMRectContext.Provider>
79-
</LayerContext.Provider>
80-
</ParentContext.Provider>,
72+
<>
73+
{resizeHandles.map((r) => (
74+
<div {...r} />
75+
))}
76+
<ParentContext.Provider value={space.id}>
77+
<LayerContext.Provider value={undefined}>
78+
<DOMRectContext.Provider value={domRect}>{centeredContent}</DOMRectContext.Provider>
79+
</LayerContext.Provider>
80+
</ParentContext.Provider>
81+
</>,
8182
)}
8283
</>
8384
);

src/components/stories/00-docs/04-ChangeHistory.stories.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ import { CommonHeader } from "../Utils";
77

88
## Change history
99

10+
### 0.2.0
11+
12+
- Rewrote core state management for all spaces using global state (issue #69)
13+
- Moved space dynamic styling updates from React managed with a React portal to direct DOM manipulation
14+
- Added JEST testing for core space behaviour (issue #71)
15+
- Added DOMRect as second parameter to `onResizeEnd` callback
16+
- Fixed "Cannot update a component from inside the function body of a different component" from latest version of React - 16.3.0 (issue #64)
17+
- Fixed issue where changing space anchors in the same parent 'ate' space incorrectly from a `<Fill />` space (issue #52)
18+
1019
### 0.1.25
1120

1221
- Added storybook docs. View with `npm run storybook`.

src/components/stories/Utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ export const ResizableProps = () => (
149149
<Prop name="maximumSize" type="number" description="Constrains resizing of the space to a maximum size." />
150150
<Prop
151151
name="onResizeStart"
152-
type="() => boolean"
152+
type="() => boolean | void"
153153
description="Triggered when a resize starts. Returning false from the event handler cancels the resize."
154154
/>
155155
<Prop
156156
name="onResizeEnd"
157-
type="(newSize: number) => void"
157+
type="(newSize: number, newRect: DOMRect) => void"
158158
description="Triggered when a resize ends. The final size in pixels of the space in after the resize is passed as the first parameter."
159159
/>
160160
</>

src/core-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ export interface ISpaceProps extends ICommonProps {
6666
anchor?: AnchorType | undefined;
6767
order?: number | undefined;
6868
position?: IPositionalProps | undefined;
69+
overlayHandle?: boolean | undefined;
6970
handleSize?: number | undefined;
7071
minimumSize?: number | undefined;
7172
maximumSize?: number | undefined;

0 commit comments

Comments
 (0)