@floegence/redevplugin-ui 3.2.0 → 3.3.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/dist/openapi.gen.d.ts +17 -98
- package/dist/platform.d.ts +6 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/surface.d.ts +37 -143
- package/dist/surface.js +325 -2554
- package/dist/testing.d.ts +20 -34
- package/dist/testing.js +46 -12
- package/dist/trusted-parent.d.ts +2 -2
- package/dist/trusted-parent.js +1 -1
- package/package.json +4 -12
- package/dist/jsx-dev-runtime.d.ts +0 -2
- package/dist/jsx-dev-runtime.js +0 -1
- package/dist/jsx-runtime.d.ts +0 -27
- package/dist/jsx-runtime.js +0 -84
- package/dist/opaque-surface-policy.gen.d.ts +0 -47
- package/dist/opaque-surface-policy.gen.js +0 -233
- package/dist/surface-integrity.gen.d.ts +0 -1
- package/dist/surface-integrity.gen.js +0 -2
- package/dist/ui-patch-validator.d.ts +0 -67
- package/dist/ui-patch-validator.js +0 -128
- package/dist/ui-reconciler.d.ts +0 -10
- package/dist/ui-reconciler.js +0 -283
package/dist/testing.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { type MessagePortLike, type MessageEventLike, type PluginJSONObject, type
|
|
1
|
+
import { type MessagePortLike, type MessageEventLike, type PluginJSONObject, type PluginSurfaceContext, type PluginBridgeClientOptions, type PluginBridgeClock } from "./surface.js";
|
|
2
2
|
/** Business/bridge fixture only. It does not certify Host permissions or WASM execution. */
|
|
3
3
|
export type PluginTestCall = {
|
|
4
4
|
method: string;
|
|
5
5
|
input?: PluginJSONObject;
|
|
6
|
-
tree?: PluginUIElementVNode;
|
|
7
6
|
cancelled: boolean;
|
|
8
7
|
resolve(value: unknown): void;
|
|
9
8
|
reject(error: Error): void;
|
|
10
9
|
};
|
|
11
10
|
export type PluginTestHarnessOptions = {
|
|
12
11
|
context?: PluginSurfaceContext;
|
|
12
|
+
clock?: PluginBridgeClock;
|
|
13
13
|
call?: (method: string, input?: PluginJSONObject) => unknown | Promise<unknown>;
|
|
14
14
|
};
|
|
15
15
|
export declare function createPluginTestContext(languageTag?: string, revision?: number): PluginSurfaceContext;
|
|
@@ -18,23 +18,22 @@ export declare function createPluginTestHarness(options?: PluginTestHarnessOptio
|
|
|
18
18
|
mode: "fixture";
|
|
19
19
|
BridgeClient: {
|
|
20
20
|
new (clientOptions?: PluginBridgeClientOptions): {
|
|
21
|
-
render(next: PluginUIElementVNode): Promise<void>;
|
|
22
21
|
readonly surfaceHandle: string;
|
|
23
22
|
readonly timeoutMs: number;
|
|
24
23
|
"__#private@#nextID": number;
|
|
24
|
+
"__#private@#clock": PluginBridgeClock;
|
|
25
25
|
"__#private@#port": MessagePortLike;
|
|
26
26
|
"__#private@#pending": Map<string, {
|
|
27
27
|
resolve: (value: unknown) => void;
|
|
28
28
|
reject: (reason: unknown) => void;
|
|
29
|
-
|
|
29
|
+
cancelTimer: () => void;
|
|
30
30
|
abortCleanup?: () => void;
|
|
31
|
-
kind: "json"
|
|
31
|
+
kind: "json";
|
|
32
32
|
identifier?: string;
|
|
33
33
|
}>;
|
|
34
|
-
"__#private@#actionHandlers": Map<string, Set<(event: PluginUIActionEvent) => void>>;
|
|
35
|
-
"__#private@#canvasInputHandlers": Map<string, Set<(event: import("./surface.js").PluginCanvasInputEvent) => void>>;
|
|
36
|
-
"__#private@#keyboardInputHandlers": Set<(event: import("./surface.js").PluginSurfaceKeyboardEvent) => void>;
|
|
37
34
|
"__#private@#lifecycleHandlers": Set<(event: import("./surface.js").BridgeLifecycleEvent) => Promise<void> | void>;
|
|
35
|
+
"__#private@#beforeCloseHandlers": Set<() => boolean | Promise<boolean>>;
|
|
36
|
+
"__#private@#beforeClosePending": boolean;
|
|
38
37
|
"__#private@#contextHandlers": Set<(context: PluginSurfaceContext) => void>;
|
|
39
38
|
"__#private@#context"?: PluginSurfaceContext;
|
|
40
39
|
"__#private@#ready": boolean;
|
|
@@ -43,17 +42,6 @@ export declare function createPluginTestHarness(options?: PluginTestHarnessOptio
|
|
|
43
42
|
"__#private@#rejectReady": (reason: unknown) => void;
|
|
44
43
|
"__#private@#lifecycleState": "active" | "quiescing" | "quiesced" | "disposed";
|
|
45
44
|
"__#private@#handlingLifecycle": boolean;
|
|
46
|
-
"__#private@#renderRevision": number;
|
|
47
|
-
"__#private@#committedTree"?: PluginUIElementVNode;
|
|
48
|
-
"__#private@#pendingRender"?: {
|
|
49
|
-
tree: PluginUIElementVNode;
|
|
50
|
-
waiters: Array<{
|
|
51
|
-
resolve: () => void;
|
|
52
|
-
reject: (reason: unknown) => void;
|
|
53
|
-
}>;
|
|
54
|
-
};
|
|
55
|
-
"__#private@#renderLoop"?: Promise<void>;
|
|
56
|
-
"__#private@#controlEditRevisions": Map<string, number>;
|
|
57
45
|
"__#private@#onMessage": (event: MessageEventLike) => void;
|
|
58
46
|
ready(): Promise<void>;
|
|
59
47
|
call<T = unknown>(method: string, params?: PluginJSONObject, options?: import("./surface.js").PluginBridgeRequestOptions): Promise<T>;
|
|
@@ -63,27 +51,19 @@ export declare function createPluginTestHarness(options?: PluginTestHarnessOptio
|
|
|
63
51
|
executionSnapshot(executionID: string, options?: import("./surface.js").PluginBridgeRequestOptions): Promise<import("./surface.js").PluginExecutionSnapshot>;
|
|
64
52
|
context(): PluginSurfaceContext | undefined;
|
|
65
53
|
onContext(handler: (context: PluginSurfaceContext) => void): () => void;
|
|
66
|
-
openCanvas(canvasId: string): Promise<import("./surface.js").PluginCanvasSurface>;
|
|
67
|
-
updateCanvasAccessibility(canvasId: string, state: import("./surface.js").PluginCanvasAccessibilityState): Promise<void>;
|
|
68
|
-
setKeyboardBindings(bindings: readonly import("./surface.js").PluginSurfaceKeyboardBinding[]): Promise<void>;
|
|
69
|
-
onKeyboardInput(handler: (event: import("./surface.js").PluginSurfaceKeyboardEvent) => void): () => void;
|
|
70
|
-
loadImageAsset(assetId: string): Promise<ImageBitmap>;
|
|
71
54
|
exportFile(request: import("./surface.js").PluginFileExportRequest, options?: import("./surface.js").PluginBridgeRequestOptions): Promise<void>;
|
|
72
|
-
|
|
73
|
-
onCanvasInput(canvasId: string, handler: (event: import("./surface.js").PluginCanvasInputEvent) => void): () => void;
|
|
55
|
+
onBeforeClose(handler: () => boolean | Promise<boolean>): () => void;
|
|
74
56
|
onLifecycle(handler: (event: import("./surface.js").BridgeLifecycleEvent) => Promise<void> | void): () => void;
|
|
75
57
|
dispose(): void;
|
|
76
|
-
"__#private@#drainRenders"(): Promise<void>;
|
|
77
|
-
"__#private@#startRenderLoop"(): void;
|
|
78
58
|
"__#private@#request"<T>(id: string, message: unknown, options?: {
|
|
79
|
-
kind?: "
|
|
59
|
+
kind?: "json";
|
|
80
60
|
identifier?: string;
|
|
81
61
|
cancellationKind?: "bridge" | "stream";
|
|
82
62
|
mutation?: boolean;
|
|
83
63
|
signal?: AbortSignal;
|
|
84
64
|
}): Promise<T>;
|
|
85
65
|
"__#private@#dispatchRequest"<T>(id: string, message: unknown, options: {
|
|
86
|
-
kind?: "
|
|
66
|
+
kind?: "json";
|
|
87
67
|
identifier?: string;
|
|
88
68
|
cancellationKind?: "bridge" | "stream";
|
|
89
69
|
mutation?: boolean;
|
|
@@ -92,9 +72,9 @@ export declare function createPluginTestHarness(options?: PluginTestHarnessOptio
|
|
|
92
72
|
"__#private@#takePending"(id: string): {
|
|
93
73
|
resolve: (value: unknown) => void;
|
|
94
74
|
reject: (reason: unknown) => void;
|
|
95
|
-
|
|
75
|
+
cancelTimer: () => void;
|
|
96
76
|
abortCleanup?: () => void;
|
|
97
|
-
kind: "json"
|
|
77
|
+
kind: "json";
|
|
98
78
|
identifier?: string;
|
|
99
79
|
} | undefined;
|
|
100
80
|
"__#private@#handleMessage"(event: MessageEventLike): Promise<void>;
|
|
@@ -104,8 +84,14 @@ export declare function createPluginTestHarness(options?: PluginTestHarnessOptio
|
|
|
104
84
|
};
|
|
105
85
|
};
|
|
106
86
|
calls: PluginTestCall[];
|
|
107
|
-
readonly tree: PluginUIElementVNode | undefined;
|
|
108
87
|
context(next: PluginSurfaceContext): void;
|
|
109
|
-
|
|
88
|
+
dispose(): void;
|
|
89
|
+
};
|
|
90
|
+
/** Virtual time affects only consumers explicitly given this clock, never global timers. */
|
|
91
|
+
export declare function createPluginTestClock(initialTimeMs?: number): {
|
|
92
|
+
clock: PluginBridgeClock;
|
|
93
|
+
readonly now: number;
|
|
94
|
+
readonly pending: number;
|
|
95
|
+
advanceBy(milliseconds: number): Promise<void>;
|
|
110
96
|
dispose(): void;
|
|
111
97
|
};
|
package/dist/testing.js
CHANGED
|
@@ -27,7 +27,7 @@ export function createPluginTestContext(languageTag = "en-US", revision = 1) {
|
|
|
27
27
|
export function createPluginTestHarness(options = {}) {
|
|
28
28
|
const calls = [], pending = new Map();
|
|
29
29
|
const clients = new Set();
|
|
30
|
-
let
|
|
30
|
+
let disposed = false;
|
|
31
31
|
let context = options.context ?? createPluginTestContext();
|
|
32
32
|
const port = new FixturePort(message => {
|
|
33
33
|
const value = message;
|
|
@@ -38,10 +38,6 @@ export function createPluginTestHarness(options = {}) {
|
|
|
38
38
|
pending.delete(value.id);
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
if (value.type === "redevplugin.ui.mount" || value.type === "redevplugin.ui.patch") {
|
|
42
|
-
port.emit({ type: "redevplugin.bridge.response", id: value.id, ok: true });
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
41
|
if (value.type !== "redevplugin.bridge.call" || !value.request)
|
|
46
42
|
return;
|
|
47
43
|
const request = value.request;
|
|
@@ -51,7 +47,7 @@ export function createPluginTestHarness(options = {}) {
|
|
|
51
47
|
}
|
|
52
48
|
const finish = (response) => { if (!pending.delete(request.id))
|
|
53
49
|
return; port.emit({ type: "redevplugin.bridge.response", id: request.id, ...response }); };
|
|
54
|
-
const call = { method: request.method, input: request.params,
|
|
50
|
+
const call = { method: request.method, input: request.params, cancelled: false,
|
|
55
51
|
resolve: value => finish({ ok: true, data: value }),
|
|
56
52
|
reject: failure => finish({ ok: false, error_code: failure instanceof PluginBridgeError ? failure.errorCode : "PLUGIN_CAPABILITY_ERROR", error: failure.message }),
|
|
57
53
|
};
|
|
@@ -64,20 +60,58 @@ export function createPluginTestHarness(options = {}) {
|
|
|
64
60
|
constructor(clientOptions = {}) {
|
|
65
61
|
if (clients.size || disposed)
|
|
66
62
|
throw new Error("A fixture owns exactly one bridge client");
|
|
67
|
-
super({ ...clientOptions, port, surfaceHandle: "surface_author_fixture" });
|
|
63
|
+
super({ clock: options.clock, ...clientOptions, port, surfaceHandle: "surface_author_fixture" });
|
|
68
64
|
clients.add(this);
|
|
69
65
|
queueMicrotask(() => { port.emit({ type: "redevplugin.bridge.context", context }); port.emit({ type: "redevplugin.bridge.lifecycle", event: { type: "ready" } }); });
|
|
70
66
|
}
|
|
71
|
-
async render(next) { await super.render(next); tree = structuredClone(next); }
|
|
72
67
|
}
|
|
73
68
|
return {
|
|
74
69
|
mode: "fixture", BridgeClient, calls,
|
|
75
|
-
get tree() { return tree; },
|
|
76
70
|
context(next) { context = next; port.emit({ type: "redevplugin.bridge.context", context }); },
|
|
77
|
-
action(action, event = {}) {
|
|
78
|
-
port.emit({ type: "redevplugin.ui.action", action, event: event.event ?? "click", target_key: event.targetKey ?? "fixture-target", edit_revision: event.editRevision ?? 0, is_composing: event.isComposing ?? false, ...(event.value !== undefined ? { value: event.value } : {}), ...(event.checked !== undefined ? { checked: event.checked } : {}), ...(event.form_data ? { form_data: event.form_data } : {}) });
|
|
79
|
-
},
|
|
80
71
|
dispose() { disposed = true; for (const client of clients)
|
|
81
72
|
client.dispose(); clients.clear(); port.close(); pending.clear(); },
|
|
82
73
|
};
|
|
83
74
|
}
|
|
75
|
+
/** Virtual time affects only consumers explicitly given this clock, never global timers. */
|
|
76
|
+
export function createPluginTestClock(initialTimeMs = 0) {
|
|
77
|
+
if (!Number.isFinite(initialTimeMs) || initialTimeMs < 0)
|
|
78
|
+
throw new Error("Fixture time must be nonnegative and finite");
|
|
79
|
+
let now = initialTimeMs, nextID = 0, advancing = false;
|
|
80
|
+
const tasks = new Map();
|
|
81
|
+
const clock = {
|
|
82
|
+
schedule(callback, delayMs) {
|
|
83
|
+
if (!Number.isFinite(delayMs) || delayMs < 0 || typeof callback !== "function" || tasks.size >= 10000)
|
|
84
|
+
throw new Error("Invalid fixture timer");
|
|
85
|
+
const id = ++nextID;
|
|
86
|
+
tasks.set(id, { at: now + delayMs, callback });
|
|
87
|
+
return () => { tasks.delete(id); };
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
clock, get now() { return now; }, get pending() { return tasks.size; },
|
|
92
|
+
async advanceBy(milliseconds) {
|
|
93
|
+
if (!Number.isFinite(milliseconds) || milliseconds < 0 || !Number.isFinite(now + milliseconds) || advancing)
|
|
94
|
+
throw new Error("Invalid or concurrent fixture clock advance");
|
|
95
|
+
advancing = true;
|
|
96
|
+
const target = now + milliseconds;
|
|
97
|
+
try {
|
|
98
|
+
for (let count = 0;; count++) {
|
|
99
|
+
await Promise.resolve();
|
|
100
|
+
const next = [...tasks.entries()].filter(([, task]) => task.at <= target).sort((a, b) => a[1].at - b[1].at || a[0] - b[0])[0];
|
|
101
|
+
if (!next)
|
|
102
|
+
break;
|
|
103
|
+
if (count >= 10000)
|
|
104
|
+
throw new Error("Fixture timer loop exceeded its bound");
|
|
105
|
+
tasks.delete(next[0]);
|
|
106
|
+
now = next[1].at;
|
|
107
|
+
next[1].callback();
|
|
108
|
+
}
|
|
109
|
+
now = target;
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
advancing = false;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
dispose() { tasks.clear(); },
|
|
116
|
+
};
|
|
117
|
+
}
|
package/dist/trusted-parent.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ export * from "./contracts.gen.js";
|
|
|
2
2
|
export * from "./errors.js";
|
|
3
3
|
export * from "./platform.js";
|
|
4
4
|
export { PluginSurfaceScope, createPluginSurfaceScope } from "./surface-scope.js";
|
|
5
|
-
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan,
|
|
6
|
-
export type { BridgeLifecycleEvent, MessageChannelLike, MessageEventLike, MessagePortLike,
|
|
5
|
+
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan, webSurfaceDocumentSchemaVersion, pluginSurfaceContextSchemaVersion, pluginRiskPlanSchemaVersion, pluginSurfaceFileExportMaxBytes, pluginSurfaceFileExportMediaTypes, trustedParentBridgeHandshakeTranscriptSHA256, } from "./surface.js";
|
|
6
|
+
export type { BridgeLifecycleEvent, MessageChannelLike, MessageEventLike, MessagePortLike, WebSurfaceDocument, PluginConfirmationDecision, PluginConfirmationHandler, PluginConfirmationIntent, PluginConfirmationPlan, PluginMethodResult, PluginRiskEffect, PluginRiskFlag, PluginRiskPlan, PluginRiskSeverity, PluginExecutionEvent, PluginSurfaceHost, PluginWebOriginPreparation, PluginWebOriginPreparationHandler, PluginSurfaceCloseResult, PluginSurfaceOpeningProgress, PluginSurfaceOpeningStage, PluginSurfaceOpeningMilestone, PluginSurfaceInteractionEvent, PluginSurfaceInteractionKind, PluginSurfaceFileExport, PluginSurfaceFileExportHandler, PluginSurfaceFileExportMediaType, PluginSurfaceQuiesceResult, PluginSurfaceRevocationReconciliation, PluginSurfacePreparationResult, PluginSurfaceContext, PluginSurfaceReloadDecision, PluginSurfaceReloadLimiterOptions, PluginSurfaceReloadState, PluginSurfaceSlotOptions, PluginSurfaceSlotState, ReDevPluginSurfaceTransport, ReDevPluginSurfaceTransportOptions, TrustedParentBridgeHandshake, TrustedParentBridgeTokenRequest, WindowLike, } from "./surface.js";
|
|
7
7
|
export type { FetchInitLike, FetchLike, FetchResponseLike, PlatformResponse } from "./http.js";
|
package/dist/trusted-parent.js
CHANGED
|
@@ -2,4 +2,4 @@ export * from "./contracts.gen.js";
|
|
|
2
2
|
export * from "./errors.js";
|
|
3
3
|
export * from "./platform.js";
|
|
4
4
|
export { PluginSurfaceScope, createPluginSurfaceScope } from "./surface-scope.js";
|
|
5
|
-
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan,
|
|
5
|
+
export { PluginSurfaceReloadLimiter, PluginSurfaceSlot, createReDevPluginSurfaceTransport, defaultPluginSurfaceReloadMax, defaultPluginSurfaceReloadWindowMs, isPluginRiskPlan, webSurfaceDocumentSchemaVersion, pluginSurfaceContextSchemaVersion, pluginRiskPlanSchemaVersion, pluginSurfaceFileExportMaxBytes, pluginSurfaceFileExportMediaTypes, trustedParentBridgeHandshakeTranscriptSHA256, } from "./surface.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@floegence/redevplugin-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -23,14 +23,6 @@
|
|
|
23
23
|
"types": "./dist/plugin.d.ts",
|
|
24
24
|
"default": "./dist/plugin.js"
|
|
25
25
|
},
|
|
26
|
-
"./jsx-runtime": {
|
|
27
|
-
"types": "./dist/jsx-runtime.d.ts",
|
|
28
|
-
"default": "./dist/jsx-runtime.js"
|
|
29
|
-
},
|
|
30
|
-
"./jsx-dev-runtime": {
|
|
31
|
-
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
32
|
-
"default": "./dist/jsx-dev-runtime.js"
|
|
33
|
-
},
|
|
34
26
|
"./local-import": {
|
|
35
27
|
"types": "./dist/local-import.d.ts",
|
|
36
28
|
"default": "./dist/local-import.js"
|
|
@@ -44,15 +36,15 @@
|
|
|
44
36
|
"dist"
|
|
45
37
|
],
|
|
46
38
|
"dependencies": {
|
|
47
|
-
"@floegence/redevplugin-contracts": "3.
|
|
39
|
+
"@floegence/redevplugin-contracts": "3.3.0",
|
|
48
40
|
"@noble/hashes": "2.4.0"
|
|
49
41
|
},
|
|
50
42
|
"publishConfig": {
|
|
51
43
|
"access": "public"
|
|
52
44
|
},
|
|
53
45
|
"scripts": {
|
|
54
|
-
"build": "
|
|
46
|
+
"build": "node ../../scripts/build_ui_package.mjs",
|
|
55
47
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
56
|
-
"test": "node ../../scripts/clean_typescript_test_output.mjs dist-test &&
|
|
48
|
+
"test": "node ../../scripts/clean_typescript_test_output.mjs dist-test && npm run build && tsc -p tsconfig.test.json && node --test dist-test/test/*.js"
|
|
57
49
|
}
|
|
58
50
|
}
|
package/dist/jsx-dev-runtime.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Fragment, jsxDEV } from "./jsx-runtime.js";
|
package/dist/jsx-runtime.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { OpaqueSurfaceAllowedTag } from "./opaque-surface-policy.gen.js";
|
|
2
|
-
import { type PluginUIElementVNode, type PluginUIVNode } from "./ui-reconciler.js";
|
|
3
|
-
export declare const Fragment: unique symbol;
|
|
4
|
-
export type PluginUIJSXChild = PluginUIVNode | string | number | boolean | null | undefined | readonly PluginUIJSXChild[];
|
|
5
|
-
export type PluginUIJSXProps = {
|
|
6
|
-
children?: PluginUIJSXChild;
|
|
7
|
-
[name: string]: unknown;
|
|
8
|
-
};
|
|
9
|
-
type PluginUIJSXType = OpaqueSurfaceAllowedTag | typeof Fragment | ((props: PluginUIJSXProps) => unknown);
|
|
10
|
-
export declare function jsx(type: PluginUIJSXType, props: PluginUIJSXProps | null, key?: string): PluginUIElementVNode;
|
|
11
|
-
export declare function jsxs(type: PluginUIJSXType, props: PluginUIJSXProps | null, key?: string): PluginUIElementVNode;
|
|
12
|
-
export declare function jsxDEV(type: PluginUIJSXType, props: PluginUIJSXProps | null, key?: string, _isStaticChildren?: boolean, _source?: unknown, _self?: unknown): PluginUIElementVNode;
|
|
13
|
-
export declare namespace JSX {
|
|
14
|
-
type Element = PluginUIElementVNode;
|
|
15
|
-
interface ElementChildrenAttribute {
|
|
16
|
-
children: unknown;
|
|
17
|
-
}
|
|
18
|
-
interface IntrinsicAttributes {
|
|
19
|
-
key: string;
|
|
20
|
-
}
|
|
21
|
-
type IntrinsicElements = {
|
|
22
|
-
[Tag in OpaqueSurfaceAllowedTag]: PluginUIJSXProps & {
|
|
23
|
-
key: string;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
export {};
|
package/dist/jsx-runtime.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { validatePluginUITree, } from "./ui-reconciler.js";
|
|
2
|
-
export const Fragment = Symbol("ReDevPlugin.Fragment");
|
|
3
|
-
const keyPattern = new RegExp("^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$");
|
|
4
|
-
const attributeAliases = new Map([
|
|
5
|
-
["autoComplete", "autocomplete"],
|
|
6
|
-
["className", "class"],
|
|
7
|
-
["htmlFor", "for"],
|
|
8
|
-
["maxLength", "maxlength"],
|
|
9
|
-
["readOnly", "readonly"],
|
|
10
|
-
["tabIndex", "tabindex"],
|
|
11
|
-
]);
|
|
12
|
-
export function jsx(type, props, key) {
|
|
13
|
-
return createElement(type, props, key);
|
|
14
|
-
}
|
|
15
|
-
export function jsxs(type, props, key) {
|
|
16
|
-
return createElement(type, props, key);
|
|
17
|
-
}
|
|
18
|
-
export function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
|
|
19
|
-
return createElement(type, props, key);
|
|
20
|
-
}
|
|
21
|
-
function createElement(type, props, key) {
|
|
22
|
-
if (type === Fragment)
|
|
23
|
-
throw new TypeError("ReDevPlugin JSX does not support Fragment; use one keyed intrinsic element");
|
|
24
|
-
if (typeof type !== "string")
|
|
25
|
-
throw new TypeError("ReDevPlugin JSX supports intrinsic elements only");
|
|
26
|
-
if (typeof key !== "string" || !keyPattern.test(key)) {
|
|
27
|
-
throw new TypeError("ReDevPlugin JSX elements require a valid stable key");
|
|
28
|
-
}
|
|
29
|
-
const attributes = {};
|
|
30
|
-
const source = props ?? {};
|
|
31
|
-
for (const [rawName, value] of Object.entries(source)) {
|
|
32
|
-
if (rawName === "children" || rawName === "key" || value === undefined)
|
|
33
|
-
continue;
|
|
34
|
-
const name = attributeAliases.get(rawName) ?? rawName;
|
|
35
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
36
|
-
throw new TypeError(`ReDevPlugin JSX attribute ${rawName} must be a string, number, or boolean`);
|
|
37
|
-
}
|
|
38
|
-
attributes[name] = value;
|
|
39
|
-
}
|
|
40
|
-
const children = [];
|
|
41
|
-
appendChildren(children, source.children, key, []);
|
|
42
|
-
const tree = {
|
|
43
|
-
type: "element",
|
|
44
|
-
key,
|
|
45
|
-
tag: type,
|
|
46
|
-
...(Object.keys(attributes).length > 0 ? { attributes } : {}),
|
|
47
|
-
...(children.length > 0 ? { children } : {}),
|
|
48
|
-
};
|
|
49
|
-
return validatePluginUITree(tree);
|
|
50
|
-
}
|
|
51
|
-
function appendChildren(target, value, parentKey, path) {
|
|
52
|
-
if (value === null || value === undefined || typeof value === "boolean")
|
|
53
|
-
return;
|
|
54
|
-
if (Array.isArray(value)) {
|
|
55
|
-
value.forEach((child, index) => appendChildren(target, child, parentKey, [...path, index]));
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (typeof value === "string" || typeof value === "number") {
|
|
59
|
-
const textPath = path.length > 0 ? path : [0];
|
|
60
|
-
target.push({ type: "text", key: textKey(parentKey, textPath), text: String(value) });
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (typeof value === "object") {
|
|
64
|
-
target.push(value);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
throw new TypeError("ReDevPlugin JSX children must be VNodes or renderable primitive values");
|
|
68
|
-
}
|
|
69
|
-
function textKey(parentKey, path) {
|
|
70
|
-
const suffix = `.text.${path.join(".")}`;
|
|
71
|
-
const candidate = parentKey + suffix;
|
|
72
|
-
if (candidate.length <= 128)
|
|
73
|
-
return candidate;
|
|
74
|
-
const hashSuffix = `.text.${fnv1a(candidate)}`;
|
|
75
|
-
return parentKey.slice(0, 128 - hashSuffix.length) + hashSuffix;
|
|
76
|
-
}
|
|
77
|
-
function fnv1a(value) {
|
|
78
|
-
let hash = 0x811c9dc5;
|
|
79
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
80
|
-
hash ^= value.charCodeAt(index);
|
|
81
|
-
hash = Math.imul(hash, 0x01000193);
|
|
82
|
-
}
|
|
83
|
-
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
84
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const opaqueSurfaceAllowedTags: readonly ["main", "section", "header", "footer", "nav", "aside", "article", "div", "span", "p", "h1", "h2", "h3", "h4", "h5", "h6", "button", "input", "textarea", "select", "option", "label", "fieldset", "legend", "form", "ul", "ol", "li", "dl", "dt", "dd", "table", "thead", "tbody", "tfoot", "tr", "th", "td", "caption", "details", "summary", "pre", "code", "kbd", "samp", "strong", "em", "small", "mark", "time", "progress", "meter", "img", "picture", "source", "audio", "video", "track", "canvas"];
|
|
2
|
-
export type OpaqueSurfaceAllowedTag = (typeof opaqueSurfaceAllowedTags)[number];
|
|
3
|
-
export declare const opaqueSurfaceGlobalAttributes: readonly ["id", "class", "role", "title", "hidden", "tabindex", "autofocus", "lang", "dir", "data-redevplugin-action", "data-redevplugin-escape-action", "data-redevplugin-asset-binding", "data-redevplugin-asset-attr"];
|
|
4
|
-
export declare const opaqueSurfaceTagAttributes: {
|
|
5
|
-
readonly button: readonly ["type", "name", "value", "disabled", "aria-pressed", "aria-expanded"];
|
|
6
|
-
readonly input: readonly ["type", "name", "value", "checked", "disabled", "readonly", "required", "placeholder", "min", "max", "step", "maxlength", "autocomplete"];
|
|
7
|
-
readonly textarea: readonly ["name", "value", "disabled", "readonly", "required", "placeholder", "rows", "cols", "maxlength"];
|
|
8
|
-
readonly select: readonly ["name", "disabled", "required", "multiple", "size"];
|
|
9
|
-
readonly option: readonly ["value", "selected", "disabled", "label"];
|
|
10
|
-
readonly label: readonly ["for"];
|
|
11
|
-
readonly form: readonly ["name", "autocomplete"];
|
|
12
|
-
readonly th: readonly ["scope", "colspan", "rowspan"];
|
|
13
|
-
readonly td: readonly ["colspan", "rowspan"];
|
|
14
|
-
readonly progress: readonly ["value", "max"];
|
|
15
|
-
readonly meter: readonly ["value", "min", "max", "low", "high", "optimum"];
|
|
16
|
-
readonly img: readonly ["alt", "width", "height", "loading", "decoding"];
|
|
17
|
-
readonly audio: readonly ["controls", "autoplay", "muted", "loop", "preload"];
|
|
18
|
-
readonly video: readonly ["controls", "autoplay", "muted", "loop", "preload", "width", "height", "playsinline"];
|
|
19
|
-
readonly source: readonly ["type", "media"];
|
|
20
|
-
readonly track: readonly ["kind", "srclang", "label", "default"];
|
|
21
|
-
readonly time: readonly ["datetime"];
|
|
22
|
-
readonly canvas: readonly ["width", "height", "data-redevplugin-canvas"];
|
|
23
|
-
};
|
|
24
|
-
export declare const opaqueSurfaceSafeInputTypes: readonly ["text", "search", "number", "checkbox", "radio", "button", "submit", "reset"];
|
|
25
|
-
export declare const opaqueSurfaceCanvasContextTypes: readonly ["2d", "webgl", "webgl2"];
|
|
26
|
-
export declare const opaqueSurfaceRenderLimits: {
|
|
27
|
-
readonly max_message_bytes: 524288;
|
|
28
|
-
readonly max_in_flight_requests: 256;
|
|
29
|
-
readonly max_renders_per_second: 60;
|
|
30
|
-
readonly max_render_depth: 32;
|
|
31
|
-
readonly max_render_nodes: 4096;
|
|
32
|
-
readonly max_patch_operations: 1024;
|
|
33
|
-
readonly max_attributes_per_element: 64;
|
|
34
|
-
readonly max_text_length: 65536;
|
|
35
|
-
readonly max_attribute_value_length: 4096;
|
|
36
|
-
readonly max_form_fields: 128;
|
|
37
|
-
readonly max_keyboard_bindings: 128;
|
|
38
|
-
readonly max_canvas_count: 4;
|
|
39
|
-
readonly max_canvas_dimension: 4096;
|
|
40
|
-
readonly max_canvas_total_pixels: 16777216;
|
|
41
|
-
readonly max_canvas_pointer_events_per_second: 120;
|
|
42
|
-
readonly max_image_count: 32;
|
|
43
|
-
readonly max_image_dimension: 4096;
|
|
44
|
-
readonly max_image_total_pixels: 33554432;
|
|
45
|
-
readonly worker_heartbeat_interval_ms: 10000;
|
|
46
|
-
readonly worker_heartbeat_timeout_ms: 5000;
|
|
47
|
-
};
|