@almadar/ui 4.51.9 → 4.51.11

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.
@@ -13697,12 +13697,12 @@ var init_MapView = __esm({
13697
13697
  shadowSize: [41, 41]
13698
13698
  });
13699
13699
  L.Marker.prototype.options.icon = defaultIcon;
13700
- const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback126, useState: useState120 } = React93__namespace.default;
13700
+ const { useEffect: useEffect87, useRef: useRef88, useCallback: useCallback126, useState: useState120 } = React93__namespace.default;
13701
13701
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
13702
13702
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
13703
13703
  function MapUpdater({ centerLat, centerLng, zoom }) {
13704
13704
  const map = useMap();
13705
- const prevRef = useRef87({ centerLat, centerLng, zoom });
13705
+ const prevRef = useRef88({ centerLat, centerLng, zoom });
13706
13706
  useEffect87(() => {
13707
13707
  const prev = prevRef.current;
13708
13708
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -59058,17 +59058,25 @@ function BrowserPlayground({
59058
59058
  const [runtime] = React93.useState(
59059
59059
  () => new OrbitalServerRuntime.OrbitalServerRuntime({ mode, debug: false })
59060
59060
  );
59061
- React93.useEffect(() => {
59061
+ const registrationReady = React93.useMemo(() => {
59062
59062
  const orbitalNames = schema.orbitals.map((o) => o.name);
59063
59063
  playgroundLog.debug("register:start", { schema: schema.name, orbitalNames });
59064
- void runtime.register(schema).then(() => {
59064
+ return runtime.register(schema).then(() => {
59065
59065
  playgroundLog.debug("register:done", { schema: schema.name, orbitalNames });
59066
59066
  });
59067
59067
  }, [runtime, schema]);
59068
+ const teardownTimerRef = React93.useRef(null);
59068
59069
  React93.useEffect(() => {
59070
+ if (teardownTimerRef.current !== null) {
59071
+ clearTimeout(teardownTimerRef.current);
59072
+ teardownTimerRef.current = null;
59073
+ }
59069
59074
  return () => {
59070
- playgroundLog.debug("unregisterAll:unmount");
59071
- runtime.unregisterAll();
59075
+ teardownTimerRef.current = setTimeout(() => {
59076
+ teardownTimerRef.current = null;
59077
+ playgroundLog.debug("unregisterAll:unmount");
59078
+ runtime.unregisterAll();
59079
+ }, 0);
59072
59080
  };
59073
59081
  }, [runtime]);
59074
59082
  const transport = React93.useMemo(() => ({
@@ -59080,12 +59088,13 @@ function BrowserPlayground({
59080
59088
  runtime.unregisterAll();
59081
59089
  },
59082
59090
  sendEvent: async (orbitalName, event, payload) => {
59091
+ await registrationReady;
59083
59092
  return runtime.processOrbitalEvent(orbitalName, {
59084
59093
  event,
59085
59094
  payload
59086
59095
  });
59087
59096
  }
59088
- }), [runtime]);
59097
+ }), [runtime, registrationReady]);
59089
59098
  return /* @__PURE__ */ jsxRuntime.jsx(
59090
59099
  OrbPreview,
59091
59100
  {
package/dist/avl/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { OrbitControls as OrbitControls$1, Grid as Grid$1, Stars, Sparkles, Html, RoundedBox } from '@react-three/drei';
3
3
  import * as React93 from 'react';
4
- import React93__default, { createContext, useState, useEffect, useMemo, useContext, useRef, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
4
+ import React93__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, lazy, useId, forwardRef, useImperativeHandle, Component } from 'react';
5
5
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
6
6
  import ELK from 'elkjs/lib/elk.bundled.js';
7
7
  import { MarkerType, Handle, Position, getBezierPath, EdgeLabelRenderer, BaseEdge, ReactFlowProvider, useNodesState, useEdgesState, useReactFlow, ReactFlow, Controls, Background, BackgroundVariant } from '@xyflow/react';
@@ -13651,12 +13651,12 @@ var init_MapView = __esm({
13651
13651
  shadowSize: [41, 41]
13652
13652
  });
13653
13653
  L.Marker.prototype.options.icon = defaultIcon;
13654
- const { useEffect: useEffect87, useRef: useRef87, useCallback: useCallback126, useState: useState120 } = React93__default;
13654
+ const { useEffect: useEffect87, useRef: useRef88, useCallback: useCallback126, useState: useState120 } = React93__default;
13655
13655
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
13656
13656
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
13657
13657
  function MapUpdater({ centerLat, centerLng, zoom }) {
13658
13658
  const map = useMap();
13659
- const prevRef = useRef87({ centerLat, centerLng, zoom });
13659
+ const prevRef = useRef88({ centerLat, centerLng, zoom });
13660
13660
  useEffect87(() => {
13661
13661
  const prev = prevRef.current;
13662
13662
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -59012,17 +59012,25 @@ function BrowserPlayground({
59012
59012
  const [runtime] = useState(
59013
59013
  () => new OrbitalServerRuntime({ mode, debug: false })
59014
59014
  );
59015
- useEffect(() => {
59015
+ const registrationReady = useMemo(() => {
59016
59016
  const orbitalNames = schema.orbitals.map((o) => o.name);
59017
59017
  playgroundLog.debug("register:start", { schema: schema.name, orbitalNames });
59018
- void runtime.register(schema).then(() => {
59018
+ return runtime.register(schema).then(() => {
59019
59019
  playgroundLog.debug("register:done", { schema: schema.name, orbitalNames });
59020
59020
  });
59021
59021
  }, [runtime, schema]);
59022
+ const teardownTimerRef = useRef(null);
59022
59023
  useEffect(() => {
59024
+ if (teardownTimerRef.current !== null) {
59025
+ clearTimeout(teardownTimerRef.current);
59026
+ teardownTimerRef.current = null;
59027
+ }
59023
59028
  return () => {
59024
- playgroundLog.debug("unregisterAll:unmount");
59025
- runtime.unregisterAll();
59029
+ teardownTimerRef.current = setTimeout(() => {
59030
+ teardownTimerRef.current = null;
59031
+ playgroundLog.debug("unregisterAll:unmount");
59032
+ runtime.unregisterAll();
59033
+ }, 0);
59026
59034
  };
59027
59035
  }, [runtime]);
59028
59036
  const transport = useMemo(() => ({
@@ -59034,12 +59042,13 @@ function BrowserPlayground({
59034
59042
  runtime.unregisterAll();
59035
59043
  },
59036
59044
  sendEvent: async (orbitalName, event, payload) => {
59045
+ await registrationReady;
59037
59046
  return runtime.processOrbitalEvent(orbitalName, {
59038
59047
  event,
59039
59048
  payload
59040
59049
  });
59041
59050
  }
59042
- }), [runtime]);
59051
+ }), [runtime, registrationReady]);
59043
59052
  return /* @__PURE__ */ jsx(
59044
59053
  OrbPreview,
59045
59054
  {
@@ -9210,12 +9210,12 @@ var init_MapView = __esm({
9210
9210
  shadowSize: [41, 41]
9211
9211
  });
9212
9212
  L.Marker.prototype.options.icon = defaultIcon;
9213
- const { useEffect: useEffect68, useRef: useRef64, useCallback: useCallback110, useState: useState98 } = React80__namespace.default;
9213
+ const { useEffect: useEffect68, useRef: useRef65, useCallback: useCallback110, useState: useState98 } = React80__namespace.default;
9214
9214
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9215
9215
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9216
9216
  function MapUpdater({ centerLat, centerLng, zoom }) {
9217
9217
  const map = useMap();
9218
- const prevRef = useRef64({ centerLat, centerLng, zoom });
9218
+ const prevRef = useRef65({ centerLat, centerLng, zoom });
9219
9219
  useEffect68(() => {
9220
9220
  const prev = prevRef.current;
9221
9221
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -46949,17 +46949,25 @@ function BrowserPlayground({
46949
46949
  const [runtime] = React80.useState(
46950
46950
  () => new OrbitalServerRuntime.OrbitalServerRuntime({ mode, debug: false })
46951
46951
  );
46952
- React80.useEffect(() => {
46952
+ const registrationReady = React80.useMemo(() => {
46953
46953
  const orbitalNames = schema.orbitals.map((o) => o.name);
46954
46954
  playgroundLog.debug("register:start", { schema: schema.name, orbitalNames });
46955
- void runtime.register(schema).then(() => {
46955
+ return runtime.register(schema).then(() => {
46956
46956
  playgroundLog.debug("register:done", { schema: schema.name, orbitalNames });
46957
46957
  });
46958
46958
  }, [runtime, schema]);
46959
+ const teardownTimerRef = React80.useRef(null);
46959
46960
  React80.useEffect(() => {
46961
+ if (teardownTimerRef.current !== null) {
46962
+ clearTimeout(teardownTimerRef.current);
46963
+ teardownTimerRef.current = null;
46964
+ }
46960
46965
  return () => {
46961
- playgroundLog.debug("unregisterAll:unmount");
46962
- runtime.unregisterAll();
46966
+ teardownTimerRef.current = setTimeout(() => {
46967
+ teardownTimerRef.current = null;
46968
+ playgroundLog.debug("unregisterAll:unmount");
46969
+ runtime.unregisterAll();
46970
+ }, 0);
46963
46971
  };
46964
46972
  }, [runtime]);
46965
46973
  const transport = React80.useMemo(() => ({
@@ -46971,12 +46979,13 @@ function BrowserPlayground({
46971
46979
  runtime.unregisterAll();
46972
46980
  },
46973
46981
  sendEvent: async (orbitalName, event, payload) => {
46982
+ await registrationReady;
46974
46983
  return runtime.processOrbitalEvent(orbitalName, {
46975
46984
  event,
46976
46985
  payload
46977
46986
  });
46978
46987
  }
46979
- }), [runtime]);
46988
+ }), [runtime, registrationReady]);
46980
46989
  return /* @__PURE__ */ jsxRuntime.jsx(
46981
46990
  OrbPreview,
46982
46991
  {
@@ -9164,12 +9164,12 @@ var init_MapView = __esm({
9164
9164
  shadowSize: [41, 41]
9165
9165
  });
9166
9166
  L.Marker.prototype.options.icon = defaultIcon;
9167
- const { useEffect: useEffect68, useRef: useRef64, useCallback: useCallback110, useState: useState98 } = React80__default;
9167
+ const { useEffect: useEffect68, useRef: useRef65, useCallback: useCallback110, useState: useState98 } = React80__default;
9168
9168
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
9169
9169
  const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
9170
9170
  function MapUpdater({ centerLat, centerLng, zoom }) {
9171
9171
  const map = useMap();
9172
- const prevRef = useRef64({ centerLat, centerLng, zoom });
9172
+ const prevRef = useRef65({ centerLat, centerLng, zoom });
9173
9173
  useEffect68(() => {
9174
9174
  const prev = prevRef.current;
9175
9175
  if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
@@ -46903,17 +46903,25 @@ function BrowserPlayground({
46903
46903
  const [runtime] = useState(
46904
46904
  () => new OrbitalServerRuntime({ mode, debug: false })
46905
46905
  );
46906
- useEffect(() => {
46906
+ const registrationReady = useMemo(() => {
46907
46907
  const orbitalNames = schema.orbitals.map((o) => o.name);
46908
46908
  playgroundLog.debug("register:start", { schema: schema.name, orbitalNames });
46909
- void runtime.register(schema).then(() => {
46909
+ return runtime.register(schema).then(() => {
46910
46910
  playgroundLog.debug("register:done", { schema: schema.name, orbitalNames });
46911
46911
  });
46912
46912
  }, [runtime, schema]);
46913
+ const teardownTimerRef = useRef(null);
46913
46914
  useEffect(() => {
46915
+ if (teardownTimerRef.current !== null) {
46916
+ clearTimeout(teardownTimerRef.current);
46917
+ teardownTimerRef.current = null;
46918
+ }
46914
46919
  return () => {
46915
- playgroundLog.debug("unregisterAll:unmount");
46916
- runtime.unregisterAll();
46920
+ teardownTimerRef.current = setTimeout(() => {
46921
+ teardownTimerRef.current = null;
46922
+ playgroundLog.debug("unregisterAll:unmount");
46923
+ runtime.unregisterAll();
46924
+ }, 0);
46917
46925
  };
46918
46926
  }, [runtime]);
46919
46927
  const transport = useMemo(() => ({
@@ -46925,12 +46933,13 @@ function BrowserPlayground({
46925
46933
  runtime.unregisterAll();
46926
46934
  },
46927
46935
  sendEvent: async (orbitalName, event, payload) => {
46936
+ await registrationReady;
46928
46937
  return runtime.processOrbitalEvent(orbitalName, {
46929
46938
  event,
46930
46939
  payload
46931
46940
  });
46932
46941
  }
46933
- }), [runtime]);
46942
+ }), [runtime, registrationReady]);
46934
46943
  return /* @__PURE__ */ jsx(
46935
46944
  OrbPreview,
46936
46945
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "4.51.9",
3
+ "version": "4.51.11",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [