ywana-core8 0.1.103 → 0.2.1
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/index.css +4941 -324
- package/dist/index.js +42338 -0
- package/dist/index.js.map +1 -0
- package/dist/index.modern.js +37458 -31678
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +39634 -34010
- package/dist/index.umd.js.map +1 -1
- package/package.json +26 -29
- package/src/Test.stories.jsx +28 -0
- package/src/desktop/Desktop.stories.jsx +110 -0
- package/src/desktop/WindowContext.js +135 -0
- package/src/desktop/WindowManager.js +355 -0
- package/src/desktop/desktop.css +55 -4
- package/src/desktop/desktop.js +312 -6
- package/src/desktop/index.js +7 -0
- package/src/desktop/window.css +229 -36
- package/src/desktop/window.js +254 -20
- package/src/desktop.backup/desktop.css +6 -0
- package/src/desktop.backup/desktop.js +13 -0
- package/src/desktop.backup/window.css +58 -0
- package/src/desktop.backup/window.js +27 -0
- package/src/html/Accordion.stories.jsx +178 -0
- package/src/html/Button.stories.jsx +175 -0
- package/src/html/Checkbox.stories.jsx +131 -0
- package/src/html/Chip.stories.jsx +189 -0
- package/src/html/Color.stories.jsx +234 -0
- package/src/html/Form.stories.jsx +271 -0
- package/src/html/Icon.stories.jsx +233 -0
- package/src/html/Progress.stories.jsx +247 -0
- package/src/html/Radio.stories.jsx +289 -0
- package/src/html/StyleTest.stories.jsx +81 -0
- package/src/html/Switch.stories.jsx +329 -0
- package/src/html/Tab.stories.jsx +239 -0
- package/src/html/Table.stories.jsx +188 -0
- package/src/html/Table2.stories.jsx +238 -0
- package/src/html/TextField2.stories.jsx +337 -0
- package/src/html/Tree.stories.jsx +285 -0
- package/src/html/accordion.example.js +0 -74
- package/src/html/accordion.js +1 -6
- package/src/html/button.js +2 -13
- package/src/html/checkbox.js +1 -9
- package/src/html/chip.js +2 -19
- package/src/html/color.js +1 -14
- package/src/html/form.js +4 -15
- package/src/html/header2.js +1 -12
- package/src/html/icon.js +1 -7
- package/src/html/index.js +1 -1
- package/src/html/list.js +1 -19
- package/src/html/menu.js +9 -5
- package/src/html/progress.js +5 -53
- package/src/html/property.js +9 -25
- package/src/html/radio.js +2 -16
- package/src/html/section.js +1 -6
- package/src/html/selector.js +2 -19
- package/src/html/switch.css +134 -100
- package/src/html/switch.example.js +46 -36
- package/src/html/switch.js +43 -192
- package/src/html/tab.js +3 -24
- package/src/html/text.js +1 -12
- package/src/html/textfield2.js +5 -42
- package/src/html/thumbnail.js +1 -12
- package/src/html/tokenfield.js +2 -21
- package/src/html/tree.js +3 -35
- package/src/index.js +1 -0
- package/__previewjs__/Wrapper.tsx +0 -14
- package/build-doc.sh +0 -10
- package/db/db.json +0 -89
- package/db/routes.json +0 -0
- package/dist/index.cjs +0 -36722
- package/dist/index.cjs.map +0 -1
- package/dist/index.css.map +0 -1
- package/doc/README.md +0 -196
- package/doc/evalulations/ACCORDION_EVALUATION.md +0 -583
- package/doc/evalulations/CHECKBOX_EVALUATION.md +0 -273
- package/doc/evalulations/CHIP_EVALUATION.md +0 -542
- package/doc/evalulations/COLOR_EVALUATION.md +0 -524
- package/doc/evalulations/COMPONENTS_EVALUATION.md +0 -477
- package/doc/evalulations/FORM_EVALUATION.md +0 -459
- package/doc/evalulations/HEADER_EVALUATION.md +0 -436
- package/doc/evalulations/ICON_EVALUATION.md +0 -254
- package/doc/evalulations/LIST_EVALUATION.md +0 -574
- package/doc/evalulations/PROGRESS_EVALUATION.md +0 -450
- package/doc/evalulations/RADIO_EVALUATION.md +0 -439
- package/doc/evalulations/RADIO_VISUAL_FIX.md +0 -183
- package/doc/evalulations/SECTION_IMPROVEMENTS.md +0 -153
- package/doc/evalulations/SWITCH_EVALUATION.md +0 -335
- package/doc/evalulations/SWITCH_VISUAL_FIX.md +0 -232
- package/doc/evalulations/TAB_EVALUATION.md +0 -626
- package/doc/evalulations/TEXTFIELD_EVALUATION.md +0 -747
- package/doc/evalulations/TOOLTIP_FIX.md +0 -157
- package/doc/evalulations/TREE_EVALUATION.md +0 -708
- package/doc/index.html +0 -0
- package/doc/package-lock.json +0 -17298
- package/doc/package.json +0 -34
- package/doc/public/index.html +0 -24
- package/doc/scripts/generate-examples.js +0 -129
- package/doc/src/App.css +0 -171
- package/doc/src/App.js +0 -114
- package/doc/src/components/ExamplePage.js +0 -129
- package/doc/src/components/WelcomePage.js +0 -84
- package/doc/src/index.css +0 -246
- package/doc/src/index.js +0 -17
- package/doc/src/theme.css +0 -256
- package/jest.config.js +0 -24
- package/preview.config.js +0 -38
- package/publish.sh +0 -6
- package/src/desktop/dektop.test.js +0 -11
- package/src/domain/CollectionAPI.test.js +0 -19
- package/src/domain/ContentEditor.test.js +0 -52
- package/src/domain2/CollectionAPI.test.js +0 -19
- package/src/domain2/CollectionContext.test.js +0 -71
- package/src/domain2/CollectionPage.test.js +0 -112
- package/src/domain2/DynamicForm.test.js +0 -47
- package/src/html/accordion.test.js +0 -37
- package/src/html/accordion.unit.test.js +0 -334
- package/src/html/button.example.new.js +0 -416
- package/src/html/button.test.js +0 -422
- package/src/html/checkbox.test.js +0 -285
- package/src/html/chip.test.js +0 -425
- package/src/html/color.example.js.backup +0 -527
- package/src/html/color.test.js +0 -377
- package/src/html/components.example.js.backup +0 -492
- package/src/html/components_enhanced.test.js +0 -581
- package/src/html/form.example.js.backup +0 -385
- package/src/html/form.test.js +0 -369
- package/src/html/header2.example.js.backup +0 -411
- package/src/html/header2.test.js +0 -377
- package/src/html/icon.example.js.backup +0 -268
- package/src/html/icon.test.js +0 -231
- package/src/html/label.test.js +0 -0
- package/src/html/list.example.js.backup +0 -404
- package/src/html/list.test.js +0 -383
- package/src/html/progress.example.js.backup +0 -424
- package/src/html/progress.test.js +0 -313
- package/src/html/property.example.js.backup +0 -553
- package/src/html/property.test.js +0 -371
- package/src/html/radio.example.js.backup +0 -389
- package/src/html/radio.test.js +0 -318
- package/src/html/section.example.js.backup +0 -99
- package/src/html/section.test.js +0 -131
- package/src/html/selector.test.js +0 -20
- package/src/html/switch.example.js.backup +0 -461
- package/src/html/switch.test.js +0 -355
- package/src/html/tab.example.js.backup +0 -446
- package/src/html/tab.test.js +0 -25
- package/src/html/tab_enhanced.test.js +0 -504
- package/src/html/table.test.js +0 -70
- package/src/html/table2.test.js +0 -582
- package/src/html/text.test.js +0 -15
- package/src/html/textfield.test.js +0 -51
- package/src/html/textfield2.example.js.backup +0 -1370
- package/src/html/textfield2.test.js +0 -950
- package/src/html/tokenfield.example.js.backup +0 -503
- package/src/html/tokenfield.test.js +0 -423
- package/src/html/tree.example.js.backup +0 -475
- package/src/html/tree.test.js +0 -43
- package/src/html/tree_enhanced.test.js +0 -495
- package/src/http/token.test.js +0 -50
- package/src/incubator/pdfViewer.js +0 -33
- package/src/incubator/wizard.test.js +0 -127
- package/src/site/site.test.js +0 -230
- package/src/site/view.test.js +0 -41
- package/src/widgets/calendar/Calendar.test.js +0 -28
- package/src/widgets/explorer/Explorer.test.js +0 -121
- package/src/widgets/ide/editor.test.js +0 -33
- package/src/widgets/kanban/Kanban.test.js +0 -78
- package/src/widgets/login/LoginBox.test.js +0 -12
- package/src/widgets/login/ResetPasswordBox.test.js +0 -34
- package/src/widgets/login/validations.test.js +0 -51
- package/src/widgets/planner/Planner.test.js +0 -60
- package/src/widgets/upload/Upload.test.js +0 -32
- package/table2.test.js +0 -454
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ywana-core8",
|
3
|
-
"version": "0.1
|
3
|
+
"version": "0.2.1",
|
4
4
|
"description": "ywana-core8",
|
5
5
|
"homepage": "https://ywana.github.io/workspace",
|
6
6
|
"author": "Ernesto Roldan Garcia",
|
@@ -9,60 +9,57 @@
|
|
9
9
|
"source": "src/index.js",
|
10
10
|
"main": "dist/index.js",
|
11
11
|
"module": "dist/index.modern.js",
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
15
|
-
|
16
|
-
|
17
|
-
},
|
12
|
+
"files": [
|
13
|
+
"dist",
|
14
|
+
"src",
|
15
|
+
"README.md"
|
16
|
+
],
|
18
17
|
"scripts": {
|
19
|
-
"build": "
|
20
|
-
"dev": "
|
21
|
-
"
|
18
|
+
"build": "vite build",
|
19
|
+
"dev": "vite build --watch",
|
20
|
+
"prepublishOnly": "npm run build",
|
21
|
+
"ladle": "ladle serve",
|
22
|
+
"ladle:build": "ladle build",
|
22
23
|
"deploy-docs": "gh-pages -d doc/build"
|
23
24
|
},
|
24
25
|
"bugs": {
|
25
26
|
"url": "https://github.com/ywana/ywana-core8/issues"
|
26
27
|
},
|
27
28
|
"resolutions": {
|
28
|
-
"react-error-overlay": "6.0.9"
|
29
|
+
"react-error-overlay": "6.0.9",
|
30
|
+
"nth-check": "^2.1.1",
|
31
|
+
"postcss": "^8.4.31",
|
32
|
+
"svgo": "^3.0.0",
|
33
|
+
"webpack-dev-server": "^4.15.1"
|
29
34
|
},
|
30
35
|
"peerDependencies": {
|
31
|
-
"react": "
|
32
|
-
"react-dom": "
|
36
|
+
"react": "^19.1.1",
|
37
|
+
"react-dom": "^19.1.1"
|
33
38
|
},
|
34
39
|
"devDependencies": {
|
35
40
|
"@babel/preset-env": "^7.28.0",
|
36
41
|
"@babel/preset-react": "^7.27.1",
|
37
|
-
"@
|
38
|
-
"@
|
39
|
-
"
|
40
|
-
"babel-jest": "^30.0.5",
|
41
|
-
"gh-pages": "^3.2.3",
|
42
|
-
"identity-obj-proxy": "^3.0.0",
|
43
|
-
"jest": "^29.7.0",
|
42
|
+
"@ladle/react": "^5.0.3",
|
43
|
+
"@vitejs/plugin-react": "^5.0.2",
|
44
|
+
"gh-pages": "^6.3.0",
|
44
45
|
"jsdom": "^26.1.0",
|
45
|
-
"
|
46
|
-
"react": "^
|
47
|
-
"
|
48
|
-
"react-scripts": "^5.0.1"
|
46
|
+
"react": "^19.1.1",
|
47
|
+
"react-dom": "^19.1.1",
|
48
|
+
"vite": "^7.1.4"
|
49
49
|
},
|
50
50
|
"dependencies": {
|
51
51
|
"axios": "^1.3.4",
|
52
52
|
"crypto-js": "^4.1.1",
|
53
53
|
"deep-equal": "^2.0.5",
|
54
|
-
"framer-motion": "^5.3.1",
|
55
54
|
"material-design-icons-iconfont": "^6.7.0",
|
56
55
|
"moment": "^2.29.1",
|
57
56
|
"moment-range": "^4.0.2",
|
58
57
|
"react-datepicker": "^4.6.0",
|
59
58
|
"react-error-overlay": "^6.0.10",
|
60
59
|
"react-image-pan-zoom-rotate": "^1.6.0",
|
61
|
-
"react-notifications-component": "^
|
62
|
-
"react-pdf": "^7.0.3",
|
60
|
+
"react-notifications-component": "^4.0.1",
|
63
61
|
"react-switch": "^6.0.0",
|
64
|
-
"react-syntax-highlighter": "^15.6.
|
65
|
-
"react-tooltip": "^4.2.21",
|
62
|
+
"react-syntax-highlighter": "^15.6.6",
|
66
63
|
"resumablejs": "^1.1.0"
|
67
64
|
}
|
68
65
|
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Test básico
|
5
|
+
*/
|
6
|
+
export const BasicTest = () => (
|
7
|
+
<div style={{ padding: '20px', background: '#f0f8ff', borderRadius: '8px' }}>
|
8
|
+
<h2>🧪 Test Básico</h2>
|
9
|
+
<p>Si ves esto, Ladle está funcionando.</p>
|
10
|
+
</div>
|
11
|
+
)
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Test con botón
|
15
|
+
*/
|
16
|
+
export const TestWithButton = () => {
|
17
|
+
const [count, setCount] = React.useState(0)
|
18
|
+
|
19
|
+
return (
|
20
|
+
<div style={{ padding: '20px', background: '#f0fff0', borderRadius: '8px' }}>
|
21
|
+
<h2>🔢 Test con Botón</h2>
|
22
|
+
<p>Contador: {count}</p>
|
23
|
+
<button onClick={() => setCount(count + 1)}>
|
24
|
+
Incrementar
|
25
|
+
</button>
|
26
|
+
</div>
|
27
|
+
)
|
28
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { Desktop } from './desktop.js'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Basic Desktop with WindowManager
|
6
|
+
*/
|
7
|
+
export const BasicDesktop = () => (
|
8
|
+
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
9
|
+
<Desktop>
|
10
|
+
<div style={{
|
11
|
+
position: 'absolute',
|
12
|
+
top: '50%',
|
13
|
+
left: '50%',
|
14
|
+
transform: 'translate(-50%, -50%)',
|
15
|
+
background: 'rgba(255,255,255,0.9)',
|
16
|
+
padding: '20px',
|
17
|
+
borderRadius: '8px',
|
18
|
+
textAlign: 'center',
|
19
|
+
maxWidth: '400px',
|
20
|
+
pointerEvents: 'none'
|
21
|
+
}}>
|
22
|
+
<h3>🖥️ Desktop with WindowManager</h3>
|
23
|
+
<p>This desktop uses the new WindowManager system.</p>
|
24
|
+
<p><strong>To test:</strong></p>
|
25
|
+
<ul style={{ textAlign: 'left', margin: '16px 0' }}>
|
26
|
+
<li>Click <strong>"+ Create Window"</strong> button (taskbar)</li>
|
27
|
+
<li>Windows will appear with automatic positioning</li>
|
28
|
+
<li>Check the debug info (taskbar)</li>
|
29
|
+
<li>Right-click for context menu (console)</li>
|
30
|
+
</ul>
|
31
|
+
<p><small>💡 Windows are rendered in the Workspace</small></p>
|
32
|
+
</div>
|
33
|
+
</Desktop>
|
34
|
+
</div>
|
35
|
+
)
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Desktop with custom size
|
39
|
+
*/
|
40
|
+
export const CustomSizeDesktop = () => (
|
41
|
+
<div style={{ height: '400px', width: '800px', position: 'relative', overflow: 'hidden', margin: '0 auto', border: '2px solid #ccc' }}>
|
42
|
+
<Desktop desktopSize={{ width: 800, height: 400 }}>
|
43
|
+
<div style={{
|
44
|
+
position: 'absolute',
|
45
|
+
bottom: '20px',
|
46
|
+
left: '20px',
|
47
|
+
background: 'rgba(255,255,255,0.9)',
|
48
|
+
padding: '12px',
|
49
|
+
borderRadius: '4px',
|
50
|
+
fontSize: '12px'
|
51
|
+
}}>
|
52
|
+
<strong>Custom Size:</strong> 800x400px
|
53
|
+
</div>
|
54
|
+
</Desktop>
|
55
|
+
</div>
|
56
|
+
)
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Dark theme desktop
|
60
|
+
*/
|
61
|
+
export const DarkDesktop = () => (
|
62
|
+
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
63
|
+
<Desktop className="desktop--dark">
|
64
|
+
<div style={{
|
65
|
+
position: 'absolute',
|
66
|
+
top: '50%',
|
67
|
+
left: '50%',
|
68
|
+
transform: 'translate(-50%, -50%)',
|
69
|
+
background: 'rgba(0,0,0,0.8)',
|
70
|
+
color: 'white',
|
71
|
+
padding: '20px',
|
72
|
+
borderRadius: '8px',
|
73
|
+
textAlign: 'center',
|
74
|
+
maxWidth: '400px',
|
75
|
+
pointerEvents: 'none'
|
76
|
+
}}>
|
77
|
+
<h3>🌙 Dark Desktop</h3>
|
78
|
+
<p>Desktop with dark theme variant.</p>
|
79
|
+
<p>Create windows to see them on the dark background.</p>
|
80
|
+
</div>
|
81
|
+
</Desktop>
|
82
|
+
</div>
|
83
|
+
)
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Light theme desktop
|
87
|
+
*/
|
88
|
+
export const LightDesktop = () => (
|
89
|
+
<div style={{ height: '600px', width: '100%', position: 'relative', overflow: 'hidden' }}>
|
90
|
+
<Desktop className="desktop--light">
|
91
|
+
<div style={{
|
92
|
+
position: 'absolute',
|
93
|
+
top: '50%',
|
94
|
+
left: '50%',
|
95
|
+
transform: 'translate(-50%, -50%)',
|
96
|
+
background: 'rgba(255,255,255,0.9)',
|
97
|
+
color: '#333',
|
98
|
+
padding: '20px',
|
99
|
+
borderRadius: '8px',
|
100
|
+
textAlign: 'center',
|
101
|
+
maxWidth: '400px',
|
102
|
+
pointerEvents: 'none'
|
103
|
+
}}>
|
104
|
+
<h3>☀️ Light Desktop</h3>
|
105
|
+
<p>Desktop with light theme variant.</p>
|
106
|
+
<p>Clean and minimal appearance.</p>
|
107
|
+
</div>
|
108
|
+
</Desktop>
|
109
|
+
</div>
|
110
|
+
)
|
@@ -0,0 +1,135 @@
|
|
1
|
+
import React, { createContext, useContext, useState, useEffect, useRef } from 'react'
|
2
|
+
import { WindowManager } from './WindowManager'
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Context for WindowManager
|
6
|
+
*/
|
7
|
+
const WindowContext = createContext(null)
|
8
|
+
|
9
|
+
/**
|
10
|
+
* WindowProvider - Provides WindowManager to React components
|
11
|
+
*/
|
12
|
+
export const WindowProvider = ({ children, desktopSize }) => {
|
13
|
+
const windowManagerRef = useRef(null)
|
14
|
+
const [state, setState] = useState(null)
|
15
|
+
|
16
|
+
// Initialize WindowManager
|
17
|
+
useEffect(() => {
|
18
|
+
windowManagerRef.current = new WindowManager(desktopSize)
|
19
|
+
|
20
|
+
// Set initial state
|
21
|
+
setState(windowManagerRef.current.getState())
|
22
|
+
|
23
|
+
// Listen for changes
|
24
|
+
const handleStateChange = (newState) => {
|
25
|
+
setState(newState)
|
26
|
+
}
|
27
|
+
|
28
|
+
windowManagerRef.current.addListener(handleStateChange)
|
29
|
+
|
30
|
+
// Cleanup
|
31
|
+
return () => {
|
32
|
+
if (windowManagerRef.current) {
|
33
|
+
windowManagerRef.current.removeListener(handleStateChange)
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}, [])
|
37
|
+
|
38
|
+
// Update desktop size when prop changes
|
39
|
+
useEffect(() => {
|
40
|
+
if (windowManagerRef.current && desktopSize) {
|
41
|
+
windowManagerRef.current.setDesktopSize(desktopSize)
|
42
|
+
}
|
43
|
+
}, [desktopSize])
|
44
|
+
|
45
|
+
// Don't render until WindowManager is initialized
|
46
|
+
if (!state || !windowManagerRef.current) {
|
47
|
+
return null
|
48
|
+
}
|
49
|
+
|
50
|
+
const value = {
|
51
|
+
// Current state
|
52
|
+
windows: state.windows,
|
53
|
+
activeWindowId: state.activeWindowId,
|
54
|
+
desktopSize: state.desktopSize,
|
55
|
+
|
56
|
+
// WindowManager instance (for advanced usage)
|
57
|
+
windowManager: windowManagerRef.current,
|
58
|
+
|
59
|
+
// Convenience methods
|
60
|
+
createWindow: (config) => windowManagerRef.current.createWindow(config),
|
61
|
+
closeWindow: (id) => windowManagerRef.current.closeWindow(id),
|
62
|
+
focusWindow: (id) => windowManagerRef.current.focusWindow(id),
|
63
|
+
minimizeWindow: (id, minimize) => windowManagerRef.current.minimizeWindow(id, minimize),
|
64
|
+
maximizeWindow: (id, maximize) => windowManagerRef.current.maximizeWindow(id, maximize),
|
65
|
+
updateWindowPosition: (id, position) => windowManagerRef.current.updateWindowPosition(id, position),
|
66
|
+
|
67
|
+
// Window queries
|
68
|
+
getWindow: (id) => windowManagerRef.current.getWindow(id),
|
69
|
+
getAllWindows: () => windowManagerRef.current.getAllWindows(),
|
70
|
+
getVisibleWindows: () => windowManagerRef.current.getVisibleWindows(),
|
71
|
+
|
72
|
+
// Layout functions
|
73
|
+
cascadeWindows: () => windowManagerRef.current.cascadeWindows(),
|
74
|
+
tileWindows: () => windowManagerRef.current.tileWindows(),
|
75
|
+
centerWindow: (id) => windowManagerRef.current.centerWindow(id),
|
76
|
+
centerAllWindows: () => windowManagerRef.current.centerAllWindows(),
|
77
|
+
|
78
|
+
// Utility functions
|
79
|
+
clearAllWindows: () => windowManagerRef.current.clearAllWindows(),
|
80
|
+
getStats: () => windowManagerRef.current.getStats(),
|
81
|
+
setDesktopSize: (size) => windowManagerRef.current.setDesktopSize(size)
|
82
|
+
}
|
83
|
+
|
84
|
+
return (
|
85
|
+
<WindowContext.Provider value={value}>
|
86
|
+
{children}
|
87
|
+
</WindowContext.Provider>
|
88
|
+
)
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Hook to use WindowContext
|
93
|
+
*/
|
94
|
+
export const useWindows = () => {
|
95
|
+
const context = useContext(WindowContext)
|
96
|
+
if (!context) {
|
97
|
+
throw new Error('useWindows must be used within a WindowProvider')
|
98
|
+
}
|
99
|
+
return context
|
100
|
+
}
|
101
|
+
|
102
|
+
/**
|
103
|
+
* Hook to use a specific window
|
104
|
+
*/
|
105
|
+
export const useWindow = (windowId) => {
|
106
|
+
const { getWindow, updateWindowPosition, closeWindow, focusWindow, minimizeWindow, maximizeWindow } = useWindows()
|
107
|
+
|
108
|
+
const window = getWindow(windowId)
|
109
|
+
|
110
|
+
return {
|
111
|
+
window,
|
112
|
+
exists: !!window,
|
113
|
+
updatePosition: (position) => updateWindowPosition(windowId, position),
|
114
|
+
close: () => closeWindow(windowId),
|
115
|
+
focus: () => focusWindow(windowId),
|
116
|
+
minimize: (minimize) => minimizeWindow(windowId, minimize),
|
117
|
+
maximize: (maximize) => maximizeWindow(windowId, maximize)
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Hook to create windows easily
|
123
|
+
*/
|
124
|
+
export const useCreateWindow = () => {
|
125
|
+
const { createWindow } = useWindows()
|
126
|
+
return createWindow
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Hook for window statistics
|
131
|
+
*/
|
132
|
+
export const useWindowStats = () => {
|
133
|
+
const { getStats } = useWindows()
|
134
|
+
return getStats()
|
135
|
+
}
|