@uniformdev/context-vue 16.0.1-alpha.128 → 16.0.1-nuxt.149
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/LICENSE.txt +2 -0
- package/README.md +2 -15
- package/dist/index.d.ts +91 -265
- package/dist/index.esm.js +7 -0
- package/dist/index.js +7 -0
- package/dist/index.mjs +7 -0
- package/package.json +49 -19
- package/dist/index.cjs.js +0 -1
- package/dist/index.es.js +0 -770
package/dist/index.es.js
DELETED
|
@@ -1,770 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
import { provide, inject, defineComponent, unref, openBlock, createBlock, resolveDynamicComponent, normalizeProps, mergeProps, createCommentVNode, h, createElementBlock, Fragment, createVNode, renderList, withCtx, guardReactiveProps, computed, renderSlot, ref, watchEffect, resolveComponent, watch } from "vue";
|
|
30
|
-
const isServer = typeof window === "undefined";
|
|
31
|
-
const uniformContextStoreProps = Symbol("uniformContextStore");
|
|
32
|
-
const initStore = ({ context, outputType = "standard" }) => {
|
|
33
|
-
provide(uniformContextStoreProps, {
|
|
34
|
-
context,
|
|
35
|
-
outputType
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const useUniformContext = (key, fallback) => {
|
|
39
|
-
const resolved = inject(key, fallback);
|
|
40
|
-
if (!resolved) {
|
|
41
|
-
throw Error(`could not resolve ${key.description}`);
|
|
42
|
-
}
|
|
43
|
-
const value = resolved;
|
|
44
|
-
return __spreadValues({}, value);
|
|
45
|
-
};
|
|
46
|
-
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
47
|
-
__name: "TestStandard",
|
|
48
|
-
props: {
|
|
49
|
-
name: null,
|
|
50
|
-
variations: null,
|
|
51
|
-
loadingMode: null,
|
|
52
|
-
component: null
|
|
53
|
-
},
|
|
54
|
-
setup(__props) {
|
|
55
|
-
const { name, variations, component } = __props;
|
|
56
|
-
const { context } = useUniformContext(uniformContextStoreProps);
|
|
57
|
-
const { result } = context.test({
|
|
58
|
-
name,
|
|
59
|
-
variations
|
|
60
|
-
});
|
|
61
|
-
return (_ctx, _cache) => {
|
|
62
|
-
return unref(result) ? (openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({ key: 0 }, unref(result))), null, 16)) : createCommentVNode("", true);
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
/*! js-cookie v3.0.1 | MIT */
|
|
67
|
-
function assign(target) {
|
|
68
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
69
|
-
var source = arguments[i];
|
|
70
|
-
for (var key in source) {
|
|
71
|
-
target[key] = source[key];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return target;
|
|
75
|
-
}
|
|
76
|
-
var defaultConverter = {
|
|
77
|
-
read: function(value) {
|
|
78
|
-
if (value[0] === '"') {
|
|
79
|
-
value = value.slice(1, -1);
|
|
80
|
-
}
|
|
81
|
-
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
82
|
-
},
|
|
83
|
-
write: function(value) {
|
|
84
|
-
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
function init(converter, defaultAttributes) {
|
|
88
|
-
function set(key, value, attributes) {
|
|
89
|
-
if (typeof document === "undefined") {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
attributes = assign({}, defaultAttributes, attributes);
|
|
93
|
-
if (typeof attributes.expires === "number") {
|
|
94
|
-
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
|
|
95
|
-
}
|
|
96
|
-
if (attributes.expires) {
|
|
97
|
-
attributes.expires = attributes.expires.toUTCString();
|
|
98
|
-
}
|
|
99
|
-
key = encodeURIComponent(key).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
|
|
100
|
-
var stringifiedAttributes = "";
|
|
101
|
-
for (var attributeName in attributes) {
|
|
102
|
-
if (!attributes[attributeName]) {
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
stringifiedAttributes += "; " + attributeName;
|
|
106
|
-
if (attributes[attributeName] === true) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
|
|
110
|
-
}
|
|
111
|
-
return document.cookie = key + "=" + converter.write(value, key) + stringifiedAttributes;
|
|
112
|
-
}
|
|
113
|
-
function get(key) {
|
|
114
|
-
if (typeof document === "undefined" || arguments.length && !key) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
var cookies = document.cookie ? document.cookie.split("; ") : [];
|
|
118
|
-
var jar = {};
|
|
119
|
-
for (var i = 0; i < cookies.length; i++) {
|
|
120
|
-
var parts = cookies[i].split("=");
|
|
121
|
-
var value = parts.slice(1).join("=");
|
|
122
|
-
try {
|
|
123
|
-
var foundKey = decodeURIComponent(parts[0]);
|
|
124
|
-
jar[foundKey] = converter.read(value, foundKey);
|
|
125
|
-
if (key === foundKey) {
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
} catch (e) {
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return key ? jar[key] : jar;
|
|
132
|
-
}
|
|
133
|
-
return Object.create({
|
|
134
|
-
set,
|
|
135
|
-
get,
|
|
136
|
-
remove: function(key, attributes) {
|
|
137
|
-
set(key, "", assign({}, attributes, {
|
|
138
|
-
expires: -1
|
|
139
|
-
}));
|
|
140
|
-
},
|
|
141
|
-
withAttributes: function(attributes) {
|
|
142
|
-
return init(this.converter, assign({}, this.attributes, attributes));
|
|
143
|
-
},
|
|
144
|
-
withConverter: function(converter2) {
|
|
145
|
-
return init(assign({}, this.converter, converter2), this.attributes);
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
attributes: { value: Object.freeze(defaultAttributes) },
|
|
149
|
-
converter: { value: Object.freeze(converter) }
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
init(defaultConverter, { path: "/" });
|
|
153
|
-
var rfdc_1 = rfdc;
|
|
154
|
-
function copyBuffer(cur) {
|
|
155
|
-
if (cur instanceof Buffer) {
|
|
156
|
-
return Buffer.from(cur);
|
|
157
|
-
}
|
|
158
|
-
return new cur.constructor(cur.buffer.slice(), cur.byteOffset, cur.length);
|
|
159
|
-
}
|
|
160
|
-
function rfdc(opts) {
|
|
161
|
-
opts = opts || {};
|
|
162
|
-
if (opts.circles)
|
|
163
|
-
return rfdcCircles(opts);
|
|
164
|
-
return opts.proto ? cloneProto : clone;
|
|
165
|
-
function cloneArray(a, fn) {
|
|
166
|
-
var keys = Object.keys(a);
|
|
167
|
-
var a2 = new Array(keys.length);
|
|
168
|
-
for (var i = 0; i < keys.length; i++) {
|
|
169
|
-
var k = keys[i];
|
|
170
|
-
var cur = a[k];
|
|
171
|
-
if (typeof cur !== "object" || cur === null) {
|
|
172
|
-
a2[k] = cur;
|
|
173
|
-
} else if (cur instanceof Date) {
|
|
174
|
-
a2[k] = new Date(cur);
|
|
175
|
-
} else if (ArrayBuffer.isView(cur)) {
|
|
176
|
-
a2[k] = copyBuffer(cur);
|
|
177
|
-
} else {
|
|
178
|
-
a2[k] = fn(cur);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return a2;
|
|
182
|
-
}
|
|
183
|
-
function clone(o) {
|
|
184
|
-
if (typeof o !== "object" || o === null)
|
|
185
|
-
return o;
|
|
186
|
-
if (o instanceof Date)
|
|
187
|
-
return new Date(o);
|
|
188
|
-
if (Array.isArray(o))
|
|
189
|
-
return cloneArray(o, clone);
|
|
190
|
-
if (o instanceof Map)
|
|
191
|
-
return new Map(cloneArray(Array.from(o), clone));
|
|
192
|
-
if (o instanceof Set)
|
|
193
|
-
return new Set(cloneArray(Array.from(o), clone));
|
|
194
|
-
var o2 = {};
|
|
195
|
-
for (var k in o) {
|
|
196
|
-
if (Object.hasOwnProperty.call(o, k) === false)
|
|
197
|
-
continue;
|
|
198
|
-
var cur = o[k];
|
|
199
|
-
if (typeof cur !== "object" || cur === null) {
|
|
200
|
-
o2[k] = cur;
|
|
201
|
-
} else if (cur instanceof Date) {
|
|
202
|
-
o2[k] = new Date(cur);
|
|
203
|
-
} else if (cur instanceof Map) {
|
|
204
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone));
|
|
205
|
-
} else if (cur instanceof Set) {
|
|
206
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone));
|
|
207
|
-
} else if (ArrayBuffer.isView(cur)) {
|
|
208
|
-
o2[k] = copyBuffer(cur);
|
|
209
|
-
} else {
|
|
210
|
-
o2[k] = clone(cur);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return o2;
|
|
214
|
-
}
|
|
215
|
-
function cloneProto(o) {
|
|
216
|
-
if (typeof o !== "object" || o === null)
|
|
217
|
-
return o;
|
|
218
|
-
if (o instanceof Date)
|
|
219
|
-
return new Date(o);
|
|
220
|
-
if (Array.isArray(o))
|
|
221
|
-
return cloneArray(o, cloneProto);
|
|
222
|
-
if (o instanceof Map)
|
|
223
|
-
return new Map(cloneArray(Array.from(o), cloneProto));
|
|
224
|
-
if (o instanceof Set)
|
|
225
|
-
return new Set(cloneArray(Array.from(o), cloneProto));
|
|
226
|
-
var o2 = {};
|
|
227
|
-
for (var k in o) {
|
|
228
|
-
var cur = o[k];
|
|
229
|
-
if (typeof cur !== "object" || cur === null) {
|
|
230
|
-
o2[k] = cur;
|
|
231
|
-
} else if (cur instanceof Date) {
|
|
232
|
-
o2[k] = new Date(cur);
|
|
233
|
-
} else if (cur instanceof Map) {
|
|
234
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
235
|
-
} else if (cur instanceof Set) {
|
|
236
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
237
|
-
} else if (ArrayBuffer.isView(cur)) {
|
|
238
|
-
o2[k] = copyBuffer(cur);
|
|
239
|
-
} else {
|
|
240
|
-
o2[k] = cloneProto(cur);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return o2;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function rfdcCircles(opts) {
|
|
247
|
-
var refs = [];
|
|
248
|
-
var refsNew = [];
|
|
249
|
-
return opts.proto ? cloneProto : clone;
|
|
250
|
-
function cloneArray(a, fn) {
|
|
251
|
-
var keys = Object.keys(a);
|
|
252
|
-
var a2 = new Array(keys.length);
|
|
253
|
-
for (var i = 0; i < keys.length; i++) {
|
|
254
|
-
var k = keys[i];
|
|
255
|
-
var cur = a[k];
|
|
256
|
-
if (typeof cur !== "object" || cur === null) {
|
|
257
|
-
a2[k] = cur;
|
|
258
|
-
} else if (cur instanceof Date) {
|
|
259
|
-
a2[k] = new Date(cur);
|
|
260
|
-
} else if (ArrayBuffer.isView(cur)) {
|
|
261
|
-
a2[k] = copyBuffer(cur);
|
|
262
|
-
} else {
|
|
263
|
-
var index = refs.indexOf(cur);
|
|
264
|
-
if (index !== -1) {
|
|
265
|
-
a2[k] = refsNew[index];
|
|
266
|
-
} else {
|
|
267
|
-
a2[k] = fn(cur);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
return a2;
|
|
272
|
-
}
|
|
273
|
-
function clone(o) {
|
|
274
|
-
if (typeof o !== "object" || o === null)
|
|
275
|
-
return o;
|
|
276
|
-
if (o instanceof Date)
|
|
277
|
-
return new Date(o);
|
|
278
|
-
if (Array.isArray(o))
|
|
279
|
-
return cloneArray(o, clone);
|
|
280
|
-
if (o instanceof Map)
|
|
281
|
-
return new Map(cloneArray(Array.from(o), clone));
|
|
282
|
-
if (o instanceof Set)
|
|
283
|
-
return new Set(cloneArray(Array.from(o), clone));
|
|
284
|
-
var o2 = {};
|
|
285
|
-
refs.push(o);
|
|
286
|
-
refsNew.push(o2);
|
|
287
|
-
for (var k in o) {
|
|
288
|
-
if (Object.hasOwnProperty.call(o, k) === false)
|
|
289
|
-
continue;
|
|
290
|
-
var cur = o[k];
|
|
291
|
-
if (typeof cur !== "object" || cur === null) {
|
|
292
|
-
o2[k] = cur;
|
|
293
|
-
} else if (cur instanceof Date) {
|
|
294
|
-
o2[k] = new Date(cur);
|
|
295
|
-
} else if (cur instanceof Map) {
|
|
296
|
-
o2[k] = new Map(cloneArray(Array.from(cur), clone));
|
|
297
|
-
} else if (cur instanceof Set) {
|
|
298
|
-
o2[k] = new Set(cloneArray(Array.from(cur), clone));
|
|
299
|
-
} else if (ArrayBuffer.isView(cur)) {
|
|
300
|
-
o2[k] = copyBuffer(cur);
|
|
301
|
-
} else {
|
|
302
|
-
var i = refs.indexOf(cur);
|
|
303
|
-
if (i !== -1) {
|
|
304
|
-
o2[k] = refsNew[i];
|
|
305
|
-
} else {
|
|
306
|
-
o2[k] = clone(cur);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
refs.pop();
|
|
311
|
-
refsNew.pop();
|
|
312
|
-
return o2;
|
|
313
|
-
}
|
|
314
|
-
function cloneProto(o) {
|
|
315
|
-
if (typeof o !== "object" || o === null)
|
|
316
|
-
return o;
|
|
317
|
-
if (o instanceof Date)
|
|
318
|
-
return new Date(o);
|
|
319
|
-
if (Array.isArray(o))
|
|
320
|
-
return cloneArray(o, cloneProto);
|
|
321
|
-
if (o instanceof Map)
|
|
322
|
-
return new Map(cloneArray(Array.from(o), cloneProto));
|
|
323
|
-
if (o instanceof Set)
|
|
324
|
-
return new Set(cloneArray(Array.from(o), cloneProto));
|
|
325
|
-
var o2 = {};
|
|
326
|
-
refs.push(o);
|
|
327
|
-
refsNew.push(o2);
|
|
328
|
-
for (var k in o) {
|
|
329
|
-
var cur = o[k];
|
|
330
|
-
if (typeof cur !== "object" || cur === null) {
|
|
331
|
-
o2[k] = cur;
|
|
332
|
-
} else if (cur instanceof Date) {
|
|
333
|
-
o2[k] = new Date(cur);
|
|
334
|
-
} else if (cur instanceof Map) {
|
|
335
|
-
o2[k] = new Map(cloneArray(Array.from(cur), cloneProto));
|
|
336
|
-
} else if (cur instanceof Set) {
|
|
337
|
-
o2[k] = new Set(cloneArray(Array.from(cur), cloneProto));
|
|
338
|
-
} else if (ArrayBuffer.isView(cur)) {
|
|
339
|
-
o2[k] = copyBuffer(cur);
|
|
340
|
-
} else {
|
|
341
|
-
var i = refs.indexOf(cur);
|
|
342
|
-
if (i !== -1) {
|
|
343
|
-
o2[k] = refsNew[i];
|
|
344
|
-
} else {
|
|
345
|
-
o2[k] = cloneProto(cur);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
refs.pop();
|
|
350
|
-
refsNew.pop();
|
|
351
|
-
return o2;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
var ht = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", jt = new Array(123);
|
|
355
|
-
for (let e = 0; e < ht.length; e++)
|
|
356
|
-
jt[ht.charCodeAt(e)] = e;
|
|
357
|
-
rfdc_1();
|
|
358
|
-
rfdc_1();
|
|
359
|
-
rfdc_1();
|
|
360
|
-
var Pe = ((u) => (u.ListStart = "nesi-list-start", u.ListEnd = "nesi-list-end", u.ListItem = "nesi-list-item-html", u.ListItemSettings = "nesi-list-item-settings", u.TestStart = "nesi-test-start", u.TestEnd = "nesi-test-end", u.Unknown = "unknown", u))(Pe || {}), Dr = "nesitag";
|
|
361
|
-
const EdgeTag = (props) => {
|
|
362
|
-
return h(Dr, props);
|
|
363
|
-
};
|
|
364
|
-
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
365
|
-
__name: "TestEdge",
|
|
366
|
-
props: {
|
|
367
|
-
name: null,
|
|
368
|
-
variations: null,
|
|
369
|
-
loadingMode: null,
|
|
370
|
-
component: null
|
|
371
|
-
},
|
|
372
|
-
setup(__props) {
|
|
373
|
-
const { name, variations, component: renderComponent } = __props;
|
|
374
|
-
const options = {
|
|
375
|
-
name
|
|
376
|
-
};
|
|
377
|
-
return (_ctx, _cache) => {
|
|
378
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
379
|
-
createVNode(unref(EdgeTag), {
|
|
380
|
-
"data-type": unref(Pe).TestStart,
|
|
381
|
-
innerHTML: JSON.stringify(options)
|
|
382
|
-
}, null, 8, ["data-type", "innerHTML"]),
|
|
383
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.variations, (variation, index) => {
|
|
384
|
-
return openBlock(), createElementBlock(Fragment, { key: index }, [
|
|
385
|
-
createVNode(unref(EdgeTag), {
|
|
386
|
-
"data-type": unref(Pe).ListItemSettings,
|
|
387
|
-
innerHTML: JSON.stringify({ id: variation.id })
|
|
388
|
-
}, null, 8, ["data-type", "innerHTML"]),
|
|
389
|
-
createVNode(unref(EdgeTag), {
|
|
390
|
-
"data-type": unref(Pe).ListItem
|
|
391
|
-
}, {
|
|
392
|
-
default: withCtx(() => [
|
|
393
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.renderComponent), normalizeProps(guardReactiveProps(variation)), null, 16))
|
|
394
|
-
]),
|
|
395
|
-
_: 2
|
|
396
|
-
}, 1032, ["data-type"])
|
|
397
|
-
], 64);
|
|
398
|
-
}), 128)),
|
|
399
|
-
createVNode(unref(EdgeTag), {
|
|
400
|
-
"data-type": unref(Pe).TestEnd
|
|
401
|
-
}, null, 8, ["data-type"])
|
|
402
|
-
], 64);
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
407
|
-
__name: "Test",
|
|
408
|
-
props: {
|
|
409
|
-
name: null,
|
|
410
|
-
variations: null,
|
|
411
|
-
loadingMode: null,
|
|
412
|
-
component: null
|
|
413
|
-
},
|
|
414
|
-
setup(__props) {
|
|
415
|
-
const props = __props;
|
|
416
|
-
const { outputType } = useUniformContext(uniformContextStoreProps);
|
|
417
|
-
const testComponent = computed(() => !isServer || outputType === "standard" ? _sfc_main$9 : _sfc_main$8);
|
|
418
|
-
return (_ctx, _cache) => {
|
|
419
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(testComponent)), normalizeProps(guardReactiveProps(props)), null, 16);
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
424
|
-
__name: "UniformContextProvider",
|
|
425
|
-
props: {
|
|
426
|
-
context: null
|
|
427
|
-
},
|
|
428
|
-
setup(__props) {
|
|
429
|
-
const props = __props;
|
|
430
|
-
initStore(__spreadValues({}, props));
|
|
431
|
-
return (_ctx, _cache) => {
|
|
432
|
-
return renderSlot(_ctx.$slots, "default");
|
|
433
|
-
};
|
|
434
|
-
}
|
|
435
|
-
});
|
|
436
|
-
var has = Object.prototype.hasOwnProperty;
|
|
437
|
-
function dequal(foo, bar) {
|
|
438
|
-
var ctor, len;
|
|
439
|
-
if (foo === bar)
|
|
440
|
-
return true;
|
|
441
|
-
if (foo && bar && (ctor = foo.constructor) === bar.constructor) {
|
|
442
|
-
if (ctor === Date)
|
|
443
|
-
return foo.getTime() === bar.getTime();
|
|
444
|
-
if (ctor === RegExp)
|
|
445
|
-
return foo.toString() === bar.toString();
|
|
446
|
-
if (ctor === Array) {
|
|
447
|
-
if ((len = foo.length) === bar.length) {
|
|
448
|
-
while (len-- && dequal(foo[len], bar[len]))
|
|
449
|
-
;
|
|
450
|
-
}
|
|
451
|
-
return len === -1;
|
|
452
|
-
}
|
|
453
|
-
if (!ctor || typeof foo === "object") {
|
|
454
|
-
len = 0;
|
|
455
|
-
for (ctor in foo) {
|
|
456
|
-
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor))
|
|
457
|
-
return false;
|
|
458
|
-
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor]))
|
|
459
|
-
return false;
|
|
460
|
-
}
|
|
461
|
-
return Object.keys(bar).length === len;
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return foo !== foo && bar !== bar;
|
|
465
|
-
}
|
|
466
|
-
const useScores = () => {
|
|
467
|
-
const { context } = useUniformContext(uniformContextStoreProps);
|
|
468
|
-
const scores = ref(context.scores);
|
|
469
|
-
watchEffect(() => {
|
|
470
|
-
const scoringChangeListener = (updatedScores) => scores.value = updatedScores;
|
|
471
|
-
const currentScores = context.scores;
|
|
472
|
-
if (!dequal(scores, currentScores)) {
|
|
473
|
-
scores.value = currentScores;
|
|
474
|
-
}
|
|
475
|
-
context.events.on("scoresUpdated", scoringChangeListener);
|
|
476
|
-
return () => {
|
|
477
|
-
context.events.off("scoresUpdated", scoringChangeListener);
|
|
478
|
-
};
|
|
479
|
-
});
|
|
480
|
-
return scores;
|
|
481
|
-
};
|
|
482
|
-
const uniformPersonalizationContextProps = Symbol("uniformIsPersonalizedStore");
|
|
483
|
-
const initPersonalizeStore = ({ personalized = false }) => {
|
|
484
|
-
provide(uniformPersonalizationContextProps, {
|
|
485
|
-
personalized
|
|
486
|
-
});
|
|
487
|
-
};
|
|
488
|
-
const useIsPersonalized = (key, fallback) => {
|
|
489
|
-
const resolved = inject(key, fallback);
|
|
490
|
-
if (!resolved) {
|
|
491
|
-
return {
|
|
492
|
-
personalized: false
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
const value = resolved;
|
|
496
|
-
return __spreadValues({}, value);
|
|
497
|
-
};
|
|
498
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
499
|
-
__name: "PersonalizeProvider",
|
|
500
|
-
props: {
|
|
501
|
-
personalized: { type: Boolean }
|
|
502
|
-
},
|
|
503
|
-
setup(__props) {
|
|
504
|
-
const { personalized } = __props;
|
|
505
|
-
initPersonalizeStore({
|
|
506
|
-
personalized
|
|
507
|
-
});
|
|
508
|
-
return (_ctx, _cache) => {
|
|
509
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ personalized: __props.personalized })));
|
|
510
|
-
};
|
|
511
|
-
}
|
|
512
|
-
});
|
|
513
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
514
|
-
__name: "PersonalizeStandard",
|
|
515
|
-
props: {
|
|
516
|
-
name: null,
|
|
517
|
-
variations: null,
|
|
518
|
-
component: null,
|
|
519
|
-
count: null
|
|
520
|
-
},
|
|
521
|
-
setup(__props) {
|
|
522
|
-
const { name, component, variations, count = 1 } = __props;
|
|
523
|
-
const { context } = useUniformContext(uniformContextStoreProps);
|
|
524
|
-
const scores = useScores();
|
|
525
|
-
const personalized = computed(() => {
|
|
526
|
-
if (scores.value, component) {
|
|
527
|
-
const { variations: personalizedVariations, personalized: personalizationOccurred } = context.personalize({
|
|
528
|
-
name,
|
|
529
|
-
variations,
|
|
530
|
-
take: count
|
|
531
|
-
});
|
|
532
|
-
return {
|
|
533
|
-
personalizedVariations,
|
|
534
|
-
personalizationOccurred
|
|
535
|
-
};
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
return (_ctx, _cache) => {
|
|
539
|
-
return openBlock(), createBlock(_sfc_main$5, { personalized: true }, {
|
|
540
|
-
default: withCtx(() => {
|
|
541
|
-
var _a;
|
|
542
|
-
return [
|
|
543
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList((_a = unref(personalized)) == null ? void 0 : _a.personalizedVariations, (item) => {
|
|
544
|
-
var _a2;
|
|
545
|
-
return openBlock(), createBlock(resolveDynamicComponent(__props.component), normalizeProps(mergeProps({
|
|
546
|
-
key: item.id
|
|
547
|
-
}, __spreadValues({
|
|
548
|
-
personalizationResult: {
|
|
549
|
-
variation: item,
|
|
550
|
-
personalizationOccurred: (_a2 = unref(personalized)) == null ? void 0 : _a2.personalizationOccurred
|
|
551
|
-
}
|
|
552
|
-
}, item))), null, 16);
|
|
553
|
-
}), 128))
|
|
554
|
-
];
|
|
555
|
-
}),
|
|
556
|
-
_: 1
|
|
557
|
-
});
|
|
558
|
-
};
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
562
|
-
__name: "PersonalizeEdge",
|
|
563
|
-
props: {
|
|
564
|
-
name: null,
|
|
565
|
-
variations: null,
|
|
566
|
-
component: null,
|
|
567
|
-
count: null
|
|
568
|
-
},
|
|
569
|
-
setup(__props) {
|
|
570
|
-
const { component, variations, count } = __props;
|
|
571
|
-
const options = count != null ? count : 1;
|
|
572
|
-
return (_ctx, _cache) => {
|
|
573
|
-
const _component_component = resolveComponent("component");
|
|
574
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
575
|
-
createVNode(unref(EdgeTag), {
|
|
576
|
-
"data-type": unref(Pe).ListStart,
|
|
577
|
-
innerHTML: JSON.stringify(unref(options))
|
|
578
|
-
}, null, 8, ["data-type", "innerHTML"]),
|
|
579
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.variations, (variant) => {
|
|
580
|
-
return openBlock(), createElementBlock(Fragment, {
|
|
581
|
-
key: variant.id
|
|
582
|
-
}, [
|
|
583
|
-
createVNode(unref(EdgeTag), {
|
|
584
|
-
"data-type": unref(Pe).ListItemSettings,
|
|
585
|
-
innerHTML: JSON.stringify({ id: variant.id, pz: variant.pz || null })
|
|
586
|
-
}, null, 8, ["data-type", "innerHTML"]),
|
|
587
|
-
createVNode(unref(EdgeTag), {
|
|
588
|
-
"data-type": unref(Pe).ListItem
|
|
589
|
-
}, {
|
|
590
|
-
default: withCtx(() => [
|
|
591
|
-
(openBlock(), createBlock(_component_component, {
|
|
592
|
-
key: variant.id,
|
|
593
|
-
personalizationResult: {
|
|
594
|
-
variant,
|
|
595
|
-
personalizationOccurred: false
|
|
596
|
-
}
|
|
597
|
-
}, null, 8, ["personalizationResult"]))
|
|
598
|
-
]),
|
|
599
|
-
_: 2
|
|
600
|
-
}, 1032, ["data-type"])
|
|
601
|
-
], 64);
|
|
602
|
-
}), 128)),
|
|
603
|
-
createVNode(unref(EdgeTag), {
|
|
604
|
-
"data-type": unref(Pe).ListEnd
|
|
605
|
-
}, null, 8, ["data-type"])
|
|
606
|
-
], 64);
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
});
|
|
610
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
611
|
-
__name: "Personalize",
|
|
612
|
-
props: {
|
|
613
|
-
name: null,
|
|
614
|
-
variations: null,
|
|
615
|
-
component: null,
|
|
616
|
-
count: null
|
|
617
|
-
},
|
|
618
|
-
setup(__props) {
|
|
619
|
-
const props = __props;
|
|
620
|
-
const { outputType } = useUniformContext(uniformContextStoreProps);
|
|
621
|
-
const personalizeComponent = computed(() => !isServer || outputType === "standard" ? _sfc_main$4 : _sfc_main$3);
|
|
622
|
-
return (_ctx, _cache) => {
|
|
623
|
-
return openBlock(), createBlock(resolveDynamicComponent(unref(personalizeComponent)), normalizeProps(guardReactiveProps(__spreadValues({}, props))), null, 16);
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
628
|
-
__name: "Track",
|
|
629
|
-
props: {
|
|
630
|
-
behavior: null,
|
|
631
|
-
tagName: { default: "div" },
|
|
632
|
-
disableVisibilityTrigger: { type: Boolean },
|
|
633
|
-
threshold: { default: 0.5 }
|
|
634
|
-
},
|
|
635
|
-
setup(__props) {
|
|
636
|
-
const _a = __props, {
|
|
637
|
-
behavior,
|
|
638
|
-
tagName,
|
|
639
|
-
threshold,
|
|
640
|
-
disableVisibilityTrigger = typeof window === "undefined" || !("IntersectionObserver" in window)
|
|
641
|
-
} = _a, rest = __objRest(_a, [
|
|
642
|
-
"behavior",
|
|
643
|
-
"tagName",
|
|
644
|
-
"threshold",
|
|
645
|
-
"disableVisibilityTrigger"
|
|
646
|
-
]);
|
|
647
|
-
const currentUrl = typeof document === "undefined" ? "__uniform_ssr_url" : document.location.href;
|
|
648
|
-
const { context } = useUniformContext(uniformContextStoreProps);
|
|
649
|
-
const { personalized: insidePersonalizeComponent } = useIsPersonalized(uniformPersonalizationContextProps);
|
|
650
|
-
const lastUrl = ref("");
|
|
651
|
-
const hasTracked = ref(false);
|
|
652
|
-
const wrapperEl = ref();
|
|
653
|
-
const disconnect = ref();
|
|
654
|
-
watchEffect(() => {
|
|
655
|
-
const urlHasChanged = lastUrl.value !== currentUrl;
|
|
656
|
-
if (urlHasChanged) {
|
|
657
|
-
lastUrl.value = currentUrl;
|
|
658
|
-
hasTracked.value = false;
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
watchEffect(() => {
|
|
662
|
-
var _a2;
|
|
663
|
-
const hasNoBehaviorValue = !behavior || Array.isArray(behavior) && !behavior.length;
|
|
664
|
-
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue;
|
|
665
|
-
if (cannotTrack || !wrapperEl.value) {
|
|
666
|
-
return;
|
|
667
|
-
}
|
|
668
|
-
const enrichments = Array.isArray(behavior) ? behavior : [behavior];
|
|
669
|
-
const pushBehaviorEnrichment = () => {
|
|
670
|
-
var _a3;
|
|
671
|
-
if (hasTracked.value) {
|
|
672
|
-
return;
|
|
673
|
-
}
|
|
674
|
-
context.update({
|
|
675
|
-
enrichments
|
|
676
|
-
});
|
|
677
|
-
hasTracked.value = false;
|
|
678
|
-
(_a3 = disconnect.value) == null ? void 0 : _a3.call(disconnect);
|
|
679
|
-
};
|
|
680
|
-
if (disableVisibilityTrigger) {
|
|
681
|
-
pushBehaviorEnrichment();
|
|
682
|
-
} else {
|
|
683
|
-
(_a2 = disconnect.value) == null ? void 0 : _a2.call(disconnect);
|
|
684
|
-
const instance = new IntersectionObserver(([entry]) => {
|
|
685
|
-
if (entry.isIntersecting) {
|
|
686
|
-
pushBehaviorEnrichment();
|
|
687
|
-
}
|
|
688
|
-
}, {
|
|
689
|
-
threshold
|
|
690
|
-
});
|
|
691
|
-
instance.observe(wrapperEl.value);
|
|
692
|
-
disconnect.value = () => {
|
|
693
|
-
var _a3;
|
|
694
|
-
return (_a3 = instance.disconnect) == null ? void 0 : _a3.call(instance);
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
return () => {
|
|
698
|
-
var _a3;
|
|
699
|
-
(_a3 = disconnect.value) == null ? void 0 : _a3.call(disconnect);
|
|
700
|
-
};
|
|
701
|
-
});
|
|
702
|
-
return (_ctx, _cache) => {
|
|
703
|
-
return openBlock(), createBlock(resolveDynamicComponent(tagName), mergeProps(__spreadValues({}, rest), {
|
|
704
|
-
ref_key: "wrapperEl",
|
|
705
|
-
ref: wrapperEl
|
|
706
|
-
}), {
|
|
707
|
-
default: withCtx(() => [
|
|
708
|
-
renderSlot(_ctx.$slots, "default")
|
|
709
|
-
]),
|
|
710
|
-
_: 3
|
|
711
|
-
}, 16);
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
716
|
-
__name: "TrackSlot",
|
|
717
|
-
props: {
|
|
718
|
-
behavior: null
|
|
719
|
-
},
|
|
720
|
-
setup(__props) {
|
|
721
|
-
const _a = __props, { behavior } = _a, rest = __objRest(_a, ["behavior"]);
|
|
722
|
-
const currentUrl = typeof document === "undefined" ? "__uniform_ssr_url" : document.location.href;
|
|
723
|
-
const { context } = useUniformContext(uniformContextStoreProps);
|
|
724
|
-
const { personalized: insidePersonalizeComponent } = useIsPersonalized(uniformPersonalizationContextProps);
|
|
725
|
-
const lastUrl = ref("");
|
|
726
|
-
const hasTracked = ref(false);
|
|
727
|
-
watchEffect(() => {
|
|
728
|
-
const urlHasChanged = lastUrl.value !== currentUrl;
|
|
729
|
-
if (urlHasChanged) {
|
|
730
|
-
lastUrl.value = currentUrl;
|
|
731
|
-
hasTracked.value = false;
|
|
732
|
-
}
|
|
733
|
-
});
|
|
734
|
-
watchEffect(() => {
|
|
735
|
-
const hasNoBehaviorValue = !behavior || Array.isArray(behavior) && !behavior.length;
|
|
736
|
-
const cannotTrack = insidePersonalizeComponent || hasNoBehaviorValue;
|
|
737
|
-
if (cannotTrack)
|
|
738
|
-
return;
|
|
739
|
-
const pushBehaviorEnrichment = () => {
|
|
740
|
-
if (hasTracked.value) {
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
const enrichments = Array.isArray(behavior) ? behavior : [behavior];
|
|
744
|
-
context.update({
|
|
745
|
-
enrichments
|
|
746
|
-
});
|
|
747
|
-
hasTracked.value = true;
|
|
748
|
-
};
|
|
749
|
-
pushBehaviorEnrichment();
|
|
750
|
-
});
|
|
751
|
-
return (_ctx, _cache) => {
|
|
752
|
-
return renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(__spreadValues({}, _ctx.rest))));
|
|
753
|
-
};
|
|
754
|
-
}
|
|
755
|
-
});
|
|
756
|
-
const useQuirks = () => {
|
|
757
|
-
const { context } = useUniformContext(uniformContextStoreProps);
|
|
758
|
-
const quirks = ref(context.quirks);
|
|
759
|
-
const quirkChangeListener = (updateQuirks) => {
|
|
760
|
-
quirks.value = updateQuirks;
|
|
761
|
-
};
|
|
762
|
-
watch(context, () => {
|
|
763
|
-
context.events.on("quirksUpdated", quirkChangeListener);
|
|
764
|
-
return () => {
|
|
765
|
-
context.events.off("quirksUpdated", quirkChangeListener);
|
|
766
|
-
};
|
|
767
|
-
});
|
|
768
|
-
return quirks;
|
|
769
|
-
};
|
|
770
|
-
export { _sfc_main$2 as Personalize, _sfc_main$7 as Test, _sfc_main$1 as Track, _sfc_main as TrackSlot, _sfc_main$6 as UniformContextProvider, initPersonalizeStore, initStore, uniformContextStoreProps, useIsPersonalized, useQuirks, useScores, useUniformContext };
|