tinacms 0.0.0-d524599-20241117111320 → 0.0.0-d7c745e-20250102002342

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/client.js CHANGED
@@ -1,10 +1,7 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("fetch-ponyfill")) : typeof define === "function" && define.amd ? define(["exports", "fetch-ponyfill"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP));
3
- })(this, function(exports2, fetchPonyfill) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}));
3
+ })(this, function(exports2) {
4
4
  "use strict";
5
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
6
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
7
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
8
5
  const TINA_HOST = "content.tinajs.io";
9
6
  class TinaClient {
10
7
  constructor({
@@ -39,7 +36,7 @@
39
36
  var _a;
40
37
  await this.init();
41
38
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
42
- const headers = new HeadersDefined();
39
+ const headers = new Headers();
43
40
  if (this.readonlyToken) {
44
41
  headers.append("X-API-KEY", this.readonlyToken);
45
42
  }
@@ -72,7 +69,7 @@
72
69
  return value;
73
70
  }
74
71
  }
75
- const res = await fetchDefined(url, optionsObject);
72
+ const res = await fetch(url, optionsObject);
76
73
  if (!res.ok) {
77
74
  let additionalInfo = "";
78
75
  if (res.status === 401) {
package/dist/client.mjs CHANGED
@@ -1,7 +1,3 @@
1
- import fetchPonyfill from "fetch-ponyfill";
2
- const { fetch: fetchPonyfillFN, Headers: HeadersPonyfill } = fetchPonyfill();
3
- const fetchDefined = typeof fetch === "undefined" ? fetchPonyfillFN : fetch;
4
- const HeadersDefined = typeof Headers === "undefined" ? HeadersPonyfill : Headers;
5
1
  const TINA_HOST = "content.tinajs.io";
6
2
  class TinaClient {
7
3
  constructor({
@@ -36,7 +32,7 @@ class TinaClient {
36
32
  var _a;
37
33
  await this.init();
38
34
  const errorPolicyDefined = errorPolicy || this.errorPolicy;
39
- const headers = new HeadersDefined();
35
+ const headers = new Headers();
40
36
  if (this.readonlyToken) {
41
37
  headers.append("X-API-KEY", this.readonlyToken);
42
38
  }
@@ -69,7 +65,7 @@ class TinaClient {
69
65
  return value;
70
66
  }
71
67
  }
72
- const res = await fetchDefined(url, optionsObject);
68
+ const res = await fetch(url, optionsObject);
73
69
  if (!res.ok) {
74
70
  let additionalInfo = "";
75
71
  if (res.status === 401) {
package/dist/index.d.ts CHANGED
@@ -53,7 +53,7 @@ export type TinaCollection = Collection;
53
53
  export type TinaCloudSchema = Schema;
54
54
  export declare const defineSchema: (config: Schema) => Schema<false>;
55
55
  export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, "children">) => Omit<TinaCMSProviderDefaultProps, "children">;
56
- interface MediaStoreClass {
56
+ export interface MediaStoreClass {
57
57
  new (...args: any[]): MediaStore;
58
58
  }
59
59
  export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, DocumentCreatorCallback, MediaStoreClass>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, MediaStoreClass, undefined>;
package/dist/index.js CHANGED
@@ -862,13 +862,23 @@ var __publicField = (obj, key, value) => {
862
862
  className,
863
863
  ...props
864
864
  }) => {
865
+ if (typeof children === "string") {
866
+ return /* @__PURE__ */ React__namespace.createElement(
867
+ "span",
868
+ {
869
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
870
+ ...props,
871
+ dangerouslySetInnerHTML: { __html: children }
872
+ }
873
+ );
874
+ }
865
875
  return /* @__PURE__ */ React__namespace.createElement(
866
876
  "span",
867
877
  {
868
878
  className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
869
- ...props,
870
- dangerouslySetInnerHTML: { __html: children }
871
- }
879
+ ...props
880
+ },
881
+ children
872
882
  );
873
883
  };
874
884
  const FieldError = ({
@@ -3820,7 +3830,7 @@ flowchart TD
3820
3830
  function _objectWithoutProperties(source, excluded) {
3821
3831
  if (source == null)
3822
3832
  return {};
3823
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3833
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3824
3834
  var key, i;
3825
3835
  if (Object.getOwnPropertySymbols) {
3826
3836
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3835,7 +3845,7 @@ flowchart TD
3835
3845
  }
3836
3846
  return target;
3837
3847
  }
3838
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3848
+ function _objectWithoutPropertiesLoose(source, excluded) {
3839
3849
  if (source == null)
3840
3850
  return {};
3841
3851
  var target = {};
@@ -4925,7 +4935,28 @@ flowchart TD
4925
4935
  onChange,
4926
4936
  value,
4927
4937
  step
4928
- }) => /* @__PURE__ */ React__namespace.createElement(Input, { type: "number", step, value, onChange });
4938
+ }) => /* @__PURE__ */ React__namespace.createElement(
4939
+ Input,
4940
+ {
4941
+ type: "number",
4942
+ step,
4943
+ value,
4944
+ onChange: (event) => {
4945
+ const inputValue = event.target.value;
4946
+ const newValue = inputValue === "" ? void 0 : inputValue;
4947
+ if (onChange) {
4948
+ const syntheticEvent = {
4949
+ ...event,
4950
+ target: {
4951
+ ...event.target,
4952
+ value: newValue
4953
+ }
4954
+ };
4955
+ onChange(syntheticEvent);
4956
+ }
4957
+ }
4958
+ }
4959
+ );
4929
4960
  function useCMS() {
4930
4961
  return useCMS$1();
4931
4962
  }
@@ -7178,244 +7209,65 @@ flowchart TD
7178
7209
  str = "0" + str;
7179
7210
  return str;
7180
7211
  }
7181
- function _inheritsLoose(subClass, superClass) {
7182
- subClass.prototype = Object.create(superClass.prototype);
7183
- subClass.prototype.constructor = subClass;
7184
- _setPrototypeOf(subClass, superClass);
7185
- }
7186
- function _setPrototypeOf(o, p) {
7187
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7188
- o2.__proto__ = p2;
7189
- return o2;
7190
- };
7191
- return _setPrototypeOf(o, p);
7192
- }
7193
- function _objectWithoutPropertiesLoose(source, excluded) {
7194
- if (source == null)
7195
- return {};
7196
- var target = {};
7197
- var sourceKeys = Object.keys(source);
7198
- var key, i;
7199
- for (i = 0; i < sourceKeys.length; i++) {
7200
- key = sourceKeys[i];
7201
- if (excluded.indexOf(key) >= 0)
7202
- continue;
7203
- target[key] = source[key];
7204
- }
7205
- return target;
7206
- }
7207
- function _assertThisInitialized(self2) {
7208
- if (self2 === void 0) {
7209
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7210
- }
7211
- return self2;
7212
- }
7213
- function isNodeFound(current, componentNode, ignoreClass) {
7214
- if (current === componentNode) {
7215
- return true;
7216
- }
7217
- if (current.correspondingElement) {
7218
- return current.correspondingElement.classList.contains(ignoreClass);
7219
- }
7220
- return current.classList.contains(ignoreClass);
7221
- }
7222
- function findHighest(current, componentNode, ignoreClass) {
7223
- if (current === componentNode) {
7224
- return true;
7212
+ var useClickAway$1 = {};
7213
+ var util = {};
7214
+ Object.defineProperty(util, "__esModule", { value: true });
7215
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7216
+ var noop = function() {
7217
+ };
7218
+ util.noop = noop;
7219
+ function on(obj) {
7220
+ var args = [];
7221
+ for (var _i = 1; _i < arguments.length; _i++) {
7222
+ args[_i - 1] = arguments[_i];
7225
7223
  }
7226
- while (current.parentNode || current.host) {
7227
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7228
- return true;
7229
- }
7230
- current = current.parentNode || current.host;
7224
+ if (obj && obj.addEventListener) {
7225
+ obj.addEventListener.apply(obj, args);
7231
7226
  }
7232
- return current;
7233
7227
  }
7234
- function clickedScrollbar(evt) {
7235
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7236
- }
7237
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7238
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7239
- return;
7228
+ util.on = on;
7229
+ function off(obj) {
7230
+ var args = [];
7231
+ for (var _i = 1; _i < arguments.length; _i++) {
7232
+ args[_i - 1] = arguments[_i];
7240
7233
  }
7241
- var passive = false;
7242
- var options = Object.defineProperty({}, "passive", {
7243
- get: function get2() {
7244
- passive = true;
7245
- }
7246
- });
7247
- var noop = function noop2() {
7248
- };
7249
- window.addEventListener("testPassiveEventSupport", noop, options);
7250
- window.removeEventListener("testPassiveEventSupport", noop, options);
7251
- return passive;
7252
- };
7253
- function autoInc(seed) {
7254
- if (seed === void 0) {
7255
- seed = 0;
7234
+ if (obj && obj.removeEventListener) {
7235
+ obj.removeEventListener.apply(obj, args);
7256
7236
  }
7257
- return function() {
7258
- return ++seed;
7259
- };
7260
- }
7261
- var uid = autoInc();
7262
- var passiveEventSupport;
7263
- var handlersMap = {};
7264
- var enabledInstances = {};
7265
- var touchEvents = ["touchstart", "touchmove"];
7266
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7267
- function getEventHandlerOptions(instance, eventName) {
7268
- var handlerOptions = {};
7269
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7270
- if (isTouchEvent && passiveEventSupport) {
7271
- handlerOptions.passive = !instance.props.preventDefault;
7272
- }
7273
- return handlerOptions;
7274
7237
  }
7275
- function onClickOutsideHOC(WrappedComponent, config) {
7276
- var _class, _temp;
7277
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7278
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7279
- _inheritsLoose(onClickOutside, _Component);
7280
- function onClickOutside(props) {
7281
- var _this;
7282
- _this = _Component.call(this, props) || this;
7283
- _this.__outsideClickHandler = function(event) {
7284
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7285
- _this.__clickOutsideHandlerProp(event);
7286
- return;
7287
- }
7288
- var instance = _this.getInstance();
7289
- if (typeof instance.props.handleClickOutside === "function") {
7290
- instance.props.handleClickOutside(event);
7291
- return;
7292
- }
7293
- if (typeof instance.handleClickOutside === "function") {
7294
- instance.handleClickOutside(event);
7295
- return;
7296
- }
7297
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7298
- };
7299
- _this.__getComponentNode = function() {
7300
- var instance = _this.getInstance();
7301
- if (config && typeof config.setClickOutsideRef === "function") {
7302
- return config.setClickOutsideRef()(instance);
7303
- }
7304
- if (typeof instance.setClickOutsideRef === "function") {
7305
- return instance.setClickOutsideRef();
7306
- }
7307
- return reactDom.findDOMNode(instance);
7308
- };
7309
- _this.enableOnClickOutside = function() {
7310
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7311
- return;
7312
- }
7313
- if (typeof passiveEventSupport === "undefined") {
7314
- passiveEventSupport = testPassiveEventSupport();
7315
- }
7316
- enabledInstances[_this._uid] = true;
7317
- var events = _this.props.eventTypes;
7318
- if (!events.forEach) {
7319
- events = [events];
7320
- }
7321
- handlersMap[_this._uid] = function(event) {
7322
- if (_this.componentNode === null)
7323
- return;
7324
- if (_this.initTimeStamp > event.timeStamp)
7325
- return;
7326
- if (_this.props.preventDefault) {
7327
- event.preventDefault();
7328
- }
7329
- if (_this.props.stopPropagation) {
7330
- event.stopPropagation();
7331
- }
7332
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7333
- return;
7334
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7335
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7336
- return;
7337
- }
7338
- _this.__outsideClickHandler(event);
7339
- };
7340
- events.forEach(function(eventName) {
7341
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7342
- });
7343
- };
7344
- _this.disableOnClickOutside = function() {
7345
- delete enabledInstances[_this._uid];
7346
- var fn = handlersMap[_this._uid];
7347
- if (fn && typeof document !== "undefined") {
7348
- var events = _this.props.eventTypes;
7349
- if (!events.forEach) {
7350
- events = [events];
7351
- }
7352
- events.forEach(function(eventName) {
7353
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7354
- });
7355
- delete handlersMap[_this._uid];
7356
- }
7357
- };
7358
- _this.getRef = function(ref) {
7359
- return _this.instanceRef = ref;
7360
- };
7361
- _this._uid = uid();
7362
- _this.initTimeStamp = performance.now();
7363
- return _this;
7364
- }
7365
- var _proto = onClickOutside.prototype;
7366
- _proto.getInstance = function getInstance() {
7367
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7368
- return this;
7369
- }
7370
- var ref = this.instanceRef;
7371
- return ref.getInstance ? ref.getInstance() : ref;
7372
- };
7373
- _proto.componentDidMount = function componentDidMount() {
7374
- if (typeof document === "undefined" || !document.createElement) {
7375
- return;
7376
- }
7377
- var instance = this.getInstance();
7378
- if (config && typeof config.handleClickOutside === "function") {
7379
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7380
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7381
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7382
- }
7383
- }
7384
- this.componentNode = this.__getComponentNode();
7385
- if (this.props.disableOnClickOutside)
7386
- return;
7387
- this.enableOnClickOutside();
7388
- };
7389
- _proto.componentDidUpdate = function componentDidUpdate() {
7390
- this.componentNode = this.__getComponentNode();
7391
- };
7392
- _proto.componentWillUnmount = function componentWillUnmount() {
7393
- this.disableOnClickOutside();
7238
+ util.off = off;
7239
+ util.isBrowser = typeof window !== "undefined";
7240
+ util.isNavigator = typeof navigator !== "undefined";
7241
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7242
+ var react_1 = React;
7243
+ var util_1 = util;
7244
+ var defaultEvents = ["mousedown", "touchstart"];
7245
+ var useClickAway = function(ref, onClickAway, events) {
7246
+ if (events === void 0) {
7247
+ events = defaultEvents;
7248
+ }
7249
+ var savedCallback = react_1.useRef(onClickAway);
7250
+ react_1.useEffect(function() {
7251
+ savedCallback.current = onClickAway;
7252
+ }, [onClickAway]);
7253
+ react_1.useEffect(function() {
7254
+ var handler = function(event) {
7255
+ var el = ref.current;
7256
+ el && !el.contains(event.target) && savedCallback.current(event);
7394
7257
  };
7395
- _proto.render = function render() {
7396
- var _this$props = this.props;
7397
- _this$props.excludeScrollbar;
7398
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7399
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7400
- props.ref = this.getRef;
7401
- } else {
7402
- props.wrappedRef = this.getRef;
7258
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7259
+ var eventName = events_1[_i];
7260
+ util_1.on(document, eventName, handler);
7261
+ }
7262
+ return function() {
7263
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7264
+ var eventName2 = events_2[_i2];
7265
+ util_1.off(document, eventName2, handler);
7403
7266
  }
7404
- props.disableOnClickOutside = this.disableOnClickOutside;
7405
- props.enableOnClickOutside = this.enableOnClickOutside;
7406
- return React.createElement(WrappedComponent, props);
7407
7267
  };
7408
- return onClickOutside;
7409
- }(React.Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7410
- eventTypes: ["mousedown", "touchstart"],
7411
- excludeScrollbar: config && config.excludeScrollbar || false,
7412
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7413
- preventDefault: false,
7414
- stopPropagation: false
7415
- }, _class.getClass = function() {
7416
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7417
- }, _temp;
7418
- }
7268
+ }, [events, ref]);
7269
+ };
7270
+ var _default = useClickAway$1.default = useClickAway;
7419
7271
  const viewModes = {
7420
7272
  YEARS: "years",
7421
7273
  MONTHS: "months",
@@ -7944,22 +7796,13 @@ flowchart TD
7944
7796
  }
7945
7797
  con[method]("***react-datetime:" + message);
7946
7798
  }
7947
- class ClickOutBase extends React.Component {
7948
- constructor() {
7949
- super(...arguments);
7950
- __publicField(this, "container", React.createRef());
7951
- }
7952
- render() {
7953
- return /* @__PURE__ */ React.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7954
- }
7955
- handleClickOutside(e) {
7956
- this.props.onClickOut(e);
7957
- }
7958
- setClickOutsideRef() {
7959
- return this.container.current;
7960
- }
7799
+ function ClickableWrapper({ className, onClickOut, children }) {
7800
+ const containerRef = React.useRef(null);
7801
+ _default(containerRef, (event) => {
7802
+ onClickOut(event);
7803
+ });
7804
+ return /* @__PURE__ */ React.createElement("div", { className, ref: containerRef }, children);
7961
7805
  }
7962
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7963
7806
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7964
7807
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7965
7808
  const format$1 = (val, _name, field) => {
@@ -8002,7 +7845,10 @@ flowchart TD
8002
7845
  ReactDateTimeWithStyles,
8003
7846
  {
8004
7847
  value: input.value,
8005
- onChange: input.onChange,
7848
+ onChange: (value) => {
7849
+ const newValue = value === "" ? void 0 : value;
7850
+ input.onChange(newValue);
7851
+ },
8006
7852
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
8007
7853
  timeFormat: timeFormat || false,
8008
7854
  inputProps: { className: textFieldClasses },
@@ -10333,7 +10179,7 @@ flowchart TD
10333
10179
  "Event Log"
10334
10180
  ));
10335
10181
  };
10336
- const version = "2.4.0";
10182
+ const version = "2.5.2";
10337
10183
  const Nav = ({
10338
10184
  isLocalMode,
10339
10185
  className = "",
package/dist/index.mjs CHANGED
@@ -6,8 +6,8 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { z } from "zod";
8
8
  import * as React from "react";
9
- import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition, createElement, Component } from "react";
10
- import { createPortal, findDOMNode } from "react-dom";
9
+ import React__default, { useState, useCallback, useEffect, useRef, createContext, forwardRef, useContext, useMemo, startTransition } from "react";
10
+ import { createPortal } from "react-dom";
11
11
  import { withRef, cn as cn$1, withVariants, withProps, withCn, createPrimitiveElement } from "@udecode/cn";
12
12
  import { toggleList, ELEMENT_UL, ELEMENT_OL, ELEMENT_H1 as ELEMENT_H1$1, ELEMENT_H2 as ELEMENT_H2$1, ELEMENT_H3 as ELEMENT_H3$1, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_PARAGRAPH, ELEMENT_BLOCKQUOTE, ELEMENT_CODE_BLOCK, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_LI, ELEMENT_LINK, MARK_CODE, MARK_UNDERLINE, MARK_STRIKETHROUGH, MARK_ITALIC, MARK_BOLD, ELEMENT_HR, ELEMENT_TABLE, ELEMENT_TR, ELEMENT_TD, ELEMENT_TH, unwrapList, ELEMENT_TODO_LI, createTrailingBlockPlugin, createAutoformatPlugin, createExitBreakPlugin, KEYS_HEADING, createResetNodePlugin, createHeadingPlugin, createParagraphPlugin, createBlockquotePlugin, createBoldPlugin, createItalicPlugin, createUnderlinePlugin, createCodePlugin, createListPlugin, createIndentListPlugin, createHorizontalRulePlugin, createNodeIdPlugin, createTablePlugin, getListItemEntry, useListToolbarButtonState, useListToolbarButton } from "@udecode/plate";
13
13
  import { PlateElement, isCollapsed, findNodePath, getPointAfter, insertNodes, ELEMENT_DEFAULT, focusEditor, getPointBefore, setNodes, isElement, PlateLeaf, createPluginFactory, useComposedRef, useEditorRef, createPointRef, insertText, moveSelection, toggleNodeType, useElement, useRemoveNodeButton, useEditorSelector, isSelectionExpanded, withHOC, normalizeEditor, getBlockAbove, queryNode, getParentNode, isType, someNode, isSelectionAtBlockStart, setElements, insertNode, getPluginType, isBlock, isBlockAboveEmpty, findNode, PlateContent, getNodeEntries, useEditorState, collapseSelection, useMarkToolbarButtonState, useMarkToolbarButton, insertEmptyElement, usePlateSelectors, useEventEditorSelectors, PortalBody, useFormInputProps, createPlugins, Plate } from "@udecode/plate-common";
@@ -889,13 +889,23 @@ const FieldDescription = ({
889
889
  className,
890
890
  ...props
891
891
  }) => {
892
+ if (typeof children === "string") {
893
+ return /* @__PURE__ */ React.createElement(
894
+ "span",
895
+ {
896
+ className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
897
+ ...props,
898
+ dangerouslySetInnerHTML: { __html: children }
899
+ }
900
+ );
901
+ }
892
902
  return /* @__PURE__ */ React.createElement(
893
903
  "span",
894
904
  {
895
905
  className: `block font-sans text-xs italic font-light text-gray-400 pt-0.5 whitespace-normal m-0 ${className}`,
896
- ...props,
897
- dangerouslySetInnerHTML: { __html: children }
898
- }
906
+ ...props
907
+ },
908
+ children
899
909
  );
900
910
  };
901
911
  const FieldError = ({
@@ -1348,8 +1358,8 @@ const ListElementVariants = withVariants(PlateElement, listVariants, [
1348
1358
  ]);
1349
1359
  const ListElement = withRef(
1350
1360
  ({ children, variant = "ul", ...props }, ref) => {
1351
- const Component2 = variant;
1352
- return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component2, null, children));
1361
+ const Component = variant;
1362
+ return /* @__PURE__ */ React__default.createElement(ListElementVariants, { asChild: true, ref, variant, ...props }, /* @__PURE__ */ React__default.createElement(Component, null, children));
1353
1363
  }
1354
1364
  );
1355
1365
  const ELEMENT_MERMAID = "mermaid";
@@ -3669,7 +3679,7 @@ function TinaForm({ form, children }) {
3669
3679
  }));
3670
3680
  }
3671
3681
  function TinaField({
3672
- Component: Component2,
3682
+ Component,
3673
3683
  children,
3674
3684
  ...fieldProps
3675
3685
  }) {
@@ -3677,7 +3687,7 @@ function TinaField({
3677
3687
  if (!isEditing)
3678
3688
  return children || null;
3679
3689
  return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
3680
- return /* @__PURE__ */ React.createElement(Component2, { input, meta, ...fieldProps });
3690
+ return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
3681
3691
  });
3682
3692
  }
3683
3693
  TinaField.propTypes = {
@@ -3847,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
3847
3857
  function _objectWithoutProperties(source, excluded) {
3848
3858
  if (source == null)
3849
3859
  return {};
3850
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3860
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3851
3861
  var key, i;
3852
3862
  if (Object.getOwnPropertySymbols) {
3853
3863
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3862,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
3862
3872
  }
3863
3873
  return target;
3864
3874
  }
3865
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3875
+ function _objectWithoutPropertiesLoose(source, excluded) {
3866
3876
  if (source == null)
3867
3877
  return {};
3868
3878
  var target = {};
@@ -4952,7 +4962,28 @@ const NumberInput = ({
4952
4962
  onChange,
4953
4963
  value,
4954
4964
  step
4955
- }) => /* @__PURE__ */ React.createElement(Input, { type: "number", step, value, onChange });
4965
+ }) => /* @__PURE__ */ React.createElement(
4966
+ Input,
4967
+ {
4968
+ type: "number",
4969
+ step,
4970
+ value,
4971
+ onChange: (event) => {
4972
+ const inputValue = event.target.value;
4973
+ const newValue = inputValue === "" ? void 0 : inputValue;
4974
+ if (onChange) {
4975
+ const syntheticEvent = {
4976
+ ...event,
4977
+ target: {
4978
+ ...event.target,
4979
+ value: newValue
4980
+ }
4981
+ };
4982
+ onChange(syntheticEvent);
4983
+ }
4984
+ }
4985
+ }
4986
+ );
4956
4987
  function useCMS() {
4957
4988
  return useCMS$1();
4958
4989
  }
@@ -7205,244 +7236,65 @@ function pad(type, value) {
7205
7236
  str = "0" + str;
7206
7237
  return str;
7207
7238
  }
7208
- function _inheritsLoose(subClass, superClass) {
7209
- subClass.prototype = Object.create(superClass.prototype);
7210
- subClass.prototype.constructor = subClass;
7211
- _setPrototypeOf(subClass, superClass);
7212
- }
7213
- function _setPrototypeOf(o, p) {
7214
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7215
- o2.__proto__ = p2;
7216
- return o2;
7217
- };
7218
- return _setPrototypeOf(o, p);
7219
- }
7220
- function _objectWithoutPropertiesLoose(source, excluded) {
7221
- if (source == null)
7222
- return {};
7223
- var target = {};
7224
- var sourceKeys = Object.keys(source);
7225
- var key, i;
7226
- for (i = 0; i < sourceKeys.length; i++) {
7227
- key = sourceKeys[i];
7228
- if (excluded.indexOf(key) >= 0)
7229
- continue;
7230
- target[key] = source[key];
7231
- }
7232
- return target;
7233
- }
7234
- function _assertThisInitialized(self) {
7235
- if (self === void 0) {
7236
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7237
- }
7238
- return self;
7239
- }
7240
- function isNodeFound(current, componentNode, ignoreClass) {
7241
- if (current === componentNode) {
7242
- return true;
7243
- }
7244
- if (current.correspondingElement) {
7245
- return current.correspondingElement.classList.contains(ignoreClass);
7246
- }
7247
- return current.classList.contains(ignoreClass);
7248
- }
7249
- function findHighest(current, componentNode, ignoreClass) {
7250
- if (current === componentNode) {
7251
- return true;
7239
+ var useClickAway$1 = {};
7240
+ var util = {};
7241
+ Object.defineProperty(util, "__esModule", { value: true });
7242
+ util.isNavigator = util.isBrowser = util.off = util.on = util.noop = void 0;
7243
+ var noop = function() {
7244
+ };
7245
+ util.noop = noop;
7246
+ function on(obj) {
7247
+ var args = [];
7248
+ for (var _i = 1; _i < arguments.length; _i++) {
7249
+ args[_i - 1] = arguments[_i];
7252
7250
  }
7253
- while (current.parentNode || current.host) {
7254
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7255
- return true;
7256
- }
7257
- current = current.parentNode || current.host;
7251
+ if (obj && obj.addEventListener) {
7252
+ obj.addEventListener.apply(obj, args);
7258
7253
  }
7259
- return current;
7260
7254
  }
7261
- function clickedScrollbar(evt) {
7262
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7263
- }
7264
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7265
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7266
- return;
7255
+ util.on = on;
7256
+ function off(obj) {
7257
+ var args = [];
7258
+ for (var _i = 1; _i < arguments.length; _i++) {
7259
+ args[_i - 1] = arguments[_i];
7267
7260
  }
7268
- var passive = false;
7269
- var options = Object.defineProperty({}, "passive", {
7270
- get: function get2() {
7271
- passive = true;
7272
- }
7273
- });
7274
- var noop = function noop2() {
7275
- };
7276
- window.addEventListener("testPassiveEventSupport", noop, options);
7277
- window.removeEventListener("testPassiveEventSupport", noop, options);
7278
- return passive;
7279
- };
7280
- function autoInc(seed) {
7281
- if (seed === void 0) {
7282
- seed = 0;
7261
+ if (obj && obj.removeEventListener) {
7262
+ obj.removeEventListener.apply(obj, args);
7283
7263
  }
7284
- return function() {
7285
- return ++seed;
7286
- };
7287
- }
7288
- var uid = autoInc();
7289
- var passiveEventSupport;
7290
- var handlersMap = {};
7291
- var enabledInstances = {};
7292
- var touchEvents = ["touchstart", "touchmove"];
7293
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7294
- function getEventHandlerOptions(instance, eventName) {
7295
- var handlerOptions = {};
7296
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7297
- if (isTouchEvent && passiveEventSupport) {
7298
- handlerOptions.passive = !instance.props.preventDefault;
7299
- }
7300
- return handlerOptions;
7301
7264
  }
7302
- function onClickOutsideHOC(WrappedComponent, config) {
7303
- var _class, _temp;
7304
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7305
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7306
- _inheritsLoose(onClickOutside, _Component);
7307
- function onClickOutside(props) {
7308
- var _this;
7309
- _this = _Component.call(this, props) || this;
7310
- _this.__outsideClickHandler = function(event) {
7311
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7312
- _this.__clickOutsideHandlerProp(event);
7313
- return;
7314
- }
7315
- var instance = _this.getInstance();
7316
- if (typeof instance.props.handleClickOutside === "function") {
7317
- instance.props.handleClickOutside(event);
7318
- return;
7319
- }
7320
- if (typeof instance.handleClickOutside === "function") {
7321
- instance.handleClickOutside(event);
7322
- return;
7323
- }
7324
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7325
- };
7326
- _this.__getComponentNode = function() {
7327
- var instance = _this.getInstance();
7328
- if (config && typeof config.setClickOutsideRef === "function") {
7329
- return config.setClickOutsideRef()(instance);
7330
- }
7331
- if (typeof instance.setClickOutsideRef === "function") {
7332
- return instance.setClickOutsideRef();
7333
- }
7334
- return findDOMNode(instance);
7335
- };
7336
- _this.enableOnClickOutside = function() {
7337
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7338
- return;
7339
- }
7340
- if (typeof passiveEventSupport === "undefined") {
7341
- passiveEventSupport = testPassiveEventSupport();
7342
- }
7343
- enabledInstances[_this._uid] = true;
7344
- var events = _this.props.eventTypes;
7345
- if (!events.forEach) {
7346
- events = [events];
7347
- }
7348
- handlersMap[_this._uid] = function(event) {
7349
- if (_this.componentNode === null)
7350
- return;
7351
- if (_this.initTimeStamp > event.timeStamp)
7352
- return;
7353
- if (_this.props.preventDefault) {
7354
- event.preventDefault();
7355
- }
7356
- if (_this.props.stopPropagation) {
7357
- event.stopPropagation();
7358
- }
7359
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7360
- return;
7361
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7362
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7363
- return;
7364
- }
7365
- _this.__outsideClickHandler(event);
7366
- };
7367
- events.forEach(function(eventName) {
7368
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7369
- });
7370
- };
7371
- _this.disableOnClickOutside = function() {
7372
- delete enabledInstances[_this._uid];
7373
- var fn = handlersMap[_this._uid];
7374
- if (fn && typeof document !== "undefined") {
7375
- var events = _this.props.eventTypes;
7376
- if (!events.forEach) {
7377
- events = [events];
7378
- }
7379
- events.forEach(function(eventName) {
7380
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7381
- });
7382
- delete handlersMap[_this._uid];
7383
- }
7384
- };
7385
- _this.getRef = function(ref) {
7386
- return _this.instanceRef = ref;
7387
- };
7388
- _this._uid = uid();
7389
- _this.initTimeStamp = performance.now();
7390
- return _this;
7391
- }
7392
- var _proto = onClickOutside.prototype;
7393
- _proto.getInstance = function getInstance() {
7394
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7395
- return this;
7396
- }
7397
- var ref = this.instanceRef;
7398
- return ref.getInstance ? ref.getInstance() : ref;
7399
- };
7400
- _proto.componentDidMount = function componentDidMount() {
7401
- if (typeof document === "undefined" || !document.createElement) {
7402
- return;
7403
- }
7404
- var instance = this.getInstance();
7405
- if (config && typeof config.handleClickOutside === "function") {
7406
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7407
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7408
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7409
- }
7410
- }
7411
- this.componentNode = this.__getComponentNode();
7412
- if (this.props.disableOnClickOutside)
7413
- return;
7414
- this.enableOnClickOutside();
7415
- };
7416
- _proto.componentDidUpdate = function componentDidUpdate() {
7417
- this.componentNode = this.__getComponentNode();
7418
- };
7419
- _proto.componentWillUnmount = function componentWillUnmount() {
7420
- this.disableOnClickOutside();
7265
+ util.off = off;
7266
+ util.isBrowser = typeof window !== "undefined";
7267
+ util.isNavigator = typeof navigator !== "undefined";
7268
+ Object.defineProperty(useClickAway$1, "__esModule", { value: true });
7269
+ var react_1 = React__default;
7270
+ var util_1 = util;
7271
+ var defaultEvents = ["mousedown", "touchstart"];
7272
+ var useClickAway = function(ref, onClickAway, events) {
7273
+ if (events === void 0) {
7274
+ events = defaultEvents;
7275
+ }
7276
+ var savedCallback = react_1.useRef(onClickAway);
7277
+ react_1.useEffect(function() {
7278
+ savedCallback.current = onClickAway;
7279
+ }, [onClickAway]);
7280
+ react_1.useEffect(function() {
7281
+ var handler = function(event) {
7282
+ var el = ref.current;
7283
+ el && !el.contains(event.target) && savedCallback.current(event);
7421
7284
  };
7422
- _proto.render = function render() {
7423
- var _this$props = this.props;
7424
- _this$props.excludeScrollbar;
7425
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7426
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7427
- props.ref = this.getRef;
7428
- } else {
7429
- props.wrappedRef = this.getRef;
7285
+ for (var _i = 0, events_1 = events; _i < events_1.length; _i++) {
7286
+ var eventName = events_1[_i];
7287
+ util_1.on(document, eventName, handler);
7288
+ }
7289
+ return function() {
7290
+ for (var _i2 = 0, events_2 = events; _i2 < events_2.length; _i2++) {
7291
+ var eventName2 = events_2[_i2];
7292
+ util_1.off(document, eventName2, handler);
7430
7293
  }
7431
- props.disableOnClickOutside = this.disableOnClickOutside;
7432
- props.enableOnClickOutside = this.enableOnClickOutside;
7433
- return createElement(WrappedComponent, props);
7434
7294
  };
7435
- return onClickOutside;
7436
- }(Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7437
- eventTypes: ["mousedown", "touchstart"],
7438
- excludeScrollbar: config && config.excludeScrollbar || false,
7439
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7440
- preventDefault: false,
7441
- stopPropagation: false
7442
- }, _class.getClass = function() {
7443
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7444
- }, _temp;
7445
- }
7295
+ }, [events, ref]);
7296
+ };
7297
+ var _default = useClickAway$1.default = useClickAway;
7446
7298
  const viewModes = {
7447
7299
  YEARS: "years",
7448
7300
  MONTHS: "months",
@@ -7971,22 +7823,13 @@ function log(message, method) {
7971
7823
  }
7972
7824
  con[method]("***react-datetime:" + message);
7973
7825
  }
7974
- class ClickOutBase extends React__default.Component {
7975
- constructor() {
7976
- super(...arguments);
7977
- __publicField(this, "container", React__default.createRef());
7978
- }
7979
- render() {
7980
- return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7981
- }
7982
- handleClickOutside(e) {
7983
- this.props.onClickOut(e);
7984
- }
7985
- setClickOutsideRef() {
7986
- return this.container.current;
7987
- }
7826
+ function ClickableWrapper({ className, onClickOut, children }) {
7827
+ const containerRef = useRef(null);
7828
+ _default(containerRef, (event) => {
7829
+ onClickOut(event);
7830
+ });
7831
+ return /* @__PURE__ */ React__default.createElement("div", { className, ref: containerRef }, children);
7988
7832
  }
7989
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7990
7833
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7991
7834
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7992
7835
  const format$1 = (val, _name, field) => {
@@ -8029,7 +7872,10 @@ const DateField = wrapFieldsWithMeta(
8029
7872
  ReactDateTimeWithStyles,
8030
7873
  {
8031
7874
  value: input.value,
8032
- onChange: input.onChange,
7875
+ onChange: (value) => {
7876
+ const newValue = value === "" ? void 0 : value;
7877
+ input.onChange(newValue);
7878
+ },
8033
7879
  dateFormat: dateFormat || DEFAULT_DATE_DISPLAY_FORMAT,
8034
7880
  timeFormat: timeFormat || false,
8035
7881
  inputProps: { className: textFieldClasses },
@@ -9840,7 +9686,7 @@ class SidebarState {
9840
9686
  }
9841
9687
  }
9842
9688
  function createScreen({
9843
- Component: Component2,
9689
+ Component,
9844
9690
  props,
9845
9691
  ...options
9846
9692
  }) {
@@ -9849,7 +9695,7 @@ function createScreen({
9849
9695
  layout: "popup",
9850
9696
  ...options,
9851
9697
  Component(screenProps) {
9852
- return /* @__PURE__ */ React__default.createElement(Component2, { ...screenProps, ...props });
9698
+ return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
9853
9699
  }
9854
9700
  };
9855
9701
  }
@@ -10360,7 +10206,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
10360
10206
  "Event Log"
10361
10207
  ));
10362
10208
  };
10363
- const version = "2.4.0";
10209
+ const version = "2.5.2";
10364
10210
  const Nav = ({
10365
10211
  isLocalMode,
10366
10212
  className = "",
@@ -13289,9 +13135,9 @@ const EllipsisIcon = ({ title }) => {
13289
13135
  ));
13290
13136
  };
13291
13137
  const Wrapper$1 = ({ inline, children }) => {
13292
- const Component2 = inline ? "span" : "div";
13138
+ const Component = inline ? "span" : "div";
13293
13139
  return /* @__PURE__ */ React__default.createElement(
13294
- Component2,
13140
+ Component,
13295
13141
  {
13296
13142
  contentEditable: false,
13297
13143
  style: { userSelect: "none" },
@@ -14079,13 +13925,13 @@ const TooltipContent = withCn(
14079
13925
  }),
14080
13926
  "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14081
13927
  );
14082
- function withTooltip(Component2) {
13928
+ function withTooltip(Component) {
14083
13929
  return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
14084
13930
  const [mounted, setMounted] = React__default.useState(false);
14085
13931
  React__default.useEffect(() => {
14086
13932
  setMounted(true);
14087
13933
  }, []);
14088
- const component = /* @__PURE__ */ React__default.createElement(Component2, { ref, ...props });
13934
+ const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
14089
13935
  if (tooltip && mounted) {
14090
13936
  return /* @__PURE__ */ React__default.createElement(Tooltip, { ...tooltipProps }, /* @__PURE__ */ React__default.createElement(TooltipTrigger, { asChild: true }, component), /* @__PURE__ */ React__default.createElement(TooltipPortal, null, /* @__PURE__ */ React__default.createElement(TooltipContent, { ...tooltipContentProps }, tooltip)));
14091
13937
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.0.0-d524599-20241117111320",
3
+ "version": "0.0.0-d7c745e-20250102002342",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "exports": {
@@ -98,7 +98,6 @@
98
98
  "color-string": "^1.9.1",
99
99
  "crypto-js": "^4.2.0",
100
100
  "date-fns": "2.30.0",
101
- "fetch-ponyfill": "^7.1.0",
102
101
  "final-form": "4.20.10",
103
102
  "final-form-arrays": "^3.1.0",
104
103
  "final-form-set-field-data": "^1.0.2",
@@ -119,8 +118,8 @@
119
118
  "react-dropzone": "14.2.3",
120
119
  "react-final-form": "^6.5.9",
121
120
  "react-icons": "^5.3.0",
122
- "react-onclickoutside": "^6.13.1",
123
121
  "react-router-dom": "6.3.0",
122
+ "react-use": "^17.6.0",
124
123
  "slate": "^0.103.0",
125
124
  "slate-history": "^0.100.0",
126
125
  "slate-hyperscript": "^0.100.0",
@@ -129,9 +128,9 @@
129
128
  "webfontloader": "1.6.28",
130
129
  "yup": "^1.4.0",
131
130
  "zod": "^3.23.8",
132
- "@tinacms/mdx": "0.0.0-d524599-20241117111320",
133
- "@tinacms/search": "0.0.0-d524599-20241117111320",
134
- "@tinacms/schema-tools": "0.0.0-d524599-20241117111320"
131
+ "@tinacms/mdx": "0.0.0-d7c745e-20250102002342",
132
+ "@tinacms/schema-tools": "1.6.9",
133
+ "@tinacms/search": "0.0.0-d7c745e-20250102002342"
135
134
  },
136
135
  "devDependencies": {
137
136
  "@graphql-tools/utils": "^10.5.6",
@@ -164,7 +163,7 @@
164
163
  "typescript": "^5.6.3",
165
164
  "vite": "^5.4.11",
166
165
  "vitest": "^2.1.5",
167
- "@tinacms/scripts": "0.0.0-d524599-20241117111320"
166
+ "@tinacms/scripts": "1.3.1"
168
167
  },
169
168
  "peerDependencies": {
170
169
  "react": ">=16.14.0",