@plasmicapp/react-web 0.2.406 → 0.2.408

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.
Files changed (2) hide show
  1. package/dist/all.d.ts +99 -43
  2. package/package.json +4 -4
package/dist/all.d.ts CHANGED
@@ -11392,10 +11392,14 @@ type ControlExtras = {
11392
11392
  item?: any;
11393
11393
  };
11394
11394
  type InferDataType<P> = P extends CanvasComponentProps<infer Data> ? Data : any;
11395
- interface CommonTypeBase<Ctx extends any[]> {
11395
+ interface CommonTypeBase {
11396
11396
  description?: string;
11397
11397
  helpText?: string;
11398
- required?: boolean;
11398
+ /**
11399
+ * If true, will hide the prop in a collapsed section; good for props that
11400
+ * should not usually be used.
11401
+ */
11402
+ advanced?: boolean;
11399
11403
  /**
11400
11404
  * If the user has chosen to use a dynamic expression for this prop, provide
11401
11405
  * a hint as to the expected values that the expression should evaluate to.
@@ -11403,16 +11407,22 @@ interface CommonTypeBase<Ctx extends any[]> {
11403
11407
  * markdown in the text here.
11404
11408
  */
11405
11409
  exprHint?: string;
11406
- /**
11407
- * Function for whether this prop should be hidden in the right panel,
11408
- * given the current props for this component
11409
- */
11410
- hidden?: ContextDependentConfig<Ctx, boolean>;
11411
11410
  /**
11412
11411
  * If true, does not allow the user to use a dynamic expression for this prop
11413
11412
  */
11414
11413
  disableDynamicValue?: boolean;
11415
11414
  }
11415
+ interface Defaultable<Ctx extends any[], T> {
11416
+ /**
11417
+ * Default value to set for this prop when the component is instantiated
11418
+ */
11419
+ defaultValue?: T;
11420
+ /**
11421
+ * Specify that default when no prop/param is provided,
11422
+ * so the Plasmic user can see it in the studio UI
11423
+ */
11424
+ defaultValueHint?: T | ContextDependentConfig<Ctx, T | undefined>;
11425
+ }
11416
11426
 
11417
11427
  type ChoiceValue = string | number | boolean;
11418
11428
  type ChoiceObject<T = ChoiceValue> = {
@@ -11920,14 +11930,10 @@ type ComponentControlContext<P> = GenericContext<P, // Full component props
11920
11930
  InferDataType<P> | null, // Canvas data
11921
11931
  ControlExtras>;
11922
11932
  type ComponentContextConfig<Props, R> = ContextDependentConfig<ComponentControlContext<Props>, R>;
11923
- interface PropTypeBase<Ctx extends any[]> extends CommonTypeBase<Ctx> {
11933
+ interface PropTypeBase<Ctx extends any[]> extends CommonTypeBase {
11924
11934
  displayName?: string;
11935
+ required?: boolean;
11925
11936
  readOnly?: boolean | ContextDependentConfig<Ctx, boolean>;
11926
- /**
11927
- * If true, will hide the prop in a collapsed section; good for props that
11928
- * should not usually be used.
11929
- */
11930
- advanced?: boolean;
11931
11937
  /**
11932
11938
  * If set to true, the component will be remounted when the prop value is updated.
11933
11939
  * (This behavior only applies to canvas)
@@ -11937,17 +11943,13 @@ interface PropTypeBase<Ctx extends any[]> extends CommonTypeBase<Ctx> {
11937
11943
  * If true, the prop can't be overriden in different variants.
11938
11944
  */
11939
11945
  invariantable?: boolean;
11940
- }
11941
- interface Defaultable<Ctx extends any[], T> {
11942
11946
  /**
11943
- * Default value to set for this prop when the component is instantiated
11944
- */
11945
- defaultValue?: T;
11946
- /**
11947
- * If no prop is given, the component uses a default; specify what
11948
- * that default is so the Plasmic user can see it in the studio UI
11947
+ * Function for whether this prop should be hidden in the right panel,
11948
+ * given the current props for this component
11949
11949
  */
11950
- defaultValueHint?: T | ContextDependentConfig<Ctx, T | undefined>;
11950
+ hidden?: ContextDependentConfig<Ctx, boolean>;
11951
+ }
11952
+ interface ExtendedDefaultable<Ctx extends any[], T> extends Defaultable<Ctx, T> {
11951
11953
  /**
11952
11954
  * Use a dynamic value expression as the default instead
11953
11955
  */
@@ -11975,7 +11977,7 @@ interface Controllable {
11975
11977
  */
11976
11978
  uncontrolledProp?: string;
11977
11979
  }
11978
- type PropTypeBaseDefault<P, T> = PropTypeBase<ComponentControlContext<P>> & Defaultable<ComponentControlContext<P>, T> & Controllable;
11980
+ type PropTypeBaseDefault<P, T> = PropTypeBase<ComponentControlContext<P>> & ExtendedDefaultable<ComponentControlContext<P>, T> & Controllable;
11979
11981
  type PlainStringType$1<P> = PropTypeBaseDefault<P, string> & PlainStringCore;
11980
11982
  type CodeStringType<P> = PropTypeBaseDefault<P, string> & CodeStringCore;
11981
11983
  type RichTextType<P> = PropTypeBaseDefault<P, string> & RichTextCore;
@@ -12206,47 +12208,98 @@ declare global {
12206
12208
  }
12207
12209
  }
12208
12210
 
12211
+ /**
12212
+ * Control type for building a custom query format.
12213
+ *
12214
+ * This control is based on react-awesome-query-builder
12215
+ * and returns data in JsonLogic format.
12216
+ *
12217
+ * If using this control type, it's recommended to install
12218
+ * @react-awesome-query-builder/core and json-logic-js as devDependencies
12219
+ * so that you can reference their types.
12220
+ *
12221
+ * References:
12222
+ * - https://github.com/ukrbublik/react-awesome-query-builder
12223
+ * - https://github.com/jwadhams/json-logic-js
12224
+ * - https://jsonlogic.com/
12225
+ */
12226
+ interface QueryBuilderCore<Ctx extends any[]> {
12227
+ type: "queryBuilder";
12228
+ /**
12229
+ * Return a @react-awesome-query-builder/core `Config` that will be merged
12230
+ * with Plasmic's built-in config.
12231
+ *
12232
+ * https://github.com/plasmicapp/plasmic/blob/master/platform/wab/src/wab/client/components/QueryBuilder/QueryBuilderConfig.tsx
12233
+ *
12234
+ * At a minimum, this should return fields and their types.
12235
+ * For configuration options, see react-awesome-query-builder docs.
12236
+ */
12237
+ config: ContextDependentConfig<Ctx, SimplifiedConfig>;
12238
+ }
12239
+ /**
12240
+ * A simplified subset of @react-awesome-query-builder/core `Config`.
12241
+ */
12242
+ interface SimplifiedConfig {
12243
+ fields: SimplifiedFields;
12244
+ }
12245
+ /**
12246
+ * A simplified subset of @react-awesome-query-builder/core `Fields`.
12247
+ */
12248
+ interface SimplifiedFields {
12249
+ [key: string]: SimplifiedField;
12250
+ }
12251
+ /**
12252
+ * A simplified subset of @react-awesome-query-builder/core `FieldOrGroup`.
12253
+ */
12254
+ interface SimplifiedField {
12255
+ type: "text" | "number" | "boolean" | "date" | "time" | "datetime" | "select" | "multiselect" | "treeselect" | "treemultiselect" | string;
12256
+ label?: string;
12257
+ defaultValue?: unknown;
12258
+ fieldSettings?: {};
12259
+ }
12260
+
12209
12261
  type FunctionControlContext<P> = GenericContext<Partial<P>, // Partial function props
12210
12262
  any>;
12211
12263
  type FunctionContextConfig<Args extends any[], R> = ContextDependentConfig<FunctionControlContext<Args>, R>;
12212
- interface BaseParam {
12264
+ interface ParamTypeBase extends CommonTypeBase {
12213
12265
  name: string;
12214
- description?: string;
12215
12266
  isOptional?: boolean;
12216
12267
  isRestParameter?: boolean;
12217
12268
  }
12218
- interface FunctionMeta<Args extends any[] = any> extends CommonTypeBase<FunctionControlContext<Args>> {
12269
+ type ParamTypeBaseDefault<Ctx extends any[], T> = ParamTypeBase & Defaultable<Ctx, T>;
12270
+ interface FunctionMeta extends CommonTypeBase {
12219
12271
  name: string;
12220
12272
  rest?: boolean;
12221
12273
  }
12222
- interface PlainStringType<T extends Nullish<string> = string> extends BaseParam {
12274
+ interface PlainStringType<T extends Nullish<string> = string> extends ParamTypeBaseDefault<any[], T> {
12223
12275
  type: "string" | `'${T}'`;
12224
12276
  }
12225
12277
  type StringType<P, T extends string = string> = "string" | PlainStringType<T> | ChoiceType<P, T> | DateStringType | DateRangeStringsType | AnyType;
12226
- interface PlainNumberType<T extends Nullish<number> = number> extends BaseParam {
12278
+ interface PlainNumberType<T extends Nullish<number> = number> extends ParamTypeBaseDefault<any[], T> {
12227
12279
  type: "number" | `${number extends T ? number : T}`;
12228
12280
  }
12229
- type NumberType<P, T extends number = number> = PlainNumberType<T> | (BaseParam & NumberTypeBaseCore<FunctionControlContext<P>>) | ChoiceType<P, T> | AnyType;
12230
- interface PlainBooleanType<T extends Nullish<boolean> = boolean> extends BaseParam {
12281
+ type NumberType<P, T extends number = number> = PlainNumberType<T> | (ParamTypeBaseDefault<FunctionControlContext<P>, T> & NumberTypeBaseCore<FunctionControlContext<P>>) | ChoiceType<P, T> | AnyType;
12282
+ interface PlainBooleanType<T extends Nullish<boolean> = boolean> extends ParamTypeBaseDefault<any[], T> {
12231
12283
  type: "boolean" | `${boolean extends T ? boolean : T}`;
12232
12284
  }
12233
- type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | (BaseParam & RichBooleanCore) | ChoiceType<P, T> | AnyType;
12234
- type GraphQLType<P> = BaseParam & GraphQLCore<FunctionControlContext<P>>;
12235
- interface PlainNullType extends BaseParam {
12285
+ type BooleanType<P, T extends boolean = boolean> = PlainBooleanType<T> | (ParamTypeBaseDefault<FunctionControlContext<P>, T> & RichBooleanCore) | ChoiceType<P, T> | AnyType;
12286
+ type GraphQLType<P> = ParamTypeBaseDefault<FunctionControlContext<P>, any> & GraphQLCore<FunctionControlContext<P>>;
12287
+ interface PlainNullType extends ParamTypeBaseDefault<any[], null> {
12236
12288
  type: "null";
12237
12289
  }
12238
12290
  type NullType = PlainNullType | AnyType;
12239
- interface PlainUndefinedType extends BaseParam {
12291
+ interface PlainUndefinedType extends ParamTypeBaseDefault<any[], undefined> {
12240
12292
  type: "undefined";
12241
12293
  }
12242
12294
  type UndefinedType = PlainUndefinedType | AnyType;
12243
- type ObjectType<P> = BaseParam & ObjectTypeBaseCore<FunctionControlContext<P>, AnyTyping<P, any>>;
12244
- type ArrayType<P> = BaseParam & ArrayTypeBaseCore<FunctionControlContext<P>, AnyTyping<P, any>>;
12245
- interface PlainAnyType extends BaseParam {
12295
+ type ObjectType<P> = ParamTypeBaseDefault<FunctionControlContext<P>, Record<string, any>> & ObjectTypeBaseCore<FunctionControlContext<P>, AnyTyping<P, any>>;
12296
+ type ArrayType<P> = ParamTypeBaseDefault<FunctionControlContext<P>, any[]> & ArrayTypeBaseCore<FunctionControlContext<P>, AnyTyping<P, any>>;
12297
+ type QueryBuilderType<P> = ParamTypeBaseDefault<FunctionControlContext<P>, any> & QueryBuilderCore<FunctionControlContext<P>>;
12298
+ interface PlainAnyType extends ParamTypeBaseDefault<FunctionControlContext<any>, any> {
12246
12299
  type: "any";
12247
12300
  }
12248
12301
  type AnyType = PlainAnyType;
12249
- interface PlainVoidType extends BaseParam {
12302
+ interface PlainVoidType extends ParamTypeBase {
12250
12303
  type: "void";
12251
12304
  }
12252
12305
  type VoidType = PlainVoidType | AnyType;
@@ -12254,7 +12307,7 @@ type IsAny<T> = 0 extends 1 & T ? true : false;
12254
12307
  type CommonType<P, T> = T extends GraphQLValue ? GraphQLType<P> : T extends null ? NullType : T extends undefined ? UndefinedType : T extends Array<any> ? ArrayType<P> : T extends object ? ObjectType<P> : AnyType;
12255
12308
  type AnyTyping<P, T> = T extends string ? StringType<P, T> : T extends number ? NumberType<P, T> : T extends boolean ? BooleanType<P, T> : CommonType<P, T>;
12256
12309
  type ToTuple<T> = T extends any[] ? T : never;
12257
- type FunctionChoiceType<Args, Opt extends ChoiceValue = ChoiceValue> = FunctionMeta<ToTuple<Args>> & ChoiceCore<FunctionControlContext<ToTuple<Args>>, Opt>;
12310
+ type FunctionChoiceType<Args, Opt extends ChoiceValue = ChoiceValue> = FunctionMeta & Defaultable<FunctionControlContext<ToTuple<Args>>, Opt | Opt[]> & ChoiceCore<FunctionControlContext<ToTuple<Args>>, Opt>;
12258
12311
  interface SingleChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends FunctionChoiceType<P, Opt> {
12259
12312
  multiSelect?: false;
12260
12313
  }
@@ -12265,14 +12318,17 @@ interface CustomChoiceType<P, Opt extends ChoiceValue = ChoiceValue> extends Fun
12265
12318
  multiSelect: FunctionContextConfig<ToTuple<P>, boolean>;
12266
12319
  }
12267
12320
  type ChoiceType<P, T extends ChoiceValue = ChoiceValue> = SingleChoiceType<P, T> | MultiChoiceType<P, T> | CustomChoiceType<P, T>;
12268
- type DateStringType = BaseParam & DateStringCore;
12269
- type DateRangeStringsType = BaseParam & DateRangeStringsCore;
12270
- interface DynamicType<P> extends BaseParam, DynamicCore<FunctionControlContext<ToTuple<P>>, ParamType<P, any>> {
12321
+ type DateStringType = ParamTypeBaseDefault<FunctionControlContext<string>, string> & DateStringCore;
12322
+ type DateRangeStringsType = ParamTypeBaseDefault<FunctionControlContext<[string, string]>, [
12323
+ string,
12324
+ string
12325
+ ]> & DateRangeStringsCore;
12326
+ interface DynamicType<P> extends ParamTypeBase, DynamicCore<FunctionControlContext<ToTuple<P>>, ParamType<P, any>> {
12271
12327
  }
12272
12328
  type RestrictedType<P, T> = IsAny<T> extends true ? AnyTyping<P, T> : [
12273
12329
  T
12274
12330
  ] extends [string] ? StringType<P, T> : [T] extends [number] ? NumberType<P, T> : [T] extends [boolean] ? BooleanType<P, T> : T extends string | null | undefined ? Exclude<T, null | undefined> extends string ? StringType<P, T extends string ? T : string> : CommonType<P, T> : T extends number | null | undefined ? Exclude<T, null | undefined> extends number ? NumberType<P, T extends number ? T : number> : CommonType<P, T> : T extends boolean | null | undefined ? Exclude<T, null | undefined> extends boolean ? BooleanType<P, T extends boolean ? T : boolean> : CommonType<P, T> : CommonType<P, T>;
12275
- type ParamType<P, T> = RestrictedType<P, T> | DynamicType<P>;
12331
+ type ParamType<P, T> = RestrictedType<P, T> | DynamicType<P> | QueryBuilderType<P>;
12276
12332
  type RequiredParam<P, T> = ParamType<P, T> & {
12277
12333
  isOptional?: false;
12278
12334
  isRestParameter?: false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/react-web",
3
- "version": "0.2.406",
3
+ "version": "0.2.408",
4
4
  "description": "plasmic library for rendering in the presentational style",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -96,9 +96,9 @@
96
96
  },
97
97
  "dependencies": {
98
98
  "@plasmicapp/auth-react": "0.0.24",
99
- "@plasmicapp/data-sources": "0.1.191",
99
+ "@plasmicapp/data-sources": "0.1.193",
100
100
  "@plasmicapp/data-sources-context": "0.1.22",
101
- "@plasmicapp/host": "1.0.227",
101
+ "@plasmicapp/host": "1.0.229",
102
102
  "@plasmicapp/loader-splits": "1.0.66",
103
103
  "@plasmicapp/nextjs-app-router": "1.0.19",
104
104
  "@plasmicapp/prepass": "1.0.21",
@@ -153,5 +153,5 @@
153
153
  "react": ">=16.8.0",
154
154
  "react-dom": ">=16.8.0"
155
155
  },
156
- "gitHead": "91363e5167ada12970c50f6178d96375d3df9437"
156
+ "gitHead": "bf8e3de2d53a1280fa9bc20fffbe6641eb73ab02"
157
157
  }