@spiffcommerce/theme-bridge 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +453 -0
- package/dist/index.umd.cjs +1 -0
- package/package.json +29 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { GetWorkflowOptions } from '@spiffcommerce/core';
|
|
2
|
+
|
|
3
|
+
interface SpiffThemeContextBase {
|
|
4
|
+
container: HTMLElement;
|
|
5
|
+
applicationKey: string;
|
|
6
|
+
}
|
|
7
|
+
interface GetNewBundleOptions {
|
|
8
|
+
productCollectionId?: string;
|
|
9
|
+
type: "new";
|
|
10
|
+
}
|
|
11
|
+
interface GetExistingBundleOptions {
|
|
12
|
+
bundleId: string;
|
|
13
|
+
type: "existing";
|
|
14
|
+
}
|
|
15
|
+
type GetBundleOptions = GetNewBundleOptions | GetExistingBundleOptions;
|
|
16
|
+
interface SpiffThemeContextBundle extends SpiffThemeContextBase {
|
|
17
|
+
bundleOptions: GetBundleOptions;
|
|
18
|
+
type: "bundle";
|
|
19
|
+
}
|
|
20
|
+
interface SpiffThemeContextTransaction extends SpiffThemeContextBase {
|
|
21
|
+
workflowOptions: GetWorkflowOptions;
|
|
22
|
+
type: "transaction";
|
|
23
|
+
}
|
|
24
|
+
type SpiffThemeContext = SpiffThemeContextTransaction | SpiffThemeContextBundle;
|
|
25
|
+
type SpiffThemeLoader = {
|
|
26
|
+
getContext(): Promise<SpiffThemeContext>;
|
|
27
|
+
setContext(context: SpiffThemeContext): void;
|
|
28
|
+
};
|
|
29
|
+
interface SpiffThemeConfigurationFile {
|
|
30
|
+
launchData: SpiffThemeLaunchData;
|
|
31
|
+
configurationSchema: SpiffThemeConfigurationSchema;
|
|
32
|
+
}
|
|
33
|
+
declare enum SpiffThemeFileType {
|
|
34
|
+
Javascript = "Javascript",
|
|
35
|
+
CSS = "CSS"
|
|
36
|
+
}
|
|
37
|
+
interface SpiffThemeLaunchData {
|
|
38
|
+
targetFiles: {
|
|
39
|
+
filename: string;
|
|
40
|
+
type: SpiffThemeFileType;
|
|
41
|
+
mimeType: string;
|
|
42
|
+
}[];
|
|
43
|
+
}
|
|
44
|
+
declare enum SpiffThemeConfigurationFieldType {
|
|
45
|
+
SingleLineText = "SingleLineText",
|
|
46
|
+
MultiLineText = "MultiLineText",
|
|
47
|
+
Heading = "Heading",
|
|
48
|
+
Number = "Number",
|
|
49
|
+
Boolean = "Boolean",
|
|
50
|
+
Select = "Select",
|
|
51
|
+
Asset = "Asset",
|
|
52
|
+
Color = "Color"
|
|
53
|
+
}
|
|
54
|
+
interface SpiffThemeConfigurationSchema {
|
|
55
|
+
fields: SpiffThemeConfigurationSchemaField[];
|
|
56
|
+
}
|
|
57
|
+
interface SpiffThemeConfigurationSchemaField {
|
|
58
|
+
key?: string;
|
|
59
|
+
type: SpiffThemeConfigurationFieldType;
|
|
60
|
+
title?: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
required?: boolean;
|
|
63
|
+
defaultValue?: string;
|
|
64
|
+
options?: {
|
|
65
|
+
key: string;
|
|
66
|
+
value: string;
|
|
67
|
+
}[];
|
|
68
|
+
assetType?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type SpiffDevOptions = Omit<SpiffThemeContextTransaction, "container"> | Omit<SpiffThemeContextBundle, "container">;
|
|
72
|
+
declare function setSpiffDevOptions(container: HTMLElement | string, context: SpiffDevOptions): void;
|
|
73
|
+
|
|
74
|
+
export { type GetBundleOptions, type SpiffDevOptions, SpiffThemeConfigurationFieldType, type SpiffThemeConfigurationFile, type SpiffThemeConfigurationSchema, type SpiffThemeConfigurationSchemaField, type SpiffThemeContext, type SpiffThemeContextBundle, type SpiffThemeContextTransaction, SpiffThemeFileType, type SpiffThemeLaunchData, type SpiffThemeLoader, setSpiffDevOptions };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
var x_ = Object.defineProperty;
|
|
2
|
+
var w_ = (_, e, t) => e in _ ? x_(_, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[e] = t;
|
|
3
|
+
var O = (_, e, t) => (w_(_, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
var H_ = /* @__PURE__ */ ((_) => (_.Javascript = "Javascript", _.CSS = "CSS", _))(H_ || {}), $_ = /* @__PURE__ */ ((_) => (_.SingleLineText = "SingleLineText", _.MultiLineText = "MultiLineText", _.Heading = "Heading", _.Number = "Number", _.Boolean = "Boolean", _.Select = "Select", _.Asset = "Asset", _.Color = "Color", _))($_ || {}), I, a, s_, H, Y, f_, j, S = {}, a_ = [], C_ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, J = Array.isArray;
|
|
5
|
+
function w(_, e) {
|
|
6
|
+
for (var t in e)
|
|
7
|
+
_[t] = e[t];
|
|
8
|
+
return _;
|
|
9
|
+
}
|
|
10
|
+
function p_(_) {
|
|
11
|
+
var e = _.parentNode;
|
|
12
|
+
e && e.removeChild(_);
|
|
13
|
+
}
|
|
14
|
+
function S_(_, e, t) {
|
|
15
|
+
var n, r, i, c = {};
|
|
16
|
+
for (i in e)
|
|
17
|
+
i == "key" ? n = e[i] : i == "ref" ? r = e[i] : c[i] = e[i];
|
|
18
|
+
if (arguments.length > 2 && (c.children = arguments.length > 3 ? I.call(arguments, 2) : t), typeof _ == "function" && _.defaultProps != null)
|
|
19
|
+
for (i in _.defaultProps)
|
|
20
|
+
c[i] === void 0 && (c[i] = _.defaultProps[i]);
|
|
21
|
+
return L(_, c, n, r, null);
|
|
22
|
+
}
|
|
23
|
+
function L(_, e, t, n, r) {
|
|
24
|
+
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 ?? ++s_, __i: -1, __u: 0 };
|
|
25
|
+
return r == null && a.vnode != null && a.vnode(i), i;
|
|
26
|
+
}
|
|
27
|
+
function V(_) {
|
|
28
|
+
return _.children;
|
|
29
|
+
}
|
|
30
|
+
function A(_, e) {
|
|
31
|
+
this.props = _, this.context = e;
|
|
32
|
+
}
|
|
33
|
+
function $(_, e) {
|
|
34
|
+
if (e == null)
|
|
35
|
+
return _.__ ? $(_.__, _.__i + 1) : null;
|
|
36
|
+
for (var t; e < _.__k.length; e++)
|
|
37
|
+
if ((t = _.__k[e]) != null && t.__e != null)
|
|
38
|
+
return t.__e;
|
|
39
|
+
return typeof _.type == "function" ? $(_) : null;
|
|
40
|
+
}
|
|
41
|
+
function h_(_) {
|
|
42
|
+
var e, t;
|
|
43
|
+
if ((_ = _.__) != null && _.__c != null) {
|
|
44
|
+
for (_.__e = _.__c.base = null, e = 0; e < _.__k.length; e++)
|
|
45
|
+
if ((t = _.__k[e]) != null && t.__e != null) {
|
|
46
|
+
_.__e = _.__c.base = t.__e;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return h_(_);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function Z(_) {
|
|
53
|
+
(!_.__d && (_.__d = !0) && H.push(_) && !W.__r++ || Y !== a.debounceRendering) && ((Y = a.debounceRendering) || f_)(W);
|
|
54
|
+
}
|
|
55
|
+
function W() {
|
|
56
|
+
var _, e, t, n, r, i, c, l, s;
|
|
57
|
+
for (H.sort(j); _ = H.shift(); )
|
|
58
|
+
_.__d && (e = H.length, n = void 0, i = (r = (t = _).__v).__e, l = [], s = [], (c = t.__P) && ((n = w({}, r)).__v = r.__v + 1, a.vnode && a.vnode(n), K(c, n, r, t.__n, c.ownerSVGElement !== void 0, 32 & r.__u ? [i] : null, l, i ?? $(r), !!(32 & r.__u), s), n.__.__k[n.__i] = n, y_(l, n, s), n.__e != i && h_(n)), H.length > e && H.sort(j));
|
|
59
|
+
W.__r = 0;
|
|
60
|
+
}
|
|
61
|
+
function d_(_, e, t, n, r, i, c, l, s, u, p) {
|
|
62
|
+
var o, h, f, y, k, m = n && n.__k || a_, d = e.length;
|
|
63
|
+
for (t.__d = s, E_(t, e, m), s = t.__d, o = 0; o < d; o++)
|
|
64
|
+
(f = t.__k[o]) != null && typeof f != "boolean" && typeof f != "function" && (h = f.__i === -1 ? S : m[f.__i] || S, f.__i = o, K(_, f, h, r, i, c, l, s, u, p), y = f.__e, f.ref && h.ref != f.ref && (h.ref && Q(h.ref, null, f), p.push(f.ref, f.__c || y, f)), k == null && y != null && (k = y), 65536 & f.__u || h.__k === f.__k ? s = v_(f, s, _) : typeof f.type == "function" && f.__d !== void 0 ? s = f.__d : y && (s = y.nextSibling), f.__d = void 0, f.__u &= -196609);
|
|
65
|
+
t.__d = s, t.__e = k;
|
|
66
|
+
}
|
|
67
|
+
function E_(_, e, t) {
|
|
68
|
+
var n, r, i, c, l, s = e.length, u = t.length, p = u, o = 0;
|
|
69
|
+
for (_.__k = [], n = 0; n < s; n++)
|
|
70
|
+
(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 ? L(null, r, null, null, r) : J(r) ? L(V, { children: r }, null, null, null) : r.constructor === void 0 && r.__b > 0 ? L(r.type, r.props, r.key, r.ref ? r.ref : null, r.__v) : r) != null ? (r.__ = _, r.__b = _.__b + 1, l = P_(r, t, c = n + o, p), r.__i = l, i = null, l !== -1 && (p--, (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 ? p > s - 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 = $(i)), z(i, i, !1), t[n] = null, p--);
|
|
71
|
+
if (p)
|
|
72
|
+
for (n = 0; n < u; n++)
|
|
73
|
+
(i = t[n]) != null && !(131072 & i.__u) && (i.__e == _.__d && (_.__d = $(i)), z(i, i));
|
|
74
|
+
}
|
|
75
|
+
function v_(_, e, t) {
|
|
76
|
+
var n, r;
|
|
77
|
+
if (typeof _.type == "function") {
|
|
78
|
+
for (n = _.__k, r = 0; n && r < n.length; r++)
|
|
79
|
+
n[r] && (n[r].__ = _, e = v_(n[r], e, t));
|
|
80
|
+
return e;
|
|
81
|
+
}
|
|
82
|
+
return _.__e != e && (t.insertBefore(_.__e, e || null), e = _.__e), e && e.nextSibling;
|
|
83
|
+
}
|
|
84
|
+
function P_(_, e, t, n) {
|
|
85
|
+
var r = _.key, i = _.type, c = t - 1, l = t + 1, s = e[t];
|
|
86
|
+
if (s === null || s && r == s.key && i === s.type)
|
|
87
|
+
return t;
|
|
88
|
+
if (n > (s != null && !(131072 & s.__u) ? 1 : 0))
|
|
89
|
+
for (; c >= 0 || l < e.length; ) {
|
|
90
|
+
if (c >= 0) {
|
|
91
|
+
if ((s = e[c]) && !(131072 & s.__u) && r == s.key && i === s.type)
|
|
92
|
+
return c;
|
|
93
|
+
c--;
|
|
94
|
+
}
|
|
95
|
+
if (l < e.length) {
|
|
96
|
+
if ((s = e[l]) && !(131072 & s.__u) && r == s.key && i === s.type)
|
|
97
|
+
return l;
|
|
98
|
+
l++;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return -1;
|
|
102
|
+
}
|
|
103
|
+
function __(_, e, t) {
|
|
104
|
+
e[0] === "-" ? _.setProperty(e, t ?? "") : _[e] = t == null ? "" : typeof t != "number" || C_.test(e) ? t : t + "px";
|
|
105
|
+
}
|
|
106
|
+
function D(_, e, t, n, r) {
|
|
107
|
+
var i;
|
|
108
|
+
_:
|
|
109
|
+
if (e === "style")
|
|
110
|
+
if (typeof t == "string")
|
|
111
|
+
_.style.cssText = t;
|
|
112
|
+
else {
|
|
113
|
+
if (typeof n == "string" && (_.style.cssText = n = ""), n)
|
|
114
|
+
for (e in n)
|
|
115
|
+
t && e in t || __(_.style, e, "");
|
|
116
|
+
if (t)
|
|
117
|
+
for (e in t)
|
|
118
|
+
n && t[e] === n[e] || __(_.style, e, t[e]);
|
|
119
|
+
}
|
|
120
|
+
else if (e[0] === "o" && e[1] === "n")
|
|
121
|
+
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 ? t_ : e_, i)) : _.removeEventListener(e, i ? t_ : e_, i);
|
|
122
|
+
else {
|
|
123
|
+
if (r)
|
|
124
|
+
e = e.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
125
|
+
else if (e !== "width" && e !== "height" && e !== "href" && e !== "list" && e !== "form" && e !== "tabIndex" && e !== "download" && e !== "rowSpan" && e !== "colSpan" && e !== "role" && e in _)
|
|
126
|
+
try {
|
|
127
|
+
_[e] = t ?? "";
|
|
128
|
+
break _;
|
|
129
|
+
} catch {
|
|
130
|
+
}
|
|
131
|
+
typeof t == "function" || (t == null || t === !1 && e[4] !== "-" ? _.removeAttribute(e) : _.setAttribute(e, t));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function e_(_) {
|
|
135
|
+
var e = this.l[_.type + !1];
|
|
136
|
+
if (_.t) {
|
|
137
|
+
if (_.t <= e.u)
|
|
138
|
+
return;
|
|
139
|
+
} else
|
|
140
|
+
_.t = Date.now();
|
|
141
|
+
return e(a.event ? a.event(_) : _);
|
|
142
|
+
}
|
|
143
|
+
function t_(_) {
|
|
144
|
+
return this.l[_.type + !0](a.event ? a.event(_) : _);
|
|
145
|
+
}
|
|
146
|
+
function K(_, e, t, n, r, i, c, l, s, u) {
|
|
147
|
+
var p, o, h, f, y, k, m, d, g, x, E, C, X, P, q, b = e.type;
|
|
148
|
+
if (e.constructor !== void 0)
|
|
149
|
+
return null;
|
|
150
|
+
128 & t.__u && (s = !!(32 & t.__u), i = [l = e.__e = t.__e]), (p = a.__b) && p(e);
|
|
151
|
+
_:
|
|
152
|
+
if (typeof b == "function")
|
|
153
|
+
try {
|
|
154
|
+
if (d = e.props, g = (p = b.contextType) && n[p.__c], x = p ? g ? g.props.value : p.__ : n, t.__c ? m = (o = e.__c = t.__c).__ = o.__E : ("prototype" in b && b.prototype.render ? e.__c = o = new b(d, x) : (e.__c = o = new A(d, x), o.constructor = b, o.render = D_), g && g.sub(o), o.props = d, o.state || (o.state = {}), o.context = x, o.__n = n, h = o.__d = !0, o.__h = [], o._sb = []), o.__s == null && (o.__s = o.state), b.getDerivedStateFromProps != null && (o.__s == o.state && (o.__s = w({}, o.__s)), w(o.__s, b.getDerivedStateFromProps(d, o.__s))), f = o.props, y = o.state, o.__v = e, h)
|
|
155
|
+
b.getDerivedStateFromProps == null && o.componentWillMount != null && o.componentWillMount(), o.componentDidMount != null && o.__h.push(o.componentDidMount);
|
|
156
|
+
else {
|
|
157
|
+
if (b.getDerivedStateFromProps == null && d !== f && o.componentWillReceiveProps != null && o.componentWillReceiveProps(d, x), !o.__e && (o.shouldComponentUpdate != null && o.shouldComponentUpdate(d, o.__s, x) === !1 || e.__v === t.__v)) {
|
|
158
|
+
for (e.__v !== t.__v && (o.props = d, o.state = o.__s, o.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.forEach(function(N) {
|
|
159
|
+
N && (N.__ = e);
|
|
160
|
+
}), E = 0; E < o._sb.length; E++)
|
|
161
|
+
o.__h.push(o._sb[E]);
|
|
162
|
+
o._sb = [], o.__h.length && c.push(o);
|
|
163
|
+
break _;
|
|
164
|
+
}
|
|
165
|
+
o.componentWillUpdate != null && o.componentWillUpdate(d, o.__s, x), o.componentDidUpdate != null && o.__h.push(function() {
|
|
166
|
+
o.componentDidUpdate(f, y, k);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (o.context = x, o.props = d, o.__P = _, o.__e = !1, C = a.__r, X = 0, "prototype" in b && b.prototype.render) {
|
|
170
|
+
for (o.state = o.__s, o.__d = !1, C && C(e), p = o.render(o.props, o.state, o.context), P = 0; P < o._sb.length; P++)
|
|
171
|
+
o.__h.push(o._sb[P]);
|
|
172
|
+
o._sb = [];
|
|
173
|
+
} else
|
|
174
|
+
do
|
|
175
|
+
o.__d = !1, C && C(e), p = o.render(o.props, o.state, o.context), o.state = o.__s;
|
|
176
|
+
while (o.__d && ++X < 25);
|
|
177
|
+
o.state = o.__s, o.getChildContext != null && (n = w(w({}, n), o.getChildContext())), h || o.getSnapshotBeforeUpdate == null || (k = o.getSnapshotBeforeUpdate(f, y)), d_(_, J(q = p != null && p.type === V && p.key == null ? p.props.children : p) ? q : [q], e, t, n, r, i, c, l, s, u), o.base = e.__e, e.__u &= -161, o.__h.length && c.push(o), m && (o.__E = o.__ = null);
|
|
178
|
+
} catch (N) {
|
|
179
|
+
e.__v = null, s || i != null ? (e.__e = l, e.__u |= s ? 160 : 32, i[i.indexOf(l)] = null) : (e.__e = t.__e, e.__k = t.__k), a.__e(N, e, t);
|
|
180
|
+
}
|
|
181
|
+
else
|
|
182
|
+
i == null && e.__v === t.__v ? (e.__k = t.__k, e.__e = t.__e) : e.__e = N_(t.__e, e, t, n, r, i, c, s, u);
|
|
183
|
+
(p = a.diffed) && p(e);
|
|
184
|
+
}
|
|
185
|
+
function y_(_, e, t) {
|
|
186
|
+
e.__d = void 0;
|
|
187
|
+
for (var n = 0; n < t.length; n++)
|
|
188
|
+
Q(t[n], t[++n], t[++n]);
|
|
189
|
+
a.__c && a.__c(e, _), _.some(function(r) {
|
|
190
|
+
try {
|
|
191
|
+
_ = r.__h, r.__h = [], _.some(function(i) {
|
|
192
|
+
i.call(r);
|
|
193
|
+
});
|
|
194
|
+
} catch (i) {
|
|
195
|
+
a.__e(i, r.__v);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function N_(_, e, t, n, r, i, c, l, s) {
|
|
200
|
+
var u, p, o, h, f, y, k, m = t.props, d = e.props, g = e.type;
|
|
201
|
+
if (g === "svg" && (r = !0), i != null) {
|
|
202
|
+
for (u = 0; u < i.length; u++)
|
|
203
|
+
if ((f = i[u]) && "setAttribute" in f == !!g && (g ? f.localName === g : f.nodeType === 3)) {
|
|
204
|
+
_ = f, i[u] = null;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (_ == null) {
|
|
209
|
+
if (g === null)
|
|
210
|
+
return document.createTextNode(d);
|
|
211
|
+
_ = r ? document.createElementNS("http://www.w3.org/2000/svg", g) : document.createElement(g, d.is && d), i = null, l = !1;
|
|
212
|
+
}
|
|
213
|
+
if (g === null)
|
|
214
|
+
m === d || l && _.data === d || (_.data = d);
|
|
215
|
+
else {
|
|
216
|
+
if (i = i && I.call(_.childNodes), m = t.props || S, !l && i != null)
|
|
217
|
+
for (m = {}, u = 0; u < _.attributes.length; u++)
|
|
218
|
+
m[(f = _.attributes[u]).name] = f.value;
|
|
219
|
+
for (u in m)
|
|
220
|
+
f = m[u], u == "children" || (u == "dangerouslySetInnerHTML" ? o = f : u === "key" || u in d || D(_, u, null, f, r));
|
|
221
|
+
for (u in d)
|
|
222
|
+
f = d[u], u == "children" ? h = f : u == "dangerouslySetInnerHTML" ? p = f : u == "value" ? y = f : u == "checked" ? k = f : u === "key" || l && typeof f != "function" || m[u] === f || D(_, u, f, m[u], r);
|
|
223
|
+
if (p)
|
|
224
|
+
l || o && (p.__html === o.__html || p.__html === _.innerHTML) || (_.innerHTML = p.__html), e.__k = [];
|
|
225
|
+
else if (o && (_.innerHTML = ""), d_(_, J(h) ? h : [h], e, t, n, r && g !== "foreignObject", i, c, i ? i[0] : t.__k && $(t, 0), l, s), i != null)
|
|
226
|
+
for (u = i.length; u--; )
|
|
227
|
+
i[u] != null && p_(i[u]);
|
|
228
|
+
l || (u = "value", y !== void 0 && (y !== _[u] || g === "progress" && !y || g === "option" && y !== m[u]) && D(_, u, y, m[u], !1), u = "checked", k !== void 0 && k !== _[u] && D(_, u, k, m[u], !1));
|
|
229
|
+
}
|
|
230
|
+
return _;
|
|
231
|
+
}
|
|
232
|
+
function Q(_, e, t) {
|
|
233
|
+
try {
|
|
234
|
+
typeof _ == "function" ? _(e) : _.current = e;
|
|
235
|
+
} catch (n) {
|
|
236
|
+
a.__e(n, t);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function z(_, e, t) {
|
|
240
|
+
var n, r;
|
|
241
|
+
if (a.unmount && a.unmount(_), (n = _.ref) && (n.current && n.current !== _.__e || Q(n, null, e)), (n = _.__c) != null) {
|
|
242
|
+
if (n.componentWillUnmount)
|
|
243
|
+
try {
|
|
244
|
+
n.componentWillUnmount();
|
|
245
|
+
} catch (i) {
|
|
246
|
+
a.__e(i, e);
|
|
247
|
+
}
|
|
248
|
+
n.base = n.__P = null, _.__c = void 0;
|
|
249
|
+
}
|
|
250
|
+
if (n = _.__k)
|
|
251
|
+
for (r = 0; r < n.length; r++)
|
|
252
|
+
n[r] && z(n[r], e, t || typeof _.type != "function");
|
|
253
|
+
t || _.__e == null || p_(_.__e), _.__ = _.__e = _.__d = void 0;
|
|
254
|
+
}
|
|
255
|
+
function D_(_, e, t) {
|
|
256
|
+
return this.constructor(_, t);
|
|
257
|
+
}
|
|
258
|
+
function L_(_, e, t) {
|
|
259
|
+
var n, r, i, c;
|
|
260
|
+
a.__ && a.__(_, e), r = (n = typeof t == "function") ? null : t && t.__k || e.__k, i = [], c = [], K(e, _ = (!n && t || e).__k = S_(V, null, [_]), r || S, S, e.ownerSVGElement !== void 0, !n && t ? [t] : r ? null : e.firstChild ? I.call(e.childNodes) : null, i, !n && t ? t : r ? r.__e : e.firstChild, n, c), y_(i, _, c);
|
|
261
|
+
}
|
|
262
|
+
I = a_.slice, a = { __e: function(_, e, t, n) {
|
|
263
|
+
for (var r, i, c; e = e.__; )
|
|
264
|
+
if ((r = e.__c) && !r.__)
|
|
265
|
+
try {
|
|
266
|
+
if ((i = r.constructor) && i.getDerivedStateFromError != null && (r.setState(i.getDerivedStateFromError(_)), c = r.__d), r.componentDidCatch != null && (r.componentDidCatch(_, n || {}), c = r.__d), c)
|
|
267
|
+
return r.__E = r;
|
|
268
|
+
} catch (l) {
|
|
269
|
+
_ = l;
|
|
270
|
+
}
|
|
271
|
+
throw _;
|
|
272
|
+
} }, s_ = 0, A.prototype.setState = function(_, e) {
|
|
273
|
+
var t;
|
|
274
|
+
t = this.__s != null && this.__s !== this.state ? this.__s : this.__s = w({}, this.state), typeof _ == "function" && (_ = _(w({}, t), this.props)), _ && w(t, _), _ != null && this.__v && (e && this._sb.push(e), Z(this));
|
|
275
|
+
}, A.prototype.forceUpdate = function(_) {
|
|
276
|
+
this.__v && (this.__e = !0, _ && this.__h.push(_), Z(this));
|
|
277
|
+
}, A.prototype.render = V, H = [], f_ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, j = function(_, e) {
|
|
278
|
+
return _.__v.__b - e.__v.__b;
|
|
279
|
+
}, W.__r = 0;
|
|
280
|
+
var T, v, R, n_, F = 0, m_ = [], U = [], o_ = a.__b, r_ = a.__r, i_ = a.diffed, l_ = a.__c, u_ = a.unmount;
|
|
281
|
+
function g_(_, e) {
|
|
282
|
+
a.__h && a.__h(v, _, F || e), F = 0;
|
|
283
|
+
var t = v.__H || (v.__H = { __: [], __h: [] });
|
|
284
|
+
return _ >= t.__.length && t.__.push({ __V: U }), t.__[_];
|
|
285
|
+
}
|
|
286
|
+
function A_(_) {
|
|
287
|
+
return F = 1, U_(b_, _);
|
|
288
|
+
}
|
|
289
|
+
function U_(_, e, t) {
|
|
290
|
+
var n = g_(T++, 2);
|
|
291
|
+
if (n.t = _, !n.__c && (n.__ = [t ? t(e) : b_(void 0, e), function(l) {
|
|
292
|
+
var s = n.__N ? n.__N[0] : n.__[0], u = n.t(s, l);
|
|
293
|
+
s !== u && (n.__N = [u, n.__[1]], n.__c.setState({}));
|
|
294
|
+
}], n.__c = v, !v.u)) {
|
|
295
|
+
var r = function(l, s, u) {
|
|
296
|
+
if (!n.__c.__H)
|
|
297
|
+
return !0;
|
|
298
|
+
var p = n.__c.__H.__.filter(function(h) {
|
|
299
|
+
return h.__c;
|
|
300
|
+
});
|
|
301
|
+
if (p.every(function(h) {
|
|
302
|
+
return !h.__N;
|
|
303
|
+
}))
|
|
304
|
+
return !i || i.call(this, l, s, u);
|
|
305
|
+
var o = !1;
|
|
306
|
+
return p.forEach(function(h) {
|
|
307
|
+
if (h.__N) {
|
|
308
|
+
var f = h.__[0];
|
|
309
|
+
h.__ = h.__N, h.__N = void 0, f !== h.__[0] && (o = !0);
|
|
310
|
+
}
|
|
311
|
+
}), !(!o && n.__c.props === l) && (!i || i.call(this, l, s, u));
|
|
312
|
+
};
|
|
313
|
+
v.u = !0;
|
|
314
|
+
var i = v.shouldComponentUpdate, c = v.componentWillUpdate;
|
|
315
|
+
v.componentWillUpdate = function(l, s, u) {
|
|
316
|
+
if (this.__e) {
|
|
317
|
+
var p = i;
|
|
318
|
+
i = void 0, r(l, s, u), i = p;
|
|
319
|
+
}
|
|
320
|
+
c && c.call(this, l, s, u);
|
|
321
|
+
}, v.shouldComponentUpdate = r;
|
|
322
|
+
}
|
|
323
|
+
return n.__N || n.__;
|
|
324
|
+
}
|
|
325
|
+
function M_(_, e) {
|
|
326
|
+
var t = g_(T++, 3);
|
|
327
|
+
!a.__s && B_(t.__H, e) && (t.__ = _, t.i = e, v.__H.__h.push(t));
|
|
328
|
+
}
|
|
329
|
+
function W_() {
|
|
330
|
+
for (var _; _ = m_.shift(); )
|
|
331
|
+
if (_.__P && _.__H)
|
|
332
|
+
try {
|
|
333
|
+
_.__H.__h.forEach(M), _.__H.__h.forEach(G), _.__H.__h = [];
|
|
334
|
+
} catch (e) {
|
|
335
|
+
_.__H.__h = [], a.__e(e, _.__v);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
a.__b = function(_) {
|
|
339
|
+
v = null, o_ && o_(_);
|
|
340
|
+
}, a.__r = function(_) {
|
|
341
|
+
r_ && r_(_), T = 0;
|
|
342
|
+
var e = (v = _.__c).__H;
|
|
343
|
+
e && (R === v ? (e.__h = [], v.__h = [], e.__.forEach(function(t) {
|
|
344
|
+
t.__N && (t.__ = t.__N), t.__V = U, t.__N = t.i = void 0;
|
|
345
|
+
})) : (e.__h.forEach(M), e.__h.forEach(G), e.__h = [], T = 0)), R = v;
|
|
346
|
+
}, a.diffed = function(_) {
|
|
347
|
+
i_ && i_(_);
|
|
348
|
+
var e = _.__c;
|
|
349
|
+
e && e.__H && (e.__H.__h.length && (m_.push(e) !== 1 && n_ === a.requestAnimationFrame || ((n_ = a.requestAnimationFrame) || T_)(W_)), e.__H.__.forEach(function(t) {
|
|
350
|
+
t.i && (t.__H = t.i), t.__V !== U && (t.__ = t.__V), t.i = void 0, t.__V = U;
|
|
351
|
+
})), R = v = null;
|
|
352
|
+
}, a.__c = function(_, e) {
|
|
353
|
+
e.some(function(t) {
|
|
354
|
+
try {
|
|
355
|
+
t.__h.forEach(M), t.__h = t.__h.filter(function(n) {
|
|
356
|
+
return !n.__ || G(n);
|
|
357
|
+
});
|
|
358
|
+
} catch (n) {
|
|
359
|
+
e.some(function(r) {
|
|
360
|
+
r.__h && (r.__h = []);
|
|
361
|
+
}), e = [], a.__e(n, t.__v);
|
|
362
|
+
}
|
|
363
|
+
}), l_ && l_(_, e);
|
|
364
|
+
}, a.unmount = function(_) {
|
|
365
|
+
u_ && u_(_);
|
|
366
|
+
var e, t = _.__c;
|
|
367
|
+
t && t.__H && (t.__H.__.forEach(function(n) {
|
|
368
|
+
try {
|
|
369
|
+
M(n);
|
|
370
|
+
} catch (r) {
|
|
371
|
+
e = r;
|
|
372
|
+
}
|
|
373
|
+
}), t.__H = void 0, e && a.__e(e, t.__v));
|
|
374
|
+
};
|
|
375
|
+
var c_ = typeof requestAnimationFrame == "function";
|
|
376
|
+
function T_(_) {
|
|
377
|
+
var e, t = function() {
|
|
378
|
+
clearTimeout(n), c_ && cancelAnimationFrame(e), setTimeout(_);
|
|
379
|
+
}, n = setTimeout(t, 100);
|
|
380
|
+
c_ && (e = requestAnimationFrame(t));
|
|
381
|
+
}
|
|
382
|
+
function M(_) {
|
|
383
|
+
var e = v, t = _.__c;
|
|
384
|
+
typeof t == "function" && (_.__c = void 0, t()), v = e;
|
|
385
|
+
}
|
|
386
|
+
function G(_) {
|
|
387
|
+
var e = v;
|
|
388
|
+
_.__c = _.__(), v = e;
|
|
389
|
+
}
|
|
390
|
+
function B_(_, e) {
|
|
391
|
+
return !_ || _.length !== e.length || e.some(function(t, n) {
|
|
392
|
+
return t !== _[n];
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function b_(_, e) {
|
|
396
|
+
return typeof e == "function" ? e(_) : e;
|
|
397
|
+
}
|
|
398
|
+
var I_ = 0;
|
|
399
|
+
function k_(_, e, t, n, r, i) {
|
|
400
|
+
var c, l, s = {};
|
|
401
|
+
for (l in e)
|
|
402
|
+
l == "ref" ? c = e[l] : s[l] = e[l];
|
|
403
|
+
var u = { type: _, props: s, key: t, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --I_, __i: -1, __u: 0, __source: r, __self: i };
|
|
404
|
+
if (typeof _ == "function" && (c = _.defaultProps))
|
|
405
|
+
for (l in c)
|
|
406
|
+
s[l] === void 0 && (s[l] = c[l]);
|
|
407
|
+
return a.vnode && a.vnode(u), u;
|
|
408
|
+
}
|
|
409
|
+
class V_ {
|
|
410
|
+
constructor() {
|
|
411
|
+
O(this, "_context");
|
|
412
|
+
O(this, "_getContextCallbacks", []);
|
|
413
|
+
}
|
|
414
|
+
async getContext() {
|
|
415
|
+
return this._context ? this._context : new Promise((e) => {
|
|
416
|
+
this._getContextCallbacks.push(e);
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
setContext(e) {
|
|
420
|
+
this._context = e, this._getContextCallbacks.forEach((t) => t(e)), this._getContextCallbacks = [];
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
let B;
|
|
424
|
+
const q_ = ({
|
|
425
|
+
context: _
|
|
426
|
+
}) => {
|
|
427
|
+
const [e, t] = A_(null);
|
|
428
|
+
return M_(() => {
|
|
429
|
+
if (e) {
|
|
430
|
+
if (B === void 0)
|
|
431
|
+
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
432
|
+
B.setContext({
|
|
433
|
+
..._,
|
|
434
|
+
container: e
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}, [e, _]), k_("div", {
|
|
438
|
+
ref: t,
|
|
439
|
+
id: "spiffThemeWrapper"
|
|
440
|
+
});
|
|
441
|
+
};
|
|
442
|
+
function R_(_, e) {
|
|
443
|
+
B = new V_(), window.SpiffThemeLoader = B;
|
|
444
|
+
let t;
|
|
445
|
+
typeof _ == "string" ? t = document.getElementById(_) : t = _, L_(k_(q_, {
|
|
446
|
+
context: e
|
|
447
|
+
}), t);
|
|
448
|
+
}
|
|
449
|
+
export {
|
|
450
|
+
$_ as SpiffThemeConfigurationFieldType,
|
|
451
|
+
H_ as SpiffThemeFileType,
|
|
452
|
+
R_ as setSpiffDevOptions
|
|
453
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(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 q_=Object.defineProperty;var j_=(b,k,w)=>k in b?q_(b,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):b[k]=w;var Z=(b,k,w)=>(j_(b,typeof k!="symbol"?k+"":k,w),w);var k=(_=>(_.Javascript="Javascript",_.CSS="CSS",_))(k||{}),w=(_=>(_.SingleLineText="SingleLineText",_.MultiLineText="MultiLineText",_.Heading="Heading",_.Number="Number",_.Boolean="Boolean",_.Select="Select",_.Asset="Asset",_.Color="Color",_))(w||{}),D,a,__,$,e_,t_,F,P={},n_=[],H_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,R=Array.isArray;function H(_,e){for(var t in e)_[t]=e[t];return _}function o_(_){var e=_.parentNode;e&&e.removeChild(_)}function C_(_,e,t){var n,r,i,f={};for(i in e)i=="key"?n=e[i]:i=="ref"?r=e[i]:f[i]=e[i];if(arguments.length>2&&(f.children=arguments.length>3?D.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(i in _.defaultProps)f[i]===void 0&&(f[i]=_.defaultProps[i]);return L(_,f,n,r,null)}function L(_,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??++__,__i:-1,__u:0};return r==null&&a.vnode!=null&&a.vnode(i),i}function A(_){return _.children}function T(_,e){this.props=_,this.context=e}function E(_,e){if(e==null)return _.__?E(_.__,_.__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"?E(_):null}function r_(_){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 r_(_)}}function i_(_){(!_.__d&&(_.__d=!0)&&$.push(_)&&!U.__r++||e_!==a.debounceRendering)&&((e_=a.debounceRendering)||t_)(U)}function U(){var _,e,t,n,r,i,f,l,c;for($.sort(F);_=$.shift();)_.__d&&(e=$.length,n=void 0,i=(r=(t=_).__v).__e,l=[],c=[],(f=t.__P)&&((n=H({},r)).__v=r.__v+1,a.vnode&&a.vnode(n),z(f,n,r,t.__n,f.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??E(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,a_(l,n,c),n.__e!=i&&r_(n)),$.length>e&&$.sort(F));U.__r=0}function l_(_,e,t,n,r,i,f,l,c,u,p){var o,d,s,y,S,m=n&&n.__k||n_,h=e.length;for(t.__d=c,$_(t,e,m),c=t.__d,o=0;o<h;o++)(s=t.__k[o])!=null&&typeof s!="boolean"&&typeof s!="function"&&(d=s.__i===-1?P:m[s.__i]||P,s.__i=o,z(_,s,d,r,i,f,l,c,u,p),y=s.__e,s.ref&&d.ref!=s.ref&&(d.ref&&G(d.ref,null,s),p.push(s.ref,s.__c||y,s)),S==null&&y!=null&&(S=y),65536&s.__u||d.__k===s.__k?c=u_(s,c,_):typeof s.type=="function"&&s.__d!==void 0?c=s.__d:y&&(c=y.nextSibling),s.__d=void 0,s.__u&=-196609);t.__d=c,t.__e=S}function $_(_,e,t){var n,r,i,f,l,c=e.length,u=t.length,p=u,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?L(null,r,null,null,r):R(r)?L(A,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?L(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=_,r.__b=_.__b+1,l=E_(r,t,f=n+o,p),r.__i=l,i=null,l!==-1&&(p--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&o--,typeof r.type!="function"&&(r.__u|=65536)):l!==f&&(l===f+1?o++:l>f?p>c-f?o+=l-f:o--:o=l<f&&l==f-1?l-f:0,l!==n+o&&(r.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==_.__d&&(_.__d=E(i)),J(i,i,!1),t[n]=null,p--);if(p)for(n=0;n<u;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==_.__d&&(_.__d=E(i)),J(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 E_(_,e,t,n){var r=_.key,i=_.type,f=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(;f>=0||l<e.length;){if(f>=0){if((c=e[f])&&!(131072&c.__u)&&r==c.key&&i===c.type)return f;f--}if(l<e.length){if((c=e[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function f_(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||H_.test(e)?t:t+"px"}function M(_,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||f_(_.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||f_(_.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_:c_,i)):_.removeEventListener(e,i?s_:c_,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 c_(_){var e=this.l[_.type+!1];if(_.t){if(_.t<=e.u)return}else _.t=Date.now();return e(a.event?a.event(_):_)}function s_(_){return this.l[_.type+!0](a.event?a.event(_):_)}function z(_,e,t,n,r,i,f,l,c,u){var p,o,d,s,y,S,m,h,g,C,V,N,w_,q,Y,x=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),i=[l=e.__e=t.__e]),(p=a.__b)&&p(e);_:if(typeof x=="function")try{if(h=e.props,g=(p=x.contextType)&&n[p.__c],C=p?g?g.props.value:p.__:n,t.__c?m=(o=e.__c=t.__c).__=o.__E:("prototype"in x&&x.prototype.render?e.__c=o=new x(h,C):(e.__c=o=new T(h,C),o.constructor=x,o.render=N_),g&&g.sub(o),o.props=h,o.state||(o.state={}),o.context=C,o.__n=n,d=o.__d=!0,o.__h=[],o._sb=[]),o.__s==null&&(o.__s=o.state),x.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=H({},o.__s)),H(o.__s,x.getDerivedStateFromProps(h,o.__s))),s=o.props,y=o.state,o.__v=e,d)x.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==s&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,C),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,C)===!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(j){j&&(j.__=e)}),V=0;V<o._sb.length;V++)o.__h.push(o._sb[V]);o._sb=[],o.__h.length&&f.push(o);break _}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,C),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(s,y,S)})}if(o.context=C,o.props=h,o.__P=_,o.__e=!1,N=a.__r,w_=0,"prototype"in x&&x.prototype.render){for(o.state=o.__s,o.__d=!1,N&&N(e),p=o.render(o.props,o.state,o.context),q=0;q<o._sb.length;q++)o.__h.push(o._sb[q]);o._sb=[]}else do o.__d=!1,N&&N(e),p=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++w_<25);o.state=o.__s,o.getChildContext!=null&&(n=H(H({},n),o.getChildContext())),d||o.getSnapshotBeforeUpdate==null||(S=o.getSnapshotBeforeUpdate(s,y)),l_(_,R(Y=p!=null&&p.type===A&&p.key==null?p.props.children:p)?Y:[Y],e,t,n,r,i,f,l,c,u),o.base=e.__e,e.__u&=-161,o.__h.length&&f.push(o),m&&(o.__E=o.__=null)}catch(j){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),a.__e(j,e,t)}else i==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=P_(t.__e,e,t,n,r,i,f,c,u);(p=a.diffed)&&p(e)}function a_(_,e,t){e.__d=void 0;for(var n=0;n<t.length;n++)G(t[n],t[++n],t[++n]);a.__c&&a.__c(e,_),_.some(function(r){try{_=r.__h,r.__h=[],_.some(function(i){i.call(r)})}catch(i){a.__e(i,r.__v)}})}function P_(_,e,t,n,r,i,f,l,c){var u,p,o,d,s,y,S,m=t.props,h=e.props,g=e.type;if(g==="svg"&&(r=!0),i!=null){for(u=0;u<i.length;u++)if((s=i[u])&&"setAttribute"in s==!!g&&(g?s.localName===g:s.nodeType===3)){_=s,i[u]=null;break}}if(_==null){if(g===null)return document.createTextNode(h);_=r?document.createElementNS("http://www.w3.org/2000/svg",g):document.createElement(g,h.is&&h),i=null,l=!1}if(g===null)m===h||l&&_.data===h||(_.data=h);else{if(i=i&&D.call(_.childNodes),m=t.props||P,!l&&i!=null)for(m={},u=0;u<_.attributes.length;u++)m[(s=_.attributes[u]).name]=s.value;for(u in m)s=m[u],u=="children"||(u=="dangerouslySetInnerHTML"?o=s:u==="key"||u in h||M(_,u,null,s,r));for(u in h)s=h[u],u=="children"?d=s:u=="dangerouslySetInnerHTML"?p=s:u=="value"?y=s:u=="checked"?S=s:u==="key"||l&&typeof s!="function"||m[u]===s||M(_,u,s,m[u],r);if(p)l||o&&(p.__html===o.__html||p.__html===_.innerHTML)||(_.innerHTML=p.__html),e.__k=[];else if(o&&(_.innerHTML=""),l_(_,R(d)?d:[d],e,t,n,r&&g!=="foreignObject",i,f,i?i[0]:t.__k&&E(t,0),l,c),i!=null)for(u=i.length;u--;)i[u]!=null&&o_(i[u]);l||(u="value",y!==void 0&&(y!==_[u]||g==="progress"&&!y||g==="option"&&y!==m[u])&&M(_,u,y,m[u],!1),u="checked",S!==void 0&&S!==_[u]&&M(_,u,S,m[u],!1))}return _}function G(_,e,t){try{typeof _=="function"?_(e):_.current=e}catch(n){a.__e(n,t)}}function J(_,e,t){var n,r;if(a.unmount&&a.unmount(_),(n=_.ref)&&(n.current&&n.current!==_.__e||G(n,null,e)),(n=_.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){a.__e(i,e)}n.base=n.__P=null,_.__c=void 0}if(n=_.__k)for(r=0;r<n.length;r++)n[r]&&J(n[r],e,t||typeof _.type!="function");t||_.__e==null||o_(_.__e),_.__=_.__e=_.__d=void 0}function N_(_,e,t){return this.constructor(_,t)}function D_(_,e,t){var n,r,i,f;a.__&&a.__(_,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,i=[],f=[],z(e,_=(!n&&t||e).__k=C_(A,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,f),a_(i,_,f)}D=n_.slice,a={__e:function(_,e,t,n){for(var r,i,f;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(_)),f=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(_,n||{}),f=r.__d),f)return r.__E=r}catch(l){_=l}throw _}},__=0,T.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=H({},this.state),typeof _=="function"&&(_=_(H({},t),this.props)),_&&H(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),i_(this))},T.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),i_(this))},T.prototype.render=A,$=[],t_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,F=function(_,e){return _.__v.__b-e.__v.__b},U.__r=0;var W,v,K,p_,Q=0,d_=[],B=[],h_=a.__b,v_=a.__r,y_=a.diffed,m_=a.__c,g_=a.unmount;function b_(_,e){a.__h&&a.__h(v,_,Q||e),Q=0;var t=v.__H||(v.__H={__:[],__h:[]});return _>=t.__.length&&t.__.push({__V:B}),t.__[_]}function L_(_){return Q=1,A_(x_,_)}function A_(_,e,t){var n=b_(W++,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],u=n.t(c,l);c!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var r=function(l,c,u){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,u);var o=!1;return p.forEach(function(d){if(d.__N){var s=d.__[0];d.__=d.__N,d.__N=void 0,s!==d.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,u))};v.u=!0;var i=v.shouldComponentUpdate,f=v.componentWillUpdate;v.componentWillUpdate=function(l,c,u){if(this.__e){var p=i;i=void 0,r(l,c,u),i=p}f&&f.call(this,l,c,u)},v.shouldComponentUpdate=r}return n.__N||n.__}function T_(_,e){var t=b_(W++,3);!a.__s&&W_(t.__H,e)&&(t.__=_,t.i=e,v.__H.__h.push(t))}function U_(){for(var _;_=d_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(I),_.__H.__h.forEach(X),_.__H.__h=[]}catch(e){_.__H.__h=[],a.__e(e,_.__v)}}a.__b=function(_){v=null,h_&&h_(_)},a.__r=function(_){v_&&v_(_),W=0;var e=(v=_.__c).__H;e&&(K===v?(e.__h=[],v.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=B,t.__N=t.i=void 0})):(e.__h.forEach(I),e.__h.forEach(X),e.__h=[],W=0)),K=v},a.diffed=function(_){y_&&y_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(d_.push(e)!==1&&p_===a.requestAnimationFrame||((p_=a.requestAnimationFrame)||M_)(U_)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==B&&(t.__=t.__V),t.i=void 0,t.__V=B})),K=v=null},a.__c=function(_,e){e.some(function(t){try{t.__h.forEach(I),t.__h=t.__h.filter(function(n){return!n.__||X(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],a.__e(n,t.__v)}}),m_&&m_(_,e)},a.unmount=function(_){g_&&g_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{I(n)}catch(r){e=r}}),t.__H=void 0,e&&a.__e(e,t.__v))};var k_=typeof requestAnimationFrame=="function";function M_(_){var e,t=function(){clearTimeout(n),k_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,100);k_&&(e=requestAnimationFrame(t))}function I(_){var e=v,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),v=e}function X(_){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 B_=0;function S_(_,e,t,n,r,i){var f,l,c={};for(l in e)l=="ref"?f=e[l]:c[l]=e[l];var u={type:_,props:c,key:t,ref:f,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--B_,__i:-1,__u:0,__source:r,__self:i};if(typeof _=="function"&&(f=_.defaultProps))for(l in f)c[l]===void 0&&(c[l]=f[l]);return a.vnode&&a.vnode(u),u}class I_{constructor(){Z(this,"_context");Z(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=[]}}let O;const O_=({context:_})=>{const[e,t]=L_(null);return T_(()=>{if(e){if(O===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");O.setContext({..._,container:e})}},[e,_]),S_("div",{ref:t,id:"spiffThemeWrapper"})};function V_(_,e){O=new I_,window.SpiffThemeLoader=O;let t;typeof _=="string"?t=document.getElementById(_):t=_,D_(S_(O_,{context:e}),t)}b.SpiffThemeConfigurationFieldType=w,b.SpiffThemeFileType=k,b.setSpiffDevOptions=V_,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spiffcommerce/theme-bridge",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc && vite build",
|
|
7
|
+
"preview": "vite preview",
|
|
8
|
+
"dev": "ladle serve"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.umd.js",
|
|
11
|
+
"module": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@ladle/react": "^4.0.2",
|
|
19
|
+
"@preact/preset-vite": "^2.7.0",
|
|
20
|
+
"@spiffcommerce/core": "^19.1.0",
|
|
21
|
+
"@types/node": "^20.11.16",
|
|
22
|
+
"preact": "^10.19.3",
|
|
23
|
+
"prettier": "^3.2.4",
|
|
24
|
+
"tsup": "^8.0.1",
|
|
25
|
+
"typescript": "^5.2.2",
|
|
26
|
+
"vite": "^5.0.8",
|
|
27
|
+
"vite-plugin-externalize-deps": "^0.8.0"
|
|
28
|
+
}
|
|
29
|
+
}
|