react-cosmos-core 7.4.2-canary.b4cc31d.0 → 7.4.2-canary.bee4e70.0
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.
|
@@ -7,6 +7,10 @@ export type CosmosRendererUrl = null | string | {
|
|
|
7
7
|
};
|
|
8
8
|
export declare function pickRendererUrl(rendererUrl: undefined | CosmosRendererUrl, mode: CosmosMode): null | string;
|
|
9
9
|
export declare function createRendererUrl(rendererUrl: string, params?: RendererParams): string;
|
|
10
|
+
/** @deprecated Pass renderer params as an object */
|
|
11
|
+
export declare function createRendererUrl(rendererUrl: string, fixtureId?: FixtureId, locked?: boolean): string;
|
|
10
12
|
export declare function createWebRendererUrl(rendererUrl: string, params?: RendererParams): string;
|
|
13
|
+
/** @deprecated Pass renderer params as an object */
|
|
14
|
+
export declare function createWebRendererUrl(rendererUrl: string, fixtureId?: FixtureId, locked?: boolean): string;
|
|
11
15
|
export declare function encodeRendererUrlFixture(fixtureId: FixtureId): string;
|
|
12
16
|
export declare function decodeRendererUrlFixture(fixture: string): FixtureId;
|
|
@@ -5,7 +5,8 @@ export function pickRendererUrl(rendererUrl, mode) {
|
|
|
5
5
|
? rendererUrl[mode]
|
|
6
6
|
: (rendererUrl ?? null);
|
|
7
7
|
}
|
|
8
|
-
export function createRendererUrl(rendererUrl,
|
|
8
|
+
export function createRendererUrl(rendererUrl, paramsOrFixtureId, locked) {
|
|
9
|
+
const params = toRendererParams(paramsOrFixtureId, locked);
|
|
9
10
|
if (hasFixtureVar(rendererUrl)) {
|
|
10
11
|
const { fixtureId, ...queryParams } = params;
|
|
11
12
|
const fixture = fixtureId ? encodeRendererUrlFixture(fixtureId) : 'index';
|
|
@@ -20,8 +21,17 @@ export function createRendererUrl(rendererUrl, params = {}) {
|
|
|
20
21
|
return baseUrl + queryString;
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
|
-
export function createWebRendererUrl(rendererUrl,
|
|
24
|
-
return applyWindowHostnameToRendererUrl(createRendererUrl(rendererUrl,
|
|
24
|
+
export function createWebRendererUrl(rendererUrl, paramsOrFixtureId, locked) {
|
|
25
|
+
return applyWindowHostnameToRendererUrl(createRendererUrl(rendererUrl, toRendererParams(paramsOrFixtureId, locked)));
|
|
26
|
+
}
|
|
27
|
+
// Cosmos packages older than 7.5 depend on this package with a caret range, so
|
|
28
|
+
// they can end up calling this version with the positional (fixtureId, locked)
|
|
29
|
+
// arguments they were built against. See the tech debt doc for when this can
|
|
30
|
+
// be removed.
|
|
31
|
+
function toRendererParams(paramsOrFixtureId = {}, locked) {
|
|
32
|
+
return 'path' in paramsOrFixtureId
|
|
33
|
+
? { fixtureId: paramsOrFixtureId, locked }
|
|
34
|
+
: paramsOrFixtureId;
|
|
25
35
|
}
|
|
26
36
|
export function encodeRendererUrlFixture(fixtureId) {
|
|
27
37
|
return Base64.encode(JSON.stringify(fixtureId));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cosmos-core",
|
|
3
|
-
"version": "7.4.2-canary.
|
|
3
|
+
"version": "7.4.2-canary.bee4e70.0+bee4e70",
|
|
4
4
|
"description": "React Cosmos Core",
|
|
5
5
|
"repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos-core",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"react": ">=18"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "bee4e7021eee5daccdd45e7ca16988b52a20ba2c"
|
|
17
17
|
}
|