@copilotkit/react-core 2.0.0-rc.43 → 2.0.0-rc.45

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 (65) hide show
  1. package/dist/{MarkdownRendererContext-C2J_lgqF.d.cts → MarkdownRendererContext-QFCldfW_.d.cts} +1 -1
  2. package/dist/{MarkdownRendererContext-C2J_lgqF.d.cts.map → MarkdownRendererContext-QFCldfW_.d.cts.map} +1 -1
  3. package/dist/{MarkdownRendererContext-CytkPOAJ.d.mts → MarkdownRendererContext-aK63ZFd-.d.mts} +1 -1
  4. package/dist/{MarkdownRendererContext-CytkPOAJ.d.mts.map → MarkdownRendererContext-aK63ZFd-.d.mts.map} +1 -1
  5. package/dist/{MarkdownSurfaces-DytbRzj2.cjs → MarkdownSurfaces-Do948N1P.cjs} +2 -2
  6. package/dist/{MarkdownSurfaces-DytbRzj2.cjs.map → MarkdownSurfaces-Do948N1P.cjs.map} +1 -1
  7. package/dist/{MarkdownSurfaces-DlYqJkAE.mjs → MarkdownSurfaces-rtE9wRUP.mjs} +2 -2
  8. package/dist/{MarkdownSurfaces-DlYqJkAE.mjs.map → MarkdownSurfaces-rtE9wRUP.mjs.map} +1 -1
  9. package/dist/{ProviderMarkdown-i_i2osOH.cjs → ProviderMarkdown-D0eI0aPo.cjs} +23 -1
  10. package/dist/ProviderMarkdown-D0eI0aPo.cjs.map +1 -0
  11. package/dist/{ProviderMarkdown-BZaPDROY.mjs → ProviderMarkdown-epL7F3Vt.mjs} +19 -3
  12. package/dist/ProviderMarkdown-epL7F3Vt.mjs.map +1 -0
  13. package/dist/accessibility-BLK-gE0R.mjs.map +1 -1
  14. package/dist/accessibility-GnodqxkH.cjs.map +1 -1
  15. package/dist/chat-BZ_bvAkg.d.mts +38 -0
  16. package/dist/chat-BZ_bvAkg.d.mts.map +1 -0
  17. package/dist/chat-CpZVyF_t.d.cts +38 -0
  18. package/dist/chat-CpZVyF_t.d.cts.map +1 -0
  19. package/dist/generative-ui/map.cjs +26 -0
  20. package/dist/generative-ui/map.cjs.map +1 -0
  21. package/dist/generative-ui/map.d.cts +23 -0
  22. package/dist/generative-ui/map.d.cts.map +1 -0
  23. package/dist/generative-ui/map.d.mts +23 -0
  24. package/dist/generative-ui/map.d.mts.map +1 -0
  25. package/dist/generative-ui/map.mjs +24 -0
  26. package/dist/generative-ui/map.mjs.map +1 -0
  27. package/dist/generative-ui/native.d.cts +3 -2
  28. package/dist/generative-ui/native.d.cts.map +1 -1
  29. package/dist/generative-ui/native.d.mts +3 -2
  30. package/dist/generative-ui/native.d.mts.map +1 -1
  31. package/dist/generative-ui.cjs +2 -2
  32. package/dist/generative-ui.d.cts +5 -4
  33. package/dist/generative-ui.d.cts.map +1 -1
  34. package/dist/generative-ui.d.mts +5 -4
  35. package/dist/generative-ui.d.mts.map +1 -1
  36. package/dist/generative-ui.mjs +2 -2
  37. package/dist/{hooks-DqsOIh8A.d.mts → hooks-D2H3iL0N.d.mts} +2 -2
  38. package/dist/{hooks-DqsOIh8A.d.mts.map → hooks-D2H3iL0N.d.mts.map} +1 -1
  39. package/dist/{hooks-2Ur8NQhj.d.cts → hooks-Dy8HeEdr.d.cts} +2 -2
  40. package/dist/{hooks-2Ur8NQhj.d.cts.map → hooks-Dy8HeEdr.d.cts.map} +1 -1
  41. package/dist/index.cjs +12 -26
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.cts +4 -3
  44. package/dist/index.d.cts.map +1 -1
  45. package/dist/index.d.mts +4 -3
  46. package/dist/index.d.mts.map +1 -1
  47. package/dist/index.mjs +11 -25
  48. package/dist/index.mjs.map +1 -1
  49. package/dist/index.umd.js +44 -21
  50. package/dist/index.umd.js.map +1 -1
  51. package/dist/{chat-C5XWeO1M.d.mts → runtime-context-B7f4M85q.d.mts} +21 -39
  52. package/dist/runtime-context-B7f4M85q.d.mts.map +1 -0
  53. package/dist/{chat-DtHs4alO.d.cts → runtime-context-CIkZS0ap.d.cts} +21 -39
  54. package/dist/runtime-context-CIkZS0ap.d.cts.map +1 -0
  55. package/dist/{standard-s8jByRiE.mjs → standard-CSBR4FhM.mjs} +31 -15
  56. package/dist/standard-CSBR4FhM.mjs.map +1 -0
  57. package/dist/{standard-CqGTZUZy.cjs → standard-DBjcBGyd.cjs} +31 -15
  58. package/dist/standard-DBjcBGyd.cjs.map +1 -0
  59. package/package.json +14 -7
  60. package/dist/ProviderMarkdown-BZaPDROY.mjs.map +0 -1
  61. package/dist/ProviderMarkdown-i_i2osOH.cjs.map +0 -1
  62. package/dist/chat-C5XWeO1M.d.mts.map +0 -1
  63. package/dist/chat-DtHs4alO.d.cts.map +0 -1
  64. package/dist/standard-CqGTZUZy.cjs.map +0 -1
  65. package/dist/standard-s8jByRiE.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  const require_accessibility = require('./accessibility-GnodqxkH.cjs');
2
- const require_ProviderMarkdown = require('./ProviderMarkdown-i_i2osOH.cjs');
2
+ const require_ProviderMarkdown = require('./ProviderMarkdown-D0eI0aPo.cjs');
3
3
  let react = require("react");
4
4
  react = require_accessibility.__toESM(react);
5
5
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -2896,13 +2896,18 @@ function isMapLibre(value) {
2896
2896
  return typeof value === "object" && value !== null && "Map" in value && typeof value.Map === "function";
2897
2897
  }
2898
2898
  /**
2899
- * Imports maplibre-gl on the client. The package is an optional peer
2900
- * dependency. The import rejects when it is not installed.
2899
+ * Loads maplibre-gl on the client with the `map` loader of the
2900
+ * `generativeUI` config. This module never imports the package itself: a
2901
+ * bundler resolves each dynamic import at build time, so an app without the
2902
+ * optional peer would fail to build. Rejects when the module is not
2903
+ * maplibre-gl.
2901
2904
  */
2902
- async function loadMapLibre() {
2903
- const module = await import("maplibre-gl");
2904
- const fromDefault = "default" in module ? module.default : void 0;
2905
- return isMapLibre(fromDefault) ? fromDefault : module;
2905
+ async function loadMapLibre(loader) {
2906
+ const loaded = await loader();
2907
+ const fromDefault = typeof loaded === "object" && loaded !== null && "default" in loaded ? loaded.default : void 0;
2908
+ if (isMapLibre(fromDefault)) return fromDefault;
2909
+ if (isMapLibre(loaded)) return loaded;
2910
+ throw new Error("The map loader did not give maplibre-gl.");
2906
2911
  }
2907
2912
  const isValidMarker = (marker) => Number.isFinite(marker.lat) && Number.isFinite(marker.lng);
2908
2913
  /**
@@ -2925,8 +2930,9 @@ function useIsDark(ref) {
2925
2930
  return isDark;
2926
2931
  }
2927
2932
  /**
2928
- * A MapLibre map with markers. maplibre-gl loads only in the browser. When
2929
- * it is not installed, or WebGL is not there, the component shows a list of
2933
+ * A MapLibre map with markers. maplibre-gl loads only in the browser, with
2934
+ * the `map` loader of the `generativeUI` config. Without the loader, when
2935
+ * the load fails, or when WebGL is not there, the component shows a list of
2930
2936
  * the places. A click on a place or a marker sets `selected`.
2931
2937
  */
2932
2938
  function MapView(props) {
@@ -2937,16 +2943,24 @@ function MapView(props) {
2937
2943
  const { zoom, route } = props;
2938
2944
  const height = props.height ?? 240;
2939
2945
  const containerRef = (0, react.useRef)(null);
2940
- const [status, setStatus] = (0, react.useState)("loading");
2946
+ const runtime = require_accessibility.useRequiredGenerativeUIRuntime();
2947
+ const { theme } = runtime;
2948
+ const loaderRef = require_ProviderMarkdown.useLatestRef(runtime.config.map);
2949
+ const hasLoader = runtime.config.map !== void 0;
2950
+ const [status, setStatus] = (0, react.useState)(hasLoader ? "loading" : "fallback");
2941
2951
  const setSelectedRef = (0, react.useRef)(props.setSelected);
2942
2952
  setSelectedRef.current = props.setSelected;
2943
- const { theme } = require_accessibility.useRequiredGenerativeUIRuntime();
2944
2953
  const styleUrl = useIsDark(containerRef) ? theme?.dark?.mapStyle || theme?.mapStyle || DEFAULT_DARK_MAP_STYLE : theme?.mapStyle || DEFAULT_MAP_STYLE;
2945
2954
  (0, react.useEffect)(() => {
2946
2955
  let isCancelled = false;
2947
2956
  let map;
2948
- async function mount() {
2949
- const maplibregl = await loadMapLibre();
2957
+ const loader = loaderRef.current;
2958
+ if (!loader) {
2959
+ setStatus("fallback");
2960
+ return;
2961
+ }
2962
+ async function mount(load) {
2963
+ const maplibregl = await loadMapLibre(load);
2950
2964
  const container = containerRef.current;
2951
2965
  if (isCancelled || !container) return;
2952
2966
  const first = markers[0];
@@ -3007,7 +3021,7 @@ function MapView(props) {
3007
3021
  });
3008
3022
  setStatus("ready");
3009
3023
  }
3010
- mount().catch(() => {
3024
+ mount(loader).catch(() => {
3011
3025
  map?.remove();
3012
3026
  map = void 0;
3013
3027
  if (!isCancelled) setStatus("fallback");
@@ -3019,6 +3033,8 @@ function MapView(props) {
3019
3033
  } catch {}
3020
3034
  };
3021
3035
  }, [
3036
+ hasLoader,
3037
+ loaderRef,
3022
3038
  markers,
3023
3039
  center,
3024
3040
  zoom,
@@ -5777,4 +5793,4 @@ Object.defineProperty(exports, 'standard_exports', {
5777
5793
  return standard_exports;
5778
5794
  }
5779
5795
  });
5780
- //# sourceMappingURL=standard-CqGTZUZy.cjs.map
5796
+ //# sourceMappingURL=standard-DBjcBGyd.cjs.map