tinacms 2.9.4 → 2.9.5

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.js CHANGED
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global2, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate-heading"), require("is-hotkey"), require("clsx"), require("@radix-ui/react-slot"), require("@udecode/plate-code-block"), require("lucide-react"), require("mermaid"), require("class-variance-authority"), require("cmdk"), require("@radix-ui/react-dialog"), require("@radix-ui/react-popover"), require("@udecode/plate"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-reset-node"), require("@udecode/plate-list"), require("@udecode/plate-resizable"), require("@udecode/plate-dnd"), require("@udecode/plate-table"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-separator"), require("@radix-ui/react-tooltip"), require("final-form"), require("final-form-arrays"), require("final-form-set-field-data"), require("react-final-form"), require("prop-types"), require("tailwind-merge"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("graphql"), require("@graphql-inspector/core"), require("react-dropzone"), require("@udecode/cmdk"), require("@headlessui/react"), require("@udecode/plate-trailing-block"), require("@udecode/plate-floating"), require("@udecode/plate-block-quote"), require("@udecode/plate-node-id"), require("@udecode/plate-link"), require("@udecode/plate-autoformat"), require("lodash.get"), require("moment"), require("date-fns"), require("dompurify"), require("sonner"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate-heading", "is-hotkey", "clsx", "@radix-ui/react-slot", "@udecode/plate-code-block", "lucide-react", "mermaid", "class-variance-authority", "cmdk", "@radix-ui/react-dialog", "@radix-ui/react-popover", "@udecode/plate", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-reset-node", "@udecode/plate-list", "@udecode/plate-resizable", "@udecode/plate-dnd", "@udecode/plate-table", "@radix-ui/react-dropdown-menu", "@radix-ui/react-toolbar", "@radix-ui/react-separator", "@radix-ui/react-tooltip", "final-form", "final-form-arrays", "final-form-set-field-data", "react-final-form", "prop-types", "tailwind-merge", "react-beautiful-dnd", "react-color", "color-string", "graphql", "@graphql-inspector/core", "react-dropzone", "@udecode/cmdk", "@headlessui/react", "@udecode/plate-trailing-block", "@udecode/plate-floating", "@udecode/plate-block-quote", "@udecode/plate-node-id", "@udecode/plate-link", "@udecode/plate-autoformat", "lodash.get", "moment", "date-fns", "dompurify", "sonner", "@tinacms/schema-tools", "graphql-tag", "yup", "react-router-dom", "@tinacms/mdx"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.tinacms = {}, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP));
9
- })(this, function(exports2, zod, React, ReactDOM, cn$2, plateHeading, isHotkey, clsx, reactSlot, plateCodeBlock, lucideReact, mermaid, classVarianceAuthority, cmdk, DialogPrimitive, PopoverPrimitive, plate, react, plateCombobox, plateResetNode, plateList, plateResizable, plateDnd, plateTable, DropdownMenuPrimitive, ToolbarPrimitive, SeparatorPrimitive, TooltipPrimitive, finalForm, arrayMutators, setFieldData, reactFinalForm, PropTypes, tailwindMerge, reactBeautifulDnd, pkg$1, pkg, graphql$1, core$1, dropzone, cmdk$1, react$1, plateTrailingBlock, plateFloating, plateBlockQuote, plateNodeId, plateLink, plateAutoformat, get$5, moment, dateFns, DOMPurify, sonner, schemaTools, gql, yup, reactRouterDom, mdx) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("zod"), require("react"), require("react-dom"), require("@udecode/cn"), require("@udecode/plate-heading"), require("is-hotkey"), require("clsx"), require("@radix-ui/react-slot"), require("@udecode/plate-code-block"), require("lucide-react"), require("mermaid"), require("class-variance-authority"), require("cmdk"), require("@radix-ui/react-dialog"), require("@radix-ui/react-popover"), require("@udecode/plate"), require("@ariakit/react"), require("@udecode/plate-combobox"), require("@udecode/plate-reset-node"), require("@udecode/plate-list"), require("@udecode/plate-resizable"), require("@udecode/plate-dnd"), require("@udecode/plate-table"), require("@radix-ui/react-dropdown-menu"), require("@radix-ui/react-toolbar"), require("@radix-ui/react-separator"), require("@radix-ui/react-tooltip"), require("final-form"), require("final-form-arrays"), require("final-form-set-field-data"), require("react-final-form"), require("prop-types"), require("tailwind-merge"), require("react-beautiful-dnd"), require("react-color"), require("color-string"), require("graphql"), require("@graphql-inspector/core"), require("react-dropzone"), require("@udecode/cmdk"), require("@headlessui/react"), require("@udecode/plate-trailing-block"), require("@udecode/plate-floating"), require("@udecode/plate-block-quote"), require("@udecode/plate-node-id"), require("@udecode/plate-link"), require("@udecode/plate-autoformat"), require("lodash.get"), require("moment"), require("date-fns"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("react-router-dom"), require("@tinacms/mdx")) : typeof define === "function" && define.amd ? define(["exports", "zod", "react", "react-dom", "@udecode/cn", "@udecode/plate-heading", "is-hotkey", "clsx", "@radix-ui/react-slot", "@udecode/plate-code-block", "lucide-react", "mermaid", "class-variance-authority", "cmdk", "@radix-ui/react-dialog", "@radix-ui/react-popover", "@udecode/plate", "@ariakit/react", "@udecode/plate-combobox", "@udecode/plate-reset-node", "@udecode/plate-list", "@udecode/plate-resizable", "@udecode/plate-dnd", "@udecode/plate-table", "@radix-ui/react-dropdown-menu", "@radix-ui/react-toolbar", "@radix-ui/react-separator", "@radix-ui/react-tooltip", "final-form", "final-form-arrays", "final-form-set-field-data", "react-final-form", "prop-types", "tailwind-merge", "react-beautiful-dnd", "react-color", "color-string", "graphql", "@graphql-inspector/core", "react-dropzone", "@udecode/cmdk", "@headlessui/react", "@udecode/plate-trailing-block", "@udecode/plate-floating", "@udecode/plate-block-quote", "@udecode/plate-node-id", "@udecode/plate-link", "@udecode/plate-autoformat", "lodash.get", "moment", "date-fns", "@tinacms/schema-tools", "graphql-tag", "yup", "react-router-dom", "@tinacms/mdx"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.tinacms = {}, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP, global2.NOOP));
9
+ })(this, function(exports2, zod, React, ReactDOM, cn$2, plateHeading, isHotkey, clsx, reactSlot, plateCodeBlock, lucideReact, mermaid, classVarianceAuthority, cmdk, DialogPrimitive, PopoverPrimitive, plate, react, plateCombobox, plateResetNode, plateList, plateResizable, plateDnd, plateTable, DropdownMenuPrimitive, ToolbarPrimitive, SeparatorPrimitive, TooltipPrimitive, finalForm, arrayMutators, setFieldData, reactFinalForm, PropTypes, tailwindMerge, reactBeautifulDnd, pkg$1, pkg, graphql$1, core$1, dropzone, cmdk$1, react$1, plateTrailingBlock, plateFloating, plateBlockQuote, plateNodeId, plateLink, plateAutoformat, get$5, moment, dateFns, schemaTools, gql, yup, reactRouterDom, mdx) {
10
10
  var _a;
11
11
  "use strict";
12
12
  function _interopNamespaceDefault(e3) {
@@ -43568,93 +43568,6 @@ Please wrap them with useCallback or configure the deps array correctly.`
43568
43568
  };
43569
43569
  }
43570
43570
  }
43571
- const isSafeHref = (href) => {
43572
- return /^https?:\/\//.test(href) && !/^javascript:/i.test(href) && !/^data:/i.test(href) && !/^vbscript:/i.test(href);
43573
- };
43574
- const parseUrlsInText$1 = (text) => {
43575
- const urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g;
43576
- const parts = text.split(urlRegex);
43577
- return parts.map((part, index) => {
43578
- if (part.match(urlRegex)) {
43579
- let href = part.startsWith("http") ? part : `https://${part}`;
43580
- href = DOMPurify.sanitize(href, {
43581
- ALLOWED_URI_REGEXP: /^https?:\/\/.*/i
43582
- });
43583
- if (isSafeHref(href)) {
43584
- const safeText2 = DOMPurify.sanitize(part, {
43585
- ALLOWED_TAGS: [],
43586
- ALLOWED_ATTR: []
43587
- });
43588
- return /* @__PURE__ */ React.createElement(
43589
- "a",
43590
- {
43591
- key: index,
43592
- href,
43593
- target: "_blank",
43594
- rel: "noopener noreferrer",
43595
- className: "underline hover:opacity-80",
43596
- onClick: (e3) => e3.stopPropagation()
43597
- },
43598
- safeText2
43599
- );
43600
- } else {
43601
- const safeText2 = DOMPurify.sanitize(part, {
43602
- ALLOWED_TAGS: [],
43603
- ALLOWED_ATTR: []
43604
- });
43605
- return /* @__PURE__ */ React.createElement("span", { key: index }, safeText2);
43606
- }
43607
- }
43608
- const safeText = DOMPurify.sanitize(part, {
43609
- ALLOWED_TAGS: [],
43610
- ALLOWED_ATTR: []
43611
- });
43612
- return safeText;
43613
- });
43614
- };
43615
- const toast = {
43616
- success: (message, options) => {
43617
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43618
- return sonner.toast.success(content, options);
43619
- },
43620
- error: (message, options) => {
43621
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43622
- return sonner.toast.error(content, options);
43623
- },
43624
- warning: (message, options) => {
43625
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43626
- return sonner.toast.warning(content, options);
43627
- },
43628
- info: (message, options) => {
43629
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43630
- return sonner.toast.info(content, options);
43631
- },
43632
- dismiss: sonner.toast.dismiss
43633
- };
43634
- const Toaster = ({ ...props }) => {
43635
- return /* @__PURE__ */ React.createElement(
43636
- sonner.Toaster,
43637
- {
43638
- className: "toaster group",
43639
- position: "top-left",
43640
- closeButton: true,
43641
- toastOptions: {
43642
- classNames: {
43643
- toast: "group toast group-[.toaster]:bg-white group-[.toaster]:shadow-lg",
43644
- description: "group-[.toast]:text-gray-700",
43645
- actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
43646
- cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
43647
- closeButton: "group-[.toast]:bg-white group-[.toast]:text-current group-[.toast]:border-0",
43648
- success: "group-[.toaster]:border-green-500 [&_[data-icon]]:text-green-500 [&_[data-content]]:text-gray-700",
43649
- error: "group-[.toaster]:border-red-500 [&_[data-icon]]:text-red-500 [&_[data-content]]:text-gray-700",
43650
- warning: "group-[.toaster]:border-yellow-500 [&_[data-icon]]:text-yellow-500 [&_[data-content]]:text-gray-700",
43651
- info: "group-[.toaster]:border-blue-500 [&_[data-icon]]:text-blue-500 [&_[data-content]]:text-gray-700"
43652
- }
43653
- },
43654
- ...props
43655
- }
43656
- );
43657
- };
43658
43571
  let Alerts$1 = class Alerts {
43659
43572
  constructor(events2, map2 = {}) {
43660
43573
  this.events = events2;
@@ -43682,43 +43595,20 @@ Please wrap them with useCallback or configure the deps array correctly.`
43682
43595
  };
43683
43596
  }
43684
43597
  add(level, message, timeout = 8e3) {
43685
- let id2;
43686
- const toastMessage = typeof message === "string" ? message : React.createElement(message);
43687
- switch (level) {
43688
- case "success":
43689
- id2 = toast.success(toastMessage, {
43690
- duration: timeout
43691
- });
43692
- break;
43693
- case "error":
43694
- id2 = `${message}|${Date.now()}`;
43695
- break;
43696
- case "warn":
43697
- id2 = toast.warning(toastMessage, {
43698
- duration: timeout
43699
- });
43700
- break;
43701
- case "info":
43702
- default:
43703
- id2 = toast.info(toastMessage, {
43704
- duration: timeout
43705
- });
43706
- break;
43707
- }
43708
43598
  const alert = {
43709
43599
  level,
43710
43600
  message,
43711
43601
  timeout,
43712
- id: String(id2)
43602
+ id: `${message}|${Date.now()}`
43713
43603
  };
43714
43604
  this.alerts.set(alert.id, alert);
43715
43605
  this.events.dispatch({ type: "alerts:add", alert });
43606
+ let timeoutId = null;
43716
43607
  const dismiss = () => {
43717
- if (level !== "error") {
43718
- toast.dismiss(id2);
43719
- }
43608
+ clearTimeout(timeoutId);
43720
43609
  this.dismiss(alert);
43721
43610
  };
43611
+ timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
43722
43612
  return dismiss;
43723
43613
  }
43724
43614
  dismiss(alert) {
@@ -46435,7 +46325,7 @@ Please wrap them with useCallback or configure the deps array correctly.`
46435
46325
  requiredArgs(1, arguments);
46436
46326
  return formatDistance(dirtyDate, Date.now(), options);
46437
46327
  }
46438
- const version$1 = "2.9.4";
46328
+ const version$1 = "2.9.5";
46439
46329
  const VersionInfo = () => {
46440
46330
  var _a2, _b, _c, _d, _e, _f;
46441
46331
  const cms = useCMS();
@@ -48072,10 +47962,21 @@ Please wrap them with useCallback or configure the deps array correctly.`
48072
47962
  };
48073
47963
  function Alerts({ alerts }) {
48074
47964
  useSubscribable(alerts);
48075
- if (alerts.all.length === 0) {
47965
+ if (!alerts.all.length) {
48076
47966
  return null;
48077
47967
  }
48078
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Toaster, null), alerts.all.filter((alert) => {
47968
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "fixed top-0 left-0 p-6 flex flex-col items-center z-[999999]" }, alerts.all.filter((alert) => {
47969
+ return alert.level !== "error";
47970
+ }).map((alert) => {
47971
+ return /* @__PURE__ */ React.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React.createElement(MdInfo, { className: "w-5 h-auto opacity-70" }), alert.level === "success" && /* @__PURE__ */ React.createElement(MdCheckCircle, { className: "w-5 h-auto opacity-70" }), alert.level === "warn" && /* @__PURE__ */ React.createElement(MdWarning, { className: "w-5 h-auto opacity-70" }), /* @__PURE__ */ React.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React.createElement(
47972
+ CloseAlert,
47973
+ {
47974
+ onClick: () => {
47975
+ alerts.dismiss(alert);
47976
+ }
47977
+ }
47978
+ ));
47979
+ })), alerts.all.filter((alert) => {
48079
47980
  return alert.level === "error";
48080
47981
  }).map((alert) => {
48081
47982
  const AlertMessage = typeof alert.message === "string" ? () => {
@@ -48103,6 +48004,51 @@ Please wrap them with useCallback or configure the deps array correctly.`
48103
48004
  ))));
48104
48005
  }));
48105
48006
  }
48007
+ const Alert = ({
48008
+ level,
48009
+ ...props
48010
+ }) => {
48011
+ const colorClasses = {
48012
+ info: "bg-white border-blue-500 text-blue-600 fill-blue-500",
48013
+ success: "bg-white border-green-500 text-green-600 fill-green-500",
48014
+ warn: "bg-white border-yellow-500 text-yellow-600 fill-yellow-500",
48015
+ error: "bg-white border-red-500 text-red-600 fill-red-500"
48016
+ };
48017
+ const borderClasses = {
48018
+ info: "border-blue-200",
48019
+ success: "border-green-200",
48020
+ warn: "border-yellow-200",
48021
+ error: "border-red-200"
48022
+ };
48023
+ return /* @__PURE__ */ React.createElement(
48024
+ "div",
48025
+ {
48026
+ className: `rounded shadow-lg font-normal cursor-pointer pointer-events-all text-sm transition-all duration-100 ease-out mb-4 max-w-full ${colorClasses[level]}}`,
48027
+ style: {
48028
+ animationName: "fly-in-up, fade-in",
48029
+ animationTimingFunction: "ease-out",
48030
+ animationIterationCount: 1,
48031
+ animationFillMode: "both",
48032
+ animationDuration: "150ms"
48033
+ }
48034
+ },
48035
+ /* @__PURE__ */ React.createElement(
48036
+ "div",
48037
+ {
48038
+ className: `flex items-center gap-1.5 w-[350px] rounded-md border p-2 ${borderClasses[level]}`,
48039
+ ...props
48040
+ }
48041
+ )
48042
+ );
48043
+ };
48044
+ const CloseAlert = ({ ...styleProps }) => /* @__PURE__ */ React.createElement(
48045
+ "button",
48046
+ {
48047
+ className: "border-none bg-transparent p-0 outline-none flex items-center",
48048
+ ...styleProps
48049
+ },
48050
+ /* @__PURE__ */ React.createElement(BiX, { className: "w-5 auto flex-grow-0 flex-shrink-0 text-gray-700" })
48051
+ );
48106
48052
  function CursorPaginator({
48107
48053
  navigateNext,
48108
48054
  navigatePrev,
package/dist/index.mjs CHANGED
@@ -57,8 +57,6 @@ import { autoformatSmartQuotes, autoformatPunctuation, autoformatLegal, autoform
57
57
  import get$5 from "lodash.get";
58
58
  import moment from "moment";
59
59
  import { formatDistanceToNow as formatDistanceToNow$1 } from "date-fns";
60
- import DOMPurify from "dompurify";
61
- import { toast as toast$1, Toaster as Toaster$1 } from "sonner";
62
60
  import { TinaSchema, addNamespaceToSchema, parseURL, resolveForm, normalizePath, canonicalPath, validateSchema } from "@tinacms/schema-tools";
63
61
  import { NAMER, resolveField } from "@tinacms/schema-tools";
64
62
  import gql from "graphql-tag";
@@ -43597,93 +43595,6 @@ class GlobalFormPlugin {
43597
43595
  };
43598
43596
  }
43599
43597
  }
43600
- const isSafeHref = (href) => {
43601
- return /^https?:\/\//.test(href) && !/^javascript:/i.test(href) && !/^data:/i.test(href) && !/^vbscript:/i.test(href);
43602
- };
43603
- const parseUrlsInText$1 = (text) => {
43604
- const urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g;
43605
- const parts = text.split(urlRegex);
43606
- return parts.map((part, index) => {
43607
- if (part.match(urlRegex)) {
43608
- let href = part.startsWith("http") ? part : `https://${part}`;
43609
- href = DOMPurify.sanitize(href, {
43610
- ALLOWED_URI_REGEXP: /^https?:\/\/.*/i
43611
- });
43612
- if (isSafeHref(href)) {
43613
- const safeText2 = DOMPurify.sanitize(part, {
43614
- ALLOWED_TAGS: [],
43615
- ALLOWED_ATTR: []
43616
- });
43617
- return /* @__PURE__ */ React__default.createElement(
43618
- "a",
43619
- {
43620
- key: index,
43621
- href,
43622
- target: "_blank",
43623
- rel: "noopener noreferrer",
43624
- className: "underline hover:opacity-80",
43625
- onClick: (e3) => e3.stopPropagation()
43626
- },
43627
- safeText2
43628
- );
43629
- } else {
43630
- const safeText2 = DOMPurify.sanitize(part, {
43631
- ALLOWED_TAGS: [],
43632
- ALLOWED_ATTR: []
43633
- });
43634
- return /* @__PURE__ */ React__default.createElement("span", { key: index }, safeText2);
43635
- }
43636
- }
43637
- const safeText = DOMPurify.sanitize(part, {
43638
- ALLOWED_TAGS: [],
43639
- ALLOWED_ATTR: []
43640
- });
43641
- return safeText;
43642
- });
43643
- };
43644
- const toast = {
43645
- success: (message, options) => {
43646
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43647
- return toast$1.success(content, options);
43648
- },
43649
- error: (message, options) => {
43650
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43651
- return toast$1.error(content, options);
43652
- },
43653
- warning: (message, options) => {
43654
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43655
- return toast$1.warning(content, options);
43656
- },
43657
- info: (message, options) => {
43658
- const content = typeof message === "string" ? parseUrlsInText$1(message) : message;
43659
- return toast$1.info(content, options);
43660
- },
43661
- dismiss: toast$1.dismiss
43662
- };
43663
- const Toaster = ({ ...props }) => {
43664
- return /* @__PURE__ */ React__default.createElement(
43665
- Toaster$1,
43666
- {
43667
- className: "toaster group",
43668
- position: "top-left",
43669
- closeButton: true,
43670
- toastOptions: {
43671
- classNames: {
43672
- toast: "group toast group-[.toaster]:bg-white group-[.toaster]:shadow-lg",
43673
- description: "group-[.toast]:text-gray-700",
43674
- actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
43675
- cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",
43676
- closeButton: "group-[.toast]:bg-white group-[.toast]:text-current group-[.toast]:border-0",
43677
- success: "group-[.toaster]:border-green-500 [&_[data-icon]]:text-green-500 [&_[data-content]]:text-gray-700",
43678
- error: "group-[.toaster]:border-red-500 [&_[data-icon]]:text-red-500 [&_[data-content]]:text-gray-700",
43679
- warning: "group-[.toaster]:border-yellow-500 [&_[data-icon]]:text-yellow-500 [&_[data-content]]:text-gray-700",
43680
- info: "group-[.toaster]:border-blue-500 [&_[data-icon]]:text-blue-500 [&_[data-content]]:text-gray-700"
43681
- }
43682
- },
43683
- ...props
43684
- }
43685
- );
43686
- };
43687
43598
  let Alerts$1 = class Alerts {
43688
43599
  constructor(events2, map2 = {}) {
43689
43600
  this.events = events2;
@@ -43711,43 +43622,20 @@ let Alerts$1 = class Alerts {
43711
43622
  };
43712
43623
  }
43713
43624
  add(level, message, timeout = 8e3) {
43714
- let id2;
43715
- const toastMessage = typeof message === "string" ? message : React__default.createElement(message);
43716
- switch (level) {
43717
- case "success":
43718
- id2 = toast.success(toastMessage, {
43719
- duration: timeout
43720
- });
43721
- break;
43722
- case "error":
43723
- id2 = `${message}|${Date.now()}`;
43724
- break;
43725
- case "warn":
43726
- id2 = toast.warning(toastMessage, {
43727
- duration: timeout
43728
- });
43729
- break;
43730
- case "info":
43731
- default:
43732
- id2 = toast.info(toastMessage, {
43733
- duration: timeout
43734
- });
43735
- break;
43736
- }
43737
43625
  const alert = {
43738
43626
  level,
43739
43627
  message,
43740
43628
  timeout,
43741
- id: String(id2)
43629
+ id: `${message}|${Date.now()}`
43742
43630
  };
43743
43631
  this.alerts.set(alert.id, alert);
43744
43632
  this.events.dispatch({ type: "alerts:add", alert });
43633
+ let timeoutId = null;
43745
43634
  const dismiss = () => {
43746
- if (level !== "error") {
43747
- toast.dismiss(id2);
43748
- }
43635
+ clearTimeout(timeoutId);
43749
43636
  this.dismiss(alert);
43750
43637
  };
43638
+ timeoutId = level !== "error" ? setTimeout(dismiss, alert.timeout) : null;
43751
43639
  return dismiss;
43752
43640
  }
43753
43641
  dismiss(alert) {
@@ -46464,7 +46352,7 @@ function formatDistanceToNow(dirtyDate, options) {
46464
46352
  requiredArgs(1, arguments);
46465
46353
  return formatDistance2(dirtyDate, Date.now(), options);
46466
46354
  }
46467
- const version$1 = "2.9.4";
46355
+ const version$1 = "2.9.5";
46468
46356
  const VersionInfo = () => {
46469
46357
  var _a2, _b, _c, _d, _e, _f;
46470
46358
  const cms = useCMS();
@@ -48101,10 +47989,21 @@ const parseUrlsInText = (text) => {
48101
47989
  };
48102
47990
  function Alerts2({ alerts }) {
48103
47991
  useSubscribable(alerts);
48104
- if (alerts.all.length === 0) {
47992
+ if (!alerts.all.length) {
48105
47993
  return null;
48106
47994
  }
48107
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Toaster, null), alerts.all.filter((alert) => {
47995
+ return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement("div", { className: "fixed top-0 left-0 p-6 flex flex-col items-center z-[999999]" }, alerts.all.filter((alert) => {
47996
+ return alert.level !== "error";
47997
+ }).map((alert) => {
47998
+ return /* @__PURE__ */ React__default.createElement(Alert, { key: alert.id, level: alert.level }, alert.level === "info" && /* @__PURE__ */ React__default.createElement(MdInfo, { className: "w-5 h-auto opacity-70" }), alert.level === "success" && /* @__PURE__ */ React__default.createElement(MdCheckCircle, { className: "w-5 h-auto opacity-70" }), alert.level === "warn" && /* @__PURE__ */ React__default.createElement(MdWarning, { className: "w-5 h-auto opacity-70" }), /* @__PURE__ */ React__default.createElement("p", { className: "m-0 flex-1 max-w-[680px] text-left" }, parseUrlsInText(alert.message.toString())), /* @__PURE__ */ React__default.createElement(
47999
+ CloseAlert,
48000
+ {
48001
+ onClick: () => {
48002
+ alerts.dismiss(alert);
48003
+ }
48004
+ }
48005
+ ));
48006
+ })), alerts.all.filter((alert) => {
48108
48007
  return alert.level === "error";
48109
48008
  }).map((alert) => {
48110
48009
  const AlertMessage = typeof alert.message === "string" ? () => {
@@ -48132,6 +48031,51 @@ function Alerts2({ alerts }) {
48132
48031
  ))));
48133
48032
  }));
48134
48033
  }
48034
+ const Alert = ({
48035
+ level,
48036
+ ...props
48037
+ }) => {
48038
+ const colorClasses = {
48039
+ info: "bg-white border-blue-500 text-blue-600 fill-blue-500",
48040
+ success: "bg-white border-green-500 text-green-600 fill-green-500",
48041
+ warn: "bg-white border-yellow-500 text-yellow-600 fill-yellow-500",
48042
+ error: "bg-white border-red-500 text-red-600 fill-red-500"
48043
+ };
48044
+ const borderClasses = {
48045
+ info: "border-blue-200",
48046
+ success: "border-green-200",
48047
+ warn: "border-yellow-200",
48048
+ error: "border-red-200"
48049
+ };
48050
+ return /* @__PURE__ */ React__default.createElement(
48051
+ "div",
48052
+ {
48053
+ className: `rounded shadow-lg font-normal cursor-pointer pointer-events-all text-sm transition-all duration-100 ease-out mb-4 max-w-full ${colorClasses[level]}}`,
48054
+ style: {
48055
+ animationName: "fly-in-up, fade-in",
48056
+ animationTimingFunction: "ease-out",
48057
+ animationIterationCount: 1,
48058
+ animationFillMode: "both",
48059
+ animationDuration: "150ms"
48060
+ }
48061
+ },
48062
+ /* @__PURE__ */ React__default.createElement(
48063
+ "div",
48064
+ {
48065
+ className: `flex items-center gap-1.5 w-[350px] rounded-md border p-2 ${borderClasses[level]}`,
48066
+ ...props
48067
+ }
48068
+ )
48069
+ );
48070
+ };
48071
+ const CloseAlert = ({ ...styleProps }) => /* @__PURE__ */ React__default.createElement(
48072
+ "button",
48073
+ {
48074
+ className: "border-none bg-transparent p-0 outline-none flex items-center",
48075
+ ...styleProps
48076
+ },
48077
+ /* @__PURE__ */ React__default.createElement(BiX, { className: "w-5 auto flex-grow-0 flex-shrink-0 text-gray-700" })
48078
+ );
48135
48079
  function CursorPaginator({
48136
48080
  navigateNext,
48137
48081
  navigatePrev,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "2.9.4",
3
+ "version": "2.9.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -137,15 +137,13 @@
137
137
  "react-icons": "^5.4.0",
138
138
  "react-router-dom": "6.3.0",
139
139
  "react-use": "^17.6.0",
140
- "sonner": "^2.0.7",
141
140
  "tailwind-merge": "^2.6.0",
142
141
  "webfontloader": "1.6.28",
143
142
  "yup": "^1.6.1",
144
143
  "zod": "^3.24.2",
145
- "dompurify": "^3.3.0",
146
- "@tinacms/schema-tools": "1.9.1",
144
+ "@tinacms/mdx": "1.8.1",
147
145
  "@tinacms/search": "1.1.1",
148
- "@tinacms/mdx": "1.8.1"
146
+ "@tinacms/schema-tools": "1.9.1"
149
147
  },
150
148
  "devDependencies": {
151
149
  "@graphql-tools/utils": "^10.8.1",
@@ -165,11 +163,11 @@
165
163
  "@types/react-color": "^3.0.13",
166
164
  "@types/react-dom": "^18.3.5",
167
165
  "@types/yup": "^0.32.0",
166
+ "lowlight": "^3.3.0",
168
167
  "happy-dom": "15.10.2",
169
168
  "identity-obj-proxy": "^3.0.0",
170
169
  "isomorphic-fetch": "^3.0.0",
171
170
  "jest-file-snapshot": "^0.7.0",
172
- "lowlight": "^3.3.0",
173
171
  "next": "14.2.10",
174
172
  "react": "^18.3.1",
175
173
  "react-dom": "^18.3.1",
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import { Toaster as Sonner } from 'sonner';
3
- type ToasterProps = React.ComponentProps<typeof Sonner>;
4
- declare const toast: {
5
- success: (message: string | React.ReactNode, options?: any) => string | number;
6
- error: (message: string | React.ReactNode, options?: any) => string | number;
7
- warning: (message: string | React.ReactNode, options?: any) => string | number;
8
- info: (message: string | React.ReactNode, options?: any) => string | number;
9
- dismiss: (id?: number | string) => string | number;
10
- };
11
- declare const Toaster: ({ ...props }: ToasterProps) => React.JSX.Element;
12
- export { toast, Toaster };