@spiffcommerce/theme-bridge 1.9.4 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -13
- package/dist/index.js +42 -42
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -47,10 +47,9 @@ declare enum FieldType {
|
|
|
47
47
|
Boolean = "Boolean",
|
|
48
48
|
Color = "Color",
|
|
49
49
|
Heading = "Heading",
|
|
50
|
-
MultiLineText = "MultiLineText",
|
|
51
50
|
Number = "Number",
|
|
52
51
|
Select = "Select",
|
|
53
|
-
|
|
52
|
+
Text = "Text"
|
|
54
53
|
}
|
|
55
54
|
interface ThemeConfigurationSchema {
|
|
56
55
|
/**
|
|
@@ -64,7 +63,7 @@ interface FieldBase {
|
|
|
64
63
|
*/
|
|
65
64
|
title: string;
|
|
66
65
|
}
|
|
67
|
-
interface
|
|
66
|
+
interface ConfigurableField extends FieldBase {
|
|
68
67
|
/**
|
|
69
68
|
* A locally unique identifier for the field.
|
|
70
69
|
*/
|
|
@@ -74,30 +73,31 @@ interface GenericField extends FieldBase {
|
|
|
74
73
|
*/
|
|
75
74
|
description?: string;
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
interface GenericFieldWithRequired extends GenericField {
|
|
76
|
+
interface RequiredOption {
|
|
79
77
|
/**
|
|
80
78
|
* Optional: Set to `true` to require a value to be provided in the configuration form.
|
|
81
79
|
*/
|
|
82
80
|
required?: boolean;
|
|
83
|
-
type: GenericFieldTypes;
|
|
84
81
|
}
|
|
85
|
-
interface
|
|
82
|
+
interface DefaultValueOption {
|
|
86
83
|
/**
|
|
87
84
|
* Optional: A default value to supply. Values are always supplied as strings.
|
|
88
85
|
* When the `type` is `"Select"`, this should be one of the `key` fields in the `options` array.
|
|
89
86
|
*/
|
|
90
87
|
defaultValue?: string;
|
|
91
|
-
type: GenericFieldTypes;
|
|
92
88
|
}
|
|
93
|
-
interface
|
|
89
|
+
interface GenericFieldBase extends ConfigurableField {
|
|
90
|
+
type: FieldType.Boolean | FieldType.Color | FieldType.Number;
|
|
91
|
+
}
|
|
92
|
+
type GenericField = GenericFieldBase & (RequiredOption | DefaultValueOption);
|
|
93
|
+
interface AssetField extends ConfigurableField, RequiredOption {
|
|
94
94
|
/**
|
|
95
95
|
* The type of asset, e.g. Image, Model, Font, etc.
|
|
96
96
|
*/
|
|
97
97
|
assetType: AssetType;
|
|
98
98
|
type: FieldType.Asset;
|
|
99
99
|
}
|
|
100
|
-
interface SelectFieldBase {
|
|
100
|
+
interface SelectFieldBase extends ConfigurableField {
|
|
101
101
|
/**
|
|
102
102
|
* The options available for the Partner to select in the configuration form.
|
|
103
103
|
*/
|
|
@@ -113,12 +113,19 @@ interface SelectFieldBase {
|
|
|
113
113
|
}[];
|
|
114
114
|
type: FieldType.Select;
|
|
115
115
|
}
|
|
116
|
-
type
|
|
117
|
-
|
|
116
|
+
type SelectField = SelectFieldBase & (RequiredOption | DefaultValueOption);
|
|
117
|
+
interface TextFieldBase extends ConfigurableField {
|
|
118
|
+
/**
|
|
119
|
+
* Allows the Partner to configure the field in a multi-line text editor.
|
|
120
|
+
*/
|
|
121
|
+
multiline?: boolean;
|
|
122
|
+
type: FieldType.Text;
|
|
123
|
+
}
|
|
124
|
+
type TextField = TextFieldBase & (RequiredOption | DefaultValueOption);
|
|
118
125
|
interface HeadingField extends FieldBase {
|
|
119
126
|
type: FieldType.Heading;
|
|
120
127
|
}
|
|
121
|
-
type ThemeConfigurationSchemaField =
|
|
128
|
+
type ThemeConfigurationSchemaField = GenericField | AssetField | SelectField | HeadingField | TextField;
|
|
122
129
|
declare enum AssetType {
|
|
123
130
|
Color = "Color",
|
|
124
131
|
ColorProfile = "ColorProfile",
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var q = (_, e, t) => (
|
|
5
|
-
var S_ = /* @__PURE__ */ ((_) => (_.Javascript = "Javascript", _.CSS = "CSS", _))(S_ || {}), E_ = /* @__PURE__ */ ((_) => (_.Asset = "Asset", _.Boolean = "Boolean", _.Color = "Color", _.Heading = "Heading", _.
|
|
6
|
-
function
|
|
2
|
+
var C_ = Object.defineProperty;
|
|
3
|
+
var x_ = (_, e, t) => e in _ ? C_(_, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[e] = t;
|
|
4
|
+
var q = (_, e, t) => (x_(_, typeof e != "symbol" ? e + "" : e, t), t);
|
|
5
|
+
var S_ = /* @__PURE__ */ ((_) => (_.Javascript = "Javascript", _.CSS = "CSS", _))(S_ || {}), E_ = /* @__PURE__ */ ((_) => (_.Asset = "Asset", _.Boolean = "Boolean", _.Color = "Color", _.Heading = "Heading", _.Number = "Number", _.Select = "Select", _.Text = "Text", _))(E_ || {}), w_ = /* @__PURE__ */ ((_) => (_.Color = "Color", _.ColorProfile = "ColorProfile", _.Data = "Data", _.Environment = "Environment", _.Font = "Font", _.Frame = "Frame", _.Illustration = "Illustration", _.Image = "Image", _.Material = "Material", _.Model = "Model", _.Video = "Video", _))(w_ || {}), V, s, f_, S, X, a_, O, H = {}, s_ = [], H_ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
|
|
6
|
+
function x(_, e) {
|
|
7
7
|
for (var t in e)
|
|
8
8
|
_[t] = e[t];
|
|
9
9
|
return _;
|
|
@@ -19,16 +19,16 @@ function $_(_, e, t) {
|
|
|
19
19
|
if (arguments.length > 2 && (c.children = arguments.length > 3 ? V.call(arguments, 2) : t), typeof _ == "function" && _.defaultProps != null)
|
|
20
20
|
for (i in _.defaultProps)
|
|
21
21
|
c[i] === void 0 && (c[i] = _.defaultProps[i]);
|
|
22
|
-
return
|
|
22
|
+
return I(_, c, n, r, null);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function I(_, e, t, n, r) {
|
|
25
25
|
var i = { type: _, props: e, key: t, ref: n, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: r ?? ++f_, __i: -1, __u: 0 };
|
|
26
26
|
return r == null && s.vnode != null && s.vnode(i), i;
|
|
27
27
|
}
|
|
28
28
|
function F(_) {
|
|
29
29
|
return _.children;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function T(_, e) {
|
|
32
32
|
this.props = _, this.context = e;
|
|
33
33
|
}
|
|
34
34
|
function E(_, e) {
|
|
@@ -51,13 +51,13 @@ function p_(_) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function Y(_) {
|
|
54
|
-
(!_.__d && (_.__d = !0) && S.push(_) && !
|
|
54
|
+
(!_.__d && (_.__d = !0) && S.push(_) && !M.__r++ || X !== s.debounceRendering) && ((X = s.debounceRendering) || a_)(M);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function M() {
|
|
57
57
|
var _, e, t, n, r, i, c, l, f;
|
|
58
58
|
for (S.sort(O); _ = S.shift(); )
|
|
59
|
-
_.__d && (e = S.length, n = void 0, i = (r = (t = _).__v).__e, l = [], f = [], (c = t.__P) && ((n =
|
|
60
|
-
|
|
59
|
+
_.__d && (e = S.length, n = void 0, i = (r = (t = _).__v).__e, l = [], f = [], (c = t.__P) && ((n = x({}, r)).__v = r.__v + 1, s.vnode && s.vnode(n), J(c, n, r, t.__n, c.ownerSVGElement !== void 0, 32 & r.__u ? [i] : null, l, i ?? E(r), !!(32 & r.__u), f), n.__.__k[n.__i] = n, m_(l, n, f), n.__e != i && p_(n)), S.length > e && S.sort(O));
|
|
60
|
+
M.__r = 0;
|
|
61
61
|
}
|
|
62
62
|
function h_(_, e, t, n, r, i, c, l, f, u, d) {
|
|
63
63
|
var o, p, a, m, k, g = n && n.__k || s_, h = e.length;
|
|
@@ -68,7 +68,7 @@ function h_(_, e, t, n, r, i, c, l, f, u, d) {
|
|
|
68
68
|
function P_(_, e, t) {
|
|
69
69
|
var n, r, i, c, l, f = e.length, u = t.length, d = u, o = 0;
|
|
70
70
|
for (_.__k = [], n = 0; n < f; n++)
|
|
71
|
-
(r = _.__k[n] = (r = e[n]) == null || typeof r == "boolean" || typeof r == "function" ? null : typeof r == "string" || typeof r == "number" || typeof r == "bigint" || r.constructor == String ?
|
|
71
|
+
(r = _.__k[n] = (r = e[n]) == null || typeof r == "boolean" || typeof r == "function" ? null : typeof r == "string" || typeof r == "number" || typeof r == "bigint" || r.constructor == String ? I(null, r, null, null, r) : G(r) ? I(F, { children: r }, null, null, null) : r.constructor === void 0 && r.__b > 0 ? I(r.type, r.props, r.key, r.ref ? r.ref : null, r.__v) : r) != null ? (r.__ = _, r.__b = _.__b + 1, l = D_(r, t, c = n + o, d), r.__i = l, i = null, l !== -1 && (d--, (i = t[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && o--, typeof r.type != "function" && (r.__u |= 65536)) : l !== c && (l === c + 1 ? o++ : l > c ? d > f - c ? o += l - c : o-- : o = l < c && l == c - 1 ? l - c : 0, l !== n + o && (r.__u |= 65536))) : (i = t[n]) && i.key == null && i.__e && (i.__e == _.__d && (_.__d = E(i)), R(i, i, !1), t[n] = null, d--);
|
|
72
72
|
if (d)
|
|
73
73
|
for (n = 0; n < u; n++)
|
|
74
74
|
(i = t[n]) != null && !(131072 & i.__u) && (i.__e == _.__d && (_.__d = E(i)), R(i, i));
|
|
@@ -145,17 +145,17 @@ function t_(_) {
|
|
|
145
145
|
return this.l[_.type + !0](s.event ? s.event(_) : _);
|
|
146
146
|
}
|
|
147
147
|
function J(_, e, t, n, r, i, c, l, f, u) {
|
|
148
|
-
var d, o, p, a, m, k, g, h, y,
|
|
148
|
+
var d, o, p, a, m, k, g, h, y, C, $, w, Q, P, B, b = e.type;
|
|
149
149
|
if (e.constructor !== void 0)
|
|
150
150
|
return null;
|
|
151
151
|
128 & t.__u && (f = !!(32 & t.__u), i = [l = e.__e = t.__e]), (d = s.__b) && d(e);
|
|
152
152
|
_:
|
|
153
153
|
if (typeof b == "function")
|
|
154
154
|
try {
|
|
155
|
-
if (h = e.props, y = (d = b.contextType) && n[d.__c],
|
|
155
|
+
if (h = e.props, y = (d = b.contextType) && n[d.__c], C = d ? y ? y.props.value : d.__ : n, t.__c ? g = (o = e.__c = t.__c).__ = o.__E : ("prototype" in b && b.prototype.render ? e.__c = o = new b(h, C) : (e.__c = o = new T(h, C), o.constructor = b, o.render = I_), y && y.sub(o), o.props = h, o.state || (o.state = {}), o.context = C, o.__n = n, p = o.__d = !0, o.__h = [], o._sb = []), o.__s == null && (o.__s = o.state), b.getDerivedStateFromProps != null && (o.__s == o.state && (o.__s = x({}, o.__s)), x(o.__s, b.getDerivedStateFromProps(h, o.__s))), a = o.props, m = o.state, o.__v = e, p)
|
|
156
156
|
b.getDerivedStateFromProps == null && o.componentWillMount != null && o.componentWillMount(), o.componentDidMount != null && o.__h.push(o.componentDidMount);
|
|
157
157
|
else {
|
|
158
|
-
if (b.getDerivedStateFromProps == null && h !== a && o.componentWillReceiveProps != null && o.componentWillReceiveProps(h,
|
|
158
|
+
if (b.getDerivedStateFromProps == null && h !== a && o.componentWillReceiveProps != null && o.componentWillReceiveProps(h, C), !o.__e && (o.shouldComponentUpdate != null && o.shouldComponentUpdate(h, o.__s, C) === !1 || e.__v === t.__v)) {
|
|
159
159
|
for (e.__v !== t.__v && (o.props = h, o.state = o.__s, o.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.forEach(function(D) {
|
|
160
160
|
D && (D.__ = e);
|
|
161
161
|
}), $ = 0; $ < o._sb.length; $++)
|
|
@@ -163,11 +163,11 @@ function J(_, e, t, n, r, i, c, l, f, u) {
|
|
|
163
163
|
o._sb = [], o.__h.length && c.push(o);
|
|
164
164
|
break _;
|
|
165
165
|
}
|
|
166
|
-
o.componentWillUpdate != null && o.componentWillUpdate(h, o.__s,
|
|
166
|
+
o.componentWillUpdate != null && o.componentWillUpdate(h, o.__s, C), o.componentDidUpdate != null && o.__h.push(function() {
|
|
167
167
|
o.componentDidUpdate(a, m, k);
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
-
if (o.context =
|
|
170
|
+
if (o.context = C, o.props = h, o.__P = _, o.__e = !1, w = s.__r, Q = 0, "prototype" in b && b.prototype.render) {
|
|
171
171
|
for (o.state = o.__s, o.__d = !1, w && w(e), d = o.render(o.props, o.state, o.context), P = 0; P < o._sb.length; P++)
|
|
172
172
|
o.__h.push(o._sb[P]);
|
|
173
173
|
o._sb = [];
|
|
@@ -175,7 +175,7 @@ function J(_, e, t, n, r, i, c, l, f, u) {
|
|
|
175
175
|
do
|
|
176
176
|
o.__d = !1, w && w(e), d = o.render(o.props, o.state, o.context), o.state = o.__s;
|
|
177
177
|
while (o.__d && ++Q < 25);
|
|
178
|
-
o.state = o.__s, o.getChildContext != null && (n =
|
|
178
|
+
o.state = o.__s, o.getChildContext != null && (n = x(x({}, n), o.getChildContext())), p || o.getSnapshotBeforeUpdate == null || (k = o.getSnapshotBeforeUpdate(a, m)), h_(_, G(B = d != null && d.type === F && d.key == null ? d.props.children : d) ? B : [B], e, t, n, r, i, c, l, f, u), o.base = e.__e, e.__u &= -161, o.__h.length && c.push(o), g && (o.__E = o.__ = null);
|
|
179
179
|
} catch (D) {
|
|
180
180
|
e.__v = null, f || i != null ? (e.__e = l, e.__u |= f ? 160 : 32, i[i.indexOf(l)] = null) : (e.__e = t.__e, e.__k = t.__k), s.__e(D, e, t);
|
|
181
181
|
}
|
|
@@ -253,10 +253,10 @@ function R(_, e, t) {
|
|
|
253
253
|
n[r] && R(n[r], e, t || typeof _.type != "function");
|
|
254
254
|
t || _.__e == null || d_(_.__e), _.__ = _.__e = _.__d = void 0;
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function I_(_, e, t) {
|
|
257
257
|
return this.constructor(_, t);
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function T_(_, e, t) {
|
|
260
260
|
var n, r, i, c;
|
|
261
261
|
s.__ && s.__(_, e), r = (n = typeof t == "function") ? null : t && t.__k || e.__k, i = [], c = [], J(e, _ = (!n && t || e).__k = $_(F, null, [_]), r || H, H, e.ownerSVGElement !== void 0, !n && t ? [t] : r ? null : e.firstChild ? V.call(e.childNodes) : null, i, !n && t ? t : r ? r.__e : e.firstChild, n, c), m_(i, _, c);
|
|
262
262
|
}
|
|
@@ -270,24 +270,24 @@ V = s_.slice, s = { __e: function(_, e, t, n) {
|
|
|
270
270
|
_ = l;
|
|
271
271
|
}
|
|
272
272
|
throw _;
|
|
273
|
-
} }, f_ = 0,
|
|
273
|
+
} }, f_ = 0, T.prototype.setState = function(_, e) {
|
|
274
274
|
var t;
|
|
275
|
-
t = this.__s != null && this.__s !== this.state ? this.__s : this.__s =
|
|
276
|
-
},
|
|
275
|
+
t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = x({}, this.state), typeof _ == "function" && (_ = _(x({}, t), this.props)), _ && x(t, _), _ != null && this.__v && (e && this._sb.push(e), Y(this));
|
|
276
|
+
}, T.prototype.forceUpdate = function(_) {
|
|
277
277
|
this.__v && (this.__e = !0, _ && this.__h.push(_), Y(this));
|
|
278
|
-
},
|
|
278
|
+
}, T.prototype.render = F, S = [], a_ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, O = function(_, e) {
|
|
279
279
|
return _.__v.__b - e.__v.__b;
|
|
280
|
-
},
|
|
281
|
-
var A, v, Z, n_, j = 0, g_ = [],
|
|
280
|
+
}, M.__r = 0;
|
|
281
|
+
var A, v, Z, n_, j = 0, g_ = [], U = [], o_ = s.__b, r_ = s.__r, i_ = s.diffed, l_ = s.__c, u_ = s.unmount;
|
|
282
282
|
function y_(_, e) {
|
|
283
283
|
s.__h && s.__h(v, _, j || e), j = 0;
|
|
284
284
|
var t = v.__H || (v.__H = { __: [], __h: [] });
|
|
285
|
-
return _ >= t.__.length && t.__.push({ __V:
|
|
285
|
+
return _ >= t.__.length && t.__.push({ __V: U }), t.__[_];
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
return j = 1,
|
|
287
|
+
function U_(_) {
|
|
288
|
+
return j = 1, L_(b_, _);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function L_(_, e, t) {
|
|
291
291
|
var n = y_(A++, 2);
|
|
292
292
|
if (n.t = _, !n.__c && (n.__ = [t ? t(e) : b_(void 0, e), function(l) {
|
|
293
293
|
var f = n.__N ? n.__N[0] : n.__[0], u = n.t(f, l);
|
|
@@ -323,7 +323,7 @@ function T_(_, e, t) {
|
|
|
323
323
|
}
|
|
324
324
|
return n.__N || n.__;
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function M_(_, e) {
|
|
327
327
|
var t = y_(A++, 3);
|
|
328
328
|
!s.__s && V_(t.__H, e) && (t.__ = _, t.i = e, v.__H.__h.push(t));
|
|
329
329
|
}
|
|
@@ -331,7 +331,7 @@ function A_() {
|
|
|
331
331
|
for (var _; _ = g_.shift(); )
|
|
332
332
|
if (_.__P && _.__H)
|
|
333
333
|
try {
|
|
334
|
-
_.__H.__h.forEach(
|
|
334
|
+
_.__H.__h.forEach(L), _.__H.__h.forEach(z), _.__H.__h = [];
|
|
335
335
|
} catch (e) {
|
|
336
336
|
_.__H.__h = [], s.__e(e, _.__v);
|
|
337
337
|
}
|
|
@@ -342,18 +342,18 @@ s.__b = function(_) {
|
|
|
342
342
|
r_ && r_(_), A = 0;
|
|
343
343
|
var e = (v = _.__c).__H;
|
|
344
344
|
e && (Z === v ? (e.__h = [], v.__h = [], e.__.forEach(function(t) {
|
|
345
|
-
t.__N && (t.__ = t.__N), t.__V =
|
|
346
|
-
})) : (e.__h.forEach(
|
|
345
|
+
t.__N && (t.__ = t.__N), t.__V = U, t.__N = t.i = void 0;
|
|
346
|
+
})) : (e.__h.forEach(L), e.__h.forEach(z), e.__h = [], A = 0)), Z = v;
|
|
347
347
|
}, s.diffed = function(_) {
|
|
348
348
|
i_ && i_(_);
|
|
349
349
|
var e = _.__c;
|
|
350
350
|
e && e.__H && (e.__H.__h.length && (g_.push(e) !== 1 && n_ === s.requestAnimationFrame || ((n_ = s.requestAnimationFrame) || W_)(A_)), e.__H.__.forEach(function(t) {
|
|
351
|
-
t.i && (t.__H = t.i), t.__V !==
|
|
351
|
+
t.i && (t.__H = t.i), t.__V !== U && (t.__ = t.__V), t.i = void 0, t.__V = U;
|
|
352
352
|
})), Z = v = null;
|
|
353
353
|
}, s.__c = function(_, e) {
|
|
354
354
|
e.some(function(t) {
|
|
355
355
|
try {
|
|
356
|
-
t.__h.forEach(
|
|
356
|
+
t.__h.forEach(L), t.__h = t.__h.filter(function(n) {
|
|
357
357
|
return !n.__ || z(n);
|
|
358
358
|
});
|
|
359
359
|
} catch (n) {
|
|
@@ -367,7 +367,7 @@ s.__b = function(_) {
|
|
|
367
367
|
var e, t = _.__c;
|
|
368
368
|
t && t.__H && (t.__H.__.forEach(function(n) {
|
|
369
369
|
try {
|
|
370
|
-
|
|
370
|
+
L(n);
|
|
371
371
|
} catch (r) {
|
|
372
372
|
e = r;
|
|
373
373
|
}
|
|
@@ -380,7 +380,7 @@ function W_(_) {
|
|
|
380
380
|
}, n = setTimeout(t, 100);
|
|
381
381
|
c_ && (e = requestAnimationFrame(t));
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function L(_) {
|
|
384
384
|
var e = v, t = _.__c;
|
|
385
385
|
typeof t == "function" && (_.__c = void 0, t()), v = e;
|
|
386
386
|
}
|
|
@@ -437,8 +437,8 @@ let W;
|
|
|
437
437
|
const q_ = ({
|
|
438
438
|
context: _
|
|
439
439
|
}) => {
|
|
440
|
-
const [e, t] =
|
|
441
|
-
return
|
|
440
|
+
const [e, t] = U_(null);
|
|
441
|
+
return M_(() => {
|
|
442
442
|
if (e) {
|
|
443
443
|
if (W === void 0)
|
|
444
444
|
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
@@ -455,7 +455,7 @@ const q_ = ({
|
|
|
455
455
|
function O_(_, e) {
|
|
456
456
|
W = new B_(), window.SpiffThemeLoader = W;
|
|
457
457
|
let t;
|
|
458
|
-
typeof _ == "string" ? t = document.getElementById(_) : t = _,
|
|
458
|
+
typeof _ == "string" ? t = document.getElementById(_) : t = _, T_(k_(q_, {
|
|
459
459
|
context: e
|
|
460
460
|
}), t);
|
|
461
461
|
}
|
package/dist/index.umd.cjs
CHANGED
|
@@ -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(b,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(b=typeof globalThis<"u"?globalThis:b||self,k(b.theme={}))})(this,function(b){"use strict";var Z_=Object.defineProperty;var j_=(b,k,S)=>k in b?Z_(b,k,{enumerable:!0,configurable:!0,writable:!0,value:S}):b[k]=S;var Y=(b,k,S)=>(j_(b,typeof k!="symbol"?k+"":k,S),S);var k=(_=>(_.Javascript="Javascript",_.CSS="CSS",_))(k||{}),S=(_=>(_.Asset="Asset",_.Boolean="Boolean",_.Color="Color",_.Heading="Heading",_.MultiLineText="MultiLineText",_.Number="Number",_.Select="Select",_.SingleLineText="SingleLineText",_))(S||{}),__=(_=>(_.Color="Color",_.ColorProfile="ColorProfile",_.Data="Data",_.Environment="Environment",_.Font="Font",_.Frame="Frame",_.Illustration="Illustration",_.Image="Image",_.Material="Material",_.Model="Model",_.Video="Video",_))(__||{}),D,s,e_,H,t_,n_,Z,P={},o_=[],w_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j=Array.isArray;function E(_,e){for(var t in e)_[t]=e[t];return _}function r_(_){var e=_.parentNode;e&&e.removeChild(_)}function H_(_,e,t){var n,r,i,u={};for(i in e)i=="key"?n=e[i]:i=="ref"?r=e[i]:u[i]=e[i];if(arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(i in _.defaultProps)u[i]===void 0&&(u[i]=_.defaultProps[i]);return N(_,u,n,r,null)}function N(_,e,t,n,r){var i={type:_,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++e_,__i:-1,__u:0};return r==null&&s.vnode!=null&&s.vnode(i),i}function L(_){return _.children}function I(_,e){this.props=_,this.context=e}function $(_,e){if(e==null)return _.__?$(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?$(_):null}function i_(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return i_(_)}}function l_(_){(!_.__d&&(_.__d=!0)&&H.push(_)&&!M.__r++||t_!==s.debounceRendering)&&((t_=s.debounceRendering)||n_)(M)}function M(){var _,e,t,n,r,i,u,l,c;for(H.sort(Z);_=H.shift();)_.__d&&(e=H.length,n=void 0,i=(r=(t=_).__v).__e,l=[],c=[],(u=t.__P)&&((n=E({},r)).__v=r.__v+1,s.vnode&&s.vnode(n),R(u,n,r,t.__n,u.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??$(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,d_(l,n,c),n.__e!=i&&i_(n)),H.length>e&&H.sort(Z));M.__r=0}function f_(_,e,t,n,r,i,u,l,c,f,d){var o,p,a,m,x,g=n&&n.__k||o_,h=e.length;for(t.__d=c,$_(t,e,g),c=t.__d,o=0;o<h;o++)(a=t.__k[o])!=null&&typeof a!="boolean"&&typeof a!="function"&&(p=a.__i===-1?P:g[a.__i]||P,a.__i=o,R(_,a,p,r,i,u,l,c,f,d),m=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&z(p.ref,null,a),d.push(a.ref,a.__c||m,a)),x==null&&m!=null&&(x=m),65536&a.__u||p.__k===a.__k?c=u_(a,c,_):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:m&&(c=m.nextSibling),a.__d=void 0,a.__u&=-196609);t.__d=c,t.__e=x}function $_(_,e,t){var n,r,i,u,l,c=e.length,f=t.length,d=f,o=0;for(_.__k=[],n=0;n<c;n++)(r=_.__k[n]=(r=e[n])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?N(null,r,null,null,r):j(r)?N(L,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?N(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=_,r.__b=_.__b+1,l=P_(r,t,u=n+o,d),r.__i=l,i=null,l!==-1&&(d--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&o--,typeof r.type!="function"&&(r.__u|=65536)):l!==u&&(l===u+1?o++:l>u?d>c-u?o+=l-u:o--:o=l<u&&l==u-1?l-u:0,l!==n+o&&(r.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i,!1),t[n]=null,d--);if(d)for(n=0;n<f;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i))}function u_(_,e,t){var n,r;if(typeof _.type=="function"){for(n=_.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=_,e=u_(n[r],e,t));return e}return _.__e!=e&&(t.insertBefore(_.__e,e||null),e=_.__e),e&&e.nextSibling}function P_(_,e,t,n){var r=_.key,i=_.type,u=t-1,l=t+1,c=e[t];if(c===null||c&&r==c.key&&i===c.type)return t;if(n>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<e.length;){if(u>=0){if((c=e[u])&&!(131072&c.__u)&&r==c.key&&i===c.type)return u;u--}if(l<e.length){if((c=e[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function c_(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||w_.test(e)?t:t+"px"}function U(_,e,t,n,r){var i;_:if(e==="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof n=="string"&&(_.style.cssText=n=""),n)for(e in n)t&&e in t||c_(_.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||c_(_.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")i=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in _?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+i]=t,t?n?t.u=n.u:(t.u=Date.now(),_.addEventListener(e,i?s_:a_,i)):_.removeEventListener(e,i?s_:a_,i);else{if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in _)try{_[e]=t??"";break _}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,t))}}function a_(_){var e=this.l[_.type+!1];if(_.t){if(_.t<=e.u)return}else _.t=Date.now();return e(s.event?s.event(_):_)}function s_(_){return this.l[_.type+!0](s.event?s.event(_):_)}function R(_,e,t,n,r,i,u,l,c,f){var d,o,p,a,m,x,g,h,y,w,B,T,E_,O,X,C=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),i=[l=e.__e=t.__e]),(d=s.__b)&&d(e);_:if(typeof C=="function")try{if(h=e.props,y=(d=C.contextType)&&n[d.__c],w=d?y?y.props.value:d.__:n,t.__c?g=(o=e.__c=t.__c).__=o.__E:("prototype"in C&&C.prototype.render?e.__c=o=new C(h,w):(e.__c=o=new I(h,w),o.constructor=C,o.render=D_),y&&y.sub(o),o.props=h,o.state||(o.state={}),o.context=w,o.__n=n,p=o.__d=!0,o.__h=[],o._sb=[]),o.__s==null&&(o.__s=o.state),C.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=E({},o.__s)),E(o.__s,C.getDerivedStateFromProps(h,o.__s))),a=o.props,m=o.state,o.__v=e,p)C.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(C.getDerivedStateFromProps==null&&h!==a&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=h,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(q){q&&(q.__=e)}),B=0;B<o._sb.length;B++)o.__h.push(o._sb[B]);o._sb=[],o.__h.length&&u.push(o);break _}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,w),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(a,m,x)})}if(o.context=w,o.props=h,o.__P=_,o.__e=!1,T=s.__r,E_=0,"prototype"in C&&C.prototype.render){for(o.state=o.__s,o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),O=0;O<o._sb.length;O++)o.__h.push(o._sb[O]);o._sb=[]}else do o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++E_<25);o.state=o.__s,o.getChildContext!=null&&(n=E(E({},n),o.getChildContext())),p||o.getSnapshotBeforeUpdate==null||(x=o.getSnapshotBeforeUpdate(a,m)),f_(_,j(X=d!=null&&d.type===L&&d.key==null?d.props.children:d)?X:[X],e,t,n,r,i,u,l,c,f),o.base=e.__e,e.__u&=-161,o.__h.length&&u.push(o),g&&(o.__E=o.__=null)}catch(q){e.__v=null,c||i!=null?(e.__e=l,e.__u|=c?160:32,i[i.indexOf(l)]=null):(e.__e=t.__e,e.__k=t.__k),s.__e(q,e,t)}else i==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=T_(t.__e,e,t,n,r,i,u,c,f);(d=s.diffed)&&d(e)}function d_(_,e,t){e.__d=void 0;for(var n=0;n<t.length;n++)z(t[n],t[++n],t[++n]);s.__c&&s.__c(e,_),_.some(function(r){try{_=r.__h,r.__h=[],_.some(function(i){i.call(r)})}catch(i){s.__e(i,r.__v)}})}function T_(_,e,t,n,r,i,u,l,c){var f,d,o,p,a,m,x,g=t.props,h=e.props,y=e.type;if(y==="svg"&&(r=!0),i!=null){for(f=0;f<i.length;f++)if((a=i[f])&&"setAttribute"in a==!!y&&(y?a.localName===y:a.nodeType===3)){_=a,i[f]=null;break}}if(_==null){if(y===null)return document.createTextNode(h);_=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,h.is&&h),i=null,l=!1}if(y===null)g===h||l&&_.data===h||(_.data=h);else{if(i=i&&D.call(_.childNodes),g=t.props||P,!l&&i!=null)for(g={},f=0;f<_.attributes.length;f++)g[(a=_.attributes[f]).name]=a.value;for(f in g)a=g[f],f=="children"||(f=="dangerouslySetInnerHTML"?o=a:f==="key"||f in h||U(_,f,null,a,r));for(f in h)a=h[f],f=="children"?p=a:f=="dangerouslySetInnerHTML"?d=a:f=="value"?m=a:f=="checked"?x=a:f==="key"||l&&typeof a!="function"||g[f]===a||U(_,f,a,g[f],r);if(d)l||o&&(d.__html===o.__html||d.__html===_.innerHTML)||(_.innerHTML=d.__html),e.__k=[];else if(o&&(_.innerHTML=""),f_(_,j(p)?p:[p],e,t,n,r&&y!=="foreignObject",i,u,i?i[0]:t.__k&&$(t,0),l,c),i!=null)for(f=i.length;f--;)i[f]!=null&&r_(i[f]);l||(f="value",m!==void 0&&(m!==_[f]||y==="progress"&&!m||y==="option"&&m!==g[f])&&U(_,f,m,g[f],!1),f="checked",x!==void 0&&x!==_[f]&&U(_,f,x,g[f],!1))}return _}function z(_,e,t){try{typeof _=="function"?_(e):_.current=e}catch(n){s.__e(n,t)}}function G(_,e,t){var n,r;if(s.unmount&&s.unmount(_),(n=_.ref)&&(n.current&&n.current!==_.__e||z(n,null,e)),(n=_.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){s.__e(i,e)}n.base=n.__P=null,_.__c=void 0}if(n=_.__k)for(r=0;r<n.length;r++)n[r]&&G(n[r],e,t||typeof _.type!="function");t||_.__e==null||r_(_.__e),_.__=_.__e=_.__d=void 0}function D_(_,e,t){return this.constructor(_,t)}function N_(_,e,t){var n,r,i,u;s.__&&s.__(_,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,i=[],u=[],R(e,_=(!n&&t||e).__k=H_(L,null,[_]),r||P,P,e.ownerSVGElement!==void 0,!n&&t?[t]:r?null:e.firstChild?D.call(e.childNodes):null,i,!n&&t?t:r?r.__e:e.firstChild,n,u),d_(i,_,u)}D=o_.slice,s={__e:function(_,e,t,n){for(var r,i,u;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(_)),u=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(_,n||{}),u=r.__d),u)return r.__E=r}catch(l){_=l}throw _}},e_=0,I.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof _=="function"&&(_=_(E({},t),this.props)),_&&E(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),l_(this))},I.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),l_(this))},I.prototype.render=L,H=[],n_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(_,e){return _.__v.__b-e.__v.__b},M.__r=0;var A,v,J,p_,K=0,h_=[],W=[],v_=s.__b,m_=s.__r,g_=s.diffed,y_=s.__c,b_=s.unmount;function k_(_,e){s.__h&&s.__h(v,_,K||e),K=0;var t=v.__H||(v.__H={__:[],__h:[]});return _>=t.__.length&&t.__.push({__V:W}),t.__[_]}function L_(_){return K=1,I_(x_,_)}function I_(_,e,t){var n=k_(A++,2);if(n.t=_,!n.__c&&(n.__=[t?t(e):x_(void 0,e),function(l){var c=n.__N?n.__N[0]:n.__[0],f=n.t(c,l);c!==f&&(n.__N=[f,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var r=function(l,c,f){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,l,c,f);var o=!1;return d.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,f))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,f){if(this.__e){var d=i;i=void 0,r(l,c,f),i=d}u&&u.call(this,l,c,f)},v.shouldComponentUpdate=r}return n.__N||n.__}function M_(_,e){var t=k_(A++,3);!s.__s&&W_(t.__H,e)&&(t.__=_,t.i=e,v.__H.__h.push(t))}function U_(){for(var _;_=h_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(F),_.__H.__h.forEach(Q),_.__H.__h=[]}catch(e){_.__H.__h=[],s.__e(e,_.__v)}}s.__b=function(_){v=null,v_&&v_(_)},s.__r=function(_){m_&&m_(_),A=0;var e=(v=_.__c).__H;e&&(J===v?(e.__h=[],v.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=W,t.__N=t.i=void 0})):(e.__h.forEach(F),e.__h.forEach(Q),e.__h=[],A=0)),J=v},s.diffed=function(_){g_&&g_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(h_.push(e)!==1&&p_===s.requestAnimationFrame||((p_=s.requestAnimationFrame)||A_)(U_)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==W&&(t.__=t.__V),t.i=void 0,t.__V=W})),J=v=null},s.__c=function(_,e){e.some(function(t){try{t.__h.forEach(F),t.__h=t.__h.filter(function(n){return!n.__||Q(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],s.__e(n,t.__v)}}),y_&&y_(_,e)},s.unmount=function(_){b_&&b_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{F(n)}catch(r){e=r}}),t.__H=void 0,e&&s.__e(e,t.__v))};var C_=typeof requestAnimationFrame=="function";function A_(_){var e,t=function(){clearTimeout(n),C_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,100);C_&&(e=requestAnimationFrame(t))}function F(_){var e=v,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),v=e}function Q(_){var e=v;_.__c=_.__(),v=e}function W_(_,e){return!_||_.length!==e.length||e.some(function(t,n){return t!==_[n]})}function x_(_,e){return typeof e=="function"?e(_):e}var F_=0;function S_(_,e,t,n,r,i){var u,l,c={};for(l in e)l=="ref"?u=e[l]:c[l]=e[l];var f={type:_,props:c,key:t,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--F_,__i:-1,__u:0,__source:r,__self:i};if(typeof _=="function"&&(u=_.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return s.vnode&&s.vnode(f),f}class V_{constructor(){Y(this,"_context");Y(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(e=>{this._getContextCallbacks.push(e)})}setContext(e){this._context=e,this._getContextCallbacks.forEach(t=>t(e)),this._getContextCallbacks=[]}configureClient(e){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(e){console.log("Add to cart",e)}}let V;const B_=({context:_})=>{const[e,t]=L_(null);return M_(()=>{if(e){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({..._,container:e})}},[e,_]),S_("div",{ref:t,id:"spiffThemeWrapper"})};function O_(_,e){V=new V_,window.SpiffThemeLoader=V;let t;typeof _=="string"?t=document.getElementById(_):t=_,N_(S_(B_,{context:e}),t)}function q_(_){return{id:"example",themeInstallId:(_==null?void 0:_.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:[],..._}}b.AssetType=__,b.FieldType=S,b.ThemeFileType=k,b.exampleThemeInstallConfig=q_,b.setSpiffDevOptions=O_,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(b,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(b=typeof globalThis<"u"?globalThis:b||self,k(b.theme={}))})(this,function(b){"use strict";var Z_=Object.defineProperty;var j_=(b,k,S)=>k in b?Z_(b,k,{enumerable:!0,configurable:!0,writable:!0,value:S}):b[k]=S;var Y=(b,k,S)=>(j_(b,typeof k!="symbol"?k+"":k,S),S);var k=(_=>(_.Javascript="Javascript",_.CSS="CSS",_))(k||{}),S=(_=>(_.Asset="Asset",_.Boolean="Boolean",_.Color="Color",_.Heading="Heading",_.Number="Number",_.Select="Select",_.Text="Text",_))(S||{}),__=(_=>(_.Color="Color",_.ColorProfile="ColorProfile",_.Data="Data",_.Environment="Environment",_.Font="Font",_.Frame="Frame",_.Illustration="Illustration",_.Image="Image",_.Material="Material",_.Model="Model",_.Video="Video",_))(__||{}),D,s,e_,H,t_,n_,Z,P={},o_=[],w_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j=Array.isArray;function E(_,e){for(var t in e)_[t]=e[t];return _}function r_(_){var e=_.parentNode;e&&e.removeChild(_)}function H_(_,e,t){var n,r,i,u={};for(i in e)i=="key"?n=e[i]:i=="ref"?r=e[i]:u[i]=e[i];if(arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(i in _.defaultProps)u[i]===void 0&&(u[i]=_.defaultProps[i]);return N(_,u,n,r,null)}function N(_,e,t,n,r){var i={type:_,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++e_,__i:-1,__u:0};return r==null&&s.vnode!=null&&s.vnode(i),i}function I(_){return _.children}function M(_,e){this.props=_,this.context=e}function $(_,e){if(e==null)return _.__?$(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?$(_):null}function i_(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return i_(_)}}function l_(_){(!_.__d&&(_.__d=!0)&&H.push(_)&&!U.__r++||t_!==s.debounceRendering)&&((t_=s.debounceRendering)||n_)(U)}function U(){var _,e,t,n,r,i,u,l,c;for(H.sort(Z);_=H.shift();)_.__d&&(e=H.length,n=void 0,i=(r=(t=_).__v).__e,l=[],c=[],(u=t.__P)&&((n=E({},r)).__v=r.__v+1,s.vnode&&s.vnode(n),R(u,n,r,t.__n,u.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??$(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,d_(l,n,c),n.__e!=i&&i_(n)),H.length>e&&H.sort(Z));U.__r=0}function f_(_,e,t,n,r,i,u,l,c,f,d){var o,p,a,m,x,g=n&&n.__k||o_,h=e.length;for(t.__d=c,$_(t,e,g),c=t.__d,o=0;o<h;o++)(a=t.__k[o])!=null&&typeof a!="boolean"&&typeof a!="function"&&(p=a.__i===-1?P:g[a.__i]||P,a.__i=o,R(_,a,p,r,i,u,l,c,f,d),m=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&z(p.ref,null,a),d.push(a.ref,a.__c||m,a)),x==null&&m!=null&&(x=m),65536&a.__u||p.__k===a.__k?c=u_(a,c,_):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:m&&(c=m.nextSibling),a.__d=void 0,a.__u&=-196609);t.__d=c,t.__e=x}function $_(_,e,t){var n,r,i,u,l,c=e.length,f=t.length,d=f,o=0;for(_.__k=[],n=0;n<c;n++)(r=_.__k[n]=(r=e[n])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?N(null,r,null,null,r):j(r)?N(I,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?N(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=_,r.__b=_.__b+1,l=P_(r,t,u=n+o,d),r.__i=l,i=null,l!==-1&&(d--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&o--,typeof r.type!="function"&&(r.__u|=65536)):l!==u&&(l===u+1?o++:l>u?d>c-u?o+=l-u:o--:o=l<u&&l==u-1?l-u:0,l!==n+o&&(r.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i,!1),t[n]=null,d--);if(d)for(n=0;n<f;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i))}function u_(_,e,t){var n,r;if(typeof _.type=="function"){for(n=_.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=_,e=u_(n[r],e,t));return e}return _.__e!=e&&(t.insertBefore(_.__e,e||null),e=_.__e),e&&e.nextSibling}function P_(_,e,t,n){var r=_.key,i=_.type,u=t-1,l=t+1,c=e[t];if(c===null||c&&r==c.key&&i===c.type)return t;if(n>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<e.length;){if(u>=0){if((c=e[u])&&!(131072&c.__u)&&r==c.key&&i===c.type)return u;u--}if(l<e.length){if((c=e[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function c_(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||w_.test(e)?t:t+"px"}function L(_,e,t,n,r){var i;_:if(e==="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof n=="string"&&(_.style.cssText=n=""),n)for(e in n)t&&e in t||c_(_.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||c_(_.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")i=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in _?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+i]=t,t?n?t.u=n.u:(t.u=Date.now(),_.addEventListener(e,i?s_:a_,i)):_.removeEventListener(e,i?s_:a_,i);else{if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in _)try{_[e]=t??"";break _}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,t))}}function a_(_){var e=this.l[_.type+!1];if(_.t){if(_.t<=e.u)return}else _.t=Date.now();return e(s.event?s.event(_):_)}function s_(_){return this.l[_.type+!0](s.event?s.event(_):_)}function R(_,e,t,n,r,i,u,l,c,f){var d,o,p,a,m,x,g,h,y,w,B,T,E_,O,X,C=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),i=[l=e.__e=t.__e]),(d=s.__b)&&d(e);_:if(typeof C=="function")try{if(h=e.props,y=(d=C.contextType)&&n[d.__c],w=d?y?y.props.value:d.__:n,t.__c?g=(o=e.__c=t.__c).__=o.__E:("prototype"in C&&C.prototype.render?e.__c=o=new C(h,w):(e.__c=o=new M(h,w),o.constructor=C,o.render=D_),y&&y.sub(o),o.props=h,o.state||(o.state={}),o.context=w,o.__n=n,p=o.__d=!0,o.__h=[],o._sb=[]),o.__s==null&&(o.__s=o.state),C.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=E({},o.__s)),E(o.__s,C.getDerivedStateFromProps(h,o.__s))),a=o.props,m=o.state,o.__v=e,p)C.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(C.getDerivedStateFromProps==null&&h!==a&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=h,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(q){q&&(q.__=e)}),B=0;B<o._sb.length;B++)o.__h.push(o._sb[B]);o._sb=[],o.__h.length&&u.push(o);break _}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,w),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(a,m,x)})}if(o.context=w,o.props=h,o.__P=_,o.__e=!1,T=s.__r,E_=0,"prototype"in C&&C.prototype.render){for(o.state=o.__s,o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),O=0;O<o._sb.length;O++)o.__h.push(o._sb[O]);o._sb=[]}else do o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++E_<25);o.state=o.__s,o.getChildContext!=null&&(n=E(E({},n),o.getChildContext())),p||o.getSnapshotBeforeUpdate==null||(x=o.getSnapshotBeforeUpdate(a,m)),f_(_,j(X=d!=null&&d.type===I&&d.key==null?d.props.children:d)?X:[X],e,t,n,r,i,u,l,c,f),o.base=e.__e,e.__u&=-161,o.__h.length&&u.push(o),g&&(o.__E=o.__=null)}catch(q){e.__v=null,c||i!=null?(e.__e=l,e.__u|=c?160:32,i[i.indexOf(l)]=null):(e.__e=t.__e,e.__k=t.__k),s.__e(q,e,t)}else i==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=T_(t.__e,e,t,n,r,i,u,c,f);(d=s.diffed)&&d(e)}function d_(_,e,t){e.__d=void 0;for(var n=0;n<t.length;n++)z(t[n],t[++n],t[++n]);s.__c&&s.__c(e,_),_.some(function(r){try{_=r.__h,r.__h=[],_.some(function(i){i.call(r)})}catch(i){s.__e(i,r.__v)}})}function T_(_,e,t,n,r,i,u,l,c){var f,d,o,p,a,m,x,g=t.props,h=e.props,y=e.type;if(y==="svg"&&(r=!0),i!=null){for(f=0;f<i.length;f++)if((a=i[f])&&"setAttribute"in a==!!y&&(y?a.localName===y:a.nodeType===3)){_=a,i[f]=null;break}}if(_==null){if(y===null)return document.createTextNode(h);_=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,h.is&&h),i=null,l=!1}if(y===null)g===h||l&&_.data===h||(_.data=h);else{if(i=i&&D.call(_.childNodes),g=t.props||P,!l&&i!=null)for(g={},f=0;f<_.attributes.length;f++)g[(a=_.attributes[f]).name]=a.value;for(f in g)a=g[f],f=="children"||(f=="dangerouslySetInnerHTML"?o=a:f==="key"||f in h||L(_,f,null,a,r));for(f in h)a=h[f],f=="children"?p=a:f=="dangerouslySetInnerHTML"?d=a:f=="value"?m=a:f=="checked"?x=a:f==="key"||l&&typeof a!="function"||g[f]===a||L(_,f,a,g[f],r);if(d)l||o&&(d.__html===o.__html||d.__html===_.innerHTML)||(_.innerHTML=d.__html),e.__k=[];else if(o&&(_.innerHTML=""),f_(_,j(p)?p:[p],e,t,n,r&&y!=="foreignObject",i,u,i?i[0]:t.__k&&$(t,0),l,c),i!=null)for(f=i.length;f--;)i[f]!=null&&r_(i[f]);l||(f="value",m!==void 0&&(m!==_[f]||y==="progress"&&!m||y==="option"&&m!==g[f])&&L(_,f,m,g[f],!1),f="checked",x!==void 0&&x!==_[f]&&L(_,f,x,g[f],!1))}return _}function z(_,e,t){try{typeof _=="function"?_(e):_.current=e}catch(n){s.__e(n,t)}}function G(_,e,t){var n,r;if(s.unmount&&s.unmount(_),(n=_.ref)&&(n.current&&n.current!==_.__e||z(n,null,e)),(n=_.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){s.__e(i,e)}n.base=n.__P=null,_.__c=void 0}if(n=_.__k)for(r=0;r<n.length;r++)n[r]&&G(n[r],e,t||typeof _.type!="function");t||_.__e==null||r_(_.__e),_.__=_.__e=_.__d=void 0}function D_(_,e,t){return this.constructor(_,t)}function N_(_,e,t){var n,r,i,u;s.__&&s.__(_,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,i=[],u=[],R(e,_=(!n&&t||e).__k=H_(I,null,[_]),r||P,P,e.ownerSVGElement!==void 0,!n&&t?[t]:r?null:e.firstChild?D.call(e.childNodes):null,i,!n&&t?t:r?r.__e:e.firstChild,n,u),d_(i,_,u)}D=o_.slice,s={__e:function(_,e,t,n){for(var r,i,u;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(_)),u=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(_,n||{}),u=r.__d),u)return r.__E=r}catch(l){_=l}throw _}},e_=0,M.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof _=="function"&&(_=_(E({},t),this.props)),_&&E(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),l_(this))},M.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),l_(this))},M.prototype.render=I,H=[],n_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(_,e){return _.__v.__b-e.__v.__b},U.__r=0;var A,v,J,p_,K=0,h_=[],F=[],v_=s.__b,m_=s.__r,g_=s.diffed,y_=s.__c,b_=s.unmount;function k_(_,e){s.__h&&s.__h(v,_,K||e),K=0;var t=v.__H||(v.__H={__:[],__h:[]});return _>=t.__.length&&t.__.push({__V:F}),t.__[_]}function I_(_){return K=1,M_(x_,_)}function M_(_,e,t){var n=k_(A++,2);if(n.t=_,!n.__c&&(n.__=[t?t(e):x_(void 0,e),function(l){var c=n.__N?n.__N[0]:n.__[0],f=n.t(c,l);c!==f&&(n.__N=[f,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var r=function(l,c,f){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,l,c,f);var o=!1;return d.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,f))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,f){if(this.__e){var d=i;i=void 0,r(l,c,f),i=d}u&&u.call(this,l,c,f)},v.shouldComponentUpdate=r}return n.__N||n.__}function U_(_,e){var t=k_(A++,3);!s.__s&&F_(t.__H,e)&&(t.__=_,t.i=e,v.__H.__h.push(t))}function L_(){for(var _;_=h_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(W),_.__H.__h.forEach(Q),_.__H.__h=[]}catch(e){_.__H.__h=[],s.__e(e,_.__v)}}s.__b=function(_){v=null,v_&&v_(_)},s.__r=function(_){m_&&m_(_),A=0;var e=(v=_.__c).__H;e&&(J===v?(e.__h=[],v.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=F,t.__N=t.i=void 0})):(e.__h.forEach(W),e.__h.forEach(Q),e.__h=[],A=0)),J=v},s.diffed=function(_){g_&&g_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(h_.push(e)!==1&&p_===s.requestAnimationFrame||((p_=s.requestAnimationFrame)||A_)(L_)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==F&&(t.__=t.__V),t.i=void 0,t.__V=F})),J=v=null},s.__c=function(_,e){e.some(function(t){try{t.__h.forEach(W),t.__h=t.__h.filter(function(n){return!n.__||Q(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],s.__e(n,t.__v)}}),y_&&y_(_,e)},s.unmount=function(_){b_&&b_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{W(n)}catch(r){e=r}}),t.__H=void 0,e&&s.__e(e,t.__v))};var C_=typeof requestAnimationFrame=="function";function A_(_){var e,t=function(){clearTimeout(n),C_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,100);C_&&(e=requestAnimationFrame(t))}function W(_){var e=v,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),v=e}function Q(_){var e=v;_.__c=_.__(),v=e}function F_(_,e){return!_||_.length!==e.length||e.some(function(t,n){return t!==_[n]})}function x_(_,e){return typeof e=="function"?e(_):e}var W_=0;function S_(_,e,t,n,r,i){var u,l,c={};for(l in e)l=="ref"?u=e[l]:c[l]=e[l];var f={type:_,props:c,key:t,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--W_,__i:-1,__u:0,__source:r,__self:i};if(typeof _=="function"&&(u=_.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return s.vnode&&s.vnode(f),f}class V_{constructor(){Y(this,"_context");Y(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(e=>{this._getContextCallbacks.push(e)})}setContext(e){this._context=e,this._getContextCallbacks.forEach(t=>t(e)),this._getContextCallbacks=[]}configureClient(e){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(e){console.log("Add to cart",e)}}let V;const B_=({context:_})=>{const[e,t]=I_(null);return U_(()=>{if(e){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({..._,container:e})}},[e,_]),S_("div",{ref:t,id:"spiffThemeWrapper"})};function O_(_,e){V=new V_,window.SpiffThemeLoader=V;let t;typeof _=="string"?t=document.getElementById(_):t=_,N_(S_(B_,{context:e}),t)}function q_(_){return{id:"example",themeInstallId:(_==null?void 0:_.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:[],..._}}b.AssetType=__,b.FieldType=S,b.ThemeFileType=k,b.exampleThemeInstallConfig=q_,b.setSpiffDevOptions=O_,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|