@flemo/react 1.12.7 → 2.0.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,12 @@
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.
18
+
19
+ Transitions compile to CSS `@keyframes` and run on the compositor. Shared-element morphs,
20
+ swipe back, and the screen lifecycle are parts of that one engine rather than separate
21
+ integrations.
19
22
 
20
23
  ## Install
21
24
 
@@ -23,15 +26,80 @@ framework-agnostic core lives in `@flemo/core`).
23
26
  pnpm add @flemo/react
24
27
  ```
25
28
 
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.
29
+ `@flemo/react` needs `react ^19` and `react-dom ^19`, and nothing else. Shared-element
30
+ morphs are included, so no animation library sits beside it. `@flemo/core` comes along as a
31
+ regular dependency.
32
+
33
+ ## Example
34
+
35
+ ```tsx
36
+ import { Route, Router, Screen, useNavigate } from "@flemo/react";
37
+
38
+ function Home() {
39
+ const navigate = useNavigate();
40
+
41
+ return (
42
+ <Screen>
43
+ <h1>Home</h1>
44
+ <button onClick={() => navigate.push("/posts/:slug", { slug: "hello" })}>Open hello</button>
45
+ </Screen>
46
+ );
47
+ }
48
+
49
+ export default function App() {
50
+ return (
51
+ <Router>
52
+ <Route path="/" element={<Home />} />
53
+ <Route path="/posts/:slug" element={<Post />} />
54
+ </Router>
55
+ );
56
+ }
57
+ ```
58
+
59
+ Augment `RegisterRoute` once and TypeScript checks every path and params object:
60
+
61
+ ```ts
62
+ declare module "@flemo/react" {
63
+ interface RegisterRoute {
64
+ "/": undefined;
65
+ "/posts/:slug": { slug: string };
66
+ }
67
+ }
68
+ ```
69
+
70
+ Browser Back, `navigate.pop()`, and a drag from the left edge each pop the pushed screen.
71
+
72
+ ## What ships in this package
73
+
74
+ `Router` and `Route` own the stack. `Screen` is the unit that moves, and it takes the shared
75
+ top and bottom bars that hand over between screens. `Morph` pairs one element across two
76
+ screens by `layoutId` so it travels instead of appearing. `Part` runs a named transition on a
77
+ single element inside a screen. `Layer` renders an overlay beside the screen so a sheet can
78
+ cover the shared bars while the screen moves. The `useNavigate`, `useScreen`, `useParams`,
79
+ `usePathname`, and `useStep` hooks read and drive all of it.
80
+
81
+ ## Packages
82
+
83
+ | Package | Published | What it is |
84
+ | ----------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
+ | `@flemo/react` | yes | The React binding. Install this one. |
86
+ | `@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. |
87
+ | `@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. |
88
+
89
+ Svelte and SolidJS bindings are planned. There is no `flemo` meta package.
29
90
 
30
91
  ## Documentation
31
92
 
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).
93
+ [flemo.dev](https://flemo.dev) carries the full guide in English and Korean: getting started,
94
+ transitions, shared-element morphs, gestures, and the API reference. The live playground is at
95
+ [flemo.dev/playground](https://flemo.dev/playground).
96
+
97
+ ## Contributing
98
+
99
+ The source lives at [github.com/kimjh96/flemo](https://github.com/kimjh96/flemo), a pnpm and
100
+ Turborepo monorepo. `pnpm turbo run typecheck lint test build` from the repository root is the
101
+ gate every change passes before it lands, and `AGENTS.md` holds the working rules: the layout,
102
+ where each kind of change belongs, and how releases are cut with Changesets.
35
103
 
36
104
  ## License
37
105
 
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';