tinacms 0.0.0-b54b303-20241210232138 → 0.0.0-b832ee4-20250102012112

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.js CHANGED
@@ -3830,7 +3830,7 @@ flowchart TD
3830
3830
  function _objectWithoutProperties(source, excluded) {
3831
3831
  if (source == null)
3832
3832
  return {};
3833
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3833
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3834
3834
  var key, i;
3835
3835
  if (Object.getOwnPropertySymbols) {
3836
3836
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3845,7 +3845,7 @@ flowchart TD
3845
3845
  }
3846
3846
  return target;
3847
3847
  }
3848
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3848
+ function _objectWithoutPropertiesLoose(source, excluded) {
3849
3849
  if (source == null)
3850
3850
  return {};
3851
3851
  var target = {};
@@ -7209,244 +7209,65 @@ flowchart TD
7209
7209
  str = "0" + str;
7210
7210
  return str;
7211
7211
  }
7212
- function _inheritsLoose(subClass, superClass) {
7213
- subClass.prototype = Object.create(superClass.prototype);
7214
- subClass.prototype.constructor = subClass;
7215
- _setPrototypeOf(subClass, superClass);
7216
- }
7217
- function _setPrototypeOf(o, p) {
7218
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7219
- o2.__proto__ = p2;
7220
- return o2;
7221
- };
7222
- return _setPrototypeOf(o, p);
7223
- }
7224
- function _objectWithoutPropertiesLoose(source, excluded) {
7225
- if (source == null)
7226
- return {};
7227
- var target = {};
7228
- var sourceKeys = Object.keys(source);
7229
- var key, i;
7230
- for (i = 0; i < sourceKeys.length; i++) {
7231
- key = sourceKeys[i];
7232
- if (excluded.indexOf(key) >= 0)
7233
- continue;
7234
- target[key] = source[key];
7235
- }
7236
- return target;
7237
- }
7238
- function _assertThisInitialized(self2) {
7239
- if (self2 === void 0) {
7240
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7241
- }
7242
- return self2;
7243
- }
7244
- function isNodeFound(current, componentNode, ignoreClass) {
7245
- if (current === componentNode) {
7246
- return true;
7247
- }
7248
- if (current.correspondingElement) {
7249
- return current.correspondingElement.classList.contains(ignoreClass);
7250
- }
7251
- return current.classList.contains(ignoreClass);
7252
- }
7253
- function findHighest(current, componentNode, ignoreClass) {
7254
- if (current === componentNode) {
7255
- 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];
7256
7223
  }
7257
- while (current.parentNode || current.host) {
7258
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7259
- return true;
7260
- }
7261
- current = current.parentNode || current.host;
7224
+ if (obj && obj.addEventListener) {
7225
+ obj.addEventListener.apply(obj, args);
7262
7226
  }
7263
- return current;
7264
- }
7265
- function clickedScrollbar(evt) {
7266
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7267
7227
  }
7268
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7269
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7270
- 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];
7271
7233
  }
7272
- var passive = false;
7273
- var options = Object.defineProperty({}, "passive", {
7274
- get: function get2() {
7275
- passive = true;
7276
- }
7277
- });
7278
- var noop = function noop2() {
7279
- };
7280
- window.addEventListener("testPassiveEventSupport", noop, options);
7281
- window.removeEventListener("testPassiveEventSupport", noop, options);
7282
- return passive;
7283
- };
7284
- function autoInc(seed) {
7285
- if (seed === void 0) {
7286
- seed = 0;
7234
+ if (obj && obj.removeEventListener) {
7235
+ obj.removeEventListener.apply(obj, args);
7287
7236
  }
7288
- return function() {
7289
- return ++seed;
7290
- };
7291
7237
  }
7292
- var uid = autoInc();
7293
- var passiveEventSupport;
7294
- var handlersMap = {};
7295
- var enabledInstances = {};
7296
- var touchEvents = ["touchstart", "touchmove"];
7297
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7298
- function getEventHandlerOptions(instance, eventName) {
7299
- var handlerOptions = {};
7300
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7301
- if (isTouchEvent && passiveEventSupport) {
7302
- handlerOptions.passive = !instance.props.preventDefault;
7303
- }
7304
- return handlerOptions;
7305
- }
7306
- function onClickOutsideHOC(WrappedComponent, config) {
7307
- var _class, _temp;
7308
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7309
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7310
- _inheritsLoose(onClickOutside, _Component);
7311
- function onClickOutside(props) {
7312
- var _this;
7313
- _this = _Component.call(this, props) || this;
7314
- _this.__outsideClickHandler = function(event) {
7315
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7316
- _this.__clickOutsideHandlerProp(event);
7317
- return;
7318
- }
7319
- var instance = _this.getInstance();
7320
- if (typeof instance.props.handleClickOutside === "function") {
7321
- instance.props.handleClickOutside(event);
7322
- return;
7323
- }
7324
- if (typeof instance.handleClickOutside === "function") {
7325
- instance.handleClickOutside(event);
7326
- return;
7327
- }
7328
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7329
- };
7330
- _this.__getComponentNode = function() {
7331
- var instance = _this.getInstance();
7332
- if (config && typeof config.setClickOutsideRef === "function") {
7333
- return config.setClickOutsideRef()(instance);
7334
- }
7335
- if (typeof instance.setClickOutsideRef === "function") {
7336
- return instance.setClickOutsideRef();
7337
- }
7338
- return reactDom.findDOMNode(instance);
7339
- };
7340
- _this.enableOnClickOutside = function() {
7341
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7342
- return;
7343
- }
7344
- if (typeof passiveEventSupport === "undefined") {
7345
- passiveEventSupport = testPassiveEventSupport();
7346
- }
7347
- enabledInstances[_this._uid] = true;
7348
- var events = _this.props.eventTypes;
7349
- if (!events.forEach) {
7350
- events = [events];
7351
- }
7352
- handlersMap[_this._uid] = function(event) {
7353
- if (_this.componentNode === null)
7354
- return;
7355
- if (_this.initTimeStamp > event.timeStamp)
7356
- return;
7357
- if (_this.props.preventDefault) {
7358
- event.preventDefault();
7359
- }
7360
- if (_this.props.stopPropagation) {
7361
- event.stopPropagation();
7362
- }
7363
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7364
- return;
7365
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7366
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7367
- return;
7368
- }
7369
- _this.__outsideClickHandler(event);
7370
- };
7371
- events.forEach(function(eventName) {
7372
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7373
- });
7374
- };
7375
- _this.disableOnClickOutside = function() {
7376
- delete enabledInstances[_this._uid];
7377
- var fn = handlersMap[_this._uid];
7378
- if (fn && typeof document !== "undefined") {
7379
- var events = _this.props.eventTypes;
7380
- if (!events.forEach) {
7381
- events = [events];
7382
- }
7383
- events.forEach(function(eventName) {
7384
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7385
- });
7386
- delete handlersMap[_this._uid];
7387
- }
7388
- };
7389
- _this.getRef = function(ref) {
7390
- return _this.instanceRef = ref;
7391
- };
7392
- _this._uid = uid();
7393
- _this.initTimeStamp = performance.now();
7394
- return _this;
7395
- }
7396
- var _proto = onClickOutside.prototype;
7397
- _proto.getInstance = function getInstance() {
7398
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7399
- return this;
7400
- }
7401
- var ref = this.instanceRef;
7402
- return ref.getInstance ? ref.getInstance() : ref;
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);
7403
7257
  };
7404
- _proto.componentDidMount = function componentDidMount() {
7405
- if (typeof document === "undefined" || !document.createElement) {
7406
- return;
7407
- }
7408
- var instance = this.getInstance();
7409
- if (config && typeof config.handleClickOutside === "function") {
7410
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7411
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7412
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7413
- }
7414
- }
7415
- this.componentNode = this.__getComponentNode();
7416
- if (this.props.disableOnClickOutside)
7417
- return;
7418
- this.enableOnClickOutside();
7419
- };
7420
- _proto.componentDidUpdate = function componentDidUpdate() {
7421
- this.componentNode = this.__getComponentNode();
7422
- };
7423
- _proto.componentWillUnmount = function componentWillUnmount() {
7424
- this.disableOnClickOutside();
7425
- };
7426
- _proto.render = function render() {
7427
- var _this$props = this.props;
7428
- _this$props.excludeScrollbar;
7429
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7430
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7431
- props.ref = this.getRef;
7432
- } else {
7433
- 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);
7434
7266
  }
7435
- props.disableOnClickOutside = this.disableOnClickOutside;
7436
- props.enableOnClickOutside = this.enableOnClickOutside;
7437
- return React.createElement(WrappedComponent, props);
7438
7267
  };
7439
- return onClickOutside;
7440
- }(React.Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7441
- eventTypes: ["mousedown", "touchstart"],
7442
- excludeScrollbar: config && config.excludeScrollbar || false,
7443
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7444
- preventDefault: false,
7445
- stopPropagation: false
7446
- }, _class.getClass = function() {
7447
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7448
- }, _temp;
7449
- }
7268
+ }, [events, ref]);
7269
+ };
7270
+ var _default = useClickAway$1.default = useClickAway;
7450
7271
  const viewModes = {
7451
7272
  YEARS: "years",
7452
7273
  MONTHS: "months",
@@ -7975,22 +7796,13 @@ flowchart TD
7975
7796
  }
7976
7797
  con[method]("***react-datetime:" + message);
7977
7798
  }
7978
- class ClickOutBase extends React.Component {
7979
- constructor() {
7980
- super(...arguments);
7981
- __publicField(this, "container", React.createRef());
7982
- }
7983
- render() {
7984
- return /* @__PURE__ */ React.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
7985
- }
7986
- handleClickOutside(e) {
7987
- this.props.onClickOut(e);
7988
- }
7989
- setClickOutsideRef() {
7990
- return this.container.current;
7991
- }
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);
7992
7805
  }
7993
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
7994
7806
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
7995
7807
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
7996
7808
  const format$1 = (val, _name, field) => {
@@ -10367,7 +10179,7 @@ flowchart TD
10367
10179
  "Event Log"
10368
10180
  ));
10369
10181
  };
10370
- const version = "2.5.1";
10182
+ const version = "2.5.2";
10371
10183
  const Nav = ({
10372
10184
  isLocalMode,
10373
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";
@@ -1358,8 +1358,8 @@ const ListElementVariants = withVariants(PlateElement, listVariants, [
1358
1358
  ]);
1359
1359
  const ListElement = withRef(
1360
1360
  ({ children, variant = "ul", ...props }, ref) => {
1361
- const Component2 = variant;
1362
- 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));
1363
1363
  }
1364
1364
  );
1365
1365
  const ELEMENT_MERMAID = "mermaid";
@@ -3679,7 +3679,7 @@ function TinaForm({ form, children }) {
3679
3679
  }));
3680
3680
  }
3681
3681
  function TinaField({
3682
- Component: Component2,
3682
+ Component,
3683
3683
  children,
3684
3684
  ...fieldProps
3685
3685
  }) {
@@ -3687,7 +3687,7 @@ function TinaField({
3687
3687
  if (!isEditing)
3688
3688
  return children || null;
3689
3689
  return /* @__PURE__ */ React.createElement(Field, { ...fieldProps }, ({ input, meta }) => {
3690
- return /* @__PURE__ */ React.createElement(Component2, { input, meta, ...fieldProps });
3690
+ return /* @__PURE__ */ React.createElement(Component, { input, meta, ...fieldProps });
3691
3691
  });
3692
3692
  }
3693
3693
  TinaField.propTypes = {
@@ -3857,7 +3857,7 @@ var _excluded = ["attr", "size", "title"];
3857
3857
  function _objectWithoutProperties(source, excluded) {
3858
3858
  if (source == null)
3859
3859
  return {};
3860
- var target = _objectWithoutPropertiesLoose$1(source, excluded);
3860
+ var target = _objectWithoutPropertiesLoose(source, excluded);
3861
3861
  var key, i;
3862
3862
  if (Object.getOwnPropertySymbols) {
3863
3863
  var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
@@ -3872,7 +3872,7 @@ function _objectWithoutProperties(source, excluded) {
3872
3872
  }
3873
3873
  return target;
3874
3874
  }
3875
- function _objectWithoutPropertiesLoose$1(source, excluded) {
3875
+ function _objectWithoutPropertiesLoose(source, excluded) {
3876
3876
  if (source == null)
3877
3877
  return {};
3878
3878
  var target = {};
@@ -7236,244 +7236,65 @@ function pad(type, value) {
7236
7236
  str = "0" + str;
7237
7237
  return str;
7238
7238
  }
7239
- function _inheritsLoose(subClass, superClass) {
7240
- subClass.prototype = Object.create(superClass.prototype);
7241
- subClass.prototype.constructor = subClass;
7242
- _setPrototypeOf(subClass, superClass);
7243
- }
7244
- function _setPrototypeOf(o, p) {
7245
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
7246
- o2.__proto__ = p2;
7247
- return o2;
7248
- };
7249
- return _setPrototypeOf(o, p);
7250
- }
7251
- function _objectWithoutPropertiesLoose(source, excluded) {
7252
- if (source == null)
7253
- return {};
7254
- var target = {};
7255
- var sourceKeys = Object.keys(source);
7256
- var key, i;
7257
- for (i = 0; i < sourceKeys.length; i++) {
7258
- key = sourceKeys[i];
7259
- if (excluded.indexOf(key) >= 0)
7260
- continue;
7261
- target[key] = source[key];
7262
- }
7263
- return target;
7264
- }
7265
- function _assertThisInitialized(self) {
7266
- if (self === void 0) {
7267
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
7268
- }
7269
- return self;
7270
- }
7271
- function isNodeFound(current, componentNode, ignoreClass) {
7272
- if (current === componentNode) {
7273
- return true;
7274
- }
7275
- if (current.correspondingElement) {
7276
- return current.correspondingElement.classList.contains(ignoreClass);
7277
- }
7278
- return current.classList.contains(ignoreClass);
7279
- }
7280
- function findHighest(current, componentNode, ignoreClass) {
7281
- if (current === componentNode) {
7282
- 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];
7283
7250
  }
7284
- while (current.parentNode || current.host) {
7285
- if (current.parentNode && isNodeFound(current, componentNode, ignoreClass)) {
7286
- return true;
7287
- }
7288
- current = current.parentNode || current.host;
7251
+ if (obj && obj.addEventListener) {
7252
+ obj.addEventListener.apply(obj, args);
7289
7253
  }
7290
- return current;
7291
- }
7292
- function clickedScrollbar(evt) {
7293
- return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
7294
7254
  }
7295
- var testPassiveEventSupport = function testPassiveEventSupport2() {
7296
- if (typeof window === "undefined" || typeof window.addEventListener !== "function") {
7297
- 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];
7298
7260
  }
7299
- var passive = false;
7300
- var options = Object.defineProperty({}, "passive", {
7301
- get: function get2() {
7302
- passive = true;
7303
- }
7304
- });
7305
- var noop = function noop2() {
7306
- };
7307
- window.addEventListener("testPassiveEventSupport", noop, options);
7308
- window.removeEventListener("testPassiveEventSupport", noop, options);
7309
- return passive;
7310
- };
7311
- function autoInc(seed) {
7312
- if (seed === void 0) {
7313
- seed = 0;
7261
+ if (obj && obj.removeEventListener) {
7262
+ obj.removeEventListener.apply(obj, args);
7314
7263
  }
7315
- return function() {
7316
- return ++seed;
7317
- };
7318
7264
  }
7319
- var uid = autoInc();
7320
- var passiveEventSupport;
7321
- var handlersMap = {};
7322
- var enabledInstances = {};
7323
- var touchEvents = ["touchstart", "touchmove"];
7324
- var IGNORE_CLASS_NAME = "ignore-react-onclickoutside";
7325
- function getEventHandlerOptions(instance, eventName) {
7326
- var handlerOptions = {};
7327
- var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
7328
- if (isTouchEvent && passiveEventSupport) {
7329
- handlerOptions.passive = !instance.props.preventDefault;
7330
- }
7331
- return handlerOptions;
7332
- }
7333
- function onClickOutsideHOC(WrappedComponent, config) {
7334
- var _class, _temp;
7335
- var componentName = WrappedComponent.displayName || WrappedComponent.name || "Component";
7336
- return _temp = _class = /* @__PURE__ */ function(_Component) {
7337
- _inheritsLoose(onClickOutside, _Component);
7338
- function onClickOutside(props) {
7339
- var _this;
7340
- _this = _Component.call(this, props) || this;
7341
- _this.__outsideClickHandler = function(event) {
7342
- if (typeof _this.__clickOutsideHandlerProp === "function") {
7343
- _this.__clickOutsideHandlerProp(event);
7344
- return;
7345
- }
7346
- var instance = _this.getInstance();
7347
- if (typeof instance.props.handleClickOutside === "function") {
7348
- instance.props.handleClickOutside(event);
7349
- return;
7350
- }
7351
- if (typeof instance.handleClickOutside === "function") {
7352
- instance.handleClickOutside(event);
7353
- return;
7354
- }
7355
- throw new Error("WrappedComponent: " + componentName + " lacks a handleClickOutside(event) function for processing outside click events.");
7356
- };
7357
- _this.__getComponentNode = function() {
7358
- var instance = _this.getInstance();
7359
- if (config && typeof config.setClickOutsideRef === "function") {
7360
- return config.setClickOutsideRef()(instance);
7361
- }
7362
- if (typeof instance.setClickOutsideRef === "function") {
7363
- return instance.setClickOutsideRef();
7364
- }
7365
- return findDOMNode(instance);
7366
- };
7367
- _this.enableOnClickOutside = function() {
7368
- if (typeof document === "undefined" || enabledInstances[_this._uid]) {
7369
- return;
7370
- }
7371
- if (typeof passiveEventSupport === "undefined") {
7372
- passiveEventSupport = testPassiveEventSupport();
7373
- }
7374
- enabledInstances[_this._uid] = true;
7375
- var events = _this.props.eventTypes;
7376
- if (!events.forEach) {
7377
- events = [events];
7378
- }
7379
- handlersMap[_this._uid] = function(event) {
7380
- if (_this.componentNode === null)
7381
- return;
7382
- if (_this.initTimeStamp > event.timeStamp)
7383
- return;
7384
- if (_this.props.preventDefault) {
7385
- event.preventDefault();
7386
- }
7387
- if (_this.props.stopPropagation) {
7388
- event.stopPropagation();
7389
- }
7390
- if (_this.props.excludeScrollbar && clickedScrollbar(event))
7391
- return;
7392
- var current = event.composed && event.composedPath && event.composedPath().shift() || event.target;
7393
- if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
7394
- return;
7395
- }
7396
- _this.__outsideClickHandler(event);
7397
- };
7398
- events.forEach(function(eventName) {
7399
- document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7400
- });
7401
- };
7402
- _this.disableOnClickOutside = function() {
7403
- delete enabledInstances[_this._uid];
7404
- var fn = handlersMap[_this._uid];
7405
- if (fn && typeof document !== "undefined") {
7406
- var events = _this.props.eventTypes;
7407
- if (!events.forEach) {
7408
- events = [events];
7409
- }
7410
- events.forEach(function(eventName) {
7411
- return document.removeEventListener(eventName, fn, getEventHandlerOptions(_assertThisInitialized(_this), eventName));
7412
- });
7413
- delete handlersMap[_this._uid];
7414
- }
7415
- };
7416
- _this.getRef = function(ref) {
7417
- return _this.instanceRef = ref;
7418
- };
7419
- _this._uid = uid();
7420
- _this.initTimeStamp = performance.now();
7421
- return _this;
7422
- }
7423
- var _proto = onClickOutside.prototype;
7424
- _proto.getInstance = function getInstance() {
7425
- if (WrappedComponent.prototype && !WrappedComponent.prototype.isReactComponent) {
7426
- return this;
7427
- }
7428
- var ref = this.instanceRef;
7429
- return ref.getInstance ? ref.getInstance() : ref;
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);
7430
7284
  };
7431
- _proto.componentDidMount = function componentDidMount() {
7432
- if (typeof document === "undefined" || !document.createElement) {
7433
- return;
7434
- }
7435
- var instance = this.getInstance();
7436
- if (config && typeof config.handleClickOutside === "function") {
7437
- this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
7438
- if (typeof this.__clickOutsideHandlerProp !== "function") {
7439
- throw new Error("WrappedComponent: " + componentName + " lacks a function for processing outside click events specified by the handleClickOutside config option.");
7440
- }
7441
- }
7442
- this.componentNode = this.__getComponentNode();
7443
- if (this.props.disableOnClickOutside)
7444
- return;
7445
- this.enableOnClickOutside();
7446
- };
7447
- _proto.componentDidUpdate = function componentDidUpdate() {
7448
- this.componentNode = this.__getComponentNode();
7449
- };
7450
- _proto.componentWillUnmount = function componentWillUnmount() {
7451
- this.disableOnClickOutside();
7452
- };
7453
- _proto.render = function render() {
7454
- var _this$props = this.props;
7455
- _this$props.excludeScrollbar;
7456
- var props = _objectWithoutPropertiesLoose(_this$props, ["excludeScrollbar"]);
7457
- if (WrappedComponent.prototype && WrappedComponent.prototype.isReactComponent) {
7458
- props.ref = this.getRef;
7459
- } else {
7460
- 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);
7461
7293
  }
7462
- props.disableOnClickOutside = this.disableOnClickOutside;
7463
- props.enableOnClickOutside = this.enableOnClickOutside;
7464
- return createElement(WrappedComponent, props);
7465
7294
  };
7466
- return onClickOutside;
7467
- }(Component), _class.displayName = "OnClickOutside(" + componentName + ")", _class.defaultProps = {
7468
- eventTypes: ["mousedown", "touchstart"],
7469
- excludeScrollbar: config && config.excludeScrollbar || false,
7470
- outsideClickIgnoreClass: IGNORE_CLASS_NAME,
7471
- preventDefault: false,
7472
- stopPropagation: false
7473
- }, _class.getClass = function() {
7474
- return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
7475
- }, _temp;
7476
- }
7295
+ }, [events, ref]);
7296
+ };
7297
+ var _default = useClickAway$1.default = useClickAway;
7477
7298
  const viewModes = {
7478
7299
  YEARS: "years",
7479
7300
  MONTHS: "months",
@@ -8002,22 +7823,13 @@ function log(message, method) {
8002
7823
  }
8003
7824
  con[method]("***react-datetime:" + message);
8004
7825
  }
8005
- class ClickOutBase extends React__default.Component {
8006
- constructor() {
8007
- super(...arguments);
8008
- __publicField(this, "container", React__default.createRef());
8009
- }
8010
- render() {
8011
- return /* @__PURE__ */ React__default.createElement("div", { className: this.props.className, ref: this.container }, this.props.children);
8012
- }
8013
- handleClickOutside(e) {
8014
- this.props.onClickOut(e);
8015
- }
8016
- setClickOutsideRef() {
8017
- return this.container.current;
8018
- }
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);
8019
7832
  }
8020
- const ClickableWrapper = onClickOutsideHOC(ClickOutBase);
8021
7833
  const DEFAULT_DATE_DISPLAY_FORMAT = "MMM DD, YYYY";
8022
7834
  const DEFAULT_TIME_DISPLAY_FORMAT = "h:mm A";
8023
7835
  const format$1 = (val, _name, field) => {
@@ -9874,7 +9686,7 @@ class SidebarState {
9874
9686
  }
9875
9687
  }
9876
9688
  function createScreen({
9877
- Component: Component2,
9689
+ Component,
9878
9690
  props,
9879
9691
  ...options
9880
9692
  }) {
@@ -9883,7 +9695,7 @@ function createScreen({
9883
9695
  layout: "popup",
9884
9696
  ...options,
9885
9697
  Component(screenProps) {
9886
- return /* @__PURE__ */ React__default.createElement(Component2, { ...screenProps, ...props });
9698
+ return /* @__PURE__ */ React__default.createElement(Component, { ...screenProps, ...props });
9887
9699
  }
9888
9700
  };
9889
9701
  }
@@ -10394,7 +10206,7 @@ const SyncStatus = ({ cms, setEventsOpen }) => {
10394
10206
  "Event Log"
10395
10207
  ));
10396
10208
  };
10397
- const version = "2.5.1";
10209
+ const version = "2.5.2";
10398
10210
  const Nav = ({
10399
10211
  isLocalMode,
10400
10212
  className = "",
@@ -13323,9 +13135,9 @@ const EllipsisIcon = ({ title }) => {
13323
13135
  ));
13324
13136
  };
13325
13137
  const Wrapper$1 = ({ inline, children }) => {
13326
- const Component2 = inline ? "span" : "div";
13138
+ const Component = inline ? "span" : "div";
13327
13139
  return /* @__PURE__ */ React__default.createElement(
13328
- Component2,
13140
+ Component,
13329
13141
  {
13330
13142
  contentEditable: false,
13331
13143
  style: { userSelect: "none" },
@@ -14113,13 +13925,13 @@ const TooltipContent = withCn(
14113
13925
  }),
14114
13926
  "z-[9999] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md"
14115
13927
  );
14116
- function withTooltip(Component2) {
13928
+ function withTooltip(Component) {
14117
13929
  return React__default.forwardRef(function ExtendComponent({ tooltip, tooltipContentProps, tooltipProps, ...props }, ref) {
14118
13930
  const [mounted, setMounted] = React__default.useState(false);
14119
13931
  React__default.useEffect(() => {
14120
13932
  setMounted(true);
14121
13933
  }, []);
14122
- const component = /* @__PURE__ */ React__default.createElement(Component2, { ref, ...props });
13934
+ const component = /* @__PURE__ */ React__default.createElement(Component, { ref, ...props });
14123
13935
  if (tooltip && mounted) {
14124
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)));
14125
13937
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.0.0-b54b303-20241210232138",
3
+ "version": "0.0.0-b832ee4-20250102012112",
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": "1.5.2",
133
- "@tinacms/search": "1.0.35",
134
- "@tinacms/schema-tools": "1.6.8"
131
+ "@tinacms/mdx": "0.0.0-b832ee4-20250102012112",
132
+ "@tinacms/schema-tools": "1.6.9",
133
+ "@tinacms/search": "0.0.0-b832ee4-20250102012112"
135
134
  },
136
135
  "devDependencies": {
137
136
  "@graphql-tools/utils": "^10.5.6",