@cairntale/chimeling-react 0.0.0 → 1.0.0-alpha.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/CHANGELOG.md +7 -0
- package/dist/components/chimeling.d.ts +12 -0
- package/dist/components/chimeling.js +13 -0
- package/dist/components/chimeling.js.map +1 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +7 -0
- package/dist/components/logo.js +19 -0
- package/dist/components/logo.js.map +1 -0
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +36 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/provider.d.ts +11 -0
- package/dist/components/provider.js +24 -0
- package/dist/components/provider.js.map +1 -0
- package/dist/components/root.d.ts +20 -0
- package/dist/components/root.js +66 -0
- package/dist/components/root.js.map +1 -0
- package/dist/components/trigger.d.ts +7 -0
- package/dist/components/trigger.js +23 -0
- package/dist/components/trigger.js.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-client.d.ts +6 -0
- package/dist/hooks/use-client.js +10 -0
- package/dist/hooks/use-client.js.map +1 -0
- package/dist/hooks/use-resolved-user-presence.d.ts +27 -0
- package/dist/hooks/use-resolved-user-presence.js +22 -0
- package/dist/hooks/use-resolved-user-presence.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +11 -0
- package/dist/lib/config.js +11 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/context.js +14 -0
- package/dist/lib/context.js.map +1 -0
- package/dist/lib/format-activity-duration.js +26 -0
- package/dist/lib/format-activity-duration.js.map +1 -0
- package/dist/lib/icon-url.js +9 -0
- package/dist/lib/icon-url.js.map +1 -0
- package/dist/lib/presence-key.js +14 -0
- package/dist/lib/presence-key.js.map +1 -0
- package/dist/lib/showable-presence.d.ts +12 -0
- package/dist/lib/showable-presence.js +12 -0
- package/dist/lib/showable-presence.js.map +1 -0
- package/dist/lib/widget-context.d.ts +6 -0
- package/dist/lib/widget-context.js +14 -0
- package/dist/lib/widget-context.js.map +1 -0
- package/dist/react/package.js +6 -0
- package/dist/react/package.js.map +1 -0
- package/dist/sdk/src/client/client/client.gen.js +174 -0
- package/dist/sdk/src/client/client/client.gen.js.map +1 -0
- package/dist/sdk/src/client/client/index.js +5 -0
- package/dist/sdk/src/client/client/utils.gen.js +177 -0
- package/dist/sdk/src/client/client/utils.gen.js.map +1 -0
- package/dist/sdk/src/client/core/auth.gen.js +12 -0
- package/dist/sdk/src/client/core/auth.gen.js.map +1 -0
- package/dist/sdk/src/client/core/bodySerializer.gen.js +6 -0
- package/dist/sdk/src/client/core/bodySerializer.gen.js.map +1 -0
- package/dist/sdk/src/client/core/params.gen.js +9 -0
- package/dist/sdk/src/client/core/params.gen.js.map +1 -0
- package/dist/sdk/src/client/core/pathSerializer.gen.js +82 -0
- package/dist/sdk/src/client/core/pathSerializer.gen.js.map +1 -0
- package/dist/sdk/src/client/core/serverSentEvents.gen.js +96 -0
- package/dist/sdk/src/client/core/serverSentEvents.gen.js.map +1 -0
- package/dist/sdk/src/client/core/utils.gen.js +78 -0
- package/dist/sdk/src/client/core/utils.gen.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/package.json +34 -9
- package/src/components/chimeling.ts +9 -0
- package/src/components/index.ts +8 -0
- package/src/components/logo.tsx +18 -0
- package/src/components/popover.tsx +44 -0
- package/src/components/provider.tsx +26 -0
- package/src/components/root.tsx +91 -0
- package/src/components/trigger.tsx +33 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use-client.ts +8 -0
- package/src/hooks/use-resolved-user-presence.ts +27 -0
- package/src/index.ts +4 -0
- package/src/lib/config.ts +9 -0
- package/src/lib/context.ts +24 -0
- package/src/lib/format-activity-duration.ts +21 -0
- package/src/lib/icon-url.ts +5 -0
- package/src/lib/presence-key.ts +5 -0
- package/src/lib/showable-presence.ts +22 -0
- package/src/lib/widget-context.ts +33 -0
- package/src/types.ts +3 -0
- package/tsconfig.json +14 -0
- package/tsdown.config.ts +13 -0
- package/turbo.json +10 -0
- package/index.js +0 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { createContext, useContext } from 'react'
|
|
4
|
+
import type { PopoverPositionerProps } from '@base-ui/react/popover'
|
|
5
|
+
import { packageErrorMessage } from './config'
|
|
6
|
+
import type { ShowablePresence } from './showable-presence'
|
|
7
|
+
|
|
8
|
+
export type WidgetPlacement = Pick<PopoverPositionerProps, 'side' | 'align' | 'sideOffset'>
|
|
9
|
+
|
|
10
|
+
export type WidgetContextValue = {
|
|
11
|
+
showable: ShowablePresence | null
|
|
12
|
+
now: Date
|
|
13
|
+
poweredBy: boolean
|
|
14
|
+
openOnHover: boolean
|
|
15
|
+
hoverOpenDelay: number
|
|
16
|
+
hoverCloseDelay: number
|
|
17
|
+
placement: WidgetPlacement
|
|
18
|
+
baseUrl: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const WidgetContext = createContext<WidgetContextValue | null>(null)
|
|
22
|
+
|
|
23
|
+
export function useWidgetContext(): WidgetContextValue {
|
|
24
|
+
const context = useContext(WidgetContext)
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error(
|
|
27
|
+
packageErrorMessage(
|
|
28
|
+
'This component can only be used within the <Chimeling.Root /> component.',
|
|
29
|
+
),
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
return context
|
|
33
|
+
}
|
package/src/types.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "es2025",
|
|
5
|
+
"lib": ["ES2025", "DOM"],
|
|
6
|
+
"module": "preserve",
|
|
7
|
+
"moduleResolution": "bundler",
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"jsx": "react-jsx"
|
|
12
|
+
},
|
|
13
|
+
"include": ["./src"]
|
|
14
|
+
}
|
package/tsdown.config.ts
ADDED
package/turbo.json
ADDED
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// Placeholder
|