@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
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { B as BaseUIAdapter, A as AdapterCapabilities, C as Component, R as RenderContext, c as RenderResult } from '../../adapter-MMD-iHNx.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @flightdev/ui - Petite-vue Adapter (Tier 3)
|
|
5
|
-
*
|
|
6
|
-
* Petite-vue adapter - minimal (~6kb) Vue subset for progressive enhancement.
|
|
7
|
-
*
|
|
8
|
-
* @module @flightdev/ui/petite-vue
|
|
9
|
-
* @version 2.0.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
interface PetiteVueAdapterOptions {
|
|
13
|
-
/** Petite-vue version */
|
|
14
|
-
version?: string;
|
|
15
|
-
/** Auto-initialize with v-scope */
|
|
16
|
-
autoInit?: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare class PetiteVueAdapter extends BaseUIAdapter {
|
|
19
|
-
private options;
|
|
20
|
-
readonly id = "petite-vue";
|
|
21
|
-
readonly name = "Petite-vue";
|
|
22
|
-
readonly framework = "petite-vue";
|
|
23
|
-
readonly frameworkVersion = "0.4+";
|
|
24
|
-
readonly tier: "tier-3";
|
|
25
|
-
readonly capabilities: AdapterCapabilities;
|
|
26
|
-
constructor(options?: PetiteVueAdapterOptions);
|
|
27
|
-
renderToString(component: Component, _context?: RenderContext): Promise<RenderResult>;
|
|
28
|
-
getHydrationScript(_result: RenderResult): string;
|
|
29
|
-
getClientEntry(): string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Create a v-scope element
|
|
33
|
-
*/
|
|
34
|
-
declare function vScope(state: Record<string, unknown>, content: string): string;
|
|
35
|
-
/**
|
|
36
|
-
* Create v-for binding
|
|
37
|
-
*/
|
|
38
|
-
declare function vFor(items: string, itemName: string, content: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Create v-if binding
|
|
41
|
-
*/
|
|
42
|
-
declare function vIf(condition: string, content: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Create a Petite-vue UI adapter.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```typescript
|
|
48
|
-
* import { petiteVue } from '@flightdev/ui/petite-vue';
|
|
49
|
-
* import { defineUI } from '@flightdev/ui';
|
|
50
|
-
*
|
|
51
|
-
* export default defineUI(petiteVue());
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function petiteVue(options?: PetiteVueAdapterOptions): PetiteVueAdapter;
|
|
55
|
-
|
|
56
|
-
export { PetiteVueAdapter, type PetiteVueAdapterOptions, petiteVue as default, petiteVue, vFor, vIf, vScope };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { B as BaseUIAdapter, A as AdapterCapabilities, C as Component, R as RenderContext, c as RenderResult } from '../../adapter-MMD-iHNx.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @flightdev/ui - Stimulus Adapter (Tier 3)
|
|
5
|
-
*
|
|
6
|
-
* Stimulus adapter - modest JavaScript for the HTML you already have.
|
|
7
|
-
*
|
|
8
|
-
* @module @flightdev/ui/stimulus
|
|
9
|
-
* @version 2.0.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
interface StimulusAdapterOptions {
|
|
13
|
-
/** Stimulus version */
|
|
14
|
-
version?: string;
|
|
15
|
-
/** Controllers directory path */
|
|
16
|
-
controllersPath?: string;
|
|
17
|
-
/** Enable debug mode */
|
|
18
|
-
debug?: boolean;
|
|
19
|
-
}
|
|
20
|
-
declare class StimulusAdapter extends BaseUIAdapter {
|
|
21
|
-
private options;
|
|
22
|
-
readonly id = "stimulus";
|
|
23
|
-
readonly name = "Stimulus";
|
|
24
|
-
readonly framework = "stimulus";
|
|
25
|
-
readonly frameworkVersion = "3+";
|
|
26
|
-
readonly tier: "tier-3";
|
|
27
|
-
readonly capabilities: AdapterCapabilities;
|
|
28
|
-
constructor(options?: StimulusAdapterOptions);
|
|
29
|
-
renderToString(component: Component, _context?: RenderContext): Promise<RenderResult>;
|
|
30
|
-
getHydrationScript(_result: RenderResult): string;
|
|
31
|
-
getClientEntry(): string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Create an element with a Stimulus controller
|
|
35
|
-
*/
|
|
36
|
-
declare function controller(name: string, content: string, options?: {
|
|
37
|
-
values?: Record<string, unknown>;
|
|
38
|
-
classes?: Record<string, string>;
|
|
39
|
-
outlets?: Record<string, string>;
|
|
40
|
-
targets?: string[];
|
|
41
|
-
}): string;
|
|
42
|
-
/**
|
|
43
|
-
* Create a data-action attribute
|
|
44
|
-
*/
|
|
45
|
-
declare function action(controller: string, method: string, event?: string): string;
|
|
46
|
-
/**
|
|
47
|
-
* Create a data-target attribute
|
|
48
|
-
*/
|
|
49
|
-
declare function target(controller: string, name: string): string;
|
|
50
|
-
/**
|
|
51
|
-
* Create a Stimulus UI adapter.
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* import { stimulus } from '@flightdev/ui/stimulus';
|
|
56
|
-
* import { defineUI } from '@flightdev/ui';
|
|
57
|
-
*
|
|
58
|
-
* export default defineUI(stimulus({ debug: true }));
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
declare function stimulus(options?: StimulusAdapterOptions): StimulusAdapter;
|
|
62
|
-
|
|
63
|
-
export { StimulusAdapter, type StimulusAdapterOptions, action, controller, stimulus as default, stimulus, target };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { B as BaseUIAdapter, A as AdapterCapabilities, C as Component, R as RenderContext, c as RenderResult, h as IslandOptions, i as Island } from '../../adapter-MMD-iHNx.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @flightdev/ui - Vanilla Web Components Adapter (Tier 3)
|
|
5
|
-
*
|
|
6
|
-
* Pure Web Components adapter - no framework, just standards.
|
|
7
|
-
*
|
|
8
|
-
* @module @flightdev/ui/vanilla
|
|
9
|
-
* @version 2.0.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
interface VanillaAdapterOptions {
|
|
13
|
-
/** Enable declarative shadow DOM */
|
|
14
|
-
declarativeShadowDom?: boolean;
|
|
15
|
-
/** Polyfill for older browsers */
|
|
16
|
-
polyfill?: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare class VanillaAdapter extends BaseUIAdapter {
|
|
19
|
-
private options;
|
|
20
|
-
readonly id = "vanilla";
|
|
21
|
-
readonly name = "Vanilla Web Components";
|
|
22
|
-
readonly framework = "vanilla";
|
|
23
|
-
readonly frameworkVersion = "ES2022+";
|
|
24
|
-
readonly tier: "tier-3";
|
|
25
|
-
readonly capabilities: AdapterCapabilities;
|
|
26
|
-
constructor(options?: VanillaAdapterOptions);
|
|
27
|
-
renderToString(component: Component, _context?: RenderContext): Promise<RenderResult>;
|
|
28
|
-
createIsland(component: unknown, props?: Record<string, unknown>, options?: IslandOptions): Island;
|
|
29
|
-
getHydrationScript(_result: RenderResult): string;
|
|
30
|
-
getClientEntry(): string;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Create a custom element with declarative shadow DOM
|
|
34
|
-
*/
|
|
35
|
-
declare function shadowRoot(content: string, mode?: 'open' | 'closed'): string;
|
|
36
|
-
/**
|
|
37
|
-
* Create a slot element
|
|
38
|
-
*/
|
|
39
|
-
declare function slot(name?: string): string;
|
|
40
|
-
/**
|
|
41
|
-
* Create a basic custom element class string (for inline scripts)
|
|
42
|
-
*/
|
|
43
|
-
declare function createElementClass(tagName: string, options?: {
|
|
44
|
-
connectedCallback?: string;
|
|
45
|
-
observedAttributes?: string[];
|
|
46
|
-
template?: string;
|
|
47
|
-
}): string;
|
|
48
|
-
/**
|
|
49
|
-
* Create a Vanilla Web Components UI adapter.
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* ```typescript
|
|
53
|
-
* import { vanilla } from '@flightdev/ui/vanilla';
|
|
54
|
-
* import { defineUI } from '@flightdev/ui';
|
|
55
|
-
*
|
|
56
|
-
* export default defineUI(vanilla({
|
|
57
|
-
* declarativeShadowDom: true,
|
|
58
|
-
* }));
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
declare function vanilla(options?: VanillaAdapterOptions): VanillaAdapter;
|
|
62
|
-
|
|
63
|
-
export { VanillaAdapter, type VanillaAdapterOptions, createElementClass, vanilla as default, shadowRoot, slot, vanilla };
|
package/dist/chunk-2SNQ6PTM.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
// src/core/adapter.ts
|
|
2
|
-
var BaseUIAdapter = class {
|
|
3
|
-
// === Default Capabilities (Override as needed) ===
|
|
4
|
-
capabilities = {
|
|
5
|
-
streaming: false,
|
|
6
|
-
partialHydration: false,
|
|
7
|
-
islands: false,
|
|
8
|
-
resumable: false,
|
|
9
|
-
ssg: true,
|
|
10
|
-
csr: true,
|
|
11
|
-
serverComponents: false
|
|
12
|
-
};
|
|
13
|
-
frameworkVersion;
|
|
14
|
-
// === Default Implementations ===
|
|
15
|
-
/**
|
|
16
|
-
* Generate hydration script.
|
|
17
|
-
* Override for framework-specific hydration.
|
|
18
|
-
*/
|
|
19
|
-
getHydrationScript(result) {
|
|
20
|
-
const data = JSON.stringify(result.hydrationData ?? {});
|
|
21
|
-
return `
|
|
22
|
-
window.__FLIGHT_DATA__ = ${data};
|
|
23
|
-
window.__FLIGHT_ADAPTER__ = '${this.id}';
|
|
24
|
-
import('/flight-client.js').then(m => m.hydrate?.());
|
|
25
|
-
`.trim();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Get client entry point code.
|
|
29
|
-
* Override for framework-specific client initialization.
|
|
30
|
-
*/
|
|
31
|
-
getClientEntry() {
|
|
32
|
-
return `
|
|
33
|
-
// ${this.name} Client Entry
|
|
34
|
-
// Override getClientEntry() in your adapter for custom behavior
|
|
35
|
-
|
|
36
|
-
export function hydrate() {
|
|
37
|
-
console.log('[Flight] Hydrating with ${this.name}');
|
|
38
|
-
const data = window.__FLIGHT_DATA__;
|
|
39
|
-
const App = window.__FLIGHT_APP__;
|
|
40
|
-
|
|
41
|
-
if (App && typeof App.mount === 'function') {
|
|
42
|
-
App.mount(document.getElementById('app'), data);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
`.trim();
|
|
46
|
-
}
|
|
47
|
-
// === Helper Methods (Available to all adapters) ===
|
|
48
|
-
/**
|
|
49
|
-
* Escape HTML entities to prevent XSS
|
|
50
|
-
*/
|
|
51
|
-
escapeHtml(str) {
|
|
52
|
-
const htmlEscapes = {
|
|
53
|
-
"&": "&",
|
|
54
|
-
"<": "<",
|
|
55
|
-
">": ">",
|
|
56
|
-
'"': """,
|
|
57
|
-
"'": "'"
|
|
58
|
-
};
|
|
59
|
-
return str.replace(/[&<>"']/g, (char) => htmlEscapes[char] ?? char);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Serialize props to JSON for hydration
|
|
63
|
-
*/
|
|
64
|
-
serializeProps(props) {
|
|
65
|
-
if (props === void 0 || props === null) {
|
|
66
|
-
return "{}";
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
return JSON.stringify(props, this.jsonReplacer);
|
|
70
|
-
} catch {
|
|
71
|
-
console.warn(`[${this.id}] Failed to serialize props`);
|
|
72
|
-
return "{}";
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* JSON replacer for serialization
|
|
77
|
-
*/
|
|
78
|
-
jsonReplacer(_key, value) {
|
|
79
|
-
if (value instanceof Map) {
|
|
80
|
-
return { __type: "Map", data: Array.from(value.entries()) };
|
|
81
|
-
}
|
|
82
|
-
if (value instanceof Set) {
|
|
83
|
-
return { __type: "Set", data: Array.from(value) };
|
|
84
|
-
}
|
|
85
|
-
if (value instanceof Date) {
|
|
86
|
-
return { __type: "Date", data: value.toISOString() };
|
|
87
|
-
}
|
|
88
|
-
if (typeof value === "bigint") {
|
|
89
|
-
return { __type: "BigInt", data: value.toString() };
|
|
90
|
-
}
|
|
91
|
-
if (typeof value === "function") {
|
|
92
|
-
return void 0;
|
|
93
|
-
}
|
|
94
|
-
return value;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Create a hydration marker comment
|
|
98
|
-
*/
|
|
99
|
-
createHydrationMarker(id, type = "start") {
|
|
100
|
-
return `<!--flight:${type}:${id}-->`;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Wrap content with hydration markers
|
|
104
|
-
*/
|
|
105
|
-
wrapWithMarkers(id, content) {
|
|
106
|
-
return `${this.createHydrationMarker(id, "start")}${content}${this.createHydrationMarker(id, "end")}`;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Generate a unique component ID
|
|
110
|
-
*/
|
|
111
|
-
generateId() {
|
|
112
|
-
return `f${Math.random().toString(36).slice(2, 9)}`;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Create timing information
|
|
116
|
-
*/
|
|
117
|
-
createTiming(startTime) {
|
|
118
|
-
return { total: performance.now() - startTime };
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Merge render context with defaults
|
|
122
|
-
*/
|
|
123
|
-
mergeContext(context) {
|
|
124
|
-
return {
|
|
125
|
-
url: "/",
|
|
126
|
-
...context
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Create an island (default implementation)
|
|
131
|
-
* Override for framework-specific island behavior.
|
|
132
|
-
*/
|
|
133
|
-
createIsland(component, props, options) {
|
|
134
|
-
const id = this.generateId();
|
|
135
|
-
const componentName = typeof component === "string" ? component : "island-component";
|
|
136
|
-
return {
|
|
137
|
-
id,
|
|
138
|
-
component: componentName,
|
|
139
|
-
props: props ?? {},
|
|
140
|
-
placeholder: `<div data-island="${id}" data-component="${componentName}">Loading...</div>`,
|
|
141
|
-
options
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Serialize state for resumability
|
|
146
|
-
*/
|
|
147
|
-
serializeState(state) {
|
|
148
|
-
return this.serializeProps(state);
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Resume from serialized state
|
|
152
|
-
*/
|
|
153
|
-
resumeFromState(serialized) {
|
|
154
|
-
return JSON.parse(serialized, this.jsonReviver);
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* JSON reviver for deserialization
|
|
158
|
-
*/
|
|
159
|
-
jsonReviver(_key, value) {
|
|
160
|
-
if (value && typeof value === "object" && "__type" in value) {
|
|
161
|
-
const typed = value;
|
|
162
|
-
switch (typed.__type) {
|
|
163
|
-
case "Map":
|
|
164
|
-
return new Map(typed.data);
|
|
165
|
-
case "Set":
|
|
166
|
-
return new Set(typed.data);
|
|
167
|
-
case "Date":
|
|
168
|
-
return new Date(typed.data);
|
|
169
|
-
case "BigInt":
|
|
170
|
-
return BigInt(typed.data);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return value;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Initialize the adapter
|
|
177
|
-
*/
|
|
178
|
-
async init() {
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Clean up resources
|
|
182
|
-
*/
|
|
183
|
-
async dispose() {
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
function wrapV1Adapter(v1Adapter, tier = "tier-2") {
|
|
187
|
-
return {
|
|
188
|
-
id: v1Adapter.name.toLowerCase().replace(/\s+/g, "-"),
|
|
189
|
-
name: v1Adapter.name,
|
|
190
|
-
framework: v1Adapter.framework,
|
|
191
|
-
tier,
|
|
192
|
-
capabilities: {
|
|
193
|
-
streaming: false,
|
|
194
|
-
partialHydration: false,
|
|
195
|
-
islands: false,
|
|
196
|
-
resumable: false,
|
|
197
|
-
ssg: true,
|
|
198
|
-
csr: true,
|
|
199
|
-
serverComponents: false
|
|
200
|
-
},
|
|
201
|
-
renderToString: v1Adapter.renderToString.bind(v1Adapter),
|
|
202
|
-
getHydrationScript: v1Adapter.getHydrationScript.bind(v1Adapter),
|
|
203
|
-
getClientEntry: v1Adapter.getClientEntry.bind(v1Adapter),
|
|
204
|
-
transformForSSR: v1Adapter.transformForSSR?.bind(v1Adapter)
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
function isV2Adapter(adapter) {
|
|
208
|
-
return adapter !== null && typeof adapter === "object" && "id" in adapter && "tier" in adapter && "capabilities" in adapter;
|
|
209
|
-
}
|
|
210
|
-
function hasCapability(adapter, capability) {
|
|
211
|
-
return adapter.capabilities[capability] === true;
|
|
212
|
-
}
|
|
213
|
-
function getCapabilities(adapter) {
|
|
214
|
-
return Object.entries(adapter.capabilities).filter(([, enabled]) => enabled).map(([capability]) => capability);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export { BaseUIAdapter, getCapabilities, hasCapability, isV2Adapter, wrapV1Adapter };
|
package/dist/chunk-3D4XMIZI.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-1/angular.ts
|
|
4
|
-
var AngularAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
this.documentTemplate = options.documentTemplate ?? this.getDefaultDocumentTemplate();
|
|
9
|
-
}
|
|
10
|
-
id = "angular";
|
|
11
|
-
name = "Angular";
|
|
12
|
-
framework = "angular";
|
|
13
|
-
frameworkVersion = "17+";
|
|
14
|
-
tier = "tier-1";
|
|
15
|
-
capabilities = {
|
|
16
|
-
streaming: true,
|
|
17
|
-
partialHydration: true,
|
|
18
|
-
islands: false,
|
|
19
|
-
// Angular doesn't have traditional islands
|
|
20
|
-
resumable: false,
|
|
21
|
-
ssg: true,
|
|
22
|
-
csr: true,
|
|
23
|
-
serverComponents: false
|
|
24
|
-
};
|
|
25
|
-
documentTemplate;
|
|
26
|
-
async renderToString(component, context) {
|
|
27
|
-
const startTime = performance.now();
|
|
28
|
-
try {
|
|
29
|
-
const { renderApplication } = await import('@angular/platform-server');
|
|
30
|
-
const { provideClientHydration, withIncrementalHydration, withEventReplay } = await import('@angular/platform-browser');
|
|
31
|
-
const hydrationFeatures = [];
|
|
32
|
-
if (this.options.incrementalHydration) {
|
|
33
|
-
hydrationFeatures.push(withIncrementalHydration());
|
|
34
|
-
}
|
|
35
|
-
if (this.options.eventReplay) {
|
|
36
|
-
hydrationFeatures.push(withEventReplay());
|
|
37
|
-
}
|
|
38
|
-
const bootstrap = component.component;
|
|
39
|
-
const url = context?.url ?? "/";
|
|
40
|
-
const html = await renderApplication(bootstrap, {
|
|
41
|
-
document: this.documentTemplate,
|
|
42
|
-
url
|
|
43
|
-
});
|
|
44
|
-
return {
|
|
45
|
-
html,
|
|
46
|
-
hydrationData: {
|
|
47
|
-
props: component.props,
|
|
48
|
-
url,
|
|
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 '@angular/platform-server'")) {
|
|
56
|
-
throw new Error(
|
|
57
|
-
"[Flight/Angular] Angular SSR dependencies not found.\nInstall required packages:\n npm install @angular/core @angular/platform-server @angular/platform-browser"
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
getHydrationScript(result) {
|
|
64
|
-
const data = this.serializeProps(result.hydrationData);
|
|
65
|
-
return `
|
|
66
|
-
<script type="module">
|
|
67
|
-
window.__FLIGHT_DATA__ = ${data};
|
|
68
|
-
window.__FLIGHT_ADAPTER__ = 'angular';
|
|
69
|
-
// Angular hydration is automatic when provideClientHydration is configured
|
|
70
|
-
</script>
|
|
71
|
-
`.trim();
|
|
72
|
-
}
|
|
73
|
-
getClientEntry() {
|
|
74
|
-
return `
|
|
75
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
76
|
-
import { provideClientHydration } from '@angular/platform-browser';
|
|
77
|
-
|
|
78
|
-
export async function hydrate() {
|
|
79
|
-
const App = window.__FLIGHT_APP__;
|
|
80
|
-
const data = window.__FLIGHT_DATA__ ?? {};
|
|
81
|
-
|
|
82
|
-
if (!App) {
|
|
83
|
-
console.warn('[Flight/Angular] No App component found');
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
try {
|
|
88
|
-
const appRef = await bootstrapApplication(App, {
|
|
89
|
-
providers: [
|
|
90
|
-
provideClientHydration(),
|
|
91
|
-
// Additional providers can be added here
|
|
92
|
-
],
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
console.log('[Flight/Angular] Application bootstrapped');
|
|
96
|
-
return appRef;
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error('[Flight/Angular] Bootstrap failed:', error);
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export async function render(AppComponent, providers = []) {
|
|
104
|
-
return bootstrapApplication(AppComponent, {
|
|
105
|
-
providers: [
|
|
106
|
-
...providers,
|
|
107
|
-
],
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
`.trim();
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Get the default document template for SSR
|
|
114
|
-
*/
|
|
115
|
-
getDefaultDocumentTemplate() {
|
|
116
|
-
return `
|
|
117
|
-
<!DOCTYPE html>
|
|
118
|
-
<html lang="en">
|
|
119
|
-
<head>
|
|
120
|
-
<meta charset="UTF-8">
|
|
121
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
122
|
-
<title>Flight App</title>
|
|
123
|
-
</head>
|
|
124
|
-
<body>
|
|
125
|
-
<app-root></app-root>
|
|
126
|
-
</body>
|
|
127
|
-
</html>
|
|
128
|
-
`.trim();
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
function angular(options) {
|
|
132
|
-
return new AngularAdapter(options);
|
|
133
|
-
}
|
|
134
|
-
var angular_default = angular;
|
|
135
|
-
|
|
136
|
-
export { AngularAdapter, angular, angular_default };
|
package/dist/chunk-3HU6GSQ4.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { BaseUIAdapter } from './chunk-2SNQ6PTM.js';
|
|
2
|
-
|
|
3
|
-
// src/adapters/tier-2/stencil.ts
|
|
4
|
-
var StencilAdapter = class extends BaseUIAdapter {
|
|
5
|
-
constructor(options = {}) {
|
|
6
|
-
super();
|
|
7
|
-
this.options = options;
|
|
8
|
-
}
|
|
9
|
-
id = "stencil";
|
|
10
|
-
name = "Stencil";
|
|
11
|
-
framework = "stencil";
|
|
12
|
-
frameworkVersion = "4+";
|
|
13
|
-
tier = "tier-2";
|
|
14
|
-
capabilities = {
|
|
15
|
-
streaming: false,
|
|
16
|
-
partialHydration: true,
|
|
17
|
-
islands: true,
|
|
18
|
-
// Web Components are natural 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
|
-
try {
|
|
27
|
-
const hydrateModule = await import('@stencil/core/hydrate');
|
|
28
|
-
const { renderToString } = hydrateModule;
|
|
29
|
-
let htmlInput;
|
|
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
|
-
htmlInput = `<${tagName} ${attrs}></${tagName}>`;
|
|
38
|
-
} else {
|
|
39
|
-
throw new Error("Stencil components must be specified as tag name strings");
|
|
40
|
-
}
|
|
41
|
-
const results = await renderToString(htmlInput, {
|
|
42
|
-
fullDocument: false,
|
|
43
|
-
prettyHtml: this.options.prettyHtml ?? false,
|
|
44
|
-
serializeShadowRoot: this.options.declarativeShadowDom ? "declarative-shadow-dom" : void 0
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
html: results.html,
|
|
48
|
-
hydrationData: {
|
|
49
|
-
tagName: component.component,
|
|
50
|
-
props: component.props,
|
|
51
|
-
componentId: component.id ?? this.generateId()
|
|
52
|
-
},
|
|
53
|
-
timing: this.createTiming(startTime)
|
|
54
|
-
};
|
|
55
|
-
} catch (error) {
|
|
56
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
57
|
-
if (message.includes("Cannot find module '@stencil/core/hydrate'")) {
|
|
58
|
-
throw new Error(
|
|
59
|
-
"[Flight/Stencil] Stencil hydrate package not found.\nInstall required packages:\n npm install @stencil/core\nAnd ensure your Stencil project has hydrate output configured."
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Create an island from a Stencil Web Component
|
|
67
|
-
*/
|
|
68
|
-
createIsland(component, props, options) {
|
|
69
|
-
const tagName = component;
|
|
70
|
-
const id = this.generateId();
|
|
71
|
-
const attrs = Object.entries(props ?? {}).map(([key, value]) => {
|
|
72
|
-
const attrName = key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
73
|
-
return `${attrName}="${this.escapeHtml(String(value))}"`;
|
|
74
|
-
}).join(" ");
|
|
75
|
-
const placeholder = `
|
|
76
|
-
<${tagName}
|
|
77
|
-
${attrs}
|
|
78
|
-
data-flight-island="${id}"
|
|
79
|
-
data-flight-hydrate="${options?.hydrate ?? "load"}"
|
|
80
|
-
></${tagName}>
|
|
81
|
-
`.trim();
|
|
82
|
-
return {
|
|
83
|
-
id,
|
|
84
|
-
component,
|
|
85
|
-
props,
|
|
86
|
-
options: options ?? { hydrate: "load" },
|
|
87
|
-
placeholder
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
getHydrationScript(result) {
|
|
91
|
-
const data = this.serializeProps(result.hydrationData);
|
|
92
|
-
return `
|
|
93
|
-
<script type="module">
|
|
94
|
-
window.__FLIGHT_DATA__ = ${data};
|
|
95
|
-
window.__FLIGHT_ADAPTER__ = 'stencil';
|
|
96
|
-
// Stencil components self-hydrate via declarative shadow DOM or scripts
|
|
97
|
-
</script>
|
|
98
|
-
`.trim();
|
|
99
|
-
}
|
|
100
|
-
getClientEntry() {
|
|
101
|
-
return `
|
|
102
|
-
// Stencil Client Entry
|
|
103
|
-
// Web Components hydrate automatically when their scripts are loaded
|
|
104
|
-
|
|
105
|
-
export function hydrate() {
|
|
106
|
-
// Stencil components hydrate automatically
|
|
107
|
-
// Just ensure the component scripts are loaded
|
|
108
|
-
console.log('[Flight/Stencil] Web Components are self-registering');
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function defineCustomElements(loader) {
|
|
112
|
-
// Load Stencil component definitions
|
|
113
|
-
if (loader && typeof loader.defineCustomElements === 'function') {
|
|
114
|
-
loader.defineCustomElements(window);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
`.trim();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
function stencil(options) {
|
|
121
|
-
return new StencilAdapter(options);
|
|
122
|
-
}
|
|
123
|
-
var stencil_default = stencil;
|
|
124
|
-
|
|
125
|
-
export { StencilAdapter, stencil, stencil_default };
|