@blocklet/pages-kit 0.3.20 → 0.3.22
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/lib/cjs/builtin/utils.js +16 -4
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/cjs/utils/inject-global-components.js +1 -2
- package/lib/cjs/utils/preload.js +2 -0
- package/lib/cjs/utils/property.js +15 -0
- package/lib/esm/builtin/utils.js +11 -0
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/utils/inject-global-components.js +1 -2
- package/lib/esm/utils/preload.js +2 -0
- package/lib/esm/utils/property.js +12 -0
- package/lib/types/builtin/utils.d.ts +1 -0
- package/lib/types/tsconfig.tsbuildinfo +1 -1
- package/lib/types/types/core.d.ts +1 -1
- package/lib/types/utils/preload.d.ts +1 -1
- package/package.json +6 -4
package/lib/cjs/builtin/utils.js
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getQuery = exports.withQuery = exports.joinURL = void 0;
|
|
4
4
|
exports.getComponentMountPoint = getComponentMountPoint;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "
|
|
5
|
+
exports.getMediaKitAbsoluteUrl = getMediaKitAbsoluteUrl;
|
|
6
|
+
const ufo_1 = require("ufo");
|
|
7
|
+
var ufo_2 = require("ufo");
|
|
8
|
+
Object.defineProperty(exports, "joinURL", { enumerable: true, get: function () { return ufo_2.joinURL; } });
|
|
9
|
+
Object.defineProperty(exports, "withQuery", { enumerable: true, get: function () { return ufo_2.withQuery; } });
|
|
10
|
+
Object.defineProperty(exports, "getQuery", { enumerable: true, get: function () { return ufo_2.getQuery; } });
|
|
9
11
|
function getComponentMountPoint(name) {
|
|
10
12
|
var _a, _b;
|
|
11
13
|
if (typeof window === 'undefined') {
|
|
@@ -14,3 +16,13 @@ function getComponentMountPoint(name) {
|
|
|
14
16
|
}
|
|
15
17
|
return (_b = (_a = globalThis.blocklet) === null || _a === void 0 ? void 0 : _a.componentMountPoints.find((i) => i.name === name || i.did === name)) === null || _b === void 0 ? void 0 : _b.mountPoint;
|
|
16
18
|
}
|
|
19
|
+
function getMediaKitAbsoluteUrl(url) {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
const PREFIX = ((_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.prefix) || '/';
|
|
22
|
+
const IMAGE_BIN_DID = 'z8ia1mAXo8ZE7ytGF36L5uBf9kD2kenhqFGp9';
|
|
23
|
+
const IMAGE_BIN_PREFIX = ((_b = blocklet === null || blocklet === void 0 ? void 0 : blocklet.componentMountPoints.find((i) => i.did === IMAGE_BIN_DID)) === null || _b === void 0 ? void 0 : _b.mountPoint) || (0, ufo_1.joinURL)(PREFIX, '/image-bin');
|
|
24
|
+
if (url && url.startsWith('mediakit://')) {
|
|
25
|
+
return window.location.origin + (0, ufo_1.joinURL)(IMAGE_BIN_PREFIX, 'uploads', url.replace('mediakit://', ''));
|
|
26
|
+
}
|
|
27
|
+
return url;
|
|
28
|
+
}
|