@octanejs/transition-group 0.0.27 → 0.0.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/transition-group",
3
- "version": "0.0.27",
3
+ "version": "0.0.29",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -41,15 +41,15 @@
41
41
  "./config": "./src/config.ts"
42
42
  },
43
43
  "peerDependencies": {
44
- "octane": "^0.10.0"
44
+ "octane": "^0.12.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@babel/core": "^7.28.0",
48
48
  "@babel/preset-env": "^7.28.0",
49
49
  "@babel/preset-react": "^7.27.1",
50
- "@octanejs/testing-library": "0.1.60",
50
+ "@octanejs/testing-library": "0.1.62",
51
51
  "@testing-library/react": "^14.3.1",
52
- "@tsrx/react": "^0.3.7",
52
+ "@tsrx/react": "^0.4.5",
53
53
  "@types/react": "^19.2.17",
54
54
  "@types/react-dom": "^19.2.3",
55
55
  "babel-jest": "30.4.1",
@@ -58,7 +58,7 @@
58
58
  "jest": "30.4.2",
59
59
  "jest-environment-jsdom": "30.4.1",
60
60
  "jest-environment-node": "30.4.1",
61
- "octane": "0.10.2",
61
+ "octane": "0.12.0",
62
62
  "prop-types": "^15.8.1",
63
63
  "react": "19.2.7",
64
64
  "react-dom": "19.2.7",
@@ -106,7 +106,9 @@ export function CSSTransition(props: CSSTransitionProps) @{
106
106
  add('exit', 'done');
107
107
  onExited?.(maybeNode);
108
108
  }}
109
- >{children}</Transition>
109
+ >
110
+ {children}
111
+ </Transition>
110
112
  }
111
113
 
112
114
  export default CSSTransition;
@@ -6,12 +6,12 @@ export function ReplaceTransition(props: ReplaceTransitionProps) @{
6
6
  const [first, second] = Children.toArray(props.children) as ElementDescriptor[];
7
7
  if (!first || !second) throw new Error('"children" must be exactly two transition components.');
8
8
 
9
- const lifecycle = (child: ElementDescriptor, name: keyof TransitionCallbacks) => (
10
- ...args: unknown[]
11
- ) => {
12
- (child.props[name] as ((...values: unknown[]) => void) | undefined)?.(...args);
13
- (props[name] as ((...values: unknown[]) => void) | undefined)?.(undefined);
14
- };
9
+ const lifecycle =
10
+ (child: ElementDescriptor, name: keyof TransitionCallbacks) =>
11
+ (...args: unknown[]) => {
12
+ (child.props[name] as ((...values: unknown[]) => void) | undefined)?.(...args);
13
+ (props[name] as ((...values: unknown[]) => void) | undefined)?.(undefined);
14
+ };
15
15
  const {
16
16
  children: _children,
17
17
  in: inProp,
@@ -23,20 +23,19 @@ export function ReplaceTransition(props: ReplaceTransitionProps) @{
23
23
  onExited: _onExited,
24
24
  ...groupProps
25
25
  } = props;
26
- const selected =
27
- inProp
28
- ? cloneElement(first, {
29
- key: 'first',
30
- onEnter: lifecycle(first, 'onEnter'),
31
- onEntering: lifecycle(first, 'onEntering'),
32
- onEntered: lifecycle(first, 'onEntered'),
33
- })
34
- : cloneElement(second, {
35
- key: 'second',
36
- onEnter: lifecycle(second, 'onExit'),
37
- onEntering: lifecycle(second, 'onExiting'),
38
- onEntered: lifecycle(second, 'onExited'),
39
- });
26
+ const selected = inProp
27
+ ? cloneElement(first, {
28
+ key: 'first',
29
+ onEnter: lifecycle(first, 'onEnter'),
30
+ onEntering: lifecycle(first, 'onEntering'),
31
+ onEntered: lifecycle(first, 'onEntered'),
32
+ })
33
+ : cloneElement(second, {
34
+ key: 'second',
35
+ onEnter: lifecycle(second, 'onExit'),
36
+ onEntering: lifecycle(second, 'onExiting'),
37
+ onEntered: lifecycle(second, 'onExited'),
38
+ });
40
39
 
41
40
  <TransitionGroup {...groupProps} children={[selected]} />
42
41
  }
@@ -97,9 +97,9 @@ export function SwitchTransition(props: SwitchTransitionProps) @{
97
97
  }
98
98
  }
99
99
 
100
- <TransitionGroupContext
101
- value={{ isMounting: !appeared.current }}
102
- >{output}</TransitionGroupContext>
100
+ <TransitionGroupContext value={{ isMounting: !appeared.current }}>
101
+ {output}
102
+ </TransitionGroupContext>
103
103
  }
104
104
 
105
105
  export default SwitchTransition;
@@ -51,12 +51,12 @@ function TransitionImpl(props: TransitionProps) @{
51
51
  const group = useContext(TransitionGroupContext);
52
52
  const latestProps = useRef(props);
53
53
  latestProps.current = props;
54
- const initial = useRef<
55
- { status: TransitionStatus; appearStatus: TransitionStatus | null } | null
56
- >(null);
54
+ const initial = useRef<{
55
+ status: TransitionStatus;
56
+ appearStatus: TransitionStatus | null;
57
+ } | null>(null);
57
58
  if (initial.current === null) {
58
- const appearing =
59
- group && !group.isMounting ? props.enter !== false : props.appear === true;
59
+ const appearing = group && !group.isMounting ? props.enter !== false : props.appear === true;
60
60
  if (props.in) {
61
61
  initial.current = appearing
62
62
  ? { status: EXITED, appearStatus: ENTERING }
@@ -105,10 +105,8 @@ function TransitionImpl(props: TransitionProps) @{
105
105
  }
106
106
  if (live.addEndListener) {
107
107
  if (live.nodeRef) (live.addEndListener as (done: () => void) => void)(finish);
108
- else if (node) (live.addEndListener as (node: Element, done: () => void) => void)(
109
- node,
110
- finish,
111
- );
108
+ else if (node)
109
+ (live.addEndListener as (node: Element, done: () => void) => void)(node, finish);
112
110
  }
113
111
  if (active && timeout !== undefined) timer.current = setTimeout(finish, timeout);
114
112
  else if (active && (!live.addEndListener || !node)) timer.current = setTimeout(finish, 0);
@@ -138,7 +136,7 @@ function TransitionImpl(props: TransitionProps) @{
138
136
  cancelPending();
139
137
  const appearing = group ? group.isMounting : mounting;
140
138
  const node = props.nodeRef?.current ?? undefined;
141
- if (!mounting && props.enter === false || config.disabled) {
139
+ if ((!mounting && props.enter === false) || config.disabled) {
142
140
  commitStatus(ENTERED, function afterEntered() {
143
141
  const live = latestProps.current;
144
142
  callEnterCallback(live.onEntered, live.nodeRef, node, appearing);
@@ -248,11 +246,12 @@ function TransitionImpl(props: TransitionProps) @{
248
246
  nodeRef: _nodeRef,
249
247
  ...childProps
250
248
  } = props;
251
- rendered = typeof children === 'function' && !isChildrenBlock(children)
252
- ? children(status, childProps)
253
- : isChildrenBlock(children)
254
- ? children
255
- : cloneElement(Children.only(children) as ElementDescriptor, childProps);
249
+ rendered =
250
+ typeof children === 'function' && !isChildrenBlock(children)
251
+ ? children(status, childProps)
252
+ : isChildrenBlock(children)
253
+ ? children
254
+ : cloneElement(Children.only(children) as ElementDescriptor, childProps);
256
255
  }
257
256
 
258
257
  <TransitionGroupContext value={null}>{rendered}</TransitionGroupContext>