Skip to content

Commit c0b23e9

Browse files
authored
Merge branch 'main' into lazy-activity
2 parents fe404be + 8ee8c8f commit c0b23e9

13 files changed

Lines changed: 69 additions & 42 deletions

File tree

‎.changeset/rude-schools-brush.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/plugin-basic-ui": patch
3+
---
4+
5+
Fix a bug that entrance transition is not applied.

‎.github/workflows/opencode.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
2224

2325
- name: Run opencode
2426
uses: sst/opencode/github@latest

‎docs/pages/docs/advanced/preloading.en.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export type TypeActivities = typeof activities;
5555
Afterwards, within each activity, you can retrieve the `preloadRef` value using the `useActivityPreloadRef()` hook.
5656

5757
```tsx showLineNumbers filename="MyActivity.ts" copy
58-
import { ActivityComponentType } from "@stackflow/react";
58+
import type { ActivityComponentType } from "@stackflow/react";
5959
import { useActivityPreloadRef } from "@stackflow/plugin-preload";
6060

6161
const MyActivity: ActivityComponentType = () => {
@@ -82,7 +82,7 @@ export const { usePreloader } = createPreloader<TypeActivities>();
8282
```
8383

8484
```tsx showLineNumbers filename="MyActivity.ts" copy
85-
import { ActivityComponentType } from "@stackflow/react";
85+
import type { ActivityComponentType } from "@stackflow/react";
8686
import { usePreloader } from "./usePreloader";
8787

8888
const MyActivity: = () => {

‎docs/pages/docs/advanced/preloading.ko.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export type TypeActivities = typeof activities;
5555
이후 각 액티비티 내에서 `useActivityPreloadRef()` 훅을 통해 해당 `preloadRef` 값을 가져올 수 있어요.
5656

5757
```tsx showLineNumbers filename="MyActivity.ts" copy
58-
import { ActivityComponentType } from "@stackflow/react";
58+
import type { ActivityComponentType } from "@stackflow/react";
5959
import { useActivityPreloadRef } from "@stackflow/plugin-preload";
6060

6161
const MyActivity: ActivityComponentType = () => {
@@ -82,7 +82,7 @@ export const { usePreloader } = createPreloader<TypeActivities>();
8282
```
8383

8484
```tsx showLineNumbers filename="MyActivity.ts" copy
85-
import { ActivityComponentType } from "@stackflow/react";
85+
import type { ActivityComponentType } from "@stackflow/react";
8686
import { usePreloader } from "./usePreloader";
8787

8888
const MyActivity: = () => {

‎docs/pages/docs/get-started/activity.en.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { APITable } from "../../../components/APITable";
2121
To actually use an activity, you need to register it with the `stackflow()` function before using it. An activity is a React component declared with the type `ActivityComponentType`.
2222

2323
```tsx showLineNumbers filename="MyActivity.tsx" copy
24-
import { ActivityComponentType } from "@stackflow/react";
24+
import type { ActivityComponentType } from "@stackflow/react";
2525
import { AppScreen } from "@stackflow/plugin-basic-ui";
2626

2727
const MyActivity: ActivityComponentType = () => {
@@ -101,7 +101,7 @@ If you have successfully registered the initial activity, you can see the render
101101
Some activities require specific parameters when used. In such cases, declare the parameter as the activity's Props.
102102

103103
```tsx showLineNumbers filename="Article.tsx" copy
104-
import { ActivityComponentType } from "@stackflow/react";
104+
import type { ActivityComponentType } from "@stackflow/react";
105105
import { AppScreen } from "@stackflow/plugin-basic-ui";
106106

107107
type ArticleParams = {

‎docs/pages/docs/get-started/activity.ko.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { APITable } from "../../../components/APITable";
2121
액티비티를 실제로 사용하기 위해서는 사용하기 전 `stackflow()` 함수에 등록이 필요해요. 액티비티는 `ActivityComponentType`이라는 타입으로 선언되는 리액트 컴포넌트에요.
2222

2323
```tsx showLineNumbers filename="MyActivity.tsx" copy
24-
import { ActivityComponentType } from "@stackflow/react";
24+
import type { ActivityComponentType } from "@stackflow/react";
2525
import { AppScreen } from "@stackflow/plugin-basic-ui";
2626

2727
const MyActivity: ActivityComponentType = () => {
@@ -105,7 +105,7 @@ export const { Stack, useFlow } = stackflow({
105105
해당 액티비티가 사용될 때, 특정 파라미터가 필요한 경우가 있어요. 이런 경우 다음과 같이 액티비티의 Props로 해당 파라미터를 선언해요.
106106

107107
```tsx showLineNumbers filename="Article.tsx" copy
108-
import { ActivityComponentType } from "@stackflow/react";
108+
import type { ActivityComponentType } from "@stackflow/react";
109109
import { AppScreen } from "@stackflow/plugin-basic-ui";
110110

111111
type ArticleParams = {

‎docs/pages/docs/get-started/getting-state.en.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The activities accessible through the `activities` field contain information rel
1818
To access the stack state in a UI component, use the `useStack()` hook.
1919

2020
```tsx showLineNumbers filename="MyActivity.tsx" copy
21-
import { ActivityComponentType, useStack } from "@stackflow/react";
21+
import { useStack, type ActivityComponentType } from "@stackflow/react";
2222
import { AppScreen } from "@stackflow/plugin-basic-ui";
2323
import { useFlow } from "./stackflow";
2424

@@ -69,7 +69,7 @@ There are the following fields in the stack state.
6969
You can use the `useActivity()` hook to get information about the current activity.
7070

7171
```tsx showLineNumbers filename="MyActivity.tsx" copy
72-
import { ActivityComponentType, useActivity } from "@stackflow/react";
72+
import { useActivity, type ActivityComponentType } from "@stackflow/react";
7373
import { AppScreen } from "@stackflow/plugin-basic-ui";
7474
import { useFlow } from "./stackflow";
7575

‎docs/pages/docs/get-started/getting-state.ko.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { APITable } from "../../../components/APITable";
1818
스택 상태를 UI 컴포넌트에서 가져오려면, `useStack()` 훅을 활용해요.
1919

2020
```tsx showLineNumbers filename="MyActivity.tsx" copy
21-
import { ActivityComponentType, useStack } from "@stackflow/react";
21+
import { useStack, type ActivityComponentType } from "@stackflow/react";
2222
import { AppScreen } from "@stackflow/plugin-basic-ui";
2323
import { useFlow } from "./stackflow";
2424

@@ -69,7 +69,7 @@ export default MyActivity;
6969
현재 액티비티의 정보를 가져오기 위해 `useActivity()` 훅을 사용할 수 있어요.
7070

7171
```tsx showLineNumbers filename="MyActivity.tsx" copy
72-
import { ActivityComponentType, useActivity } from "@stackflow/react";
72+
import { useActivity, type ActivityComponentType } from "@stackflow/react";
7373
import { AppScreen } from "@stackflow/plugin-basic-ui";
7474
import { useFlow } from "./stackflow";
7575

‎docs/pages/docs/get-started/navigating-activities.en.mdx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ If you have successfully registered an activity, it's time to navigate between a
1414
We use the `useFlow()` hook created in `stackflow.ts`. Through the `push()` function within this hook, we can stack a new activity as follows.
1515

1616
```tsx showLineNumbers filename="MyActivity.tsx" copy /push/
17-
import { ActivityComponentType } from "@stackflow/react";
17+
import type { ActivityComponentType } from "@stackflow/react";
1818
import { AppScreen } from "@stackflow/plugin-basic-ui";
1919
import { useFlow } from "./stackflow";
2020

@@ -76,7 +76,7 @@ The third parameter of the `push()` function, additional options, includes the f
7676
Next, let's look at how to replace the current activity without adding a new activity to the stack. Using the `replace()` function from the `useFlow()` hook created in `stackflow.ts`, you can replace the current activity as follows.
7777

7878
```tsx showLineNumbers filename="MyActivity.tsx" copy /replace/
79-
import { ActivityComponentType } from "@stackflow/react";
79+
import type { ActivityComponentType } from "@stackflow/react";
8080
import { AppScreen } from "@stackflow/plugin-basic-ui";
8181
import { useFlow } from "./stackflow";
8282

@@ -134,7 +134,7 @@ The third parameter of the `replace()` function, additional options, includes th
134134
Finally, let's look at how to delete the current activity and return to the previous activity. Using the `pop()` function from the `useFlow()` hook created in `stackflow.ts`, you can delete the current activity as follows.
135135

136136
```tsx showLineNumbers filename="Article.tsx" copy /pop/
137-
import { ActivityComponentType } from "@stackflow/react";
137+
import type { ActivityComponentType } from "@stackflow/react";
138138
import { AppScreen } from "@stackflow/plugin-basic-ui";
139139
import { useFlow } from "./stackflow";
140140

@@ -169,23 +169,23 @@ const Article: ActivityComponentType<ArticleParams> = ({ params }) => {
169169
export default Article;
170170
```
171171

172-
`pop()` takes optional parameters for the number of stacks to pop and additional options. These parameters can be omitted, and default values will be used.
172+
`pop()` takes optional parameters for the number of activities to pop and additional options. These parameters can be omitted, and default values will be used.
173173

174174
```ts
175-
pop(); // pop a single stack
175+
pop(); // pop a single activity
176176

177-
pop(3); // pop multiple stacks
177+
pop(3); // pop multiple activities
178178

179179
pop({
180180
/* additional option */
181-
}); // pop a single stack with additional options
181+
}); // pop a single activity with additional options
182182

183183
pop(3, {
184184
/* additional option */
185-
}); // pop multiple stacks with additional options
185+
}); // pop multiple activities with additional options
186186
```
187187

188-
The first parameter of the pop() function can specify the number of stacks to pop or define additional options. If the first parameter is used for the number of stacks, the second parameter can then be used to provide additional options.
188+
The first parameter of the pop() function can specify the number of activities to pop or define additional options. If the first parameter is used for the number of activities, the second parameter can then be used to provide additional options.
189189

190190
The additional options include the following values.
191191

‎docs/pages/docs/get-started/navigating-activities.ko.mdx‎

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { APITable } from "../../../components/APITable";
1414
`stackflow.ts`에서 생성했던 `useFlow()` 훅을 사용해요. 해당 훅 내에 `push()` 함수를 통해 다음과 같이 새 액티비티를 쌓을 수 있어요.
1515

1616
```tsx filename="MyActivity.tsx" copy
17-
import { ActivityComponentType } from "@stackflow/react";
17+
import type { ActivityComponentType } from "@stackflow/react";
1818
import { AppScreen } from "@stackflow/plugin-basic-ui";
1919
import { useFlow } from "./stackflow";
2020

@@ -78,7 +78,7 @@ push(
7878
다음으로 스택에 새로운 액티비티를 추가하지 않고 현재 액티비티를 교체하는 방법에 대해서 살펴봐요. `stackflow.ts`에서 생성했던 `useFlow()` 훅의 `replace()` 함수를 통해 다음과 같이 현재 액티비티를 교체할 수 있어요.
7979

8080
```tsx filename="MyActivity.tsx" copy
81-
import { ActivityComponentType } from "@stackflow/react";
81+
import type { ActivityComponentType } from "@stackflow/react";
8282
import { AppScreen } from "@stackflow/plugin-basic-ui";
8383
import { useFlow } from "./stackflow";
8484

@@ -135,11 +135,9 @@ replace(
135135

136136
마지막으로 현재 액티비티를 삭제하고 이전 액티비티로 돌아가는 방법에 대해서 살펴봐요. `stackflow.ts`에서 생성했던 `useFlow()` 훅의 `pop()` 함수를 통해 다음과 같이 현재 액티비티를 삭제할 수 있어요.
137137

138-
```tsx
139-
/**
140-
* Article.tsx
141-
*/
142-
import { ActivityComponentType } from "@stackflow/react";
138+
139+
```tsx showLineNumbers filename="Article.tsx" copy /pop/
140+
import type { ActivityComponentType } from "@stackflow/react";
143141
import { AppScreen } from "@stackflow/plugin-basic-ui";
144142
import { useFlow } from "./stackflow";
145143

@@ -150,15 +148,22 @@ type ArticleParams = {
150148
const Article: ActivityComponentType<ArticleParams> = ({ params }) => {
151149
const { pop } = useFlow();
152150

153-
const onClick = () => {
151+
const goBack = () => {
152+
// 액티비티 하나만 제거
154153
pop();
155154
};
156155

156+
const goBackMultiple = () => {
157+
// 액티비티 여러 개 제거
158+
pop(3);
159+
};
160+
157161
return (
158162
<AppScreen appBar={{ title: "Article" }}>
159163
<div>
160164
<h1>{params.title}</h1>
161-
<button onClick={onClick}>back</button>
165+
<button onClick={goBack}>Back</button>
166+
<button onClick={goBackMultiple}>Back 3 Steps</button>
162167
</div>
163168
</AppScreen>
164169
);
@@ -167,15 +172,21 @@ const Article: ActivityComponentType<ArticleParams> = ({ params }) => {
167172
export default Article;
168173
```
169174

170-
`pop()`은 첫번째 파라미터로 추가 옵션을 받아요. 첫번째 파라미터인 추가 옵션은 선택적으로 넘기지 않을 수 있어요. (기본값을 사용해요)
175+
`pop()` 함수의 첫번째 파라미터는 제거할 액티비티의 개수를 지정하거나 추가 옵션을 정의할 수 있어요.
176+
첫번째 파라미터를 액티비티 개수로 사용하면, 두번째 매개변수는 추가 옵션을 전달하는 데 사용할 수 있어요.
171177

172178
```ts
173-
pop();
179+
pop(); // 액티비티 하나 제거
180+
181+
pop(3); // 액티비티 여러 개 제거
174182

175-
// 또는
176183
pop({
177184
/* 추가 옵션 */
178-
});
185+
}); // 추가 옵션과 함께 액티비티 하나 제거
186+
187+
pop(3, {
188+
/* 추가 옵션 */
189+
}); // 추가 옵션과 함께 액티비티 여러 개 제거
179190
```
180191

181192
`pop()` 함수의 첫번째 파라미터인 추가 옵션에는 다음과 같은 값이 있어요.
@@ -188,4 +199,4 @@ pop({
188199

189200
---
190201

191-
액티비티를 쌓고, 교체하고, 삭제하는 방법에 대해서 알아봤어요. 이제 액티비티 내의 가상의 스택을 만들 수 있는 방법에 대해 알아봐요.
202+
액티비티를 쌓고, 교체하고, 삭제하는 방법에 대해서 알아봤어요. 이제 액티비티 내의 가상의 스택을 만들 수 있는 방법에 대해 알아봐요.

0 commit comments

Comments
 (0)