@mjhls/mjh-framework 1.0.49 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +170 -170
- package/dist/index.es.js +905 -833
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +902 -831
- package/dist/index.js.map +1 -1
- package/package.json +79 -79
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, { Component, useState,
|
|
1
|
+
import React__default, { Component, useState, 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';
|
|
@@ -17,7 +17,7 @@ import FormControl from 'react-bootstrap/FormControl';
|
|
|
17
17
|
import Button from 'react-bootstrap/Button';
|
|
18
18
|
import { withRouter } from 'next/router';
|
|
19
19
|
import PropTypes from 'prop-types';
|
|
20
|
-
import { Figure, Carousel, Card as Card$1 } from 'react-bootstrap';
|
|
20
|
+
import { Figure, Carousel, Card as Card$1, Table } from 'react-bootstrap';
|
|
21
21
|
|
|
22
22
|
/*! *****************************************************************************
|
|
23
23
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -674,7 +674,7 @@ var DeckContent = function (_React$Component) {
|
|
|
674
674
|
}, _this.renderCardImage = function (row, page) {
|
|
675
675
|
if (row.thumbnail && row.thumbnail.asset) {
|
|
676
676
|
return row.thumbnail.asset.url;
|
|
677
|
-
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
677
|
+
/*} else if (page === 'videos' && row.youtubeURL) {
|
|
678
678
|
return `https://img.youtube.com/vi/${getYouTubeId(row.youtubeURL)}/0.jpg`*/
|
|
679
679
|
} else {
|
|
680
680
|
return _this.defaultImage;
|
|
@@ -3076,7 +3076,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
3076
3076
|
),
|
|
3077
3077
|
React__default.createElement(
|
|
3078
3078
|
Navbar,
|
|
3079
|
-
{ className: 'bottom-nav', variant: 'dark', expand: '
|
|
3079
|
+
{ className: 'bottom-nav', variant: 'dark', expand: 'xl', bg: 'primary', sticky: 'top' },
|
|
3080
3080
|
React__default.createElement(
|
|
3081
3081
|
Container,
|
|
3082
3082
|
{ className: 'position-relative' },
|
|
@@ -3139,7 +3139,7 @@ var NavDvm = function NavDvm(props) {
|
|
|
3139
3139
|
React__default.createElement(
|
|
3140
3140
|
'style',
|
|
3141
3141
|
{ jsx: true },
|
|
3142
|
-
'\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:
|
|
3142
|
+
'\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 '
|
|
3143
3143
|
)
|
|
3144
3144
|
);
|
|
3145
3145
|
};
|
|
@@ -5772,20 +5772,12 @@ AD.propTypes = {
|
|
|
5772
5772
|
minInViewPercent: PropTypes.number
|
|
5773
5773
|
};
|
|
5774
5774
|
|
|
5775
|
-
var AD300x100 = function AD300x100(_ref) {
|
|
5776
|
-
var networkID = _ref.networkID,
|
|
5777
|
-
adUnit = _ref.adUnit,
|
|
5778
|
-
targeting = _ref.targeting;
|
|
5779
|
-
|
|
5780
|
-
return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x100', sizes: [[300, 100]] });
|
|
5781
|
-
};
|
|
5782
|
-
|
|
5783
5775
|
var AD300x250 = function AD300x250(_ref) {
|
|
5784
5776
|
var networkID = _ref.networkID,
|
|
5785
5777
|
adUnit = _ref.adUnit,
|
|
5786
5778
|
targeting = _ref.targeting;
|
|
5787
5779
|
|
|
5788
|
-
return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x250', sizes: [[300, 250]] });
|
|
5780
|
+
return React__default.createElement(AD, { networkID: networkID, adUnit: adUnit, targeting: targeting, className: 'AD300x250', sizes: [[300, 250], [300, 100]] });
|
|
5789
5781
|
};
|
|
5790
5782
|
|
|
5791
5783
|
var AD300x250x600 = function AD300x250x600(_ref) {
|
|
@@ -5798,281 +5790,828 @@ var AD300x250x600 = function AD300x250x600(_ref) {
|
|
|
5798
5790
|
adUnit: adUnit,
|
|
5799
5791
|
className: 'AD300x250',
|
|
5800
5792
|
targeting: targeting,
|
|
5801
|
-
sizes: [[300, 250], [300, 600]]
|
|
5793
|
+
sizes: [[300, 250], [300, 600], [300, 100]]
|
|
5802
5794
|
});
|
|
5803
5795
|
};
|
|
5804
5796
|
|
|
5805
|
-
var
|
|
5806
|
-
|
|
5807
|
-
|
|
5797
|
+
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
5798
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5799
|
+
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
5800
|
+
function parseAssetId(ref) {
|
|
5801
|
+
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
5802
|
+
if (!id || !dimensionString || !format) {
|
|
5803
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
5804
|
+
}
|
|
5805
|
+
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
5806
|
+
var width = +imgWidthStr;
|
|
5807
|
+
var height = +imgHeightStr;
|
|
5808
|
+
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
5809
|
+
if (!isValidAssetId) {
|
|
5810
|
+
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
5811
|
+
}
|
|
5812
|
+
return { id: id, width: width, height: height, format: format };
|
|
5813
|
+
}
|
|
5814
|
+
exports.default = parseAssetId;
|
|
5808
5815
|
|
|
5809
|
-
|
|
5810
|
-
return React__default.createElement(
|
|
5811
|
-
'div',
|
|
5812
|
-
{ style: { textAlign: 'center', marginTop: '1em', marginBottom: '1em' } },
|
|
5813
|
-
React__default.createElement(
|
|
5814
|
-
Figure,
|
|
5815
|
-
null,
|
|
5816
|
-
React__default.createElement(Figure.Image, { alt: asset ? asset.originalFilename : '', src: asset.url }),
|
|
5817
|
-
caption && React__default.createElement(
|
|
5818
|
-
Figure.Caption,
|
|
5819
|
-
null,
|
|
5820
|
-
caption
|
|
5821
|
-
)
|
|
5822
|
-
)
|
|
5823
|
-
);
|
|
5824
|
-
}
|
|
5825
|
-
return null;
|
|
5826
|
-
};
|
|
5816
|
+
});
|
|
5827
5817
|
|
|
5828
|
-
|
|
5829
|
-
var slides = _ref.slides;
|
|
5818
|
+
unwrapExports(parseAssetId_1);
|
|
5830
5819
|
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
);
|
|
5843
|
-
})
|
|
5844
|
-
)
|
|
5845
|
-
);
|
|
5820
|
+
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
5821
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
5822
|
+
__assign = Object.assign || function(t) {
|
|
5823
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5824
|
+
s = arguments[i];
|
|
5825
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
5826
|
+
t[p] = s[p];
|
|
5827
|
+
}
|
|
5828
|
+
return t;
|
|
5829
|
+
};
|
|
5830
|
+
return __assign.apply(this, arguments);
|
|
5846
5831
|
};
|
|
5847
|
-
|
|
5848
|
-
var
|
|
5849
|
-
var
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
var
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
for (i = length; i-- !== 0;)
|
|
5866
|
-
if (!equal(a[i], b[i])) return false;
|
|
5867
|
-
return true;
|
|
5832
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5833
|
+
var isRef = function (src) {
|
|
5834
|
+
var source = src;
|
|
5835
|
+
return source ? typeof source._ref === 'string' : false;
|
|
5836
|
+
};
|
|
5837
|
+
var isAsset = function (src) {
|
|
5838
|
+
var source = src;
|
|
5839
|
+
return source ? typeof source._id === 'string' : false;
|
|
5840
|
+
};
|
|
5841
|
+
var isAssetStub = function (src) {
|
|
5842
|
+
var source = src;
|
|
5843
|
+
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
5844
|
+
};
|
|
5845
|
+
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
5846
|
+
// eslint-disable-next-line complexity
|
|
5847
|
+
function parseSource(source) {
|
|
5848
|
+
if (!source) {
|
|
5849
|
+
return null;
|
|
5868
5850
|
}
|
|
5869
|
-
|
|
5870
|
-
if (
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
if (dateA && dateB) return a.getTime() == b.getTime();
|
|
5876
|
-
|
|
5877
|
-
var regexpA = a instanceof RegExp
|
|
5878
|
-
, regexpB = b instanceof RegExp;
|
|
5879
|
-
if (regexpA != regexpB) return false;
|
|
5880
|
-
if (regexpA && regexpB) return a.toString() == b.toString();
|
|
5881
|
-
|
|
5882
|
-
var keys = keyList(a);
|
|
5883
|
-
length = keys.length;
|
|
5884
|
-
|
|
5885
|
-
if (length !== keyList(b).length)
|
|
5886
|
-
return false;
|
|
5887
|
-
|
|
5888
|
-
for (i = length; i-- !== 0;)
|
|
5889
|
-
if (!hasProp.call(b, keys[i])) return false;
|
|
5890
|
-
|
|
5891
|
-
for (i = length; i-- !== 0;) {
|
|
5892
|
-
key = keys[i];
|
|
5893
|
-
if (!equal(a[key], b[key])) return false;
|
|
5851
|
+
var image;
|
|
5852
|
+
if (typeof source === 'string' && isUrl(source)) {
|
|
5853
|
+
// Someone passed an existing image url?
|
|
5854
|
+
image = {
|
|
5855
|
+
asset: { _ref: urlToId(source) }
|
|
5856
|
+
};
|
|
5894
5857
|
}
|
|
5858
|
+
else if (typeof source === 'string') {
|
|
5859
|
+
// Just an asset id
|
|
5860
|
+
image = {
|
|
5861
|
+
asset: { _ref: source }
|
|
5862
|
+
};
|
|
5863
|
+
}
|
|
5864
|
+
else if (isRef(source)) {
|
|
5865
|
+
// We just got passed an asset directly
|
|
5866
|
+
image = {
|
|
5867
|
+
asset: source
|
|
5868
|
+
};
|
|
5869
|
+
}
|
|
5870
|
+
else if (isAsset(source)) {
|
|
5871
|
+
// If we were passed an image asset document
|
|
5872
|
+
image = {
|
|
5873
|
+
asset: {
|
|
5874
|
+
_ref: source._id || ''
|
|
5875
|
+
}
|
|
5876
|
+
};
|
|
5877
|
+
}
|
|
5878
|
+
else if (isAssetStub(source)) {
|
|
5879
|
+
// If we were passed a partial asset (`url`, but no `_id`)
|
|
5880
|
+
image = {
|
|
5881
|
+
asset: {
|
|
5882
|
+
_ref: urlToId(source.asset.url)
|
|
5883
|
+
}
|
|
5884
|
+
};
|
|
5885
|
+
}
|
|
5886
|
+
else if (typeof source.asset === 'object') {
|
|
5887
|
+
// Probably an actual image with materialized asset
|
|
5888
|
+
image = source;
|
|
5889
|
+
}
|
|
5890
|
+
else {
|
|
5891
|
+
// We got something that does not look like an image, or it is an image
|
|
5892
|
+
// that currently isn't sporting an asset.
|
|
5893
|
+
return null;
|
|
5894
|
+
}
|
|
5895
|
+
var img = source;
|
|
5896
|
+
if (img.crop) {
|
|
5897
|
+
image.crop = img.crop;
|
|
5898
|
+
}
|
|
5899
|
+
if (img.hotspot) {
|
|
5900
|
+
image.hotspot = img.hotspot;
|
|
5901
|
+
}
|
|
5902
|
+
return applyDefaults(image);
|
|
5903
|
+
}
|
|
5904
|
+
exports.default = parseSource;
|
|
5905
|
+
function isUrl(url) {
|
|
5906
|
+
return /^https?:\/\//.test("" + url);
|
|
5907
|
+
}
|
|
5908
|
+
function urlToId(url) {
|
|
5909
|
+
var parts = url.split('/').slice(-1);
|
|
5910
|
+
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
5911
|
+
}
|
|
5912
|
+
// Mock crop and hotspot if image lacks it
|
|
5913
|
+
function applyDefaults(image) {
|
|
5914
|
+
if (image.crop && image.hotspot) {
|
|
5915
|
+
return image;
|
|
5916
|
+
}
|
|
5917
|
+
// We need to pad in default values for crop or hotspot
|
|
5918
|
+
var result = __assign({}, image);
|
|
5919
|
+
if (!result.crop) {
|
|
5920
|
+
result.crop = {
|
|
5921
|
+
left: 0,
|
|
5922
|
+
top: 0,
|
|
5923
|
+
bottom: 0,
|
|
5924
|
+
right: 0
|
|
5925
|
+
};
|
|
5926
|
+
}
|
|
5927
|
+
if (!result.hotspot) {
|
|
5928
|
+
result.hotspot = {
|
|
5929
|
+
x: 0.5,
|
|
5930
|
+
y: 0.5,
|
|
5931
|
+
height: 1.0,
|
|
5932
|
+
width: 1.0
|
|
5933
|
+
};
|
|
5934
|
+
}
|
|
5935
|
+
return result;
|
|
5936
|
+
}
|
|
5895
5937
|
|
|
5896
|
-
|
|
5897
|
-
}
|
|
5898
|
-
|
|
5899
|
-
return a!==a && b!==b;
|
|
5900
|
-
};
|
|
5901
|
-
|
|
5902
|
-
var Sister;
|
|
5903
|
-
|
|
5904
|
-
/**
|
|
5905
|
-
* @link https://github.com/gajus/sister for the canonical source repository
|
|
5906
|
-
* @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause
|
|
5907
|
-
*/
|
|
5908
|
-
Sister = function () {
|
|
5909
|
-
var sister = {},
|
|
5910
|
-
events = {};
|
|
5938
|
+
});
|
|
5911
5939
|
|
|
5912
|
-
|
|
5913
|
-
* @name handler
|
|
5914
|
-
* @function
|
|
5915
|
-
* @param {Object} data Event data.
|
|
5916
|
-
*/
|
|
5940
|
+
unwrapExports(parseSource_1);
|
|
5917
5941
|
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
return listener;
|
|
5942
|
+
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
5943
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
5944
|
+
__assign = Object.assign || function(t) {
|
|
5945
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5946
|
+
s = arguments[i];
|
|
5947
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
5948
|
+
t[p] = s[p];
|
|
5949
|
+
}
|
|
5950
|
+
return t;
|
|
5928
5951
|
};
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
|
|
5952
|
+
return __assign.apply(this, arguments);
|
|
5953
|
+
};
|
|
5954
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
5955
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5956
|
+
};
|
|
5957
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5958
|
+
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
5959
|
+
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
5960
|
+
exports.parseSource = parseSource_1$$1.default;
|
|
5961
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
5962
|
+
['width', 'w'],
|
|
5963
|
+
['height', 'h'],
|
|
5964
|
+
['format', 'fm'],
|
|
5965
|
+
['download', 'dl'],
|
|
5966
|
+
['blur', 'blur'],
|
|
5967
|
+
['sharpen', 'sharp'],
|
|
5968
|
+
['invert', 'invert'],
|
|
5969
|
+
['orientation', 'or'],
|
|
5970
|
+
['minHeight', 'min-h'],
|
|
5971
|
+
['maxHeight', 'max-h'],
|
|
5972
|
+
['minWidth', 'min-w'],
|
|
5973
|
+
['maxWidth', 'max-w'],
|
|
5974
|
+
['quality', 'q'],
|
|
5975
|
+
['fit', 'fit'],
|
|
5976
|
+
['crop', 'crop'],
|
|
5977
|
+
['auto', 'auto'],
|
|
5978
|
+
['dpr', 'dpr']
|
|
5979
|
+
];
|
|
5980
|
+
function urlForImage(options) {
|
|
5981
|
+
var spec = __assign({}, (options || {}));
|
|
5982
|
+
var source = spec.source;
|
|
5983
|
+
delete spec.source;
|
|
5984
|
+
var image = parseSource_1$$1.default(source);
|
|
5985
|
+
if (!image) {
|
|
5986
|
+
return null;
|
|
5987
|
+
}
|
|
5988
|
+
var id = image.asset._ref || image.asset._id || '';
|
|
5989
|
+
var asset = parseAssetId_1$$1.default(id);
|
|
5990
|
+
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
5991
|
+
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
5992
|
+
var cropTop = Math.round(image.crop.top * asset.height);
|
|
5993
|
+
var crop = {
|
|
5994
|
+
left: cropLeft,
|
|
5995
|
+
top: cropTop,
|
|
5996
|
+
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
5997
|
+
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
5998
|
+
};
|
|
5999
|
+
// Compute hot spot rect in terms of pixel coordinates
|
|
6000
|
+
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
6001
|
+
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
6002
|
+
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
6003
|
+
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
6004
|
+
var hotspot = {
|
|
6005
|
+
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
6006
|
+
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
6007
|
+
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
6008
|
+
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
6009
|
+
};
|
|
6010
|
+
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
6011
|
+
// the crop/hotspot.
|
|
6012
|
+
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
6013
|
+
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
6014
|
+
}
|
|
6015
|
+
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
6016
|
+
}
|
|
6017
|
+
exports.default = urlForImage;
|
|
6018
|
+
// eslint-disable-next-line complexity
|
|
6019
|
+
function specToImageUrl(spec) {
|
|
6020
|
+
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
6021
|
+
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
6022
|
+
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
6023
|
+
var params = [];
|
|
6024
|
+
if (spec.rect) {
|
|
6025
|
+
// Only bother url with a crop if it actually crops anything
|
|
6026
|
+
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
6027
|
+
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
6028
|
+
if (isEffectiveCrop) {
|
|
6029
|
+
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
6030
|
+
}
|
|
6031
|
+
}
|
|
6032
|
+
if (spec.bg) {
|
|
6033
|
+
params.push("bg=" + spec.bg);
|
|
6034
|
+
}
|
|
6035
|
+
if (spec.focalPoint) {
|
|
6036
|
+
params.push("fp-x=" + spec.focalPoint.x);
|
|
6037
|
+
params.push("fp-x=" + spec.focalPoint.y);
|
|
6038
|
+
}
|
|
6039
|
+
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
6040
|
+
if (flip) {
|
|
6041
|
+
params.push("flip=" + flip);
|
|
6042
|
+
}
|
|
6043
|
+
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
6044
|
+
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
6045
|
+
var specName = mapping[0], param = mapping[1];
|
|
6046
|
+
if (typeof spec[specName] !== 'undefined') {
|
|
6047
|
+
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
6048
|
+
}
|
|
6049
|
+
else if (typeof spec[param] !== 'undefined') {
|
|
6050
|
+
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
6051
|
+
}
|
|
6052
|
+
});
|
|
6053
|
+
if (params.length === 0) {
|
|
6054
|
+
return baseUrl;
|
|
6055
|
+
}
|
|
6056
|
+
return baseUrl + "?" + params.join('&');
|
|
6057
|
+
}
|
|
6058
|
+
function fit(source, spec) {
|
|
6059
|
+
var cropRect;
|
|
6060
|
+
var imgWidth = spec.width;
|
|
6061
|
+
var imgHeight = spec.height;
|
|
6062
|
+
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
6063
|
+
if (!(imgWidth && imgHeight)) {
|
|
6064
|
+
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
6065
|
+
}
|
|
6066
|
+
var crop = source.crop;
|
|
6067
|
+
var hotspot = source.hotspot;
|
|
6068
|
+
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
6069
|
+
var desiredAspectRatio = imgWidth / imgHeight;
|
|
6070
|
+
var cropAspectRatio = crop.width / crop.height;
|
|
6071
|
+
if (cropAspectRatio > desiredAspectRatio) {
|
|
6072
|
+
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
6073
|
+
var height = crop.height;
|
|
6074
|
+
var width = height * desiredAspectRatio;
|
|
6075
|
+
var top_2 = crop.top;
|
|
6076
|
+
// Center output horizontally over hotspot
|
|
6077
|
+
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
6078
|
+
var left = hotspotXCenter - width / 2;
|
|
6079
|
+
// Keep output within crop
|
|
6080
|
+
if (left < crop.left) {
|
|
6081
|
+
left = crop.left;
|
|
6082
|
+
}
|
|
6083
|
+
else if (left + width > crop.left + crop.width) {
|
|
6084
|
+
left = crop.left + crop.width - width;
|
|
6085
|
+
}
|
|
6086
|
+
cropRect = {
|
|
6087
|
+
left: Math.round(left),
|
|
6088
|
+
top: Math.round(top_2),
|
|
6089
|
+
width: Math.round(width),
|
|
6090
|
+
height: Math.round(height)
|
|
6091
|
+
};
|
|
6092
|
+
}
|
|
6093
|
+
else {
|
|
6094
|
+
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
6095
|
+
var width = crop.width;
|
|
6096
|
+
var height = width / desiredAspectRatio;
|
|
6097
|
+
var left = crop.left;
|
|
6098
|
+
// Center output vertically over hotspot
|
|
6099
|
+
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
6100
|
+
var top_3 = hotspotYCenter - height / 2;
|
|
6101
|
+
// Keep output rect within crop
|
|
6102
|
+
if (top_3 < crop.top) {
|
|
6103
|
+
top_3 = crop.top;
|
|
6104
|
+
}
|
|
6105
|
+
else if (top_3 + height > crop.top + crop.height) {
|
|
6106
|
+
top_3 = crop.top + crop.height - height;
|
|
5938
6107
|
}
|
|
6108
|
+
cropRect = {
|
|
6109
|
+
left: Math.max(0, Math.floor(left)),
|
|
6110
|
+
top: Math.max(0, Math.floor(top_3)),
|
|
6111
|
+
width: Math.round(width),
|
|
6112
|
+
height: Math.round(height)
|
|
6113
|
+
};
|
|
6114
|
+
}
|
|
6115
|
+
return {
|
|
6116
|
+
width: imgWidth,
|
|
6117
|
+
height: imgHeight,
|
|
6118
|
+
rect: cropRect
|
|
5939
6119
|
};
|
|
6120
|
+
}
|
|
5940
6121
|
|
|
5941
|
-
|
|
5942
|
-
* @param {String} name Event name.
|
|
5943
|
-
* @param {Object} data Event data.
|
|
5944
|
-
*/
|
|
5945
|
-
sister.trigger = function (name, data) {
|
|
5946
|
-
var listeners = events[name],
|
|
5947
|
-
i;
|
|
6122
|
+
});
|
|
5948
6123
|
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
6124
|
+
unwrapExports(urlForImage_1);
|
|
6125
|
+
var urlForImage_2 = urlForImage_1.parseSource;
|
|
6126
|
+
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6127
|
+
|
|
6128
|
+
var builder = createCommonjsModule(function (module, exports) {
|
|
6129
|
+
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
6130
|
+
__assign = Object.assign || function(t) {
|
|
6131
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6132
|
+
s = arguments[i];
|
|
6133
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6134
|
+
t[p] = s[p];
|
|
5954
6135
|
}
|
|
6136
|
+
return t;
|
|
5955
6137
|
};
|
|
5956
|
-
|
|
5957
|
-
return sister;
|
|
6138
|
+
return __assign.apply(this, arguments);
|
|
5958
6139
|
};
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
var
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
if (typeof opts === 'function') {
|
|
5967
|
-
cb = opts;
|
|
5968
|
-
opts = {};
|
|
5969
|
-
}
|
|
5970
|
-
|
|
5971
|
-
opts = opts || {};
|
|
5972
|
-
cb = cb || function() {};
|
|
5973
|
-
|
|
5974
|
-
script.type = opts.type || 'text/javascript';
|
|
5975
|
-
script.charset = opts.charset || 'utf8';
|
|
5976
|
-
script.async = 'async' in opts ? !!opts.async : true;
|
|
5977
|
-
script.src = src;
|
|
5978
|
-
|
|
5979
|
-
if (opts.attrs) {
|
|
5980
|
-
setAttributes(script, opts.attrs);
|
|
5981
|
-
}
|
|
5982
|
-
|
|
5983
|
-
if (opts.text) {
|
|
5984
|
-
script.text = '' + opts.text;
|
|
5985
|
-
}
|
|
5986
|
-
|
|
5987
|
-
var onend = 'onload' in script ? stdOnEnd : ieOnEnd;
|
|
5988
|
-
onend(script, cb);
|
|
5989
|
-
|
|
5990
|
-
// some good legacy browsers (firefox) fail the 'in' detection above
|
|
5991
|
-
// so as a fallback we always set onload
|
|
5992
|
-
// old IE will ignore this and new IE will set onload
|
|
5993
|
-
if (!script.onload) {
|
|
5994
|
-
stdOnEnd(script, cb);
|
|
5995
|
-
}
|
|
5996
|
-
|
|
5997
|
-
head.appendChild(script);
|
|
6140
|
+
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
6141
|
+
if (mod && mod.__esModule) return mod;
|
|
6142
|
+
var result = {};
|
|
6143
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6144
|
+
result["default"] = mod;
|
|
6145
|
+
return result;
|
|
5998
6146
|
};
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
function stdOnEnd (script, cb) {
|
|
6007
|
-
script.onload = function () {
|
|
6008
|
-
this.onerror = this.onload = null;
|
|
6009
|
-
cb(null, script);
|
|
6010
|
-
};
|
|
6011
|
-
script.onerror = function () {
|
|
6012
|
-
// this.onload = null here is necessary
|
|
6013
|
-
// because even IE9 works not like others
|
|
6014
|
-
this.onerror = this.onload = null;
|
|
6015
|
-
cb(new Error('Failed to load ' + this.src), script);
|
|
6016
|
-
};
|
|
6147
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6148
|
+
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
6149
|
+
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
6150
|
+
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
6151
|
+
var validAutoModes = ['format'];
|
|
6152
|
+
function isSanityClient(client) {
|
|
6153
|
+
return client ? typeof client.clientConfig === 'object' : false;
|
|
6017
6154
|
}
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6155
|
+
function rewriteSpecName(key) {
|
|
6156
|
+
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
6157
|
+
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
6158
|
+
var entry = specs_1[_i];
|
|
6159
|
+
var specName = entry[0], param = entry[1];
|
|
6160
|
+
if (key === specName || key === param) {
|
|
6161
|
+
return specName;
|
|
6162
|
+
}
|
|
6163
|
+
}
|
|
6164
|
+
return key;
|
|
6025
6165
|
}
|
|
6166
|
+
function urlBuilder(options) {
|
|
6167
|
+
// Did we get a SanityClient?
|
|
6168
|
+
var client = options;
|
|
6169
|
+
if (isSanityClient(client)) {
|
|
6170
|
+
// Inherit config from client
|
|
6171
|
+
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
6172
|
+
return new ImageUrlBuilder(null, {
|
|
6173
|
+
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
6174
|
+
projectId: projectId,
|
|
6175
|
+
dataset: dataset
|
|
6176
|
+
});
|
|
6177
|
+
}
|
|
6178
|
+
// Or just accept the options as given
|
|
6179
|
+
return new ImageUrlBuilder(null, options);
|
|
6180
|
+
}
|
|
6181
|
+
exports.default = urlBuilder;
|
|
6182
|
+
var ImageUrlBuilder = /** @class */ (function () {
|
|
6183
|
+
function ImageUrlBuilder(parent, options) {
|
|
6184
|
+
this.options = parent
|
|
6185
|
+
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
6186
|
+
}
|
|
6187
|
+
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
6188
|
+
var baseUrl = options.baseUrl || '';
|
|
6189
|
+
var newOptions = { baseUrl: baseUrl };
|
|
6190
|
+
for (var key in options) {
|
|
6191
|
+
if (options.hasOwnProperty(key)) {
|
|
6192
|
+
var specKey = rewriteSpecName(key);
|
|
6193
|
+
newOptions[specKey] = options[key];
|
|
6194
|
+
}
|
|
6195
|
+
}
|
|
6196
|
+
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
6197
|
+
};
|
|
6198
|
+
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
6199
|
+
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
6200
|
+
// studio, the 'image'-document must be provided.
|
|
6201
|
+
ImageUrlBuilder.prototype.image = function (source) {
|
|
6202
|
+
return this.withOptions({ source: source });
|
|
6203
|
+
};
|
|
6204
|
+
// Specify the dataset
|
|
6205
|
+
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
6206
|
+
return this.withOptions({ dataset: dataset });
|
|
6207
|
+
};
|
|
6208
|
+
// Specify the projectId
|
|
6209
|
+
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
6210
|
+
return this.withOptions({ projectId: projectId });
|
|
6211
|
+
};
|
|
6212
|
+
// Specify background color
|
|
6213
|
+
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
6214
|
+
return this.withOptions({ bg: bg });
|
|
6215
|
+
};
|
|
6216
|
+
// Set DPR scaling factor
|
|
6217
|
+
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
6218
|
+
return this.withOptions({ dpr: dpr });
|
|
6219
|
+
};
|
|
6220
|
+
// Specify the width of the image in pixels
|
|
6221
|
+
ImageUrlBuilder.prototype.width = function (width) {
|
|
6222
|
+
return this.withOptions({ width: width });
|
|
6223
|
+
};
|
|
6224
|
+
// Specify the height of the image in pixels
|
|
6225
|
+
ImageUrlBuilder.prototype.height = function (height) {
|
|
6226
|
+
return this.withOptions({ height: height });
|
|
6227
|
+
};
|
|
6228
|
+
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
6229
|
+
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
6230
|
+
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
6231
|
+
};
|
|
6232
|
+
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
6233
|
+
return this.withOptions({ maxWidth: maxWidth });
|
|
6234
|
+
};
|
|
6235
|
+
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
6236
|
+
return this.withOptions({ minWidth: minWidth });
|
|
6237
|
+
};
|
|
6238
|
+
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
6239
|
+
return this.withOptions({ maxHeight: maxHeight });
|
|
6240
|
+
};
|
|
6241
|
+
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
6242
|
+
return this.withOptions({ minHeight: minHeight });
|
|
6243
|
+
};
|
|
6244
|
+
// Specify width and height in pixels
|
|
6245
|
+
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
6246
|
+
return this.withOptions({ width: width, height: height });
|
|
6247
|
+
};
|
|
6248
|
+
// Specify blur between 0 and 100
|
|
6249
|
+
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
6250
|
+
return this.withOptions({ blur: blur });
|
|
6251
|
+
};
|
|
6252
|
+
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
6253
|
+
return this.withOptions({ sharpen: sharpen });
|
|
6254
|
+
};
|
|
6255
|
+
// Specify the desired rectangle of the image
|
|
6256
|
+
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
6257
|
+
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
6258
|
+
};
|
|
6259
|
+
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
6260
|
+
ImageUrlBuilder.prototype.format = function (format) {
|
|
6261
|
+
return this.withOptions({ format: format });
|
|
6262
|
+
};
|
|
6263
|
+
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
6264
|
+
return this.withOptions({ invert: invert });
|
|
6265
|
+
};
|
|
6266
|
+
// Rotation in degrees 0, 90, 180, 270
|
|
6267
|
+
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
6268
|
+
return this.withOptions({ orientation: orientation });
|
|
6269
|
+
};
|
|
6270
|
+
// Compression quality 0-100
|
|
6271
|
+
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
6272
|
+
return this.withOptions({ quality: quality });
|
|
6273
|
+
};
|
|
6274
|
+
// Make it a download link. Parameter is default filename.
|
|
6275
|
+
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
6276
|
+
return this.withOptions({ download: download });
|
|
6277
|
+
};
|
|
6278
|
+
// Flip image horizontally
|
|
6279
|
+
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
6280
|
+
return this.withOptions({ flipHorizontal: true });
|
|
6281
|
+
};
|
|
6282
|
+
// Flip image verically
|
|
6283
|
+
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
6284
|
+
return this.withOptions({ flipVertical: true });
|
|
6285
|
+
};
|
|
6286
|
+
// Ignore crop/hotspot from image record, even when present
|
|
6287
|
+
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
6288
|
+
return this.withOptions({ ignoreImageParams: true });
|
|
6289
|
+
};
|
|
6290
|
+
ImageUrlBuilder.prototype.fit = function (value) {
|
|
6291
|
+
if (validFits.indexOf(value) === -1) {
|
|
6292
|
+
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
6293
|
+
}
|
|
6294
|
+
return this.withOptions({ fit: value });
|
|
6295
|
+
};
|
|
6296
|
+
ImageUrlBuilder.prototype.crop = function (value) {
|
|
6297
|
+
if (validCrops.indexOf(value) === -1) {
|
|
6298
|
+
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
6299
|
+
}
|
|
6300
|
+
return this.withOptions({ crop: value });
|
|
6301
|
+
};
|
|
6302
|
+
ImageUrlBuilder.prototype.auto = function (value) {
|
|
6303
|
+
if (validAutoModes.indexOf(value) === -1) {
|
|
6304
|
+
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
6305
|
+
}
|
|
6306
|
+
return this.withOptions({ auto: value });
|
|
6307
|
+
};
|
|
6308
|
+
// Gets the url based on the submitted parameters
|
|
6309
|
+
ImageUrlBuilder.prototype.url = function () {
|
|
6310
|
+
return urlForImage_1$$1.default(this.options);
|
|
6311
|
+
};
|
|
6312
|
+
// Synonym for url()
|
|
6313
|
+
ImageUrlBuilder.prototype.toString = function () {
|
|
6314
|
+
return this.url();
|
|
6315
|
+
};
|
|
6316
|
+
return ImageUrlBuilder;
|
|
6317
|
+
}());
|
|
6026
6318
|
|
|
6027
|
-
var loadYouTubeIframeApi = createCommonjsModule(function (module, exports) {
|
|
6028
|
-
|
|
6029
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6030
|
-
value: true
|
|
6031
6319
|
});
|
|
6032
6320
|
|
|
6321
|
+
unwrapExports(builder);
|
|
6033
6322
|
|
|
6323
|
+
var node = createCommonjsModule(function (module) {
|
|
6324
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
6325
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6326
|
+
};
|
|
6327
|
+
var builder_1 = __importDefault(builder);
|
|
6328
|
+
module.exports = builder_1.default;
|
|
6034
6329
|
|
|
6035
|
-
|
|
6330
|
+
});
|
|
6036
6331
|
|
|
6037
|
-
|
|
6332
|
+
var imageUrlBuilder = unwrapExports(node);
|
|
6038
6333
|
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
*/
|
|
6044
|
-
var iframeAPIReady = new Promise(function (resolve) {
|
|
6045
|
-
if (window.YT && window.YT.Player && window.YT.Player instanceof Function) {
|
|
6046
|
-
resolve(window.YT);
|
|
6334
|
+
var FigureComponent = function FigureComponent(_ref) {
|
|
6335
|
+
var caption = _ref.caption,
|
|
6336
|
+
asset = _ref.asset,
|
|
6337
|
+
client = _ref.client;
|
|
6047
6338
|
|
|
6048
|
-
|
|
6049
|
-
} else {
|
|
6050
|
-
var protocol = window.location.protocol === 'http:' ? 'http:' : 'https:';
|
|
6339
|
+
var builder = imageUrlBuilder(client);
|
|
6051
6340
|
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
}
|
|
6056
|
-
});
|
|
6057
|
-
}
|
|
6341
|
+
var urlFor = function urlFor(source) {
|
|
6342
|
+
return builder.image(source);
|
|
6343
|
+
};
|
|
6058
6344
|
|
|
6059
|
-
|
|
6345
|
+
return React__default.createElement(
|
|
6346
|
+
'div',
|
|
6347
|
+
{ style: { textAlign: 'center', marginTop: '1em', marginBottom: '1em' } },
|
|
6348
|
+
React__default.createElement(
|
|
6349
|
+
Figure,
|
|
6350
|
+
null,
|
|
6351
|
+
React__default.createElement(Figure.Image, { src: urlFor(asset).url() }),
|
|
6352
|
+
caption && React__default.createElement(
|
|
6353
|
+
Figure.Caption,
|
|
6354
|
+
null,
|
|
6355
|
+
caption
|
|
6356
|
+
)
|
|
6357
|
+
)
|
|
6358
|
+
);
|
|
6359
|
+
};
|
|
6060
6360
|
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
if (previous) {
|
|
6065
|
-
previous();
|
|
6066
|
-
}
|
|
6361
|
+
var Slideshow = function Slideshow(_ref) {
|
|
6362
|
+
var slides = _ref.slides,
|
|
6363
|
+
client = _ref.client;
|
|
6067
6364
|
|
|
6068
|
-
|
|
6069
|
-
};
|
|
6070
|
-
});
|
|
6365
|
+
var builder = imageUrlBuilder(client);
|
|
6071
6366
|
|
|
6072
|
-
|
|
6367
|
+
var urlFor = function urlFor(source) {
|
|
6368
|
+
return builder.image(source);
|
|
6369
|
+
};
|
|
6370
|
+
return React__default.createElement(
|
|
6371
|
+
'div',
|
|
6372
|
+
{ style: { marginTop: '1em', marginBottom: '1em' } },
|
|
6373
|
+
React__default.createElement(
|
|
6374
|
+
Carousel,
|
|
6375
|
+
null,
|
|
6376
|
+
slides && slides.map(function (slide) {
|
|
6377
|
+
return React__default.createElement(
|
|
6378
|
+
Carousel.Item,
|
|
6379
|
+
{ key: slide._key },
|
|
6380
|
+
React__default.createElement('img', { src: urlFor(slide.asset).url(), style: { width: '100%' } })
|
|
6381
|
+
);
|
|
6382
|
+
})
|
|
6383
|
+
)
|
|
6384
|
+
);
|
|
6073
6385
|
};
|
|
6074
6386
|
|
|
6075
|
-
|
|
6387
|
+
var isArray$1 = Array.isArray;
|
|
6388
|
+
var keyList = Object.keys;
|
|
6389
|
+
var hasProp = Object.prototype.hasOwnProperty;
|
|
6390
|
+
|
|
6391
|
+
var fastDeepEqual = function equal(a, b) {
|
|
6392
|
+
if (a === b) return true;
|
|
6393
|
+
|
|
6394
|
+
if (a && b && typeof a == 'object' && typeof b == 'object') {
|
|
6395
|
+
var arrA = isArray$1(a)
|
|
6396
|
+
, arrB = isArray$1(b)
|
|
6397
|
+
, i
|
|
6398
|
+
, length
|
|
6399
|
+
, key;
|
|
6400
|
+
|
|
6401
|
+
if (arrA && arrB) {
|
|
6402
|
+
length = a.length;
|
|
6403
|
+
if (length != b.length) return false;
|
|
6404
|
+
for (i = length; i-- !== 0;)
|
|
6405
|
+
if (!equal(a[i], b[i])) return false;
|
|
6406
|
+
return true;
|
|
6407
|
+
}
|
|
6408
|
+
|
|
6409
|
+
if (arrA != arrB) return false;
|
|
6410
|
+
|
|
6411
|
+
var dateA = a instanceof Date
|
|
6412
|
+
, dateB = b instanceof Date;
|
|
6413
|
+
if (dateA != dateB) return false;
|
|
6414
|
+
if (dateA && dateB) return a.getTime() == b.getTime();
|
|
6415
|
+
|
|
6416
|
+
var regexpA = a instanceof RegExp
|
|
6417
|
+
, regexpB = b instanceof RegExp;
|
|
6418
|
+
if (regexpA != regexpB) return false;
|
|
6419
|
+
if (regexpA && regexpB) return a.toString() == b.toString();
|
|
6420
|
+
|
|
6421
|
+
var keys = keyList(a);
|
|
6422
|
+
length = keys.length;
|
|
6423
|
+
|
|
6424
|
+
if (length !== keyList(b).length)
|
|
6425
|
+
return false;
|
|
6426
|
+
|
|
6427
|
+
for (i = length; i-- !== 0;)
|
|
6428
|
+
if (!hasProp.call(b, keys[i])) return false;
|
|
6429
|
+
|
|
6430
|
+
for (i = length; i-- !== 0;) {
|
|
6431
|
+
key = keys[i];
|
|
6432
|
+
if (!equal(a[key], b[key])) return false;
|
|
6433
|
+
}
|
|
6434
|
+
|
|
6435
|
+
return true;
|
|
6436
|
+
}
|
|
6437
|
+
|
|
6438
|
+
return a!==a && b!==b;
|
|
6439
|
+
};
|
|
6440
|
+
|
|
6441
|
+
var Sister;
|
|
6442
|
+
|
|
6443
|
+
/**
|
|
6444
|
+
* @link https://github.com/gajus/sister for the canonical source repository
|
|
6445
|
+
* @license https://github.com/gajus/sister/blob/master/LICENSE BSD 3-Clause
|
|
6446
|
+
*/
|
|
6447
|
+
Sister = function () {
|
|
6448
|
+
var sister = {},
|
|
6449
|
+
events = {};
|
|
6450
|
+
|
|
6451
|
+
/**
|
|
6452
|
+
* @name handler
|
|
6453
|
+
* @function
|
|
6454
|
+
* @param {Object} data Event data.
|
|
6455
|
+
*/
|
|
6456
|
+
|
|
6457
|
+
/**
|
|
6458
|
+
* @param {String} name Event name.
|
|
6459
|
+
* @param {handler} handler
|
|
6460
|
+
* @return {listener}
|
|
6461
|
+
*/
|
|
6462
|
+
sister.on = function (name, handler) {
|
|
6463
|
+
var listener = {name: name, handler: handler};
|
|
6464
|
+
events[name] = events[name] || [];
|
|
6465
|
+
events[name].unshift(listener);
|
|
6466
|
+
return listener;
|
|
6467
|
+
};
|
|
6468
|
+
|
|
6469
|
+
/**
|
|
6470
|
+
* @param {listener}
|
|
6471
|
+
*/
|
|
6472
|
+
sister.off = function (listener) {
|
|
6473
|
+
var index = events[listener.name].indexOf(listener);
|
|
6474
|
+
|
|
6475
|
+
if (index !== -1) {
|
|
6476
|
+
events[listener.name].splice(index, 1);
|
|
6477
|
+
}
|
|
6478
|
+
};
|
|
6479
|
+
|
|
6480
|
+
/**
|
|
6481
|
+
* @param {String} name Event name.
|
|
6482
|
+
* @param {Object} data Event data.
|
|
6483
|
+
*/
|
|
6484
|
+
sister.trigger = function (name, data) {
|
|
6485
|
+
var listeners = events[name],
|
|
6486
|
+
i;
|
|
6487
|
+
|
|
6488
|
+
if (listeners) {
|
|
6489
|
+
i = listeners.length;
|
|
6490
|
+
while (i--) {
|
|
6491
|
+
listeners[i].handler(data);
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
6494
|
+
};
|
|
6495
|
+
|
|
6496
|
+
return sister;
|
|
6497
|
+
};
|
|
6498
|
+
|
|
6499
|
+
var sister = Sister;
|
|
6500
|
+
|
|
6501
|
+
var loadScript = function load (src, opts, cb) {
|
|
6502
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
6503
|
+
var script = document.createElement('script');
|
|
6504
|
+
|
|
6505
|
+
if (typeof opts === 'function') {
|
|
6506
|
+
cb = opts;
|
|
6507
|
+
opts = {};
|
|
6508
|
+
}
|
|
6509
|
+
|
|
6510
|
+
opts = opts || {};
|
|
6511
|
+
cb = cb || function() {};
|
|
6512
|
+
|
|
6513
|
+
script.type = opts.type || 'text/javascript';
|
|
6514
|
+
script.charset = opts.charset || 'utf8';
|
|
6515
|
+
script.async = 'async' in opts ? !!opts.async : true;
|
|
6516
|
+
script.src = src;
|
|
6517
|
+
|
|
6518
|
+
if (opts.attrs) {
|
|
6519
|
+
setAttributes(script, opts.attrs);
|
|
6520
|
+
}
|
|
6521
|
+
|
|
6522
|
+
if (opts.text) {
|
|
6523
|
+
script.text = '' + opts.text;
|
|
6524
|
+
}
|
|
6525
|
+
|
|
6526
|
+
var onend = 'onload' in script ? stdOnEnd : ieOnEnd;
|
|
6527
|
+
onend(script, cb);
|
|
6528
|
+
|
|
6529
|
+
// some good legacy browsers (firefox) fail the 'in' detection above
|
|
6530
|
+
// so as a fallback we always set onload
|
|
6531
|
+
// old IE will ignore this and new IE will set onload
|
|
6532
|
+
if (!script.onload) {
|
|
6533
|
+
stdOnEnd(script, cb);
|
|
6534
|
+
}
|
|
6535
|
+
|
|
6536
|
+
head.appendChild(script);
|
|
6537
|
+
};
|
|
6538
|
+
|
|
6539
|
+
function setAttributes(script, attrs) {
|
|
6540
|
+
for (var attr in attrs) {
|
|
6541
|
+
script.setAttribute(attr, attrs[attr]);
|
|
6542
|
+
}
|
|
6543
|
+
}
|
|
6544
|
+
|
|
6545
|
+
function stdOnEnd (script, cb) {
|
|
6546
|
+
script.onload = function () {
|
|
6547
|
+
this.onerror = this.onload = null;
|
|
6548
|
+
cb(null, script);
|
|
6549
|
+
};
|
|
6550
|
+
script.onerror = function () {
|
|
6551
|
+
// this.onload = null here is necessary
|
|
6552
|
+
// because even IE9 works not like others
|
|
6553
|
+
this.onerror = this.onload = null;
|
|
6554
|
+
cb(new Error('Failed to load ' + this.src), script);
|
|
6555
|
+
};
|
|
6556
|
+
}
|
|
6557
|
+
|
|
6558
|
+
function ieOnEnd (script, cb) {
|
|
6559
|
+
script.onreadystatechange = function () {
|
|
6560
|
+
if (this.readyState != 'complete' && this.readyState != 'loaded') return
|
|
6561
|
+
this.onreadystatechange = null;
|
|
6562
|
+
cb(null, script); // there is no way to catch loading errors in IE8
|
|
6563
|
+
};
|
|
6564
|
+
}
|
|
6565
|
+
|
|
6566
|
+
var loadYouTubeIframeApi = createCommonjsModule(function (module, exports) {
|
|
6567
|
+
|
|
6568
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6569
|
+
value: true
|
|
6570
|
+
});
|
|
6571
|
+
|
|
6572
|
+
|
|
6573
|
+
|
|
6574
|
+
var _loadScript2 = _interopRequireDefault(loadScript);
|
|
6575
|
+
|
|
6576
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6577
|
+
|
|
6578
|
+
exports.default = function (emitter) {
|
|
6579
|
+
/**
|
|
6580
|
+
* A promise that is resolved when window.onYouTubeIframeAPIReady is called.
|
|
6581
|
+
* The promise is resolved with a reference to window.YT object.
|
|
6582
|
+
*/
|
|
6583
|
+
var iframeAPIReady = new Promise(function (resolve) {
|
|
6584
|
+
if (window.YT && window.YT.Player && window.YT.Player instanceof Function) {
|
|
6585
|
+
resolve(window.YT);
|
|
6586
|
+
|
|
6587
|
+
return;
|
|
6588
|
+
} else {
|
|
6589
|
+
var protocol = window.location.protocol === 'http:' ? 'http:' : 'https:';
|
|
6590
|
+
|
|
6591
|
+
(0, _loadScript2.default)(protocol + '//www.youtube.com/iframe_api', function (error) {
|
|
6592
|
+
if (error) {
|
|
6593
|
+
emitter.trigger('error', error);
|
|
6594
|
+
}
|
|
6595
|
+
});
|
|
6596
|
+
}
|
|
6597
|
+
|
|
6598
|
+
var previous = window.onYouTubeIframeAPIReady;
|
|
6599
|
+
|
|
6600
|
+
// The API will call this function when page has finished downloading
|
|
6601
|
+
// the JavaScript for the player API.
|
|
6602
|
+
window.onYouTubeIframeAPIReady = function () {
|
|
6603
|
+
if (previous) {
|
|
6604
|
+
previous();
|
|
6605
|
+
}
|
|
6606
|
+
|
|
6607
|
+
resolve(window.YT);
|
|
6608
|
+
};
|
|
6609
|
+
});
|
|
6610
|
+
|
|
6611
|
+
return iframeAPIReady;
|
|
6612
|
+
};
|
|
6613
|
+
|
|
6614
|
+
module.exports = exports['default'];
|
|
6076
6615
|
});
|
|
6077
6616
|
|
|
6078
6617
|
unwrapExports(loadYouTubeIframeApi);
|
|
@@ -7455,7 +7994,7 @@ var util = {
|
|
|
7455
7994
|
|
|
7456
7995
|
var require$$2 = {};
|
|
7457
7996
|
|
|
7458
|
-
var node = createCommonjsModule(function (module, exports) {
|
|
7997
|
+
var node$1 = createCommonjsModule(function (module, exports) {
|
|
7459
7998
|
/**
|
|
7460
7999
|
* Module dependencies.
|
|
7461
8000
|
*/
|
|
@@ -7705,14 +8244,14 @@ function init (debug$$1) {
|
|
|
7705
8244
|
|
|
7706
8245
|
exports.enable(load());
|
|
7707
8246
|
});
|
|
7708
|
-
var node_1 = node.init;
|
|
7709
|
-
var node_2 = node.log;
|
|
7710
|
-
var node_3 = node.formatArgs;
|
|
7711
|
-
var node_4 = node.save;
|
|
7712
|
-
var node_5 = node.load;
|
|
7713
|
-
var node_6 = node.useColors;
|
|
7714
|
-
var node_7 = node.colors;
|
|
7715
|
-
var node_8 = node.inspectOpts;
|
|
8247
|
+
var node_1 = node$1.init;
|
|
8248
|
+
var node_2 = node$1.log;
|
|
8249
|
+
var node_3 = node$1.formatArgs;
|
|
8250
|
+
var node_4 = node$1.save;
|
|
8251
|
+
var node_5 = node$1.load;
|
|
8252
|
+
var node_6 = node$1.useColors;
|
|
8253
|
+
var node_7 = node$1.colors;
|
|
8254
|
+
var node_8 = node$1.inspectOpts;
|
|
7716
8255
|
|
|
7717
8256
|
var src = createCommonjsModule(function (module) {
|
|
7718
8257
|
/**
|
|
@@ -7723,7 +8262,7 @@ var src = createCommonjsModule(function (module) {
|
|
|
7723
8262
|
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
|
7724
8263
|
module.exports = browser;
|
|
7725
8264
|
} else {
|
|
7726
|
-
module.exports = node;
|
|
8265
|
+
module.exports = node$1;
|
|
7727
8266
|
}
|
|
7728
8267
|
});
|
|
7729
8268
|
|
|
@@ -8526,579 +9065,42 @@ function shouldUseNative() {
|
|
|
8526
9065
|
return true;
|
|
8527
9066
|
} catch (err) {
|
|
8528
9067
|
// We don't expect any of the above to throw, but better to be safe.
|
|
8529
|
-
return false;
|
|
8530
|
-
}
|
|
8531
|
-
}
|
|
8532
|
-
|
|
8533
|
-
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
8534
|
-
var from;
|
|
8535
|
-
var to = toObject(target);
|
|
8536
|
-
var symbols;
|
|
8537
|
-
|
|
8538
|
-
for (var s = 1; s < arguments.length; s++) {
|
|
8539
|
-
from = Object(arguments[s]);
|
|
8540
|
-
|
|
8541
|
-
for (var key in from) {
|
|
8542
|
-
if (hasOwnProperty$5.call(from, key)) {
|
|
8543
|
-
to[key] = from[key];
|
|
8544
|
-
}
|
|
8545
|
-
}
|
|
8546
|
-
|
|
8547
|
-
if (getOwnPropertySymbols) {
|
|
8548
|
-
symbols = getOwnPropertySymbols(from);
|
|
8549
|
-
for (var i = 0; i < symbols.length; i++) {
|
|
8550
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
|
8551
|
-
to[symbols[i]] = from[symbols[i]];
|
|
8552
|
-
}
|
|
8553
|
-
}
|
|
8554
|
-
}
|
|
8555
|
-
}
|
|
8556
|
-
|
|
8557
|
-
return to;
|
|
8558
|
-
};
|
|
8559
|
-
|
|
8560
|
-
var baseUrl = 'https://docs.sanity.io/help/';
|
|
8561
|
-
|
|
8562
|
-
var generateHelpUrl = function generateHelpUrl(slug) {
|
|
8563
|
-
return baseUrl + slug
|
|
8564
|
-
};
|
|
8565
|
-
|
|
8566
|
-
var parseAssetId_1 = createCommonjsModule(function (module, exports) {
|
|
8567
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8568
|
-
var example = 'image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg';
|
|
8569
|
-
function parseAssetId(ref) {
|
|
8570
|
-
var _a = ref.split('-'), id = _a[1], dimensionString = _a[2], format = _a[3];
|
|
8571
|
-
if (!id || !dimensionString || !format) {
|
|
8572
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
8573
|
-
}
|
|
8574
|
-
var _b = dimensionString.split('x'), imgWidthStr = _b[0], imgHeightStr = _b[1];
|
|
8575
|
-
var width = +imgWidthStr;
|
|
8576
|
-
var height = +imgHeightStr;
|
|
8577
|
-
var isValidAssetId = isFinite(width) && isFinite(height);
|
|
8578
|
-
if (!isValidAssetId) {
|
|
8579
|
-
throw new Error("Malformed asset _ref '" + ref + "'. Expected an id like \"" + example + "\".");
|
|
8580
|
-
}
|
|
8581
|
-
return { id: id, width: width, height: height, format: format };
|
|
8582
|
-
}
|
|
8583
|
-
exports.default = parseAssetId;
|
|
8584
|
-
|
|
8585
|
-
});
|
|
8586
|
-
|
|
8587
|
-
unwrapExports(parseAssetId_1);
|
|
8588
|
-
|
|
8589
|
-
var parseSource_1 = createCommonjsModule(function (module, exports) {
|
|
8590
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
8591
|
-
__assign = Object.assign || function(t) {
|
|
8592
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8593
|
-
s = arguments[i];
|
|
8594
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8595
|
-
t[p] = s[p];
|
|
8596
|
-
}
|
|
8597
|
-
return t;
|
|
8598
|
-
};
|
|
8599
|
-
return __assign.apply(this, arguments);
|
|
8600
|
-
};
|
|
8601
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8602
|
-
var isRef = function (src) {
|
|
8603
|
-
var source = src;
|
|
8604
|
-
return source ? typeof source._ref === 'string' : false;
|
|
8605
|
-
};
|
|
8606
|
-
var isAsset = function (src) {
|
|
8607
|
-
var source = src;
|
|
8608
|
-
return source ? typeof source._id === 'string' : false;
|
|
8609
|
-
};
|
|
8610
|
-
var isAssetStub = function (src) {
|
|
8611
|
-
var source = src;
|
|
8612
|
-
return source && source.asset ? typeof source.asset.url === 'string' : false;
|
|
8613
|
-
};
|
|
8614
|
-
// Convert an asset-id, asset or image to an image record suitable for processing
|
|
8615
|
-
// eslint-disable-next-line complexity
|
|
8616
|
-
function parseSource(source) {
|
|
8617
|
-
if (!source) {
|
|
8618
|
-
return null;
|
|
8619
|
-
}
|
|
8620
|
-
var image;
|
|
8621
|
-
if (typeof source === 'string' && isUrl(source)) {
|
|
8622
|
-
// Someone passed an existing image url?
|
|
8623
|
-
image = {
|
|
8624
|
-
asset: { _ref: urlToId(source) }
|
|
8625
|
-
};
|
|
8626
|
-
}
|
|
8627
|
-
else if (typeof source === 'string') {
|
|
8628
|
-
// Just an asset id
|
|
8629
|
-
image = {
|
|
8630
|
-
asset: { _ref: source }
|
|
8631
|
-
};
|
|
8632
|
-
}
|
|
8633
|
-
else if (isRef(source)) {
|
|
8634
|
-
// We just got passed an asset directly
|
|
8635
|
-
image = {
|
|
8636
|
-
asset: source
|
|
8637
|
-
};
|
|
8638
|
-
}
|
|
8639
|
-
else if (isAsset(source)) {
|
|
8640
|
-
// If we were passed an image asset document
|
|
8641
|
-
image = {
|
|
8642
|
-
asset: {
|
|
8643
|
-
_ref: source._id || ''
|
|
8644
|
-
}
|
|
8645
|
-
};
|
|
8646
|
-
}
|
|
8647
|
-
else if (isAssetStub(source)) {
|
|
8648
|
-
// If we were passed a partial asset (`url`, but no `_id`)
|
|
8649
|
-
image = {
|
|
8650
|
-
asset: {
|
|
8651
|
-
_ref: urlToId(source.asset.url)
|
|
8652
|
-
}
|
|
8653
|
-
};
|
|
8654
|
-
}
|
|
8655
|
-
else if (typeof source.asset === 'object') {
|
|
8656
|
-
// Probably an actual image with materialized asset
|
|
8657
|
-
image = source;
|
|
8658
|
-
}
|
|
8659
|
-
else {
|
|
8660
|
-
// We got something that does not look like an image, or it is an image
|
|
8661
|
-
// that currently isn't sporting an asset.
|
|
8662
|
-
return null;
|
|
8663
|
-
}
|
|
8664
|
-
var img = source;
|
|
8665
|
-
if (img.crop) {
|
|
8666
|
-
image.crop = img.crop;
|
|
8667
|
-
}
|
|
8668
|
-
if (img.hotspot) {
|
|
8669
|
-
image.hotspot = img.hotspot;
|
|
8670
|
-
}
|
|
8671
|
-
return applyDefaults(image);
|
|
8672
|
-
}
|
|
8673
|
-
exports.default = parseSource;
|
|
8674
|
-
function isUrl(url) {
|
|
8675
|
-
return /^https?:\/\//.test("" + url);
|
|
8676
|
-
}
|
|
8677
|
-
function urlToId(url) {
|
|
8678
|
-
var parts = url.split('/').slice(-1);
|
|
8679
|
-
return ("image-" + parts[0]).replace(/\.([a-z]+)$/, '-$1');
|
|
8680
|
-
}
|
|
8681
|
-
// Mock crop and hotspot if image lacks it
|
|
8682
|
-
function applyDefaults(image) {
|
|
8683
|
-
if (image.crop && image.hotspot) {
|
|
8684
|
-
return image;
|
|
8685
|
-
}
|
|
8686
|
-
// We need to pad in default values for crop or hotspot
|
|
8687
|
-
var result = __assign({}, image);
|
|
8688
|
-
if (!result.crop) {
|
|
8689
|
-
result.crop = {
|
|
8690
|
-
left: 0,
|
|
8691
|
-
top: 0,
|
|
8692
|
-
bottom: 0,
|
|
8693
|
-
right: 0
|
|
8694
|
-
};
|
|
8695
|
-
}
|
|
8696
|
-
if (!result.hotspot) {
|
|
8697
|
-
result.hotspot = {
|
|
8698
|
-
x: 0.5,
|
|
8699
|
-
y: 0.5,
|
|
8700
|
-
height: 1.0,
|
|
8701
|
-
width: 1.0
|
|
8702
|
-
};
|
|
8703
|
-
}
|
|
8704
|
-
return result;
|
|
8705
|
-
}
|
|
8706
|
-
|
|
8707
|
-
});
|
|
8708
|
-
|
|
8709
|
-
unwrapExports(parseSource_1);
|
|
8710
|
-
|
|
8711
|
-
var urlForImage_1 = createCommonjsModule(function (module, exports) {
|
|
8712
|
-
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
|
|
8713
|
-
__assign = Object.assign || function(t) {
|
|
8714
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8715
|
-
s = arguments[i];
|
|
8716
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8717
|
-
t[p] = s[p];
|
|
8718
|
-
}
|
|
8719
|
-
return t;
|
|
8720
|
-
};
|
|
8721
|
-
return __assign.apply(this, arguments);
|
|
8722
|
-
};
|
|
8723
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
8724
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8725
|
-
};
|
|
8726
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8727
|
-
var parseAssetId_1$$1 = __importDefault(parseAssetId_1);
|
|
8728
|
-
var parseSource_1$$1 = __importDefault(parseSource_1);
|
|
8729
|
-
exports.parseSource = parseSource_1$$1.default;
|
|
8730
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
8731
|
-
['width', 'w'],
|
|
8732
|
-
['height', 'h'],
|
|
8733
|
-
['format', 'fm'],
|
|
8734
|
-
['download', 'dl'],
|
|
8735
|
-
['blur', 'blur'],
|
|
8736
|
-
['sharpen', 'sharp'],
|
|
8737
|
-
['invert', 'invert'],
|
|
8738
|
-
['orientation', 'or'],
|
|
8739
|
-
['minHeight', 'min-h'],
|
|
8740
|
-
['maxHeight', 'max-h'],
|
|
8741
|
-
['minWidth', 'min-w'],
|
|
8742
|
-
['maxWidth', 'max-w'],
|
|
8743
|
-
['quality', 'q'],
|
|
8744
|
-
['fit', 'fit'],
|
|
8745
|
-
['crop', 'crop'],
|
|
8746
|
-
['auto', 'auto'],
|
|
8747
|
-
['dpr', 'dpr']
|
|
8748
|
-
];
|
|
8749
|
-
function urlForImage(options) {
|
|
8750
|
-
var spec = __assign({}, (options || {}));
|
|
8751
|
-
var source = spec.source;
|
|
8752
|
-
delete spec.source;
|
|
8753
|
-
var image = parseSource_1$$1.default(source);
|
|
8754
|
-
if (!image) {
|
|
8755
|
-
return null;
|
|
8756
|
-
}
|
|
8757
|
-
var id = image.asset._ref || image.asset._id || '';
|
|
8758
|
-
var asset = parseAssetId_1$$1.default(id);
|
|
8759
|
-
// Compute crop rect in terms of pixel coordinates in the raw source image
|
|
8760
|
-
var cropLeft = Math.round(image.crop.left * asset.width);
|
|
8761
|
-
var cropTop = Math.round(image.crop.top * asset.height);
|
|
8762
|
-
var crop = {
|
|
8763
|
-
left: cropLeft,
|
|
8764
|
-
top: cropTop,
|
|
8765
|
-
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
8766
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
8767
|
-
};
|
|
8768
|
-
// Compute hot spot rect in terms of pixel coordinates
|
|
8769
|
-
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
8770
|
-
var hotSpotHorizontalRadius = (image.hotspot.width * asset.width) / 2;
|
|
8771
|
-
var hotSpotCenterX = image.hotspot.x * asset.width;
|
|
8772
|
-
var hotSpotCenterY = image.hotspot.y * asset.height;
|
|
8773
|
-
var hotspot = {
|
|
8774
|
-
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
8775
|
-
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
8776
|
-
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
8777
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
8778
|
-
};
|
|
8779
|
-
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
8780
|
-
// the crop/hotspot.
|
|
8781
|
-
if (!(spec.rect || spec.focalPoint || spec.ignoreImageParams || spec.crop)) {
|
|
8782
|
-
spec = __assign({}, spec, fit({ crop: crop, hotspot: hotspot }, spec));
|
|
8783
|
-
}
|
|
8784
|
-
return specToImageUrl(__assign({}, spec, { asset: asset }));
|
|
8785
|
-
}
|
|
8786
|
-
exports.default = urlForImage;
|
|
8787
|
-
// eslint-disable-next-line complexity
|
|
8788
|
-
function specToImageUrl(spec) {
|
|
8789
|
-
var cdnUrl = spec.baseUrl || 'https://cdn.sanity.io';
|
|
8790
|
-
var filename = spec.asset.id + "-" + spec.asset.width + "x" + spec.asset.height + "." + spec.asset.format;
|
|
8791
|
-
var baseUrl = cdnUrl + "/images/" + spec.projectId + "/" + spec.dataset + "/" + filename;
|
|
8792
|
-
var params = [];
|
|
8793
|
-
if (spec.rect) {
|
|
8794
|
-
// Only bother url with a crop if it actually crops anything
|
|
8795
|
-
var _a = spec.rect, left = _a.left, top_1 = _a.top, width = _a.width, height = _a.height;
|
|
8796
|
-
var isEffectiveCrop = left !== 0 || top_1 !== 0 || height !== spec.asset.height || width !== spec.asset.width;
|
|
8797
|
-
if (isEffectiveCrop) {
|
|
8798
|
-
params.push("rect=" + left + "," + top_1 + "," + width + "," + height);
|
|
8799
|
-
}
|
|
8800
|
-
}
|
|
8801
|
-
if (spec.bg) {
|
|
8802
|
-
params.push("bg=" + spec.bg);
|
|
8803
|
-
}
|
|
8804
|
-
if (spec.focalPoint) {
|
|
8805
|
-
params.push("fp-x=" + spec.focalPoint.x);
|
|
8806
|
-
params.push("fp-x=" + spec.focalPoint.y);
|
|
8807
|
-
}
|
|
8808
|
-
var flip = [spec.flipHorizontal && 'h', spec.flipVertical && 'v'].filter(Boolean).join('');
|
|
8809
|
-
if (flip) {
|
|
8810
|
-
params.push("flip=" + flip);
|
|
8811
|
-
}
|
|
8812
|
-
// Map from spec name to url param name, and allow using the actual param name as an alternative
|
|
8813
|
-
exports.SPEC_NAME_TO_URL_NAME_MAPPINGS.forEach(function (mapping) {
|
|
8814
|
-
var specName = mapping[0], param = mapping[1];
|
|
8815
|
-
if (typeof spec[specName] !== 'undefined') {
|
|
8816
|
-
params.push(param + "=" + encodeURIComponent(spec[specName]));
|
|
8817
|
-
}
|
|
8818
|
-
else if (typeof spec[param] !== 'undefined') {
|
|
8819
|
-
params.push(param + "=" + encodeURIComponent(spec[param]));
|
|
8820
|
-
}
|
|
8821
|
-
});
|
|
8822
|
-
if (params.length === 0) {
|
|
8823
|
-
return baseUrl;
|
|
8824
|
-
}
|
|
8825
|
-
return baseUrl + "?" + params.join('&');
|
|
8826
|
-
}
|
|
8827
|
-
function fit(source, spec) {
|
|
8828
|
-
var cropRect;
|
|
8829
|
-
var imgWidth = spec.width;
|
|
8830
|
-
var imgHeight = spec.height;
|
|
8831
|
-
// If we are not constraining the aspect ratio, we'll just use the whole crop
|
|
8832
|
-
if (!(imgWidth && imgHeight)) {
|
|
8833
|
-
return { width: imgWidth, height: imgHeight, rect: source.crop };
|
|
8834
|
-
}
|
|
8835
|
-
var crop = source.crop;
|
|
8836
|
-
var hotspot = source.hotspot;
|
|
8837
|
-
// If we are here, that means aspect ratio is locked and fitting will be a bit harder
|
|
8838
|
-
var desiredAspectRatio = imgWidth / imgHeight;
|
|
8839
|
-
var cropAspectRatio = crop.width / crop.height;
|
|
8840
|
-
if (cropAspectRatio > desiredAspectRatio) {
|
|
8841
|
-
// The crop is wider than the desired aspect ratio. That means we are cutting from the sides
|
|
8842
|
-
var height = crop.height;
|
|
8843
|
-
var width = height * desiredAspectRatio;
|
|
8844
|
-
var top_2 = crop.top;
|
|
8845
|
-
// Center output horizontally over hotspot
|
|
8846
|
-
var hotspotXCenter = (hotspot.right - hotspot.left) / 2 + hotspot.left;
|
|
8847
|
-
var left = hotspotXCenter - width / 2;
|
|
8848
|
-
// Keep output within crop
|
|
8849
|
-
if (left < crop.left) {
|
|
8850
|
-
left = crop.left;
|
|
8851
|
-
}
|
|
8852
|
-
else if (left + width > crop.left + crop.width) {
|
|
8853
|
-
left = crop.left + crop.width - width;
|
|
8854
|
-
}
|
|
8855
|
-
cropRect = {
|
|
8856
|
-
left: Math.round(left),
|
|
8857
|
-
top: Math.round(top_2),
|
|
8858
|
-
width: Math.round(width),
|
|
8859
|
-
height: Math.round(height)
|
|
8860
|
-
};
|
|
8861
|
-
}
|
|
8862
|
-
else {
|
|
8863
|
-
// The crop is taller than the desired ratio, we are cutting from top and bottom
|
|
8864
|
-
var width = crop.width;
|
|
8865
|
-
var height = width / desiredAspectRatio;
|
|
8866
|
-
var left = crop.left;
|
|
8867
|
-
// Center output vertically over hotspot
|
|
8868
|
-
var hotspotYCenter = (hotspot.bottom - hotspot.top) / 2 + hotspot.top;
|
|
8869
|
-
var top_3 = hotspotYCenter - height / 2;
|
|
8870
|
-
// Keep output rect within crop
|
|
8871
|
-
if (top_3 < crop.top) {
|
|
8872
|
-
top_3 = crop.top;
|
|
8873
|
-
}
|
|
8874
|
-
else if (top_3 + height > crop.top + crop.height) {
|
|
8875
|
-
top_3 = crop.top + crop.height - height;
|
|
8876
|
-
}
|
|
8877
|
-
cropRect = {
|
|
8878
|
-
left: Math.max(0, Math.floor(left)),
|
|
8879
|
-
top: Math.max(0, Math.floor(top_3)),
|
|
8880
|
-
width: Math.round(width),
|
|
8881
|
-
height: Math.round(height)
|
|
8882
|
-
};
|
|
8883
|
-
}
|
|
8884
|
-
return {
|
|
8885
|
-
width: imgWidth,
|
|
8886
|
-
height: imgHeight,
|
|
8887
|
-
rect: cropRect
|
|
8888
|
-
};
|
|
9068
|
+
return false;
|
|
9069
|
+
}
|
|
8889
9070
|
}
|
|
8890
9071
|
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
var
|
|
8895
|
-
var urlForImage_3 = urlForImage_1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
9072
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
9073
|
+
var from;
|
|
9074
|
+
var to = toObject(target);
|
|
9075
|
+
var symbols;
|
|
8896
9076
|
|
|
8897
|
-
var
|
|
8898
|
-
|
|
8899
|
-
__assign = Object.assign || function(t) {
|
|
8900
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8901
|
-
s = arguments[i];
|
|
8902
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8903
|
-
t[p] = s[p];
|
|
8904
|
-
}
|
|
8905
|
-
return t;
|
|
8906
|
-
};
|
|
8907
|
-
return __assign.apply(this, arguments);
|
|
8908
|
-
};
|
|
8909
|
-
var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
|
|
8910
|
-
if (mod && mod.__esModule) return mod;
|
|
8911
|
-
var result = {};
|
|
8912
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
8913
|
-
result["default"] = mod;
|
|
8914
|
-
return result;
|
|
8915
|
-
};
|
|
8916
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8917
|
-
var urlForImage_1$$1 = __importStar(urlForImage_1);
|
|
8918
|
-
var validFits = ['clip', 'crop', 'fill', 'fillmax', 'max', 'scale', 'min'];
|
|
8919
|
-
var validCrops = ['top', 'bottom', 'left', 'right', 'center', 'focalpoint', 'entropy'];
|
|
8920
|
-
var validAutoModes = ['format'];
|
|
8921
|
-
function isSanityClient(client) {
|
|
8922
|
-
return client ? typeof client.clientConfig === 'object' : false;
|
|
8923
|
-
}
|
|
8924
|
-
function rewriteSpecName(key) {
|
|
8925
|
-
var specs = urlForImage_1$$1.SPEC_NAME_TO_URL_NAME_MAPPINGS;
|
|
8926
|
-
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
|
|
8927
|
-
var entry = specs_1[_i];
|
|
8928
|
-
var specName = entry[0], param = entry[1];
|
|
8929
|
-
if (key === specName || key === param) {
|
|
8930
|
-
return specName;
|
|
8931
|
-
}
|
|
8932
|
-
}
|
|
8933
|
-
return key;
|
|
8934
|
-
}
|
|
8935
|
-
function urlBuilder(options) {
|
|
8936
|
-
// Did we get a SanityClient?
|
|
8937
|
-
var client = options;
|
|
8938
|
-
if (isSanityClient(client)) {
|
|
8939
|
-
// Inherit config from client
|
|
8940
|
-
var _a = client.clientConfig, apiHost = _a.apiHost, projectId = _a.projectId, dataset = _a.dataset;
|
|
8941
|
-
return new ImageUrlBuilder(null, {
|
|
8942
|
-
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
8943
|
-
projectId: projectId,
|
|
8944
|
-
dataset: dataset
|
|
8945
|
-
});
|
|
8946
|
-
}
|
|
8947
|
-
// Or just accept the options as given
|
|
8948
|
-
return new ImageUrlBuilder(null, options);
|
|
8949
|
-
}
|
|
8950
|
-
exports.default = urlBuilder;
|
|
8951
|
-
var ImageUrlBuilder = /** @class */ (function () {
|
|
8952
|
-
function ImageUrlBuilder(parent, options) {
|
|
8953
|
-
this.options = parent
|
|
8954
|
-
? __assign({}, (parent.options || {}), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
8955
|
-
}
|
|
8956
|
-
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
8957
|
-
var baseUrl = options.baseUrl || '';
|
|
8958
|
-
var newOptions = { baseUrl: baseUrl };
|
|
8959
|
-
for (var key in options) {
|
|
8960
|
-
if (options.hasOwnProperty(key)) {
|
|
8961
|
-
var specKey = rewriteSpecName(key);
|
|
8962
|
-
newOptions[specKey] = options[key];
|
|
8963
|
-
}
|
|
8964
|
-
}
|
|
8965
|
-
return new ImageUrlBuilder(this, __assign({ baseUrl: baseUrl }, newOptions));
|
|
8966
|
-
};
|
|
8967
|
-
// The image to be represented. Accepts a Sanity 'image'-document, 'asset'-document or
|
|
8968
|
-
// _id of asset. To get the benefit of automatic hot-spot/crop integration with the content
|
|
8969
|
-
// studio, the 'image'-document must be provided.
|
|
8970
|
-
ImageUrlBuilder.prototype.image = function (source) {
|
|
8971
|
-
return this.withOptions({ source: source });
|
|
8972
|
-
};
|
|
8973
|
-
// Specify the dataset
|
|
8974
|
-
ImageUrlBuilder.prototype.dataset = function (dataset) {
|
|
8975
|
-
return this.withOptions({ dataset: dataset });
|
|
8976
|
-
};
|
|
8977
|
-
// Specify the projectId
|
|
8978
|
-
ImageUrlBuilder.prototype.projectId = function (projectId) {
|
|
8979
|
-
return this.withOptions({ projectId: projectId });
|
|
8980
|
-
};
|
|
8981
|
-
// Specify background color
|
|
8982
|
-
ImageUrlBuilder.prototype.bg = function (bg) {
|
|
8983
|
-
return this.withOptions({ bg: bg });
|
|
8984
|
-
};
|
|
8985
|
-
// Set DPR scaling factor
|
|
8986
|
-
ImageUrlBuilder.prototype.dpr = function (dpr) {
|
|
8987
|
-
return this.withOptions({ dpr: dpr });
|
|
8988
|
-
};
|
|
8989
|
-
// Specify the width of the image in pixels
|
|
8990
|
-
ImageUrlBuilder.prototype.width = function (width) {
|
|
8991
|
-
return this.withOptions({ width: width });
|
|
8992
|
-
};
|
|
8993
|
-
// Specify the height of the image in pixels
|
|
8994
|
-
ImageUrlBuilder.prototype.height = function (height) {
|
|
8995
|
-
return this.withOptions({ height: height });
|
|
8996
|
-
};
|
|
8997
|
-
// Specify focal point in fraction of image dimensions. Each component 0.0-1.0
|
|
8998
|
-
ImageUrlBuilder.prototype.focalPoint = function (x, y) {
|
|
8999
|
-
return this.withOptions({ focalPoint: { x: x, y: y } });
|
|
9000
|
-
};
|
|
9001
|
-
ImageUrlBuilder.prototype.maxWidth = function (maxWidth) {
|
|
9002
|
-
return this.withOptions({ maxWidth: maxWidth });
|
|
9003
|
-
};
|
|
9004
|
-
ImageUrlBuilder.prototype.minWidth = function (minWidth) {
|
|
9005
|
-
return this.withOptions({ minWidth: minWidth });
|
|
9006
|
-
};
|
|
9007
|
-
ImageUrlBuilder.prototype.maxHeight = function (maxHeight) {
|
|
9008
|
-
return this.withOptions({ maxHeight: maxHeight });
|
|
9009
|
-
};
|
|
9010
|
-
ImageUrlBuilder.prototype.minHeight = function (minHeight) {
|
|
9011
|
-
return this.withOptions({ minHeight: minHeight });
|
|
9012
|
-
};
|
|
9013
|
-
// Specify width and height in pixels
|
|
9014
|
-
ImageUrlBuilder.prototype.size = function (width, height) {
|
|
9015
|
-
return this.withOptions({ width: width, height: height });
|
|
9016
|
-
};
|
|
9017
|
-
// Specify blur between 0 and 100
|
|
9018
|
-
ImageUrlBuilder.prototype.blur = function (blur) {
|
|
9019
|
-
return this.withOptions({ blur: blur });
|
|
9020
|
-
};
|
|
9021
|
-
ImageUrlBuilder.prototype.sharpen = function (sharpen) {
|
|
9022
|
-
return this.withOptions({ sharpen: sharpen });
|
|
9023
|
-
};
|
|
9024
|
-
// Specify the desired rectangle of the image
|
|
9025
|
-
ImageUrlBuilder.prototype.rect = function (left, top, width, height) {
|
|
9026
|
-
return this.withOptions({ rect: { left: left, top: top, width: width, height: height } });
|
|
9027
|
-
};
|
|
9028
|
-
// Specify the image format of the image. 'jpg', 'pjpg', 'png', 'webp'
|
|
9029
|
-
ImageUrlBuilder.prototype.format = function (format) {
|
|
9030
|
-
return this.withOptions({ format: format });
|
|
9031
|
-
};
|
|
9032
|
-
ImageUrlBuilder.prototype.invert = function (invert) {
|
|
9033
|
-
return this.withOptions({ invert: invert });
|
|
9034
|
-
};
|
|
9035
|
-
// Rotation in degrees 0, 90, 180, 270
|
|
9036
|
-
ImageUrlBuilder.prototype.orientation = function (orientation) {
|
|
9037
|
-
return this.withOptions({ orientation: orientation });
|
|
9038
|
-
};
|
|
9039
|
-
// Compression quality 0-100
|
|
9040
|
-
ImageUrlBuilder.prototype.quality = function (quality) {
|
|
9041
|
-
return this.withOptions({ quality: quality });
|
|
9042
|
-
};
|
|
9043
|
-
// Make it a download link. Parameter is default filename.
|
|
9044
|
-
ImageUrlBuilder.prototype.forceDownload = function (download) {
|
|
9045
|
-
return this.withOptions({ download: download });
|
|
9046
|
-
};
|
|
9047
|
-
// Flip image horizontally
|
|
9048
|
-
ImageUrlBuilder.prototype.flipHorizontal = function () {
|
|
9049
|
-
return this.withOptions({ flipHorizontal: true });
|
|
9050
|
-
};
|
|
9051
|
-
// Flip image verically
|
|
9052
|
-
ImageUrlBuilder.prototype.flipVertical = function () {
|
|
9053
|
-
return this.withOptions({ flipVertical: true });
|
|
9054
|
-
};
|
|
9055
|
-
// Ignore crop/hotspot from image record, even when present
|
|
9056
|
-
ImageUrlBuilder.prototype.ignoreImageParams = function () {
|
|
9057
|
-
return this.withOptions({ ignoreImageParams: true });
|
|
9058
|
-
};
|
|
9059
|
-
ImageUrlBuilder.prototype.fit = function (value) {
|
|
9060
|
-
if (validFits.indexOf(value) === -1) {
|
|
9061
|
-
throw new Error("Invalid fit mode \"" + value + "\"");
|
|
9062
|
-
}
|
|
9063
|
-
return this.withOptions({ fit: value });
|
|
9064
|
-
};
|
|
9065
|
-
ImageUrlBuilder.prototype.crop = function (value) {
|
|
9066
|
-
if (validCrops.indexOf(value) === -1) {
|
|
9067
|
-
throw new Error("Invalid crop mode \"" + value + "\"");
|
|
9068
|
-
}
|
|
9069
|
-
return this.withOptions({ crop: value });
|
|
9070
|
-
};
|
|
9071
|
-
ImageUrlBuilder.prototype.auto = function (value) {
|
|
9072
|
-
if (validAutoModes.indexOf(value) === -1) {
|
|
9073
|
-
throw new Error("Invalid auto mode \"" + value + "\"");
|
|
9074
|
-
}
|
|
9075
|
-
return this.withOptions({ auto: value });
|
|
9076
|
-
};
|
|
9077
|
-
// Gets the url based on the submitted parameters
|
|
9078
|
-
ImageUrlBuilder.prototype.url = function () {
|
|
9079
|
-
return urlForImage_1$$1.default(this.options);
|
|
9080
|
-
};
|
|
9081
|
-
// Synonym for url()
|
|
9082
|
-
ImageUrlBuilder.prototype.toString = function () {
|
|
9083
|
-
return this.url();
|
|
9084
|
-
};
|
|
9085
|
-
return ImageUrlBuilder;
|
|
9086
|
-
}());
|
|
9077
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
9078
|
+
from = Object(arguments[s]);
|
|
9087
9079
|
|
|
9088
|
-
|
|
9080
|
+
for (var key in from) {
|
|
9081
|
+
if (hasOwnProperty$5.call(from, key)) {
|
|
9082
|
+
to[key] = from[key];
|
|
9083
|
+
}
|
|
9084
|
+
}
|
|
9089
9085
|
|
|
9090
|
-
|
|
9086
|
+
if (getOwnPropertySymbols) {
|
|
9087
|
+
symbols = getOwnPropertySymbols(from);
|
|
9088
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
9089
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
9090
|
+
to[symbols[i]] = from[symbols[i]];
|
|
9091
|
+
}
|
|
9092
|
+
}
|
|
9093
|
+
}
|
|
9094
|
+
}
|
|
9091
9095
|
|
|
9092
|
-
|
|
9093
|
-
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
9094
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9096
|
+
return to;
|
|
9095
9097
|
};
|
|
9096
|
-
var builder_1 = __importDefault(builder);
|
|
9097
|
-
module.exports = builder_1.default;
|
|
9098
9098
|
|
|
9099
|
-
|
|
9099
|
+
var baseUrl = 'https://docs.sanity.io/help/';
|
|
9100
9100
|
|
|
9101
|
-
|
|
9101
|
+
var generateHelpUrl = function generateHelpUrl(slug) {
|
|
9102
|
+
return baseUrl + slug
|
|
9103
|
+
};
|
|
9102
9104
|
|
|
9103
9105
|
var enc = encodeURIComponent;
|
|
9104
9106
|
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'));
|
|
@@ -9118,11 +9120,11 @@ var getQueryString = function getQueryString(options) {
|
|
|
9118
9120
|
};
|
|
9119
9121
|
|
|
9120
9122
|
var buildUrl = function buildUrl(props) {
|
|
9121
|
-
var node = props.node,
|
|
9123
|
+
var node$$1 = props.node,
|
|
9122
9124
|
options = props.options;
|
|
9123
9125
|
var projectId = options.projectId,
|
|
9124
9126
|
dataset = options.dataset;
|
|
9125
|
-
var asset = node.asset;
|
|
9127
|
+
var asset = node$$1.asset;
|
|
9126
9128
|
|
|
9127
9129
|
if (!asset) {
|
|
9128
9130
|
throw new Error('Image does not have required `asset` property');
|
|
@@ -9142,10 +9144,10 @@ var buildUrl = function buildUrl(props) {
|
|
|
9142
9144
|
throw new Error('Invalid image reference in block, no `_ref` found on `asset`');
|
|
9143
9145
|
}
|
|
9144
9146
|
|
|
9145
|
-
return node
|
|
9147
|
+
return node(objectAssign({
|
|
9146
9148
|
projectId: projectId,
|
|
9147
9149
|
dataset: dataset
|
|
9148
|
-
}, options.imageOptions || {})).image(node).toString();
|
|
9150
|
+
}, options.imageOptions || {})).image(node$$1).toString();
|
|
9149
9151
|
};
|
|
9150
9152
|
|
|
9151
9153
|
var getImageUrl = buildUrl;
|
|
@@ -9915,7 +9917,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
9915
9917
|
|
|
9916
9918
|
return React__default.createElement(
|
|
9917
9919
|
Card$1,
|
|
9918
|
-
{
|
|
9920
|
+
{ className: 'sidebar' },
|
|
9919
9921
|
React__default.createElement(
|
|
9920
9922
|
Card$1.Body,
|
|
9921
9923
|
null,
|
|
@@ -9929,6 +9931,61 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
9929
9931
|
);
|
|
9930
9932
|
};
|
|
9931
9933
|
|
|
9934
|
+
var TableShow = function TableShow(_ref) {
|
|
9935
|
+
var rows = _ref.rows;
|
|
9936
|
+
|
|
9937
|
+
return React__default.createElement(
|
|
9938
|
+
Table,
|
|
9939
|
+
{ bordered: true, hover: true, responsive: true },
|
|
9940
|
+
React__default.createElement(
|
|
9941
|
+
'tbody',
|
|
9942
|
+
null,
|
|
9943
|
+
rows && rows.map(function (row) {
|
|
9944
|
+
return React__default.createElement(
|
|
9945
|
+
'tr',
|
|
9946
|
+
{ key: row._key },
|
|
9947
|
+
row.cells && row.cells.map(function (cell, index) {
|
|
9948
|
+
return React__default.createElement(
|
|
9949
|
+
'td',
|
|
9950
|
+
{ key: index },
|
|
9951
|
+
cell
|
|
9952
|
+
);
|
|
9953
|
+
})
|
|
9954
|
+
);
|
|
9955
|
+
})
|
|
9956
|
+
)
|
|
9957
|
+
);
|
|
9958
|
+
};
|
|
9959
|
+
|
|
9960
|
+
var Media$1 = function Media$$1(_ref) {
|
|
9961
|
+
var uploadDoc = _ref.uploadDoc,
|
|
9962
|
+
poster = _ref.poster,
|
|
9963
|
+
client = _ref.client,
|
|
9964
|
+
blank = _ref.blank,
|
|
9965
|
+
caption = _ref.caption;
|
|
9966
|
+
|
|
9967
|
+
var builder = imageUrlBuilder(client);
|
|
9968
|
+
|
|
9969
|
+
var urlFor = function urlFor(source) {
|
|
9970
|
+
return builder.image(source);
|
|
9971
|
+
};
|
|
9972
|
+
|
|
9973
|
+
return React__default.createElement(
|
|
9974
|
+
Figure,
|
|
9975
|
+
null,
|
|
9976
|
+
uploadDoc ? React__default.createElement(
|
|
9977
|
+
'a',
|
|
9978
|
+
{ href: urlFor(poster.asset).url(), target: blank ? '_blank' : '_self' },
|
|
9979
|
+
React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() })
|
|
9980
|
+
) : React__default.createElement(Figure.Image, { src: urlFor(poster.asset).url() }),
|
|
9981
|
+
caption && React__default.createElement(
|
|
9982
|
+
Figure.Caption,
|
|
9983
|
+
null,
|
|
9984
|
+
caption
|
|
9985
|
+
)
|
|
9986
|
+
);
|
|
9987
|
+
};
|
|
9988
|
+
|
|
9932
9989
|
var getSerializers$1 = function getSerializers(client) {
|
|
9933
9990
|
return {
|
|
9934
9991
|
types: {
|
|
@@ -9943,13 +10000,13 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
9943
10000
|
var asset = node.asset,
|
|
9944
10001
|
caption = node.caption;
|
|
9945
10002
|
|
|
9946
|
-
return React__default.createElement(FigureComponent, { caption: caption, asset: asset });
|
|
10003
|
+
return React__default.createElement(FigureComponent, { caption: caption, asset: asset, client: client });
|
|
9947
10004
|
},
|
|
9948
10005
|
slideshow: function slideshow(_ref3) {
|
|
9949
10006
|
var node = _ref3.node;
|
|
9950
10007
|
var slides = node.slides;
|
|
9951
10008
|
|
|
9952
|
-
return React__default.createElement(Slideshow, { slides: slides });
|
|
10009
|
+
return React__default.createElement(Slideshow, { slides: slides, client: client });
|
|
9953
10010
|
},
|
|
9954
10011
|
sidebar: function sidebar(_ref4) {
|
|
9955
10012
|
var node = _ref4.node;
|
|
@@ -9957,10 +10014,25 @@ var getSerializers$1 = function getSerializers(client) {
|
|
|
9957
10014
|
content = node.content;
|
|
9958
10015
|
|
|
9959
10016
|
return React__default.createElement(Sidebar, { caption: caption, content: content });
|
|
10017
|
+
},
|
|
10018
|
+
table: function table(_ref5) {
|
|
10019
|
+
var node = _ref5.node;
|
|
10020
|
+
var rows = node.rows;
|
|
10021
|
+
|
|
10022
|
+
return React__default.createElement(TableShow, { rows: rows });
|
|
10023
|
+
},
|
|
10024
|
+
media: function media(_ref6) {
|
|
10025
|
+
var node = _ref6.node;
|
|
10026
|
+
var upload_doc = node.upload_doc,
|
|
10027
|
+
poster = node.poster,
|
|
10028
|
+
caption = node.caption,
|
|
10029
|
+
blank = node.blank;
|
|
10030
|
+
|
|
10031
|
+
return React__default.createElement(Media$1, { uploadDoc: upload_doc, poster: poster, blank: blank, client: client, caption: caption });
|
|
9960
10032
|
}
|
|
9961
10033
|
}
|
|
9962
10034
|
};
|
|
9963
10035
|
};
|
|
9964
10036
|
|
|
9965
|
-
export { DeckContent, DeckQueue, ThumbnailCard, TaxonomyCard, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal,
|
|
10037
|
+
export { DeckContent, DeckQueue, ThumbnailCard, TaxonomyCard, Column1, Column2, Column3, Header, LeftNav, AccordionPanel, NavMagazine, NavNative, NavNormal, NavDvm, TemplateNormal, AD300x250, AD300x250x600, AD728x90, getSerializers$1 as getSerializers, Search$1 as Search };
|
|
9966
10038
|
//# sourceMappingURL=index.es.js.map
|