@mjhls/mjh-framework 1.0.50 → 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 +1 -1
- package/dist/index.es.js +1008 -2082
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1007 -2081
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -503,1523 +503,879 @@ var getYoutubeId = createCommonjsModule(function (module, exports) {
|
|
|
503
503
|
}));
|
|
504
504
|
});
|
|
505
505
|
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
function defineProperties(target, props) {
|
|
514
|
-
for (var i = 0; i < props.length; i++) {
|
|
515
|
-
var descriptor = props[i];
|
|
516
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
517
|
-
descriptor.configurable = true;
|
|
518
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
519
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
506
|
+
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
507
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
508
|
+
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
509
|
+
function parseAssetId(ref) {
|
|
510
|
+
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
511
|
+
if (!id || !dimensionString || !format) {
|
|
512
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
520
513
|
}
|
|
521
|
-
|
|
514
|
+
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
515
|
+
var width = +imgWidthStr;
|
|
516
|
+
var height = +imgHeightStr;
|
|
517
|
+
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
518
|
+
if (!isValidAssetId) {
|
|
519
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
520
|
+
}
|
|
521
|
+
return { id: id, width: width, height: height, format: format };
|
|
522
|
+
}
|
|
523
|
+
exports.default = parseAssetId;
|
|
522
524
|
|
|
523
|
-
|
|
524
|
-
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
525
|
-
if (staticProps) defineProperties(Constructor, staticProps);
|
|
526
|
-
return Constructor;
|
|
527
|
-
};
|
|
528
|
-
}();
|
|
525
|
+
});
|
|
529
526
|
|
|
530
|
-
|
|
531
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
532
|
-
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
533
|
-
}
|
|
527
|
+
unwrapExports(parseAssetId_1);
|
|
534
528
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
529
|
+
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
530
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
531
|
+
__assign = Object.assign || function(t) {
|
|
532
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
533
|
+
s = arguments[i];
|
|
534
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
535
|
+
t[p] = s[p];
|
|
536
|
+
}
|
|
537
|
+
return t;
|
|
538
|
+
};
|
|
539
|
+
return __assign.apply(this, arguments);
|
|
544
540
|
};
|
|
545
|
-
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
541
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
542
|
+
var isRef = function (src) {
|
|
543
|
+
var source = src;
|
|
544
|
+
return source ? typeof source._ref === 'string' : false;
|
|
552
545
|
};
|
|
553
|
-
|
|
554
|
-
var
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
var
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
}
|
|
567
|
-
} catch (err) {
|
|
568
|
-
_d = true;
|
|
569
|
-
_e = err;
|
|
570
|
-
} finally {
|
|
571
|
-
try {
|
|
572
|
-
if (!_n && _i["return"]) _i["return"]();
|
|
573
|
-
} finally {
|
|
574
|
-
if (_d) throw _e;
|
|
575
|
-
}
|
|
546
|
+
var isAsset = function (src) {
|
|
547
|
+
var source = src;
|
|
548
|
+
return source ? typeof source._id === 'string' : false;
|
|
549
|
+
};
|
|
550
|
+
var isAssetStub = function (src) {
|
|
551
|
+
var source = src;
|
|
552
|
+
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
553
|
+
};
|
|
554
|
+
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
555
|
+
// eslint-disable-next-line complexity
|
|
556
|
+
function parseSource(source) {
|
|
557
|
+
if (!source) {
|
|
558
|
+
return null;
|
|
576
559
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
return arr;
|
|
584
|
-
} else if (Symbol.iterator in Object(arr)) {
|
|
585
|
-
return sliceIterator(arr, i);
|
|
586
|
-
} else {
|
|
587
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
560
|
+
var image;
|
|
561
|
+
if (typeof source === 'string' && isUrl(source)) {
|
|
562
|
+
// Someone passed an existing image url?
|
|
563
|
+
image = {
|
|
564
|
+
asset: { _ref: urlToId(source) }
|
|
565
|
+
};
|
|
588
566
|
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
595
|
-
|
|
596
|
-
return arr2;
|
|
597
|
-
} else {
|
|
598
|
-
return Array.from(arr);
|
|
599
|
-
}
|
|
600
|
-
};
|
|
601
|
-
|
|
602
|
-
var DeckContent = function (_React$Component) {
|
|
603
|
-
inherits(DeckContent, _React$Component);
|
|
604
|
-
|
|
605
|
-
function DeckContent() {
|
|
606
|
-
var _ref;
|
|
607
|
-
|
|
608
|
-
var _temp, _this, _ret;
|
|
609
|
-
|
|
610
|
-
classCallCheck(this, DeckContent);
|
|
611
|
-
|
|
612
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
613
|
-
args[_key] = arguments[_key];
|
|
567
|
+
else if (typeof source === 'string') {
|
|
568
|
+
// Just an asset id
|
|
569
|
+
image = {
|
|
570
|
+
asset: { _ref: source }
|
|
571
|
+
};
|
|
614
572
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}, _this.loadMore = function () {
|
|
627
|
-
setTimeout(function () {
|
|
628
|
-
_this.setState(function (state) {
|
|
629
|
-
return {
|
|
630
|
-
page: state.page + 1,
|
|
631
|
-
from: state.from + state.per,
|
|
632
|
-
to: state.to + state.per
|
|
633
|
-
};
|
|
634
|
-
}, _this.loadData);
|
|
635
|
-
}, 10);
|
|
636
|
-
}, _this.loadData = function () {
|
|
637
|
-
var _this$state = _this.state,
|
|
638
|
-
from = _this$state.from,
|
|
639
|
-
to = _this$state.to,
|
|
640
|
-
data = _this$state.data,
|
|
641
|
-
query = _this$state.query;
|
|
642
|
-
var client = _this.props.client;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
var params = { from: from, to: to };
|
|
646
|
-
var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
|
|
647
|
-
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
648
|
-
|
|
649
|
-
if (_this.pointer && _this.pointerArray) {
|
|
650
|
-
var pointer = _this.pointer;
|
|
651
|
-
client.fetch(queryUpdated).then(function (dataArr) {
|
|
652
|
-
_this.setState(function (state, props) {
|
|
653
|
-
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
654
|
-
return {
|
|
655
|
-
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
|
|
656
|
-
scrolling: true
|
|
657
|
-
};
|
|
658
|
-
} else {
|
|
659
|
-
return {
|
|
660
|
-
scrolling: false
|
|
661
|
-
};
|
|
573
|
+
else if (isRef(source)) {
|
|
574
|
+
// We just got passed an asset directly
|
|
575
|
+
image = {
|
|
576
|
+
asset: source
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
else if (isAsset(source)) {
|
|
580
|
+
// If we were passed an image asset document
|
|
581
|
+
image = {
|
|
582
|
+
asset: {
|
|
583
|
+
_ref: source._id || ''
|
|
662
584
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
|
|
671
|
-
scrolling: true
|
|
672
|
-
};
|
|
673
|
-
} else {
|
|
674
|
-
return {
|
|
675
|
-
scrolling: false
|
|
676
|
-
};
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
else if (isAssetStub(source)) {
|
|
588
|
+
// If we were passed a partial asset (`url`, but no `_id`)
|
|
589
|
+
image = {
|
|
590
|
+
asset: {
|
|
591
|
+
_ref: urlToId(source.asset.url)
|
|
677
592
|
}
|
|
678
|
-
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
}, _this.renderCardImage = function (row, page) {
|
|
682
|
-
if (row.thumbnail && row.thumbnail.asset) {
|
|
683
|
-
return row.thumbnail.asset.url;
|
|
684
|
-
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
685
|
-
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
686
|
-
} else {
|
|
687
|
-
return _this.defaultImage;
|
|
688
|
-
}
|
|
689
|
-
}, _this.cardLoader = function (page, columns, variant) {
|
|
690
|
-
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
691
|
-
|
|
692
|
-
var itemCounter = 0;
|
|
693
|
-
var lgVar = 12;
|
|
694
|
-
return React__default.createElement(
|
|
695
|
-
Row,
|
|
696
|
-
null,
|
|
697
|
-
_this.state.data && _this.state.data.map(function (row, index) {
|
|
698
|
-
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
699
|
-
lgVar = 12;
|
|
700
|
-
} else if (columns && columns !== 'rotate') {
|
|
701
|
-
lgVar = Math.floor(12 / columns);
|
|
702
|
-
} else {
|
|
703
|
-
lgVar = 6;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
return React__default.createElement(
|
|
707
|
-
Col,
|
|
708
|
-
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
709
|
-
React__default.createElement(
|
|
710
|
-
Card,
|
|
711
|
-
{ className: 'content-card', style: { flexDirection: mode } },
|
|
712
|
-
React__default.createElement(
|
|
713
|
-
Link,
|
|
714
|
-
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
715
|
-
React__default.createElement(
|
|
716
|
-
'a',
|
|
717
|
-
null,
|
|
718
|
-
React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
|
|
719
|
-
)
|
|
720
|
-
),
|
|
721
|
-
React__default.createElement(
|
|
722
|
-
Card.Body,
|
|
723
|
-
null,
|
|
724
|
-
React__default.createElement(
|
|
725
|
-
Link,
|
|
726
|
-
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
727
|
-
React__default.createElement(
|
|
728
|
-
'a',
|
|
729
|
-
null,
|
|
730
|
-
React__default.createElement(
|
|
731
|
-
Card.Title,
|
|
732
|
-
null,
|
|
733
|
-
row.title
|
|
734
|
-
),
|
|
735
|
-
React__default.createElement(
|
|
736
|
-
Card.Text,
|
|
737
|
-
null,
|
|
738
|
-
row.summary
|
|
739
|
-
)
|
|
740
|
-
)
|
|
741
|
-
)
|
|
742
|
-
)
|
|
743
|
-
)
|
|
744
|
-
);
|
|
745
|
-
})
|
|
746
|
-
);
|
|
747
|
-
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
createClass(DeckContent, [{
|
|
751
|
-
key: 'componentDidUpdate',
|
|
752
|
-
value: function componentDidUpdate(prevProps, prevState) {
|
|
753
|
-
if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
|
|
754
|
-
// eslint-disable-next-line react/no-did-update-set-state
|
|
755
|
-
this.setState({
|
|
756
|
-
data: this.props.dataRecord,
|
|
757
|
-
dataKeptToCompareNewDatarecord: this.props.dataRecord,
|
|
758
|
-
per: this.props.params ? this.props.params.to : 2,
|
|
759
|
-
page: 1,
|
|
760
|
-
from: this.props.params ? this.props.params.from : 0,
|
|
761
|
-
to: this.props.params ? this.props.params.to : 2,
|
|
762
|
-
total_pages: null,
|
|
763
|
-
scrolling: true,
|
|
764
|
-
query: this.props.query
|
|
765
|
-
});
|
|
766
|
-
}
|
|
593
|
+
};
|
|
767
594
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
// this.loadData();
|
|
595
|
+
else if (typeof source.asset === 'object') {
|
|
596
|
+
// Probably an actual image with materialized asset
|
|
597
|
+
image = source;
|
|
772
598
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
var _props = this.props,
|
|
779
|
-
columns = _props.columns,
|
|
780
|
-
variant = _props.variant,
|
|
781
|
-
autoScroll = _props.autoScroll,
|
|
782
|
-
page = _props.page;
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
return React__default.createElement(
|
|
786
|
-
'div',
|
|
787
|
-
{ className: 'contentDeck' },
|
|
788
|
-
autoScroll ? React__default.createElement(
|
|
789
|
-
React__default.Fragment,
|
|
790
|
-
null,
|
|
791
|
-
React__default.createElement(
|
|
792
|
-
InfiniteScroll,
|
|
793
|
-
{ dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
|
|
794
|
-
this.cardLoader(page, columns, variant)
|
|
795
|
-
),
|
|
796
|
-
React__default.createElement(
|
|
797
|
-
'noscript',
|
|
798
|
-
null,
|
|
799
|
-
'Manual Pagination Here'
|
|
800
|
-
)
|
|
801
|
-
) : React__default.createElement(
|
|
802
|
-
React__default.Fragment,
|
|
803
|
-
null,
|
|
804
|
-
this.cardLoader(page, columns, variant),
|
|
805
|
-
React__default.createElement(
|
|
806
|
-
'div',
|
|
807
|
-
{ style: { padding: '0px 10px' } },
|
|
808
|
-
this.state.scrolling ? React__default.createElement(
|
|
809
|
-
'button',
|
|
810
|
-
{
|
|
811
|
-
style: { margin: 'auto', width: '100%' },
|
|
812
|
-
onClick: function onClick(e) {
|
|
813
|
-
_this2.loadMore();
|
|
814
|
-
} },
|
|
815
|
-
'Load More'
|
|
816
|
-
) : React__default.createElement(
|
|
817
|
-
'p',
|
|
818
|
-
{ style: { textAlign: 'center' } },
|
|
819
|
-
React__default.createElement(
|
|
820
|
-
'b',
|
|
821
|
-
null,
|
|
822
|
-
'End of data'
|
|
823
|
-
)
|
|
824
|
-
)
|
|
825
|
-
),
|
|
826
|
-
React__default.createElement(
|
|
827
|
-
'noscript',
|
|
828
|
-
null,
|
|
829
|
-
'Manual Pagination Here'
|
|
830
|
-
)
|
|
831
|
-
)
|
|
832
|
-
);
|
|
599
|
+
else {
|
|
600
|
+
// We got something that does not look like an image, or it is an image
|
|
601
|
+
// that currently isn't sporting an asset.
|
|
602
|
+
return null;
|
|
833
603
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
/**
|
|
839
|
-
* Checks if `value` is classified as an `Array` object.
|
|
840
|
-
*
|
|
841
|
-
* @static
|
|
842
|
-
* @memberOf _
|
|
843
|
-
* @since 0.1.0
|
|
844
|
-
* @category Lang
|
|
845
|
-
* @param {*} value The value to check.
|
|
846
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
847
|
-
* @example
|
|
848
|
-
*
|
|
849
|
-
* _.isArray([1, 2, 3]);
|
|
850
|
-
* // => true
|
|
851
|
-
*
|
|
852
|
-
* _.isArray(document.body.children);
|
|
853
|
-
* // => false
|
|
854
|
-
*
|
|
855
|
-
* _.isArray('abc');
|
|
856
|
-
* // => false
|
|
857
|
-
*
|
|
858
|
-
* _.isArray(_.noop);
|
|
859
|
-
* // => false
|
|
860
|
-
*/
|
|
861
|
-
var isArray = Array.isArray;
|
|
862
|
-
|
|
863
|
-
var isArray_1 = isArray;
|
|
864
|
-
|
|
865
|
-
/** Detect free variable `global` from Node.js. */
|
|
866
|
-
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
867
|
-
|
|
868
|
-
var _freeGlobal = freeGlobal;
|
|
869
|
-
|
|
870
|
-
/** Detect free variable `self`. */
|
|
871
|
-
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
872
|
-
|
|
873
|
-
/** Used as a reference to the global object. */
|
|
874
|
-
var root = _freeGlobal || freeSelf || Function('return this')();
|
|
875
|
-
|
|
876
|
-
var _root = root;
|
|
877
|
-
|
|
878
|
-
/** Built-in value references. */
|
|
879
|
-
var Symbol$1 = _root.Symbol;
|
|
880
|
-
|
|
881
|
-
var _Symbol = Symbol$1;
|
|
882
|
-
|
|
883
|
-
/** Used for built-in method references. */
|
|
884
|
-
var objectProto = Object.prototype;
|
|
885
|
-
|
|
886
|
-
/** Used to check objects for own properties. */
|
|
887
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
888
|
-
|
|
889
|
-
/**
|
|
890
|
-
* Used to resolve the
|
|
891
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
892
|
-
* of values.
|
|
893
|
-
*/
|
|
894
|
-
var nativeObjectToString = objectProto.toString;
|
|
895
|
-
|
|
896
|
-
/** Built-in value references. */
|
|
897
|
-
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
|
898
|
-
|
|
899
|
-
/**
|
|
900
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
901
|
-
*
|
|
902
|
-
* @private
|
|
903
|
-
* @param {*} value The value to query.
|
|
904
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
905
|
-
*/
|
|
906
|
-
function getRawTag(value) {
|
|
907
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
|
908
|
-
tag = value[symToStringTag];
|
|
909
|
-
|
|
910
|
-
try {
|
|
911
|
-
value[symToStringTag] = undefined;
|
|
912
|
-
} catch (e) {}
|
|
913
|
-
|
|
914
|
-
var result = nativeObjectToString.call(value);
|
|
915
|
-
{
|
|
916
|
-
if (isOwn) {
|
|
917
|
-
value[symToStringTag] = tag;
|
|
918
|
-
} else {
|
|
919
|
-
delete value[symToStringTag];
|
|
604
|
+
var img = source;
|
|
605
|
+
if (img.crop) {
|
|
606
|
+
image.crop = img.crop;
|
|
920
607
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
var _getRawTag = getRawTag;
|
|
926
|
-
|
|
927
|
-
/** Used for built-in method references. */
|
|
928
|
-
var objectProto$1 = Object.prototype;
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* Used to resolve the
|
|
932
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
933
|
-
* of values.
|
|
934
|
-
*/
|
|
935
|
-
var nativeObjectToString$1 = objectProto$1.toString;
|
|
936
|
-
|
|
937
|
-
/**
|
|
938
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
939
|
-
*
|
|
940
|
-
* @private
|
|
941
|
-
* @param {*} value The value to convert.
|
|
942
|
-
* @returns {string} Returns the converted string.
|
|
943
|
-
*/
|
|
944
|
-
function objectToString(value) {
|
|
945
|
-
return nativeObjectToString$1.call(value);
|
|
608
|
+
if (img.hotspot) {
|
|
609
|
+
image.hotspot = img.hotspot;
|
|
610
|
+
}
|
|
611
|
+
return applyDefaults(image);
|
|
946
612
|
}
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
/** `Object#toString` result references. */
|
|
951
|
-
var nullTag = '[object Null]',
|
|
952
|
-
undefinedTag = '[object Undefined]';
|
|
953
|
-
|
|
954
|
-
/** Built-in value references. */
|
|
955
|
-
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
|
956
|
-
|
|
957
|
-
/**
|
|
958
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
959
|
-
*
|
|
960
|
-
* @private
|
|
961
|
-
* @param {*} value The value to query.
|
|
962
|
-
* @returns {string} Returns the `toStringTag`.
|
|
963
|
-
*/
|
|
964
|
-
function baseGetTag(value) {
|
|
965
|
-
if (value == null) {
|
|
966
|
-
return value === undefined ? undefinedTag : nullTag;
|
|
967
|
-
}
|
|
968
|
-
return (symToStringTag$1 && symToStringTag$1 in Object(value))
|
|
969
|
-
? _getRawTag(value)
|
|
970
|
-
: _objectToString(value);
|
|
613
|
+
exports.default = parseSource;
|
|
614
|
+
function isUrl(url) {
|
|
615
|
+
return /^https?:\/\//.test("" + url);
|
|
971
616
|
}
|
|
972
|
-
|
|
973
|
-
var
|
|
974
|
-
|
|
975
|
-
/**
|
|
976
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
977
|
-
* and has a `typeof` result of "object".
|
|
978
|
-
*
|
|
979
|
-
* @static
|
|
980
|
-
* @memberOf _
|
|
981
|
-
* @since 4.0.0
|
|
982
|
-
* @category Lang
|
|
983
|
-
* @param {*} value The value to check.
|
|
984
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
985
|
-
* @example
|
|
986
|
-
*
|
|
987
|
-
* _.isObjectLike({});
|
|
988
|
-
* // => true
|
|
989
|
-
*
|
|
990
|
-
* _.isObjectLike([1, 2, 3]);
|
|
991
|
-
* // => true
|
|
992
|
-
*
|
|
993
|
-
* _.isObjectLike(_.noop);
|
|
994
|
-
* // => false
|
|
995
|
-
*
|
|
996
|
-
* _.isObjectLike(null);
|
|
997
|
-
* // => false
|
|
998
|
-
*/
|
|
999
|
-
function isObjectLike(value) {
|
|
1000
|
-
return value != null && typeof value == 'object';
|
|
617
|
+
function urlToId(url) {
|
|
618
|
+
var parts = url.split('/').slice(-1);
|
|
619
|
+
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
1001
620
|
}
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
return typeof value == 'symbol' ||
|
|
1027
|
-
(isObjectLike_1(value) && _baseGetTag(value) == symbolTag);
|
|
621
|
+
// Mock crop and hotspot if image lacks it
|
|
622
|
+
function applyDefaults(image) {
|
|
623
|
+
if (image.crop && image.hotspot) {
|
|
624
|
+
return image;
|
|
625
|
+
}
|
|
626
|
+
// We need to pad in default values for crop or hotspot
|
|
627
|
+
var result = __assign({}, image);
|
|
628
|
+
if (!result.crop) {
|
|
629
|
+
result.crop = {
|
|
630
|
+
left: 0,
|
|
631
|
+
top: 0,
|
|
632
|
+
bottom: 0,
|
|
633
|
+
right: 0
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
if (!result.hotspot) {
|
|
637
|
+
result.hotspot = {
|
|
638
|
+
x: 0.5,
|
|
639
|
+
y: 0.5,
|
|
640
|
+
height: 1.0,
|
|
641
|
+
width: 1.0
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
return result;
|
|
1028
645
|
}
|
|
1029
646
|
|
|
1030
|
-
|
|
647
|
+
});
|
|
1031
648
|
|
|
1032
|
-
|
|
1033
|
-
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1034
|
-
reIsPlainProp = /^\w*$/;
|
|
649
|
+
unwrapExports(parseSource_1);
|
|
1035
650
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
return
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
651
|
+
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
652
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
653
|
+
__assign = Object.assign || function(t) {
|
|
654
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
655
|
+
s = arguments[i];
|
|
656
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
657
|
+
t[p] = s[p];
|
|
658
|
+
}
|
|
659
|
+
return t;
|
|
660
|
+
};
|
|
661
|
+
return __assign.apply(this, arguments);
|
|
662
|
+
};
|
|
663
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
664
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
665
|
+
};
|
|
666
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
667
|
+
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
668
|
+
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
669
|
+
exports.parseSource = parseSource_1$$1.default;
|
|
670
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
671
|
+
['width', 'w'],
|
|
672
|
+
['height', 'h'],
|
|
673
|
+
['format', 'fm'],
|
|
674
|
+
['download', 'dl'],
|
|
675
|
+
['blur', 'blur'],
|
|
676
|
+
['sharpen', 'sharp'],
|
|
677
|
+
['invert', 'invert'],
|
|
678
|
+
['orientation', 'or'],
|
|
679
|
+
['minHeight', 'min-h'],
|
|
680
|
+
['maxHeight', 'max-h'],
|
|
681
|
+
['minWidth', 'min-w'],
|
|
682
|
+
['maxWidth', 'max-w'],
|
|
683
|
+
['quality', 'q'],
|
|
684
|
+
['fit', 'fit'],
|
|
685
|
+
['crop', 'crop'],
|
|
686
|
+
['auto', 'auto'],
|
|
687
|
+
['dpr', 'dpr']
|
|
688
|
+
];
|
|
689
|
+
function urlForImage(options) {
|
|
690
|
+
var spec = __assign({}, (options || {}));
|
|
691
|
+
var source = spec.source;
|
|
692
|
+
delete spec.source;
|
|
693
|
+
var image = parseSource_1$$1.default(source);
|
|
694
|
+
if (!image) {
|
|
695
|
+
return null;
|
|
696
|
+
}
|
|
697
|
+
var id = image.asset._ref || image.asset._id || '';
|
|
698
|
+
var asset = parseAssetId_1$$1.default(id);
|
|
699
|
+
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
700
|
+
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
701
|
+
var cropTop = Math.round(image.crop.top * asset.height);
|
|
702
|
+
var crop = {
|
|
703
|
+
left: cropLeft,
|
|
704
|
+
top: cropTop,
|
|
705
|
+
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
706
|
+
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
707
|
+
};
|
|
708
|
+
// Compute hot spot rect in terms of pixel coordinates
|
|
709
|
+
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
710
|
+
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
711
|
+
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
712
|
+
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
713
|
+
var hotspot = {
|
|
714
|
+
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
715
|
+
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
716
|
+
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
717
|
+
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
718
|
+
};
|
|
719
|
+
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
720
|
+
// the crop/hotspot.
|
|
721
|
+
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
722
|
+
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
723
|
+
}
|
|
724
|
+
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
1055
725
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
726
|
+
exports.default = urlForImage;
|
|
727
|
+
// eslint-disable-next-line complexity
|
|
728
|
+
function specToImageUrl(spec) {
|
|
729
|
+
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
730
|
+
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
731
|
+
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
732
|
+
var params = [];
|
|
733
|
+
if (spec.rect) {
|
|
734
|
+
// Only bother url with a crop if it actually crops anything
|
|
735
|
+
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
736
|
+
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
737
|
+
if (isEffectiveCrop) {
|
|
738
|
+
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
if (spec.bg) {
|
|
742
|
+
params.push("bg=" + spec.bg);
|
|
743
|
+
}
|
|
744
|
+
if (spec.focalPoint) {
|
|
745
|
+
params.push("fp-x=" + spec.focalPoint.x);
|
|
746
|
+
params.push("fp-x=" + spec.focalPoint.y);
|
|
747
|
+
}
|
|
748
|
+
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
749
|
+
if (flip) {
|
|
750
|
+
params.push("flip=" + flip);
|
|
751
|
+
}
|
|
752
|
+
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
753
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
754
|
+
var specName = mapping[0], param = mapping[1];
|
|
755
|
+
if (typeof spec[specName] !== 'undefined') {
|
|
756
|
+
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
757
|
+
}
|
|
758
|
+
else if (typeof spec[param] !== 'undefined') {
|
|
759
|
+
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
if (params.length === 0) {
|
|
763
|
+
return baseUrl;
|
|
764
|
+
}
|
|
765
|
+
return baseUrl + "?" + params.join('&');
|
|
1087
766
|
}
|
|
1088
|
-
|
|
1089
|
-
var
|
|
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
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
767
|
+
function fit(source, spec) {
|
|
768
|
+
var cropRect;
|
|
769
|
+
var imgWidth = spec.width;
|
|
770
|
+
var imgHeight = spec.height;
|
|
771
|
+
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
772
|
+
if (!(imgWidth && imgHeight)) {
|
|
773
|
+
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
774
|
+
}
|
|
775
|
+
var crop = source.crop;
|
|
776
|
+
var hotspot = source.hotspot;
|
|
777
|
+
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
778
|
+
var desiredAspectRatio = imgWidth / imgHeight;
|
|
779
|
+
var cropAspectRatio = crop.width / crop.height;
|
|
780
|
+
if (cropAspectRatio > desiredAspectRatio) {
|
|
781
|
+
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
782
|
+
var height = crop.height;
|
|
783
|
+
var width = height * desiredAspectRatio;
|
|
784
|
+
var top_2 = crop.top;
|
|
785
|
+
// Center output horizontally over hotspot
|
|
786
|
+
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
787
|
+
var left = hotspotXCenter - width / 2;
|
|
788
|
+
// Keep output within crop
|
|
789
|
+
if (left < crop.left) {
|
|
790
|
+
left = crop.left;
|
|
791
|
+
}
|
|
792
|
+
else if (left + width > crop.left + crop.width) {
|
|
793
|
+
left = crop.left + crop.width - width;
|
|
794
|
+
}
|
|
795
|
+
cropRect = {
|
|
796
|
+
left: Math.round(left),
|
|
797
|
+
top: Math.round(top_2),
|
|
798
|
+
width: Math.round(width),
|
|
799
|
+
height: Math.round(height)
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
804
|
+
var width = crop.width;
|
|
805
|
+
var height = width / desiredAspectRatio;
|
|
806
|
+
var left = crop.left;
|
|
807
|
+
// Center output vertically over hotspot
|
|
808
|
+
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
809
|
+
var top_3 = hotspotYCenter - height / 2;
|
|
810
|
+
// Keep output rect within crop
|
|
811
|
+
if (top_3 < crop.top) {
|
|
812
|
+
top_3 = crop.top;
|
|
813
|
+
}
|
|
814
|
+
else if (top_3 + height > crop.top + crop.height) {
|
|
815
|
+
top_3 = crop.top + crop.height - height;
|
|
816
|
+
}
|
|
817
|
+
cropRect = {
|
|
818
|
+
left: Math.max(0, Math.floor(left)),
|
|
819
|
+
top: Math.max(0, Math.floor(top_3)),
|
|
820
|
+
width: Math.round(width),
|
|
821
|
+
height: Math.round(height)
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
return {
|
|
825
|
+
width: imgWidth,
|
|
826
|
+
height: imgHeight,
|
|
827
|
+
rect: cropRect
|
|
828
|
+
};
|
|
1122
829
|
}
|
|
1123
830
|
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
/** Used to detect overreaching core-js shims. */
|
|
1127
|
-
var coreJsData = _root['__core-js_shared__'];
|
|
1128
|
-
|
|
1129
|
-
var _coreJsData = coreJsData;
|
|
831
|
+
});
|
|
1130
832
|
|
|
1131
|
-
|
|
1132
|
-
var
|
|
1133
|
-
|
|
1134
|
-
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
1135
|
-
}());
|
|
833
|
+
unwrapExports(urlForImage_1);
|
|
834
|
+
var urlForImage_2 = urlForImage_1.parseSource;
|
|
835
|
+
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
1136
836
|
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
837
|
+
var builder = createCommonjsModule(function (module, exports) {
|
|
838
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
839
|
+
__assign = Object.assign || function(t) {
|
|
840
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
841
|
+
s = arguments[i];
|
|
842
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
843
|
+
t[p] = s[p];
|
|
844
|
+
}
|
|
845
|
+
return t;
|
|
846
|
+
};
|
|
847
|
+
return __assign.apply(this, arguments);
|
|
848
|
+
};
|
|
849
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
850
|
+
if (mod && mod.__esModule) return mod;
|
|
851
|
+
var result = {};
|
|
852
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
853
|
+
result["default"] = mod;
|
|
854
|
+
return result;
|
|
855
|
+
};
|
|
856
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
857
|
+
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
858
|
+
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
859
|
+
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
860
|
+
var validAutoModes = ['format'];
|
|
861
|
+
function isSanityClient(client) {
|
|
862
|
+
return client ? typeof client.clientConfig === 'object' : false;
|
|
1146
863
|
}
|
|
1147
|
-
|
|
1148
|
-
var
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
var
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
* Converts `func` to its source code.
|
|
1158
|
-
*
|
|
1159
|
-
* @private
|
|
1160
|
-
* @param {Function} func The function to convert.
|
|
1161
|
-
* @returns {string} Returns the source code.
|
|
1162
|
-
*/
|
|
1163
|
-
function toSource(func) {
|
|
1164
|
-
if (func != null) {
|
|
1165
|
-
try {
|
|
1166
|
-
return funcToString.call(func);
|
|
1167
|
-
} catch (e) {}
|
|
1168
|
-
try {
|
|
1169
|
-
return (func + '');
|
|
1170
|
-
} catch (e) {}
|
|
1171
|
-
}
|
|
1172
|
-
return '';
|
|
864
|
+
function rewriteSpecName(key) {
|
|
865
|
+
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
866
|
+
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
867
|
+
var entry = specs_1[_i];
|
|
868
|
+
var specName = entry[0], param = entry[1];
|
|
869
|
+
if (key === specName || key === param) {
|
|
870
|
+
return specName;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
return key;
|
|
1173
874
|
}
|
|
875
|
+
function urlBuilder(options) {
|
|
876
|
+
// Did we get a SanityClient?
|
|
877
|
+
var client = options;
|
|
878
|
+
if (isSanityClient(client)) {
|
|
879
|
+
// Inherit config from client
|
|
880
|
+
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
881
|
+
return new ImageUrlBuilder(null, {
|
|
882
|
+
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
883
|
+
projectId: projectId,
|
|
884
|
+
dataset: dataset
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
// Or just accept the options as given
|
|
888
|
+
return new ImageUrlBuilder(null, options);
|
|
889
|
+
}
|
|
890
|
+
exports.default = urlBuilder;
|
|
891
|
+
var ImageUrlBuilder = /** @class */ (function () {
|
|
892
|
+
function ImageUrlBuilder(parent, options) {
|
|
893
|
+
this.options = parent
|
|
894
|
+
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
895
|
+
}
|
|
896
|
+
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
897
|
+
var baseUrl = options.baseUrl || '';
|
|
898
|
+
var newOptions = { baseUrl: baseUrl };
|
|
899
|
+
for (var key in options) {
|
|
900
|
+
if (options.hasOwnProperty(key)) {
|
|
901
|
+
var specKey = rewriteSpecName(key);
|
|
902
|
+
newOptions[specKey] = options[key];
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
906
|
+
};
|
|
907
|
+
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
908
|
+
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
909
|
+
// studio, the 'image'-document must be provided.
|
|
910
|
+
ImageUrlBuilder.prototype.image = function (source) {
|
|
911
|
+
return this.withOptions({ source: source });
|
|
912
|
+
};
|
|
913
|
+
// Specify the dataset
|
|
914
|
+
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
915
|
+
return this.withOptions({ dataset: dataset });
|
|
916
|
+
};
|
|
917
|
+
// Specify the projectId
|
|
918
|
+
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
919
|
+
return this.withOptions({ projectId: projectId });
|
|
920
|
+
};
|
|
921
|
+
// Specify background color
|
|
922
|
+
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
923
|
+
return this.withOptions({ bg: bg });
|
|
924
|
+
};
|
|
925
|
+
// Set DPR scaling factor
|
|
926
|
+
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
927
|
+
return this.withOptions({ dpr: dpr });
|
|
928
|
+
};
|
|
929
|
+
// Specify the width of the image in pixels
|
|
930
|
+
ImageUrlBuilder.prototype.width = function (width) {
|
|
931
|
+
return this.withOptions({ width: width });
|
|
932
|
+
};
|
|
933
|
+
// Specify the height of the image in pixels
|
|
934
|
+
ImageUrlBuilder.prototype.height = function (height) {
|
|
935
|
+
return this.withOptions({ height: height });
|
|
936
|
+
};
|
|
937
|
+
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
938
|
+
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
939
|
+
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
940
|
+
};
|
|
941
|
+
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
942
|
+
return this.withOptions({ maxWidth: maxWidth });
|
|
943
|
+
};
|
|
944
|
+
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
945
|
+
return this.withOptions({ minWidth: minWidth });
|
|
946
|
+
};
|
|
947
|
+
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
948
|
+
return this.withOptions({ maxHeight: maxHeight });
|
|
949
|
+
};
|
|
950
|
+
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
951
|
+
return this.withOptions({ minHeight: minHeight });
|
|
952
|
+
};
|
|
953
|
+
// Specify width and height in pixels
|
|
954
|
+
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
955
|
+
return this.withOptions({ width: width, height: height });
|
|
956
|
+
};
|
|
957
|
+
// Specify blur between 0 and 100
|
|
958
|
+
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
959
|
+
return this.withOptions({ blur: blur });
|
|
960
|
+
};
|
|
961
|
+
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
962
|
+
return this.withOptions({ sharpen: sharpen });
|
|
963
|
+
};
|
|
964
|
+
// Specify the desired rectangle of the image
|
|
965
|
+
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
966
|
+
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
967
|
+
};
|
|
968
|
+
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
969
|
+
ImageUrlBuilder.prototype.format = function (format) {
|
|
970
|
+
return this.withOptions({ format: format });
|
|
971
|
+
};
|
|
972
|
+
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
973
|
+
return this.withOptions({ invert: invert });
|
|
974
|
+
};
|
|
975
|
+
// Rotation in degrees 0, 90, 180, 270
|
|
976
|
+
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
977
|
+
return this.withOptions({ orientation: orientation });
|
|
978
|
+
};
|
|
979
|
+
// Compression quality 0-100
|
|
980
|
+
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
981
|
+
return this.withOptions({ quality: quality });
|
|
982
|
+
};
|
|
983
|
+
// Make it a download link. Parameter is default filename.
|
|
984
|
+
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
985
|
+
return this.withOptions({ download: download });
|
|
986
|
+
};
|
|
987
|
+
// Flip image horizontally
|
|
988
|
+
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
989
|
+
return this.withOptions({ flipHorizontal: true });
|
|
990
|
+
};
|
|
991
|
+
// Flip image verically
|
|
992
|
+
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
993
|
+
return this.withOptions({ flipVertical: true });
|
|
994
|
+
};
|
|
995
|
+
// Ignore crop/hotspot from image record, even when present
|
|
996
|
+
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
997
|
+
return this.withOptions({ ignoreImageParams: true });
|
|
998
|
+
};
|
|
999
|
+
ImageUrlBuilder.prototype.fit = function (value) {
|
|
1000
|
+
if (validFits.indexOf(value) === -1) {
|
|
1001
|
+
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
1002
|
+
}
|
|
1003
|
+
return this.withOptions({ fit: value });
|
|
1004
|
+
};
|
|
1005
|
+
ImageUrlBuilder.prototype.crop = function (value) {
|
|
1006
|
+
if (validCrops.indexOf(value) === -1) {
|
|
1007
|
+
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
1008
|
+
}
|
|
1009
|
+
return this.withOptions({ crop: value });
|
|
1010
|
+
};
|
|
1011
|
+
ImageUrlBuilder.prototype.auto = function (value) {
|
|
1012
|
+
if (validAutoModes.indexOf(value) === -1) {
|
|
1013
|
+
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
1014
|
+
}
|
|
1015
|
+
return this.withOptions({ auto: value });
|
|
1016
|
+
};
|
|
1017
|
+
// Gets the url based on the submitted parameters
|
|
1018
|
+
ImageUrlBuilder.prototype.url = function () {
|
|
1019
|
+
return urlForImage_1$$1.default(this.options);
|
|
1020
|
+
};
|
|
1021
|
+
// Synonym for url()
|
|
1022
|
+
ImageUrlBuilder.prototype.toString = function () {
|
|
1023
|
+
return this.url();
|
|
1024
|
+
};
|
|
1025
|
+
return ImageUrlBuilder;
|
|
1026
|
+
}());
|
|
1174
1027
|
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* Used to match `RegExp`
|
|
1179
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
1180
|
-
*/
|
|
1181
|
-
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
1182
|
-
|
|
1183
|
-
/** Used to detect host constructors (Safari). */
|
|
1184
|
-
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
1028
|
+
});
|
|
1185
1029
|
|
|
1186
|
-
|
|
1187
|
-
var funcProto$1 = Function.prototype,
|
|
1188
|
-
objectProto$2 = Object.prototype;
|
|
1030
|
+
unwrapExports(builder);
|
|
1189
1031
|
|
|
1190
|
-
|
|
1191
|
-
var
|
|
1032
|
+
var node = createCommonjsModule(function (module) {
|
|
1033
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
1034
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1035
|
+
};
|
|
1036
|
+
var builder_1 = __importDefault(builder);
|
|
1037
|
+
module.exports = builder_1.default;
|
|
1192
1038
|
|
|
1193
|
-
|
|
1194
|
-
var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
|
1039
|
+
});
|
|
1195
1040
|
|
|
1196
|
-
|
|
1197
|
-
var reIsNative = RegExp('^' +
|
|
1198
|
-
funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
|
|
1199
|
-
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
1200
|
-
);
|
|
1041
|
+
var imageUrlBuilder = unwrapExports(node);
|
|
1201
1042
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
* @private
|
|
1206
|
-
* @param {*} value The value to check.
|
|
1207
|
-
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
1208
|
-
* else `false`.
|
|
1209
|
-
*/
|
|
1210
|
-
function baseIsNative(value) {
|
|
1211
|
-
if (!isObject_1(value) || _isMasked(value)) {
|
|
1212
|
-
return false;
|
|
1043
|
+
var classCallCheck = function (instance, Constructor) {
|
|
1044
|
+
if (!(instance instanceof Constructor)) {
|
|
1045
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1213
1046
|
}
|
|
1214
|
-
|
|
1215
|
-
return pattern.test(_toSource(value));
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
var _baseIsNative = baseIsNative;
|
|
1219
|
-
|
|
1220
|
-
/**
|
|
1221
|
-
* Gets the value at `key` of `object`.
|
|
1222
|
-
*
|
|
1223
|
-
* @private
|
|
1224
|
-
* @param {Object} [object] The object to query.
|
|
1225
|
-
* @param {string} key The key of the property to get.
|
|
1226
|
-
* @returns {*} Returns the property value.
|
|
1227
|
-
*/
|
|
1228
|
-
function getValue(object, key) {
|
|
1229
|
-
return object == null ? undefined : object[key];
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
var _getValue = getValue;
|
|
1233
|
-
|
|
1234
|
-
/**
|
|
1235
|
-
* Gets the native function at `key` of `object`.
|
|
1236
|
-
*
|
|
1237
|
-
* @private
|
|
1238
|
-
* @param {Object} object The object to query.
|
|
1239
|
-
* @param {string} key The key of the method to get.
|
|
1240
|
-
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
1241
|
-
*/
|
|
1242
|
-
function getNative(object, key) {
|
|
1243
|
-
var value = _getValue(object, key);
|
|
1244
|
-
return _baseIsNative(value) ? value : undefined;
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
var _getNative = getNative;
|
|
1047
|
+
};
|
|
1248
1048
|
|
|
1249
|
-
|
|
1250
|
-
|
|
1049
|
+
var createClass = function () {
|
|
1050
|
+
function defineProperties(target, props) {
|
|
1051
|
+
for (var i = 0; i < props.length; i++) {
|
|
1052
|
+
var descriptor = props[i];
|
|
1053
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1054
|
+
descriptor.configurable = true;
|
|
1055
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1056
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1251
1059
|
|
|
1252
|
-
|
|
1060
|
+
return function (Constructor, protoProps, staticProps) {
|
|
1061
|
+
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
|
1062
|
+
if (staticProps) defineProperties(Constructor, staticProps);
|
|
1063
|
+
return Constructor;
|
|
1064
|
+
};
|
|
1065
|
+
}();
|
|
1253
1066
|
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
* @name clear
|
|
1259
|
-
* @memberOf Hash
|
|
1260
|
-
*/
|
|
1261
|
-
function hashClear() {
|
|
1262
|
-
this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
|
1263
|
-
this.size = 0;
|
|
1264
|
-
}
|
|
1067
|
+
var inherits = function (subClass, superClass) {
|
|
1068
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
1069
|
+
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
|
1070
|
+
}
|
|
1265
1071
|
|
|
1266
|
-
|
|
1072
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1073
|
+
constructor: {
|
|
1074
|
+
value: subClass,
|
|
1075
|
+
enumerable: false,
|
|
1076
|
+
writable: true,
|
|
1077
|
+
configurable: true
|
|
1078
|
+
}
|
|
1079
|
+
});
|
|
1080
|
+
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
|
1081
|
+
};
|
|
1267
1082
|
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
* @name delete
|
|
1273
|
-
* @memberOf Hash
|
|
1274
|
-
* @param {Object} hash The hash to modify.
|
|
1275
|
-
* @param {string} key The key of the value to remove.
|
|
1276
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1277
|
-
*/
|
|
1278
|
-
function hashDelete(key) {
|
|
1279
|
-
var result = this.has(key) && delete this.__data__[key];
|
|
1280
|
-
this.size -= result ? 1 : 0;
|
|
1281
|
-
return result;
|
|
1282
|
-
}
|
|
1083
|
+
var possibleConstructorReturn = function (self, call) {
|
|
1084
|
+
if (!self) {
|
|
1085
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1086
|
+
}
|
|
1283
1087
|
|
|
1284
|
-
|
|
1088
|
+
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
|
1089
|
+
};
|
|
1285
1090
|
|
|
1286
|
-
|
|
1287
|
-
|
|
1091
|
+
var slicedToArray = function () {
|
|
1092
|
+
function sliceIterator(arr, i) {
|
|
1093
|
+
var _arr = [];
|
|
1094
|
+
var _n = true;
|
|
1095
|
+
var _d = false;
|
|
1096
|
+
var _e = undefined;
|
|
1288
1097
|
|
|
1289
|
-
|
|
1290
|
-
var
|
|
1098
|
+
try {
|
|
1099
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
1100
|
+
_arr.push(_s.value);
|
|
1291
1101
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1102
|
+
if (i && _arr.length === i) break;
|
|
1103
|
+
}
|
|
1104
|
+
} catch (err) {
|
|
1105
|
+
_d = true;
|
|
1106
|
+
_e = err;
|
|
1107
|
+
} finally {
|
|
1108
|
+
try {
|
|
1109
|
+
if (!_n && _i["return"]) _i["return"]();
|
|
1110
|
+
} finally {
|
|
1111
|
+
if (_d) throw _e;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1294
1114
|
|
|
1295
|
-
|
|
1296
|
-
* Gets the hash value for `key`.
|
|
1297
|
-
*
|
|
1298
|
-
* @private
|
|
1299
|
-
* @name get
|
|
1300
|
-
* @memberOf Hash
|
|
1301
|
-
* @param {string} key The key of the value to get.
|
|
1302
|
-
* @returns {*} Returns the entry value.
|
|
1303
|
-
*/
|
|
1304
|
-
function hashGet(key) {
|
|
1305
|
-
var data = this.__data__;
|
|
1306
|
-
if (_nativeCreate) {
|
|
1307
|
-
var result = data[key];
|
|
1308
|
-
return result === HASH_UNDEFINED ? undefined : result;
|
|
1115
|
+
return _arr;
|
|
1309
1116
|
}
|
|
1310
|
-
return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
var _hashGet = hashGet;
|
|
1314
|
-
|
|
1315
|
-
/** Used for built-in method references. */
|
|
1316
|
-
var objectProto$4 = Object.prototype;
|
|
1317
|
-
|
|
1318
|
-
/** Used to check objects for own properties. */
|
|
1319
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1320
1117
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
var data = this.__data__;
|
|
1332
|
-
return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
|
|
1333
|
-
}
|
|
1334
|
-
|
|
1335
|
-
var _hashHas = hashHas;
|
|
1336
|
-
|
|
1337
|
-
/** Used to stand-in for `undefined` hash values. */
|
|
1338
|
-
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
1339
|
-
|
|
1340
|
-
/**
|
|
1341
|
-
* Sets the hash `key` to `value`.
|
|
1342
|
-
*
|
|
1343
|
-
* @private
|
|
1344
|
-
* @name set
|
|
1345
|
-
* @memberOf Hash
|
|
1346
|
-
* @param {string} key The key of the value to set.
|
|
1347
|
-
* @param {*} value The value to set.
|
|
1348
|
-
* @returns {Object} Returns the hash instance.
|
|
1349
|
-
*/
|
|
1350
|
-
function hashSet(key, value) {
|
|
1351
|
-
var data = this.__data__;
|
|
1352
|
-
this.size += this.has(key) ? 0 : 1;
|
|
1353
|
-
data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
1354
|
-
return this;
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
var _hashSet = hashSet;
|
|
1118
|
+
return function (arr, i) {
|
|
1119
|
+
if (Array.isArray(arr)) {
|
|
1120
|
+
return arr;
|
|
1121
|
+
} else if (Symbol.iterator in Object(arr)) {
|
|
1122
|
+
return sliceIterator(arr, i);
|
|
1123
|
+
} else {
|
|
1124
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
}();
|
|
1358
1128
|
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
* @private
|
|
1363
|
-
* @constructor
|
|
1364
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1365
|
-
*/
|
|
1366
|
-
function Hash(entries) {
|
|
1367
|
-
var index = -1,
|
|
1368
|
-
length = entries == null ? 0 : entries.length;
|
|
1129
|
+
var toConsumableArray = function (arr) {
|
|
1130
|
+
if (Array.isArray(arr)) {
|
|
1131
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
|
|
1369
1132
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
this.set(entry[0], entry[1]);
|
|
1133
|
+
return arr2;
|
|
1134
|
+
} else {
|
|
1135
|
+
return Array.from(arr);
|
|
1374
1136
|
}
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
// Add methods to `Hash`.
|
|
1378
|
-
Hash.prototype.clear = _hashClear;
|
|
1379
|
-
Hash.prototype['delete'] = _hashDelete;
|
|
1380
|
-
Hash.prototype.get = _hashGet;
|
|
1381
|
-
Hash.prototype.has = _hashHas;
|
|
1382
|
-
Hash.prototype.set = _hashSet;
|
|
1383
|
-
|
|
1384
|
-
var _Hash = Hash;
|
|
1137
|
+
};
|
|
1385
1138
|
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
*
|
|
1389
|
-
* @private
|
|
1390
|
-
* @name clear
|
|
1391
|
-
* @memberOf ListCache
|
|
1392
|
-
*/
|
|
1393
|
-
function listCacheClear() {
|
|
1394
|
-
this.__data__ = [];
|
|
1395
|
-
this.size = 0;
|
|
1396
|
-
}
|
|
1139
|
+
var DeckContent = function (_React$Component) {
|
|
1140
|
+
inherits(DeckContent, _React$Component);
|
|
1397
1141
|
|
|
1398
|
-
|
|
1142
|
+
function DeckContent() {
|
|
1143
|
+
var _ref;
|
|
1399
1144
|
|
|
1400
|
-
|
|
1401
|
-
* Performs a
|
|
1402
|
-
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
1403
|
-
* comparison between two values to determine if they are equivalent.
|
|
1404
|
-
*
|
|
1405
|
-
* @static
|
|
1406
|
-
* @memberOf _
|
|
1407
|
-
* @since 4.0.0
|
|
1408
|
-
* @category Lang
|
|
1409
|
-
* @param {*} value The value to compare.
|
|
1410
|
-
* @param {*} other The other value to compare.
|
|
1411
|
-
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1412
|
-
* @example
|
|
1413
|
-
*
|
|
1414
|
-
* var object = { 'a': 1 };
|
|
1415
|
-
* var other = { 'a': 1 };
|
|
1416
|
-
*
|
|
1417
|
-
* _.eq(object, object);
|
|
1418
|
-
* // => true
|
|
1419
|
-
*
|
|
1420
|
-
* _.eq(object, other);
|
|
1421
|
-
* // => false
|
|
1422
|
-
*
|
|
1423
|
-
* _.eq('a', 'a');
|
|
1424
|
-
* // => true
|
|
1425
|
-
*
|
|
1426
|
-
* _.eq('a', Object('a'));
|
|
1427
|
-
* // => false
|
|
1428
|
-
*
|
|
1429
|
-
* _.eq(NaN, NaN);
|
|
1430
|
-
* // => true
|
|
1431
|
-
*/
|
|
1432
|
-
function eq(value, other) {
|
|
1433
|
-
return value === other || (value !== value && other !== other);
|
|
1434
|
-
}
|
|
1145
|
+
var _temp, _this, _ret;
|
|
1435
1146
|
|
|
1436
|
-
|
|
1147
|
+
classCallCheck(this, DeckContent);
|
|
1437
1148
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
*
|
|
1441
|
-
* @private
|
|
1442
|
-
* @param {Array} array The array to inspect.
|
|
1443
|
-
* @param {*} key The key to search for.
|
|
1444
|
-
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
1445
|
-
*/
|
|
1446
|
-
function assocIndexOf(array, key) {
|
|
1447
|
-
var length = array.length;
|
|
1448
|
-
while (length--) {
|
|
1449
|
-
if (eq_1(array[length][0], key)) {
|
|
1450
|
-
return length;
|
|
1149
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1150
|
+
args[_key] = arguments[_key];
|
|
1451
1151
|
}
|
|
1452
|
-
}
|
|
1453
|
-
return -1;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
var _assocIndexOf = assocIndexOf;
|
|
1457
1152
|
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
}
|
|
1486
|
-
--this.size;
|
|
1487
|
-
return true;
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
var _listCacheDelete = listCacheDelete;
|
|
1491
|
-
|
|
1492
|
-
/**
|
|
1493
|
-
* Gets the list cache value for `key`.
|
|
1494
|
-
*
|
|
1495
|
-
* @private
|
|
1496
|
-
* @name get
|
|
1497
|
-
* @memberOf ListCache
|
|
1498
|
-
* @param {string} key The key of the value to get.
|
|
1499
|
-
* @returns {*} Returns the entry value.
|
|
1500
|
-
*/
|
|
1501
|
-
function listCacheGet(key) {
|
|
1502
|
-
var data = this.__data__,
|
|
1503
|
-
index = _assocIndexOf(data, key);
|
|
1153
|
+
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 = {
|
|
1154
|
+
data: _this.data,
|
|
1155
|
+
dataKeptToCompareNewDatarecord: _this.data,
|
|
1156
|
+
per: _this.params ? _this.params.to : 2,
|
|
1157
|
+
page: 1,
|
|
1158
|
+
from: _this.params ? _this.params.from : 0,
|
|
1159
|
+
to: _this.params ? _this.params.to : 2,
|
|
1160
|
+
total_pages: null,
|
|
1161
|
+
scrolling: true,
|
|
1162
|
+
query: _this.query
|
|
1163
|
+
}, _this.loadMore = function () {
|
|
1164
|
+
setTimeout(function () {
|
|
1165
|
+
_this.setState(function (state) {
|
|
1166
|
+
return {
|
|
1167
|
+
page: state.page + 1,
|
|
1168
|
+
from: state.from + state.per,
|
|
1169
|
+
to: state.to + state.per
|
|
1170
|
+
};
|
|
1171
|
+
}, _this.loadData);
|
|
1172
|
+
}, 10);
|
|
1173
|
+
}, _this.loadData = function () {
|
|
1174
|
+
var _this$state = _this.state,
|
|
1175
|
+
from = _this$state.from,
|
|
1176
|
+
to = _this$state.to,
|
|
1177
|
+
data = _this$state.data,
|
|
1178
|
+
query = _this$state.query;
|
|
1179
|
+
var client = _this.props.client;
|
|
1504
1180
|
|
|
1505
|
-
return index < 0 ? undefined : data[index][1];
|
|
1506
|
-
}
|
|
1507
1181
|
|
|
1508
|
-
var
|
|
1182
|
+
var params = { from: from, to: to };
|
|
1183
|
+
var queryUpdated = query.replace('$from', params.from).replace('$to', params.to);
|
|
1184
|
+
// const query = '*[_type == "article" && defined(title) && defined(thumbnail)][$from...$to] { title, summary, thumbnail { asset-> }, url }'
|
|
1509
1185
|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1186
|
+
if (_this.pointer && _this.pointerArray) {
|
|
1187
|
+
var pointer = _this.pointer;
|
|
1188
|
+
client.fetch(queryUpdated).then(function (dataArr) {
|
|
1189
|
+
_this.setState(function (state, props) {
|
|
1190
|
+
if (dataArr[_this.pointerArray][pointer].length > 0) {
|
|
1191
|
+
return {
|
|
1192
|
+
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr[_this.pointerArray][pointer])),
|
|
1193
|
+
scrolling: true
|
|
1194
|
+
};
|
|
1195
|
+
} else {
|
|
1196
|
+
return {
|
|
1197
|
+
scrolling: false
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
});
|
|
1202
|
+
} else {
|
|
1203
|
+
client.fetch(queryUpdated).then(function (dataArr) {
|
|
1204
|
+
_this.setState(function (state, props) {
|
|
1205
|
+
if (dataArr.length > 0) {
|
|
1206
|
+
return {
|
|
1207
|
+
data: [].concat(toConsumableArray(data), toConsumableArray(dataArr)),
|
|
1208
|
+
scrolling: true
|
|
1209
|
+
};
|
|
1210
|
+
} else {
|
|
1211
|
+
return {
|
|
1212
|
+
scrolling: false
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
});
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
}, _this.urlFor = function (source) {
|
|
1219
|
+
var client = _this.props.client;
|
|
1522
1220
|
|
|
1523
|
-
var
|
|
1221
|
+
var builder = imageUrlBuilder(client);
|
|
1222
|
+
return builder.image(source);
|
|
1223
|
+
}, _this.renderCardImage = function (row, page) {
|
|
1224
|
+
if (row.thumbnail && row.thumbnail.asset) {
|
|
1225
|
+
return _this.urlFor(row.thumbnail.asset).url();
|
|
1226
|
+
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
1227
|
+
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
1228
|
+
} else {
|
|
1229
|
+
return _this.defaultImage;
|
|
1230
|
+
}
|
|
1231
|
+
}, _this.cardLoader = function (page, columns, variant) {
|
|
1232
|
+
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
1524
1233
|
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1234
|
+
var itemCounter = 0;
|
|
1235
|
+
var lgVar = 12;
|
|
1236
|
+
return React__default.createElement(
|
|
1237
|
+
Row,
|
|
1238
|
+
null,
|
|
1239
|
+
_this.state.data && _this.state.data.map(function (row, index) {
|
|
1240
|
+
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
1241
|
+
lgVar = 12;
|
|
1242
|
+
} else if (columns && columns !== 'rotate') {
|
|
1243
|
+
lgVar = Math.floor(12 / columns);
|
|
1244
|
+
} else {
|
|
1245
|
+
lgVar = 6;
|
|
1246
|
+
}
|
|
1538
1247
|
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1248
|
+
return React__default.createElement(
|
|
1249
|
+
Col,
|
|
1250
|
+
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
1251
|
+
React__default.createElement(
|
|
1252
|
+
Card,
|
|
1253
|
+
{ className: 'content-card', style: { flexDirection: mode } },
|
|
1254
|
+
React__default.createElement(
|
|
1255
|
+
Link,
|
|
1256
|
+
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
1257
|
+
React__default.createElement(
|
|
1258
|
+
'a',
|
|
1259
|
+
null,
|
|
1260
|
+
React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
|
|
1261
|
+
)
|
|
1262
|
+
),
|
|
1263
|
+
React__default.createElement(
|
|
1264
|
+
Card.Body,
|
|
1265
|
+
null,
|
|
1266
|
+
React__default.createElement(
|
|
1267
|
+
Link,
|
|
1268
|
+
{ href: _this.mapping[row.contentCategory.name] + '/[url]', as: _this.mapping[row.contentCategory.name] + '/' + row.url.current },
|
|
1269
|
+
React__default.createElement(
|
|
1270
|
+
'a',
|
|
1271
|
+
null,
|
|
1272
|
+
React__default.createElement(
|
|
1273
|
+
Card.Title,
|
|
1274
|
+
null,
|
|
1275
|
+
row.title
|
|
1276
|
+
),
|
|
1277
|
+
React__default.createElement(
|
|
1278
|
+
Card.Text,
|
|
1279
|
+
null,
|
|
1280
|
+
row.summary
|
|
1281
|
+
)
|
|
1282
|
+
)
|
|
1283
|
+
)
|
|
1284
|
+
)
|
|
1285
|
+
)
|
|
1286
|
+
);
|
|
1287
|
+
})
|
|
1288
|
+
);
|
|
1289
|
+
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
1544
1290
|
}
|
|
1545
|
-
return this;
|
|
1546
|
-
}
|
|
1547
1291
|
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1292
|
+
createClass(DeckContent, [{
|
|
1293
|
+
key: 'componentDidUpdate',
|
|
1294
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
1295
|
+
if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
|
|
1296
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
1297
|
+
this.setState({
|
|
1298
|
+
data: this.props.dataRecord,
|
|
1299
|
+
dataKeptToCompareNewDatarecord: this.props.dataRecord,
|
|
1300
|
+
per: this.props.params ? this.props.params.to : 2,
|
|
1301
|
+
page: 1,
|
|
1302
|
+
from: this.props.params ? this.props.params.from : 0,
|
|
1303
|
+
to: this.props.params ? this.props.params.to : 2,
|
|
1304
|
+
total_pages: null,
|
|
1305
|
+
scrolling: true,
|
|
1306
|
+
query: this.props.query
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
}, {
|
|
1311
|
+
key: 'componentDidMount',
|
|
1312
|
+
value: function componentDidMount() {
|
|
1313
|
+
// this.loadData();
|
|
1314
|
+
}
|
|
1315
|
+
}, {
|
|
1316
|
+
key: 'render',
|
|
1317
|
+
value: function render() {
|
|
1318
|
+
var _this2 = this;
|
|
1560
1319
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
}
|
|
1320
|
+
var _props = this.props,
|
|
1321
|
+
columns = _props.columns,
|
|
1322
|
+
variant = _props.variant,
|
|
1323
|
+
autoScroll = _props.autoScroll,
|
|
1324
|
+
page = _props.page;
|
|
1567
1325
|
|
|
1568
|
-
// Add methods to `ListCache`.
|
|
1569
|
-
ListCache.prototype.clear = _listCacheClear;
|
|
1570
|
-
ListCache.prototype['delete'] = _listCacheDelete;
|
|
1571
|
-
ListCache.prototype.get = _listCacheGet;
|
|
1572
|
-
ListCache.prototype.has = _listCacheHas;
|
|
1573
|
-
ListCache.prototype.set = _listCacheSet;
|
|
1574
1326
|
|
|
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
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
*/
|
|
1624
|
-
function getMapData(map, key) {
|
|
1625
|
-
var data = map.__data__;
|
|
1626
|
-
return _isKeyable(key)
|
|
1627
|
-
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
1628
|
-
: data.map;
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
var _getMapData = getMapData;
|
|
1632
|
-
|
|
1633
|
-
/**
|
|
1634
|
-
* Removes `key` and its value from the map.
|
|
1635
|
-
*
|
|
1636
|
-
* @private
|
|
1637
|
-
* @name delete
|
|
1638
|
-
* @memberOf MapCache
|
|
1639
|
-
* @param {string} key The key of the value to remove.
|
|
1640
|
-
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
1641
|
-
*/
|
|
1642
|
-
function mapCacheDelete(key) {
|
|
1643
|
-
var result = _getMapData(this, key)['delete'](key);
|
|
1644
|
-
this.size -= result ? 1 : 0;
|
|
1645
|
-
return result;
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
var _mapCacheDelete = mapCacheDelete;
|
|
1649
|
-
|
|
1650
|
-
/**
|
|
1651
|
-
* Gets the map value for `key`.
|
|
1652
|
-
*
|
|
1653
|
-
* @private
|
|
1654
|
-
* @name get
|
|
1655
|
-
* @memberOf MapCache
|
|
1656
|
-
* @param {string} key The key of the value to get.
|
|
1657
|
-
* @returns {*} Returns the entry value.
|
|
1658
|
-
*/
|
|
1659
|
-
function mapCacheGet(key) {
|
|
1660
|
-
return _getMapData(this, key).get(key);
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
var _mapCacheGet = mapCacheGet;
|
|
1664
|
-
|
|
1665
|
-
/**
|
|
1666
|
-
* Checks if a map value for `key` exists.
|
|
1667
|
-
*
|
|
1668
|
-
* @private
|
|
1669
|
-
* @name has
|
|
1670
|
-
* @memberOf MapCache
|
|
1671
|
-
* @param {string} key The key of the entry to check.
|
|
1672
|
-
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
1673
|
-
*/
|
|
1674
|
-
function mapCacheHas(key) {
|
|
1675
|
-
return _getMapData(this, key).has(key);
|
|
1676
|
-
}
|
|
1677
|
-
|
|
1678
|
-
var _mapCacheHas = mapCacheHas;
|
|
1679
|
-
|
|
1680
|
-
/**
|
|
1681
|
-
* Sets the map `key` to `value`.
|
|
1682
|
-
*
|
|
1683
|
-
* @private
|
|
1684
|
-
* @name set
|
|
1685
|
-
* @memberOf MapCache
|
|
1686
|
-
* @param {string} key The key of the value to set.
|
|
1687
|
-
* @param {*} value The value to set.
|
|
1688
|
-
* @returns {Object} Returns the map cache instance.
|
|
1689
|
-
*/
|
|
1690
|
-
function mapCacheSet(key, value) {
|
|
1691
|
-
var data = _getMapData(this, key),
|
|
1692
|
-
size = data.size;
|
|
1693
|
-
|
|
1694
|
-
data.set(key, value);
|
|
1695
|
-
this.size += data.size == size ? 0 : 1;
|
|
1696
|
-
return this;
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
var _mapCacheSet = mapCacheSet;
|
|
1700
|
-
|
|
1701
|
-
/**
|
|
1702
|
-
* Creates a map cache object to store key-value pairs.
|
|
1703
|
-
*
|
|
1704
|
-
* @private
|
|
1705
|
-
* @constructor
|
|
1706
|
-
* @param {Array} [entries] The key-value pairs to cache.
|
|
1707
|
-
*/
|
|
1708
|
-
function MapCache(entries) {
|
|
1709
|
-
var index = -1,
|
|
1710
|
-
length = entries == null ? 0 : entries.length;
|
|
1711
|
-
|
|
1712
|
-
this.clear();
|
|
1713
|
-
while (++index < length) {
|
|
1714
|
-
var entry = entries[index];
|
|
1715
|
-
this.set(entry[0], entry[1]);
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
|
-
// Add methods to `MapCache`.
|
|
1720
|
-
MapCache.prototype.clear = _mapCacheClear;
|
|
1721
|
-
MapCache.prototype['delete'] = _mapCacheDelete;
|
|
1722
|
-
MapCache.prototype.get = _mapCacheGet;
|
|
1723
|
-
MapCache.prototype.has = _mapCacheHas;
|
|
1724
|
-
MapCache.prototype.set = _mapCacheSet;
|
|
1725
|
-
|
|
1726
|
-
var _MapCache = MapCache;
|
|
1727
|
-
|
|
1728
|
-
/** Error message constants. */
|
|
1729
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
1730
|
-
|
|
1731
|
-
/**
|
|
1732
|
-
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
1733
|
-
* provided, it determines the cache key for storing the result based on the
|
|
1734
|
-
* arguments provided to the memoized function. By default, the first argument
|
|
1735
|
-
* provided to the memoized function is used as the map cache key. The `func`
|
|
1736
|
-
* is invoked with the `this` binding of the memoized function.
|
|
1737
|
-
*
|
|
1738
|
-
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
1739
|
-
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
1740
|
-
* constructor with one whose instances implement the
|
|
1741
|
-
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
1742
|
-
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
1743
|
-
*
|
|
1744
|
-
* @static
|
|
1745
|
-
* @memberOf _
|
|
1746
|
-
* @since 0.1.0
|
|
1747
|
-
* @category Function
|
|
1748
|
-
* @param {Function} func The function to have its output memoized.
|
|
1749
|
-
* @param {Function} [resolver] The function to resolve the cache key.
|
|
1750
|
-
* @returns {Function} Returns the new memoized function.
|
|
1751
|
-
* @example
|
|
1752
|
-
*
|
|
1753
|
-
* var object = { 'a': 1, 'b': 2 };
|
|
1754
|
-
* var other = { 'c': 3, 'd': 4 };
|
|
1755
|
-
*
|
|
1756
|
-
* var values = _.memoize(_.values);
|
|
1757
|
-
* values(object);
|
|
1758
|
-
* // => [1, 2]
|
|
1759
|
-
*
|
|
1760
|
-
* values(other);
|
|
1761
|
-
* // => [3, 4]
|
|
1762
|
-
*
|
|
1763
|
-
* object.a = 2;
|
|
1764
|
-
* values(object);
|
|
1765
|
-
* // => [1, 2]
|
|
1766
|
-
*
|
|
1767
|
-
* // Modify the result cache.
|
|
1768
|
-
* values.cache.set(object, ['a', 'b']);
|
|
1769
|
-
* values(object);
|
|
1770
|
-
* // => ['a', 'b']
|
|
1771
|
-
*
|
|
1772
|
-
* // Replace `_.memoize.Cache`.
|
|
1773
|
-
* _.memoize.Cache = WeakMap;
|
|
1774
|
-
*/
|
|
1775
|
-
function memoize(func, resolver) {
|
|
1776
|
-
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
1777
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
1778
|
-
}
|
|
1779
|
-
var memoized = function() {
|
|
1780
|
-
var args = arguments,
|
|
1781
|
-
key = resolver ? resolver.apply(this, args) : args[0],
|
|
1782
|
-
cache = memoized.cache;
|
|
1783
|
-
|
|
1784
|
-
if (cache.has(key)) {
|
|
1785
|
-
return cache.get(key);
|
|
1786
|
-
}
|
|
1787
|
-
var result = func.apply(this, args);
|
|
1788
|
-
memoized.cache = cache.set(key, result) || cache;
|
|
1789
|
-
return result;
|
|
1790
|
-
};
|
|
1791
|
-
memoized.cache = new (memoize.Cache || _MapCache);
|
|
1792
|
-
return memoized;
|
|
1793
|
-
}
|
|
1794
|
-
|
|
1795
|
-
// Expose `MapCache`.
|
|
1796
|
-
memoize.Cache = _MapCache;
|
|
1797
|
-
|
|
1798
|
-
var memoize_1 = memoize;
|
|
1799
|
-
|
|
1800
|
-
/** Used as the maximum memoize cache size. */
|
|
1801
|
-
var MAX_MEMOIZE_SIZE = 500;
|
|
1802
|
-
|
|
1803
|
-
/**
|
|
1804
|
-
* A specialized version of `_.memoize` which clears the memoized function's
|
|
1805
|
-
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
1806
|
-
*
|
|
1807
|
-
* @private
|
|
1808
|
-
* @param {Function} func The function to have its output memoized.
|
|
1809
|
-
* @returns {Function} Returns the new memoized function.
|
|
1810
|
-
*/
|
|
1811
|
-
function memoizeCapped(func) {
|
|
1812
|
-
var result = memoize_1(func, function(key) {
|
|
1813
|
-
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
1814
|
-
cache.clear();
|
|
1327
|
+
return React__default.createElement(
|
|
1328
|
+
'div',
|
|
1329
|
+
{ className: 'contentDeck' },
|
|
1330
|
+
autoScroll ? React__default.createElement(
|
|
1331
|
+
React__default.Fragment,
|
|
1332
|
+
null,
|
|
1333
|
+
React__default.createElement(
|
|
1334
|
+
InfiniteScroll,
|
|
1335
|
+
{ dataLength: this.state.data.length, next: this.loadMore, hasMore: this.state.scrolling },
|
|
1336
|
+
this.cardLoader(page, columns, variant)
|
|
1337
|
+
),
|
|
1338
|
+
React__default.createElement(
|
|
1339
|
+
'noscript',
|
|
1340
|
+
null,
|
|
1341
|
+
'Manual Pagination Here'
|
|
1342
|
+
)
|
|
1343
|
+
) : React__default.createElement(
|
|
1344
|
+
React__default.Fragment,
|
|
1345
|
+
null,
|
|
1346
|
+
this.cardLoader(page, columns, variant),
|
|
1347
|
+
React__default.createElement(
|
|
1348
|
+
'div',
|
|
1349
|
+
{ style: { padding: '0px 10px' } },
|
|
1350
|
+
this.state.scrolling ? React__default.createElement(
|
|
1351
|
+
'button',
|
|
1352
|
+
{
|
|
1353
|
+
style: { margin: 'auto', width: '100%' },
|
|
1354
|
+
onClick: function onClick(e) {
|
|
1355
|
+
_this2.loadMore();
|
|
1356
|
+
} },
|
|
1357
|
+
'Load More'
|
|
1358
|
+
) : React__default.createElement(
|
|
1359
|
+
'p',
|
|
1360
|
+
{ style: { textAlign: 'center' } },
|
|
1361
|
+
React__default.createElement(
|
|
1362
|
+
'b',
|
|
1363
|
+
null,
|
|
1364
|
+
'End of data'
|
|
1365
|
+
)
|
|
1366
|
+
)
|
|
1367
|
+
),
|
|
1368
|
+
React__default.createElement(
|
|
1369
|
+
'noscript',
|
|
1370
|
+
null,
|
|
1371
|
+
'Manual Pagination Here'
|
|
1372
|
+
)
|
|
1373
|
+
)
|
|
1374
|
+
);
|
|
1815
1375
|
}
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
var cache = result.cache;
|
|
1820
|
-
return result;
|
|
1821
|
-
}
|
|
1822
|
-
|
|
1823
|
-
var _memoizeCapped = memoizeCapped;
|
|
1824
|
-
|
|
1825
|
-
/** Used to match property names within property paths. */
|
|
1826
|
-
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
1827
|
-
|
|
1828
|
-
/** Used to match backslashes in property paths. */
|
|
1829
|
-
var reEscapeChar = /\\(\\)?/g;
|
|
1830
|
-
|
|
1831
|
-
/**
|
|
1832
|
-
* Converts `string` to a property path array.
|
|
1833
|
-
*
|
|
1834
|
-
* @private
|
|
1835
|
-
* @param {string} string The string to convert.
|
|
1836
|
-
* @returns {Array} Returns the property path array.
|
|
1837
|
-
*/
|
|
1838
|
-
var stringToPath = _memoizeCapped(function(string) {
|
|
1839
|
-
var result = [];
|
|
1840
|
-
if (string.charCodeAt(0) === 46 /* . */) {
|
|
1841
|
-
result.push('');
|
|
1842
|
-
}
|
|
1843
|
-
string.replace(rePropName, function(match, number, quote, subString) {
|
|
1844
|
-
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
1845
|
-
});
|
|
1846
|
-
return result;
|
|
1847
|
-
});
|
|
1848
|
-
|
|
1849
|
-
var _stringToPath = stringToPath;
|
|
1850
|
-
|
|
1851
|
-
/**
|
|
1852
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
1853
|
-
* shorthands.
|
|
1854
|
-
*
|
|
1855
|
-
* @private
|
|
1856
|
-
* @param {Array} [array] The array to iterate over.
|
|
1857
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
1858
|
-
* @returns {Array} Returns the new mapped array.
|
|
1859
|
-
*/
|
|
1860
|
-
function arrayMap(array, iteratee) {
|
|
1861
|
-
var index = -1,
|
|
1862
|
-
length = array == null ? 0 : array.length,
|
|
1863
|
-
result = Array(length);
|
|
1864
|
-
|
|
1865
|
-
while (++index < length) {
|
|
1866
|
-
result[index] = iteratee(array[index], index, array);
|
|
1867
|
-
}
|
|
1868
|
-
return result;
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
var _arrayMap = arrayMap;
|
|
1872
|
-
|
|
1873
|
-
/** Used as references for various `Number` constants. */
|
|
1874
|
-
var INFINITY = 1 / 0;
|
|
1875
|
-
|
|
1876
|
-
/** Used to convert symbols to primitives and strings. */
|
|
1877
|
-
var symbolProto = _Symbol ? _Symbol.prototype : undefined,
|
|
1878
|
-
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
1879
|
-
|
|
1880
|
-
/**
|
|
1881
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
1882
|
-
* values to empty strings.
|
|
1883
|
-
*
|
|
1884
|
-
* @private
|
|
1885
|
-
* @param {*} value The value to process.
|
|
1886
|
-
* @returns {string} Returns the string.
|
|
1887
|
-
*/
|
|
1888
|
-
function baseToString(value) {
|
|
1889
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
1890
|
-
if (typeof value == 'string') {
|
|
1891
|
-
return value;
|
|
1892
|
-
}
|
|
1893
|
-
if (isArray_1(value)) {
|
|
1894
|
-
// Recursively convert values (susceptible to call stack limits).
|
|
1895
|
-
return _arrayMap(value, baseToString) + '';
|
|
1896
|
-
}
|
|
1897
|
-
if (isSymbol_1(value)) {
|
|
1898
|
-
return symbolToString ? symbolToString.call(value) : '';
|
|
1899
|
-
}
|
|
1900
|
-
var result = (value + '');
|
|
1901
|
-
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
|
1902
|
-
}
|
|
1903
|
-
|
|
1904
|
-
var _baseToString = baseToString;
|
|
1905
|
-
|
|
1906
|
-
/**
|
|
1907
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
1908
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
1909
|
-
*
|
|
1910
|
-
* @static
|
|
1911
|
-
* @memberOf _
|
|
1912
|
-
* @since 4.0.0
|
|
1913
|
-
* @category Lang
|
|
1914
|
-
* @param {*} value The value to convert.
|
|
1915
|
-
* @returns {string} Returns the converted string.
|
|
1916
|
-
* @example
|
|
1917
|
-
*
|
|
1918
|
-
* _.toString(null);
|
|
1919
|
-
* // => ''
|
|
1920
|
-
*
|
|
1921
|
-
* _.toString(-0);
|
|
1922
|
-
* // => '-0'
|
|
1923
|
-
*
|
|
1924
|
-
* _.toString([1, 2, 3]);
|
|
1925
|
-
* // => '1,2,3'
|
|
1926
|
-
*/
|
|
1927
|
-
function toString(value) {
|
|
1928
|
-
return value == null ? '' : _baseToString(value);
|
|
1929
|
-
}
|
|
1930
|
-
|
|
1931
|
-
var toString_1 = toString;
|
|
1932
|
-
|
|
1933
|
-
/**
|
|
1934
|
-
* Casts `value` to a path array if it's not one.
|
|
1935
|
-
*
|
|
1936
|
-
* @private
|
|
1937
|
-
* @param {*} value The value to inspect.
|
|
1938
|
-
* @param {Object} [object] The object to query keys on.
|
|
1939
|
-
* @returns {Array} Returns the cast property path array.
|
|
1940
|
-
*/
|
|
1941
|
-
function castPath(value, object) {
|
|
1942
|
-
if (isArray_1(value)) {
|
|
1943
|
-
return value;
|
|
1944
|
-
}
|
|
1945
|
-
return _isKey(value, object) ? [value] : _stringToPath(toString_1(value));
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
|
-
var _castPath = castPath;
|
|
1949
|
-
|
|
1950
|
-
/** Used as references for various `Number` constants. */
|
|
1951
|
-
var INFINITY$1 = 1 / 0;
|
|
1952
|
-
|
|
1953
|
-
/**
|
|
1954
|
-
* Converts `value` to a string key if it's not a string or symbol.
|
|
1955
|
-
*
|
|
1956
|
-
* @private
|
|
1957
|
-
* @param {*} value The value to inspect.
|
|
1958
|
-
* @returns {string|symbol} Returns the key.
|
|
1959
|
-
*/
|
|
1960
|
-
function toKey(value) {
|
|
1961
|
-
if (typeof value == 'string' || isSymbol_1(value)) {
|
|
1962
|
-
return value;
|
|
1963
|
-
}
|
|
1964
|
-
var result = (value + '');
|
|
1965
|
-
return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
var _toKey = toKey;
|
|
1969
|
-
|
|
1970
|
-
/**
|
|
1971
|
-
* The base implementation of `_.get` without support for default values.
|
|
1972
|
-
*
|
|
1973
|
-
* @private
|
|
1974
|
-
* @param {Object} object The object to query.
|
|
1975
|
-
* @param {Array|string} path The path of the property to get.
|
|
1976
|
-
* @returns {*} Returns the resolved value.
|
|
1977
|
-
*/
|
|
1978
|
-
function baseGet(object, path) {
|
|
1979
|
-
path = _castPath(path, object);
|
|
1980
|
-
|
|
1981
|
-
var index = 0,
|
|
1982
|
-
length = path.length;
|
|
1983
|
-
|
|
1984
|
-
while (object != null && index < length) {
|
|
1985
|
-
object = object[_toKey(path[index++])];
|
|
1986
|
-
}
|
|
1987
|
-
return (index && index == length) ? object : undefined;
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
|
-
var _baseGet = baseGet;
|
|
1991
|
-
|
|
1992
|
-
/**
|
|
1993
|
-
* Gets the value at `path` of `object`. If the resolved value is
|
|
1994
|
-
* `undefined`, the `defaultValue` is returned in its place.
|
|
1995
|
-
*
|
|
1996
|
-
* @static
|
|
1997
|
-
* @memberOf _
|
|
1998
|
-
* @since 3.7.0
|
|
1999
|
-
* @category Object
|
|
2000
|
-
* @param {Object} object The object to query.
|
|
2001
|
-
* @param {Array|string} path The path of the property to get.
|
|
2002
|
-
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
2003
|
-
* @returns {*} Returns the resolved value.
|
|
2004
|
-
* @example
|
|
2005
|
-
*
|
|
2006
|
-
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2007
|
-
*
|
|
2008
|
-
* _.get(object, 'a[0].b.c');
|
|
2009
|
-
* // => 3
|
|
2010
|
-
*
|
|
2011
|
-
* _.get(object, ['a', '0', 'b', 'c']);
|
|
2012
|
-
* // => 3
|
|
2013
|
-
*
|
|
2014
|
-
* _.get(object, 'a.b.c', 'default');
|
|
2015
|
-
* // => 'default'
|
|
2016
|
-
*/
|
|
2017
|
-
function get$1(object, path, defaultValue) {
|
|
2018
|
-
var result = object == null ? undefined : _baseGet(object, path);
|
|
2019
|
-
return result === undefined ? defaultValue : result;
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
var get_1 = get$1;
|
|
1376
|
+
}]);
|
|
1377
|
+
return DeckContent;
|
|
1378
|
+
}(React__default.Component);
|
|
2023
1379
|
|
|
2024
1380
|
var DeckQueue = function (_React$Component) {
|
|
2025
1381
|
inherits(DeckQueue, _React$Component);
|
|
@@ -2098,6 +1454,11 @@ var DeckQueue = function (_React$Component) {
|
|
|
2098
1454
|
});
|
|
2099
1455
|
});
|
|
2100
1456
|
}
|
|
1457
|
+
}, _this.urlFor = function (source) {
|
|
1458
|
+
var client = _this.props.client;
|
|
1459
|
+
|
|
1460
|
+
var builder = imageUrlBuilder(client);
|
|
1461
|
+
return builder.image(source);
|
|
2101
1462
|
}, _temp), possibleConstructorReturn(_this, _ret);
|
|
2102
1463
|
}
|
|
2103
1464
|
|
|
@@ -2113,7 +1474,8 @@ var DeckQueue = function (_React$Component) {
|
|
|
2113
1474
|
Row,
|
|
2114
1475
|
null,
|
|
2115
1476
|
this.state.data && this.state.data.map(function (row, index) {
|
|
2116
|
-
|
|
1477
|
+
// const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
|
|
1478
|
+
var thumbnailURL = row.thumbnail && row.thumbnail.asset ? _this2.urlFor(row.thumbnail.asset).url() : _this2.props.defaultImage;
|
|
2117
1479
|
return React__default.createElement(
|
|
2118
1480
|
Col,
|
|
2119
1481
|
{ key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -2213,7 +1575,15 @@ var DeckQueue = function (_React$Component) {
|
|
|
2213
1575
|
|
|
2214
1576
|
var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
2215
1577
|
var size = _ref.size,
|
|
2216
|
-
mediaData = _ref.mediaData
|
|
1578
|
+
mediaData = _ref.mediaData,
|
|
1579
|
+
client = _ref.client,
|
|
1580
|
+
defaultImage = _ref.defaultImage;
|
|
1581
|
+
|
|
1582
|
+
var builder = imageUrlBuilder(client);
|
|
1583
|
+
|
|
1584
|
+
var urlFor = function urlFor(source) {
|
|
1585
|
+
return builder.image(source);
|
|
1586
|
+
};
|
|
2217
1587
|
|
|
2218
1588
|
return React__default.createElement(
|
|
2219
1589
|
'div',
|
|
@@ -2222,7 +1592,13 @@ var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
|
2222
1592
|
return React__default.createElement(
|
|
2223
1593
|
Media,
|
|
2224
1594
|
{ className: 'mb-3 thumbnail-card' },
|
|
2225
|
-
React__default.createElement('img', {
|
|
1595
|
+
React__default.createElement('img', {
|
|
1596
|
+
width: size,
|
|
1597
|
+
height: size,
|
|
1598
|
+
className: 'mr-3',
|
|
1599
|
+
src: item.thumbnail && item.thumbnail.asset ? urlFor(item.thumbnail.asset).url() : defaultImage,
|
|
1600
|
+
alt: 'Generic placeholder'
|
|
1601
|
+
}),
|
|
2226
1602
|
React__default.createElement(
|
|
2227
1603
|
Media.Body,
|
|
2228
1604
|
null,
|
|
@@ -2248,8 +1624,15 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2248
1624
|
_props$icon = props.icon,
|
|
2249
1625
|
icon = _props$icon === undefined ? false : _props$icon,
|
|
2250
1626
|
data = props.dataRecord,
|
|
2251
|
-
defaultImage = props.defaultImage
|
|
1627
|
+
defaultImage = props.defaultImage,
|
|
1628
|
+
client = props.client;
|
|
1629
|
+
|
|
1630
|
+
|
|
1631
|
+
var builder = imageUrlBuilder(client);
|
|
2252
1632
|
|
|
1633
|
+
var urlFor = function urlFor(source) {
|
|
1634
|
+
return builder.image(source);
|
|
1635
|
+
};
|
|
2253
1636
|
|
|
2254
1637
|
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
2255
1638
|
|
|
@@ -2270,8 +1653,7 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2270
1653
|
} else {
|
|
2271
1654
|
lgVar = 6;
|
|
2272
1655
|
}
|
|
2273
|
-
var thumbnailURL =
|
|
2274
|
-
|
|
1656
|
+
var thumbnailURL = row.thumbnail && row.thumbnail.asset ? urlFor(row.thumbnail.asset).url() : defaultImage;
|
|
2275
1657
|
return React__default.createElement(
|
|
2276
1658
|
Col,
|
|
2277
1659
|
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
@@ -2326,7 +1708,8 @@ var TaxonomyCard = function TaxonomyCard(props) {
|
|
|
2326
1708
|
top: '50%',
|
|
2327
1709
|
transform: 'translateY(-50%) translateX(50px)',
|
|
2328
1710
|
transition: 'all .25s',
|
|
2329
|
-
pointerEvents: 'none'
|
|
1711
|
+
pointerEvents: 'none'
|
|
1712
|
+
} },
|
|
2330
1713
|
'\u2192'
|
|
2331
1714
|
)
|
|
2332
1715
|
)
|
|
@@ -3083,7 +2466,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
3083
2466
|
),
|
|
3084
2467
|
React__default.createElement(
|
|
3085
2468
|
Navbar,
|
|
3086
|
-
{ className: 'bottom-nav', variant: 'dark', expand: '
|
|
2469
|
+
{ className: 'bottom-nav', variant: 'dark', expand: 'xl', bg: 'primary', sticky: 'top' },
|
|
3087
2470
|
React__default.createElement(
|
|
3088
2471
|
Container,
|
|
3089
2472
|
{ className: 'position-relative' },
|
|
@@ -3146,7 +2529,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
3146
2529
|
React__default.createElement(
|
|
3147
2530
|
'style',
|
|
3148
2531
|
{ jsx: true },
|
|
3149
|
-
'\n .mobile-logo{\n display: none;\n position: absolute;\n left: 50%;\n top: 0;\n height: 40px;\n transform: translateX(-50%);\n }\n .mobile-logo img{\n height: 100%;\n }\n @media screen and (max-width:
|
|
2532
|
+
'\n .mobile-logo{\n display: none;\n position: absolute;\n left: 50%;\n top: 0;\n height: 40px;\n transform: translateX(-50%);\n }\n .mobile-logo img{\n height: 100%;\n }\n @media screen and (max-width: 1199px){\n .mobile-logo{\n display: block;\n }\n .top-nav{\n display: none;\n }\n }\n '
|
|
3150
2533
|
)
|
|
3151
2534
|
);
|
|
3152
2535
|
};
|
|
@@ -5803,30 +5186,40 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
5803
5186
|
|
|
5804
5187
|
var FigureComponent = function FigureComponent(_ref) {
|
|
5805
5188
|
var caption = _ref.caption,
|
|
5806
|
-
asset = _ref.asset
|
|
5189
|
+
asset = _ref.asset,
|
|
5190
|
+
client = _ref.client;
|
|
5807
5191
|
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5192
|
+
var builder = imageUrlBuilder(client);
|
|
5193
|
+
|
|
5194
|
+
var urlFor = function urlFor(source) {
|
|
5195
|
+
return builder.image(source);
|
|
5196
|
+
};
|
|
5197
|
+
|
|
5198
|
+
return React__default.createElement(
|
|
5199
|
+
'div',
|
|
5200
|
+
{ style: { textAlign: 'center', marginTop: '1em', marginBottom: '1em' } },
|
|
5201
|
+
React__default.createElement(
|
|
5202
|
+
reactBootstrap.Figure,
|
|
5203
|
+
null,
|
|
5204
|
+
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(asset).url() }),
|
|
5205
|
+
caption && React__default.createElement(
|
|
5206
|
+
reactBootstrap.Figure.Caption,
|
|
5814
5207
|
null,
|
|
5815
|
-
|
|
5816
|
-
caption && React__default.createElement(
|
|
5817
|
-
reactBootstrap.Figure.Caption,
|
|
5818
|
-
null,
|
|
5819
|
-
caption
|
|
5820
|
-
)
|
|
5208
|
+
caption
|
|
5821
5209
|
)
|
|
5822
|
-
)
|
|
5823
|
-
|
|
5824
|
-
return null;
|
|
5210
|
+
)
|
|
5211
|
+
);
|
|
5825
5212
|
};
|
|
5826
5213
|
|
|
5827
5214
|
var Slideshow = function Slideshow(_ref) {
|
|
5828
|
-
var slides = _ref.slides
|
|
5215
|
+
var slides = _ref.slides,
|
|
5216
|
+
client = _ref.client;
|
|
5217
|
+
|
|
5218
|
+
var builder = imageUrlBuilder(client);
|
|
5829
5219
|
|
|
5220
|
+
var urlFor = function urlFor(source) {
|
|
5221
|
+
return builder.image(source);
|
|
5222
|
+
};
|
|
5830
5223
|
return React__default.createElement(
|
|
5831
5224
|
'div',
|
|
5832
5225
|
{ style: { marginTop: '1em', marginBottom: '1em' } },
|
|
@@ -5837,14 +5230,14 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
5837
5230
|
return React__default.createElement(
|
|
5838
5231
|
reactBootstrap.Carousel.Item,
|
|
5839
5232
|
{ key: slide._key },
|
|
5840
|
-
React__default.createElement('img', {
|
|
5233
|
+
React__default.createElement('img', { src: urlFor(slide.asset).url(), style: { width: '100%' } })
|
|
5841
5234
|
);
|
|
5842
5235
|
})
|
|
5843
5236
|
)
|
|
5844
5237
|
);
|
|
5845
5238
|
};
|
|
5846
5239
|
|
|
5847
|
-
var isArray
|
|
5240
|
+
var isArray = Array.isArray;
|
|
5848
5241
|
var keyList = Object.keys;
|
|
5849
5242
|
var hasProp = Object.prototype.hasOwnProperty;
|
|
5850
5243
|
|
|
@@ -5852,8 +5245,8 @@ var fastDeepEqual = function equal(a, b) {
|
|
|
5852
5245
|
if (a === b) return true;
|
|
5853
5246
|
|
|
5854
5247
|
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
5855
|
-
var arrA = isArray
|
|
5856
|
-
, arrB = isArray
|
|
5248
|
+
var arrA = isArray(a)
|
|
5249
|
+
, arrB = isArray(b)
|
|
5857
5250
|
, i
|
|
5858
5251
|
, length
|
|
5859
5252
|
, key;
|
|
@@ -6935,7 +6328,7 @@ function format(f) {
|
|
|
6935
6328
|
}
|
|
6936
6329
|
});
|
|
6937
6330
|
for (var x = args[i]; i < len; x = args[++i]) {
|
|
6938
|
-
if (isNull(x) || !isObject
|
|
6331
|
+
if (isNull(x) || !isObject(x)) {
|
|
6939
6332
|
str += ' ' + x;
|
|
6940
6333
|
} else {
|
|
6941
6334
|
str += ' ' + inspect(x);
|
|
@@ -7086,7 +6479,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7086
6479
|
// Check that value is an object with an inspect function on it
|
|
7087
6480
|
if (ctx.customInspect &&
|
|
7088
6481
|
value &&
|
|
7089
|
-
isFunction
|
|
6482
|
+
isFunction(value.inspect) &&
|
|
7090
6483
|
// Filter out the util module, it's inspect function is special
|
|
7091
6484
|
value.inspect !== inspect &&
|
|
7092
6485
|
// Also filter out any prototype objects using the circular check.
|
|
@@ -7121,7 +6514,7 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7121
6514
|
|
|
7122
6515
|
// Some type of object without properties can be shortcutted.
|
|
7123
6516
|
if (keys.length === 0) {
|
|
7124
|
-
if (isFunction
|
|
6517
|
+
if (isFunction(value)) {
|
|
7125
6518
|
var name = value.name ? ': ' + value.name : '';
|
|
7126
6519
|
return ctx.stylize('[Function' + name + ']', 'special');
|
|
7127
6520
|
}
|
|
@@ -7139,13 +6532,13 @@ function formatValue(ctx, value, recurseTimes) {
|
|
|
7139
6532
|
var base = '', array = false, braces = ['{', '}'];
|
|
7140
6533
|
|
|
7141
6534
|
// Make Array say that they are Array
|
|
7142
|
-
if (isArray$
|
|
6535
|
+
if (isArray$1(value)) {
|
|
7143
6536
|
array = true;
|
|
7144
6537
|
braces = ['[', ']'];
|
|
7145
6538
|
}
|
|
7146
6539
|
|
|
7147
6540
|
// Make functions say that they are functions
|
|
7148
|
-
if (isFunction
|
|
6541
|
+
if (isFunction(value)) {
|
|
7149
6542
|
var n = value.name ? ': ' + value.name : '';
|
|
7150
6543
|
base = ' [Function' + n + ']';
|
|
7151
6544
|
}
|
|
@@ -7221,7 +6614,7 @@ function formatError(value) {
|
|
|
7221
6614
|
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
7222
6615
|
var output = [];
|
|
7223
6616
|
for (var i = 0, l = value.length; i < l; ++i) {
|
|
7224
|
-
if (hasOwnProperty
|
|
6617
|
+
if (hasOwnProperty(value, String(i))) {
|
|
7225
6618
|
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
7226
6619
|
String(i), true));
|
|
7227
6620
|
} else {
|
|
@@ -7252,7 +6645,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
|
7252
6645
|
str = ctx.stylize('[Setter]', 'special');
|
|
7253
6646
|
}
|
|
7254
6647
|
}
|
|
7255
|
-
if (!hasOwnProperty
|
|
6648
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
|
7256
6649
|
name = '[' + key + ']';
|
|
7257
6650
|
}
|
|
7258
6651
|
if (!str) {
|
|
@@ -7318,7 +6711,7 @@ function reduceToSingleString(output, base, braces) {
|
|
|
7318
6711
|
|
|
7319
6712
|
// NOTE: These type checking functions intentionally don't use `instanceof`
|
|
7320
6713
|
// because it is fragile and can be easily faked with `Object.create()`.
|
|
7321
|
-
function isArray$
|
|
6714
|
+
function isArray$1(ar) {
|
|
7322
6715
|
return Array.isArray(ar);
|
|
7323
6716
|
}
|
|
7324
6717
|
|
|
@@ -7342,7 +6735,7 @@ function isString(arg) {
|
|
|
7342
6735
|
return typeof arg === 'string';
|
|
7343
6736
|
}
|
|
7344
6737
|
|
|
7345
|
-
function isSymbol
|
|
6738
|
+
function isSymbol(arg) {
|
|
7346
6739
|
return typeof arg === 'symbol';
|
|
7347
6740
|
}
|
|
7348
6741
|
|
|
@@ -7351,23 +6744,23 @@ function isUndefined(arg) {
|
|
|
7351
6744
|
}
|
|
7352
6745
|
|
|
7353
6746
|
function isRegExp(re) {
|
|
7354
|
-
return isObject
|
|
6747
|
+
return isObject(re) && objectToString(re) === '[object RegExp]';
|
|
7355
6748
|
}
|
|
7356
6749
|
|
|
7357
|
-
function isObject
|
|
6750
|
+
function isObject(arg) {
|
|
7358
6751
|
return typeof arg === 'object' && arg !== null;
|
|
7359
6752
|
}
|
|
7360
6753
|
|
|
7361
6754
|
function isDate(d) {
|
|
7362
|
-
return isObject
|
|
6755
|
+
return isObject(d) && objectToString(d) === '[object Date]';
|
|
7363
6756
|
}
|
|
7364
6757
|
|
|
7365
6758
|
function isError(e) {
|
|
7366
|
-
return isObject
|
|
7367
|
-
(objectToString
|
|
6759
|
+
return isObject(e) &&
|
|
6760
|
+
(objectToString(e) === '[object Error]' || e instanceof Error);
|
|
7368
6761
|
}
|
|
7369
6762
|
|
|
7370
|
-
function isFunction
|
|
6763
|
+
function isFunction(arg) {
|
|
7371
6764
|
return typeof arg === 'function';
|
|
7372
6765
|
}
|
|
7373
6766
|
|
|
@@ -7384,7 +6777,7 @@ function isBuffer(maybeBuf) {
|
|
|
7384
6777
|
return Buffer.isBuffer(maybeBuf);
|
|
7385
6778
|
}
|
|
7386
6779
|
|
|
7387
|
-
function objectToString
|
|
6780
|
+
function objectToString(o) {
|
|
7388
6781
|
return Object.prototype.toString.call(o);
|
|
7389
6782
|
}
|
|
7390
6783
|
|
|
@@ -7414,7 +6807,7 @@ function log() {
|
|
|
7414
6807
|
|
|
7415
6808
|
function _extend(origin, add) {
|
|
7416
6809
|
// Don't do anything if add isn't an object
|
|
7417
|
-
if (!add || !isObject
|
|
6810
|
+
if (!add || !isObject(add)) return origin;
|
|
7418
6811
|
|
|
7419
6812
|
var keys = Object.keys(add);
|
|
7420
6813
|
var i = keys.length;
|
|
@@ -7423,7 +6816,7 @@ function _extend(origin, add) {
|
|
|
7423
6816
|
}
|
|
7424
6817
|
return origin;
|
|
7425
6818
|
}
|
|
7426
|
-
function hasOwnProperty
|
|
6819
|
+
function hasOwnProperty(obj, prop) {
|
|
7427
6820
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
7428
6821
|
}
|
|
7429
6822
|
|
|
@@ -7433,19 +6826,19 @@ var util = {
|
|
|
7433
6826
|
log: log,
|
|
7434
6827
|
isBuffer: isBuffer,
|
|
7435
6828
|
isPrimitive: isPrimitive,
|
|
7436
|
-
isFunction: isFunction
|
|
6829
|
+
isFunction: isFunction,
|
|
7437
6830
|
isError: isError,
|
|
7438
6831
|
isDate: isDate,
|
|
7439
|
-
isObject: isObject
|
|
6832
|
+
isObject: isObject,
|
|
7440
6833
|
isRegExp: isRegExp,
|
|
7441
6834
|
isUndefined: isUndefined,
|
|
7442
|
-
isSymbol: isSymbol
|
|
6835
|
+
isSymbol: isSymbol,
|
|
7443
6836
|
isString: isString,
|
|
7444
6837
|
isNumber: isNumber,
|
|
7445
6838
|
isNullOrUndefined: isNullOrUndefined,
|
|
7446
6839
|
isNull: isNull,
|
|
7447
6840
|
isBoolean: isBoolean,
|
|
7448
|
-
isArray: isArray$
|
|
6841
|
+
isArray: isArray$1,
|
|
7449
6842
|
inspect: inspect,
|
|
7450
6843
|
deprecate: deprecate,
|
|
7451
6844
|
format: format,
|
|
@@ -7454,7 +6847,7 @@ var util = {
|
|
|
7454
6847
|
|
|
7455
6848
|
var require$$2 = {};
|
|
7456
6849
|
|
|
7457
|
-
var node = createCommonjsModule(function (module, exports) {
|
|
6850
|
+
var node$1 = createCommonjsModule(function (module, exports) {
|
|
7458
6851
|
/**
|
|
7459
6852
|
* Module dependencies.
|
|
7460
6853
|
*/
|
|
@@ -7704,14 +7097,14 @@ function init (debug$$1) {
|
|
|
7704
7097
|
|
|
7705
7098
|
exports.enable(load());
|
|
7706
7099
|
});
|
|
7707
|
-
var node_1 = node.init;
|
|
7708
|
-
var node_2 = node.log;
|
|
7709
|
-
var node_3 = node.formatArgs;
|
|
7710
|
-
var node_4 = node.save;
|
|
7711
|
-
var node_5 = node.load;
|
|
7712
|
-
var node_6 = node.useColors;
|
|
7713
|
-
var node_7 = node.colors;
|
|
7714
|
-
var node_8 = node.inspectOpts;
|
|
7100
|
+
var node_1 = node$1.init;
|
|
7101
|
+
var node_2 = node$1.log;
|
|
7102
|
+
var node_3 = node$1.formatArgs;
|
|
7103
|
+
var node_4 = node$1.save;
|
|
7104
|
+
var node_5 = node$1.load;
|
|
7105
|
+
var node_6 = node$1.useColors;
|
|
7106
|
+
var node_7 = node$1.colors;
|
|
7107
|
+
var node_8 = node$1.inspectOpts;
|
|
7715
7108
|
|
|
7716
7109
|
var src = createCommonjsModule(function (module) {
|
|
7717
7110
|
/**
|
|
@@ -7722,7 +7115,7 @@ var src = createCommonjsModule(function (module) {
|
|
|
7722
7115
|
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
|
7723
7116
|
module.exports = browser;
|
|
7724
7117
|
} else {
|
|
7725
|
-
module.exports = node;
|
|
7118
|
+
module.exports = node$1;
|
|
7726
7119
|
}
|
|
7727
7120
|
});
|
|
7728
7121
|
|
|
@@ -8474,7 +7867,7 @@ object-assign
|
|
|
8474
7867
|
*/
|
|
8475
7868
|
/* eslint-disable no-unused-vars */
|
|
8476
7869
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
8477
|
-
var hasOwnProperty$
|
|
7870
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
8478
7871
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
8479
7872
|
|
|
8480
7873
|
function toObject(val) {
|
|
@@ -8524,580 +7917,43 @@ function shouldUseNative() {
|
|
|
8524
7917
|
|
|
8525
7918
|
return true;
|
|
8526
7919
|
} catch (err) {
|
|
8527
|
-
// We don't expect any of the above to throw, but better to be safe.
|
|
8528
|
-
return false;
|
|
8529
|
-
}
|
|
8530
|
-
}
|
|
8531
|
-
|
|
8532
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
8533
|
-
var from;
|
|
8534
|
-
var to = toObject(target);
|
|
8535
|
-
var symbols;
|
|
8536
|
-
|
|
8537
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
8538
|
-
from = Object(arguments[s]);
|
|
8539
|
-
|
|
8540
|
-
for (var key in from) {
|
|
8541
|
-
if (hasOwnProperty$5.call(from, key)) {
|
|
8542
|
-
to[key] = from[key];
|
|
8543
|
-
}
|
|
8544
|
-
}
|
|
8545
|
-
|
|
8546
|
-
if (getOwnPropertySymbols) {
|
|
8547
|
-
symbols = getOwnPropertySymbols(from);
|
|
8548
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
8549
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
8550
|
-
to[symbols[i]] = from[symbols[i]];
|
|
8551
|
-
}
|
|
8552
|
-
}
|
|
8553
|
-
}
|
|
8554
|
-
}
|
|
8555
|
-
|
|
8556
|
-
return to;
|
|
8557
|
-
};
|
|
8558
|
-
|
|
8559
|
-
var baseUrl = 'https://docs.sanity.io/help/';
|
|
8560
|
-
|
|
8561
|
-
var generateHelpUrl = function generateHelpUrl(slug) {
|
|
8562
|
-
return baseUrl + slug
|
|
8563
|
-
};
|
|
8564
|
-
|
|
8565
|
-
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
8566
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8567
|
-
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
8568
|
-
function parseAssetId(ref) {
|
|
8569
|
-
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
8570
|
-
if (!id || !dimensionString || !format) {
|
|
8571
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
8572
|
-
}
|
|
8573
|
-
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
8574
|
-
var width = +imgWidthStr;
|
|
8575
|
-
var height = +imgHeightStr;
|
|
8576
|
-
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
8577
|
-
if (!isValidAssetId) {
|
|
8578
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
8579
|
-
}
|
|
8580
|
-
return { id: id, width: width, height: height, format: format };
|
|
8581
|
-
}
|
|
8582
|
-
exports.default = parseAssetId;
|
|
8583
|
-
|
|
8584
|
-
});
|
|
8585
|
-
|
|
8586
|
-
unwrapExports(parseAssetId_1);
|
|
8587
|
-
|
|
8588
|
-
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
8589
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
8590
|
-
__assign = Object.assign || function(t) {
|
|
8591
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8592
|
-
s = arguments[i];
|
|
8593
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8594
|
-
t[p] = s[p];
|
|
8595
|
-
}
|
|
8596
|
-
return t;
|
|
8597
|
-
};
|
|
8598
|
-
return __assign.apply(this, arguments);
|
|
8599
|
-
};
|
|
8600
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8601
|
-
var isRef = function (src) {
|
|
8602
|
-
var source = src;
|
|
8603
|
-
return source ? typeof source._ref === 'string' : false;
|
|
8604
|
-
};
|
|
8605
|
-
var isAsset = function (src) {
|
|
8606
|
-
var source = src;
|
|
8607
|
-
return source ? typeof source._id === 'string' : false;
|
|
8608
|
-
};
|
|
8609
|
-
var isAssetStub = function (src) {
|
|
8610
|
-
var source = src;
|
|
8611
|
-
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
8612
|
-
};
|
|
8613
|
-
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
8614
|
-
// eslint-disable-next-line complexity
|
|
8615
|
-
function parseSource(source) {
|
|
8616
|
-
if (!source) {
|
|
8617
|
-
return null;
|
|
8618
|
-
}
|
|
8619
|
-
var image;
|
|
8620
|
-
if (typeof source === 'string' && isUrl(source)) {
|
|
8621
|
-
// Someone passed an existing image url?
|
|
8622
|
-
image = {
|
|
8623
|
-
asset: { _ref: urlToId(source) }
|
|
8624
|
-
};
|
|
8625
|
-
}
|
|
8626
|
-
else if (typeof source === 'string') {
|
|
8627
|
-
// Just an asset id
|
|
8628
|
-
image = {
|
|
8629
|
-
asset: { _ref: source }
|
|
8630
|
-
};
|
|
8631
|
-
}
|
|
8632
|
-
else if (isRef(source)) {
|
|
8633
|
-
// We just got passed an asset directly
|
|
8634
|
-
image = {
|
|
8635
|
-
asset: source
|
|
8636
|
-
};
|
|
8637
|
-
}
|
|
8638
|
-
else if (isAsset(source)) {
|
|
8639
|
-
// If we were passed an image asset document
|
|
8640
|
-
image = {
|
|
8641
|
-
asset: {
|
|
8642
|
-
_ref: source._id || ''
|
|
8643
|
-
}
|
|
8644
|
-
};
|
|
8645
|
-
}
|
|
8646
|
-
else if (isAssetStub(source)) {
|
|
8647
|
-
// If we were passed a partial asset (`url`, but no `_id`)
|
|
8648
|
-
image = {
|
|
8649
|
-
asset: {
|
|
8650
|
-
_ref: urlToId(source.asset.url)
|
|
8651
|
-
}
|
|
8652
|
-
};
|
|
8653
|
-
}
|
|
8654
|
-
else if (typeof source.asset === 'object') {
|
|
8655
|
-
// Probably an actual image with materialized asset
|
|
8656
|
-
image = source;
|
|
8657
|
-
}
|
|
8658
|
-
else {
|
|
8659
|
-
// We got something that does not look like an image, or it is an image
|
|
8660
|
-
// that currently isn't sporting an asset.
|
|
8661
|
-
return null;
|
|
8662
|
-
}
|
|
8663
|
-
var img = source;
|
|
8664
|
-
if (img.crop) {
|
|
8665
|
-
image.crop = img.crop;
|
|
8666
|
-
}
|
|
8667
|
-
if (img.hotspot) {
|
|
8668
|
-
image.hotspot = img.hotspot;
|
|
8669
|
-
}
|
|
8670
|
-
return applyDefaults(image);
|
|
8671
|
-
}
|
|
8672
|
-
exports.default = parseSource;
|
|
8673
|
-
function isUrl(url) {
|
|
8674
|
-
return /^https?:\/\//.test("" + url);
|
|
8675
|
-
}
|
|
8676
|
-
function urlToId(url) {
|
|
8677
|
-
var parts = url.split('/').slice(-1);
|
|
8678
|
-
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
8679
|
-
}
|
|
8680
|
-
// Mock crop and hotspot if image lacks it
|
|
8681
|
-
function applyDefaults(image) {
|
|
8682
|
-
if (image.crop && image.hotspot) {
|
|
8683
|
-
return image;
|
|
8684
|
-
}
|
|
8685
|
-
// We need to pad in default values for crop or hotspot
|
|
8686
|
-
var result = __assign({}, image);
|
|
8687
|
-
if (!result.crop) {
|
|
8688
|
-
result.crop = {
|
|
8689
|
-
left: 0,
|
|
8690
|
-
top: 0,
|
|
8691
|
-
bottom: 0,
|
|
8692
|
-
right: 0
|
|
8693
|
-
};
|
|
8694
|
-
}
|
|
8695
|
-
if (!result.hotspot) {
|
|
8696
|
-
result.hotspot = {
|
|
8697
|
-
x: 0.5,
|
|
8698
|
-
y: 0.5,
|
|
8699
|
-
height: 1.0,
|
|
8700
|
-
width: 1.0
|
|
8701
|
-
};
|
|
8702
|
-
}
|
|
8703
|
-
return result;
|
|
8704
|
-
}
|
|
8705
|
-
|
|
8706
|
-
});
|
|
8707
|
-
|
|
8708
|
-
unwrapExports(parseSource_1);
|
|
8709
|
-
|
|
8710
|
-
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
8711
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
8712
|
-
__assign = Object.assign || function(t) {
|
|
8713
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8714
|
-
s = arguments[i];
|
|
8715
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8716
|
-
t[p] = s[p];
|
|
8717
|
-
}
|
|
8718
|
-
return t;
|
|
8719
|
-
};
|
|
8720
|
-
return __assign.apply(this, arguments);
|
|
8721
|
-
};
|
|
8722
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
8723
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8724
|
-
};
|
|
8725
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8726
|
-
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
8727
|
-
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
8728
|
-
exports.parseSource = parseSource_1$$1.default;
|
|
8729
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
8730
|
-
['width', 'w'],
|
|
8731
|
-
['height', 'h'],
|
|
8732
|
-
['format', 'fm'],
|
|
8733
|
-
['download', 'dl'],
|
|
8734
|
-
['blur', 'blur'],
|
|
8735
|
-
['sharpen', 'sharp'],
|
|
8736
|
-
['invert', 'invert'],
|
|
8737
|
-
['orientation', 'or'],
|
|
8738
|
-
['minHeight', 'min-h'],
|
|
8739
|
-
['maxHeight', 'max-h'],
|
|
8740
|
-
['minWidth', 'min-w'],
|
|
8741
|
-
['maxWidth', 'max-w'],
|
|
8742
|
-
['quality', 'q'],
|
|
8743
|
-
['fit', 'fit'],
|
|
8744
|
-
['crop', 'crop'],
|
|
8745
|
-
['auto', 'auto'],
|
|
8746
|
-
['dpr', 'dpr']
|
|
8747
|
-
];
|
|
8748
|
-
function urlForImage(options) {
|
|
8749
|
-
var spec = __assign({}, (options || {}));
|
|
8750
|
-
var source = spec.source;
|
|
8751
|
-
delete spec.source;
|
|
8752
|
-
var image = parseSource_1$$1.default(source);
|
|
8753
|
-
if (!image) {
|
|
8754
|
-
return null;
|
|
8755
|
-
}
|
|
8756
|
-
var id = image.asset._ref || image.asset._id || '';
|
|
8757
|
-
var asset = parseAssetId_1$$1.default(id);
|
|
8758
|
-
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
8759
|
-
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
8760
|
-
var cropTop = Math.round(image.crop.top * asset.height);
|
|
8761
|
-
var crop = {
|
|
8762
|
-
left: cropLeft,
|
|
8763
|
-
top: cropTop,
|
|
8764
|
-
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
8765
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
8766
|
-
};
|
|
8767
|
-
// Compute hot spot rect in terms of pixel coordinates
|
|
8768
|
-
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
8769
|
-
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
8770
|
-
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
8771
|
-
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
8772
|
-
var hotspot = {
|
|
8773
|
-
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
8774
|
-
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
8775
|
-
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
8776
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
8777
|
-
};
|
|
8778
|
-
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
8779
|
-
// the crop/hotspot.
|
|
8780
|
-
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
8781
|
-
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
8782
|
-
}
|
|
8783
|
-
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
8784
|
-
}
|
|
8785
|
-
exports.default = urlForImage;
|
|
8786
|
-
// eslint-disable-next-line complexity
|
|
8787
|
-
function specToImageUrl(spec) {
|
|
8788
|
-
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
8789
|
-
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
8790
|
-
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
8791
|
-
var params = [];
|
|
8792
|
-
if (spec.rect) {
|
|
8793
|
-
// Only bother url with a crop if it actually crops anything
|
|
8794
|
-
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
8795
|
-
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
8796
|
-
if (isEffectiveCrop) {
|
|
8797
|
-
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
8798
|
-
}
|
|
8799
|
-
}
|
|
8800
|
-
if (spec.bg) {
|
|
8801
|
-
params.push("bg=" + spec.bg);
|
|
8802
|
-
}
|
|
8803
|
-
if (spec.focalPoint) {
|
|
8804
|
-
params.push("fp-x=" + spec.focalPoint.x);
|
|
8805
|
-
params.push("fp-x=" + spec.focalPoint.y);
|
|
8806
|
-
}
|
|
8807
|
-
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
8808
|
-
if (flip) {
|
|
8809
|
-
params.push("flip=" + flip);
|
|
8810
|
-
}
|
|
8811
|
-
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
8812
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
8813
|
-
var specName = mapping[0], param = mapping[1];
|
|
8814
|
-
if (typeof spec[specName] !== 'undefined') {
|
|
8815
|
-
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
8816
|
-
}
|
|
8817
|
-
else if (typeof spec[param] !== 'undefined') {
|
|
8818
|
-
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
8819
|
-
}
|
|
8820
|
-
});
|
|
8821
|
-
if (params.length === 0) {
|
|
8822
|
-
return baseUrl;
|
|
8823
|
-
}
|
|
8824
|
-
return baseUrl + "?" + params.join('&');
|
|
8825
|
-
}
|
|
8826
|
-
function fit(source, spec) {
|
|
8827
|
-
var cropRect;
|
|
8828
|
-
var imgWidth = spec.width;
|
|
8829
|
-
var imgHeight = spec.height;
|
|
8830
|
-
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
8831
|
-
if (!(imgWidth && imgHeight)) {
|
|
8832
|
-
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
8833
|
-
}
|
|
8834
|
-
var crop = source.crop;
|
|
8835
|
-
var hotspot = source.hotspot;
|
|
8836
|
-
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
8837
|
-
var desiredAspectRatio = imgWidth / imgHeight;
|
|
8838
|
-
var cropAspectRatio = crop.width / crop.height;
|
|
8839
|
-
if (cropAspectRatio > desiredAspectRatio) {
|
|
8840
|
-
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
8841
|
-
var height = crop.height;
|
|
8842
|
-
var width = height * desiredAspectRatio;
|
|
8843
|
-
var top_2 = crop.top;
|
|
8844
|
-
// Center output horizontally over hotspot
|
|
8845
|
-
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
8846
|
-
var left = hotspotXCenter - width / 2;
|
|
8847
|
-
// Keep output within crop
|
|
8848
|
-
if (left < crop.left) {
|
|
8849
|
-
left = crop.left;
|
|
8850
|
-
}
|
|
8851
|
-
else if (left + width > crop.left + crop.width) {
|
|
8852
|
-
left = crop.left + crop.width - width;
|
|
8853
|
-
}
|
|
8854
|
-
cropRect = {
|
|
8855
|
-
left: Math.round(left),
|
|
8856
|
-
top: Math.round(top_2),
|
|
8857
|
-
width: Math.round(width),
|
|
8858
|
-
height: Math.round(height)
|
|
8859
|
-
};
|
|
8860
|
-
}
|
|
8861
|
-
else {
|
|
8862
|
-
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
8863
|
-
var width = crop.width;
|
|
8864
|
-
var height = width / desiredAspectRatio;
|
|
8865
|
-
var left = crop.left;
|
|
8866
|
-
// Center output vertically over hotspot
|
|
8867
|
-
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
8868
|
-
var top_3 = hotspotYCenter - height / 2;
|
|
8869
|
-
// Keep output rect within crop
|
|
8870
|
-
if (top_3 < crop.top) {
|
|
8871
|
-
top_3 = crop.top;
|
|
8872
|
-
}
|
|
8873
|
-
else if (top_3 + height > crop.top + crop.height) {
|
|
8874
|
-
top_3 = crop.top + crop.height - height;
|
|
8875
|
-
}
|
|
8876
|
-
cropRect = {
|
|
8877
|
-
left: Math.max(0, Math.floor(left)),
|
|
8878
|
-
top: Math.max(0, Math.floor(top_3)),
|
|
8879
|
-
width: Math.round(width),
|
|
8880
|
-
height: Math.round(height)
|
|
8881
|
-
};
|
|
8882
|
-
}
|
|
8883
|
-
return {
|
|
8884
|
-
width: imgWidth,
|
|
8885
|
-
height: imgHeight,
|
|
8886
|
-
rect: cropRect
|
|
8887
|
-
};
|
|
7920
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
7921
|
+
return false;
|
|
7922
|
+
}
|
|
8888
7923
|
}
|
|
8889
7924
|
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
var
|
|
8894
|
-
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
7925
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
7926
|
+
var from;
|
|
7927
|
+
var to = toObject(target);
|
|
7928
|
+
var symbols;
|
|
8895
7929
|
|
|
8896
|
-
var
|
|
8897
|
-
|
|
8898
|
-
__assign = Object.assign || function(t) {
|
|
8899
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8900
|
-
s = arguments[i];
|
|
8901
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8902
|
-
t[p] = s[p];
|
|
8903
|
-
}
|
|
8904
|
-
return t;
|
|
8905
|
-
};
|
|
8906
|
-
return __assign.apply(this, arguments);
|
|
8907
|
-
};
|
|
8908
|
-
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
8909
|
-
if (mod && mod.__esModule) return mod;
|
|
8910
|
-
var result = {};
|
|
8911
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
8912
|
-
result["default"] = mod;
|
|
8913
|
-
return result;
|
|
8914
|
-
};
|
|
8915
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8916
|
-
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
8917
|
-
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
8918
|
-
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
8919
|
-
var validAutoModes = ['format'];
|
|
8920
|
-
function isSanityClient(client) {
|
|
8921
|
-
return client ? typeof client.clientConfig === 'object' : false;
|
|
8922
|
-
}
|
|
8923
|
-
function rewriteSpecName(key) {
|
|
8924
|
-
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
8925
|
-
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
8926
|
-
var entry = specs_1[_i];
|
|
8927
|
-
var specName = entry[0], param = entry[1];
|
|
8928
|
-
if (key === specName || key === param) {
|
|
8929
|
-
return specName;
|
|
8930
|
-
}
|
|
8931
|
-
}
|
|
8932
|
-
return key;
|
|
8933
|
-
}
|
|
8934
|
-
function urlBuilder(options) {
|
|
8935
|
-
// Did we get a SanityClient?
|
|
8936
|
-
var client = options;
|
|
8937
|
-
if (isSanityClient(client)) {
|
|
8938
|
-
// Inherit config from client
|
|
8939
|
-
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
8940
|
-
return new ImageUrlBuilder(null, {
|
|
8941
|
-
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
8942
|
-
projectId: projectId,
|
|
8943
|
-
dataset: dataset
|
|
8944
|
-
});
|
|
8945
|
-
}
|
|
8946
|
-
// Or just accept the options as given
|
|
8947
|
-
return new ImageUrlBuilder(null, options);
|
|
8948
|
-
}
|
|
8949
|
-
exports.default = urlBuilder;
|
|
8950
|
-
var ImageUrlBuilder = /** @class */ (function () {
|
|
8951
|
-
function ImageUrlBuilder(parent, options) {
|
|
8952
|
-
this.options = parent
|
|
8953
|
-
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
8954
|
-
}
|
|
8955
|
-
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
8956
|
-
var baseUrl = options.baseUrl || '';
|
|
8957
|
-
var newOptions = { baseUrl: baseUrl };
|
|
8958
|
-
for (var key in options) {
|
|
8959
|
-
if (options.hasOwnProperty(key)) {
|
|
8960
|
-
var specKey = rewriteSpecName(key);
|
|
8961
|
-
newOptions[specKey] = options[key];
|
|
8962
|
-
}
|
|
8963
|
-
}
|
|
8964
|
-
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
8965
|
-
};
|
|
8966
|
-
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
8967
|
-
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
8968
|
-
// studio, the 'image'-document must be provided.
|
|
8969
|
-
ImageUrlBuilder.prototype.image = function (source) {
|
|
8970
|
-
return this.withOptions({ source: source });
|
|
8971
|
-
};
|
|
8972
|
-
// Specify the dataset
|
|
8973
|
-
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
8974
|
-
return this.withOptions({ dataset: dataset });
|
|
8975
|
-
};
|
|
8976
|
-
// Specify the projectId
|
|
8977
|
-
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
8978
|
-
return this.withOptions({ projectId: projectId });
|
|
8979
|
-
};
|
|
8980
|
-
// Specify background color
|
|
8981
|
-
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
8982
|
-
return this.withOptions({ bg: bg });
|
|
8983
|
-
};
|
|
8984
|
-
// Set DPR scaling factor
|
|
8985
|
-
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
8986
|
-
return this.withOptions({ dpr: dpr });
|
|
8987
|
-
};
|
|
8988
|
-
// Specify the width of the image in pixels
|
|
8989
|
-
ImageUrlBuilder.prototype.width = function (width) {
|
|
8990
|
-
return this.withOptions({ width: width });
|
|
8991
|
-
};
|
|
8992
|
-
// Specify the height of the image in pixels
|
|
8993
|
-
ImageUrlBuilder.prototype.height = function (height) {
|
|
8994
|
-
return this.withOptions({ height: height });
|
|
8995
|
-
};
|
|
8996
|
-
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
8997
|
-
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
8998
|
-
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
8999
|
-
};
|
|
9000
|
-
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
9001
|
-
return this.withOptions({ maxWidth: maxWidth });
|
|
9002
|
-
};
|
|
9003
|
-
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
9004
|
-
return this.withOptions({ minWidth: minWidth });
|
|
9005
|
-
};
|
|
9006
|
-
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
9007
|
-
return this.withOptions({ maxHeight: maxHeight });
|
|
9008
|
-
};
|
|
9009
|
-
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
9010
|
-
return this.withOptions({ minHeight: minHeight });
|
|
9011
|
-
};
|
|
9012
|
-
// Specify width and height in pixels
|
|
9013
|
-
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
9014
|
-
return this.withOptions({ width: width, height: height });
|
|
9015
|
-
};
|
|
9016
|
-
// Specify blur between 0 and 100
|
|
9017
|
-
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
9018
|
-
return this.withOptions({ blur: blur });
|
|
9019
|
-
};
|
|
9020
|
-
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
9021
|
-
return this.withOptions({ sharpen: sharpen });
|
|
9022
|
-
};
|
|
9023
|
-
// Specify the desired rectangle of the image
|
|
9024
|
-
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
9025
|
-
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
9026
|
-
};
|
|
9027
|
-
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
9028
|
-
ImageUrlBuilder.prototype.format = function (format) {
|
|
9029
|
-
return this.withOptions({ format: format });
|
|
9030
|
-
};
|
|
9031
|
-
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
9032
|
-
return this.withOptions({ invert: invert });
|
|
9033
|
-
};
|
|
9034
|
-
// Rotation in degrees 0, 90, 180, 270
|
|
9035
|
-
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
9036
|
-
return this.withOptions({ orientation: orientation });
|
|
9037
|
-
};
|
|
9038
|
-
// Compression quality 0-100
|
|
9039
|
-
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
9040
|
-
return this.withOptions({ quality: quality });
|
|
9041
|
-
};
|
|
9042
|
-
// Make it a download link. Parameter is default filename.
|
|
9043
|
-
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
9044
|
-
return this.withOptions({ download: download });
|
|
9045
|
-
};
|
|
9046
|
-
// Flip image horizontally
|
|
9047
|
-
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
9048
|
-
return this.withOptions({ flipHorizontal: true });
|
|
9049
|
-
};
|
|
9050
|
-
// Flip image verically
|
|
9051
|
-
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
9052
|
-
return this.withOptions({ flipVertical: true });
|
|
9053
|
-
};
|
|
9054
|
-
// Ignore crop/hotspot from image record, even when present
|
|
9055
|
-
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
9056
|
-
return this.withOptions({ ignoreImageParams: true });
|
|
9057
|
-
};
|
|
9058
|
-
ImageUrlBuilder.prototype.fit = function (value) {
|
|
9059
|
-
if (validFits.indexOf(value) === -1) {
|
|
9060
|
-
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
9061
|
-
}
|
|
9062
|
-
return this.withOptions({ fit: value });
|
|
9063
|
-
};
|
|
9064
|
-
ImageUrlBuilder.prototype.crop = function (value) {
|
|
9065
|
-
if (validCrops.indexOf(value) === -1) {
|
|
9066
|
-
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
9067
|
-
}
|
|
9068
|
-
return this.withOptions({ crop: value });
|
|
9069
|
-
};
|
|
9070
|
-
ImageUrlBuilder.prototype.auto = function (value) {
|
|
9071
|
-
if (validAutoModes.indexOf(value) === -1) {
|
|
9072
|
-
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
9073
|
-
}
|
|
9074
|
-
return this.withOptions({ auto: value });
|
|
9075
|
-
};
|
|
9076
|
-
// Gets the url based on the submitted parameters
|
|
9077
|
-
ImageUrlBuilder.prototype.url = function () {
|
|
9078
|
-
return urlForImage_1$$1.default(this.options);
|
|
9079
|
-
};
|
|
9080
|
-
// Synonym for url()
|
|
9081
|
-
ImageUrlBuilder.prototype.toString = function () {
|
|
9082
|
-
return this.url();
|
|
9083
|
-
};
|
|
9084
|
-
return ImageUrlBuilder;
|
|
9085
|
-
}());
|
|
7930
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
7931
|
+
from = Object(arguments[s]);
|
|
9086
7932
|
|
|
9087
|
-
|
|
7933
|
+
for (var key in from) {
|
|
7934
|
+
if (hasOwnProperty$1.call(from, key)) {
|
|
7935
|
+
to[key] = from[key];
|
|
7936
|
+
}
|
|
7937
|
+
}
|
|
9088
7938
|
|
|
9089
|
-
|
|
7939
|
+
if (getOwnPropertySymbols) {
|
|
7940
|
+
symbols = getOwnPropertySymbols(from);
|
|
7941
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
7942
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
7943
|
+
to[symbols[i]] = from[symbols[i]];
|
|
7944
|
+
}
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
9090
7948
|
|
|
9091
|
-
|
|
9092
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
9093
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7949
|
+
return to;
|
|
9094
7950
|
};
|
|
9095
|
-
var builder_1 = __importDefault(builder);
|
|
9096
|
-
module.exports = builder_1.default;
|
|
9097
7951
|
|
|
9098
|
-
|
|
7952
|
+
var baseUrl = 'https://docs.sanity.io/help/';
|
|
9099
7953
|
|
|
9100
|
-
|
|
7954
|
+
var generateHelpUrl = function generateHelpUrl(slug) {
|
|
7955
|
+
return baseUrl + slug
|
|
7956
|
+
};
|
|
9101
7957
|
|
|
9102
7958
|
var enc = encodeURIComponent;
|
|
9103
7959
|
var materializeError = "You must either:\n - Pass `projectId` and `dataset` to the block renderer\n - Materialize images to include the `url` field.\n\nFor more information, see ".concat(generateHelpUrl('block-content-image-materializing'));
|
|
@@ -9117,11 +7973,11 @@ var getQueryString = function getQueryString(options) {
|
|
|
9117
7973
|
};
|
|
9118
7974
|
|
|
9119
7975
|
var buildUrl = function buildUrl(props) {
|
|
9120
|
-
var node = props.node,
|
|
7976
|
+
var node$$1 = props.node,
|
|
9121
7977
|
options = props.options;
|
|
9122
7978
|
var projectId = options.projectId,
|
|
9123
7979
|
dataset = options.dataset;
|
|
9124
|
-
var asset = node.asset;
|
|
7980
|
+
var asset = node$$1.asset;
|
|
9125
7981
|
|
|
9126
7982
|
if (!asset) {
|
|
9127
7983
|
throw new Error('Image does not have required `asset` property');
|
|
@@ -9141,10 +7997,10 @@ var buildUrl = function buildUrl(props) {
|
|
|
9141
7997
|
throw new Error('Invalid image reference in block, no `_ref` found on `asset`');
|
|
9142
7998
|
}
|
|
9143
7999
|
|
|
9144
|
-
return node
|
|
8000
|
+
return node(objectAssign({
|
|
9145
8001
|
projectId: projectId,
|
|
9146
8002
|
dataset: dataset
|
|
9147
|
-
}, options.imageOptions || {})).image(node).toString();
|
|
8003
|
+
}, options.imageOptions || {})).image(node$$1).toString();
|
|
9148
8004
|
};
|
|
9149
8005
|
|
|
9150
8006
|
var getImageUrl = buildUrl;
|
|
@@ -9914,7 +8770,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
9914
8770
|
|
|
9915
8771
|
return React__default.createElement(
|
|
9916
8772
|
reactBootstrap.Card,
|
|
9917
|
-
{
|
|
8773
|
+
{ className: 'sidebar' },
|
|
9918
8774
|
React__default.createElement(
|
|
9919
8775
|
reactBootstrap.Card.Body,
|
|
9920
8776
|
null,
|
|
@@ -9928,6 +8784,61 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
9928
8784
|
);
|
|
9929
8785
|
};
|
|
9930
8786
|
|
|
8787
|
+
var TableShow = function TableShow(_ref) {
|
|
8788
|
+
var rows = _ref.rows;
|
|
8789
|
+
|
|
8790
|
+
return React__default.createElement(
|
|
8791
|
+
reactBootstrap.Table,
|
|
8792
|
+
{ bordered: true, hover: true, responsive: true },
|
|
8793
|
+
React__default.createElement(
|
|
8794
|
+
'tbody',
|
|
8795
|
+
null,
|
|
8796
|
+
rows && rows.map(function (row) {
|
|
8797
|
+
return React__default.createElement(
|
|
8798
|
+
'tr',
|
|
8799
|
+
{ key: row._key },
|
|
8800
|
+
row.cells && row.cells.map(function (cell, index) {
|
|
8801
|
+
return React__default.createElement(
|
|
8802
|
+
'td',
|
|
8803
|
+
{ key: index },
|
|
8804
|
+
cell
|
|
8805
|
+
);
|
|
8806
|
+
})
|
|
8807
|
+
);
|
|
8808
|
+
})
|
|
8809
|
+
)
|
|
8810
|
+
);
|
|
8811
|
+
};
|
|
8812
|
+
|
|
8813
|
+
var Media$1 = function Media$$1(_ref) {
|
|
8814
|
+
var uploadDoc = _ref.uploadDoc,
|
|
8815
|
+
poster = _ref.poster,
|
|
8816
|
+
client = _ref.client,
|
|
8817
|
+
blank = _ref.blank,
|
|
8818
|
+
caption = _ref.caption;
|
|
8819
|
+
|
|
8820
|
+
var builder = imageUrlBuilder(client);
|
|
8821
|
+
|
|
8822
|
+
var urlFor = function urlFor(source) {
|
|
8823
|
+
return builder.image(source);
|
|
8824
|
+
};
|
|
8825
|
+
|
|
8826
|
+
return React__default.createElement(
|
|
8827
|
+
reactBootstrap.Figure,
|
|
8828
|
+
null,
|
|
8829
|
+
uploadDoc ? React__default.createElement(
|
|
8830
|
+
'a',
|
|
8831
|
+
{ href: urlFor(poster.asset).url(), target: blank ? '_blank' : '_self' },
|
|
8832
|
+
React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() })
|
|
8833
|
+
) : React__default.createElement(reactBootstrap.Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
8834
|
+
caption && React__default.createElement(
|
|
8835
|
+
reactBootstrap.Figure.Caption,
|
|
8836
|
+
null,
|
|
8837
|
+
caption
|
|
8838
|
+
)
|
|
8839
|
+
);
|
|
8840
|
+
};
|
|
8841
|
+
|
|
9931
8842
|
var getSerializers$1 = function getSerializers(client) {
|
|
9932
8843
|
return {
|
|
9933
8844
|
types: {
|
|
@@ -9942,13 +8853,13 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
9942
8853
|
var asset = node.asset,
|
|
9943
8854
|
caption = node.caption;
|
|
9944
8855
|
|
|
9945
|
-
return React__default.createElement(FigureComponent, { caption: caption, asset: asset });
|
|
8856
|
+
return React__default.createElement(FigureComponent, { caption: caption, asset: asset, client: client });
|
|
9946
8857
|
},
|
|
9947
8858
|
slideshow: function slideshow(_ref3) {
|
|
9948
8859
|
var node = _ref3.node;
|
|
9949
8860
|
var slides = node.slides;
|
|
9950
8861
|
|
|
9951
|
-
return React__default.createElement(Slideshow, { slides: slides });
|
|
8862
|
+
return React__default.createElement(Slideshow, { slides: slides, client: client });
|
|
9952
8863
|
},
|
|
9953
8864
|
sidebar: function sidebar(_ref4) {
|
|
9954
8865
|
var node = _ref4.node;
|
|
@@ -9956,6 +8867,21 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
9956
8867
|
content = node.content;
|
|
9957
8868
|
|
|
9958
8869
|
return React__default.createElement(Sidebar, { caption: caption, content: content });
|
|
8870
|
+
},
|
|
8871
|
+
table: function table(_ref5) {
|
|
8872
|
+
var node = _ref5.node;
|
|
8873
|
+
var rows = node.rows;
|
|
8874
|
+
|
|
8875
|
+
return React__default.createElement(TableShow, { rows: rows });
|
|
8876
|
+
},
|
|
8877
|
+
media: function media(_ref6) {
|
|
8878
|
+
var node = _ref6.node;
|
|
8879
|
+
var upload_doc = node.upload_doc,
|
|
8880
|
+
poster = node.poster,
|
|
8881
|
+
caption = node.caption,
|
|
8882
|
+
blank = node.blank;
|
|
8883
|
+
|
|
8884
|
+
return React__default.createElement(Media$1, { uploadDoc: upload_doc, poster: poster, blank: blank, client: client, caption: caption });
|
|
9959
8885
|
}
|
|
9960
8886
|
}
|
|
9961
8887
|
};
|