@flightdev/ui 2.0.0 → 4.0.0

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 (120) hide show
  1. package/README.md +285 -70
  2. package/dist/{chunk-XTDK7ME5.js → chunk-S4DTUQII.js} +246 -19
  3. package/dist/chunk-S4DTUQII.js.map +1 -0
  4. package/dist/core/index.d.ts +423 -3
  5. package/dist/core/index.js +23 -2
  6. package/dist/core/index.js.map +1 -0
  7. package/dist/index.d.ts +2 -3
  8. package/dist/index.js +29 -5
  9. package/dist/index.js.map +1 -0
  10. package/package.json +11 -181
  11. package/.turbo/turbo-build.log +0 -81
  12. package/.turbo/turbo-lint.log +0 -40
  13. package/.turbo/turbo-typecheck.log +0 -4
  14. package/TESTING.md +0 -124
  15. package/dist/adapter-MMD-iHNx.d.ts +0 -424
  16. package/dist/adapters/tier-1/angular.d.ts +0 -60
  17. package/dist/adapters/tier-1/angular.js +0 -2
  18. package/dist/adapters/tier-1/index.d.ts +0 -7
  19. package/dist/adapters/tier-1/index.js +0 -7
  20. package/dist/adapters/tier-1/qwik.d.ts +0 -55
  21. package/dist/adapters/tier-1/qwik.js +0 -2
  22. package/dist/adapters/tier-1/react.d.ts +0 -67
  23. package/dist/adapters/tier-1/react.js +0 -2
  24. package/dist/adapters/tier-1/solid.d.ts +0 -45
  25. package/dist/adapters/tier-1/solid.js +0 -2
  26. package/dist/adapters/tier-1/svelte.d.ts +0 -48
  27. package/dist/adapters/tier-1/svelte.js +0 -2
  28. package/dist/adapters/tier-1/vue.d.ts +0 -47
  29. package/dist/adapters/tier-1/vue.js +0 -2
  30. package/dist/adapters/tier-2/index.d.ts +0 -7
  31. package/dist/adapters/tier-2/index.js +0 -7
  32. package/dist/adapters/tier-2/inferno.d.ts +0 -31
  33. package/dist/adapters/tier-2/inferno.js +0 -2
  34. package/dist/adapters/tier-2/lit.d.ts +0 -34
  35. package/dist/adapters/tier-2/lit.js +0 -2
  36. package/dist/adapters/tier-2/marko.d.ts +0 -59
  37. package/dist/adapters/tier-2/marko.js +0 -2
  38. package/dist/adapters/tier-2/mithril.d.ts +0 -31
  39. package/dist/adapters/tier-2/mithril.js +0 -2
  40. package/dist/adapters/tier-2/preact.d.ts +0 -33
  41. package/dist/adapters/tier-2/preact.js +0 -2
  42. package/dist/adapters/tier-2/stencil.d.ts +0 -52
  43. package/dist/adapters/tier-2/stencil.js +0 -2
  44. package/dist/adapters/tier-3/alpine.d.ts +0 -73
  45. package/dist/adapters/tier-3/alpine.js +0 -2
  46. package/dist/adapters/tier-3/hotwire.d.ts +0 -71
  47. package/dist/adapters/tier-3/hotwire.js +0 -2
  48. package/dist/adapters/tier-3/htmx.d.ts +0 -88
  49. package/dist/adapters/tier-3/htmx.js +0 -2
  50. package/dist/adapters/tier-3/index.d.ts +0 -7
  51. package/dist/adapters/tier-3/index.js +0 -7
  52. package/dist/adapters/tier-3/petite-vue.d.ts +0 -56
  53. package/dist/adapters/tier-3/petite-vue.js +0 -2
  54. package/dist/adapters/tier-3/stimulus.d.ts +0 -63
  55. package/dist/adapters/tier-3/stimulus.js +0 -2
  56. package/dist/adapters/tier-3/vanilla.d.ts +0 -63
  57. package/dist/adapters/tier-3/vanilla.js +0 -2
  58. package/dist/chunk-2SNQ6PTM.js +0 -217
  59. package/dist/chunk-3D4XMIZI.js +0 -136
  60. package/dist/chunk-3HU6GSQ4.js +0 -125
  61. package/dist/chunk-4PZDNFL7.js +0 -148
  62. package/dist/chunk-5IBLFTYL.js +0 -114
  63. package/dist/chunk-64JZJ7OK.js +0 -142
  64. package/dist/chunk-7ZJI3QU2.js +0 -132
  65. package/dist/chunk-CE4FJHQJ.js +0 -133
  66. package/dist/chunk-DTCAUBH5.js +0 -87
  67. package/dist/chunk-NTASPOHG.js +0 -106
  68. package/dist/chunk-OI2AMQLG.js +0 -152
  69. package/dist/chunk-Q7HUE44H.js +0 -106
  70. package/dist/chunk-QH3LOWXU.js +0 -155
  71. package/dist/chunk-QIVAK6BH.js +0 -103
  72. package/dist/chunk-V34XPVGK.js +0 -103
  73. package/dist/chunk-VK7ZPMO7.js +0 -221
  74. package/dist/chunk-X6CNUW6T.js +0 -136
  75. package/dist/chunk-YFGSHW5S.js +0 -121
  76. package/dist/chunk-ZAJVSE7J.js +0 -90
  77. package/docs/ADAPTERS.md +0 -946
  78. package/docs/PATTERNS.md +0 -836
  79. package/src/adapters/tier-1/angular.ts +0 -223
  80. package/src/adapters/tier-1/index.ts +0 -12
  81. package/src/adapters/tier-1/qwik.ts +0 -177
  82. package/src/adapters/tier-1/react.ts +0 -330
  83. package/src/adapters/tier-1/solid.ts +0 -222
  84. package/src/adapters/tier-1/svelte.ts +0 -211
  85. package/src/adapters/tier-1/vue.ts +0 -234
  86. package/src/adapters/tier-2/index.ts +0 -12
  87. package/src/adapters/tier-2/inferno.ts +0 -149
  88. package/src/adapters/tier-2/lit.ts +0 -191
  89. package/src/adapters/tier-2/marko.ts +0 -199
  90. package/src/adapters/tier-2/mithril.ts +0 -152
  91. package/src/adapters/tier-2/preact.ts +0 -133
  92. package/src/adapters/tier-2/stencil.ts +0 -214
  93. package/src/adapters/tier-3/alpine.ts +0 -218
  94. package/src/adapters/tier-3/hotwire.ts +0 -254
  95. package/src/adapters/tier-3/htmx.ts +0 -263
  96. package/src/adapters/tier-3/index.ts +0 -12
  97. package/src/adapters/tier-3/petite-vue.ts +0 -163
  98. package/src/adapters/tier-3/stimulus.ts +0 -233
  99. package/src/adapters/tier-3/vanilla.ts +0 -252
  100. package/src/ambient.d.ts +0 -310
  101. package/src/core/adapter.ts +0 -366
  102. package/src/core/index.ts +0 -56
  103. package/src/core/registry.ts +0 -518
  104. package/src/core/types.ts +0 -461
  105. package/src/htmx.ts +0 -134
  106. package/src/index.ts +0 -263
  107. package/test/__mocks__/stencil-core.ts +0 -19
  108. package/test/__mocks__/stencil-hydrate.ts +0 -15
  109. package/test/adapters/tier-1.test.ts +0 -206
  110. package/test/adapters/tier-2.test.ts +0 -175
  111. package/test/adapters/tier-3.test.ts +0 -284
  112. package/test/contracts/adapter.contract.ts +0 -293
  113. package/test/core/core.test.ts +0 -310
  114. package/test/errors/error-handling.test.ts +0 -454
  115. package/test/integration/htmx.integration.test.ts +0 -246
  116. package/test/integration/react.integration.test.ts +0 -271
  117. package/test/integration/registry.integration.test.ts +0 -308
  118. package/tsconfig.json +0 -22
  119. package/tsup.config.ts +0 -93
  120. package/vitest.config.ts +0 -101
package/README.md CHANGED
@@ -1,91 +1,306 @@
1
- # @flight-framework/ui
1
+ # @flightdev/ui
2
2
 
3
- Headless UI components for Flight Framework. Accessible, unstyled primitives for building design systems.
3
+ The universal UI framework layer for Flight. Provides server-side rendering (SSR) and hydration support for 18+ UI frameworks.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Installation](#installation)
8
+ - [Quick Start](#quick-start)
9
+ - [Architecture](#architecture)
10
+ - [Adapter Registry](#adapter-registry)
11
+ - [Rendering](#rendering)
12
+ - [API Reference](#api-reference)
13
+ - [License](#license)
14
+
15
+ ---
4
16
 
5
17
  ## Installation
6
18
 
7
19
  ```bash
8
- npm install @flight-framework/ui
20
+ npm install @flightdev/ui
21
+ ```
22
+
23
+ Then install the adapter for your framework:
24
+
25
+ ```bash
26
+ npm install @flightdev/ui-react # React 18+
27
+ npm install @flightdev/ui-vue # Vue 3
28
+ npm install @flightdev/ui-angular # Angular 17+
29
+ npm install @flightdev/ui-svelte # Svelte 5
30
+ npm install @flightdev/ui-solid # Solid.js
31
+ npm install @flightdev/ui-qwik # Qwik
9
32
  ```
10
33
 
11
- ## Components
34
+ ---
12
35
 
13
- ### Dialog (Modal)
36
+ ## Quick Start
14
37
 
15
- ```tsx
16
- import { Dialog, DialogTrigger, DialogContent, DialogTitle } from '@flight-framework/ui/react';
38
+ ```typescript
39
+ import { defineUI, renderPage, toHTML } from '@flightdev/ui';
40
+ import { react } from '@flightdev/ui-react';
17
41
 
18
- function App() {
19
- return (
20
- <Dialog>
21
- <DialogTrigger>Open Modal</DialogTrigger>
22
- <DialogContent>
23
- <DialogTitle>Confirm Action</DialogTitle>
24
- <p>Are you sure you want to continue?</p>
25
- </DialogContent>
26
- </Dialog>
27
- );
28
- }
42
+ // Define UI configuration
43
+ const ui = defineUI(react());
44
+
45
+ // Render a component
46
+ const result = await renderPage(ui, {
47
+ component: App,
48
+ props: { user: { name: 'John' } },
49
+ });
50
+
51
+ // Generate full HTML document
52
+ const html = toHTML(result, {
53
+ title: 'My App',
54
+ lang: 'en',
55
+ });
29
56
  ```
30
57
 
31
- ### Dropdown Menu
32
-
33
- ```tsx
34
- import { Menu, MenuTrigger, MenuContent, MenuItem } from '@flight-framework/ui/react';
35
-
36
- function App() {
37
- return (
38
- <Menu>
39
- <MenuTrigger>Options</MenuTrigger>
40
- <MenuContent>
41
- <MenuItem onSelect={() => {}}>Edit</MenuItem>
42
- <MenuItem onSelect={() => {}}>Delete</MenuItem>
43
- </MenuContent>
44
- </Menu>
45
- );
58
+ ---
59
+
60
+ ## Architecture
61
+
62
+ The UI system is organized into three tiers based on feature support:
63
+
64
+ ### Tier 1: Full Support
65
+
66
+ Full SSR, streaming, hydration, and islands architecture support.
67
+
68
+ | Adapter | Package | Streaming | Islands | Resumable |
69
+ |---------|---------|-----------|---------|-----------|
70
+ | React 18+ | `@flightdev/ui-react` | Yes | Yes | No |
71
+ | Vue 3 | `@flightdev/ui-vue` | Yes | Yes | No |
72
+ | Angular 17+ | `@flightdev/ui-angular` | Yes | Yes | No |
73
+ | Svelte 5 | `@flightdev/ui-svelte` | No | Yes | No |
74
+ | Solid.js | `@flightdev/ui-solid` | Yes | Yes | No |
75
+ | Qwik | `@flightdev/ui-qwik` | Yes | Yes | Yes |
76
+
77
+ ### Tier 2: Standard Support
78
+
79
+ SSR and hydration with framework-specific optimizations.
80
+
81
+ | Adapter | Package |
82
+ |---------|---------|
83
+ | Preact | `@flightdev/ui-preact` |
84
+ | Lit | `@flightdev/ui-lit` |
85
+ | Marko | `@flightdev/ui-marko` |
86
+ | Stencil | `@flightdev/ui-stencil` |
87
+ | Mithril | `@flightdev/ui-mithril` |
88
+ | Inferno | `@flightdev/ui-inferno` |
89
+
90
+ ### Tier 3: HTML-First
91
+
92
+ Server-rendered HTML with minimal JavaScript.
93
+
94
+ | Adapter | Package |
95
+ |---------|---------|
96
+ | HTMX | `@flightdev/ui-htmx` |
97
+ | Alpine.js | `@flightdev/ui-alpine` |
98
+ | Hotwire | `@flightdev/ui-hotwire` |
99
+ | Stimulus | `@flightdev/ui-stimulus` |
100
+ | Petite-vue | `@flightdev/ui-petite-vue` |
101
+ | Vanilla | `@flightdev/ui-vanilla` |
102
+
103
+ ---
104
+
105
+ ## Adapter Registry
106
+
107
+ The adapter registry provides dynamic loading and capability queries.
108
+
109
+ ### Registering Adapters
110
+
111
+ ```typescript
112
+ import { adapterRegistry, registerBuiltinAdapters } from '@flightdev/ui';
113
+
114
+ // Register all built-in adapters
115
+ registerBuiltinAdapters();
116
+ ```
117
+
118
+ ### Getting Adapters
119
+
120
+ ```typescript
121
+ // Get adapter by name
122
+ const adapter = await adapterRegistry.get('react');
123
+
124
+ // Get adapter metadata
125
+ const metadata = adapterRegistry.getMetadata('vue');
126
+ console.log(metadata.tier); // 'tier-1'
127
+ console.log(metadata.framework); // 'vue'
128
+ ```
129
+
130
+ ### Querying Capabilities
131
+
132
+ ```typescript
133
+ // List adapters by tier
134
+ const tier1 = adapterRegistry.listByTier('tier-1');
135
+ // ['react', 'vue', 'angular', 'svelte', 'solid', 'qwik']
136
+
137
+ // List adapters by capability
138
+ const streaming = adapterRegistry.listByCapability('streaming');
139
+ // ['react', 'vue', 'angular', 'solid', 'qwik', 'marko']
140
+
141
+ // Check if adapter has capability
142
+ const hasStreaming = adapterRegistry.hasCapability('react', 'streaming');
143
+ // true
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Rendering
149
+
150
+ ### String Rendering
151
+
152
+ Render a component to an HTML string:
153
+
154
+ ```typescript
155
+ const result = await adapter.renderToString({
156
+ component: App,
157
+ props: { data },
158
+ });
159
+
160
+ console.log(result.html); // Rendered HTML
161
+ console.log(result.hydrationData); // State for client hydration
162
+ console.log(result.timing); // Performance metrics
163
+ ```
164
+
165
+ ### Streaming Rendering
166
+
167
+ For adapters with streaming support:
168
+
169
+ ```typescript
170
+ const { stream, done, abort } = adapter.renderToStream(
171
+ { component: App, props: {} },
172
+ { url: request.url },
173
+ {
174
+ onShellReady: () => {
175
+ response.writeHead(200, {
176
+ 'Content-Type': 'text/html',
177
+ 'Transfer-Encoding': 'chunked',
178
+ });
179
+ },
180
+ onError: (error) => {
181
+ console.error('Render error:', error);
182
+ },
183
+ }
184
+ );
185
+
186
+ const reader = stream.getReader();
187
+ while (true) {
188
+ const { done: readerDone, value } = await reader.read();
189
+ if (readerDone) break;
190
+ response.write(value);
46
191
  }
192
+ response.end();
193
+ ```
194
+
195
+ ### Hydration Scripts
196
+
197
+ Generate client-side hydration code:
198
+
199
+ ```typescript
200
+ const result = await adapter.renderToString({ component: App, props: {} });
201
+ const hydrationScript = adapter.getHydrationScript(result);
202
+
203
+ const html = `
204
+ <!DOCTYPE html>
205
+ <html>
206
+ <body>
207
+ <div id="app">${result.html}</div>
208
+ ${hydrationScript}
209
+ </body>
210
+ </html>
211
+ `;
212
+ ```
213
+
214
+ ---
215
+
216
+ ## API Reference
217
+
218
+ ### defineUI
219
+
220
+ Create a UI configuration object.
221
+
222
+ ```typescript
223
+ function defineUI(
224
+ adapter: UIAdapterV2 | UIAdapterV1,
225
+ options?: {
226
+ streaming?: boolean;
227
+ hydration?: 'full' | 'partial' | 'progressive' | 'none';
228
+ islands?: boolean;
229
+ defaultIslandStrategy?: IslandHydrationStrategy;
230
+ }
231
+ ): UIConfig;
232
+ ```
233
+
234
+ ### renderPage
235
+
236
+ Render a component with the configured adapter.
237
+
238
+ ```typescript
239
+ function renderPage(
240
+ config: UIConfig,
241
+ component: Component,
242
+ context?: RenderContext
243
+ ): Promise<RenderResult>;
47
244
  ```
48
245
 
49
- ### Tabs
50
-
51
- ```tsx
52
- import { Tabs, TabList, Tab, TabPanel } from '@flight-framework/ui/react';
53
-
54
- function App() {
55
- return (
56
- <Tabs defaultValue="tab1">
57
- <TabList>
58
- <Tab value="tab1">Tab 1</Tab>
59
- <Tab value="tab2">Tab 2</Tab>
60
- </TabList>
61
- <TabPanel value="tab1">Content 1</TabPanel>
62
- <TabPanel value="tab2">Content 2</TabPanel>
63
- </Tabs>
64
- );
246
+ ### toHTML
247
+
248
+ Generate a full HTML document from a render result.
249
+
250
+ ```typescript
251
+ function toHTML(
252
+ result: RenderResult,
253
+ options?: {
254
+ lang?: string;
255
+ title?: string;
256
+ meta?: Record<string, string>;
257
+ charset?: string;
258
+ viewport?: string;
259
+ }
260
+ ): string;
261
+ ```
262
+
263
+ ### BaseUIAdapter
264
+
265
+ Base class for creating custom adapters.
266
+
267
+ ```typescript
268
+ import { BaseUIAdapter } from '@flightdev/ui';
269
+ import type { Component, RenderResult, RenderContext } from '@flightdev/ui';
270
+
271
+ class MyAdapter extends BaseUIAdapter {
272
+ readonly id = 'my-adapter';
273
+ readonly name = 'My Adapter';
274
+ readonly framework = 'my-framework';
275
+ readonly tier = 'tier-2' as const;
276
+
277
+ async renderToString(
278
+ component: Component,
279
+ context?: RenderContext
280
+ ): Promise<RenderResult> {
281
+ // Implementation
282
+ }
283
+
284
+ getHydrationScript(result: RenderResult): string {
285
+ // Implementation
286
+ }
287
+
288
+ getClientEntry(): string {
289
+ // Implementation
290
+ }
65
291
  }
66
292
  ```
67
293
 
68
- ## Available Components
69
-
70
- - Dialog / Modal
71
- - Dropdown Menu
72
- - Popover
73
- - Tooltip
74
- - Tabs
75
- - Accordion
76
- - Collapsible
77
- - Switch / Toggle
78
- - Slider
79
- - Select / Combobox
80
- - Toast / Notifications
81
-
82
- ## Features
83
-
84
- - Fully accessible (WAI-ARIA)
85
- - Keyboard navigation
86
- - Focus management
87
- - Unstyled (bring your own CSS)
88
- - TypeScript support
294
+ ---
295
+
296
+ ## Documentation
297
+
298
+ For detailed documentation on each adapter and advanced patterns:
299
+
300
+ - [Adapter System](./docs/ADAPTERS.md)
301
+ - [Usage Patterns](./docs/PATTERNS.md)
302
+
303
+ ---
89
304
 
90
305
  ## License
91
306