@mjhls/mjh-framework 1.0.51 → 1.0.52
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/README.md +170 -170
- package/dist/index.es.js +917 -2071
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +916 -2070
- package/dist/index.js.map +1 -1
- package/package.json +79 -79
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, { Component, useState,
|
|
1
|
+
import React__default, { Component, useState, createElement, createContext } from 'react';
|
|
2
2
|
import Row from 'react-bootstrap/Row';
|
|
3
3
|
import Col from 'react-bootstrap/Col';
|
|
4
4
|
import Card from 'react-bootstrap/Card';
|
|
@@ -496,1523 +496,879 @@ var getYoutubeId = createCommonjsModule(function (module, exports) {
|
|
|
496
496
|
}));
|
|
497
497
|
});
|
|
498
498
|
|
|
499
|
-
var
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
function defineProperties(target, props) {
|
|
507
|
-
for (var i = 0; i < props.length; i++) {
|
|
508
|
-
var descriptor = props[i];
|
|
509
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
510
|
-
descriptor.configurable = true;
|
|
511
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
512
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
499
|
+
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
500
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
501
|
+
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
502
|
+
function parseAssetId(ref) {
|
|
503
|
+
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
504
|
+
if (!id || !dimensionString || !format) {
|
|
505
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
513
506
|
}
|
|
514
|
-
|
|
507
|
+
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
508
|
+
var width = +imgWidthStr;
|
|
509
|
+
var height = +imgHeightStr;
|
|
510
|
+
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
511
|
+
if (!isValidAssetId) {
|
|
512
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
513
|
+
}
|
|
514
|
+
return { id: id, width: width, height: height, format: format };
|
|
515
|
+
}
|
|
516
|
+
exports.default = parseAssetId;
|
|
515
517
|
|
|
516
|
-
|
|
517
|
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
518
|
-
if (staticProps) defineProperties(Constructor, staticProps);
|
|
519
|
-
return Constructor;
|
|
520
|
-
};
|
|
521
|
-
}();
|
|
518
|
+
});
|
|
522
519
|
|
|
523
|
-
|
|
524
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
525
|
-
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
526
|
-
}
|
|
520
|
+
unwrapExports(parseAssetId_1);
|
|
527
521
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
522
|
+
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
523
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
524
|
+
__assign = Object.assign || function(t) {
|
|
525
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
526
|
+
s = arguments[i];
|
|
527
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
528
|
+
t[p] = s[p];
|
|
529
|
+
}
|
|
530
|
+
return t;
|
|
531
|
+
};
|
|
532
|
+
return __assign.apply(this, arguments);
|
|
537
533
|
};
|
|
538
|
-
|
|
539
|
-
var
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
534
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
535
|
+
var isRef = function (src) {
|
|
536
|
+
var source = src;
|
|
537
|
+
return source ? typeof source._ref === 'string' : false;
|
|
545
538
|
};
|
|
546
|
-
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
var
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
}
|
|
560
|
-
} catch (err) {
|
|
561
|
-
_d = true;
|
|
562
|
-
_e = err;
|
|
563
|
-
} finally {
|
|
564
|
-
try {
|
|
565
|
-
if (!_n && _i["return"]) _i["return"]();
|
|
566
|
-
} finally {
|
|
567
|
-
if (_d) throw _e;
|
|
568
|
-
}
|
|
539
|
+
var isAsset = function (src) {
|
|
540
|
+
var source = src;
|
|
541
|
+
return source ? typeof source._id === 'string' : false;
|
|
542
|
+
};
|
|
543
|
+
var isAssetStub = function (src) {
|
|
544
|
+
var source = src;
|
|
545
|
+
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
546
|
+
};
|
|
547
|
+
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
548
|
+
// eslint-disable-next-line complexity
|
|
549
|
+
function parseSource(source) {
|
|
550
|
+
if (!source) {
|
|
551
|
+
return null;
|
|
569
552
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
return arr;
|
|
577
|
-
} else if (Symbol.iterator in Object(arr)) {
|
|
578
|
-
return sliceIterator(arr, i);
|
|
579
|
-
} else {
|
|
580
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
553
|
+
var image;
|
|
554
|
+
if (typeof source === 'string' && isUrl(source)) {
|
|
555
|
+
// Someone passed an existing image url?
|
|
556
|
+
image = {
|
|
557
|
+
asset: { _ref: urlToId(source) }
|
|
558
|
+
};
|
|
581
559
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
588
|
-
|
|
589
|
-
return arr2;
|
|
590
|
-
} else {
|
|
591
|
-
return Array.from(arr);
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
|
|
595
|
-
var DeckContent = function (_React$Component) {
|
|
596
|
-
inherits(DeckContent, _React$Component);
|
|
597
|
-
|
|
598
|
-
function DeckContent() {
|
|
599
|
-
var _ref;
|
|
600
|
-
|
|
601
|
-
var _temp, _this, _ret;
|
|
602
|
-
|
|
603
|
-
classCallCheck(this, DeckContent);
|
|
604
|
-
|
|
605
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
606
|
-
args[_key] = arguments[_key];
|
|
560
|
+
else if (typeof source === 'string') {
|
|
561
|
+
// Just an asset id
|
|
562
|
+
image = {
|
|
563
|
+
asset: { _ref: source }
|
|
564
|
+
};
|
|
607
565
|
}
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
}, _this.loadMore = function () {
|
|
620
|
-
setTimeout(function () {
|
|
621
|
-
_this.setState(function (state) {
|
|
622
|
-
return {
|
|
623
|
-
page: state.page + 1,
|
|
624
|
-
from: state.from + state.per,
|
|
625
|
-
to: state.to + state.per
|
|
626
|
-
};
|
|
627
|
-
}, _this.loadData);
|
|
628
|
-
}, 10);
|
|
629
|
-
}, _this.loadData = function () {
|
|
630
|
-
var _this$state = _this.state,
|
|
631
|
-
from = _this$state.from,
|
|
632
|
-
to = _this$state.to,
|
|
633
|
-
data = _this$state.data,
|
|
634
|
-
query = _this$state.query;
|
|
635
|
-
var client = _this.props.client;
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
var params = { from: from, to: to };
|
|
639
|
-
var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
|
|
640
|
-
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
641
|
-
|
|
642
|
-
if (_this.pointer && _this.pointerArray) {
|
|
643
|
-
var pointer = _this.pointer;
|
|
644
|
-
client.fetch(queryUpdated).then(function (dataArr) {
|
|
645
|
-
_this.setState(function (state, props) {
|
|
646
|
-
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
647
|
-
return {
|
|
648
|
-
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
|
|
649
|
-
scrolling: true
|
|
650
|
-
};
|
|
651
|
-
} else {
|
|
652
|
-
return {
|
|
653
|
-
scrolling: false
|
|
654
|
-
};
|
|
566
|
+
else if (isRef(source)) {
|
|
567
|
+
// We just got passed an asset directly
|
|
568
|
+
image = {
|
|
569
|
+
asset: source
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
else if (isAsset(source)) {
|
|
573
|
+
// If we were passed an image asset document
|
|
574
|
+
image = {
|
|
575
|
+
asset: {
|
|
576
|
+
_ref: source._id || ''
|
|
655
577
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
|
|
664
|
-
scrolling: true
|
|
665
|
-
};
|
|
666
|
-
} else {
|
|
667
|
-
return {
|
|
668
|
-
scrolling: false
|
|
669
|
-
};
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
else if (isAssetStub(source)) {
|
|
581
|
+
// If we were passed a partial asset (`url`, but no `_id`)
|
|
582
|
+
image = {
|
|
583
|
+
asset: {
|
|
584
|
+
_ref: urlToId(source.asset.url)
|
|
670
585
|
}
|
|
671
|
-
|
|
672
|
-
});
|
|
673
|
-
}
|
|
674
|
-
}, _this.renderCardImage = function (row, page) {
|
|
675
|
-
if (row.thumbnail && row.thumbnail.asset) {
|
|
676
|
-
return row.thumbnail.asset.url;
|
|
677
|
-
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
678
|
-
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
679
|
-
} else {
|
|
680
|
-
return _this.defaultImage;
|
|
681
|
-
}
|
|
682
|
-
}, _this.cardLoader = function (page, columns, variant) {
|
|
683
|
-
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
684
|
-
|
|
685
|
-
var itemCounter = 0;
|
|
686
|
-
var lgVar = 12;
|
|
687
|
-
return React__default.createElement(
|
|
688
|
-
Row,
|
|
689
|
-
null,
|
|
690
|
-
_this.state.data && _this.state.data.map(function (row, index) {
|
|
691
|
-
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
692
|
-
lgVar = 12;
|
|
693
|
-
} else if (columns && columns !== 'rotate') {
|
|
694
|
-
lgVar = Math.floor(12 / columns);
|
|
695
|
-
} else {
|
|
696
|
-
lgVar = 6;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
return React__default.createElement(
|
|
700
|
-
Col,
|
|
701
|
-
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
702
|
-
React__default.createElement(
|
|
703
|
-
Card,
|
|
704
|
-
{ className: 'content-card', style: { flexDirection: mode } },
|
|
705
|
-
React__default.createElement(
|
|
706
|
-
Link,
|
|
707
|
-
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
708
|
-
React__default.createElement(
|
|
709
|
-
'a',
|
|
710
|
-
null,
|
|
711
|
-
React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
|
|
712
|
-
)
|
|
713
|
-
),
|
|
714
|
-
React__default.createElement(
|
|
715
|
-
Card.Body,
|
|
716
|
-
null,
|
|
717
|
-
React__default.createElement(
|
|
718
|
-
Link,
|
|
719
|
-
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
720
|
-
React__default.createElement(
|
|
721
|
-
'a',
|
|
722
|
-
null,
|
|
723
|
-
React__default.createElement(
|
|
724
|
-
Card.Title,
|
|
725
|
-
null,
|
|
726
|
-
row.title
|
|
727
|
-
),
|
|
728
|
-
React__default.createElement(
|
|
729
|
-
Card.Text,
|
|
730
|
-
null,
|
|
731
|
-
row.summary
|
|
732
|
-
)
|
|
733
|
-
)
|
|
734
|
-
)
|
|
735
|
-
)
|
|
736
|
-
)
|
|
737
|
-
);
|
|
738
|
-
})
|
|
739
|
-
);
|
|
740
|
-
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
createClass(DeckContent, [{
|
|
744
|
-
key: 'componentDidUpdate',
|
|
745
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
746
|
-
if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
|
|
747
|
-
// eslint-disable-next-line react/no-did-update-set-state
|
|
748
|
-
this.setState({
|
|
749
|
-
data: this.props.dataRecord,
|
|
750
|
-
dataKeptToCompareNewDatarecord: this.props.dataRecord,
|
|
751
|
-
per: this.props.params ? this.props.params.to : 2,
|
|
752
|
-
page: 1,
|
|
753
|
-
from: this.props.params ? this.props.params.from : 0,
|
|
754
|
-
to: this.props.params ? this.props.params.to : 2,
|
|
755
|
-
total_pages: null,
|
|
756
|
-
scrolling: true,
|
|
757
|
-
query: this.props.query
|
|
758
|
-
});
|
|
759
|
-
}
|
|
586
|
+
};
|
|
760
587
|
}
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
// this.loadData();
|
|
588
|
+
else if (typeof source.asset === 'object') {
|
|
589
|
+
// Probably an actual image with materialized asset
|
|
590
|
+
image = source;
|
|
765
591
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
var _props = this.props,
|
|
772
|
-
columns = _props.columns,
|
|
773
|
-
variant = _props.variant,
|
|
774
|
-
autoScroll = _props.autoScroll,
|
|
775
|
-
page = _props.page;
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
return React__default.createElement(
|
|
779
|
-
'div',
|
|
780
|
-
{ className: 'contentDeck' },
|
|
781
|
-
autoScroll ? React__default.createElement(
|
|
782
|
-
React__default.Fragment,
|
|
783
|
-
null,
|
|
784
|
-
React__default.createElement(
|
|
785
|
-
InfiniteScroll,
|
|
786
|
-
{ dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
|
|
787
|
-
this.cardLoader(page, columns, variant)
|
|
788
|
-
),
|
|
789
|
-
React__default.createElement(
|
|
790
|
-
'noscript',
|
|
791
|
-
null,
|
|
792
|
-
'Manual Pagination Here'
|
|
793
|
-
)
|
|
794
|
-
) : React__default.createElement(
|
|
795
|
-
React__default.Fragment,
|
|
796
|
-
null,
|
|
797
|
-
this.cardLoader(page, columns, variant),
|
|
798
|
-
React__default.createElement(
|
|
799
|
-
'div',
|
|
800
|
-
{ style: { padding: '0px 10px' } },
|
|
801
|
-
this.state.scrolling ? React__default.createElement(
|
|
802
|
-
'button',
|
|
803
|
-
{
|
|
804
|
-
style: { margin: 'auto', width: '100%' },
|
|
805
|
-
onClick: function onClick(e) {
|
|
806
|
-
_this2.loadMore();
|
|
807
|
-
} },
|
|
808
|
-
'Load More'
|
|
809
|
-
) : React__default.createElement(
|
|
810
|
-
'p',
|
|
811
|
-
{ style: { textAlign: 'center' } },
|
|
812
|
-
React__default.createElement(
|
|
813
|
-
'b',
|
|
814
|
-
null,
|
|
815
|
-
'End of data'
|
|
816
|
-
)
|
|
817
|
-
)
|
|
818
|
-
),
|
|
819
|
-
React__default.createElement(
|
|
820
|
-
'noscript',
|
|
821
|
-
null,
|
|
822
|
-
'Manual Pagination Here'
|
|
823
|
-
)
|
|
824
|
-
)
|
|
825
|
-
);
|
|
592
|
+
else {
|
|
593
|
+
// We got something that does not look like an image, or it is an image
|
|
594
|
+
// that currently isn't sporting an asset.
|
|
595
|
+
return null;
|
|
826
596
|
}
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Checks if `value` is classified as an `Array` object.
|
|
833
|
-
*
|
|
834
|
-
* @static
|
|
835
|
-
* @memberOf _
|
|
836
|
-
* @since 0.1.0
|
|
837
|
-
* @category Lang
|
|
838
|
-
* @param {*} value The value to check.
|
|
839
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
840
|
-
* @example
|
|
841
|
-
*
|
|
842
|
-
* _.isArray([1, 2, 3]);
|
|
843
|
-
* // => true
|
|
844
|
-
*
|
|
845
|
-
* _.isArray(document.body.children);
|
|
846
|
-
* // => false
|
|
847
|
-
*
|
|
848
|
-
* _.isArray('abc');
|
|
849
|
-
* // => false
|
|
850
|
-
*
|
|
851
|
-
* _.isArray(_.noop);
|
|
852
|
-
* // => false
|
|
853
|
-
*/
|
|
854
|
-
var isArray = Array.isArray;
|
|
855
|
-
|
|
856
|
-
var isArray_1 = isArray;
|
|
857
|
-
|
|
858
|
-
/** Detect free variable `global` from Node.js. */
|
|
859
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
860
|
-
|
|
861
|
-
var _freeGlobal = freeGlobal;
|
|
862
|
-
|
|
863
|
-
/** Detect free variable `self`. */
|
|
864
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
865
|
-
|
|
866
|
-
/** Used as a reference to the global object. */
|
|
867
|
-
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
868
|
-
|
|
869
|
-
var _root = root;
|
|
870
|
-
|
|
871
|
-
/** Built-in value references. */
|
|
872
|
-
var Symbol$1 = _root.Symbol;
|
|
873
|
-
|
|
874
|
-
var _Symbol = Symbol$1;
|
|
875
|
-
|
|
876
|
-
/** Used for built-in method references. */
|
|
877
|
-
var objectProto = Object.prototype;
|
|
878
|
-
|
|
879
|
-
/** Used to check objects for own properties. */
|
|
880
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
881
|
-
|
|
882
|
-
/**
|
|
883
|
-
* Used to resolve the
|
|
884
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
885
|
-
* of values.
|
|
886
|
-
*/
|
|
887
|
-
var nativeObjectToString = objectProto.toString;
|
|
888
|
-
|
|
889
|
-
/** Built-in value references. */
|
|
890
|
-
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
891
|
-
|
|
892
|
-
/**
|
|
893
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
894
|
-
*
|
|
895
|
-
* @private
|
|
896
|
-
* @param {*} value The value to query.
|
|
897
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
898
|
-
*/
|
|
899
|
-
function getRawTag(value) {
|
|
900
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
901
|
-
tag = value[symToStringTag];
|
|
902
|
-
|
|
903
|
-
try {
|
|
904
|
-
value[symToStringTag] = undefined;
|
|
905
|
-
} catch (e) {}
|
|
906
|
-
|
|
907
|
-
var result = nativeObjectToString.call(value);
|
|
908
|
-
{
|
|
909
|
-
if (isOwn) {
|
|
910
|
-
value[symToStringTag] = tag;
|
|
911
|
-
} else {
|
|
912
|
-
delete value[symToStringTag];
|
|
597
|
+
var img = source;
|
|
598
|
+
if (img.crop) {
|
|
599
|
+
image.crop = img.crop;
|
|
913
600
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
var _getRawTag = getRawTag;
|
|
919
|
-
|
|
920
|
-
/** Used for built-in method references. */
|
|
921
|
-
var objectProto$1 = Object.prototype;
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Used to resolve the
|
|
925
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
926
|
-
* of values.
|
|
927
|
-
*/
|
|
928
|
-
var nativeObjectToString$1 = objectProto$1.toString;
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
932
|
-
*
|
|
933
|
-
* @private
|
|
934
|
-
* @param {*} value The value to convert.
|
|
935
|
-
* @returns {string} Returns the converted string.
|
|
936
|
-
*/
|
|
937
|
-
function objectToString(value) {
|
|
938
|
-
return nativeObjectToString$1.call(value);
|
|
601
|
+
if (img.hotspot) {
|
|
602
|
+
image.hotspot = img.hotspot;
|
|
603
|
+
}
|
|
604
|
+
return applyDefaults(image);
|
|
939
605
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
/** `Object#toString` result references. */
|
|
944
|
-
var nullTag = '[object Null]',
|
|
945
|
-
undefinedTag = '[object Undefined]';
|
|
946
|
-
|
|
947
|
-
/** Built-in value references. */
|
|
948
|
-
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
949
|
-
|
|
950
|
-
/**
|
|
951
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
952
|
-
*
|
|
953
|
-
* @private
|
|
954
|
-
* @param {*} value The value to query.
|
|
955
|
-
* @returns {string} Returns the `toStringTag`.
|
|
956
|
-
*/
|
|
957
|
-
function baseGetTag(value) {
|
|
958
|
-
if (value == null) {
|
|
959
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
960
|
-
}
|
|
961
|
-
return (symToStringTag$1 && symToStringTag$1 in Object(value))
|
|
962
|
-
? _getRawTag(value)
|
|
963
|
-
: _objectToString(value);
|
|
606
|
+
exports.default = parseSource;
|
|
607
|
+
function isUrl(url) {
|
|
608
|
+
return /^https?:\/\//.test("" + url);
|
|
964
609
|
}
|
|
965
|
-
|
|
966
|
-
var
|
|
967
|
-
|
|
968
|
-
/**
|
|
969
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
970
|
-
* and has a `typeof` result of "object".
|
|
971
|
-
*
|
|
972
|
-
* @static
|
|
973
|
-
* @memberOf _
|
|
974
|
-
* @since 4.0.0
|
|
975
|
-
* @category Lang
|
|
976
|
-
* @param {*} value The value to check.
|
|
977
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
978
|
-
* @example
|
|
979
|
-
*
|
|
980
|
-
* _.isObjectLike({});
|
|
981
|
-
* // => true
|
|
982
|
-
*
|
|
983
|
-
* _.isObjectLike([1, 2, 3]);
|
|
984
|
-
* // => true
|
|
985
|
-
*
|
|
986
|
-
* _.isObjectLike(_.noop);
|
|
987
|
-
* // => false
|
|
988
|
-
*
|
|
989
|
-
* _.isObjectLike(null);
|
|
990
|
-
* // => false
|
|
991
|
-
*/
|
|
992
|
-
function isObjectLike(value) {
|
|
993
|
-
return value != null && typeof value == 'object';
|
|
610
|
+
function urlToId(url) {
|
|
611
|
+
var parts = url.split('/').slice(-1);
|
|
612
|
+
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
994
613
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
return typeof value == 'symbol' ||
|
|
1020
|
-
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
614
|
+
// Mock crop and hotspot if image lacks it
|
|
615
|
+
function applyDefaults(image) {
|
|
616
|
+
if (image.crop && image.hotspot) {
|
|
617
|
+
return image;
|
|
618
|
+
}
|
|
619
|
+
// We need to pad in default values for crop or hotspot
|
|
620
|
+
var result = __assign({}, image);
|
|
621
|
+
if (!result.crop) {
|
|
622
|
+
result.crop = {
|
|
623
|
+
left: 0,
|
|
624
|
+
top: 0,
|
|
625
|
+
bottom: 0,
|
|
626
|
+
right: 0
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
if (!result.hotspot) {
|
|
630
|
+
result.hotspot = {
|
|
631
|
+
x: 0.5,
|
|
632
|
+
y: 0.5,
|
|
633
|
+
height: 1.0,
|
|
634
|
+
width: 1.0
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
return result;
|
|
1021
638
|
}
|
|
1022
639
|
|
|
1023
|
-
|
|
640
|
+
});
|
|
1024
641
|
|
|
1025
|
-
|
|
1026
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1027
|
-
reIsPlainProp = /^\w*$/;
|
|
642
|
+
unwrapExports(parseSource_1);
|
|
1028
643
|
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
644
|
+
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
645
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
646
|
+
__assign = Object.assign || function(t) {
|
|
647
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
648
|
+
s = arguments[i];
|
|
649
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
650
|
+
t[p] = s[p];
|
|
651
|
+
}
|
|
652
|
+
return t;
|
|
653
|
+
};
|
|
654
|
+
return __assign.apply(this, arguments);
|
|
655
|
+
};
|
|
656
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
657
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
658
|
+
};
|
|
659
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
660
|
+
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
661
|
+
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
662
|
+
exports.parseSource = parseSource_1$$1.default;
|
|
663
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
664
|
+
['width', 'w'],
|
|
665
|
+
['height', 'h'],
|
|
666
|
+
['format', 'fm'],
|
|
667
|
+
['download', 'dl'],
|
|
668
|
+
['blur', 'blur'],
|
|
669
|
+
['sharpen', 'sharp'],
|
|
670
|
+
['invert', 'invert'],
|
|
671
|
+
['orientation', 'or'],
|
|
672
|
+
['minHeight', 'min-h'],
|
|
673
|
+
['maxHeight', 'max-h'],
|
|
674
|
+
['minWidth', 'min-w'],
|
|
675
|
+
['maxWidth', 'max-w'],
|
|
676
|
+
['quality', 'q'],
|
|
677
|
+
['fit', 'fit'],
|
|
678
|
+
['crop', 'crop'],
|
|
679
|
+
['auto', 'auto'],
|
|
680
|
+
['dpr', 'dpr']
|
|
681
|
+
];
|
|
682
|
+
function urlForImage(options) {
|
|
683
|
+
var spec = __assign({}, (options || {}));
|
|
684
|
+
var source = spec.source;
|
|
685
|
+
delete spec.source;
|
|
686
|
+
var image = parseSource_1$$1.default(source);
|
|
687
|
+
if (!image) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
var id = image.asset._ref || image.asset._id || '';
|
|
691
|
+
var asset = parseAssetId_1$$1.default(id);
|
|
692
|
+
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
693
|
+
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
694
|
+
var cropTop = Math.round(image.crop.top * asset.height);
|
|
695
|
+
var crop = {
|
|
696
|
+
left: cropLeft,
|
|
697
|
+
top: cropTop,
|
|
698
|
+
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
699
|
+
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
700
|
+
};
|
|
701
|
+
// Compute hot spot rect in terms of pixel coordinates
|
|
702
|
+
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
703
|
+
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
704
|
+
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
705
|
+
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
706
|
+
var hotspot = {
|
|
707
|
+
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
708
|
+
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
709
|
+
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
710
|
+
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
711
|
+
};
|
|
712
|
+
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
713
|
+
// the crop/hotspot.
|
|
714
|
+
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
715
|
+
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
716
|
+
}
|
|
717
|
+
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
1048
718
|
}
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
719
|
+
exports.default = urlForImage;
|
|
720
|
+
// eslint-disable-next-line complexity
|
|
721
|
+
function specToImageUrl(spec) {
|
|
722
|
+
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
723
|
+
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
724
|
+
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
725
|
+
var params = [];
|
|
726
|
+
if (spec.rect) {
|
|
727
|
+
// Only bother url with a crop if it actually crops anything
|
|
728
|
+
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
729
|
+
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
730
|
+
if (isEffectiveCrop) {
|
|
731
|
+
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if (spec.bg) {
|
|
735
|
+
params.push("bg=" + spec.bg);
|
|
736
|
+
}
|
|
737
|
+
if (spec.focalPoint) {
|
|
738
|
+
params.push("fp-x=" + spec.focalPoint.x);
|
|
739
|
+
params.push("fp-x=" + spec.focalPoint.y);
|
|
740
|
+
}
|
|
741
|
+
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
742
|
+
if (flip) {
|
|
743
|
+
params.push("flip=" + flip);
|
|
744
|
+
}
|
|
745
|
+
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
746
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
747
|
+
var specName = mapping[0], param = mapping[1];
|
|
748
|
+
if (typeof spec[specName] !== 'undefined') {
|
|
749
|
+
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
750
|
+
}
|
|
751
|
+
else if (typeof spec[param] !== 'undefined') {
|
|
752
|
+
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
if (params.length === 0) {
|
|
756
|
+
return baseUrl;
|
|
757
|
+
}
|
|
758
|
+
return baseUrl + "?" + params.join('&');
|
|
1080
759
|
}
|
|
1081
|
-
|
|
1082
|
-
var
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
760
|
+
function fit(source, spec) {
|
|
761
|
+
var cropRect;
|
|
762
|
+
var imgWidth = spec.width;
|
|
763
|
+
var imgHeight = spec.height;
|
|
764
|
+
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
765
|
+
if (!(imgWidth && imgHeight)) {
|
|
766
|
+
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
767
|
+
}
|
|
768
|
+
var crop = source.crop;
|
|
769
|
+
var hotspot = source.hotspot;
|
|
770
|
+
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
771
|
+
var desiredAspectRatio = imgWidth / imgHeight;
|
|
772
|
+
var cropAspectRatio = crop.width / crop.height;
|
|
773
|
+
if (cropAspectRatio > desiredAspectRatio) {
|
|
774
|
+
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
775
|
+
var height = crop.height;
|
|
776
|
+
var width = height * desiredAspectRatio;
|
|
777
|
+
var top_2 = crop.top;
|
|
778
|
+
// Center output horizontally over hotspot
|
|
779
|
+
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
780
|
+
var left = hotspotXCenter - width / 2;
|
|
781
|
+
// Keep output within crop
|
|
782
|
+
if (left < crop.left) {
|
|
783
|
+
left = crop.left;
|
|
784
|
+
}
|
|
785
|
+
else if (left + width > crop.left + crop.width) {
|
|
786
|
+
left = crop.left + crop.width - width;
|
|
787
|
+
}
|
|
788
|
+
cropRect = {
|
|
789
|
+
left: Math.round(left),
|
|
790
|
+
top: Math.round(top_2),
|
|
791
|
+
width: Math.round(width),
|
|
792
|
+
height: Math.round(height)
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
797
|
+
var width = crop.width;
|
|
798
|
+
var height = width / desiredAspectRatio;
|
|
799
|
+
var left = crop.left;
|
|
800
|
+
// Center output vertically over hotspot
|
|
801
|
+
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
802
|
+
var top_3 = hotspotYCenter - height / 2;
|
|
803
|
+
// Keep output rect within crop
|
|
804
|
+
if (top_3 < crop.top) {
|
|
805
|
+
top_3 = crop.top;
|
|
806
|
+
}
|
|
807
|
+
else if (top_3 + height > crop.top + crop.height) {
|
|
808
|
+
top_3 = crop.top + crop.height - height;
|
|
809
|
+
}
|
|
810
|
+
cropRect = {
|
|
811
|
+
left: Math.max(0, Math.floor(left)),
|
|
812
|
+
top: Math.max(0, Math.floor(top_3)),
|
|
813
|
+
width: Math.round(width),
|
|
814
|
+
height: Math.round(height)
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
return {
|
|
818
|
+
width: imgWidth,
|
|
819
|
+
height: imgHeight,
|
|
820
|
+
rect: cropRect
|
|
821
|
+
};
|
|
1115
822
|
}
|
|
1116
823
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
/** Used to detect overreaching core-js shims. */
|
|
1120
|
-
var coreJsData = _root['__core-js_shared__'];
|
|
1121
|
-
|
|
1122
|
-
var _coreJsData = coreJsData;
|
|
824
|
+
});
|
|
1123
825
|
|
|
1124
|
-
|
|
1125
|
-
var
|
|
1126
|
-
|
|
1127
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1128
|
-
}());
|
|
826
|
+
unwrapExports(urlForImage_1);
|
|
827
|
+
var urlForImage_2 = urlForImage_1.parseSource;
|
|
828
|
+
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
1129
829
|
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
830
|
+
var builder = createCommonjsModule(function (module, exports) {
|
|
831
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
832
|
+
__assign = Object.assign || function(t) {
|
|
833
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
834
|
+
s = arguments[i];
|
|
835
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
836
|
+
t[p] = s[p];
|
|
837
|
+
}
|
|
838
|
+
return t;
|
|
839
|
+
};
|
|
840
|
+
return __assign.apply(this, arguments);
|
|
841
|
+
};
|
|
842
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
843
|
+
if (mod && mod.__esModule) return mod;
|
|
844
|
+
var result = {};
|
|
845
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
846
|
+
result["default"] = mod;
|
|
847
|
+
return result;
|
|
848
|
+
};
|
|
849
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
850
|
+
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
851
|
+
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
852
|
+
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
853
|
+
var validAutoModes = ['format'];
|
|
854
|
+
function isSanityClient(client) {
|
|
855
|
+
return client ? typeof client.clientConfig === 'object' : false;
|
|
1139
856
|
}
|
|
1140
|
-
|
|
1141
|
-
var
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
var
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
* Converts `func` to its source code.
|
|
1151
|
-
*
|
|
1152
|
-
* @private
|
|
1153
|
-
* @param {Function} func The function to convert.
|
|
1154
|
-
* @returns {string} Returns the source code.
|
|
1155
|
-
*/
|
|
1156
|
-
function toSource(func) {
|
|
1157
|
-
if (func != null) {
|
|
1158
|
-
try {
|
|
1159
|
-
return funcToString.call(func);
|
|
1160
|
-
} catch (e) {}
|
|
1161
|
-
try {
|
|
1162
|
-
return (func + '');
|
|
1163
|
-
} catch (e) {}
|
|
1164
|
-
}
|
|
1165
|
-
return '';
|
|
857
|
+
function rewriteSpecName(key) {
|
|
858
|
+
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
859
|
+
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
860
|
+
var entry = specs_1[_i];
|
|
861
|
+
var specName = entry[0], param = entry[1];
|
|
862
|
+
if (key === specName || key === param) {
|
|
863
|
+
return specName;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
return key;
|
|
1166
867
|
}
|
|
868
|
+
function urlBuilder(options) {
|
|
869
|
+
// Did we get a SanityClient?
|
|
870
|
+
var client = options;
|
|
871
|
+
if (isSanityClient(client)) {
|
|
872
|
+
// Inherit config from client
|
|
873
|
+
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
874
|
+
return new ImageUrlBuilder(null, {
|
|
875
|
+
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
876
|
+
projectId: projectId,
|
|
877
|
+
dataset: dataset
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
// Or just accept the options as given
|
|
881
|
+
return new ImageUrlBuilder(null, options);
|
|
882
|
+
}
|
|
883
|
+
exports.default = urlBuilder;
|
|
884
|
+
var ImageUrlBuilder = /** @class */ (function () {
|
|
885
|
+
function ImageUrlBuilder(parent, options) {
|
|
886
|
+
this.options = parent
|
|
887
|
+
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
888
|
+
}
|
|
889
|
+
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
890
|
+
var baseUrl = options.baseUrl || '';
|
|
891
|
+
var newOptions = { baseUrl: baseUrl };
|
|
892
|
+
for (var key in options) {
|
|
893
|
+
if (options.hasOwnProperty(key)) {
|
|
894
|
+
var specKey = rewriteSpecName(key);
|
|
895
|
+
newOptions[specKey] = options[key];
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
899
|
+
};
|
|
900
|
+
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
901
|
+
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
902
|
+
// studio, the 'image'-document must be provided.
|
|
903
|
+
ImageUrlBuilder.prototype.image = function (source) {
|
|
904
|
+
return this.withOptions({ source: source });
|
|
905
|
+
};
|
|
906
|
+
// Specify the dataset
|
|
907
|
+
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
908
|
+
return this.withOptions({ dataset: dataset });
|
|
909
|
+
};
|
|
910
|
+
// Specify the projectId
|
|
911
|
+
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
912
|
+
return this.withOptions({ projectId: projectId });
|
|
913
|
+
};
|
|
914
|
+
// Specify background color
|
|
915
|
+
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
916
|
+
return this.withOptions({ bg: bg });
|
|
917
|
+
};
|
|
918
|
+
// Set DPR scaling factor
|
|
919
|
+
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
920
|
+
return this.withOptions({ dpr: dpr });
|
|
921
|
+
};
|
|
922
|
+
// Specify the width of the image in pixels
|
|
923
|
+
ImageUrlBuilder.prototype.width = function (width) {
|
|
924
|
+
return this.withOptions({ width: width });
|
|
925
|
+
};
|
|
926
|
+
// Specify the height of the image in pixels
|
|
927
|
+
ImageUrlBuilder.prototype.height = function (height) {
|
|
928
|
+
return this.withOptions({ height: height });
|
|
929
|
+
};
|
|
930
|
+
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
931
|
+
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
932
|
+
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
933
|
+
};
|
|
934
|
+
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
935
|
+
return this.withOptions({ maxWidth: maxWidth });
|
|
936
|
+
};
|
|
937
|
+
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
938
|
+
return this.withOptions({ minWidth: minWidth });
|
|
939
|
+
};
|
|
940
|
+
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
941
|
+
return this.withOptions({ maxHeight: maxHeight });
|
|
942
|
+
};
|
|
943
|
+
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
944
|
+
return this.withOptions({ minHeight: minHeight });
|
|
945
|
+
};
|
|
946
|
+
// Specify width and height in pixels
|
|
947
|
+
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
948
|
+
return this.withOptions({ width: width, height: height });
|
|
949
|
+
};
|
|
950
|
+
// Specify blur between 0 and 100
|
|
951
|
+
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
952
|
+
return this.withOptions({ blur: blur });
|
|
953
|
+
};
|
|
954
|
+
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
955
|
+
return this.withOptions({ sharpen: sharpen });
|
|
956
|
+
};
|
|
957
|
+
// Specify the desired rectangle of the image
|
|
958
|
+
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
959
|
+
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
960
|
+
};
|
|
961
|
+
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
962
|
+
ImageUrlBuilder.prototype.format = function (format) {
|
|
963
|
+
return this.withOptions({ format: format });
|
|
964
|
+
};
|
|
965
|
+
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
966
|
+
return this.withOptions({ invert: invert });
|
|
967
|
+
};
|
|
968
|
+
// Rotation in degrees 0, 90, 180, 270
|
|
969
|
+
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
970
|
+
return this.withOptions({ orientation: orientation });
|
|
971
|
+
};
|
|
972
|
+
// Compression quality 0-100
|
|
973
|
+
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
974
|
+
return this.withOptions({ quality: quality });
|
|
975
|
+
};
|
|
976
|
+
// Make it a download link. Parameter is default filename.
|
|
977
|
+
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
978
|
+
return this.withOptions({ download: download });
|
|
979
|
+
};
|
|
980
|
+
// Flip image horizontally
|
|
981
|
+
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
982
|
+
return this.withOptions({ flipHorizontal: true });
|
|
983
|
+
};
|
|
984
|
+
// Flip image verically
|
|
985
|
+
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
986
|
+
return this.withOptions({ flipVertical: true });
|
|
987
|
+
};
|
|
988
|
+
// Ignore crop/hotspot from image record, even when present
|
|
989
|
+
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
990
|
+
return this.withOptions({ ignoreImageParams: true });
|
|
991
|
+
};
|
|
992
|
+
ImageUrlBuilder.prototype.fit = function (value) {
|
|
993
|
+
if (validFits.indexOf(value) === -1) {
|
|
994
|
+
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
995
|
+
}
|
|
996
|
+
return this.withOptions({ fit: value });
|
|
997
|
+
};
|
|
998
|
+
ImageUrlBuilder.prototype.crop = function (value) {
|
|
999
|
+
if (validCrops.indexOf(value) === -1) {
|
|
1000
|
+
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
1001
|
+
}
|
|
1002
|
+
return this.withOptions({ crop: value });
|
|
1003
|
+
};
|
|
1004
|
+
ImageUrlBuilder.prototype.auto = function (value) {
|
|
1005
|
+
if (validAutoModes.indexOf(value) === -1) {
|
|
1006
|
+
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
1007
|
+
}
|
|
1008
|
+
return this.withOptions({ auto: value });
|
|
1009
|
+
};
|
|
1010
|
+
// Gets the url based on the submitted parameters
|
|
1011
|
+
ImageUrlBuilder.prototype.url = function () {
|
|
1012
|
+
return urlForImage_1$$1.default(this.options);
|
|
1013
|
+
};
|
|
1014
|
+
// Synonym for url()
|
|
1015
|
+
ImageUrlBuilder.prototype.toString = function () {
|
|
1016
|
+
return this.url();
|
|
1017
|
+
};
|
|
1018
|
+
return ImageUrlBuilder;
|
|
1019
|
+
}());
|
|
1167
1020
|
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
* Used to match `RegExp`
|
|
1172
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1173
|
-
*/
|
|
1174
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1175
|
-
|
|
1176
|
-
/** Used to detect host constructors (Safari). */
|
|
1177
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1021
|
+
});
|
|
1178
1022
|
|
|
1179
|
-
|
|
1180
|
-
var funcProto$1 = Function.prototype,
|
|
1181
|
-
objectProto$2 = Object.prototype;
|
|
1023
|
+
unwrapExports(builder);
|
|
1182
1024
|
|
|
1183
|
-
|
|
1184
|
-
var
|
|
1025
|
+
var node = createCommonjsModule(function (module) {
|
|
1026
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1027
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1028
|
+
};
|
|
1029
|
+
var builder_1 = __importDefault(builder);
|
|
1030
|
+
module.exports = builder_1.default;
|
|
1185
1031
|
|
|
1186
|
-
|
|
1187
|
-
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
|
1032
|
+
});
|
|
1188
1033
|
|
|
1189
|
-
|
|
1190
|
-
var reIsNative = RegExp('^' +
|
|
1191
|
-
funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
|
|
1192
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
1193
|
-
);
|
|
1034
|
+
var imageUrlBuilder = unwrapExports(node);
|
|
1194
1035
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
* @private
|
|
1199
|
-
* @param {*} value The value to check.
|
|
1200
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1201
|
-
* else `false`.
|
|
1202
|
-
*/
|
|
1203
|
-
function baseIsNative(value) {
|
|
1204
|
-
if (!isObject_1(value) || _isMasked(value)) {
|
|
1205
|
-
return false;
|
|
1036
|
+
var classCallCheck = function (instance, Constructor) {
|
|
1037
|
+
if (!(instance instanceof Constructor)) {
|
|
1038
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1206
1039
|
}
|
|
1207
|
-
|
|
1208
|
-
return pattern.test(_toSource(value));
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
var _baseIsNative = baseIsNative;
|
|
1212
|
-
|
|
1213
|
-
/**
|
|
1214
|
-
* Gets the value at `key` of `object`.
|
|
1215
|
-
*
|
|
1216
|
-
* @private
|
|
1217
|
-
* @param {Object} [object] The object to query.
|
|
1218
|
-
* @param {string} key The key of the property to get.
|
|
1219
|
-
* @returns {*} Returns the property value.
|
|
1220
|
-
*/
|
|
1221
|
-
function getValue(object, key) {
|
|
1222
|
-
return object == null ? undefined : object[key];
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
var _getValue = getValue;
|
|
1226
|
-
|
|
1227
|
-
/**
|
|
1228
|
-
* Gets the native function at `key` of `object`.
|
|
1229
|
-
*
|
|
1230
|
-
* @private
|
|
1231
|
-
* @param {Object} object The object to query.
|
|
1232
|
-
* @param {string} key The key of the method to get.
|
|
1233
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1234
|
-
*/
|
|
1235
|
-
function getNative(object, key) {
|
|
1236
|
-
var value = _getValue(object, key);
|
|
1237
|
-
return _baseIsNative(value) ? value : undefined;
|
|
1238
|
-
}
|
|
1239
|
-
|
|
1240
|
-
var _getNative = getNative;
|
|
1040
|
+
};
|
|
1241
1041
|
|
|
1242
|
-
|
|
1243
|
-
|
|
1042
|
+
var createClass = function () {
|
|
1043
|
+
function defineProperties(target, props) {
|
|
1044
|
+
for (var i = 0; i < props.length; i++) {
|
|
1045
|
+
var descriptor = props[i];
|
|
1046
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1047
|
+
descriptor.configurable = true;
|
|
1048
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1049
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1244
1052
|
|
|
1245
|
-
|
|
1053
|
+
return function (Constructor, protoProps, staticProps) {
|
|
1054
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1055
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1056
|
+
return Constructor;
|
|
1057
|
+
};
|
|
1058
|
+
}();
|
|
1246
1059
|
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
* @name clear
|
|
1252
|
-
* @memberOf Hash
|
|
1253
|
-
*/
|
|
1254
|
-
function hashClear() {
|
|
1255
|
-
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
1256
|
-
this.size = 0;
|
|
1257
|
-
}
|
|
1060
|
+
var inherits = function (subClass, superClass) {
|
|
1061
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1062
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1063
|
+
}
|
|
1258
1064
|
|
|
1259
|
-
|
|
1065
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1066
|
+
constructor: {
|
|
1067
|
+
value: subClass,
|
|
1068
|
+
enumerable: false,
|
|
1069
|
+
writable: true,
|
|
1070
|
+
configurable: true
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1074
|
+
};
|
|
1260
1075
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
* @name delete
|
|
1266
|
-
* @memberOf Hash
|
|
1267
|
-
* @param {Object} hash The hash to modify.
|
|
1268
|
-
* @param {string} key The key of the value to remove.
|
|
1269
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1270
|
-
*/
|
|
1271
|
-
function hashDelete(key) {
|
|
1272
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
1273
|
-
this.size -= result ? 1 : 0;
|
|
1274
|
-
return result;
|
|
1275
|
-
}
|
|
1076
|
+
var possibleConstructorReturn = function (self, call) {
|
|
1077
|
+
if (!self) {
|
|
1078
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1079
|
+
}
|
|
1276
1080
|
|
|
1277
|
-
|
|
1081
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1082
|
+
};
|
|
1278
1083
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1084
|
+
var slicedToArray = function () {
|
|
1085
|
+
function sliceIterator(arr, i) {
|
|
1086
|
+
var _arr = [];
|
|
1087
|
+
var _n = true;
|
|
1088
|
+
var _d = false;
|
|
1089
|
+
var _e = undefined;
|
|
1281
1090
|
|
|
1282
|
-
|
|
1283
|
-
var
|
|
1091
|
+
try {
|
|
1092
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
1093
|
+
_arr.push(_s.value);
|
|
1284
1094
|
|
|
1285
|
-
|
|
1286
|
-
|
|
1095
|
+
if (i && _arr.length === i) break;
|
|
1096
|
+
}
|
|
1097
|
+
} catch (err) {
|
|
1098
|
+
_d = true;
|
|
1099
|
+
_e = err;
|
|
1100
|
+
} finally {
|
|
1101
|
+
try {
|
|
1102
|
+
if (!_n && _i["return"]) _i["return"]();
|
|
1103
|
+
} finally {
|
|
1104
|
+
if (_d) throw _e;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1287
1107
|
|
|
1288
|
-
|
|
1289
|
-
* Gets the hash value for `key`.
|
|
1290
|
-
*
|
|
1291
|
-
* @private
|
|
1292
|
-
* @name get
|
|
1293
|
-
* @memberOf Hash
|
|
1294
|
-
* @param {string} key The key of the value to get.
|
|
1295
|
-
* @returns {*} Returns the entry value.
|
|
1296
|
-
*/
|
|
1297
|
-
function hashGet(key) {
|
|
1298
|
-
var data = this.__data__;
|
|
1299
|
-
if (_nativeCreate) {
|
|
1300
|
-
var result = data[key];
|
|
1301
|
-
return result === HASH_UNDEFINED ? undefined : result;
|
|
1108
|
+
return _arr;
|
|
1302
1109
|
}
|
|
1303
|
-
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
var _hashGet = hashGet;
|
|
1307
|
-
|
|
1308
|
-
/** Used for built-in method references. */
|
|
1309
|
-
var objectProto$4 = Object.prototype;
|
|
1310
1110
|
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1322
|
-
*/
|
|
1323
|
-
function hashHas(key) {
|
|
1324
|
-
var data = this.__data__;
|
|
1325
|
-
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
var _hashHas = hashHas;
|
|
1329
|
-
|
|
1330
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1331
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Sets the hash `key` to `value`.
|
|
1335
|
-
*
|
|
1336
|
-
* @private
|
|
1337
|
-
* @name set
|
|
1338
|
-
* @memberOf Hash
|
|
1339
|
-
* @param {string} key The key of the value to set.
|
|
1340
|
-
* @param {*} value The value to set.
|
|
1341
|
-
* @returns {Object} Returns the hash instance.
|
|
1342
|
-
*/
|
|
1343
|
-
function hashSet(key, value) {
|
|
1344
|
-
var data = this.__data__;
|
|
1345
|
-
this.size += this.has(key) ? 0 : 1;
|
|
1346
|
-
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
1347
|
-
return this;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
var _hashSet = hashSet;
|
|
1111
|
+
return function (arr, i) {
|
|
1112
|
+
if (Array.isArray(arr)) {
|
|
1113
|
+
return arr;
|
|
1114
|
+
} else if (Symbol.iterator in Object(arr)) {
|
|
1115
|
+
return sliceIterator(arr, i);
|
|
1116
|
+
} else {
|
|
1117
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
1118
|
+
}
|
|
1119
|
+
};
|
|
1120
|
+
}();
|
|
1351
1121
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
* @private
|
|
1356
|
-
* @constructor
|
|
1357
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1358
|
-
*/
|
|
1359
|
-
function Hash(entries) {
|
|
1360
|
-
var index = -1,
|
|
1361
|
-
length = entries == null ? 0 : entries.length;
|
|
1122
|
+
var toConsumableArray = function (arr) {
|
|
1123
|
+
if (Array.isArray(arr)) {
|
|
1124
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
1362
1125
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
this.set(entry[0], entry[1]);
|
|
1126
|
+
return arr2;
|
|
1127
|
+
} else {
|
|
1128
|
+
return Array.from(arr);
|
|
1367
1129
|
}
|
|
1368
|
-
}
|
|
1369
|
-
|
|
1370
|
-
// Add methods to `Hash`.
|
|
1371
|
-
Hash.prototype.clear = _hashClear;
|
|
1372
|
-
Hash.prototype['delete'] = _hashDelete;
|
|
1373
|
-
Hash.prototype.get = _hashGet;
|
|
1374
|
-
Hash.prototype.has = _hashHas;
|
|
1375
|
-
Hash.prototype.set = _hashSet;
|
|
1376
|
-
|
|
1377
|
-
var _Hash = Hash;
|
|
1130
|
+
};
|
|
1378
1131
|
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
*
|
|
1382
|
-
* @private
|
|
1383
|
-
* @name clear
|
|
1384
|
-
* @memberOf ListCache
|
|
1385
|
-
*/
|
|
1386
|
-
function listCacheClear() {
|
|
1387
|
-
this.__data__ = [];
|
|
1388
|
-
this.size = 0;
|
|
1389
|
-
}
|
|
1132
|
+
var DeckContent = function (_React$Component) {
|
|
1133
|
+
inherits(DeckContent, _React$Component);
|
|
1390
1134
|
|
|
1391
|
-
|
|
1135
|
+
function DeckContent() {
|
|
1136
|
+
var _ref;
|
|
1392
1137
|
|
|
1393
|
-
|
|
1394
|
-
* Performs a
|
|
1395
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1396
|
-
* comparison between two values to determine if they are equivalent.
|
|
1397
|
-
*
|
|
1398
|
-
* @static
|
|
1399
|
-
* @memberOf _
|
|
1400
|
-
* @since 4.0.0
|
|
1401
|
-
* @category Lang
|
|
1402
|
-
* @param {*} value The value to compare.
|
|
1403
|
-
* @param {*} other The other value to compare.
|
|
1404
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1405
|
-
* @example
|
|
1406
|
-
*
|
|
1407
|
-
* var object = { 'a': 1 };
|
|
1408
|
-
* var other = { 'a': 1 };
|
|
1409
|
-
*
|
|
1410
|
-
* _.eq(object, object);
|
|
1411
|
-
* // => true
|
|
1412
|
-
*
|
|
1413
|
-
* _.eq(object, other);
|
|
1414
|
-
* // => false
|
|
1415
|
-
*
|
|
1416
|
-
* _.eq('a', 'a');
|
|
1417
|
-
* // => true
|
|
1418
|
-
*
|
|
1419
|
-
* _.eq('a', Object('a'));
|
|
1420
|
-
* // => false
|
|
1421
|
-
*
|
|
1422
|
-
* _.eq(NaN, NaN);
|
|
1423
|
-
* // => true
|
|
1424
|
-
*/
|
|
1425
|
-
function eq(value, other) {
|
|
1426
|
-
return value === other || (value !== value && other !== other);
|
|
1427
|
-
}
|
|
1138
|
+
var _temp, _this, _ret;
|
|
1428
1139
|
|
|
1429
|
-
|
|
1140
|
+
classCallCheck(this, DeckContent);
|
|
1430
1141
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
*
|
|
1434
|
-
* @private
|
|
1435
|
-
* @param {Array} array The array to inspect.
|
|
1436
|
-
* @param {*} key The key to search for.
|
|
1437
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1438
|
-
*/
|
|
1439
|
-
function assocIndexOf(array, key) {
|
|
1440
|
-
var length = array.length;
|
|
1441
|
-
while (length--) {
|
|
1442
|
-
if (eq_1(array[length][0], key)) {
|
|
1443
|
-
return length;
|
|
1142
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1143
|
+
args[_key] = arguments[_key];
|
|
1444
1144
|
}
|
|
1445
|
-
}
|
|
1446
|
-
return -1;
|
|
1447
|
-
}
|
|
1448
1145
|
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
} else {
|
|
1477
|
-
splice.call(data, index, 1);
|
|
1478
|
-
}
|
|
1479
|
-
--this.size;
|
|
1480
|
-
return true;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
var _listCacheDelete = listCacheDelete;
|
|
1484
|
-
|
|
1485
|
-
/**
|
|
1486
|
-
* Gets the list cache value for `key`.
|
|
1487
|
-
*
|
|
1488
|
-
* @private
|
|
1489
|
-
* @name get
|
|
1490
|
-
* @memberOf ListCache
|
|
1491
|
-
* @param {string} key The key of the value to get.
|
|
1492
|
-
* @returns {*} Returns the entry value.
|
|
1493
|
-
*/
|
|
1494
|
-
function listCacheGet(key) {
|
|
1495
|
-
var data = this.__data__,
|
|
1496
|
-
index = _assocIndexOf(data, key);
|
|
1146
|
+
return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref = DeckContent.__proto__ || Object.getPrototypeOf(DeckContent)).call.apply(_ref, [this].concat(args))), _this), _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
|
|
1147
|
+
data: _this.data,
|
|
1148
|
+
dataKeptToCompareNewDatarecord: _this.data,
|
|
1149
|
+
per: _this.params ? _this.params.to : 2,
|
|
1150
|
+
page: 1,
|
|
1151
|
+
from: _this.params ? _this.params.from : 0,
|
|
1152
|
+
to: _this.params ? _this.params.to : 2,
|
|
1153
|
+
total_pages: null,
|
|
1154
|
+
scrolling: true,
|
|
1155
|
+
query: _this.query
|
|
1156
|
+
}, _this.loadMore = function () {
|
|
1157
|
+
setTimeout(function () {
|
|
1158
|
+
_this.setState(function (state) {
|
|
1159
|
+
return {
|
|
1160
|
+
page: state.page + 1,
|
|
1161
|
+
from: state.from + state.per,
|
|
1162
|
+
to: state.to + state.per
|
|
1163
|
+
};
|
|
1164
|
+
}, _this.loadData);
|
|
1165
|
+
}, 10);
|
|
1166
|
+
}, _this.loadData = function () {
|
|
1167
|
+
var _this$state = _this.state,
|
|
1168
|
+
from = _this$state.from,
|
|
1169
|
+
to = _this$state.to,
|
|
1170
|
+
data = _this$state.data,
|
|
1171
|
+
query = _this$state.query;
|
|
1172
|
+
var client = _this.props.client;
|
|
1497
1173
|
|
|
1498
|
-
return index < 0 ? undefined : data[index][1];
|
|
1499
|
-
}
|
|
1500
1174
|
|
|
1501
|
-
var
|
|
1175
|
+
var params = { from: from, to: to };
|
|
1176
|
+
var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
|
|
1177
|
+
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
1502
1178
|
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1179
|
+
if (_this.pointer && _this.pointerArray) {
|
|
1180
|
+
var pointer = _this.pointer;
|
|
1181
|
+
client.fetch(queryUpdated).then(function (dataArr) {
|
|
1182
|
+
_this.setState(function (state, props) {
|
|
1183
|
+
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
1184
|
+
return {
|
|
1185
|
+
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
|
|
1186
|
+
scrolling: true
|
|
1187
|
+
};
|
|
1188
|
+
} else {
|
|
1189
|
+
return {
|
|
1190
|
+
scrolling: false
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
});
|
|
1194
|
+
});
|
|
1195
|
+
} else {
|
|
1196
|
+
client.fetch(queryUpdated).then(function (dataArr) {
|
|
1197
|
+
_this.setState(function (state, props) {
|
|
1198
|
+
if (dataArr.length > 0) {
|
|
1199
|
+
return {
|
|
1200
|
+
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
|
|
1201
|
+
scrolling: true
|
|
1202
|
+
};
|
|
1203
|
+
} else {
|
|
1204
|
+
return {
|
|
1205
|
+
scrolling: false
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
}, _this.urlFor = function (source) {
|
|
1212
|
+
var client = _this.props.client;
|
|
1515
1213
|
|
|
1516
|
-
var
|
|
1214
|
+
var builder = imageUrlBuilder(client);
|
|
1215
|
+
return builder.image(source);
|
|
1216
|
+
}, _this.renderCardImage = function (row, page) {
|
|
1217
|
+
if (row.thumbnail && row.thumbnail.asset) {
|
|
1218
|
+
return _this.urlFor(row.thumbnail.asset).url();
|
|
1219
|
+
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
1220
|
+
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
1221
|
+
} else {
|
|
1222
|
+
return _this.defaultImage;
|
|
1223
|
+
}
|
|
1224
|
+
}, _this.cardLoader = function (page, columns, variant) {
|
|
1225
|
+
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
1517
1226
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1227
|
+
var itemCounter = 0;
|
|
1228
|
+
var lgVar = 12;
|
|
1229
|
+
return React__default.createElement(
|
|
1230
|
+
Row,
|
|
1231
|
+
null,
|
|
1232
|
+
_this.state.data && _this.state.data.map(function (row, index) {
|
|
1233
|
+
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
1234
|
+
lgVar = 12;
|
|
1235
|
+
} else if (columns && columns !== 'rotate') {
|
|
1236
|
+
lgVar = Math.floor(12 / columns);
|
|
1237
|
+
} else {
|
|
1238
|
+
lgVar = 6;
|
|
1239
|
+
}
|
|
1531
1240
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1241
|
+
return React__default.createElement(
|
|
1242
|
+
Col,
|
|
1243
|
+
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
1244
|
+
React__default.createElement(
|
|
1245
|
+
Card,
|
|
1246
|
+
{ className: 'content-card', style: { flexDirection: mode } },
|
|
1247
|
+
React__default.createElement(
|
|
1248
|
+
Link,
|
|
1249
|
+
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
1250
|
+
React__default.createElement(
|
|
1251
|
+
'a',
|
|
1252
|
+
null,
|
|
1253
|
+
React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
|
|
1254
|
+
)
|
|
1255
|
+
),
|
|
1256
|
+
React__default.createElement(
|
|
1257
|
+
Card.Body,
|
|
1258
|
+
null,
|
|
1259
|
+
React__default.createElement(
|
|
1260
|
+
Link,
|
|
1261
|
+
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
1262
|
+
React__default.createElement(
|
|
1263
|
+
'a',
|
|
1264
|
+
null,
|
|
1265
|
+
React__default.createElement(
|
|
1266
|
+
Card.Title,
|
|
1267
|
+
null,
|
|
1268
|
+
row.title
|
|
1269
|
+
),
|
|
1270
|
+
React__default.createElement(
|
|
1271
|
+
Card.Text,
|
|
1272
|
+
null,
|
|
1273
|
+
row.summary
|
|
1274
|
+
)
|
|
1275
|
+
)
|
|
1276
|
+
)
|
|
1277
|
+
)
|
|
1278
|
+
)
|
|
1279
|
+
);
|
|
1280
|
+
})
|
|
1281
|
+
);
|
|
1282
|
+
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
1537
1283
|
}
|
|
1538
|
-
return this;
|
|
1539
|
-
}
|
|
1540
1284
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1285
|
+
createClass(DeckContent, [{
|
|
1286
|
+
key: 'componentDidUpdate',
|
|
1287
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
1288
|
+
if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
|
|
1289
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
1290
|
+
this.setState({
|
|
1291
|
+
data: this.props.dataRecord,
|
|
1292
|
+
dataKeptToCompareNewDatarecord: this.props.dataRecord,
|
|
1293
|
+
per: this.props.params ? this.props.params.to : 2,
|
|
1294
|
+
page: 1,
|
|
1295
|
+
from: this.props.params ? this.props.params.from : 0,
|
|
1296
|
+
to: this.props.params ? this.props.params.to : 2,
|
|
1297
|
+
total_pages: null,
|
|
1298
|
+
scrolling: true,
|
|
1299
|
+
query: this.props.query
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}, {
|
|
1304
|
+
key: 'componentDidMount',
|
|
1305
|
+
value: function componentDidMount() {
|
|
1306
|
+
// this.loadData();
|
|
1307
|
+
}
|
|
1308
|
+
}, {
|
|
1309
|
+
key: 'render',
|
|
1310
|
+
value: function render() {
|
|
1311
|
+
var _this2 = this;
|
|
1553
1312
|
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
}
|
|
1313
|
+
var _props = this.props,
|
|
1314
|
+
columns = _props.columns,
|
|
1315
|
+
variant = _props.variant,
|
|
1316
|
+
autoScroll = _props.autoScroll,
|
|
1317
|
+
page = _props.page;
|
|
1560
1318
|
|
|
1561
|
-
// Add methods to `ListCache`.
|
|
1562
|
-
ListCache.prototype.clear = _listCacheClear;
|
|
1563
|
-
ListCache.prototype['delete'] = _listCacheDelete;
|
|
1564
|
-
ListCache.prototype.get = _listCacheGet;
|
|
1565
|
-
ListCache.prototype.has = _listCacheHas;
|
|
1566
|
-
ListCache.prototype.set = _listCacheSet;
|
|
1567
1319
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
*/
|
|
1617
|
-
function getMapData(map, key) {
|
|
1618
|
-
var data = map.__data__;
|
|
1619
|
-
return _isKeyable(key)
|
|
1620
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1621
|
-
: data.map;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
var _getMapData = getMapData;
|
|
1625
|
-
|
|
1626
|
-
/**
|
|
1627
|
-
* Removes `key` and its value from the map.
|
|
1628
|
-
*
|
|
1629
|
-
* @private
|
|
1630
|
-
* @name delete
|
|
1631
|
-
* @memberOf MapCache
|
|
1632
|
-
* @param {string} key The key of the value to remove.
|
|
1633
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1634
|
-
*/
|
|
1635
|
-
function mapCacheDelete(key) {
|
|
1636
|
-
var result = _getMapData(this, key)['delete'](key);
|
|
1637
|
-
this.size -= result ? 1 : 0;
|
|
1638
|
-
return result;
|
|
1639
|
-
}
|
|
1640
|
-
|
|
1641
|
-
var _mapCacheDelete = mapCacheDelete;
|
|
1642
|
-
|
|
1643
|
-
/**
|
|
1644
|
-
* Gets the map value for `key`.
|
|
1645
|
-
*
|
|
1646
|
-
* @private
|
|
1647
|
-
* @name get
|
|
1648
|
-
* @memberOf MapCache
|
|
1649
|
-
* @param {string} key The key of the value to get.
|
|
1650
|
-
* @returns {*} Returns the entry value.
|
|
1651
|
-
*/
|
|
1652
|
-
function mapCacheGet(key) {
|
|
1653
|
-
return _getMapData(this, key).get(key);
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
var _mapCacheGet = mapCacheGet;
|
|
1657
|
-
|
|
1658
|
-
/**
|
|
1659
|
-
* Checks if a map value for `key` exists.
|
|
1660
|
-
*
|
|
1661
|
-
* @private
|
|
1662
|
-
* @name has
|
|
1663
|
-
* @memberOf MapCache
|
|
1664
|
-
* @param {string} key The key of the entry to check.
|
|
1665
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1666
|
-
*/
|
|
1667
|
-
function mapCacheHas(key) {
|
|
1668
|
-
return _getMapData(this, key).has(key);
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
var _mapCacheHas = mapCacheHas;
|
|
1672
|
-
|
|
1673
|
-
/**
|
|
1674
|
-
* Sets the map `key` to `value`.
|
|
1675
|
-
*
|
|
1676
|
-
* @private
|
|
1677
|
-
* @name set
|
|
1678
|
-
* @memberOf MapCache
|
|
1679
|
-
* @param {string} key The key of the value to set.
|
|
1680
|
-
* @param {*} value The value to set.
|
|
1681
|
-
* @returns {Object} Returns the map cache instance.
|
|
1682
|
-
*/
|
|
1683
|
-
function mapCacheSet(key, value) {
|
|
1684
|
-
var data = _getMapData(this, key),
|
|
1685
|
-
size = data.size;
|
|
1686
|
-
|
|
1687
|
-
data.set(key, value);
|
|
1688
|
-
this.size += data.size == size ? 0 : 1;
|
|
1689
|
-
return this;
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
var _mapCacheSet = mapCacheSet;
|
|
1693
|
-
|
|
1694
|
-
/**
|
|
1695
|
-
* Creates a map cache object to store key-value pairs.
|
|
1696
|
-
*
|
|
1697
|
-
* @private
|
|
1698
|
-
* @constructor
|
|
1699
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1700
|
-
*/
|
|
1701
|
-
function MapCache(entries) {
|
|
1702
|
-
var index = -1,
|
|
1703
|
-
length = entries == null ? 0 : entries.length;
|
|
1704
|
-
|
|
1705
|
-
this.clear();
|
|
1706
|
-
while (++index < length) {
|
|
1707
|
-
var entry = entries[index];
|
|
1708
|
-
this.set(entry[0], entry[1]);
|
|
1709
|
-
}
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
// Add methods to `MapCache`.
|
|
1713
|
-
MapCache.prototype.clear = _mapCacheClear;
|
|
1714
|
-
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1715
|
-
MapCache.prototype.get = _mapCacheGet;
|
|
1716
|
-
MapCache.prototype.has = _mapCacheHas;
|
|
1717
|
-
MapCache.prototype.set = _mapCacheSet;
|
|
1718
|
-
|
|
1719
|
-
var _MapCache = MapCache;
|
|
1720
|
-
|
|
1721
|
-
/** Error message constants. */
|
|
1722
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1723
|
-
|
|
1724
|
-
/**
|
|
1725
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1726
|
-
* provided, it determines the cache key for storing the result based on the
|
|
1727
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
1728
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
1729
|
-
* is invoked with the `this` binding of the memoized function.
|
|
1730
|
-
*
|
|
1731
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1732
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1733
|
-
* constructor with one whose instances implement the
|
|
1734
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1735
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1736
|
-
*
|
|
1737
|
-
* @static
|
|
1738
|
-
* @memberOf _
|
|
1739
|
-
* @since 0.1.0
|
|
1740
|
-
* @category Function
|
|
1741
|
-
* @param {Function} func The function to have its output memoized.
|
|
1742
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1743
|
-
* @returns {Function} Returns the new memoized function.
|
|
1744
|
-
* @example
|
|
1745
|
-
*
|
|
1746
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
1747
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
1748
|
-
*
|
|
1749
|
-
* var values = _.memoize(_.values);
|
|
1750
|
-
* values(object);
|
|
1751
|
-
* // => [1, 2]
|
|
1752
|
-
*
|
|
1753
|
-
* values(other);
|
|
1754
|
-
* // => [3, 4]
|
|
1755
|
-
*
|
|
1756
|
-
* object.a = 2;
|
|
1757
|
-
* values(object);
|
|
1758
|
-
* // => [1, 2]
|
|
1759
|
-
*
|
|
1760
|
-
* // Modify the result cache.
|
|
1761
|
-
* values.cache.set(object, ['a', 'b']);
|
|
1762
|
-
* values(object);
|
|
1763
|
-
* // => ['a', 'b']
|
|
1764
|
-
*
|
|
1765
|
-
* // Replace `_.memoize.Cache`.
|
|
1766
|
-
* _.memoize.Cache = WeakMap;
|
|
1767
|
-
*/
|
|
1768
|
-
function memoize(func, resolver) {
|
|
1769
|
-
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1770
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1771
|
-
}
|
|
1772
|
-
var memoized = function() {
|
|
1773
|
-
var args = arguments,
|
|
1774
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1775
|
-
cache = memoized.cache;
|
|
1776
|
-
|
|
1777
|
-
if (cache.has(key)) {
|
|
1778
|
-
return cache.get(key);
|
|
1779
|
-
}
|
|
1780
|
-
var result = func.apply(this, args);
|
|
1781
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
1782
|
-
return result;
|
|
1783
|
-
};
|
|
1784
|
-
memoized.cache = new (memoize.Cache || _MapCache);
|
|
1785
|
-
return memoized;
|
|
1786
|
-
}
|
|
1787
|
-
|
|
1788
|
-
// Expose `MapCache`.
|
|
1789
|
-
memoize.Cache = _MapCache;
|
|
1790
|
-
|
|
1791
|
-
var memoize_1 = memoize;
|
|
1792
|
-
|
|
1793
|
-
/** Used as the maximum memoize cache size. */
|
|
1794
|
-
var MAX_MEMOIZE_SIZE = 500;
|
|
1795
|
-
|
|
1796
|
-
/**
|
|
1797
|
-
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1798
|
-
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1799
|
-
*
|
|
1800
|
-
* @private
|
|
1801
|
-
* @param {Function} func The function to have its output memoized.
|
|
1802
|
-
* @returns {Function} Returns the new memoized function.
|
|
1803
|
-
*/
|
|
1804
|
-
function memoizeCapped(func) {
|
|
1805
|
-
var result = memoize_1(func, function(key) {
|
|
1806
|
-
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1807
|
-
cache.clear();
|
|
1320
|
+
return React__default.createElement(
|
|
1321
|
+
'div',
|
|
1322
|
+
{ className: 'contentDeck' },
|
|
1323
|
+
autoScroll ? React__default.createElement(
|
|
1324
|
+
React__default.Fragment,
|
|
1325
|
+
null,
|
|
1326
|
+
React__default.createElement(
|
|
1327
|
+
InfiniteScroll,
|
|
1328
|
+
{ dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
|
|
1329
|
+
this.cardLoader(page, columns, variant)
|
|
1330
|
+
),
|
|
1331
|
+
React__default.createElement(
|
|
1332
|
+
'noscript',
|
|
1333
|
+
null,
|
|
1334
|
+
'Manual Pagination Here'
|
|
1335
|
+
)
|
|
1336
|
+
) : React__default.createElement(
|
|
1337
|
+
React__default.Fragment,
|
|
1338
|
+
null,
|
|
1339
|
+
this.cardLoader(page, columns, variant),
|
|
1340
|
+
React__default.createElement(
|
|
1341
|
+
'div',
|
|
1342
|
+
{ style: { padding: '0px 10px' } },
|
|
1343
|
+
this.state.scrolling ? React__default.createElement(
|
|
1344
|
+
'button',
|
|
1345
|
+
{
|
|
1346
|
+
style: { margin: 'auto', width: '100%' },
|
|
1347
|
+
onClick: function onClick(e) {
|
|
1348
|
+
_this2.loadMore();
|
|
1349
|
+
} },
|
|
1350
|
+
'Load More'
|
|
1351
|
+
) : React__default.createElement(
|
|
1352
|
+
'p',
|
|
1353
|
+
{ style: { textAlign: 'center' } },
|
|
1354
|
+
React__default.createElement(
|
|
1355
|
+
'b',
|
|
1356
|
+
null,
|
|
1357
|
+
'End of data'
|
|
1358
|
+
)
|
|
1359
|
+
)
|
|
1360
|
+
),
|
|
1361
|
+
React__default.createElement(
|
|
1362
|
+
'noscript',
|
|
1363
|
+
null,
|
|
1364
|
+
'Manual Pagination Here'
|
|
1365
|
+
)
|
|
1366
|
+
)
|
|
1367
|
+
);
|
|
1808
1368
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
var cache = result.cache;
|
|
1813
|
-
return result;
|
|
1814
|
-
}
|
|
1815
|
-
|
|
1816
|
-
var _memoizeCapped = memoizeCapped;
|
|
1817
|
-
|
|
1818
|
-
/** Used to match property names within property paths. */
|
|
1819
|
-
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1820
|
-
|
|
1821
|
-
/** Used to match backslashes in property paths. */
|
|
1822
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
1823
|
-
|
|
1824
|
-
/**
|
|
1825
|
-
* Converts `string` to a property path array.
|
|
1826
|
-
*
|
|
1827
|
-
* @private
|
|
1828
|
-
* @param {string} string The string to convert.
|
|
1829
|
-
* @returns {Array} Returns the property path array.
|
|
1830
|
-
*/
|
|
1831
|
-
var stringToPath = _memoizeCapped(function(string) {
|
|
1832
|
-
var result = [];
|
|
1833
|
-
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1834
|
-
result.push('');
|
|
1835
|
-
}
|
|
1836
|
-
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1837
|
-
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1838
|
-
});
|
|
1839
|
-
return result;
|
|
1840
|
-
});
|
|
1841
|
-
|
|
1842
|
-
var _stringToPath = stringToPath;
|
|
1843
|
-
|
|
1844
|
-
/**
|
|
1845
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
1846
|
-
* shorthands.
|
|
1847
|
-
*
|
|
1848
|
-
* @private
|
|
1849
|
-
* @param {Array} [array] The array to iterate over.
|
|
1850
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
1851
|
-
* @returns {Array} Returns the new mapped array.
|
|
1852
|
-
*/
|
|
1853
|
-
function arrayMap(array, iteratee) {
|
|
1854
|
-
var index = -1,
|
|
1855
|
-
length = array == null ? 0 : array.length,
|
|
1856
|
-
result = Array(length);
|
|
1857
|
-
|
|
1858
|
-
while (++index < length) {
|
|
1859
|
-
result[index] = iteratee(array[index], index, array);
|
|
1860
|
-
}
|
|
1861
|
-
return result;
|
|
1862
|
-
}
|
|
1863
|
-
|
|
1864
|
-
var _arrayMap = arrayMap;
|
|
1865
|
-
|
|
1866
|
-
/** Used as references for various `Number` constants. */
|
|
1867
|
-
var INFINITY = 1 / 0;
|
|
1868
|
-
|
|
1869
|
-
/** Used to convert symbols to primitives and strings. */
|
|
1870
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
1871
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1872
|
-
|
|
1873
|
-
/**
|
|
1874
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1875
|
-
* values to empty strings.
|
|
1876
|
-
*
|
|
1877
|
-
* @private
|
|
1878
|
-
* @param {*} value The value to process.
|
|
1879
|
-
* @returns {string} Returns the string.
|
|
1880
|
-
*/
|
|
1881
|
-
function baseToString(value) {
|
|
1882
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
1883
|
-
if (typeof value == 'string') {
|
|
1884
|
-
return value;
|
|
1885
|
-
}
|
|
1886
|
-
if (isArray_1(value)) {
|
|
1887
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
1888
|
-
return _arrayMap(value, baseToString) + '';
|
|
1889
|
-
}
|
|
1890
|
-
if (isSymbol_1(value)) {
|
|
1891
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
1892
|
-
}
|
|
1893
|
-
var result = (value + '');
|
|
1894
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1895
|
-
}
|
|
1896
|
-
|
|
1897
|
-
var _baseToString = baseToString;
|
|
1898
|
-
|
|
1899
|
-
/**
|
|
1900
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
1901
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
1902
|
-
*
|
|
1903
|
-
* @static
|
|
1904
|
-
* @memberOf _
|
|
1905
|
-
* @since 4.0.0
|
|
1906
|
-
* @category Lang
|
|
1907
|
-
* @param {*} value The value to convert.
|
|
1908
|
-
* @returns {string} Returns the converted string.
|
|
1909
|
-
* @example
|
|
1910
|
-
*
|
|
1911
|
-
* _.toString(null);
|
|
1912
|
-
* // => ''
|
|
1913
|
-
*
|
|
1914
|
-
* _.toString(-0);
|
|
1915
|
-
* // => '-0'
|
|
1916
|
-
*
|
|
1917
|
-
* _.toString([1, 2, 3]);
|
|
1918
|
-
* // => '1,2,3'
|
|
1919
|
-
*/
|
|
1920
|
-
function toString(value) {
|
|
1921
|
-
return value == null ? '' : _baseToString(value);
|
|
1922
|
-
}
|
|
1923
|
-
|
|
1924
|
-
var toString_1 = toString;
|
|
1925
|
-
|
|
1926
|
-
/**
|
|
1927
|
-
* Casts `value` to a path array if it's not one.
|
|
1928
|
-
*
|
|
1929
|
-
* @private
|
|
1930
|
-
* @param {*} value The value to inspect.
|
|
1931
|
-
* @param {Object} [object] The object to query keys on.
|
|
1932
|
-
* @returns {Array} Returns the cast property path array.
|
|
1933
|
-
*/
|
|
1934
|
-
function castPath(value, object) {
|
|
1935
|
-
if (isArray_1(value)) {
|
|
1936
|
-
return value;
|
|
1937
|
-
}
|
|
1938
|
-
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
var _castPath = castPath;
|
|
1942
|
-
|
|
1943
|
-
/** Used as references for various `Number` constants. */
|
|
1944
|
-
var INFINITY$1 = 1 / 0;
|
|
1945
|
-
|
|
1946
|
-
/**
|
|
1947
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
1948
|
-
*
|
|
1949
|
-
* @private
|
|
1950
|
-
* @param {*} value The value to inspect.
|
|
1951
|
-
* @returns {string|symbol} Returns the key.
|
|
1952
|
-
*/
|
|
1953
|
-
function toKey(value) {
|
|
1954
|
-
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
1955
|
-
return value;
|
|
1956
|
-
}
|
|
1957
|
-
var result = (value + '');
|
|
1958
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
1959
|
-
}
|
|
1960
|
-
|
|
1961
|
-
var _toKey = toKey;
|
|
1962
|
-
|
|
1963
|
-
/**
|
|
1964
|
-
* The base implementation of `_.get` without support for default values.
|
|
1965
|
-
*
|
|
1966
|
-
* @private
|
|
1967
|
-
* @param {Object} object The object to query.
|
|
1968
|
-
* @param {Array|string} path The path of the property to get.
|
|
1969
|
-
* @returns {*} Returns the resolved value.
|
|
1970
|
-
*/
|
|
1971
|
-
function baseGet(object, path) {
|
|
1972
|
-
path = _castPath(path, object);
|
|
1973
|
-
|
|
1974
|
-
var index = 0,
|
|
1975
|
-
length = path.length;
|
|
1976
|
-
|
|
1977
|
-
while (object != null && index < length) {
|
|
1978
|
-
object = object[_toKey(path[index++])];
|
|
1979
|
-
}
|
|
1980
|
-
return (index && index == length) ? object : undefined;
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
var _baseGet = baseGet;
|
|
1984
|
-
|
|
1985
|
-
/**
|
|
1986
|
-
* Gets the value at `path` of `object`. If the resolved value is
|
|
1987
|
-
* `undefined`, the `defaultValue` is returned in its place.
|
|
1988
|
-
*
|
|
1989
|
-
* @static
|
|
1990
|
-
* @memberOf _
|
|
1991
|
-
* @since 3.7.0
|
|
1992
|
-
* @category Object
|
|
1993
|
-
* @param {Object} object The object to query.
|
|
1994
|
-
* @param {Array|string} path The path of the property to get.
|
|
1995
|
-
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
1996
|
-
* @returns {*} Returns the resolved value.
|
|
1997
|
-
* @example
|
|
1998
|
-
*
|
|
1999
|
-
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2000
|
-
*
|
|
2001
|
-
* _.get(object, 'a[0].b.c');
|
|
2002
|
-
* // => 3
|
|
2003
|
-
*
|
|
2004
|
-
* _.get(object, ['a', '0', 'b', 'c']);
|
|
2005
|
-
* // => 3
|
|
2006
|
-
*
|
|
2007
|
-
* _.get(object, 'a.b.c', 'default');
|
|
2008
|
-
* // => 'default'
|
|
2009
|
-
*/
|
|
2010
|
-
function get$1(object, path, defaultValue) {
|
|
2011
|
-
var result = object == null ? undefined : _baseGet(object, path);
|
|
2012
|
-
return result === undefined ? defaultValue : result;
|
|
2013
|
-
}
|
|
2014
|
-
|
|
2015
|
-
var get_1 = get$1;
|
|
1369
|
+
}]);
|
|
1370
|
+
return DeckContent;
|
|
1371
|
+
}(React__default.Component);
|
|
2016
1372
|
|
|
2017
1373
|
var DeckQueue = function (_React$Component) {
|
|
2018
1374
|
inherits(DeckQueue, _React$Component);
|
|
@@ -2091,6 +1447,11 @@ var DeckQueue = function (_React$Component) {
|
|
|
2091
1447
|
});
|
|
2092
1448
|
});
|
|
2093
1449
|
}
|
|
1450
|
+
}, _this.urlFor = function (source) {
|
|
1451
|
+
var client = _this.props.client;
|
|
1452
|
+
|
|
1453
|
+
var builder = imageUrlBuilder(client);
|
|
1454
|
+
return builder.image(source);
|
|
2094
1455
|
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
2095
1456
|
}
|
|
2096
1457
|
|
|
@@ -2106,7 +1467,8 @@ var DeckQueue = function (_React$Component) {
|
|
|
2106
1467
|
Row,
|
|
2107
1468
|
null,
|
|
2108
1469
|
this.state.data && this.state.data.map(function (row, index) {
|
|
2109
|
-
|
|
1470
|
+
// const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
|
|
1471
|
+
var thumbnailURL = row.thumbnail && row.thumbnail.asset ? _this2.urlFor(row.thumbnail.asset).url() : _this2.props.defaultImage;
|
|
2110
1472
|
return React__default.createElement(
|
|
2111
1473
|
Col,
|
|
2112
1474
|
{ key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -2206,7 +1568,15 @@ var DeckQueue = function (_React$Component) {
|
|
|
2206
1568
|
|
|
2207
1569
|
var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
2208
1570
|
var size = _ref.size,
|
|
2209
|
-
mediaData = _ref.mediaData
|
|
1571
|
+
mediaData = _ref.mediaData,
|
|
1572
|
+
client = _ref.client,
|
|
1573
|
+
defaultImage = _ref.defaultImage;
|
|
1574
|
+
|
|
1575
|
+
var builder = imageUrlBuilder(client);
|
|
1576
|
+
|
|
1577
|
+
var urlFor = function urlFor(source) {
|
|
1578
|
+
return builder.image(source);
|
|
1579
|
+
};
|
|
2210
1580
|
|
|
2211
1581
|
return React__default.createElement(
|
|
2212
1582
|
'div',
|
|
@@ -2215,7 +1585,13 @@ var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
|
2215
1585
|
return React__default.createElement(
|
|
2216
1586
|
Media,
|
|
2217
1587
|
{ className: 'mb-3 thumbnail-card' },
|
|
2218
|
-
React__default.createElement('img', {
|
|
1588
|
+
React__default.createElement('img', {
|
|
1589
|
+
width: size,
|
|
1590
|
+
height: size,
|
|
1591
|
+
className: 'mr-3',
|
|
1592
|
+
src: item.thumbnail && item.thumbnail.asset ? urlFor(item.thumbnail.asset).url() : defaultImage,
|
|
1593
|
+
alt: 'Generic placeholder'
|
|
1594
|
+
}),
|
|
2219
1595
|
React__default.createElement(
|
|
2220
1596
|
Media.Body,
|
|
2221
1597
|
null,
|
|
@@ -2241,8 +1617,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2241
1617
|
_props$icon = props.icon,
|
|
2242
1618
|
icon = _props$icon === undefined ? false : _props$icon,
|
|
2243
1619
|
data = props.dataRecord,
|
|
2244
|
-
defaultImage = props.defaultImage
|
|
1620
|
+
defaultImage = props.defaultImage,
|
|
1621
|
+
client = props.client;
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
var builder = imageUrlBuilder(client);
|
|
2245
1625
|
|
|
1626
|
+
var urlFor = function urlFor(source) {
|
|
1627
|
+
return builder.image(source);
|
|
1628
|
+
};
|
|
2246
1629
|
|
|
2247
1630
|
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
2248
1631
|
|
|
@@ -2263,8 +1646,7 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2263
1646
|
} else {
|
|
2264
1647
|
lgVar = 6;
|
|
2265
1648
|
}
|
|
2266
|
-
var thumbnailURL =
|
|
2267
|
-
|
|
1649
|
+
var thumbnailURL = row.thumbnail && row.thumbnail.asset ? urlFor(row.thumbnail.asset).url() : defaultImage;
|
|
2268
1650
|
return React__default.createElement(
|
|
2269
1651
|
Col,
|
|
2270
1652
|
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -2319,7 +1701,8 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2319
1701
|
top: '50%',
|
|
2320
1702
|
transform: 'translateY(-50%) translateX(50px)',
|
|
2321
1703
|
transition: 'all .25s',
|
|
2322
|
-
pointerEvents: 'none'
|
|
1704
|
+
pointerEvents: 'none'
|
|
1705
|
+
} },
|
|
2323
1706
|
'\u2192'
|
|
2324
1707
|
)
|
|
2325
1708
|
)
|
|
@@ -5730,606 +5113,69 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
5730
5113
|
Container,
|
|
5731
5114
|
null,
|
|
5732
5115
|
layout()
|
|
5733
|
-
)
|
|
5734
|
-
);
|
|
5735
|
-
};
|
|
5736
|
-
|
|
5737
|
-
var AD = function AD(_ref) {
|
|
5738
|
-
var networkID = _ref.networkID,
|
|
5739
|
-
adUnit = _ref.adUnit,
|
|
5740
|
-
sizeMapping = _ref.sizeMapping,
|
|
5741
|
-
className = _ref.className,
|
|
5742
|
-
slotId = _ref.slotId,
|
|
5743
|
-
sizes = _ref.sizes,
|
|
5744
|
-
minInViewPercent = _ref.minInViewPercent,
|
|
5745
|
-
_ref$targeting = _ref.targeting,
|
|
5746
|
-
targeting = _ref$targeting === undefined ? { desktop: {} } : _ref$targeting;
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
return React__default.createElement(
|
|
5750
|
-
lib_1,
|
|
5751
|
-
{ dfpNetworkId: networkID, targetingArguments: targeting.desktop, sizeMapping: sizeMapping, lazyLoad: { fetchMarginPercent: 500, renderMarginPercent: 200, mobileScaling: 2.0 } },
|
|
5752
|
-
React__default.createElement(
|
|
5753
|
-
'div',
|
|
5754
|
-
{ className: className },
|
|
5755
|
-
React__default.createElement(lib_2, {
|
|
5756
|
-
slotId: slotId,
|
|
5757
|
-
sizes: sizes,
|
|
5758
|
-
adUnit: adUnit,
|
|
5759
|
-
sizeMapping: sizeMapping
|
|
5760
|
-
})
|
|
5761
|
-
)
|
|
5762
|
-
);
|
|
5763
|
-
};
|
|
5764
|
-
|
|
5765
|
-
AD.propTypes = {
|
|
5766
|
-
networkID: PropTypes.string.isRequired,
|
|
5767
|
-
adUnit: PropTypes.string.isRequired,
|
|
5768
|
-
slotId: PropTypes.string,
|
|
5769
|
-
className: PropTypes.string,
|
|
5770
|
-
sizeMapping: PropTypes.array,
|
|
5771
|
-
sizes: PropTypes.array,
|
|
5772
|
-
minInViewPercent: PropTypes.number
|
|
5773
|
-
};
|
|
5774
|
-
|
|
5775
|
-
var AD300x250 = function AD300x250(_ref) {
|
|
5776
|
-
var networkID = _ref.networkID,
|
|
5777
|
-
adUnit = _ref.adUnit,
|
|
5778
|
-
targeting = _ref.targeting;
|
|
5779
|
-
|
|
5780
|
-
return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x250', sizes: [[300, 250], [300, 100]] });
|
|
5781
|
-
};
|
|
5782
|
-
|
|
5783
|
-
var AD300x250x600 = function AD300x250x600(_ref) {
|
|
5784
|
-
var networkID = _ref.networkID,
|
|
5785
|
-
adUnit = _ref.adUnit,
|
|
5786
|
-
targeting = _ref.targeting;
|
|
5787
|
-
|
|
5788
|
-
return React__default.createElement(AD, {
|
|
5789
|
-
networkID: networkID,
|
|
5790
|
-
adUnit: adUnit,
|
|
5791
|
-
className: 'AD300x250',
|
|
5792
|
-
targeting: targeting,
|
|
5793
|
-
sizes: [[300, 250], [300, 600], [300, 100]]
|
|
5794
|
-
});
|
|
5795
|
-
};
|
|
5796
|
-
|
|
5797
|
-
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
5798
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5799
|
-
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
5800
|
-
function parseAssetId(ref) {
|
|
5801
|
-
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
5802
|
-
if (!id || !dimensionString || !format) {
|
|
5803
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
5804
|
-
}
|
|
5805
|
-
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
5806
|
-
var width = +imgWidthStr;
|
|
5807
|
-
var height = +imgHeightStr;
|
|
5808
|
-
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
5809
|
-
if (!isValidAssetId) {
|
|
5810
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
5811
|
-
}
|
|
5812
|
-
return { id: id, width: width, height: height, format: format };
|
|
5813
|
-
}
|
|
5814
|
-
exports.default = parseAssetId;
|
|
5815
|
-
|
|
5816
|
-
});
|
|
5817
|
-
|
|
5818
|
-
unwrapExports(parseAssetId_1);
|
|
5819
|
-
|
|
5820
|
-
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
5821
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
5822
|
-
__assign = Object.assign || function(t) {
|
|
5823
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5824
|
-
s = arguments[i];
|
|
5825
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
5826
|
-
t[p] = s[p];
|
|
5827
|
-
}
|
|
5828
|
-
return t;
|
|
5829
|
-
};
|
|
5830
|
-
return __assign.apply(this, arguments);
|
|
5831
|
-
};
|
|
5832
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5833
|
-
var isRef = function (src) {
|
|
5834
|
-
var source = src;
|
|
5835
|
-
return source ? typeof source._ref === 'string' : false;
|
|
5836
|
-
};
|
|
5837
|
-
var isAsset = function (src) {
|
|
5838
|
-
var source = src;
|
|
5839
|
-
return source ? typeof source._id === 'string' : false;
|
|
5840
|
-
};
|
|
5841
|
-
var isAssetStub = function (src) {
|
|
5842
|
-
var source = src;
|
|
5843
|
-
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
5844
|
-
};
|
|
5845
|
-
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
5846
|
-
// eslint-disable-next-line complexity
|
|
5847
|
-
function parseSource(source) {
|
|
5848
|
-
if (!source) {
|
|
5849
|
-
return null;
|
|
5850
|
-
}
|
|
5851
|
-
var image;
|
|
5852
|
-
if (typeof source === 'string' && isUrl(source)) {
|
|
5853
|
-
// Someone passed an existing image url?
|
|
5854
|
-
image = {
|
|
5855
|
-
asset: { _ref: urlToId(source) }
|
|
5856
|
-
};
|
|
5857
|
-
}
|
|
5858
|
-
else if (typeof source === 'string') {
|
|
5859
|
-
// Just an asset id
|
|
5860
|
-
image = {
|
|
5861
|
-
asset: { _ref: source }
|
|
5862
|
-
};
|
|
5863
|
-
}
|
|
5864
|
-
else if (isRef(source)) {
|
|
5865
|
-
// We just got passed an asset directly
|
|
5866
|
-
image = {
|
|
5867
|
-
asset: source
|
|
5868
|
-
};
|
|
5869
|
-
}
|
|
5870
|
-
else if (isAsset(source)) {
|
|
5871
|
-
// If we were passed an image asset document
|
|
5872
|
-
image = {
|
|
5873
|
-
asset: {
|
|
5874
|
-
_ref: source._id || ''
|
|
5875
|
-
}
|
|
5876
|
-
};
|
|
5877
|
-
}
|
|
5878
|
-
else if (isAssetStub(source)) {
|
|
5879
|
-
// If we were passed a partial asset (`url`, but no `_id`)
|
|
5880
|
-
image = {
|
|
5881
|
-
asset: {
|
|
5882
|
-
_ref: urlToId(source.asset.url)
|
|
5883
|
-
}
|
|
5884
|
-
};
|
|
5885
|
-
}
|
|
5886
|
-
else if (typeof source.asset === 'object') {
|
|
5887
|
-
// Probably an actual image with materialized asset
|
|
5888
|
-
image = source;
|
|
5889
|
-
}
|
|
5890
|
-
else {
|
|
5891
|
-
// We got something that does not look like an image, or it is an image
|
|
5892
|
-
// that currently isn't sporting an asset.
|
|
5893
|
-
return null;
|
|
5894
|
-
}
|
|
5895
|
-
var img = source;
|
|
5896
|
-
if (img.crop) {
|
|
5897
|
-
image.crop = img.crop;
|
|
5898
|
-
}
|
|
5899
|
-
if (img.hotspot) {
|
|
5900
|
-
image.hotspot = img.hotspot;
|
|
5901
|
-
}
|
|
5902
|
-
return applyDefaults(image);
|
|
5903
|
-
}
|
|
5904
|
-
exports.default = parseSource;
|
|
5905
|
-
function isUrl(url) {
|
|
5906
|
-
return /^https?:\/\//.test("" + url);
|
|
5907
|
-
}
|
|
5908
|
-
function urlToId(url) {
|
|
5909
|
-
var parts = url.split('/').slice(-1);
|
|
5910
|
-
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
5911
|
-
}
|
|
5912
|
-
// Mock crop and hotspot if image lacks it
|
|
5913
|
-
function applyDefaults(image) {
|
|
5914
|
-
if (image.crop && image.hotspot) {
|
|
5915
|
-
return image;
|
|
5916
|
-
}
|
|
5917
|
-
// We need to pad in default values for crop or hotspot
|
|
5918
|
-
var result = __assign({}, image);
|
|
5919
|
-
if (!result.crop) {
|
|
5920
|
-
result.crop = {
|
|
5921
|
-
left: 0,
|
|
5922
|
-
top: 0,
|
|
5923
|
-
bottom: 0,
|
|
5924
|
-
right: 0
|
|
5925
|
-
};
|
|
5926
|
-
}
|
|
5927
|
-
if (!result.hotspot) {
|
|
5928
|
-
result.hotspot = {
|
|
5929
|
-
x: 0.5,
|
|
5930
|
-
y: 0.5,
|
|
5931
|
-
height: 1.0,
|
|
5932
|
-
width: 1.0
|
|
5933
|
-
};
|
|
5934
|
-
}
|
|
5935
|
-
return result;
|
|
5936
|
-
}
|
|
5937
|
-
|
|
5938
|
-
});
|
|
5939
|
-
|
|
5940
|
-
unwrapExports(parseSource_1);
|
|
5941
|
-
|
|
5942
|
-
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
5943
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
5944
|
-
__assign = Object.assign || function(t) {
|
|
5945
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5946
|
-
s = arguments[i];
|
|
5947
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
5948
|
-
t[p] = s[p];
|
|
5949
|
-
}
|
|
5950
|
-
return t;
|
|
5951
|
-
};
|
|
5952
|
-
return __assign.apply(this, arguments);
|
|
5953
|
-
};
|
|
5954
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
5955
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5956
|
-
};
|
|
5957
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5958
|
-
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
5959
|
-
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
5960
|
-
exports.parseSource = parseSource_1$$1.default;
|
|
5961
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
5962
|
-
['width', 'w'],
|
|
5963
|
-
['height', 'h'],
|
|
5964
|
-
['format', 'fm'],
|
|
5965
|
-
['download', 'dl'],
|
|
5966
|
-
['blur', 'blur'],
|
|
5967
|
-
['sharpen', 'sharp'],
|
|
5968
|
-
['invert', 'invert'],
|
|
5969
|
-
['orientation', 'or'],
|
|
5970
|
-
['minHeight', 'min-h'],
|
|
5971
|
-
['maxHeight', 'max-h'],
|
|
5972
|
-
['minWidth', 'min-w'],
|
|
5973
|
-
['maxWidth', 'max-w'],
|
|
5974
|
-
['quality', 'q'],
|
|
5975
|
-
['fit', 'fit'],
|
|
5976
|
-
['crop', 'crop'],
|
|
5977
|
-
['auto', 'auto'],
|
|
5978
|
-
['dpr', 'dpr']
|
|
5979
|
-
];
|
|
5980
|
-
function urlForImage(options) {
|
|
5981
|
-
var spec = __assign({}, (options || {}));
|
|
5982
|
-
var source = spec.source;
|
|
5983
|
-
delete spec.source;
|
|
5984
|
-
var image = parseSource_1$$1.default(source);
|
|
5985
|
-
if (!image) {
|
|
5986
|
-
return null;
|
|
5987
|
-
}
|
|
5988
|
-
var id = image.asset._ref || image.asset._id || '';
|
|
5989
|
-
var asset = parseAssetId_1$$1.default(id);
|
|
5990
|
-
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
5991
|
-
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
5992
|
-
var cropTop = Math.round(image.crop.top * asset.height);
|
|
5993
|
-
var crop = {
|
|
5994
|
-
left: cropLeft,
|
|
5995
|
-
top: cropTop,
|
|
5996
|
-
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
5997
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
5998
|
-
};
|
|
5999
|
-
// Compute hot spot rect in terms of pixel coordinates
|
|
6000
|
-
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
6001
|
-
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
6002
|
-
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
6003
|
-
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
6004
|
-
var hotspot = {
|
|
6005
|
-
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
6006
|
-
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
6007
|
-
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
6008
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
6009
|
-
};
|
|
6010
|
-
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
6011
|
-
// the crop/hotspot.
|
|
6012
|
-
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
6013
|
-
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
6014
|
-
}
|
|
6015
|
-
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
6016
|
-
}
|
|
6017
|
-
exports.default = urlForImage;
|
|
6018
|
-
// eslint-disable-next-line complexity
|
|
6019
|
-
function specToImageUrl(spec) {
|
|
6020
|
-
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
6021
|
-
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
6022
|
-
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
6023
|
-
var params = [];
|
|
6024
|
-
if (spec.rect) {
|
|
6025
|
-
// Only bother url with a crop if it actually crops anything
|
|
6026
|
-
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
6027
|
-
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
6028
|
-
if (isEffectiveCrop) {
|
|
6029
|
-
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
6030
|
-
}
|
|
6031
|
-
}
|
|
6032
|
-
if (spec.bg) {
|
|
6033
|
-
params.push("bg=" + spec.bg);
|
|
6034
|
-
}
|
|
6035
|
-
if (spec.focalPoint) {
|
|
6036
|
-
params.push("fp-x=" + spec.focalPoint.x);
|
|
6037
|
-
params.push("fp-x=" + spec.focalPoint.y);
|
|
6038
|
-
}
|
|
6039
|
-
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
6040
|
-
if (flip) {
|
|
6041
|
-
params.push("flip=" + flip);
|
|
6042
|
-
}
|
|
6043
|
-
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
6044
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
6045
|
-
var specName = mapping[0], param = mapping[1];
|
|
6046
|
-
if (typeof spec[specName] !== 'undefined') {
|
|
6047
|
-
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
6048
|
-
}
|
|
6049
|
-
else if (typeof spec[param] !== 'undefined') {
|
|
6050
|
-
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
6051
|
-
}
|
|
6052
|
-
});
|
|
6053
|
-
if (params.length === 0) {
|
|
6054
|
-
return baseUrl;
|
|
6055
|
-
}
|
|
6056
|
-
return baseUrl + "?" + params.join('&');
|
|
6057
|
-
}
|
|
6058
|
-
function fit(source, spec) {
|
|
6059
|
-
var cropRect;
|
|
6060
|
-
var imgWidth = spec.width;
|
|
6061
|
-
var imgHeight = spec.height;
|
|
6062
|
-
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
6063
|
-
if (!(imgWidth && imgHeight)) {
|
|
6064
|
-
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
6065
|
-
}
|
|
6066
|
-
var crop = source.crop;
|
|
6067
|
-
var hotspot = source.hotspot;
|
|
6068
|
-
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
6069
|
-
var desiredAspectRatio = imgWidth / imgHeight;
|
|
6070
|
-
var cropAspectRatio = crop.width / crop.height;
|
|
6071
|
-
if (cropAspectRatio > desiredAspectRatio) {
|
|
6072
|
-
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
6073
|
-
var height = crop.height;
|
|
6074
|
-
var width = height * desiredAspectRatio;
|
|
6075
|
-
var top_2 = crop.top;
|
|
6076
|
-
// Center output horizontally over hotspot
|
|
6077
|
-
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
6078
|
-
var left = hotspotXCenter - width / 2;
|
|
6079
|
-
// Keep output within crop
|
|
6080
|
-
if (left < crop.left) {
|
|
6081
|
-
left = crop.left;
|
|
6082
|
-
}
|
|
6083
|
-
else if (left + width > crop.left + crop.width) {
|
|
6084
|
-
left = crop.left + crop.width - width;
|
|
6085
|
-
}
|
|
6086
|
-
cropRect = {
|
|
6087
|
-
left: Math.round(left),
|
|
6088
|
-
top: Math.round(top_2),
|
|
6089
|
-
width: Math.round(width),
|
|
6090
|
-
height: Math.round(height)
|
|
6091
|
-
};
|
|
6092
|
-
}
|
|
6093
|
-
else {
|
|
6094
|
-
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
6095
|
-
var width = crop.width;
|
|
6096
|
-
var height = width / desiredAspectRatio;
|
|
6097
|
-
var left = crop.left;
|
|
6098
|
-
// Center output vertically over hotspot
|
|
6099
|
-
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
6100
|
-
var top_3 = hotspotYCenter - height / 2;
|
|
6101
|
-
// Keep output rect within crop
|
|
6102
|
-
if (top_3 < crop.top) {
|
|
6103
|
-
top_3 = crop.top;
|
|
6104
|
-
}
|
|
6105
|
-
else if (top_3 + height > crop.top + crop.height) {
|
|
6106
|
-
top_3 = crop.top + crop.height - height;
|
|
6107
|
-
}
|
|
6108
|
-
cropRect = {
|
|
6109
|
-
left: Math.max(0, Math.floor(left)),
|
|
6110
|
-
top: Math.max(0, Math.floor(top_3)),
|
|
6111
|
-
width: Math.round(width),
|
|
6112
|
-
height: Math.round(height)
|
|
6113
|
-
};
|
|
6114
|
-
}
|
|
6115
|
-
return {
|
|
6116
|
-
width: imgWidth,
|
|
6117
|
-
height: imgHeight,
|
|
6118
|
-
rect: cropRect
|
|
6119
|
-
};
|
|
6120
|
-
}
|
|
5116
|
+
)
|
|
5117
|
+
);
|
|
5118
|
+
};
|
|
6121
5119
|
|
|
6122
|
-
|
|
5120
|
+
var AD = function AD(_ref) {
|
|
5121
|
+
var networkID = _ref.networkID,
|
|
5122
|
+
adUnit = _ref.adUnit,
|
|
5123
|
+
sizeMapping = _ref.sizeMapping,
|
|
5124
|
+
className = _ref.className,
|
|
5125
|
+
slotId = _ref.slotId,
|
|
5126
|
+
sizes = _ref.sizes,
|
|
5127
|
+
minInViewPercent = _ref.minInViewPercent,
|
|
5128
|
+
_ref$targeting = _ref.targeting,
|
|
5129
|
+
targeting = _ref$targeting === undefined ? { desktop: {} } : _ref$targeting;
|
|
6123
5130
|
|
|
6124
|
-
unwrapExports(urlForImage_1);
|
|
6125
|
-
var urlForImage_2 = urlForImage_1.parseSource;
|
|
6126
|
-
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6127
5131
|
|
|
6128
|
-
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
}
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
var result = {};
|
|
6143
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6144
|
-
result["default"] = mod;
|
|
6145
|
-
return result;
|
|
5132
|
+
return React__default.createElement(
|
|
5133
|
+
lib_1,
|
|
5134
|
+
{ dfpNetworkId: networkID, targetingArguments: targeting.desktop, sizeMapping: sizeMapping, lazyLoad: { fetchMarginPercent: 500, renderMarginPercent: 200, mobileScaling: 2.0 } },
|
|
5135
|
+
React__default.createElement(
|
|
5136
|
+
'div',
|
|
5137
|
+
{ className: className },
|
|
5138
|
+
React__default.createElement(lib_2, {
|
|
5139
|
+
slotId: slotId,
|
|
5140
|
+
sizes: sizes,
|
|
5141
|
+
adUnit: adUnit,
|
|
5142
|
+
sizeMapping: sizeMapping
|
|
5143
|
+
})
|
|
5144
|
+
)
|
|
5145
|
+
);
|
|
6146
5146
|
};
|
|
6147
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6148
|
-
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
6149
|
-
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
6150
|
-
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
6151
|
-
var validAutoModes = ['format'];
|
|
6152
|
-
function isSanityClient(client) {
|
|
6153
|
-
return client ? typeof client.clientConfig === 'object' : false;
|
|
6154
|
-
}
|
|
6155
|
-
function rewriteSpecName(key) {
|
|
6156
|
-
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6157
|
-
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
6158
|
-
var entry = specs_1[_i];
|
|
6159
|
-
var specName = entry[0], param = entry[1];
|
|
6160
|
-
if (key === specName || key === param) {
|
|
6161
|
-
return specName;
|
|
6162
|
-
}
|
|
6163
|
-
}
|
|
6164
|
-
return key;
|
|
6165
|
-
}
|
|
6166
|
-
function urlBuilder(options) {
|
|
6167
|
-
// Did we get a SanityClient?
|
|
6168
|
-
var client = options;
|
|
6169
|
-
if (isSanityClient(client)) {
|
|
6170
|
-
// Inherit config from client
|
|
6171
|
-
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
6172
|
-
return new ImageUrlBuilder(null, {
|
|
6173
|
-
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
6174
|
-
projectId: projectId,
|
|
6175
|
-
dataset: dataset
|
|
6176
|
-
});
|
|
6177
|
-
}
|
|
6178
|
-
// Or just accept the options as given
|
|
6179
|
-
return new ImageUrlBuilder(null, options);
|
|
6180
|
-
}
|
|
6181
|
-
exports.default = urlBuilder;
|
|
6182
|
-
var ImageUrlBuilder = /** @class */ (function () {
|
|
6183
|
-
function ImageUrlBuilder(parent, options) {
|
|
6184
|
-
this.options = parent
|
|
6185
|
-
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
6186
|
-
}
|
|
6187
|
-
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
6188
|
-
var baseUrl = options.baseUrl || '';
|
|
6189
|
-
var newOptions = { baseUrl: baseUrl };
|
|
6190
|
-
for (var key in options) {
|
|
6191
|
-
if (options.hasOwnProperty(key)) {
|
|
6192
|
-
var specKey = rewriteSpecName(key);
|
|
6193
|
-
newOptions[specKey] = options[key];
|
|
6194
|
-
}
|
|
6195
|
-
}
|
|
6196
|
-
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
6197
|
-
};
|
|
6198
|
-
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
6199
|
-
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
6200
|
-
// studio, the 'image'-document must be provided.
|
|
6201
|
-
ImageUrlBuilder.prototype.image = function (source) {
|
|
6202
|
-
return this.withOptions({ source: source });
|
|
6203
|
-
};
|
|
6204
|
-
// Specify the dataset
|
|
6205
|
-
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
6206
|
-
return this.withOptions({ dataset: dataset });
|
|
6207
|
-
};
|
|
6208
|
-
// Specify the projectId
|
|
6209
|
-
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
6210
|
-
return this.withOptions({ projectId: projectId });
|
|
6211
|
-
};
|
|
6212
|
-
// Specify background color
|
|
6213
|
-
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
6214
|
-
return this.withOptions({ bg: bg });
|
|
6215
|
-
};
|
|
6216
|
-
// Set DPR scaling factor
|
|
6217
|
-
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
6218
|
-
return this.withOptions({ dpr: dpr });
|
|
6219
|
-
};
|
|
6220
|
-
// Specify the width of the image in pixels
|
|
6221
|
-
ImageUrlBuilder.prototype.width = function (width) {
|
|
6222
|
-
return this.withOptions({ width: width });
|
|
6223
|
-
};
|
|
6224
|
-
// Specify the height of the image in pixels
|
|
6225
|
-
ImageUrlBuilder.prototype.height = function (height) {
|
|
6226
|
-
return this.withOptions({ height: height });
|
|
6227
|
-
};
|
|
6228
|
-
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
6229
|
-
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
6230
|
-
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
6231
|
-
};
|
|
6232
|
-
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
6233
|
-
return this.withOptions({ maxWidth: maxWidth });
|
|
6234
|
-
};
|
|
6235
|
-
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
6236
|
-
return this.withOptions({ minWidth: minWidth });
|
|
6237
|
-
};
|
|
6238
|
-
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
6239
|
-
return this.withOptions({ maxHeight: maxHeight });
|
|
6240
|
-
};
|
|
6241
|
-
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
6242
|
-
return this.withOptions({ minHeight: minHeight });
|
|
6243
|
-
};
|
|
6244
|
-
// Specify width and height in pixels
|
|
6245
|
-
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
6246
|
-
return this.withOptions({ width: width, height: height });
|
|
6247
|
-
};
|
|
6248
|
-
// Specify blur between 0 and 100
|
|
6249
|
-
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
6250
|
-
return this.withOptions({ blur: blur });
|
|
6251
|
-
};
|
|
6252
|
-
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
6253
|
-
return this.withOptions({ sharpen: sharpen });
|
|
6254
|
-
};
|
|
6255
|
-
// Specify the desired rectangle of the image
|
|
6256
|
-
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
6257
|
-
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
6258
|
-
};
|
|
6259
|
-
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
6260
|
-
ImageUrlBuilder.prototype.format = function (format) {
|
|
6261
|
-
return this.withOptions({ format: format });
|
|
6262
|
-
};
|
|
6263
|
-
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
6264
|
-
return this.withOptions({ invert: invert });
|
|
6265
|
-
};
|
|
6266
|
-
// Rotation in degrees 0, 90, 180, 270
|
|
6267
|
-
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
6268
|
-
return this.withOptions({ orientation: orientation });
|
|
6269
|
-
};
|
|
6270
|
-
// Compression quality 0-100
|
|
6271
|
-
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
6272
|
-
return this.withOptions({ quality: quality });
|
|
6273
|
-
};
|
|
6274
|
-
// Make it a download link. Parameter is default filename.
|
|
6275
|
-
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
6276
|
-
return this.withOptions({ download: download });
|
|
6277
|
-
};
|
|
6278
|
-
// Flip image horizontally
|
|
6279
|
-
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
6280
|
-
return this.withOptions({ flipHorizontal: true });
|
|
6281
|
-
};
|
|
6282
|
-
// Flip image verically
|
|
6283
|
-
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
6284
|
-
return this.withOptions({ flipVertical: true });
|
|
6285
|
-
};
|
|
6286
|
-
// Ignore crop/hotspot from image record, even when present
|
|
6287
|
-
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
6288
|
-
return this.withOptions({ ignoreImageParams: true });
|
|
6289
|
-
};
|
|
6290
|
-
ImageUrlBuilder.prototype.fit = function (value) {
|
|
6291
|
-
if (validFits.indexOf(value) === -1) {
|
|
6292
|
-
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
6293
|
-
}
|
|
6294
|
-
return this.withOptions({ fit: value });
|
|
6295
|
-
};
|
|
6296
|
-
ImageUrlBuilder.prototype.crop = function (value) {
|
|
6297
|
-
if (validCrops.indexOf(value) === -1) {
|
|
6298
|
-
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
6299
|
-
}
|
|
6300
|
-
return this.withOptions({ crop: value });
|
|
6301
|
-
};
|
|
6302
|
-
ImageUrlBuilder.prototype.auto = function (value) {
|
|
6303
|
-
if (validAutoModes.indexOf(value) === -1) {
|
|
6304
|
-
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
6305
|
-
}
|
|
6306
|
-
return this.withOptions({ auto: value });
|
|
6307
|
-
};
|
|
6308
|
-
// Gets the url based on the submitted parameters
|
|
6309
|
-
ImageUrlBuilder.prototype.url = function () {
|
|
6310
|
-
return urlForImage_1$$1.default(this.options);
|
|
6311
|
-
};
|
|
6312
|
-
// Synonym for url()
|
|
6313
|
-
ImageUrlBuilder.prototype.toString = function () {
|
|
6314
|
-
return this.url();
|
|
6315
|
-
};
|
|
6316
|
-
return ImageUrlBuilder;
|
|
6317
|
-
}());
|
|
6318
5147
|
|
|
6319
|
-
|
|
5148
|
+
AD.propTypes = {
|
|
5149
|
+
networkID: PropTypes.string.isRequired,
|
|
5150
|
+
adUnit: PropTypes.string.isRequired,
|
|
5151
|
+
slotId: PropTypes.string,
|
|
5152
|
+
className: PropTypes.string,
|
|
5153
|
+
sizeMapping: PropTypes.array,
|
|
5154
|
+
sizes: PropTypes.array,
|
|
5155
|
+
minInViewPercent: PropTypes.number
|
|
5156
|
+
};
|
|
6320
5157
|
|
|
6321
|
-
|
|
5158
|
+
var AD300x250 = function AD300x250(_ref) {
|
|
5159
|
+
var networkID = _ref.networkID,
|
|
5160
|
+
adUnit = _ref.adUnit,
|
|
5161
|
+
targeting = _ref.targeting;
|
|
6322
5162
|
|
|
6323
|
-
|
|
6324
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6325
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5163
|
+
return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x250', sizes: [[300, 250], [300, 100]] });
|
|
6326
5164
|
};
|
|
6327
|
-
var builder_1 = __importDefault(builder);
|
|
6328
|
-
module.exports = builder_1.default;
|
|
6329
5165
|
|
|
6330
|
-
|
|
5166
|
+
var AD300x250x600 = function AD300x250x600(_ref) {
|
|
5167
|
+
var networkID = _ref.networkID,
|
|
5168
|
+
adUnit = _ref.adUnit,
|
|
5169
|
+
targeting = _ref.targeting;
|
|
6331
5170
|
|
|
6332
|
-
|
|
5171
|
+
return React__default.createElement(AD, {
|
|
5172
|
+
networkID: networkID,
|
|
5173
|
+
adUnit: adUnit,
|
|
5174
|
+
className: 'AD300x250',
|
|
5175
|
+
targeting: targeting,
|
|
5176
|
+
sizes: [[300, 250], [300, 600], [300, 100]]
|
|
5177
|
+
});
|
|
5178
|
+
};
|
|
6333
5179
|
|
|
6334
5180
|
var FigureComponent = function FigureComponent(_ref) {
|
|
6335
5181
|
var caption = _ref.caption,
|
|
@@ -6384,7 +5230,7 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
6384
5230
|
);
|
|
6385
5231
|
};
|
|
6386
5232
|
|
|
6387
|
-
var isArray
|
|
5233
|
+
var isArray = Array.isArray;
|
|
6388
5234
|
var keyList = Object.keys;
|
|
6389
5235
|
var hasProp = Object.prototype.hasOwnProperty;
|
|
6390
5236
|
|
|
@@ -6392,8 +5238,8 @@ var fastDeepEqual = function equal(a, b) {
|
|
|
6392
5238
|
if (a === b) return true;
|
|
6393
5239
|
|
|
6394
5240
|
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
6395
|
-
var arrA = isArray
|
|
6396
|
-
, arrB = isArray
|
|
5241
|
+
var arrA = isArray(a)
|
|
5242
|
+
, arrB = isArray(b)
|
|
6397
5243
|
, i
|
|
6398
5244
|
, length
|
|
6399
5245
|
, key;
|
|
@@ -7475,7 +6321,7 @@ function format(f) {
|
|
|
7475
6321
|
}
|
|
7476
6322
|
});
|
|
7477
6323
|
for (var x = args[i]; i < len; x = args[++i]) {
|
|
7478
|
-
if (isNull(x) || !isObject
|
|
6324
|
+
if (isNull(x) || !isObject(x)) {
|
|
7479
6325
|
str += ' ' + x;
|
|
7480
6326
|
} else {
|
|
7481
6327
|
str += ' ' + inspect(x);
|
|
@@ -7626,7 +6472,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7626
6472
|
// Check that value is an object with an inspect function on it
|
|
7627
6473
|
if (ctx.customInspect &&
|
|
7628
6474
|
value &&
|
|
7629
|
-
isFunction
|
|
6475
|
+
isFunction(value.inspect) &&
|
|
7630
6476
|
// Filter out the util module, it's inspect function is special
|
|
7631
6477
|
value.inspect !== inspect &&
|
|
7632
6478
|
// Also filter out any prototype objects using the circular check.
|
|
@@ -7661,7 +6507,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7661
6507
|
|
|
7662
6508
|
// Some type of object without properties can be shortcutted.
|
|
7663
6509
|
if (keys.length === 0) {
|
|
7664
|
-
if (isFunction
|
|
6510
|
+
if (isFunction(value)) {
|
|
7665
6511
|
var name = value.name ? ': ' + value.name : '';
|
|
7666
6512
|
return ctx.stylize('[Function' + name + ']', 'special');
|
|
7667
6513
|
}
|
|
@@ -7679,13 +6525,13 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7679
6525
|
var base = '', array = false, braces = ['{', '}'];
|
|
7680
6526
|
|
|
7681
6527
|
// Make Array say that they are Array
|
|
7682
|
-
if (isArray$
|
|
6528
|
+
if (isArray$1(value)) {
|
|
7683
6529
|
array = true;
|
|
7684
6530
|
braces = ['[', ']'];
|
|
7685
6531
|
}
|
|
7686
6532
|
|
|
7687
6533
|
// Make functions say that they are functions
|
|
7688
|
-
if (isFunction
|
|
6534
|
+
if (isFunction(value)) {
|
|
7689
6535
|
var n = value.name ? ': ' + value.name : '';
|
|
7690
6536
|
base = ' [Function' + n + ']';
|
|
7691
6537
|
}
|
|
@@ -7761,7 +6607,7 @@ function formatError(value) {
|
|
|
7761
6607
|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
7762
6608
|
var output = [];
|
|
7763
6609
|
for (var i = 0, l = value.length; i < l; ++i) {
|
|
7764
|
-
if (hasOwnProperty
|
|
6610
|
+
if (hasOwnProperty(value, String(i))) {
|
|
7765
6611
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
7766
6612
|
String(i), true));
|
|
7767
6613
|
} else {
|
|
@@ -7792,7 +6638,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
|
7792
6638
|
str = ctx.stylize('[Setter]', 'special');
|
|
7793
6639
|
}
|
|
7794
6640
|
}
|
|
7795
|
-
if (!hasOwnProperty
|
|
6641
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
|
7796
6642
|
name = '[' + key + ']';
|
|
7797
6643
|
}
|
|
7798
6644
|
if (!str) {
|
|
@@ -7858,7 +6704,7 @@ function reduceToSingleString(output, base, braces) {
|
|
|
7858
6704
|
|
|
7859
6705
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
7860
6706
|
// because it is fragile and can be easily faked with `Object.create()`.
|
|
7861
|
-
function isArray$
|
|
6707
|
+
function isArray$1(ar) {
|
|
7862
6708
|
return Array.isArray(ar);
|
|
7863
6709
|
}
|
|
7864
6710
|
|
|
@@ -7882,7 +6728,7 @@ function isString(arg) {
|
|
|
7882
6728
|
return typeof arg === 'string';
|
|
7883
6729
|
}
|
|
7884
6730
|
|
|
7885
|
-
function isSymbol
|
|
6731
|
+
function isSymbol(arg) {
|
|
7886
6732
|
return typeof arg === 'symbol';
|
|
7887
6733
|
}
|
|
7888
6734
|
|
|
@@ -7891,23 +6737,23 @@ function isUndefined(arg) {
|
|
|
7891
6737
|
}
|
|
7892
6738
|
|
|
7893
6739
|
function isRegExp(re) {
|
|
7894
|
-
return isObject
|
|
6740
|
+
return isObject(re) && objectToString(re) === '[object RegExp]';
|
|
7895
6741
|
}
|
|
7896
6742
|
|
|
7897
|
-
function isObject
|
|
6743
|
+
function isObject(arg) {
|
|
7898
6744
|
return typeof arg === 'object' && arg !== null;
|
|
7899
6745
|
}
|
|
7900
6746
|
|
|
7901
6747
|
function isDate(d) {
|
|
7902
|
-
return isObject
|
|
6748
|
+
return isObject(d) && objectToString(d) === '[object Date]';
|
|
7903
6749
|
}
|
|
7904
6750
|
|
|
7905
6751
|
function isError(e) {
|
|
7906
|
-
return isObject
|
|
7907
|
-
(objectToString
|
|
6752
|
+
return isObject(e) &&
|
|
6753
|
+
(objectToString(e) === '[object Error]' || e instanceof Error);
|
|
7908
6754
|
}
|
|
7909
6755
|
|
|
7910
|
-
function isFunction
|
|
6756
|
+
function isFunction(arg) {
|
|
7911
6757
|
return typeof arg === 'function';
|
|
7912
6758
|
}
|
|
7913
6759
|
|
|
@@ -7924,7 +6770,7 @@ function isBuffer(maybeBuf) {
|
|
|
7924
6770
|
return Buffer.isBuffer(maybeBuf);
|
|
7925
6771
|
}
|
|
7926
6772
|
|
|
7927
|
-
function objectToString
|
|
6773
|
+
function objectToString(o) {
|
|
7928
6774
|
return Object.prototype.toString.call(o);
|
|
7929
6775
|
}
|
|
7930
6776
|
|
|
@@ -7954,7 +6800,7 @@ function log() {
|
|
|
7954
6800
|
|
|
7955
6801
|
function _extend(origin, add) {
|
|
7956
6802
|
// Don't do anything if add isn't an object
|
|
7957
|
-
if (!add || !isObject
|
|
6803
|
+
if (!add || !isObject(add)) return origin;
|
|
7958
6804
|
|
|
7959
6805
|
var keys = Object.keys(add);
|
|
7960
6806
|
var i = keys.length;
|
|
@@ -7963,7 +6809,7 @@ function _extend(origin, add) {
|
|
|
7963
6809
|
}
|
|
7964
6810
|
return origin;
|
|
7965
6811
|
}
|
|
7966
|
-
function hasOwnProperty
|
|
6812
|
+
function hasOwnProperty(obj, prop) {
|
|
7967
6813
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
7968
6814
|
}
|
|
7969
6815
|
|
|
@@ -7973,19 +6819,19 @@ var util = {
|
|
|
7973
6819
|
log: log,
|
|
7974
6820
|
isBuffer: isBuffer,
|
|
7975
6821
|
isPrimitive: isPrimitive,
|
|
7976
|
-
isFunction: isFunction
|
|
6822
|
+
isFunction: isFunction,
|
|
7977
6823
|
isError: isError,
|
|
7978
6824
|
isDate: isDate,
|
|
7979
|
-
isObject: isObject
|
|
6825
|
+
isObject: isObject,
|
|
7980
6826
|
isRegExp: isRegExp,
|
|
7981
6827
|
isUndefined: isUndefined,
|
|
7982
|
-
isSymbol: isSymbol
|
|
6828
|
+
isSymbol: isSymbol,
|
|
7983
6829
|
isString: isString,
|
|
7984
6830
|
isNumber: isNumber,
|
|
7985
6831
|
isNullOrUndefined: isNullOrUndefined,
|
|
7986
6832
|
isNull: isNull,
|
|
7987
6833
|
isBoolean: isBoolean,
|
|
7988
|
-
isArray: isArray$
|
|
6834
|
+
isArray: isArray$1,
|
|
7989
6835
|
inspect: inspect,
|
|
7990
6836
|
deprecate: deprecate,
|
|
7991
6837
|
format: format,
|
|
@@ -9014,7 +7860,7 @@ object-assign
|
|
|
9014
7860
|
*/
|
|
9015
7861
|
/* eslint-disable no-unused-vars */
|
|
9016
7862
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
9017
|
-
var hasOwnProperty$
|
|
7863
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
9018
7864
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
9019
7865
|
|
|
9020
7866
|
function toObject(val) {
|
|
@@ -9078,7 +7924,7 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
|
|
|
9078
7924
|
from = Object(arguments[s]);
|
|
9079
7925
|
|
|
9080
7926
|
for (var key in from) {
|
|
9081
|
-
if (hasOwnProperty$
|
|
7927
|
+
if (hasOwnProperty$1.call(from, key)) {
|
|
9082
7928
|
to[key] = from[key];
|
|
9083
7929
|
}
|
|
9084
7930
|
}
|