@lingxia/page-runtime 0.6.0 → 0.6.5

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.
@@ -154,6 +154,31 @@ function definePageBridgeAction(name, mode) {
154
154
  function filterPayload(name, args) {
155
155
  const clean = [];
156
156
  for (const value of args) {
157
+ // CustomEvent carries serializable data on `.detail`, but the DOM Event
158
+ // wrapper itself is not portable across the bridge. Repackage as a plain
159
+ // `{detail, type}` so page actions bound directly to DOM listeners (e.g.
160
+ // `onVideoEnded={action}`) keep the familiar `event.detail` shape without
161
+ // forwarding the live Event instance. Without this rewrite the bare Event
162
+ // was stripped wholesale, producing `event = undefined` on the receiving
163
+ // side — surfaced in the showcase as "video ended undefined".
164
+ if (typeof CustomEvent !== "undefined" && value instanceof CustomEvent) {
165
+ clean.push({ type: value.type, detail: value.detail });
166
+ continue;
167
+ }
168
+ // Some framework wrappers / WebView realms do not preserve
169
+ // `instanceof CustomEvent`, but still expose the portable event payload
170
+ // shape. Keep it before the generic Event stripping path so page actions
171
+ // receive `event.detail` consistently.
172
+ const maybeEvent = value;
173
+ if (maybeEvent && typeof maybeEvent === "object" && typeof maybeEvent.type === "string" && "detail" in maybeEvent) {
174
+ clean.push({
175
+ type: maybeEvent.type,
176
+ detail: maybeEvent.detail,
177
+ });
178
+ continue;
179
+ }
180
+ // Generic Event / event-like objects with non-serializable methods stay
181
+ // stripped — there's no portable payload to extract.
157
182
  if (value instanceof Event)
158
183
  continue;
159
184
  if (value &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxia/page-runtime",
3
- "version": "0.6.0",
3
+ "version": "0.6.5",
4
4
  "private": false,
5
5
  "description": "Shared page runtime core for LingXia lxapp frameworks",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "prepublishOnly": "npm run build"
20
20
  },
21
21
  "dependencies": {
22
- "@lingxia/bridge": "0.6.0"
22
+ "@lingxia/bridge": "0.6.5"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@lingxia/bridge": "file:../lingxia-bridge",