@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
@@ -1,223 +0,0 @@
1
- /**
2
- * @flightdev/ui - Angular Adapter (Tier 1)
3
- *
4
- * Full-featured Angular 17+ SSR adapter with hydration and incremental hydration support.
5
- *
6
- * @module @flightdev/ui/angular
7
- * @version 2.0.0
8
- */
9
-
10
- import { BaseUIAdapter } from '../../core/adapter.js';
11
- import type {
12
- AdapterCapabilities,
13
- Component,
14
- RenderContext,
15
- RenderResult,
16
- } from '../../core/types.js';
17
-
18
- // ============================================================================
19
- // Types
20
- // ============================================================================
21
-
22
- /**
23
- * Angular bootstrap function type
24
- */
25
- export type AngularBootstrapFn = (document: string, url: string) => Promise<unknown>;
26
-
27
- export interface AngularAdapterOptions {
28
- /** Enable incremental hydration (Angular 17+) */
29
- incrementalHydration?: boolean;
30
-
31
- /** Enable event replay during hydration */
32
- eventReplay?: boolean;
33
-
34
- /** Document template for SSR */
35
- documentTemplate?: string;
36
-
37
- /** Custom providers for SSR */
38
- providers?: unknown[];
39
- }
40
-
41
- // ============================================================================
42
- // Angular Adapter
43
- // ============================================================================
44
-
45
- export class AngularAdapter extends BaseUIAdapter {
46
- readonly id = 'angular';
47
- readonly name = 'Angular';
48
- readonly framework = 'angular';
49
- readonly frameworkVersion = '17+';
50
- readonly tier = 'tier-1' as const;
51
-
52
- override readonly capabilities: AdapterCapabilities = {
53
- streaming: true,
54
- partialHydration: true,
55
- islands: false, // Angular doesn't have traditional islands
56
- resumable: false,
57
- ssg: true,
58
- csr: true,
59
- serverComponents: false,
60
- };
61
-
62
- private documentTemplate: string;
63
-
64
- constructor(private options: AngularAdapterOptions = {}) {
65
- super();
66
- this.documentTemplate = options.documentTemplate ?? this.getDefaultDocumentTemplate();
67
- }
68
-
69
- async renderToString(
70
- component: Component,
71
- context?: RenderContext
72
- ): Promise<RenderResult> {
73
- const startTime = performance.now();
74
-
75
- try {
76
- // Dynamic import of Angular platform-server
77
- const { renderApplication } = await import('@angular/platform-server');
78
- const { provideClientHydration, withIncrementalHydration, withEventReplay } =
79
- await import('@angular/platform-browser');
80
-
81
- // Build hydration providers based on options
82
- const hydrationFeatures: unknown[] = [];
83
-
84
- if (this.options.incrementalHydration) {
85
- hydrationFeatures.push(withIncrementalHydration());
86
- }
87
-
88
- if (this.options.eventReplay) {
89
- hydrationFeatures.push(withEventReplay());
90
- }
91
-
92
- // The component should be an Angular bootstrap function
93
- const bootstrap = component.component as AngularBootstrapFn;
94
- const url = context?.url ?? '/';
95
-
96
- // Render the application
97
- const html = await renderApplication(bootstrap, {
98
- document: this.documentTemplate,
99
- url,
100
- });
101
-
102
- return {
103
- html,
104
- hydrationData: {
105
- props: component.props,
106
- url,
107
- componentId: component.id ?? this.generateId(),
108
- },
109
- timing: this.createTiming(startTime),
110
- };
111
- } catch (error) {
112
- // Handle missing Angular dependencies gracefully
113
- const message = error instanceof Error ? error.message : String(error);
114
-
115
- if (message.includes("Cannot find module '@angular/platform-server'")) {
116
- throw new Error(
117
- '[Flight/Angular] Angular SSR dependencies not found.\n' +
118
- 'Install required packages:\n' +
119
- ' npm install @angular/core @angular/platform-server @angular/platform-browser'
120
- );
121
- }
122
-
123
- throw error;
124
- }
125
- }
126
-
127
- override getHydrationScript(result: RenderResult): string {
128
- const data = this.serializeProps(result.hydrationData);
129
-
130
- // Angular handles hydration differently - it's built into the render output
131
- // This script is for passing additional Flight-specific data
132
- return `
133
- <script type="module">
134
- window.__FLIGHT_DATA__ = ${data};
135
- window.__FLIGHT_ADAPTER__ = 'angular';
136
- // Angular hydration is automatic when provideClientHydration is configured
137
- </script>
138
- `.trim();
139
- }
140
-
141
- override getClientEntry(): string {
142
- return `
143
- import { bootstrapApplication } from '@angular/platform-browser';
144
- import { provideClientHydration } from '@angular/platform-browser';
145
-
146
- export async function hydrate() {
147
- const App = window.__FLIGHT_APP__;
148
- const data = window.__FLIGHT_DATA__ ?? {};
149
-
150
- if (!App) {
151
- console.warn('[Flight/Angular] No App component found');
152
- return;
153
- }
154
-
155
- try {
156
- const appRef = await bootstrapApplication(App, {
157
- providers: [
158
- provideClientHydration(),
159
- // Additional providers can be added here
160
- ],
161
- });
162
-
163
- console.log('[Flight/Angular] Application bootstrapped');
164
- return appRef;
165
- } catch (error) {
166
- console.error('[Flight/Angular] Bootstrap failed:', error);
167
- throw error;
168
- }
169
- }
170
-
171
- export async function render(AppComponent, providers = []) {
172
- return bootstrapApplication(AppComponent, {
173
- providers: [
174
- ...providers,
175
- ],
176
- });
177
- }
178
- `.trim();
179
- }
180
-
181
- /**
182
- * Get the default document template for SSR
183
- */
184
- private getDefaultDocumentTemplate(): string {
185
- return `
186
- <!DOCTYPE html>
187
- <html lang="en">
188
- <head>
189
- <meta charset="UTF-8">
190
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
191
- <title>Flight App</title>
192
- </head>
193
- <body>
194
- <app-root></app-root>
195
- </body>
196
- </html>
197
- `.trim();
198
- }
199
- }
200
-
201
- // ============================================================================
202
- // Factory Function
203
- // ============================================================================
204
-
205
- /**
206
- * Create an Angular UI adapter.
207
- *
208
- * @example
209
- * ```typescript
210
- * import { angular } from '@flightdev/ui/angular';
211
- * import { defineUI } from '@flightdev/ui';
212
- *
213
- * export default defineUI(angular({
214
- * incrementalHydration: true,
215
- * eventReplay: true,
216
- * }));
217
- * ```
218
- */
219
- export function angular(options?: AngularAdapterOptions): AngularAdapter {
220
- return new AngularAdapter(options);
221
- }
222
-
223
- export default angular;
@@ -1,12 +0,0 @@
1
- /**
2
- * @flightdev/ui - Tier 1 Adapters Index
3
- *
4
- * Re-exports all Tier 1 (Full Support) adapters.
5
- */
6
-
7
- export { react, ReactAdapter, type ReactAdapterOptions } from './react.js';
8
- export { vue, VueAdapter, type VueAdapterOptions } from './vue.js';
9
- export { angular, AngularAdapter, type AngularAdapterOptions, type AngularBootstrapFn } from './angular.js';
10
- export { svelte, SvelteAdapter, type SvelteAdapterOptions } from './svelte.js';
11
- export { solid, SolidAdapter, type SolidAdapterOptions } from './solid.js';
12
- export { qwik, QwikAdapter, type QwikAdapterOptions } from './qwik.js';
@@ -1,177 +0,0 @@
1
- /**
2
- * @flightdev/ui - Qwik Adapter (Tier 1)
3
- *
4
- * Qwik adapter with resumable hydration - zero JavaScript until interaction.
5
- *
6
- * @module @flightdev/ui/qwik
7
- * @version 2.0.0
8
- */
9
-
10
- import { BaseUIAdapter } from '../../core/adapter.js';
11
- import type {
12
- AdapterCapabilities,
13
- Component,
14
- RenderContext,
15
- RenderResult,
16
- } from '../../core/types.js';
17
-
18
- // ============================================================================
19
- // Types
20
- // ============================================================================
21
-
22
- export interface QwikAdapterOptions {
23
- /** Enable prefetching */
24
- prefetch?: boolean;
25
-
26
- /** Prefetch strategy */
27
- prefetchStrategy?: 'hover' | 'viewport' | 'idle';
28
-
29
- /** Container tag name */
30
- containerTagName?: string;
31
- }
32
-
33
- // ============================================================================
34
- // Qwik Adapter
35
- // ============================================================================
36
-
37
- export class QwikAdapter extends BaseUIAdapter {
38
- readonly id = 'qwik';
39
- readonly name = 'Qwik';
40
- readonly framework = 'qwik';
41
- readonly frameworkVersion = '1.0+';
42
- readonly tier = 'tier-1' as const;
43
-
44
- override readonly capabilities: AdapterCapabilities = {
45
- streaming: true,
46
- partialHydration: true,
47
- islands: true,
48
- resumable: true, // Qwik's killer feature!
49
- ssg: true,
50
- csr: true,
51
- serverComponents: false,
52
- };
53
-
54
- constructor(private options: QwikAdapterOptions = {}) {
55
- super();
56
- }
57
-
58
- async renderToString(
59
- component: Component,
60
- _context?: RenderContext
61
- ): Promise<RenderResult> {
62
- const startTime = performance.now();
63
-
64
- try {
65
- const { renderToString } = await import('@builder.io/qwik/server');
66
-
67
- const QwikComponent = component.component as () => unknown;
68
- const containerTagName = this.options.containerTagName ?? 'div';
69
-
70
- const result = await renderToString(QwikComponent, {
71
- containerTagName,
72
- // Qwik serializes state automatically
73
- });
74
-
75
- return {
76
- html: result.html,
77
- hydrationData: {
78
- // Qwik doesn't need explicit hydration data
79
- // State is serialized in the HTML
80
- componentId: component.id ?? this.generateId(),
81
- },
82
- timing: this.createTiming(startTime),
83
- };
84
- } catch (error) {
85
- const message = error instanceof Error ? error.message : String(error);
86
-
87
- if (message.includes("Cannot find module '@builder.io/qwik/server'")) {
88
- throw new Error(
89
- '[Flight/Qwik] Qwik dependencies not found.\n' +
90
- 'Install required packages:\n' +
91
- ' npm install @builder.io/qwik'
92
- );
93
- }
94
-
95
- throw error;
96
- }
97
- }
98
-
99
- /**
100
- * Serialize state for resumability (Qwik's specialty)
101
- */
102
- override serializeState(state: unknown): string {
103
- // Qwik handles serialization internally via qwik/serialization
104
- return JSON.stringify(state);
105
- }
106
-
107
- /**
108
- * Resume from serialized state
109
- */
110
- override resumeFromState(_serialized: string): unknown {
111
- // Qwik automatically resumes from HTML-embedded state
112
- // This is called by the client-side Qwik runtime
113
- return null;
114
- }
115
-
116
- override getHydrationScript(_result: RenderResult): string {
117
- // Qwik doesn't need traditional hydration scripts
118
- // It uses resumability - the state is in the HTML
119
- const prefetchStrategy = this.options.prefetchStrategy ?? 'idle';
120
-
121
- return `
122
- <script type="module">
123
- window.__FLIGHT_ADAPTER__ = 'qwik';
124
- // Qwik handles resumability automatically
125
- // No hydration script needed - Qwik resumes from HTML state
126
- // Prefetch strategy: ${prefetchStrategy}
127
- </script>
128
- `.trim();
129
- }
130
-
131
- override getClientEntry(): string {
132
- return `
133
- // Qwik Client Entry
134
- // Qwik uses resumability - no traditional hydration needed
135
-
136
- export function hydrate() {
137
- // Qwik automatically resumes from HTML-serialized state
138
- // This function is a no-op for Qwik
139
- console.log('[Flight/Qwik] Resumability enabled - no hydration needed');
140
- }
141
-
142
- export function prefetch() {
143
- // Trigger Qwik prefetching
144
- if ('requestIdleCallback' in window) {
145
- requestIdleCallback(() => {
146
- const qwikLoader = document.querySelector('[q\\\\:container]');
147
- if (qwikLoader) {
148
- // Qwik prefetches automatically based on container attributes
149
- }
150
- });
151
- }
152
- }
153
- `.trim();
154
- }
155
- }
156
-
157
- // ============================================================================
158
- // Factory Function
159
- // ============================================================================
160
-
161
- /**
162
- * Create a Qwik UI adapter.
163
- *
164
- * @example
165
- * ```typescript
166
- * import { qwik } from '@flightdev/ui/qwik';
167
- * import { defineUI } from '@flightdev/ui';
168
- *
169
- * // Qwik's resumability means zero JS until interaction!
170
- * export default defineUI(qwik({ prefetchStrategy: 'idle' }));
171
- * ```
172
- */
173
- export function qwik(options?: QwikAdapterOptions): QwikAdapter {
174
- return new QwikAdapter(options);
175
- }
176
-
177
- export default qwik;