@orangelogic/design-system 2.174.0 → 2.176.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.
Files changed (21) hide show
  1. package/library/chunks/{color-swatch-group.C01UAz1A.js → color-swatch-group.NJnbc24w.js} +696 -699
  2. package/library/chunks/{color-swatch.DpzAGKQx.js → color-swatch.D6Gg5bpz.js} +1 -1
  3. package/library/chunks/{folder-select.BgWvY0t0.js → folder-select.Di9wfqIU.js} +77 -72
  4. package/library/components/color-swatch-group.js +2 -2
  5. package/library/components/color-swatch.js +1 -1
  6. package/library/components/copy-button.js +1 -1
  7. package/library/components/folder-select.js +1 -1
  8. package/library/components/molecules.js +2 -2
  9. package/library/components/organisms.js +1 -1
  10. package/library/components/types.js +16162 -16098
  11. package/library/package.json +1 -1
  12. package/library/packages/atoms/src/components/copy-button/copy-button.d.ts +3 -0
  13. package/library/packages/organisms/src/color-swatch-group/color-swatch-group.constants.d.ts +10 -66
  14. package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +1 -0
  15. package/library/packages/organisms/src/content-builder/content-builder.utils.d.ts +9 -0
  16. package/library/packages/organisms/src/content-builder/plugins/{telemetry.d.ts → telemetry/index.d.ts} +2 -0
  17. package/library/packages/organisms/src/content-builder/{content-builder.telemetry.d.ts → plugins/telemetry/measure.d.ts} +7 -19
  18. package/library/packages/organisms/src/content-builder/plugins/telemetry/metrics.d.ts +106 -0
  19. package/library/packages/utils/src/font/font.d.ts +23 -8
  20. package/library/utils.js +322 -311
  21. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "2.174.0",
4
+ "version": "2.176.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -27,6 +27,9 @@ import { default as CxTooltip } from '../tooltip/tooltip';
27
27
  * @cssproperty --background-color - The background color to use for the button.
28
28
  * @cssproperty --color - The color to use for the button.
29
29
  * @cssproperty --button-font-size - The font size to use for the button.
30
+ * @cssproperty --button-font-family - The font family to use for the button.
31
+ * @cssproperty --button-font-style - The font style to use for the button.
32
+ * @cssproperty --button-font-weight - The font weight to use for the button.
30
33
  * @cssproperty --button-padding - The padding to use for the button.
31
34
  * @cssproperty --button-background-color - The background color to use for the button.
32
35
  *
@@ -6,84 +6,29 @@ export declare const validCodes: string[];
6
6
  export declare const columnDefaults: {
7
7
  resizable: boolean;
8
8
  };
9
- export declare const columns: ({
9
+ /**
10
+ * A single "Name" column that renders the color swatch and the name together,
11
+ * so the "Name" header spans the whole column instead of truncating inside a
12
+ * narrow swatch-only column.
13
+ */
14
+ export declare const nameColumn: {
10
15
  field: string;
11
16
  formatter: (cell: CellComponent) => HTMLDivElement;
12
17
  headerHozAlign: string;
13
18
  headerSort: boolean;
14
19
  hozAlign: string;
15
20
  title: string;
16
- width: number;
17
- widthGrow?: undefined;
18
- minWidth?: undefined;
19
- responsive?: undefined;
20
- } | {
21
- field: string;
22
- headerHozAlign: string;
23
- headerSort: boolean;
24
- hozAlign: string;
25
21
  widthGrow: number;
26
- formatter?: undefined;
27
- title?: undefined;
28
- width?: undefined;
29
- minWidth?: undefined;
30
- responsive?: undefined;
31
- } | {
22
+ };
23
+ export declare const codeColumns: ({
32
24
  field: string;
33
25
  headerHozAlign: string;
34
26
  headerSort: boolean;
35
27
  hozAlign: string;
36
28
  minWidth: number;
37
29
  title: string;
38
- formatter?: undefined;
39
- width?: undefined;
40
- widthGrow?: undefined;
41
- responsive?: undefined;
42
- } | {
43
- field: string;
44
- headerHozAlign: string;
45
- headerSort: boolean;
46
- hozAlign: string;
47
- responsive: number;
48
- title: string;
49
- widthGrow: number;
50
- formatter?: undefined;
51
- width?: undefined;
52
- minWidth?: undefined;
53
- })[];
54
- export declare const copyableColumns: (localize: LocalizeController, palette: string) => ({
55
- field: string;
56
- formatter: (cell: CellComponent) => HTMLDivElement;
57
- headerHozAlign: string;
58
- headerSort: boolean;
59
- hozAlign: string;
60
- title: string;
61
- width: number;
62
- widthGrow?: undefined;
63
- minWidth?: undefined;
64
30
  responsive?: undefined;
65
- } | {
66
- field: string;
67
- headerHozAlign: string;
68
- headerSort: boolean;
69
- hozAlign: string;
70
- widthGrow: number;
71
- formatter?: undefined;
72
- title?: undefined;
73
- width?: undefined;
74
- minWidth?: undefined;
75
- responsive?: undefined;
76
- } | {
77
- field: string;
78
- headerHozAlign: string;
79
- headerSort: boolean;
80
- hozAlign: string;
81
- minWidth: number;
82
- title: string;
83
- formatter?: undefined;
84
- width?: undefined;
85
31
  widthGrow?: undefined;
86
- responsive?: undefined;
87
32
  } | {
88
33
  field: string;
89
34
  headerHozAlign: string;
@@ -92,10 +37,9 @@ export declare const copyableColumns: (localize: LocalizeController, palette: st
92
37
  responsive: number;
93
38
  title: string;
94
39
  widthGrow: number;
95
- formatter?: undefined;
96
- width?: undefined;
97
40
  minWidth?: undefined;
98
- } | {
41
+ })[];
42
+ export declare const copyableCodeColumns: (localize: LocalizeController, palette: string) => ({
99
43
  field: string;
100
44
  formatter: (cell: any) => HTMLElement | null;
101
45
  headerHozAlign: string;
@@ -7,6 +7,7 @@ export declare class ConfigFormController implements ReactiveController {
7
7
  host: ReactiveControllerHost & CxConfigForm;
8
8
  private readonly localize;
9
9
  private apiSearchAssets;
10
+ private apiGetTeamSpaceFontFamily;
10
11
  private readonly pendingGalleryPickerSaves;
11
12
  private readonly fontFamiliesCache;
12
13
  private readonly pendingFontFamilyFetches;
@@ -14,6 +14,15 @@ type FontPickerStoredValues = {
14
14
  export declare function getTemplateClass(templateId: string): string;
15
15
  export declare function getContentConfigs(traits: PropertyConfig[], adHocProperties: string[]): string[];
16
16
  export declare function getLimitedBlocks(blockType: BlockType): BlockType[];
17
+ /**
18
+ * The `space-default` typeface inherits the team space's current font, so the
19
+ * backend returns it with no variants of its own. Populate its `families` from
20
+ * the typeface that matches the space's current font (from
21
+ * `apiGetTeamSpaceFontFamily`), so the style dropdown can offer that font's
22
+ * variants. Returns the list unchanged when there is no space font or no
23
+ * matching typeface.
24
+ */
25
+ export declare function injectSpaceDefaultVariants(typefaces: FontTypeface[], spaceFontFamily: string): FontTypeface[];
17
26
  export declare function getFontPickerControlValues({ blockAttributes, keys, typefaces, }: {
18
27
  blockAttributes: Record<string, unknown>;
19
28
  keys: FontPickerKeys;
@@ -1,5 +1,7 @@
1
1
  import { Editor } from 'grapesjs';
2
2
 
3
+ export * from './metrics';
4
+ export * from './measure';
3
5
  export type TelemetryPluginOptions = {
4
6
  bootStartedAt: number;
5
7
  };
@@ -1,28 +1,16 @@
1
1
  import { Component } from 'grapesjs';
2
+ import { UiActionName } from './metrics';
2
3
 
3
- export declare const UiAction: {
4
- readonly AddBlock: "add_block";
5
- readonly ConfigureWorkflow: "configure_workflow";
6
- readonly DeviceSwitch: "device_switch";
7
- readonly DuplicateBlock: "duplicate_block";
8
- readonly EditorBoot: "editor_boot";
9
- readonly MoveBlock: "move_block";
10
- readonly OpenConfig: "open_config";
11
- readonly PickAsset: "pick_asset";
12
- readonly PickAssetFormat: "pick_asset_format";
13
- readonly PickDownloadFormat: "pick_download_format";
14
- readonly Redo: "redo";
15
- readonly RemoveBlock: "remove_block";
16
- readonly RichTextEdit: "rich_text_edit";
17
- readonly SaveConfig: "save_config";
18
- readonly SelectBlock: "select_block";
19
- readonly Undo: "undo";
20
- };
21
- export type UiActionName = (typeof UiAction)[keyof typeof UiAction];
22
4
  /** Mirrors the CMS5_BO.Data.MetricsIsEnabled parameter, passed in by the host VForm. */
23
5
  export declare function setEditorMetricsEnabled(enabled: boolean): void;
24
6
  /** Whether metrics are currently armed - the same flag `measureSync` and friends check. */
25
7
  export declare function isEditorMetricsEnabled(): boolean;
8
+ /**
9
+ * Record one editor action.
10
+ *
11
+ * Mode is always 'edit' from here - the content builder only exists in edit mode. It is
12
+ * passed explicitly rather than defaulted downstream so the call says what it means.
13
+ */
26
14
  export declare function dispatch(action: string, durationMs: number, component: string, blockType?: string): void;
27
15
  /**
28
16
  * Derive the block-type label from a GrapesJS component.
@@ -0,0 +1,106 @@
1
+ /**
2
+ * CMS5 browser metrics: what is measured, what the samples are called, and which label
3
+ * values are allowed to exist.
4
+ *
5
+ * Cortex owns the OpenTelemetry SDK, the exporter and the resource, and publishes an
6
+ * instrument factory on `window.OLTelemetry`. This module owns everything above that
7
+ * line. Only the factory crosses it, so the page runs one MeterProvider and one export
8
+ * stream however many bundles are loaded, and this repository ships no SDK of its own.
9
+ *
10
+ * The metric definitions and the label vocabularies used to live on the Cortex side, so
11
+ * that a frontend release could not introduce a new label value - and therefore new
12
+ * metric series - without a corresponding change there. They moved here because they
13
+ * describe this repository's own blocks and editor actions and went stale whenever it
14
+ * shipped without a matching Cortex change: a `cx-sb-` prefix rule once excluded fifteen
15
+ * of the twenty-one block types, including the two most common ones, so an ordinary page
16
+ * of headings and text produced no block metrics at all and simply looked idle.
17
+ *
18
+ * The bound those lists provided has moved with them, not been dropped. Every set below
19
+ * is closed, and a value outside it collapses to `unknown` rather than being dropped, so
20
+ * a missing entry shows up as a visible bucket in Grafana instead of silently
21
+ * disappearing. Adding a value here adds metric series - treat it as a change with a cost.
22
+ *
23
+ * When Cortex is older than the API, every entry point below is a no-op: the components
24
+ * behave exactly as they do with telemetry switched off.
25
+ *
26
+ * How things are *timed* lives in `./measure`; when the measurement is armed lives in
27
+ * `./index` (edit mode, the GrapesJS plugin) and `./content-render` (view mode).
28
+ */
29
+ export declare const COMPONENT_CONTENT_BUILDER = "cx-content-builder";
30
+ /** Stamped by CMS5_PageViewer_Content_VForm from the server's own edit-mode state. */
31
+ export declare const METRICS_MARKER_SELECTOR = "[data-cms5-metrics=\"true\"]";
32
+ /**
33
+ * Site-builder mode. The same page content is served in both, so without this label a
34
+ * block painted inside the editor canvas and the same block on the published page land in
35
+ * one series - and they are not the same thing. One is behind an authenticated editor
36
+ * with the builder bundle loaded; the other is what a visitor actually waits for.
37
+ */
38
+ export declare const MODE_EDIT = "edit";
39
+ export declare const MODE_VIEW = "view";
40
+ export declare const UiAction: {
41
+ readonly AddBlock: "add_block";
42
+ readonly ConfigureWorkflow: "configure_workflow";
43
+ readonly DeviceSwitch: "device_switch";
44
+ readonly DuplicateBlock: "duplicate_block";
45
+ readonly EditorBoot: "editor_boot";
46
+ readonly MoveBlock: "move_block";
47
+ readonly OpenConfig: "open_config";
48
+ readonly PickAsset: "pick_asset";
49
+ readonly PickAssetFormat: "pick_asset_format";
50
+ readonly PickDownloadFormat: "pick_download_format";
51
+ readonly Redo: "redo";
52
+ readonly RemoveBlock: "remove_block";
53
+ readonly RichTextEdit: "rich_text_edit";
54
+ readonly SaveConfig: "save_config";
55
+ readonly SelectBlock: "select_block";
56
+ readonly Undo: "undo";
57
+ };
58
+ export type UiActionName = (typeof UiAction)[keyof typeof UiAction];
59
+ /**
60
+ * Element name of every block the builder can place, mapped to its metric label.
61
+ *
62
+ * A table rather than a prefix rule, because block tags are not uniform: only six are
63
+ * named `cx-sb-*` and the rest reuse general-purpose design-system elements
64
+ * (`cx-header`, `cx-text`, `cx-gallery`, ...).
65
+ *
66
+ * The label is the GrapesJS block name, not the tag: that is the word the author sees in
67
+ * the block picker, and it survives a component being re-pointed at a different element.
68
+ * Gallery and Carousel are two picker entries backed by one element, so they necessarily
69
+ * share a label - the DOM cannot tell them apart.
70
+ */
71
+ export declare const BLOCK_TAG_LABELS: Map<string, string>;
72
+ /**
73
+ * The blocks whose render time is worth measuring on a published page: content the
74
+ * visitor is waiting for. The column containers are excluded - they resolve with the page
75
+ * itself, so timing them measures the framework rather than the content, and because one
76
+ * wraps every block they would dominate the sample.
77
+ */
78
+ export declare const CONTENT_BLOCK_TAGS: string[];
79
+ /**
80
+ * Blocks that render a placeholder and then fetch, so their Lit render completing says
81
+ * nothing about when the user actually sees content. These signal the real end instead.
82
+ */
83
+ export declare const LOADING_BLOCK_TAGS: Set<string>;
84
+ /**
85
+ * The mode the server said this page is in.
86
+ *
87
+ * Read from the stamp rather than inferred from the DOM: the editor mounts
88
+ * asynchronously, so anything guessed from the markup at load time would be a race.
89
+ */
90
+ export declare function detectMode(container?: Element | null): string;
91
+ export declare function blockLabelOf(tagName: string): string | undefined;
92
+ export declare function recordUiAction(action: string, seconds: number, component: string, mode: string, blockType?: string): void;
93
+ export declare function recordBlockRender(seconds: number, blockType: string | undefined, mode: string): void;
94
+ export declare function recordContentRender(seconds: number, mode: string): void;
95
+ export declare function countContentRenderAbandoned(mode: string): void;
96
+ /**
97
+ * Tell Cortex which mode this page is in, so its own page-level histograms carry the
98
+ * dimension too.
99
+ *
100
+ * Page load, TTFB and the web vitals are recorded by Cortex, not here, and they need the
101
+ * split as much as these metrics do: opening a page for editing boots the editor inside
102
+ * the page load, so the authoring cost lands in the published page's timings unless the
103
+ * two populations can be told apart. Cortex cannot read this itself without knowing what
104
+ * CMS5 is, which is the arrangement this module exists to avoid.
105
+ */
106
+ export declare function declarePageMode(mode: string): void;
@@ -3,19 +3,34 @@ import { FontFamily, FontTypeface } from '../../../types/src/font-picker';
3
3
 
4
4
  /**
5
5
  * Stable option value for a typeface. Uses the explicit `value` when provided,
6
- * otherwise derives a CSS-safe slug from the typeface name.
6
+ * otherwise derives a space-safe identity from the typeface name.
7
7
  */
8
8
  export declare function getTypefaceOptionValue(typeface: FontTypeface): string;
9
9
  /**
10
- * Stable, unique option value for a font-family variant.
10
+ * Stable option identity for a font-family variant, used only as the
11
+ * `cx-select` option value (never applied as CSS — the real font-family,
12
+ * weight, and style are stored separately). Built from the variant's
13
+ * identifying fields — the CSS `value` (or `name` when it is absent) plus
14
+ * `fontStyle` and `fontWeight` — made space-safe.
11
15
  *
12
- * `value` is the CSS font-family to apply and is only usable as the option
13
- * identity when it uniquely identifies the variant. Some APIs return the same
14
- * `value` for every variant of a typeface (e.g. all "Lato" variants share
15
- * `value: "Lato"` and differ only by name/weight/style) — in that case the
16
- * value can't be the selector identity, so fall back to a name-based slug.
16
+ * Two variants that are identical in all of those fields collide by design;
17
+ * that is a backend data problem, not something the picker resolves.
17
18
  */
18
- export declare function getFontFamilyOptionValue(fontFamily: FontFamily, fontFamilies: FontFamily[]): string;
19
+ export declare function getFontFamilyOptionValue(fontFamily: FontFamily): string;
20
+ /**
21
+ * Quotes a CSS font-family that contains spaces (e.g. `Custom Font 2`) so it
22
+ * stays valid wherever it is substituted into a `font-family` declaration.
23
+ * Names without spaces are already valid identifiers (including generic
24
+ * keywords like `sans-serif`) and are left as-is; an already-quoted value is
25
+ * returned unchanged. Any backslash or single quote inside the name is escaped
26
+ * so a name like `O'Reilly Sans` still produces a valid quoted string.
27
+ */
28
+ export declare function quoteFontFamily(fontFamily: string): string;
29
+ /**
30
+ * Strips one pair of surrounding quotes and unescapes the content so a stored
31
+ * value matches raw names. Inverse of `quoteFontFamily`.
32
+ */
33
+ export declare function unquoteFontFamily(fontFamily: string): string;
19
34
  /**
20
35
  * Test if a specific font configuration is available using a test element
21
36
  */