oakstudios / mechanical-ragger Goto Github PK
View Code? Open in Web Editor NEWMechanical text ragging for the web
Home Page: https://oakstudios.github.io/mechanical-ragger/#essay
License: MIT License
Mechanical text ragging for the web
Home Page: https://oakstudios.github.io/mechanical-ragger/#essay
License: MIT License
window.getComputedStyle
doesn't always return a pixel value, particularly when it evaluates to normal
.
style value |
getComputedStyle value |
---|---|
|
18px |
inherit |
18px |
initial |
normal |
normal |
normal |
revert |
18px |
unset |
18px |
mechanical-ragger fails for this test case (since normal evaluates to NaN
).
MDN suggests that the default is ~1.2
, but chrome uses something closer to 1.16
๐ฅด
normal
Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly
1.2
, depending on the element'sfont-family
.โ https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#values
Either way, relying on all UAs to use a reliable default here feels risky, so maybe we should log a warning in the console and not try to render the exclusion if we can't figure out the line-height
? and probably update the README to note this.
Any text I place within the <mechanical-ragger>
element won't inherit the other styles on my site. For example:
<p><mechanical-ragger>
This <a href="github.com">URL</a> won't be styled like my other links.
</mechanical-ragger></p>
As far as I understand it, mechanical-ragger creates an autonomous custom element, which won't inherit anything from other HTML elements. But I'd love to be able to integrate this tool's ragging with all my existing styles. Thanks!
should probably test a few uses of the module on every push:
just need to ensure they render, but maybe testing for the existence of the exclusion element would be useful? a visual diffing test might be ideal but maybe more trouble to set up than it's worth?
lh
units might be helpful for a few different issues like #3 and #18, where browser differences in how they evaluate, report, and round line heights cause issues for us. we may get mileage out of:
lh
units, which should mirror browser renderingnoted before, but this is borked
think an svg would actually be a good candidate here, because transitioning a circle
's width
property alongside vector-effect: non-scaling-stroke
would feel a little more harmonious with the motif of the site, and svg is probably less error-prone than trying to leverage backface visibility
particularly in chrome
Noticed while working with storybook, navigating from story to story outputs some errors about elements being undefined, because the resize observer isn't disconnecting
the basic demo with text-align: right
isn't quite what we want. should make sure we know which side of the paragraph the rags (plural none if it's centered?) are going to be on
some considerations:
writing-mode
and inferred writing mode when you just plop RTL text into a LTR document?text-align: center
needs two exclusionsCould just be a screenshot of the demo?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.