@mjhls/mjh-framework 1.0.221 → 1.0.223
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 +174 -174
- package/dist/cjs/AdSlot-d87cef08.js +69 -0
- package/dist/cjs/DeckContent.js +116 -59
- package/dist/cjs/DeckQueue.js +3 -3
- package/dist/cjs/{Dfp-c4f1f12a.js → Dfp-8b6f25fe.js} +1 -1
- package/dist/cjs/{GridContent-089aa22c.js → GridContent-8b0ebfec.js} +26 -10
- package/dist/cjs/GridContent.js +5 -4
- package/dist/cjs/IssueContentDeck.js +1 -1
- package/dist/cjs/IssueDeck.js +1 -1
- package/dist/cjs/MasterDeck.js +11 -11
- package/dist/cjs/{Normal-47d9e184.js → Normal-78631b6e.js} +78 -93
- package/dist/cjs/PublicationDeck.js +1 -1
- package/dist/cjs/QueueDeckExpanded.js +6 -5
- package/dist/cjs/{TaxonomyCard-d97685e2.js → TaxonomyCard-f24d8ec9.js} +1 -1
- package/dist/cjs/TaxonomyCard.js +2 -2
- package/dist/cjs/TemplateNormal.js +3 -2
- package/dist/cjs/ThumbnailCard.js +1 -1
- package/dist/cjs/VideoSeriesListing.js +2 -2
- package/dist/cjs/{YoutubeGroup-ad994d02.js → YoutubeGroup-d2d9e57c.js} +4 -4
- package/dist/cjs/YoutubeGroup.js +1 -1
- package/dist/cjs/{index-a4c53ff4.js → index-eb596973.js} +18 -18
- package/dist/cjs/index.js +203 -182
- package/dist/cjs/{main-58839f4e.js → main-c1bd47fe.js} +6 -6
- package/dist/cjs/{visibility-sensor-bea3105d.js → visibility-sensor-59b2685c.js} +2501 -1437
- package/dist/esm/AdSlot-b67f8534.js +64 -0
- package/dist/esm/DeckContent.js +116 -59
- package/dist/esm/DeckQueue.js +3 -3
- package/dist/esm/{Dfp-6731ac01.js → Dfp-6c8d69e6.js} +1 -1
- package/dist/esm/{GridContent-214acb61.js → GridContent-0777cc42.js} +26 -10
- package/dist/esm/GridContent.js +5 -4
- package/dist/esm/IssueContentDeck.js +1 -1
- package/dist/esm/IssueDeck.js +1 -1
- package/dist/esm/MasterDeck.js +11 -11
- package/dist/esm/{Normal-be430fa9.js → Normal-7d33c7bf.js} +78 -92
- package/dist/esm/PublicationDeck.js +1 -1
- package/dist/esm/QueueDeckExpanded.js +6 -5
- package/dist/esm/{TaxonomyCard-f9c93953.js → TaxonomyCard-ca8c7c8a.js} +1 -1
- package/dist/esm/TaxonomyCard.js +2 -2
- package/dist/esm/TemplateNormal.js +3 -2
- package/dist/esm/ThumbnailCard.js +1 -1
- package/dist/esm/VideoSeriesListing.js +2 -2
- package/dist/esm/{YoutubeGroup-1368335c.js → YoutubeGroup-d3b92eb5.js} +4 -4
- package/dist/esm/YoutubeGroup.js +1 -1
- package/dist/esm/{index-ca4ff5cb.js → index-b7bbf1d4.js} +18 -18
- package/dist/esm/index.js +204 -183
- package/dist/esm/{main-dea495b7.js → main-2504c03f.js} +6 -6
- package/dist/esm/{visibility-sensor-675d3fa1.js → visibility-sensor-61158020.js} +2501 -1437
- package/package.json +93 -93
|
@@ -60,35 +60,35 @@ function parseSource(source) {
|
|
|
60
60
|
if (typeof source === 'string' && isUrl(source)) {
|
|
61
61
|
// Someone passed an existing image url?
|
|
62
62
|
image = {
|
|
63
|
-
asset: { _ref: urlToId(source) }
|
|
63
|
+
asset: { _ref: urlToId(source) },
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
else if (typeof source === 'string') {
|
|
67
67
|
// Just an asset id
|
|
68
68
|
image = {
|
|
69
|
-
asset: { _ref: source }
|
|
69
|
+
asset: { _ref: source },
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
72
|
else if (isRef(source)) {
|
|
73
73
|
// We just got passed an asset directly
|
|
74
74
|
image = {
|
|
75
|
-
asset: source
|
|
75
|
+
asset: source,
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
else if (isAsset(source)) {
|
|
79
79
|
// If we were passed an image asset document
|
|
80
80
|
image = {
|
|
81
81
|
asset: {
|
|
82
|
-
_ref: source._id || ''
|
|
83
|
-
}
|
|
82
|
+
_ref: source._id || '',
|
|
83
|
+
},
|
|
84
84
|
};
|
|
85
85
|
}
|
|
86
86
|
else if (isAssetStub(source)) {
|
|
87
87
|
// If we were passed a partial asset (`url`, but no `_id`)
|
|
88
88
|
image = {
|
|
89
89
|
asset: {
|
|
90
|
-
_ref: urlToId(source.asset.url)
|
|
91
|
-
}
|
|
90
|
+
_ref: urlToId(source.asset.url),
|
|
91
|
+
},
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
else if (typeof source.asset === 'object') {
|
|
@@ -129,7 +129,7 @@ function applyDefaults(image) {
|
|
|
129
129
|
left: 0,
|
|
130
130
|
top: 0,
|
|
131
131
|
bottom: 0,
|
|
132
|
-
right: 0
|
|
132
|
+
right: 0,
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
135
|
if (!result.hotspot) {
|
|
@@ -137,7 +137,7 @@ function applyDefaults(image) {
|
|
|
137
137
|
x: 0.5,
|
|
138
138
|
y: 0.5,
|
|
139
139
|
height: 1.0,
|
|
140
|
-
width: 1.0
|
|
140
|
+
width: 1.0,
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
143
|
return result;
|
|
@@ -184,7 +184,7 @@ exports.SPEC_NAME_TO_URL_NAME_MAPPINGS = [
|
|
|
184
184
|
['crop', 'crop'],
|
|
185
185
|
['saturation', 'sat'],
|
|
186
186
|
['auto', 'auto'],
|
|
187
|
-
['dpr', 'dpr']
|
|
187
|
+
['dpr', 'dpr'],
|
|
188
188
|
];
|
|
189
189
|
function urlForImage(options) {
|
|
190
190
|
var spec = __assign({}, (options || {}));
|
|
@@ -203,7 +203,7 @@ function urlForImage(options) {
|
|
|
203
203
|
left: cropLeft,
|
|
204
204
|
top: cropTop,
|
|
205
205
|
width: Math.round(asset.width - image.crop.right * asset.width - cropLeft),
|
|
206
|
-
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop)
|
|
206
|
+
height: Math.round(asset.height - image.crop.bottom * asset.height - cropTop),
|
|
207
207
|
};
|
|
208
208
|
// Compute hot spot rect in terms of pixel coordinates
|
|
209
209
|
var hotSpotVerticalRadius = (image.hotspot.height * asset.height) / 2;
|
|
@@ -214,7 +214,7 @@ function urlForImage(options) {
|
|
|
214
214
|
left: hotSpotCenterX - hotSpotHorizontalRadius,
|
|
215
215
|
top: hotSpotCenterY - hotSpotVerticalRadius,
|
|
216
216
|
right: hotSpotCenterX + hotSpotHorizontalRadius,
|
|
217
|
-
bottom: hotSpotCenterY + hotSpotVerticalRadius
|
|
217
|
+
bottom: hotSpotCenterY + hotSpotVerticalRadius,
|
|
218
218
|
};
|
|
219
219
|
// If irrelevant, or if we are requested to: don't perform crop/fit based on
|
|
220
220
|
// the crop/hotspot.
|
|
@@ -296,7 +296,7 @@ function fit(source, spec) {
|
|
|
296
296
|
left: Math.round(left),
|
|
297
297
|
top: Math.round(top_2),
|
|
298
298
|
width: Math.round(width),
|
|
299
|
-
height: Math.round(height)
|
|
299
|
+
height: Math.round(height),
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
else {
|
|
@@ -318,13 +318,13 @@ function fit(source, spec) {
|
|
|
318
318
|
left: Math.max(0, Math.floor(left)),
|
|
319
319
|
top: Math.max(0, Math.floor(top_3)),
|
|
320
320
|
width: Math.round(width),
|
|
321
|
-
height: Math.round(height)
|
|
321
|
+
height: Math.round(height),
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
324
|
return {
|
|
325
325
|
width: imgWidth,
|
|
326
326
|
height: imgHeight,
|
|
327
|
-
rect: cropRect
|
|
327
|
+
rect: cropRect,
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
|
|
@@ -382,7 +382,7 @@ function urlBuilder(options) {
|
|
|
382
382
|
return new ImageUrlBuilder(null, {
|
|
383
383
|
baseUrl: apiHost.replace(/^https:\/\/api\./, 'https://cdn.'),
|
|
384
384
|
projectId: projectId,
|
|
385
|
-
dataset: dataset
|
|
385
|
+
dataset: dataset,
|
|
386
386
|
});
|
|
387
387
|
}
|
|
388
388
|
// Or just accept the options as given
|
|
@@ -395,7 +395,7 @@ var ImageUrlBuilder = /** @class */ (function () {
|
|
|
395
395
|
? __assign(__assign({}, (parent.options || {})), (options || {})) : __assign({}, (options || {})); // Copy options
|
|
396
396
|
}
|
|
397
397
|
ImageUrlBuilder.prototype.withOptions = function (options) {
|
|
398
|
-
var baseUrl = options.baseUrl ||
|
|
398
|
+
var baseUrl = options.baseUrl || this.options.baseUrl;
|
|
399
399
|
var newOptions = { baseUrl: baseUrl };
|
|
400
400
|
for (var key in options) {
|
|
401
401
|
if (options.hasOwnProperty(key)) {
|
|
@@ -523,7 +523,7 @@ var ImageUrlBuilder = /** @class */ (function () {
|
|
|
523
523
|
ImageUrlBuilder.prototype.url = function () {
|
|
524
524
|
return urlForImage_1$1.default(this.options);
|
|
525
525
|
};
|
|
526
|
-
//
|
|
526
|
+
// Alias for url()
|
|
527
527
|
ImageUrlBuilder.prototype.toString = function () {
|
|
528
528
|
return this.url();
|
|
529
529
|
};
|