@aiquants/resize-panels 0.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 +192 -0
- package/dist/Panel.d.ts +8 -0
- package/dist/Panel.d.ts.map +1 -0
- package/dist/PanelDebugInfo.d.ts +29 -0
- package/dist/PanelDebugInfo.d.ts.map +1 -0
- package/dist/PanelGroup.d.ts +8 -0
- package/dist/PanelGroup.d.ts.map +1 -0
- package/dist/PanelResizeHandle.d.ts +8 -0
- package/dist/PanelResizeHandle.d.ts.map +1 -0
- package/dist/context.d.ts +13 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/debugOverlayStore.d.ts +62 -0
- package/dist/debugOverlayStore.d.ts.map +1 -0
- package/dist/hooks.d.ts +44 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +4824 -0
- package/dist/index.umd.js +23 -0
- package/dist/reducer.d.ts +38 -0
- package/dist/reducer.d.ts.map +1 -0
- package/dist/resize-panels.css +1 -0
- package/dist/roundHalfToEven.d.ts +10 -0
- package/dist/roundHalfToEven.d.ts.map +1 -0
- package/dist/types.d.ts +215 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils.d.ts +68 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +74 -0
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ContainerAxisMeasurement, FlexibleSize, PanelDirection, PanelLayoutData, SizeConfig, SizeUnit } from './types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Number of significant fractional digits to preserve when rounding percentage-based sizes.
|
|
5
|
+
* パーセンテージサイズの丸めで保持する有効小数桁数。
|
|
6
|
+
*/
|
|
7
|
+
export declare const PERCENTAGE_DIGITS = 6;
|
|
8
|
+
/**
|
|
9
|
+
* Convert a pixel measurement to a percentage of the container using banker’s rounding.
|
|
10
|
+
* ピクセル寸法をバンカーズラウンディングでコンテナ比率のパーセンテージへ変換する。
|
|
11
|
+
*/
|
|
12
|
+
export declare const toRoundedPercentage: (size: number, base: number) => number;
|
|
13
|
+
/**
|
|
14
|
+
* Translate a percentage-based size back into pixels relative to the container.
|
|
15
|
+
* パーセンテージ指定のサイズをコンテナ基準のピクセル値へ変換する。
|
|
16
|
+
*/
|
|
17
|
+
export declare const percentageToPixels: (percentage: number | undefined, base: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Normalize a flexible size into a size configuration object.
|
|
20
|
+
* 柔軟なサイズ指定をサイズ設定オブジェクトへ正規化する。
|
|
21
|
+
*/
|
|
22
|
+
export declare const normalizeSizeConfig: (size: FlexibleSize | undefined, defaultUnit?: SizeUnit) => SizeConfig | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Convert flexible size constraints into pixel values based on container size.
|
|
25
|
+
* 柔軟サイズ制約をコンテナサイズ基準のピクセル値へ変換する。
|
|
26
|
+
*/
|
|
27
|
+
export declare const getConstraintInPixels: (size: FlexibleSize | undefined, defaultValue: number, containerSize: number) => number;
|
|
28
|
+
/**
|
|
29
|
+
* Clamp a numeric value between the provided bounds.
|
|
30
|
+
* 数値を指定した範囲に収めるためのクリッピング処理。
|
|
31
|
+
*/
|
|
32
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
33
|
+
/**
|
|
34
|
+
* Derive a snap-to-zero threshold from the container axis length using shared heuristics.
|
|
35
|
+
* 共通ヒューリスティクスに基づきコンテナ軸長からゼロスナップ閾値を算出する。
|
|
36
|
+
*/
|
|
37
|
+
export declare const calculateSnapThreshold: (axisSize: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Adjust pixel-based panels in priority order to absorb remaining space.
|
|
40
|
+
* 残余スペースを吸収するためにピクセル基準パネルを優先度順に調整する。
|
|
41
|
+
*/
|
|
42
|
+
export declare const adjustPixelPanelsByPriority: (panels: PanelLayoutData[], sizeDiff: number, containerSize: number) => number;
|
|
43
|
+
/**
|
|
44
|
+
* Measure container size in a given direction, returning inner (borderless) and outer dimensions.
|
|
45
|
+
* 指定方向で枠線控除後と控除前の両方の寸法を測定して返す。
|
|
46
|
+
*/
|
|
47
|
+
export declare const getContainerSize: (element: HTMLElement, direction: PanelDirection) => ContainerAxisMeasurement;
|
|
48
|
+
/**
|
|
49
|
+
* Generate a panel identifier compatible with server and client rendering.
|
|
50
|
+
* サーバー・クライアント双方で利用できるパネル識別子を生成する。
|
|
51
|
+
*/
|
|
52
|
+
export declare const generatePanelId: () => string;
|
|
53
|
+
/**
|
|
54
|
+
* Generate a resize handle identifier compatible with server and client rendering.
|
|
55
|
+
* サーバー・クライアント双方で利用できるリサイズハンドル識別子を生成する。
|
|
56
|
+
*/
|
|
57
|
+
export declare const generateResizeHandleId: () => string;
|
|
58
|
+
/**
|
|
59
|
+
* Persist panel layout sizes to local storage.
|
|
60
|
+
* パネルレイアウトのサイズをローカルストレージへ保存する。
|
|
61
|
+
*/
|
|
62
|
+
export declare const saveLayout: (id: string, sizes: number[]) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Restore panel layout sizes from local storage.
|
|
65
|
+
* パネルレイアウトのサイズをローカルストレージから復元する。
|
|
66
|
+
*/
|
|
67
|
+
export declare const loadLayout: (id: string) => number[] | null;
|
|
68
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EAKjB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,QAAQ,EAChB,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,MAMhE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM,GAAG,SAAS,EAAE,MAAM,MAAM,KAAG,MAKjF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,YAAY,GAAG,SAAS,EAAE,cAAa,QAAuB,KAAG,UAAU,GAAG,SAMvH,CAAA;AAcD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,YAAY,GAAG,SAAS,EAAE,cAAc,MAAM,EAAE,eAAe,MAAM,KAAG,MASnH,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,KAAG,MAE/D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,UAAU,MAAM,KAAG,MAOzD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GAAI,QAAQ,eAAe,EAAE,EAAE,UAAU,MAAM,EAAE,eAAe,MAAM,KAAG,MA0GhH,CAAA;AAcD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,WAAW,EAAE,WAAW,cAAc,KAAG,wBAuBlF,CAAA;AAKD;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,MAMlC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAO,MAMzC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,EAAE,OAAO,MAAM,EAAE,KAAG,IAMxD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,KAAG,MAAM,EAAE,GAAG,IAQlD,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aiquants/resize-panels",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Reusable resizable panel components and utilities for React",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"resizable",
|
|
8
|
+
"panels",
|
|
9
|
+
"layout",
|
|
10
|
+
"component",
|
|
11
|
+
"ui"
|
|
12
|
+
],
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "fehde-k",
|
|
15
|
+
"url": "https://x.com/fehdek"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"main": "dist/index.umd.js",
|
|
19
|
+
"module": "dist/index.es.js",
|
|
20
|
+
"types": "dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.es.js",
|
|
25
|
+
"require": "./dist/index.umd.js"
|
|
26
|
+
},
|
|
27
|
+
"./css": "./dist/resize-panels.css"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "vite build",
|
|
35
|
+
"dev": "vite build --watch",
|
|
36
|
+
"typecheck": "tsc --noEmit",
|
|
37
|
+
"license-check": "pnpm dlx license-checker --production --onlyAllow \"MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;Unlicense\"",
|
|
38
|
+
"license-check:json": "pnpm dlx license-checker --production --onlyAllow \"MIT;Apache-2.0;BSD-2-Clause;BSD-3-Clause;ISC;Unlicense\" --json",
|
|
39
|
+
"clean": "rimraf dist",
|
|
40
|
+
"prepublishOnly": "npm run clean && npm run typecheck && npm run test --if-present && npm run build",
|
|
41
|
+
"publish:patch": "npm version patch && npm publish",
|
|
42
|
+
"publish:minor": "npm version minor && npm publish",
|
|
43
|
+
"publish:major": "npm version major && npm publish"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0",
|
|
47
|
+
"npm": ">=8.0.0"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": "^19.1.0",
|
|
51
|
+
"react-dom": "^19.1.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@tailwindcss/postcss": "^4.1.16",
|
|
55
|
+
"tailwind-merge": "^3.3.1",
|
|
56
|
+
"tailwindcss": "^4.1.16"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@tailwindcss/vite": "^4.1.16",
|
|
60
|
+
"@types/react": "^19.2.2",
|
|
61
|
+
"@types/react-dom": "^19.2.2",
|
|
62
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
63
|
+
"react": "^19.2.0",
|
|
64
|
+
"react-dom": "^19.2.0",
|
|
65
|
+
"rimraf": "^6.0.1",
|
|
66
|
+
"typescript": "^5.9.3",
|
|
67
|
+
"vite": "^7.1.12",
|
|
68
|
+
"vite-plugin-dts": "^3.9.1",
|
|
69
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
}
|
|
74
|
+
}
|