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
780
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.4k
CSSfmt
morishitter
2
200
Introduction to CSS Architecture
morishitter
3
330
Introduction to PostCSS
morishitter
6
1.7k
Yet Another CSS Preprocessor
morishitter
1
5.5k
Other Decks in Programming
See All in Programming
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Macとオーディオ再生 2024/11/02
yusukeito
0
370
Jakarta EE meets AI
ivargrimstad
0
150
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
EventSourcingの理想と現実
wenas
6
2.3k
NSOutlineView何もわからん:( 前編 / I Don't Understand About NSOutlineView :( Pt. 1
usagimaru
0
330
エンジニアとして関わる要件と仕様(公開用)
murabayashi
0
290
Realtime API 入門
riofujimon
0
150
Featured
See All Featured
Fireside Chat
paigeccino
34
3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
840
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Thoughts on Productivity
jonyablonski
67
4.3k
Embracing the Ebb and Flow
colly
84
4.5k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Typedesign – Prime Four
hannesfritz
40
2.4k
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_