@orangelogic/design-system 3.15.0 → 3.16.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.
@@ -85,7 +85,7 @@ import { default as it } from "./visually-hidden.js";
85
85
  import { fontAwesomeIconNames as mt, getAnimationNames as pt, getEasingNames as ft } from "./atoms.js";
86
86
  import { c as Ct } from "../chunks/component.styles.CAS3c9pM.js";
87
87
  import { g as ut, a as ct, s as gt } from "../chunks/animation-registry.HmpwNuGH.js";
88
- import { s as At, u as It, Y as St, v as Dt, n as bt, C as ht, m as yt, $ as Ft, a0 as Et, a1 as Pt, a3 as Rt, a2 as Lt, a4 as vt, a5 as Vt, a6 as Bt, a7 as Mt, a8 as Ot, l as wt, Z as kt, w as Gt, _ as _t, x as Nt, y as Ht, z as Ut, k as Xt, a9 as zt, B as Wt, E as Kt, G as qt, H as jt, aa as Yt, j as Qt, J as Zt, K as Jt, h as $t, V as ao, W as eo, ab as to, f as oo, L as ro, M as so, N as xo, P as io, Q as lo, R as mo, ac as po, ad as fo, T as no, U as Co, ae as uo, af as co, e as go, X as To, ag as Ao, ah as Io } from "../chunks/types.Bc8Tgozj.js";
88
+ import { s as At, u as It, Y as St, v as Dt, n as bt, C as ht, m as yt, $ as Ft, a0 as Et, a1 as Pt, a3 as Rt, a2 as Lt, a4 as vt, a5 as Vt, a6 as Bt, a7 as Mt, a8 as Ot, l as wt, Z as kt, w as Gt, _ as _t, x as Nt, y as Ht, z as Ut, k as Xt, a9 as zt, B as Wt, E as Kt, G as qt, H as jt, aa as Yt, j as Qt, J as Zt, K as Jt, h as $t, V as ao, W as eo, ab as to, f as oo, L as ro, M as so, N as xo, P as io, Q as lo, R as mo, ac as po, ad as fo, T as no, U as Co, ae as uo, af as co, e as go, X as To, ag as Ao, ah as Io } from "../chunks/types.C7C66KUV.js";
89
89
  import { default as Do } from "./bicolor-picker.js";
90
90
  import { default as ho } from "./border-input-group.js";
91
91
  import { C as Fo } from "../chunks/color-swatch.DxxOpJXT.js";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "3.15.0",
4
+ "version": "3.16.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -0,0 +1,13 @@
1
+ export type CxCommentTaskMentionSelectEvent = CustomEvent<{
2
+ value: {
3
+ id: string;
4
+ label: string;
5
+ title?: string;
6
+ type?: string;
7
+ };
8
+ }>;
9
+ declare global {
10
+ interface GlobalEventHandlersEventMap {
11
+ 'cx-comment-task-mention-select': CxCommentTaskMentionSelectEvent;
12
+ }
13
+ }
@@ -48,6 +48,7 @@ export * from './cx-column-resizable-change';
48
48
  export * from './cx-column-scroll';
49
49
  export * from './cx-columns-display-change';
50
50
  export * from './cx-comment-mention-select';
51
+ export * from './cx-comment-task-mention-select';
51
52
  export * from './cx-connect';
52
53
  export * from './cx-connected';
53
54
  export * from './cx-content-builder-gallery-change';
@@ -24,6 +24,7 @@ declare global {
24
24
  * @description Replaces Cortex's current SSR comment and allows rich text editing thanks to the migration of Tiptap.
25
25
  *
26
26
  * @event {{ content: string }} cx-comment-change - Emitted when the editor's content changes.
27
+ * @event {{ value: { id: string, label: string, title?: string, type?: string } }} cx-comment-task-mention-select - Emitted when a task mention is selected from the task suggestion dropdown (triggered by `task-trigger-char`, `#` by default).
27
28
  * @event cx-recording-started - Emitted when the screen recorder has started.
28
29
  * @event cx-recording-stopped - Emitted when the screen recorder has stopped.
29
30
  * @event {{ error: Error }} cx-recording-error - Emitted when the screen recorder has error.
@@ -57,6 +58,47 @@ export default class CxComment extends CortexElement {
57
58
  filterName: string;
58
59
  serviceName: string;
59
60
  autocompletionViewstate: string;
61
+ /**
62
+ * Query module name for the task mention autocomplete. Task mentions
63
+ * (and task permalink paste conversion) stay disabled while unset.
64
+ */
65
+ taskQueryName: string;
66
+ /**
67
+ * Filter module name for the task mention autocomplete.
68
+ */
69
+ taskFilterName: string;
70
+ /**
71
+ * Optional filter module name used only to resolve pasted task permalinks,
72
+ * expected to match the pasted identifier exactly (unlike `task-filter-name`,
73
+ * whose fuzzy conditions also match title substrings). While unset, paste
74
+ * resolution runs through `task-filter-name` and keeps only an exact
75
+ * identifier match from its results.
76
+ */
77
+ taskPasteFilterName: string;
78
+ /**
79
+ * Minimum query length for the task mention autocomplete. Defaults to 0
80
+ * so suggestions show as soon as the trigger character is typed.
81
+ */
82
+ taskMinQueryLength: number;
83
+ /**
84
+ * The character that triggers the task mention autocomplete. Defaults
85
+ * to `#`.
86
+ */
87
+ taskTriggerChar: string;
88
+ /**
89
+ * Format of the task mention chip text while composing, with `[IDENTIFIER]`
90
+ * and `[TITLE]` placeholders — the same template the host uses for the
91
+ * rendered mention links. Display-only: the mention is stored as the
92
+ * identifier alone, so the title never enters the saved comment body.
93
+ */
94
+ taskLabelTemplate: string;
95
+ /**
96
+ * Regex source (case-insensitive, capture group 1 = identifier) matched
97
+ * against pasted same-origin URL paths to detect task links. Provided by
98
+ * the host, derived from the site's task URL template. While unset, only
99
+ * legacy `?TID={id}` links are detected on paste.
100
+ */
101
+ taskUrlPattern: string;
60
102
  maxCount: number;
61
103
  queryDelay: number;
62
104
  minQueryLength: number;
@@ -82,16 +124,46 @@ export default class CxComment extends CortexElement {
82
124
  private handleCopy;
83
125
  private fetchAutocompleteItems;
84
126
  getMentionItems(queryString: string): Promise<AutocompleteItem[]>;
127
+ getTaskMentionItems(queryString: string, filterName?: string): Promise<AutocompleteItem[]>;
85
128
  resetMention(): void;
86
129
  protected handleMenuItemClick(): void;
87
130
  private handleFullscreenClick;
88
131
  toggleFullscreen(): void;
132
+ /**
133
+ * Both mention kinds debounce their autocomplete identically; only the
134
+ * items getter differs. Kept as field initializers so the debounce wait
135
+ * captures `queryDelay` at construction time, exactly like the previous
136
+ * inline `_debounce` fields did.
137
+ */
138
+ private createDebouncedMentionFetch;
89
139
  private readonly debouncedFetch;
140
+ private readonly debouncedTaskFetch;
90
141
  private fetchItems;
142
+ private fetchTaskItems;
91
143
  private handleMentionSelect;
144
+ /**
145
+ * Shared activation for both suggestion kinds: anchors the shared
146
+ * cx-mentions popup on the suggestion decoration and wires selection.
147
+ * `resetAnchor` re-anchors even when an anchor is already set (contact
148
+ * mention start); the other paths keep the existing anchor (`??=`) so the
149
+ * popup does not jump while typing, relying on `onExit` → `resetMention`
150
+ * to clear it between suggestions.
151
+ */
152
+ private activateMention;
92
153
  private handleMentionStart;
93
154
  private handleMentionUpdate;
155
+ private handleTaskMentionActivate;
94
156
  private handleMentionKeyDown;
157
+ /**
158
+ * The task mention extension is created per editor init (not in the static
159
+ * `extensions` field) so its options read the host-applied properties
160
+ * (trigger char, label template, URL pattern). It is always registered —
161
+ * keeping the node in the schema means stored task mentions round-trip
162
+ * unchanged even where the feature is off — while suggestions and paste
163
+ * conversion stay inert until the host opts in via `task-query-name`.
164
+ */
165
+ private getTaskMentionExtension;
166
+ private getEditorExtensions;
95
167
  private initEditor;
96
168
  /**
97
169
  * First init must happen here: on Cortex ajax refresh the element renders while
@@ -0,0 +1,77 @@
1
+ import { PluginKey } from '@tiptap/pm/state';
2
+ import { MentionNodeAttrs, MentionOptions } from '../mention';
3
+
4
+ export interface TaskMentionNodeAttrs extends MentionNodeAttrs {
5
+ /**
6
+ * Snapshot of the task title at insertion time, stored as a `data-title`
7
+ * attribute. Display-time rendering resolves the current title server-side;
8
+ * this is only a fallback for plain-text contexts.
9
+ */
10
+ title?: string | null;
11
+ }
12
+ /**
13
+ * A task reference resolved from a pasted permalink.
14
+ */
15
+ export interface ResolvedTaskMention {
16
+ id: string;
17
+ label: string;
18
+ title?: string;
19
+ }
20
+ export type TaskMentionOptions = MentionOptions<any, TaskMentionNodeAttrs> & {
21
+ /**
22
+ * Format of the chip text shown while composing, with `[IDENTIFIER]` and
23
+ * `[TITLE]` placeholders (mirrors the server's TaskMentionLinkTextTemplate,
24
+ * which formats the rendered mention links the same way). Mentions without
25
+ * a title always show the identifier alone. Display-only: the mention
26
+ * serializes as `{char}{identifier}` regardless of this option, so the
27
+ * title never becomes part of the stored comment body.
28
+ */
29
+ labelTemplate?: string;
30
+ /**
31
+ * Resolves a task identifier extracted from a pasted permalink into a
32
+ * mention item. Return `null` when the identifier matches no task; the
33
+ * pasted text is then left untouched (rendered as a plain link).
34
+ * URL paste conversion is disabled while this is unset.
35
+ */
36
+ resolveTaskUrl?: (identifier: string) => Promise<ResolvedTaskMention | null>;
37
+ /**
38
+ * Site-specific regex source, matched case-insensitively against a pasted
39
+ * same-origin URL's path, with the task identifier as capture group 1.
40
+ * Derived server-side from the site's task URL template so paste detection
41
+ * always follows it. Path-based detection is disabled while unset — only
42
+ * legacy `?TID={id}` links are recognized then.
43
+ */
44
+ urlPattern?: string;
45
+ };
46
+ /**
47
+ * The plugin key for the task mention plugin.
48
+ */
49
+ export declare const TaskMentionPluginKey: PluginKey<any>;
50
+ /**
51
+ * The chip text shown in the editor for a task mention: the trigger character
52
+ * followed by the label template with `[IDENTIFIER]`/`[TITLE]` filled in, or
53
+ * by the identifier alone when the mention has no title.
54
+ */
55
+ export declare function formatTaskMentionText(char: string, labelTemplate: string | undefined, identifier: string, title: string | null | undefined): string;
56
+ /**
57
+ * Extracts a task identifier from a task permalink pointing at `currentOrigin`.
58
+ * Path detection follows `sitePattern` (the site's task URL template, compiled
59
+ * by `compileTaskUrlPattern`); legacy `?TID={identifier}` links are always
60
+ * recognized. Returns `null` for anything else (foreign origins, non-task
61
+ * paths, plain text).
62
+ */
63
+ export declare function findTaskIdentifierInUrl(text: string, currentOrigin: string, sitePattern?: RegExp | null): string | null;
64
+ /**
65
+ * Compiles the site-specific URL pattern, or returns `null` when unset or
66
+ * invalid (path-based paste detection then stays disabled).
67
+ */
68
+ export declare function compileTaskUrlPattern(patternSource: string | undefined): RegExp | null;
69
+ /**
70
+ * This extension inserts references to other tasks into the editor — the task
71
+ * counterpart of the contact `Mention` extension. Stored as `span.task-mention`
72
+ * so the contact-mention parsers never touch it.
73
+ * Also converts pasted task permalinks into task mentions when
74
+ * `resolveTaskUrl` is configured; the pasted URL is matched against the
75
+ * site-provided `urlPattern` (or a legacy `?TID={id}` parameter).
76
+ */
77
+ export declare const TaskMention: import('@tiptap/core').Node<TaskMentionOptions, any>;
@@ -7774,6 +7774,34 @@
7774
7774
  *
7775
7775
  */
7776
7776
  autocompletionViewstate?: string;
7777
+ /**
7778
+ * Query module name for the task mention autocomplete. Task mentions (and task permalink paste conversion) stay disabled while unset.
7779
+ */
7780
+ taskQueryName?: string;
7781
+ /**
7782
+ * Filter module name for the task mention autocomplete.
7783
+ */
7784
+ taskFilterName?: string;
7785
+ /**
7786
+ * Optional filter module name used only to resolve pasted task permalinks, expected to match the pasted identifier exactly (unlike `task-filter-name`, whose fuzzy conditions also match title substrings). While unset, paste resolution runs through `task-filter-name` and keeps only an exact identifier match from its results.
7787
+ */
7788
+ taskPasteFilterName?: string;
7789
+ /**
7790
+ * Minimum query length for the task mention autocomplete. Defaults to 0 so suggestions show as soon as the trigger character is typed.
7791
+ */
7792
+ taskMinQueryLength?: number;
7793
+ /**
7794
+ * The character that triggers the task mention autocomplete. Defaults to `#`.
7795
+ */
7796
+ taskTriggerChar?: string;
7797
+ /**
7798
+ * Format of the task mention chip text while composing, with `[IDENTIFIER]` and `[TITLE]` placeholders — the same template the host uses for the rendered mention links. Display-only: the mention is stored as the identifier alone, so the title never enters the saved comment body.
7799
+ */
7800
+ taskLabelTemplate?: string;
7801
+ /**
7802
+ * Regex source (case-insensitive, capture group 1 = identifier) matched against pasted same-origin URL paths to detect task links. Provided by the host, derived from the site's task URL template. While unset, only legacy `?TID={id}` links are detected on paste.
7803
+ */
7804
+ taskUrlPattern?: string;
7777
7805
  /**
7778
7806
  *
7779
7807
  */
@@ -7904,6 +7932,34 @@
7904
7932
  *
7905
7933
  */
7906
7934
  autocompletionViewstate?: string;
7935
+ /**
7936
+ * Query module name for the task mention autocomplete. Task mentions (and task permalink paste conversion) stay disabled while unset.
7937
+ */
7938
+ taskQueryName?: string;
7939
+ /**
7940
+ * Filter module name for the task mention autocomplete.
7941
+ */
7942
+ taskFilterName?: string;
7943
+ /**
7944
+ * Optional filter module name used only to resolve pasted task permalinks, expected to match the pasted identifier exactly (unlike `task-filter-name`, whose fuzzy conditions also match title substrings). While unset, paste resolution runs through `task-filter-name` and keeps only an exact identifier match from its results.
7945
+ */
7946
+ taskPasteFilterName?: string;
7947
+ /**
7948
+ * Minimum query length for the task mention autocomplete. Defaults to 0 so suggestions show as soon as the trigger character is typed.
7949
+ */
7950
+ taskMinQueryLength?: number;
7951
+ /**
7952
+ * The character that triggers the task mention autocomplete. Defaults to `#`.
7953
+ */
7954
+ taskTriggerChar?: string;
7955
+ /**
7956
+ * Format of the task mention chip text while composing, with `[IDENTIFIER]` and `[TITLE]` placeholders — the same template the host uses for the rendered mention links. Display-only: the mention is stored as the identifier alone, so the title never enters the saved comment body.
7957
+ */
7958
+ taskLabelTemplate?: string;
7959
+ /**
7960
+ * Regex source (case-insensitive, capture group 1 = identifier) matched against pasted same-origin URL paths to detect task links. Provided by the host, derived from the site's task URL template. While unset, only legacy `?TID={id}` links are detected on paste.
7961
+ */
7962
+ taskUrlPattern?: string;
7907
7963
  /**
7908
7964
  *
7909
7965
  */
@@ -9240,6 +9296,34 @@
9240
9296
  *
9241
9297
  */
9242
9298
  autocompletionViewstate?: string;
9299
+ /**
9300
+ * Query module name for the task mention autocomplete. Task mentions (and task permalink paste conversion) stay disabled while unset.
9301
+ */
9302
+ taskQueryName?: string;
9303
+ /**
9304
+ * Filter module name for the task mention autocomplete.
9305
+ */
9306
+ taskFilterName?: string;
9307
+ /**
9308
+ * Optional filter module name used only to resolve pasted task permalinks, expected to match the pasted identifier exactly (unlike `task-filter-name`, whose fuzzy conditions also match title substrings). While unset, paste resolution runs through `task-filter-name` and keeps only an exact identifier match from its results.
9309
+ */
9310
+ taskPasteFilterName?: string;
9311
+ /**
9312
+ * Minimum query length for the task mention autocomplete. Defaults to 0 so suggestions show as soon as the trigger character is typed.
9313
+ */
9314
+ taskMinQueryLength?: number;
9315
+ /**
9316
+ * The character that triggers the task mention autocomplete. Defaults to `#`.
9317
+ */
9318
+ taskTriggerChar?: string;
9319
+ /**
9320
+ * Format of the task mention chip text while composing, with `[IDENTIFIER]` and `[TITLE]` placeholders — the same template the host uses for the rendered mention links. Display-only: the mention is stored as the identifier alone, so the title never enters the saved comment body.
9321
+ */
9322
+ taskLabelTemplate?: string;
9323
+ /**
9324
+ * Regex source (case-insensitive, capture group 1 = identifier) matched against pasted same-origin URL paths to detect task links. Provided by the host, derived from the site's task URL template. While unset, only legacy `?TID={id}` links are detected on paste.
9325
+ */
9326
+ taskUrlPattern?: string;
9243
9327
  /**
9244
9328
  *
9245
9329
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "3.15.0",
4
+ "version": "3.16.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {