buckyos 0.7.205 → 0.7.206

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,148 @@
1
+ import { type TransferableContentRef, type ZoneContent } from './content';
2
+ /** Zone content reference list: `{"v":1,"items":[ZoneContent…]}`. */
3
+ export declare const CONTENT_REFS_FORMAT = "application/vnd.buckyos.content-refs+json";
4
+ /** Transfer handle: `{"v":1,"offerId":"…"}`, pointing at a record the desktop keeps (cut, large, deferred or private content). */
5
+ export declare const TRANSFER_HANDLE_FORMAT = "application/vnd.buckyos.transfer+json";
6
+ /** The `text/html` attributes of the typed table. */
7
+ export declare const TYPED_TABLE_ATTR = "data-buckyos-table";
8
+ export declare const TYPED_VALUE_ATTR = "data-buckyos-value";
9
+ /** The `text/html` attribute that marks a link as an embedded content reference: `{"v":1,"kind":"file"|"folder"}`. */
10
+ export declare const CONTENT_REF_ATTR = "data-buckyos-ref";
11
+ /** The `text/html` attribute that carries the transfer handle where the dedicated MIME type cannot travel. */
12
+ export declare const TRANSFER_HANDLE_ATTR = "data-buckyos-transfer";
13
+ /** The async clipboard name of a non-standard format (Chromium Web custom formats). */
14
+ export declare const webClipboardFormat: (format: string) => string;
15
+ /** The most items one content reference list carries; a larger selection needs a transfer handle. */
16
+ export declare const MAX_CONTENT_REFS = 10000;
17
+ /** One item's representations by format name: the strings a DataTransfer or a ClipboardItem carries. */
18
+ export type TransferRepresentations = Record<string, string>;
19
+ /** A `cyfs:///<path>` or `obj://<objId>[/<inner path>]` line as a reference; undefined when it is not one (any other
20
+ * scheme, a query or fragment, `.` / `..` segments, invalid names or escapes). Segments may be percent-encoded. */
21
+ export declare function parseBuckyosAddress(text: string): TransferableContentRef | undefined;
22
+ /** The address of a reference as a URI (`text/uri-list`, `href`): every path segment percent-encoded. */
23
+ export declare function buckyosAddressUri(ref: TransferableContentRef): string;
24
+ /** The references of a text when every non-empty line is a BuckyOS address (`text/uri-list` comment lines skipped);
25
+ * undefined when any line is something else. */
26
+ export declare function readBuckyosAddresses(text: string | undefined, options?: {
27
+ uriList?: boolean;
28
+ }): TransferableContentRef[] | undefined;
29
+ /** The dedicated value of a reference list. */
30
+ export declare function contentRefsValue(items: ZoneContent[]): string;
31
+ /** The items of a reference list value in order; undefined for another major version, a damaged value, an empty
32
+ * list or an invalid item. */
33
+ export declare function readContentRefs(value: string | undefined): ZoneContent[] | undefined;
34
+ /** The `<a>` links of a reference list, in order, each marked with its kind. */
35
+ export declare function contentRefsHtml(items: ZoneContent[]): string;
36
+ /** The reference list a `text/html` carries as marked links, in order (addresses only: no `objId`; the link text as
37
+ * the name). Undefined when there is no marked link or one of them is not valid. */
38
+ export declare function contentRefsFromHtml(html: string | undefined): ZoneContent[] | undefined;
39
+ /** Everything one write of a Zone selection puts down (§2.2): the list, a name per line, an address per line and the
40
+ * marked links. */
41
+ export declare function contentRefsRepresentations(items: ZoneContent[]): TransferRepresentations;
42
+ /** The field types of the system table standard (the AI Workspace standard table types, without `object_ref`). */
43
+ export declare const TABLE_FIELD_TYPES: readonly ["text", "boolean", "number", "decimal", "date", "datetime", "select", "multi_select", "currency", "json"];
44
+ export type TableFieldType = typeof TABLE_FIELD_TYPES[number];
45
+ export interface TypedTableField {
46
+ name: string;
47
+ type: TableFieldType;
48
+ /** decimal, currency: digits after the point (0–18). */
49
+ scale?: number;
50
+ /** currency: the default ISO 4217 code. */
51
+ currency?: string;
52
+ /** select, multi_select: the option labels. */
53
+ options?: string[];
54
+ }
55
+ /** A cell: its wire value (option labels, not ids; `{ amount, currency }` for money) and the text people see. An empty
56
+ * cell has neither. */
57
+ export interface TypedTableCell {
58
+ value?: unknown;
59
+ text?: string;
60
+ }
61
+ export interface TypedTable {
62
+ fields: TypedTableField[];
63
+ rows: TypedTableCell[][];
64
+ }
65
+ /** Whether a wire value has the shape its field type takes (the receiver still normalizes it). */
66
+ export declare function isTypedTableValue(field: TypedTableField, value: unknown): boolean;
67
+ /** A cell value as plain text: ISO dates, `TRUE` / `FALSE`, labels joined with `, `, `CNY 500.00`, JSON. */
68
+ export declare function typedTableText(field: TypedTableField, value: unknown): string;
69
+ /** A cell as spreadsheets take it, quoted when it holds a tab, quote or line break. */
70
+ export declare function typedTableTsvCell(field: TypedTableField, value: unknown): string;
71
+ /** One write of a table (§2.2): an HTML table carrying the field definitions and each cell's wire value, and a TSV
72
+ * with a header row. A cell's `text` is what the HTML shows; without it the TSV text is shown. */
73
+ export declare function typedTableRepresentations(table: TypedTable): {
74
+ 'text/html': string;
75
+ 'text/plain': string;
76
+ };
77
+ /** The definitions of a `data-buckyos-table` attribute; undefined for another major version or a damaged value. */
78
+ export declare function readTypedTableFields(attr: string | undefined): TypedTableField[] | undefined;
79
+ /** The first typed table of a `text/html`; undefined when there is none or its marks are not valid. The header row
80
+ * (`<th>` cells) is skipped; a cell value that does not fit its field keeps only its text. */
81
+ export declare function readTypedTable(html: string | undefined): TypedTable | undefined;
82
+ /** `cut` marks the handle of a cut: when the record is gone (a reload, another tab) the receiver can still tell the user
83
+ * that the cut expired instead of silently copying (§6). */
84
+ export interface TransferHandle {
85
+ v: 1;
86
+ offerId: string;
87
+ cut?: true;
88
+ }
89
+ /** A fresh high-entropy offer id (128 random bits, base64url). */
90
+ export declare function newOfferId(): string;
91
+ export declare const transferHandleValue: (offerId: string, options?: {
92
+ cut?: boolean;
93
+ }) => string;
94
+ export declare function readTransferHandle(value: string | undefined): TransferHandle | undefined;
95
+ /** The `text/html` of one write with the handle embedded, for paths that only carry Web standard formats (an async
96
+ * clipboard read of a copy-event write, a cross-origin WebKit paste). */
97
+ export declare function embedTransferHandle(html: string, offerId: string, options?: {
98
+ cut?: boolean;
99
+ }): string;
100
+ export declare function transferHandleFromHtml(html: string | undefined): TransferHandle | undefined;
101
+ /** What one paste or drop carried, taken while its event is dispatched. */
102
+ export interface TransferSnapshot {
103
+ /** Format names as the platform listed them, lower-case, without the `web ` prefix (`files` for files). */
104
+ types: string[];
105
+ /** String representations by format. */
106
+ data: Record<string, string>;
107
+ files: File[];
108
+ }
109
+ /** The format names a drag or clipboard event lists (all that `dragenter` / `dragover` may look at). */
110
+ export declare function transferTypes(dt: DataTransfer | null | undefined): string[];
111
+ /** Reads every string representation and the files of a DataTransfer. Call it before the event handler returns. */
112
+ export declare function snapshotDataTransfer(dt: DataTransfer | null | undefined): TransferSnapshot;
113
+ /** Puts representations on a DataTransfer (`dragstart`, `copy` / `cut` events). */
114
+ export declare function writeDataTransfer(dt: DataTransfer, representations: TransferRepresentations): void;
115
+ /**
116
+ * Writes representations to the system clipboard in one `ClipboardItem` (toolbar and menu commands, inside the user's
117
+ * gesture). Formats the browser cannot write are left out; when the custom ones make the write fail, the Web standard
118
+ * ones are written alone. Returns the formats written; throws when nothing could be written.
119
+ */
120
+ export declare function writeClipboard(representations: TransferRepresentations, options?: {
121
+ images?: Record<string, Blob>;
122
+ }): Promise<string[]>;
123
+ /** Reads the system clipboard (an explicit Paste button, inside the user's gesture). Throws when the browser refuses. */
124
+ export declare function readClipboard(): Promise<TransferSnapshot>;
125
+ export interface TransferReader {
126
+ snapshot: TransferSnapshot;
127
+ has(format: string): boolean;
128
+ /** A string representation by its registered name. */
129
+ get(format: string): string | undefined;
130
+ /** The transfer handle: the dedicated MIME type, then the `text/html` embedding. */
131
+ handle(): TransferHandle | undefined;
132
+ /** The Zone reference list: the dedicated MIME type, then the marked links of `text/html`. */
133
+ contentRefs(): {
134
+ items: ZoneContent[];
135
+ via: 'mime' | 'html';
136
+ } | undefined;
137
+ /** The typed table of `text/html`. */
138
+ typedTable(): TypedTable | undefined;
139
+ /** BuckyOS addresses: `text/uri-list`, then `text/plain`, when every line is one. */
140
+ addresses(): TransferableContentRef[] | undefined;
141
+ files: File[];
142
+ html: string | undefined;
143
+ text: string | undefined;
144
+ }
145
+ export declare function transferReader(snapshot: TransferSnapshot): TransferReader;
146
+ /** Whether a drag or paste may carry Zone references (from its types alone, as `dragover` sees them). */
147
+ export declare const mayCarryContentRefs: (types: string[]) =>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