@flemo/react 1.12.8 → 2.1.0

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/README.md CHANGED
@@ -13,9 +13,8 @@
13
13
  ---
14
14
 
15
15
  flemo is a router whose unit of routing is a **screen**, not a page. Push, pop, and the
16
- animations and gestures between screens are handled by flemo, so you don't need to wire a
17
- router and a motion library together yourself. `@flemo/react` is the React binding (the
18
- framework-agnostic core lives in `@flemo/core`).
16
+ animations and gestures between them belong to the router, so an app does not have to wire a
17
+ routing library and an animation library together and then keep their timing in agreement.
19
18
 
20
19
  ## Install
21
20
 
@@ -23,15 +22,80 @@ framework-agnostic core lives in `@flemo/core`).
23
22
  pnpm add @flemo/react
24
23
  ```
25
24
 
26
- `@flemo/react` pulls in `@flemo/core` (the framework-agnostic primitives) as a regular
27
- dependency. Apps that only need transition compilers or the navigation queue can install
28
- `@flemo/core` directly.
25
+ `@flemo/react` needs `react ^19` and `react-dom ^19`, and nothing else. Shared-element
26
+ morphs are included, so no animation library sits beside it. `@flemo/core` comes along as a
27
+ regular dependency.
28
+
29
+ ## Example
30
+
31
+ ```tsx
32
+ import { Route, Router, Screen, useNavigate } from "@flemo/react";
33
+
34
+ function Home() {
35
+ const navigate = useNavigate();
36
+
37
+ return (
38
+ <Screen>
39
+ <h1>Home</h1>
40
+ <button onClick={() => navigate.push("/posts/:slug", { slug: "hello" })}>Open hello</button>
41
+ </Screen>
42
+ );
43
+ }
44
+
45
+ export default function App() {
46
+ return (
47
+ <Router>
48
+ <Route path="/" element={<Home />} />
49
+ <Route path="/posts/:slug" element={<Post />} />
50
+ </Router>
51
+ );
52
+ }
53
+ ```
54
+
55
+ Augment `RegisterRoute` once and TypeScript checks every path and params object:
56
+
57
+ ```ts
58
+ declare module "@flemo/react" {
59
+ interface RegisterRoute {
60
+ "/": undefined;
61
+ "/posts/:slug": { slug: string };
62
+ }
63
+ }
64
+ ```
65
+
66
+ Browser Back, `navigate.pop()`, and a drag from the left edge each pop the pushed screen.
67
+
68
+ ## What ships in this package
69
+
70
+ `Router` and `Route` own the stack. `Screen` is the unit that moves, and it takes the shared
71
+ top and bottom bars that hand over between screens. `Morph` pairs one element across two
72
+ screens by `layoutId` so it travels instead of appearing. `Part` runs a named transition on a
73
+ single element inside a screen. `Layer` renders an overlay beside the screen so a sheet can
74
+ cover the shared bars while the screen moves. The `useNavigate`, `useScreen`, `useParams`,
75
+ `usePathname`, and `useStep` hooks read and drive all of it.
76
+
77
+ ## Packages
78
+
79
+ | Package | Published | What it is |
80
+ | ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
81
+ | `@flemo/react` | yes | The React binding. Install this one. |
82
+ | `@flemo/core` | yes | Framework-agnostic primitives: the navigation task queue, the stores, transition factories and presets, the keyframes compiler, and the morph runtime. Install it directly only to use those without React. |
83
+ | `@flemo/devtools` | yes | Zero-dependency flight recorder and visual panel. It observes the `data-flemo-*` surfaces the engine already exposes and imports neither package above, so attaching it does not change measured motion. |
84
+
85
+ Svelte and SolidJS bindings are planned. There is no `flemo` meta package.
29
86
 
30
87
  ## Documentation
31
88
 
32
- See [flemo.dev](https://flemo.dev) for the full guide: getting started,
33
- transitions, shared-element morphs, gestures, and the complete API reference. A live playground is
34
- at [flemo.dev/playground](https://flemo.dev/playground).
89
+ [flemo.dev](https://flemo.dev) carries the full guide in English and Korean: getting started,
90
+ transitions, shared-element morphs, gestures, and the API reference. The live playground is at
91
+ [flemo.dev/playground](https://flemo.dev/playground).
92
+
93
+ ## Contributing
94
+
95
+ The source lives at [github.com/kimjh96/flemo](https://github.com/kimjh96/flemo), a pnpm and
96
+ Turborepo monorepo. `pnpm turbo run typecheck lint test build` from the repository root is the
97
+ gate every change passes before it lands, and `AGENTS.md` holds the working rules: the layout,
98
+ where each kind of change belongs, and how releases are cut with Changesets.
35
99
 
36
100
  ## License
37
101
 
package/dist/Router.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CSSProperties, PropsWithChildren } from 'react';
2
- import { HistoryDriver, PartTransition, Decorator, Transition, TransitionName } from '@flemo/core';
2
+ import { HistoryDriver, MorphTransition, PartTransition, Decorator, Transition, TransitionName } from '@flemo/core';
3
3
  interface RouterProps {
4
4
  name?: string;
5
5
  strictRoutes?: boolean;
@@ -8,10 +8,11 @@ interface RouterProps {
8
8
  transitions?: Transition[];
9
9
  decorators?: Decorator[];
10
10
  partTransitions?: PartTransition[];
11
+ morphTransitions?: MorphTransition[];
11
12
  history?: "browser" | "memory";
12
13
  createDriver?: (routerKey?: string) => HistoryDriver;
13
14
  className?: string;
14
15
  style?: CSSProperties;
15
16
  }
16
- declare function Router({ children, name, strictRoutes, initPath, defaultTransitionName, transitions, decorators, partTransitions, history, createDriver, className, style }: PropsWithChildren<RouterProps>): import("react").JSX.Element;
17
+ declare function Router({ children, name, strictRoutes, initPath, defaultTransitionName, transitions, decorators, partTransitions, morphTransitions, history, createDriver, className, style }: PropsWithChildren<RouterProps>): import("react").JSX.Element;
17
18
  export default Router;
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ export { default as ScreenMotion } from './screen/ScreenMotion';
13
13
  export { default as ScreenFreeze } from './screen/ScreenFreeze';
14
14
  export { default as ScreenDecorator } from './screen/ScreenDecorator';
15
15
  export { default as Part, type PartProps } from './screen/Part';
16
+ export { default as Layer, type LayerProps } from './screen/Layer';
17
+ export { default as Morph, type MorphProps } from './screen/Morph';
16
18
  export { default as ScreenContext, type ScreenContextProps } from './screen/ScreenContext';
17
19
  export { default as useHistoryStore } from './stores/useHistoryStore';
18
20
  export { default as useNavigateStore } from './stores/useNavigateStore';
@@ -22,5 +24,5 @@ export { default as RouterScopeProvider } from './stores/RouterScopeProvider';
22
24
  export { type FlemoStores } from './stores/StoreContext';
23
25
  export { type SharedBarId, type SharedBarMetadata, type SharedBarPresence, type SharedBarsMetadata } from './screen/store';
24
26
  export { default as useViewportScrollHeight } from './screen/useViewportScrollHeight';
25
- export { createTransition, createRawTransition, createDecorator, createRawDecorator, createPartTransition, createRawPartTransition, partTransitionMap, createBrowserHistoryDriver } from '@flemo/core';
26
- export type { TransitionName, RegisterTransition, DecoratorName, RegisterDecorator, PartTransitionName, RegisterPartTransition, PartTransitionOptions, HistoryDriver, HistoryNavEvent } from '@flemo/core';
27
+ export { createTransition, createRawTransition, createDecorator, createRawDecorator, createPartTransition, createRawPartTransition, partTransitionMap, createMorphTransition, createRawMorphTransition, morphTransitionMap, createBrowserHistoryDriver } from '@flemo/core';
28
+ export type { TransitionName, RegisterTransition, DecoratorName, RegisterDecorator, PartTransitionName, RegisterPartTransition, PartTransitionOptions, MorphTransitionName, RegisterMorphTransition, MorphTransitionOptions, HistoryDriver, HistoryNavEvent } from '@flemo/core';