-
Notifications
You must be signed in to change notification settings - Fork 580
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIP-22: Smart Widgets – interactive components #1454
base: master
Are you sure you want to change the base?
Conversation
} | ||
``` | ||
### 2.3.1. background_color | ||
the `background_color` property defines the color of the overall container of the smart widget. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with or without alpha?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a hex code, so yes, it can contain alpha.
FYI, NIP-22 was taken by #1434 |
Don't worry too much about NIP numbers, they always change before the merge anyway. |
This makes sense, is there a library that can be used to parse these? |
Has responsiveness (e.g. rendering on phones) been considered? |
We are yet to submit a library that handle the parsing of the smart widgets. Although, any client can do the implementation as the structuration of the smart widgets is straight forward and it only requires consideration of some specifications on each client. |
The smart widgets are responsive on Mobile devices as well yes since the structure allows for a predefined layout of 1 or 2 at max which is simple and straight forward (check out YakiHonne). As per your suggestion, it makes sense to ensure total flexibility and responsiveness, it was considered in the early design of the smart widgets, but we came up with the current structure as it keeps the smart widgets follow specific guidelines when it comes to each element positioning and space taken (using divisions) which ensures that the smart widgets have the same structure across different devices. |
This is like a more limited form of HTML and, at the same time, requires a custom rendering engine that will forever be a moving target. Instead of inventing a new documentation and styling specs we should just reuse the existing ones or forego layouts+styling, again, specially because this will be a widely moving target when it meets users' wishes. |
This is ok. I just refers to the key names, they seem misleading to me. |
Btw, I agree with Pablo, introducing a new rendering engine is a huge burdensome for clients, we risk ending up with long notes with missing parts, making the user experience inconsistent. If I didn't misunderstand something, it seems that the gain will be just having a two-column structure, when today more of 85%+ of users (unfortunately) use a smartphone that lines up all the content. Thus, it is only a minimal aesthetic benefit, excluding polling, which, however, is only the inclusion of an external event with a background color. I would actually vote for this approach: just include events with the standard |
+1 will implement. Much needed next gen functionality. Given that the NIP is optional, clients can choose whether they want to render smart widgets or not. Users can also vote with their notes, if they like them. |
Agree with Pablo and I think you can use data uri scheme for this. Here's a simple demonstration:
|
Can you elaborate more on this? What exactly do you mean by reusing existing ones or forego layouts+styling? Are you referring to a more abstract approach when it comes to defining the smart widgets? |
I would say that the smart widgets definition is simple and easy to adopt, the structure follows specific guidelines and uses a well defined elements, which ensures an appropriate visualization across different devices. Adopting web aspect in this regard is not a favorable idea as it enforces natives clients to add a Webview as you said, which is not that great of an idea. And since the smart widgets are addressable events, yes they can be attached in notes or articles (nostr:naddr1), in which other clients that implement smart widgets can render them, if not, it will be forwarded to clients who do so. |
This adoption is limited to web clients only. How exactly do you intend to run this on native mobile clients? |
My two cents is that HTML is too powerful and complex, and markdown/asciidoc are too limited for something like this. So I don't know what the alternative to the bespoke markup format being proposed might be, but if one exists we should use that instead of making a new one up. |
I will be glad to hear any suggestions that will lead to a more optimized approach of defining smart widgets, if such approach exists it's very welcome to be discussed, if not, with the contribution of the community, we might be on the doorstep of introducing something new that can be widely adopted. |
All I suggest is using data uri scheme instead of <smart_widget_stringified_json>, so
and then you can sanitize it with DOMParser if you want just image then
and if you need links buttons click images etc then simply
|
I understand your proposition, it would make more sense if it's only destined for web based clients, how can this approach be handled in native mobile client? Because smart widgets with its abstract structure can be implemented on both. |
You don't have to use some xml like content that must be parsed. But if you do then use Webview or parse it with some kind of xml parser. Have a look here #1468 looks much better that way imo |
This proves what was mentioned in the discussion above, using Webviews in native mobile clients is a poor idea which should not be considered as it has a lot of implications. Your approach is not as abstract to allow for cross-platform use as Smart widget introduces. |
I see. In your case, you can use |
What implications exactly? I don't really understand what your use case is here. The only things your widgets allow you to do are things users can already do anyway in posts/articles (links, videos, images, polls, ...). I don't think adding borders and colours to link buttons are worth parsing an entirely new markup language. What I need is this: I don't know if that overlaps with your goals. If it does, hit me up. |
HTML has always been avoidable since it has implications to the mobile apps devs and more. For such reason and others, you are seeing a stringified json with new abstract properties that clients devs can depend on to render the widgets.
In normal cases like you are saying, users can't use customized buttons with customized nostr profiles for displaying or zapping, or let's just say customized POSTS in general. In addition, this is just the initial proposal and it is heavily OPENED for changes and improvements no matter how they look like. So rather than dispatching the same concept as bread crumbs all over proposals, I think it's better to minimize it in one place and work on improving things up that's all what I'm saying.
And this can be done with the implementation in here, perhaps some minor specifications are still missing or not improved yet, due to the load of complications these widgets has that's all. |
I like the idea, but I think we can't have a design language inside events. It would be much better to just define a program that takes inputs and emit outputs, then let the host app determine how to display these in the UI. For example, a widget could declare it expects a pubkey, then the app would display a dropdown of Nostr profiles for the user to choose; or the widget could declare that it expects an amount and current user's pubkey, and the app would display a numeric field for the amount and a confirmation button prompting the user to authorize sharing its own pubkey. The widget itself could be a little WASM program that would be able to call some Nostr-specific functions (defined in the spec) using the inputs, then emit different kinds of labeled outputs, such as a single value, a Nostr entity link, an image URL, a URL or a table or list of values. Then again the app would display these somehow. I don't know, I've never implemented this, so I am just imagining things. |
Yes, after the first launch we are also planning to switching this off.
These kind of use cases are existed, however as you said they affected by the design and not obvious enough.
We will see how things will go with this.
Much appreciated, thanks. |
In the Solid project (https://solidproject.org/), we’ve been rolling out "Smart Widgets" (also called "Solid Panes"), which have really taken off among developers—both in terms of creativity and usability. The project is gaining momentum with new contributors joining (on a related note, I’m also working on Nostr auth). This PR has become the most upvoted in Nostr’s history. Could we consider merging it, even if it's not perfect yet? It could improve based on what we learn from the first rollout. |
Got directed to this PR by one of our users at Predyx. I'm very interested in seeing this PR merged. We plan to bring our prediction markets to nostr, and I think Smart Widgets would be a good start for us. |
Merging requires 2+ clients that FULLY implement the PR. How many implementations of this PR exist today in production? I assume YakiHonne implements all the features described. Is there anyone else? @Seddik-Boukhalfa can probably edit the first post with an implementation tracker to help us out. |
it is already under this issue with nostrability: nostrability/nostrability#99 |
This NIP introduces the concept of Smart Widgets for Nostr clients. Smart Widgets are customizable, interactive components that can be embedded within Nostr events. These widgets allow users and developers to create rich, dynamic content that enhances the user experience. This proposal outlines the structure, implementation, and potential use cases of Smart Widgets within the Nostr protocol.