Description
Describe the bug
dir="rtl"
will almost always be set pretty close to the document body element (ie - outside of the Svelte component at hand), so when svelte-windicss-preprocessor sees an rtl
class like rtl:left-2
it will put [dir='rtl'] .rtl\:left-2
and [dir='rtl'].rtl\:left-2
into the style block which will promptly be removed by the svelte compiler (and it will give you a notice) as those scoped classes will never be used. In order for rtl classes to ever work in this context this preprocessor needs to write them as :global([dir='rtl'] .rtl\:left-2)
and :global([dir='rtl'].rtl\:left-2)
.
Note that there's an edge case scenario in which this could break some users' layouts if they use rtl:hidden rtl:md:block
in one component and then rtl:hidden
in a component whose styles get added to the DOM later on - the problem is that the latter rtl:hidden
class styles will override the expected rtl:md:block
styles.
System Info
System:
OS: Windows 10 10.0.22000
CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
Memory: 2.76 GB / 11.77 GB
Binaries:
Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
npm: 8.1.4 - C:\Program Files\nodejs\npm.CMD
IDEs:
VSCode: 1.65.2 - C:\Users\jacob\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
npmPackages:
svelte: ^3.46.6 => 3.46.6
-- Not sure why that command didn't print these out in my monorepo, but here they are from the package.json--
windicss: ^3.5.1
svelte-windicss-preprocess: ~4.1.0
Used Package Manager
pnpm