@webstudio-is/react-sdk 0.78.0 → 0.80.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.
Files changed (40) hide show
  1. package/lib/cjs/context.js +8 -2
  2. package/lib/cjs/css/normalize.js +23 -43
  3. package/lib/cjs/css/presets.js +1 -111
  4. package/lib/cjs/embed-template.js +45 -16
  5. package/lib/cjs/expression.js +137 -22
  6. package/lib/cjs/index.js +6 -2
  7. package/lib/cjs/props.js +32 -2
  8. package/lib/cjs/tree/create-elements-tree.js +7 -2
  9. package/lib/cjs/tree/root.js +15 -7
  10. package/lib/context.js +8 -2
  11. package/lib/css/normalize.js +23 -33
  12. package/lib/css/presets.js +1 -111
  13. package/lib/embed-template.js +45 -16
  14. package/lib/expression.js +137 -22
  15. package/lib/index.js +13 -5
  16. package/lib/props.js +32 -2
  17. package/lib/tree/create-elements-tree.js +10 -3
  18. package/lib/tree/root.js +16 -8
  19. package/lib/types/components/component-meta.d.ts +30 -0
  20. package/lib/types/context.d.ts +5 -2
  21. package/lib/types/css/normalize.d.ts +0 -520
  22. package/lib/types/css/presets.d.ts +0 -282
  23. package/lib/types/embed-template.d.ts +38 -0
  24. package/lib/types/expression.d.ts +12 -4
  25. package/lib/types/index.d.ts +1 -1
  26. package/lib/types/props.d.ts +10 -0
  27. package/lib/types/tree/create-elements-tree.d.ts +6 -5
  28. package/lib/types/tree/root.d.ts +5 -5
  29. package/package.json +17 -16
  30. package/src/context.tsx +17 -4
  31. package/src/css/normalize.ts +23 -32
  32. package/src/css/presets.ts +0 -110
  33. package/src/embed-template.test.ts +84 -4
  34. package/src/embed-template.ts +51 -18
  35. package/src/expression.test.ts +106 -12
  36. package/src/expression.ts +157 -26
  37. package/src/index.ts +6 -2
  38. package/src/props.ts +33 -3
  39. package/src/tree/create-elements-tree.tsx +19 -10
  40. package/src/tree/root.ts +24 -13
@@ -366,6 +366,24 @@ declare const WsComponentPropsMeta: z.ZodObject<{
366
366
  defaultValue?: string | undefined;
367
367
  label?: string | undefined;
368
368
  description?: string | undefined;
369
+ }>, z.ZodObject<{
370
+ control: z.ZodLiteral<"action">;
371
+ type: z.ZodLiteral<"action">;
372
+ label: z.ZodOptional<z.ZodString>;
373
+ description: z.ZodOptional<z.ZodString>;
374
+ required: z.ZodBoolean;
375
+ }, "strip", z.ZodTypeAny, {
376
+ type: "action";
377
+ required: boolean;
378
+ control: "action";
379
+ label?: string | undefined;
380
+ description?: string | undefined;
381
+ }, {
382
+ type: "action";
383
+ required: boolean;
384
+ control: "action";
385
+ label?: string | undefined;
386
+ description?: string | undefined;
369
387
  }>]>>;
370
388
  initialProps: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
371
389
  }, "strip", z.ZodTypeAny, {
@@ -490,6 +508,12 @@ declare const WsComponentPropsMeta: z.ZodObject<{
490
508
  defaultValue?: string | undefined;
491
509
  label?: string | undefined;
492
510
  description?: string | undefined;
511
+ } | {
512
+ type: "action";
513
+ required: boolean;
514
+ control: "action";
515
+ label?: string | undefined;
516
+ description?: string | undefined;
493
517
  }>;
494
518
  initialProps?: string[] | undefined;
495
519
  }, {
@@ -614,6 +638,12 @@ declare const WsComponentPropsMeta: z.ZodObject<{
614
638
  defaultValue?: string | undefined;
615
639
  label?: string | undefined;
616
640
  description?: string | undefined;
641
+ } | {
642
+ type: "action";
643
+ required: boolean;
644
+ control: "action";
645
+ label?: string | undefined;
646
+ description?: string | undefined;
617
647
  }>;
618
648
  initialProps?: string[] | undefined;
619
649
  }>;
@@ -29,10 +29,13 @@ export type Params = {
29
29
  */
30
30
  assetBaseUrl: string;
31
31
  };
32
+ export type DataSourceValues = Map<DataSource["id"], unknown>;
32
33
  export declare const ReactSdkContext: import("react").Context<Params & {
33
34
  propsByInstanceIdStore: ReadableAtom<PropsByInstanceId>;
34
35
  assetsStore: ReadableAtom<Assets>;
35
36
  pagesStore: ReadableAtom<Pages>;
36
- dataSourceValuesStore: ReadableAtom<Map<DataSource["id"], unknown>>;
37
- setDataSourceValue: (instanceId: Instance["id"], prop: Prop["name"], value: unknown) => void;
37
+ dataSourceValuesStore: ReadableAtom<DataSourceValues>;
38
+ executeEffectfulExpression: (expression: string, values: DataSourceValues) => DataSourceValues;
39
+ setDataSourceValues: (newValues: DataSourceValues) => void;
40
+ setBoundDataSourceValue: (instanceId: Instance["id"], prop: Prop["name"], value: unknown) => void;
38
41
  }>;