Open
Description
There's a lot here that I'm aligned with. Very excited to see clear ideas about the future of Widgets and PWA!
I like defining Widget structure + behavior inside the PWA manifest as the Widget is a projection of the PWA. Defining the Widget within the PWA makes this projection clearer and likely simplifies future PWA+Widget concerns packaging, registration, communication, etc. (Sidebar: I think there's still a separate need to create standalone web-based widgets. A utility widget, like a clock, probably doesn't need to interact with an app or browser experience.)
Looking at the current WidgetDefinition sample, these are my initial thoughts. Happy to dive into any further!
{
"name": "Agenda",
"id": "widget-agenda",
"url": "/widgets/agenda/",
"type": "text/calendar",
"template": "agenda",
"data": "/widgets/data/agenda.ical",
"update": "900",
"icons": [ ],
"backgrounds": [ ],
"actions": [ ],
"ms-acn": {
"prefer": "medium",
"small": "/widgets/data/agenda-acn-small.json",
"medium": "/widgets/data/agenda-acn-medium.json",
"large": "/widgets/data/agenda-acn-large.json"
}
}
- name
- LGTM. Just want to call out that the name a PWA is packaged with here should be able to be localized at time of user install.
- id
- Can you explain a bit about what this id accomplishes? Is it intended to disambiguate WidgetDefinitions defined in the same manifest? Could the same thing client be identified by querying WidgetClients?
- url
- Makes sense. I assume if a
url
is present, thentype
,template
,anddata
are ignored. For Windows-specific PWA widgets, having a separate field that expects Adaptive Card template endpoints is a must.
- Makes sense. I assume if a
- type
- This appears to be bound to
template
. I don't yet see why separating mime type from the template will help developers.
- This appears to be bound to
- template
- I'd prefer a
template_url
that points to some standardized template structure that all browsers know how to render and bind todata
. No strong opinion though. For my use cases as a developer, I'm more likely to useurl
orms-acn
.
- I'd prefer a
- data
- LGTM. Love the data/template segregation.
- update
- This already makes me nervous :) It makes initial sense that this would be managed by or similarly to Periodic Sync to respect resource utilization. However, periodically updating the Widget, independent of app activity, breaks the projection paradigm. When a user reads a message from a friend, views an unseen item, or does some action in the app that the Widget makes them aware of, they will expect the Widget to respond to that action. If there's a 900 second delay, or even a 5 second delay, that Widget would appear unresponsive. There's definitely a need to guard users from noisy widget updates, but the fixed time period may not be sufficient. Ideally, a widget refresh could be requested in the service worker.
- icons
- Where would these icons be displayed to users? Do they differ from action icons?
- backgrounds
- Makes sense for providing background images to lay the widget template over. I'm curious if this is also intended to support light/dark mode. From my understanding, the template would remain the same and the renderer would need to know which components to use. Maybe that's better described under a
visual_display_mode
.
- Makes sense for providing background images to lay the widget template over. I'm curious if this is also intended to support light/dark mode. From my understanding, the template would remain the same and the renderer would need to know which components to use. Maybe that's better described under a
- actions
- Agreed with aligning this with Notification actions and surfacing them in the service worker.