@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
|
@@ -593,6 +593,14 @@ var ButtonContainer = /*#__PURE__*/styled__default.button.withConfig({
|
|
|
593
593
|
componentId: "sc-obzd3o-0"
|
|
594
594
|
})(["height:45px;font-size:", ";"], uiFonts.size.small);
|
|
595
595
|
|
|
596
|
+
var toUppercaseHexColor = function toUppercaseHexColor(color) {
|
|
597
|
+
if (!color) return undefined;
|
|
598
|
+
// Check if it's a valid hex color
|
|
599
|
+
var hexRegex = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
|
|
600
|
+
if (!hexRegex.test(color)) return color;
|
|
601
|
+
return color.toUpperCase();
|
|
602
|
+
};
|
|
603
|
+
|
|
596
604
|
var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
597
605
|
var _atlasJSON$frames, _atlasJSON$frames2;
|
|
598
606
|
var atlasJSON = _ref.atlasJSON,
|
|
@@ -622,6 +630,9 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
622
630
|
console.error("SpriteFromAtlas: Could not find sprite with key " + spriteKey + " in atlasJSON.");
|
|
623
631
|
return null;
|
|
624
632
|
}
|
|
633
|
+
var normalizedTintColor = toUppercaseHexColor(tintColor);
|
|
634
|
+
// For white tint, we'll use a very light gray instead
|
|
635
|
+
var effectiveTintColor = normalizedTintColor === '#FFFFFF' ? '#EEEEEE' : normalizedTintColor;
|
|
625
636
|
return React__default.createElement(Container$1, {
|
|
626
637
|
width: width,
|
|
627
638
|
height: height,
|
|
@@ -638,7 +649,7 @@ var SpriteFromAtlas = function SpriteFromAtlas(_ref) {
|
|
|
638
649
|
style: imgStyle,
|
|
639
650
|
centered: centered,
|
|
640
651
|
borderRadius: borderRadius,
|
|
641
|
-
tintColor:
|
|
652
|
+
tintColor: effectiveTintColor
|
|
642
653
|
}));
|
|
643
654
|
};
|
|
644
655
|
var Container$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
@@ -654,7 +665,7 @@ var Container$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
654
665
|
var ImgSprite = /*#__PURE__*/styled__default.div.withConfig({
|
|
655
666
|
displayName: "SpriteFromAtlas__ImgSprite",
|
|
656
667
|
componentId: "sc-1lpani8-1"
|
|
657
|
-
})(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";
|
|
668
|
+
})(["width:", "px;height:", "px;background-image:url(", ");background-position:-", "px -", "px;transform:scale(", ");position:relative;top:", ";left:", ";opacity:", ";border-radius:", ";overflow:hidden;", " ", ""], function (props) {
|
|
658
669
|
return props.frame.w;
|
|
659
670
|
}, function (props) {
|
|
660
671
|
return props.frame.h;
|
|
@@ -670,15 +681,14 @@ var ImgSprite = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
670
681
|
return props.centered ? '0' : '8px';
|
|
671
682
|
}, function (props) {
|
|
672
683
|
return props.centered ? '0' : '8px';
|
|
673
|
-
}, function (props) {
|
|
674
|
-
var filters = [];
|
|
675
|
-
if (props.grayScale) filters.push('grayscale(100%)');
|
|
676
|
-
if (props.tintColor) filters.push("brightness(0.8) contrast(1.2) sepia(100%) hue-rotate(" + (props.tintColor === '#FFD700' ? '40deg' : '210deg') + ") saturate(400%)");
|
|
677
|
-
return filters.length ? filters.join(' ') : 'none';
|
|
678
684
|
}, function (props) {
|
|
679
685
|
return props.opacity;
|
|
680
686
|
}, function (props) {
|
|
681
687
|
return props.borderRadius || '0';
|
|
688
|
+
}, function (props) {
|
|
689
|
+
return props.grayScale && styled.css(["filter:grayscale(100%);"]);
|
|
690
|
+
}, function (props) {
|
|
691
|
+
return props.tintColor && styled.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);
|
|
682
692
|
});
|
|
683
693
|
|
|
684
694
|
var frames = {
|