Giter VIP home page Giter VIP logo

cqfill's Introduction

cqfill's People

Contributors

jasikpark avatar jonathantneal avatar silvenon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cqfill's Issues

Broken minification in cqfill.mjs

I'm using [email protected] in a react application, and cqfill makes the build fail with the following error:

TypeError: [...]\node_modules\cqfill\polyfill\cqfill.mjs: Duplicate declaration "n"
> 1 | (({every:e,indexOf:t,slice:s}=Array.prototype [rest of the script...]

I unminified the content of the file and could pinpoint the location of the error:

TypeError: C:\DEV\GitHub\eclubpolimi.it\node_modules\cqfill\polyfill\cqfill.mjs: Duplicate declaration "n"
  25 |   y = () => {
  26 |       for (const [e, t, s, n] of d) {
> 27 |           const n = new Set();
     |                 ^
  28 |           for (const t of r) if (s(t, a.get(t))) for (const s of t.querySelectorAll(e)) n.add(s);
  29 |           const o = [];
  30 |           for (const e of n) {

This is the corresponding code https://github.com/jsxtools/cqfill/blob/main/src/export.js#L58
It looks like an issue with minification.

Support for multiple containers / components on page

When I add multiple containers/contained elements on the page the polyfill behaves strange.
Would be nice to have a example for multiple containers / unit tests.

Example 1 (normal website): we have one (global) container and two contained
Variant 1: https://stackblitz.com/edit/cqfill-multiple-containers?file=index.html
Variant 2: https://stackblitz.com/edit/cqfill-one-container-multiple-contained-media?file=style.css
it works as expected then.

Example 2 (Component based development): - we have two containers and two contained (basically if you develop isolated component based > webcomponents, angular,.... it's always this case):
https://stackblitz.com/edit/cqfill-multiple-containers-multiple-components?file=index.html

only the first will work because of the --css-container variable?

I think the postcss plugin should process it > make a central container or use multiple --css-container variables

svelte / sveltekit usage

The only way I could successfully import cqfill into a ".svelte" file was like this:

<script>
    // Error: "Uncaught (in promise) TypeError: cqfill is not a function"    
    // import { cqfill } from "cqfill";

    import { cqfill } from '../../node_modules/cqfill/export/cqfill';

    cqfill();
</script>

Not sure if this is a problem with the module or something I'm doing.

Lack of whitespace between @container and (RULE) cause problem

My first time filing an open source issue, please go easy on me :).

Using cqfill with PostCSS, when i leave a whitespace between @container and (RULE), the generated CSS code works. But when I remove the whitespace

@container(min-width: 700px) {
  .contained {
    /* styles applied when a container is at least 700px */
  }
}

which i think is valid, then the generated CSS become

@media--css-container and (min-width: 700px) {
...
}

The whitespace between @media and --css-container is gone and it does not work anymore.

Your thought on this ?

Unable to import named `cqfill` function export

The docs indicate that I should be able to manually apply the polyfill to a shadow root by importing a named export function called cqfill:

import { cqfill } from 'cqfill'

cqfill() /* cqfill(document); cqfill(shadowRoot) */

However, when I attempted to do this, Webpack gave me an error saying that cqfill had no exports. I ended up having to do the following in order to import the cqfill function:

import { cqfill } from 'node_modules/cqfill/export/cqfill.cjs'

cqfill(shadowRoot)

I ended up using another library that worked with styled-components but wanted to post this issue here in case it affects others as well. :)

::before and ::after support

Hey, does this polyfill support to use ::before and ::after inside the contained element. I tried but it seems not working.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.