@haklex/rich-compose 0.43.2 → 0.44.1

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.
@@ -75347,7 +75347,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75347
75347
  }));
75348
75348
  //#endregion
75349
75349
  //#region ../rich-ext-excalidraw/src/constants.ts
75350
- var readonlyUIOptions;
75350
+ var readonlyUIOptions, fitSceneToViewport, fitSceneOnReady;
75351
75351
  var init_constants$2 = __esmMin((() => {
75352
75352
  readonlyUIOptions = { canvasActions: {
75353
75353
  toggleTheme: false,
@@ -75356,6 +75356,23 @@ Please report this to https://github.com/markedjs/marked.`, e) {
75356
75356
  loadScene: false,
75357
75357
  changeViewBackgroundColor: false
75358
75358
  } };
75359
+ fitSceneToViewport = (api) => api.scrollToContent(void 0, {
75360
+ fitToViewport: true,
75361
+ viewportZoomFactor: .9,
75362
+ maxZoom: 1
75363
+ });
75364
+ fitSceneOnReady = (api) => {
75365
+ const isReady = () => api.getAppState().width > 0 && api.getSceneElements().length > 0;
75366
+ if (isReady()) {
75367
+ fitSceneToViewport(api);
75368
+ return;
75369
+ }
75370
+ const unsubscribe = api.onChange(() => {
75371
+ if (!isReady()) return;
75372
+ unsubscribe();
75373
+ fitSceneToViewport(api);
75374
+ });
75375
+ };
75359
75376
  }));
75360
75377
  //#endregion
75361
75378
  //#region ../rich-ext-excalidraw/src/styles.css.ts.vanilla.css
@@ -162316,7 +162333,7 @@ TTD mermaid definition render errror: ${M.message}`, "color: yellow"), le("ai",
162316
162333
  initialData: data,
162317
162334
  theme,
162318
162335
  excalidrawAPI: (api) => {
162319
- setTimeout(() => api.scrollToContent(), 100);
162336
+ fitSceneOnReady(api);
162320
162337
  }
162321
162338
  }),
162322
162339
  target: e.currentTarget,
@@ -162368,7 +162385,7 @@ TTD mermaid definition render errror: ${M.message}`, "color: yellow"), le("ai",
162368
162385
  theme,
162369
162386
  excalidrawAPI: (api) => {
162370
162387
  apiRef.current = api;
162371
- setTimeout(() => api.scrollToContent(), 100);
162388
+ fitSceneOnReady(api);
162372
162389
  }
162373
162390
  })
162374
162391
  }), /* @__PURE__ */ (0, import_jsx_runtime$2.jsxs)("div", {
@@ -162402,7 +162419,7 @@ TTD mermaid definition render errror: ${M.message}`, "color: yellow"), le("ai",
162402
162419
  className: excalidrawActionButton,
162403
162420
  title: "Fit to Content",
162404
162421
  type: "button",
162405
- onClick: () => apiRef.current?.scrollToContent(),
162422
+ onClick: () => apiRef.current && fitSceneToViewport(apiRef.current),
162406
162423
  children: /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(ScanSearch, { size: 20 })
162407
162424
  }),
162408
162425
  canExpand && /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)("button", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haklex/rich-compose",
3
- "version": "0.43.2",
3
+ "version": "0.44.1",
4
4
  "description": "Compose primitives for haklex rich content renderers — Gundam-style assembly of Lexical nodes, sync/lazy renderers, and Provider stacks.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -293,28 +293,28 @@
293
293
  ],
294
294
  "dependencies": {
295
295
  "@lexical/headless": "^0.49.0",
296
- "@haklex/rich-ext-chat": "0.43.2",
297
- "@haklex/rich-ext-code-snippet": "0.43.2",
298
- "@haklex/rich-ext-dynamic": "0.43.2",
299
- "@haklex/rich-ext-embed": "0.43.2",
300
- "@haklex/rich-ext-excalidraw": "0.43.2",
301
- "@haklex/rich-ext-nested-doc": "0.43.2",
302
- "@haklex/rich-ext-gallery": "0.43.2",
303
- "@haklex/rich-renderer-alert": "0.43.2",
304
- "@haklex/rich-renderer-banner": "0.43.2",
305
- "@haklex/rich-renderer-codeblock": "0.43.2",
306
- "@haklex/rich-ext-poll": "0.43.2",
307
- "@haklex/rich-plugin-slash-menu": "0.43.2",
308
- "@haklex/rich-renderer-katex": "0.43.2",
309
- "@haklex/rich-renderer-file": "0.43.2",
310
- "@haklex/rich-litexml": "0.43.2",
311
- "@haklex/rich-renderer-image": "0.43.2",
312
- "@haklex/rich-renderer-ruby": "0.43.2",
313
- "@haklex/rich-renderer-linkcard": "0.43.2",
314
- "@haklex/rich-renderer-mention": "0.43.2",
315
- "@haklex/rich-renderer-video": "0.43.2",
316
- "@haklex/rich-style-token": "0.43.2",
317
- "@haklex/rich-renderer-mermaid": "0.43.2"
296
+ "@haklex/rich-ext-code-snippet": "0.44.1",
297
+ "@haklex/rich-ext-chat": "0.44.1",
298
+ "@haklex/rich-ext-dynamic": "0.44.1",
299
+ "@haklex/rich-ext-excalidraw": "0.44.1",
300
+ "@haklex/rich-ext-gallery": "0.44.1",
301
+ "@haklex/rich-ext-embed": "0.44.1",
302
+ "@haklex/rich-ext-nested-doc": "0.44.1",
303
+ "@haklex/rich-ext-poll": "0.44.1",
304
+ "@haklex/rich-litexml": "0.44.1",
305
+ "@haklex/rich-plugin-slash-menu": "0.44.1",
306
+ "@haklex/rich-renderer-alert": "0.44.1",
307
+ "@haklex/rich-renderer-banner": "0.44.1",
308
+ "@haklex/rich-renderer-codeblock": "0.44.1",
309
+ "@haklex/rich-renderer-file": "0.44.1",
310
+ "@haklex/rich-renderer-image": "0.44.1",
311
+ "@haklex/rich-renderer-katex": "0.44.1",
312
+ "@haklex/rich-renderer-mention": "0.44.1",
313
+ "@haklex/rich-renderer-linkcard": "0.44.1",
314
+ "@haklex/rich-renderer-mermaid": "0.44.1",
315
+ "@haklex/rich-renderer-ruby": "0.44.1",
316
+ "@haklex/rich-renderer-video": "0.44.1",
317
+ "@haklex/rich-style-token": "0.44.1"
318
318
  },
319
319
  "devDependencies": {
320
320
  "@lexical/react": "^0.49.0",
@@ -330,7 +330,7 @@
330
330
  "unplugin-dts": "^1.0.3",
331
331
  "vite": "^8.2.2",
332
332
  "vitest": "^4.1.11",
333
- "@haklex/rich-editor": "0.43.2"
333
+ "@haklex/rich-editor": "0.44.1"
334
334
  },
335
335
  "peerDependencies": {
336
336
  "@lexical/react": "^0.49.0",
@@ -338,7 +338,7 @@
338
338
  "lucide-react": "^1.0.0",
339
339
  "react": ">=19",
340
340
  "react-dom": ">=19",
341
- "@haklex/rich-editor": "^0.43.2"
341
+ "@haklex/rich-editor": "^0.44.1"
342
342
  },
343
343
  "publishConfig": {
344
344
  "access": "public"