@tachui/core 0.7.1-alpha → 0.8.0-alpha

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 (265) hide show
  1. package/README.md +2 -2
  2. package/dist/bundles/common.d.ts +1 -1
  3. package/dist/bundles/common.d.ts.map +1 -1
  4. package/dist/bundles/minimal.d.ts +2 -16
  5. package/dist/bundles/minimal.d.ts.map +1 -1
  6. package/dist/bundles/production-minimal.d.ts +2 -16
  7. package/dist/bundles/production-minimal.d.ts.map +1 -1
  8. package/dist/common.js +403 -827
  9. package/dist/compiler/advanced-parser.d.ts.map +1 -1
  10. package/dist/compiler/index.js +14 -8
  11. package/dist/component-XAzF1xqs.js +487 -0
  12. package/dist/component-base-x2XmHFjy.js +255 -0
  13. package/dist/components/index.d.ts +4 -38
  14. package/dist/components/index.d.ts.map +1 -1
  15. package/dist/components/index.js +7 -4167
  16. package/dist/components/wrapper.d.ts +5 -152
  17. package/dist/components/wrapper.d.ts.map +1 -1
  18. package/dist/concatenated-component-ByPl3_FF.js +2933 -0
  19. package/dist/constants/index.d.ts +1 -1
  20. package/dist/constants/layout.d.ts +47 -4
  21. package/dist/constants/layout.d.ts.map +1 -1
  22. package/dist/constants/layout.js +84 -0
  23. package/dist/css-classes/index.js +176 -0
  24. package/dist/{dom-bridge-Cx-s6Ihx.js → dom-bridge-CAa1N2zX.js} +28 -28
  25. package/dist/{effect-CytAc9em.js → effect-B9Knft0b.js} +3 -3
  26. package/dist/essential.js +395 -825
  27. package/dist/index-DCPJFUm9.js +1407 -0
  28. package/dist/index-DIvMCJQO.js +268 -0
  29. package/dist/index-vdsiw6gQ.js +777 -0
  30. package/dist/index.d.ts +9 -9
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +395 -825
  33. package/dist/minimal-prod.js +101 -155
  34. package/dist/minimal.js +104 -170
  35. package/dist/modifiers/background.d.ts +41 -11
  36. package/dist/modifiers/background.d.ts.map +1 -1
  37. package/dist/modifiers/base.d.ts +6 -33
  38. package/dist/modifiers/base.d.ts.map +1 -1
  39. package/dist/modifiers/base.js +487 -0
  40. package/dist/modifiers/builder.d.ts +103 -195
  41. package/dist/modifiers/builder.d.ts.map +1 -1
  42. package/dist/modifiers/builder.js +9 -0
  43. package/dist/modifiers/core.d.ts +9 -401
  44. package/dist/modifiers/core.d.ts.map +1 -1
  45. package/dist/modifiers/{utils.d.ts → factories.d.ts} +18 -5
  46. package/dist/modifiers/factories.d.ts.map +1 -0
  47. package/dist/modifiers/index.d.ts +8 -52
  48. package/dist/modifiers/index.d.ts.map +1 -1
  49. package/dist/modifiers/index.js +38 -0
  50. package/dist/modifiers/presets.d.ts +368 -0
  51. package/dist/modifiers/presets.d.ts.map +1 -0
  52. package/dist/modifiers/registry.js +10 -0
  53. package/dist/modifiers/types.d.ts +39 -211
  54. package/dist/modifiers/types.d.ts.map +1 -1
  55. package/dist/modifiers/types.js +4 -0
  56. package/dist/performance-optimizer-stub-CtfXUwl4.js +38 -0
  57. package/dist/plugins/index.d.ts +5 -6
  58. package/dist/plugins/index.d.ts.map +1 -1
  59. package/dist/plugins/index.js +147 -297
  60. package/dist/plugins/simplified-index.d.ts +5 -6
  61. package/dist/plugins/simplified-index.d.ts.map +1 -1
  62. package/dist/production-minimal-BY_gMc-l.js +2532 -0
  63. package/dist/reactive/index.js +96 -95
  64. package/dist/reactive/types.js +4 -0
  65. package/dist/runtime/dom-bridge.js +5 -5
  66. package/dist/runtime/element-override.d.ts.map +1 -1
  67. package/dist/runtime/index.d.ts +0 -7
  68. package/dist/runtime/index.d.ts.map +1 -1
  69. package/dist/runtime/renderer.d.ts.map +1 -1
  70. package/dist/runtime/renderer.js +7 -8
  71. package/dist/runtime/semantic-role-manager.d.ts.map +1 -1
  72. package/dist/runtime/types.js +1 -0
  73. package/dist/{scheduler-7SvC3a21.js → scheduler-BKeqwrYE.js} +130 -130
  74. package/dist/validation/build-time-stub.d.ts +33 -0
  75. package/dist/validation/build-time-stub.d.ts.map +1 -0
  76. package/dist/validation/debug-tools-stub.d.ts +67 -0
  77. package/dist/validation/debug-tools-stub.d.ts.map +1 -0
  78. package/dist/validation/index.d.ts +23 -78
  79. package/dist/validation/index.d.ts.map +1 -1
  80. package/dist/validation/index.js +609 -6470
  81. package/dist/validation/lifecycle-validation.d.ts.map +1 -1
  82. package/dist/validation/performance-optimizer-stub.d.ts +50 -0
  83. package/dist/validation/performance-optimizer-stub.d.ts.map +1 -0
  84. package/dist/validation/plugin-registration.d.ts +5 -1
  85. package/dist/validation/plugin-registration.d.ts.map +1 -1
  86. package/dist/validation/production-bypass-core.d.ts +69 -0
  87. package/dist/validation/production-bypass-core.d.ts.map +1 -0
  88. package/package.json +41 -5
  89. package/dist/ScrollView-h-6wYMAm.js +0 -515
  90. package/dist/Spacer-BbteDQ9I.js +0 -5337
  91. package/dist/binding-CmdpowkI.js +0 -2276
  92. package/dist/components/BasicInput.d.ts +0 -116
  93. package/dist/components/BasicInput.d.ts.map +0 -1
  94. package/dist/components/Button.d.ts +0 -252
  95. package/dist/components/Button.d.ts.map +0 -1
  96. package/dist/components/Divider.d.ts +0 -141
  97. package/dist/components/Divider.d.ts.map +0 -1
  98. package/dist/components/EnhancedLink.d.ts +0 -365
  99. package/dist/components/EnhancedLink.d.ts.map +0 -1
  100. package/dist/components/Form.d.ts +0 -141
  101. package/dist/components/Form.d.ts.map +0 -1
  102. package/dist/components/Grid.d.ts +0 -698
  103. package/dist/components/Grid.d.ts.map +0 -1
  104. package/dist/components/GridResponsive.d.ts +0 -214
  105. package/dist/components/GridResponsive.d.ts.map +0 -1
  106. package/dist/components/Image.d.ts +0 -162
  107. package/dist/components/Image.d.ts.map +0 -1
  108. package/dist/components/List.d.ts +0 -287
  109. package/dist/components/List.d.ts.map +0 -1
  110. package/dist/components/Menu.d.ts +0 -159
  111. package/dist/components/Menu.d.ts.map +0 -1
  112. package/dist/components/Picker.d.ts +0 -153
  113. package/dist/components/Picker.d.ts.map +0 -1
  114. package/dist/components/ScrollView.d.ts +0 -222
  115. package/dist/components/ScrollView.d.ts.map +0 -1
  116. package/dist/components/Section.d.ts +0 -153
  117. package/dist/components/Section.d.ts.map +0 -1
  118. package/dist/components/Show.d.ts +0 -64
  119. package/dist/components/Show.d.ts.map +0 -1
  120. package/dist/components/Spacer.d.ts +0 -35
  121. package/dist/components/Spacer.d.ts.map +0 -1
  122. package/dist/components/Text.d.ts +0 -242
  123. package/dist/components/Text.d.ts.map +0 -1
  124. package/dist/components/Toggle.d.ts +0 -207
  125. package/dist/components/Toggle.d.ts.map +0 -1
  126. package/dist/concatenated-component-DPcl2TEO.js +0 -6779
  127. package/dist/context--zQFIImS.js +0 -283
  128. package/dist/debug/index.d.ts +0 -61
  129. package/dist/debug/index.d.ts.map +0 -1
  130. package/dist/debug.js +0 -178
  131. package/dist/developer-experience/enhanced-errors.d.ts +0 -128
  132. package/dist/developer-experience/enhanced-errors.d.ts.map +0 -1
  133. package/dist/developer-experience/enhanced-types.d.ts +0 -281
  134. package/dist/developer-experience/enhanced-types.d.ts.map +0 -1
  135. package/dist/developer-experience/index.d.ts +0 -44
  136. package/dist/developer-experience/index.d.ts.map +0 -1
  137. package/dist/index-Nfi2SBQh.js +0 -3268
  138. package/dist/modifiers/attributes.d.ts +0 -203
  139. package/dist/modifiers/attributes.d.ts.map +0 -1
  140. package/dist/modifiers/backdrop.d.ts +0 -59
  141. package/dist/modifiers/backdrop.d.ts.map +0 -1
  142. package/dist/modifiers/border.d.ts +0 -217
  143. package/dist/modifiers/border.d.ts.map +0 -1
  144. package/dist/modifiers/effects.d.ts +0 -159
  145. package/dist/modifiers/effects.d.ts.map +0 -1
  146. package/dist/modifiers/elements.d.ts +0 -240
  147. package/dist/modifiers/elements.d.ts.map +0 -1
  148. package/dist/modifiers/filters.d.ts +0 -275
  149. package/dist/modifiers/filters.d.ts.map +0 -1
  150. package/dist/modifiers/flexbox.d.ts +0 -82
  151. package/dist/modifiers/flexbox.d.ts.map +0 -1
  152. package/dist/modifiers/font.d.ts +0 -71
  153. package/dist/modifiers/font.d.ts.map +0 -1
  154. package/dist/modifiers/grid.d.ts +0 -92
  155. package/dist/modifiers/grid.d.ts.map +0 -1
  156. package/dist/modifiers/margin.d.ts +0 -128
  157. package/dist/modifiers/margin.d.ts.map +0 -1
  158. package/dist/modifiers/padding.d.ts +0 -204
  159. package/dist/modifiers/padding.d.ts.map +0 -1
  160. package/dist/modifiers/responsive/advanced-utilities.d.ts +0 -118
  161. package/dist/modifiers/responsive/advanced-utilities.d.ts.map +0 -1
  162. package/dist/modifiers/responsive/breakpoints.d.ts +0 -81
  163. package/dist/modifiers/responsive/breakpoints.d.ts.map +0 -1
  164. package/dist/modifiers/responsive/css-generator.d.ts +0 -100
  165. package/dist/modifiers/responsive/css-generator.d.ts.map +0 -1
  166. package/dist/modifiers/responsive/dev-tools.d.ts +0 -107
  167. package/dist/modifiers/responsive/dev-tools.d.ts.map +0 -1
  168. package/dist/modifiers/responsive/index.d.ts +0 -29
  169. package/dist/modifiers/responsive/index.d.ts.map +0 -1
  170. package/dist/modifiers/responsive/layout-patterns.d.ts +0 -230
  171. package/dist/modifiers/responsive/layout-patterns.d.ts.map +0 -1
  172. package/dist/modifiers/responsive/performance.d.ts +0 -130
  173. package/dist/modifiers/responsive/performance.d.ts.map +0 -1
  174. package/dist/modifiers/responsive/responsive-builder.d.ts +0 -133
  175. package/dist/modifiers/responsive/responsive-builder.d.ts.map +0 -1
  176. package/dist/modifiers/responsive/responsive-modifier.d.ts +0 -123
  177. package/dist/modifiers/responsive/responsive-modifier.d.ts.map +0 -1
  178. package/dist/modifiers/responsive/types.d.ts +0 -183
  179. package/dist/modifiers/responsive/types.d.ts.map +0 -1
  180. package/dist/modifiers/responsive/utilities.d.ts +0 -149
  181. package/dist/modifiers/responsive/utilities.d.ts.map +0 -1
  182. package/dist/modifiers/scroll.d.ts +0 -143
  183. package/dist/modifiers/scroll.d.ts.map +0 -1
  184. package/dist/modifiers/shadows.d.ts +0 -114
  185. package/dist/modifiers/shadows.d.ts.map +0 -1
  186. package/dist/modifiers/size.d.ts +0 -113
  187. package/dist/modifiers/size.d.ts.map +0 -1
  188. package/dist/modifiers/text.d.ts +0 -147
  189. package/dist/modifiers/text.d.ts.map +0 -1
  190. package/dist/modifiers/transformations.d.ts +0 -329
  191. package/dist/modifiers/transformations.d.ts.map +0 -1
  192. package/dist/modifiers/transitions.d.ts +0 -98
  193. package/dist/modifiers/transitions.d.ts.map +0 -1
  194. package/dist/modifiers/typography.d.ts +0 -192
  195. package/dist/modifiers/typography.d.ts.map +0 -1
  196. package/dist/modifiers/utility.d.ts +0 -69
  197. package/dist/modifiers/utility.d.ts.map +0 -1
  198. package/dist/modifiers/utils.d.ts.map +0 -1
  199. package/dist/plugins/simplified-error-handler.d.ts +0 -83
  200. package/dist/plugins/simplified-error-handler.d.ts.map +0 -1
  201. package/dist/runtime/dev-tools.d.ts +0 -240
  202. package/dist/runtime/dev-tools.d.ts.map +0 -1
  203. package/dist/runtime/development-warnings.d.ts +0 -42
  204. package/dist/runtime/development-warnings.d.ts.map +0 -1
  205. package/dist/runtime/error-boundary.d.ts +0 -302
  206. package/dist/runtime/error-boundary.d.ts.map +0 -1
  207. package/dist/runtime/error-recovery.d.ts +0 -267
  208. package/dist/runtime/error-recovery.d.ts.map +0 -1
  209. package/dist/runtime/error-reporting.d.ts +0 -287
  210. package/dist/runtime/error-reporting.d.ts.map +0 -1
  211. package/dist/runtime/error-utils.d.ts +0 -204
  212. package/dist/runtime/error-utils.d.ts.map +0 -1
  213. package/dist/runtime/performance.d.ts +0 -217
  214. package/dist/runtime/performance.d.ts.map +0 -1
  215. package/dist/sui-compat.d.ts +0 -110
  216. package/dist/sui-compat.d.ts.map +0 -1
  217. package/dist/validation/advanced-debugging.d.ts +0 -319
  218. package/dist/validation/advanced-debugging.d.ts.map +0 -1
  219. package/dist/validation/build-time/detection.d.ts +0 -32
  220. package/dist/validation/build-time/detection.d.ts.map +0 -1
  221. package/dist/validation/build-time/index.d.ts +0 -84
  222. package/dist/validation/build-time/index.d.ts.map +0 -1
  223. package/dist/validation/build-time/plugins.d.ts +0 -75
  224. package/dist/validation/build-time/plugins.d.ts.map +0 -1
  225. package/dist/validation/build-time/rules.d.ts +0 -73
  226. package/dist/validation/build-time/rules.d.ts.map +0 -1
  227. package/dist/validation/build-time/transformer.d.ts +0 -23
  228. package/dist/validation/build-time/transformer.d.ts.map +0 -1
  229. package/dist/validation/build-time/types.d.ts +0 -212
  230. package/dist/validation/build-time/types.d.ts.map +0 -1
  231. package/dist/validation/comprehensive.d.ts +0 -160
  232. package/dist/validation/comprehensive.d.ts.map +0 -1
  233. package/dist/validation/debug-tools.d.ts +0 -251
  234. package/dist/validation/debug-tools.d.ts.map +0 -1
  235. package/dist/validation/developer-experience.d.ts +0 -243
  236. package/dist/validation/developer-experience.d.ts.map +0 -1
  237. package/dist/validation/documentation-integration.d.ts +0 -269
  238. package/dist/validation/documentation-integration.d.ts.map +0 -1
  239. package/dist/validation/enhanced-runtime.d.ts +0 -279
  240. package/dist/validation/enhanced-runtime.d.ts.map +0 -1
  241. package/dist/validation/error-reporting.d.ts +0 -186
  242. package/dist/validation/error-reporting.d.ts.map +0 -1
  243. package/dist/validation/ide-integration.d.ts +0 -328
  244. package/dist/validation/ide-integration.d.ts.map +0 -1
  245. package/dist/validation/performance-optimizer.d.ts +0 -218
  246. package/dist/validation/performance-optimizer.d.ts.map +0 -1
  247. package/dist/validation/production-bypass.d.ts +0 -175
  248. package/dist/validation/production-bypass.d.ts.map +0 -1
  249. package/dist/validation/simple.d.ts +0 -111
  250. package/dist/validation/simple.d.ts.map +0 -1
  251. package/dist/viewport/adapters/web-adapter.d.ts +0 -227
  252. package/dist/viewport/adapters/web-adapter.d.ts.map +0 -1
  253. package/dist/viewport/components.d.ts +0 -131
  254. package/dist/viewport/components.d.ts.map +0 -1
  255. package/dist/viewport/environment.d.ts +0 -75
  256. package/dist/viewport/environment.d.ts.map +0 -1
  257. package/dist/viewport/index.d.ts +0 -138
  258. package/dist/viewport/index.d.ts.map +0 -1
  259. package/dist/viewport/index.js +0 -2085
  260. package/dist/viewport/platform-detection.d.ts +0 -59
  261. package/dist/viewport/platform-detection.d.ts.map +0 -1
  262. package/dist/viewport/types.d.ts +0 -301
  263. package/dist/viewport/types.d.ts.map +0 -1
  264. package/dist/viewport/viewport-manager.d.ts +0 -118
  265. package/dist/viewport/viewport-manager.d.ts.map +0 -1
@@ -1,2085 +0,0 @@
1
- import { a as O, w as G } from "../dom-bridge-Cx-s6Ihx.js";
2
- import { a as C, q as D } from "../scheduler-7SvC3a21.js";
3
- import { a as F, u as N } from "../context--zQFIImS.js";
4
- function M(n = {}) {
5
- const e = L(), t = $(e, n), i = q(), s = X(), r = J();
6
- return {
7
- platform: e,
8
- capabilities: t,
9
- userAgent: i,
10
- screenSize: s,
11
- isTouch: r
12
- };
13
- }
14
- function L() {
15
- return V() ? "electron" : U() ? "mobile" : R() ? "embedded" : "web";
16
- }
17
- function V() {
18
- return typeof window < "u" ? !!window.electronAPI || !!window.electron || !!window.require || navigator.userAgent.toLowerCase().includes("electron") : typeof process < "u" ? !!process.electron || !!process.versions?.electron || process.env.ELECTRON === "true" : !1;
19
- }
20
- function U() {
21
- if (typeof window > "u") return !1;
22
- const n = "ontouchstart" in window && !("onmousedown" in window), e = window.innerWidth <= 768 || window.innerHeight <= 768, t = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
23
- navigator.userAgent
24
- ), i = window.matchMedia?.("(pointer: coarse)")?.matches, s = window.matchMedia?.("(max-width: 768px)")?.matches;
25
- return n || e && t || i || s;
26
- }
27
- function R() {
28
- if (typeof window > "u") return !1;
29
- try {
30
- return window.self !== window.top;
31
- } catch {
32
- return !0;
33
- }
34
- }
35
- function $(n, e) {
36
- const t = {
37
- multiWindow: !1,
38
- nativeWindows: !1,
39
- modalOverlays: !0,
40
- crossWindowCommunication: !1,
41
- windowResizing: !1,
42
- windowMinimizing: !1,
43
- fullscreenSupport: !1,
44
- menuBarSupport: !1
45
- };
46
- switch (n) {
47
- case "electron":
48
- return {
49
- ...t,
50
- multiWindow: !0,
51
- nativeWindows: !0,
52
- crossWindowCommunication: !0,
53
- windowResizing: !0,
54
- windowMinimizing: !0,
55
- fullscreenSupport: !0,
56
- menuBarSupport: !0
57
- };
58
- case "web":
59
- return {
60
- ...t,
61
- multiWindow: e.enablePopupTest ? B() : !1,
62
- crossWindowCommunication: K() || j(),
63
- fullscreenSupport: k(),
64
- windowResizing: !1,
65
- // Browser windows can't be resized programmatically
66
- windowMinimizing: !1
67
- };
68
- case "mobile":
69
- return {
70
- ...t,
71
- fullscreenSupport: k(),
72
- modalOverlays: !0
73
- };
74
- case "embedded":
75
- return {
76
- ...t,
77
- modalOverlays: !0
78
- };
79
- default:
80
- return t;
81
- }
82
- }
83
- function B() {
84
- if (typeof window > "u" || typeof window.navigator < "u" && window.navigator.userAgent.includes("jsdom"))
85
- return !1;
86
- try {
87
- const n = window.open("", "", "width=1,height=1");
88
- return n ? (n.close(), !0) : !1;
89
- } catch {
90
- return !1;
91
- }
92
- }
93
- function K() {
94
- return typeof window < "u" && "BroadcastChannel" in window;
95
- }
96
- function j() {
97
- return typeof window < "u" && "MessageChannel" in window;
98
- }
99
- function k() {
100
- return typeof document > "u" ? !1 : !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
101
- }
102
- function q() {
103
- return typeof navigator > "u" ? "unknown" : navigator.userAgent;
104
- }
105
- function X() {
106
- return typeof window > "u" ? { width: 1920, height: 1080 } : {
107
- width: window.screen?.width || window.innerWidth || 1920,
108
- height: window.screen?.height || window.innerHeight || 1080
109
- };
110
- }
111
- function J() {
112
- return typeof window > "u" ? !1 : "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
113
- }
114
- function Z() {
115
- if (typeof navigator > "u")
116
- return {
117
- name: "unknown",
118
- version: "unknown",
119
- engine: "unknown"
120
- };
121
- const n = navigator.userAgent;
122
- let e = "unknown", t = "unknown", i = "unknown";
123
- if (n.includes("Chrome")) {
124
- e = "Chrome";
125
- const s = n.match(/Chrome\/(\d+)/);
126
- t = s ? s[1] : "unknown", i = "Blink";
127
- } else if (n.includes("Firefox")) {
128
- e = "Firefox";
129
- const s = n.match(/Firefox\/(\d+)/);
130
- t = s ? s[1] : "unknown", i = "Gecko";
131
- } else if (n.includes("Safari") && !n.includes("Chrome")) {
132
- e = "Safari";
133
- const s = n.match(/Version\/(\d+)/);
134
- t = s ? s[1] : "unknown", i = "WebKit";
135
- } else if (n.includes("Edge")) {
136
- e = "Edge";
137
- const s = n.match(/Edge\/(\d+)/) || n.match(/Edg\/(\d+)/);
138
- t = s ? s[1] : "unknown", i = "Blink";
139
- }
140
- return { name: e, version: t, engine: i };
141
- }
142
- function Q() {
143
- if (typeof navigator > "u")
144
- return {
145
- name: "unknown",
146
- version: "unknown"
147
- };
148
- const n = navigator.userAgent;
149
- let e = "unknown", t = "unknown";
150
- if (n.includes("Windows"))
151
- e = "Windows", n.includes("Windows NT 10.0") ? t = "10/11" : n.includes("Windows NT 6.3") ? t = "8.1" : n.includes("Windows NT 6.2") ? t = "8" : n.includes("Windows NT 6.1") && (t = "7");
152
- else if (n.includes("Mac OS X")) {
153
- e = "macOS";
154
- const i = n.match(/Mac OS X (\d+_\d+_?\d*)/);
155
- i && (t = i[1].replace(/_/g, "."));
156
- } else if (n.includes("Linux"))
157
- e = "Linux";
158
- else if (n.includes("Android")) {
159
- e = "Android";
160
- const i = n.match(/Android (\d+\.?\d*\.?\d*)/);
161
- t = i ? i[1] : "unknown";
162
- } else if (n.includes("iPhone OS") || n.includes("OS ")) {
163
- e = "iOS";
164
- const i = n.match(/OS (\d+_\d+_?\d*)/);
165
- i && (t = i[1].replace(/_/g, "."));
166
- }
167
- return { name: e, version: t };
168
- }
169
- function Y() {
170
- return typeof window > "u" ? {
171
- webgl: !1,
172
- webgl2: !1,
173
- webWorkers: !1,
174
- serviceWorkers: !1,
175
- pushNotifications: !1,
176
- webAssembly: !1,
177
- intersectionObserver: !1,
178
- resizeObserver: !1
179
- } : {
180
- webgl: !!window.WebGLRenderingContext,
181
- webgl2: !!window.WebGL2RenderingContext,
182
- webWorkers: "Worker" in window,
183
- serviceWorkers: "serviceWorker" in navigator,
184
- pushNotifications: "PushManager" in window,
185
- webAssembly: "WebAssembly" in window,
186
- intersectionObserver: "IntersectionObserver" in window,
187
- resizeObserver: "ResizeObserver" in window
188
- };
189
- }
190
- function E(n) {
191
- return {
192
- canOpenWindow: (e = !1) => e ? n.capabilities.nativeWindows : n.capabilities.multiWindow || n.capabilities.modalOverlays,
193
- canCommunicateBetweenWindows: () => n.capabilities.crossWindowCommunication,
194
- canResizeWindows: () => n.capabilities.windowResizing,
195
- canMinimizeWindows: () => n.capabilities.windowMinimizing,
196
- canUseFullscreen: () => n.capabilities.fullscreenSupport,
197
- canUseMenuBar: () => n.capabilities.menuBarSupport,
198
- getOptimalViewportType: (e = !1) => e && n.capabilities.nativeWindows ? "window" : n.capabilities.modalOverlays ? "modal" : n.platform === "mobile" ? "sheet" : "portal"
199
- };
200
- }
201
- class ee {
202
- // Fallback strategies
203
- createModal(e) {
204
- throw new Error("Modal fallback not implemented");
205
- }
206
- createPortal(e) {
207
- throw new Error("Portal fallback not implemented");
208
- }
209
- }
210
- var te = Object.defineProperty, ne = (n, e, t) => e in n ? te(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, a = (n, e, t) => ne(n, typeof e != "symbol" ? e + "" : e, t);
211
- class S extends ee {
212
- constructor(e = {}) {
213
- super(), a(this, "environment"), a(this, "portals", /* @__PURE__ */ new Map()), a(this, "modals", /* @__PURE__ */ new Map()), a(this, "popups", /* @__PURE__ */ new Map()), a(this, "portalContainer", null), a(this, "broadcastChannel", null), this.environment = M(e), this.initializePortalContainer();
214
- }
215
- /**
216
- * Check if we can create a window with given config
217
- */
218
- canCreateWindow(e) {
219
- if (!e.preferNativeWindow)
220
- return !0;
221
- try {
222
- return this.environment.capabilities.multiWindow;
223
- } catch {
224
- return !1;
225
- }
226
- }
227
- /**
228
- * Create a viewport instance
229
- */
230
- createWindow(e) {
231
- switch (this.determineWindowType(e)) {
232
- case "window":
233
- return this.createPopupWindow(e);
234
- case "modal":
235
- return this.createModal(e);
236
- case "portal":
237
- return this.createPortal(e);
238
- default:
239
- return this.createModal(e);
240
- }
241
- }
242
- /**
243
- * Destroy a window
244
- */
245
- async destroyWindow(e) {
246
- const t = this.portals.get(e);
247
- if (t) {
248
- t.dispose(), this.portals.delete(e);
249
- return;
250
- }
251
- const i = this.modals.get(e);
252
- if (i) {
253
- i.dispose(), this.modals.delete(e);
254
- return;
255
- }
256
- const s = this.popups.get(e);
257
- if (s) {
258
- s.dispose(), this.popups.delete(e);
259
- return;
260
- }
261
- }
262
- /**
263
- * Set up cross-window communication
264
- */
265
- setupCrossWindowCommunication() {
266
- if ("BroadcastChannel" in window)
267
- this.broadcastChannel = new BroadcastChannel("tachui-viewport"), this.broadcastChannel.addEventListener("message", (e) => {
268
- this.handleCrossWindowMessage(e.data);
269
- });
270
- else {
271
- const e = (t) => {
272
- if (t.key === "tachui-viewport-message")
273
- try {
274
- const i = JSON.parse(t.newValue || "{}");
275
- this.handleCrossWindowMessage(i);
276
- } catch {
277
- }
278
- };
279
- typeof window < "u" && window.addEventListener("storage", e);
280
- }
281
- }
282
- /**
283
- * Broadcast message to other windows
284
- */
285
- broadcastMessage(e, t) {
286
- const i = {
287
- ...e,
288
- timestamp: Date.now(),
289
- source: window.location.href
290
- };
291
- this.broadcastChannel ? this.broadcastChannel.postMessage(i) : (localStorage.setItem("tachui-viewport-message", JSON.stringify(i)), setTimeout(() => {
292
- localStorage.removeItem("tachui-viewport-message");
293
- }, 100));
294
- }
295
- /**
296
- * Optimize for web platform
297
- */
298
- optimizeForPlatform() {
299
- document.documentElement.style.setProperty("--tachui-modal-backdrop-blur", "8px"), document.documentElement.style.setProperty("--tachui-modal-animation-duration", "200ms"), document.documentElement.style.setProperty("--tachui-modal-z-index", "1000"), this.injectGlobalStyles();
300
- }
301
- /**
302
- * Create popup window (native browser window)
303
- */
304
- createPopupWindow(e) {
305
- const t = new ie(e);
306
- return this.popups.set(e.id, t), t;
307
- }
308
- /**
309
- * Create modal overlay
310
- */
311
- createModal(e) {
312
- const t = new se(e);
313
- return this.modals.set(e.id, t), t;
314
- }
315
- /**
316
- * Create portal
317
- */
318
- createPortal(e) {
319
- const t = new ae(e, this.portalContainer);
320
- return this.portals.set(e.id, t), t;
321
- }
322
- /**
323
- * Determine optimal window type
324
- */
325
- determineWindowType(e) {
326
- return e.preferNativeWindow && this.environment.capabilities.multiWindow ? "window" : e.modal !== !1 ? "modal" : "portal";
327
- }
328
- /**
329
- * Initialize portal container
330
- */
331
- initializePortalContainer() {
332
- let e = document.getElementById("app");
333
- if (e) {
334
- this.portalContainer = e;
335
- return;
336
- }
337
- e = document.getElementById("tachui-portals"), e || (e = document.createElement("div"), e.id = "tachui-portals", e.style.position = "relative", e.style.zIndex = "999", document.body.appendChild(e)), this.portalContainer = e;
338
- }
339
- /**
340
- * Handle cross-window messages
341
- */
342
- handleCrossWindowMessage(e) {
343
- this.portals.forEach((t) => t.receiveMessage(e)), this.modals.forEach((t) => t.receiveMessage(e)), this.popups.forEach((t) => t.receiveMessage(e));
344
- }
345
- /**
346
- * Inject global CSS styles
347
- */
348
- injectGlobalStyles() {
349
- const e = "tachui-viewport-styles";
350
- if (document.getElementById(e))
351
- return;
352
- const t = document.createElement("style");
353
- t.id = e, t.textContent = `
354
- .tachui-modal-backdrop {
355
- position: fixed;
356
- top: 0;
357
- left: 0;
358
- right: 0;
359
- bottom: 0;
360
- background: rgba(0, 0, 0, 0.5);
361
- backdrop-filter: blur(var(--tachui-modal-backdrop-blur, 8px));
362
- z-index: var(--tachui-modal-z-index, 1000);
363
- display: flex;
364
- align-items: center;
365
- justify-content: center;
366
- animation: tachui-fade-in var(--tachui-modal-animation-duration, 200ms) ease-out;
367
- }
368
-
369
- .tachui-modal-content {
370
- background: white;
371
- border-radius: 8px;
372
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
373
- max-width: 90vw;
374
- max-height: 90vh;
375
- overflow: auto;
376
- animation: tachui-scale-in var(--tachui-modal-animation-duration, 200ms) ease-out;
377
- }
378
-
379
- .tachui-portal {
380
- position: relative;
381
- }
382
-
383
- @keyframes tachui-fade-in {
384
- from {
385
- opacity: 0;
386
- }
387
- to {
388
- opacity: 1;
389
- }
390
- }
391
-
392
- @keyframes tachui-scale-in {
393
- from {
394
- opacity: 0;
395
- transform: scale(0.95);
396
- }
397
- to {
398
- opacity: 1;
399
- transform: scale(1);
400
- }
401
- }
402
-
403
- @media (prefers-reduced-motion: reduce) {
404
- .tachui-modal-backdrop,
405
- .tachui-modal-content {
406
- animation: none;
407
- }
408
- }
409
- `, document.head.appendChild(t);
410
- }
411
- }
412
- class ie {
413
- constructor(e) {
414
- a(this, "id"), a(this, "type", "window"), a(this, "config"), a(this, "state"), a(this, "nativeWindow", null), a(this, "messageHandlers", /* @__PURE__ */ new Set()), a(this, "eventHandlers", /* @__PURE__ */ new Map()), a(this, "setState"), this.id = e.id, this.config = e;
415
- const [t, i] = C({
416
- id: e.id,
417
- title: e.title || e.id,
418
- isVisible: !1,
419
- isMinimized: !1,
420
- isMaximized: !1,
421
- isFullscreen: !1,
422
- isFocused: !1,
423
- bounds: {
424
- x: e.x || 100,
425
- y: e.y || 100,
426
- width: e.width || 800,
427
- height: e.height || 600
428
- },
429
- // Phase 2: Enhanced state properties
430
- isPooled: !1,
431
- lastUsed: Date.now(),
432
- groupId: void 0,
433
- tabIndex: void 0,
434
- parentWindowId: void 0
435
- });
436
- this.state = t, this.setState = i;
437
- }
438
- render(e) {
439
- this.nativeWindow && (this.nativeWindow.document.title = this.config.title || this.config.id);
440
- }
441
- async show() {
442
- if (this.nativeWindow && !this.nativeWindow.closed) {
443
- this.nativeWindow.focus();
444
- return;
445
- }
446
- const e = this.buildWindowFeatures();
447
- if (this.nativeWindow = window.open("", this.config.id, e), !this.nativeWindow)
448
- throw new Error("Failed to open popup window (likely blocked by popup blocker)");
449
- this.setupPopupEventHandlers(), this.setState((t) => ({
450
- ...t,
451
- isVisible: !0,
452
- isFocused: !0
453
- }));
454
- }
455
- async hide() {
456
- this.nativeWindow && !this.nativeWindow.closed && this.nativeWindow.blur();
457
- }
458
- async focus() {
459
- this.nativeWindow && !this.nativeWindow.closed && this.nativeWindow.focus();
460
- }
461
- async minimize() {
462
- }
463
- async maximize() {
464
- }
465
- async restore() {
466
- }
467
- async close() {
468
- this.nativeWindow && !this.nativeWindow.closed && this.nativeWindow.close(), this.dispose();
469
- }
470
- dispose() {
471
- this.messageHandlers.clear(), this.eventHandlers.clear(), this.nativeWindow = null;
472
- }
473
- postMessage(e) {
474
- this.nativeWindow && !this.nativeWindow.closed && this.nativeWindow.postMessage(e, "*");
475
- }
476
- onMessage(e) {
477
- return this.messageHandlers.add(e), () => this.messageHandlers.delete(e);
478
- }
479
- receiveMessage(e) {
480
- this.messageHandlers.forEach((t) => t(e));
481
- }
482
- onShow(e) {
483
- return this.addEventListener("show", e);
484
- }
485
- onHide(e) {
486
- return this.addEventListener("hide", e);
487
- }
488
- onFocus(e) {
489
- return this.addEventListener("focus", e);
490
- }
491
- onBlur(e) {
492
- return this.addEventListener("blur", e);
493
- }
494
- onResize(e) {
495
- return () => {
496
- };
497
- }
498
- onClose(e) {
499
- return this.addEventListener("close", e);
500
- }
501
- addEventListener(e, t) {
502
- return this.eventHandlers.has(e) || this.eventHandlers.set(e, /* @__PURE__ */ new Set()), this.eventHandlers.get(e).add(t), () => {
503
- this.eventHandlers.get(e)?.delete(t);
504
- };
505
- }
506
- emit(e) {
507
- const t = this.eventHandlers.get(e);
508
- t && t.forEach((i) => i());
509
- }
510
- buildWindowFeatures() {
511
- const e = [];
512
- return this.config.width && e.push(`width=${this.config.width}`), this.config.height && e.push(`height=${this.config.height}`), this.config.x && e.push(`left=${this.config.x}`), this.config.y && e.push(`top=${this.config.y}`), e.push(`resizable=${this.config.resizable !== !1 ? "yes" : "no"}`), e.push("scrollbars=yes"), e.push("status=no"), e.push("toolbar=no"), e.push("menubar=no"), e.push("location=no"), e.join(",");
513
- }
514
- setupPopupEventHandlers() {
515
- if (!this.nativeWindow) return;
516
- const e = () => {
517
- if (this.nativeWindow?.closed) {
518
- this.emit("close");
519
- return;
520
- }
521
- setTimeout(e, 1e3);
522
- };
523
- e(), window.addEventListener("message", (t) => {
524
- t.source === this.nativeWindow && this.messageHandlers.forEach((i) => i(t.data));
525
- });
526
- }
527
- // ==================== Phase 2: Enhanced Methods ====================
528
- /**
529
- * Window pooling and reuse
530
- */
531
- async prepareForReuse() {
532
- this.nativeWindow && !this.nativeWindow.closed && (this.nativeWindow.document.body.innerHTML = "", this.nativeWindow.document.title = ""), this.messageHandlers.clear();
533
- }
534
- isReusable() {
535
- return this.nativeWindow != null && !this.nativeWindow.closed;
536
- }
537
- markAsUsed() {
538
- this.setState((e) => ({
539
- ...e,
540
- lastUsed: Date.now()
541
- }));
542
- }
543
- async returnToPool() {
544
- await this.hide(), this.setState((e) => ({
545
- ...e,
546
- isPooled: !0,
547
- lastUsed: Date.now()
548
- }));
549
- }
550
- /**
551
- * State synchronization (limited in popup windows due to cross-origin restrictions)
552
- */
553
- syncState(e, t) {
554
- if (!(!this.nativeWindow || this.nativeWindow.closed))
555
- try {
556
- this.nativeWindow.postMessage({ type: "sync_state", key: e, value: t }, "*");
557
- } catch (i) {
558
- console.warn("Failed to sync state to popup window:", i);
559
- }
560
- }
561
- getSharedState(e) {
562
- }
563
- onSharedStateChange(e, t) {
564
- return () => {
565
- };
566
- }
567
- /**
568
- * Tab grouping (not supported for popup windows)
569
- */
570
- async attachToTab(e) {
571
- throw new Error("Tab grouping not supported for popup windows");
572
- }
573
- async detachFromTab() {
574
- return this;
575
- }
576
- getTabContainer() {
577
- return null;
578
- }
579
- getTabIndex() {
580
- return this.state().tabIndex || 0;
581
- }
582
- setTabIndex(e) {
583
- this.setState((t) => ({
584
- ...t,
585
- tabIndex: e
586
- }));
587
- }
588
- /**
589
- * Parent-child relationships (limited for popup windows)
590
- */
591
- setParentWindow(e) {
592
- this.setState((t) => ({
593
- ...t,
594
- parentWindowId: e.id
595
- }));
596
- }
597
- getParentWindow() {
598
- return null;
599
- }
600
- getChildWindows() {
601
- return [];
602
- }
603
- addChildWindow(e) {
604
- }
605
- removeChildWindow(e) {
606
- }
607
- }
608
- class se {
609
- constructor(e) {
610
- a(this, "id"), a(this, "type", "modal"), a(this, "config"), a(this, "state"), a(this, "backdropElement", null), a(this, "contentElement", null), a(this, "messageHandlers", /* @__PURE__ */ new Set()), a(this, "eventHandlers", /* @__PURE__ */ new Map()), a(this, "setState"), a(this, "sharedState", /* @__PURE__ */ new Map()), a(this, "stateChangeCallbacks", /* @__PURE__ */ new Map()), a(this, "childWindows", /* @__PURE__ */ new Map()), a(this, "parentWindow", null), a(this, "tabContainer", null), this.id = e.id, this.config = e;
611
- const [t, i] = C({
612
- id: e.id,
613
- title: e.title || e.id,
614
- isVisible: !1,
615
- isMinimized: !1,
616
- isMaximized: !1,
617
- isFullscreen: !1,
618
- isFocused: !1,
619
- bounds: {
620
- x: 0,
621
- y: 0,
622
- width: e.width || 600,
623
- height: e.height || 400
624
- },
625
- zIndex: 1e3,
626
- // Phase 2: Enhanced state properties
627
- isPooled: !1,
628
- lastUsed: Date.now(),
629
- groupId: void 0,
630
- tabIndex: void 0,
631
- parentWindowId: void 0
632
- });
633
- this.state = t, this.setState = i, this.createElement();
634
- }
635
- render(e) {
636
- this.contentElement && (this.contentElement.innerHTML = `<div>Modal: ${this.config.title}</div>`);
637
- }
638
- async show() {
639
- this.backdropElement && (document.body.appendChild(this.backdropElement), this.setState((e) => ({
640
- ...e,
641
- isVisible: !0,
642
- isFocused: !0
643
- })), this.emit("show"));
644
- }
645
- async hide() {
646
- this.backdropElement?.parentNode && this.backdropElement.parentNode.removeChild(this.backdropElement), this.setState((e) => ({
647
- ...e,
648
- isVisible: !1,
649
- isFocused: !1
650
- })), this.emit("hide");
651
- }
652
- async focus() {
653
- this.contentElement && this.contentElement.focus(), this.emit("focus");
654
- }
655
- async minimize() {
656
- await this.hide();
657
- }
658
- async maximize() {
659
- }
660
- async restore() {
661
- await this.show();
662
- }
663
- async close() {
664
- await this.hide(), this.emit("close"), this.dispose();
665
- }
666
- dispose() {
667
- this.backdropElement?.parentNode && this.backdropElement.parentNode.removeChild(this.backdropElement), this.messageHandlers.clear(), this.eventHandlers.clear();
668
- }
669
- postMessage(e) {
670
- }
671
- onMessage(e) {
672
- return this.messageHandlers.add(e), () => this.messageHandlers.delete(e);
673
- }
674
- receiveMessage(e) {
675
- this.messageHandlers.forEach((t) => t(e));
676
- }
677
- onShow(e) {
678
- return this.addEventListener("show", e);
679
- }
680
- onHide(e) {
681
- return this.addEventListener("hide", e);
682
- }
683
- onFocus(e) {
684
- return this.addEventListener("focus", e);
685
- }
686
- onBlur(e) {
687
- return this.addEventListener("blur", e);
688
- }
689
- onResize(e) {
690
- return () => {
691
- };
692
- }
693
- onClose(e) {
694
- return this.addEventListener("close", e);
695
- }
696
- addEventListener(e, t) {
697
- return this.eventHandlers.has(e) || this.eventHandlers.set(e, /* @__PURE__ */ new Set()), this.eventHandlers.get(e).add(t), () => {
698
- this.eventHandlers.get(e)?.delete(t);
699
- };
700
- }
701
- emit(e) {
702
- const t = this.eventHandlers.get(e);
703
- t && t.forEach((i) => i());
704
- }
705
- createElement() {
706
- this.backdropElement = document.createElement("div"), this.backdropElement.className = "tachui-modal-backdrop", this.contentElement = document.createElement("div"), this.contentElement.className = "tachui-modal-content", this.contentElement.style.width = `${this.config.width || 600}px`, this.contentElement.style.height = `${this.config.height || 400}px`, this.backdropElement.appendChild(this.contentElement), this.backdropElement.addEventListener("click", (e) => {
707
- e.target === this.backdropElement && this.config.backdropDismiss !== !1 && this.close();
708
- }), document.addEventListener("keydown", (e) => {
709
- e.key === "Escape" && this.config.escapeKeyDismiss !== !1 && this.close();
710
- });
711
- }
712
- /**
713
- * Window pooling and reuse
714
- */
715
- async prepareForReuse() {
716
- this.contentElement && (this.contentElement.innerHTML = ""), this.messageHandlers.clear(), this.sharedState.clear(), this.stateChangeCallbacks.clear();
717
- }
718
- isReusable() {
719
- return this.backdropElement != null && this.contentElement != null;
720
- }
721
- markAsUsed() {
722
- this.setState((e) => ({
723
- ...e,
724
- lastUsed: Date.now()
725
- }));
726
- }
727
- async returnToPool() {
728
- await this.hide(), this.setState((e) => ({
729
- ...e,
730
- isPooled: !0,
731
- lastUsed: Date.now()
732
- }));
733
- }
734
- /**
735
- * State synchronization (full support for modals)
736
- */
737
- syncState(e, t) {
738
- this.sharedState.set(e, t);
739
- const i = this.stateChangeCallbacks.get(e);
740
- i && i.forEach((s) => s(t)), this.childWindows.forEach((s) => {
741
- s.syncState(e, t);
742
- });
743
- }
744
- getSharedState(e) {
745
- return this.sharedState.get(e);
746
- }
747
- onSharedStateChange(e, t) {
748
- return this.stateChangeCallbacks.has(e) || this.stateChangeCallbacks.set(e, /* @__PURE__ */ new Set()), this.stateChangeCallbacks.get(e).add(t), () => {
749
- this.stateChangeCallbacks.get(e)?.delete(t);
750
- };
751
- }
752
- /**
753
- * Tab grouping (web modal tab simulation)
754
- */
755
- async attachToTab(e) {
756
- this.tabContainer = e, this.createTabInterface();
757
- }
758
- async detachFromTab() {
759
- return this.tabContainer = null, this.removeTabInterface(), this;
760
- }
761
- getTabContainer() {
762
- return this.tabContainer;
763
- }
764
- getTabIndex() {
765
- return this.state().tabIndex || 0;
766
- }
767
- setTabIndex(e) {
768
- this.setState((t) => ({
769
- ...t,
770
- tabIndex: e
771
- }));
772
- }
773
- /**
774
- * Parent-child relationships (full support for modals)
775
- */
776
- setParentWindow(e) {
777
- this.parentWindow = e, this.setState((t) => ({
778
- ...t,
779
- parentWindowId: e.id
780
- }));
781
- }
782
- getParentWindow() {
783
- return this.parentWindow;
784
- }
785
- getChildWindows() {
786
- return Array.from(this.childWindows.values());
787
- }
788
- addChildWindow(e) {
789
- this.childWindows.set(e.id, e), e.setParentWindow(this);
790
- }
791
- removeChildWindow(e) {
792
- this.childWindows.delete(e);
793
- }
794
- /**
795
- * Tab interface helpers
796
- */
797
- createTabInterface() {
798
- if (!this.contentElement || !this.tabContainer) return;
799
- const e = document.createElement("div");
800
- e.className = "tachui-modal-tab-header", e.style.cssText = `
801
- display: flex;
802
- border-bottom: 1px solid #e0e0e0;
803
- background: #f5f5f5;
804
- min-height: 40px;
805
- `, this.contentElement.insertBefore(e, this.contentElement.firstChild);
806
- }
807
- removeTabInterface() {
808
- if (!this.contentElement) return;
809
- const e = this.contentElement.querySelector(".tachui-modal-tab-header");
810
- e && e.remove();
811
- }
812
- }
813
- class ae {
814
- constructor(e, t) {
815
- this.container = t, a(this, "id"), a(this, "type", "portal"), a(this, "config"), a(this, "state"), a(this, "portalElement", null), a(this, "messageHandlers", /* @__PURE__ */ new Set()), a(this, "eventHandlers", /* @__PURE__ */ new Map()), a(this, "cleanupFunction", null), a(this, "setState"), a(this, "sharedState", /* @__PURE__ */ new Map()), a(this, "stateChangeCallbacks", /* @__PURE__ */ new Map()), a(this, "childWindows", /* @__PURE__ */ new Map()), a(this, "parentWindow", null), a(this, "tabContainer", null), this.id = e.id, this.config = e;
816
- const [i, s] = C({
817
- id: e.id,
818
- title: e.title || e.id,
819
- isVisible: !1,
820
- isMinimized: !1,
821
- isMaximized: !1,
822
- isFullscreen: !1,
823
- isFocused: !1,
824
- bounds: {
825
- x: e.x || 0,
826
- y: e.y || 0,
827
- width: e.width || 400,
828
- height: e.height || 300
829
- },
830
- // Phase 2: Enhanced state properties
831
- isPooled: !1,
832
- lastUsed: Date.now(),
833
- groupId: void 0,
834
- tabIndex: void 0,
835
- parentWindowId: void 0
836
- });
837
- this.state = i, this.setState = s, this.createElement();
838
- }
839
- render(e) {
840
- if (this.portalElement) {
841
- this.portalElement.innerHTML = "";
842
- try {
843
- const t = O(e, this.portalElement);
844
- this.cleanupFunction = t;
845
- } catch (t) {
846
- console.error("Error during mountComponentTree:", t);
847
- }
848
- }
849
- }
850
- async show() {
851
- this.portalElement && (this.container.id === "app" && (this.container.innerHTML = ""), this.container.appendChild(this.portalElement), this.portalElement.style.display = "block", this.setState((e) => ({
852
- ...e,
853
- isVisible: !0
854
- })), this.emit("show"));
855
- }
856
- async hide() {
857
- this.portalElement && (this.portalElement.style.display = "none"), this.setState((e) => ({
858
- ...e,
859
- isVisible: !1
860
- })), this.emit("hide");
861
- }
862
- async focus() {
863
- this.emit("focus");
864
- }
865
- async minimize() {
866
- await this.hide();
867
- }
868
- async maximize() {
869
- }
870
- async restore() {
871
- await this.show();
872
- }
873
- async close() {
874
- this.portalElement?.parentNode && this.portalElement.parentNode.removeChild(this.portalElement), this.emit("close"), this.dispose();
875
- }
876
- dispose() {
877
- this.cleanupFunction && (this.cleanupFunction(), this.cleanupFunction = null), this.portalElement?.parentNode && this.portalElement.parentNode.removeChild(this.portalElement), this.messageHandlers.clear(), this.eventHandlers.clear();
878
- }
879
- postMessage(e) {
880
- }
881
- onMessage(e) {
882
- return this.messageHandlers.add(e), () => this.messageHandlers.delete(e);
883
- }
884
- receiveMessage(e) {
885
- this.messageHandlers.forEach((t) => t(e));
886
- }
887
- onShow(e) {
888
- return this.addEventListener("show", e);
889
- }
890
- onHide(e) {
891
- return this.addEventListener("hide", e);
892
- }
893
- onFocus(e) {
894
- return this.addEventListener("focus", e);
895
- }
896
- onBlur(e) {
897
- return this.addEventListener("blur", e);
898
- }
899
- onResize(e) {
900
- return () => {
901
- };
902
- }
903
- onClose(e) {
904
- return this.addEventListener("close", e);
905
- }
906
- addEventListener(e, t) {
907
- return this.eventHandlers.has(e) || this.eventHandlers.set(e, /* @__PURE__ */ new Set()), this.eventHandlers.get(e).add(t), () => {
908
- this.eventHandlers.get(e)?.delete(t);
909
- };
910
- }
911
- emit(e) {
912
- const t = this.eventHandlers.get(e);
913
- t && t.forEach((i) => i());
914
- }
915
- createElement() {
916
- this.portalElement = document.createElement("div"), this.portalElement.className = "tachui-portal", this.container && this.container.id === "app" ? (this.portalElement.style.position = "static", this.portalElement.style.width = "100%", this.portalElement.style.height = "auto", this.portalElement.style.background = "transparent", this.portalElement.style.border = "none", this.portalElement.style.display = "block") : (this.portalElement.style.position = "absolute", this.portalElement.style.left = `${this.config.x || 0}px`, this.portalElement.style.top = `${this.config.y || 0}px`, this.portalElement.style.width = `${this.config.width || 400}px`, this.portalElement.style.height = `${this.config.height || 300}px`, this.portalElement.style.background = "white", this.portalElement.style.border = "1px solid #ccc", this.portalElement.style.borderRadius = "8px", this.portalElement.style.boxShadow = "0 4px 12px rgba(0, 0, 0, 0.15)", this.portalElement.style.display = "none");
917
- }
918
- /**
919
- * Window pooling and reuse (excellent for portals)
920
- */
921
- async prepareForReuse() {
922
- this.portalElement && (this.portalElement.innerHTML = ""), this.messageHandlers.clear(), this.sharedState.clear(), this.stateChangeCallbacks.clear();
923
- }
924
- isReusable() {
925
- return this.portalElement != null;
926
- }
927
- markAsUsed() {
928
- this.setState((e) => ({
929
- ...e,
930
- lastUsed: Date.now()
931
- }));
932
- }
933
- async returnToPool() {
934
- await this.hide(), this.setState((e) => ({
935
- ...e,
936
- isPooled: !0,
937
- lastUsed: Date.now()
938
- }));
939
- }
940
- /**
941
- * State synchronization (full support for portals)
942
- */
943
- syncState(e, t) {
944
- this.sharedState.set(e, t);
945
- const i = this.stateChangeCallbacks.get(e);
946
- i && i.forEach((s) => s(t)), this.childWindows.forEach((s) => {
947
- s.syncState(e, t);
948
- });
949
- }
950
- getSharedState(e) {
951
- return this.sharedState.get(e);
952
- }
953
- onSharedStateChange(e, t) {
954
- return this.stateChangeCallbacks.has(e) || this.stateChangeCallbacks.set(e, /* @__PURE__ */ new Set()), this.stateChangeCallbacks.get(e).add(t), () => {
955
- this.stateChangeCallbacks.get(e)?.delete(t);
956
- };
957
- }
958
- /**
959
- * Tab grouping (portal-based tab simulation)
960
- */
961
- async attachToTab(e) {
962
- this.tabContainer = e, this.createPortalTabInterface();
963
- }
964
- async detachFromTab() {
965
- return this.tabContainer = null, this.removePortalTabInterface(), this;
966
- }
967
- getTabContainer() {
968
- return this.tabContainer;
969
- }
970
- getTabIndex() {
971
- return this.state().tabIndex || 0;
972
- }
973
- setTabIndex(e) {
974
- this.setState((t) => ({
975
- ...t,
976
- tabIndex: e
977
- }));
978
- }
979
- /**
980
- * Parent-child relationships (full support for portals)
981
- */
982
- setParentWindow(e) {
983
- this.parentWindow = e, this.setState((t) => ({
984
- ...t,
985
- parentWindowId: e.id
986
- }));
987
- }
988
- getParentWindow() {
989
- return this.parentWindow;
990
- }
991
- getChildWindows() {
992
- return Array.from(this.childWindows.values());
993
- }
994
- addChildWindow(e) {
995
- this.childWindows.set(e.id, e), e.setParentWindow(this);
996
- }
997
- removeChildWindow(e) {
998
- this.childWindows.delete(e);
999
- }
1000
- /**
1001
- * Portal tab interface helpers
1002
- */
1003
- createPortalTabInterface() {
1004
- if (!this.portalElement || !this.tabContainer) return;
1005
- const e = document.createElement("div");
1006
- e.className = "tachui-portal-tab-header", e.style.cssText = `
1007
- display: flex;
1008
- background: #f8f9fa;
1009
- border-bottom: 1px solid #dee2e6;
1010
- min-height: 36px;
1011
- padding: 0 8px;
1012
- align-items: center;
1013
- `, this.portalElement.insertBefore(e, this.portalElement.firstChild);
1014
- }
1015
- removePortalTabInterface() {
1016
- if (!this.portalElement) return;
1017
- const e = this.portalElement.querySelector(".tachui-portal-tab-header");
1018
- e && e.remove();
1019
- }
1020
- }
1021
- var oe = Object.defineProperty, re = (n, e, t) => e in n ? oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, l = (n, e, t) => re(n, typeof e != "symbol" ? e + "" : e, t);
1022
- class x {
1023
- constructor(e, t = {}) {
1024
- l(this, "adapter"), l(this, "windows", /* @__PURE__ */ new Map()), l(this, "windowGroups", /* @__PURE__ */ new Map()), l(this, "eventHandlers", /* @__PURE__ */ new Map()), l(this, "globalState", /* @__PURE__ */ new Map()), l(this, "globalStateCallbacks", /* @__PURE__ */ new Map()), l(this, "environment"), l(this, "platformConfig"), this.platformConfig = t, this.environment = M(t), e ? this.adapter = e : this.adapter = this.createDefaultAdapter(), this.adapter.setupCrossWindowCommunication(), this.adapter.optimizeForPlatform();
1025
- }
1026
- /**
1027
- * Open a new window/viewport
1028
- */
1029
- async openWindow(e, t, i = {}) {
1030
- const s = this.windows.get(e);
1031
- if (s)
1032
- return await s.show(), await s.focus(), s;
1033
- const r = {
1034
- id: e,
1035
- title: i.title || e,
1036
- width: i.width || 800,
1037
- height: i.height || 600,
1038
- ...i
1039
- };
1040
- this.getOptimalWindowType(i);
1041
- const o = this.adapter.createWindow(r);
1042
- return this.windows.set(e, o), o.render(t), this.setupWindowEventHandlers(o), await o.show(), this.emit("window:opened", { window: o }), o;
1043
- }
1044
- /**
1045
- * Dismiss/close a window
1046
- */
1047
- async dismissWindow(e) {
1048
- const t = this.windows.get(e);
1049
- if (!t)
1050
- throw new Error(`Window with id '${e}' not found`);
1051
- await t.close(), this.windows.delete(e), this.emit("window:closed", { windowId: e });
1052
- }
1053
- /**
1054
- * Get a specific window
1055
- */
1056
- getWindow(e) {
1057
- return this.windows.get(e) || null;
1058
- }
1059
- /**
1060
- * Get all open windows
1061
- */
1062
- getAllWindows() {
1063
- return Array.from(this.windows.values());
1064
- }
1065
- /**
1066
- * Create a window group for data-driven window management
1067
- */
1068
- createWindowGroup(e) {
1069
- if (this.windowGroups.has(e))
1070
- return this.windowGroups.get(e);
1071
- const t = new de(e, this);
1072
- return this.windowGroups.set(e, t), t;
1073
- }
1074
- /**
1075
- * Check if we can open a window with given options
1076
- */
1077
- canOpenWindow(e = {}) {
1078
- return E(this.environment).canOpenWindow(e.preferNativeWindow);
1079
- }
1080
- /**
1081
- * Get optimal window type for given options
1082
- */
1083
- getOptimalWindowType(e = {}) {
1084
- const t = E(this.environment);
1085
- return e.preferNativeWindow && this.environment.capabilities.nativeWindows ? "window" : e.modal !== !1 && this.environment.capabilities.modalOverlays ? "modal" : t.getOptimalViewportType(e.preferNativeWindow);
1086
- }
1087
- /**
1088
- * Event handling
1089
- */
1090
- onWindowOpened(e) {
1091
- return this.on("window:opened", ({ window: t }) => e(t));
1092
- }
1093
- onWindowClosed(e) {
1094
- return this.on("window:closed", ({ windowId: t }) => e(t));
1095
- }
1096
- /**
1097
- * Generic event subscription
1098
- */
1099
- on(e, t) {
1100
- return this.eventHandlers.has(e) || this.eventHandlers.set(e, /* @__PURE__ */ new Set()), this.eventHandlers.get(e).add(t), () => {
1101
- this.eventHandlers.get(e)?.delete(t);
1102
- };
1103
- }
1104
- /**
1105
- * Emit an event to all handlers
1106
- */
1107
- emit(e, t) {
1108
- const i = this.eventHandlers.get(e);
1109
- i && i.forEach((s) => s(t));
1110
- }
1111
- /**
1112
- * Set up event handlers for a window
1113
- */
1114
- setupWindowEventHandlers(e) {
1115
- e.onFocus(() => {
1116
- this.emit("window:focused", { windowId: e.id });
1117
- }), e.onResize((t) => {
1118
- this.emit("window:resized", { windowId: e.id, bounds: t });
1119
- }), e.onClose(() => {
1120
- this.windows.delete(e.id), this.emit("window:closed", { windowId: e.id });
1121
- });
1122
- }
1123
- /**
1124
- * Create default adapter based on platform
1125
- */
1126
- createDefaultAdapter() {
1127
- switch (this.environment.platform) {
1128
- case "electron":
1129
- return new S(this.platformConfig);
1130
- default:
1131
- return new S(this.platformConfig);
1132
- }
1133
- }
1134
- // ==================== Phase 2: Global State Management ====================
1135
- /**
1136
- * Synchronize state globally across all windows
1137
- */
1138
- syncGlobalState(e, t, i) {
1139
- this.globalState.set(e, t);
1140
- const s = this.globalStateCallbacks.get(e);
1141
- s && s.forEach((r) => r(t)), this.windows.forEach((r) => {
1142
- r.syncState(e, t);
1143
- }), this.windowGroups.forEach((r, o) => {
1144
- o !== i && r.syncStateInternal(e, t);
1145
- });
1146
- }
1147
- /**
1148
- * Get global shared state
1149
- */
1150
- getGlobalState(e) {
1151
- return this.globalState.get(e);
1152
- }
1153
- /**
1154
- * Listen for global state changes
1155
- */
1156
- onGlobalStateChange(e, t) {
1157
- return this.globalStateCallbacks.has(e) || this.globalStateCallbacks.set(e, /* @__PURE__ */ new Set()), this.globalStateCallbacks.get(e).add(t), () => {
1158
- this.globalStateCallbacks.get(e)?.delete(t);
1159
- };
1160
- }
1161
- /**
1162
- * Get window group by ID
1163
- */
1164
- getWindowGroup(e) {
1165
- return this.windowGroups.get(e) || null;
1166
- }
1167
- /**
1168
- * Get all window groups
1169
- */
1170
- getAllWindowGroups() {
1171
- return Array.from(this.windowGroups.values());
1172
- }
1173
- /**
1174
- * Window group management utilities
1175
- */
1176
- configureWindowGroupDefaults(e, t) {
1177
- const i = this.windowGroups.get(e);
1178
- i && (t.groupingStrategy && i.setGroupingStrategy(t.groupingStrategy), t.tabConfig && i.configureTabbing(t.tabConfig), t.poolConfig && i.configurePool(t.poolConfig), t.stateSyncScope && i.enableStateSync(t.stateSyncScope));
1179
- }
1180
- /**
1181
- * Cleanup all resources
1182
- */
1183
- dispose() {
1184
- this.globalState.clear(), this.globalStateCallbacks.clear();
1185
- const e = Array.from(this.windows.values()).map(
1186
- (t) => t.close().catch(() => {
1187
- })
1188
- // Ignore errors during cleanup
1189
- );
1190
- Promise.all(e).finally(() => {
1191
- this.windows.clear(), this.windowGroups.clear(), this.eventHandlers.clear();
1192
- });
1193
- }
1194
- }
1195
- class de {
1196
- constructor(e, t, i = "any") {
1197
- this.id = e, this.manager = t, this.dataType = i, l(this, "windows", /* @__PURE__ */ new Map()), l(this, "defaultOptions", {}), l(this, "maxInstances", 1 / 0), l(this, "groupingStrategy", "stack"), l(this, "tabConfig", {
1198
- enabled: !1,
1199
- tabPosition: "top",
1200
- allowDetach: !0,
1201
- allowReorder: !0
1202
- }), l(this, "poolConfig", {
1203
- enabled: !1,
1204
- maxPoolSize: 5,
1205
- reuseThreshold: 3e4,
1206
- // 30 seconds
1207
- keepAliveTime: 3e5
1208
- // 5 minutes
1209
- }), l(this, "stateSyncScope", "none"), l(this, "sharedState", /* @__PURE__ */ new Map()), l(this, "stateCallbacks", /* @__PURE__ */ new Map()), l(this, "windowPool", /* @__PURE__ */ new Map()), l(this, "eventCallbacks", /* @__PURE__ */ new Map()), l(this, "windowMetadata", /* @__PURE__ */ new Map()), this.startPoolCleanup();
1210
- }
1211
- /**
1212
- * Open a window for specific data (Enhanced with pooling and reuse)
1213
- */
1214
- async openWindow(e, t) {
1215
- const i = this.createDataKey(e), s = `${this.id}:${i}`, r = this.windows.get(i);
1216
- if (r)
1217
- return await r.show(), await r.focus(), r.markAsUsed(), r;
1218
- let o = await this.getPooledWindow();
1219
- if (o) {
1220
- const h = t(e);
1221
- return o.render(h), this.setWindowGroupMetadata(o, {
1222
- id: s,
1223
- groupId: this.id,
1224
- isPooled: !1,
1225
- lastUsed: Date.now()
1226
- }), await o.show(), await o.focus(), this.windows.set(i, o), this.emitEvent("window:reused", o, e), o;
1227
- }
1228
- if (this.windows.size >= this.maxInstances) {
1229
- const h = this.windows.values().next().value;
1230
- h && (this.poolConfig.enabled ? await this.returnToPool(h) : await h.close());
1231
- }
1232
- const f = t(e);
1233
- return o = await this.manager.openWindow(s, f, this.defaultOptions), this.setWindowGroupMetadata(o, {
1234
- groupId: this.id,
1235
- isPooled: !1,
1236
- lastUsed: Date.now(),
1237
- tabIndex: this.tabConfig.enabled ? this.windows.size : void 0
1238
- }), this.windows.set(i, o), o.onClose(() => {
1239
- this.poolConfig.enabled && o.isReusable() ? this.returnToPool(o) : (this.windows.delete(i), this.emitEvent("window:destroyed", o.id), this.windows.size === 0 && this.emitEvent("group:empty"));
1240
- }), this.groupingStrategy !== "stack" && this.applyGroupingStrategy(), this.emitEvent("window:created", o), this.windows.size >= this.maxInstances && this.emitEvent("group:full"), o;
1241
- }
1242
- /**
1243
- * Get window for specific data
1244
- */
1245
- getWindowForData(e) {
1246
- const t = this.createDataKey(e);
1247
- return this.windows.get(t) || null;
1248
- }
1249
- /**
1250
- * Get all windows in this group
1251
- */
1252
- getAllWindows() {
1253
- return Array.from(this.windows.values());
1254
- }
1255
- /**
1256
- * Close all windows in this group
1257
- */
1258
- async closeAllWindows() {
1259
- const e = Array.from(this.windows.values()).map(
1260
- (t) => t.close().catch(() => {
1261
- })
1262
- // Ignore errors
1263
- );
1264
- await Promise.all(e), this.windows.clear();
1265
- }
1266
- /**
1267
- * Set default options for windows in this group
1268
- */
1269
- setDefaultOptions(e) {
1270
- this.defaultOptions = { ...e };
1271
- }
1272
- /**
1273
- * Set maximum number of instances
1274
- */
1275
- setMaxInstances(e) {
1276
- this.maxInstances = Math.max(1, e);
1277
- }
1278
- // ==================== Phase 2: Enhanced Features ====================
1279
- /**
1280
- * Window grouping and tabbing
1281
- */
1282
- setGroupingStrategy(e) {
1283
- this.groupingStrategy = e, this.applyGroupingStrategy();
1284
- }
1285
- getGroupingStrategy() {
1286
- return this.groupingStrategy;
1287
- }
1288
- configureTabbing(e) {
1289
- this.tabConfig = { ...e }, e.enabled && this.manager.environment.platform === "electron" && this.enableTabGrouping();
1290
- }
1291
- getTabConfig() {
1292
- return { ...this.tabConfig };
1293
- }
1294
- /**
1295
- * Window pooling and reuse
1296
- */
1297
- configurePool(e) {
1298
- this.poolConfig = { ...e }, e.enabled && this.startPoolCleanup();
1299
- }
1300
- getPoolConfig() {
1301
- return { ...this.poolConfig };
1302
- }
1303
- getPooledWindows() {
1304
- return Array.from(this.windowPool.values());
1305
- }
1306
- async returnToPool(e) {
1307
- if (!this.poolConfig.enabled) {
1308
- await e.close();
1309
- return;
1310
- }
1311
- await e.prepareForReuse(), await e.hide(), this.setWindowGroupMetadata(e, {
1312
- isPooled: !0,
1313
- lastUsed: Date.now()
1314
- }), this.windowPool.set(e.id, e), this.windows.delete(this.getDataKeyForWindow(e)), this.emitEvent("window:pooled", e);
1315
- }
1316
- /**
1317
- * State synchronization
1318
- */
1319
- enableStateSync(e) {
1320
- this.stateSyncScope = e;
1321
- }
1322
- syncState(e, t) {
1323
- this.syncStateInternal(e, t), this.stateSyncScope === "group" ? this.syncStateToGroupWindows(e, t) : this.stateSyncScope === "global" && this.manager.syncGlobalState(e, t, this.id);
1324
- }
1325
- /**
1326
- * Internal state sync without propagation (prevents recursion)
1327
- */
1328
- syncStateInternal(e, t) {
1329
- this.sharedState.set(e, t);
1330
- const i = this.stateCallbacks.get(e);
1331
- i && i.forEach((s) => s(t));
1332
- }
1333
- getSharedState(e) {
1334
- return this.sharedState.get(e);
1335
- }
1336
- onStateChange(e, t) {
1337
- return this.stateCallbacks.has(e) || this.stateCallbacks.set(e, /* @__PURE__ */ new Set()), this.stateCallbacks.get(e).add(t), () => {
1338
- this.stateCallbacks.get(e)?.delete(t);
1339
- };
1340
- }
1341
- /**
1342
- * Window lifecycle events
1343
- */
1344
- onWindowCreated(e) {
1345
- return this.addEventCallback("window:created", e);
1346
- }
1347
- onWindowDestroyed(e) {
1348
- return this.addEventCallback("window:destroyed", e);
1349
- }
1350
- onWindowReused(e) {
1351
- return this.addEventCallback("window:reused", e);
1352
- }
1353
- /**
1354
- * Group-level events
1355
- */
1356
- onGroupEmpty(e) {
1357
- return this.addEventCallback("group:empty", e);
1358
- }
1359
- onGroupFull(e) {
1360
- return this.addEventCallback("group:full", e);
1361
- }
1362
- // ==================== Private Implementation ====================
1363
- /**
1364
- * Apply grouping strategy to existing windows
1365
- */
1366
- applyGroupingStrategy() {
1367
- const e = this.getAllWindows();
1368
- switch (this.groupingStrategy) {
1369
- case "tabs":
1370
- this.arrangeWindowsAsTabs(e);
1371
- break;
1372
- case "cascade":
1373
- this.arrangeWindowsAsCascade(e);
1374
- break;
1375
- case "tile":
1376
- this.arrangeWindowsAsTiles(e);
1377
- break;
1378
- default:
1379
- this.arrangeWindowsAsStack(e);
1380
- break;
1381
- }
1382
- }
1383
- /**
1384
- * Enable tab grouping for windows
1385
- */
1386
- enableTabGrouping() {
1387
- !this.tabConfig.enabled || this.manager.environment.platform;
1388
- }
1389
- /**
1390
- * Start pool cleanup timer
1391
- */
1392
- startPoolCleanup() {
1393
- this.poolConfig.enabled && setInterval(() => {
1394
- this.cleanupPool();
1395
- }, 6e4);
1396
- }
1397
- /**
1398
- * Clean up expired pooled windows
1399
- */
1400
- cleanupPool() {
1401
- const e = Date.now(), t = [];
1402
- this.windowPool.forEach((i, s) => {
1403
- const r = this.getWindowGroupMetadata(i);
1404
- e - (r.lastUsed || 0) > this.poolConfig.keepAliveTime && t.push(s);
1405
- }), t.forEach(async (i) => {
1406
- const s = this.windowPool.get(i);
1407
- s && (await s.dispose(), this.windowPool.delete(i));
1408
- });
1409
- }
1410
- /**
1411
- * Try to get a pooled window for reuse
1412
- */
1413
- async getPooledWindow() {
1414
- if (!this.poolConfig.enabled || this.windowPool.size === 0)
1415
- return null;
1416
- let e = null, t = 0;
1417
- return this.windowPool.forEach((i) => {
1418
- const s = this.getWindowGroupMetadata(i), r = Date.now() - (s.lastUsed || 0);
1419
- if (r < this.poolConfig.reuseThreshold) {
1420
- const o = this.poolConfig.reuseThreshold - r;
1421
- o > t && (e = i, t = o);
1422
- }
1423
- }), e && (this.windowPool.delete(e.id), this.setWindowGroupMetadata(e, {
1424
- isPooled: !1,
1425
- lastUsed: Date.now()
1426
- })), e;
1427
- }
1428
- /**
1429
- * Sync state to all windows in group (with recursion prevention)
1430
- */
1431
- syncStateToGroupWindows(e, t) {
1432
- this.windows.forEach((i) => {
1433
- const s = this.getWindowGroupMetadata(i);
1434
- this.setWindowGroupMetadata(i, {
1435
- ...s,
1436
- [`shared:${e}`]: t
1437
- });
1438
- });
1439
- }
1440
- /**
1441
- * Get data key for a window instance
1442
- */
1443
- getDataKeyForWindow(e) {
1444
- for (const [t, i] of this.windows.entries())
1445
- if (i.id === e.id)
1446
- return t;
1447
- return "";
1448
- }
1449
- /**
1450
- * Window arrangement strategies
1451
- */
1452
- arrangeWindowsAsTabs(e) {
1453
- this.manager.environment.platform === "electron" || this.arrangeWindowsAsModalTabs(e);
1454
- }
1455
- arrangeWindowsAsCascade(e) {
1456
- e.forEach((t, i) => {
1457
- const s = i * 30;
1458
- this.setWindowGroupMetadata(t, {
1459
- cascadeOffset: s,
1460
- arrangementStyle: "cascade"
1461
- });
1462
- });
1463
- }
1464
- arrangeWindowsAsTiles(e) {
1465
- const t = typeof window < "u" ? window.screen.width : 1920, i = typeof window < "u" ? window.screen.height : 1080, s = Math.ceil(Math.sqrt(e.length)), r = Math.ceil(e.length / s), o = t / s, f = i / r;
1466
- e.forEach((h, d) => {
1467
- const u = d % s, P = Math.floor(d / s);
1468
- this.setWindowGroupMetadata(h, {
1469
- tilePosition: {
1470
- col: u,
1471
- row: P,
1472
- x: u * o,
1473
- y: P * f,
1474
- width: o,
1475
- height: f
1476
- },
1477
- arrangementStyle: "tile"
1478
- });
1479
- });
1480
- }
1481
- arrangeWindowsAsStack(e) {
1482
- }
1483
- arrangeWindowsAsModalTabs(e) {
1484
- }
1485
- /**
1486
- * Window metadata management (workaround for signal setter access)
1487
- */
1488
- setWindowGroupMetadata(e, t) {
1489
- this.windowMetadata.set(e.id, {
1490
- ...this.windowMetadata.get(e.id),
1491
- ...t
1492
- });
1493
- }
1494
- getWindowGroupMetadata(e) {
1495
- return this.windowMetadata.get(e.id) || {};
1496
- }
1497
- /**
1498
- * Event management helpers
1499
- */
1500
- addEventCallback(e, t) {
1501
- return this.eventCallbacks.has(e) || this.eventCallbacks.set(e, /* @__PURE__ */ new Set()), this.eventCallbacks.get(e).add(t), () => {
1502
- this.eventCallbacks.get(e)?.delete(t);
1503
- };
1504
- }
1505
- emitEvent(e, ...t) {
1506
- const i = this.eventCallbacks.get(e);
1507
- i && i.forEach((s) => s(...t));
1508
- }
1509
- /**
1510
- * Create a unique key for data
1511
- */
1512
- createDataKey(e) {
1513
- if (e == null)
1514
- return "null";
1515
- if (typeof e == "string" || typeof e == "number" || typeof e == "boolean")
1516
- return String(e);
1517
- if (typeof e == "object" && "id" in e)
1518
- return String(e.id);
1519
- try {
1520
- return JSON.stringify(e);
1521
- } catch {
1522
- return String(e);
1523
- }
1524
- }
1525
- }
1526
- let w = null;
1527
- function c(n = {}) {
1528
- return w || (w = new x(void 0, n)), w;
1529
- }
1530
- function H(n) {
1531
- w?.dispose(), w = n;
1532
- }
1533
- function le() {
1534
- w?.dispose(), w = null;
1535
- }
1536
- var ce = Object.defineProperty, he = (n, e, t) => e in n ? ce(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, I = (n, e, t) => he(n, typeof e != "symbol" ? e + "" : e, t);
1537
- function p(n) {
1538
- return {
1539
- type: "window-scene",
1540
- sceneType: "window",
1541
- id: n.id,
1542
- title: n.title || n.id,
1543
- content: n.children,
1544
- options: n,
1545
- // Render method for scene management
1546
- render() {
1547
- return {
1548
- type: "component",
1549
- id: `window-scene-${n.id}`,
1550
- props: {},
1551
- render: () => ({
1552
- type: "element",
1553
- tag: "div",
1554
- props: {},
1555
- children: [],
1556
- element: document.createElement("div")
1557
- })
1558
- };
1559
- },
1560
- // Open this window
1561
- async open() {
1562
- const e = c(), t = D(() => G((i) => n.children(), `Window-${n.id}`)({}));
1563
- await e.openWindow(n.id, t, n);
1564
- },
1565
- // Close this window
1566
- async close() {
1567
- await c().dismissWindow(n.id);
1568
- }
1569
- };
1570
- }
1571
- function W(n) {
1572
- const e = c(), t = e.createWindowGroup(n.id);
1573
- n.groupingStrategy && t.setGroupingStrategy(n.groupingStrategy), n.tabConfig && t.configureTabbing(n.tabConfig), n.poolConfig && t.configurePool(n.poolConfig), n.stateSyncScope && t.enableStateSync(n.stateSyncScope), n.maxInstances && t.setMaxInstances(n.maxInstances);
1574
- const {
1575
- groupingStrategy: i,
1576
- tabConfig: s,
1577
- poolConfig: r,
1578
- stateSyncScope: o,
1579
- maxInstances: f,
1580
- ...h
1581
- } = n;
1582
- return t.setDefaultOptions(h), {
1583
- type: "window-group",
1584
- sceneType: "window-group",
1585
- id: n.id,
1586
- title: n.title || n.id,
1587
- content: n.children,
1588
- options: n,
1589
- group: t,
1590
- // Render method for scene management
1591
- render() {
1592
- return {
1593
- type: "component",
1594
- id: `window-group-${n.id}`,
1595
- props: {},
1596
- render: () => ({
1597
- type: "element",
1598
- tag: "div",
1599
- props: {},
1600
- children: [],
1601
- element: document.createElement("div")
1602
- })
1603
- };
1604
- },
1605
- // Open a window (data-driven or simple)
1606
- async open(d) {
1607
- if (d !== void 0 && n.for)
1608
- await t.openWindow(d, n.children);
1609
- else {
1610
- const u = n.children();
1611
- await e.openWindow(n.id, u, n);
1612
- }
1613
- },
1614
- // Open window for specific data
1615
- async openForData(d) {
1616
- if (!n.for)
1617
- throw new Error('WindowGroup must specify "for" parameter for data-driven windows');
1618
- await t.openWindow(d, n.children);
1619
- },
1620
- // Close all windows in this group
1621
- async closeAll() {
1622
- await t.closeAllWindows();
1623
- },
1624
- // Get all windows in this group
1625
- getWindows() {
1626
- return t.getAllWindows();
1627
- },
1628
- // Phase 2: Enhanced methods
1629
- configureGrouping(d) {
1630
- t.setGroupingStrategy(d);
1631
- },
1632
- configureTabs(d) {
1633
- t.configureTabbing(d);
1634
- },
1635
- configurePooling(d) {
1636
- t.configurePool(d);
1637
- },
1638
- enableStateSync(d) {
1639
- t.enableStateSync(d);
1640
- },
1641
- syncGroupState(d, u) {
1642
- t.syncState(d, u);
1643
- },
1644
- getGroupState(d) {
1645
- return t.getSharedState(d);
1646
- },
1647
- onGroupStateChange(d, u) {
1648
- return t.onStateChange(d, u);
1649
- }
1650
- };
1651
- }
1652
- function g(n) {
1653
- return {
1654
- type: "app",
1655
- scenes: n.children,
1656
- render() {
1657
- return {
1658
- type: "component",
1659
- id: "tachui-app",
1660
- props: {},
1661
- render: () => ({
1662
- type: "element",
1663
- tag: "div",
1664
- props: {},
1665
- children: [],
1666
- element: document.createElement("div")
1667
- })
1668
- };
1669
- },
1670
- // Initialize all scenes
1671
- async initialize() {
1672
- if (!c(n.platformConfig)) {
1673
- const { initializeViewportSystem: t } = await Promise.resolve().then(() => Ce);
1674
- t();
1675
- }
1676
- },
1677
- // Get scene by ID
1678
- getScene(e) {
1679
- return n.children.find((t) => t.id === e);
1680
- },
1681
- // Open a specific scene
1682
- async openScene(e, t) {
1683
- const i = this.getScene(e);
1684
- if (!i)
1685
- throw new Error(`Scene with id '${e}' not found`);
1686
- i.type === "window-scene" ? await i.open() : i.type === "window-group" && await i.open(t);
1687
- }
1688
- };
1689
- }
1690
- const b = {
1691
- /**
1692
- * Create a document window group
1693
- */
1694
- documentGroup(n, e, t, i) {
1695
- return W({
1696
- id: n,
1697
- title: e,
1698
- for: t,
1699
- children: i,
1700
- width: 800,
1701
- height: 600,
1702
- resizable: !0
1703
- });
1704
- },
1705
- /**
1706
- * Create a settings window
1707
- */
1708
- settingsWindow(n) {
1709
- return p({
1710
- id: "settings",
1711
- title: "Settings",
1712
- width: 600,
1713
- height: 400,
1714
- resizable: !1,
1715
- children: n
1716
- });
1717
- },
1718
- /**
1719
- * Create an inspector window
1720
- */
1721
- inspectorWindow(n) {
1722
- return p({
1723
- id: "inspector",
1724
- title: "Inspector",
1725
- width: 300,
1726
- height: 500,
1727
- resizable: !0,
1728
- alwaysOnTop: !0,
1729
- children: n
1730
- });
1731
- },
1732
- /**
1733
- * Create a palette window
1734
- */
1735
- paletteWindow(n, e, t) {
1736
- return p({
1737
- id: n,
1738
- title: e,
1739
- width: 250,
1740
- height: 400,
1741
- resizable: !1,
1742
- alwaysOnTop: !0,
1743
- children: t
1744
- });
1745
- }
1746
- }, z = {
1747
- /**
1748
- * Basic app with main window and settings
1749
- */
1750
- basicApp: () => g({
1751
- children: [
1752
- p({
1753
- id: "main",
1754
- title: "My App",
1755
- children: () => ({
1756
- type: "component",
1757
- id: "main-content",
1758
- props: {},
1759
- render: () => ({
1760
- type: "element",
1761
- tag: "div",
1762
- props: {},
1763
- children: [],
1764
- element: document.createElement("div")
1765
- })
1766
- })
1767
- }),
1768
- b.settingsWindow(() => ({
1769
- type: "component",
1770
- id: "settings-content",
1771
- props: {},
1772
- render: () => ({
1773
- type: "element",
1774
- tag: "div",
1775
- props: {},
1776
- children: [],
1777
- element: document.createElement("div")
1778
- })
1779
- }))
1780
- ]
1781
- }),
1782
- /**
1783
- * Document-based app
1784
- */
1785
- documentApp: () => g({
1786
- children: [
1787
- W({
1788
- id: "document",
1789
- title: "Document",
1790
- for: class {
1791
- constructor() {
1792
- I(this, "id"), I(this, "title");
1793
- }
1794
- },
1795
- children: (n) => ({
1796
- type: "component",
1797
- id: `document-${n.id}`,
1798
- props: {},
1799
- render: () => ({
1800
- type: "element",
1801
- tag: "div",
1802
- props: {},
1803
- children: [],
1804
- element: document.createElement("div")
1805
- })
1806
- })
1807
- }),
1808
- b.settingsWindow(() => ({
1809
- type: "component",
1810
- id: "settings",
1811
- props: {},
1812
- render: () => ({
1813
- type: "element",
1814
- tag: "div",
1815
- props: {},
1816
- children: [],
1817
- element: document.createElement("div")
1818
- })
1819
- }))
1820
- ]
1821
- })
1822
- }, A = F(null);
1823
- function _({
1824
- children: n,
1825
- manager: e
1826
- }) {
1827
- const t = e || c(), i = {
1828
- openWindow: async (s, r, o) => await t.openWindow(s, r, o),
1829
- dismissWindow: async (s) => await t.dismissWindow(s),
1830
- viewportEnvironment: t.environment,
1831
- currentWindow: null
1832
- // This would be set based on current context
1833
- };
1834
- return {
1835
- type: "context-provider",
1836
- context: A,
1837
- value: i,
1838
- children: Array.isArray(n) ? n : [n]
1839
- };
1840
- }
1841
- function m() {
1842
- const n = N(A);
1843
- if (!n)
1844
- throw new Error("useViewportEnvironment must be used within a ViewportEnvironmentProvider");
1845
- return n();
1846
- }
1847
- function y() {
1848
- const { openWindow: n } = m();
1849
- return n;
1850
- }
1851
- function v() {
1852
- const { dismissWindow: n } = m();
1853
- return n;
1854
- }
1855
- function T() {
1856
- const { viewportEnvironment: n } = m();
1857
- return n;
1858
- }
1859
- function ue() {
1860
- const { currentWindow: n } = m();
1861
- return n;
1862
- }
1863
- function we() {
1864
- return c();
1865
- }
1866
- function pe(n, e) {
1867
- return (t) => _({
1868
- children: n(t),
1869
- manager: e
1870
- });
1871
- }
1872
- function me(n) {
1873
- return (e) => {
1874
- const t = y(), i = v(), s = T();
1875
- return n({
1876
- ...e,
1877
- openWindow: t,
1878
- dismissWindow: i,
1879
- viewportEnvironment: s
1880
- });
1881
- };
1882
- }
1883
- const fe = {
1884
- openWindow: "openWindow",
1885
- dismissWindow: "dismissWindow",
1886
- viewportEnvironment: "viewportEnvironment",
1887
- currentWindow: "currentWindow"
1888
- };
1889
- function ge(n) {
1890
- return m()[n];
1891
- }
1892
- const be = {
1893
- // Manager
1894
- getManager: c,
1895
- // Environment
1896
- useOpenWindow: y,
1897
- useDismissWindow: v,
1898
- useViewportInfo: T,
1899
- // Components
1900
- Window: p,
1901
- WindowGroup: W,
1902
- App: g,
1903
- // Utilities
1904
- Utils: b,
1905
- Examples: z
1906
- };
1907
- function ye(n) {
1908
- const e = new x(n?.customAdapter);
1909
- return H(e), e;
1910
- }
1911
- const ve = {
1912
- isWindow: (n) => n.type === "window",
1913
- isModal: (n) => n.type === "modal",
1914
- isPortal: (n) => n.type === "portal",
1915
- isSheet: (n) => n.type === "sheet",
1916
- isPopover: (n) => n.type === "popover"
1917
- }, We = {
1918
- /**
1919
- * Check if running in Electron
1920
- */
1921
- isElectron: () => c().environment.platform === "electron",
1922
- /**
1923
- * Check if on mobile
1924
- */
1925
- isMobile: () => c().environment.platform === "mobile",
1926
- /**
1927
- * Check if multi-window is supported
1928
- */
1929
- supportsMultiWindow: () => c().environment.capabilities.multiWindow,
1930
- /**
1931
- * Check if native windows are supported
1932
- */
1933
- supportsNativeWindows: () => c().environment.capabilities.nativeWindows,
1934
- /**
1935
- * Get optimal window type for current platform
1936
- */
1937
- getOptimalWindowType: (n = !1) => c().getOptimalWindowType({ preferNativeWindow: n })
1938
- }, Ee = {
1939
- /**
1940
- * Standard document window
1941
- */
1942
- document: (n) => ({
1943
- title: n || "Document",
1944
- width: 800,
1945
- height: 600,
1946
- resizable: !0,
1947
- minimizable: !0,
1948
- maximizable: !0
1949
- }),
1950
- /**
1951
- * Settings/preferences window
1952
- */
1953
- settings: (n) => ({
1954
- title: n || "Settings",
1955
- width: 600,
1956
- height: 400,
1957
- resizable: !1,
1958
- minimizable: !1,
1959
- maximizable: !1,
1960
- modal: !0
1961
- }),
1962
- /**
1963
- * Inspector/sidebar window
1964
- */
1965
- inspector: (n) => ({
1966
- title: n || "Inspector",
1967
- width: 300,
1968
- height: 500,
1969
- resizable: !0,
1970
- alwaysOnTop: !0
1971
- }),
1972
- /**
1973
- * Palette/tool window
1974
- */
1975
- palette: (n) => ({
1976
- title: n || "Palette",
1977
- width: 250,
1978
- height: 400,
1979
- resizable: !1,
1980
- alwaysOnTop: !0
1981
- }),
1982
- /**
1983
- * Dialog/alert window
1984
- */
1985
- dialog: (n) => ({
1986
- title: n || "Dialog",
1987
- width: 400,
1988
- height: 200,
1989
- resizable: !1,
1990
- modal: !0,
1991
- minimizable: !1,
1992
- maximizable: !1
1993
- }),
1994
- /**
1995
- * Fullscreen window
1996
- */
1997
- fullscreen: (n) => ({
1998
- title: n || "Fullscreen",
1999
- width: typeof window < "u" && window.screen?.width || 1920,
2000
- height: typeof window < "u" && window.screen?.height || 1080,
2001
- resizable: !1,
2002
- minimizable: !1,
2003
- maximizable: !1
2004
- })
2005
- }, Se = {
2006
- DEFAULT_WINDOW_WIDTH: 800,
2007
- DEFAULT_WINDOW_HEIGHT: 600,
2008
- MIN_WINDOW_WIDTH: 300,
2009
- MIN_WINDOW_HEIGHT: 200,
2010
- MODAL_Z_INDEX: 1e3,
2011
- PORTAL_Z_INDEX: 999,
2012
- ANIMATION_DURATION: 200
2013
- }, Ce = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2014
- __proto__: null,
2015
- App: g,
2016
- EnvironmentKeys: fe,
2017
- ExampleScenes: z,
2018
- PlatformUtils: We,
2019
- TachUIViewportManager: x,
2020
- Viewport: be,
2021
- ViewportConstants: Se,
2022
- ViewportEnvironmentProvider: _,
2023
- ViewportTypeGuards: ve,
2024
- WebViewportAdapter: S,
2025
- Window: p,
2026
- WindowConfigs: Ee,
2027
- WindowGroup: W,
2028
- WindowUtils: b,
2029
- checkFeatureSupport: Y,
2030
- createCapabilityChecker: E,
2031
- createWindowAwareComponent: me,
2032
- detectViewportEnvironment: M,
2033
- disposeViewportManager: le,
2034
- getBrowserInfo: Z,
2035
- getEnvironmentValue: ge,
2036
- getOSInfo: Q,
2037
- getViewportManager: c,
2038
- initializeViewportSystem: ye,
2039
- setViewportManager: H,
2040
- useCurrentWindow: ue,
2041
- useDismissWindow: v,
2042
- useEnvironmentDismissWindow: v,
2043
- useEnvironmentOpenWindow: y,
2044
- useOpenWindow: y,
2045
- useViewportEnvironment: m,
2046
- useViewportInfo: T,
2047
- useViewportManager: we,
2048
- withViewportEnvironment: pe
2049
- }, Symbol.toStringTag, { value: "Module" }));
2050
- export {
2051
- g as App,
2052
- fe as EnvironmentKeys,
2053
- z as ExampleScenes,
2054
- We as PlatformUtils,
2055
- x as TachUIViewportManager,
2056
- be as Viewport,
2057
- Se as ViewportConstants,
2058
- _ as ViewportEnvironmentProvider,
2059
- ve as ViewportTypeGuards,
2060
- S as WebViewportAdapter,
2061
- p as Window,
2062
- Ee as WindowConfigs,
2063
- W as WindowGroup,
2064
- b as WindowUtils,
2065
- Y as checkFeatureSupport,
2066
- E as createCapabilityChecker,
2067
- me as createWindowAwareComponent,
2068
- M as detectViewportEnvironment,
2069
- le as disposeViewportManager,
2070
- Z as getBrowserInfo,
2071
- ge as getEnvironmentValue,
2072
- Q as getOSInfo,
2073
- c as getViewportManager,
2074
- ye as initializeViewportSystem,
2075
- H as setViewportManager,
2076
- ue as useCurrentWindow,
2077
- v as useDismissWindow,
2078
- v as useEnvironmentDismissWindow,
2079
- y as useEnvironmentOpenWindow,
2080
- y as useOpenWindow,
2081
- m as useViewportEnvironment,
2082
- T as useViewportInfo,
2083
- we as useViewportManager,
2084
- pe as withViewportEnvironment
2085
- };