Update build/distribution tooling. - #10
Conversation
There was a problem hiding this comment.
@sanajaved7 @oluoluoxenfree @jerivas This is an initial pass, ready for review/feedback.
| "test:ci": "run-p test:unit:ci test:e2e:ci" | ||
| }, | ||
| "devDependencies": { | ||
| "@floating-ui/dom": "^1.0.1", |
There was a problem hiding this comment.
If we're bundling (and transpiling) any dependencies into our published polyfill, then they are no longer actually "dependencies" for consumers.
|
|
||
| // @@@ Testing purposes... | ||
| console.log('running'); | ||
| applyPolyfill(); | ||
| } | ||
|
|
||
| // @@@ This is just to test that the floating-ui code can run... | ||
| function applyPolyfill() { | ||
| const referenceElement: HTMLElement | null = | ||
| document.querySelector('#button'); | ||
| const floatingElement: HTMLElement | null = | ||
| document.querySelector('#my-popup'); | ||
|
|
||
| if (referenceElement && floatingElement) { | ||
| const applyStyles = ({ x = 0, y = 0, strategy = 'absolute' } = {}) => { | ||
| Object.assign(floatingElement.style, { | ||
| position: strategy, | ||
| left: `${x}px`, | ||
| top: `${y}px`, | ||
| }); | ||
| }; | ||
|
|
||
| computePosition(referenceElement, floatingElement, { | ||
| placement: 'bottom', | ||
| }).then(applyStyles); | ||
| } |
There was a problem hiding this comment.
All this stuff can get removed/replaced with the actual polyfill code -- it's just to test that this package can be installed/run, including the floating-ui code.
| fileName: 'css-anchor-positioning', | ||
| formats: ['es', 'umd', 'iife'], | ||
| }, | ||
| target: 'es6', |
There was a problem hiding this comment.
@sanajaved7 @oluoluoxenfree @jerivas Right now this is targeting es6, which is pretty straightforward. If we want to target es5 we might need to consider a different build tool (Babel?) -- Vite and esbuild do not support es5 transpilation yet.
| import { transformCSS } from './fetching.js'; | ||
|
|
||
| // Expose API | ||
| // @@@ This should be replaced with the actual API we want to expose |
There was a problem hiding this comment.
Again, just for testing purposes. I imagine that the API we want to expose would go here.
|
Yay this has been merged ! :) But quick question, are folks able to see my comments other than "ES2020+ 😎" ? 🤔 Where I tried to "start reviews" and provide some feedback to the implementation. If not, please let me know, I'll try to re-post them or screenshot what I'm seeing. |

Uh oh!
There was an error while loading. Please reload this page.