@firecms/core 3.0.0-tw4.2 → 3.0.0

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/README.md CHANGED
@@ -167,7 +167,7 @@ in `example/src`.
167
167
  That file needs to export a valid Firebase config, that you can get
168
168
  from your Firebase console when creating a webapp for your project.
169
169
 
170
- Then simply run `npm install` and `npm run dev` (or `yarn` and `yarn dev`)
170
+ Then simply run `yarn` and `yarn dev`
171
171
 
172
172
  ## License
173
173
 
@@ -1,6 +1,6 @@
1
1
  import { AuthController, DataSourceDelegate, FireCMSPlugin } from "../types";
2
2
  export declare const DEFAULT_SERVER_DEV = "https://api-kdoe6pj3qq-ey.a.run.app";
3
- export declare const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
3
+ export declare const DEFAULT_SERVER = "https://api.firecms.co";
4
4
  export type AccessResponse = {
5
5
  blocked?: boolean;
6
6
  message?: string;
package/dist/index.es.js CHANGED
@@ -1127,6 +1127,18 @@ function unslugify(slug) {
1127
1127
  return slug.trim();
1128
1128
  }
1129
1129
  }
1130
+ function prettifyIdentifier(input) {
1131
+ if (!input) return "";
1132
+ let text = input;
1133
+ text = text.replace(/([a-z])([A-Z])|([A-Z])([A-Z][a-z])/g, "$1$3 $2$4");
1134
+ text = text.replace(/[_-]+/g, " ");
1135
+ const s = text.trim().replace(/\b\w/g, (char) => char.toUpperCase());
1136
+ console.log("Prettified identifier:", {
1137
+ input,
1138
+ s
1139
+ });
1140
+ return s;
1141
+ }
1130
1142
  const defaultDateFormat = "MMMM dd, yyyy, HH:mm:ss";
1131
1143
  const COLLECTION_PATH_SEPARATOR = "::";
1132
1144
  function stripCollectionPath(path) {
@@ -4908,7 +4920,7 @@ function EmptyValue() {
4908
4920
  const $ = c(1);
4909
4921
  let t0;
4910
4922
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
4911
- t0 = /* @__PURE__ */ jsx("div", { className: "rounded-full bg-surface-200 bg-opacity-30 bg-surface-200/30 dark:bg-opacity-20 dark:bg-surface-200/20 w-5 h-2 inline-block" });
4923
+ t0 = /* @__PURE__ */ jsx("div", { className: "rounded-full bg-surface-200 bg-opacity-30 dark:bg-opacity-20 w-5 h-2 inline-block" });
4912
4924
  $[0] = t0;
4913
4925
  } else {
4914
4926
  t0 = $[0];
@@ -9733,9 +9745,9 @@ const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
9733
9745
  }
9734
9746
  const setOnHoverFalse = t10;
9735
9747
  const borderClass = showError ? "border-red-500" : internalSaved ? "border-green-500" : isSelected ? "border-primary" : "border-transparent";
9736
- const t11 = `flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`;
9748
+ const t11 = `flex relative h-full rounded-md p-${p} border border-4 border-opacity-75`;
9737
9749
  const t12 = onHover && !disabled ? "bg-surface-50 dark:bg-surface-900" : "";
9738
- const t13 = saved ? "bg-surface-100/75 dark:bg-surface-800/75" : "";
9750
+ const t13 = saved ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
9739
9751
  const t14 = hideOverflow ? "overflow-hidden" : "";
9740
9752
  const t15 = isSelected ? "bg-surface-50 dark:bg-surface-900" : "";
9741
9753
  let t16;
@@ -9803,7 +9815,7 @@ const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
9803
9815
  }
9804
9816
  let t24;
9805
9817
  if ($[33] !== disabled || $[34] !== disabledTooltip || $[35] !== onHover) {
9806
- t24 = disabled && onHover && disabledTooltip && /* @__PURE__ */ jsx("div", { className: "absolute top-1 right-1 text-xs", children: /* @__PURE__ */ jsx(Tooltip, { title: disabledTooltip, children: /* @__PURE__ */ jsx(DoNotDisturbOnIcon, { size: "smallest", color: "disabled", className: "text-text-disabled" }) }) });
9818
+ t24 = disabled && onHover && disabledTooltip && /* @__PURE__ */ jsx("div", { className: "absolute top-1 right-1 text-xs", children: /* @__PURE__ */ jsx(Tooltip, { title: disabledTooltip, children: /* @__PURE__ */ jsx(DoNotDisturbOnIcon, { size: "smallest", color: "disabled", className: "text-surface-500" }) }) });
9807
9819
  $[33] = disabled;
9808
9820
  $[34] = disabledTooltip;
9809
9821
  $[35] = onHover;
@@ -10201,10 +10213,6 @@ function getEntityFromCache(path) {
10201
10213
  const entityString = localStorage.getItem(key);
10202
10214
  if (entityString) {
10203
10215
  const entity = JSON.parse(entityString, customReviver);
10204
- console.log("Loaded entity from localStorage:", {
10205
- key,
10206
- entity
10207
- });
10208
10216
  return entity;
10209
10217
  }
10210
10218
  } catch (error) {
@@ -10273,7 +10281,7 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
10273
10281
  const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;
10274
10282
  const hasDraft = enableLocalChangesBackup ? getEntityFromCache(fullPath + "/" + entity.id) : false;
10275
10283
  const iconSize = largeLayout && (size === "m" || size === "l" || size == "xl") ? "medium" : "small";
10276
- return /* @__PURE__ */ jsxs("div", { className: cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 bg-surface-50/90 dark:bg-opacity-90 dark:bg-surface-900/90 z-10", frozen ? "sticky left-0" : ""), onClick: useCallback((event) => {
10284
+ return /* @__PURE__ */ jsxs("div", { className: cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10", frozen ? "sticky left-0" : ""), onClick: useCallback((event) => {
10277
10285
  event.stopPropagation();
10278
10286
  }, []), style: {
10279
10287
  width,
@@ -10787,7 +10795,7 @@ const VirtualTableHeader = React__default.memo(function VirtualTableHeader2(t0)
10787
10795
  const t3 = column.frozen ? "sticky left-0 z-10" : "relative z-0";
10788
10796
  let t4;
10789
10797
  if ($[4] !== t3) {
10790
- t4 = cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-surface-50 dark:bg-surface-900", "text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark", "hover:bg-surface-100 dark:hover:bg-surface-800 hover:bg-opacity-50 hover:bg-surface-100/50 dark:hover:bg-opacity-50 dark:hover:bg-surface-800/50", t3);
10798
+ t4 = cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-surface-50 dark:bg-surface-900", "text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark", "hover:bg-surface-100 dark:hover:bg-surface-800 hover:bg-opacity-50 dark:hover:bg-opacity-50", t3);
10791
10799
  $[4] = t3;
10792
10800
  $[5] = t4;
10793
10801
  } else {
@@ -11223,7 +11231,7 @@ const VirtualTableRow = React__default.memo(function VirtualTableRow2(t0) {
11223
11231
  const onClick = t1;
11224
11232
  let t2;
11225
11233
  if ($[4] !== hoverRow || $[5] !== onRowClick || $[6] !== rowClassName || $[7] !== rowData) {
11226
- t2 = cls("flex min-w-full text-sm border-b border-surface-200 dark:border-surface-800 border-opacity-40 border-surface-200/40 dark:border-opacity-40 dark:border-surface-800/40", rowClassName ? rowClassName(rowData) : "", {
11234
+ t2 = cls("flex min-w-full text-sm border-b border-surface-200 dark:border-surface-800 border-opacity-40 dark:border-opacity-40", rowClassName ? rowClassName(rowData) : "", {
11227
11235
  "hover:bg-opacity-95": hoverRow,
11228
11236
  "cursor-pointer": onRowClick
11229
11237
  });
@@ -12254,7 +12262,7 @@ const SelectableTable = function SelectableTable2({
12254
12262
  selectedCell
12255
12263
  }), [setPopupCell, select, onValueChange, size, selectedCell]);
12256
12264
  return /* @__PURE__ */ jsx(SelectableTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full flex flex-col bg-white dark:bg-surface-950", ref, children: /* @__PURE__ */ jsx(VirtualTable, { data, columns, cellRenderer, onRowClick: inlineEditing ? void 0 : onEntityClick ? onRowClick : void 0, onEndReached: loadNextPage, onResetPagination: resetPagination, error: dataLoadingError, onColumnResize, rowHeight: getRowHeight(size), loading: dataLoading, filter: filterValues, onFilterUpdate: setFilterValues ? onFilterUpdate : void 0, sortBy, onSortByUpdate: setSortBy, hoverRow, initialScroll, onScroll, checkFilterCombination, createFilterField: filterable ? createFilterField : void 0, rowClassName: useCallback((entity) => {
12257
- return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 bg-surface-100/75 dark:bg-surface-800 dark:bg-opacity-75 dark:bg-surface-800/75" : "";
12265
+ return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
12258
12266
  }, [highlightedRow]), className: "flex-grow", emptyComponent, endAdornment, AddColumnComponent }) }) });
12259
12267
  };
12260
12268
  function createFilterField({
@@ -22052,7 +22060,7 @@ function ArrayContainerItem(t0) {
22052
22060
  storedProps,
22053
22061
  updateItemCustomProps
22054
22062
  } = t0;
22055
- const t1 = `relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20 dark\\:hover\\:bg-surface-800/20" : ""} rounded-md opacity-100`;
22063
+ const t1 = `relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20" : ""} rounded-md opacity-100`;
22056
22064
  let t2;
22057
22065
  if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
22058
22066
  t2 = (props) => updateItemCustomProps(internalId, props);
@@ -22375,7 +22383,7 @@ function ReferenceWidget({
22375
22383
  } else if (value?.isEntityReference && value?.isEntityReference()) {
22376
22384
  child = /* @__PURE__ */ jsx(ReferencePreview, { reference: value, onClick: onEntryClick, disabled, previewProperties, size, includeId, includeEntityLink });
22377
22385
  }
22378
- return /* @__PURE__ */ jsxs("div", { className: cls("text-sm font-medium", "min-w-80 flex flex-col gap-4", "relative transition-colors duration-200 ease-in rounded font-medium", disabled ? "bg-opacity-50" : "hover:bg-opacity-75", "text-opacity-50 text-text-primary/50 dark:text-white dark:text-opacity-50 dark:text-white/50", className), children: [
22386
+ return /* @__PURE__ */ jsxs("div", { className: cls("text-sm font-medium", "min-w-80 flex flex-col gap-4", "relative transition-colors duration-200 ease-in rounded font-medium", disabled ? "bg-opacity-50" : "hover:bg-opacity-75", "text-opacity-50 dark:text-white dark:text-opacity-50", className), children: [
22379
22387
  child,
22380
22388
  !value && /* @__PURE__ */ jsx("div", { className: "justify-center text-left", children: /* @__PURE__ */ jsxs(Button, { variant: "outlined", color: "primary", disabled, onClick: onEntryClick, children: [
22381
22389
  "Edit ",
@@ -23681,7 +23689,15 @@ function SideDialogView({
23681
23689
  pendingClose,
23682
23690
  setPendingClose
23683
23691
  }, children: [
23684
- /* @__PURE__ */ jsxs(Sheet, { open: Boolean(panel), onOpenChange: (open) => !open && onCloseRequest(), title: "Side dialog " + panel?.key, children: [
23692
+ /* @__PURE__ */ jsxs(Sheet, { open: Boolean(panel), onOpenChange: (open) => {
23693
+ if (!open) {
23694
+ const suggestionMenu = document.querySelector('[data-suggestion-menu="true"]');
23695
+ if (suggestionMenu && window.getComputedStyle(suggestionMenu).visibility !== "hidden") {
23696
+ return;
23697
+ }
23698
+ onCloseRequest();
23699
+ }
23700
+ }, title: "Side dialog " + panel?.key, children: [
23685
23701
  panel && /* @__PURE__ */ jsx("div", { className: "transform max-w-[100vw] lg:max-w-[95vw] flex flex-col h-full transition-all duration-250 ease-in-out bg-white dark:bg-surface-900 ", style: {
23686
23702
  width: panel.width,
23687
23703
  transform: `translateX(-${offsetPosition * 200}px)`
@@ -25029,7 +25045,7 @@ function useBuildDataSource({
25029
25045
  }, [delegate.initTextSearch])
25030
25046
  };
25031
25047
  }
25032
- const DEFAULT_SERVER = "https://api-drplyi3b6q-ey.a.run.app";
25048
+ const DEFAULT_SERVER = "https://api.firecms.co";
25033
25049
  async function makeRequest(authController, dataSourceKey, pluginKeys, apiKey) {
25034
25050
  let idToken;
25035
25051
  try {
@@ -25263,7 +25279,7 @@ function DrawerNavigationItem(t0) {
25263
25279
  const {
25264
25280
  isActive
25265
25281
  } = t52;
25266
- return cls("rounded-lg truncate", "hover:bg-surface-accent-300 hover:bg-opacity-75 hover:bg-surface-accent-300/75 dark:hover:bg-surface-accent-800 dark:hover:bg-opacity-75 dark:hover:bg-surface-accent-800/75 text-text-primary dark:text-surface-200 hover:text-surface-900 hover:dark:text-white hover:bg-surface-accent-300/75 dark:hover:bg-surface-accent-800/75", "flex flex-row items-center mr-8", drawerOpen ? "pl-4 h-10" : "pl-4 h-9", "font-semibold text-xs", isActive ? "bg-surface-accent-200 bg-opacity-60 dark:bg-surface-800 dark:bg-opacity-50 bg-surface-accent-200/60 dark:bg-surface-800/50" : "");
25282
+ return cls("rounded-lg truncate", "hover:bg-surface-accent-300 hover:bg-opacity-75 dark:hover:bg-surface-accent-800 dark:hover:bg-opacity-75 text-text-primary dark:text-surface-200 hover:text-surface-900 hover:dark:text-white", "flex flex-row items-center mr-8", drawerOpen ? "pl-4 h-10" : "pl-4 h-9", "font-semibold text-xs", isActive ? "bg-surface-accent-200 bg-opacity-60 dark:bg-surface-800 dark:bg-opacity-50" : "");
25267
25283
  };
25268
25284
  $[4] = drawerOpen;
25269
25285
  $[5] = t4;
@@ -25273,7 +25289,7 @@ function DrawerNavigationItem(t0) {
25273
25289
  const t5 = drawerOpen ? "opacity-100" : "opacity-0 hidden";
25274
25290
  let t6;
25275
25291
  if ($[6] !== t5) {
25276
- t6 = cls("text-text-primary dark:text-surface-200", t5, "ml-4 font-inherit");
25292
+ t6 = cls(t5, "ml-4 font-inherit text-inherit");
25277
25293
  $[6] = t5;
25278
25294
  $[7] = t6;
25279
25295
  } else {
@@ -25421,7 +25437,7 @@ function DefaultDrawer(t0) {
25421
25437
  }
25422
25438
  let t10;
25423
25439
  if ($[41] !== adminMenuOpen || $[42] !== buildGroupHeader || $[43] !== drawerOpen || $[44] !== navigationEntries || $[45] !== onClick || $[46] !== tooltipsOpen) {
25424
- t10 = (group_0) => /* @__PURE__ */ jsxs("div", { className: "bg-surface-50 dark:bg-surface-800 dark:bg-opacity-30 dark:bg-surface-800/30 bg-surface-50 dark:bg-surface-800/30 my-4 rounded-lg ml-3 mr-1", children: [
25440
+ t10 = (group_0) => /* @__PURE__ */ jsxs("div", { className: "bg-surface-50 dark:bg-surface-800 dark:bg-opacity-30 my-4 rounded-lg ml-3 mr-1", children: [
25425
25441
  buildGroupHeader(group_0),
25426
25442
  Object.values(navigationEntries).filter((e_0) => e_0.group === group_0).map((view_0) => /* @__PURE__ */ jsx(DrawerNavigationItem, { icon: /* @__PURE__ */ jsx(IconForView, { collectionOrView: view_0.collection ?? view_0.view, size: "small" }), tooltipsOpen, adminMenuOpen, drawerOpen, onClick: () => onClick(view_0), url: view_0.url, name: view_0.name }, view_0.id))
25427
25443
  ] }, `drawer_group_${group_0}`);
@@ -26929,7 +26945,7 @@ function DrawerWrapper(props) {
26929
26945
  }
26930
26946
  let t12;
26931
26947
  if ($[24] !== innerDrawer || $[25] !== props.open || $[26] !== props.setDrawerOpen) {
26932
- t12 = /* @__PURE__ */ jsx(Sheet, { side: "left", transparent: true, open: props.open, onOpenChange: props.setDrawerOpen, title: "Navigation drawer", overlayClassName: "bg-white bg-opacity-80 bg-white/80", children: innerDrawer });
26948
+ t12 = /* @__PURE__ */ jsx(Sheet, { side: "left", transparent: true, open: props.open, onOpenChange: props.setDrawerOpen, title: "Navigation drawer", overlayClassName: "bg-white bg-opacity-80", children: innerDrawer });
26933
26949
  $[24] = innerDrawer;
26934
26950
  $[25] = props.open;
26935
26951
  $[26] = props.setDrawerOpen;
@@ -27174,6 +27190,7 @@ export {
27174
27190
  navigateToEntity,
27175
27191
  pick,
27176
27192
  plural,
27193
+ prettifyIdentifier,
27177
27194
  printChanged,
27178
27195
  propertiesToColumns,
27179
27196
  randomColor,