@contentstack/studio-internal 1.6.0 → 1.8.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/dist/index.d.ts CHANGED
@@ -457,9 +457,34 @@ type SelectOperator = SingleSelectOperator | MultiSelectOperator;
457
457
  type ReferenceOperator = (typeof REFERENCE_OPERATORS)[number]["value"];
458
458
  type ExistenceOperator = (typeof EXISTENCE_OPERATORS)[number]["value"];
459
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";
460
469
  type ConditionBindings = {
461
470
  conditionBinding: BindingType;
462
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;
463
488
  };
464
489
  type NumberCondition = {
465
490
  type: "number";
@@ -643,6 +668,15 @@ interface NodeInterface {
643
668
  parent: (root: Node, path: Path) => Ancestor;
644
669
  common: (root: Node, path: Path, another: Path) => NodeEntry;
645
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;
646
680
  /**
647
681
  * Checks if the given value as well as their slots are nodes
648
682
  * @param value The value to check
@@ -1151,6 +1185,130 @@ declare const setClasses: NodeTransforms["setClasses"];
1151
1185
 
1152
1186
  declare const unsetProp: NodeTransforms["unsetProp"];
1153
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
+
1154
1312
  /**
1155
1313
  * Length of generated IDs using nanoid.
1156
1314
  *
@@ -1269,5 +1427,5 @@ interface SectionSlotContext {
1269
1427
  */
1270
1428
  declare function indexSectionSlotContexts(sectionUI: any): Record<string, SectionSlotContext>;
1271
1429
 
1272
- 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 };
1273
- export type { Ancestor, ArrayCondition, ArrayOperator, BaseEditor, BindableNodeProp, BindableNodePropType, BindingMap, BindingType, BooleanCondition, BooleanOperator, ComparisonOperator, Condition, ConditionBindings, 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 };
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -122,6 +122,15 @@ export interface NodeInterface {
122
122
  parent: (root: Node, path: Path) => Ancestor;
123
123
  common: (root: Node, path: Path, another: Path) => NodeEntry;
124
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;
125
134
  /**
126
135
  * Checks if the given value as well as their slots are nodes
127
136
  * @param value The value to check
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../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AC,SAAS,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;CAC9D;AAED,eAAO,MAAM,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
  }
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sources":["../../src/interfaces/node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAkOO,MAAM,IAAI,GAAkB;AACjC,IAAA,SAAS,CACP,IAAU,EACV,IAAU,EACV,UAAgC,EAAE,EAAA;QAElC,MAAM,SAAS,GAAe,EAAE;AAChC,QAAA,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;AAC7C,YAAA,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnC;AACA,QAAA,OAAO,SAAS;IAClB,CAAC;AAED,IAAA,MAAM,CAAC,IAAY,EAAA;AACjB,QAAA,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AAC5B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,qCAAA,CAAuC,CAAC;QAC1D;QAEA,OAAO;AACL,YAAA,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC;AACtB,YAAA,KAAK,EAAE,EAAE;YACT,IAAI;AACJ,YAAA,QAAQ,EAAE,EAAE;AACZ,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,KAAK,EAAE,EAAE;AACT,YAAA,MAAM,EAAE,EAAE;SACX;IACH,CAAC;IAED,GAAG,CAAC,IAAU,EAAE,IAAU,EAAA;QACxB,IAAI,I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AC1E;AAEA,QAAA,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;IACzB,CAAC;;AAYH,SAAS,kBAAkB,CACzB,CAAO,EACP,UAAkB,EAClB,UAAmB,EAAA;AAEnB,IAAA,IAAI,UAAU,KAAK,EAAE,EAAE;AACrB,QAAA,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC;IAC9D;AACA,IAAA,IAAI,UAAU,KAAK,EAAE,EAAE;AACrB,QAAA,MAAM,IAAI,KAAK,CAAC,CAAA,wCAAA,CAA0C,CAAC;IAC7D;IAEA,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC;IAEnC,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,EAAE;IACX;IAEA,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,MAAM,CAAC,gBAAgB;IAChC;IAEA,OAAO,MAAM,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,EAAE;AAClD;;;;"}
@@ -12,9 +12,34 @@ export type SelectOperator = SingleSelectOperator | MultiSelectOperator;
12
12
  export type ReferenceOperator = (typeof REFERENCE_OPERATORS)[number]["value"];
13
13
  export type ExistenceOperator = (typeof EXISTENCE_OPERATORS)[number]["value"];
14
14
  export type EmptinessOperator = (typeof EMPTINESS_OPERATORS)[number]["value"];
15
+ /**
16
+ * The facet of a subject a condition asks about, when it asks about a facet at
17
+ * all — a list's length, a reference's content type, an asset's extension.
18
+ *
19
+ * Lives here beside `Condition` rather than with the derivation helpers because
20
+ * it is now PERSISTED: `subType` below is read by `evaluateCondition`, so it is
21
+ * part of the evaluation contract, not a display concern.
22
+ */
23
+ export type ConditionSubType = "image_extension" | "image_size" | "ref_content_type" | "block_name" | "length" | "select_options" | "presence";
15
24
  export type ConditionBindings = {
16
25
  conditionBinding: BindingType;
17
26
  dataBinding: BindingType;
27
+ /**
28
+ * The sub-type the author actually chose, recorded so evaluation never has to
29
+ * infer it.
30
+ *
31
+ * `eq` is shared between an identity check and a length comparison, and the
32
+ * field's data type is not stored either, so `Length == 3` and
33
+ * `Block Name == block_1` are otherwise the same shape. Without this, the two
34
+ * are indistinguishable and evaluation has to guess.
35
+ *
36
+ * Optional, and absent on every condition saved before this — and on anything
37
+ * the CLI or the compositions API writes. Evaluation MUST therefore treat its
38
+ * absence as "behave exactly as before": re-interpreting an old condition
39
+ * would change published pages with no edit or publish event, which is the
40
+ * failure ADR 0014 exists to prevent.
41
+ */
42
+ subType?: ConditionSubType;
18
43
  };
19
44
  export type NumberCondition = {
20
45
  type: "number";
@@ -1 +1 @@
1
- {"version":3,"file":"condition-types.d.ts","sourceRoot":"","sources":["../../src/types/condition-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACtE,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACtE,MAAM,MAAM,oBAAoB,GAC9B,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACpD,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MA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ACX,eAAe,GACf,MAAM,CAAC;AAEX,qDAAqD;AACrD,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;IAChD,KAAK,EAAE,IAAI,CAAC;CACb,GAAG,iBAAiB,CAAC;AAEtB,iDAAiD;AACjD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEnD,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,iBAAiB,CAAC"}
1
+ {"version":3,"file":"condition-types.d.ts","sourceRoot":"","sources":["../../src/types/condition-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAChF,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACtE,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AACtE,MAAM,MAAM,oBAAo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CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,iBAAiB,CAAC;AAEtB,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,QAAQ,GACR,OAAO,GACP,WAAW,GACX,eAAe,GACf,MAAM,CAAC;AAEX,qDAAqD;AACrD,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAE3D;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,GAAG,iBAAiB,CAAC;IAChD,KAAK,EAAE,IAAI,CAAC;CACb,GAAG,iBAAiB,CAAC;AAEtB,iDAAiD;AACjD,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEnD,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,kBAAkB,GAClB,cAAc,GACd,iBAAiB,CAAC"}
@@ -0,0 +1,126 @@
1
+ import type { BindingType } from "../interfaces";
2
+ import type { Condition, ConditionSubType } from "../types/condition-types";
3
+ /**
4
+ * Turn a stored uid into something readable: `alpha_hero_centered` →
5
+ * "Alpha Hero Centered".
6
+ *
7
+ * Only ever applied to a **uid** — a block or content-type key the author named
8
+ * themselves in the CT builder. NEVER to a literal condition value: a literal is
9
+ * compared against real data, so prettifying `sale_ends` into "Sale Ends" would
10
+ * misstate what the condition actually matches.
11
+ *
12
+ * It is a guess even for a uid — Contentstack derives the uid from the name at
13
+ * creation and then locks it while the display name stays editable, so the two
14
+ * drift. A stored name (see {@link ConditionDisplay}) is always preferred; this
15
+ * is the floor for conditions that carry none.
16
+ */
17
+ export declare function uidToDisplayName(uid: string): string;
18
+ /**
19
+ * Display names stamped on a condition block when its condition is authored,
20
+ * held on the node as `metadata.conditionDisplay`.
21
+ *
22
+ * Deliberately kept OUT of `metadata.condition`: that object is the evaluation
23
+ * contract `evaluateCondition` consumes, and mixing presentation into it invites
24
+ * logic to key off a display string. Equally deliberately, only the two
25
+ * **uid-shaped** parts are stored — the field name and the block / content-type
26
+ * title. The operator and a literal value are derivable from the node, and
27
+ * storing a whole rendered sentence would freeze the grammar: later corrections
28
+ * would reach only conditions authored after them, and the label could fall out
29
+ * of step with the operator on its own node.
30
+ */
31
+ export interface ConditionDisplay {
32
+ /** The condition subject's display name, e.g. `hero_sections` → "Hero Sections". */
33
+ subject?: string;
34
+ /** A block's or referenced content type's title, e.g. `alpha_hero` → "Hero — Alpha". */
35
+ value?: string;
36
+ }
37
+ /**
38
+ * The short description of a condition block, used to tell one apart from its
39
+ * siblings. Rendered in the Layers row and in the block's drop well.
40
+ *
41
+ * `null` and `unsupported` are deliberately distinct. `null` means the block
42
+ * carries no condition at all — the surface should say so. `unsupported` means a
43
+ * condition IS configured but cannot be described; a surface must NOT then claim
44
+ * "no condition configured", which would be a plain lie about a configured block.
45
+ */
46
+ export type ConditionHint = {
47
+ kind: "info";
48
+ prefix: string;
49
+ value: string;
50
+ rawValue: string;
51
+ } | {
52
+ kind: "unsupported";
53
+ };
54
+ export type { ConditionSubType };
55
+ /**
56
+ * Derive the condition's sub-type from the condition alone — no schema.
57
+ *
58
+ * Ported from Studio's `conditionSubTypeConfig` so the Layers row and the canvas
59
+ * drop well cannot disagree with the Settings tab about what a condition is.
60
+ *
61
+ * Note `length` is used as the **catch-all else-branch** for `select`,
62
+ * `reference` and `modular_block`, not as a claim that the condition is about
63
+ * length. {@link subTypeLabel} guards against rendering it as one.
64
+ */
65
+ export declare function getConditionSubType(condition: Condition): ConditionSubType | null;
66
+ /**
67
+ * The field path a binding points at, as stored — `title`, `hero.file_size`,
68
+ * `hero_sections`. Exported so a Repeater's `items` binding and a condition's own
69
+ * binding are read by the same code: a condition block's subject can come from
70
+ * either, and the two must not disagree.
71
+ */
72
+ export declare function getBindingFieldPath(binding?: BindingType): string | undefined;
73
+ /**
74
+ * The field path a condition is evaluated against, as stored. Not de-uid-ified:
75
+ * this is a key, and prettifying a key produces something that reads as a display
76
+ * name and silently contradicts the real one whenever the two have drifted.
77
+ */
78
+ export declare function getConditionSubject(condition: Condition): string | undefined;
79
+ /**
80
+ * True when the condition's subject has collapsed into its own value and so
81
+ * identifies nothing.
82
+ *
83
+ * `useAddCondition` (and `createConditionBlockNode` on the auto path) rewrite a
84
+ * **repeater-scoped** identity binding's `path` to the condition value itself.
85
+ * The binding then points at the branch rather than at the field, so rendering
86
+ * subject + operator + value would read `block_1 == block_1`, or
87
+ * `_content_type_uid == author` where the subject just restates the operator.
88
+ *
89
+ * Value-only is also what the author needs there for an independent reason: every
90
+ * sibling branch inside one repeater is on the same field, so naming that field
91
+ * would distinguish nothing and would only cost width.
92
+ *
93
+ * NOT every identity condition is degenerate. A blocks-field condition bound
94
+ * through a template binding (only the repeater data source is `isNestedContext`,
95
+ * so only it triggers the rewrite) keeps a real subject and reads
96
+ * `hero_sections.Block Name == Alpha Hero Centered`.
97
+ */
98
+ export declare function isDegenerateSubject(condition: Condition): boolean;
99
+ /**
100
+ * Build the condition hint from the node's condition.
101
+ *
102
+ * The subject is taken from the first source that has one:
103
+ *
104
+ * 1. `display.subject` — a name stamped when the condition was authored
105
+ * 2. `selected_field` on the condition's own binding — set for section-scoped
106
+ * conditions, whose Repeater binds with an empty path
107
+ * 3. `fallback.subject` — a name the caller derived from context, which is how a
108
+ * collapsed page-scoped subject is recovered: the block's parent Repeater
109
+ * still names the field even though the condition's binding no longer does
110
+ * 4. the condition's own binding — unless that has collapsed into the value
111
+ *
112
+ * With a subject: When <subject>[.<SubType>] <op> <value>
113
+ * Without one: When <value>
114
+ *
115
+ * A collapsed subject is therefore no longer *dropped*, only *unavailable* — which
116
+ * it stops being as soon as a caller can name it. That is what lets the Layers row
117
+ * and the drop well read the same condition the Settings tab does, whose own
118
+ * resolver walks to the Repeater for exactly this reason.
119
+ *
120
+ * Returns `unsupported` when nothing describable is left — an array or object
121
+ * value, or a non-presence condition with no value and no subject.
122
+ */
123
+ export declare function getConditionHint(condition?: Condition | null, display?: ConditionDisplay, fallback?: {
124
+ subject?: string;
125
+ }): ConditionHint | null;
126
+ //# sourceMappingURL=condition-hint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-hint.d.ts","sourceRoot":"","sources":["../../src/utils/condition-hint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAwD5B,YAAY,EAAE,gBAAgB,EAAE,CAAC;AAEjC;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,GACnB,gBAAgB,GAAG,IAAI,CAgCzB;AAwED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAa7E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAI5E;AAyBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAMjE;AA4CD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,CAAC,EAAE,SAAS,GAAG,IAAI,EAC5B,OAAO,CAAC,EAAE,gBAAgB,EAC1B,QAAQ,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9B,aAAa,GAAG,IAAI,CAuCtB"}
@@ -0,0 +1,352 @@
1
+ import { CONDITION_OPERATORS } from '../constants/condition.js';
2
+
3
+ /**
4
+ * Turn a stored uid into something readable: `alpha_hero_centered` →
5
+ * "Alpha Hero Centered".
6
+ *
7
+ * Only ever applied to a **uid** — a block or content-type key the author named
8
+ * themselves in the CT builder. NEVER to a literal condition value: a literal is
9
+ * compared against real data, so prettifying `sale_ends` into "Sale Ends" would
10
+ * misstate what the condition actually matches.
11
+ *
12
+ * It is a guess even for a uid — Contentstack derives the uid from the name at
13
+ * creation and then locks it while the display name stays editable, so the two
14
+ * drift. A stored name (see {@link ConditionDisplay}) is always preferred; this
15
+ * is the floor for conditions that carry none.
16
+ */
17
+ function uidToDisplayName(uid) {
18
+ return uid.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
19
+ }
20
+ /** A reference condition binds against this key rather than against a field. */
21
+ const CONTENT_TYPE_UID_KEY = "_content_type_uid";
22
+ const values = (list) => new Set(list.map((o) => o.value));
23
+ const PRESENCE_OPERATORS = values([
24
+ ...CONDITION_OPERATORS.EXISTENCE_OPERATORS,
25
+ ...CONDITION_OPERATORS.EMPTINESS_OPERATORS,
26
+ ]);
27
+ /** Operators whose own symbol already reads "length …", so a Length label would double up. */
28
+ const ARRAY_OPERATORS = values(CONDITION_OPERATORS.ARRAY_OPERATORS);
29
+ const REF_CONTENT_TYPE_OPERATORS = new Set(["eq", "contentTypeIs"]);
30
+ const BLOCK_NAME_OPERATORS = new Set(["eq", "is"]);
31
+ const SELECT_OPTIONS_OPERATORS = new Set(["includes", "excludes"]);
32
+ /** Every operator, flattened, for symbol / label lookup by stored value. */
33
+ const OPERATOR_BY_VALUE = {};
34
+ for (const list of Object.values(CONDITION_OPERATORS)) {
35
+ for (const op of list) {
36
+ if (!OPERATOR_BY_VALUE[op.value]) {
37
+ OPERATOR_BY_VALUE[op.value] = { label: op.label, symbol: op.symbol };
38
+ }
39
+ }
40
+ }
41
+ /**
42
+ * Whether a condition's value is a number — including a numeric **string**.
43
+ *
44
+ * The string case is not defensive padding: `convertValueByDataType` only coerces
45
+ * for `boolean` and `number` FIELD data types, so a length check on a `blocks` or
46
+ * `reference` field persists `"3"` rather than `3`, even though its input is
47
+ * `type="number"`.
48
+ *
49
+ * This is the only signal separating a length check from an identity check.
50
+ * Neither the sub-type nor the field's data type is stored on the condition, so
51
+ * `Length == 3` and `Block Name == block_1` are otherwise identical:
52
+ * `{ type: "modular_block", operator: "eq" }`.
53
+ */
54
+ function isNumericValue(value) {
55
+ if (typeof value === "number")
56
+ return Number.isFinite(value);
57
+ if (typeof value !== "string")
58
+ return false;
59
+ const trimmed = value.trim();
60
+ return trimmed !== "" && Number.isFinite(Number(trimmed));
61
+ }
62
+ /**
63
+ * Derive the condition's sub-type from the condition alone — no schema.
64
+ *
65
+ * Ported from Studio's `conditionSubTypeConfig` so the Layers row and the canvas
66
+ * drop well cannot disagree with the Settings tab about what a condition is.
67
+ *
68
+ * Note `length` is used as the **catch-all else-branch** for `select`,
69
+ * `reference` and `modular_block`, not as a claim that the condition is about
70
+ * length. {@link subTypeLabel} guards against rendering it as one.
71
+ */
72
+ function getConditionSubType(condition) {
73
+ // Prefer what the author actually chose. Everything below is inference for
74
+ // conditions that predate `subType` — and for anything the CLI or the
75
+ // compositions API writes, which never records it. Guessing when the answer is
76
+ // on the node would keep the known-wrong cases wrong: a numeric block uid
77
+ // reading as a length check, and the `select` catch-all arm.
78
+ if (condition.subType)
79
+ return condition.subType;
80
+ const { type, operator } = condition;
81
+ // Presence is derived from the OPERATOR: a presence check persists the
82
+ // subject's own type, so a type-first derivation would miss it.
83
+ if (PRESENCE_OPERATORS.has(operator))
84
+ return "presence";
85
+ if (type === "image_extension")
86
+ return "image_extension";
87
+ if (type === "image_size")
88
+ return "image_size";
89
+ if (type === "array")
90
+ return "length";
91
+ if (type === "select")
92
+ return SELECT_OPTIONS_OPERATORS.has(operator) ? "select_options" : "length";
93
+ // `eq` is shared between an identity check and a length comparison, and the
94
+ // sub-type is not persisted — so an author who picked Length and typed 3 saved
95
+ // exactly what Block Name would have. Only the value tells them apart.
96
+ const numeric = isNumericValue(condition.value);
97
+ if (type === "reference") {
98
+ return REF_CONTENT_TYPE_OPERATORS.has(operator) && !numeric
99
+ ? "ref_content_type"
100
+ : "length";
101
+ }
102
+ if (type === "modular_block") {
103
+ return BLOCK_NAME_OPERATORS.has(operator) && !numeric
104
+ ? "block_name"
105
+ : "length";
106
+ }
107
+ return null;
108
+ }
109
+ const SUB_TYPE_LABELS = {
110
+ block_name: "Block Name",
111
+ ref_content_type: "Content Type",
112
+ length: "Length",
113
+ image_size: "Size",
114
+ image_extension: "Extension",
115
+ select_options: "Selection",
116
+ };
117
+ /**
118
+ * The sub-type label to append to the subject, or `undefined` when the operator
119
+ * already implies it and appending would be noise or a contradiction.
120
+ *
121
+ * Skipped for:
122
+ * - `presence` — the operator says "exists" / "is empty"; "Hero.Presence Exists"
123
+ * reads as a doubling.
124
+ * - `select_options` — `includes` / `excludes` already say the subject is a set.
125
+ * - `length` with an ARRAY operator — its symbol is already `length >`.
126
+ * - `length` on any type other than `array` — there it is the catch-all arm, so a
127
+ * single-select `eq` would otherwise render `colors.Length == red`.
128
+ */
129
+ function subTypeLabel(condition) {
130
+ const subType = getConditionSubType(condition);
131
+ if (!subType)
132
+ return undefined;
133
+ if (subType === "presence" || subType === "select_options")
134
+ return undefined;
135
+ if (subType === "length") {
136
+ // The operator's own symbol already reads "length >".
137
+ if (ARRAY_OPERATORS.has(condition.operator))
138
+ return undefined;
139
+ // A recorded sub-type is a fact, not a guess: trust it and skip the value
140
+ // test below. Suppressing the label here while the evaluator honours
141
+ // `subType === "length"` would put the two back out of step.
142
+ if (condition.subType === "length")
143
+ return SUB_TYPE_LABELS[subType];
144
+ // `length` is the catch-all else-branch of the `select` / `reference` /
145
+ // `modular_block` arms, so it is not by itself a claim about length. A length
146
+ // comparison is numeric — that is the signal. Without this, a single-select
147
+ // equality would render `colors.Length == "red"`.
148
+ if (!isNumericValue(condition.value))
149
+ return undefined;
150
+ }
151
+ return SUB_TYPE_LABELS[subType];
152
+ }
153
+ /** How the operator reads: its symbol where it has one, else its label lowercased. */
154
+ function operatorLabel(operator) {
155
+ const op = OPERATOR_BY_VALUE[operator];
156
+ if (!op)
157
+ return operator;
158
+ // Raw labels are title-cased for menu items ("Starts with", "Is Not"), which
159
+ // reads as a proper noun mid-string. Symbols stay as-is.
160
+ return op.symbol ?? op.label.toLowerCase();
161
+ }
162
+ /**
163
+ * Flatten a Contentstack-shaped binding path into dot notation:
164
+ * `{ hero: { file_size: {} } }` → `"hero.file_size"`.
165
+ *
166
+ * Reimplemented here rather than imported: `studio-registry` and `studio-client`
167
+ * each hold their own copy, but both sit downstream of this package, and this
168
+ * module must stay importable by a leaf. `BindingType` is defined here, so the
169
+ * walk arguably belongs here and the other two copies should collapse onto it —
170
+ * out of scope for this change.
171
+ */
172
+ function flattenBindingPath(path) {
173
+ if (!path || typeof path !== "object")
174
+ return "";
175
+ const keys = Object.keys(path);
176
+ if (keys.length === 0)
177
+ return "";
178
+ const key = keys[0];
179
+ const rest = flattenBindingPath(path[key]);
180
+ return rest ? `${key}.${rest}` : key;
181
+ }
182
+ /**
183
+ * The field path a binding points at, as stored — `title`, `hero.file_size`,
184
+ * `hero_sections`. Exported so a Repeater's `items` binding and a condition's own
185
+ * binding are read by the same code: a condition block's subject can come from
186
+ * either, and the two must not disagree.
187
+ */
188
+ function getBindingFieldPath(binding) {
189
+ if (!binding || typeof binding !== "object")
190
+ return undefined;
191
+ const value = binding.value;
192
+ // `component_props` and `static_value` bindings carry a plain string rather
193
+ // than a `path` object; the key is the string itself.
194
+ if (typeof value === "string")
195
+ return value.split(".").pop() || undefined;
196
+ const path = flattenBindingPath(value?.path);
197
+ return path || undefined;
198
+ }
199
+ /**
200
+ * The field path a condition is evaluated against, as stored. Not de-uid-ified:
201
+ * this is a key, and prettifying a key produces something that reads as a display
202
+ * name and silently contradicts the real one whenever the two have drifted.
203
+ */
204
+ function getConditionSubject(condition) {
205
+ return getBindingFieldPath(condition.conditionBinding);
206
+ }
207
+ /**
208
+ * The field a **section-scoped** condition is bound within, de-uid-ified.
209
+ *
210
+ * `createConditionBlockNode` records `selected_field` on the condition's binding
211
+ * for section compositions, because a section's Repeater binds with an empty
212
+ * `path` and the field lives on the composition's linked schema instead. That
213
+ * makes this the one way to name the subject of a collapsed section-scoped
214
+ * condition without reaching into Studio's store — so the canvas and the Layers
215
+ * row can derive the same name.
216
+ *
217
+ * De-uid-ified, matching the Repeater row that renders the same field as
218
+ * "Iterates Hero Sections"; showing it raw here would make the two rows disagree.
219
+ */
220
+ function getSectionScopeFieldName(condition) {
221
+ const value = condition
222
+ .conditionBinding?.value;
223
+ const selected = value
224
+ ?.selected_field;
225
+ if (typeof selected !== "string" || !selected.trim())
226
+ return undefined;
227
+ const last = selected.split(".").pop() || selected;
228
+ return uidToDisplayName(last);
229
+ }
230
+ /**
231
+ * True when the condition's subject has collapsed into its own value and so
232
+ * identifies nothing.
233
+ *
234
+ * `useAddCondition` (and `createConditionBlockNode` on the auto path) rewrite a
235
+ * **repeater-scoped** identity binding's `path` to the condition value itself.
236
+ * The binding then points at the branch rather than at the field, so rendering
237
+ * subject + operator + value would read `block_1 == block_1`, or
238
+ * `_content_type_uid == author` where the subject just restates the operator.
239
+ *
240
+ * Value-only is also what the author needs there for an independent reason: every
241
+ * sibling branch inside one repeater is on the same field, so naming that field
242
+ * would distinguish nothing and would only cost width.
243
+ *
244
+ * NOT every identity condition is degenerate. A blocks-field condition bound
245
+ * through a template binding (only the repeater data source is `isNestedContext`,
246
+ * so only it triggers the rewrite) keeps a real subject and reads
247
+ * `hero_sections.Block Name == Alpha Hero Centered`.
248
+ */
249
+ function isDegenerateSubject(condition) {
250
+ const subject = getConditionSubject(condition);
251
+ if (!subject)
252
+ return false;
253
+ return (subject === CONTENT_TYPE_UID_KEY || subject === String(condition.value));
254
+ }
255
+ /**
256
+ * True when the condition's value is a **uid** rather than a literal — a block
257
+ * uid or a content-type uid — and is therefore safe to render as a display name.
258
+ *
259
+ * Deliberately independent of {@link isDegenerateSubject}. Those answer different
260
+ * questions: whether the *subject* is worth showing, and whether the *value* is a
261
+ * uid. Tying de-uid-ification to degeneracy meant a blocks condition bound
262
+ * through a template binding printed the raw `alpha_hero_centered` instead of its
263
+ * name.
264
+ */
265
+ function hasUidValue(condition) {
266
+ return ((condition.type === "modular_block" || condition.type === "reference") &&
267
+ typeof condition.value === "string" &&
268
+ condition.value.length > 0);
269
+ }
270
+ /**
271
+ * How the value reads. `undefined` means the value must not be rendered at all
272
+ * (a presence check carries none) — distinct from a value that cannot be
273
+ * described, which makes the whole hint `unsupported`.
274
+ */
275
+ function valueLabel(condition, display) {
276
+ const { value } = condition;
277
+ if (PRESENCE_OPERATORS.has(condition.operator))
278
+ return undefined;
279
+ if (hasUidValue(condition)) {
280
+ return display?.value || uidToDisplayName(value);
281
+ }
282
+ // Quotes are the only delimiter left once the subject is a raw key and the
283
+ // operator a symbol, and multi-word values are ordinary. Numbers and booleans
284
+ // stay bare — quoting them would suggest a string comparison.
285
+ if (typeof value === "string")
286
+ return `"${value}"`;
287
+ if (typeof value === "number" || typeof value === "boolean")
288
+ return String(value);
289
+ return undefined;
290
+ }
291
+ /**
292
+ * Build the condition hint from the node's condition.
293
+ *
294
+ * The subject is taken from the first source that has one:
295
+ *
296
+ * 1. `display.subject` — a name stamped when the condition was authored
297
+ * 2. `selected_field` on the condition's own binding — set for section-scoped
298
+ * conditions, whose Repeater binds with an empty path
299
+ * 3. `fallback.subject` — a name the caller derived from context, which is how a
300
+ * collapsed page-scoped subject is recovered: the block's parent Repeater
301
+ * still names the field even though the condition's binding no longer does
302
+ * 4. the condition's own binding — unless that has collapsed into the value
303
+ *
304
+ * With a subject: When <subject>[.<SubType>] <op> <value>
305
+ * Without one: When <value>
306
+ *
307
+ * A collapsed subject is therefore no longer *dropped*, only *unavailable* — which
308
+ * it stops being as soon as a caller can name it. That is what lets the Layers row
309
+ * and the drop well read the same condition the Settings tab does, whose own
310
+ * resolver walks to the Repeater for exactly this reason.
311
+ *
312
+ * Returns `unsupported` when nothing describable is left — an array or object
313
+ * value, or a non-presence condition with no value and no subject.
314
+ */
315
+ function getConditionHint(condition, display, fallback) {
316
+ if (!condition)
317
+ return null;
318
+ const rawValue = String(condition.value ?? "");
319
+ const isPresence = PRESENCE_OPERATORS.has(condition.operator);
320
+ const ownSubject = isDegenerateSubject(condition)
321
+ ? undefined
322
+ : getConditionSubject(condition);
323
+ const subject = display?.subject ||
324
+ getSectionScopeFieldName(condition) ||
325
+ fallback?.subject ||
326
+ ownSubject;
327
+ const value = valueLabel(condition, display);
328
+ // Nothing to say: no subject to name and no value to compare.
329
+ if (!subject && value === undefined)
330
+ return { kind: "unsupported" };
331
+ // A value we cannot describe (array / object), on a condition that should have
332
+ // one. Naming the subject and operator without it would read as truncated.
333
+ if (!isPresence && value === undefined)
334
+ return { kind: "unsupported" };
335
+ // With no subject there is nothing for the operator to relate the value to, so
336
+ // a dangling `== "Sale"` would read as truncated. Show the value alone — which
337
+ // is also the collapsed-subject reading when no caller could name the field.
338
+ const parts = subject
339
+ ? [
340
+ [subject, subTypeLabel(condition)].filter(Boolean).join("."),
341
+ operatorLabel(condition.operator),
342
+ value,
343
+ ]
344
+ : [value];
345
+ const text = parts
346
+ .filter((part) => part !== undefined && part !== "")
347
+ .join(" ");
348
+ return { kind: "info", prefix: "When", value: text, rawValue };
349
+ }
350
+
351
+ export { getBindingFieldPath, getConditionHint, getConditionSubType, getConditionSubject, isDegenerateSubject, uidToDisplayName };
352
+ //# sourceMappingURL=condition-hint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"condition-hint.js","sources":["../../src/utils/condition-hint.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;AAaG;AACG,SAAU,gBAAgB,CAAC,GAAW,EAAA;IAC1C,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;AACxE;AAmCA;AACA,MAAM,oBAAoB,GAAG,mBAAmB;AAEhD,MAAM,MAAM,GAAG,CAAC,IAAkC,KAChD,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;AAEnC,MAAM,kBAAkB,GAAG,MAAM,CAAC;IAChC,GAAG,mBAAmB,CAAC,mBAAmB;IAC1C,GAAG,mBAAmB,CAAC,mBAAmB;AAC3C,CAAA,CAAC;AACF;AACA,MAAM,eAAe,GAAG,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC;AACnE,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AACnE,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAClD,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAElE;AACA,MAAM,iBAAiB,GACrB,EAAE;AACJ,KAAK,MAAM,IAAI,IAAI,MAA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MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AAC5D,YAAA,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC;YACjC,KAAK;AACN;AACH,UAAE,CAAC,KAAK,CAAC;IAEX,MAAM,IAAI,GAAG;AACV,SAAA,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;SAClD,IAAI,CAAC,GAAG,CAAC;AAEZ,IAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE;AAChE;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentstack/studio-internal",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "This is core package which is a flavour of slate js and consist of all editor functionality",
5
5
  "author": "Contentstack",
6
6
  "homepage": "https://github.com/contentstack/composable-studio-sdk/tree/main/packages/studio-internal#readme",
@@ -39,7 +39,7 @@
39
39
  "uuid": "^11.1.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@contentstack/common-config": "^1.2.3",
42
+ "@contentstack/common-config": "^1.2.5",
43
43
  "@rollup/plugin-commonjs": "^28.0.6",
44
44
  "@rollup/plugin-node-resolve": "^16.0.1",
45
45
  "@rollup/plugin-terser": "^1.0.0",
@@ -50,6 +50,5 @@
50
50
  "rollup-plugin-dts": "^6.2.1",
51
51
  "rollup-plugin-node-externals": "^8.0.1",
52
52
  "rollup-plugin-preserve-directives": "^0.4.0"
53
- },
54
- "gitHead": "1e35733997b7c0e030296d3ebcf053aee69151a3"
53
+ }
55
54
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Contentstack
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.