remoraid 2.10.7 → 2.18.43

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.
@@ -725,7 +725,7 @@ var require_lodash = __commonJS((exports2, module2) => {
725
725
  }
726
726
  var runInContext = function runInContext(context) {
727
727
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
728
- var { Array: Array2, Date, Error: Error2, Function: Function2, Math, Object: Object2, RegExp: RegExp2, String, TypeError: TypeError2 } = context;
728
+ var { Array: Array2, Date, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String, TypeError: TypeError2 } = context;
729
729
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
730
730
  var coreJsData = context["__core-js_shared__"];
731
731
  var funcToString = funcProto.toString;
@@ -748,7 +748,7 @@ var require_lodash = __commonJS((exports2, module2) => {
748
748
  } catch (e) {}
749
749
  }();
750
750
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
751
- var { ceil: nativeCeil, floor: nativeFloor } = Math, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math.max, nativeMin = Math.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse;
751
+ var { ceil: nativeCeil, floor: nativeFloor } = Math2, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
752
752
  var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
753
753
  var metaMap = WeakMap2 && new WeakMap2;
754
754
  var realNames = {};
@@ -1001,7 +1001,7 @@ var require_lodash = __commonJS((exports2, module2) => {
1001
1001
  }
1002
1002
  SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
1003
1003
  SetCache.prototype.has = setCacheHas;
1004
- function Stack3(entries) {
1004
+ function Stack2(entries) {
1005
1005
  var data = this.__data__ = new ListCache(entries);
1006
1006
  this.size = data.size;
1007
1007
  }
@@ -1035,11 +1035,11 @@ var require_lodash = __commonJS((exports2, module2) => {
1035
1035
  this.size = data.size;
1036
1036
  return this;
1037
1037
  }
1038
- Stack3.prototype.clear = stackClear;
1039
- Stack3.prototype["delete"] = stackDelete;
1040
- Stack3.prototype.get = stackGet;
1041
- Stack3.prototype.has = stackHas;
1042
- Stack3.prototype.set = stackSet;
1038
+ Stack2.prototype.clear = stackClear;
1039
+ Stack2.prototype["delete"] = stackDelete;
1040
+ Stack2.prototype.get = stackGet;
1041
+ Stack2.prototype.has = stackHas;
1042
+ Stack2.prototype.set = stackSet;
1043
1043
  function arrayLikeKeys(value, inherited) {
1044
1044
  var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes(value.length, String) : [], length = result2.length;
1045
1045
  for (var key in value) {
@@ -1155,7 +1155,7 @@ var require_lodash = __commonJS((exports2, module2) => {
1155
1155
  result2 = initCloneByTag(value, tag, isDeep);
1156
1156
  }
1157
1157
  }
1158
- stack || (stack = new Stack3);
1158
+ stack || (stack = new Stack2);
1159
1159
  var stacked = stack.get(value);
1160
1160
  if (stacked) {
1161
1161
  return stacked;
@@ -1424,21 +1424,21 @@ var require_lodash = __commonJS((exports2, module2) => {
1424
1424
  objIsObj = false;
1425
1425
  }
1426
1426
  if (isSameTag && !objIsObj) {
1427
- stack || (stack = new Stack3);
1427
+ stack || (stack = new Stack2);
1428
1428
  return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1429
1429
  }
1430
1430
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1431
1431
  var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
1432
1432
  if (objIsWrapped || othIsWrapped) {
1433
1433
  var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
1434
- stack || (stack = new Stack3);
1434
+ stack || (stack = new Stack2);
1435
1435
  return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1436
1436
  }
1437
1437
  }
1438
1438
  if (!isSameTag) {
1439
1439
  return false;
1440
1440
  }
1441
- stack || (stack = new Stack3);
1441
+ stack || (stack = new Stack2);
1442
1442
  return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1443
1443
  }
1444
1444
  function baseIsMap(value) {
@@ -1464,7 +1464,7 @@ var require_lodash = __commonJS((exports2, module2) => {
1464
1464
  return false;
1465
1465
  }
1466
1466
  } else {
1467
- var stack = new Stack3;
1467
+ var stack = new Stack2;
1468
1468
  if (customizer) {
1469
1469
  var result2 = customizer(objValue, srcValue, key, object, source, stack);
1470
1470
  }
@@ -1560,7 +1560,7 @@ var require_lodash = __commonJS((exports2, module2) => {
1560
1560
  return;
1561
1561
  }
1562
1562
  baseFor(source, function(srcValue, key) {
1563
- stack || (stack = new Stack3);
1563
+ stack || (stack = new Stack2);
1564
1564
  if (isObject(srcValue)) {
1565
1565
  baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
1566
1566
  } else {
@@ -2429,7 +2429,7 @@ var require_lodash = __commonJS((exports2, module2) => {
2429
2429
  return setWrapToString(result2, func, bitmask);
2430
2430
  }
2431
2431
  function createRound(methodName) {
2432
- var func = Math[methodName];
2432
+ var func = Math2[methodName];
2433
2433
  return function(number, precision) {
2434
2434
  number = toNumber(number);
2435
2435
  precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
@@ -5461,6 +5461,7 @@ __p += '`;
5461
5461
  var exports_core = {};
5462
5462
  __export(exports_core, {
5463
5463
  useWidgets: () => useWidgets,
5464
+ useWidget: () => useWidget,
5464
5465
  useSettingsWidgetOptions: () => useSettingsWidgetContext,
5465
5466
  useSettingsTableOptions: () => useSettingsTableOptions,
5466
5467
  useRemoraidUserExperience: () => useRemoraidUserExperience,
@@ -5471,19 +5472,27 @@ __export(exports_core, {
5471
5472
  useHydrationStatus: () => useHydrationStatus,
5472
5473
  useHydratedMantineColorScheme: () => useHydratedMantineColorScheme,
5473
5474
  useFrameLayout: () => useFrameLayout,
5474
- isFrameLayout: () => isFrameLayout,
5475
+ remoraidAppShellLayoutId: () => remoraidAppShellLayoutId,
5476
+ isValidElementOfType: () => isValidElementOfType,
5477
+ getElementTypeName: () => getElementTypeName,
5478
+ getDefaultWidgetContext: () => getDefaultWidgetContext,
5475
5479
  defaultUserExperienceCookieName: () => defaultUserExperienceCookieName,
5476
5480
  defaultUserExperience: () => defaultUserExperience,
5477
5481
  defaultSettingsWidgetOptions: () => defaultSettingsWidgetContext,
5478
5482
  defaultSettingsTableOptions: () => defaultSettingsTableOptions,
5479
5483
  defaultNavbarSettingsWidgetId: () => defaultNavbarSettingsWidgetId,
5480
5484
  defaultLayoutsContext: () => defaultLayoutsContext,
5481
- defaultFrameLayoutContext: () => defaultFrameLayoutContext,
5482
- defaultAppShellLayoutId: () => defaultAppShellLayoutId,
5485
+ defaultAppShellNavbarPositions: () => defaultAppShellNavbarPositions,
5486
+ defaultAppShellFooterPositions: () => defaultAppShellFooterPositions,
5483
5487
  defaultAppContext: () => defaultAppContext,
5484
5488
  createUserExperienceContext: () => createUserExperienceContext,
5485
5489
  createRemoraidTheme: () => createRemoraidTheme,
5486
- WidgetWrapper: () => WidgetWrapper_default,
5490
+ createContextCluster: () => createContextCluster,
5491
+ co: () => co,
5492
+ asElementOrPropsOfType: () => asElementOrPropsOfType,
5493
+ asElementOfType: () => asElementOfType,
5494
+ asChildrenOfType: () => asChildrenOfType,
5495
+ WidgetWrapper: () => WidgetWrapper,
5487
5496
  WidgetSelectionHeader: () => WidgetSelectionHeader,
5488
5497
  Widget: () => Widget,
5489
5498
  UserExperienceProviderWrapper: () => UserExperienceProviderWrapper,
@@ -5495,6 +5504,7 @@ __export(exports_core, {
5495
5504
  RemoraidIconSize: () => RemoraidIconSize,
5496
5505
  RemoraidButton: () => RemoraidButton,
5497
5506
  RemoraidBreakpoint: () => RemoraidBreakpoint,
5507
+ Pinnable: () => Pinnable,
5498
5508
  PageContainer: () => PageContainer,
5499
5509
  Page: () => Page,
5500
5510
  NotFoundPage: () => NotFoundPage,
@@ -5502,11 +5512,13 @@ __export(exports_core, {
5502
5512
  NavbarSettingsWidget: () => NavbarSettingsWidget,
5503
5513
  LayoutType: () => LayoutType,
5504
5514
  HydrationStatusProvider: () => HydrationStatusProvider,
5505
- FrameLayoutVariant: () => FrameLayoutVariant,
5506
5515
  FrameLayoutSection: () => FrameLayoutSection,
5507
5516
  FrameLayout: () => FrameLayout_default,
5508
5517
  FooterVariant: () => FooterVariant,
5509
5518
  EnvironmentShell: () => EnvironmentShell,
5519
+ Controls: () => Controls,
5520
+ ControlButton: () => ControlButton,
5521
+ ContextClusterProvider: () => ContextClusterProvider,
5510
5522
  BadgeMinimal: () => BadgeMinimal,
5511
5523
  BadgeGroup: () => BadgeGroup,
5512
5524
  AppShell: () => AppShell_default,
@@ -5519,6 +5531,11 @@ module.exports = __toCommonJS(exports_core);
5519
5531
  // src/core/components/RemoraidProvider/WidgetsProvider/index.tsx
5520
5532
  var import_react = __toESM(require("react"));
5521
5533
  var jsx_dev_runtime = require("react/jsx-dev-runtime");
5534
+ var getDefaultWidgetContext = (configuration) => ({
5535
+ name: configuration.widgetId,
5536
+ selected: true,
5537
+ ...configuration.initialValues
5538
+ });
5522
5539
  var widgetsContext = import_react.default.createContext({
5523
5540
  widgets: {},
5524
5541
  activeWidget: null,
@@ -5534,6 +5551,10 @@ var widgetsContext = import_react.default.createContext({
5534
5551
  var useWidgets = () => {
5535
5552
  return import_react.useContext(widgetsContext);
5536
5553
  };
5554
+ var useWidget = (pageId, widgetId) => {
5555
+ const { widgets } = useWidgets();
5556
+ return widgets?.[pageId]?.[widgetId] ?? null;
5557
+ };
5537
5558
  function WidgetsProvider({
5538
5559
  children
5539
5560
  }) {
@@ -5579,13 +5600,10 @@ function WidgetsProvider({
5579
5600
  const registerPage = (pageId, initialWidgets) => {
5580
5601
  setWidgets((prev) => ({
5581
5602
  ...prev,
5582
- [pageId]: initialWidgets.reduce((t, w) => {
5603
+ [pageId]: initialWidgets.reduce((t, widget) => {
5583
5604
  return {
5584
5605
  ...t,
5585
- [w.widgetId]: {
5586
- name: w.name,
5587
- selected: w.initialValue === undefined ? true : w.initialValue
5588
- }
5606
+ [widget.widgetId]: getDefaultWidgetContext(widget)
5589
5607
  };
5590
5608
  }, {})
5591
5609
  }));
@@ -5609,10 +5627,7 @@ function WidgetsProvider({
5609
5627
  ...prev,
5610
5628
  [pageId]: {
5611
5629
  ...prev[pageId],
5612
- [widget.widgetId]: {
5613
- name: widget.name,
5614
- selected: widget.initialValue === undefined ? true : widget.initialValue
5615
- }
5630
+ [widget.widgetId]: getDefaultWidgetContext(widget)
5616
5631
  }
5617
5632
  }));
5618
5633
  };
@@ -5691,23 +5706,52 @@ var FrameLayoutSection;
5691
5706
  FrameLayoutSection2["Right"] = "right";
5692
5707
  FrameLayoutSection2["Content"] = "content";
5693
5708
  })(FrameLayoutSection ||= {});
5694
- var FrameLayoutVariant;
5695
- ((FrameLayoutVariant2) => {
5696
- FrameLayoutVariant2["Plain"] = "plain";
5697
- FrameLayoutVariant2["Sticky"] = "sticky";
5698
- })(FrameLayoutVariant ||= {});
5699
5709
 
5700
5710
  // src/core/lib/utils.ts
5711
+ var import_react2 = require("react");
5701
5712
  var co = (condition, value, fallback) => condition(value) ? value : fallback;
5713
+ var isValidElementOfType = (type, value) => {
5714
+ return import_react2.isValidElement(value) && value.type === type;
5715
+ };
5716
+ var getElementTypeName = (type) => {
5717
+ if (typeof type === "string") {
5718
+ return type;
5719
+ }
5720
+ if (typeof type === "function") {
5721
+ return type.displayName ?? type.name ?? "anonymous component";
5722
+ }
5723
+ return "unknown";
5724
+ };
5725
+ var asElementOfType = (type, element, additionalErrorMessage) => {
5726
+ if (isValidElementOfType(type, element)) {
5727
+ return element;
5728
+ }
5729
+ throw new TypeError(`Expected React element of type ${getElementTypeName(type)}, but received type: ${getElementTypeName(element.type)}.${additionalErrorMessage !== undefined && additionalErrorMessage.length > 0 ? ` ${additionalErrorMessage}` : ""}`);
5730
+ };
5731
+ var asChildrenOfType = (type, children, additionalErrorMessage) => {
5732
+ if (children === undefined || children === null) {
5733
+ return children;
5734
+ }
5735
+ if (Array.isArray(children)) {
5736
+ return children.map((child) => asChildrenOfType(type, child, additionalErrorMessage));
5737
+ }
5738
+ return asElementOfType(type, children, additionalErrorMessage);
5739
+ };
5740
+ var asElementOrPropsOfType = (type, elementOrProps, additionalErrorMessage) => {
5741
+ if (import_react2.isValidElement(elementOrProps)) {
5742
+ return asElementOfType(type, elementOrProps, additionalErrorMessage);
5743
+ }
5744
+ return elementOrProps;
5745
+ };
5702
5746
 
5703
5747
  // src/core/components/RemoraidProvider/ThemeProvider/index.tsx
5704
5748
  var import_core2 = require("@mantine/core");
5705
5749
  var import_icons_react = require("@tabler/icons-react");
5706
- var import_react3 = __toESM(require("react"));
5750
+ var import_react4 = __toESM(require("react"));
5707
5751
 
5708
5752
  // src/core/components/RemoraidProvider/HydrationStatusProvider/index.tsx
5709
5753
  var import_core = require("@mantine/core");
5710
- var import_react2 = require("react");
5754
+ var import_react3 = require("react");
5711
5755
  var jsx_dev_runtime2 = require("react/jsx-dev-runtime");
5712
5756
  var defaultHydrationStatus = {
5713
5757
  hasHydrated: false,
@@ -5715,9 +5759,9 @@ var defaultHydrationStatus = {
5715
5759
  return;
5716
5760
  }
5717
5761
  };
5718
- var hydrationStatusContext = import_react2.createContext(defaultHydrationStatus);
5762
+ var hydrationStatusContext = import_react3.createContext(defaultHydrationStatus);
5719
5763
  var useHydrationStatus = () => {
5720
- return import_react2.useContext(hydrationStatusContext);
5764
+ return import_react3.useContext(hydrationStatusContext);
5721
5765
  };
5722
5766
  var useHydratedMantineColorScheme = () => {
5723
5767
  const { ensureHydration } = useHydrationStatus();
@@ -5726,12 +5770,12 @@ var useHydratedMantineColorScheme = () => {
5726
5770
  function HydrationStatusProvider({
5727
5771
  children
5728
5772
  }) {
5729
- const [hasHydrated, setHasHydrated] = import_react2.useState(defaultHydrationStatus.hasHydrated);
5730
- const hydrationStatus = import_react2.useMemo(() => ({
5773
+ const [hasHydrated, setHasHydrated] = import_react3.useState(defaultHydrationStatus.hasHydrated);
5774
+ const hydrationStatus = import_react3.useMemo(() => ({
5731
5775
  hasHydrated,
5732
5776
  ensureHydration: (v) => hasHydrated ? v : undefined
5733
5777
  }), [hasHydrated]);
5734
- import_react2.useEffect(() => {
5778
+ import_react3.useEffect(() => {
5735
5779
  setHasHydrated(true);
5736
5780
  }, []);
5737
5781
  return /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(hydrationStatusContext.Provider, {
@@ -5831,9 +5875,9 @@ var createRemoraidTheme = (customTheme, dependencies) => {
5831
5875
  }
5832
5876
  };
5833
5877
  };
5834
- var themeContext = import_react3.default.createContext(createRemoraidTheme());
5878
+ var themeContext = import_react4.default.createContext(createRemoraidTheme());
5835
5879
  var useRemoraidTheme = () => {
5836
- return import_react3.useContext(themeContext);
5880
+ return import_react4.useContext(themeContext);
5837
5881
  };
5838
5882
  function ThemeProvider({
5839
5883
  theme,
@@ -5841,7 +5885,7 @@ function ThemeProvider({
5841
5885
  }) {
5842
5886
  const mantineTheme = import_core2.useMantineTheme();
5843
5887
  const { colorScheme } = useHydratedMantineColorScheme();
5844
- const remoraidTheme = import_react3.useMemo(() => {
5888
+ const remoraidTheme = import_react4.useMemo(() => {
5845
5889
  const dependencies = {
5846
5890
  mantineTheme,
5847
5891
  colorScheme
@@ -5858,13 +5902,13 @@ function ThemeProvider({
5858
5902
  var import_react_cookie2 = require("react-cookie");
5859
5903
 
5860
5904
  // src/core/components/RemoraidProvider/CoreUserExperienceProvider/index.tsx
5861
- var import_react5 = require("react");
5905
+ var import_react6 = require("react");
5862
5906
 
5863
5907
  // src/core/components/UserExperienceProviderWrapper/index.tsx
5864
- var import_react4 = require("react");
5908
+ var import_react5 = require("react");
5865
5909
  var import_react_cookie = require("react-cookie");
5866
5910
  var jsx_dev_runtime4 = require("react/jsx-dev-runtime");
5867
- var createUserExperienceContext = (defaultUserExperience) => import_react4.createContext({
5911
+ var createUserExperienceContext = (defaultUserExperience) => import_react5.createContext({
5868
5912
  userExperience: defaultUserExperience,
5869
5913
  updateUserExperience: () => {},
5870
5914
  processedCookie: false,
@@ -5879,18 +5923,18 @@ function UserExperienceProviderWrapper({
5879
5923
  initialValue
5880
5924
  }) {
5881
5925
  const [cookies, setCookie] = import_react_cookie.useCookies();
5882
- const initialUserExperience = {
5883
- ...defaultUserExperience,
5884
- ...initialValue
5885
- };
5886
- const [userExperience, setUserExperience] = import_react4.useState(initialUserExperience);
5887
- const [processedCookie, setProcessedCookie] = import_react4.useState(false);
5926
+ let initialUserExperience = defaultUserExperience;
5927
+ if (typeof initialValue === "object" && typeof initialUserExperience === "object") {
5928
+ initialUserExperience = { ...initialUserExperience, ...initialValue };
5929
+ }
5930
+ const [userExperience, setUserExperience] = import_react5.useState(initialUserExperience);
5931
+ const [processedCookie, setProcessedCookie] = import_react5.useState(false);
5888
5932
  const updateUserExperience = (p) => {
5889
5933
  const updatedUserExperience = typeof p === "function" ? p(userExperience) : p;
5890
5934
  setCookie(cookieName, updatedUserExperience, { path: "/" });
5891
5935
  setUserExperience(updatedUserExperience);
5892
5936
  };
5893
- import_react4.useEffect(() => {
5937
+ import_react5.useEffect(() => {
5894
5938
  const userExperienceCookie = cookies[cookieName];
5895
5939
  if (userExperienceCookie && isValidUserExperience(userExperienceCookie)) {
5896
5940
  setUserExperience(userExperienceCookie);
@@ -5919,7 +5963,7 @@ var defaultUserExperience = {
5919
5963
  var defaultUserExperienceCookieName = "remoraid-core-user-experience";
5920
5964
  var coreUserExperienceContext = createUserExperienceContext(defaultUserExperience);
5921
5965
  var useRemoraidUserExperience = () => {
5922
- return import_react5.useContext(coreUserExperienceContext);
5966
+ return import_react6.useContext(coreUserExperienceContext);
5923
5967
  };
5924
5968
  function CoreUserExperienceProvider({
5925
5969
  children,
@@ -5952,20 +5996,20 @@ function CoreUserExperienceProvider({
5952
5996
  }
5953
5997
 
5954
5998
  // src/core/components/RemoraidProvider/LayoutsProvider/index.tsx
5955
- var import_react6 = require("react");
5999
+ var import_react7 = require("react");
5956
6000
  var jsx_dev_runtime6 = require("react/jsx-dev-runtime");
5957
6001
  var defaultLayoutsContext = {
5958
6002
  layouts: {},
5959
6003
  setLayouts: () => {}
5960
6004
  };
5961
- var layoutsContext = import_react6.createContext(defaultLayoutsContext);
6005
+ var layoutsContext = import_react7.createContext(defaultLayoutsContext);
5962
6006
  var useLayouts = () => {
5963
- return import_react6.useContext(layoutsContext);
6007
+ return import_react7.useContext(layoutsContext);
5964
6008
  };
5965
6009
  function LayoutsProvider({
5966
6010
  children
5967
6011
  }) {
5968
- const [layouts, setLayouts] = import_react6.useState({});
6012
+ const [layouts, setLayouts] = import_react7.useState({});
5969
6013
  return /* @__PURE__ */ jsx_dev_runtime6.jsxDEV(layoutsContext.Provider, {
5970
6014
  value: { layouts, setLayouts },
5971
6015
  children
@@ -6003,24 +6047,24 @@ function RemoraidProvider({
6003
6047
  }, undefined, false, undefined, this);
6004
6048
  }
6005
6049
  // src/core/components/AppShell/index.tsx
6006
- var import_core7 = require("@mantine/core");
6050
+ var import_core8 = require("@mantine/core");
6007
6051
 
6008
6052
  // src/core/components/AppShell/NavbarMinimal/index.tsx
6009
6053
  var import_core3 = require("@mantine/core");
6010
6054
  var import_icons_react2 = require("@tabler/icons-react");
6011
6055
  var import_link = __toESM(require("next/link"));
6012
6056
  var import_navigation = require("next/navigation");
6013
- var import_react8 = require("react");
6057
+ var import_react9 = require("react");
6014
6058
 
6015
6059
  // src/core/components/AppShell/AppProvider/index.tsx
6016
- var import_react7 = require("react");
6060
+ var import_react8 = require("react");
6017
6061
  var jsx_dev_runtime8 = require("react/jsx-dev-runtime");
6018
6062
  var defaultAppContext = {
6019
6063
  navigablePages: []
6020
6064
  };
6021
- var appContext = import_react7.createContext(defaultAppContext);
6065
+ var appContext = import_react8.createContext(defaultAppContext);
6022
6066
  var useRemoraidApp = () => {
6023
- return import_react7.useContext(appContext);
6067
+ return import_react8.useContext(appContext);
6024
6068
  };
6025
6069
  function AppProvider({
6026
6070
  appContext: appContextProps,
@@ -6044,7 +6088,7 @@ function NavbarLink({
6044
6088
  href,
6045
6089
  indicator
6046
6090
  }) {
6047
- const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = import_react8.useState(false);
6091
+ const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = import_react9.useState(false);
6048
6092
  const iconProps = {
6049
6093
  size: iconSize,
6050
6094
  stroke: 1.5
@@ -6106,7 +6150,7 @@ function NavbarMinimal({
6106
6150
  const { setColorScheme, colorScheme } = useHydratedMantineColorScheme();
6107
6151
  const { userExperience } = useRemoraidUserExperience();
6108
6152
  const { navigablePages, logo, auth } = useRemoraidApp();
6109
- const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = import_react8.useState(false);
6153
+ const [isHoveringRoleIndicator, setIsHoveringRoleIndicator] = import_react9.useState(false);
6110
6154
  const linkProps = {
6111
6155
  linkSize,
6112
6156
  iconSize,
@@ -6209,7 +6253,6 @@ function FooterMinimal({
6209
6253
  return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_core4.Group, {
6210
6254
  justify: "center",
6211
6255
  w: "100%",
6212
- py: "md",
6213
6256
  ...componentsProps?.container,
6214
6257
  children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_icons_react3.IconPennant, {
6215
6258
  size: 50,
@@ -6220,257 +6263,323 @@ function FooterMinimal({
6220
6263
  }
6221
6264
 
6222
6265
  // src/core/components/FrameLayout/index.tsx
6223
- var import_core6 = require("@mantine/core");
6224
- var import_react9 = require("react");
6266
+ var import_core7 = require("@mantine/core");
6267
+ var import_react10 = require("react");
6225
6268
 
6226
6269
  // src/core/components/FrameLayout/Element/index.tsx
6270
+ var import_core6 = require("@mantine/core");
6271
+
6272
+ // src/core/lib/errors.ts
6273
+ class InvalidComponentUsageError extends Error {
6274
+ constructor(component, rule) {
6275
+ super(`Invalid usage of '${component}': ${rule}`);
6276
+ this.name = "InvalidComponentUsageError";
6277
+ }
6278
+ }
6279
+
6280
+ // src/core/components/Page/PageContainer/index.tsx
6227
6281
  var import_core5 = require("@mantine/core");
6282
+
6283
+ // node_modules/clsx/dist/clsx.mjs
6284
+ function r(e) {
6285
+ var t, f, n = "";
6286
+ if (typeof e == "string" || typeof e == "number")
6287
+ n += e;
6288
+ else if (typeof e == "object")
6289
+ if (Array.isArray(e)) {
6290
+ var o = e.length;
6291
+ for (t = 0;t < o; t++)
6292
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
6293
+ } else
6294
+ for (f in e)
6295
+ e[f] && (n && (n += " "), n += f);
6296
+ return n;
6297
+ }
6298
+ function clsx() {
6299
+ for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
6300
+ (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
6301
+ return n;
6302
+ }
6303
+ var clsx_default = clsx;
6304
+
6305
+ // src/core/components/Page/PageContainer/index.tsx
6228
6306
  var jsx_dev_runtime11 = require("react/jsx-dev-runtime");
6229
- function Element({
6307
+ function PageContainer({
6308
+ children,
6309
+ p = 0,
6310
+ hidden = false,
6311
+ componentsProps
6312
+ }) {
6313
+ const theme = useRemoraidTheme();
6314
+ return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core5.Container, {
6315
+ size: theme.containerSize,
6316
+ p,
6317
+ w: "100%",
6318
+ "data-hidden": hidden,
6319
+ ...componentsProps?.container,
6320
+ className: clsx_default("remoraid-page-container", componentsProps?.container?.className),
6321
+ children
6322
+ }, undefined, false, undefined, this);
6323
+ }
6324
+
6325
+ // src/core/components/FrameLayout/Element/index.tsx
6326
+ var import_lodash = __toESM(require_lodash());
6327
+ var jsx_dev_runtime12 = require("react/jsx-dev-runtime");
6328
+ function Element2({
6230
6329
  section,
6231
6330
  includeContainer = true,
6331
+ includePageContainer = false,
6232
6332
  layoutId,
6333
+ hidden = false,
6233
6334
  componentsProps,
6234
6335
  children
6235
6336
  }) {
6236
6337
  const { layouts } = useLayouts();
6237
6338
  const closestLayout = useFrameLayout();
6238
- if (closestLayout.layoutId === null) {
6239
- return null;
6339
+ if (!closestLayout) {
6340
+ throw new InvalidComponentUsageError("FrameLayout.Element", "must be used as child of 'FrameLayout'.");
6240
6341
  }
6241
6342
  const layout = layouts[layoutId ?? closestLayout.layoutId];
6242
- if (!isFrameLayout(layout)) {
6343
+ if (!layout) {
6243
6344
  return null;
6244
6345
  }
6245
- if (layout.sections[section] === null) {
6346
+ if (layout.type !== "frame" /* Frame */) {
6347
+ throw new TypeError("Prop 'layoutId' in 'FrameLayout.Element' must refer to a valid 'FrameLayout' component. Leave 'layoutId' undefined, if you want to use the closest 'FrameLayout' as reference layout.");
6348
+ }
6349
+ if (!layout.sections[section]) {
6246
6350
  return null;
6247
6351
  }
6248
6352
  let containerProps = {};
6249
6353
  if (section === "left" /* Left */ || section === "right" /* Right */) {
6250
6354
  containerProps.h = "100%";
6251
6355
  }
6252
- return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core5.Portal, {
6356
+ const element = includePageContainer ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(PageContainer, {
6357
+ p: 0,
6358
+ hidden,
6359
+ ...componentsProps?.PageContainer,
6360
+ children
6361
+ }, undefined, false, undefined, this) : children;
6362
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Portal, {
6253
6363
  target: layout.sections[section],
6254
- children: includeContainer ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core5.Box, {
6255
- ...containerProps,
6256
- ...componentsProps?.container,
6257
- children
6258
- }, undefined, false, undefined, this) : children
6364
+ children: includeContainer ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Box, {
6365
+ "data-hidden": hidden,
6366
+ ...import_lodash.merge(containerProps, componentsProps?.container),
6367
+ className: clsx_default("remoraid-frame-layout-element", containerProps?.className, componentsProps?.container?.className),
6368
+ children: element
6369
+ }, undefined, false, undefined, this) : element
6259
6370
  }, undefined, false, undefined, this);
6260
6371
  }
6261
6372
 
6262
6373
  // src/core/components/FrameLayout/index.tsx
6263
- var jsx_dev_runtime12 = require("react/jsx-dev-runtime");
6264
- var isFrameLayout = (layout) => {
6265
- if (typeof layout !== "object" || layout === null) {
6266
- return false;
6267
- }
6268
- if (!("sections" in layout)) {
6269
- return false;
6270
- }
6271
- if (typeof layout.sections !== "object" || layout.sections === null) {
6272
- return false;
6273
- }
6274
- return true;
6275
- };
6276
- var defaultFrameLayoutVariant = "sticky" /* Sticky */;
6277
- var defaultFrameLayoutContext = {
6278
- layoutId: null,
6279
- layout: {
6280
- sections: {
6281
- ["top" /* Top */]: null,
6282
- ["bottom" /* Bottom */]: null,
6283
- ["left" /* Left */]: null,
6284
- ["right" /* Right */]: null
6285
- }
6286
- },
6287
- setLayout: () => {}
6288
- };
6289
- var layoutContext = import_react9.createContext(defaultFrameLayoutContext);
6374
+ var jsx_dev_runtime13 = require("react/jsx-dev-runtime");
6375
+ var layoutContext = import_react10.createContext(null);
6290
6376
  var useFrameLayout = () => {
6291
- return import_react9.useContext(layoutContext);
6377
+ return import_react10.useContext(layoutContext);
6292
6378
  };
6293
6379
  function FrameLayout({
6294
- variant = defaultFrameLayoutVariant,
6295
6380
  layoutId,
6381
+ includeScrollArea = true,
6382
+ gutter = 0,
6296
6383
  componentsProps,
6297
6384
  children
6298
6385
  }) {
6299
6386
  const theme = useRemoraidTheme();
6300
6387
  const { layouts, setLayouts } = useLayouts();
6301
6388
  const layout = layouts[layoutId];
6302
- const setLayout = import_react9.useMemo(() => {
6303
- return (value) => {
6304
- setLayouts((prev) => ({
6305
- ...prev,
6306
- [layoutId]: typeof value === "function" ? value(prev[layoutId]) : value
6307
- }));
6308
- };
6309
- }, [layoutId, setLayouts]);
6310
- const topSection = import_react9.useCallback((n) => {
6311
- setLayout((prev) => ({
6389
+ const defaultSections = import_react10.useMemo(() => ({
6390
+ ["bottom" /* Bottom */]: null,
6391
+ ["right" /* Right */]: null,
6392
+ ["top" /* Top */]: null,
6393
+ ["left" /* Left */]: null,
6394
+ ["content" /* Content */]: null
6395
+ }), []);
6396
+ const setSections = import_react10.useCallback((value) => {
6397
+ setLayouts((prev) => ({
6398
+ ...prev,
6399
+ [layoutId]: {
6400
+ type: "frame" /* Frame */,
6401
+ sections: typeof value === "function" ? value(prev[layoutId]?.sections ?? defaultSections) : value
6402
+ }
6403
+ }));
6404
+ }, [layoutId, setLayouts, defaultSections]);
6405
+ const topSectionRef = import_react10.useCallback((n) => {
6406
+ setSections((prev) => ({
6407
+ ...prev,
6408
+ ["top" /* Top */]: n
6409
+ }));
6410
+ }, [setSections]);
6411
+ const bottomSectionRef = import_react10.useCallback((n) => {
6412
+ setSections((prev) => ({
6312
6413
  ...prev,
6313
- sections: { ...prev?.sections, ["top" /* Top */]: n }
6414
+ ["bottom" /* Bottom */]: n
6314
6415
  }));
6315
- }, [setLayout]);
6316
- const bottomSection = import_react9.useCallback((n) => {
6317
- setLayout((prev) => ({
6416
+ }, [setSections]);
6417
+ const leftSectionRef = import_react10.useCallback((n) => {
6418
+ setSections((prev) => ({
6318
6419
  ...prev,
6319
- sections: { ...prev?.sections, ["bottom" /* Bottom */]: n }
6420
+ ["left" /* Left */]: n
6320
6421
  }));
6321
- }, [setLayout]);
6322
- const leftSection = import_react9.useCallback((n) => {
6323
- setLayout((prev) => ({
6422
+ }, [setSections]);
6423
+ const rightSectionRef = import_react10.useCallback((n) => {
6424
+ setSections((prev) => ({
6324
6425
  ...prev,
6325
- sections: { ...prev?.sections, ["left" /* Left */]: n }
6426
+ ["right" /* Right */]: n
6326
6427
  }));
6327
- }, [setLayout]);
6328
- const rightSection = import_react9.useCallback((n) => {
6329
- setLayout((prev) => ({
6428
+ }, [setSections]);
6429
+ const contentSectionRef = import_react10.useCallback((n) => {
6430
+ setSections((prev) => ({
6330
6431
  ...prev,
6331
- sections: { ...prev?.sections, ["right" /* Right */]: n }
6432
+ ["content" /* Content */]: n
6332
6433
  }));
6333
- }, [setLayout]);
6334
- let contentSection = children;
6335
- const childrenContainerProps = {
6434
+ }, [setSections]);
6435
+ const contentSection = /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6436
+ ref: contentSectionRef,
6437
+ h: "100%",
6438
+ gap: gutter,
6336
6439
  flex: 1,
6337
- ...componentsProps?.childrenContainer
6338
- };
6339
- if (variant === "plain" /* Plain */) {
6340
- contentSection = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Box, {
6341
- ...childrenContainerProps,
6342
- children: contentSection
6343
- }, undefined, false, undefined, this);
6344
- } else if (variant === "sticky" /* Sticky */) {
6345
- contentSection = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.ScrollArea, {
6346
- ...theme.scrollAreaProps,
6347
- ...childrenContainerProps,
6348
- children
6349
- }, undefined, false, undefined, this);
6350
- }
6351
- return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(layoutContext.Provider, {
6352
- value: { layoutId, layout, setLayout },
6353
- children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Group, {
6440
+ ...componentsProps?.sectionContainers?.["content" /* Content */],
6441
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-content-section", componentsProps?.sectionContainers?.["content" /* Content */]?.className),
6442
+ children
6443
+ }, undefined, false, undefined, this);
6444
+ const layoutContextValue = import_react10.useMemo(() => ({
6445
+ type: "frame" /* Frame */,
6446
+ sections: defaultSections,
6447
+ ...layout,
6448
+ layoutId
6449
+ }), [layout?.sections, defaultSections, layoutId]);
6450
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(layoutContext.Provider, {
6451
+ value: layoutContextValue,
6452
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Group, {
6354
6453
  gap: 0,
6355
6454
  h: "100%",
6356
6455
  w: "100%",
6357
6456
  wrap: "nowrap",
6358
6457
  ...componentsProps?.horizontalContainer,
6458
+ style: {
6459
+ "--remoraid-frame-layout-gutter": typeof gutter === "string" ? `var(--mantine-spacing-${gutter})` : `${gutter}px`
6460
+ },
6461
+ className: clsx_default("remoraid-frame-layout", componentsProps?.horizontalContainer?.className),
6359
6462
  children: [
6360
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Group, {
6361
- ref: leftSection,
6463
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Group, {
6464
+ ref: leftSectionRef,
6362
6465
  h: "100%",
6363
- gap: 0,
6364
6466
  wrap: "nowrap",
6365
- ...componentsProps?.sectionContainers?.["left" /* Left */]
6467
+ gap: gutter,
6468
+ pr: 0,
6469
+ ...componentsProps?.sectionContainers?.["left" /* Left */],
6470
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["left" /* Left */]?.className)
6366
6471
  }, undefined, false, undefined, this),
6367
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Stack, {
6472
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6368
6473
  h: "100%",
6369
6474
  flex: 1,
6370
6475
  gap: 0,
6371
6476
  ...componentsProps?.verticalContainer,
6477
+ className: clsx_default("remoraid-frame-layout-vertical-container", componentsProps?.verticalContainer?.className),
6372
6478
  children: [
6373
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Stack, {
6374
- h: "100%",
6375
- ref: topSection,
6376
- gap: 0,
6479
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6480
+ ref: topSectionRef,
6481
+ gap: gutter,
6377
6482
  flex: 0,
6378
- ...componentsProps?.sectionContainers?.["top" /* Top */]
6483
+ ...componentsProps?.sectionContainers?.["top" /* Top */],
6484
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-top-section", componentsProps?.sectionContainers?.["top" /* Top */]?.className)
6379
6485
  }, undefined, false, undefined, this),
6380
- contentSection,
6381
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Stack, {
6382
- h: "100%",
6383
- ref: bottomSection,
6384
- gap: 0,
6486
+ includeScrollArea ? /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.ScrollArea, {
6487
+ flex: 1,
6488
+ ...theme.scrollAreaProps,
6489
+ ...componentsProps?.ScrollArea,
6490
+ children: contentSection
6491
+ }, undefined, false, undefined, this) : contentSection,
6492
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6493
+ ref: bottomSectionRef,
6494
+ gap: gutter,
6385
6495
  flex: 0,
6386
- ...componentsProps?.sectionContainers?.["bottom" /* Bottom */]
6496
+ ...componentsProps?.sectionContainers?.["bottom" /* Bottom */],
6497
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-bottom-section", componentsProps?.sectionContainers?.["bottom" /* Bottom */]?.className)
6387
6498
  }, undefined, false, undefined, this)
6388
6499
  ]
6389
6500
  }, undefined, true, undefined, this),
6390
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Group, {
6391
- gap: 0,
6392
- ref: rightSection,
6501
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Group, {
6502
+ ref: rightSectionRef,
6393
6503
  h: "100%",
6504
+ gap: gutter,
6505
+ pl: 0,
6394
6506
  wrap: "nowrap",
6395
- ...componentsProps?.sectionContainers?.["right" /* Right */]
6507
+ ...componentsProps?.sectionContainers?.["right" /* Right */],
6508
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["right" /* Right */]?.className)
6396
6509
  }, undefined, false, undefined, this)
6397
6510
  ]
6398
6511
  }, undefined, true, undefined, this)
6399
6512
  }, undefined, false, undefined, this);
6400
6513
  }
6401
6514
  var FrameLayout_default = Object.assign(FrameLayout, {
6402
- Element
6515
+ Element: Element2
6403
6516
  });
6404
6517
 
6405
6518
  // src/core/components/AppShell/index.tsx
6406
- var jsx_dev_runtime13 = require("react/jsx-dev-runtime");
6407
- var defaultAppShellLayoutId = "remoraidAppShell";
6408
- var defaultProps = {
6409
- navbarVariant: null,
6410
- footerVariant: null
6411
- };
6412
- function AppShell(props) {
6413
- const {
6414
- children,
6415
- navbarVariant,
6416
- footerVariant,
6417
- navbarPosition,
6418
- footerPosition,
6419
- appContext: appContext2,
6420
- componentsProps
6421
- } = {
6422
- ...defaultProps,
6423
- ...props
6424
- };
6519
+ var import_lodash2 = __toESM(require_lodash());
6520
+ var jsx_dev_runtime14 = require("react/jsx-dev-runtime");
6521
+ var remoraidAppShellLayoutId = "remoraid-app-shell";
6522
+ var defaultAppShellNavbarPositions = { ["minimal" /* Minimal */]: "left" /* Left */ };
6523
+ var defaultAppShellFooterPositions = { ["minimal" /* Minimal */]: "content" /* Content */ };
6524
+ function AppShell({
6525
+ navbarVariant: navbarVariantProp,
6526
+ footerVariant: footerVariantProp,
6527
+ navbarPosition: navbarPositionProp,
6528
+ footerPosition: footerPositionProp,
6529
+ gutter = "md",
6530
+ appContext: appContext2,
6531
+ componentsProps,
6532
+ children
6533
+ }) {
6534
+ const navbarVariant = navbarVariantProp ?? null;
6535
+ const footerVariant = footerVariantProp ?? null;
6536
+ const navbarPosition = navbarPositionProp ?? (navbarVariant === null ? null : defaultAppShellNavbarPositions[navbarVariant]);
6537
+ const footerPosition = footerPositionProp ?? (footerVariant === null ? null : defaultAppShellFooterPositions[footerVariant]);
6425
6538
  let navbar;
6426
6539
  let footer;
6427
- let navbarContainerProps = {};
6428
- let footerContainerProps = {};
6540
+ let navbarLayoutElementProps = {
6541
+ includeContainer: false
6542
+ };
6543
+ let footerLayoutElementProps = {
6544
+ includeContainer: true,
6545
+ componentsProps: { container: { style: { order: 1 } } }
6546
+ };
6429
6547
  if (navbarVariant === "minimal" /* Minimal */) {
6430
- navbar = /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(NavbarMinimal, {
6548
+ navbar = /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(NavbarMinimal, {
6431
6549
  ...componentsProps?.navbar
6432
6550
  }, undefined, false, undefined, this);
6433
- navbarContainerProps.py = "md";
6434
- if (navbarPosition === "left" /* Left */) {
6435
- navbarContainerProps.pl = "md";
6436
- } else if (navbarPosition === "right" /* Right */) {
6437
- navbarContainerProps.pr = "md";
6438
- }
6439
6551
  }
6440
6552
  if (footerVariant === "minimal" /* Minimal */) {
6441
- footer = /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FooterMinimal, {
6553
+ footer = /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FooterMinimal, {
6442
6554
  ...componentsProps?.footer
6443
6555
  }, undefined, false, undefined, this);
6444
6556
  }
6445
- return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(AppProvider, {
6557
+ return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(AppProvider, {
6446
6558
  appContext: appContext2,
6447
6559
  ...componentsProps?.AppProvider,
6448
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FrameLayout_default, {
6449
- layoutId: defaultAppShellLayoutId,
6450
- ...componentsProps?.layout,
6451
- children: [
6452
- navbarPosition !== undefined && navbarPosition !== "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FrameLayout_default.Element, {
6453
- section: navbarPosition,
6454
- componentsProps: { container: { ...navbarContainerProps } },
6455
- children: navbar
6456
- }, undefined, false, undefined, this),
6457
- footerPosition !== undefined && footerPosition !== "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FrameLayout_default.Element, {
6458
- section: footerPosition,
6459
- componentsProps: { container: { ...footerContainerProps } },
6460
- children: footer
6461
- }, undefined, false, undefined, this),
6462
- navbarPosition !== undefined && navbarPosition === "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
6463
- children: navbar
6464
- }, undefined, false, undefined, this),
6465
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Box, {
6466
- ...componentsProps?.childrenContainer,
6467
- children
6468
- }, undefined, false, undefined, this),
6469
- footerPosition !== undefined && footerPosition === "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
6470
- children: footer
6471
- }, undefined, false, undefined, this)
6472
- ]
6473
- }, undefined, true, undefined, this)
6560
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core8.Box, {
6561
+ h: "100vh",
6562
+ ...componentsProps?.container,
6563
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FrameLayout_default, {
6564
+ layoutId: remoraidAppShellLayoutId,
6565
+ gutter,
6566
+ ...componentsProps?.layout,
6567
+ children: [
6568
+ navbarPosition !== null && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FrameLayout_default.Element, {
6569
+ section: navbarPosition,
6570
+ includeContainer: false,
6571
+ ...import_lodash2.merge(navbarLayoutElementProps, componentsProps?.navbarLayoutElement),
6572
+ children: navbar
6573
+ }, undefined, false, undefined, this),
6574
+ children,
6575
+ footerPosition !== null && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FrameLayout_default.Element, {
6576
+ section: footerPosition,
6577
+ ...import_lodash2.merge(footerLayoutElementProps, componentsProps?.footerLayoutElement),
6578
+ children: footer
6579
+ }, undefined, false, undefined, this)
6580
+ ]
6581
+ }, undefined, true, undefined, this)
6582
+ }, undefined, false, undefined, this)
6474
6583
  }, undefined, false, undefined, this);
6475
6584
  }
6476
6585
  var AppShell_default = Object.assign(AppShell, {
@@ -6481,43 +6590,24 @@ var AppShell_default = Object.assign(AppShell, {
6481
6590
  var import_core10 = require("@mantine/core");
6482
6591
 
6483
6592
  // src/core/components/Page/index.tsx
6484
- var import_react10 = __toESM(require("react"));
6593
+ var import_react11 = __toESM(require("react"));
6485
6594
  var import_navigation2 = require("next/navigation");
6486
-
6487
- // src/core/components/Page/PageContainer/index.tsx
6488
- var import_core8 = require("@mantine/core");
6489
- var jsx_dev_runtime14 = require("react/jsx-dev-runtime");
6490
- function PageContainer({
6491
- children,
6492
- pt,
6493
- componentsProps
6494
- }) {
6495
- const theme = useRemoraidTheme();
6496
- return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core8.Container, {
6497
- size: theme.containerSize,
6498
- pt: pt ?? "md",
6499
- ...componentsProps?.container,
6500
- children
6501
- }, undefined, false, undefined, this);
6502
- }
6503
-
6504
- // src/core/components/Page/index.tsx
6505
6595
  var jsx_dev_runtime15 = require("react/jsx-dev-runtime");
6506
- var pageContext = import_react10.default.createContext(null);
6596
+ var pageContext = import_react11.default.createContext(null);
6507
6597
  var usePage = () => {
6508
- return import_react10.useContext(pageContext);
6598
+ return import_react11.useContext(pageContext);
6509
6599
  };
6510
6600
  function Page({
6511
6601
  children,
6512
6602
  name,
6513
6603
  config,
6514
- pt,
6604
+ p = 0,
6515
6605
  componentsProps
6516
6606
  }) {
6517
6607
  const pathname = import_navigation2.usePathname();
6518
6608
  const { isPageRegistered, registerPage } = useWidgets();
6519
6609
  const pageId = config?.pageId ?? pathname;
6520
- import_react10.useEffect(() => {
6610
+ import_react11.useEffect(() => {
6521
6611
  if (!isPageRegistered(pageId)) {
6522
6612
  if (config?.registerPageDirectly) {
6523
6613
  registerPage(pageId, []);
@@ -6527,7 +6617,7 @@ function Page({
6527
6617
  return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(pageContext.Provider, {
6528
6618
  value: { name: name ?? pathname, pageId, ...config },
6529
6619
  children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(PageContainer, {
6530
- pt,
6620
+ p,
6531
6621
  componentsProps: { container: componentsProps?.container },
6532
6622
  children
6533
6623
  }, undefined, false, undefined, this)
@@ -6545,8 +6635,9 @@ function ScrollableChipGroup({
6545
6635
  onChange,
6546
6636
  gap,
6547
6637
  componentsProps,
6548
- children
6638
+ children: childrenProp
6549
6639
  }) {
6640
+ const children = asChildrenOfType(import_core9.Chip, childrenProp, "Check children passed to 'ScrollableChipGroup' component.");
6550
6641
  const theme = useRemoraidTheme();
6551
6642
  return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core9.ScrollArea, {
6552
6643
  ...theme.scrollAreaProps,
@@ -6576,12 +6667,12 @@ function WidgetSelectionHeader({
6576
6667
  mt
6577
6668
  }) {
6578
6669
  const theme = useRemoraidTheme();
6579
- const { widgets, isPageRegistered, updateWidgetSelectionBulk } = useWidgets();
6670
+ const { isPageRegistered, updateWidgetSelectionBulk, ...widgetsContext2 } = useWidgets();
6580
6671
  const page = usePage();
6581
6672
  if (!page) {
6582
- console.error("'WidgetSelectionHeader' must be rendered inside of a 'Page' component.");
6583
- return null;
6673
+ throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
6584
6674
  }
6675
+ const widgets = widgetsContext2.widgets[page.pageId] ?? {};
6585
6676
  return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Flex, {
6586
6677
  justify: "flex-start",
6587
6678
  align: "center",
@@ -6597,86 +6688,52 @@ function WidgetSelectionHeader({
6597
6688
  orientation: "vertical"
6598
6689
  }, undefined, false, undefined, this),
6599
6690
  isPageRegistered(page.pageId) && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ScrollableChipGroup, {
6600
- value: Object.keys(widgets[page.pageId]).filter((widgetId) => widgets[page.pageId][widgetId].selected),
6691
+ value: Object.keys(widgets).filter((widgetId) => widgets[widgetId]?.selected),
6601
6692
  onChange: (value) => {
6602
6693
  updateWidgetSelectionBulk(page.pageId, value);
6603
6694
  },
6604
6695
  componentsProps: { scrollArea: { flex: 1 } },
6605
- children: Object.keys(widgets[page.pageId]).map((widgetId) => /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Chip, {
6606
- value: widgetId,
6607
- size: "sm",
6608
- disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6609
- icon: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_icons_react4.IconCheck, {
6610
- ...theme.iconProps.tiny
6611
- }, undefined, false, undefined, this),
6612
- children: widgets[page.pageId][widgetId].name
6613
- }, widgetId, false, undefined, this))
6696
+ children: Object.keys(widgets).map((widgetId) => {
6697
+ const widget = widgets[widgetId] ?? getDefaultWidgetContext({ widgetId });
6698
+ return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Chip, {
6699
+ value: widgetId,
6700
+ size: "sm",
6701
+ disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6702
+ icon: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_icons_react4.IconCheck, {
6703
+ ...theme.iconProps.tiny
6704
+ }, undefined, false, undefined, this),
6705
+ children: widget.name
6706
+ }, widgetId, false, undefined, this);
6707
+ })
6614
6708
  }, undefined, false, undefined, this)
6615
6709
  ]
6616
6710
  }, undefined, true, undefined, this);
6617
6711
  }
6618
- // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
6619
- var import_core11 = require("@mantine/core");
6620
- var import_icons_react5 = require("@tabler/icons-react");
6621
- var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
6622
- function CloseButton({ widgetId }) {
6623
- const theme = useRemoraidTheme();
6624
- const { activeWidget, updateWidgetSelection } = useWidgets();
6625
- const page = usePage();
6626
- return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.Transition, {
6627
- mounted: activeWidget === widgetId,
6628
- transition: "pop-top-right",
6629
- duration: theme.transitionDurations.short,
6630
- timingFunction: "ease",
6631
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.ActionIcon, {
6632
- pos: "absolute",
6633
- size: "xs",
6634
- className: "remoraid-close-button",
6635
- radius: "xl",
6636
- color: "red",
6637
- onClick: () => {
6638
- if (!page) {
6639
- return;
6640
- }
6641
- updateWidgetSelection(page.pageId, widgetId, false);
6642
- },
6643
- style: transitionStyle,
6644
- children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_icons_react5.IconX, {
6645
- ...theme.iconProps.tiny
6646
- }, undefined, false, undefined, this)
6647
- }, undefined, false, undefined, this)
6648
- }, undefined, false, undefined, this);
6649
- }
6650
6712
  // src/core/components/BadgeGroup/index.tsx
6651
- var import_core13 = require("@mantine/core");
6652
- var import_react11 = __toESM(require("react"));
6713
+ var import_core12 = require("@mantine/core");
6714
+ var import_react12 = __toESM(require("react"));
6653
6715
 
6654
6716
  // src/core/components/BadgeMinimal/index.tsx
6655
- var import_core12 = require("@mantine/core");
6656
- var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
6657
- var isBadgeMinimalProps = (e) => {
6658
- if (typeof e !== "object") {
6659
- return false;
6660
- }
6661
- if (!("label" in e)) {
6662
- return false;
6663
- }
6664
- return true;
6665
- };
6666
- function BadgeMinimal(props) {
6667
- const { label, tooltip, mounted, componentsProps } = props;
6717
+ var import_core11 = require("@mantine/core");
6718
+ var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
6719
+ function BadgeMinimal({
6720
+ label,
6721
+ tooltip,
6722
+ mounted = true,
6723
+ componentsProps
6724
+ }) {
6668
6725
  const theme = useRemoraidTheme();
6669
- return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Transition, {
6670
- mounted: mounted !== false,
6726
+ return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.Transition, {
6727
+ mounted,
6671
6728
  transition: "fade",
6672
6729
  duration: theme.transitionDurations.short,
6673
6730
  timingFunction: "ease",
6674
6731
  ...componentsProps?.transition,
6675
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Tooltip, {
6732
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.Tooltip, {
6676
6733
  disabled: !tooltip,
6677
6734
  label: tooltip,
6678
6735
  ...componentsProps?.tooltip,
6679
- children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Badge, {
6736
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.Badge, {
6680
6737
  variant: "default",
6681
6738
  ...componentsProps?.badge,
6682
6739
  style: {
@@ -6691,36 +6748,39 @@ function BadgeMinimal(props) {
6691
6748
  }
6692
6749
 
6693
6750
  // src/core/components/BadgeGroup/index.tsx
6694
- var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
6751
+ var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
6695
6752
  var react = require("react");
6696
6753
  function BadgeGroup({
6697
- badges,
6754
+ badges: badgesProp,
6698
6755
  gap,
6699
6756
  breakpoint,
6700
6757
  componentsProps
6701
6758
  }) {
6702
6759
  const theme = useRemoraidTheme();
6703
- const numVisibleBadges = badges.filter((e) => isBadgeMinimalProps(e) ? e.mounted !== false : true).length;
6704
- return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(jsx_dev_runtime20.Fragment, {
6760
+ const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
6761
+ const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
6762
+ return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(jsx_dev_runtime19.Fragment, {
6705
6763
  children: [
6706
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Group, {
6764
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Group, {
6707
6765
  gap: gap ?? "xs",
6708
6766
  wrap: "nowrap",
6709
6767
  visibleFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
6710
- children: badges.map((e, i) => {
6711
- if (isBadgeMinimalProps(e)) {
6712
- return /* @__PURE__ */ react.createElement(BadgeMinimal, {
6713
- ...e,
6714
- key: i
6715
- });
6716
- }
6717
- return e;
6768
+ children: badges.map((badge, i) => {
6769
+ if (isValidElementOfType(BadgeMinimal, badge)) {
6770
+ return badge;
6771
+ } else if (import_react12.isValidElement(badge)) {
6772
+ throw new TypeError(`Expected React element of type ${BadgeMinimal.name}, but received type: ${typeof badge.type === "string" ? badge.type : badge.type?.name ?? "unknown"}. Check the 'badges' property of this widget.`);
6773
+ }
6774
+ return /* @__PURE__ */ react.createElement(BadgeMinimal, {
6775
+ ...badge,
6776
+ key: i
6777
+ });
6718
6778
  })
6719
6779
  }, undefined, false, undefined, this),
6720
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Tooltip, {
6780
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Tooltip, {
6721
6781
  label: `${numVisibleBadges} badge${numVisibleBadges === 1 ? "" : "s"}`,
6722
6782
  ...componentsProps?.tooltip,
6723
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Badge, {
6783
+ children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Badge, {
6724
6784
  hiddenFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
6725
6785
  hidden: numVisibleBadges === 0,
6726
6786
  variant: "light",
@@ -6734,36 +6794,27 @@ function BadgeGroup({
6734
6794
  }, undefined, true, undefined, this);
6735
6795
  }
6736
6796
  // src/core/components/AlertMinimal/index.tsx
6737
- var import_core14 = require("@mantine/core");
6738
- var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
6739
- var isAlertMinimalProps = (e) => {
6740
- if (typeof e !== "object") {
6741
- return false;
6742
- }
6743
- if (!("category" in e)) {
6744
- return false;
6745
- }
6746
- return true;
6747
- };
6797
+ var import_core13 = require("@mantine/core");
6798
+ var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
6748
6799
  function AlertMinimal({
6749
- children,
6750
6800
  title,
6751
6801
  category,
6752
6802
  text,
6753
6803
  onClose,
6754
- mounted,
6804
+ mounted = true,
6755
6805
  mt,
6756
6806
  mb,
6757
- componentsProps
6807
+ componentsProps,
6808
+ children
6758
6809
  }) {
6759
6810
  const theme = useRemoraidTheme();
6760
- return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Transition, {
6811
+ return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Transition, {
6761
6812
  mounted: mounted !== false,
6762
6813
  transition: "fade",
6763
6814
  duration: theme.transitionDurations.short,
6764
6815
  timingFunction: "ease",
6765
6816
  ...componentsProps?.transition,
6766
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Alert, {
6817
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Alert, {
6767
6818
  ...theme.alertProps[category],
6768
6819
  title: title ?? theme.alertProps[category].title,
6769
6820
  withCloseButton: onClose !== undefined,
@@ -6783,230 +6834,570 @@ function AlertMinimal({
6783
6834
  }, undefined, false, undefined, this);
6784
6835
  }
6785
6836
  // src/core/components/RemoraidButton/index.tsx
6786
- var import_core15 = require("@mantine/core");
6787
- var import_icons_react6 = require("@tabler/icons-react");
6788
- var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
6789
- var isRemoraidButtonProps = (e) => {
6790
- if (typeof e !== "object") {
6791
- return false;
6792
- }
6793
- if (!("label" in e)) {
6794
- return false;
6795
- }
6796
- return true;
6797
- };
6837
+ var import_core14 = require("@mantine/core");
6838
+ var import_icons_react5 = require("@tabler/icons-react");
6839
+ var import_react13 = require("react");
6840
+ var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
6798
6841
  function RemoraidButton({
6799
6842
  label,
6800
- responsive,
6801
- breakpoint,
6802
- collapsed,
6843
+ responsive: ResponsiveProp,
6844
+ breakpoint: breakpointProp,
6845
+ collapsed: collapsedProp,
6803
6846
  size,
6804
6847
  color,
6805
6848
  onClick,
6806
6849
  loading,
6807
- variant,
6808
- componentsProps,
6809
- ...props
6850
+ variant = "default",
6851
+ mounted = true,
6852
+ icon: iconProp,
6853
+ iconSize = "medium" /* Medium */,
6854
+ componentsProps
6810
6855
  }) {
6856
+ const responsive = ResponsiveProp ?? true;
6857
+ const breakpoint = breakpointProp ?? "md";
6858
+ const collapsed = collapsedProp ?? false;
6859
+ const icon = iconProp ?? import_icons_react5.IconClick;
6811
6860
  const theme = useRemoraidTheme();
6812
- const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
6813
- const icon = props.icon ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(props.icon, {
6814
- ...iconProps
6815
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_icons_react6.IconClick, {
6816
- ...iconProps
6817
- }, undefined, false, undefined, this);
6818
- return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
6819
- children: [
6820
- /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.Tooltip, {
6821
- label,
6822
- ...componentsProps?.tooltip,
6823
- children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.ActionIcon, {
6824
- "aria-label": label,
6825
- variant: variant ?? "default",
6861
+ const iconProps = { ...theme.iconProps[iconSize], ...componentsProps?.icon };
6862
+ const iconElement = import_react13.createElement(icon, iconProps);
6863
+ return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Transition, {
6864
+ mounted,
6865
+ transition: "fade",
6866
+ duration: theme.transitionDurations.short,
6867
+ timingFunction: "ease",
6868
+ ...componentsProps?.transition,
6869
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
6870
+ children: [
6871
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Tooltip, {
6872
+ label,
6873
+ ...componentsProps?.tooltip,
6874
+ children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.ActionIcon, {
6875
+ "aria-label": label,
6876
+ variant,
6877
+ onClick,
6878
+ loading,
6879
+ size: size ? `input-${size}` : "input-sm",
6880
+ color,
6881
+ ...componentsProps?.button,
6882
+ ...componentsProps?.ActionIcon,
6883
+ hiddenFrom: !responsive ? undefined : breakpoint,
6884
+ display: !responsive && !collapsed ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6885
+ style: {
6886
+ ...transitionStyle,
6887
+ ...componentsProps?.ActionIcon?.style ?? componentsProps?.button?.style
6888
+ },
6889
+ children: iconElement
6890
+ }, undefined, false, undefined, this)
6891
+ }, undefined, false, undefined, this),
6892
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Button, {
6826
6893
  onClick,
6827
6894
  loading,
6828
- size: size ? `input-${size}` : "input-sm",
6895
+ variant,
6896
+ size,
6829
6897
  color,
6898
+ leftSection: iconProp ? iconElement : undefined,
6830
6899
  ...componentsProps?.button,
6831
- ...componentsProps?.ActionIcon,
6832
- hiddenFrom: responsive === false ? undefined : breakpoint ?? "md",
6833
- display: responsive === false && collapsed !== true ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6834
- children: icon
6900
+ ...componentsProps?.Button,
6901
+ visibleFrom: !responsive ? undefined : breakpoint,
6902
+ display: !responsive && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6903
+ style: {
6904
+ ...transitionStyle,
6905
+ ...componentsProps?.Button?.style ?? componentsProps?.button?.style
6906
+ },
6907
+ children: label
6835
6908
  }, undefined, false, undefined, this)
6836
- }, undefined, false, undefined, this),
6837
- /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.Button, {
6838
- onClick,
6839
- loading,
6840
- variant: variant ?? "default",
6909
+ ]
6910
+ }, undefined, true, undefined, this)
6911
+ }, undefined, false, undefined, this);
6912
+ }
6913
+ // src/core/components/Controls/ControlButton/index.tsx
6914
+ var import_core15 = require("@mantine/core");
6915
+ var import_icons_react6 = require("@tabler/icons-react");
6916
+ var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
6917
+ function ControlButton({
6918
+ icon: Icon4 = import_icons_react6.IconClick,
6919
+ mounted = true,
6920
+ size = "xs",
6921
+ iconSize = "tiny" /* Tiny */,
6922
+ onClick,
6923
+ order,
6924
+ color,
6925
+ tooltip,
6926
+ componentsProps
6927
+ }) {
6928
+ const theme = useRemoraidTheme();
6929
+ return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.Transition, {
6930
+ mounted,
6931
+ transition: "pop-top-right",
6932
+ duration: theme.transitionDurations.short,
6933
+ timingFunction: "ease",
6934
+ ...componentsProps?.transition,
6935
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.Tooltip, {
6936
+ label: tooltip,
6937
+ disabled: !Boolean(tooltip),
6938
+ ...componentsProps?.tooltip,
6939
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.ActionIcon, {
6940
+ "data-control-button": true,
6841
6941
  size,
6842
6942
  color,
6843
- leftSection: props.icon ? icon : undefined,
6943
+ onClick,
6944
+ radius: "xl",
6844
6945
  ...componentsProps?.button,
6845
- ...componentsProps?.Button,
6846
- visibleFrom: responsive === false ? undefined : breakpoint ?? "md",
6847
- display: responsive === false && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6848
- children: label
6946
+ style: {
6947
+ ...transitionStyle,
6948
+ order,
6949
+ ...componentsProps?.button?.style
6950
+ },
6951
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Icon4, {
6952
+ ...theme.iconProps[iconSize],
6953
+ ...componentsProps?.icon
6954
+ }, undefined, false, undefined, this)
6849
6955
  }, undefined, false, undefined, this)
6956
+ }, undefined, false, undefined, this)
6957
+ }, undefined, false, undefined, this);
6958
+ }
6959
+
6960
+ // src/core/components/Controls/index.tsx
6961
+ var import_react14 = require("react");
6962
+ var import_core16 = require("@mantine/core");
6963
+ var import_icons_react7 = require("@tabler/icons-react");
6964
+ var import_lodash3 = __toESM(require_lodash());
6965
+ var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
6966
+ function Controls({
6967
+ groupRef,
6968
+ mounted = true,
6969
+ dragContainerRef,
6970
+ gutter = 5,
6971
+ iconSize = "tiny" /* Tiny */,
6972
+ additionalButtons: additionalButtonsProp,
6973
+ componentsProps,
6974
+ children: childrenProp
6975
+ }) {
6976
+ const additionalButtons = additionalButtonsProp?.map((additionalButton) => asElementOrPropsOfType(ControlButton, additionalButton, "Check the 'additionalButtons' property of 'Controls'."));
6977
+ const children = asChildrenOfType(ControlButton, childrenProp, "Check children passed to 'Controls' component.");
6978
+ const theme = useRemoraidTheme();
6979
+ const [pos, setPos] = import_react14.useState({
6980
+ x: 0,
6981
+ y: 0
6982
+ });
6983
+ const offsetRef = import_react14.useRef({ x: 0, y: 0 });
6984
+ const containerRef = import_react14.useRef(null);
6985
+ const clamp = (v, min, max) => {
6986
+ return Math.min(Math.max(v, min), max);
6987
+ };
6988
+ const handlePointerDown = (e) => {
6989
+ if (e.target instanceof Element && e.target.closest("button,[data-control-button]")) {
6990
+ return;
6991
+ }
6992
+ if (!containerRef.current) {
6993
+ return;
6994
+ }
6995
+ const paperRect = containerRef.current.getBoundingClientRect();
6996
+ offsetRef.current = {
6997
+ x: e.clientX - paperRect.right,
6998
+ y: e.clientY - paperRect.top
6999
+ };
7000
+ e.currentTarget.setPointerCapture(e.pointerId);
7001
+ };
7002
+ const handlePointerMove = (e) => {
7003
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
7004
+ return;
7005
+ }
7006
+ if (!containerRef.current || !dragContainerRef.current) {
7007
+ return;
7008
+ }
7009
+ const boxRect = dragContainerRef.current.getBoundingClientRect();
7010
+ const paperRect = containerRef.current.getBoundingClientRect();
7011
+ const rawX = e.clientX - boxRect.right - offsetRef.current.x;
7012
+ const rawY = e.clientY - boxRect.top - offsetRef.current.y;
7013
+ const maxX = boxRect.width - paperRect.width;
7014
+ const maxY = boxRect.height - paperRect.height;
7015
+ setPos({
7016
+ x: clamp(-rawX, 0, maxX),
7017
+ y: clamp(rawY, 0, maxY)
7018
+ });
7019
+ };
7020
+ const handlePointerUp = (e) => {
7021
+ e.currentTarget.releasePointerCapture(e.pointerId);
7022
+ };
7023
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Transition, {
7024
+ mounted,
7025
+ keepMounted: true,
7026
+ transition: "pop",
7027
+ duration: theme.transitionDurations.short,
7028
+ timingFunction: "ease",
7029
+ ...componentsProps?.transition,
7030
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Paper, {
7031
+ ref: containerRef,
7032
+ pos: "absolute",
7033
+ p: gutter,
7034
+ bg: theme.transparentBackground,
7035
+ shadow: "md",
7036
+ onPointerDown: handlePointerDown,
7037
+ onPointerMove: handlePointerMove,
7038
+ onPointerUp: handlePointerUp,
7039
+ ...componentsProps?.container,
7040
+ style: {
7041
+ right: pos.x,
7042
+ top: pos.y,
7043
+ ...import_lodash3.merge(transitionStyle, componentsProps?.container?.style)
7044
+ },
7045
+ className: clsx_default("remoraid-controls", componentsProps?.container?.className),
7046
+ children: /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Group, {
7047
+ gap: gutter,
7048
+ ref: groupRef,
7049
+ wrap: "nowrap",
7050
+ ...componentsProps?.group,
7051
+ className: clsx_default("remoraid-controls-group", componentsProps?.group?.className),
7052
+ children: [
7053
+ /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_icons_react7.IconGripHorizontal, {
7054
+ order: -100,
7055
+ color: "var(--mantine-color-default-border)",
7056
+ ...import_lodash3.merge(theme.iconProps[iconSize], componentsProps?.gripIcon)
7057
+ }, undefined, false, undefined, this),
7058
+ children,
7059
+ additionalButtons && additionalButtons.map((button, i) => {
7060
+ if (isValidElementOfType(ControlButton, button)) {
7061
+ return button;
7062
+ }
7063
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ControlButton, {
7064
+ ...button
7065
+ }, i, false, undefined, this);
7066
+ })
7067
+ ]
7068
+ }, undefined, true, undefined, this)
7069
+ }, undefined, false, undefined, this)
7070
+ }, undefined, false, undefined, this);
7071
+ }
7072
+ // src/core/components/Widget/WidgetWrapper/index.tsx
7073
+ var import_core18 = require("@mantine/core");
7074
+ var import_react16 = require("react");
7075
+ var import_icons_react9 = require("@tabler/icons-react");
7076
+
7077
+ // src/core/components/Pinnable/index.tsx
7078
+ var import_react15 = require("react");
7079
+ var import_icons_react8 = require("@tabler/icons-react");
7080
+ var import_core17 = require("@mantine/core");
7081
+ var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
7082
+ function Pinnable({
7083
+ layoutType: layoutTypeProp,
7084
+ section,
7085
+ initialValue = false,
7086
+ layoutId,
7087
+ controlsContainer,
7088
+ hidden = false,
7089
+ componentsProps,
7090
+ children
7091
+ }) {
7092
+ const layoutType = layoutTypeProp ?? "frame" /* Frame */;
7093
+ const { layouts } = useLayouts();
7094
+ const [pinned, setPinned] = import_react15.useState(initialValue);
7095
+ const containerRef = import_react15.useRef(null);
7096
+ const layout = layouts[layoutId ?? remoraidAppShellLayoutId];
7097
+ if (layout && layout.type !== layoutType) {
7098
+ throw new TypeError(`Prop 'layoutId' in '${Pinnable.name}' refers to a layout of type ${layout.type}, expected ${layoutType}. Leave 'layoutId' undefined, if you want to use the layout in '${AppShell_default.name}' as reference layout.`);
7099
+ }
7100
+ const controlButton = import_react15.useMemo(() => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ControlButton, {
7101
+ icon: pinned ? import_icons_react8.IconPinnedOff : import_icons_react8.IconPin,
7102
+ tooltip: pinned ? "Unpin" : "Pin",
7103
+ color: "green",
7104
+ order: 100,
7105
+ ...componentsProps?.button,
7106
+ onClick: (e) => {
7107
+ setPinned((p) => !p);
7108
+ componentsProps?.button?.onClick?.(e);
7109
+ }
7110
+ }, undefined, false, undefined, this), [pinned, componentsProps?.button]);
7111
+ const element = /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Box, {
7112
+ pos: "relative",
7113
+ ref: containerRef,
7114
+ "data-hidden": hidden,
7115
+ ...componentsProps?.container,
7116
+ className: clsx_default("remoraid-pinnable", componentsProps?.container?.className),
7117
+ children: [
7118
+ controlsContainer === undefined ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Controls, {
7119
+ dragContainerRef: containerRef,
7120
+ ...componentsProps?.controls,
7121
+ children: controlButton
7122
+ }, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Portal, {
7123
+ target: controlsContainer,
7124
+ children: controlButton
7125
+ }, undefined, false, undefined, this),
7126
+ children
6850
7127
  ]
6851
7128
  }, undefined, true, undefined, this);
7129
+ if (!layout) {
7130
+ return null;
7131
+ }
7132
+ if (pinned && layoutType === "frame" /* Frame */) {
7133
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(FrameLayout_default.Element, {
7134
+ layoutId,
7135
+ section,
7136
+ hidden,
7137
+ ...componentsProps?.layoutElement,
7138
+ children: element
7139
+ }, undefined, false, undefined, this);
7140
+ }
7141
+ return element;
6852
7142
  }
7143
+
6853
7144
  // src/core/components/Widget/WidgetWrapper/index.tsx
6854
- var import_core16 = require("@mantine/core");
6855
- var import_react12 = require("react");
6856
- var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
7145
+ var import_lodash4 = __toESM(require_lodash());
7146
+ var jsx_dev_runtime25 = require("react/jsx-dev-runtime");
6857
7147
  function WidgetWrapper({
6858
- children,
6859
7148
  config,
6860
- mt,
6861
- withCloseButton,
6862
- componentsProps
7149
+ mt = 0,
7150
+ withCloseButton = true,
7151
+ pinnableSection,
7152
+ componentsProps,
7153
+ children
6863
7154
  }) {
6864
7155
  const {
6865
7156
  isWidgetSelected,
6866
7157
  isPageRegistered,
6867
7158
  isWidgetRegistered,
6868
7159
  registerWidget,
6869
- updateActiveWidget
7160
+ updateActiveWidget,
7161
+ updateWidgetSelection,
7162
+ activeWidget
6870
7163
  } = useWidgets();
6871
7164
  const page = usePage();
6872
7165
  const theme = useRemoraidTheme();
7166
+ const mounted = page !== null && isWidgetSelected(page.pageId, config.widgetId);
7167
+ const [controlsContainer, setControlsContainer] = import_react16.useState(null);
7168
+ const [hidden, setHidden] = import_react16.useState(!mounted);
6873
7169
  const pageRegistered = page ? isPageRegistered(page.pageId) : false;
6874
- import_react12.useEffect(() => {
6875
- if (!page) {
6876
- return;
6877
- }
6878
- if (!isWidgetRegistered(page.pageId, config.widgetId)) {
6879
- registerWidget(page.pageId, config);
6880
- }
6881
- }, [pageRegistered]);
6882
- return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Transition, {
6883
- mounted: page !== null && isWidgetSelected(page.pageId, config.widgetId),
7170
+ const containerRef = import_react16.useRef(null);
7171
+ const controlsContainerRef = import_react16.useCallback((n) => {
7172
+ setControlsContainer(n);
7173
+ }, [setControlsContainer]);
7174
+ const handleEnter = () => {
7175
+ updateActiveWidget(config.widgetId);
7176
+ };
7177
+ const handleLeave = () => {
7178
+ updateActiveWidget(null);
7179
+ };
7180
+ let element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core18.Transition, {
7181
+ mounted,
6884
7182
  transition: "fade-left",
6885
7183
  duration: theme.transitionDurations.medium,
6886
7184
  timingFunction: "ease",
6887
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Paper, {
7185
+ ...componentsProps?.transition,
7186
+ onExited: () => {
7187
+ setHidden(true);
7188
+ componentsProps?.transition?.onExited?.();
7189
+ },
7190
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core18.Paper, {
7191
+ ref: containerRef,
6888
7192
  p: "md",
6889
7193
  shadow: "md",
6890
7194
  bg: theme.transparentBackground,
6891
- mt: mt || 0,
7195
+ mt,
6892
7196
  pos: "relative",
6893
7197
  h: "fit-content",
6894
7198
  ...componentsProps?.container,
6895
- style: { ...transitionStyle, ...componentsProps?.container?.style },
6896
- onMouseEnter: () => {
6897
- updateActiveWidget(config.widgetId);
7199
+ onMouseEnter: (e) => {
7200
+ if (!pinnableSection) {
7201
+ handleEnter();
7202
+ }
7203
+ componentsProps?.container?.onMouseEnter?.(e);
6898
7204
  },
6899
- onMouseLeave: () => {
6900
- updateActiveWidget(null);
7205
+ onMouseLeave: (e) => {
7206
+ if (!pinnableSection) {
7207
+ handleLeave();
7208
+ }
7209
+ componentsProps?.container?.onMouseLeave?.(e);
6901
7210
  },
7211
+ style: import_lodash4.merge(transitionStyle, componentsProps?.container?.style),
7212
+ id: config.widgetId,
6902
7213
  children: [
6903
- withCloseButton !== false && /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(CloseButton, {
6904
- widgetId: config.widgetId
7214
+ /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Controls, {
7215
+ dragContainerRef: containerRef,
7216
+ groupRef: controlsContainerRef,
7217
+ mounted: activeWidget === config.widgetId,
7218
+ ...componentsProps?.controls,
7219
+ children: /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(ControlButton, {
7220
+ mounted: withCloseButton,
7221
+ icon: import_icons_react9.IconX,
7222
+ tooltip: "Hide widget",
7223
+ color: "red",
7224
+ order: 200,
7225
+ ...componentsProps?.closeButton,
7226
+ onClick: (e) => {
7227
+ if (!page) {
7228
+ return;
7229
+ }
7230
+ updateWidgetSelection(page.pageId, config.widgetId, false);
7231
+ handleLeave();
7232
+ componentsProps?.closeButton?.onClick?.(e);
7233
+ }
7234
+ }, undefined, false, undefined, this)
6905
7235
  }, undefined, false, undefined, this),
6906
7236
  children
6907
7237
  ]
6908
7238
  }, undefined, true, undefined, this)
6909
7239
  }, undefined, false, undefined, this);
7240
+ if (pinnableSection !== undefined) {
7241
+ element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Pinnable, {
7242
+ section: pinnableSection,
7243
+ controlsContainer,
7244
+ hidden,
7245
+ ...componentsProps?.Pinnable,
7246
+ componentsProps: {
7247
+ ...componentsProps?.Pinnable?.componentsProps,
7248
+ container: {
7249
+ ...componentsProps?.Pinnable?.componentsProps?.container,
7250
+ onMouseEnter: (e) => {
7251
+ handleEnter();
7252
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseEnter?.(e);
7253
+ },
7254
+ onMouseLeave: (e) => {
7255
+ handleLeave();
7256
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseLeave?.(e);
7257
+ }
7258
+ },
7259
+ button: {
7260
+ ...componentsProps?.Pinnable?.componentsProps?.button,
7261
+ onClick: (e) => {
7262
+ handleLeave();
7263
+ componentsProps?.Pinnable?.componentsProps?.button?.onClick?.(e);
7264
+ }
7265
+ },
7266
+ layoutElement: {
7267
+ includeContainer: false,
7268
+ includePageContainer: pinnableSection === "top" /* Top */ || pinnableSection === "bottom" /* Bottom */,
7269
+ ...componentsProps?.Pinnable?.componentsProps?.layoutElement
7270
+ }
7271
+ },
7272
+ children: element
7273
+ }, undefined, false, undefined, this);
7274
+ }
7275
+ import_react16.useEffect(() => {
7276
+ if (!page) {
7277
+ return;
7278
+ }
7279
+ if (!isWidgetRegistered(page.pageId, config.widgetId)) {
7280
+ registerWidget(page.pageId, config);
7281
+ }
7282
+ }, [pageRegistered]);
7283
+ import_react16.useEffect(() => {
7284
+ if (mounted) {
7285
+ const id = requestAnimationFrame(() => {
7286
+ setHidden(false);
7287
+ });
7288
+ return () => {
7289
+ cancelAnimationFrame(id);
7290
+ };
7291
+ }
7292
+ }, [mounted]);
7293
+ return element;
6910
7294
  }
6911
- var WidgetWrapper_default = Object.assign(WidgetWrapper, {
6912
- CloseButton
6913
- });
6914
7295
  // src/core/components/Widget/index.tsx
6915
- var import_core17 = require("@mantine/core");
6916
- var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
7296
+ var import_core19 = require("@mantine/core");
7297
+ var jsx_dev_runtime26 = require("react/jsx-dev-runtime");
6917
7298
  var react2 = require("react");
6918
7299
  function Widget({
6919
- children,
6920
7300
  id,
6921
- config,
6922
7301
  title,
6923
- badges,
6924
- buttons,
6925
- alerts,
7302
+ config,
7303
+ badges: badgesProp,
7304
+ buttons: buttonsProp,
7305
+ alerts: alertsProp,
6926
7306
  gaps,
6927
7307
  loading,
6928
7308
  mt,
6929
- componentsProps
7309
+ pinnableSection,
7310
+ componentsProps,
7311
+ children
6930
7312
  }) {
7313
+ const buttons = buttonsProp?.map((button) => asElementOrPropsOfType(RemoraidButton, button, "Check the 'buttons' property of this widget."));
7314
+ const alerts = alertsProp?.map((alert) => asElementOrPropsOfType(AlertMinimal, alert, "Check the 'alerts' property of this widget."));
7315
+ const badges = badgesProp?.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check the 'badges' property of this widget."));
6931
7316
  const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
6932
7317
  const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
6933
7318
  const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
6934
- return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(WidgetWrapper_default, {
7319
+ return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(WidgetWrapper, {
6935
7320
  config: {
6936
7321
  widgetId: id,
6937
- name: title,
6938
- ...config
7322
+ ...config,
7323
+ initialValues: {
7324
+ name: title,
7325
+ ...config?.initialValues
7326
+ }
6939
7327
  },
6940
7328
  mt,
6941
- componentsProps: {
6942
- container: componentsProps?.container,
6943
- transition: componentsProps?.transition
6944
- },
6945
7329
  ...componentsProps?.wrapper,
7330
+ pinnableSection: pinnableSection ?? componentsProps?.wrapper?.pinnableSection,
6946
7331
  children: [
6947
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Group, {
7332
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Group, {
6948
7333
  justify: "space-between",
6949
7334
  wrap: "nowrap",
6950
7335
  children: [
6951
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Group, {
7336
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Group, {
6952
7337
  gap: badgesGap,
6953
7338
  wrap: "nowrap",
6954
7339
  children: [
6955
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Title, {
7340
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Title, {
6956
7341
  order: 1,
6957
7342
  size: "h3",
6958
7343
  lineClamp: 1,
6959
- children: title
7344
+ children: title ?? id
6960
7345
  }, undefined, false, undefined, this),
6961
- badges !== undefined && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(BadgeGroup, {
7346
+ badges !== undefined && /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(BadgeGroup, {
6962
7347
  badges,
6963
7348
  gap: badgesGap,
6964
7349
  ...componentsProps?.badgeGroup
6965
7350
  }, undefined, false, undefined, this)
6966
7351
  ]
6967
7352
  }, undefined, true, undefined, this),
6968
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Group, {
7353
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Group, {
6969
7354
  gap: buttonsGap,
6970
7355
  wrap: "nowrap",
6971
- children: buttons !== undefined && buttons.map((e, i) => {
6972
- if (isRemoraidButtonProps(e)) {
6973
- return /* @__PURE__ */ react2.createElement(RemoraidButton, {
6974
- ...e,
6975
- key: i
6976
- });
7356
+ children: buttons !== undefined && buttons.map((button, i) => {
7357
+ if (isValidElementOfType(RemoraidButton, button)) {
7358
+ return button;
6977
7359
  }
6978
- return e;
7360
+ return /* @__PURE__ */ react2.createElement(RemoraidButton, {
7361
+ ...button,
7362
+ key: i
7363
+ });
6979
7364
  })
6980
7365
  }, undefined, false, undefined, this)
6981
7366
  ]
6982
7367
  }, undefined, true, undefined, this),
6983
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Divider, {
6984
- my: "md"
7368
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Divider, {
7369
+ my: "md",
7370
+ ...componentsProps?.divider
6985
7371
  }, undefined, false, undefined, this),
6986
- alerts !== undefined && alerts.map((a, i) => {
6987
- if (isAlertMinimalProps(a)) {
7372
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Stack, {
7373
+ align: "stretch",
7374
+ gap: alertsGap,
7375
+ mb: alerts && alerts.length > 0 ? "md" : 0,
7376
+ ...componentsProps?.alertsContainer,
7377
+ children: alerts?.map((alert, i) => {
7378
+ if (isValidElementOfType(AlertMinimal, alert)) {
7379
+ return alert;
7380
+ }
6988
7381
  return /* @__PURE__ */ react2.createElement(AlertMinimal, {
6989
- ...a,
6990
- mb: alertsGap,
7382
+ ...alert,
6991
7383
  key: i
6992
7384
  });
6993
- }
6994
- return a;
6995
- }),
6996
- loading ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Center, {
6997
- children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Loader, {
7385
+ })
7386
+ }, undefined, false, undefined, this),
7387
+ loading ? /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Center, {
7388
+ children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Loader, {
6998
7389
  ...componentsProps?.loader
6999
7390
  }, undefined, false, undefined, this)
7000
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
7391
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(jsx_dev_runtime26.Fragment, {
7001
7392
  children
7002
7393
  }, undefined, false, undefined, this)
7003
7394
  ]
7004
7395
  }, undefined, true, undefined, this);
7005
7396
  }
7006
7397
  // src/core/components/NotFoundPage/index.tsx
7007
- var import_core18 = require("@mantine/core");
7398
+ var import_core20 = require("@mantine/core");
7008
7399
  var import_navigation3 = require("next/navigation");
7009
- var jsx_dev_runtime25 = require("react/jsx-dev-runtime");
7400
+ var jsx_dev_runtime27 = require("react/jsx-dev-runtime");
7010
7401
  function NotFoundPage({
7011
7402
  children,
7012
7403
  message,
@@ -7014,11 +7405,11 @@ function NotFoundPage({
7014
7405
  }) {
7015
7406
  const pathname = import_navigation3.usePathname();
7016
7407
  const theme = useRemoraidTheme();
7017
- return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Page, {
7408
+ return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Page, {
7018
7409
  name: "Not Found",
7019
7410
  ...componentsProps?.page,
7020
7411
  children: [
7021
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core18.Alert, {
7412
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(import_core20.Alert, {
7022
7413
  ...theme.alertProps.negative,
7023
7414
  title: "404 - Page Not Found",
7024
7415
  children: message ?? `Could not find page ${pathname}.`
@@ -7028,8 +7419,8 @@ function NotFoundPage({
7028
7419
  }, undefined, true, undefined, this);
7029
7420
  }
7030
7421
  // src/core/components/EnvironmentShell/index.tsx
7031
- var import_core19 = require("@mantine/core");
7032
- var jsx_dev_runtime26 = require("react/jsx-dev-runtime");
7422
+ var import_core21 = require("@mantine/core");
7423
+ var jsx_dev_runtime28 = require("react/jsx-dev-runtime");
7033
7424
  function EnvironmentShell({
7034
7425
  children,
7035
7426
  environment,
@@ -7043,7 +7434,7 @@ function EnvironmentShell({
7043
7434
  const undefinedKeys = Object.keys(environment).filter((key) => environment[key] === undefined);
7044
7435
  const alertTitle = `Please Specify Environment Variable${undefinedKeys.length > 1 ? "s" : ""}`;
7045
7436
  const alertMessage = `Components could not be rendered because the following environment variables are not specified: ${undefinedKeys.join(", ")}.`;
7046
- const alert = /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Alert, {
7437
+ const alert = /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(import_core21.Alert, {
7047
7438
  ...theme.alertProps.neutral,
7048
7439
  title: alertTitle,
7049
7440
  m,
@@ -7051,12 +7442,12 @@ function EnvironmentShell({
7051
7442
  children: message ?? alertMessage
7052
7443
  }, undefined, false, undefined, this);
7053
7444
  if (undefinedKeys.length === 0) {
7054
- return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(jsx_dev_runtime26.Fragment, {
7445
+ return /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(jsx_dev_runtime28.Fragment, {
7055
7446
  children
7056
7447
  }, undefined, false, undefined, this);
7057
7448
  }
7058
7449
  if (withContainer) {
7059
- return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(PageContainer, {
7450
+ return /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(PageContainer, {
7060
7451
  componentsProps: { container: componentsProps?.container },
7061
7452
  children: alert
7062
7453
  }, undefined, false, undefined, this);
@@ -7064,22 +7455,22 @@ function EnvironmentShell({
7064
7455
  return alert;
7065
7456
  }
7066
7457
  // src/core/components/SettingsWidget/index.tsx
7067
- var import_react13 = require("react");
7068
- var import_icons_react8 = require("@tabler/icons-react");
7458
+ var import_react17 = require("react");
7459
+ var import_icons_react11 = require("@tabler/icons-react");
7069
7460
 
7070
7461
  // src/core/components/SettingsWidget/SaveButton/index.tsx
7071
- var import_icons_react7 = require("@tabler/icons-react");
7072
- var import_core20 = require("@mantine/core");
7073
- var jsx_dev_runtime27 = require("react/jsx-dev-runtime");
7462
+ var import_icons_react10 = require("@tabler/icons-react");
7463
+ var import_core22 = require("@mantine/core");
7464
+ var jsx_dev_runtime29 = require("react/jsx-dev-runtime");
7074
7465
  function SaveButton({
7075
7466
  onSaveChanges,
7076
7467
  insideContainer,
7077
7468
  componentsProps
7078
7469
  }) {
7079
7470
  const settingsWidgetOptions = useSettingsWidgetContext();
7080
- const button = /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(RemoraidButton, {
7471
+ const button = /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(RemoraidButton, {
7081
7472
  label: "Save Changes",
7082
- icon: import_icons_react7.IconDeviceFloppy,
7473
+ icon: import_icons_react10.IconDeviceFloppy,
7083
7474
  onClick: onSaveChanges,
7084
7475
  responsive: false,
7085
7476
  ...componentsProps?.button,
@@ -7092,7 +7483,7 @@ function SaveButton({
7092
7483
  }
7093
7484
  }, undefined, false, undefined, this);
7094
7485
  if (insideContainer !== false) {
7095
- return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(import_core20.Group, {
7486
+ return /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core22.Group, {
7096
7487
  w: "100%",
7097
7488
  justify: "flex-end",
7098
7489
  mt: "md",
@@ -7104,11 +7495,11 @@ function SaveButton({
7104
7495
  }
7105
7496
 
7106
7497
  // src/core/components/SettingsWidget/index.tsx
7107
- var jsx_dev_runtime28 = require("react/jsx-dev-runtime");
7498
+ var jsx_dev_runtime30 = require("react/jsx-dev-runtime");
7108
7499
  var defaultSettingsWidgetContext = {};
7109
- var settingsWidgetContext = import_react13.createContext(defaultSettingsWidgetContext);
7500
+ var settingsWidgetContext = import_react17.createContext(defaultSettingsWidgetContext);
7110
7501
  var useSettingsWidgetContext = () => {
7111
- return import_react13.useContext(settingsWidgetContext);
7502
+ return import_react17.useContext(settingsWidgetContext);
7112
7503
  };
7113
7504
  function SettingsWidget({
7114
7505
  children,
@@ -7117,9 +7508,9 @@ function SettingsWidget({
7117
7508
  custom,
7118
7509
  widgetProps
7119
7510
  }) {
7120
- return /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(settingsWidgetContext.Provider, {
7511
+ return /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(settingsWidgetContext.Provider, {
7121
7512
  value: { custom, unsavedChanges },
7122
- children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Widget, {
7513
+ children: /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(Widget, {
7123
7514
  title: "Settings",
7124
7515
  id: "settings",
7125
7516
  mt: "md",
@@ -7128,7 +7519,7 @@ function SettingsWidget({
7128
7519
  ...onRestoreDefaultValues ? [
7129
7520
  {
7130
7521
  label: "Restore Default Values",
7131
- icon: import_icons_react8.IconRestore,
7522
+ icon: import_icons_react11.IconRestore,
7132
7523
  onClick: onRestoreDefaultValues,
7133
7524
  componentsProps: { button: { disabled: custom === false } }
7134
7525
  }
@@ -7155,27 +7546,27 @@ var SettingsWidget_default = Object.assign(SettingsWidget, {
7155
7546
  SaveButton
7156
7547
  });
7157
7548
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7158
- var import_react14 = require("react");
7159
- var import_core22 = require("@mantine/core");
7549
+ var import_react18 = require("react");
7550
+ var import_core24 = require("@mantine/core");
7160
7551
 
7161
7552
  // src/core/components/SettingsWidget/SettingsTable/Row/index.tsx
7162
- var import_core21 = require("@mantine/core");
7163
- var jsx_dev_runtime29 = require("react/jsx-dev-runtime");
7553
+ var import_core23 = require("@mantine/core");
7554
+ var jsx_dev_runtime31 = require("react/jsx-dev-runtime");
7164
7555
  function Row({
7165
7556
  children,
7166
7557
  label
7167
7558
  }) {
7168
7559
  const options = useSettingsTableOptions();
7169
- return /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Table.Tr, {
7560
+ return /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Table.Tr, {
7170
7561
  children: [
7171
- /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Table.Th, {
7562
+ /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Table.Th, {
7172
7563
  w: options.leftColumnWidth,
7173
- children: /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Text, {
7564
+ children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Text, {
7174
7565
  size: "sm",
7175
7566
  children: label
7176
7567
  }, undefined, false, undefined, this)
7177
7568
  }, undefined, false, undefined, this),
7178
- /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Table.Td, {
7569
+ /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Table.Td, {
7179
7570
  py: "xs",
7180
7571
  children
7181
7572
  }, undefined, false, undefined, this)
@@ -7184,29 +7575,30 @@ function Row({
7184
7575
  }
7185
7576
 
7186
7577
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7187
- var jsx_dev_runtime30 = require("react/jsx-dev-runtime");
7578
+ var jsx_dev_runtime32 = require("react/jsx-dev-runtime");
7188
7579
  var defaultSettingsTableOptions = {
7189
7580
  leftColumnWidth: "38.2%"
7190
7581
  };
7191
- var settingsTableOptionsContext = import_react14.createContext(defaultSettingsTableOptions);
7582
+ var settingsTableOptionsContext = import_react18.createContext(defaultSettingsTableOptions);
7192
7583
  var useSettingsTableOptions = () => {
7193
- return import_react14.useContext(settingsTableOptionsContext);
7584
+ return import_react18.useContext(settingsTableOptionsContext);
7194
7585
  };
7195
7586
  function SettingsTable({
7196
- children,
7197
- leftColumnWidth
7587
+ leftColumnWidth,
7588
+ children: childrenProp
7198
7589
  }) {
7590
+ const children = asChildrenOfType(Row, childrenProp, "Check children passed to 'SettingsTable' component.");
7199
7591
  const theme = useRemoraidTheme();
7200
- return /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(settingsTableOptionsContext.Provider, {
7592
+ return /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(settingsTableOptionsContext.Provider, {
7201
7593
  value: {
7202
7594
  leftColumnWidth: leftColumnWidth ?? defaultSettingsTableOptions.leftColumnWidth
7203
7595
  },
7204
- children: /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(import_core22.Table, {
7596
+ children: /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(import_core24.Table, {
7205
7597
  bg: theme.transparentBackground,
7206
7598
  withTableBorder: true,
7207
7599
  variant: "vertical",
7208
7600
  layout: "fixed",
7209
- children: /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(import_core22.Table.Tbody, {
7601
+ children: /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(import_core24.Table.Tbody, {
7210
7602
  children
7211
7603
  }, undefined, false, undefined, this)
7212
7604
  }, undefined, false, undefined, this)
@@ -7216,21 +7608,21 @@ var SettingsTable_default = Object.assign(SettingsTable, {
7216
7608
  Row
7217
7609
  });
7218
7610
  // src/core/components/NavbarSettingsWidget/index.tsx
7219
- var import_react15 = require("react");
7220
- var import_lodash = __toESM(require_lodash());
7221
- var import_core23 = require("@mantine/core");
7222
- var import_icons_react9 = require("@tabler/icons-react");
7223
- var jsx_dev_runtime31 = require("react/jsx-dev-runtime");
7611
+ var import_lodash5 = __toESM(require_lodash());
7612
+ var import_core25 = require("@mantine/core");
7613
+ var import_icons_react12 = require("@tabler/icons-react");
7614
+ var jsx_dev_runtime33 = require("react/jsx-dev-runtime");
7224
7615
  var defaultNavbarSettingsWidgetId = "navbar-settings";
7225
7616
  function NavbarSettingsWidget({
7226
- additionalRows,
7617
+ additionalRows: additionalRowsProp,
7227
7618
  widgetProps,
7228
7619
  componentsProps
7229
7620
  }) {
7621
+ const additionalRows = additionalRowsProp?.map((additionalRow) => asElementOrPropsOfType(SettingsTable_default.Row, additionalRow, "Check the 'additionalRows' property of 'NavbarSettingsWidget'."));
7230
7622
  const { userExperience, updateUserExperience, initialUserExperience } = useRemoraidUserExperience();
7231
7623
  const app = useRemoraidApp();
7232
7624
  const theme = useRemoraidTheme();
7233
- return /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsWidget_default, {
7625
+ return /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsWidget_default, {
7234
7626
  widgetProps: {
7235
7627
  id: defaultNavbarSettingsWidgetId,
7236
7628
  title: "Navbar Settings",
@@ -7242,12 +7634,13 @@ function NavbarSettingsWidget({
7242
7634
  navbar: initialUserExperience.navbar
7243
7635
  }));
7244
7636
  },
7245
- custom: !import_lodash.isEqual(userExperience.navbar, initialUserExperience.navbar),
7246
- children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsTable_default, {
7637
+ custom: !import_lodash5.isEqual(userExperience.navbar, initialUserExperience.navbar),
7638
+ children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default, {
7639
+ ...componentsProps?.table,
7247
7640
  children: [
7248
- /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsTable_default.Row, {
7641
+ /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default.Row, {
7249
7642
  label: "Select which pages you want to display or hide",
7250
- children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Chip.Group, {
7643
+ children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(import_core25.Chip.Group, {
7251
7644
  multiple: true,
7252
7645
  value: app.navigablePages.filter((p) => !userExperience.navbar.hiddenPages.includes(p.href)).map((p) => p.href),
7253
7646
  onChange: (newValue) => {
@@ -7259,12 +7652,12 @@ function NavbarSettingsWidget({
7259
7652
  }
7260
7653
  }));
7261
7654
  },
7262
- children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Group, {
7655
+ children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(import_core25.Group, {
7263
7656
  justify: "flex-start",
7264
7657
  gap: "xs",
7265
- children: app.navigablePages.map((p) => ({ ...p, icon: p.icon ?? import_icons_react9.IconLink })).map((p, i) => /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Chip, {
7658
+ children: app.navigablePages.map((p) => ({ ...p, icon: p.icon ?? import_icons_react12.IconLink })).map((p, i) => /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(import_core25.Chip, {
7266
7659
  value: p.href,
7267
- icon: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(p.icon, {
7660
+ icon: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(p.icon, {
7268
7661
  ...theme.iconProps.tiny,
7269
7662
  color: theme.primaryColor
7270
7663
  }, undefined, false, undefined, this),
@@ -7274,9 +7667,57 @@ function NavbarSettingsWidget({
7274
7667
  }, undefined, false, undefined, this)
7275
7668
  }, undefined, false, undefined, this)
7276
7669
  }, "select-hidden-pages", false, undefined, this),
7277
- ...(additionalRows ?? []).map((row, i) => row.key ? row : import_react15.cloneElement(row, { key: i }))
7278
- ],
7279
- ...componentsProps?.table
7280
- }, undefined, false, undefined, this)
7670
+ additionalRows && additionalRows.map((row, i) => {
7671
+ if (isValidElementOfType(SettingsTable_default.Row, row)) {
7672
+ return row;
7673
+ }
7674
+ return /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default.Row, {
7675
+ ...row
7676
+ }, i, false, undefined, this);
7677
+ })
7678
+ ]
7679
+ }, undefined, true, undefined, this)
7281
7680
  }, undefined, false, undefined, this);
7282
7681
  }
7682
+ // src/core/components/ContextClusterProvider/index.tsx
7683
+ var import_react19 = __toESM(require("react"));
7684
+ var jsx_dev_runtime34 = require("react/jsx-dev-runtime");
7685
+ var createContextCluster = (generalDefaultValue, staticIds) => {
7686
+ const isStaticId = (id) => {
7687
+ if (staticIds?.find((staticId) => staticId === id)) {
7688
+ return true;
7689
+ }
7690
+ return false;
7691
+ };
7692
+ const contexts = {};
7693
+ const defaultValues = {};
7694
+ const createContext8 = (id, defaultValue) => {
7695
+ const context = import_react19.default.createContext(defaultValue ?? generalDefaultValue);
7696
+ contexts[id] = context;
7697
+ defaultValues[id] = defaultValue ?? generalDefaultValue;
7698
+ return context;
7699
+ };
7700
+ const useContext11 = (id) => {
7701
+ if (isStaticId(id)) {
7702
+ return contexts[id] ? import_react19.default.useContext(contexts[id]) : generalDefaultValue;
7703
+ }
7704
+ return contexts[id] ? import_react19.default.useContext(contexts[id]) : null;
7705
+ };
7706
+ return {
7707
+ contexts,
7708
+ defaultValues,
7709
+ generalDefaultValue,
7710
+ createContext: createContext8,
7711
+ useContext: useContext11
7712
+ };
7713
+ };
7714
+ function ContextClusterProvider({
7715
+ cluster,
7716
+ values = {},
7717
+ children
7718
+ }) {
7719
+ return Object.entries(cluster.contexts).reduceRight((t, [id, context]) => context ? /* @__PURE__ */ jsx_dev_runtime34.jsxDEV(context.Provider, {
7720
+ value: values[id] ?? cluster.defaultValues[id] ?? cluster.generalDefaultValue,
7721
+ children: t
7722
+ }, undefined, false, undefined, this) : t, children);
7723
+ }