@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.
- package/README.md +285 -70
- package/dist/{chunk-XTDK7ME5.js → chunk-S4DTUQII.js} +246 -19
- package/dist/chunk-S4DTUQII.js.map +1 -0
- package/dist/core/index.d.ts +423 -3
- package/dist/core/index.js +23 -2
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -0
- package/package.json +11 -181
- package/.turbo/turbo-build.log +0 -81
- package/.turbo/turbo-lint.log +0 -40
- package/.turbo/turbo-typecheck.log +0 -4
- package/TESTING.md +0 -124
- package/dist/adapter-MMD-iHNx.d.ts +0 -424
- package/dist/adapters/tier-1/angular.d.ts +0 -60
- package/dist/adapters/tier-1/angular.js +0 -2
- package/dist/adapters/tier-1/index.d.ts +0 -7
- package/dist/adapters/tier-1/index.js +0 -7
- package/dist/adapters/tier-1/qwik.d.ts +0 -55
- package/dist/adapters/tier-1/qwik.js +0 -2
- package/dist/adapters/tier-1/react.d.ts +0 -67
- package/dist/adapters/tier-1/react.js +0 -2
- package/dist/adapters/tier-1/solid.d.ts +0 -45
- package/dist/adapters/tier-1/solid.js +0 -2
- package/dist/adapters/tier-1/svelte.d.ts +0 -48
- package/dist/adapters/tier-1/svelte.js +0 -2
- package/dist/adapters/tier-1/vue.d.ts +0 -47
- package/dist/adapters/tier-1/vue.js +0 -2
- package/dist/adapters/tier-2/index.d.ts +0 -7
- package/dist/adapters/tier-2/index.js +0 -7
- package/dist/adapters/tier-2/inferno.d.ts +0 -31
- package/dist/adapters/tier-2/inferno.js +0 -2
- package/dist/adapters/tier-2/lit.d.ts +0 -34
- package/dist/adapters/tier-2/lit.js +0 -2
- package/dist/adapters/tier-2/marko.d.ts +0 -59
- package/dist/adapters/tier-2/marko.js +0 -2
- package/dist/adapters/tier-2/mithril.d.ts +0 -31
- package/dist/adapters/tier-2/mithril.js +0 -2
- package/dist/adapters/tier-2/preact.d.ts +0 -33
- package/dist/adapters/tier-2/preact.js +0 -2
- package/dist/adapters/tier-2/stencil.d.ts +0 -52
- package/dist/adapters/tier-2/stencil.js +0 -2
- package/dist/adapters/tier-3/alpine.d.ts +0 -73
- package/dist/adapters/tier-3/alpine.js +0 -2
- package/dist/adapters/tier-3/hotwire.d.ts +0 -71
- package/dist/adapters/tier-3/hotwire.js +0 -2
- package/dist/adapters/tier-3/htmx.d.ts +0 -88
- package/dist/adapters/tier-3/htmx.js +0 -2
- package/dist/adapters/tier-3/index.d.ts +0 -7
- package/dist/adapters/tier-3/index.js +0 -7
- package/dist/adapters/tier-3/petite-vue.d.ts +0 -56
- package/dist/adapters/tier-3/petite-vue.js +0 -2
- package/dist/adapters/tier-3/stimulus.d.ts +0 -63
- package/dist/adapters/tier-3/stimulus.js +0 -2
- package/dist/adapters/tier-3/vanilla.d.ts +0 -63
- package/dist/adapters/tier-3/vanilla.js +0 -2
- package/dist/chunk-2SNQ6PTM.js +0 -217
- package/dist/chunk-3D4XMIZI.js +0 -136
- package/dist/chunk-3HU6GSQ4.js +0 -125
- package/dist/chunk-4PZDNFL7.js +0 -148
- package/dist/chunk-5IBLFTYL.js +0 -114
- package/dist/chunk-64JZJ7OK.js +0 -142
- package/dist/chunk-7ZJI3QU2.js +0 -132
- package/dist/chunk-CE4FJHQJ.js +0 -133
- package/dist/chunk-DTCAUBH5.js +0 -87
- package/dist/chunk-NTASPOHG.js +0 -106
- package/dist/chunk-OI2AMQLG.js +0 -152
- package/dist/chunk-Q7HUE44H.js +0 -106
- package/dist/chunk-QH3LOWXU.js +0 -155
- package/dist/chunk-QIVAK6BH.js +0 -103
- package/dist/chunk-V34XPVGK.js +0 -103
- package/dist/chunk-VK7ZPMO7.js +0 -221
- package/dist/chunk-X6CNUW6T.js +0 -136
- package/dist/chunk-YFGSHW5S.js +0 -121
- package/dist/chunk-ZAJVSE7J.js +0 -90
- package/docs/ADAPTERS.md +0 -946
- package/docs/PATTERNS.md +0 -836
- package/src/adapters/tier-1/angular.ts +0 -223
- package/src/adapters/tier-1/index.ts +0 -12
- package/src/adapters/tier-1/qwik.ts +0 -177
- package/src/adapters/tier-1/react.ts +0 -330
- package/src/adapters/tier-1/solid.ts +0 -222
- package/src/adapters/tier-1/svelte.ts +0 -211
- package/src/adapters/tier-1/vue.ts +0 -234
- package/src/adapters/tier-2/index.ts +0 -12
- package/src/adapters/tier-2/inferno.ts +0 -149
- package/src/adapters/tier-2/lit.ts +0 -191
- package/src/adapters/tier-2/marko.ts +0 -199
- package/src/adapters/tier-2/mithril.ts +0 -152
- package/src/adapters/tier-2/preact.ts +0 -133
- package/src/adapters/tier-2/stencil.ts +0 -214
- package/src/adapters/tier-3/alpine.ts +0 -218
- package/src/adapters/tier-3/hotwire.ts +0 -254
- package/src/adapters/tier-3/htmx.ts +0 -263
- package/src/adapters/tier-3/index.ts +0 -12
- package/src/adapters/tier-3/petite-vue.ts +0 -163
- package/src/adapters/tier-3/stimulus.ts +0 -233
- package/src/adapters/tier-3/vanilla.ts +0 -252
- package/src/ambient.d.ts +0 -310
- package/src/core/adapter.ts +0 -366
- package/src/core/index.ts +0 -56
- package/src/core/registry.ts +0 -518
- package/src/core/types.ts +0 -461
- package/src/htmx.ts +0 -134
- package/src/index.ts +0 -263
- package/test/__mocks__/stencil-core.ts +0 -19
- package/test/__mocks__/stencil-hydrate.ts +0 -15
- package/test/adapters/tier-1.test.ts +0 -206
- package/test/adapters/tier-2.test.ts +0 -175
- package/test/adapters/tier-3.test.ts +0 -284
- package/test/contracts/adapter.contract.ts +0 -293
- package/test/core/core.test.ts +0 -310
- package/test/errors/error-handling.test.ts +0 -454
- package/test/integration/htmx.integration.test.ts +0 -246
- package/test/integration/react.integration.test.ts +0 -271
- package/test/integration/registry.integration.test.ts +0 -308
- package/tsconfig.json +0 -22
- package/tsup.config.ts +0 -93
- package/vitest.config.ts +0 -101
package/dist/chunk-V34XPVGK.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-2/mithril.ts
|
|
4
|
-
var MithrilAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
}
|
|
9
|
-
id = "mithril";
|
|
10
|
-
name = "Mithril";
|
|
11
|
-
framework = "mithril";
|
|
12
|
-
frameworkVersion = "2+";
|
|
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 render = await import('mithril-node-render').then((m2) => m2.default || m2);
|
|
27
|
-
const m = await import('mithril').then((mod) => mod.default || mod);
|
|
28
|
-
const MithrilComponent = component.component;
|
|
29
|
-
const vnode = m(MithrilComponent, component.props ?? {});
|
|
30
|
-
const html = await render(vnode);
|
|
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 'mithril-node-render'")) {
|
|
42
|
-
throw new Error(
|
|
43
|
-
"[Flight/Mithril] Mithril SSR package not found.\nInstall required packages:\n npm install mithril mithril-node-render\n npm install -D @types/mithril"
|
|
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__ = 'mithril';
|
|
55
|
-
|
|
56
|
-
import m from 'mithril';
|
|
57
|
-
|
|
58
|
-
const App = window.__FLIGHT_APP__;
|
|
59
|
-
const container = document.getElementById('app');
|
|
60
|
-
|
|
61
|
-
if (App && container) {
|
|
62
|
-
// Mithril mounts and diffs against existing DOM
|
|
63
|
-
m.mount(container, {
|
|
64
|
-
view: () => m(App, window.__FLIGHT_DATA__.props)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
</script>
|
|
68
|
-
`.trim();
|
|
69
|
-
}
|
|
70
|
-
getClientEntry() {
|
|
71
|
-
return `
|
|
72
|
-
import m from 'mithril';
|
|
73
|
-
|
|
74
|
-
export function hydrate() {
|
|
75
|
-
const container = document.getElementById('app');
|
|
76
|
-
const App = window.__FLIGHT_APP__;
|
|
77
|
-
const data = window.__FLIGHT_DATA__ ?? {};
|
|
78
|
-
|
|
79
|
-
if (!container || !App) {
|
|
80
|
-
console.warn('[Flight/Mithril] Missing container or App');
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Mithril automatically diffs against existing DOM
|
|
85
|
-
m.mount(container, {
|
|
86
|
-
view: () => m(App, data.props)
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function render(App, container, props = {}) {
|
|
91
|
-
m.mount(container, {
|
|
92
|
-
view: () => m(App, props)
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
`.trim();
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
function mithril(options) {
|
|
99
|
-
return new MithrilAdapter(options);
|
|
100
|
-
}
|
|
101
|
-
var mithril_default = mithril;
|
|
102
|
-
|
|
103
|
-
export { MithrilAdapter, mithril, mithril_default };
|
package/dist/chunk-VK7ZPMO7.js
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-1/react.ts
|
|
4
|
-
var ReactAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
}
|
|
9
|
-
id = "react";
|
|
10
|
-
name = "React";
|
|
11
|
-
framework = "react";
|
|
12
|
-
frameworkVersion = "18+";
|
|
13
|
-
tier = "tier-1";
|
|
14
|
-
capabilities = {
|
|
15
|
-
streaming: true,
|
|
16
|
-
partialHydration: true,
|
|
17
|
-
islands: true,
|
|
18
|
-
resumable: false,
|
|
19
|
-
// React 19 has some resumability features
|
|
20
|
-
ssg: true,
|
|
21
|
-
csr: true,
|
|
22
|
-
serverComponents: true
|
|
23
|
-
};
|
|
24
|
-
async renderToString(component, _context) {
|
|
25
|
-
const startTime = performance.now();
|
|
26
|
-
const { renderToString } = await import('react-dom/server');
|
|
27
|
-
const { createElement } = await import('react');
|
|
28
|
-
const element = createElement(
|
|
29
|
-
component.component,
|
|
30
|
-
component.props ?? {},
|
|
31
|
-
component.children
|
|
32
|
-
);
|
|
33
|
-
const html = renderToString(element);
|
|
34
|
-
return {
|
|
35
|
-
html,
|
|
36
|
-
hydrationData: {
|
|
37
|
-
props: component.props,
|
|
38
|
-
componentId: component.id ?? this.generateId()
|
|
39
|
-
},
|
|
40
|
-
timing: this.createTiming(startTime)
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Render to stream using React 18+ streaming SSR.
|
|
45
|
-
*
|
|
46
|
-
* Uses `renderToReadableStream` (Web Streams API) which works in:
|
|
47
|
-
* - Node.js 18+ (with Web Streams support)
|
|
48
|
-
* - Deno
|
|
49
|
-
* - Cloudflare Workers
|
|
50
|
-
* - Vercel Edge Runtime
|
|
51
|
-
* - Other edge runtimes
|
|
52
|
-
*
|
|
53
|
-
* Falls back to `renderToPipeableStream` for Node.js environments
|
|
54
|
-
* that require traditional streams.
|
|
55
|
-
*/
|
|
56
|
-
renderToStream(component, _context, options) {
|
|
57
|
-
let aborted = false;
|
|
58
|
-
let abortController = null;
|
|
59
|
-
let resolvePromise;
|
|
60
|
-
let rejectPromise;
|
|
61
|
-
const done = new Promise((resolve, reject) => {
|
|
62
|
-
resolvePromise = resolve;
|
|
63
|
-
rejectPromise = reject;
|
|
64
|
-
});
|
|
65
|
-
const stream = new ReadableStream({
|
|
66
|
-
start: async (controller) => {
|
|
67
|
-
try {
|
|
68
|
-
const { renderToReadableStream } = await import('react-dom/server');
|
|
69
|
-
const { createElement } = await import('react');
|
|
70
|
-
const element = createElement(
|
|
71
|
-
component.component,
|
|
72
|
-
component.props ?? {},
|
|
73
|
-
component.children
|
|
74
|
-
);
|
|
75
|
-
abortController = new AbortController();
|
|
76
|
-
const reactStream = await renderToReadableStream(element, {
|
|
77
|
-
signal: abortController.signal,
|
|
78
|
-
onError(error) {
|
|
79
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
80
|
-
options?.onError?.(err);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
options?.onShellReady?.();
|
|
84
|
-
const reader = reactStream.getReader();
|
|
85
|
-
const pump = async () => {
|
|
86
|
-
try {
|
|
87
|
-
while (true) {
|
|
88
|
-
if (aborted) {
|
|
89
|
-
await reader.cancel();
|
|
90
|
-
controller.close();
|
|
91
|
-
resolvePromise();
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
const { done: readerDone, value } = await reader.read();
|
|
95
|
-
if (readerDone) {
|
|
96
|
-
controller.close();
|
|
97
|
-
options?.onAllReady?.();
|
|
98
|
-
resolvePromise();
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
if (value) {
|
|
102
|
-
controller.enqueue(value);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
} catch (error) {
|
|
106
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
107
|
-
options?.onError?.(err);
|
|
108
|
-
controller.error(err);
|
|
109
|
-
rejectPromise(err);
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
await pump();
|
|
113
|
-
} catch (error) {
|
|
114
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
115
|
-
if (err.message.includes("renderToReadableStream")) {
|
|
116
|
-
await this.fallbackStreamRender(component, controller, options, resolvePromise, rejectPromise);
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
options?.onShellError?.(err);
|
|
120
|
-
options?.onError?.(err);
|
|
121
|
-
controller.error(err);
|
|
122
|
-
rejectPromise(err);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
return {
|
|
127
|
-
stream,
|
|
128
|
-
done,
|
|
129
|
-
abort: () => {
|
|
130
|
-
aborted = true;
|
|
131
|
-
abortController?.abort();
|
|
132
|
-
resolvePromise();
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Fallback render for environments without Web Streams support.
|
|
138
|
-
* Uses renderToString and emits as a single chunk.
|
|
139
|
-
*/
|
|
140
|
-
async fallbackStreamRender(component, controller, options, resolvePromise, rejectPromise) {
|
|
141
|
-
try {
|
|
142
|
-
const { renderToString } = await import('react-dom/server');
|
|
143
|
-
const { createElement } = await import('react');
|
|
144
|
-
const element = createElement(
|
|
145
|
-
component.component,
|
|
146
|
-
component.props ?? {},
|
|
147
|
-
component.children
|
|
148
|
-
);
|
|
149
|
-
options?.onShellReady?.();
|
|
150
|
-
const html = renderToString(element);
|
|
151
|
-
const encoded = new TextEncoder().encode(html);
|
|
152
|
-
controller.enqueue(encoded);
|
|
153
|
-
controller.close();
|
|
154
|
-
options?.onAllReady?.();
|
|
155
|
-
resolvePromise();
|
|
156
|
-
} catch (error) {
|
|
157
|
-
const err = error instanceof Error ? error : new Error(String(error));
|
|
158
|
-
options?.onError?.(err);
|
|
159
|
-
controller.error(err);
|
|
160
|
-
rejectPromise(err);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
getHydrationScript(result) {
|
|
164
|
-
const data = this.serializeProps(result.hydrationData);
|
|
165
|
-
return `
|
|
166
|
-
<script type="module">
|
|
167
|
-
window.__FLIGHT_DATA__ = ${data};
|
|
168
|
-
window.__FLIGHT_ADAPTER__ = 'react';
|
|
169
|
-
|
|
170
|
-
import { hydrateRoot } from 'react-dom/client';
|
|
171
|
-
|
|
172
|
-
const container = document.getElementById('app');
|
|
173
|
-
const App = window.__FLIGHT_APP__;
|
|
174
|
-
|
|
175
|
-
if (container && App) {
|
|
176
|
-
const { props } = window.__FLIGHT_DATA__;
|
|
177
|
-
import('react').then(({ createElement }) => {
|
|
178
|
-
hydrateRoot(container, createElement(App, props));
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
</script>
|
|
182
|
-
`.trim();
|
|
183
|
-
}
|
|
184
|
-
getClientEntry() {
|
|
185
|
-
return `
|
|
186
|
-
import { hydrateRoot, createRoot } from 'react-dom/client';
|
|
187
|
-
import { createElement } from 'react';
|
|
188
|
-
|
|
189
|
-
export function hydrate() {
|
|
190
|
-
const container = document.getElementById('app');
|
|
191
|
-
const App = window.__FLIGHT_APP__;
|
|
192
|
-
const data = window.__FLIGHT_DATA__ ?? {};
|
|
193
|
-
|
|
194
|
-
if (!container || !App) {
|
|
195
|
-
console.warn('[Flight/React] Missing container or App');
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Check if we have SSR content to hydrate
|
|
200
|
-
if (container.innerHTML.trim()) {
|
|
201
|
-
hydrateRoot(container, createElement(App, data.props));
|
|
202
|
-
} else {
|
|
203
|
-
// Fallback to client-side render
|
|
204
|
-
createRoot(container).render(createElement(App, data.props));
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export function render(App, container, props = {}) {
|
|
209
|
-
const root = createRoot(container);
|
|
210
|
-
root.render(createElement(App, props));
|
|
211
|
-
return root;
|
|
212
|
-
}
|
|
213
|
-
`.trim();
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
function react(options) {
|
|
217
|
-
return new ReactAdapter(options);
|
|
218
|
-
}
|
|
219
|
-
var react_default = react;
|
|
220
|
-
|
|
221
|
-
export { ReactAdapter, react, react_default };
|
package/dist/chunk-X6CNUW6T.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-1/svelte.ts
|
|
4
|
-
var SvelteAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
}
|
|
9
|
-
id = "svelte";
|
|
10
|
-
name = "Svelte";
|
|
11
|
-
framework = "svelte";
|
|
12
|
-
frameworkVersion = "5+";
|
|
13
|
-
tier = "tier-1";
|
|
14
|
-
capabilities = {
|
|
15
|
-
streaming: false,
|
|
16
|
-
// Svelte 5 doesn't have streaming SSR yet
|
|
17
|
-
partialHydration: true,
|
|
18
|
-
islands: true,
|
|
19
|
-
resumable: false,
|
|
20
|
-
ssg: true,
|
|
21
|
-
csr: true,
|
|
22
|
-
serverComponents: false
|
|
23
|
-
};
|
|
24
|
-
async renderToString(component, _context) {
|
|
25
|
-
const startTime = performance.now();
|
|
26
|
-
try {
|
|
27
|
-
const { render } = await import('svelte/server');
|
|
28
|
-
const SvelteComponent = component.component;
|
|
29
|
-
const { body, head } = render(SvelteComponent, {
|
|
30
|
-
props: component.props ?? {}
|
|
31
|
-
});
|
|
32
|
-
return {
|
|
33
|
-
html: body,
|
|
34
|
-
head,
|
|
35
|
-
hydrationData: {
|
|
36
|
-
props: component.props,
|
|
37
|
-
componentId: component.id ?? this.generateId()
|
|
38
|
-
},
|
|
39
|
-
css: this.options.extractCss ? void 0 : void 0,
|
|
40
|
-
// CSS handled by bundler
|
|
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 'svelte/server'")) {
|
|
46
|
-
return this.renderSvelte4(component, startTime);
|
|
47
|
-
}
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Fallback render for Svelte 4
|
|
53
|
-
*/
|
|
54
|
-
async renderSvelte4(component, startTime) {
|
|
55
|
-
const SvelteComponent = component.component;
|
|
56
|
-
const result = SvelteComponent.render(component.props ?? {});
|
|
57
|
-
return {
|
|
58
|
-
html: result.html,
|
|
59
|
-
head: result.head,
|
|
60
|
-
css: result.css?.code,
|
|
61
|
-
hydrationData: {
|
|
62
|
-
props: component.props,
|
|
63
|
-
componentId: component.id ?? this.generateId()
|
|
64
|
-
},
|
|
65
|
-
timing: this.createTiming(startTime)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
getHydrationScript(result) {
|
|
69
|
-
const data = this.serializeProps(result.hydrationData);
|
|
70
|
-
return `
|
|
71
|
-
<script type="module">
|
|
72
|
-
window.__FLIGHT_DATA__ = ${data};
|
|
73
|
-
window.__FLIGHT_ADAPTER__ = 'svelte';
|
|
74
|
-
|
|
75
|
-
const App = window.__FLIGHT_APP__;
|
|
76
|
-
const container = document.getElementById('app');
|
|
77
|
-
|
|
78
|
-
if (App && container) {
|
|
79
|
-
const { props } = window.__FLIGHT_DATA__;
|
|
80
|
-
// Svelte 5 mount
|
|
81
|
-
import('svelte').then(({ mount, hydrate }) => {
|
|
82
|
-
if (container.innerHTML.trim()) {
|
|
83
|
-
hydrate(App, { target: container, props });
|
|
84
|
-
} else {
|
|
85
|
-
mount(App, { target: container, props });
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
</script>
|
|
90
|
-
`.trim();
|
|
91
|
-
}
|
|
92
|
-
getClientEntry() {
|
|
93
|
-
return `
|
|
94
|
-
// Svelte 5 client entry
|
|
95
|
-
import { mount, hydrate } from 'svelte';
|
|
96
|
-
|
|
97
|
-
export function hydrateApp() {
|
|
98
|
-
const container = document.getElementById('app');
|
|
99
|
-
const App = window.__FLIGHT_APP__;
|
|
100
|
-
const data = window.__FLIGHT_DATA__ ?? {};
|
|
101
|
-
|
|
102
|
-
if (!container || !App) {
|
|
103
|
-
console.warn('[Flight/Svelte] Missing container or App');
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Check if we have SSR content to hydrate
|
|
108
|
-
if (container.innerHTML.trim()) {
|
|
109
|
-
return hydrate(App, {
|
|
110
|
-
target: container,
|
|
111
|
-
props: data.props ?? {},
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
// Fallback to client-side render
|
|
115
|
-
return mount(App, {
|
|
116
|
-
target: container,
|
|
117
|
-
props: data.props ?? {},
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export function render(App, container, props = {}) {
|
|
123
|
-
return mount(App, { target: container, props });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Export for Flight
|
|
127
|
-
export { hydrateApp as hydrate };
|
|
128
|
-
`.trim();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
function svelte(options) {
|
|
132
|
-
return new SvelteAdapter(options);
|
|
133
|
-
}
|
|
134
|
-
var svelte_default = svelte;
|
|
135
|
-
|
|
136
|
-
export { SvelteAdapter, svelte, svelte_default };
|
package/dist/chunk-YFGSHW5S.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-2/lit.ts
|
|
4
|
-
var LitAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
}
|
|
9
|
-
id = "lit";
|
|
10
|
-
name = "Lit";
|
|
11
|
-
framework = "lit";
|
|
12
|
-
frameworkVersion = "3+";
|
|
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
|
-
try {
|
|
26
|
-
const { render } = await import('@lit-labs/ssr');
|
|
27
|
-
const { html } = await import('lit');
|
|
28
|
-
const { collectResult } = await import('@lit-labs/ssr/lib/render-result.js');
|
|
29
|
-
let template;
|
|
30
|
-
if (typeof component.component === "string") {
|
|
31
|
-
const tagName = component.component;
|
|
32
|
-
const props = component.props ?? {};
|
|
33
|
-
const attrs = Object.entries(props).map(([key, value]) => {
|
|
34
|
-
const attrName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
35
|
-
return `${attrName}="${this.escapeHtml(String(value))}"`;
|
|
36
|
-
}).join(" ");
|
|
37
|
-
template = html`<${tagName} ${attrs}></${tagName}>`;
|
|
38
|
-
} else if (typeof component.component === "function") {
|
|
39
|
-
template = component.component(component.props ?? {});
|
|
40
|
-
} else {
|
|
41
|
-
template = component.component;
|
|
42
|
-
}
|
|
43
|
-
const ssrResult = render(template);
|
|
44
|
-
const htmlString = await collectResult(ssrResult);
|
|
45
|
-
return {
|
|
46
|
-
html: htmlString,
|
|
47
|
-
hydrationData: {
|
|
48
|
-
props: component.props,
|
|
49
|
-
componentId: component.id ?? this.generateId()
|
|
50
|
-
},
|
|
51
|
-
timing: this.createTiming(startTime)
|
|
52
|
-
};
|
|
53
|
-
} catch (error) {
|
|
54
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
55
|
-
if (message.includes("Cannot find module '@lit-labs/ssr'")) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
"[Flight/Lit] Lit SSR package not found.\nInstall required packages:\n npm install lit @lit-labs/ssr"
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
createIsland(component, props, options) {
|
|
64
|
-
const tagName = component;
|
|
65
|
-
const id = this.generateId();
|
|
66
|
-
const deferHydration = this.options.deferHydration ?? false;
|
|
67
|
-
const attrs = Object.entries(props ?? {}).map(([key, value]) => {
|
|
68
|
-
const attrName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
69
|
-
return `${attrName}="${this.escapeHtml(String(value))}"`;
|
|
70
|
-
}).join(" ");
|
|
71
|
-
const placeholder = `
|
|
72
|
-
<${tagName}
|
|
73
|
-
${attrs}
|
|
74
|
-
data-flight-island="${id}"
|
|
75
|
-
${deferHydration ? "defer-hydration" : ""}
|
|
76
|
-
></${tagName}>
|
|
77
|
-
`.trim();
|
|
78
|
-
return {
|
|
79
|
-
id,
|
|
80
|
-
component,
|
|
81
|
-
props,
|
|
82
|
-
options: options ?? { hydrate: "load" },
|
|
83
|
-
placeholder
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
getHydrationScript(result) {
|
|
87
|
-
const data = this.serializeProps(result.hydrationData);
|
|
88
|
-
return `
|
|
89
|
-
<script type="module">
|
|
90
|
-
window.__FLIGHT_DATA__ = ${data};
|
|
91
|
-
window.__FLIGHT_ADAPTER__ = 'lit';
|
|
92
|
-
|
|
93
|
-
// Lit components hydrate when their definition is loaded
|
|
94
|
-
// If using defer-hydration, call removeAttribute('defer-hydration')
|
|
95
|
-
document.querySelectorAll('[defer-hydration]').forEach(el => {
|
|
96
|
-
el.removeAttribute('defer-hydration');
|
|
97
|
-
});
|
|
98
|
-
</script>
|
|
99
|
-
`.trim();
|
|
100
|
-
}
|
|
101
|
-
getClientEntry() {
|
|
102
|
-
return `
|
|
103
|
-
// Lit Client Entry
|
|
104
|
-
// Lit components self-hydrate when their definitions are loaded
|
|
105
|
-
|
|
106
|
-
export function hydrate() {
|
|
107
|
-
// Remove defer-hydration attributes to trigger hydration
|
|
108
|
-
document.querySelectorAll('[defer-hydration]').forEach(el => {
|
|
109
|
-
el.removeAttribute('defer-hydration');
|
|
110
|
-
});
|
|
111
|
-
console.log('[Flight/Lit] Components hydrated');
|
|
112
|
-
}
|
|
113
|
-
`.trim();
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
function lit(options) {
|
|
117
|
-
return new LitAdapter(options);
|
|
118
|
-
}
|
|
119
|
-
var lit_default = lit;
|
|
120
|
-
|
|
121
|
-
export { LitAdapter, lit, lit_default };
|
package/dist/chunk-ZAJVSE7J.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-3/petite-vue.ts
|
|
4
|
-
var PetiteVueAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
}
|
|
9
|
-
id = "petite-vue";
|
|
10
|
-
name = "Petite-vue";
|
|
11
|
-
framework = "petite-vue";
|
|
12
|
-
frameworkVersion = "0.4+";
|
|
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/Petite-vue] Components must be HTML strings or template functions.\nUse v-scope for state and @click, v-model, etc. for interactivity."
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
html,
|
|
37
|
-
hydrationData: component.props,
|
|
38
|
-
timing: this.createTiming(startTime)
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
getHydrationScript(_result) {
|
|
42
|
-
const {
|
|
43
|
-
version = "0.4.1",
|
|
44
|
-
autoInit = true
|
|
45
|
-
} = this.options;
|
|
46
|
-
return `
|
|
47
|
-
<!-- Flight/Petite-vue -->
|
|
48
|
-
<script type="module">
|
|
49
|
-
import { createApp } from 'https://esm.sh/petite-vue@${version}';
|
|
50
|
-
|
|
51
|
-
window.__FLIGHT_ADAPTER__ = 'petite-vue';
|
|
52
|
-
${autoInit ? `createApp().mount();` : "// Manual init: createApp().mount()"}
|
|
53
|
-
|
|
54
|
-
console.log('[Flight/Petite-vue] Initialized');
|
|
55
|
-
</script>
|
|
56
|
-
`.trim();
|
|
57
|
-
}
|
|
58
|
-
getClientEntry() {
|
|
59
|
-
return `
|
|
60
|
-
import { createApp, reactive } from 'petite-vue';
|
|
61
|
-
|
|
62
|
-
export { createApp, reactive };
|
|
63
|
-
|
|
64
|
-
export function hydrate() {
|
|
65
|
-
createApp().mount();
|
|
66
|
-
console.log('[Flight/Petite-vue] Application mounted');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export function createScope(initialState) {
|
|
70
|
-
return reactive(initialState);
|
|
71
|
-
}
|
|
72
|
-
`.trim();
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
function vScope(state, content) {
|
|
76
|
-
const stateStr = JSON.stringify(state).replace(/"/g, "'");
|
|
77
|
-
return `<div v-scope="${stateStr}">${content}</div>`;
|
|
78
|
-
}
|
|
79
|
-
function vFor(items, itemName, content) {
|
|
80
|
-
return `<template v-for="${itemName} in ${items}">${content}</template>`;
|
|
81
|
-
}
|
|
82
|
-
function vIf(condition, content) {
|
|
83
|
-
return `<template v-if="${condition}">${content}</template>`;
|
|
84
|
-
}
|
|
85
|
-
function petiteVue(options) {
|
|
86
|
-
return new PetiteVueAdapter(options);
|
|
87
|
-
}
|
|
88
|
-
var petite_vue_default = petiteVue;
|
|
89
|
-
|
|
90
|
-
export { PetiteVueAdapter, petiteVue, petite_vue_default, vFor, vIf, vScope };
|