remoraid 2.14.7 → 2.19.4

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 Stack4(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
- Stack4.prototype.clear = stackClear;
1039
- Stack4.prototype["delete"] = stackDelete;
1040
- Stack4.prototype.get = stackGet;
1041
- Stack4.prototype.has = stackHas;
1042
- Stack4.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 Stack4);
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 Stack4);
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 Stack4);
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 Stack4);
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 Stack4;
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 Stack4);
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,18 +5472,17 @@ __export(exports_core, {
5471
5472
  useHydrationStatus: () => useHydrationStatus,
5472
5473
  useHydratedMantineColorScheme: () => useHydratedMantineColorScheme,
5473
5474
  useFrameLayout: () => useFrameLayout,
5475
+ remoraidAppShellLayoutId: () => remoraidAppShellLayoutId,
5474
5476
  isValidElementOfType: () => isValidElementOfType,
5475
- isFrameLayout: () => isFrameLayout,
5476
5477
  getElementTypeName: () => getElementTypeName,
5478
+ getDefaultWidgetContext: () => getDefaultWidgetContext,
5477
5479
  defaultUserExperienceCookieName: () => defaultUserExperienceCookieName,
5478
5480
  defaultUserExperience: () => defaultUserExperience,
5479
5481
  defaultSettingsWidgetOptions: () => defaultSettingsWidgetContext,
5480
5482
  defaultSettingsTableOptions: () => defaultSettingsTableOptions,
5481
5483
  defaultNavbarSettingsWidgetId: () => defaultNavbarSettingsWidgetId,
5482
5484
  defaultLayoutsContext: () => defaultLayoutsContext,
5483
- defaultFrameLayoutContext: () => defaultFrameLayoutContext,
5484
5485
  defaultAppShellNavbarPositions: () => defaultAppShellNavbarPositions,
5485
- defaultAppShellLayoutId: () => defaultAppShellLayoutId,
5486
5486
  defaultAppShellFooterPositions: () => defaultAppShellFooterPositions,
5487
5487
  defaultAppContext: () => defaultAppContext,
5488
5488
  createUserExperienceContext: () => createUserExperienceContext,
@@ -5492,7 +5492,7 @@ __export(exports_core, {
5492
5492
  asElementOrPropsOfType: () => asElementOrPropsOfType,
5493
5493
  asElementOfType: () => asElementOfType,
5494
5494
  asChildrenOfType: () => asChildrenOfType,
5495
- WidgetWrapper: () => WidgetWrapper_default,
5495
+ WidgetWrapper: () => WidgetWrapper,
5496
5496
  WidgetSelectionHeader: () => WidgetSelectionHeader,
5497
5497
  Widget: () => Widget,
5498
5498
  UserExperienceProviderWrapper: () => UserExperienceProviderWrapper,
@@ -5504,6 +5504,7 @@ __export(exports_core, {
5504
5504
  RemoraidIconSize: () => RemoraidIconSize,
5505
5505
  RemoraidButton: () => RemoraidButton,
5506
5506
  RemoraidBreakpoint: () => RemoraidBreakpoint,
5507
+ Pinnable: () => Pinnable,
5507
5508
  PageContainer: () => PageContainer,
5508
5509
  Page: () => Page,
5509
5510
  NotFoundPage: () => NotFoundPage,
@@ -5511,11 +5512,12 @@ __export(exports_core, {
5511
5512
  NavbarSettingsWidget: () => NavbarSettingsWidget,
5512
5513
  LayoutType: () => LayoutType,
5513
5514
  HydrationStatusProvider: () => HydrationStatusProvider,
5514
- FrameLayoutVariant: () => FrameLayoutVariant,
5515
5515
  FrameLayoutSection: () => FrameLayoutSection,
5516
5516
  FrameLayout: () => FrameLayout_default,
5517
5517
  FooterVariant: () => FooterVariant,
5518
5518
  EnvironmentShell: () => EnvironmentShell,
5519
+ Controls: () => Controls,
5520
+ ControlButton: () => ControlButton,
5519
5521
  ContextClusterProvider: () => ContextClusterProvider,
5520
5522
  BadgeMinimal: () => BadgeMinimal,
5521
5523
  BadgeGroup: () => BadgeGroup,
@@ -5529,6 +5531,11 @@ module.exports = __toCommonJS(exports_core);
5529
5531
  // src/core/components/RemoraidProvider/WidgetsProvider/index.tsx
5530
5532
  var import_react = __toESM(require("react"));
5531
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
+ });
5532
5539
  var widgetsContext = import_react.default.createContext({
5533
5540
  widgets: {},
5534
5541
  activeWidget: null,
@@ -5544,6 +5551,10 @@ var widgetsContext = import_react.default.createContext({
5544
5551
  var useWidgets = () => {
5545
5552
  return import_react.useContext(widgetsContext);
5546
5553
  };
5554
+ var useWidget = (pageId, widgetId) => {
5555
+ const { widgets } = useWidgets();
5556
+ return widgets?.[pageId]?.[widgetId] ?? null;
5557
+ };
5547
5558
  function WidgetsProvider({
5548
5559
  children
5549
5560
  }) {
@@ -5589,13 +5600,10 @@ function WidgetsProvider({
5589
5600
  const registerPage = (pageId, initialWidgets) => {
5590
5601
  setWidgets((prev) => ({
5591
5602
  ...prev,
5592
- [pageId]: initialWidgets.reduce((t, w) => {
5603
+ [pageId]: initialWidgets.reduce((t, widget) => {
5593
5604
  return {
5594
5605
  ...t,
5595
- [w.widgetId]: {
5596
- name: w.name,
5597
- selected: w.initialValue === undefined ? true : w.initialValue
5598
- }
5606
+ [widget.widgetId]: getDefaultWidgetContext(widget)
5599
5607
  };
5600
5608
  }, {})
5601
5609
  }));
@@ -5619,10 +5627,7 @@ function WidgetsProvider({
5619
5627
  ...prev,
5620
5628
  [pageId]: {
5621
5629
  ...prev[pageId],
5622
- [widget.widgetId]: {
5623
- name: widget.name,
5624
- selected: widget.initialValue === undefined ? true : widget.initialValue
5625
- }
5630
+ [widget.widgetId]: getDefaultWidgetContext(widget)
5626
5631
  }
5627
5632
  }));
5628
5633
  };
@@ -5701,11 +5706,6 @@ var FrameLayoutSection;
5701
5706
  FrameLayoutSection2["Right"] = "right";
5702
5707
  FrameLayoutSection2["Content"] = "content";
5703
5708
  })(FrameLayoutSection ||= {});
5704
- var FrameLayoutVariant;
5705
- ((FrameLayoutVariant2) => {
5706
- FrameLayoutVariant2["Plain"] = "plain";
5707
- FrameLayoutVariant2["Sticky"] = "sticky";
5708
- })(FrameLayoutVariant ||= {});
5709
5709
 
5710
5710
  // src/core/lib/utils.ts
5711
5711
  var import_react2 = require("react");
@@ -5872,7 +5872,8 @@ var createRemoraidTheme = (customTheme, dependencies) => {
5872
5872
  stroke: 3,
5873
5873
  ...customTheme?.iconProps?.tiny
5874
5874
  }
5875
- }
5875
+ },
5876
+ primaryGutter: "md"
5876
5877
  };
5877
5878
  };
5878
5879
  var themeContext = import_react4.default.createContext(createRemoraidTheme());
@@ -6047,7 +6048,7 @@ function RemoraidProvider({
6047
6048
  }, undefined, false, undefined, this);
6048
6049
  }
6049
6050
  // src/core/components/AppShell/index.tsx
6050
- var import_core7 = require("@mantine/core");
6051
+ var import_core8 = require("@mantine/core");
6051
6052
 
6052
6053
  // src/core/components/AppShell/NavbarMinimal/index.tsx
6053
6054
  var import_core3 = require("@mantine/core");
@@ -6253,7 +6254,6 @@ function FooterMinimal({
6253
6254
  return /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_core4.Group, {
6254
6255
  justify: "center",
6255
6256
  w: "100%",
6256
- py: "md",
6257
6257
  ...componentsProps?.container,
6258
6258
  children: /* @__PURE__ */ jsx_dev_runtime10.jsxDEV(import_icons_react3.IconPennant, {
6259
6259
  size: 50,
@@ -6264,274 +6264,319 @@ function FooterMinimal({
6264
6264
  }
6265
6265
 
6266
6266
  // src/core/components/FrameLayout/index.tsx
6267
- var import_core6 = require("@mantine/core");
6267
+ var import_core7 = require("@mantine/core");
6268
6268
  var import_react10 = require("react");
6269
6269
 
6270
6270
  // src/core/components/FrameLayout/Element/index.tsx
6271
+ var import_core6 = require("@mantine/core");
6272
+
6273
+ // src/core/lib/errors.ts
6274
+ class InvalidComponentUsageError extends Error {
6275
+ constructor(component, rule) {
6276
+ super(`Invalid usage of '${component}': ${rule}`);
6277
+ this.name = "InvalidComponentUsageError";
6278
+ }
6279
+ }
6280
+
6281
+ // src/core/components/Page/PageContainer/index.tsx
6271
6282
  var import_core5 = require("@mantine/core");
6283
+
6284
+ // node_modules/clsx/dist/clsx.mjs
6285
+ function r(e) {
6286
+ var t, f, n = "";
6287
+ if (typeof e == "string" || typeof e == "number")
6288
+ n += e;
6289
+ else if (typeof e == "object")
6290
+ if (Array.isArray(e)) {
6291
+ var o = e.length;
6292
+ for (t = 0;t < o; t++)
6293
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
6294
+ } else
6295
+ for (f in e)
6296
+ e[f] && (n && (n += " "), n += f);
6297
+ return n;
6298
+ }
6299
+ function clsx() {
6300
+ for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
6301
+ (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
6302
+ return n;
6303
+ }
6304
+ var clsx_default = clsx;
6305
+
6306
+ // src/core/components/Page/PageContainer/index.tsx
6272
6307
  var jsx_dev_runtime11 = require("react/jsx-dev-runtime");
6273
- function Element({
6308
+ function PageContainer({
6309
+ children,
6310
+ p = 0,
6311
+ hidden = false,
6312
+ componentsProps
6313
+ }) {
6314
+ const theme = useRemoraidTheme();
6315
+ return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core5.Container, {
6316
+ size: theme.containerSize,
6317
+ p,
6318
+ w: "100%",
6319
+ "data-hidden": hidden,
6320
+ ...componentsProps?.container,
6321
+ className: clsx_default("remoraid-page-container", componentsProps?.container?.className),
6322
+ children
6323
+ }, undefined, false, undefined, this);
6324
+ }
6325
+
6326
+ // src/core/components/FrameLayout/Element/index.tsx
6327
+ var import_lodash = __toESM(require_lodash());
6328
+ var jsx_dev_runtime12 = require("react/jsx-dev-runtime");
6329
+ function Element2({
6274
6330
  section,
6275
6331
  includeContainer = true,
6332
+ includePageContainer = false,
6276
6333
  layoutId,
6334
+ hidden = false,
6277
6335
  componentsProps,
6278
6336
  children
6279
6337
  }) {
6280
6338
  const { layouts } = useLayouts();
6281
6339
  const closestLayout = useFrameLayout();
6282
- if (closestLayout.layoutId === null) {
6283
- return null;
6340
+ if (!closestLayout) {
6341
+ throw new InvalidComponentUsageError("FrameLayout.Element", "must be used as child of 'FrameLayout'.");
6284
6342
  }
6285
6343
  const layout = layouts[layoutId ?? closestLayout.layoutId];
6286
- if (!isFrameLayout(layout)) {
6344
+ if (!layout) {
6287
6345
  return null;
6288
6346
  }
6289
- if (layout.sections[section] === null) {
6347
+ if (layout.type !== "frame" /* Frame */) {
6348
+ 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.");
6349
+ }
6350
+ if (!layout.sections[section]) {
6290
6351
  return null;
6291
6352
  }
6292
6353
  let containerProps = {};
6293
6354
  if (section === "left" /* Left */ || section === "right" /* Right */) {
6294
6355
  containerProps.h = "100%";
6295
6356
  }
6296
- return /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core5.Portal, {
6357
+ const element = includePageContainer ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(PageContainer, {
6358
+ p: 0,
6359
+ hidden,
6360
+ ...componentsProps?.PageContainer,
6361
+ children
6362
+ }, undefined, false, undefined, this) : children;
6363
+ return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Portal, {
6297
6364
  target: layout.sections[section],
6298
- children: includeContainer ? /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(import_core5.Box, {
6299
- ...containerProps,
6300
- ...componentsProps?.container,
6301
- children
6302
- }, undefined, false, undefined, this) : children
6365
+ children: includeContainer ? /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Box, {
6366
+ "data-hidden": hidden,
6367
+ ...import_lodash.merge(containerProps, componentsProps?.container),
6368
+ className: clsx_default("remoraid-frame-layout-element", containerProps?.className, componentsProps?.container?.className),
6369
+ children: element
6370
+ }, undefined, false, undefined, this) : element
6303
6371
  }, undefined, false, undefined, this);
6304
6372
  }
6305
6373
 
6306
6374
  // src/core/components/FrameLayout/index.tsx
6307
- var jsx_dev_runtime12 = require("react/jsx-dev-runtime");
6308
- var isFrameLayout = (layout) => {
6309
- if (typeof layout !== "object" || layout === null) {
6310
- return false;
6311
- }
6312
- if (!("sections" in layout)) {
6313
- return false;
6314
- }
6315
- if (typeof layout.sections !== "object" || layout.sections === null) {
6316
- return false;
6317
- }
6318
- return true;
6319
- };
6320
- var defaultFrameLayoutVariant = "sticky" /* Sticky */;
6321
- var defaultFrameLayoutContext = {
6322
- layoutId: null,
6323
- layout: {
6324
- sections: {
6325
- ["top" /* Top */]: null,
6326
- ["bottom" /* Bottom */]: null,
6327
- ["left" /* Left */]: null,
6328
- ["right" /* Right */]: null
6329
- }
6330
- },
6331
- setLayout: () => {}
6332
- };
6333
- var layoutContext = import_react10.createContext(defaultFrameLayoutContext);
6375
+ var jsx_dev_runtime13 = require("react/jsx-dev-runtime");
6376
+ var layoutContext = import_react10.createContext(null);
6334
6377
  var useFrameLayout = () => {
6335
6378
  return import_react10.useContext(layoutContext);
6336
6379
  };
6337
6380
  function FrameLayout({
6338
- variant = defaultFrameLayoutVariant,
6339
6381
  layoutId,
6382
+ includeScrollArea = true,
6383
+ gutter = 0,
6340
6384
  componentsProps,
6341
6385
  children
6342
6386
  }) {
6343
6387
  const theme = useRemoraidTheme();
6344
6388
  const { layouts, setLayouts } = useLayouts();
6345
6389
  const layout = layouts[layoutId];
6346
- const setLayout = import_react10.useMemo(() => {
6347
- return (value) => {
6348
- setLayouts((prev) => ({
6349
- ...prev,
6350
- [layoutId]: typeof value === "function" ? value(prev[layoutId]) : value
6351
- }));
6352
- };
6353
- }, [layoutId, setLayouts]);
6354
- const topSection = import_react10.useCallback((n) => {
6355
- setLayout((prev) => ({
6390
+ const defaultSections = import_react10.useMemo(() => ({
6391
+ ["bottom" /* Bottom */]: null,
6392
+ ["right" /* Right */]: null,
6393
+ ["top" /* Top */]: null,
6394
+ ["left" /* Left */]: null,
6395
+ ["content" /* Content */]: null
6396
+ }), []);
6397
+ const setSections = import_react10.useCallback((value) => {
6398
+ setLayouts((prev) => ({
6356
6399
  ...prev,
6357
- sections: { ...prev?.sections, ["top" /* Top */]: n }
6400
+ [layoutId]: {
6401
+ type: "frame" /* Frame */,
6402
+ sections: typeof value === "function" ? value(prev[layoutId]?.sections ?? defaultSections) : value
6403
+ }
6358
6404
  }));
6359
- }, [setLayout]);
6360
- const bottomSection = import_react10.useCallback((n) => {
6361
- setLayout((prev) => ({
6405
+ }, [layoutId, setLayouts, defaultSections]);
6406
+ const topSectionRef = import_react10.useCallback((n) => {
6407
+ setSections((prev) => ({
6362
6408
  ...prev,
6363
- sections: { ...prev?.sections, ["bottom" /* Bottom */]: n }
6409
+ ["top" /* Top */]: n
6364
6410
  }));
6365
- }, [setLayout]);
6366
- const leftSection = import_react10.useCallback((n) => {
6367
- setLayout((prev) => ({
6411
+ }, [setSections]);
6412
+ const bottomSectionRef = import_react10.useCallback((n) => {
6413
+ setSections((prev) => ({
6368
6414
  ...prev,
6369
- sections: { ...prev?.sections, ["left" /* Left */]: n }
6415
+ ["bottom" /* Bottom */]: n
6370
6416
  }));
6371
- }, [setLayout]);
6372
- const rightSection = import_react10.useCallback((n) => {
6373
- setLayout((prev) => ({
6417
+ }, [setSections]);
6418
+ const leftSectionRef = import_react10.useCallback((n) => {
6419
+ setSections((prev) => ({
6374
6420
  ...prev,
6375
- sections: { ...prev?.sections, ["right" /* Right */]: n }
6421
+ ["left" /* Left */]: n
6376
6422
  }));
6377
- }, [setLayout]);
6378
- let contentSection = children;
6379
- const childrenContainerProps = {
6423
+ }, [setSections]);
6424
+ const rightSectionRef = import_react10.useCallback((n) => {
6425
+ setSections((prev) => ({
6426
+ ...prev,
6427
+ ["right" /* Right */]: n
6428
+ }));
6429
+ }, [setSections]);
6430
+ const contentSectionRef = import_react10.useCallback((n) => {
6431
+ setSections((prev) => ({
6432
+ ...prev,
6433
+ ["content" /* Content */]: n
6434
+ }));
6435
+ }, [setSections]);
6436
+ const contentSection = /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6437
+ ref: contentSectionRef,
6438
+ h: "100%",
6439
+ gap: gutter,
6380
6440
  flex: 1,
6381
- ...componentsProps?.childrenContainer
6382
- };
6383
- if (variant === "plain" /* Plain */) {
6384
- contentSection = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Box, {
6385
- ...childrenContainerProps,
6386
- children: contentSection
6387
- }, undefined, false, undefined, this);
6388
- } else if (variant === "sticky" /* Sticky */) {
6389
- contentSection = /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.ScrollArea, {
6390
- ...theme.scrollAreaProps,
6391
- ...childrenContainerProps,
6392
- children
6393
- }, undefined, false, undefined, this);
6394
- }
6395
- return /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(layoutContext.Provider, {
6396
- value: { layoutId, layout, setLayout },
6397
- children: /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Group, {
6441
+ ...componentsProps?.sectionContainers?.["content" /* Content */],
6442
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-content-section", componentsProps?.sectionContainers?.["content" /* Content */]?.className),
6443
+ children
6444
+ }, undefined, false, undefined, this);
6445
+ const layoutContextValue = import_react10.useMemo(() => ({
6446
+ type: "frame" /* Frame */,
6447
+ sections: defaultSections,
6448
+ ...layout,
6449
+ layoutId
6450
+ }), [layout?.sections, defaultSections, layoutId]);
6451
+ return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(layoutContext.Provider, {
6452
+ value: layoutContextValue,
6453
+ children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Group, {
6398
6454
  gap: 0,
6399
6455
  h: "100%",
6400
6456
  w: "100%",
6401
6457
  wrap: "nowrap",
6402
6458
  ...componentsProps?.horizontalContainer,
6459
+ style: {
6460
+ "--remoraid-frame-layout-gutter": typeof gutter === "string" ? `var(--mantine-spacing-${gutter})` : `${gutter}px`
6461
+ },
6462
+ className: clsx_default("remoraid-frame-layout", componentsProps?.horizontalContainer?.className),
6403
6463
  children: [
6404
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Group, {
6405
- ref: leftSection,
6464
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Group, {
6465
+ ref: leftSectionRef,
6406
6466
  h: "100%",
6407
- gap: 0,
6408
6467
  wrap: "nowrap",
6409
- ...componentsProps?.sectionContainers?.["left" /* Left */]
6468
+ gap: gutter,
6469
+ pr: 0,
6470
+ ...componentsProps?.sectionContainers?.["left" /* Left */],
6471
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["left" /* Left */]?.className)
6410
6472
  }, undefined, false, undefined, this),
6411
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Stack, {
6473
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6412
6474
  h: "100%",
6413
6475
  flex: 1,
6414
6476
  gap: 0,
6415
6477
  ...componentsProps?.verticalContainer,
6478
+ className: clsx_default("remoraid-frame-layout-vertical-container", componentsProps?.verticalContainer?.className),
6416
6479
  children: [
6417
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Stack, {
6418
- h: "100%",
6419
- ref: topSection,
6420
- gap: 0,
6480
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6481
+ ref: topSectionRef,
6482
+ gap: gutter,
6421
6483
  flex: 0,
6422
- ...componentsProps?.sectionContainers?.["top" /* Top */]
6484
+ ...componentsProps?.sectionContainers?.["top" /* Top */],
6485
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-top-section", componentsProps?.sectionContainers?.["top" /* Top */]?.className)
6423
6486
  }, undefined, false, undefined, this),
6424
- contentSection,
6425
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Stack, {
6426
- h: "100%",
6427
- ref: bottomSection,
6428
- gap: 0,
6487
+ includeScrollArea ? /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.ScrollArea, {
6488
+ flex: 1,
6489
+ ...theme.scrollAreaProps,
6490
+ ...componentsProps?.ScrollArea,
6491
+ children: contentSection
6492
+ }, undefined, false, undefined, this) : contentSection,
6493
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Stack, {
6494
+ ref: bottomSectionRef,
6495
+ gap: gutter,
6429
6496
  flex: 0,
6430
- ...componentsProps?.sectionContainers?.["bottom" /* Bottom */]
6497
+ ...componentsProps?.sectionContainers?.["bottom" /* Bottom */],
6498
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-bottom-section", componentsProps?.sectionContainers?.["bottom" /* Bottom */]?.className)
6431
6499
  }, undefined, false, undefined, this)
6432
6500
  ]
6433
6501
  }, undefined, true, undefined, this),
6434
- /* @__PURE__ */ jsx_dev_runtime12.jsxDEV(import_core6.Group, {
6435
- gap: 0,
6436
- ref: rightSection,
6502
+ /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Group, {
6503
+ ref: rightSectionRef,
6437
6504
  h: "100%",
6505
+ gap: gutter,
6506
+ pl: 0,
6438
6507
  wrap: "nowrap",
6439
- ...componentsProps?.sectionContainers?.["right" /* Right */]
6508
+ ...componentsProps?.sectionContainers?.["right" /* Right */],
6509
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["right" /* Right */]?.className)
6440
6510
  }, undefined, false, undefined, this)
6441
6511
  ]
6442
6512
  }, undefined, true, undefined, this)
6443
6513
  }, undefined, false, undefined, this);
6444
6514
  }
6445
6515
  var FrameLayout_default = Object.assign(FrameLayout, {
6446
- Element
6516
+ Element: Element2
6447
6517
  });
6448
6518
 
6449
6519
  // src/core/components/AppShell/index.tsx
6450
- var jsx_dev_runtime13 = require("react/jsx-dev-runtime");
6451
- var defaultAppShellLayoutId = "remoraidAppShell";
6520
+ var import_lodash2 = __toESM(require_lodash());
6521
+ var jsx_dev_runtime14 = require("react/jsx-dev-runtime");
6522
+ var remoraidAppShellLayoutId = "remoraid-app-shell";
6452
6523
  var defaultAppShellNavbarPositions = { ["minimal" /* Minimal */]: "left" /* Left */ };
6453
6524
  var defaultAppShellFooterPositions = { ["minimal" /* Minimal */]: "content" /* Content */ };
6454
- function AppShell(props) {
6455
- const {
6456
- children,
6457
- navbarVariant,
6458
- footerVariant,
6459
- appContext: appContext2,
6460
- componentsProps
6461
- } = {
6462
- navbarVariant: null,
6463
- footerVariant: null,
6464
- ...props
6465
- };
6466
- let { navbarPosition, footerPosition } = props;
6467
- if (navbarVariant !== null && navbarPosition === undefined) {
6468
- navbarPosition = defaultAppShellNavbarPositions[navbarVariant];
6469
- }
6470
- if (footerVariant !== null && footerPosition === undefined) {
6471
- footerPosition = defaultAppShellFooterPositions[footerVariant];
6472
- }
6525
+ function AppShell({
6526
+ navbarVariant: navbarVariantProp,
6527
+ footerVariant: footerVariantProp,
6528
+ navbarPosition: navbarPositionProp,
6529
+ footerPosition: footerPositionProp,
6530
+ gutter,
6531
+ appContext: appContext2,
6532
+ componentsProps,
6533
+ children
6534
+ }) {
6535
+ const navbarVariant = navbarVariantProp ?? null;
6536
+ const footerVariant = footerVariantProp ?? null;
6537
+ const navbarPosition = navbarPositionProp ?? (navbarVariant === null ? null : defaultAppShellNavbarPositions[navbarVariant]);
6538
+ const footerPosition = footerPositionProp ?? (footerVariant === null ? null : defaultAppShellFooterPositions[footerVariant]);
6539
+ const theme = useRemoraidTheme();
6473
6540
  let navbar;
6474
6541
  let footer;
6475
- let navbarContainerProps = {};
6476
- let footerContainerProps = {};
6542
+ let navbarLayoutElementProps = {
6543
+ includeContainer: false
6544
+ };
6545
+ let footerLayoutElementProps = {
6546
+ includeContainer: true,
6547
+ componentsProps: { container: { style: { order: 1 } } }
6548
+ };
6477
6549
  if (navbarVariant === "minimal" /* Minimal */) {
6478
- navbar = /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(NavbarMinimal, {
6550
+ navbar = /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(NavbarMinimal, {
6479
6551
  ...componentsProps?.navbar
6480
6552
  }, undefined, false, undefined, this);
6481
- navbarContainerProps.py = "md";
6482
- if (navbarPosition === "left" /* Left */) {
6483
- navbarContainerProps.pl = "md";
6484
- } else if (navbarPosition === "right" /* Right */) {
6485
- navbarContainerProps.pr = "md";
6486
- }
6487
6553
  }
6488
6554
  if (footerVariant === "minimal" /* Minimal */) {
6489
- footer = /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FooterMinimal, {
6555
+ footer = /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FooterMinimal, {
6490
6556
  ...componentsProps?.footer
6491
6557
  }, undefined, false, undefined, this);
6492
6558
  }
6493
- return /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(AppProvider, {
6559
+ return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(AppProvider, {
6494
6560
  appContext: appContext2,
6495
6561
  ...componentsProps?.AppProvider,
6496
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Box, {
6562
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core8.Box, {
6497
6563
  h: "100vh",
6498
6564
  ...componentsProps?.container,
6499
- children: /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FrameLayout_default, {
6500
- layoutId: defaultAppShellLayoutId,
6565
+ children: /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FrameLayout_default, {
6566
+ layoutId: remoraidAppShellLayoutId,
6567
+ gutter: gutter ?? theme.primaryGutter,
6501
6568
  ...componentsProps?.layout,
6502
6569
  children: [
6503
- navbarPosition !== undefined && navbarPosition !== "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FrameLayout_default.Element, {
6570
+ navbarPosition !== null && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FrameLayout_default.Element, {
6504
6571
  section: navbarPosition,
6505
- ...componentsProps?.navbarLayoutElement,
6506
- componentsProps: {
6507
- ...componentsProps?.navbarLayoutElement?.componentsProps,
6508
- container: {
6509
- ...navbarContainerProps,
6510
- ...componentsProps?.navbarLayoutElement?.componentsProps?.container
6511
- }
6512
- },
6572
+ includeContainer: false,
6573
+ ...import_lodash2.merge(navbarLayoutElementProps, componentsProps?.navbarLayoutElement),
6513
6574
  children: navbar
6514
6575
  }, undefined, false, undefined, this),
6515
- footerPosition !== undefined && footerPosition !== "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(FrameLayout_default.Element, {
6576
+ children,
6577
+ footerPosition !== null && /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(FrameLayout_default.Element, {
6516
6578
  section: footerPosition,
6517
- ...componentsProps?.footerLayoutElement,
6518
- componentsProps: {
6519
- ...componentsProps?.footerLayoutElement?.componentsProps,
6520
- container: {
6521
- ...footerContainerProps,
6522
- ...componentsProps?.footerLayoutElement?.componentsProps?.container
6523
- }
6524
- },
6525
- children: footer
6526
- }, undefined, false, undefined, this),
6527
- navbarPosition !== undefined && navbarPosition === "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
6528
- children: navbar
6529
- }, undefined, false, undefined, this),
6530
- /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(import_core7.Box, {
6531
- ...componentsProps?.childrenContainer,
6532
- children
6533
- }, undefined, false, undefined, this),
6534
- footerPosition !== undefined && footerPosition === "content" /* Content */ && /* @__PURE__ */ jsx_dev_runtime13.jsxDEV(jsx_dev_runtime13.Fragment, {
6579
+ ...import_lodash2.merge(footerLayoutElementProps, componentsProps?.footerLayoutElement),
6535
6580
  children: footer
6536
6581
  }, undefined, false, undefined, this)
6537
6582
  ]
@@ -6544,30 +6589,12 @@ var AppShell_default = Object.assign(AppShell, {
6544
6589
  FooterMinimal
6545
6590
  });
6546
6591
  // src/core/components/WidgetSelectionHeader/index.tsx
6547
- var import_core10 = require("@mantine/core");
6592
+ var import_core11 = require("@mantine/core");
6548
6593
 
6549
6594
  // src/core/components/Page/index.tsx
6595
+ var import_core9 = require("@mantine/core");
6550
6596
  var import_react11 = __toESM(require("react"));
6551
6597
  var import_navigation2 = require("next/navigation");
6552
-
6553
- // src/core/components/Page/PageContainer/index.tsx
6554
- var import_core8 = require("@mantine/core");
6555
- var jsx_dev_runtime14 = require("react/jsx-dev-runtime");
6556
- function PageContainer({
6557
- children,
6558
- pt,
6559
- componentsProps
6560
- }) {
6561
- const theme = useRemoraidTheme();
6562
- return /* @__PURE__ */ jsx_dev_runtime14.jsxDEV(import_core8.Container, {
6563
- size: theme.containerSize,
6564
- pt: pt ?? "md",
6565
- ...componentsProps?.container,
6566
- children
6567
- }, undefined, false, undefined, this);
6568
- }
6569
-
6570
- // src/core/components/Page/index.tsx
6571
6598
  var jsx_dev_runtime15 = require("react/jsx-dev-runtime");
6572
6599
  var pageContext = import_react11.default.createContext(null);
6573
6600
  var usePage = () => {
@@ -6577,9 +6604,10 @@ function Page({
6577
6604
  children,
6578
6605
  name,
6579
6606
  config,
6580
- pt,
6607
+ gap,
6581
6608
  componentsProps
6582
6609
  }) {
6610
+ const theme = useRemoraidTheme();
6583
6611
  const pathname = import_navigation2.usePathname();
6584
6612
  const { isPageRegistered, registerPage } = useWidgets();
6585
6613
  const pageId = config?.pageId ?? pathname;
@@ -6593,9 +6621,13 @@ function Page({
6593
6621
  return /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(pageContext.Provider, {
6594
6622
  value: { name: name ?? pathname, pageId, ...config },
6595
6623
  children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(PageContainer, {
6596
- pt,
6597
- componentsProps: { container: componentsProps?.container },
6598
- children
6624
+ ...componentsProps?.PageContainer,
6625
+ children: /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(import_core9.Stack, {
6626
+ gap: gap ?? theme.primaryGutter,
6627
+ ...componentsProps?.Stack,
6628
+ className: clsx_default("remoraid-page", componentsProps?.Stack?.className),
6629
+ children
6630
+ }, undefined, false, undefined, this)
6599
6631
  }, undefined, false, undefined, this)
6600
6632
  }, undefined, false, undefined, this);
6601
6633
  }
@@ -6604,25 +6636,26 @@ function Page({
6604
6636
  var import_icons_react4 = require("@tabler/icons-react");
6605
6637
 
6606
6638
  // src/core/components/ScrollableChipGroup/index.tsx
6607
- var import_core9 = require("@mantine/core");
6639
+ var import_core10 = require("@mantine/core");
6608
6640
  var jsx_dev_runtime16 = require("react/jsx-dev-runtime");
6609
6641
  function ScrollableChipGroup({
6610
6642
  value,
6611
6643
  onChange,
6612
6644
  gap,
6613
6645
  componentsProps,
6614
- children
6646
+ children: childrenProp
6615
6647
  }) {
6648
+ const children = asChildrenOfType(import_core10.Chip, childrenProp, "Check children passed to 'ScrollableChipGroup' component.");
6616
6649
  const theme = useRemoraidTheme();
6617
- return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core9.ScrollArea, {
6650
+ return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.ScrollArea, {
6618
6651
  ...theme.scrollAreaProps,
6619
6652
  ...componentsProps?.scrollArea,
6620
- children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core9.Chip.Group, {
6653
+ children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.Chip.Group, {
6621
6654
  value,
6622
6655
  onChange,
6623
6656
  ...componentsProps?.chipGroup,
6624
6657
  multiple: true,
6625
- children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core9.Flex, {
6658
+ children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(import_core10.Flex, {
6626
6659
  justify: "flex-start",
6627
6660
  align: "center",
6628
6661
  gap: gap ?? "xs",
@@ -6642,98 +6675,73 @@ function WidgetSelectionHeader({
6642
6675
  mt
6643
6676
  }) {
6644
6677
  const theme = useRemoraidTheme();
6645
- const { widgets, isPageRegistered, updateWidgetSelectionBulk } = useWidgets();
6678
+ const { isPageRegistered, updateWidgetSelectionBulk, ...widgetsContext2 } = useWidgets();
6646
6679
  const page = usePage();
6647
6680
  if (!page) {
6648
- console.error("'WidgetSelectionHeader' must be rendered inside of a 'Page' component.");
6649
- return null;
6681
+ throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
6650
6682
  }
6651
- return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Flex, {
6683
+ const widgets = widgetsContext2.widgets[page.pageId] ?? {};
6684
+ return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Flex, {
6652
6685
  justify: "flex-start",
6653
6686
  align: "center",
6654
6687
  gap: "xs",
6655
6688
  mt,
6656
6689
  children: [
6657
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Text, {
6690
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Text, {
6658
6691
  size: "lg",
6659
6692
  fw: 400,
6660
6693
  children: title ?? page.name
6661
6694
  }, undefined, false, undefined, this),
6662
- /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Divider, {
6695
+ /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Divider, {
6663
6696
  orientation: "vertical"
6664
6697
  }, undefined, false, undefined, this),
6665
6698
  isPageRegistered(page.pageId) && /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(ScrollableChipGroup, {
6666
- value: Object.keys(widgets[page.pageId]).filter((widgetId) => widgets[page.pageId][widgetId].selected),
6699
+ value: Object.keys(widgets).filter((widgetId) => widgets[widgetId]?.selected),
6667
6700
  onChange: (value) => {
6668
6701
  updateWidgetSelectionBulk(page.pageId, value);
6669
6702
  },
6670
6703
  componentsProps: { scrollArea: { flex: 1 } },
6671
- children: Object.keys(widgets[page.pageId]).map((widgetId) => /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core10.Chip, {
6672
- value: widgetId,
6673
- size: "sm",
6674
- disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6675
- icon: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_icons_react4.IconCheck, {
6676
- ...theme.iconProps.tiny
6677
- }, undefined, false, undefined, this),
6678
- children: widgets[page.pageId][widgetId].name
6679
- }, widgetId, false, undefined, this))
6704
+ children: Object.keys(widgets).map((widgetId) => {
6705
+ const widget = widgets[widgetId] ?? getDefaultWidgetContext({ widgetId });
6706
+ return /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_core11.Chip, {
6707
+ value: widgetId,
6708
+ size: "sm",
6709
+ disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6710
+ icon: /* @__PURE__ */ jsx_dev_runtime17.jsxDEV(import_icons_react4.IconCheck, {
6711
+ ...theme.iconProps.tiny
6712
+ }, undefined, false, undefined, this),
6713
+ children: widget.name
6714
+ }, widgetId, false, undefined, this);
6715
+ })
6680
6716
  }, undefined, false, undefined, this)
6681
6717
  ]
6682
6718
  }, undefined, true, undefined, this);
6683
6719
  }
6684
- // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
6685
- var import_core11 = require("@mantine/core");
6686
- var import_icons_react5 = require("@tabler/icons-react");
6687
- var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
6688
- function CloseButton({ widgetId }) {
6689
- const theme = useRemoraidTheme();
6690
- const { activeWidget, updateWidgetSelection } = useWidgets();
6691
- const page = usePage();
6692
- return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.Transition, {
6693
- mounted: activeWidget === widgetId,
6694
- transition: "pop-top-right",
6695
- duration: theme.transitionDurations.short,
6696
- timingFunction: "ease",
6697
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core11.ActionIcon, {
6698
- pos: "absolute",
6699
- size: "xs",
6700
- className: "remoraid-close-button",
6701
- radius: "xl",
6702
- color: "red",
6703
- onClick: () => {
6704
- if (!page) {
6705
- return;
6706
- }
6707
- updateWidgetSelection(page.pageId, widgetId, false);
6708
- },
6709
- style: transitionStyle,
6710
- children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_icons_react5.IconX, {
6711
- ...theme.iconProps.tiny
6712
- }, undefined, false, undefined, this)
6713
- }, undefined, false, undefined, this)
6714
- }, undefined, false, undefined, this);
6715
- }
6716
6720
  // src/core/components/BadgeGroup/index.tsx
6717
6721
  var import_core13 = require("@mantine/core");
6718
6722
  var import_react12 = __toESM(require("react"));
6719
6723
 
6720
6724
  // src/core/components/BadgeMinimal/index.tsx
6721
6725
  var import_core12 = require("@mantine/core");
6722
- var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
6723
- function BadgeMinimal(props) {
6724
- const { label, tooltip, mounted, componentsProps } = props;
6726
+ var jsx_dev_runtime18 = require("react/jsx-dev-runtime");
6727
+ function BadgeMinimal({
6728
+ label,
6729
+ tooltip,
6730
+ mounted = true,
6731
+ componentsProps
6732
+ }) {
6725
6733
  const theme = useRemoraidTheme();
6726
- return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Transition, {
6727
- mounted: mounted !== false,
6734
+ return /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Transition, {
6735
+ mounted,
6728
6736
  transition: "fade",
6729
6737
  duration: theme.transitionDurations.short,
6730
6738
  timingFunction: "ease",
6731
6739
  ...componentsProps?.transition,
6732
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Tooltip, {
6740
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Tooltip, {
6733
6741
  disabled: !tooltip,
6734
6742
  label: tooltip,
6735
6743
  ...componentsProps?.tooltip,
6736
- children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core12.Badge, {
6744
+ children: /* @__PURE__ */ jsx_dev_runtime18.jsxDEV(import_core12.Badge, {
6737
6745
  variant: "default",
6738
6746
  ...componentsProps?.badge,
6739
6747
  style: {
@@ -6748,7 +6756,7 @@ function BadgeMinimal(props) {
6748
6756
  }
6749
6757
 
6750
6758
  // src/core/components/BadgeGroup/index.tsx
6751
- var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
6759
+ var jsx_dev_runtime19 = require("react/jsx-dev-runtime");
6752
6760
  var react = require("react");
6753
6761
  function BadgeGroup({
6754
6762
  badges: badgesProp,
@@ -6759,9 +6767,9 @@ function BadgeGroup({
6759
6767
  const theme = useRemoraidTheme();
6760
6768
  const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
6761
6769
  const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
6762
- return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(jsx_dev_runtime20.Fragment, {
6770
+ return /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(jsx_dev_runtime19.Fragment, {
6763
6771
  children: [
6764
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Group, {
6772
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Group, {
6765
6773
  gap: gap ?? "xs",
6766
6774
  wrap: "nowrap",
6767
6775
  visibleFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
@@ -6777,10 +6785,10 @@ function BadgeGroup({
6777
6785
  });
6778
6786
  })
6779
6787
  }, undefined, false, undefined, this),
6780
- /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Tooltip, {
6788
+ /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Tooltip, {
6781
6789
  label: `${numVisibleBadges} badge${numVisibleBadges === 1 ? "" : "s"}`,
6782
6790
  ...componentsProps?.tooltip,
6783
- children: /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core13.Badge, {
6791
+ children: /* @__PURE__ */ jsx_dev_runtime19.jsxDEV(import_core13.Badge, {
6784
6792
  hiddenFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
6785
6793
  hidden: numVisibleBadges === 0,
6786
6794
  variant: "light",
@@ -6795,26 +6803,26 @@ function BadgeGroup({
6795
6803
  }
6796
6804
  // src/core/components/AlertMinimal/index.tsx
6797
6805
  var import_core14 = require("@mantine/core");
6798
- var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
6806
+ var jsx_dev_runtime20 = require("react/jsx-dev-runtime");
6799
6807
  function AlertMinimal({
6800
6808
  title,
6801
6809
  category,
6802
6810
  text,
6803
6811
  onClose,
6804
- mounted,
6812
+ mounted = true,
6805
6813
  mt,
6806
6814
  mb,
6807
6815
  componentsProps,
6808
6816
  children
6809
6817
  }) {
6810
6818
  const theme = useRemoraidTheme();
6811
- return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Transition, {
6819
+ return /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Transition, {
6812
6820
  mounted: mounted !== false,
6813
6821
  transition: "fade",
6814
6822
  duration: theme.transitionDurations.short,
6815
6823
  timingFunction: "ease",
6816
6824
  ...componentsProps?.transition,
6817
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core14.Alert, {
6825
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime20.jsxDEV(import_core14.Alert, {
6818
6826
  ...theme.alertProps[category],
6819
6827
  title: title ?? theme.alertProps[category].title,
6820
6828
  withCloseButton: onClose !== undefined,
@@ -6835,140 +6843,480 @@ function AlertMinimal({
6835
6843
  }
6836
6844
  // src/core/components/RemoraidButton/index.tsx
6837
6845
  var import_core15 = require("@mantine/core");
6838
- var import_icons_react6 = require("@tabler/icons-react");
6839
- var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
6846
+ var import_icons_react5 = require("@tabler/icons-react");
6847
+ var import_react13 = require("react");
6848
+ var jsx_dev_runtime21 = require("react/jsx-dev-runtime");
6840
6849
  function RemoraidButton({
6841
6850
  label,
6842
- responsive,
6843
- breakpoint,
6844
- collapsed,
6851
+ responsive: ResponsiveProp,
6852
+ breakpoint: breakpointProp,
6853
+ collapsed: collapsedProp,
6845
6854
  size,
6846
6855
  color,
6847
6856
  onClick,
6848
6857
  loading,
6849
- variant,
6850
- componentsProps,
6851
- ...props
6858
+ variant = "default",
6859
+ mounted = true,
6860
+ icon: iconProp,
6861
+ iconSize = "medium" /* Medium */,
6862
+ componentsProps
6852
6863
  }) {
6864
+ const responsive = ResponsiveProp ?? true;
6865
+ const breakpoint = breakpointProp ?? "md";
6866
+ const collapsed = collapsedProp ?? false;
6867
+ const icon = iconProp ?? import_icons_react5.IconClick;
6853
6868
  const theme = useRemoraidTheme();
6854
- const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
6855
- const icon = props.icon ? /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(props.icon, {
6856
- ...iconProps
6857
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_icons_react6.IconClick, {
6858
- ...iconProps
6859
- }, undefined, false, undefined, this);
6860
- return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(jsx_dev_runtime22.Fragment, {
6861
- children: [
6862
- /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.Tooltip, {
6863
- label,
6864
- ...componentsProps?.tooltip,
6865
- children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.ActionIcon, {
6866
- "aria-label": label,
6867
- variant: variant ?? "default",
6869
+ const iconProps = { ...theme.iconProps[iconSize], ...componentsProps?.icon };
6870
+ const iconElement = import_react13.createElement(icon, iconProps);
6871
+ return /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Transition, {
6872
+ mounted,
6873
+ transition: "fade",
6874
+ duration: theme.transitionDurations.short,
6875
+ timingFunction: "ease",
6876
+ ...componentsProps?.transition,
6877
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(jsx_dev_runtime21.Fragment, {
6878
+ children: [
6879
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Tooltip, {
6880
+ label,
6881
+ ...componentsProps?.tooltip,
6882
+ children: /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.ActionIcon, {
6883
+ "aria-label": label,
6884
+ variant,
6885
+ onClick,
6886
+ loading,
6887
+ size: size ? `input-${size}` : "input-sm",
6888
+ color,
6889
+ ...componentsProps?.button,
6890
+ ...componentsProps?.ActionIcon,
6891
+ hiddenFrom: !responsive ? undefined : breakpoint,
6892
+ display: !responsive && !collapsed ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6893
+ style: {
6894
+ ...transitionStyle,
6895
+ ...componentsProps?.ActionIcon?.style ?? componentsProps?.button?.style
6896
+ },
6897
+ children: iconElement
6898
+ }, undefined, false, undefined, this)
6899
+ }, undefined, false, undefined, this),
6900
+ /* @__PURE__ */ jsx_dev_runtime21.jsxDEV(import_core15.Button, {
6868
6901
  onClick,
6869
6902
  loading,
6870
- size: size ? `input-${size}` : "input-sm",
6903
+ variant,
6904
+ size,
6871
6905
  color,
6906
+ leftSection: iconProp ? iconElement : undefined,
6872
6907
  ...componentsProps?.button,
6873
- ...componentsProps?.ActionIcon,
6874
- hiddenFrom: responsive === false ? undefined : breakpoint ?? "md",
6875
- display: responsive === false && collapsed !== true ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6876
- children: icon
6908
+ ...componentsProps?.Button,
6909
+ visibleFrom: !responsive ? undefined : breakpoint,
6910
+ display: !responsive && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6911
+ style: {
6912
+ ...transitionStyle,
6913
+ ...componentsProps?.Button?.style ?? componentsProps?.button?.style
6914
+ },
6915
+ children: label
6877
6916
  }, undefined, false, undefined, this)
6878
- }, undefined, false, undefined, this),
6879
- /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core15.Button, {
6880
- onClick,
6881
- loading,
6882
- variant: variant ?? "default",
6917
+ ]
6918
+ }, undefined, true, undefined, this)
6919
+ }, undefined, false, undefined, this);
6920
+ }
6921
+ // src/core/components/Controls/ControlButton/index.tsx
6922
+ var import_core16 = require("@mantine/core");
6923
+ var import_icons_react6 = require("@tabler/icons-react");
6924
+ var jsx_dev_runtime22 = require("react/jsx-dev-runtime");
6925
+ function ControlButton({
6926
+ icon: Icon4 = import_icons_react6.IconClick,
6927
+ mounted = true,
6928
+ size = "xs",
6929
+ iconSize = "tiny" /* Tiny */,
6930
+ onClick,
6931
+ order,
6932
+ color,
6933
+ tooltip,
6934
+ componentsProps
6935
+ }) {
6936
+ const theme = useRemoraidTheme();
6937
+ return /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Transition, {
6938
+ mounted,
6939
+ transition: "pop-top-right",
6940
+ duration: theme.transitionDurations.short,
6941
+ timingFunction: "ease",
6942
+ ...componentsProps?.transition,
6943
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.Tooltip, {
6944
+ label: tooltip,
6945
+ disabled: !Boolean(tooltip),
6946
+ ...componentsProps?.tooltip,
6947
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(import_core16.ActionIcon, {
6948
+ "data-control-button": true,
6883
6949
  size,
6884
6950
  color,
6885
- leftSection: props.icon ? icon : undefined,
6951
+ onClick,
6952
+ radius: "xl",
6886
6953
  ...componentsProps?.button,
6887
- ...componentsProps?.Button,
6888
- visibleFrom: responsive === false ? undefined : breakpoint ?? "md",
6889
- display: responsive === false && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6890
- children: label
6954
+ style: {
6955
+ ...transitionStyle,
6956
+ order,
6957
+ ...componentsProps?.button?.style
6958
+ },
6959
+ children: /* @__PURE__ */ jsx_dev_runtime22.jsxDEV(Icon4, {
6960
+ ...theme.iconProps[iconSize],
6961
+ ...componentsProps?.icon
6962
+ }, undefined, false, undefined, this)
6891
6963
  }, undefined, false, undefined, this)
6964
+ }, undefined, false, undefined, this)
6965
+ }, undefined, false, undefined, this);
6966
+ }
6967
+
6968
+ // src/core/components/Controls/index.tsx
6969
+ var import_react14 = require("react");
6970
+ var import_core17 = require("@mantine/core");
6971
+ var import_icons_react7 = require("@tabler/icons-react");
6972
+ var import_lodash3 = __toESM(require_lodash());
6973
+ var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
6974
+ function Controls({
6975
+ groupRef,
6976
+ mounted = true,
6977
+ dragContainerRef,
6978
+ gutter = 5,
6979
+ iconSize = "tiny" /* Tiny */,
6980
+ additionalButtons: additionalButtonsProp,
6981
+ componentsProps,
6982
+ children: childrenProp
6983
+ }) {
6984
+ const additionalButtons = additionalButtonsProp?.map((additionalButton) => asElementOrPropsOfType(ControlButton, additionalButton, "Check the 'additionalButtons' property of 'Controls'."));
6985
+ const children = asChildrenOfType(ControlButton, childrenProp, "Check children passed to 'Controls' component.");
6986
+ const theme = useRemoraidTheme();
6987
+ const [pos, setPos] = import_react14.useState({
6988
+ x: 0,
6989
+ y: 0
6990
+ });
6991
+ const offsetRef = import_react14.useRef({ x: 0, y: 0 });
6992
+ const containerRef = import_react14.useRef(null);
6993
+ const clamp = (v, min, max) => {
6994
+ return Math.min(Math.max(v, min), max);
6995
+ };
6996
+ const handlePointerDown = (e) => {
6997
+ if (e.target instanceof Element && e.target.closest("button,[data-control-button]")) {
6998
+ return;
6999
+ }
7000
+ if (!containerRef.current) {
7001
+ return;
7002
+ }
7003
+ const paperRect = containerRef.current.getBoundingClientRect();
7004
+ offsetRef.current = {
7005
+ x: e.clientX - paperRect.right,
7006
+ y: e.clientY - paperRect.top
7007
+ };
7008
+ e.currentTarget.setPointerCapture(e.pointerId);
7009
+ };
7010
+ const handlePointerMove = (e) => {
7011
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
7012
+ return;
7013
+ }
7014
+ if (!containerRef.current || !dragContainerRef.current) {
7015
+ return;
7016
+ }
7017
+ const boxRect = dragContainerRef.current.getBoundingClientRect();
7018
+ const paperRect = containerRef.current.getBoundingClientRect();
7019
+ const rawX = e.clientX - boxRect.right - offsetRef.current.x;
7020
+ const rawY = e.clientY - boxRect.top - offsetRef.current.y;
7021
+ const maxX = boxRect.width - paperRect.width;
7022
+ const maxY = boxRect.height - paperRect.height;
7023
+ setPos({
7024
+ x: clamp(-rawX, 0, maxX),
7025
+ y: clamp(rawY, 0, maxY)
7026
+ });
7027
+ };
7028
+ const handlePointerUp = (e) => {
7029
+ e.currentTarget.releasePointerCapture(e.pointerId);
7030
+ };
7031
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Transition, {
7032
+ mounted,
7033
+ keepMounted: true,
7034
+ transition: "pop",
7035
+ duration: theme.transitionDurations.short,
7036
+ timingFunction: "ease",
7037
+ ...componentsProps?.transition,
7038
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Paper, {
7039
+ ref: containerRef,
7040
+ pos: "absolute",
7041
+ p: gutter,
7042
+ bg: theme.transparentBackground,
7043
+ shadow: "md",
7044
+ onPointerDown: handlePointerDown,
7045
+ onPointerMove: handlePointerMove,
7046
+ onPointerUp: handlePointerUp,
7047
+ ...componentsProps?.container,
7048
+ style: {
7049
+ right: pos.x,
7050
+ top: pos.y,
7051
+ ...import_lodash3.merge(transitionStyle, componentsProps?.container?.style)
7052
+ },
7053
+ className: clsx_default("remoraid-controls", componentsProps?.container?.className),
7054
+ children: /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core17.Group, {
7055
+ gap: gutter,
7056
+ ref: groupRef,
7057
+ wrap: "nowrap",
7058
+ ...componentsProps?.group,
7059
+ className: clsx_default("remoraid-controls-group", componentsProps?.group?.className),
7060
+ children: [
7061
+ /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_icons_react7.IconGripHorizontal, {
7062
+ order: -100,
7063
+ color: "var(--mantine-color-default-border)",
7064
+ ...import_lodash3.merge(theme.iconProps[iconSize], componentsProps?.gripIcon)
7065
+ }, undefined, false, undefined, this),
7066
+ children,
7067
+ additionalButtons && additionalButtons.map((button, i) => {
7068
+ if (isValidElementOfType(ControlButton, button)) {
7069
+ return button;
7070
+ }
7071
+ return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(ControlButton, {
7072
+ ...button
7073
+ }, i, false, undefined, this);
7074
+ })
7075
+ ]
7076
+ }, undefined, true, undefined, this)
7077
+ }, undefined, false, undefined, this)
7078
+ }, undefined, false, undefined, this);
7079
+ }
7080
+ // src/core/components/Widget/WidgetWrapper/index.tsx
7081
+ var import_core19 = require("@mantine/core");
7082
+ var import_react16 = require("react");
7083
+ var import_icons_react9 = require("@tabler/icons-react");
7084
+
7085
+ // src/core/components/Pinnable/index.tsx
7086
+ var import_react15 = require("react");
7087
+ var import_icons_react8 = require("@tabler/icons-react");
7088
+ var import_core18 = require("@mantine/core");
7089
+ var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
7090
+ function Pinnable({
7091
+ layoutType: layoutTypeProp,
7092
+ section,
7093
+ initialValue = false,
7094
+ layoutId,
7095
+ controlsContainer,
7096
+ hidden = false,
7097
+ componentsProps,
7098
+ children
7099
+ }) {
7100
+ const layoutType = layoutTypeProp ?? "frame" /* Frame */;
7101
+ const { layouts } = useLayouts();
7102
+ const [pinned, setPinned] = import_react15.useState(initialValue);
7103
+ const containerRef = import_react15.useRef(null);
7104
+ const layout = layouts[layoutId ?? remoraidAppShellLayoutId];
7105
+ if (layout && layout.type !== layoutType) {
7106
+ 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.`);
7107
+ }
7108
+ const controlButton = import_react15.useMemo(() => /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(ControlButton, {
7109
+ icon: pinned ? import_icons_react8.IconPinnedOff : import_icons_react8.IconPin,
7110
+ tooltip: pinned ? "Unpin" : "Pin",
7111
+ color: "green",
7112
+ order: 100,
7113
+ ...componentsProps?.button,
7114
+ onClick: (e) => {
7115
+ setPinned((p) => !p);
7116
+ componentsProps?.button?.onClick?.(e);
7117
+ }
7118
+ }, undefined, false, undefined, this), [pinned, componentsProps?.button]);
7119
+ const element = /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Box, {
7120
+ pos: "relative",
7121
+ ref: containerRef,
7122
+ "data-hidden": hidden,
7123
+ ...componentsProps?.container,
7124
+ className: clsx_default("remoraid-pinnable", componentsProps?.container?.className),
7125
+ children: [
7126
+ controlsContainer === undefined ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(Controls, {
7127
+ dragContainerRef: containerRef,
7128
+ ...componentsProps?.controls,
7129
+ children: controlButton
7130
+ }, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core18.Portal, {
7131
+ target: controlsContainer,
7132
+ children: controlButton
7133
+ }, undefined, false, undefined, this),
7134
+ children
6892
7135
  ]
6893
7136
  }, undefined, true, undefined, this);
7137
+ if (!layout) {
7138
+ return null;
7139
+ }
7140
+ if (pinned && layoutType === "frame" /* Frame */) {
7141
+ return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(FrameLayout_default.Element, {
7142
+ layoutId,
7143
+ section,
7144
+ hidden,
7145
+ ...componentsProps?.layoutElement,
7146
+ children: element
7147
+ }, undefined, false, undefined, this);
7148
+ }
7149
+ return element;
6894
7150
  }
7151
+
6895
7152
  // src/core/components/Widget/WidgetWrapper/index.tsx
6896
- var import_core16 = require("@mantine/core");
6897
- var import_react13 = require("react");
6898
- var jsx_dev_runtime23 = require("react/jsx-dev-runtime");
7153
+ var import_lodash4 = __toESM(require_lodash());
7154
+ var jsx_dev_runtime25 = require("react/jsx-dev-runtime");
6899
7155
  function WidgetWrapper({
6900
- children,
6901
7156
  config,
6902
- mt,
6903
- withCloseButton,
6904
- componentsProps
7157
+ mt = 0,
7158
+ withCloseButton = true,
7159
+ pinnableSection,
7160
+ componentsProps,
7161
+ children
6905
7162
  }) {
6906
7163
  const {
6907
7164
  isWidgetSelected,
6908
7165
  isPageRegistered,
6909
7166
  isWidgetRegistered,
6910
7167
  registerWidget,
6911
- updateActiveWidget
7168
+ updateActiveWidget,
7169
+ updateWidgetSelection,
7170
+ activeWidget
6912
7171
  } = useWidgets();
6913
7172
  const page = usePage();
6914
7173
  const theme = useRemoraidTheme();
7174
+ const mounted = page !== null && isWidgetSelected(page.pageId, config.widgetId);
7175
+ const [controlsContainer, setControlsContainer] = import_react16.useState(null);
7176
+ const [hidden, setHidden] = import_react16.useState(!mounted);
6915
7177
  const pageRegistered = page ? isPageRegistered(page.pageId) : false;
6916
- import_react13.useEffect(() => {
6917
- if (!page) {
6918
- return;
6919
- }
6920
- if (!isWidgetRegistered(page.pageId, config.widgetId)) {
6921
- registerWidget(page.pageId, config);
6922
- }
6923
- }, [pageRegistered]);
6924
- return /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Transition, {
6925
- mounted: page !== null && isWidgetSelected(page.pageId, config.widgetId),
7178
+ const containerRef = import_react16.useRef(null);
7179
+ const controlsContainerRef = import_react16.useCallback((n) => {
7180
+ setControlsContainer(n);
7181
+ }, [setControlsContainer]);
7182
+ const handleEnter = () => {
7183
+ updateActiveWidget(config.widgetId);
7184
+ };
7185
+ const handleLeave = () => {
7186
+ updateActiveWidget(null);
7187
+ };
7188
+ let element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core19.Transition, {
7189
+ mounted,
6926
7190
  transition: "fade-left",
6927
7191
  duration: theme.transitionDurations.medium,
6928
7192
  timingFunction: "ease",
6929
- children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(import_core16.Paper, {
7193
+ ...componentsProps?.transition,
7194
+ onExited: () => {
7195
+ setHidden(true);
7196
+ componentsProps?.transition?.onExited?.();
7197
+ },
7198
+ children: (transitionStyle) => /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core19.Paper, {
7199
+ ref: containerRef,
6930
7200
  p: "md",
6931
7201
  shadow: "md",
6932
7202
  bg: theme.transparentBackground,
6933
- mt: mt || 0,
7203
+ mt,
6934
7204
  pos: "relative",
6935
7205
  h: "fit-content",
6936
7206
  ...componentsProps?.container,
6937
- style: { ...transitionStyle, ...componentsProps?.container?.style },
6938
- onMouseEnter: () => {
6939
- updateActiveWidget(config.widgetId);
7207
+ onMouseEnter: (e) => {
7208
+ if (!pinnableSection) {
7209
+ handleEnter();
7210
+ }
7211
+ componentsProps?.container?.onMouseEnter?.(e);
6940
7212
  },
6941
- onMouseLeave: () => {
6942
- updateActiveWidget(null);
7213
+ onMouseLeave: (e) => {
7214
+ if (!pinnableSection) {
7215
+ handleLeave();
7216
+ }
7217
+ componentsProps?.container?.onMouseLeave?.(e);
6943
7218
  },
7219
+ style: import_lodash4.merge(transitionStyle, componentsProps?.container?.style),
7220
+ id: config.widgetId,
6944
7221
  children: [
6945
- withCloseButton !== false && /* @__PURE__ */ jsx_dev_runtime23.jsxDEV(CloseButton, {
6946
- widgetId: config.widgetId
7222
+ /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Controls, {
7223
+ dragContainerRef: containerRef,
7224
+ groupRef: controlsContainerRef,
7225
+ mounted: activeWidget === config.widgetId,
7226
+ ...componentsProps?.controls,
7227
+ children: /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(ControlButton, {
7228
+ mounted: withCloseButton,
7229
+ icon: import_icons_react9.IconX,
7230
+ tooltip: "Hide widget",
7231
+ color: "red",
7232
+ order: 200,
7233
+ ...componentsProps?.closeButton,
7234
+ onClick: (e) => {
7235
+ if (!page) {
7236
+ return;
7237
+ }
7238
+ updateWidgetSelection(page.pageId, config.widgetId, false);
7239
+ handleLeave();
7240
+ componentsProps?.closeButton?.onClick?.(e);
7241
+ }
7242
+ }, undefined, false, undefined, this)
6947
7243
  }, undefined, false, undefined, this),
6948
7244
  children
6949
7245
  ]
6950
7246
  }, undefined, true, undefined, this)
6951
7247
  }, undefined, false, undefined, this);
7248
+ if (pinnableSection !== undefined) {
7249
+ element = /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Pinnable, {
7250
+ section: pinnableSection,
7251
+ controlsContainer,
7252
+ hidden,
7253
+ ...componentsProps?.Pinnable,
7254
+ componentsProps: {
7255
+ ...componentsProps?.Pinnable?.componentsProps,
7256
+ container: {
7257
+ ...componentsProps?.Pinnable?.componentsProps?.container,
7258
+ onMouseEnter: (e) => {
7259
+ handleEnter();
7260
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseEnter?.(e);
7261
+ },
7262
+ onMouseLeave: (e) => {
7263
+ handleLeave();
7264
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseLeave?.(e);
7265
+ }
7266
+ },
7267
+ button: {
7268
+ ...componentsProps?.Pinnable?.componentsProps?.button,
7269
+ onClick: (e) => {
7270
+ handleLeave();
7271
+ componentsProps?.Pinnable?.componentsProps?.button?.onClick?.(e);
7272
+ }
7273
+ },
7274
+ layoutElement: {
7275
+ includeContainer: false,
7276
+ includePageContainer: pinnableSection === "top" /* Top */ || pinnableSection === "bottom" /* Bottom */,
7277
+ ...componentsProps?.Pinnable?.componentsProps?.layoutElement
7278
+ }
7279
+ },
7280
+ children: element
7281
+ }, undefined, false, undefined, this);
7282
+ }
7283
+ import_react16.useEffect(() => {
7284
+ if (!page) {
7285
+ return;
7286
+ }
7287
+ if (!isWidgetRegistered(page.pageId, config.widgetId)) {
7288
+ registerWidget(page.pageId, config);
7289
+ }
7290
+ }, [pageRegistered]);
7291
+ import_react16.useEffect(() => {
7292
+ if (mounted) {
7293
+ const id = requestAnimationFrame(() => {
7294
+ setHidden(false);
7295
+ });
7296
+ return () => {
7297
+ cancelAnimationFrame(id);
7298
+ };
7299
+ }
7300
+ }, [mounted]);
7301
+ return element;
6952
7302
  }
6953
- var WidgetWrapper_default = Object.assign(WidgetWrapper, {
6954
- CloseButton
6955
- });
6956
7303
  // src/core/components/Widget/index.tsx
6957
- var import_core17 = require("@mantine/core");
6958
- var jsx_dev_runtime24 = require("react/jsx-dev-runtime");
7304
+ var import_core20 = require("@mantine/core");
7305
+ var jsx_dev_runtime26 = require("react/jsx-dev-runtime");
6959
7306
  var react2 = require("react");
6960
7307
  function Widget({
6961
- children,
6962
7308
  id,
6963
- config,
6964
7309
  title,
7310
+ config,
6965
7311
  badges: badgesProp,
6966
7312
  buttons: buttonsProp,
6967
7313
  alerts: alertsProp,
6968
7314
  gaps,
6969
7315
  loading,
6970
7316
  mt,
6971
- componentsProps
7317
+ pinnableSection,
7318
+ componentsProps,
7319
+ children
6972
7320
  }) {
6973
7321
  const buttons = buttonsProp?.map((button) => asElementOrPropsOfType(RemoraidButton, button, "Check the 'buttons' property of this widget."));
6974
7322
  const alerts = alertsProp?.map((alert) => asElementOrPropsOfType(AlertMinimal, alert, "Check the 'alerts' property of this widget."));
@@ -6976,41 +7324,41 @@ function Widget({
6976
7324
  const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
6977
7325
  const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
6978
7326
  const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
6979
- return /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(WidgetWrapper_default, {
7327
+ return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(WidgetWrapper, {
6980
7328
  config: {
6981
7329
  widgetId: id,
6982
- name: title,
6983
- ...config
7330
+ ...config,
7331
+ initialValues: {
7332
+ name: title,
7333
+ ...config?.initialValues
7334
+ }
6984
7335
  },
6985
7336
  mt,
6986
- componentsProps: {
6987
- container: componentsProps?.container,
6988
- transition: componentsProps?.transition
6989
- },
6990
7337
  ...componentsProps?.wrapper,
7338
+ pinnableSection: pinnableSection ?? componentsProps?.wrapper?.pinnableSection,
6991
7339
  children: [
6992
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Group, {
7340
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
6993
7341
  justify: "space-between",
6994
7342
  wrap: "nowrap",
6995
7343
  children: [
6996
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Group, {
7344
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
6997
7345
  gap: badgesGap,
6998
7346
  wrap: "nowrap",
6999
7347
  children: [
7000
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Title, {
7348
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Title, {
7001
7349
  order: 1,
7002
7350
  size: "h3",
7003
7351
  lineClamp: 1,
7004
- children: title
7352
+ children: title ?? id
7005
7353
  }, undefined, false, undefined, this),
7006
- badges !== undefined && /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(BadgeGroup, {
7354
+ badges !== undefined && /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(BadgeGroup, {
7007
7355
  badges,
7008
7356
  gap: badgesGap,
7009
7357
  ...componentsProps?.badgeGroup
7010
7358
  }, undefined, false, undefined, this)
7011
7359
  ]
7012
7360
  }, undefined, true, undefined, this),
7013
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Group, {
7361
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Group, {
7014
7362
  gap: buttonsGap,
7015
7363
  wrap: "nowrap",
7016
7364
  children: buttons !== undefined && buttons.map((button, i) => {
@@ -7025,11 +7373,11 @@ function Widget({
7025
7373
  }, undefined, false, undefined, this)
7026
7374
  ]
7027
7375
  }, undefined, true, undefined, this),
7028
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Divider, {
7376
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Divider, {
7029
7377
  my: "md",
7030
7378
  ...componentsProps?.divider
7031
7379
  }, undefined, false, undefined, this),
7032
- /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Stack, {
7380
+ /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Stack, {
7033
7381
  align: "stretch",
7034
7382
  gap: alertsGap,
7035
7383
  mb: alerts && alerts.length > 0 ? "md" : 0,
@@ -7044,20 +7392,20 @@ function Widget({
7044
7392
  });
7045
7393
  })
7046
7394
  }, undefined, false, undefined, this),
7047
- loading ? /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Center, {
7048
- children: /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(import_core17.Loader, {
7395
+ loading ? /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Center, {
7396
+ children: /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core20.Loader, {
7049
7397
  ...componentsProps?.loader
7050
7398
  }, undefined, false, undefined, this)
7051
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime24.jsxDEV(jsx_dev_runtime24.Fragment, {
7399
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(jsx_dev_runtime26.Fragment, {
7052
7400
  children
7053
7401
  }, undefined, false, undefined, this)
7054
7402
  ]
7055
7403
  }, undefined, true, undefined, this);
7056
7404
  }
7057
7405
  // src/core/components/NotFoundPage/index.tsx
7058
- var import_core18 = require("@mantine/core");
7406
+ var import_core21 = require("@mantine/core");
7059
7407
  var import_navigation3 = require("next/navigation");
7060
- var jsx_dev_runtime25 = require("react/jsx-dev-runtime");
7408
+ var jsx_dev_runtime27 = require("react/jsx-dev-runtime");
7061
7409
  function NotFoundPage({
7062
7410
  children,
7063
7411
  message,
@@ -7065,11 +7413,11 @@ function NotFoundPage({
7065
7413
  }) {
7066
7414
  const pathname = import_navigation3.usePathname();
7067
7415
  const theme = useRemoraidTheme();
7068
- return /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(Page, {
7416
+ return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(Page, {
7069
7417
  name: "Not Found",
7070
7418
  ...componentsProps?.page,
7071
7419
  children: [
7072
- /* @__PURE__ */ jsx_dev_runtime25.jsxDEV(import_core18.Alert, {
7420
+ /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(import_core21.Alert, {
7073
7421
  ...theme.alertProps.negative,
7074
7422
  title: "404 - Page Not Found",
7075
7423
  children: message ?? `Could not find page ${pathname}.`
@@ -7079,8 +7427,8 @@ function NotFoundPage({
7079
7427
  }, undefined, true, undefined, this);
7080
7428
  }
7081
7429
  // src/core/components/EnvironmentShell/index.tsx
7082
- var import_core19 = require("@mantine/core");
7083
- var jsx_dev_runtime26 = require("react/jsx-dev-runtime");
7430
+ var import_core22 = require("@mantine/core");
7431
+ var jsx_dev_runtime28 = require("react/jsx-dev-runtime");
7084
7432
  function EnvironmentShell({
7085
7433
  children,
7086
7434
  environment,
@@ -7094,7 +7442,7 @@ function EnvironmentShell({
7094
7442
  const undefinedKeys = Object.keys(environment).filter((key) => environment[key] === undefined);
7095
7443
  const alertTitle = `Please Specify Environment Variable${undefinedKeys.length > 1 ? "s" : ""}`;
7096
7444
  const alertMessage = `Components could not be rendered because the following environment variables are not specified: ${undefinedKeys.join(", ")}.`;
7097
- const alert = /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(import_core19.Alert, {
7445
+ const alert = /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(import_core22.Alert, {
7098
7446
  ...theme.alertProps.neutral,
7099
7447
  title: alertTitle,
7100
7448
  m,
@@ -7102,12 +7450,12 @@ function EnvironmentShell({
7102
7450
  children: message ?? alertMessage
7103
7451
  }, undefined, false, undefined, this);
7104
7452
  if (undefinedKeys.length === 0) {
7105
- return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(jsx_dev_runtime26.Fragment, {
7453
+ return /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(jsx_dev_runtime28.Fragment, {
7106
7454
  children
7107
7455
  }, undefined, false, undefined, this);
7108
7456
  }
7109
7457
  if (withContainer) {
7110
- return /* @__PURE__ */ jsx_dev_runtime26.jsxDEV(PageContainer, {
7458
+ return /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(PageContainer, {
7111
7459
  componentsProps: { container: componentsProps?.container },
7112
7460
  children: alert
7113
7461
  }, undefined, false, undefined, this);
@@ -7115,22 +7463,22 @@ function EnvironmentShell({
7115
7463
  return alert;
7116
7464
  }
7117
7465
  // src/core/components/SettingsWidget/index.tsx
7118
- var import_react14 = require("react");
7119
- var import_icons_react8 = require("@tabler/icons-react");
7466
+ var import_react17 = require("react");
7467
+ var import_icons_react11 = require("@tabler/icons-react");
7120
7468
 
7121
7469
  // src/core/components/SettingsWidget/SaveButton/index.tsx
7122
- var import_icons_react7 = require("@tabler/icons-react");
7123
- var import_core20 = require("@mantine/core");
7124
- var jsx_dev_runtime27 = require("react/jsx-dev-runtime");
7470
+ var import_icons_react10 = require("@tabler/icons-react");
7471
+ var import_core23 = require("@mantine/core");
7472
+ var jsx_dev_runtime29 = require("react/jsx-dev-runtime");
7125
7473
  function SaveButton({
7126
7474
  onSaveChanges,
7127
7475
  insideContainer,
7128
7476
  componentsProps
7129
7477
  }) {
7130
7478
  const settingsWidgetOptions = useSettingsWidgetContext();
7131
- const button = /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(RemoraidButton, {
7479
+ const button = /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(RemoraidButton, {
7132
7480
  label: "Save Changes",
7133
- icon: import_icons_react7.IconDeviceFloppy,
7481
+ icon: import_icons_react10.IconDeviceFloppy,
7134
7482
  onClick: onSaveChanges,
7135
7483
  responsive: false,
7136
7484
  ...componentsProps?.button,
@@ -7143,7 +7491,7 @@ function SaveButton({
7143
7491
  }
7144
7492
  }, undefined, false, undefined, this);
7145
7493
  if (insideContainer !== false) {
7146
- return /* @__PURE__ */ jsx_dev_runtime27.jsxDEV(import_core20.Group, {
7494
+ return /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core23.Group, {
7147
7495
  w: "100%",
7148
7496
  justify: "flex-end",
7149
7497
  mt: "md",
@@ -7155,11 +7503,11 @@ function SaveButton({
7155
7503
  }
7156
7504
 
7157
7505
  // src/core/components/SettingsWidget/index.tsx
7158
- var jsx_dev_runtime28 = require("react/jsx-dev-runtime");
7506
+ var jsx_dev_runtime30 = require("react/jsx-dev-runtime");
7159
7507
  var defaultSettingsWidgetContext = {};
7160
- var settingsWidgetContext = import_react14.createContext(defaultSettingsWidgetContext);
7508
+ var settingsWidgetContext = import_react17.createContext(defaultSettingsWidgetContext);
7161
7509
  var useSettingsWidgetContext = () => {
7162
- return import_react14.useContext(settingsWidgetContext);
7510
+ return import_react17.useContext(settingsWidgetContext);
7163
7511
  };
7164
7512
  function SettingsWidget({
7165
7513
  children,
@@ -7168,9 +7516,9 @@ function SettingsWidget({
7168
7516
  custom,
7169
7517
  widgetProps
7170
7518
  }) {
7171
- return /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(settingsWidgetContext.Provider, {
7519
+ return /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(settingsWidgetContext.Provider, {
7172
7520
  value: { custom, unsavedChanges },
7173
- children: /* @__PURE__ */ jsx_dev_runtime28.jsxDEV(Widget, {
7521
+ children: /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(Widget, {
7174
7522
  title: "Settings",
7175
7523
  id: "settings",
7176
7524
  mt: "md",
@@ -7179,7 +7527,7 @@ function SettingsWidget({
7179
7527
  ...onRestoreDefaultValues ? [
7180
7528
  {
7181
7529
  label: "Restore Default Values",
7182
- icon: import_icons_react8.IconRestore,
7530
+ icon: import_icons_react11.IconRestore,
7183
7531
  onClick: onRestoreDefaultValues,
7184
7532
  componentsProps: { button: { disabled: custom === false } }
7185
7533
  }
@@ -7206,27 +7554,27 @@ var SettingsWidget_default = Object.assign(SettingsWidget, {
7206
7554
  SaveButton
7207
7555
  });
7208
7556
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7209
- var import_react15 = require("react");
7210
- var import_core22 = require("@mantine/core");
7557
+ var import_react18 = require("react");
7558
+ var import_core25 = require("@mantine/core");
7211
7559
 
7212
7560
  // src/core/components/SettingsWidget/SettingsTable/Row/index.tsx
7213
- var import_core21 = require("@mantine/core");
7214
- var jsx_dev_runtime29 = require("react/jsx-dev-runtime");
7561
+ var import_core24 = require("@mantine/core");
7562
+ var jsx_dev_runtime31 = require("react/jsx-dev-runtime");
7215
7563
  function Row({
7216
7564
  children,
7217
7565
  label
7218
7566
  }) {
7219
7567
  const options = useSettingsTableOptions();
7220
- return /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Table.Tr, {
7568
+ return /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core24.Table.Tr, {
7221
7569
  children: [
7222
- /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Table.Th, {
7570
+ /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core24.Table.Th, {
7223
7571
  w: options.leftColumnWidth,
7224
- children: /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Text, {
7572
+ children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core24.Text, {
7225
7573
  size: "sm",
7226
7574
  children: label
7227
7575
  }, undefined, false, undefined, this)
7228
7576
  }, undefined, false, undefined, this),
7229
- /* @__PURE__ */ jsx_dev_runtime29.jsxDEV(import_core21.Table.Td, {
7577
+ /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core24.Table.Td, {
7230
7578
  py: "xs",
7231
7579
  children
7232
7580
  }, undefined, false, undefined, this)
@@ -7235,30 +7583,30 @@ function Row({
7235
7583
  }
7236
7584
 
7237
7585
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7238
- var jsx_dev_runtime30 = require("react/jsx-dev-runtime");
7586
+ var jsx_dev_runtime32 = require("react/jsx-dev-runtime");
7239
7587
  var defaultSettingsTableOptions = {
7240
7588
  leftColumnWidth: "38.2%"
7241
7589
  };
7242
- var settingsTableOptionsContext = import_react15.createContext(defaultSettingsTableOptions);
7590
+ var settingsTableOptionsContext = import_react18.createContext(defaultSettingsTableOptions);
7243
7591
  var useSettingsTableOptions = () => {
7244
- return import_react15.useContext(settingsTableOptionsContext);
7592
+ return import_react18.useContext(settingsTableOptionsContext);
7245
7593
  };
7246
7594
  function SettingsTable({
7247
7595
  leftColumnWidth,
7248
7596
  children: childrenProp
7249
7597
  }) {
7250
- const theme = useRemoraidTheme();
7251
7598
  const children = asChildrenOfType(Row, childrenProp, "Check children passed to 'SettingsTable' component.");
7252
- return /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(settingsTableOptionsContext.Provider, {
7599
+ const theme = useRemoraidTheme();
7600
+ return /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(settingsTableOptionsContext.Provider, {
7253
7601
  value: {
7254
7602
  leftColumnWidth: leftColumnWidth ?? defaultSettingsTableOptions.leftColumnWidth
7255
7603
  },
7256
- children: /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(import_core22.Table, {
7604
+ children: /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(import_core25.Table, {
7257
7605
  bg: theme.transparentBackground,
7258
7606
  withTableBorder: true,
7259
7607
  variant: "vertical",
7260
7608
  layout: "fixed",
7261
- children: /* @__PURE__ */ jsx_dev_runtime30.jsxDEV(import_core22.Table.Tbody, {
7609
+ children: /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(import_core25.Table.Tbody, {
7262
7610
  children
7263
7611
  }, undefined, false, undefined, this)
7264
7612
  }, undefined, false, undefined, this)
@@ -7268,20 +7616,21 @@ var SettingsTable_default = Object.assign(SettingsTable, {
7268
7616
  Row
7269
7617
  });
7270
7618
  // src/core/components/NavbarSettingsWidget/index.tsx
7271
- var import_lodash = __toESM(require_lodash());
7272
- var import_core23 = require("@mantine/core");
7273
- var import_icons_react9 = require("@tabler/icons-react");
7274
- var jsx_dev_runtime31 = require("react/jsx-dev-runtime");
7619
+ var import_lodash5 = __toESM(require_lodash());
7620
+ var import_core26 = require("@mantine/core");
7621
+ var import_icons_react12 = require("@tabler/icons-react");
7622
+ var jsx_dev_runtime33 = require("react/jsx-dev-runtime");
7275
7623
  var defaultNavbarSettingsWidgetId = "navbar-settings";
7276
7624
  function NavbarSettingsWidget({
7277
- additionalRows,
7625
+ additionalRows: additionalRowsProp,
7278
7626
  widgetProps,
7279
7627
  componentsProps
7280
7628
  }) {
7629
+ const additionalRows = additionalRowsProp?.map((additionalRow) => asElementOrPropsOfType(SettingsTable_default.Row, additionalRow, "Check the 'additionalRows' property of 'NavbarSettingsWidget'."));
7281
7630
  const { userExperience, updateUserExperience, initialUserExperience } = useRemoraidUserExperience();
7282
7631
  const app = useRemoraidApp();
7283
7632
  const theme = useRemoraidTheme();
7284
- return /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsWidget_default, {
7633
+ return /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsWidget_default, {
7285
7634
  widgetProps: {
7286
7635
  id: defaultNavbarSettingsWidgetId,
7287
7636
  title: "Navbar Settings",
@@ -7293,13 +7642,13 @@ function NavbarSettingsWidget({
7293
7642
  navbar: initialUserExperience.navbar
7294
7643
  }));
7295
7644
  },
7296
- custom: !import_lodash.isEqual(userExperience.navbar, initialUserExperience.navbar),
7297
- children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsTable_default, {
7645
+ custom: !import_lodash5.isEqual(userExperience.navbar, initialUserExperience.navbar),
7646
+ children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default, {
7298
7647
  ...componentsProps?.table,
7299
7648
  children: [
7300
- /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsTable_default.Row, {
7649
+ /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default.Row, {
7301
7650
  label: "Select which pages you want to display or hide",
7302
- children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Chip.Group, {
7651
+ children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(import_core26.Chip.Group, {
7303
7652
  multiple: true,
7304
7653
  value: app.navigablePages.filter((p) => !userExperience.navbar.hiddenPages.includes(p.href)).map((p) => p.href),
7305
7654
  onChange: (newValue) => {
@@ -7311,12 +7660,12 @@ function NavbarSettingsWidget({
7311
7660
  }
7312
7661
  }));
7313
7662
  },
7314
- children: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Group, {
7663
+ children: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(import_core26.Group, {
7315
7664
  justify: "flex-start",
7316
7665
  gap: "xs",
7317
- children: app.navigablePages.map((p) => ({ ...p, icon: p.icon ?? import_icons_react9.IconLink })).map((p, i) => /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(import_core23.Chip, {
7666
+ children: app.navigablePages.map((p) => ({ ...p, icon: p.icon ?? import_icons_react12.IconLink })).map((p, i) => /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(import_core26.Chip, {
7318
7667
  value: p.href,
7319
- icon: /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(p.icon, {
7668
+ icon: /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(p.icon, {
7320
7669
  ...theme.iconProps.tiny,
7321
7670
  color: theme.primaryColor
7322
7671
  }, undefined, false, undefined, this),
@@ -7330,7 +7679,7 @@ function NavbarSettingsWidget({
7330
7679
  if (isValidElementOfType(SettingsTable_default.Row, row)) {
7331
7680
  return row;
7332
7681
  }
7333
- return /* @__PURE__ */ jsx_dev_runtime31.jsxDEV(SettingsTable_default.Row, {
7682
+ return /* @__PURE__ */ jsx_dev_runtime33.jsxDEV(SettingsTable_default.Row, {
7334
7683
  ...row
7335
7684
  }, i, false, undefined, this);
7336
7685
  })
@@ -7339,8 +7688,8 @@ function NavbarSettingsWidget({
7339
7688
  }, undefined, false, undefined, this);
7340
7689
  }
7341
7690
  // src/core/components/ContextClusterProvider/index.tsx
7342
- var import_react16 = __toESM(require("react"));
7343
- var jsx_dev_runtime32 = require("react/jsx-dev-runtime");
7691
+ var import_react19 = __toESM(require("react"));
7692
+ var jsx_dev_runtime34 = require("react/jsx-dev-runtime");
7344
7693
  var createContextCluster = (generalDefaultValue, staticIds) => {
7345
7694
  const isStaticId = (id) => {
7346
7695
  if (staticIds?.find((staticId) => staticId === id)) {
@@ -7351,16 +7700,16 @@ var createContextCluster = (generalDefaultValue, staticIds) => {
7351
7700
  const contexts = {};
7352
7701
  const defaultValues = {};
7353
7702
  const createContext8 = (id, defaultValue) => {
7354
- const context = import_react16.default.createContext(defaultValue ?? generalDefaultValue);
7703
+ const context = import_react19.default.createContext(defaultValue ?? generalDefaultValue);
7355
7704
  contexts[id] = context;
7356
7705
  defaultValues[id] = defaultValue ?? generalDefaultValue;
7357
7706
  return context;
7358
7707
  };
7359
7708
  const useContext11 = (id) => {
7360
7709
  if (isStaticId(id)) {
7361
- return contexts[id] ? import_react16.default.useContext(contexts[id]) : generalDefaultValue;
7710
+ return contexts[id] ? import_react19.default.useContext(contexts[id]) : generalDefaultValue;
7362
7711
  }
7363
- return contexts[id] ? import_react16.default.useContext(contexts[id]) : null;
7712
+ return contexts[id] ? import_react19.default.useContext(contexts[id]) : null;
7364
7713
  };
7365
7714
  return {
7366
7715
  contexts,
@@ -7375,8 +7724,8 @@ function ContextClusterProvider({
7375
7724
  values = {},
7376
7725
  children
7377
7726
  }) {
7378
- return Object.entries(cluster.contexts).reduceRight((t, [id, context]) => /* @__PURE__ */ jsx_dev_runtime32.jsxDEV(context.Provider, {
7727
+ return Object.entries(cluster.contexts).reduceRight((t, [id, context]) => context ? /* @__PURE__ */ jsx_dev_runtime34.jsxDEV(context.Provider, {
7379
7728
  value: values[id] ?? cluster.defaultValues[id] ?? cluster.generalDefaultValue,
7380
7729
  children: t
7381
- }, undefined, false, undefined, this), children);
7730
+ }, undefined, false, undefined, this) : t, children);
7382
7731
  }