tailwindcss-scoped-preflight
Version:
To avoid style conflicts (CSS collisions/interference side effects) when using Tailwind CSS with other UI libraries like Antd, Vuetify etc.
1 lines • 21.3 kB
Source Map (JSON)
{"version":3,"file":"plugin.modern.mjs","sources":["../src/strategies.ts","../src/index.ts"],"sourcesContent":["import { type CSSRuleSelectorTransformer } from './index';\n\ninterface Options {\n ignore?: string[];\n remove?: string[];\n}\n\ntype SelectorBasedStrategy<ExtraOptions = unknown> = (\n selectors: string | string[],\n options?: Options & ExtraOptions,\n) => CSSRuleSelectorTransformer;\n\nconst optionsHandlerForIgnoreAndRemove = (\n selector: string,\n { ignore, remove }: Options = {},\n): string | null => {\n if (remove?.some((s) => selector.includes(s)) === true) {\n return '';\n }\n if (ignore?.some((s) => selector.includes(s)) === true) {\n return selector;\n }\n return null;\n};\n\nconst roots = new Set([\n 'html',\n 'body',\n ':host',\n]);\nfunction isRootSelector(selector: string) {\n return roots.has(selector);\n}\n\nfunction isBeforeOrAfter(ruleSelector: string) {\n return ruleSelector.includes('::before') || ruleSelector.includes('::after');\n}\nfunction isPseudoElementSelector(ruleSelector: string) {\n return ruleSelector.includes('::');\n}\n\n/**\n * Isolates the TailwindCSS preflight styles inside of the container (assuming all the TailwindCSS is inside of this container)\n *\n * @param containerSelectors\n * @param options\n * @param options.ignore - list of preflight CSS selectors to ignore (don't isolate) - these will not be affected by the transformation\n * @param options.remove - list of preflight CSS selectors to remove from the final CSS - use it if you have any specific conflicts and really want to remove some preflight rules\n * @param options.rootStyles - 'move to container' (default) - moves the root styles to the container styles (by simply replacing the selector), 'add :where' - adds ` :where` to the root selector so styles are still in roots, but only matching items would be affected\n *\n * @link https://www.npmjs.com/package/tailwindcss-scoped-preflight#isolate-inside-of-container (example)\n */\nexport const isolateInsideOfContainer: SelectorBasedStrategy<{\n except?: string;\n rootStyles?: 'move to container' | 'add :where';\n}> = (containerSelectors, options) => {\n const whereNotExcept =\n typeof options?.except === 'string' && options.except\n ? `:where(:not(${options.except},${options.except} *))`\n : '';\n\n const selectorsArray = [containerSelectors].flat();\n const whereDirect = `:where(${selectorsArray.join(',')})`;\n const whereWithSubs = `:where(${selectorsArray.map((s) => `${s},${s} *`).join(',')})`;\n\n return ({ ruleSelector }) => {\n const handled = optionsHandlerForIgnoreAndRemove(ruleSelector, options);\n if (handled != null) {\n return handled;\n }\n\n if (isRootSelector(ruleSelector)) {\n if (options?.rootStyles === 'add :where') {\n return `${ruleSelector}${whereNotExcept} ${whereDirect}`;\n }\n return selectorsArray.map((s) => `${s}${whereNotExcept}`).join(',');\n } else if (isBeforeOrAfter(ruleSelector)) {\n return `${whereWithSubs}${whereNotExcept}${ruleSelector}`;\n } else if (isPseudoElementSelector(ruleSelector)) {\n return `${whereWithSubs}${whereNotExcept} ${ruleSelector}`;\n } else {\n return `${ruleSelector}${whereWithSubs}${whereNotExcept}`;\n }\n };\n};\n\n/**\n * Isolates the TailwindCSS preflight styles outside of the container (assuming no TailwindCSS inside of it)\n * @param containerSelectors\n * @param options\n * @param options.ignore - list of preflight CSS selectors to ignore (don't isolate) - these will not be affected by the transformation\n * @param options.remove - list of preflight CSS selectors to remove from the final CSS - use it if you have any specific conflicts and really want to remove some preflight rules\n *\n * @link https://www.npmjs.com/package/tailwindcss-scoped-preflight#isolate-outside-of-container (example)\n */\nexport const isolateOutsideOfContainer: SelectorBasedStrategy<{ plus?: string }> = (\n containerSelectors,\n options,\n) => {\n const whereNotContainerSelector = `:where(:not(${[containerSelectors]\n .flat()\n .map((s) => `${s},${s} *`)\n .join(',')}))`;\n\n const insideOfContainerLogic =\n typeof options?.plus === 'string' && options.plus\n ? isolateInsideOfContainer(options.plus)\n : null;\n\n return ({ ruleSelector, ...rest }) => {\n const ignoreOrRemove = optionsHandlerForIgnoreAndRemove(ruleSelector, options);\n if (ignoreOrRemove != null) {\n return ignoreOrRemove;\n }\n\n if (isRootSelector(ruleSelector)) {\n return ruleSelector;\n }\n\n return [\n isBeforeOrAfter(ruleSelector)\n ? `${whereNotContainerSelector}${ruleSelector}`\n : isPseudoElementSelector(ruleSelector)\n ? `${whereNotContainerSelector} ${ruleSelector}`\n : `${ruleSelector}${whereNotContainerSelector}`,\n insideOfContainerLogic?.({ ruleSelector, ...rest }),\n ]\n .filter(Boolean)\n .join(',');\n };\n};\n\n/**\n * @deprecated Use `isolateInsideOfContainer` with rootStyles option set to 'add :where'\n * @description Isolates the TailwindCSS preflight styles within the component selector (not inside of the container, but immediately)\n * @param componentSelectors\n * @param options\n * @param options.ignore - list of preflight CSS selectors to ignore (don't isolate) - these will not be affected by the transformation\n * @param options.remove - list of preflight CSS selectors to remove from the final CSS - use it if you have any specific conflicts and really want to remove some preflight rules\n *\n * @link https://www.npmjs.com/package/tailwindcss-scoped-preflight#update-your-tailwind-css-configuration (example)\n */\nexport const isolateForComponents: SelectorBasedStrategy = (\n componentSelectors,\n options,\n): CSSRuleSelectorTransformer => {\n const componentSelectorsArray = [componentSelectors].flat();\n const whereComponentSelectorsDirect = `:where(${componentSelectorsArray.join(',')})`;\n const whereComponentSelectorsWithSubs = `:where(${componentSelectorsArray\n .map((s) => `${s},${s} *`)\n .join(',')})`;\n\n return ({ ruleSelector }) =>\n optionsHandlerForIgnoreAndRemove(ruleSelector, options) ??\n (isRootSelector(ruleSelector)\n ? `${ruleSelector} ${whereComponentSelectorsDirect}`\n : `${ruleSelector}${whereComponentSelectorsWithSubs}`);\n};\n","import TailwindPlugin from 'tailwindcss/plugin.js';\nimport postcss from 'postcss';\nimport { type CSSRuleObject } from 'tailwindcss/types/config.js';\nimport { readFileSync } from 'fs';\nimport { createRequire } from 'module';\n\n// if you see TS1470 - we actually just made an adapter here\nconst req = typeof require !== 'undefined' ? require : createRequire(import.meta.url);\n\nconst { withOptions } = TailwindPlugin;\n\ninterface PropsFilterInput {\n selectorSet: Set<string>;\n property: string;\n value: any;\n}\n\nexport type CSSRuleSelectorTransformer = (info: { ruleSelector: string }) => string;\n\ntype ModifyResult = string | null | undefined;\n\ntype ModifyStylesHook = (input: PropsFilterInput) => ModifyResult;\n\ninterface PluginOptions {\n isolationStrategy: CSSRuleSelectorTransformer;\n /** @deprecated prefer using modifyPreflightStyles */\n propsFilter?: (input: PropsFilterInput) => boolean | undefined;\n modifyPreflightStyles?: Record<string, Record<string, ModifyResult>> | ModifyStylesHook;\n}\n\n/**\n * TailwindCSS plugin to scope the preflight styles\n * @param isolationStrategy - function to transform the preflight CSS selectors,\n * import {@link https://www.npmjs.com/package/tailwindcss-scoped-preflight#isolate-inside-of-container isolateInsideOfContainer},\n * {@link https://www.npmjs.com/package/tailwindcss-scoped-preflight#isolate-outside-of-container isolateOutsideOfContainer},\n * {@link https://www.npmjs.com/package/tailwindcss-scoped-preflight#update-your-tailwind-css-configuration isolateForComponents} or write {@link https://www.npmjs.com/package/tailwindcss-scoped-preflight#your-owncustom-isolation-strategy your own}\n * @param propsFilter - function to filter the preflight CSS properties and values, return false to remove the property. Any other value (including true and undefined) will leave the prop intact\n * @param modifyPreflightStyles - function to modify the preflight CSS properties and their values, return null to remove the property. Any other returned value will be used as a new value for the property. If you don't want to change it - return the old value (provided in argument object as `value`).\n * @link https://www.npmjs.com/package/tailwindcss-scoped-preflight (documentation)\n */\nexport const scopedPreflightStyles = withOptions<PluginOptions>(\n ({ isolationStrategy, propsFilter, modifyPreflightStyles }) =>\n ({ addBase, corePlugins }) => {\n const baseCssPath = req.resolve('tailwindcss/lib/css/preflight.css');\n const baseCssStyles = postcss.parse(readFileSync(baseCssPath, 'utf8'));\n\n if (typeof isolationStrategy !== 'function') {\n throw new Error(\n \"TailwindCssScopedPreflightPlugin: isolationStrategy option must be a function - custom one or pre-bundled - import { isolateInsideOfContainer, isolateOutsideOfContainer, isolateForComponents } from 'tailwindcss-scoped-preflight-plugin')\",\n );\n }\n\n if (corePlugins('preflight')) {\n throw new Error(\n `TailwindCssScopedPreflightPlugin: TailwindCSS corePlugins.preflight config option must be set to false`,\n );\n }\n\n let modifyStylesHook: ModifyStylesHook | undefined;\n if (typeof modifyPreflightStyles === 'function') {\n modifyStylesHook = modifyPreflightStyles;\n } else if (modifyPreflightStyles) {\n const configEntries = Object.entries(modifyPreflightStyles);\n modifyStylesHook = ({ selectorSet, property, value }) => {\n const matchingEntry = configEntries.find(([sel]) => selectorSet.has(sel));\n return matchingEntry?.[1]?.[property];\n };\n }\n\n baseCssStyles.walkRules((rule) => {\n if (propsFilter || modifyPreflightStyles) {\n const selectorSet = new Set(rule.selectors);\n rule.nodes = rule.nodes?.map((node) => {\n if (node instanceof postcss.Declaration) {\n const newValue = modifyStylesHook\n ? modifyStylesHook({\n selectorSet,\n property: node.prop,\n value: node.value,\n })\n : node.value;\n\n const filterValue = propsFilter\n ? propsFilter({\n selectorSet,\n property: node.prop,\n value: node.value,\n })\n : true;\n if (filterValue === false || newValue === null) {\n return postcss.comment({\n text: node.toString(),\n });\n } else if (typeof newValue !== 'undefined' && newValue !== node.value) {\n node.value = newValue;\n }\n }\n return node;\n });\n }\n rule.selectors = rule.selectors\n .map((s) => isolationStrategy({ ruleSelector: s }))\n .filter((value, index, array) => value && array.indexOf(value) === index);\n rule.selector = rule.selectors.join(',\\n');\n if (!rule.nodes.some((n) => n instanceof postcss.Declaration)) {\n rule.nodes = [];\n }\n });\n\n addBase(\n baseCssStyles.nodes.filter((node, i, all) => {\n const next = all[i + 1];\n return node instanceof postcss.Rule\n ? node.nodes.length > 0 && node.selector\n : node instanceof postcss.Comment\n ? next instanceof postcss.Rule && next.selector && next.nodes.length > 0\n : true;\n }) as unknown as CSSRuleObject[],\n );\n },\n () => ({\n corePlugins: {\n preflight: false,\n },\n }),\n);\n\nexport * from './strategies';\n"],"names":["optionsHandlerForIgnoreAndRemove","selector","ignore","remove","some","s","includes","roots","Set","isRootSelector","has","isBeforeOrAfter","ruleSelector","isPseudoElementSelector","isolateInsideOfContainer","containerSelectors","options","whereNotExcept","except","selectorsArray","flat","whereDirect","join","whereWithSubs","map","handled","rootStyles","isolateOutsideOfContainer","whereNotContainerSelector","insideOfContainerLogic","plus","_ref","rest","_objectWithoutPropertiesLoose","_excluded","ignoreOrRemove","_extends","filter","Boolean","isolateForComponents","componentSelectors","componentSelectorsArray","whereComponentSelectorsDirect","whereComponentSelectorsWithSubs","_optionsHandlerForIgn","req","require","createRequire","import","meta","url","withOptions","TailwindPlugin","scopedPreflightStyles","isolationStrategy","propsFilter","modifyPreflightStyles","addBase","corePlugins","baseCssPath","resolve","baseCssStyles","postcss","parse","readFileSync","Error","modifyStylesHook","configEntries","Object","entries","selectorSet","property","value","_matchingEntry$","matchingEntry","find","sel","walkRules","rule","_rule$nodes","selectors","nodes","node","Declaration","newValue","prop","filterValue","comment","text","toString","index","array","indexOf","n","i","all","next","Rule","length","Comment","preflight"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,gCAAgC,GAAGA,CACvCC,QAAgB,EAChB;EAAEC,MAAM;AAAEC,EAAAA,MAAAA;AAAM,CAAA,GAAc,EAAE,KACf;AACjB,EAAA,IAAI,CAAAA,MAAM,IAAA,IAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEC,IAAI,CAAEC,CAAC,IAAKJ,QAAQ,CAACK,QAAQ,CAACD,CAAC,CAAC,CAAC,MAAK,IAAI,EAAE;AACtD,IAAA,OAAO,EAAE,CAAA;AACX,GAAA;AACA,EAAA,IAAI,CAAAH,MAAM,IAAA,IAAA,GAAA,KAAA,CAAA,GAANA,MAAM,CAAEE,IAAI,CAAEC,CAAC,IAAKJ,QAAQ,CAACK,QAAQ,CAACD,CAAC,CAAC,CAAC,MAAK,IAAI,EAAE;AACtD,IAAA,OAAOJ,QAAQ,CAAA;AACjB,GAAA;AACA,EAAA,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAMM,KAAK,GAAG,IAAIC,GAAG,CAAC,CACpB,MAAM,EACN,MAAM,EACN,OAAO,CACR,CAAC,CAAA;AACF,SAASC,cAAcA,CAACR,QAAgB,EAAA;AACtC,EAAA,OAAOM,KAAK,CAACG,GAAG,CAACT,QAAQ,C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