@orangelogic/design-system 2.221.0 → 2.223.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.221.0",
4
+ "version": "2.223.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  import { default as CxIconButton } from '../icon-button/icon-button.ts';
2
2
  import { default as CortexLightElement } from '../../../../base/src/cortex-light-element.ts';
3
- import { TemplateResult } from 'lit';
3
+ import { PropertyValues, TemplateResult } from 'lit';
4
4
  import { RendererObject, TokenizerAndRendererExtension } from 'marked';
5
5
 
6
6
  /**
@@ -10,7 +10,8 @@ import { RendererObject, TokenizerAndRendererExtension } from 'marked';
10
10
  * cx-markdown is powered by [MarkedJs](https://marked.js.org/).
11
11
  *
12
12
  * Fenced `mermaid` code blocks render as diagrams; Mermaid is imported lazily only when one is
13
- * present. Output is sanitized with DOMPurify unless `live-script` is set.
13
+ * present; with `show-math-notation` set, `$…$` and `$$…$$` render through KaTeX the same way.
14
+ * Output is sanitized with DOMPurify unless `live-script` is set.
14
15
  *
15
16
  * Leading YAML frontmatter renders as a collapsed disclosure instead of an `<hr>` plus heading, and
16
17
  * is parsed onto the `frontmatter` property.
@@ -24,7 +25,7 @@ import { RendererObject, TokenizerAndRendererExtension } from 'marked';
24
25
  * buttons, Mermaid nodes — do not bubble past the component. Clicks on inert content still do.
25
26
  *
26
27
  * @event cx-ready - Emitted when the markdown has been rendered, deferred until any Mermaid
27
- * diagrams have been drawn.
28
+ * diagrams and formulas have been drawn.
28
29
  */
29
30
  export default class CxMarkdown extends CortexLightElement {
30
31
  #private;
@@ -33,6 +34,8 @@ export default class CxMarkdown extends CortexLightElement {
33
34
  'cx-icon-button': typeof CxIconButton;
34
35
  };
35
36
  private readonly localize;
37
+ /** KaTeX loader, held in a field like other I/O so a test can keep the import pending. */
38
+ private loadKatex;
36
39
  /**
37
40
  * YAML frontmatter parsed from `markdown`, empty when there is none. Derived output — assigning
38
41
  * to it has no effect. Read it after `cx-ready`. Deliberately non-reactive: the disclosure is
@@ -54,6 +57,11 @@ export default class CxMarkdown extends CortexLightElement {
54
57
  * adds `rel="noopener noreferrer"`. Empty (the default) leaves anchors untouched.
55
58
  */
56
59
  linkTarget: string;
60
+ /**
61
+ * Renders `$…$` and `$$…$$` with KaTeX, loaded lazily. Invalid TeX, or a browser without
62
+ * MathML, keeps its source.
63
+ */
64
+ showMathNotation: boolean;
57
65
  /**
58
66
  * The markdown to render.
59
67
  */
@@ -73,6 +81,7 @@ export default class CxMarkdown extends CortexLightElement {
73
81
  rendered: string;
74
82
  connectedCallback(): void;
75
83
  disconnectedCallback(): void;
84
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
76
85
  updateRendered(): void;
77
86
  /**
78
87
  * Light DOM means every click reaches ancestors, which commonly treat one as "start editing".
@@ -1,9 +1,12 @@
1
- import { Marked, Tokens } from 'marked';
1
+ import { CreateParserOptions } from '../../../../types/src/markdown';
2
+ import { Marked, MarkedExtension, Renderer, Tokens } from 'marked';
2
3
 
3
4
  /** Class name cx-markdown looks for when deciding whether to load Mermaid. */
4
5
  export declare const MERMAID_CLASS_NAME = "mermaid";
5
6
  /** Class name on the disclosure wrapping YAML frontmatter. */
6
7
  export declare const FRONTMATTER_CLASS_NAME = "cx-frontmatter";
8
+ /** Class name cx-markdown looks for when deciding whether to load KaTeX. */
9
+ export declare const MATH_CLASS_NAME = "cx-math";
7
10
  export type ExtractedFrontmatter = {
8
11
  /** The markdown with the frontmatter block removed. */
9
12
  body: string;
@@ -16,8 +19,10 @@ export declare function extractFrontmatter(source: string): ExtractedFrontmatter
16
19
  /** Collapsed disclosure shown in place of the frontmatter block. */
17
20
  export declare function renderFrontmatterDetails(raw: string, label: string): string;
18
21
  export declare const baseRenderer: {
19
- code(this: import('marked').Renderer<string, string>, { escaped, lang: infoString, text }: Tokens.Code): string;
22
+ code(this: Renderer<string, string>, { escaped, lang: infoString, text }: Tokens.Code): string;
20
23
  };
24
+ /** Opt-in `$…$` / `$$…$$` support; `createParser({ math })` registers it. */
25
+ export declare const mathExtension: MarkedExtension;
21
26
  /**
22
27
  * https://marked.js.org/using_advanced in Marked instance section.
23
28
  * https://marked.js.org/using_pro in Marked marked.use() section.
@@ -25,5 +30,5 @@ export declare const baseRenderer: {
25
30
  *
26
31
  * Change from Singleton to Factory pattern: returns a new isolated Marked parser.
27
32
  */
28
- export declare function createParser(): Marked<string, string>;
33
+ export declare function createParser({ math }?: CreateParserOptions): Marked<string, string>;
29
34
  export type Parser = ReturnType<typeof createParser>;
@@ -130,7 +130,7 @@ export declare class ReactCrop extends PureComponent<ReactCropProps, ReactCropSt
130
130
  width: string;
131
131
  } | undefined;
132
132
  dragCrop(): PixelCrop;
133
- getPointRegion(box: Rectangle, origOrd: Ords | undefined, minWidth: number, minHeight: number): XYOrds;
133
+ getPointRegion(box: Rectangle): XYOrds;
134
134
  resolveMinDimensions(box: Rectangle, aspect: number, minWidth?: number, minHeight?: number): number[];
135
135
  resizeCrop(): PixelCrop;
136
136
  renderCropSelection(): import("react/jsx-runtime").JSX.Element | undefined;
@@ -23,7 +23,7 @@ export default class ConfigsController {
23
23
  'version-label'?: string;
24
24
  'waveform-src'?: string;
25
25
  width: string;
26
- }>[] | import('../../../types/src/content-builder').PropertyConfig<{
26
+ }>[] | import('../../../types/src/content-builder').PropertyConfig[] | import('../../../types/src/content-builder').PropertyConfig<{
27
27
  'asset-button-type': import('./blocks/button/button').default["assetType"];
28
28
  'asset-src': import('./blocks/button/button').default["assetSrc"];
29
29
  'asset-type': import('./blocks/button/button').default["assetType"];
@@ -288,7 +288,7 @@ export default class ConfigsController {
288
288
  'use-custom-alt-dark-mode': import('./blocks/image/image').default["useCustomAltDarkMode"];
289
289
  width: import('./blocks/image/image').default["width"];
290
290
  'zoom-style'?: import('./blocks/image/image').default["zoomStyle"];
291
- }>[] | import('../../../types/src/content-builder').PropertyConfig[] | import('../../../types/src/content-builder').PropertyConfig<{
291
+ }>[] | import('../../../types/src/content-builder').PropertyConfig<{
292
292
  'can-search-by-icon': import('../../../molecules/src/index.ts').CxSearchBox["canSearchByIcon"];
293
293
  label: import('../../../molecules/src/index.ts').CxSearchBox["label"];
294
294
  placeholder: import('../../../molecules/src/index.ts').CxSearchBox["placeholder"];
@@ -11,6 +11,11 @@ type FontPickerStoredValues = {
11
11
  style: string;
12
12
  weight: string;
13
13
  };
14
+ /**
15
+ * Validates an "Open link" target: an absolute or intranet URL, or a relative
16
+ * URL resolved against the current site at click time (see `openLink`).
17
+ */
18
+ export declare function isValidClickLink(clickLink: string): boolean;
14
19
  export declare function getTemplateClass(templateId: string): string;
15
20
  export declare function getContentConfigs(traits: PropertyConfig[], adHocProperties: string[]): string[];
16
21
  export declare function getLimitedBlocks(blockType: BlockType): BlockType[];
@@ -10,4 +10,4 @@ import { Schema } from '@tiptap/pm/model';
10
10
  * Constructs the model cannot represent are not dropped: `html_block` and `html_inline` hold their
11
11
  * source verbatim and are replayed on the way out.
12
12
  */
13
- export declare const markdownSchema: Schema<"image" | "blockquote" | "table" | "text" | "heading" | "paragraph" | "frontmatter" | "doc" | "horizontal_rule" | "bullet_list" | "code_block" | "list_item" | "ordered_list" | "table_row" | "table_cell" | "table_header" | "hard_break" | "html_block" | "html_inline", "link" | "code" | "em" | "strong" | "strike">;
13
+ export declare const markdownSchema: Schema<"image" | "blockquote" | "table" | "text" | "heading" | "paragraph" | "list_item" | "frontmatter" | "doc" | "horizontal_rule" | "bullet_list" | "code_block" | "ordered_list" | "table_row" | "table_cell" | "table_header" | "hard_break" | "html_block" | "html_inline", "link" | "code" | "em" | "strong" | "strike">;
@@ -3527,6 +3527,10 @@
3527
3527
  * Target applied to every rendered link. Set to `_blank` to open links in a new tab, which also adds `rel="noopener noreferrer"`. Empty (the default) leaves anchors untouched.
3528
3528
  */
3529
3529
  linkTarget?: string;
3530
+ /**
3531
+ * Renders `$…$` and `$$…$$` with KaTeX, loaded lazily. Invalid TeX, or a browser without MathML, keeps its source.
3532
+ */
3533
+ showMathNotation?: boolean;
3530
3534
  /**
3531
3535
  * The markdown to render.
3532
3536
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.221.0",
4
+ "version": "2.223.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {