Premier commit déjà bien avancé

This commit is contained in:
2025-11-10 18:33:24 +01:00
commit db4f0508cb
652 changed files with 440521 additions and 0 deletions

204
frontend/node_modules/@lezer/css/test/declarations.txt generated vendored Normal file
View File

@ -0,0 +1,204 @@
# Function calls
a {
color: rgba(0, 255, 0, 0.5);
}
==>
StyleSheet(
RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral,NumberLiteral,NumberLiteral,NumberLiteral))))))
# Calls where each argument has multiple values
div {
background: repeating-linear-gradient(red, orange 50px);
clip-path: polygon(50% 0%, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0% 50%, 40% 40%)
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(ValueName,ValueName,NumberLiteral(Unit)))),
Declaration(PropertyName,CallExpression(Callee,ArgList(
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),
NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit)))))))
# Color literals
a {
b: #fafd04;
c: #fafd0401;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ColorLiteral),
Declaration(PropertyName,ColorLiteral))))
# Numbers
a {
b: 0.5%;
c: 5em;
margin: 10E3px;
margin: -456.8px;
margin: -0.0px;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)),
Declaration(PropertyName,NumberLiteral(Unit)))))
# Binary arithmetic operators
a {
width: calc(100% - 80px);
aspect-ratio: 1/2;
font-size: calc(10px + (56 - 10) * ((100vw - 320px) / (1920 - 320)));
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(BinaryExpression(NumberLiteral(Unit),BinOp,NumberLiteral(Unit))))),
Declaration(PropertyName,BinaryExpression(NumberLiteral,BinOp,NumberLiteral)),
Declaration(PropertyName,CallExpression(Callee,ArgList(
BinaryExpression(BinaryExpression(NumberLiteral(Unit),BinOp,ParenthesizedValue(
BinaryExpression(NumberLiteral,BinOp,NumberLiteral))),BinOp,ParenthesizedValue(
BinaryExpression(ParenthesizedValue(BinaryExpression(NumberLiteral(Unit),BinOp,NumberLiteral(Unit))),BinOp,
ParenthesizedValue(BinaryExpression(NumberLiteral,BinOp,NumberLiteral)))))))))))
# Strings
a {
b: '';
c: '\'hi\'';
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,StringLiteral),Declaration(PropertyName,StringLiteral))))
# URLs
a {
b: url(http://something-else?foo=bar);
c: url();
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallLiteral(CallTag,ParenthesizedContent)),
Declaration(PropertyName,CallLiteral(CallTag)))))
# Important declarations
a {
b: c !important;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,ValueName,Important))))
# Comments right after numbers
a {
shape-outside: circle(20em/*=*/at 50% 50%);
shape-outside: inset(1em, 1em, 1em, 1em);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral(Unit),Comment,ValueName,NumberLiteral(Unit),NumberLiteral(Unit)))),
Declaration(PropertyName,CallExpression(Callee,ArgList(NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit),NumberLiteral(Unit)))))))
# Unfinished rule
a { foo: 2
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,NumberLiteral),⚠)))
# Variable names
foo {
--my-variable: white;
color: var(--my-variable);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(VariableName,ValueName),
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))))))
# Trailing comma
div { color: var(--c,) }
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))))))
# Space before colon
div {
color : red;
.x :active {
color : blue;
}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,ValueName),
RuleSet(DescendantSelector(ClassSelector(ClassName),PseudoClassSelector(PseudoClassName)),Block(
Declaration(PropertyName,ValueName))))))
# Empty value
p {
--var-name: ;
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(Declaration(VariableName))))
# Bracketed values
div {
--myvar: [ some: value; ]
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(VariableName,BracketedValue("[", ValueName, ":", ValueName, ";", "]")))))
# Call to variables
.foo {
box-shadow: --shadow(blue);
}
==>
StyleSheet(RuleSet(ClassSelector(ClassName),Block(
Declaration(PropertyName,CallExpression(VariableName,ArgList(ValueName))))))

150
frontend/node_modules/@lezer/css/test/selector.txt generated vendored Normal file
View File

@ -0,0 +1,150 @@
# Universal selectors
* {}
div * {}
==>
StyleSheet(
RuleSet(UniversalSelector,Block),
RuleSet(DescendantSelector(TagSelector(TagName),UniversalSelector),Block))
# Type selectors
div, span {}
h1, h2, h3, h4 {}
==>
StyleSheet(
RuleSet(TagSelector(TagName),TagSelector(TagName),Block),
RuleSet(TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),Block))
# Class selectors
.class-a {}
div.class-b, .class-c.class-d {}
==>
StyleSheet(
RuleSet(ClassSelector(ClassName),Block),
RuleSet(ClassSelector(TagSelector(TagName),ClassName),ClassSelector(ClassSelector(ClassName),ClassName),Block))
# Id selectors
#some-id, a#another-id {}
==>
StyleSheet(RuleSet(IdSelector(IdName),IdSelector(TagSelector(TagName),IdName),Block))
# Attribute selectors
[a] {}
[b=c] {}
[d~=e] {}
a[b] {}
==>
StyleSheet(
RuleSet(AttributeSelector(AttributeName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(TagSelector(TagName),AttributeName),Block))
# Pseudo-class selectors
a:hover {}
:nth-child(2) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName),Block),
RuleSet(PseudoClassSelector(":",PseudoClassName,ArgList(NumberLiteral)),Block))
# Pseudo-element selectors
a::first-line {}
==>
StyleSheet(RuleSet(PseudoClassSelector(TagSelector(TagName),"::",PseudoClassName),Block))
# Child selectors
a > b {}
c > d > e {}
==>
StyleSheet(
RuleSet(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),Block),
RuleSet(ChildSelector(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),ChildOp,TagSelector(TagName)),Block))
# Descendant selectors
a b {}
c d e {}
==>
StyleSheet(
RuleSet(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),Block),
RuleSet(DescendantSelector(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),TagSelector(TagName)),Block))
# Nesting selectors
a {
&.b {}
& c {}
c & {}
& > d {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(ClassSelector(NestingSelector,ClassName),Block),
RuleSet(DescendantSelector(NestingSelector,TagSelector(TagName)),Block),
RuleSet(DescendantSelector(TagSelector(TagName), NestingSelector),Block),
RuleSet(ChildSelector(NestingSelector,ChildOp,TagSelector(TagName)),Block))))
# Relative selectors
a {
p {}
> f {}
+ g {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(TagSelector(TagName),Block),
RuleSet(ChildSelector(ChildOp,TagSelector(TagName)),Block),
RuleSet(SiblingSelector(SiblingOp,TagSelector(TagName)),Block))))
# Sibling selectors
a.b ~ c.d {}
.e.f + .g.h {}
==>
StyleSheet(
RuleSet(SiblingSelector(ClassSelector(TagSelector(TagName),ClassName),SiblingOp,ClassSelector(TagSelector(TagName),ClassName)),Block),
RuleSet(SiblingSelector(ClassSelector(ClassSelector(ClassName),ClassName),SiblingOp,ClassSelector(ClassSelector(ClassName),ClassName)),Block))
# The :not selector
a:not(:hover) {}
.b:not(c > .d) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName,ArgList(PseudoClassSelector(":",PseudoClassName))),Block),
RuleSet(PseudoClassSelector(ClassSelector(ClassName),":",PseudoClassName,ArgList(ChildSelector(TagSelector(TagName),ChildOp,ClassSelector(ClassName)))),Block))

214
frontend/node_modules/@lezer/css/test/statements.txt generated vendored Normal file
View File

@ -0,0 +1,214 @@
# Empty stylesheets
/* Just a comment */
==>
StyleSheet(Comment)
# Import statements
@import url("fineprint.css") print;
@import url("bluish.css") speech;
@import 'custom.css';
@import url("chrome://communicator/skin/");
@import "common.css" screen;
@import "reset.css" layer(framework.component);
@import "components.css" layer screen;
==>
StyleSheet(
ImportStatement(import,CallLiteral(CallTag,StringLiteral),KeywordQuery),
ImportStatement(import,CallLiteral(CallTag,StringLiteral),KeywordQuery),
ImportStatement(import,StringLiteral),
ImportStatement(import,CallLiteral(CallTag,StringLiteral)),
ImportStatement(import,StringLiteral,KeywordQuery),
ImportStatement(import,StringLiteral,Layer(layer,LayerName,LayerName)),
ImportStatement(import,StringLiteral,Layer(layer),KeywordQuery))
# Namespace statements
/* Default namespace */
@namespace url(XML-namespace-URL);
@namespace "XML-namespace-URL";
@namespace url(http://www.w3.org/1999/xhtml);
@namespace svg url(http://www.w3.org/2000/svg);
/* Prefixed namespace */
@namespace prefix url(XML-namespace-URL);
@namespace prefix "XML-namespace-URL";
==>
StyleSheet(
Comment,
NamespaceStatement(namespace,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,StringLiteral),
NamespaceStatement(namespace,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,NamespaceName,CallLiteral(CallTag,ParenthesizedContent)),
Comment,
NamespaceStatement(namespace,NamespaceName,CallLiteral(CallTag,ParenthesizedContent)),
NamespaceStatement(namespace,NamespaceName,StringLiteral))
# Keyframes statements
@keyframes important1 {
from { margin-top: 50px; }
50%, 60% { margin-top: 150px !important; } /* ignored */
to { margin-top: 100px; }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(NumberLiteral(Unit)),KeyframeSelector(NumberLiteral(Unit)),Block(
Declaration(PropertyName,NumberLiteral(Unit),Important)),
Comment,
KeyframeSelector(KeyframeRangeName),Block(Declaration(PropertyName,NumberLiteral(Unit))))))
# Keyframes statements with range
@keyframes anim-1 {
entry 0% { margin-top: 50px; }
entry 100% { margin-top: 50px; }
exit 0% { margin-top: 50px; }
exit 100% { margin-top: 50px; }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(Declaration(PropertyName,NumberLiteral(Unit))))))
# Keyframes statements with range and multiple keyframe selectors
@keyframes fade-in-out-animation {
entry 0%, exit 100% { opacity: 0 }
entry 100%, exit 0% { opacity: 1 }
}
==>
StyleSheet(KeyframesStatement(keyframes,KeyframeName,KeyframeList(
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(
Declaration(PropertyName,NumberLiteral)),
KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),KeyframeSelector(KeyframeRangeName,NumberLiteral(Unit)),Block(
Declaration(PropertyName,NumberLiteral)))))
# Media statements
@media screen and (min-width: 30em) and (orientation: landscape) {}
@media (min-height: 680px), screen and (orientation: portrait) {}
@media not all and (monochrome) {}
@media only screen {}
@media (10em <= width < 30em) {}
==>
StyleSheet(
MediaStatement(media,BinaryQuery(BinaryQuery(KeywordQuery,LogicOp,FeatureQuery(FeatureName,NumberLiteral(Unit))),LogicOp,
FeatureQuery(FeatureName,ValueName)),Block),
MediaStatement(media,FeatureQuery(FeatureName,NumberLiteral(Unit)),BinaryQuery(KeywordQuery,LogicOp,FeatureQuery(FeatureName,ValueName)),Block),
MediaStatement(media,UnaryQuery(UnaryQueryOp,BinaryQuery(KeywordQuery,LogicOp,ParenthesizedQuery(KeywordQuery))),Block),
MediaStatement(media,UnaryQuery(UnaryQueryOp,KeywordQuery),Block),
MediaStatement(media,ComparisonQuery(NumberLiteral(Unit),CompareOp,FeatureName,CompareOp,NumberLiteral(Unit)),Block))
# Supports statements
@supports (animation-name: test) {
div { animation-name: test; }
}
@supports (transform-style: preserve) or (-moz-transform-style: preserve) {}
@supports not ((text-align-last: justify) or (-moz-text-align-last: justify)) {}
@supports not selector(:matches(a, b)) {}
==>
StyleSheet(
SupportsStatement(supports,FeatureQuery(FeatureName,ValueName),Block(RuleSet(TagSelector(TagName),Block(Declaration(PropertyName,ValueName))))),
SupportsStatement(supports,BinaryQuery(FeatureQuery(FeatureName,ValueName),LogicOp,FeatureQuery(FeatureName,ValueName)),Block),
SupportsStatement(supports,UnaryQuery(UnaryQueryOp,ParenthesizedQuery(
BinaryQuery(FeatureQuery(FeatureName,ValueName),LogicOp,FeatureQuery(FeatureName,ValueName)))),Block),
SupportsStatement(supports,UnaryQuery(UnaryQueryOp,SelectorQuery(selector,ParenthesizedSelector(PseudoClassSelector(PseudoClassName,ArgList(TagSelector(TagName),TagSelector(TagName)))))),Block))
# Charset statements
@charset "utf-8";
==>
StyleSheet(CharsetStatement(charset,StringLiteral))
# Other at-statements
@font-face {
font-family: "Open Sans";
src: url("/a") format("woff2"), url("/b/c") format("woff");
}
==>
StyleSheet(AtRule(AtKeyword,Block(
Declaration(PropertyName,StringLiteral),
Declaration(PropertyName,CallLiteral(CallTag,StringLiteral),CallExpression(Callee,ArgList(StringLiteral)),
CallLiteral(CallTag,StringLiteral),CallExpression(Callee,ArgList(StringLiteral))))))
# Unterminated Comment
p {}
/*
div {}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block),Comment)
# Escaped identifiers
#foo\ bar {
--weird\\var: 5px;
width: var(--weird\\var);
c\6f lor: b\6c ue;
}
==>
StyleSheet(RuleSet(IdSelector(IdName),Block(
Declaration(VariableName,NumberLiteral(Unit)),
Declaration(PropertyName,CallExpression(Callee,ArgList(VariableName))),
Declaration(PropertyName, ValueName))))
# Scope
@scope { .x {} }
@scope (div) {}
@scope (.a) to (.b) {}
==>
StyleSheet(
ScopeStatement(scope,Block(RuleSet(ClassSelector(ClassName),Block))),
ScopeStatement(scope,ParenthesizedSelector(TagSelector(TagName)),Block),
ScopeStatement(scope,ParenthesizedSelector(ClassSelector(ClassName)),to,ParenthesizedSelector(ClassSelector(ClassName)),Block))
# If Expressions
p {
background-color: if(
style(--color: white): black;
supports(foo: bar): red;
else: pink
);
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
Declaration(PropertyName,IfExpression(if,ArgList(
IfBranch(CallQuery(QueryCallee,ArgList(FeatureName,ValueName)),ValueName),
IfBranch(CallQuery(QueryCallee,ArgList(FeatureName,ValueName)),ValueName),
IfBranch(KeywordQuery,ValueName)))))))

16
frontend/node_modules/@lezer/css/test/test-css.js generated vendored Normal file
View File

@ -0,0 +1,16 @@
import {parser} from "../dist/index.js"
import {fileTests} from "@lezer/generator/dist/test"
import * as fs from "fs"
import * as path from "path"
import {fileURLToPath} from "url"
let caseDir = path.dirname(fileURLToPath(import.meta.url))
for (let file of fs.readdirSync(caseDir)) {
if (!/\.txt$/.test(file)) continue
let name = /^[^\.]*/.exec(file)[0]
describe(name, () => {
for (let {name, run} of fileTests(fs.readFileSync(path.join(caseDir, file), "utf8"), file))
it(name, () => run(parser))
})
}