@spiffcommerce/theme-bridge 1.10.6 → 1.10.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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { DesignCreationMessage, SpiffCommerceClient } from '@spiffcommerce/core';
2
- import { OutputPlugin } from 'rollup';
2
+ import { Plugin } from 'vite';
3
3
 
4
4
  interface ThemeConfigurationFile {
5
5
  /**
@@ -298,6 +298,27 @@ type SpiffDevOptions = Omit<ThemeContextTransaction, "container"> | Omit<ThemeCo
298
298
  declare function setSpiffDevOptions(container: HTMLElement | string, context: SpiffDevOptions): void;
299
299
  declare function exampleThemeInstallConfig(opts?: Partial<ThemeInstallConfigurationResource>): ThemeInstallConfigurationResource;
300
300
 
301
- declare function spiffThemePlugin(configSchema?: ThemeConfigurationSchema): OutputPlugin;
301
+ interface PluginOptions {
302
+ /**
303
+ * When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.
304
+ * @default true
305
+ */
306
+ autoGenerateTargetFiles?: boolean;
307
+ /**
308
+ * A configuration schema to allow installs to customize your theme.
309
+ * @default undefined
310
+ */
311
+ configurationSchema?: ThemeConfigurationSchema;
312
+ /**
313
+ * Manually add/override specific files.
314
+ * @default undefined
315
+ */
316
+ targetFiles?: ThemeConfigurationLaunchDataTargetFile[];
317
+ }
318
+ /**
319
+ * Automatically generates a `spiffTheme.json` file in your output directory.
320
+ * @param opts Options to customize the generated file.
321
+ */
322
+ declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
302
323
 
303
324
  export { type AssetResource, AssetType, type BundleDesignCreationMessage, type DesignCreationMessageWithQuantity, FieldType, type SpiffDevOptions, type SpiffThemeLoader, type ThemeConfigurationFile, type ThemeConfigurationLaunchData, type ThemeConfigurationLaunchDataTargetFile, type ThemeConfigurationSchema, type ThemeConfigurationSchemaField, type ThemeConfigurationSchemaFieldResource, type ThemeConfigurationSchemaResource, type ThemeContext, type ThemeContextBundle, type ThemeContextBundleOptions, type ThemeContextBundleOptionsExisting, type ThemeContextBundleOptionsNew, type ThemeContextTransaction, type ThemeContextWorkflowOptions, type ThemeContextWorkflowOptionsExternalProduct, type ThemeContextWorkflowOptionsIntegrationProduct, type ThemeContextWorkflowOptionsTransaction, ThemeFileType, type ThemeInstallConfigurationField, type ThemeInstallConfigurationResource, type ThemeLaunchDataResource, type ThemeLaunchDataTargetFileResource, type ThemeResource, type ThemeVersionResource, exampleThemeInstallConfig, setSpiffDevOptions, spiffThemePlugin };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ var Se = (e, _, t) => _ in e ? Ce(e, _, { enumerable: !0, configurable: !0, writ
4
4
  var B = (e, _, t) => (Se(e, typeof _ != "symbol" ? _ + "" : _, t), t);
5
5
  import we from "fs";
6
6
  import Ee from "path";
7
- var O = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(O || {}), He = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.Number = "Number", e.Select = "Select", e.Text = "Text", e))(He || {}), $e = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))($e || {}), A, f, ae, S, Y, fe, Z, H = {}, pe = [], Pe = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
7
+ var O = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(O || {}), He = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.Number = "Number", e.Select = "Select", e.Text = "Text", e))(He || {}), $e = /* @__PURE__ */ ((e) => (e.Color = "Color", e.ColorProfile = "ColorProfile", e.Data = "Data", e.Environment = "Environment", e.Font = "Font", e.Frame = "Frame", e.Illustration = "Illustration", e.Image = "Image", e.Material = "Material", e.Model = "Model", e.Video = "Video", e))($e || {}), A, f, ue, S, X, fe, Z, H = {}, pe = [], Pe = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
8
8
  function C(e, _) {
9
9
  for (var t in _)
10
10
  e[t] = _[t];
@@ -15,16 +15,16 @@ function de(e) {
15
15
  _ && _.removeChild(e);
16
16
  }
17
17
  function De(e, _, t) {
18
- var n, o, i, c = {};
18
+ var n, o, i, a = {};
19
19
  for (i in _)
20
- i == "key" ? n = _[i] : i == "ref" ? o = _[i] : c[i] = _[i];
21
- if (arguments.length > 2 && (c.children = arguments.length > 3 ? A.call(arguments, 2) : t), typeof e == "function" && e.defaultProps != null)
20
+ i == "key" ? n = _[i] : i == "ref" ? o = _[i] : a[i] = _[i];
21
+ if (arguments.length > 2 && (a.children = arguments.length > 3 ? A.call(arguments, 2) : t), typeof e == "function" && e.defaultProps != null)
22
22
  for (i in e.defaultProps)
23
- c[i] === void 0 && (c[i] = e.defaultProps[i]);
24
- return T(e, c, n, o, null);
23
+ a[i] === void 0 && (a[i] = e.defaultProps[i]);
24
+ return T(e, a, n, o, null);
25
25
  }
26
26
  function T(e, _, t, n, o) {
27
- var i = { type: e, props: _, key: t, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++ae, __i: -1, __u: 0 };
27
+ var i = { type: e, props: _, key: t, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: o ?? ++ue, __i: -1, __u: 0 };
28
28
  return o == null && f.vnode != null && f.vnode(i), i;
29
29
  }
30
30
  function F(e) {
@@ -53,24 +53,24 @@ function he(e) {
53
53
  }
54
54
  }
55
55
  function ee(e) {
56
- (!e.__d && (e.__d = !0) && S.push(e) && !L.__r++ || Y !== f.debounceRendering) && ((Y = f.debounceRendering) || fe)(L);
56
+ (!e.__d && (e.__d = !0) && S.push(e) && !L.__r++ || X !== f.debounceRendering) && ((X = f.debounceRendering) || fe)(L);
57
57
  }
58
58
  function L() {
59
- var e, _, t, n, o, i, c, l, u;
59
+ var e, _, t, n, o, i, a, l, c;
60
60
  for (S.sort(Z); e = S.shift(); )
61
- e.__d && (_ = S.length, n = void 0, i = (o = (t = e).__v).__e, l = [], u = [], (c = t.__P) && ((n = C({}, o)).__v = o.__v + 1, f.vnode && f.vnode(n), K(c, n, o, t.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? w(o), !!(32 & o.__u), u), n.__.__k[n.__i] = n, ge(l, n, u), n.__e != i && he(n)), S.length > _ && S.sort(Z));
61
+ e.__d && (_ = S.length, n = void 0, i = (o = (t = e).__v).__e, l = [], c = [], (a = t.__P) && ((n = C({}, o)).__v = o.__v + 1, f.vnode && f.vnode(n), Y(a, n, o, t.__n, a.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, l, i ?? w(o), !!(32 & o.__u), c), n.__.__k[n.__i] = n, ge(l, n, c), n.__e != i && he(n)), S.length > _ && S.sort(Z));
62
62
  L.__r = 0;
63
63
  }
64
- function ve(e, _, t, n, o, i, c, l, u, s, p) {
65
- var r, d, a, m, k, g = n && n.__k || pe, h = _.length;
66
- for (t.__d = u, Ne(t, _, g), u = t.__d, r = 0; r < h; r++)
67
- (a = t.__k[r]) != null && typeof a != "boolean" && typeof a != "function" && (d = a.__i === -1 ? H : g[a.__i] || H, a.__i = r, K(e, a, d, o, i, c, l, u, s, p), m = a.__e, a.ref && d.ref != a.ref && (d.ref && Q(d.ref, null, a), p.push(a.ref, a.__c || m, a)), k == null && m != null && (k = m), 65536 & a.__u || d.__k === a.__k ? u = me(a, u, e) : typeof a.type == "function" && a.__d !== void 0 ? u = a.__d : m && (u = m.nextSibling), a.__d = void 0, a.__u &= -196609);
68
- t.__d = u, t.__e = k;
64
+ function ve(e, _, t, n, o, i, a, l, c, s, p) {
65
+ var r, d, u, m, k, g = n && n.__k || pe, h = _.length;
66
+ for (t.__d = c, Ne(t, _, g), c = t.__d, r = 0; r < h; r++)
67
+ (u = t.__k[r]) != null && typeof u != "boolean" && typeof u != "function" && (d = u.__i === -1 ? H : g[u.__i] || H, u.__i = r, Y(e, u, d, o, i, a, l, c, s, p), m = u.__e, u.ref && d.ref != u.ref && (d.ref && K(d.ref, null, u), p.push(u.ref, u.__c || m, u)), k == null && m != null && (k = m), 65536 & u.__u || d.__k === u.__k ? c = me(u, c, e) : typeof u.type == "function" && u.__d !== void 0 ? c = u.__d : m && (c = m.nextSibling), u.__d = void 0, u.__u &= -196609);
68
+ t.__d = c, t.__e = k;
69
69
  }
70
70
  function Ne(e, _, t) {
71
- var n, o, i, c, l, u = _.length, s = t.length, p = s, r = 0;
72
- for (e.__k = [], n = 0; n < u; n++)
73
- (o = e.__k[n] = (o = _[n]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? T(null, o, null, null, o) : G(o) ? T(F, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? T(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, l = Te(o, t, c = n + r, p), o.__i = l, i = null, l !== -1 && (p--, (i = t[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : l !== c && (l === c + 1 ? r++ : l > c ? p > u - c ? r += l - c : r-- : r = l < c && l == c - 1 ? l - c : 0, l !== n + r && (o.__u |= 65536))) : (i = t[n]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = w(i)), z(i, i, !1), t[n] = null, p--);
71
+ var n, o, i, a, l, c = _.length, s = t.length, p = s, r = 0;
72
+ for (e.__k = [], n = 0; n < c; n++)
73
+ (o = e.__k[n] = (o = _[n]) == null || typeof o == "boolean" || typeof o == "function" ? null : typeof o == "string" || typeof o == "number" || typeof o == "bigint" || o.constructor == String ? T(null, o, null, null, o) : G(o) ? T(F, { children: o }, null, null, null) : o.constructor === void 0 && o.__b > 0 ? T(o.type, o.props, o.key, o.ref ? o.ref : null, o.__v) : o) != null ? (o.__ = e, o.__b = e.__b + 1, l = Te(o, t, a = n + r, p), o.__i = l, i = null, l !== -1 && (p--, (i = t[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : l !== a && (l === a + 1 ? r++ : l > a ? p > c - a ? r += l - a : r-- : r = l < a && l == a - 1 ? l - a : 0, l !== n + r && (o.__u |= 65536))) : (i = t[n]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = w(i)), z(i, i, !1), t[n] = null, p--);
74
74
  if (p)
75
75
  for (n = 0; n < s; n++)
76
76
  (i = t[n]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = w(i)), z(i, i));
@@ -85,18 +85,18 @@ function me(e, _, t) {
85
85
  return e.__e != _ && (t.insertBefore(e.__e, _ || null), _ = e.__e), _ && _.nextSibling;
86
86
  }
87
87
  function Te(e, _, t, n) {
88
- var o = e.key, i = e.type, c = t - 1, l = t + 1, u = _[t];
89
- if (u === null || u && o == u.key && i === u.type)
88
+ var o = e.key, i = e.type, a = t - 1, l = t + 1, c = _[t];
89
+ if (c === null || c && o == c.key && i === c.type)
90
90
  return t;
91
- if (n > (u != null && !(131072 & u.__u) ? 1 : 0))
92
- for (; c >= 0 || l < _.length; ) {
93
- if (c >= 0) {
94
- if ((u = _[c]) && !(131072 & u.__u) && o == u.key && i === u.type)
95
- return c;
96
- c--;
91
+ if (n > (c != null && !(131072 & c.__u) ? 1 : 0))
92
+ for (; a >= 0 || l < _.length; ) {
93
+ if (a >= 0) {
94
+ if ((c = _[a]) && !(131072 & c.__u) && o == c.key && i === c.type)
95
+ return a;
96
+ a--;
97
97
  }
98
98
  if (l < _.length) {
99
- if ((u = _[l]) && !(131072 & u.__u) && o == u.key && i === u.type)
99
+ if ((c = _[l]) && !(131072 & c.__u) && o == c.key && i === c.type)
100
100
  return l;
101
101
  l++;
102
102
  }
@@ -146,49 +146,49 @@ function te(e) {
146
146
  function ne(e) {
147
147
  return this.l[e.type + !0](f.event ? f.event(e) : e);
148
148
  }
149
- function K(e, _, t, n, o, i, c, l, u, s) {
150
- var p, r, d, a, m, k, g, h, y, x, $, E, X, P, V, b = _.type;
149
+ function Y(e, _, t, n, o, i, a, l, c, s) {
150
+ var p, r, d, u, m, k, g, h, y, x, $, E, Q, P, V, b = _.type;
151
151
  if (_.constructor !== void 0)
152
152
  return null;
153
- 128 & t.__u && (u = !!(32 & t.__u), i = [l = _.__e = t.__e]), (p = f.__b) && p(_);
153
+ 128 & t.__u && (c = !!(32 & t.__u), i = [l = _.__e = t.__e]), (p = f.__b) && p(_);
154
154
  e:
155
155
  if (typeof b == "function")
156
156
  try {
157
- if (h = _.props, y = (p = b.contextType) && n[p.__c], x = p ? y ? y.props.value : p.__ : n, t.__c ? g = (r = _.__c = t.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? _.__c = r = new b(h, x) : (_.__c = r = new I(h, x), r.constructor = b, r.render = je), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = x, r.__n = n, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = C({}, r.__s)), C(r.__s, b.getDerivedStateFromProps(h, r.__s))), a = r.props, m = r.state, r.__v = _, d)
157
+ if (h = _.props, y = (p = b.contextType) && n[p.__c], x = p ? y ? y.props.value : p.__ : n, t.__c ? g = (r = _.__c = t.__c).__ = r.__E : ("prototype" in b && b.prototype.render ? _.__c = r = new b(h, x) : (_.__c = r = new I(h, x), r.constructor = b, r.render = Ue), y && y.sub(r), r.props = h, r.state || (r.state = {}), r.context = x, r.__n = n, d = r.__d = !0, r.__h = [], r._sb = []), r.__s == null && (r.__s = r.state), b.getDerivedStateFromProps != null && (r.__s == r.state && (r.__s = C({}, r.__s)), C(r.__s, b.getDerivedStateFromProps(h, r.__s))), u = r.props, m = r.state, r.__v = _, d)
158
158
  b.getDerivedStateFromProps == null && r.componentWillMount != null && r.componentWillMount(), r.componentDidMount != null && r.__h.push(r.componentDidMount);
159
159
  else {
160
- if (b.getDerivedStateFromProps == null && h !== a && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, x), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, x) === !1 || _.__v === t.__v)) {
160
+ if (b.getDerivedStateFromProps == null && h !== u && r.componentWillReceiveProps != null && r.componentWillReceiveProps(h, x), !r.__e && (r.shouldComponentUpdate != null && r.shouldComponentUpdate(h, r.__s, x) === !1 || _.__v === t.__v)) {
161
161
  for (_.__v !== t.__v && (r.props = h, r.state = r.__s, r.__d = !1), _.__e = t.__e, _.__k = t.__k, _.__k.forEach(function(D) {
162
162
  D && (D.__ = _);
163
163
  }), $ = 0; $ < r._sb.length; $++)
164
164
  r.__h.push(r._sb[$]);
165
- r._sb = [], r.__h.length && c.push(r);
165
+ r._sb = [], r.__h.length && a.push(r);
166
166
  break e;
167
167
  }
168
168
  r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, x), r.componentDidUpdate != null && r.__h.push(function() {
169
- r.componentDidUpdate(a, m, k);
169
+ r.componentDidUpdate(u, m, k);
170
170
  });
171
171
  }
172
- if (r.context = x, r.props = h, r.__P = e, r.__e = !1, E = f.__r, X = 0, "prototype" in b && b.prototype.render) {
172
+ if (r.context = x, r.props = h, r.__P = e, r.__e = !1, E = f.__r, Q = 0, "prototype" in b && b.prototype.render) {
173
173
  for (r.state = r.__s, r.__d = !1, E && E(_), p = r.render(r.props, r.state, r.context), P = 0; P < r._sb.length; P++)
174
174
  r.__h.push(r._sb[P]);
175
175
  r._sb = [];
176
176
  } else
177
177
  do
178
178
  r.__d = !1, E && E(_), p = r.render(r.props, r.state, r.context), r.state = r.__s;
179
- while (r.__d && ++X < 25);
180
- r.state = r.__s, r.getChildContext != null && (n = C(C({}, n), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(a, m)), ve(e, G(V = p != null && p.type === F && p.key == null ? p.props.children : p) ? V : [V], _, t, n, o, i, c, l, u, s), r.base = _.__e, _.__u &= -161, r.__h.length && c.push(r), g && (r.__E = r.__ = null);
179
+ while (r.__d && ++Q < 25);
180
+ r.state = r.__s, r.getChildContext != null && (n = C(C({}, n), r.getChildContext())), d || r.getSnapshotBeforeUpdate == null || (k = r.getSnapshotBeforeUpdate(u, m)), ve(e, G(V = p != null && p.type === F && p.key == null ? p.props.children : p) ? V : [V], _, t, n, o, i, a, l, c, s), r.base = _.__e, _.__u &= -161, r.__h.length && a.push(r), g && (r.__E = r.__ = null);
181
181
  } catch (D) {
182
- _.__v = null, u || i != null ? (_.__e = l, _.__u |= u ? 160 : 32, i[i.indexOf(l)] = null) : (_.__e = t.__e, _.__k = t.__k), f.__e(D, _, t);
182
+ _.__v = null, c || i != null ? (_.__e = l, _.__u |= c ? 160 : 32, i[i.indexOf(l)] = null) : (_.__e = t.__e, _.__k = t.__k), f.__e(D, _, t);
183
183
  }
184
184
  else
185
- i == null && _.__v === t.__v ? (_.__k = t.__k, _.__e = t.__e) : _.__e = Ie(t.__e, _, t, n, o, i, c, u, s);
185
+ i == null && _.__v === t.__v ? (_.__k = t.__k, _.__e = t.__e) : _.__e = Ie(t.__e, _, t, n, o, i, a, c, s);
186
186
  (p = f.diffed) && p(_);
187
187
  }
188
188
  function ge(e, _, t) {
189
189
  _.__d = void 0;
190
190
  for (var n = 0; n < t.length; n++)
191
- Q(t[n], t[++n], t[++n]);
191
+ K(t[n], t[++n], t[++n]);
192
192
  f.__c && f.__c(_, e), e.some(function(o) {
193
193
  try {
194
194
  e = o.__h, o.__h = [], e.some(function(i) {
@@ -199,12 +199,12 @@ function ge(e, _, t) {
199
199
  }
200
200
  });
201
201
  }
202
- function Ie(e, _, t, n, o, i, c, l, u) {
203
- var s, p, r, d, a, m, k, g = t.props, h = _.props, y = _.type;
202
+ function Ie(e, _, t, n, o, i, a, l, c) {
203
+ var s, p, r, d, u, m, k, g = t.props, h = _.props, y = _.type;
204
204
  if (y === "svg" && (o = !0), i != null) {
205
205
  for (s = 0; s < i.length; s++)
206
- if ((a = i[s]) && "setAttribute" in a == !!y && (y ? a.localName === y : a.nodeType === 3)) {
207
- e = a, i[s] = null;
206
+ if ((u = i[s]) && "setAttribute" in u == !!y && (y ? u.localName === y : u.nodeType === 3)) {
207
+ e = u, i[s] = null;
208
208
  break;
209
209
  }
210
210
  }
@@ -218,21 +218,21 @@ function Ie(e, _, t, n, o, i, c, l, u) {
218
218
  else {
219
219
  if (i = i && A.call(e.childNodes), g = t.props || H, !l && i != null)
220
220
  for (g = {}, s = 0; s < e.attributes.length; s++)
221
- g[(a = e.attributes[s]).name] = a.value;
221
+ g[(u = e.attributes[s]).name] = u.value;
222
222
  for (s in g)
223
- a = g[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = a : s === "key" || s in h || N(e, s, null, a, o));
223
+ u = g[s], s == "children" || (s == "dangerouslySetInnerHTML" ? r = u : s === "key" || s in h || N(e, s, null, u, o));
224
224
  for (s in h)
225
- a = h[s], s == "children" ? d = a : s == "dangerouslySetInnerHTML" ? p = a : s == "value" ? m = a : s == "checked" ? k = a : s === "key" || l && typeof a != "function" || g[s] === a || N(e, s, a, g[s], o);
225
+ u = h[s], s == "children" ? d = u : s == "dangerouslySetInnerHTML" ? p = u : s == "value" ? m = u : s == "checked" ? k = u : s === "key" || l && typeof u != "function" || g[s] === u || N(e, s, u, g[s], o);
226
226
  if (p)
227
227
  l || r && (p.__html === r.__html || p.__html === e.innerHTML) || (e.innerHTML = p.__html), _.__k = [];
228
- else if (r && (e.innerHTML = ""), ve(e, G(d) ? d : [d], _, t, n, o && y !== "foreignObject", i, c, i ? i[0] : t.__k && w(t, 0), l, u), i != null)
228
+ else if (r && (e.innerHTML = ""), ve(e, G(d) ? d : [d], _, t, n, o && y !== "foreignObject", i, a, i ? i[0] : t.__k && w(t, 0), l, c), i != null)
229
229
  for (s = i.length; s--; )
230
230
  i[s] != null && de(i[s]);
231
231
  l || (s = "value", m !== void 0 && (m !== e[s] || y === "progress" && !m || y === "option" && m !== g[s]) && N(e, s, m, g[s], !1), s = "checked", k !== void 0 && k !== e[s] && N(e, s, k, g[s], !1));
232
232
  }
233
233
  return e;
234
234
  }
235
- function Q(e, _, t) {
235
+ function K(e, _, t) {
236
236
  try {
237
237
  typeof e == "function" ? e(_) : e.current = _;
238
238
  } catch (n) {
@@ -241,7 +241,7 @@ function Q(e, _, t) {
241
241
  }
242
242
  function z(e, _, t) {
243
243
  var n, o;
244
- if (f.unmount && f.unmount(e), (n = e.ref) && (n.current && n.current !== e.__e || Q(n, null, _)), (n = e.__c) != null) {
244
+ if (f.unmount && f.unmount(e), (n = e.ref) && (n.current && n.current !== e.__e || K(n, null, _)), (n = e.__c) != null) {
245
245
  if (n.componentWillUnmount)
246
246
  try {
247
247
  n.componentWillUnmount();
@@ -255,24 +255,24 @@ function z(e, _, t) {
255
255
  n[o] && z(n[o], _, t || typeof e.type != "function");
256
256
  t || e.__e == null || de(e.__e), e.__ = e.__e = e.__d = void 0;
257
257
  }
258
- function je(e, _, t) {
258
+ function Ue(e, _, t) {
259
259
  return this.constructor(e, t);
260
260
  }
261
- function Ue(e, _, t) {
262
- var n, o, i, c;
263
- f.__ && f.__(e, _), o = (n = typeof t == "function") ? null : t && t.__k || _.__k, i = [], c = [], K(_, e = (!n && t || _).__k = De(F, null, [e]), o || H, H, _.ownerSVGElement !== void 0, !n && t ? [t] : o ? null : _.firstChild ? A.call(_.childNodes) : null, i, !n && t ? t : o ? o.__e : _.firstChild, n, c), ge(i, e, c);
261
+ function je(e, _, t) {
262
+ var n, o, i, a;
263
+ f.__ && f.__(e, _), o = (n = typeof t == "function") ? null : t && t.__k || _.__k, i = [], a = [], Y(_, e = (!n && t || _).__k = De(F, null, [e]), o || H, H, _.ownerSVGElement !== void 0, !n && t ? [t] : o ? null : _.firstChild ? A.call(_.childNodes) : null, i, !n && t ? t : o ? o.__e : _.firstChild, n, a), ge(i, e, a);
264
264
  }
265
265
  A = pe.slice, f = { __e: function(e, _, t, n) {
266
- for (var o, i, c; _ = _.__; )
266
+ for (var o, i, a; _ = _.__; )
267
267
  if ((o = _.__c) && !o.__)
268
268
  try {
269
- if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), c = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, n || {}), c = o.__d), c)
269
+ if ((i = o.constructor) && i.getDerivedStateFromError != null && (o.setState(i.getDerivedStateFromError(e)), a = o.__d), o.componentDidCatch != null && (o.componentDidCatch(e, n || {}), a = o.__d), a)
270
270
  return o.__E = o;
271
271
  } catch (l) {
272
272
  e = l;
273
273
  }
274
274
  throw e;
275
- } }, ae = 0, I.prototype.setState = function(e, _) {
275
+ } }, ue = 0, I.prototype.setState = function(e, _) {
276
276
  var t;
277
277
  t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = C({}, this.state), typeof e == "function" && (e = e(C({}, t), this.props)), e && C(t, e), e != null && this.__v && (_ && this._sb.push(_), ee(this));
278
278
  }, I.prototype.forceUpdate = function(e) {
@@ -280,11 +280,11 @@ A = pe.slice, f = { __e: function(e, _, t, n) {
280
280
  }, I.prototype.render = F, S = [], fe = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Z = function(e, _) {
281
281
  return e.__v.__b - _.__v.__b;
282
282
  }, L.__r = 0;
283
- var M, v, q, oe, J = 0, ye = [], j = [], re = f.__b, ie = f.__r, le = f.diffed, se = f.__c, ce = f.unmount;
283
+ var M, v, q, oe, J = 0, ye = [], U = [], re = f.__b, ie = f.__r, le = f.diffed, se = f.__c, ce = f.unmount;
284
284
  function be(e, _) {
285
285
  f.__h && f.__h(v, e, J || _), J = 0;
286
286
  var t = v.__H || (v.__H = { __: [], __h: [] });
287
- return e >= t.__.length && t.__.push({ __V: j }), t.__[e];
287
+ return e >= t.__.length && t.__.push({ __V: U }), t.__[e];
288
288
  }
289
289
  function Le(e) {
290
290
  return J = 1, Me(ke, e);
@@ -292,10 +292,10 @@ function Le(e) {
292
292
  function Me(e, _, t) {
293
293
  var n = be(M++, 2);
294
294
  if (n.t = e, !n.__c && (n.__ = [t ? t(_) : ke(void 0, _), function(l) {
295
- var u = n.__N ? n.__N[0] : n.__[0], s = n.t(u, l);
296
- u !== s && (n.__N = [s, n.__[1]], n.__c.setState({}));
295
+ var c = n.__N ? n.__N[0] : n.__[0], s = n.t(c, l);
296
+ c !== s && (n.__N = [s, n.__[1]], n.__c.setState({}));
297
297
  }], n.__c = v, !v.u)) {
298
- var o = function(l, u, s) {
298
+ var o = function(l, c, s) {
299
299
  if (!n.__c.__H)
300
300
  return !0;
301
301
  var p = n.__c.__H.__.filter(function(d) {
@@ -304,23 +304,23 @@ function Me(e, _, t) {
304
304
  if (p.every(function(d) {
305
305
  return !d.__N;
306
306
  }))
307
- return !i || i.call(this, l, u, s);
307
+ return !i || i.call(this, l, c, s);
308
308
  var r = !1;
309
309
  return p.forEach(function(d) {
310
310
  if (d.__N) {
311
- var a = d.__[0];
312
- d.__ = d.__N, d.__N = void 0, a !== d.__[0] && (r = !0);
311
+ var u = d.__[0];
312
+ d.__ = d.__N, d.__N = void 0, u !== d.__[0] && (r = !0);
313
313
  }
314
- }), !(!r && n.__c.props === l) && (!i || i.call(this, l, u, s));
314
+ }), !(!r && n.__c.props === l) && (!i || i.call(this, l, c, s));
315
315
  };
316
316
  v.u = !0;
317
- var i = v.shouldComponentUpdate, c = v.componentWillUpdate;
318
- v.componentWillUpdate = function(l, u, s) {
317
+ var i = v.shouldComponentUpdate, a = v.componentWillUpdate;
318
+ v.componentWillUpdate = function(l, c, s) {
319
319
  if (this.__e) {
320
320
  var p = i;
321
- i = void 0, o(l, u, s), i = p;
321
+ i = void 0, o(l, c, s), i = p;
322
322
  }
323
- c && c.call(this, l, u, s);
323
+ a && a.call(this, l, c, s);
324
324
  }, v.shouldComponentUpdate = o;
325
325
  }
326
326
  return n.__N || n.__;
@@ -333,7 +333,7 @@ function Ae() {
333
333
  for (var e; e = ye.shift(); )
334
334
  if (e.__P && e.__H)
335
335
  try {
336
- e.__H.__h.forEach(U), e.__H.__h.forEach(R), e.__H.__h = [];
336
+ e.__H.__h.forEach(j), e.__H.__h.forEach(R), e.__H.__h = [];
337
337
  } catch (_) {
338
338
  e.__H.__h = [], f.__e(_, e.__v);
339
339
  }
@@ -344,18 +344,18 @@ f.__b = function(e) {
344
344
  ie && ie(e), M = 0;
345
345
  var _ = (v = e.__c).__H;
346
346
  _ && (q === v ? (_.__h = [], v.__h = [], _.__.forEach(function(t) {
347
- t.__N && (t.__ = t.__N), t.__V = j, t.__N = t.i = void 0;
348
- })) : (_.__h.forEach(U), _.__h.forEach(R), _.__h = [], M = 0)), q = v;
347
+ t.__N && (t.__ = t.__N), t.__V = U, t.__N = t.i = void 0;
348
+ })) : (_.__h.forEach(j), _.__h.forEach(R), _.__h = [], M = 0)), q = v;
349
349
  }, f.diffed = function(e) {
350
350
  le && le(e);
351
351
  var _ = e.__c;
352
352
  _ && _.__H && (_.__H.__h.length && (ye.push(_) !== 1 && oe === f.requestAnimationFrame || ((oe = f.requestAnimationFrame) || Fe)(Ae)), _.__H.__.forEach(function(t) {
353
- t.i && (t.__H = t.i), t.__V !== j && (t.__ = t.__V), t.i = void 0, t.__V = j;
353
+ t.i && (t.__H = t.i), t.__V !== U && (t.__ = t.__V), t.i = void 0, t.__V = U;
354
354
  })), q = v = null;
355
355
  }, f.__c = function(e, _) {
356
356
  _.some(function(t) {
357
357
  try {
358
- t.__h.forEach(U), t.__h = t.__h.filter(function(n) {
358
+ t.__h.forEach(j), t.__h = t.__h.filter(function(n) {
359
359
  return !n.__ || R(n);
360
360
  });
361
361
  } catch (n) {
@@ -369,20 +369,20 @@ f.__b = function(e) {
369
369
  var _, t = e.__c;
370
370
  t && t.__H && (t.__H.__.forEach(function(n) {
371
371
  try {
372
- U(n);
372
+ j(n);
373
373
  } catch (o) {
374
374
  _ = o;
375
375
  }
376
376
  }), t.__H = void 0, _ && f.__e(_, t.__v));
377
377
  };
378
- var ue = typeof requestAnimationFrame == "function";
378
+ var ae = typeof requestAnimationFrame == "function";
379
379
  function Fe(e) {
380
380
  var _, t = function() {
381
- clearTimeout(n), ue && cancelAnimationFrame(_), setTimeout(e);
381
+ clearTimeout(n), ae && cancelAnimationFrame(_), setTimeout(e);
382
382
  }, n = setTimeout(t, 100);
383
- ue && (_ = requestAnimationFrame(t));
383
+ ae && (_ = requestAnimationFrame(t));
384
384
  }
385
- function U(e) {
385
+ function j(e) {
386
386
  var _ = v, t = e.__c;
387
387
  typeof t == "function" && (e.__c = void 0, t()), v = _;
388
388
  }
@@ -400,13 +400,13 @@ function ke(e, _) {
400
400
  }
401
401
  var Be = 0;
402
402
  function xe(e, _, t, n, o, i) {
403
- var c, l, u = {};
403
+ var a, l, c = {};
404
404
  for (l in _)
405
- l == "ref" ? c = _[l] : u[l] = _[l];
406
- var s = { type: e, props: u, key: t, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Be, __i: -1, __u: 0, __source: o, __self: i };
407
- if (typeof e == "function" && (c = e.defaultProps))
408
- for (l in c)
409
- u[l] === void 0 && (u[l] = c[l]);
405
+ l == "ref" ? a = _[l] : c[l] = _[l];
406
+ var s = { type: e, props: c, key: t, ref: a, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --Be, __i: -1, __u: 0, __source: o, __self: i };
407
+ if (typeof e == "function" && (a = e.defaultProps))
408
+ for (l in a)
409
+ c[l] === void 0 && (c[l] = a[l]);
410
410
  return f.vnode && f.vnode(s), s;
411
411
  }
412
412
  class qe {
@@ -454,14 +454,14 @@ const Oe = ({
454
454
  id: "spiffThemeWrapper"
455
455
  });
456
456
  };
457
- function i_(e, _) {
457
+ function l_(e, _) {
458
458
  W = new qe(), window.SpiffThemeLoader = W;
459
459
  let t;
460
- typeof e == "string" ? t = document.getElementById(e) : t = e, Ue(xe(Oe, {
460
+ typeof e == "string" ? t = document.getElementById(e) : t = e, je(xe(Oe, {
461
461
  context: _
462
462
  }), t);
463
463
  }
464
- function l_(e) {
464
+ function s_(e) {
465
465
  return {
466
466
  id: "example",
467
467
  themeInstallId: (e == null ? void 0 : e.themeInstallId) ?? "example",
@@ -490,14 +490,14 @@ function l_(e) {
490
490
  ...e
491
491
  };
492
492
  }
493
- const Ze = "@spiffcommerce/theme-bridge", ze = "1.10.5", Je = "module", Re = {
493
+ const Ze = "@spiffcommerce/theme-bridge", ze = "1.10.7", Je = "module", Re = {
494
494
  build: "tsc && vite build",
495
495
  preview: "vite preview",
496
496
  dev: "ladle serve",
497
497
  schema: "node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"
498
- }, Ge = "./dist/index.umd.cjs", Ke = "./dist/index.js", Qe = "./dist/index.d.ts", Xe = [
498
+ }, Ge = "./dist/index.umd.cjs", Ye = "./dist/index.js", Ke = "./dist/index.d.ts", Qe = [
499
499
  "./dist"
500
- ], Ye = {
500
+ ], Xe = {
501
501
  import: "./dist/index.js",
502
502
  require: "./dist/index.umd.cjs"
503
503
  }, e_ = {}, __ = {
@@ -526,42 +526,52 @@ const Ze = "@spiffcommerce/theme-bridge", ze = "1.10.5", Je = "module", Re = {
526
526
  type: Je,
527
527
  scripts: Re,
528
528
  main: Ge,
529
- module: Ke,
530
- types: Qe,
531
- files: Xe,
532
- exports: Ye,
529
+ module: Ye,
530
+ types: Ke,
531
+ files: Qe,
532
+ exports: Xe,
533
533
  dependencies: e_,
534
534
  devDependencies: __
535
535
  };
536
- function s_(e) {
536
+ function n_(e, _) {
537
+ if (_.type === "chunk") {
538
+ if (!_.isDynamicEntry)
539
+ return {
540
+ type: O.Javascript,
541
+ mimeType: "text/javascript",
542
+ preload: !_.isEntry,
543
+ filename: e
544
+ };
545
+ } else if (e.endsWith(".css"))
546
+ return {
547
+ type: O.CSS,
548
+ mimeType: "text/css",
549
+ filename: e
550
+ };
551
+ return null;
552
+ }
553
+ function c_(e) {
554
+ const {
555
+ autoGenerateTargetFiles: _ = !0,
556
+ configurationSchema: t,
557
+ targetFiles: n
558
+ } = e ?? {};
537
559
  return {
538
560
  name: "spiff-theme-plugin",
539
561
  version: t_.version,
540
- writeBundle(_, t) {
541
- const n = {
562
+ config(o, i) {
563
+ o.base !== void 0 && o.base !== "" && console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'), o.base = "";
564
+ },
565
+ writeBundle(o, i) {
566
+ const a = _ ? Object.keys(i).map((c) => n != null && n.some((s) => s.filename === c) ? null : n_(c, i[c])).filter((c) => c !== null) : [];
567
+ n && a.push(...n);
568
+ const l = {
542
569
  launchData: {
543
- targetFiles: Object.keys(t).map((o) => {
544
- const i = t[o];
545
- if (i.type === "chunk") {
546
- if (!i.isDynamicEntry)
547
- return {
548
- type: O.Javascript,
549
- mimeType: "text/javascript",
550
- preload: !i.isEntry,
551
- filename: o
552
- };
553
- } else if (o.endsWith(".css"))
554
- return {
555
- type: O.CSS,
556
- mimeType: "text/css",
557
- filename: o
558
- };
559
- return null;
560
- }).filter((o) => o !== null)
570
+ targetFiles: a
561
571
  },
562
- configurationSchema: e
572
+ configurationSchema: t
563
573
  };
564
- we.writeFileSync(Ee.join(_.dir, "spiffTheme.json"), JSON.stringify(n, void 0, 4));
574
+ we.writeFileSync(Ee.join(o.dir, "spiffTheme.json"), JSON.stringify(l, void 0, 4));
565
575
  }
566
576
  };
567
577
  }
@@ -569,7 +579,7 @@ export {
569
579
  $e as AssetType,
570
580
  He as FieldType,
571
581
  O as ThemeFileType,
572
- l_ as exampleThemeInstallConfig,
573
- i_ as setSpiffDevOptions,
574
- s_ as spiffThemePlugin
582
+ s_ as exampleThemeInstallConfig,
583
+ l_ as setSpiffDevOptions,
584
+ c_ as spiffThemePlugin
575
585
  };
@@ -1,2 +1,2 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("#spiffThemeWrapper{width:100%;height:100%}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- (function(m,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(m=typeof globalThis<"u"?globalThis:m||self,k(m.theme={},m.fs,m.path))})(this,function(m,k,E){"use strict";var Re=Object.defineProperty;var Ge=(m,k,E)=>k in m?Re(m,k,{enumerable:!0,configurable:!0,writable:!0,value:E}):m[k]=E;var ee=(m,k,E)=>(Ge(m,typeof k!="symbol"?k+"":k,E),E);var D=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(D||{}),_e=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.Number="Number",e.Select="Select",e.Text="Text",e))(_e||{}),te=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(te||{}),N,a,ne,$,oe,re,Z,P={},ie=[],He=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function S(e,_){for(var t in _)e[t]=_[t];return e}function le(e){var _=e.parentNode;_&&_.removeChild(e)}function Pe(e,_,t){var n,o,i,c={};for(i in _)i=="key"?n=_[i]:i=="ref"?o=_[i]:c[i]=_[i];if(arguments.length>2&&(c.children=arguments.length>3?N.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return j(e,c,n,o,null)}function j(e,_,t,n,o){var i={type:e,props:_,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ne,__i:-1,__u:0};return o==null&&a.vnode!=null&&a.vnode(i),i}function I(e){return e.children}function M(e,_){this.props=e,this.context=_}function H(e,_){if(_==null)return e.__?H(e.__,e.__i+1):null;for(var t;_<e.__k.length;_++)if((t=e.__k[_])!=null&&t.__e!=null)return t.__e;return typeof e.type=="function"?H(e):null}function se(e){var _,t;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,_=0;_<e.__k.length;_++)if((t=e.__k[_])!=null&&t.__e!=null){e.__e=e.__c.base=t.__e;break}return se(e)}}function ce(e){(!e.__d&&(e.__d=!0)&&$.push(e)&&!U.__r++||oe!==a.debounceRendering)&&((oe=a.debounceRendering)||re)(U)}function U(){var e,_,t,n,o,i,c,l,f;for($.sort(Z);e=$.shift();)e.__d&&(_=$.length,n=void 0,i=(o=(t=e).__v).__e,l=[],f=[],(c=t.__P)&&((n=S({},o)).__v=o.__v+1,a.vnode&&a.vnode(n),J(c,n,o,t.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??H(o),!!(32&o.__u),f),n.__.__k[n.__i]=n,he(l,n,f),n.__e!=i&&se(n)),$.length>_&&$.sort(Z));U.__r=0}function fe(e,_,t,n,o,i,c,l,f,s,p){var r,d,u,g,C,y=n&&n.__k||ie,h=_.length;for(t.__d=f,Te(t,_,y),f=t.__d,r=0;r<h;r++)(u=t.__k[r])!=null&&typeof u!="boolean"&&typeof u!="function"&&(d=u.__i===-1?P:y[u.__i]||P,u.__i=r,J(e,u,d,o,i,c,l,f,s,p),g=u.__e,u.ref&&d.ref!=u.ref&&(d.ref&&R(d.ref,null,u),p.push(u.ref,u.__c||g,u)),C==null&&g!=null&&(C=g),65536&u.__u||d.__k===u.__k?f=ue(u,f,e):typeof u.type=="function"&&u.__d!==void 0?f=u.__d:g&&(f=g.nextSibling),u.__d=void 0,u.__u&=-196609);t.__d=f,t.__e=C}function Te(e,_,t){var n,o,i,c,l,f=_.length,s=t.length,p=s,r=0;for(e.__k=[],n=0;n<f;n++)(o=e.__k[n]=(o=_[n])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?j(null,o,null,null,o):z(o)?j(I,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?j(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=De(o,t,c=n+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==c&&(l===c+1?r++:l>c?p>f-c?r+=l-c:r--:r=l<c&&l==c-1?l-c:0,l!==n+r&&(o.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=H(i)),G(i,i,!1),t[n]=null,p--);if(p)for(n=0;n<s;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=H(i)),G(i,i))}function ue(e,_,t){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,_=ue(n[o],_,t));return _}return e.__e!=_&&(t.insertBefore(e.__e,_||null),_=e.__e),_&&_.nextSibling}function De(e,_,t,n){var o=e.key,i=e.type,c=t-1,l=t+1,f=_[t];if(f===null||f&&o==f.key&&i===f.type)return t;if(n>(f!=null&&!(131072&f.__u)?1:0))for(;c>=0||l<_.length;){if(c>=0){if((f=_[c])&&!(131072&f.__u)&&o==f.key&&i===f.type)return c;c--}if(l<_.length){if((f=_[l])&&!(131072&f.__u)&&o==f.key&&i===f.type)return l;l++}}return-1}function ae(e,_,t){_[0]==="-"?e.setProperty(_,t??""):e[_]=t==null?"":typeof t!="number"||He.test(_)?t:t+"px"}function L(e,_,t,n,o){var i;e:if(_==="style")if(typeof t=="string")e.style.cssText=t;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(_ in n)t&&_ in t||ae(e.style,_,"");if(t)for(_ in t)n&&t[_]===n[_]||ae(e.style,_,t[_])}else if(_[0]==="o"&&_[1]==="n")i=_!==(_=_.replace(/(PointerCapture)$|Capture$/,"$1")),_=_.toLowerCase()in e?_.toLowerCase().slice(2):_.slice(2),e.l||(e.l={}),e.l[_+i]=t,t?n?t.u=n.u:(t.u=Date.now(),e.addEventListener(_,i?de:pe,i)):e.removeEventListener(_,i?de:pe,i);else{if(o)_=_.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(_!=="width"&&_!=="height"&&_!=="href"&&_!=="list"&&_!=="form"&&_!=="tabIndex"&&_!=="download"&&_!=="rowSpan"&&_!=="colSpan"&&_!=="role"&&_ in e)try{e[_]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&_[4]!=="-"?e.removeAttribute(_):e.setAttribute(_,t))}}function pe(e){var _=this.l[e.type+!1];if(e.t){if(e.t<=_.u)return}else e.t=Date.now();return _(a.event?a.event(e):e)}function de(e){return this.l[e.type+!0](a.event?a.event(e):e)}function J(e,_,t,n,o,i,c,l,f,s){var p,r,d,u,g,C,y,h,b,w,q,T,$e,O,Y,x=_.type;if(_.constructor!==void 0)return null;128&t.__u&&(f=!!(32&t.__u),i=[l=_.__e=t.__e]),(p=a.__b)&&p(_);e:if(typeof x=="function")try{if(h=_.props,b=(p=x.contextType)&&n[p.__c],w=p?b?b.props.value:p.__:n,t.__c?y=(r=_.__c=t.__c).__=r.__E:("prototype"in x&&x.prototype.render?_.__c=r=new x(h,w):(_.__c=r=new M(h,w),r.constructor=x,r.render=je),b&&b.sub(r),r.props=h,r.state||(r.state={}),r.context=w,r.__n=n,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),x.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=S({},r.__s)),S(r.__s,x.getDerivedStateFromProps(h,r.__s))),u=r.props,g=r.state,r.__v=_,d)x.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==u&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(h,w),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(h,r.__s,w)===!1||_.__v===t.__v)){for(_.__v!==t.__v&&(r.props=h,r.state=r.__s,r.__d=!1),_.__e=t.__e,_.__k=t.__k,_.__k.forEach(function(B){B&&(B.__=_)}),q=0;q<r._sb.length;q++)r.__h.push(r._sb[q]);r._sb=[],r.__h.length&&c.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(h,r.__s,w),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(u,g,C)})}if(r.context=w,r.props=h,r.__P=e,r.__e=!1,T=a.__r,$e=0,"prototype"in x&&x.prototype.render){for(r.state=r.__s,r.__d=!1,T&&T(_),p=r.render(r.props,r.state,r.context),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);r._sb=[]}else do r.__d=!1,T&&T(_),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++$e<25);r.state=r.__s,r.getChildContext!=null&&(n=S(S({},n),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(C=r.getSnapshotBeforeUpdate(u,g)),fe(e,z(Y=p!=null&&p.type===I&&p.key==null?p.props.children:p)?Y:[Y],_,t,n,o,i,c,l,f,s),r.base=_.__e,_.__u&=-161,r.__h.length&&c.push(r),y&&(r.__E=r.__=null)}catch(B){_.__v=null,f||i!=null?(_.__e=l,_.__u|=f?160:32,i[i.indexOf(l)]=null):(_.__e=t.__e,_.__k=t.__k),a.__e(B,_,t)}else i==null&&_.__v===t.__v?(_.__k=t.__k,_.__e=t.__e):_.__e=Ne(t.__e,_,t,n,o,i,c,f,s);(p=a.diffed)&&p(_)}function he(e,_,t){_.__d=void 0;for(var n=0;n<t.length;n++)R(t[n],t[++n],t[++n]);a.__c&&a.__c(_,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){a.__e(i,o.__v)}})}function Ne(e,_,t,n,o,i,c,l,f){var s,p,r,d,u,g,C,y=t.props,h=_.props,b=_.type;if(b==="svg"&&(o=!0),i!=null){for(s=0;s<i.length;s++)if((u=i[s])&&"setAttribute"in u==!!b&&(b?u.localName===b:u.nodeType===3)){e=u,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(h);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,h.is&&h),i=null,l=!1}if(b===null)y===h||l&&e.data===h||(e.data=h);else{if(i=i&&N.call(e.childNodes),y=t.props||P,!l&&i!=null)for(y={},s=0;s<e.attributes.length;s++)y[(u=e.attributes[s]).name]=u.value;for(s in y)u=y[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=u:s==="key"||s in h||L(e,s,null,u,o));for(s in h)u=h[s],s=="children"?d=u:s=="dangerouslySetInnerHTML"?p=u:s=="value"?g=u:s=="checked"?C=u:s==="key"||l&&typeof u!="function"||y[s]===u||L(e,s,u,y[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),_.__k=[];else if(r&&(e.innerHTML=""),fe(e,z(d)?d:[d],_,t,n,o&&b!=="foreignObject",i,c,i?i[0]:t.__k&&H(t,0),l,f),i!=null)for(s=i.length;s--;)i[s]!=null&&le(i[s]);l||(s="value",g!==void 0&&(g!==e[s]||b==="progress"&&!g||b==="option"&&g!==y[s])&&L(e,s,g,y[s],!1),s="checked",C!==void 0&&C!==e[s]&&L(e,s,C,y[s],!1))}return e}function R(e,_,t){try{typeof e=="function"?e(_):e.current=_}catch(n){a.__e(n,t)}}function G(e,_,t){var n,o;if(a.unmount&&a.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||R(n,null,_)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){a.__e(i,_)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&G(n[o],_,t||typeof e.type!="function");t||e.__e==null||le(e.__e),e.__=e.__e=e.__d=void 0}function je(e,_,t){return this.constructor(e,t)}function Ie(e,_,t){var n,o,i,c;a.__&&a.__(e,_),o=(n=typeof t=="function")?null:t&&t.__k||_.__k,i=[],c=[],J(_,e=(!n&&t||_).__k=Pe(I,null,[e]),o||P,P,_.ownerSVGElement!==void 0,!n&&t?[t]:o?null:_.firstChild?N.call(_.childNodes):null,i,!n&&t?t:o?o.__e:_.firstChild,n,c),he(i,e,c)}N=ie.slice,a={__e:function(e,_,t,n){for(var o,i,c;_=_.__;)if((o=_.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),c=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),c=o.__d),c)return o.__E=o}catch(l){e=l}throw e}},ne=0,M.prototype.setState=function(e,_){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=S({},this.state),typeof e=="function"&&(e=e(S({},t),this.props)),e&&S(t,e),e!=null&&this.__v&&(_&&this._sb.push(_),ce(this))},M.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ce(this))},M.prototype.render=I,$=[],re=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,_){return e.__v.__b-_.__v.__b},U.__r=0;var A,v,K,ve,Q=0,me=[],F=[],ge=a.__b,ye=a.__r,be=a.diffed,ke=a.__c,xe=a.unmount;function Ce(e,_){a.__h&&a.__h(v,e,Q||_),Q=0;var t=v.__H||(v.__H={__:[],__h:[]});return e>=t.__.length&&t.__.push({__V:F}),t.__[e]}function Me(e){return Q=1,Ue(we,e)}function Ue(e,_,t){var n=Ce(A++,2);if(n.t=e,!n.__c&&(n.__=[t?t(_):we(void 0,_),function(l){var f=n.__N?n.__N[0]:n.__[0],s=n.t(f,l);f!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var o=function(l,f,s){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,f,s);var r=!1;return p.forEach(function(d){if(d.__N){var u=d.__[0];d.__=d.__N,d.__N=void 0,u!==d.__[0]&&(r=!0)}}),!(!r&&n.__c.props===l)&&(!i||i.call(this,l,f,s))};v.u=!0;var i=v.shouldComponentUpdate,c=v.componentWillUpdate;v.componentWillUpdate=function(l,f,s){if(this.__e){var p=i;i=void 0,o(l,f,s),i=p}c&&c.call(this,l,f,s)},v.shouldComponentUpdate=o}return n.__N||n.__}function Le(e,_){var t=Ce(A++,3);!a.__s&&We(t.__H,_)&&(t.__=e,t.i=_,v.__H.__h.push(t))}function Ae(){for(var e;e=me.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(W),e.__H.__h.forEach(X),e.__H.__h=[]}catch(_){e.__H.__h=[],a.__e(_,e.__v)}}a.__b=function(e){v=null,ge&&ge(e)},a.__r=function(e){ye&&ye(e),A=0;var _=(v=e.__c).__H;_&&(K===v?(_.__h=[],v.__h=[],_.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=F,t.__N=t.i=void 0})):(_.__h.forEach(W),_.__h.forEach(X),_.__h=[],A=0)),K=v},a.diffed=function(e){be&&be(e);var _=e.__c;_&&_.__H&&(_.__H.__h.length&&(me.push(_)!==1&&ve===a.requestAnimationFrame||((ve=a.requestAnimationFrame)||Fe)(Ae)),_.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==F&&(t.__=t.__V),t.i=void 0,t.__V=F})),K=v=null},a.__c=function(e,_){_.some(function(t){try{t.__h.forEach(W),t.__h=t.__h.filter(function(n){return!n.__||X(n)})}catch(n){_.some(function(o){o.__h&&(o.__h=[])}),_=[],a.__e(n,t.__v)}}),ke&&ke(e,_)},a.unmount=function(e){xe&&xe(e);var _,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{W(n)}catch(o){_=o}}),t.__H=void 0,_&&a.__e(_,t.__v))};var Se=typeof requestAnimationFrame=="function";function Fe(e){var _,t=function(){clearTimeout(n),Se&&cancelAnimationFrame(_),setTimeout(e)},n=setTimeout(t,100);Se&&(_=requestAnimationFrame(t))}function W(e){var _=v,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),v=_}function X(e){var _=v;e.__c=e.__(),v=_}function We(e,_){return!e||e.length!==_.length||_.some(function(t,n){return t!==e[n]})}function we(e,_){return typeof _=="function"?_(e):_}var Ve=0;function Ee(e,_,t,n,o,i){var c,l,f={};for(l in _)l=="ref"?c=_[l]:f[l]=_[l];var s={type:e,props:f,key:t,ref:c,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ve,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(c=e.defaultProps))for(l in c)f[l]===void 0&&(f[l]=c[l]);return a.vnode&&a.vnode(s),s}class qe{constructor(){ee(this,"_context");ee(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(_=>{this._getContextCallbacks.push(_)})}setContext(_){this._context=_,this._getContextCallbacks.forEach(t=>t(_)),this._getContextCallbacks=[]}configureClient(_){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(_){console.log("Add to cart",_)}}let V;const Oe=({context:e})=>{const[_,t]=Me(null);return Le(()=>{if(_){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({...e,container:_})}},[_,e]),Ee("div",{ref:t,id:"spiffThemeWrapper"})};function Be(e,_){V=new qe,window.SpiffThemeLoader=V;let t;typeof e=="string"?t=document.getElementById(e):t=e,Ie(Ee(Oe,{context:_}),t)}function Ze(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const ze={name:"@spiffcommerce/theme-bridge",version:"1.10.5",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^19.1.0","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"}};function Je(e){return{name:"spiff-theme-plugin",version:ze.version,writeBundle(_,t){const n={launchData:{targetFiles:Object.keys(t).map(o=>{const i=t[o];if(i.type==="chunk"){if(!i.isDynamicEntry)return{type:D.Javascript,mimeType:"text/javascript",preload:!i.isEntry,filename:o}}else if(o.endsWith(".css"))return{type:D.CSS,mimeType:"text/css",filename:o};return null}).filter(o=>o!==null)},configurationSchema:e};k.writeFileSync(E.join(_.dir,"spiffTheme.json"),JSON.stringify(n,void 0,4))}}}m.AssetType=te,m.FieldType=_e,m.ThemeFileType=D,m.exampleThemeInstallConfig=Ze,m.setSpiffDevOptions=Be,m.spiffThemePlugin=Je,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
2
+ (function(m,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(m=typeof globalThis<"u"?globalThis:m||self,k(m.theme={},m.fs,m.path))})(this,function(m,k,E){"use strict";var Ge=Object.defineProperty;var Ye=(m,k,E)=>k in m?Ge(m,k,{enumerable:!0,configurable:!0,writable:!0,value:E}):m[k]=E;var ee=(m,k,E)=>(Ye(m,typeof k!="symbol"?k+"":k,E),E);var D=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(D||{}),te=(e=>(e.Asset="Asset",e.Boolean="Boolean",e.Color="Color",e.Heading="Heading",e.Number="Number",e.Select="Select",e.Text="Text",e))(te||{}),_e=(e=>(e.Color="Color",e.ColorProfile="ColorProfile",e.Data="Data",e.Environment="Environment",e.Font="Font",e.Frame="Frame",e.Illustration="Illustration",e.Image="Image",e.Material="Material",e.Model="Model",e.Video="Video",e))(_e||{}),N,a,ne,T,oe,re,Z,H={},ie=[],$e=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,z=Array.isArray;function S(e,t){for(var _ in t)e[_]=t[_];return e}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function He(e,t,_){var n,o,i,u={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:u[i]=t[i];if(arguments.length>2&&(u.children=arguments.length>3?N.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)u[i]===void 0&&(u[i]=e.defaultProps[i]);return I(e,u,n,o,null)}function I(e,t,_,n,o){var i={type:e,props:t,key:_,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:o??++ne,__i:-1,__u:0};return o==null&&a.vnode!=null&&a.vnode(i),i}function j(e){return e.children}function M(e,t){this.props=e,this.context=t}function $(e,t){if(t==null)return e.__?$(e.__,e.__i+1):null;for(var _;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null)return _.__e;return typeof e.type=="function"?$(e):null}function se(e){var t,_;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((_=e.__k[t])!=null&&_.__e!=null){e.__e=e.__c.base=_.__e;break}return se(e)}}function ce(e){(!e.__d&&(e.__d=!0)&&T.push(e)&&!U.__r++||oe!==a.debounceRendering)&&((oe=a.debounceRendering)||re)(U)}function U(){var e,t,_,n,o,i,u,l,c;for(T.sort(Z);e=T.shift();)e.__d&&(t=T.length,n=void 0,i=(o=(_=e).__v).__e,l=[],c=[],(u=_.__P)&&((n=S({},o)).__v=o.__v+1,a.vnode&&a.vnode(n),J(u,n,o,_.__n,u.ownerSVGElement!==void 0,32&o.__u?[i]:null,l,i??$(o),!!(32&o.__u),c),n.__.__k[n.__i]=n,he(l,n,c),n.__e!=i&&se(n)),T.length>t&&T.sort(Z));U.__r=0}function ue(e,t,_,n,o,i,u,l,c,s,p){var r,d,f,g,C,y=n&&n.__k||ie,h=t.length;for(_.__d=c,Pe(_,t,y),c=_.__d,r=0;r<h;r++)(f=_.__k[r])!=null&&typeof f!="boolean"&&typeof f!="function"&&(d=f.__i===-1?H:y[f.__i]||H,f.__i=r,J(e,f,d,o,i,u,l,c,s,p),g=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&R(d.ref,null,f),p.push(f.ref,f.__c||g,f)),C==null&&g!=null&&(C=g),65536&f.__u||d.__k===f.__k?c=fe(f,c,e):typeof f.type=="function"&&f.__d!==void 0?c=f.__d:g&&(c=g.nextSibling),f.__d=void 0,f.__u&=-196609);_.__d=c,_.__e=C}function Pe(e,t,_){var n,o,i,u,l,c=t.length,s=_.length,p=s,r=0;for(e.__k=[],n=0;n<c;n++)(o=e.__k[n]=(o=t[n])==null||typeof o=="boolean"||typeof o=="function"?null:typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?I(null,o,null,null,o):z(o)?I(j,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?I(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o)!=null?(o.__=e,o.__b=e.__b+1,l=De(o,_,u=n+r,p),o.__i=l,i=null,l!==-1&&(p--,(i=_[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):l!==u&&(l===u+1?r++:l>u?p>c-u?r+=l-u:r--:r=l<u&&l==u-1?l-u:0,l!==n+r&&(o.__u|=65536))):(i=_[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=$(i)),G(i,i,!1),_[n]=null,p--);if(p)for(n=0;n<s;n++)(i=_[n])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=$(i)),G(i,i))}function fe(e,t,_){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=fe(n[o],t,_));return t}return e.__e!=t&&(_.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function De(e,t,_,n){var o=e.key,i=e.type,u=_-1,l=_+1,c=t[_];if(c===null||c&&o==c.key&&i===c.type)return _;if(n>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<t.length;){if(u>=0){if((c=t[u])&&!(131072&c.__u)&&o==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&o==c.key&&i===c.type)return l;l++}}return-1}function ae(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||$e.test(t)?_:_+"px"}function F(e,t,_,n,o){var i;e:if(t==="style")if(typeof _=="string")e.style.cssText=_;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)_&&t in _||ae(e.style,t,"");if(_)for(t in _)n&&_[t]===n[t]||ae(e.style,t,_[t])}else if(t[0]==="o"&&t[1]==="n")i=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=_,_?n?_.u=n.u:(_.u=Date.now(),e.addEventListener(t,i?de:pe,i)):e.removeEventListener(t,i?de:pe,i);else{if(o)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,_))}}function pe(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(a.event?a.event(e):e)}function de(e){return this.l[e.type+!0](a.event?a.event(e):e)}function J(e,t,_,n,o,i,u,l,c,s){var p,r,d,f,g,C,y,h,b,w,q,P,Te,O,X,x=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(c=!!(32&_.__u),i=[l=t.__e=_.__e]),(p=a.__b)&&p(t);e:if(typeof x=="function")try{if(h=t.props,b=(p=x.contextType)&&n[p.__c],w=p?b?b.props.value:p.__:n,_.__c?y=(r=t.__c=_.__c).__=r.__E:("prototype"in x&&x.prototype.render?t.__c=r=new x(h,w):(t.__c=r=new M(h,w),r.constructor=x,r.render=Ie),b&&b.sub(r),r.props=h,r.state||(r.state={}),r.context=w,r.__n=n,d=r.__d=!0,r.__h=[],r._sb=[]),r.__s==null&&(r.__s=r.state),x.getDerivedStateFromProps!=null&&(r.__s==r.state&&(r.__s=S({},r.__s)),S(r.__s,x.getDerivedStateFromProps(h,r.__s))),f=r.props,g=r.state,r.__v=t,d)x.getDerivedStateFromProps==null&&r.componentWillMount!=null&&r.componentWillMount(),r.componentDidMount!=null&&r.__h.push(r.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==f&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(h,w),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(h,r.__s,w)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(r.props=h,r.state=r.__s,r.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(B){B&&(B.__=t)}),q=0;q<r._sb.length;q++)r.__h.push(r._sb[q]);r._sb=[],r.__h.length&&u.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(h,r.__s,w),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(f,g,C)})}if(r.context=w,r.props=h,r.__P=e,r.__e=!1,P=a.__r,Te=0,"prototype"in x&&x.prototype.render){for(r.state=r.__s,r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),O=0;O<r._sb.length;O++)r.__h.push(r._sb[O]);r._sb=[]}else do r.__d=!1,P&&P(t),p=r.render(r.props,r.state,r.context),r.state=r.__s;while(r.__d&&++Te<25);r.state=r.__s,r.getChildContext!=null&&(n=S(S({},n),r.getChildContext())),d||r.getSnapshotBeforeUpdate==null||(C=r.getSnapshotBeforeUpdate(f,g)),ue(e,z(X=p!=null&&p.type===j&&p.key==null?p.props.children:p)?X:[X],t,_,n,o,i,u,l,c,s),r.base=t.__e,t.__u&=-161,r.__h.length&&u.push(r),y&&(r.__E=r.__=null)}catch(B){t.__v=null,c||i!=null?(t.__e=l,t.__u|=c?160:32,i[i.indexOf(l)]=null):(t.__e=_.__e,t.__k=_.__k),a.__e(B,t,_)}else i==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ne(_.__e,t,_,n,o,i,u,c,s);(p=a.diffed)&&p(t)}function he(e,t,_){t.__d=void 0;for(var n=0;n<_.length;n++)R(_[n],_[++n],_[++n]);a.__c&&a.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){a.__e(i,o.__v)}})}function Ne(e,t,_,n,o,i,u,l,c){var s,p,r,d,f,g,C,y=_.props,h=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(s=0;s<i.length;s++)if((f=i[s])&&"setAttribute"in f==!!b&&(b?f.localName===b:f.nodeType===3)){e=f,i[s]=null;break}}if(e==null){if(b===null)return document.createTextNode(h);e=o?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,h.is&&h),i=null,l=!1}if(b===null)y===h||l&&e.data===h||(e.data=h);else{if(i=i&&N.call(e.childNodes),y=_.props||H,!l&&i!=null)for(y={},s=0;s<e.attributes.length;s++)y[(f=e.attributes[s]).name]=f.value;for(s in y)f=y[s],s=="children"||(s=="dangerouslySetInnerHTML"?r=f:s==="key"||s in h||F(e,s,null,f,o));for(s in h)f=h[s],s=="children"?d=f:s=="dangerouslySetInnerHTML"?p=f:s=="value"?g=f:s=="checked"?C=f:s==="key"||l&&typeof f!="function"||y[s]===f||F(e,s,f,y[s],o);if(p)l||r&&(p.__html===r.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(r&&(e.innerHTML=""),ue(e,z(d)?d:[d],t,_,n,o&&b!=="foreignObject",i,u,i?i[0]:_.__k&&$(_,0),l,c),i!=null)for(s=i.length;s--;)i[s]!=null&&le(i[s]);l||(s="value",g!==void 0&&(g!==e[s]||b==="progress"&&!g||b==="option"&&g!==y[s])&&F(e,s,g,y[s],!1),s="checked",C!==void 0&&C!==e[s]&&F(e,s,C,y[s],!1))}return e}function R(e,t,_){try{typeof e=="function"?e(t):e.current=t}catch(n){a.__e(n,_)}}function G(e,t,_){var n,o;if(a.unmount&&a.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||R(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){a.__e(i,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&G(n[o],t,_||typeof e.type!="function");_||e.__e==null||le(e.__e),e.__=e.__e=e.__d=void 0}function Ie(e,t,_){return this.constructor(e,_)}function je(e,t,_){var n,o,i,u;a.__&&a.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,i=[],u=[],J(t,e=(!n&&_||t).__k=He(j,null,[e]),o||H,H,t.ownerSVGElement!==void 0,!n&&_?[_]:o?null:t.firstChild?N.call(t.childNodes):null,i,!n&&_?_:o?o.__e:t.firstChild,n,u),he(i,e,u)}N=ie.slice,a={__e:function(e,t,_,n){for(var o,i,u;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),u=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),u=o.__d),u)return o.__E=o}catch(l){e=l}throw e}},ne=0,M.prototype.setState=function(e,t){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=S({},this.state),typeof e=="function"&&(e=e(S({},_),this.props)),e&&S(_,e),e!=null&&this.__v&&(t&&this._sb.push(t),ce(this))},M.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ce(this))},M.prototype.render=j,T=[],re=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(e,t){return e.__v.__b-t.__v.__b},U.__r=0;var L,v,Y,ve,K=0,me=[],A=[],ge=a.__b,ye=a.__r,be=a.diffed,ke=a.__c,xe=a.unmount;function Ce(e,t){a.__h&&a.__h(v,e,K||t),K=0;var _=v.__H||(v.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:A}),_.__[e]}function Me(e){return K=1,Ue(we,e)}function Ue(e,t,_){var n=Ce(L++,2);if(n.t=e,!n.__c&&(n.__=[_?_(t):we(void 0,t),function(l){var c=n.__N?n.__N[0]:n.__[0],s=n.t(c,l);c!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var o=function(l,c,s){if(!n.__c.__H)return!0;var p=n.__c.__H.__.filter(function(d){return d.__c});if(p.every(function(d){return!d.__N}))return!i||i.call(this,l,c,s);var r=!1;return p.forEach(function(d){if(d.__N){var f=d.__[0];d.__=d.__N,d.__N=void 0,f!==d.__[0]&&(r=!0)}}),!(!r&&n.__c.props===l)&&(!i||i.call(this,l,c,s))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,o(l,c,s),i=p}u&&u.call(this,l,c,s)},v.shouldComponentUpdate=o}return n.__N||n.__}function Fe(e,t){var _=Ce(L++,3);!a.__s&&We(_.__H,t)&&(_.__=e,_.i=t,v.__H.__h.push(_))}function Le(){for(var e;e=me.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(W),e.__H.__h.forEach(Q),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}a.__b=function(e){v=null,ge&&ge(e)},a.__r=function(e){ye&&ye(e),L=0;var t=(v=e.__c).__H;t&&(Y===v?(t.__h=[],v.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.__V=A,_.__N=_.i=void 0})):(t.__h.forEach(W),t.__h.forEach(Q),t.__h=[],L=0)),Y=v},a.diffed=function(e){be&&be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(me.push(t)!==1&&ve===a.requestAnimationFrame||((ve=a.requestAnimationFrame)||Ae)(Le)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==A&&(_.__=_.__V),_.i=void 0,_.__V=A})),Y=v=null},a.__c=function(e,t){t.some(function(_){try{_.__h.forEach(W),_.__h=_.__h.filter(function(n){return!n.__||Q(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],a.__e(n,_.__v)}}),ke&&ke(e,t)},a.unmount=function(e){xe&&xe(e);var t,_=e.__c;_&&_.__H&&(_.__H.__.forEach(function(n){try{W(n)}catch(o){t=o}}),_.__H=void 0,t&&a.__e(t,_.__v))};var Se=typeof requestAnimationFrame=="function";function Ae(e){var t,_=function(){clearTimeout(n),Se&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(_,100);Se&&(t=requestAnimationFrame(_))}function W(e){var t=v,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),v=t}function Q(e){var t=v;e.__c=e.__(),v=t}function We(e,t){return!e||e.length!==t.length||t.some(function(_,n){return _!==e[n]})}function we(e,t){return typeof t=="function"?t(e):t}var Ve=0;function Ee(e,t,_,n,o,i){var u,l,c={};for(l in t)l=="ref"?u=t[l]:c[l]=t[l];var s={type:e,props:c,key:_,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Ve,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(u=e.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return a.vnode&&a.vnode(s),s}class qe{constructor(){ee(this,"_context");ee(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(t=>{this._getContextCallbacks.push(t)})}setContext(t){this._context=t,this._getContextCallbacks.forEach(_=>_(t)),this._getContextCallbacks=[]}configureClient(t){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(t){console.log("Add to cart",t)}}let V;const Oe=({context:e})=>{const[t,_]=Me(null);return Fe(()=>{if(t){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({...e,container:t})}},[t,e]),Ee("div",{ref:_,id:"spiffThemeWrapper"})};function Be(e,t){V=new qe,window.SpiffThemeLoader=V;let _;typeof e=="string"?_=document.getElementById(e):_=e,je(Ee(Oe,{context:t}),_)}function Ze(e){return{id:"example",themeInstallId:(e==null?void 0:e.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],...e}}const ze={name:"@spiffcommerce/theme-bridge",version:"1.10.7",type:"module",scripts:{build:"tsc && vite build",preview:"vite preview",dev:"ladle serve",schema:"node --no-warnings=ExperimentalWarning --loader ts-node/esm scripts/generateSchema.ts"},main:"./dist/index.umd.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",files:["./dist"],exports:{import:"./dist/index.js",require:"./dist/index.umd.cjs"},dependencies:{},devDependencies:{"@ladle/react":"^4.0.2","@preact/preset-vite":"^2.7.0","@spiffcommerce/core":"^19.1.0","@types/node":"^20.11.16","@typescript-eslint/eslint-plugin":"^7.1.0","@typescript-eslint/parser":"^7.1.0",eslint:"^8.57.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3",preact:"^10.19.3",prettier:"^3.2.4",rollup:"^4.12.0","ts-json-schema-generator":"^1.5.0","ts-node":"^10.9.2",tsup:"^8.0.1",typescript:"^5.2.2",vite:"^5.0.8","vite-plugin-css-injected-by-js":"^3.4.0","vite-plugin-externalize-deps":"^0.8.0"}};function Je(e,t){if(t.type==="chunk"){if(!t.isDynamicEntry)return{type:D.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:D.CSS,mimeType:"text/css",filename:e};return null}function Re(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:_,targetFiles:n}=e??{};return{name:"spiff-theme-plugin",version:ze.version,config(o,i){o.base!==void 0&&o.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),o.base=""},writeBundle(o,i){const u=t?Object.keys(i).map(c=>n!=null&&n.some(s=>s.filename===c)?null:Je(c,i[c])).filter(c=>c!==null):[];n&&u.push(...n);const l={launchData:{targetFiles:u},configurationSchema:_};k.writeFileSync(E.join(o.dir,"spiffTheme.json"),JSON.stringify(l,void 0,4))}}}m.AssetType=_e,m.FieldType=te,m.ThemeFileType=D,m.exampleThemeInstallConfig=Ze,m.setSpiffDevOptions=Be,m.spiffThemePlugin=Re,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spiffcommerce/theme-bridge",
3
- "version": "1.10.6",
3
+ "version": "1.10.8",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "tsc && vite build",