@mjhls/mjh-framework 1.0.23 → 1.0.25
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 +195 -572
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +197 -570
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var Row = _interopDefault(require('react-bootstrap/Row'));
|
|
|
10
10
|
var Col = _interopDefault(require('react-bootstrap/Col'));
|
|
11
11
|
var Card = _interopDefault(require('react-bootstrap/Card'));
|
|
12
12
|
var Link = _interopDefault(require('next/link'));
|
|
13
|
+
var Media = _interopDefault(require('react-bootstrap/Media'));
|
|
13
14
|
var ListGroup = _interopDefault(require('react-bootstrap/ListGroup'));
|
|
14
15
|
var Head = _interopDefault(require('next/head'));
|
|
15
16
|
var Accordion = _interopDefault(require('react-bootstrap/Accordion'));
|
|
@@ -621,7 +622,6 @@ var DeckContent = function (_React$Component) {
|
|
|
621
622
|
|
|
622
623
|
var itemCounter = 0;
|
|
623
624
|
var lgVar = 12;
|
|
624
|
-
|
|
625
625
|
return React__default.createElement(
|
|
626
626
|
Row,
|
|
627
627
|
null,
|
|
@@ -646,7 +646,11 @@ var DeckContent = function (_React$Component) {
|
|
|
646
646
|
React__default.createElement(
|
|
647
647
|
'a',
|
|
648
648
|
null,
|
|
649
|
-
React__default.createElement(Card.Img, {
|
|
649
|
+
React__default.createElement(Card.Img, {
|
|
650
|
+
variant: 'top',
|
|
651
|
+
src: row.thumbnail.asset ? row.thumbnail.asset.url : _this.defaultImage,
|
|
652
|
+
alt: row.thumbnail.asset ? row.thumbnail.asset.originalFilename : ''
|
|
653
|
+
})
|
|
650
654
|
)
|
|
651
655
|
),
|
|
652
656
|
React__default.createElement(
|
|
@@ -940,6 +944,93 @@ var DeckQueue = function (_React$Component) {
|
|
|
940
944
|
return DeckQueue;
|
|
941
945
|
}(React__default.Component);
|
|
942
946
|
|
|
947
|
+
var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
948
|
+
var size = _ref.size,
|
|
949
|
+
mediaData = _ref.mediaData;
|
|
950
|
+
|
|
951
|
+
return React__default.createElement(
|
|
952
|
+
'div',
|
|
953
|
+
null,
|
|
954
|
+
mediaData && mediaData.map(function (item, index) {
|
|
955
|
+
return React__default.createElement(
|
|
956
|
+
Media,
|
|
957
|
+
{ className: 'mb-3' },
|
|
958
|
+
React__default.createElement('img', { width: size, height: size, className: 'mr-3', src: item.thumbnail.asset.url, alt: 'Generic placeholder' }),
|
|
959
|
+
React__default.createElement(
|
|
960
|
+
Media.Body,
|
|
961
|
+
null,
|
|
962
|
+
React__default.createElement(
|
|
963
|
+
'h5',
|
|
964
|
+
null,
|
|
965
|
+
item.title
|
|
966
|
+
),
|
|
967
|
+
React__default.createElement(
|
|
968
|
+
'p',
|
|
969
|
+
null,
|
|
970
|
+
item.summary
|
|
971
|
+
)
|
|
972
|
+
)
|
|
973
|
+
);
|
|
974
|
+
})
|
|
975
|
+
);
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
var TaxonomyCard = function TaxonomyCard(props) {
|
|
979
|
+
var columns = props.columns,
|
|
980
|
+
variant = props.variant,
|
|
981
|
+
data = props.dataRecord;
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
985
|
+
|
|
986
|
+
var itemCounter = 0;
|
|
987
|
+
var lgVar = 12;
|
|
988
|
+
|
|
989
|
+
return React__default.createElement(
|
|
990
|
+
'div',
|
|
991
|
+
{ className: 'contentDeck' },
|
|
992
|
+
React__default.createElement(
|
|
993
|
+
Row,
|
|
994
|
+
null,
|
|
995
|
+
data && data.map(function (row, index) {
|
|
996
|
+
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
997
|
+
lgVar = 12;
|
|
998
|
+
} else if (columns && columns !== 'rotate') {
|
|
999
|
+
lgVar = Math.floor(12 / columns);
|
|
1000
|
+
} else {
|
|
1001
|
+
lgVar = 6;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
return React__default.createElement(
|
|
1005
|
+
Col,
|
|
1006
|
+
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
1007
|
+
React__default.createElement(
|
|
1008
|
+
Card,
|
|
1009
|
+
{ style: { flexDirection: mode } },
|
|
1010
|
+
React__default.createElement(
|
|
1011
|
+
Card.Body,
|
|
1012
|
+
null,
|
|
1013
|
+
React__default.createElement(
|
|
1014
|
+
Link,
|
|
1015
|
+
{ href: row.url, as: row.url },
|
|
1016
|
+
React__default.createElement(
|
|
1017
|
+
'a',
|
|
1018
|
+
null,
|
|
1019
|
+
React__default.createElement(
|
|
1020
|
+
Card.Title,
|
|
1021
|
+
null,
|
|
1022
|
+
row.name
|
|
1023
|
+
)
|
|
1024
|
+
)
|
|
1025
|
+
)
|
|
1026
|
+
)
|
|
1027
|
+
)
|
|
1028
|
+
);
|
|
1029
|
+
})
|
|
1030
|
+
)
|
|
1031
|
+
);
|
|
1032
|
+
};
|
|
1033
|
+
|
|
943
1034
|
var Column1 = function Column1(props) {
|
|
944
1035
|
return React__default.createElement(
|
|
945
1036
|
'section',
|
|
@@ -949,8 +1040,8 @@ var Column1 = function Column1(props) {
|
|
|
949
1040
|
{ className: 'justify-content-md-center' },
|
|
950
1041
|
React__default.createElement(
|
|
951
1042
|
Col,
|
|
952
|
-
{ className: 'middleCol' },
|
|
953
|
-
React__default.createElement(
|
|
1043
|
+
{ className: 'middleCol', style: { marginTop: !props.title && '10px' } },
|
|
1044
|
+
props.title && React__default.createElement(
|
|
954
1045
|
'h1',
|
|
955
1046
|
null,
|
|
956
1047
|
props.title
|
|
@@ -973,8 +1064,8 @@ var Column2 = function Column2(props) {
|
|
|
973
1064
|
{ className: 'justify-content-md-center' },
|
|
974
1065
|
React__default.createElement(
|
|
975
1066
|
Col,
|
|
976
|
-
{ md: true, className: 'middleCol' },
|
|
977
|
-
React__default.createElement(
|
|
1067
|
+
{ md: true, className: 'middleCol', style: { marginTop: !props.title && '10px' } },
|
|
1068
|
+
props.title && React__default.createElement(
|
|
978
1069
|
'h1',
|
|
979
1070
|
null,
|
|
980
1071
|
props.title
|
|
@@ -1074,8 +1165,8 @@ var Column3 = function Column3(props) {
|
|
|
1074
1165
|
),
|
|
1075
1166
|
React__default.createElement(
|
|
1076
1167
|
Col,
|
|
1077
|
-
{ md: true, className: 'middleCol', style: { maxWidth: '640px' } },
|
|
1078
|
-
React__default.createElement(
|
|
1168
|
+
{ md: true, className: 'middleCol', style: { maxWidth: '640px', marginTop: !props.title && '10px' } },
|
|
1169
|
+
props.title && React__default.createElement(
|
|
1079
1170
|
'h1',
|
|
1080
1171
|
null,
|
|
1081
1172
|
props.title
|
|
@@ -1590,10 +1681,43 @@ var NavNormal = function NavNormal(props) {
|
|
|
1590
1681
|
);
|
|
1591
1682
|
};
|
|
1592
1683
|
|
|
1684
|
+
var Search = function Search(_ref) {
|
|
1685
|
+
var placeholder = _ref.placeholder,
|
|
1686
|
+
disabled = _ref.disabled,
|
|
1687
|
+
type = _ref.type,
|
|
1688
|
+
btnText = _ref.btnText,
|
|
1689
|
+
handleSearch = _ref.handleSearch;
|
|
1690
|
+
|
|
1691
|
+
var _useState = React.useState(''),
|
|
1692
|
+
_useState2 = slicedToArray(_useState, 2),
|
|
1693
|
+
searchKey = _useState2[0],
|
|
1694
|
+
setSearchKey = _useState2[1];
|
|
1695
|
+
|
|
1696
|
+
var onChangeSearch = function onChangeSearch(e) {
|
|
1697
|
+
setSearchKey(e.target.value);
|
|
1698
|
+
};
|
|
1699
|
+
|
|
1700
|
+
return React__default.createElement(
|
|
1701
|
+
'div',
|
|
1702
|
+
{ className: 'd-flex' },
|
|
1703
|
+
React__default.createElement('input', { className: 'form-control', placeholder: placeholder, disabled: disabled, type: type, value: searchKey, onChange: function onChange(e) {
|
|
1704
|
+
return onChangeSearch(e);
|
|
1705
|
+
} }),
|
|
1706
|
+
React__default.createElement(
|
|
1707
|
+
'button',
|
|
1708
|
+
{ className: 'test', onClick: function onClick() {
|
|
1709
|
+
return handleSearch(searchKey);
|
|
1710
|
+
} },
|
|
1711
|
+
btnText
|
|
1712
|
+
)
|
|
1713
|
+
);
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1593
1716
|
var NavDvm = function NavDvm(props) {
|
|
1594
1717
|
var logo = props.logo,
|
|
1595
1718
|
dataObject = props.dataObject,
|
|
1596
|
-
subNavHeads = props.subNavHeads
|
|
1719
|
+
subNavHeads = props.subNavHeads,
|
|
1720
|
+
onSearch = props.onSearch;
|
|
1597
1721
|
|
|
1598
1722
|
|
|
1599
1723
|
return React__default.createElement(
|
|
@@ -1608,8 +1732,12 @@ var NavDvm = function NavDvm(props) {
|
|
|
1608
1732
|
React__default.createElement(
|
|
1609
1733
|
'div',
|
|
1610
1734
|
{ className: 'd-flex' },
|
|
1611
|
-
React__default.createElement('img', { src: logo, className: 'h-100' }),
|
|
1612
|
-
React__default.createElement(
|
|
1735
|
+
React__default.createElement('img', { src: logo, className: 'h-100', style: { width: '120px' } }),
|
|
1736
|
+
React__default.createElement(
|
|
1737
|
+
'div',
|
|
1738
|
+
{ className: ' ml-4 d-flex align-items-center' },
|
|
1739
|
+
React__default.createElement(Search, { btnText: 'Search', handleSearch: onSearch })
|
|
1740
|
+
)
|
|
1613
1741
|
),
|
|
1614
1742
|
React__default.createElement(
|
|
1615
1743
|
'div',
|
|
@@ -1651,7 +1779,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
1651
1779
|
return React__default.createElement(
|
|
1652
1780
|
NavDropdown,
|
|
1653
1781
|
{ key: index, title: row.name, id: 'basic-nav-dropdown' },
|
|
1654
|
-
row.subQuery && row.subQuery.map(function (ddRow,
|
|
1782
|
+
row.subQuery && row.subQuery.map(function (ddRow, subIndex) {
|
|
1655
1783
|
if (ddRow.type === 'divider') {
|
|
1656
1784
|
return React__default.createElement(NavDropdown.Divider, { key: subIndex });
|
|
1657
1785
|
} else {
|
|
@@ -3425,10 +3553,11 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
3425
3553
|
keywords = props.keywords,
|
|
3426
3554
|
description = props.description,
|
|
3427
3555
|
website = props.website,
|
|
3428
|
-
horizontalAD = props.config.horizontalAD
|
|
3556
|
+
horizontalAD = props.config.horizontalAD,
|
|
3557
|
+
onSearch = props.onSearch;
|
|
3429
3558
|
|
|
3430
3559
|
|
|
3431
|
-
function navigation() {
|
|
3560
|
+
var navigation = function navigation() {
|
|
3432
3561
|
switch (config.navComponent) {
|
|
3433
3562
|
case 'normal':
|
|
3434
3563
|
return React__default.createElement(NavNormal, { logo: website.logo, dataObject: config.navItems });
|
|
@@ -3437,30 +3566,30 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
3437
3566
|
case 'native':
|
|
3438
3567
|
return React__default.createElement(NavNative, { logo: website.logo, dataObject: config.navItems });
|
|
3439
3568
|
case 'dvm':
|
|
3440
|
-
return React__default.createElement(NavDvm, { logo: website.logo, dataObject: config.navItems });
|
|
3569
|
+
return React__default.createElement(NavDvm, { logo: website.logo, dataObject: config.navItems, onSearch: onSearch });
|
|
3441
3570
|
default:
|
|
3442
3571
|
return React__default.createElement('noNav', null);
|
|
3443
3572
|
}
|
|
3444
|
-
}
|
|
3573
|
+
};
|
|
3445
3574
|
|
|
3446
3575
|
function layout() {
|
|
3447
3576
|
switch (config.columns) {
|
|
3448
3577
|
case '1':
|
|
3449
3578
|
return React__default.createElement(
|
|
3450
3579
|
Column1,
|
|
3451
|
-
|
|
3580
|
+
{ title: title },
|
|
3452
3581
|
props.children
|
|
3453
3582
|
);
|
|
3454
3583
|
case '2':
|
|
3455
3584
|
return React__default.createElement(
|
|
3456
3585
|
Column2,
|
|
3457
|
-
{ rightItems: config.rightItems },
|
|
3586
|
+
{ title: title, rightItems: config.rightItems },
|
|
3458
3587
|
props.children
|
|
3459
3588
|
);
|
|
3460
3589
|
case '3':
|
|
3461
3590
|
return React__default.createElement(
|
|
3462
3591
|
Column3,
|
|
3463
|
-
{ leftItems: config.leftItems, rightItems: config.rightItems },
|
|
3592
|
+
{ title: title, leftItems: config.leftItems, rightItems: config.rightItems },
|
|
3464
3593
|
props.children
|
|
3465
3594
|
);
|
|
3466
3595
|
default:
|
|
@@ -3473,7 +3602,7 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
3473
3602
|
null,
|
|
3474
3603
|
React__default.createElement(Header, { title: title, keyword: keywords, description: description }),
|
|
3475
3604
|
navigation(),
|
|
3476
|
-
React__default.createElement(
|
|
3605
|
+
horizontalAD && horizontalAD.networkID && horizontalAD.adUnit && React__default.createElement(
|
|
3477
3606
|
Container,
|
|
3478
3607
|
null,
|
|
3479
3608
|
React__default.createElement(AD728x90, { networkID: horizontalAD.networkID, adUnit: horizontalAD.adUnit })
|
|
@@ -3507,7 +3636,7 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
3507
3636
|
|
|
3508
3637
|
var FigureComponent = function FigureComponent(_ref) {
|
|
3509
3638
|
var caption = _ref.caption,
|
|
3510
|
-
|
|
3639
|
+
asset = _ref.asset;
|
|
3511
3640
|
|
|
3512
3641
|
return React__default.createElement(
|
|
3513
3642
|
'div',
|
|
@@ -3515,8 +3644,8 @@ var FigureComponent = function FigureComponent(_ref) {
|
|
|
3515
3644
|
React__default.createElement(
|
|
3516
3645
|
reactBootstrap.Figure,
|
|
3517
3646
|
null,
|
|
3518
|
-
React__default.createElement(reactBootstrap.Figure.Image, { alt:
|
|
3519
|
-
React__default.createElement(
|
|
3647
|
+
React__default.createElement(reactBootstrap.Figure.Image, { alt: asset ? asset.originalFilename : '', src: asset.url ? asset.url : '/placeholder.jpg' }),
|
|
3648
|
+
caption && React__default.createElement(
|
|
3520
3649
|
reactBootstrap.Figure.Caption,
|
|
3521
3650
|
null,
|
|
3522
3651
|
caption
|
|
@@ -3538,7 +3667,7 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
3538
3667
|
return React__default.createElement(
|
|
3539
3668
|
reactBootstrap.Carousel.Item,
|
|
3540
3669
|
{ key: slide._key },
|
|
3541
|
-
React__default.createElement('img', { style: { width: '100%' }, src: slide.url, alt: slide.asset.originalFilename })
|
|
3670
|
+
React__default.createElement('img', { style: { width: '100%' }, src: slide.asset.url ? slide.asset.url : '/placeholder.jpg', alt: slide.asset ? slide.asset.originalFilename : '' })
|
|
3542
3671
|
);
|
|
3543
3672
|
})
|
|
3544
3673
|
)
|
|
@@ -6217,547 +6346,6 @@ var YouTubePlayer$1 = function YouTubePlayer(_ref) {
|
|
|
6217
6346
|
return React__default.createElement(YouTube, { videoId: id, opts: { width: '100%' } });
|
|
6218
6347
|
};
|
|
6219
6348
|
|
|
6220
|
-
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
6221
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6222
|
-
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
6223
|
-
function parseAssetId(ref) {
|
|
6224
|
-
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
6225
|
-
if (!id || !dimensionString || !format) {
|
|
6226
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
6227
|
-
}
|
|
6228
|
-
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
6229
|
-
var width = +imgWidthStr;
|
|
6230
|
-
var height = +imgHeightStr;
|
|
6231
|
-
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
6232
|
-
if (!isValidAssetId) {
|
|
6233
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
6234
|
-
}
|
|
6235
|
-
return { id: id, width: width, height: height, format: format };
|
|
6236
|
-
}
|
|
6237
|
-
exports.default = parseAssetId;
|
|
6238
|
-
|
|
6239
|
-
});
|
|
6240
|
-
|
|
6241
|
-
unwrapExports(parseAssetId_1);
|
|
6242
|
-
|
|
6243
|
-
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
6244
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6245
|
-
__assign = Object.assign || function(t) {
|
|
6246
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6247
|
-
s = arguments[i];
|
|
6248
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6249
|
-
t[p] = s[p];
|
|
6250
|
-
}
|
|
6251
|
-
return t;
|
|
6252
|
-
};
|
|
6253
|
-
return __assign.apply(this, arguments);
|
|
6254
|
-
};
|
|
6255
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6256
|
-
var isRef = function (src) {
|
|
6257
|
-
var source = src;
|
|
6258
|
-
return source ? typeof source._ref === 'string' : false;
|
|
6259
|
-
};
|
|
6260
|
-
var isAsset = function (src) {
|
|
6261
|
-
var source = src;
|
|
6262
|
-
return source ? typeof source._id === 'string' : false;
|
|
6263
|
-
};
|
|
6264
|
-
var isAssetStub = function (src) {
|
|
6265
|
-
var source = src;
|
|
6266
|
-
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
6267
|
-
};
|
|
6268
|
-
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
6269
|
-
// eslint-disable-next-line complexity
|
|
6270
|
-
function parseSource(source) {
|
|
6271
|
-
if (!source) {
|
|
6272
|
-
return null;
|
|
6273
|
-
}
|
|
6274
|
-
var image;
|
|
6275
|
-
if (typeof source === 'string' && isUrl(source)) {
|
|
6276
|
-
// Someone passed an existing image url?
|
|
6277
|
-
image = {
|
|
6278
|
-
asset: { _ref: urlToId(source) }
|
|
6279
|
-
};
|
|
6280
|
-
}
|
|
6281
|
-
else if (typeof source === 'string') {
|
|
6282
|
-
// Just an asset id
|
|
6283
|
-
image = {
|
|
6284
|
-
asset: { _ref: source }
|
|
6285
|
-
};
|
|
6286
|
-
}
|
|
6287
|
-
else if (isRef(source)) {
|
|
6288
|
-
// We just got passed an asset directly
|
|
6289
|
-
image = {
|
|
6290
|
-
asset: source
|
|
6291
|
-
};
|
|
6292
|
-
}
|
|
6293
|
-
else if (isAsset(source)) {
|
|
6294
|
-
// If we were passed an image asset document
|
|
6295
|
-
image = {
|
|
6296
|
-
asset: {
|
|
6297
|
-
_ref: source._id || ''
|
|
6298
|
-
}
|
|
6299
|
-
};
|
|
6300
|
-
}
|
|
6301
|
-
else if (isAssetStub(source)) {
|
|
6302
|
-
// If we were passed a partial asset (`url`, but no `_id`)
|
|
6303
|
-
image = {
|
|
6304
|
-
asset: {
|
|
6305
|
-
_ref: urlToId(source.asset.url)
|
|
6306
|
-
}
|
|
6307
|
-
};
|
|
6308
|
-
}
|
|
6309
|
-
else if (typeof source.asset === 'object') {
|
|
6310
|
-
// Probably an actual image with materialized asset
|
|
6311
|
-
image = source;
|
|
6312
|
-
}
|
|
6313
|
-
else {
|
|
6314
|
-
// We got something that does not look like an image, or it is an image
|
|
6315
|
-
// that currently isn't sporting an asset.
|
|
6316
|
-
return null;
|
|
6317
|
-
}
|
|
6318
|
-
var img = source;
|
|
6319
|
-
if (img.crop) {
|
|
6320
|
-
image.crop = img.crop;
|
|
6321
|
-
}
|
|
6322
|
-
if (img.hotspot) {
|
|
6323
|
-
image.hotspot = img.hotspot;
|
|
6324
|
-
}
|
|
6325
|
-
return applyDefaults(image);
|
|
6326
|
-
}
|
|
6327
|
-
exports.default = parseSource;
|
|
6328
|
-
function isUrl(url) {
|
|
6329
|
-
return /^https?:\/\//.test("" + url);
|
|
6330
|
-
}
|
|
6331
|
-
function urlToId(url) {
|
|
6332
|
-
var parts = url.split('/').slice(-1);
|
|
6333
|
-
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
6334
|
-
}
|
|
6335
|
-
// Mock crop and hotspot if image lacks it
|
|
6336
|
-
function applyDefaults(image) {
|
|
6337
|
-
if (image.crop && image.hotspot) {
|
|
6338
|
-
return image;
|
|
6339
|
-
}
|
|
6340
|
-
// We need to pad in default values for crop or hotspot
|
|
6341
|
-
var result = __assign({}, image);
|
|
6342
|
-
if (!result.crop) {
|
|
6343
|
-
result.crop = {
|
|
6344
|
-
left: 0,
|
|
6345
|
-
top: 0,
|
|
6346
|
-
bottom: 0,
|
|
6347
|
-
right: 0
|
|
6348
|
-
};
|
|
6349
|
-
}
|
|
6350
|
-
if (!result.hotspot) {
|
|
6351
|
-
result.hotspot = {
|
|
6352
|
-
x: 0.5,
|
|
6353
|
-
y: 0.5,
|
|
6354
|
-
height: 1.0,
|
|
6355
|
-
width: 1.0
|
|
6356
|
-
};
|
|
6357
|
-
}
|
|
6358
|
-
return result;
|
|
6359
|
-
}
|
|
6360
|
-
|
|
6361
|
-
});
|
|
6362
|
-
|
|
6363
|
-
unwrapExports(parseSource_1);
|
|
6364
|
-
|
|
6365
|
-
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
6366
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6367
|
-
__assign = Object.assign || function(t) {
|
|
6368
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6369
|
-
s = arguments[i];
|
|
6370
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6371
|
-
t[p] = s[p];
|
|
6372
|
-
}
|
|
6373
|
-
return t;
|
|
6374
|
-
};
|
|
6375
|
-
return __assign.apply(this, arguments);
|
|
6376
|
-
};
|
|
6377
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6378
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6379
|
-
};
|
|
6380
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6381
|
-
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
6382
|
-
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
6383
|
-
exports.parseSource = parseSource_1$$1.default;
|
|
6384
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
6385
|
-
['width', 'w'],
|
|
6386
|
-
['height', 'h'],
|
|
6387
|
-
['format', 'fm'],
|
|
6388
|
-
['download', 'dl'],
|
|
6389
|
-
['blur', 'blur'],
|
|
6390
|
-
['sharpen', 'sharp'],
|
|
6391
|
-
['invert', 'invert'],
|
|
6392
|
-
['orientation', 'or'],
|
|
6393
|
-
['minHeight', 'min-h'],
|
|
6394
|
-
['maxHeight', 'max-h'],
|
|
6395
|
-
['minWidth', 'min-w'],
|
|
6396
|
-
['maxWidth', 'max-w'],
|
|
6397
|
-
['quality', 'q'],
|
|
6398
|
-
['fit', 'fit'],
|
|
6399
|
-
['crop', 'crop'],
|
|
6400
|
-
['auto', 'auto'],
|
|
6401
|
-
['dpr', 'dpr']
|
|
6402
|
-
];
|
|
6403
|
-
function urlForImage(options) {
|
|
6404
|
-
var spec = __assign({}, (options || {}));
|
|
6405
|
-
var source = spec.source;
|
|
6406
|
-
delete spec.source;
|
|
6407
|
-
var image = parseSource_1$$1.default(source);
|
|
6408
|
-
if (!image) {
|
|
6409
|
-
return null;
|
|
6410
|
-
}
|
|
6411
|
-
var id = image.asset._ref || image.asset._id || '';
|
|
6412
|
-
var asset = parseAssetId_1$$1.default(id);
|
|
6413
|
-
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
6414
|
-
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
6415
|
-
var cropTop = Math.round(image.crop.top * asset.height);
|
|
6416
|
-
var crop = {
|
|
6417
|
-
left: cropLeft,
|
|
6418
|
-
top: cropTop,
|
|
6419
|
-
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
6420
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
6421
|
-
};
|
|
6422
|
-
// Compute hot spot rect in terms of pixel coordinates
|
|
6423
|
-
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
6424
|
-
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
6425
|
-
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
6426
|
-
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
6427
|
-
var hotspot = {
|
|
6428
|
-
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
6429
|
-
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
6430
|
-
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
6431
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
6432
|
-
};
|
|
6433
|
-
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
6434
|
-
// the crop/hotspot.
|
|
6435
|
-
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
6436
|
-
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
6437
|
-
}
|
|
6438
|
-
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
6439
|
-
}
|
|
6440
|
-
exports.default = urlForImage;
|
|
6441
|
-
// eslint-disable-next-line complexity
|
|
6442
|
-
function specToImageUrl(spec) {
|
|
6443
|
-
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
6444
|
-
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
6445
|
-
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
6446
|
-
var params = [];
|
|
6447
|
-
if (spec.rect) {
|
|
6448
|
-
// Only bother url with a crop if it actually crops anything
|
|
6449
|
-
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
6450
|
-
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
6451
|
-
if (isEffectiveCrop) {
|
|
6452
|
-
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
6453
|
-
}
|
|
6454
|
-
}
|
|
6455
|
-
if (spec.bg) {
|
|
6456
|
-
params.push("bg=" + spec.bg);
|
|
6457
|
-
}
|
|
6458
|
-
if (spec.focalPoint) {
|
|
6459
|
-
params.push("fp-x=" + spec.focalPoint.x);
|
|
6460
|
-
params.push("fp-x=" + spec.focalPoint.y);
|
|
6461
|
-
}
|
|
6462
|
-
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
6463
|
-
if (flip) {
|
|
6464
|
-
params.push("flip=" + flip);
|
|
6465
|
-
}
|
|
6466
|
-
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
6467
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
6468
|
-
var specName = mapping[0], param = mapping[1];
|
|
6469
|
-
if (typeof spec[specName] !== 'undefined') {
|
|
6470
|
-
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
6471
|
-
}
|
|
6472
|
-
else if (typeof spec[param] !== 'undefined') {
|
|
6473
|
-
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
6474
|
-
}
|
|
6475
|
-
});
|
|
6476
|
-
if (params.length === 0) {
|
|
6477
|
-
return baseUrl;
|
|
6478
|
-
}
|
|
6479
|
-
return baseUrl + "?" + params.join('&');
|
|
6480
|
-
}
|
|
6481
|
-
function fit(source, spec) {
|
|
6482
|
-
var cropRect;
|
|
6483
|
-
var imgWidth = spec.width;
|
|
6484
|
-
var imgHeight = spec.height;
|
|
6485
|
-
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
6486
|
-
if (!(imgWidth && imgHeight)) {
|
|
6487
|
-
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
6488
|
-
}
|
|
6489
|
-
var crop = source.crop;
|
|
6490
|
-
var hotspot = source.hotspot;
|
|
6491
|
-
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
6492
|
-
var desiredAspectRatio = imgWidth / imgHeight;
|
|
6493
|
-
var cropAspectRatio = crop.width / crop.height;
|
|
6494
|
-
if (cropAspectRatio > desiredAspectRatio) {
|
|
6495
|
-
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
6496
|
-
var height = crop.height;
|
|
6497
|
-
var width = height * desiredAspectRatio;
|
|
6498
|
-
var top_2 = crop.top;
|
|
6499
|
-
// Center output horizontally over hotspot
|
|
6500
|
-
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
6501
|
-
var left = hotspotXCenter - width / 2;
|
|
6502
|
-
// Keep output within crop
|
|
6503
|
-
if (left < crop.left) {
|
|
6504
|
-
left = crop.left;
|
|
6505
|
-
}
|
|
6506
|
-
else if (left + width > crop.left + crop.width) {
|
|
6507
|
-
left = crop.left + crop.width - width;
|
|
6508
|
-
}
|
|
6509
|
-
cropRect = {
|
|
6510
|
-
left: Math.round(left),
|
|
6511
|
-
top: Math.round(top_2),
|
|
6512
|
-
width: Math.round(width),
|
|
6513
|
-
height: Math.round(height)
|
|
6514
|
-
};
|
|
6515
|
-
}
|
|
6516
|
-
else {
|
|
6517
|
-
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
6518
|
-
var width = crop.width;
|
|
6519
|
-
var height = width / desiredAspectRatio;
|
|
6520
|
-
var left = crop.left;
|
|
6521
|
-
// Center output vertically over hotspot
|
|
6522
|
-
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
6523
|
-
var top_3 = hotspotYCenter - height / 2;
|
|
6524
|
-
// Keep output rect within crop
|
|
6525
|
-
if (top_3 < crop.top) {
|
|
6526
|
-
top_3 = crop.top;
|
|
6527
|
-
}
|
|
6528
|
-
else if (top_3 + height > crop.top + crop.height) {
|
|
6529
|
-
top_3 = crop.top + crop.height - height;
|
|
6530
|
-
}
|
|
6531
|
-
cropRect = {
|
|
6532
|
-
left: Math.max(0, Math.floor(left)),
|
|
6533
|
-
top: Math.max(0, Math.floor(top_3)),
|
|
6534
|
-
width: Math.round(width),
|
|
6535
|
-
height: Math.round(height)
|
|
6536
|
-
};
|
|
6537
|
-
}
|
|
6538
|
-
return {
|
|
6539
|
-
width: imgWidth,
|
|
6540
|
-
height: imgHeight,
|
|
6541
|
-
rect: cropRect
|
|
6542
|
-
};
|
|
6543
|
-
}
|
|
6544
|
-
|
|
6545
|
-
});
|
|
6546
|
-
|
|
6547
|
-
unwrapExports(urlForImage_1);
|
|
6548
|
-
var urlForImage_2 = urlForImage_1.parseSource;
|
|
6549
|
-
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6550
|
-
|
|
6551
|
-
var builder = createCommonjsModule(function (module, exports) {
|
|
6552
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6553
|
-
__assign = Object.assign || function(t) {
|
|
6554
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6555
|
-
s = arguments[i];
|
|
6556
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6557
|
-
t[p] = s[p];
|
|
6558
|
-
}
|
|
6559
|
-
return t;
|
|
6560
|
-
};
|
|
6561
|
-
return __assign.apply(this, arguments);
|
|
6562
|
-
};
|
|
6563
|
-
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
6564
|
-
if (mod && mod.__esModule) return mod;
|
|
6565
|
-
var result = {};
|
|
6566
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6567
|
-
result["default"] = mod;
|
|
6568
|
-
return result;
|
|
6569
|
-
};
|
|
6570
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6571
|
-
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
6572
|
-
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
6573
|
-
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
6574
|
-
var validAutoModes = ['format'];
|
|
6575
|
-
function isSanityClient(client) {
|
|
6576
|
-
return client ? typeof client.clientConfig === 'object' : false;
|
|
6577
|
-
}
|
|
6578
|
-
function rewriteSpecName(key) {
|
|
6579
|
-
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6580
|
-
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
6581
|
-
var entry = specs_1[_i];
|
|
6582
|
-
var specName = entry[0], param = entry[1];
|
|
6583
|
-
if (key === specName || key === param) {
|
|
6584
|
-
return specName;
|
|
6585
|
-
}
|
|
6586
|
-
}
|
|
6587
|
-
return key;
|
|
6588
|
-
}
|
|
6589
|
-
function urlBuilder(options) {
|
|
6590
|
-
// Did we get a SanityClient?
|
|
6591
|
-
var client = options;
|
|
6592
|
-
if (isSanityClient(client)) {
|
|
6593
|
-
// Inherit config from client
|
|
6594
|
-
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
6595
|
-
return new ImageUrlBuilder(null, {
|
|
6596
|
-
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
6597
|
-
projectId: projectId,
|
|
6598
|
-
dataset: dataset
|
|
6599
|
-
});
|
|
6600
|
-
}
|
|
6601
|
-
// Or just accept the options as given
|
|
6602
|
-
return new ImageUrlBuilder(null, options);
|
|
6603
|
-
}
|
|
6604
|
-
exports.default = urlBuilder;
|
|
6605
|
-
var ImageUrlBuilder = /** @class */ (function () {
|
|
6606
|
-
function ImageUrlBuilder(parent, options) {
|
|
6607
|
-
this.options = parent
|
|
6608
|
-
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
6609
|
-
}
|
|
6610
|
-
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
6611
|
-
var baseUrl = options.baseUrl || '';
|
|
6612
|
-
var newOptions = { baseUrl: baseUrl };
|
|
6613
|
-
for (var key in options) {
|
|
6614
|
-
if (options.hasOwnProperty(key)) {
|
|
6615
|
-
var specKey = rewriteSpecName(key);
|
|
6616
|
-
newOptions[specKey] = options[key];
|
|
6617
|
-
}
|
|
6618
|
-
}
|
|
6619
|
-
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
6620
|
-
};
|
|
6621
|
-
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
6622
|
-
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
6623
|
-
// studio, the 'image'-document must be provided.
|
|
6624
|
-
ImageUrlBuilder.prototype.image = function (source) {
|
|
6625
|
-
return this.withOptions({ source: source });
|
|
6626
|
-
};
|
|
6627
|
-
// Specify the dataset
|
|
6628
|
-
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
6629
|
-
return this.withOptions({ dataset: dataset });
|
|
6630
|
-
};
|
|
6631
|
-
// Specify the projectId
|
|
6632
|
-
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
6633
|
-
return this.withOptions({ projectId: projectId });
|
|
6634
|
-
};
|
|
6635
|
-
// Specify background color
|
|
6636
|
-
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
6637
|
-
return this.withOptions({ bg: bg });
|
|
6638
|
-
};
|
|
6639
|
-
// Set DPR scaling factor
|
|
6640
|
-
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
6641
|
-
return this.withOptions({ dpr: dpr });
|
|
6642
|
-
};
|
|
6643
|
-
// Specify the width of the image in pixels
|
|
6644
|
-
ImageUrlBuilder.prototype.width = function (width) {
|
|
6645
|
-
return this.withOptions({ width: width });
|
|
6646
|
-
};
|
|
6647
|
-
// Specify the height of the image in pixels
|
|
6648
|
-
ImageUrlBuilder.prototype.height = function (height) {
|
|
6649
|
-
return this.withOptions({ height: height });
|
|
6650
|
-
};
|
|
6651
|
-
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
6652
|
-
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
6653
|
-
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
6654
|
-
};
|
|
6655
|
-
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
6656
|
-
return this.withOptions({ maxWidth: maxWidth });
|
|
6657
|
-
};
|
|
6658
|
-
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
6659
|
-
return this.withOptions({ minWidth: minWidth });
|
|
6660
|
-
};
|
|
6661
|
-
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
6662
|
-
return this.withOptions({ maxHeight: maxHeight });
|
|
6663
|
-
};
|
|
6664
|
-
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
6665
|
-
return this.withOptions({ minHeight: minHeight });
|
|
6666
|
-
};
|
|
6667
|
-
// Specify width and height in pixels
|
|
6668
|
-
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
6669
|
-
return this.withOptions({ width: width, height: height });
|
|
6670
|
-
};
|
|
6671
|
-
// Specify blur between 0 and 100
|
|
6672
|
-
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
6673
|
-
return this.withOptions({ blur: blur });
|
|
6674
|
-
};
|
|
6675
|
-
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
6676
|
-
return this.withOptions({ sharpen: sharpen });
|
|
6677
|
-
};
|
|
6678
|
-
// Specify the desired rectangle of the image
|
|
6679
|
-
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
6680
|
-
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
6681
|
-
};
|
|
6682
|
-
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
6683
|
-
ImageUrlBuilder.prototype.format = function (format) {
|
|
6684
|
-
return this.withOptions({ format: format });
|
|
6685
|
-
};
|
|
6686
|
-
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
6687
|
-
return this.withOptions({ invert: invert });
|
|
6688
|
-
};
|
|
6689
|
-
// Rotation in degrees 0, 90, 180, 270
|
|
6690
|
-
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
6691
|
-
return this.withOptions({ orientation: orientation });
|
|
6692
|
-
};
|
|
6693
|
-
// Compression quality 0-100
|
|
6694
|
-
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
6695
|
-
return this.withOptions({ quality: quality });
|
|
6696
|
-
};
|
|
6697
|
-
// Make it a download link. Parameter is default filename.
|
|
6698
|
-
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
6699
|
-
return this.withOptions({ download: download });
|
|
6700
|
-
};
|
|
6701
|
-
// Flip image horizontally
|
|
6702
|
-
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
6703
|
-
return this.withOptions({ flipHorizontal: true });
|
|
6704
|
-
};
|
|
6705
|
-
// Flip image verically
|
|
6706
|
-
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
6707
|
-
return this.withOptions({ flipVertical: true });
|
|
6708
|
-
};
|
|
6709
|
-
// Ignore crop/hotspot from image record, even when present
|
|
6710
|
-
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
6711
|
-
return this.withOptions({ ignoreImageParams: true });
|
|
6712
|
-
};
|
|
6713
|
-
ImageUrlBuilder.prototype.fit = function (value) {
|
|
6714
|
-
if (validFits.indexOf(value) === -1) {
|
|
6715
|
-
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
6716
|
-
}
|
|
6717
|
-
return this.withOptions({ fit: value });
|
|
6718
|
-
};
|
|
6719
|
-
ImageUrlBuilder.prototype.crop = function (value) {
|
|
6720
|
-
if (validCrops.indexOf(value) === -1) {
|
|
6721
|
-
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
6722
|
-
}
|
|
6723
|
-
return this.withOptions({ crop: value });
|
|
6724
|
-
};
|
|
6725
|
-
ImageUrlBuilder.prototype.auto = function (value) {
|
|
6726
|
-
if (validAutoModes.indexOf(value) === -1) {
|
|
6727
|
-
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
6728
|
-
}
|
|
6729
|
-
return this.withOptions({ auto: value });
|
|
6730
|
-
};
|
|
6731
|
-
// Gets the url based on the submitted parameters
|
|
6732
|
-
ImageUrlBuilder.prototype.url = function () {
|
|
6733
|
-
return urlForImage_1$$1.default(this.options);
|
|
6734
|
-
};
|
|
6735
|
-
// Synonym for url()
|
|
6736
|
-
ImageUrlBuilder.prototype.toString = function () {
|
|
6737
|
-
return this.url();
|
|
6738
|
-
};
|
|
6739
|
-
return ImageUrlBuilder;
|
|
6740
|
-
}());
|
|
6741
|
-
|
|
6742
|
-
});
|
|
6743
|
-
|
|
6744
|
-
unwrapExports(builder);
|
|
6745
|
-
|
|
6746
|
-
var node$1 = createCommonjsModule(function (module) {
|
|
6747
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6748
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6749
|
-
};
|
|
6750
|
-
var builder_1 = __importDefault(builder);
|
|
6751
|
-
module.exports = builder_1.default;
|
|
6752
|
-
|
|
6753
|
-
});
|
|
6754
|
-
|
|
6755
|
-
var imageUrlBuilder = unwrapExports(node$1);
|
|
6756
|
-
|
|
6757
|
-
var urlFor = function urlFor(source, client) {
|
|
6758
|
-
return imageUrlBuilder(client).image(source);
|
|
6759
|
-
};
|
|
6760
|
-
|
|
6761
6349
|
var getSerializers = function getSerializers(client) {
|
|
6762
6350
|
return {
|
|
6763
6351
|
types: {
|
|
@@ -6772,23 +6360,60 @@ var getSerializers = function getSerializers(client) {
|
|
|
6772
6360
|
var asset = node.asset,
|
|
6773
6361
|
caption = node.caption;
|
|
6774
6362
|
|
|
6775
|
-
|
|
6776
|
-
return React__default.createElement(FigureComponent, { caption: caption, url: url });
|
|
6363
|
+
return React__default.createElement(FigureComponent, { caption: caption, asset: asset });
|
|
6777
6364
|
},
|
|
6778
6365
|
slideshow: function slideshow(_ref3) {
|
|
6779
6366
|
var node = _ref3.node;
|
|
6367
|
+
var slides = node.slides;
|
|
6780
6368
|
|
|
6781
|
-
var slides = node.slides && node.slides.map(function (slide) {
|
|
6782
|
-
return Object.assign(slide, { url: urlFor(slide.asset, client).url() });
|
|
6783
|
-
});
|
|
6784
6369
|
return React__default.createElement(Slideshow, { slides: slides });
|
|
6785
6370
|
}
|
|
6786
6371
|
}
|
|
6787
6372
|
};
|
|
6788
6373
|
};
|
|
6789
6374
|
|
|
6375
|
+
var searchResult = function searchResult(_ref) {
|
|
6376
|
+
var searchResults = _ref.searchResults,
|
|
6377
|
+
searchTerm = _ref.searchTerm;
|
|
6378
|
+
|
|
6379
|
+
return React__default.createElement(
|
|
6380
|
+
React__default.Fragment,
|
|
6381
|
+
null,
|
|
6382
|
+
React__default.createElement(
|
|
6383
|
+
'p',
|
|
6384
|
+
null,
|
|
6385
|
+
' Results for "',
|
|
6386
|
+
searchTerm,
|
|
6387
|
+
'" '
|
|
6388
|
+
),
|
|
6389
|
+
searchResults && searchResults.length > 0 ? searchResults.map(function (item, index) {
|
|
6390
|
+
return React__default.createElement(
|
|
6391
|
+
'div',
|
|
6392
|
+
{ key: index, className: 'search-result-container' },
|
|
6393
|
+
React__default.createElement(
|
|
6394
|
+
'h5',
|
|
6395
|
+
null,
|
|
6396
|
+
item.title
|
|
6397
|
+
),
|
|
6398
|
+
React__default.createElement(
|
|
6399
|
+
'p',
|
|
6400
|
+
null,
|
|
6401
|
+
item.summary,
|
|
6402
|
+
' '
|
|
6403
|
+
)
|
|
6404
|
+
);
|
|
6405
|
+
}) : React__default.createElement(
|
|
6406
|
+
'div',
|
|
6407
|
+
null,
|
|
6408
|
+
'No results found'
|
|
6409
|
+
)
|
|
6410
|
+
);
|
|
6411
|
+
};
|
|
6412
|
+
|
|
6790
6413
|
exports.DeckContent = DeckContent;
|
|
6791
6414
|
exports.DeckQueue = DeckQueue;
|
|
6415
|
+
exports.ThumbnailCard = ThumbnailCard;
|
|
6416
|
+
exports.TaxonomyCard = TaxonomyCard;
|
|
6792
6417
|
exports.Column1 = Column1;
|
|
6793
6418
|
exports.Column2 = Column2;
|
|
6794
6419
|
exports.Column3 = Column3;
|
|
@@ -6804,4 +6429,6 @@ exports.AD300x250 = AD300x250;
|
|
|
6804
6429
|
exports.AD300x250x600 = AD300x250x600;
|
|
6805
6430
|
exports.AD728x90 = AD728x90;
|
|
6806
6431
|
exports.getSerializers = getSerializers;
|
|
6432
|
+
exports.SearchResult = searchResult;
|
|
6433
|
+
exports.Search = Search;
|
|
6807
6434
|
//# sourceMappingURL=index.js.map
|