@zag-js/splitter 0.2.4 → 0.2.6
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/dist/chunk-7IDNY7GP.mjs +217 -0
- package/dist/chunk-A3GF7W2N.mjs +97 -0
- package/dist/chunk-DX6NGFGC.mjs +16 -0
- package/dist/chunk-F2ZDEPE3.mjs +510 -0
- package/dist/index.d.ts +7 -966
- package/dist/index.js +37 -16
- package/dist/index.mjs +10 -794
- package/dist/splitter.anatomy.d.ts +6 -0
- package/dist/splitter.anatomy.js +41 -0
- package/dist/splitter.anatomy.mjs +8 -0
- package/dist/splitter.connect.d.ts +23 -0
- package/dist/splitter.connect.js +342 -0
- package/dist/splitter.connect.mjs +8 -0
- package/dist/splitter.dom.d.ts +37 -0
- package/dist/splitter.dom.js +123 -0
- package/dist/splitter.dom.mjs +6 -0
- package/dist/splitter.machine.d.ts +7 -0
- package/dist/splitter.machine.js +624 -0
- package/dist/splitter.machine.mjs +7 -0
- package/dist/splitter.types.d.ts +96 -0
- package/dist/splitter.types.js +18 -0
- package/dist/splitter.types.mjs +0 -0
- package/package.json +22 -12
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { StateMachine } from '@zag-js/core';
|
|
2
|
+
import { RequiredBy, DirectionProperty, CommonProperties, Context } from '@zag-js/types';
|
|
3
|
+
|
|
4
|
+
type ElementIds = Partial<{
|
|
5
|
+
root: string;
|
|
6
|
+
splitter: string;
|
|
7
|
+
label: string;
|
|
8
|
+
toggleBtn: string;
|
|
9
|
+
primaryPane: string;
|
|
10
|
+
secondaryPane: string;
|
|
11
|
+
}>;
|
|
12
|
+
type PublicContext = DirectionProperty & CommonProperties & {
|
|
13
|
+
/**
|
|
14
|
+
* The ids of the elements in the splitter. Useful for composition.
|
|
15
|
+
*/
|
|
16
|
+
ids?: ElementIds;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to allow the separator to be dragged.
|
|
19
|
+
*/
|
|
20
|
+
fixed?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The orientation of the split view.
|
|
23
|
+
*/
|
|
24
|
+
orientation: "horizontal" | "vertical";
|
|
25
|
+
/**
|
|
26
|
+
* The minimum size of the primary pane.
|
|
27
|
+
*/
|
|
28
|
+
min: number;
|
|
29
|
+
/**
|
|
30
|
+
* The maximum size of the primary pane.
|
|
31
|
+
*/
|
|
32
|
+
max: number;
|
|
33
|
+
/**
|
|
34
|
+
* The size of the primary pane.
|
|
35
|
+
*/
|
|
36
|
+
value: number;
|
|
37
|
+
/**
|
|
38
|
+
* The step increments of the primary pane when it is dragged
|
|
39
|
+
* or resized with keyboard.
|
|
40
|
+
*/
|
|
41
|
+
step: number;
|
|
42
|
+
/**
|
|
43
|
+
* Callback to be invoked when the primary pane is resized.
|
|
44
|
+
*/
|
|
45
|
+
onChange?: (details: {
|
|
46
|
+
value: number;
|
|
47
|
+
}) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Callback to be invoked when the primary pane's resize session starts
|
|
50
|
+
*/
|
|
51
|
+
onChangeStart?: (details: {
|
|
52
|
+
value: number;
|
|
53
|
+
}) => void;
|
|
54
|
+
/**
|
|
55
|
+
* Callback to be invoked when the primary pane's resize session ends
|
|
56
|
+
*/
|
|
57
|
+
onChangeEnd?: (details: {
|
|
58
|
+
value: number;
|
|
59
|
+
}) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the primary pane is disabled.
|
|
62
|
+
*/
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* The minimum offset needed to snap the primary pane to its minimum or maximum size.
|
|
66
|
+
*/
|
|
67
|
+
snapOffset: number;
|
|
68
|
+
};
|
|
69
|
+
type UserDefinedContext = RequiredBy<PublicContext, "id">;
|
|
70
|
+
type ComputedContext = Readonly<{
|
|
71
|
+
/**
|
|
72
|
+
* @computed
|
|
73
|
+
* Whether the primary pane is at its minimum size.
|
|
74
|
+
*/
|
|
75
|
+
isAtMin: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* @computed
|
|
78
|
+
* Whether the primary pane is at its maximum size.
|
|
79
|
+
*/
|
|
80
|
+
isAtMax: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* @computed
|
|
83
|
+
* Whether the orientation is horizontal.
|
|
84
|
+
*/
|
|
85
|
+
isHorizontal: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
type PrivateContext = Context<{}>;
|
|
88
|
+
type MachineContext = PublicContext & ComputedContext & PrivateContext;
|
|
89
|
+
type MachineState = {
|
|
90
|
+
value: "unknown" | "idle" | "hover:temp" | "hover" | "dragging" | "focused";
|
|
91
|
+
tags: "focus";
|
|
92
|
+
};
|
|
93
|
+
type State = StateMachine.State<MachineContext, MachineState>;
|
|
94
|
+
type Send = StateMachine.Send<StateMachine.AnyEventObject>;
|
|
95
|
+
|
|
96
|
+
export { MachineContext, MachineState, Send, State, UserDefinedContext };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/splitter.types.ts
|
|
17
|
+
var splitter_types_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(splitter_types_exports);
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/splitter",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Core logic for the splitter widget implemented as a state machine",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
5
|
"keywords": [
|
|
9
6
|
"js",
|
|
10
7
|
"machine",
|
|
@@ -30,19 +27,32 @@
|
|
|
30
27
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
31
28
|
},
|
|
32
29
|
"dependencies": {
|
|
33
|
-
"@zag-js/anatomy": "0.1.
|
|
34
|
-
"@zag-js/
|
|
35
|
-
"@zag-js/
|
|
30
|
+
"@zag-js/anatomy": "0.1.3",
|
|
31
|
+
"@zag-js/types": "0.3.2",
|
|
32
|
+
"@zag-js/core": "0.2.4"
|
|
36
33
|
},
|
|
37
34
|
"devDependencies": {
|
|
38
|
-
"
|
|
39
|
-
"@zag-js/
|
|
40
|
-
"@zag-js/utils": "0.
|
|
35
|
+
"clean-package": "2.2.0",
|
|
36
|
+
"@zag-js/dom-utils": "0.2.2",
|
|
37
|
+
"@zag-js/number-utils": "0.2.2",
|
|
38
|
+
"@zag-js/utils": "0.3.2"
|
|
39
|
+
},
|
|
40
|
+
"clean-package": "../../../clean-package.config.json",
|
|
41
|
+
"main": "dist/index.js",
|
|
42
|
+
"module": "dist/index.mjs",
|
|
43
|
+
"types": "dist/index.d.ts",
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"types": "./dist/index.d.ts",
|
|
47
|
+
"import": "./dist/index.mjs",
|
|
48
|
+
"require": "./dist/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./package.json": "./package.json"
|
|
41
51
|
},
|
|
42
52
|
"scripts": {
|
|
43
|
-
"build-fast": "tsup src
|
|
53
|
+
"build-fast": "tsup src",
|
|
44
54
|
"start": "pnpm build --watch",
|
|
45
|
-
"build": "tsup src
|
|
55
|
+
"build": "tsup src --dts",
|
|
46
56
|
"test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
|
|
47
57
|
"lint": "eslint src --ext .ts,.tsx",
|
|
48
58
|
"test-ci": "pnpm test --ci --runInBand",
|