feat(core): apply CSS cascade layer (@layer) rules
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- css, typescript
Línea de trabajo
Start with ui/styling/style-scope.ts and css/css-tree-parser.ts, then trace RuleSet and compareSelectors to understand how rules are populated and ordered. Review the existing unit tests and the proposed behavior for named, dotted, anonymous, and imported layers. Done means supported @layer rules retain their names and cascade order without changing the explicitly out-of-scope at-rules.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Current behavior
_populateRules in ui/styling/style-scope.ts only descends into @media at-rules. Any other block at-rule — @layer, @supports, @scope, @container — is silently dropped with its contents.
@layer utilities {
.my-util { color: red; }
}
.my-util never applies. This is already biting the ecosystem: Tailwind v4 output crashes/loops on @layer (NativeScript/tailwind#197), and Panda CSS / Bamboo / UnoCSS all emit cascade layers, so none of the modern build-time atomic-CSS pipelines can feed NativeScript today. Community workarounds flatten @layer at bundler time (e.g. ns-tailwind-vite), which loses the cascade semantics.
Proposal
Apply @layer per CSS Cascade Level 5, scoped to what NativeScript's cascade implements:
- Parse: the css-tree adapter (
css/css-tree-parser.ts) already emits{type: 'layer', rules: [...]}— it just needs to keep the prelude (layer names). - Order: a document-wide name → ordinal registry; statement form
@layer a, b;pre-declares order, block form registers on first sight, dotted names (a.b) resolve through ancestors, anonymous blocks get unreferenceable names. - Cascade: each
RuleSetcarries alayerPath: number[];compareSelectorscompares layer paths before specificity, with unlayered rules sorting after all layered ones — matching the spec (unlayered author styles beat all layered styles; layer order beats specificity within layers). @import "x.css" layer(name)nests the imported sheet under the named layer.
Deliberately out of scope: !important layer-order reversal (NS does not implement !important — it warns and strips) and other block at-rules (@supports, @container, @scope), which still need real semantics and are safer left dropped than applied unconditionally.
PR
I have a patch ready on a fork branch with unit tests — will open the PR referencing this issue.
- Lenguaje dominante
- TypeScript
- Estrellas
- 25.7k
- Forks
- 1.7k
- Merge medio
- 2 d 19 h
- PR fusionados (30 d)
- 27
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de NativeScript/NativeScript
-
bug-pending-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NativeScript/NativeScript#11460 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
NativeScript/NativeScript#11448 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
NativeScript/NativeScript#11068 ·
Los mantenedores suelen responder en 1 día
-
bug-pending-triage
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
NativeScript/NativeScript#11476 ·
Los mantenedores suelen responder en 1 día
-
vite: workspace CSS imports served to device with __vite__updateStyle (undefined at runtime)Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
NativeScript/NativeScript#11472 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de NativeScript/NativeScript
Issues similares
-
refactor
Dificultad 2/5 Medio día Aptitud para principiantes 84/100
Los mantenedores suelen responder en 5 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
OHDSI/Data2Evidence#3450 ·
Los mantenedores suelen responder en 2 días
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
redhat-developer/rhdh-plugin-export-overlays#4011 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
automation missing-model model-sync provider:ofox
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
anomalyco/models.dev#8421 ·
Los mantenedores suelen responder en 1 día
-
SlackAdapter and TelegramAdapter are not assignable to Adapter under exactOptionalPropertyTypesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día