remoraid 2.14.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 Stack4(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
- Stack4.prototype.clear = stackClear;
1015
- Stack4.prototype["delete"] = stackDelete;
1016
- Stack4.prototype.get = stackGet;
1017
- Stack4.prototype.has = stackHas;
1018
- Stack4.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 Stack4);
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 Stack4);
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 Stack4);
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 Stack4);
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 Stack4;
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 Stack4);
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,11 +5614,6 @@ 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
5621
5619
  import {
@@ -5984,7 +5982,7 @@ function RemoraidProvider({
5984
5982
  }, undefined, false, undefined, this);
5985
5983
  }
5986
5984
  // src/core/components/AppShell/index.tsx
5987
- import { Box as Box3 } from "@mantine/core";
5985
+ import { Box as Box2 } from "@mantine/core";
5988
5986
 
5989
5987
  // src/core/components/AppShell/NavbarMinimal/index.tsx
5990
5988
  import {
@@ -6205,7 +6203,6 @@ function FooterMinimal({
6205
6203
  return /* @__PURE__ */ jsxDEV10(Group, {
6206
6204
  justify: "center",
6207
6205
  w: "100%",
6208
- py: "md",
6209
6206
  ...componentsProps?.container,
6210
6207
  children: /* @__PURE__ */ jsxDEV10(IconPennant, {
6211
6208
  size: 50,
@@ -6217,7 +6214,6 @@ function FooterMinimal({
6217
6214
 
6218
6215
  // src/core/components/FrameLayout/index.tsx
6219
6216
  import {
6220
- Box as Box2,
6221
6217
  Group as Group2,
6222
6218
  ScrollArea,
6223
6219
  Stack as Stack2
@@ -6231,269 +6227,313 @@ import {
6231
6227
 
6232
6228
  // src/core/components/FrameLayout/Element/index.tsx
6233
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
6234
6265
  import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
6235
- 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({
6236
6288
  section,
6237
6289
  includeContainer = true,
6290
+ includePageContainer = false,
6238
6291
  layoutId,
6292
+ hidden = false,
6239
6293
  componentsProps,
6240
6294
  children
6241
6295
  }) {
6242
6296
  const { layouts } = useLayouts();
6243
6297
  const closestLayout = useFrameLayout();
6244
- if (closestLayout.layoutId === null) {
6245
- return null;
6298
+ if (!closestLayout) {
6299
+ throw new InvalidComponentUsageError("FrameLayout.Element", "must be used as child of 'FrameLayout'.");
6246
6300
  }
6247
6301
  const layout = layouts[layoutId ?? closestLayout.layoutId];
6248
- if (!isFrameLayout(layout)) {
6302
+ if (!layout) {
6249
6303
  return null;
6250
6304
  }
6251
- 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]) {
6252
6309
  return null;
6253
6310
  }
6254
6311
  let containerProps = {};
6255
6312
  if (section === "left" /* Left */ || section === "right" /* Right */) {
6256
6313
  containerProps.h = "100%";
6257
6314
  }
6258
- 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, {
6259
6322
  target: layout.sections[section],
6260
- children: includeContainer ? /* @__PURE__ */ jsxDEV11(Box, {
6261
- ...containerProps,
6262
- ...componentsProps?.container,
6263
- children
6264
- }, 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
6265
6329
  }, undefined, false, undefined, this);
6266
6330
  }
6267
6331
 
6268
6332
  // src/core/components/FrameLayout/index.tsx
6269
- import { jsxDEV as jsxDEV12 } from "react/jsx-dev-runtime";
6270
- var isFrameLayout = (layout) => {
6271
- if (typeof layout !== "object" || layout === null) {
6272
- return false;
6273
- }
6274
- if (!("sections" in layout)) {
6275
- return false;
6276
- }
6277
- if (typeof layout.sections !== "object" || layout.sections === null) {
6278
- return false;
6279
- }
6280
- return true;
6281
- };
6282
- var defaultFrameLayoutVariant = "sticky" /* Sticky */;
6283
- var defaultFrameLayoutContext = {
6284
- layoutId: null,
6285
- layout: {
6286
- sections: {
6287
- ["top" /* Top */]: null,
6288
- ["bottom" /* Bottom */]: null,
6289
- ["left" /* Left */]: null,
6290
- ["right" /* Right */]: null
6291
- }
6292
- },
6293
- setLayout: () => {}
6294
- };
6295
- var layoutContext = createContext5(defaultFrameLayoutContext);
6333
+ import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
6334
+ var layoutContext = createContext5(null);
6296
6335
  var useFrameLayout = () => {
6297
6336
  return useContext7(layoutContext);
6298
6337
  };
6299
6338
  function FrameLayout({
6300
- variant = defaultFrameLayoutVariant,
6301
6339
  layoutId,
6340
+ includeScrollArea = true,
6341
+ gutter = 0,
6302
6342
  componentsProps,
6303
6343
  children
6304
6344
  }) {
6305
6345
  const theme = useRemoraidTheme();
6306
6346
  const { layouts, setLayouts } = useLayouts();
6307
6347
  const layout = layouts[layoutId];
6308
- const setLayout = useMemo3(() => {
6309
- return (value) => {
6310
- setLayouts((prev) => ({
6311
- ...prev,
6312
- [layoutId]: typeof value === "function" ? value(prev[layoutId]) : value
6313
- }));
6314
- };
6315
- }, [layoutId, setLayouts]);
6316
- const topSection = useCallback((n) => {
6317
- 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) => ({
6318
6357
  ...prev,
6319
- sections: { ...prev?.sections, ["top" /* Top */]: n }
6358
+ [layoutId]: {
6359
+ type: "frame" /* Frame */,
6360
+ sections: typeof value === "function" ? value(prev[layoutId]?.sections ?? defaultSections) : value
6361
+ }
6320
6362
  }));
6321
- }, [setLayout]);
6322
- const bottomSection = useCallback((n) => {
6323
- setLayout((prev) => ({
6363
+ }, [layoutId, setLayouts, defaultSections]);
6364
+ const topSectionRef = useCallback((n) => {
6365
+ setSections((prev) => ({
6324
6366
  ...prev,
6325
- sections: { ...prev?.sections, ["bottom" /* Bottom */]: n }
6367
+ ["top" /* Top */]: n
6326
6368
  }));
6327
- }, [setLayout]);
6328
- const leftSection = useCallback((n) => {
6329
- setLayout((prev) => ({
6369
+ }, [setSections]);
6370
+ const bottomSectionRef = useCallback((n) => {
6371
+ setSections((prev) => ({
6330
6372
  ...prev,
6331
- sections: { ...prev?.sections, ["left" /* Left */]: n }
6373
+ ["bottom" /* Bottom */]: n
6332
6374
  }));
6333
- }, [setLayout]);
6334
- const rightSection = useCallback((n) => {
6335
- setLayout((prev) => ({
6375
+ }, [setSections]);
6376
+ const leftSectionRef = useCallback((n) => {
6377
+ setSections((prev) => ({
6336
6378
  ...prev,
6337
- sections: { ...prev?.sections, ["right" /* Right */]: n }
6379
+ ["left" /* Left */]: n
6338
6380
  }));
6339
- }, [setLayout]);
6340
- let contentSection = children;
6341
- const childrenContainerProps = {
6381
+ }, [setSections]);
6382
+ const rightSectionRef = useCallback((n) => {
6383
+ setSections((prev) => ({
6384
+ ...prev,
6385
+ ["right" /* Right */]: n
6386
+ }));
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,
6342
6398
  flex: 1,
6343
- ...componentsProps?.childrenContainer
6344
- };
6345
- if (variant === "plain" /* Plain */) {
6346
- contentSection = /* @__PURE__ */ jsxDEV12(Box2, {
6347
- ...childrenContainerProps,
6348
- children: contentSection
6349
- }, undefined, false, undefined, this);
6350
- } else if (variant === "sticky" /* Sticky */) {
6351
- contentSection = /* @__PURE__ */ jsxDEV12(ScrollArea, {
6352
- ...theme.scrollAreaProps,
6353
- ...childrenContainerProps,
6354
- children
6355
- }, undefined, false, undefined, this);
6356
- }
6357
- return /* @__PURE__ */ jsxDEV12(layoutContext.Provider, {
6358
- value: { layoutId, layout, setLayout },
6359
- 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, {
6360
6412
  gap: 0,
6361
6413
  h: "100%",
6362
6414
  w: "100%",
6363
6415
  wrap: "nowrap",
6364
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),
6365
6421
  children: [
6366
- /* @__PURE__ */ jsxDEV12(Group2, {
6367
- ref: leftSection,
6422
+ /* @__PURE__ */ jsxDEV13(Group2, {
6423
+ ref: leftSectionRef,
6368
6424
  h: "100%",
6369
- gap: 0,
6370
6425
  wrap: "nowrap",
6371
- ...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)
6372
6430
  }, undefined, false, undefined, this),
6373
- /* @__PURE__ */ jsxDEV12(Stack2, {
6431
+ /* @__PURE__ */ jsxDEV13(Stack2, {
6374
6432
  h: "100%",
6375
6433
  flex: 1,
6376
6434
  gap: 0,
6377
6435
  ...componentsProps?.verticalContainer,
6436
+ className: clsx_default("remoraid-frame-layout-vertical-container", componentsProps?.verticalContainer?.className),
6378
6437
  children: [
6379
- /* @__PURE__ */ jsxDEV12(Stack2, {
6380
- h: "100%",
6381
- ref: topSection,
6382
- gap: 0,
6438
+ /* @__PURE__ */ jsxDEV13(Stack2, {
6439
+ ref: topSectionRef,
6440
+ gap: gutter,
6383
6441
  flex: 0,
6384
- ...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)
6385
6444
  }, undefined, false, undefined, this),
6386
- contentSection,
6387
- /* @__PURE__ */ jsxDEV12(Stack2, {
6388
- h: "100%",
6389
- ref: bottomSection,
6390
- 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,
6391
6454
  flex: 0,
6392
- ...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)
6393
6457
  }, undefined, false, undefined, this)
6394
6458
  ]
6395
6459
  }, undefined, true, undefined, this),
6396
- /* @__PURE__ */ jsxDEV12(Group2, {
6397
- gap: 0,
6398
- ref: rightSection,
6460
+ /* @__PURE__ */ jsxDEV13(Group2, {
6461
+ ref: rightSectionRef,
6399
6462
  h: "100%",
6463
+ gap: gutter,
6464
+ pl: 0,
6400
6465
  wrap: "nowrap",
6401
- ...componentsProps?.sectionContainers?.["right" /* Right */]
6466
+ ...componentsProps?.sectionContainers?.["right" /* Right */],
6467
+ className: clsx_default("remoraid-frame-layout-section", componentsProps?.sectionContainers?.["right" /* Right */]?.className)
6402
6468
  }, undefined, false, undefined, this)
6403
6469
  ]
6404
6470
  }, undefined, true, undefined, this)
6405
6471
  }, undefined, false, undefined, this);
6406
6472
  }
6407
6473
  var FrameLayout_default = Object.assign(FrameLayout, {
6408
- Element
6474
+ Element: Element2
6409
6475
  });
6410
6476
 
6411
6477
  // src/core/components/AppShell/index.tsx
6412
- import { jsxDEV as jsxDEV13, Fragment as Fragment2 } from "react/jsx-dev-runtime";
6413
- var defaultAppShellLayoutId = "remoraidAppShell";
6478
+ var import_lodash2 = __toESM(require_lodash(), 1);
6479
+ import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
6480
+ var remoraidAppShellLayoutId = "remoraid-app-shell";
6414
6481
  var defaultAppShellNavbarPositions = { ["minimal" /* Minimal */]: "left" /* Left */ };
6415
6482
  var defaultAppShellFooterPositions = { ["minimal" /* Minimal */]: "content" /* Content */ };
6416
- function AppShell(props) {
6417
- const {
6418
- children,
6419
- navbarVariant,
6420
- footerVariant,
6421
- appContext: appContext2,
6422
- componentsProps
6423
- } = {
6424
- navbarVariant: null,
6425
- footerVariant: null,
6426
- ...props
6427
- };
6428
- let { navbarPosition, footerPosition } = props;
6429
- if (navbarVariant !== null && navbarPosition === undefined) {
6430
- navbarPosition = defaultAppShellNavbarPositions[navbarVariant];
6431
- }
6432
- if (footerVariant !== null && footerPosition === undefined) {
6433
- footerPosition = defaultAppShellFooterPositions[footerVariant];
6434
- }
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]);
6435
6497
  let navbar;
6436
6498
  let footer;
6437
- let navbarContainerProps = {};
6438
- let footerContainerProps = {};
6499
+ let navbarLayoutElementProps = {
6500
+ includeContainer: false
6501
+ };
6502
+ let footerLayoutElementProps = {
6503
+ includeContainer: true,
6504
+ componentsProps: { container: { style: { order: 1 } } }
6505
+ };
6439
6506
  if (navbarVariant === "minimal" /* Minimal */) {
6440
- navbar = /* @__PURE__ */ jsxDEV13(NavbarMinimal, {
6507
+ navbar = /* @__PURE__ */ jsxDEV14(NavbarMinimal, {
6441
6508
  ...componentsProps?.navbar
6442
6509
  }, undefined, false, undefined, this);
6443
- navbarContainerProps.py = "md";
6444
- if (navbarPosition === "left" /* Left */) {
6445
- navbarContainerProps.pl = "md";
6446
- } else if (navbarPosition === "right" /* Right */) {
6447
- navbarContainerProps.pr = "md";
6448
- }
6449
6510
  }
6450
6511
  if (footerVariant === "minimal" /* Minimal */) {
6451
- footer = /* @__PURE__ */ jsxDEV13(FooterMinimal, {
6512
+ footer = /* @__PURE__ */ jsxDEV14(FooterMinimal, {
6452
6513
  ...componentsProps?.footer
6453
6514
  }, undefined, false, undefined, this);
6454
6515
  }
6455
- return /* @__PURE__ */ jsxDEV13(AppProvider, {
6516
+ return /* @__PURE__ */ jsxDEV14(AppProvider, {
6456
6517
  appContext: appContext2,
6457
6518
  ...componentsProps?.AppProvider,
6458
- children: /* @__PURE__ */ jsxDEV13(Box3, {
6519
+ children: /* @__PURE__ */ jsxDEV14(Box2, {
6459
6520
  h: "100vh",
6460
6521
  ...componentsProps?.container,
6461
- children: /* @__PURE__ */ jsxDEV13(FrameLayout_default, {
6462
- layoutId: defaultAppShellLayoutId,
6522
+ children: /* @__PURE__ */ jsxDEV14(FrameLayout_default, {
6523
+ layoutId: remoraidAppShellLayoutId,
6524
+ gutter,
6463
6525
  ...componentsProps?.layout,
6464
6526
  children: [
6465
- navbarPosition !== undefined && navbarPosition !== "content" /* Content */ && /* @__PURE__ */ jsxDEV13(FrameLayout_default.Element, {
6527
+ navbarPosition !== null && /* @__PURE__ */ jsxDEV14(FrameLayout_default.Element, {
6466
6528
  section: navbarPosition,
6467
- ...componentsProps?.navbarLayoutElement,
6468
- componentsProps: {
6469
- ...componentsProps?.navbarLayoutElement?.componentsProps,
6470
- container: {
6471
- ...navbarContainerProps,
6472
- ...componentsProps?.navbarLayoutElement?.componentsProps?.container
6473
- }
6474
- },
6529
+ includeContainer: false,
6530
+ ...import_lodash2.merge(navbarLayoutElementProps, componentsProps?.navbarLayoutElement),
6475
6531
  children: navbar
6476
6532
  }, undefined, false, undefined, this),
6477
- footerPosition !== undefined && footerPosition !== "content" /* Content */ && /* @__PURE__ */ jsxDEV13(FrameLayout_default.Element, {
6533
+ children,
6534
+ footerPosition !== null && /* @__PURE__ */ jsxDEV14(FrameLayout_default.Element, {
6478
6535
  section: footerPosition,
6479
- ...componentsProps?.footerLayoutElement,
6480
- componentsProps: {
6481
- ...componentsProps?.footerLayoutElement?.componentsProps,
6482
- container: {
6483
- ...footerContainerProps,
6484
- ...componentsProps?.footerLayoutElement?.componentsProps?.container
6485
- }
6486
- },
6487
- children: footer
6488
- }, undefined, false, undefined, this),
6489
- navbarPosition !== undefined && navbarPosition === "content" /* Content */ && /* @__PURE__ */ jsxDEV13(Fragment2, {
6490
- children: navbar
6491
- }, undefined, false, undefined, this),
6492
- /* @__PURE__ */ jsxDEV13(Box3, {
6493
- ...componentsProps?.childrenContainer,
6494
- children
6495
- }, undefined, false, undefined, this),
6496
- footerPosition !== undefined && footerPosition === "content" /* Content */ && /* @__PURE__ */ jsxDEV13(Fragment2, {
6536
+ ...import_lodash2.merge(footerLayoutElementProps, componentsProps?.footerLayoutElement),
6497
6537
  children: footer
6498
6538
  }, undefined, false, undefined, this)
6499
6539
  ]
@@ -6514,25 +6554,6 @@ import React6, {
6514
6554
  useEffect as useEffect3
6515
6555
  } from "react";
6516
6556
  import { usePathname as usePathname2 } from "next/navigation";
6517
-
6518
- // src/core/components/Page/PageContainer/index.tsx
6519
- import { Container } from "@mantine/core";
6520
- import { jsxDEV as jsxDEV14 } from "react/jsx-dev-runtime";
6521
- function PageContainer({
6522
- children,
6523
- pt,
6524
- componentsProps
6525
- }) {
6526
- const theme = useRemoraidTheme();
6527
- return /* @__PURE__ */ jsxDEV14(Container, {
6528
- size: theme.containerSize,
6529
- pt: pt ?? "md",
6530
- ...componentsProps?.container,
6531
- children
6532
- }, undefined, false, undefined, this);
6533
- }
6534
-
6535
- // src/core/components/Page/index.tsx
6536
6557
  import { jsxDEV as jsxDEV15 } from "react/jsx-dev-runtime";
6537
6558
  var pageContext = React6.createContext(null);
6538
6559
  var usePage = () => {
@@ -6542,7 +6563,7 @@ function Page({
6542
6563
  children,
6543
6564
  name,
6544
6565
  config,
6545
- pt,
6566
+ p = 0,
6546
6567
  componentsProps
6547
6568
  }) {
6548
6569
  const pathname = usePathname2();
@@ -6558,7 +6579,7 @@ function Page({
6558
6579
  return /* @__PURE__ */ jsxDEV15(pageContext.Provider, {
6559
6580
  value: { name: name ?? pathname, pageId, ...config },
6560
6581
  children: /* @__PURE__ */ jsxDEV15(PageContainer, {
6561
- pt,
6582
+ p,
6562
6583
  componentsProps: { container: componentsProps?.container },
6563
6584
  children
6564
6585
  }, undefined, false, undefined, this)
@@ -6580,8 +6601,9 @@ function ScrollableChipGroup({
6580
6601
  onChange,
6581
6602
  gap,
6582
6603
  componentsProps,
6583
- children
6604
+ children: childrenProp
6584
6605
  }) {
6606
+ const children = asChildrenOfType(Chip, childrenProp, "Check children passed to 'ScrollableChipGroup' component.");
6585
6607
  const theme = useRemoraidTheme();
6586
6608
  return /* @__PURE__ */ jsxDEV16(ScrollArea2, {
6587
6609
  ...theme.scrollAreaProps,
@@ -6611,12 +6633,12 @@ function WidgetSelectionHeader({
6611
6633
  mt
6612
6634
  }) {
6613
6635
  const theme = useRemoraidTheme();
6614
- const { widgets, isPageRegistered, updateWidgetSelectionBulk } = useWidgets();
6636
+ const { isPageRegistered, updateWidgetSelectionBulk, ...widgetsContext2 } = useWidgets();
6615
6637
  const page = usePage();
6616
6638
  if (!page) {
6617
- console.error("'WidgetSelectionHeader' must be rendered inside of a 'Page' component.");
6618
- return null;
6639
+ throw new InvalidComponentUsageError("WidgetSelectionHeader", "must be used as child of 'Page'.");
6619
6640
  }
6641
+ const widgets = widgetsContext2.widgets[page.pageId] ?? {};
6620
6642
  return /* @__PURE__ */ jsxDEV17(Flex3, {
6621
6643
  justify: "flex-start",
6622
6644
  align: "center",
@@ -6632,56 +6654,27 @@ function WidgetSelectionHeader({
6632
6654
  orientation: "vertical"
6633
6655
  }, undefined, false, undefined, this),
6634
6656
  isPageRegistered(page.pageId) && /* @__PURE__ */ jsxDEV17(ScrollableChipGroup, {
6635
- value: Object.keys(widgets[page.pageId]).filter((widgetId) => widgets[page.pageId][widgetId].selected),
6657
+ value: Object.keys(widgets).filter((widgetId) => widgets[widgetId]?.selected),
6636
6658
  onChange: (value) => {
6637
6659
  updateWidgetSelectionBulk(page.pageId, value);
6638
6660
  },
6639
6661
  componentsProps: { scrollArea: { flex: 1 } },
6640
- children: Object.keys(widgets[page.pageId]).map((widgetId) => /* @__PURE__ */ jsxDEV17(Chip2, {
6641
- value: widgetId,
6642
- size: "sm",
6643
- disabled: disabledWidgets && disabledWidgets.includes(widgetId),
6644
- icon: /* @__PURE__ */ jsxDEV17(IconCheck, {
6645
- ...theme.iconProps.tiny
6646
- }, undefined, false, undefined, this),
6647
- children: widgets[page.pageId][widgetId].name
6648
- }, 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
+ })
6649
6674
  }, undefined, false, undefined, this)
6650
6675
  ]
6651
6676
  }, undefined, true, undefined, this);
6652
6677
  }
6653
- // src/core/components/Widget/WidgetWrapper/CloseButton/index.tsx
6654
- import { ActionIcon, Transition } from "@mantine/core";
6655
- import { IconX } from "@tabler/icons-react";
6656
- import { jsxDEV as jsxDEV18 } from "react/jsx-dev-runtime";
6657
- function CloseButton({ widgetId }) {
6658
- const theme = useRemoraidTheme();
6659
- const { activeWidget, updateWidgetSelection } = useWidgets();
6660
- const page = usePage();
6661
- return /* @__PURE__ */ jsxDEV18(Transition, {
6662
- mounted: activeWidget === widgetId,
6663
- transition: "pop-top-right",
6664
- duration: theme.transitionDurations.short,
6665
- timingFunction: "ease",
6666
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV18(ActionIcon, {
6667
- pos: "absolute",
6668
- size: "xs",
6669
- className: "remoraid-close-button",
6670
- radius: "xl",
6671
- color: "red",
6672
- onClick: () => {
6673
- if (!page) {
6674
- return;
6675
- }
6676
- updateWidgetSelection(page.pageId, widgetId, false);
6677
- },
6678
- style: transitionStyle,
6679
- children: /* @__PURE__ */ jsxDEV18(IconX, {
6680
- ...theme.iconProps.tiny
6681
- }, undefined, false, undefined, this)
6682
- }, undefined, false, undefined, this)
6683
- }, undefined, false, undefined, this);
6684
- }
6685
6678
  // src/core/components/BadgeGroup/index.tsx
6686
6679
  import {
6687
6680
  Badge as Badge2,
@@ -6694,23 +6687,27 @@ import React7, { isValidElement as isValidElement2 } from "react";
6694
6687
  import {
6695
6688
  Badge,
6696
6689
  Tooltip as Tooltip2,
6697
- Transition as Transition2
6690
+ Transition
6698
6691
  } from "@mantine/core";
6699
- import { jsxDEV as jsxDEV19 } from "react/jsx-dev-runtime";
6700
- function BadgeMinimal(props) {
6701
- 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
+ }) {
6702
6699
  const theme = useRemoraidTheme();
6703
- return /* @__PURE__ */ jsxDEV19(Transition2, {
6704
- mounted: mounted !== false,
6700
+ return /* @__PURE__ */ jsxDEV18(Transition, {
6701
+ mounted,
6705
6702
  transition: "fade",
6706
6703
  duration: theme.transitionDurations.short,
6707
6704
  timingFunction: "ease",
6708
6705
  ...componentsProps?.transition,
6709
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV19(Tooltip2, {
6706
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV18(Tooltip2, {
6710
6707
  disabled: !tooltip,
6711
6708
  label: tooltip,
6712
6709
  ...componentsProps?.tooltip,
6713
- children: /* @__PURE__ */ jsxDEV19(Badge, {
6710
+ children: /* @__PURE__ */ jsxDEV18(Badge, {
6714
6711
  variant: "default",
6715
6712
  ...componentsProps?.badge,
6716
6713
  style: {
@@ -6725,7 +6722,7 @@ function BadgeMinimal(props) {
6725
6722
  }
6726
6723
 
6727
6724
  // src/core/components/BadgeGroup/index.tsx
6728
- 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";
6729
6726
  import { createElement } from "react";
6730
6727
  function BadgeGroup({
6731
6728
  badges: badgesProp,
@@ -6736,9 +6733,9 @@ function BadgeGroup({
6736
6733
  const theme = useRemoraidTheme();
6737
6734
  const badges = badgesProp.map((badge) => asElementOrPropsOfType(BadgeMinimal, badge, "Check 'badges' property passed to 'BadgeGroup'."));
6738
6735
  const numVisibleBadges = badges.filter((badge) => isValidElementOfType(BadgeMinimal, badge) ? badge.props.mounted : badge.mounted !== false).length;
6739
- return /* @__PURE__ */ jsxDEV20(Fragment3, {
6736
+ return /* @__PURE__ */ jsxDEV19(Fragment2, {
6740
6737
  children: [
6741
- /* @__PURE__ */ jsxDEV20(Group3, {
6738
+ /* @__PURE__ */ jsxDEV19(Group3, {
6742
6739
  gap: gap ?? "xs",
6743
6740
  wrap: "nowrap",
6744
6741
  visibleFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
@@ -6754,10 +6751,10 @@ function BadgeGroup({
6754
6751
  });
6755
6752
  })
6756
6753
  }, undefined, false, undefined, this),
6757
- /* @__PURE__ */ jsxDEV20(Tooltip3, {
6754
+ /* @__PURE__ */ jsxDEV19(Tooltip3, {
6758
6755
  label: `${numVisibleBadges} badge${numVisibleBadges === 1 ? "" : "s"}`,
6759
6756
  ...componentsProps?.tooltip,
6760
- children: /* @__PURE__ */ jsxDEV20(Badge2, {
6757
+ children: /* @__PURE__ */ jsxDEV19(Badge2, {
6761
6758
  hiddenFrom: breakpoint ?? theme.breakpoints.badgeGroupCollapse,
6762
6759
  hidden: numVisibleBadges === 0,
6763
6760
  variant: "light",
@@ -6773,28 +6770,28 @@ function BadgeGroup({
6773
6770
  // src/core/components/AlertMinimal/index.tsx
6774
6771
  import {
6775
6772
  Alert,
6776
- Transition as Transition3
6773
+ Transition as Transition2
6777
6774
  } from "@mantine/core";
6778
- import { jsxDEV as jsxDEV21 } from "react/jsx-dev-runtime";
6775
+ import { jsxDEV as jsxDEV20 } from "react/jsx-dev-runtime";
6779
6776
  function AlertMinimal({
6780
6777
  title,
6781
6778
  category,
6782
6779
  text,
6783
6780
  onClose,
6784
- mounted,
6781
+ mounted = true,
6785
6782
  mt,
6786
6783
  mb,
6787
6784
  componentsProps,
6788
6785
  children
6789
6786
  }) {
6790
6787
  const theme = useRemoraidTheme();
6791
- return /* @__PURE__ */ jsxDEV21(Transition3, {
6788
+ return /* @__PURE__ */ jsxDEV20(Transition2, {
6792
6789
  mounted: mounted !== false,
6793
6790
  transition: "fade",
6794
6791
  duration: theme.transitionDurations.short,
6795
6792
  timingFunction: "ease",
6796
6793
  ...componentsProps?.transition,
6797
- children: (transitionStyle) => /* @__PURE__ */ jsxDEV21(Alert, {
6794
+ children: (transitionStyle) => /* @__PURE__ */ jsxDEV20(Alert, {
6798
6795
  ...theme.alertProps[category],
6799
6796
  title: title ?? theme.alertProps[category].title,
6800
6797
  withCloseButton: onClose !== undefined,
@@ -6815,154 +6812,509 @@ function AlertMinimal({
6815
6812
  }
6816
6813
  // src/core/components/RemoraidButton/index.tsx
6817
6814
  import {
6818
- ActionIcon as ActionIcon2,
6815
+ ActionIcon,
6819
6816
  Button,
6820
- Tooltip as Tooltip4
6817
+ Tooltip as Tooltip4,
6818
+ Transition as Transition3
6821
6819
  } from "@mantine/core";
6822
6820
  import { IconClick } from "@tabler/icons-react";
6823
- import { jsxDEV as jsxDEV22, Fragment as Fragment4 } from "react/jsx-dev-runtime";
6821
+ import { createElement as createElement2 } from "react";
6822
+ import { jsxDEV as jsxDEV21, Fragment as Fragment3 } from "react/jsx-dev-runtime";
6824
6823
  function RemoraidButton({
6825
6824
  label,
6826
- responsive,
6827
- breakpoint,
6828
- collapsed,
6825
+ responsive: ResponsiveProp,
6826
+ breakpoint: breakpointProp,
6827
+ collapsed: collapsedProp,
6829
6828
  size,
6830
6829
  color,
6831
6830
  onClick,
6832
6831
  loading,
6833
- variant,
6834
- componentsProps,
6835
- ...props
6832
+ variant = "default",
6833
+ mounted = true,
6834
+ icon: iconProp,
6835
+ iconSize = "medium" /* Medium */,
6836
+ componentsProps
6836
6837
  }) {
6838
+ const responsive = ResponsiveProp ?? true;
6839
+ const breakpoint = breakpointProp ?? "md";
6840
+ const collapsed = collapsedProp ?? false;
6841
+ const icon = iconProp ?? IconClick;
6837
6842
  const theme = useRemoraidTheme();
6838
- const iconProps = { ...theme.iconProps.medium, ...componentsProps?.icon };
6839
- const icon = props.icon ? /* @__PURE__ */ jsxDEV22(props.icon, {
6840
- ...iconProps
6841
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV22(IconClick, {
6842
- ...iconProps
6843
- }, undefined, false, undefined, this);
6844
- return /* @__PURE__ */ jsxDEV22(Fragment4, {
6845
- children: [
6846
- /* @__PURE__ */ jsxDEV22(Tooltip4, {
6847
- label,
6848
- ...componentsProps?.tooltip,
6849
- children: /* @__PURE__ */ jsxDEV22(ActionIcon2, {
6850
- "aria-label": label,
6851
- 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, {
6852
6875
  onClick,
6853
6876
  loading,
6854
- size: size ? `input-${size}` : "input-sm",
6877
+ variant,
6878
+ size,
6855
6879
  color,
6880
+ leftSection: iconProp ? iconElement : undefined,
6856
6881
  ...componentsProps?.button,
6857
- ...componentsProps?.ActionIcon,
6858
- hiddenFrom: responsive === false ? undefined : breakpoint ?? "md",
6859
- display: responsive === false && collapsed !== true ? "none" : componentsProps?.ActionIcon?.display ?? componentsProps?.button?.display,
6860
- 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
6861
6890
  }, undefined, false, undefined, this)
6862
- }, undefined, false, undefined, this),
6863
- /* @__PURE__ */ jsxDEV22(Button, {
6864
- onClick,
6865
- loading,
6866
- 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,
6867
6927
  size,
6868
6928
  color,
6869
- leftSection: props.icon ? icon : undefined,
6929
+ onClick,
6930
+ radius: "xl",
6870
6931
  ...componentsProps?.button,
6871
- ...componentsProps?.Button,
6872
- visibleFrom: responsive === false ? undefined : breakpoint ?? "md",
6873
- display: responsive === false && collapsed ? "none" : componentsProps?.Button?.display ?? componentsProps?.button?.display,
6874
- 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)
6875
6941
  }, undefined, false, undefined, this)
6876
- ]
6877
- }, undefined, true, undefined, this);
6942
+ }, undefined, false, undefined, this)
6943
+ }, undefined, false, undefined, this);
6878
6944
  }
6879
- // src/core/components/Widget/WidgetWrapper/index.tsx
6945
+
6946
+ // src/core/components/Controls/index.tsx
6947
+ import { useRef, useState as useState6 } from "react";
6880
6948
  import {
6949
+ Group as Group4,
6881
6950
  Paper as Paper2,
6882
- Transition as Transition4
6951
+ Transition as Transition5
6883
6952
  } from "@mantine/core";
6884
- import { useEffect as useEffect4 } from "react";
6953
+ import { IconGripHorizontal } from "@tabler/icons-react";
6954
+ var import_lodash3 = __toESM(require_lodash(), 1);
6885
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";
6886
7146
  function WidgetWrapper({
6887
- children,
6888
7147
  config,
6889
- mt,
6890
- withCloseButton,
6891
- componentsProps
7148
+ mt = 0,
7149
+ withCloseButton = true,
7150
+ pinnableSection,
7151
+ componentsProps,
7152
+ children
6892
7153
  }) {
6893
7154
  const {
6894
7155
  isWidgetSelected,
6895
7156
  isPageRegistered,
6896
7157
  isWidgetRegistered,
6897
7158
  registerWidget,
6898
- updateActiveWidget
7159
+ updateActiveWidget,
7160
+ updateWidgetSelection,
7161
+ activeWidget
6899
7162
  } = useWidgets();
6900
7163
  const page = usePage();
6901
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);
6902
7168
  const pageRegistered = page ? isPageRegistered(page.pageId) : false;
6903
- useEffect4(() => {
6904
- if (!page) {
6905
- return;
6906
- }
6907
- if (!isWidgetRegistered(page.pageId, config.widgetId)) {
6908
- registerWidget(page.pageId, config);
6909
- }
6910
- }, [pageRegistered]);
6911
- return /* @__PURE__ */ jsxDEV23(Transition4, {
6912
- 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,
6913
7181
  transition: "fade-left",
6914
7182
  duration: theme.transitionDurations.medium,
6915
7183
  timingFunction: "ease",
6916
- 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,
6917
7191
  p: "md",
6918
7192
  shadow: "md",
6919
7193
  bg: theme.transparentBackground,
6920
- mt: mt || 0,
7194
+ mt,
6921
7195
  pos: "relative",
6922
7196
  h: "fit-content",
6923
7197
  ...componentsProps?.container,
6924
- style: { ...transitionStyle, ...componentsProps?.container?.style },
6925
- onMouseEnter: () => {
6926
- updateActiveWidget(config.widgetId);
7198
+ onMouseEnter: (e) => {
7199
+ if (!pinnableSection) {
7200
+ handleEnter();
7201
+ }
7202
+ componentsProps?.container?.onMouseEnter?.(e);
6927
7203
  },
6928
- onMouseLeave: () => {
6929
- updateActiveWidget(null);
7204
+ onMouseLeave: (e) => {
7205
+ if (!pinnableSection) {
7206
+ handleLeave();
7207
+ }
7208
+ componentsProps?.container?.onMouseLeave?.(e);
6930
7209
  },
7210
+ style: import_lodash4.merge(transitionStyle, componentsProps?.container?.style),
7211
+ id: config.widgetId,
6931
7212
  children: [
6932
- withCloseButton !== false && /* @__PURE__ */ jsxDEV23(CloseButton, {
6933
- 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)
6934
7234
  }, undefined, false, undefined, this),
6935
7235
  children
6936
7236
  ]
6937
7237
  }, undefined, true, undefined, this)
6938
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;
6939
7293
  }
6940
- var WidgetWrapper_default = Object.assign(WidgetWrapper, {
6941
- CloseButton
6942
- });
6943
7294
  // src/core/components/Widget/index.tsx
6944
7295
  import {
6945
7296
  Center,
6946
7297
  Divider as Divider3,
6947
- Group as Group4,
7298
+ Group as Group5,
6948
7299
  Loader,
6949
7300
  Title,
6950
7301
  Stack as Stack3
6951
7302
  } from "@mantine/core";
6952
- import { jsxDEV as jsxDEV24, Fragment as Fragment5 } from "react/jsx-dev-runtime";
6953
- 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";
6954
7305
  function Widget({
6955
- children,
6956
7306
  id,
6957
- config,
6958
7307
  title,
7308
+ config,
6959
7309
  badges: badgesProp,
6960
7310
  buttons: buttonsProp,
6961
7311
  alerts: alertsProp,
6962
7312
  gaps,
6963
7313
  loading,
6964
7314
  mt,
6965
- componentsProps
7315
+ pinnableSection,
7316
+ componentsProps,
7317
+ children
6966
7318
  }) {
6967
7319
  const buttons = buttonsProp?.map((button) => asElementOrPropsOfType(RemoraidButton, button, "Check the 'buttons' property of this widget."));
6968
7320
  const alerts = alertsProp?.map((alert) => asElementOrPropsOfType(AlertMinimal, alert, "Check the 'alerts' property of this widget."));
@@ -6970,48 +7322,48 @@ function Widget({
6970
7322
  const badgesGap = (typeof gaps === "object" ? gaps.badges : gaps) ?? "xs";
6971
7323
  const buttonsGap = (typeof gaps === "object" ? gaps.buttons : gaps) ?? "xs";
6972
7324
  const alertsGap = (typeof gaps === "object" ? gaps.alerts : gaps) ?? "xs";
6973
- return /* @__PURE__ */ jsxDEV24(WidgetWrapper_default, {
7325
+ return /* @__PURE__ */ jsxDEV26(WidgetWrapper, {
6974
7326
  config: {
6975
7327
  widgetId: id,
6976
- name: title,
6977
- ...config
7328
+ ...config,
7329
+ initialValues: {
7330
+ name: title,
7331
+ ...config?.initialValues
7332
+ }
6978
7333
  },
6979
7334
  mt,
6980
- componentsProps: {
6981
- container: componentsProps?.container,
6982
- transition: componentsProps?.transition
6983
- },
6984
7335
  ...componentsProps?.wrapper,
7336
+ pinnableSection: pinnableSection ?? componentsProps?.wrapper?.pinnableSection,
6985
7337
  children: [
6986
- /* @__PURE__ */ jsxDEV24(Group4, {
7338
+ /* @__PURE__ */ jsxDEV26(Group5, {
6987
7339
  justify: "space-between",
6988
7340
  wrap: "nowrap",
6989
7341
  children: [
6990
- /* @__PURE__ */ jsxDEV24(Group4, {
7342
+ /* @__PURE__ */ jsxDEV26(Group5, {
6991
7343
  gap: badgesGap,
6992
7344
  wrap: "nowrap",
6993
7345
  children: [
6994
- /* @__PURE__ */ jsxDEV24(Title, {
7346
+ /* @__PURE__ */ jsxDEV26(Title, {
6995
7347
  order: 1,
6996
7348
  size: "h3",
6997
7349
  lineClamp: 1,
6998
- children: title
7350
+ children: title ?? id
6999
7351
  }, undefined, false, undefined, this),
7000
- badges !== undefined && /* @__PURE__ */ jsxDEV24(BadgeGroup, {
7352
+ badges !== undefined && /* @__PURE__ */ jsxDEV26(BadgeGroup, {
7001
7353
  badges,
7002
7354
  gap: badgesGap,
7003
7355
  ...componentsProps?.badgeGroup
7004
7356
  }, undefined, false, undefined, this)
7005
7357
  ]
7006
7358
  }, undefined, true, undefined, this),
7007
- /* @__PURE__ */ jsxDEV24(Group4, {
7359
+ /* @__PURE__ */ jsxDEV26(Group5, {
7008
7360
  gap: buttonsGap,
7009
7361
  wrap: "nowrap",
7010
7362
  children: buttons !== undefined && buttons.map((button, i) => {
7011
7363
  if (isValidElementOfType(RemoraidButton, button)) {
7012
7364
  return button;
7013
7365
  }
7014
- return /* @__PURE__ */ createElement2(RemoraidButton, {
7366
+ return /* @__PURE__ */ createElement3(RemoraidButton, {
7015
7367
  ...button,
7016
7368
  key: i
7017
7369
  });
@@ -7019,11 +7371,11 @@ function Widget({
7019
7371
  }, undefined, false, undefined, this)
7020
7372
  ]
7021
7373
  }, undefined, true, undefined, this),
7022
- /* @__PURE__ */ jsxDEV24(Divider3, {
7374
+ /* @__PURE__ */ jsxDEV26(Divider3, {
7023
7375
  my: "md",
7024
7376
  ...componentsProps?.divider
7025
7377
  }, undefined, false, undefined, this),
7026
- /* @__PURE__ */ jsxDEV24(Stack3, {
7378
+ /* @__PURE__ */ jsxDEV26(Stack3, {
7027
7379
  align: "stretch",
7028
7380
  gap: alertsGap,
7029
7381
  mb: alerts && alerts.length > 0 ? "md" : 0,
@@ -7032,17 +7384,17 @@ function Widget({
7032
7384
  if (isValidElementOfType(AlertMinimal, alert)) {
7033
7385
  return alert;
7034
7386
  }
7035
- return /* @__PURE__ */ createElement2(AlertMinimal, {
7387
+ return /* @__PURE__ */ createElement3(AlertMinimal, {
7036
7388
  ...alert,
7037
7389
  key: i
7038
7390
  });
7039
7391
  })
7040
7392
  }, undefined, false, undefined, this),
7041
- loading ? /* @__PURE__ */ jsxDEV24(Center, {
7042
- children: /* @__PURE__ */ jsxDEV24(Loader, {
7393
+ loading ? /* @__PURE__ */ jsxDEV26(Center, {
7394
+ children: /* @__PURE__ */ jsxDEV26(Loader, {
7043
7395
  ...componentsProps?.loader
7044
7396
  }, undefined, false, undefined, this)
7045
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV24(Fragment5, {
7397
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV26(Fragment4, {
7046
7398
  children
7047
7399
  }, undefined, false, undefined, this)
7048
7400
  ]
@@ -7051,7 +7403,7 @@ function Widget({
7051
7403
  // src/core/components/NotFoundPage/index.tsx
7052
7404
  import { Alert as Alert2 } from "@mantine/core";
7053
7405
  import { usePathname as usePathname3 } from "next/navigation";
7054
- import { jsxDEV as jsxDEV25 } from "react/jsx-dev-runtime";
7406
+ import { jsxDEV as jsxDEV27 } from "react/jsx-dev-runtime";
7055
7407
  function NotFoundPage({
7056
7408
  children,
7057
7409
  message,
@@ -7059,11 +7411,11 @@ function NotFoundPage({
7059
7411
  }) {
7060
7412
  const pathname = usePathname3();
7061
7413
  const theme = useRemoraidTheme();
7062
- return /* @__PURE__ */ jsxDEV25(Page, {
7414
+ return /* @__PURE__ */ jsxDEV27(Page, {
7063
7415
  name: "Not Found",
7064
7416
  ...componentsProps?.page,
7065
7417
  children: [
7066
- /* @__PURE__ */ jsxDEV25(Alert2, {
7418
+ /* @__PURE__ */ jsxDEV27(Alert2, {
7067
7419
  ...theme.alertProps.negative,
7068
7420
  title: "404 - Page Not Found",
7069
7421
  children: message ?? `Could not find page ${pathname}.`
@@ -7074,7 +7426,7 @@ function NotFoundPage({
7074
7426
  }
7075
7427
  // src/core/components/EnvironmentShell/index.tsx
7076
7428
  import { Alert as Alert3 } from "@mantine/core";
7077
- 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";
7078
7430
  function EnvironmentShell({
7079
7431
  children,
7080
7432
  environment,
@@ -7088,7 +7440,7 @@ function EnvironmentShell({
7088
7440
  const undefinedKeys = Object.keys(environment).filter((key) => environment[key] === undefined);
7089
7441
  const alertTitle = `Please Specify Environment Variable${undefinedKeys.length > 1 ? "s" : ""}`;
7090
7442
  const alertMessage = `Components could not be rendered because the following environment variables are not specified: ${undefinedKeys.join(", ")}.`;
7091
- const alert = /* @__PURE__ */ jsxDEV26(Alert3, {
7443
+ const alert = /* @__PURE__ */ jsxDEV28(Alert3, {
7092
7444
  ...theme.alertProps.neutral,
7093
7445
  title: alertTitle,
7094
7446
  m,
@@ -7096,12 +7448,12 @@ function EnvironmentShell({
7096
7448
  children: message ?? alertMessage
7097
7449
  }, undefined, false, undefined, this);
7098
7450
  if (undefinedKeys.length === 0) {
7099
- return /* @__PURE__ */ jsxDEV26(Fragment6, {
7451
+ return /* @__PURE__ */ jsxDEV28(Fragment5, {
7100
7452
  children
7101
7453
  }, undefined, false, undefined, this);
7102
7454
  }
7103
7455
  if (withContainer) {
7104
- return /* @__PURE__ */ jsxDEV26(PageContainer, {
7456
+ return /* @__PURE__ */ jsxDEV28(PageContainer, {
7105
7457
  componentsProps: { container: componentsProps?.container },
7106
7458
  children: alert
7107
7459
  }, undefined, false, undefined, this);
@@ -7114,15 +7466,15 @@ import { IconRestore } from "@tabler/icons-react";
7114
7466
 
7115
7467
  // src/core/components/SettingsWidget/SaveButton/index.tsx
7116
7468
  import { IconDeviceFloppy } from "@tabler/icons-react";
7117
- import { Group as Group5 } from "@mantine/core";
7118
- 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";
7119
7471
  function SaveButton({
7120
7472
  onSaveChanges,
7121
7473
  insideContainer,
7122
7474
  componentsProps
7123
7475
  }) {
7124
7476
  const settingsWidgetOptions = useSettingsWidgetContext();
7125
- const button = /* @__PURE__ */ jsxDEV27(RemoraidButton, {
7477
+ const button = /* @__PURE__ */ jsxDEV29(RemoraidButton, {
7126
7478
  label: "Save Changes",
7127
7479
  icon: IconDeviceFloppy,
7128
7480
  onClick: onSaveChanges,
@@ -7137,7 +7489,7 @@ function SaveButton({
7137
7489
  }
7138
7490
  }, undefined, false, undefined, this);
7139
7491
  if (insideContainer !== false) {
7140
- return /* @__PURE__ */ jsxDEV27(Group5, {
7492
+ return /* @__PURE__ */ jsxDEV29(Group6, {
7141
7493
  w: "100%",
7142
7494
  justify: "flex-end",
7143
7495
  mt: "md",
@@ -7149,7 +7501,7 @@ function SaveButton({
7149
7501
  }
7150
7502
 
7151
7503
  // src/core/components/SettingsWidget/index.tsx
7152
- import { jsxDEV as jsxDEV28 } from "react/jsx-dev-runtime";
7504
+ import { jsxDEV as jsxDEV30 } from "react/jsx-dev-runtime";
7153
7505
  var defaultSettingsWidgetContext = {};
7154
7506
  var settingsWidgetContext = createContext6(defaultSettingsWidgetContext);
7155
7507
  var useSettingsWidgetContext = () => {
@@ -7162,9 +7514,9 @@ function SettingsWidget({
7162
7514
  custom,
7163
7515
  widgetProps
7164
7516
  }) {
7165
- return /* @__PURE__ */ jsxDEV28(settingsWidgetContext.Provider, {
7517
+ return /* @__PURE__ */ jsxDEV30(settingsWidgetContext.Provider, {
7166
7518
  value: { custom, unsavedChanges },
7167
- children: /* @__PURE__ */ jsxDEV28(Widget, {
7519
+ children: /* @__PURE__ */ jsxDEV30(Widget, {
7168
7520
  title: "Settings",
7169
7521
  id: "settings",
7170
7522
  mt: "md",
@@ -7205,22 +7557,22 @@ import { Table as Table2 } from "@mantine/core";
7205
7557
 
7206
7558
  // src/core/components/SettingsWidget/SettingsTable/Row/index.tsx
7207
7559
  import { Table, Text as Text2 } from "@mantine/core";
7208
- import { jsxDEV as jsxDEV29 } from "react/jsx-dev-runtime";
7560
+ import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
7209
7561
  function Row({
7210
7562
  children,
7211
7563
  label
7212
7564
  }) {
7213
7565
  const options = useSettingsTableOptions();
7214
- return /* @__PURE__ */ jsxDEV29(Table.Tr, {
7566
+ return /* @__PURE__ */ jsxDEV31(Table.Tr, {
7215
7567
  children: [
7216
- /* @__PURE__ */ jsxDEV29(Table.Th, {
7568
+ /* @__PURE__ */ jsxDEV31(Table.Th, {
7217
7569
  w: options.leftColumnWidth,
7218
- children: /* @__PURE__ */ jsxDEV29(Text2, {
7570
+ children: /* @__PURE__ */ jsxDEV31(Text2, {
7219
7571
  size: "sm",
7220
7572
  children: label
7221
7573
  }, undefined, false, undefined, this)
7222
7574
  }, undefined, false, undefined, this),
7223
- /* @__PURE__ */ jsxDEV29(Table.Td, {
7575
+ /* @__PURE__ */ jsxDEV31(Table.Td, {
7224
7576
  py: "xs",
7225
7577
  children
7226
7578
  }, undefined, false, undefined, this)
@@ -7229,7 +7581,7 @@ function Row({
7229
7581
  }
7230
7582
 
7231
7583
  // src/core/components/SettingsWidget/SettingsTable/index.tsx
7232
- import { jsxDEV as jsxDEV30 } from "react/jsx-dev-runtime";
7584
+ import { jsxDEV as jsxDEV32 } from "react/jsx-dev-runtime";
7233
7585
  var defaultSettingsTableOptions = {
7234
7586
  leftColumnWidth: "38.2%"
7235
7587
  };
@@ -7241,18 +7593,18 @@ function SettingsTable({
7241
7593
  leftColumnWidth,
7242
7594
  children: childrenProp
7243
7595
  }) {
7244
- const theme = useRemoraidTheme();
7245
7596
  const children = asChildrenOfType(Row, childrenProp, "Check children passed to 'SettingsTable' component.");
7246
- return /* @__PURE__ */ jsxDEV30(settingsTableOptionsContext.Provider, {
7597
+ const theme = useRemoraidTheme();
7598
+ return /* @__PURE__ */ jsxDEV32(settingsTableOptionsContext.Provider, {
7247
7599
  value: {
7248
7600
  leftColumnWidth: leftColumnWidth ?? defaultSettingsTableOptions.leftColumnWidth
7249
7601
  },
7250
- children: /* @__PURE__ */ jsxDEV30(Table2, {
7602
+ children: /* @__PURE__ */ jsxDEV32(Table2, {
7251
7603
  bg: theme.transparentBackground,
7252
7604
  withTableBorder: true,
7253
7605
  variant: "vertical",
7254
7606
  layout: "fixed",
7255
- children: /* @__PURE__ */ jsxDEV30(Table2.Tbody, {
7607
+ children: /* @__PURE__ */ jsxDEV32(Table2.Tbody, {
7256
7608
  children
7257
7609
  }, undefined, false, undefined, this)
7258
7610
  }, undefined, false, undefined, this)
@@ -7262,20 +7614,21 @@ var SettingsTable_default = Object.assign(SettingsTable, {
7262
7614
  Row
7263
7615
  });
7264
7616
  // src/core/components/NavbarSettingsWidget/index.tsx
7265
- var import_lodash = __toESM(require_lodash(), 1);
7266
- 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";
7267
7619
  import { IconLink as IconLink2 } from "@tabler/icons-react";
7268
- import { jsxDEV as jsxDEV31 } from "react/jsx-dev-runtime";
7620
+ import { jsxDEV as jsxDEV33 } from "react/jsx-dev-runtime";
7269
7621
  var defaultNavbarSettingsWidgetId = "navbar-settings";
7270
7622
  function NavbarSettingsWidget({
7271
- additionalRows,
7623
+ additionalRows: additionalRowsProp,
7272
7624
  widgetProps,
7273
7625
  componentsProps
7274
7626
  }) {
7627
+ const additionalRows = additionalRowsProp?.map((additionalRow) => asElementOrPropsOfType(SettingsTable_default.Row, additionalRow, "Check the 'additionalRows' property of 'NavbarSettingsWidget'."));
7275
7628
  const { userExperience, updateUserExperience, initialUserExperience } = useRemoraidUserExperience();
7276
7629
  const app = useRemoraidApp();
7277
7630
  const theme = useRemoraidTheme();
7278
- return /* @__PURE__ */ jsxDEV31(SettingsWidget_default, {
7631
+ return /* @__PURE__ */ jsxDEV33(SettingsWidget_default, {
7279
7632
  widgetProps: {
7280
7633
  id: defaultNavbarSettingsWidgetId,
7281
7634
  title: "Navbar Settings",
@@ -7287,13 +7640,13 @@ function NavbarSettingsWidget({
7287
7640
  navbar: initialUserExperience.navbar
7288
7641
  }));
7289
7642
  },
7290
- custom: !import_lodash.isEqual(userExperience.navbar, initialUserExperience.navbar),
7291
- children: /* @__PURE__ */ jsxDEV31(SettingsTable_default, {
7643
+ custom: !import_lodash5.isEqual(userExperience.navbar, initialUserExperience.navbar),
7644
+ children: /* @__PURE__ */ jsxDEV33(SettingsTable_default, {
7292
7645
  ...componentsProps?.table,
7293
7646
  children: [
7294
- /* @__PURE__ */ jsxDEV31(SettingsTable_default.Row, {
7647
+ /* @__PURE__ */ jsxDEV33(SettingsTable_default.Row, {
7295
7648
  label: "Select which pages you want to display or hide",
7296
- children: /* @__PURE__ */ jsxDEV31(Chip3.Group, {
7649
+ children: /* @__PURE__ */ jsxDEV33(Chip3.Group, {
7297
7650
  multiple: true,
7298
7651
  value: app.navigablePages.filter((p) => !userExperience.navbar.hiddenPages.includes(p.href)).map((p) => p.href),
7299
7652
  onChange: (newValue) => {
@@ -7305,12 +7658,12 @@ function NavbarSettingsWidget({
7305
7658
  }
7306
7659
  }));
7307
7660
  },
7308
- children: /* @__PURE__ */ jsxDEV31(Group6, {
7661
+ children: /* @__PURE__ */ jsxDEV33(Group7, {
7309
7662
  justify: "flex-start",
7310
7663
  gap: "xs",
7311
- 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, {
7312
7665
  value: p.href,
7313
- icon: /* @__PURE__ */ jsxDEV31(p.icon, {
7666
+ icon: /* @__PURE__ */ jsxDEV33(p.icon, {
7314
7667
  ...theme.iconProps.tiny,
7315
7668
  color: theme.primaryColor
7316
7669
  }, undefined, false, undefined, this),
@@ -7324,7 +7677,7 @@ function NavbarSettingsWidget({
7324
7677
  if (isValidElementOfType(SettingsTable_default.Row, row)) {
7325
7678
  return row;
7326
7679
  }
7327
- return /* @__PURE__ */ jsxDEV31(SettingsTable_default.Row, {
7680
+ return /* @__PURE__ */ jsxDEV33(SettingsTable_default.Row, {
7328
7681
  ...row
7329
7682
  }, i, false, undefined, this);
7330
7683
  })
@@ -7334,7 +7687,7 @@ function NavbarSettingsWidget({
7334
7687
  }
7335
7688
  // src/core/components/ContextClusterProvider/index.tsx
7336
7689
  import React8 from "react";
7337
- import { jsxDEV as jsxDEV32 } from "react/jsx-dev-runtime";
7690
+ import { jsxDEV as jsxDEV34 } from "react/jsx-dev-runtime";
7338
7691
  var createContextCluster = (generalDefaultValue, staticIds) => {
7339
7692
  const isStaticId = (id) => {
7340
7693
  if (staticIds?.find((staticId) => staticId === id)) {
@@ -7369,13 +7722,14 @@ function ContextClusterProvider({
7369
7722
  values = {},
7370
7723
  children
7371
7724
  }) {
7372
- return Object.entries(cluster.contexts).reduceRight((t, [id, context]) => /* @__PURE__ */ jsxDEV32(context.Provider, {
7725
+ return Object.entries(cluster.contexts).reduceRight((t, [id, context]) => context ? /* @__PURE__ */ jsxDEV34(context.Provider, {
7373
7726
  value: values[id] ?? cluster.defaultValues[id] ?? cluster.generalDefaultValue,
7374
7727
  children: t
7375
- }, undefined, false, undefined, this), children);
7728
+ }, undefined, false, undefined, this) : t, children);
7376
7729
  }
7377
7730
  export {
7378
7731
  useWidgets,
7732
+ useWidget,
7379
7733
  useSettingsWidgetContext as useSettingsWidgetOptions,
7380
7734
  useSettingsTableOptions,
7381
7735
  useRemoraidUserExperience,
@@ -7386,18 +7740,17 @@ export {
7386
7740
  useHydrationStatus,
7387
7741
  useHydratedMantineColorScheme,
7388
7742
  useFrameLayout,
7743
+ remoraidAppShellLayoutId,
7389
7744
  isValidElementOfType,
7390
- isFrameLayout,
7391
7745
  getElementTypeName,
7746
+ getDefaultWidgetContext,
7392
7747
  defaultUserExperienceCookieName,
7393
7748
  defaultUserExperience,
7394
7749
  defaultSettingsWidgetContext as defaultSettingsWidgetOptions,
7395
7750
  defaultSettingsTableOptions,
7396
7751
  defaultNavbarSettingsWidgetId,
7397
7752
  defaultLayoutsContext,
7398
- defaultFrameLayoutContext,
7399
7753
  defaultAppShellNavbarPositions,
7400
- defaultAppShellLayoutId,
7401
7754
  defaultAppShellFooterPositions,
7402
7755
  defaultAppContext,
7403
7756
  createUserExperienceContext,
@@ -7407,7 +7760,7 @@ export {
7407
7760
  asElementOrPropsOfType,
7408
7761
  asElementOfType,
7409
7762
  asChildrenOfType,
7410
- WidgetWrapper_default as WidgetWrapper,
7763
+ WidgetWrapper,
7411
7764
  WidgetSelectionHeader,
7412
7765
  Widget,
7413
7766
  UserExperienceProviderWrapper,
@@ -7419,6 +7772,7 @@ export {
7419
7772
  RemoraidIconSize,
7420
7773
  RemoraidButton,
7421
7774
  RemoraidBreakpoint,
7775
+ Pinnable,
7422
7776
  PageContainer,
7423
7777
  Page,
7424
7778
  NotFoundPage,
@@ -7426,11 +7780,12 @@ export {
7426
7780
  NavbarSettingsWidget,
7427
7781
  LayoutType,
7428
7782
  HydrationStatusProvider,
7429
- FrameLayoutVariant,
7430
7783
  FrameLayoutSection,
7431
7784
  FrameLayout_default as FrameLayout,
7432
7785
  FooterVariant,
7433
7786
  EnvironmentShell,
7787
+ Controls,
7788
+ ControlButton,
7434
7789
  ContextClusterProvider,
7435
7790
  BadgeMinimal,
7436
7791
  BadgeGroup,