@uniformdev/canvas 20.7.1-alpha.26 → 20.7.1-alpha.32
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/dist/index.d.mts +21 -22
- package/dist/index.d.ts +21 -22
- package/dist/index.esm.js +24 -23
- package/dist/index.js +24 -23
- package/dist/index.mjs +24 -23
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
@@ -553,7 +553,7 @@ interface components$n {
|
|
553
553
|
categoryId?: string | null;
|
554
554
|
/** @description Description of the component definition */
|
555
555
|
description?: string;
|
556
|
-
/** @description
|
556
|
+
/** @description Preview image URL for the component definition (shown in the UI) */
|
557
557
|
previewImageUrl?: string;
|
558
558
|
/**
|
559
559
|
* @description if this component uses team permissions or custom permissions
|
@@ -778,7 +778,7 @@ interface components$m {
|
|
778
778
|
categoryId?: string | null;
|
779
779
|
/** @description Description of the component definition */
|
780
780
|
description?: string;
|
781
|
-
/** @description
|
781
|
+
/** @description Preview image URL for the component definition (shown in the UI) */
|
782
782
|
previewImageUrl?: string;
|
783
783
|
/**
|
784
784
|
* @description if this component uses team permissions or custom permissions
|
@@ -7507,6 +7507,8 @@ interface components$8 {
|
|
7507
7507
|
retryCount: number;
|
7508
7508
|
retryDelay: number;
|
7509
7509
|
sourceCache?: string;
|
7510
|
+
/** @description Array of status codes for corresponding retries; will be empty for cache hits, Uniform Content data resources and static JSON data resources */
|
7511
|
+
statusCodes: number[];
|
7510
7512
|
};
|
7511
7513
|
data: unknown;
|
7512
7514
|
};
|
@@ -7541,6 +7543,7 @@ interface components$8 {
|
|
7541
7543
|
};
|
7542
7544
|
};
|
7543
7545
|
DataResolutionIssue: {
|
7546
|
+
componentId?: string;
|
7544
7547
|
componentPath?: string;
|
7545
7548
|
componentType?: string;
|
7546
7549
|
message: string;
|
@@ -8419,8 +8422,8 @@ interface components$8 {
|
|
8419
8422
|
};
|
8420
8423
|
};
|
8421
8424
|
parameters: {
|
8422
|
-
/** @description Enables additional diagnostics that will be attached to the response */
|
8423
|
-
diagnostics:
|
8425
|
+
/** @description Enables additional diagnostics that will be attached to the response; set to "no-data" to skip data resource values while keeping metrics */
|
8426
|
+
diagnostics: "true" | "false" | "no-data";
|
8424
8427
|
/** @description Controls how many levels deep content references should be resolved */
|
8425
8428
|
resolutionDepth: number;
|
8426
8429
|
/** @description Max number of records to return */
|
@@ -9732,9 +9735,10 @@ type DataResolutionOptionPositive = {
|
|
9732
9735
|
type DataResolutionParameters = {
|
9733
9736
|
/**
|
9734
9737
|
* Adds additional diagnostics about edge request processing to the response (`diagnostics`).
|
9735
|
-
*
|
9738
|
+
* Only use when diagnosing performance issues, don't use for serving production traffic.
|
9739
|
+
* Setting to `true` will include all resolved data which may be big. Use `"no-data"` to skip data.
|
9736
9740
|
*/
|
9737
|
-
diagnostics?: boolean;
|
9741
|
+
diagnostics?: boolean | 'no-data';
|
9738
9742
|
/**
|
9739
9743
|
* Controls how many levels deep content references should be resolved.
|
9740
9744
|
*/
|
@@ -10101,10 +10105,7 @@ interface paths$6 {
|
|
10101
10105
|
path?: never;
|
10102
10106
|
cookie?: never;
|
10103
10107
|
};
|
10104
|
-
/**
|
10105
|
-
* @deprecated
|
10106
|
-
* @description Gets all preview URLs
|
10107
|
-
*/
|
10108
|
+
/** @description Gets all preview URLs */
|
10108
10109
|
get: {
|
10109
10110
|
parameters: {
|
10110
10111
|
query: {
|
@@ -10149,10 +10150,7 @@ interface paths$6 {
|
|
10149
10150
|
500: components$6["responses"]["InternalServerError"];
|
10150
10151
|
};
|
10151
10152
|
};
|
10152
|
-
/**
|
10153
|
-
* @deprecated
|
10154
|
-
* @description Upserts a preview URL
|
10155
|
-
*/
|
10153
|
+
/** @description Upserts a preview URL */
|
10156
10154
|
put: {
|
10157
10155
|
parameters: {
|
10158
10156
|
query?: never;
|
@@ -10214,10 +10212,7 @@ interface paths$6 {
|
|
10214
10212
|
};
|
10215
10213
|
};
|
10216
10214
|
post?: never;
|
10217
|
-
/**
|
10218
|
-
* @deprecated
|
10219
|
-
* @description Deletes a preview URL
|
10220
|
-
*/
|
10215
|
+
/** @description Deletes a preview URL */
|
10221
10216
|
delete: {
|
10222
10217
|
parameters: {
|
10223
10218
|
query?: never;
|
@@ -11548,7 +11543,7 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
|
|
11548
11543
|
filters?: CompositionFilters;
|
11549
11544
|
} & ({
|
11550
11545
|
resolveData: true;
|
11551
|
-
diagnostics
|
11546
|
+
diagnostics: DataResolutionParameters['diagnostics'];
|
11552
11547
|
} | {
|
11553
11548
|
resolveData?: false;
|
11554
11549
|
})): Promise<CompositionGetListResponse | CompositionResolvedListResponse>;
|
@@ -12102,13 +12097,19 @@ interface EvaluateNodeTreeVisibilityOptions extends Pick<EvaluateNodeVisibilityO
|
|
12102
12097
|
* When false, indeterminate criteria will fail the summary result, and the node will be hidden
|
12103
12098
|
*/
|
12104
12099
|
showIndeterminate?: boolean;
|
12100
|
+
/**
|
12101
|
+
* When evaluating visibility of a root node, this controls what happens when the node is found to be invisible.
|
12102
|
+
* When 'throw' (default), an error is thrown.
|
12103
|
+
* When 'ignore', the node is left intact. False is still returned.
|
12104
|
+
*/
|
12105
|
+
rootNodeInvisibleHandling?: 'throw' | 'ignore';
|
12105
12106
|
}
|
12106
12107
|
/**
|
12107
12108
|
* Function to call to evaluate visibility rules when traversing the node tree with walkNodeTree.
|
12108
12109
|
*
|
12109
12110
|
* If the function returns false, that means the current node is removed and you should stop any other code handling.
|
12110
12111
|
*/
|
12111
|
-
declare function evaluateWalkTreeNodeVisibility({ rules, showIndeterminate, context, }: EvaluateNodeTreeVisibilityOptions): boolean | undefined;
|
12112
|
+
declare function evaluateWalkTreeNodeVisibility({ rules, showIndeterminate, rootNodeInvisibleHandling, context, }: EvaluateNodeTreeVisibilityOptions): boolean | undefined;
|
12112
12113
|
|
12113
12114
|
interface EvaluateWalkTreePropertyCriteriaOptions extends Pick<EvaluatePropertyCriteriaOptions, 'rules' | 'keepIndeterminate'> {
|
12114
12115
|
node: ComponentInstance;
|
@@ -12398,8 +12399,6 @@ declare const createCanvasChannel: ({ listenTo, broadcastTo, }: {
|
|
12398
12399
|
|
12399
12400
|
/**
|
12400
12401
|
* API client to work with Uniform Project Preview entities
|
12401
|
-
*
|
12402
|
-
* @deprecated beta functionality subject to change
|
12403
12402
|
*/
|
12404
12403
|
declare class PreviewClient extends ApiClient {
|
12405
12404
|
constructor(options: ClientOptions);
|
package/dist/index.d.ts
CHANGED
@@ -553,7 +553,7 @@ interface components$n {
|
|
553
553
|
categoryId?: string | null;
|
554
554
|
/** @description Description of the component definition */
|
555
555
|
description?: string;
|
556
|
-
/** @description
|
556
|
+
/** @description Preview image URL for the component definition (shown in the UI) */
|
557
557
|
previewImageUrl?: string;
|
558
558
|
/**
|
559
559
|
* @description if this component uses team permissions or custom permissions
|
@@ -778,7 +778,7 @@ interface components$m {
|
|
778
778
|
categoryId?: string | null;
|
779
779
|
/** @description Description of the component definition */
|
780
780
|
description?: string;
|
781
|
-
/** @description
|
781
|
+
/** @description Preview image URL for the component definition (shown in the UI) */
|
782
782
|
previewImageUrl?: string;
|
783
783
|
/**
|
784
784
|
* @description if this component uses team permissions or custom permissions
|
@@ -7507,6 +7507,8 @@ interface components$8 {
|
|
7507
7507
|
retryCount: number;
|
7508
7508
|
retryDelay: number;
|
7509
7509
|
sourceCache?: string;
|
7510
|
+
/** @description Array of status codes for corresponding retries; will be empty for cache hits, Uniform Content data resources and static JSON data resources */
|
7511
|
+
statusCodes: number[];
|
7510
7512
|
};
|
7511
7513
|
data: unknown;
|
7512
7514
|
};
|
@@ -7541,6 +7543,7 @@ interface components$8 {
|
|
7541
7543
|
};
|
7542
7544
|
};
|
7543
7545
|
DataResolutionIssue: {
|
7546
|
+
componentId?: string;
|
7544
7547
|
componentPath?: string;
|
7545
7548
|
componentType?: string;
|
7546
7549
|
message: string;
|
@@ -8419,8 +8422,8 @@ interface components$8 {
|
|
8419
8422
|
};
|
8420
8423
|
};
|
8421
8424
|
parameters: {
|
8422
|
-
/** @description Enables additional diagnostics that will be attached to the response */
|
8423
|
-
diagnostics:
|
8425
|
+
/** @description Enables additional diagnostics that will be attached to the response; set to "no-data" to skip data resource values while keeping metrics */
|
8426
|
+
diagnostics: "true" | "false" | "no-data";
|
8424
8427
|
/** @description Controls how many levels deep content references should be resolved */
|
8425
8428
|
resolutionDepth: number;
|
8426
8429
|
/** @description Max number of records to return */
|
@@ -9732,9 +9735,10 @@ type DataResolutionOptionPositive = {
|
|
9732
9735
|
type DataResolutionParameters = {
|
9733
9736
|
/**
|
9734
9737
|
* Adds additional diagnostics about edge request processing to the response (`diagnostics`).
|
9735
|
-
*
|
9738
|
+
* Only use when diagnosing performance issues, don't use for serving production traffic.
|
9739
|
+
* Setting to `true` will include all resolved data which may be big. Use `"no-data"` to skip data.
|
9736
9740
|
*/
|
9737
|
-
diagnostics?: boolean;
|
9741
|
+
diagnostics?: boolean | 'no-data';
|
9738
9742
|
/**
|
9739
9743
|
* Controls how many levels deep content references should be resolved.
|
9740
9744
|
*/
|
@@ -10101,10 +10105,7 @@ interface paths$6 {
|
|
10101
10105
|
path?: never;
|
10102
10106
|
cookie?: never;
|
10103
10107
|
};
|
10104
|
-
/**
|
10105
|
-
* @deprecated
|
10106
|
-
* @description Gets all preview URLs
|
10107
|
-
*/
|
10108
|
+
/** @description Gets all preview URLs */
|
10108
10109
|
get: {
|
10109
10110
|
parameters: {
|
10110
10111
|
query: {
|
@@ -10149,10 +10150,7 @@ interface paths$6 {
|
|
10149
10150
|
500: components$6["responses"]["InternalServerError"];
|
10150
10151
|
};
|
10151
10152
|
};
|
10152
|
-
/**
|
10153
|
-
* @deprecated
|
10154
|
-
* @description Upserts a preview URL
|
10155
|
-
*/
|
10153
|
+
/** @description Upserts a preview URL */
|
10156
10154
|
put: {
|
10157
10155
|
parameters: {
|
10158
10156
|
query?: never;
|
@@ -10214,10 +10212,7 @@ interface paths$6 {
|
|
10214
10212
|
};
|
10215
10213
|
};
|
10216
10214
|
post?: never;
|
10217
|
-
/**
|
10218
|
-
* @deprecated
|
10219
|
-
* @description Deletes a preview URL
|
10220
|
-
*/
|
10215
|
+
/** @description Deletes a preview URL */
|
10221
10216
|
delete: {
|
10222
10217
|
parameters: {
|
10223
10218
|
query?: never;
|
@@ -11548,7 +11543,7 @@ declare class CanvasClient extends ApiClient<CanvasClientOptions> {
|
|
11548
11543
|
filters?: CompositionFilters;
|
11549
11544
|
} & ({
|
11550
11545
|
resolveData: true;
|
11551
|
-
diagnostics
|
11546
|
+
diagnostics: DataResolutionParameters['diagnostics'];
|
11552
11547
|
} | {
|
11553
11548
|
resolveData?: false;
|
11554
11549
|
})): Promise<CompositionGetListResponse | CompositionResolvedListResponse>;
|
@@ -12102,13 +12097,19 @@ interface EvaluateNodeTreeVisibilityOptions extends Pick<EvaluateNodeVisibilityO
|
|
12102
12097
|
* When false, indeterminate criteria will fail the summary result, and the node will be hidden
|
12103
12098
|
*/
|
12104
12099
|
showIndeterminate?: boolean;
|
12100
|
+
/**
|
12101
|
+
* When evaluating visibility of a root node, this controls what happens when the node is found to be invisible.
|
12102
|
+
* When 'throw' (default), an error is thrown.
|
12103
|
+
* When 'ignore', the node is left intact. False is still returned.
|
12104
|
+
*/
|
12105
|
+
rootNodeInvisibleHandling?: 'throw' | 'ignore';
|
12105
12106
|
}
|
12106
12107
|
/**
|
12107
12108
|
* Function to call to evaluate visibility rules when traversing the node tree with walkNodeTree.
|
12108
12109
|
*
|
12109
12110
|
* If the function returns false, that means the current node is removed and you should stop any other code handling.
|
12110
12111
|
*/
|
12111
|
-
declare function evaluateWalkTreeNodeVisibility({ rules, showIndeterminate, context, }: EvaluateNodeTreeVisibilityOptions): boolean | undefined;
|
12112
|
+
declare function evaluateWalkTreeNodeVisibility({ rules, showIndeterminate, rootNodeInvisibleHandling, context, }: EvaluateNodeTreeVisibilityOptions): boolean | undefined;
|
12112
12113
|
|
12113
12114
|
interface EvaluateWalkTreePropertyCriteriaOptions extends Pick<EvaluatePropertyCriteriaOptions, 'rules' | 'keepIndeterminate'> {
|
12114
12115
|
node: ComponentInstance;
|
@@ -12398,8 +12399,6 @@ declare const createCanvasChannel: ({ listenTo, broadcastTo, }: {
|
|
12398
12399
|
|
12399
12400
|
/**
|
12400
12401
|
* API client to work with Uniform Project Preview entities
|
12401
|
-
*
|
12402
|
-
* @deprecated beta functionality subject to change
|
12403
12402
|
*/
|
12404
12403
|
declare class PreviewClient extends ApiClient {
|
12405
12404
|
constructor(options: ClientOptions);
|
package/dist/index.esm.js
CHANGED
@@ -624,7 +624,7 @@ var CanvasClient = class extends ApiClient {
|
|
624
624
|
const edgeParams = {
|
625
625
|
...originParams,
|
626
626
|
projectId,
|
627
|
-
|
627
|
+
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
628
628
|
...rewrittenFilters
|
629
629
|
};
|
630
630
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
@@ -665,7 +665,7 @@ var CanvasClient = class extends ApiClient {
|
|
665
665
|
const edgeParams = {
|
666
666
|
...params,
|
667
667
|
projectId,
|
668
|
-
|
668
|
+
diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
|
669
669
|
};
|
670
670
|
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
671
671
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
@@ -847,7 +847,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
847
847
|
return {
|
848
848
|
projectId,
|
849
849
|
...params,
|
850
|
-
diagnostics:
|
850
|
+
diagnostics: typeof options.diagnostics === "boolean" ? options.diagnostics : options.diagnostics === "no-data" ? "no-data" : void 0
|
851
851
|
};
|
852
852
|
}
|
853
853
|
};
|
@@ -2092,15 +2092,19 @@ function evaluateNodeVisibility({
|
|
2092
2092
|
function evaluateWalkTreeNodeVisibility({
|
2093
2093
|
rules,
|
2094
2094
|
showIndeterminate,
|
2095
|
+
rootNodeInvisibleHandling = "throw",
|
2095
2096
|
context
|
2096
2097
|
}) {
|
2097
|
-
const { type, node, actions } = context;
|
2098
|
+
const { type, node, actions, ancestorsAndSelf } = context;
|
2098
2099
|
if (type !== "component") {
|
2099
2100
|
return;
|
2100
2101
|
}
|
2101
2102
|
const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
|
2102
2103
|
if (result === null && !showIndeterminate || result === false) {
|
2103
|
-
|
2104
|
+
if (ancestorsAndSelf.length === 1 && rootNodeInvisibleHandling === "ignore") {
|
2105
|
+
} else {
|
2106
|
+
actions.remove();
|
2107
|
+
}
|
2104
2108
|
return false;
|
2105
2109
|
}
|
2106
2110
|
return true;
|
@@ -2336,25 +2340,24 @@ function extractLocales({ component }) {
|
|
2336
2340
|
function localize(options) {
|
2337
2341
|
const nodes = options.nodes;
|
2338
2342
|
const locale = options.locale;
|
2339
|
-
|
2340
|
-
|
2343
|
+
if (!locale) {
|
2344
|
+
return;
|
2345
|
+
}
|
2346
|
+
const vizControlLocaleRule = createLocaleVisibilityRule(locale);
|
2341
2347
|
walkNodeTree(nodes, (context) => {
|
2342
2348
|
const { type, node, actions } = context;
|
2343
2349
|
if (type !== "component") {
|
2344
|
-
|
2345
|
-
localizeProperties(node, locale, vizControlLocaleRule);
|
2346
|
-
}
|
2350
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2347
2351
|
return;
|
2348
2352
|
}
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
}
|
2353
|
+
const result = evaluateWalkTreeNodeVisibility({
|
2354
|
+
context,
|
2355
|
+
rules: vizControlLocaleRule,
|
2356
|
+
showIndeterminate: true,
|
2357
|
+
rootNodeInvisibleHandling: "ignore"
|
2358
|
+
});
|
2359
|
+
if (!result) {
|
2360
|
+
return;
|
2358
2361
|
}
|
2359
2362
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2360
2363
|
const locales = extractLocales({ component: node });
|
@@ -2365,9 +2368,7 @@ function localize(options) {
|
|
2365
2368
|
if (replaceComponent == null ? void 0 : replaceComponent.length) {
|
2366
2369
|
replaceComponent.forEach((component) => {
|
2367
2370
|
removeLocaleProperty(component);
|
2368
|
-
|
2369
|
-
localizeProperties(component, locale, vizControlLocaleRule);
|
2370
|
-
}
|
2371
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2371
2372
|
});
|
2372
2373
|
const [first, ...rest] = replaceComponent;
|
2373
2374
|
actions.replace(first);
|
@@ -2377,7 +2378,7 @@ function localize(options) {
|
|
2377
2378
|
} else {
|
2378
2379
|
actions.remove();
|
2379
2380
|
}
|
2380
|
-
} else
|
2381
|
+
} else {
|
2381
2382
|
localizeProperties(node, locale, vizControlLocaleRule);
|
2382
2383
|
}
|
2383
2384
|
});
|
package/dist/index.js
CHANGED
@@ -787,7 +787,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
787
787
|
const edgeParams = {
|
788
788
|
...originParams,
|
789
789
|
projectId,
|
790
|
-
|
790
|
+
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
791
791
|
...rewrittenFilters
|
792
792
|
};
|
793
793
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
@@ -828,7 +828,7 @@ var CanvasClient = class extends import_api2.ApiClient {
|
|
828
828
|
const edgeParams = {
|
829
829
|
...params,
|
830
830
|
projectId,
|
831
|
-
|
831
|
+
diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
|
832
832
|
};
|
833
833
|
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
834
834
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
@@ -1010,7 +1010,7 @@ var _ContentClient = class _ContentClient extends import_api4.ApiClient {
|
|
1010
1010
|
return {
|
1011
1011
|
projectId,
|
1012
1012
|
...params,
|
1013
|
-
diagnostics:
|
1013
|
+
diagnostics: typeof options.diagnostics === "boolean" ? options.diagnostics : options.diagnostics === "no-data" ? "no-data" : void 0
|
1014
1014
|
};
|
1015
1015
|
}
|
1016
1016
|
};
|
@@ -2255,15 +2255,19 @@ function evaluateNodeVisibility({
|
|
2255
2255
|
function evaluateWalkTreeNodeVisibility({
|
2256
2256
|
rules,
|
2257
2257
|
showIndeterminate,
|
2258
|
+
rootNodeInvisibleHandling = "throw",
|
2258
2259
|
context
|
2259
2260
|
}) {
|
2260
|
-
const { type, node, actions } = context;
|
2261
|
+
const { type, node, actions, ancestorsAndSelf } = context;
|
2261
2262
|
if (type !== "component") {
|
2262
2263
|
return;
|
2263
2264
|
}
|
2264
2265
|
const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
|
2265
2266
|
if (result === null && !showIndeterminate || result === false) {
|
2266
|
-
|
2267
|
+
if (ancestorsAndSelf.length === 1 && rootNodeInvisibleHandling === "ignore") {
|
2268
|
+
} else {
|
2269
|
+
actions.remove();
|
2270
|
+
}
|
2267
2271
|
return false;
|
2268
2272
|
}
|
2269
2273
|
return true;
|
@@ -2499,25 +2503,24 @@ function extractLocales({ component }) {
|
|
2499
2503
|
function localize(options) {
|
2500
2504
|
const nodes = options.nodes;
|
2501
2505
|
const locale = options.locale;
|
2502
|
-
|
2503
|
-
|
2506
|
+
if (!locale) {
|
2507
|
+
return;
|
2508
|
+
}
|
2509
|
+
const vizControlLocaleRule = createLocaleVisibilityRule(locale);
|
2504
2510
|
walkNodeTree(nodes, (context) => {
|
2505
2511
|
const { type, node, actions } = context;
|
2506
2512
|
if (type !== "component") {
|
2507
|
-
|
2508
|
-
localizeProperties(node, locale, vizControlLocaleRule);
|
2509
|
-
}
|
2513
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2510
2514
|
return;
|
2511
2515
|
}
|
2512
|
-
|
2513
|
-
|
2514
|
-
|
2515
|
-
|
2516
|
-
|
2517
|
-
|
2518
|
-
|
2519
|
-
|
2520
|
-
}
|
2516
|
+
const result = evaluateWalkTreeNodeVisibility({
|
2517
|
+
context,
|
2518
|
+
rules: vizControlLocaleRule,
|
2519
|
+
showIndeterminate: true,
|
2520
|
+
rootNodeInvisibleHandling: "ignore"
|
2521
|
+
});
|
2522
|
+
if (!result) {
|
2523
|
+
return;
|
2521
2524
|
}
|
2522
2525
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2523
2526
|
const locales = extractLocales({ component: node });
|
@@ -2528,9 +2531,7 @@ function localize(options) {
|
|
2528
2531
|
if (replaceComponent == null ? void 0 : replaceComponent.length) {
|
2529
2532
|
replaceComponent.forEach((component) => {
|
2530
2533
|
removeLocaleProperty(component);
|
2531
|
-
|
2532
|
-
localizeProperties(component, locale, vizControlLocaleRule);
|
2533
|
-
}
|
2534
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2534
2535
|
});
|
2535
2536
|
const [first, ...rest] = replaceComponent;
|
2536
2537
|
actions.replace(first);
|
@@ -2540,7 +2541,7 @@ function localize(options) {
|
|
2540
2541
|
} else {
|
2541
2542
|
actions.remove();
|
2542
2543
|
}
|
2543
|
-
} else
|
2544
|
+
} else {
|
2544
2545
|
localizeProperties(node, locale, vizControlLocaleRule);
|
2545
2546
|
}
|
2546
2547
|
});
|
package/dist/index.mjs
CHANGED
@@ -624,7 +624,7 @@ var CanvasClient = class extends ApiClient {
|
|
624
624
|
const edgeParams = {
|
625
625
|
...originParams,
|
626
626
|
projectId,
|
627
|
-
|
627
|
+
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
628
628
|
...rewrittenFilters
|
629
629
|
};
|
630
630
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
@@ -665,7 +665,7 @@ var CanvasClient = class extends ApiClient {
|
|
665
665
|
const edgeParams = {
|
666
666
|
...params,
|
667
667
|
projectId,
|
668
|
-
|
668
|
+
diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
|
669
669
|
};
|
670
670
|
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
671
671
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
@@ -847,7 +847,7 @@ var _ContentClient = class _ContentClient extends ApiClient3 {
|
|
847
847
|
return {
|
848
848
|
projectId,
|
849
849
|
...params,
|
850
|
-
diagnostics:
|
850
|
+
diagnostics: typeof options.diagnostics === "boolean" ? options.diagnostics : options.diagnostics === "no-data" ? "no-data" : void 0
|
851
851
|
};
|
852
852
|
}
|
853
853
|
};
|
@@ -2092,15 +2092,19 @@ function evaluateNodeVisibility({
|
|
2092
2092
|
function evaluateWalkTreeNodeVisibility({
|
2093
2093
|
rules,
|
2094
2094
|
showIndeterminate,
|
2095
|
+
rootNodeInvisibleHandling = "throw",
|
2095
2096
|
context
|
2096
2097
|
}) {
|
2097
|
-
const { type, node, actions } = context;
|
2098
|
+
const { type, node, actions, ancestorsAndSelf } = context;
|
2098
2099
|
if (type !== "component") {
|
2099
2100
|
return;
|
2100
2101
|
}
|
2101
2102
|
const result = evaluateNodeVisibility({ node, rules, simplifyCriteria: true });
|
2102
2103
|
if (result === null && !showIndeterminate || result === false) {
|
2103
|
-
|
2104
|
+
if (ancestorsAndSelf.length === 1 && rootNodeInvisibleHandling === "ignore") {
|
2105
|
+
} else {
|
2106
|
+
actions.remove();
|
2107
|
+
}
|
2104
2108
|
return false;
|
2105
2109
|
}
|
2106
2110
|
return true;
|
@@ -2336,25 +2340,24 @@ function extractLocales({ component }) {
|
|
2336
2340
|
function localize(options) {
|
2337
2341
|
const nodes = options.nodes;
|
2338
2342
|
const locale = options.locale;
|
2339
|
-
|
2340
|
-
|
2343
|
+
if (!locale) {
|
2344
|
+
return;
|
2345
|
+
}
|
2346
|
+
const vizControlLocaleRule = createLocaleVisibilityRule(locale);
|
2341
2347
|
walkNodeTree(nodes, (context) => {
|
2342
2348
|
const { type, node, actions } = context;
|
2343
2349
|
if (type !== "component") {
|
2344
|
-
|
2345
|
-
localizeProperties(node, locale, vizControlLocaleRule);
|
2346
|
-
}
|
2350
|
+
localizeProperties(node, locale, vizControlLocaleRule);
|
2347
2351
|
return;
|
2348
2352
|
}
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
}
|
2353
|
+
const result = evaluateWalkTreeNodeVisibility({
|
2354
|
+
context,
|
2355
|
+
rules: vizControlLocaleRule,
|
2356
|
+
showIndeterminate: true,
|
2357
|
+
rootNodeInvisibleHandling: "ignore"
|
2358
|
+
});
|
2359
|
+
if (!result) {
|
2360
|
+
return;
|
2358
2361
|
}
|
2359
2362
|
if (node.type === CANVAS_LOCALIZATION_TYPE) {
|
2360
2363
|
const locales = extractLocales({ component: node });
|
@@ -2365,9 +2368,7 @@ function localize(options) {
|
|
2365
2368
|
if (replaceComponent == null ? void 0 : replaceComponent.length) {
|
2366
2369
|
replaceComponent.forEach((component) => {
|
2367
2370
|
removeLocaleProperty(component);
|
2368
|
-
|
2369
|
-
localizeProperties(component, locale, vizControlLocaleRule);
|
2370
|
-
}
|
2371
|
+
localizeProperties(component, locale, vizControlLocaleRule);
|
2371
2372
|
});
|
2372
2373
|
const [first, ...rest] = replaceComponent;
|
2373
2374
|
actions.replace(first);
|
@@ -2377,7 +2378,7 @@ function localize(options) {
|
|
2377
2378
|
} else {
|
2378
2379
|
actions.remove();
|
2379
2380
|
}
|
2380
|
-
} else
|
2381
|
+
} else {
|
2381
2382
|
localizeProperties(node, locale, vizControlLocaleRule);
|
2382
2383
|
}
|
2383
2384
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "20.7.1-alpha.
|
3
|
+
"version": "20.7.1-alpha.32+616e77445e",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -28,7 +28,7 @@
|
|
28
28
|
"lint": "eslint \"src/**/*.{js,ts,tsx}\"",
|
29
29
|
"format": "prettier --write \"src/**/*.{js,ts,tsx}\"",
|
30
30
|
"update-openapi": "tsx ./scripts/update-openapi.cts",
|
31
|
-
"document": "api-extractor run --local"
|
31
|
+
"document:prebuild": "api-extractor run --local"
|
32
32
|
},
|
33
33
|
"devDependencies": {
|
34
34
|
"@types/retry": "0.12.5",
|
@@ -38,9 +38,9 @@
|
|
38
38
|
"p-throttle": "5.0.0"
|
39
39
|
},
|
40
40
|
"dependencies": {
|
41
|
-
"@uniformdev/assets": "20.7.1-alpha.
|
42
|
-
"@uniformdev/context": "20.7.1-alpha.
|
43
|
-
"@uniformdev/richtext": "20.7.1-alpha.
|
41
|
+
"@uniformdev/assets": "20.7.1-alpha.32+616e77445e",
|
42
|
+
"@uniformdev/context": "20.7.1-alpha.32+616e77445e",
|
43
|
+
"@uniformdev/richtext": "20.7.1-alpha.32+616e77445e",
|
44
44
|
"immer": "10.1.1"
|
45
45
|
},
|
46
46
|
"files": [
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"publishConfig": {
|
50
50
|
"access": "public"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "616e77445e7f75fca783616a70b359a2fb7bdfab"
|
53
53
|
}
|