@floegence/redevplugin-ui 3.0.17 → 3.0.18

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.
@@ -3,7 +3,7 @@ export type OpaqueSurfaceAllowedTag = (typeof opaqueSurfaceAllowedTags)[number];
3
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
4
  export declare const opaqueSurfaceTagAttributes: {
5
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", "autocomplete"];
6
+ readonly input: readonly ["type", "name", "value", "checked", "disabled", "readonly", "required", "placeholder", "min", "max", "step", "maxlength", "autocomplete"];
7
7
  readonly textarea: readonly ["name", "value", "disabled", "readonly", "required", "placeholder", "rows", "cols", "maxlength"];
8
8
  readonly select: readonly ["name", "disabled", "required", "multiple", "size"];
9
9
  readonly option: readonly ["value", "selected", "disabled", "label"];
@@ -96,6 +96,7 @@ export const opaqueSurfaceTagAttributes = {
96
96
  "min",
97
97
  "max",
98
98
  "step",
99
+ "maxlength",
99
100
  "autocomplete"
100
101
  ],
101
102
  "textarea": [
package/dist/surface.js CHANGED
@@ -811,6 +811,7 @@ export function createOpaquePluginBootstrapHTML(options = {}) {
811
811
  if (lower === "data-redevplugin-asset-binding" && !validOpaqueHandle(String(value), "asset")) return false;
812
812
  if (lower === "data-redevplugin-asset-attr" && !["src", "poster"].includes(String(value))) return false;
813
813
  if (lower === "data-redevplugin-canvas" && (tag !== "canvas" || !validResourceIdentifier(String(value)))) return false;
814
+ if (lower === "maxlength" && (!/^(0|[1-9][0-9]*)$/.test(String(value)) || !Number.isSafeInteger(Number(value)))) return false;
814
815
  if (tag === "canvas" && (lower === "width" || lower === "height") && (!/^[1-9][0-9]{0,4}$/.test(String(value)) || Number(value) > maxCanvasDimension)) return false;
815
816
  if (tag === "input" && lower === "type" && !safeInputTypes.has(String(value).trim().toLowerCase() || "text")) return false;
816
817
  return String(value).length <= maxAttributeValueLength;
@@ -2412,6 +2413,7 @@ class PluginSurfaceHostImplementation {
2412
2413
  #transportIdle;
2413
2414
  #port;
2414
2415
  #openSignals;
2416
+ #openingFailure;
2415
2417
  #quiesce;
2416
2418
  #initialFrameLoad;
2417
2419
  #frameLoaded = false;
@@ -2465,6 +2467,7 @@ class PluginSurfaceHostImplementation {
2465
2467
  throw new PluginBridgeError("PLUGIN_BRIDGE_HANDSHAKE_FAILED", "Plugin surface host is already open");
2466
2468
  }
2467
2469
  this.#opened = true;
2470
+ this.#openingFailure = undefined;
2468
2471
  const startedAt = Date.now();
2469
2472
  const progressTimer = setTimeout(() => {
2470
2473
  if (!this.#ready && !this.#disposed) {
@@ -2496,7 +2499,7 @@ class PluginSurfaceHostImplementation {
2496
2499
  await withTimeout(this.#completeOpening(signals, initialFrameLoad.promise), this.#loadTimeoutMs, "Plugin surface opening timed out");
2497
2500
  }
2498
2501
  catch (error) {
2499
- const bridgeError = toBridgeError(error, "PLUGIN_BRIDGE_HANDSHAKE_FAILED");
2502
+ const bridgeError = this.#openingFailure ?? toBridgeError(error, "PLUGIN_BRIDGE_HANDSHAKE_FAILED");
2500
2503
  if (bridgeError.errorCode === "PLUGIN_BRIDGE_TIMEOUT")
2501
2504
  this.#reloadLimiter.recordCrash();
2502
2505
  this.#reportError(bridgeError);
@@ -2508,6 +2511,7 @@ class PluginSurfaceHostImplementation {
2508
2511
  finally {
2509
2512
  clearTimeout(progressTimer);
2510
2513
  this.#openSignals = undefined;
2514
+ this.#openingFailure = undefined;
2511
2515
  this.#initialFrameLoad = undefined;
2512
2516
  }
2513
2517
  }
@@ -3187,12 +3191,17 @@ class PluginSurfaceHostImplementation {
3187
3191
  async #failSurface(error) {
3188
3192
  if (this.#disposed)
3189
3193
  return;
3194
+ const opening = !this.#ready && this.#openSignals !== undefined;
3190
3195
  this.#ready = false;
3191
3196
  this.#bridgeReady = false;
3192
3197
  this.#rendererInitialized = false;
3193
- this.#openSignals?.firstPaint.reject(error);
3194
- this.#openSignals?.workerReady.reject(error);
3195
- this.#reportError(error);
3198
+ const terminalError = opening ? (this.#openingFailure ??= error) : error;
3199
+ this.#openSignals?.portAcknowledged.reject(terminalError);
3200
+ this.#openSignals?.firstPaint.reject(terminalError);
3201
+ this.#openSignals?.workerReady.reject(terminalError);
3202
+ this.#openSignals?.firstCommit.reject(terminalError);
3203
+ if (!opening)
3204
+ this.#reportError(terminalError);
3196
3205
  const revoke = this.#revokeSurface(true);
3197
3206
  this.#disposeLocal();
3198
3207
  await revoke;
@@ -116,6 +116,9 @@ function validAttribute(tag, name, value) {
116
116
  return false;
117
117
  if (normalized === "data-redevplugin-canvas" && (tag !== "canvas" || !keyPattern.test(serialized)))
118
118
  return false;
119
+ if (normalized === "maxlength" &&
120
+ (!/^(0|[1-9][0-9]*)$/.test(serialized) || !Number.isSafeInteger(Number(serialized))))
121
+ return false;
119
122
  if (tag === "canvas" && (normalized === "width" || normalized === "height") &&
120
123
  (!/^[1-9][0-9]{0,4}$/.test(serialized) || Number(serialized) > opaqueSurfaceRenderLimits.max_canvas_dimension))
121
124
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/redevplugin-ui",
3
- "version": "3.0.17",
3
+ "version": "3.0.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -40,7 +40,7 @@
40
40
  "dist"
41
41
  ],
42
42
  "dependencies": {
43
- "@floegence/redevplugin-contracts": "3.0.17"
43
+ "@floegence/redevplugin-contracts": "3.0.18"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"