@joinskips/brand 6.0.0-develop.126 → 6.0.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.
@@ -2,10 +2,8 @@ export declare const ATTACHMENT_TYPES: string[];
2
2
  export declare const MAX_ATTACHMENT_BYTES: number;
3
3
  /** A picked file's type: the picker's own, else the one its name says, else none. */
4
4
  export declare function attachmentType(name: string, given?: string | null): string;
5
- /** What attachmentProblem reads of a picked file. */
6
- export interface FileFacts {
5
+ /** Why a picked file cannot be sent, or null when it can. */
6
+ export declare function attachmentProblem(file: {
7
7
  type: string;
8
8
  size: number;
9
- }
10
- /** Why a picked file cannot be sent, or null when it can. */
11
- export declare function attachmentProblem(file: FileFacts): 'type' | 'size' | null;
9
+ }): 'type' | 'size' | null;
@@ -1,5 +1,4 @@
1
- export interface BubbleProps {
1
+ export declare function Bubble({ mine, text }: {
2
2
  mine?: boolean;
3
3
  text: string;
4
- }
5
- export declare function Bubble({ mine, text }: BubbleProps): import("react").JSX.Element;
4
+ }): import("react").JSX.Element;
@@ -1,6 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Text, View } from 'react-native';
3
3
  import { Markdown } from "./Markdown.js";
4
+ // The member's line in the accent and exactly as typed, Skips' on a card with its Markdown drawn, each with its
5
+ // tail corner tighter.
4
6
  export function Bubble({ mine = false, text }) {
5
7
  if (mine) {
6
8
  return (_jsx(Text, { className: "rounded-[20px] rounded-br-[7px] bg-accent px-4 py-2.5 font-ui text-md text-accent-ink", children: text }));
@@ -10,6 +10,7 @@ const AVATAR_SIZE = 32;
10
10
  export const PHOTO_RETRIES = 5;
11
11
  export const PHOTO_RETRY_MS = 1_500;
12
12
  const MIN_BOTTOM_SPACE = 12;
13
+ // React Native text inherits no font from the screen, so each line carries it.
13
14
  function Line({ className, ...props }) {
14
15
  return _jsx(Text, { className: `font-ui ${className}`, ...props });
15
16
  }
@@ -70,14 +71,11 @@ function ThreadRow({ item, words, onRetry, ...props }) {
70
71
  const sentAt = Math.max(...messages.map((m) => m.sentAt));
71
72
  return (_jsxs(View, { className: `max-w-[82%] gap-1 ${mine ? 'items-end self-end' : 'items-start self-start'}`, children: [messages.map((message, index) => (_jsxs(View, { className: "flex-row items-end gap-2", children: [mine ? null : index === messages.length - 1 ? (_jsx(SenderAvatar, { sender: sender, name: name, skipMark: props.skipMark })) : (_jsx(View, { className: "w-8" })), _jsxs(View, { className: `shrink gap-2 ${mine ? 'items-end' : 'items-start'}`, children: [message.attachments.map((attachment) => (_jsx(Attachment, { attachment: attachment, words: words, Icon: props.Icon }, attachment.url))), message.text ? _jsx(Bubble, { mine: mine, text: message.text }) : null] })] }, message.id))), _jsx(Line, { className: `px-1 text-xs text-ink-secondary ${mine ? '' : 'ml-10'}`, children: `${name} · ${words.messageTime(sentAt)}` })] }));
72
73
  }
73
- // A failed line is a button to send it again, and its note is announced.
74
- const BUTTON_ROLE = 'button';
75
- const ALERT_ROLE = 'alert';
76
74
  function Unsent({ message, words, onRetry, Icon, }) {
77
75
  const failed = message.delivery === 'failed';
78
- return (_jsxs(Pressable, { ...(failed ? { role: BUTTON_ROLE } : {}), disabled: !failed, onPress: () => {
76
+ return (_jsxs(Pressable, { ...(failed ? { role: 'button' } : {}), disabled: !failed, onPress: () => {
79
77
  onRetry(message.id);
80
- }, className: `max-w-[82%] items-end gap-1 self-end ${failed ? '' : 'opacity-70'}`, children: [message.file ? _jsx(PickedPreview, { picked: message.file, words: words, Icon: Icon }) : null, message.text ? _jsx(Bubble, { mine: true, text: message.text }) : null, _jsx(Line, { ...(failed ? { role: ALERT_ROLE } : {}), className: `px-1 text-xs ${failed ? 'text-error-ink' : 'text-ink-secondary'}`, children: `${words.you} · ${failed ? words.notSent : words.sending}` })] }));
78
+ }, className: `max-w-[82%] items-end gap-1 self-end ${failed ? '' : 'opacity-70'}`, children: [message.file ? _jsx(PickedPreview, { picked: message.file, words: words, Icon: Icon }) : null, message.text ? _jsx(Bubble, { mine: true, text: message.text }) : null, _jsx(Line, { ...(failed ? { role: 'alert' } : {}), className: `px-1 text-xs ${failed ? 'text-error-ink' : 'text-ink-secondary'}`, children: `${words.you} · ${failed ? words.notSent : words.sending}` })] }));
81
79
  }
82
80
  // Skip's mark, or a care team member's photo, or their initial when they have none or it does not load.
83
81
  function SenderAvatar({ sender, name, skipMark, }) {
@@ -89,10 +87,12 @@ function SenderAvatar({ sender, name, skipMark, }) {
89
87
  setFailed(true);
90
88
  }, style: { width: AVATAR_SIZE, height: AVATAR_SIZE } })) : (_jsx(Line, { className: "text-sm font-semibold text-ink", children: name.trim().charAt(0).toUpperCase() })) }));
91
89
  }
90
+ // Brand's attachment card, with what kind of file it is under the name.
92
91
  function FileCard({ name, detail, Icon }) {
93
92
  const secondary = useColor('ink-secondary');
94
93
  return (_jsxs(View, { className: "w-80 max-w-full flex-row items-center gap-3 rounded-control border border-line-subtle bg-surface p-3", children: [_jsx(Icon, { name: "file", color: secondary, size: 20 }), _jsxs(View, { className: "flex-1", children: [_jsx(Line, { className: "text-sm text-ink", numberOfLines: 1, children: name }), _jsx(Line, { className: "text-xs text-ink-secondary", children: detail })] })] }));
95
94
  }
95
+ // A picked file on its way: the photo itself, or a PDF's card with its size.
96
96
  function PickedPreview({ picked, words, Icon }) {
97
97
  if (isPhoto(picked)) {
98
98
  return (_jsx(Image, { source: { uri: picked.uri }, accessibilityLabel: `${words.photo} ${picked.name}`, resizeMode: "cover", className: "h-48 w-48 rounded-control bg-muted" }));
@@ -1,4 +1,3 @@
1
- export interface MarkdownProps {
1
+ export declare function Markdown({ text }: {
2
2
  text: string;
3
- }
4
- export declare function Markdown({ text }: MarkdownProps): import("react").JSX.Element;
3
+ }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Linking, Text, View } from 'react-native';
3
3
  import { readMarkdown } from "../markdown.js";
4
+ // A line from Skips as the care team wrote it: its Markdown drawn as text, with no HTML taken from it.
4
5
  function Inlines({ nodes }) {
5
6
  return nodes.map((node, i) => _jsx(InlineNode, { node: node }, `${String(i)}-${node.type}`));
6
7
  }
@@ -20,14 +20,14 @@ export interface WelcomeWords {
20
20
  codeRanOut: string;
21
21
  typing: string;
22
22
  }
23
- export interface WelcomeChoiceProps {
23
+ /** The choice under Skip's welcome: log in as a member, or go on here as someone new. */
24
+ export declare function WelcomeChoice({ words, onLogIn, onContinueHere, }: {
24
25
  words: WelcomeWords;
25
26
  onLogIn: () => void;
26
27
  onContinueHere: () => void;
27
- }
28
- /** The choice under Skip's welcome: log in as a member, or go on here as someone new. */
29
- export declare function WelcomeChoice({ words, onLogIn, onContinueHere, }: WelcomeChoiceProps): import("react").JSX.Element;
30
- export interface ChoicesProps {
28
+ }): import("react").JSX.Element;
29
+ /** The answers to Skip's question, all drawn alike. One answer only: while one is on its way, none can be pressed. */
30
+ export declare function Choices({ items, question, sending, holding, failed, words, onChoose, }: {
31
31
  items: ChoiceItem[];
32
32
  question: string;
33
33
  sending: string | null;
@@ -35,28 +35,24 @@ export interface ChoicesProps {
35
35
  failed: boolean;
36
36
  words: WelcomeWords;
37
37
  onChoose: (answer: ChoiceItem) => void;
38
- }
39
- /** The answers to Skip's question, all drawn alike. One answer only: while one is on its way, none can be pressed. */
40
- export declare function Choices({ items, question, sending, holding, failed, words, onChoose, }: ChoicesProps): import("react").JSX.Element;
41
- export interface EmailStepProps {
38
+ }): import("react").JSX.Element;
39
+ /** The email asked for after Continue here, and again for a visitor changing it. */
40
+ export declare function EmailStep({ words, onSubmit, initial, }: {
42
41
  words: WelcomeWords;
43
42
  onSubmit: (email: string) => void;
44
43
  initial?: string;
45
- }
46
- /** The email asked for after Continue here, and again for a visitor changing it. */
47
- export declare function EmailStep({ words, onSubmit, initial, }: EmailStepProps): import("react").JSX.Element;
48
- export interface NameStepProps {
44
+ }): import("react").JSX.Element;
45
+ /** The name asked of a visitor the Skips App does not know, with the way back to change a mistyped email. */
46
+ export declare function NameStep({ words, onSubmit, onChangeEmail, }: {
49
47
  words: WelcomeWords;
50
48
  onSubmit: (name: string) => void;
51
49
  onChangeEmail: () => void;
52
- }
53
- /** The name asked of a visitor the Skips App does not know, with the way back to change a mistyped email. */
54
- export declare function NameStep({ words, onSubmit, onChangeEmail, }: NameStepProps): import("react").JSX.Element;
50
+ }): import("react").JSX.Element;
55
51
  /**
56
52
  * The code emailed to the visitor, one digit to a box over one real field, so typing, deleting, a paste and the
57
53
  * phone's own code suggestion work as in any field. The chat mounts it afresh for each code that goes out.
58
54
  */
59
- export interface CodeStepProps {
55
+ export declare function CodeStep({ words, length, noMatch, ranOut, resendAfterMs, onSubmit, onResend, onChangeEmail, }: {
60
56
  words: WelcomeWords;
61
57
  length: number;
62
58
  noMatch: boolean;
@@ -65,14 +61,12 @@ export interface CodeStepProps {
65
61
  onSubmit: (code: string) => void;
66
62
  onResend: () => void;
67
63
  onChangeEmail: () => void;
68
- }
69
- export declare function CodeStep({ words, length, noMatch, ranOut, resendAfterMs, onSubmit, onResend, onChangeEmail, }: CodeStepProps): import("react").JSX.Element;
64
+ }): import("react").JSX.Element;
70
65
  export declare const DOT_REST_OPACITY = 0.35;
71
66
  export declare const DOT_RISE = 3;
72
67
  export declare const DOT_STILL_OPACITY = 0.6;
73
68
  /** Skip writing a reply: three dots rising in turn in Skip's bubble beside Skip's mark, announced as a status. */
74
- export interface SkipTypingProps {
69
+ export declare function SkipTyping({ label, skipMark }: {
75
70
  label: string;
76
71
  skipMark: ImageSourcePropType;
77
- }
78
- export declare function SkipTyping({ label, skipMark }: SkipTypingProps): import("react").JSX.Element;
72
+ }): import("react").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useId, useState } from 'react';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  import { AccessibilityInfo, ActivityIndicator, Animated, Image, Pressable, Text, TextInput, View } from 'react-native';
4
4
  import { DOT_CYCLE_MS } from "../skipTyping.js";
5
5
  import { codeDigits, completesCode, EMAIL_MAX_LENGTH, givenEmail, givenName, NAME_MAX_LENGTH, RESEND_AFTER_MS, resendClock, } from "../welcome.js";
@@ -23,16 +23,10 @@ export function Choices({ items, question, sending, holding = false, failed, wor
23
23
  onChoose(item);
24
24
  } }, item.value))) }), failed ? (_jsx(Text, { role: "alert", className: "font-ui text-sm text-error-ink", children: words.choiceNotSent })) : null] }));
25
25
  }
26
- // The error under a field, as the field's description. React Native's types leave aria-describedby out, and
27
- // react-native-web reads it.
28
- function describedBy(errorId) {
29
- return errorId === undefined ? {} : { 'aria-describedby': errorId };
30
- }
31
26
  // One thing asked of a new visitor: a field in focus and its button. What is typed is checked here and handed on.
32
27
  function StepField({ label, error, submitLabel, input, usable, onSubmit, initial = '', aside }) {
33
28
  const [typed, setTyped] = useState(initial);
34
29
  const [refused, setRefused] = useState(false);
35
- const errorId = useId();
36
30
  const placeholder = useColor('ink-placeholder');
37
31
  const submit = () => {
38
32
  const value = usable(typed);
@@ -40,7 +34,7 @@ function StepField({ label, error, submitLabel, input, usable, onSubmit, initial
40
34
  if (value !== null)
41
35
  onSubmit(value);
42
36
  };
43
- return (_jsxs(View, { className: "w-full max-w-[360px] gap-2 self-center", children: [aside ? (_jsx(View, { className: "self-center", children: _jsx(Pill, { label: aside.label, look: "flat", onPress: aside.onPress }) })) : null, _jsx(Text, { className: "font-ui text-sm font-medium text-ink", children: label }), _jsx(TextInput, { autoFocus: true, value: typed, onChangeText: setTyped, onSubmitEditing: submit, accessibilityLabel: label, "aria-invalid": refused, ...describedBy(refused ? errorId : undefined), placeholderTextColor: placeholder, className: `h-control rounded-control border bg-surface px-3 font-ui text-md text-ink ${refused ? 'border-error-ink' : 'border-line-control'}`, ...input }), refused ? (_jsx(Text, { nativeID: errorId, role: "alert", className: "font-ui text-sm text-error-ink", children: error })) : null, _jsx(View, { className: "self-center", children: _jsx(Pill, { label: submitLabel, onPress: submit }) })] }));
37
+ return (_jsxs(View, { className: "w-full max-w-[360px] gap-2 self-center", children: [aside ? (_jsx(View, { className: "self-center", children: _jsx(Pill, { label: aside.label, look: "flat", onPress: aside.onPress }) })) : null, _jsx(Text, { className: "font-ui text-sm font-medium text-ink", children: label }), _jsx(TextInput, { autoFocus: true, value: typed, onChangeText: setTyped, onSubmitEditing: submit, accessibilityLabel: label, "aria-invalid": refused, placeholderTextColor: placeholder, className: `h-control rounded-control border bg-surface px-3 font-ui text-md text-ink ${refused ? 'border-error-ink' : 'border-line-control'}`, ...input }), refused ? (_jsx(Text, { role: "alert", className: "font-ui text-sm text-error-ink", children: error })) : null, _jsx(View, { className: "self-center", children: _jsx(Pill, { label: submitLabel, onPress: submit }) })] }));
44
38
  }
45
39
  /** The email asked for after Continue here, and again for a visitor changing it. */
46
40
  export function EmailStep({ words, onSubmit, initial, }) {
@@ -51,6 +45,7 @@ export function NameStep({ words, onSubmit, onChangeEmail, }) {
51
45
  return (_jsx(StepField, { label: words.nameLabel, error: words.nameError, submitLabel: words.nameSubmit, input: { autoComplete: 'name', maxLength: NAME_MAX_LENGTH, autoCapitalize: 'words' }, usable: givenName, onSubmit: onSubmit, aside: { label: words.changeEmail, onPress: onChangeEmail } }));
52
46
  }
53
47
  const TICK_MS = 250;
48
+ // Send new code, held back until the wait is over, and the wait beside it.
54
49
  function NewCode({ waitMs, words, onResend }) {
55
50
  const [secondsLeft, setSecondsLeft] = useState(Math.ceil(waitMs / 1000));
56
51
  useEffect(() => {
@@ -67,26 +62,19 @@ function NewCode({ waitMs, words, onResend }) {
67
62
  }, [waitMs]);
68
63
  return (_jsxs(_Fragment, { children: [_jsx(Pill, { label: words.resend, look: "flat", disabled: secondsLeft > 0, onPress: onResend }), secondsLeft > 0 ? (_jsx(Text, { role: "timer", accessibilityLabel: words.resendWait, className: "font-ui text-sm text-ink-secondary", children: resendClock(secondsLeft) })) : null] }));
69
64
  }
65
+ /**
66
+ * The code emailed to the visitor, one digit to a box over one real field, so typing, deleting, a paste and the
67
+ * phone's own code suggestion work as in any field. The chat mounts it afresh for each code that goes out.
68
+ */
70
69
  export function CodeStep({ words, length, noMatch, ranOut, resendAfterMs = RESEND_AFTER_MS, onSubmit, onResend, onChangeEmail, }) {
71
70
  const [code, setCode] = useState('');
72
- const [focused, setFocused] = useState(false);
73
- const errorId = useId();
74
71
  const error = ranOut ? words.codeRanOut : noMatch ? words.codeNoMatch : null;
75
- // The box the next digit goes in, or the last once the code is whole.
76
- const nextBox = Math.min(code.length, length - 1);
77
- return (_jsxs(View, { className: "w-full max-w-[360px] items-center gap-3 self-center", children: [_jsx(Text, { className: "font-ui text-sm font-medium text-ink", children: words.codeLabel }), _jsxs(View, { className: "relative", children: [_jsx(View, { "aria-hidden": true, className: "flex-row gap-2", children: Array.from({ length }, (_, box) => (_jsx(View, { className: `h-control w-11 items-center justify-center rounded-control border ${focused && box === nextBox ? 'border-focus' : error ? 'border-error-ink' : 'border-line-control'}`, children: _jsx(Text, { className: "font-ui text-xl font-medium text-ink", children: code[box] ?? '' }) }, box))) }), _jsx(TextInput, { autoFocus: true, value: code, onChangeText: (typed) => {
72
+ return (_jsxs(View, { className: "w-full max-w-[360px] items-center gap-3 self-center", children: [_jsx(Text, { className: "font-ui text-sm font-medium text-ink", children: words.codeLabel }), _jsxs(View, { className: "relative", children: [_jsx(View, { "aria-hidden": true, className: "flex-row gap-2", children: Array.from({ length }, (_, box) => (_jsx(View, { className: `h-control w-11 items-center justify-center rounded-control border ${error ? 'border-error-ink' : 'border-line-control'}`, children: _jsx(Text, { className: "font-ui text-xl font-medium text-ink", children: code[box] ?? '' }) }, box))) }), _jsx(TextInput, { autoFocus: true, value: code, onChangeText: (typed) => {
78
73
  const digits = codeDigits(typed, length);
79
74
  setCode(digits);
80
75
  if (completesCode(digits, code, length))
81
76
  onSubmit(digits);
82
- }, onFocus: () => {
83
- setFocused(true);
84
- }, onBlur: () => {
85
- setFocused(false);
86
- }, accessibilityLabel: words.codeLabel, "aria-invalid": error !== null, ...describedBy(error === null ? undefined : errorId), inputMode: "numeric", autoComplete: "one-time-code", textContentType: "oneTimeCode", caretHidden: true,
87
- // Unseen, not just clear: the boxes draw the digits and the focus, and a checker would read clear text as
88
- // text with no contrast.
89
- className: "absolute inset-0 opacity-0" })] }), error ? (_jsx(Text, { nativeID: errorId, role: "alert", className: "text-center font-ui text-sm text-error-ink", children: error })) : null, _jsxs(View, { className: "flex-row flex-wrap items-center justify-center gap-2", children: [_jsx(Pill, { label: words.changeEmail, look: "flat", onPress: onChangeEmail }), _jsx(NewCode, { waitMs: resendAfterMs, words: words, onResend: onResend }), _jsx(Pill, { label: words.codeSubmit, disabled: code.length < length, onPress: () => {
77
+ }, accessibilityLabel: words.codeLabel, "aria-invalid": error !== null, inputMode: "numeric", autoComplete: "one-time-code", textContentType: "oneTimeCode", caretHidden: true, className: "absolute inset-0 rounded-control text-transparent" })] }), error ? (_jsx(Text, { role: "alert", className: "text-center font-ui text-sm text-error-ink", children: error })) : null, _jsxs(View, { className: "flex-row flex-wrap items-center justify-center gap-2", children: [_jsx(Pill, { label: words.changeEmail, look: "flat", onPress: onChangeEmail }), _jsx(NewCode, { waitMs: resendAfterMs, words: words, onResend: onResend }), _jsx(Pill, { label: words.codeSubmit, disabled: code.length < length, onPress: () => {
90
78
  onSubmit(code);
91
79
  } })] })] }));
92
80
  }
@@ -101,9 +89,7 @@ export const DOT_STILL_OPACITY = 0.6;
101
89
  function useReducedMotion() {
102
90
  const [reduced, setReduced] = useState(null);
103
91
  useEffect(() => {
104
- void (async () => {
105
- setReduced(await AccessibilityInfo.isReduceMotionEnabled());
106
- })();
92
+ void AccessibilityInfo.isReduceMotionEnabled().then(setReduced);
107
93
  const change = AccessibilityInfo.addEventListener('reduceMotionChanged', setReduced);
108
94
  return () => {
109
95
  change.remove();
@@ -111,12 +97,12 @@ function useReducedMotion() {
111
97
  }, []);
112
98
  return reduced;
113
99
  }
100
+ /** Skip writing a reply: three dots rising in turn in Skip's bubble beside Skip's mark, announced as a status. */
114
101
  export function SkipTyping({ label, skipMark }) {
115
102
  const dotColor = useColor('ink-secondary');
116
103
  const reduced = useReducedMotion();
117
104
  const still = reduced === true;
118
- // Made once and kept, so render reads no ref.
119
- const [rise] = useState(() => DOTS.map(() => new Animated.Value(0)));
105
+ const rise = useRef(DOTS.map(() => new Animated.Value(0))).current;
120
106
  useEffect(() => {
121
107
  if (reduced !== false)
122
108
  return undefined;
@@ -1,17 +1,11 @@
1
1
  import type { ComponentType } from 'react';
2
2
  /** The icons the chat draws, from the brand's interface icons, which each app already draws. */
3
3
  export type ChatIconName = 'attach' | 'arrow-right' | 'file' | 'close';
4
- export interface ChatIconProps {
4
+ export type ChatIcon = ComponentType<{
5
5
  name: ChatIconName;
6
6
  color: string;
7
7
  size: number;
8
- }
9
- export type ChatIcon = ComponentType<ChatIconProps>;
10
- /** The two reasons an attachment is refused, in the chat's words. */
11
- export interface AttachmentRefusedWords {
12
- type: string;
13
- size: string;
14
- }
8
+ }>;
15
9
  /** Every word the chat shows, which each app passes in. */
16
10
  export interface ChatWords {
17
11
  composerPlaceholder: string;
@@ -29,7 +23,10 @@ export interface ChatWords {
29
23
  feedDown: string;
30
24
  loading: string;
31
25
  loadFailed: string;
32
- attachmentRefused: AttachmentRefusedWords;
26
+ attachmentRefused: {
27
+ type: string;
28
+ size: string;
29
+ };
33
30
  fileKind: (name: string) => string;
34
31
  fileSize: (bytes: number) => string;
35
32
  messageTime: (ms: number) => string;
package/chat/thread.d.ts CHANGED
@@ -25,19 +25,16 @@ export declare function withReceivedAll(thread: Thread, messages: ChatMessage[])
25
25
  export declare const CLUSTER_GAP_MS = 120000;
26
26
  /** Who a run is from: the member, Skip, or a person on the care team. */
27
27
  export type RunSender = 'mine' | 'skip' | ChatAuthor;
28
- export interface NoticeItem {
28
+ export type ThreadItem = {
29
29
  kind: 'notice';
30
30
  message: ThreadMessage;
31
- }
32
- export interface UnsentItem {
31
+ } | {
33
32
  kind: 'unsent';
34
33
  message: ThreadMessage;
35
- }
36
- export interface RunItem {
34
+ } | {
37
35
  kind: 'run';
38
36
  sender: RunSender;
39
37
  messages: ThreadMessage[];
40
- }
41
- export type ThreadItem = NoticeItem | UnsentItem | RunItem;
38
+ };
42
39
  /** Notices and the member's unsent lines on their own, every other line in runs by sender, in order. */
43
40
  export declare function groupThread(messages: ThreadMessage[], skipUserId: number | null): ThreadItem[];
package/chat/typing.js CHANGED
@@ -15,10 +15,8 @@ export function createTypingSignal(send) {
15
15
  };
16
16
  return {
17
17
  typed(text) {
18
- if (!text.trim()) {
19
- stop();
20
- return;
21
- }
18
+ if (!text.trim())
19
+ return stop();
22
20
  if (!typing)
23
21
  send((typing = true));
24
22
  if (idle)
@@ -31,9 +29,7 @@ export function createTypingSignal(send) {
31
29
  /** Who on the care team is typing, each cleared after TYPING_CLEAR_MS without news. */
32
30
  export function createTypingWatch(onChange) {
33
31
  const timers = new Map();
34
- const publish = () => {
35
- onChange([...timers.keys()]);
36
- };
32
+ const publish = () => onChange([...timers.keys()]);
37
33
  const clear = (name) => {
38
34
  const timer = timers.get(name);
39
35
  if (!timer)
@@ -44,16 +40,12 @@ export function createTypingWatch(onChange) {
44
40
  };
45
41
  return {
46
42
  update(name, typing) {
47
- if (!typing) {
48
- clear(name);
49
- return;
50
- }
43
+ if (!typing)
44
+ return clear(name);
51
45
  const timer = timers.get(name);
52
46
  if (timer)
53
47
  clearTimeout(timer);
54
- timers.set(name, setTimeout(() => {
55
- clear(name);
56
- }, TYPING_CLEAR_MS));
48
+ timers.set(name, setTimeout(() => clear(name), TYPING_CLEAR_MS));
57
49
  if (!timer)
58
50
  publish();
59
51
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joinskips/brand",
3
- "version": "6.0.0-develop.126",
3
+ "version": "6.0.0",
4
4
  "description": "Skips design tokens, Onest, logos, favicons, interface icons, member pictures and app icons.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://brand.joinskips.com",