@flightdev/ui 2.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 (118) hide show
  1. package/.turbo/turbo-build.log +81 -0
  2. package/.turbo/turbo-lint.log +40 -0
  3. package/.turbo/turbo-typecheck.log +4 -0
  4. package/LICENSE +21 -0
  5. package/README.md +92 -0
  6. package/TESTING.md +124 -0
  7. package/dist/adapter-MMD-iHNx.d.ts +424 -0
  8. package/dist/adapters/tier-1/angular.d.ts +60 -0
  9. package/dist/adapters/tier-1/angular.js +2 -0
  10. package/dist/adapters/tier-1/index.d.ts +7 -0
  11. package/dist/adapters/tier-1/index.js +7 -0
  12. package/dist/adapters/tier-1/qwik.d.ts +55 -0
  13. package/dist/adapters/tier-1/qwik.js +2 -0
  14. package/dist/adapters/tier-1/react.d.ts +67 -0
  15. package/dist/adapters/tier-1/react.js +2 -0
  16. package/dist/adapters/tier-1/solid.d.ts +45 -0
  17. package/dist/adapters/tier-1/solid.js +2 -0
  18. package/dist/adapters/tier-1/svelte.d.ts +48 -0
  19. package/dist/adapters/tier-1/svelte.js +2 -0
  20. package/dist/adapters/tier-1/vue.d.ts +47 -0
  21. package/dist/adapters/tier-1/vue.js +2 -0
  22. package/dist/adapters/tier-2/index.d.ts +7 -0
  23. package/dist/adapters/tier-2/index.js +7 -0
  24. package/dist/adapters/tier-2/inferno.d.ts +31 -0
  25. package/dist/adapters/tier-2/inferno.js +2 -0
  26. package/dist/adapters/tier-2/lit.d.ts +34 -0
  27. package/dist/adapters/tier-2/lit.js +2 -0
  28. package/dist/adapters/tier-2/marko.d.ts +59 -0
  29. package/dist/adapters/tier-2/marko.js +2 -0
  30. package/dist/adapters/tier-2/mithril.d.ts +31 -0
  31. package/dist/adapters/tier-2/mithril.js +2 -0
  32. package/dist/adapters/tier-2/preact.d.ts +33 -0
  33. package/dist/adapters/tier-2/preact.js +2 -0
  34. package/dist/adapters/tier-2/stencil.d.ts +52 -0
  35. package/dist/adapters/tier-2/stencil.js +2 -0
  36. package/dist/adapters/tier-3/alpine.d.ts +73 -0
  37. package/dist/adapters/tier-3/alpine.js +2 -0
  38. package/dist/adapters/tier-3/hotwire.d.ts +71 -0
  39. package/dist/adapters/tier-3/hotwire.js +2 -0
  40. package/dist/adapters/tier-3/htmx.d.ts +88 -0
  41. package/dist/adapters/tier-3/htmx.js +2 -0
  42. package/dist/adapters/tier-3/index.d.ts +7 -0
  43. package/dist/adapters/tier-3/index.js +7 -0
  44. package/dist/adapters/tier-3/petite-vue.d.ts +56 -0
  45. package/dist/adapters/tier-3/petite-vue.js +2 -0
  46. package/dist/adapters/tier-3/stimulus.d.ts +63 -0
  47. package/dist/adapters/tier-3/stimulus.js +2 -0
  48. package/dist/adapters/tier-3/vanilla.d.ts +63 -0
  49. package/dist/adapters/tier-3/vanilla.js +2 -0
  50. package/dist/chunk-2SNQ6PTM.js +217 -0
  51. package/dist/chunk-3D4XMIZI.js +136 -0
  52. package/dist/chunk-3HU6GSQ4.js +125 -0
  53. package/dist/chunk-4PZDNFL7.js +148 -0
  54. package/dist/chunk-5IBLFTYL.js +114 -0
  55. package/dist/chunk-64JZJ7OK.js +142 -0
  56. package/dist/chunk-7ZJI3QU2.js +132 -0
  57. package/dist/chunk-CE4FJHQJ.js +133 -0
  58. package/dist/chunk-DTCAUBH5.js +87 -0
  59. package/dist/chunk-NTASPOHG.js +106 -0
  60. package/dist/chunk-OI2AMQLG.js +152 -0
  61. package/dist/chunk-Q7HUE44H.js +106 -0
  62. package/dist/chunk-QH3LOWXU.js +155 -0
  63. package/dist/chunk-QIVAK6BH.js +103 -0
  64. package/dist/chunk-V34XPVGK.js +103 -0
  65. package/dist/chunk-VK7ZPMO7.js +221 -0
  66. package/dist/chunk-X6CNUW6T.js +136 -0
  67. package/dist/chunk-XTDK7ME5.js +382 -0
  68. package/dist/chunk-YFGSHW5S.js +121 -0
  69. package/dist/chunk-ZAJVSE7J.js +90 -0
  70. package/dist/core/index.d.ts +161 -0
  71. package/dist/core/index.js +2 -0
  72. package/dist/index.d.ts +103 -0
  73. package/dist/index.js +71 -0
  74. package/docs/ADAPTERS.md +946 -0
  75. package/docs/PATTERNS.md +836 -0
  76. package/package.json +229 -0
  77. package/src/adapters/tier-1/angular.ts +223 -0
  78. package/src/adapters/tier-1/index.ts +12 -0
  79. package/src/adapters/tier-1/qwik.ts +177 -0
  80. package/src/adapters/tier-1/react.ts +330 -0
  81. package/src/adapters/tier-1/solid.ts +222 -0
  82. package/src/adapters/tier-1/svelte.ts +211 -0
  83. package/src/adapters/tier-1/vue.ts +234 -0
  84. package/src/adapters/tier-2/index.ts +12 -0
  85. package/src/adapters/tier-2/inferno.ts +149 -0
  86. package/src/adapters/tier-2/lit.ts +191 -0
  87. package/src/adapters/tier-2/marko.ts +199 -0
  88. package/src/adapters/tier-2/mithril.ts +152 -0
  89. package/src/adapters/tier-2/preact.ts +133 -0
  90. package/src/adapters/tier-2/stencil.ts +214 -0
  91. package/src/adapters/tier-3/alpine.ts +218 -0
  92. package/src/adapters/tier-3/hotwire.ts +254 -0
  93. package/src/adapters/tier-3/htmx.ts +263 -0
  94. package/src/adapters/tier-3/index.ts +12 -0
  95. package/src/adapters/tier-3/petite-vue.ts +163 -0
  96. package/src/adapters/tier-3/stimulus.ts +233 -0
  97. package/src/adapters/tier-3/vanilla.ts +252 -0
  98. package/src/ambient.d.ts +310 -0
  99. package/src/core/adapter.ts +366 -0
  100. package/src/core/index.ts +56 -0
  101. package/src/core/registry.ts +518 -0
  102. package/src/core/types.ts +461 -0
  103. package/src/htmx.ts +134 -0
  104. package/src/index.ts +263 -0
  105. package/test/__mocks__/stencil-core.ts +19 -0
  106. package/test/__mocks__/stencil-hydrate.ts +15 -0
  107. package/test/adapters/tier-1.test.ts +206 -0
  108. package/test/adapters/tier-2.test.ts +175 -0
  109. package/test/adapters/tier-3.test.ts +284 -0
  110. package/test/contracts/adapter.contract.ts +293 -0
  111. package/test/core/core.test.ts +310 -0
  112. package/test/errors/error-handling.test.ts +454 -0
  113. package/test/integration/htmx.integration.test.ts +246 -0
  114. package/test/integration/react.integration.test.ts +271 -0
  115. package/test/integration/registry.integration.test.ts +308 -0
  116. package/tsconfig.json +22 -0
  117. package/tsup.config.ts +93 -0
  118. package/vitest.config.ts +101 -0
@@ -0,0 +1,87 @@
1
+ import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
2
+
3
+ // src/adapters/tier-2/preact.ts
4
+ var PreactAdapter = class extends BaseUIAdapter {
5
+ constructor(options = {}) {
6
+ super();
7
+ this.options = options;
8
+ }
9
+ id = "preact";
10
+ name = "Preact";
11
+ framework = "preact";
12
+ frameworkVersion = "10+";
13
+ tier = "tier-2";
14
+ capabilities = {
15
+ streaming: false,
16
+ partialHydration: true,
17
+ islands: true,
18
+ resumable: false,
19
+ ssg: true,
20
+ csr: true,
21
+ serverComponents: false
22
+ };
23
+ async renderToString(component, _context) {
24
+ const startTime = performance.now();
25
+ const renderToString = await import('preact-render-to-string').then((m) => m.default || m.renderToString);
26
+ const { h } = await import('preact');
27
+ const PreactComponent = component.component;
28
+ const element = h(PreactComponent, component.props ?? {});
29
+ const html = renderToString(element);
30
+ return {
31
+ html,
32
+ hydrationData: {
33
+ props: component.props,
34
+ componentId: component.id ?? this.generateId()
35
+ },
36
+ timing: this.createTiming(startTime)
37
+ };
38
+ }
39
+ getHydrationScript(result) {
40
+ const data = this.serializeProps(result.hydrationData);
41
+ return `
42
+ <script type="module">
43
+ window.__FLIGHT_DATA__ = ${data};
44
+ window.__FLIGHT_ADAPTER__ = 'preact';
45
+
46
+ import { h, hydrate } from 'preact';
47
+
48
+ const App = window.__FLIGHT_APP__;
49
+ const container = document.getElementById('app');
50
+
51
+ if (App && container) {
52
+ hydrate(h(App, window.__FLIGHT_DATA__.props), container);
53
+ }
54
+ </script>
55
+ `.trim();
56
+ }
57
+ getClientEntry() {
58
+ return `
59
+ import { h, hydrate, render } from 'preact';
60
+
61
+ export function hydrateApp() {
62
+ const container = document.getElementById('app');
63
+ const App = window.__FLIGHT_APP__;
64
+ const data = window.__FLIGHT_DATA__ ?? {};
65
+
66
+ if (!container || !App) {
67
+ console.warn('[Flight/Preact] Missing container or App');
68
+ return;
69
+ }
70
+
71
+ if (container.innerHTML.trim()) {
72
+ hydrate(h(App, data.props), container);
73
+ } else {
74
+ render(h(App, data.props), container);
75
+ }
76
+ }
77
+
78
+ export { hydrateApp as hydrate };
79
+ `.trim();
80
+ }
81
+ };
82
+ function preact(options) {
83
+ return new PreactAdapter(options);
84
+ }
85
+ var preact_default = preact;
86
+
87
+ export { PreactAdapter, preact, preact_default };
@@ -0,0 +1,106 @@
1
+ import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
2
+
3
+ // src/adapters/tier-1/qwik.ts
4
+ var QwikAdapter = class extends BaseUIAdapter {
5
+ constructor(options = {}) {
6
+ super();
7
+ this.options = options;
8
+ }
9
+ id = "qwik";
10
+ name = "Qwik";
11
+ framework = "qwik";
12
+ frameworkVersion = "1.0+";
13
+ tier = "tier-1";
14
+ capabilities = {
15
+ streaming: true,
16
+ partialHydration: true,
17
+ islands: true,
18
+ resumable: true,
19
+ // Qwik's killer feature!
20
+ ssg: true,
21
+ csr: true,
22
+ serverComponents: false
23
+ };
24
+ async renderToString(component, _context) {
25
+ const startTime = performance.now();
26
+ try {
27
+ const { renderToString } = await import('@builder.io/qwik/server');
28
+ const QwikComponent = component.component;
29
+ const containerTagName = this.options.containerTagName ?? "div";
30
+ const result = await renderToString(QwikComponent, {
31
+ containerTagName
32
+ // Qwik serializes state automatically
33
+ });
34
+ return {
35
+ html: result.html,
36
+ hydrationData: {
37
+ // Qwik doesn't need explicit hydration data
38
+ // State is serialized in the HTML
39
+ componentId: component.id ?? this.generateId()
40
+ },
41
+ timing: this.createTiming(startTime)
42
+ };
43
+ } catch (error) {
44
+ const message = error instanceof Error ? error.message : String(error);
45
+ if (message.includes("Cannot find module '@builder.io/qwik/server'")) {
46
+ throw new Error(
47
+ "[Flight/Qwik] Qwik dependencies not found.\nInstall required packages:\n npm install @builder.io/qwik"
48
+ );
49
+ }
50
+ throw error;
51
+ }
52
+ }
53
+ /**
54
+ * Serialize state for resumability (Qwik's specialty)
55
+ */
56
+ serializeState(state) {
57
+ return JSON.stringify(state);
58
+ }
59
+ /**
60
+ * Resume from serialized state
61
+ */
62
+ resumeFromState(_serialized) {
63
+ return null;
64
+ }
65
+ getHydrationScript(_result) {
66
+ const prefetchStrategy = this.options.prefetchStrategy ?? "idle";
67
+ return `
68
+ <script type="module">
69
+ window.__FLIGHT_ADAPTER__ = 'qwik';
70
+ // Qwik handles resumability automatically
71
+ // No hydration script needed - Qwik resumes from HTML state
72
+ // Prefetch strategy: ${prefetchStrategy}
73
+ </script>
74
+ `.trim();
75
+ }
76
+ getClientEntry() {
77
+ return `
78
+ // Qwik Client Entry
79
+ // Qwik uses resumability - no traditional hydration needed
80
+
81
+ export function hydrate() {
82
+ // Qwik automatically resumes from HTML-serialized state
83
+ // This function is a no-op for Qwik
84
+ console.log('[Flight/Qwik] Resumability enabled - no hydration needed');
85
+ }
86
+
87
+ export function prefetch() {
88
+ // Trigger Qwik prefetching
89
+ if ('requestIdleCallback' in window) {
90
+ requestIdleCallback(() => {
91
+ const qwikLoader = document.querySelector('[q\\\\:container]');
92
+ if (qwikLoader) {
93
+ // Qwik prefetches automatically based on container attributes
94
+ }
95
+ });
96
+ }
97
+ }
98
+ `.trim();
99
+ }
100
+ };
101
+ function qwik(options) {
102
+ return new QwikAdapter(options);
103
+ }
104
+ var qwik_default = qwik;
105
+
106
+ export { QwikAdapter, qwik, qwik_default };
@@ -0,0 +1,152 @@
1
+ import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
2
+
3
+ // src/adapters/tier-3/vanilla.ts
4
+ var VanillaAdapter = class extends BaseUIAdapter {
5
+ constructor(options = {}) {
6
+ super();
7
+ this.options = options;
8
+ }
9
+ id = "vanilla";
10
+ name = "Vanilla Web Components";
11
+ framework = "vanilla";
12
+ frameworkVersion = "ES2022+";
13
+ tier = "tier-3";
14
+ capabilities = {
15
+ streaming: false,
16
+ partialHydration: false,
17
+ islands: true,
18
+ // Web Components ARE islands
19
+ resumable: false,
20
+ ssg: true,
21
+ csr: true,
22
+ serverComponents: false
23
+ };
24
+ async renderToString(component, _context) {
25
+ const startTime = performance.now();
26
+ let html;
27
+ if (typeof component.component === "string") {
28
+ const tagName = component.component;
29
+ const props = component.props ?? {};
30
+ const attrs = Object.entries(props).map(([key, value]) => {
31
+ const attrName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
32
+ return `${attrName}="${this.escapeHtml(String(value))}"`;
33
+ }).join(" ");
34
+ html = `<${tagName} ${attrs}></${tagName}>`;
35
+ } else if (typeof component.component === "function") {
36
+ html = component.component(component.props ?? {});
37
+ } else {
38
+ throw new Error(
39
+ "[Flight/Vanilla] Components must be tag names or template functions."
40
+ );
41
+ }
42
+ return {
43
+ html,
44
+ hydrationData: {
45
+ props: component.props,
46
+ componentId: component.id ?? this.generateId()
47
+ },
48
+ timing: this.createTiming(startTime)
49
+ };
50
+ }
51
+ createIsland(component, props, options) {
52
+ const tagName = component;
53
+ const id = this.generateId();
54
+ const attrs = Object.entries(props ?? {}).map(([key, value]) => {
55
+ const attrName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
56
+ return `${attrName}="${this.escapeHtml(String(value))}"`;
57
+ }).join(" ");
58
+ const placeholder = `
59
+ <${tagName}
60
+ ${attrs}
61
+ data-flight-island="${id}"
62
+ data-flight-hydrate="${options?.hydrate ?? "load"}"
63
+ ></${tagName}>
64
+ `.trim();
65
+ return {
66
+ id,
67
+ component,
68
+ props,
69
+ options: options ?? { hydrate: "load" },
70
+ placeholder
71
+ };
72
+ }
73
+ getHydrationScript(_result) {
74
+ const { polyfill = false } = this.options;
75
+ let scripts = `
76
+ <!-- Flight/Vanilla Web Components -->
77
+ <script>
78
+ window.__FLIGHT_ADAPTER__ = 'vanilla';
79
+ </script>
80
+ `;
81
+ if (polyfill) {
82
+ scripts += `
83
+ <script src="https://unpkg.com/@webcomponents/webcomponentsjs@2.8.0/webcomponents-loader.js"></script>
84
+ `;
85
+ }
86
+ return scripts.trim();
87
+ }
88
+ getClientEntry() {
89
+ return `
90
+ // Vanilla Web Components Client Entry
91
+ // Components self-register when their scripts are loaded
92
+
93
+ export function hydrate() {
94
+ // Web Components auto-upgrade when defined
95
+ console.log('[Flight/Vanilla] Web Components ready');
96
+ }
97
+
98
+ // Helper to define a custom element
99
+ export function define(tagName, elementClass) {
100
+ if (!customElements.get(tagName)) {
101
+ customElements.define(tagName, elementClass);
102
+ }
103
+ }
104
+
105
+ // Wait for a component to be defined
106
+ export function whenDefined(tagName) {
107
+ return customElements.whenDefined(tagName);
108
+ }
109
+
110
+ // Upgrade all elements matching a selector
111
+ export function upgradeAll(selector = '*') {
112
+ document.querySelectorAll(selector).forEach(el => {
113
+ customElements.upgrade(el);
114
+ });
115
+ }
116
+ `.trim();
117
+ }
118
+ };
119
+ function shadowRoot(content, mode = "open") {
120
+ return `<template shadowrootmode="${mode}">${content}</template>`;
121
+ }
122
+ function slot(name) {
123
+ return name ? `<slot name="${name}"></slot>` : "<slot></slot>";
124
+ }
125
+ function createElementClass(tagName, options = {}) {
126
+ const className = tagName.split("-").map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join("");
127
+ return `
128
+ class ${className} extends HTMLElement {
129
+ ${options.observedAttributes ? `static observedAttributes = ${JSON.stringify(options.observedAttributes)};` : ""}
130
+
131
+ constructor() {
132
+ super();
133
+ ${options.template ? `
134
+ this.attachShadow({ mode: 'open' });
135
+ this.shadowRoot.innerHTML = \`${options.template}\`;
136
+ ` : ""}
137
+ }
138
+
139
+ connectedCallback() {
140
+ ${options.connectedCallback ?? ""}
141
+ }
142
+ }
143
+
144
+ customElements.define('${tagName}', ${className});
145
+ `.trim();
146
+ }
147
+ function vanilla(options) {
148
+ return new VanillaAdapter(options);
149
+ }
150
+ var vanilla_default = vanilla;
151
+
152
+ export { VanillaAdapter, createElementClass, shadowRoot, slot, vanilla, vanilla_default };
@@ -0,0 +1,106 @@
1
+ import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
2
+
3
+ // src/adapters/tier-3/alpine.ts
4
+ var AlpineAdapter = class extends BaseUIAdapter {
5
+ constructor(options = {}) {
6
+ super();
7
+ this.options = options;
8
+ }
9
+ id = "alpine";
10
+ name = "Alpine.js";
11
+ framework = "alpine";
12
+ frameworkVersion = "3.14+";
13
+ tier = "tier-3";
14
+ capabilities = {
15
+ streaming: false,
16
+ partialHydration: false,
17
+ islands: false,
18
+ resumable: false,
19
+ ssg: true,
20
+ csr: true,
21
+ serverComponents: false
22
+ };
23
+ async renderToString(component, _context) {
24
+ const startTime = performance.now();
25
+ let html;
26
+ if (typeof component.component === "function") {
27
+ html = component.component(component.props ?? {});
28
+ } else if (typeof component.component === "string") {
29
+ html = component.component;
30
+ } else {
31
+ throw new Error(
32
+ "[Flight/Alpine] Components must be HTML strings or template functions.\nAlpine uses declarative HTML with x-data, x-bind, etc."
33
+ );
34
+ }
35
+ return {
36
+ html,
37
+ hydrationData: component.props,
38
+ timing: this.createTiming(startTime)
39
+ };
40
+ }
41
+ getHydrationScript(_result) {
42
+ const {
43
+ version = "3.14.3",
44
+ plugins = [],
45
+ csp = false,
46
+ cdnBase = "https://cdn.jsdelivr.net/npm"
47
+ } = this.options;
48
+ const pluginScripts = plugins.map(
49
+ (plugin) => `<script defer src="${cdnBase}/@alpinejs/${plugin}@${version}/dist/cdn.min.js"></script>`
50
+ ).join("\n");
51
+ const alpineScript = csp ? `<script defer src="${cdnBase}/@alpinejs/csp@${version}/dist/cdn.min.js"></script>` : `<script defer src="${cdnBase}/alpinejs@${version}/dist/cdn.min.js"></script>`;
52
+ return `
53
+ <!-- Flight/Alpine.js -->
54
+ ${pluginScripts}
55
+ ${alpineScript}
56
+ <script>
57
+ window.__FLIGHT_ADAPTER__ = 'alpine';
58
+ </script>
59
+ `.trim();
60
+ }
61
+ getClientEntry() {
62
+ return `
63
+ // Alpine.js Client Entry
64
+ // Alpine initializes automatically via x-data directives in HTML
65
+
66
+ export function hydrate() {
67
+ // Alpine auto-initializes when loaded
68
+ // No explicit hydration needed
69
+ console.log('[Flight/Alpine] Declarative reactivity active');
70
+ }
71
+
72
+ export function initWithPlugins(plugins = []) {
73
+ // Dynamically load plugins before Alpine
74
+ return Promise.all(
75
+ plugins.map(plugin =>
76
+ import(\`https://cdn.jsdelivr.net/npm/@alpinejs/\${plugin}/dist/cdn.min.js\`)
77
+ )
78
+ ).then(() => {
79
+ return import('alpinejs');
80
+ });
81
+ }
82
+ `.trim();
83
+ }
84
+ };
85
+ function xData(data, content) {
86
+ const dataStr = JSON.stringify(data).replace(/"/g, "'");
87
+ return `<div x-data="${dataStr}">${content}</div>`;
88
+ }
89
+ function xFor(expression, content) {
90
+ return `<template x-for="${expression}">${content}</template>`;
91
+ }
92
+ function xIf(condition, content) {
93
+ return `<template x-if="${condition}">${content}</template>`;
94
+ }
95
+ function xBind(attr, value) {
96
+ return `:${attr}="${value}"`;
97
+ }
98
+ function xOn(event, handler) {
99
+ return `@${event}="${handler}"`;
100
+ }
101
+ function alpine(options) {
102
+ return new AlpineAdapter(options);
103
+ }
104
+ var alpine_default = alpine;
105
+
106
+ export { AlpineAdapter, alpine, alpine_default, xBind, xData, xFor, xIf, xOn };
@@ -0,0 +1,155 @@
1
+ import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
2
+
3
+ // src/adapters/tier-1/vue.ts
4
+ var VueAdapter = class extends BaseUIAdapter {
5
+ constructor(options = {}) {
6
+ super();
7
+ this.options = options;
8
+ }
9
+ id = "vue";
10
+ name = "Vue";
11
+ framework = "vue";
12
+ frameworkVersion = "3+";
13
+ tier = "tier-1";
14
+ capabilities = {
15
+ streaming: true,
16
+ partialHydration: true,
17
+ islands: true,
18
+ resumable: false,
19
+ ssg: true,
20
+ csr: true,
21
+ serverComponents: false
22
+ };
23
+ async renderToString(component, _context) {
24
+ const startTime = performance.now();
25
+ const { createSSRApp } = await import('vue');
26
+ const { renderToString } = await import('vue/server-renderer');
27
+ const app = createSSRApp(
28
+ component.component,
29
+ component.props ?? {}
30
+ );
31
+ if (this.options.configureApp) {
32
+ this.options.configureApp(app);
33
+ }
34
+ const html = await renderToString(app);
35
+ return {
36
+ html,
37
+ hydrationData: {
38
+ props: component.props,
39
+ componentId: component.id ?? this.generateId()
40
+ },
41
+ timing: this.createTiming(startTime)
42
+ };
43
+ }
44
+ renderToStream(component, _context, options) {
45
+ let aborted = false;
46
+ let resolvePromise;
47
+ let rejectPromise;
48
+ const done = new Promise((resolve, reject) => {
49
+ resolvePromise = resolve;
50
+ rejectPromise = reject;
51
+ });
52
+ const stream = new ReadableStream({
53
+ async start(controller) {
54
+ try {
55
+ const { createSSRApp } = await import('vue');
56
+ const { renderToWebStream } = await import('vue/server-renderer');
57
+ const app = createSSRApp(
58
+ component.component,
59
+ component.props ?? {}
60
+ );
61
+ const webStream = renderToWebStream(app);
62
+ const reader = webStream.getReader();
63
+ options?.onShellReady?.();
64
+ while (true) {
65
+ const { done: readerDone, value } = await reader.read();
66
+ if (aborted) {
67
+ reader.cancel();
68
+ break;
69
+ }
70
+ if (readerDone) {
71
+ controller.close();
72
+ resolvePromise();
73
+ options?.onAllReady?.();
74
+ break;
75
+ }
76
+ controller.enqueue(value);
77
+ }
78
+ } catch (error) {
79
+ const err = error instanceof Error ? error : new Error(String(error));
80
+ options?.onError?.(err);
81
+ controller.error(err);
82
+ rejectPromise(err);
83
+ }
84
+ }
85
+ });
86
+ return {
87
+ stream,
88
+ done,
89
+ abort() {
90
+ aborted = true;
91
+ resolvePromise();
92
+ }
93
+ };
94
+ }
95
+ getHydrationScript(result) {
96
+ const data = this.serializeProps(result.hydrationData);
97
+ return `
98
+ <script type="module">
99
+ window.__FLIGHT_DATA__ = ${data};
100
+ window.__FLIGHT_ADAPTER__ = 'vue';
101
+
102
+ import { createApp } from 'vue';
103
+
104
+ const container = document.getElementById('app');
105
+ const App = window.__FLIGHT_APP__;
106
+
107
+ if (container && App) {
108
+ const { props } = window.__FLIGHT_DATA__;
109
+ const app = createApp(App, props);
110
+ app.mount(container);
111
+ }
112
+ </script>
113
+ `.trim();
114
+ }
115
+ getClientEntry() {
116
+ return `
117
+ import { createApp, createSSRApp } from 'vue';
118
+
119
+ export function hydrate() {
120
+ const container = document.getElementById('app');
121
+ const App = window.__FLIGHT_APP__;
122
+ const data = window.__FLIGHT_DATA__ ?? {};
123
+
124
+ if (!container || !App) {
125
+ console.warn('[Flight/Vue] Missing container or App');
126
+ return;
127
+ }
128
+
129
+ // Check if we have SSR content to hydrate
130
+ if (container.innerHTML.trim()) {
131
+ const app = createSSRApp(App, data.props);
132
+ app.mount(container);
133
+ return app;
134
+ } else {
135
+ // Fallback to client-side render
136
+ const app = createApp(App, data.props);
137
+ app.mount(container);
138
+ return app;
139
+ }
140
+ }
141
+
142
+ export function render(App, container, props = {}) {
143
+ const app = createApp(App, props);
144
+ app.mount(container);
145
+ return app;
146
+ }
147
+ `.trim();
148
+ }
149
+ };
150
+ function vue(options) {
151
+ return new VueAdapter(options);
152
+ }
153
+ var vue_default = vue;
154
+
155
+ export { VueAdapter, vue, vue_default };
@@ -0,0 +1,103 @@
1
+ import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
2
+
3
+ // src/adapters/tier-2/inferno.ts
4
+ var InfernoAdapter = class extends BaseUIAdapter {
5
+ constructor(options = {}) {
6
+ super();
7
+ this.options = options;
8
+ }
9
+ id = "inferno";
10
+ name = "Inferno";
11
+ framework = "inferno";
12
+ frameworkVersion = "8+";
13
+ tier = "tier-2";
14
+ capabilities = {
15
+ streaming: false,
16
+ partialHydration: false,
17
+ islands: false,
18
+ resumable: false,
19
+ ssg: true,
20
+ csr: true,
21
+ serverComponents: false
22
+ };
23
+ async renderToString(component, _context) {
24
+ const startTime = performance.now();
25
+ try {
26
+ const { renderToString } = await import('inferno-server');
27
+ const { createElement } = await import('inferno-create-element');
28
+ const InfernoComponent = component.component;
29
+ const element = createElement(InfernoComponent, component.props ?? {});
30
+ const html = renderToString(element);
31
+ return {
32
+ html,
33
+ hydrationData: {
34
+ props: component.props,
35
+ componentId: component.id ?? this.generateId()
36
+ },
37
+ timing: this.createTiming(startTime)
38
+ };
39
+ } catch (error) {
40
+ const message = error instanceof Error ? error.message : String(error);
41
+ if (message.includes("Cannot find module 'inferno-server'")) {
42
+ throw new Error(
43
+ "[Flight/Inferno] Inferno SSR package not found.\nInstall required packages:\n npm install inferno inferno-server inferno-create-element"
44
+ );
45
+ }
46
+ throw error;
47
+ }
48
+ }
49
+ getHydrationScript(result) {
50
+ const data = this.serializeProps(result.hydrationData);
51
+ return `
52
+ <script type="module">
53
+ window.__FLIGHT_DATA__ = ${data};
54
+ window.__FLIGHT_ADAPTER__ = 'inferno';
55
+
56
+ import { hydrate } from 'inferno-hydrate';
57
+ import { createElement } from 'inferno-create-element';
58
+
59
+ const App = window.__FLIGHT_APP__;
60
+ const container = document.getElementById('app');
61
+
62
+ if (App && container) {
63
+ hydrate(
64
+ createElement(App, window.__FLIGHT_DATA__.props),
65
+ container
66
+ );
67
+ }
68
+ </script>
69
+ `.trim();
70
+ }
71
+ getClientEntry() {
72
+ return `
73
+ import { hydrate } from 'inferno-hydrate';
74
+ import { render } from 'inferno';
75
+ import { createElement } from 'inferno-create-element';
76
+
77
+ export function hydrateApp() {
78
+ const container = document.getElementById('app');
79
+ const App = window.__FLIGHT_APP__;
80
+ const data = window.__FLIGHT_DATA__ ?? {};
81
+
82
+ if (!container || !App) {
83
+ console.warn('[Flight/Inferno] Missing container or App');
84
+ return;
85
+ }
86
+
87
+ if (container.innerHTML.trim()) {
88
+ hydrate(createElement(App, data.props), container);
89
+ } else {
90
+ render(createElement(App, data.props), container);
91
+ }
92
+ }
93
+
94
+ export { hydrateApp as hydrate };
95
+ `.trim();
96
+ }
97
+ };
98
+ function inferno(options) {
99
+ return new InfernoAdapter(options);
100
+ }
101
+ var inferno_default = inferno;
102
+
103
+ export { InfernoAdapter, inferno, inferno_default };