@liveblocks/react-ui 2.14.0 → 2.15.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/_private/index.d.mts +24 -22
- package/dist/_private/index.d.ts +24 -22
- package/dist/_private/index.js +1 -0
- package/dist/_private/index.js.map +1 -1
- package/dist/_private/index.mjs +1 -0
- package/dist/_private/index.mjs.map +1 -1
- package/dist/components/Comment.js +358 -256
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/Comment.mjs +334 -232
- package/dist/components/Comment.mjs.map +1 -1
- package/dist/components/Composer.js +308 -225
- package/dist/components/Composer.js.map +1 -1
- package/dist/components/Composer.mjs +288 -206
- package/dist/components/Composer.mjs.map +1 -1
- package/dist/components/HistoryVersionSummary.js +28 -32
- package/dist/components/HistoryVersionSummary.js.map +1 -1
- package/dist/components/HistoryVersionSummary.mjs +27 -31
- package/dist/components/HistoryVersionSummary.mjs.map +1 -1
- package/dist/components/HistoryVersionSummaryList.js +11 -9
- package/dist/components/HistoryVersionSummaryList.js.map +1 -1
- package/dist/components/HistoryVersionSummaryList.mjs +10 -8
- package/dist/components/HistoryVersionSummaryList.mjs.map +1 -1
- package/dist/components/InboxNotification.js +202 -143
- package/dist/components/InboxNotification.js.map +1 -1
- package/dist/components/InboxNotification.mjs +180 -121
- package/dist/components/InboxNotification.mjs.map +1 -1
- package/dist/components/InboxNotificationList.js +19 -14
- package/dist/components/InboxNotificationList.js.map +1 -1
- package/dist/components/InboxNotificationList.mjs +17 -12
- package/dist/components/InboxNotificationList.mjs.map +1 -1
- package/dist/components/Thread.js +104 -86
- package/dist/components/Thread.js.map +1 -1
- package/dist/components/Thread.mjs +93 -75
- package/dist/components/Thread.mjs.map +1 -1
- package/dist/components/internal/Attachment.js +161 -113
- package/dist/components/internal/Attachment.js.map +1 -1
- package/dist/components/internal/Attachment.mjs +150 -102
- package/dist/components/internal/Attachment.mjs.map +1 -1
- package/dist/components/internal/Attribution.js +15 -13
- package/dist/components/internal/Attribution.js.map +1 -1
- package/dist/components/internal/Attribution.mjs +15 -13
- package/dist/components/internal/Attribution.mjs.map +1 -1
- package/dist/components/internal/Avatar.js +27 -20
- package/dist/components/internal/Avatar.js.map +1 -1
- package/dist/components/internal/Avatar.mjs +23 -16
- package/dist/components/internal/Avatar.mjs.map +1 -1
- package/dist/components/internal/Button.js +5 -4
- package/dist/components/internal/Button.js.map +1 -1
- package/dist/components/internal/Button.mjs +4 -3
- package/dist/components/internal/Button.mjs.map +1 -1
- package/dist/components/internal/Dropdown.js +27 -19
- package/dist/components/internal/Dropdown.js.map +1 -1
- package/dist/components/internal/Dropdown.mjs +26 -18
- package/dist/components/internal/Dropdown.mjs.map +1 -1
- package/dist/components/internal/Emoji.js +4 -3
- package/dist/components/internal/Emoji.js.map +1 -1
- package/dist/components/internal/Emoji.mjs +3 -2
- package/dist/components/internal/Emoji.mjs.map +1 -1
- package/dist/components/internal/EmojiPicker.js +96 -72
- package/dist/components/internal/EmojiPicker.js.map +1 -1
- package/dist/components/internal/EmojiPicker.mjs +90 -66
- package/dist/components/internal/EmojiPicker.mjs.map +1 -1
- package/dist/components/internal/Icon.js +5 -4
- package/dist/components/internal/Icon.js.map +1 -1
- package/dist/components/internal/Icon.mjs +5 -4
- package/dist/components/internal/Icon.mjs.map +1 -1
- package/dist/components/internal/InboxNotificationThread.js +53 -38
- package/dist/components/internal/InboxNotificationThread.js.map +1 -1
- package/dist/components/internal/InboxNotificationThread.mjs +53 -38
- package/dist/components/internal/InboxNotificationThread.mjs.map +1 -1
- package/dist/components/internal/List.js +8 -6
- package/dist/components/internal/List.js.map +1 -1
- package/dist/components/internal/List.mjs +6 -4
- package/dist/components/internal/List.mjs.map +1 -1
- package/dist/components/internal/Room.js +8 -6
- package/dist/components/internal/Room.js.map +1 -1
- package/dist/components/internal/Room.mjs +7 -5
- package/dist/components/internal/Room.mjs.map +1 -1
- package/dist/components/internal/Tooltip.js +49 -33
- package/dist/components/internal/Tooltip.js.map +1 -1
- package/dist/components/internal/Tooltip.mjs +46 -30
- package/dist/components/internal/Tooltip.mjs.map +1 -1
- package/dist/components/internal/User.js +8 -6
- package/dist/components/internal/User.js.map +1 -1
- package/dist/components/internal/User.mjs +7 -5
- package/dist/components/internal/User.mjs.map +1 -1
- package/dist/components.js +12 -29
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +6 -5
- package/dist/components.mjs.map +1 -1
- package/dist/config.js +16 -12
- package/dist/config.js.map +1 -1
- package/dist/config.mjs +13 -9
- package/dist/config.mjs.map +1 -1
- package/dist/icons/ArrowDown.js +7 -6
- package/dist/icons/ArrowDown.js.map +1 -1
- package/dist/icons/ArrowDown.mjs +7 -6
- package/dist/icons/ArrowDown.mjs.map +1 -1
- package/dist/icons/ArrowUp.js +7 -6
- package/dist/icons/ArrowUp.js.map +1 -1
- package/dist/icons/ArrowUp.mjs +7 -6
- package/dist/icons/ArrowUp.mjs.map +1 -1
- package/dist/icons/Attachment.js +7 -6
- package/dist/icons/Attachment.js.map +1 -1
- package/dist/icons/Attachment.mjs +7 -6
- package/dist/icons/Attachment.mjs.map +1 -1
- package/dist/icons/Bold.js +7 -6
- package/dist/icons/Bold.js.map +1 -1
- package/dist/icons/Bold.mjs +7 -6
- package/dist/icons/Bold.mjs.map +1 -1
- package/dist/icons/Check.js +7 -6
- package/dist/icons/Check.js.map +1 -1
- package/dist/icons/Check.mjs +7 -6
- package/dist/icons/Check.mjs.map +1 -1
- package/dist/icons/Code.js +7 -6
- package/dist/icons/Code.js.map +1 -1
- package/dist/icons/Code.mjs +7 -6
- package/dist/icons/Code.mjs.map +1 -1
- package/dist/icons/Cross.js +12 -8
- package/dist/icons/Cross.js.map +1 -1
- package/dist/icons/Cross.mjs +12 -8
- package/dist/icons/Cross.mjs.map +1 -1
- package/dist/icons/Delete.js +7 -6
- package/dist/icons/Delete.js.map +1 -1
- package/dist/icons/Delete.mjs +7 -6
- package/dist/icons/Delete.mjs.map +1 -1
- package/dist/icons/Edit.js +7 -6
- package/dist/icons/Edit.js.map +1 -1
- package/dist/icons/Edit.mjs +7 -6
- package/dist/icons/Edit.mjs.map +1 -1
- package/dist/icons/Ellipsis.js +21 -16
- package/dist/icons/Ellipsis.js.map +1 -1
- package/dist/icons/Ellipsis.mjs +21 -16
- package/dist/icons/Ellipsis.mjs.map +1 -1
- package/dist/icons/Emoji.js +25 -18
- package/dist/icons/Emoji.js.map +1 -1
- package/dist/icons/Emoji.mjs +25 -18
- package/dist/icons/Emoji.mjs.map +1 -1
- package/dist/icons/EmojiAdd.js +28 -20
- package/dist/icons/EmojiAdd.js.map +1 -1
- package/dist/icons/EmojiAdd.mjs +28 -20
- package/dist/icons/EmojiAdd.mjs.map +1 -1
- package/dist/icons/Italic.js +7 -6
- package/dist/icons/Italic.js.map +1 -1
- package/dist/icons/Italic.mjs +7 -6
- package/dist/icons/Italic.mjs.map +1 -1
- package/dist/icons/Mention.js +12 -8
- package/dist/icons/Mention.js.map +1 -1
- package/dist/icons/Mention.mjs +12 -8
- package/dist/icons/Mention.mjs.map +1 -1
- package/dist/icons/Resolve.js +14 -10
- package/dist/icons/Resolve.js.map +1 -1
- package/dist/icons/Resolve.mjs +14 -10
- package/dist/icons/Resolve.mjs.map +1 -1
- package/dist/icons/Resolved.js +16 -12
- package/dist/icons/Resolved.js.map +1 -1
- package/dist/icons/Resolved.mjs +16 -12
- package/dist/icons/Resolved.mjs.map +1 -1
- package/dist/icons/Restore.js +12 -8
- package/dist/icons/Restore.js.map +1 -1
- package/dist/icons/Restore.mjs +12 -8
- package/dist/icons/Restore.mjs.map +1 -1
- package/dist/icons/Search.js +7 -6
- package/dist/icons/Search.js.map +1 -1
- package/dist/icons/Search.mjs +7 -6
- package/dist/icons/Search.mjs.map +1 -1
- package/dist/icons/Send.js +7 -6
- package/dist/icons/Send.js.map +1 -1
- package/dist/icons/Send.mjs +7 -6
- package/dist/icons/Send.mjs.map +1 -1
- package/dist/icons/Spinner.js +8 -7
- package/dist/icons/Spinner.js.map +1 -1
- package/dist/icons/Spinner.mjs +8 -7
- package/dist/icons/Spinner.mjs.map +1 -1
- package/dist/icons/Strikethrough.js +7 -6
- package/dist/icons/Strikethrough.js.map +1 -1
- package/dist/icons/Strikethrough.mjs +7 -6
- package/dist/icons/Strikethrough.mjs.map +1 -1
- package/dist/icons/Warning.js +14 -10
- package/dist/icons/Warning.js.map +1 -1
- package/dist/icons/Warning.mjs +14 -10
- package/dist/icons/Warning.mjs.map +1 -1
- package/dist/icons/index.js +42 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/index.mjs +19 -0
- package/dist/icons/index.mjs.map +1 -0
- package/dist/index.d.mts +14 -12
- package/dist/index.d.ts +14 -12
- package/dist/overrides.js +65 -36
- package/dist/overrides.js.map +1 -1
- package/dist/overrides.mjs +59 -12
- package/dist/overrides.mjs.map +1 -1
- package/dist/primitives/Comment/index.js +75 -66
- package/dist/primitives/Comment/index.js.map +1 -1
- package/dist/primitives/Comment/index.mjs +71 -62
- package/dist/primitives/Comment/index.mjs.map +1 -1
- package/dist/primitives/Composer/contexts.js +11 -11
- package/dist/primitives/Composer/index.js +343 -284
- package/dist/primitives/Composer/index.js.map +1 -1
- package/dist/primitives/Composer/index.mjs +262 -203
- package/dist/primitives/Composer/index.mjs.map +1 -1
- package/dist/primitives/Composer/utils.js +20 -21
- package/dist/primitives/Composer/utils.js.map +1 -1
- package/dist/primitives/Composer/utils.mjs +4 -5
- package/dist/primitives/Composer/utils.mjs.map +1 -1
- package/dist/primitives/EmojiPicker/contexts.js +3 -3
- package/dist/primitives/EmojiPicker/index.js +160 -142
- package/dist/primitives/EmojiPicker/index.js.map +1 -1
- package/dist/primitives/EmojiPicker/index.mjs +122 -104
- package/dist/primitives/EmojiPicker/index.mjs.map +1 -1
- package/dist/primitives/FileSize.js +9 -7
- package/dist/primitives/FileSize.js.map +1 -1
- package/dist/primitives/FileSize.mjs +7 -5
- package/dist/primitives/FileSize.mjs.map +1 -1
- package/dist/primitives/Timestamp.js +12 -10
- package/dist/primitives/Timestamp.js.map +1 -1
- package/dist/primitives/Timestamp.mjs +7 -5
- package/dist/primitives/Timestamp.mjs.map +1 -1
- package/dist/primitives/index.d.mts +24 -23
- package/dist/primitives/index.d.ts +24 -23
- package/dist/primitives/internal/Emoji.js +7 -5
- package/dist/primitives/internal/Emoji.js.map +1 -1
- package/dist/primitives/internal/Emoji.mjs +6 -4
- package/dist/primitives/internal/Emoji.mjs.map +1 -1
- package/dist/shared.js +2 -7
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +2 -7
- package/dist/shared.mjs.map +1 -1
- package/dist/slate/plugins/auto-links.mjs +1 -1
- package/dist/slate/plugins/custom-links.mjs +1 -1
- package/dist/slate/plugins/mentions.mjs +1 -1
- package/dist/utils/Persist.js +19 -18
- package/dist/utils/Persist.js.map +1 -1
- package/dist/utils/Persist.mjs +7 -6
- package/dist/utils/Persist.mjs.map +1 -1
- package/dist/utils/Portal.js +5 -4
- package/dist/utils/Portal.js.map +1 -1
- package/dist/utils/Portal.mjs +4 -3
- package/dist/utils/Portal.mjs.map +1 -1
- package/dist/utils/use-controllable-state.js +5 -5
- package/dist/utils/use-index.js +7 -7
- package/dist/utils/use-initial.js +2 -2
- package/dist/utils/use-interval.js +4 -4
- package/dist/utils/use-latest.js +3 -3
- package/dist/utils/use-observable.js +2 -2
- package/dist/utils/use-refs.js +2 -2
- package/dist/utils/use-rerender.js +2 -2
- package/dist/utils/use-visible.js +24 -2
- package/dist/utils/use-visible.js.map +1 -1
- package/dist/utils/use-visible.mjs +23 -2
- package/dist/utils/use-visible.mjs.map +1 -1
- package/dist/utils/use-window-focus.js +2 -2
- package/dist/utils/use-window-focus.js.map +1 -1
- package/dist/utils/use-window-focus.mjs +1 -1
- package/dist/utils/use-window-focus.mjs.map +1 -1
- package/dist/version.js +2 -2
- package/dist/version.js.map +1 -1
- package/dist/version.mjs +2 -2
- package/dist/version.mjs.map +1 -1
- package/package.json +10 -25
- package/dist/utils/use-id.js +0 -29
- package/dist/utils/use-id.js.map +0 -1
- package/dist/utils/use-id.mjs +0 -27
- package/dist/utils/use-id.mjs.map +0 -1
- package/dist/utils/use-layout-effect.js +0 -8
- package/dist/utils/use-layout-effect.js.map +0 -1
- package/dist/utils/use-layout-effect.mjs +0 -6
- package/dist/utils/use-layout-effect.mjs.map +0 -1
- package/dist/utils/use-transition.js +0 -16
- package/dist/utils/use-transition.js.map +0 -1
- package/dist/utils/use-transition.mjs +0 -14
- package/dist/utils/use-transition.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timestamp.js","sources":["../../src/primitives/Timestamp.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport
|
|
1
|
+
{"version":3,"file":"Timestamp.js","sources":["../../src/primitives/Timestamp.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, useMemo } from \"react\";\n\nimport type { ComponentPropsWithSlot } from \"../types\";\nimport { capitalize } from \"../utils/capitalize\";\nimport { dateTimeFormat, relativeTimeFormat } from \"../utils/intl\";\nimport { useInterval } from \"../utils/use-interval\";\nimport { useRerender } from \"../utils/use-rerender\";\n\nconst DYNAMIC_DATE_THRESHOLD = 3 * 24 * 60 * 60 * 1000; // 3 days\nconst RENDER_INTERVAL = 30 * 1000; // 30 seconds\n\nconst TIMESTAMP_NAME = \"Timestamp\";\n\nexport interface TimestampProps\n extends Omit<ComponentPropsWithSlot<\"time\">, \"children\" | \"title\"> {\n /**\n * The date to display.\n */\n date: Date | string | number;\n\n /**\n * A function to format the displayed date.\n */\n children?: (date: Date, locale?: string) => ReactNode;\n\n /**\n * The `title` attribute's value or a function to format it.\n */\n title?: string | ((date: Date, locale?: string) => string);\n\n /**\n * The interval in milliseconds at which the component will re-render.\n * Can be set to `false` to disable re-rendering.\n */\n interval?: number | false;\n\n /**\n * The locale used when formatting the date.\n */\n locale?: string;\n}\n\nconst relativeUnits = {\n seconds: 60,\n minutes: 60,\n hours: 24,\n days: 7,\n weeks: 4.34524,\n months: 12,\n};\n\n/**\n * Formats a date absolutely.\n */\nfunction formatVerboseDate(date: Date, locale?: string) {\n const formatter = dateTimeFormat(locale, {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"numeric\",\n });\n\n return capitalize(formatter.format(date));\n}\n\n/**\n * Formats a date absolutely with only the day and month.\n */\nfunction formatShortDate(date: Date, locale?: string) {\n const formatter = dateTimeFormat(locale, {\n month: \"short\",\n day: \"numeric\",\n });\n\n return capitalize(formatter.format(date));\n}\n\n// Some locales' relative formatting can be broken (e.g. \"-1h\") when using the narrow style.\nconst localesWithBrokenNarrowRelativeFormatting = [\n \"br\",\n \"fr\",\n \"nb\",\n \"nn\",\n \"no\",\n \"ro\",\n \"sv\",\n];\n\n/**\n * Formats a date relatively.\n */\nfunction formatRelativeDate(date: Date, locale?: string) {\n let resolvedLocale: string;\n\n if (locale) {\n resolvedLocale = locale;\n } else {\n const formatter = relativeTimeFormat();\n\n resolvedLocale = formatter.resolvedOptions().locale;\n }\n\n const isBrokenWhenNarrow = localesWithBrokenNarrowRelativeFormatting.some(\n (locale) =>\n resolvedLocale === locale || resolvedLocale.startsWith(`${locale}-`)\n );\n\n const formatter = relativeTimeFormat(resolvedLocale, {\n style: isBrokenWhenNarrow ? \"short\" : \"narrow\",\n numeric: \"auto\",\n });\n\n let difference = (date.getTime() - Date.now()) / 1000;\n\n if (\n difference > -relativeUnits.seconds &&\n difference < relativeUnits.seconds\n ) {\n return formatter.format(0, \"seconds\");\n }\n\n for (const [unit, length] of Object.entries(relativeUnits)) {\n if (Math.abs(difference) < length) {\n return formatter.format(\n Math.round(difference),\n unit as Intl.RelativeTimeFormatUnit\n );\n }\n\n difference /= length;\n }\n\n return capitalize(formatter.format(Math.round(difference), \"years\"));\n}\n\n/**\n * Formats a date relatively if it's recent,\n * otherwise absolutely with only the day and month.\n */\nfunction formatDynamicDate(date: Date, locale?: string) {\n return date.getTime() > Date.now() - DYNAMIC_DATE_THRESHOLD\n ? formatRelativeDate(date, locale)\n : formatShortDate(date, locale);\n}\n\n/**\n * Displays a formatted date, and automatically re-renders to support relative\n * formatting. Defaults to relative formatting for recent dates and a short\n * absolute formatting for older ones.\n *\n * @example\n * <Timestamp date={new Date()} />\n *\n * @example\n * <Timestamp date={new Date()} title={(date) => date.toISOString()} interval={false}>\n * {(date) => date.toLocaleDateString()}\n * </Timestamp>\n */\nexport const Timestamp = forwardRef<HTMLTimeElement, TimestampProps>(\n (\n {\n date,\n locale,\n children: renderChildren = formatDynamicDate,\n title: renderTitle = formatVerboseDate,\n dateTime,\n interval = RENDER_INTERVAL,\n asChild,\n ...props\n },\n forwardedRef\n ) => {\n const Component = asChild ? Slot : \"time\";\n const [rerender, key] = useRerender();\n const parsedDate = useMemo(() => new Date(date), [date]);\n const normalizedDate = useMemo(\n () => parsedDate.toISOString(),\n [parsedDate]\n );\n const title = useMemo(\n () =>\n typeof renderTitle === \"function\"\n ? renderTitle(parsedDate, locale)\n : renderTitle,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [renderTitle, parsedDate, key]\n );\n const children = useMemo(\n () =>\n typeof renderChildren === \"function\"\n ? renderChildren(parsedDate, locale)\n : renderChildren,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [renderChildren, parsedDate, key]\n );\n\n useInterval(rerender, interval);\n\n return (\n <Component\n {...props}\n ref={forwardedRef}\n dateTime={dateTime ?? normalizedDate}\n title={title}\n >\n {children}\n </Component>\n );\n }\n);\n\nif (process.env.NODE_ENV !== \"production\") {\n Timestamp.displayName = TIMESTAMP_NAME;\n}\n"],"names":["dateTimeFormat","capitalize","formatter","relativeTimeFormat","locale","forwardRef","Slot","useRerender","useMemo","useInterval","jsx"],"mappings":";;;;;;;;;;AAAA,YAAA,CAAA;AAYA,MAAM,sBAAyB,GAAA,CAAA,GAAI,E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,cAAgB,EAAA,UAAA,EAAY,GAAG,CAAA;AAAA,KAClC,CAAA;AAEA,IAAAC,uBAAA,CAAY,UAAU,QAAQ,CAAA,CAAA;AAE9B,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,MACL,UAAU,QAAY,IAAA,cAAA;AAAA,MACtB,KAAA;AAAA,MAEC,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AACzC,EAAA,SAAA,CAAU,WAAc,GAAA,cAAA,CAAA;AAC1B;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
-
import
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
4
|
import { capitalize } from '../utils/capitalize.mjs';
|
|
5
5
|
import { dateTimeFormat, relativeTimeFormat } from '../utils/intl.mjs';
|
|
6
6
|
import { useInterval } from '../utils/use-interval.mjs';
|
|
7
7
|
import { useRerender } from '../utils/use-rerender.mjs';
|
|
8
8
|
|
|
9
|
+
"use client";
|
|
9
10
|
const DYNAMIC_DATE_THRESHOLD = 3 * 24 * 60 * 60 * 1e3;
|
|
10
11
|
const RENDER_INTERVAL = 30 * 1e3;
|
|
11
12
|
const TIMESTAMP_NAME = "Timestamp";
|
|
@@ -103,12 +104,13 @@ const Timestamp = forwardRef(
|
|
|
103
104
|
[renderChildren, parsedDate, key]
|
|
104
105
|
);
|
|
105
106
|
useInterval(rerender, interval);
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
107
108
|
...props,
|
|
108
109
|
ref: forwardedRef,
|
|
109
110
|
dateTime: dateTime ?? normalizedDate,
|
|
110
|
-
title
|
|
111
|
-
|
|
111
|
+
title,
|
|
112
|
+
children
|
|
113
|
+
});
|
|
112
114
|
}
|
|
113
115
|
);
|
|
114
116
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timestamp.mjs","sources":["../../src/primitives/Timestamp.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport
|
|
1
|
+
{"version":3,"file":"Timestamp.mjs","sources":["../../src/primitives/Timestamp.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ReactNode } from \"react\";\nimport { forwardRef, useMemo } from \"react\";\n\nimport type { ComponentPropsWithSlot } from \"../types\";\nimport { capitalize } from \"../utils/capitalize\";\nimport { dateTimeFormat, relativeTimeFormat } from \"../utils/intl\";\nimport { useInterval } from \"../utils/use-interval\";\nimport { useRerender } from \"../utils/use-rerender\";\n\nconst DYNAMIC_DATE_THRESHOLD = 3 * 24 * 60 * 60 * 1000; // 3 days\nconst RENDER_INTERVAL = 30 * 1000; // 30 seconds\n\nconst TIMESTAMP_NAME = \"Timestamp\";\n\nexport interface TimestampProps\n extends Omit<ComponentPropsWithSlot<\"time\">, \"children\" | \"title\"> {\n /**\n * The date to display.\n */\n date: Date | string | number;\n\n /**\n * A function to format the displayed date.\n */\n children?: (date: Date, locale?: string) => ReactNode;\n\n /**\n * The `title` attribute's value or a function to format it.\n */\n title?: string | ((date: Date, locale?: string) => string);\n\n /**\n * The interval in milliseconds at which the component will re-render.\n * Can be set to `false` to disable re-rendering.\n */\n interval?: number | false;\n\n /**\n * The locale used when formatting the date.\n */\n locale?: string;\n}\n\nconst relativeUnits = {\n seconds: 60,\n minutes: 60,\n hours: 24,\n days: 7,\n weeks: 4.34524,\n months: 12,\n};\n\n/**\n * Formats a date absolutely.\n */\nfunction formatVerboseDate(date: Date, locale?: string) {\n const formatter = dateTimeFormat(locale, {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n hour: \"numeric\",\n minute: \"numeric\",\n });\n\n return capitalize(formatter.format(date));\n}\n\n/**\n * Formats a date absolutely with only the day and month.\n */\nfunction formatShortDate(date: Date, locale?: string) {\n const formatter = dateTimeFormat(locale, {\n month: \"short\",\n day: \"numeric\",\n });\n\n return capitalize(formatter.format(date));\n}\n\n// Some locales' relative formatting can be broken (e.g. \"-1h\") when using the narrow style.\nconst localesWithBrokenNarrowRelativeFormatting = [\n \"br\",\n \"fr\",\n \"nb\",\n \"nn\",\n \"no\",\n \"ro\",\n \"sv\",\n];\n\n/**\n * Formats a date relatively.\n */\nfunction formatRelativeDate(date: Date, locale?: string) {\n let resolvedLocale: string;\n\n if (locale) {\n resolvedLocale = locale;\n } else {\n const formatter = relativeTimeFormat();\n\n resolvedLocale = formatter.resolvedOptions().locale;\n }\n\n const isBrokenWhenNarrow = localesWithBrokenNarrowRelativeFormatting.some(\n (locale) =>\n resolvedLocale === locale || resolvedLocale.startsWith(`${locale}-`)\n );\n\n const formatter = relativeTimeFormat(resolvedLocale, {\n style: isBrokenWhenNarrow ? \"short\" : \"narrow\",\n numeric: \"auto\",\n });\n\n let difference = (date.getTime() - Date.now()) / 1000;\n\n if (\n difference > -relativeUnits.seconds &&\n difference < relativeUnits.seconds\n ) {\n return formatter.format(0, \"seconds\");\n }\n\n for (const [unit, length] of Object.entries(relativeUnits)) {\n if (Math.abs(difference) < length) {\n return formatter.format(\n Math.round(difference),\n unit as Intl.RelativeTimeFormatUnit\n );\n }\n\n difference /= length;\n }\n\n return capitalize(formatter.format(Math.round(difference), \"years\"));\n}\n\n/**\n * Formats a date relatively if it's recent,\n * otherwise absolutely with only the day and month.\n */\nfunction formatDynamicDate(date: Date, locale?: string) {\n return date.getTime() > Date.now() - DYNAMIC_DATE_THRESHOLD\n ? formatRelativeDate(date, locale)\n : formatShortDate(date, locale);\n}\n\n/**\n * Displays a formatted date, and automatically re-renders to support relative\n * formatting. Defaults to relative formatting for recent dates and a short\n * absolute formatting for older ones.\n *\n * @example\n * <Timestamp date={new Date()} />\n *\n * @example\n * <Timestamp date={new Date()} title={(date) => date.toISOString()} interval={false}>\n * {(date) => date.toLocaleDateString()}\n * </Timestamp>\n */\nexport const Timestamp = forwardRef<HTMLTimeElement, TimestampProps>(\n (\n {\n date,\n locale,\n children: renderChildren = formatDynamicDate,\n title: renderTitle = formatVerboseDate,\n dateTime,\n interval = RENDER_INTERVAL,\n asChild,\n ...props\n },\n forwardedRef\n ) => {\n const Component = asChild ? Slot : \"time\";\n const [rerender, key] = useRerender();\n const parsedDate = useMemo(() => new Date(date), [date]);\n const normalizedDate = useMemo(\n () => parsedDate.toISOString(),\n [parsedDate]\n );\n const title = useMemo(\n () =>\n typeof renderTitle === \"function\"\n ? renderTitle(parsedDate, locale)\n : renderTitle,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [renderTitle, parsedDate, key]\n );\n const children = useMemo(\n () =>\n typeof renderChildren === \"function\"\n ? renderChildren(parsedDate, locale)\n : renderChildren,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [renderChildren, parsedDate, key]\n );\n\n useInterval(rerender, interval);\n\n return (\n <Component\n {...props}\n ref={forwardedRef}\n dateTime={dateTime ?? normalizedDate}\n title={title}\n >\n {children}\n </Component>\n );\n }\n);\n\nif (process.env.NODE_ENV !== \"production\") {\n Timestamp.displayName = TIMESTAMP_NAME;\n}\n"],"names":["formatter","locale"],"mappings":";;;;;;;;AAAA,YAAA,CAAA;AAYA,MAAM,sBAAyB,GAAA,CAAA,GAAI,EAAK,GAAA,EAAA,GAAK,EAAK,GAAA,GAAA,CAAA;AAClD,MAAM,kBAAkB,EAAK,GAAA,GAAA,CAAA;AAE7B,MAAM,cAAiB,GAAA,WAAA,CAAA;AA+BvB,MAAM,aAAgB,GAAA;AAAA,EACpB,OAAS,EAAA,EAAA;AAAA,EACT,OAAS,EAAA,EAAA;AAAA,EACT,KAAO,EAAA,EAAA;AAAA,EACP,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H,CAAA,CAAA;AAAA,GAEJ;AACF,EAAA;AAEA,IAAI,OAAA,CAAQ,GAAI,CAAA,QAAA,KAAa,YAAc,EAAA;AACzC,EAAA,SAAA,CAAU,WAAc,GAAA,cAAA,CAAA;AAC1B;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEvent, PropsWithChildren } from 'react';
|
|
3
3
|
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
6
|
declare type Direction = "ltr" | "rtl";
|
|
6
7
|
declare type SlotProp = {
|
|
@@ -72,21 +73,21 @@ interface CommentBodyProps extends Omit<ComponentPropsWithSlot<"div">, "children
|
|
|
72
73
|
* @example
|
|
73
74
|
* <Comment.Mention>@{userId}</Comment.Mention>
|
|
74
75
|
*/
|
|
75
|
-
declare const CommentMention:
|
|
76
|
+
declare const CommentMention: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & SlotProp & react.RefAttributes<HTMLSpanElement>>;
|
|
76
77
|
/**
|
|
77
78
|
* Displays links within `Comment.Body`.
|
|
78
79
|
*
|
|
79
80
|
* @example
|
|
80
81
|
* <Comment.Link href={href}>{children}</Comment.Link>
|
|
81
82
|
*/
|
|
82
|
-
declare const CommentLink:
|
|
83
|
+
declare const CommentLink: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & SlotProp & react.RefAttributes<HTMLAnchorElement>>;
|
|
83
84
|
/**
|
|
84
85
|
* Displays a comment body.
|
|
85
86
|
*
|
|
86
87
|
* @example
|
|
87
88
|
* <Comment.Body body={comment.body} />
|
|
88
89
|
*/
|
|
89
|
-
declare const CommentBody:
|
|
90
|
+
declare const CommentBody: react.ForwardRefExoticComponent<CommentBodyProps & react.RefAttributes<HTMLDivElement>>;
|
|
90
91
|
|
|
91
92
|
declare namespace index$2 {
|
|
92
93
|
export {
|
|
@@ -251,25 +252,25 @@ interface ComposerSubmitComment {
|
|
|
251
252
|
* <Composer.MarkToggle mark="italic">Italic</Composer.MarkToggle>
|
|
252
253
|
* </Composer.FloatingToolbar>
|
|
253
254
|
*/
|
|
254
|
-
declare const ComposerFloatingToolbar:
|
|
255
|
+
declare const ComposerFloatingToolbar: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SlotProp & react.RefAttributes<HTMLDivElement>>;
|
|
255
256
|
/**
|
|
256
257
|
* Displays mentions within `Composer.Editor`.
|
|
257
258
|
*
|
|
258
259
|
* @example
|
|
259
260
|
* <Composer.Mention>@{userId}</Composer.Mention>
|
|
260
261
|
*/
|
|
261
|
-
declare const ComposerMention:
|
|
262
|
+
declare const ComposerMention: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & SlotProp & react.RefAttributes<HTMLSpanElement>>;
|
|
262
263
|
/**
|
|
263
264
|
* Displays links within `Composer.Editor`.
|
|
264
265
|
*
|
|
265
266
|
* @example
|
|
266
267
|
* <Composer.Link href={href}>{children}</Composer.Link>
|
|
267
268
|
*/
|
|
268
|
-
declare const ComposerLink:
|
|
269
|
+
declare const ComposerLink: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & SlotProp & react.RefAttributes<HTMLAnchorElement>>;
|
|
269
270
|
/**
|
|
270
271
|
* Contains suggestions within `Composer.Editor`.
|
|
271
272
|
*/
|
|
272
|
-
declare const ComposerSuggestions:
|
|
273
|
+
declare const ComposerSuggestions: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SlotProp & react.RefAttributes<HTMLDivElement>>;
|
|
273
274
|
/**
|
|
274
275
|
* Displays a list of suggestions within `Composer.Editor`.
|
|
275
276
|
*
|
|
@@ -282,7 +283,7 @@ declare const ComposerSuggestions: React__default.ForwardRefExoticComponent<Omit
|
|
|
282
283
|
* ))}
|
|
283
284
|
* </Composer.SuggestionsList>
|
|
284
285
|
*/
|
|
285
|
-
declare const ComposerSuggestionsList:
|
|
286
|
+
declare const ComposerSuggestionsList: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & SlotProp & react.RefAttributes<HTMLUListElement>>;
|
|
286
287
|
/**
|
|
287
288
|
* Displays a suggestion within `Composer.SuggestionsList`.
|
|
288
289
|
*
|
|
@@ -291,14 +292,14 @@ declare const ComposerSuggestionsList: React__default.ForwardRefExoticComponent<
|
|
|
291
292
|
* @{userId}
|
|
292
293
|
* </Composer.SuggestionsListItem>
|
|
293
294
|
*/
|
|
294
|
-
declare const ComposerSuggestionsListItem:
|
|
295
|
+
declare const ComposerSuggestionsListItem: react.ForwardRefExoticComponent<ComposerSuggestionsListItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
295
296
|
/**
|
|
296
297
|
* Displays the composer's editor.
|
|
297
298
|
*
|
|
298
299
|
* @example
|
|
299
300
|
* <Composer.Editor placeholder="Write a comment…" />
|
|
300
301
|
*/
|
|
301
|
-
declare const ComposerEditor:
|
|
302
|
+
declare const ComposerEditor: react.ForwardRefExoticComponent<ComposerEditorProps & react.RefAttributes<HTMLDivElement>>;
|
|
302
303
|
/**
|
|
303
304
|
* Surrounds the composer's content and handles submissions.
|
|
304
305
|
*
|
|
@@ -308,21 +309,21 @@ declare const ComposerEditor: React__default.ForwardRefExoticComponent<ComposerE
|
|
|
308
309
|
* <Composer.Submit />
|
|
309
310
|
* </Composer.Form>
|
|
310
311
|
*/
|
|
311
|
-
declare const ComposerForm:
|
|
312
|
+
declare const ComposerForm: react.ForwardRefExoticComponent<ComposerFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
312
313
|
/**
|
|
313
314
|
* A button to submit the composer.
|
|
314
315
|
*
|
|
315
316
|
* @example
|
|
316
317
|
* <Composer.Submit>Send</Composer.Submit>
|
|
317
318
|
*/
|
|
318
|
-
declare const ComposerSubmit:
|
|
319
|
+
declare const ComposerSubmit: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & react.RefAttributes<HTMLButtonElement>>;
|
|
319
320
|
/**
|
|
320
321
|
* A button which opens a file picker to create attachments.
|
|
321
322
|
*
|
|
322
323
|
* @example
|
|
323
324
|
* <Composer.AttachFiles>Attach files</Composer.AttachFiles>
|
|
324
325
|
*/
|
|
325
|
-
declare const ComposerAttachFiles:
|
|
326
|
+
declare const ComposerAttachFiles: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & react.RefAttributes<HTMLButtonElement>>;
|
|
326
327
|
/**
|
|
327
328
|
* A drop area which accepts files to create attachments.
|
|
328
329
|
*
|
|
@@ -331,7 +332,7 @@ declare const ComposerAttachFiles: React__default.ForwardRefExoticComponent<Omit
|
|
|
331
332
|
* Drop files here
|
|
332
333
|
* </Composer.AttachmentsDropArea>
|
|
333
334
|
*/
|
|
334
|
-
declare const ComposerAttachmentsDropArea:
|
|
335
|
+
declare const ComposerAttachmentsDropArea: react.ForwardRefExoticComponent<ComposerAttachmentsDropAreaProps & react.RefAttributes<HTMLDivElement>>;
|
|
335
336
|
/**
|
|
336
337
|
* A toggle button which toggles a specific text mark.
|
|
337
338
|
*
|
|
@@ -340,7 +341,7 @@ declare const ComposerAttachmentsDropArea: React__default.ForwardRefExoticCompon
|
|
|
340
341
|
* Bold
|
|
341
342
|
* </Composer.MarkToggle>
|
|
342
343
|
*/
|
|
343
|
-
declare const ComposerMarkToggle:
|
|
344
|
+
declare const ComposerMarkToggle: react.ForwardRefExoticComponent<ComposerMarkToggleProps & react.RefAttributes<HTMLButtonElement>>;
|
|
344
345
|
|
|
345
346
|
declare namespace index$1 {
|
|
346
347
|
export {
|
|
@@ -425,7 +426,7 @@ declare type ComposerContext = {
|
|
|
425
426
|
*/
|
|
426
427
|
removeAttachment: (attachmentId: string) => void;
|
|
427
428
|
};
|
|
428
|
-
declare const ComposerContext:
|
|
429
|
+
declare const ComposerContext: react.Context<ComposerContext | null>;
|
|
429
430
|
declare function useComposer(): ComposerContext;
|
|
430
431
|
|
|
431
432
|
declare class AttachmentTooLargeError extends Error {
|
|
@@ -543,7 +544,7 @@ declare type EmojiPickerSearchProps = ComponentPropsWithSlot<"input">;
|
|
|
543
544
|
* <EmojiPicker.Content />
|
|
544
545
|
* </EmojiPicker.Root>
|
|
545
546
|
*/
|
|
546
|
-
declare function EmojiPickerRoot({ columns, locale, onEmojiSelect, children, }: EmojiPickerRootProps):
|
|
547
|
+
declare function EmojiPickerRoot({ columns, locale, onEmojiSelect, children, }: EmojiPickerRootProps): react_jsx_runtime.JSX.Element;
|
|
547
548
|
declare namespace EmojiPickerRoot {
|
|
548
549
|
var displayName: string;
|
|
549
550
|
}
|
|
@@ -560,7 +561,7 @@ declare namespace EmojiPickerRoot {
|
|
|
560
561
|
* @example
|
|
561
562
|
* <EmojiPicker.Search />
|
|
562
563
|
*/
|
|
563
|
-
declare const EmojiPickerSearch:
|
|
564
|
+
declare const EmojiPickerSearch: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & SlotProp & react.RefAttributes<HTMLInputElement>>;
|
|
564
565
|
/**
|
|
565
566
|
* @private
|
|
566
567
|
* The EmojiPicker primitive is undocumented for now and subject to change,
|
|
@@ -584,7 +585,7 @@ declare const EmojiPickerSearch: React__default.ForwardRefExoticComponent<Omit<R
|
|
|
584
585
|
* }}
|
|
585
586
|
* />
|
|
586
587
|
*/
|
|
587
|
-
declare const EmojiPickerContent:
|
|
588
|
+
declare const EmojiPickerContent: react.ForwardRefExoticComponent<EmojiPickerContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
588
589
|
|
|
589
590
|
declare namespace index {
|
|
590
591
|
export {
|
|
@@ -614,7 +615,7 @@ interface FileSizeProps extends Omit<ComponentPropsWithSlot<"span">, "children">
|
|
|
614
615
|
* @example
|
|
615
616
|
* <FileSize size={100000} />
|
|
616
617
|
*/
|
|
617
|
-
declare const FileSize:
|
|
618
|
+
declare const FileSize: react.ForwardRefExoticComponent<FileSizeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
618
619
|
|
|
619
620
|
interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children" | "title"> {
|
|
620
621
|
/**
|
|
@@ -652,6 +653,6 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
|
|
|
652
653
|
* {(date) => date.toLocaleDateString()}
|
|
653
654
|
* </Timestamp>
|
|
654
655
|
*/
|
|
655
|
-
declare const Timestamp:
|
|
656
|
+
declare const Timestamp: react.ForwardRefExoticComponent<TimestampProps & react.RefAttributes<HTMLTimeElement>>;
|
|
656
657
|
|
|
657
658
|
export { AttachmentTooLargeError, index$2 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index$1 as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, index as EmojiPicker, EmojiPickerContentCategoryHeaderProps, EmojiPickerContentComponents, EmojiPickerContentEmojiProps, EmojiPickerContentEmptyProps, EmojiPickerContentErrorProps, EmojiPickerContentGridProps, EmojiPickerContentLoadingProps, EmojiPickerContentProps, EmojiPickerContentRowProps, EmojiPickerRootProps, EmojiPickerSearchProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ElementType, ComponentPropsWithoutRef, ReactNode, ComponentType, FormEvent, PropsWithChildren } from 'react';
|
|
3
3
|
import { CommentBody as CommentBody$1, CommentAttachment, CommentMixedAttachment } from '@liveblocks/core';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
|
|
5
6
|
declare type Direction = "ltr" | "rtl";
|
|
6
7
|
declare type SlotProp = {
|
|
@@ -72,21 +73,21 @@ interface CommentBodyProps extends Omit<ComponentPropsWithSlot<"div">, "children
|
|
|
72
73
|
* @example
|
|
73
74
|
* <Comment.Mention>@{userId}</Comment.Mention>
|
|
74
75
|
*/
|
|
75
|
-
declare const CommentMention:
|
|
76
|
+
declare const CommentMention: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & SlotProp & react.RefAttributes<HTMLSpanElement>>;
|
|
76
77
|
/**
|
|
77
78
|
* Displays links within `Comment.Body`.
|
|
78
79
|
*
|
|
79
80
|
* @example
|
|
80
81
|
* <Comment.Link href={href}>{children}</Comment.Link>
|
|
81
82
|
*/
|
|
82
|
-
declare const CommentLink:
|
|
83
|
+
declare const CommentLink: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & SlotProp & react.RefAttributes<HTMLAnchorElement>>;
|
|
83
84
|
/**
|
|
84
85
|
* Displays a comment body.
|
|
85
86
|
*
|
|
86
87
|
* @example
|
|
87
88
|
* <Comment.Body body={comment.body} />
|
|
88
89
|
*/
|
|
89
|
-
declare const CommentBody:
|
|
90
|
+
declare const CommentBody: react.ForwardRefExoticComponent<CommentBodyProps & react.RefAttributes<HTMLDivElement>>;
|
|
90
91
|
|
|
91
92
|
declare namespace index$2 {
|
|
92
93
|
export {
|
|
@@ -251,25 +252,25 @@ interface ComposerSubmitComment {
|
|
|
251
252
|
* <Composer.MarkToggle mark="italic">Italic</Composer.MarkToggle>
|
|
252
253
|
* </Composer.FloatingToolbar>
|
|
253
254
|
*/
|
|
254
|
-
declare const ComposerFloatingToolbar:
|
|
255
|
+
declare const ComposerFloatingToolbar: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SlotProp & react.RefAttributes<HTMLDivElement>>;
|
|
255
256
|
/**
|
|
256
257
|
* Displays mentions within `Composer.Editor`.
|
|
257
258
|
*
|
|
258
259
|
* @example
|
|
259
260
|
* <Composer.Mention>@{userId}</Composer.Mention>
|
|
260
261
|
*/
|
|
261
|
-
declare const ComposerMention:
|
|
262
|
+
declare const ComposerMention: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & SlotProp & react.RefAttributes<HTMLSpanElement>>;
|
|
262
263
|
/**
|
|
263
264
|
* Displays links within `Composer.Editor`.
|
|
264
265
|
*
|
|
265
266
|
* @example
|
|
266
267
|
* <Composer.Link href={href}>{children}</Composer.Link>
|
|
267
268
|
*/
|
|
268
|
-
declare const ComposerLink:
|
|
269
|
+
declare const ComposerLink: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & SlotProp & react.RefAttributes<HTMLAnchorElement>>;
|
|
269
270
|
/**
|
|
270
271
|
* Contains suggestions within `Composer.Editor`.
|
|
271
272
|
*/
|
|
272
|
-
declare const ComposerSuggestions:
|
|
273
|
+
declare const ComposerSuggestions: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SlotProp & react.RefAttributes<HTMLDivElement>>;
|
|
273
274
|
/**
|
|
274
275
|
* Displays a list of suggestions within `Composer.Editor`.
|
|
275
276
|
*
|
|
@@ -282,7 +283,7 @@ declare const ComposerSuggestions: React__default.ForwardRefExoticComponent<Omit
|
|
|
282
283
|
* ))}
|
|
283
284
|
* </Composer.SuggestionsList>
|
|
284
285
|
*/
|
|
285
|
-
declare const ComposerSuggestionsList:
|
|
286
|
+
declare const ComposerSuggestionsList: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, "ref"> & SlotProp & react.RefAttributes<HTMLUListElement>>;
|
|
286
287
|
/**
|
|
287
288
|
* Displays a suggestion within `Composer.SuggestionsList`.
|
|
288
289
|
*
|
|
@@ -291,14 +292,14 @@ declare const ComposerSuggestionsList: React__default.ForwardRefExoticComponent<
|
|
|
291
292
|
* @{userId}
|
|
292
293
|
* </Composer.SuggestionsListItem>
|
|
293
294
|
*/
|
|
294
|
-
declare const ComposerSuggestionsListItem:
|
|
295
|
+
declare const ComposerSuggestionsListItem: react.ForwardRefExoticComponent<ComposerSuggestionsListItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
295
296
|
/**
|
|
296
297
|
* Displays the composer's editor.
|
|
297
298
|
*
|
|
298
299
|
* @example
|
|
299
300
|
* <Composer.Editor placeholder="Write a comment…" />
|
|
300
301
|
*/
|
|
301
|
-
declare const ComposerEditor:
|
|
302
|
+
declare const ComposerEditor: react.ForwardRefExoticComponent<ComposerEditorProps & react.RefAttributes<HTMLDivElement>>;
|
|
302
303
|
/**
|
|
303
304
|
* Surrounds the composer's content and handles submissions.
|
|
304
305
|
*
|
|
@@ -308,21 +309,21 @@ declare const ComposerEditor: React__default.ForwardRefExoticComponent<ComposerE
|
|
|
308
309
|
* <Composer.Submit />
|
|
309
310
|
* </Composer.Form>
|
|
310
311
|
*/
|
|
311
|
-
declare const ComposerForm:
|
|
312
|
+
declare const ComposerForm: react.ForwardRefExoticComponent<ComposerFormProps & react.RefAttributes<HTMLFormElement>>;
|
|
312
313
|
/**
|
|
313
314
|
* A button to submit the composer.
|
|
314
315
|
*
|
|
315
316
|
* @example
|
|
316
317
|
* <Composer.Submit>Send</Composer.Submit>
|
|
317
318
|
*/
|
|
318
|
-
declare const ComposerSubmit:
|
|
319
|
+
declare const ComposerSubmit: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & react.RefAttributes<HTMLButtonElement>>;
|
|
319
320
|
/**
|
|
320
321
|
* A button which opens a file picker to create attachments.
|
|
321
322
|
*
|
|
322
323
|
* @example
|
|
323
324
|
* <Composer.AttachFiles>Attach files</Composer.AttachFiles>
|
|
324
325
|
*/
|
|
325
|
-
declare const ComposerAttachFiles:
|
|
326
|
+
declare const ComposerAttachFiles: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & SlotProp & react.RefAttributes<HTMLButtonElement>>;
|
|
326
327
|
/**
|
|
327
328
|
* A drop area which accepts files to create attachments.
|
|
328
329
|
*
|
|
@@ -331,7 +332,7 @@ declare const ComposerAttachFiles: React__default.ForwardRefExoticComponent<Omit
|
|
|
331
332
|
* Drop files here
|
|
332
333
|
* </Composer.AttachmentsDropArea>
|
|
333
334
|
*/
|
|
334
|
-
declare const ComposerAttachmentsDropArea:
|
|
335
|
+
declare const ComposerAttachmentsDropArea: react.ForwardRefExoticComponent<ComposerAttachmentsDropAreaProps & react.RefAttributes<HTMLDivElement>>;
|
|
335
336
|
/**
|
|
336
337
|
* A toggle button which toggles a specific text mark.
|
|
337
338
|
*
|
|
@@ -340,7 +341,7 @@ declare const ComposerAttachmentsDropArea: React__default.ForwardRefExoticCompon
|
|
|
340
341
|
* Bold
|
|
341
342
|
* </Composer.MarkToggle>
|
|
342
343
|
*/
|
|
343
|
-
declare const ComposerMarkToggle:
|
|
344
|
+
declare const ComposerMarkToggle: react.ForwardRefExoticComponent<ComposerMarkToggleProps & react.RefAttributes<HTMLButtonElement>>;
|
|
344
345
|
|
|
345
346
|
declare namespace index$1 {
|
|
346
347
|
export {
|
|
@@ -425,7 +426,7 @@ declare type ComposerContext = {
|
|
|
425
426
|
*/
|
|
426
427
|
removeAttachment: (attachmentId: string) => void;
|
|
427
428
|
};
|
|
428
|
-
declare const ComposerContext:
|
|
429
|
+
declare const ComposerContext: react.Context<ComposerContext | null>;
|
|
429
430
|
declare function useComposer(): ComposerContext;
|
|
430
431
|
|
|
431
432
|
declare class AttachmentTooLargeError extends Error {
|
|
@@ -543,7 +544,7 @@ declare type EmojiPickerSearchProps = ComponentPropsWithSlot<"input">;
|
|
|
543
544
|
* <EmojiPicker.Content />
|
|
544
545
|
* </EmojiPicker.Root>
|
|
545
546
|
*/
|
|
546
|
-
declare function EmojiPickerRoot({ columns, locale, onEmojiSelect, children, }: EmojiPickerRootProps):
|
|
547
|
+
declare function EmojiPickerRoot({ columns, locale, onEmojiSelect, children, }: EmojiPickerRootProps): react_jsx_runtime.JSX.Element;
|
|
547
548
|
declare namespace EmojiPickerRoot {
|
|
548
549
|
var displayName: string;
|
|
549
550
|
}
|
|
@@ -560,7 +561,7 @@ declare namespace EmojiPickerRoot {
|
|
|
560
561
|
* @example
|
|
561
562
|
* <EmojiPicker.Search />
|
|
562
563
|
*/
|
|
563
|
-
declare const EmojiPickerSearch:
|
|
564
|
+
declare const EmojiPickerSearch: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps<react.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & SlotProp & react.RefAttributes<HTMLInputElement>>;
|
|
564
565
|
/**
|
|
565
566
|
* @private
|
|
566
567
|
* The EmojiPicker primitive is undocumented for now and subject to change,
|
|
@@ -584,7 +585,7 @@ declare const EmojiPickerSearch: React__default.ForwardRefExoticComponent<Omit<R
|
|
|
584
585
|
* }}
|
|
585
586
|
* />
|
|
586
587
|
*/
|
|
587
|
-
declare const EmojiPickerContent:
|
|
588
|
+
declare const EmojiPickerContent: react.ForwardRefExoticComponent<EmojiPickerContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
588
589
|
|
|
589
590
|
declare namespace index {
|
|
590
591
|
export {
|
|
@@ -614,7 +615,7 @@ interface FileSizeProps extends Omit<ComponentPropsWithSlot<"span">, "children">
|
|
|
614
615
|
* @example
|
|
615
616
|
* <FileSize size={100000} />
|
|
616
617
|
*/
|
|
617
|
-
declare const FileSize:
|
|
618
|
+
declare const FileSize: react.ForwardRefExoticComponent<FileSizeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
618
619
|
|
|
619
620
|
interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children" | "title"> {
|
|
620
621
|
/**
|
|
@@ -652,6 +653,6 @@ interface TimestampProps extends Omit<ComponentPropsWithSlot<"time">, "children"
|
|
|
652
653
|
* {(date) => date.toLocaleDateString()}
|
|
653
654
|
* </Timestamp>
|
|
654
655
|
*/
|
|
655
|
-
declare const Timestamp:
|
|
656
|
+
declare const Timestamp: react.ForwardRefExoticComponent<TimestampProps & react.RefAttributes<HTMLTimeElement>>;
|
|
656
657
|
|
|
657
658
|
export { AttachmentTooLargeError, index$2 as Comment, CommentBodyComponents, CommentBodyLinkProps, CommentBodyMentionProps, CommentBodyProps, CommentLinkProps, CommentMentionProps, index$1 as Composer, ComposerAttachFilesProps, ComposerAttachmentsDropAreaProps, ComposerBodyMark, ComposerBodyMarks, ComposerContext, ComposerEditorComponents, ComposerEditorFloatingToolbarProps, ComposerEditorLinkProps, ComposerEditorMentionProps, ComposerEditorMentionSuggestionsProps, ComposerEditorProps, ComposerFloatingToolbarProps, ComposerFormProps, ComposerLinkProps, ComposerMarkToggleProps, ComposerMentionProps, ComposerSubmitComment, ComposerSubmitProps, ComposerSuggestionsListItemProps, ComposerSuggestionsListProps, index as EmojiPicker, EmojiPickerContentCategoryHeaderProps, EmojiPickerContentComponents, EmojiPickerContentEmojiProps, EmojiPickerContentEmptyProps, EmojiPickerContentErrorProps, EmojiPickerContentGridProps, EmojiPickerContentLoadingProps, EmojiPickerContentProps, EmojiPickerContentRowProps, EmojiPickerRootProps, EmojiPickerSearchProps, FileSize, FileSizeProps, Timestamp, TimestampProps, useComposer };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
3
4
|
var reactSlot = require('@radix-ui/react-slot');
|
|
4
|
-
var
|
|
5
|
+
var react = require('react');
|
|
5
6
|
var constants = require('../../constants.js');
|
|
6
7
|
|
|
7
|
-
const Emoji =
|
|
8
|
+
const Emoji = react.forwardRef(
|
|
8
9
|
({ emoji, style, asChild, ...props }, forwardedRef) => {
|
|
9
10
|
const Component = asChild ? reactSlot.Slot : "span";
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, {
|
|
11
12
|
role: "img",
|
|
12
13
|
"aria-label": emoji,
|
|
13
14
|
"data-emoji": emoji,
|
|
@@ -21,8 +22,9 @@ const Emoji = React.forwardRef(
|
|
|
21
22
|
whiteSpace: "nowrap"
|
|
22
23
|
},
|
|
23
24
|
...props,
|
|
24
|
-
ref: forwardedRef
|
|
25
|
-
|
|
25
|
+
ref: forwardedRef,
|
|
26
|
+
children: emoji
|
|
27
|
+
});
|
|
26
28
|
}
|
|
27
29
|
);
|
|
28
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emoji.js","sources":["../../../src/primitives/internal/Emoji.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport
|
|
1
|
+
{"version":3,"file":"Emoji.js","sources":["../../../src/primitives/internal/Emoji.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nimport { EMOJI_FONT_FAMILY } from \"../../constants\";\nimport type { ComponentPropsWithSlot } from \"../../types\";\n\nexport interface EmojiProps extends ComponentPropsWithSlot<\"span\"> {\n emoji: string;\n}\n\nexport const Emoji = forwardRef<HTMLSpanElement, EmojiProps>(\n ({ emoji, style, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? Slot : \"span\";\n\n return (\n <Component\n role=\"img\"\n aria-label={emoji}\n data-emoji={emoji}\n style={{\n ...style,\n fontFamily: EMOJI_FONT_FAMILY,\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"1em\",\n whiteSpace: \"nowrap\",\n }}\n {...props}\n ref={forwardedRef}\n >\n {emoji}\n </Component>\n );\n }\n);\n"],"names":["forwardRef","Slot","jsx","EMOJI_FONT_FAMILY"],"mappings":";;;;;;;AAUO,MAAM,KAAQ,GAAAA,gBAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,OAAO,OAAY,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACrD,IAAM,MAAA,SAAA,GAAY,UAAUC,cAAO,GAAA,MAAA,CAAA;AAEnC,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,YAAY,EAAA,KAAA;AAAA,MACZ,YAAY,EAAA,KAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,GAAG,KAAA;AAAA,QACH,UAAY,EAAAC,2BAAA;AAAA,QACZ,OAAS,EAAA,aAAA;AAAA,QACT,UAAY,EAAA,QAAA;AAAA,QACZ,cAAgB,EAAA,QAAA;AAAA,QAChB,KAAO,EAAA,KAAA;AAAA,QACP,UAAY,EAAA,QAAA;AAAA,OACd;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,MAEJ,QAAA,EAAA,KAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
1
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
2
|
-
import
|
|
3
|
+
import { forwardRef } from 'react';
|
|
3
4
|
import { EMOJI_FONT_FAMILY } from '../../constants.mjs';
|
|
4
5
|
|
|
5
6
|
const Emoji = forwardRef(
|
|
6
7
|
({ emoji, style, asChild, ...props }, forwardedRef) => {
|
|
7
8
|
const Component = asChild ? Slot : "span";
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ jsx(Component, {
|
|
9
10
|
role: "img",
|
|
10
11
|
"aria-label": emoji,
|
|
11
12
|
"data-emoji": emoji,
|
|
@@ -19,8 +20,9 @@ const Emoji = forwardRef(
|
|
|
19
20
|
whiteSpace: "nowrap"
|
|
20
21
|
},
|
|
21
22
|
...props,
|
|
22
|
-
ref: forwardedRef
|
|
23
|
-
|
|
23
|
+
ref: forwardedRef,
|
|
24
|
+
children: emoji
|
|
25
|
+
});
|
|
24
26
|
}
|
|
25
27
|
);
|
|
26
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emoji.mjs","sources":["../../../src/primitives/internal/Emoji.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport
|
|
1
|
+
{"version":3,"file":"Emoji.mjs","sources":["../../../src/primitives/internal/Emoji.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nimport { EMOJI_FONT_FAMILY } from \"../../constants\";\nimport type { ComponentPropsWithSlot } from \"../../types\";\n\nexport interface EmojiProps extends ComponentPropsWithSlot<\"span\"> {\n emoji: string;\n}\n\nexport const Emoji = forwardRef<HTMLSpanElement, EmojiProps>(\n ({ emoji, style, asChild, ...props }, forwardedRef) => {\n const Component = asChild ? Slot : \"span\";\n\n return (\n <Component\n role=\"img\"\n aria-label={emoji}\n data-emoji={emoji}\n style={{\n ...style,\n fontFamily: EMOJI_FONT_FAMILY,\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n width: \"1em\",\n whiteSpace: \"nowrap\",\n }}\n {...props}\n ref={forwardedRef}\n >\n {emoji}\n </Component>\n );\n }\n);\n"],"names":[],"mappings":";;;;;AAUO,MAAM,KAAQ,GAAA,UAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,OAAO,OAAY,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACrD,IAAM,MAAA,SAAA,GAAY,UAAU,IAAO,GAAA,MAAA,CAAA;AAEnC,IAAA,uBACG,GAAA,CAAA,SAAA,EAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,YAAY,EAAA,KAAA;AAAA,MACZ,YAAY,EAAA,KAAA;AAAA,MACZ,KAAO,EAAA;AAAA,QACL,GAAG,KAAA;AAAA,QACH,UAAY,EAAA,iBAAA;AAAA,QACZ,OAAS,EAAA,aAAA;AAAA,QACT,UAAY,EAAA,QAAA;AAAA,QACZ,cAAgB,EAAA,QAAA;AAAA,QAChB,KAAO,EAAA,KAAA;AAAA,QACP,UAAY,EAAA,QAAA;AAAA,OACd;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,MAEJ,QAAA,EAAA,KAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
package/dist/shared.js
CHANGED
|
@@ -2,16 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@liveblocks/core');
|
|
4
4
|
var react = require('@liveblocks/react');
|
|
5
|
-
var
|
|
5
|
+
var _private = require('@liveblocks/react/_private');
|
|
6
6
|
|
|
7
7
|
function useCurrentUserId() {
|
|
8
8
|
const client = react.useClient();
|
|
9
|
-
|
|
10
|
-
return index_js.useSyncExternalStore(
|
|
11
|
-
currentUserIdStore.subscribe,
|
|
12
|
-
currentUserIdStore.get,
|
|
13
|
-
currentUserIdStore.get
|
|
14
|
-
) ?? null;
|
|
9
|
+
return _private.useSignal(client[core.kInternal].currentUserId) ?? null;
|
|
15
10
|
}
|
|
16
11
|
|
|
17
12
|
exports.useCurrentUserId = useCurrentUserId;
|
package/dist/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sources":["../src/shared.ts"],"sourcesContent":["import { kInternal } from \"@liveblocks/core\";\nimport { useClient } from \"@liveblocks/react\";\nimport {
|
|
1
|
+
{"version":3,"file":"shared.js","sources":["../src/shared.ts"],"sourcesContent":["import { kInternal } from \"@liveblocks/core\";\nimport { useClient } from \"@liveblocks/react\";\nimport { useSignal } from \"@liveblocks/react/_private\";\n\nexport function useCurrentUserId(): string | null {\n const client = useClient();\n return useSignal(client[kInternal].currentUserId) ?? null;\n}\n"],"names":["useClient","useSignal","kInternal"],"mappings":";;;;;;AAIO,SAAS,gBAAkC,GAAA;AAChD,EAAA,MAAM,SAASA,eAAU,EAAA,CAAA;AACzB,EAAA,OAAOC,kBAAU,CAAA,MAAA,CAAOC,cAAW,CAAA,CAAA,aAAa,CAAK,IAAA,IAAA,CAAA;AACvD;;;;"}
|