@webstudio-is/react-sdk 0.163.0 → 0.167.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/lib/index.js CHANGED
@@ -706,7 +706,8 @@ import {
706
706
  import { StyleValue } from "@webstudio-is/css-engine";
707
707
  var EmbedTemplateText = z2.object({
708
708
  type: z2.literal("text"),
709
- value: z2.string()
709
+ value: z2.string(),
710
+ placeholder: z2.boolean().optional()
710
711
  });
711
712
  var EmbedTemplateExpression = z2.object({
712
713
  type: z2.literal("expression"),
@@ -969,7 +970,8 @@ var createInstancesFromTemplate = (treeTemplate, instances, props, dataSourceByR
969
970
  if (item.type === "text") {
970
971
  parentChildren.push({
971
972
  type: "text",
972
- value: item.value
973
+ value: item.value,
974
+ placeholder: item.placeholder
973
975
  });
974
976
  }
975
977
  if (item.type === "expression") {
@@ -1404,11 +1406,15 @@ var generateJsxChildren = ({
1404
1406
  dataSources,
1405
1407
  usedDataSources,
1406
1408
  indexesWithinAncestors,
1407
- classesMap
1409
+ classesMap,
1410
+ excludePlaceholders
1408
1411
  }) => {
1409
1412
  let generatedChildren = "";
1410
1413
  for (const child of children) {
1411
1414
  if (child.type === "text") {
1415
+ if (excludePlaceholders && child.placeholder === true) {
1416
+ continue;
1417
+ }
1412
1418
  generatedChildren += child.value.split("\n").map((line) => `{${JSON.stringify(line)}}
1413
1419
  `).join(`<br />
1414
1420
  `);
@@ -1447,7 +1453,8 @@ var generateJsxChildren = ({
1447
1453
  props,
1448
1454
  dataSources,
1449
1455
  usedDataSources,
1450
- indexesWithinAncestors
1456
+ indexesWithinAncestors,
1457
+ excludePlaceholders
1451
1458
  })
1452
1459
  });
1453
1460
  continue;
@@ -10,7 +10,7 @@ export declare const generateJsxElement: ({ scope, instance, props, dataSources,
10
10
  children: string;
11
11
  classesMap?: Map<string, Array<string>>;
12
12
  }) => string;
13
- export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, }: {
13
+ export declare const generateJsxChildren: ({ scope, children, instances, props, dataSources, usedDataSources, indexesWithinAncestors, classesMap, excludePlaceholders, }: {
14
14
  scope: Scope;
15
15
  children: Instance["children"];
16
16
  instances: Instances;
@@ -19,6 +19,7 @@ export declare const generateJsxChildren: ({ scope, children, instances, props,
19
19
  usedDataSources: DataSources;
20
20
  indexesWithinAncestors: IndexesWithinAncestors;
21
21
  classesMap?: Map<string, Array<string>>;
22
+ excludePlaceholders?: boolean;
22
23
  }) => string;
23
24
  export declare const generateWebstudioComponent: ({ scope, name, rootInstanceId, parameters, instances, props, dataSources, indexesWithinAncestors, classesMap, }: {
24
25
  scope: Scope;
@@ -3365,12 +3365,15 @@ export declare const WsComponentMeta: z.ZodObject<{
3365
3365
  template: z.ZodOptional<z.ZodLazy<z.ZodArray<z.ZodUnion<[z.ZodType<import("../embed-template").EmbedTemplateInstance, z.ZodTypeDef, import("../embed-template").EmbedTemplateInstance>, z.ZodObject<{
3366
3366
  type: z.ZodLiteral<"text">;
3367
3367
  value: z.ZodString;
3368
+ placeholder: z.ZodOptional<z.ZodBoolean>;
3368
3369
  }, "strip", z.ZodTypeAny, {
3369
3370
  value: string;
3370
3371
  type: "text";
3372
+ placeholder?: boolean | undefined;
3371
3373
  }, {
3372
3374
  value: string;
3373
3375
  type: "text";
3376
+ placeholder?: boolean | undefined;
3374
3377
  }>, z.ZodObject<{
3375
3378
  type: z.ZodLiteral<"expression">;
3376
3379
  value: z.ZodString;
@@ -4270,6 +4273,7 @@ export declare const WsComponentMeta: z.ZodObject<{
4270
4273
  template?: ({
4271
4274
  value: string;
4272
4275
  type: "text";
4276
+ placeholder?: boolean | undefined;
4273
4277
  } | {
4274
4278
  value: string;
4275
4279
  type: "expression";
@@ -5163,6 +5167,7 @@ export declare const WsComponentMeta: z.ZodObject<{
5163
5167
  template?: ({
5164
5168
  value: string;
5165
5169
  type: "text";
5170
+ placeholder?: boolean | undefined;
5166
5171
  } | {
5167
5172
  value: string;
5168
5173
  type: "expression";
@@ -6,12 +6,15 @@ import type { WsComponentMeta } from "./components/component-meta";
6
6
  declare const EmbedTemplateText: z.ZodObject<{
7
7
  type: z.ZodLiteral<"text">;
8
8
  value: z.ZodString;
9
+ placeholder: z.ZodOptional<z.ZodBoolean>;
9
10
  }, "strip", z.ZodTypeAny, {
10
11
  value: string;
11
12
  type: "text";
13
+ placeholder?: boolean | undefined;
12
14
  }, {
13
15
  value: string;
14
16
  type: "text";
17
+ placeholder?: boolean | undefined;
15
18
  }>;
16
19
  type EmbedTemplateText = z.infer<typeof EmbedTemplateText>;
17
20
  declare const EmbedTemplateExpression: z.ZodObject<{
@@ -10670,12 +10673,15 @@ export declare const EmbedTemplateInstance: z.ZodType<EmbedTemplateInstance>;
10670
10673
  export declare const WsEmbedTemplate: z.ZodLazy<z.ZodArray<z.ZodUnion<[z.ZodType<EmbedTemplateInstance, z.ZodTypeDef, EmbedTemplateInstance>, z.ZodObject<{
10671
10674
  type: z.ZodLiteral<"text">;
10672
10675
  value: z.ZodString;
10676
+ placeholder: z.ZodOptional<z.ZodBoolean>;
10673
10677
  }, "strip", z.ZodTypeAny, {
10674
10678
  value: string;
10675
10679
  type: "text";
10680
+ placeholder?: boolean | undefined;
10676
10681
  }, {
10677
10682
  value: string;
10678
10683
  type: "text";
10684
+ placeholder?: boolean | undefined;
10679
10685
  }>, z.ZodObject<{
10680
10686
  type: z.ZodLiteral<"expression">;
10681
10687
  value: z.ZodString;
@@ -10690,6 +10696,7 @@ export type WsEmbedTemplate = z.infer<typeof WsEmbedTemplate>;
10690
10696
  export declare const generateDataFromEmbedTemplate: (treeTemplate: ({
10691
10697
  value: string;
10692
10698
  type: "text";
10699
+ placeholder?: boolean | undefined;
10693
10700
  } | {
10694
10701
  value: string;
10695
10702
  type: "expression";
@@ -10697,16 +10704,17 @@ export declare const generateDataFromEmbedTemplate: (treeTemplate: ({
10697
10704
  export declare const namespaceMeta: (meta: WsComponentMeta, namespace: string, components: Set<EmbedTemplateInstance["component"]>) => {
10698
10705
  type: "control" | "embed" | "container" | "rich-text-child";
10699
10706
  description?: string | undefined;
10707
+ category?: "data" | "xml" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "internal" | undefined;
10700
10708
  label?: string | undefined;
10701
10709
  order?: number | undefined;
10702
10710
  template?: ({
10703
10711
  value: string;
10704
10712
  type: "text";
10713
+ placeholder?: boolean | undefined;
10705
10714
  } | {
10706
10715
  value: string;
10707
10716
  type: "expression";
10708
10717
  } | EmbedTemplateInstance)[] | undefined;
10709
- category?: "data" | "xml" | "text" | "hidden" | "media" | "general" | "forms" | "radix" | "internal" | undefined;
10710
10718
  requiredAncestors?: string[] | undefined;
10711
10719
  invalidAncestors?: string[] | undefined;
10712
10720
  indexWithinAncestor?: string | undefined;
@@ -31,6 +31,7 @@ export declare const getClosestInstance: (instancePath: InstancePath, currentIns
31
31
  children: ({
32
32
  value: string;
33
33
  type: "text";
34
+ placeholder?: boolean | undefined;
34
35
  } | {
35
36
  value: string;
36
37
  type: "id";
@@ -7,6 +7,7 @@ export declare const getIndexesWithinAncestors: (metas: Map<Instance["component"
7
7
  children: ({
8
8
  value: string;
9
9
  type: "text";
10
+ placeholder?: boolean | undefined;
10
11
  } | {
11
12
  value: string;
12
13
  type: "id";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.163.0",
3
+ "version": "0.167.0",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -28,11 +28,11 @@
28
28
  "html-tags": "^3.3.1",
29
29
  "nanoid": "^5.0.1",
30
30
  "title-case": "^4.1.0",
31
- "@webstudio-is/css-engine": "0.163.0",
32
- "@webstudio-is/fonts": "0.163.0",
33
- "@webstudio-is/image": "0.163.0",
34
- "@webstudio-is/icons": "^0.163.0",
35
- "@webstudio-is/sdk": "0.163.0"
31
+ "@webstudio-is/css-engine": "0.167.0",
32
+ "@webstudio-is/fonts": "0.167.0",
33
+ "@webstudio-is/icons": "^0.167.0",
34
+ "@webstudio-is/image": "0.167.0",
35
+ "@webstudio-is/sdk": "0.167.0"
36
36
  },
37
37
  "exports": {
38
38
  ".": {