@moontra/moonui-pro 2.25.15 → 2.25.16

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.
package/dist/index.mjs CHANGED
@@ -8594,8 +8594,6 @@ function toast({ ...props }) {
8594
8594
  update
8595
8595
  };
8596
8596
  }
8597
-
8598
- // ../../node_modules/@radix-ui/primitive/dist/index.mjs
8599
8597
  function composeEventHandlers2(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
8600
8598
  return function handleEvent(event) {
8601
8599
  originalEventHandler?.(event);
@@ -9925,15 +9923,9 @@ function getWindowScrollBarX(element, rect) {
9925
9923
  }
9926
9924
  return rect.left + leftScroll;
9927
9925
  }
9928
- function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
9929
- if (ignoreScrollbarX === void 0) {
9930
- ignoreScrollbarX = false;
9931
- }
9926
+ function getHTMLOffset(documentElement, scroll) {
9932
9927
  const htmlRect = documentElement.getBoundingClientRect();
9933
- const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
9934
- // RTL <body> scrollbar.
9935
- getWindowScrollBarX(documentElement, htmlRect)
9936
- ));
9928
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
9937
9929
  const y = htmlRect.top + scroll.scrollTop;
9938
9930
  return {
9939
9931
  x,
@@ -9971,7 +9963,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
9971
9963
  offsets.y = offsetRect.y + offsetParent.clientTop;
9972
9964
  }
9973
9965
  }
9974
- const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
9966
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
9975
9967
  return {
9976
9968
  width: rect.width * scale.x,
9977
9969
  height: rect.height * scale.y,
@@ -10000,6 +9992,7 @@ function getDocumentRect(element) {
10000
9992
  y
10001
9993
  };
10002
9994
  }
9995
+ var SCROLLBAR_MAX = 25;
10003
9996
  function getViewportRect(element, strategy) {
10004
9997
  const win = getWindow(element);
10005
9998
  const html = getDocumentElement(element);
@@ -10017,6 +10010,19 @@ function getViewportRect(element, strategy) {
10017
10010
  y = visualViewport.offsetTop;
10018
10011
  }
10019
10012
  }
10013
+ const windowScrollbarX = getWindowScrollBarX(html);
10014
+ if (windowScrollbarX <= 0) {
10015
+ const doc3 = html.ownerDocument;
10016
+ const body = doc3.body;
10017
+ const bodyStyles = getComputedStyle(body);
10018
+ const bodyMarginInline = doc3.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
10019
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
10020
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
10021
+ width -= clippingStableScrollbarWidth;
10022
+ }
10023
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
10024
+ width += windowScrollbarX;
10025
+ }
10020
10026
  return {
10021
10027
  width,
10022
10028
  height,
@@ -10759,8 +10765,13 @@ var PopperAnchor = t.forwardRef(
10759
10765
  const context = usePopperContext(ANCHOR_NAME, __scopePopper);
10760
10766
  const ref = t.useRef(null);
10761
10767
  const composedRefs = useComposedRefs2(forwardedRef, ref);
10768
+ const anchorRef = t.useRef(null);
10762
10769
  t.useEffect(() => {
10763
- context.onAnchorChange(virtualRef?.current || ref.current);
10770
+ const previousAnchor = anchorRef.current;
10771
+ anchorRef.current = virtualRef?.current || ref.current;
10772
+ if (previousAnchor !== anchorRef.current) {
10773
+ context.onAnchorChange(anchorRef.current);
10774
+ }
10764
10775
  });
10765
10776
  return virtualRef ? null : /* @__PURE__ */ jsx(Primitive2.div, { ...anchorProps, ref: composedRefs });
10766
10777
  }
@@ -11083,7 +11094,7 @@ function usePresence2(present) {
11083
11094
  const ownerWindow = node.ownerDocument.defaultView ?? window;
11084
11095
  const handleAnimationEnd = (event) => {
11085
11096
  const currentAnimationName = getAnimationName2(stylesRef.current);
11086
- const isCurrentAnimation = currentAnimationName.includes(event.animationName);
11097
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
11087
11098
  if (event.target === node && isCurrentAnimation) {
11088
11099
  send("ANIMATION_END");
11089
11100
  if (!prevPresentRef.current) {
@@ -32979,12 +32990,17 @@ function run2(config) {
32979
32990
  });
32980
32991
  const handlers2 = [];
32981
32992
  state.doc.nodesBetween(from2, to, (node, pos) => {
32982
- if (!node.isTextblock || node.type.spec.code) {
32993
+ var _a2, _b, _c, _d, _e2;
32994
+ if (((_b = (_a2 = node.type) == null ? void 0 : _a2.spec) == null ? void 0 : _b.code) || !(node.isText || node.isTextblock || node.isInline)) {
32983
32995
  return;
32984
32996
  }
32997
+ const contentSize = (_e2 = (_d = (_c = node.content) == null ? void 0 : _c.size) != null ? _d : node.nodeSize) != null ? _e2 : 0;
32985
32998
  const resolvedFrom = Math.max(from2, pos);
32986
- const resolvedTo = Math.min(to, pos + node.content.size);
32987
- const textToMatch = node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, "\uFFFC");
32999
+ const resolvedTo = Math.min(to, pos + contentSize);
33000
+ if (resolvedFrom >= resolvedTo) {
33001
+ return;
33002
+ }
33003
+ const textToMatch = node.isText ? node.text || "" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, "\uFFFC");
32988
33004
  const matches2 = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);
32989
33005
  matches2.forEach((match) => {
32990
33006
  if (match.index === void 0) {
@@ -33199,8 +33215,6 @@ var ExtensionManager = class {
33199
33215
  get plugins() {
33200
33216
  const { editor } = this;
33201
33217
  const extensions = sortExtensions([...this.extensions].reverse());
33202
- const inputRules = [];
33203
- const pasteRules = [];
33204
33218
  const allPlugins = extensions.map((extension) => {
33205
33219
  const context = {
33206
33220
  name: extension.name,
@@ -33231,11 +33245,23 @@ var ExtensionManager = class {
33231
33245
  plugins.push(keyMapPlugin);
33232
33246
  const addInputRules = getExtensionField(extension, "addInputRules", context);
33233
33247
  if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
33234
- inputRules.push(...addInputRules());
33248
+ const rules = addInputRules();
33249
+ if (rules && rules.length) {
33250
+ const inputResult = inputRulesPlugin({
33251
+ editor,
33252
+ rules
33253
+ });
33254
+ const inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];
33255
+ plugins.push(...inputPlugins);
33256
+ }
33235
33257
  }
33236
33258
  const addPasteRules = getExtensionField(extension, "addPasteRules", context);
33237
33259
  if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
33238
- pasteRules.push(...addPasteRules());
33260
+ const rules = addPasteRules();
33261
+ if (rules && rules.length) {
33262
+ const pasteRules = pasteRulesPlugin({ editor, rules });
33263
+ plugins.push(...pasteRules);
33264
+ }
33239
33265
  }
33240
33266
  const addProseMirrorPlugins = getExtensionField(
33241
33267
  extension,
@@ -33248,17 +33274,7 @@ var ExtensionManager = class {
33248
33274
  }
33249
33275
  return plugins;
33250
33276
  }).flat();
33251
- return [
33252
- inputRulesPlugin({
33253
- editor,
33254
- rules: inputRules
33255
- }),
33256
- ...pasteRulesPlugin({
33257
- editor,
33258
- rules: pasteRules
33259
- }),
33260
- ...allPlugins
33261
- ];
33277
+ return allPlugins;
33262
33278
  }
33263
33279
  /**
33264
33280
  * Get all attributes from the extensions.
@@ -34060,7 +34076,8 @@ function canSetMark(state, tr2, newMarkType) {
34060
34076
  }
34061
34077
  if (cursor) {
34062
34078
  const currentMarks = (_a2 = state.storedMarks) != null ? _a2 : cursor.marks();
34063
- return !!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType));
34079
+ const parentAllowsMarkType = cursor.parent.type.allowsMarkType(newMarkType);
34080
+ return parentAllowsMarkType && (!!newMarkType.isInSet(currentMarks) || !currentMarks.some((mark) => mark.type.excludes(newMarkType)));
34064
34081
  }
34065
34082
  const { ranges } = selection;
34066
34083
  return ranges.some(({ $from, $to }) => {
@@ -35160,6 +35177,8 @@ var Editor = class extends EventEmitter {
35160
35177
  emitContentError: false,
35161
35178
  onBeforeCreate: () => null,
35162
35179
  onCreate: () => null,
35180
+ onMount: () => null,
35181
+ onUnmount: () => null,
35163
35182
  onUpdate: () => null,
35164
35183
  onSelectionUpdate: () => null,
35165
35184
  onTransaction: () => null,
@@ -35181,6 +35200,8 @@ var Editor = class extends EventEmitter {
35181
35200
  this.createSchema();
35182
35201
  this.on("beforeCreate", this.options.onBeforeCreate);
35183
35202
  this.emit("beforeCreate", { editor: this });
35203
+ this.on("mount", this.options.onMount);
35204
+ this.on("unmount", this.options.onUnmount);
35184
35205
  this.on("contentError", this.options.onContentError);
35185
35206
  this.on("create", this.options.onCreate);
35186
35207
  this.on("update", this.options.onUpdate);
@@ -35213,6 +35234,7 @@ var Editor = class extends EventEmitter {
35213
35234
  );
35214
35235
  }
35215
35236
  this.createView(el);
35237
+ this.emit("mount", { editor: this });
35216
35238
  window.setTimeout(() => {
35217
35239
  if (this.isDestroyed) {
35218
35240
  return;
@@ -35226,7 +35248,6 @@ var Editor = class extends EventEmitter {
35226
35248
  * Remove the editor from the DOM, but still allow remounting at a different point in time
35227
35249
  */
35228
35250
  unmount() {
35229
- var _a2;
35230
35251
  if (this.editorView) {
35231
35252
  const dom = this.editorView.dom;
35232
35253
  if (dom == null ? void 0 : dom.editor) {
@@ -35236,8 +35257,19 @@ var Editor = class extends EventEmitter {
35236
35257
  }
35237
35258
  this.editorView = null;
35238
35259
  this.isInitialized = false;
35239
- (_a2 = this.css) == null ? void 0 : _a2.remove();
35260
+ if (this.css) {
35261
+ try {
35262
+ if (typeof this.css.remove === "function") {
35263
+ this.css.remove();
35264
+ } else if (this.css.parentNode) {
35265
+ this.css.parentNode.removeChild(this.css);
35266
+ }
35267
+ } catch (error) {
35268
+ console.warn("Failed to remove CSS element:", error);
35269
+ }
35270
+ }
35240
35271
  this.css = null;
35272
+ this.emit("unmount", { editor: this });
35241
35273
  }
35242
35274
  /**
35243
35275
  * Returns the editor storage.
@@ -36563,7 +36595,7 @@ var Bold = Mark2.create({
36563
36595
  });
36564
36596
 
36565
36597
  // ../../node_modules/@tiptap/extension-code/dist/index.js
36566
- var inputRegex2 = /(^|[^`])`([^`]+)`(?!`)/;
36598
+ var inputRegex2 = /(^|[^`])`([^`]+)`(?!`)$/;
36567
36599
  var pasteRegex = /(^|[^`])`([^`]+)`(?!`)/g;
36568
36600
  var Code = Mark2.create({
36569
36601
  name: "code",
@@ -36628,6 +36660,8 @@ var CodeBlock = Node3.create({
36628
36660
  exitOnTripleEnter: true,
36629
36661
  exitOnArrowDown: true,
36630
36662
  defaultLanguage: null,
36663
+ enableTabIndentation: false,
36664
+ tabSize: 4,
36631
36665
  HTMLAttributes: {}
36632
36666
  };
36633
36667
  },
@@ -36701,6 +36735,91 @@ var CodeBlock = Node3.create({
36701
36735
  }
36702
36736
  return false;
36703
36737
  },
36738
+ // handle tab indentation
36739
+ Tab: ({ editor }) => {
36740
+ if (!this.options.enableTabIndentation) {
36741
+ return false;
36742
+ }
36743
+ const { state } = editor;
36744
+ const { selection } = state;
36745
+ const { $from, empty: empty2 } = selection;
36746
+ if ($from.parent.type !== this.type) {
36747
+ return false;
36748
+ }
36749
+ const indent = " ".repeat(this.options.tabSize);
36750
+ if (empty2) {
36751
+ return editor.commands.insertContent(indent);
36752
+ }
36753
+ return editor.commands.command(({ tr: tr2 }) => {
36754
+ const { from: from2, to } = selection;
36755
+ const text = state.doc.textBetween(from2, to, "\n", "\n");
36756
+ const lines = text.split("\n");
36757
+ const indentedText = lines.map((line) => indent + line).join("\n");
36758
+ tr2.replaceWith(from2, to, state.schema.text(indentedText));
36759
+ return true;
36760
+ });
36761
+ },
36762
+ // handle shift+tab reverse indentation
36763
+ "Shift-Tab": ({ editor }) => {
36764
+ if (!this.options.enableTabIndentation) {
36765
+ return false;
36766
+ }
36767
+ const { state } = editor;
36768
+ const { selection } = state;
36769
+ const { $from, empty: empty2 } = selection;
36770
+ if ($from.parent.type !== this.type) {
36771
+ return false;
36772
+ }
36773
+ if (empty2) {
36774
+ return editor.commands.command(({ tr: tr2 }) => {
36775
+ var _a2;
36776
+ const { pos } = $from;
36777
+ const codeBlockStart = $from.start();
36778
+ const codeBlockEnd = $from.end();
36779
+ const allText = state.doc.textBetween(codeBlockStart, codeBlockEnd, "\n", "\n");
36780
+ const lines = allText.split("\n");
36781
+ let currentLineIndex = 0;
36782
+ let charCount = 0;
36783
+ const relativeCursorPos = pos - codeBlockStart;
36784
+ for (let i = 0; i < lines.length; i += 1) {
36785
+ if (charCount + lines[i].length >= relativeCursorPos) {
36786
+ currentLineIndex = i;
36787
+ break;
36788
+ }
36789
+ charCount += lines[i].length + 1;
36790
+ }
36791
+ const currentLine = lines[currentLineIndex];
36792
+ const leadingSpaces = ((_a2 = currentLine.match(/^ */)) == null ? void 0 : _a2[0]) || "";
36793
+ const spacesToRemove = Math.min(leadingSpaces.length, this.options.tabSize);
36794
+ if (spacesToRemove === 0) {
36795
+ return true;
36796
+ }
36797
+ let lineStartPos = codeBlockStart;
36798
+ for (let i = 0; i < currentLineIndex; i += 1) {
36799
+ lineStartPos += lines[i].length + 1;
36800
+ }
36801
+ tr2.delete(lineStartPos, lineStartPos + spacesToRemove);
36802
+ const cursorPosInLine = pos - lineStartPos;
36803
+ if (cursorPosInLine <= spacesToRemove) {
36804
+ tr2.setSelection(TextSelection.create(tr2.doc, lineStartPos));
36805
+ }
36806
+ return true;
36807
+ });
36808
+ }
36809
+ return editor.commands.command(({ tr: tr2 }) => {
36810
+ const { from: from2, to } = selection;
36811
+ const text = state.doc.textBetween(from2, to, "\n", "\n");
36812
+ const lines = text.split("\n");
36813
+ const reverseIndentText = lines.map((line) => {
36814
+ var _a2;
36815
+ const leadingSpaces = ((_a2 = line.match(/^ */)) == null ? void 0 : _a2[0]) || "";
36816
+ const spacesToRemove = Math.min(leadingSpaces.length, this.options.tabSize);
36817
+ return line.slice(spacesToRemove);
36818
+ }).join("\n");
36819
+ tr2.replaceWith(from2, to, state.schema.text(reverseIndentText));
36820
+ return true;
36821
+ });
36822
+ },
36704
36823
  // exit node on triple enter
36705
36824
  Enter: ({ editor }) => {
36706
36825
  if (!this.options.exitOnTripleEnter) {
@@ -43701,6 +43820,20 @@ var BackgroundColor = Extension.create({
43701
43820
  default: null,
43702
43821
  parseHTML: (element) => {
43703
43822
  var _a2;
43823
+ const styleAttr = element.getAttribute("style");
43824
+ if (styleAttr) {
43825
+ const decls = styleAttr.split(";").map((s) => s.trim()).filter(Boolean);
43826
+ for (let i = decls.length - 1; i >= 0; i -= 1) {
43827
+ const parts = decls[i].split(":");
43828
+ if (parts.length >= 2) {
43829
+ const prop = parts[0].trim().toLowerCase();
43830
+ const val = parts.slice(1).join(":").trim();
43831
+ if (prop === "background-color") {
43832
+ return val.replace(/['"]+/g, "");
43833
+ }
43834
+ }
43835
+ }
43836
+ }
43704
43837
  return (_a2 = element.style.backgroundColor) == null ? void 0 : _a2.replace(/['"]+/g, "");
43705
43838
  },
43706
43839
  renderHTML: (attributes) => {
@@ -43743,6 +43876,20 @@ var Color = Extension.create({
43743
43876
  default: null,
43744
43877
  parseHTML: (element) => {
43745
43878
  var _a2;
43879
+ const styleAttr = element.getAttribute("style");
43880
+ if (styleAttr) {
43881
+ const decls = styleAttr.split(";").map((s) => s.trim()).filter(Boolean);
43882
+ for (let i = decls.length - 1; i >= 0; i -= 1) {
43883
+ const parts = decls[i].split(":");
43884
+ if (parts.length >= 2) {
43885
+ const prop = parts[0].trim().toLowerCase();
43886
+ const val = parts.slice(1).join(":").trim();
43887
+ if (prop === "color") {
43888
+ return val.replace(/['"]+/g, "");
43889
+ }
43890
+ }
43891
+ }
43892
+ }
43746
43893
  return (_a2 = element.style.color) == null ? void 0 : _a2.replace(/['"]+/g, "");
43747
43894
  },
43748
43895
  renderHTML: (attributes) => {
@@ -44235,6 +44382,8 @@ var CodeBlockLowlight = index_default.extend({
44235
44382
  exitOnTripleEnter: true,
44236
44383
  exitOnArrowDown: true,
44237
44384
  defaultLanguage: null,
44385
+ enableTabIndentation: false,
44386
+ tabSize: 4,
44238
44387
  HTMLAttributes: {}
44239
44388
  };
44240
44389
  },
@@ -62513,7 +62662,8 @@ function AdvancedChartInternal({
62513
62662
  showTooltip && /* @__PURE__ */ jsx(
62514
62663
  Tooltip,
62515
62664
  {
62516
- cursor: { fill: darkMode ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.05)" }
62665
+ cursor: { fill: darkMode ? "rgba(255,255,255,0.05)" : "rgba(0,0,0,0.05)" },
62666
+ content: customTooltip ? customTooltip : CustomTooltip
62517
62667
  }
62518
62668
  ),
62519
62669
  showLegend && /* @__PURE__ */ jsx(
@@ -62585,7 +62735,12 @@ function AdvancedChartInternal({
62585
62735
  axisLine: { stroke: darkMode ? "#4b5563" : "#d1d5db" }
62586
62736
  }
62587
62737
  ),
62588
- showTooltip && /* @__PURE__ */ jsx(Tooltip, {}),
62738
+ showTooltip && /* @__PURE__ */ jsx(
62739
+ Tooltip,
62740
+ {
62741
+ content: customTooltip ? customTooltip : CustomTooltip
62742
+ }
62743
+ ),
62589
62744
  showLegend && /* @__PURE__ */ jsx(
62590
62745
  Legend,
62591
62746
  {
@@ -62716,7 +62871,12 @@ function AdvancedChartInternal({
62716
62871
  axisLine: { stroke: darkMode ? "#4b5563" : "#d1d5db" }
62717
62872
  }
62718
62873
  ),
62719
- showTooltip && /* @__PURE__ */ jsx(Tooltip, {}),
62874
+ showTooltip && /* @__PURE__ */ jsx(
62875
+ Tooltip,
62876
+ {
62877
+ content: customTooltip ? customTooltip : CustomTooltip
62878
+ }
62879
+ ),
62720
62880
  showLegend && /* @__PURE__ */ jsx(
62721
62881
  Legend,
62722
62882
  {
@@ -78445,10 +78605,10 @@ var cardVariants = cva(
78445
78605
  glass: "border border-white/20 bg-white/10 backdrop-blur-md dark:border-gray-700/30 dark:bg-gray-800/10"
78446
78606
  },
78447
78607
  size: {
78448
- default: "p-6",
78449
- sm: "p-4",
78450
- lg: "p-8",
78451
- xl: "p-10"
78608
+ default: "",
78609
+ sm: "",
78610
+ lg: "",
78611
+ xl: ""
78452
78612
  },
78453
78613
  radius: {
78454
78614
  default: "rounded-lg",
@@ -78501,7 +78661,7 @@ var CardHeader = t.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
78501
78661
  "div",
78502
78662
  {
78503
78663
  ref,
78504
- className: cn2("moonui-theme", "flex flex-col space-y-1.5", className),
78664
+ className: cn2("moonui-theme", "flex flex-col space-y-1.5 p-6", className),
78505
78665
  ...props
78506
78666
  }
78507
78667
  ));
@@ -78524,13 +78684,13 @@ var CardDescription2 = t.forwardRef(({ className, ...props }, ref) => /* @__PURE
78524
78684
  }
78525
78685
  ));
78526
78686
  CardDescription2.displayName = "CardDescription";
78527
- var CardContent = t.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn2("moonui-theme", "pt-0", className), ...props }));
78687
+ var CardContent = t.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn2("moonui-theme", "p-6 pt-0", className), ...props }));
78528
78688
  CardContent.displayName = "CardContent";
78529
78689
  var CardFooter = t.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
78530
78690
  "div",
78531
78691
  {
78532
78692
  ref,
78533
- className: cn2("moonui-theme", "flex items-center pt-4", className),
78693
+ className: cn2("moonui-theme", "flex items-center p-6 pt-0", className),
78534
78694
  ...props
78535
78695
  }
78536
78696
  ));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.25.15",
3
+ "version": "2.25.16",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",