@k2b/ui 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/actions/Dropdown.js +1 -0
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/content/MapView.js +128 -13
- package/dist/browser/content/MapView.js.map +1 -1
- package/dist/browser/content/MapViewFrame.js +1 -1
- package/dist/browser/content/MapViewFrame.js.map +1 -1
- package/dist/browser/content/MatchText.js +61 -0
- package/dist/browser/content/MatchText.js.map +1 -0
- package/dist/browser/content/index.js +2 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/map-view-glyphs.js +23 -0
- package/dist/browser/content/map-view-glyphs.js.map +1 -0
- package/dist/browser/content/map-view-live.js +45 -22
- package/dist/browser/content/map-view-live.js.map +1 -1
- package/dist/browser/content/map-view-snapshot.js +191 -0
- package/dist/browser/content/map-view-snapshot.js.map +1 -0
- package/dist/browser/content/map-view-types.js.map +1 -1
- package/dist/browser/inputs/Combobox.js +139 -62
- package/dist/browser/inputs/Combobox.js.map +1 -1
- package/dist/browser/inputs/TextInput.js +1 -1
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +73 -70
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/ScrollArea.js +4 -1
- package/dist/browser/layout/ScrollArea.js.map +1 -1
- package/dist/browser/text-editor/TextEditor.js +1358 -0
- package/dist/browser/text-editor/TextEditor.js.map +1 -0
- package/dist/browser/text-editor/clipboard-html.js +152 -0
- package/dist/browser/text-editor/clipboard-html.js.map +1 -0
- package/dist/browser/text-editor/clipboard-loading.js +68 -0
- package/dist/browser/text-editor/clipboard-loading.js.map +1 -0
- package/dist/browser/text-editor/clipboard.js +51 -0
- package/dist/browser/text-editor/clipboard.js.map +1 -0
- package/dist/browser/text-editor/engine.js +125 -0
- package/dist/browser/text-editor/engine.js.map +1 -0
- package/dist/browser/text-editor/format.js +218 -0
- package/dist/browser/text-editor/format.js.map +1 -0
- package/dist/browser/text-editor/formatted.js +164 -0
- package/dist/browser/text-editor/formatted.js.map +1 -0
- package/dist/browser/text-editor/language.js +19 -0
- package/dist/browser/text-editor/language.js.map +1 -0
- package/dist/browser/text-editor/markdown-table.js +563 -0
- package/dist/browser/text-editor/markdown-table.js.map +1 -0
- package/dist/browser/text-editor/messages.js +233 -0
- package/dist/browser/text-editor/messages.js.map +1 -0
- package/dist/browser/text-editor/paste.js +115 -0
- package/dist/browser/text-editor/paste.js.map +1 -0
- package/dist/browser/text-editor/table.js +1760 -0
- package/dist/browser/text-editor/table.js.map +1 -0
- package/dist/browser/text-editor.js +5 -0
- package/dist/browser/text-editor.js.map +1 -0
- package/dist/ssr/actions/Dropdown.js +1 -0
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/content/MapView.js +128 -13
- package/dist/ssr/content/MapView.js.map +1 -1
- package/dist/ssr/content/MapViewFrame.js +1 -1
- package/dist/ssr/content/MapViewFrame.js.map +1 -1
- package/dist/ssr/content/MatchText.js +56 -0
- package/dist/ssr/content/MatchText.js.map +1 -0
- package/dist/ssr/content/index.js +2 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/map-view-glyphs.js +23 -0
- package/dist/ssr/content/map-view-glyphs.js.map +1 -0
- package/dist/ssr/content/map-view-snapshot.js +191 -0
- package/dist/ssr/content/map-view-snapshot.js.map +1 -0
- package/dist/ssr/content/map-view-types.js.map +1 -1
- package/dist/ssr/inputs/Combobox.js +66 -20
- package/dist/ssr/inputs/Combobox.js.map +1 -1
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +1 -1
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/ScrollArea.js +4 -1
- package/dist/ssr/layout/ScrollArea.js.map +1 -1
- package/dist/ssr/text-editor/TextEditor.js +1155 -0
- package/dist/ssr/text-editor/TextEditor.js.map +1 -0
- package/dist/ssr/text-editor/clipboard-html.js +152 -0
- package/dist/ssr/text-editor/clipboard-html.js.map +1 -0
- package/dist/ssr/text-editor/clipboard-loading.js +68 -0
- package/dist/ssr/text-editor/clipboard-loading.js.map +1 -0
- package/dist/ssr/text-editor/clipboard.js +51 -0
- package/dist/ssr/text-editor/clipboard.js.map +1 -0
- package/dist/ssr/text-editor/engine.js +125 -0
- package/dist/ssr/text-editor/engine.js.map +1 -0
- package/dist/ssr/text-editor/format.js +218 -0
- package/dist/ssr/text-editor/format.js.map +1 -0
- package/dist/ssr/text-editor/formatted.js +164 -0
- package/dist/ssr/text-editor/formatted.js.map +1 -0
- package/dist/ssr/text-editor/language.js +19 -0
- package/dist/ssr/text-editor/language.js.map +1 -0
- package/dist/ssr/text-editor/markdown-table.js +563 -0
- package/dist/ssr/text-editor/markdown-table.js.map +1 -0
- package/dist/ssr/text-editor/messages.js +233 -0
- package/dist/ssr/text-editor/messages.js.map +1 -0
- package/dist/ssr/text-editor/paste.js +115 -0
- package/dist/ssr/text-editor/paste.js.map +1 -0
- package/dist/ssr/text-editor/table.js +1760 -0
- package/dist/ssr/text-editor/table.js.map +1 -0
- package/dist/ssr/text-editor.js +5 -0
- package/dist/ssr/text-editor.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/types/actions/Dropdown.d.ts +2 -0
- package/dist/types/content/MapViewFrame.d.ts +1 -1
- package/dist/types/content/MatchText.d.ts +21 -0
- package/dist/types/content/index.d.ts +3 -1
- package/dist/types/content/map-view-glyphs.d.ts +5 -0
- package/dist/types/content/map-view-live.d.ts +1 -1
- package/dist/types/content/map-view-snapshot.d.ts +13 -0
- package/dist/types/content/map-view-types.d.ts +15 -0
- package/dist/types/inputs/Combobox.d.ts +12 -0
- package/dist/types/inputs/TextInput.d.ts +2 -1
- package/dist/types/layout/AppWorkspace.d.ts +4 -1
- package/dist/types/layout/ScrollArea.d.ts +2 -0
- package/dist/types/text-editor/TextEditor.d.ts +69 -0
- package/dist/types/text-editor/clipboard-html.d.ts +9 -0
- package/dist/types/text-editor/clipboard-loading.d.ts +8 -0
- package/dist/types/text-editor/clipboard.d.ts +20 -0
- package/dist/types/text-editor/engine.d.ts +34 -0
- package/dist/types/text-editor/format.d.ts +34 -0
- package/dist/types/text-editor/formatted.d.ts +1 -0
- package/dist/types/text-editor/language.d.ts +8 -0
- package/dist/types/text-editor/markdown-table.d.ts +105 -0
- package/dist/types/text-editor/messages.d.ts +113 -0
- package/dist/types/text-editor/paste.d.ts +6 -0
- package/dist/types/text-editor/table.d.ts +81 -0
- package/dist/types/text-editor.d.ts +4 -0
- package/package.json +24 -3
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { EditorState, type Extension, Facet } from "@codemirror/state";
|
|
2
|
+
import { EditorView } from "@codemirror/view";
|
|
3
|
+
import { type InlineFormat } from "./format";
|
|
4
|
+
import * as T from "./markdown-table";
|
|
5
|
+
export type TableTarget = {
|
|
6
|
+
tableFrom: number;
|
|
7
|
+
rowFrom: number;
|
|
8
|
+
columnFrom: number;
|
|
9
|
+
row: number;
|
|
10
|
+
column: number;
|
|
11
|
+
};
|
|
12
|
+
/** Resolve a server-returned identity against the current document immediately before focus. */
|
|
13
|
+
export type TableFocusTarget = () => TableTarget | null;
|
|
14
|
+
export type TableHost = {
|
|
15
|
+
undo: () => void;
|
|
16
|
+
redo: () => void;
|
|
17
|
+
boundary: () => void;
|
|
18
|
+
cellLabel: (row: number, column: number, name?: string) => string;
|
|
19
|
+
sourceLabels?: () => {
|
|
20
|
+
edit: string;
|
|
21
|
+
valid: string;
|
|
22
|
+
invalid: string;
|
|
23
|
+
changed: string;
|
|
24
|
+
structural: string;
|
|
25
|
+
applying?: string;
|
|
26
|
+
applyFailed?: string;
|
|
27
|
+
done: string;
|
|
28
|
+
discard: string;
|
|
29
|
+
continue: string;
|
|
30
|
+
line?: (line: number) => string;
|
|
31
|
+
separator?: (header: number, separator: number) => string;
|
|
32
|
+
extra?: (line: number) => string;
|
|
33
|
+
complete?: string;
|
|
34
|
+
};
|
|
35
|
+
actionLabel?: (action: "rowMenu" | "columnMenu" | "addRow" | "addColumn" | "emptyCell") => string;
|
|
36
|
+
/** Respect a host's personal Tab-for-focus preference inside cells too. */
|
|
37
|
+
tabMovesFocus?: () => boolean;
|
|
38
|
+
/** Capture durable anchors synchronously, then send the action to the owning server. */
|
|
39
|
+
structure?: {
|
|
40
|
+
available: () => boolean;
|
|
41
|
+
perform: (action: MenuAction, target: TableTarget) => Promise<TableFocusTarget | void>;
|
|
42
|
+
/** Resolves only after the confirmed update is applied; rejects without discarding the draft. */
|
|
43
|
+
replaceSource?: (target: TableTarget, expected: string, source: string, caret: {
|
|
44
|
+
row: number;
|
|
45
|
+
column: number;
|
|
46
|
+
}) => Promise<TableFocusTarget | void>;
|
|
47
|
+
};
|
|
48
|
+
onError: (code: "structureUnavailable" | "structureFailed" | "pasteTooLarge" | "textTooLarge" | "cellRemoved") => void;
|
|
49
|
+
onRecovery: (text: string) => void;
|
|
50
|
+
/** Cell focus is separate from CodeMirror contentDOM focus; collaboration maps these offsets to its own cursor. */
|
|
51
|
+
onCellSelection?: (selection: {
|
|
52
|
+
anchor: number;
|
|
53
|
+
head: number;
|
|
54
|
+
} | null) => void;
|
|
55
|
+
onDroppedImages?: (count: number, files: File[]) => void;
|
|
56
|
+
maxLength: number;
|
|
57
|
+
maxPasteCells: number;
|
|
58
|
+
/** App-owned presentation, e.g. formula results. Called only outside the active cell. */
|
|
59
|
+
renderCell?: (element: HTMLElement, raw: string, table: T.Table, row: number, column: number) => void;
|
|
60
|
+
};
|
|
61
|
+
export type MenuAction = "completeColumns" | "rowAbove" | "rowBelow" | "colLeft" | "colRight" | "deleteRow" | "deleteCol" | "moveRowUp" | "moveRowDown" | "moveColLeft" | "moveColRight" | "toggleHeader" | "deleteTable" | "alignLeft" | "alignCenter" | "alignRight";
|
|
62
|
+
export declare const tableHost: Facet<TableHost, TableHost | null>;
|
|
63
|
+
export declare const tablesIn: (state: EditorState) => T.Table[];
|
|
64
|
+
/** A local source draft for one table. Invalid drafts never replace shared text.
|
|
65
|
+
* Collaborative structure changes require the host's confirmed anchored action. */
|
|
66
|
+
export declare const editTableSource: (view: EditorView, wrap: HTMLElement) => void;
|
|
67
|
+
export declare const tableActionEnabled: (view: EditorView, wrap: HTMLElement, action: MenuAction) => boolean;
|
|
68
|
+
/** Copy the visible table through the browser clipboard, with spreadsheet and rich-text payloads. */
|
|
69
|
+
export declare const copyTable: (view: EditorView, wrap: HTMLElement, format: "table" | "markdown") => Promise<void>;
|
|
70
|
+
export declare const runMenuAction: (view: EditorView, wrap: HTMLElement, action: MenuAction) => void;
|
|
71
|
+
/** Structural actions also work in source mode, without a mounted table widget. */
|
|
72
|
+
export declare const runTableAction: (view: EditorView, tableFrom: number, r: number, c: number, action: MenuAction,
|
|
73
|
+
/** `false` when the gesture already moved the caret out of the table: the result must not pull it back. */
|
|
74
|
+
options?: {
|
|
75
|
+
follow?: boolean;
|
|
76
|
+
}) => void;
|
|
77
|
+
/** Route formatting to the active cell instead of the hidden outer-editor caret. */
|
|
78
|
+
export declare const formatActiveCell: (view: EditorView, name: InlineFormat) => boolean;
|
|
79
|
+
/** First `<table>` of pasted HTML as a grid (Excel, Sheets, Word, web pages). */
|
|
80
|
+
export declare const htmlTableGrid: (html: string) => string[][] | null;
|
|
81
|
+
export declare const tableGrid: () => Extension;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { createTextEditor, type TextEditorController, type TextEditorMode, type TextEditorOptions } from "./text-editor/engine";
|
|
2
|
+
export { commands as textEditorCommands, formatLabels as textEditorFormatLabels, type InlineFormat } from "./text-editor/format";
|
|
3
|
+
export { TableSizePicker, type TableSizePickerProps, TextEditor, type TextEditorControls, type TextEditorProps, } from "./text-editor/TextEditor";
|
|
4
|
+
export { editTableSource, type MenuAction, runMenuAction, runTableAction, type TableFocusTarget, type TableHost, type TableTarget, tableGrid, tableHost, } from "./text-editor/table";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k2b/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.0",
|
|
4
4
|
"description": "Production-ready components for SolidJS applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,7 +37,18 @@
|
|
|
37
37
|
"default": "./dist/ssr/charts.js"
|
|
38
38
|
},
|
|
39
39
|
"./package.json": "./package.json",
|
|
40
|
-
"./map-glyphs/*": "./map-glyphs/*"
|
|
40
|
+
"./map-glyphs/*": "./map-glyphs/*",
|
|
41
|
+
"./text-editor": {
|
|
42
|
+
"types": "./dist/types/text-editor.d.ts",
|
|
43
|
+
"browser": "./dist/browser/text-editor.js",
|
|
44
|
+
"import": "./dist/ssr/text-editor.js",
|
|
45
|
+
"default": "./dist/ssr/text-editor.js"
|
|
46
|
+
},
|
|
47
|
+
"./text-editor/model": {
|
|
48
|
+
"types": "./dist/types/text-editor/markdown-table.d.ts",
|
|
49
|
+
"import": "./dist/ssr/text-editor/markdown-table.js",
|
|
50
|
+
"default": "./dist/ssr/text-editor/markdown-table.js"
|
|
51
|
+
}
|
|
41
52
|
},
|
|
42
53
|
"files": [
|
|
43
54
|
"dist",
|
|
@@ -55,12 +66,19 @@
|
|
|
55
66
|
"prepack": "bun run build"
|
|
56
67
|
},
|
|
57
68
|
"dependencies": {
|
|
69
|
+
"@codemirror/commands": "6.10.4",
|
|
70
|
+
"@codemirror/language": "6.12.4",
|
|
71
|
+
"@codemirror/state": "6.7.1",
|
|
72
|
+
"@codemirror/view": "6.43.7",
|
|
58
73
|
"@fontsource/ibm-plex-mono": "5.3.0",
|
|
59
74
|
"@fontsource/ibm-plex-sans": "5.3.0",
|
|
60
75
|
"@k2b/stdlib": "0.30.0",
|
|
76
|
+
"@lezer/markdown": "1.7.2",
|
|
61
77
|
"@tabler/icons-webfont": "3.48.0",
|
|
78
|
+
"dompurify": "3.4.17",
|
|
62
79
|
"maplibre-gl": "6.14.0",
|
|
63
80
|
"marked": "18.0.14",
|
|
81
|
+
"pbf": "5.1.2",
|
|
64
82
|
"qr-scanner": "1.4.2"
|
|
65
83
|
},
|
|
66
84
|
"peerDependencies": {
|
|
@@ -86,7 +104,10 @@
|
|
|
86
104
|
"typescript": "7.0.2",
|
|
87
105
|
"@typescript/typescript6": "6.0.2",
|
|
88
106
|
"@maplibre/maplibre-gl-style-spec": "26.4.4",
|
|
89
|
-
"fontnik": "0.7.7"
|
|
107
|
+
"fontnik": "0.7.7",
|
|
108
|
+
"yjs": "13.6.33",
|
|
109
|
+
"y-codemirror.next": "0.3.6",
|
|
110
|
+
"y-protocols": "1.0.7"
|
|
90
111
|
},
|
|
91
112
|
"publishConfig": {
|
|
92
113
|
"access": "public"
|