@myrmidon/cadmus-text-segment 0.0.0-stage → 0.0.2
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"myrmidon-cadmus-text-segment.mjs","names":["sameIds","WS_REGEX"],"sources":["../../../../projects/myrmidon/cadmus-text-segment/src/lib/models.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/utils/tip-template.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/utils/selection-range.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/utils/segment-finder.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/services/text-measure.service.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/services/segmented-text-store.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/services/spaced-text-segmenter.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/components/text-segment-view/text-segment-view.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/components/text-segment-view/text-segment-view.html","../../../../projects/myrmidon/cadmus-text-segment/src/lib/components/text-segment-block-view/text-segment-block-view.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/components/text-segment-block-view/text-segment-block-view.html","../../../../projects/myrmidon/cadmus-text-segment/src/lib/components/segmented-text-view/segmented-text-view.ts","../../../../projects/myrmidon/cadmus-text-segment/src/lib/components/segmented-text-view/segmented-text-view.html"],"sourcesContent":["import { InjectionToken, InputSignal, Type } from '@angular/core';\n\n/**\n * The selection mode of a text segment:\n * - `allowed`: a selection can start or end at this segment (default).\n * - `wrapped`: a selection cannot start or end at this segment, but it can\n * include it when it starts before and ends after it (e.g. a space between\n * two words).\n * - `attached`: like `wrapped`, but the segment is glued to the segment\n * preceding it: whenever that segment is at the end of a selection, all the\n * attached segments following it are included too; and a selection starting\n * at an attached segment starts from its base instead (e.g. a Unicode\n * combining diacritic following its base letter).\n * - `blocked`: no selection can start, end, or cross this segment: when\n * dragging or extending a selection, the selection stops before it.\n */\nexport type TextSegmentSelectionMode =\n | 'allowed'\n | 'wrapped'\n | 'attached'\n | 'blocked';\n\n/**\n * An arbitrarily defined segment of a text. Segments are pure data: they\n * never carry any view state (selection, search results, etc.), which is\n * kept by the viewer, so that a segment object is never mutated once\n * created and can be safely shared and compared by identity.\n */\nexport interface TextSegment<T = unknown> {\n /**\n * Arbitrary numeric ID, unique in the whole segmented text.\n */\n id: number;\n /**\n * The ordinal position of the segment, as defined by the segmentation\n * logic (e.g. the index of a character in the source text). This is\n * informative only: the viewer orders segments by their position in\n * blocks, and there can be holes in this numeric sequence (e.g. when\n * skipping CR+LF).\n */\n index: number;\n /**\n * The text value of the segment. This is what is searched by the finder.\n */\n value: string;\n /**\n * The text to display for the segment, falling back to `value` if not set.\n */\n label?: string;\n /**\n * An optional precomputed tip for the segment, used when the settings do\n * not define a tip template or function.\n */\n tip?: string;\n /**\n * An optional data object attached to the segment. All the segments in a\n * text have the same payload type.\n */\n payload?: T;\n /**\n * The selection mode for this segment. Default is `allowed`.\n */\n selectionMode?: TextSegmentSelectionMode;\n /**\n * The fill color of the segment's text box, overriding the default color\n * from settings. When the segment is selected or is a search result, this\n * is temporarily replaced by the corresponding color from settings.\n */\n color?: string;\n /**\n * The color of the segment's text box text, overriding the default text\n * color from settings.\n */\n textColor?: string;\n /**\n * The color of the segment's text box border, overriding the default\n * border color from settings. Segmentation logic can use it to visually\n * represent additional metadata.\n */\n borderColor?: string;\n /**\n * Optional CSS class(es) to add to the segment view's host element.\n */\n cssClass?: string;\n}\n\n/**\n * A block (e.g. a paragraph or a line) of text segments.\n */\nexport interface TextSegmentBlock<T = unknown> {\n /**\n * The index of the block in the text (0-N).\n */\n index: number;\n /**\n * The segments in the block, in their display order.\n */\n segments: TextSegment<T>[];\n}\n\n/**\n * The position of a segment tip.\n */\nexport type TextSegmentTipPosition = 'below' | 'popup';\n\n/**\n * How the segments of a block wrap to the next line when they do not fit\n * the available width:\n * - `segment`: the line can wrap after any segment (default).\n * - `word`: the line wraps only after a whitespace segment (i.e. a segment\n * whose value is entirely whitespace), so that the segments between two\n * whitespaces (e.g. the characters of a word) stay together, like in\n * normal text. A run of segments wider than the whole line still wraps\n * after any segment.\n */\nexport type TextSegmentWrapMode = 'segment' | 'word';\n\n/**\n * The contract of a component used to render the tip of a segment via\n * the `tipComponent` setting. The component gets the segment bound to its\n * `segment` input.\n */\nexport interface TextSegmentTipComponent<T = unknown> {\n segment: InputSignal<TextSegment<T> | undefined>;\n}\n\n/**\n * Display settings for a segmented text view. Colors can be any CSS color\n * value, including CSS variables like the Angular Material M3 tokens\n * (`var(--mat-sys-...)`), which are used by default so that the view\n * follows the application theme (and its dark mode).\n */\nexport interface SegmentedTextSettings {\n // ── layout ──────────────────────────────────────────────────────────────\n /** The horizontal gap (px) between two segments in the same block. */\n segmentOffset: number;\n /** The vertical gap (px) between two wrapped lines in the same block. */\n lineOffset: number;\n /** The vertical gap (px) between two blocks. */\n blockOffset: number;\n /** True to show the block number (=index+1) before each block. */\n showBlockNumbers?: boolean;\n /**\n * How segments wrap to the next line (default `segment`): see\n * `TextSegmentWrapMode`.\n */\n wrapMode?: TextSegmentWrapMode;\n\n // ── optional boxes ──────────────────────────────────────────────────────\n /** True to show the ID box in each segment view. */\n showIdBox?: boolean;\n /** True to show the index box in each segment view. */\n showIndexBox?: boolean;\n /** True to show the tip (below each segment or as a popup). */\n showTipBox?: boolean;\n\n // ── colors ──────────────────────────────────────────────────────────────\n /** Default fill color of the text box. */\n color: string;\n /** Default text color of the text box. */\n textColor: string;\n /** Default border color of the text box. */\n borderColor: string;\n /** Fill color of a selected segment. */\n selectionColor: string;\n /** Text color of a selected segment. */\n selectionTextColor: string;\n /** Fill color of a segment matching the current search. */\n resultColor: string;\n /** Text color of a segment matching the current search. */\n resultTextColor: string;\n /** Color of the outline drawn around the segment with the caret. */\n caretColor: string;\n\n // ── text box ────────────────────────────────────────────────────────────\n /** Font family of the text box text. */\n fontFace: string;\n /** Font size of the text box text (any CSS font-size, e.g. `16px`). */\n fontSize: string;\n /** Text box height (px). Its width fits the text. */\n textRectHeight: number;\n /**\n * Text box minimum width (px). When > 0 it forces a segment to be\n * visible even with a text like a space.\n */\n textRectMinWidth?: number;\n /** Horizontal padding (px) between the text and its box border. */\n textRectPadding?: number;\n /** Corner radius (px) of the boxes. */\n textRectRadius?: number;\n /** Border stroke width (px) of the text box. */\n textRectStrokeWidth?: number;\n /** Border stroke dash array of the text box (e.g. `4 2`). */\n textRectStrokeDasharray?: string;\n\n // ── ID and index boxes ──────────────────────────────────────────────────\n /** Font family of the ID and index boxes. */\n infoFontFace: string;\n /** Font size of the ID and index boxes. */\n infoFontSize: string;\n /** Height (px) of the ID and index boxes. */\n infoRectHeight: number;\n\n // ── tip ─────────────────────────────────────────────────────────────────\n /** Font family of the tip. */\n tipFontFace: string;\n /** Font size of the tip. */\n tipFontSize: string;\n /** Height (px) of the tip box when below (its width is the segment's). */\n tipRectHeight: number;\n /**\n * Template string for the tip, with placeholders in `{{...}}`. Each\n * placeholder is a dot-separated path into the segment's payload (e.g.\n * `{{uni.category}}`), or one of `$id`, `$index`, `$value`, `$label`\n * for the segment's own properties. Unresolved placeholders are removed.\n */\n tipTemplate?: string;\n /**\n * Function returning the tip for a segment. When set, it overrides\n * `tipTemplate`.\n */\n tipFn?: (segment: TextSegment<any>) => string | null | undefined;\n /**\n * A component to render the tip instead of text, for a fully custom\n * visualization. It must declare a `segment` input (see\n * `TextSegmentTipComponent`). When set, it overrides both `tipFn` and\n * `tipTemplate`.\n */\n tipComponent?: Type<unknown>;\n /**\n * Max length in characters of a textual tip: text beyond it is replaced\n * by a trailing ellipsis.\n */\n tipMaxLength?: number;\n /** Whether to display the tip below the segment or as a popup on hover. */\n tipPosition: TextSegmentTipPosition;\n}\n\n/**\n * The default settings for a segmented text view, used for any setting\n * which is not explicitly provided.\n */\nexport const DEFAULT_SEGMENTED_TEXT_SETTINGS: Readonly<SegmentedTextSettings> =\n Object.freeze({\n segmentOffset: 2,\n lineOffset: 6,\n blockOffset: 12,\n showBlockNumbers: true,\n wrapMode: 'segment',\n showIdBox: false,\n showIndexBox: false,\n showTipBox: false,\n color: 'var(--mat-sys-surface-container-low)',\n textColor: 'var(--mat-sys-on-surface)',\n borderColor: 'var(--mat-sys-outline-variant)',\n selectionColor: 'var(--mat-sys-primary)',\n selectionTextColor: 'var(--mat-sys-on-primary)',\n resultColor: 'var(--mat-sys-tertiary-container)',\n resultTextColor: 'var(--mat-sys-on-tertiary-container)',\n caretColor: 'var(--mat-sys-primary)',\n fontFace: \"Roboto, 'Helvetica Neue', Arial, sans-serif\",\n fontSize: '18px',\n textRectHeight: 28,\n textRectMinWidth: 10,\n textRectPadding: 3,\n textRectRadius: 4,\n textRectStrokeWidth: 1,\n infoFontFace: \"'Roboto Mono', Consolas, monospace\",\n infoFontSize: '10px',\n infoRectHeight: 14,\n tipFontFace: \"Roboto, 'Helvetica Neue', Arial, sans-serif\",\n tipFontSize: '10px',\n tipRectHeight: 14,\n tipMaxLength: 30,\n tipPosition: 'popup',\n });\n\n/**\n * Merge the specified partial settings with the default ones.\n */\nexport function resolveSegmentedTextSettings(\n settings?: Partial<SegmentedTextSettings> | null,\n): SegmentedTextSettings {\n if (!settings) {\n return DEFAULT_SEGMENTED_TEXT_SETTINGS;\n }\n const resolved = { ...DEFAULT_SEGMENTED_TEXT_SETTINGS } as Record<\n string,\n unknown\n >;\n // undefined values do not override defaults\n for (const [key, value] of Object.entries(settings)) {\n if (value !== undefined) {\n resolved[key] = value;\n }\n }\n return resolved as unknown as SegmentedTextSettings;\n}\n\n/**\n * A segmented text with its optional display settings. This is just a\n * convenience container for transferring both data and settings.\n */\nexport interface SegmentedText<T = unknown> {\n blocks: TextSegmentBlock<T>[];\n settings?: Partial<SegmentedTextSettings>;\n}\n\n/**\n * Interface implemented by text segmenters. A segmenter contains the whole\n * segmentation logic, which is completely external to the viewer: it builds\n * blocks of segments from a text, and maps selections to and from\n * coordinates expressed in its own syntax.\n */\nexport interface TextSegmenter<T = unknown> {\n /**\n * Get blocks of segments from the specified text.\n */\n getBlocks(text?: string): TextSegmentBlock<T>[];\n\n /**\n * Get the coordinates of the specified segments.\n * @param blocks The blocks of the whole text, providing the context\n * required to calculate coordinates.\n * @param segments The segments (usually the selected ones), in their\n * text order.\n * @returns The coordinates, or an empty string if there are no\n * coordinates for the specified segments.\n */\n getSegmentCoords(\n blocks: readonly TextSegmentBlock<T>[],\n segments: readonly TextSegment<T>[],\n ): string;\n\n /**\n * Get the segments included by the specified coordinates.\n * @param blocks The blocks of the whole text.\n * @param coords The coordinates.\n * @returns The segments in their text order, or null if the coordinates\n * are not valid.\n */\n getCoordsSegments(\n blocks: readonly TextSegmentBlock<T>[],\n coords: string,\n ): TextSegment<T>[] | null;\n}\n\n/**\n * Injection token for an optional text segmenter used by the segmented text\n * view for coordinates. The view's `segmenter` input, when set, takes\n * precedence over it.\n */\nexport const TEXT_SEGMENTER = new InjectionToken<TextSegmenter<any>>(\n 'TEXT_SEGMENTER',\n);\n\n/**\n * The selection of a segmented text view, as emitted by it.\n */\nexport interface TextSegmentSelection<T = unknown> {\n /** The IDs of the selected segments, in their text order. */\n ids: number[];\n /** The selected segments, in their text order. */\n segments: TextSegment<T>[];\n /**\n * The coordinates of the selection, when a segmenter is available and\n * the selection is not empty.\n */\n coords?: string;\n}\n\n/**\n * A click on a segment, as emitted by a segmented text view. This is\n * emitted for any segment, whatever its selection mode: so it is the only\n * way for a consumer to know that the user clicked a segment which cannot\n * be selected (e.g. a `blocked` segment representing an existing\n * annotation, which the consumer may want to pick for editing).\n */\nexport interface TextSegmentClick<T = unknown> {\n /** The clicked segment. */\n segment: TextSegment<T>;\n /** The pointer event which completed the click. */\n event: PointerEvent;\n}\n\n/**\n * Options for finding text in segments.\n */\nexport interface TextSegmentFindOptions {\n /** The text to find. Empty means no search. */\n query: string;\n /**\n * True to find text across segment boundaries (concatenating the values\n * of all the segments in each block); false to find text inside each\n * single segment value.\n */\n crossSegments: boolean;\n /** True for a case-sensitive search. */\n caseSensitive: boolean;\n}\n","import { SegmentedTextSettings, TextSegment } from '../models';\n\nconst PLACEHOLDER_REGEX = /\\{\\{\\s*([^{}]+?)\\s*\\}\\}/g;\n\n/**\n * Resolve a dot-separated path in the specified object.\n * @param obj The object.\n * @param path The path, e.g. `uni.category` or `tags.0`.\n * @returns The value, or undefined if not found.\n */\nexport function resolvePath(obj: unknown, path: string): unknown {\n let current: unknown = obj;\n for (const step of path.split('.')) {\n if (current === null || current === undefined) {\n return undefined;\n }\n if (typeof current !== 'object' && typeof current !== 'function') {\n return undefined;\n }\n current = (current as Record<string, unknown>)[step];\n }\n return current;\n}\n\nfunction valueToString(value: unknown): string {\n if (value === null || value === undefined) {\n return '';\n }\n if (typeof value === 'object') {\n try {\n return JSON.stringify(value);\n } catch {\n return '';\n }\n }\n return String(value);\n}\n\n/**\n * Fill a tip template with data from a segment. Each placeholder in `{{...}}`\n * is a dot-separated path into the segment's payload, or one of `$id`,\n * `$index`, `$value`, `$label` for the segment's own properties. Unresolved\n * placeholders are replaced with an empty string, and the result is trimmed.\n * @param template The template, e.g. `cat.='{{uni.category}}'`.\n * @param segment The segment.\n * @returns The filled template.\n */\nexport function fillTipTemplate(\n template: string,\n segment: TextSegment<unknown>,\n): string {\n return template\n .replace(PLACEHOLDER_REGEX, (_, path: string) => {\n switch (path) {\n case '$id':\n return String(segment.id);\n case '$index':\n return String(segment.index);\n case '$value':\n return segment.value;\n case '$label':\n return segment.label ?? segment.value;\n default:\n return valueToString(resolvePath(segment.payload, path));\n }\n })\n .trim();\n}\n\n/**\n * Truncate the specified text to the specified max length, appending an\n * ellipsis when truncated.\n */\nexport function truncateText(text: string, maxLength?: number): string {\n if (!maxLength || maxLength < 1 || text.length <= maxLength) {\n return text;\n }\n return text.substring(0, maxLength) + '…';\n}\n\n/**\n * Get the textual tip for a segment according to the specified settings:\n * `tipFn` wins over `tipTemplate`, which wins over the segment's own `tip`.\n * The result is truncated according to `tipMaxLength`.\n * @returns The tip, or an empty string if none.\n */\nexport function resolveSegmentTip(\n segment: TextSegment<unknown>,\n settings: Pick<\n SegmentedTextSettings,\n 'tipFn' | 'tipTemplate' | 'tipMaxLength'\n >,\n): string {\n let tip: string | null | undefined;\n if (settings.tipFn) {\n tip = settings.tipFn(segment);\n } else if (settings.tipTemplate) {\n tip = fillTipTemplate(settings.tipTemplate, segment);\n } else {\n tip = segment.tip;\n }\n return tip ? truncateText(tip, settings.tipMaxLength) : '';\n}\n","import { TextSegment, TextSegmentSelectionMode } from '../models';\n\n/**\n * A range of positions (inclusive) in the flat list of all the segments of\n * a text.\n */\nexport interface SegmentRange {\n start: number;\n end: number;\n}\n\ntype ModeSource = readonly Pick<TextSegment<unknown>, 'selectionMode'>[];\n\nfunction modeAt(segments: ModeSource, pos: number): TextSegmentSelectionMode {\n return segments[pos]?.selectionMode ?? 'allowed';\n}\n\n/**\n * True if the segment at the specified position is attached to an allowed\n * base segment, i.e. it can be the last segment of a selection.\n */\nfunction isAttachedToAllowed(segments: ModeSource, pos: number): boolean {\n let p = pos;\n while (p >= 0 && modeAt(segments, p) === 'attached') {\n p--;\n }\n return p >= 0 && modeAt(segments, p) === 'allowed';\n}\n\n/**\n * Clamp a focus position so that walking from the anchor to it never\n * crosses a `blocked` segment.\n * @returns The farthest position reachable from the anchor towards the\n * focus, or the anchor itself.\n */\nexport function clampFocus(\n segments: ModeSource,\n anchor: number,\n focus: number,\n): number {\n focus = Math.max(0, Math.min(segments.length - 1, focus));\n const dir = focus >= anchor ? 1 : -1;\n let reached = anchor;\n for (let p = anchor + dir; dir > 0 ? p <= focus : p >= focus; p += dir) {\n if (modeAt(segments, p) === 'blocked') {\n break;\n }\n reached = p;\n }\n return reached;\n}\n\n/**\n * Resolve the range of segments selected by dragging (or extending) from an\n * anchor position to a focus position, according to the selection mode of\n * each segment:\n * - the range never crosses a `blocked` segment: it stops before it, and\n * if the anchor itself is blocked there is no selection;\n * - a range starting at an `attached` segment starts at its base instead,\n * and a range ending at a segment followed by attached segments includes\n * them;\n * - the range is trimmed so that it starts at an `allowed` segment and ends\n * at an `allowed` segment (or at an attached segment of an allowed one).\n *\n * @param segments The flat list of all the segments.\n * @param anchor The anchor position (where the selection started).\n * @param focus The focus position (where the selection ends).\n * @returns The range, or null if nothing can be selected.\n */\nexport function resolveSegmentRange(\n segments: ModeSource,\n anchor: number,\n focus: number,\n): SegmentRange | null {\n const n = segments.length;\n if (anchor < 0 || anchor >= n || n === 0) {\n return null;\n }\n if (modeAt(segments, anchor) === 'blocked') {\n return null;\n }\n\n // walk from anchor to focus, stopping before any blocked segment\n const reached = clampFocus(segments, anchor, focus);\n let start = Math.min(anchor, reached);\n let end = Math.max(anchor, reached);\n\n // attached: snap start back to its base, extend end over followers\n while (start > 0 && modeAt(segments, start) === 'attached') {\n start--;\n }\n while (end + 1 < n && modeAt(segments, end + 1) === 'attached') {\n end++;\n }\n\n // trim to valid boundaries\n while (start <= end && modeAt(segments, start) !== 'allowed') {\n start++;\n }\n while (\n end >= start &&\n modeAt(segments, end) !== 'allowed' &&\n !(\n modeAt(segments, end) === 'attached' && isAttachedToAllowed(segments, end)\n )\n ) {\n end--;\n }\n return start <= end ? { start, end } : null;\n}\n\n/**\n * Find the next position where a caret can be placed, i.e. the first\n * `allowed` segment from the specified position (excluded) in the specified\n * direction.\n * @returns The position, or -1 if not found.\n */\nexport function findCaretPosition(\n segments: ModeSource,\n from: number,\n dir: 1 | -1,\n): number {\n for (let p = from + dir; p >= 0 && p < segments.length; p += dir) {\n if (modeAt(segments, p) === 'allowed') {\n return p;\n }\n }\n return -1;\n}\n\n/**\n * Find the next position where the focus of a selection being extended can\n * move to from the specified position in the specified direction: this\n * skips `wrapped` and `attached` segments, and stops at `blocked` ones.\n * @returns The position, or -1 if the focus cannot move.\n */\nexport function findExtendPosition(\n segments: ModeSource,\n from: number,\n dir: 1 | -1,\n): number {\n for (let p = from + dir; p >= 0 && p < segments.length; p += dir) {\n const mode = modeAt(segments, p);\n if (mode === 'blocked') {\n return -1;\n }\n if (mode === 'allowed') {\n return p;\n }\n }\n return -1;\n}\n\n/**\n * Find the allowed position nearest to the specified one within the range\n * [min, max], looking forward first and then backward.\n * @returns The position, or -1 if not found.\n */\nexport function findNearestAllowed(\n segments: ModeSource,\n pos: number,\n min: number,\n max: number,\n): number {\n for (let p = pos; p <= max; p++) {\n if (modeAt(segments, p) === 'allowed') {\n return p;\n }\n }\n for (let p = pos - 1; p >= min; p--) {\n if (modeAt(segments, p) === 'allowed') {\n return p;\n }\n }\n return -1;\n}\n","import { TextSegmentBlock, TextSegmentFindOptions } from '../models';\n\n/**\n * Find text in the segments of the specified blocks.\n * @param blocks The blocks.\n * @param options The find options. When `crossSegments` is false, each\n * segment whose value contains the query is a match; when true, the values\n * of all the segments in each block are concatenated, and each occurrence of\n * the query in it is a match including all the segments it overlaps (matches\n * never cross block boundaries, and do not overlap each other).\n * @returns The matches in text order, each with the IDs of its segments.\n */\nexport function findTextSegments(\n blocks: readonly TextSegmentBlock<unknown>[],\n options: TextSegmentFindOptions,\n): number[][] {\n const query = options.caseSensitive\n ? options.query\n : options.query.toLowerCase();\n if (!query) {\n return [];\n }\n const norm = (s: string) => (options.caseSensitive ? s : s.toLowerCase());\n const matches: number[][] = [];\n\n for (const block of blocks) {\n if (!options.crossSegments) {\n for (const segment of block.segments) {\n if (norm(segment.value).includes(query)) {\n matches.push([segment.id]);\n }\n }\n continue;\n }\n\n // concatenate the normalized values, keeping each segment's span\n // (normalization may change the length of a value)\n const starts: number[] = [];\n const ends: number[] = [];\n let text = '';\n for (const segment of block.segments) {\n starts.push(text.length);\n text += norm(segment.value);\n ends.push(text.length);\n }\n const n = block.segments.length;\n let from = 0;\n let at: number;\n // i is the index of the first segment which may overlap a match:\n // as matches are found in order, it only moves forward\n let i = 0;\n while ((at = text.indexOf(query, from)) > -1) {\n const end = at + query.length;\n while (i < n && ends[i] <= at) {\n i++;\n }\n const ids: number[] = [];\n for (let j = i; j < n && starts[j] < end; j++) {\n if (ends[j] > at) {\n ids.push(block.segments[j].id);\n }\n }\n matches.push(ids);\n from = end;\n }\n }\n return matches;\n}\n","import { DOCUMENT, Injectable, inject, signal } from '@angular/core';\n\n/**\n * A service to measure the width of text rendered with a given font, used\n * to size the SVG boxes of segments. Measures are cached, and the cache is\n * cleared whenever web fonts finish loading: as `version` changes at that\n * time, computations reading it are re-evaluated to get the new measures.\n * When no canvas is available (e.g. server-side or in tests), widths are\n * estimated from the font size.\n */\n@Injectable({ providedIn: 'root' })\nexport class TextMeasureService {\n private readonly _document = inject(DOCUMENT, { optional: true });\n private _context?: OffscreenCanvasRenderingContext2D | null;\n private readonly _cache = new Map<string, number>();\n private readonly _version = signal(0);\n\n /**\n * A version number incremented every time the cache is invalidated\n * because of a change in available fonts. Read it in a computation to\n * re-run it when measures change.\n */\n public readonly version = this._version.asReadonly();\n\n constructor() {\n const fonts = this._document?.fonts;\n if (fonts) {\n const invalidate = () => this.invalidate();\n if (fonts.status !== 'loaded') {\n fonts.ready?.then(invalidate).catch(() => undefined);\n }\n fonts.addEventListener?.('loadingdone', invalidate);\n }\n }\n\n private getContext(): OffscreenCanvasRenderingContext2D | null {\n if (this._context === undefined) {\n try {\n this._context =\n typeof OffscreenCanvas !== 'undefined'\n ? new OffscreenCanvas(1, 1).getContext('2d')\n : null;\n } catch {\n this._context = null;\n }\n }\n return this._context;\n }\n\n /**\n * Clear the cache of measures.\n */\n public invalidate(): void {\n this._cache.clear();\n this._version.update((v) => v + 1);\n }\n\n /**\n * Estimate the width of a text from a CSS font size, used when measuring\n * is not possible.\n */\n public static estimate(text: string, fontSize: string): number {\n const m = /([\\d.]+)\\s*(px|pt|r?em)?/.exec(fontSize);\n let px = m ? parseFloat(m[1]) : 16;\n switch (m?.[2]) {\n case 'pt':\n px = (px * 4) / 3;\n break;\n case 'em':\n case 'rem':\n px *= 16;\n break;\n }\n return [...text].length * px * 0.6;\n }\n\n /**\n * Measure the width in pixels of the specified text.\n * @param text The text to measure.\n * @param fontFace The CSS font family.\n * @param fontSize The CSS font size.\n * @returns The width.\n */\n public measure(text: string, fontFace: string, fontSize: string): number {\n if (!text) {\n return 0;\n }\n const font = `${fontSize} ${fontFace}`;\n const key = font + '\\u0000' + text;\n let width = this._cache.get(key);\n if (width === undefined) {\n const ctx = this.getContext();\n if (ctx) {\n ctx.font = font;\n width = ctx.measureText(text).width;\n } else {\n width = TextMeasureService.estimate(text, fontSize);\n }\n this._cache.set(key, width);\n }\n return width;\n }\n}\n","import { Injectable, computed, linkedSignal, signal } from '@angular/core';\n\nimport {\n TextSegment,\n TextSegmentBlock,\n TextSegmentFindOptions,\n} from '../models';\nimport {\n clampFocus,\n findCaretPosition,\n findExtendPosition,\n findNearestAllowed,\n resolveSegmentRange,\n} from '../utils/selection-range';\nimport { findTextSegments } from '../utils/segment-finder';\n\ninterface BlockRange {\n // start position (inclusive) in the flat list of segments\n start: number;\n // end position (exclusive)\n end: number;\n}\n\nfunction sameIds(a: readonly number[], b: readonly number[]): boolean {\n if (a === b) return true;\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\n/**\n * The view state of a segmented text: selection, caret and search results.\n * This is provided by each `SegmentedTextView` instance, and contains all\n * the selection and navigation logic, independently from the DOM. The\n * selection is linear: it is defined by an anchor (where it started) and a\n * focus (where it ends, i.e. the caret), both kept as segment IDs, so that\n * it survives changes in the blocks when the same IDs are still present.\n * Actions return true when they changed the selection.\n */\n@Injectable()\nexport class SegmentedTextStore<T = unknown> {\n private readonly _anchorId = signal<number | null>(null);\n private readonly _focusId = signal<number | null>(null);\n private readonly _selectedIds = signal<readonly number[]>([]);\n\n /**\n * The blocks of the text.\n */\n public readonly blocks = signal<readonly TextSegmentBlock<T>[]>([]);\n\n /**\n * All the segments of the text in their order, i.e. the flat list of\n * the blocks segments. A \"position\" is an index in this list.\n */\n public readonly segments = computed<readonly TextSegment<T>[]>(() =>\n this.blocks().flatMap((b) => b.segments),\n );\n\n /**\n * Map of positions keyed by segment ID.\n */\n public readonly positions = computed(() => {\n const map = new Map<number, number>();\n this.segments().forEach((s, i) => map.set(s.id, i));\n return map;\n });\n\n private readonly _blockRanges = computed<BlockRange[]>(() => {\n let start = 0;\n return this.blocks().map((b) => {\n const range = { start, end: start + b.segments.length };\n start = range.end;\n return range;\n });\n });\n\n /**\n * The IDs of the selected segments, in their text order.\n */\n public readonly selectedIds = this._selectedIds.asReadonly();\n\n /**\n * The set of the selected segments IDs, for fast lookup.\n */\n public readonly selectedSet = computed<ReadonlySet<number>>(\n () => new Set(this._selectedIds()),\n );\n\n /**\n * The selected segments, in their text order.\n */\n public readonly selectedSegments = computed<TextSegment<T>[]>(() => {\n const segments = this.segments();\n const positions = this.positions();\n return this._selectedIds()\n .map((id) => segments[positions.get(id)!])\n .filter((s) => !!s);\n });\n\n /**\n * The ID of the segment with the caret (the selection focus), if any.\n */\n public readonly caretId = computed<number | null>(() => {\n const id = this._focusId();\n return id !== null && this.positions().has(id) ? id : null;\n });\n\n /**\n * The current find options.\n */\n public readonly find = signal<TextSegmentFindOptions>({\n query: '',\n crossSegments: false,\n caseSensitive: false,\n });\n\n /**\n * The search matches in text order, each with its segments IDs.\n */\n public readonly matches = computed<number[][]>(() =>\n findTextSegments(this.blocks(), this.find()),\n );\n\n /**\n * The set of the IDs of all the segments in any search match.\n */\n public readonly hitSet = computed<ReadonlySet<number>>(\n () => new Set(this.matches().flat()),\n );\n\n /**\n * The index of the current match, or -1. This is reset whenever matches\n * change.\n */\n public readonly currentMatch = linkedSignal<number[][], number>({\n source: this.matches,\n computation: () => -1,\n });\n\n // ── internals ───────────────────────────────────────────────────────────\n\n private posOf(id: number | null): number {\n return id === null ? -1 : (this.positions().get(id) ?? -1);\n }\n\n private blockIndexOf(pos: number): number {\n const ranges = this._blockRanges();\n // binary search\n let lo = 0;\n let hi = ranges.length - 1;\n while (lo <= hi) {\n const mid = (lo + hi) >> 1;\n if (pos < ranges[mid].start) {\n hi = mid - 1;\n } else if (pos >= ranges[mid].end) {\n lo = mid + 1;\n } else {\n return mid;\n }\n }\n return -1;\n }\n\n private setIds(ids: readonly number[]): boolean {\n if (sameIds(ids, this._selectedIds())) {\n return false;\n }\n this._selectedIds.set(ids);\n return true;\n }\n\n /**\n * Set anchor and focus, and select the range resolved between them.\n */\n private applyRange(anchor: number, focus: number): boolean {\n const segments = this.segments();\n // the focus cannot go past a blocked segment\n if (anchor > -1 && segments[anchor]?.selectionMode !== 'blocked') {\n focus = clampFocus(segments, anchor, focus);\n }\n this._anchorId.set(segments[anchor]?.id ?? null);\n this._focusId.set(segments[focus]?.id ?? null);\n const range = resolveSegmentRange(segments, anchor, focus);\n return this.setIds(\n range\n ? segments.slice(range.start, range.end + 1).map((s) => s.id)\n : [],\n );\n }\n\n /**\n * Move the focus to the specified position, extending the selection from\n * the current anchor, or collapsing it there.\n */\n private moveFocus(pos: number, extend: boolean): boolean {\n if (pos < 0) {\n return false;\n }\n const anchor = this.posOf(this._anchorId());\n return this.applyRange(extend && anchor > -1 ? anchor : pos, pos);\n }\n\n // ── actions ─────────────────────────────────────────────────────────────\n\n /**\n * Set the blocks of the text. The current selection is kept for the\n * segments which are still present.\n * @returns True if the selection changed.\n */\n public setBlocks(blocks: readonly TextSegmentBlock<T>[]): boolean {\n this.blocks.set(blocks);\n const positions = this.positions();\n if (this._anchorId() !== null && !positions.has(this._anchorId()!)) {\n this._anchorId.set(null);\n }\n if (this._focusId() !== null && !positions.has(this._focusId()!)) {\n this._focusId.set(null);\n }\n return this.setIds(this._selectedIds().filter((id) => positions.has(id)));\n }\n\n /**\n * Start a selection at the specified segment (e.g. on pointer down).\n * @param id The segment ID.\n * @param extend True to extend the current selection up to this segment\n * (e.g. on SHIFT+click) rather than starting a new one.\n */\n public startAt(id: number, extend = false): boolean {\n return this.moveFocus(this.posOf(id), extend);\n }\n\n /**\n * Extend the selection from its anchor to the specified segment (e.g.\n * while dragging).\n */\n public extendTo(id: number): boolean {\n if (id === this._focusId()) {\n return false;\n }\n return this.moveFocus(this.posOf(id), true);\n }\n\n /**\n * Move the caret by one segment in the specified direction.\n * @param dir The direction.\n * @param extend True to extend the selection, false to collapse it to the\n * segment with the caret.\n */\n public moveCaret(dir: 1 | -1, extend = false): boolean {\n const segments = this.segments();\n const focus = this.posOf(this._focusId());\n if (focus < 0) {\n // no caret yet: start from the text edge\n return this.moveFocus(\n findCaretPosition(segments, dir > 0 ? -1 : segments.length, dir),\n false,\n );\n }\n return this.moveFocus(\n extend\n ? findExtendPosition(segments, focus, dir)\n : findCaretPosition(segments, focus, dir),\n extend,\n );\n }\n\n /**\n * Move the caret to the same relative position in the previous or next\n * non-empty block.\n */\n public moveBlock(dir: 1 | -1, extend = false): boolean {\n const focus = this.posOf(this._focusId());\n if (focus < 0) {\n return this.moveCaret(dir, extend);\n }\n const ranges = this._blockRanges();\n const bi = this.blockIndexOf(focus);\n const offset = focus - ranges[bi].start;\n for (let b = bi + dir; b >= 0 && b < ranges.length; b += dir) {\n const r = ranges[b];\n if (r.end > r.start) {\n const target = Math.min(r.start + offset, r.end - 1);\n return this.moveFocus(\n findNearestAllowed(this.segments(), target, r.start, r.end - 1),\n extend,\n );\n }\n }\n return false;\n }\n\n /**\n * Move the caret to the start or end of its block.\n */\n public moveToBlockEdge(edge: 'start' | 'end', extend = false): boolean {\n const focus = this.posOf(this._focusId());\n if (focus < 0) {\n return this.moveToTextEdge(edge, extend);\n }\n const r = this._blockRanges()[this.blockIndexOf(focus)];\n return this.moveToEdge(r.start, r.end - 1, edge, extend);\n }\n\n /**\n * Move the caret to the start or end of the text.\n */\n public moveToTextEdge(edge: 'start' | 'end', extend = false): boolean {\n return this.moveToEdge(0, this.segments().length - 1, edge, extend);\n }\n\n private moveToEdge(\n min: number,\n max: number,\n edge: 'start' | 'end',\n extend: boolean,\n ): boolean {\n const segments = this.segments();\n let pos: number;\n if (edge === 'start') {\n pos = findCaretPosition(segments, min - 1, 1);\n if (pos > max) pos = -1;\n } else {\n pos = findCaretPosition(segments, max + 1, -1);\n if (pos < min) pos = -1;\n }\n return this.moveFocus(pos, extend);\n }\n\n /**\n * Select all the text, within the limits of blocked segments starting\n * from the first selectable segment.\n */\n public selectAll(): boolean {\n const segments = this.segments();\n const first = findCaretPosition(segments, -1, 1);\n if (first < 0) {\n return false;\n }\n return this.applyRange(first, segments.length - 1);\n }\n\n /**\n * Clear the selection and the caret.\n */\n public clear(): boolean {\n this._anchorId.set(null);\n this._focusId.set(null);\n return this.setIds([]);\n }\n\n /**\n * Directly select the specified segments, bypassing selection rules (e.g.\n * when selecting from coordinates or from a binding). Unknown IDs are\n * ignored, and the selection is sorted in text order.\n */\n public setSelectedIds(ids: readonly number[]): boolean {\n const positions = this.positions();\n const sorted = ids\n .filter((id) => positions.has(id))\n .sort((a, b) => positions.get(a)! - positions.get(b)!);\n const unique = sorted.filter((id, i) => i === 0 || sorted[i - 1] !== id);\n this._anchorId.set(unique.length ? unique[0] : null);\n this._focusId.set(unique.length ? unique[unique.length - 1] : null);\n return this.setIds(unique);\n }\n\n /**\n * Go to the next or previous search match (wrapping around), selecting it.\n * @returns The IDs of the match segments, or null if no match.\n */\n public goToMatch(dir: 1 | -1): number[] | null {\n const matches = this.matches();\n if (!matches.length) {\n return null;\n }\n const current = this.currentMatch();\n const next =\n current < 0\n ? dir > 0\n ? 0\n : matches.length - 1\n : (current + dir + matches.length) % matches.length;\n this.currentMatch.set(next);\n this.setSelectedIds(matches[next]);\n return matches[next];\n }\n}\n","import {\n TextSegment,\n TextSegmentBlock,\n TextSegmentSelectionMode,\n TextSegmenter,\n} from '../models';\n\n/**\n * Options for `SpacedTextSegmenter`.\n */\nexport interface SpacedTextSegmenterOptions<T = unknown> {\n /**\n * True to include each LF as the last segment of its block. Default is\n * false, i.e. LF just ends the block.\n */\n includeLf?: boolean;\n /**\n * The label for a space. Default is `_`.\n */\n spaceLabel?: string;\n /**\n * The selection mode for Unicode combining characters. Default is\n * `wrapped`; use `attached` to keep each combining character together\n * with its base character in any selection.\n */\n combiningMode?: Extract<TextSegmentSelectionMode, 'wrapped' | 'attached'>;\n /**\n * An optional function to build the payload of each segment.\n * @param char The segment character.\n * @param id The segment ID.\n * @param index The segment index.\n */\n payloadFactory?: (char: string, id: number, index: number) => T | undefined;\n}\n\n/**\n * The location of a segment in a token.\n */\ninterface TokenLocation {\n // 1-based block ordinal\n y: number;\n // 1-based token ordinal in block\n x: number;\n // 1-based character ordinal in token\n at: number;\n // token length in segments\n length: number;\n}\n\ninterface TokenIndex<T> {\n // tokens in each block: blocks[y-1][x-1] = token segments\n tokens: TextSegment<T>[][][];\n // locations keyed by segment ID\n locations: Map<number, TokenLocation>;\n // flat positions keyed by segment ID\n positions: Map<number, number>;\n // all the segments in their order\n segments: TextSegment<T>[];\n}\n\ninterface CoordsPoint {\n y: number;\n x: number;\n at?: number;\n run?: number;\n}\n\nconst POINT_REGEX = /^(\\d+)\\.(\\d+)(?:@(\\d+)(?:x(\\d+))?)?$/;\nconst WS_REGEX = /^\\s+$/u;\nconst COMBINING_REGEX = /^\\p{M}+$/u;\n\n/**\n * A text segmenter where each character is a segment, and each line is a\n * block. Its coordinates are token-based and optionally character-based\n * within tokens, a token being any sequence of non-whitespace characters.\n * A point has form `Y.X@AxR` where `Y` is the block ordinal (1-N), `X` the\n * token ordinal in its block (1-N), and optionally `A` is the ordinal of the\n * first character in the token (1-N) and `R` the count of characters\n * (1-N, omitted when 1). A range spanning several tokens has two points\n * separated by `-`, both inclusive: the start point starts at `A` (and\n * extends to the end of its token), the end point ends at `A+R-1` of its\n * token. For instance, in `alpha beta`, `1.2@2x2` is `et` and\n * `1.1@4x2-1.2@1` is `ha b`.\n *\n * Segment IDs are code point ordinals (1-N), and indexes are the UTF-16\n * offsets in the source text (so that `text.substring(index, index +\n * value.length) === value`). CR and LF are not segments (unless LF is\n * included via options), but they still count for IDs and indexes.\n */\nexport class SpacedTextSegmenter<T = unknown> implements TextSegmenter<T> {\n private readonly _options: Required<\n Omit<SpacedTextSegmenterOptions<T>, 'payloadFactory'>\n > &\n Pick<SpacedTextSegmenterOptions<T>, 'payloadFactory'>;\n private readonly _indexes = new WeakMap<object, TokenIndex<T>>();\n\n constructor(options?: SpacedTextSegmenterOptions<T>) {\n this._options = {\n includeLf: options?.includeLf ?? false,\n spaceLabel: options?.spaceLabel ?? '_',\n combiningMode: options?.combiningMode ?? 'wrapped',\n payloadFactory: options?.payloadFactory,\n };\n }\n\n /**\n * Get the label for the specified character, if it needs one: ASCII\n * control characters get their Unicode Control Pictures symbols (U+2400),\n * and space gets the configured space label.\n */\n public getLabel(char: string): string | undefined {\n const code = char.charCodeAt(0);\n if (char.length === 1) {\n if (code < 0x20) return String.fromCharCode(0x2400 + code);\n if (code === 0x20) return this._options.spaceLabel;\n if (code === 0x7f) return '␡';\n }\n return undefined;\n }\n\n private createSegment(char: string, id: number, index: number): TextSegment<T> {\n const segment: TextSegment<T> = { id, index, value: char };\n const label = this.getLabel(char);\n if (label !== undefined) {\n segment.label = label;\n }\n if (WS_REGEX.test(char)) {\n segment.selectionMode = 'wrapped';\n } else if (COMBINING_REGEX.test(char)) {\n segment.selectionMode = this._options.combiningMode;\n }\n const payload = this._options.payloadFactory?.(char, id, index);\n if (payload !== undefined) {\n segment.payload = payload;\n }\n return segment;\n }\n\n /**\n * Get blocks of segments from the specified text: one segment per\n * character (code point), one block per line.\n */\n public getBlocks(text?: string): TextSegmentBlock<T>[] {\n if (!text) {\n return [];\n }\n const blocks: TextSegmentBlock<T>[] = [{ index: 0, segments: [] }];\n let id = 0;\n let index = 0;\n for (const char of text) {\n id++;\n const at = index;\n index += char.length;\n if (char === '\\r') {\n continue;\n }\n const block = blocks[blocks.length - 1];\n if (char === '\\n') {\n if (this._options.includeLf) {\n block.segments.push(this.createSegment(char, id, at));\n }\n blocks.push({ index: blocks.length, segments: [] });\n continue;\n }\n block.segments.push(this.createSegment(char, id, at));\n }\n return blocks;\n }\n\n private getIndex(blocks: readonly TextSegmentBlock<T>[]): TokenIndex<T> {\n let index = this._indexes.get(blocks);\n if (index) {\n return index;\n }\n index = {\n tokens: [],\n locations: new Map(),\n positions: new Map(),\n segments: [],\n };\n for (const block of blocks) {\n const tokens: TextSegment<T>[][] = [];\n let token: TextSegment<T>[] | null = null;\n for (const segment of block.segments) {\n index.positions.set(segment.id, index.segments.length);\n index.segments.push(segment);\n if (WS_REGEX.test(segment.value)) {\n token = null;\n continue;\n }\n if (!token) {\n token = [];\n tokens.push(token);\n }\n token.push(segment);\n }\n index.tokens.push(tokens);\n }\n index.tokens.forEach((tokens, yi) =>\n tokens.forEach((token, xi) =>\n token.forEach((segment, ai) =>\n index!.locations.set(segment.id, {\n y: yi + 1,\n x: xi + 1,\n at: ai + 1,\n length: token.length,\n }),\n ),\n ),\n );\n this._indexes.set(blocks, index);\n return index;\n }\n\n /**\n * Get the coordinates of the specified segments, assumed to be contiguous\n * and in text order. Whitespace segments at the edges are ignored.\n * @returns The coordinates, or an empty string if the segments contain\n * no token character.\n */\n public getSegmentCoords(\n blocks: readonly TextSegmentBlock<T>[],\n segments: readonly TextSegment<T>[],\n ): string {\n const index = this.getIndex(blocks);\n const located = segments\n .map((s) => index.locations.get(s.id))\n .filter((l): l is TokenLocation => !!l);\n if (!located.length) {\n return '';\n }\n const first = located[0];\n const last = located[located.length - 1];\n const run = (r: number) => (r > 1 ? `x${r}` : '');\n\n // single token\n if (first.y === last.y && first.x === last.x) {\n if (first.at === 1 && last.at === last.length) {\n return `${first.y}.${first.x}`;\n }\n return `${first.y}.${first.x}@${first.at}${run(last.at - first.at + 1)}`;\n }\n\n // several tokens\n const start =\n first.at === 1\n ? `${first.y}.${first.x}`\n : `${first.y}.${first.x}@${first.at}${run(first.length - first.at + 1)}`;\n const end =\n last.at === last.length\n ? `${last.y}.${last.x}`\n : `${last.y}.${last.x}@1${run(last.at)}`;\n return `${start}-${end}`;\n }\n\n private static parsePoint(text: string): CoordsPoint | null {\n const m = POINT_REGEX.exec(text.trim());\n if (!m) {\n return null;\n }\n const point: CoordsPoint = { y: +m[1], x: +m[2] };\n if (m[3] !== undefined) point.at = +m[3];\n if (m[4] !== undefined) point.run = +m[4];\n if (\n point.y < 1 ||\n point.x < 1 ||\n point.at === 0 ||\n point.run === 0\n ) {\n return null;\n }\n return point;\n }\n\n /**\n * Get the segments included by the specified coordinates.\n * @returns The segments, or null if the coordinates are not valid, or\n * refer to a non-existing location.\n */\n public getCoordsSegments(\n blocks: readonly TextSegmentBlock<T>[],\n coords: string,\n ): TextSegment<T>[] | null {\n const parts = (coords || '').split('-');\n if (parts.length > 2) {\n return null;\n }\n const points = parts.map((p) => SpacedTextSegmenter.parsePoint(p));\n if (points.some((p) => !p)) {\n return null;\n }\n const index = this.getIndex(blocks);\n\n // get the [first, last] character (0-based) picked from a point's token\n const pick = (\n p: CoordsPoint,\n whole: 'start' | 'end' | 'both',\n ): TextSegment<T>[] | null => {\n const token = index.tokens[p.y - 1]?.[p.x - 1];\n if (!token) {\n return null;\n }\n if (p.at === undefined) {\n return token;\n }\n const run = p.run ?? 1;\n const last = p.at + run - 1;\n if (last > token.length) {\n return null;\n }\n // a start point always extends to the token end\n if (whole === 'start') {\n return token.slice(p.at - 1);\n }\n return token.slice(p.at - 1, last);\n };\n\n if (points.length === 1) {\n return pick(points[0]!, 'both');\n }\n const head = pick(points[0]!, 'start');\n const tail = pick(points[1]!, 'end');\n if (!head?.length || !tail?.length) {\n return null;\n }\n const start = index.positions.get(head[0].id)!;\n const end = index.positions.get(tail[tail.length - 1].id)!;\n if (start > end) {\n return null;\n }\n return index.segments.slice(start, end + 1);\n }\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n} from '@angular/core';\n\nimport {\n DEFAULT_SEGMENTED_TEXT_SETTINGS,\n SegmentedTextSettings,\n TextSegment,\n} from '../../models';\nimport { TextMeasureService } from '../../services/text-measure.service';\nimport { resolveSegmentTip } from '../../utils/tip-template';\n\n/**\n * The vertical gap (px) between stacked boxes in a segment.\n */\nconst BOX_GAP = 2;\n\ninterface BoxGeometry {\n y: number;\n height: number;\n}\n\n/**\n * The geometry of a segment view.\n */\nexport interface TextSegmentGeometry {\n width: number;\n height: number;\n strokeWidth: number;\n radius: number;\n text: BoxGeometry;\n id?: BoxGeometry;\n index?: BoxGeometry;\n tip?: BoxGeometry;\n}\n\n/**\n * View of a single text segment: an SVG with a text box, optionally\n * followed by an ID box, an index box, and a tip box. This is a dumb\n * component, entirely driven by its inputs. Its host element carries the\n * segment ID in its `data-seg-id` attribute, which is used by the\n * containing views for event delegation.\n */\n@Component({\n selector: 'cadmus-text-segment-view',\n imports: [NgComponentOutlet],\n templateUrl: './text-segment-view.html',\n styleUrl: './text-segment-view.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n role: 'option',\n '[attr.data-seg-id]': 'segment().id',\n '[attr.aria-selected]': 'selected()',\n '[attr.aria-label]': 'label()',\n '[class]': 'hostClass()',\n },\n})\nexport class TextSegmentView {\n private readonly _measure = inject(TextMeasureService);\n\n /**\n * The segment to display.\n */\n public readonly segment = input.required<TextSegment<any>>();\n\n /**\n * The display settings.\n */\n public readonly settings = input<SegmentedTextSettings>(\n DEFAULT_SEGMENTED_TEXT_SETTINGS,\n );\n\n /**\n * True if the segment is selected.\n */\n public readonly selected = input<boolean>(false);\n\n /**\n * True if the segment is part of a search result.\n */\n public readonly hit = input<boolean>(false);\n\n /**\n * True if the segment has the caret.\n */\n public readonly caret = input<boolean>(false);\n\n public readonly label = computed(() => {\n const segment = this.segment();\n return segment.label ?? segment.value;\n });\n\n public readonly hostClass = computed(() => {\n const classes = ['cadmus-text-segment-view'];\n if (this.selected()) classes.push('selected');\n if (this.hit()) classes.push('hit');\n if (this.caret()) classes.push('caret');\n const mode = this.segment().selectionMode;\n if (mode && mode !== 'allowed') classes.push('mode-' + mode);\n const css = this.segment().cssClass;\n if (css) classes.push(css);\n return classes.join(' ');\n });\n\n /**\n * True if the tip box is displayed below the segment.\n */\n public readonly tipBelow = computed(() => {\n const s = this.settings();\n return !!s.showTipBox && s.tipPosition === 'below';\n });\n\n /**\n * The textual tip, when displayed below and not rendered by a component.\n */\n public readonly tipText = computed(() => {\n const s = this.settings();\n return this.tipBelow() && !s.tipComponent\n ? resolveSegmentTip(this.segment(), s)\n : '';\n });\n\n public readonly tipInputs = computed(() => ({ segment: this.segment() }));\n\n public readonly geometry = computed<TextSegmentGeometry>(() => {\n const s = this.settings();\n const segment = this.segment();\n // re-measure when fonts change\n this._measure.version();\n\n const strokeWidth = s.textRectStrokeWidth ?? 1;\n const padding = s.textRectPadding ?? 0;\n let width = Math.max(\n this._measure.measure(this.label(), s.fontFace, s.fontSize) + padding * 2,\n s.textRectMinWidth ?? 0,\n );\n const measureInfo = (text: string) =>\n this._measure.measure(text, s.infoFontFace, s.infoFontSize) + 4;\n if (s.showIdBox) {\n width = Math.max(width, measureInfo(String(segment.id)));\n }\n if (s.showIndexBox) {\n width = Math.max(width, measureInfo(String(segment.index)));\n }\n width = Math.ceil(width + strokeWidth);\n\n const g: TextSegmentGeometry = {\n width,\n height: s.textRectHeight,\n strokeWidth,\n radius: s.textRectRadius ?? 0,\n text: { y: 0, height: s.textRectHeight },\n };\n const stack = (height: number): BoxGeometry => {\n const box = { y: g.height + BOX_GAP, height };\n g.height = box.y + height;\n return box;\n };\n if (s.showIdBox) g.id = stack(s.infoRectHeight);\n if (s.showIndexBox) g.index = stack(s.infoRectHeight);\n if (this.tipBelow()) g.tip = stack(s.tipRectHeight);\n return g;\n });\n\n public readonly fill = computed(() => {\n const s = this.settings();\n if (this.selected()) return s.selectionColor;\n if (this.hit()) return s.resultColor;\n return this.segment().color ?? s.color;\n });\n\n public readonly textFill = computed(() => {\n const s = this.settings();\n if (this.selected()) return s.selectionTextColor;\n if (this.hit()) return s.resultTextColor;\n return this.segment().textColor ?? s.textColor;\n });\n\n public readonly stroke = computed(\n () => this.segment().borderColor ?? this.settings().borderColor,\n );\n}\n","@let g = geometry();\n@let s = settings();\n<svg\n [attr.width]=\"g.width\"\n [attr.height]=\"g.height\"\n [attr.viewBox]=\"'0 0 ' + g.width + ' ' + g.height\"\n aria-hidden=\"true\"\n focusable=\"false\"\n>\n <!-- text box -->\n <rect\n class=\"text-rect\"\n [attr.x]=\"g.strokeWidth / 2\"\n [attr.y]=\"g.strokeWidth / 2\"\n [attr.width]=\"g.width - g.strokeWidth\"\n [attr.height]=\"g.text.height - g.strokeWidth\"\n [attr.rx]=\"g.radius\"\n [attr.stroke-width]=\"g.strokeWidth\"\n [attr.stroke-dasharray]=\"s.textRectStrokeDasharray || null\"\n [style.fill]=\"fill()\"\n [style.stroke]=\"stroke()\"\n />\n <text\n class=\"text\"\n [attr.x]=\"g.width / 2\"\n [attr.y]=\"g.text.height / 2\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [style.fill]=\"textFill()\"\n [style.font-family]=\"s.fontFace\"\n [style.font-size]=\"s.fontSize\"\n >{{ label() }}</text>\n\n <!-- ID box -->\n @if (g.id; as box) {\n <rect\n class=\"info-rect id-rect\"\n x=\"0\"\n [attr.y]=\"box.y\"\n [attr.width]=\"g.width\"\n [attr.height]=\"box.height\"\n [attr.rx]=\"g.radius\"\n />\n <text\n class=\"info-text id-text\"\n [attr.x]=\"g.width / 2\"\n [attr.y]=\"box.y + box.height / 2\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [style.font-family]=\"s.infoFontFace\"\n [style.font-size]=\"s.infoFontSize\"\n >{{ segment().id }}</text>\n }\n\n <!-- index box -->\n @if (g.index; as box) {\n <rect\n class=\"info-rect index-rect\"\n x=\"0\"\n [attr.y]=\"box.y\"\n [attr.width]=\"g.width\"\n [attr.height]=\"box.height\"\n [attr.rx]=\"g.radius\"\n />\n <text\n class=\"info-text index-text\"\n [attr.x]=\"g.width / 2\"\n [attr.y]=\"box.y + box.height / 2\"\n text-anchor=\"middle\"\n dominant-baseline=\"central\"\n [style.font-family]=\"s.infoFontFace\"\n [style.font-size]=\"s.infoFontSize\"\n >{{ segment().index }}</text>\n }\n\n <!-- tip box -->\n @if (g.tip; as box) {\n @if (s.tipComponent; as tipComponent) {\n <foreignObject\n class=\"tip-html\"\n x=\"0\"\n [attr.y]=\"box.y\"\n [attr.width]=\"g.width\"\n [attr.height]=\"box.height\"\n >\n <div class=\"tip-html-content\">\n <ng-container\n *ngComponentOutlet=\"tipComponent; inputs: tipInputs()\"\n />\n </div>\n </foreignObject>\n } @else {\n <rect\n class=\"tip-rect\"\n x=\"0\"\n [attr.y]=\"box.y\"\n [attr.width]=\"g.width\"\n [attr.height]=\"box.height\"\n [attr.rx]=\"g.radius\"\n />\n <text\n class=\"tip-text\"\n x=\"2\"\n [attr.y]=\"box.y + box.height / 2\"\n dominant-baseline=\"central\"\n [style.font-family]=\"s.tipFontFace\"\n [style.font-size]=\"s.tipFontSize\"\n >{{ tipText() }}</text>\n }\n }\n</svg>\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n} from '@angular/core';\n\nimport {\n DEFAULT_SEGMENTED_TEXT_SETTINGS,\n SegmentedTextSettings,\n TextSegment,\n TextSegmentBlock,\n} from '../../models';\nimport { TextSegmentView } from '../text-segment-view/text-segment-view';\n\nconst EMPTY_SET: ReadonlySet<number> = new Set<number>();\nconst WS_REGEX = /^\\s+$/u;\n\n/**\n * Split the specified segments into runs for `word` wrapping: each run ends\n * with a whitespace segment (i.e. a segment whose value is entirely\n * whitespace), except for the last one.\n */\nexport function getTextSegmentRuns<T>(\n segments: readonly TextSegment<T>[],\n): TextSegment<T>[][] {\n const runs: TextSegment<T>[][] = [];\n let run: TextSegment<T>[] = [];\n for (const segment of segments) {\n run.push(segment);\n if (WS_REGEX.test(segment.value)) {\n runs.push(run);\n run = [];\n }\n }\n if (run.length) {\n runs.push(run);\n }\n return runs;\n}\n\n/**\n * View of a block of text segments: a row of segment views, reflowing to\n * the next line when reaching the container's end, optionally preceded by\n * the block number. According to the `wrapMode` setting, the row can wrap\n * after any segment, or only after whitespace segments, so that words stay\n * together. This is a dumb component, entirely driven by its inputs.\n */\n@Component({\n selector: 'cadmus-text-segment-block-view',\n imports: [TextSegmentView],\n templateUrl: './text-segment-block-view.html',\n styleUrl: './text-segment-block-view.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n role: 'group',\n '[attr.data-block-index]': 'block().index',\n '[attr.aria-label]': '\"block \" + (block().index + 1)',\n },\n})\nexport class TextSegmentBlockView {\n /**\n * The block to display.\n */\n public readonly block = input.required<TextSegmentBlock<any>>();\n\n /**\n * The display settings.\n */\n public readonly settings = input<SegmentedTextSettings>(\n DEFAULT_SEGMENTED_TEXT_SETTINGS,\n );\n\n /**\n * The IDs of the selected segments.\n */\n public readonly selectedIds = input<ReadonlySet<number>>(EMPTY_SET);\n\n /**\n * The IDs of the segments in search results.\n */\n public readonly hitIds = input<ReadonlySet<number>>(EMPTY_SET);\n\n /**\n * The ID of the segment with the caret, if any.\n */\n public readonly caretId = input<number | null>(null);\n\n /**\n * The runs of segments kept together when wrapping by word, or null\n * when wrapping by segment.\n */\n public readonly runs = computed<TextSegment<any>[][] | null>(() =>\n this.settings().wrapMode === 'word'\n ? getTextSegmentRuns(this.block().segments)\n : null,\n );\n}\n","@let s = settings();\n@if (s.showBlockNumbers) {\n <div\n class=\"block-number\"\n aria-hidden=\"true\"\n [style.line-height.px]=\"s.textRectHeight\"\n >\n {{ block().index + 1 }}\n </div>\n}\n<div\n class=\"segments\"\n [style.column-gap.px]=\"s.segmentOffset\"\n [style.row-gap.px]=\"s.lineOffset\"\n [style.min-height.px]=\"s.textRectHeight\"\n>\n @if (runs(); as runs) {\n <!-- word wrap: each run (e.g. a word with its trailing space) stays\n together, unless it is wider than the whole line -->\n @for (run of runs; track run[0].id) {\n <div\n class=\"run\"\n [style.column-gap.px]=\"s.segmentOffset\"\n [style.row-gap.px]=\"s.lineOffset\"\n >\n @for (segment of run; track segment.id) {\n <cadmus-text-segment-view\n [segment]=\"segment\"\n [settings]=\"s\"\n [selected]=\"selectedIds().has(segment.id)\"\n [hit]=\"hitIds().has(segment.id)\"\n [caret]=\"caretId() === segment.id\"\n />\n }\n </div>\n }\n } @else {\n @for (segment of block().segments; track segment.id) {\n <cadmus-text-segment-view\n [segment]=\"segment\"\n [settings]=\"s\"\n [selected]=\"selectedIds().has(segment.id)\"\n [hit]=\"hitIds().has(segment.id)\"\n [caret]=\"caretId() === segment.id\"\n />\n }\n }\n</div>\n","import { NgComponentOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { FormField, form } from '@angular/forms/signals';\nimport {\n CdkConnectedOverlay,\n ConnectedPosition,\n} from '@angular/cdk/overlay';\n\nimport { MatIconButton } from '@angular/material/button';\nimport {\n MatFormField,\n MatHint,\n MatPrefix,\n MatSuffix,\n} from '@angular/material/form-field';\nimport { MatIcon } from '@angular/material/icon';\nimport { MatInput } from '@angular/material/input';\nimport { MatSlider, MatSliderThumb } from '@angular/material/slider';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport {\n TEXT_SEGMENTER,\n TextSegment,\n TextSegmentBlock,\n TextSegmentClick,\n TextSegmentSelection,\n TextSegmenter,\n SegmentedTextSettings,\n resolveSegmentedTextSettings,\n} from '../../models';\nimport { SegmentedTextStore } from '../../services/segmented-text-store';\nimport { resolveSegmentTip } from '../../utils/tip-template';\nimport { TextSegmentBlockView } from '../text-segment-block-view/text-segment-block-view';\n\n/**\n * The debounce time (ms) for applying typed coordinates.\n */\nexport const SEGMENTED_TEXT_COORDS_DEBOUNCE = 400;\n\n/** Minimum zoom factor. */\nexport const SEGMENTED_TEXT_MIN_ZOOM = 0.5;\n/** Maximum zoom factor. */\nexport const SEGMENTED_TEXT_MAX_ZOOM = 3;\n\n/**\n * The edge (px) of the viewport where dragging auto-scrolls it.\n */\nconst AUTO_SCROLL_EDGE = 24;\n\ninterface ViewControls {\n zoom: number;\n coords: string;\n}\n\ninterface HoveredSegment<T> {\n element: Element;\n segment: TextSegment<T>;\n}\n\nfunction sameIds(a: readonly number[], b: readonly number[]): boolean {\n return a.length === b.length && a.every((id, i) => id === b[i]);\n}\n\n/**\n * View of a segmented text: its blocks stacked vertically in a scrollable\n * viewport, with a toolbar for zoom, find, and coordinates. Users select\n * segments like text in an editor: by clicking, dragging, SHIFT+clicking, or\n * with the keyboard (arrows, Home/End, CTRL+A, Escape), always within the\n * rules defined by each segment's selection mode. The selection is exposed\n * by the two-way `selectedIds` model, and each new selection made by the\n * user is emitted by `selectionChange`.\n */\n@Component({\n selector: 'cadmus-segmented-text-view',\n imports: [\n CdkConnectedOverlay,\n FormField,\n MatFormField,\n MatHint,\n MatIcon,\n MatIconButton,\n MatInput,\n MatPrefix,\n MatSlider,\n MatSliderThumb,\n MatSuffix,\n MatTooltip,\n NgComponentOutlet,\n TextSegmentBlockView,\n ],\n providers: [SegmentedTextStore],\n templateUrl: './segmented-text-view.html',\n styleUrl: './segmented-text-view.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[style.--cadmus-tseg-caret-color]': 'resolvedSettings().caretColor',\n },\n})\nexport class SegmentedTextView<T = unknown> {\n private readonly _document = inject(DOCUMENT);\n private readonly _injectedSegmenter = inject<TextSegmenter<T>>(\n TEXT_SEGMENTER,\n { optional: true },\n );\n private _dragging = false;\n private _dragChanged = false;\n // the ID of the segment where the pointer was pressed, for clicks\n private _downId: number | null = null;\n private _lastCoords = '';\n\n /**\n * The state store of this view.\n */\n public readonly store = inject<SegmentedTextStore<T>>(SegmentedTextStore);\n\n // ── inputs and outputs ──────────────────────────────────────────────────\n\n /**\n * The blocks of segments to display.\n */\n public readonly blocks = input<readonly TextSegmentBlock<T>[]>([]);\n\n /**\n * The display settings. Any setting not specified here gets its default\n * value from `DEFAULT_SEGMENTED_TEXT_SETTINGS`.\n */\n public readonly settings = input<\n Partial<SegmentedTextSettings> | null | undefined\n >();\n\n /**\n * The segmenter used for coordinates. When not set, the one provided via\n * the `TEXT_SEGMENTER` token is used, if any. Without a segmenter, the\n * coordinates box is not displayed.\n */\n public readonly segmenter = input<TextSegmenter<T> | null | undefined>();\n\n /** True to show the zoom control. */\n public readonly showZoom = input<boolean>(true);\n /** True to show the find control. */\n public readonly showFind = input<boolean>(true);\n /** True to show the coordinates box (when a segmenter is available). */\n public readonly showCoords = input<boolean>(true);\n /** The accessible label of the text. */\n public readonly ariaLabel = input<string>('segmented text');\n\n /**\n * The IDs of the selected segments, in text order.\n */\n public readonly selectedIds = model<number[]>([]);\n\n /**\n * Emitted whenever the user makes a new selection.\n */\n public readonly selectionChange = output<TextSegmentSelection<T>>();\n\n /**\n * Emitted when the user clicks a segment (i.e. presses and releases the\n * primary pointer button on the same segment), whatever its selection\n * mode, including segments which cannot be selected like `blocked` ones.\n * This is emitted after any selection change caused by the click.\n */\n public readonly segmentClick = output<TextSegmentClick<T>>();\n\n // ── derived state ───────────────────────────────────────────────────────\n\n public readonly resolvedSettings = computed(() =>\n resolveSegmentedTextSettings(this.settings()),\n );\n\n public readonly activeSegmenter = computed<TextSegmenter<T> | null>(\n () => this.segmenter() ?? this._injectedSegmenter ?? null,\n );\n\n public readonly minZoom = SEGMENTED_TEXT_MIN_ZOOM;\n public readonly maxZoom = SEGMENTED_TEXT_MAX_ZOOM;\n\n private readonly _view = signal<ViewControls>({ zoom: 1, coords: '' });\n\n /**\n * The form for the view controls (zoom and coordinates).\n */\n public readonly viewForm = form(this._view);\n\n /**\n * The form for the find controls, bound to the store's find options.\n */\n public readonly findForm = form(this.store.find);\n\n /**\n * True when the typed coordinates are not valid.\n */\n public readonly coordsError = signal(false);\n\n public readonly viewport =\n viewChild.required<ElementRef<HTMLElement>>('viewport');\n private readonly _overlay = viewChild(CdkConnectedOverlay);\n\n // ── tip popup ───────────────────────────────────────────────────────────\n\n public readonly hovered = signal<HoveredSegment<T> | null>(null);\n\n public readonly popupEnabled = computed(() => {\n const s = this.resolvedSettings();\n return !!s.showTipBox && s.tipPosition === 'popup';\n });\n\n public readonly popupText = computed(() => {\n const hovered = this.hovered();\n const s = this.resolvedSettings();\n return hovered && !s.tipComponent\n ? resolveSegmentTip(hovered.segment, s)\n : '';\n });\n\n public readonly popupOpen = computed(\n () =>\n this.popupEnabled() &&\n !!this.hovered() &&\n (!!this.resolvedSettings().tipComponent || !!this.popupText()),\n );\n\n public readonly popupInputs = computed(() => ({\n segment: this.hovered()?.segment,\n }));\n\n public readonly popupOrigin = computed<Element>(\n () => this.hovered()?.element ?? this.viewport().nativeElement,\n );\n\n public readonly popupPositions: ConnectedPosition[] = [\n {\n originX: 'center',\n originY: 'bottom',\n overlayX: 'center',\n overlayY: 'top',\n offsetY: 6,\n },\n {\n originX: 'center',\n originY: 'top',\n overlayX: 'center',\n overlayY: 'bottom',\n offsetY: -6,\n },\n ];\n\n constructor() {\n // blocks -> store; a new segmenter just refreshes coordinates\n effect(() => {\n const blocks = this.blocks();\n this.activeSegmenter();\n untracked(() => {\n if (this.store.setBlocks(blocks)) {\n this.commit();\n } else {\n this.updateCoords();\n }\n });\n });\n\n // selectedIds model -> store (external changes only)\n effect(() => {\n const ids = this.selectedIds();\n untracked(() => {\n if (!sameIds(ids, this.store.selectedIds())) {\n this.store.setSelectedIds(ids);\n this.updateCoords();\n }\n });\n });\n\n // typed coordinates -> selection, debounced\n effect((onCleanup) => {\n const coords = this.viewForm.coords().value();\n if (coords === this._lastCoords) {\n return;\n }\n const handle = setTimeout(\n () => this.applyCoords(coords),\n SEGMENTED_TEXT_COORDS_DEBOUNCE,\n );\n onCleanup(() => clearTimeout(handle));\n });\n\n // the popup must not intercept pointer events, else hovering would\n // flicker as the pointer enters it\n effect(() => {\n if (this.popupOpen()) {\n untracked(() => this.disablePopupPointer());\n }\n });\n }\n\n // ── selection commit ────────────────────────────────────────────────────\n\n /**\n * Update the coordinates box from the current selection.\n * @returns The coordinates.\n */\n private updateCoords(): string {\n const segmenter = this.activeSegmenter();\n const coords =\n segmenter && this.store.selectedIds().length\n ? segmenter.getSegmentCoords(\n this.store.blocks(),\n this.store.selectedSegments(),\n )\n : '';\n this._lastCoords = coords;\n this.coordsError.set(false);\n this._view.update((v) => ({ ...v, coords }));\n return coords;\n }\n\n /**\n * Publish the store's selection to the model and to the selection event.\n * @param writeCoords False to leave the coordinates box untouched, e.g.\n * when the selection comes from it.\n */\n private commit(writeCoords = true): void {\n const ids = [...this.store.selectedIds()];\n this.selectedIds.set(ids);\n const segmenter = this.activeSegmenter();\n let coords: string;\n if (writeCoords) {\n coords = this.updateCoords();\n } else {\n coords =\n segmenter && ids.length\n ? segmenter.getSegmentCoords(\n this.store.blocks(),\n this.store.selectedSegments(),\n )\n : '';\n }\n this.selectionChange.emit({\n ids,\n segments: this.store.selectedSegments(),\n coords: coords || undefined,\n });\n }\n\n private applyCoords(coords: string): void {\n const segmenter = this.activeSegmenter();\n if (!segmenter) {\n return;\n }\n this._lastCoords = coords;\n const text = coords.trim();\n if (!text) {\n this.coordsError.set(false);\n if (this.store.clear()) {\n this.commit(false);\n }\n return;\n }\n const segments = segmenter.getCoordsSegments(this.store.blocks(), text);\n if (!segments) {\n this.coordsError.set(true);\n return;\n }\n this.coordsError.set(false);\n if (this.store.setSelectedIds(segments.map((s) => s.id))) {\n this.commit(false);\n if (segments.length) {\n this.scrollToSegment(segments[0].id);\n }\n }\n }\n\n // ── public API ──────────────────────────────────────────────────────────\n\n /**\n * Scroll the viewport so that the specified segment is visible.\n */\n public scrollToSegment(id: number): void {\n const el = this.viewport().nativeElement.querySelector(\n `[data-seg-id=\"${id}\"]`,\n );\n el?.scrollIntoView?.({ block: 'nearest', inline: 'nearest' });\n }\n\n /**\n * Clear the selection.\n */\n public clearSelection(): void {\n if (this.store.clear()) {\n this.commit();\n }\n }\n\n /**\n * Go to the next or previous search match, selecting it.\n */\n public goToMatch(dir: 1 | -1): void {\n const ids = this.store.goToMatch(dir);\n if (ids) {\n this.commit();\n this.scrollToSegment(ids[0]);\n }\n }\n\n // ── toolbar ─────────────────────────────────────────────────────────────\n\n public formatZoom(value: number): string {\n return Math.round(value * 100) + '%';\n }\n\n public resetZoom(): void {\n this.viewForm.zoom().value.set(1);\n }\n\n public clearFind(): void {\n this.findForm.query().value.set('');\n }\n\n public toggleCrossSegments(): void {\n this.findForm.crossSegments().value.update((v) => !v);\n }\n\n public toggleCaseSensitive(): void {\n this.findForm.caseSensitive().value.update((v) => !v);\n }\n\n public onFindKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter') {\n event.preventDefault();\n this.goToMatch(event.shiftKey ? -1 : 1);\n } else if (event.key === 'Escape' && this.findForm.query().value()) {\n event.preventDefault();\n event.stopPropagation();\n this.clearFind();\n }\n }\n\n // ── pointer ─────────────────────────────────────────────────────────────\n\n private segmentIdAt(target: EventTarget | null): number | null {\n const el = (target as Element | null)?.closest?.('[data-seg-id]');\n if (!el || !this.viewport().nativeElement.contains(el)) {\n return null;\n }\n const id = Number(el.getAttribute('data-seg-id'));\n return Number.isNaN(id) ? null : id;\n }\n\n private segmentById(id: number): TextSegment<T> | undefined {\n const pos = this.store.positions().get(id);\n return pos === undefined ? undefined : this.store.segments()[pos];\n }\n\n public onPointerDown(event: PointerEvent): void {\n if (event.button !== 0) {\n return;\n }\n const id = this.segmentIdAt(event.target);\n if (id === null) {\n return;\n }\n // prevent native text selection and drag\n event.preventDefault();\n const viewport = this.viewport().nativeElement;\n viewport.focus({ preventScroll: true });\n this.hovered.set(null);\n this._dragging = true;\n this._downId = id;\n this._dragChanged = this.store.startAt(id, event.shiftKey);\n try {\n viewport.setPointerCapture?.(event.pointerId);\n } catch {\n // not supported: dragging works only within the viewport\n }\n }\n\n public onPointerMove(event: PointerEvent): void {\n if (!this._dragging) {\n return;\n }\n // with pointer capture the target is the viewport: find the segment\n // under the pointer\n const target =\n this._document.elementFromPoint?.(event.clientX, event.clientY) ??\n event.target;\n const id = this.segmentIdAt(target);\n if (id !== null && this.store.extendTo(id)) {\n this._dragChanged = true;\n }\n this.autoScroll(event.clientY);\n }\n\n public onPointerUp(event: PointerEvent): void {\n if (!this._dragging) {\n return;\n }\n this._dragging = false;\n try {\n this.viewport().nativeElement.releasePointerCapture?.(event.pointerId);\n } catch {\n // ignore\n }\n if (this._dragChanged) {\n this._dragChanged = false;\n this.commit();\n }\n\n // a click is a press and release on the same segment; with pointer\n // capture the target is the viewport, so find the segment under it\n const downId = this._downId;\n this._downId = null;\n if (downId === null || event.type === 'pointercancel') {\n return;\n }\n const target =\n this._document.elementFromPoint?.(event.clientX, event.clientY) ??\n event.target;\n if (this.segmentIdAt(target) === downId) {\n const segment = this.segmentById(downId);\n if (segment) {\n this.segmentClick.emit({ segment, event });\n }\n }\n }\n\n private autoScroll(clientY: number): void {\n const viewport = this.viewport().nativeElement;\n const rect = viewport.getBoundingClientRect();\n if (clientY < rect.top + AUTO_SCROLL_EDGE) {\n viewport.scrollTop -= rect.top + AUTO_SCROLL_EDGE - clientY;\n } else if (clientY > rect.bottom - AUTO_SCROLL_EDGE) {\n viewport.scrollTop += clientY - (rect.bottom - AUTO_SCROLL_EDGE);\n }\n }\n\n public onPointerOver(event: PointerEvent): void {\n if (this._dragging || !this.popupEnabled()) {\n return;\n }\n const el = (event.target as Element | null)?.closest?.('[data-seg-id]');\n const id = this.segmentIdAt(el ?? null);\n const segment = id === null ? undefined : this.segmentById(id);\n if (!el || !segment) {\n this.hovered.set(null);\n } else if (this.hovered()?.element !== el) {\n this.hovered.set({ element: el, segment });\n }\n }\n\n public onPointerLeave(): void {\n this.hovered.set(null);\n }\n\n private disablePopupPointer(): void {\n const ref = this._overlay()?.overlayRef;\n if (ref) {\n ref.overlayElement.style.pointerEvents = 'none';\n ref.hostElement.style.pointerEvents = 'none';\n }\n }\n\n public onPopupAttach(): void {\n this.disablePopupPointer();\n }\n\n // ── keyboard ────────────────────────────────────────────────────────────\n\n public onKeyDown(event: KeyboardEvent): void {\n const s = this.store;\n const extend = event.shiftKey;\n const ctrl = event.ctrlKey || event.metaKey;\n let changed = false;\n switch (event.key) {\n case 'ArrowLeft':\n changed = s.moveCaret(-1, extend);\n break;\n case 'ArrowRight':\n changed = s.moveCaret(1, extend);\n break;\n case 'ArrowUp':\n changed = s.moveBlock(-1, extend);\n break;\n case 'ArrowDown':\n changed = s.moveBlock(1, extend);\n break;\n case 'Home':\n changed = ctrl\n ? s.moveToTextEdge('start', extend)\n : s.moveToBlockEdge('start', extend);\n break;\n case 'End':\n changed = ctrl\n ? s.moveToTextEdge('end', extend)\n : s.moveToBlockEdge('end', extend);\n break;\n case 'a':\n case 'A':\n if (!ctrl) {\n return;\n }\n changed = s.selectAll();\n break;\n case 'Escape':\n // let Escape propagate (e.g. to close a dialog) when there is\n // nothing to clear\n if (!s.selectedIds().length) {\n return;\n }\n changed = s.clear();\n break;\n default:\n return;\n }\n event.preventDefault();\n if (changed) {\n this.commit();\n const caret = s.caretId();\n if (caret !== null) {\n this.scrollToSegment(caret);\n }\n }\n }\n\n public onWheel(event: WheelEvent): void {\n if (!event.ctrlKey || !this.showZoom()) {\n return;\n }\n event.preventDefault();\n const zoom = this.viewForm.zoom().value();\n const next = Math.round((zoom + (event.deltaY < 0 ? 0.1 : -0.1)) * 10) / 10;\n this.viewForm\n .zoom()\n .value.set(Math.max(this.minZoom, Math.min(this.maxZoom, next)));\n }\n}\n","@let s = resolvedSettings();\n<!-- text -->\n<div\n #viewport\n class=\"viewport\"\n tabindex=\"0\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [attr.aria-label]=\"ariaLabel()\"\n (pointerdown)=\"onPointerDown($event)\"\n (pointermove)=\"onPointerMove($event)\"\n (pointerup)=\"onPointerUp($event)\"\n (pointercancel)=\"onPointerUp($event)\"\n (pointerover)=\"onPointerOver($event)\"\n (pointerleave)=\"onPointerLeave()\"\n (keydown)=\"onKeyDown($event)\"\n (wheel)=\"onWheel($event)\"\n>\n <div\n class=\"content\"\n [style.zoom]=\"viewForm.zoom().value()\"\n [style.row-gap.px]=\"s.blockOffset\"\n >\n @for (block of blocks(); track block.index) {\n <cadmus-text-segment-block-view\n [block]=\"block\"\n [settings]=\"s\"\n [selectedIds]=\"store.selectedSet()\"\n [hitIds]=\"store.hitSet()\"\n [caretId]=\"store.caretId()\"\n />\n } @empty {\n <div class=\"empty\">no text</div>\n }\n </div>\n</div>\n\n<!-- toolbar -->\n@if (showZoom() || showFind() || (showCoords() && activeSegmenter())) {\n <div class=\"toolbar\">\n <!-- zoom -->\n @if (showZoom()) {\n <div class=\"zoom\">\n <mat-icon class=\"muted\" aria-hidden=\"true\">zoom_in</mat-icon>\n <mat-slider\n [min]=\"minZoom\"\n [max]=\"maxZoom\"\n step=\"0.1\"\n discrete\n [displayWith]=\"formatZoom\"\n >\n <input matSliderThumb [formField]=\"viewForm.zoom\" aria-label=\"zoom\" />\n </mat-slider>\n <button\n type=\"button\"\n mat-icon-button\n class=\"dense\"\n matTooltip=\"Reset zoom\"\n aria-label=\"reset zoom\"\n [disabled]=\"viewForm.zoom().value() === 1\"\n (click)=\"resetZoom()\"\n >\n <mat-icon>restart_alt</mat-icon>\n </button>\n </div>\n }\n\n <!-- find -->\n @if (showFind()) {\n @let find = store.find();\n @let matchCount = store.matches().length;\n <div class=\"find\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-icon matPrefix class=\"muted\">search</mat-icon>\n <input\n matInput\n type=\"search\"\n placeholder=\"find\"\n aria-label=\"find\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [formField]=\"findForm.query\"\n (keydown)=\"onFindKeydown($event)\"\n />\n @if (find.query) {\n <button\n type=\"button\"\n matSuffix\n mat-icon-button\n class=\"dense\"\n aria-label=\"clear find\"\n (click)=\"clearFind()\"\n >\n <mat-icon>close</mat-icon>\n </button>\n }\n </mat-form-field>\n <button\n type=\"button\"\n mat-icon-button\n class=\"dense toggle\"\n [class.on]=\"find.crossSegments\"\n [attr.aria-pressed]=\"find.crossSegments\"\n [matTooltip]=\"\n find.crossSegments\n ? 'Finding across segments'\n : 'Finding within each segment'\n \"\n aria-label=\"find across segments\"\n (click)=\"toggleCrossSegments()\"\n >\n <mat-icon>{{ find.crossSegments ? \"link\" : \"link_off\" }}</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n class=\"dense toggle case\"\n [class.on]=\"find.caseSensitive\"\n [attr.aria-pressed]=\"find.caseSensitive\"\n matTooltip=\"Case sensitive\"\n aria-label=\"case sensitive\"\n (click)=\"toggleCaseSensitive()\"\n >\n Aa\n </button>\n @if (find.query) {\n <span class=\"match-count\" aria-live=\"polite\">\n @if (!matchCount) {\n no match\n } @else if (store.currentMatch() < 0) {\n {{ matchCount }} found\n } @else {\n {{ store.currentMatch() + 1 }}/{{ matchCount }}\n }\n </span>\n <button\n type=\"button\"\n mat-icon-button\n class=\"dense\"\n matTooltip=\"Previous match (Shift+Enter)\"\n aria-label=\"previous match\"\n [disabled]=\"!matchCount\"\n (click)=\"goToMatch(-1)\"\n >\n <mat-icon>keyboard_arrow_up</mat-icon>\n </button>\n <button\n type=\"button\"\n mat-icon-button\n class=\"dense\"\n matTooltip=\"Next match (Enter)\"\n aria-label=\"next match\"\n [disabled]=\"!matchCount\"\n (click)=\"goToMatch(1)\"\n >\n <mat-icon>keyboard_arrow_down</mat-icon>\n </button>\n }\n </div>\n }\n\n <!-- coordinates -->\n @if (showCoords() && activeSegmenter()) {\n <div class=\"coords\">\n <mat-form-field appearance=\"outline\" subscriptSizing=\"dynamic\">\n <mat-icon matPrefix class=\"muted\">my_location</mat-icon>\n <input\n matInput\n placeholder=\"coordinates\"\n aria-label=\"coordinates\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n [formField]=\"viewForm.coords\"\n />\n @if (coordsError()) {\n <mat-hint class=\"coords-error\">invalid coordinates</mat-hint>\n }\n </mat-form-field>\n </div>\n }\n </div>\n}\n\n<!-- tip popup -->\n<ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"popupOrigin()\"\n [cdkConnectedOverlayOpen]=\"popupOpen()\"\n [cdkConnectedOverlayPositions]=\"popupPositions\"\n (attach)=\"onPopupAttach()\"\n>\n <div\n class=\"tip-popup\"\n role=\"tooltip\"\n [style.font-family]=\"s.tipFontFace\"\n >\n @if (s.tipComponent; as tipComponent) {\n <ng-container *ngComponentOutlet=\"tipComponent; inputs: popupInputs()\" />\n } @else {\n {{ popupText() }}\n }\n </div>\n</ng-template>\n"],"mappings":";;;;;;;;;;;AAkPA,MAAa,kCACX,OAAO,OAAO;CACZ,eAAe;CACf,YAAY;CACZ,aAAa;CACb,kBAAkB;CAClB,UAAU;CACV,WAAW;CACX,cAAc;CACd,YAAY;CACZ,OAAO;CACP,WAAW;CACX,aAAa;CACb,gBAAgB;CAChB,oBAAoB;CACpB,aAAa;CACb,iBAAiB;CACjB,YAAY;CACZ,UAAU;CACV,UAAU;CACV,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,gBAAgB;CAChB,qBAAqB;CACrB,cAAc;CACd,cAAc;CACd,gBAAgB;CAChB,aAAa;CACb,aAAa;CACb,eAAe;CACf,cAAc;CACd,aAAa;AACd,CAAA;AAKH,SAAgB,6BACd,UAAgD;CAEhD,IAAI,CAAC,UACH,OAAO;CAET,MAAM,WAAW,EAAE,GAAG,gCAA+B;CAKrD,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,QAAQ,GAChD,IAAI,UAAU,QACZ,SAAS,OAAO;CAGpB,OAAO;AACT;AAuDA,MAAa,iBAAiB,IAAI,eAChC,gBAAgB;AC/VlB,MAAM,oBAAoB;AAQ1B,SAAgB,YAAY,KAAc,MAAY;CACpD,IAAI,UAAmB;CACvB,KAAK,MAAM,QAAQ,KAAK,MAAM,GAAG,GAAG;EAClC,IAAI,YAAY,QAAQ,YAAY,QAClC;EAEF,IAAI,OAAO,YAAY,YAAY,OAAO,YAAY,YACpD;EAEF,UAAW,QAAoC;CACjD;CACA,OAAO;AACT;AAEA,SAAS,cAAc,OAAc;CACnC,IAAI,UAA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AA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,mBAAA;EAAA,CAAA;EAAA,iBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,iBAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,cAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAU,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAClB,mBAAmB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myrmidon/cadmus-text-segment",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Cadmus - segmented text viewer with linear selection of arbitrary text segments.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Cadmus",
|
|
7
|
+
"bricks",
|
|
8
|
+
"text",
|
|
9
|
+
"segmentation"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/vedph/cadmus-bricks-shell-v3",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/vedph/cadmus-bricks-shell-v3"
|
|
15
|
+
},
|
|
16
|
+
"author": {
|
|
17
|
+
"name": "Daniele Fusi"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@angular/cdk": "^22.2.0",
|
|
21
|
+
"@angular/common": "^22.2.0",
|
|
22
|
+
"@angular/core": "^22.2.0",
|
|
23
|
+
"@angular/forms": "^22.2.0",
|
|
24
|
+
"@angular/material": "^22.2.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tslib": "^2.3.0"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"module": "fesm2022/myrmidon-cadmus-text-segment.mjs",
|
|
31
|
+
"typings": "types/myrmidon-cadmus-text-segment.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
"./package.json": {
|
|
34
|
+
"default": "./package.json"
|
|
35
|
+
},
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./types/myrmidon-cadmus-text-segment.d.ts",
|
|
38
|
+
"default": "./fesm2022/myrmidon-cadmus-text-segment.mjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"type": "module"
|
|
6
42
|
}
|