@preprio/toolkit 0.5.0-rc.6 → 0.5.0-rc.8

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
@@ -737,12 +737,13 @@ There are three ways to get them there. Pick the first that fits your setup.
737
737
 
738
738
  #### Option 1: GraphQL Codegen (recommended)
739
739
 
740
- Add the `preprIds` document transform to your Codegen output. `_id` and
741
- `__typename` are added wherever your schema has them: on models and
742
- components, and inside each member of a dynamic content field. Collections
743
- like `Pages` and unions themselves never get an `_id`, so the queries stay
744
- valid. Your `.graphql` files stay as they are; the generated documents and
745
- types include the fields, at no runtime cost.
740
+ Add the `preprIds` document transform to your Codegen output. `_id` is
741
+ added wherever your schema has one: on models and components, and inside
742
+ each member of a dynamic content field. Collections like `Pages` and unions
743
+ themselves never get an `_id`, so the queries stay valid. Your `.graphql`
744
+ files stay as they are; the generated documents and types include the field,
745
+ at no runtime cost. Adding a field never breaks code that compiles today, so
746
+ this is safe to turn on in an existing project.
746
747
 
747
748
  ```ts
748
749
  // codegen.ts
@@ -766,6 +767,13 @@ export default config;
766
767
  Run Codegen again after adding it. Needs `graphql` 16 or later, which a
767
768
  Codegen setup already has.
768
769
 
770
+ To add `__typename` everywhere too, use `createPreprIds({ typename: true })`
771
+ instead. It is off by default because a selected `__typename` changes the
772
+ generated types: each member of a union is typed on its own, so code that
773
+ reads a union's fields without checking `__typename` first stops compiling.
774
+ Live preview only needs it on dynamic content entries, where you select it
775
+ already to render them.
776
+
769
777
  #### Option 2: at runtime, without Codegen
770
778
 
771
779
  `addPreprIds(document, schema)` does the same to a parsed query. It needs
@@ -31,7 +31,7 @@ __export(astro_exports, {
31
31
  module.exports = __toCommonJS(astro_exports);
32
32
 
33
33
  // src/version.ts
34
- var VERSION = "0.5.0-rc.6";
34
+ var VERSION = "0.5.0-rc.8";
35
35
 
36
36
  // src/core/features.ts
37
37
  function isEnabled(config) {
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.5.0-rc.6";
2
+ var VERSION = "0.5.0-rc.8";
3
3
 
4
4
  // src/core/features.ts
5
5
  function isEnabled(config) {
@@ -2,7 +2,7 @@ import {
2
2
  ALL_FEATURES_ENABLED,
3
3
  VERSION,
4
4
  resolveFeatures
5
- } from "./chunk-WHZNCYUS.js";
5
+ } from "./chunk-Y4NMRYHE.js";
6
6
  import {
7
7
  createIframeBridge,
8
8
  isLocale,
@@ -659,7 +659,7 @@ var StegaElements = class {
659
659
  };
660
660
 
661
661
  // src/core/stega/stega.generated.ts
662
- var STEGA_STYLES = '@property --prepr-presence{syntax:"<number>";inherits:true;initial-value:1}[data-prepr-encoded]{outline:1px dashed rgba(79,70,229,calc(.3 * var(--prepr-presence,1)));outline-offset:2px}';
662
+ var STEGA_STYLES = '@property --prepr-presence{syntax:"<number>";inherits:true;initial-value:1}[data-prepr-encoded]{outline:1px dashed rgb(79 70 229/calc(.3 * var(--prepr-presence,1)));outline-offset:2px}';
663
663
 
664
664
  // src/core/stega/styles.ts
665
665
  var STEGA_STYLE_MARKER = "data-prepr-stega";
@@ -1052,7 +1052,7 @@ function createToolbarStore(initial = {}) {
1052
1052
  return { get, set, subscribe };
1053
1053
  }
1054
1054
 
1055
- // ../../node_modules/.pnpm/preact@10.29.7/node_modules/preact/dist/preact.mjs
1055
+ // ../../node_modules/.pnpm/preact@10.29.8/node_modules/preact/dist/preact.mjs
1056
1056
  var n;
1057
1057
  var l;
1058
1058
  var u;
@@ -1123,8 +1123,8 @@ function H() {
1123
1123
  }
1124
1124
  }
1125
1125
  function L(n2, l2, u3, t3, i2, r2, o2, e2, f3, c2, a2) {
1126
- var s2, h2, p2, v2, y2, _2, g2, m2 = t3 && t3.__k || w, b2 = l2.length;
1127
- for (f3 = T(u3, l2, m2, f3, b2), s2 = 0; s2 < b2; s2++) null != (p2 = u3.__k[s2]) && (h2 = -1 != p2.__i && m2[p2.__i] || d, p2.__i = s2, _2 = q(n2, p2, h2, i2, r2, o2, e2, f3, c2, a2), v2 = p2.__e, p2.ref && h2.ref != p2.ref && (h2.ref && J(h2.ref, null, p2), a2.push(p2.ref, p2.__c || v2, p2)), null == y2 && null != v2 && (y2 = v2), (g2 = !!(4 & p2.__u)) || h2.__k === p2.__k ? (f3 = j(p2, f3, n2, g2), g2 && h2.__e && (h2.__e = null)) : "function" == typeof p2.type && void 0 !== _2 ? f3 = _2 : v2 && (f3 = v2.nextSibling), p2.__u &= -7);
1126
+ var s2, h2, p2, v2, y2, _2, g2 = t3 && t3.__k || w, m2 = l2.length;
1127
+ for (f3 = T(u3, l2, g2, f3, m2), s2 = 0; s2 < m2; s2++) null != (p2 = u3.__k[s2]) && (h2 = -1 != p2.__i && g2[p2.__i] || d, p2.__i = s2, _2 = q(n2, p2, h2, i2, r2, o2, e2, f3, c2, a2), v2 = p2.__e, p2.ref && h2.ref != p2.ref && (h2.ref && J(h2.ref, null, p2), a2.push(p2.ref, p2.__c || v2, p2)), null == y2 && null != v2 && (y2 = v2), 4 & p2.__u ? (f3 = j(p2, f3, n2), h2.__e && (h2.__e = null)) : "function" == typeof p2.type && void 0 !== _2 ? f3 = _2 : v2 && (f3 = v2.nextSibling), p2.__u &= -7);
1128
1128
  return u3.__e = y2, f3;
1129
1129
  }
1130
1130
  function T(n2, l2, u3, t3, i2) {
@@ -1133,13 +1133,13 @@ function T(n2, l2, u3, t3, i2) {
1133
1133
  if (s2) for (r2 = 0; r2 < a2; r2++) null != (e2 = u3[r2]) && 0 == (2 & e2.__u) && (e2.__e == t3 && (t3 = $(e2)), K(e2, e2));
1134
1134
  return t3;
1135
1135
  }
1136
- function j(n2, l2, u3, t3) {
1137
- var i2, r2;
1136
+ function j(n2, l2, u3) {
1137
+ var t3, i2;
1138
1138
  if ("function" == typeof n2.type) {
1139
- for (i2 = n2.__k, r2 = 0; i2 && r2 < i2.length; r2++) i2[r2] && (i2[r2].__ = n2, l2 = j(i2[r2], l2, u3, t3));
1139
+ for (t3 = n2.__k, i2 = 0; t3 && i2 < t3.length; i2++) t3[i2] && (t3[i2].__ = n2, l2 = j(t3[i2], l2, u3));
1140
1140
  return l2;
1141
1141
  }
1142
- n2.__e != l2 && (t3 && (l2 && n2.type && !l2.parentNode && (l2 = $(n2)), u3.insertBefore(n2.__e, l2 || null)), l2 = n2.__e);
1142
+ n2.__e != l2 && (l2 && n2.type && !l2.parentNode && (l2 = $(n2)), l2 = u3.insertBefore(n2.__e, l2 || null));
1143
1143
  do {
1144
1144
  l2 = l2 && l2.nextSibling;
1145
1145
  } while (null != l2 && 8 == l2.nodeType);
@@ -1185,35 +1185,35 @@ function V(n2) {
1185
1185
  };
1186
1186
  }
1187
1187
  function q(n2, u3, t3, i2, r2, o2, e2, f3, c2, a2) {
1188
- var s2, h2, p2, v2, y2, d2, _2, k2, x2, M, $2, I2, P2, A2, H2, T2, j2 = u3.type;
1188
+ var s2, h2, p2, v2, y2, d2, _2, k2, x2, M, I2, P2, A2, H2, T2, j2, F = u3.type;
1189
1189
  if (void 0 !== u3.constructor) return null;
1190
1190
  128 & t3.__u && (c2 = !!(32 & t3.__u), o2 = [f3 = u3.__e = t3.__e]), (s2 = l.__b) && s2(u3);
1191
- n: if ("function" == typeof j2) {
1191
+ n: if ("function" == typeof F) {
1192
1192
  h2 = e2.length;
1193
1193
  try {
1194
- if (x2 = u3.props, M = j2.prototype && j2.prototype.render, $2 = (s2 = j2.contextType) && i2[s2.__c], I2 = s2 ? $2 ? $2.props.value : s2.__ : i2, t3.__c ? k2 = (p2 = u3.__c = t3.__c).__ = p2.__E : (M ? u3.__c = p2 = new j2(x2, I2) : (u3.__c = p2 = new C(x2, I2), p2.constructor = j2, p2.render = Q), $2 && $2.sub(p2), p2.state || (p2.state = {}), p2.__n = i2, v2 = p2.__d = true, p2.__h = [], p2._sb = []), M && null == p2.__s && (p2.__s = p2.state), M && null != j2.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = m({}, p2.__s)), m(p2.__s, j2.getDerivedStateFromProps(x2, p2.__s))), y2 = p2.props, d2 = p2.state, p2.__v = u3, v2) M && null == j2.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), M && null != p2.componentDidMount && p2.__h.push(p2.componentDidMount);
1194
+ if (x2 = u3.props, M = F.prototype && F.prototype.render, I2 = (s2 = F.contextType) && i2[s2.__c], P2 = s2 ? I2 ? I2.props.value : s2.__ : i2, t3.__c ? k2 = (p2 = u3.__c = t3.__c).__ = p2.__E : (M ? u3.__c = p2 = new F(x2, P2) : (u3.__c = p2 = new C(x2, P2), p2.constructor = F, p2.render = Q), I2 && I2.sub(p2), p2.state || (p2.state = {}), p2.__n = i2, v2 = p2.__d = true, p2.__h = [], p2._sb = []), M && null == p2.__s && (p2.__s = p2.state), M && null != F.getDerivedStateFromProps && (p2.__s == p2.state && (p2.__s = m({}, p2.__s)), m(p2.__s, F.getDerivedStateFromProps(x2, p2.__s))), y2 = p2.props, d2 = p2.state, p2.__v = u3, v2) M && null == F.getDerivedStateFromProps && null != p2.componentWillMount && p2.componentWillMount(), M && null != p2.componentDidMount && p2.__h.push(p2.componentDidMount);
1195
1195
  else {
1196
- if (M && null == j2.getDerivedStateFromProps && x2 !== y2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(x2, I2), u3.__v == t3.__v || !p2.__e && null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(x2, p2.__s, I2)) {
1196
+ if (M && null == F.getDerivedStateFromProps && x2 !== y2 && null != p2.componentWillReceiveProps && p2.componentWillReceiveProps(x2, P2), u3.__v == t3.__v || !p2.__e && null != p2.shouldComponentUpdate && false === p2.shouldComponentUpdate(x2, p2.__s, P2)) {
1197
1197
  u3.__v != t3.__v && (p2.props = x2, p2.state = p2.__s, p2.__d = false), u3.__e = t3.__e, u3.__k = t3.__k, u3.__k.some(function(n3) {
1198
1198
  n3 && (n3.__ = u3);
1199
- }), w.push.apply(p2.__h, p2._sb), p2._sb = [], p2.__h.length && e2.push(p2);
1199
+ }), w.push.apply(p2.__h, p2._sb), p2._sb = [], p2.__h.length && e2.push(p2), f3 = $(t3);
1200
1200
  break n;
1201
1201
  }
1202
- null != p2.componentWillUpdate && p2.componentWillUpdate(x2, p2.__s, I2), M && null != p2.componentDidUpdate && p2.__h.push(function() {
1202
+ null != p2.componentWillUpdate && p2.componentWillUpdate(x2, p2.__s, P2), M && null != p2.componentDidUpdate && p2.__h.push(function() {
1203
1203
  p2.componentDidUpdate(y2, d2, _2);
1204
1204
  });
1205
1205
  }
1206
- if (p2.context = I2, p2.props = x2, p2.__P = n2, p2.__e = false, P2 = l.__r, A2 = 0, M) p2.state = p2.__s, p2.__d = false, P2 && P2(u3), s2 = p2.render(p2.props, p2.state, p2.context), w.push.apply(p2.__h, p2._sb), p2._sb = [];
1206
+ if (p2.context = P2, p2.props = x2, p2.__P = n2, p2.__e = false, A2 = l.__r, H2 = 0, M) p2.state = p2.__s, p2.__d = false, A2 && A2(u3), s2 = p2.render(p2.props, p2.state, p2.context), w.push.apply(p2.__h, p2._sb), p2._sb = [];
1207
1207
  else do {
1208
- p2.__d = false, P2 && P2(u3), s2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s;
1209
- } while (p2.__d && ++A2 < 25);
1210
- p2.state = p2.__s, null != p2.getChildContext && (i2 = m(m({}, i2), p2.getChildContext())), M && !v2 && null != p2.getSnapshotBeforeUpdate && (_2 = p2.getSnapshotBeforeUpdate(y2, d2)), H2 = null != s2 && s2.type === S && null == s2.key ? E(s2.props.children) : s2, f3 = L(n2, g(H2) ? H2 : [H2], u3, t3, i2, r2, o2, e2, f3, c2, a2), p2.base = u3.__e, u3.__u &= -161, p2.__h.length && e2.push(p2), k2 && (p2.__E = p2.__ = null);
1208
+ p2.__d = false, A2 && A2(u3), s2 = p2.render(p2.props, p2.state, p2.context), p2.state = p2.__s;
1209
+ } while (p2.__d && ++H2 < 25);
1210
+ p2.state = p2.__s, null != p2.getChildContext && (i2 = m(m({}, i2), p2.getChildContext())), M && !v2 && null != p2.getSnapshotBeforeUpdate && (_2 = p2.getSnapshotBeforeUpdate(y2, d2)), T2 = null != s2 && s2.type === S && null == s2.key ? E(s2.props.children) : s2, f3 = L(n2, g(T2) ? T2 : [T2], u3, t3, i2, r2, o2, e2, f3, c2, a2), p2.base = u3.__e, u3.__u &= -161, p2.__h.length && e2.push(p2), k2 && (p2.__E = p2.__ = null);
1211
1211
  } catch (n3) {
1212
1212
  if (e2.length = h2, u3.__v = null, c2 || null != o2) {
1213
1213
  if (n3.then) {
1214
1214
  for (u3.__u |= c2 ? 160 : 128; f3 && 8 == f3.nodeType && f3.nextSibling; ) f3 = f3.nextSibling;
1215
1215
  null != o2 && (o2[o2.indexOf(f3)] = null), u3.__e = f3;
1216
- } else if (null != o2) for (T2 = o2.length; T2--; ) b(o2[T2]);
1216
+ } else if (null != o2) for (j2 = o2.length; j2--; ) b(o2[j2]);
1217
1217
  } else u3.__e = t3.__e;
1218
1218
  null == u3.__k && (u3.__k = t3.__k || []), n3.then || B(u3), l.__e(n3, u3, t3);
1219
1219
  }
@@ -1334,9 +1334,9 @@ var CLOSE_ICON_SVG = `<svg width="10" height="10" viewBox="0 0 10 10" fill="none
1334
1334
  </svg>`;
1335
1335
 
1336
1336
  // src/core/ui/toolbar.generated.ts
1337
- var TOOLBAR_CSS = ":host{--prepr-primary:#4338ca;--prepr-bg:#eef2ff;--prepr-text:#1f2937;--prepr-radius:8px;--prepr-shadow:0px 0px 40px 0px #1f29373d;--prepr-z-index:10000;--prepr-primary-50:#eef2ff;--prepr-primary-100:#e0e7ff;--prepr-primary-800:#3730a3;--prepr-indigo-600:#4f46e5;--prepr-indigo-50:#eef2ff;--prepr-indigo-700:#4338ca;--prepr-secondary-400:#fb923c;--prepr-secondary-500:#f97316;--prepr-gray-100:#f3f4f6;--prepr-gray-200:#e5e7eb;--prepr-gray-300:#d1d5db;--prepr-gray-400:#9ca3af;--prepr-gray-500:#6b7280;--prepr-gray-700:#374151;--prepr-gray-800:#1f2937;--prepr-gray-900:#111827;--prepr-shadow-sm:0px 0px 12px 0px #c3c3c3cc;color:var(--prepr-text);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.5}:host *,:host :before,:host :after,*,:before,:after{box-sizing:border-box}button{font-family:inherit;font-size:inherit;margin:0}.prepr-regular-text{font-size:.875rem;font-weight:500;line-height:1.5}.prepr-backdrop{z-index:calc(var(--prepr-z-index) - 1);opacity:0;pointer-events:none;background:#0000001a;transition:opacity .2s ease-in-out;position:fixed;top:0;bottom:0;left:0;right:0}.prepr-backdrop[data-open=true]{opacity:1;pointer-events:auto;animation:.2s ease-in-out prepr-fade-in}.prepr-container{z-index:var(--prepr-z-index);justify-content:flex-end;align-items:center;display:flex;position:fixed;top:calc(50% - 64px);right:0}.prepr-toggle-holder{padding:.5rem}.prepr-toggle{cursor:pointer;background:var(--prepr-primary);color:#fff;border:none;border-radius:9999px;justify-content:center;align-items:center;width:2.25rem;height:2.25rem;display:flex}.prepr-toggle>span{display:flex}.prepr-toggle svg{color:#fff}.prepr-panel{z-index:var(--prepr-z-index);opacity:0;pointer-events:none;justify-content:flex-end;padding:.75rem;transition:opacity .2s ease-in-out;display:flex;position:fixed;top:50%;right:0;transform:translateY(-50%)}.prepr-panel[data-open=true]{opacity:1;pointer-events:auto;animation:.2s ease-in-out prepr-fade-in}.prepr-content{box-shadow:var(--prepr-shadow);border-radius:var(--prepr-radius);background:var(--prepr-bg);flex-direction:column;gap:2.5rem;width:100%;padding:1.5rem;display:flex}@media (min-width:640px){.prepr-panel{margin-right:4rem;padding:0}.prepr-content{width:502px;padding:2.5rem}}.prepr-header{justify-content:space-between;align-items:center;gap:.5rem;display:flex}.prepr-header-left{align-items:flex-start;gap:.75rem;display:flex}.prepr-badge{background:var(--prepr-primary-100);height:1.5rem;color:var(--prepr-primary);border-radius:4px;align-items:center;padding:.25rem .75rem;font-size:.875rem;display:flex}.prepr-header-close{cursor:pointer;background:var(--prepr-primary-100);width:2rem;height:2rem;color:var(--prepr-gray-700);border:none;border-radius:6px;justify-content:center;align-items:center;display:flex}.prepr-section{flex-direction:column;gap:.5rem;display:flex}.prepr-section-label{color:var(--prepr-gray-400);font-size:.875rem}.prepr-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.5rem 1.5rem;display:flex}.prepr-row-title{color:var(--prepr-gray-800);margin:0;font-size:1rem;font-weight:600}.prepr-radiogroup{border-radius:var(--prepr-radius);border:1px solid var(--prepr-gray-300);background:#fff;align-items:center;gap:.25rem;height:2.5rem;padding:.25rem;display:flex}.prepr-radiogroup[data-disabled=true]{cursor:not-allowed;opacity:.5}.prepr-radiogroup[data-disabled=true] .prepr-radio{pointer-events:none}.prepr-radio{cursor:pointer;white-space:nowrap;text-align:center;height:2rem;color:var(--prepr-gray-900);background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:.5rem 1.125rem;font-size:.875rem;font-weight:500;transition:all .2s ease-in-out;display:flex}.prepr-radio[data-checked=true]{background:var(--prepr-indigo-600);color:#fff;box-shadow:var(--prepr-shadow-sm)}.prepr-radio[data-checked=true][data-off=true]{background:var(--prepr-gray-800);color:#fff}.prepr-radio-variant{width:82px}.prepr-listbox{position:relative}.prepr-segment-button{border-radius:var(--prepr-radius);border:1px solid var(--prepr-gray-300);width:240px;height:2.5rem;color:var(--prepr-gray-500);cursor:pointer;background:#fff;flex-shrink:0;align-items:center;gap:.5rem;padding:0 .5rem;font-size:.875rem;font-weight:500;display:flex;overflow:hidden}@media (min-width:768px){.prepr-segment-button{padding:0 1rem}}.prepr-segment-button:disabled{cursor:not-allowed;background:var(--prepr-gray-200);color:var(--prepr-gray-400)}.prepr-segment-button[aria-expanded=true]{border-bottom-color:#fff;border-bottom-right-radius:0;border-bottom-left-radius:0}.prepr-segment-label{white-space:nowrap;text-overflow:ellipsis;text-align:left;width:100%;margin-right:auto;overflow:hidden}.prepr-segment-caret{color:var(--prepr-gray-800);display:flex}.prepr-options{z-index:calc(var(--prepr-z-index) + 1);border-left:1px solid var(--prepr-gray-300);border-right:1px solid var(--prepr-gray-300);border-bottom:1px solid var(--prepr-gray-300);-ms-overflow-style:none;scrollbar-width:none;background:#fff;border-radius:0 0 6px 6px;width:240px;max-height:300px;margin:0;padding:0;list-style:none;position:absolute;top:100%;left:0;overflow-y:auto;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.prepr-options::-webkit-scrollbar{display:none}.prepr-options[hidden]{display:none}.prepr-option-search{background:#fff;padding:.5rem;position:-webkit-sticky;position:sticky;top:0}.prepr-segment-search{border:1px solid var(--prepr-gray-300);border-radius:var(--prepr-radius);width:100%;height:2rem;font:inherit;color:var(--prepr-gray-900);box-sizing:border-box;background:#fff;padding:0 .5rem;font-size:.875rem}@media (pointer:coarse){.prepr-segment-search{font-size:16px}}.prepr-segment-search::placeholder{color:var(--prepr-gray-400)}.prepr-segment-search:focus{border-color:var(--prepr-gray-400);outline:none}.prepr-option{cursor:pointer;width:100%;color:var(--prepr-gray-900);background:#fff;align-items:center;padding:.5rem 1rem;font-size:.875rem;font-weight:500;display:flex}.prepr-option:hover{background:var(--prepr-gray-100)}.prepr-option[aria-selected=true]{background:var(--prepr-indigo-50);color:var(--prepr-indigo-700)}.prepr-option-label{white-space:nowrap;text-overflow:ellipsis;text-align:left;width:100%;margin-right:auto;overflow:hidden}.prepr-reset{background:var(--prepr-secondary-400);color:#fff;cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;gap:.5rem;width:100%;height:2.5rem;padding:.5rem .75rem;font-size:.875rem;font-weight:500;display:flex}.prepr-reset:hover:not(:disabled){background:var(--prepr-secondary-500)}.prepr-reset:disabled{background:var(--prepr-gray-400);color:var(--prepr-gray-500);cursor:not-allowed}@media (min-width:768px){.prepr-reset{width:108px}}.prepr-indicators{z-index:var(--prepr-z-index);gap:.75rem;display:flex;position:fixed;bottom:1.5rem;right:1.5rem}.prepr-status-pill{background:var(--prepr-primary);color:#fff;cursor:pointer;border:none;border-radius:9999px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.prepr-status-pill[data-interactive=false]{cursor:default;opacity:1;color:#fff}.prepr-status-pill[data-interactive=true]:hover{background:var(--prepr-primary-800)}.prepr-status-pill[hidden]{display:none}.prepr-status-viewing{color:#fff9;font-size:10px}.prepr-status-segment{text-overflow:ellipsis;white-space:nowrap;max-width:120px;display:inline-block;overflow:hidden}.prepr-status-variant{text-overflow:ellipsis;white-space:nowrap;background:#fff3;border-radius:4px;max-width:80px;padding:0 .5rem;display:inline-block;overflow:hidden}.prepr-status-x{color:#fff;width:.75rem;height:.75rem}.prepr-close-edit-pill{background:var(--prepr-primary-50);color:var(--prepr-gray-800);cursor:pointer;border:none;border-radius:9999px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.prepr-close-edit-pill:hover{background:var(--prepr-primary-100)}.prepr-close-edit-pill[hidden]{display:none}.prepr-close-edit-x{width:1rem;height:1rem;color:var(--prepr-gray-500);transition:color .15s}.prepr-close-edit-pill:hover .prepr-close-edit-x{color:var(--prepr-gray-700)}.prepr-tip{z-index:calc(var(--prepr-z-index) + 2);overflow-wrap:break-word;background:var(--prepr-gray-900);color:#fff;pointer-events:none;border-radius:6px;width:auto;max-width:min(420px,100vw - 16px);padding:.5rem .75rem;font-size:.75rem;font-weight:500;position:fixed;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.prepr-tip-arrow{border-left:6px solid #0000;border-right:6px solid #0000;border-top:6px solid var(--prepr-gray-900);width:0;height:0;position:absolute;top:100%;transform:translate(-50%)}[hidden]{display:none!important}@keyframes prepr-fade-in{0%{opacity:0}to{opacity:1}}";
1337
+ var TOOLBAR_CSS = ":host{--prepr-primary:#4338ca;--prepr-bg:#eef2ff;--prepr-text:#1f2937;--prepr-radius:8px;--prepr-shadow:0px 0px 40px 0px #1f29373d;--prepr-z-index:10000;--prepr-primary-50:#eef2ff;--prepr-primary-100:#e0e7ff;--prepr-primary-800:#3730a3;--prepr-indigo-600:#4f46e5;--prepr-indigo-50:#eef2ff;--prepr-indigo-700:#4338ca;--prepr-secondary-400:#fb923c;--prepr-secondary-500:#f97316;--prepr-gray-100:#f3f4f6;--prepr-gray-200:#e5e7eb;--prepr-gray-300:#d1d5db;--prepr-gray-400:#9ca3af;--prepr-gray-500:#6b7280;--prepr-gray-700:#374151;--prepr-gray-800:#1f2937;--prepr-gray-900:#111827;--prepr-shadow-sm:0px 0px 12px 0px #c3c3c3cc;color:var(--prepr-text);box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.5}:host *,:host :before,:host :after,*,:before,:after{box-sizing:border-box}button{font-family:inherit;font-size:inherit;margin:0}.prepr-regular-text{font-size:.875rem;font-weight:500;line-height:1.5}.prepr-backdrop{z-index:calc(var(--prepr-z-index) - 1);opacity:0;pointer-events:none;background:#0000001a;transition:opacity .2s ease-in-out;position:fixed;top:0;bottom:0;left:0;right:0}.prepr-backdrop[data-open=true]{opacity:1;pointer-events:auto;animation:.2s ease-in-out prepr-fade-in}.prepr-container{z-index:var(--prepr-z-index);justify-content:flex-end;align-items:center;display:flex;position:fixed;top:calc(50% - 64px);right:0}.prepr-toggle-holder{padding:.5rem}.prepr-toggle{cursor:pointer;background:var(--prepr-primary);color:#fff;border:none;border-radius:9999px;justify-content:center;align-items:center;width:2.25rem;height:2.25rem;display:flex}.prepr-toggle>span{display:flex}.prepr-toggle svg{color:#fff}.prepr-panel{z-index:var(--prepr-z-index);opacity:0;pointer-events:none;justify-content:flex-end;padding:.75rem;transition:opacity .2s ease-in-out;display:flex;position:fixed;top:50%;right:0;transform:translateY(-50%)}.prepr-panel[data-open=true]{opacity:1;pointer-events:auto;animation:.2s ease-in-out prepr-fade-in}.prepr-content{box-shadow:var(--prepr-shadow);border-radius:var(--prepr-radius);background:var(--prepr-bg);flex-direction:column;gap:2.5rem;width:100%;padding:1.5rem;display:flex}@media (min-width:640px){.prepr-panel{margin-right:4rem;padding:0}.prepr-content{width:502px;padding:2.5rem}}.prepr-header{justify-content:space-between;align-items:center;gap:.5rem;display:flex}.prepr-header-left{align-items:flex-start;gap:.75rem;display:flex}.prepr-badge{background:var(--prepr-primary-100);height:1.5rem;color:var(--prepr-primary);border-radius:4px;align-items:center;padding:.25rem .75rem;font-size:.875rem;display:flex}.prepr-header-close{cursor:pointer;background:var(--prepr-primary-100);width:2rem;height:2rem;color:var(--prepr-gray-700);border:none;border-radius:6px;justify-content:center;align-items:center;display:flex}.prepr-section{flex-direction:column;gap:.5rem;display:flex}.prepr-section-label{color:var(--prepr-gray-400);font-size:.875rem}.prepr-row{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.5rem 1.5rem;display:flex}.prepr-row-title{color:var(--prepr-gray-800);margin:0;font-size:1rem;font-weight:600}.prepr-radiogroup{border-radius:var(--prepr-radius);border:1px solid var(--prepr-gray-300);background:#fff;align-items:center;gap:.25rem;height:2.5rem;padding:.25rem;display:flex}.prepr-radiogroup[data-disabled=true]{cursor:not-allowed;opacity:.5}.prepr-radiogroup[data-disabled=true] .prepr-radio{pointer-events:none}.prepr-radio{cursor:pointer;white-space:nowrap;text-align:center;height:2rem;color:var(--prepr-gray-900);background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;padding:.5rem 1.125rem;font-size:.875rem;font-weight:500;transition:all .2s ease-in-out;display:flex}.prepr-radio[data-checked=true]{background:var(--prepr-indigo-600);color:#fff;box-shadow:var(--prepr-shadow-sm)}.prepr-radio[data-checked=true][data-off=true]{background:var(--prepr-gray-800);color:#fff}.prepr-radio-variant{width:82px}.prepr-listbox{position:relative}.prepr-segment-button{border-radius:var(--prepr-radius);border:1px solid var(--prepr-gray-300);width:240px;height:2.5rem;color:var(--prepr-gray-500);cursor:pointer;background:#fff;flex-shrink:0;align-items:center;gap:.5rem;padding:0 .5rem;font-size:.875rem;font-weight:500;display:flex;overflow:hidden}@media (min-width:768px){.prepr-segment-button{padding:0 1rem}}.prepr-segment-button:disabled{cursor:not-allowed;background:var(--prepr-gray-200);color:var(--prepr-gray-400)}.prepr-segment-button[aria-expanded=true]{border-bottom-color:#fff;border-bottom-right-radius:0;border-bottom-left-radius:0}.prepr-segment-label{white-space:nowrap;text-overflow:ellipsis;text-align:left;width:100%;margin-right:auto;overflow:hidden}.prepr-segment-caret{color:var(--prepr-gray-800);display:flex}.prepr-options{z-index:calc(var(--prepr-z-index) + 1);border-left:1px solid var(--prepr-gray-300);border-right:1px solid var(--prepr-gray-300);border-bottom:1px solid var(--prepr-gray-300);-ms-overflow-style:none;scrollbar-width:none;background:#fff;border-radius:0 0 6px 6px;width:240px;max-height:300px;margin:0;padding:0;list-style:none;position:absolute;top:100%;left:0;overflow-y:auto;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.prepr-options::-webkit-scrollbar{display:none}.prepr-options[hidden]{display:none}.prepr-option-search{background:#fff;padding:.5rem;position:sticky;top:0}.prepr-segment-search{border:1px solid var(--prepr-gray-300);border-radius:var(--prepr-radius);width:100%;height:2rem;font:inherit;color:var(--prepr-gray-900);box-sizing:border-box;background:#fff;padding:0 .5rem;font-size:.875rem}@media (pointer:coarse){.prepr-segment-search{font-size:16px}}.prepr-segment-search::placeholder{color:var(--prepr-gray-400)}.prepr-segment-search:focus{border-color:var(--prepr-gray-400);outline:none}.prepr-option{cursor:pointer;width:100%;color:var(--prepr-gray-900);background:#fff;align-items:center;padding:.5rem 1rem;font-size:.875rem;font-weight:500;display:flex}.prepr-option:hover{background:var(--prepr-gray-100)}.prepr-option[aria-selected=true]{background:var(--prepr-indigo-50);color:var(--prepr-indigo-700)}.prepr-option-label{white-space:nowrap;text-overflow:ellipsis;text-align:left;width:100%;margin-right:auto;overflow:hidden}.prepr-reset{background:var(--prepr-secondary-400);color:#fff;cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;gap:.5rem;width:100%;height:2.5rem;padding:.5rem .75rem;font-size:.875rem;font-weight:500;display:flex}.prepr-reset:hover:not(:disabled){background:var(--prepr-secondary-500)}.prepr-reset:disabled{background:var(--prepr-gray-400);color:var(--prepr-gray-500);cursor:not-allowed}@media (min-width:768px){.prepr-reset{width:108px}}.prepr-indicators{z-index:var(--prepr-z-index);gap:.75rem;display:flex;position:fixed;bottom:1.5rem;right:1.5rem}.prepr-status-pill{background:var(--prepr-primary);color:#fff;cursor:pointer;border:none;border-radius:9999px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.prepr-status-pill[data-interactive=false]{cursor:default;opacity:1;color:#fff}.prepr-status-pill[data-interactive=true]:hover{background:var(--prepr-primary-800)}.prepr-status-pill[hidden]{display:none}.prepr-status-viewing{color:#fff9;font-size:10px}.prepr-status-segment{text-overflow:ellipsis;white-space:nowrap;max-width:120px;display:inline-block;overflow:hidden}.prepr-status-variant{text-overflow:ellipsis;white-space:nowrap;background:#fff3;border-radius:4px;max-width:80px;padding:0 .5rem;display:inline-block;overflow:hidden}.prepr-status-x{color:#fff;width:.75rem;height:.75rem}.prepr-close-edit-pill{background:var(--prepr-primary-50);color:var(--prepr-gray-800);cursor:pointer;border:none;border-radius:9999px;align-items:center;gap:.5rem;padding:.5rem 1rem;font-size:.75rem;font-weight:500;transition:background-color .15s;display:flex;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a}.prepr-close-edit-pill:hover{background:var(--prepr-primary-100)}.prepr-close-edit-pill[hidden]{display:none}.prepr-close-edit-x{width:1rem;height:1rem;color:var(--prepr-gray-500);transition:color .15s}.prepr-close-edit-pill:hover .prepr-close-edit-x{color:var(--prepr-gray-700)}.prepr-tip{z-index:calc(var(--prepr-z-index) + 2);overflow-wrap:break-word;background:var(--prepr-gray-900);color:#fff;pointer-events:none;border-radius:6px;width:auto;max-width:min(420px,100vw - 16px);padding:.5rem .75rem;font-size:.75rem;font-weight:500;position:fixed;box-shadow:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a}.prepr-tip-arrow{border-left:6px solid #0000;border-right:6px solid #0000;border-top:6px solid var(--prepr-gray-900);width:0;height:0;position:absolute;top:100%;transform:translate(-50%)}[hidden]{display:none!important}@keyframes prepr-fade-in{0%{opacity:0}to{opacity:1}}";
1338
1338
 
1339
- // ../../node_modules/.pnpm/preact@10.29.7/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
1339
+ // ../../node_modules/.pnpm/preact@10.29.8/node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
1340
1340
  var f2 = 0;
1341
1341
  function u2(e2, t3, n2, o2, i2, u3) {
1342
1342
  t3 || (t3 = {});
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  VERSION,
3
3
  resolveFeatures
4
- } from "./chunk-WHZNCYUS.js";
4
+ } from "./chunk-Y4NMRYHE.js";
5
5
 
6
6
  // src/core/server.ts
7
7
  var PreprError = class extends Error {
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "0.5.0-rc.6";
2
+ var VERSION = "0.5.0-rc.8";
3
3
 
4
4
  // src/core/features.ts
5
5
  function isEnabled(config) {
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var codegen_exports = {};
22
22
  __export(codegen_exports, {
23
23
  addPreprIds: () => addPreprIds,
24
+ createPreprIds: () => createPreprIds,
24
25
  preprIds: () => preprIds
25
26
  });
26
27
  module.exports = __toCommonJS(codegen_exports);
@@ -33,7 +34,8 @@ function hasResponseKey(set, key) {
33
34
  (s) => s.kind === import_graphql.Kind.FIELD && (s.alias ?? s.name).value === key
34
35
  );
35
36
  }
36
- function addPreprIds(document, schema) {
37
+ function addPreprIds(document, schema, options = {}) {
38
+ const typename = options.typename ?? false;
37
39
  const roots = new Set(
38
40
  [
39
41
  schema.getQueryType(),
@@ -52,7 +54,7 @@ function addPreprIds(document, schema) {
52
54
  if (((0, import_graphql.isObjectType)(type) || (0, import_graphql.isInterfaceType)(type)) && "_id" in type.getFields() && !hasResponseKey(node, "_id")) {
53
55
  added.push(field("_id"));
54
56
  }
55
- if (!hasResponseKey(node, "__typename")) {
57
+ if (typename && !hasResponseKey(node, "__typename")) {
56
58
  added.push(field("__typename"));
57
59
  }
58
60
  if (!added.length) return;
@@ -61,19 +63,20 @@ function addPreprIds(document, schema) {
61
63
  })
62
64
  );
63
65
  }
64
- var preprIds = {
65
- transform({
66
- documents,
67
- schema
68
- }) {
69
- const built = (0, import_graphql.buildASTSchema)(schema, { assumeValidSDL: true });
70
- return documents.map(
71
- (file) => file.document ? { ...file, document: addPreprIds(file.document, built) } : file
72
- );
73
- }
74
- };
66
+ function createPreprIds(options = {}) {
67
+ return {
68
+ transform({ documents, schema }) {
69
+ const built = (0, import_graphql.buildASTSchema)(schema, { assumeValidSDL: true });
70
+ return documents.map(
71
+ (file) => file.document ? { ...file, document: addPreprIds(file.document, built, options) } : file
72
+ );
73
+ }
74
+ };
75
+ }
76
+ var preprIds = createPreprIds();
75
77
  // Annotate the CommonJS export names for ESM import in node:
76
78
  0 && (module.exports = {
77
79
  addPreprIds,
80
+ createPreprIds,
78
81
  preprIds
79
82
  });
@@ -6,23 +6,50 @@ import { DocumentNode, GraphQLSchema } from 'graphql';
6
6
  */
7
7
  interface CodegenDocumentFile {
8
8
  document?: DocumentNode;
9
- [key: string]: unknown;
9
+ }
10
+ interface PreprIdsOptions {
11
+ /**
12
+ * Also select `__typename` on every object, interface and union below the
13
+ * root. Default `false`: a selected `__typename` changes the types Codegen
14
+ * generates (each union member is typed separately, and objects built by
15
+ * hand must carry one), which can break code that compiles today. Live
16
+ * preview only needs it on dynamic content entries, where you select it
17
+ * already to render them.
18
+ */
19
+ typename?: boolean;
10
20
  }
11
21
  /**
12
- * Select `_id` and `__typename` on every level of a query that has them, so
13
- * live preview and click-to-edit can find each item without you selecting
14
- * them by hand.
22
+ * Select `_id` on every level of a query that has one, so live preview and
23
+ * click-to-edit can find each item without you selecting it by hand.
15
24
  *
16
- * The schema decides where they go: `_id` only on types that have one
17
- * (models and components, not collections like `Pages` or unions), and
18
- * `__typename` on every object, interface and union below the root.
19
- * Fields already selected are left as they are.
25
+ * The schema decides where it goes: only on types that have an `_id`
26
+ * (models and components, not collections like `Pages` or unions; inside a
27
+ * union, on each member). Adding a field never breaks the types Codegen
28
+ * generates. With `typename: true`, `__typename` is added on every object,
29
+ * interface and union below the root too. Fields already selected are left
30
+ * as they are.
20
31
  */
21
- declare function addPreprIds(document: DocumentNode, schema: GraphQLSchema): DocumentNode;
32
+ declare function addPreprIds(document: DocumentNode, schema: GraphQLSchema, options?: PreprIdsOptions): DocumentNode;
33
+ /** A GraphQL Codegen document transform. */
34
+ interface CodegenDocumentTransform {
35
+ transform<File extends CodegenDocumentFile>(options: {
36
+ documents: File[];
37
+ schema: DocumentNode;
38
+ }): File[];
39
+ }
22
40
  /**
23
41
  * GraphQL Codegen document transform that runs `addPreprIds` on every
24
- * document, so the generated documents and types include `_id` and
25
- * `__typename` wherever the schema has them:
42
+ * document, with options:
43
+ *
44
+ * ```ts
45
+ * documentTransforms: [createPreprIds({ typename: true })],
46
+ * ```
47
+ */
48
+ declare function createPreprIds(options?: PreprIdsOptions): CodegenDocumentTransform;
49
+ /**
50
+ * GraphQL Codegen document transform that runs `addPreprIds` on every
51
+ * document, so the generated documents and types include `_id` wherever the
52
+ * schema has one:
26
53
  *
27
54
  * ```ts
28
55
  * // codegen.ts
@@ -35,12 +62,9 @@ declare function addPreprIds(document: DocumentNode, schema: GraphQLSchema): Doc
35
62
  * },
36
63
  * },
37
64
  * ```
65
+ *
66
+ * `createPreprIds({ typename: true })` adds `__typename` as well.
38
67
  */
39
- declare const preprIds: {
40
- transform({ documents, schema, }: {
41
- documents: CodegenDocumentFile[];
42
- schema: DocumentNode;
43
- }): CodegenDocumentFile[];
44
- };
68
+ declare const preprIds: CodegenDocumentTransform;
45
69
 
46
- export { type CodegenDocumentFile, addPreprIds, preprIds };
70
+ export { type CodegenDocumentFile, type CodegenDocumentTransform, type PreprIdsOptions, addPreprIds, createPreprIds, preprIds };
@@ -6,23 +6,50 @@ import { DocumentNode, GraphQLSchema } from 'graphql';
6
6
  */
7
7
  interface CodegenDocumentFile {
8
8
  document?: DocumentNode;
9
- [key: string]: unknown;
9
+ }
10
+ interface PreprIdsOptions {
11
+ /**
12
+ * Also select `__typename` on every object, interface and union below the
13
+ * root. Default `false`: a selected `__typename` changes the types Codegen
14
+ * generates (each union member is typed separately, and objects built by
15
+ * hand must carry one), which can break code that compiles today. Live
16
+ * preview only needs it on dynamic content entries, where you select it
17
+ * already to render them.
18
+ */
19
+ typename?: boolean;
10
20
  }
11
21
  /**
12
- * Select `_id` and `__typename` on every level of a query that has them, so
13
- * live preview and click-to-edit can find each item without you selecting
14
- * them by hand.
22
+ * Select `_id` on every level of a query that has one, so live preview and
23
+ * click-to-edit can find each item without you selecting it by hand.
15
24
  *
16
- * The schema decides where they go: `_id` only on types that have one
17
- * (models and components, not collections like `Pages` or unions), and
18
- * `__typename` on every object, interface and union below the root.
19
- * Fields already selected are left as they are.
25
+ * The schema decides where it goes: only on types that have an `_id`
26
+ * (models and components, not collections like `Pages` or unions; inside a
27
+ * union, on each member). Adding a field never breaks the types Codegen
28
+ * generates. With `typename: true`, `__typename` is added on every object,
29
+ * interface and union below the root too. Fields already selected are left
30
+ * as they are.
20
31
  */
21
- declare function addPreprIds(document: DocumentNode, schema: GraphQLSchema): DocumentNode;
32
+ declare function addPreprIds(document: DocumentNode, schema: GraphQLSchema, options?: PreprIdsOptions): DocumentNode;
33
+ /** A GraphQL Codegen document transform. */
34
+ interface CodegenDocumentTransform {
35
+ transform<File extends CodegenDocumentFile>(options: {
36
+ documents: File[];
37
+ schema: DocumentNode;
38
+ }): File[];
39
+ }
22
40
  /**
23
41
  * GraphQL Codegen document transform that runs `addPreprIds` on every
24
- * document, so the generated documents and types include `_id` and
25
- * `__typename` wherever the schema has them:
42
+ * document, with options:
43
+ *
44
+ * ```ts
45
+ * documentTransforms: [createPreprIds({ typename: true })],
46
+ * ```
47
+ */
48
+ declare function createPreprIds(options?: PreprIdsOptions): CodegenDocumentTransform;
49
+ /**
50
+ * GraphQL Codegen document transform that runs `addPreprIds` on every
51
+ * document, so the generated documents and types include `_id` wherever the
52
+ * schema has one:
26
53
  *
27
54
  * ```ts
28
55
  * // codegen.ts
@@ -35,12 +62,9 @@ declare function addPreprIds(document: DocumentNode, schema: GraphQLSchema): Doc
35
62
  * },
36
63
  * },
37
64
  * ```
65
+ *
66
+ * `createPreprIds({ typename: true })` adds `__typename` as well.
38
67
  */
39
- declare const preprIds: {
40
- transform({ documents, schema, }: {
41
- documents: CodegenDocumentFile[];
42
- schema: DocumentNode;
43
- }): CodegenDocumentFile[];
44
- };
68
+ declare const preprIds: CodegenDocumentTransform;
45
69
 
46
- export { type CodegenDocumentFile, addPreprIds, preprIds };
70
+ export { type CodegenDocumentFile, type CodegenDocumentTransform, type PreprIdsOptions, addPreprIds, createPreprIds, preprIds };
@@ -17,7 +17,8 @@ function hasResponseKey(set, key) {
17
17
  (s) => s.kind === Kind.FIELD && (s.alias ?? s.name).value === key
18
18
  );
19
19
  }
20
- function addPreprIds(document, schema) {
20
+ function addPreprIds(document, schema, options = {}) {
21
+ const typename = options.typename ?? false;
21
22
  const roots = new Set(
22
23
  [
23
24
  schema.getQueryType(),
@@ -36,7 +37,7 @@ function addPreprIds(document, schema) {
36
37
  if ((isObjectType(type) || isInterfaceType(type)) && "_id" in type.getFields() && !hasResponseKey(node, "_id")) {
37
38
  added.push(field("_id"));
38
39
  }
39
- if (!hasResponseKey(node, "__typename")) {
40
+ if (typename && !hasResponseKey(node, "__typename")) {
40
41
  added.push(field("__typename"));
41
42
  }
42
43
  if (!added.length) return;
@@ -45,18 +46,19 @@ function addPreprIds(document, schema) {
45
46
  })
46
47
  );
47
48
  }
48
- var preprIds = {
49
- transform({
50
- documents,
51
- schema
52
- }) {
53
- const built = buildASTSchema(schema, { assumeValidSDL: true });
54
- return documents.map(
55
- (file) => file.document ? { ...file, document: addPreprIds(file.document, built) } : file
56
- );
57
- }
58
- };
49
+ function createPreprIds(options = {}) {
50
+ return {
51
+ transform({ documents, schema }) {
52
+ const built = buildASTSchema(schema, { assumeValidSDL: true });
53
+ return documents.map(
54
+ (file) => file.document ? { ...file, document: addPreprIds(file.document, built, options) } : file
55
+ );
56
+ }
57
+ };
58
+ }
59
+ var preprIds = createPreprIds();
59
60
  export {
60
61
  addPreprIds,
62
+ createPreprIds,
61
63
  preprIds
62
64
  };