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