react-resize-demo 2.0.1 → 2.0.3

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.
Files changed (39) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +5 -0
  3. package/dist/components/ResizeHandle/index.js +1 -91
  4. package/dist/components/ResizeHandle/index.js.map +1 -1
  5. package/dist/components/ResizePanel/index.d.ts +16 -0
  6. package/dist/components/ResizePanel/index.js +1 -32
  7. package/dist/components/ResizePanel/index.js.map +1 -1
  8. package/dist/components/ResizePanelGroup/index.d.ts +19 -0
  9. package/dist/components/ResizePanelGroup/index.js +1 -60
  10. package/dist/components/ResizePanelGroup/index.js.map +1 -1
  11. package/dist/components/shared/context.js +1 -34
  12. package/dist/components/shared/context.js.map +1 -1
  13. package/dist/esm/components/ResizeHandle/index.js +1 -89
  14. package/dist/esm/components/ResizeHandle/index.js.map +1 -1
  15. package/dist/esm/components/ResizePanel/index.d.ts +16 -0
  16. package/dist/esm/components/ResizePanel/index.js +1 -30
  17. package/dist/esm/components/ResizePanel/index.js.map +1 -1
  18. package/dist/esm/components/ResizePanelGroup/index.d.ts +19 -0
  19. package/dist/esm/components/ResizePanelGroup/index.js +1 -58
  20. package/dist/esm/components/ResizePanelGroup/index.js.map +1 -1
  21. package/dist/esm/components/shared/context.js +1 -31
  22. package/dist/esm/components/shared/context.js.map +1 -1
  23. package/dist/esm/index.d.ts +3 -0
  24. package/dist/esm/index.js +1 -5
  25. package/dist/esm/index.js.map +1 -1
  26. package/dist/esm/types/index.d.ts +44 -0
  27. package/dist/esm/utils/resizeAble.js +1 -426
  28. package/dist/esm/utils/resizeAble.js.map +1 -1
  29. package/dist/esm/utils/virtualNode.js +1 -163
  30. package/dist/esm/utils/virtualNode.js.map +1 -1
  31. package/dist/index.d.ts +3 -0
  32. package/dist/index.js +1 -14
  33. package/dist/index.js.map +1 -1
  34. package/dist/types/index.d.ts +0 -27
  35. package/dist/utils/resizeAble.js +1 -430
  36. package/dist/utils/resizeAble.js.map +1 -1
  37. package/dist/utils/virtualNode.js +1 -167
  38. package/dist/utils/virtualNode.js.map +1 -1
  39. package/package.json +134 -88
@@ -1,168 +1,2 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- /**
6
- * 虚拟节点管理模块
7
- * 负责创建、更新、销毁虚拟节点,用于虚拟化拖拽
8
- */
9
- class VirtualNodeManager {
10
- constructor() {
11
- Object.defineProperty(this, "virtualNodes", {
12
- enumerable: true,
13
- configurable: true,
14
- writable: true,
15
- value: new Map()
16
- }); // 存储虚拟节点映射:realEl -> virtualEl
17
- }
18
- /**
19
- * 创建虚拟节点
20
- * @param originalEl - 原始节点
21
- * @param config - 虚拟化配置
22
- * @returns 虚拟节点
23
- */
24
- createVirtualNode(originalEl, config = {}) {
25
- if (!originalEl || !originalEl.parentElement) {
26
- return null;
27
- }
28
- // 如果已存在虚拟节点,先移除
29
- if (this.virtualNodes.has(originalEl)) {
30
- this.removeVirtualNode(originalEl);
31
- }
32
- // 获取原始节点的位置和尺寸信息
33
- const rect = originalEl.getBoundingClientRect();
34
- const parentRect = originalEl.parentElement.getBoundingClientRect();
35
- const computedStyle = window.getComputedStyle(originalEl);
36
- // 创建虚拟节点(只复制结构,不复制内容以提高性能)
37
- const virtualEl = originalEl.cloneNode(false); // false 表示不复制子节点
38
- // 计算相对于父容器的位置
39
- const top = rect.top - parentRect.top + (originalEl.parentElement.scrollTop || 0);
40
- const left = rect.left - parentRect.left + (originalEl.parentElement.scrollLeft || 0);
41
- // 设置虚拟节点样式
42
- virtualEl.style.cssText = `
43
- position: absolute;
44
- top: ${top}px;
45
- left: ${left}px;
46
- width: ${rect.width}px;
47
- height: ${rect.height}px;
48
- margin: 0;
49
- padding: ${computedStyle.padding};
50
- border: ${computedStyle.border};
51
- box-sizing: ${computedStyle.boxSizing};
52
- pointer-events: none;
53
- z-index: 10000;
54
- opacity: 0.6;
55
- background-color: ${computedStyle.backgroundColor || 'rgba(0, 123, 255, 0.1)'};
56
- overflow: hidden;
57
- box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);
58
- `;
59
- // 应用自定义样式
60
- if (config.style) {
61
- Object.assign(virtualEl.style, config.style);
62
- }
63
- // 应用自定义类名
64
- if (config.className) {
65
- virtualEl.className = config.className;
66
- }
67
- // 隐藏原始节点的内容(可选,通过设置透明度)
68
- const originalOpacity = originalEl.style.opacity;
69
- originalEl.style.opacity = '0.3';
70
- originalEl.dataset.originalOpacity = originalOpacity || '';
71
- // 将虚拟节点插入到父容器中
72
- originalEl.parentElement.appendChild(virtualEl);
73
- // 存储映射关系
74
- this.virtualNodes.set(originalEl, virtualEl);
75
- return virtualEl;
76
- }
77
- /**
78
- * 更新虚拟节点尺寸
79
- * @param originalEl - 原始节点
80
- * @param size - 新尺寸
81
- * @param direction - 方向 'horizontal' | 'vertical'
82
- */
83
- updateVirtualNode(originalEl, size, direction) {
84
- const virtualEl = this.virtualNodes.get(originalEl);
85
- if (!virtualEl)
86
- return;
87
- const sizeProperty = direction === 'horizontal' ? 'width' : 'height';
88
- virtualEl.style[sizeProperty] = `${size}px`;
89
- }
90
- /**
91
- * 更新虚拟节点位置(用于级联调整)
92
- * @param originalEl - 原始节点
93
- * @param newPosition - 新位置(绝对位置,不是偏移量)
94
- * @param direction - 方向 'horizontal' | 'vertical'
95
- */
96
- updateVirtualNodePosition(originalEl, newPosition, direction) {
97
- const virtualEl = this.virtualNodes.get(originalEl);
98
- if (!virtualEl)
99
- return;
100
- const positionProperty = direction === 'horizontal' ? 'left' : 'top';
101
- virtualEl.style[positionProperty] = `${newPosition}px`;
102
- }
103
- /**
104
- * 移除虚拟节点
105
- * @param originalEl - 原始节点
106
- */
107
- removeVirtualNode(originalEl) {
108
- const virtualEl = this.virtualNodes.get(originalEl);
109
- if (!virtualEl)
110
- return;
111
- // 恢复原始节点透明度
112
- if (originalEl.dataset.originalOpacity !== undefined) {
113
- originalEl.style.opacity = originalEl.dataset.originalOpacity;
114
- delete originalEl.dataset.originalOpacity;
115
- }
116
- // 移除虚拟节点
117
- if (virtualEl.parentElement) {
118
- virtualEl.parentElement.removeChild(virtualEl);
119
- }
120
- // 移除映射关系
121
- this.virtualNodes.delete(originalEl);
122
- }
123
- /**
124
- * 将最终尺寸应用到真实节点
125
- * @param originalEl - 原始节点
126
- * @param finalSize - 最终尺寸
127
- * @param direction - 方向 'horizontal' | 'vertical'
128
- */
129
- applyToRealNode(originalEl, finalSize, direction) {
130
- const sizeProperty = direction === 'horizontal' ? 'width' : 'height';
131
- originalEl.style[sizeProperty] = `${finalSize}px`;
132
- }
133
- /**
134
- * 移除所有虚拟节点
135
- */
136
- removeAllVirtualNodes() {
137
- const nodesToRemove = Array.from(this.virtualNodes.keys());
138
- nodesToRemove.forEach(originalEl => {
139
- this.removeVirtualNode(originalEl);
140
- });
141
- this.virtualNodes.clear();
142
- }
143
- /**
144
- * 检查是否存在虚拟节点
145
- * @param originalEl - 原始节点
146
- * @returns 是否存在
147
- */
148
- hasVirtualNode(originalEl) {
149
- return this.virtualNodes.has(originalEl);
150
- }
151
- /**
152
- * 获取虚拟节点
153
- * @param originalEl - 原始节点
154
- * @returns 虚拟节点或null
155
- */
156
- getVirtualNode(originalEl) {
157
- return this.virtualNodes.get(originalEl) || null;
158
- }
159
- /**
160
- * 销毁管理器,清理所有资源
161
- */
162
- destroy() {
163
- this.removeAllVirtualNodes();
164
- }
165
- }
166
-
167
- exports.default = VirtualNodeManager;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=class{constructor(){Object.defineProperty(this,"virtualNodes",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}createVirtualNode(e,t={}){if(!e||!e.parentElement)return null;this.virtualNodes.has(e)&&this.removeVirtualNode(e);const o=e.getBoundingClientRect(),i=e.parentElement.getBoundingClientRect(),a=window.getComputedStyle(e),l=e.cloneNode(!1),r=o.top-i.top+(e.parentElement.scrollTop||0),n=o.left-i.left+(e.parentElement.scrollLeft||0);l.style.cssText=`\n position: absolute;\n top: ${r}px;\n left: ${n}px;\n width: ${o.width}px;\n height: ${o.height}px;\n margin: 0;\n padding: ${a.padding};\n border: ${a.border};\n box-sizing: ${a.boxSizing};\n pointer-events: none;\n z-index: 10000;\n opacity: 0.6;\n background-color: ${a.backgroundColor||"rgba(0, 123, 255, 0.1)"};\n overflow: hidden;\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);\n `,t.style&&Object.assign(l.style,t.style),t.className&&(l.className=t.className);const s=e.style.opacity;return e.style.opacity="0.3",e.dataset.originalOpacity=s||"",e.parentElement.appendChild(l),this.virtualNodes.set(e,l),l}updateVirtualNode(e,t,o){const i=this.virtualNodes.get(e);if(!i)return;const a="horizontal"===o?"width":"height";i.style[a]=`${t}px`}updateVirtualNodePosition(e,t,o){const i=this.virtualNodes.get(e);if(!i)return;const a="horizontal"===o?"left":"top";i.style[a]=`${t}px`}removeVirtualNode(e){const t=this.virtualNodes.get(e);t&&(void 0!==e.dataset.originalOpacity&&(e.style.opacity=e.dataset.originalOpacity,delete e.dataset.originalOpacity),t.parentElement&&t.parentElement.removeChild(t),this.virtualNodes.delete(e))}applyToRealNode(e,t,o){const i="horizontal"===o?"width":"height";e.style[i]=`${t}px`}removeAllVirtualNodes(){Array.from(this.virtualNodes.keys()).forEach(e=>{this.removeVirtualNode(e)}),this.virtualNodes.clear()}hasVirtualNode(e){return this.virtualNodes.has(e)}getVirtualNode(e){return this.virtualNodes.get(e)||null}destroy(){this.removeAllVirtualNodes()}};
168
2
  //# sourceMappingURL=virtualNode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtualNode.js","sources":["../../src/utils/virtualNode.ts"],"sourcesContent":["/**\r\n * 虚拟节点管理模块\r\n * 负责创建、更新、销毁虚拟节点,用于虚拟化拖拽\r\n */\r\n\r\nimport { VirtualNodeConfig, ResizeDirection } from '../types';\r\n\r\nclass VirtualNodeManager {\r\n private virtualNodes: Map<HTMLElement, HTMLElement> = new Map(); // 存储虚拟节点映射:realEl -> virtualEl\r\n\r\n /**\r\n * 创建虚拟节点\r\n * @param originalEl - 原始节点\r\n * @param config - 虚拟化配置\r\n * @returns 虚拟节点\r\n */\r\n createVirtualNode(originalEl: HTMLElement, config: VirtualNodeConfig = {}): HTMLElement | null {\r\n if (!originalEl || !originalEl.parentElement) {\r\n return null;\r\n }\r\n\r\n // 如果已存在虚拟节点,先移除\r\n if (this.virtualNodes.has(originalEl)) {\r\n this.removeVirtualNode(originalEl);\r\n }\r\n\r\n // 获取原始节点的位置和尺寸信息\r\n const rect = originalEl.getBoundingClientRect();\r\n const parentRect = originalEl.parentElement.getBoundingClientRect();\r\n const computedStyle = window.getComputedStyle(originalEl);\r\n\r\n // 创建虚拟节点(只复制结构,不复制内容以提高性能)\r\n const virtualEl = originalEl.cloneNode(false) as HTMLElement; // false 表示不复制子节点\r\n \r\n // 计算相对于父容器的位置\r\n const top = rect.top - parentRect.top + (originalEl.parentElement.scrollTop || 0);\r\n const left = rect.left - parentRect.left + (originalEl.parentElement.scrollLeft || 0);\r\n \r\n // 设置虚拟节点样式\r\n virtualEl.style.cssText = `\r\n position: absolute;\r\n top: ${top}px;\r\n left: ${left}px;\r\n width: ${rect.width}px;\r\n height: ${rect.height}px;\r\n margin: 0;\r\n padding: ${computedStyle.padding};\r\n border: ${computedStyle.border};\r\n box-sizing: ${computedStyle.boxSizing};\r\n pointer-events: none;\r\n z-index: 10000;\r\n opacity: 0.6;\r\n background-color: ${computedStyle.backgroundColor || 'rgba(0, 123, 255, 0.1)'};\r\n overflow: hidden;\r\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.3);\r\n `;\r\n\r\n // 应用自定义样式\r\n if (config.style) {\r\n Object.assign(virtualEl.style, config.style);\r\n }\r\n\r\n // 应用自定义类名\r\n if (config.className) {\r\n virtualEl.className = config.className;\r\n }\r\n\r\n // 隐藏原始节点的内容(可选,通过设置透明度)\r\n const originalOpacity = originalEl.style.opacity;\r\n originalEl.style.opacity = '0.3';\r\n originalEl.dataset.originalOpacity = originalOpacity || '';\r\n\r\n // 将虚拟节点插入到父容器中\r\n originalEl.parentElement.appendChild(virtualEl);\r\n\r\n // 存储映射关系\r\n this.virtualNodes.set(originalEl, virtualEl);\r\n\r\n return virtualEl;\r\n }\r\n\r\n /**\r\n * 更新虚拟节点尺寸\r\n * @param originalEl - 原始节点\r\n * @param size - 新尺寸\r\n * @param direction - 方向 'horizontal' | 'vertical'\r\n */\r\n updateVirtualNode(originalEl: HTMLElement, size: number, direction: ResizeDirection): void {\r\n const virtualEl = this.virtualNodes.get(originalEl);\r\n if (!virtualEl) return;\r\n\r\n const sizeProperty = direction === 'horizontal' ? 'width' : 'height';\r\n virtualEl.style[sizeProperty] = `${size}px`;\r\n }\r\n\r\n /**\r\n * 更新虚拟节点位置(用于级联调整)\r\n * @param originalEl - 原始节点\r\n * @param newPosition - 新位置(绝对位置,不是偏移量)\r\n * @param direction - 方向 'horizontal' | 'vertical'\r\n */\r\n updateVirtualNodePosition(originalEl: HTMLElement, newPosition: number, direction: ResizeDirection): void {\r\n const virtualEl = this.virtualNodes.get(originalEl);\r\n if (!virtualEl) return;\r\n\r\n const positionProperty = direction === 'horizontal' ? 'left' : 'top';\r\n virtualEl.style[positionProperty] = `${newPosition}px`;\r\n }\r\n\r\n /**\r\n * 移除虚拟节点\r\n * @param originalEl - 原始节点\r\n */\r\n removeVirtualNode(originalEl: HTMLElement): void {\r\n const virtualEl = this.virtualNodes.get(originalEl);\r\n if (!virtualEl) return;\r\n\r\n // 恢复原始节点透明度\r\n if (originalEl.dataset.originalOpacity !== undefined) {\r\n originalEl.style.opacity = originalEl.dataset.originalOpacity;\r\n delete originalEl.dataset.originalOpacity;\r\n }\r\n\r\n // 移除虚拟节点\r\n if (virtualEl.parentElement) {\r\n virtualEl.parentElement.removeChild(virtualEl);\r\n }\r\n\r\n // 移除映射关系\r\n this.virtualNodes.delete(originalEl);\r\n }\r\n\r\n /**\r\n * 将最终尺寸应用到真实节点\r\n * @param originalEl - 原始节点\r\n * @param finalSize - 最终尺寸\r\n * @param direction - 方向 'horizontal' | 'vertical'\r\n */\r\n applyToRealNode(originalEl: HTMLElement, finalSize: number, direction: ResizeDirection): void {\r\n const sizeProperty = direction === 'horizontal' ? 'width' : 'height';\r\n originalEl.style[sizeProperty] = `${finalSize}px`;\r\n }\r\n\r\n /**\r\n * 移除所有虚拟节点\r\n */\r\n removeAllVirtualNodes(): void {\r\n const nodesToRemove = Array.from(this.virtualNodes.keys());\r\n nodesToRemove.forEach(originalEl => {\r\n this.removeVirtualNode(originalEl);\r\n });\r\n this.virtualNodes.clear();\r\n }\r\n\r\n /**\r\n * 检查是否存在虚拟节点\r\n * @param originalEl - 原始节点\r\n * @returns 是否存在\r\n */\r\n hasVirtualNode(originalEl: HTMLElement): boolean {\r\n return this.virtualNodes.has(originalEl);\r\n }\r\n\r\n /**\r\n * 获取虚拟节点\r\n * @param originalEl - 原始节点\r\n * @returns 虚拟节点或null\r\n */\r\n getVirtualNode(originalEl: HTMLElement): HTMLElement | null {\r\n return this.virtualNodes.get(originalEl) || null;\r\n }\r\n\r\n /**\r\n * 销毁管理器,清理所有资源\r\n */\r\n destroy(): void {\r\n this.removeAllVirtualNodes();\r\n }\r\n}\r\n\r\nexport default VirtualNodeManager;\r\n\r\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;AAIH,MAAM,kBAAkB,CAAA;AAAxB,IAAA,WAAA,GAAA;AACY,QAAA,MAAA,CAAA,cAAA,CAAA,IAAA,EAAA,cAAA,EAAA;;;;AAA8C,YAAA,KAAA,EAAA,IAAI,GAAG;AAAG,SAAA,CAAA,CAAA;IA0KpE;AAxKI;;;;;AAKG;AACH,IAAA,iBAAiB,CAAC,UAAuB,EAAE,MAAA,GAA4B,EAAE,EAAA;QACrE,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE;AAC1C,YAAA,OAAO,IAAI;QACf;;QAGA,IAAI,IAAI,CAAC,YAAY,CA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../../src/utils/virtualNode.ts"],"sourcesContent":[null],"names":["constructor","Object","defineProperty","this","value","Map","createVirtualNode","originalEl","config","parentElement","virtualNodes","has","removeVirtualNode","rect","getBoundingClientRect","parentRect","computedStyle","window","getComputedStyle","virtualEl","cloneNode","top","scrollTop","left","scrollLeft","style","cssText","width","height","padding","border","boxSizing","backgroundColor","assign","className","originalOpacity","opacity","dataset","appendChild","set","updateVirtualNode","size","direction","get","sizeProperty","updateVirtualNodePosition","newPosition","positionProperty","undefined","removeChild","delete","applyToRealNode","finalSize","removeAllVirtualNodes","Array","from","keys","forEach","clear","hasVirtualNode","getVirtualNode","destroy"],"mappings":"oFAOA,MAAA,WAAAA,GACYC,OAAAC,eAAAC,KAAA,eAAA,2CAA8CC,MAAA,IAAIC,KA0K9D,CAlKI,iBAAAC,CAAkBC,EAAyBC,EAA4B,IACnE,IAAKD,IAAeA,EAAWE,cAC3B,OAAO,KAIPN,KAAKO,aAAaC,IAAIJ,IACtBJ,KAAKS,kBAAkBL,GAI3B,MAAMM,EAAON,EAAWO,wBAClBC,EAAaR,EAAWE,cAAcK,wBACtCE,EAAgBC,OAAOC,iBAAiBX,GAGxCY,EAAYZ,EAAWa,WAAU,GAGjCC,EAAMR,EAAKQ,IAAMN,EAAWM,KAAOd,EAAWE,cAAca,WAAa,GACzEC,EAAOV,EAAKU,KAAOR,EAAWQ,MAAQhB,EAAWE,cAAce,YAAc,GAGnFL,EAAUM,MAAMC,QAAU,uDAEfL,2BACCE,4BACCV,EAAKc,iCACJd,EAAKe,2DAEJZ,EAAca,iCACfb,EAAcc,oCACVd,EAAce,wIAIRf,EAAcgB,iBAAmB,gIAMrDxB,EAAOiB,OACPxB,OAAOgC,OAAOd,EAAUM,MAAOjB,EAAOiB,OAItCjB,EAAO0B,YACPf,EAAUe,UAAY1B,EAAO0B,WAIjC,MAAMC,EAAkB5B,EAAWkB,MAAMW,QAUzC,OATA7B,EAAWkB,MAAMW,QAAU,MAC3B7B,EAAW8B,QAAQF,gB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- {
2
- "name": "react-resize-demo",
3
- "version": "2.0.1",
4
- "description": "A React component library demo",
5
- "main": "dist/index.js",
6
- "module": "dist/esm/index.js",
7
- "types": "dist/types/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/esm/index.js",
11
- "require": "./dist/index.js",
12
- "types": "./dist/types/index.d.ts"
13
- },
14
- "./components": {
15
- "import": "./dist/esm/components/ResizePanel/index.js",
16
- "require": "./dist/components/ResizePanel/index.js",
17
- "types": "./dist/types/components/ResizePanel/index.d.ts"
18
- },
19
- "./components/*": {
20
- "import": "./dist/esm/components/*/index.js",
21
- "require": "./dist/components/*/index.js",
22
- "types": "./dist/types/components/*/index.d.ts"
23
- },
24
- "./utils": {
25
- "import": "./dist/esm/utils/index.js",
26
- "require": "./dist/utils/index.js",
27
- "types": "./dist/types/utils/index.d.ts"
28
- },
29
- "./types": {
30
- "import": "./dist/esm/types/index.js",
31
- "require": "./dist/types/index.js",
32
- "types": "./dist/types/types/index.d.ts"
33
- }
34
- },
35
- "files": [
36
- "dist",
37
- "README.md",
38
- "CHANGELOG.md"
39
- ],
40
- "scripts": {
41
- "build": "rollup -c",
42
- "build:watch": "rollup -c -w",
43
- "dev": "vite",
44
- "demo": "vite --config vite.demo.config.ts",
45
- "demo:build": "vite build --config vite.demo.config.ts",
46
- "type-check": "tsc --noEmit",
47
- "lint": "eslint src --ext .ts,.tsx",
48
- "prepublishOnly": "npm run build"
49
- },
50
- "keywords": [
51
- "react",
52
- "component",
53
- "library"
54
- ],
55
- "author": "",
56
- "license": "MIT",
57
- "peerDependencies": {
58
- "react": ">=16.8.0",
59
- "react-dom": ">=16.8.0"
60
- },
61
- "devDependencies": {
62
- "@rollup/plugin-commonjs": "^25.0.7",
63
- "@rollup/plugin-node-resolve": "^15.2.3",
64
- "@rollup/plugin-typescript": "^11.1.5",
65
- "@types/react": "^18.2.43",
66
- "@types/react-dom": "^18.2.17",
67
- "@typescript-eslint/eslint-plugin": "^6.14.0",
68
- "@typescript-eslint/parser": "^6.14.0",
69
- "@vitejs/plugin-react": "^4.2.1",
70
- "eslint": "^8.55.0",
71
- "eslint-plugin-react": "^7.33.2",
72
- "eslint-plugin-react-hooks": "^4.6.0",
73
- "react": "^18.2.0",
74
- "react-dom": "^18.2.0",
75
- "rollup": "^4.6.1",
76
- "rollup-plugin-dts": "^6.1.0",
77
- "rollup-plugin-peer-deps-external": "^2.2.4",
78
- "rollup-plugin-postcss": "^4.0.2",
79
- "tslib": "^2.6.2",
80
- "typescript": "^5.3.3",
81
- "vite": "^5.0.7"
82
- },
83
- "repository": {
84
- "type": "git",
85
- "url": ""
86
- }
87
- }
88
-
1
+ {
2
+ "name": "react-resize-demo",
3
+ "version": "2.0.3",
4
+ "description": "A React component library demo",
5
+ "main": "dist/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/esm/index.d.ts",
12
+ "default": "./dist/esm/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "./components": {
20
+ "import": {
21
+ "types": "./dist/esm/components/index.d.ts",
22
+ "default": "./dist/esm/components/index.js"
23
+ },
24
+ "require": {
25
+ "types": "./dist/components/index.d.ts",
26
+ "default": "./dist/components/index.js"
27
+ }
28
+ },
29
+ "./components/*": {
30
+ "import": {
31
+ "types": "./dist/esm/components/*/index.d.ts",
32
+ "default": "./dist/esm/components/*/index.js"
33
+ },
34
+ "require": {
35
+ "types": "./dist/components/*/index.d.ts",
36
+ "default": "./dist/components/*/index.js"
37
+ }
38
+ },
39
+ "./components/shared/*": {
40
+ "import": {
41
+ "types": "./dist/esm/components/shared/*.d.ts",
42
+ "default": "./dist/esm/components/shared/*.js"
43
+ },
44
+ "require": {
45
+ "types": "./dist/components/shared/*.d.ts",
46
+ "default": "./dist/components/shared/*.js"
47
+ }
48
+ },
49
+ "./utils": {
50
+ "import": {
51
+ "types": "./dist/esm/utils/index.d.ts",
52
+ "default": "./dist/esm/utils/index.js"
53
+ },
54
+ "require": {
55
+ "types": "./dist/utils/index.d.ts",
56
+ "default": "./dist/utils/index.js"
57
+ }
58
+ },
59
+ "./utils/*": {
60
+ "import": {
61
+ "types": "./dist/esm/utils/*.d.ts",
62
+ "default": "./dist/esm/utils/*.js"
63
+ },
64
+ "require": {
65
+ "types": "./dist/utils/*.d.ts",
66
+ "default": "./dist/utils/*.js"
67
+ }
68
+ },
69
+ "./types": {
70
+ "import": {
71
+ "types": "./dist/esm/types/index.d.ts",
72
+ "default": "./dist/esm/types/index.js"
73
+ },
74
+ "require": {
75
+ "types": "./dist/types/index.d.ts",
76
+ "default": "./dist/types/index.js"
77
+ }
78
+ }
79
+ },
80
+ "sideEffects": false,
81
+ "files": [
82
+ "dist",
83
+ "README.md",
84
+ "CHANGELOG.md"
85
+ ],
86
+ "scripts": {
87
+ "build": "rollup -c",
88
+ "build:watch": "rollup -c -w",
89
+ "dev": "vite",
90
+ "demo": "vite --config vite.demo.config.ts",
91
+ "demo:build": "vite build --config vite.demo.config.ts",
92
+ "type-check": "tsc --noEmit",
93
+ "lint": "eslint src --ext .ts,.tsx",
94
+ "prepublishOnly": "npm run build"
95
+ },
96
+ "keywords": [
97
+ "react",
98
+ "component",
99
+ "library"
100
+ ],
101
+ "author": "",
102
+ "license": "MIT",
103
+ "peerDependencies": {
104
+ "react": ">=16.8.0",
105
+ "react-dom": ">=16.8.0"
106
+ },
107
+ "devDependencies": {
108
+ "@rollup/plugin-commonjs": "^25.0.7",
109
+ "@rollup/plugin-node-resolve": "^15.2.3",
110
+ "@rollup/plugin-typescript": "^11.1.5",
111
+ "@types/react": "^18.2.43",
112
+ "@types/react-dom": "^18.2.17",
113
+ "@typescript-eslint/eslint-plugin": "^6.14.0",
114
+ "@typescript-eslint/parser": "^6.14.0",
115
+ "@vitejs/plugin-react": "^4.2.1",
116
+ "eslint": "^8.55.0",
117
+ "eslint-plugin-react": "^7.33.2",
118
+ "eslint-plugin-react-hooks": "^4.6.0",
119
+ "react": "^18.2.0",
120
+ "react-dom": "^18.2.0",
121
+ "rollup": "^4.6.1",
122
+ "rollup-plugin-dts": "^6.1.0",
123
+ "rollup-plugin-peer-deps-external": "^2.2.4",
124
+ "rollup-plugin-postcss": "^4.0.2",
125
+ "tslib": "^2.6.2",
126
+ "typescript": "^5.3.3",
127
+ "vite": "^5.0.7"
128
+ },
129
+ "repository": {
130
+ "type": "git",
131
+ "url": ""
132
+ }
133
+ }
134
+