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.
@@ -701,7 +701,7 @@ var require_lodash = __commonJS((exports, module) => {
701
701
  }
702
702
  var runInContext = function runInContext(context) {
703
703
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
704
- var { Array: Array2, Date, Error: Error2, Function: Function2, Math, Object: Object2, RegExp: RegExp2, String, TypeError: TypeError2 } = context;
704
+ var { Array: Array2, Date, Error: Error2, Function: Function2, Math: Math2, Object: Object2, RegExp: RegExp2, String, TypeError: TypeError2 } = context;
705
705
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
706
706
  var coreJsData = context["__core-js_shared__"];
707
707
  var funcToString = funcProto.toString;
@@ -724,7 +724,7 @@ var require_lodash = __commonJS((exports, module) => {
724
724
  } catch (e) {}
725
725
  }();
726
726
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
727
- 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;
727
+ 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;
728
728
  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");
729
729
  var metaMap = WeakMap2 && new WeakMap2;
730
730
  var realNames = {};
@@ -977,7 +977,7 @@ var require_lodash = __commonJS((exports, module) => {
977
977
  }
978
978
  SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
979
979
  SetCache.prototype.has = setCacheHas;
980
- function Stack3(entries) {
980
+ function Stack2(entries) {
981
981
  var data = this.__data__ = new ListCache(entries);
982
982
  this.size = data.size;
983
983
  }
@@ -1011,11 +1011,11 @@ var require_lodash = __commonJS((exports, module) => {
1011
1011
  this.size = data.size;
1012
1012
  return this;
1013
1013
  }
1014
- Stack3.prototype.clear = stackClear;
1015
- Stack3.prototype["delete"] = stackDelete;
1016
- Stack3.prototype.get = stackGet;
1017
- Stack3.prototype.has = stackHas;
1018
- Stack3.prototype.set = stackSet;
1014
+ Stack2.prototype.clear = stackClear;
1015
+ Stack2.prototype["delete"] = stackDelete;
1016
+ Stack2.prototype.get = stackGet;
1017
+ Stack2.prototype.has = stackHas;
1018
+ Stack2.prototype.set = stackSet;
1019
1019
  function arrayLikeKeys(value, inherited) {
1020
1020
  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;
1021
1021
  for (var key in value) {
@@ -1131,7 +1131,7 @@ var require_lodash = __commonJS((exports, module) => {
1131
1131
  result2 = initCloneByTag(value, tag, isDeep);
1132
1132
  }
1133
1133
  }
1134
- stack || (stack = new Stack3);
1134
+ stack || (stack = new Stack2);
1135
1135
  var stacked = stack.get(value);
1136
1136
  if (stacked) {
1137
1137
  return stacked;
@@ -1400,21 +1400,21 @@ var require_lodash = __commonJS((exports, module) => {
1400
1400
  objIsObj = false;
1401
1401
  }
1402
1402
  if (isSameTag && !objIsObj) {
1403
- stack || (stack = new Stack3);
1403
+ stack || (stack = new Stack2);
1404
1404
  return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
1405
1405
  }
1406
1406
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
1407
1407
  var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
1408
1408
  if (objIsWrapped || othIsWrapped) {
1409
1409
  var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
1410
- stack || (stack = new Stack3);
1410
+ stack || (stack = new Stack2);
1411
1411
  return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
1412
1412
  }
1413
1413
  }
1414
1414
  if (!isSameTag) {
1415
1415
  return false;
1416
1416
  }
1417
- stack || (stack = new Stack3);
1417
+ stack || (stack = new Stack2);
1418
1418
  return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
1419
1419
  }
1420
1420
  function baseIsMap(value) {
@@ -1440,7 +1440,7 @@ var require_lodash = __commonJS((exports, module) => {
1440
1440
  return false;
1441
1441
  }
1442
1442
  } else {
1443
- var stack = new Stack3;
1443
+ var stack = new Stack2;
1444
1444
  if (customizer) {
1445
1445
  var result2 = customizer(objValue, srcValue, key, object, source, stack);
1446
1446
  }
@@ -1536,7 +1536,7 @@ var require_lodash = __commonJS((exports, module) => {
1536
1536
  return;
1537
1537
  }
1538
1538
  baseFor(source, function(srcValue, key) {
1539
- stack || (stack = new Stack3);
1539
+ stack || (stack = new Stack2);
1540
1540
  if (isObject(srcValue)) {
1541
1541
  baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
1542
1542
  } else {
@@ -2405,7 +2405,7 @@ var require_lodash = __commonJS((exports, module) => {
2405
2405
  return setWrapToString(result2, func, bitmask);
2406
2406
  }
2407
2407
  function createRound(methodName) {
2408
- var func = Math[methodName];
2408
+ var func = Math2[methodName];
2409
2409
  return function(number, precision) {
2410
2410
  number = toNumber(number);
2411
2411
  precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
@@ -5439,6 +5439,11 @@ import React2, {
5439
5439
  useContext
5440
5440
  } from "react";
5441
5441
  import { jsxDEV } from "react/jsx-dev-runtime";
5442
+ var getDefaultWidgetContext = (configuration) => ({
5443
+ name: configuration.widgetId,
5444
+ selected: true,
5445
+ ...configuration.initialValues
5446
+ });
5442
5447
  var widgetsContext = React2.createContext({
5443
5448
  widgets: {},
5444
5449
  activeWidget: null,
@@ -5454,6 +5459,10 @@ var widgetsContext = React2.createContext({
5454
5459
  var useWidgets = () => {
5455
5460
  return useContext(widgetsContext);
5456
5461
  };
5462
+ var useWidget = (pageId, widgetId) => {
5463
+ const { widgets } = useWidgets();
5464
+ return widgets?.[pageId]?.[widgetId] ?? null;
5465
+ };
5457
5466
  function WidgetsProvider({
5458
5467
  children
5459
5468
  }) {
@@ -5499,13 +5508,10 @@ function WidgetsProvider({
5499
5508
  const registerPage = (pageId, initialWidgets) => {
5500
5509
  setWidgets((prev) => ({
5501
5510
  ...prev,
5502
- [pageId]: initialWidgets.reduce((t, w) => {
5511
+ [pageId]: initialWidgets.reduce((t, widget) => {
5503
5512
  return {
5504
5513
  ...t,
5505
- [w.widgetId]: {
5506
- name: w.name,
5507
- selected: w.initialValue === undefined ? true : w.initialValue
5508
- }
5514
+ [widget.widgetId]: getDefaultWidgetContext(widget)
5509
5515
  };
5510
5516
  }, {})
5511
5517
  }));
@@ -5529,10 +5535,7 @@ function WidgetsProvider({
5529
5535
  ...prev,
5530
5536
  [pageId]: {
5531
5537
  ...prev[pageId],
5532
- [widget.widgetId]: {
5533
- name: widget.name,
5534
- selected: widget.initialValue === undefined ? true : widget.initialValue
5535
- }
5538
+ [widget.widgetId]: getDefaultWidgetContext(widget)
5536
5539
  }
5537
5540
  }));
5538
5541
  };
@@ -5611,14 +5614,45 @@ var FrameLayoutSection;
5611
5614
  FrameLayoutSection2["Right"] = "right";
5612
5615
  FrameLayoutSection2["Content"] = "content";
5613
5616
  })(FrameLayoutSection ||= {});
5614
- var FrameLayoutVariant;
5615
- ((FrameLayoutVariant2) => {
5616
- FrameLayoutVariant2["Plain"] = "plain";
5617
- FrameLayoutVariant2["Sticky"] = "sticky";
5618
- })(FrameLayoutVariant ||= {});
5619
5617
 
5620
5618
  // src/core/lib/utils.ts
5619
+ import {
5620
+ isValidElement
5621
+ } from "react";
5621
5622
  var co = (condition, value, fallback) => condition(value) ? value : fallback;
5623
+ var isValidElementOfType = (type, value) => {
5624
+ return isValidElement(value) && value.type === type;
5625
+ };
5626
+ var getElementTypeName = (type) => {
5627
+ if (typeof type === "string") {
5628
+ return type;
5629
+ }
5630
+ if (typeof type === "function") {
5631
+ return type.displayName ?? type.name ?? "anonymous component";
5632
+ }
5633
+ return "unknown";
5634
+ };
5635
+ var asElementOfType = (type, element, additionalErrorMessage) => {
5636
+ if (isValidElementOfType(type, element)) {
5637
+ return element;
5638
+ }
5639
+ throw new TypeError(`Expected React element of type ${getElementTypeName(type)}, but received type: ${getElementTypeName(element.type)}.${additionalErrorMessage !== undefined && additionalErrorMessage.length > 0 ? ` ${additionalErrorMessage}` : ""}`);
5640
+ };
5641
+ var asChildrenOfType = (type, children, additionalErrorMessage) => {
5642
+ if (children === undefined || children === null) {
5643
+ return children;
5644
+ }
5645
+ if (Array.isArray(children)) {
5646
+ return children.map((child) => asChildrenOfType(type, child, additionalErrorMessage));
5647
+ }
5648
+ return asElementOfType(type, children, additionalErrorMessage);
5649
+ };
5650
+ var asElementOrPropsOfType = (type, elementOrProps, additionalErrorMessage) => {
5651
+ if (isValidElement(elementOrProps)) {
5652
+ return asElementOfType(type, elementOrProps, additionalErrorMessage);
5653
+ }
5654
+ return elementOrProps;
5655
+ };
5622
5656
 
5623
5657
  // src/core/components/RemoraidProvider/ThemeProvider/index.tsx
5624
5658
  import {
@@ -5820,10 +5854,10 @@ function UserExperienceProviderWrapper({
5820
5854
  initialValue
5821
5855
  }) {
5822
5856
  const [cookies, setCookie] = useCookies();
5823
- const initialUserExperience = {
5824
- ...defaultUserExperience,
5825
- ...initialValue
5826
- };
5857
+ let initialUserExperience = defaultUserExperience;
5858
+ if (typeof initialValue === "object" && typeof initialUserExperience === "object") {
5859
+ initialUserExperience = { ...initialUserExperience, ...initialValue };
5860
+ }
5827
5861
  const [userExperience, setUserExperience] = useState3(initialUserExperience);
5828
5862
  const [processedCookie, setProcessedCookie] = useState3(false);
5829
5863
  const updateUserExperience = (p) => {
@@ -5948,7 +5982,7 @@ function RemoraidProvider({
5948
5982
  }, undefined, false, undefined, this);
5949
5983
  }
5950
5984
  // src/core/components/AppShell/index.tsx
5951
- import { Box as Box3 } from "@mantine/core";
5985
+ import { Box as Box2 } from "@mantine/core";
5952
5986
 
5953
5987
  // src/core/components/AppShell/NavbarMinimal/index.tsx
5954
5988
  import {
@@ -6169,7 +6203,6 @@ function FooterMinimal({
6169
6203
  return /* @__PURE__ */ jsxDEV10(Group, {
6170
6204
  justify: "center",
6171
6205
  w: "100%",
6172
- py: "md",
6173
6206
  ...componentsProps?.container,
6174
6207
  children: /* @__PURE__ */ jsxDEV10(IconPennant, {
6175
6208
  size: 50,
@@ -6181,7 +6214,6 @@ function FooterMinimal({
6181
6214
 
6182
6215
  // src/core/components/FrameLayout/index.tsx
6183
6216
  import {
6184
- Box as Box2,
6185
6217
  Group as Group2,
6186
6218
  ScrollArea,
6187
6219
  Stack as Stack2
@@ -6195,252 +6227,318 @@ import {
6195
6227
 
6196
6228
  // src/core/components/FrameLayout/Element/index.tsx
6197
6229
  import { Box, Portal } from "@mantine/core";
6230
+
6231
+ // src/core/lib/errors.ts
6232
+ class InvalidComponentUsageError extends Error {
6233
+ constructor(component, rule) {
6234
+ super(`Invalid usage of '${component}': ${rule}`);
6235
+ this.name = "InvalidComponentUsageError";
6236
+ }
6237
+ }
6238
+
6239
+ // src/core/components/Page/PageContainer/index.tsx
6240
+ import { Container } from "@mantine/core";
6241
+
6242
+ // node_modules/clsx/dist/clsx.mjs
6243
+ function r(e) {
6244
+ var t, f, n = "";
6245
+ if (typeof e == "string" || typeof e == "number")
6246
+ n += e;
6247
+ else if (typeof e == "object")
6248
+ if (Array.isArray(e)) {
6249
+ var o = e.length;
6250
+ for (t = 0;t < o; t++)
6251
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
6252
+ } else
6253
+ for (f in e)
6254
+ e[f] && (n && (n += " "), n += f);
6255
+ return n;
6256
+ }
6257
+ function clsx() {
6258
+ for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
6259
+ (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
6260
+ return n;
6261
+ }
6262
+ var clsx_default = clsx;
6263
+
6264
+ // src/core/components/Page/PageContainer/index.tsx
6198
6265
  import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
6199
- function Element({
6266
+ function PageContainer({
6267
+ children,
6268
+ p = 0,
6269
+ hidden = false,
6270
+ componentsProps
6271
+ }) {
6272
+ const theme = useRemoraidTheme();
6273
+ return /* @__PURE__ */ jsxDEV11(Container, {
6274
+ size: theme.containerSize,
6275
+ p,
6276
+ w: "100%",
6277
+ "data-hidden": hidden,
6278
+ ...componentsProps?.container,
6279
+ className: clsx_default("remoraid-page-container", componentsProps?.container?.className),
6280
+ children
6281
+ }, undefined, false, undefined, this);
6282
+ }
6283
+
6284
+ // src/core/components/FrameLayout/Element/index.tsx
6285
+ var import_lodash = __toESM(require_lodash(), 1);
6286
+ import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
6287
+ function Element2({
6200
6288
  section,
6201
6289
  includeContainer = true,
6290
+ includePageContainer = false,
6202
6291
  layoutId,
6292
+ hidden = false,
6203
6293
  componentsProps,
6204
6294
  children
6205
6295
  }) {
6206
6296
  const { layouts } = useLayouts();
6207
6297
  const closestLayout = useFrameLayout();
6208
- if (closestLayout.layoutId === null) {
6209
- return null;
6298
+ if (!closestLayout) {
6299
+ throw new InvalidComponentUsageError("FrameLayout.Element", "must be used as child of 'FrameLayout'.");
6210
6300
  }
6211
6301
  const layout = layouts[layoutId ?? closestLayout.layoutId];
6212
- if (!isFrameLayout(layout)) {
6302
+ if (!layout) {
6213
6303
  return null;
6214
6304
  }
6215
- if (layout.sections[section] === null) {
6305
+ if (layout.type !== "frame" /* Frame */) {
6306
+ 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.");
6307
+ }
6308
+ if (!layout.sections[section]) {
6216
6309
  return null;
6217
6310
  }
6218
6311
  let containerProps = {};
6219
6312
  if (section === "left" /* Left */ || section === "right" /* Right */) {
6220
6313
  containerProps.h = "100%";
6221
6314
  }
6222
- return /* @__PURE__ */ jsxDEV11(Portal, {
6315
+ const element = includePageContainer ? /* @__PURE__ */ jsxDEV12(PageContainer, {
6316
+ p: 0,
6317
+ hidden,
6318
+ ...componentsProps?.PageContainer,
6319
+ children
6320
+ }, undefined, false, undefined, this) : children;
6321
+ return /* @__PURE__ */ jsxDEV12(Portal, {
6223
6322
  target: layout.sections[section],
6224
- children: includeContainer ? /* @__PURE__ */ jsxDEV11(Box, {
6225
- ...containerProps,
6226
- ...componentsProps?.container,
6227
- children
6228
- }, undefined, false, undefined, this) : children
6323
+ children: includeContainer ? /* @__PURE__ */ jsxDEV12(Box, {
6324
+ "data-hidden": hidden,
6325
+ ...import_lodash.merge(containerProps, componentsProps?.container),
6326
+ className: clsx_default("remoraid-frame-layout-element", containerProps?.className, componentsProps?.container?.className),
6327
+ children: element
6328
+ }, undefined, false, undefined, this) : element
6229
6329
  }, undefined, false, undefined, this);
6230
6330
  }
6231
6331
 
6232
6332
  // src/core/components/FrameLayout/index.tsx
6233
- import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
6234
- var isFrameLayout = (layout) => {
6235
- if (typeof layout !== "object" || layout === null) {
6236
- return false;
6237
- }
6238
- if (!("sections" in layout)) {
6239
- return false;
6240
- }
6241
- if (typeof layout.sections !== "object" || layout.sections === null) {
6242
- return false;
6243
- }
6244
- return true;
6245
- };
6246
- var defaultFrameLayoutVariant = "sticky" /* Sticky */;
6247
- var defaultFrameLayoutContext = {
6248
- layoutId: null,
6249
- layout: {
6250
- sections: {
6251
- ["top" /* Top */]: null,
6252
- ["bottom" /* Bottom */]: null,
6253
- ["left" /* Left */]: null,
6254
- ["right" /* Right */]: null
6255
- }
6256
- },
6257
- setLayout: () => {}
6258
- };
6259
- var layoutContext = createContext5(defaultFrameLayoutContext);
6333
+ import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
6334
+ var layoutContext = createContext5(null);
6260
6335
  var useFrameLayout = () => {
6261
6336
  return useContext7(layoutContext);
6262
6337
  };
6263
6338
  function FrameLayout({
6264
- variant = defaultFrameLayoutVariant,
6265
6339
  layoutId,
6340
+ includeScrollArea = true,
6341
+ gutter = 0,
6266
6342
  componentsProps,
6267
6343
  children
6268
6344
  }) {
6269
6345
  const theme = useRemoraidTheme();
6270
6346
  const { layouts, setLayouts } = useLayouts();
6271
6347
  const layout = layouts[layoutId];
6272
- const setLayout = useMemo3(() => {
6273
- return (value) => {
6274
- setLayouts((prev) => ({
6275
- ...prev,
6276
- [layoutId]: typeof value === "function" ? value(prev[layoutId]) : value
6277
- }));
6278
- };
6279
- }, [layoutId, setLayouts]);
6280
- const topSection = useCallback((n) => {
6281
- setLayout((prev) => ({
6348
+ const defaultSections = useMemo3(() => ({
6349
+ ["bottom" /* Bottom */]: null,
6350
+ ["right" /* Right */]: null,
6351
+ ["top" /* Top */]: null,
6352
+ ["left" /* Left */]: null,
6353
+ ["content" /* Content */]: null
6354
+ }), []);
6355
+ const setSections = useCallback((value) => {
6356
+ setLayouts((prev) => ({
6357
+ ...prev,
6358
+ [layoutId]: {
6359
+ type: "frame" /* Frame */,
6360
+ sections: typeof value === "function" ? value(prev[layoutId]?.sections ?? defaultSections) : value
6361
+ }
6362
+ }));
6363
+ }, [layoutId, setLayouts, defaultSections]);
6364
+ const topSectionRef = useCallback((n) => {
6365
+ setSections((prev) => ({
6282
6366
  ...prev,
6283
- sections: { ...prev?.sections, ["top" /* Top */]: n }
6367
+ ["top" /* Top */]: n
6284
6368
  }));
6285
- }, [setLayout]);
6286
- const bottomSection = useCallback((n) => {
6287
- setLayout((prev) => ({
6369
+ }, [setSections]);
6370
+ const bottomSectionRef = useCallback((n) => {
6371
+ setSections((prev) => ({
6288
6372
  ...prev,
6289
- sections: { ...prev?.sections, ["bottom" /* Bottom */]: n }
6373
+ ["bottom" /* Bottom */]: n
6290
6374
  }));
6291
- }, [setLayout]);
6292
- const leftSection = useCallback((n) => {
6293
- setLayout((prev) => ({
6375
+ }, [setSections]);
6376
+ const leftSectionRef = useCallback((n) => {
6377
+ setSections((prev) => ({
6294
6378
  ...prev,
6295
- sections: { ...prev?.sections, ["left" /* Left */]: n }
6379
+ ["left" /* Left */]: n
6296
6380
  }));
6297
- }, [setLayout]);
6298
- const rightSection = useCallback((n) => {
6299
- setLayout((prev) => ({
6381
+ }, [setSections]);
6382
+ const rightSectionRef = useCallback((n) => {
6383
+ setSections((prev) => ({
6300
6384
  ...prev,
6301
- sections: { ...prev?.sections, ["right" /* Right */]: n }
6385
+ ["right" /* Right */]: n
6302
6386
  }));
6303
- }, [setLayout]);
6304
- let contentSection = children;
6305
- const childrenContainerProps = {
6387
+ }, [setSections]);
6388
+ const contentSectionRef = useCallback((n) => {
6389
+ setSections((prev) => ({
6390
+ ...prev,
6391
+ ["content" /* Content */]: n
6392
+ }));
6393
+ }, [setSections]);
6394
+ const contentSection = /* @__PURE__ */ jsxDEV13(Stack2, {
6395
+ ref: contentSectionRef,
6396
+ h: "100%",
6397
+ gap: gutter,
6306
6398
  flex: 1,
6307
- ...componentsProps?.childrenContainer
6308
- };
6309
- if (variant === "plain" /* Plain */) {
6310
- contentSection = /* @__PURE__ */ jsxDEV12(Box2, {
6311
- ...childrenContainerProps,
6312
- children: contentSection
6313
- }, undefined, false, undefined, this);
6314
- } else if (variant === "sticky" /* Sticky */) {
6315
- contentSection = /* @__PURE__ */ jsxDEV12(ScrollArea, {
6316
- ...theme.scrollAreaProps,
6317
- ...childrenContainerProps,
6318
- children
6319
- }, undefined, false, undefined, this);
6320
- }
6321
- return /* @__PURE__ */ jsxDEV12(layoutContext.Provider, {
6322
- value: { layoutId, layout, setLayout },
6323
- children: /* @__PURE__ */ jsxDEV12(Group2, {
6399
+ ...componentsProps?.sectionContainers?.["content" /* Content */],
6400
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-content-section", componentsProps?.sectionContainers?.["content" /* Content */]?.className),
6401
+ children
6402
+ }, undefined, false, undefined, this);
6403
+ const layoutContextValue = useMemo3(() => ({
6404
+ type: "frame" /* Frame */,
6405
+ sections: defaultSections,
6406
+ ...layout,
6407
+ layoutId
6408
+ }), [layout?.sections, defaultSections, layoutId]);
6409
+ return /* @__PURE__ */ jsxDEV13(layoutContext.Provider, {
6410
+ value: layoutContextValue,
6411
+ children: /* @__PURE__ */ jsxDEV13(Group2, {
6324
6412
  gap: 0,
6325
6413
  h: "100%",
6326
6414
  w: "100%",
6327
6415
  wrap: "nowrap",
6328
6416
  ...componentsProps?.horizontalContainer,
6417
+ style: {
6418
+ "--remoraid-frame-layout-gutter": typeof gutter === "string" ? `var(--mantine-spacing-${gutter})` : `${gutter}px`
6419
+ },
6420
+ className: clsx_default("remoraid-frame-layout", componentsProps?.horizontalContainer?.className),
6329
6421
  children: [
6330
- /* @__PURE__ */ jsxDEV12(Group2, {
6331
- ref: leftSection,
6422
+ /* @__PURE__ */ jsxDEV13(Group2, {
6423
+ ref: leftSectionRef,
6332
6424
  h: "100%",
6333
- gap: 0,
6334
6425
  wrap: "nowrap",
6335
- ...componentsProps?.sectionContainers?.["left" /* Left */]
6426
+ gap: gutter,
6427
+ pr: 0,
6428
+ ...componentsProps?.sectionContainers?.["left" /* Left */],
6429
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["left" /* Left */]?.className)
6336
6430
  }, undefined, false, undefined, this),
6337
- /* @__PURE__ */ jsxDEV12(Stack2, {
6431
+ /* @__PURE__ */ jsxDEV13(Stack2, {
6338
6432
  h: "100%",
6339
6433
  flex: 1,
6340
6434
  gap: 0,
6341
6435
  ...componentsProps?.verticalContainer,
6436
+ className: clsx_default("remoraid-frame-layout-vertical-container", componentsProps?.verticalContainer?.className),
6342
6437
  children: [
6343
- /* @__PURE__ */ jsxDEV12(Stack2, {
6344
- h: "100%",
6345
- ref: topSection,
6346
- gap: 0,
6438
+ /* @__PURE__ */ jsxDEV13(Stack2, {
6439
+ ref: topSectionRef,
6440
+ gap: gutter,
6347
6441
  flex: 0,
6348
- ...componentsProps?.sectionContainers?.["top" /* Top */]
6442
+ ...componentsProps?.sectionContainers?.["top" /* Top */],
6443
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-top-section", componentsProps?.sectionContainers?.["top" /* Top */]?.className)
6349
6444
  }, undefined, false, undefined, this),
6350
- contentSection,
6351
- /* @__PURE__ */ jsxDEV12(Stack2, {
6352
- h: "100%",
6353
- ref: bottomSection,
6354
- gap: 0,
6445
+ includeScrollArea ? /* @__PURE__ */ jsxDEV13(ScrollArea, {
6446
+ flex: 1,
6447
+ ...theme.scrollAreaProps,
6448
+ ...componentsProps?.ScrollArea,
6449
+ children: contentSection
6450
+ }, undefined, false, undefined, this) : contentSection,
6451
+ /* @__PURE__ */ jsxDEV13(Stack2, {
6452
+ ref: bottomSectionRef,
6453
+ gap: gutter,
6355
6454
  flex: 0,
6356
- ...componentsProps?.sectionContainers?.["bottom" /* Bottom */]
6455
+ ...componentsProps?.sectionContainers?.["bottom" /* Bottom */],
6456
+ className: clsx_default("remoraid-frame-layout-section", "remoraid-frame-layout-bottom-section", componentsProps?.sectionContainers?.["bottom" /* Bottom */]?.className)
6357
6457
  }, undefined, false, undefined, this)
6358
6458
  ]
6359
6459
  }, undefined, true, undefined, this),
6360
- /* @__PURE__ */ jsxDEV12(Group2, {
6361
- gap: 0,
6362
- ref: rightSection,
6460
+ /* @__PURE__ */ jsxDEV13(Group2, {
6461
+ ref: rightSectionRef,
6363
6462
  h: "100%",
6463
+ gap: gutter,
6464
+ pl: 0,
6364
6465
  wrap: "nowrap",
6365
- ...componentsProps?.sectionContainers?.["right" /* Right */]
6466
+ ...componentsProps?.sectionContainers?.["right" /* Right */],
6467
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["right" /* Right */]?.className)
6366
6468
  }, undefined, false, undefined, this)
6367
6469
  ]
6368
6470
  }, undefined, true, undefined, this)
6369
6471
  }, undefined, false, undefined, this);
6370
6472
  }
6371
6473
  var FrameLayout_default = Object.assign(FrameLayout, {
6372
- Element
6474
+ Element: Element2
6373
6475
  });
6374
6476
 
6375
6477
  // src/core/components/AppShell/index.tsx
6376
- import { jsxDEV as jsxDEV13, Fragment as Fragment2 } from "react/jsx-dev-runtime";
6377
- var defaultAppShellLayoutId = "remoraidAppShell";
6378
- var defaultProps = {
6379
- navbarVariant: null,
6380
- footerVariant: null
6381
- };
6382
- function AppShell(props) {
6383
- const {
6384
- children,
6385
- navbarVariant,
6386
- footerVariant,
6387
- navbarPosition,
6388
- footerPosition,
6389
- appContext: appContext2,
6390
- componentsProps
6391
- } = {
6392
- ...defaultProps,
6393
- ...props
6394
- };
6478
+ var import_lodash2 = __toESM(require_lodash(), 1);
6479
+ import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
6480
+ var remoraidAppShellLayoutId = "remoraid-app-shell";
6481
+ var defaultAppShellNavbarPositions = { ["minimal" /* Minimal */]: "left" /* Left */ };
6482
+ var defaultAppShellFooterPositions = { ["minimal" /* Minimal */]: "content" /* Content */ };
6483
+ function AppShell({
6484
+ navbarVariant: navbarVariantProp,
6485
+ footerVariant: footerVariantProp,
6486
+ navbarPosition: navbarPositionProp,
6487
+ footerPosition: footerPositionProp,
6488
+ gutter = "md",
6489
+ appContext: appContext2,
6490
+ componentsProps,
6491
+ children
6492
+ }) {
6493
+ const navbarVariant = navbarVariantProp ?? null;
6494
+ const footerVariant = footerVariantProp ?? null;
6495
+ const navbarPosition = navbarPositionProp ?? (navbarVariant === null ? null : defaultAppShellNavbarPositions[navbarVariant]);
6496
+ const footerPosition = footerPositionProp ?? (footerVariant === null ? null : defaultAppShellFooterPositions[footerVariant]);
6395
6497
  let navbar;
6396
6498
  let footer;
6397
- let navbarContainerProps = {};
6398
- let footerContainerProps = {};
6499
+ let navbarLayoutElementProps = {
6500
+ includeContainer: false
6501
+ };
6502
+ let footerLayoutElementProps = {
6503
+ includeContainer: true,
6504
+ componentsProps: { container: { style: { order: 1 } } }
6505
+ };
6399
6506
  if (navbarVariant === "minimal" /* Minimal */) {
6400
- navbar = /* @__PURE__ */ jsxDEV13(NavbarMinimal, {
6507
+ navbar = /* @__PURE__ */ jsxDEV14(NavbarMinimal, {
6401
6508
  ...componentsProps?.navbar
6402
6509
  }, undefined, false, undefined, this);
6403
- navbarContainerProps.py = "md";
6404
- if (navbarPosition === "left" /* Left */) {
6405
- navbarContainerProps.pl = "md";
6406
- } else if (navbarPosition === "right" /* Right */) {
6407
- navbarContainerProps.pr = "md";
6408
- }
6409
6510
  }
6410
6511
  if (footerVariant === "minimal" /* Minimal */) {
6411
- footer = /* @__PURE__ */ jsxDEV13(FooterMinimal, {
6512
+ footer = /* @__PURE__ */ jsxDEV14(FooterMinimal, {
6412
6513
  ...componentsProps?.footer
6413
6514
  }, undefined, false, undefined, this);
6414
6515
  }
6415
- return /* @__PURE__ */ jsxDEV13(AppProvider, {
6516
+ return /* @__PURE__ */ jsxDEV14(AppProvider, {
6416
6517
  appContext: appContext2,
6417
6518
  ...componentsProps?.AppProvider,
6418
- children: /* @__PURE__ */ jsxDEV13(FrameLayout_default, {
6419
- layoutId: defaultAppShellLayoutId,
6420
- ...componentsProps?.layout,
6421
- children: [
6422
- navbarPosition !== undefined && navbarPosition !== "content" /* Content */ && /* @__PURE__ */ jsxDEV13(FrameLayout_default.Element, {
6423
- section: navbarPosition,
6424
- componentsProps: { container: { ...navbarContainerProps } },
6425
- children: navbar
6426
- }, undefined, false, undefined, this),
6427
- footerPosition !== undefined && footerPosition !== "content" /* Content */ && /* @__PURE__ */ jsxDEV13(FrameLayout_default.Element, {
6428
- section: footerPosition,
6429
- componentsProps: { container: { ...footerContainerProps } },
6430
- children: footer
6431
- }, undefined, false, undefined, this),
6432
- navbarPosition !== undefined && navbarPosition === "content" /* Content */ && /* @__PURE__ */ jsxDEV13(Fragment2, {
6433
- children: navbar
6434
- }, undefined, false, undefined, this),
6435
- /* @__PURE__ */ jsxDEV13(Box3, {
6436
- ...componentsProps?.childrenContainer,
6437
- children
6438
- }, undefined, false, undefined, this),
6439
- footerPosition !== undefined && footerPosition === "content" /* Content */ && /* @__PURE__ */ jsxDEV13(Fragment2, {
6440
- children: footer
6441
- }, undefined, false, undefined, this)
6442
- ]
6443
- }, undefined, true, undefined, this)
6519
+ children: /* @__PURE__ */ jsxDEV14(Box2, {
6520
+ h: "100vh",
6521
+ ...componentsProps?.container,
6522
+ children: /* @__PURE__ */ jsxDEV14(FrameLayout_default, {
6523
+ layoutId: remoraidAppShellLayoutId,
6524
+ gutter,
6525
+ ...componentsProps?.layout,
6526
+ children: [
6527
+ navbarPosition !== null && /* @__PURE__ */ jsxDEV14(FrameLayout_default.Element, {
6528
+ section: navbarPosition,
6529
+ includeContainer: false,
6530
+ ...import_lodash2.merge(navbarLayoutElementProps, componentsProps?.navbarLayoutElement),
6531
+ children: navbar
6532
+ }, undefined, false, undefined, this),
6533
+ children,
6534
+ footerPosition !== null && /* @__PURE__ */ jsxDEV14(FrameLayout_default.Element, {
6535
+ section: footerPosition,
6536
+ ...import_lodash2.merge(footerLayoutElementProps, componentsProps?.footerLayoutElement),
6537
+ children: footer
6538
+ }, undefined, false, undefined, this)
6539
+ ]
6540
+ }, undefined, true, undefined, this)
6541
+ }, undefined, false, undefined, this)
6444
6542
  }, undefined, false, undefined, this);
6445
6543
  }
6446
6544
  var AppShell_default = Object.assign(AppShell, {
@@ -6456,25 +6554,6 @@ import React6, {
6456
6554
  useEffect as useEffect3
6457
6555
  } from "react";
6458
6556
  import { usePathname as usePathname2 } from "next/navigation";
6459
-
6460
- // src/core/components/Page/PageContainer/index.tsx
6461
- import { Container } from "@mantine/core";
6462
- import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
6463
- function PageContainer({
6464
- children,
6465
- pt,
6466
- componentsProps
6467
- }) {
6468
- const theme = useRemoraidTheme();
6469
- return /* @__PURE__ */ jsxDEV14(Container, {
6470
- size: theme.containerSize,
6471
- pt: pt ?? "md",
6472
- ...componentsProps?.container,
6473
- children
6474
- }, undefined, false, undefined, this);
6475
- }
6476
-
6477
- // src/core/components/Page/index.tsx
6478
6557
  import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
6479
6558
  var pageContext = React6.createContext(null);
6480
6559
  var usePage = () => {
@@ -6484,7 +6563,7 @@ function Page({
6484
6563
  children,
6485
6564
  name,
6486
6565
  config,
6487
- pt,
6566
+ p = 0,
6488
6567
  componentsProps
6489
6568
  }) {
6490
6569
  const pathname = usePathname2();
@@ -6500,7 +6579,7 @@ function Page({
6500
6579
  return /* @__PURE__ */ jsxDEV15(pageContext.Provider, {
6501
6580
  value: { name: name ?? pathname, pageId, ...config },
6502
6581
  children: /* @__PURE__ */ jsxDEV15(PageContainer, {
6503
- pt,
6582
+ p,
6504
6583
  componentsProps: { container: componentsProps?.container },
6505
6584
  children
6506
6585
  }, undefined, false, undefined, this)
@@ -6522,8 +6601,9 @@ function ScrollableChipGroup({
6522
6601
  onChange,
6523
6602
  gap,
6524
6603
  componentsProps,
6525
- children
6604
+ children: childrenProp
6526
6605
  }) {
6606
+ const children = asChildrenOfType(Chip, childrenProp, "Check children passed to 'ScrollableChipGroup' component.");
6527
6607
  const theme = useRemoraidTheme();
6528
6608
  return /* @__PURE__ */ jsxDEV16(ScrollArea2, {
6529
6609
  ...theme.scrollAreaProps,
@@ -6553,12 +6633,12 @@ function WidgetSelectionHeader({
6553
6633
  mt
6554
6634
  }) {
6555
6635
  const theme = useRemoraidTheme();
6556
- const { widgets, isPageRegistered, updateWidgetSelectionBulk } = useWidgets();
6636
+ const { isPageRegistered, updateWidgetSelectionBulk, ...widgetsContext2 } = useWidgets();
6557
6637
  const page = usePage();
6558
6638
  if (!page) {
6559
- console.error("'WidgetSelectionHeader' must be rendered inside of a 'Page' component.");
6560
- return null;
6639
+ throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
6561
6640
  }
6641
+ const widgets = widgetsContext2.widgets[page.pageId] ?? {};
6562
6642
  return /* @__PURE__ */ jsxDEV17(Flex3, {
6563
6643
  justify: "flex-start",
6564
6644
  align: "center",
@@ -6574,94 +6654,60 @@ function WidgetSelectionHeader({
6574
6654
  orientation: "vertical"
6575
6655
  }, undefined, false, undefined, this),
6576
6656
  isPageRegistered(page.pageId) && /* @__PURE__ */ jsxDEV17(ScrollableChipGroup, {
6577
- value: Object.keys(widgets[page.pageId]).filter((widgetId) => widgets[page.pageId][widgetId].selected),
6657
+ value: Object.keys(widgets).filter((widgetId) => widgets[widgetId]?.selected),
6578
6658
  onChange: (value) => {
6579
6659
  updateWidgetSelectionBulk(page.pageId, value);
6580
6660
  },
6581
6661
  componentsProps: { scrollArea: { flex: 1 } },
6582
- children: Object.keys(widgets[page.pageId]).map((widgetId) => /* @__PURE__ */ jsxDEV17(Chip2, {
6583
- value: widgetId,
6584
- size: "sm",
6585
- disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6586
- icon: /* @__PURE__ */ jsxDEV17(IconCheck, {
6587
- ...theme.iconProps.tiny
6588
- }, undefined, false, undefined, this),
6589
- children: widgets[page.pageId][widgetId].name
6590
- }, widgetId, false, undefined, this))
6662
+ children: Object.keys(widgets).map((widgetId) => {
6663
+ const widget = widgets[widgetId] ?? getDefaultWidgetContext({ widgetId });
6664
+ return /* @__PURE__ */ jsxDEV17(Chip2, {
6665
+ value: widgetId,
6666
+ size: "sm",
6667
+ disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6668
+ icon: /* @__PURE__ */ jsxDEV17(IconCheck, {
6669
+ ...theme.iconProps.tiny
6670
+ }, undefined, false, undefined, this),
6671
+ children: widget.name
6672
+ }, widgetId, false, undefined, this);
6673
+ })
6591
6674
  }, undefined, false, undefined, this)
6592
6675
  ]
6593
6676
  }, undefined, true, undefined, this);
6594
6677
  }
6595
- // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
6596
- import { ActionIcon, Transition } from "@mantine/core";
6597
- import { IconX } from "@tabler/icons-react";
6598
- import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
6599
- function CloseButton({ widgetId }) {
6600
- const theme = useRemoraidTheme();
6601
- const { activeWidget, updateWidgetSelection } = useWidgets();
6602
- const page = usePage();
6603
- return /* @__PURE__ */ jsxDEV18(Transition, {
6604
- mounted: activeWidget === widgetId,
6605
- transition: "pop-top-right",
6606
- duration: theme.transitionDurations.short,
6607
- timingFunction: "ease",
6608
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV18(ActionIcon, {
6609
- pos: "absolute",
6610
- size: "xs",
6611
- className: "remoraid-close-button",
6612
- radius: "xl",
6613
- color: "red",
6614
- onClick: () => {
6615
- if (!page) {
6616
- return;
6617
- }
6618
- updateWidgetSelection(page.pageId, widgetId, false);
6619
- },
6620
- style: transitionStyle,
6621
- children: /* @__PURE__ */ jsxDEV18(IconX, {
6622
- ...theme.iconProps.tiny
6623
- }, undefined, false, undefined, this)
6624
- }, undefined, false, undefined, this)
6625
- }, undefined, false, undefined, this);
6626
- }
6627
6678
  // src/core/components/BadgeGroup/index.tsx
6628
6679
  import {
6629
6680
  Badge as Badge2,
6630
6681
  Group as Group3,
6631
6682
  Tooltip as Tooltip3
6632
6683
  } from "@mantine/core";
6633
- import React7 from "react";
6684
+ import React7, { isValidElement as isValidElement2 } from "react";
6634
6685
 
6635
6686
  // src/core/components/BadgeMinimal/index.tsx
6636
6687
  import {
6637
6688
  Badge,
6638
6689
  Tooltip as Tooltip2,
6639
- Transition as Transition2
6690
+ Transition
6640
6691
  } from "@mantine/core";
6641
- import { jsxDEV as jsxDEV19 } from "react/jsx-dev-runtime";
6642
- var isBadgeMinimalProps = (e) => {
6643
- if (typeof e !== "object") {
6644
- return false;
6645
- }
6646
- if (!("label" in e)) {
6647
- return false;
6648
- }
6649
- return true;
6650
- };
6651
- function BadgeMinimal(props) {
6652
- const { label, tooltip, mounted, componentsProps } = props;
6692
+ import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
6693
+ function BadgeMinimal({
6694
+ label,
6695
+ tooltip,
6696
+ mounted = true,
6697
+ componentsProps
6698
+ }) {
6653
6699
  const theme = useRemoraidTheme();
6654
- return /* @__PURE__ */ jsxDEV19(Transition2, {
6655
- mounted: mounted !== false,
6700
+ return /* @__PURE__ */ jsxDEV18(Transition, {
6701
+ mounted,
6656
6702
  transition: "fade",
6657
6703
  duration: theme.transitionDurations.short,
6658
6704
  timingFunction: "ease",
6659
6705
  ...componentsProps?.transition,
6660
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV19(Tooltip2, {
6706
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV18(Tooltip2, {
6661
6707
  disabled: !tooltip,
6662
6708
  label: tooltip,
6663
6709
  ...componentsProps?.tooltip,
6664
- children: /* @__PURE__ */ jsxDEV19(Badge, {
6710
+ children: /* @__PURE__ */ jsxDEV18(Badge, {
6665
6711
  variant: "default",
6666
6712
  ...componentsProps?.badge,
6667
6713
  style: {
@@ -6676,36 +6722,39 @@ function BadgeMinimal(props) {
6676
6722
  }
6677
6723
 
6678
6724
  // src/core/components/BadgeGroup/index.tsx
6679
- import { jsxDEV as jsxDEV20, Fragment as Fragment3 } from "react/jsx-dev-runtime";
6725
+ import { jsxDEV as jsxDEV19, Fragment as Fragment2 } from "react/jsx-dev-runtime";
6680
6726
  import { createElement } from "react";
6681
6727
  function BadgeGroup({
6682
- badges,
6728
+ badges: badgesProp,
6683
6729
  gap,
6684
6730
  breakpoint,
6685
6731
  componentsProps
6686
6732
  }) {
6687
6733
  const theme = useRemoraidTheme();
6688
- const numVisibleBadges = badges.filter((e) => isBadgeMinimalProps(e) ? e.mounted !== false : true).length;
6689
- return /* @__PURE__ */ jsxDEV20(Fragment3, {
6734
+ const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
6735
+ const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
6736
+ return /* @__PURE__ */ jsxDEV19(Fragment2, {
6690
6737
  children: [
6691
- /* @__PURE__ */ jsxDEV20(Group3, {
6738
+ /* @__PURE__ */ jsxDEV19(Group3, {
6692
6739
  gap: gap ?? "xs",
6693
6740
  wrap: "nowrap",
6694
6741
  visibleFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
6695
- children: badges.map((e, i) => {
6696
- if (isBadgeMinimalProps(e)) {
6697
- return /* @__PURE__ */ createElement(BadgeMinimal, {
6698
- ...e,
6699
- key: i
6700
- });
6701
- }
6702
- return e;
6742
+ children: badges.map((badge, i) => {
6743
+ if (isValidElementOfType(BadgeMinimal, badge)) {
6744
+ return badge;
6745
+ } else if (isValidElement2(badge)) {
6746
+ 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.`);
6747
+ }
6748
+ return /* @__PURE__ */ createElement(BadgeMinimal, {
6749
+ ...badge,
6750
+ key: i
6751
+ });
6703
6752
  })
6704
6753
  }, undefined, false, undefined, this),
6705
- /* @__PURE__ */ jsxDEV20(Tooltip3, {
6754
+ /* @__PURE__ */ jsxDEV19(Tooltip3, {
6706
6755
  label: `${numVisibleBadges} badge${numVisibleBadges === 1 ? "" : "s"}`,
6707
6756
  ...componentsProps?.tooltip,
6708
- children: /* @__PURE__ */ jsxDEV20(Badge2, {
6757
+ children: /* @__PURE__ */ jsxDEV19(Badge2, {
6709
6758
  hiddenFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
6710
6759
  hidden: numVisibleBadges === 0,
6711
6760
  variant: "light",
@@ -6721,37 +6770,28 @@ function BadgeGroup({
6721
6770
  // src/core/components/AlertMinimal/index.tsx
6722
6771
  import {
6723
6772
  Alert,
6724
- Transition as Transition3
6773
+ Transition as Transition2
6725
6774
  } from "@mantine/core";
6726
- import { jsxDEV as jsxDEV21 } from "react/jsx-dev-runtime";
6727
- var isAlertMinimalProps = (e) => {
6728
- if (typeof e !== "object") {
6729
- return false;
6730
- }
6731
- if (!("category" in e)) {
6732
- return false;
6733
- }
6734
- return true;
6735
- };
6775
+ import { jsxDEV as jsxDEV20 } from "react/jsx-dev-runtime";
6736
6776
  function AlertMinimal({
6737
- children,
6738
6777
  title,
6739
6778
  category,
6740
6779
  text,
6741
6780
  onClose,
6742
- mounted,
6781
+ mounted = true,
6743
6782
  mt,
6744
6783
  mb,
6745
- componentsProps
6784
+ componentsProps,
6785
+ children
6746
6786
  }) {
6747
6787
  const theme = useRemoraidTheme();
6748
- return /* @__PURE__ */ jsxDEV21(Transition3, {
6788
+ return /* @__PURE__ */ jsxDEV20(Transition2, {
6749
6789
  mounted: mounted !== false,
6750
6790
  transition: "fade",
6751
6791
  duration: theme.transitionDurations.short,
6752
6792
  timingFunction: "ease",
6753
6793
  ...componentsProps?.transition,
6754
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV21(Alert, {
6794
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV20(Alert, {
6755
6795
  ...theme.alertProps[category],
6756
6796
  title: title ?? theme.alertProps[category].title,
6757
6797
  withCloseButton: onClose !== undefined,
@@ -6772,233 +6812,589 @@ function AlertMinimal({
6772
6812
  }
6773
6813
  // src/core/components/RemoraidButton/index.tsx
6774
6814
  import {
6775
- ActionIcon as ActionIcon2,
6815
+ ActionIcon,
6776
6816
  Button,
6777
- Tooltip as Tooltip4
6817
+ Tooltip as Tooltip4,
6818
+ Transition as Transition3
6778
6819
  } from "@mantine/core";
6779
6820
  import { IconClick } from "@tabler/icons-react";
6780
- import { jsxDEV as jsxDEV22, Fragment as Fragment4 } from "react/jsx-dev-runtime";
6781
- var isRemoraidButtonProps = (e) => {
6782
- if (typeof e !== "object") {
6783
- return false;
6784
- }
6785
- if (!("label" in e)) {
6786
- return false;
6787
- }
6788
- return true;
6789
- };
6821
+ import { createElement as createElement2 } from "react";
6822
+ import { jsxDEV as jsxDEV21, Fragment as Fragment3 } from "react/jsx-dev-runtime";
6790
6823
  function RemoraidButton({
6791
6824
  label,
6792
- responsive,
6793
- breakpoint,
6794
- collapsed,
6825
+ responsive: ResponsiveProp,
6826
+ breakpoint: breakpointProp,
6827
+ collapsed: collapsedProp,
6795
6828
  size,
6796
6829
  color,
6797
6830
  onClick,
6798
6831
  loading,
6799
- variant,
6800
- componentsProps,
6801
- ...props
6832
+ variant = "default",
6833
+ mounted = true,
6834
+ icon: iconProp,
6835
+ iconSize = "medium" /* Medium */,
6836
+ componentsProps
6802
6837
  }) {
6838
+ const responsive = ResponsiveProp ?? true;
6839
+ const breakpoint = breakpointProp ?? "md";
6840
+ const collapsed = collapsedProp ?? false;
6841
+ const icon = iconProp ?? IconClick;
6803
6842
  const theme = useRemoraidTheme();
6804
- const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
6805
- const icon = props.icon ? /* @__PURE__ */ jsxDEV22(props.icon, {
6806
- ...iconProps
6807
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV22(IconClick, {
6808
- ...iconProps
6809
- }, undefined, false, undefined, this);
6810
- return /* @__PURE__ */ jsxDEV22(Fragment4, {
6811
- children: [
6812
- /* @__PURE__ */ jsxDEV22(Tooltip4, {
6813
- label,
6814
- ...componentsProps?.tooltip,
6815
- children: /* @__PURE__ */ jsxDEV22(ActionIcon2, {
6816
- "aria-label": label,
6817
- variant: variant ?? "default",
6843
+ const iconProps = { ...theme.iconProps[iconSize], ...componentsProps?.icon };
6844
+ const iconElement = createElement2(icon, iconProps);
6845
+ return /* @__PURE__ */ jsxDEV21(Transition3, {
6846
+ mounted,
6847
+ transition: "fade",
6848
+ duration: theme.transitionDurations.short,
6849
+ timingFunction: "ease",
6850
+ ...componentsProps?.transition,
6851
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV21(Fragment3, {
6852
+ children: [
6853
+ /* @__PURE__ */ jsxDEV21(Tooltip4, {
6854
+ label,
6855
+ ...componentsProps?.tooltip,
6856
+ children: /* @__PURE__ */ jsxDEV21(ActionIcon, {
6857
+ "aria-label": label,
6858
+ variant,
6859
+ onClick,
6860
+ loading,
6861
+ size: size ? `input-${size}` : "input-sm",
6862
+ color,
6863
+ ...componentsProps?.button,
6864
+ ...componentsProps?.ActionIcon,
6865
+ hiddenFrom: !responsive ? undefined : breakpoint,
6866
+ display: !responsive && !collapsed ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6867
+ style: {
6868
+ ...transitionStyle,
6869
+ ...componentsProps?.ActionIcon?.style ?? componentsProps?.button?.style
6870
+ },
6871
+ children: iconElement
6872
+ }, undefined, false, undefined, this)
6873
+ }, undefined, false, undefined, this),
6874
+ /* @__PURE__ */ jsxDEV21(Button, {
6818
6875
  onClick,
6819
6876
  loading,
6820
- size: size ? `input-${size}` : "input-sm",
6877
+ variant,
6878
+ size,
6821
6879
  color,
6880
+ leftSection: iconProp ? iconElement : undefined,
6822
6881
  ...componentsProps?.button,
6823
- ...componentsProps?.ActionIcon,
6824
- hiddenFrom: responsive === false ? undefined : breakpoint ?? "md",
6825
- display: responsive === false && collapsed !== true ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6826
- children: icon
6882
+ ...componentsProps?.Button,
6883
+ visibleFrom: !responsive ? undefined : breakpoint,
6884
+ display: !responsive && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6885
+ style: {
6886
+ ...transitionStyle,
6887
+ ...componentsProps?.Button?.style ?? componentsProps?.button?.style
6888
+ },
6889
+ children: label
6827
6890
  }, undefined, false, undefined, this)
6828
- }, undefined, false, undefined, this),
6829
- /* @__PURE__ */ jsxDEV22(Button, {
6830
- onClick,
6831
- loading,
6832
- variant: variant ?? "default",
6891
+ ]
6892
+ }, undefined, true, undefined, this)
6893
+ }, undefined, false, undefined, this);
6894
+ }
6895
+ // src/core/components/Controls/ControlButton/index.tsx
6896
+ import {
6897
+ ActionIcon as ActionIcon2,
6898
+ Tooltip as Tooltip5,
6899
+ Transition as Transition4
6900
+ } from "@mantine/core";
6901
+ import { IconClick as IconClick2 } from "@tabler/icons-react";
6902
+ import { jsxDEV as jsxDEV22 } from "react/jsx-dev-runtime";
6903
+ function ControlButton({
6904
+ icon: Icon4 = IconClick2,
6905
+ mounted = true,
6906
+ size = "xs",
6907
+ iconSize = "tiny" /* Tiny */,
6908
+ onClick,
6909
+ order,
6910
+ color,
6911
+ tooltip,
6912
+ componentsProps
6913
+ }) {
6914
+ const theme = useRemoraidTheme();
6915
+ return /* @__PURE__ */ jsxDEV22(Transition4, {
6916
+ mounted,
6917
+ transition: "pop-top-right",
6918
+ duration: theme.transitionDurations.short,
6919
+ timingFunction: "ease",
6920
+ ...componentsProps?.transition,
6921
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV22(Tooltip5, {
6922
+ label: tooltip,
6923
+ disabled: !Boolean(tooltip),
6924
+ ...componentsProps?.tooltip,
6925
+ children: /* @__PURE__ */ jsxDEV22(ActionIcon2, {
6926
+ "data-control-button": true,
6833
6927
  size,
6834
6928
  color,
6835
- leftSection: props.icon ? icon : undefined,
6929
+ onClick,
6930
+ radius: "xl",
6836
6931
  ...componentsProps?.button,
6837
- ...componentsProps?.Button,
6838
- visibleFrom: responsive === false ? undefined : breakpoint ?? "md",
6839
- display: responsive === false && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6840
- children: label
6932
+ style: {
6933
+ ...transitionStyle,
6934
+ order,
6935
+ ...componentsProps?.button?.style
6936
+ },
6937
+ children: /* @__PURE__ */ jsxDEV22(Icon4, {
6938
+ ...theme.iconProps[iconSize],
6939
+ ...componentsProps?.icon
6940
+ }, undefined, false, undefined, this)
6841
6941
  }, undefined, false, undefined, this)
6842
- ]
6843
- }, undefined, true, undefined, this);
6942
+ }, undefined, false, undefined, this)
6943
+ }, undefined, false, undefined, this);
6844
6944
  }
6845
- // src/core/components/Widget/WidgetWrapper/index.tsx
6945
+
6946
+ // src/core/components/Controls/index.tsx
6947
+ import { useRef, useState as useState6 } from "react";
6846
6948
  import {
6949
+ Group as Group4,
6847
6950
  Paper as Paper2,
6848
- Transition as Transition4
6951
+ Transition as Transition5
6849
6952
  } from "@mantine/core";
6850
- import { useEffect as useEffect4 } from "react";
6953
+ import { IconGripHorizontal } from "@tabler/icons-react";
6954
+ var import_lodash3 = __toESM(require_lodash(), 1);
6851
6955
  import { jsxDEV as jsxDEV23 } from "react/jsx-dev-runtime";
6956
+ function Controls({
6957
+ groupRef,
6958
+ mounted = true,
6959
+ dragContainerRef,
6960
+ gutter = 5,
6961
+ iconSize = "tiny" /* Tiny */,
6962
+ additionalButtons: additionalButtonsProp,
6963
+ componentsProps,
6964
+ children: childrenProp
6965
+ }) {
6966
+ const additionalButtons = additionalButtonsProp?.map((additionalButton) => asElementOrPropsOfType(ControlButton, additionalButton, "Check the 'additionalButtons' property of 'Controls'."));
6967
+ const children = asChildrenOfType(ControlButton, childrenProp, "Check children passed to 'Controls' component.");
6968
+ const theme = useRemoraidTheme();
6969
+ const [pos, setPos] = useState6({
6970
+ x: 0,
6971
+ y: 0
6972
+ });
6973
+ const offsetRef = useRef({ x: 0, y: 0 });
6974
+ const containerRef = useRef(null);
6975
+ const clamp = (v, min, max) => {
6976
+ return Math.min(Math.max(v, min), max);
6977
+ };
6978
+ const handlePointerDown = (e) => {
6979
+ if (e.target instanceof Element && e.target.closest("button,[data-control-button]")) {
6980
+ return;
6981
+ }
6982
+ if (!containerRef.current) {
6983
+ return;
6984
+ }
6985
+ const paperRect = containerRef.current.getBoundingClientRect();
6986
+ offsetRef.current = {
6987
+ x: e.clientX - paperRect.right,
6988
+ y: e.clientY - paperRect.top
6989
+ };
6990
+ e.currentTarget.setPointerCapture(e.pointerId);
6991
+ };
6992
+ const handlePointerMove = (e) => {
6993
+ if (!e.currentTarget.hasPointerCapture(e.pointerId)) {
6994
+ return;
6995
+ }
6996
+ if (!containerRef.current || !dragContainerRef.current) {
6997
+ return;
6998
+ }
6999
+ const boxRect = dragContainerRef.current.getBoundingClientRect();
7000
+ const paperRect = containerRef.current.getBoundingClientRect();
7001
+ const rawX = e.clientX - boxRect.right - offsetRef.current.x;
7002
+ const rawY = e.clientY - boxRect.top - offsetRef.current.y;
7003
+ const maxX = boxRect.width - paperRect.width;
7004
+ const maxY = boxRect.height - paperRect.height;
7005
+ setPos({
7006
+ x: clamp(-rawX, 0, maxX),
7007
+ y: clamp(rawY, 0, maxY)
7008
+ });
7009
+ };
7010
+ const handlePointerUp = (e) => {
7011
+ e.currentTarget.releasePointerCapture(e.pointerId);
7012
+ };
7013
+ return /* @__PURE__ */ jsxDEV23(Transition5, {
7014
+ mounted,
7015
+ keepMounted: true,
7016
+ transition: "pop",
7017
+ duration: theme.transitionDurations.short,
7018
+ timingFunction: "ease",
7019
+ ...componentsProps?.transition,
7020
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV23(Paper2, {
7021
+ ref: containerRef,
7022
+ pos: "absolute",
7023
+ p: gutter,
7024
+ bg: theme.transparentBackground,
7025
+ shadow: "md",
7026
+ onPointerDown: handlePointerDown,
7027
+ onPointerMove: handlePointerMove,
7028
+ onPointerUp: handlePointerUp,
7029
+ ...componentsProps?.container,
7030
+ style: {
7031
+ right: pos.x,
7032
+ top: pos.y,
7033
+ ...import_lodash3.merge(transitionStyle, componentsProps?.container?.style)
7034
+ },
7035
+ className: clsx_default("remoraid-controls", componentsProps?.container?.className),
7036
+ children: /* @__PURE__ */ jsxDEV23(Group4, {
7037
+ gap: gutter,
7038
+ ref: groupRef,
7039
+ wrap: "nowrap",
7040
+ ...componentsProps?.group,
7041
+ className: clsx_default("remoraid-controls-group", componentsProps?.group?.className),
7042
+ children: [
7043
+ /* @__PURE__ */ jsxDEV23(IconGripHorizontal, {
7044
+ order: -100,
7045
+ color: "var(--mantine-color-default-border)",
7046
+ ...import_lodash3.merge(theme.iconProps[iconSize], componentsProps?.gripIcon)
7047
+ }, undefined, false, undefined, this),
7048
+ children,
7049
+ additionalButtons && additionalButtons.map((button, i) => {
7050
+ if (isValidElementOfType(ControlButton, button)) {
7051
+ return button;
7052
+ }
7053
+ return /* @__PURE__ */ jsxDEV23(ControlButton, {
7054
+ ...button
7055
+ }, i, false, undefined, this);
7056
+ })
7057
+ ]
7058
+ }, undefined, true, undefined, this)
7059
+ }, undefined, false, undefined, this)
7060
+ }, undefined, false, undefined, this);
7061
+ }
7062
+ // src/core/components/Widget/WidgetWrapper/index.tsx
7063
+ import { Paper as Paper3, Transition as Transition6 } from "@mantine/core";
7064
+ import {
7065
+ useCallback as useCallback2,
7066
+ useEffect as useEffect4,
7067
+ useRef as useRef3,
7068
+ useState as useState8
7069
+ } from "react";
7070
+ import { IconX } from "@tabler/icons-react";
7071
+
7072
+ // src/core/components/Pinnable/index.tsx
7073
+ import {
7074
+ useMemo as useMemo4,
7075
+ useRef as useRef2,
7076
+ useState as useState7
7077
+ } from "react";
7078
+ import { IconPin, IconPinnedOff } from "@tabler/icons-react";
7079
+ import { Box as Box3, Portal as Portal2 } from "@mantine/core";
7080
+ import { jsxDEV as jsxDEV24 } from "react/jsx-dev-runtime";
7081
+ function Pinnable({
7082
+ layoutType: layoutTypeProp,
7083
+ section,
7084
+ initialValue = false,
7085
+ layoutId,
7086
+ controlsContainer,
7087
+ hidden = false,
7088
+ componentsProps,
7089
+ children
7090
+ }) {
7091
+ const layoutType = layoutTypeProp ?? "frame" /* Frame */;
7092
+ const { layouts } = useLayouts();
7093
+ const [pinned, setPinned] = useState7(initialValue);
7094
+ const containerRef = useRef2(null);
7095
+ const layout = layouts[layoutId ?? remoraidAppShellLayoutId];
7096
+ if (layout && layout.type !== layoutType) {
7097
+ 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.`);
7098
+ }
7099
+ const controlButton = useMemo4(() => /* @__PURE__ */ jsxDEV24(ControlButton, {
7100
+ icon: pinned ? IconPinnedOff : IconPin,
7101
+ tooltip: pinned ? "Unpin" : "Pin",
7102
+ color: "green",
7103
+ order: 100,
7104
+ ...componentsProps?.button,
7105
+ onClick: (e) => {
7106
+ setPinned((p) => !p);
7107
+ componentsProps?.button?.onClick?.(e);
7108
+ }
7109
+ }, undefined, false, undefined, this), [pinned, componentsProps?.button]);
7110
+ const element = /* @__PURE__ */ jsxDEV24(Box3, {
7111
+ pos: "relative",
7112
+ ref: containerRef,
7113
+ "data-hidden": hidden,
7114
+ ...componentsProps?.container,
7115
+ className: clsx_default("remoraid-pinnable", componentsProps?.container?.className),
7116
+ children: [
7117
+ controlsContainer === undefined ? /* @__PURE__ */ jsxDEV24(Controls, {
7118
+ dragContainerRef: containerRef,
7119
+ ...componentsProps?.controls,
7120
+ children: controlButton
7121
+ }, undefined, false, undefined, this) : controlsContainer !== null && /* @__PURE__ */ jsxDEV24(Portal2, {
7122
+ target: controlsContainer,
7123
+ children: controlButton
7124
+ }, undefined, false, undefined, this),
7125
+ children
7126
+ ]
7127
+ }, undefined, true, undefined, this);
7128
+ if (!layout) {
7129
+ return null;
7130
+ }
7131
+ if (pinned && layoutType === "frame" /* Frame */) {
7132
+ return /* @__PURE__ */ jsxDEV24(FrameLayout_default.Element, {
7133
+ layoutId,
7134
+ section,
7135
+ hidden,
7136
+ ...componentsProps?.layoutElement,
7137
+ children: element
7138
+ }, undefined, false, undefined, this);
7139
+ }
7140
+ return element;
7141
+ }
7142
+
7143
+ // src/core/components/Widget/WidgetWrapper/index.tsx
7144
+ var import_lodash4 = __toESM(require_lodash(), 1);
7145
+ import { jsxDEV as jsxDEV25 } from "react/jsx-dev-runtime";
6852
7146
  function WidgetWrapper({
6853
- children,
6854
7147
  config,
6855
- mt,
6856
- withCloseButton,
6857
- componentsProps
7148
+ mt = 0,
7149
+ withCloseButton = true,
7150
+ pinnableSection,
7151
+ componentsProps,
7152
+ children
6858
7153
  }) {
6859
7154
  const {
6860
7155
  isWidgetSelected,
6861
7156
  isPageRegistered,
6862
7157
  isWidgetRegistered,
6863
7158
  registerWidget,
6864
- updateActiveWidget
7159
+ updateActiveWidget,
7160
+ updateWidgetSelection,
7161
+ activeWidget
6865
7162
  } = useWidgets();
6866
7163
  const page = usePage();
6867
7164
  const theme = useRemoraidTheme();
7165
+ const mounted = page !== null && isWidgetSelected(page.pageId, config.widgetId);
7166
+ const [controlsContainer, setControlsContainer] = useState8(null);
7167
+ const [hidden, setHidden] = useState8(!mounted);
6868
7168
  const pageRegistered = page ? isPageRegistered(page.pageId) : false;
6869
- useEffect4(() => {
6870
- if (!page) {
6871
- return;
6872
- }
6873
- if (!isWidgetRegistered(page.pageId, config.widgetId)) {
6874
- registerWidget(page.pageId, config);
6875
- }
6876
- }, [pageRegistered]);
6877
- return /* @__PURE__ */ jsxDEV23(Transition4, {
6878
- mounted: page !== null && isWidgetSelected(page.pageId, config.widgetId),
7169
+ const containerRef = useRef3(null);
7170
+ const controlsContainerRef = useCallback2((n) => {
7171
+ setControlsContainer(n);
7172
+ }, [setControlsContainer]);
7173
+ const handleEnter = () => {
7174
+ updateActiveWidget(config.widgetId);
7175
+ };
7176
+ const handleLeave = () => {
7177
+ updateActiveWidget(null);
7178
+ };
7179
+ let element = /* @__PURE__ */ jsxDEV25(Transition6, {
7180
+ mounted,
6879
7181
  transition: "fade-left",
6880
7182
  duration: theme.transitionDurations.medium,
6881
7183
  timingFunction: "ease",
6882
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV23(Paper2, {
7184
+ ...componentsProps?.transition,
7185
+ onExited: () => {
7186
+ setHidden(true);
7187
+ componentsProps?.transition?.onExited?.();
7188
+ },
7189
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV25(Paper3, {
7190
+ ref: containerRef,
6883
7191
  p: "md",
6884
7192
  shadow: "md",
6885
7193
  bg: theme.transparentBackground,
6886
- mt: mt || 0,
7194
+ mt,
6887
7195
  pos: "relative",
6888
7196
  h: "fit-content",
6889
7197
  ...componentsProps?.container,
6890
- style: { ...transitionStyle, ...componentsProps?.container?.style },
6891
- onMouseEnter: () => {
6892
- updateActiveWidget(config.widgetId);
7198
+ onMouseEnter: (e) => {
7199
+ if (!pinnableSection) {
7200
+ handleEnter();
7201
+ }
7202
+ componentsProps?.container?.onMouseEnter?.(e);
6893
7203
  },
6894
- onMouseLeave: () => {
6895
- updateActiveWidget(null);
7204
+ onMouseLeave: (e) => {
7205
+ if (!pinnableSection) {
7206
+ handleLeave();
7207
+ }
7208
+ componentsProps?.container?.onMouseLeave?.(e);
6896
7209
  },
7210
+ style: import_lodash4.merge(transitionStyle, componentsProps?.container?.style),
7211
+ id: config.widgetId,
6897
7212
  children: [
6898
- withCloseButton !== false && /* @__PURE__ */ jsxDEV23(CloseButton, {
6899
- widgetId: config.widgetId
7213
+ /* @__PURE__ */ jsxDEV25(Controls, {
7214
+ dragContainerRef: containerRef,
7215
+ groupRef: controlsContainerRef,
7216
+ mounted: activeWidget === config.widgetId,
7217
+ ...componentsProps?.controls,
7218
+ children: /* @__PURE__ */ jsxDEV25(ControlButton, {
7219
+ mounted: withCloseButton,
7220
+ icon: IconX,
7221
+ tooltip: "Hide widget",
7222
+ color: "red",
7223
+ order: 200,
7224
+ ...componentsProps?.closeButton,
7225
+ onClick: (e) => {
7226
+ if (!page) {
7227
+ return;
7228
+ }
7229
+ updateWidgetSelection(page.pageId, config.widgetId, false);
7230
+ handleLeave();
7231
+ componentsProps?.closeButton?.onClick?.(e);
7232
+ }
7233
+ }, undefined, false, undefined, this)
6900
7234
  }, undefined, false, undefined, this),
6901
7235
  children
6902
7236
  ]
6903
7237
  }, undefined, true, undefined, this)
6904
7238
  }, undefined, false, undefined, this);
7239
+ if (pinnableSection !== undefined) {
7240
+ element = /* @__PURE__ */ jsxDEV25(Pinnable, {
7241
+ section: pinnableSection,
7242
+ controlsContainer,
7243
+ hidden,
7244
+ ...componentsProps?.Pinnable,
7245
+ componentsProps: {
7246
+ ...componentsProps?.Pinnable?.componentsProps,
7247
+ container: {
7248
+ ...componentsProps?.Pinnable?.componentsProps?.container,
7249
+ onMouseEnter: (e) => {
7250
+ handleEnter();
7251
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseEnter?.(e);
7252
+ },
7253
+ onMouseLeave: (e) => {
7254
+ handleLeave();
7255
+ componentsProps?.Pinnable?.componentsProps?.container?.onMouseLeave?.(e);
7256
+ }
7257
+ },
7258
+ button: {
7259
+ ...componentsProps?.Pinnable?.componentsProps?.button,
7260
+ onClick: (e) => {
7261
+ handleLeave();
7262
+ componentsProps?.Pinnable?.componentsProps?.button?.onClick?.(e);
7263
+ }
7264
+ },
7265
+ layoutElement: {
7266
+ includeContainer: false,
7267
+ includePageContainer: pinnableSection === "top" /* Top */ || pinnableSection === "bottom" /* Bottom */,
7268
+ ...componentsProps?.Pinnable?.componentsProps?.layoutElement
7269
+ }
7270
+ },
7271
+ children: element
7272
+ }, undefined, false, undefined, this);
7273
+ }
7274
+ useEffect4(() => {
7275
+ if (!page) {
7276
+ return;
7277
+ }
7278
+ if (!isWidgetRegistered(page.pageId, config.widgetId)) {
7279
+ registerWidget(page.pageId, config);
7280
+ }
7281
+ }, [pageRegistered]);
7282
+ useEffect4(() => {
7283
+ if (mounted) {
7284
+ const id = requestAnimationFrame(() => {
7285
+ setHidden(false);
7286
+ });
7287
+ return () => {
7288
+ cancelAnimationFrame(id);
7289
+ };
7290
+ }
7291
+ }, [mounted]);
7292
+ return element;
6905
7293
  }
6906
- var WidgetWrapper_default = Object.assign(WidgetWrapper, {
6907
- CloseButton
6908
- });
6909
7294
  // src/core/components/Widget/index.tsx
6910
7295
  import {
6911
7296
  Center,
6912
7297
  Divider as Divider3,
6913
- Group as Group4,
7298
+ Group as Group5,
6914
7299
  Loader,
6915
- Title
7300
+ Title,
7301
+ Stack as Stack3
6916
7302
  } from "@mantine/core";
6917
- import { jsxDEV as jsxDEV24, Fragment as Fragment5 } from "react/jsx-dev-runtime";
6918
- import { createElement as createElement2 } from "react";
7303
+ import { jsxDEV as jsxDEV26, Fragment as Fragment4 } from "react/jsx-dev-runtime";
7304
+ import { createElement as createElement3 } from "react";
6919
7305
  function Widget({
6920
- children,
6921
7306
  id,
6922
- config,
6923
7307
  title,
6924
- badges,
6925
- buttons,
6926
- alerts,
7308
+ config,
7309
+ badges: badgesProp,
7310
+ buttons: buttonsProp,
7311
+ alerts: alertsProp,
6927
7312
  gaps,
6928
7313
  loading,
6929
7314
  mt,
6930
- componentsProps
7315
+ pinnableSection,
7316
+ componentsProps,
7317
+ children
6931
7318
  }) {
7319
+ const buttons = buttonsProp?.map((button) => asElementOrPropsOfType(RemoraidButton, button, "Check the 'buttons' property of this widget."));
7320
+ const alerts = alertsProp?.map((alert) => asElementOrPropsOfType(AlertMinimal, alert, "Check the 'alerts' property of this widget."));
7321
+ const badges = badgesProp?.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check the 'badges' property of this widget."));
6932
7322
  const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
6933
7323
  const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
6934
7324
  const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
6935
- return /* @__PURE__ */ jsxDEV24(WidgetWrapper_default, {
7325
+ return /* @__PURE__ */ jsxDEV26(WidgetWrapper, {
6936
7326
  config: {
6937
7327
  widgetId: id,
6938
- name: title,
6939
- ...config
7328
+ ...config,
7329
+ initialValues: {
7330
+ name: title,
7331
+ ...config?.initialValues
7332
+ }
6940
7333
  },
6941
7334
  mt,
6942
- componentsProps: {
6943
- container: componentsProps?.container,
6944
- transition: componentsProps?.transition
6945
- },
6946
7335
  ...componentsProps?.wrapper,
7336
+ pinnableSection: pinnableSection ?? componentsProps?.wrapper?.pinnableSection,
6947
7337
  children: [
6948
- /* @__PURE__ */ jsxDEV24(Group4, {
7338
+ /* @__PURE__ */ jsxDEV26(Group5, {
6949
7339
  justify: "space-between",
6950
7340
  wrap: "nowrap",
6951
7341
  children: [
6952
- /* @__PURE__ */ jsxDEV24(Group4, {
7342
+ /* @__PURE__ */ jsxDEV26(Group5, {
6953
7343
  gap: badgesGap,
6954
7344
  wrap: "nowrap",
6955
7345
  children: [
6956
- /* @__PURE__ */ jsxDEV24(Title, {
7346
+ /* @__PURE__ */ jsxDEV26(Title, {
6957
7347
  order: 1,
6958
7348
  size: "h3",
6959
7349
  lineClamp: 1,
6960
- children: title
7350
+ children: title ?? id
6961
7351
  }, undefined, false, undefined, this),
6962
- badges !== undefined && /* @__PURE__ */ jsxDEV24(BadgeGroup, {
7352
+ badges !== undefined && /* @__PURE__ */ jsxDEV26(BadgeGroup, {
6963
7353
  badges,
6964
7354
  gap: badgesGap,
6965
7355
  ...componentsProps?.badgeGroup
6966
7356
  }, undefined, false, undefined, this)
6967
7357
  ]
6968
7358
  }, undefined, true, undefined, this),
6969
- /* @__PURE__ */ jsxDEV24(Group4, {
7359
+ /* @__PURE__ */ jsxDEV26(Group5, {
6970
7360
  gap: buttonsGap,
6971
7361
  wrap: "nowrap",
6972
- children: buttons !== undefined && buttons.map((e, i) => {
6973
- if (isRemoraidButtonProps(e)) {
6974
- return /* @__PURE__ */ createElement2(RemoraidButton, {
6975
- ...e,
6976
- key: i
6977
- });
7362
+ children: buttons !== undefined && buttons.map((button, i) => {
7363
+ if (isValidElementOfType(RemoraidButton, button)) {
7364
+ return button;
6978
7365
  }
6979
- return e;
7366
+ return /* @__PURE__ */ createElement3(RemoraidButton, {
7367
+ ...button,
7368
+ key: i
7369
+ });
6980
7370
  })
6981
7371
  }, undefined, false, undefined, this)
6982
7372
  ]
6983
7373
  }, undefined, true, undefined, this),
6984
- /* @__PURE__ */ jsxDEV24(Divider3, {
6985
- my: "md"
7374
+ /* @__PURE__ */ jsxDEV26(Divider3, {
7375
+ my: "md",
7376
+ ...componentsProps?.divider
6986
7377
  }, undefined, false, undefined, this),
6987
- alerts !== undefined && alerts.map((a, i) => {
6988
- if (isAlertMinimalProps(a)) {
6989
- return /* @__PURE__ */ createElement2(AlertMinimal, {
6990
- ...a,
6991
- mb: alertsGap,
7378
+ /* @__PURE__ */ jsxDEV26(Stack3, {
7379
+ align: "stretch",
7380
+ gap: alertsGap,
7381
+ mb: alerts && alerts.length > 0 ? "md" : 0,
7382
+ ...componentsProps?.alertsContainer,
7383
+ children: alerts?.map((alert, i) => {
7384
+ if (isValidElementOfType(AlertMinimal, alert)) {
7385
+ return alert;
7386
+ }
7387
+ return /* @__PURE__ */ createElement3(AlertMinimal, {
7388
+ ...alert,
6992
7389
  key: i
6993
7390
  });
6994
- }
6995
- return a;
6996
- }),
6997
- loading ? /* @__PURE__ */ jsxDEV24(Center, {
6998
- children: /* @__PURE__ */ jsxDEV24(Loader, {
7391
+ })
7392
+ }, undefined, false, undefined, this),
7393
+ loading ? /* @__PURE__ */ jsxDEV26(Center, {
7394
+ children: /* @__PURE__ */ jsxDEV26(Loader, {
6999
7395
  ...componentsProps?.loader
7000
7396
  }, undefined, false, undefined, this)
7001
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV24(Fragment5, {
7397
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV26(Fragment4, {
7002
7398
  children
7003
7399
  }, undefined, false, undefined, this)
7004
7400
  ]
@@ -7007,7 +7403,7 @@ function Widget({
7007
7403
  // src/core/components/NotFoundPage/index.tsx
7008
7404
  import { Alert as Alert2 } from "@mantine/core";
7009
7405
  import { usePathname as usePathname3 } from "next/navigation";
7010
- import { jsxDEV as jsxDEV25 } from "react/jsx-dev-runtime";
7406
+ import { jsxDEV as jsxDEV27 } from "react/jsx-dev-runtime";
7011
7407
  function NotFoundPage({
7012
7408
  children,
7013
7409
  message,
@@ -7015,11 +7411,11 @@ function NotFoundPage({
7015
7411
  }) {
7016
7412
  const pathname = usePathname3();
7017
7413
  const theme = useRemoraidTheme();
7018
- return /* @__PURE__ */ jsxDEV25(Page, {
7414
+ return /* @__PURE__ */ jsxDEV27(Page, {
7019
7415
  name: "Not Found",
7020
7416
  ...componentsProps?.page,
7021
7417
  children: [
7022
- /* @__PURE__ */ jsxDEV25(Alert2, {
7418
+ /* @__PURE__ */ jsxDEV27(Alert2, {
7023
7419
  ...theme.alertProps.negative,
7024
7420
  title: "404 - Page Not Found",
7025
7421
  children: message ?? `Could not find page ${pathname}.`
@@ -7030,7 +7426,7 @@ function NotFoundPage({
7030
7426
  }
7031
7427
  // src/core/components/EnvironmentShell/index.tsx
7032
7428
  import { Alert as Alert3 } from "@mantine/core";
7033
- import { jsxDEV as jsxDEV26, Fragment as Fragment6 } from "react/jsx-dev-runtime";
7429
+ import { jsxDEV as jsxDEV28, Fragment as Fragment5 } from "react/jsx-dev-runtime";
7034
7430
  function EnvironmentShell({
7035
7431
  children,
7036
7432
  environment,
@@ -7044,7 +7440,7 @@ function EnvironmentShell({
7044
7440
  const undefinedKeys = Object.keys(environment).filter((key) => environment[key] === undefined);
7045
7441
  const alertTitle = `Please Specify Environment Variable${undefinedKeys.length > 1 ? "s" : ""}`;
7046
7442
  const alertMessage = `Components could not be rendered because the following environment variables are not specified: ${undefinedKeys.join(", ")}.`;
7047
- const alert = /* @__PURE__ */ jsxDEV26(Alert3, {
7443
+ const alert = /* @__PURE__ */ jsxDEV28(Alert3, {
7048
7444
  ...theme.alertProps.neutral,
7049
7445
  title: alertTitle,
7050
7446
  m,
@@ -7052,12 +7448,12 @@ function EnvironmentShell({
7052
7448
  children: message ?? alertMessage
7053
7449
  }, undefined, false, undefined, this);
7054
7450
  if (undefinedKeys.length === 0) {
7055
- return /* @__PURE__ */ jsxDEV26(Fragment6, {
7451
+ return /* @__PURE__ */ jsxDEV28(Fragment5, {
7056
7452
  children
7057
7453
  }, undefined, false, undefined, this);
7058
7454
  }
7059
7455
  if (withContainer) {
7060
- return /* @__PURE__ */ jsxDEV26(PageContainer, {
7456
+ return /* @__PURE__ */ jsxDEV28(PageContainer, {
7061
7457
  componentsProps: { container: componentsProps?.container },
7062
7458
  children: alert
7063
7459
  }, undefined, false, undefined, this);
@@ -7070,15 +7466,15 @@ import { IconRestore } from "@tabler/icons-react";
7070
7466
 
7071
7467
  // src/core/components/SettingsWidget/SaveButton/index.tsx
7072
7468
  import { IconDeviceFloppy } from "@tabler/icons-react";
7073
- import { Group as Group5 } from "@mantine/core";
7074
- import { jsxDEV as jsxDEV27 } from "react/jsx-dev-runtime";
7469
+ import { Group as Group6 } from "@mantine/core";
7470
+ import { jsxDEV as jsxDEV29 } from "react/jsx-dev-runtime";
7075
7471
  function SaveButton({
7076
7472
  onSaveChanges,
7077
7473
  insideContainer,
7078
7474
  componentsProps
7079
7475
  }) {
7080
7476
  const settingsWidgetOptions = useSettingsWidgetContext();
7081
- const button = /* @__PURE__ */ jsxDEV27(RemoraidButton, {
7477
+ const button = /* @__PURE__ */ jsxDEV29(RemoraidButton, {
7082
7478
  label: "Save Changes",
7083
7479
  icon: IconDeviceFloppy,
7084
7480
  onClick: onSaveChanges,
@@ -7093,7 +7489,7 @@ function SaveButton({
7093
7489
  }
7094
7490
  }, undefined, false, undefined, this);
7095
7491
  if (insideContainer !== false) {
7096
- return /* @__PURE__ */ jsxDEV27(Group5, {
7492
+ return /* @__PURE__ */ jsxDEV29(Group6, {
7097
7493
  w: "100%",
7098
7494
  justify: "flex-end",
7099
7495
  mt: "md",
@@ -7105,7 +7501,7 @@ function SaveButton({
7105
7501
  }
7106
7502
 
7107
7503
  // src/core/components/SettingsWidget/index.tsx
7108
- import { jsxDEV as jsxDEV28 } from "react/jsx-dev-runtime";
7504
+ import { jsxDEV as jsxDEV30 } from "react/jsx-dev-runtime";
7109
7505
  var defaultSettingsWidgetContext = {};
7110
7506
  var settingsWidgetContext = createContext6(defaultSettingsWidgetContext);
7111
7507
  var useSettingsWidgetContext = () => {
@@ -7118,9 +7514,9 @@ function SettingsWidget({
7118
7514
  custom,
7119
7515
  widgetProps
7120
7516
  }) {
7121
- return /* @__PURE__ */ jsxDEV28(settingsWidgetContext.Provider, {
7517
+ return /* @__PURE__ */ jsxDEV30(settingsWidgetContext.Provider, {
7122
7518
  value: { custom, unsavedChanges },
7123
- children: /* @__PURE__ */ jsxDEV28(Widget, {
7519
+ children: /* @__PURE__ */ jsxDEV30(Widget, {
7124
7520
  title: "Settings",
7125
7521
  id: "settings",
7126
7522
  mt: "md",
@@ -7161,22 +7557,22 @@ import { Table as Table2 } from "@mantine/core";
7161
7557
 
7162
7558
  // src/core/components/SettingsWidget/SettingsTable/Row/index.tsx
7163
7559
  import { Table, Text as Text2 } from "@mantine/core";
7164
- import { jsxDEV as jsxDEV29 } from "react/jsx-dev-runtime";
7560
+ import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
7165
7561
  function Row({
7166
7562
  children,
7167
7563
  label
7168
7564
  }) {
7169
7565
  const options = useSettingsTableOptions();
7170
- return /* @__PURE__ */ jsxDEV29(Table.Tr, {
7566
+ return /* @__PURE__ */ jsxDEV31(Table.Tr, {
7171
7567
  children: [
7172
- /* @__PURE__ */ jsxDEV29(Table.Th, {
7568
+ /* @__PURE__ */ jsxDEV31(Table.Th, {
7173
7569
  w: options.leftColumnWidth,
7174
- children: /* @__PURE__ */ jsxDEV29(Text2, {
7570
+ children: /* @__PURE__ */ jsxDEV31(Text2, {
7175
7571
  size: "sm",
7176
7572
  children: label
7177
7573
  }, undefined, false, undefined, this)
7178
7574
  }, undefined, false, undefined, this),
7179
- /* @__PURE__ */ jsxDEV29(Table.Td, {
7575
+ /* @__PURE__ */ jsxDEV31(Table.Td, {
7180
7576
  py: "xs",
7181
7577
  children
7182
7578
  }, undefined, false, undefined, this)
@@ -7185,7 +7581,7 @@ function Row({
7185
7581
  }
7186
7582
 
7187
7583
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7188
- import { jsxDEV as jsxDEV30 } from "react/jsx-dev-runtime";
7584
+ import { jsxDEV as jsxDEV32 } from "react/jsx-dev-runtime";
7189
7585
  var defaultSettingsTableOptions = {
7190
7586
  leftColumnWidth: "38.2%"
7191
7587
  };
@@ -7194,20 +7590,21 @@ var useSettingsTableOptions = () => {
7194
7590
  return useContext10(settingsTableOptionsContext);
7195
7591
  };
7196
7592
  function SettingsTable({
7197
- children,
7198
- leftColumnWidth
7593
+ leftColumnWidth,
7594
+ children: childrenProp
7199
7595
  }) {
7596
+ const children = asChildrenOfType(Row, childrenProp, "Check children passed to 'SettingsTable' component.");
7200
7597
  const theme = useRemoraidTheme();
7201
- return /* @__PURE__ */ jsxDEV30(settingsTableOptionsContext.Provider, {
7598
+ return /* @__PURE__ */ jsxDEV32(settingsTableOptionsContext.Provider, {
7202
7599
  value: {
7203
7600
  leftColumnWidth: leftColumnWidth ?? defaultSettingsTableOptions.leftColumnWidth
7204
7601
  },
7205
- children: /* @__PURE__ */ jsxDEV30(Table2, {
7602
+ children: /* @__PURE__ */ jsxDEV32(Table2, {
7206
7603
  bg: theme.transparentBackground,
7207
7604
  withTableBorder: true,
7208
7605
  variant: "vertical",
7209
7606
  layout: "fixed",
7210
- children: /* @__PURE__ */ jsxDEV30(Table2.Tbody, {
7607
+ children: /* @__PURE__ */ jsxDEV32(Table2.Tbody, {
7211
7608
  children
7212
7609
  }, undefined, false, undefined, this)
7213
7610
  }, undefined, false, undefined, this)
@@ -7217,21 +7614,21 @@ var SettingsTable_default = Object.assign(SettingsTable, {
7217
7614
  Row
7218
7615
  });
7219
7616
  // src/core/components/NavbarSettingsWidget/index.tsx
7220
- import { cloneElement } from "react";
7221
- var import_lodash = __toESM(require_lodash(), 1);
7222
- import { Chip as Chip3, Group as Group6 } from "@mantine/core";
7617
+ var import_lodash5 = __toESM(require_lodash(), 1);
7618
+ import { Chip as Chip3, Group as Group7 } from "@mantine/core";
7223
7619
  import { IconLink as IconLink2 } from "@tabler/icons-react";
7224
- import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
7620
+ import { jsxDEV as jsxDEV33 } from "react/jsx-dev-runtime";
7225
7621
  var defaultNavbarSettingsWidgetId = "navbar-settings";
7226
7622
  function NavbarSettingsWidget({
7227
- additionalRows,
7623
+ additionalRows: additionalRowsProp,
7228
7624
  widgetProps,
7229
7625
  componentsProps
7230
7626
  }) {
7627
+ const additionalRows = additionalRowsProp?.map((additionalRow) => asElementOrPropsOfType(SettingsTable_default.Row, additionalRow, "Check the 'additionalRows' property of 'NavbarSettingsWidget'."));
7231
7628
  const { userExperience, updateUserExperience, initialUserExperience } = useRemoraidUserExperience();
7232
7629
  const app = useRemoraidApp();
7233
7630
  const theme = useRemoraidTheme();
7234
- return /* @__PURE__ */ jsxDEV31(SettingsWidget_default, {
7631
+ return /* @__PURE__ */ jsxDEV33(SettingsWidget_default, {
7235
7632
  widgetProps: {
7236
7633
  id: defaultNavbarSettingsWidgetId,
7237
7634
  title: "Navbar Settings",
@@ -7243,12 +7640,13 @@ function NavbarSettingsWidget({
7243
7640
  navbar: initialUserExperience.navbar
7244
7641
  }));
7245
7642
  },
7246
- custom: !import_lodash.isEqual(userExperience.navbar, initialUserExperience.navbar),
7247
- children: /* @__PURE__ */ jsxDEV31(SettingsTable_default, {
7643
+ custom: !import_lodash5.isEqual(userExperience.navbar, initialUserExperience.navbar),
7644
+ children: /* @__PURE__ */ jsxDEV33(SettingsTable_default, {
7645
+ ...componentsProps?.table,
7248
7646
  children: [
7249
- /* @__PURE__ */ jsxDEV31(SettingsTable_default.Row, {
7647
+ /* @__PURE__ */ jsxDEV33(SettingsTable_default.Row, {
7250
7648
  label: "Select which pages you want to display or hide",
7251
- children: /* @__PURE__ */ jsxDEV31(Chip3.Group, {
7649
+ children: /* @__PURE__ */ jsxDEV33(Chip3.Group, {
7252
7650
  multiple: true,
7253
7651
  value: app.navigablePages.filter((p) => !userExperience.navbar.hiddenPages.includes(p.href)).map((p) => p.href),
7254
7652
  onChange: (newValue) => {
@@ -7260,12 +7658,12 @@ function NavbarSettingsWidget({
7260
7658
  }
7261
7659
  }));
7262
7660
  },
7263
- children: /* @__PURE__ */ jsxDEV31(Group6, {
7661
+ children: /* @__PURE__ */ jsxDEV33(Group7, {
7264
7662
  justify: "flex-start",
7265
7663
  gap: "xs",
7266
- children: app.navigablePages.map((p) => ({ ...p, icon: p.icon ?? IconLink2 })).map((p, i) => /* @__PURE__ */ jsxDEV31(Chip3, {
7664
+ children: app.navigablePages.map((p) => ({ ...p, icon: p.icon ?? IconLink2 })).map((p, i) => /* @__PURE__ */ jsxDEV33(Chip3, {
7267
7665
  value: p.href,
7268
- icon: /* @__PURE__ */ jsxDEV31(p.icon, {
7666
+ icon: /* @__PURE__ */ jsxDEV33(p.icon, {
7269
7667
  ...theme.iconProps.tiny,
7270
7668
  color: theme.primaryColor
7271
7669
  }, undefined, false, undefined, this),
@@ -7275,14 +7673,63 @@ function NavbarSettingsWidget({
7275
7673
  }, undefined, false, undefined, this)
7276
7674
  }, undefined, false, undefined, this)
7277
7675
  }, "select-hidden-pages", false, undefined, this),
7278
- ...(additionalRows ?? []).map((row, i) => row.key ? row : cloneElement(row, { key: i }))
7279
- ],
7280
- ...componentsProps?.table
7281
- }, undefined, false, undefined, this)
7676
+ additionalRows && additionalRows.map((row, i) => {
7677
+ if (isValidElementOfType(SettingsTable_default.Row, row)) {
7678
+ return row;
7679
+ }
7680
+ return /* @__PURE__ */ jsxDEV33(SettingsTable_default.Row, {
7681
+ ...row
7682
+ }, i, false, undefined, this);
7683
+ })
7684
+ ]
7685
+ }, undefined, true, undefined, this)
7282
7686
  }, undefined, false, undefined, this);
7283
7687
  }
7688
+ // src/core/components/ContextClusterProvider/index.tsx
7689
+ import React8 from "react";
7690
+ import { jsxDEV as jsxDEV34 } from "react/jsx-dev-runtime";
7691
+ var createContextCluster = (generalDefaultValue, staticIds) => {
7692
+ const isStaticId = (id) => {
7693
+ if (staticIds?.find((staticId) => staticId === id)) {
7694
+ return true;
7695
+ }
7696
+ return false;
7697
+ };
7698
+ const contexts = {};
7699
+ const defaultValues = {};
7700
+ const createContext8 = (id, defaultValue) => {
7701
+ const context = React8.createContext(defaultValue ?? generalDefaultValue);
7702
+ contexts[id] = context;
7703
+ defaultValues[id] = defaultValue ?? generalDefaultValue;
7704
+ return context;
7705
+ };
7706
+ const useContext11 = (id) => {
7707
+ if (isStaticId(id)) {
7708
+ return contexts[id] ? React8.useContext(contexts[id]) : generalDefaultValue;
7709
+ }
7710
+ return contexts[id] ? React8.useContext(contexts[id]) : null;
7711
+ };
7712
+ return {
7713
+ contexts,
7714
+ defaultValues,
7715
+ generalDefaultValue,
7716
+ createContext: createContext8,
7717
+ useContext: useContext11
7718
+ };
7719
+ };
7720
+ function ContextClusterProvider({
7721
+ cluster,
7722
+ values = {},
7723
+ children
7724
+ }) {
7725
+ return Object.entries(cluster.contexts).reduceRight((t, [id, context]) => context ? /* @__PURE__ */ jsxDEV34(context.Provider, {
7726
+ value: values[id] ?? cluster.defaultValues[id] ?? cluster.generalDefaultValue,
7727
+ children: t
7728
+ }, undefined, false, undefined, this) : t, children);
7729
+ }
7284
7730
  export {
7285
7731
  useWidgets,
7732
+ useWidget,
7286
7733
  useSettingsWidgetContext as useSettingsWidgetOptions,
7287
7734
  useSettingsTableOptions,
7288
7735
  useRemoraidUserExperience,
@@ -7293,19 +7740,27 @@ export {
7293
7740
  useHydrationStatus,
7294
7741
  useHydratedMantineColorScheme,
7295
7742
  useFrameLayout,
7296
- isFrameLayout,
7743
+ remoraidAppShellLayoutId,
7744
+ isValidElementOfType,
7745
+ getElementTypeName,
7746
+ getDefaultWidgetContext,
7297
7747
  defaultUserExperienceCookieName,
7298
7748
  defaultUserExperience,
7299
7749
  defaultSettingsWidgetContext as defaultSettingsWidgetOptions,
7300
7750
  defaultSettingsTableOptions,
7301
7751
  defaultNavbarSettingsWidgetId,
7302
7752
  defaultLayoutsContext,
7303
- defaultFrameLayoutContext,
7304
- defaultAppShellLayoutId,
7753
+ defaultAppShellNavbarPositions,
7754
+ defaultAppShellFooterPositions,
7305
7755
  defaultAppContext,
7306
7756
  createUserExperienceContext,
7307
7757
  createRemoraidTheme,
7308
- WidgetWrapper_default as WidgetWrapper,
7758
+ createContextCluster,
7759
+ co,
7760
+ asElementOrPropsOfType,
7761
+ asElementOfType,
7762
+ asChildrenOfType,
7763
+ WidgetWrapper,
7309
7764
  WidgetSelectionHeader,
7310
7765
  Widget,
7311
7766
  UserExperienceProviderWrapper,
@@ -7317,6 +7772,7 @@ export {
7317
7772
  RemoraidIconSize,
7318
7773
  RemoraidButton,
7319
7774
  RemoraidBreakpoint,
7775
+ Pinnable,
7320
7776
  PageContainer,
7321
7777
  Page,
7322
7778
  NotFoundPage,
@@ -7324,11 +7780,13 @@ export {
7324
7780
  NavbarSettingsWidget,
7325
7781
  LayoutType,
7326
7782
  HydrationStatusProvider,
7327
- FrameLayoutVariant,
7328
7783
  FrameLayoutSection,
7329
7784
  FrameLayout_default as FrameLayout,
7330
7785
  FooterVariant,
7331
7786
  EnvironmentShell,
7787
+ Controls,
7788
+ ControlButton,
7789
+ ContextClusterProvider,
7332
7790
  BadgeMinimal,
7333
7791
  BadgeGroup,
7334
7792
  AppShell_default as AppShell,