@estiva-app/ui 0.62.1 → 0.63.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.
@@ -116,15 +116,21 @@ export interface ReferenceMenuOptions {
116
116
  ariaLabel: string;
117
117
  /** The section's heading. */
118
118
  sectionLabel: string;
119
- /** At each row's start: a 16px icon — unless the row brings its own (`CaptionedItem.icon`). */
119
+ /** At each row's start: a 16px icon — unless the row brings its own (`CaptionedItem.icon`), or `iconFor` answers. */
120
120
  icon: ReactNode;
121
+ /**
122
+ * A row's 16px icon from what it points at — its `uri` — when the list holds
123
+ * several kinds of thing; `undefined` from it draws `icon`. Give the chip the
124
+ * same answer at 14px (`CaptionedReference`'s `iconFor`), so a pick keeps it.
125
+ */
126
+ iconFor?: (uri: string) => ReactNode | undefined;
121
127
  }
122
128
  /**
123
129
  * The list `[` opens: `label: snippet` rows, the same box as the people list.
124
130
  * One section headed `sectionLabel`, or — when the rows say which section they
125
131
  * are in — a heading for each, in the order the rows arrive.
126
132
  */
127
- export declare function referenceMenu({ ariaLabel, sectionLabel, icon }: ReferenceMenuOptions): SuggestionPopupOptions<CaptionedItem>;
133
+ export declare function referenceMenu({ ariaLabel, sectionLabel, icon, iconFor }: ReferenceMenuOptions): SuggestionPopupOptions<CaptionedItem>;
128
134
  export interface ReferenceTriggerOptions extends ReferenceMenuOptions {
129
135
  /** Everything `[` can offer, asked each time the query changes. Narrowed by {@link filterReferences}. */
130
136
  items: () => readonly CaptionedItem[];
@@ -1 +1 @@
1
- {"version":3,"file":"ComposerTriggers.d.ts","sourceRoot":"","sources":["../src/ComposerTriggers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AAErD,OAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAMxE,OAAO,KAAK,E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CAM9D;AAMD,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,CAGpG;AAED,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAA;CAClC;AAID;;;;GAIG;AACH,eAAO,MAAM,aAAa,sCA6BxB,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * What a thing is, as the apps name it: a topic, a project, an issue, another
3
+ * app's file, or a message.
4
+ *
5
+ * The one part that names Estiva's own kinds of thing (Katerina, 8 October):
6
+ * every app draws the same icon for the same kind, so the table lives here once
7
+ * instead of in each app.
8
+ */
9
+ export type ThingKind = 'topic' | 'project' | 'issue' | 'file' | 'message';
10
+ /**
11
+ * The kind of thing behind an event kind: a message is a message, a channel or
12
+ * a bare file is a topic, a project and an issue are themselves, and anything
13
+ * else is another app's file.
14
+ */
15
+ export declare function thingKindOf(eventKind: number | undefined): ThingKind;
16
+ export interface KindIconProps {
17
+ kind: ThingKind;
18
+ /** 16 in a row or a list; 14 inside a chip. Default 16. */
19
+ size?: 14 | 16;
20
+ /**
21
+ * `secondary`: the quieter grey a list row's icon wears. `inherit`: the ink
22
+ * of what holds it — a chip, a selected row. Default `secondary`.
23
+ */
24
+ tone?: 'secondary' | 'inherit';
25
+ /** Space and position only. */
26
+ className?: string;
27
+ }
28
+ /** The icon before a thing's name that says what kind of thing it is. */
29
+ export declare function KindIcon({ kind, size, tone, className }: KindIconProps): import("react").JSX.Element;
30
+ //# sourceMappingURL=KindIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KindIcon.d.ts","sourceRoot":"","sources":["../src/KindIcon.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAA;AAoB1E;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAMpE;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAA;IACf,2DAA2D;IAC3D,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,IAAkB,EAAE,SAAS,EAAE,EAAE,aAAa,+BAGzF"}
@@ -0,0 +1,33 @@
1
+ import { Extension } from '@tiptap/core';
2
+ /** As much of a `DataTransfer` as the paste reads. */
3
+ export interface ClipboardSource {
4
+ files?: ArrayLike<File> | null;
5
+ getData(format: string): string;
6
+ }
7
+ /** `'Screenshot 2026-09-07 14-32-05.png'`: sortable, and readable on a file card. */
8
+ export declare function pastedImageName(contentType: string, at?: Date, index?: number): string;
9
+ /**
10
+ * The pictures on the clipboard, named — `[]` when there is nothing to attach.
11
+ *
12
+ * **Text wins.** A copy from a spreadsheet or a document puts a rendered
13
+ * picture of the selection beside the text; attaching the picture instead of
14
+ * pasting the text is wrong every time. So a clipboard holding text is left to
15
+ * the editor, and a screenshot, which holds none, lands here. Pictures only:
16
+ * any other file comes through the app's own file picker.
17
+ */
18
+ export declare function pastedImages(source: ClipboardSource | null | undefined, at?: Date): File[];
19
+ export interface PastedImagesOptions {
20
+ /**
21
+ * The pictures a paste carried, named. Return `true` when the app took them
22
+ * (an upload started), `false` to let the editor paste as it would have —
23
+ * for a box that cannot upload right now.
24
+ */
25
+ onImages: (files: File[]) => boolean;
26
+ }
27
+ /**
28
+ * Pasting a picture attaches it: a screenshot pasted into the editor reaches
29
+ * the app as named files, the way the app's own file picker would hand them.
30
+ * Text on the clipboard wins (see {@link pastedImages}).
31
+ */
32
+ export declare const PastedImages: Extension<PastedImagesOptions, any>;
33
+ //# sourceMappingURL=PastedImages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PastedImages.d.ts","sourceRoot":"","sources":["../src/PastedImages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC,sDAAsD;AACtD,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;CAChC;AA0BD,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,GAAE,IAAiB,EAAE,KAAK,SAAI,GAAG,MAAM,CAO7F;AASD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,EAAE,EAAE,GAAE,IAAiB,GAAG,IAAI,EAAE,CAUtG;AAED,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,OAAO,CAAA;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,qCAmBvB,CAAA"}
package/dist/editor.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  * `Toolbar`, `MenuItem`, `SuggestionMenu` — is the main entry's own, not a copy.
9
9
  */
10
10
  export { KeptSelection, SelectionToolbar, normalizeHref, type MarkId, type SelectionToolbarProps } from './SelectionToolbar';
11
+ export { PastedImages, pastedImages, pastedImageName, type PastedImagesOptions, type ClipboardSource } from './PastedImages';
11
12
  export { suggestionPopup, isSuggestionActive, isSuggestionOpen, type SuggestionPopupOptions } from './suggestionPopup';
12
13
  export { EditorBlockHandle, blockDropCursor, deleteBlock, moveBlock, duplicateBlock, startBlockDrag, type EditorBlockHandleProps, type BlockTurnInto } from './EditorBlockHandle';
13
14
  export { PersonMention, UrgentPersonMention, CaptionedReference, ReferenceTrigger, SlashCommands, peopleMenu, referenceMenu, filterPeople, urgentPubkeys, filterReferences, formatSection, applyFormat, typeTrigger, filterSlashSections, FORMATS, type MentionPerson, type PersonMentionOptions, type CaptionedItem, type CaptionedReferenceOptions, type ReferenceTriggerOptions, type ReferenceMenuOptions, type SlashCommand, type SlashSection, type SlashCommandsOptions, type FormatId, type FormatDef, type CodeFormat, } from './ComposerTriggers';
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC5H,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AACtH,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,sBAAsB,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACjL,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,O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,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAA"}
package/dist/editor.js CHANGED
@@ -280,6 +280,64 @@ function SelectionToolbar({ editor, marks = ["bold", "italic", "underline"], lin
280
280
  );
281
281
  }
282
282
 
283
+ // src/PastedImages.ts
284
+ import { Extension as Extension2 } from "@tiptap/core";
285
+ import { Plugin as Plugin2, PluginKey as PluginKey2 } from "@tiptap/pm/state";
286
+ var IMAGE_EXTENSIONS = {
287
+ "image/png": "png",
288
+ "image/jpeg": "jpg",
289
+ "image/gif": "gif",
290
+ "image/webp": "webp",
291
+ "image/heic": "heic",
292
+ "image/heif": "heif",
293
+ "image/svg+xml": "svg"
294
+ };
295
+ var GENERIC_STEMS = /* @__PURE__ */ new Set(["image", "blob", "unknown", "untitled", "screenshot"]);
296
+ function extensionFor(contentType) {
297
+ const type = contentType.toLowerCase();
298
+ return IMAGE_EXTENSIONS[type] ?? type.split("/")[1]?.split("+")[0] ?? "png";
299
+ }
300
+ function pastedImageName(contentType, at = /* @__PURE__ */ new Date(), index = 0) {
301
+ const pad = (n) => String(n).padStart(2, "0");
302
+ const stamp = `${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())} ${pad(at.getHours())}-${pad(at.getMinutes())}-${pad(at.getSeconds())}`;
303
+ const nth = index > 0 ? ` (${index + 1})` : "";
304
+ return `Screenshot ${stamp}${nth}.${extensionFor(contentType)}`;
305
+ }
306
+ function hasUsableName(name) {
307
+ const dot = name.lastIndexOf(".");
308
+ if (dot <= 0 || dot === name.length - 1) return false;
309
+ return !GENERIC_STEMS.has(name.slice(0, dot).toLowerCase());
310
+ }
311
+ function pastedImages(source, at = /* @__PURE__ */ new Date()) {
312
+ if (!source) return [];
313
+ if (source.getData("text/plain").trim() !== "") return [];
314
+ const images = Array.from(source.files ?? []).filter((f) => f.type.toLowerCase().startsWith("image/"));
315
+ let generated = 0;
316
+ return images.map(
317
+ (file) => hasUsableName(file.name) ? file : new File([file], pastedImageName(file.type, at, generated++), { type: file.type, lastModified: file.lastModified })
318
+ );
319
+ }
320
+ var PastedImages = Extension2.create({
321
+ name: "pastedImages",
322
+ addOptions() {
323
+ return { onImages: () => false };
324
+ },
325
+ addProseMirrorPlugins() {
326
+ const options = this.options;
327
+ return [
328
+ new Plugin2({
329
+ key: new PluginKey2("pastedImages"),
330
+ props: {
331
+ handlePaste: (_view, event) => {
332
+ const files = pastedImages(event.clipboardData);
333
+ return files.length > 0 && options.onImages(files);
334
+ }
335
+ }
336
+ })
337
+ ];
338
+ }
339
+ });
340
+
283
341
  // src/suggestionPopup.tsx
284
342
  import { forwardRef, useRef as useRef2, useImperativeHandle } from "react";
285
343
  import { ReactRenderer } from "@tiptap/react";
@@ -503,8 +561,8 @@ function EditorBlockHandle({ editor, turnInto = [], actions, children, className
503
561
  }
504
562
 
505
563
  // src/ComposerTriggers.tsx
506
- import { Extension as Extension2 } from "@tiptap/core";
507
- import { PluginKey as PluginKey2 } from "@tiptap/pm/state";
564
+ import { Extension as Extension3 } from "@tiptap/core";
565
+ import { PluginKey as PluginKey3 } from "@tiptap/pm/state";
508
566
  import Mention from "@tiptap/extension-mention";
509
567
  import Suggestion from "@tiptap/suggestion";
510
568
  import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
@@ -665,7 +723,7 @@ var CaptionedReference = Mention.extend({
665
723
  );
666
724
  }
667
725
  });
668
- function referenceMenu({ ariaLabel, sectionLabel, icon }) {
726
+ function referenceMenu({ ariaLabel, sectionLabel, icon, iconFor }) {
669
727
  return {
670
728
  ariaLabel,
671
729
  width: "w-[658px]",
@@ -681,11 +739,11 @@ function referenceMenu({ ariaLabel, sectionLabel, icon }) {
681
739
  return groups;
682
740
  },
683
741
  itemKey: (item) => `reference-${item.id}`,
684
- row: (item) => ({ leading: item.icon ?? icon, label: captionOf(item.label, item.snippet), description: item.description, hint: /* @__PURE__ */ jsx4(EnterHint, {}) })
742
+ row: (item) => ({ leading: item.icon ?? iconFor?.(item.uri) ?? icon, label: captionOf(item.label, item.snippet), description: item.description, hint: /* @__PURE__ */ jsx4(EnterHint, {}) })
685
743
  };
686
744
  }
687
745
  var listed = (options, query) => options.sections ? options.sections(query).flatMap((section) => section.items.map((item) => ({ ...item, section: section.label }))) : filterReferences(options.items(), query);
688
- var ReferenceTrigger = Extension2.create({
746
+ var ReferenceTrigger = Extension3.create({
689
747
  name: "referenceTrigger",
690
748
  addOptions() {
691
749
  return { items: () => [], nodeName: "captionedReference", ariaLabel: "References", sectionLabel: "References", icon: null };
@@ -696,7 +754,7 @@ var ReferenceTrigger = Extension2.create({
696
754
  Suggestion({
697
755
  editor: this.editor,
698
756
  char: "[",
699
- pluginKey: new PluginKey2("referenceTrigger"),
757
+ pluginKey: new PluginKey3("referenceTrigger"),
700
758
  ...listening("]"),
701
759
  // As a mention's: only where the chip may go.
702
760
  allow: ({ state, range }) => {
@@ -774,7 +832,7 @@ function filterSlashSections(sections, query) {
774
832
  const q = query.toLowerCase();
775
833
  return sections.map((section) => ({ ...section, commands: q ? section.commands.filter((command) => matches(command, q)) : section.commands }));
776
834
  }
777
- var SlashCommands = Extension2.create({
835
+ var SlashCommands = Extension3.create({
778
836
  name: "slashCommands",
779
837
  addOptions() {
780
838
  return { sections: [formatSection()] };
@@ -786,7 +844,7 @@ var SlashCommands = Extension2.create({
786
844
  editor: this.editor,
787
845
  char: "/",
788
846
  startOfLine: false,
789
- pluginKey: new PluginKey2("slashCommands"),
847
+ pluginKey: new PluginKey3("slashCommands"),
790
848
  items: ({ query }) => filterSlashSections(sections, query).flatMap((section, at) => section.commands.map((command) => ({ ...command, section: at }))),
791
849
  command: ({ editor, range, props }) => {
792
850
  editor.chain().focus().deleteRange(range).run();
@@ -806,8 +864,8 @@ var SlashCommands = Extension2.create({
806
864
  });
807
865
 
808
866
  // src/BlockNodes.tsx
809
- import { Extension as Extension3, Node as Node2 } from "@tiptap/core";
810
- import { Plugin as Plugin2, PluginKey as PluginKey3 } from "@tiptap/pm/state";
867
+ import { Extension as Extension4, Node as Node2 } from "@tiptap/core";
868
+ import { Plugin as Plugin3, PluginKey as PluginKey4 } from "@tiptap/pm/state";
811
869
  import { Mapping, ReplaceAroundStep } from "@tiptap/pm/transform";
812
870
  import { NodeViewWrapper as NodeViewWrapper2, ReactNodeViewRenderer as ReactNodeViewRenderer2 } from "@tiptap/react";
813
871
  import { jsx as jsx5 } from "react/jsx-runtime";
@@ -955,7 +1013,7 @@ function bringsInBlocks(transactions) {
955
1013
  })
956
1014
  );
957
1015
  }
958
- var BlockId = Extension3.create({
1016
+ var BlockId = Extension4.create({
959
1017
  name: "blockId",
960
1018
  onCreate() {
961
1019
  const { state, view } = this.editor;
@@ -967,8 +1025,8 @@ var BlockId = Extension3.create({
967
1025
  },
968
1026
  addProseMirrorPlugins() {
969
1027
  return [
970
- new Plugin2({
971
- key: new PluginKey3("blockIdSplit"),
1028
+ new Plugin3({
1029
+ key: new PluginKey4("blockIdSplit"),
972
1030
  appendTransaction: (transactions, old, state) => {
973
1031
  if (!bringsInBlocks(transactions)) return null;
974
1032
  const mapping = new Mapping();
@@ -1105,6 +1163,7 @@ export {
1105
1163
  EditorBlockHandle,
1106
1164
  FORMATS,
1107
1165
  KeptSelection,
1166
+ PastedImages,
1108
1167
  PersonMention,
1109
1168
  ReferenceNode,
1110
1169
  ReferenceTrigger,
@@ -1124,6 +1183,8 @@ export {
1124
1183
  isSuggestionOpen,
1125
1184
  moveBlock,
1126
1185
  normalizeHref,
1186
+ pastedImageName,
1187
+ pastedImages,
1127
1188
  peopleMenu,
1128
1189
  referenceMenu,
1129
1190
  startBlockDrag,