@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.es.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React__default, { Component, useState,
|
|
1
|
+
import React__default, { Component, useState, createContext, createElement } from 'react';
|
|
2
2
|
import Row from 'react-bootstrap/Row';
|
|
3
3
|
import Col from 'react-bootstrap/Col';
|
|
4
4
|
import Card from 'react-bootstrap/Card';
|
|
5
5
|
import Link from 'next/link';
|
|
6
|
+
import Media from 'react-bootstrap/Media';
|
|
6
7
|
import ListGroup from 'react-bootstrap/ListGroup';
|
|
7
8
|
import Head from 'next/head';
|
|
8
9
|
import Accordion from 'react-bootstrap/Accordion';
|
|
@@ -614,7 +615,6 @@ var DeckContent = function (_React$Component) {
|
|
|
614
615
|
|
|
615
616
|
var itemCounter = 0;
|
|
616
617
|
var lgVar = 12;
|
|
617
|
-
|
|
618
618
|
return React__default.createElement(
|
|
619
619
|
Row,
|
|
620
620
|
null,
|
|
@@ -639,7 +639,11 @@ var DeckContent = function (_React$Component) {
|
|
|
639
639
|
React__default.createElement(
|
|
640
640
|
'a',
|
|
641
641
|
null,
|
|
642
|
-
React__default.createElement(Card.Img, {
|
|
642
|
+
React__default.createElement(Card.Img, {
|
|
643
|
+
variant: 'top',
|
|
644
|
+
src: row.thumbnail.asset ? row.thumbnail.asset.url : _this.defaultImage,
|
|
645
|
+
alt: row.thumbnail.asset ? row.thumbnail.asset.originalFilename : ''
|
|
646
|
+
})
|
|
643
647
|
)
|
|
644
648
|
),
|
|
645
649
|
React__default.createElement(
|
|
@@ -933,6 +937,93 @@ var DeckQueue = function (_React$Component) {
|
|
|
933
937
|
return DeckQueue;
|
|
934
938
|
}(React__default.Component);
|
|
935
939
|
|
|
940
|
+
var ThumbnailCard = function ThumbnailCard(_ref) {
|
|
941
|
+
var size = _ref.size,
|
|
942
|
+
mediaData = _ref.mediaData;
|
|
943
|
+
|
|
944
|
+
return React__default.createElement(
|
|
945
|
+
'div',
|
|
946
|
+
null,
|
|
947
|
+
mediaData && mediaData.map(function (item, index) {
|
|
948
|
+
return React__default.createElement(
|
|
949
|
+
Media,
|
|
950
|
+
{ className: 'mb-3' },
|
|
951
|
+
React__default.createElement('img', { width: size, height: size, className: 'mr-3', src: item.thumbnail.asset.url, alt: 'Generic placeholder' }),
|
|
952
|
+
React__default.createElement(
|
|
953
|
+
Media.Body,
|
|
954
|
+
null,
|
|
955
|
+
React__default.createElement(
|
|
956
|
+
'h5',
|
|
957
|
+
null,
|
|
958
|
+
item.title
|
|
959
|
+
),
|
|
960
|
+
React__default.createElement(
|
|
961
|
+
'p',
|
|
962
|
+
null,
|
|
963
|
+
item.summary
|
|
964
|
+
)
|
|
965
|
+
)
|
|
966
|
+
);
|
|
967
|
+
})
|
|
968
|
+
);
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
var TaxonomyCard = function TaxonomyCard(props) {
|
|
972
|
+
var columns = props.columns,
|
|
973
|
+
variant = props.variant,
|
|
974
|
+
data = props.dataRecord;
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
|
|
978
|
+
|
|
979
|
+
var itemCounter = 0;
|
|
980
|
+
var lgVar = 12;
|
|
981
|
+
|
|
982
|
+
return React__default.createElement(
|
|
983
|
+
'div',
|
|
984
|
+
{ className: 'contentDeck' },
|
|
985
|
+
React__default.createElement(
|
|
986
|
+
Row,
|
|
987
|
+
null,
|
|
988
|
+
data && data.map(function (row, index) {
|
|
989
|
+
if (columns === 'rotate' && itemCounter % 3 === 0) {
|
|
990
|
+
lgVar = 12;
|
|
991
|
+
} else if (columns && columns !== 'rotate') {
|
|
992
|
+
lgVar = Math.floor(12 / columns);
|
|
993
|
+
} else {
|
|
994
|
+
lgVar = 6;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
return React__default.createElement(
|
|
998
|
+
Col,
|
|
999
|
+
{ key: itemCounter, md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
|
|
1000
|
+
React__default.createElement(
|
|
1001
|
+
Card,
|
|
1002
|
+
{ style: { flexDirection: mode } },
|
|
1003
|
+
React__default.createElement(
|
|
1004
|
+
Card.Body,
|
|
1005
|
+
null,
|
|
1006
|
+
React__default.createElement(
|
|
1007
|
+
Link,
|
|
1008
|
+
{ href: row.url, as: row.url },
|
|
1009
|
+
React__default.createElement(
|
|
1010
|
+
'a',
|
|
1011
|
+
null,
|
|
1012
|
+
React__default.createElement(
|
|
1013
|
+
Card.Title,
|
|
1014
|
+
null,
|
|
1015
|
+
row.name
|
|
1016
|
+
)
|
|
1017
|
+
)
|
|
1018
|
+
)
|
|
1019
|
+
)
|
|
1020
|
+
)
|
|
1021
|
+
);
|
|
1022
|
+
})
|
|
1023
|
+
)
|
|
1024
|
+
);
|
|
1025
|
+
};
|
|
1026
|
+
|
|
936
1027
|
var Column1 = function Column1(props) {
|
|
937
1028
|
return React__default.createElement(
|
|
938
1029
|
'section',
|
|
@@ -942,8 +1033,8 @@ var Column1 = function Column1(props) {
|
|
|
942
1033
|
{ className: 'justify-content-md-center' },
|
|
943
1034
|
React__default.createElement(
|
|
944
1035
|
Col,
|
|
945
|
-
{ className: 'middleCol' },
|
|
946
|
-
React__default.createElement(
|
|
1036
|
+
{ className: 'middleCol', style: { marginTop: !props.title && '10px' } },
|
|
1037
|
+
props.title && React__default.createElement(
|
|
947
1038
|
'h1',
|
|
948
1039
|
null,
|
|
949
1040
|
props.title
|
|
@@ -966,8 +1057,8 @@ var Column2 = function Column2(props) {
|
|
|
966
1057
|
{ className: 'justify-content-md-center' },
|
|
967
1058
|
React__default.createElement(
|
|
968
1059
|
Col,
|
|
969
|
-
{ md: true, className: 'middleCol' },
|
|
970
|
-
React__default.createElement(
|
|
1060
|
+
{ md: true, className: 'middleCol', style: { marginTop: !props.title && '10px' } },
|
|
1061
|
+
props.title && React__default.createElement(
|
|
971
1062
|
'h1',
|
|
972
1063
|
null,
|
|
973
1064
|
props.title
|
|
@@ -1067,8 +1158,8 @@ var Column3 = function Column3(props) {
|
|
|
1067
1158
|
),
|
|
1068
1159
|
React__default.createElement(
|
|
1069
1160
|
Col,
|
|
1070
|
-
{ md: true, className: 'middleCol', style: { maxWidth: '640px' } },
|
|
1071
|
-
React__default.createElement(
|
|
1161
|
+
{ md: true, className: 'middleCol', style: { maxWidth: '640px', marginTop: !props.title && '10px' } },
|
|
1162
|
+
props.title && React__default.createElement(
|
|
1072
1163
|
'h1',
|
|
1073
1164
|
null,
|
|
1074
1165
|
props.title
|
|
@@ -1583,10 +1674,43 @@ var NavNormal = function NavNormal(props) {
|
|
|
1583
1674
|
);
|
|
1584
1675
|
};
|
|
1585
1676
|
|
|
1677
|
+
var Search = function Search(_ref) {
|
|
1678
|
+
var placeholder = _ref.placeholder,
|
|
1679
|
+
disabled = _ref.disabled,
|
|
1680
|
+
type = _ref.type,
|
|
1681
|
+
btnText = _ref.btnText,
|
|
1682
|
+
handleSearch = _ref.handleSearch;
|
|
1683
|
+
|
|
1684
|
+
var _useState = useState(''),
|
|
1685
|
+
_useState2 = slicedToArray(_useState, 2),
|
|
1686
|
+
searchKey = _useState2[0],
|
|
1687
|
+
setSearchKey = _useState2[1];
|
|
1688
|
+
|
|
1689
|
+
var onChangeSearch = function onChangeSearch(e) {
|
|
1690
|
+
setSearchKey(e.target.value);
|
|
1691
|
+
};
|
|
1692
|
+
|
|
1693
|
+
return React__default.createElement(
|
|
1694
|
+
'div',
|
|
1695
|
+
{ className: 'd-flex' },
|
|
1696
|
+
React__default.createElement('input', { className: 'form-control', placeholder: placeholder, disabled: disabled, type: type, value: searchKey, onChange: function onChange(e) {
|
|
1697
|
+
return onChangeSearch(e);
|
|
1698
|
+
} }),
|
|
1699
|
+
React__default.createElement(
|
|
1700
|
+
'button',
|
|
1701
|
+
{ className: 'test', onClick: function onClick() {
|
|
1702
|
+
return handleSearch(searchKey);
|
|
1703
|
+
} },
|
|
1704
|
+
btnText
|
|
1705
|
+
)
|
|
1706
|
+
);
|
|
1707
|
+
};
|
|
1708
|
+
|
|
1586
1709
|
var NavDvm = function NavDvm(props) {
|
|
1587
1710
|
var logo = props.logo,
|
|
1588
1711
|
dataObject = props.dataObject,
|
|
1589
|
-
subNavHeads = props.subNavHeads
|
|
1712
|
+
subNavHeads = props.subNavHeads,
|
|
1713
|
+
onSearch = props.onSearch;
|
|
1590
1714
|
|
|
1591
1715
|
|
|
1592
1716
|
return React__default.createElement(
|
|
@@ -1601,8 +1725,12 @@ var NavDvm = function NavDvm(props) {
|
|
|
1601
1725
|
React__default.createElement(
|
|
1602
1726
|
'div',
|
|
1603
1727
|
{ className: 'd-flex' },
|
|
1604
|
-
React__default.createElement('img', { src: logo, className: 'h-100' }),
|
|
1605
|
-
React__default.createElement(
|
|
1728
|
+
React__default.createElement('img', { src: logo, className: 'h-100', style: { width: '120px' } }),
|
|
1729
|
+
React__default.createElement(
|
|
1730
|
+
'div',
|
|
1731
|
+
{ className: ' ml-4 d-flex align-items-center' },
|
|
1732
|
+
React__default.createElement(Search, { btnText: 'Search', handleSearch: onSearch })
|
|
1733
|
+
)
|
|
1606
1734
|
),
|
|
1607
1735
|
React__default.createElement(
|
|
1608
1736
|
'div',
|
|
@@ -1644,7 +1772,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
1644
1772
|
return React__default.createElement(
|
|
1645
1773
|
NavDropdown,
|
|
1646
1774
|
{ key: index, title: row.name, id: 'basic-nav-dropdown' },
|
|
1647
|
-
row.subQuery && row.subQuery.map(function (ddRow,
|
|
1775
|
+
row.subQuery && row.subQuery.map(function (ddRow, subIndex) {
|
|
1648
1776
|
if (ddRow.type === 'divider') {
|
|
1649
1777
|
return React__default.createElement(NavDropdown.Divider, { key: subIndex });
|
|
1650
1778
|
} else {
|
|
@@ -3418,10 +3546,11 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
3418
3546
|
keywords = props.keywords,
|
|
3419
3547
|
description = props.description,
|
|
3420
3548
|
website = props.website,
|
|
3421
|
-
horizontalAD = props.config.horizontalAD
|
|
3549
|
+
horizontalAD = props.config.horizontalAD,
|
|
3550
|
+
onSearch = props.onSearch;
|
|
3422
3551
|
|
|
3423
3552
|
|
|
3424
|
-
function navigation() {
|
|
3553
|
+
var navigation = function navigation() {
|
|
3425
3554
|
switch (config.navComponent) {
|
|
3426
3555
|
case 'normal':
|
|
3427
3556
|
return React__default.createElement(NavNormal, { logo: website.logo, dataObject: config.navItems });
|
|
@@ -3430,30 +3559,30 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
3430
3559
|
case 'native':
|
|
3431
3560
|
return React__default.createElement(NavNative, { logo: website.logo, dataObject: config.navItems });
|
|
3432
3561
|
case 'dvm':
|
|
3433
|
-
return React__default.createElement(NavDvm, { logo: website.logo, dataObject: config.navItems });
|
|
3562
|
+
return React__default.createElement(NavDvm, { logo: website.logo, dataObject: config.navItems, onSearch: onSearch });
|
|
3434
3563
|
default:
|
|
3435
3564
|
return React__default.createElement('noNav', null);
|
|
3436
3565
|
}
|
|
3437
|
-
}
|
|
3566
|
+
};
|
|
3438
3567
|
|
|
3439
3568
|
function layout() {
|
|
3440
3569
|
switch (config.columns) {
|
|
3441
3570
|
case '1':
|
|
3442
3571
|
return React__default.createElement(
|
|
3443
3572
|
Column1,
|
|
3444
|
-
|
|
3573
|
+
{ title: title },
|
|
3445
3574
|
props.children
|
|
3446
3575
|
);
|
|
3447
3576
|
case '2':
|
|
3448
3577
|
return React__default.createElement(
|
|
3449
3578
|
Column2,
|
|
3450
|
-
{ rightItems: config.rightItems },
|
|
3579
|
+
{ title: title, rightItems: config.rightItems },
|
|
3451
3580
|
props.children
|
|
3452
3581
|
);
|
|
3453
3582
|
case '3':
|
|
3454
3583
|
return React__default.createElement(
|
|
3455
3584
|
Column3,
|
|
3456
|
-
{ leftItems: config.leftItems, rightItems: config.rightItems },
|
|
3585
|
+
{ title: title, leftItems: config.leftItems, rightItems: config.rightItems },
|
|
3457
3586
|
props.children
|
|
3458
3587
|
);
|
|
3459
3588
|
default:
|
|
@@ -3466,7 +3595,7 @@ var TemplateNormal = function TemplateNormal(props) {
|
|
|
3466
3595
|
null,
|
|
3467
3596
|
React__default.createElement(Header, { title: title, keyword: keywords, description: description }),
|
|
3468
3597
|
navigation(),
|
|
3469
|
-
React__default.createElement(
|
|
3598
|
+
horizontalAD && horizontalAD.networkID && horizontalAD.adUnit && React__default.createElement(
|
|
3470
3599
|
Container,
|
|
3471
3600
|
null,
|
|
3472
3601
|
React__default.createElement(AD728x90, { networkID: horizontalAD.networkID, adUnit: horizontalAD.adUnit })
|
|
@@ -3500,7 +3629,7 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
3500
3629
|
|
|
3501
3630
|
var FigureComponent = function FigureComponent(_ref) {
|
|
3502
3631
|
var caption = _ref.caption,
|
|
3503
|
-
|
|
3632
|
+
asset = _ref.asset;
|
|
3504
3633
|
|
|
3505
3634
|
return React__default.createElement(
|
|
3506
3635
|
'div',
|
|
@@ -3508,8 +3637,8 @@ var FigureComponent = function FigureComponent(_ref) {
|
|
|
3508
3637
|
React__default.createElement(
|
|
3509
3638
|
Figure,
|
|
3510
3639
|
null,
|
|
3511
|
-
React__default.createElement(Figure.Image, { alt:
|
|
3512
|
-
React__default.createElement(
|
|
3640
|
+
React__default.createElement(Figure.Image, { alt: asset ? asset.originalFilename : '', src: asset.url ? asset.url : '/placeholder.jpg' }),
|
|
3641
|
+
caption && React__default.createElement(
|
|
3513
3642
|
Figure.Caption,
|
|
3514
3643
|
null,
|
|
3515
3644
|
caption
|
|
@@ -3531,7 +3660,7 @@ var Slideshow = function Slideshow(_ref) {
|
|
|
3531
3660
|
return React__default.createElement(
|
|
3532
3661
|
Carousel.Item,
|
|
3533
3662
|
{ key: slide._key },
|
|
3534
|
-
React__default.createElement('img', { style: { width: '100%' }, src: slide.url, alt: slide.asset.originalFilename })
|
|
3663
|
+
React__default.createElement('img', { style: { width: '100%' }, src: slide.asset.url ? slide.asset.url : '/placeholder.jpg', alt: slide.asset ? slide.asset.originalFilename : '' })
|
|
3535
3664
|
);
|
|
3536
3665
|
})
|
|
3537
3666
|
)
|
|
@@ -6210,547 +6339,6 @@ var YouTubePlayer$1 = function YouTubePlayer(_ref) {
|
|
|
6210
6339
|
return React__default.createElement(YouTube, { videoId: id, opts: { width: '100%' } });
|
|
6211
6340
|
};
|
|
6212
6341
|
|
|
6213
|
-
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
6214
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6215
|
-
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
6216
|
-
function parseAssetId(ref) {
|
|
6217
|
-
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
6218
|
-
if (!id || !dimensionString || !format) {
|
|
6219
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
6220
|
-
}
|
|
6221
|
-
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
6222
|
-
var width = +imgWidthStr;
|
|
6223
|
-
var height = +imgHeightStr;
|
|
6224
|
-
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
6225
|
-
if (!isValidAssetId) {
|
|
6226
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
6227
|
-
}
|
|
6228
|
-
return { id: id, width: width, height: height, format: format };
|
|
6229
|
-
}
|
|
6230
|
-
exports.default = parseAssetId;
|
|
6231
|
-
|
|
6232
|
-
});
|
|
6233
|
-
|
|
6234
|
-
unwrapExports(parseAssetId_1);
|
|
6235
|
-
|
|
6236
|
-
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
6237
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6238
|
-
__assign = Object.assign || function(t) {
|
|
6239
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6240
|
-
s = arguments[i];
|
|
6241
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6242
|
-
t[p] = s[p];
|
|
6243
|
-
}
|
|
6244
|
-
return t;
|
|
6245
|
-
};
|
|
6246
|
-
return __assign.apply(this, arguments);
|
|
6247
|
-
};
|
|
6248
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6249
|
-
var isRef = function (src) {
|
|
6250
|
-
var source = src;
|
|
6251
|
-
return source ? typeof source._ref === 'string' : false;
|
|
6252
|
-
};
|
|
6253
|
-
var isAsset = function (src) {
|
|
6254
|
-
var source = src;
|
|
6255
|
-
return source ? typeof source._id === 'string' : false;
|
|
6256
|
-
};
|
|
6257
|
-
var isAssetStub = function (src) {
|
|
6258
|
-
var source = src;
|
|
6259
|
-
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
6260
|
-
};
|
|
6261
|
-
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
6262
|
-
// eslint-disable-next-line complexity
|
|
6263
|
-
function parseSource(source) {
|
|
6264
|
-
if (!source) {
|
|
6265
|
-
return null;
|
|
6266
|
-
}
|
|
6267
|
-
var image;
|
|
6268
|
-
if (typeof source === 'string' && isUrl(source)) {
|
|
6269
|
-
// Someone passed an existing image url?
|
|
6270
|
-
image = {
|
|
6271
|
-
asset: { _ref: urlToId(source) }
|
|
6272
|
-
};
|
|
6273
|
-
}
|
|
6274
|
-
else if (typeof source === 'string') {
|
|
6275
|
-
// Just an asset id
|
|
6276
|
-
image = {
|
|
6277
|
-
asset: { _ref: source }
|
|
6278
|
-
};
|
|
6279
|
-
}
|
|
6280
|
-
else if (isRef(source)) {
|
|
6281
|
-
// We just got passed an asset directly
|
|
6282
|
-
image = {
|
|
6283
|
-
asset: source
|
|
6284
|
-
};
|
|
6285
|
-
}
|
|
6286
|
-
else if (isAsset(source)) {
|
|
6287
|
-
// If we were passed an image asset document
|
|
6288
|
-
image = {
|
|
6289
|
-
asset: {
|
|
6290
|
-
_ref: source._id || ''
|
|
6291
|
-
}
|
|
6292
|
-
};
|
|
6293
|
-
}
|
|
6294
|
-
else if (isAssetStub(source)) {
|
|
6295
|
-
// If we were passed a partial asset (`url`, but no `_id`)
|
|
6296
|
-
image = {
|
|
6297
|
-
asset: {
|
|
6298
|
-
_ref: urlToId(source.asset.url)
|
|
6299
|
-
}
|
|
6300
|
-
};
|
|
6301
|
-
}
|
|
6302
|
-
else if (typeof source.asset === 'object') {
|
|
6303
|
-
// Probably an actual image with materialized asset
|
|
6304
|
-
image = source;
|
|
6305
|
-
}
|
|
6306
|
-
else {
|
|
6307
|
-
// We got something that does not look like an image, or it is an image
|
|
6308
|
-
// that currently isn't sporting an asset.
|
|
6309
|
-
return null;
|
|
6310
|
-
}
|
|
6311
|
-
var img = source;
|
|
6312
|
-
if (img.crop) {
|
|
6313
|
-
image.crop = img.crop;
|
|
6314
|
-
}
|
|
6315
|
-
if (img.hotspot) {
|
|
6316
|
-
image.hotspot = img.hotspot;
|
|
6317
|
-
}
|
|
6318
|
-
return applyDefaults(image);
|
|
6319
|
-
}
|
|
6320
|
-
exports.default = parseSource;
|
|
6321
|
-
function isUrl(url) {
|
|
6322
|
-
return /^https?:\/\//.test("" + url);
|
|
6323
|
-
}
|
|
6324
|
-
function urlToId(url) {
|
|
6325
|
-
var parts = url.split('/').slice(-1);
|
|
6326
|
-
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
6327
|
-
}
|
|
6328
|
-
// Mock crop and hotspot if image lacks it
|
|
6329
|
-
function applyDefaults(image) {
|
|
6330
|
-
if (image.crop && image.hotspot) {
|
|
6331
|
-
return image;
|
|
6332
|
-
}
|
|
6333
|
-
// We need to pad in default values for crop or hotspot
|
|
6334
|
-
var result = __assign({}, image);
|
|
6335
|
-
if (!result.crop) {
|
|
6336
|
-
result.crop = {
|
|
6337
|
-
left: 0,
|
|
6338
|
-
top: 0,
|
|
6339
|
-
bottom: 0,
|
|
6340
|
-
right: 0
|
|
6341
|
-
};
|
|
6342
|
-
}
|
|
6343
|
-
if (!result.hotspot) {
|
|
6344
|
-
result.hotspot = {
|
|
6345
|
-
x: 0.5,
|
|
6346
|
-
y: 0.5,
|
|
6347
|
-
height: 1.0,
|
|
6348
|
-
width: 1.0
|
|
6349
|
-
};
|
|
6350
|
-
}
|
|
6351
|
-
return result;
|
|
6352
|
-
}
|
|
6353
|
-
|
|
6354
|
-
});
|
|
6355
|
-
|
|
6356
|
-
unwrapExports(parseSource_1);
|
|
6357
|
-
|
|
6358
|
-
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
6359
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6360
|
-
__assign = Object.assign || function(t) {
|
|
6361
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6362
|
-
s = arguments[i];
|
|
6363
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6364
|
-
t[p] = s[p];
|
|
6365
|
-
}
|
|
6366
|
-
return t;
|
|
6367
|
-
};
|
|
6368
|
-
return __assign.apply(this, arguments);
|
|
6369
|
-
};
|
|
6370
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6371
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6372
|
-
};
|
|
6373
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6374
|
-
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
6375
|
-
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
6376
|
-
exports.parseSource = parseSource_1$$1.default;
|
|
6377
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
6378
|
-
['width', 'w'],
|
|
6379
|
-
['height', 'h'],
|
|
6380
|
-
['format', 'fm'],
|
|
6381
|
-
['download', 'dl'],
|
|
6382
|
-
['blur', 'blur'],
|
|
6383
|
-
['sharpen', 'sharp'],
|
|
6384
|
-
['invert', 'invert'],
|
|
6385
|
-
['orientation', 'or'],
|
|
6386
|
-
['minHeight', 'min-h'],
|
|
6387
|
-
['maxHeight', 'max-h'],
|
|
6388
|
-
['minWidth', 'min-w'],
|
|
6389
|
-
['maxWidth', 'max-w'],
|
|
6390
|
-
['quality', 'q'],
|
|
6391
|
-
['fit', 'fit'],
|
|
6392
|
-
['crop', 'crop'],
|
|
6393
|
-
['auto', 'auto'],
|
|
6394
|
-
['dpr', 'dpr']
|
|
6395
|
-
];
|
|
6396
|
-
function urlForImage(options) {
|
|
6397
|
-
var spec = __assign({}, (options || {}));
|
|
6398
|
-
var source = spec.source;
|
|
6399
|
-
delete spec.source;
|
|
6400
|
-
var image = parseSource_1$$1.default(source);
|
|
6401
|
-
if (!image) {
|
|
6402
|
-
return null;
|
|
6403
|
-
}
|
|
6404
|
-
var id = image.asset._ref || image.asset._id || '';
|
|
6405
|
-
var asset = parseAssetId_1$$1.default(id);
|
|
6406
|
-
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
6407
|
-
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
6408
|
-
var cropTop = Math.round(image.crop.top * asset.height);
|
|
6409
|
-
var crop = {
|
|
6410
|
-
left: cropLeft,
|
|
6411
|
-
top: cropTop,
|
|
6412
|
-
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
6413
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
6414
|
-
};
|
|
6415
|
-
// Compute hot spot rect in terms of pixel coordinates
|
|
6416
|
-
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
6417
|
-
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
6418
|
-
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
6419
|
-
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
6420
|
-
var hotspot = {
|
|
6421
|
-
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
6422
|
-
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
6423
|
-
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
6424
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
6425
|
-
};
|
|
6426
|
-
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
6427
|
-
// the crop/hotspot.
|
|
6428
|
-
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
6429
|
-
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
6430
|
-
}
|
|
6431
|
-
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
6432
|
-
}
|
|
6433
|
-
exports.default = urlForImage;
|
|
6434
|
-
// eslint-disable-next-line complexity
|
|
6435
|
-
function specToImageUrl(spec) {
|
|
6436
|
-
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
6437
|
-
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
6438
|
-
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
6439
|
-
var params = [];
|
|
6440
|
-
if (spec.rect) {
|
|
6441
|
-
// Only bother url with a crop if it actually crops anything
|
|
6442
|
-
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
6443
|
-
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
6444
|
-
if (isEffectiveCrop) {
|
|
6445
|
-
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
6446
|
-
}
|
|
6447
|
-
}
|
|
6448
|
-
if (spec.bg) {
|
|
6449
|
-
params.push("bg=" + spec.bg);
|
|
6450
|
-
}
|
|
6451
|
-
if (spec.focalPoint) {
|
|
6452
|
-
params.push("fp-x=" + spec.focalPoint.x);
|
|
6453
|
-
params.push("fp-x=" + spec.focalPoint.y);
|
|
6454
|
-
}
|
|
6455
|
-
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
6456
|
-
if (flip) {
|
|
6457
|
-
params.push("flip=" + flip);
|
|
6458
|
-
}
|
|
6459
|
-
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
6460
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
6461
|
-
var specName = mapping[0], param = mapping[1];
|
|
6462
|
-
if (typeof spec[specName] !== 'undefined') {
|
|
6463
|
-
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
6464
|
-
}
|
|
6465
|
-
else if (typeof spec[param] !== 'undefined') {
|
|
6466
|
-
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
6467
|
-
}
|
|
6468
|
-
});
|
|
6469
|
-
if (params.length === 0) {
|
|
6470
|
-
return baseUrl;
|
|
6471
|
-
}
|
|
6472
|
-
return baseUrl + "?" + params.join('&');
|
|
6473
|
-
}
|
|
6474
|
-
function fit(source, spec) {
|
|
6475
|
-
var cropRect;
|
|
6476
|
-
var imgWidth = spec.width;
|
|
6477
|
-
var imgHeight = spec.height;
|
|
6478
|
-
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
6479
|
-
if (!(imgWidth && imgHeight)) {
|
|
6480
|
-
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
6481
|
-
}
|
|
6482
|
-
var crop = source.crop;
|
|
6483
|
-
var hotspot = source.hotspot;
|
|
6484
|
-
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
6485
|
-
var desiredAspectRatio = imgWidth / imgHeight;
|
|
6486
|
-
var cropAspectRatio = crop.width / crop.height;
|
|
6487
|
-
if (cropAspectRatio > desiredAspectRatio) {
|
|
6488
|
-
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
6489
|
-
var height = crop.height;
|
|
6490
|
-
var width = height * desiredAspectRatio;
|
|
6491
|
-
var top_2 = crop.top;
|
|
6492
|
-
// Center output horizontally over hotspot
|
|
6493
|
-
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
6494
|
-
var left = hotspotXCenter - width / 2;
|
|
6495
|
-
// Keep output within crop
|
|
6496
|
-
if (left < crop.left) {
|
|
6497
|
-
left = crop.left;
|
|
6498
|
-
}
|
|
6499
|
-
else if (left + width > crop.left + crop.width) {
|
|
6500
|
-
left = crop.left + crop.width - width;
|
|
6501
|
-
}
|
|
6502
|
-
cropRect = {
|
|
6503
|
-
left: Math.round(left),
|
|
6504
|
-
top: Math.round(top_2),
|
|
6505
|
-
width: Math.round(width),
|
|
6506
|
-
height: Math.round(height)
|
|
6507
|
-
};
|
|
6508
|
-
}
|
|
6509
|
-
else {
|
|
6510
|
-
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
6511
|
-
var width = crop.width;
|
|
6512
|
-
var height = width / desiredAspectRatio;
|
|
6513
|
-
var left = crop.left;
|
|
6514
|
-
// Center output vertically over hotspot
|
|
6515
|
-
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
6516
|
-
var top_3 = hotspotYCenter - height / 2;
|
|
6517
|
-
// Keep output rect within crop
|
|
6518
|
-
if (top_3 < crop.top) {
|
|
6519
|
-
top_3 = crop.top;
|
|
6520
|
-
}
|
|
6521
|
-
else if (top_3 + height > crop.top + crop.height) {
|
|
6522
|
-
top_3 = crop.top + crop.height - height;
|
|
6523
|
-
}
|
|
6524
|
-
cropRect = {
|
|
6525
|
-
left: Math.max(0, Math.floor(left)),
|
|
6526
|
-
top: Math.max(0, Math.floor(top_3)),
|
|
6527
|
-
width: Math.round(width),
|
|
6528
|
-
height: Math.round(height)
|
|
6529
|
-
};
|
|
6530
|
-
}
|
|
6531
|
-
return {
|
|
6532
|
-
width: imgWidth,
|
|
6533
|
-
height: imgHeight,
|
|
6534
|
-
rect: cropRect
|
|
6535
|
-
};
|
|
6536
|
-
}
|
|
6537
|
-
|
|
6538
|
-
});
|
|
6539
|
-
|
|
6540
|
-
unwrapExports(urlForImage_1);
|
|
6541
|
-
var urlForImage_2 = urlForImage_1.parseSource;
|
|
6542
|
-
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6543
|
-
|
|
6544
|
-
var builder = createCommonjsModule(function (module, exports) {
|
|
6545
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6546
|
-
__assign = Object.assign || function(t) {
|
|
6547
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6548
|
-
s = arguments[i];
|
|
6549
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6550
|
-
t[p] = s[p];
|
|
6551
|
-
}
|
|
6552
|
-
return t;
|
|
6553
|
-
};
|
|
6554
|
-
return __assign.apply(this, arguments);
|
|
6555
|
-
};
|
|
6556
|
-
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
6557
|
-
if (mod && mod.__esModule) return mod;
|
|
6558
|
-
var result = {};
|
|
6559
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6560
|
-
result["default"] = mod;
|
|
6561
|
-
return result;
|
|
6562
|
-
};
|
|
6563
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6564
|
-
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
6565
|
-
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
6566
|
-
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
6567
|
-
var validAutoModes = ['format'];
|
|
6568
|
-
function isSanityClient(client) {
|
|
6569
|
-
return client ? typeof client.clientConfig === 'object' : false;
|
|
6570
|
-
}
|
|
6571
|
-
function rewriteSpecName(key) {
|
|
6572
|
-
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6573
|
-
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
6574
|
-
var entry = specs_1[_i];
|
|
6575
|
-
var specName = entry[0], param = entry[1];
|
|
6576
|
-
if (key === specName || key === param) {
|
|
6577
|
-
return specName;
|
|
6578
|
-
}
|
|
6579
|
-
}
|
|
6580
|
-
return key;
|
|
6581
|
-
}
|
|
6582
|
-
function urlBuilder(options) {
|
|
6583
|
-
// Did we get a SanityClient?
|
|
6584
|
-
var client = options;
|
|
6585
|
-
if (isSanityClient(client)) {
|
|
6586
|
-
// Inherit config from client
|
|
6587
|
-
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
6588
|
-
return new ImageUrlBuilder(null, {
|
|
6589
|
-
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
6590
|
-
projectId: projectId,
|
|
6591
|
-
dataset: dataset
|
|
6592
|
-
});
|
|
6593
|
-
}
|
|
6594
|
-
// Or just accept the options as given
|
|
6595
|
-
return new ImageUrlBuilder(null, options);
|
|
6596
|
-
}
|
|
6597
|
-
exports.default = urlBuilder;
|
|
6598
|
-
var ImageUrlBuilder = /** @class */ (function () {
|
|
6599
|
-
function ImageUrlBuilder(parent, options) {
|
|
6600
|
-
this.options = parent
|
|
6601
|
-
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
6602
|
-
}
|
|
6603
|
-
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
6604
|
-
var baseUrl = options.baseUrl || '';
|
|
6605
|
-
var newOptions = { baseUrl: baseUrl };
|
|
6606
|
-
for (var key in options) {
|
|
6607
|
-
if (options.hasOwnProperty(key)) {
|
|
6608
|
-
var specKey = rewriteSpecName(key);
|
|
6609
|
-
newOptions[specKey] = options[key];
|
|
6610
|
-
}
|
|
6611
|
-
}
|
|
6612
|
-
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
6613
|
-
};
|
|
6614
|
-
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
6615
|
-
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
6616
|
-
// studio, the 'image'-document must be provided.
|
|
6617
|
-
ImageUrlBuilder.prototype.image = function (source) {
|
|
6618
|
-
return this.withOptions({ source: source });
|
|
6619
|
-
};
|
|
6620
|
-
// Specify the dataset
|
|
6621
|
-
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
6622
|
-
return this.withOptions({ dataset: dataset });
|
|
6623
|
-
};
|
|
6624
|
-
// Specify the projectId
|
|
6625
|
-
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
6626
|
-
return this.withOptions({ projectId: projectId });
|
|
6627
|
-
};
|
|
6628
|
-
// Specify background color
|
|
6629
|
-
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
6630
|
-
return this.withOptions({ bg: bg });
|
|
6631
|
-
};
|
|
6632
|
-
// Set DPR scaling factor
|
|
6633
|
-
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
6634
|
-
return this.withOptions({ dpr: dpr });
|
|
6635
|
-
};
|
|
6636
|
-
// Specify the width of the image in pixels
|
|
6637
|
-
ImageUrlBuilder.prototype.width = function (width) {
|
|
6638
|
-
return this.withOptions({ width: width });
|
|
6639
|
-
};
|
|
6640
|
-
// Specify the height of the image in pixels
|
|
6641
|
-
ImageUrlBuilder.prototype.height = function (height) {
|
|
6642
|
-
return this.withOptions({ height: height });
|
|
6643
|
-
};
|
|
6644
|
-
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
6645
|
-
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
6646
|
-
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
6647
|
-
};
|
|
6648
|
-
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
6649
|
-
return this.withOptions({ maxWidth: maxWidth });
|
|
6650
|
-
};
|
|
6651
|
-
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
6652
|
-
return this.withOptions({ minWidth: minWidth });
|
|
6653
|
-
};
|
|
6654
|
-
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
6655
|
-
return this.withOptions({ maxHeight: maxHeight });
|
|
6656
|
-
};
|
|
6657
|
-
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
6658
|
-
return this.withOptions({ minHeight: minHeight });
|
|
6659
|
-
};
|
|
6660
|
-
// Specify width and height in pixels
|
|
6661
|
-
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
6662
|
-
return this.withOptions({ width: width, height: height });
|
|
6663
|
-
};
|
|
6664
|
-
// Specify blur between 0 and 100
|
|
6665
|
-
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
6666
|
-
return this.withOptions({ blur: blur });
|
|
6667
|
-
};
|
|
6668
|
-
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
6669
|
-
return this.withOptions({ sharpen: sharpen });
|
|
6670
|
-
};
|
|
6671
|
-
// Specify the desired rectangle of the image
|
|
6672
|
-
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
6673
|
-
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
6674
|
-
};
|
|
6675
|
-
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
6676
|
-
ImageUrlBuilder.prototype.format = function (format) {
|
|
6677
|
-
return this.withOptions({ format: format });
|
|
6678
|
-
};
|
|
6679
|
-
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
6680
|
-
return this.withOptions({ invert: invert });
|
|
6681
|
-
};
|
|
6682
|
-
// Rotation in degrees 0, 90, 180, 270
|
|
6683
|
-
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
6684
|
-
return this.withOptions({ orientation: orientation });
|
|
6685
|
-
};
|
|
6686
|
-
// Compression quality 0-100
|
|
6687
|
-
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
6688
|
-
return this.withOptions({ quality: quality });
|
|
6689
|
-
};
|
|
6690
|
-
// Make it a download link. Parameter is default filename.
|
|
6691
|
-
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
6692
|
-
return this.withOptions({ download: download });
|
|
6693
|
-
};
|
|
6694
|
-
// Flip image horizontally
|
|
6695
|
-
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
6696
|
-
return this.withOptions({ flipHorizontal: true });
|
|
6697
|
-
};
|
|
6698
|
-
// Flip image verically
|
|
6699
|
-
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
6700
|
-
return this.withOptions({ flipVertical: true });
|
|
6701
|
-
};
|
|
6702
|
-
// Ignore crop/hotspot from image record, even when present
|
|
6703
|
-
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
6704
|
-
return this.withOptions({ ignoreImageParams: true });
|
|
6705
|
-
};
|
|
6706
|
-
ImageUrlBuilder.prototype.fit = function (value) {
|
|
6707
|
-
if (validFits.indexOf(value) === -1) {
|
|
6708
|
-
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
6709
|
-
}
|
|
6710
|
-
return this.withOptions({ fit: value });
|
|
6711
|
-
};
|
|
6712
|
-
ImageUrlBuilder.prototype.crop = function (value) {
|
|
6713
|
-
if (validCrops.indexOf(value) === -1) {
|
|
6714
|
-
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
6715
|
-
}
|
|
6716
|
-
return this.withOptions({ crop: value });
|
|
6717
|
-
};
|
|
6718
|
-
ImageUrlBuilder.prototype.auto = function (value) {
|
|
6719
|
-
if (validAutoModes.indexOf(value) === -1) {
|
|
6720
|
-
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
6721
|
-
}
|
|
6722
|
-
return this.withOptions({ auto: value });
|
|
6723
|
-
};
|
|
6724
|
-
// Gets the url based on the submitted parameters
|
|
6725
|
-
ImageUrlBuilder.prototype.url = function () {
|
|
6726
|
-
return urlForImage_1$$1.default(this.options);
|
|
6727
|
-
};
|
|
6728
|
-
// Synonym for url()
|
|
6729
|
-
ImageUrlBuilder.prototype.toString = function () {
|
|
6730
|
-
return this.url();
|
|
6731
|
-
};
|
|
6732
|
-
return ImageUrlBuilder;
|
|
6733
|
-
}());
|
|
6734
|
-
|
|
6735
|
-
});
|
|
6736
|
-
|
|
6737
|
-
unwrapExports(builder);
|
|
6738
|
-
|
|
6739
|
-
var node$1 = createCommonjsModule(function (module) {
|
|
6740
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6741
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6742
|
-
};
|
|
6743
|
-
var builder_1 = __importDefault(builder);
|
|
6744
|
-
module.exports = builder_1.default;
|
|
6745
|
-
|
|
6746
|
-
});
|
|
6747
|
-
|
|
6748
|
-
var imageUrlBuilder = unwrapExports(node$1);
|
|
6749
|
-
|
|
6750
|
-
var urlFor = function urlFor(source, client) {
|
|
6751
|
-
return imageUrlBuilder(client).image(source);
|
|
6752
|
-
};
|
|
6753
|
-
|
|
6754
6342
|
var getSerializers = function getSerializers(client) {
|
|
6755
6343
|
return {
|
|
6756
6344
|
types: {
|
|
@@ -6765,20 +6353,55 @@ var getSerializers = function getSerializers(client) {
|
|
|
6765
6353
|
var asset = node.asset,
|
|
6766
6354
|
caption = node.caption;
|
|
6767
6355
|
|
|
6768
|
-
|
|
6769
|
-
return React__default.createElement(FigureComponent, { caption: caption, url: url });
|
|
6356
|
+
return React__default.createElement(FigureComponent, { caption: caption, asset: asset });
|
|
6770
6357
|
},
|
|
6771
6358
|
slideshow: function slideshow(_ref3) {
|
|
6772
6359
|
var node = _ref3.node;
|
|
6360
|
+
var slides = node.slides;
|
|
6773
6361
|
|
|
6774
|
-
var slides = node.slides && node.slides.map(function (slide) {
|
|
6775
|
-
return Object.assign(slide, { url: urlFor(slide.asset, client).url() });
|
|
6776
|
-
});
|
|
6777
6362
|
return React__default.createElement(Slideshow, { slides: slides });
|
|
6778
6363
|
}
|
|
6779
6364
|
}
|
|
6780
6365
|
};
|
|
6781
6366
|
};
|
|
6782
6367
|
|
|
6783
|
-
|
|
6368
|
+
var searchResult = function searchResult(_ref) {
|
|
6369
|
+
var searchResults = _ref.searchResults,
|
|
6370
|
+
searchTerm = _ref.searchTerm;
|
|
6371
|
+
|
|
6372
|
+
return React__default.createElement(
|
|
6373
|
+
React__default.Fragment,
|
|
6374
|
+
null,
|
|
6375
|
+
React__default.createElement(
|
|
6376
|
+
'p',
|
|
6377
|
+
null,
|
|
6378
|
+
' Results for "',
|
|
6379
|
+
searchTerm,
|
|
6380
|
+
'" '
|
|
6381
|
+
),
|
|
6382
|
+
searchResults && searchResults.length > 0 ? searchResults.map(function (item, index) {
|
|
6383
|
+
return React__default.createElement(
|
|
6384
|
+
'div',
|
|
6385
|
+
{ key: index, className: 'search-result-container' },
|
|
6386
|
+
React__default.createElement(
|
|
6387
|
+
'h5',
|
|
6388
|
+
null,
|
|
6389
|
+
item.title
|
|
6390
|
+
),
|
|
6391
|
+
React__default.createElement(
|
|
6392
|
+
'p',
|
|
6393
|
+
null,
|
|
6394
|
+
item.summary,
|
|
6395
|
+
' '
|
|
6396
|
+
)
|
|
6397
|
+
);
|
|
6398
|
+
}) : React__default.createElement(
|
|
6399
|
+
'div',
|
|
6400
|
+
null,
|
|
6401
|
+
'No results found'
|
|
6402
|
+
)
|
|
6403
|
+
);
|
|
6404
|
+
};
|
|
6405
|
+
|
|
6406
|
+
export { DeckContent, DeckQueue, ThumbnailCard, TaxonomyCard, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD300x250, AD300x250x600, AD728x90, getSerializers, searchResult as SearchResult, Search };
|
|
6784
6407
|
//# sourceMappingURL=index.es.js.map
|