-
Notifications
You must be signed in to change notification settings - Fork 55
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
Editorial: Add a diagram for storage model #152
Conversation
It seems the validator blocks any use of ARIA attributes and forces |
I believe we expected you would embed an SVG inline, as it was in the original issue. All the advice was geared toward that. We did not offer advice for referencing it via The |
It looks like #148 failed to build. Please replace all browsing session references appropriately before merging... I'll investigate. Edit: build is fixed, and "browsing session" references no longer appear on https://storage.spec.whatwg.org/. |
Does it make sense to do (I'm not against embedding the SVG, it's just that it'll introduce some manual work if the diagram ever changes. I wonder Bikeshed can just import SVG files.) |
|
assets/model-diagram.mmd
Outdated
"Browsing session" ||--|| "Storage shed" : "holds (session)" | ||
"Storage shed" ||--o{ "Storage shelf" : "for each storage key" | ||
"Storage shelf" ||--|| "Storage bucket" : "holds (default)" | ||
"Storage bucket" ||--|{ "Storage bottle" : "for each storage endpoint" |
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.
Shall we lowercase all these terms? I'm not entirely sure, but it looks a little off to me at the moment.
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.
I'm not sure about that either, diagrams tend to have the cases this way.
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 unfortunate that preview doesn't work for this image. I guess that's due to it only doing a Bikeshed build and not a full build.
@domenic can you do a quick peak? I'd love your thoughts on:
- Doing diagrams.
- The Node.js stuff here.
- Using
assets/
for structure.
(Mainly because if this is good, we should adopt it elsewhere, e.g., in Fetch.)
.gitignore
Outdated
@@ -1,3 +1,5 @@ | |||
/storage.spec.whatwg.org/ | |||
/deploy.sh | |||
/storage.html | |||
/node_modules/ | |||
package-lock.json |
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.
This we'll also have to change upstream: https://github.com/whatwg/spec-factory/blob/main/factory.json. But it's straightforward enough.
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.
Will it override this file if unchanged btw?
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.
I'm unsure on whether or not we should check in package-lock.json. It looks like we don't for other Node-using spec repos. But it's generally good practice. We check it in for participate.whatwg.org.
If you check it in, you get reproducible builds. If you don't check it in, all your dependencies-of-dependencies will get recomputed each time, potentially with inadvertent breaking changes.
However, if you check it in, you also start getting annoying GitHub security alerts about all your dependencies-of-dependencies :-/.
Co-authored-by: Anne van Kesteren <[email protected]>
.gitignore
Outdated
@@ -1,3 +1,5 @@ | |||
/storage.spec.whatwg.org/ | |||
/deploy.sh | |||
/storage.html | |||
/node_modules/ | |||
package-lock.json |
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.
I'm unsure on whether or not we should check in package-lock.json. It looks like we don't for other Node-using spec repos. But it's generally good practice. We check it in for participate.whatwg.org.
If you check it in, you get reproducible builds. If you don't check it in, all your dependencies-of-dependencies will get recomputed each time, potentially with inadvertent breaking changes.
However, if you check it in, you also start getting annoying GitHub security alerts about all your dependencies-of-dependencies :-/.
assets/model-diagram.mmd
Outdated
%% Build command: `npm i && npm run build-diagram` | ||
|
||
"User agent" ||--|| "Storage shed" : "holds (local)" | ||
"Browsing session" ||--|| "Storage shed" : "holds (session)" |
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.
Please change "Browsing session" to "Top-level traversable", per the latest spec.
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.
A browsing session holds a storage shed, which is a storage shed. A browsing session’s storage shed holds all session storage data.
Err, it's still there, should it be fixed too?
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.
Ahh, that's because the build failure. 😅
package.json
Outdated
@@ -0,0 +1,14 @@ | |||
{ | |||
"name": "storage", |
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.
I suggest moving "private": true
to the top, and removing "name"
and "version"
. Compare to https://github.com/whatwg/webidl/blob/main/package.json.
assets/model-diagram.svg
Outdated
@@ -0,0 +1,50 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="chart-title-mermaid-1669067354847 chart-desc-mermaid-1669067354847" style="max-width:396.227px;background-color:#fff;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333" viewBox="0 0 396.227 815"> |
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.
Do we want to check in this build output? Or should it be generated on each deploy?
If the latter, we need to do some work to make this repo more like webidl. (Which is another repo which uses Node as part of its build process.) We can make the changes as part of this PR, but we'd also need to update spec-factory so that it generates the files appropriately next time in the same way.
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.
Either way is fine to me, but let's try that...
assets/model-diagram.svg
Outdated
@@ -0,0 +1,50 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="chart-title-mermaid-1669067354847 chart-desc-mermaid-1669067354847" style="max-width:396.227px;background-color:#fff;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333" viewBox="0 0 396.227 815"> |
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.
This file will need to be added as an "extra_files
in https://github.com/whatwg/spec-factory/blob/main/factory.json otherwise the build will not work. That updates the Makefile like so: https://github.com/whatwg/encoding/blob/main/Makefile#L23 .
We'll need to be sure to exclude all the other files. So maybe something like assets/*.svg
?
Alternately, you could have all the other stuff live in scripts/
, and have it generate a new file in assets/
or images/
. Then you'd add assets/*.*
as the extra files.
assets/model-diagram.svg
Outdated
@@ -0,0 +1,50 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="chart-title-mermaid-1669067354847 chart-desc-mermaid-1669067354847" style="max-width:396.227px;background-color:#fff;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333" viewBox="0 0 396.227 815"> |
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.
This image is unreadably small when viewed standalone. https://raw.githubusercontent.com/whatwg/storage/651b26d44e2572123dbc82f93adb61359ed71dda/assets/model-diagram.svg
Will it be extremely small when embedded in the spec, too?
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.
I'm not quite sure what's happening, but on Firefox it seems it gets smaller with larger viewport and gets bigger with smaller-but-bigger-than-the-image viewport. Anyway we set width
and height
manually in HTML, so it should be fine.
<path fill="none" stroke="gray" marker-end="url(#a)" marker-start="url(#b)" d="M187.818 445v100" class="er relationshipLine"/> | ||
<path fill="none" stroke="gray" marker-end="url(#d)" marker-start="url(#b)" d="M187.818 620v100" class="er relationshipLine"/> | ||
<path fill="#f0fff0" fill-opacity="100%" stroke="gray" d="M20 20h107.523v75H20z" class="er entityBox"/> | ||
<text class="er entityLabel" dominant-baseline="middle" style="font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px" text-anchor="middle" transform="translate(73.762 57.5)">User agent</text> |
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.
I wonder why these style attributes exist, despite the overall SVG element already having that style. Oh well; I assume there's nothing we can do.
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.
I just looked at this and SVGOMG has a "Style to attributes" option that indeed reduces the file size further. Not sure how to use that from CLI however.
The other things I see are the redundant aria-*
attribute and a bunch of useless class
attributes.
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.
Corresponds to whatwg/storage#152.
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.
Looking promising!
scripts/model-diagram.mmd
Outdated
@@ -0,0 +1,12 @@ | |||
erDiagram |
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.
Hmm, now this lives in scripts/, which is a bit weird... maybe it should live in top-level?
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.
Unsure how it would look if we get more diagrams... But for now SGTM.
@domenic any final feedback from you here? I have a couple minor things I can do in a fixup, but I want to make sure we're aligned on the big picture stuff. |
storage.bs
Outdated
<p><img src=assets/model-diagram.svg alt="Storage model diagram (described in the next paragraph)." | ||
width=434 height=815> | ||
|
||
<p id=model-description>To isolate this data this standard defines a <a for=/>storage shed</a> |
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.
I guess this id="" is not really needed anymore. (Although it doesn't hurt.)
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.
I fixed my nits, but I realized I have another question for @saschanaz.
Co-authored-by: Anne van Kesteren <[email protected]>
Corresponds to whatwg/storage#152.
Fixes #151
Used SVGO as @annevk suggested, which indeed vastly reduces the size.
Preview | Diff