@ahnseungchan/webviewkit 2.0.0 → 2.2.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 +13 -9
- package/dist/index.d.mts +37 -7
- package/dist/index.d.ts +37 -7
- package/dist/index.js +500 -128
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +486 -110
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,8 +48,8 @@ export default function App() {
|
|
|
48
48
|
|
|
49
49
|
| 상황 | 동작 |
|
|
50
50
|
|------|------|
|
|
51
|
-
| `push(path)` |
|
|
52
|
-
| 같은 path 다시 push | 새 인스턴스가 쌓인다. 기존 페이지로 가려면 `popTo(path)` |
|
|
51
|
+
| `push(path)` | 새 엔트리를 쌓는다. 단 `keepAlive` 페이지의 캐시본이 같은 path 로 있으면 그 인스턴스를 되살린다. 전환 중이면 무시(`false`) |
|
|
52
|
+
| 같은 path 다시 push | 새 인스턴스가 쌓인다. 기존 페이지로 가려면 `popTo(path)`. 단 `keepAlive` 페이지는 캐시된 인스턴스가 되살아난다 |
|
|
53
53
|
| 브라우저·하드웨어 back | popstate 로 스택 pop (URL·화면 항상 일치) |
|
|
54
54
|
| 루트에서 `back()` | history 를 건드리지 않고 `onBackAtRoot()` |
|
|
55
55
|
| 미등록 path | URL 변경 없음, dev 경고 + `onNotFound(path)` |
|
|
@@ -62,12 +62,14 @@ export default function App() {
|
|
|
62
62
|
| prop | 기본 | 설명 |
|
|
63
63
|
|------|------|------|
|
|
64
64
|
| `initialActivity` | — | 루트 페이지. 마운트 시 1회만 읽음 |
|
|
65
|
-
| `Activities` | `[]` | `{ path, element }[]`. path 에 `:param` 사용
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
65
|
+
| `Activities` | `[]` | `{ path, element, keepAlive? }[]`. path 에 `:param` 사용 가능. `keepAlive: true` 면 pop 뒤에도 마운트 유지(스크롤·입력·state 보존), 같은 path(pathname+search) push 시 되살림. replace·reset 은 되살리지 않고 대상 path 의 캐시본을 버림 |
|
|
66
|
+
| `keepAliveLimit` | `5` (`KEEP_ALIVE_LIMIT`) | 캐시할 keepAlive 페이지 최대 개수(스택 위 keepAlive 페이지 포함). `0` 이면 끔(`keepAlive` 라우트도 일반 페이지처럼 동작). 마운트 시 1회만 읽음 |
|
|
67
|
+
| `maxMountedPages` | 무제한 | 동시 마운트 페이지 상한(1 미만은 1, 유한한 수가 아니면 무제한). 스택 안·캐시된 keepAlive 페이지는 상한과 무관하게 언마운트하지 않으므로 keepAlive 페이지가 많으면 상한보다 많이 마운트될 수 있다(`keepAliveLimit` 으로 제한). 전환 중 페이지도 마운트하되, 언마운트돼 있던 페이지는 퇴장 슬라이드를 위해 다시 마운트하지 않는다. 그 외는 back 시 새로 마운트. 15개 초과 시 dev 경고 |
|
|
68
|
+
| `transition` | `"slide"` | `"slide"`(iOS 네이티브 스택: 패럴랙스·dim·가장자리 그림자) · `"fade"` · `"none"` |
|
|
69
|
+
| `duration` | `500` | 전환 ms |
|
|
68
70
|
| `restoreStack` | `"with-root"` | 딥링크 복원 정책 |
|
|
69
71
|
| `onBackAtRoot` / `onNotFound` | — | 콜백 |
|
|
70
|
-
| `isShowHeader` | `false` | `StackHeader`
|
|
72
|
+
| `isShowHeader` | `false` | 각 페이지 상단에 `StackHeader` 렌더. 헤더가 페이지와 함께 슬라이드되고, 스크롤 시 상단 고정(sticky) |
|
|
71
73
|
| `safeArea` | `false` | `env(safe-area-inset-*)` padding |
|
|
72
74
|
| `maxWidth` | `"600px"` | 본문 최대 폭 |
|
|
73
75
|
| `enableDevTools` | dev 에서 true | 스택 로드맵 오버레이 |
|
|
@@ -77,11 +79,13 @@ export default function App() {
|
|
|
77
79
|
|
|
78
80
|
| hook | 반환 |
|
|
79
81
|
|------|------|
|
|
80
|
-
| `useStackRouter()` | `push`, `replace`, `reset`, `back`, `pop(n)`, `popTo(path)`, `canGoBack`, `depth`, `currentPath`, `currentState`, `entries`, `isTransitioning` |
|
|
81
|
-
| `
|
|
82
|
+
| `useStackRouter()` | `push`, `replace`, `reset`, `resetPush`, `back`, `pop(n)`, `popTo(path)`, `canGoBack`, `depth`, `currentPath`, `currentState`, `entries`, `isTransitioning` |
|
|
83
|
+
| `useStackRouter().resetPush(path, data?)` | 루트만 남기고 `path` 를 push (스택 `[루트, path]`, push 슬라이드). 결제 완료 → 결과 화면처럼 중간 단계를 지울 때 |
|
|
84
|
+
| `useActivity()` | 현재 페이지의 `{ key, path, pattern, params, query, data, index, isTop, isCached, revision }`. `index` 는 스택 위치(0 = 루트, 캐시 중이면 `-1`). `isCached` 는 keepAlive 로 숨겨진 상태. `revision` 은 인스턴스가 새 `data` 로 재사용된 횟수 |
|
|
85
|
+
| `useOnRevive(callback)` | 기존 인스턴스가 새 `data` 로 재사용될 때마다 `callback(data)` 1회 호출: 캐시된 페이지가 되살아날 때, `resetPush` 가 스택 안 keepAlive 인스턴스를 재사용할 때. 최초 마운트에는 호출 안 함. 새 `data` 로 화면을 갱신할 때 |
|
|
82
86
|
| `useParams()` | `params` |
|
|
83
87
|
|
|
84
|
-
테마는 CSS 변수로 바꿉니다: `--wvk-page-bg`, `--wvk-header-bg`, `--wvk-header-border`, `--wvk-header-color`, `--wvk-back-color`.
|
|
88
|
+
테마는 CSS 변수로 바꿉니다: `--wvk-page-bg`, `--wvk-dim-color`, `--wvk-edge-shadow`, `--wvk-header-bg`, `--wvk-header-border`, `--wvk-header-color`, `--wvk-back-color`.
|
|
85
89
|
|
|
86
90
|
## Native Bridge
|
|
87
91
|
|
package/dist/index.d.mts
CHANGED
|
@@ -266,12 +266,17 @@ type WebViewBridgeProviderProps = {
|
|
|
266
266
|
*/
|
|
267
267
|
declare function WebViewBridgeProvider({ children, stack, transport, enableOutboundBridge, hostOptions, }: WebViewBridgeProviderProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
268
268
|
|
|
269
|
-
/**
|
|
270
|
-
|
|
269
|
+
/**
|
|
270
|
+
* push/back 전환 기본 시간 (ms). iOS 네비게이션 전환 체감에 맞춘 값.
|
|
271
|
+
* `StackRouterProvider` `duration` 으로 조정
|
|
272
|
+
*/
|
|
273
|
+
declare const STACK_TRANSITION_MS = 500;
|
|
271
274
|
/** `history.back()` 이 popstate 를 기다리는 최대 시간 */
|
|
272
275
|
declare const BACK_TIMEOUT_MS = 1000;
|
|
273
276
|
/** 브릿지 요청 응답 기본 타임아웃 */
|
|
274
277
|
declare const BRIDGE_TIMEOUT_MS = 5000;
|
|
278
|
+
/** keepAlive 페이지 기본 최대 보관 수 (스택 안 keepAlive 포함) */
|
|
279
|
+
declare const KEEP_ALIVE_LIMIT = 5;
|
|
275
280
|
|
|
276
281
|
interface StackBridgeSyncOptions {
|
|
277
282
|
allowUrl?: AllowUrl;
|
|
@@ -284,6 +289,8 @@ interface Activity {
|
|
|
284
289
|
/** 정적 경로 또는 동적 세그먼트 패턴 (`/detail/:id`) */
|
|
285
290
|
path: string;
|
|
286
291
|
element: React.ReactNode;
|
|
292
|
+
/** true 면 스택에서 빠져도 인스턴스(state)를 보관했다가 같은 path 로 돌아오면 되살린다 */
|
|
293
|
+
keepAlive?: boolean;
|
|
287
294
|
}
|
|
288
295
|
type StackTransitionType = "slide" | "fade" | "none";
|
|
289
296
|
type RestoreStackPolicy = "with-root" | "top-only";
|
|
@@ -291,7 +298,7 @@ interface StackRouterProviderProps {
|
|
|
291
298
|
initialActivity: Activity;
|
|
292
299
|
Activities?: Activity[];
|
|
293
300
|
maxWidth?: string;
|
|
294
|
-
/** true면 상단에 `StackHeader` 렌더 */
|
|
301
|
+
/** true면 각 페이지 상단에 `StackHeader` 렌더 (페이지와 함께 전환) */
|
|
295
302
|
isShowHeader?: boolean;
|
|
296
303
|
/** 개발 시 스택 로드맵 오버레이 (기본: NODE_ENV === "development") */
|
|
297
304
|
enableDevTools?: boolean;
|
|
@@ -300,6 +307,10 @@ interface StackRouterProviderProps {
|
|
|
300
307
|
duration?: number;
|
|
301
308
|
/** 새로고침·딥링크 진입 시 스택 복원 정책 (기본 "with-root") */
|
|
302
309
|
restoreStack?: RestoreStackPolicy;
|
|
310
|
+
/** keepAlive 페이지 최대 보관 수 (기본 KEEP_ALIVE_LIMIT, 0 이면 보관 안 함) */
|
|
311
|
+
keepAliveLimit?: number;
|
|
312
|
+
/** 스택 top 에서부터 children 을 마운트할 최대 페이지 수 (기본 제한 없음, 1 미만은 1) */
|
|
313
|
+
maxMountedPages?: number;
|
|
303
314
|
/** env(safe-area-inset-*) padding 적용 */
|
|
304
315
|
safeArea?: boolean;
|
|
305
316
|
/** 루트에서 back 했을 때 (앱 종료·WebView 닫기 위임) */
|
|
@@ -376,9 +387,13 @@ interface BackRouterProps {
|
|
|
376
387
|
declare const BackRouter: ({ label }: BackRouterProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
377
388
|
|
|
378
389
|
interface StackHeaderProps {
|
|
379
|
-
/** 기본:
|
|
390
|
+
/** 기본: 이 헤더가 속한 페이지의 path */
|
|
380
391
|
title?: React.ReactNode;
|
|
381
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* 페이지 안에 있으면 그 페이지 기준(제목·back 버튼)으로 그려 페이지와 함께 전환된다.
|
|
395
|
+
* 페이지 밖이면 현재 top 기준.
|
|
396
|
+
*/
|
|
382
397
|
declare const Header: ({ title }: StackHeaderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
383
398
|
|
|
384
399
|
interface ActivityContextValue {
|
|
@@ -388,14 +403,23 @@ interface ActivityContextValue {
|
|
|
388
403
|
params: Record<string, string>;
|
|
389
404
|
query: Record<string, string>;
|
|
390
405
|
data?: unknown;
|
|
391
|
-
/** 스택 내 위치 (0 = root) */
|
|
406
|
+
/** 스택 내 위치 (0 = root). 퇴장 중이면 빠지기 전 위치, 보관 중이면 -1 */
|
|
392
407
|
index: number;
|
|
393
408
|
isTop: boolean;
|
|
409
|
+
/** keepAlive 로 보관 중인 페이지 (스택에서는 빠졌지만 마운트 유지) */
|
|
410
|
+
isCached: boolean;
|
|
411
|
+
/** 이 인스턴스가 새 data 로 재사용(보관본 되살리기·resetPush 재사용)된 횟수 */
|
|
412
|
+
revision: number;
|
|
394
413
|
}
|
|
395
414
|
/** 현재 페이지(Activity) 자신의 path·params·query·data */
|
|
396
415
|
declare function useActivity(): ActivityContextValue;
|
|
397
416
|
/** `/detail/:id` → `{ id }` */
|
|
398
417
|
declare function useParams<TParams extends Record<string, string> = Record<string, string>>(): TParams;
|
|
418
|
+
/**
|
|
419
|
+
* 이 페이지 인스턴스가 새 data 로 재사용될 때마다 1회 호출: 보관본이 되살아날 때,
|
|
420
|
+
* resetPush 가 스택 안 인스턴스를 재사용할 때. 첫 마운트에는 호출하지 않는다
|
|
421
|
+
*/
|
|
422
|
+
declare function useOnRevive(callback: (data: unknown) => void): void;
|
|
399
423
|
|
|
400
424
|
interface PathMatch {
|
|
401
425
|
params: Record<string, string>;
|
|
@@ -422,6 +446,10 @@ interface StackEntry {
|
|
|
422
446
|
params: Record<string, string>;
|
|
423
447
|
query: Record<string, string>;
|
|
424
448
|
data?: unknown;
|
|
449
|
+
/** true 면 스택에서 빠져도 보관 목록(cached)에 남긴다 */
|
|
450
|
+
keepAlive?: boolean;
|
|
451
|
+
/** 기존 인스턴스를 새 data 로 재사용(REVIVE·RESET_PUSH)할 때마다 1씩 오른다. 없으면 0 */
|
|
452
|
+
revision?: number;
|
|
425
453
|
}
|
|
426
454
|
|
|
427
455
|
interface StackRouterContextValue {
|
|
@@ -439,6 +467,8 @@ interface StackRouterContextValue {
|
|
|
439
467
|
push: (path: string, data?: unknown) => boolean;
|
|
440
468
|
replace: (path: string, data?: unknown) => boolean;
|
|
441
469
|
reset: (path: string, data?: unknown) => boolean;
|
|
470
|
+
/** 루트만 남기고 path 를 push 한다 (스택: [루트, path]) */
|
|
471
|
+
resetPush: (path: string, data?: unknown) => boolean;
|
|
442
472
|
back: () => boolean;
|
|
443
473
|
pop: (count?: number) => boolean;
|
|
444
474
|
popTo: (path: string) => boolean;
|
|
@@ -446,6 +476,6 @@ interface StackRouterContextValue {
|
|
|
446
476
|
forward: () => void;
|
|
447
477
|
}
|
|
448
478
|
declare const useStackRouter: () => StackRouterContextValue;
|
|
449
|
-
declare const StackRouterProvider: ({ initialActivity, Activities, maxWidth, isShowHeader, enableDevTools, transition, duration, restoreStack, safeArea, onBackAtRoot, onNotFound, bridge, }: StackRouterProviderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
479
|
+
declare const StackRouterProvider: ({ initialActivity, Activities, maxWidth, isShowHeader, enableDevTools, transition, duration, restoreStack, keepAliveLimit, maxMountedPages, safeArea, onBackAtRoot, onNotFound, bridge, }: StackRouterProviderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
450
480
|
|
|
451
|
-
export { type Activity, type ActivityContextValue, type AllowUrl, BACK_REQUEST_METHOD, BACK_TIMEOUT_MS, BRIDGE_ERROR_CODES, BRIDGE_NAMESPACE, BRIDGE_PROTOCOL_VERSION, BRIDGE_RESPONSE_METHOD, BRIDGE_TIMEOUT_MS, type BackRequestResult, BackRouter, type BridgeEnvelope, BridgeError, type BridgeErrorBody, type BridgeErrorCode, type BridgeHostCleanup, type BridgeHostKind, type BridgeRequestOptions, type BridgeResult, type BridgeTransport, type BridgeTransportOptions, type CreateStackRouterBridgeOptions, Direction, type DirectionType, FLUTTER_LEGACY_STACK_HANDLERS, FLUTTER_READY_EVENT, FLUTTER_UNIFIED_HANDLER, type FlutterInAppWebViewBridge, HistoryAction, type HistoryListener, type HistoryState, type InstallBridgeHostOptions, RN_BRIDGE_HANDLER, type RestoreStackPolicy, STACK_BRIDGE_METHODS, STACK_TRANSITION_MS, type StackBridgeMethod, type StackBridgeSyncOptions, type StackChangedPayload, StackDevRoadmap, type StackEntry, Header as StackHeader, type StackMeta, type StackPushPayload, type StackReplacePayload, type StackResetPayload, type StackRouterBridge, type StackRouterContextValue, type StackRouterHostHandlers, StackRouterProvider, type StackRouterProviderProps, type StackTransitionType, type VisiblePage, type WaitForBridgeHostOptions, WebViewBridgeClient, type WebViewBridgeClientOptions, WebViewBridgeProvider, type WebViewBridgeProviderProps, assertStackUrl, createBridgeEnvelope, createBridgeId, createBridgeResponse, createBridgeTransport, createStackRouterBridge, createWebViewBridgeClient, detectBridgeHost, emitBridgeEnvelope, findActivity, getStackRouterBridge, handleBridgeMessage, history, installBridgeHost, installStackRouterBridge, isBridgeEnvelope, isNativeBridgeHost, isSafeStackUrl, matchPath, parseBridgeMessage, parseQuery, resetStackRouterBridgeCache, serializeBridgeMessage, toStackPath, useActivity, useParams, useStackRouter, waitForBridgeHost };
|
|
481
|
+
export { type Activity, type ActivityContextValue, type AllowUrl, BACK_REQUEST_METHOD, BACK_TIMEOUT_MS, BRIDGE_ERROR_CODES, BRIDGE_NAMESPACE, BRIDGE_PROTOCOL_VERSION, BRIDGE_RESPONSE_METHOD, BRIDGE_TIMEOUT_MS, type BackRequestResult, BackRouter, type BridgeEnvelope, BridgeError, type BridgeErrorBody, type BridgeErrorCode, type BridgeHostCleanup, type BridgeHostKind, type BridgeRequestOptions, type BridgeResult, type BridgeTransport, type BridgeTransportOptions, type CreateStackRouterBridgeOptions, Direction, type DirectionType, FLUTTER_LEGACY_STACK_HANDLERS, FLUTTER_READY_EVENT, FLUTTER_UNIFIED_HANDLER, type FlutterInAppWebViewBridge, HistoryAction, type HistoryListener, type HistoryState, type InstallBridgeHostOptions, KEEP_ALIVE_LIMIT, RN_BRIDGE_HANDLER, type RestoreStackPolicy, STACK_BRIDGE_METHODS, STACK_TRANSITION_MS, type StackBridgeMethod, type StackBridgeSyncOptions, type StackChangedPayload, StackDevRoadmap, type StackEntry, Header as StackHeader, type StackMeta, type StackPushPayload, type StackReplacePayload, type StackResetPayload, type StackRouterBridge, type StackRouterContextValue, type StackRouterHostHandlers, StackRouterProvider, type StackRouterProviderProps, type StackTransitionType, type VisiblePage, type WaitForBridgeHostOptions, WebViewBridgeClient, type WebViewBridgeClientOptions, WebViewBridgeProvider, type WebViewBridgeProviderProps, assertStackUrl, createBridgeEnvelope, createBridgeId, createBridgeResponse, createBridgeTransport, createStackRouterBridge, createWebViewBridgeClient, detectBridgeHost, emitBridgeEnvelope, findActivity, getStackRouterBridge, handleBridgeMessage, history, installBridgeHost, installStackRouterBridge, isBridgeEnvelope, isNativeBridgeHost, isSafeStackUrl, matchPath, parseBridgeMessage, parseQuery, resetStackRouterBridgeCache, serializeBridgeMessage, toStackPath, useActivity, useOnRevive, useParams, useStackRouter, waitForBridgeHost };
|
package/dist/index.d.ts
CHANGED
|
@@ -266,12 +266,17 @@ type WebViewBridgeProviderProps = {
|
|
|
266
266
|
*/
|
|
267
267
|
declare function WebViewBridgeProvider({ children, stack, transport, enableOutboundBridge, hostOptions, }: WebViewBridgeProviderProps): _emotion_react_jsx_runtime.JSX.Element;
|
|
268
268
|
|
|
269
|
-
/**
|
|
270
|
-
|
|
269
|
+
/**
|
|
270
|
+
* push/back 전환 기본 시간 (ms). iOS 네비게이션 전환 체감에 맞춘 값.
|
|
271
|
+
* `StackRouterProvider` `duration` 으로 조정
|
|
272
|
+
*/
|
|
273
|
+
declare const STACK_TRANSITION_MS = 500;
|
|
271
274
|
/** `history.back()` 이 popstate 를 기다리는 최대 시간 */
|
|
272
275
|
declare const BACK_TIMEOUT_MS = 1000;
|
|
273
276
|
/** 브릿지 요청 응답 기본 타임아웃 */
|
|
274
277
|
declare const BRIDGE_TIMEOUT_MS = 5000;
|
|
278
|
+
/** keepAlive 페이지 기본 최대 보관 수 (스택 안 keepAlive 포함) */
|
|
279
|
+
declare const KEEP_ALIVE_LIMIT = 5;
|
|
275
280
|
|
|
276
281
|
interface StackBridgeSyncOptions {
|
|
277
282
|
allowUrl?: AllowUrl;
|
|
@@ -284,6 +289,8 @@ interface Activity {
|
|
|
284
289
|
/** 정적 경로 또는 동적 세그먼트 패턴 (`/detail/:id`) */
|
|
285
290
|
path: string;
|
|
286
291
|
element: React.ReactNode;
|
|
292
|
+
/** true 면 스택에서 빠져도 인스턴스(state)를 보관했다가 같은 path 로 돌아오면 되살린다 */
|
|
293
|
+
keepAlive?: boolean;
|
|
287
294
|
}
|
|
288
295
|
type StackTransitionType = "slide" | "fade" | "none";
|
|
289
296
|
type RestoreStackPolicy = "with-root" | "top-only";
|
|
@@ -291,7 +298,7 @@ interface StackRouterProviderProps {
|
|
|
291
298
|
initialActivity: Activity;
|
|
292
299
|
Activities?: Activity[];
|
|
293
300
|
maxWidth?: string;
|
|
294
|
-
/** true면 상단에 `StackHeader` 렌더 */
|
|
301
|
+
/** true면 각 페이지 상단에 `StackHeader` 렌더 (페이지와 함께 전환) */
|
|
295
302
|
isShowHeader?: boolean;
|
|
296
303
|
/** 개발 시 스택 로드맵 오버레이 (기본: NODE_ENV === "development") */
|
|
297
304
|
enableDevTools?: boolean;
|
|
@@ -300,6 +307,10 @@ interface StackRouterProviderProps {
|
|
|
300
307
|
duration?: number;
|
|
301
308
|
/** 새로고침·딥링크 진입 시 스택 복원 정책 (기본 "with-root") */
|
|
302
309
|
restoreStack?: RestoreStackPolicy;
|
|
310
|
+
/** keepAlive 페이지 최대 보관 수 (기본 KEEP_ALIVE_LIMIT, 0 이면 보관 안 함) */
|
|
311
|
+
keepAliveLimit?: number;
|
|
312
|
+
/** 스택 top 에서부터 children 을 마운트할 최대 페이지 수 (기본 제한 없음, 1 미만은 1) */
|
|
313
|
+
maxMountedPages?: number;
|
|
303
314
|
/** env(safe-area-inset-*) padding 적용 */
|
|
304
315
|
safeArea?: boolean;
|
|
305
316
|
/** 루트에서 back 했을 때 (앱 종료·WebView 닫기 위임) */
|
|
@@ -376,9 +387,13 @@ interface BackRouterProps {
|
|
|
376
387
|
declare const BackRouter: ({ label }: BackRouterProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
377
388
|
|
|
378
389
|
interface StackHeaderProps {
|
|
379
|
-
/** 기본:
|
|
390
|
+
/** 기본: 이 헤더가 속한 페이지의 path */
|
|
380
391
|
title?: React.ReactNode;
|
|
381
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* 페이지 안에 있으면 그 페이지 기준(제목·back 버튼)으로 그려 페이지와 함께 전환된다.
|
|
395
|
+
* 페이지 밖이면 현재 top 기준.
|
|
396
|
+
*/
|
|
382
397
|
declare const Header: ({ title }: StackHeaderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
383
398
|
|
|
384
399
|
interface ActivityContextValue {
|
|
@@ -388,14 +403,23 @@ interface ActivityContextValue {
|
|
|
388
403
|
params: Record<string, string>;
|
|
389
404
|
query: Record<string, string>;
|
|
390
405
|
data?: unknown;
|
|
391
|
-
/** 스택 내 위치 (0 = root) */
|
|
406
|
+
/** 스택 내 위치 (0 = root). 퇴장 중이면 빠지기 전 위치, 보관 중이면 -1 */
|
|
392
407
|
index: number;
|
|
393
408
|
isTop: boolean;
|
|
409
|
+
/** keepAlive 로 보관 중인 페이지 (스택에서는 빠졌지만 마운트 유지) */
|
|
410
|
+
isCached: boolean;
|
|
411
|
+
/** 이 인스턴스가 새 data 로 재사용(보관본 되살리기·resetPush 재사용)된 횟수 */
|
|
412
|
+
revision: number;
|
|
394
413
|
}
|
|
395
414
|
/** 현재 페이지(Activity) 자신의 path·params·query·data */
|
|
396
415
|
declare function useActivity(): ActivityContextValue;
|
|
397
416
|
/** `/detail/:id` → `{ id }` */
|
|
398
417
|
declare function useParams<TParams extends Record<string, string> = Record<string, string>>(): TParams;
|
|
418
|
+
/**
|
|
419
|
+
* 이 페이지 인스턴스가 새 data 로 재사용될 때마다 1회 호출: 보관본이 되살아날 때,
|
|
420
|
+
* resetPush 가 스택 안 인스턴스를 재사용할 때. 첫 마운트에는 호출하지 않는다
|
|
421
|
+
*/
|
|
422
|
+
declare function useOnRevive(callback: (data: unknown) => void): void;
|
|
399
423
|
|
|
400
424
|
interface PathMatch {
|
|
401
425
|
params: Record<string, string>;
|
|
@@ -422,6 +446,10 @@ interface StackEntry {
|
|
|
422
446
|
params: Record<string, string>;
|
|
423
447
|
query: Record<string, string>;
|
|
424
448
|
data?: unknown;
|
|
449
|
+
/** true 면 스택에서 빠져도 보관 목록(cached)에 남긴다 */
|
|
450
|
+
keepAlive?: boolean;
|
|
451
|
+
/** 기존 인스턴스를 새 data 로 재사용(REVIVE·RESET_PUSH)할 때마다 1씩 오른다. 없으면 0 */
|
|
452
|
+
revision?: number;
|
|
425
453
|
}
|
|
426
454
|
|
|
427
455
|
interface StackRouterContextValue {
|
|
@@ -439,6 +467,8 @@ interface StackRouterContextValue {
|
|
|
439
467
|
push: (path: string, data?: unknown) => boolean;
|
|
440
468
|
replace: (path: string, data?: unknown) => boolean;
|
|
441
469
|
reset: (path: string, data?: unknown) => boolean;
|
|
470
|
+
/** 루트만 남기고 path 를 push 한다 (스택: [루트, path]) */
|
|
471
|
+
resetPush: (path: string, data?: unknown) => boolean;
|
|
442
472
|
back: () => boolean;
|
|
443
473
|
pop: (count?: number) => boolean;
|
|
444
474
|
popTo: (path: string) => boolean;
|
|
@@ -446,6 +476,6 @@ interface StackRouterContextValue {
|
|
|
446
476
|
forward: () => void;
|
|
447
477
|
}
|
|
448
478
|
declare const useStackRouter: () => StackRouterContextValue;
|
|
449
|
-
declare const StackRouterProvider: ({ initialActivity, Activities, maxWidth, isShowHeader, enableDevTools, transition, duration, restoreStack, safeArea, onBackAtRoot, onNotFound, bridge, }: StackRouterProviderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
479
|
+
declare const StackRouterProvider: ({ initialActivity, Activities, maxWidth, isShowHeader, enableDevTools, transition, duration, restoreStack, keepAliveLimit, maxMountedPages, safeArea, onBackAtRoot, onNotFound, bridge, }: StackRouterProviderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
450
480
|
|
|
451
|
-
export { type Activity, type ActivityContextValue, type AllowUrl, BACK_REQUEST_METHOD, BACK_TIMEOUT_MS, BRIDGE_ERROR_CODES, BRIDGE_NAMESPACE, BRIDGE_PROTOCOL_VERSION, BRIDGE_RESPONSE_METHOD, BRIDGE_TIMEOUT_MS, type BackRequestResult, BackRouter, type BridgeEnvelope, BridgeError, type BridgeErrorBody, type BridgeErrorCode, type BridgeHostCleanup, type BridgeHostKind, type BridgeRequestOptions, type BridgeResult, type BridgeTransport, type BridgeTransportOptions, type CreateStackRouterBridgeOptions, Direction, type DirectionType, FLUTTER_LEGACY_STACK_HANDLERS, FLUTTER_READY_EVENT, FLUTTER_UNIFIED_HANDLER, type FlutterInAppWebViewBridge, HistoryAction, type HistoryListener, type HistoryState, type InstallBridgeHostOptions, RN_BRIDGE_HANDLER, type RestoreStackPolicy, STACK_BRIDGE_METHODS, STACK_TRANSITION_MS, type StackBridgeMethod, type StackBridgeSyncOptions, type StackChangedPayload, StackDevRoadmap, type StackEntry, Header as StackHeader, type StackMeta, type StackPushPayload, type StackReplacePayload, type StackResetPayload, type StackRouterBridge, type StackRouterContextValue, type StackRouterHostHandlers, StackRouterProvider, type StackRouterProviderProps, type StackTransitionType, type VisiblePage, type WaitForBridgeHostOptions, WebViewBridgeClient, type WebViewBridgeClientOptions, WebViewBridgeProvider, type WebViewBridgeProviderProps, assertStackUrl, createBridgeEnvelope, createBridgeId, createBridgeResponse, createBridgeTransport, createStackRouterBridge, createWebViewBridgeClient, detectBridgeHost, emitBridgeEnvelope, findActivity, getStackRouterBridge, handleBridgeMessage, history, installBridgeHost, installStackRouterBridge, isBridgeEnvelope, isNativeBridgeHost, isSafeStackUrl, matchPath, parseBridgeMessage, parseQuery, resetStackRouterBridgeCache, serializeBridgeMessage, toStackPath, useActivity, useParams, useStackRouter, waitForBridgeHost };
|
|
481
|
+
export { type Activity, type ActivityContextValue, type AllowUrl, BACK_REQUEST_METHOD, BACK_TIMEOUT_MS, BRIDGE_ERROR_CODES, BRIDGE_NAMESPACE, BRIDGE_PROTOCOL_VERSION, BRIDGE_RESPONSE_METHOD, BRIDGE_TIMEOUT_MS, type BackRequestResult, BackRouter, type BridgeEnvelope, BridgeError, type BridgeErrorBody, type BridgeErrorCode, type BridgeHostCleanup, type BridgeHostKind, type BridgeRequestOptions, type BridgeResult, type BridgeTransport, type BridgeTransportOptions, type CreateStackRouterBridgeOptions, Direction, type DirectionType, FLUTTER_LEGACY_STACK_HANDLERS, FLUTTER_READY_EVENT, FLUTTER_UNIFIED_HANDLER, type FlutterInAppWebViewBridge, HistoryAction, type HistoryListener, type HistoryState, type InstallBridgeHostOptions, KEEP_ALIVE_LIMIT, RN_BRIDGE_HANDLER, type RestoreStackPolicy, STACK_BRIDGE_METHODS, STACK_TRANSITION_MS, type StackBridgeMethod, type StackBridgeSyncOptions, type StackChangedPayload, StackDevRoadmap, type StackEntry, Header as StackHeader, type StackMeta, type StackPushPayload, type StackReplacePayload, type StackResetPayload, type StackRouterBridge, type StackRouterContextValue, type StackRouterHostHandlers, StackRouterProvider, type StackRouterProviderProps, type StackTransitionType, type VisiblePage, type WaitForBridgeHostOptions, WebViewBridgeClient, type WebViewBridgeClientOptions, WebViewBridgeProvider, type WebViewBridgeProviderProps, assertStackUrl, createBridgeEnvelope, createBridgeId, createBridgeResponse, createBridgeTransport, createStackRouterBridge, createWebViewBridgeClient, detectBridgeHost, emitBridgeEnvelope, findActivity, getStackRouterBridge, handleBridgeMessage, history, installBridgeHost, installStackRouterBridge, isBridgeEnvelope, isNativeBridgeHost, isSafeStackUrl, matchPath, parseBridgeMessage, parseQuery, resetStackRouterBridgeCache, serializeBridgeMessage, toStackPath, useActivity, useOnRevive, useParams, useStackRouter, waitForBridgeHost };
|