Skip to content

Commit 3cc3204

Browse files
authored
fix(macros/CSS_Ref): fix special cases (#10241)
Fix special cases in CSS_Ref macro
1 parent 65badf3 commit 3cc3204

File tree

1 file changed

+65
-12
lines changed

1 file changed

+65
-12
lines changed

Diff for: kumascript/macros/CSS_Ref.ejs

+65-12
Original file line numberDiff line numberDiff line change
@@ -394,22 +394,26 @@ for (let i in characters) {
394394
let item = index[characters[i]][j];
395395
396396
switch (item.label) {
397+
// Add alternate name for pseudo-elements (one colon)
397398
case "::after":
398399
case "::before":
399400
case "::first-letter":
400401
case "::first-line":
401402
item.label += ` (${item.label.replace(/^:/, "")})`;
402403
break;
403404
405+
// Font-feature-values
404406
case "@annotation":
405407
case "@character-variant":
408+
case "@historical-forms":
406409
case "@ornaments":
407410
case "@styleset":
408411
case "@stylistic":
409412
case "@swash":
410413
item.urlPath = `@font-feature-values#${item.label}`;
411414
break;
412415
416+
// Font-variant-alternates
413417
case "annotation()":
414418
case "character-variant()":
415419
case "ornaments()":
@@ -419,18 +423,17 @@ for (let i in characters) {
419423
item.urlPath = `font-variant-alternates#${item.label}`;
420424
break;
421425
422-
case "format()":
423-
item.urlPath = "@font-face/src#format()";
424-
break;
425426
427+
// Image
426428
case "image()":
427429
item.urlPath = "image#The_image()_functional_notation";
428430
break;
429-
430-
case "url()":
431-
item.urlPath = "url#The_url()_functional_notation";
431+
case "image-set()":
432+
case "paint()":
433+
item.urlPath = `image/${item.label.replace("()", "")}`;
432434
break;
433435
436+
// Filter
434437
case "blur()":
435438
case "brightness()":
436439
case "contrast()":
@@ -444,6 +447,7 @@ for (let i in characters) {
444447
item.urlPath = `filter-function/${item.label.replace("()", "")}`;
445448
break;
446449
450+
// Transforms
447451
case "matrix()":
448452
case "matrix3d()":
449453
case "perspective()":
@@ -468,24 +472,46 @@ for (let i in characters) {
468472
item.urlPath = `transform-function/${item.label.replace("()", "")}`;
469473
break;
470474
475+
// Colors
476+
case "rgba()": // Still valid but alternative name for rgb()
477+
item.urlPath = "color_value/rgb";
478+
break;
479+
case "hsla()": // Still valid but alternative name for hsl()
480+
item.urlPath = "color_value/hsl";
481+
break;
471482
case "rgb()":
472-
case "rgba()":
473483
case "hsl()":
474-
case "hsla()":
475-
item.urlPath = `color_value#${item.label}`;
484+
case "hwb()":
485+
case "lab()":
486+
case "lch()":
487+
case "light-dark()":
488+
case "oklab()":
489+
case "oklch()":
490+
item.urlPath = `color_value/${item.label.replace("()", "")}`;
491+
break;
492+
493+
// Gradients
494+
case "conic-gradient()":
495+
case "linear-gradient()":
496+
case "radial-gradient()":
497+
case "repeating-conic-gradient()":
498+
case "repeating-linear-gradient()":
499+
case "repeating-radial-gradient()":
500+
item.urlPath = `gradient/${item.label.replace("()", "")}`;
476501
break;
477502
503+
// Shapes
478504
case "inset()":
479505
case "polygon()":
480506
case "circle()":
481507
case "ellipse()":
482508
item.urlPath = `basic-shape#${item.label}`;
483509
break;
484-
485510
case "rect()":
486511
item.urlPath = `shape#${item.label}`;
487512
break;
488513
514+
// @page
489515
case "@top-left-corner":
490516
case "@top-left":
491517
case "@top-center":
@@ -505,10 +531,37 @@ for (let i in characters) {
505531
item.urlPath = "@page#page-margin-box-type";
506532
break;
507533
534+
// Easing functions
508535
case "cubic-bezier()":
509-
case "frames()":
536+
item.urlPath = "easing-function#cubic_bézier_easing_function";
537+
break;
538+
case "linear()":
539+
item.urlPath = "easing-function#linear_easing_function";
540+
break;
510541
case "steps()":
511-
item.urlPath = `single-transition-timing-function#${item.label}`;
542+
item.urlPath = `easing-function#steps_easing_function`;
543+
break;
544+
545+
// Alternate name
546+
case "word-wrap":
547+
item.urlPath = "overflow-wrap";
548+
break;
549+
case "line-clamp": // Nobody implements it under this name
550+
item.urlPath = "-webkit-line-clamp"
551+
break;
552+
553+
// Misc
554+
case "view()":
555+
item.urlPath = "animation-timeline/view";
556+
break;
557+
case ":host()":
558+
item.urlPath = ":host_function"
559+
break;
560+
case "format()":
561+
item.urlPath = "@font-face/src#format()";
562+
break;
563+
case "url()":
564+
item.urlPath = "url#The_url()_functional_notation";
512565
break;
513566
}
514567
}

0 commit comments

Comments
 (0)