@activecollab/components 2.0.414 → 2.0.416
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/cjs/components/Media/Media.js.map +1 -1
- package/dist/cjs/components/PortableText/Styles.js +20 -2
- package/dist/cjs/components/PortableText/Styles.js.map +1 -1
- package/dist/cjs/components/PortableText/renderers.js +20 -4
- package/dist/cjs/components/PortableText/renderers.js.map +1 -1
- package/dist/cjs/components/PortableText/types.js +39 -3
- package/dist/cjs/components/PortableText/types.js.map +1 -1
- package/dist/cjs/components/PortableText/types.test.js +137 -0
- package/dist/cjs/components/PortableText/types.test.js.map +1 -1
- package/dist/cjs/presentation/shared/FeatureAvailability.js +217 -0
- package/dist/cjs/presentation/shared/FeatureAvailability.js.map +1 -0
- package/dist/cjs/presentation/shared/MessageDialog.js.map +1 -1
- package/dist/cjs/presentation/shared/index.js +16 -1
- package/dist/cjs/presentation/shared/index.js.map +1 -1
- package/dist/esm/components/Media/Media.d.ts +3 -2
- package/dist/esm/components/Media/Media.d.ts.map +1 -1
- package/dist/esm/components/Media/Media.js.map +1 -1
- package/dist/esm/components/PortableText/Styles.d.ts +19 -1
- package/dist/esm/components/PortableText/Styles.d.ts.map +1 -1
- package/dist/esm/components/PortableText/Styles.js +20 -2
- package/dist/esm/components/PortableText/Styles.js.map +1 -1
- package/dist/esm/components/PortableText/renderers.d.ts.map +1 -1
- package/dist/esm/components/PortableText/renderers.js +20 -4
- package/dist/esm/components/PortableText/renderers.js.map +1 -1
- package/dist/esm/components/PortableText/types.d.ts +16 -2
- package/dist/esm/components/PortableText/types.d.ts.map +1 -1
- package/dist/esm/components/PortableText/types.js +32 -2
- package/dist/esm/components/PortableText/types.js.map +1 -1
- package/dist/esm/components/PortableText/types.test.js +138 -1
- package/dist/esm/components/PortableText/types.test.js.map +1 -1
- package/dist/esm/presentation/shared/FeatureAvailability.d.ts +52 -0
- package/dist/esm/presentation/shared/FeatureAvailability.d.ts.map +1 -0
- package/dist/esm/presentation/shared/FeatureAvailability.js +203 -0
- package/dist/esm/presentation/shared/FeatureAvailability.js.map +1 -0
- package/dist/esm/presentation/shared/MessageDialog.d.ts.map +1 -1
- package/dist/esm/presentation/shared/MessageDialog.js.map +1 -1
- package/dist/esm/presentation/shared/index.d.ts +2 -0
- package/dist/esm/presentation/shared/index.d.ts.map +1 -1
- package/dist/esm/presentation/shared/index.js +1 -0
- package/dist/esm/presentation/shared/index.js.map +1 -1
- package/dist/index.js +210 -140
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25321,16 +25321,204 @@
|
|
|
25321
25321
|
})(["margin:0;border:none;border-top:1px solid var(--border-primary);"]);
|
|
25322
25322
|
StyledDivider.displayName = "StyledDivider";
|
|
25323
25323
|
|
|
25324
|
-
/**
|
|
25324
|
+
/**
|
|
25325
|
+
* The default `list` block; rendered as ul or ol through the `as` prop, and
|
|
25326
|
+
* tagged `data-portable-list` so the depth rules below scope to design-system
|
|
25327
|
+
* lists — a stray `<ul>`/`<ol>` from an injected renderer is left untouched.
|
|
25328
|
+
*
|
|
25329
|
+
* Nesting works structurally: each level is its own StyledList inside a parent
|
|
25330
|
+
* `<li>`, so it re-applies its own `padding-left` (indentation compounds) and,
|
|
25331
|
+
* for ordered levels, restarts numbering. A nested list carries no vertical
|
|
25332
|
+
* margin, so it hugs the item it belongs to.
|
|
25333
|
+
*
|
|
25334
|
+
* Both bullet and numbered levels change their marker by nesting depth, so
|
|
25335
|
+
* levels stay distinct even where the two interleave:
|
|
25336
|
+
* bullets disc → circle → square → (disc)
|
|
25337
|
+
* numbers decimal → lower-alpha → lower-roman → (upper-alpha)
|
|
25338
|
+
* Depth is counted from the list ancestors themselves (not per-tag), so an
|
|
25339
|
+
* intervening `<ol>` never throws off a `<ul>`'s depth and vice-versa. The
|
|
25340
|
+
* rules are ordered shallow-to-deep; a deeper rule is more specific, so it
|
|
25341
|
+
* wins the cascade for the levels it applies to.
|
|
25342
|
+
*/
|
|
25325
25343
|
var StyledList$1 = styled__default["default"].ul.withConfig({
|
|
25326
25344
|
displayName: "Styles__StyledList",
|
|
25327
25345
|
componentId: "sc-1fss4z4-5"
|
|
25328
|
-
})(["margin:0;padding-left:", ";list-style:", " outside;li + li{margin-top:", ";}"], "1.25rem", function (_ref) {
|
|
25346
|
+
})(["margin:0;padding-left:", ";list-style:", " outside;li + li{margin-top:", ";}& ul[data-portable-list]{list-style-type:circle;}& ol[data-portable-list]{list-style-type:lower-alpha;}& [data-portable-list] ul[data-portable-list]{list-style-type:square;}& [data-portable-list] ol[data-portable-list]{list-style-type:lower-roman;}& [data-portable-list] [data-portable-list] ul[data-portable-list]{list-style-type:disc;}& [data-portable-list] [data-portable-list] ol[data-portable-list]{list-style-type:upper-alpha;}"], "1.25rem", function (_ref) {
|
|
25329
25347
|
var $ordered = _ref.$ordered;
|
|
25330
25348
|
return $ordered ? "decimal" : "disc";
|
|
25331
25349
|
}, SPACE.xs);
|
|
25332
25350
|
StyledList$1.displayName = "StyledList";
|
|
25333
25351
|
|
|
25352
|
+
/**
|
|
25353
|
+
* Portable Text envelope — the general content contract for structured,
|
|
25354
|
+
* renderer-independent content (in-app messages, help, changelogs).
|
|
25355
|
+
*
|
|
25356
|
+
* The design system owns this envelope and the universal default set below.
|
|
25357
|
+
* It never hardcodes a product element: concrete elements (callout,
|
|
25358
|
+
* button-reference, doc-link, …) are defined in the application catalog and
|
|
25359
|
+
* injected into the Portable Text engine through {@link PortableTextComponents}.
|
|
25360
|
+
* See README.md next to this file for the full contract.
|
|
25361
|
+
*/
|
|
25362
|
+
|
|
25363
|
+
/* ---- Spans and marks ------------------------------------------------- */
|
|
25364
|
+
|
|
25365
|
+
/**
|
|
25366
|
+
* A mark with data. Parameterless marks travel as plain strings ("strong");
|
|
25367
|
+
* marks that need data travel as objects discriminated by `type`.
|
|
25368
|
+
*/
|
|
25369
|
+
|
|
25370
|
+
/** The one default mark that carries data. */
|
|
25371
|
+
|
|
25372
|
+
/** The leaf of every text run: a piece of text plus the marks wrapping it. */
|
|
25373
|
+
|
|
25374
|
+
/** Marks every client understands without injection. */
|
|
25375
|
+
var PORTABLE_TEXT_DEFAULT_MARKS = ["strong", "em", "code", "link"];
|
|
25376
|
+
|
|
25377
|
+
/* ---- Blocks ----------------------------------------------------------- */
|
|
25378
|
+
|
|
25379
|
+
/** 1 maps to Title1, 2 to Title2, 3 to Header2 typography. */
|
|
25380
|
+
|
|
25381
|
+
/**
|
|
25382
|
+
* A list item's children are its own spans first, then any nested `list`
|
|
25383
|
+
* block(s) — the shape that carries multi-level lists. A spans-only item (no
|
|
25384
|
+
* nested list) is the common, flat case and stays valid unchanged.
|
|
25385
|
+
*/
|
|
25386
|
+
|
|
25387
|
+
/** Screenshots render framed (border, no shadow); illustrations render flat. */
|
|
25388
|
+
|
|
25389
|
+
/**
|
|
25390
|
+
* Video variants name the hosting service; `src` is the canonical video URL.
|
|
25391
|
+
* Their rendering carries service semantics (URL parsing, embed derivation),
|
|
25392
|
+
* so it belongs to the application catalog — injected as a `media` block
|
|
25393
|
+
* override — never to the default set. The default renderer degrades them.
|
|
25394
|
+
*/
|
|
25395
|
+
|
|
25396
|
+
// A Record so the compiler checks the list against the union in both
|
|
25397
|
+
// directions: a missing and a stray key each fail to build.
|
|
25398
|
+
var MEDIA_IMAGE_VARIANTS = {
|
|
25399
|
+
screenshot: true,
|
|
25400
|
+
illustration: true
|
|
25401
|
+
};
|
|
25402
|
+
var isPortableTextMediaImageVariant = function isPortableTextMediaImageVariant(value) {
|
|
25403
|
+
return typeof value === "string" && value in MEDIA_IMAGE_VARIANTS;
|
|
25404
|
+
};
|
|
25405
|
+
|
|
25406
|
+
/** A table cell is a span array, so inline marks work inside cells. */
|
|
25407
|
+
|
|
25408
|
+
/** A themed horizontal rule between sections. Carries no data. */
|
|
25409
|
+
|
|
25410
|
+
/**
|
|
25411
|
+
* Derived from the union's discriminators, so adding a block to the union
|
|
25412
|
+
* without a renderer entry is a compile error, never silent drift.
|
|
25413
|
+
*/
|
|
25414
|
+
|
|
25415
|
+
// A Record so the compiler checks the list against the union in both
|
|
25416
|
+
// directions: a missing and a stray key each fail to build.
|
|
25417
|
+
var DEFAULT_BLOCK_TYPES = {
|
|
25418
|
+
paragraph: true,
|
|
25419
|
+
heading: true,
|
|
25420
|
+
list: true,
|
|
25421
|
+
"list-item": true,
|
|
25422
|
+
media: true,
|
|
25423
|
+
"titled-text": true,
|
|
25424
|
+
"code-block": true,
|
|
25425
|
+
table: true,
|
|
25426
|
+
divider: true
|
|
25427
|
+
};
|
|
25428
|
+
|
|
25429
|
+
/** Blocks every client understands without injection. */
|
|
25430
|
+
var PORTABLE_TEXT_DEFAULT_BLOCKS = Object.keys(DEFAULT_BLOCK_TYPES);
|
|
25431
|
+
|
|
25432
|
+
/* ---- Objects ----------------------------------------------------------- */
|
|
25433
|
+
|
|
25434
|
+
/**
|
|
25435
|
+
* An embedded component the envelope does not interpret: `_type` names an
|
|
25436
|
+
* application-catalog element, everything else is that element's data. An
|
|
25437
|
+
* object whose `_type` has no injected renderer renders nothing and is logged.
|
|
25438
|
+
*/
|
|
25439
|
+
|
|
25440
|
+
/** The root of a message body: what an API returns under `content`. */
|
|
25441
|
+
|
|
25442
|
+
/* ---- Injection contract ------------------------------------------------ */
|
|
25443
|
+
|
|
25444
|
+
/**
|
|
25445
|
+
* Called once per unknown type instead of rendering it, so content written
|
|
25446
|
+
* for newer clients degrades silently on older ones.
|
|
25447
|
+
*/
|
|
25448
|
+
|
|
25449
|
+
/**
|
|
25450
|
+
* What an application injects into the Portable Text engine: renderers for
|
|
25451
|
+
* its catalog marks and objects, optional overrides for the default blocks,
|
|
25452
|
+
* and the unknown-type hook.
|
|
25453
|
+
*/
|
|
25454
|
+
|
|
25455
|
+
/* ---- Runtime guards ----------------------------------------------------- */
|
|
25456
|
+
|
|
25457
|
+
var isRecord = function isRecord(value) {
|
|
25458
|
+
return typeof value === "object" && value !== null;
|
|
25459
|
+
};
|
|
25460
|
+
var isPortableTextSpan = function isPortableTextSpan(value) {
|
|
25461
|
+
return isRecord(value) && typeof value.text === "string";
|
|
25462
|
+
};
|
|
25463
|
+
var isPortableTextTableRow = function isPortableTextTableRow(value) {
|
|
25464
|
+
return Array.isArray(value) && value.every(function (cell) {
|
|
25465
|
+
return Array.isArray(cell) && cell.every(isPortableTextSpan);
|
|
25466
|
+
});
|
|
25467
|
+
};
|
|
25468
|
+
var isPortableTextObjectNode = function isPortableTextObjectNode(value) {
|
|
25469
|
+
return isRecord(value) && value.type === "object" && typeof value._type === "string";
|
|
25470
|
+
};
|
|
25471
|
+
|
|
25472
|
+
/**
|
|
25473
|
+
* A block is any non-object node with a string `type`. Unknown block types
|
|
25474
|
+
* stay valid on purpose — they render nothing on clients that predate them.
|
|
25475
|
+
* Known types are held to their shape, so a serializer bug (a paragraph
|
|
25476
|
+
* without `children`, a list of non-nodes) fails here instead of at render.
|
|
25477
|
+
*/
|
|
25478
|
+
var _isPortableTextBlock = function isPortableTextBlock(value) {
|
|
25479
|
+
if (!isRecord(value) || typeof value.type !== "string" || value.type === "object") {
|
|
25480
|
+
return false;
|
|
25481
|
+
}
|
|
25482
|
+
switch (value.type) {
|
|
25483
|
+
case "paragraph":
|
|
25484
|
+
case "heading":
|
|
25485
|
+
return Array.isArray(value.children) && value.children.every(isPortableTextSpan);
|
|
25486
|
+
case "list-item":
|
|
25487
|
+
// The item's spans, plus optional nested `list` block(s). Widened only
|
|
25488
|
+
// for nested lists: any other block child (a stray paragraph, an object)
|
|
25489
|
+
// still fails, so a serializer bug is caught here, not at render.
|
|
25490
|
+
return Array.isArray(value.children) && value.children.every(function (child) {
|
|
25491
|
+
return isPortableTextSpan(child) || _isPortableTextBlock(child) && child.type === "list";
|
|
25492
|
+
});
|
|
25493
|
+
case "list":
|
|
25494
|
+
// A list holds `list-item`s only. A sublist emitted as a sibling of the
|
|
25495
|
+
// items (the classic half-implemented-nesting bug) renders invalid HTML
|
|
25496
|
+
// — <ul> with a direct <ul> child — so it fails here, not at render.
|
|
25497
|
+
// `list-item` is validated but sits outside the PortableTextBlock union,
|
|
25498
|
+
// so the discriminator is checked before isPortableTextBlock narrows it.
|
|
25499
|
+
return Array.isArray(value.children) && value.children.every(function (child) {
|
|
25500
|
+
return isRecord(child) && child.type === "list-item" && _isPortableTextBlock(child);
|
|
25501
|
+
});
|
|
25502
|
+
case "media":
|
|
25503
|
+
return typeof value.src === "string";
|
|
25504
|
+
case "titled-text":
|
|
25505
|
+
return typeof value.title === "string" && (value.content === undefined || isPortableTextContent(value.content));
|
|
25506
|
+
case "code-block":
|
|
25507
|
+
return typeof value.code === "string" && (value.language === undefined || typeof value.language === "string");
|
|
25508
|
+
case "table":
|
|
25509
|
+
return isPortableTextTableRow(value.header) && Array.isArray(value.rows) && value.rows.every(isPortableTextTableRow);
|
|
25510
|
+
case "divider":
|
|
25511
|
+
return true;
|
|
25512
|
+
default:
|
|
25513
|
+
return true;
|
|
25514
|
+
}
|
|
25515
|
+
};
|
|
25516
|
+
var isPortableTextContent = function isPortableTextContent(value) {
|
|
25517
|
+
return Array.isArray(value) && value.every(function (node) {
|
|
25518
|
+
return _isPortableTextBlock(node) || isPortableTextObjectNode(node);
|
|
25519
|
+
});
|
|
25520
|
+
};
|
|
25521
|
+
|
|
25334
25522
|
var StyledMedia = styled__default["default"].div.withConfig({
|
|
25335
25523
|
displayName: "Styles__StyledMedia",
|
|
25336
25524
|
componentId: "sc-zjz7mh-0"
|
|
@@ -25520,10 +25708,16 @@
|
|
|
25520
25708
|
var block = _ref8.block,
|
|
25521
25709
|
children = _ref8.children;
|
|
25522
25710
|
var ordered = block.style === "number";
|
|
25523
|
-
return
|
|
25524
|
-
|
|
25525
|
-
|
|
25526
|
-
|
|
25711
|
+
return (
|
|
25712
|
+
/*#__PURE__*/
|
|
25713
|
+
// `data-portable-list` scopes the depth-marker rules in Styles.ts to
|
|
25714
|
+
// design-system lists, and marks the ancestors those rules count.
|
|
25715
|
+
React__default["default"].createElement(StyledList$1, {
|
|
25716
|
+
as: ordered ? "ol" : "ul",
|
|
25717
|
+
$ordered: ordered,
|
|
25718
|
+
"data-portable-list": ""
|
|
25719
|
+
}, children)
|
|
25720
|
+
);
|
|
25527
25721
|
},
|
|
25528
25722
|
"list-item": function listItem(_ref9) {
|
|
25529
25723
|
var children = _ref9.children;
|
|
@@ -25539,6 +25733,15 @@
|
|
|
25539
25733
|
alt = _ref1.alt,
|
|
25540
25734
|
variant = _ref1.variant,
|
|
25541
25735
|
caption = _ref1.caption;
|
|
25736
|
+
|
|
25737
|
+
// Video (and future) variants carry service semantics, so their renderer
|
|
25738
|
+
// is application-catalog territory — an injected `media` override. The
|
|
25739
|
+
// universal set covers images only; anything else degrades and warns, per
|
|
25740
|
+
// the contract's degradation rule.
|
|
25741
|
+
if (variant !== undefined && !isPortableTextMediaImageVariant(variant)) {
|
|
25742
|
+
console.warn("PortableText: no default renderer for media variant \"".concat(variant, "\"."));
|
|
25743
|
+
return null;
|
|
25744
|
+
}
|
|
25542
25745
|
return /*#__PURE__*/React__default["default"].createElement(Media, {
|
|
25543
25746
|
src: src,
|
|
25544
25747
|
alt: alt,
|
|
@@ -25602,140 +25805,6 @@
|
|
|
25602
25805
|
}
|
|
25603
25806
|
};
|
|
25604
25807
|
|
|
25605
|
-
/**
|
|
25606
|
-
* Portable Text envelope — the general content contract for structured,
|
|
25607
|
-
* renderer-independent content (in-app messages, help, changelogs).
|
|
25608
|
-
*
|
|
25609
|
-
* The design system owns this envelope and the universal default set below.
|
|
25610
|
-
* It never hardcodes a product element: concrete elements (callout,
|
|
25611
|
-
* button-reference, doc-link, …) are defined in the application catalog and
|
|
25612
|
-
* injected into the Portable Text engine through {@link PortableTextComponents}.
|
|
25613
|
-
* See README.md next to this file for the full contract.
|
|
25614
|
-
*/
|
|
25615
|
-
|
|
25616
|
-
/* ---- Spans and marks ------------------------------------------------- */
|
|
25617
|
-
|
|
25618
|
-
/**
|
|
25619
|
-
* A mark with data. Parameterless marks travel as plain strings ("strong");
|
|
25620
|
-
* marks that need data travel as objects discriminated by `type`.
|
|
25621
|
-
*/
|
|
25622
|
-
|
|
25623
|
-
/** The one default mark that carries data. */
|
|
25624
|
-
|
|
25625
|
-
/** The leaf of every text run: a piece of text plus the marks wrapping it. */
|
|
25626
|
-
|
|
25627
|
-
/** Marks every client understands without injection. */
|
|
25628
|
-
var PORTABLE_TEXT_DEFAULT_MARKS = ["strong", "em", "code", "link"];
|
|
25629
|
-
|
|
25630
|
-
/* ---- Blocks ----------------------------------------------------------- */
|
|
25631
|
-
|
|
25632
|
-
/** 1 maps to Title1, 2 to Title2, 3 to Header2 typography. */
|
|
25633
|
-
|
|
25634
|
-
/** Screenshots render framed (border, no shadow); illustrations render flat. */
|
|
25635
|
-
|
|
25636
|
-
/** A table cell is a span array, so inline marks work inside cells. */
|
|
25637
|
-
|
|
25638
|
-
/** A themed horizontal rule between sections. Carries no data. */
|
|
25639
|
-
|
|
25640
|
-
/**
|
|
25641
|
-
* Derived from the union's discriminators, so adding a block to the union
|
|
25642
|
-
* without a renderer entry is a compile error, never silent drift.
|
|
25643
|
-
*/
|
|
25644
|
-
|
|
25645
|
-
// A Record so the compiler checks the list against the union in both
|
|
25646
|
-
// directions: a missing and a stray key each fail to build.
|
|
25647
|
-
var DEFAULT_BLOCK_TYPES = {
|
|
25648
|
-
paragraph: true,
|
|
25649
|
-
heading: true,
|
|
25650
|
-
list: true,
|
|
25651
|
-
"list-item": true,
|
|
25652
|
-
media: true,
|
|
25653
|
-
"titled-text": true,
|
|
25654
|
-
"code-block": true,
|
|
25655
|
-
table: true,
|
|
25656
|
-
divider: true
|
|
25657
|
-
};
|
|
25658
|
-
|
|
25659
|
-
/** Blocks every client understands without injection. */
|
|
25660
|
-
var PORTABLE_TEXT_DEFAULT_BLOCKS = Object.keys(DEFAULT_BLOCK_TYPES);
|
|
25661
|
-
|
|
25662
|
-
/* ---- Objects ----------------------------------------------------------- */
|
|
25663
|
-
|
|
25664
|
-
/**
|
|
25665
|
-
* An embedded component the envelope does not interpret: `_type` names an
|
|
25666
|
-
* application-catalog element, everything else is that element's data. An
|
|
25667
|
-
* object whose `_type` has no injected renderer renders nothing and is logged.
|
|
25668
|
-
*/
|
|
25669
|
-
|
|
25670
|
-
/** The root of a message body: what an API returns under `content`. */
|
|
25671
|
-
|
|
25672
|
-
/* ---- Injection contract ------------------------------------------------ */
|
|
25673
|
-
|
|
25674
|
-
/**
|
|
25675
|
-
* Called once per unknown type instead of rendering it, so content written
|
|
25676
|
-
* for newer clients degrades silently on older ones.
|
|
25677
|
-
*/
|
|
25678
|
-
|
|
25679
|
-
/**
|
|
25680
|
-
* What an application injects into the Portable Text engine: renderers for
|
|
25681
|
-
* its catalog marks and objects, optional overrides for the default blocks,
|
|
25682
|
-
* and the unknown-type hook.
|
|
25683
|
-
*/
|
|
25684
|
-
|
|
25685
|
-
/* ---- Runtime guards ----------------------------------------------------- */
|
|
25686
|
-
|
|
25687
|
-
var isRecord = function isRecord(value) {
|
|
25688
|
-
return typeof value === "object" && value !== null;
|
|
25689
|
-
};
|
|
25690
|
-
var isPortableTextSpan = function isPortableTextSpan(value) {
|
|
25691
|
-
return isRecord(value) && typeof value.text === "string";
|
|
25692
|
-
};
|
|
25693
|
-
var isPortableTextTableRow = function isPortableTextTableRow(value) {
|
|
25694
|
-
return Array.isArray(value) && value.every(function (cell) {
|
|
25695
|
-
return Array.isArray(cell) && cell.every(isPortableTextSpan);
|
|
25696
|
-
});
|
|
25697
|
-
};
|
|
25698
|
-
var isPortableTextObjectNode = function isPortableTextObjectNode(value) {
|
|
25699
|
-
return isRecord(value) && value.type === "object" && typeof value._type === "string";
|
|
25700
|
-
};
|
|
25701
|
-
|
|
25702
|
-
/**
|
|
25703
|
-
* A block is any non-object node with a string `type`. Unknown block types
|
|
25704
|
-
* stay valid on purpose — they render nothing on clients that predate them.
|
|
25705
|
-
* Known types are held to their shape, so a serializer bug (a paragraph
|
|
25706
|
-
* without `children`, a list of non-nodes) fails here instead of at render.
|
|
25707
|
-
*/
|
|
25708
|
-
var _isPortableTextBlock = function isPortableTextBlock(value) {
|
|
25709
|
-
if (!isRecord(value) || typeof value.type !== "string" || value.type === "object") {
|
|
25710
|
-
return false;
|
|
25711
|
-
}
|
|
25712
|
-
switch (value.type) {
|
|
25713
|
-
case "paragraph":
|
|
25714
|
-
case "heading":
|
|
25715
|
-
case "list-item":
|
|
25716
|
-
return Array.isArray(value.children) && value.children.every(isPortableTextSpan);
|
|
25717
|
-
case "list":
|
|
25718
|
-
return Array.isArray(value.children) && value.children.every(_isPortableTextBlock);
|
|
25719
|
-
case "media":
|
|
25720
|
-
return typeof value.src === "string";
|
|
25721
|
-
case "titled-text":
|
|
25722
|
-
return typeof value.title === "string" && (value.content === undefined || isPortableTextContent(value.content));
|
|
25723
|
-
case "code-block":
|
|
25724
|
-
return typeof value.code === "string" && (value.language === undefined || typeof value.language === "string");
|
|
25725
|
-
case "table":
|
|
25726
|
-
return isPortableTextTableRow(value.header) && Array.isArray(value.rows) && value.rows.every(isPortableTextTableRow);
|
|
25727
|
-
case "divider":
|
|
25728
|
-
return true;
|
|
25729
|
-
default:
|
|
25730
|
-
return true;
|
|
25731
|
-
}
|
|
25732
|
-
};
|
|
25733
|
-
var isPortableTextContent = function isPortableTextContent(value) {
|
|
25734
|
-
return Array.isArray(value) && value.every(function (node) {
|
|
25735
|
-
return _isPortableTextBlock(node) || isPortableTextObjectNode(node);
|
|
25736
|
-
});
|
|
25737
|
-
};
|
|
25738
|
-
|
|
25739
25808
|
var _excluded$o = ["content", "components", "space"];
|
|
25740
25809
|
var defaultUnknownTypeHandler = function defaultUnknownTypeHandler(kind, type) {
|
|
25741
25810
|
console.warn("PortableText: no renderer for ".concat(kind, " type \"").concat(type, "\"."));
|
|
@@ -30521,6 +30590,7 @@
|
|
|
30521
30590
|
exports.isOptionGroup = isOptionGroup;
|
|
30522
30591
|
exports.isPortableTextBlock = _isPortableTextBlock;
|
|
30523
30592
|
exports.isPortableTextContent = isPortableTextContent;
|
|
30593
|
+
exports.isPortableTextMediaImageVariant = isPortableTextMediaImageVariant;
|
|
30524
30594
|
exports.isPortableTextObjectNode = isPortableTextObjectNode;
|
|
30525
30595
|
exports.isPortableTextSpan = isPortableTextSpan;
|
|
30526
30596
|
exports.isPortableTextTableRow = isPortableTextTableRow;
|