@contentstack/studio-internal 1.5.0 → 1.7.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.
@@ -212,6 +212,38 @@ export declare const IMAGE_EXTENSION_OPERATOR: readonly [{
212
212
  readonly label: "Is Not";
213
213
  readonly value: "isNot";
214
214
  }];
215
+ /**
216
+ * Existence operators apply to EVERY condition subject — a field, a field
217
+ * property, or a complex field via its `exists` sub-type — so they are
218
+ * evaluated before `evaluateCondition`'s type switch rather than inside it.
219
+ *
220
+ * They ask about the KEY, not the value: `exists` is true for a key present
221
+ * with `null` / `0` / `false` / `""`. That is deliberately narrower than
222
+ * `isEmpty`, which asks about the value and is also true for a missing key.
223
+ */
224
+ export declare const EXISTENCE_OPERATORS: readonly [{
225
+ readonly label: "Exists";
226
+ readonly value: "exists";
227
+ }, {
228
+ readonly label: "Does not exist";
229
+ readonly value: "notExists";
230
+ }];
231
+ /**
232
+ * Emptiness operators ask about the VALUE, where existence asks about the key:
233
+ * `null`, `""`, `[]` and `{}` are empty; `0` and `false` are not — they are
234
+ * values a user deliberately chose.
235
+ *
236
+ * They are also members of TEXT_OPERATORS (where they have always lived, and
237
+ * where `StringOperator` derives from), so any list that already carries them
238
+ * must not gain a duplicate when these are appended.
239
+ */
240
+ export declare const EMPTINESS_OPERATORS: readonly [{
241
+ readonly label: "Is empty";
242
+ readonly value: "isEmpty";
243
+ }, {
244
+ readonly label: "Is not empty";
245
+ readonly value: "isNotEmpty";
246
+ }];
215
247
  export declare const CONDITION_OPERATORS: {
216
248
  TEXT_OPERATORS: ({
217
249
  readonly label: "Equals";
@@ -409,5 +441,19 @@ export declare const CONDITION_OPERATORS: {
409
441
  readonly label: "Is Not";
410
442
  readonly value: "isNot";
411
443
  })[];
444
+ EXISTENCE_OPERATORS: ({
445
+ readonly label: "Exists";
446
+ readonly value: "exists";
447
+ } | {
448
+ readonly label: "Does not exist";
449
+ readonly value: "notExists";
450
+ })[];
451
+ EMPTINESS_OPERATORS: ({
452
+ readonly label: "Is empty";
453
+ readonly value: "isEmpty";
454
+ } | {
455
+ readonly label: "Is not empty";
456
+ readonly value: "isNotEmpty";
457
+ })[];
412
458
  };
413
459
  //# sourceMappingURL=condition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../../src/constants/condition.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;CAGd,CAAC;AAEX,eAAO,MAAM,eAAe;;;CAGlB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BjB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;EA2BvB,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;EA+BlB,CAAC;AAEX,eAAO,MAAM,4BAA4B;;;;;;;EAG/B,CAAC;AAEX,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG1B,CAAC;AAEX,eAAO,MAAM,iBAAiB;;;;;;;EAGpB,CAAC;AAEX,eAAO,MAAM,uBAAuB;;;;;;;;;;EAI1B,CAAC;AAEX,eAAO,MAAM,sBAAsB;;;;;;EASzB,CAAC;AAEX,eAAO,MAAM,gCAAgC;;;;;;;;EAOnC,CAAC;AAEX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGtB,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;;;;;;;;EAI3B,CAAC;AAEX,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAc/B,CAAC"}
@@ -152,6 +152,44 @@ const IMAGE_EXTENSION_OPERATOR = [
152
152
  { ...EQUAL_OPERATOR },
153
153
  { ...IS_NOT_OPERATOR },
154
154
  ];
155
+ /**
156
+ * Existence operators apply to EVERY condition subject — a field, a field
157
+ * property, or a complex field via its `exists` sub-type — so they are
158
+ * evaluated before `evaluateCondition`'s type switch rather than inside it.
159
+ *
160
+ * They ask about the KEY, not the value: `exists` is true for a key present
161
+ * with `null` / `0` / `false` / `""`. That is deliberately narrower than
162
+ * `isEmpty`, which asks about the value and is also true for a missing key.
163
+ */
164
+ const EXISTENCE_OPERATORS = [
165
+ {
166
+ label: "Exists",
167
+ value: "exists",
168
+ },
169
+ {
170
+ label: "Does not exist",
171
+ value: "notExists",
172
+ },
173
+ ];
174
+ /**
175
+ * Emptiness operators ask about the VALUE, where existence asks about the key:
176
+ * `null`, `""`, `[]` and `{}` are empty; `0` and `false` are not — they are
177
+ * values a user deliberately chose.
178
+ *
179
+ * They are also members of TEXT_OPERATORS (where they have always lived, and
180
+ * where `StringOperator` derives from), so any list that already carries them
181
+ * must not gain a duplicate when these are appended.
182
+ */
183
+ const EMPTINESS_OPERATORS = [
184
+ {
185
+ label: "Is empty",
186
+ value: "isEmpty",
187
+ },
188
+ {
189
+ label: "Is not empty",
190
+ value: "isNotEmpty",
191
+ },
192
+ ];
155
193
  const CONDITION_OPERATORS = {
156
194
  TEXT_OPERATORS: [...TEXT_OPERATORS],
157
195
  COMPARISON_OPERATORS: [...COMPARISON_OPERATORS],
@@ -164,7 +202,9 @@ const CONDITION_OPERATORS = {
164
202
  REFERENCE_OPERATORS: [...REFERENCE_OPERATORS],
165
203
  REFERENCE_CONTENT_TYPE_OPERATORS: [...REFERENCE_CONTENT_TYPE_OPERATORS],
166
204
  IMAGE_EXTENSION_OPERATOR: [...IMAGE_EXTENSION_OPERATOR],
205
+ EXISTENCE_OPERATORS: [...EXISTENCE_OPERATORS],
206
+ EMPTINESS_OPERATORS: [...EMPTINESS_OPERATORS],
167
207
  };
168
208
 
169
- export { ARRAY_OPERATORS, BOOLEAN_OPERATORS, COMPARISON_OPERATORS, CONDITION_OPERATORS, EQUAL_OPERATOR, IMAGE_EXTENSION_OPERATOR, IS_NOT_OPERATOR, IS_OPERATOR, MODULAR_BLOCK_NAME_OPERATORS, MODULAR_BLOCK_OPERATORS, MULTI_SELECT_OPERATORS, NOT_EQUAL_OPERATOR, REFERENCE_CONTENT_TYPE_OPERATORS, REFERENCE_OPERATORS, SINGLE_SELECT_OPERATORS, TEXT_OPERATORS };
209
+ export { ARRAY_OPERATORS, BOOLEAN_OPERATORS, COMPARISON_OPERATORS, CONDITION_OPERATORS, EMPTINESS_OPERATORS, EQUAL_OPERATOR, EXISTENCE_OPERATORS, IMAGE_EXTENSION_OPERATOR, IS_NOT_OPERATOR, IS_OPERATOR, MODULAR_BLOCK_NAME_OPERATORS, MODULAR_BLOCK_OPERATORS, MULTI_SELECT_OPERATORS, NOT_EQUAL_OPERATOR, REFERENCE_CONTENT_TYPE_OPERATORS, REFERENCE_OPERATORS, SINGLE_SELECT_OPERATORS, TEXT_OPERATORS };
170
210
  //# sourceMappingURL=condition.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition.js","sources":["../../src/constants/condition.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;AACzB,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,KAAK,EAAE,IAAI;;AAGN,MAAM,eAAe,GAAG;AAC7B,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,KAAK,EAAE,OAAO;;AAGT,MAAM,cAAc,GAAG;AAC5B,IAAA,KAAK,EAAE,QAAQ;AACf,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,MAA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AA,cAAc,EAAE,CAAC,GAAG,cAAc,CAAC;AACnC,IAAA,oBAAoB,EAAE,CAAC,GAAG,oBAAoB,CAAC;AAC/C,IAAA,uBAAuB,EAAE,CAAC,GAAG,uBAAuB,CAAC;AACrD,IAAA,4BAA4B,EAAE,CAAC,GAAG,4BAA4B,CAAC;AAC/D,IAAA,eAAe,EAAE,CAAC,GAAG,eAAe,CAAC;AACrC,IAAA,iBAAiB,EAAE,CAAC,GAAG,iBAAiB,CAAC;AACzC,IAAA,uBAAuB,EAAE,CAAC,GAAG,uBAAuB,CAAC;AACrD,IAAA,sBAAsB,EAAE,CAAC,GAAG,sBAAsB,CAAC;AACnD,IAAA,mBAAmB,EAAE,CAAC,GAAG,mBAAmB,CAAC;AAC7C,IAAA,gCAAgC,EAAE,CAAC,GAAG,gCAAgC,CAAC;AACvE,IAAA,wBAAwB,EAAE,CAAC,GAAG,wBAAwB,CAAC;AACvD,IAAA,mBAAmB,EAAE,CAAC,GAAG,mBAAmB,CAAC;AAC7C,IAAA,mBAAmB,EAAE,CAAC,GAAG,mBAAmB,CAAC;;;;;"}
package/dist/index.d.ts CHANGED
@@ -200,6 +200,38 @@ declare const IMAGE_EXTENSION_OPERATOR: readonly [{
200
200
  readonly label: "Is Not";
201
201
  readonly value: "isNot";
202
202
  }];
203
+ /**
204
+ * Existence operators apply to EVERY condition subject — a field, a field
205
+ * property, or a complex field via its `exists` sub-type — so they are
206
+ * evaluated before `evaluateCondition`'s type switch rather than inside it.
207
+ *
208
+ * They ask about the KEY, not the value: `exists` is true for a key present
209
+ * with `null` / `0` / `false` / `""`. That is deliberately narrower than
210
+ * `isEmpty`, which asks about the value and is also true for a missing key.
211
+ */
212
+ declare const EXISTENCE_OPERATORS: readonly [{
213
+ readonly label: "Exists";
214
+ readonly value: "exists";
215
+ }, {
216
+ readonly label: "Does not exist";
217
+ readonly value: "notExists";
218
+ }];
219
+ /**
220
+ * Emptiness operators ask about the VALUE, where existence asks about the key:
221
+ * `null`, `""`, `[]` and `{}` are empty; `0` and `false` are not — they are
222
+ * values a user deliberately chose.
223
+ *
224
+ * They are also members of TEXT_OPERATORS (where they have always lived, and
225
+ * where `StringOperator` derives from), so any list that already carries them
226
+ * must not gain a duplicate when these are appended.
227
+ */
228
+ declare const EMPTINESS_OPERATORS: readonly [{
229
+ readonly label: "Is empty";
230
+ readonly value: "isEmpty";
231
+ }, {
232
+ readonly label: "Is not empty";
233
+ readonly value: "isNotEmpty";
234
+ }];
203
235
  declare const CONDITION_OPERATORS: {
204
236
  TEXT_OPERATORS: ({
205
237
  readonly label: "Equals";
@@ -397,6 +429,20 @@ declare const CONDITION_OPERATORS: {
397
429
  readonly label: "Is Not";
398
430
  readonly value: "isNot";
399
431
  })[];
432
+ EXISTENCE_OPERATORS: ({
433
+ readonly label: "Exists";
434
+ readonly value: "exists";
435
+ } | {
436
+ readonly label: "Does not exist";
437
+ readonly value: "notExists";
438
+ })[];
439
+ EMPTINESS_OPERATORS: ({
440
+ readonly label: "Is empty";
441
+ readonly value: "isEmpty";
442
+ } | {
443
+ readonly label: "Is not empty";
444
+ readonly value: "isNotEmpty";
445
+ })[];
400
446
  };
401
447
 
402
448
  type ComparisonOperator = (typeof COMPARISON_OPERATORS)[number]["value"];
@@ -409,9 +455,36 @@ type SingleSelectOperator = (typeof SINGLE_SELECT_OPERATORS)[number]["value"];
409
455
  type MultiSelectOperator = (typeof MULTI_SELECT_OPERATORS)[number]["value"];
410
456
  type SelectOperator = SingleSelectOperator | MultiSelectOperator;
411
457
  type ReferenceOperator = (typeof REFERENCE_OPERATORS)[number]["value"];
458
+ type ExistenceOperator = (typeof EXISTENCE_OPERATORS)[number]["value"];
459
+ type EmptinessOperator = (typeof EMPTINESS_OPERATORS)[number]["value"];
460
+ /**
461
+ * The facet of a subject a condition asks about, when it asks about a facet at
462
+ * all — a list's length, a reference's content type, an asset's extension.
463
+ *
464
+ * Lives here beside `Condition` rather than with the derivation helpers because
465
+ * it is now PERSISTED: `subType` below is read by `evaluateCondition`, so it is
466
+ * part of the evaluation contract, not a display concern.
467
+ */
468
+ type ConditionSubType = "image_extension" | "image_size" | "ref_content_type" | "block_name" | "length" | "select_options" | "presence";
412
469
  type ConditionBindings = {
413
470
  conditionBinding: BindingType;
414
471
  dataBinding: BindingType;
472
+ /**
473
+ * The sub-type the author actually chose, recorded so evaluation never has to
474
+ * infer it.
475
+ *
476
+ * `eq` is shared between an identity check and a length comparison, and the
477
+ * field's data type is not stored either, so `Length == 3` and
478
+ * `Block Name == block_1` are otherwise the same shape. Without this, the two
479
+ * are indistinguishable and evaluation has to guess.
480
+ *
481
+ * Optional, and absent on every condition saved before this — and on anything
482
+ * the CLI or the compositions API writes. Evaluation MUST therefore treat its
483
+ * absence as "behave exactly as before": re-interpreting an old condition
484
+ * would change published pages with no edit or publish event, which is the
485
+ * failure ADR 0014 exists to prevent.
486
+ */
487
+ subType?: ConditionSubType;
415
488
  };
416
489
  type NumberCondition = {
417
490
  type: "number";
@@ -465,12 +538,35 @@ type ImageSizeCondition = {
465
538
  value: number;
466
539
  } & ConditionBindings;
467
540
  type ImageCondition = ImageSizeCondition | ImageExtensionCondition;
468
- type Condition = NumberCondition | StringCondition | BooleanCondition | ArrayCondition | ModularBlockCondition | DateCondition | SelectCondition | ReferenceCondition | ImageCondition;
541
+ /**
542
+ * The subject types a presence check (existence or emptiness) can be authored
543
+ * against. Mirrors the `type` of every other condition so a subject keeps
544
+ * describing what it IS even when the operator ignores its value — plus
545
+ * `"file"`, which exists only here because an asset has no comparable value of
546
+ * its own (every other file condition is expressed through a sub-type:
547
+ * `image_extension` / `image_size`).
548
+ */
549
+ type PresenceConditionType = "string" | "number" | "boolean" | "date" | "select" | "array" | "reference" | "modular_block" | "file";
550
+ /** @deprecated Use {@link PresenceConditionType}. */
551
+ type ExistenceConditionType = PresenceConditionType;
552
+ /**
553
+ * A presence check carries no value — the operator asks only about the bound
554
+ * key (existence) or about whether its value is empty. Both apply to every
555
+ * subject type, which is why they share one shape.
556
+ *
557
+ * `value` is required-but-null rather than optional: making it optional widens
558
+ * `Condition["value"]` with `undefined` for every consumer that reads a value
559
+ * off an unnarrowed condition.
560
+ */
561
+ type PresenceCondition = {
562
+ type: PresenceConditionType;
563
+ operator: ExistenceOperator | EmptinessOperator;
564
+ value: null;
565
+ } & ConditionBindings;
566
+ /** @deprecated Use {@link PresenceCondition}. */
567
+ type ExistenceCondition = PresenceCondition;
568
+ type Condition = NumberCondition | StringCondition | BooleanCondition | ArrayCondition | ModularBlockCondition | DateCondition | SelectCondition | ReferenceCondition | ImageCondition | PresenceCondition;
469
569
 
470
- type SymbolProp = {
471
- uid: string;
472
- [key: string]: unknown;
473
- };
474
570
  type BindingMap = Record<string, string>;
475
571
  type NodeProp = NodePropsWithBinding | NodePropWithUnknownValue | NodePropsForObject | NodePropsForArray | NodePropsWithSlot;
476
572
  type BindableNodeProp = NodePropsWithBinding | NodePropWithBindingMap;
@@ -516,6 +612,13 @@ type NodePropTypes = {
516
612
  json_rte: "json_rte";
517
613
  /** Plain text only — singleline or multiline; excludes HTML RTE and Markdown fields. */
518
614
  plaintext: "plaintext";
615
+ /**
616
+ * A registered Studio function reference. The prop's saved value is the
617
+ * function NAME (string, chosen from `registerStudioFunctions` names in the
618
+ * Studio props panel); at render time the SDK replaces it with a callable
619
+ * that invokes `callStudioFunction(name, ...args)`. Works on any component.
620
+ */
621
+ action: "action";
519
622
  };
520
623
  type NodePropStaticValueTypes = {
521
624
  string: string;
@@ -530,6 +633,8 @@ type NodePropStaticValueTypes = {
530
633
  any: any;
531
634
  json_rte: Record<string, any>;
532
635
  plaintext: string;
636
+ /** Saved as the registered function's name. */
637
+ action: string;
533
638
  };
534
639
  type NodePropType = NodePropTypes[keyof NodePropTypes];
535
640
  type BindableNodePropType = Exclude<NodePropType, "slot">;
@@ -563,6 +668,15 @@ interface NodeInterface {
563
668
  parent: (root: Node, path: Path) => Ancestor;
564
669
  common: (root: Node, path: Path, another: Path) => NodeEntry;
565
670
  isNode: (value: any) => value is Node;
671
+ /**
672
+ * `isNode`, but tolerant of an omitted `slots` key.
673
+ *
674
+ * TRAVERSAL ONLY — never use this to validate a transform. `isNode` keeps its
675
+ * strict contract precisely because transforms rely on `slots` being present;
676
+ * this predicate exists so a walk can still SEE a leaf that legitimately has
677
+ * no children to declare.
678
+ */
679
+ isNodeLike: (value: any) => value is Node;
566
680
  /**
567
681
  * Checks if the given value as well as their slots are nodes
568
682
  * @param value The value to check
@@ -632,8 +746,6 @@ type Node = {
632
746
  bindings?: Record<string, BindingType>;
633
747
  condition?: Condition;
634
748
  repeaterWrapper?: boolean;
635
- symbolProps?: SymbolProp[];
636
- symbolUID?: string;
637
749
  slotNames?: Record<string, string>;
638
750
  [key: string]: any;
639
751
  };
@@ -1073,6 +1185,130 @@ declare const setClasses: NodeTransforms["setClasses"];
1073
1185
 
1074
1186
  declare const unsetProp: NodeTransforms["unsetProp"];
1075
1187
 
1188
+ /**
1189
+ * Turn a stored uid into something readable: `alpha_hero_centered` →
1190
+ * "Alpha Hero Centered".
1191
+ *
1192
+ * Only ever applied to a **uid** — a block or content-type key the author named
1193
+ * themselves in the CT builder. NEVER to a literal condition value: a literal is
1194
+ * compared against real data, so prettifying `sale_ends` into "Sale Ends" would
1195
+ * misstate what the condition actually matches.
1196
+ *
1197
+ * It is a guess even for a uid — Contentstack derives the uid from the name at
1198
+ * creation and then locks it while the display name stays editable, so the two
1199
+ * drift. A stored name (see {@link ConditionDisplay}) is always preferred; this
1200
+ * is the floor for conditions that carry none.
1201
+ */
1202
+ declare function uidToDisplayName(uid: string): string;
1203
+ /**
1204
+ * Display names stamped on a condition block when its condition is authored,
1205
+ * held on the node as `metadata.conditionDisplay`.
1206
+ *
1207
+ * Deliberately kept OUT of `metadata.condition`: that object is the evaluation
1208
+ * contract `evaluateCondition` consumes, and mixing presentation into it invites
1209
+ * logic to key off a display string. Equally deliberately, only the two
1210
+ * **uid-shaped** parts are stored — the field name and the block / content-type
1211
+ * title. The operator and a literal value are derivable from the node, and
1212
+ * storing a whole rendered sentence would freeze the grammar: later corrections
1213
+ * would reach only conditions authored after them, and the label could fall out
1214
+ * of step with the operator on its own node.
1215
+ */
1216
+ interface ConditionDisplay {
1217
+ /** The condition subject's display name, e.g. `hero_sections` → "Hero Sections". */
1218
+ subject?: string;
1219
+ /** A block's or referenced content type's title, e.g. `alpha_hero` → "Hero — Alpha". */
1220
+ value?: string;
1221
+ }
1222
+ /**
1223
+ * The short description of a condition block, used to tell one apart from its
1224
+ * siblings. Rendered in the Layers row and in the block's drop well.
1225
+ *
1226
+ * `null` and `unsupported` are deliberately distinct. `null` means the block
1227
+ * carries no condition at all — the surface should say so. `unsupported` means a
1228
+ * condition IS configured but cannot be described; a surface must NOT then claim
1229
+ * "no condition configured", which would be a plain lie about a configured block.
1230
+ */
1231
+ type ConditionHint = {
1232
+ kind: "info";
1233
+ prefix: string;
1234
+ value: string;
1235
+ rawValue: string;
1236
+ } | {
1237
+ kind: "unsupported";
1238
+ };
1239
+
1240
+ /**
1241
+ * Derive the condition's sub-type from the condition alone — no schema.
1242
+ *
1243
+ * Ported from Studio's `conditionSubTypeConfig` so the Layers row and the canvas
1244
+ * drop well cannot disagree with the Settings tab about what a condition is.
1245
+ *
1246
+ * Note `length` is used as the **catch-all else-branch** for `select`,
1247
+ * `reference` and `modular_block`, not as a claim that the condition is about
1248
+ * length. {@link subTypeLabel} guards against rendering it as one.
1249
+ */
1250
+ declare function getConditionSubType(condition: Condition): ConditionSubType | null;
1251
+ /**
1252
+ * The field path a binding points at, as stored — `title`, `hero.file_size`,
1253
+ * `hero_sections`. Exported so a Repeater's `items` binding and a condition's own
1254
+ * binding are read by the same code: a condition block's subject can come from
1255
+ * either, and the two must not disagree.
1256
+ */
1257
+ declare function getBindingFieldPath(binding?: BindingType): string | undefined;
1258
+ /**
1259
+ * The field path a condition is evaluated against, as stored. Not de-uid-ified:
1260
+ * this is a key, and prettifying a key produces something that reads as a display
1261
+ * name and silently contradicts the real one whenever the two have drifted.
1262
+ */
1263
+ declare function getConditionSubject(condition: Condition): string | undefined;
1264
+ /**
1265
+ * True when the condition's subject has collapsed into its own value and so
1266
+ * identifies nothing.
1267
+ *
1268
+ * `useAddCondition` (and `createConditionBlockNode` on the auto path) rewrite a
1269
+ * **repeater-scoped** identity binding's `path` to the condition value itself.
1270
+ * The binding then points at the branch rather than at the field, so rendering
1271
+ * subject + operator + value would read `block_1 == block_1`, or
1272
+ * `_content_type_uid == author` where the subject just restates the operator.
1273
+ *
1274
+ * Value-only is also what the author needs there for an independent reason: every
1275
+ * sibling branch inside one repeater is on the same field, so naming that field
1276
+ * would distinguish nothing and would only cost width.
1277
+ *
1278
+ * NOT every identity condition is degenerate. A blocks-field condition bound
1279
+ * through a template binding (only the repeater data source is `isNestedContext`,
1280
+ * so only it triggers the rewrite) keeps a real subject and reads
1281
+ * `hero_sections.Block Name == Alpha Hero Centered`.
1282
+ */
1283
+ declare function isDegenerateSubject(condition: Condition): boolean;
1284
+ /**
1285
+ * Build the condition hint from the node's condition.
1286
+ *
1287
+ * The subject is taken from the first source that has one:
1288
+ *
1289
+ * 1. `display.subject` — a name stamped when the condition was authored
1290
+ * 2. `selected_field` on the condition's own binding — set for section-scoped
1291
+ * conditions, whose Repeater binds with an empty path
1292
+ * 3. `fallback.subject` — a name the caller derived from context, which is how a
1293
+ * collapsed page-scoped subject is recovered: the block's parent Repeater
1294
+ * still names the field even though the condition's binding no longer does
1295
+ * 4. the condition's own binding — unless that has collapsed into the value
1296
+ *
1297
+ * With a subject: When <subject>[.<SubType>] <op> <value>
1298
+ * Without one: When <value>
1299
+ *
1300
+ * A collapsed subject is therefore no longer *dropped*, only *unavailable* — which
1301
+ * it stops being as soon as a caller can name it. That is what lets the Layers row
1302
+ * and the drop well read the same condition the Settings tab does, whose own
1303
+ * resolver walks to the Repeater for exactly this reason.
1304
+ *
1305
+ * Returns `unsupported` when nothing describable is left — an array or object
1306
+ * value, or a non-presence condition with no value and no subject.
1307
+ */
1308
+ declare function getConditionHint(condition?: Condition | null, display?: ConditionDisplay, fallback?: {
1309
+ subject?: string;
1310
+ }): ConditionHint | null;
1311
+
1076
1312
  /**
1077
1313
  * Length of generated IDs using nanoid.
1078
1314
  *
@@ -1191,5 +1427,5 @@ interface SectionSlotContext {
1191
1427
  */
1192
1428
  declare function indexSectionSlotContexts(sectionUI: any): Record<string, SectionSlotContext>;
1193
1429
 
1194
- export { CONDITION_OPERATORS, Editor, ID_LENGTH, Node, Operation, Path, PathRef, Transforms, apply, compressSpec, createEditor, decompressSpec, getDirtyPaths, hasUnsavedChanges, indexSectionSlotContexts, insertNodes, isNormalizing, liftNodes, moveNodes, node, nodes, normalize, normalizeNode, pathRef, pathRefs, removeNodes, setActiveContextPath, setClasses, setHasUnSavedChanges, setNodes, setNormalizing, setProp, setResponsiveStyles, setSelection, shouldNormalize, unsetProp, unsetResponsiveStyles, unwrapNodes, validateCompression, withoutNormalizing, wrapNodes };
1195
- export type { Ancestor, ArrayCondition, ArrayOperator, BaseEditor, BindableNodeProp, BindableNodePropType, BindingMap, BindingType, BooleanCondition, BooleanOperator, ComparisonOperator, Condition, ConditionBindings, CustomTypes, DateCondition, Descendant, EditorInterface, EditorNodesOptions, EditorNormalizeOptions, EditorPathOptions, EditorPathRefOptions, ExtendedType, ImageCondition, ImageExtensionCondition, ImageExtensionOperator, ImageSizeCondition, InsertNodeOperation, LeafEdge, MaximizeMode, ModularBlockCondition, ModularBlockOperator, MoveNodeOperation, MoveUnit, MultiSelectOperator, NodeAncestorsOptions, NodeEntry, NodeInterface, NodeMatch, NodeOperation, NodeProp, NodePropStaticValueTypes, NodePropType, NodePropTypes, NodePropWithBindingMap, NodePropWithUnknownValue, NodeProps, NodePropsForArray, NodePropsForObject, NodePropsWithBinding, NodePropsWithSlot, NodeStyle, NodeStyles, NumberCondition, OmitFirstArg, OperationInterface, PathAncestorsOptions, PathIndex, PathInterface, PathLevelsOptions, PathNode, PathRefInterface, PathTransformOptions, PropsCompare, PropsMerge, RangeDirection, RangeMode, ReferenceCondition, ReferenceOperator, RemoveNodeOperation, SectionSlotContext, SelectCondition, SelectOperator, SelectionEdge, SelectionMode, SelectionOperation, SetActiveContextPathOperation, SetNodeOperation, SetPropOperation, SetSelectionOperation, SingleSelectOperator, SlotUid, StaticValueNodePropType, StringCondition, StringOperator, SymbolProp, TextDirection, TextUnit, TextUnitAdjustment, UnknownNodePropType, UnsetPropOperation };
1430
+ export { CONDITION_OPERATORS, Editor, ID_LENGTH, Node, Operation, Path, PathRef, Transforms, apply, compressSpec, createEditor, decompressSpec, getBindingFieldPath, getConditionHint, getConditionSubType, getConditionSubject, getDirtyPaths, hasUnsavedChanges, indexSectionSlotContexts, insertNodes, isDegenerateSubject, isNormalizing, liftNodes, moveNodes, node, nodes, normalize, normalizeNode, pathRef, pathRefs, removeNodes, setActiveContextPath, setClasses, setHasUnSavedChanges, setNodes, setNormalizing, setProp, setResponsiveStyles, setSelection, shouldNormalize, uidToDisplayName, unsetProp, unsetResponsiveStyles, unwrapNodes, validateCompression, withoutNormalizing, wrapNodes };
1431
+ export type { Ancestor, ArrayCondition, ArrayOperator, BaseEditor, BindableNodeProp, BindableNodePropType, BindingMap, BindingType, BooleanCondition, BooleanOperator, ComparisonOperator, Condition, ConditionBindings, ConditionDisplay, ConditionHint, ConditionSubType, CustomTypes, DateCondition, Descendant, EditorInterface, EditorNodesOptions, EditorNormalizeOptions, EditorPathOptions, EditorPathRefOptions, EmptinessOperator, ExistenceCondition, ExistenceConditionType, ExistenceOperator, ExtendedType, ImageCondition, ImageExtensionCondition, ImageExtensionOperator, ImageSizeCondition, InsertNodeOperation, LeafEdge, MaximizeMode, ModularBlockCondition, ModularBlockOperator, MoveNodeOperation, MoveUnit, MultiSelectOperator, NodeAncestorsOptions, NodeEntry, NodeInterface, NodeMatch, NodeOperation, NodeProp, NodePropStaticValueTypes, NodePropType, NodePropTypes, NodePropWithBindingMap, NodePropWithUnknownValue, NodeProps, NodePropsForArray, NodePropsForObject, NodePropsWithBinding, NodePropsWithSlot, NodeStyle, NodeStyles, NumberCondition, OmitFirstArg, OperationInterface, PathAncestorsOptions, PathIndex, PathInterface, PathLevelsOptions, PathNode, PathRefInterface, PathTransformOptions, PresenceCondition, PresenceConditionType, PropsCompare, PropsMerge, RangeDirection, RangeMode, ReferenceCondition, ReferenceOperator, RemoveNodeOperation, SectionSlotContext, SelectCondition, SelectOperator, SelectionEdge, SelectionMode, SelectionOperation, SetActiveContextPathOperation, SetNodeOperation, SetPropOperation, SetSelectionOperation, SingleSelectOperator, SlotUid, StaticValueNodePropType, StringCondition, StringOperator, TextDirection, TextUnit, TextUnitAdjustment, UnknownNodePropType, UnsetPropOperation };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAElC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,GACxB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAElC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,GACxB,MAAM,6BAA6B,CAAC"}
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ export { setProp } from './transforms-node/set-props.js';
33
33
  export { setClasses } from './transforms-node/set-classes.js';
34
34
  export { unsetProp } from './transforms-node/unset-props.js';
35
35
  export { CONDITION_OPERATORS } from './constants/condition.js';
36
+ export { getBindingFieldPath, getConditionHint, getConditionSubType, getConditionSubject, isDegenerateSubject, uidToDisplayName } from './utils/condition-hint.js';
36
37
  export { ID_LENGTH } from './constants/id.js';
37
38
  export { compressSpec, decompressSpec, validateCompression } from './utils/spec-compression.js';
38
39
  export { indexSectionSlotContexts } from './utils/section-slot-walker.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,10 +1,6 @@
1
1
  import { Properties } from "csstype";
2
2
  import { Editor, Path, SlotUid } from ".";
3
3
  import { Condition } from "../types";
4
- export type SymbolProp = {
5
- uid: string;
6
- [key: string]: unknown;
7
- };
8
4
  export type Node = {
9
5
  uid: string;
10
6
  type: string;
@@ -16,8 +12,6 @@ export type Node = {
16
12
  bindings?: Record<string, BindingType>;
17
13
  condition?: Condition;
18
14
  repeaterWrapper?: boolean;
19
- symbolProps?: SymbolProp[];
20
- symbolUID?: string;
21
15
  slotNames?: Record<string, string>;
22
16
  [key: string]: any;
23
17
  };
@@ -72,6 +66,13 @@ export type NodePropTypes = {
72
66
  json_rte: "json_rte";
73
67
  /** Plain text only — singleline or multiline; excludes HTML RTE and Markdown fields. */
74
68
  plaintext: "plaintext";
69
+ /**
70
+ * A registered Studio function reference. The prop's saved value is the
71
+ * function NAME (string, chosen from `registerStudioFunctions` names in the
72
+ * Studio props panel); at render time the SDK replaces it with a callable
73
+ * that invokes `callStudioFunction(name, ...args)`. Works on any component.
74
+ */
75
+ action: "action";
75
76
  };
76
77
  export type NodePropStaticValueTypes = {
77
78
  string: string;
@@ -86,6 +87,8 @@ export type NodePropStaticValueTypes = {
86
87
  any: any;
87
88
  json_rte: Record<string, any>;
88
89
  plaintext: string;
90
+ /** Saved as the registered function's name. */
91
+ action: string;
89
92
  };
90
93
  export type NodePropType = NodePropTypes[keyof NodePropTypes];
91
94
  export type BindableNodePropType = Exclude<NodePropType, "slot">;
@@ -119,6 +122,15 @@ export interface NodeInterface {
119
122
  parent: (root: Node, path: Path) => Ancestor;
120
123
  common: (root: Node, path: Path, another: Path) => NodeEntry;
121
124
  isNode: (value: any) => value is Node;
125
+ /**
126
+ * `isNode`, but tolerant of an omitted `slots` key.
127
+ *
128
+ * TRAVERSAL ONLY — never use this to validate a transform. `isNode` keeps its
129
+ * strict contract precisely because transforms rely on `slots` being present;
130
+ * this predicate exists so a walk can still SEE a leaf that legitimately has
131
+ * no children to declare.
132
+ */
133
+ isNodeLike: (value: any) => value is Node;
122
134
  /**
123
135
  * Checks if the given value as well as their slots are nodes
124
136
  * @param value The value to check
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/interfaces/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAC1C,OAAO,EAAE,SAA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AM,IAAI,EAAE,aA8MlB,CAAC;AAEF,iBAAS,kBAAkB,CACzB,CAAC,EAAE,IAAI,EACP,UAAU,EAAE,MAAM,GACjB;IAAE,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAA;CAAE,CAAC;AACxC,iBAAS,kBAAkB,CACzB,CAAC,EAAE,IAAI,EACP,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,UAAU,CAAC"}
@@ -92,6 +92,17 @@ const Node = {
92
92
  value.metadata &&
93
93
  value.slots);
94
94
  },
95
+ isNodeLike(value) {
96
+ // Same shape as isNode minus `slots`: a leaf authored through the CMA has no
97
+ // children to declare, so it legitimately omits the key. Traversal must not
98
+ // treat that as "not a node" — see `nodes()`.
99
+ return Boolean(isPlainObject(value) &&
100
+ value.uid &&
101
+ value.type &&
102
+ value.props &&
103
+ value.styles &&
104
+ value.metadata);
105
+ },
95
106
  isNodeRecursive(value) {
96
107
  if (!Node.isNode(value)) {
97
108
  return false;
@@ -100,15 +111,33 @@ const Node = {
100
111
  return slot.every(Node.isNodeRecursive);
101
112
  });
102
113
  },
114
+ /**
115
+ * Depth-first walk over a node and its descendants.
116
+ *
117
+ * `slots` is defaulted because a leaf node authored through the CMA legitimately
118
+ * omits the key — it has no children to declare. The renderer already tolerates
119
+ * that, so such a composition looks healthy on canvas and on the site, and only
120
+ * a consumer that WALKS the tree crashes. Without the default, one slots-less
121
+ * atom takes down whatever rendered the walk: a real section (Pricing Systems
122
+ * Cards, 4 slots-less atoms) white-screened Studio's Data tab via
123
+ * collectComponentProps, because the throw escapes React with no boundary above.
124
+ */
103
125
  *nodes(root) {
104
126
  const stack = [[root, []]];
105
127
  while (stack.length > 0) {
106
128
  const [node, path] = stack.pop();
107
129
  yield [node, path];
108
- for (const [slot, children] of Object.entries(node.slots)) {
130
+ for (const [slot, children] of Object.entries(node.slots ?? {})) {
109
131
  for (let index = children.length - 1; index >= 0; index--) {
110
132
  const child = children[index];
111
- if (Node.isNode(child)) {
133
+ // `isNodeLike`, not `isNode`: the strict check requires a truthy
134
+ // `slots`, so a slots-less leaf was yielded when it happened to be the
135
+ // root and silently dropped when reached from its parent. Consumers
136
+ // that walk descendants — collectComponentProps and friends — then
137
+ // missed that atom's props entirely, with nothing reporting it.
138
+ // isNode keeps its contract for transform validation; only the walk
139
+ // relaxes.
140
+ if (Node.isNodeLike(child)) {
112
141
  stack.push([child, path.concat([[slot, index]])]);
113
142
  }
114
143
  }