@plasmicapp/react-web 0.2.188 → 0.2.190

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/all.d.ts CHANGED
@@ -10998,17 +10998,32 @@ interface CanvasComponentProps<Data = any> {
10998
10998
  setControlContextData?: (data: Data) => void;
10999
10999
  }
11000
11000
  declare type InferDataType<P> = P extends CanvasComponentProps<infer Data> ? Data : any;
11001
+ declare type ControlExtras = {
11002
+ path: (string | number)[];
11003
+ };
11001
11004
  /**
11002
- * Config option that takes the context (e.g., props) of the component instance
11003
- * to dynamically set its value.
11005
+ * Context that we pass back to control functions.
11006
+ */
11007
+ declare type ControlContext<P> = [
11008
+ /**
11009
+ * props
11004
11010
  */
11005
- declare type ContextDependentConfig<P, R> = (props: P,
11011
+ P,
11006
11012
  /**
11007
11013
  * `contextData` can be `null` if the prop controls are rendering before
11008
11014
  * the component instance itself (it will re-render once the component
11009
11015
  * calls `setControlContextData`)
11010
11016
  */
11011
- contextData: InferDataType<P> | null) => R;
11017
+ InferDataType<P> | null,
11018
+ /**
11019
+ * Extra information for the control to use
11020
+ */
11021
+ ControlExtras];
11022
+ /**
11023
+ * Config option that takes the context (e.g., props) of the component instance
11024
+ * to dynamically set its value.
11025
+ */
11026
+ declare type ContextDependentConfig<P, R> = (...args: ControlContext<P>) => R;
11012
11027
  interface PropTypeBase<P> {
11013
11028
  displayName?: string;
11014
11029
  description?: string;
@@ -11162,7 +11177,7 @@ declare type JSONLikeType<P> = "object" | ({
11162
11177
  /**
11163
11178
  * Optional function that generates a name for this item in the array
11164
11179
  */
11165
- nameFunc?: (item: any) => string | undefined;
11180
+ nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
11166
11181
  } & DefaultValueOrExpr<P, any> & PropTypeBase<P>) | ({
11167
11182
  type: "array";
11168
11183
  itemType?: {
@@ -11173,8 +11188,33 @@ declare type JSONLikeType<P> = "object" | ({
11173
11188
  /**
11174
11189
  * Optional function that generates a name for this item in the array
11175
11190
  */
11176
- nameFunc?: (item: any) => string | undefined;
11191
+ nameFunc?: (item: any, ...args: ControlContext<P>) => string | undefined;
11177
11192
  };
11193
+ /**
11194
+ * Optional function that determines whether the user can delete a given item.
11195
+ */
11196
+ unstable__canDelete?: (item: any, ...args: ControlContext<P>) => boolean;
11197
+ /**
11198
+ * Specify how to let Plasmic know how to update its own internal representation of the data when the value has
11199
+ * changed, or when issuing a minimalValue or shownValue that is different.
11200
+ *
11201
+ * Important to specify this if you are expecting any nested expression values in this data type!
11202
+ */
11203
+ unstable__keyFunc?: (item: any) => any;
11204
+ /**
11205
+ * Specify what would be the tentative new value that is set if the user makes any changes.
11206
+ *
11207
+ * Useful for field mappings.
11208
+ *
11209
+ * For instance, consider a Table where we have a `fields` prop:
11210
+ *
11211
+ * - Initially, the value is undefined. But if the user makes any changes, we would want to save an array of at
11212
+ * least three items (corresponding to, say, three columns inferred from a schema).
11213
+ *
11214
+ * - Let's say there are 5 columns in the value. The data schema changes, removing a column and adding two new
11215
+ * ones. Now we would want a different minimal value, containing 6 items.
11216
+ */
11217
+ unstable__minimalValue?: ContextDependentConfig<P, any>;
11178
11218
  } & DefaultValueOrExpr<P, any[]> & PropTypeBase<P>) | ({
11179
11219
  type: "dataSource";
11180
11220
  dataSource: "airtable" | "cms";
@@ -11903,31 +11943,6 @@ declare type Queries = {
11903
11943
  };
11904
11944
  declare function createUseScreenVariants(isMulti: boolean, screenQueries: Queries): () => string | string[] | undefined;
11905
11945
 
11906
- /**
11907
- * Returns whether the component is currently being server side rendered or
11908
- * hydrated on the client. Can be used to delay browser-specific rendering
11909
- * until after hydration.
11910
- */
11911
- declare function useIsSSR$1(): boolean;
11912
-
11913
- declare type PlasmicTranslator = (str: string, opts?: {
11914
- components?: {
11915
- [key: string]: React__default.ReactElement;
11916
- };
11917
- }) => React__default.ReactNode;
11918
- interface TransProps {
11919
- transKey?: string;
11920
- children?: React__default.ReactNode;
11921
- }
11922
- declare function genTranslatableString(elt: React__default.ReactNode): {
11923
- str: string;
11924
- components: {
11925
- [key: string]: React__default.ReactElement<any, string | ((props: any) => React__default.ReactElement<any, any> | null) | (new (props: any) => React__default.Component<any, any, any>)>;
11926
- };
11927
- componentsCount: number;
11928
- };
11929
- declare function Trans({ transKey, children }: TransProps): React__default.ReactNode;
11930
-
11931
11946
  interface PlasmicDataSourceContextValue {
11932
11947
  userAuthToken?: string | null;
11933
11948
  isUserLoading?: boolean;
@@ -11953,7 +11968,32 @@ declare function useCurrentUser(): {
11953
11968
  };
11954
11969
  declare const PlasmicDataSourceContextProvider: React__default.Provider<PlasmicDataSourceContextValue | undefined>;
11955
11970
 
11956
- interface PlasmicRootProviderProps {
11971
+ /**
11972
+ * Returns whether the component is currently being server side rendered or
11973
+ * hydrated on the client. Can be used to delay browser-specific rendering
11974
+ * until after hydration.
11975
+ */
11976
+ declare function useIsSSR$1(): boolean;
11977
+
11978
+ declare type PlasmicTranslator = (str: string, opts?: {
11979
+ components?: {
11980
+ [key: string]: React__default.ReactElement;
11981
+ };
11982
+ }) => React__default.ReactNode;
11983
+ interface TransProps {
11984
+ transKey?: string;
11985
+ children?: React__default.ReactNode;
11986
+ }
11987
+ declare function genTranslatableString(elt: React__default.ReactNode): {
11988
+ str: string;
11989
+ components: {
11990
+ [key: string]: React__default.ReactElement<any, string | ((props: any) => React__default.ReactElement<any, any> | null) | (new (props: any) => React__default.Component<any, any, any>)>;
11991
+ };
11992
+ componentsCount: number;
11993
+ };
11994
+ declare function Trans({ transKey, children }: TransProps): React__default.ReactNode;
11995
+
11996
+ interface PlasmicRootProviderProps extends PlasmicDataSourceContextValue {
11957
11997
  platform?: "nextjs" | "gatsby";
11958
11998
  children?: React$1.ReactNode;
11959
11999
  translator?: PlasmicTranslator;