@zag-js/splitter 0.1.10 → 0.1.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/splitter",
3
- "version": "0.1.10",
3
+ "version": "0.1.13",
4
4
  "description": "Core logic for the splitter widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,20 +30,21 @@
30
30
  "url": "https://github.com/chakra-ui/zag/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@zag-js/core": "0.1.8",
34
- "@zag-js/types": "0.2.2"
33
+ "@zag-js/core": "0.1.10",
34
+ "@zag-js/types": "0.2.5"
35
35
  },
36
36
  "devDependencies": {
37
- "@zag-js/dom-utils": "0.1.7",
38
- "@zag-js/number-utils": "0.1.2"
37
+ "@zag-js/dom-utils": "0.1.11",
38
+ "@zag-js/number-utils": "0.1.4"
39
39
  },
40
40
  "scripts": {
41
- "build:fast": "zag build",
42
- "start": "zag build --watch",
43
- "build": "zag build --prod",
41
+ "build-fast": "tsup src/index.ts --format=esm,cjs",
42
+ "start": "pnpm build --watch",
43
+ "build": "tsup src/index.ts --format=esm,cjs --dts",
44
44
  "test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
45
45
  "lint": "eslint src --ext .ts,.tsx",
46
- "test:ci": "yarn test --ci --runInBand",
47
- "test:watch": "yarn test --watch --updateSnapshot"
46
+ "test-ci": "pnpm test --ci --runInBand",
47
+ "test-watch": "pnpm test --watch -u",
48
+ "typecheck": "tsc --noEmit"
48
49
  }
49
- }
50
+ }
@@ -1,19 +0,0 @@
1
- import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
- import type { Send, State } from "./splitter.types";
3
- export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
4
- isCollapsed: boolean;
5
- isExpanded: boolean;
6
- isFocused: boolean;
7
- isDragging: boolean;
8
- value: number;
9
- collapse(): void;
10
- expand(): void;
11
- toggle(): void;
12
- setSize(size: number): void;
13
- rootProps: T["element"];
14
- secondaryPaneProps: T["element"];
15
- primaryPaneProps: T["element"];
16
- toggleButtonProps: T["element"];
17
- labelProps: T["element"];
18
- splitterProps: T["element"];
19
- };
@@ -1,28 +0,0 @@
1
- import type { MachineContext as Ctx } from "./splitter.types";
2
- export declare const dom: {
3
- getRootNode: (ctx: {
4
- getRootNode?: () => Node | Document | ShadowRoot;
5
- }) => Document | ShadowRoot;
6
- getDoc: (ctx: {
7
- getRootNode?: () => Node | Document | ShadowRoot;
8
- }) => Document;
9
- getWin: (ctx: {
10
- getRootNode?: () => Node | Document | ShadowRoot;
11
- }) => Window & typeof globalThis;
12
- getActiveElement: (ctx: {
13
- getRootNode?: () => Node | Document | ShadowRoot;
14
- }) => HTMLElement;
15
- getById: <T_1 = HTMLElement>(ctx: {
16
- getRootNode?: () => Node | Document | ShadowRoot;
17
- }, id: string) => T_1;
18
- } & {
19
- getRootId: (ctx: Ctx) => string;
20
- getSplitterId: (ctx: Ctx) => string;
21
- getToggleButtonId: (ctx: Ctx) => string;
22
- getLabelId: (ctx: Ctx) => string;
23
- getPrimaryPaneId: (ctx: Ctx) => string;
24
- getSecondaryPaneId: (ctx: Ctx) => string;
25
- getSplitterEl: (ctx: Ctx) => HTMLElement;
26
- getPrimaryPaneEl: (ctx: Ctx) => HTMLElement;
27
- getCursor(ctx: Ctx): "default" | (string & {}) | "col-resize" | "e-resize" | "n-resize" | "row-resize" | "s-resize" | "w-resize";
28
- };
@@ -1,2 +0,0 @@
1
- import type { MachineContext, MachineState, UserDefinedContext } from "./splitter.types";
2
- export declare function machine(ctx: UserDefinedContext): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;
@@ -1,94 +0,0 @@
1
- import type { StateMachine as S } from "@zag-js/core";
2
- import type { CommonProperties, Context, DirectionProperty, RequiredBy } from "@zag-js/types";
3
- declare type ElementIds = Partial<{
4
- root: string;
5
- splitter: string;
6
- label: string;
7
- toggleBtn: string;
8
- primaryPane: string;
9
- secondaryPane: string;
10
- }>;
11
- declare type PublicContext = DirectionProperty & CommonProperties & {
12
- /**
13
- * The ids of the elements in the splitter. Useful for composition.
14
- */
15
- ids?: ElementIds;
16
- /**
17
- * Whether to allow the separator to be dragged.
18
- */
19
- fixed?: boolean;
20
- /**
21
- * The orientation of the split view.
22
- */
23
- orientation: "horizontal" | "vertical";
24
- /**
25
- * The minimum size of the primary pane.
26
- */
27
- min: number;
28
- /**
29
- * The maximum size of the primary pane.
30
- */
31
- max: number;
32
- /**
33
- * The size of the primary pane.
34
- */
35
- value: number;
36
- /**
37
- * The step increments of the primary pane when it is dragged
38
- * or resized with keyboard.
39
- */
40
- step: number;
41
- /**
42
- * Callback to be invoked when the primary pane is resized.
43
- */
44
- onChange?: (details: {
45
- value: number;
46
- }) => void;
47
- /**
48
- * Callback to be invoked when the primary pane's resize session starts
49
- */
50
- onChangeStart?: (details: {
51
- value: number;
52
- }) => void;
53
- /**
54
- * Callback to be invoked when the primary pane's resize session ends
55
- */
56
- onChangeEnd?: (details: {
57
- value: number;
58
- }) => void;
59
- /**
60
- * Whether the primary pane is disabled.
61
- */
62
- disabled?: boolean;
63
- /**
64
- * The minimum offset needed to snap the primary pane to its minimum or maximum size.
65
- */
66
- snapOffset: number;
67
- };
68
- export declare type UserDefinedContext = RequiredBy<PublicContext, "id">;
69
- declare type ComputedContext = Readonly<{
70
- /**
71
- * @computed
72
- * Whether the primary pane is at its minimum size.
73
- */
74
- isAtMin: boolean;
75
- /**
76
- * @computed
77
- * Whether the primary pane is at its maximum size.
78
- */
79
- isAtMax: boolean;
80
- /**
81
- * @computed
82
- * Whether the orientation is horizontal.
83
- */
84
- isHorizontal: boolean;
85
- }>;
86
- declare type PrivateContext = Context<{}>;
87
- export declare type MachineContext = PublicContext & ComputedContext & PrivateContext;
88
- export declare type MachineState = {
89
- value: "unknown" | "idle" | "hover:temp" | "hover" | "dragging" | "focused";
90
- tags: "focus";
91
- };
92
- export declare type State = S.State<MachineContext, MachineState>;
93
- export declare type Send = S.Send<S.AnyEventObject>;
94
- export {};