@crediblemark/build 0.22.9 → 0.24.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.
@@ -2561,7 +2561,8 @@ import { useEffect as useEffect12, useState as useState8 } from "react";
2561
2561
  var styles_module_default5 = { "ComponentList": "_ComponentList_1jl8i_1", "ComponentList--isExpanded": "_ComponentList--isExpanded_1jl8i_5", "ComponentList-content": "_ComponentList-content_1jl8i_9", "ComponentList-title": "_ComponentList-title_1jl8i_17", "ComponentList-titleIcon": "_ComponentList-titleIcon_1jl8i_53" };
2562
2562
 
2563
2563
  // components/ComponentList/index.tsx
2564
- import { useEffect as useEffect11 } from "react";
2564
+ import { useEffect as useEffect11, useRef as useRef9 } from "react";
2565
+ import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
2565
2566
  import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
2566
2567
  var getClassName5 = get_class_name_factory_default("ComponentList", styles_module_default5);
2567
2568
  var ComponentListItem = ({
@@ -2591,7 +2592,16 @@ var ComponentList = ({
2591
2592
  const config = useAppStore((s) => s.config);
2592
2593
  const setUi = useAppStore((s) => s.setUi);
2593
2594
  const componentList = useAppStore((s) => s.state.ui.componentList);
2595
+ const parentRef = useRef9(null);
2594
2596
  const { expanded = true } = componentList[id] || {};
2597
+ const components = Object.keys(config.components);
2598
+ const virtualizer = useVirtualizer2({
2599
+ count: components.length,
2600
+ getScrollElement: () => parentRef.current,
2601
+ estimateSize: () => 40,
2602
+ // Estimated height of each item
2603
+ overscan: 5
2604
+ });
2595
2605
  return /* @__PURE__ */ jsxs4("div", { className: getClassName5({ isExpanded: expanded }), children: [
2596
2606
  title && /* @__PURE__ */ jsxs4(
2597
2607
  "button",
@@ -2607,7 +2617,6 @@ var ComponentList = ({
2607
2617
  }
2608
2618
  }
2609
2619
  }),
2610
- title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
2611
2620
  children: [
2612
2621
  /* @__PURE__ */ jsxs4("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
2613
2622
  id.toLowerCase().includes("hero") && /* @__PURE__ */ jsx12(LayoutTemplate, { size: 12, strokeWidth: 2.5 }),
@@ -2622,16 +2631,52 @@ var ComponentList = ({
2622
2631
  ]
2623
2632
  }
2624
2633
  ),
2625
- /* @__PURE__ */ jsx12("div", { className: getClassName5("content"), children: /* @__PURE__ */ jsx12(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
2626
- return /* @__PURE__ */ jsx12(
2627
- ComponentListItem,
2628
- {
2629
- label: config.components[componentKey]["label"] ?? componentKey,
2630
- name: componentKey
2634
+ /* @__PURE__ */ jsx12(
2635
+ "div",
2636
+ {
2637
+ ref: parentRef,
2638
+ className: getClassName5("content"),
2639
+ style: {
2640
+ maxHeight: expanded ? "500px" : "0px",
2641
+ overflowY: "auto",
2642
+ transition: "max-height 0.3s ease-in-out"
2631
2643
  },
2632
- componentKey
2633
- );
2634
- }) }) })
2644
+ children: /* @__PURE__ */ jsx12(
2645
+ "div",
2646
+ {
2647
+ style: {
2648
+ height: `${virtualizer.getTotalSize()}px`,
2649
+ width: "100%",
2650
+ position: "relative"
2651
+ },
2652
+ children: /* @__PURE__ */ jsx12(Drawer, { children: children || virtualizer.getVirtualItems().map((virtualItem) => {
2653
+ const componentKey = components[virtualItem.index];
2654
+ return /* @__PURE__ */ jsx12(
2655
+ "div",
2656
+ {
2657
+ style: {
2658
+ position: "absolute",
2659
+ top: 0,
2660
+ left: 0,
2661
+ width: "100%",
2662
+ height: `${virtualItem.size}px`,
2663
+ transform: `translateY(${virtualItem.start}px)`
2664
+ },
2665
+ children: /* @__PURE__ */ jsx12(
2666
+ ComponentListItem,
2667
+ {
2668
+ label: config.components[componentKey]["label"] ?? componentKey,
2669
+ name: componentKey
2670
+ }
2671
+ )
2672
+ },
2673
+ virtualItem.key
2674
+ );
2675
+ }) })
2676
+ }
2677
+ )
2678
+ }
2679
+ )
2635
2680
  ] });
2636
2681
  };
2637
2682
  ComponentList.Item = ComponentListItem;
@@ -2750,9 +2795,9 @@ import {
2750
2795
  forwardRef as forwardRef2,
2751
2796
  useCallback as useCallback11,
2752
2797
  useContext as useContext7,
2753
- useRef as useRef9
2798
+ useRef as useRef10
2754
2799
  } from "react";
2755
- import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
2800
+ import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
2756
2801
  import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs5 } from "react/jsx-runtime";
2757
2802
  var getClassName7 = get_class_name_factory_default("LayerTree", styles_module_default7);
2758
2803
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default7);
@@ -3021,8 +3066,8 @@ var VirtualizedLayerTreeItems = ({
3021
3066
  selectedPathIds,
3022
3067
  tree
3023
3068
  }) => {
3024
- const listRef = useRef9(null);
3025
- const virtualizer = useVirtualizer2({
3069
+ const listRef = useRef10(null);
3070
+ const virtualizer = useVirtualizer3({
3026
3071
  count: tree.items.length,
3027
3072
  estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
3028
3073
  getItemKey: (index) => tree.items[index].itemId,
@@ -3425,12 +3470,12 @@ import {
3425
3470
  useCallback as useCallback22,
3426
3471
  useEffect as useEffect23,
3427
3472
  useMemo as useMemo21,
3428
- useRef as useRef17,
3473
+ useRef as useRef18,
3429
3474
  useState as useState17
3430
3475
  } from "react";
3431
3476
 
3432
3477
  // components/CredBuild/components/Preview/index.tsx
3433
- import { useCallback as useCallback14, useEffect as useEffect15, useRef as useRef11, useMemo as useMemo13 } from "react";
3478
+ import { useCallback as useCallback14, useEffect as useEffect15, useRef as useRef12, useMemo as useMemo13 } from "react";
3434
3479
 
3435
3480
  // components/AutoFrame/index.tsx
3436
3481
  import {
@@ -3438,7 +3483,7 @@ import {
3438
3483
  useCallback as useCallback13,
3439
3484
  useContext as useContext9,
3440
3485
  useEffect as useEffect14,
3441
- useRef as useRef10,
3486
+ useRef as useRef11,
3442
3487
  useState as useState9
3443
3488
  } from "react";
3444
3489
  import hash from "object-hash";
@@ -3680,8 +3725,8 @@ function AutoFrame({
3680
3725
  const handleStylesLoaded = useCallback13(() => {
3681
3726
  setStylesLoaded(true);
3682
3727
  }, []);
3683
- const onReadyRef = useRef10(onReady);
3684
- const onNotReadyRef = useRef10(onNotReady);
3728
+ const onReadyRef = useRef11(onReady);
3729
+ const onNotReadyRef = useRef11(onNotReady);
3685
3730
  useEffect14(() => {
3686
3731
  onReadyRef.current = onReady;
3687
3732
  onNotReadyRef.current = onNotReady;
@@ -3827,7 +3872,7 @@ var Preview = ({ id = "credbuild-preview" }) => {
3827
3872
  );
3828
3873
  const Frame = useMemo13(() => overrides.iframe, [overrides]);
3829
3874
  const rootProps = root.props || root;
3830
- const ref = useRef11(null);
3875
+ const ref = useRef12(null);
3831
3876
  useBubbleIframeEvents(ref);
3832
3877
  const inner = !renderData ? /* @__PURE__ */ jsx23(
3833
3878
  Page,
@@ -4015,7 +4060,7 @@ import {
4015
4060
  useCallback as useCallback16,
4016
4061
  useEffect as useEffect17,
4017
4062
  useMemo as useMemo15,
4018
- useRef as useRef12,
4063
+ useRef as useRef13,
4019
4064
  useState as useState11
4020
4065
  } from "react";
4021
4066
  import { AutoScroller, defaultPreset } from "@dnd-kit/dom";
@@ -4349,7 +4394,7 @@ import { jsx as jsx26 } from "react/jsx-runtime";
4349
4394
  var DEBUG2 = false;
4350
4395
  var AREA_CHANGE_DEBOUNCE_MS = 100;
4351
4396
  var useTempDisableFallback = (timeout2) => {
4352
- const lastFallbackDisable = useRef12(null);
4397
+ const lastFallbackDisable = useRef13(null);
4353
4398
  return useCallback16((manager) => {
4354
4399
  collisionStore.setState({ fallbackEnabled: false });
4355
4400
  const fallbackId = generateId();
@@ -4369,7 +4414,7 @@ var DragDropContextClient = ({
4369
4414
  const dispatch = useAppStore((s) => s.dispatch);
4370
4415
  const instanceId = useAppStore((s) => s.instanceId);
4371
4416
  const appStore = useAppStoreApi();
4372
- const debouncedParamsRef = useRef12(null);
4417
+ const debouncedParamsRef = useRef13(null);
4373
4418
  const tempDisableFallback = useTempDisableFallback(100);
4374
4419
  const [zoneStore] = useState11(() => {
4375
4420
  const rootVirtualizers = /* @__PURE__ */ new Map();
@@ -4515,8 +4560,8 @@ var DragDropContextClient = ({
4515
4560
  ]);
4516
4561
  const sensors = useSensors();
4517
4562
  const [dragListeners, setDragListeners] = useState11({});
4518
- const dragMode = useRef12(null);
4519
- const initialSelector = useRef12(void 0);
4563
+ const dragMode = useRef13(null);
4564
+ const initialSelector = useRef13(void 0);
4520
4565
  const nextContextValue = useMemo15(
4521
4566
  () => ({
4522
4567
  mode: "edit",
@@ -5007,7 +5052,7 @@ import { useShallow as useShallow6 } from "zustand/react/shallow";
5007
5052
  import {
5008
5053
  createContext as createContext7,
5009
5054
  useContext as useContext12,
5010
- useRef as useRef13,
5055
+ useRef as useRef14,
5011
5056
  useMemo as useMemo17
5012
5057
  } from "react";
5013
5058
  import { jsx as jsx29 } from "react/jsx-runtime";
@@ -5015,7 +5060,7 @@ var FrameContext = createContext7(null);
5015
5060
  var FrameProvider = ({
5016
5061
  children
5017
5062
  }) => {
5018
- const frameRef = useRef13(null);
5063
+ const frameRef = useRef14(null);
5019
5064
  const value = useMemo17(
5020
5065
  () => ({
5021
5066
  frameRef
@@ -5039,7 +5084,8 @@ var styles_module_default16 = { "CredBuildHeader": "_CredBuildHeader_qzv5u_1", "
5039
5084
  import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs11 } from "react/jsx-runtime";
5040
5085
  var getClassName15 = get_class_name_factory_default("CredBuildHeader", styles_module_default16);
5041
5086
  var HeaderInner = ({
5042
- hidePlugins
5087
+ hidePlugins,
5088
+ theme
5043
5089
  }) => {
5044
5090
  const {
5045
5091
  onPublish,
@@ -5176,7 +5222,7 @@ var HeaderInner = ({
5176
5222
  children: "Dashboard"
5177
5223
  }
5178
5224
  ),
5179
- /* @__PURE__ */ jsxs11(
5225
+ /* @__PURE__ */ jsx30(
5180
5226
  IconButton,
5181
5227
  {
5182
5228
  type: "button",
@@ -5194,10 +5240,7 @@ var HeaderInner = ({
5194
5240
  window.dispatchEvent(new CustomEvent("credbuild-theme-change", { detail: newTheme }));
5195
5241
  },
5196
5242
  title: "Toggle Theme",
5197
- children: [
5198
- /* @__PURE__ */ jsx30(Sun, { className: "cb-theme-sun", size: 16 }),
5199
- /* @__PURE__ */ jsx30(Moon, { className: "cb-theme-moon", size: 16 })
5200
- ]
5243
+ children: theme === "dark" ? /* @__PURE__ */ jsx30(Sun, { size: 16 }) : /* @__PURE__ */ jsx30(Moon, { size: 16 })
5201
5244
  }
5202
5245
  )
5203
5246
  ] }),
@@ -5338,7 +5381,7 @@ import {
5338
5381
  useCallback as useCallback18,
5339
5382
  useEffect as useEffect19,
5340
5383
  useMemo as useMemo19,
5341
- useRef as useRef14,
5384
+ useRef as useRef15,
5342
5385
  useState as useState14
5343
5386
  } from "react";
5344
5387
 
@@ -5392,7 +5435,7 @@ var Canvas = () => {
5392
5435
  }))
5393
5436
  );
5394
5437
  const [showTransition, setShowTransition] = useState14(false);
5395
- const isResizingRef = useRef14(false);
5438
+ const isResizingRef = useRef15(false);
5396
5439
  const defaultRender = useMemo19(() => {
5397
5440
  const CredBuildDefault = ({ children }) => /* @__PURE__ */ jsx32(Fragment12, { children });
5398
5441
  return CredBuildDefault;
@@ -5561,10 +5604,10 @@ var Canvas = () => {
5561
5604
  };
5562
5605
 
5563
5606
  // lib/use-sidebar-resize.ts
5564
- import { useCallback as useCallback19, useEffect as useEffect20, useRef as useRef15, useState as useState15 } from "react";
5607
+ import { useCallback as useCallback19, useEffect as useEffect20, useRef as useRef16, useState as useState15 } from "react";
5565
5608
  function useSidebarResize(position, dispatch) {
5566
5609
  const [width, setWidth] = useState15(null);
5567
- const sidebarRef = useRef15(null);
5610
+ const sidebarRef = useRef16(null);
5568
5611
  const storeWidth = useAppStore(
5569
5612
  (s) => position === "left" ? s.state.ui.leftSideBarWidth : s.state.ui.rightSideBarWidth
5570
5613
  );
@@ -5642,7 +5685,7 @@ function useSidebarResize(position, dispatch) {
5642
5685
  }
5643
5686
 
5644
5687
  // components/CredBuild/components/ResizeHandle/index.tsx
5645
- import { useCallback as useCallback20, useRef as useRef16 } from "react";
5688
+ import { useCallback as useCallback20, useRef as useRef17 } from "react";
5646
5689
 
5647
5690
  // css-module:/home/crediblemark/Project/Credibuild/components/CredBuild/components/ResizeHandle/styles.module.css#css-module
5648
5691
  var styles_module_default19 = { "ResizeHandle": "_ResizeHandle_144bf_2", "ResizeHandle--left": "_ResizeHandle--left_144bf_16", "ResizeHandle--right": "_ResizeHandle--right_144bf_20" };
@@ -5658,10 +5701,10 @@ var ResizeHandle = ({
5658
5701
  }) => {
5659
5702
  const { frameRef } = useCanvasFrame();
5660
5703
  const resetAutoZoom = useResetAutoZoom(frameRef);
5661
- const handleRef = useRef16(null);
5662
- const isDragging = useRef16(false);
5663
- const startX = useRef16(0);
5664
- const startWidth = useRef16(0);
5704
+ const handleRef = useRef17(null);
5705
+ const isDragging = useRef17(false);
5706
+ const startX = useRef17(0);
5707
+ const startWidth = useRef17(0);
5665
5708
  const handleMouseMove = useCallback20(
5666
5709
  (e) => {
5667
5710
  if (!isDragging.current) return;
@@ -6039,6 +6082,7 @@ var Layout = ({ children }) => {
6039
6082
  className: `CredBuild ${theme === "dark" ? "dark" : ""} ${getClassName21({
6040
6083
  hidePlugins: hasLegacySideBarPlugin
6041
6084
  })}`,
6085
+ "data-theme": theme,
6042
6086
  id: instanceId,
6043
6087
  style: { height },
6044
6088
  children: [
@@ -6060,7 +6104,7 @@ var Layout = ({ children }) => {
6060
6104
  className: getLayoutClassName("inner"),
6061
6105
  style: layoutOptions,
6062
6106
  children: [
6063
- /* @__PURE__ */ jsx36("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsx36(Header, { hidePlugins: hasLegacySideBarPlugin }) }),
6107
+ /* @__PURE__ */ jsx36("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ jsx36(Header, { theme, hidePlugins: hasLegacySideBarPlugin }) }),
6064
6108
  /* @__PURE__ */ jsxs16(
6065
6109
  Sidebar,
6066
6110
  {
@@ -6289,7 +6333,7 @@ function CredBuildProvider({ children }) {
6289
6333
  index: initialHistoryIndex,
6290
6334
  initialAppState
6291
6335
  });
6292
- const previousData = useRef17(null);
6336
+ const previousData = useRef18(null);
6293
6337
  useEffect23(() => {
6294
6338
  return appStore.subscribe(
6295
6339
  (s) => s.state.data,
package/dist/index.js CHANGED
@@ -11102,6 +11102,7 @@ init_get_class_name_factory();
11102
11102
  var import_react76 = require("react");
11103
11103
  init_store2();
11104
11104
  init_lucide_react();
11105
+ var import_react_virtual2 = require("@tanstack/react-virtual");
11105
11106
  var import_jsx_runtime71 = require("react/jsx-runtime");
11106
11107
  var getClassName28 = get_class_name_factory_default("ComponentList", styles_module_default19);
11107
11108
  var ComponentListItem = ({
@@ -11131,7 +11132,16 @@ var ComponentList = ({
11131
11132
  const config = useAppStore((s) => s.config);
11132
11133
  const setUi = useAppStore((s) => s.setUi);
11133
11134
  const componentList = useAppStore((s) => s.state.ui.componentList);
11135
+ const parentRef = (0, import_react76.useRef)(null);
11134
11136
  const { expanded = true } = componentList[id] || {};
11137
+ const components = Object.keys(config.components);
11138
+ const virtualizer = (0, import_react_virtual2.useVirtualizer)({
11139
+ count: components.length,
11140
+ getScrollElement: () => parentRef.current,
11141
+ estimateSize: () => 40,
11142
+ // Estimated height of each item
11143
+ overscan: 5
11144
+ });
11135
11145
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: getClassName28({ isExpanded: expanded }), children: [
11136
11146
  title && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
11137
11147
  "button",
@@ -11147,7 +11157,6 @@ var ComponentList = ({
11147
11157
  }
11148
11158
  }
11149
11159
  }),
11150
- title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
11151
11160
  children: [
11152
11161
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
11153
11162
  id.toLowerCase().includes("hero") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LayoutTemplate, { size: 12, strokeWidth: 2.5 }),
@@ -11162,16 +11171,52 @@ var ComponentList = ({
11162
11171
  ]
11163
11172
  }
11164
11173
  ),
11165
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: getClassName28("content"), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
11166
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11167
- ComponentListItem,
11168
- {
11169
- label: config.components[componentKey]["label"] ?? componentKey,
11170
- name: componentKey
11174
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11175
+ "div",
11176
+ {
11177
+ ref: parentRef,
11178
+ className: getClassName28("content"),
11179
+ style: {
11180
+ maxHeight: expanded ? "500px" : "0px",
11181
+ overflowY: "auto",
11182
+ transition: "max-height 0.3s ease-in-out"
11171
11183
  },
11172
- componentKey
11173
- );
11174
- }) }) })
11184
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11185
+ "div",
11186
+ {
11187
+ style: {
11188
+ height: `${virtualizer.getTotalSize()}px`,
11189
+ width: "100%",
11190
+ position: "relative"
11191
+ },
11192
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Drawer, { children: children || virtualizer.getVirtualItems().map((virtualItem) => {
11193
+ const componentKey = components[virtualItem.index];
11194
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11195
+ "div",
11196
+ {
11197
+ style: {
11198
+ position: "absolute",
11199
+ top: 0,
11200
+ left: 0,
11201
+ width: "100%",
11202
+ height: `${virtualItem.size}px`,
11203
+ transform: `translateY(${virtualItem.start}px)`
11204
+ },
11205
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11206
+ ComponentListItem,
11207
+ {
11208
+ label: config.components[componentKey]["label"] ?? componentKey,
11209
+ name: componentKey
11210
+ }
11211
+ )
11212
+ },
11213
+ virtualItem.key
11214
+ );
11215
+ }) })
11216
+ }
11217
+ )
11218
+ }
11219
+ )
11175
11220
  ] });
11176
11221
  };
11177
11222
  ComponentList.Item = ComponentListItem;
@@ -11803,7 +11848,7 @@ init_root_droppable_id();
11803
11848
  var import_react82 = require("react");
11804
11849
  init_store2();
11805
11850
  init_use_context_store();
11806
- var import_react_virtual2 = require("@tanstack/react-virtual");
11851
+ var import_react_virtual3 = require("@tanstack/react-virtual");
11807
11852
  var import_jsx_runtime77 = require("react/jsx-runtime");
11808
11853
  var getClassName30 = get_class_name_factory_default("LayerTree", styles_module_default21);
11809
11854
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default21);
@@ -12073,7 +12118,7 @@ var VirtualizedLayerTreeItems = ({
12073
12118
  tree
12074
12119
  }) => {
12075
12120
  const listRef = (0, import_react82.useRef)(null);
12076
- const virtualizer = (0, import_react_virtual2.useVirtualizer)({
12121
+ const virtualizer = (0, import_react_virtual3.useVirtualizer)({
12077
12122
  count: tree.items.length,
12078
12123
  estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
12079
12124
  getItemKey: (index) => tree.items[index].itemId,
@@ -13584,7 +13629,8 @@ var styles_module_default25 = { "CredBuildHeader": "_CredBuildHeader_qzv5u_1", "
13584
13629
  var import_jsx_runtime85 = require("react/jsx-runtime");
13585
13630
  var getClassName33 = get_class_name_factory_default("CredBuildHeader", styles_module_default25);
13586
13631
  var HeaderInner = ({
13587
- hidePlugins
13632
+ hidePlugins,
13633
+ theme
13588
13634
  }) => {
13589
13635
  const {
13590
13636
  onPublish,
@@ -13721,7 +13767,7 @@ var HeaderInner = ({
13721
13767
  children: "Dashboard"
13722
13768
  }
13723
13769
  ),
13724
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
13770
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
13725
13771
  IconButton,
13726
13772
  {
13727
13773
  type: "button",
@@ -13739,10 +13785,7 @@ var HeaderInner = ({
13739
13785
  window.dispatchEvent(new CustomEvent("credbuild-theme-change", { detail: newTheme }));
13740
13786
  },
13741
13787
  title: "Toggle Theme",
13742
- children: [
13743
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Sun, { className: "cb-theme-sun", size: 16 }),
13744
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Moon, { className: "cb-theme-moon", size: 16 })
13745
- ]
13788
+ children: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Sun, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Moon, { size: 16 })
13746
13789
  }
13747
13790
  )
13748
13791
  ] }),
@@ -14764,6 +14807,7 @@ var Layout = ({ children }) => {
14764
14807
  className: `CredBuild ${theme === "dark" ? "dark" : ""} ${getClassName43({
14765
14808
  hidePlugins: hasLegacySideBarPlugin
14766
14809
  })}`,
14810
+ "data-theme": theme,
14767
14811
  id: instanceId,
14768
14812
  style: { height },
14769
14813
  children: [
@@ -14785,7 +14829,7 @@ var Layout = ({ children }) => {
14785
14829
  className: getLayoutClassName("inner"),
14786
14830
  style: layoutOptions,
14787
14831
  children: [
14788
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Header, { hidePlugins: hasLegacySideBarPlugin }) }),
14832
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Header, { theme, hidePlugins: hasLegacySideBarPlugin }) }),
14789
14833
  /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
14790
14834
  Sidebar,
14791
14835
  {
package/dist/index.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  registerOverlayPortal,
13
13
  useCredBuild,
14
14
  useGetCredBuild
15
- } from "./chunk-D4PXAFBJ.mjs";
15
+ } from "./chunk-5H2KI7SK.mjs";
16
16
  import "./chunk-FC3ZRBT2.mjs";
17
17
  import {
18
18
  setDeep
@@ -11102,6 +11102,7 @@ init_get_class_name_factory();
11102
11102
  var import_react76 = require("react");
11103
11103
  init_store2();
11104
11104
  init_lucide_react();
11105
+ var import_react_virtual2 = require("@tanstack/react-virtual");
11105
11106
  var import_jsx_runtime71 = require("react/jsx-runtime");
11106
11107
  var getClassName28 = get_class_name_factory_default("ComponentList", styles_module_default19);
11107
11108
  var ComponentListItem = ({
@@ -11131,7 +11132,16 @@ var ComponentList = ({
11131
11132
  const config = useAppStore((s) => s.config);
11132
11133
  const setUi = useAppStore((s) => s.setUi);
11133
11134
  const componentList = useAppStore((s) => s.state.ui.componentList);
11135
+ const parentRef = (0, import_react76.useRef)(null);
11134
11136
  const { expanded = true } = componentList[id] || {};
11137
+ const components = Object.keys(config.components);
11138
+ const virtualizer = (0, import_react_virtual2.useVirtualizer)({
11139
+ count: components.length,
11140
+ getScrollElement: () => parentRef.current,
11141
+ estimateSize: () => 40,
11142
+ // Estimated height of each item
11143
+ overscan: 5
11144
+ });
11135
11145
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: getClassName28({ isExpanded: expanded }), children: [
11136
11146
  title && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
11137
11147
  "button",
@@ -11147,7 +11157,6 @@ var ComponentList = ({
11147
11157
  }
11148
11158
  }
11149
11159
  }),
11150
- title: expanded ? `Collapse${title ? ` ${title}` : ""}` : `Expand${title ? ` ${title}` : ""}`,
11151
11160
  children: [
11152
11161
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
11153
11162
  id.toLowerCase().includes("hero") && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LayoutTemplate, { size: 12, strokeWidth: 2.5 }),
@@ -11162,16 +11171,52 @@ var ComponentList = ({
11162
11171
  ]
11163
11172
  }
11164
11173
  ),
11165
- /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: getClassName28("content"), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Drawer, { children: children || Object.keys(config.components).map((componentKey) => {
11166
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11167
- ComponentListItem,
11168
- {
11169
- label: config.components[componentKey]["label"] ?? componentKey,
11170
- name: componentKey
11174
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11175
+ "div",
11176
+ {
11177
+ ref: parentRef,
11178
+ className: getClassName28("content"),
11179
+ style: {
11180
+ maxHeight: expanded ? "500px" : "0px",
11181
+ overflowY: "auto",
11182
+ transition: "max-height 0.3s ease-in-out"
11171
11183
  },
11172
- componentKey
11173
- );
11174
- }) }) })
11184
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11185
+ "div",
11186
+ {
11187
+ style: {
11188
+ height: `${virtualizer.getTotalSize()}px`,
11189
+ width: "100%",
11190
+ position: "relative"
11191
+ },
11192
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Drawer, { children: children || virtualizer.getVirtualItems().map((virtualItem) => {
11193
+ const componentKey = components[virtualItem.index];
11194
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11195
+ "div",
11196
+ {
11197
+ style: {
11198
+ position: "absolute",
11199
+ top: 0,
11200
+ left: 0,
11201
+ width: "100%",
11202
+ height: `${virtualItem.size}px`,
11203
+ transform: `translateY(${virtualItem.start}px)`
11204
+ },
11205
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
11206
+ ComponentListItem,
11207
+ {
11208
+ label: config.components[componentKey]["label"] ?? componentKey,
11209
+ name: componentKey
11210
+ }
11211
+ )
11212
+ },
11213
+ virtualItem.key
11214
+ );
11215
+ }) })
11216
+ }
11217
+ )
11218
+ }
11219
+ )
11175
11220
  ] });
11176
11221
  };
11177
11222
  ComponentList.Item = ComponentListItem;
@@ -11803,7 +11848,7 @@ init_root_droppable_id();
11803
11848
  var import_react82 = require("react");
11804
11849
  init_store2();
11805
11850
  init_use_context_store();
11806
- var import_react_virtual2 = require("@tanstack/react-virtual");
11851
+ var import_react_virtual3 = require("@tanstack/react-virtual");
11807
11852
  var import_jsx_runtime77 = require("react/jsx-runtime");
11808
11853
  var getClassName30 = get_class_name_factory_default("LayerTree", styles_module_default21);
11809
11854
  var getClassNameLayer = get_class_name_factory_default("Layer", styles_module_default21);
@@ -12073,7 +12118,7 @@ var VirtualizedLayerTreeItems = ({
12073
12118
  tree
12074
12119
  }) => {
12075
12120
  const listRef = (0, import_react82.useRef)(null);
12076
- const virtualizer = (0, import_react_virtual2.useVirtualizer)({
12121
+ const virtualizer = (0, import_react_virtual3.useVirtualizer)({
12077
12122
  count: tree.items.length,
12078
12123
  estimateSize: (index) => getEstimatedRowHeight(tree.items[index].itemId),
12079
12124
  getItemKey: (index) => tree.items[index].itemId,
@@ -13584,7 +13629,8 @@ var styles_module_default25 = { "CredBuildHeader": "_CredBuildHeader_qzv5u_1", "
13584
13629
  var import_jsx_runtime85 = require("react/jsx-runtime");
13585
13630
  var getClassName33 = get_class_name_factory_default("CredBuildHeader", styles_module_default25);
13586
13631
  var HeaderInner = ({
13587
- hidePlugins
13632
+ hidePlugins,
13633
+ theme
13588
13634
  }) => {
13589
13635
  const {
13590
13636
  onPublish,
@@ -13721,7 +13767,7 @@ var HeaderInner = ({
13721
13767
  children: "Dashboard"
13722
13768
  }
13723
13769
  ),
13724
- /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
13770
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
13725
13771
  IconButton,
13726
13772
  {
13727
13773
  type: "button",
@@ -13739,10 +13785,7 @@ var HeaderInner = ({
13739
13785
  window.dispatchEvent(new CustomEvent("credbuild-theme-change", { detail: newTheme }));
13740
13786
  },
13741
13787
  title: "Toggle Theme",
13742
- children: [
13743
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Sun, { className: "cb-theme-sun", size: 16 }),
13744
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Moon, { className: "cb-theme-moon", size: 16 })
13745
- ]
13788
+ children: theme === "dark" ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Sun, { size: 16 }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Moon, { size: 16 })
13746
13789
  }
13747
13790
  )
13748
13791
  ] }),
@@ -14764,6 +14807,7 @@ var Layout = ({ children }) => {
14764
14807
  className: `CredBuild ${theme === "dark" ? "dark" : ""} ${getClassName43({
14765
14808
  hidePlugins: hasLegacySideBarPlugin
14766
14809
  })}`,
14810
+ "data-theme": theme,
14767
14811
  id: instanceId,
14768
14812
  style: { height },
14769
14813
  children: [
@@ -14785,7 +14829,7 @@ var Layout = ({ children }) => {
14785
14829
  className: getLayoutClassName("inner"),
14786
14830
  style: layoutOptions,
14787
14831
  children: [
14788
- /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Header, { hidePlugins: hasLegacySideBarPlugin }) }),
14832
+ /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: getLayoutClassName("header"), children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Header, { theme, hidePlugins: hasLegacySideBarPlugin }) }),
14789
14833
  /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
14790
14834
  Sidebar,
14791
14835
  {
@@ -12,7 +12,7 @@ import {
12
12
  registerOverlayPortal,
13
13
  useCredBuild,
14
14
  useGetCredBuild
15
- } from "./chunk-D4PXAFBJ.mjs";
15
+ } from "./chunk-5H2KI7SK.mjs";
16
16
  import "./chunk-FC3ZRBT2.mjs";
17
17
  import {
18
18
  setDeep
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crediblemark/build",
3
- "version": "0.22.9",
3
+ "version": "0.24.1",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Rasyiqi Crediblemark",
6
6
  "repository": {