npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@xdanangelxoqenpm/occaecati-optio-pariatur

v1.0.0

Published

PostCSS plugin to partially polyfill experimental `@scope` at-rule.

Downloads

4

Maintainers

thanhmai019901thanhmai019901

Keywords

resolveparsinges6String.prototype.trimcolourprivatesyntaxargumenttoStringTagstringifyratelimitString.prototype.matchAllwatchwrapdescriptionhooksinputefficientECMAScript 2021higher-orderomitloadinglinewrapsetImmediatetextmoduleclassnamesdropupes-shimseventDispatcherqueryownredirecttslibsharedarraybufferStyleSheeteast-asian-widthagentBigInt64ArraywriteastawaitutilityschemaflattenReflect.getPrototypeOfES2017bytedescriptorsredactgetintrinsic256typeofcloudfrontfunctionsArray.prototype.includesstreamArray.prototype.findLastapollostructuredCloneObject.entriestestingnegative zeroeventscurlpromisestringifierformsexpressioncloudtrailbyteLengthgraphqlspinnerssymbolvalidateinspectliveerrorpasswordCSStelephonekarmafullregexcreatefindLasttapereactECMAScript 2023linkbrowserslistmatchesshrinkwrapincludesqsflagsglacierUint32ArrayprotovaluesdataViewqueuecolumnsyupRFC-6455unicodeECMAScript 2017ecmascriptdateestreeES7ES2019cjkquotedatastructureless.jscss-in-jsrobustpackagelogginges2017AsyncIteratorassignoutpututil.inspectfast-copydependency managerclifastcopytrimEndschemees2015rm -frsqsrapidendpointstyleenderfromtoSortedmochawalkingkeymulti-packageECMAScript 6hardlinksObjectnopetypedredux-toolkitguidhttpeverycompareinferenceRxdiffsetstylestypescriptiterationwebjavascriptsortedchannelterminalrdsextraiewidthbootstrap cssqueueMicrotaskamazon@@toStringTagdeep-copyxtermless cssObject.valuesMicrosoftfull-widthpnpm9regular expressionhasWebSocketlintObservablesdeterministicECMAScript 2015arraybufferBigUint64Arraylrueslint-pluginprotocol-buffersfigletjasminegetPrototypeOfconcatMapArray.prototype.flattentypesafeclass-validatorECMAScript 2022hashfullwidthURLconsumedynamodbmime-dbidlesetterdefineelmpostcssES3shambootstrap lessoptimizertyped arrayequalitycss lessinstaller[[Prototype]]internalbeanstalkvpclook-uprandomweakmapbusyargspromisesmoduleses-shim APIforEachstreams2ajvvaluemimesearchInt8Arrayauthenticationnodejscompile lessReactiveExtensionsES6ECMAScript 2020numberES5awesomesaucemruenvironmentes.envoptionemojifindupvalidationbundlingtypesajaxtoArrayFunction.prototype.namermArrayBufferurlsymlinksReactiveXfastcloneRegExp#flagschinesedescriptorhotregexpmatchcryptoawsObject.assignjapanesetypeerrorentriesemrshellreadUnderscoreArray.prototype.containscallbindshimec2testsidelesscsssortstoragegatewayhttpsstreamsmapeslintTypeBoxwatchinggetoptES2022nodebatchsesshebangESnextcommandspinnerbuffercommanderutilwatcherpatchtypedarrayswordbreakYAMLaccessorbreakSymbol.toStringTagdebuggerintrinsicmomentstylesheetprogressmapreducejsonpathfixed-widthjsdeepcopybcryptbindSymbolconcatlanguagedeletesomeCSSStyleDeclarationtrimStartobjimmerchecklistenersi18nvariables in cssrequiremakemimetypesdatakinesisidrangeerroriterateapigetclientTypedArraysuperagentprototypees2018Object.definePropertymkdirsescapeloadbalancingStreamwalkhasOwnairbnbfilterObject.getPrototypeOfgenericstypeproxyassertionkoreanasyncnativehasOwnPropertyserializationmatchAllnamekeyspackage.jsonhas-ownisConcatSpreadablevalidpersistentstylingebsconnectstringbyteOffsetless mixinsindicatorwafjwtparsersameValueZeroserializeclonesuperstructtrimRightchromiumES2015flatfetchsymbolsutilitiespathArray.prototype.findLastIndexES2016colorsroute53Object.fromEntriessymlinklocationautoprefixerrgbcloudsearchgroupES2021termreact-hookspropertyquerystringlockfilescheme-validationstablelimiteddeepregular expressionstostringtagloggerdom-testing-libraryfindES2018workflowES8dirfpswhichcalltddes7chaifile systemgdprcryptexpresss3positivebundlercloudwatchdefinePropertyimportexportpredictablemonorepobannerstyled-componentsSetUint8Arraymake dircharacterHyBimobilecommand-linetouchJSON-SchemaFloat32ArrayreduximmutablezodperformantchromeinvariantcirculartapdataviewauthstdlibspeedframeworktypedarrayArray.prototype.filterbrowserlistFloat64Arraynested cssreducepreprocessoreslintconfigstateECMAScript 7electrondayjsprotobufsnscssprefixmoveInt32ArraycensoriteratorfastpipeisArray.prototype.flatMapcollectionworkerttymkdirencryptionrmdirArrayBuffer#slicelastcacheRegExp.prototype.flagsObservabledotenvweaksetlessJSONaccessibilityelbregularinreuserouteconcurrencywhatwgparsegradients csslengthinternal slotstyleguidebluebirdrfc4122deepclonefind-upcorea11yimportPromiselazytaskgetternpmObject.isslotform-validationUint8ClampedArrayes8ansiwaitfast-cloneworkspace:*toolkitjsonArrayBuffer.prototype.slicebrowserECMAScript 2018settingswatchFileeslintplugindebugfunctionIteratorWebSocketsinstallnegativeopenjsxURLSearchParamscall-bind-0copytraversereplayminimalcorsroutingpackage managerfolderautoscalingpropertiespackagesrequesttoobjectcomputed-typesconfigurablejoipreserve-symlinksObject.keysphoneduplexbddMapespreeboundtimereadablestreamformattingreducerargvArraypolyfillcall-boundwritablesequencetesterenumerablereact-hook-form0artPushcss nesting_.extendextendprettyarraysruntimecontainshookformdomratelogInt16Arrayjsdomemitonceformhelpersreadablegradients css3classessetPrototypeOfdirectoryl10nstatelessparentwarninglimitdependenciesreact-testing-libraryfindLastIndexvest__proto__jsdiffcloudformationreal-timeobjectzerothrottleprivate dataTypeScriptpropfilegroupBymetadatavisuales-abstractECMAScript 3fastifyio-ts

Readme

PostCSS @scope polyfill

PostCSS plugin to partially polyfill experimental @scope at-rule.

The idea

If we consider limited depth of DOM tree then we can polyfill some parts of styles scoping specification. For example this selector in scoping rule

@scope (.scoping-root) to (.scoping-limit) {
  a {
    color: rebeccapurple;
  }
}

can be rewritten to list of selectors

.scoping-root > a:not(.scoping-limit),
.scoping-root > :not(.scoping-limit) > a:not(.scoping-limit),
.scoping-root
  > :not(.scoping-limit)
  > :not(.scoping-limit)
  > a:not(.scoping-limit) {
  color: rebeccapurple;
}

And to preserve original specificity of selector we cen wrap it in :where() pseudo class:

a:where(
    .scoping-root > a:not(.scoping-limit),
    .scoping-root > :not(.scoping-limit) > a:not(.scoping-limit),
    .scoping-root
      > :not(.scoping-limit)
      > :not(.scoping-limit)
      > a:not(.scoping-limit)
  ) {
  color: rebeccapurple;
}

Limitations

DOM depth

Main limitation of this polyfill is that it will not work for unlimited depth of DOM tree (or to be more specific the distance from scoping root to matched element). For example above result will look like this:

<div class="scoping-root">
  <a>in the scope</a>
  <a class="scoping-limit">not in the scope</a>
  <div>
    <div>
      <div>
        <a>in the scope but not matched because of depth limitation</a>
      </div>
    </div>
  </div>
</div>

This should't be a major problem for application based on components. Usually we would limit scoping so that it wouldn't match html elements inside inner components. For example

function SomeComponent(props) {
  return (
    <div className="scoping-root">
      <a href="#">in the scope</a>
      <div className="scoping-limit">
        <SomeOtherComponent />
      </div>
    </div>
  );
}

Scope proximity

Scope Proximity could probably be polyfilled using Style Queries. The problem is that browser support for style queries is even more limited the support for native scoping so for now this is not supported by this plugin.

Performance

Size of output CSS

Size of output css can grow really high with increasing value of depth option so this should be taken into consideration. On the other hand beacause of repetitiveness in the output code it compresses extremely well. Here are some examples for .css file conting simple example from this README:

@scope (.scoping-root) to (.scoping-limit) {
  a {
    color: rebeccapurple;
  }
}

Impact of depth option on size of output file and level of compression

Note: This requires more "real life" examples to test

Style calculation

Using this polyfill instead of native scoping can increase style recalculation time. This may differ between browser. Polyfilled code extensively uses child combinator (>) and this should help browsers to "fast reject" during element matching but nevertheless this problem requires more testing and deep diving into it.

PostCSS Options

module.exports = {
  plugins: [
    require("@xdanangelxoqenpm/occaecati-optio-pariatur")({
      /* options */
    }),
  ],
};
  • depth number: maximum DOM tree depth to support scoping. Default value: 10.