@blinkk/root-cms 1.0.0-beta.55 → 1.0.0-beta.57

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.
Files changed (2) hide show
  1. package/dist/ui/ui.js +41 -34
  2. package/package.json +3 -3
package/dist/ui/ui.js CHANGED
@@ -38146,7 +38146,8 @@ ${this.customData.serverResponse}`;
38146
38146
  createdAt: df(),
38147
38147
  createdBy: window.firebase.user.email,
38148
38148
  modifiedAt: df(),
38149
- modifiedBy: window.firebase.user.email
38149
+ modifiedBy: window.firebase.user.email,
38150
+ locales: ["en"]
38150
38151
  },
38151
38152
  fields: options2?.fields ?? {}
38152
38153
  };
@@ -39181,7 +39182,6 @@ ${this.customData.serverResponse}`;
39181
39182
  localeSet.delete(locale);
39182
39183
  }
39183
39184
  }
39184
- localeSet.add("en");
39185
39185
  const newLocales = Array.from(localeSet.values()).sort();
39186
39186
  updateEnabledLocales(newLocales);
39187
39187
  }
@@ -39212,30 +39212,23 @@ ${this.customData.serverResponse}`;
39212
39212
  ] }),
39213
39213
  /* @__PURE__ */ o4(Stack, { spacing: 40, children: Object.keys(localeGroups).map((groupId) => {
39214
39214
  const group = localeGroups[groupId];
39215
- const enabledLocales2 = enabledLocalesFor(groupId);
39215
+ const groupEnabledLocales = enabledLocalesFor(groupId);
39216
39216
  return /* @__PURE__ */ o4(
39217
39217
  LocalizationModal.LocaleGroup,
39218
39218
  {
39219
39219
  group,
39220
- enabledLocales: enabledLocales2,
39220
+ groupEnabledLocales,
39221
+ allEnabledLocales: enabledLocales,
39221
39222
  onChange: (locales) => setGroupEnabledLocales(groupId, locales)
39222
39223
  }
39223
39224
  );
39224
39225
  }) })
39225
39226
  ] }) });
39226
39227
  };
39227
- function getLocaleLabel(locale) {
39228
- const langNames = new Intl.DisplayNames(["en"], {
39229
- type: "language"
39230
- });
39231
- const parts = locale.split("_");
39232
- const langCode = parts[0];
39233
- const langName = langNames.of(langCode) || locale;
39234
- return `${langName} (${locale})`;
39235
- }
39236
39228
  LocalizationModal.LocaleGroup = (props) => {
39237
- const enabledLocales = props.enabledLocales || [];
39229
+ const enabledLocales = props.groupEnabledLocales || [];
39238
39230
  const groupLocales = props.group.locales || [];
39231
+ const allEnabledLocales = props.allEnabledLocales || [];
39239
39232
  function setEnabledLocales(locales) {
39240
39233
  if (props.onChange) {
39241
39234
  props.onChange(locales);
@@ -39261,17 +39254,21 @@ ${this.customData.serverResponse}`;
39261
39254
  }
39262
39255
  )
39263
39256
  ] }),
39264
- /* @__PURE__ */ o4(Group, { children: groupLocales.map((locale) => /* @__PURE__ */ o4(
39265
- Checkbox,
39266
- {
39267
- value: locale,
39268
- checked: enabledLocales.includes(locale) || locale === "en",
39269
- disabled: locale === "en",
39270
- label: getLocaleLabel(locale),
39271
- onChange: () => toggleLocale(locale),
39272
- size: "xs"
39273
- }
39274
- )) })
39257
+ /* @__PURE__ */ o4(Group, { children: groupLocales.map((locale) => {
39258
+ const checked = enabledLocales.includes(locale);
39259
+ const disabled = allEnabledLocales.length <= 1 && checked;
39260
+ return /* @__PURE__ */ o4(
39261
+ Checkbox,
39262
+ {
39263
+ value: locale,
39264
+ checked,
39265
+ disabled,
39266
+ label: getLocaleLabel(locale),
39267
+ onChange: () => toggleLocale(locale),
39268
+ size: "xs"
39269
+ }
39270
+ );
39271
+ }) })
39275
39272
  ] });
39276
39273
  };
39277
39274
  LocalizationModal.AllNoneButtons = (props) => {
@@ -39632,6 +39629,15 @@ ${this.customData.serverResponse}`;
39632
39629
  }
39633
39630
  );
39634
39631
  }
39632
+ function getLocaleLabel(locale) {
39633
+ const langNames = new Intl.DisplayNames(["en"], {
39634
+ type: "language"
39635
+ });
39636
+ const parts = locale.split("_");
39637
+ const langCode = parts[0];
39638
+ const langName = langNames.of(langCode) || locale;
39639
+ return `${langName} (${locale})`;
39640
+ }
39635
39641
 
39636
39642
  // ui/components/PublishDocModal/PublishDocModal.tsx
39637
39643
  var MODAL_ID4 = "PublishDocModal";
@@ -39853,7 +39859,7 @@ ${this.customData.serverResponse}`;
39853
39859
  // package.json
39854
39860
  var package_default = {
39855
39861
  name: "@blinkk/root-cms",
39856
- version: "1.0.0-beta.55",
39862
+ version: "1.0.0-beta.57",
39857
39863
  author: "s@blinkk.com",
39858
39864
  license: "MIT",
39859
39865
  engines: {
@@ -39956,7 +39962,7 @@ ${this.customData.serverResponse}`;
39956
39962
  vitest: "^0.18.1"
39957
39963
  },
39958
39964
  peerDependencies: {
39959
- "@blinkk/root": "1.0.0-beta.55",
39965
+ "@blinkk/root": "1.0.0-beta.57",
39960
39966
  "firebase-admin": ">=11",
39961
39967
  "firebase-functions": ">=4",
39962
39968
  preact: "10.x",
@@ -40096,13 +40102,14 @@ ${this.customData.serverResponse}`;
40096
40102
  const notificationId = `revert-draft-${docId}`;
40097
40103
  const modalId = modals.openConfirmModal({
40098
40104
  ...modalTheme,
40099
- title: `Revert draft ${docId}`,
40105
+ title: `Discard draft edits for ${docId}`,
40100
40106
  children: /* @__PURE__ */ o4(Text2, { size: "body-sm", weight: "semi-bold", children: [
40101
- "Are you sure you want to revert draft changes for ",
40107
+ "Are you sure you want to discard draft changes for",
40108
+ " ",
40102
40109
  /* @__PURE__ */ o4("code", { children: docId }),
40103
40110
  "? The doc data will revert to the published version. There is no undo."
40104
40111
  ] }),
40105
- labels: { confirm: "Revert draft", cancel: "Cancel" },
40112
+ labels: { confirm: "Discard draft edits", cancel: "Cancel" },
40106
40113
  cancelProps: { size: "xs" },
40107
40114
  confirmProps: { color: "red", size: "xs" },
40108
40115
  onCancel: () => console.log("Cancel"),
@@ -40111,15 +40118,15 @@ ${this.customData.serverResponse}`;
40111
40118
  showNotification({
40112
40119
  id: notificationId,
40113
40120
  title: "Unpublishing doc",
40114
- message: `Requesting revert draft of ${docId}...`,
40121
+ message: `Discarding draft edits of ${docId}...`,
40115
40122
  loading: true,
40116
40123
  autoClose: false
40117
40124
  });
40118
40125
  await cmsRevertDraft(docId);
40119
40126
  updateNotification({
40120
40127
  id: notificationId,
40121
- title: "Reverted draft!",
40122
- message: `Successfully reverted ${docId}!`,
40128
+ title: "Discarded draft edited",
40129
+ message: `Successfully reverted ${docId} back to its published version`,
40123
40130
  loading: false,
40124
40131
  autoClose: 5e3
40125
40132
  });
@@ -40273,7 +40280,7 @@ ${this.customData.serverResponse}`;
40273
40280
  {
40274
40281
  icon: /* @__PURE__ */ o4(IconArrowBack, { size: 20 }),
40275
40282
  onClick: () => onRevertDraft(),
40276
- children: "Revert draft"
40283
+ children: "Discard draft edits"
40277
40284
  }
40278
40285
  ),
40279
40286
  sys.firstPublishedAt && /* @__PURE__ */ o4(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkk/root-cms",
3
- "version": "1.0.0-beta.55",
3
+ "version": "1.0.0-beta.57",
4
4
  "author": "s@blinkk.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -56,7 +56,7 @@
56
56
  "//": "NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",
57
57
  "devDependencies": {
58
58
  "@babel/core": "^7.17.9",
59
- "@blinkk/root": "1.0.0-beta.55",
59
+ "@blinkk/root": "1.0.0-beta.57",
60
60
  "@emotion/react": "^11.10.5",
61
61
  "@firebase/app-compat": "^0.1.33",
62
62
  "@firebase/app-types": "^0.7.0",
@@ -90,7 +90,7 @@
90
90
  "vitest": "^0.18.1"
91
91
  },
92
92
  "peerDependencies": {
93
- "@blinkk/root": "1.0.0-beta.55",
93
+ "@blinkk/root": "1.0.0-beta.57",
94
94
  "firebase-admin": ">=11",
95
95
  "firebase-functions": ">=4",
96
96
  "preact": "10.x",