ywana-core8 0.1.103 → 0.2.2

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 (172) hide show
  1. package/dist/index.css +4941 -324
  2. package/dist/index.js +42339 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.modern.js +37459 -31678
  5. package/dist/index.modern.js.map +1 -1
  6. package/dist/index.umd.js +39635 -34010
  7. package/dist/index.umd.js.map +1 -1
  8. package/package.json +26 -29
  9. package/src/Test.stories.jsx +28 -0
  10. package/src/desktop/Desktop.stories.jsx +110 -0
  11. package/src/desktop/WindowContext.js +135 -0
  12. package/src/desktop/WindowManager.js +355 -0
  13. package/src/desktop/desktop.css +55 -4
  14. package/src/desktop/desktop.js +312 -6
  15. package/src/desktop/index.js +7 -0
  16. package/src/desktop/window.css +229 -36
  17. package/src/desktop/window.js +255 -20
  18. package/src/desktop.backup/desktop.css +6 -0
  19. package/src/desktop.backup/desktop.js +13 -0
  20. package/src/desktop.backup/window.css +58 -0
  21. package/src/desktop.backup/window.js +27 -0
  22. package/src/html/Accordion.stories.jsx +178 -0
  23. package/src/html/Button.stories.jsx +175 -0
  24. package/src/html/Checkbox.stories.jsx +131 -0
  25. package/src/html/Chip.stories.jsx +189 -0
  26. package/src/html/Color.stories.jsx +234 -0
  27. package/src/html/Form.stories.jsx +271 -0
  28. package/src/html/Icon.stories.jsx +233 -0
  29. package/src/html/Progress.stories.jsx +247 -0
  30. package/src/html/Radio.stories.jsx +289 -0
  31. package/src/html/StyleTest.stories.jsx +81 -0
  32. package/src/html/Switch.stories.jsx +329 -0
  33. package/src/html/Tab.stories.jsx +239 -0
  34. package/src/html/Table.stories.jsx +188 -0
  35. package/src/html/Table2.stories.jsx +238 -0
  36. package/src/html/TextField2.stories.jsx +337 -0
  37. package/src/html/Tree.stories.jsx +285 -0
  38. package/src/html/accordion.example.js +0 -74
  39. package/src/html/accordion.js +1 -6
  40. package/src/html/button.js +2 -13
  41. package/src/html/checkbox.js +1 -9
  42. package/src/html/chip.js +2 -19
  43. package/src/html/color.js +1 -14
  44. package/src/html/form.js +4 -15
  45. package/src/html/header2.js +1 -12
  46. package/src/html/icon.js +1 -7
  47. package/src/html/index.js +1 -1
  48. package/src/html/list.js +1 -19
  49. package/src/html/menu.js +9 -5
  50. package/src/html/progress.js +5 -53
  51. package/src/html/property.js +9 -25
  52. package/src/html/radio.js +2 -16
  53. package/src/html/section.js +1 -6
  54. package/src/html/selector.js +2 -19
  55. package/src/html/switch.css +134 -100
  56. package/src/html/switch.example.js +46 -36
  57. package/src/html/switch.js +43 -192
  58. package/src/html/tab.js +3 -24
  59. package/src/html/text.js +1 -12
  60. package/src/html/textfield2.js +5 -42
  61. package/src/html/thumbnail.js +1 -12
  62. package/src/html/tokenfield.js +2 -21
  63. package/src/html/tree.js +3 -35
  64. package/src/index.js +1 -0
  65. package/__previewjs__/Wrapper.tsx +0 -14
  66. package/build-doc.sh +0 -10
  67. package/db/db.json +0 -89
  68. package/db/routes.json +0 -0
  69. package/dist/index.cjs +0 -36722
  70. package/dist/index.cjs.map +0 -1
  71. package/dist/index.css.map +0 -1
  72. package/doc/README.md +0 -196
  73. package/doc/evalulations/ACCORDION_EVALUATION.md +0 -583
  74. package/doc/evalulations/CHECKBOX_EVALUATION.md +0 -273
  75. package/doc/evalulations/CHIP_EVALUATION.md +0 -542
  76. package/doc/evalulations/COLOR_EVALUATION.md +0 -524
  77. package/doc/evalulations/COMPONENTS_EVALUATION.md +0 -477
  78. package/doc/evalulations/FORM_EVALUATION.md +0 -459
  79. package/doc/evalulations/HEADER_EVALUATION.md +0 -436
  80. package/doc/evalulations/ICON_EVALUATION.md +0 -254
  81. package/doc/evalulations/LIST_EVALUATION.md +0 -574
  82. package/doc/evalulations/PROGRESS_EVALUATION.md +0 -450
  83. package/doc/evalulations/RADIO_EVALUATION.md +0 -439
  84. package/doc/evalulations/RADIO_VISUAL_FIX.md +0 -183
  85. package/doc/evalulations/SECTION_IMPROVEMENTS.md +0 -153
  86. package/doc/evalulations/SWITCH_EVALUATION.md +0 -335
  87. package/doc/evalulations/SWITCH_VISUAL_FIX.md +0 -232
  88. package/doc/evalulations/TAB_EVALUATION.md +0 -626
  89. package/doc/evalulations/TEXTFIELD_EVALUATION.md +0 -747
  90. package/doc/evalulations/TOOLTIP_FIX.md +0 -157
  91. package/doc/evalulations/TREE_EVALUATION.md +0 -708
  92. package/doc/index.html +0 -0
  93. package/doc/package-lock.json +0 -17298
  94. package/doc/package.json +0 -34
  95. package/doc/public/index.html +0 -24
  96. package/doc/scripts/generate-examples.js +0 -129
  97. package/doc/src/App.css +0 -171
  98. package/doc/src/App.js +0 -114
  99. package/doc/src/components/ExamplePage.js +0 -129
  100. package/doc/src/components/WelcomePage.js +0 -84
  101. package/doc/src/index.css +0 -246
  102. package/doc/src/index.js +0 -17
  103. package/doc/src/theme.css +0 -256
  104. package/jest.config.js +0 -24
  105. package/preview.config.js +0 -38
  106. package/publish.sh +0 -6
  107. package/src/desktop/dektop.test.js +0 -11
  108. package/src/domain/CollectionAPI.test.js +0 -19
  109. package/src/domain/ContentEditor.test.js +0 -52
  110. package/src/domain2/CollectionAPI.test.js +0 -19
  111. package/src/domain2/CollectionContext.test.js +0 -71
  112. package/src/domain2/CollectionPage.test.js +0 -112
  113. package/src/domain2/DynamicForm.test.js +0 -47
  114. package/src/html/accordion.test.js +0 -37
  115. package/src/html/accordion.unit.test.js +0 -334
  116. package/src/html/button.example.new.js +0 -416
  117. package/src/html/button.test.js +0 -422
  118. package/src/html/checkbox.test.js +0 -285
  119. package/src/html/chip.test.js +0 -425
  120. package/src/html/color.example.js.backup +0 -527
  121. package/src/html/color.test.js +0 -377
  122. package/src/html/components.example.js.backup +0 -492
  123. package/src/html/components_enhanced.test.js +0 -581
  124. package/src/html/form.example.js.backup +0 -385
  125. package/src/html/form.test.js +0 -369
  126. package/src/html/header2.example.js.backup +0 -411
  127. package/src/html/header2.test.js +0 -377
  128. package/src/html/icon.example.js.backup +0 -268
  129. package/src/html/icon.test.js +0 -231
  130. package/src/html/label.test.js +0 -0
  131. package/src/html/list.example.js.backup +0 -404
  132. package/src/html/list.test.js +0 -383
  133. package/src/html/progress.example.js.backup +0 -424
  134. package/src/html/progress.test.js +0 -313
  135. package/src/html/property.example.js.backup +0 -553
  136. package/src/html/property.test.js +0 -371
  137. package/src/html/radio.example.js.backup +0 -389
  138. package/src/html/radio.test.js +0 -318
  139. package/src/html/section.example.js.backup +0 -99
  140. package/src/html/section.test.js +0 -131
  141. package/src/html/selector.test.js +0 -20
  142. package/src/html/switch.example.js.backup +0 -461
  143. package/src/html/switch.test.js +0 -355
  144. package/src/html/tab.example.js.backup +0 -446
  145. package/src/html/tab.test.js +0 -25
  146. package/src/html/tab_enhanced.test.js +0 -504
  147. package/src/html/table.test.js +0 -70
  148. package/src/html/table2.test.js +0 -582
  149. package/src/html/text.test.js +0 -15
  150. package/src/html/textfield.test.js +0 -51
  151. package/src/html/textfield2.example.js.backup +0 -1370
  152. package/src/html/textfield2.test.js +0 -950
  153. package/src/html/tokenfield.example.js.backup +0 -503
  154. package/src/html/tokenfield.test.js +0 -423
  155. package/src/html/tree.example.js.backup +0 -475
  156. package/src/html/tree.test.js +0 -43
  157. package/src/html/tree_enhanced.test.js +0 -495
  158. package/src/http/token.test.js +0 -50
  159. package/src/incubator/pdfViewer.js +0 -33
  160. package/src/incubator/wizard.test.js +0 -127
  161. package/src/site/site.test.js +0 -230
  162. package/src/site/view.test.js +0 -41
  163. package/src/widgets/calendar/Calendar.test.js +0 -28
  164. package/src/widgets/explorer/Explorer.test.js +0 -121
  165. package/src/widgets/ide/editor.test.js +0 -33
  166. package/src/widgets/kanban/Kanban.test.js +0 -78
  167. package/src/widgets/login/LoginBox.test.js +0 -12
  168. package/src/widgets/login/ResetPasswordBox.test.js +0 -34
  169. package/src/widgets/login/validations.test.js +0 -51
  170. package/src/widgets/planner/Planner.test.js +0 -60
  171. package/src/widgets/upload/Upload.test.js +0 -32
  172. 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.103",
3
+ "version": "0.2.2",
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
- "previewjs": {
13
- "framework": "react",
14
- "react": {
15
- "version": 17
16
- }
17
- },
12
+ "files": [
13
+ "dist",
14
+ "src",
15
+ "README.md"
16
+ ],
18
17
  "scripts": {
19
- "build": "microbundle --no-compress --jsx React.createElement",
20
- "dev": "microbundle watch --no-compress --jsx React.createElement",
21
- "test": "jest",
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": "17.x",
32
- "react-dom": "17.x"
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
- "@testing-library/jest-dom": "^6.6.4",
38
- "@testing-library/react": "^12.1.5",
39
- "@testing-library/user-event": "^14.6.1",
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
- "microbundle": "^0.14.2",
46
- "react": "^17.0.2",
47
- "react-dom": "^17.0.2",
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": "^3.4.1",
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.1",
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
+ }