@danxbot/ui 6.3.7 → 6.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { type BlockInfo, type BlockKind, type ConstructInfo } from "../../lib/markdown/convert";
1
+ import { type BlockInfo, type BlockKind, type ConstructInfo, type InlineMark } from "../../lib/markdown/convert";
2
2
  import { type Command } from "../../lib/markdown/commands";
3
3
  import type { MarkdownSurface } from "../../lib/markdown/surface";
4
4
  export interface EditorState {
@@ -9,6 +9,15 @@ export interface EditorState {
9
9
  ranged: boolean;
10
10
  block: BlockInfo | null;
11
11
  construct: ConstructInfo | null;
12
+ /**
13
+ * Inline marks (bold, italic, inline code, strikethrough) surrounding the
14
+ * caret's own position — the header toolbar's only source for "is bold
15
+ * currently active", so a toggle button never re-derives it from the
16
+ * source text a second time. Empty, never null, when there is nothing to
17
+ * report, which is the harder-to-misuse shape for a caller that only ever
18
+ * does `marks.has(...)`.
19
+ */
20
+ marks: Set<InlineMark>;
12
21
  }
13
22
  /**
14
23
  * Tracks source and selection, and derives what is under the caret.
@@ -44,6 +44,23 @@ export declare function convertBlock(kind: BlockKind, options?: ConvertOptions):
44
44
  * replacing every line and therefore every DOM node the reconciler had kept.
45
45
  */
46
46
  export declare function setFenceLanguage(language: string): Command;
47
+ /** The inline mark kinds a toolbar can show as active. */
48
+ export type InlineMark = "strong" | "emphasis" | "codeSpan" | "strike";
49
+ /**
50
+ * Every inline mark frame containing `offset`, read from the projection.
51
+ *
52
+ * SAME METHOD AS `constructAt`, for the same reason: the parser has already
53
+ * decided where a `**bold**` run starts and ends, including cases a regex
54
+ * would get wrong — a marker inside a code span, one split across an escaped
55
+ * character. A toolbar asking "is the caret inside bold" gets the parser's
56
+ * answer instead of re-deriving it from the source text a second time.
57
+ *
58
+ * Boundaries are INCLUSIVE on both ends, matching `constructAt` — a caret at
59
+ * either edge of `**bold**` still reads as inside it. This is a display
60
+ * nicety (which toolbar buttons light up), not a decision about where
61
+ * `toggleInline` wraps or unwraps, which reasons about the source directly.
62
+ */
63
+ export declare function marksAt(projection: Projection, offset: number): Set<InlineMark>;
47
64
  export interface ConstructInfo {
48
65
  kind: "link" | "image";
49
66
  /** Destination — `href` for a link, `src` for an image. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "6.3.7",
3
+ "version": "6.3.8",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",