@spiffcommerce/theme-bridge 1.10.7 → 1.11.0-alpha.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 +8 -3
- package/dist/index.js +160 -154
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DesignCreationMessage, SpiffCommerceClient } from '@spiffcommerce/core';
|
|
2
|
-
import {
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
3
|
|
|
4
4
|
interface ThemeConfigurationFile {
|
|
5
5
|
/**
|
|
@@ -300,7 +300,7 @@ declare function exampleThemeInstallConfig(opts?: Partial<ThemeInstallConfigurat
|
|
|
300
300
|
|
|
301
301
|
interface PluginOptions {
|
|
302
302
|
/**
|
|
303
|
-
* When `true`, will automatically insert files
|
|
303
|
+
* When `true`, will automatically insert files from the build into the `launchData.targetFiles` field.
|
|
304
304
|
* @default true
|
|
305
305
|
*/
|
|
306
306
|
autoGenerateTargetFiles?: boolean;
|
|
@@ -309,6 +309,11 @@ interface PluginOptions {
|
|
|
309
309
|
* @default undefined
|
|
310
310
|
*/
|
|
311
311
|
configurationSchema?: ThemeConfigurationSchema;
|
|
312
|
+
/**
|
|
313
|
+
* Generates `targetFiles` entries with preload set to true. Only applies when `autoGenerateTargetFiles` is set to true.
|
|
314
|
+
* @default true
|
|
315
|
+
*/
|
|
316
|
+
includePreloadChunks?: boolean;
|
|
312
317
|
/**
|
|
313
318
|
* Manually add/override specific files.
|
|
314
319
|
* @default undefined
|
|
@@ -319,6 +324,6 @@ interface PluginOptions {
|
|
|
319
324
|
* Automatically generates a `spiffTheme.json` file in your output directory.
|
|
320
325
|
* @param opts Options to customize the generated file.
|
|
321
326
|
*/
|
|
322
|
-
declare function spiffThemePlugin(opts?: PluginOptions):
|
|
327
|
+
declare function spiffThemePlugin(opts?: PluginOptions): Plugin;
|
|
323
328
|
|
|
324
329
|
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
|
@@ -1,10 +1,10 @@
|
|
|
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
2
|
var Ce = Object.defineProperty;
|
|
3
|
-
var
|
|
4
|
-
var B = (e, _, t) => (
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
var O = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(O || {}),
|
|
3
|
+
var Ee = (e, _, t) => _ in e ? Ce(e, _, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[_] = t;
|
|
4
|
+
var B = (e, _, t) => (Ee(e, typeof _ != "symbol" ? _ + "" : _, t), t);
|
|
5
|
+
import Se from "fs";
|
|
6
|
+
import we from "path";
|
|
7
|
+
var O = /* @__PURE__ */ ((e) => (e.Javascript = "Javascript", e.CSS = "CSS", e))(O || {}), $e = /* @__PURE__ */ ((e) => (e.Asset = "Asset", e.Boolean = "Boolean", e.Color = "Color", e.Heading = "Heading", e.Number = "Number", e.Select = "Select", e.Text = "Text", e))($e || {}), He = /* @__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))(He || {}), A, f, ae, E, X, fe, Z, $ = {}, pe = [], De = /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];
|
|
@@ -14,18 +14,18 @@ function de(e) {
|
|
|
14
14
|
var _ = e.parentNode;
|
|
15
15
|
_ && _.removeChild(e);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
var n,
|
|
17
|
+
function Pe(e, _, t) {
|
|
18
|
+
var n, o, i, c = {};
|
|
19
19
|
for (i in _)
|
|
20
|
-
i == "key" ? n = _[i] : i == "ref" ?
|
|
21
|
-
if (arguments.length > 2 && (
|
|
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)
|
|
22
22
|
for (i in e.defaultProps)
|
|
23
|
-
|
|
24
|
-
return T(e,
|
|
23
|
+
c[i] === void 0 && (c[i] = e.defaultProps[i]);
|
|
24
|
+
return T(e, c, n, o, null);
|
|
25
25
|
}
|
|
26
|
-
function T(e, _, t, n,
|
|
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:
|
|
28
|
-
return
|
|
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 };
|
|
28
|
+
return o == null && f.vnode != null && f.vnode(i), i;
|
|
29
29
|
}
|
|
30
30
|
function F(e) {
|
|
31
31
|
return e.children;
|
|
@@ -33,13 +33,13 @@ function F(e) {
|
|
|
33
33
|
function I(e, _) {
|
|
34
34
|
this.props = e, this.context = _;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function S(e, _) {
|
|
37
37
|
if (_ == null)
|
|
38
|
-
return e.__ ?
|
|
38
|
+
return e.__ ? S(e.__, e.__i + 1) : null;
|
|
39
39
|
for (var t; _ < e.__k.length; _++)
|
|
40
40
|
if ((t = e.__k[_]) != null && t.__e != null)
|
|
41
41
|
return t.__e;
|
|
42
|
-
return typeof e.type == "function" ?
|
|
42
|
+
return typeof e.type == "function" ? S(e) : null;
|
|
43
43
|
}
|
|
44
44
|
function he(e) {
|
|
45
45
|
var _, t;
|
|
@@ -53,60 +53,60 @@ function he(e) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function ee(e) {
|
|
56
|
-
(!e.__d && (e.__d = !0) &&
|
|
56
|
+
(!e.__d && (e.__d = !0) && E.push(e) && !L.__r++ || X !== f.debounceRendering) && ((X = f.debounceRendering) || fe)(L);
|
|
57
57
|
}
|
|
58
58
|
function L() {
|
|
59
|
-
var e, _, t, n,
|
|
60
|
-
for (
|
|
61
|
-
e.__d && (_ =
|
|
59
|
+
var e, _, t, n, o, i, c, s, u;
|
|
60
|
+
for (E.sort(Z); e = E.shift(); )
|
|
61
|
+
e.__d && (_ = E.length, n = void 0, i = (o = (t = e).__v).__e, s = [], u = [], (c = t.__P) && ((n = C({}, o)).__v = o.__v + 1, f.vnode && f.vnode(n), Y(c, n, o, t.__n, c.ownerSVGElement !== void 0, 32 & o.__u ? [i] : null, s, i ?? S(o), !!(32 & o.__u), u), n.__.__k[n.__i] = n, ge(s, n, u), n.__e != i && he(n)), E.length > _ && E.sort(Z));
|
|
62
62
|
L.__r = 0;
|
|
63
63
|
}
|
|
64
|
-
function ve(e, _, t, n,
|
|
65
|
-
var
|
|
66
|
-
for (t.__d =
|
|
67
|
-
(a = t.__k[
|
|
68
|
-
t.__d =
|
|
64
|
+
function ve(e, _, t, n, o, i, c, s, u, l, 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 ? $ : g[a.__i] || $, a.__i = r, Y(e, a, d, o, i, c, s, u, l, p), m = a.__e, a.ref && d.ref != a.ref && (d.ref && K(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;
|
|
69
69
|
}
|
|
70
70
|
function Ne(e, _, t) {
|
|
71
|
-
var n,
|
|
72
|
-
for (e.__k = [], n = 0; n <
|
|
73
|
-
(
|
|
71
|
+
var n, o, i, c, s, u = _.length, l = t.length, p = l, 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, s = Te(o, t, c = n + r, p), o.__i = s, i = null, s !== -1 && (p--, (i = t[s]) && (i.__u |= 131072)), i == null || i.__v === null ? (s == -1 && r--, typeof o.type != "function" && (o.__u |= 65536)) : s !== c && (s === c + 1 ? r++ : s > c ? p > u - c ? r += s - c : r-- : r = s < c && s == c - 1 ? s - c : 0, s !== n + r && (o.__u |= 65536))) : (i = t[n]) && i.key == null && i.__e && (i.__e == e.__d && (e.__d = S(i)), z(i, i, !1), t[n] = null, p--);
|
|
74
74
|
if (p)
|
|
75
|
-
for (n = 0; n <
|
|
76
|
-
(i = t[n]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d =
|
|
75
|
+
for (n = 0; n < l; n++)
|
|
76
|
+
(i = t[n]) != null && !(131072 & i.__u) && (i.__e == e.__d && (e.__d = S(i)), z(i, i));
|
|
77
77
|
}
|
|
78
78
|
function me(e, _, t) {
|
|
79
|
-
var n,
|
|
79
|
+
var n, o;
|
|
80
80
|
if (typeof e.type == "function") {
|
|
81
|
-
for (n = e.__k,
|
|
82
|
-
n[
|
|
81
|
+
for (n = e.__k, o = 0; n && o < n.length; o++)
|
|
82
|
+
n[o] && (n[o].__ = e, _ = me(n[o], _, t));
|
|
83
83
|
return _;
|
|
84
84
|
}
|
|
85
85
|
return e.__e != _ && (t.insertBefore(e.__e, _ || null), _ = e.__e), _ && _.nextSibling;
|
|
86
86
|
}
|
|
87
87
|
function Te(e, _, t, n) {
|
|
88
|
-
var
|
|
89
|
-
if (
|
|
88
|
+
var o = e.key, i = e.type, c = t - 1, s = t + 1, u = _[t];
|
|
89
|
+
if (u === null || u && o == u.key && i === u.type)
|
|
90
90
|
return t;
|
|
91
|
-
if (n > (
|
|
92
|
-
for (;
|
|
93
|
-
if (
|
|
94
|
-
if ((
|
|
95
|
-
return
|
|
96
|
-
|
|
91
|
+
if (n > (u != null && !(131072 & u.__u) ? 1 : 0))
|
|
92
|
+
for (; c >= 0 || s < _.length; ) {
|
|
93
|
+
if (c >= 0) {
|
|
94
|
+
if ((u = _[c]) && !(131072 & u.__u) && o == u.key && i === u.type)
|
|
95
|
+
return c;
|
|
96
|
+
c--;
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
99
|
-
if ((
|
|
100
|
-
return
|
|
101
|
-
|
|
98
|
+
if (s < _.length) {
|
|
99
|
+
if ((u = _[s]) && !(131072 & u.__u) && o == u.key && i === u.type)
|
|
100
|
+
return s;
|
|
101
|
+
s++;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
return -1;
|
|
105
105
|
}
|
|
106
106
|
function _e(e, _, t) {
|
|
107
|
-
_[0] === "-" ? e.setProperty(_, t ?? "") : e[_] = t == null ? "" : typeof t != "number" ||
|
|
107
|
+
_[0] === "-" ? e.setProperty(_, t ?? "") : e[_] = t == null ? "" : typeof t != "number" || De.test(_) ? t : t + "px";
|
|
108
108
|
}
|
|
109
|
-
function N(e, _, t, n,
|
|
109
|
+
function N(e, _, t, n, o) {
|
|
110
110
|
var i;
|
|
111
111
|
e:
|
|
112
112
|
if (_ === "style")
|
|
@@ -123,7 +123,7 @@ function N(e, _, t, n, r) {
|
|
|
123
123
|
else if (_[0] === "o" && _[1] === "n")
|
|
124
124
|
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 ? ne : te, i)) : e.removeEventListener(_, i ? ne : te, i);
|
|
125
125
|
else {
|
|
126
|
-
if (
|
|
126
|
+
if (o)
|
|
127
127
|
_ = _.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
|
|
128
128
|
else if (_ !== "width" && _ !== "height" && _ !== "href" && _ !== "list" && _ !== "form" && _ !== "tabIndex" && _ !== "download" && _ !== "rowSpan" && _ !== "colSpan" && _ !== "role" && _ in e)
|
|
129
129
|
try {
|
|
@@ -146,93 +146,93 @@ 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
|
|
150
|
-
var p,
|
|
149
|
+
function Y(e, _, t, n, o, i, c, s, u, l) {
|
|
150
|
+
var p, r, d, a, m, k, g, h, y, x, H, w, Q, D, V, b = _.type;
|
|
151
151
|
if (_.constructor !== void 0)
|
|
152
152
|
return null;
|
|
153
|
-
128 & t.__u && (
|
|
153
|
+
128 & t.__u && (u = !!(32 & t.__u), i = [s = _.__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 = (
|
|
158
|
-
b.getDerivedStateFromProps == null &&
|
|
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))), a = r.props, m = r.state, r.__v = _, d)
|
|
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 &&
|
|
161
|
-
for (_.__v !== t.__v && (
|
|
162
|
-
|
|
163
|
-
}),
|
|
164
|
-
|
|
165
|
-
|
|
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)) {
|
|
161
|
+
for (_.__v !== t.__v && (r.props = h, r.state = r.__s, r.__d = !1), _.__e = t.__e, _.__k = t.__k, _.__k.forEach(function(P) {
|
|
162
|
+
P && (P.__ = _);
|
|
163
|
+
}), H = 0; H < r._sb.length; H++)
|
|
164
|
+
r.__h.push(r._sb[H]);
|
|
165
|
+
r._sb = [], r.__h.length && c.push(r);
|
|
166
166
|
break e;
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
|
|
168
|
+
r.componentWillUpdate != null && r.componentWillUpdate(h, r.__s, x), r.componentDidUpdate != null && r.__h.push(function() {
|
|
169
|
+
r.componentDidUpdate(a, m, k);
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
if (
|
|
173
|
-
for (
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
if (r.context = x, r.props = h, r.__P = e, r.__e = !1, w = f.__r, Q = 0, "prototype" in b && b.prototype.render) {
|
|
173
|
+
for (r.state = r.__s, r.__d = !1, w && w(_), p = r.render(r.props, r.state, r.context), D = 0; D < r._sb.length; D++)
|
|
174
|
+
r.__h.push(r._sb[D]);
|
|
175
|
+
r._sb = [];
|
|
176
176
|
} else
|
|
177
177
|
do
|
|
178
|
-
|
|
179
|
-
while (
|
|
180
|
-
|
|
181
|
-
} catch (
|
|
182
|
-
_.__v = null,
|
|
178
|
+
r.__d = !1, w && w(_), p = r.render(r.props, r.state, r.context), r.state = r.__s;
|
|
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(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, s, u, l), r.base = _.__e, _.__u &= -161, r.__h.length && c.push(r), g && (r.__E = r.__ = null);
|
|
181
|
+
} catch (P) {
|
|
182
|
+
_.__v = null, u || i != null ? (_.__e = s, _.__u |= u ? 160 : 32, i[i.indexOf(s)] = null) : (_.__e = t.__e, _.__k = t.__k), f.__e(P, _, t);
|
|
183
183
|
}
|
|
184
184
|
else
|
|
185
|
-
i == null && _.__v === t.__v ? (_.__k = t.__k, _.__e = t.__e) : _.__e = Ie(t.__e, _, t, n,
|
|
185
|
+
i == null && _.__v === t.__v ? (_.__k = t.__k, _.__e = t.__e) : _.__e = Ie(t.__e, _, t, n, o, i, c, u, l);
|
|
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
|
-
|
|
192
|
-
f.__c && f.__c(_, e), e.some(function(
|
|
191
|
+
K(t[n], t[++n], t[++n]);
|
|
192
|
+
f.__c && f.__c(_, e), e.some(function(o) {
|
|
193
193
|
try {
|
|
194
|
-
e =
|
|
195
|
-
i.call(
|
|
194
|
+
e = o.__h, o.__h = [], e.some(function(i) {
|
|
195
|
+
i.call(o);
|
|
196
196
|
});
|
|
197
197
|
} catch (i) {
|
|
198
|
-
f.__e(i,
|
|
198
|
+
f.__e(i, o.__v);
|
|
199
199
|
}
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
|
-
function Ie(e, _, t, n,
|
|
203
|
-
var
|
|
204
|
-
if (y === "svg" && (
|
|
205
|
-
for (
|
|
206
|
-
if ((a = i[
|
|
207
|
-
e = a, i[
|
|
202
|
+
function Ie(e, _, t, n, o, i, c, s, u) {
|
|
203
|
+
var l, p, r, d, a, m, k, g = t.props, h = _.props, y = _.type;
|
|
204
|
+
if (y === "svg" && (o = !0), i != null) {
|
|
205
|
+
for (l = 0; l < i.length; l++)
|
|
206
|
+
if ((a = i[l]) && "setAttribute" in a == !!y && (y ? a.localName === y : a.nodeType === 3)) {
|
|
207
|
+
e = a, i[l] = null;
|
|
208
208
|
break;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
if (e == null) {
|
|
212
212
|
if (y === null)
|
|
213
213
|
return document.createTextNode(h);
|
|
214
|
-
e =
|
|
214
|
+
e = o ? document.createElementNS("http://www.w3.org/2000/svg", y) : document.createElement(y, h.is && h), i = null, s = !1;
|
|
215
215
|
}
|
|
216
216
|
if (y === null)
|
|
217
|
-
g === h ||
|
|
217
|
+
g === h || s && e.data === h || (e.data = h);
|
|
218
218
|
else {
|
|
219
|
-
if (i = i && A.call(e.childNodes), g = t.props ||
|
|
220
|
-
for (g = {},
|
|
221
|
-
g[(a = e.attributes[
|
|
222
|
-
for (
|
|
223
|
-
a = g[
|
|
224
|
-
for (
|
|
225
|
-
a = h[
|
|
219
|
+
if (i = i && A.call(e.childNodes), g = t.props || $, !s && i != null)
|
|
220
|
+
for (g = {}, l = 0; l < e.attributes.length; l++)
|
|
221
|
+
g[(a = e.attributes[l]).name] = a.value;
|
|
222
|
+
for (l in g)
|
|
223
|
+
a = g[l], l == "children" || (l == "dangerouslySetInnerHTML" ? r = a : l === "key" || l in h || N(e, l, null, a, o));
|
|
224
|
+
for (l in h)
|
|
225
|
+
a = h[l], l == "children" ? d = a : l == "dangerouslySetInnerHTML" ? p = a : l == "value" ? m = a : l == "checked" ? k = a : l === "key" || s && typeof a != "function" || g[l] === a || N(e, l, a, g[l], o);
|
|
226
226
|
if (p)
|
|
227
|
-
|
|
228
|
-
else if (
|
|
229
|
-
for (
|
|
230
|
-
i[
|
|
231
|
-
|
|
227
|
+
s || 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 && S(t, 0), s, u), i != null)
|
|
229
|
+
for (l = i.length; l--; )
|
|
230
|
+
i[l] != null && de(i[l]);
|
|
231
|
+
s || (l = "value", m !== void 0 && (m !== e[l] || y === "progress" && !m || y === "option" && m !== g[l]) && N(e, l, m, g[l], !1), l = "checked", k !== void 0 && k !== e[l] && N(e, l, k, g[l], !1));
|
|
232
232
|
}
|
|
233
233
|
return e;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function K(e, _, t) {
|
|
236
236
|
try {
|
|
237
237
|
typeof e == "function" ? e(_) : e.current = _;
|
|
238
238
|
} catch (n) {
|
|
@@ -240,8 +240,8 @@ function Q(e, _, t) {
|
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
function z(e, _, t) {
|
|
243
|
-
var n,
|
|
244
|
-
if (f.unmount && f.unmount(e), (n = e.ref) && (n.current && n.current !== e.__e ||
|
|
243
|
+
var n, o;
|
|
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();
|
|
@@ -251,25 +251,25 @@ function z(e, _, t) {
|
|
|
251
251
|
n.base = n.__P = null, e.__c = void 0;
|
|
252
252
|
}
|
|
253
253
|
if (n = e.__k)
|
|
254
|
-
for (
|
|
255
|
-
n[
|
|
254
|
+
for (o = 0; o < n.length; o++)
|
|
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
258
|
function Ue(e, _, t) {
|
|
259
259
|
return this.constructor(e, t);
|
|
260
260
|
}
|
|
261
261
|
function je(e, _, t) {
|
|
262
|
-
var n,
|
|
263
|
-
f.__ && f.__(e, _),
|
|
262
|
+
var n, o, i, c;
|
|
263
|
+
f.__ && f.__(e, _), o = (n = typeof t == "function") ? null : t && t.__k || _.__k, i = [], c = [], Y(_, e = (!n && t || _).__k = Pe(F, null, [e]), o || $, $, _.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);
|
|
264
264
|
}
|
|
265
265
|
A = pe.slice, f = { __e: function(e, _, t, n) {
|
|
266
|
-
for (var
|
|
267
|
-
if ((
|
|
266
|
+
for (var o, i, c; _ = _.__; )
|
|
267
|
+
if ((o = _.__c) && !o.__)
|
|
268
268
|
try {
|
|
269
|
-
if ((i =
|
|
270
|
-
return
|
|
271
|
-
} catch (
|
|
272
|
-
e =
|
|
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)
|
|
270
|
+
return o.__E = o;
|
|
271
|
+
} catch (s) {
|
|
272
|
+
e = s;
|
|
273
273
|
}
|
|
274
274
|
throw e;
|
|
275
275
|
} }, ae = 0, I.prototype.setState = function(e, _) {
|
|
@@ -277,7 +277,7 @@ A = pe.slice, f = { __e: function(e, _, t, n) {
|
|
|
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) {
|
|
279
279
|
this.__v && (this.__e = !0, e && this.__h.push(e), ee(this));
|
|
280
|
-
}, I.prototype.render = F,
|
|
280
|
+
}, I.prototype.render = F, E = [], 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
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;
|
|
@@ -291,11 +291,11 @@ function Le(e) {
|
|
|
291
291
|
}
|
|
292
292
|
function Me(e, _, t) {
|
|
293
293
|
var n = be(M++, 2);
|
|
294
|
-
if (n.t = e, !n.__c && (n.__ = [t ? t(_) : ke(void 0, _), function(
|
|
295
|
-
var
|
|
296
|
-
|
|
294
|
+
if (n.t = e, !n.__c && (n.__ = [t ? t(_) : ke(void 0, _), function(s) {
|
|
295
|
+
var u = n.__N ? n.__N[0] : n.__[0], l = n.t(u, s);
|
|
296
|
+
u !== l && (n.__N = [l, n.__[1]], n.__c.setState({}));
|
|
297
297
|
}], n.__c = v, !v.u)) {
|
|
298
|
-
var
|
|
298
|
+
var o = function(s, u, l) {
|
|
299
299
|
if (!n.__c.__H)
|
|
300
300
|
return !0;
|
|
301
301
|
var p = n.__c.__H.__.filter(function(d) {
|
|
@@ -304,24 +304,24 @@ function Me(e, _, t) {
|
|
|
304
304
|
if (p.every(function(d) {
|
|
305
305
|
return !d.__N;
|
|
306
306
|
}))
|
|
307
|
-
return !i || i.call(this,
|
|
308
|
-
var
|
|
307
|
+
return !i || i.call(this, s, u, l);
|
|
308
|
+
var r = !1;
|
|
309
309
|
return p.forEach(function(d) {
|
|
310
310
|
if (d.__N) {
|
|
311
311
|
var a = d.__[0];
|
|
312
|
-
d.__ = d.__N, d.__N = void 0, a !== d.__[0] && (
|
|
312
|
+
d.__ = d.__N, d.__N = void 0, a !== d.__[0] && (r = !0);
|
|
313
313
|
}
|
|
314
|
-
}), !(!
|
|
314
|
+
}), !(!r && n.__c.props === s) && (!i || i.call(this, s, u, l));
|
|
315
315
|
};
|
|
316
316
|
v.u = !0;
|
|
317
|
-
var i = v.shouldComponentUpdate,
|
|
318
|
-
v.componentWillUpdate = function(
|
|
317
|
+
var i = v.shouldComponentUpdate, c = v.componentWillUpdate;
|
|
318
|
+
v.componentWillUpdate = function(s, u, l) {
|
|
319
319
|
if (this.__e) {
|
|
320
320
|
var p = i;
|
|
321
|
-
i = void 0,
|
|
321
|
+
i = void 0, o(s, u, l), i = p;
|
|
322
322
|
}
|
|
323
|
-
|
|
324
|
-
}, v.shouldComponentUpdate =
|
|
323
|
+
c && c.call(this, s, u, l);
|
|
324
|
+
}, v.shouldComponentUpdate = o;
|
|
325
325
|
}
|
|
326
326
|
return n.__N || n.__;
|
|
327
327
|
}
|
|
@@ -359,8 +359,8 @@ f.__b = function(e) {
|
|
|
359
359
|
return !n.__ || R(n);
|
|
360
360
|
});
|
|
361
361
|
} catch (n) {
|
|
362
|
-
_.some(function(
|
|
363
|
-
|
|
362
|
+
_.some(function(o) {
|
|
363
|
+
o.__h && (o.__h = []);
|
|
364
364
|
}), _ = [], f.__e(n, t.__v);
|
|
365
365
|
}
|
|
366
366
|
}), se && se(e, _);
|
|
@@ -370,8 +370,8 @@ f.__b = function(e) {
|
|
|
370
370
|
t && t.__H && (t.__H.__.forEach(function(n) {
|
|
371
371
|
try {
|
|
372
372
|
j(n);
|
|
373
|
-
} catch (
|
|
374
|
-
_ =
|
|
373
|
+
} catch (o) {
|
|
374
|
+
_ = o;
|
|
375
375
|
}
|
|
376
376
|
}), t.__H = void 0, _ && f.__e(_, t.__v));
|
|
377
377
|
};
|
|
@@ -399,15 +399,15 @@ function ke(e, _) {
|
|
|
399
399
|
return typeof _ == "function" ? _(e) : _;
|
|
400
400
|
}
|
|
401
401
|
var Be = 0;
|
|
402
|
-
function xe(e, _, t, n,
|
|
403
|
-
var
|
|
404
|
-
for (
|
|
405
|
-
|
|
406
|
-
var
|
|
407
|
-
if (typeof e == "function" && (
|
|
408
|
-
for (
|
|
409
|
-
|
|
410
|
-
return f.vnode && f.vnode(
|
|
402
|
+
function xe(e, _, t, n, o, i) {
|
|
403
|
+
var c, s, u = {};
|
|
404
|
+
for (s in _)
|
|
405
|
+
s == "ref" ? c = _[s] : u[s] = _[s];
|
|
406
|
+
var l = { 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 (s in c)
|
|
409
|
+
u[s] === void 0 && (u[s] = c[s]);
|
|
410
|
+
return f.vnode && f.vnode(l), l;
|
|
411
411
|
}
|
|
412
412
|
class qe {
|
|
413
413
|
constructor() {
|
|
@@ -490,14 +490,14 @@ function s_(e) {
|
|
|
490
490
|
...e
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
|
-
const Ze = "@spiffcommerce/theme-bridge", ze = "1.10.
|
|
493
|
+
const Ze = "@spiffcommerce/theme-bridge", ze = "1.10.8", 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",
|
|
498
|
+
}, Ge = "./dist/index.umd.cjs", Ye = "./dist/index.js", Ke = "./dist/index.d.ts", Qe = [
|
|
499
499
|
"./dist"
|
|
500
|
-
],
|
|
500
|
+
], Xe = {
|
|
501
501
|
import: "./dist/index.js",
|
|
502
502
|
require: "./dist/index.umd.cjs"
|
|
503
503
|
}, e_ = {}, __ = {
|
|
@@ -526,15 +526,17 @@ const Ze = "@spiffcommerce/theme-bridge", ze = "1.10.6", Je = "module", Re = {
|
|
|
526
526
|
type: Je,
|
|
527
527
|
scripts: Re,
|
|
528
528
|
main: Ge,
|
|
529
|
-
module:
|
|
530
|
-
types:
|
|
531
|
-
files:
|
|
532
|
-
exports:
|
|
529
|
+
module: Ye,
|
|
530
|
+
types: Ke,
|
|
531
|
+
files: Qe,
|
|
532
|
+
exports: Xe,
|
|
533
533
|
dependencies: e_,
|
|
534
534
|
devDependencies: __
|
|
535
535
|
};
|
|
536
|
-
function n_(e, _) {
|
|
536
|
+
function n_(e, _, t) {
|
|
537
537
|
if (_.type === "chunk") {
|
|
538
|
+
if (console.log(`chunk ${e} isEntry: ${_.isEntry}, isDynamicEntry: ${_.isDynamicEntry}, isImplicitEntry: ${_.isImplicitEntry}`), _.isImplicitEntry && !t)
|
|
539
|
+
return null;
|
|
538
540
|
if (!_.isDynamicEntry)
|
|
539
541
|
return {
|
|
540
542
|
type: O.Javascript,
|
|
@@ -554,27 +556,31 @@ function c_(e) {
|
|
|
554
556
|
const {
|
|
555
557
|
autoGenerateTargetFiles: _ = !0,
|
|
556
558
|
configurationSchema: t,
|
|
557
|
-
|
|
559
|
+
includePreloadChunks: n = !0,
|
|
560
|
+
targetFiles: o
|
|
558
561
|
} = e ?? {};
|
|
559
562
|
return {
|
|
560
563
|
name: "spiff-theme-plugin",
|
|
561
564
|
version: t_.version,
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
565
|
+
config(i, c) {
|
|
566
|
+
i.base !== void 0 && i.base !== "" && console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'), i.base = "";
|
|
567
|
+
},
|
|
568
|
+
writeBundle(i, c) {
|
|
569
|
+
const s = _ ? Object.keys(c).map((l) => o != null && o.some((p) => p.filename === l) ? null : n_(l, c[l], n)).filter((l) => l !== null) : [];
|
|
570
|
+
o && s.push(...o);
|
|
571
|
+
const u = {
|
|
566
572
|
launchData: {
|
|
567
|
-
targetFiles:
|
|
573
|
+
targetFiles: s
|
|
568
574
|
},
|
|
569
575
|
configurationSchema: t
|
|
570
576
|
};
|
|
571
|
-
|
|
577
|
+
Se.writeFileSync(we.join(i.dir, "spiffTheme.json"), JSON.stringify(u, void 0, 4));
|
|
572
578
|
}
|
|
573
579
|
};
|
|
574
580
|
}
|
|
575
581
|
export {
|
|
576
|
-
|
|
577
|
-
|
|
582
|
+
He as AssetType,
|
|
583
|
+
$e as FieldType,
|
|
578
584
|
O as ThemeFileType,
|
|
579
585
|
s_ as exampleThemeInstallConfig,
|
|
580
586
|
l_ as setSpiffDevOptions,
|
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(v,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(v=typeof globalThis<"u"?globalThis:v||self,k(v.theme={},v.fs,v.path))})(this,function(v,k,E){"use strict";var Ge=Object.defineProperty;var Ke=(v,k,E)=>k in v?Ge(v,k,{enumerable:!0,configurable:!0,writable:!0,value:E}):v[k]=E;var ee=(v,k,E)=>(Ke(v,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,$,oe,re,Z,T={},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,t){for(var _ in t)e[_]=t[_];return e}function le(e){var t=e.parentNode;t&&t.removeChild(e)}function Te(e,t,_){var n,r,i,u={};for(i in t)i=="key"?n=t[i]:i=="ref"?r=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,r,null)}function I(e,t,_,n,r){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:r??++ne,__i:-1,__u:0};return r==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 H(e,t){if(t==null)return e.__?H(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"?H(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)&&$.push(e)&&!U.__r++||oe!==a.debounceRendering)&&((oe=a.debounceRendering)||re)(U)}function U(){var e,t,_,n,r,i,u,l,c;for($.sort(Z);e=$.shift();)e.__d&&(t=$.length,n=void 0,i=(r=(_=e).__v).__e,l=[],c=[],(u=_.__P)&&((n=S({},r)).__v=r.__v+1,a.vnode&&a.vnode(n),J(u,n,r,_.__n,u.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??H(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,he(l,n,c),n.__e!=i&&se(n)),$.length>t&&$.sort(Z));U.__r=0}function ue(e,t,_,n,r,i,u,l,c,s,p){var o,d,f,g,C,y=n&&n.__k||ie,h=t.length;for(_.__d=c,Pe(_,t,y),c=_.__d,o=0;o<h;o++)(f=_.__k[o])!=null&&typeof f!="boolean"&&typeof f!="function"&&(d=f.__i===-1?T:y[f.__i]||T,f.__i=o,J(e,f,d,r,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,r,i,u,l,c=t.length,s=_.length,p=s,o=0;for(e.__k=[],n=0;n<c;n++)(r=e.__k[n]=(r=t[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):z(r)?I(j,{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.__=e,r.__b=e.__b+1,l=De(r,_,u=n+o,p),r.__i=l,i=null,l!==-1&&(p--,(i=_[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?p>c-u?o+=l-u:o--:o=l<u&&l==u-1?l-u:0,l!==n+o&&(r.__u|=65536))):(i=_[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=H(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=H(i)),G(i,i))}function fe(e,t,_){var n,r;if(typeof e.type=="function"){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=fe(n[r],t,_));return t}return e.__e!=t&&(_.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function De(e,t,_,n){var r=e.key,i=e.type,u=_-1,l=_+1,c=t[_];if(c===null||c&&r==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)&&r==c.key&&i===c.type)return u;u--}if(l<t.length){if((c=t[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function ae(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||He.test(t)?_:_+"px"}function F(e,t,_,n,r){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(r)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,r,i,u,l,c,s){var p,o,d,f,g,C,y,h,b,w,q,P,$e,O,Y,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=(o=t.__c=_.__c).__=o.__E:("prototype"in x&&x.prototype.render?t.__c=o=new x(h,w):(t.__c=o=new M(h,w),o.constructor=x,o.render=Ie),b&&b.sub(o),o.props=h,o.state||(o.state={}),o.context=w,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=S({},o.__s)),S(o.__s,x.getDerivedStateFromProps(h,o.__s))),f=o.props,g=o.state,o.__v=t,d)x.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==f&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,w)===!1||t.__v===_.__v)){for(t.__v!==_.__v&&(o.props=h,o.state=o.__s,o.__d=!1),t.__e=_.__e,t.__k=_.__k,t.__k.forEach(function(B){B&&(B.__=t)}),q=0;q<o._sb.length;q++)o.__h.push(o._sb[q]);o._sb=[],o.__h.length&&u.push(o);break e}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,w),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(f,g,C)})}if(o.context=w,o.props=h,o.__P=e,o.__e=!1,P=a.__r,$e=0,"prototype"in x&&x.prototype.render){for(o.state=o.__s,o.__d=!1,P&&P(t),p=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,P&&P(t),p=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=S(S({},n),o.getChildContext())),d||o.getSnapshotBeforeUpdate==null||(C=o.getSnapshotBeforeUpdate(f,g)),ue(e,z(Y=p!=null&&p.type===j&&p.key==null?p.props.children:p)?Y:[Y],t,_,n,r,i,u,l,c,s),o.base=t.__e,t.__u&=-161,o.__h.length&&u.push(o),y&&(o.__E=o.__=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,r,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(r){try{e=r.__h,r.__h=[],e.some(function(i){i.call(r)})}catch(i){a.__e(i,r.__v)}})}function Ne(e,t,_,n,r,i,u,l,c){var s,p,o,d,f,g,C,y=_.props,h=t.props,b=t.type;if(b==="svg"&&(r=!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=r?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||T,!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"?o=f:s==="key"||s in h||F(e,s,null,f,r));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],r);if(p)l||o&&(p.__html===o.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(o&&(e.innerHTML=""),ue(e,z(d)?d:[d],t,_,n,r&&b!=="foreignObject",i,u,i?i[0]:_.__k&&H(_,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,r;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(r=0;r<n.length;r++)n[r]&&G(n[r],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,r,i,u;a.__&&a.__(e,t),r=(n=typeof _=="function")?null:_&&_.__k||t.__k,i=[],u=[],J(t,e=(!n&&_||t).__k=Te(j,null,[e]),r||T,T,t.ownerSVGElement!==void 0,!n&&_?[_]:r?null:t.firstChild?N.call(t.childNodes):null,i,!n&&_?_:r?r.__e:t.firstChild,n,u),he(i,e,u)}N=ie.slice,a={__e:function(e,t,_,n){for(var r,i,u;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(e)),u=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,n||{}),u=r.__d),u)return r.__E=r}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,$=[],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,m,K,me,Q=0,ve=[],A=[],ge=a.__b,ye=a.__r,be=a.diffed,ke=a.__c,xe=a.unmount;function Ce(e,t){a.__h&&a.__h(m,e,Q||t),Q=0;var _=m.__H||(m.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:A}),_.__[e]}function Me(e){return Q=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=m,!m.u)){var r=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 o=!1;return p.forEach(function(d){if(d.__N){var f=d.__[0];d.__=d.__N,d.__N=void 0,f!==d.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,s))};m.u=!0;var i=m.shouldComponentUpdate,u=m.componentWillUpdate;m.componentWillUpdate=function(l,c,s){if(this.__e){var p=i;i=void 0,r(l,c,s),i=p}u&&u.call(this,l,c,s)},m.shouldComponentUpdate=r}return n.__N||n.__}function Fe(e,t){var _=Ce(L++,3);!a.__s&&We(_.__H,t)&&(_.__=e,_.i=t,m.__H.__h.push(_))}function Le(){for(var e;e=ve.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(W),e.__H.__h.forEach(X),e.__H.__h=[]}catch(t){e.__H.__h=[],a.__e(t,e.__v)}}a.__b=function(e){m=null,ge&&ge(e)},a.__r=function(e){ye&&ye(e),L=0;var t=(m=e.__c).__H;t&&(K===m?(t.__h=[],m.__h=[],t.__.forEach(function(_){_.__N&&(_.__=_.__N),_.__V=A,_.__N=_.i=void 0})):(t.__h.forEach(W),t.__h.forEach(X),t.__h=[],L=0)),K=m},a.diffed=function(e){be&&be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ve.push(t)!==1&&me===a.requestAnimationFrame||((me=a.requestAnimationFrame)||Ae)(Le)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==A&&(_.__=_.__V),_.i=void 0,_.__V=A})),K=m=null},a.__c=function(e,t){t.some(function(_){try{_.__h.forEach(W),_.__h=_.__h.filter(function(n){return!n.__||X(n)})}catch(n){t.some(function(r){r.__h&&(r.__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(r){t=r}}),_.__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=m,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),m=t}function X(e){var t=m;e.__c=e.__(),m=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,r,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:r,__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.6",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,writeBundle(r,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(r.dir,"spiffTheme.json"),JSON.stringify(l,void 0,4))}}}v.AssetType=_e,v.FieldType=te,v.ThemeFileType=D,v.exampleThemeInstallConfig=Ze,v.setSpiffDevOptions=Be,v.spiffThemePlugin=Re,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
(function(v,k){typeof exports=="object"&&typeof module<"u"?k(exports,require("fs"),require("path")):typeof define=="function"&&define.amd?define(["exports","fs","path"],k):(v=typeof globalThis<"u"?globalThis:v||self,k(v.theme={},v.fs,v.path))})(this,function(v,k,w){"use strict";var Ge=Object.defineProperty;var Ye=(v,k,w)=>k in v?Ge(v,k,{enumerable:!0,configurable:!0,writable:!0,value:w}):v[k]=w;var ee=(v,k,w)=>(Ye(v,typeof k!="symbol"?k+"":k,w),w);var P=(e=>(e.Javascript="Javascript",e.CSS="CSS",e))(P||{}),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,f,ne,$,oe,re,Z,D={},ie=[],Te=/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 De(e,t,_){var n,o,i,c={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:c[i]=t[i];if(arguments.length>2&&(c.children=arguments.length>3?N.call(arguments,2):_),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)c[i]===void 0&&(c[i]=e.defaultProps[i]);return I(e,c,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&&f.vnode!=null&&f.vnode(i),i}function j(e){return e.children}function M(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(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"?T(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)&&$.push(e)&&!U.__r++||oe!==f.debounceRendering)&&((oe=f.debounceRendering)||re)(U)}function U(){var e,t,_,n,o,i,c,s,u;for($.sort(Z);e=$.shift();)e.__d&&(t=$.length,n=void 0,i=(o=(_=e).__v).__e,s=[],u=[],(c=_.__P)&&((n=S({},o)).__v=o.__v+1,f.vnode&&f.vnode(n),J(c,n,o,_.__n,c.ownerSVGElement!==void 0,32&o.__u?[i]:null,s,i??T(o),!!(32&o.__u),u),n.__.__k[n.__i]=n,he(s,n,u),n.__e!=i&&se(n)),$.length>t&&$.sort(Z));U.__r=0}function ue(e,t,_,n,o,i,c,s,u,l,p){var r,d,a,y,C,g=n&&n.__k||ie,h=t.length;for(_.__d=u,He(_,t,g),u=_.__d,r=0;r<h;r++)(a=_.__k[r])!=null&&typeof a!="boolean"&&typeof a!="function"&&(d=a.__i===-1?D:g[a.__i]||D,a.__i=r,J(e,a,d,o,i,c,s,u,l,p),y=a.__e,a.ref&&d.ref!=a.ref&&(d.ref&&R(d.ref,null,a),p.push(a.ref,a.__c||y,a)),C==null&&y!=null&&(C=y),65536&a.__u||d.__k===a.__k?u=ae(a,u,e):typeof a.type=="function"&&a.__d!==void 0?u=a.__d:y&&(u=y.nextSibling),a.__d=void 0,a.__u&=-196609);_.__d=u,_.__e=C}function He(e,t,_){var n,o,i,c,s,u=t.length,l=_.length,p=l,r=0;for(e.__k=[],n=0;n<u;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,s=Pe(o,_,c=n+r,p),o.__i=s,i=null,s!==-1&&(p--,(i=_[s])&&(i.__u|=131072)),i==null||i.__v===null?(s==-1&&r--,typeof o.type!="function"&&(o.__u|=65536)):s!==c&&(s===c+1?r++:s>c?p>u-c?r+=s-c:r--:r=s<c&&s==c-1?s-c:0,s!==n+r&&(o.__u|=65536))):(i=_[n])&&i.key==null&&i.__e&&(i.__e==e.__d&&(e.__d=T(i)),G(i,i,!1),_[n]=null,p--);if(p)for(n=0;n<l;n++)(i=_[n])!=null&&!(131072&i.__u)&&(i.__e==e.__d&&(e.__d=T(i)),G(i,i))}function ae(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=ae(n[o],t,_));return t}return e.__e!=t&&(_.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Pe(e,t,_,n){var o=e.key,i=e.type,c=_-1,s=_+1,u=t[_];if(u===null||u&&o==u.key&&i===u.type)return _;if(n>(u!=null&&!(131072&u.__u)?1:0))for(;c>=0||s<t.length;){if(c>=0){if((u=t[c])&&!(131072&u.__u)&&o==u.key&&i===u.type)return c;c--}if(s<t.length){if((u=t[s])&&!(131072&u.__u)&&o==u.key&&i===u.type)return s;s++}}return-1}function fe(e,t,_){t[0]==="-"?e.setProperty(t,_??""):e[t]=_==null?"":typeof _!="number"||Te.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 _||fe(e.style,t,"");if(_)for(t in _)n&&_[t]===n[t]||fe(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(f.event?f.event(e):e)}function de(e){return this.l[e.type+!0](f.event?f.event(e):e)}function J(e,t,_,n,o,i,c,s,u,l){var p,r,d,a,y,C,g,h,b,E,q,H,$e,O,X,x=t.type;if(t.constructor!==void 0)return null;128&_.__u&&(u=!!(32&_.__u),i=[s=t.__e=_.__e]),(p=f.__b)&&p(t);e:if(typeof x=="function")try{if(h=t.props,b=(p=x.contextType)&&n[p.__c],E=p?b?b.props.value:p.__:n,_.__c?g=(r=t.__c=_.__c).__=r.__E:("prototype"in x&&x.prototype.render?t.__c=r=new x(h,E):(t.__c=r=new M(h,E),r.constructor=x,r.render=Ie),b&&b.sub(r),r.props=h,r.state||(r.state={}),r.context=E,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))),a=r.props,y=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!==a&&r.componentWillReceiveProps!=null&&r.componentWillReceiveProps(h,E),!r.__e&&(r.shouldComponentUpdate!=null&&r.shouldComponentUpdate(h,r.__s,E)===!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&&c.push(r);break e}r.componentWillUpdate!=null&&r.componentWillUpdate(h,r.__s,E),r.componentDidUpdate!=null&&r.__h.push(function(){r.componentDidUpdate(a,y,C)})}if(r.context=E,r.props=h,r.__P=e,r.__e=!1,H=f.__r,$e=0,"prototype"in x&&x.prototype.render){for(r.state=r.__s,r.__d=!1,H&&H(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,H&&H(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(a,y)),ue(e,z(X=p!=null&&p.type===j&&p.key==null?p.props.children:p)?X:[X],t,_,n,o,i,c,s,u,l),r.base=t.__e,t.__u&=-161,r.__h.length&&c.push(r),g&&(r.__E=r.__=null)}catch(B){t.__v=null,u||i!=null?(t.__e=s,t.__u|=u?160:32,i[i.indexOf(s)]=null):(t.__e=_.__e,t.__k=_.__k),f.__e(B,t,_)}else i==null&&t.__v===_.__v?(t.__k=_.__k,t.__e=_.__e):t.__e=Ne(_.__e,t,_,n,o,i,c,u,l);(p=f.diffed)&&p(t)}function he(e,t,_){t.__d=void 0;for(var n=0;n<_.length;n++)R(_[n],_[++n],_[++n]);f.__c&&f.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){f.__e(i,o.__v)}})}function Ne(e,t,_,n,o,i,c,s,u){var l,p,r,d,a,y,C,g=_.props,h=t.props,b=t.type;if(b==="svg"&&(o=!0),i!=null){for(l=0;l<i.length;l++)if((a=i[l])&&"setAttribute"in a==!!b&&(b?a.localName===b:a.nodeType===3)){e=a,i[l]=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,s=!1}if(b===null)g===h||s&&e.data===h||(e.data=h);else{if(i=i&&N.call(e.childNodes),g=_.props||D,!s&&i!=null)for(g={},l=0;l<e.attributes.length;l++)g[(a=e.attributes[l]).name]=a.value;for(l in g)a=g[l],l=="children"||(l=="dangerouslySetInnerHTML"?r=a:l==="key"||l in h||F(e,l,null,a,o));for(l in h)a=h[l],l=="children"?d=a:l=="dangerouslySetInnerHTML"?p=a:l=="value"?y=a:l=="checked"?C=a:l==="key"||s&&typeof a!="function"||g[l]===a||F(e,l,a,g[l],o);if(p)s||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,c,i?i[0]:_.__k&&T(_,0),s,u),i!=null)for(l=i.length;l--;)i[l]!=null&&le(i[l]);s||(l="value",y!==void 0&&(y!==e[l]||b==="progress"&&!y||b==="option"&&y!==g[l])&&F(e,l,y,g[l],!1),l="checked",C!==void 0&&C!==e[l]&&F(e,l,C,g[l],!1))}return e}function R(e,t,_){try{typeof e=="function"?e(t):e.current=t}catch(n){f.__e(n,_)}}function G(e,t,_){var n,o;if(f.unmount&&f.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){f.__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,c;f.__&&f.__(e,t),o=(n=typeof _=="function")?null:_&&_.__k||t.__k,i=[],c=[],J(t,e=(!n&&_||t).__k=De(j,null,[e]),o||D,D,t.ownerSVGElement!==void 0,!n&&_?[_]:o?null:t.firstChild?N.call(t.childNodes):null,i,!n&&_?_:o?o.__e:t.firstChild,n,c),he(i,e,c)}N=ie.slice,f={__e:function(e,t,_,n){for(var o,i,c;t=t.__;)if((o=t.__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(s){e=s}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,$=[],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,m,Y,me,K=0,ve=[],A=[],ye=f.__b,ge=f.__r,be=f.diffed,ke=f.__c,xe=f.unmount;function Ce(e,t){f.__h&&f.__h(m,e,K||t),K=0;var _=m.__H||(m.__H={__:[],__h:[]});return e>=_.__.length&&_.__.push({__V:A}),_.__[e]}function Me(e){return K=1,Ue(Ee,e)}function Ue(e,t,_){var n=Ce(L++,2);if(n.t=e,!n.__c&&(n.__=[_?_(t):Ee(void 0,t),function(s){var u=n.__N?n.__N[0]:n.__[0],l=n.t(u,s);u!==l&&(n.__N=[l,n.__[1]],n.__c.setState({}))}],n.__c=m,!m.u)){var o=function(s,u,l){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,s,u,l);var r=!1;return p.forEach(function(d){if(d.__N){var a=d.__[0];d.__=d.__N,d.__N=void 0,a!==d.__[0]&&(r=!0)}}),!(!r&&n.__c.props===s)&&(!i||i.call(this,s,u,l))};m.u=!0;var i=m.shouldComponentUpdate,c=m.componentWillUpdate;m.componentWillUpdate=function(s,u,l){if(this.__e){var p=i;i=void 0,o(s,u,l),i=p}c&&c.call(this,s,u,l)},m.shouldComponentUpdate=o}return n.__N||n.__}function Fe(e,t){var _=Ce(L++,3);!f.__s&&We(_.__H,t)&&(_.__=e,_.i=t,m.__H.__h.push(_))}function Le(){for(var e;e=ve.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=[],f.__e(t,e.__v)}}f.__b=function(e){m=null,ye&&ye(e)},f.__r=function(e){ge&&ge(e),L=0;var t=(m=e.__c).__H;t&&(Y===m?(t.__h=[],m.__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=m},f.diffed=function(e){be&&be(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ve.push(t)!==1&&me===f.requestAnimationFrame||((me=f.requestAnimationFrame)||Ae)(Le)),t.__H.__.forEach(function(_){_.i&&(_.__H=_.i),_.__V!==A&&(_.__=_.__V),_.i=void 0,_.__V=A})),Y=m=null},f.__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=[],f.__e(n,_.__v)}}),ke&&ke(e,t)},f.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&&f.__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=m,_=e.__c;typeof _=="function"&&(e.__c=void 0,_()),m=t}function Q(e){var t=m;e.__c=e.__(),m=t}function We(e,t){return!e||e.length!==t.length||t.some(function(_,n){return _!==e[n]})}function Ee(e,t){return typeof t=="function"?t(e):t}var Ve=0;function we(e,t,_,n,o,i){var c,s,u={};for(s in t)s=="ref"?c=t[s]:u[s]=t[s];var l={type:e,props:u,key:_,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(s in c)u[s]===void 0&&(u[s]=c[s]);return f.vnode&&f.vnode(l),l}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]),we("div",{ref:_,id:"spiffThemeWrapper"})};function Be(e,t){V=new qe,window.SpiffThemeLoader=V;let _;typeof e=="string"?_=document.getElementById(e):_=e,je(we(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.8",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(console.log(`chunk ${e} isEntry: ${t.isEntry}, isDynamicEntry: ${t.isDynamicEntry}, isImplicitEntry: ${t.isImplicitEntry}`),t.isImplicitEntry&&!_)return null;if(!t.isDynamicEntry)return{type:P.Javascript,mimeType:"text/javascript",preload:!t.isEntry,filename:e}}else if(e.endsWith(".css"))return{type:P.CSS,mimeType:"text/css",filename:e};return null}function Re(e){const{autoGenerateTargetFiles:t=!0,configurationSchema:_,includePreloadChunks:n=!0,targetFiles:o}=e??{};return{name:"spiff-theme-plugin",version:ze.version,config(i,c){i.base!==void 0&&i.base!==""&&console.warn('You have specified a `base` in your vite configuration other than "". This value will now be overwritten.'),i.base=""},writeBundle(i,c){const s=t?Object.keys(c).map(l=>o!=null&&o.some(p=>p.filename===l)?null:Je(l,c[l],n)).filter(l=>l!==null):[];o&&s.push(...o);const u={launchData:{targetFiles:s},configurationSchema:_};k.writeFileSync(w.join(i.dir,"spiffTheme.json"),JSON.stringify(u,void 0,4))}}}v.AssetType=_e,v.FieldType=te,v.ThemeFileType=P,v.exampleThemeInstallConfig=Ze,v.setSpiffDevOptions=Be,v.spiffThemePlugin=Re,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
|