@rpg-engine/long-bow 0.8.12 → 0.8.14
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/dist/long-bow.cjs.development.js +17 -7
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +17 -7
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/utils/colorUtils.d.ts +1 -0
- package/package.json +1 -1
- package/src/components/shared/SpriteFromAtlas.tsx +56 -14
- package/src/mocks/itemContainer.mocks.ts +46 -38
- package/src/utils/colorUtils.ts +11 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -585,6 +585,14 @@ var ButtonContainer = /*#__PURE__*/styled.button.withConfig({
|
|
|
585
585
|
componentId: "sc-obzd3o-0"
|
|
586
586
|
})(["height:45px;font-size:", ";"], uiFonts.size.small);
|
|
587
587
|
|
|
588
|
+
var toUppercaseHexColor = function toUppercaseHexColor(color) {
|
|
589
|
+
if (!color) return undefined;
|
|
590
|
+
// Check if it's a valid hex color
|
|
591
|
+
var hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
592
|
+
if (!hexRegex.test(color)) return color;
|
|
593
|
+
return color.toUpperCase();
|
|
594
|
+
};
|
|
595
|
+
|
|
588
596
|
var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
589
597
|
var _atlasJSON$frames, _atlasJSON$frames2;
|
|
590
598
|
var atlasJSON = _ref.atlasJSON,
|
|
@@ -614,6 +622,9 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
614
622
|
console.error("SpriteFromAtlas: Could not find sprite with key " + spriteKey + " in atlasJSON.");
|
|
615
623
|
return null;
|
|
616
624
|
}
|
|
625
|
+
var normalizedTintColor = toUppercaseHexColor(tintColor);
|
|
626
|
+
// For white tint, we'll use a very light gray instead
|
|
627
|
+
var effectiveTintColor = normalizedTintColor === '#FFFFFF' ? '#EEEEEE' : normalizedTintColor;
|
|
617
628
|
return React.createElement(Container$1, {
|
|
618
629
|
width: width,
|
|
619
630
|
height: height,
|
|
@@ -630,7 +641,7 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
630
641
|
style: imgStyle,
|
|
631
642
|
centered: centered,
|
|
632
643
|
borderRadius: borderRadius,
|
|
633
|
-
tintColor:
|
|
644
|
+
tintColor: effectiveTintColor
|
|
634
645
|
}));
|
|
635
646
|
};
|
|
636
647
|
var Container$1 = /*#__PURE__*/styled.div.withConfig({
|
|
@@ -646,7 +657,7 @@ var Container$1 = /*#__PURE__*/styled.div.withConfig({
|
|
|
646
657
|
var ImgSprite = /*#__PURE__*/styled.div.withConfig({
|
|
647
658
|
displayName: "SpriteFromAtlas__ImgSprite",
|
|
648
659
|
componentId: "sc-1lpani8-1"
|
|
649
|
-
})(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";
|
|
660
|
+
})(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";opacity:", ";border-radius:", ";overflow:hidden;", " ", ""], function (props) {
|
|
650
661
|
return props.frame.w;
|
|
651
662
|
}, function (props) {
|
|
652
663
|
return props.frame.h;
|
|
@@ -662,15 +673,14 @@ var ImgSprite = /*#__PURE__*/styled.div.withConfig({
|
|
|
662
673
|
return props.centered ? '0' : '8px';
|
|
663
674
|
}, function (props) {
|
|
664
675
|
return props.centered ? '0' : '8px';
|
|
665
|
-
}, function (props) {
|
|
666
|
-
var filters = [];
|
|
667
|
-
if (props.grayScale) filters.push('grayscale(100%)');
|
|
668
|
-
if (props.tintColor) filters.push("brightness(0.8) contrast(1.2) sepia(100%) hue-rotate(" + (props.tintColor === '#FFD700' ? '40deg' : '210deg') + ") saturate(400%)");
|
|
669
|
-
return filters.length ? filters.join(' ') : 'none';
|
|
670
676
|
}, function (props) {
|
|
671
677
|
return props.opacity;
|
|
672
678
|
}, function (props) {
|
|
673
679
|
return props.borderRadius || '0';
|
|
680
|
+
}, function (props) {
|
|
681
|
+
return props.grayScale && css(["filter:grayscale(100%);"]);
|
|
682
|
+
}, function (props) {
|
|
683
|
+
return props.tintColor && css(["&::before{content:'';position:absolute;top:0;left:0;width:", "px;height:", "px;background-color:", ";mix-blend-mode:multiply;opacity:0.6;pointer-events:none;-webkit-mask-image:url(", ");-webkit-mask-position:-", "px -", "px;mask-image:url(", ");mask-position:-", "px -", "px;}&::after{content:'';position:absolute;top:0;left:0;width:", "px;height:", "px;background-color:", ";mix-blend-mode:soft-light;opacity:0.6;pointer-events:none;-webkit-mask-image:url(", ");-webkit-mask-position:-", "px -", "px;mask-image:url(", ");mask-position:-", "px -", "px;}"], props.frame.w, props.frame.h, props.tintColor, props.atlasIMG, props.frame.x, props.frame.y, props.atlasIMG, props.frame.x, props.frame.y, props.frame.w, props.frame.h, props.tintColor, props.atlasIMG, props.frame.x, props.frame.y, props.atlasIMG, props.frame.x, props.frame.y);
|
|
674
684
|
});
|
|
675
685
|
|
|
676
686
|
var frames = {
|