@spiffcommerce/theme-bridge 1.8.0 → 1.9.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/dist/index.d.ts +107 -38
- package/dist/index.js +91 -91
- package/dist/index.umd.cjs +1 -1
- package/package.json +10 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,55 +1,136 @@
|
|
|
1
1
|
import { DesignCreationMessage, SpiffCommerceClient } from '@spiffcommerce/core';
|
|
2
2
|
|
|
3
3
|
interface ThemeConfigurationFile {
|
|
4
|
+
/**
|
|
5
|
+
* Information the theme loader needs in order to launch your theme.
|
|
6
|
+
*/
|
|
4
7
|
launchData: ThemeConfigurationLaunchData;
|
|
5
|
-
|
|
8
|
+
/**
|
|
9
|
+
* An object that describes information that's configurable by a Partner when they install your theme.
|
|
10
|
+
*/
|
|
11
|
+
configurationSchema?: ThemeConfigurationSchema;
|
|
6
12
|
}
|
|
7
13
|
declare enum ThemeFileType {
|
|
8
14
|
Javascript = "Javascript",
|
|
9
15
|
CSS = "CSS"
|
|
10
16
|
}
|
|
11
17
|
interface ThemeConfigurationLaunchData {
|
|
18
|
+
/**
|
|
19
|
+
* Files that will be loaded when launching the theme.
|
|
20
|
+
*/
|
|
12
21
|
targetFiles: ThemeConfigurationLaunchDataTargetFile[];
|
|
13
22
|
}
|
|
14
|
-
interface
|
|
23
|
+
interface LaunchFileBase {
|
|
24
|
+
/**
|
|
25
|
+
* The local path to the file.
|
|
26
|
+
*/
|
|
15
27
|
filename: string;
|
|
16
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The MIME type of the file.
|
|
30
|
+
*/
|
|
17
31
|
mimeType: string;
|
|
18
32
|
}
|
|
19
|
-
interface
|
|
20
|
-
|
|
33
|
+
interface GenericLaunchFile {
|
|
34
|
+
type: ThemeFileType.CSS;
|
|
21
35
|
}
|
|
22
|
-
interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
interface JavascriptLaunchFile extends LaunchFileBase {
|
|
37
|
+
/**
|
|
38
|
+
* When `false`, the file will be loaded immediately. When `true`, the file will instead be pre-loaded.
|
|
39
|
+
* With javascript files, this will insert them into the page as `<link rel="modulepreload" ... >`.
|
|
40
|
+
*/
|
|
41
|
+
preload?: boolean;
|
|
42
|
+
type: ThemeFileType.Javascript;
|
|
27
43
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
type ThemeConfigurationLaunchDataTargetFile = GenericLaunchFile | JavascriptLaunchFile;
|
|
45
|
+
declare enum FieldType {
|
|
46
|
+
Asset = "Asset",
|
|
47
|
+
Boolean = "Boolean",
|
|
48
|
+
Color = "Color",
|
|
31
49
|
Heading = "Heading",
|
|
50
|
+
MultiLineText = "MultiLineText",
|
|
32
51
|
Number = "Number",
|
|
33
|
-
Boolean = "Boolean",
|
|
34
52
|
Select = "Select",
|
|
35
|
-
|
|
36
|
-
Color = "Color"
|
|
53
|
+
SingleLineText = "SingleLineText"
|
|
37
54
|
}
|
|
38
55
|
interface ThemeConfigurationSchema {
|
|
56
|
+
/**
|
|
57
|
+
* An array of fields that a Partner can configure when they install the theme.
|
|
58
|
+
*/
|
|
39
59
|
fields: ThemeConfigurationSchemaField[];
|
|
40
60
|
}
|
|
41
|
-
interface
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
61
|
+
interface FieldBase {
|
|
62
|
+
/**
|
|
63
|
+
* The display name for the field. When `type` is `"Heading"`, this is the heading string.
|
|
64
|
+
*/
|
|
65
|
+
title: string;
|
|
66
|
+
}
|
|
67
|
+
interface GenericField extends FieldBase {
|
|
68
|
+
/**
|
|
69
|
+
* A locally unique identifier for the field.
|
|
70
|
+
*/
|
|
71
|
+
key: string;
|
|
72
|
+
/**
|
|
73
|
+
* Optional: A brief description of what the field might be used for. This is displayed beneath the field in the configuration form.
|
|
74
|
+
*/
|
|
45
75
|
description?: string;
|
|
76
|
+
}
|
|
77
|
+
type GenericFieldTypes = FieldType.Boolean | FieldType.Color | FieldType.MultiLineText | FieldType.Number | FieldType.SingleLineText;
|
|
78
|
+
interface GenericFieldWithRequired extends GenericField {
|
|
79
|
+
/**
|
|
80
|
+
* Optional: Set to `true` to require a value to be provided in the configuration form.
|
|
81
|
+
*/
|
|
46
82
|
required?: boolean;
|
|
83
|
+
type: GenericFieldTypes;
|
|
84
|
+
}
|
|
85
|
+
interface GenericFieldWithDefault extends GenericField {
|
|
86
|
+
/**
|
|
87
|
+
* Optional: A default value to supply. Values are always supplied as strings.
|
|
88
|
+
* When the `type` is `"Select"`, this should be one of the `key` fields in the `options` array.
|
|
89
|
+
*/
|
|
47
90
|
defaultValue?: string;
|
|
48
|
-
|
|
91
|
+
type: GenericFieldTypes;
|
|
92
|
+
}
|
|
93
|
+
interface AssetField extends GenericField {
|
|
94
|
+
/**
|
|
95
|
+
* The type of asset, e.g. Image, Model, Font, etc.
|
|
96
|
+
*/
|
|
97
|
+
assetType: AssetType;
|
|
98
|
+
type: FieldType.Asset;
|
|
99
|
+
}
|
|
100
|
+
interface SelectFieldBase {
|
|
101
|
+
/**
|
|
102
|
+
* The options available for the Partner to select in the configuration form.
|
|
103
|
+
*/
|
|
104
|
+
options: {
|
|
105
|
+
/**
|
|
106
|
+
* A locally unique identifier (within this set of options).
|
|
107
|
+
*/
|
|
49
108
|
key: string;
|
|
109
|
+
/**
|
|
110
|
+
* The string that is displayed visually in the menu item.
|
|
111
|
+
*/
|
|
50
112
|
value: string;
|
|
51
113
|
}[];
|
|
52
|
-
|
|
114
|
+
type: FieldType.Select;
|
|
115
|
+
}
|
|
116
|
+
type SelectFieldWithRequired = Omit<GenericFieldWithRequired, "type"> & SelectFieldBase;
|
|
117
|
+
type SelectFieldWithDefault = Omit<GenericFieldWithDefault, "type"> & SelectFieldBase;
|
|
118
|
+
interface HeadingField extends FieldBase {
|
|
119
|
+
type: FieldType.Heading;
|
|
120
|
+
}
|
|
121
|
+
type ThemeConfigurationSchemaField = GenericFieldWithRequired | GenericFieldWithDefault | AssetField | SelectFieldWithRequired | SelectFieldWithDefault | HeadingField;
|
|
122
|
+
declare enum AssetType {
|
|
123
|
+
Color = "Color",
|
|
124
|
+
ColorProfile = "ColorProfile",
|
|
125
|
+
Data = "Data",
|
|
126
|
+
Environment = "Environment",
|
|
127
|
+
Font = "Font",
|
|
128
|
+
Frame = "Frame",
|
|
129
|
+
Illustration = "Illustration",
|
|
130
|
+
Image = "Image",
|
|
131
|
+
Material = "Material",
|
|
132
|
+
Model = "Model",
|
|
133
|
+
Video = "Video"
|
|
53
134
|
}
|
|
54
135
|
|
|
55
136
|
interface ThemeResource {
|
|
@@ -72,7 +153,7 @@ interface ThemeConfigurationSchemaResource {
|
|
|
72
153
|
}
|
|
73
154
|
interface ThemeConfigurationSchemaFieldResource {
|
|
74
155
|
key?: string;
|
|
75
|
-
type:
|
|
156
|
+
type: FieldType;
|
|
76
157
|
title?: string;
|
|
77
158
|
description?: string;
|
|
78
159
|
required?: boolean;
|
|
@@ -91,6 +172,7 @@ interface ThemeLaunchDataTargetFileResource {
|
|
|
91
172
|
type: ThemeFileType;
|
|
92
173
|
mimeType: string;
|
|
93
174
|
fileLink: string;
|
|
175
|
+
preload?: boolean;
|
|
94
176
|
}
|
|
95
177
|
interface ThemeInstallConfigurationResource {
|
|
96
178
|
id: string;
|
|
@@ -105,22 +187,9 @@ interface ThemeInstallConfigurationField {
|
|
|
105
187
|
key?: string;
|
|
106
188
|
fallbackToDefaultConfiguration?: boolean;
|
|
107
189
|
value?: string;
|
|
108
|
-
type:
|
|
190
|
+
type: FieldType;
|
|
109
191
|
asset?: AssetResource;
|
|
110
192
|
}
|
|
111
|
-
declare enum AssetType {
|
|
112
|
-
Data = "Data",
|
|
113
|
-
Font = "Font",
|
|
114
|
-
Frame = "Frame",
|
|
115
|
-
Illustration = "Illustration",
|
|
116
|
-
Image = "Image",
|
|
117
|
-
Model = "Model",
|
|
118
|
-
Material = "Material",
|
|
119
|
-
Color = "Color",
|
|
120
|
-
Video = "Video",
|
|
121
|
-
ColorProfile = "ColorProfile",
|
|
122
|
-
Environment = "Environment"
|
|
123
|
-
}
|
|
124
193
|
interface AssetResource {
|
|
125
194
|
key: string;
|
|
126
195
|
name: string;
|
|
@@ -220,4 +289,4 @@ type SpiffDevOptions = Omit<ThemeContextTransaction, "container"> | Omit<ThemeCo
|
|
|
220
289
|
declare function setSpiffDevOptions(container: HTMLElement | string, context: SpiffDevOptions): void;
|
|
221
290
|
declare function exampleThemeInstallConfig(opts?: Partial<ThemeInstallConfigurationResource>): ThemeInstallConfigurationResource;
|
|
222
291
|
|
|
223
|
-
export { type AssetResource, AssetType, type BundleDesignCreationMessage, type DesignCreationMessageWithQuantity, type SpiffDevOptions, type SpiffThemeLoader,
|
|
292
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var x_ = Object.defineProperty;
|
|
2
2
|
var C_ = (_, e, t) => e in _ ? x_(_, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[e] = t;
|
|
3
3
|
var q = (_, e, t) => (C_(_, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
var S_ = /* @__PURE__ */ ((_) => (_.Javascript = "Javascript", _.CSS = "CSS", _))(S_ || {}), E_ = /* @__PURE__ */ ((_) => (_.
|
|
4
|
+
var S_ = /* @__PURE__ */ ((_) => (_.Javascript = "Javascript", _.CSS = "CSS", _))(S_ || {}), E_ = /* @__PURE__ */ ((_) => (_.Asset = "Asset", _.Boolean = "Boolean", _.Color = "Color", _.Heading = "Heading", _.MultiLineText = "MultiLineText", _.Number = "Number", _.Select = "Select", _.SingleLineText = "SingleLineText", _))(E_ || {}), w_ = /* @__PURE__ */ ((_) => (_.Color = "Color", _.ColorProfile = "ColorProfile", _.Data = "Data", _.Environment = "Environment", _.Font = "Font", _.Frame = "Frame", _.Illustration = "Illustration", _.Image = "Image", _.Material = "Material", _.Model = "Model", _.Video = "Video", _))(w_ || {}), V, s, f_, S, X, a_, O, H = {}, s_ = [], H_ = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i, G = Array.isArray;
|
|
5
5
|
function C(_, e) {
|
|
6
6
|
for (var t in e)
|
|
7
7
|
_[t] = e[t];
|
|
@@ -12,13 +12,13 @@ function d_(_) {
|
|
|
12
12
|
e && e.removeChild(_);
|
|
13
13
|
}
|
|
14
14
|
function $_(_, e, t) {
|
|
15
|
-
var n, r, i,
|
|
15
|
+
var n, r, i, c = {};
|
|
16
16
|
for (i in e)
|
|
17
|
-
i == "key" ? n = e[i] : i == "ref" ? r = e[i] :
|
|
18
|
-
if (arguments.length > 2 && (
|
|
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 ? V.call(arguments, 2) : t), typeof _ == "function" && _.defaultProps != null)
|
|
19
19
|
for (i in _.defaultProps)
|
|
20
|
-
|
|
21
|
-
return L(_,
|
|
20
|
+
c[i] === void 0 && (c[i] = _.defaultProps[i]);
|
|
21
|
+
return L(_, c, n, r, null);
|
|
22
22
|
}
|
|
23
23
|
function L(_, e, t, n, r) {
|
|
24
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 ?? ++f_, __i: -1, __u: 0 };
|
|
@@ -50,26 +50,26 @@ function p_(_) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function Y(_) {
|
|
53
|
-
(!_.__d && (_.__d = !0) && S.push(_) && !
|
|
53
|
+
(!_.__d && (_.__d = !0) && S.push(_) && !U.__r++ || X !== s.debounceRendering) && ((X = s.debounceRendering) || a_)(U);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
var _, e, t, n, r, i,
|
|
55
|
+
function U() {
|
|
56
|
+
var _, e, t, n, r, i, c, l, f;
|
|
57
57
|
for (S.sort(O); _ = S.shift(); )
|
|
58
|
-
_.__d && (e = S.length, n = void 0, i = (r = (t = _).__v).__e, l = [], f = [], (
|
|
59
|
-
|
|
58
|
+
_.__d && (e = S.length, n = void 0, i = (r = (t = _).__v).__e, l = [], f = [], (c = t.__P) && ((n = C({}, r)).__v = r.__v + 1, s.vnode && s.vnode(n), J(c, n, r, t.__n, c.ownerSVGElement !== void 0, 32 & r.__u ? [i] : null, l, i ?? E(r), !!(32 & r.__u), f), n.__.__k[n.__i] = n, m_(l, n, f), n.__e != i && p_(n)), S.length > e && S.sort(O));
|
|
59
|
+
U.__r = 0;
|
|
60
60
|
}
|
|
61
|
-
function h_(_, e, t, n, r, i,
|
|
61
|
+
function h_(_, e, t, n, r, i, c, l, f, u, d) {
|
|
62
62
|
var o, p, a, m, k, g = n && n.__k || s_, h = e.length;
|
|
63
63
|
for (t.__d = f, P_(t, e, g), f = t.__d, o = 0; o < h; o++)
|
|
64
|
-
(a = t.__k[o]) != null && typeof a != "boolean" && typeof a != "function" && (p = a.__i === -1 ? H : g[a.__i] || H, a.__i = o, J(_, a, p, r, i,
|
|
64
|
+
(a = t.__k[o]) != null && typeof a != "boolean" && typeof a != "function" && (p = a.__i === -1 ? H : g[a.__i] || H, a.__i = o, J(_, a, p, r, i, c, l, f, u, d), m = a.__e, a.ref && p.ref != a.ref && (p.ref && K(p.ref, null, a), d.push(a.ref, a.__c || m, a)), k == null && m != null && (k = m), 65536 & a.__u || p.__k === a.__k ? f = v_(a, f, _) : typeof a.type == "function" && a.__d !== void 0 ? f = a.__d : m && (f = m.nextSibling), a.__d = void 0, a.__u &= -196609);
|
|
65
65
|
t.__d = f, t.__e = k;
|
|
66
66
|
}
|
|
67
67
|
function P_(_, e, t) {
|
|
68
|
-
var n, r, i,
|
|
68
|
+
var n, r, i, c, l, f = e.length, u = t.length, d = u, o = 0;
|
|
69
69
|
for (_.__k = [], n = 0; n < f; 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) : G(r) ? L(F, { 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 = D_(r, t,
|
|
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) : G(r) ? L(F, { 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 = D_(r, t, c = n + o, d), r.__i = l, i = null, l !== -1 && (d--, (i = t[l]) && (i.__u |= 131072)), i == null || i.__v === null ? (l == -1 && o--, typeof r.type != "function" && (r.__u |= 65536)) : l !== c && (l === c + 1 ? o++ : l > c ? d > f - c ? o += l - c : o-- : o = l < c && l == c - 1 ? l - c : 0, l !== n + o && (r.__u |= 65536))) : (i = t[n]) && i.key == null && i.__e && (i.__e == _.__d && (_.__d = E(i)), R(i, i, !1), t[n] = null, d--);
|
|
71
71
|
if (d)
|
|
72
|
-
for (n = 0; n <
|
|
72
|
+
for (n = 0; n < u; n++)
|
|
73
73
|
(i = t[n]) != null && !(131072 & i.__u) && (i.__e == _.__d && (_.__d = E(i)), R(i, i));
|
|
74
74
|
}
|
|
75
75
|
function v_(_, e, t) {
|
|
@@ -82,15 +82,15 @@ function v_(_, e, t) {
|
|
|
82
82
|
return _.__e != e && (t.insertBefore(_.__e, e || null), e = _.__e), e && e.nextSibling;
|
|
83
83
|
}
|
|
84
84
|
function D_(_, e, t, n) {
|
|
85
|
-
var r = _.key, i = _.type,
|
|
85
|
+
var r = _.key, i = _.type, c = t - 1, l = t + 1, f = e[t];
|
|
86
86
|
if (f === null || f && r == f.key && i === f.type)
|
|
87
87
|
return t;
|
|
88
88
|
if (n > (f != null && !(131072 & f.__u) ? 1 : 0))
|
|
89
|
-
for (;
|
|
90
|
-
if (
|
|
91
|
-
if ((f = e[
|
|
92
|
-
return
|
|
93
|
-
|
|
89
|
+
for (; c >= 0 || l < e.length; ) {
|
|
90
|
+
if (c >= 0) {
|
|
91
|
+
if ((f = e[c]) && !(131072 & f.__u) && r == f.key && i === f.type)
|
|
92
|
+
return c;
|
|
93
|
+
c--;
|
|
94
94
|
}
|
|
95
95
|
if (l < e.length) {
|
|
96
96
|
if ((f = e[l]) && !(131072 & f.__u) && r == f.key && i === f.type)
|
|
@@ -143,7 +143,7 @@ function e_(_) {
|
|
|
143
143
|
function t_(_) {
|
|
144
144
|
return this.l[_.type + !0](s.event ? s.event(_) : _);
|
|
145
145
|
}
|
|
146
|
-
function J(_, e, t, n, r, i,
|
|
146
|
+
function J(_, e, t, n, r, i, c, l, f, u) {
|
|
147
147
|
var d, o, p, a, m, k, g, h, y, x, $, w, Q, P, B, b = e.type;
|
|
148
148
|
if (e.constructor !== void 0)
|
|
149
149
|
return null;
|
|
@@ -159,7 +159,7 @@ function J(_, e, t, n, r, i, u, l, f, c) {
|
|
|
159
159
|
D && (D.__ = e);
|
|
160
160
|
}), $ = 0; $ < o._sb.length; $++)
|
|
161
161
|
o.__h.push(o._sb[$]);
|
|
162
|
-
o._sb = [], o.__h.length &&
|
|
162
|
+
o._sb = [], o.__h.length && c.push(o);
|
|
163
163
|
break _;
|
|
164
164
|
}
|
|
165
165
|
o.componentWillUpdate != null && o.componentWillUpdate(h, o.__s, x), o.componentDidUpdate != null && o.__h.push(function() {
|
|
@@ -174,12 +174,12 @@ function J(_, e, t, n, r, i, u, l, f, c) {
|
|
|
174
174
|
do
|
|
175
175
|
o.__d = !1, w && w(e), d = o.render(o.props, o.state, o.context), o.state = o.__s;
|
|
176
176
|
while (o.__d && ++Q < 25);
|
|
177
|
-
o.state = o.__s, o.getChildContext != null && (n = C(C({}, n), o.getChildContext())), p || o.getSnapshotBeforeUpdate == null || (k = o.getSnapshotBeforeUpdate(a, m)), h_(_, G(B = d != null && d.type === F && d.key == null ? d.props.children : d) ? B : [B], e, t, n, r, i,
|
|
177
|
+
o.state = o.__s, o.getChildContext != null && (n = C(C({}, n), o.getChildContext())), p || o.getSnapshotBeforeUpdate == null || (k = o.getSnapshotBeforeUpdate(a, m)), h_(_, G(B = d != null && d.type === F && d.key == null ? d.props.children : d) ? B : [B], e, t, n, r, i, c, l, f, u), o.base = e.__e, e.__u &= -161, o.__h.length && c.push(o), g && (o.__E = o.__ = null);
|
|
178
178
|
} catch (D) {
|
|
179
179
|
e.__v = null, f || i != null ? (e.__e = l, e.__u |= f ? 160 : 32, i[i.indexOf(l)] = null) : (e.__e = t.__e, e.__k = t.__k), s.__e(D, e, t);
|
|
180
180
|
}
|
|
181
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,
|
|
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, f, u);
|
|
183
183
|
(d = s.diffed) && d(e);
|
|
184
184
|
}
|
|
185
185
|
function m_(_, e, t) {
|
|
@@ -196,12 +196,12 @@ function m_(_, e, t) {
|
|
|
196
196
|
}
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function N_(_, e, t, n, r, i,
|
|
200
|
-
var
|
|
199
|
+
function N_(_, e, t, n, r, i, c, l, f) {
|
|
200
|
+
var u, d, o, p, a, m, k, g = t.props, h = e.props, y = e.type;
|
|
201
201
|
if (y === "svg" && (r = !0), i != null) {
|
|
202
|
-
for (
|
|
203
|
-
if ((a = i[
|
|
204
|
-
_ = a, i[
|
|
202
|
+
for (u = 0; u < i.length; u++)
|
|
203
|
+
if ((a = i[u]) && "setAttribute" in a == !!y && (y ? a.localName === y : a.nodeType === 3)) {
|
|
204
|
+
_ = a, i[u] = null;
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
@@ -213,19 +213,19 @@ function N_(_, e, t, n, r, i, u, l, f) {
|
|
|
213
213
|
if (y === null)
|
|
214
214
|
g === h || l && _.data === h || (_.data = h);
|
|
215
215
|
else {
|
|
216
|
-
if (i = i &&
|
|
217
|
-
for (g = {},
|
|
218
|
-
g[(a = _.attributes[
|
|
219
|
-
for (
|
|
220
|
-
a = g[
|
|
221
|
-
for (
|
|
222
|
-
a = h[
|
|
216
|
+
if (i = i && V.call(_.childNodes), g = t.props || H, !l && i != null)
|
|
217
|
+
for (g = {}, u = 0; u < _.attributes.length; u++)
|
|
218
|
+
g[(a = _.attributes[u]).name] = a.value;
|
|
219
|
+
for (u in g)
|
|
220
|
+
a = g[u], u == "children" || (u == "dangerouslySetInnerHTML" ? o = a : u === "key" || u in h || N(_, u, null, a, r));
|
|
221
|
+
for (u in h)
|
|
222
|
+
a = h[u], u == "children" ? p = a : u == "dangerouslySetInnerHTML" ? d = a : u == "value" ? m = a : u == "checked" ? k = a : u === "key" || l && typeof a != "function" || g[u] === a || N(_, u, a, g[u], r);
|
|
223
223
|
if (d)
|
|
224
224
|
l || o && (d.__html === o.__html || d.__html === _.innerHTML) || (_.innerHTML = d.__html), e.__k = [];
|
|
225
|
-
else if (o && (_.innerHTML = ""), h_(_, G(p) ? p : [p], e, t, n, r && y !== "foreignObject", i,
|
|
226
|
-
for (
|
|
227
|
-
i[
|
|
228
|
-
l || (
|
|
225
|
+
else if (o && (_.innerHTML = ""), h_(_, G(p) ? p : [p], e, t, n, r && y !== "foreignObject", i, c, i ? i[0] : t.__k && E(t, 0), l, f), i != null)
|
|
226
|
+
for (u = i.length; u--; )
|
|
227
|
+
i[u] != null && d_(i[u]);
|
|
228
|
+
l || (u = "value", m !== void 0 && (m !== _[u] || y === "progress" && !m || y === "option" && m !== g[u]) && N(_, u, m, g[u], !1), u = "checked", k !== void 0 && k !== _[u] && N(_, u, k, g[u], !1));
|
|
229
229
|
}
|
|
230
230
|
return _;
|
|
231
231
|
}
|
|
@@ -256,14 +256,14 @@ function L_(_, e, t) {
|
|
|
256
256
|
return this.constructor(_, t);
|
|
257
257
|
}
|
|
258
258
|
function I_(_, e, t) {
|
|
259
|
-
var n, r, i,
|
|
260
|
-
s.__ && s.__(_, e), r = (n = typeof t == "function") ? null : t && t.__k || e.__k, i = [],
|
|
259
|
+
var n, r, i, c;
|
|
260
|
+
s.__ && s.__(_, e), r = (n = typeof t == "function") ? null : t && t.__k || e.__k, i = [], c = [], J(e, _ = (!n && t || e).__k = $_(F, null, [_]), r || H, H, e.ownerSVGElement !== void 0, !n && t ? [t] : r ? null : e.firstChild ? V.call(e.childNodes) : null, i, !n && t ? t : r ? r.__e : e.firstChild, n, c), m_(i, _, c);
|
|
261
261
|
}
|
|
262
|
-
|
|
263
|
-
for (var r, i,
|
|
262
|
+
V = s_.slice, s = { __e: function(_, e, t, n) {
|
|
263
|
+
for (var r, i, c; e = e.__; )
|
|
264
264
|
if ((r = e.__c) && !r.__)
|
|
265
265
|
try {
|
|
266
|
-
if ((i = r.constructor) && i.getDerivedStateFromError != null && (r.setState(i.getDerivedStateFromError(_)),
|
|
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
267
|
return r.__E = r;
|
|
268
268
|
} catch (l) {
|
|
269
269
|
_ = l;
|
|
@@ -276,23 +276,23 @@ T = s_.slice, s = { __e: function(_, e, t, n) {
|
|
|
276
276
|
this.__v && (this.__e = !0, _ && this.__h.push(_), Y(this));
|
|
277
277
|
}, I.prototype.render = F, S = [], a_ = typeof Promise == "function" ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, O = function(_, e) {
|
|
278
278
|
return _.__v.__b - e.__v.__b;
|
|
279
|
-
},
|
|
280
|
-
var
|
|
279
|
+
}, U.__r = 0;
|
|
280
|
+
var A, v, Z, n_, j = 0, g_ = [], M = [], o_ = s.__b, r_ = s.__r, i_ = s.diffed, l_ = s.__c, u_ = s.unmount;
|
|
281
281
|
function y_(_, e) {
|
|
282
282
|
s.__h && s.__h(v, _, j || e), j = 0;
|
|
283
283
|
var t = v.__H || (v.__H = { __: [], __h: [] });
|
|
284
284
|
return _ >= t.__.length && t.__.push({ __V: M }), t.__[_];
|
|
285
285
|
}
|
|
286
286
|
function M_(_) {
|
|
287
|
-
return j = 1,
|
|
287
|
+
return j = 1, T_(b_, _);
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
var n = y_(
|
|
289
|
+
function T_(_, e, t) {
|
|
290
|
+
var n = y_(A++, 2);
|
|
291
291
|
if (n.t = _, !n.__c && (n.__ = [t ? t(e) : b_(void 0, e), function(l) {
|
|
292
|
-
var f = n.__N ? n.__N[0] : n.__[0],
|
|
293
|
-
f !==
|
|
292
|
+
var f = n.__N ? n.__N[0] : n.__[0], u = n.t(f, l);
|
|
293
|
+
f !== u && (n.__N = [u, n.__[1]], n.__c.setState({}));
|
|
294
294
|
}], n.__c = v, !v.u)) {
|
|
295
|
-
var r = function(l, f,
|
|
295
|
+
var r = function(l, f, u) {
|
|
296
296
|
if (!n.__c.__H)
|
|
297
297
|
return !0;
|
|
298
298
|
var d = n.__c.__H.__.filter(function(p) {
|
|
@@ -301,36 +301,36 @@ function U_(_, e, t) {
|
|
|
301
301
|
if (d.every(function(p) {
|
|
302
302
|
return !p.__N;
|
|
303
303
|
}))
|
|
304
|
-
return !i || i.call(this, l, f,
|
|
304
|
+
return !i || i.call(this, l, f, u);
|
|
305
305
|
var o = !1;
|
|
306
306
|
return d.forEach(function(p) {
|
|
307
307
|
if (p.__N) {
|
|
308
308
|
var a = p.__[0];
|
|
309
309
|
p.__ = p.__N, p.__N = void 0, a !== p.__[0] && (o = !0);
|
|
310
310
|
}
|
|
311
|
-
}), !(!o && n.__c.props === l) && (!i || i.call(this, l, f,
|
|
311
|
+
}), !(!o && n.__c.props === l) && (!i || i.call(this, l, f, u));
|
|
312
312
|
};
|
|
313
313
|
v.u = !0;
|
|
314
|
-
var i = v.shouldComponentUpdate,
|
|
315
|
-
v.componentWillUpdate = function(l, f,
|
|
314
|
+
var i = v.shouldComponentUpdate, c = v.componentWillUpdate;
|
|
315
|
+
v.componentWillUpdate = function(l, f, u) {
|
|
316
316
|
if (this.__e) {
|
|
317
317
|
var d = i;
|
|
318
|
-
i = void 0, r(l, f,
|
|
318
|
+
i = void 0, r(l, f, u), i = d;
|
|
319
319
|
}
|
|
320
|
-
|
|
320
|
+
c && c.call(this, l, f, u);
|
|
321
321
|
}, v.shouldComponentUpdate = r;
|
|
322
322
|
}
|
|
323
323
|
return n.__N || n.__;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
var t = y_(
|
|
327
|
-
!s.__s &&
|
|
325
|
+
function U_(_, e) {
|
|
326
|
+
var t = y_(A++, 3);
|
|
327
|
+
!s.__s && V_(t.__H, e) && (t.__ = _, t.i = e, v.__H.__h.push(t));
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function A_() {
|
|
330
330
|
for (var _; _ = g_.shift(); )
|
|
331
331
|
if (_.__P && _.__H)
|
|
332
332
|
try {
|
|
333
|
-
_.__H.__h.forEach(
|
|
333
|
+
_.__H.__h.forEach(T), _.__H.__h.forEach(z), _.__H.__h = [];
|
|
334
334
|
} catch (e) {
|
|
335
335
|
_.__H.__h = [], s.__e(e, _.__v);
|
|
336
336
|
}
|
|
@@ -338,21 +338,21 @@ function W_() {
|
|
|
338
338
|
s.__b = function(_) {
|
|
339
339
|
v = null, o_ && o_(_);
|
|
340
340
|
}, s.__r = function(_) {
|
|
341
|
-
r_ && r_(_),
|
|
341
|
+
r_ && r_(_), A = 0;
|
|
342
342
|
var e = (v = _.__c).__H;
|
|
343
343
|
e && (Z === v ? (e.__h = [], v.__h = [], e.__.forEach(function(t) {
|
|
344
344
|
t.__N && (t.__ = t.__N), t.__V = M, t.__N = t.i = void 0;
|
|
345
|
-
})) : (e.__h.forEach(
|
|
345
|
+
})) : (e.__h.forEach(T), e.__h.forEach(z), e.__h = [], A = 0)), Z = v;
|
|
346
346
|
}, s.diffed = function(_) {
|
|
347
347
|
i_ && i_(_);
|
|
348
348
|
var e = _.__c;
|
|
349
|
-
e && e.__H && (e.__H.__h.length && (g_.push(e) !== 1 && n_ === s.requestAnimationFrame || ((n_ = s.requestAnimationFrame) ||
|
|
349
|
+
e && e.__H && (e.__H.__h.length && (g_.push(e) !== 1 && n_ === s.requestAnimationFrame || ((n_ = s.requestAnimationFrame) || W_)(A_)), e.__H.__.forEach(function(t) {
|
|
350
350
|
t.i && (t.__H = t.i), t.__V !== M && (t.__ = t.__V), t.i = void 0, t.__V = M;
|
|
351
351
|
})), Z = v = null;
|
|
352
352
|
}, s.__c = function(_, e) {
|
|
353
353
|
e.some(function(t) {
|
|
354
354
|
try {
|
|
355
|
-
t.__h.forEach(
|
|
355
|
+
t.__h.forEach(T), t.__h = t.__h.filter(function(n) {
|
|
356
356
|
return !n.__ || z(n);
|
|
357
357
|
});
|
|
358
358
|
} catch (n) {
|
|
@@ -362,24 +362,24 @@ s.__b = function(_) {
|
|
|
362
362
|
}
|
|
363
363
|
}), l_ && l_(_, e);
|
|
364
364
|
}, s.unmount = function(_) {
|
|
365
|
-
|
|
365
|
+
u_ && u_(_);
|
|
366
366
|
var e, t = _.__c;
|
|
367
367
|
t && t.__H && (t.__H.__.forEach(function(n) {
|
|
368
368
|
try {
|
|
369
|
-
|
|
369
|
+
T(n);
|
|
370
370
|
} catch (r) {
|
|
371
371
|
e = r;
|
|
372
372
|
}
|
|
373
373
|
}), t.__H = void 0, e && s.__e(e, t.__v));
|
|
374
374
|
};
|
|
375
|
-
var
|
|
376
|
-
function
|
|
375
|
+
var c_ = typeof requestAnimationFrame == "function";
|
|
376
|
+
function W_(_) {
|
|
377
377
|
var e, t = function() {
|
|
378
|
-
clearTimeout(n),
|
|
378
|
+
clearTimeout(n), c_ && cancelAnimationFrame(e), setTimeout(_);
|
|
379
379
|
}, n = setTimeout(t, 100);
|
|
380
|
-
|
|
380
|
+
c_ && (e = requestAnimationFrame(t));
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function T(_) {
|
|
383
383
|
var e = v, t = _.__c;
|
|
384
384
|
typeof t == "function" && (_.__c = void 0, t()), v = e;
|
|
385
385
|
}
|
|
@@ -387,7 +387,7 @@ function z(_) {
|
|
|
387
387
|
var e = v;
|
|
388
388
|
_.__c = _.__(), v = e;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function V_(_, e) {
|
|
391
391
|
return !_ || _.length !== e.length || e.some(function(t, n) {
|
|
392
392
|
return t !== _[n];
|
|
393
393
|
});
|
|
@@ -397,14 +397,14 @@ function b_(_, e) {
|
|
|
397
397
|
}
|
|
398
398
|
var F_ = 0;
|
|
399
399
|
function k_(_, e, t, n, r, i) {
|
|
400
|
-
var
|
|
400
|
+
var c, l, f = {};
|
|
401
401
|
for (l in e)
|
|
402
|
-
l == "ref" ?
|
|
403
|
-
var
|
|
404
|
-
if (typeof _ == "function" && (
|
|
405
|
-
for (l in
|
|
406
|
-
f[l] === void 0 && (f[l] =
|
|
407
|
-
return s.vnode && s.vnode(
|
|
402
|
+
l == "ref" ? c = e[l] : f[l] = e[l];
|
|
403
|
+
var u = { type: _, props: f, key: t, ref: c, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --F_, __i: -1, __u: 0, __source: r, __self: i };
|
|
404
|
+
if (typeof _ == "function" && (c = _.defaultProps))
|
|
405
|
+
for (l in c)
|
|
406
|
+
f[l] === void 0 && (f[l] = c[l]);
|
|
407
|
+
return s.vnode && s.vnode(u), u;
|
|
408
408
|
}
|
|
409
409
|
class B_ {
|
|
410
410
|
constructor() {
|
|
@@ -432,16 +432,16 @@ class B_ {
|
|
|
432
432
|
console.log("Add to cart", e);
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
|
-
let
|
|
435
|
+
let W;
|
|
436
436
|
const q_ = ({
|
|
437
437
|
context: _
|
|
438
438
|
}) => {
|
|
439
439
|
const [e, t] = M_(null);
|
|
440
|
-
return
|
|
440
|
+
return U_(() => {
|
|
441
441
|
if (e) {
|
|
442
|
-
if (
|
|
442
|
+
if (W === void 0)
|
|
443
443
|
throw new Error("Please call setSpiffDevOptions before requesting the context.");
|
|
444
|
-
|
|
444
|
+
W.setContext({
|
|
445
445
|
..._,
|
|
446
446
|
container: e
|
|
447
447
|
});
|
|
@@ -452,7 +452,7 @@ const q_ = ({
|
|
|
452
452
|
});
|
|
453
453
|
};
|
|
454
454
|
function O_(_, e) {
|
|
455
|
-
|
|
455
|
+
W = new B_(), window.SpiffThemeLoader = W;
|
|
456
456
|
let t;
|
|
457
457
|
typeof _ == "string" ? t = document.getElementById(_) : t = _, I_(k_(q_, {
|
|
458
458
|
context: e
|
|
@@ -489,7 +489,7 @@ function R_(_) {
|
|
|
489
489
|
}
|
|
490
490
|
export {
|
|
491
491
|
w_ as AssetType,
|
|
492
|
-
E_ as
|
|
492
|
+
E_ as FieldType,
|
|
493
493
|
S_ as ThemeFileType,
|
|
494
494
|
R_ as exampleThemeInstallConfig,
|
|
495
495
|
O_ as setSpiffDevOptions
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1 +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 Z_=Object.defineProperty;var j_=(b,k,C)=>k in b?Z_(b,k,{enumerable:!0,configurable:!0,writable:!0,value:C}):b[k]=C;var Y=(b,k,C)=>(j_(b,typeof k!="symbol"?k+"":k,C),C);var k=(_=>(_.Javascript="Javascript",_.CSS="CSS",_))(k||{}),C=(_=>(_.SingleLineText="SingleLineText",_.MultiLineText="MultiLineText",_.Heading="Heading",_.Number="Number",_.Boolean="Boolean",_.Select="Select",_.Asset="Asset",_.Color="Color",_))(C||{}),__=(_=>(_.Data="Data",_.Font="Font",_.Frame="Frame",_.Illustration="Illustration",_.Image="Image",_.Model="Model",_.Material="Material",_.Color="Color",_.Video="Video",_.ColorProfile="ColorProfile",_.Environment="Environment",_))(__||{}),N,s,e_,H,t_,n_,Z,P={},o_=[],w_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j=Array.isArray;function E(_,e){for(var t in e)_[t]=e[t];return _}function r_(_){var e=_.parentNode;e&&e.removeChild(_)}function H_(_,e,t){var n,r,i,u={};for(i in e)i=="key"?n=e[i]:i=="ref"?r=e[i]:u[i]=e[i];if(arguments.length>2&&(u.children=arguments.length>3?N.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(i in _.defaultProps)u[i]===void 0&&(u[i]=_.defaultProps[i]);return L(_,u,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??++e_,__i:-1,__u:0};return r==null&&s.vnode!=null&&s.vnode(i),i}function T(_){return _.children}function I(_,e){this.props=_,this.context=e}function $(_,e){if(e==null)return _.__?$(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?$(_):null}function i_(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return i_(_)}}function l_(_){(!_.__d&&(_.__d=!0)&&H.push(_)&&!M.__r++||t_!==s.debounceRendering)&&((t_=s.debounceRendering)||n_)(M)}function M(){var _,e,t,n,r,i,u,l,c;for(H.sort(Z);_=H.shift();)_.__d&&(e=H.length,n=void 0,i=(r=(t=_).__v).__e,l=[],c=[],(u=t.__P)&&((n=E({},r)).__v=r.__v+1,s.vnode&&s.vnode(n),R(u,n,r,t.__n,u.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??$(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,d_(l,n,c),n.__e!=i&&i_(n)),H.length>e&&H.sort(Z));M.__r=0}function f_(_,e,t,n,r,i,u,l,c,f,d){var o,p,a,m,S,g=n&&n.__k||o_,h=e.length;for(t.__d=c,$_(t,e,g),c=t.__d,o=0;o<h;o++)(a=t.__k[o])!=null&&typeof a!="boolean"&&typeof a!="function"&&(p=a.__i===-1?P:g[a.__i]||P,a.__i=o,R(_,a,p,r,i,u,l,c,f,d),m=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&z(p.ref,null,a),d.push(a.ref,a.__c||m,a)),S==null&&m!=null&&(S=m),65536&a.__u||p.__k===a.__k?c=u_(a,c,_):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:m&&(c=m.nextSibling),a.__d=void 0,a.__u&=-196609);t.__d=c,t.__e=S}function $_(_,e,t){var n,r,i,u,l,c=e.length,f=t.length,d=f,o=0;for(_.__k=[],n=0;n<c;n++)(r=_.__k[n]=(r=e[n])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?L(null,r,null,null,r):j(r)?L(T,{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,u=n+o,d),r.__i=l,i=null,l!==-1&&(d--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&o--,typeof r.type!="function"&&(r.__u|=65536)):l!==u&&(l===u+1?o++:l>u?d>c-u?o+=l-u:o--:o=l<u&&l==u-1?l-u:0,l!==n+o&&(r.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i,!1),t[n]=null,d--);if(d)for(n=0;n<f;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i))}function u_(_,e,t){var n,r;if(typeof _.type=="function"){for(n=_.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=_,e=u_(n[r],e,t));return e}return _.__e!=e&&(t.insertBefore(_.__e,e||null),e=_.__e),e&&e.nextSibling}function P_(_,e,t,n){var r=_.key,i=_.type,u=t-1,l=t+1,c=e[t];if(c===null||c&&r==c.key&&i===c.type)return t;if(n>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<e.length;){if(u>=0){if((c=e[u])&&!(131072&c.__u)&&r==c.key&&i===c.type)return u;u--}if(l<e.length){if((c=e[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function c_(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||w_.test(e)?t:t+"px"}function U(_,e,t,n,r){var i;_:if(e==="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof n=="string"&&(_.style.cssText=n=""),n)for(e in n)t&&e in t||c_(_.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||c_(_.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")i=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in _?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+i]=t,t?n?t.u=n.u:(t.u=Date.now(),_.addEventListener(e,i?s_:a_,i)):_.removeEventListener(e,i?s_:a_,i);else{if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in _)try{_[e]=t??"";break _}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,t))}}function a_(_){var e=this.l[_.type+!1];if(_.t){if(_.t<=e.u)return}else _.t=Date.now();return e(s.event?s.event(_):_)}function s_(_){return this.l[_.type+!0](s.event?s.event(_):_)}function R(_,e,t,n,r,i,u,l,c,f){var d,o,p,a,m,S,g,h,y,w,B,D,E_,O,X,x=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),i=[l=e.__e=t.__e]),(d=s.__b)&&d(e);_:if(typeof x=="function")try{if(h=e.props,y=(d=x.contextType)&&n[d.__c],w=d?y?y.props.value:d.__:n,t.__c?g=(o=e.__c=t.__c).__=o.__E:("prototype"in x&&x.prototype.render?e.__c=o=new x(h,w):(e.__c=o=new I(h,w),o.constructor=x,o.render=N_),y&&y.sub(o),o.props=h,o.state||(o.state={}),o.context=w,o.__n=n,p=o.__d=!0,o.__h=[],o._sb=[]),o.__s==null&&(o.__s=o.state),x.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=E({},o.__s)),E(o.__s,x.getDerivedStateFromProps(h,o.__s))),a=o.props,m=o.state,o.__v=e,p)x.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(x.getDerivedStateFromProps==null&&h!==a&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=h,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(q){q&&(q.__=e)}),B=0;B<o._sb.length;B++)o.__h.push(o._sb[B]);o._sb=[],o.__h.length&&u.push(o);break _}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,w),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(a,m,S)})}if(o.context=w,o.props=h,o.__P=_,o.__e=!1,D=s.__r,E_=0,"prototype"in x&&x.prototype.render){for(o.state=o.__s,o.__d=!1,D&&D(e),d=o.render(o.props,o.state,o.context),O=0;O<o._sb.length;O++)o.__h.push(o._sb[O]);o._sb=[]}else do o.__d=!1,D&&D(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++E_<25);o.state=o.__s,o.getChildContext!=null&&(n=E(E({},n),o.getChildContext())),p||o.getSnapshotBeforeUpdate==null||(S=o.getSnapshotBeforeUpdate(a,m)),f_(_,j(X=d!=null&&d.type===T&&d.key==null?d.props.children:d)?X:[X],e,t,n,r,i,u,l,c,f),o.base=e.__e,e.__u&=-161,o.__h.length&&u.push(o),g&&(o.__E=o.__=null)}catch(q){e.__v=null,c||i!=null?(e.__e=l,e.__u|=c?160:32,i[i.indexOf(l)]=null):(e.__e=t.__e,e.__k=t.__k),s.__e(q,e,t)}else i==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=D_(t.__e,e,t,n,r,i,u,c,f);(d=s.diffed)&&d(e)}function d_(_,e,t){e.__d=void 0;for(var n=0;n<t.length;n++)z(t[n],t[++n],t[++n]);s.__c&&s.__c(e,_),_.some(function(r){try{_=r.__h,r.__h=[],_.some(function(i){i.call(r)})}catch(i){s.__e(i,r.__v)}})}function D_(_,e,t,n,r,i,u,l,c){var f,d,o,p,a,m,S,g=t.props,h=e.props,y=e.type;if(y==="svg"&&(r=!0),i!=null){for(f=0;f<i.length;f++)if((a=i[f])&&"setAttribute"in a==!!y&&(y?a.localName===y:a.nodeType===3)){_=a,i[f]=null;break}}if(_==null){if(y===null)return document.createTextNode(h);_=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,h.is&&h),i=null,l=!1}if(y===null)g===h||l&&_.data===h||(_.data=h);else{if(i=i&&N.call(_.childNodes),g=t.props||P,!l&&i!=null)for(g={},f=0;f<_.attributes.length;f++)g[(a=_.attributes[f]).name]=a.value;for(f in g)a=g[f],f=="children"||(f=="dangerouslySetInnerHTML"?o=a:f==="key"||f in h||U(_,f,null,a,r));for(f in h)a=h[f],f=="children"?p=a:f=="dangerouslySetInnerHTML"?d=a:f=="value"?m=a:f=="checked"?S=a:f==="key"||l&&typeof a!="function"||g[f]===a||U(_,f,a,g[f],r);if(d)l||o&&(d.__html===o.__html||d.__html===_.innerHTML)||(_.innerHTML=d.__html),e.__k=[];else if(o&&(_.innerHTML=""),f_(_,j(p)?p:[p],e,t,n,r&&y!=="foreignObject",i,u,i?i[0]:t.__k&&$(t,0),l,c),i!=null)for(f=i.length;f--;)i[f]!=null&&r_(i[f]);l||(f="value",m!==void 0&&(m!==_[f]||y==="progress"&&!m||y==="option"&&m!==g[f])&&U(_,f,m,g[f],!1),f="checked",S!==void 0&&S!==_[f]&&U(_,f,S,g[f],!1))}return _}function z(_,e,t){try{typeof _=="function"?_(e):_.current=e}catch(n){s.__e(n,t)}}function G(_,e,t){var n,r;if(s.unmount&&s.unmount(_),(n=_.ref)&&(n.current&&n.current!==_.__e||z(n,null,e)),(n=_.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){s.__e(i,e)}n.base=n.__P=null,_.__c=void 0}if(n=_.__k)for(r=0;r<n.length;r++)n[r]&&G(n[r],e,t||typeof _.type!="function");t||_.__e==null||r_(_.__e),_.__=_.__e=_.__d=void 0}function N_(_,e,t){return this.constructor(_,t)}function L_(_,e,t){var n,r,i,u;s.__&&s.__(_,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,i=[],u=[],R(e,_=(!n&&t||e).__k=H_(T,null,[_]),r||P,P,e.ownerSVGElement!==void 0,!n&&t?[t]:r?null:e.firstChild?N.call(e.childNodes):null,i,!n&&t?t:r?r.__e:e.firstChild,n,u),d_(i,_,u)}N=o_.slice,s={__e:function(_,e,t,n){for(var r,i,u;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(_)),u=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(_,n||{}),u=r.__d),u)return r.__E=r}catch(l){_=l}throw _}},e_=0,I.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof _=="function"&&(_=_(E({},t),this.props)),_&&E(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),l_(this))},I.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),l_(this))},I.prototype.render=T,H=[],n_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(_,e){return _.__v.__b-e.__v.__b},M.__r=0;var A,v,J,p_,K=0,h_=[],W=[],v_=s.__b,m_=s.__r,g_=s.diffed,y_=s.__c,b_=s.unmount;function k_(_,e){s.__h&&s.__h(v,_,K||e),K=0;var t=v.__H||(v.__H={__:[],__h:[]});return _>=t.__.length&&t.__.push({__V:W}),t.__[_]}function T_(_){return K=1,I_(S_,_)}function I_(_,e,t){var n=k_(A++,2);if(n.t=_,!n.__c&&(n.__=[t?t(e):S_(void 0,e),function(l){var c=n.__N?n.__N[0]:n.__[0],f=n.t(c,l);c!==f&&(n.__N=[f,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var r=function(l,c,f){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,l,c,f);var o=!1;return d.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,f))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,f){if(this.__e){var d=i;i=void 0,r(l,c,f),i=d}u&&u.call(this,l,c,f)},v.shouldComponentUpdate=r}return n.__N||n.__}function M_(_,e){var t=k_(A++,3);!s.__s&&W_(t.__H,e)&&(t.__=_,t.i=e,v.__H.__h.push(t))}function U_(){for(var _;_=h_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(F),_.__H.__h.forEach(Q),_.__H.__h=[]}catch(e){_.__H.__h=[],s.__e(e,_.__v)}}s.__b=function(_){v=null,v_&&v_(_)},s.__r=function(_){m_&&m_(_),A=0;var e=(v=_.__c).__H;e&&(J===v?(e.__h=[],v.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=W,t.__N=t.i=void 0})):(e.__h.forEach(F),e.__h.forEach(Q),e.__h=[],A=0)),J=v},s.diffed=function(_){g_&&g_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(h_.push(e)!==1&&p_===s.requestAnimationFrame||((p_=s.requestAnimationFrame)||A_)(U_)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==W&&(t.__=t.__V),t.i=void 0,t.__V=W})),J=v=null},s.__c=function(_,e){e.some(function(t){try{t.__h.forEach(F),t.__h=t.__h.filter(function(n){return!n.__||Q(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],s.__e(n,t.__v)}}),y_&&y_(_,e)},s.unmount=function(_){b_&&b_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{F(n)}catch(r){e=r}}),t.__H=void 0,e&&s.__e(e,t.__v))};var x_=typeof requestAnimationFrame=="function";function A_(_){var e,t=function(){clearTimeout(n),x_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,100);x_&&(e=requestAnimationFrame(t))}function F(_){var e=v,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),v=e}function Q(_){var e=v;_.__c=_.__(),v=e}function W_(_,e){return!_||_.length!==e.length||e.some(function(t,n){return t!==_[n]})}function S_(_,e){return typeof e=="function"?e(_):e}var F_=0;function C_(_,e,t,n,r,i){var u,l,c={};for(l in e)l=="ref"?u=e[l]:c[l]=e[l];var f={type:_,props:c,key:t,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--F_,__i:-1,__u:0,__source:r,__self:i};if(typeof _=="function"&&(u=_.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return s.vnode&&s.vnode(f),f}class V_{constructor(){Y(this,"_context");Y(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(e=>{this._getContextCallbacks.push(e)})}setContext(e){this._context=e,this._getContextCallbacks.forEach(t=>t(e)),this._getContextCallbacks=[]}configureClient(e){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(e){console.log("Add to cart",e)}}let V;const B_=({context:_})=>{const[e,t]=T_(null);return M_(()=>{if(e){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({..._,container:e})}},[e,_]),C_("div",{ref:t,id:"spiffThemeWrapper"})};function O_(_,e){V=new V_,window.SpiffThemeLoader=V;let t;typeof _=="string"?t=document.getElementById(_):t=_,L_(C_(B_,{context:e}),t)}function q_(_){return{id:"example",themeInstallId:(_==null?void 0:_.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],..._}}b.AssetType=__,b.ThemeConfigurationFieldType=C,b.ThemeFileType=k,b.exampleThemeInstallConfig=q_,b.setSpiffDevOptions=O_,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
|
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 Z_=Object.defineProperty;var j_=(b,k,S)=>k in b?Z_(b,k,{enumerable:!0,configurable:!0,writable:!0,value:S}):b[k]=S;var Y=(b,k,S)=>(j_(b,typeof k!="symbol"?k+"":k,S),S);var k=(_=>(_.Javascript="Javascript",_.CSS="CSS",_))(k||{}),S=(_=>(_.Asset="Asset",_.Boolean="Boolean",_.Color="Color",_.Heading="Heading",_.MultiLineText="MultiLineText",_.Number="Number",_.Select="Select",_.SingleLineText="SingleLineText",_))(S||{}),__=(_=>(_.Color="Color",_.ColorProfile="ColorProfile",_.Data="Data",_.Environment="Environment",_.Font="Font",_.Frame="Frame",_.Illustration="Illustration",_.Image="Image",_.Material="Material",_.Model="Model",_.Video="Video",_))(__||{}),D,s,e_,H,t_,n_,Z,P={},o_=[],w_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,j=Array.isArray;function E(_,e){for(var t in e)_[t]=e[t];return _}function r_(_){var e=_.parentNode;e&&e.removeChild(_)}function H_(_,e,t){var n,r,i,u={};for(i in e)i=="key"?n=e[i]:i=="ref"?r=e[i]:u[i]=e[i];if(arguments.length>2&&(u.children=arguments.length>3?D.call(arguments,2):t),typeof _=="function"&&_.defaultProps!=null)for(i in _.defaultProps)u[i]===void 0&&(u[i]=_.defaultProps[i]);return N(_,u,n,r,null)}function N(_,e,t,n,r){var i={type:_,props:e,key:t,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:r??++e_,__i:-1,__u:0};return r==null&&s.vnode!=null&&s.vnode(i),i}function L(_){return _.children}function I(_,e){this.props=_,this.context=e}function $(_,e){if(e==null)return _.__?$(_.__,_.__i+1):null;for(var t;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null)return t.__e;return typeof _.type=="function"?$(_):null}function i_(_){var e,t;if((_=_.__)!=null&&_.__c!=null){for(_.__e=_.__c.base=null,e=0;e<_.__k.length;e++)if((t=_.__k[e])!=null&&t.__e!=null){_.__e=_.__c.base=t.__e;break}return i_(_)}}function l_(_){(!_.__d&&(_.__d=!0)&&H.push(_)&&!M.__r++||t_!==s.debounceRendering)&&((t_=s.debounceRendering)||n_)(M)}function M(){var _,e,t,n,r,i,u,l,c;for(H.sort(Z);_=H.shift();)_.__d&&(e=H.length,n=void 0,i=(r=(t=_).__v).__e,l=[],c=[],(u=t.__P)&&((n=E({},r)).__v=r.__v+1,s.vnode&&s.vnode(n),R(u,n,r,t.__n,u.ownerSVGElement!==void 0,32&r.__u?[i]:null,l,i??$(r),!!(32&r.__u),c),n.__.__k[n.__i]=n,d_(l,n,c),n.__e!=i&&i_(n)),H.length>e&&H.sort(Z));M.__r=0}function f_(_,e,t,n,r,i,u,l,c,f,d){var o,p,a,m,x,g=n&&n.__k||o_,h=e.length;for(t.__d=c,$_(t,e,g),c=t.__d,o=0;o<h;o++)(a=t.__k[o])!=null&&typeof a!="boolean"&&typeof a!="function"&&(p=a.__i===-1?P:g[a.__i]||P,a.__i=o,R(_,a,p,r,i,u,l,c,f,d),m=a.__e,a.ref&&p.ref!=a.ref&&(p.ref&&z(p.ref,null,a),d.push(a.ref,a.__c||m,a)),x==null&&m!=null&&(x=m),65536&a.__u||p.__k===a.__k?c=u_(a,c,_):typeof a.type=="function"&&a.__d!==void 0?c=a.__d:m&&(c=m.nextSibling),a.__d=void 0,a.__u&=-196609);t.__d=c,t.__e=x}function $_(_,e,t){var n,r,i,u,l,c=e.length,f=t.length,d=f,o=0;for(_.__k=[],n=0;n<c;n++)(r=_.__k[n]=(r=e[n])==null||typeof r=="boolean"||typeof r=="function"?null:typeof r=="string"||typeof r=="number"||typeof r=="bigint"||r.constructor==String?N(null,r,null,null,r):j(r)?N(L,{children:r},null,null,null):r.constructor===void 0&&r.__b>0?N(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)!=null?(r.__=_,r.__b=_.__b+1,l=P_(r,t,u=n+o,d),r.__i=l,i=null,l!==-1&&(d--,(i=t[l])&&(i.__u|=131072)),i==null||i.__v===null?(l==-1&&o--,typeof r.type!="function"&&(r.__u|=65536)):l!==u&&(l===u+1?o++:l>u?d>c-u?o+=l-u:o--:o=l<u&&l==u-1?l-u:0,l!==n+o&&(r.__u|=65536))):(i=t[n])&&i.key==null&&i.__e&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i,!1),t[n]=null,d--);if(d)for(n=0;n<f;n++)(i=t[n])!=null&&!(131072&i.__u)&&(i.__e==_.__d&&(_.__d=$(i)),G(i,i))}function u_(_,e,t){var n,r;if(typeof _.type=="function"){for(n=_.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=_,e=u_(n[r],e,t));return e}return _.__e!=e&&(t.insertBefore(_.__e,e||null),e=_.__e),e&&e.nextSibling}function P_(_,e,t,n){var r=_.key,i=_.type,u=t-1,l=t+1,c=e[t];if(c===null||c&&r==c.key&&i===c.type)return t;if(n>(c!=null&&!(131072&c.__u)?1:0))for(;u>=0||l<e.length;){if(u>=0){if((c=e[u])&&!(131072&c.__u)&&r==c.key&&i===c.type)return u;u--}if(l<e.length){if((c=e[l])&&!(131072&c.__u)&&r==c.key&&i===c.type)return l;l++}}return-1}function c_(_,e,t){e[0]==="-"?_.setProperty(e,t??""):_[e]=t==null?"":typeof t!="number"||w_.test(e)?t:t+"px"}function U(_,e,t,n,r){var i;_:if(e==="style")if(typeof t=="string")_.style.cssText=t;else{if(typeof n=="string"&&(_.style.cssText=n=""),n)for(e in n)t&&e in t||c_(_.style,e,"");if(t)for(e in t)n&&t[e]===n[e]||c_(_.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")i=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in _?e.toLowerCase().slice(2):e.slice(2),_.l||(_.l={}),_.l[e+i]=t,t?n?t.u=n.u:(t.u=Date.now(),_.addEventListener(e,i?s_:a_,i)):_.removeEventListener(e,i?s_:a_,i);else{if(r)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in _)try{_[e]=t??"";break _}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?_.removeAttribute(e):_.setAttribute(e,t))}}function a_(_){var e=this.l[_.type+!1];if(_.t){if(_.t<=e.u)return}else _.t=Date.now();return e(s.event?s.event(_):_)}function s_(_){return this.l[_.type+!0](s.event?s.event(_):_)}function R(_,e,t,n,r,i,u,l,c,f){var d,o,p,a,m,x,g,h,y,w,B,T,E_,O,X,C=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(c=!!(32&t.__u),i=[l=e.__e=t.__e]),(d=s.__b)&&d(e);_:if(typeof C=="function")try{if(h=e.props,y=(d=C.contextType)&&n[d.__c],w=d?y?y.props.value:d.__:n,t.__c?g=(o=e.__c=t.__c).__=o.__E:("prototype"in C&&C.prototype.render?e.__c=o=new C(h,w):(e.__c=o=new I(h,w),o.constructor=C,o.render=D_),y&&y.sub(o),o.props=h,o.state||(o.state={}),o.context=w,o.__n=n,p=o.__d=!0,o.__h=[],o._sb=[]),o.__s==null&&(o.__s=o.state),C.getDerivedStateFromProps!=null&&(o.__s==o.state&&(o.__s=E({},o.__s)),E(o.__s,C.getDerivedStateFromProps(h,o.__s))),a=o.props,m=o.state,o.__v=e,p)C.getDerivedStateFromProps==null&&o.componentWillMount!=null&&o.componentWillMount(),o.componentDidMount!=null&&o.__h.push(o.componentDidMount);else{if(C.getDerivedStateFromProps==null&&h!==a&&o.componentWillReceiveProps!=null&&o.componentWillReceiveProps(h,w),!o.__e&&(o.shouldComponentUpdate!=null&&o.shouldComponentUpdate(h,o.__s,w)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(o.props=h,o.state=o.__s,o.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(q){q&&(q.__=e)}),B=0;B<o._sb.length;B++)o.__h.push(o._sb[B]);o._sb=[],o.__h.length&&u.push(o);break _}o.componentWillUpdate!=null&&o.componentWillUpdate(h,o.__s,w),o.componentDidUpdate!=null&&o.__h.push(function(){o.componentDidUpdate(a,m,x)})}if(o.context=w,o.props=h,o.__P=_,o.__e=!1,T=s.__r,E_=0,"prototype"in C&&C.prototype.render){for(o.state=o.__s,o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),O=0;O<o._sb.length;O++)o.__h.push(o._sb[O]);o._sb=[]}else do o.__d=!1,T&&T(e),d=o.render(o.props,o.state,o.context),o.state=o.__s;while(o.__d&&++E_<25);o.state=o.__s,o.getChildContext!=null&&(n=E(E({},n),o.getChildContext())),p||o.getSnapshotBeforeUpdate==null||(x=o.getSnapshotBeforeUpdate(a,m)),f_(_,j(X=d!=null&&d.type===L&&d.key==null?d.props.children:d)?X:[X],e,t,n,r,i,u,l,c,f),o.base=e.__e,e.__u&=-161,o.__h.length&&u.push(o),g&&(o.__E=o.__=null)}catch(q){e.__v=null,c||i!=null?(e.__e=l,e.__u|=c?160:32,i[i.indexOf(l)]=null):(e.__e=t.__e,e.__k=t.__k),s.__e(q,e,t)}else i==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=T_(t.__e,e,t,n,r,i,u,c,f);(d=s.diffed)&&d(e)}function d_(_,e,t){e.__d=void 0;for(var n=0;n<t.length;n++)z(t[n],t[++n],t[++n]);s.__c&&s.__c(e,_),_.some(function(r){try{_=r.__h,r.__h=[],_.some(function(i){i.call(r)})}catch(i){s.__e(i,r.__v)}})}function T_(_,e,t,n,r,i,u,l,c){var f,d,o,p,a,m,x,g=t.props,h=e.props,y=e.type;if(y==="svg"&&(r=!0),i!=null){for(f=0;f<i.length;f++)if((a=i[f])&&"setAttribute"in a==!!y&&(y?a.localName===y:a.nodeType===3)){_=a,i[f]=null;break}}if(_==null){if(y===null)return document.createTextNode(h);_=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,h.is&&h),i=null,l=!1}if(y===null)g===h||l&&_.data===h||(_.data=h);else{if(i=i&&D.call(_.childNodes),g=t.props||P,!l&&i!=null)for(g={},f=0;f<_.attributes.length;f++)g[(a=_.attributes[f]).name]=a.value;for(f in g)a=g[f],f=="children"||(f=="dangerouslySetInnerHTML"?o=a:f==="key"||f in h||U(_,f,null,a,r));for(f in h)a=h[f],f=="children"?p=a:f=="dangerouslySetInnerHTML"?d=a:f=="value"?m=a:f=="checked"?x=a:f==="key"||l&&typeof a!="function"||g[f]===a||U(_,f,a,g[f],r);if(d)l||o&&(d.__html===o.__html||d.__html===_.innerHTML)||(_.innerHTML=d.__html),e.__k=[];else if(o&&(_.innerHTML=""),f_(_,j(p)?p:[p],e,t,n,r&&y!=="foreignObject",i,u,i?i[0]:t.__k&&$(t,0),l,c),i!=null)for(f=i.length;f--;)i[f]!=null&&r_(i[f]);l||(f="value",m!==void 0&&(m!==_[f]||y==="progress"&&!m||y==="option"&&m!==g[f])&&U(_,f,m,g[f],!1),f="checked",x!==void 0&&x!==_[f]&&U(_,f,x,g[f],!1))}return _}function z(_,e,t){try{typeof _=="function"?_(e):_.current=e}catch(n){s.__e(n,t)}}function G(_,e,t){var n,r;if(s.unmount&&s.unmount(_),(n=_.ref)&&(n.current&&n.current!==_.__e||z(n,null,e)),(n=_.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){s.__e(i,e)}n.base=n.__P=null,_.__c=void 0}if(n=_.__k)for(r=0;r<n.length;r++)n[r]&&G(n[r],e,t||typeof _.type!="function");t||_.__e==null||r_(_.__e),_.__=_.__e=_.__d=void 0}function D_(_,e,t){return this.constructor(_,t)}function N_(_,e,t){var n,r,i,u;s.__&&s.__(_,e),r=(n=typeof t=="function")?null:t&&t.__k||e.__k,i=[],u=[],R(e,_=(!n&&t||e).__k=H_(L,null,[_]),r||P,P,e.ownerSVGElement!==void 0,!n&&t?[t]:r?null:e.firstChild?D.call(e.childNodes):null,i,!n&&t?t:r?r.__e:e.firstChild,n,u),d_(i,_,u)}D=o_.slice,s={__e:function(_,e,t,n){for(var r,i,u;e=e.__;)if((r=e.__c)&&!r.__)try{if((i=r.constructor)&&i.getDerivedStateFromError!=null&&(r.setState(i.getDerivedStateFromError(_)),u=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(_,n||{}),u=r.__d),u)return r.__E=r}catch(l){_=l}throw _}},e_=0,I.prototype.setState=function(_,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=E({},this.state),typeof _=="function"&&(_=_(E({},t),this.props)),_&&E(t,_),_!=null&&this.__v&&(e&&this._sb.push(e),l_(this))},I.prototype.forceUpdate=function(_){this.__v&&(this.__e=!0,_&&this.__h.push(_),l_(this))},I.prototype.render=L,H=[],n_=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Z=function(_,e){return _.__v.__b-e.__v.__b},M.__r=0;var A,v,J,p_,K=0,h_=[],W=[],v_=s.__b,m_=s.__r,g_=s.diffed,y_=s.__c,b_=s.unmount;function k_(_,e){s.__h&&s.__h(v,_,K||e),K=0;var t=v.__H||(v.__H={__:[],__h:[]});return _>=t.__.length&&t.__.push({__V:W}),t.__[_]}function L_(_){return K=1,I_(x_,_)}function I_(_,e,t){var n=k_(A++,2);if(n.t=_,!n.__c&&(n.__=[t?t(e):x_(void 0,e),function(l){var c=n.__N?n.__N[0]:n.__[0],f=n.t(c,l);c!==f&&(n.__N=[f,n.__[1]],n.__c.setState({}))}],n.__c=v,!v.u)){var r=function(l,c,f){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,l,c,f);var o=!1;return d.forEach(function(p){if(p.__N){var a=p.__[0];p.__=p.__N,p.__N=void 0,a!==p.__[0]&&(o=!0)}}),!(!o&&n.__c.props===l)&&(!i||i.call(this,l,c,f))};v.u=!0;var i=v.shouldComponentUpdate,u=v.componentWillUpdate;v.componentWillUpdate=function(l,c,f){if(this.__e){var d=i;i=void 0,r(l,c,f),i=d}u&&u.call(this,l,c,f)},v.shouldComponentUpdate=r}return n.__N||n.__}function M_(_,e){var t=k_(A++,3);!s.__s&&W_(t.__H,e)&&(t.__=_,t.i=e,v.__H.__h.push(t))}function U_(){for(var _;_=h_.shift();)if(_.__P&&_.__H)try{_.__H.__h.forEach(F),_.__H.__h.forEach(Q),_.__H.__h=[]}catch(e){_.__H.__h=[],s.__e(e,_.__v)}}s.__b=function(_){v=null,v_&&v_(_)},s.__r=function(_){m_&&m_(_),A=0;var e=(v=_.__c).__H;e&&(J===v?(e.__h=[],v.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.__V=W,t.__N=t.i=void 0})):(e.__h.forEach(F),e.__h.forEach(Q),e.__h=[],A=0)),J=v},s.diffed=function(_){g_&&g_(_);var e=_.__c;e&&e.__H&&(e.__H.__h.length&&(h_.push(e)!==1&&p_===s.requestAnimationFrame||((p_=s.requestAnimationFrame)||A_)(U_)),e.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.__V!==W&&(t.__=t.__V),t.i=void 0,t.__V=W})),J=v=null},s.__c=function(_,e){e.some(function(t){try{t.__h.forEach(F),t.__h=t.__h.filter(function(n){return!n.__||Q(n)})}catch(n){e.some(function(r){r.__h&&(r.__h=[])}),e=[],s.__e(n,t.__v)}}),y_&&y_(_,e)},s.unmount=function(_){b_&&b_(_);var e,t=_.__c;t&&t.__H&&(t.__H.__.forEach(function(n){try{F(n)}catch(r){e=r}}),t.__H=void 0,e&&s.__e(e,t.__v))};var C_=typeof requestAnimationFrame=="function";function A_(_){var e,t=function(){clearTimeout(n),C_&&cancelAnimationFrame(e),setTimeout(_)},n=setTimeout(t,100);C_&&(e=requestAnimationFrame(t))}function F(_){var e=v,t=_.__c;typeof t=="function"&&(_.__c=void 0,t()),v=e}function Q(_){var e=v;_.__c=_.__(),v=e}function W_(_,e){return!_||_.length!==e.length||e.some(function(t,n){return t!==_[n]})}function x_(_,e){return typeof e=="function"?e(_):e}var F_=0;function S_(_,e,t,n,r,i){var u,l,c={};for(l in e)l=="ref"?u=e[l]:c[l]=e[l];var f={type:_,props:c,key:t,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--F_,__i:-1,__u:0,__source:r,__self:i};if(typeof _=="function"&&(u=_.defaultProps))for(l in u)c[l]===void 0&&(c[l]=u[l]);return s.vnode&&s.vnode(f),f}class V_{constructor(){Y(this,"_context");Y(this,"_getContextCallbacks",[])}async getContext(){return this._context?this._context:new Promise(e=>{this._getContextCallbacks.push(e)})}setContext(e){this._context=e,this._getContextCallbacks.forEach(t=>t(e)),this._getContextCallbacks=[]}configureClient(e){console.log("Client configured")}themeLoaded(){console.log("Theme loaded")}close(){console.log("Theme closed")}addToEcommerceCart(e){console.log("Add to cart",e)}}let V;const B_=({context:_})=>{const[e,t]=L_(null);return M_(()=>{if(e){if(V===void 0)throw new Error("Please call setSpiffDevOptions before requesting the context.");V.setContext({..._,container:e})}},[e,_]),S_("div",{ref:t,id:"spiffThemeWrapper"})};function O_(_,e){V=new V_,window.SpiffThemeLoader=V;let t;typeof _=="string"?t=document.getElementById(_):t=_,N_(S_(B_,{context:e}),t)}function q_(_){return{id:"example",themeInstallId:(_==null?void 0:_.themeInstallId)??"example",name:"Example Configuration",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",themeVersion:{id:"example",version:"1.0.0",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z",configurationSchema:{fields:[]},launchData:{targetFiles:[]},theme:{id:"example",name:"Example Theme",createdAt:"2021-01-01T00:00:00Z",updatedAt:"2021-01-01T00:00:00Z"}},fields:[],..._}}b.AssetType=__,b.FieldType=S,b.ThemeFileType=k,b.exampleThemeInstallConfig=q_,b.setSpiffDevOptions=O_,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spiffcommerce/theme-bridge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc && vite build",
|
|
7
7
|
"preview": "vite preview",
|
|
8
|
-
"dev": "ladle serve"
|
|
8
|
+
"dev": "ladle serve",
|
|
9
|
+
"schema": "ts-node --esm scripts/generateSchema.ts"
|
|
9
10
|
},
|
|
10
11
|
"main": "dist/index.umd.js",
|
|
11
12
|
"module": "dist/index.js",
|
|
@@ -19,8 +20,15 @@
|
|
|
19
20
|
"@preact/preset-vite": "^2.7.0",
|
|
20
21
|
"@spiffcommerce/core": "^19.1.0",
|
|
21
22
|
"@types/node": "^20.11.16",
|
|
23
|
+
"@typescript-eslint/eslint-plugin": "^7.1.0",
|
|
24
|
+
"@typescript-eslint/parser": "^7.1.0",
|
|
25
|
+
"eslint": "^8.57.0",
|
|
26
|
+
"eslint-config-prettier": "^9.1.0",
|
|
27
|
+
"eslint-plugin-prettier": "^5.1.3",
|
|
22
28
|
"preact": "^10.19.3",
|
|
23
29
|
"prettier": "^3.2.4",
|
|
30
|
+
"ts-json-schema-generator": "^1.5.0",
|
|
31
|
+
"ts-node": "^10.9.2",
|
|
24
32
|
"tsup": "^8.0.1",
|
|
25
33
|
"typescript": "^5.2.2",
|
|
26
34
|
"vite": "^5.0.8",
|