ntk 8.26.0 → 8.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/widgets/svgview.js +20 -0
- package/package.json +1 -1
package/lib/widgets/svgview.js
CHANGED
|
@@ -622,6 +622,14 @@ function resolveStyle(node, parent) {
|
|
|
622
622
|
value = urlReference(v);
|
|
623
623
|
if (value === '') value = 'none';
|
|
624
624
|
break;
|
|
625
|
+
case 'fill':
|
|
626
|
+
case 'stroke':
|
|
627
|
+
value = paintValue(v);
|
|
628
|
+
break;
|
|
629
|
+
case 'color':
|
|
630
|
+
// `currentColor` as a colour is the parent's (CSS Color 4, 6.4)
|
|
631
|
+
if (v.toLowerCase() !== 'currentcolor') value = v;
|
|
632
|
+
break;
|
|
625
633
|
default:
|
|
626
634
|
value = v;
|
|
627
635
|
}
|
|
@@ -633,6 +641,18 @@ function resolveStyle(node, parent) {
|
|
|
633
641
|
return style;
|
|
634
642
|
}
|
|
635
643
|
|
|
644
|
+
/**
|
|
645
|
+
* A fill or a stroke as `_paint` and the paint scan read it: `currentColor`
|
|
646
|
+
* and `none` are keywords, which CSS reads in any case (CSS Values 4, 2.5),
|
|
647
|
+
* and anything else is as written. `currentcolor`, as CSS Color 4 writes it
|
|
648
|
+
* and as Apple's pages do, reached the context as a colour nobody knows and
|
|
649
|
+
* painted nothing.
|
|
650
|
+
*/
|
|
651
|
+
function paintValue(value) {
|
|
652
|
+
const k = value.toLowerCase();
|
|
653
|
+
return k === 'currentcolor' ? 'currentColor' : k === 'none' ? 'none' : value;
|
|
654
|
+
}
|
|
655
|
+
|
|
636
656
|
/**
|
|
637
657
|
* A length in a dash pattern or its offset, in user units: a number, or one
|
|
638
658
|
* in `px` (SVG 2, 13.5.6). A percentage of the viewport's diagonal, or a
|