Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/quiet-spoons-wink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@stackflow/plugin-basic-ui": patch
"@stackflow/react-ui-core": patch
---

Support Core 1.x from 1.1.0-canary.0 and Stackflow React 1.x from 1.3.2-canary.0 in Basic UI and its React UI Core dependency, while retaining Core 2.x/3.x and Stackflow React 2.x support.

Use the legacy global navigation hook on Stackflow React 1.x so AppScreen, AppBar, Modal, and BottomSheet can pop activities on both supported React integration versions.
4 changes: 2 additions & 2 deletions extensions/plugin-basic-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"typescript": "^5.5.3"
},
"peerDependencies": {
"@stackflow/core": "^2.0.0 || ^3.0.0",
"@stackflow/react": "^2.0.0",
"@stackflow/core": "^1.1.0-canary.0 || ^2.0.0 || ^3.0.0",
"@stackflow/react": "^1.3.2-canary.0 || ^2.0.0",
"@types/react": ">=16.8.0",
"react": ">=16.8.0"
},
Expand Down
6 changes: 3 additions & 3 deletions extensions/plugin-basic-ui/src/components/AppBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFlow } from "@stackflow/react";
import {
useActivityDataAttributes,
useAppBarTitleMaxWidth,
Expand All @@ -12,6 +11,7 @@ import { IconBack, IconClose } from "../assets";
import { useGlobalOptions } from "../basicUIPlugin";
import type { GlobalVars } from "../basicUIPlugin.css";
import { globalVars } from "../basicUIPlugin.css";
import { usePop } from "../usePop";
import { compactMap } from "../utils";
import * as css from "./AppBar.css";
import * as appScreenCss from "./AppScreen.css";
Expand Down Expand Up @@ -108,7 +108,7 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
},
ref,
) => {
const actions = useFlow();
const pop = usePop();
const activity = useNullableActivity();
const activityDataAttributes = useActivityDataAttributes();

Expand Down Expand Up @@ -139,7 +139,7 @@ const AppBar = forwardRef<HTMLDivElement, AppBarProps>(
}

if (!e.defaultPrevented) {
actions.pop();
pop();
}
};

Expand Down
4 changes: 2 additions & 2 deletions extensions/plugin-basic-ui/src/components/AppScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFlow, useStack } from "@stackflow/react";
import {
useActivityDataAttributes,
useLazy,
Expand All @@ -16,6 +15,7 @@ import { createContext, useContext, useMemo, useRef } from "react";
import { useGlobalOptions } from "../basicUIPlugin";
import type { GlobalVars } from "../basicUIPlugin.css";
import { globalVars } from "../basicUIPlugin.css";
import { usePop } from "../usePop";
import type { PropOf } from "../utils";
import { compactMap } from "../utils";
import AppBar from "./AppBar";
Expand Down Expand Up @@ -68,7 +68,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
const activityDataAttributes = useActivityDataAttributes();
const mounted = useMounted();

const { pop } = useFlow();
const pop = usePop();

const appScreenRef = useRef<HTMLDivElement>(null);
const dimRef = useRef<HTMLDivElement>(null);
Expand Down
4 changes: 2 additions & 2 deletions extensions/plugin-basic-ui/src/components/BottomSheet.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFlow } from "@stackflow/react";
import {
useLazy,
useNullableActivity,
Expand All @@ -11,6 +10,7 @@ import clsx from "clsx";
import { useRef } from "react";
import type { GlobalVars } from "../basicUIPlugin.css";
import { globalVars } from "../basicUIPlugin.css";
import { usePop } from "../usePop";
import { compactMap } from "../utils";
import * as css from "./BottomSheet.css";

Expand All @@ -34,7 +34,7 @@ const BottomSheet: React.FC<BottomSheetProps> = ({
className,
}) => {
const activity = useNullableActivity();
const { pop } = useFlow();
const pop = usePop();

const containerRef = useRef<HTMLDivElement>(null);
const dimRef = useRef<HTMLDivElement>(null);
Expand Down
4 changes: 2 additions & 2 deletions extensions/plugin-basic-ui/src/components/Modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useFlow } from "@stackflow/react";
import {
useLazy,
useNullableActivity,
Expand All @@ -11,6 +10,7 @@ import clsx from "clsx";
import { useRef } from "react";
import type { GlobalVars } from "../basicUIPlugin.css";
import { globalVars } from "../basicUIPlugin.css";
import { usePop } from "../usePop";
import { compactMap } from "../utils";
import * as css from "./Modal.css";

Expand All @@ -33,7 +33,7 @@ const Modal: React.FC<ModalProps> = ({
className,
}) => {
const activity = useNullableActivity();
const { pop } = useFlow();
const pop = usePop();

const containerRef = useRef<HTMLDivElement>(null);
const paperRef = useRef<HTMLDivElement>(null);
Expand Down
16 changes: 16 additions & 0 deletions extensions/plugin-basic-ui/src/usePop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as StackflowReact from "@stackflow/react";

type NavigationHook = () => {
pop(): void;
};

const navigationHooks = StackflowReact as unknown as {
useFlow?: NavigationHook;
useActions: NavigationHook;
};

// Stackflow React 1.x exposes the global navigation hook as useActions.
export function usePop() {
const useNavigation = navigationHooks.useFlow ?? navigationHooks.useActions;
return useNavigation().pop;
}
4 changes: 2 additions & 2 deletions extensions/react-ui-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"typescript": "^5.5.3"
},
"peerDependencies": {
"@stackflow/core": "^2.0.0 || ^3.0.0",
"@stackflow/react": "^2.0.0",
"@stackflow/core": "^1.1.0-canary.0 || ^2.0.0 || ^3.0.0",
"@stackflow/react": "^1.3.2-canary.0 || ^2.0.0",
"@types/react": ">=16.8.0",
"react": ">=16.8.0"
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5799,8 +5799,8 @@ __metadata:
rimraf: "npm:^3.0.2"
typescript: "npm:^5.5.3"
peerDependencies:
"@stackflow/core": ^2.0.0 || ^3.0.0
"@stackflow/react": ^2.0.0
"@stackflow/core": ^1.1.0-canary.0 || ^2.0.0 || ^3.0.0
"@stackflow/react": ^1.3.2-canary.0 || ^2.0.0
"@types/react": ">=16.8.0"
react: ">=16.8.0"
languageName: unknown
Expand Down Expand Up @@ -6062,8 +6062,8 @@ __metadata:
rimraf: "npm:^3.0.2"
typescript: "npm:^5.5.3"
peerDependencies:
"@stackflow/core": ^2.0.0 || ^3.0.0
"@stackflow/react": ^2.0.0
"@stackflow/core": ^1.1.0-canary.0 || ^2.0.0 || ^3.0.0
"@stackflow/react": ^1.3.2-canary.0 || ^2.0.0
"@types/react": ">=16.8.0"
react: ">=16.8.0"
languageName: unknown
Expand Down
Loading