useyuva 0.0.6 → 0.0.8

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 (45) hide show
  1. package/README.md +89 -1
  2. package/dist/esm/chat.js +2 -2
  3. package/dist/esm/docs.js +134 -0
  4. package/dist/esm/index-dj5dhqc1.js +12 -0
  5. package/dist/esm/index-e2tek7yk.js +2 -0
  6. package/dist/esm/index-jdxce2se.js +4 -0
  7. package/dist/esm/index-rdzxvj2r.js +2 -0
  8. package/dist/esm/index.js +1 -1
  9. package/dist/esm/nuxt/module.js +20 -0
  10. package/dist/esm/nuxt/runtime/components.js +88 -0
  11. package/dist/esm/react.js +1 -1
  12. package/dist/esm/thread-3ydc3xfc.js +61 -0
  13. package/dist/esm/{yuva-chat-tebg111a.js → yuva-chat-86e4mz63.js} +2 -4
  14. package/dist/types/client/api.d.ts +17 -0
  15. package/dist/types/client/client.d.ts +23 -1
  16. package/dist/types/client/reader.d.ts +12 -0
  17. package/dist/types/docs/base.d.ts +43 -0
  18. package/dist/types/docs/define.d.ts +1 -0
  19. package/dist/types/docs/discussions.d.ts +22 -0
  20. package/dist/types/docs/dom.d.ts +1 -0
  21. package/dist/types/docs/feedback.d.ts +21 -0
  22. package/dist/types/docs/page.d.ts +2 -0
  23. package/dist/types/docs/preview.d.ts +1 -0
  24. package/dist/types/docs/thread.d.ts +71 -0
  25. package/dist/types/docs.d.ts +7 -0
  26. package/dist/types/element.d.ts +0 -1
  27. package/dist/types/i18n.d.ts +1 -1
  28. package/dist/types/index.d.ts +3 -2
  29. package/dist/types/locales/en/docs.d.ts +2 -0
  30. package/dist/types/locales/en/thread.d.ts +2 -0
  31. package/dist/types/locales/tr/docs.d.ts +2 -0
  32. package/dist/types/locales/tr/thread.d.ts +2 -0
  33. package/dist/types/nuxt/module.d.ts +12 -0
  34. package/dist/types/nuxt/runtime/components.d.ts +88 -0
  35. package/dist/types/react.d.ts +26 -2
  36. package/dist/types/schema.gen.d.ts +6638 -3874
  37. package/dist/types/translate.d.ts +2 -0
  38. package/dist/types/types.d.ts +1 -0
  39. package/dist/widget/yuva-docs-thread-4580g2ny.js +61 -0
  40. package/dist/yuva-chat.js +8 -8
  41. package/dist/yuva-docs.js +144 -0
  42. package/dist/yuva.js +2 -2
  43. package/package.json +39 -8
  44. package/dist/esm/index-d1vxbqpr.js +0 -12
  45. package/dist/esm/index-r5vcg0sx.js +0 -2
@@ -0,0 +1,71 @@
1
+ import type { Discussion, DiscussionAuthor, DiscussionDetail, DiscussionPost } from "../client/api.js";
2
+ import type { YuvaClient } from "../client/client.js";
3
+ import type { ReaderSession } from "../client/reader.js";
4
+ export type View = {
5
+ kind: "list";
6
+ } | {
7
+ kind: "thread";
8
+ id: string;
9
+ } | {
10
+ kind: "new";
11
+ };
12
+ export type Writer = "reader" | "contact" | null;
13
+ type Badge = "answered" | "pending" | "team" | "locked";
14
+ export interface DiscussionDetailEvent {
15
+ page: string;
16
+ discussion_id: string;
17
+ state: Discussion["state"];
18
+ }
19
+ export interface DiscussionPostDetail {
20
+ page: string;
21
+ discussion_id: string;
22
+ post_id: string;
23
+ state: DiscussionPost["state"];
24
+ }
25
+ export interface DiscussionsState {
26
+ view: View;
27
+ items: Discussion[];
28
+ thread: DiscussionDetail | null;
29
+ threadState: "loading" | "ready" | "missing" | "error";
30
+ writer: Writer;
31
+ reader: ReaderSession | null;
32
+ busy: Set<string>;
33
+ notice: string;
34
+ error: string;
35
+ confirm: string;
36
+ focus: string;
37
+ }
38
+ export interface ThreadHost {
39
+ s: DiscussionsState;
40
+ readonly root: ParentNode;
41
+ locale(): string;
42
+ direction(): "ltr" | "rtl";
43
+ page(): string;
44
+ pageTitle(): string;
45
+ mode(): string;
46
+ readonly icons: Record<"up" | "lock" | "clock", string>;
47
+ client(): YuvaClient;
48
+ render(): void;
49
+ emit(type: string, detail: unknown): void;
50
+ act<T>(key: string, action: () => Promise<T>): Promise<T | undefined>;
51
+ signIn(): Promise<void>;
52
+ open(id: string, focus: boolean): Promise<void>;
53
+ toList(): void;
54
+ forget(): void;
55
+ button(className: string, text: string, key: string, onClick: () => void, html?: string): HTMLButtonElement;
56
+ avatar(author: DiscussionAuthor, small?: boolean): HTMLElement;
57
+ badge(kind: Badge, short?: boolean): HTMLElement;
58
+ time(value: string): HTMLTimeElement;
59
+ authorName(author: DiscussionAuthor): string;
60
+ noticeBox(text: string, icon?: string): HTMLElement;
61
+ }
62
+ export interface Thread {
63
+ threadView(): Node[];
64
+ newView(): Node[];
65
+ syncSend(): void;
66
+ close(): void;
67
+ reset(): void;
68
+ }
69
+ export declare const styles = "\n.thread { display: flex; flex-direction: column; gap: 12px; }\n.thread-head { display: flex; flex-direction: column; gap: 8px; }\n.post { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--yuva-border); border-radius: 12px; }\n.post.accepted { border-color: var(--yuva-success); box-shadow: inset 0 0 0 1px var(--yuva-success); }\n.post.pending { border-style: dashed; }\n.side { display: flex; flex-direction: column; align-items: center; gap: 6px; }\n.vote {\n display: inline-flex; flex-direction: column; align-items: center; gap: 0; min-inline-size: 40px; padding: 4px 6px;\n border: 1px solid var(--yuva-border); border-radius: 8px; background: none; cursor: pointer; font-size: 0.85em; font-weight: 600;\n}\n.vote:hover:not(:disabled) { border-color: var(--yuva-accent); }\n.vote[aria-pressed=\"true\"] { border-color: var(--yuva-accent); color: var(--yuva-accent); background: var(--yuva-soft); }\n.post-body { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; gap: 8px; }\n.post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.88em; }\n.name { font-weight: 600; }\n.answer-label { display: flex; align-items: center; gap: 6px; color: var(--yuva-success); font-weight: 600; font-size: 0.85em; }\n.tools { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }\n.children { display: flex; flex-direction: column; gap: 10px; margin-block-start: 4px; padding-inline-start: 14px; border-inline-start: 2px solid var(--yuva-border); }\n.children .post { padding: 10px 0; border: 0; box-shadow: none; }\n.children .post + .post { border-block-start: 1px solid var(--yuva-border); border-radius: 0; }\n.deleted { font-style: italic; opacity: 0.65; }\n.signin { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 14px; border: 1px solid var(--yuva-border); border-radius: 12px; }\n.composer { display: flex; flex-direction: column; border: 1px solid var(--yuva-border); border-radius: 12px; overflow: hidden; }\n.composer:focus-within { border-color: var(--yuva-accent); }\n.composer .ctabs { display: flex; gap: 4px; padding: 0 8px; border-block-end: 1px solid var(--yuva-border); }\n.composer .ctab { padding: 7px 10px; border: 0; border-block-end: 2px solid transparent; background: none; cursor: pointer; font-size: 0.88em; opacity: 0.75; margin-block-end: -1px; }\n.composer .ctab[aria-selected=\"true\"] { border-block-end-color: var(--yuva-accent); font-weight: 600; opacity: 1; }\n.composer .ctab:focus-visible { outline: 2px solid var(--yuva-accent); outline-offset: -2px; }\n.composer textarea, .composer .preview { border: 0; border-radius: 0; min-block-size: 110px; padding: 10px 12px; }\n.composer textarea:focus-visible { outline: none; }\n.composer .preview { overflow-wrap: anywhere; }\n.composer .foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border-block-start: 1px solid var(--yuva-border); }\n.composer .hint { font-size: 0.8em; opacity: 0.7; }\n.composer .buttons { display: flex; gap: 8px; margin-inline-start: auto; }\n.field-title { font-size: 1.05em; font-weight: 600; }\n.form { display: flex; flex-direction: column; gap: 10px; }\n.md { overflow-wrap: anywhere; }\n.md > :first-child { margin-block-start: 0; }\n.md > :last-child { margin-block-end: 0; }\n.md p, .md ul, .md ol, .md pre, .md blockquote, .md table { margin: 0 0 0.75em; }\n.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 0.9em 0 0.4em; font-size: 1em; font-weight: 600; }\n.md h1, .md h3 { font-size: 1.1em; }\n.md ul, .md ol { padding-inline-start: 1.5em; }\n.md a { color: var(--yuva-accent); }\n.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; padding: 1px 5px; border-radius: 5px; background: var(--yuva-soft); }\n.md pre { padding: 10px 12px; border-radius: 8px; background: var(--yuva-soft); overflow-x: auto; }\n.md pre code { padding: 0; background: none; }\n.md blockquote { padding-inline-start: 12px; border-inline-start: 3px solid var(--yuva-border); opacity: 0.85; }\n.md table { border-collapse: collapse; display: block; overflow-x: auto; }\n.md th, .md td { border: 1px solid var(--yuva-border); padding: 4px 8px; }\n.md img { max-inline-size: 100%; }\n.md hr { border: 0; border-block-start: 1px solid var(--yuva-border); }\n@media (max-width: 560px) {\n .post { padding: 12px; gap: 10px; }\n}\n";
70
+ export declare function createThread(host: ThreadHost): Thread;
71
+ export {};
@@ -0,0 +1,7 @@
1
+ import { defineDocs } from "./docs/define.js";
2
+ import { YuvaDiscussionsElement, type DiscussionDetailEvent, type DiscussionPostDetail } from "./docs/discussions.js";
3
+ import { YuvaPageFeedbackElement, type PageFeedbackDetail, type PageRatingDetail } from "./docs/feedback.js";
4
+ export { defineDocs, YuvaDiscussionsElement, YuvaPageFeedbackElement, type DiscussionDetailEvent, type DiscussionPostDetail, type PageFeedbackDetail, type PageRatingDetail, };
5
+ export type { IdentityTokenSource } from "./client/client.js";
6
+ export type { Discussion, DiscussionPost, PageRating, ReaderProfile } from "./client/api.js";
7
+ export type { ReaderSession } from "./client/reader.js";
@@ -1,5 +1,4 @@
1
1
  import { type IdentityTokenSource, type ClientConversation, type Layout, type PanelModule, type Rating } from "./types.js";
2
- export declare function contrastOn(color: string): string;
3
2
  export declare class YuvaChatElement extends HTMLElement {
4
3
  #private;
5
4
  static observedAttributes: string[];
@@ -3,4 +3,4 @@ export declare const sourceLocale = "en";
3
3
  export declare function resolveLocale(...candidates: (string | null | undefined)[]): string;
4
4
  export declare function directionOf(locale: string): "ltr" | "rtl";
5
5
  export declare function catalogFor(locale: string): Messages;
6
- export declare function translatePlain(messages: Messages, descriptor: MessageDescriptor): string;
6
+ export declare function translatePlain(messages: Messages, descriptor: MessageDescriptor, fallback?: Messages): string;
@@ -1,2 +1,3 @@
1
- export { createYuvaClient, YuvaClient, type ConnectionState, type ConversationInput, type IdentityTokenSource, type MessageInput, type Page, type StoredState, type YuvaClientEvents, type YuvaClientOptions, type YuvaStorage, } from "./client/client.js";
2
- export { ApiError, type Fetch, type ClientAttachment, type ClientContact, type ClientConversation, type ClientConversationCreated, type ClientConversationPage, type ClientInbox, type ClientMessage, type ClientMessagePage, type ClientPresence, type ClientReadState, type ClientRealtimeMessage, type ClientSession, type ClientSessionInfo, type Problem, } from "./client/api.js";
1
+ export { createYuvaClient, YuvaClient, type ConnectionState, type ConversationInput, type DiscussionListOptions, type IdentityTokenSource, type MessageInput, type Page, type StoredState, type YuvaClientEvents, type YuvaClientOptions, type YuvaStorage, } from "./client/client.js";
2
+ export { openReaderPopup, readerConnectUrl, type ReaderSession, type ReaderSignInOptions } from "./client/reader.js";
3
+ export { ApiError, type Fetch, type ClientAttachment, type ClientChatSettings, type ClientContact, type ClientConversation, type ClientConversationCreated, type ClientConversationPage, type ClientFeedbackCreate, type ClientInbox, type ClientMessage, type ClientMessagePage, type ClientDiscussionCreate, type ClientDiscussionPostUpdate, type ClientPresence, type ClientReadState, type ClientRealtimeMessage, type ClientSession, type ClientSessionInfo, type Discussion, type DiscussionAuthor, type DiscussionDetail, type DiscussionMode, type DiscussionPage, type DiscussionPost, type DiscussionPostCreate, type DiscussionSort, type DiscussionState, type PageRating, type PageRatingCreate, type Problem, type ReaderProfile, type ReaderToken, } from "./client/api.js";
@@ -0,0 +1,2 @@
1
+ import type { Messages } from "@lingui/core";
2
+ export declare const messages: Messages;
@@ -0,0 +1,2 @@
1
+ import type { Messages } from "@lingui/core";
2
+ export declare const messages: Messages;
@@ -0,0 +1,2 @@
1
+ import type { Messages } from "@lingui/core";
2
+ export declare const messages: Messages;
@@ -0,0 +1,2 @@
1
+ import type { Messages } from "@lingui/core";
2
+ export declare const messages: Messages;
@@ -0,0 +1,12 @@
1
+ export interface ModuleOptions {
2
+ server?: string;
3
+ channel?: string;
4
+ locale?: string;
5
+ }
6
+ declare module "@nuxt/schema" {
7
+ interface PublicRuntimeConfig {
8
+ yuva: Required<ModuleOptions>;
9
+ }
10
+ }
11
+ declare const _default: import("@nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
12
+ export default _default;
@@ -0,0 +1,88 @@
1
+ import { type PropType } from "vue";
2
+ import type { IdentityTokenSource, Layout } from "../../types.js";
3
+ import type { DiscussionDetailEvent, DiscussionPostDetail, PageFeedbackDetail, PageRatingDetail } from "../../docs.js";
4
+ import type { ReaderProfile } from "../../client/api.js";
5
+ export declare const YuvaPageFeedback: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
6
+ channel: StringConstructor;
7
+ server: StringConstructor;
8
+ locale: StringConstructor;
9
+ dir: PropType<"ltr" | "rtl">;
10
+ identityToken: PropType<string | IdentityTokenSource | null>;
11
+ page: StringConstructor;
12
+ pageTitle: StringConstructor;
13
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
14
+ [key: string]: any;
15
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ rating: (_: PageRatingDetail) => true;
17
+ feedback: (_: PageFeedbackDetail) => true;
18
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
+ channel: StringConstructor;
20
+ server: StringConstructor;
21
+ locale: StringConstructor;
22
+ dir: PropType<"ltr" | "rtl">;
23
+ identityToken: PropType<string | IdentityTokenSource | null>;
24
+ page: StringConstructor;
25
+ pageTitle: StringConstructor;
26
+ }>> & Readonly<{
27
+ onFeedback?: ((_: PageFeedbackDetail) => any) | undefined;
28
+ onRating?: ((_: PageRatingDetail) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
30
+ export declare const YuvaDiscussions: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
31
+ channel: StringConstructor;
32
+ server: StringConstructor;
33
+ locale: StringConstructor;
34
+ dir: PropType<"ltr" | "rtl">;
35
+ identityToken: PropType<string | IdentityTokenSource | null>;
36
+ page: StringConstructor;
37
+ pageTitle: StringConstructor;
38
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
39
+ [key: string]: any;
40
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
41
+ discussion: (_: DiscussionDetailEvent) => true;
42
+ post: (_: DiscussionPostDetail) => true;
43
+ reader: (_: ReaderProfile | null) => true;
44
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
45
+ channel: StringConstructor;
46
+ server: StringConstructor;
47
+ locale: StringConstructor;
48
+ dir: PropType<"ltr" | "rtl">;
49
+ identityToken: PropType<string | IdentityTokenSource | null>;
50
+ page: StringConstructor;
51
+ pageTitle: StringConstructor;
52
+ }>> & Readonly<{
53
+ onDiscussion?: ((_: DiscussionDetailEvent) => any) | undefined;
54
+ onPost?: ((_: DiscussionPostDetail) => any) | undefined;
55
+ onReader?: ((_: {
56
+ name?: string;
57
+ initials: string;
58
+ } | null) => any) | undefined;
59
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
60
+ export declare const YuvaChat: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
61
+ channel: StringConstructor;
62
+ server: StringConstructor;
63
+ locale: StringConstructor;
64
+ dir: PropType<"ltr" | "rtl">;
65
+ identityToken: PropType<string | IdentityTokenSource | null>;
66
+ layout: PropType<Layout>;
67
+ open: BooleanConstructor;
68
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
69
+ [key: string]: any;
70
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
71
+ unread: (_: {
72
+ count: number;
73
+ }) => true;
74
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
75
+ channel: StringConstructor;
76
+ server: StringConstructor;
77
+ locale: StringConstructor;
78
+ dir: PropType<"ltr" | "rtl">;
79
+ identityToken: PropType<string | IdentityTokenSource | null>;
80
+ layout: PropType<Layout>;
81
+ open: BooleanConstructor;
82
+ }>> & Readonly<{
83
+ onUnread?: ((_: {
84
+ count: number;
85
+ }) => any) | undefined;
86
+ }>, {
87
+ open: boolean;
88
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,6 +1,8 @@
1
- import { type ReactElement, type ReactNode } from "react";
1
+ import { type CSSProperties, type ReactElement, type ReactNode } from "react";
2
2
  import type { ClientConversation, ClientMessage } from "./client/api.js";
3
- import type { MessageInput, YuvaClient } from "./client/client.js";
3
+ import type { IdentityTokenSource, MessageInput, YuvaClient } from "./client/client.js";
4
+ import type { DiscussionDetailEvent, DiscussionPostDetail, PageFeedbackDetail, PageRatingDetail } from "./docs.js";
5
+ import type { ReaderProfile } from "./client/api.js";
4
6
  export interface YuvaProviderProps {
5
7
  client: YuvaClient;
6
8
  connect?: boolean;
@@ -27,3 +29,25 @@ export interface MessagesResult {
27
29
  markRead(): Promise<void>;
28
30
  }
29
31
  export declare function useMessages(conversationId: string | null | undefined): MessagesResult;
32
+ export interface YuvaDocsProps {
33
+ channel: string;
34
+ server?: string;
35
+ locale?: string;
36
+ dir?: "ltr" | "rtl";
37
+ page?: string;
38
+ pageTitle?: string;
39
+ identityToken?: string | IdentityTokenSource | null;
40
+ className?: string;
41
+ style?: CSSProperties;
42
+ }
43
+ export interface YuvaPageFeedbackProps extends YuvaDocsProps {
44
+ onRating?: (detail: PageRatingDetail) => void;
45
+ onFeedback?: (detail: PageFeedbackDetail) => void;
46
+ }
47
+ export interface YuvaDiscussionsProps extends YuvaDocsProps {
48
+ onDiscussion?: (detail: DiscussionDetailEvent) => void;
49
+ onPost?: (detail: DiscussionPostDetail) => void;
50
+ onReader?: (detail: ReaderProfile | null) => void;
51
+ }
52
+ export declare function YuvaPageFeedback({ onRating, onFeedback, ...props }: YuvaPageFeedbackProps): ReactElement;
53
+ export declare function YuvaDiscussions({ onDiscussion, onPost, onReader, ...props }: YuvaDiscussionsProps): ReactElement;