@uniformdev/canvas-next-rsc 19.181.3-alpha.0 → 19.182.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.
package/dist/index.esm.js CHANGED
@@ -368,7 +368,7 @@ var ContextUpdateTransfer = async ({
368
368
  return null;
369
369
  }
370
370
  if (serverContext) {
371
- await serverContext.__INTERNAL__.update(result);
371
+ await serverContext.internal_update(result);
372
372
  }
373
373
  return /* @__PURE__ */ React.createElement(ContextUpdateTransferClient, { ts: (/* @__PURE__ */ new Date()).valueOf(), update: result });
374
374
  };
@@ -446,12 +446,7 @@ var createServerUniformContextFromManifest = async (options) => {
446
446
  ...options || {},
447
447
  serverCookieValue: (_a = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
448
448
  });
449
- return {
450
- ...context,
451
- __INTERNAL__: {
452
- update: (...props) => context.update(...props)
453
- }
454
- };
449
+ return context;
455
450
  };
456
451
 
457
452
  // src/utils/route.ts
@@ -687,10 +682,23 @@ var TestServer = async (props) => {
687
682
  };
688
683
 
689
684
  // src/components/VisibilityRulesWrapper.tsx
685
+ import {
686
+ createQuirksVisibilityRule,
687
+ evaluateNodeVisibilityParameter
688
+ } from "@uniformdev/canvas";
690
689
  import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
691
690
  import React6 from "react";
692
691
  var VisibilityRulesWrapper = (props) => {
693
- return /* @__PURE__ */ React6.createElement(VisibilityRulesWrapperClient, { ...props });
692
+ const { context, ...rest } = props;
693
+ let isVisible = null;
694
+ if (context) {
695
+ const rules = createQuirksVisibilityRule(context.quirks);
696
+ isVisible = evaluateNodeVisibilityParameter({
697
+ rules,
698
+ parameter: props.parameter
699
+ });
700
+ }
701
+ return /* @__PURE__ */ React6.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
694
702
  };
695
703
 
696
704
  // src/components/UniformComposition.ts
@@ -1004,7 +1012,8 @@ var resolveComponents = ({
1004
1012
  VisibilityRulesWrapper,
1005
1013
  {
1006
1014
  key: `${slotName}-${componentIndex}-visibility`,
1007
- parameter: visibilityRules
1015
+ parameter: visibilityRules,
1016
+ context: serverContext
1008
1017
  },
1009
1018
  childNode
1010
1019
  );
package/dist/index.js CHANGED
@@ -417,7 +417,7 @@ var ContextUpdateTransfer = async ({
417
417
  return null;
418
418
  }
419
419
  if (serverContext) {
420
- await serverContext.__INTERNAL__.update(result);
420
+ await serverContext.internal_update(result);
421
421
  }
422
422
  return /* @__PURE__ */ import_react.default.createElement(import_canvas_next_rsc_client.ContextUpdateTransferClient, { ts: (/* @__PURE__ */ new Date()).valueOf(), update: result });
423
423
  };
@@ -456,7 +456,7 @@ async function generateStaticParams() {
456
456
  }
457
457
 
458
458
  // src/components/UniformComposition.ts
459
- var import_canvas7 = require("@uniformdev/canvas");
459
+ var import_canvas8 = require("@uniformdev/canvas");
460
460
  var import_canvas_next_rsc_client7 = require("@uniformdev/canvas-next-rsc-client");
461
461
  var import_canvas_next_rsc_shared6 = require("@uniformdev/canvas-next-rsc-shared");
462
462
  var import_core = require("@uniformdev/canvas-react/core");
@@ -482,12 +482,7 @@ var createServerUniformContextFromManifest = async (options) => {
482
482
  ...options || {},
483
483
  serverCookieValue: (_a = (0, import_headers2.cookies)().get(import_context.UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
484
484
  });
485
- return {
486
- ...context,
487
- __INTERNAL__: {
488
- update: (...props) => context.update(...props)
489
- }
490
- };
485
+ return context;
491
486
  };
492
487
 
493
488
  // src/utils/route.ts
@@ -717,10 +712,20 @@ var TestServer = async (props) => {
717
712
  };
718
713
 
719
714
  // src/components/VisibilityRulesWrapper.tsx
715
+ var import_canvas7 = require("@uniformdev/canvas");
720
716
  var import_canvas_next_rsc_client6 = require("@uniformdev/canvas-next-rsc-client");
721
717
  var import_react8 = __toESM(require("react"));
722
718
  var VisibilityRulesWrapper = (props) => {
723
- return /* @__PURE__ */ import_react8.default.createElement(import_canvas_next_rsc_client6.VisibilityRulesWrapperClient, { ...props });
719
+ const { context, ...rest } = props;
720
+ let isVisible = null;
721
+ if (context) {
722
+ const rules = (0, import_canvas7.createQuirksVisibilityRule)(context.quirks);
723
+ isVisible = (0, import_canvas7.evaluateNodeVisibilityParameter)({
724
+ rules,
725
+ parameter: props.parameter
726
+ });
727
+ }
728
+ return /* @__PURE__ */ import_react8.default.createElement(import_canvas_next_rsc_client6.VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
724
729
  };
725
730
 
726
731
  // src/components/UniformComposition.ts
@@ -748,8 +753,8 @@ var UniformComposition = async ({
748
753
  (0, import_navigation.redirect)(href);
749
754
  }
750
755
  const state = route.compositionApiResponse.state;
751
- if (state === import_canvas7.CANVAS_DRAFT_STATE || state === import_canvas7.CANVAS_EDITOR_STATE) {
752
- (0, import_canvas7.walkNodeTree)(route.compositionApiResponse.composition, (node) => {
756
+ if (state === import_canvas8.CANVAS_DRAFT_STATE || state === import_canvas8.CANVAS_EDITOR_STATE) {
757
+ (0, import_canvas8.walkNodeTree)(route.compositionApiResponse.composition, (node) => {
753
758
  if (node.type === "component" && node.node.parameters) {
754
759
  Object.keys(node.node.parameters).forEach((key) => {
755
760
  const parameter = node.node.parameters[key];
@@ -816,10 +821,10 @@ var isServerComponent = ({
816
821
  serverContext
817
822
  }) => {
818
823
  var _a, _b;
819
- if (component.type === import_canvas7.CANVAS_PERSONALIZE_TYPE) {
824
+ if (component.type === import_canvas8.CANVAS_PERSONALIZE_TYPE) {
820
825
  return serverContext && ((_a = getServerConfig().evaluation) == null ? void 0 : _a.personalization) !== "client";
821
826
  }
822
- if (component.type === import_canvas7.CANVAS_TEST_TYPE) {
827
+ if (component.type === import_canvas8.CANVAS_TEST_TYPE) {
823
828
  return serverContext && ((_b = getServerConfig().evaluation) == null ? void 0 : _b.testing) !== "client";
824
829
  }
825
830
  };
@@ -831,11 +836,11 @@ var resolveSystemComponent = ({
831
836
  const config = getServerConfig();
832
837
  let resolved = null;
833
838
  let suspense = void 0;
834
- if (component.type === import_canvas7.CANVAS_PERSONALIZE_TYPE) {
839
+ if (component.type === import_canvas8.CANVAS_PERSONALIZE_TYPE) {
835
840
  resolved = server ? PersonalizeServer : PersonalizeClientWrapper;
836
841
  suspense = server && ((_a = config.ppr) == null ? void 0 : _a.personalizationSuspense);
837
842
  }
838
- if (component.type === import_canvas7.CANVAS_TEST_TYPE) {
843
+ if (component.type === import_canvas8.CANVAS_TEST_TYPE) {
839
844
  resolved = server ? TestServer : import_canvas_next_rsc_client7.TestClient;
840
845
  suspense = server && ((_b = config.ppr) == null ? void 0 : _b.testSuspense);
841
846
  }
@@ -944,8 +949,8 @@ var resolveComponents = ({
944
949
  const resolvedComponent = systemComponent || regularComponent;
945
950
  const wrapInSuspense = systemSuspense || componentSuspense;
946
951
  const parameters = (_a = component.parameters) != null ? _a : {};
947
- const enrichmentTags = (_b = parameters[import_canvas7.CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _b.value;
948
- const visibilityRules = (_c = parameters[import_canvas7.CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _c.value;
952
+ const enrichmentTags = (_b = parameters[import_canvas8.CANVAS_ENRICHMENT_TAG_PARAM]) == null ? void 0 : _b.value;
953
+ const visibilityRules = (_c = parameters[import_canvas8.CANVAS_VIZ_CONTROL_PARAM]) == null ? void 0 : _c.value;
949
954
  const key = `${slotName}-${componentIndex}-component`;
950
955
  const componentProps = {
951
956
  ...Object.keys(parameters).reduce((acc, cur) => {
@@ -988,7 +993,7 @@ var resolveComponents = ({
988
993
  if (tagElement) {
989
994
  elements.push(tagElement);
990
995
  }
991
- const isPlaceholder = (0, import_canvas7.isComponentPlaceholderId)(component == null ? void 0 : component._id);
996
+ const isPlaceholder = (0, import_canvas8.isComponentPlaceholderId)(component == null ? void 0 : component._id);
992
997
  childNode = (0, import_react9.createElement)(
993
998
  import_core.PureContextualEditingComponentWrapper,
994
999
  {
@@ -1034,7 +1039,8 @@ var resolveComponents = ({
1034
1039
  VisibilityRulesWrapper,
1035
1040
  {
1036
1041
  key: `${slotName}-${componentIndex}-visibility`,
1037
- parameter: visibilityRules
1042
+ parameter: visibilityRules,
1043
+ context: serverContext
1038
1044
  },
1039
1045
  childNode
1040
1046
  );
@@ -1077,7 +1083,7 @@ var UniformContext = async ({
1077
1083
  };
1078
1084
 
1079
1085
  // src/components/UniformPlayground.tsx
1080
- var import_canvas8 = require("@uniformdev/canvas");
1086
+ var import_canvas9 = require("@uniformdev/canvas");
1081
1087
  var import_navigation2 = require("next/navigation");
1082
1088
  var import_react12 = __toESM(require("react"));
1083
1089
  var UniformPlayground = async ({ searchParams, ...rest }) => {
@@ -1093,7 +1099,7 @@ var UniformPlayground = async ({ searchParams, ...rest }) => {
1093
1099
  type: "no-cache"
1094
1100
  }
1095
1101
  });
1096
- const possibleStates = [import_canvas8.CANVAS_EDITOR_STATE, import_canvas8.CANVAS_DRAFT_STATE];
1102
+ const possibleStates = [import_canvas9.CANVAS_EDITOR_STATE, import_canvas9.CANVAS_DRAFT_STATE];
1097
1103
  let composition = void 0;
1098
1104
  for (let i = 0; i < possibleStates.length; i++) {
1099
1105
  const state = possibleStates[i];
package/dist/index.mjs CHANGED
@@ -368,7 +368,7 @@ var ContextUpdateTransfer = async ({
368
368
  return null;
369
369
  }
370
370
  if (serverContext) {
371
- await serverContext.__INTERNAL__.update(result);
371
+ await serverContext.internal_update(result);
372
372
  }
373
373
  return /* @__PURE__ */ React.createElement(ContextUpdateTransferClient, { ts: (/* @__PURE__ */ new Date()).valueOf(), update: result });
374
374
  };
@@ -446,12 +446,7 @@ var createServerUniformContextFromManifest = async (options) => {
446
446
  ...options || {},
447
447
  serverCookieValue: (_a = cookies().get(UNIFORM_DEFAULT_COOKIE_NAME)) == null ? void 0 : _a.value
448
448
  });
449
- return {
450
- ...context,
451
- __INTERNAL__: {
452
- update: (...props) => context.update(...props)
453
- }
454
- };
449
+ return context;
455
450
  };
456
451
 
457
452
  // src/utils/route.ts
@@ -687,10 +682,23 @@ var TestServer = async (props) => {
687
682
  };
688
683
 
689
684
  // src/components/VisibilityRulesWrapper.tsx
685
+ import {
686
+ createQuirksVisibilityRule,
687
+ evaluateNodeVisibilityParameter
688
+ } from "@uniformdev/canvas";
690
689
  import { VisibilityRulesWrapperClient } from "@uniformdev/canvas-next-rsc-client";
691
690
  import React6 from "react";
692
691
  var VisibilityRulesWrapper = (props) => {
693
- return /* @__PURE__ */ React6.createElement(VisibilityRulesWrapperClient, { ...props });
692
+ const { context, ...rest } = props;
693
+ let isVisible = null;
694
+ if (context) {
695
+ const rules = createQuirksVisibilityRule(context.quirks);
696
+ isVisible = evaluateNodeVisibilityParameter({
697
+ rules,
698
+ parameter: props.parameter
699
+ });
700
+ }
701
+ return /* @__PURE__ */ React6.createElement(VisibilityRulesWrapperClient, { ...rest, initialIsVisible: isVisible });
694
702
  };
695
703
 
696
704
  // src/components/UniformComposition.ts
@@ -1004,7 +1012,8 @@ var resolveComponents = ({
1004
1012
  VisibilityRulesWrapper,
1005
1013
  {
1006
1014
  key: `${slotName}-${componentIndex}-visibility`,
1007
- parameter: visibilityRules
1015
+ parameter: visibilityRules,
1016
+ context: serverContext
1008
1017
  },
1009
1018
  childNode
1010
1019
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas-next-rsc",
3
- "version": "19.181.3-alpha.0+a04bb53ba0",
3
+ "version": "19.182.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -61,15 +61,15 @@
61
61
  "react-dom": "18.3.1"
62
62
  },
63
63
  "dependencies": {
64
- "@uniformdev/canvas": "19.181.3-alpha.0+a04bb53ba0",
65
- "@uniformdev/canvas-next-rsc-client": "^19.181.3-alpha.0+a04bb53ba0",
66
- "@uniformdev/canvas-next-rsc-shared": "^19.181.3-alpha.0+a04bb53ba0",
67
- "@uniformdev/canvas-react": "19.181.3-alpha.0+a04bb53ba0",
68
- "@uniformdev/context": "19.181.3-alpha.0+a04bb53ba0",
69
- "@uniformdev/project-map": "19.181.3-alpha.0+a04bb53ba0",
70
- "@uniformdev/redirect": "19.181.3-alpha.0+a04bb53ba0",
71
- "@uniformdev/richtext": "19.181.3-alpha.0+a04bb53ba0",
72
- "@uniformdev/webhooks": "19.181.3-alpha.0+a04bb53ba0",
64
+ "@uniformdev/canvas": "19.182.0",
65
+ "@uniformdev/canvas-next-rsc-client": "^19.182.0",
66
+ "@uniformdev/canvas-next-rsc-shared": "^19.182.0",
67
+ "@uniformdev/canvas-react": "19.182.0",
68
+ "@uniformdev/context": "19.182.0",
69
+ "@uniformdev/project-map": "19.182.0",
70
+ "@uniformdev/redirect": "19.182.0",
71
+ "@uniformdev/richtext": "19.182.0",
72
+ "@uniformdev/webhooks": "19.182.0",
73
73
  "@vercel/edge-config": "^0.4.0",
74
74
  "encoding": "^0.1.13",
75
75
  "server-only": "^0.0.1",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "access": "public"
88
88
  },
89
- "gitHead": "a04bb53ba05f24066de3b279abc8442e3f3ec1cf"
89
+ "gitHead": "138d94ac9eff7221b6357095578380edf30cdb27"
90
90
  }