@glassly/engine 0.3.5-dev.789 → 0.3.5-dev.793

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.
Files changed (39) hide show
  1. package/build/engine.d.ts +1 -0
  2. package/build/engine.d.ts.map +1 -1
  3. package/build/facades/miniapps.d.ts +2 -0
  4. package/build/facades/miniapps.d.ts.map +1 -1
  5. package/build/facades/miniapps.js +2 -0
  6. package/build/facades/miniapps.js.map +1 -1
  7. package/build/generated/releaseMetadata.js +3 -3
  8. package/build/generated/releaseMetadata.js.map +1 -1
  9. package/build/services/AppRegistry.d.ts +4 -1
  10. package/build/services/AppRegistry.d.ts.map +1 -1
  11. package/build/services/AppRegistry.js +16 -2
  12. package/build/services/AppRegistry.js.map +1 -1
  13. package/build/services/GlassesTouchInput.d.ts.map +1 -1
  14. package/build/services/GlassesTouchInput.js +5 -4
  15. package/build/services/GlassesTouchInput.js.map +1 -1
  16. package/build/services/LocalMiniappRuntime.d.ts +2 -0
  17. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  18. package/build/services/LocalMiniappRuntime.js +27 -3
  19. package/build/services/LocalMiniappRuntime.js.map +1 -1
  20. package/build/services/manifestActions.d.ts +4 -2
  21. package/build/services/manifestActions.d.ts.map +1 -1
  22. package/build/services/manifestActions.js +8 -3
  23. package/build/services/manifestActions.js.map +1 -1
  24. package/build/stores/apps.d.ts +6 -0
  25. package/build/stores/apps.d.ts.map +1 -1
  26. package/build/stores/apps.js +16 -1
  27. package/build/stores/apps.js.map +1 -1
  28. package/build/types/applet.d.ts +3 -1
  29. package/build/types/applet.d.ts.map +1 -1
  30. package/build/types/applet.js.map +1 -1
  31. package/package.json +7 -7
  32. package/src/facades/miniapps.ts +3 -0
  33. package/src/generated/releaseMetadata.ts +3 -3
  34. package/src/services/AppRegistry.ts +18 -3
  35. package/src/services/GlassesTouchInput.ts +5 -4
  36. package/src/services/LocalMiniappRuntime.ts +28 -3
  37. package/src/services/manifestActions.ts +8 -3
  38. package/src/stores/apps.ts +23 -1
  39. package/src/types/applet.ts +3 -1
@@ -1512,6 +1512,9 @@ class LocalMiniappRuntime {
1512
1512
  case MiniappRequestType.WIDGET_RESULT:
1513
1513
  this.handleWidgetResult(packageName, payload);
1514
1514
  break;
1515
+ case MiniappRequestType.WIDGET_EXPANDABLE:
1516
+ this.handleWidgetExpandable(packageName, payload, requestId);
1517
+ break;
1515
1518
  case MiniappRequestType.SYSTEM_EXIT:
1516
1519
  void this.handleSystemExit(packageName, requestId);
1517
1520
  break;
@@ -5287,6 +5290,9 @@ class LocalMiniappRuntime {
5287
5290
  const app = this.interopApps().find((a) => a.packageName === packageName);
5288
5291
  if (!app)
5289
5292
  return false;
5293
+ // Running only for its widget: start() promotes it to a normal run, as opening it on the phone does.
5294
+ if (app.widgetOnly)
5295
+ return useAppStatusStore.getState().start(app, { skipNavigation: true });
5290
5296
  if (app.local) {
5291
5297
  await miniappLauncher.ensureConnected(packageName);
5292
5298
  return true;
@@ -5340,7 +5346,8 @@ class LocalMiniappRuntime {
5340
5346
  packageName: app.packageName,
5341
5347
  name: app.name,
5342
5348
  version: app.version ?? "",
5343
- running: app.running,
5349
+ // A provider running only for a placed widget is not a run the wearer started.
5350
+ running: app.running && !app.widgetOnly,
5344
5351
  hidden: app.hidden === true,
5345
5352
  system: isSystemMiniapp(app),
5346
5353
  compatibility,
@@ -5556,7 +5563,7 @@ class LocalMiniappRuntime {
5556
5563
  name: widget.name,
5557
5564
  sizes: widget.sizes,
5558
5565
  defaultSize: widget.defaultSize,
5559
- expandable: widget.expandable,
5566
+ expandable: widget.expandOnTap,
5560
5567
  running: app.running,
5561
5568
  compatible: app.compatibility?.isCompatible !== false,
5562
5569
  });
@@ -5759,6 +5766,23 @@ class LocalMiniappRuntime {
5759
5766
  this.sendResult(pending.hostPackageName, pending.hostRequestId, false, undefined, error);
5760
5767
  }
5761
5768
  }
5769
+ /** Provider: read, or set with `expandable`, whether a tap expands one of its own `EX` widgets. */
5770
+ handleWidgetExpandable(packageName, payload, requestId) {
5771
+ const widgetId = payload.widgetId;
5772
+ const app = this.interopApps().find((a) => a.packageName === packageName);
5773
+ const widget = app && widgetId ? this.declaredWidget(app, widgetId) : undefined;
5774
+ if (!widget?.expandable) {
5775
+ this.sendResult(packageName, requestId, false, undefined, {
5776
+ code: MiniappErrorCode.WIDGET_NOT_FOUND,
5777
+ message: `${packageName} has no widget "${widgetId ?? "(missing widgetId)"}" that lists EX`,
5778
+ });
5779
+ return;
5780
+ }
5781
+ const expandable = typeof payload.expandable === "boolean"
5782
+ ? useAppStatusStore.getState().setWidgetExpand(packageName, widget.id, payload.expandable)
5783
+ : widget.expandOnTap;
5784
+ this.sendResult(packageName, requestId, true, { expandable });
5785
+ }
5762
5786
  /** Provider → host, one-shot: cache the frame for its view and push it to every host holding the widget. */
5763
5787
  handleWidgetUpdate(providerPackageName, payload) {
5764
5788
  const widgetId = payload.widgetId;
@@ -5771,7 +5795,7 @@ class LocalMiniappRuntime {
5771
5795
  return;
5772
5796
  const view = payload.view === "expanded" ? "expanded" : "card";
5773
5797
  if (view === "expanded" && !widget.expandable) {
5774
- console.warn(`${LOG_TAG}: dropping expanded frame from ${providerPackageName}/${widgetId}: not declared expandable`);
5798
+ console.warn(`${LOG_TAG}: dropping expanded frame from ${providerPackageName}/${widgetId}: it does not list EX`);
5775
5799
  return;
5776
5800
  }
5777
5801
  const cap = view === "expanded"