@uniformdev/canvas 19.0.0 → 19.1.1-alpha.1
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.ts +473 -194
- package/dist/index.esm.js +96 -5
- package/dist/index.js +103 -8
- package/dist/index.mjs +96 -5
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
@@ -548,11 +548,74 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
548
548
|
}
|
549
549
|
};
|
550
550
|
|
551
|
-
// src/
|
551
|
+
// src/CompositionRelationshipClient.ts
|
552
552
|
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
553
|
+
var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
|
554
|
+
var unstable_CompositionRelationshipClient = class extends ApiClient2 {
|
555
|
+
constructor(options) {
|
556
|
+
super(options);
|
557
|
+
this.getDefinitionsRelationships = async ({
|
558
|
+
definitionIds,
|
559
|
+
withCompositions
|
560
|
+
}) => {
|
561
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
|
562
|
+
type: "definition",
|
563
|
+
projectId: this._options.projectId,
|
564
|
+
definitionIds: definitionIds.join(","),
|
565
|
+
withCompositions
|
566
|
+
});
|
567
|
+
return this.apiClient(url);
|
568
|
+
};
|
569
|
+
this.clearAllRelationships = async () => {
|
570
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
|
571
|
+
return this.apiClient(url, {
|
572
|
+
method: "POST",
|
573
|
+
body: JSON.stringify({
|
574
|
+
type: "clear",
|
575
|
+
projectId: this._options.projectId
|
576
|
+
})
|
577
|
+
});
|
578
|
+
};
|
579
|
+
this.indexCompositionRelationships = async ({
|
580
|
+
state,
|
581
|
+
compositionId
|
582
|
+
}) => {
|
583
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
|
584
|
+
return this.apiClient(url, {
|
585
|
+
method: "POST",
|
586
|
+
body: JSON.stringify({
|
587
|
+
type: "index",
|
588
|
+
projectId: this._options.projectId,
|
589
|
+
state,
|
590
|
+
compositionId
|
591
|
+
})
|
592
|
+
});
|
593
|
+
};
|
594
|
+
this.getVersion = async () => {
|
595
|
+
const url = this.createUrl("/api/v1/usage-tracking", {
|
596
|
+
projectId: this._options.projectId
|
597
|
+
});
|
598
|
+
return this.apiClient(url).then((response) => response.version);
|
599
|
+
};
|
600
|
+
this.setVersion = async (version) => {
|
601
|
+
const url = this.createUrl("/api/v1/usage-tracking");
|
602
|
+
return this.apiClient(url, {
|
603
|
+
method: "POST",
|
604
|
+
body: JSON.stringify({
|
605
|
+
projectId: this._options.projectId,
|
606
|
+
version
|
607
|
+
})
|
608
|
+
});
|
609
|
+
};
|
610
|
+
this._options = options;
|
611
|
+
}
|
612
|
+
};
|
613
|
+
|
614
|
+
// src/DataSourceClient.ts
|
615
|
+
import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
|
553
616
|
var dataSourceUrl = "/api/v1/data-source";
|
554
617
|
var dataSourcesUrl = "/api/v1/data-sources";
|
555
|
-
var DataSourceClient = class extends
|
618
|
+
var DataSourceClient = class extends ApiClient3 {
|
556
619
|
constructor(options) {
|
557
620
|
super(options);
|
558
621
|
}
|
@@ -589,9 +652,9 @@ var DataSourceClient = class extends ApiClient2 {
|
|
589
652
|
};
|
590
653
|
|
591
654
|
// src/DataTypeClient.ts
|
592
|
-
import { ApiClient as
|
655
|
+
import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
|
593
656
|
var _url;
|
594
|
-
var _DataTypeClient = class extends
|
657
|
+
var _DataTypeClient = class extends ApiClient4 {
|
595
658
|
constructor(options) {
|
596
659
|
super(options);
|
597
660
|
}
|
@@ -1121,6 +1184,7 @@ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1121
1184
|
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
1122
1185
|
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
1123
1186
|
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
1187
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
1124
1188
|
var PLACEHOLDER_ID = "placeholder";
|
1125
1189
|
var EMPTY_COMPOSITION = {
|
1126
1190
|
_id: "_empty_composition_id",
|
@@ -1230,12 +1294,18 @@ var isReadyMessage = (message) => {
|
|
1230
1294
|
var isUpdateCompositionMessage = (message) => {
|
1231
1295
|
return message.type === "update-composition";
|
1232
1296
|
};
|
1297
|
+
var isUpdateCompositionInternalMessage = (message) => {
|
1298
|
+
return message.type === "update-composition-internal";
|
1299
|
+
};
|
1233
1300
|
var isAddComponentMessage = (message) => {
|
1234
1301
|
return message.type === "add-component";
|
1235
1302
|
};
|
1236
1303
|
var isMovingComponentMessage = (message) => {
|
1237
1304
|
return message.type === "move-component";
|
1238
1305
|
};
|
1306
|
+
var isUpdateComponentParameterMessage = (message) => {
|
1307
|
+
return message.type === "update-component-parameter";
|
1308
|
+
};
|
1239
1309
|
var isDismissPlaceholderMessage = (message) => {
|
1240
1310
|
return message.type === "dismiss-placeholder";
|
1241
1311
|
};
|
@@ -1297,6 +1367,14 @@ var createCanvasChannel = ({
|
|
1297
1367
|
};
|
1298
1368
|
postMessage(message);
|
1299
1369
|
};
|
1370
|
+
const updateCompositionInternal = (composition, hash) => {
|
1371
|
+
const message = {
|
1372
|
+
type: "update-composition-internal",
|
1373
|
+
composition,
|
1374
|
+
hash
|
1375
|
+
};
|
1376
|
+
postMessage(message);
|
1377
|
+
};
|
1300
1378
|
const addComponent = (options) => {
|
1301
1379
|
const message = {
|
1302
1380
|
...options,
|
@@ -1311,6 +1389,13 @@ var createCanvasChannel = ({
|
|
1311
1389
|
};
|
1312
1390
|
postMessage(message);
|
1313
1391
|
};
|
1392
|
+
const updateComponentParameter = (options) => {
|
1393
|
+
const message = {
|
1394
|
+
...options,
|
1395
|
+
type: "update-component-parameter"
|
1396
|
+
};
|
1397
|
+
postMessage(message);
|
1398
|
+
};
|
1314
1399
|
const dismissPlaceholder = (options) => {
|
1315
1400
|
const message = {
|
1316
1401
|
...options,
|
@@ -1333,7 +1418,7 @@ var createCanvasChannel = ({
|
|
1333
1418
|
postMessage(message);
|
1334
1419
|
};
|
1335
1420
|
const messageEventListener = (event) => {
|
1336
|
-
if (typeof event.data !== "string"
|
1421
|
+
if (typeof event.data !== "string") {
|
1337
1422
|
return;
|
1338
1423
|
}
|
1339
1424
|
let message = null;
|
@@ -1363,9 +1448,11 @@ var createCanvasChannel = ({
|
|
1363
1448
|
destroy,
|
1364
1449
|
selectComponent,
|
1365
1450
|
updateComposition,
|
1451
|
+
updateCompositionInternal,
|
1366
1452
|
on,
|
1367
1453
|
addComponent,
|
1368
1454
|
moveComponent,
|
1455
|
+
updateComponentParameter,
|
1369
1456
|
dismissPlaceholder,
|
1370
1457
|
updatePreviewSettings,
|
1371
1458
|
reportRenderedCompositions
|
@@ -1546,6 +1633,7 @@ export {
|
|
1546
1633
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
1547
1634
|
IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
|
1548
1635
|
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
1636
|
+
IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
|
1549
1637
|
PLACEHOLDER_ID,
|
1550
1638
|
UncachedCanvasClient,
|
1551
1639
|
UniqueBatchEntries,
|
@@ -1568,6 +1656,8 @@ export {
|
|
1568
1656
|
isReportRenderedCompositionsMessage,
|
1569
1657
|
isSelectComponentMessage,
|
1570
1658
|
isSystemComponentDefinition,
|
1659
|
+
isUpdateComponentParameterMessage,
|
1660
|
+
isUpdateCompositionInternalMessage,
|
1571
1661
|
isUpdateCompositionMessage,
|
1572
1662
|
isUpdatePreviewSettingsMessage,
|
1573
1663
|
localize,
|
@@ -1575,5 +1665,6 @@ export {
|
|
1575
1665
|
mapSlotToTestVariations,
|
1576
1666
|
nullLimitPolicy,
|
1577
1667
|
subscribeToComposition,
|
1668
|
+
unstable_CompositionRelationshipClient,
|
1578
1669
|
walkComponentTree
|
1579
1670
|
};
|
package/dist/index.js
CHANGED
@@ -274,7 +274,7 @@ var require_retry2 = __commonJS({
|
|
274
274
|
// src/index.ts
|
275
275
|
var src_exports = {};
|
276
276
|
__export(src_exports, {
|
277
|
-
ApiClientError: () =>
|
277
|
+
ApiClientError: () => import_api5.ApiClientError,
|
278
278
|
BatchEntry: () => BatchEntry,
|
279
279
|
CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
|
280
280
|
CANVAS_ENRICHMENT_TAG_PARAM: () => CANVAS_ENRICHMENT_TAG_PARAM,
|
@@ -307,6 +307,7 @@ __export(src_exports, {
|
|
307
307
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE: () => IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
308
308
|
IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID: () => IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
|
309
309
|
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM: () => IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
310
|
+
IS_RENDERED_BY_UNIFORM_ATTRIBUTE: () => IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
|
310
311
|
PLACEHOLDER_ID: () => PLACEHOLDER_ID,
|
311
312
|
UncachedCanvasClient: () => UncachedCanvasClient,
|
312
313
|
UniqueBatchEntries: () => UniqueBatchEntries,
|
@@ -329,6 +330,8 @@ __export(src_exports, {
|
|
329
330
|
isReportRenderedCompositionsMessage: () => isReportRenderedCompositionsMessage,
|
330
331
|
isSelectComponentMessage: () => isSelectComponentMessage,
|
331
332
|
isSystemComponentDefinition: () => isSystemComponentDefinition,
|
333
|
+
isUpdateComponentParameterMessage: () => isUpdateComponentParameterMessage,
|
334
|
+
isUpdateCompositionInternalMessage: () => isUpdateCompositionInternalMessage,
|
332
335
|
isUpdateCompositionMessage: () => isUpdateCompositionMessage,
|
333
336
|
isUpdatePreviewSettingsMessage: () => isUpdatePreviewSettingsMessage,
|
334
337
|
localize: () => localize,
|
@@ -336,6 +339,7 @@ __export(src_exports, {
|
|
336
339
|
mapSlotToTestVariations: () => mapSlotToTestVariations,
|
337
340
|
nullLimitPolicy: () => nullLimitPolicy,
|
338
341
|
subscribeToComposition: () => subscribeToComposition,
|
342
|
+
unstable_CompositionRelationshipClient: () => unstable_CompositionRelationshipClient,
|
339
343
|
walkComponentTree: () => walkComponentTree
|
340
344
|
});
|
341
345
|
module.exports = __toCommonJS(src_exports);
|
@@ -623,11 +627,74 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
623
627
|
}
|
624
628
|
};
|
625
629
|
|
626
|
-
// src/
|
630
|
+
// src/CompositionRelationshipClient.ts
|
627
631
|
var import_api2 = require("@uniformdev/context/api");
|
632
|
+
var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
|
633
|
+
var unstable_CompositionRelationshipClient = class extends import_api2.ApiClient {
|
634
|
+
constructor(options) {
|
635
|
+
super(options);
|
636
|
+
this.getDefinitionsRelationships = async ({
|
637
|
+
definitionIds,
|
638
|
+
withCompositions
|
639
|
+
}) => {
|
640
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
|
641
|
+
type: "definition",
|
642
|
+
projectId: this._options.projectId,
|
643
|
+
definitionIds: definitionIds.join(","),
|
644
|
+
withCompositions
|
645
|
+
});
|
646
|
+
return this.apiClient(url);
|
647
|
+
};
|
648
|
+
this.clearAllRelationships = async () => {
|
649
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
|
650
|
+
return this.apiClient(url, {
|
651
|
+
method: "POST",
|
652
|
+
body: JSON.stringify({
|
653
|
+
type: "clear",
|
654
|
+
projectId: this._options.projectId
|
655
|
+
})
|
656
|
+
});
|
657
|
+
};
|
658
|
+
this.indexCompositionRelationships = async ({
|
659
|
+
state,
|
660
|
+
compositionId
|
661
|
+
}) => {
|
662
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
|
663
|
+
return this.apiClient(url, {
|
664
|
+
method: "POST",
|
665
|
+
body: JSON.stringify({
|
666
|
+
type: "index",
|
667
|
+
projectId: this._options.projectId,
|
668
|
+
state,
|
669
|
+
compositionId
|
670
|
+
})
|
671
|
+
});
|
672
|
+
};
|
673
|
+
this.getVersion = async () => {
|
674
|
+
const url = this.createUrl("/api/v1/usage-tracking", {
|
675
|
+
projectId: this._options.projectId
|
676
|
+
});
|
677
|
+
return this.apiClient(url).then((response) => response.version);
|
678
|
+
};
|
679
|
+
this.setVersion = async (version) => {
|
680
|
+
const url = this.createUrl("/api/v1/usage-tracking");
|
681
|
+
return this.apiClient(url, {
|
682
|
+
method: "POST",
|
683
|
+
body: JSON.stringify({
|
684
|
+
projectId: this._options.projectId,
|
685
|
+
version
|
686
|
+
})
|
687
|
+
});
|
688
|
+
};
|
689
|
+
this._options = options;
|
690
|
+
}
|
691
|
+
};
|
692
|
+
|
693
|
+
// src/DataSourceClient.ts
|
694
|
+
var import_api3 = require("@uniformdev/context/api");
|
628
695
|
var dataSourceUrl = "/api/v1/data-source";
|
629
696
|
var dataSourcesUrl = "/api/v1/data-sources";
|
630
|
-
var DataSourceClient = class extends
|
697
|
+
var DataSourceClient = class extends import_api3.ApiClient {
|
631
698
|
constructor(options) {
|
632
699
|
super(options);
|
633
700
|
}
|
@@ -664,9 +731,9 @@ var DataSourceClient = class extends import_api2.ApiClient {
|
|
664
731
|
};
|
665
732
|
|
666
733
|
// src/DataTypeClient.ts
|
667
|
-
var
|
734
|
+
var import_api4 = require("@uniformdev/context/api");
|
668
735
|
var _url;
|
669
|
-
var _DataTypeClient = class extends
|
736
|
+
var _DataTypeClient = class extends import_api4.ApiClient {
|
670
737
|
constructor(options) {
|
671
738
|
super(options);
|
672
739
|
}
|
@@ -1196,6 +1263,7 @@ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1196
1263
|
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
1197
1264
|
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
1198
1265
|
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
1266
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
1199
1267
|
var PLACEHOLDER_ID = "placeholder";
|
1200
1268
|
var EMPTY_COMPOSITION = {
|
1201
1269
|
_id: "_empty_composition_id",
|
@@ -1305,12 +1373,18 @@ var isReadyMessage = (message) => {
|
|
1305
1373
|
var isUpdateCompositionMessage = (message) => {
|
1306
1374
|
return message.type === "update-composition";
|
1307
1375
|
};
|
1376
|
+
var isUpdateCompositionInternalMessage = (message) => {
|
1377
|
+
return message.type === "update-composition-internal";
|
1378
|
+
};
|
1308
1379
|
var isAddComponentMessage = (message) => {
|
1309
1380
|
return message.type === "add-component";
|
1310
1381
|
};
|
1311
1382
|
var isMovingComponentMessage = (message) => {
|
1312
1383
|
return message.type === "move-component";
|
1313
1384
|
};
|
1385
|
+
var isUpdateComponentParameterMessage = (message) => {
|
1386
|
+
return message.type === "update-component-parameter";
|
1387
|
+
};
|
1314
1388
|
var isDismissPlaceholderMessage = (message) => {
|
1315
1389
|
return message.type === "dismiss-placeholder";
|
1316
1390
|
};
|
@@ -1372,6 +1446,14 @@ var createCanvasChannel = ({
|
|
1372
1446
|
};
|
1373
1447
|
postMessage(message);
|
1374
1448
|
};
|
1449
|
+
const updateCompositionInternal = (composition, hash) => {
|
1450
|
+
const message = {
|
1451
|
+
type: "update-composition-internal",
|
1452
|
+
composition,
|
1453
|
+
hash
|
1454
|
+
};
|
1455
|
+
postMessage(message);
|
1456
|
+
};
|
1375
1457
|
const addComponent = (options) => {
|
1376
1458
|
const message = {
|
1377
1459
|
...options,
|
@@ -1386,6 +1468,13 @@ var createCanvasChannel = ({
|
|
1386
1468
|
};
|
1387
1469
|
postMessage(message);
|
1388
1470
|
};
|
1471
|
+
const updateComponentParameter = (options) => {
|
1472
|
+
const message = {
|
1473
|
+
...options,
|
1474
|
+
type: "update-component-parameter"
|
1475
|
+
};
|
1476
|
+
postMessage(message);
|
1477
|
+
};
|
1389
1478
|
const dismissPlaceholder = (options) => {
|
1390
1479
|
const message = {
|
1391
1480
|
...options,
|
@@ -1408,7 +1497,7 @@ var createCanvasChannel = ({
|
|
1408
1497
|
postMessage(message);
|
1409
1498
|
};
|
1410
1499
|
const messageEventListener = (event) => {
|
1411
|
-
if (typeof event.data !== "string"
|
1500
|
+
if (typeof event.data !== "string") {
|
1412
1501
|
return;
|
1413
1502
|
}
|
1414
1503
|
let message = null;
|
@@ -1438,9 +1527,11 @@ var createCanvasChannel = ({
|
|
1438
1527
|
destroy,
|
1439
1528
|
selectComponent,
|
1440
1529
|
updateComposition,
|
1530
|
+
updateCompositionInternal,
|
1441
1531
|
on,
|
1442
1532
|
addComponent,
|
1443
1533
|
moveComponent,
|
1534
|
+
updateComponentParameter,
|
1444
1535
|
dismissPlaceholder,
|
1445
1536
|
updatePreviewSettings,
|
1446
1537
|
reportRenderedCompositions
|
@@ -1585,8 +1676,8 @@ function mapSlotToTestVariations(slot) {
|
|
1585
1676
|
}
|
1586
1677
|
|
1587
1678
|
// src/index.ts
|
1588
|
-
var
|
1589
|
-
var CanvasClientError =
|
1679
|
+
var import_api5 = require("@uniformdev/context/api");
|
1680
|
+
var CanvasClientError = import_api5.ApiClientError;
|
1590
1681
|
// Annotate the CommonJS export names for ESM import in node:
|
1591
1682
|
0 && (module.exports = {
|
1592
1683
|
ApiClientError,
|
@@ -1622,6 +1713,7 @@ var CanvasClientError = import_api4.ApiClientError;
|
|
1622
1713
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
1623
1714
|
IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
|
1624
1715
|
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
1716
|
+
IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
|
1625
1717
|
PLACEHOLDER_ID,
|
1626
1718
|
UncachedCanvasClient,
|
1627
1719
|
UniqueBatchEntries,
|
@@ -1644,6 +1736,8 @@ var CanvasClientError = import_api4.ApiClientError;
|
|
1644
1736
|
isReportRenderedCompositionsMessage,
|
1645
1737
|
isSelectComponentMessage,
|
1646
1738
|
isSystemComponentDefinition,
|
1739
|
+
isUpdateComponentParameterMessage,
|
1740
|
+
isUpdateCompositionInternalMessage,
|
1647
1741
|
isUpdateCompositionMessage,
|
1648
1742
|
isUpdatePreviewSettingsMessage,
|
1649
1743
|
localize,
|
@@ -1651,5 +1745,6 @@ var CanvasClientError = import_api4.ApiClientError;
|
|
1651
1745
|
mapSlotToTestVariations,
|
1652
1746
|
nullLimitPolicy,
|
1653
1747
|
subscribeToComposition,
|
1748
|
+
unstable_CompositionRelationshipClient,
|
1654
1749
|
walkComponentTree
|
1655
1750
|
});
|
package/dist/index.mjs
CHANGED
@@ -548,11 +548,74 @@ var UncachedCanvasClient = class extends CanvasClient {
|
|
548
548
|
}
|
549
549
|
};
|
550
550
|
|
551
|
-
// src/
|
551
|
+
// src/CompositionRelationshipClient.ts
|
552
552
|
import { ApiClient as ApiClient2 } from "@uniformdev/context/api";
|
553
|
+
var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
|
554
|
+
var unstable_CompositionRelationshipClient = class extends ApiClient2 {
|
555
|
+
constructor(options) {
|
556
|
+
super(options);
|
557
|
+
this.getDefinitionsRelationships = async ({
|
558
|
+
definitionIds,
|
559
|
+
withCompositions
|
560
|
+
}) => {
|
561
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL, {
|
562
|
+
type: "definition",
|
563
|
+
projectId: this._options.projectId,
|
564
|
+
definitionIds: definitionIds.join(","),
|
565
|
+
withCompositions
|
566
|
+
});
|
567
|
+
return this.apiClient(url);
|
568
|
+
};
|
569
|
+
this.clearAllRelationships = async () => {
|
570
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
|
571
|
+
return this.apiClient(url, {
|
572
|
+
method: "POST",
|
573
|
+
body: JSON.stringify({
|
574
|
+
type: "clear",
|
575
|
+
projectId: this._options.projectId
|
576
|
+
})
|
577
|
+
});
|
578
|
+
};
|
579
|
+
this.indexCompositionRelationships = async ({
|
580
|
+
state,
|
581
|
+
compositionId
|
582
|
+
}) => {
|
583
|
+
const url = this.createUrl(COMPOSITION_RELATIONSHIP_URL);
|
584
|
+
return this.apiClient(url, {
|
585
|
+
method: "POST",
|
586
|
+
body: JSON.stringify({
|
587
|
+
type: "index",
|
588
|
+
projectId: this._options.projectId,
|
589
|
+
state,
|
590
|
+
compositionId
|
591
|
+
})
|
592
|
+
});
|
593
|
+
};
|
594
|
+
this.getVersion = async () => {
|
595
|
+
const url = this.createUrl("/api/v1/usage-tracking", {
|
596
|
+
projectId: this._options.projectId
|
597
|
+
});
|
598
|
+
return this.apiClient(url).then((response) => response.version);
|
599
|
+
};
|
600
|
+
this.setVersion = async (version) => {
|
601
|
+
const url = this.createUrl("/api/v1/usage-tracking");
|
602
|
+
return this.apiClient(url, {
|
603
|
+
method: "POST",
|
604
|
+
body: JSON.stringify({
|
605
|
+
projectId: this._options.projectId,
|
606
|
+
version
|
607
|
+
})
|
608
|
+
});
|
609
|
+
};
|
610
|
+
this._options = options;
|
611
|
+
}
|
612
|
+
};
|
613
|
+
|
614
|
+
// src/DataSourceClient.ts
|
615
|
+
import { ApiClient as ApiClient3 } from "@uniformdev/context/api";
|
553
616
|
var dataSourceUrl = "/api/v1/data-source";
|
554
617
|
var dataSourcesUrl = "/api/v1/data-sources";
|
555
|
-
var DataSourceClient = class extends
|
618
|
+
var DataSourceClient = class extends ApiClient3 {
|
556
619
|
constructor(options) {
|
557
620
|
super(options);
|
558
621
|
}
|
@@ -589,9 +652,9 @@ var DataSourceClient = class extends ApiClient2 {
|
|
589
652
|
};
|
590
653
|
|
591
654
|
// src/DataTypeClient.ts
|
592
|
-
import { ApiClient as
|
655
|
+
import { ApiClient as ApiClient4 } from "@uniformdev/context/api";
|
593
656
|
var _url;
|
594
|
-
var _DataTypeClient = class extends
|
657
|
+
var _DataTypeClient = class extends ApiClient4 {
|
595
658
|
constructor(options) {
|
596
659
|
super(options);
|
597
660
|
}
|
@@ -1121,6 +1184,7 @@ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1121
1184
|
var IN_CONTEXT_EDITOR_COMPONENT_START_ROLE = "uniform-component-start";
|
1122
1185
|
var IN_CONTEXT_EDITOR_COMPONENT_END_ROLE = "uniform-component-end";
|
1123
1186
|
var IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID = "uniform-canvas-preview-script";
|
1187
|
+
var IS_RENDERED_BY_UNIFORM_ATTRIBUTE = "data-is-rendered-by-uniform";
|
1124
1188
|
var PLACEHOLDER_ID = "placeholder";
|
1125
1189
|
var EMPTY_COMPOSITION = {
|
1126
1190
|
_id: "_empty_composition_id",
|
@@ -1230,12 +1294,18 @@ var isReadyMessage = (message) => {
|
|
1230
1294
|
var isUpdateCompositionMessage = (message) => {
|
1231
1295
|
return message.type === "update-composition";
|
1232
1296
|
};
|
1297
|
+
var isUpdateCompositionInternalMessage = (message) => {
|
1298
|
+
return message.type === "update-composition-internal";
|
1299
|
+
};
|
1233
1300
|
var isAddComponentMessage = (message) => {
|
1234
1301
|
return message.type === "add-component";
|
1235
1302
|
};
|
1236
1303
|
var isMovingComponentMessage = (message) => {
|
1237
1304
|
return message.type === "move-component";
|
1238
1305
|
};
|
1306
|
+
var isUpdateComponentParameterMessage = (message) => {
|
1307
|
+
return message.type === "update-component-parameter";
|
1308
|
+
};
|
1239
1309
|
var isDismissPlaceholderMessage = (message) => {
|
1240
1310
|
return message.type === "dismiss-placeholder";
|
1241
1311
|
};
|
@@ -1297,6 +1367,14 @@ var createCanvasChannel = ({
|
|
1297
1367
|
};
|
1298
1368
|
postMessage(message);
|
1299
1369
|
};
|
1370
|
+
const updateCompositionInternal = (composition, hash) => {
|
1371
|
+
const message = {
|
1372
|
+
type: "update-composition-internal",
|
1373
|
+
composition,
|
1374
|
+
hash
|
1375
|
+
};
|
1376
|
+
postMessage(message);
|
1377
|
+
};
|
1300
1378
|
const addComponent = (options) => {
|
1301
1379
|
const message = {
|
1302
1380
|
...options,
|
@@ -1311,6 +1389,13 @@ var createCanvasChannel = ({
|
|
1311
1389
|
};
|
1312
1390
|
postMessage(message);
|
1313
1391
|
};
|
1392
|
+
const updateComponentParameter = (options) => {
|
1393
|
+
const message = {
|
1394
|
+
...options,
|
1395
|
+
type: "update-component-parameter"
|
1396
|
+
};
|
1397
|
+
postMessage(message);
|
1398
|
+
};
|
1314
1399
|
const dismissPlaceholder = (options) => {
|
1315
1400
|
const message = {
|
1316
1401
|
...options,
|
@@ -1333,7 +1418,7 @@ var createCanvasChannel = ({
|
|
1333
1418
|
postMessage(message);
|
1334
1419
|
};
|
1335
1420
|
const messageEventListener = (event) => {
|
1336
|
-
if (typeof event.data !== "string"
|
1421
|
+
if (typeof event.data !== "string") {
|
1337
1422
|
return;
|
1338
1423
|
}
|
1339
1424
|
let message = null;
|
@@ -1363,9 +1448,11 @@ var createCanvasChannel = ({
|
|
1363
1448
|
destroy,
|
1364
1449
|
selectComponent,
|
1365
1450
|
updateComposition,
|
1451
|
+
updateCompositionInternal,
|
1366
1452
|
on,
|
1367
1453
|
addComponent,
|
1368
1454
|
moveComponent,
|
1455
|
+
updateComponentParameter,
|
1369
1456
|
dismissPlaceholder,
|
1370
1457
|
updatePreviewSettings,
|
1371
1458
|
reportRenderedCompositions
|
@@ -1546,6 +1633,7 @@ export {
|
|
1546
1633
|
IN_CONTEXT_EDITOR_COMPONENT_START_ROLE,
|
1547
1634
|
IN_CONTEXT_EDITOR_EMBED_SCRIPT_ID,
|
1548
1635
|
IN_CONTEXT_EDITOR_QUERY_STRING_PARAM,
|
1636
|
+
IS_RENDERED_BY_UNIFORM_ATTRIBUTE,
|
1549
1637
|
PLACEHOLDER_ID,
|
1550
1638
|
UncachedCanvasClient,
|
1551
1639
|
UniqueBatchEntries,
|
@@ -1568,6 +1656,8 @@ export {
|
|
1568
1656
|
isReportRenderedCompositionsMessage,
|
1569
1657
|
isSelectComponentMessage,
|
1570
1658
|
isSystemComponentDefinition,
|
1659
|
+
isUpdateComponentParameterMessage,
|
1660
|
+
isUpdateCompositionInternalMessage,
|
1571
1661
|
isUpdateCompositionMessage,
|
1572
1662
|
isUpdatePreviewSettingsMessage,
|
1573
1663
|
localize,
|
@@ -1575,5 +1665,6 @@ export {
|
|
1575
1665
|
mapSlotToTestVariations,
|
1576
1666
|
nullLimitPolicy,
|
1577
1667
|
subscribeToComposition,
|
1668
|
+
unstable_CompositionRelationshipClient,
|
1578
1669
|
walkComponentTree
|
1579
1670
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uniformdev/canvas",
|
3
|
-
"version": "19.
|
3
|
+
"version": "19.1.1-alpha.1+3ec68fe9d",
|
4
4
|
"description": "Common functionality and types for Uniform Canvas",
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
6
6
|
"main": "./dist/index.js",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
"pusher-js": "8.0.1"
|
48
48
|
},
|
49
49
|
"dependencies": {
|
50
|
-
"@uniformdev/context": "19.
|
50
|
+
"@uniformdev/context": "19.1.1-alpha.1+3ec68fe9d"
|
51
51
|
},
|
52
52
|
"files": [
|
53
53
|
"/dist"
|
@@ -55,5 +55,5 @@
|
|
55
55
|
"publishConfig": {
|
56
56
|
"access": "public"
|
57
57
|
},
|
58
|
-
"gitHead": "
|
58
|
+
"gitHead": "3ec68fe9d54c7128e57cc8a5c8116fe968f65865"
|
59
59
|
}
|