Skip to content

Commit 49c73f8

Browse files
chore: add @cosense/types and option-t dependencies
1 parent 4f8f91e commit 49c73f8

26 files changed

+100
-97
lines changed

browser/dom/_internal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Encodes `AddEventListenerOptions` into a number for equality comparison.
33
* This function converts the options object into a single number where each bit
44
* represents a specific option (capture, once, passive).
@@ -15,7 +15,7 @@ export const encode = (
1515
(options.passive ? 4 : 0)
1616
);
1717
};
18-
/**
18+
/**
1919
* Decodes a number back into `AddEventListenerOptions` object.
2020
* Each bit in the encoded number represents a specific option:
2121
*

browser/dom/selection.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export declare class Selection extends BaseStore<undefined> {
3636
*
3737
* @param range The selection range to normalize
3838
* @return The normalized range with start position at the beginning
39-
*
39+
*
4040
* This is useful when you need consistent text processing regardless of
4141
* whether the user selected text from top-to-bottom or bottom-to-top.
4242
*/

browser/dom/statusBar.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { statusBar } from "./dom.ts";
22

33
export interface UseStatusBarResult {
44
/** Display information in the acquired status bar section
5-
*
5+
*
66
* @param items Array of items to display (text, icons, or groups)
77
*/
88
render: (...items: Item[]) => void;
@@ -11,7 +11,7 @@ export interface UseStatusBarResult {
1111
}
1212

1313
/** Get a section of the status bar and return functions to manipulate it
14-
*
14+
*
1515
* The status bar is divided into sections, each managed independently.
1616
* This hook creates a new section and provides methods to:
1717
* - Display information (text and icons) in the section
@@ -77,7 +77,7 @@ const makeItem = (child: string | Node) => {
7777
};
7878

7979
/** Create a loading spinner icon
80-
*
80+
*
8181
* Creates a FontAwesome spinner icon wrapped in a status bar item.
8282
* Use this to indicate loading or processing states.
8383
*/
@@ -88,7 +88,7 @@ const makeSpinner = () => {
8888
};
8989

9090
/** Create a checkmark icon
91-
*
91+
*
9292
* Creates a Kamon checkmark icon wrapped in a status bar item.
9393
* Use this to indicate successful completion or confirmation.
9494
*/
@@ -99,7 +99,7 @@ const makeCheckCircle = () => {
9999
};
100100

101101
/** Create a warning icon
102-
*
102+
*
103103
* Creates a FontAwesome warning triangle icon wrapped in a status bar item.
104104
* Use this to indicate warnings, errors, or important notices.
105105
*/

browser/dom/stores.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import type { Selection } from "./selection.d.ts";
44
export type { Cursor, Selection };
55

66
/** Retrieve Scrapbox's internal cursor and selection stores from the DOM
7-
*
7+
*
88
* This function accesses React's internal fiber tree to obtain references to
99
* the Cursor and Selection store instances that Scrapbox uses to manage
1010
* text input state. These stores provide APIs for:
1111
* - Cursor: Managing text cursor position and movement
1212
* - Selection: Handling text selection ranges and operations
13-
*
13+
*
1414
* @throws {Error} If text input element or stores cannot be found
1515
* @returns Object containing cursor and selection store instances
1616
*/
@@ -52,7 +52,7 @@ export const takeStores = (): { cursor: Cursor; selection: Selection } => {
5252
};
5353

5454
/** Internal React Fiber node structure
55-
*
55+
*
5656
* This interface represents the minimal structure we need from React's
5757
* internal fiber tree to access Scrapbox's store instances. Note that
5858
* this is an implementation detail and might change with React updates.

browser/dom/takeInternalLines.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const takeInternalLines = (): readonly BaseLine[] => {
3838
};
3939

4040
/** Internal React Fiber node structure for accessing line data
41-
*
41+
*
4242
* This interface represents the minimal structure needed to access
4343
* the lines data from React's component props. This is an implementation
4444
* detail that depends on React's internal structure.

browser/dom/textInputEventListener.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { decode, encode } from "./_internal.ts";
44
declare const scrapbox: Scrapbox;
55

66
/** Map structure for tracking event listeners and their options
7-
*
7+
*
88
* Structure:
99
* - First level: Maps event names to their listeners
1010
* - Second level: Maps each listener to its set of encoded options
@@ -74,7 +74,7 @@ export const addTextInputEventListener = <K extends keyof HTMLElementEventMap>(
7474
const encoded = encode(options);
7575

7676
/** A wrapper listener that removes itself from the `listenerMap` when called
77-
*
77+
*
7878
* This wrapper ensures proper cleanup of both the DOM event listener and our
7979
* internal listener tracking when a 'once' listener is triggered.
8080
*/

browser/websocket/_codeBlock.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import { extractFromCodeTitle } from "./_codeBlock.ts";
44

55
/**
66
* Tests for code block title parsing functionality
7-
*
7+
*
88
* These tests verify the parsing of code block titles in various formats:
99
* - Valid formats: code:filename.ext(param), code:filename(param), code:filename.ext
1010
* - Invalid formats: trailing dots, incorrect prefixes, non-code blocks
1111
*/
1212
Deno.test("extractFromCodeTitle()", async (t) => {
1313
await t.step("accurate titles", async (st) => {
1414
const titles = [
15-
"code:foo.extA(extB)", // Basic format: no spaces
16-
" code:foo.extA(extB)", // Leading space before code:
17-
" code: foo.extA (extB)", // Spaces around components
18-
" code: foo (extB) ", // Extension omitted, has parameter
19-
" code: foo.extA ", // Extension only, no parameter
20-
" code: foo ", // Basic name only
21-
" code: .foo ", // Leading dot in name
15+
"code:foo.extA(extB)", // Basic format: no spaces
16+
" code:foo.extA(extB)", // Leading space before code:
17+
" code: foo.extA (extB)", // Spaces around components
18+
" code: foo (extB) ", // Extension omitted, has parameter
19+
" code: foo.extA ", // Extension only, no parameter
20+
" code: foo ", // Basic name only
21+
" code: .foo ", // Leading dot in name
2222
];
2323
for (const title of titles) {
2424
await st.step(`"${title}"`, async (sst) => {
@@ -30,9 +30,9 @@ Deno.test("extractFromCodeTitle()", async (t) => {
3030
await t.step("inaccurate titles", async (st) => {
3131
const nonTitles = [
3232
" code: foo. ", // Invalid: Trailing dot without extension is not a valid code block format
33-
// Returning `null` is expected as this format is invalid
34-
"any:code: foo ", // Invalid: Must start with exactly "code:" prefix
35-
" I'm not code block ", // Invalid: Not a code block format at all
33+
// Returning `null` is expected as this format is invalid
34+
"any:code: foo ", // Invalid: Must start with exactly "code:" prefix
35+
" I'm not code block ", // Invalid: Not a code block format at all
3636
];
3737
for (const title of nonTitles) {
3838
await st.step(`"${title}"`, async () => {

browser/websocket/_codeBlock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { TinyCodeBlock } from "../../rest/getCodeBlocks.ts";
22

33
/** Interface for storing code block title line information
4-
*
4+
*
55
* In Scrapbox, code blocks start with a title line that defines:
66
* - The code's filename or language identifier
77
* - Optional language specification in parentheses
@@ -55,7 +55,7 @@ export const extractFromCodeTitle = (lineText: string): CodeTitle | null => {
5555
};
5656

5757
/** Calculate the indentation level for code block content
58-
*
58+
*
5959
* The content of a code block is indented one level deeper than its title line.
6060
* This function determines the correct indentation by analyzing the title line's
6161
* whitespace and adding one additional level.

browser/websocket/applyCommit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface ApplyCommitProp {
1717
* - Track who made each line modification
1818
* - Associate changes with user accounts
1919
* - Maintain edit history and attribution
20-
*/
20+
*/
2121
userId: string;
2222
}
2323

browser/websocket/change.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ export interface TitleChange {
4949
}
5050
export interface FilesChange {
5151
/** Array of file IDs
52-
*
52+
*
5353
* These IDs reference files that have been uploaded to the page.
5454
* Files can include images, documents, or other attachments.
5555
*/
5656
files: string[];
5757
}
5858
export interface HelpFeelsChange {
5959
/** Array of Helpfeel entries without the leading "? " prefix
60-
*
60+
*
6161
* Helpfeel is a Scrapbox notation for creating help/documentation entries.
6262
* Example: "? How to use" becomes "How to use" in this array.
6363
* These entries are used to build the page's help documentation.
@@ -66,7 +66,7 @@ export interface HelpFeelsChange {
6666
}
6767
export interface infoboxDefinitionChange {
6868
/** Array of trimmed lines from infobox tables
69-
*
69+
*
7070
* Contains lines from tables marked with either:
7171
* - `table:infobox`: Standard information box format
7272
* - `table:cosense`: Custom information box format

0 commit comments

Comments
 (0)