microboard-ui-temp 0.1.169 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/_redirects +1 -0
  2. package/dist/{chunk-g9f7dzez.js → chunk-dy5ccdyb.js} +73513 -73170
  3. package/dist/{chunk-d2kcyv9d.css → chunk-f0mvcsbm.css} +424 -223
  4. package/dist/env.js +5 -0
  5. package/dist/example.html +2 -2
  6. package/dist/index.css +424 -223
  7. package/dist/index.html +96 -0
  8. package/dist/index.js +73513 -73170
  9. package/dist/spa.css +424 -223
  10. package/dist/spa.js +73513 -73170
  11. package/dist/titlePanel.js +21 -8
  12. package/dist/types/App/Connection.d.ts +11 -15
  13. package/dist/types/App/Storage.d.ts +2 -0
  14. package/dist/types/entities/comments/Thread/message/Message.d.ts +1 -1
  15. package/dist/types/entities/comments/{useScrollToUnreadMessage.d.ts → hooks/useScrollToUnreadMessage.d.ts} +2 -1
  16. package/dist/types/entities/comments/index.d.ts +1 -1
  17. package/dist/types/features/BoardItemsPanel/BoardItemsPanel.d.ts +2 -0
  18. package/dist/types/features/BoardItemsPanel/BoardItemsPanelContext.d.ts +11 -0
  19. package/dist/types/features/BoardItemsPanel/index.d.ts +2 -0
  20. package/dist/types/features/SidePanel/BoardItemsList.d.ts +6 -0
  21. package/dist/types/features/SidePanel/SidePanelContext.d.ts +3 -0
  22. package/dist/types/features/Templates/SelectTemplateModal/TemplateItemPreview/TemplateItemPreview.d.ts +3 -8
  23. package/dist/types/features/Templates/SelectTemplateModal/TemplateItemsGrid/TemplateItem/TemplateItem.d.ts +1 -1
  24. package/dist/types/features/Templates/SelectTemplateModal/TemplateItemsGrid/TemplateItemsGrid.d.ts +1 -1
  25. package/dist/types/features/Templates/lib.d.ts +1 -0
  26. package/dist/types/features/Templates/types.d.ts +8 -0
  27. package/dist/types/pages/TemplateBoardPage.d.ts +2 -0
  28. package/dist/types/shared/Lang/index.d.ts +2 -0
  29. package/dist/types/shared/api/base/base.d.ts +1 -0
  30. package/dist/types/shared/api/billing/types.d.ts +2 -2
  31. package/dist/types/shared/api/users/api.d.ts +3 -1
  32. package/dist/types/shared/lib/useHotkey.d.ts +8 -0
  33. package/package.json +8 -3
  34. /package/dist/types/entities/comments/{useCommentsMerge.d.ts → hooks/useCommentsMerge.d.ts} +0 -0
  35. /package/dist/types/entities/comments/{useIntersectionObserver.d.ts → hooks/useIntersectionObserver.d.ts} +0 -0
  36. /package/dist/types/{entities/comments → shared/date}/lib.d.ts +0 -0
@@ -182,16 +182,29 @@ async function handleEdit(ev) {
182
182
  }
183
183
  async function handleShare(ev) {
184
184
  ev.preventDefault();
185
- const html = document.documentElement.innerHTML;
185
+ const html = document.documentElement.outerHTML;
186
186
  const name = getBoardName();
187
- const { boardsApi, api } = await import("https://www.unpkg.com/microboard-ui-temp/dist/index.js");
188
- api.updateURL("https://dev-app.microboard.io/api/v1");
189
- const res = await boardsApi.createBoard({
190
- title: name,
191
- isPublic: true
187
+ const appOrigin = window.location.origin;
188
+ const importWindow = window.open(`${appOrigin}/import-snapshot`, "_blank");
189
+ if (!importWindow)
190
+ return;
191
+ await new Promise((resolve, reject) => {
192
+ const timeout = setTimeout(() => {
193
+ window.removeEventListener("message", onMessage);
194
+ reject(new Error("Import timed out"));
195
+ }, 60000);
196
+ function onMessage(event) {
197
+ if (event.source !== importWindow)
198
+ return;
199
+ if (event.data?.type === "microboard-snapshot-ready") {
200
+ window.removeEventListener("message", onMessage);
201
+ clearTimeout(timeout);
202
+ importWindow.postMessage({ type: "microboard-snapshot", html, name }, appOrigin);
203
+ resolve();
204
+ }
205
+ }
206
+ window.addEventListener("message", onMessage);
192
207
  });
193
- await boardsApi.publishSnapshot(html, res.data.id, res.data.id);
194
- window.location.href = `https://dev-app.microboard.io/boards/${res.data.id}`;
195
208
  }
196
209
  async function injectStyles() {
197
210
  const resp = await fetch("https://www.unpkg.com/microboard-ui-temp/dist/index.css");
@@ -1,8 +1,15 @@
1
1
  import type { AiChatMsg, BoardEventMsg, ConfirmationMsg, SnapshotRequestMsg, ModeMsg, SyncBoardEvent } from "microboard-temp";
2
2
  import { Board, PresenceEventMsg, PresenceEventType, UserJoinMsg } from "microboard-temp";
3
3
  import type { Account } from "../entities/account";
4
- import { Subject } from "../shared/Subject";
5
4
  import { Storage } from "./Storage";
5
+ export interface BoardSubscriptionCompletedMsg {
6
+ type: "BoardSubscriptionCompleted";
7
+ boardId: string;
8
+ mode: "view" | "edit";
9
+ snapshot: any;
10
+ eventsSinceLastSnapshot: SyncBoardEvent[];
11
+ initialSequenceNumber: number;
12
+ }
6
13
  export interface AuthMsg {
7
14
  type: "Auth";
8
15
  jwt: string;
@@ -51,18 +58,10 @@ export interface BoardAccessDeniedMsg {
51
58
  type: "BoardAccessDenied";
52
59
  boardId: string;
53
60
  }
54
- export interface BoardSubscriptionCompletedMsg {
55
- type: "BoardSubscriptionCompleted";
56
- boardId: string;
57
- mode: "view" | "edit";
58
- snapshot: string | null;
59
- eventsSinceLastSnapshot: SyncBoardEvent[];
60
- initialSequenceNumber: number;
61
- }
62
61
  export type EventsMsg = ModeMsg | BoardEventMsg | SnapshotRequestMsg | ConfirmationMsg | BoardSubscriptionCompletedMsg | UserJoinMsg | PresenceEventMsg | AiChatMsg;
63
62
  export type SocketMsg = EventsMsg | AuthMsg | AuthConfirmationMsg | LogoutMsg | GetModeMsg | InvalidateRightsMsg | UserJoinMsg | SubscribeMsg | UnsubscribeMsg | VersionCheckMsg | ErrorMsg | ModeMsg | PingMsg | AiChatMsg | BoardAccessDeniedMsg;
64
63
  export interface Connection {
65
- connectionId: number;
64
+ connectionId: string;
66
65
  getCurrentUser: () => string;
67
66
  connect(): Promise<void>;
68
67
  subscribe(board: Board): void;
@@ -79,13 +78,10 @@ export interface Connection {
79
78
  }
80
79
  export declare function createConnection(getCurrentBoard: () => Board, getAccount: () => Account, getStorage: () => Storage): Connection;
81
80
  interface WsClient {
82
- onOpenSubject: Subject<unknown>;
83
- onCloseSubject: Subject<unknown>;
84
- connect: () => void;
85
81
  send: (message: SocketMsg) => void;
86
82
  isConnected: () => boolean;
87
- onConnect: () => void;
83
+ close: () => void;
88
84
  }
89
85
  type SocketMsgHandler = (message: SocketMsg) => void;
90
- export declare function createWsClient(msgHandler: SocketMsgHandler, setConnectionErrorTimeout: () => void, onError: (error: unknown) => void, getCurrentBoard: () => Board, invalidateToken: () => Promise<void>): WsClient;
86
+ export declare function createWsClient(wsUrl: string, token: string, msgHandler: SocketMsgHandler, onError: (error: unknown) => void, onReconnect: () => void): WsClient;
91
87
  export {};
@@ -2,6 +2,8 @@ import type { boardsApi } from "../shared/api";
2
2
  export declare class Storage {
3
3
  createdBoards: string;
4
4
  visitedBoards: string;
5
+ setAnonKey(): void;
6
+ getAnonKey(): string;
5
7
  listCreatedBoards(): boardsApi.Board[];
6
8
  listVisitedBoards(): boardsApi.Board[];
7
9
  setCreatedBoards(boards: boardsApi.Board[]): void;
@@ -13,5 +13,5 @@ interface Props {
13
13
  isShorted: boolean;
14
14
  isOptionsPanelActive: boolean;
15
15
  }
16
- export declare const Message: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLElement>>;
16
+ export declare const Message: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
17
17
  export {};
@@ -1,6 +1,7 @@
1
+ import { RefObject } from "react";
1
2
  import { CommentMessage } from "microboard-temp";
2
3
  interface Args {
3
- refs: React.MutableRefObject<Record<string, HTMLDivElement | null>>;
4
+ refs: RefObject<Record<string, HTMLDivElement | null>>;
4
5
  unreadMessages?: CommentMessage[] | null;
5
6
  deps?: unknown[];
6
7
  }
@@ -1,4 +1,4 @@
1
1
  export { CommentsProvider } from "./CommentsProvider";
2
2
  export { useCommentsContext, CommentsContextProvider } from "./CommentsContext";
3
3
  export { CommentContainer } from "./CommentContainer/CommentContainer";
4
- export { useIntersectionObserver } from "./useIntersectionObserver";
4
+ export { CommentsPanel } from "./CommentsPanel/CommentsPanel";
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare function BoardItemsPanel(): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React, { PropsWithChildren } from "react";
2
+ type BoardItemsPanelContextType = {
3
+ isOpen: boolean;
4
+ openPanel: () => void;
5
+ closePanel: () => void;
6
+ togglePanel: () => void;
7
+ };
8
+ export declare const BoardItemsPanelContext: React.Context<BoardItemsPanelContextType>;
9
+ export declare function useBoardItemsPanelContext(): BoardItemsPanelContextType;
10
+ export declare function BoardItemsPanelContextProvider({ children, }: PropsWithChildren<{}>): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export { BoardItemsPanel } from "./BoardItemsPanel";
2
+ export { BoardItemsPanelContextProvider, useBoardItemsPanelContext, } from "./BoardItemsPanelContext";
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface BoardItemsListProps {
3
+ query?: string;
4
+ }
5
+ export declare function BoardItemsList({ query, }: BoardItemsListProps): React.JSX.Element;
6
+ export {};
@@ -7,6 +7,9 @@ type SidePanelContext = {
7
7
  setStamp: React.Dispatch<React.SetStateAction<number | null>>;
8
8
  isOpen: boolean;
9
9
  isHighlighted: boolean;
10
+ showItems: boolean;
11
+ openItemsView: () => void;
12
+ closeItemsView: () => void;
10
13
  };
11
14
  export declare const SidePanelContext: React.Context<SidePanelContext>;
12
15
  export declare function useSidePanelContext(): SidePanelContext;
@@ -1,14 +1,9 @@
1
- import { Template } from "microboard-temp";
2
- import type { BoardSnapshot } from "microboard-temp";
1
+ import { Template } from "../../../Templates/types";
3
2
  interface TemplateItemPreviewProps {
4
3
  name: string;
5
- language: string;
6
- description: string;
7
- tags: string[];
8
- snapshot: BoardSnapshot;
4
+ templateId: string;
9
5
  setPresentedTemplate: (template: null | Template) => void;
10
- viewLinkId: string;
11
6
  relatedTemplates: Template[];
12
7
  }
13
- export declare const TemplateItemPreview: ({ name, description, snapshot, setPresentedTemplate, viewLinkId, relatedTemplates, }: TemplateItemPreviewProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const TemplateItemPreview: ({ name, templateId, setPresentedTemplate, relatedTemplates, }: TemplateItemPreviewProps) => import("react/jsx-runtime").JSX.Element;
14
9
  export {};
@@ -1,4 +1,4 @@
1
- import { Template } from "microboard-temp";
1
+ import { Template } from "../../../../Templates/types";
2
2
  interface TemplateItemProps {
3
3
  template: Template;
4
4
  setPresentedTemplate: (template: null | Template) => void;
@@ -1,4 +1,4 @@
1
- import { Template } from "microboard-temp";
1
+ import { Template } from "../../../Templates/types";
2
2
  interface TemplateItemsGridProps {
3
3
  templates: Template[];
4
4
  setPresentedTemplate: (template: null | Template) => void;
@@ -5,3 +5,4 @@ export declare const pasteSnapshot: ({ board, snapshot, }: {
5
5
  board: Board;
6
6
  snapshot: BoardSnapshot;
7
7
  }) => void;
8
+ export declare function fetchTemplateSnapshot(templateId: string): Promise<BoardSnapshot>;
@@ -0,0 +1,8 @@
1
+ export interface Template {
2
+ id: string;
3
+ preview: string;
4
+ languages: string[];
5
+ tags: string[];
6
+ name: string;
7
+ created: string;
8
+ }
@@ -0,0 +1,2 @@
1
+ import React from "react";
2
+ export declare const TemplateBoardPage: () => React.JSX.Element;
@@ -5,6 +5,7 @@ export declare const resources: {
5
5
  common: {
6
6
  and: string;
7
7
  save: string;
8
+ cancel: string;
8
9
  backToMain: string;
9
10
  confirm: string;
10
11
  loading: string;
@@ -1237,6 +1238,7 @@ export declare const resources: {
1237
1238
  common: {
1238
1239
  and: string;
1239
1240
  save: string;
1241
+ cancel: string;
1240
1242
  backToMain: string;
1241
1243
  confirm: string;
1242
1244
  loading: string;
@@ -17,6 +17,7 @@ export declare class HTTP {
17
17
  post<R, B extends MutationRequestBody = MutationRequestBody, P extends ParamsRecord = ParamsRecord>(path: string, body?: B, config?: HTTPRequestConfig<URLSearchParamsInit, P>): Promise<HTTPResponse<R>>;
18
18
  patch<R, B extends MutationRequestBody = MutationRequestBody, P extends ParamsRecord = ParamsRecord>(path: string, body?: B, config?: HTTPRequestConfig<URLSearchParamsInit, P>): Promise<HTTPResponse<R>>;
19
19
  patchRaw<R, P extends ParamsRecord = ParamsRecord>(path: string, file: File, config?: HTTPRequestConfig<URLSearchParamsInit, P>): Promise<HTTPResponse<R>>;
20
+ putRawExternal<R>(url: string, file: File): Promise<Response>;
20
21
  put<R, B extends MutationRequestBody = MutationRequestBody, P extends ParamsRecord = ParamsRecord>(path: string, body?: B, config?: HTTPRequestConfig<URLSearchParamsInit, P>): Promise<HTTPResponse<R>>;
21
22
  delete<R, Q extends URLSearchParamsInit = URLSearchParamsInit, P extends ParamsRecord = ParamsRecord, B extends MutationRequestBody = MutationRequestBody>(path: string, config?: HTTPRequestConfig<Q, P>, body?: B): Promise<HTTPResponse<R>>;
22
23
  }
@@ -47,9 +47,9 @@ export type TokensLimits = {
47
47
  };
48
48
  export type UserLimits = {
49
49
  storage: StorageUsage;
50
- models: AvailableModel[];
51
50
  plan: UserPlan;
52
- tokens: TokensLimits;
51
+ models?: AvailableModel[];
52
+ tokens?: TokensLimits;
53
53
  };
54
54
  export type Plan = {
55
55
  id: string;
@@ -3,5 +3,7 @@ export declare function getMe(): Promise<import("..").HTTPResponse<User>>;
3
3
  export declare function getUsers(search?: string, limit?: number): Promise<import("..").HTTPResponse<User[]>>;
4
4
  export declare function updateMe(payload: UpdateUserPayload, signal?: AbortSignal): Promise<import("..").HTTPResponse<unknown>>;
5
5
  export declare function updateNewsletter(payload: UpdateUserNewsletter, signal?: AbortSignal): Promise<import("..").HTTPResponse<unknown>>;
6
- export declare function uploadAvatar(avatar: File): Promise<import("..").HTTPResponse<unknown>>;
6
+ export declare function uploadAvatar(avatar: File): Promise<{
7
+ url: string;
8
+ }>;
7
9
  export declare function removeAvatar(): Promise<import("..").HTTPResponse<unknown>>;
@@ -0,0 +1,8 @@
1
+ interface HotkeyOptions {
2
+ ctrl?: boolean;
3
+ shift?: boolean;
4
+ alt?: boolean;
5
+ meta?: boolean;
6
+ }
7
+ export declare function useHotkey(code: string, callback: () => void, options?: HotkeyOptions): void;
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.169",
3
+ "version": "0.3.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -25,6 +25,10 @@
25
25
  "cucumber:playwright:parallel:report:safari": "cucumber-js --tags @microboard --profile playwright --parallel 9 --format html:features/reports/cucumber-report.html --world-parameters '{\"browser\":\"safari\"}'",
26
26
  "cucumber:playwright:sync:report": "cucumber-js --tags @sync --profile playwright --format html:features/reports/cucumber-report.html --world-parameters '{\"isSync\":\"true\"}'"
27
27
  },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/hyperboard/microboardUI"
31
+ },
28
32
  "files": [
29
33
  "dist"
30
34
  ],
@@ -46,7 +50,8 @@
46
50
  "node-html-parser": "^7.0.1",
47
51
  "prettier": "^3.6.2",
48
52
  "stylelint": "^16.21.1",
49
- "tsc-alias": "^1.8.16"
53
+ "tsc-alias": "^1.8.16",
54
+ "wrangler": "^4.61.0"
50
55
  },
51
56
  "peerDependencies": {
52
57
  "typescript": "^5.8.3",
@@ -74,7 +79,7 @@
74
79
  "i18next-browser-languagedetector": "^8.2.0",
75
80
  "js-cookie": "^3.0.5",
76
81
  "jwt-decode": "^4.0.0",
77
- "microboard-temp": "^0.5.121",
82
+ "microboard-temp": "^0.6.1",
78
83
  "nanoid": "^5.1.5",
79
84
  "prop-types": "^15.8.1",
80
85
  "react-hot-toast": "2.4.1",