@k2b/ui 0.19.0 → 0.20.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.
Files changed (43) hide show
  1. package/dist/browser/actions/GestureMenu.js +467 -0
  2. package/dist/browser/actions/GestureMenu.js.map +1 -0
  3. package/dist/browser/actions/index.js +1 -0
  4. package/dist/browser/actions/index.js.map +1 -1
  5. package/dist/browser/chat/ChatComposer.js +3 -41
  6. package/dist/browser/chat/ChatComposer.js.map +1 -1
  7. package/dist/browser/chat/ChatPrimitives.js +9 -3
  8. package/dist/browser/chat/ChatPrimitives.js.map +1 -1
  9. package/dist/browser/chat/ChatTimeline.js +19 -1
  10. package/dist/browser/chat/ChatTimeline.js.map +1 -1
  11. package/dist/browser/content/MessageRow.js +2 -2
  12. package/dist/browser/content/MessageRow.js.map +1 -1
  13. package/dist/browser/inputs/TextInput.js +13 -1
  14. package/dist/browser/inputs/TextInput.js.map +1 -1
  15. package/dist/browser/inputs/markdown/actions.js +0 -42
  16. package/dist/browser/inputs/markdown/actions.js.map +1 -1
  17. package/dist/browser/intl/messages.js +0 -6
  18. package/dist/browser/intl/messages.js.map +1 -1
  19. package/dist/ssr/actions/GestureMenu.js +411 -0
  20. package/dist/ssr/actions/GestureMenu.js.map +1 -0
  21. package/dist/ssr/actions/index.js +1 -0
  22. package/dist/ssr/actions/index.js.map +1 -1
  23. package/dist/ssr/chat/ChatComposer.js +3 -41
  24. package/dist/ssr/chat/ChatComposer.js.map +1 -1
  25. package/dist/ssr/chat/ChatPrimitives.js +9 -3
  26. package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
  27. package/dist/ssr/chat/ChatTimeline.js +19 -1
  28. package/dist/ssr/chat/ChatTimeline.js.map +1 -1
  29. package/dist/ssr/content/MessageRow.js +2 -2
  30. package/dist/ssr/content/MessageRow.js.map +1 -1
  31. package/dist/ssr/inputs/TextInput.js +13 -1
  32. package/dist/ssr/inputs/TextInput.js.map +1 -1
  33. package/dist/ssr/inputs/markdown/actions.js +0 -42
  34. package/dist/ssr/inputs/markdown/actions.js.map +1 -1
  35. package/dist/ssr/intl/messages.js +0 -6
  36. package/dist/ssr/intl/messages.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/types/actions/GestureMenu.d.ts +35 -0
  39. package/dist/types/actions/index.d.ts +2 -0
  40. package/dist/types/chat/ChatComposer.d.ts +4 -1
  41. package/dist/types/inputs/markdown/actions.d.ts +0 -2
  42. package/dist/types/intl/messages.d.ts +0 -3
  43. package/package.json +2 -2
@@ -0,0 +1,35 @@
1
+ import { type JSX } from "solid-js";
2
+ import { type DropdownAction, type DropdownActionBase, type DropdownChoice, type DropdownSection } from "./Dropdown";
3
+ export type GestureKind = "swipe-right" | "swipe-left" | "double-tap";
4
+ /** A menu action that a gesture runs as well. */
5
+ export type GestureMenuAction = DropdownActionBase & {
6
+ action: () => void;
7
+ /** The gesture that runs this action. Give each gesture to at most one item; a disabled item disables its gesture. */
8
+ gesture?: GestureKind;
9
+ };
10
+ export type GestureMenuSection = Omit<DropdownSection, "items"> & {
11
+ items: readonly (GestureMenuAction | DropdownAction | DropdownChoice)[];
12
+ };
13
+ export type GestureMenuItem = GestureMenuAction | DropdownAction | DropdownChoice | GestureMenuSection;
14
+ export type GestureMenuProps = {
15
+ /**
16
+ * The menu. A long press opens it as a bottom sheet, a right-click, the Context Menu key, or Shift+F10 as a menu.
17
+ * An item with `gesture` is also run by that gesture, so every gesture has its entry here.
18
+ */
19
+ items: readonly GestureMenuItem[];
20
+ /** Names the element and its menu, for example "Message from Nora, 10:42". */
21
+ label: string;
22
+ children: JSX.Element;
23
+ /** Shown above the menu in the long-press sheet, for example a row of quick reactions. `close` closes the sheet. */
24
+ sheetTop?: (close: () => void) => JSX.Element;
25
+ /** Tab order of the element. A list that moves focus between its rows itself passes -1. */
26
+ tabIndex?: number;
27
+ class?: string;
28
+ };
29
+ /**
30
+ * Touch gestures for an element, each the shortcut of an entry in its menu: a horizontal swipe, a double tap, and a
31
+ * long press that opens the whole menu as a `BottomSheet`. A mouse double-click runs the double-tap action; a
32
+ * right-click and the keyboard open the menu beside the element. Vertical scrolling never turns into a swipe.
33
+ */
34
+ export declare function GestureMenu(props: GestureMenuProps): JSX.Element;
35
+ export default GestureMenu;
@@ -10,6 +10,8 @@ export type { DropdownAction, DropdownActionBase, DropdownChoice, DropdownItemPr
10
10
  export { Dropdown, DropdownItem, dropdownPosition } from "./Dropdown";
11
11
  export type { FilterChipOption, FilterChipProps, FilterChipSection } from "./FilterChip";
12
12
  export { FilterChip } from "./FilterChip";
13
+ export type { GestureKind, GestureMenuAction, GestureMenuItem, GestureMenuProps, GestureMenuSection } from "./GestureMenu";
14
+ export { GestureMenu } from "./GestureMenu";
13
15
  export type { RemoveButtonProps } from "./RemoveButton";
14
16
  export { RemoveButton } from "./RemoveButton";
15
17
  export type { SegmentedControlProps, SegmentOption } from "./SegmentedControl";
@@ -86,7 +86,10 @@ export type ChatComposerProps = {
86
86
  variant?: "default" | "conversation";
87
87
  /** `"enter"` (default): Enter sends and Shift+Enter breaks the line. `"mod-enter"`: Enter breaks the line. Ctrl/⌘+Enter always sends. */
88
88
  sendKey?: "enter" | "mod-enter";
89
- /** Adds "Aa", which opens one row of Markdown formatting buttons above the field; the field and its controls stay put. */
89
+ /**
90
+ * Adds "Aa", which opens one row above the field with Bold, Italic and Bullet list (Ctrl/⌘+B, Ctrl/⌘+I, Ctrl/⌘+Shift+8);
91
+ * the field and its controls stay put. Other Markdown is typed by hand.
92
+ */
90
93
  formatting?: boolean;
91
94
  /** An emoji button at a fixed place. Touch-only devices hide it; their keyboard has emoji. */
92
95
  emoji?: ChatComposerEmoji;
@@ -6,7 +6,5 @@ export declare const toggleInlineMarker: (textarea: HTMLTextAreaElement, marker:
6
6
  export declare const insertLink: (textarea: HTMLTextAreaElement, url?: string) => void;
7
7
  export declare const toggleHeading: (textarea: HTMLTextAreaElement, level: 1 | 2 | 3) => void;
8
8
  export declare const toggleBulletList: (textarea: HTMLTextAreaElement) => void;
9
- /** Puts the selected lines between ``` fences. Inside a fenced block, from its opening line on, it removes that block's fences. */
10
- export declare const toggleCodeBlock: (textarea: HTMLTextAreaElement) => void;
11
9
  export declare const toggleQuote: (textarea: HTMLTextAreaElement) => void;
12
10
  export declare const toggleNumberedList: (textarea: HTMLTextAreaElement) => void;
@@ -456,9 +456,6 @@ declare const uiMessages: import("@k2b/stdlib").Catalog<{
456
456
  writeMessage: string;
457
457
  writeConversationMessage: string;
458
458
  composerFormatting: string;
459
- strikethroughShortcut: string;
460
- codeBlock: string;
461
- insertLink: string;
462
459
  insertEmoji: string;
463
460
  emojiSuggestions: string;
464
461
  dictate: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k2b/ui",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Production-ready components for SolidJS applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "fixture:build": "bun run build && NODE_ENV=production bun run fixture/scripts/build.ts",
39
39
  "fixture:typecheck": "tsc -p fixture/tsconfig.json --noEmit --pretty false",
40
40
  "test": "bun run build && bun test --path-ignore-patterns '**/*.behavior.test.*' src scripts && bun run scripts/check-packed-consumer.ts",
41
- "typecheck": "tsc -p tsconfig.json --noEmit --pretty false && bun run check:declarations && bun run typecheck:dom",
41
+ "typecheck": "tsc --checkers 2 -p tsconfig.json --noEmit --pretty false && bun run check:declarations && bun run typecheck:dom",
42
42
  "typecheck:dom": "tsc -p test/tsconfig.json --noEmit --pretty false",
43
43
  "prepack": "bun run build"
44
44
  },