@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-DTCAUBH5.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
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 };
|
package/dist/chunk-NTASPOHG.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
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 };
|
package/dist/chunk-OI2AMQLG.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
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 };
|
package/dist/chunk-Q7HUE44H.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
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 };
|
package/dist/chunk-QH3LOWXU.js
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
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 };
|
package/dist/chunk-QIVAK6BH.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
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 };
|