Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Houdini: Abracadabra CSS
Search
Masaaki Morishita
October 19, 2016
Programming
1
770
Houdini: Abracadabra CSS
at #dogenzakabeerbash
Masaaki Morishita
October 19, 2016
Tweet
Share
More Decks by Masaaki Morishita
See All by Masaaki Morishita
PostCSS: Build your own CSS processor
morishitter
6
4.6k
Modern CSS: architecture, future specs and build flow
morishitter
13
2.5k
PostCSS and cssnext
morishitter
11
1.7k
PostCSS 5.0: for Custom CSS Preprocessing
morishitter
10
1.1k
PostCSS for beginners
morishitter
6
1.3k
CSSfmt
morishitter
2
200
Introduction to CSS Architecture
morishitter
3
330
Introduction to PostCSS
morishitter
6
1.6k
Yet Another CSS Preprocessor
morishitter
1
5.5k
Other Decks in Programming
See All in Programming
Vue3の一歩踏み込んだパフォーマンスチューニング2024
hal_spidernight
3
3.1k
RailsのPull requestsのレビューの時に私が考えていること
yahonda
5
1.7k
OpenTelemetryでRailsのパフォーマンス分析を始めてみよう(KoR2024)
ymtdzzz
4
1.6k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
390
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
cXML という電子商取引の トランザクションを支える プロトコルと向きあっている話
phigasui
3
2.3k
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
550
ECSのサービス間通信 4つの方法を比較する 〜Canary,Blue/Greenも添えて〜
tkikuc
11
2.3k
Macとオーディオ再生 2024/11/02
yusukeito
0
160
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
讓數據說話:用 Python、Prometheus 和 Grafana 講故事
eddie
0
350
『ドメイン駆動設計をはじめよう』のモデリングアプローチ
masuda220
PRO
8
440
Featured
See All Featured
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
4
290
Why Our Code Smells
bkeepers
PRO
334
57k
Optimizing for Happiness
mojombo
376
69k
Testing 201, or: Great Expectations
jmmastey
38
7k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.8k
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
Statistics for Hackers
jakevdp
796
220k
Art, The Web, and Tiny UX
lynnandtonic
296
20k
A Tale of Four Properties
chriscoyier
156
23k
Agile that works and the tools we love
rasmusluckow
327
21k
Happy Clients
brianwarren
97
6.7k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
328
21k
Transcript
Houdini: Abracadabra CSS @morishi(er_
About me .about-me { name: Masaaki Morishita; twitter: @morishitter_; github:
morishitter; qiita: morishitter; specializing-in: CSS; works-at: 'Increments, inc.'; }
Do you love CSS?
CSS is easy :) • ؆୯ͳߏจ • ΧεέʔσΟϯάʢৄࡉɺܧঝʣ .selector {
property: value; } ͜Ε͚ͩ
but, CSS is broken...
CSS is missing ;( • ߏԽ • நԽ • ϧʔϧηοτͷείʔϓ
"Cascading Shit Show" by @fat h"ps:/ /www.youtube.com/watch? v=iniwPUEbPUM
CSS preprocessors? • e.g. Sass, Less, Stylus • ඪ४ٕज़Ͱͳ͍ •
γϯλοΫεγϡΨʔ • PostCSS? • PostCSSͨͩͷύʔαʔ • cssnext ϙϦϑΟϧͰͳ͍
We need polyfils of CSS
but, it's very hard to create
None
None
None
Houdini
Extensible web h"ps:/ /extensiblewebmanifesto.org/
Extensible Web • ϒϥβͷػೳʹΞΫηε͢ΔϨΠϠʔͷAPIΛఏڙ • ༷ͷࡦఆɺϒϥβͷ࣮Λͨͣʹ։ൃऀ࣮Ͱ͖Δ • ༷ͷఏҊʹͭͳ͕Δ • HoudiniͦͷCSSͷͨΊͷͷ
Houdini • Typed OM • Proper-es and Values API •
Pain-ng API • Layout API • Font Metrics API • Parser API • Worklets
Typed OM document.querySelector('#element') .style.opacity = '0.5px'; ↓ document.querySelector('#element') .styleMap.set('opacity', new
CSSNumberValue(0.5)); document.querySelector('#element') .styleMap.get('opacity').value; // 0.5
Typed OM • ࠓ·Ͱ element.style ͷจࣈྻΛ͜Ͷ͘Γճ͚ͩ͢ • styleMap ΦϒδΣΫτͱͷΫϥεΛՃ •
JS͔ΒCSSΛѻ͍͘͢ͳΔ • CanaryͰflagΛONʹ͢Δͱ෦తʹ͑Δ
Proper&es and Values API .foo { --opacity: 1; --opacity: 'foo';
opacity: var(--opacity); /* ແޮͳͳͷͰύʔαʔ͕উखʹআ */ } document.registerProperty({ name: '--my-opacity', syntax: '<number>', // type check inherits: false, // ܧঝͤ͞Δ͔Ͳ͏͔ initialValue: 1 // ॳظ });
Pain%ng API <div id="foo"></div> <style> #foo { --image: url('#url'); background-image:
paint(image-with-placeholder); } </style>
Paint Worklet document.registerProperty({ name: '--image', syntax: '<image>' }); window.paintWorklet.import('paintworklet.js'); registerPaint('image-with-placeholder',
class { static get inputProperties() { return ['--image']; } paint(ctx, geom, properties) { const img = properties.get('--image'); switch (img.state) { // } } })
Paint Worklet • CanvasͷΑ͏ͳͷ • CanvasCPUϝϞϦ৯͏ • CanaryͰflagΛONʹ͢Δͱ෦తʹ͑Δ
Layout API <div id="myElement"> <div> CSS is awesome. </div> </div>
<style> #myElement { display: layout('simple-flow'); } </style>
Layout Worklet registerLayout('simple-flow', class { static get inputProperties() { return
['width', 'height'] } static get childrenInputProperties() { return ['x', 'y', 'position'] } layout(children, constraintSpace, styleMap, breakToken) { // } }
Is Houdini ready yet? h"ps:/ /ishoudinireadyyet.com
Thanks :D @morishi(er_