-
Notifications
You must be signed in to change notification settings - Fork 279
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
feat: renderer/style: Passthrough unknown properties to Svg output #759
Conversation
- Updated examples due to above - Removed renderer code made unnecessary byy passthrough SVG - Removed 'unknown property' test
Codecov Report
@@ Coverage Diff @@
## main #759 +/- ##
==========================================
+ Coverage 65.72% 65.93% +0.20%
==========================================
Files 59 59
Lines 7980 7920 -60
Branches 1405 1402 -3
==========================================
- Hits 5245 5222 -23
+ Misses 2726 2689 -37
Partials 9 9
Continue to review full report at Codecov.
|
Deploying with Cloudflare Pages
|
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.
Looks good but let's wait until #743 merges.
Out of the loop: does the system warn the user when it's letting stuff pass through? Or, since the goal is to let everything pass through, it'd be too noisy? as usual i'm just vaguely worried about xss somehow but idk |
@maxkrieger, it's a good question. Nearly all diagrams will have passthrough properties. An example is r (radius), which is now a passthrough -- the typescript code previously mapping r is no longer necessary. One of the tradeoffs of the approach we discussed earlier in the week is when a user mistypes a Style property name. There is no error or warning, which can lead to confusion. The consensus was to (eventually) build support in the IDE to help users recognize non-Style properties since we no longer stop compilation upon encountering "unknown" properties -- instead, we pass them down the pipeline. |
Also are we aware about Also some attr names have colons like |
The desire remains to broaden support for non-alphanumeric property names, but this PR does not implement a solution to this part of the problem. Options discussed include:
|
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.
Looks great!
…se/penrose into svg-passthrough-attributes
Description
Fixes #767
Continued work on passthrough SVG properties (see PR# 749). This PR eliminates Style's check for unknown properties and removes the test associated with the unknown property check.
Further, SVG passthrough properties make some renderer code unnecessary. Where these properties are rendered via the passthrough logic, specific logic for these fields has been eliminated.
Implementation strategy and design decisions
This is a continuation of PR #749, which added support for passthrough properties to the renderer. This PR makes it possible for users to utilize this functionality in a Style program, except in the situation where the property name includes dashes. A future PR will address that issue since allowing dashes in an identifier name conflicts with the desire to allow computations in the form of x1-x2 (no spaces).
As before, there is presently no validation of passthrough SVG properties or their contents. This is left as future work and reflects the current group consensus. Further, there is no guarantee a passthrough property will not interfere with the optimized properties in the diagram. Some care and knowledge of SVG may be necessary on the part of the user.
Examples with steps to reproduce them
Choose any example. Add an unknown property such as "smileandwave" with a string literal value. Run the example and locate the passthrough property and value on the shape within the SVG output.
Checklist
yarn test
yarn docs
and there were no errors when generating the HTML siteOpen questions
See PR# 749