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
@@ -0,0 +1,355 @@
1
+ /**
2
+ * WindowManager - Manages the state of all windows
3
+ */
4
+ export class WindowManager {
5
+ constructor(desktopSize = { width: 1200, height: 800 }) {
6
+ this.windows = new Map()
7
+ this.activeWindowId = null
8
+ this.nextZIndex = 1000
9
+ this.listeners = new Set()
10
+ this.desktopSize = desktopSize
11
+ }
12
+
13
+ /**
14
+ * Add a listener for changes
15
+ */
16
+ addListener(listener) {
17
+ this.listeners.add(listener)
18
+ }
19
+
20
+ /**
21
+ * Remove a listener
22
+ */
23
+ removeListener(listener) {
24
+ this.listeners.delete(listener)
25
+ }
26
+
27
+ /**
28
+ * Notify all listeners about changes
29
+ */
30
+ notifyListeners() {
31
+ const state = this.getState()
32
+ this.listeners.forEach(listener => listener(state))
33
+ }
34
+
35
+ /**
36
+ * Update desktop size
37
+ */
38
+ setDesktopSize(size) {
39
+ const oldSize = this.desktopSize
40
+ this.desktopSize = size
41
+
42
+ // Reposition windows that are out of bounds
43
+ this.repositionWindowsInBounds()
44
+
45
+ this.notifyListeners()
46
+ return { oldSize, newSize: size }
47
+ }
48
+
49
+ /**
50
+ * Get current desktop size
51
+ */
52
+ getDesktopSize() {
53
+ return this.desktopSize
54
+ }
55
+
56
+ /**
57
+ * Get current state
58
+ */
59
+ getState() {
60
+ return {
61
+ windows: Array.from(this.windows.values()),
62
+ activeWindowId: this.activeWindowId,
63
+ desktopSize: this.desktopSize
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Create a new window
69
+ */
70
+ createWindow(config) {
71
+ const size = config.size || { width: 600, height: 400 }
72
+ const window = {
73
+ id: config.id || `window-${Date.now()}`,
74
+ title: config.title || 'New Window',
75
+ icon: config.icon || 'window',
76
+ position: config.position || this.calculatePosition(size),
77
+ size: size,
78
+ minimized: false,
79
+ maximized: false,
80
+ zIndex: this.nextZIndex++,
81
+ ...config
82
+ }
83
+
84
+ this.windows.set(window.id, window)
85
+ this.activeWindowId = window.id
86
+ this.notifyListeners()
87
+
88
+ return window.id
89
+ }
90
+
91
+ /**
92
+ * Calculate automatic position for new windows
93
+ */
94
+ calculatePosition(windowSize = { width: 600, height: 400 }) {
95
+ const existingWindows = Array.from(this.windows.values())
96
+ const baseX = 50
97
+ const baseY = 50
98
+ const offsetStep = 40
99
+
100
+ // Calculate cascade position
101
+ let x = baseX + (existingWindows.length * offsetStep)
102
+ let y = baseY + (existingWindows.length * offsetStep)
103
+
104
+ // Check if it goes out of desktop bounds
105
+ const maxX = this.desktopSize.width - windowSize.width - 20
106
+ const maxY = this.desktopSize.height - windowSize.height - 100 // Space for taskbar
107
+
108
+ // If out of bounds, restart cascade
109
+ if (x > maxX || y > maxY) {
110
+ const cascadeIndex = existingWindows.length % 8
111
+ x = baseX + (cascadeIndex * 30)
112
+ y = baseY + (cascadeIndex * 30)
113
+ }
114
+
115
+ return { x: Math.max(0, x), y: Math.max(0, y) }
116
+ }
117
+
118
+ /**
119
+ * Get a window by ID
120
+ */
121
+ getWindow(windowId) {
122
+ return this.windows.get(windowId)
123
+ }
124
+
125
+ /**
126
+ * Close a window
127
+ */
128
+ closeWindow(windowId) {
129
+ if (!this.windows.has(windowId)) return false
130
+
131
+ this.windows.delete(windowId)
132
+
133
+ // If it was the active window, activate another one
134
+ if (this.activeWindowId === windowId) {
135
+ const remaining = Array.from(this.windows.values())
136
+ this.activeWindowId = remaining.length > 0 ? remaining[0].id : null
137
+ }
138
+
139
+ this.notifyListeners()
140
+ return true
141
+ }
142
+
143
+ /**
144
+ * Focus a window
145
+ */
146
+ focusWindow(windowId) {
147
+ const window = this.windows.get(windowId)
148
+ if (!window) return false
149
+
150
+ // If minimized, restore it
151
+ if (window.minimized) {
152
+ window.minimized = false
153
+ }
154
+
155
+ // Bring to front
156
+ window.zIndex = this.nextZIndex++
157
+ this.activeWindowId = windowId
158
+
159
+ this.notifyListeners()
160
+ return true
161
+ }
162
+
163
+ /**
164
+ * Minimize a window
165
+ */
166
+ minimizeWindow(windowId, minimize = true) {
167
+ const window = this.windows.get(windowId)
168
+ if (!window) return false
169
+
170
+ window.minimized = minimize
171
+
172
+ // If minimizing the active window, find another one
173
+ if (minimize && this.activeWindowId === windowId) {
174
+ const visible = Array.from(this.windows.values()).filter(w => !w.minimized)
175
+ this.activeWindowId = visible.length > 0 ? visible[0].id : null
176
+ }
177
+
178
+ this.notifyListeners()
179
+ return true
180
+ }
181
+
182
+ /**
183
+ * Maximize a window
184
+ */
185
+ maximizeWindow(windowId, maximize = true) {
186
+ const window = this.windows.get(windowId)
187
+ if (!window) return false
188
+
189
+ window.maximized = maximize
190
+
191
+ // If maximizing, also focus it
192
+ if (maximize) {
193
+ this.focusWindow(windowId)
194
+ } else {
195
+ this.notifyListeners()
196
+ }
197
+
198
+ return true
199
+ }
200
+
201
+ /**
202
+ * Update window position
203
+ */
204
+ updateWindowPosition(windowId, position) {
205
+ const window = this.windows.get(windowId)
206
+ if (!window) return false
207
+
208
+ window.position = { ...window.position, ...position }
209
+ this.notifyListeners()
210
+ return true
211
+ }
212
+
213
+ /**
214
+ * Get all windows
215
+ */
216
+ getAllWindows() {
217
+ return Array.from(this.windows.values())
218
+ }
219
+
220
+ /**
221
+ * Get visible windows (not minimized)
222
+ */
223
+ getVisibleWindows() {
224
+ return Array.from(this.windows.values()).filter(w => !w.minimized)
225
+ }
226
+
227
+ /**
228
+ * Clear all windows
229
+ */
230
+ clearAllWindows() {
231
+ this.windows.clear()
232
+ this.activeWindowId = null
233
+ this.notifyListeners()
234
+ }
235
+
236
+ /**
237
+ * Reposition windows that are out of desktop bounds
238
+ */
239
+ repositionWindowsInBounds() {
240
+ this.windows.forEach(window => {
241
+ if (window.maximized) return // Maximized windows don't need repositioning
242
+
243
+ const maxX = this.desktopSize.width - window.size.width
244
+ const maxY = this.desktopSize.height - window.size.height - 50 // Space for taskbar
245
+
246
+ // Adjust position if out of bounds
247
+ if (window.position.x > maxX) {
248
+ window.position.x = Math.max(0, maxX)
249
+ }
250
+ if (window.position.y > maxY) {
251
+ window.position.y = Math.max(0, maxY)
252
+ }
253
+ })
254
+ }
255
+
256
+ /**
257
+ * Arrange windows in cascade
258
+ */
259
+ cascadeWindows() {
260
+ const visibleWindows = this.getVisibleWindows().filter(w => !w.maximized)
261
+ const baseX = 50
262
+ const baseY = 50
263
+ const offsetStep = 30
264
+
265
+ visibleWindows.forEach((window, index) => {
266
+ window.position = {
267
+ x: baseX + (index * offsetStep),
268
+ y: baseY + (index * offsetStep)
269
+ }
270
+ window.maximized = false
271
+ })
272
+
273
+ this.notifyListeners()
274
+ }
275
+
276
+ /**
277
+ * Arrange windows in tile layout
278
+ */
279
+ tileWindows() {
280
+ const visibleWindows = this.getVisibleWindows().filter(w => !w.maximized)
281
+ if (visibleWindows.length === 0) return
282
+
283
+ const cols = Math.ceil(Math.sqrt(visibleWindows.length))
284
+ const rows = Math.ceil(visibleWindows.length / cols)
285
+ const windowWidth = Math.floor(this.desktopSize.width / cols)
286
+ const windowHeight = Math.floor((this.desktopSize.height - 80) / rows) // Space for taskbar
287
+
288
+ visibleWindows.forEach((window, index) => {
289
+ const col = index % cols
290
+ const row = Math.floor(index / cols)
291
+
292
+ window.position = {
293
+ x: col * windowWidth,
294
+ y: row * windowHeight
295
+ }
296
+ window.size = {
297
+ width: windowWidth - 10, // Small margin
298
+ height: windowHeight - 10
299
+ }
300
+ window.maximized = false
301
+ })
302
+
303
+ this.notifyListeners()
304
+ }
305
+
306
+ /**
307
+ * Center a window on the desktop
308
+ */
309
+ centerWindow(windowId) {
310
+ const window = this.windows.get(windowId)
311
+ if (!window || window.maximized) return false
312
+
313
+ window.position = {
314
+ x: (this.desktopSize.width - window.size.width) / 2,
315
+ y: (this.desktopSize.height - window.size.height - 50) / 2 // Space for taskbar
316
+ }
317
+
318
+ this.notifyListeners()
319
+ return true
320
+ }
321
+
322
+ /**
323
+ * Center all visible windows
324
+ */
325
+ centerAllWindows() {
326
+ const visibleWindows = this.getVisibleWindows().filter(w => !w.maximized)
327
+ const offsetStep = 20
328
+
329
+ visibleWindows.forEach((window, index) => {
330
+ const baseX = (this.desktopSize.width - window.size.width) / 2
331
+ const baseY = (this.desktopSize.height - window.size.height - 50) / 2
332
+
333
+ window.position = {
334
+ x: baseX + (index * offsetStep),
335
+ y: baseY + (index * offsetStep)
336
+ }
337
+ })
338
+
339
+ this.notifyListeners()
340
+ }
341
+
342
+ /**
343
+ * Get statistics
344
+ */
345
+ getStats() {
346
+ const windows = this.getAllWindows()
347
+ return {
348
+ total: windows.length,
349
+ visible: windows.filter(w => !w.minimized).length,
350
+ minimized: windows.filter(w => w.minimized).length,
351
+ maximized: windows.filter(w => w.maximized).length,
352
+ desktopSize: this.desktopSize
353
+ }
354
+ }
355
+ }
@@ -1,6 +1,57 @@
1
+ /* Desktop Component Styles */
2
+
1
3
  .desktop {
2
- height: 100vh;
3
- width: 100vw;
4
- background-color: rgb(113, 102, 226);
5
- position: relative;
4
+ position: relative;
5
+ width: 100%;
6
+ height: 100%;
7
+ overflow: hidden;
8
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
9
+ user-select: none;
10
+ }
11
+
12
+ .desktop__background {
13
+ position: absolute;
14
+ top: 0;
15
+ left: 0;
16
+ width: 100%;
17
+ height: 100%;
18
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
19
+ z-index: 0;
20
+ }
21
+
22
+ .desktop__content {
23
+ position: relative;
24
+ width: 100%;
25
+ height: 100%;
26
+ z-index: 1;
27
+ }
28
+
29
+ /* Desktop variants */
30
+ .desktop--dark {
31
+ color: white;
32
+ }
33
+
34
+ .desktop--dark .desktop__background {
35
+ background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
36
+ }
37
+
38
+ .desktop--light {
39
+ color: #333;
40
+ }
41
+
42
+ .desktop--light .desktop__background {
43
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
44
+ }
45
+
46
+ /* Responsive design */
47
+ @media (max-width: 768px) {
48
+ .desktop {
49
+ font-size: 14px;
50
+ }
51
+ }
52
+
53
+ @media (max-width: 480px) {
54
+ .desktop {
55
+ font-size: 12px;
56
+ }
6
57
  }