@contentstack/studio-internal 1.8.0 → 1.9.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 +121 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/node.d.ts +14 -0
- package/dist/interfaces/node.d.ts.map +1 -1
- package/dist/interfaces/node.js.map +1 -1
- package/dist/utils/composition-rules.d.ts +32 -0
- package/dist/utils/composition-rules.d.ts.map +1 -0
- package/dist/utils/composition-rules.js +55 -0
- package/dist/utils/composition-rules.js.map +1 -0
- package/dist/utils/normalize-data-sources.d.ts +23 -0
- package/dist/utils/normalize-data-sources.d.ts.map +1 -0
- package/dist/utils/normalize-data-sources.js +102 -0
- package/dist/utils/normalize-data-sources.js.map +1 -0
- package/dist/utils/normalize-ui.d.ts +51 -0
- package/dist/utils/normalize-ui.d.ts.map +1 -0
- package/dist/utils/normalize-ui.js +405 -0
- package/dist/utils/normalize-ui.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -572,9 +572,21 @@ type NodeProp = NodePropsWithBinding | NodePropWithUnknownValue | NodePropsForOb
|
|
|
572
572
|
type BindableNodeProp = NodePropsWithBinding | NodePropWithBindingMap;
|
|
573
573
|
type NodePropWithBindingMap = NodePropsForArray | NodePropsForObject;
|
|
574
574
|
type NodeProps = Record<string, NodeProp>;
|
|
575
|
+
/**
|
|
576
|
+
* Where a `component_props` binding's value comes from, as Studio records it
|
|
577
|
+
* when the author picks it, so renderers need not guess from the key:
|
|
578
|
+
* - `state`: a Studio state variable the app declared;
|
|
579
|
+
* - `function`: a function the app registered (bound to make a node clickable);
|
|
580
|
+
* - `slot`: a key the enclosing `<Slot data>` provides;
|
|
581
|
+
* - `props`: the component's props — host data or external data.
|
|
582
|
+
* Bindings saved before Studio wrote the tag have none.
|
|
583
|
+
*/
|
|
584
|
+
type BindingSource = "state" | "function" | "slot" | "props";
|
|
575
585
|
type BindingType = {
|
|
576
586
|
type: string;
|
|
577
587
|
value: unknown;
|
|
588
|
+
/** Only on `component_props` bindings; see {@link BindingSource}. */
|
|
589
|
+
source?: BindingSource;
|
|
578
590
|
};
|
|
579
591
|
interface NodePropsWithBinding {
|
|
580
592
|
type: BindableNodePropType;
|
|
@@ -587,6 +599,8 @@ interface NodePropsForObject {
|
|
|
587
599
|
type: NodePropTypes["object"];
|
|
588
600
|
binding?: BindingType;
|
|
589
601
|
bindingMap?: BindingMap;
|
|
602
|
+
/** A value the node carries itself, used when nothing is bound. */
|
|
603
|
+
value?: unknown;
|
|
590
604
|
}
|
|
591
605
|
interface NodePropsForArray {
|
|
592
606
|
type: NodePropTypes["array"];
|
|
@@ -1322,6 +1336,38 @@ declare function getConditionHint(condition?: Condition | null, display?: Condit
|
|
|
1322
1336
|
*/
|
|
1323
1337
|
declare const ID_LENGTH = 15;
|
|
1324
1338
|
|
|
1339
|
+
/**
|
|
1340
|
+
* Rules a composition's fields follow wherever they are written: the Studio API
|
|
1341
|
+
* refuses a write that breaks them, and Studio's forms check them as the author
|
|
1342
|
+
* types. One definition, so the two can never disagree.
|
|
1343
|
+
*/
|
|
1344
|
+
/**
|
|
1345
|
+
* A composition's `composable_uid`: lowercase letters, digits and "_", at most
|
|
1346
|
+
* 200 characters — a content type uid's limits on Contentstack, kept lowercase.
|
|
1347
|
+
*/
|
|
1348
|
+
declare const COMPOSABLE_UID_PATTERN: RegExp;
|
|
1349
|
+
declare const COMPOSABLE_UID_MAX_LENGTH = 200;
|
|
1350
|
+
/** What is wrong with a composable_uid, if anything. */
|
|
1351
|
+
type ComposableUidProblem = "missing" | "blank" | "invalid_characters" | "too_long";
|
|
1352
|
+
declare function composableUidProblem(uid: unknown): ComposableUidProblem | undefined;
|
|
1353
|
+
/** The characters of a uid that a composable_uid can't use, each once. */
|
|
1354
|
+
declare const composableUidInvalidCharacters: (uid: string) => string[];
|
|
1355
|
+
/**
|
|
1356
|
+
* A composable_uid suggested from a name: lowercased, each run of other
|
|
1357
|
+
* characters made one "_" (as the Contentstack SDK's generateUid), no "_" at
|
|
1358
|
+
* either end, cut to the length a uid can have — so it always has no problem.
|
|
1359
|
+
*/
|
|
1360
|
+
declare const composableUidFromName: (name: string) => string;
|
|
1361
|
+
/** An HTML attribute name a component may carry. */
|
|
1362
|
+
declare const HTML_ATTRIBUTE_NAME_PATTERN: RegExp;
|
|
1363
|
+
/** Attribute names Studio sets itself, through styles: class and style. */
|
|
1364
|
+
declare const STYLE_HTML_ATTRIBUTES: readonly ["class", "classname", "style"];
|
|
1365
|
+
/** The prefix of the attributes Studio adds to a rendered component. */
|
|
1366
|
+
declare const STUDIO_HTML_ATTRIBUTE_PREFIX = "data-composable-studio-";
|
|
1367
|
+
/** What is wrong with an HTML attribute name, if anything. */
|
|
1368
|
+
type HtmlAttributeNameProblem = "invalid_name" | "style_attribute" | "studio_attribute";
|
|
1369
|
+
declare function htmlAttributeNameProblem(name: string): HtmlAttributeNameProblem | undefined;
|
|
1370
|
+
|
|
1325
1371
|
/**
|
|
1326
1372
|
* Compress a UI spec using zlib compression for storage.
|
|
1327
1373
|
*
|
|
@@ -1376,6 +1422,79 @@ declare function validateCompression(spec: Node): {
|
|
|
1376
1422
|
isIdentical: boolean;
|
|
1377
1423
|
};
|
|
1378
1424
|
|
|
1425
|
+
/**
|
|
1426
|
+
* Brings a stored layout into the shape every reader assumes, so a broken
|
|
1427
|
+
* composition degrades instead of crashing the page.
|
|
1428
|
+
*
|
|
1429
|
+
* Compositions reach the SDK straight from the CMS: anything that wrote the
|
|
1430
|
+
* entry (the CMA, an import, an older or newer Studio, a hand edit) can leave a
|
|
1431
|
+
* field missing, `null` or of the wrong type. Readers walk `node.props`,
|
|
1432
|
+
* `node.slots[k]`, `binding.value.path` and the rest without guarding each
|
|
1433
|
+
* access, so instead of a guard at every site the tree is normalized once, where
|
|
1434
|
+
* it enters the SDK:
|
|
1435
|
+
*
|
|
1436
|
+
* - Valid data is kept exactly; unknown keys are kept as they are.
|
|
1437
|
+
* - A container of the wrong type becomes empty: `props`, `slots`, `metadata`,
|
|
1438
|
+
* `attrs`, `styles` → `{}`, a slot → `[]`.
|
|
1439
|
+
* - What cannot be read is dropped, not guessed: a child without a string
|
|
1440
|
+
* `uid` and `type`, a prop that is not an object, a binding that cannot be
|
|
1441
|
+
* resolved (the prop stays, so it renders its default), a style declaration
|
|
1442
|
+
* that is not a string or number.
|
|
1443
|
+
* - The root is the layout itself: a root missing its `uid` or `type` is read as
|
|
1444
|
+
* `root` / `page` rather than dropping the whole page.
|
|
1445
|
+
*
|
|
1446
|
+
* Returns a new tree — the input is never mutated — or `null` when `ui` is not
|
|
1447
|
+
* a node at all. A tree this function returned is passed through unchanged.
|
|
1448
|
+
*/
|
|
1449
|
+
declare function normalizeUi(ui: unknown): Node | null;
|
|
1450
|
+
/**
|
|
1451
|
+
* A binding the SDK can resolve, or `null`. Path bindings need an object
|
|
1452
|
+
* `value` whose `path` is a chain of objects (a `null` leaf is read as the
|
|
1453
|
+
* end of the chain) and the ids their type names; key bindings need a string
|
|
1454
|
+
* key. Any other type is one this SDK cannot resolve. Only what would make
|
|
1455
|
+
* a reader throw or read the wrong thing is refused: this is not validation.
|
|
1456
|
+
*/
|
|
1457
|
+
declare function normalizeBinding(raw: unknown): Record<string, any> | null;
|
|
1458
|
+
/**
|
|
1459
|
+
* A stored layout — compressed text, legacy JSON text, or a parsed tree — read
|
|
1460
|
+
* and normalized; `null` when it is not a layout.
|
|
1461
|
+
*/
|
|
1462
|
+
declare function readLayout(ui: unknown): Node | null;
|
|
1463
|
+
/**
|
|
1464
|
+
* A spec as the renderers and style extractors read it: its `ui` normalized
|
|
1465
|
+
* (`null` when unreadable — the page renders nothing), and its
|
|
1466
|
+
* `sectionCompositions` a list of sections with readable layouts (a section
|
|
1467
|
+
* whose layout cannot be read is left out; its placements render nothing).
|
|
1468
|
+
*
|
|
1469
|
+
* Specs reach the renderers from the SDK's fetch and straight from apps (bring
|
|
1470
|
+
* your own data, a spec built or cached by hand), so each render and style
|
|
1471
|
+
* entry reads it through here. Returns a new spec; the input is not mutated.
|
|
1472
|
+
*/
|
|
1473
|
+
declare function normalizeSpec<T>(spec: T): T;
|
|
1474
|
+
|
|
1475
|
+
/**
|
|
1476
|
+
* A composition's `data_sources`, in the shape every reader assumes.
|
|
1477
|
+
*
|
|
1478
|
+
* Stored as JSON text (an array, or an object keyed by uid), it reaches the SDK
|
|
1479
|
+
* from the CMS as whatever wrote it. A dozen readers parse it and walk it
|
|
1480
|
+
* (pinned entries, queries, resolved references, external data), so it is read
|
|
1481
|
+
* once, where an entry enters the SDK, and handed on as clean JSON text: what
|
|
1482
|
+
* cannot be read is dropped, the rest is kept as it was.
|
|
1483
|
+
*/
|
|
1484
|
+
/**
|
|
1485
|
+
* `data_sources` as clean JSON text (`"[]"` when nothing is readable). Text that
|
|
1486
|
+
* is not JSON is handed on unchanged: its readers already treat it as empty and
|
|
1487
|
+
* report it as DATA_SOURCES_UNREADABLE, naming the composition.
|
|
1488
|
+
*/
|
|
1489
|
+
declare function normalizeDataSources(raw: unknown): unknown;
|
|
1490
|
+
/**
|
|
1491
|
+
* The entry with its `data_sources` normalized. An entry without the field is
|
|
1492
|
+
* returned as it is: "absent" and "empty" read differently downstream.
|
|
1493
|
+
*/
|
|
1494
|
+
declare function withNormalizedDataSources<T extends {
|
|
1495
|
+
data_sources?: unknown;
|
|
1496
|
+
}>(entry: T): T;
|
|
1497
|
+
|
|
1379
1498
|
/**
|
|
1380
1499
|
* Shared section-UI walker for section-slot context resolution.
|
|
1381
1500
|
*
|
|
@@ -1427,5 +1546,5 @@ interface SectionSlotContext {
|
|
|
1427
1546
|
*/
|
|
1428
1547
|
declare function indexSectionSlotContexts(sectionUI: any): Record<string, SectionSlotContext>;
|
|
1429
1548
|
|
|
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 };
|
|
1549
|
+
export { COMPOSABLE_UID_MAX_LENGTH, COMPOSABLE_UID_PATTERN, CONDITION_OPERATORS, Editor, HTML_ATTRIBUTE_NAME_PATTERN, ID_LENGTH, Node, Operation, Path, PathRef, STUDIO_HTML_ATTRIBUTE_PREFIX, STYLE_HTML_ATTRIBUTES, Transforms, apply, composableUidFromName, composableUidInvalidCharacters, composableUidProblem, compressSpec, createEditor, decompressSpec, getBindingFieldPath, getConditionHint, getConditionSubType, getConditionSubject, getDirtyPaths, hasUnsavedChanges, htmlAttributeNameProblem, indexSectionSlotContexts, insertNodes, isDegenerateSubject, isNormalizing, liftNodes, moveNodes, node, nodes, normalize, normalizeBinding, normalizeDataSources, normalizeNode, normalizeSpec, normalizeUi, pathRef, pathRefs, readLayout, removeNodes, setActiveContextPath, setClasses, setHasUnSavedChanges, setNodes, setNormalizing, setProp, setResponsiveStyles, setSelection, shouldNormalize, uidToDisplayName, unsetProp, unsetResponsiveStyles, unwrapNodes, validateCompression, withNormalizedDataSources, withoutNormalizing, wrapNodes };
|
|
1550
|
+
export type { Ancestor, ArrayCondition, ArrayOperator, BaseEditor, BindableNodeProp, BindableNodePropType, BindingMap, BindingSource, BindingType, BooleanCondition, BooleanOperator, ComparisonOperator, ComposableUidProblem, Condition, ConditionBindings, ConditionDisplay, ConditionHint, ConditionSubType, CustomTypes, DateCondition, Descendant, EditorInterface, EditorNodesOptions, EditorNormalizeOptions, EditorPathOptions, EditorPathRefOptions, EmptinessOperator, ExistenceCondition, ExistenceConditionType, ExistenceOperator, ExtendedType, HtmlAttributeNameProblem, 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 };
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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"}
|
|
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,yBAAyB,EACzB,sBAAsB,EACtB,2BAA2B,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,GAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,KAAK,kBAAkB,GACxB,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,9 @@ export { unsetProp } from './transforms-node/unset-props.js';
|
|
|
35
35
|
export { CONDITION_OPERATORS } from './constants/condition.js';
|
|
36
36
|
export { getBindingFieldPath, getConditionHint, getConditionSubType, getConditionSubject, isDegenerateSubject, uidToDisplayName } from './utils/condition-hint.js';
|
|
37
37
|
export { ID_LENGTH } from './constants/id.js';
|
|
38
|
+
export { COMPOSABLE_UID_MAX_LENGTH, COMPOSABLE_UID_PATTERN, HTML_ATTRIBUTE_NAME_PATTERN, STUDIO_HTML_ATTRIBUTE_PREFIX, STYLE_HTML_ATTRIBUTES, composableUidFromName, composableUidInvalidCharacters, composableUidProblem, htmlAttributeNameProblem } from './utils/composition-rules.js';
|
|
38
39
|
export { compressSpec, decompressSpec, validateCompression } from './utils/spec-compression.js';
|
|
40
|
+
export { normalizeBinding, normalizeSpec, normalizeUi, readLayout } from './utils/normalize-ui.js';
|
|
41
|
+
export { normalizeDataSources, withNormalizedDataSources } from './utils/normalize-data-sources.js';
|
|
39
42
|
export { indexSectionSlotContexts } from './utils/section-slot-walker.js';
|
|
40
43
|
//# sourceMappingURL=index.js.map
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -26,9 +26,21 @@ export type NodeProp = NodePropsWithBinding | NodePropWithUnknownValue | NodePro
|
|
|
26
26
|
export type BindableNodeProp = NodePropsWithBinding | NodePropWithBindingMap;
|
|
27
27
|
export type NodePropWithBindingMap = NodePropsForArray | NodePropsForObject;
|
|
28
28
|
export type NodeProps = Record<string, NodeProp>;
|
|
29
|
+
/**
|
|
30
|
+
* Where a `component_props` binding's value comes from, as Studio records it
|
|
31
|
+
* when the author picks it, so renderers need not guess from the key:
|
|
32
|
+
* - `state`: a Studio state variable the app declared;
|
|
33
|
+
* - `function`: a function the app registered (bound to make a node clickable);
|
|
34
|
+
* - `slot`: a key the enclosing `<Slot data>` provides;
|
|
35
|
+
* - `props`: the component's props — host data or external data.
|
|
36
|
+
* Bindings saved before Studio wrote the tag have none.
|
|
37
|
+
*/
|
|
38
|
+
export type BindingSource = "state" | "function" | "slot" | "props";
|
|
29
39
|
export type BindingType = {
|
|
30
40
|
type: string;
|
|
31
41
|
value: unknown;
|
|
42
|
+
/** Only on `component_props` bindings; see {@link BindingSource}. */
|
|
43
|
+
source?: BindingSource;
|
|
32
44
|
};
|
|
33
45
|
export interface NodePropsWithBinding {
|
|
34
46
|
type: BindableNodePropType;
|
|
@@ -41,6 +53,8 @@ export interface NodePropsForObject {
|
|
|
41
53
|
type: NodePropTypes["object"];
|
|
42
54
|
binding?: BindingType;
|
|
43
55
|
bindingMap?: BindingMap;
|
|
56
|
+
/** A value the node carries itself, used when nothing is bound. */
|
|
57
|
+
value?: unknown;
|
|
44
58
|
}
|
|
45
59
|
export interface NodePropsForArray {
|
|
46
60
|
type: NodePropTypes["array"];
|
|
@@ -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,SAAS,EAAE,MAAM,UAAU,CAAC;AAIrC,MAAM,MAAM,IAAI,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,QAAQ,EAAE;QACR,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QACvC,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,SAAS,CAAC,EAAE,MA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OAAO,CAAC;IAC/D;;;;;;OAMG;IACH,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,KAAK,UAAU,EAAE,CAAC;IAC9E,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,SAAS,CAAC,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":["../../src/interfaces/node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"node.js","sources":["../../src/interfaces/node.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAyPO,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;Q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ACvC,CAAC;AAED,IAAA,iBAAiB,CAAC,IAAU,EAAE,IAAU,EAAE,OAAgB,EAAA;QACxD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;QAE9B,IAAI,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,CAAA,iBAAA,EAAoB,OAAO,CAAA,kBAAA,EAAqB,IAAI,CAAA,CAAA,CAAG,CAAC;QAC1E;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;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules a composition's fields follow wherever they are written: the Studio API
|
|
3
|
+
* refuses a write that breaks them, and Studio's forms check them as the author
|
|
4
|
+
* types. One definition, so the two can never disagree.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A composition's `composable_uid`: lowercase letters, digits and "_", at most
|
|
8
|
+
* 200 characters — a content type uid's limits on Contentstack, kept lowercase.
|
|
9
|
+
*/
|
|
10
|
+
export declare const COMPOSABLE_UID_PATTERN: RegExp;
|
|
11
|
+
export declare const COMPOSABLE_UID_MAX_LENGTH = 200;
|
|
12
|
+
/** What is wrong with a composable_uid, if anything. */
|
|
13
|
+
export type ComposableUidProblem = "missing" | "blank" | "invalid_characters" | "too_long";
|
|
14
|
+
export declare function composableUidProblem(uid: unknown): ComposableUidProblem | undefined;
|
|
15
|
+
/** The characters of a uid that a composable_uid can't use, each once. */
|
|
16
|
+
export declare const composableUidInvalidCharacters: (uid: string) => string[];
|
|
17
|
+
/**
|
|
18
|
+
* A composable_uid suggested from a name: lowercased, each run of other
|
|
19
|
+
* characters made one "_" (as the Contentstack SDK's generateUid), no "_" at
|
|
20
|
+
* either end, cut to the length a uid can have — so it always has no problem.
|
|
21
|
+
*/
|
|
22
|
+
export declare const composableUidFromName: (name: string) => string;
|
|
23
|
+
/** An HTML attribute name a component may carry. */
|
|
24
|
+
export declare const HTML_ATTRIBUTE_NAME_PATTERN: RegExp;
|
|
25
|
+
/** Attribute names Studio sets itself, through styles: class and style. */
|
|
26
|
+
export declare const STYLE_HTML_ATTRIBUTES: readonly ["class", "classname", "style"];
|
|
27
|
+
/** The prefix of the attributes Studio adds to a rendered component. */
|
|
28
|
+
export declare const STUDIO_HTML_ATTRIBUTE_PREFIX = "data-composable-studio-";
|
|
29
|
+
/** What is wrong with an HTML attribute name, if anything. */
|
|
30
|
+
export type HtmlAttributeNameProblem = "invalid_name" | "style_attribute" | "studio_attribute";
|
|
31
|
+
export declare function htmlAttributeNameProblem(name: string): HtmlAttributeNameProblem | undefined;
|
|
32
|
+
//# sourceMappingURL=composition-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-rules.d.ts","sourceRoot":"","sources":["../../src/utils/composition-rules.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAiB,CAAC;AACrD,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,wDAAwD;AACxD,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,OAAO,GACP,oBAAoB,GACpB,UAAU,CAAC;AAEf,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,OAAO,GACX,oBAAoB,GAAG,SAAS,CAMlC;AAED,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,GAAI,KAAK,MAAM,KAAG,MAAM,EAElE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,MAKb,CAAC;AAEzC,oDAAoD;AACpD,eAAO,MAAM,2BAA2B,QAAyB,CAAC;AAElE,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,0CAA2C,CAAC;AAE9E,wEAAwE;AACxE,eAAO,MAAM,4BAA4B,4BAA4B,CAAC;AAEtE,8DAA8D;AAC9D,MAAM,MAAM,wBAAwB,GAChC,cAAc,GACd,iBAAiB,GACjB,kBAAkB,CAAC;AAEvB,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,GACX,wBAAwB,GAAG,SAAS,CAOtC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules a composition's fields follow wherever they are written: the Studio API
|
|
3
|
+
* refuses a write that breaks them, and Studio's forms check them as the author
|
|
4
|
+
* types. One definition, so the two can never disagree.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* A composition's `composable_uid`: lowercase letters, digits and "_", at most
|
|
8
|
+
* 200 characters — a content type uid's limits on Contentstack, kept lowercase.
|
|
9
|
+
*/
|
|
10
|
+
const COMPOSABLE_UID_PATTERN = /^[a-z0-9_]+$/;
|
|
11
|
+
const COMPOSABLE_UID_MAX_LENGTH = 200;
|
|
12
|
+
function composableUidProblem(uid) {
|
|
13
|
+
if (uid === undefined || uid === null)
|
|
14
|
+
return "missing";
|
|
15
|
+
if (typeof uid !== "string" || uid.trim() === "")
|
|
16
|
+
return "blank";
|
|
17
|
+
if (!COMPOSABLE_UID_PATTERN.test(uid))
|
|
18
|
+
return "invalid_characters";
|
|
19
|
+
if (uid.length > COMPOSABLE_UID_MAX_LENGTH)
|
|
20
|
+
return "too_long";
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
/** The characters of a uid that a composable_uid can't use, each once. */
|
|
24
|
+
const composableUidInvalidCharacters = (uid) => [
|
|
25
|
+
...new Set(uid.replace(/[a-z0-9_]/g, "")),
|
|
26
|
+
];
|
|
27
|
+
/**
|
|
28
|
+
* A composable_uid suggested from a name: lowercased, each run of other
|
|
29
|
+
* characters made one "_" (as the Contentstack SDK's generateUid), no "_" at
|
|
30
|
+
* either end, cut to the length a uid can have — so it always has no problem.
|
|
31
|
+
*/
|
|
32
|
+
const composableUidFromName = (name) => name
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
35
|
+
.replace(/^_+|_+$/g, "")
|
|
36
|
+
.slice(0, COMPOSABLE_UID_MAX_LENGTH);
|
|
37
|
+
/** An HTML attribute name a component may carry. */
|
|
38
|
+
const HTML_ATTRIBUTE_NAME_PATTERN = /^[a-zA-Z_:][\w.:-]*$/;
|
|
39
|
+
/** Attribute names Studio sets itself, through styles: class and style. */
|
|
40
|
+
const STYLE_HTML_ATTRIBUTES = ["class", "classname", "style"];
|
|
41
|
+
/** The prefix of the attributes Studio adds to a rendered component. */
|
|
42
|
+
const STUDIO_HTML_ATTRIBUTE_PREFIX = "data-composable-studio-";
|
|
43
|
+
function htmlAttributeNameProblem(name) {
|
|
44
|
+
if (!HTML_ATTRIBUTE_NAME_PATTERN.test(name))
|
|
45
|
+
return "invalid_name";
|
|
46
|
+
const lower = name.toLowerCase();
|
|
47
|
+
if (lower.startsWith(STUDIO_HTML_ATTRIBUTE_PREFIX))
|
|
48
|
+
return "studio_attribute";
|
|
49
|
+
if (STYLE_HTML_ATTRIBUTES.includes(lower))
|
|
50
|
+
return "style_attribute";
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { COMPOSABLE_UID_MAX_LENGTH, COMPOSABLE_UID_PATTERN, HTML_ATTRIBUTE_NAME_PATTERN, STUDIO_HTML_ATTRIBUTE_PREFIX, STYLE_HTML_ATTRIBUTES, composableUidFromName, composableUidInvalidCharacters, composableUidProblem, htmlAttributeNameProblem };
|
|
55
|
+
//# sourceMappingURL=composition-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composition-rules.js","sources":["../../src/utils/composition-rules.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;AAIG;AAEH;;;AAGG;AACI,MAAM,sBAAsB,GAAG;AAC/B,MAAM,yBAAyB,GAAG;AASnC,SAAU,oBAAoB,CAClC,GAAY,EAAA;AAEZ,IAAA,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;AAAE,QAAA,OAAO,SAAS;IACvD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;AAAE,QAAA,OAAO,OAAO;AAChE,IAAA,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,oBAAoB;AAClE,IAAA,IAAI,GAAG,CAAC,MAAM,GAAG,yBAAyB;AAAE,QAAA,OAAO,UAAU;AAC7D,IAAA,OAAO,SAAS;AAClB;AAEA;MACa,8BAA8B,GAAG,CAAC,GAAW,KAAe;IACvE,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;;AAG3C;;;;AAIG;MACU,qBAAqB,GAAG,CAAC,IAAY,KAChD;AACG,KAAA,WAAW;AACX,KAAA,OAAO,CAAC,aAAa,EAAE,GAAG;AAC1B,KAAA,OAAO,CAAC,UAAU,EAAE,EAAE;AACtB,KAAA,KAAK,CAAC,CAAC,EAAE,yBAAyB;AAEvC;AACO,MAAM,2BAA2B,GAAG;AAE3C;AACO,MAAM,qBAAqB,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO;AAEnE;AACO,MAAM,4BAA4B,GAAG;AAQtC,SAAU,wBAAwB,CACtC,IAAY,EAAA;AAEZ,IAAA,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC;AAAE,QAAA,OAAO,cAAc;AAClE,IAAA,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE;AAChC,IAAA,IAAI,KAAK,CAAC,UAAU,CAAC,4BAA4B,CAAC;AAAE,QAAA,OAAO,kBAAkB;AAC7E,IAAA,IAAK,qBAA2C,CAAC,QAAQ,CAAC,KAAK,CAAC;AAC9D,QAAA,OAAO,iBAAiB;AAC1B,IAAA,OAAO,SAAS;AAClB;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A composition's `data_sources`, in the shape every reader assumes.
|
|
3
|
+
*
|
|
4
|
+
* Stored as JSON text (an array, or an object keyed by uid), it reaches the SDK
|
|
5
|
+
* from the CMS as whatever wrote it. A dozen readers parse it and walk it
|
|
6
|
+
* (pinned entries, queries, resolved references, external data), so it is read
|
|
7
|
+
* once, where an entry enters the SDK, and handed on as clean JSON text: what
|
|
8
|
+
* cannot be read is dropped, the rest is kept as it was.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* `data_sources` as clean JSON text (`"[]"` when nothing is readable). Text that
|
|
12
|
+
* is not JSON is handed on unchanged: its readers already treat it as empty and
|
|
13
|
+
* report it as DATA_SOURCES_UNREADABLE, naming the composition.
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeDataSources(raw: unknown): unknown;
|
|
16
|
+
/**
|
|
17
|
+
* The entry with its `data_sources` normalized. An entry without the field is
|
|
18
|
+
* returned as it is: "absent" and "empty" read differently downstream.
|
|
19
|
+
*/
|
|
20
|
+
export declare function withNormalizedDataSources<T extends {
|
|
21
|
+
data_sources?: unknown;
|
|
22
|
+
}>(entry: T): T;
|
|
23
|
+
//# sourceMappingURL=normalize-data-sources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-data-sources.d.ts","sourceRoot":"","sources":["../../src/utils/normalize-data-sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAuEH;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAa1D;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,EAC5E,KAAK,EAAE,CAAC,GACP,CAAC,CAGH"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A composition's `data_sources`, in the shape every reader assumes.
|
|
3
|
+
*
|
|
4
|
+
* Stored as JSON text (an array, or an object keyed by uid), it reaches the SDK
|
|
5
|
+
* from the CMS as whatever wrote it. A dozen readers parse it and walk it
|
|
6
|
+
* (pinned entries, queries, resolved references, external data), so it is read
|
|
7
|
+
* once, where an entry enters the SDK, and handed on as clean JSON text: what
|
|
8
|
+
* cannot be read is dropped, the rest is kept as it was.
|
|
9
|
+
*/
|
|
10
|
+
const isObject = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
|
|
11
|
+
const isNonEmptyString = (v) => typeof v === "string" && v.length > 0;
|
|
12
|
+
/** The list, or `[]` when it is not a list of data sources. */
|
|
13
|
+
function readList(value) {
|
|
14
|
+
if (Array.isArray(value))
|
|
15
|
+
return value;
|
|
16
|
+
if (isObject(value))
|
|
17
|
+
return Object.values(value);
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
/** A pinned entry: addressed by its uid and content type. */
|
|
21
|
+
const isPinnedEntry = (e) => isObject(e) &&
|
|
22
|
+
isNonEmptyString(e.uid) &&
|
|
23
|
+
(isNonEmptyString(e._content_type_uid) ||
|
|
24
|
+
isNonEmptyString(e.content_type_uid));
|
|
25
|
+
/** A saved query: found by its uid, run from its spec. */
|
|
26
|
+
const isQuery = (q) => isObject(q) &&
|
|
27
|
+
isNonEmptyString(q.uid) &&
|
|
28
|
+
isObject(q.spec) &&
|
|
29
|
+
(q.spec.contentType === undefined || typeof q.spec.contentType === "string");
|
|
30
|
+
function normalizeItem(raw) {
|
|
31
|
+
if (!isObject(raw) || !isNonEmptyString(raw.uid))
|
|
32
|
+
return null;
|
|
33
|
+
const item = { ...raw };
|
|
34
|
+
if ("data" in item) {
|
|
35
|
+
if (item.uid === "contentstack") {
|
|
36
|
+
if (Array.isArray(item.data)) {
|
|
37
|
+
item.data = item.data.filter(isPinnedEntry);
|
|
38
|
+
}
|
|
39
|
+
else if (isObject(item.data) && "entries" in item.data) {
|
|
40
|
+
item.data = {
|
|
41
|
+
...item.data,
|
|
42
|
+
entries: Array.isArray(item.data.entries)
|
|
43
|
+
? item.data.entries.filter(isPinnedEntry)
|
|
44
|
+
: [],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
item.data = [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else if (item.uid === "contentstack_queries") {
|
|
52
|
+
item.data = Array.isArray(item.data) ? item.data.filter(isQuery) : [];
|
|
53
|
+
}
|
|
54
|
+
else if (item.uid === "external_data" && !isObject(item.data)) {
|
|
55
|
+
delete item.data;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if ("resolvedReferences" in item) {
|
|
59
|
+
const refs = isObject(item.resolvedReferences)
|
|
60
|
+
? item.resolvedReferences
|
|
61
|
+
: {};
|
|
62
|
+
item.resolvedReferences = Object.fromEntries(Object.entries(refs)
|
|
63
|
+
.filter(([, paths]) => Array.isArray(paths))
|
|
64
|
+
.map(([owner, paths]) => [
|
|
65
|
+
owner,
|
|
66
|
+
paths.filter(isNonEmptyString),
|
|
67
|
+
]));
|
|
68
|
+
}
|
|
69
|
+
return item;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* `data_sources` as clean JSON text (`"[]"` when nothing is readable). Text that
|
|
73
|
+
* is not JSON is handed on unchanged: its readers already treat it as empty and
|
|
74
|
+
* report it as DATA_SOURCES_UNREADABLE, naming the composition.
|
|
75
|
+
*/
|
|
76
|
+
function normalizeDataSources(raw) {
|
|
77
|
+
let value = raw;
|
|
78
|
+
if (typeof raw === "string") {
|
|
79
|
+
try {
|
|
80
|
+
value = JSON.parse(raw);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return raw;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const items = readList(value)
|
|
87
|
+
.map(normalizeItem)
|
|
88
|
+
.filter((i) => i !== null);
|
|
89
|
+
return JSON.stringify(items);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The entry with its `data_sources` normalized. An entry without the field is
|
|
93
|
+
* returned as it is: "absent" and "empty" read differently downstream.
|
|
94
|
+
*/
|
|
95
|
+
function withNormalizedDataSources(entry) {
|
|
96
|
+
if (!entry || entry.data_sources === undefined)
|
|
97
|
+
return entry;
|
|
98
|
+
return { ...entry, data_sources: normalizeDataSources(entry.data_sources) };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { normalizeDataSources, withNormalizedDataSources };
|
|
102
|
+
//# sourceMappingURL=normalize-data-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-data-sources.js","sources":["../../src/utils/normalize-data-sources.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AAIH,MAAM,QAAQ,GAAG,CAAC,CAAU,KAC1B,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1D,MAAM,gBAAgB,GAAG,CAAC,CAAU,KAClC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC;AAEvC;AACA,SAAS,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;;AAIG;AACG,SAAU,oBAAoB,CAAC,GAAY,EAAA;IAC/C,IAAI,KAAK,GAAY,GAAG;AACxB,IAAA,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;AAC3B,QAAA,IAAI;AACF,YAAA,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QACzB;AAAE,QAAA,MAAM;AACN,YAAA,OAAO,GAAG;QACZ;IACF;AACA,IAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK;SACzB,GAAG,CAAC,aAAa;SACjB,MAAM,CAAC,CAAC,CAAC,KAAgB,CAAC,KAAK,IAAI,CAAC;AACvC,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAEA;;;AAGG;AACG,SAAU,yBAAyB,CACvC,KAAQ,EAAA;AAER,IAAA,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,KAAK,SAAS;AAAE,QAAA,OAAO,KAAK;AAC5D,IAAA,OAAO,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,oBAAoB,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;AAC7E;;;;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Node } from "../interfaces/node";
|
|
2
|
+
/**
|
|
3
|
+
* Brings a stored layout into the shape every reader assumes, so a broken
|
|
4
|
+
* composition degrades instead of crashing the page.
|
|
5
|
+
*
|
|
6
|
+
* Compositions reach the SDK straight from the CMS: anything that wrote the
|
|
7
|
+
* entry (the CMA, an import, an older or newer Studio, a hand edit) can leave a
|
|
8
|
+
* field missing, `null` or of the wrong type. Readers walk `node.props`,
|
|
9
|
+
* `node.slots[k]`, `binding.value.path` and the rest without guarding each
|
|
10
|
+
* access, so instead of a guard at every site the tree is normalized once, where
|
|
11
|
+
* it enters the SDK:
|
|
12
|
+
*
|
|
13
|
+
* - Valid data is kept exactly; unknown keys are kept as they are.
|
|
14
|
+
* - A container of the wrong type becomes empty: `props`, `slots`, `metadata`,
|
|
15
|
+
* `attrs`, `styles` → `{}`, a slot → `[]`.
|
|
16
|
+
* - What cannot be read is dropped, not guessed: a child without a string
|
|
17
|
+
* `uid` and `type`, a prop that is not an object, a binding that cannot be
|
|
18
|
+
* resolved (the prop stays, so it renders its default), a style declaration
|
|
19
|
+
* that is not a string or number.
|
|
20
|
+
* - The root is the layout itself: a root missing its `uid` or `type` is read as
|
|
21
|
+
* `root` / `page` rather than dropping the whole page.
|
|
22
|
+
*
|
|
23
|
+
* Returns a new tree — the input is never mutated — or `null` when `ui` is not
|
|
24
|
+
* a node at all. A tree this function returned is passed through unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export declare function normalizeUi(ui: unknown): Node | null;
|
|
27
|
+
/**
|
|
28
|
+
* A binding the SDK can resolve, or `null`. Path bindings need an object
|
|
29
|
+
* `value` whose `path` is a chain of objects (a `null` leaf is read as the
|
|
30
|
+
* end of the chain) and the ids their type names; key bindings need a string
|
|
31
|
+
* key. Any other type is one this SDK cannot resolve. Only what would make
|
|
32
|
+
* a reader throw or read the wrong thing is refused: this is not validation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function normalizeBinding(raw: unknown): Record<string, any> | null;
|
|
35
|
+
/**
|
|
36
|
+
* A stored layout — compressed text, legacy JSON text, or a parsed tree — read
|
|
37
|
+
* and normalized; `null` when it is not a layout.
|
|
38
|
+
*/
|
|
39
|
+
export declare function readLayout(ui: unknown): Node | null;
|
|
40
|
+
/**
|
|
41
|
+
* A spec as the renderers and style extractors read it: its `ui` normalized
|
|
42
|
+
* (`null` when unreadable — the page renders nothing), and its
|
|
43
|
+
* `sectionCompositions` a list of sections with readable layouts (a section
|
|
44
|
+
* whose layout cannot be read is left out; its placements render nothing).
|
|
45
|
+
*
|
|
46
|
+
* Specs reach the renderers from the SDK's fetch and straight from apps (bring
|
|
47
|
+
* your own data, a spec built or cached by hand), so each render and style
|
|
48
|
+
* entry reads it through here. Returns a new spec; the input is not mutated.
|
|
49
|
+
*/
|
|
50
|
+
export declare function normalizeSpec<T>(spec: T): T;
|
|
51
|
+
//# sourceMappingURL=normalize-ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-ui.d.ts","sourceRoot":"","sources":["../../src/utils/normalize-ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAWpD;AAsHD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CA+BzE;AAuKD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAMnD;AAKD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,CAiB3C"}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { isPlainObject } from './is-plain-object.js';
|
|
2
|
+
import { decompressSpec } from './spec-compression.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Brings a stored layout into the shape every reader assumes, so a broken
|
|
6
|
+
* composition degrades instead of crashing the page.
|
|
7
|
+
*
|
|
8
|
+
* Compositions reach the SDK straight from the CMS: anything that wrote the
|
|
9
|
+
* entry (the CMA, an import, an older or newer Studio, a hand edit) can leave a
|
|
10
|
+
* field missing, `null` or of the wrong type. Readers walk `node.props`,
|
|
11
|
+
* `node.slots[k]`, `binding.value.path` and the rest without guarding each
|
|
12
|
+
* access, so instead of a guard at every site the tree is normalized once, where
|
|
13
|
+
* it enters the SDK:
|
|
14
|
+
*
|
|
15
|
+
* - Valid data is kept exactly; unknown keys are kept as they are.
|
|
16
|
+
* - A container of the wrong type becomes empty: `props`, `slots`, `metadata`,
|
|
17
|
+
* `attrs`, `styles` → `{}`, a slot → `[]`.
|
|
18
|
+
* - What cannot be read is dropped, not guessed: a child without a string
|
|
19
|
+
* `uid` and `type`, a prop that is not an object, a binding that cannot be
|
|
20
|
+
* resolved (the prop stays, so it renders its default), a style declaration
|
|
21
|
+
* that is not a string or number.
|
|
22
|
+
* - The root is the layout itself: a root missing its `uid` or `type` is read as
|
|
23
|
+
* `root` / `page` rather than dropping the whole page.
|
|
24
|
+
*
|
|
25
|
+
* Returns a new tree — the input is never mutated — or `null` when `ui` is not
|
|
26
|
+
* a node at all. A tree this function returned is passed through unchanged.
|
|
27
|
+
*/
|
|
28
|
+
function normalizeUi(ui) {
|
|
29
|
+
if (isPlainObject(ui) && normalized.has(ui))
|
|
30
|
+
return ui;
|
|
31
|
+
if (!isPlainObject(ui))
|
|
32
|
+
return null;
|
|
33
|
+
const root = ui;
|
|
34
|
+
const result = normalizeNode({
|
|
35
|
+
...root,
|
|
36
|
+
uid: isNonEmptyString(root.uid) ? root.uid : "root",
|
|
37
|
+
type: isNonEmptyString(root.type) ? root.type : "page",
|
|
38
|
+
});
|
|
39
|
+
if (result)
|
|
40
|
+
normalized.add(result);
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
/** Trees normalizeUi produced, so a second call is free. */
|
|
44
|
+
const normalized = new WeakSet();
|
|
45
|
+
/** How deep a node tree or binding path is followed; deeper is dropped. */
|
|
46
|
+
const MAX_DEPTH = 200;
|
|
47
|
+
/** Binding types the SDK resolves, by the shape of their `value`. */
|
|
48
|
+
const PATH_BINDINGS = new Set([
|
|
49
|
+
"template",
|
|
50
|
+
"contentstack",
|
|
51
|
+
"contentstack_queries",
|
|
52
|
+
"repeater",
|
|
53
|
+
]);
|
|
54
|
+
const KEY_BINDINGS = new Set(["static_value", "component_props"]);
|
|
55
|
+
const isNonEmptyString = (v) => typeof v === "string" && v.length > 0;
|
|
56
|
+
const plain = (v) => isPlainObject(v) ? v : undefined;
|
|
57
|
+
function normalizeNode(raw, depth = 0) {
|
|
58
|
+
const n = plain(raw);
|
|
59
|
+
if (!n || depth > MAX_DEPTH)
|
|
60
|
+
return null;
|
|
61
|
+
if (!isNonEmptyString(n.uid) || !isNonEmptyString(n.type))
|
|
62
|
+
return null;
|
|
63
|
+
const node = {
|
|
64
|
+
...n,
|
|
65
|
+
attrs: normalizeAttrs(n.attrs),
|
|
66
|
+
metadata: normalizeMetadata(n.metadata),
|
|
67
|
+
props: normalizeProps(n.props),
|
|
68
|
+
slots: normalizeSlots(n.slots, depth),
|
|
69
|
+
styles: normalizeStyles(n.styles),
|
|
70
|
+
};
|
|
71
|
+
if ("children" in n) {
|
|
72
|
+
// Legacy flat children: only an array of nodes is walked.
|
|
73
|
+
if (Array.isArray(n.children))
|
|
74
|
+
node.children = normalizeChildren(n.children, depth);
|
|
75
|
+
else
|
|
76
|
+
delete node.children;
|
|
77
|
+
}
|
|
78
|
+
return node;
|
|
79
|
+
}
|
|
80
|
+
function normalizeChildren(children, depth) {
|
|
81
|
+
const out = [];
|
|
82
|
+
for (const child of children) {
|
|
83
|
+
const c = normalizeNode(child, depth + 1);
|
|
84
|
+
if (c)
|
|
85
|
+
out.push(c);
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
function normalizeSlots(raw, depth) {
|
|
90
|
+
const slots = plain(raw);
|
|
91
|
+
if (!slots)
|
|
92
|
+
return {};
|
|
93
|
+
const out = {};
|
|
94
|
+
for (const [key, children] of Object.entries(slots)) {
|
|
95
|
+
out[key] = Array.isArray(children)
|
|
96
|
+
? normalizeChildren(children, depth)
|
|
97
|
+
: [];
|
|
98
|
+
}
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
function normalizeAttrs(raw) {
|
|
102
|
+
const attrs = plain(raw);
|
|
103
|
+
if (!attrs)
|
|
104
|
+
return {};
|
|
105
|
+
const out = {};
|
|
106
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
107
|
+
// An attribute renders as text; an object or array has no attribute value.
|
|
108
|
+
if (typeof value === "string" ||
|
|
109
|
+
typeof value === "number" ||
|
|
110
|
+
typeof value === "boolean") {
|
|
111
|
+
out[key] = value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return out;
|
|
115
|
+
}
|
|
116
|
+
function normalizeProps(raw) {
|
|
117
|
+
const props = plain(raw);
|
|
118
|
+
if (!props)
|
|
119
|
+
return {};
|
|
120
|
+
const out = {};
|
|
121
|
+
for (const [key, value] of Object.entries(props)) {
|
|
122
|
+
const prop = normalizeProp(value);
|
|
123
|
+
if (prop)
|
|
124
|
+
out[key] = prop;
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
function normalizeProp(raw) {
|
|
129
|
+
const prop = plain(raw);
|
|
130
|
+
if (!prop)
|
|
131
|
+
return null;
|
|
132
|
+
// A slot prop is only a pointer to a slot: without its uid it points nowhere.
|
|
133
|
+
if (prop.type === "slot")
|
|
134
|
+
return isNonEmptyString(prop.slot) ? prop : null;
|
|
135
|
+
const out = { ...prop };
|
|
136
|
+
if ("binding" in out) {
|
|
137
|
+
const binding = normalizeBinding(out.binding);
|
|
138
|
+
if (binding)
|
|
139
|
+
out.binding = binding;
|
|
140
|
+
else
|
|
141
|
+
delete out.binding;
|
|
142
|
+
}
|
|
143
|
+
if ("bindingMap" in out) {
|
|
144
|
+
const map = plain(out.bindingMap);
|
|
145
|
+
if (map) {
|
|
146
|
+
out.bindingMap = Object.fromEntries(Object.entries(map).filter(([, v]) => typeof v === "string"));
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
delete out.bindingMap;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return out;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* A binding the SDK can resolve, or `null`. Path bindings need an object
|
|
156
|
+
* `value` whose `path` is a chain of objects (a `null` leaf is read as the
|
|
157
|
+
* end of the chain) and the ids their type names; key bindings need a string
|
|
158
|
+
* key. Any other type is one this SDK cannot resolve. Only what would make
|
|
159
|
+
* a reader throw or read the wrong thing is refused: this is not validation.
|
|
160
|
+
*/
|
|
161
|
+
function normalizeBinding(raw) {
|
|
162
|
+
const binding = plain(raw);
|
|
163
|
+
if (!binding || !isNonEmptyString(binding.type))
|
|
164
|
+
return null;
|
|
165
|
+
if (KEY_BINDINGS.has(binding.type)) {
|
|
166
|
+
return isNonEmptyString(binding.value) ? binding : null;
|
|
167
|
+
}
|
|
168
|
+
if (!PATH_BINDINGS.has(binding.type))
|
|
169
|
+
return null;
|
|
170
|
+
const value = plain(binding.value);
|
|
171
|
+
if (!value)
|
|
172
|
+
return null;
|
|
173
|
+
const path = normalizePath(value.path);
|
|
174
|
+
if (!path)
|
|
175
|
+
return null;
|
|
176
|
+
// The ids a binding is resolved by. A Repeater binding without its
|
|
177
|
+
// `repeaterUID` still resolves through the nearest Repeater, so that one only
|
|
178
|
+
// has to be a string when present.
|
|
179
|
+
const required = {
|
|
180
|
+
template: [],
|
|
181
|
+
contentstack: ["uid", "_content_type_uid"],
|
|
182
|
+
contentstack_queries: ["queryUID"],
|
|
183
|
+
repeater: [],
|
|
184
|
+
};
|
|
185
|
+
for (const id of required[binding.type]) {
|
|
186
|
+
if (!isNonEmptyString(value[id]))
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
for (const optional of [
|
|
190
|
+
"repeaterUID",
|
|
191
|
+
"content_type_uid",
|
|
192
|
+
"selected_field",
|
|
193
|
+
]) {
|
|
194
|
+
if (optional in value && typeof value[optional] !== "string")
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
return { ...binding, value: { ...value, path } };
|
|
198
|
+
}
|
|
199
|
+
/** A binding path: nested objects; `null` / `undefined` ends a branch. */
|
|
200
|
+
function normalizePath(raw, depth = 0) {
|
|
201
|
+
const path = plain(raw);
|
|
202
|
+
if (!path || depth > MAX_DEPTH)
|
|
203
|
+
return null;
|
|
204
|
+
const out = {};
|
|
205
|
+
for (const [key, child] of Object.entries(path)) {
|
|
206
|
+
if (child === null || child === undefined) {
|
|
207
|
+
out[key] = {};
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const next = normalizePath(child, depth + 1);
|
|
211
|
+
if (!next)
|
|
212
|
+
return null;
|
|
213
|
+
out[key] = next;
|
|
214
|
+
}
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
function normalizeStyles(raw) {
|
|
218
|
+
const styles = plain(raw);
|
|
219
|
+
if (!styles)
|
|
220
|
+
return {};
|
|
221
|
+
const out = {};
|
|
222
|
+
for (const [groupKey, rawGroup] of Object.entries(styles)) {
|
|
223
|
+
const group = plain(rawGroup);
|
|
224
|
+
if (!group)
|
|
225
|
+
continue;
|
|
226
|
+
const responsive = plain(group.responsiveStyles) ?? {};
|
|
227
|
+
const breakpoints = {};
|
|
228
|
+
for (const [bp, rawDecls] of Object.entries(responsive)) {
|
|
229
|
+
const decls = plain(rawDecls);
|
|
230
|
+
if (!decls)
|
|
231
|
+
continue;
|
|
232
|
+
breakpoints[bp] = Object.fromEntries(Object.entries(decls).filter(([, v]) => typeof v === "string" || typeof v === "number"));
|
|
233
|
+
}
|
|
234
|
+
out[groupKey] = {
|
|
235
|
+
...group,
|
|
236
|
+
classes: Array.isArray(group.classes)
|
|
237
|
+
? group.classes.filter((c) => typeof c === "string")
|
|
238
|
+
: [],
|
|
239
|
+
responsiveStyles: breakpoints,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
return out;
|
|
243
|
+
}
|
|
244
|
+
function normalizeMetadata(raw) {
|
|
245
|
+
const metadata = plain(raw);
|
|
246
|
+
if (!metadata)
|
|
247
|
+
return {};
|
|
248
|
+
const out = { ...metadata };
|
|
249
|
+
if ("bindings" in out) {
|
|
250
|
+
const bindings = plain(out.bindings);
|
|
251
|
+
if (bindings) {
|
|
252
|
+
out.bindings = Object.fromEntries(Object.entries(bindings)
|
|
253
|
+
.map(([target, b]) => [target, normalizeBinding(b)])
|
|
254
|
+
.filter(([, b]) => b !== null));
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
delete out.bindings;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if ("condition" in out) {
|
|
261
|
+
const condition = plain(out.condition);
|
|
262
|
+
if (condition) {
|
|
263
|
+
const next = { ...condition };
|
|
264
|
+
for (const key of ["conditionBinding", "dataBinding"]) {
|
|
265
|
+
if (!(key in next))
|
|
266
|
+
continue;
|
|
267
|
+
const b = normalizeBinding(next[key]);
|
|
268
|
+
if (b)
|
|
269
|
+
next[key] = b;
|
|
270
|
+
else
|
|
271
|
+
delete next[key];
|
|
272
|
+
}
|
|
273
|
+
out.condition = next;
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
delete out.condition;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
dropUnless(out, "compositionUID", isNonEmptyString);
|
|
280
|
+
dropUnless(out, "mode", (v) => typeof v === "string");
|
|
281
|
+
dropUnless(out, "repeaterBindingFieldType", (v) => typeof v === "string");
|
|
282
|
+
dropUnless(out, "sectionBindingOverride", isPlainObject);
|
|
283
|
+
dropUnless(out, "uidRemapping", isPlainObject);
|
|
284
|
+
dropUnless(out, "slotNames", isPlainObject);
|
|
285
|
+
dropUnless(out, "conditionDisplay", isPlainObject);
|
|
286
|
+
dropUnless(out, "defaultSection", (v) => isPlainObject(v) && isNonEmptyString(v.uid));
|
|
287
|
+
if ("allowedSections" in out) {
|
|
288
|
+
if (Array.isArray(out.allowedSections)) {
|
|
289
|
+
out.allowedSections = out.allowedSections.filter((s) => isPlainObject(s) && isNonEmptyString(s.uid));
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
delete out.allowedSections;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if ("sectionExposedProps" in out) {
|
|
296
|
+
if (Array.isArray(out.sectionExposedProps)) {
|
|
297
|
+
out.sectionExposedProps = out.sectionExposedProps.filter((p) => isPlainObject(p) &&
|
|
298
|
+
isNonEmptyString(p.nodeUid) &&
|
|
299
|
+
isNonEmptyString(p.propKey));
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
delete out.sectionExposedProps;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if ("seo" in out) {
|
|
306
|
+
const seo = normalizeSeo(out.seo);
|
|
307
|
+
if (seo)
|
|
308
|
+
out.seo = seo;
|
|
309
|
+
else
|
|
310
|
+
delete out.seo;
|
|
311
|
+
}
|
|
312
|
+
return out;
|
|
313
|
+
}
|
|
314
|
+
function normalizeSeo(raw) {
|
|
315
|
+
const seo = plain(raw);
|
|
316
|
+
if (!seo)
|
|
317
|
+
return null;
|
|
318
|
+
const out = { ...seo };
|
|
319
|
+
for (const key of ["pageTitle", "pageDescription", "openGraphImage"]) {
|
|
320
|
+
dropUnless(out, key, (v) => typeof v === "string");
|
|
321
|
+
}
|
|
322
|
+
for (const key of Object.keys(out)) {
|
|
323
|
+
if (!key.endsWith("Binding"))
|
|
324
|
+
continue;
|
|
325
|
+
const b = normalizeBinding(out[key]);
|
|
326
|
+
if (b)
|
|
327
|
+
out[key] = b;
|
|
328
|
+
else
|
|
329
|
+
delete out[key];
|
|
330
|
+
}
|
|
331
|
+
if ("metaProps" in out) {
|
|
332
|
+
if (Array.isArray(out.metaProps)) {
|
|
333
|
+
out.metaProps = out.metaProps
|
|
334
|
+
.filter((p) => isPlainObject(p) && isNonEmptyString(p.name))
|
|
335
|
+
.map((p) => {
|
|
336
|
+
const prop = { ...p };
|
|
337
|
+
dropUnless(prop, "value", (v) => typeof v === "string");
|
|
338
|
+
if ("binding" in prop) {
|
|
339
|
+
const b = normalizeBinding(prop.binding);
|
|
340
|
+
if (b)
|
|
341
|
+
prop.binding = b;
|
|
342
|
+
else
|
|
343
|
+
delete prop.binding;
|
|
344
|
+
}
|
|
345
|
+
return prop;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
delete out.metaProps;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return out;
|
|
353
|
+
}
|
|
354
|
+
function dropUnless(target, key, ok) {
|
|
355
|
+
if (key in target && !ok(target[key]))
|
|
356
|
+
delete target[key];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* A stored layout — compressed text, legacy JSON text, or a parsed tree — read
|
|
360
|
+
* and normalized; `null` when it is not a layout.
|
|
361
|
+
*/
|
|
362
|
+
function readLayout(ui) {
|
|
363
|
+
try {
|
|
364
|
+
return normalizeUi(typeof ui === "string" ? decompressSpec(ui) : ui);
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/** Specs normalizeSpec produced. */
|
|
371
|
+
const normalizedSpecs = new WeakSet();
|
|
372
|
+
/**
|
|
373
|
+
* A spec as the renderers and style extractors read it: its `ui` normalized
|
|
374
|
+
* (`null` when unreadable — the page renders nothing), and its
|
|
375
|
+
* `sectionCompositions` a list of sections with readable layouts (a section
|
|
376
|
+
* whose layout cannot be read is left out; its placements render nothing).
|
|
377
|
+
*
|
|
378
|
+
* Specs reach the renderers from the SDK's fetch and straight from apps (bring
|
|
379
|
+
* your own data, a spec built or cached by hand), so each render and style
|
|
380
|
+
* entry reads it through here. Returns a new spec; the input is not mutated.
|
|
381
|
+
*/
|
|
382
|
+
function normalizeSpec(spec) {
|
|
383
|
+
if (!isPlainObject(spec))
|
|
384
|
+
return spec;
|
|
385
|
+
if (normalizedSpecs.has(spec))
|
|
386
|
+
return spec;
|
|
387
|
+
const raw = spec;
|
|
388
|
+
const out = { ...raw, ui: readLayout(raw.ui) };
|
|
389
|
+
if ("sectionCompositions" in raw) {
|
|
390
|
+
out.sectionCompositions = Array.isArray(raw.sectionCompositions)
|
|
391
|
+
? raw.sectionCompositions.flatMap((section) => {
|
|
392
|
+
const sec = plain(section);
|
|
393
|
+
if (!sec || !isNonEmptyString(sec.uid))
|
|
394
|
+
return [];
|
|
395
|
+
const ui = readLayout(sec.ui);
|
|
396
|
+
return ui ? [{ ...sec, ui }] : [];
|
|
397
|
+
})
|
|
398
|
+
: [];
|
|
399
|
+
}
|
|
400
|
+
normalizedSpecs.add(out);
|
|
401
|
+
return out;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export { normalizeBinding, normalizeSpec, normalizeUi, readLayout };
|
|
405
|
+
//# sourceMappingURL=normalize-ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-ui.js","sources":["../../src/utils/normalize-ui.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AACG,SAAU,WAAW,CAAC,EAAW,EAAA;IACrC,IAAI,aAAa,CAAC,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,EAAY,CAAC;AAAE,QAAA,OAAO,EAAU;AACxE,IAAA,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC;AAAE,QAAA,OAAO,IAAI;IACnC,MAAM,IAAI,GAAG,EAAyB;IACtC,MAAM,MAAM,GAAG,aAAa,CAAC;AAC3B,QAAA,GAAG,IAAI;AACP,QAAA,GAAG,EAAE,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,GAAG,MAAM;AACnD,QAAA,IAAI,EAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,MAAM;AACvD,KAAA,CAAC;AACF,IAAA,IAAI,MAAM;AAAE,QAAA,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC;AAClC,IAAA,OAAO,MAAM;AACf;AAEA;AACA,MAAM,UAAU,GAAG,IAAI,OAAO,EAAU;AAExC;AACA,MAAM,SAAS,GAAG,GAAG;AAErB;AACA,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,UAAU;IACV,cAAc;IACd,sBAAsB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G,CAAC,EAAE,CAAC,EAAE;AACnE,IAAA,IAAI,qBAAqB,IAAI,GAAG,EAAE;QAChC,GAAG,CAAC,mBAAmB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB;cAC3D,GAAG,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,OAAgB,KAAI;AACnD,gBAAA,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;gBAC1B,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC;AAAE,oBAAA,OAAO,EAAE;gBACjD,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;AAC7B,gBAAA,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE;AACnC,YAAA,CAAC;cACD,EAAE;IACR;AACA,IAAA,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC;AACxB,IAAA,OAAO,GAAQ;AACjB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/studio-internal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.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.
|
|
42
|
+
"@contentstack/common-config": "^1.2.7",
|
|
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",
|