akanjs 3.3.0-rc.43 → 3.3.0-rc.44
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/package.json +1 -1
- package/types/ui/recipe/badgeRecipe.d.ts +2 -2
- package/types/ui/recipe/buttonRecipe.d.ts +2 -2
- package/types/ui/recipe/inputRecipe.d.ts +2 -2
- package/types/webkit/csrSlide.d.ts +3 -1
- package/types/webkit/useCsrRefs.d.ts +1 -1
- package/webkit/csrSlide.ts +15 -1
- package/webkit/useCsrNavigation.ts +3 -0
- package/webkit/useCsrTransitions.ts +2 -2
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
export declare const badgeRecipe: (variants?: Omit<({
|
|
3
3
|
size?: "lg" | "md" | "sm" | "xs" | undefined;
|
|
4
4
|
outline?: boolean | undefined;
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "error" | "info" | "warning" | "success" | "primary" | "outline" | "secondary" | "accent" | "neutral" | undefined;
|
|
6
6
|
} & {
|
|
7
7
|
class?: import("tailwind-variants/lite").ClassValue;
|
|
8
8
|
className?: never;
|
|
9
9
|
}) | ({
|
|
10
10
|
size?: "lg" | "md" | "sm" | "xs" | undefined;
|
|
11
11
|
outline?: boolean | undefined;
|
|
12
|
-
variant?: "
|
|
12
|
+
variant?: "default" | "error" | "info" | "warning" | "success" | "primary" | "outline" | "secondary" | "accent" | "neutral" | undefined;
|
|
13
13
|
} & {
|
|
14
14
|
class?: never;
|
|
15
15
|
className?: import("tailwind-variants/lite").ClassValue;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const buttonRecipe: (variants?: Omit<({
|
|
3
3
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | "icon" | undefined;
|
|
4
4
|
outline?: boolean | undefined;
|
|
5
|
-
variant?: "
|
|
5
|
+
variant?: "default" | "link" | "info" | "warning" | "success" | "destructive" | "primary" | "outline" | "secondary" | "accent" | "neutral" | "ghost" | undefined;
|
|
6
6
|
shape?: "default" | "circle" | "square" | undefined;
|
|
7
7
|
} & {
|
|
8
8
|
class?: import("tailwind-variants/lite").ClassValue;
|
|
@@ -10,7 +10,7 @@ export declare const buttonRecipe: (variants?: Omit<({
|
|
|
10
10
|
}) | ({
|
|
11
11
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | "icon" | undefined;
|
|
12
12
|
outline?: boolean | undefined;
|
|
13
|
-
variant?: "
|
|
13
|
+
variant?: "default" | "link" | "info" | "warning" | "success" | "destructive" | "primary" | "outline" | "secondary" | "accent" | "neutral" | "ghost" | undefined;
|
|
14
14
|
shape?: "default" | "circle" | "square" | undefined;
|
|
15
15
|
} & {
|
|
16
16
|
class?: never;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
export declare const inputRecipe: (variants?: Omit<({
|
|
3
3
|
kind?: "field" | "select" | "area" | undefined;
|
|
4
4
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | undefined;
|
|
5
|
-
tone?: "
|
|
5
|
+
tone?: "default" | "error" | "primary" | undefined;
|
|
6
6
|
} & {
|
|
7
7
|
class?: import("tailwind-variants/lite").ClassValue;
|
|
8
8
|
className?: never;
|
|
9
9
|
}) | ({
|
|
10
10
|
kind?: "field" | "select" | "area" | undefined;
|
|
11
11
|
size?: "xl" | "lg" | "md" | "sm" | "xs" | undefined;
|
|
12
|
-
tone?: "
|
|
12
|
+
tone?: "default" | "error" | "primary" | undefined;
|
|
13
13
|
} & {
|
|
14
14
|
class?: never;
|
|
15
15
|
className?: import("tailwind-variants/lite").ClassValue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PathRoute } from "akanjs/client";
|
|
1
|
+
import type { Location, PathRoute } from "akanjs/client";
|
|
2
2
|
type FramePageState = PathRoute["pageState"];
|
|
3
3
|
type Keyframe = Record<string, string>;
|
|
4
4
|
export interface CsrSlideFrame {
|
|
@@ -19,6 +19,8 @@ export declare class CsrSlide {
|
|
|
19
19
|
private constructor();
|
|
20
20
|
static get supported(): boolean;
|
|
21
21
|
static get isCalm(): boolean;
|
|
22
|
+
static holdStill(kind: "push" | "replace", from: Location, to: Location): boolean;
|
|
23
|
+
static isStill(entryId: string | undefined): boolean;
|
|
22
24
|
static play(frame: CsrSlideFrame, { fromUnit, toUnit, duration, keep }: CsrSlidePlay): CsrSlide | null;
|
|
23
25
|
/** What each part's style is with the page `unit` px from its place: 0 shown, the frame's width gone right. */
|
|
24
26
|
static partsAt({ width, height, pageState, prevPageState }: CsrSlideFrame, unit: number): Record<string, Keyframe>;
|
|
@@ -17,8 +17,8 @@ export declare const useCsrRefs: () => {
|
|
|
17
17
|
pageContentRef: import("react").RefObject<HTMLDivElement | null>;
|
|
18
18
|
prevPageContentRef: import("react").RefObject<HTMLDivElement | null>;
|
|
19
19
|
onBack: import("react").RefObject<{
|
|
20
|
-
stack?: (() => Promise<void>) | undefined;
|
|
21
20
|
none?: (() => Promise<void>) | undefined;
|
|
21
|
+
stack?: (() => Promise<void>) | undefined;
|
|
22
22
|
fade?: (() => Promise<void>) | undefined;
|
|
23
23
|
bottomUp?: (() => Promise<void>) | undefined;
|
|
24
24
|
scaleOut?: (() => Promise<void>) | undefined;
|
package/webkit/csrSlide.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import type { PathRoute } from "akanjs/client";
|
|
2
|
+
import type { Location, PathRoute } from "akanjs/client";
|
|
3
3
|
|
|
4
4
|
type FramePageState = PathRoute["pageState"];
|
|
5
5
|
type Keyframe = Record<string, string>;
|
|
@@ -43,6 +43,20 @@ export class CsrSlide {
|
|
|
43
43
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
static #stillEntryId: string | null = null;
|
|
47
|
+
|
|
48
|
+
static holdStill(kind: "push" | "replace", from: Location, to: Location) {
|
|
49
|
+
const isStill =
|
|
50
|
+
kind === "replace" &&
|
|
51
|
+
from.pathRoute.pageState.transition === "none" &&
|
|
52
|
+
to.pathRoute.pageState.transition !== "none";
|
|
53
|
+
CsrSlide.#stillEntryId = isStill ? (to.entryId ?? null) : null;
|
|
54
|
+
return isStill;
|
|
55
|
+
}
|
|
56
|
+
static isStill(entryId: string | undefined) {
|
|
57
|
+
return !!entryId && entryId === CsrSlide.#stillEntryId;
|
|
58
|
+
}
|
|
59
|
+
|
|
46
60
|
static play(frame: CsrSlideFrame, { fromUnit, toUnit, duration, keep = false }: CsrSlidePlay): CsrSlide | null {
|
|
47
61
|
if (!CsrSlide.supported || duration <= 0) return null;
|
|
48
62
|
const from = CsrSlide.partsAt(frame, fromUnit);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
import { useCallback } from "react";
|
|
12
12
|
import { CsrStack } from "./CsrStack";
|
|
13
13
|
import { CsrPageReadiness } from "./csrPageReadiness";
|
|
14
|
+
import { CsrSlide } from "./csrSlide";
|
|
14
15
|
import type { CsrKeyboard } from "./useCsrKeyboard";
|
|
15
16
|
import type { CsrLocationState } from "./useCsrLocationState";
|
|
16
17
|
import { type CsrRefs, currentRouter } from "./useCsrRefs";
|
|
@@ -257,7 +258,9 @@ export const useCsrNavigation = (input: CsrNavigationInput) => {
|
|
|
257
258
|
? cached
|
|
258
259
|
: target;
|
|
259
260
|
const scrollTop = pageContentRef.current?.scrollTop ?? 0;
|
|
261
|
+
const isStill = CsrSlide.holdStill(kind, fromLocation, toLocation);
|
|
260
262
|
const slides =
|
|
263
|
+
!isStill &&
|
|
261
264
|
CsrStack.keyOf(toLocation) !== CsrStack.keyOf(fromLocation) &&
|
|
262
265
|
shouldPrepareFrameTransition(href) &&
|
|
263
266
|
toLocation.pathRoute.pageState.transition !== "none";
|
|
@@ -162,7 +162,7 @@ const usePlayOnForward = (
|
|
|
162
162
|
) => {
|
|
163
163
|
|
|
164
164
|
useLayoutEffect(() => {
|
|
165
|
-
if (history.current.type === "forward") {
|
|
165
|
+
if (history.current.type === "forward" && !CsrSlide.isStill(location.entryId)) {
|
|
166
166
|
void transUnit.start(transUnitRange[0], { immediate: true });
|
|
167
167
|
void transUnit.start(transUnitRange[1], { config });
|
|
168
168
|
} else void transUnit.start(transUnitRange[1], { immediate: true });
|
|
@@ -409,7 +409,7 @@ const useStackSlide = (
|
|
|
409
409
|
cancelSlide();
|
|
410
410
|
|
|
411
411
|
const isStack = frameRef.current.pageState.transition === "stack";
|
|
412
|
-
if (history.current.type !== "forward" || CsrSlide.isCalm || !isStack) {
|
|
412
|
+
if (history.current.type !== "forward" || CsrSlide.isCalm || !isStack || CsrSlide.isStill(location.entryId)) {
|
|
413
413
|
void transUnit.start(transUnitRange[1], { immediate: true });
|
|
414
414
|
return;
|
|
415
415
|
}
|