@xom11/whiteboard 0.27.0 → 0.28.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 (60) hide show
  1. package/dist/ai.d.mts +1 -1
  2. package/dist/ai.d.ts +1 -1
  3. package/dist/ai.js +54 -23
  4. package/dist/ai.js.map +1 -1
  5. package/dist/ai.mjs +54 -23
  6. package/dist/ai.mjs.map +1 -1
  7. package/dist/catalog.json +4 -4
  8. package/dist/{chunk-D5JLJ3PT.mjs → chunk-5JM35CXV.mjs} +4 -4
  9. package/dist/{chunk-D5JLJ3PT.mjs.map → chunk-5JM35CXV.mjs.map} +1 -1
  10. package/dist/{chunk-KYMBUTPO.mjs → chunk-BU5KLO3P.mjs} +3 -3
  11. package/dist/{chunk-KYMBUTPO.mjs.map → chunk-BU5KLO3P.mjs.map} +1 -1
  12. package/dist/{chunk-AYJPOHCI.mjs → chunk-H22OZYTW.mjs} +3 -3
  13. package/dist/{chunk-AYJPOHCI.mjs.map → chunk-H22OZYTW.mjs.map} +1 -1
  14. package/dist/{chunk-I3L56GVH.mjs → chunk-OQIQNKPQ.mjs} +3 -3
  15. package/dist/{chunk-I3L56GVH.mjs.map → chunk-OQIQNKPQ.mjs.map} +1 -1
  16. package/dist/{chunk-KZGPSTZI.mjs → chunk-QCZVFEN4.mjs} +4 -4
  17. package/dist/{chunk-KZGPSTZI.mjs.map → chunk-QCZVFEN4.mjs.map} +1 -1
  18. package/dist/{chunk-4ETJ4CDY.mjs → chunk-QRUAEXLR.mjs} +4 -4
  19. package/dist/{chunk-4ETJ4CDY.mjs.map → chunk-QRUAEXLR.mjs.map} +1 -1
  20. package/dist/{chunk-HLAOGXEK.mjs → chunk-V3YJ6JFL.mjs} +3 -3
  21. package/dist/{chunk-HLAOGXEK.mjs.map → chunk-V3YJ6JFL.mjs.map} +1 -1
  22. package/dist/{chunk-D5LWSN2Y.mjs → chunk-ZTQBUKLJ.mjs} +30 -13
  23. package/dist/chunk-ZTQBUKLJ.mjs.map +1 -0
  24. package/dist/geometry-2d.d.mts +1 -1
  25. package/dist/geometry-2d.d.ts +1 -1
  26. package/dist/geometry-2d.js +143 -33
  27. package/dist/geometry-2d.js.map +1 -1
  28. package/dist/geometry-2d.mjs +3 -3
  29. package/dist/geometry-3d.d.mts +1 -1
  30. package/dist/geometry-3d.d.ts +1 -1
  31. package/dist/geometry-3d.js +28 -11
  32. package/dist/geometry-3d.js.map +1 -1
  33. package/dist/geometry-3d.mjs +3 -3
  34. package/dist/graph-2d.d.mts +1 -1
  35. package/dist/graph-2d.d.ts +1 -1
  36. package/dist/graph-2d.js +28 -11
  37. package/dist/graph-2d.js.map +1 -1
  38. package/dist/graph-2d.mjs +3 -3
  39. package/dist/{host-M26FS244.mjs → host-2ISGVO7O.mjs} +5 -5
  40. package/dist/{host-M26FS244.mjs.map → host-2ISGVO7O.mjs.map} +1 -1
  41. package/dist/{host-HAYCJJ2T.mjs → host-4P766V4J.mjs} +110 -27
  42. package/dist/host-4P766V4J.mjs.map +1 -0
  43. package/dist/{host-LTJHAY5A.mjs → host-HOSJHQ5H.mjs} +6 -6
  44. package/dist/{host-LTJHAY5A.mjs.map → host-HOSJHQ5H.mjs.map} +1 -1
  45. package/dist/index.d.mts +9 -4
  46. package/dist/index.d.ts +9 -4
  47. package/dist/index.js +147 -35
  48. package/dist/index.js.map +1 -1
  49. package/dist/index.mjs +17 -15
  50. package/dist/index.mjs.map +1 -1
  51. package/dist/latex.d.mts +1 -1
  52. package/dist/latex.d.ts +1 -1
  53. package/dist/serialize-N4G6RFBB.mjs +9 -0
  54. package/dist/{serialize-C3LSUMSA.mjs.map → serialize-N4G6RFBB.mjs.map} +1 -1
  55. package/dist/{types-zc_Pa0mp.d.mts → types-BHYC2Fiw.d.mts} +25 -1
  56. package/dist/{types-zc_Pa0mp.d.ts → types-BHYC2Fiw.d.ts} +25 -1
  57. package/package.json +1 -1
  58. package/dist/chunk-D5LWSN2Y.mjs.map +0 -1
  59. package/dist/host-HAYCJJ2T.mjs.map +0 -1
  60. package/dist/serialize-C3LSUMSA.mjs +0 -9
package/dist/latex.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as BaseStampCustomData, S as StampType } from './types-zc_Pa0mp.mjs';
1
+ import { B as BaseStampCustomData, S as StampType } from './types-BHYC2Fiw.mjs';
2
2
  import 'zod';
3
3
  import 'react';
4
4
  import '@excalidraw/excalidraw/element/types';
package/dist/latex.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { B as BaseStampCustomData, S as StampType } from './types-zc_Pa0mp.js';
1
+ import { B as BaseStampCustomData, S as StampType } from './types-BHYC2Fiw.js';
2
2
  import 'zod';
3
3
  import 'react';
4
4
  import '@excalidraw/excalidraw/element/types';
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ export { parseSceneState, stringifySceneState } from './chunk-V3YJ6JFL.mjs';
3
+ import './chunk-ZTQBUKLJ.mjs';
4
+ import './chunk-IHUFOV7L.mjs';
5
+ import './chunk-73Q7ADVL.mjs';
6
+ import './chunk-B4NJJZFR.mjs';
7
+ import './chunk-J5LGTIGS.mjs';
8
+ //# sourceMappingURL=serialize-N4G6RFBB.mjs.map
9
+ //# sourceMappingURL=serialize-N4G6RFBB.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"serialize-C3LSUMSA.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"serialize-N4G6RFBB.mjs"}
@@ -2,6 +2,25 @@ import { z } from 'zod';
2
2
  import { ReactNode, ComponentType, RefAttributes } from 'react';
3
3
  import { ExcalidrawElement } from '@excalidraw/excalidraw/element/types';
4
4
 
5
+ /**
6
+ * Snapshot tiến trình dựng hình geometry-2d, phát ra trong lúc GV thao tác
7
+ * (trước khi chèn ảnh thật). Consumer broadcast cho học sinh để vẽ ghost preview.
8
+ * Toạ độ + kích thước tính theo board-units của Excalidraw.
9
+ */
10
+ interface GeometryDraftPreview {
11
+ /** SVG markup của hình đang dựng (đã render từ state hiện tại). */
12
+ svg: string;
13
+ /** Board-units width (= intrinsic px của SVG ở zoom 1). */
14
+ width: number;
15
+ /** Board-units height. */
16
+ height: number;
17
+ /** Board-coord góc trên-trái nơi ảnh sẽ được chèn. */
18
+ x: number;
19
+ y: number;
20
+ /** Counter tăng dần để consumer bỏ khung cũ khi kênh lossy reorder. */
21
+ seq: number;
22
+ }
23
+
5
24
  declare const NameZ: z.ZodString;
6
25
 
7
26
  type Name = z.infer<typeof NameZ>;
@@ -345,6 +364,11 @@ interface StampHostProps {
345
364
  isDark: boolean;
346
365
  /** Optional client-safe bridge for the geometry-2d AI prompt editor. */
347
366
  generateGeometryFigure?: GenerateGeometryFigure;
367
+ /**
368
+ * Chỉ geometry-2d dùng: phát snapshot hình đang dựng (debounced) để consumer
369
+ * broadcast cho học sinh xem live. `null` = clear ghost (đã chèn / huỷ / rỗng).
370
+ */
371
+ onGeometryDraft?: (draft: GeometryDraftPreview | null) => void;
348
372
  }
349
373
  /**
350
374
  * Imperative API mà main view truy cập qua ref:
@@ -415,4 +439,4 @@ interface StampType<TCustomData extends BaseStampCustomData = BaseStampCustomDat
415
439
  experimental?: boolean;
416
440
  }
417
441
 
418
- export type { AiFigureProgress as A, BaseStampCustomData as B, DslInputT as D, GenerateGeometryFigure as G, StampType as S, AiFigureUiResult as a, State as b };
442
+ export type { AiFigureProgress as A, BaseStampCustomData as B, DslInputT as D, GenerateGeometryFigure as G, StampType as S, GeometryDraftPreview as a, AiFigureUiResult as b, State as c };
@@ -2,6 +2,25 @@ import { z } from 'zod';
2
2
  import { ReactNode, ComponentType, RefAttributes } from 'react';
3
3
  import { ExcalidrawElement } from '@excalidraw/excalidraw/element/types';
4
4
 
5
+ /**
6
+ * Snapshot tiến trình dựng hình geometry-2d, phát ra trong lúc GV thao tác
7
+ * (trước khi chèn ảnh thật). Consumer broadcast cho học sinh để vẽ ghost preview.
8
+ * Toạ độ + kích thước tính theo board-units của Excalidraw.
9
+ */
10
+ interface GeometryDraftPreview {
11
+ /** SVG markup của hình đang dựng (đã render từ state hiện tại). */
12
+ svg: string;
13
+ /** Board-units width (= intrinsic px của SVG ở zoom 1). */
14
+ width: number;
15
+ /** Board-units height. */
16
+ height: number;
17
+ /** Board-coord góc trên-trái nơi ảnh sẽ được chèn. */
18
+ x: number;
19
+ y: number;
20
+ /** Counter tăng dần để consumer bỏ khung cũ khi kênh lossy reorder. */
21
+ seq: number;
22
+ }
23
+
5
24
  declare const NameZ: z.ZodString;
6
25
 
7
26
  type Name = z.infer<typeof NameZ>;
@@ -345,6 +364,11 @@ interface StampHostProps {
345
364
  isDark: boolean;
346
365
  /** Optional client-safe bridge for the geometry-2d AI prompt editor. */
347
366
  generateGeometryFigure?: GenerateGeometryFigure;
367
+ /**
368
+ * Chỉ geometry-2d dùng: phát snapshot hình đang dựng (debounced) để consumer
369
+ * broadcast cho học sinh xem live. `null` = clear ghost (đã chèn / huỷ / rỗng).
370
+ */
371
+ onGeometryDraft?: (draft: GeometryDraftPreview | null) => void;
348
372
  }
349
373
  /**
350
374
  * Imperative API mà main view truy cập qua ref:
@@ -415,4 +439,4 @@ interface StampType<TCustomData extends BaseStampCustomData = BaseStampCustomDat
415
439
  experimental?: boolean;
416
440
  }
417
441
 
418
- export type { AiFigureProgress as A, BaseStampCustomData as B, DslInputT as D, GenerateGeometryFigure as G, StampType as S, AiFigureUiResult as a, State as b };
442
+ export type { AiFigureProgress as A, BaseStampCustomData as B, DslInputT as D, GenerateGeometryFigure as G, StampType as S, GeometryDraftPreview as a, AiFigureUiResult as b, State as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xom11/whiteboard",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "private": false,
5
5
  "description": "Excalidraw + JSXGraph + KaTeX whiteboard component (drawing, geometry stamps, LaTeX stamps).",
6
6
  "repository": {