@activecollab/components 2.0.415 → 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/PortableText/Styles.js +20 -2
- package/dist/cjs/components/PortableText/Styles.js.map +1 -1
- package/dist/cjs/components/PortableText/renderers.js +10 -4
- package/dist/cjs/components/PortableText/renderers.js.map +1 -1
- package/dist/cjs/components/PortableText/types.js +21 -2
- package/dist/cjs/components/PortableText/types.js.map +1 -1
- package/dist/cjs/components/PortableText/types.test.js +120 -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/index.js +16 -1
- package/dist/cjs/presentation/shared/index.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 +10 -4
- package/dist/esm/components/PortableText/renderers.js.map +1 -1
- package/dist/esm/components/PortableText/types.d.ts +6 -1
- package/dist/esm/components/PortableText/types.d.ts.map +1 -1
- package/dist/esm/components/PortableText/types.js +17 -2
- package/dist/esm/components/PortableText/types.js.map +1 -1
- package/dist/esm/components/PortableText/types.test.js +120 -0
- 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/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 +51 -8
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":["PORTABLE_TEXT_DEFAULT_MARKS","MEDIA_IMAGE_VARIANTS","screenshot","illustration","isPortableTextMediaImageVariant","value","DEFAULT_BLOCK_TYPES","paragraph","heading","list","media","table","divider","PORTABLE_TEXT_DEFAULT_BLOCKS","Object","keys","isRecord","isPortableTextSpan","text","isPortableTextTableRow","Array","isArray","every","cell","isPortableTextObjectNode","type","_type","isPortableTextBlock","children","src","title","content","undefined","isPortableTextContent","code","language","header","rows","node"],"sources":["../../../../src/components/PortableText/types.ts"],"sourcesContent":["import { ComponentType, ReactNode } from \"react\";\n\n/**\n * Portable Text envelope — the general content contract for structured,\n * renderer-independent content (in-app messages, help, changelogs).\n *\n * The design system owns this envelope and the universal default set below.\n * It never hardcodes a product element: concrete elements (callout,\n * button-reference, doc-link, …) are defined in the application catalog and\n * injected into the Portable Text engine through {@link PortableTextComponents}.\n * See README.md next to this file for the full contract.\n */\n\n/* ---- Spans and marks ------------------------------------------------- */\n\n/**\n * A mark with data. Parameterless marks travel as plain strings (\"strong\");\n * marks that need data travel as objects discriminated by `type`.\n */\nexport interface PortableTextMarkObject {\n type: string;\n [data: string]: unknown;\n}\n\n/** The one default mark that carries data. */\nexport interface PortableTextLinkMark extends PortableTextMarkObject {\n type: \"link\";\n href: string;\n}\n\nexport type PortableTextMark = string | PortableTextMarkObject;\n\n/** The leaf of every text run: a piece of text plus the marks wrapping it. */\nexport interface PortableTextSpan {\n text: string;\n marks?: PortableTextMark[];\n}\n\n/** Marks every client understands without injection. */\nexport const PORTABLE_TEXT_DEFAULT_MARKS = [\n \"strong\",\n \"em\",\n \"code\",\n \"link\",\n] as const;\n\nexport type PortableTextDefaultMark =\n (typeof PORTABLE_TEXT_DEFAULT_MARKS)[number];\n\n/* ---- Blocks ----------------------------------------------------------- */\n\nexport interface PortableTextParagraphBlock {\n type: \"paragraph\";\n children: PortableTextSpan[];\n}\n\n/** 1 maps to Title1, 2 to Title2, 3 to Header2 typography. */\nexport type PortableTextHeadingLevel = 1 | 2 | 3;\n\nexport interface PortableTextHeadingBlock {\n type: \"heading\";\n level: PortableTextHeadingLevel;\n children: PortableTextSpan[];\n}\n\nexport type PortableTextListStyle = \"bullet\" | \"number\";\n\nexport interface PortableTextListItemBlock {\n type: \"list-item\";\n children: PortableTextSpan[];\n}\n\nexport interface PortableTextListBlock {\n type: \"list\";\n style?: PortableTextListStyle;\n children: PortableTextListItemBlock[];\n}\n\n/** Screenshots render framed (border, no shadow); illustrations render flat. */\nexport type PortableTextMediaImageVariant = \"screenshot\" | \"illustration\";\n\n/**\n * Video variants name the hosting service; `src` is the canonical video URL.\n * Their rendering carries service semantics (URL parsing, embed derivation),\n * so it belongs to the application catalog — injected as a `media` block\n * override — never to the default set. The default renderer degrades them.\n */\nexport type PortableTextMediaVideoVariant = \"vimeo\" | \"youtube\";\n\nexport type PortableTextMediaVariant =\n | PortableTextMediaImageVariant\n | PortableTextMediaVideoVariant;\n\n// A Record so the compiler checks the list against the union in both\n// directions: a missing and a stray key each fail to build.\nconst MEDIA_IMAGE_VARIANTS: Record<PortableTextMediaImageVariant, true> = {\n screenshot: true,\n illustration: true,\n};\n\nexport const isPortableTextMediaImageVariant = (\n value: unknown\n): value is PortableTextMediaImageVariant =>\n typeof value === \"string\" && value in MEDIA_IMAGE_VARIANTS;\n\nexport interface PortableTextMediaBlock {\n type: \"media\";\n src: string;\n alt?: string;\n variant?: PortableTextMediaVariant;\n caption?: string;\n}\n\nexport interface PortableTextTitledTextBlock {\n type: \"titled-text\";\n /**\n * Same semantic scale as `heading` — 1, 2 or 3 (the default) — so the wire\n * format never encodes a typography name. How a level looks is the\n * renderer's business.\n */\n level?: PortableTextHeadingLevel;\n title: string;\n content?: PortableTextNode[];\n}\n\nexport interface PortableTextCodeBlock {\n type: \"code-block\";\n /**\n * A language hint (e.g. \"php\", \"json\"). The default renderer does no\n * highlighting, so any value — known, unknown or absent — renders as plain\n * preformatted text; it travels as data for surfaces that highlight.\n */\n language?: string;\n code: string;\n}\n\n/** A table cell is a span array, so inline marks work inside cells. */\nexport type PortableTextTableCell = PortableTextSpan[];\nexport type PortableTextTableRow = PortableTextTableCell[];\n\nexport interface PortableTextTableBlock {\n type: \"table\";\n header: PortableTextTableRow;\n rows: PortableTextTableRow[];\n}\n\n/** A themed horizontal rule between sections. Carries no data. */\nexport interface PortableTextDividerBlock {\n type: \"divider\";\n}\n\nexport type PortableTextBlock =\n | PortableTextParagraphBlock\n | PortableTextHeadingBlock\n | PortableTextListBlock\n | PortableTextMediaBlock\n | PortableTextTitledTextBlock\n | PortableTextCodeBlock\n | PortableTextTableBlock\n | PortableTextDividerBlock;\n\n/**\n * Derived from the union's discriminators, so adding a block to the union\n * without a renderer entry is a compile error, never silent drift.\n */\nexport type PortableTextDefaultBlockType = (\n | PortableTextBlock\n | PortableTextListItemBlock\n)[\"type\"];\n\n// A Record so the compiler checks the list against the union in both\n// directions: a missing and a stray key each fail to build.\nconst DEFAULT_BLOCK_TYPES: Record<PortableTextDefaultBlockType, true> = {\n paragraph: true,\n heading: true,\n list: true,\n \"list-item\": true,\n media: true,\n \"titled-text\": true,\n \"code-block\": true,\n table: true,\n divider: true,\n};\n\n/** Blocks every client understands without injection. */\nexport const PORTABLE_TEXT_DEFAULT_BLOCKS = Object.keys(\n DEFAULT_BLOCK_TYPES\n) as readonly PortableTextDefaultBlockType[];\n\n/* ---- Objects ----------------------------------------------------------- */\n\n/**\n * An embedded component the envelope does not interpret: `_type` names an\n * application-catalog element, everything else is that element's data. An\n * object whose `_type` has no injected renderer renders nothing and is logged.\n */\nexport interface PortableTextObjectNode {\n type: \"object\";\n _type: string;\n [data: string]: unknown;\n}\n\nexport type PortableTextNode = PortableTextBlock | PortableTextObjectNode;\n\n/** The root of a message body: what an API returns under `content`. */\nexport type PortableTextContent = PortableTextNode[];\n\n/* ---- Injection contract ------------------------------------------------ */\n\nexport interface PortableTextMarkRendererProps<\n TMark extends PortableTextMarkObject = PortableTextMarkObject\n> {\n /** Present for object marks; absent when the mark is a plain string. */\n mark?: TMark;\n children: ReactNode;\n}\n\nexport type PortableTextMarkRenderer<\n TMark extends PortableTextMarkObject = PortableTextMarkObject\n> = ComponentType<PortableTextMarkRendererProps<TMark>>;\n\nexport interface PortableTextObjectRendererProps<\n TNode extends PortableTextObjectNode = PortableTextObjectNode\n> {\n node: TNode;\n /** The object's nested `content`, already rendered by the engine. */\n children?: ReactNode;\n}\n\nexport type PortableTextObjectRenderer<\n TNode extends PortableTextObjectNode = PortableTextObjectNode\n> = ComponentType<PortableTextObjectRendererProps<TNode>>;\n\nexport interface PortableTextBlockRendererProps<\n TBlock extends PortableTextBlock = PortableTextBlock\n> {\n block: TBlock;\n /** The block's rendered children/content, when it has any. */\n children?: ReactNode;\n /**\n * Engine-bound span renderer for blocks that carry spans outside `children`\n * (table cells). Resolves marks with the same precedence — injected first,\n * then defaults — as flowing text. Absent when a renderer is used without\n * the engine.\n */\n renderSpans?: (spans: PortableTextSpan[]) => ReactNode;\n}\n\nexport type PortableTextBlockRenderer<\n TBlock extends PortableTextBlock = PortableTextBlock\n> = ComponentType<PortableTextBlockRendererProps<TBlock>>;\n\nexport type PortableTextUnknownKind = \"block\" | \"mark\" | \"object\";\n\n/**\n * Called once per unknown type instead of rendering it, so content written\n * for newer clients degrades silently on older ones.\n */\nexport type PortableTextUnknownTypeHandler = (\n kind: PortableTextUnknownKind,\n type: string\n) => void;\n\n/**\n * What an application injects into the Portable Text engine: renderers for\n * its catalog marks and objects, optional overrides for the default blocks,\n * and the unknown-type hook.\n */\nexport interface PortableTextComponents {\n marks?: Record<string, PortableTextMarkRenderer>;\n objects?: Record<string, PortableTextObjectRenderer>;\n blocks?: Partial<\n Record<PortableTextDefaultBlockType, PortableTextBlockRenderer>\n >;\n onUnknownType?: PortableTextUnknownTypeHandler;\n}\n\n/* ---- Runtime guards ----------------------------------------------------- */\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nexport const isPortableTextSpan = (value: unknown): value is PortableTextSpan =>\n isRecord(value) && typeof value.text === \"string\";\n\nexport const isPortableTextTableRow = (\n value: unknown\n): value is PortableTextTableRow =>\n Array.isArray(value) &&\n value.every((cell) => Array.isArray(cell) && cell.every(isPortableTextSpan));\n\nexport const isPortableTextObjectNode = (\n value: unknown\n): value is PortableTextObjectNode =>\n isRecord(value) && value.type === \"object\" && typeof value._type === \"string\";\n\n/**\n * A block is any non-object node with a string `type`. Unknown block types\n * stay valid on purpose — they render nothing on clients that predate them.\n * Known types are held to their shape, so a serializer bug (a paragraph\n * without `children`, a list of non-nodes) fails here instead of at render.\n */\nexport const isPortableTextBlock = (\n value: unknown\n): value is PortableTextBlock => {\n if (\n !isRecord(value) ||\n typeof value.type !== \"string\" ||\n value.type === \"object\"\n ) {\n return false;\n }\n\n switch (value.type) {\n case \"paragraph\":\n case \"heading\":\n case \"list-item\":\n return (\n Array.isArray(value.children) &&\n value.children.every(isPortableTextSpan)\n );\n case \"list\":\n return (\n Array.isArray(value.children) &&\n value.children.every(isPortableTextBlock)\n );\n case \"media\":\n return typeof value.src === \"string\";\n case \"titled-text\":\n return (\n typeof value.title === \"string\" &&\n (value.content === undefined || isPortableTextContent(value.content))\n );\n case \"code-block\":\n return (\n typeof value.code === \"string\" &&\n (value.language === undefined || typeof value.language === \"string\")\n );\n case \"table\":\n return (\n isPortableTextTableRow(value.header) &&\n Array.isArray(value.rows) &&\n value.rows.every(isPortableTextTableRow)\n );\n case \"divider\":\n return true;\n default:\n return true;\n }\n};\n\nexport const isPortableTextContent = (\n value: unknown\n): value is PortableTextContent =>\n Array.isArray(value) &&\n value.every(\n (node) => isPortableTextBlock(node) || isPortableTextObjectNode(node)\n );\n"],"mappings":"AAEA;A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AI,OAAO3B,KAAK,CAAC8B,QAAQ,KAAK,QAAQ,CAAC;IAExE,KAAK,OAAO;MACV,OACEhB,sBAAsB,CAACd,KAAK,CAAC+B,MAAM,CAAC,IACpChB,KAAK,CAACC,OAAO,CAAChB,KAAK,CAACgC,IAAI,CAAC,IACzBhC,KAAK,CAACgC,IAAI,CAACf,KAAK,CAACH,sBAAsB,CAAC;IAE5C,KAAK,SAAS;MACZ,OAAO,IAAI;IACb;MACE,OAAO,IAAI;EACf;AACF,CAAC;AAED,OAAO,MAAMc,qBAAqB,GAChC5B,KAAc,IAEde,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,IACpBA,KAAK,CAACiB,KAAK,CACRgB,IAAI,IAAKX,mBAAmB,CAACW,IAAI,CAAC,IAAId,wBAAwB,CAACc,IAAI,CACtE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":["PORTABLE_TEXT_DEFAULT_MARKS","MEDIA_IMAGE_VARIANTS","screenshot","illustration","isPortableTextMediaImageVariant","value","DEFAULT_BLOCK_TYPES","paragraph","heading","list","media","table","divider","PORTABLE_TEXT_DEFAULT_BLOCKS","Object","keys","isRecord","isPortableTextSpan","text","isPortableTextTableRow","Array","isArray","every","cell","isPortableTextObjectNode","type","_type","isPortableTextBlock","children","child","src","title","content","undefined","isPortableTextContent","code","language","header","rows","node"],"sources":["../../../../src/components/PortableText/types.ts"],"sourcesContent":["import { ComponentType, ReactNode } from \"react\";\n\n/**\n * Portable Text envelope — the general content contract for structured,\n * renderer-independent content (in-app messages, help, changelogs).\n *\n * The design system owns this envelope and the universal default set below.\n * It never hardcodes a product element: concrete elements (callout,\n * button-reference, doc-link, …) are defined in the application catalog and\n * injected into the Portable Text engine through {@link PortableTextComponents}.\n * See README.md next to this file for the full contract.\n */\n\n/* ---- Spans and marks ------------------------------------------------- */\n\n/**\n * A mark with data. Parameterless marks travel as plain strings (\"strong\");\n * marks that need data travel as objects discriminated by `type`.\n */\nexport interface PortableTextMarkObject {\n type: string;\n [data: string]: unknown;\n}\n\n/** The one default mark that carries data. */\nexport interface PortableTextLinkMark extends PortableTextMarkObject {\n type: \"link\";\n href: string;\n}\n\nexport type PortableTextMark = string | PortableTextMarkObject;\n\n/** The leaf of every text run: a piece of text plus the marks wrapping it. */\nexport interface PortableTextSpan {\n text: string;\n marks?: PortableTextMark[];\n}\n\n/** Marks every client understands without injection. */\nexport const PORTABLE_TEXT_DEFAULT_MARKS = [\n \"strong\",\n \"em\",\n \"code\",\n \"link\",\n] as const;\n\nexport type PortableTextDefaultMark =\n (typeof PORTABLE_TEXT_DEFAULT_MARKS)[number];\n\n/* ---- Blocks ----------------------------------------------------------- */\n\nexport interface PortableTextParagraphBlock {\n type: \"paragraph\";\n children: PortableTextSpan[];\n}\n\n/** 1 maps to Title1, 2 to Title2, 3 to Header2 typography. */\nexport type PortableTextHeadingLevel = 1 | 2 | 3;\n\nexport interface PortableTextHeadingBlock {\n type: \"heading\";\n level: PortableTextHeadingLevel;\n children: PortableTextSpan[];\n}\n\nexport type PortableTextListStyle = \"bullet\" | \"number\";\n\n/**\n * A list item's children are its own spans first, then any nested `list`\n * block(s) — the shape that carries multi-level lists. A spans-only item (no\n * nested list) is the common, flat case and stays valid unchanged.\n */\nexport interface PortableTextListItemBlock {\n type: \"list-item\";\n children: (PortableTextSpan | PortableTextListBlock)[];\n}\n\nexport interface PortableTextListBlock {\n type: \"list\";\n style?: PortableTextListStyle;\n children: PortableTextListItemBlock[];\n}\n\n/** Screenshots render framed (border, no shadow); illustrations render flat. */\nexport type PortableTextMediaImageVariant = \"screenshot\" | \"illustration\";\n\n/**\n * Video variants name the hosting service; `src` is the canonical video URL.\n * Their rendering carries service semantics (URL parsing, embed derivation),\n * so it belongs to the application catalog — injected as a `media` block\n * override — never to the default set. The default renderer degrades them.\n */\nexport type PortableTextMediaVideoVariant = \"vimeo\" | \"youtube\";\n\nexport type PortableTextMediaVariant =\n | PortableTextMediaImageVariant\n | PortableTextMediaVideoVariant;\n\n// A Record so the compiler checks the list against the union in both\n// directions: a missing and a stray key each fail to build.\nconst MEDIA_IMAGE_VARIANTS: Record<PortableTextMediaImageVariant, true> = {\n screenshot: true,\n illustration: true,\n};\n\nexport const isPortableTextMediaImageVariant = (\n value: unknown\n): value is PortableTextMediaImageVariant =>\n typeof value === \"string\" && value in MEDIA_IMAGE_VARIANTS;\n\nexport interface PortableTextMediaBlock {\n type: \"media\";\n src: string;\n alt?: string;\n variant?: PortableTextMediaVariant;\n caption?: string;\n}\n\nexport interface PortableTextTitledTextBlock {\n type: \"titled-text\";\n /**\n * Same semantic scale as `heading` — 1, 2 or 3 (the default) — so the wire\n * format never encodes a typography name. How a level looks is the\n * renderer's business.\n */\n level?: PortableTextHeadingLevel;\n title: string;\n content?: PortableTextNode[];\n}\n\nexport interface PortableTextCodeBlock {\n type: \"code-block\";\n /**\n * A language hint (e.g. \"php\", \"json\"). The default renderer does no\n * highlighting, so any value — known, unknown or absent — renders as plain\n * preformatted text; it travels as data for surfaces that highlight.\n */\n language?: string;\n code: string;\n}\n\n/** A table cell is a span array, so inline marks work inside cells. */\nexport type PortableTextTableCell = PortableTextSpan[];\nexport type PortableTextTableRow = PortableTextTableCell[];\n\nexport interface PortableTextTableBlock {\n type: \"table\";\n header: PortableTextTableRow;\n rows: PortableTextTableRow[];\n}\n\n/** A themed horizontal rule between sections. Carries no data. */\nexport interface PortableTextDividerBlock {\n type: \"divider\";\n}\n\nexport type PortableTextBlock =\n | PortableTextParagraphBlock\n | PortableTextHeadingBlock\n | PortableTextListBlock\n | PortableTextMediaBlock\n | PortableTextTitledTextBlock\n | PortableTextCodeBlock\n | PortableTextTableBlock\n | PortableTextDividerBlock;\n\n/**\n * Derived from the union's discriminators, so adding a block to the union\n * without a renderer entry is a compile error, never silent drift.\n */\nexport type PortableTextDefaultBlockType = (\n | PortableTextBlock\n | PortableTextListItemBlock\n)[\"type\"];\n\n// A Record so the compiler checks the list against the union in both\n// directions: a missing and a stray key each fail to build.\nconst DEFAULT_BLOCK_TYPES: Record<PortableTextDefaultBlockType, true> = {\n paragraph: true,\n heading: true,\n list: true,\n \"list-item\": true,\n media: true,\n \"titled-text\": true,\n \"code-block\": true,\n table: true,\n divider: true,\n};\n\n/** Blocks every client understands without injection. */\nexport const PORTABLE_TEXT_DEFAULT_BLOCKS = Object.keys(\n DEFAULT_BLOCK_TYPES\n) as readonly PortableTextDefaultBlockType[];\n\n/* ---- Objects ----------------------------------------------------------- */\n\n/**\n * An embedded component the envelope does not interpret: `_type` names an\n * application-catalog element, everything else is that element's data. An\n * object whose `_type` has no injected renderer renders nothing and is logged.\n */\nexport interface PortableTextObjectNode {\n type: \"object\";\n _type: string;\n [data: string]: unknown;\n}\n\nexport type PortableTextNode = PortableTextBlock | PortableTextObjectNode;\n\n/** The root of a message body: what an API returns under `content`. */\nexport type PortableTextContent = PortableTextNode[];\n\n/* ---- Injection contract ------------------------------------------------ */\n\nexport interface PortableTextMarkRendererProps<\n TMark extends PortableTextMarkObject = PortableTextMarkObject\n> {\n /** Present for object marks; absent when the mark is a plain string. */\n mark?: TMark;\n children: ReactNode;\n}\n\nexport type PortableTextMarkRenderer<\n TMark extends PortableTextMarkObject = PortableTextMarkObject\n> = ComponentType<PortableTextMarkRendererProps<TMark>>;\n\nexport interface PortableTextObjectRendererProps<\n TNode extends PortableTextObjectNode = PortableTextObjectNode\n> {\n node: TNode;\n /** The object's nested `content`, already rendered by the engine. */\n children?: ReactNode;\n}\n\nexport type PortableTextObjectRenderer<\n TNode extends PortableTextObjectNode = PortableTextObjectNode\n> = ComponentType<PortableTextObjectRendererProps<TNode>>;\n\nexport interface PortableTextBlockRendererProps<\n TBlock extends PortableTextBlock = PortableTextBlock\n> {\n block: TBlock;\n /** The block's rendered children/content, when it has any. */\n children?: ReactNode;\n /**\n * Engine-bound span renderer for blocks that carry spans outside `children`\n * (table cells). Resolves marks with the same precedence — injected first,\n * then defaults — as flowing text. Absent when a renderer is used without\n * the engine.\n */\n renderSpans?: (spans: PortableTextSpan[]) => ReactNode;\n}\n\nexport type PortableTextBlockRenderer<\n TBlock extends PortableTextBlock = PortableTextBlock\n> = ComponentType<PortableTextBlockRendererProps<TBlock>>;\n\nexport type PortableTextUnknownKind = \"block\" | \"mark\" | \"object\";\n\n/**\n * Called once per unknown type instead of rendering it, so content written\n * for newer clients degrades silently on older ones.\n */\nexport type PortableTextUnknownTypeHandler = (\n kind: PortableTextUnknownKind,\n type: string\n) => void;\n\n/**\n * What an application injects into the Portable Text engine: renderers for\n * its catalog marks and objects, optional overrides for the default blocks,\n * and the unknown-type hook.\n */\nexport interface PortableTextComponents {\n marks?: Record<string, PortableTextMarkRenderer>;\n objects?: Record<string, PortableTextObjectRenderer>;\n blocks?: Partial<\n Record<PortableTextDefaultBlockType, PortableTextBlockRenderer>\n >;\n onUnknownType?: PortableTextUnknownTypeHandler;\n}\n\n/* ---- Runtime guards ----------------------------------------------------- */\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nexport const isPortableTextSpan = (value: unknown): value is PortableTextSpan =>\n isRecord(value) && typeof value.text === \"string\";\n\nexport const isPortableTextTableRow = (\n value: unknown\n): value is PortableTextTableRow =>\n Array.isArray(value) &&\n value.every((cell) => Array.isArray(cell) && cell.every(isPortableTextSpan));\n\nexport const isPortableTextObjectNode = (\n value: unknown\n): value is PortableTextObjectNode =>\n isRecord(value) && value.type === \"object\" && typeof value._type === \"string\";\n\n/**\n * A block is any non-object node with a string `type`. Unknown block types\n * stay valid on purpose — they render nothing on clients that predate them.\n * Known types are held to their shape, so a serializer bug (a paragraph\n * without `children`, a list of non-nodes) fails here instead of at render.\n */\nexport const isPortableTextBlock = (\n value: unknown\n): value is PortableTextBlock => {\n if (\n !isRecord(value) ||\n typeof value.type !== \"string\" ||\n value.type === \"object\"\n ) {\n return false;\n }\n\n switch (value.type) {\n case \"paragraph\":\n case \"heading\":\n return (\n Array.isArray(value.children) &&\n value.children.every(isPortableTextSpan)\n );\n case \"list-item\":\n // The item's spans, plus optional nested `list` block(s). Widened only\n // for nested lists: any other block child (a stray paragraph, an object)\n // still fails, so a serializer bug is caught here, not at render.\n return (\n Array.isArray(value.children) &&\n value.children.every(\n (child) =>\n isPortableTextSpan(child) ||\n (isPortableTextBlock(child) && child.type === \"list\")\n )\n );\n case \"list\":\n // A list holds `list-item`s only. A sublist emitted as a sibling of the\n // items (the classic half-implemented-nesting bug) renders invalid HTML\n // — <ul> with a direct <ul> child — so it fails here, not at render.\n // `list-item` is validated but sits outside the PortableTextBlock union,\n // so the discriminator is checked before isPortableTextBlock narrows it.\n return (\n Array.isArray(value.children) &&\n value.children.every(\n (child) =>\n isRecord(child) &&\n child.type === \"list-item\" &&\n isPortableTextBlock(child)\n )\n );\n case \"media\":\n return typeof value.src === \"string\";\n case \"titled-text\":\n return (\n typeof value.title === \"string\" &&\n (value.content === undefined || isPortableTextContent(value.content))\n );\n case \"code-block\":\n return (\n typeof value.code === \"string\" &&\n (value.language === undefined || typeof value.language === \"string\")\n );\n case \"table\":\n return (\n isPortableTextTableRow(value.header) &&\n Array.isArray(value.rows) &&\n value.rows.every(isPortableTextTableRow)\n );\n case \"divider\":\n return true;\n default:\n return true;\n }\n};\n\nexport const isPortableTextContent = (\n value: unknown\n): value is PortableTextContent =>\n Array.isArray(value) &&\n value.every(\n (node) => isPortableTextBlock(node) || isPortableTextObjectNode(node)\n );\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAMA;;AAQA;;AAMA;AACA,OAAO,MAAMA,2BAA2B,GAAG,CACzC,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,MAAM,CACE;;AAKV;;AAOA;;AAWA;AACA;AACA;AACA;AACA;;AAYA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA,MAAMC,oBAAiE,GAAG;EACxEC,UAAU,EAAE,IAAI;EAChBC,YAAY,EAAE;AAChB,CAAC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,KAC7B9B,KAAK,CAAC+B,QAAQ,KAAKH,SAAS,IAAI,OAAO5B,KAAK,CAAC+B,QAAQ,KAAK,QAAQ,CAAC;IAExE,KAAK,OAAO;MACV,OACEjB,sBAAsB,CAACd,KAAK,CAACgC,MAAM,CAAC,IACpCjB,KAAK,CAACC,OAAO,CAAChB,KAAK,CAACiC,IAAI,CAAC,IACzBjC,KAAK,CAACiC,IAAI,CAAChB,KAAK,CAACH,sBAAsB,CAAC;IAE5C,KAAK,SAAS;MACZ,OAAO,IAAI;IACb;MACE,OAAO,IAAI;EACf;AACF,CAAC;AAED,OAAO,MAAMe,qBAAqB,GAChC7B,KAAc,IAEde,KAAK,CAACC,OAAO,CAAChB,KAAK,CAAC,IACpBA,KAAK,CAACiB,KAAK,CACRiB,IAAI,IAAKZ,mBAAmB,CAACY,IAAI,CAAC,IAAIf,wBAAwB,CAACe,IAAI,CACtE,CAAC","ignoreList":[]}
|
|
@@ -197,6 +197,126 @@ describe("PortableText envelope", () => {
|
|
|
197
197
|
rows: []
|
|
198
198
|
}])).toBe(false);
|
|
199
199
|
});
|
|
200
|
+
it("accepts a list-item whose children nest a list block after its spans", () => {
|
|
201
|
+
expect(isPortableTextContent([{
|
|
202
|
+
type: "list",
|
|
203
|
+
style: "bullet",
|
|
204
|
+
children: [{
|
|
205
|
+
type: "list-item",
|
|
206
|
+
children: [{
|
|
207
|
+
text: "Step 3:",
|
|
208
|
+
marks: ["strong"]
|
|
209
|
+
}, {
|
|
210
|
+
text: " Choose one of the following options:"
|
|
211
|
+
}, {
|
|
212
|
+
type: "list",
|
|
213
|
+
style: "bullet",
|
|
214
|
+
children: [{
|
|
215
|
+
type: "list-item",
|
|
216
|
+
children: [{
|
|
217
|
+
text: "Sign in via Email"
|
|
218
|
+
}]
|
|
219
|
+
}, {
|
|
220
|
+
type: "list-item",
|
|
221
|
+
children: [{
|
|
222
|
+
text: "Sign in via your Google account"
|
|
223
|
+
}]
|
|
224
|
+
}]
|
|
225
|
+
}]
|
|
226
|
+
}]
|
|
227
|
+
}])).toBe(true);
|
|
228
|
+
});
|
|
229
|
+
it("validates a list nested four levels deep with mixed styles per level", () => {
|
|
230
|
+
expect(isPortableTextContent([{
|
|
231
|
+
type: "list",
|
|
232
|
+
style: "number",
|
|
233
|
+
children: [{
|
|
234
|
+
type: "list-item",
|
|
235
|
+
children: [{
|
|
236
|
+
text: "Top level, ordered"
|
|
237
|
+
}, {
|
|
238
|
+
type: "list",
|
|
239
|
+
style: "bullet",
|
|
240
|
+
children: [{
|
|
241
|
+
type: "list-item",
|
|
242
|
+
children: [{
|
|
243
|
+
text: "Level 2, bullet"
|
|
244
|
+
}, {
|
|
245
|
+
type: "list",
|
|
246
|
+
style: "number",
|
|
247
|
+
children: [{
|
|
248
|
+
type: "list-item",
|
|
249
|
+
children: [{
|
|
250
|
+
text: "Level 3, ordered"
|
|
251
|
+
}, {
|
|
252
|
+
type: "list",
|
|
253
|
+
style: "bullet",
|
|
254
|
+
children: [{
|
|
255
|
+
type: "list-item",
|
|
256
|
+
children: [{
|
|
257
|
+
text: "Level 4, bullet"
|
|
258
|
+
}]
|
|
259
|
+
}]
|
|
260
|
+
}]
|
|
261
|
+
}]
|
|
262
|
+
}]
|
|
263
|
+
}]
|
|
264
|
+
}]
|
|
265
|
+
}]
|
|
266
|
+
}])).toBe(true);
|
|
267
|
+
});
|
|
268
|
+
it("rejects a list whose child is a sublist instead of a list-item", () => {
|
|
269
|
+
// The classic half-implemented-nesting bug: the sublist is emitted as a
|
|
270
|
+
// sibling of the items rather than inside one. It renders invalid HTML
|
|
271
|
+
// (<ul> with a direct <ul> child), so the guard must reject it.
|
|
272
|
+
expect(isPortableTextContent([{
|
|
273
|
+
type: "list",
|
|
274
|
+
style: "bullet",
|
|
275
|
+
children: [{
|
|
276
|
+
type: "list-item",
|
|
277
|
+
children: [{
|
|
278
|
+
text: "Parent"
|
|
279
|
+
}]
|
|
280
|
+
}, {
|
|
281
|
+
type: "list",
|
|
282
|
+
style: "bullet",
|
|
283
|
+
children: [{
|
|
284
|
+
type: "list-item",
|
|
285
|
+
children: [{
|
|
286
|
+
text: "Orphan sub"
|
|
287
|
+
}]
|
|
288
|
+
}]
|
|
289
|
+
}]
|
|
290
|
+
}])).toBe(false);
|
|
291
|
+
});
|
|
292
|
+
it("rejects a list-item child that is neither a span nor a nested list", () => {
|
|
293
|
+
// A stray paragraph child — the guard is widened for nested lists only.
|
|
294
|
+
expect(isPortableTextContent([{
|
|
295
|
+
type: "list",
|
|
296
|
+
children: [{
|
|
297
|
+
type: "list-item",
|
|
298
|
+
children: [{
|
|
299
|
+
text: "An item"
|
|
300
|
+
}, {
|
|
301
|
+
type: "paragraph",
|
|
302
|
+
children: [{
|
|
303
|
+
text: "not allowed here"
|
|
304
|
+
}]
|
|
305
|
+
}]
|
|
306
|
+
}]
|
|
307
|
+
}])).toBe(false);
|
|
308
|
+
// An embedded object child is rejected too.
|
|
309
|
+
expect(isPortableTextContent([{
|
|
310
|
+
type: "list",
|
|
311
|
+
children: [{
|
|
312
|
+
type: "list-item",
|
|
313
|
+
children: [{
|
|
314
|
+
type: "object",
|
|
315
|
+
_type: "callout"
|
|
316
|
+
}]
|
|
317
|
+
}]
|
|
318
|
+
}])).toBe(false);
|
|
319
|
+
});
|
|
200
320
|
it("accepts a code-block without a language and a table without rows", () => {
|
|
201
321
|
expect(isPortableTextContent([{
|
|
202
322
|
type: "code-block",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.test.js","names":["createElement","Fragment","isPortableTextBlock","isPortableTextContent","isPortableTextMediaImageVariant","isPortableTextObjectNode","isPortableTextSpan","PORTABLE_TEXT_DEFAULT_BLOCKS","PORTABLE_TEXT_DEFAULT_MARKS","describe","sampleMessageContent","type","level","children","text","marks","article","style","src","variant","caption","title","content","_type","tone","label","language","code","header","rows","it","expect","toBe","payload","data","heading","paragraph","callout","toEqual","undefined","_components$marks","seen","components","_ref","objects","_ref2","onUnknownType","kind","push","Object","keys"],"sources":["../../../../src/components/PortableText/types.test.ts"],"sourcesContent":["import { createElement, Fragment } from \"react\";\n\nimport {\n isPortableTextBlock,\n isPortableTextContent,\n isPortableTextMediaImageVariant,\n isPortableTextObjectNode,\n isPortableTextSpan,\n PORTABLE_TEXT_DEFAULT_BLOCKS,\n PORTABLE_TEXT_DEFAULT_MARKS,\n PortableTextComponents,\n PortableTextContent,\n} from \"./types\";\n\ndescribe(\"PortableText envelope\", () => {\n const sampleMessageContent: PortableTextContent = [\n { type: \"heading\", level: 2, children: [{ text: \"IP Firewall\" }] },\n {\n type: \"paragraph\",\n children: [\n { text: \"Open the \" },\n { text: \"Security page\", marks: [\"interface-name\"] },\n { text: \" and press \" },\n { text: \"Enter\", marks: [\"keyboard-key\"] },\n { text: \". Read more in \" },\n {\n text: \"the help article\",\n marks: [{ type: \"doc-link\", article: \"ip-firewall\" }],\n },\n { text: \".\" },\n ],\n },\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n {\n type: \"list-item\",\n children: [{ text: \"Allowlist the IPs you trust\" }],\n },\n {\n type: \"list-item\",\n children: [{ text: \"immediately\", marks: [\"strong\"] }],\n },\n ],\n },\n {\n type: \"media\",\n src: \"/screenshots/firewall.png\",\n variant: \"screenshot\",\n caption: \"The firewall settings\",\n },\n {\n type: \"titled-text\",\n title: \"Allowlist the IPs you trust\",\n level: 3,\n content: [\n { type: \"paragraph\", children: [{ text: \"Add one range per line.\" }] },\n ],\n },\n {\n type: \"object\",\n _type: \"callout\",\n tone: \"note\",\n content: [\n {\n type: \"paragraph\",\n children: [{ text: \"Takes effect immediately.\" }],\n },\n ],\n },\n {\n type: \"object\",\n _type: \"button-reference\",\n label: \"Save Changes\",\n variant: \"primary\",\n },\n { type: \"divider\" },\n {\n type: \"code-block\",\n language: \"json\",\n code: '{ \"allowlist\": [\"203.0.113.0/24\"] }',\n },\n {\n type: \"table\",\n header: [[{ text: \"Range\" }], [{ text: \"Purpose\" }]],\n rows: [\n [\n [{ text: \"203.0.113.0/24\", marks: [\"code\"] }],\n [{ text: \"Office\", marks: [\"strong\"] }],\n ],\n [[{ text: \"198.51.100.0/24\", marks: [\"code\"] }], [{ text: \"VPN\" }]],\n ],\n },\n ];\n\n it(\"validates a sample message that mixes default blocks and catalog objects\", () => {\n expect(isPortableTextContent(sampleMessageContent)).toBe(true);\n });\n\n it(\"keeps unknown block and object types valid so older clients degrade instead of break\", () => {\n expect(\n isPortableTextContent([\n { type: \"some-future-block\", payload: 1 },\n { type: \"object\", _type: \"some-future-element\", data: true },\n ])\n ).toBe(true);\n });\n\n it(\"rejects nodes without a type discriminator and objects without _type\", () => {\n expect(isPortableTextContent([{ children: [] }])).toBe(false);\n expect(isPortableTextContent([{ type: \"object\" }])).toBe(false);\n expect(isPortableTextContent([\"paragraph\"])).toBe(false);\n expect(isPortableTextContent({ content: [] })).toBe(false);\n });\n\n it(\"rejects known blocks whose shape a serializer bug has broken\", () => {\n expect(isPortableTextContent([{ type: \"paragraph\" }])).toBe(false);\n expect(\n isPortableTextContent([{ type: \"heading\", level: 2, children: \"oops\" }])\n ).toBe(false);\n expect(\n isPortableTextContent([\n { type: \"paragraph\", children: [{ marks: [\"strong\"] }] },\n ])\n ).toBe(false);\n expect(isPortableTextContent([{ type: \"list\" }])).toBe(false);\n expect(\n isPortableTextContent([{ type: \"list\", children: [\"not a node\"] }])\n ).toBe(false);\n expect(isPortableTextContent([{ type: \"media\" }])).toBe(false);\n expect(isPortableTextContent([{ type: \"titled-text\", content: [] }])).toBe(\n false\n );\n expect(\n isPortableTextContent([\n { type: \"titled-text\", title: \"Ranges\", content: \"oops\" },\n ])\n ).toBe(false);\n });\n\n it(\"rejects malformed code-block, table and divider-adjacent shapes\", () => {\n expect(isPortableTextContent([{ type: \"code-block\" }])).toBe(false);\n expect(isPortableTextContent([{ type: \"code-block\", code: 42 }])).toBe(\n false\n );\n expect(\n isPortableTextContent([{ type: \"code-block\", code: \"x\", language: 1 }])\n ).toBe(false);\n expect(isPortableTextContent([{ type: \"table\" }])).toBe(false);\n expect(\n isPortableTextContent([{ type: \"table\", header: [], rows: \"oops\" }])\n ).toBe(false);\n expect(\n isPortableTextContent([\n { type: \"table\", header: [[{ text: \"A\" }]], rows: [[\"not a cell\"]] },\n ])\n ).toBe(false);\n expect(\n isPortableTextContent([\n { type: \"table\", header: [{ text: \"not a cell\" }], rows: [] },\n ])\n ).toBe(false);\n });\n\n it(\"accepts a code-block without a language and a table without rows\", () => {\n expect(\n isPortableTextContent([{ type: \"code-block\", code: \"npm install\" }])\n ).toBe(true);\n expect(\n isPortableTextContent([\n { type: \"table\", header: [[{ text: \"A\" }]], rows: [] },\n ])\n ).toBe(true);\n expect(isPortableTextContent([{ type: \"divider\" }])).toBe(true);\n });\n\n it(\"accepts a titled-text with only a title, with or without content\", () => {\n expect(\n isPortableTextContent([{ type: \"titled-text\", title: \"Ranges\" }])\n ).toBe(true);\n expect(\n isPortableTextContent([\n { type: \"titled-text\", title: \"Ranges\", content: [] },\n ])\n ).toBe(true);\n });\n\n it(\"tells blocks, objects and spans apart\", () => {\n const [heading, paragraph] = sampleMessageContent;\n const callout = sampleMessageContent[5];\n\n expect(isPortableTextBlock(heading)).toBe(true);\n expect(isPortableTextBlock(callout)).toBe(false);\n expect(isPortableTextObjectNode(callout)).toBe(true);\n expect(isPortableTextObjectNode(heading)).toBe(false);\n expect(isPortableTextSpan({ text: \"plain\" })).toBe(true);\n expect(isPortableTextSpan(paragraph)).toBe(false);\n });\n\n it(\"ships a universal default set free of product elements\", () => {\n expect(PORTABLE_TEXT_DEFAULT_BLOCKS).toEqual([\n \"paragraph\",\n \"heading\",\n \"list\",\n \"list-item\",\n \"media\",\n \"titled-text\",\n \"code-block\",\n \"table\",\n \"divider\",\n ]);\n expect(PORTABLE_TEXT_DEFAULT_MARKS).toEqual([\n \"strong\",\n \"em\",\n \"code\",\n \"link\",\n ]);\n });\n\n it(\"keeps video media variants in the envelope but out of the image variant set\", () => {\n expect(\n isPortableTextContent([\n {\n type: \"media\",\n variant: \"vimeo\",\n src: \"https://vimeo.com/1131696931\",\n caption: \"Duplicating a project\",\n },\n {\n type: \"media\",\n variant: \"youtube\",\n src: \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n },\n ])\n ).toBe(true);\n\n expect(isPortableTextMediaImageVariant(\"screenshot\")).toBe(true);\n expect(isPortableTextMediaImageVariant(\"illustration\")).toBe(true);\n expect(isPortableTextMediaImageVariant(\"vimeo\")).toBe(false);\n expect(isPortableTextMediaImageVariant(\"youtube\")).toBe(false);\n expect(isPortableTextMediaImageVariant(undefined)).toBe(false);\n });\n\n it(\"accepts an application components map through the injection contract\", () => {\n const seen: string[] = [];\n const components: PortableTextComponents = {\n marks: {\n \"interface-name\": ({ children }) =>\n createElement(Fragment, null, children),\n },\n objects: {\n callout: ({ children }) => createElement(Fragment, null, children),\n },\n onUnknownType: (kind, type) => {\n seen.push(`${kind}:${type}`);\n },\n };\n\n components.onUnknownType?.(\"object\", \"some-future-element\");\n\n expect(Object.keys(components.marks ?? {})).toEqual([\"interface-name\"]);\n expect(seen).toEqual([\"object:some-future-element\"]);\n });\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,OAAO;AAE/C,SACEC,mBAAmB,EACnBC,qBAAqB,EACrBC,+BAA+B,EAC/BC,wBAAwB,EACxBC,kBAAkB,EAClBC,4BAA4B,EAC5BC,2BAA2B,QAGtB,SAAS;AAEhBC,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACtC,MAAMC,oBAAyC,GAAG,CAChD;IAAEC,IAAI,EAAE,SAAS;IAAEC,KAAK,EAAE,CAAC;IAAEC,QAAQ,EAAE,CAAC;MAAEC,IAAI,EAAE;IAAc,CAAC;EAAE,CAAC,EAClE;IACEH,IAAI,EAAE,WAAW;IACjBE,QAAQ,EAAE,CACR;MAAEC,IAAI,EAAE;IAAY,CAAC,EACrB;MAAEA,IAAI,EAAE,eAAe;MAAEC,KAAK,EAAE,CAAC,gBAAgB;IAAE,CAAC,EAC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A,oBAAOb,aAAa,CAACC,QAAQ,EAAE,IAAI,EAAEY,QAAQ,CAAC;QAAA;MACpE,CAAC;MACDiC,aAAa,EAAEA,CAACC,IAAI,EAAEpC,IAAI,KAAK;QAC7B8B,IAAI,CAACO,IAAI,CAAID,IAAI,SAAIpC,IAAM,CAAC;MAC9B;IACF,CAAC;IAED+B,UAAU,CAACI,aAAa,YAAxBJ,UAAU,CAACI,aAAa,CAAG,QAAQ,EAAE,qBAAqB,CAAC;IAE3Df,MAAM,CAACkB,MAAM,CAACC,IAAI,EAAAV,iBAAA,GAACE,UAAU,CAAC3B,KAAK,YAAAyB,iBAAA,GAAI,CAAC,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACvEP,MAAM,CAACU,IAAI,CAAC,CAACH,OAAO,CAAC,CAAC,4BAA4B,CAAC,CAAC;EACtD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.test.js","names":["createElement","Fragment","isPortableTextBlock","isPortableTextContent","isPortableTextMediaImageVariant","isPortableTextObjectNode","isPortableTextSpan","PORTABLE_TEXT_DEFAULT_BLOCKS","PORTABLE_TEXT_DEFAULT_MARKS","describe","sampleMessageContent","type","level","children","text","marks","article","style","src","variant","caption","title","content","_type","tone","label","language","code","header","rows","it","expect","toBe","payload","data","heading","paragraph","callout","toEqual","undefined","_components$marks","seen","components","_ref","objects","_ref2","onUnknownType","kind","push","Object","keys"],"sources":["../../../../src/components/PortableText/types.test.ts"],"sourcesContent":["import { createElement, Fragment } from \"react\";\n\nimport {\n isPortableTextBlock,\n isPortableTextContent,\n isPortableTextMediaImageVariant,\n isPortableTextObjectNode,\n isPortableTextSpan,\n PORTABLE_TEXT_DEFAULT_BLOCKS,\n PORTABLE_TEXT_DEFAULT_MARKS,\n PortableTextComponents,\n PortableTextContent,\n} from \"./types\";\n\ndescribe(\"PortableText envelope\", () => {\n const sampleMessageContent: PortableTextContent = [\n { type: \"heading\", level: 2, children: [{ text: \"IP Firewall\" }] },\n {\n type: \"paragraph\",\n children: [\n { text: \"Open the \" },\n { text: \"Security page\", marks: [\"interface-name\"] },\n { text: \" and press \" },\n { text: \"Enter\", marks: [\"keyboard-key\"] },\n { text: \". Read more in \" },\n {\n text: \"the help article\",\n marks: [{ type: \"doc-link\", article: \"ip-firewall\" }],\n },\n { text: \".\" },\n ],\n },\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n {\n type: \"list-item\",\n children: [{ text: \"Allowlist the IPs you trust\" }],\n },\n {\n type: \"list-item\",\n children: [{ text: \"immediately\", marks: [\"strong\"] }],\n },\n ],\n },\n {\n type: \"media\",\n src: \"/screenshots/firewall.png\",\n variant: \"screenshot\",\n caption: \"The firewall settings\",\n },\n {\n type: \"titled-text\",\n title: \"Allowlist the IPs you trust\",\n level: 3,\n content: [\n { type: \"paragraph\", children: [{ text: \"Add one range per line.\" }] },\n ],\n },\n {\n type: \"object\",\n _type: \"callout\",\n tone: \"note\",\n content: [\n {\n type: \"paragraph\",\n children: [{ text: \"Takes effect immediately.\" }],\n },\n ],\n },\n {\n type: \"object\",\n _type: \"button-reference\",\n label: \"Save Changes\",\n variant: \"primary\",\n },\n { type: \"divider\" },\n {\n type: \"code-block\",\n language: \"json\",\n code: '{ \"allowlist\": [\"203.0.113.0/24\"] }',\n },\n {\n type: \"table\",\n header: [[{ text: \"Range\" }], [{ text: \"Purpose\" }]],\n rows: [\n [\n [{ text: \"203.0.113.0/24\", marks: [\"code\"] }],\n [{ text: \"Office\", marks: [\"strong\"] }],\n ],\n [[{ text: \"198.51.100.0/24\", marks: [\"code\"] }], [{ text: \"VPN\" }]],\n ],\n },\n ];\n\n it(\"validates a sample message that mixes default blocks and catalog objects\", () => {\n expect(isPortableTextContent(sampleMessageContent)).toBe(true);\n });\n\n it(\"keeps unknown block and object types valid so older clients degrade instead of break\", () => {\n expect(\n isPortableTextContent([\n { type: \"some-future-block\", payload: 1 },\n { type: \"object\", _type: \"some-future-element\", data: true },\n ])\n ).toBe(true);\n });\n\n it(\"rejects nodes without a type discriminator and objects without _type\", () => {\n expect(isPortableTextContent([{ children: [] }])).toBe(false);\n expect(isPortableTextContent([{ type: \"object\" }])).toBe(false);\n expect(isPortableTextContent([\"paragraph\"])).toBe(false);\n expect(isPortableTextContent({ content: [] })).toBe(false);\n });\n\n it(\"rejects known blocks whose shape a serializer bug has broken\", () => {\n expect(isPortableTextContent([{ type: \"paragraph\" }])).toBe(false);\n expect(\n isPortableTextContent([{ type: \"heading\", level: 2, children: \"oops\" }])\n ).toBe(false);\n expect(\n isPortableTextContent([\n { type: \"paragraph\", children: [{ marks: [\"strong\"] }] },\n ])\n ).toBe(false);\n expect(isPortableTextContent([{ type: \"list\" }])).toBe(false);\n expect(\n isPortableTextContent([{ type: \"list\", children: [\"not a node\"] }])\n ).toBe(false);\n expect(isPortableTextContent([{ type: \"media\" }])).toBe(false);\n expect(isPortableTextContent([{ type: \"titled-text\", content: [] }])).toBe(\n false\n );\n expect(\n isPortableTextContent([\n { type: \"titled-text\", title: \"Ranges\", content: \"oops\" },\n ])\n ).toBe(false);\n });\n\n it(\"rejects malformed code-block, table and divider-adjacent shapes\", () => {\n expect(isPortableTextContent([{ type: \"code-block\" }])).toBe(false);\n expect(isPortableTextContent([{ type: \"code-block\", code: 42 }])).toBe(\n false\n );\n expect(\n isPortableTextContent([{ type: \"code-block\", code: \"x\", language: 1 }])\n ).toBe(false);\n expect(isPortableTextContent([{ type: \"table\" }])).toBe(false);\n expect(\n isPortableTextContent([{ type: \"table\", header: [], rows: \"oops\" }])\n ).toBe(false);\n expect(\n isPortableTextContent([\n { type: \"table\", header: [[{ text: \"A\" }]], rows: [[\"not a cell\"]] },\n ])\n ).toBe(false);\n expect(\n isPortableTextContent([\n { type: \"table\", header: [{ text: \"not a cell\" }], rows: [] },\n ])\n ).toBe(false);\n });\n\n it(\"accepts a list-item whose children nest a list block after its spans\", () => {\n expect(\n isPortableTextContent([\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n {\n type: \"list-item\",\n children: [\n { text: \"Step 3:\", marks: [\"strong\"] },\n { text: \" Choose one of the following options:\" },\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n {\n type: \"list-item\",\n children: [{ text: \"Sign in via Email\" }],\n },\n {\n type: \"list-item\",\n children: [{ text: \"Sign in via your Google account\" }],\n },\n ],\n },\n ],\n },\n ],\n },\n ])\n ).toBe(true);\n });\n\n it(\"validates a list nested four levels deep with mixed styles per level\", () => {\n expect(\n isPortableTextContent([\n {\n type: \"list\",\n style: \"number\",\n children: [\n {\n type: \"list-item\",\n children: [\n { text: \"Top level, ordered\" },\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n {\n type: \"list-item\",\n children: [\n { text: \"Level 2, bullet\" },\n {\n type: \"list\",\n style: \"number\",\n children: [\n {\n type: \"list-item\",\n children: [\n { text: \"Level 3, ordered\" },\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n {\n type: \"list-item\",\n children: [{ text: \"Level 4, bullet\" }],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n },\n ])\n ).toBe(true);\n });\n\n it(\"rejects a list whose child is a sublist instead of a list-item\", () => {\n // The classic half-implemented-nesting bug: the sublist is emitted as a\n // sibling of the items rather than inside one. It renders invalid HTML\n // (<ul> with a direct <ul> child), so the guard must reject it.\n expect(\n isPortableTextContent([\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n { type: \"list-item\", children: [{ text: \"Parent\" }] },\n {\n type: \"list\",\n style: \"bullet\",\n children: [\n { type: \"list-item\", children: [{ text: \"Orphan sub\" }] },\n ],\n },\n ],\n },\n ])\n ).toBe(false);\n });\n\n it(\"rejects a list-item child that is neither a span nor a nested list\", () => {\n // A stray paragraph child — the guard is widened for nested lists only.\n expect(\n isPortableTextContent([\n {\n type: \"list\",\n children: [\n {\n type: \"list-item\",\n children: [\n { text: \"An item\" },\n { type: \"paragraph\", children: [{ text: \"not allowed here\" }] },\n ],\n },\n ],\n },\n ])\n ).toBe(false);\n // An embedded object child is rejected too.\n expect(\n isPortableTextContent([\n {\n type: \"list\",\n children: [\n {\n type: \"list-item\",\n children: [{ type: \"object\", _type: \"callout\" }],\n },\n ],\n },\n ])\n ).toBe(false);\n });\n\n it(\"accepts a code-block without a language and a table without rows\", () => {\n expect(\n isPortableTextContent([{ type: \"code-block\", code: \"npm install\" }])\n ).toBe(true);\n expect(\n isPortableTextContent([\n { type: \"table\", header: [[{ text: \"A\" }]], rows: [] },\n ])\n ).toBe(true);\n expect(isPortableTextContent([{ type: \"divider\" }])).toBe(true);\n });\n\n it(\"accepts a titled-text with only a title, with or without content\", () => {\n expect(\n isPortableTextContent([{ type: \"titled-text\", title: \"Ranges\" }])\n ).toBe(true);\n expect(\n isPortableTextContent([\n { type: \"titled-text\", title: \"Ranges\", content: [] },\n ])\n ).toBe(true);\n });\n\n it(\"tells blocks, objects and spans apart\", () => {\n const [heading, paragraph] = sampleMessageContent;\n const callout = sampleMessageContent[5];\n\n expect(isPortableTextBlock(heading)).toBe(true);\n expect(isPortableTextBlock(callout)).toBe(false);\n expect(isPortableTextObjectNode(callout)).toBe(true);\n expect(isPortableTextObjectNode(heading)).toBe(false);\n expect(isPortableTextSpan({ text: \"plain\" })).toBe(true);\n expect(isPortableTextSpan(paragraph)).toBe(false);\n });\n\n it(\"ships a universal default set free of product elements\", () => {\n expect(PORTABLE_TEXT_DEFAULT_BLOCKS).toEqual([\n \"paragraph\",\n \"heading\",\n \"list\",\n \"list-item\",\n \"media\",\n \"titled-text\",\n \"code-block\",\n \"table\",\n \"divider\",\n ]);\n expect(PORTABLE_TEXT_DEFAULT_MARKS).toEqual([\n \"strong\",\n \"em\",\n \"code\",\n \"link\",\n ]);\n });\n\n it(\"keeps video media variants in the envelope but out of the image variant set\", () => {\n expect(\n isPortableTextContent([\n {\n type: \"media\",\n variant: \"vimeo\",\n src: \"https://vimeo.com/1131696931\",\n caption: \"Duplicating a project\",\n },\n {\n type: \"media\",\n variant: \"youtube\",\n src: \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\",\n },\n ])\n ).toBe(true);\n\n expect(isPortableTextMediaImageVariant(\"screenshot\")).toBe(true);\n expect(isPortableTextMediaImageVariant(\"illustration\")).toBe(true);\n expect(isPortableTextMediaImageVariant(\"vimeo\")).toBe(false);\n expect(isPortableTextMediaImageVariant(\"youtube\")).toBe(false);\n expect(isPortableTextMediaImageVariant(undefined)).toBe(false);\n });\n\n it(\"accepts an application components map through the injection contract\", () => {\n const seen: string[] = [];\n const components: PortableTextComponents = {\n marks: {\n \"interface-name\": ({ children }) =>\n createElement(Fragment, null, children),\n },\n objects: {\n callout: ({ children }) => createElement(Fragment, null, children),\n },\n onUnknownType: (kind, type) => {\n seen.push(`${kind}:${type}`);\n },\n };\n\n components.onUnknownType?.(\"object\", \"some-future-element\");\n\n expect(Object.keys(components.marks ?? {})).toEqual([\"interface-name\"]);\n expect(seen).toEqual([\"object:some-future-element\"]);\n });\n});\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,OAAO;AAE/C,SACEC,mBAAmB,EACnBC,qBAAqB,EACrBC,+BAA+B,EAC/BC,wBAAwB,EACxBC,kBAAkB,EAClBC,4BAA4B,EAC5BC,2BAA2B,QAGtB,SAAS;AAEhBC,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACtC,MAAMC,oBAAyC,GAAG,CAChD;IAAEC,IAAI,EAAE,SAAS;IAAEC,KAAK,EAAE,CAAC;IAAEC,QAAQ,EAAE,CAAC;MAAEC,IAAI,EAAE;IAAc,CAAC;EAAE,CAAC,EAClE;IACEH,IAAI,EAAE,WAAW;IACjBE,QAAQ,EAAE,CACR;MAAEC,IAAI,EAAE;IAAY,CAAC,EACrB;MAAEA,IAAI,EAAE,eAAe;MAAEC,KAAK,EAAE,CAAC,gBAAgB;IAAE,CAAC,EACpD;MAAED,IAAI,EAAE;IAAc,CAAC,EACvB;MAAEA,IAAI,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kC,GAAG;MACzC3B,KAAK,EAAE;QACL,gBAAgB,EAAE4B,IAAA;UAAA,IAAG9B,QAAQ,GAAA8B,IAAA,CAAR9B,QAAQ;UAAA,oBAC3Bb,aAAa,CAACC,QAAQ,EAAE,IAAI,EAAEY,QAAQ,CAAC;QAAA;MAC3C,CAAC;MACD+B,OAAO,EAAE;QACPP,OAAO,EAAEQ,KAAA;UAAA,IAAGhC,QAAQ,GAAAgC,KAAA,CAARhC,QAAQ;UAAA,oBAAOb,aAAa,CAACC,QAAQ,EAAE,IAAI,EAAEY,QAAQ,CAAC;QAAA;MACpE,CAAC;MACDiC,aAAa,EAAEA,CAACC,IAAI,EAAEpC,IAAI,KAAK;QAC7B8B,IAAI,CAACO,IAAI,CAAID,IAAI,SAAIpC,IAAM,CAAC;MAC9B;IACF,CAAC;IAED+B,UAAU,CAACI,aAAa,YAAxBJ,UAAU,CAACI,aAAa,CAAG,QAAQ,EAAE,qBAAqB,CAAC;IAE3Df,MAAM,CAACkB,MAAM,CAACC,IAAI,EAAAV,iBAAA,GAACE,UAAU,CAAC3B,KAAK,YAAAyB,iBAAA,GAAI,CAAC,CAAC,CAAC,CAAC,CAACF,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC;IACvEP,MAAM,CAACU,IAAI,CAAC,CAACH,OAAO,CAAC,CAAC,4BAA4B,CAAC,CAAC;EACtD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* FeatureAvailability — a compact, data-driven block that states where a
|
|
4
|
+
* feature is available: on which hosting, on which plans and to which roles.
|
|
5
|
+
*
|
|
6
|
+
* It is the reusable version of the availability panel used in the Help Docs
|
|
7
|
+
* example articles, extracted so several stories (and, later, the real
|
|
8
|
+
* PortableText renderer) can share one implementation and one visual language:
|
|
9
|
+
*
|
|
10
|
+
* • green check → available
|
|
11
|
+
* • analog clock → decided but not shipped yet ("to be determined")
|
|
12
|
+
* • strikethrough → not included
|
|
13
|
+
*
|
|
14
|
+
* The component is theme-agnostic (all colors come from `--color-*` tokens) and
|
|
15
|
+
* self-contained (it carries its own typography, so it renders correctly
|
|
16
|
+
* outside the article body as well).
|
|
17
|
+
*/
|
|
18
|
+
export type AvailabilityStatus = "available" | "pending" | "excluded";
|
|
19
|
+
export interface AvailabilityMark {
|
|
20
|
+
label: string;
|
|
21
|
+
status: AvailabilityStatus;
|
|
22
|
+
/** Muted parenthetical, e.g. "(stable, since Jun 17 2026)". Include the parens. */
|
|
23
|
+
note?: string;
|
|
24
|
+
/** Italic muted trailing text for the pending state, e.g. "to be determined". */
|
|
25
|
+
pending?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Nested marks rendered in parentheses, e.g. Member+ (PM ✓ / FM ✓). When a
|
|
28
|
+
* mark has children it does not render its own status icon — the children
|
|
29
|
+
* carry the marks.
|
|
30
|
+
*/
|
|
31
|
+
children?: AvailabilityMark[];
|
|
32
|
+
}
|
|
33
|
+
export interface AvailabilityRow {
|
|
34
|
+
label: string;
|
|
35
|
+
items: AvailabilityMark[];
|
|
36
|
+
/** Icon before the label (Availability row) or after it (Plans / Roles). Default "after". */
|
|
37
|
+
iconPosition?: "before" | "after";
|
|
38
|
+
/** Separate items with a middot (used on the Availability row). Default false. */
|
|
39
|
+
separated?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface FeatureAvailabilityProps {
|
|
42
|
+
rows: AvailabilityRow[];
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const FeatureAvailability: ({ rows, className, }: FeatureAvailabilityProps) => ReactElement;
|
|
46
|
+
/**
|
|
47
|
+
* A realistic GA feature: shipped on Cloud, self-hosted still to be scheduled,
|
|
48
|
+
* on every plan, for internal roles but not for clients. Exercises all three
|
|
49
|
+
* marks (check / clock / strikethrough) out of the box.
|
|
50
|
+
*/
|
|
51
|
+
export declare const DEFAULT_FEATURE_AVAILABILITY: FeatureAvailabilityProps;
|
|
52
|
+
//# sourceMappingURL=FeatureAvailability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureAvailability.d.ts","sourceRoot":"","sources":["../../../../src/presentation/shared/FeatureAvailability.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAI5C;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,kBAAkB,CAAC;IAC3B,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,6FAA6F;IAC7F,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,kFAAkF;IAClF,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsMD,eAAO,MAAM,mBAAmB,GAAI,sBAGjC,wBAAwB,KAAG,YAsB7B,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,wBA8C1C,CAAC"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* FeatureAvailability — a compact, data-driven block that states where a
|
|
6
|
+
* feature is available: on which hosting, on which plans and to which roles.
|
|
7
|
+
*
|
|
8
|
+
* It is the reusable version of the availability panel used in the Help Docs
|
|
9
|
+
* example articles, extracted so several stories (and, later, the real
|
|
10
|
+
* PortableText renderer) can share one implementation and one visual language:
|
|
11
|
+
*
|
|
12
|
+
* • green check → available
|
|
13
|
+
* • analog clock → decided but not shipped yet ("to be determined")
|
|
14
|
+
* • strikethrough → not included
|
|
15
|
+
*
|
|
16
|
+
* The component is theme-agnostic (all colors come from `--color-*` tokens) and
|
|
17
|
+
* self-contained (it carries its own typography, so it renders correctly
|
|
18
|
+
* outside the article body as well).
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/* ------------------------------------------------------------------ */
|
|
22
|
+
/* Marks */
|
|
23
|
+
/* ------------------------------------------------------------------ */
|
|
24
|
+
|
|
25
|
+
const CheckMark = () => /*#__PURE__*/React.createElement("svg", {
|
|
26
|
+
className: "ap-ic ap-yes",
|
|
27
|
+
viewBox: "0 0 16 16",
|
|
28
|
+
width: "15",
|
|
29
|
+
height: "15",
|
|
30
|
+
"aria-hidden": true
|
|
31
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
32
|
+
d: "M13 4.6 L6.5 11.4 L3 8",
|
|
33
|
+
fill: "none",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
strokeWidth: "2",
|
|
36
|
+
strokeLinecap: "round",
|
|
37
|
+
strokeLinejoin: "round"
|
|
38
|
+
}));
|
|
39
|
+
const ClockMark = () => /*#__PURE__*/React.createElement("svg", {
|
|
40
|
+
className: "ap-ic ap-clock",
|
|
41
|
+
viewBox: "0 0 16 16",
|
|
42
|
+
width: "14",
|
|
43
|
+
height: "14",
|
|
44
|
+
"aria-hidden": true
|
|
45
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
46
|
+
cx: "8",
|
|
47
|
+
cy: "8",
|
|
48
|
+
r: "6.2",
|
|
49
|
+
fill: "none",
|
|
50
|
+
stroke: "currentColor",
|
|
51
|
+
strokeWidth: "1.4"
|
|
52
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
53
|
+
d: "M8 8 L8 4.4 M8 8 L10.5 9.3",
|
|
54
|
+
fill: "none",
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeWidth: "1.4",
|
|
57
|
+
strokeLinecap: "round"
|
|
58
|
+
}));
|
|
59
|
+
const StatusIcon = _ref => {
|
|
60
|
+
let status = _ref.status;
|
|
61
|
+
if (status === "available") {
|
|
62
|
+
return /*#__PURE__*/React.createElement(CheckMark, null);
|
|
63
|
+
}
|
|
64
|
+
if (status === "pending") {
|
|
65
|
+
return /*#__PURE__*/React.createElement(ClockMark, null);
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** A nested mark inside parentheses, e.g. "PM ✓". */
|
|
71
|
+
const ChildMark = _ref2 => {
|
|
72
|
+
let mark = _ref2.mark;
|
|
73
|
+
return mark.status === "excluded" ? /*#__PURE__*/React.createElement("span", {
|
|
74
|
+
className: "ap-excluded"
|
|
75
|
+
}, mark.label) : /*#__PURE__*/React.createElement(React.Fragment, null, mark.label, " ", /*#__PURE__*/React.createElement(StatusIcon, {
|
|
76
|
+
status: mark.status
|
|
77
|
+
}));
|
|
78
|
+
};
|
|
79
|
+
const Mark = _ref3 => {
|
|
80
|
+
var _mark$children;
|
|
81
|
+
let mark = _ref3.mark,
|
|
82
|
+
iconPosition = _ref3.iconPosition;
|
|
83
|
+
const hasChildren = Boolean(mark.children && mark.children.length > 0);
|
|
84
|
+
const excluded = mark.status === "excluded";
|
|
85
|
+
const icon = hasChildren ? null : /*#__PURE__*/React.createElement(StatusIcon, {
|
|
86
|
+
status: mark.status
|
|
87
|
+
});
|
|
88
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
89
|
+
className: excluded ? "ap-item ap-excluded" : "ap-item"
|
|
90
|
+
}, iconPosition === "before" && icon, mark.label, mark.note && /*#__PURE__*/React.createElement("span", {
|
|
91
|
+
className: "ap-sub"
|
|
92
|
+
}, mark.note), mark.pending && /*#__PURE__*/React.createElement("span", {
|
|
93
|
+
className: "ap-tbd"
|
|
94
|
+
}, mark.pending), hasChildren && /*#__PURE__*/React.createElement("span", {
|
|
95
|
+
className: "ap-sub"
|
|
96
|
+
}, "(", (_mark$children = mark.children) == null ? void 0 : _mark$children.map((child, index) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
97
|
+
key: child.label
|
|
98
|
+
}, index > 0 && " / ", /*#__PURE__*/React.createElement(ChildMark, {
|
|
99
|
+
mark: child
|
|
100
|
+
}))), ")"), iconPosition === "after" && icon);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/* ------------------------------------------------------------------ */
|
|
104
|
+
/* Panel */
|
|
105
|
+
/* ------------------------------------------------------------------ */
|
|
106
|
+
|
|
107
|
+
const StyledPanel = styled.div.withConfig({
|
|
108
|
+
displayName: "FeatureAvailability__StyledPanel",
|
|
109
|
+
componentId: "sc-42kyhy-0"
|
|
110
|
+
})(["font-family:-apple-system,BlinkMacSystemFont,\"Roboto\",\"Helvetica Neue\",Arial,sans-serif;font-size:13px;line-height:20px;color:var(--color-theme-900);padding:12px 16px;border:1px solid var(--color-theme-300);border-radius:10px;background:var(--color-theme-100);.ap-row{display:flex;gap:10px;padding:6px 0;align-items:baseline;flex-wrap:wrap;}.ap-row:first-of-type{padding-top:0;}.ap-row:last-of-type{padding-bottom:0;}.ap-row + .ap-row{border-top:1px dashed var(--color-theme-300);}.ap-label{flex:0 0 84px;color:var(--color-theme-700);font-weight:600;font-size:13px;}.ap-vals{flex:1 1 240px;display:flex;flex-wrap:wrap;gap:4px 14px;align-items:center;}.ap-item{display:inline-flex;align-items:center;gap:5px;white-space:nowrap;}.ap-sub{color:var(--color-theme-600);}.ap-tbd{color:var(--color-theme-600);font-style:italic;}.ap-sep{color:var(--color-theme-400);}.ap-excluded{text-decoration:line-through;color:var(--color-theme-500);}.ap-ic{flex:none;vertical-align:-2px;}.ap-yes{color:var(--color-green-olive-drab);}.ap-clock{color:var(--color-theme-600);}"]);
|
|
111
|
+
export const FeatureAvailability = _ref4 => {
|
|
112
|
+
let rows = _ref4.rows,
|
|
113
|
+
className = _ref4.className;
|
|
114
|
+
return /*#__PURE__*/React.createElement(StyledPanel, {
|
|
115
|
+
className: className,
|
|
116
|
+
"aria-label": "Feature availability"
|
|
117
|
+
}, rows.map(row => {
|
|
118
|
+
var _row$iconPosition;
|
|
119
|
+
const iconPosition = (_row$iconPosition = row.iconPosition) != null ? _row$iconPosition : "after";
|
|
120
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
121
|
+
className: "ap-row",
|
|
122
|
+
key: row.label
|
|
123
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
124
|
+
className: "ap-label"
|
|
125
|
+
}, row.label), /*#__PURE__*/React.createElement("span", {
|
|
126
|
+
className: "ap-vals"
|
|
127
|
+
}, row.items.map((item, index) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
128
|
+
key: item.label
|
|
129
|
+
}, index > 0 && row.separated && /*#__PURE__*/React.createElement("span", {
|
|
130
|
+
className: "ap-sep"
|
|
131
|
+
}, "\xB7"), /*#__PURE__*/React.createElement(Mark, {
|
|
132
|
+
mark: item,
|
|
133
|
+
iconPosition: iconPosition
|
|
134
|
+
})))));
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/* ------------------------------------------------------------------ */
|
|
139
|
+
/* Illustrative defaults */
|
|
140
|
+
/* ------------------------------------------------------------------ */
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* A realistic GA feature: shipped on Cloud, self-hosted still to be scheduled,
|
|
144
|
+
* on every plan, for internal roles but not for clients. Exercises all three
|
|
145
|
+
* marks (check / clock / strikethrough) out of the box.
|
|
146
|
+
*/
|
|
147
|
+
export const DEFAULT_FEATURE_AVAILABILITY = {
|
|
148
|
+
rows: [{
|
|
149
|
+
label: "Availability",
|
|
150
|
+
iconPosition: "before",
|
|
151
|
+
separated: true,
|
|
152
|
+
items: [{
|
|
153
|
+
label: "Cloud",
|
|
154
|
+
status: "available",
|
|
155
|
+
note: "(stable, since Jun 17 2026)"
|
|
156
|
+
}, {
|
|
157
|
+
label: "Self-Hosted",
|
|
158
|
+
status: "pending",
|
|
159
|
+
pending: "to be determined"
|
|
160
|
+
}]
|
|
161
|
+
}, {
|
|
162
|
+
label: "Plans",
|
|
163
|
+
items: [{
|
|
164
|
+
label: "S–Mega",
|
|
165
|
+
status: "available"
|
|
166
|
+
}, {
|
|
167
|
+
label: "Plus",
|
|
168
|
+
status: "available"
|
|
169
|
+
}, {
|
|
170
|
+
label: "Pro",
|
|
171
|
+
status: "available"
|
|
172
|
+
}, {
|
|
173
|
+
label: "Pro+Get-Paid",
|
|
174
|
+
status: "available"
|
|
175
|
+
}]
|
|
176
|
+
}, {
|
|
177
|
+
label: "Roles",
|
|
178
|
+
items: [{
|
|
179
|
+
label: "Owner",
|
|
180
|
+
status: "available"
|
|
181
|
+
}, {
|
|
182
|
+
label: "Member",
|
|
183
|
+
status: "available"
|
|
184
|
+
}, {
|
|
185
|
+
label: "Member+",
|
|
186
|
+
status: "available",
|
|
187
|
+
children: [{
|
|
188
|
+
label: "PM",
|
|
189
|
+
status: "available"
|
|
190
|
+
}, {
|
|
191
|
+
label: "FM",
|
|
192
|
+
status: "available"
|
|
193
|
+
}]
|
|
194
|
+
}, {
|
|
195
|
+
label: "Client",
|
|
196
|
+
status: "excluded"
|
|
197
|
+
}, {
|
|
198
|
+
label: "Client+",
|
|
199
|
+
status: "excluded"
|
|
200
|
+
}]
|
|
201
|
+
}]
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=FeatureAvailability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeatureAvailability.js","names":["React","styled","CheckMark","createElement","className","viewBox","width","height","d","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","ClockMark","cx","cy","r","StatusIcon","_ref","status","ChildMark","_ref2","mark","label","Fragment","Mark","_ref3","_mark$children","iconPosition","hasChildren","Boolean","children","length","excluded","icon","note","pending","map","child","index","key","StyledPanel","div","withConfig","displayName","componentId","FeatureAvailability","_ref4","rows","row","_row$iconPosition","items","item","separated","DEFAULT_FEATURE_AVAILABILITY"],"sources":["../../../../src/presentation/shared/FeatureAvailability.tsx"],"sourcesContent":["import React, { ReactElement } from \"react\";\n\nimport styled from \"styled-components\";\n\n/**\n * FeatureAvailability — a compact, data-driven block that states where a\n * feature is available: on which hosting, on which plans and to which roles.\n *\n * It is the reusable version of the availability panel used in the Help Docs\n * example articles, extracted so several stories (and, later, the real\n * PortableText renderer) can share one implementation and one visual language:\n *\n * • green check → available\n * • analog clock → decided but not shipped yet (\"to be determined\")\n * • strikethrough → not included\n *\n * The component is theme-agnostic (all colors come from `--color-*` tokens) and\n * self-contained (it carries its own typography, so it renders correctly\n * outside the article body as well).\n */\n\nexport type AvailabilityStatus = \"available\" | \"pending\" | \"excluded\";\n\nexport interface AvailabilityMark {\n label: string;\n status: AvailabilityStatus;\n /** Muted parenthetical, e.g. \"(stable, since Jun 17 2026)\". Include the parens. */\n note?: string;\n /** Italic muted trailing text for the pending state, e.g. \"to be determined\". */\n pending?: string;\n /**\n * Nested marks rendered in parentheses, e.g. Member+ (PM ✓ / FM ✓). When a\n * mark has children it does not render its own status icon — the children\n * carry the marks.\n */\n children?: AvailabilityMark[];\n}\n\nexport interface AvailabilityRow {\n label: string;\n items: AvailabilityMark[];\n /** Icon before the label (Availability row) or after it (Plans / Roles). Default \"after\". */\n iconPosition?: \"before\" | \"after\";\n /** Separate items with a middot (used on the Availability row). Default false. */\n separated?: boolean;\n}\n\nexport interface FeatureAvailabilityProps {\n rows: AvailabilityRow[];\n className?: string;\n}\n\n/* ------------------------------------------------------------------ */\n/* Marks */\n/* ------------------------------------------------------------------ */\n\nconst CheckMark = (): ReactElement => (\n <svg\n className=\"ap-ic ap-yes\"\n viewBox=\"0 0 16 16\"\n width=\"15\"\n height=\"15\"\n aria-hidden\n >\n <path\n d=\"M13 4.6 L6.5 11.4 L3 8\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n);\n\nconst ClockMark = (): ReactElement => (\n <svg\n className=\"ap-ic ap-clock\"\n viewBox=\"0 0 16 16\"\n width=\"14\"\n height=\"14\"\n aria-hidden\n >\n <circle\n cx=\"8\"\n cy=\"8\"\n r=\"6.2\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.4\"\n />\n <path\n d=\"M8 8 L8 4.4 M8 8 L10.5 9.3\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.4\"\n strokeLinecap=\"round\"\n />\n </svg>\n);\n\nconst StatusIcon = ({\n status,\n}: {\n status: AvailabilityStatus;\n}): ReactElement | null => {\n if (status === \"available\") {\n return <CheckMark />;\n }\n if (status === \"pending\") {\n return <ClockMark />;\n }\n return null;\n};\n\n/** A nested mark inside parentheses, e.g. \"PM ✓\". */\nconst ChildMark = ({ mark }: { mark: AvailabilityMark }): ReactElement =>\n mark.status === \"excluded\" ? (\n <span className=\"ap-excluded\">{mark.label}</span>\n ) : (\n <>\n {mark.label} <StatusIcon status={mark.status} />\n </>\n );\n\nconst Mark = ({\n mark,\n iconPosition,\n}: {\n mark: AvailabilityMark;\n iconPosition: \"before\" | \"after\";\n}): ReactElement => {\n const hasChildren = Boolean(mark.children && mark.children.length > 0);\n const excluded = mark.status === \"excluded\";\n const icon = hasChildren ? null : <StatusIcon status={mark.status} />;\n\n return (\n <span className={excluded ? \"ap-item ap-excluded\" : \"ap-item\"}>\n {iconPosition === \"before\" && icon}\n {mark.label}\n {mark.note && <span className=\"ap-sub\">{mark.note}</span>}\n {mark.pending && <span className=\"ap-tbd\">{mark.pending}</span>}\n {hasChildren && (\n <span className=\"ap-sub\">\n (\n {mark.children?.map((child, index) => (\n <React.Fragment key={child.label}>\n {index > 0 && \" / \"}\n <ChildMark mark={child} />\n </React.Fragment>\n ))}\n )\n </span>\n )}\n {iconPosition === \"after\" && icon}\n </span>\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* Panel */\n/* ------------------------------------------------------------------ */\n\nconst StyledPanel = styled.div`\n font-family: -apple-system, BlinkMacSystemFont, \"Roboto\", \"Helvetica Neue\",\n Arial, sans-serif;\n font-size: 13px;\n line-height: 20px;\n color: var(--color-theme-900);\n padding: 12px 16px;\n border: 1px solid var(--color-theme-300);\n border-radius: 10px;\n background: var(--color-theme-100);\n\n .ap-row {\n display: flex;\n gap: 10px;\n padding: 6px 0;\n align-items: baseline;\n flex-wrap: wrap;\n }\n\n .ap-row:first-of-type {\n padding-top: 0;\n }\n\n .ap-row:last-of-type {\n padding-bottom: 0;\n }\n\n .ap-row + .ap-row {\n border-top: 1px dashed var(--color-theme-300);\n }\n\n .ap-label {\n flex: 0 0 84px;\n color: var(--color-theme-700);\n font-weight: 600;\n font-size: 13px;\n }\n\n .ap-vals {\n flex: 1 1 240px;\n display: flex;\n flex-wrap: wrap;\n gap: 4px 14px;\n align-items: center;\n }\n\n .ap-item {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n white-space: nowrap;\n }\n\n .ap-sub {\n color: var(--color-theme-600);\n }\n\n .ap-tbd {\n color: var(--color-theme-600);\n font-style: italic;\n }\n\n .ap-sep {\n color: var(--color-theme-400);\n }\n\n .ap-excluded {\n text-decoration: line-through;\n color: var(--color-theme-500);\n }\n\n .ap-ic {\n flex: none;\n vertical-align: -2px;\n }\n\n .ap-yes {\n color: var(--color-green-olive-drab);\n }\n\n .ap-clock {\n color: var(--color-theme-600);\n }\n`;\n\nexport const FeatureAvailability = ({\n rows,\n className,\n}: FeatureAvailabilityProps): ReactElement => (\n <StyledPanel className={className} aria-label=\"Feature availability\">\n {rows.map((row) => {\n const iconPosition = row.iconPosition ?? \"after\";\n\n return (\n <div className=\"ap-row\" key={row.label}>\n <span className=\"ap-label\">{row.label}</span>\n <span className=\"ap-vals\">\n {row.items.map((item, index) => (\n <React.Fragment key={item.label}>\n {index > 0 && row.separated && (\n <span className=\"ap-sep\">·</span>\n )}\n <Mark mark={item} iconPosition={iconPosition} />\n </React.Fragment>\n ))}\n </span>\n </div>\n );\n })}\n </StyledPanel>\n);\n\n/* ------------------------------------------------------------------ */\n/* Illustrative defaults */\n/* ------------------------------------------------------------------ */\n\n/**\n * A realistic GA feature: shipped on Cloud, self-hosted still to be scheduled,\n * on every plan, for internal roles but not for clients. Exercises all three\n * marks (check / clock / strikethrough) out of the box.\n */\nexport const DEFAULT_FEATURE_AVAILABILITY: FeatureAvailabilityProps = {\n rows: [\n {\n label: \"Availability\",\n iconPosition: \"before\",\n separated: true,\n items: [\n {\n label: \"Cloud\",\n status: \"available\",\n note: \"(stable, since Jun 17 2026)\",\n },\n {\n label: \"Self-Hosted\",\n status: \"pending\",\n pending: \"to be determined\",\n },\n ],\n },\n {\n label: \"Plans\",\n items: [\n { label: \"S–Mega\", status: \"available\" },\n { label: \"Plus\", status: \"available\" },\n { label: \"Pro\", status: \"available\" },\n { label: \"Pro+Get-Paid\", status: \"available\" },\n ],\n },\n {\n label: \"Roles\",\n items: [\n { label: \"Owner\", status: \"available\" },\n { label: \"Member\", status: \"available\" },\n {\n label: \"Member+\",\n status: \"available\",\n children: [\n { label: \"PM\", status: \"available\" },\n { label: \"FM\", status: \"available\" },\n ],\n },\n { label: \"Client\", status: \"excluded\" },\n { label: \"Client+\", status: \"excluded\" },\n ],\n },\n ],\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAwB,OAAO;AAE3C,OAAOC,MAAM,MAAM,mBAAmB;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiCA;AACA;AACA;;AAEA,MAAMC,SAAS,GAAGA,CAAA,kBAChBF,KAAA,CAAAG,aAAA;EACEC,SAAS,EAAC,cAAc;EACxBC,OAAO,EAAC,WAAW;EACnBC,KAAK,EAAC,IAAI;EACVC,M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,EAAE,CACR;QAAER,KAAK,EAAE,IAAI;QAAEJ,MAAM,EAAE;MAAY,CAAC,EACpC;QAAEI,KAAK,EAAE,IAAI;QAAEJ,MAAM,EAAE;MAAY,CAAC;IAExC,CAAC,EACD;MAAEI,KAAK,EAAE,QAAQ;MAAEJ,MAAM,EAAE;IAAW,CAAC,EACvC;MAAEI,KAAK,EAAE,SAAS;MAAEJ,MAAM,EAAE;IAAW,CAAC;EAE5C,CAAC;AAEL,CAAC","ignoreList":[]}
|
|
@@ -36,4 +36,6 @@ export { BackupCodesDialogs, CreateLoginCodeDialogs } from "./TwoFactorDialogs";
|
|
|
36
36
|
export type { BackupCodesDialogsProps, CreateLoginCodeDialogsProps, } from "./TwoFactorDialogs";
|
|
37
37
|
export { SettingsHeader, SettingsContent, StyledSettingRow, RowText, SettingRow, } from "./settings";
|
|
38
38
|
export type { SettingsHeaderProps, SettingRowProps } from "./settings";
|
|
39
|
+
export { FeatureAvailability, DEFAULT_FEATURE_AVAILABILITY, } from "./FeatureAvailability";
|
|
40
|
+
export type { FeatureAvailabilityProps, AvailabilityRow, AvailabilityMark, AvailabilityStatus, } from "./FeatureAvailability";
|
|
39
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/presentation/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrE,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB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BAAmB,CAAC;AACzE,YAAY,EACV,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAChF,YAAY,EACV,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/presentation/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzE,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACrE,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,kBAAkB,EAClB,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